Thu, 05 Dec 2019 10:46:39 +0100
fix encryption of files with specific length
libidav/crypto.c | file | annotate | diff | comparison | revisions |
--- a/libidav/crypto.c Wed Dec 04 15:48:58 2019 +0100 +++ b/libidav/crypto.c Thu Dec 05 10:46:39 2019 +0100 @@ -1239,9 +1239,11 @@ // encrypt int flags = 0; - if(inlen % 16 != 0) { + if(inlen % 16 != 0 || enc->end) { + enc->end = 1; + } + if(enc->end) { flags = BCRYPT_BLOCK_PADDING; - enc->end = 1; } if(BCryptEncrypt(enc->ctx.hKey, in, inlen, NULL, enc->ctx.pbIV, 16, out, outalloc, &outlen, flags)) { fprintf(stderr, "Error: BCryptEncrypt failed\n");