From: tb Date: Sat, 30 Jul 2022 11:24:52 +0000 (+0000) Subject: Transform two || chains into individually checked functions X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=528936cd672e78d2dc95cc20a1436af90405b915;p=openbsd Transform two || chains into individually checked functions Requested by and ok jsing --- diff --git a/lib/libcrypto/pkcs12/p12_key.c b/lib/libcrypto/pkcs12/p12_key.c index f85190aba99..f4013dbbc9a 100644 --- a/lib/libcrypto/pkcs12/p12_key.c +++ b/lib/libcrypto/pkcs12/p12_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p12_key.c,v 1.29 2022/07/24 18:55:22 tb Exp $ */ +/* $OpenBSD: p12_key.c,v 1.30 2022/07/30 11:24:52 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -142,15 +142,20 @@ PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, *p++ = pass[i % passlen]; for (;;) { - if (!EVP_DigestInit_ex(ctx, md_type, NULL) || - !EVP_DigestUpdate(ctx, D, v) || - !EVP_DigestUpdate(ctx, I, Ilen) || - !EVP_DigestFinal_ex(ctx, Ai, NULL)) + if (!EVP_DigestInit_ex(ctx, md_type, NULL)) + goto err; + if (!EVP_DigestUpdate(ctx, D, v)) + goto err; + if (!EVP_DigestUpdate(ctx, I, Ilen)) + goto err; + if (!EVP_DigestFinal_ex(ctx, Ai, NULL)) goto err; for (j = 1; j < iter; j++) { - if (!EVP_DigestInit_ex(ctx, md_type, NULL) || - !EVP_DigestUpdate(ctx, Ai, u) || - !EVP_DigestFinal_ex(ctx, Ai, NULL)) + if (!EVP_DigestInit_ex(ctx, md_type, NULL)) + goto err; + if (!EVP_DigestUpdate(ctx, Ai, u)) + goto err; + if (!EVP_DigestFinal_ex(ctx, Ai, NULL)) goto err; } memcpy(out, Ai, min(n, u));