Extracting SubjectKeyId and AuthorityKeyId in case of x509 V3 extensions. Updating mbedtls_x509_crt_free function to also free the new dynamic elements (issuer field of AuthorityKeyId).
A few tests are also added which test the feature with a correct certificate and multiple ones with erroneous ASN1 tags.
Signed-off-by: toth92g <toth92g@gmail.com>
diff --git a/library/oid.c b/library/oid.c
index 622e793..79bf554 100644
--- a/library/oid.c
+++ b/library/oid.c
@@ -319,7 +319,17 @@
MBEDTLS_OID_X509_EXT_CERTIFICATE_POLICIES,
},
{
- NULL_OID_DESCRIPTOR,
+ { ADD_LEN(MBEDTLS_OID_SUBJECT_KEY_IDENTIFIER), "id-ce-subjectKeyIdentifier",
+ "Subject Key Identifier" },
+ MBEDTLS_OID_X509_EXT_SUBJECT_KEY_IDENTIFIER,
+ },
+ {
+ { ADD_LEN(MBEDTLS_OID_AUTHORITY_KEY_IDENTIFIER), "id-ce-authorityKeyIdentifier",
+ "Authority Key Identifier" },
+ MBEDTLS_OID_X509_EXT_AUTHORITY_KEY_IDENTIFIER,
+ },
+ {
+ { NULL, 0, NULL, NULL },
0,
},
};