Skip to content

Commit

Permalink
os_stub/cryptlib_mbedtls: x509: Don't copy some NIDs
Browse files Browse the repository at this point in the history
Avoid copying the basic_constraints NID as we already set it ourselves
and also avoid copying the authority_key_identifier as it won't be
correct on the CSR.

Signed-off-by: Alistair Francis <[email protected]>
  • Loading branch information
alistair23 authored and jyao1 committed Nov 29, 2023
1 parent 495f047 commit 84989bf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions os_stub/cryptlib_mbedtls/pk/x509.c
Original file line number Diff line number Diff line change
Expand Up @@ -2110,6 +2110,17 @@ bool libspdm_gen_x509_csr(size_t hash_nid, size_t asym_nid,
goto free_all;
}

if (MBEDTLS_OID_CMP_RAW(MBEDTLS_OID_BASIC_CONSTRAINTS, next_oid->buf.p, oid_tag_len) == 0) {
next_oid = next_oid->next;
continue;
}

if (MBEDTLS_OID_CMP_RAW(MBEDTLS_OID_AUTHORITY_KEY_IDENTIFIER, next_oid->buf.p,
oid_tag_len) == 0) {
next_oid = next_oid->next;
continue;
}

if (mbedtls_x509write_csr_set_extension(&req, next_oid->buf.p,
oid_tag_len,
next_oid->buf.p + oid_tag_len,
Expand Down

0 comments on commit 84989bf

Please sign in to comment.