Adapt ssl_set_own_cert() to generic keys
diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c
index dd7fc46..e5adef7 100644
--- a/programs/ssl/ssl_client2.c
+++ b/programs/ssl/ssl_client2.c
@@ -257,7 +257,7 @@
#if defined(POLARSSL_X509_PARSE_C)
x509_cert cacert;
x509_cert clicert;
- rsa_context rsa;
+ pk_context pkey;
#endif
char *p, *q;
const int *list;
@@ -271,7 +271,7 @@
#if defined(POLARSSL_X509_PARSE_C)
memset( &cacert, 0, sizeof( x509_cert ) );
memset( &clicert, 0, sizeof( x509_cert ) );
- memset( &rsa, 0, sizeof( rsa_context ) );
+ pk_init( &pkey );
#endif
if( argc == 0 )
@@ -626,11 +626,11 @@
#if defined(POLARSSL_FS_IO)
if( strlen( opt.key_file ) )
- ret = x509parse_keyfile_rsa( &rsa, opt.key_file, "" );
+ ret = x509parse_keyfile( &pkey, opt.key_file, "" );
else
#endif
#if defined(POLARSSL_CERTS_C)
- ret = x509parse_key_rsa( &rsa, (const unsigned char *) test_cli_key,
+ ret = x509parse_key( &pkey, (const unsigned char *) test_cli_key,
strlen( test_cli_key ), NULL, 0 );
#else
{
@@ -640,7 +640,7 @@
#endif
if( ret != 0 )
{
- printf( " failed\n ! x509parse_key_rsa returned -0x%x\n\n", -ret );
+ printf( " failed\n ! x509parse_key returned -0x%x\n\n", -ret );
goto exit;
}
@@ -711,7 +711,7 @@
#if defined(POLARSSL_X509_PARSE_C)
ssl_set_ca_chain( &ssl, &cacert, NULL, opt.server_name );
- ssl_set_own_cert( &ssl, &clicert, &rsa );
+ ssl_set_own_cert( &ssl, &clicert, &pkey );
#endif
#if defined(POLARSSL_KEY_EXCHANGE_PSK_ENABLED)
@@ -911,7 +911,7 @@
#if defined(POLARSSL_X509_PARSE_C)
x509_free( &clicert );
x509_free( &cacert );
- rsa_free( &rsa );
+ pk_free( &pkey );
#endif
ssl_session_free( &saved_session );
ssl_free( &ssl );