diff --git a/knot/Implementations/crypto_aead/knot128v1/armcortexm_3/encrypt.c b/knot/Implementations/crypto_aead/knot128v1/armcortexm_3/encrypt.c index 30c6c80..5a0052d 100644 --- a/knot/Implementations/crypto_aead/knot128v1/armcortexm_3/encrypt.c +++ b/knot/Implementations/crypto_aead/knot128v1/armcortexm_3/encrypt.c @@ -237,8 +237,8 @@ int crypto_aead_decrypt(unsigned char *m, unsigned long long *mlen, unpackFormat(tempU8, s); unpackFormat((tempU8+8), (s+2)); if (memcmp((void*)tempU8, (void*)c,CRYPTO_ABYTES)) { + memset(m, 0, sizeof(unsigned char) * (*mlen)); *mlen = 0; - memset(m, 0, sizeof(unsigned char) * (clen - CRYPTO_ABYTES)); return -1; } return 0; diff --git a/knot/Implementations/crypto_aead/knot128v2/armcortexm_3/encrypt.c b/knot/Implementations/crypto_aead/knot128v2/armcortexm_3/encrypt.c index 28abf55..0315084 100644 --- a/knot/Implementations/crypto_aead/knot128v2/armcortexm_3/encrypt.c +++ b/knot/Implementations/crypto_aead/knot128v2/armcortexm_3/encrypt.c @@ -248,8 +248,8 @@ int crypto_aead_decrypt(unsigned char *m, unsigned long long *mlen, unpackU96FormatToThreePacket(tempU8, s); unpackU96FormatToThreePacket((tempU8 + 12), (s + 3)); if (memcmp((void*)tempU8, (void*)c, CRYPTO_ABYTES)) { + memset(m, 0, sizeof(unsigned char) * (*mlen)); *mlen = 0; - memset(m, 0, sizeof(unsigned char) * (clen - CRYPTO_ABYTES)); return -1; } return 0; diff --git a/knot/Implementations/crypto_aead/knot192/armcortexm_3/encrypt.c b/knot/Implementations/crypto_aead/knot192/armcortexm_3/encrypt.c index 9513625..65c8859 100644 --- a/knot/Implementations/crypto_aead/knot192/armcortexm_3/encrypt.c +++ b/knot/Implementations/crypto_aead/knot192/armcortexm_3/encrypt.c @@ -202,8 +202,8 @@ int crypto_aead_decrypt(unsigned char *m, unsigned long long *mlen, unpackU96FormatToThreePacket(tempU8, s); unpackU96FormatToThreePacket((tempU8 + 12), (s + 3)); if (memcmp((void*)tempU8, (void*)c, CRYPTO_ABYTES)) { + memset(m, 0, sizeof(unsigned char) * (*mlen)); *mlen = 0; - memset(m, 0, sizeof(unsigned char) * (clen - CRYPTO_ABYTES)); return -1; } return 0; diff --git a/knot/Implementations/crypto_aead/knot256/armcortexm_3/encrypt.c b/knot/Implementations/crypto_aead/knot256/armcortexm_3/encrypt.c index d8d1476..3fc96ee 100644 --- a/knot/Implementations/crypto_aead/knot256/armcortexm_3/encrypt.c +++ b/knot/Implementations/crypto_aead/knot256/armcortexm_3/encrypt.c @@ -320,9 +320,9 @@ int crypto_aead_decrypt( unpackU128FormatToFourPacket(tempU8, s); unpackU128FormatToFourPacket((tempU8 + 16), (s + 4)); if (memcmp((void*)tempU8, (void*)c, CRYPTO_ABYTES)) { + memset(m, 0, sizeof(unsigned char) * (*mlen)); *mlen = 0; - memset(m, 0, sizeof(unsigned char) * (clen - CRYPTO_ABYTES)); return -1; } return 0; -} \ No newline at end of file +}