{"id":28524421,"url":"https://github.com/tlsfuzzer/mlkem-sct-toolkit","last_synced_at":"2025-07-06T08:31:44.421Z","repository":{"id":287097467,"uuid":"873814144","full_name":"tlsfuzzer/mlkem-sct-toolkit","owner":"tlsfuzzer","description":"Toolkit for testing ML-KEM implementations for side-channel leakage","archived":false,"fork":false,"pushed_at":"2025-06-02T13:26:49.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-03T02:27:54.590Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tlsfuzzer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-16T19:05:33.000Z","updated_at":"2025-06-02T13:26:53.000Z","dependencies_parsed_at":"2025-04-10T00:28:19.003Z","dependency_job_id":"ee0e29c0-ad2b-46a8-87c9-9c8c515ebd31","html_url":"https://github.com/tlsfuzzer/mlkem-sct-toolkit","commit_stats":null,"previous_names":["tlsfuzzer/mlkem-sct-toolkit"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tlsfuzzer/mlkem-sct-toolkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlsfuzzer%2Fmlkem-sct-toolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlsfuzzer%2Fmlkem-sct-toolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlsfuzzer%2Fmlkem-sct-toolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlsfuzzer%2Fmlkem-sct-toolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tlsfuzzer","download_url":"https://codeload.github.com/tlsfuzzer/mlkem-sct-toolkit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlsfuzzer%2Fmlkem-sct-toolkit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263870239,"owners_count":23522647,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-09T10:45:01.143Z","updated_at":"2025-07-06T08:31:44.414Z","avatar_url":"https://github.com/tlsfuzzer.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Toolkit for testing ML-KEM implementations for side-channel leakage.\n\nNote: it is a very early version of it, with a lot of pieces moving around still.\nTo understand how it works, I highly recommend first getting familiar with the\ngeneral timing analysis in `tlsfuzzer`:\nhttps://tlsfuzzer.readthedocs.io/en/latest/timing-analysis.html\nand the Marvin toolkit:\nhttps://github.com/tomato42/marvin-toolkit/\n\nVery rough steps to follow:\n----------------\n\nCreate private keys for the harness to use:\n```\nopenssl genpkey -algorithm ml-kem-768 -out ml-kem-768-dk.pem\nopenssl pkey -pubout -in ml-kem-768-dk.pem -out ml-kem-768-ek.pem\n```\nGenerate test vectors:\n```\nPYTHONPATH=../tlsfuzzer ../tlsfuzzer/venv-py3-opt-deps/bin/python3 ml_kem_encap.py --force -o test-dir/ -c ml-kem-768-ek.pem --repeat 10000 valid=0 valid=1 valid=2 random=0 random=1 xor_u_coefficient=\"0 1\" xor_u_coefficient=\"-1 1\" xor_v_coefficient=\"0 1\" xor_v_coefficient=\"-1 1\" one_u_remain=0 one_u_remain=1 one_u_remain=2 one_v_remain=0 one_v_remain=-1\n```\nRun the system under test/test harness\n```\nPYTHONPATH=../tlsfuzzer taskset --cpu-list 0 ../tlsfuzzer/venv-py3-opt-deps/bin/python3 harness/kyber-py/mlkem_decap.py -i test-dir/ciphers.bin -o test-dir/raw_times.csv -k ml-kem-768-dk.pem -n 1088\n```\nExtract the data:\n```\nPYTHONPATH=../tlsfuzzer ../tlsfuzzer/venv-py3-opt-deps/bin/python3 ../tlsfuzzer/tlsfuzzer/extract.py -o test-dir -l test-dir/log.csv --raw-time test-dir/raw_times.csv --clock-frequency 1000\n```\nor, with extracting of the intermediate values:\n```\nPYTHONPATH=~/dev/tlsfuzzer:~/dev/kyber-py/src/ ~/dev/tlsfuzzer/venv-py3-opt-deps/bin/python extract.py -o test-dir --ml-kem-keys ml-kem-768-dk.pem --raw-values test-dir/ciphers.bin -l test-dir/log.csv --raw-time test-dir/raw_times.csv --clock-frequency 1000\n```\n\nAnalysis of the data:\n```\nPYTHONPATH=../tlsfuzzer ../tlsfuzzer/venv-py3-opt-deps/bin/python3 ../tlsfuzzer/tlsfuzzer/analysis.py -o test-dir --verbose\n```\n\nAnalysis of the intermediate values:\n```\nfor file in bit-size-min-w bit-size-s-hat-dot-u-hat bit-size-w first-diff-c-c-prime hd-c-c-prime hw-c-prime hw-m-prime hw-r-prime hw-s-hat-dot-u-hat hw-w last-diff-c-c-prime; do\n    mkdir test-dir-$file\n    cp test-dir/measurements-$file.csv test-dir-$file/measurements.csv\n    PYTHONPATH=../tlsfuzzer ../tlsfuzzer/venv-py3-opt-deps/bin/python3 ../tlsfuzzer/tlsfuzzer/analysis.py -o test-dir-$file/ --verbose --summary-only --Hamming-weight --minimal-analysis --no-sign-test \ndone\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftlsfuzzer%2Fmlkem-sct-toolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftlsfuzzer%2Fmlkem-sct-toolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftlsfuzzer%2Fmlkem-sct-toolkit/lists"}