Remove used of deprecated function in mbedtls
Upgrading to v3.6.2 introduced the deprecation of a function. This has
been migrated to the function that will be supported moving forward.
Change-Id: Ia7b06dcf066085bdfa027abe04fb0635257bfb18
Reviewed-on: https://pigweed-review.googlesource.com/c/open-dice/+/258352
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Commit-Queue: Darren Krahn <dkrahn@google.com>
Reviewed-by: Darren Krahn <dkrahn@google.com>
diff --git a/src/mbedtls_ops.c b/src/mbedtls_ops.c
index b3d5e57..8c232dc 100644
--- a/src/mbedtls_ops.c
+++ b/src/mbedtls_ops.c
@@ -354,8 +354,6 @@
mbedtls_pk_init(&subject_key_context);
mbedtls_x509write_cert cert_context;
mbedtls_x509write_crt_init(&cert_context);
- mbedtls_mpi serial_number;
- mbedtls_mpi_init(&serial_number);
// Derive key pairs and IDs.
result = SetupKeyPair(authority_private_key_seed, &authority_key_context);
@@ -411,12 +409,8 @@
// Construct the certificate.
mbedtls_x509write_crt_set_version(&cert_context, MBEDTLS_X509_CRT_VERSION_3);
- if (0 !=
- mbedtls_mpi_read_binary(&serial_number, subject_id, sizeof(subject_id))) {
- result = kDiceResultPlatformError;
- goto out;
- }
- if (0 != mbedtls_x509write_crt_set_serial(&cert_context, &serial_number)) {
+ if (0 != mbedtls_x509write_crt_set_serial_raw(&cert_context, subject_id,
+ sizeof(subject_id))) {
result = kDiceResultPlatformError;
goto out;
}
@@ -503,7 +497,6 @@
*certificate_actual_size);
out:
- mbedtls_mpi_free(&serial_number);
mbedtls_x509write_crt_free(&cert_context);
mbedtls_pk_free(&authority_key_context);
mbedtls_pk_free(&subject_key_context);
diff --git a/third_party/mbedtls/custom_config.h b/third_party/mbedtls/custom_config.h
index bcb1ead..765eef9 100644
--- a/third_party/mbedtls/custom_config.h
+++ b/third_party/mbedtls/custom_config.h
@@ -16,6 +16,7 @@
#define THIRD_PARTY_MBEDTLS_CUSTOM_CONFIG_H_
/* mbed TLS feature support */
+#define MBEDTLS_DEPRECATED_REMOVED
#define MBEDTLS_ECDSA_DETERMINISTIC
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
#define MBEDTLS_SHA512_NO_SHA384