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`.
This commit is contained in:
Ron Eldor 2019-02-12 15:05:53 +02:00
parent 9eeb8611b1
commit 991a05b411
2 changed files with 5 additions and 1 deletions

View File

@ -725,7 +725,7 @@
"iEM9wW7hEMkwmk0h/sqZsrJsGH5YsF/VThSq/JVO1e2mZH2vruyZKJVBq+8tDNYp\r\n" \ "iEM9wW7hEMkwmk0h/sqZsrJsGH5YsF/VThSq/JVO1e2mZH2vruyZKJVBq+8tDNYp\r\n" \
"HkK6tSyVYQhzIt3StMJWKMl/o5k2AYz6tSC164+1oG+ML3LWg8XrGKa91H4UOKap\r\n" \ "HkK6tSyVYQhzIt3StMJWKMl/o5k2AYz6tSC164+1oG+ML3LWg8XrGKa91H4UOKap\r\n" \
"Awgk0+4m0T25cNs=\r\n" \ "Awgk0+4m0T25cNs=\r\n" \
"-----END CERTIFICATE-----\r\n"; "-----END CERTIFICATE-----\r\n"
/* END FILE */ /* END FILE */
/* This is taken from tests/data_files/server2.crt.der. */ /* This is taken from tests/data_files/server2.crt.der. */

View File

@ -357,8 +357,12 @@ int main( int argc, char *argv[] )
{ {
if( strcmp( q, "SHA1" ) == 0 ) if( strcmp( q, "SHA1" ) == 0 )
opt.md = MBEDTLS_MD_SHA1; opt.md = MBEDTLS_MD_SHA1;
else if( strcmp( q, "SHA224" ) == 0 )
opt.md = MBEDTLS_MD_SHA224;
else if( strcmp( q, "SHA256" ) == 0 ) else if( strcmp( q, "SHA256" ) == 0 )
opt.md = MBEDTLS_MD_SHA256; opt.md = MBEDTLS_MD_SHA256;
else if( strcmp( q, "SHA384" ) == 0 )
opt.md = MBEDTLS_MD_SHA384;
else if( strcmp( q, "SHA512" ) == 0 ) else if( strcmp( q, "SHA512" ) == 0 )
opt.md = MBEDTLS_MD_SHA512; opt.md = MBEDTLS_MD_SHA512;
else if( strcmp( q, "MD2" ) == 0 ) else if( strcmp( q, "MD2" ) == 0 )