openssl/crypto/evp
Richard Levitte f7397f0d58 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)
2019-10-11 15:55:36 +02:00
..
bio_b64.c
bio_enc.c
bio_md.c Don't use internal knowledge about EVP_MD_CTX in and MD BIO 2019-10-11 11:42:43 +01:00
bio_ok.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
build.info Support calling EVP_DigestUpdate instead of EVP_Digest[Sign|Verify]Update 2019-10-11 11:42:43 +01:00
c_allc.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
c_alld.c Move MD5-SHA1 digest completely to the default provider 2019-10-04 10:35:40 +02:00
cmeth_lib.c Reorganize local header files 2019-09-28 20:26:35 +02:00
digest.c Support calling EVP_DigestUpdate instead of EVP_Digest[Sign|Verify]Update 2019-10-11 11:42:43 +01:00
e_aes_cbc_hmac_sha1.c Reorganize local header files 2019-09-28 20:26:35 +02:00
e_aes_cbc_hmac_sha256.c Reorganize local header files 2019-09-28 20:26:35 +02:00
e_aes.c Explicitly test against NULL; do not use !p or similar 2019-10-09 21:32:15 +02:00
e_aria.c Reorganize local header files 2019-09-28 20:26:35 +02:00
e_bf.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
e_camellia.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
e_cast.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
e_chacha20_poly1305.c Reorganize local header files 2019-09-28 20:26:35 +02:00
e_des3.c Reorganize local header files 2019-09-28 20:26:35 +02:00
e_des.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
e_idea.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
e_null.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
e_old.c
e_rc2.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
e_rc4_hmac_md5.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
e_rc4.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
e_rc5.c Reorganize local header files 2019-09-28 20:26:35 +02:00
e_seed.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
e_sm4.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
e_xcbc_d.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
encode.c Reorganize local header files 2019-09-28 20:26:35 +02:00
evp_cnf.c
evp_enc.c Add rc2 ciphers to default provider 2019-10-08 16:42:28 +10:00
evp_err.c Replumbing: make it possible for providers to specify multiple names 2019-10-03 15:47:25 +02:00
evp_fetch.c Replumbing: make it possible for providers to specify multiple names 2019-10-03 15:47:25 +02:00
evp_key.c
evp_lib.c Fix EVP_Cipher() for provided cipher implementations 2019-10-11 15:55:36 +02:00
evp_local.h Add the provider function signatures for DigestSign* 2019-10-03 09:47:12 +01:00
evp_pbe.c Explicitly test against NULL; do not use !p or similar 2019-10-09 21:32:15 +02:00
evp_pkey.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
evp_utils.c Reorganize local header files 2019-09-28 20:26:35 +02:00
exchange.c Reorganize local header files 2019-09-28 20:26:35 +02:00
kdf_lib.c Reorganize local header files 2019-09-28 20:26:35 +02:00
kdf_meth.c Reorganize local header files 2019-09-28 20:26:35 +02:00
keymgmt_lib.c Reorganize local header files 2019-09-28 20:26:35 +02:00
keymgmt_meth.c Reorganize local header files 2019-09-28 20:26:35 +02:00
legacy_md5_sha1.c Providers: move all digests 2019-10-10 14:12:15 +02:00
legacy_sha.c Move all SHA digests completely to the default provider 2019-10-04 00:18:41 +02:00
m_md2.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
m_md4.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
m_md5.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
m_mdc2.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
m_null.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
m_ripemd.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
m_sigver.c Support calling EVP_DigestUpdate instead of EVP_Digest[Sign|Verify]Update 2019-10-11 11:42:43 +01:00
m_wp.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
mac_lib.c Reorganize public header files (part 1) 2019-09-28 20:26:36 +02:00
mac_meth.c Reorganize local header files 2019-09-28 20:26:35 +02:00
names.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
p5_crpt2.c Reorganize local header files 2019-09-28 20:26:35 +02:00
p5_crpt.c Explicitly test against NULL; do not use !p or similar 2019-10-09 21:32:15 +02:00
p_dec.c
p_enc.c
p_lib.c Explicitly test against NULL; do not use !p or similar 2019-10-09 21:32:15 +02:00
p_open.c Explicitly test against NULL; do not use !p or similar 2019-10-09 21:32:15 +02:00
p_seal.c
p_sign.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
p_verify.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
pbe_scrypt.c Usages of KDFs converted to use the name macros 2019-09-11 10:22:49 +10:00
pkey_kdf.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
pkey_mac.c Reorganize local header files 2019-09-28 20:26:35 +02:00
pmeth_fn.c Add the provider function signatures for DigestSign* 2019-10-03 09:47:12 +01:00
pmeth_gn.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
pmeth_lib.c Explicitly test against NULL; do not use !p or similar 2019-10-09 21:32:15 +02:00