mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 03:25:46 +01:00
Merge pull request #643 from hanno-arm/secp256r1-baremetal
[Baremetal] Add Secp256r1 test certificates
This commit is contained in:
commit
d6fba18328
@ -37,18 +37,6 @@
|
|||||||
/* Debug output */
|
/* Debug output */
|
||||||
#define MBEDTLS_DEBUG_C
|
#define MBEDTLS_DEBUG_C
|
||||||
|
|
||||||
/* We don't have DER-encoded test CRTs yet. */
|
|
||||||
#define MBEDTLS_PEM_PARSE_C
|
|
||||||
#define MBEDTLS_BASE64_C
|
|
||||||
/* We don't have Secp256r1 test CRTs at the moment. */
|
|
||||||
#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
|
|
||||||
|
|
||||||
/* Correct ECP configuration values */
|
|
||||||
#undef MBEDTLS_ECP_MAX_BITS
|
|
||||||
#undef MBEDTLS_MPI_MAX_SIZE
|
|
||||||
#define MBEDTLS_ECP_MAX_BITS 384
|
|
||||||
#define MBEDTLS_MPI_MAX_SIZE 48
|
|
||||||
|
|
||||||
/* ssl_client2 and ssl_server2 use CTR-DRBG so far. */
|
/* ssl_client2 and ssl_server2 use CTR-DRBG so far. */
|
||||||
#define MBEDTLS_CTR_DRBG_C
|
#define MBEDTLS_CTR_DRBG_C
|
||||||
|
|
||||||
|
292
library/certs.c
292
library/certs.c
@ -42,6 +42,101 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Use CRTs with Secp256r1-only if Secp384r1 is disabled.
|
||||||
|
* Otherwise, fall back to previous test CRTs using both
|
||||||
|
* Secp256r1 and Secp384r1. */
|
||||||
|
#if !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
|
||||||
|
|
||||||
|
/* This is taken from tests/data_files/test-ca3.crt.pem */
|
||||||
|
/* BEGIN FILE string macro TEST_CA_CRT_EC_PEM tests/data_files/test-ca3.crt.pem */
|
||||||
|
#define TEST_CA_CRT_EC_PEM \
|
||||||
|
"-----BEGIN CERTIFICATE-----\r\n" \
|
||||||
|
"MIIBuTCCAV2gAwIBAgIBATAMBggqhkjOPQQDAgUAMDsxGjAYBgNVBAMMEVRlc3Qg\r\n" \
|
||||||
|
"Q0EgU2VjcDI1NnIxMRAwDgYDVQQKDAdNYmVkVExTMQswCQYDVQQGEwJVSzAeFw0w\r\n" \
|
||||||
|
"MTAxMDEwMDAwMDBaFw0zMDEyMzEyMzU5NTlaMDsxGjAYBgNVBAMMEVRlc3QgQ0Eg\r\n" \
|
||||||
|
"U2VjcDI1NnIxMRAwDgYDVQQKDAdNYmVkVExTMQswCQYDVQQGEwJVSzBZMBMGByqG\r\n" \
|
||||||
|
"SM49AgEGCCqGSM49AwEHA0IABLZIHgilzw/iCx1r09kyZsZfarzztX4y1km0S5Mx\r\n" \
|
||||||
|
"rsFB67NjUhXE6/YY3W38oxeY4eIvEb516BOR/g3e3OL7Q8WjUDBOMAwGA1UdEwQF\r\n" \
|
||||||
|
"MAMBAf8wHQYDVR0OBBYEFEpepGEzSxZIDDF4IjXW+85Q5yASMB8GA1UdIwQYMBaA\r\n" \
|
||||||
|
"FEpepGEzSxZIDDF4IjXW+85Q5yASMAwGCCqGSM49BAMCBQADSAAwRQIhAKejV1jK\r\n" \
|
||||||
|
"vPH1vIsZAr6/VmSvjXkxmT2rpzEP9iJvJAteAiBhCPtV7LdSF1ZUqphAK3DYh2m7\r\n" \
|
||||||
|
"l1eSxSKXB29adbF96g==\r\n" \
|
||||||
|
"-----END CERTIFICATE-----\r\n"
|
||||||
|
/* END FILE */
|
||||||
|
|
||||||
|
/* This is generated from tests/data_files/test-ca3.crt.der using `xxd -i`. */
|
||||||
|
/* BEGIN FILE binary macro TEST_CA_CRT_EC_DER tests/data_files/test-ca3.crt.der */
|
||||||
|
#define TEST_CA_CRT_EC_DER { \
|
||||||
|
0x30, 0x82, 0x01, 0xb9, 0x30, 0x82, 0x01, 0x5d, 0xa0, 0x03, 0x02, 0x01, \
|
||||||
|
0x02, 0x02, 0x01, 0x01, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, \
|
||||||
|
0x3d, 0x04, 0x03, 0x02, 0x05, 0x00, 0x30, 0x3b, 0x31, 0x1a, 0x30, 0x18, \
|
||||||
|
0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x11, 0x54, 0x65, 0x73, 0x74, 0x20, \
|
||||||
|
0x43, 0x41, 0x20, 0x53, 0x65, 0x63, 0x70, 0x32, 0x35, 0x36, 0x72, 0x31, \
|
||||||
|
0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x07, 0x4d, \
|
||||||
|
0x62, 0x65, 0x64, 0x54, 0x4c, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \
|
||||||
|
0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x4b, 0x30, 0x1e, 0x17, 0x0d, 0x30, \
|
||||||
|
0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, \
|
||||||
|
0x17, 0x0d, 0x33, 0x30, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, \
|
||||||
|
0x35, 0x39, 0x5a, 0x30, 0x3b, 0x31, 0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, \
|
||||||
|
0x04, 0x03, 0x0c, 0x11, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x41, 0x20, \
|
||||||
|
0x53, 0x65, 0x63, 0x70, 0x32, 0x35, 0x36, 0x72, 0x31, 0x31, 0x10, 0x30, \
|
||||||
|
0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x07, 0x4d, 0x62, 0x65, 0x64, \
|
||||||
|
0x54, 0x4c, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, \
|
||||||
|
0x13, 0x02, 0x55, 0x4b, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, \
|
||||||
|
0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, \
|
||||||
|
0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xb6, 0x48, 0x1e, 0x08, 0xa5, \
|
||||||
|
0xcf, 0x0f, 0xe2, 0x0b, 0x1d, 0x6b, 0xd3, 0xd9, 0x32, 0x66, 0xc6, 0x5f, \
|
||||||
|
0x6a, 0xbc, 0xf3, 0xb5, 0x7e, 0x32, 0xd6, 0x49, 0xb4, 0x4b, 0x93, 0x31, \
|
||||||
|
0xae, 0xc1, 0x41, 0xeb, 0xb3, 0x63, 0x52, 0x15, 0xc4, 0xeb, 0xf6, 0x18, \
|
||||||
|
0xdd, 0x6d, 0xfc, 0xa3, 0x17, 0x98, 0xe1, 0xe2, 0x2f, 0x11, 0xbe, 0x75, \
|
||||||
|
0xe8, 0x13, 0x91, 0xfe, 0x0d, 0xde, 0xdc, 0xe2, 0xfb, 0x43, 0xc5, 0xa3, \
|
||||||
|
0x50, 0x30, 0x4e, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, \
|
||||||
|
0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, \
|
||||||
|
0x04, 0x16, 0x04, 0x14, 0x4a, 0x5e, 0xa4, 0x61, 0x33, 0x4b, 0x16, 0x48, \
|
||||||
|
0x0c, 0x31, 0x78, 0x22, 0x35, 0xd6, 0xfb, 0xce, 0x50, 0xe7, 0x20, 0x12, \
|
||||||
|
0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, \
|
||||||
|
0x14, 0x4a, 0x5e, 0xa4, 0x61, 0x33, 0x4b, 0x16, 0x48, 0x0c, 0x31, 0x78, \
|
||||||
|
0x22, 0x35, 0xd6, 0xfb, 0xce, 0x50, 0xe7, 0x20, 0x12, 0x30, 0x0c, 0x06, \
|
||||||
|
0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x05, 0x00, 0x03, \
|
||||||
|
0x48, 0x00, 0x30, 0x45, 0x02, 0x21, 0x00, 0xa7, 0xa3, 0x57, 0x58, 0xca, \
|
||||||
|
0xbc, 0xf1, 0xf5, 0xbc, 0x8b, 0x19, 0x02, 0xbe, 0xbf, 0x56, 0x64, 0xaf, \
|
||||||
|
0x8d, 0x79, 0x31, 0x99, 0x3d, 0xab, 0xa7, 0x31, 0x0f, 0xf6, 0x22, 0x6f, \
|
||||||
|
0x24, 0x0b, 0x5e, 0x02, 0x20, 0x61, 0x08, 0xfb, 0x55, 0xec, 0xb7, 0x52, \
|
||||||
|
0x17, 0x56, 0x54, 0xaa, 0x98, 0x40, 0x2b, 0x70, 0xd8, 0x87, 0x69, 0xbb, \
|
||||||
|
0x97, 0x57, 0x92, 0xc5, 0x22, 0x97, 0x07, 0x6f, 0x5a, 0x75, 0xb1, 0x7d, \
|
||||||
|
0xea \
|
||||||
|
}
|
||||||
|
/* END FILE */
|
||||||
|
|
||||||
|
/* This is taken from tests/data_files/test-ca3.key.pem */
|
||||||
|
/* BEGIN FILE string macro TEST_CA_KEY_EC_PEM tests/data_files/test-ca3.key.pem */
|
||||||
|
#define TEST_CA_KEY_EC_PEM \
|
||||||
|
"-----BEGIN EC PRIVATE KEY-----\r\n" \
|
||||||
|
"MHcCAQEEIDlfIVA04pd23r9UJhLf0kt6SkROecrhPbNWtawigBCkoAoGCCqGSM49\r\n" \
|
||||||
|
"AwEHoUQDQgAEtkgeCKXPD+ILHWvT2TJmxl9qvPO1fjLWSbRLkzGuwUHrs2NSFcTr\r\n" \
|
||||||
|
"9hjdbfyjF5jh4i8RvnXoE5H+Dd7c4vtDxQ==\r\n" \
|
||||||
|
"-----END EC PRIVATE KEY-----\r\n"
|
||||||
|
/* END FILE */
|
||||||
|
|
||||||
|
/* This is generated from tests/data_files/test-ca3.key.der using `xxd -i`. */
|
||||||
|
/* BEGIN FILE binary macro TEST_CA_KEY_EC_DER tests/data_files/test-ca3.key.der */
|
||||||
|
#define TEST_CA_KEY_EC_DER { \
|
||||||
|
0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0x39, 0x5f, 0x21, 0x50, 0x34, \
|
||||||
|
0xe2, 0x97, 0x76, 0xde, 0xbf, 0x54, 0x26, 0x12, 0xdf, 0xd2, 0x4b, 0x7a, \
|
||||||
|
0x4a, 0x44, 0x4e, 0x79, 0xca, 0xe1, 0x3d, 0xb3, 0x56, 0xb5, 0xac, 0x22, \
|
||||||
|
0x80, 0x10, 0xa4, 0xa0, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, \
|
||||||
|
0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0xb6, 0x48, 0x1e, \
|
||||||
|
0x08, 0xa5, 0xcf, 0x0f, 0xe2, 0x0b, 0x1d, 0x6b, 0xd3, 0xd9, 0x32, 0x66, \
|
||||||
|
0xc6, 0x5f, 0x6a, 0xbc, 0xf3, 0xb5, 0x7e, 0x32, 0xd6, 0x49, 0xb4, 0x4b, \
|
||||||
|
0x93, 0x31, 0xae, 0xc1, 0x41, 0xeb, 0xb3, 0x63, 0x52, 0x15, 0xc4, 0xeb, \
|
||||||
|
0xf6, 0x18, 0xdd, 0x6d, 0xfc, 0xa3, 0x17, 0x98, 0xe1, 0xe2, 0x2f, 0x11, \
|
||||||
|
0xbe, 0x75, 0xe8, 0x13, 0x91, 0xfe, 0x0d, 0xde, 0xdc, 0xe2, 0xfb, 0x43, \
|
||||||
|
0xc5 \
|
||||||
|
}
|
||||||
|
/* END FILE */
|
||||||
|
|
||||||
|
#else /* !MBEDTLS_ECP_DP_SECP384R1_ENABLED */
|
||||||
|
|
||||||
/* This is taken from tests/data_files/test-ca2.crt */
|
/* This is taken from tests/data_files/test-ca2.crt */
|
||||||
/* BEGIN FILE string macro TEST_CA_CRT_EC_PEM tests/data_files/test-ca2.crt */
|
/* BEGIN FILE string macro TEST_CA_CRT_EC_PEM tests/data_files/test-ca2.crt */
|
||||||
#define TEST_CA_CRT_EC_PEM \
|
#define TEST_CA_CRT_EC_PEM \
|
||||||
@ -154,6 +249,10 @@
|
|||||||
}
|
}
|
||||||
/* END FILE */
|
/* END FILE */
|
||||||
|
|
||||||
|
#endif /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */
|
||||||
|
|
||||||
|
#define TEST_CA_PWD_EC_PEM "PolarSSLTest"
|
||||||
|
|
||||||
/* This is taken from tests/data_files/test-ca-sha256.crt. */
|
/* This is taken from tests/data_files/test-ca-sha256.crt. */
|
||||||
/* BEGIN FILE string macro TEST_CA_CRT_RSA_SHA256_PEM tests/data_files/test-ca-sha256.crt */
|
/* BEGIN FILE string macro TEST_CA_CRT_RSA_SHA256_PEM tests/data_files/test-ca-sha256.crt */
|
||||||
#define TEST_CA_CRT_RSA_SHA256_PEM \
|
#define TEST_CA_CRT_RSA_SHA256_PEM \
|
||||||
@ -513,6 +612,100 @@
|
|||||||
* - multiple EC curve types
|
* - multiple EC curve types
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Use CRTs with Secp256r1-only if Secp384r1 is disabled.
|
||||||
|
* Otherwise, fall back to previous test CRTs using both
|
||||||
|
* Secp256r1 and Secp384r1. */
|
||||||
|
#if !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
|
||||||
|
|
||||||
|
/* This is taken from tests/data_files/server11.crt.pem. */
|
||||||
|
/* BEGIN FILE string macro TEST_SRV_CRT_EC_PEM tests/data_files/server11.crt.pem */
|
||||||
|
#define TEST_SRV_CRT_EC_PEM \
|
||||||
|
"-----BEGIN CERTIFICATE-----\r\n" \
|
||||||
|
"MIIBrzCCAVKgAwIBAgIBATAMBggqhkjOPQQDAgUAMDsxGjAYBgNVBAMMEVRlc3Qg\r\n" \
|
||||||
|
"Q0EgU2VjcDI1NnIxMRAwDgYDVQQKDAdNYmVkVExTMQswCQYDVQQGEwJVSzAeFw0w\r\n" \
|
||||||
|
"MTAxMDEwMDAwMDBaFw0zMDEyMzEyMzU5NTlaMDMxEjAQBgNVBAMMCWxvY2FsaG9z\r\n" \
|
||||||
|
"dDEQMA4GA1UECgwHTWJlZFRMUzELMAkGA1UEBhMCVUswWTATBgcqhkjOPQIBBggq\r\n" \
|
||||||
|
"hkjOPQMBBwNCAATH4k2I+9HG/2AM4cN0pPkfO62ddKWwtDsdFezZoKxwXYm0ClZe\r\n" \
|
||||||
|
"zZYmfpl8x5Q7+V2oGg3TXoC8TOmXjAtabfDNo00wSzAJBgNVHRMEAjAAMB0GA1Ud\r\n" \
|
||||||
|
"DgQWBBQjXj0e2wlEVpSCbySpu2oDJgn7sjAfBgNVHSMEGDAWgBRKXqRhM0sWSAwx\r\n" \
|
||||||
|
"eCI11vvOUOcgEjAMBggqhkjOPQQDAgUAA0kAMEYCIQCN7/F5DbM4Ug5NcKHeKFbb\r\n" \
|
||||||
|
"3EHpsBjg0//gXa9mJ7Q4jAIhAIzio6vwCYnzrslzsTbPpmtU+6Op6SlzdGO/iR77\r\n" \
|
||||||
|
"bcfp\r\n" \
|
||||||
|
"-----END CERTIFICATE-----\r\n"
|
||||||
|
/* END FILE */
|
||||||
|
|
||||||
|
/* This is generated from tests/data_files/server11.crt.der using `xxd -i`. */
|
||||||
|
/* BEGIN FILE binary macro TEST_SRV_CRT_EC_DER tests/data_files/server11.crt.der */
|
||||||
|
#define TEST_SRV_CRT_EC_DER { \
|
||||||
|
0x30, 0x82, 0x01, 0xaf, 0x30, 0x82, 0x01, 0x52, 0xa0, 0x03, 0x02, 0x01, \
|
||||||
|
0x02, 0x02, 0x01, 0x01, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, \
|
||||||
|
0x3d, 0x04, 0x03, 0x02, 0x05, 0x00, 0x30, 0x3b, 0x31, 0x1a, 0x30, 0x18, \
|
||||||
|
0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x11, 0x54, 0x65, 0x73, 0x74, 0x20, \
|
||||||
|
0x43, 0x41, 0x20, 0x53, 0x65, 0x63, 0x70, 0x32, 0x35, 0x36, 0x72, 0x31, \
|
||||||
|
0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x07, 0x4d, \
|
||||||
|
0x62, 0x65, 0x64, 0x54, 0x4c, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \
|
||||||
|
0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x4b, 0x30, 0x1e, 0x17, 0x0d, 0x30, \
|
||||||
|
0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, \
|
||||||
|
0x17, 0x0d, 0x33, 0x30, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, \
|
||||||
|
0x35, 0x39, 0x5a, 0x30, 0x33, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, \
|
||||||
|
0x04, 0x03, 0x0c, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, \
|
||||||
|
0x74, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x07, \
|
||||||
|
0x4d, 0x62, 0x65, 0x64, 0x54, 0x4c, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, \
|
||||||
|
0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x4b, 0x30, 0x59, 0x30, 0x13, \
|
||||||
|
0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, \
|
||||||
|
0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xc7, \
|
||||||
|
0xe2, 0x4d, 0x88, 0xfb, 0xd1, 0xc6, 0xff, 0x60, 0x0c, 0xe1, 0xc3, 0x74, \
|
||||||
|
0xa4, 0xf9, 0x1f, 0x3b, 0xad, 0x9d, 0x74, 0xa5, 0xb0, 0xb4, 0x3b, 0x1d, \
|
||||||
|
0x15, 0xec, 0xd9, 0xa0, 0xac, 0x70, 0x5d, 0x89, 0xb4, 0x0a, 0x56, 0x5e, \
|
||||||
|
0xcd, 0x96, 0x26, 0x7e, 0x99, 0x7c, 0xc7, 0x94, 0x3b, 0xf9, 0x5d, 0xa8, \
|
||||||
|
0x1a, 0x0d, 0xd3, 0x5e, 0x80, 0xbc, 0x4c, 0xe9, 0x97, 0x8c, 0x0b, 0x5a, \
|
||||||
|
0x6d, 0xf0, 0xcd, 0xa3, 0x4d, 0x30, 0x4b, 0x30, 0x09, 0x06, 0x03, 0x55, \
|
||||||
|
0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, \
|
||||||
|
0x0e, 0x04, 0x16, 0x04, 0x14, 0x23, 0x5e, 0x3d, 0x1e, 0xdb, 0x09, 0x44, \
|
||||||
|
0x56, 0x94, 0x82, 0x6f, 0x24, 0xa9, 0xbb, 0x6a, 0x03, 0x26, 0x09, 0xfb, \
|
||||||
|
0xb2, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, \
|
||||||
|
0x80, 0x14, 0x4a, 0x5e, 0xa4, 0x61, 0x33, 0x4b, 0x16, 0x48, 0x0c, 0x31, \
|
||||||
|
0x78, 0x22, 0x35, 0xd6, 0xfb, 0xce, 0x50, 0xe7, 0x20, 0x12, 0x30, 0x0c, \
|
||||||
|
0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x05, 0x00, \
|
||||||
|
0x03, 0x49, 0x00, 0x30, 0x46, 0x02, 0x21, 0x00, 0x8d, 0xef, 0xf1, 0x79, \
|
||||||
|
0x0d, 0xb3, 0x38, 0x52, 0x0e, 0x4d, 0x70, 0xa1, 0xde, 0x28, 0x56, 0xdb, \
|
||||||
|
0xdc, 0x41, 0xe9, 0xb0, 0x18, 0xe0, 0xd3, 0xff, 0xe0, 0x5d, 0xaf, 0x66, \
|
||||||
|
0x27, 0xb4, 0x38, 0x8c, 0x02, 0x21, 0x00, 0x8c, 0xe2, 0xa3, 0xab, 0xf0, \
|
||||||
|
0x09, 0x89, 0xf3, 0xae, 0xc9, 0x73, 0xb1, 0x36, 0xcf, 0xa6, 0x6b, 0x54, \
|
||||||
|
0xfb, 0xa3, 0xa9, 0xe9, 0x29, 0x73, 0x74, 0x63, 0xbf, 0x89, 0x1e, 0xfb, \
|
||||||
|
0x6d, 0xc7, 0xe9 \
|
||||||
|
}
|
||||||
|
/* END FILE */
|
||||||
|
|
||||||
|
/* This is taken from tests/data_files/server11.key.pem. */
|
||||||
|
/* BEGIN FILE string macro TEST_SRV_KEY_EC_PEM tests/data_files/server11.key.pem */
|
||||||
|
#define TEST_SRV_KEY_EC_PEM \
|
||||||
|
"-----BEGIN EC PRIVATE KEY-----\r\n" \
|
||||||
|
"MHcCAQEEIGEWs7/9cQHgEI5v2qeQRGLoFhjrNK4lul6tmcqDACKuoAoGCCqGSM49\r\n" \
|
||||||
|
"AwEHoUQDQgAEx+JNiPvRxv9gDOHDdKT5HzutnXSlsLQ7HRXs2aCscF2JtApWXs2W\r\n" \
|
||||||
|
"Jn6ZfMeUO/ldqBoN016AvEzpl4wLWm3wzQ==\r\n" \
|
||||||
|
"-----END EC PRIVATE KEY-----\r\n"
|
||||||
|
/* END FILE */
|
||||||
|
|
||||||
|
/* This is generated from tests/data_files/server11.key.der using `xxd -i`. */
|
||||||
|
/* BEGIN FILE binary macro TEST_SRV_KEY_EC_DER tests/data_files/server11.key.der */
|
||||||
|
#define TEST_SRV_KEY_EC_DER { \
|
||||||
|
0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0x61, 0x16, 0xb3, 0xbf, 0xfd, \
|
||||||
|
0x71, 0x01, 0xe0, 0x10, 0x8e, 0x6f, 0xda, 0xa7, 0x90, 0x44, 0x62, 0xe8, \
|
||||||
|
0x16, 0x18, 0xeb, 0x34, 0xae, 0x25, 0xba, 0x5e, 0xad, 0x99, 0xca, 0x83, \
|
||||||
|
0x00, 0x22, 0xae, 0xa0, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, \
|
||||||
|
0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0xc7, 0xe2, 0x4d, \
|
||||||
|
0x88, 0xfb, 0xd1, 0xc6, 0xff, 0x60, 0x0c, 0xe1, 0xc3, 0x74, 0xa4, 0xf9, \
|
||||||
|
0x1f, 0x3b, 0xad, 0x9d, 0x74, 0xa5, 0xb0, 0xb4, 0x3b, 0x1d, 0x15, 0xec, \
|
||||||
|
0xd9, 0xa0, 0xac, 0x70, 0x5d, 0x89, 0xb4, 0x0a, 0x56, 0x5e, 0xcd, 0x96, \
|
||||||
|
0x26, 0x7e, 0x99, 0x7c, 0xc7, 0x94, 0x3b, 0xf9, 0x5d, 0xa8, 0x1a, 0x0d, \
|
||||||
|
0xd3, 0x5e, 0x80, 0xbc, 0x4c, 0xe9, 0x97, 0x8c, 0x0b, 0x5a, 0x6d, 0xf0, \
|
||||||
|
0xcd \
|
||||||
|
}
|
||||||
|
/* END FILE */
|
||||||
|
|
||||||
|
#else /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */
|
||||||
|
|
||||||
/* This is taken from tests/data_files/server5.crt. */
|
/* This is taken from tests/data_files/server5.crt. */
|
||||||
/* BEGIN FILE string macro TEST_SRV_CRT_EC_PEM tests/data_files/server5.crt */
|
/* BEGIN FILE string macro TEST_SRV_CRT_EC_PEM tests/data_files/server5.crt */
|
||||||
#define TEST_SRV_CRT_EC_PEM \
|
#define TEST_SRV_CRT_EC_PEM \
|
||||||
@ -611,6 +804,8 @@
|
|||||||
}
|
}
|
||||||
/* END FILE */
|
/* END FILE */
|
||||||
|
|
||||||
|
#endif /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */
|
||||||
|
|
||||||
/* This is taken from tests/data_files/server2-sha256.crt. */
|
/* This is taken from tests/data_files/server2-sha256.crt. */
|
||||||
/* BEGIN FILE string macro TEST_SRV_CRT_RSA_SHA256_PEM tests/data_files/server2-sha256.crt */
|
/* BEGIN FILE string macro TEST_SRV_CRT_RSA_SHA256_PEM tests/data_files/server2-sha256.crt */
|
||||||
#define TEST_SRV_CRT_RSA_SHA256_PEM \
|
#define TEST_SRV_CRT_RSA_SHA256_PEM \
|
||||||
@ -962,6 +1157,101 @@
|
|||||||
* - multiple EC curve types
|
* - multiple EC curve types
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Use CRTs with Secp256r1-only if Secp384r1 is disabled.
|
||||||
|
* Otherwise, fall back to previous test CRTs using both
|
||||||
|
* Secp256r1 and Secp384r1. */
|
||||||
|
#if !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
|
||||||
|
|
||||||
|
/* This is taken from tests/data_files/cli3.crt. */
|
||||||
|
/* BEGIN FILE string macro TEST_CLI_CRT_EC_PEM tests/data_files/cli3.crt.pem */
|
||||||
|
#define TEST_CLI_CRT_EC_PEM \
|
||||||
|
"-----BEGIN CERTIFICATE-----\r\n" \
|
||||||
|
"MIIBuTCCAVygAwIBAgIBATAMBggqhkjOPQQDAgUAMDsxGjAYBgNVBAMMEVRlc3Qg\r\n" \
|
||||||
|
"Q0EgU2VjcDI1NnIxMRAwDgYDVQQKDAdNYmVkVExTMQswCQYDVQQGEwJVSzAeFw0w\r\n" \
|
||||||
|
"MTAxMDEwMDAwMDBaFw0zMDEyMzEyMzU5NTlaMD0xHDAaBgNVBAMME1Rlc3QgQ1JU\r\n" \
|
||||||
|
"MiBTZWNwMjU2cjExEDAOBgNVBAoMB01iZWRUTFMxCzAJBgNVBAYTAlVLMFkwEwYH\r\n" \
|
||||||
|
"KoZIzj0CAQYIKoZIzj0DAQcDQgAEEm+TJ4LBB85IBjWNcNIodr2L06CZqLbVClmH\r\n" \
|
||||||
|
"uxPqiZafsAZDl0lqgL6cCigF/ML2EqFyKW+Oext3uAmNkemj6aNNMEswCQYDVR0T\r\n" \
|
||||||
|
"BAIwADAdBgNVHQ4EFgQUF9Yq9UkoSClnXwrdghuhrokH/hIwHwYDVR0jBBgwFoAU\r\n" \
|
||||||
|
"Sl6kYTNLFkgMMXgiNdb7zlDnIBIwDAYIKoZIzj0EAwIFAANJADBGAiEAg3UsTyLd\r\n" \
|
||||||
|
"vCPRG13gbf1R8gb85g4K1VbZ+CKl58HW2VgCIQDXk/8WFrt7vA+m3L1xJxj8iln9\r\n" \
|
||||||
|
"wMR16i9Fqykw7cqsRw==\r\n" \
|
||||||
|
"-----END CERTIFICATE-----\r\n"
|
||||||
|
/* END FILE */
|
||||||
|
|
||||||
|
/* This is generated from tests/data_files/cli3.crt.der using `xxd -i`. */
|
||||||
|
/* BEGIN FILE binary macro TEST_CLI_CRT_EC_DER tests/data_files/cli3.crt.der */
|
||||||
|
#define TEST_CLI_CRT_EC_DER { \
|
||||||
|
0x30, 0x82, 0x01, 0xb9, 0x30, 0x82, 0x01, 0x5c, 0xa0, 0x03, 0x02, 0x01, \
|
||||||
|
0x02, 0x02, 0x01, 0x01, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, \
|
||||||
|
0x3d, 0x04, 0x03, 0x02, 0x05, 0x00, 0x30, 0x3b, 0x31, 0x1a, 0x30, 0x18, \
|
||||||
|
0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x11, 0x54, 0x65, 0x73, 0x74, 0x20, \
|
||||||
|
0x43, 0x41, 0x20, 0x53, 0x65, 0x63, 0x70, 0x32, 0x35, 0x36, 0x72, 0x31, \
|
||||||
|
0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x07, 0x4d, \
|
||||||
|
0x62, 0x65, 0x64, 0x54, 0x4c, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \
|
||||||
|
0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x4b, 0x30, 0x1e, 0x17, 0x0d, 0x30, \
|
||||||
|
0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, \
|
||||||
|
0x17, 0x0d, 0x33, 0x30, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, \
|
||||||
|
0x35, 0x39, 0x5a, 0x30, 0x3d, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, \
|
||||||
|
0x04, 0x03, 0x0c, 0x13, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x52, 0x54, \
|
||||||
|
0x32, 0x20, 0x53, 0x65, 0x63, 0x70, 0x32, 0x35, 0x36, 0x72, 0x31, 0x31, \
|
||||||
|
0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x07, 0x4d, 0x62, \
|
||||||
|
0x65, 0x64, 0x54, 0x4c, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, \
|
||||||
|
0x04, 0x06, 0x13, 0x02, 0x55, 0x4b, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, \
|
||||||
|
0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, \
|
||||||
|
0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x12, 0x6f, 0x93, \
|
||||||
|
0x27, 0x82, 0xc1, 0x07, 0xce, 0x48, 0x06, 0x35, 0x8d, 0x70, 0xd2, 0x28, \
|
||||||
|
0x76, 0xbd, 0x8b, 0xd3, 0xa0, 0x99, 0xa8, 0xb6, 0xd5, 0x0a, 0x59, 0x87, \
|
||||||
|
0xbb, 0x13, 0xea, 0x89, 0x96, 0x9f, 0xb0, 0x06, 0x43, 0x97, 0x49, 0x6a, \
|
||||||
|
0x80, 0xbe, 0x9c, 0x0a, 0x28, 0x05, 0xfc, 0xc2, 0xf6, 0x12, 0xa1, 0x72, \
|
||||||
|
0x29, 0x6f, 0x8e, 0x7b, 0x1b, 0x77, 0xb8, 0x09, 0x8d, 0x91, 0xe9, 0xa3, \
|
||||||
|
0xe9, 0xa3, 0x4d, 0x30, 0x4b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, \
|
||||||
|
0x04, 0x02, 0x30, 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, \
|
||||||
|
0x16, 0x04, 0x14, 0x17, 0xd6, 0x2a, 0xf5, 0x49, 0x28, 0x48, 0x29, 0x67, \
|
||||||
|
0x5f, 0x0a, 0xdd, 0x82, 0x1b, 0xa1, 0xae, 0x89, 0x07, 0xfe, 0x12, 0x30, \
|
||||||
|
0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, \
|
||||||
|
0x4a, 0x5e, 0xa4, 0x61, 0x33, 0x4b, 0x16, 0x48, 0x0c, 0x31, 0x78, 0x22, \
|
||||||
|
0x35, 0xd6, 0xfb, 0xce, 0x50, 0xe7, 0x20, 0x12, 0x30, 0x0c, 0x06, 0x08, \
|
||||||
|
0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x05, 0x00, 0x03, 0x49, \
|
||||||
|
0x00, 0x30, 0x46, 0x02, 0x21, 0x00, 0x83, 0x75, 0x2c, 0x4f, 0x22, 0xdd, \
|
||||||
|
0xbc, 0x23, 0xd1, 0x1b, 0x5d, 0xe0, 0x6d, 0xfd, 0x51, 0xf2, 0x06, 0xfc, \
|
||||||
|
0xe6, 0x0e, 0x0a, 0xd5, 0x56, 0xd9, 0xf8, 0x22, 0xa5, 0xe7, 0xc1, 0xd6, \
|
||||||
|
0xd9, 0x58, 0x02, 0x21, 0x00, 0xd7, 0x93, 0xff, 0x16, 0x16, 0xbb, 0x7b, \
|
||||||
|
0xbc, 0x0f, 0xa6, 0xdc, 0xbd, 0x71, 0x27, 0x18, 0xfc, 0x8a, 0x59, 0xfd, \
|
||||||
|
0xc0, 0xc4, 0x75, 0xea, 0x2f, 0x45, 0xab, 0x29, 0x30, 0xed, 0xca, 0xac, \
|
||||||
|
0x47 \
|
||||||
|
}
|
||||||
|
/* END FILE */
|
||||||
|
|
||||||
|
/* This is taken from tests/data_files/cli3.key.pem. */
|
||||||
|
/* BEGIN FILE string macro TEST_CLI_KEY_EC_PEM tests/data_files/cli3.key.pem */
|
||||||
|
#define TEST_CLI_KEY_EC_PEM \
|
||||||
|
"-----BEGIN EC PRIVATE KEY-----\r\n" \
|
||||||
|
"MHcCAQEEIGFE8JJMBKeo1BnPGgzGae1stIrWdEaUvjo9xO8OTC5QoAoGCCqGSM49\r\n" \
|
||||||
|
"AwEHoUQDQgAEEm+TJ4LBB85IBjWNcNIodr2L06CZqLbVClmHuxPqiZafsAZDl0lq\r\n" \
|
||||||
|
"gL6cCigF/ML2EqFyKW+Oext3uAmNkemj6Q==\r\n" \
|
||||||
|
"-----END EC PRIVATE KEY-----\r\n"
|
||||||
|
/* END FILE */
|
||||||
|
|
||||||
|
/* This is generated from tests/data_files/cli3.key.der using `xxd -i`. */
|
||||||
|
/* BEGIN FILE binary macro TEST_CLI_KEY_EC_DER tests/data_files/cli3.key.der */
|
||||||
|
#define TEST_CLI_KEY_EC_DER { \
|
||||||
|
0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0x61, 0x44, 0xf0, 0x92, 0x4c, \
|
||||||
|
0x04, 0xa7, 0xa8, 0xd4, 0x19, 0xcf, 0x1a, 0x0c, 0xc6, 0x69, 0xed, 0x6c, \
|
||||||
|
0xb4, 0x8a, 0xd6, 0x74, 0x46, 0x94, 0xbe, 0x3a, 0x3d, 0xc4, 0xef, 0x0e, \
|
||||||
|
0x4c, 0x2e, 0x50, 0xa0, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, \
|
||||||
|
0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x12, 0x6f, 0x93, \
|
||||||
|
0x27, 0x82, 0xc1, 0x07, 0xce, 0x48, 0x06, 0x35, 0x8d, 0x70, 0xd2, 0x28, \
|
||||||
|
0x76, 0xbd, 0x8b, 0xd3, 0xa0, 0x99, 0xa8, 0xb6, 0xd5, 0x0a, 0x59, 0x87, \
|
||||||
|
0xbb, 0x13, 0xea, 0x89, 0x96, 0x9f, 0xb0, 0x06, 0x43, 0x97, 0x49, 0x6a, \
|
||||||
|
0x80, 0xbe, 0x9c, 0x0a, 0x28, 0x05, 0xfc, 0xc2, 0xf6, 0x12, 0xa1, 0x72, \
|
||||||
|
0x29, 0x6f, 0x8e, 0x7b, 0x1b, 0x77, 0xb8, 0x09, 0x8d, 0x91, 0xe9, 0xa3, \
|
||||||
|
0xe9 \
|
||||||
|
}
|
||||||
|
/* END FILE */
|
||||||
|
|
||||||
|
#else /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */
|
||||||
|
|
||||||
/* This is taken from tests/data_files/cli2.crt. */
|
/* This is taken from tests/data_files/cli2.crt. */
|
||||||
/* BEGIN FILE string macro TEST_CLI_CRT_EC_PEM tests/data_files/cli2.crt */
|
/* BEGIN FILE string macro TEST_CLI_CRT_EC_PEM tests/data_files/cli2.crt */
|
||||||
#define TEST_CLI_CRT_EC_PEM \
|
#define TEST_CLI_CRT_EC_PEM \
|
||||||
@ -1061,6 +1351,8 @@
|
|||||||
}
|
}
|
||||||
/* END FILE */
|
/* END FILE */
|
||||||
|
|
||||||
|
#endif /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */
|
||||||
|
|
||||||
/* This is taken from tests/data_files/cli-rsa-sha256.crt. */
|
/* This is taken from tests/data_files/cli-rsa-sha256.crt. */
|
||||||
/* BEGIN FILE string macro TEST_CLI_CRT_RSA_PEM tests/data_files/cli-rsa-sha256.crt */
|
/* BEGIN FILE string macro TEST_CLI_CRT_RSA_PEM tests/data_files/cli-rsa-sha256.crt */
|
||||||
#define TEST_CLI_CRT_RSA_PEM \
|
#define TEST_CLI_CRT_RSA_PEM \
|
||||||
|
66
scripts/generate_certs.sh
Executable file
66
scripts/generate_certs.sh
Executable file
@ -0,0 +1,66 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -d include/mbedtls ]; then :; else
|
||||||
|
echo "$0: must be run from root" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CERTS="library/certs.c"
|
||||||
|
CERTS_TMP="${CERTS}.tmp"
|
||||||
|
CERTS_NEW="${CERTS}.new"
|
||||||
|
|
||||||
|
# Remove bodies of BEGIN FILE ... END FILE blocks
|
||||||
|
SED_RM_FILE_BODIES=":o; /BEGIN FILE/!{p;n;bo}; /BEGIN FILE/{p; n; :i; /END FILE/{n; bo}; n; bi}"
|
||||||
|
sed -n "${SED_RM_FILE_BODIES}" $CERTS > ${CERTS_TMP}
|
||||||
|
while IFS= read -r line; do
|
||||||
|
echo "$line"
|
||||||
|
CMD=`echo "$line" | sed -n 's/^\/\* BEGIN FILE \([^ ]*\) \([^ ]*\) \([^ ]*\) \([^ ]*\)*.*$/\1 \2 \3 \4/p'`
|
||||||
|
if [ -n "$CMD" ]; then
|
||||||
|
enc=$(echo "$CMD" | cut -f1 -d' ' )
|
||||||
|
type=$(echo "$CMD" | cut -f2 -d' ' )
|
||||||
|
name=$(echo "$CMD" | cut -f3 -d' ' )
|
||||||
|
file=$(echo "$CMD" | cut -f4 -d' ' )
|
||||||
|
|
||||||
|
if [ "$type" != "variable" ] && [ "$type" != "macro" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$enc" != "string" ] && [ "$enc" != "binary" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Support 'binary' and 'string' encoding
|
||||||
|
# Support 'variable' and 'macro' types
|
||||||
|
|
||||||
|
if [ "$enc" = "binary" ]; then
|
||||||
|
DATA=`xxd -i "$file" | tail -n +2 | head -n -2 | sed 's/^[ ]*/ /'`
|
||||||
|
elif [ "$enc" = "string" ]; then
|
||||||
|
DATA=`cat "$file" | sed 's/^/ \"/;s/$/\\r\\n\"/'`
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$type" = "variable" ]; then
|
||||||
|
if [ "$enc" = "binary" ]; then
|
||||||
|
echo "const unsigned char ${name}[] = {"
|
||||||
|
xxd -i "$file" | sed 's/^[ ]*/ /' | tail -n +2 | head -n -2
|
||||||
|
echo "};"
|
||||||
|
elif [ "$enc" = "string" ]; then
|
||||||
|
echo "const char ${name}[] ="
|
||||||
|
cat "$file" | head -n -1 | sed 's/^/ \"/;s/$/\\r\\n\"/'
|
||||||
|
cat "$file" | tail -n 1 | sed 's/^/ \"/;s/$/\\r\\n\";/'
|
||||||
|
fi
|
||||||
|
elif [ "$type" = "macro" ]; then
|
||||||
|
if [ "$enc" = "binary" ]; then
|
||||||
|
printf '%-77s\\\n' "#define ${name} {"
|
||||||
|
xxd -i "$file" | sed 's/^[ ]*/ /' | tail -n +2 | head -n -2 |
|
||||||
|
xargs -d'\n' printf '%-77s\\\n'
|
||||||
|
echo "}"
|
||||||
|
elif [ "$enc" = "string" ]; then
|
||||||
|
printf '%-75s\\\n' "#define ${name}"
|
||||||
|
cat "$file" | head -n -1 | sed 's/^/ \"/; s/$/\\r\\n\"/' | xargs -d'\n' printf '%-75s\\\n'
|
||||||
|
cat "$file" | tail -n 1 | sed 's/^/ \"/; s/$/\\r\\n\"/'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "/* END FILE */"
|
||||||
|
fi
|
||||||
|
done < ${CERTS_TMP} > ${CERTS}
|
@ -15,6 +15,7 @@ OPENSSL ?= openssl
|
|||||||
FAKETIME ?= faketime
|
FAKETIME ?= faketime
|
||||||
MBEDTLS_CERT_WRITE ?= $(PWD)/../../programs/x509/cert_write
|
MBEDTLS_CERT_WRITE ?= $(PWD)/../../programs/x509/cert_write
|
||||||
MBEDTLS_CERT_REQ ?= $(PWD)/../../programs/x509/cert_req
|
MBEDTLS_CERT_REQ ?= $(PWD)/../../programs/x509/cert_req
|
||||||
|
MBEDTLS_GEN_KEY ?= $(PWD)/../../programs/pkey/gen_key
|
||||||
|
|
||||||
## Build the generated test data. Note that since the final outputs
|
## Build the generated test data. Note that since the final outputs
|
||||||
## are committed to the repository, this target should do nothing on a
|
## are committed to the repository, this target should do nothing on a
|
||||||
@ -146,6 +147,42 @@ all_final += cli-rsa-sha256.crt.der
|
|||||||
$(OPENSSL) pkey -in $< -out $@ -inform PEM -outform DER
|
$(OPENSSL) pkey -in $< -out $@ -inform PEM -outform DER
|
||||||
all_final += cli-rsa.key.der
|
all_final += cli-rsa.key.der
|
||||||
|
|
||||||
|
test-ca3.key.pem:
|
||||||
|
$(MBEDTLS_GEN_KEY) type=ec ec_curve=secp256r1 format=pem filename=$@
|
||||||
|
test-ca3.key.der: test-ca3.key.pem
|
||||||
|
$(OPENSSL) ec -inform PEM -outform DER -in $< -out $@
|
||||||
|
test-ca3.csr: test-ca3.key.der
|
||||||
|
$(MBEDTLS_CERT_REQ) filename=$< output_file=$@ subject_name="CN=Test CA Secp256r1, O=MbedTLS, C=UK" md=SHA256
|
||||||
|
test-ca3.crt.pem: test-ca3.csr test-ca3.key.der
|
||||||
|
$(MBEDTLS_CERT_WRITE) request_file=test-ca3.csr selfsign=1 issuer_name="CN=Test CA Secp256r1, O=MbedTLS, C=UK" is_ca=1 md=SHA256 issuer_key=test-ca3.key.der output_file=$@
|
||||||
|
test-ca3.crt.der: test-ca3.crt.pem
|
||||||
|
$(OPENSSL) x509 -inform PEM -outform DER -in $< -out $@
|
||||||
|
all_final += test-ca3.key.pem test-ca3.key.der test-ca3.csr test-ca3.crt.pem test-ca3.crt.der
|
||||||
|
|
||||||
|
cli3.key.pem:
|
||||||
|
$(MBEDTLS_GEN_KEY) type=ec ec_curve=secp256r1 format=pem filename=$@
|
||||||
|
cli3.key.der: cli3.key.pem
|
||||||
|
$(OPENSSL) ec -inform PEM -outform DER -in $< -out $@
|
||||||
|
cli3.csr: cli3.key.der
|
||||||
|
$(MBEDTLS_CERT_REQ) filename=$< output_file=$@ subject_name="CN=Test CRT2 Secp256r1, O=MbedTLS, C=UK" md=SHA256
|
||||||
|
cli3.crt.pem: cli3.csr test-ca3.key.der
|
||||||
|
$(MBEDTLS_CERT_WRITE) request_file=cli3.csr issuer_name="CN=Test CA Secp256r1, O=MbedTLS, C=UK" md=SHA256 issuer_key=test-ca3.key.der output_file=$@
|
||||||
|
cli3.crt.der: cli3.crt.pem
|
||||||
|
$(OPENSSL) x509 -inform PEM -outform DER -in $< -out $@
|
||||||
|
all_final += cli3.key.pem cli3.key.der cli3.csr cli3.crt.pem cli3.crt.der
|
||||||
|
|
||||||
|
server11.key.pem:
|
||||||
|
$(MBEDTLS_GEN_KEY) type=ec ec_curve=secp256r1 format=pem filename=$@
|
||||||
|
server11.key.der: server11.key.pem
|
||||||
|
$(OPENSSL) ec -inform PEM -outform DER -in $< -out $@
|
||||||
|
server11.csr: server11.key.der
|
||||||
|
$(MBEDTLS_CERT_REQ) filename=$< output_file=$@ subject_name="CN=localhost, O=MbedTLS, C=UK" md=SHA256
|
||||||
|
server11.crt.pem: server11.csr test-ca3.key.der
|
||||||
|
$(MBEDTLS_CERT_WRITE) request_file=server11.csr issuer_name="CN=Test CA Secp256r1, O=MbedTLS, C=UK" md=SHA256 issuer_key=test-ca3.key.der output_file=$@
|
||||||
|
server11.crt.der: server11.crt.pem
|
||||||
|
$(OPENSSL) x509 -inform PEM -outform DER -in $< -out $@
|
||||||
|
all_final += server11.key.pem server11.key.der server11.csr server11.crt.pem server11.crt.der
|
||||||
|
|
||||||
test_ca_int_rsa1 = test-int-ca.crt
|
test_ca_int_rsa1 = test-int-ca.crt
|
||||||
|
|
||||||
server7.csr: server7.key
|
server7.csr: server7.key
|
||||||
|
@ -11,6 +11,8 @@ There are two main CAs for use as trusted roots:
|
|||||||
- test-ca2*.crt aka "C=NL, O=PolarSSL, CN=Polarssl Test EC CA"
|
- test-ca2*.crt aka "C=NL, O=PolarSSL, CN=Polarssl Test EC CA"
|
||||||
uses an EC key with NIST P-384 (aka secp384r1)
|
uses an EC key with NIST P-384 (aka secp384r1)
|
||||||
variants used to test the keyUsage extension
|
variants used to test the keyUsage extension
|
||||||
|
- test-ca3.crt aka "CN=TestCASecp256r1, O=MbedTLS, C=UK"
|
||||||
|
uses an EC key with NIST P-256 (aka secp256r1)
|
||||||
The files test-ca_cat12 and test-ca_cat21 contain them concatenated both ways.
|
The files test-ca_cat12 and test-ca_cat21 contain them concatenated both ways.
|
||||||
|
|
||||||
Two intermediate CAs are signed by them:
|
Two intermediate CAs are signed by them:
|
||||||
@ -40,6 +42,7 @@ Short information fields:
|
|||||||
- name or pattern
|
- name or pattern
|
||||||
- issuing CA: 1 -> test-ca.crt
|
- issuing CA: 1 -> test-ca.crt
|
||||||
2 -> test-ca2.crt
|
2 -> test-ca2.crt
|
||||||
|
3 -> test-ca3.crt
|
||||||
I1 -> test-int-ca.crt
|
I1 -> test-int-ca.crt
|
||||||
I2 -> test-int-ca2.crt
|
I2 -> test-int-ca2.crt
|
||||||
I3 -> test-int-ca3.crt
|
I3 -> test-int-ca3.crt
|
||||||
@ -57,6 +60,7 @@ List of certificates:
|
|||||||
- cert_md*.crt, cert_sha*.crt: 1 R: signature hash
|
- cert_md*.crt, cert_sha*.crt: 1 R: signature hash
|
||||||
- cert_v1_with_ext.crt: 1 R: v1 with extensions (illegal)
|
- cert_v1_with_ext.crt: 1 R: v1 with extensions (illegal)
|
||||||
- cli2.crt: 2 E: basic
|
- cli2.crt: 2 E: basic
|
||||||
|
- cli3.crt: 3 E, secp256r1 curve
|
||||||
- cli-rsa.key, cli-rsa-*.crt: RSA key used for test clients, signed by
|
- cli-rsa.key, cli-rsa-*.crt: RSA key used for test clients, signed by
|
||||||
the RSA test CA.
|
the RSA test CA.
|
||||||
- enco-cert-utf8str.pem: see enco-ca-prstr.pem above
|
- enco-cert-utf8str.pem: see enco-ca-prstr.pem above
|
||||||
@ -102,6 +106,7 @@ List of certificates:
|
|||||||
_int3_int-ca2.crt: S10 + I3 + I2
|
_int3_int-ca2.crt: S10 + I3 + I2
|
||||||
_int3_int-ca2_ca.crt: S10 + I3 + I2 + 1
|
_int3_int-ca2_ca.crt: S10 + I3 + I2 + 1
|
||||||
_int3_spurious_int-ca2.crt: S10 + I3 + I1(spurious) + I2
|
_int3_spurious_int-ca2.crt: S10 + I3 + I1(spurious) + I2
|
||||||
|
- server11.crt: 3 E, secp256r1 curve
|
||||||
|
|
||||||
Certificate revocation lists
|
Certificate revocation lists
|
||||||
----------------------------
|
----------------------------
|
||||||
|
BIN
tests/data_files/cli3.crt.der
Normal file
BIN
tests/data_files/cli3.crt.der
Normal file
Binary file not shown.
12
tests/data_files/cli3.crt.pem
Normal file
12
tests/data_files/cli3.crt.pem
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIBuTCCAVygAwIBAgIBATAMBggqhkjOPQQDAgUAMDsxGjAYBgNVBAMMEVRlc3Qg
|
||||||
|
Q0EgU2VjcDI1NnIxMRAwDgYDVQQKDAdNYmVkVExTMQswCQYDVQQGEwJVSzAeFw0w
|
||||||
|
MTAxMDEwMDAwMDBaFw0zMDEyMzEyMzU5NTlaMD0xHDAaBgNVBAMME1Rlc3QgQ1JU
|
||||||
|
MiBTZWNwMjU2cjExEDAOBgNVBAoMB01iZWRUTFMxCzAJBgNVBAYTAlVLMFkwEwYH
|
||||||
|
KoZIzj0CAQYIKoZIzj0DAQcDQgAEEm+TJ4LBB85IBjWNcNIodr2L06CZqLbVClmH
|
||||||
|
uxPqiZafsAZDl0lqgL6cCigF/ML2EqFyKW+Oext3uAmNkemj6aNNMEswCQYDVR0T
|
||||||
|
BAIwADAdBgNVHQ4EFgQUF9Yq9UkoSClnXwrdghuhrokH/hIwHwYDVR0jBBgwFoAU
|
||||||
|
Sl6kYTNLFkgMMXgiNdb7zlDnIBIwDAYIKoZIzj0EAwIFAANJADBGAiEAg3UsTyLd
|
||||||
|
vCPRG13gbf1R8gb85g4K1VbZ+CKl58HW2VgCIQDXk/8WFrt7vA+m3L1xJxj8iln9
|
||||||
|
wMR16i9Fqykw7cqsRw==
|
||||||
|
-----END CERTIFICATE-----
|
8
tests/data_files/cli3.csr
Normal file
8
tests/data_files/cli3.csr
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
-----BEGIN CERTIFICATE REQUEST-----
|
||||||
|
MIH6MIGfAgEAMD0xHDAaBgNVBAMME1Rlc3QgQ1JUMiBTZWNwMjU2cjExEDAOBgNV
|
||||||
|
BAoMB01iZWRUTFMxCzAJBgNVBAYTAlVLMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD
|
||||||
|
QgAEEm+TJ4LBB85IBjWNcNIodr2L06CZqLbVClmHuxPqiZafsAZDl0lqgL6cCigF
|
||||||
|
/ML2EqFyKW+Oext3uAmNkemj6aAAMAwGCCqGSM49BAMCBQADSAAwRQIgPbHQgHvW
|
||||||
|
f/gN4jV+GHIkQGhI4OAa7d82/dVzxXbYxnACIQCoqAs7agETcK6jp7A36pnKT9Jc
|
||||||
|
Lck5I3roXwDPXMtzSg==
|
||||||
|
-----END CERTIFICATE REQUEST-----
|
BIN
tests/data_files/cli3.key.der
Normal file
BIN
tests/data_files/cli3.key.der
Normal file
Binary file not shown.
5
tests/data_files/cli3.key.pem
Normal file
5
tests/data_files/cli3.key.pem
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
-----BEGIN EC PRIVATE KEY-----
|
||||||
|
MHcCAQEEIGFE8JJMBKeo1BnPGgzGae1stIrWdEaUvjo9xO8OTC5QoAoGCCqGSM49
|
||||||
|
AwEHoUQDQgAEEm+TJ4LBB85IBjWNcNIodr2L06CZqLbVClmHuxPqiZafsAZDl0lq
|
||||||
|
gL6cCigF/ML2EqFyKW+Oext3uAmNkemj6Q==
|
||||||
|
-----END EC PRIVATE KEY-----
|
BIN
tests/data_files/server11.crt.der
Normal file
BIN
tests/data_files/server11.crt.der
Normal file
Binary file not shown.
12
tests/data_files/server11.crt.pem
Normal file
12
tests/data_files/server11.crt.pem
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIBrzCCAVKgAwIBAgIBATAMBggqhkjOPQQDAgUAMDsxGjAYBgNVBAMMEVRlc3Qg
|
||||||
|
Q0EgU2VjcDI1NnIxMRAwDgYDVQQKDAdNYmVkVExTMQswCQYDVQQGEwJVSzAeFw0w
|
||||||
|
MTAxMDEwMDAwMDBaFw0zMDEyMzEyMzU5NTlaMDMxEjAQBgNVBAMMCWxvY2FsaG9z
|
||||||
|
dDEQMA4GA1UECgwHTWJlZFRMUzELMAkGA1UEBhMCVUswWTATBgcqhkjOPQIBBggq
|
||||||
|
hkjOPQMBBwNCAATH4k2I+9HG/2AM4cN0pPkfO62ddKWwtDsdFezZoKxwXYm0ClZe
|
||||||
|
zZYmfpl8x5Q7+V2oGg3TXoC8TOmXjAtabfDNo00wSzAJBgNVHRMEAjAAMB0GA1Ud
|
||||||
|
DgQWBBQjXj0e2wlEVpSCbySpu2oDJgn7sjAfBgNVHSMEGDAWgBRKXqRhM0sWSAwx
|
||||||
|
eCI11vvOUOcgEjAMBggqhkjOPQQDAgUAA0kAMEYCIQCN7/F5DbM4Ug5NcKHeKFbb
|
||||||
|
3EHpsBjg0//gXa9mJ7Q4jAIhAIzio6vwCYnzrslzsTbPpmtU+6Op6SlzdGO/iR77
|
||||||
|
bcfp
|
||||||
|
-----END CERTIFICATE-----
|
8
tests/data_files/server11.csr
Normal file
8
tests/data_files/server11.csr
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
-----BEGIN CERTIFICATE REQUEST-----
|
||||||
|
MIHwMIGVAgEAMDMxEjAQBgNVBAMMCWxvY2FsaG9zdDEQMA4GA1UECgwHTWJlZFRM
|
||||||
|
UzELMAkGA1UEBhMCVUswWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATH4k2I+9HG
|
||||||
|
/2AM4cN0pPkfO62ddKWwtDsdFezZoKxwXYm0ClZezZYmfpl8x5Q7+V2oGg3TXoC8
|
||||||
|
TOmXjAtabfDNoAAwDAYIKoZIzj0EAwIFAANIADBFAiB8fjrx5Y4vietqCbuB1/1y
|
||||||
|
1UMETwhDoCr5uRlPmOME/AIhAKr7gJJguJcXvyWPBBLJ7Ig4ingF8UGirfeWu6es
|
||||||
|
4t3v
|
||||||
|
-----END CERTIFICATE REQUEST-----
|
BIN
tests/data_files/server11.key.der
Normal file
BIN
tests/data_files/server11.key.der
Normal file
Binary file not shown.
5
tests/data_files/server11.key.pem
Normal file
5
tests/data_files/server11.key.pem
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
-----BEGIN EC PRIVATE KEY-----
|
||||||
|
MHcCAQEEIGEWs7/9cQHgEI5v2qeQRGLoFhjrNK4lul6tmcqDACKuoAoGCCqGSM49
|
||||||
|
AwEHoUQDQgAEx+JNiPvRxv9gDOHDdKT5HzutnXSlsLQ7HRXs2aCscF2JtApWXs2W
|
||||||
|
Jn6ZfMeUO/ldqBoN016AvEzpl4wLWm3wzQ==
|
||||||
|
-----END EC PRIVATE KEY-----
|
BIN
tests/data_files/test-ca3.crt.der
Normal file
BIN
tests/data_files/test-ca3.crt.der
Normal file
Binary file not shown.
12
tests/data_files/test-ca3.crt.pem
Normal file
12
tests/data_files/test-ca3.crt.pem
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIBuTCCAV2gAwIBAgIBATAMBggqhkjOPQQDAgUAMDsxGjAYBgNVBAMMEVRlc3Qg
|
||||||
|
Q0EgU2VjcDI1NnIxMRAwDgYDVQQKDAdNYmVkVExTMQswCQYDVQQGEwJVSzAeFw0w
|
||||||
|
MTAxMDEwMDAwMDBaFw0zMDEyMzEyMzU5NTlaMDsxGjAYBgNVBAMMEVRlc3QgQ0Eg
|
||||||
|
U2VjcDI1NnIxMRAwDgYDVQQKDAdNYmVkVExTMQswCQYDVQQGEwJVSzBZMBMGByqG
|
||||||
|
SM49AgEGCCqGSM49AwEHA0IABLZIHgilzw/iCx1r09kyZsZfarzztX4y1km0S5Mx
|
||||||
|
rsFB67NjUhXE6/YY3W38oxeY4eIvEb516BOR/g3e3OL7Q8WjUDBOMAwGA1UdEwQF
|
||||||
|
MAMBAf8wHQYDVR0OBBYEFEpepGEzSxZIDDF4IjXW+85Q5yASMB8GA1UdIwQYMBaA
|
||||||
|
FEpepGEzSxZIDDF4IjXW+85Q5yASMAwGCCqGSM49BAMCBQADSAAwRQIhAKejV1jK
|
||||||
|
vPH1vIsZAr6/VmSvjXkxmT2rpzEP9iJvJAteAiBhCPtV7LdSF1ZUqphAK3DYh2m7
|
||||||
|
l1eSxSKXB29adbF96g==
|
||||||
|
-----END CERTIFICATE-----
|
8
tests/data_files/test-ca3.csr
Normal file
8
tests/data_files/test-ca3.csr
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
-----BEGIN CERTIFICATE REQUEST-----
|
||||||
|
MIH5MIGdAgEAMDsxGjAYBgNVBAMMEVRlc3QgQ0EgU2VjcDI1NnIxMRAwDgYDVQQK
|
||||||
|
DAdNYmVkVExTMQswCQYDVQQGEwJVSzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA
|
||||||
|
BLZIHgilzw/iCx1r09kyZsZfarzztX4y1km0S5MxrsFB67NjUhXE6/YY3W38oxeY
|
||||||
|
4eIvEb516BOR/g3e3OL7Q8WgADAMBggqhkjOPQQDAgUAA0kAMEYCIQD55eBPVcht
|
||||||
|
2trIK3YYWKJbGXIoKF0930KQh8eFAcFD8AIhAI2exrMqoNF8JDoUS2m3Vv0ZFYRG
|
||||||
|
982wT8Ok59LiWCOX
|
||||||
|
-----END CERTIFICATE REQUEST-----
|
BIN
tests/data_files/test-ca3.key.der
Normal file
BIN
tests/data_files/test-ca3.key.der
Normal file
Binary file not shown.
5
tests/data_files/test-ca3.key.pem
Normal file
5
tests/data_files/test-ca3.key.pem
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
-----BEGIN EC PRIVATE KEY-----
|
||||||
|
MHcCAQEEIDlfIVA04pd23r9UJhLf0kt6SkROecrhPbNWtawigBCkoAoGCCqGSM49
|
||||||
|
AwEHoUQDQgAEtkgeCKXPD+ILHWvT2TJmxl9qvPO1fjLWSbRLkzGuwUHrs2NSFcTr
|
||||||
|
9hjdbfyjF5jh4i8RvnXoE5H+Dd7c4vtDxQ==
|
||||||
|
-----END EC PRIVATE KEY-----
|
214
tests/ssl-opt.sh
214
tests/ssl-opt.sh
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user