From 9c1cf459dd249c49bb9598ae3322662f5b470a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 4 Jul 2013 11:20:24 +0200 Subject: [PATCH] Implement x509parse_key_pkcs8_encrypted_der_ec() --- library/x509parse.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/library/x509parse.c b/library/x509parse.c index caf59c433..b231f8001 100644 --- a/library/x509parse.c +++ b/library/x509parse.c @@ -2815,25 +2815,20 @@ static int x509parse_key_pkcs8_unencrypted_der_ec( */ static int x509parse_key_pkcs8_encrypted_der_ec( ecp_keypair *eck, - const unsigned char *key, - size_t keylen, - const unsigned char *pwd, - size_t pwdlen ) + const unsigned char *key, size_t keylen, + const unsigned char *pwd, size_t pwdlen ) { int ret; + unsigned char buf[2048]; + size_t len = 0; - (void) key; - (void) keylen; - (void) pwd; - (void) pwdlen; - - if( ( ret = ecp_check_prvkey( &eck->grp, &eck->d ) ) != 0 ) + if( ( ret = x509parse_pkcs8_decrypt( buf, sizeof( buf ), &len, + key, keylen, pwd, pwdlen ) ) != 0 ) { - ecp_keypair_free( eck ); return( ret ); } - return 0; + return( x509parse_key_pkcs8_unencrypted_der_ec( eck, buf, len ) ); } /*