Latest update
This commit is contained in:
@@ -426,6 +426,49 @@ AES.
|
||||
|
||||
=back
|
||||
|
||||
=head2 SIV Mode
|
||||
|
||||
For SIV mode ciphers the behaviour of the EVP interface is subtly
|
||||
altered and several additional ctrl operations are supported.
|
||||
|
||||
To specify any additional authenticated data (AAD) and/or a Nonce, a call to
|
||||
EVP_CipherUpdate(), EVP_EncryptUpdate() or EVP_DecryptUpdate() should be made
|
||||
with the output parameter B<out> set to B<NULL>.
|
||||
|
||||
RFC5297 states that the Nonce is the last piece of AAD before the actual
|
||||
encrypt/decrypt takes place. The API does not differentiate the Nonce from
|
||||
other AAD.
|
||||
|
||||
When decrypting the return value of EVP_DecryptFinal() or EVP_CipherFinal()
|
||||
indicates if the operation was successful. If it does not indicate success
|
||||
the authentication operation has failed and any output data B<MUST NOT>
|
||||
be used as it is corrupted.
|
||||
|
||||
The following ctrls are supported in both SIV modes.
|
||||
|
||||
=over 4
|
||||
|
||||
=item EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, tag);
|
||||
|
||||
Writes B<taglen> bytes of the tag value to the buffer indicated by B<tag>.
|
||||
This call can only be made when encrypting data and B<after> all data has been
|
||||
processed (e.g. after an EVP_EncryptFinal() call). For SIV mode the taglen must
|
||||
be 16.
|
||||
|
||||
=item EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, taglen, tag);
|
||||
|
||||
Sets the expected tag to B<taglen> bytes from B<tag>. This call is only legal
|
||||
when decrypting data and must be made B<before> any data is processed (e.g.
|
||||
before any EVP_DecryptUpdate() call). For SIV mode the taglen must be 16.
|
||||
|
||||
=back
|
||||
|
||||
SIV mode makes two passes over the input data, thus, only one call to
|
||||
EVP_CipherUpdate(), EVP_EncryptUpdate() or EVP_DecryptUpdate() should be made
|
||||
with B<out> set to a non-B<NULL> value. A call to EVP_Decrypt_Final() or
|
||||
EVP_CipherFinal() is not required, but will indicate if the update
|
||||
operation succeeded.
|
||||
|
||||
=head2 ChaCha20-Poly1305
|
||||
|
||||
The following I<ctrl>s are supported for the ChaCha20-Poly1305 AEAD algorithm.
|
||||
|
||||
Reference in New Issue
Block a user