diff options
author | Pauli <ppzgs1@gmail.com> | 2021-03-02 22:45:34 +1000 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2021-03-12 08:27:21 +1000 |
commit | deee9672723f1cfaaf6770f856345bccf94217d6 (patch) | |
tree | 94339472de2fd9a18a897ddba569ab04a933e51d /providers | |
parent | 8b81a89d06ab0eb4121c7f9eaf1454aef3180289 (diff) |
prov: support param argument to DES cipher init calls
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14383)
Diffstat (limited to 'providers')
-rw-r--r-- | providers/implementations/ciphers/cipher_des.c | 18 | ||||
-rw-r--r-- | providers/implementations/ciphers/cipher_tdes_common.c | 18 |
2 files changed, 22 insertions, 14 deletions
diff --git a/providers/implementations/ciphers/cipher_des.c b/providers/implementations/ciphers/cipher_des.c index 32cab17b3e..9010ce9099 100644 --- a/providers/implementations/ciphers/cipher_des.c +++ b/providers/implementations/ciphers/cipher_des.c @@ -71,7 +71,8 @@ static void des_freectx(void *vctx) } static int des_init(void *vctx, const unsigned char *key, size_t keylen, - const unsigned char *iv, size_t ivlen, int enc) + const unsigned char *iv, size_t ivlen, + const OSSL_PARAM params[], int enc) { PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; @@ -92,21 +93,24 @@ static int des_init(void *vctx, const unsigned char *key, size_t keylen, ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH); return 0; } - return ctx->hw->init(ctx, key, keylen); + if (!ctx->hw->init(ctx, key, keylen)) + return 0; } - return 1; + return ossl_cipher_generic_set_ctx_params(ctx, params); } static int des_einit(void *vctx, const unsigned char *key, size_t keylen, - const unsigned char *iv, size_t ivlen) + const unsigned char *iv, size_t ivlen, + const OSSL_PARAM params[]) { - return des_init(vctx, key, keylen, iv, ivlen, 1); + return des_init(vctx, key, keylen, iv, ivlen, params, 1); } static int des_dinit(void *vctx, const unsigned char *key, size_t keylen, - const unsigned char *iv, size_t ivlen) + const unsigned char *iv, size_t ivlen, + const OSSL_PARAM params[]) { - return des_init(vctx, key, keylen, iv, ivlen, 0); + return des_init(vctx, key, keylen, iv, ivlen, params, 0); } static int des_generatekey(PROV_CIPHER_CTX *ctx, void *ptr) diff --git a/providers/implementations/ciphers/cipher_tdes_common.c b/providers/implementations/ciphers/cipher_tdes_common.c index f0fd03ff4b..048b08661d 100644 --- a/providers/implementations/ciphers/cipher_tdes_common.c +++ b/providers/implementations/ciphers/cipher_tdes_common.c @@ -62,7 +62,8 @@ void ossl_tdes_freectx(void *vctx) } static int tdes_init(void *vctx, const unsigned char *key, size_t keylen, - const unsigned char *iv, size_t ivlen, int enc) + const unsigned char *iv, size_t ivlen, + const OSSL_PARAM params[], int enc) { PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; @@ -83,21 +84,24 @@ static int tdes_init(void *vctx, const unsigned char *key, size_t keylen, ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH); return 0; } - return ctx->hw->init(ctx, key, ctx->keylen); + if (!ctx->hw->init(ctx, key, ctx->keylen)) + return 0; } - return 1; + return ossl_cipher_generic_set_ctx_params(ctx, params); } int ossl_tdes_einit(void *vctx, const unsigned char *key, size_t keylen, - const unsigned char *iv, size_t ivlen) + const unsigned char *iv, size_t ivlen, + const OSSL_PARAM params[]) { - return tdes_init(vctx, key, keylen, iv, ivlen, 1); + return tdes_init(vctx, key, keylen, iv, ivlen, params, 1); } int ossl_tdes_dinit(void *vctx, const unsigned char *key, size_t keylen, - const unsigned char *iv, size_t ivlen) + const unsigned char *iv, size_t ivlen, + const OSSL_PARAM params[]) { - return tdes_init(vctx, key, keylen, iv, ivlen, 0); + return tdes_init(vctx, key, keylen, iv, ivlen, params, 0); } CIPHER_DEFAULT_GETTABLE_CTX_PARAMS_START(ossl_tdes) |