Browse Source

fix chacha20poly1305 encrypt/decrypt empty pt/ct

Karel Miko 7 years ago
parent
commit
27c472654c

+ 0 - 1
src/encauth/chachapoly/chacha20poly1305_decrypt.c

@@ -25,7 +25,6 @@ int chacha20poly1305_decrypt(chacha20poly1305_state *st, const unsigned char *in
    unsigned long padlen;
    unsigned long padlen;
    int err;
    int err;
 
 
-   if (inlen == 0) return CRYPT_OK; /* nothing to do */
    LTC_ARGCHK(st != NULL);
    LTC_ARGCHK(st != NULL);
 
 
    if (st->aadflg) {
    if (st->aadflg) {

+ 0 - 1
src/encauth/chachapoly/chacha20poly1305_encrypt.c

@@ -25,7 +25,6 @@ int chacha20poly1305_encrypt(chacha20poly1305_state *st, const unsigned char *in
    unsigned long padlen;
    unsigned long padlen;
    int err;
    int err;
 
 
-   if (inlen == 0) return CRYPT_OK; /* nothing to do */
    LTC_ARGCHK(st != NULL);
    LTC_ARGCHK(st != NULL);
 
 
    if ((err = chacha_crypt(&st->chacha, in, inlen, out)) != CRYPT_OK)         return err;
    if ((err = chacha_crypt(&st->chacha, in, inlen, out)) != CRYPT_OK)         return err;