[Backport 2.16] Mark basic constraints critical as appropriate.
Per RFC 5280 4.2.1.9 if the 'cA' field is set to true, the extension
must be marked critical.
Signed-off-by: Darren Krahn <dkrahn@google.com>
diff --git a/library/x509write_crt.c b/library/x509write_crt.c
index 5462e83..aaffd14 100644
--- a/library/x509write_crt.c
+++ b/library/x509write_crt.c
@@ -203,7 +203,7 @@
return(
mbedtls_x509write_crt_set_extension( ctx, MBEDTLS_OID_BASIC_CONSTRAINTS,
MBEDTLS_OID_SIZE( MBEDTLS_OID_BASIC_CONSTRAINTS ),
- 0, buf + sizeof(buf) - len, len ) );
+ is_ca, buf + sizeof(buf) - len, len ) );
}
#if defined(MBEDTLS_SHA1_C)