Skip to content

Commit a6039df

Browse files
authored
Merge pull request gost-engine#525 from Mironenko/f-iv-length
Fix static analysis warnings for GOST_cipher_ctx_iv_length returning -1
2 parents 4e6e331 + 2b49eb9 commit a6039df

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

gost_cipher_ctx.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "gost_cipher_ctx.h"
22

3+
#include <assert.h>
34
#include <limits.h>
45
#include <stdint.h>
56
#include <string.h>
@@ -260,8 +261,10 @@ int GOST_cipher_ctx_iv_length(const GOST_cipher_ctx *ctx)
260261
& EVP_CIPH_CUSTOM_IV_LENGTH) != 0) {
261262
rv = GOST_cipher_ctx_ctrl((GOST_cipher_ctx *)ctx, EVP_CTRL_GET_IVLEN,
262263
0, &len);
263-
if (rv <= 0)
264-
return -1;
264+
if (rv <= 0) {
265+
assert(0 && "Bad cipher definition");
266+
return 0;
267+
}
265268
}
266269

267270
((GOST_cipher_ctx *)ctx)->iv_len = len;

0 commit comments

Comments
 (0)