dav/crypto.c

changeset 9
6aec77cfa95b
parent 5
88625853ae74
child 10
e6d0fbe0ebd9
--- a/dav/crypto.c	Mon Aug 12 15:58:30 2013 +0200
+++ b/dav/crypto.c	Mon Aug 12 16:32:30 2013 +0200
@@ -51,7 +51,7 @@
 
 size_t aes_write(const void *buf, size_t s, size_t n, AESDecrypter *dec) {
     int len = s*n;
-    int outlen = len + AES_BLOCK_SIZE;
+    int outlen = len + 16;
     unsigned char *out = malloc(outlen);
     EVP_DecryptUpdate(&dec->ctx, out, &len, buf, len);
     dec->write(out, 1, len, dec->stream);
@@ -117,12 +117,12 @@
     void *out = NULL;
     int outlen = 0;
     if(in_len != 0) {
-        outlen = len + AES_BLOCK_SIZE;
+        outlen = len + 16;
         out = malloc(outlen);
         EVP_EncryptUpdate(&enc->ctx, out, &outlen, in, in_len);
         //out = (char*)aes_encrypt(enc->ctx, (unsigned char*)in, (int*)&in_len);
     } else {
-        out = malloc(AES_BLOCK_SIZE);
+        out = malloc(16);
         EVP_EncryptFinal_ex(&enc->ctx, out, &outlen);
         enc->end = 1;
     }

mercurial