Add support for all SHA modes in cert_write
Add support for `MBEDTLS_SHA_224` and `MBEDTLS_SHA_384` in
`cert_write`, to support generating such certificates in
`tests/data_files/Makefile`.
diff --git a/library/certs.c b/library/certs.c
index 3c18d3c..f152c28 100644
--- a/library/certs.c
+++ b/library/certs.c
@@ -725,7 +725,7 @@
"iEM9wW7hEMkwmk0h/sqZsrJsGH5YsF/VThSq/JVO1e2mZH2vruyZKJVBq+8tDNYp\r\n" \
"HkK6tSyVYQhzIt3StMJWKMl/o5k2AYz6tSC164+1oG+ML3LWg8XrGKa91H4UOKap\r\n" \
"Awgk0+4m0T25cNs=\r\n" \
-"-----END CERTIFICATE-----\r\n";
+"-----END CERTIFICATE-----\r\n"
/* END FILE */
/* This is taken from tests/data_files/server2.crt.der. */
diff --git a/programs/x509/cert_write.c b/programs/x509/cert_write.c
index c3e89be..d36d73c 100644
--- a/programs/x509/cert_write.c
+++ b/programs/x509/cert_write.c
@@ -357,8 +357,12 @@
{
if( strcmp( q, "SHA1" ) == 0 )
opt.md = MBEDTLS_MD_SHA1;
+ else if( strcmp( q, "SHA224" ) == 0 )
+ opt.md = MBEDTLS_MD_SHA224;
else if( strcmp( q, "SHA256" ) == 0 )
opt.md = MBEDTLS_MD_SHA256;
+ else if( strcmp( q, "SHA384" ) == 0 )
+ opt.md = MBEDTLS_MD_SHA384;
else if( strcmp( q, "SHA512" ) == 0 )
opt.md = MBEDTLS_MD_SHA512;
else if( strcmp( q, "MD2" ) == 0 )