{"id":"RUSTSEC-2026-0212","summary":"Potentially Incorrect Output of Constant-Time Swap/Select on Aarch64","details":"The implementation of constant-time swap and select on aarch64\nplatforms used a `cmp` instruction in inline assembly to check whether\nan 8-bit wide selector was 0. The `cmp` instruction works on 32-bit\nregisters, which included the unspecified high 24 bits of the `cmp` operand.\nDepending on the execution environment the `cmp`\ncould thus potentially return an incorrect result because its\noperand's high bits in the inline assembly were set when Rust expected them to be unset.\nThis could lead to incorrect results for the constant-time swap and select\noperations built from this comparison.\n\n## Impact\nIn certain circumstances the swap and select instructions on aarch64\nplatforms returned incorrect results.\n\n## Mitigation\nStarting from version `0.0.6`, the selector is compared using a `tst`\ninstruction with a mask, which only compares the first 8 bits of the\nselector.","modified":"2026-07-17T11:45:03.712828005Z","published":"2026-05-26T12:00:00Z","database_specific":{"license":"CC0-1.0"},"references":[{"type":"PACKAGE","url":"https://crates.io/crates/libcrux-secrets"},{"type":"ADVISORY","url":"https://rustsec.org/advisories/RUSTSEC-2026-0212.html"},{"type":"WEB","url":"https://github.com/celabshq/libcrux/pull/1461"}],"affected":[{"package":{"name":"libcrux-secrets","ecosystem":"crates.io","purl":"pkg:cargo/libcrux-secrets"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0.0.0-0"},{"fixed":"0.0.6"}]}],"ecosystem_specific":{"affects":{"functions":["libcrux_secrets::Select::select","libcrux_secrets::Swap::swap"],"arch":[],"os":[]},"affected_functions":null},"database_specific":{"informational":null,"categories":[],"source":"https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2026-0212.json","cvss":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"}]}