-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Split numeric string conversions out of the OID module #9413
Split numeric string conversions out of the OID module #9413
Conversation
63871e7
to
858ac4e
Compare
11928d6
to
26ac2e7
Compare
8878168
to
ac6e0bf
Compare
This commit moves the function declarations for mbedtls_oid_get_numeric_string and mbedtls_oid_from_numeric_string from oid.h to x509.h. Signed-off-by: Sam Berry <sam.berry@arm.com>
This commit moves the mbedtls_oid_get_numeric_string function definition from oid.c to x509.c. Signed-off-by: Sam Berry <sam.berry@arm.com>
This commit moves all related mbedtls_oid_get_numeric_string unit tests from test_suite_oid to test_suite_x509parse. Signed-off-by: Sam Berry <sam.berry@arm.com>
This commit moves the mbedtls_oid_from_numeric_string function definition from oid.c to x509_create.c Signed-off-by: Sam Berry <sam.berry@arm.com>
This commit moves all related mbedtls_oid_from_numeric_string unit tests from test_suite_oid to test_suite_x509write. Signed-off-by: Sam Berry <sam.berry@arm.com>
This commit moves static functions that are necessary for mbedtls_oid_get_numeric_string and mbedtls_oid_from_numeric_string from oid.c to x509.c Signed-off-by: Sam Berry <sam.berry@arm.com>
Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
d1a33b8
to
e5b261f
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.
One test case dependency typo, LGTM otherwise
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, thanks!
No backports required as this is an API-breaking refactor that we are doing for 4.0. Please add words to that effect after the backport checkboxes in the PR description and tick them.
Co-authored-by: David Horstmann <david.horstmann@arm.com> Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
57309c9
to
94c3065
Compare
@@ -805,6 +805,75 @@ static char nibble_to_hex_digit(int i) | |||
return (i < 10) ? (i + '0') : (i - 10 + 'A'); | |||
} | |||
|
|||
/* Return the x.y.z.... style numeric string for the given OID */ |
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.
Shouldn't this also be guarded by #if defined(MBEDTLS_OID_C)
?
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 am not too sure, since issue 9379 mentions that this function is explicity used by mbedtls_x509_dn_gets
and I believe the only guard should be MBEDTLS_X509_USE_C
.
I am unsure however, so is anyone able to clear this up further?
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 functions are moving from the OID module to an X.509 module. So none of the code added by this PR should be guarded by MBEDTLS_OID_C
. Instead it should be guarded by whatever MBEDTLS_X509_XXX
options are needed at the point where the X.509 code uses them.
library/x509_create.c
Outdated
@@ -278,6 +278,186 @@ static int parse_attribute_value_hex_der_encoded(const char *s, | |||
return MBEDTLS_ERR_X509_INVALID_NAME; | |||
} | |||
|
|||
#if defined(MBEDTLS_OID_C) |
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.
#if defined(MBEDTLS_OID_C) |
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.
Removed, thanks
This commit removes the MBEDTLS_OID_C guard from the static functions in the library/x509_create.c as this function is no longer included in the oid.c file. Signed-off-by: Harry Ramsey <harry.ramsey@arm.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.
LGTM, thanks!
Moved functions are guarded by MBEDTLS_X509_USE_C
and MBEDTLS_X509_CREATE_C
since these guard x509.c
and x509_create.c
respectively.
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 too, thanks!
b268d27
Fixes #9379
PR checklist