diff --git a/ChangeLog.d/improve_x509_cert_writing_serial_number_management.txt b/ChangeLog.d/improve_x509_cert_writing_serial_number_management.txt index 29f16972c..1764c2f64 100644 --- a/ChangeLog.d/improve_x509_cert_writing_serial_number_management.txt +++ b/ChangeLog.d/improve_x509_cert_writing_serial_number_management.txt @@ -6,7 +6,7 @@ Bugfix New deprecations * 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. Changes diff --git a/include/mbedtls/x509_crt.h b/include/mbedtls/x509_crt.h index 56cc56be0..157e3a68c 100644 --- a/include/mbedtls/x509_crt.h +++ b/include/mbedtls/x509_crt.h @@ -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 * 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 * 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 * 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); /** diff --git a/library/x509write_crt.c b/library/x509write_crt.c index bac849f09..4f233953c 100644 --- a/library/x509write_crt.c +++ b/library/x509write_crt.c @@ -124,7 +124,7 @@ int mbedtls_x509write_crt_set_serial(mbedtls_x509write_cert *ctx, } #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) { if (serial_len > MBEDTLS_X509_RFC5280_MAX_SERIAL_LEN) { diff --git a/programs/x509/cert_write.c b/programs/x509/cert_write.c index 13debceae..287dd344a 100644 --- a/programs/x509/cert_write.c +++ b/programs/x509/cert_write.c @@ -736,10 +736,10 @@ usage: mbedtls_x509write_crt_set_version(&crt, opt.version); 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) { 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); goto exit; } diff --git a/tests/suites/test_suite_x509write.function b/tests/suites/test_suite_x509write.function index 5d68e1609..24094ec6a 100644 --- a/tests/suites/test_suite_x509write.function +++ b/tests/suites/test_suite_x509write.function @@ -397,7 +397,7 @@ void x509_crt_check(char *subject_key_file, char *subject_pwd, serial_arg->len) == 0); TEST_ASSERT(mbedtls_x509write_crt_set_serial(&crt, &serial_mpi) == 0); #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); #endif TEST_ASSERT(mbedtls_x509write_crt_set_validity(&crt, not_before, @@ -587,7 +587,7 @@ void x509_set_serial_check() mbedtls_mpi_free(&serial_mpi); #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)), MBEDTLS_ERR_X509_BAD_INPUT_DATA);