Skip to content

pkcs1v15: use ctutils::CtGt to address TODO - #726

Merged
tarcieri merged 1 commit into
masterfrom
pkcs1v15/use-ctgt-to-address-todo
Oct 19, 2026
Merged

tarcieri merged 1 commit into
masterfrom
pkcs1v15/use-ctgt-to-address-todo

Conversation

@tarcieri

Copy link
Copy Markdown
Member

No description provided.

let valid_ps = Choice::from_u8_lsb((((2i32 + 8i32 - index as i32 - 1i32) >> 31) & 1) as u8);
// PS starts at offset 2 and must contain at least 8 nonzero octets,
// so the first zero separator must occur at offset 10 or later.
let valid_ps = index.ct_gt(&9);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This unfortunately doesn't exist but would be a clearer way to write it:

Suggested change
let valid_ps = index.ct_gt(&9);
let valid_ps = index.ct_ge(&10);

Thought about leaving a comment to that effect.

@tarcieri
tarcieri merged commit f550922 into master Oct 19, 2026
12 checks passed
@tarcieri
tarcieri deleted the pkcs1v15/use-ctgt-to-address-todo branch October 19, 2026 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant