Skip to content

Commit d6d439c

Browse files
committed
Add NULL parameter validation to wc_Des_CbcEncryptWithKey/DecryptWithKey F-1371
1 parent d278da0 commit d6d439c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

wolfcrypt/src/wc_encrypt.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ int wc_Des_CbcEncryptWithKey(byte* out, const byte* in, word32 sz,
100100
int ret = 0;
101101
WC_DECLARE_VAR(des, Des, 1, 0);
102102

103+
if (out == NULL || in == NULL || key == NULL) {
104+
return BAD_FUNC_ARG;
105+
}
106+
103107
WC_ALLOC_VAR_EX(des, Des, 1, NULL, DYNAMIC_TYPE_TMP_BUFFER,
104108
return MEMORY_E);
105109

@@ -118,6 +122,10 @@ int wc_Des_CbcDecryptWithKey(byte* out, const byte* in, word32 sz,
118122
int ret = 0;
119123
WC_DECLARE_VAR(des, Des, 1, 0);
120124

125+
if (out == NULL || in == NULL || key == NULL) {
126+
return BAD_FUNC_ARG;
127+
}
128+
121129
WC_ALLOC_VAR_EX(des, Des, 1, NULL, DYNAMIC_TYPE_TMP_BUFFER,
122130
return MEMORY_E);
123131

0 commit comments

Comments
 (0)