Update crypto.md to correct function description for `decipher.setAAD`
According to the NodeJS CCM example, when decrypting the plaintextLength
parameter actually refers to the ciphertext length, not the plaintext length:
decipher.setAAD(aad, {
plaintextLength: ciphertext.length
});
The same can be seen in the OpenSSL docs where a call to EVP_DecryptUpdate
passes the ciphertext length:
/* Provide the total ciphertext length */
if(1 != EVP_DecryptUpdate(ctx, NULL, &len, NULL, ciphertext_len))
handleErrors();
This parameter probably should have been called inputLength
or bufferLength
instead of plaintextLength
, so that it makes sense both when encrypting and decrypting, but at least we can correct the sentence in the documentation for now to refer to the correct value.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines