libidav/crypto.c

changeset 818
bc782cca0759
parent 816
839fefbdedc7
equal deleted inserted replaced
817:22257f6d06a3 818:bc782cca0759
101 } 101 }
102 102
103 size_t aes_write(const void *buf, size_t s, size_t n, AESDecrypter *dec) { 103 size_t aes_write(const void *buf, size_t s, size_t n, AESDecrypter *dec) {
104 int len = s*n; 104 int len = s*n;
105 if(!dec->init) { 105 if(!dec->init) {
106 size_t n = 16 - dec->ivpos; 106 size_t m = 16 - dec->ivpos;
107 size_t cp = n > len ? len : n; 107 size_t cp = m > len ? len : m;
108 memcpy(dec->ivtmp + dec->ivpos, buf, cp); 108 memcpy(dec->ivtmp + dec->ivpos, buf, cp);
109 dec->ivpos += cp; 109 dec->ivpos += cp;
110 if(dec->ivpos >= 16) { 110 if(dec->ivpos >= 16) {
111 aes_decrypter_init(dec); 111 aes_decrypter_init(dec);
112 } 112 }

mercurial