From 90dac90f5333ce810312692fc06b26dcf834b8d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 12 Jun 2014 17:04:24 +0200 Subject: [PATCH] Small code simplification in pkcs5_pbes2() --- library/pkcs5.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/library/pkcs5.c b/library/pkcs5.c index 061f4738e..a4b92384e 100644 --- a/library/pkcs5.c +++ b/library/pkcs5.c @@ -204,19 +204,8 @@ int pkcs5_pbes2( asn1_buf *pbe_params, int mode, if( ( ret = cipher_setkey( &cipher_ctx, key, 8 * keylen, mode ) ) != 0 ) goto exit; - if( ( ret = cipher_set_iv( &cipher_ctx, iv, enc_scheme_params.len ) ) != 0 ) - goto exit; - - if( ( ret = cipher_reset( &cipher_ctx ) ) != 0 ) - goto exit; - - if( ( ret = cipher_update( &cipher_ctx, data, datalen, - output, &olen ) ) != 0 ) - { - goto exit; - } - - if( ( ret = cipher_finish( &cipher_ctx, output + olen, &olen ) ) != 0 ) + if( ( ret = cipher_crypt( &cipher_ctx, iv, enc_scheme_params.len, + data, datalen, output, &olen ) ) != 0 ) ret = POLARSSL_ERR_PKCS5_PASSWORD_MISMATCH; exit: