diff options
author | Richard Levitte <levitte@openssl.org> | 2019-10-10 18:04:06 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-10-11 15:55:36 +0200 |
commit | f7397f0d58ce7ddf4c5366cd1846f16b341fbe43 (patch) | |
tree | c7bfeea8b055eb040811e24d2db1cb8c9765c445 /providers/implementations/ciphers/cipher_aes_wrp.c | |
parent | bb82531f6592f0e9af28d3502346191a465374a3 (diff) |
Fix EVP_Cipher() for provided cipher implementations
EVP_Cipher() would return whatever ctx->cipher->ccipher() returned
with no regard for historical semantics.
We change this to first look if there is a ctx->cipher->ccipher(), and
in that case we treat the implementation as one with a custom cipher,
and "translate" it's return value like this: 0 => -1, 1 => outl, where
|outl| is the output length.
If there is no ctx->cipher->ccipher, we treat the implementation as
one without a custom cipher, call ctx->cipher->cupdate or
ctx->cipher->cfinal depending on input, and return whatever they
return (0 or 1).
Furthermore, we add a small hack in EVP_CIPHER_flags() to check if the
cipher is a provided one, and add EVP_CIPH_FLAG_CUSTOM_CIPHER to the
flags to be returned if there is a cipher->ccipher. That way,
provided implementations never have to set that flag themselves, all
they need to do is to include a OSSL_FUNC_CIPHER_CIPHER function.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10137)
Diffstat (limited to 'providers/implementations/ciphers/cipher_aes_wrp.c')
0 files changed, 0 insertions, 0 deletions