# HG changeset patch # User Olaf Wintermann # Date 1536228817 -7200 # Node ID 70ed56e56122a684a6ca5d758d2603a4a1206890 # Parent 37da70159bf6122d721886090106adbabc183a85 applies aes stream fix to macos implementation diff -r 37da70159bf6 -r 70ed56e56122 libidav/crypto.c --- a/libidav/crypto.c Thu Sep 06 11:57:00 2018 +0200 +++ b/libidav/crypto.c Thu Sep 06 12:13:37 2018 +0200 @@ -529,7 +529,7 @@ size_t outlen = 0; size_t ivl = enc->ivlen; if(in_len != 0) { - outlen = len + 16; + outlen = len + 32; out = malloc(outlen + ivl); if(enc->iv) { memcpy(out, enc->iv, ivl); @@ -538,15 +538,18 @@ CCCryptorStatus status; size_t avail = outlen; status = CCCryptorUpdate(enc->ctx, in, in_len, out + ivl, avail, &outlen); - - free(in); + if(in_len != len) { + int newoutlen = 16; + status = CCCryptorFinal(enc->ctx, out + ivl + outlen, 16, &newoutlen); + outlen += newoutlen; + enc->end = 1; + } } else { out = malloc(32); CCCryptorStatus status; size_t avail = outlen; status = CCCryptorFinal(enc->ctx, out, 32, &outlen); enc->end = 1; - free(in); } enc->tmp = (char*)out; enc->tmplen = outlen + ivl; @@ -558,6 +561,8 @@ enc->ivlen = 0; } + free(in); + return aes_read(buf, s, n, enc); }