-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve X.509 cert writing serial number management #6883
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there was a misunderstanding about the intended API of the new function. Also, a bit more work is needed to fully handle the deprecation, and as you correctly pointed out, our code was not compliant before this PR, so there's also a bit more work that comes with fixing that bug!
ChangeLog.d/improve_x509_cert_writing_serial_number_management.txt
Outdated
Show resolved
Hide resolved
f0f6b57
to
fda367e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going in the right direction, the two main things remaining are the serial argument of the example program, and encoding of of numbers that would look negative. For that part, I think (but didn't check) that we might have a test gap, as it looks "01" is the only value of serial that we are testing. If that's the case, please add tests with other relevant serial values.
9f4a08b
to
679474d
Compare
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
…TLS_DEPRECATED_REMOVED Signed-off-by: Valerio Setti <vsetti@baylibre.com>
…al_new Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
- enhance mbedtls_x509write_crt_set_serial(): avoid use of useless temporary buffer - fix mbedtls_x509write_crt_der(): add an extra 0x00 byte at the beginning of serial if the MSb of serial is 1, as required from ASN.1 Signed-off-by: Valerio Setti <vsetti@baylibre.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some changes requested.
It would be great to add some tests using mbedtls_x509_crt_info
and check that the set serial number is then properly printed (and test it), but I'm not sure if it isn't a bit too much. Wdyt, @mpg?
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
I also added some |
aaf2fbf
to
f9d1ece
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good to me, but I seem to always want more test cases :)
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
f9d1ece
to
18b9b03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* \param ctx CRT context to use | ||
* \param serial A raw array of bytes containing the serial number in big | ||
* endian format | ||
* \param serial_len Length of valid bytes (expressed in bytes) in \p serial |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Length of valid bytes (expressed in bytes) is redundant, but that's just a minor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only blocker for me is the fact that newly added lines 134 - 137 of x509write_crt.c
are not covered by any test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenCI seems to have a spurious failure. Thanks for addressing all the comments!
These changes the ABI but not the API, as the changes fields were private, so the failure of ABI-API-checking is acceptable. |
Description
The goal of this PR is to remove any direct dependency of X509 certificate writing from BIGNUM_C.
Resolves #6843
Gatekeeper checklist