Open sacca97 opened 1 year ago
Not sure you intended this, but the encryption and decryption function are not symmetrical. (i.e. the ct length is not encoded in the padding)
Basic code sample follows.
` uint8_t msg[7] = "Simola"; size_t pad = (sizeof(msg) + 15) & 0xFFFFFFF0; uint8_t enc[16 + pad]; aead_encrypt(enc, msg, 7, NULL, 0, 0, key_bytes); uint8_t dec[16]; int rc = aead_decrypt(dec, enc, sizeof(enc), NULL, 0, 0, key_bytes);
assert(crypto_equal(msg, dec, 7) && rc == 1);`
The assertion fails, but If I call the decryption function with srclen = 16+7 then the decryption is successfull.
srclen = 16+7
Not sure you intended this, but the encryption and decryption function are not symmetrical. (i.e. the ct length is not encoded in the padding)
Basic code sample follows.
` uint8_t msg[7] = "Simola"; size_t pad = (sizeof(msg) + 15) & 0xFFFFFFF0; uint8_t enc[16 + pad]; aead_encrypt(enc, msg, 7, NULL, 0, 0, key_bytes); uint8_t dec[16]; int rc = aead_decrypt(dec, enc, sizeof(enc), NULL, 0, 0, key_bytes);
The assertion fails, but If I call the decryption function with
srclen = 16+7
then the decryption is successfull.