/*
- * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
*/
#include "internal/deprecated.h"
+#include <openssl/proverr.h>
#include "cipher_aes_xts.h"
#include "prov/implementations.h"
#include "prov/providercommon.h"
-#include "prov/providercommonerr.h"
-
-/* TODO (3.0) Figure out what flags need to be set */
-#define AES_XTS_FLAGS (EVP_CIPH_CUSTOM_IV \
- | EVP_CIPH_ALWAYS_CALL_INIT \
- | EVP_CIPH_CTRL_INIT \
- | EVP_CIPH_CUSTOM_COPY)
+#define AES_XTS_FLAGS PROV_CIPHER_FLAG_CUSTOM_IV
#define AES_XTS_IV_BITS 128
#define AES_XTS_BLOCK_BITS 8
ctx->enc = enc;
if (iv != NULL) {
- if (!cipher_generic_initiv(vctx, iv, ivlen))
+ if (!ossl_cipher_generic_initiv(vctx, iv, ivlen))
return 0;
}
if (key != NULL) {
PROV_AES_XTS_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
if (ctx != NULL) {
- cipher_generic_initkey(&ctx->base, kbits, blkbits, ivbits, mode, flags,
- ossl_prov_cipher_hw_aes_xts(kbits), NULL);
+ ossl_cipher_generic_initkey(&ctx->base, kbits, blkbits, ivbits, mode,
+ flags, ossl_prov_cipher_hw_aes_xts(kbits),
+ NULL);
}
return ctx;
}
{
PROV_AES_XTS_CTX *ctx = (PROV_AES_XTS_CTX *)vctx;
- cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx);
+ ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx);
OPENSSL_clear_free(ctx, sizeof(*ctx));
}
OSSL_PARAM_END
};
-static const OSSL_PARAM *aes_xts_settable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM *aes_xts_settable_ctx_params(ossl_unused void *cctx,
+ ossl_unused void *provctx)
{
return aes_xts_known_settable_ctx_params;
}
PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx;
const OSSL_PARAM *p;
- /*
- * TODO(3.0) We need a general solution for handling missing parameters
- * inside set_params and get_params methods.
- */
p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_KEYLEN);
if (p != NULL) {
size_t keylen;
static OSSL_FUNC_cipher_get_params_fn aes_##kbits##_##lcmode##_get_params; \
static int aes_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \
{ \
- return cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \
+ return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \
flags, 2 * kbits, AES_XTS_BLOCK_BITS, \
AES_XTS_IV_BITS); \
} \
{ OSSL_FUNC_CIPHER_GET_PARAMS, \
(void (*)(void))aes_##kbits##_##lcmode##_get_params }, \
{ OSSL_FUNC_CIPHER_GETTABLE_PARAMS, \
- (void (*)(void))cipher_generic_gettable_params }, \
+ (void (*)(void))ossl_cipher_generic_gettable_params }, \
{ OSSL_FUNC_CIPHER_GET_CTX_PARAMS, \
- (void (*)(void))cipher_generic_get_ctx_params }, \
+ (void (*)(void))ossl_cipher_generic_get_ctx_params }, \
{ OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \
- (void (*)(void))cipher_generic_gettable_ctx_params }, \
+ (void (*)(void))ossl_cipher_generic_gettable_ctx_params }, \
{ OSSL_FUNC_CIPHER_SET_CTX_PARAMS, \
(void (*)(void))aes_xts_set_ctx_params }, \
{ OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS, \