-
-
Notifications
You must be signed in to change notification settings - Fork 10k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 #10137)
- Loading branch information
Showing
2 changed files
with
45 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters