Add lint to check for NULL parameters in the AlgorithmIdentifier element of CRLs, when mandatory per RFC 4055#1040
Merged
christopher-henderson merged 5 commits intoMay 10, 2026
Conversation
christopher-henderson
approved these changes
May 10, 2026
christopher-henderson
left a comment
Member
There was a problem hiding this comment.
Thank you for this lint!
It's not easy when cryptobyte has to be whipped so that you can manually walk through the structure. So your work is very much appreciated.
| // Attempt to read the parameters element | ||
| var nullBytes cryptobyte.String | ||
| var nullFound bool | ||
| if !signatureAlgorithmBytes.ReadOptionalASN1(&nullBytes, &nullFound, asn1.NULL) { |
There was a problem hiding this comment.
-- Pointless Commentary --
cryptobyte is both very useful and very clearly a C library pretending to be Go library 😆
I have to reckon that these are 1:1 translations, minus the fact these are methods on a *String rather than functions that take in a *String.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Suspicious of a recent incident, I noticed that Zlint lacks a certain check on the signature algorithm identifier of CRLs. Specifically, it lacks verification that — when the signature algorithm is one of the four
shaXXXWIthRSAEncryptionalgorithms (with XXX being one of 224, 256, 384, 512) — the mandatoryparameterselement is present and set to NULL, as required by RFC 4055 Section 6 (which is referenced by RFC 5280). A similar check already exists for certificates, but not for CRLs, so here's my proposal. In my lint, I perform this check on the outer AlgorithmIdentifier. I think examining the inner or the outer one is equivalent, since the two are supposed be identical (and if they aren't, it's a different problem that IMO should be addressed by a separate lint).