* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
+{-
+use OpenSSL::paramnames qw(produce_param_decoder);
+-}
/*
* AES low level APIs are deprecated for public use, but still ok for internal
return 1;
}
-static const OSSL_PARAM aes_xts_known_settable_ctx_params[] = {
- OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_KEYLEN, NULL),
- OSSL_PARAM_END
-};
+{- produce_param_decoder('aes_xts_set_ctx_params',
+ (['OSSL_CIPHER_PARAM_KEYLEN', 'keylen', 'size_t'],
+ )); -}
static const OSSL_PARAM *aes_xts_settable_ctx_params(ossl_unused void *cctx,
ossl_unused void *provctx)
{
- return aes_xts_known_settable_ctx_params;
+ return aes_xts_set_ctx_params_list;
}
static int aes_xts_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx;
- const OSSL_PARAM *p;
+ struct aes_xts_set_ctx_params_st p;
- if (ossl_param_is_empty(params))
- return 1;
+ if (ctx == NULL || !aes_xts_set_ctx_params_decoder(params, &p))
+ return 0;
- p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_KEYLEN);
- if (p != NULL) {
+ if (p.keylen != NULL) {
size_t keylen;
- if (!OSSL_PARAM_get_size_t(p, &keylen)) {
+ if (!OSSL_PARAM_get_size_t(p.keylen, &keylen)) {
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
return 0;
}
-
/*
* Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
+{-
+use OpenSSL::paramnames qw(produce_param_decoder);
+-}
/* Dispatch functions for SM4 XTS mode */
return 1;
}
-static const OSSL_PARAM sm4_xts_known_settable_ctx_params[] = {
- OSSL_PARAM_utf8_string(OSSL_CIPHER_PARAM_XTS_STANDARD, NULL, 0),
- OSSL_PARAM_END
-};
+{- produce_param_decoder('sm4_xts_set_ctx_params',
+ (['OSSL_CIPHER_PARAM_XTS_STANDARD', 'std', 'utf8_string'],
+ )); -}
static const OSSL_PARAM *sm4_xts_settable_ctx_params(ossl_unused void *cctx,
ossl_unused void *provctx)
{
- return sm4_xts_known_settable_ctx_params;
+ return sm4_xts_set_ctx_params_list;
}
static int sm4_xts_set_ctx_params(void *vxctx, const OSSL_PARAM params[])
{
PROV_SM4_XTS_CTX *xctx = (PROV_SM4_XTS_CTX *)vxctx;
- const OSSL_PARAM *p;
+ struct sm4_xts_set_ctx_params_st p;
- if (ossl_param_is_empty(params))
- return 1;
+ if (xctx == NULL || !sm4_xts_set_ctx_params_decoder(params, &p))
+ return 0;
/*-
* Sets the XTS standard to use with SM4-XTS algorithm.
* "GB" means the GB/T 17964-2021 standard
* "IEEE" means the IEEE Std 1619-2007 standard
*/
- p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_XTS_STANDARD);
-
- if (p != NULL) {
+ if (p.std != NULL) {
const char *xts_standard = NULL;
- if (p->data_type != OSSL_PARAM_UTF8_STRING)
+ if (p.std->data_type != OSSL_PARAM_UTF8_STRING)
return 0;
- if (!OSSL_PARAM_get_utf8_string_ptr(p, &xts_standard)) {
+ if (!OSSL_PARAM_get_utf8_string_ptr(p.std, &xts_standard)) {
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
return 0;
}