Skip to content

Conversation

@cjpatton
Copy link
Collaborator

Two commits in this PR. The first adds regression tests to make sure the raw NIDs don't change. The second one changes the implementation of Cipher::from_nid() so that it properly handles the GCM ciphers. Note that the 3DES is still not handled correctly.

@cjpatton cjpatton force-pushed the cjpatton/fun-with-nids branch 2 times, most recently from 20d2309 to 8eac919 Compare February 10, 2026 16:07
@cjpatton cjpatton requested a review from kornelski February 10, 2026 16:08
@cjpatton cjpatton changed the title sym: Handle GCM NIDs properly symm: Handle GCM NIDs properly Feb 10, 2026
This method returns `None` for the GCM NIDs.

It appears to be implemented incorrectly: It first calls
`OBJ_nid2sn(nid)` to get the NID's short name, then calls
`EVP_get_cipherbyname(name)`. The documentation isn't clear as to
whether `name` should be the short or long name, but it appears to
expect the long name. At least, changing to `OBJ_nid2sn()` to
`OBJ_nid2ln()` makes the method work properly,

To fix this, this commit calls `EVP_get_cipherbynid()`, which is is more
direct.

Note that the method still returns `None` on the 3DES NID, but we're not
likely to encounter this one in practice.
@cjpatton cjpatton force-pushed the cjpatton/fun-with-nids branch from 8eac919 to 0847d31 Compare February 10, 2026 16:15
@kornelski kornelski merged commit 559fc27 into master Feb 10, 2026
25 checks passed
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.

2 participants