x509: replace/fix name of new function for setting serial
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
48fdbb3940
commit
af4815c6a4
5 changed files with 8 additions and 8 deletions
|
@ -6,7 +6,7 @@ Bugfix
|
||||||
|
|
||||||
New deprecations
|
New deprecations
|
||||||
* mbedtls_x509write_crt_set_serial() is now being deprecated in favor of
|
* mbedtls_x509write_crt_set_serial() is now being deprecated in favor of
|
||||||
mbedtls_x509write_crt_set_serial_new(). The goal here is to remove any
|
mbedtls_x509write_crt_set_serial_raw(). The goal here is to remove any
|
||||||
direct dependency of X509 on BIGNUM_C.
|
direct dependency of X509 on BIGNUM_C.
|
||||||
|
|
||||||
Changes
|
Changes
|
||||||
|
|
|
@ -993,7 +993,7 @@ void mbedtls_x509write_crt_set_version(mbedtls_x509write_cert *ctx, int version)
|
||||||
*
|
*
|
||||||
* \deprecated This function is deprecated and will be removed in a
|
* \deprecated This function is deprecated and will be removed in a
|
||||||
* future version of the library. Please use
|
* future version of the library. Please use
|
||||||
* mbedtls_x509write_crt_set_serial_new() instead.
|
* mbedtls_x509write_crt_set_serial_raw() instead.
|
||||||
*
|
*
|
||||||
* \note Even though the MBEDTLS_BIGNUM_C guard looks redundant since
|
* \note Even though the MBEDTLS_BIGNUM_C guard looks redundant since
|
||||||
* X509 depends on PK and PK depends on BIGNUM, this emphasizes
|
* X509 depends on PK and PK depends on BIGNUM, this emphasizes
|
||||||
|
@ -1021,7 +1021,7 @@ int MBEDTLS_DEPRECATED mbedtls_x509write_crt_set_serial(
|
||||||
* MBEDTLS_ERR_X509_BAD_INPUT_DATA if the provided input buffer
|
* MBEDTLS_ERR_X509_BAD_INPUT_DATA if the provided input buffer
|
||||||
* is too big (longer than MBEDTLS_X509_RFC5280_MAX_SERIAL_LEN)
|
* is too big (longer than MBEDTLS_X509_RFC5280_MAX_SERIAL_LEN)
|
||||||
*/
|
*/
|
||||||
int mbedtls_x509write_crt_set_serial_new(mbedtls_x509write_cert *ctx,
|
int mbedtls_x509write_crt_set_serial_raw(mbedtls_x509write_cert *ctx,
|
||||||
unsigned char *serial, size_t serial_len);
|
unsigned char *serial, size_t serial_len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -124,7 +124,7 @@ int mbedtls_x509write_crt_set_serial(mbedtls_x509write_cert *ctx,
|
||||||
}
|
}
|
||||||
#endif // MBEDTLS_BIGNUM_C && !MBEDTLS_DEPRECATED_REMOVED
|
#endif // MBEDTLS_BIGNUM_C && !MBEDTLS_DEPRECATED_REMOVED
|
||||||
|
|
||||||
int mbedtls_x509write_crt_set_serial_new(mbedtls_x509write_cert *ctx,
|
int mbedtls_x509write_crt_set_serial_raw(mbedtls_x509write_cert *ctx,
|
||||||
unsigned char *serial, size_t serial_len)
|
unsigned char *serial, size_t serial_len)
|
||||||
{
|
{
|
||||||
if (serial_len > MBEDTLS_X509_RFC5280_MAX_SERIAL_LEN) {
|
if (serial_len > MBEDTLS_X509_RFC5280_MAX_SERIAL_LEN) {
|
||||||
|
|
|
@ -736,10 +736,10 @@ usage:
|
||||||
mbedtls_x509write_crt_set_version(&crt, opt.version);
|
mbedtls_x509write_crt_set_version(&crt, opt.version);
|
||||||
mbedtls_x509write_crt_set_md_alg(&crt, opt.md);
|
mbedtls_x509write_crt_set_md_alg(&crt, opt.md);
|
||||||
|
|
||||||
ret = mbedtls_x509write_crt_set_serial_new(&crt, serial, serial_len);
|
ret = mbedtls_x509write_crt_set_serial_raw(&crt, serial, serial_len);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
mbedtls_strerror(ret, buf, sizeof(buf));
|
mbedtls_strerror(ret, buf, sizeof(buf));
|
||||||
mbedtls_printf(" failed\n ! mbedtls_x509write_crt_set_serial_new "
|
mbedtls_printf(" failed\n ! mbedtls_x509write_crt_set_serial_raw "
|
||||||
"returned -0x%04x - %s\n\n", (unsigned int) -ret, buf);
|
"returned -0x%04x - %s\n\n", (unsigned int) -ret, buf);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -397,7 +397,7 @@ void x509_crt_check(char *subject_key_file, char *subject_pwd,
|
||||||
serial_arg->len) == 0);
|
serial_arg->len) == 0);
|
||||||
TEST_ASSERT(mbedtls_x509write_crt_set_serial(&crt, &serial_mpi) == 0);
|
TEST_ASSERT(mbedtls_x509write_crt_set_serial(&crt, &serial_mpi) == 0);
|
||||||
#else
|
#else
|
||||||
TEST_ASSERT(mbedtls_x509write_crt_set_serial_new(&crt, serial_arg->x,
|
TEST_ASSERT(mbedtls_x509write_crt_set_serial_raw(&crt, serial_arg->x,
|
||||||
serial_arg->len) == 0);
|
serial_arg->len) == 0);
|
||||||
#endif
|
#endif
|
||||||
TEST_ASSERT(mbedtls_x509write_crt_set_validity(&crt, not_before,
|
TEST_ASSERT(mbedtls_x509write_crt_set_validity(&crt, not_before,
|
||||||
|
@ -587,7 +587,7 @@ void x509_set_serial_check()
|
||||||
mbedtls_mpi_free(&serial_mpi);
|
mbedtls_mpi_free(&serial_mpi);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TEST_EQUAL(mbedtls_x509write_crt_set_serial_new(&ctx, invalid_serial,
|
TEST_EQUAL(mbedtls_x509write_crt_set_serial_raw(&ctx, invalid_serial,
|
||||||
sizeof(invalid_serial)),
|
sizeof(invalid_serial)),
|
||||||
MBEDTLS_ERR_X509_BAD_INPUT_DATA);
|
MBEDTLS_ERR_X509_BAD_INPUT_DATA);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue