Skip to content

Commit ec62e8b

Browse files
changes from peer review
1 parent ebc7e5a commit ec62e8b

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/we_aes_block.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,14 @@ static int we_aes_cbc_decrypt(we_AesBlock* aes, unsigned char *out,
180180

181181
/* padding is handled by OpenSSL before passed to we_aes_cbc_decrypt */
182182
rc = wc_AesCbcDecrypt(&aes->aes, out, in, (unsigned int)len);
183-
if (rc != 0) {
183+
if (rc <= 0) {
184184
ret = -1;
185185
}
186-
187-
if (ret >= 0) {
186+
else {
188187
ret = (int)len;
189188
}
190189

191-
WOLFENGINE_LEAVE(WE_LOG_CIPHER, "we_aes_cbc_encrypt", ret);
190+
WOLFENGINE_LEAVE(WE_LOG_CIPHER, "we_aes_cbc_decrypt", ret);
192191
return ret;
193192
}
194193

src/we_des3_cbc.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,11 @@ static int we_des3_cbc_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
8585
WOLFENGINE_ERROR_FUNC(WE_LOG_CIPHER, "wc_Des3Init", rc);
8686
ret = 0;
8787
}
88+
8889
des3->init = 1;
89-
if (iv == NULL) {
90-
des3->ivSet = 0;
91-
}
92-
else {
93-
des3->ivSet = 1;
94-
}
90+
91+
/* set des3->ivSet to 1 if iv buffer passed in is not NULL */
92+
des3->ivSet = (iv == NULL);
9593
}
9694

9795
if (ret == 1) {

0 commit comments

Comments
 (0)