diff options
-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) |