# HG changeset patch # User Olaf Wintermann # Date 1536228817 -7200 # Node ID efda9aa1bbad96f647fcde2ba1c5602180bfd883 # Parent 22522ff52a62208d8907b3b29894fe0722cbacc3 applies aes stream fix to macos implementation diff -r 22522ff52a62 -r efda9aa1bbad 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); }