From ba4878aa6478cca39ec1f583b17fc1d8d4f0b656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 27 Jun 2013 10:51:01 +0200 Subject: [PATCH] Rename x509parse_key & co with _rsa suffix --- doxygen/input/doc_x509.h | 4 +- include/polarssl/x509.h | 16 +-- library/x509parse.c | 20 ++-- programs/pkey/key_app.c | 8 +- programs/pkey/key_app_writer.c | 8 +- programs/pkey/rsa_sign_pss.c | 2 +- programs/pkey/rsa_verify_pss.c | 4 +- programs/ssl/ssl_client2.c | 6 +- programs/ssl/ssl_fork_server.c | 6 +- programs/ssl/ssl_mail_client.c | 6 +- programs/ssl/ssl_server.c | 6 +- programs/ssl/ssl_server2.c | 6 +- programs/test/o_p_test.c | 2 +- programs/test/ssl_cert_test.c | 4 +- programs/test/ssl_test.c | 4 +- programs/x509/cert_req.c | 4 +- tests/suites/test_suite_x509parse.data | 122 ++++++++++----------- tests/suites/test_suite_x509parse.function | 12 +- tests/suites/test_suite_x509write.function | 2 +- 19 files changed, 122 insertions(+), 120 deletions(-) diff --git a/doxygen/input/doc_x509.h b/doxygen/input/doc_x509.h index 56bb49b4de..16fe75a2be 100644 --- a/doxygen/input/doc_x509.h +++ b/doxygen/input/doc_x509.h @@ -11,8 +11,8 @@ * \c x509parse_crtfile()). * - X.509 certificate revocation list (CRL) reading (see \c x509parse_crl() * and\c x509parse_crlfile()). - * - X.509 (RSA) private key reading (see \c x509parse_key() and - * \c x509parse_keyfile()). + * - X.509 (RSA) private key reading (see \c x509parse_key_rsa() and + * \c x509parse_keyfile_rsa()). * - X.509 certificate signature verification (see \c x509parse_verify()) * * This module can be used to build a certificate authority (CA) chain and diff --git a/include/polarssl/x509.h b/include/polarssl/x509.h index 86624ecb01..d7f1443879 100644 --- a/include/polarssl/x509.h +++ b/include/polarssl/x509.h @@ -427,9 +427,9 @@ int x509parse_crlfile( x509_crl *chain, const char *path ); * * \return 0 if successful, or a specific X509 or PEM error code */ -int x509parse_key( rsa_context *rsa, - const unsigned char *key, size_t keylen, - const unsigned char *pwd, size_t pwdlen ); +int x509parse_key_rsa( rsa_context *rsa, + const unsigned char *key, size_t keylen, + const unsigned char *pwd, size_t pwdlen ); /** \ingroup x509_module */ /** @@ -441,8 +441,8 @@ int x509parse_key( rsa_context *rsa, * * \return 0 if successful, or a specific X509 or PEM error code */ -int x509parse_keyfile( rsa_context *rsa, const char *path, - const char *password ); +int x509parse_keyfile_rsa( rsa_context *rsa, const char *path, + const char *password ); /** \ingroup x509_module */ /** @@ -454,8 +454,8 @@ int x509parse_keyfile( rsa_context *rsa, const char *path, * * \return 0 if successful, or a specific X509 or PEM error code */ -int x509parse_public_key( rsa_context *rsa, - const unsigned char *key, size_t keylen ); +int x509parse_public_key_rsa( rsa_context *rsa, + const unsigned char *key, size_t keylen ); /** \ingroup x509_module */ /** @@ -466,7 +466,7 @@ int x509parse_public_key( rsa_context *rsa, * * \return 0 if successful, or a specific X509 or PEM error code */ -int x509parse_public_keyfile( rsa_context *rsa, const char *path ); +int x509parse_public_keyfile_rsa( rsa_context *rsa, const char *path ); /** \ingroup x509_module */ /** diff --git a/library/x509parse.c b/library/x509parse.c index ea3a24abca..7c7ee29fb9 100644 --- a/library/x509parse.c +++ b/library/x509parse.c @@ -1945,7 +1945,7 @@ int x509parse_crlfile( x509_crl *chain, const char *path ) /* * Load and parse a private RSA key */ -int x509parse_keyfile( rsa_context *rsa, const char *path, const char *pwd ) +int x509parse_keyfile_rsa( rsa_context *rsa, const char *path, const char *pwd ) { int ret; size_t n; @@ -1955,9 +1955,9 @@ int x509parse_keyfile( rsa_context *rsa, const char *path, const char *pwd ) return( ret ); if( pwd == NULL ) - ret = x509parse_key( rsa, buf, n, NULL, 0 ); + ret = x509parse_key_rsa( rsa, buf, n, NULL, 0 ); else - ret = x509parse_key( rsa, buf, n, + ret = x509parse_key_rsa( rsa, buf, n, (const unsigned char *) pwd, strlen( pwd ) ); memset( buf, 0, n + 1 ); @@ -1969,7 +1969,7 @@ int x509parse_keyfile( rsa_context *rsa, const char *path, const char *pwd ) /* * Load and parse a public RSA key */ -int x509parse_public_keyfile( rsa_context *rsa, const char *path ) +int x509parse_public_keyfile_rsa( rsa_context *rsa, const char *path ) { int ret; size_t n; @@ -1978,7 +1978,7 @@ int x509parse_public_keyfile( rsa_context *rsa, const char *path ) if ( (ret = load_file( path, &buf, &n ) ) != 0 ) return( ret ); - ret = x509parse_public_key( rsa, buf, n ); + ret = x509parse_public_key_rsa( rsa, buf, n ); memset( buf, 0, n + 1 ); polarssl_free( buf ); @@ -2258,8 +2258,9 @@ static int x509parse_key_pkcs8_encrypted_der( /* * Parse a private RSA key */ -int x509parse_key( rsa_context *rsa, const unsigned char *key, size_t keylen, - const unsigned char *pwd, size_t pwdlen ) +int x509parse_key_rsa( rsa_context *rsa, + const unsigned char *key, size_t keylen, + const unsigned char *pwd, size_t pwdlen ) { int ret; @@ -2365,7 +2366,8 @@ int x509parse_key( rsa_context *rsa, const unsigned char *key, size_t keylen, /* * Parse a public RSA key */ -int x509parse_public_key( rsa_context *rsa, const unsigned char *key, size_t keylen ) +int x509parse_public_key_rsa( rsa_context *rsa, + const unsigned char *key, size_t keylen ) { int ret; size_t len; @@ -3562,7 +3564,7 @@ int x509_self_test( int verbose ) rsa_init( &rsa, RSA_PKCS_V15, 0 ); - if( ( ret = x509parse_key( &rsa, + if( ( ret = x509parse_key_rsa( &rsa, (const unsigned char *) test_ca_key, i, (const unsigned char *) test_ca_pwd, j ) ) != 0 ) { diff --git a/programs/pkey/key_app.c b/programs/pkey/key_app.c index 2f906c4ecb..bea996aabc 100644 --- a/programs/pkey/key_app.c +++ b/programs/pkey/key_app.c @@ -164,14 +164,14 @@ int main( int argc, char *argv[] ) printf( "\n . Loading the private key ..." ); fflush( stdout ); - ret = x509parse_keyfile( &rsa, opt.filename, opt.password ); + ret = x509parse_keyfile_rsa( &rsa, opt.filename, opt.password ); if( ret != 0 ) { #ifdef POLARSSL_ERROR_C polarssl_strerror( ret, buf, 1024 ); #endif - printf( " failed\n ! x509parse_key returned %d - %s\n\n", ret, buf ); + printf( " failed\n ! x509parse_key_rsa returned %d - %s\n\n", ret, buf ); rsa_free( &rsa ); goto exit; } @@ -199,14 +199,14 @@ int main( int argc, char *argv[] ) printf( "\n . Loading the public key ..." ); fflush( stdout ); - ret = x509parse_public_keyfile( &rsa, opt.filename ); + ret = x509parse_public_keyfile_rsa( &rsa, opt.filename ); if( ret != 0 ) { #ifdef POLARSSL_ERROR_C polarssl_strerror( ret, buf, 1024 ); #endif - printf( " failed\n ! x509parse_public_key returned %d - %s\n\n", ret, buf ); + printf( " failed\n ! x509parse_public_key_rsa returned %d - %s\n\n", ret, buf ); rsa_free( &rsa ); goto exit; } diff --git a/programs/pkey/key_app_writer.c b/programs/pkey/key_app_writer.c index feb2ecc53d..88cb9071c2 100644 --- a/programs/pkey/key_app_writer.c +++ b/programs/pkey/key_app_writer.c @@ -238,14 +238,14 @@ int main( int argc, char *argv[] ) printf( "\n . Loading the private key ..." ); fflush( stdout ); - ret = x509parse_keyfile( &rsa, opt.filename, NULL ); + ret = x509parse_keyfile_rsa( &rsa, opt.filename, NULL ); if( ret != 0 ) { #ifdef POLARSSL_ERROR_C polarssl_strerror( ret, buf, 1024 ); #endif - printf( " failed\n ! x509parse_key returned %d - %s\n\n", ret, buf ); + printf( " failed\n ! x509parse_key_rsa returned %d - %s\n\n", ret, buf ); rsa_free( &rsa ); goto exit; } @@ -274,14 +274,14 @@ int main( int argc, char *argv[] ) printf( "\n . Loading the public key ..." ); fflush( stdout ); - ret = x509parse_public_keyfile( &rsa, opt.filename ); + ret = x509parse_public_keyfile_rsa( &rsa, opt.filename ); if( ret != 0 ) { #ifdef POLARSSL_ERROR_C polarssl_strerror( ret, buf, 1024 ); #endif - printf( " failed\n ! x509parse_public_key returned %d - %s\n\n", ret, buf ); + printf( " failed\n ! x509parse_public_key_rsa returned %d - %s\n\n", ret, buf ); rsa_free( &rsa ); goto exit; } diff --git a/programs/pkey/rsa_sign_pss.c b/programs/pkey/rsa_sign_pss.c index 82387080d4..e848f545f5 100644 --- a/programs/pkey/rsa_sign_pss.c +++ b/programs/pkey/rsa_sign_pss.c @@ -101,7 +101,7 @@ int main( int argc, char *argv[] ) rsa_init( &rsa, RSA_PKCS_V21, POLARSSL_MD_SHA1 ); - if( ( ret = x509parse_keyfile( &rsa, argv[1], "" ) ) != 0 ) + if( ( ret = x509parse_keyfile_rsa( &rsa, argv[1], "" ) ) != 0 ) { ret = 1; printf( " failed\n ! Could not open '%s'\n", argv[1] ); diff --git a/programs/pkey/rsa_verify_pss.c b/programs/pkey/rsa_verify_pss.c index b44daa0782..00d73781f6 100644 --- a/programs/pkey/rsa_verify_pss.c +++ b/programs/pkey/rsa_verify_pss.c @@ -83,9 +83,9 @@ int main( int argc, char *argv[] ) rsa_init( &rsa, RSA_PKCS_V21, POLARSSL_MD_SHA1 ); - if( ( ret = x509parse_public_keyfile( &rsa, argv[1] ) ) != 0 ) + if( ( ret = x509parse_public_keyfile_rsa( &rsa, argv[1] ) ) != 0 ) { - printf( " failed\n ! x509parse_public_key returned %d\n\n", ret ); + printf( " failed\n ! x509parse_public_key_rsa returned %d\n\n", ret ); goto exit; } diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index 1ddb86d9f1..036cc67ae1 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -533,11 +533,11 @@ int main( int argc, char *argv[] ) #if defined(POLARSSL_FS_IO) if( strlen( opt.key_file ) ) - ret = x509parse_keyfile( &rsa, opt.key_file, "" ); + ret = x509parse_keyfile_rsa( &rsa, opt.key_file, "" ); else #endif #if defined(POLARSSL_CERTS_C) - ret = x509parse_key( &rsa, (const unsigned char *) test_cli_key, + ret = x509parse_key_rsa( &rsa, (const unsigned char *) test_cli_key, strlen( test_cli_key ), NULL, 0 ); #else { @@ -547,7 +547,7 @@ int main( int argc, char *argv[] ) #endif if( ret != 0 ) { - printf( " failed\n ! x509parse_key returned -0x%x\n\n", -ret ); + printf( " failed\n ! x509parse_key_rsa returned -0x%x\n\n", -ret ); goto exit; } diff --git a/programs/ssl/ssl_fork_server.c b/programs/ssl/ssl_fork_server.c index e021ebbd66..986458b5e4 100644 --- a/programs/ssl/ssl_fork_server.c +++ b/programs/ssl/ssl_fork_server.c @@ -139,7 +139,7 @@ int main( int argc, char *argv[] ) /* * This demonstration program uses embedded test certificates. * Instead, you may want to use x509parse_crtfile() to read the - * server and CA certificates, as well as x509parse_keyfile(). + * server and CA certificates, as well as x509parse_keyfile_rsa(). */ ret = x509parse_crt( &srvcert, (const unsigned char *) test_srv_crt, strlen( test_srv_crt ) ); @@ -158,11 +158,11 @@ int main( int argc, char *argv[] ) } rsa_init( &rsa, RSA_PKCS_V15, 0 ); - ret = x509parse_key( &rsa, (const unsigned char *) test_srv_key, + ret = x509parse_key_rsa( &rsa, (const unsigned char *) test_srv_key, strlen( test_srv_key ), NULL, 0 ); if( ret != 0 ) { - printf( " failed\n ! x509parse_key returned %d\n\n", ret ); + printf( " failed\n ! x509parse_key_rsa returned %d\n\n", ret ); goto exit; } diff --git a/programs/ssl/ssl_mail_client.c b/programs/ssl/ssl_mail_client.c index 4b5d177a52..665cdbfe81 100644 --- a/programs/ssl/ssl_mail_client.c +++ b/programs/ssl/ssl_mail_client.c @@ -532,11 +532,11 @@ int main( int argc, char *argv[] ) #if defined(POLARSSL_FS_IO) if( strlen( opt.key_file ) ) - ret = x509parse_keyfile( &rsa, opt.key_file, "" ); + ret = x509parse_keyfile_rsa( &rsa, opt.key_file, "" ); else #endif #if defined(POLARSSL_CERTS_C) - ret = x509parse_key( &rsa, (const unsigned char *) test_cli_key, + ret = x509parse_key_rsa( &rsa, (const unsigned char *) test_cli_key, strlen( test_cli_key ), NULL, 0 ); #else { @@ -546,7 +546,7 @@ int main( int argc, char *argv[] ) #endif if( ret != 0 ) { - printf( " failed\n ! x509parse_key returned %d\n\n", ret ); + printf( " failed\n ! x509parse_key_rsa returned %d\n\n", ret ); goto exit; } diff --git a/programs/ssl/ssl_server.c b/programs/ssl/ssl_server.c index 3059236ec5..dbb193ba40 100644 --- a/programs/ssl/ssl_server.c +++ b/programs/ssl/ssl_server.c @@ -117,7 +117,7 @@ int main( int argc, char *argv[] ) /* * This demonstration program uses embedded test certificates. * Instead, you may want to use x509parse_crtfile() to read the - * server and CA certificates, as well as x509parse_keyfile(). + * server and CA certificates, as well as x509parse_keyfile_rsa(). */ ret = x509parse_crt( &srvcert, (const unsigned char *) test_srv_crt, strlen( test_srv_crt ) ); @@ -136,11 +136,11 @@ int main( int argc, char *argv[] ) } rsa_init( &rsa, RSA_PKCS_V15, 0 ); - ret = x509parse_key( &rsa, (const unsigned char *) test_srv_key, + ret = x509parse_key_rsa( &rsa, (const unsigned char *) test_srv_key, strlen( test_srv_key ), NULL, 0 ); if( ret != 0 ) { - printf( " failed\n ! x509parse_key returned %d\n\n", ret ); + printf( " failed\n ! x509parse_key_rsa returned %d\n\n", ret ); goto exit; } diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index 6197cda4a8..db2d123a2d 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -501,11 +501,11 @@ int main( int argc, char *argv[] ) #if defined(POLARSSL_FS_IO) if( strlen( opt.key_file ) ) - ret = x509parse_keyfile( &rsa, opt.key_file, "" ); + ret = x509parse_keyfile_rsa( &rsa, opt.key_file, "" ); else #endif #if defined(POLARSSL_CERTS_C) - ret = x509parse_key( &rsa, (const unsigned char *) test_srv_key, + ret = x509parse_key_rsa( &rsa, (const unsigned char *) test_srv_key, strlen( test_srv_key ), NULL, 0 ); #else { @@ -515,7 +515,7 @@ int main( int argc, char *argv[] ) #endif if( ret != 0 ) { - printf( " failed\n ! x509parse_key returned -0x%x\n\n", -ret ); + printf( " failed\n ! x509parse_key_rsa returned -0x%x\n\n", -ret ); goto exit; } diff --git a/programs/test/o_p_test.c b/programs/test/o_p_test.c index 97262825e0..84dd38bace 100644 --- a/programs/test/o_p_test.c +++ b/programs/test/o_p_test.c @@ -104,7 +104,7 @@ int main( int argc, char *argv[] ) fflush( stdout ); rsa_init( &p_rsa, RSA_PKCS_V15, 0 ); - if( x509parse_keyfile( &p_rsa, argv[1], NULL ) != 0 ) + if( x509parse_keyfile_rsa( &p_rsa, argv[1], NULL ) != 0 ) { ret = 1; printf( " failed\n ! Could not load key.\n\n" ); diff --git a/programs/test/ssl_cert_test.c b/programs/test/ssl_cert_test.c index 83a2a01239..bf4684b2f2 100644 --- a/programs/test/ssl_cert_test.c +++ b/programs/test/ssl_cert_test.c @@ -196,10 +196,10 @@ int main( int argc, char *argv[] ) printf( " . Loading the client private key %s...", name ); fflush( stdout ); - ret = x509parse_keyfile( &rsa, name, NULL ); + ret = x509parse_keyfile_rsa( &rsa, name, NULL ); if( ret != 0 ) { - printf( " failed\n ! x509parse_key returned %d\n\n", ret ); + printf( " failed\n ! x509parse_key_rsa returned %d\n\n", ret ); goto exit; } diff --git a/programs/test/ssl_test.c b/programs/test/ssl_test.c index 607b09250a..ce45ccf870 100644 --- a/programs/test/ssl_test.c +++ b/programs/test/ssl_test.c @@ -229,11 +229,11 @@ static int ssl_test( struct options *opt ) goto exit; } - ret = x509parse_key( &rsa, (const unsigned char *) test_srv_key, + ret = x509parse_key_rsa( &rsa, (const unsigned char *) test_srv_key, strlen( test_srv_key ), NULL, 0 ); if( ret != 0 ) { - printf( " ! x509parse_key returned %d\n\n", ret ); + printf( " ! x509parse_key_rsa returned %d\n\n", ret ); goto exit; } #endif diff --git a/programs/x509/cert_req.c b/programs/x509/cert_req.c index 20418abb51..cbd62521d1 100644 --- a/programs/x509/cert_req.c +++ b/programs/x509/cert_req.c @@ -267,14 +267,14 @@ int main( int argc, char *argv[] ) printf( "\n . Loading the private key ..." ); fflush( stdout ); - ret = x509parse_keyfile( &rsa, opt.filename, NULL ); + ret = x509parse_keyfile_rsa( &rsa, opt.filename, NULL ); if( ret != 0 ) { #ifdef POLARSSL_ERROR_C error_strerror( ret, buf, 1024 ); #endif - printf( " failed\n ! x509parse_key returned %d - %s\n\n", ret, buf ); + printf( " failed\n ! x509parse_key_rsa returned %d - %s\n\n", ret, buf ); rsa_free( &rsa ); goto exit; } diff --git a/tests/suites/test_suite_x509parse.data b/tests/suites/test_suite_x509parse.data index 570513be46..c82465f88d 100644 --- a/tests/suites/test_suite_x509parse.data +++ b/tests/suites/test_suite_x509parse.data @@ -78,113 +78,113 @@ X509 CRL Information SHA512 Digest depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO x509_crl_info:"data_files/crl_sha512.pem":"CRL version \: 1\nissuer name \: C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update \: 2011-02-12 14\:44\:07\nnext update \: 2011-04-13 14\:44\:07\nRevoked certificates\:\nserial number\: 01 revocation date\: 2011-02-12 14\:44\:07\nserial number\: 03 revocation date\: 2011-02-12 14\:44\:07\nsigned using \: RSA with SHA-512\n" -X509 Parse Key #1 (No password when required) +X509 Parse RSA Key #1 (No password when required) depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509parse_keyfile:"data_files/test-ca.key":NULL:POLARSSL_ERR_X509_PASSWORD_REQUIRED +x509parse_keyfile_rsa:"data_files/test-ca.key":NULL:POLARSSL_ERR_X509_PASSWORD_REQUIRED -X509 Parse Key #2 (Correct password) +X509 Parse RSA Key #2 (Correct password) depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509parse_keyfile:"data_files/test-ca.key":"PolarSSLTest":0 +x509parse_keyfile_rsa:"data_files/test-ca.key":"PolarSSLTest":0 -X509 Parse Key #3 (Wrong password) +X509 Parse RSA Key #3 (Wrong password) depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509parse_keyfile:"data_files/test-ca.key":"PolarSSLWRONG":POLARSSL_ERR_X509_PASSWORD_MISMATCH +x509parse_keyfile_rsa:"data_files/test-ca.key":"PolarSSLWRONG":POLARSSL_ERR_X509_PASSWORD_MISMATCH -X509 Parse Key #4 (DES Encrypted) +X509 Parse RSA Key #4 (DES Encrypted) depends_on:POLARSSL_MD5_C:POLARSSL_DES_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509parse_keyfile:"data_files/keyfile.des":"testkey":0 +x509parse_keyfile_rsa:"data_files/keyfile.des":"testkey":0 -X509 Parse Key #5 (3DES Encrypted) +X509 Parse RSA Key #5 (3DES Encrypted) depends_on:POLARSSL_MD5_C:POLARSSL_DES_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509parse_keyfile:"data_files/keyfile.3des":"testkey":0 +x509parse_keyfile_rsa:"data_files/keyfile.3des":"testkey":0 -X509 Parse Key #6 (AES-128 Encrypted) +X509 Parse RSA Key #6 (AES-128 Encrypted) depends_on:POLARSSL_MD5_C:POLARSSL_AES_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509parse_keyfile:"data_files/keyfile.aes128":"testkey":0 +x509parse_keyfile_rsa:"data_files/keyfile.aes128":"testkey":0 -X509 Parse Key #7 (AES-192 Encrypted) +X509 Parse RSA Key #7 (AES-192 Encrypted) depends_on:POLARSSL_MD5_C:POLARSSL_AES_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509parse_keyfile:"data_files/keyfile.aes192":"testkey":0 +x509parse_keyfile_rsa:"data_files/keyfile.aes192":"testkey":0 -X509 Parse Key #8 (AES-256 Encrypted) +X509 Parse RSA Key #8 (AES-256 Encrypted) depends_on:POLARSSL_MD5_C:POLARSSL_AES_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509parse_keyfile:"data_files/keyfile.aes256":"testkey":0 +x509parse_keyfile_rsa:"data_files/keyfile.aes256":"testkey":0 -X509 Parse Key #9 (PKCS#8 wrapped) +X509 Parse RSA Key #9 (PKCS#8 wrapped) depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509parse_keyfile:"data_files/format_gen.key":"":0 +x509parse_keyfile_rsa:"data_files/format_gen.key":"":0 -X509 Parse Key #10 (PKCS#8 encrypted SHA1-3DES) +X509 Parse RSA Key #10 (PKCS#8 encrypted SHA1-3DES) depends_on:POLARSSL_DES_C:POLARSSL_SHA1_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_PKCS12_C -x509parse_keyfile:"data_files/pkcs8_pbe_sha1_3des.key":"PolarSSLTest":0 +x509parse_keyfile_rsa:"data_files/pkcs8_pbe_sha1_3des.key":"PolarSSLTest":0 -X509 Parse Key #10.1 (PKCS#8 encrypted SHA1-3DES, wrong PW) +X509 Parse RSA Key #10.1 (PKCS#8 encrypted SHA1-3DES, wrong PW) depends_on:POLARSSL_DES_C:POLARSSL_SHA1_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_PKCS12_C -x509parse_keyfile:"data_files/pkcs8_pbe_sha1_3des.key":"PolarSSLTes":POLARSSL_ERR_X509_PASSWORD_MISMATCH +x509parse_keyfile_rsa:"data_files/pkcs8_pbe_sha1_3des.key":"PolarSSLTes":POLARSSL_ERR_X509_PASSWORD_MISMATCH -X509 Parse Key #10.2 (PKCS#8 encrypted SHA1-3DES, no PW) +X509 Parse RSA Key #10.2 (PKCS#8 encrypted SHA1-3DES, no PW) depends_on:POLARSSL_DES_C:POLARSSL_SHA1_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_PKCS12_C -x509parse_keyfile:"data_files/pkcs8_pbe_sha1_3des.key":"":POLARSSL_ERR_X509_PASSWORD_REQUIRED +x509parse_keyfile_rsa:"data_files/pkcs8_pbe_sha1_3des.key":"":POLARSSL_ERR_X509_PASSWORD_REQUIRED -X509 Parse Key #11 (PKCS#8 encrypted SHA1-3DES DER) +X509 Parse RSA Key #11 (PKCS#8 encrypted SHA1-3DES DER) depends_on:POLARSSL_DES_C:POLARSSL_SHA1_C:POLARSSL_FS_IO:POLARSSL_PKCS12_C -x509parse_keyfile:"data_files/pkcs8_pbe_sha1_3des.der":"PolarSSLTest":0 +x509parse_keyfile_rsa:"data_files/pkcs8_pbe_sha1_3des.der":"PolarSSLTest":0 -X509 Parse Key #12 (PKCS#8 encrypted SHA1-2DES) +X509 Parse RSA Key #12 (PKCS#8 encrypted SHA1-2DES) depends_on:POLARSSL_DES_C:POLARSSL_SHA1_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_PKCS12_C -x509parse_keyfile:"data_files/pkcs8_pbe_sha1_2des.key":"PolarSSLTest":0 +x509parse_keyfile_rsa:"data_files/pkcs8_pbe_sha1_2des.key":"PolarSSLTest":0 -X509 Parse Key #12.1 (PKCS#8 encrypted SHA1-2DES, wrong PW) +X509 Parse RSA Key #12.1 (PKCS#8 encrypted SHA1-2DES, wrong PW) depends_on:POLARSSL_DES_C:POLARSSL_SHA1_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_PKCS12_C -x509parse_keyfile:"data_files/pkcs8_pbe_sha1_2des.key":"PolarSLTest":POLARSSL_ERR_X509_PASSWORD_MISMATCH +x509parse_keyfile_rsa:"data_files/pkcs8_pbe_sha1_2des.key":"PolarSLTest":POLARSSL_ERR_X509_PASSWORD_MISMATCH -X509 Parse Key #12.2 (PKCS#8 encrypted SHA1-2DES, no PW) +X509 Parse RSA Key #12.2 (PKCS#8 encrypted SHA1-2DES, no PW) depends_on:POLARSSL_DES_C:POLARSSL_SHA1_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_PKCS12_C -x509parse_keyfile:"data_files/pkcs8_pbe_sha1_2des.key":"":POLARSSL_ERR_X509_PASSWORD_REQUIRED +x509parse_keyfile_rsa:"data_files/pkcs8_pbe_sha1_2des.key":"":POLARSSL_ERR_X509_PASSWORD_REQUIRED -X509 Parse Key #13 (PKCS#8 encrypted SHA1-RC4-128) +X509 Parse RSA Key #13 (PKCS#8 encrypted SHA1-RC4-128) depends_on:POLARSSL_ARC4_C:POLARSSL_SHA1_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_PKCS12_C -x509parse_keyfile:"data_files/pkcs8_pbe_sha1_rc4_128.key":"PolarSSLTest":0 +x509parse_keyfile_rsa:"data_files/pkcs8_pbe_sha1_rc4_128.key":"PolarSSLTest":0 -X509 Parse Key #13.1 (PKCS#8 encrypted SHA1-RC4-128, wrong PW) +X509 Parse RSA Key #13.1 (PKCS#8 encrypted SHA1-RC4-128, wrong PW) depends_on:POLARSSL_ARC4_C:POLARSSL_SHA1_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_PKCS12_C -x509parse_keyfile:"data_files/pkcs8_pbe_sha1_rc4_128.key":"PolarSSLTe":POLARSSL_ERR_X509_PASSWORD_MISMATCH +x509parse_keyfile_rsa:"data_files/pkcs8_pbe_sha1_rc4_128.key":"PolarSSLTe":POLARSSL_ERR_X509_PASSWORD_MISMATCH -X509 Parse Key #13.2 (PKCS#8 encrypted SHA1-RC4-128, no PW) +X509 Parse RSA Key #13.2 (PKCS#8 encrypted SHA1-RC4-128, no PW) depends_on:POLARSSL_ARC4_C:POLARSSL_SHA1_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_PKCS12_C -x509parse_keyfile:"data_files/pkcs8_pbe_sha1_rc4_128.key":"":POLARSSL_ERR_X509_PASSWORD_REQUIRED +x509parse_keyfile_rsa:"data_files/pkcs8_pbe_sha1_rc4_128.key":"":POLARSSL_ERR_X509_PASSWORD_REQUIRED -X509 Parse Key #14 (PKCS#8 encrypted v2 PBDFK2 3DES) +X509 Parse RSA Key #14 (PKCS#8 encrypted v2 PBDFK2 3DES) depends_on:POLARSSL_DES_C:POLARSSL_SHA1_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_PKCS5_C -x509parse_keyfile:"data_files/pkcs8_pbes2_pbkdf2_3des.key":"PolarSSLTest":0 +x509parse_keyfile_rsa:"data_files/pkcs8_pbes2_pbkdf2_3des.key":"PolarSSLTest":0 -X509 Parse Key #15 (PKCS#8 encrypted v2 PBDFK2 3DES, wrong PW) +X509 Parse RSA Key #15 (PKCS#8 encrypted v2 PBDFK2 3DES, wrong PW) depends_on:POLARSSL_DES_C:POLARSSL_SHA1_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_PKCS5_C -x509parse_keyfile:"data_files/pkcs8_pbes2_pbkdf2_3des.key":"PolarSSLTes":POLARSSL_ERR_X509_PASSWORD_MISMATCH +x509parse_keyfile_rsa:"data_files/pkcs8_pbes2_pbkdf2_3des.key":"PolarSSLTes":POLARSSL_ERR_X509_PASSWORD_MISMATCH -X509 Parse Key #16 (PKCS#8 encrypted v2 PBDFK2 3DES, no PW) +X509 Parse RSA Key #16 (PKCS#8 encrypted v2 PBDFK2 3DES, no PW) depends_on:POLARSSL_DES_C:POLARSSL_SHA1_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_PKCS5_C -x509parse_keyfile:"data_files/pkcs8_pbes2_pbkdf2_3des.key":"":POLARSSL_ERR_X509_PASSWORD_REQUIRED +x509parse_keyfile_rsa:"data_files/pkcs8_pbes2_pbkdf2_3des.key":"":POLARSSL_ERR_X509_PASSWORD_REQUIRED -X509 Parse Key #17 (PKCS#8 encrypted v2 PBDFK2 3DES DER) +X509 Parse RSA Key #17 (PKCS#8 encrypted v2 PBDFK2 3DES DER) depends_on:POLARSSL_DES_C:POLARSSL_SHA1_C:POLARSSL_FS_IO:POLARSSL_PKCS5_C -x509parse_keyfile:"data_files/pkcs8_pbes2_pbkdf2_3des.der":"PolarSSLTest":0 +x509parse_keyfile_rsa:"data_files/pkcs8_pbes2_pbkdf2_3des.der":"PolarSSLTest":0 -X509 Parse Key #18 (PKCS#8 encrypted v2 PBDFK2 3DES DER, wrong PW) +X509 Parse RSA Key #18 (PKCS#8 encrypted v2 PBDFK2 3DES DER, wrong PW) depends_on:POLARSSL_DES_C:POLARSSL_SHA1_C:POLARSSL_FS_IO:POLARSSL_PKCS5_C -x509parse_keyfile:"data_files/pkcs8_pbes2_pbkdf2_3des.der":"PolarSSLTes":POLARSSL_ERR_X509_PASSWORD_MISMATCH +x509parse_keyfile_rsa:"data_files/pkcs8_pbes2_pbkdf2_3des.der":"PolarSSLTes":POLARSSL_ERR_X509_PASSWORD_MISMATCH -X509 Parse Key #19 (PKCS#8 encrypted v2 PBDFK2 3DES DER, no PW) +X509 Parse RSA Key #19 (PKCS#8 encrypted v2 PBDFK2 3DES DER, no PW) depends_on:POLARSSL_DES_C:POLARSSL_SHA1_C:POLARSSL_FS_IO:POLARSSL_PKCS5_C -x509parse_keyfile:"data_files/pkcs8_pbes2_pbkdf2_3des.der":"":POLARSSL_ERR_X509_KEY_INVALID_FORMAT +x509parse_keyfile_rsa:"data_files/pkcs8_pbes2_pbkdf2_3des.der":"":POLARSSL_ERR_X509_KEY_INVALID_FORMAT -X509 Parse Key #20 (PKCS#8 encrypted v2 PBDFK2 DES) +X509 Parse RSA Key #20 (PKCS#8 encrypted v2 PBDFK2 DES) depends_on:POLARSSL_DES_C:POLARSSL_SHA1_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_PKCS5_C -x509parse_keyfile:"data_files/pkcs8_pbes2_pbkdf2_des.key":"PolarSSLTest":0 +x509parse_keyfile_rsa:"data_files/pkcs8_pbes2_pbkdf2_des.key":"PolarSSLTest":0 -X509 Parse Public Key #1 (PKCS#8 wrapped) +X509 Parse Public RSA Key #1 (PKCS#8 wrapped) depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509parse_public_keyfile:"data_files/format_gen.pub":0 +x509parse_public_keyfile_rsa:"data_files/format_gen.pub":0 X509 Get Distinguished Name #1 depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO @@ -652,22 +652,22 @@ X509 CRL ASN1 (TBSCertList, no entries) x509parse_crl:"30463031020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030300d06092a864886f70d01010e050003020001":"CRL version \: 1\nissuer name \: CN=ABCD\nthis update \: 2009-01-01 00\:00\:00\nnext update \: 0000-00-00 00\:00\:00\nRevoked certificates\:\nsigned using \: RSA with SHA-224\n":0 X509 Key ASN1 (Incorrect first tag) -x509parse_key:"":"":POLARSSL_ERR_X509_KEY_INVALID_FORMAT +x509parse_key_rsa:"":"":POLARSSL_ERR_X509_KEY_INVALID_FORMAT X509 Key ASN1 (RSAPrivateKey, incorrect version tag) -x509parse_key:"300100":"":POLARSSL_ERR_X509_KEY_INVALID_FORMAT +x509parse_key_rsa:"300100":"":POLARSSL_ERR_X509_KEY_INVALID_FORMAT X509 Key ASN1 (RSAPrivateKey, version tag missing) -x509parse_key:"3000":"":POLARSSL_ERR_X509_KEY_INVALID_FORMAT +x509parse_key_rsa:"3000":"":POLARSSL_ERR_X509_KEY_INVALID_FORMAT X509 Key ASN1 (RSAPrivateKey, invalid version) -x509parse_key:"3003020101":"":POLARSSL_ERR_X509_KEY_INVALID_FORMAT +x509parse_key_rsa:"3003020101":"":POLARSSL_ERR_X509_KEY_INVALID_FORMAT X509 Key ASN1 (RSAPrivateKey, correct version, incorrect tag) -x509parse_key:"300402010000":"":POLARSSL_ERR_X509_KEY_INVALID_FORMAT +x509parse_key_rsa:"300402010000":"":POLARSSL_ERR_X509_KEY_INVALID_FORMAT X509 Key ASN1 (RSAPrivateKey, values present, length mismatch) -x509parse_key:"301c02010002010102010102010102010102010102010102010102010100":"":POLARSSL_ERR_X509_KEY_INVALID_FORMAT +x509parse_key_rsa:"301c02010002010102010102010102010102010102010102010102010100":"":POLARSSL_ERR_X509_KEY_INVALID_FORMAT X509 Key ASN1 (RSAPrivateKey, values present, check_privkey fails) -x509parse_key:"301b020100020101020101020101020101020101020101020101020101":"":POLARSSL_ERR_X509_KEY_INVALID_FORMAT +x509parse_key_rsa:"301b020100020101020101020101020101020101020101020101020101":"":POLARSSL_ERR_X509_KEY_INVALID_FORMAT diff --git a/tests/suites/test_suite_x509parse.function b/tests/suites/test_suite_x509parse.function index 8b69327ff9..9b422f0ac4 100644 --- a/tests/suites/test_suite_x509parse.function +++ b/tests/suites/test_suite_x509parse.function @@ -138,14 +138,14 @@ x509_time_expired:crt_file:entity:result END_CASE BEGIN_CASE -x509parse_keyfile:key_file:password:result +x509parse_keyfile_rsa:key_file:password:result { rsa_context rsa; int res; memset( &rsa, 0, sizeof( rsa_context ) ); - res = x509parse_keyfile( &rsa, {key_file}, {password} ); + res = x509parse_keyfile_rsa( &rsa, {key_file}, {password} ); TEST_ASSERT( res == {result} ); @@ -159,14 +159,14 @@ x509parse_keyfile:key_file:password:result END_CASE BEGIN_CASE -x509parse_public_keyfile:key_file:result +x509parse_public_keyfile_rsa:key_file:result { rsa_context rsa; int res; memset( &rsa, 0, sizeof( rsa_context ) ); - res = x509parse_public_keyfile( &rsa, {key_file} ); + res = x509parse_public_keyfile_rsa( &rsa, {key_file} ); TEST_ASSERT( res == {result} ); @@ -238,7 +238,7 @@ x509parse_crl:crl_data:result_str:result END_CASE BEGIN_CASE -x509parse_key:key_data:result_str:result +x509parse_key_rsa:key_data:result_str:result { rsa_context rsa; unsigned char buf[2000]; @@ -251,7 +251,7 @@ x509parse_key:key_data:result_str:result data_len = unhexify( buf, {key_data} ); - TEST_ASSERT( x509parse_key( &rsa, buf, data_len, NULL, 0 ) == ( {result} ) ); + TEST_ASSERT( x509parse_key_rsa( &rsa, buf, data_len, NULL, 0 ) == ( {result} ) ); if( ( {result} ) == 0 ) { TEST_ASSERT( 1 ); diff --git a/tests/suites/test_suite_x509write.function b/tests/suites/test_suite_x509write.function index 8ce3e712fe..e3bf12f722 100644 --- a/tests/suites/test_suite_x509write.function +++ b/tests/suites/test_suite_x509write.function @@ -41,7 +41,7 @@ x509_cert_req_check:key_file:md_type:cert_req_check_file strcpy( cur->name, "NL" ); memset( &rsa, 0, sizeof(rsa_context) ); - ret = x509parse_keyfile( &rsa, {key_file}, NULL ); + ret = x509parse_keyfile_rsa( &rsa, {key_file}, NULL ); TEST_ASSERT( ret == 0 ); if( ret != 0 ) return 0;