summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2023-12-22 10:20:33 +0000
committertb <>2023-12-22 10:20:33 +0000
commit91793da94692a348327fa8950d3e57746af14e4c (patch)
tree97dff7b13c3f69bbb32f74024215f9d9919cca93 /src/lib
parentdf8fef64eb7d2f12cb9bf598ab93ecd8da04677f (diff)
downloadopenbsd-91793da94692a348327fa8950d3e57746af14e4c.tar.gz
openbsd-91793da94692a348327fa8950d3e57746af14e4c.tar.bz2
openbsd-91793da94692a348327fa8950d3e57746af14e4c.zip
evp_enc: make some flag checks explicit
ok joshua jsing
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/evp/evp_enc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c
index d8c01cdc47..d0cd301e52 100644
--- a/src/lib/libcrypto/evp/evp_enc.c
+++ b/src/lib/libcrypto/evp/evp_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_enc.c,v 1.74 2023/12/21 20:50:43 tb Exp $ */ 1/* $OpenBSD: evp_enc.c,v 1.75 2023/12/22 10:20:33 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -131,13 +131,13 @@ EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *engine,
131 return 0; 131 return 0;
132 } 132 }
133 133
134 if (!(ctx->flags & EVP_CIPHER_CTX_FLAG_WRAP_ALLOW) && 134 if ((ctx->flags & EVP_CIPHER_CTX_FLAG_WRAP_ALLOW) == 0 &&
135 EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_WRAP_MODE) { 135 EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_WRAP_MODE) {
136 EVPerror(EVP_R_WRAP_MODE_NOT_ALLOWED); 136 EVPerror(EVP_R_WRAP_MODE_NOT_ALLOWED);
137 return 0; 137 return 0;
138 } 138 }
139 139
140 if (!(EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_CUSTOM_IV)) { 140 if ((EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_CUSTOM_IV) == 0) {
141 int iv_len; 141 int iv_len;
142 142
143 switch (EVP_CIPHER_CTX_mode(ctx)) { 143 switch (EVP_CIPHER_CTX_mode(ctx)) {
@@ -181,7 +181,7 @@ EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *engine,
181 } 181 }
182 } 182 }
183 183
184 if (key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) { 184 if (key != NULL || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT) != 0) {
185 if (!ctx->cipher->init(ctx, key, iv, enc)) 185 if (!ctx->cipher->init(ctx, key, iv, enc))
186 return 0; 186 return 0;
187 } 187 }