From: Richard Levitte Date: Mon, 3 Aug 2020 19:09:26 +0000 (+0200) Subject: PEM: Fix i2b_PvK to use EVP_Encrypt calls consistently X-Git-Tag: openssl-3.0.0-alpha7~638 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dca51418b0186c1d829b04ce89990148fbedbf9c;p=thirdparty%2Fopenssl.git PEM: Fix i2b_PvK to use EVP_Encrypt calls consistently Reviewed-by: Shane Lontis (Merged from https://github.com/openssl/openssl/pull/12574) --- diff --git a/crypto/pem/pvkfmt.c b/crypto/pem/pvkfmt.c index 3745a1c1e35..95d1ff5a94d 100644 --- a/crypto/pem/pvkfmt.c +++ b/crypto/pem/pvkfmt.c @@ -859,9 +859,9 @@ static int i2b_PVK(unsigned char **out, const EVP_PKEY *pk, int enclevel, if (!EVP_EncryptInit_ex(cctx, EVP_rc4(), NULL, keybuf, NULL)) goto error; OPENSSL_cleanse(keybuf, 20); - if (!EVP_DecryptUpdate(cctx, p, &enctmplen, p, pklen - 8)) + if (!EVP_EncryptUpdate(cctx, p, &enctmplen, p, pklen - 8)) goto error; - if (!EVP_DecryptFinal_ex(cctx, p + enctmplen, &enctmplen)) + if (!EVP_EncryptFinal_ex(cctx, p + enctmplen, &enctmplen)) goto error; }