xref: /freebsd/crypto/openssl/providers/implementations/ciphers/cipher_aes_xts.c (revision e7be843b4a162e68651d3911f0357ed464915629)
1b077aed3SPierre Pronchery 
2b077aed3SPierre Pronchery /*
3*e7be843bSPierre Pronchery  * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.
4b077aed3SPierre Pronchery  *
5b077aed3SPierre Pronchery  * Licensed under the Apache License 2.0 (the "License").  You may not use
6b077aed3SPierre Pronchery  * this file except in compliance with the License.  You can obtain a copy
7b077aed3SPierre Pronchery  * in the file LICENSE in the source distribution or at
8b077aed3SPierre Pronchery  * https://www.openssl.org/source/license.html
9b077aed3SPierre Pronchery  */
10b077aed3SPierre Pronchery 
11b077aed3SPierre Pronchery /*
12b077aed3SPierre Pronchery  * AES low level APIs are deprecated for public use, but still ok for internal
13b077aed3SPierre Pronchery  * use where we're using them to implement the higher level EVP interface, as is
14b077aed3SPierre Pronchery  * the case here.
15b077aed3SPierre Pronchery  */
16b077aed3SPierre Pronchery #include "internal/deprecated.h"
17b077aed3SPierre Pronchery 
18b077aed3SPierre Pronchery #include <openssl/proverr.h>
19b077aed3SPierre Pronchery #include "cipher_aes_xts.h"
20b077aed3SPierre Pronchery #include "prov/implementations.h"
21b077aed3SPierre Pronchery #include "prov/providercommon.h"
22b077aed3SPierre Pronchery 
23b077aed3SPierre Pronchery #define AES_XTS_FLAGS PROV_CIPHER_FLAG_CUSTOM_IV
24b077aed3SPierre Pronchery #define AES_XTS_IV_BITS 128
25b077aed3SPierre Pronchery #define AES_XTS_BLOCK_BITS 8
26b077aed3SPierre Pronchery 
27b077aed3SPierre Pronchery /* forward declarations */
28b077aed3SPierre Pronchery static OSSL_FUNC_cipher_encrypt_init_fn aes_xts_einit;
29b077aed3SPierre Pronchery static OSSL_FUNC_cipher_decrypt_init_fn aes_xts_dinit;
30b077aed3SPierre Pronchery static OSSL_FUNC_cipher_update_fn aes_xts_stream_update;
31b077aed3SPierre Pronchery static OSSL_FUNC_cipher_final_fn aes_xts_stream_final;
32b077aed3SPierre Pronchery static OSSL_FUNC_cipher_cipher_fn aes_xts_cipher;
33b077aed3SPierre Pronchery static OSSL_FUNC_cipher_freectx_fn aes_xts_freectx;
34b077aed3SPierre Pronchery static OSSL_FUNC_cipher_dupctx_fn aes_xts_dupctx;
35b077aed3SPierre Pronchery static OSSL_FUNC_cipher_set_ctx_params_fn aes_xts_set_ctx_params;
36b077aed3SPierre Pronchery static OSSL_FUNC_cipher_settable_ctx_params_fn aes_xts_settable_ctx_params;
37b077aed3SPierre Pronchery 
38b077aed3SPierre Pronchery /*
39b077aed3SPierre Pronchery  * Verify that the two keys are different.
40b077aed3SPierre Pronchery  *
41b077aed3SPierre Pronchery  * This addresses the vulnerability described in Rogaway's
42b077aed3SPierre Pronchery  * September 2004 paper:
43b077aed3SPierre Pronchery  *
44b077aed3SPierre Pronchery  *      "Efficient Instantiations of Tweakable Blockciphers and
45b077aed3SPierre Pronchery  *       Refinements to Modes OCB and PMAC".
46b077aed3SPierre Pronchery  *      (http://web.cs.ucdavis.edu/~rogaway/papers/offsets.pdf)
47b077aed3SPierre Pronchery  *
48b077aed3SPierre Pronchery  * FIPS 140-2 IG A.9 XTS-AES Key Generation Requirements states
49b077aed3SPierre Pronchery  * that:
50b077aed3SPierre Pronchery  *      "The check for Key_1 != Key_2 shall be done at any place
51b077aed3SPierre Pronchery  *       BEFORE using the keys in the XTS-AES algorithm to process
52b077aed3SPierre Pronchery  *       data with them."
53b077aed3SPierre Pronchery  */
aes_xts_check_keys_differ(const unsigned char * key,size_t bytes,int enc)54b077aed3SPierre Pronchery static int aes_xts_check_keys_differ(const unsigned char *key, size_t bytes,
55b077aed3SPierre Pronchery                                      int enc)
56b077aed3SPierre Pronchery {
57b077aed3SPierre Pronchery     if ((!ossl_aes_xts_allow_insecure_decrypt || enc)
58b077aed3SPierre Pronchery             && CRYPTO_memcmp(key, key + bytes, bytes) == 0) {
59b077aed3SPierre Pronchery         ERR_raise(ERR_LIB_PROV, PROV_R_XTS_DUPLICATED_KEYS);
60b077aed3SPierre Pronchery         return 0;
61b077aed3SPierre Pronchery     }
62b077aed3SPierre Pronchery     return 1;
63b077aed3SPierre Pronchery }
64b077aed3SPierre Pronchery 
65*e7be843bSPierre Pronchery #ifdef AES_XTS_S390X
66*e7be843bSPierre Pronchery # include "cipher_aes_xts_s390x.inc"
67*e7be843bSPierre Pronchery #endif
68*e7be843bSPierre Pronchery 
69b077aed3SPierre Pronchery /*-
70b077aed3SPierre Pronchery  * Provider dispatch functions
71b077aed3SPierre Pronchery  */
aes_xts_init(void * vctx,const unsigned char * key,size_t keylen,const unsigned char * iv,size_t ivlen,const OSSL_PARAM params[],int enc)72b077aed3SPierre Pronchery static int aes_xts_init(void *vctx, const unsigned char *key, size_t keylen,
73b077aed3SPierre Pronchery                         const unsigned char *iv, size_t ivlen,
74b077aed3SPierre Pronchery                         const OSSL_PARAM params[], int enc)
75b077aed3SPierre Pronchery {
76b077aed3SPierre Pronchery     PROV_AES_XTS_CTX *xctx = (PROV_AES_XTS_CTX *)vctx;
77b077aed3SPierre Pronchery     PROV_CIPHER_CTX *ctx = &xctx->base;
78b077aed3SPierre Pronchery 
79b077aed3SPierre Pronchery     if (!ossl_prov_is_running())
80b077aed3SPierre Pronchery         return 0;
81b077aed3SPierre Pronchery 
82b077aed3SPierre Pronchery     ctx->enc = enc;
83b077aed3SPierre Pronchery 
84b077aed3SPierre Pronchery     if (iv != NULL) {
85b077aed3SPierre Pronchery         if (!ossl_cipher_generic_initiv(vctx, iv, ivlen))
86b077aed3SPierre Pronchery             return 0;
87b077aed3SPierre Pronchery     }
88b077aed3SPierre Pronchery     if (key != NULL) {
89b077aed3SPierre Pronchery         if (keylen != ctx->keylen) {
90b077aed3SPierre Pronchery             ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH);
91b077aed3SPierre Pronchery             return 0;
92b077aed3SPierre Pronchery         }
93b077aed3SPierre Pronchery         if (!aes_xts_check_keys_differ(key, keylen / 2, enc))
94b077aed3SPierre Pronchery             return 0;
95b077aed3SPierre Pronchery         if (!ctx->hw->init(ctx, key, keylen))
96b077aed3SPierre Pronchery             return 0;
97b077aed3SPierre Pronchery     }
98b077aed3SPierre Pronchery     return aes_xts_set_ctx_params(ctx, params);
99b077aed3SPierre Pronchery }
100b077aed3SPierre Pronchery 
aes_xts_einit(void * vctx,const unsigned char * key,size_t keylen,const unsigned char * iv,size_t ivlen,const OSSL_PARAM params[])101b077aed3SPierre Pronchery static int aes_xts_einit(void *vctx, const unsigned char *key, size_t keylen,
102b077aed3SPierre Pronchery                          const unsigned char *iv, size_t ivlen,
103b077aed3SPierre Pronchery                          const OSSL_PARAM params[])
104b077aed3SPierre Pronchery {
105*e7be843bSPierre Pronchery #ifdef AES_XTS_S390X
106*e7be843bSPierre Pronchery     if (s390x_aes_xts_einit(vctx, key, keylen, iv, ivlen, params) == 1)
107*e7be843bSPierre Pronchery         return 1;
108*e7be843bSPierre Pronchery #endif
109b077aed3SPierre Pronchery     return aes_xts_init(vctx, key, keylen, iv, ivlen, params, 1);
110b077aed3SPierre Pronchery }
111b077aed3SPierre Pronchery 
aes_xts_dinit(void * vctx,const unsigned char * key,size_t keylen,const unsigned char * iv,size_t ivlen,const OSSL_PARAM params[])112b077aed3SPierre Pronchery static int aes_xts_dinit(void *vctx, const unsigned char *key, size_t keylen,
113b077aed3SPierre Pronchery                          const unsigned char *iv, size_t ivlen,
114b077aed3SPierre Pronchery                          const OSSL_PARAM params[])
115b077aed3SPierre Pronchery {
116*e7be843bSPierre Pronchery #ifdef AES_XTS_S390X
117*e7be843bSPierre Pronchery     if (s390x_aes_xts_dinit(vctx, key, keylen, iv, ivlen, params) == 1)
118*e7be843bSPierre Pronchery         return 1;
119*e7be843bSPierre Pronchery #endif
120b077aed3SPierre Pronchery     return aes_xts_init(vctx, key, keylen, iv, ivlen, params, 0);
121b077aed3SPierre Pronchery }
122b077aed3SPierre Pronchery 
aes_xts_newctx(void * provctx,unsigned int mode,uint64_t flags,size_t kbits,size_t blkbits,size_t ivbits)123b077aed3SPierre Pronchery static void *aes_xts_newctx(void *provctx, unsigned int mode, uint64_t flags,
124b077aed3SPierre Pronchery                             size_t kbits, size_t blkbits, size_t ivbits)
125b077aed3SPierre Pronchery {
126*e7be843bSPierre Pronchery     PROV_AES_XTS_CTX *ctx;
127b077aed3SPierre Pronchery 
128*e7be843bSPierre Pronchery     if (!ossl_prov_is_running())
129*e7be843bSPierre Pronchery         return NULL;
130*e7be843bSPierre Pronchery 
131*e7be843bSPierre Pronchery     ctx = OPENSSL_zalloc(sizeof(*ctx));
132b077aed3SPierre Pronchery     if (ctx != NULL) {
133b077aed3SPierre Pronchery         ossl_cipher_generic_initkey(&ctx->base, kbits, blkbits, ivbits, mode,
134b077aed3SPierre Pronchery                                     flags, ossl_prov_cipher_hw_aes_xts(kbits),
135b077aed3SPierre Pronchery                                     NULL);
136b077aed3SPierre Pronchery     }
137b077aed3SPierre Pronchery     return ctx;
138b077aed3SPierre Pronchery }
139b077aed3SPierre Pronchery 
aes_xts_freectx(void * vctx)140b077aed3SPierre Pronchery static void aes_xts_freectx(void *vctx)
141b077aed3SPierre Pronchery {
142b077aed3SPierre Pronchery     PROV_AES_XTS_CTX *ctx = (PROV_AES_XTS_CTX *)vctx;
143b077aed3SPierre Pronchery 
144b077aed3SPierre Pronchery     ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx);
145b077aed3SPierre Pronchery     OPENSSL_clear_free(ctx,  sizeof(*ctx));
146b077aed3SPierre Pronchery }
147b077aed3SPierre Pronchery 
aes_xts_dupctx(void * vctx)148b077aed3SPierre Pronchery static void *aes_xts_dupctx(void *vctx)
149b077aed3SPierre Pronchery {
150b077aed3SPierre Pronchery     PROV_AES_XTS_CTX *in = (PROV_AES_XTS_CTX *)vctx;
151b077aed3SPierre Pronchery     PROV_AES_XTS_CTX *ret = NULL;
152b077aed3SPierre Pronchery 
153b077aed3SPierre Pronchery     if (!ossl_prov_is_running())
154b077aed3SPierre Pronchery         return NULL;
155b077aed3SPierre Pronchery 
156*e7be843bSPierre Pronchery #ifdef AES_XTS_S390X
157*e7be843bSPierre Pronchery     if (in->plat.s390x.fc)
158*e7be843bSPierre Pronchery         return s390x_aes_xts_dupctx(vctx);
159*e7be843bSPierre Pronchery #endif
160*e7be843bSPierre Pronchery 
161b077aed3SPierre Pronchery     if (in->xts.key1 != NULL) {
162b077aed3SPierre Pronchery         if (in->xts.key1 != &in->ks1)
163b077aed3SPierre Pronchery             return NULL;
164b077aed3SPierre Pronchery     }
165b077aed3SPierre Pronchery     if (in->xts.key2 != NULL) {
166b077aed3SPierre Pronchery         if (in->xts.key2 != &in->ks2)
167b077aed3SPierre Pronchery             return NULL;
168b077aed3SPierre Pronchery     }
169b077aed3SPierre Pronchery     ret = OPENSSL_malloc(sizeof(*ret));
170*e7be843bSPierre Pronchery     if (ret == NULL)
171b077aed3SPierre Pronchery         return NULL;
172b077aed3SPierre Pronchery     in->base.hw->copyctx(&ret->base, &in->base);
173b077aed3SPierre Pronchery     return ret;
174b077aed3SPierre Pronchery }
175b077aed3SPierre Pronchery 
aes_xts_cipher(void * vctx,unsigned char * out,size_t * outl,size_t outsize,const unsigned char * in,size_t inl)176b077aed3SPierre Pronchery static int aes_xts_cipher(void *vctx, unsigned char *out, size_t *outl,
177b077aed3SPierre Pronchery                           size_t outsize, const unsigned char *in, size_t inl)
178b077aed3SPierre Pronchery {
179b077aed3SPierre Pronchery     PROV_AES_XTS_CTX *ctx = (PROV_AES_XTS_CTX *)vctx;
180b077aed3SPierre Pronchery 
181*e7be843bSPierre Pronchery #ifdef AES_XTS_S390X
182*e7be843bSPierre Pronchery     if (ctx->plat.s390x.fc)
183*e7be843bSPierre Pronchery         return s390x_aes_xts_cipher(vctx, out, outl, outsize, in, inl);
184*e7be843bSPierre Pronchery #endif
185*e7be843bSPierre Pronchery 
186b077aed3SPierre Pronchery     if (!ossl_prov_is_running()
187b077aed3SPierre Pronchery             || ctx->xts.key1 == NULL
188b077aed3SPierre Pronchery             || ctx->xts.key2 == NULL
189b077aed3SPierre Pronchery             || !ctx->base.iv_set
190b077aed3SPierre Pronchery             || out == NULL
191b077aed3SPierre Pronchery             || in == NULL
192b077aed3SPierre Pronchery             || inl < AES_BLOCK_SIZE)
193b077aed3SPierre Pronchery         return 0;
194b077aed3SPierre Pronchery 
195b077aed3SPierre Pronchery     /*
196b077aed3SPierre Pronchery      * Impose a limit of 2^20 blocks per data unit as specified by
197b077aed3SPierre Pronchery      * IEEE Std 1619-2018.  The earlier and obsolete IEEE Std 1619-2007
198b077aed3SPierre Pronchery      * indicated that this was a SHOULD NOT rather than a MUST NOT.
199b077aed3SPierre Pronchery      * NIST SP 800-38E mandates the same limit.
200b077aed3SPierre Pronchery      */
201b077aed3SPierre Pronchery     if (inl > XTS_MAX_BLOCKS_PER_DATA_UNIT * AES_BLOCK_SIZE) {
202b077aed3SPierre Pronchery         ERR_raise(ERR_LIB_PROV, PROV_R_XTS_DATA_UNIT_IS_TOO_LARGE);
203b077aed3SPierre Pronchery         return 0;
204b077aed3SPierre Pronchery     }
205b077aed3SPierre Pronchery 
206b077aed3SPierre Pronchery     if (ctx->stream != NULL)
207b077aed3SPierre Pronchery         (*ctx->stream)(in, out, inl, ctx->xts.key1, ctx->xts.key2, ctx->base.iv);
208b077aed3SPierre Pronchery     else if (CRYPTO_xts128_encrypt(&ctx->xts, ctx->base.iv, in, out, inl,
209b077aed3SPierre Pronchery                                    ctx->base.enc))
210b077aed3SPierre Pronchery         return 0;
211b077aed3SPierre Pronchery 
212b077aed3SPierre Pronchery     *outl = inl;
213b077aed3SPierre Pronchery     return 1;
214b077aed3SPierre Pronchery }
215b077aed3SPierre Pronchery 
aes_xts_stream_update(void * vctx,unsigned char * out,size_t * outl,size_t outsize,const unsigned char * in,size_t inl)216b077aed3SPierre Pronchery static int aes_xts_stream_update(void *vctx, unsigned char *out, size_t *outl,
217b077aed3SPierre Pronchery                                  size_t outsize, const unsigned char *in,
218b077aed3SPierre Pronchery                                  size_t inl)
219b077aed3SPierre Pronchery {
220b077aed3SPierre Pronchery     PROV_AES_XTS_CTX *ctx = (PROV_AES_XTS_CTX *)vctx;
221b077aed3SPierre Pronchery 
222b077aed3SPierre Pronchery     if (outsize < inl) {
223b077aed3SPierre Pronchery         ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
224b077aed3SPierre Pronchery         return 0;
225b077aed3SPierre Pronchery     }
226b077aed3SPierre Pronchery 
227b077aed3SPierre Pronchery     if (!aes_xts_cipher(ctx, out, outl, outsize, in, inl)) {
228b077aed3SPierre Pronchery         ERR_raise(ERR_LIB_PROV, PROV_R_CIPHER_OPERATION_FAILED);
229b077aed3SPierre Pronchery         return 0;
230b077aed3SPierre Pronchery     }
231b077aed3SPierre Pronchery 
232b077aed3SPierre Pronchery     return 1;
233b077aed3SPierre Pronchery }
234b077aed3SPierre Pronchery 
aes_xts_stream_final(void * vctx,unsigned char * out,size_t * outl,size_t outsize)235b077aed3SPierre Pronchery static int aes_xts_stream_final(void *vctx, unsigned char *out, size_t *outl,
236b077aed3SPierre Pronchery                                 size_t outsize)
237b077aed3SPierre Pronchery {
238b077aed3SPierre Pronchery     if (!ossl_prov_is_running())
239b077aed3SPierre Pronchery         return 0;
240b077aed3SPierre Pronchery     *outl = 0;
241b077aed3SPierre Pronchery     return 1;
242b077aed3SPierre Pronchery }
243b077aed3SPierre Pronchery 
244b077aed3SPierre Pronchery static const OSSL_PARAM aes_xts_known_settable_ctx_params[] = {
245b077aed3SPierre Pronchery     OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_KEYLEN, NULL),
246b077aed3SPierre Pronchery     OSSL_PARAM_END
247b077aed3SPierre Pronchery };
248b077aed3SPierre Pronchery 
aes_xts_settable_ctx_params(ossl_unused void * cctx,ossl_unused void * provctx)249b077aed3SPierre Pronchery static const OSSL_PARAM *aes_xts_settable_ctx_params(ossl_unused void *cctx,
250b077aed3SPierre Pronchery                                                      ossl_unused void *provctx)
251b077aed3SPierre Pronchery {
252b077aed3SPierre Pronchery     return aes_xts_known_settable_ctx_params;
253b077aed3SPierre Pronchery }
254b077aed3SPierre Pronchery 
aes_xts_set_ctx_params(void * vctx,const OSSL_PARAM params[])255b077aed3SPierre Pronchery static int aes_xts_set_ctx_params(void *vctx, const OSSL_PARAM params[])
256b077aed3SPierre Pronchery {
257b077aed3SPierre Pronchery     PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx;
258b077aed3SPierre Pronchery     const OSSL_PARAM *p;
259b077aed3SPierre Pronchery 
260*e7be843bSPierre Pronchery     if (ossl_param_is_empty(params))
261b077aed3SPierre Pronchery         return 1;
262b077aed3SPierre Pronchery 
263b077aed3SPierre Pronchery     p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_KEYLEN);
264b077aed3SPierre Pronchery     if (p != NULL) {
265b077aed3SPierre Pronchery         size_t keylen;
266b077aed3SPierre Pronchery 
267b077aed3SPierre Pronchery         if (!OSSL_PARAM_get_size_t(p, &keylen)) {
268b077aed3SPierre Pronchery             ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
269b077aed3SPierre Pronchery             return 0;
270b077aed3SPierre Pronchery         }
271b077aed3SPierre Pronchery         /* The key length can not be modified for xts mode */
272b077aed3SPierre Pronchery         if (keylen != ctx->keylen)
273b077aed3SPierre Pronchery             return 0;
274b077aed3SPierre Pronchery     }
275b077aed3SPierre Pronchery 
276b077aed3SPierre Pronchery     return 1;
277b077aed3SPierre Pronchery }
278b077aed3SPierre Pronchery 
279b077aed3SPierre Pronchery #define IMPLEMENT_cipher(lcmode, UCMODE, kbits, flags)                         \
280b077aed3SPierre Pronchery static OSSL_FUNC_cipher_get_params_fn aes_##kbits##_##lcmode##_get_params;     \
281b077aed3SPierre Pronchery static int aes_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])            \
282b077aed3SPierre Pronchery {                                                                              \
283b077aed3SPierre Pronchery     return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
284b077aed3SPierre Pronchery                                      flags, 2 * kbits, AES_XTS_BLOCK_BITS,     \
285b077aed3SPierre Pronchery                                      AES_XTS_IV_BITS);                         \
286b077aed3SPierre Pronchery }                                                                              \
287b077aed3SPierre Pronchery static OSSL_FUNC_cipher_newctx_fn aes_##kbits##_xts_newctx;                    \
288b077aed3SPierre Pronchery static void *aes_##kbits##_xts_newctx(void *provctx)                           \
289b077aed3SPierre Pronchery {                                                                              \
290b077aed3SPierre Pronchery     return aes_xts_newctx(provctx, EVP_CIPH_##UCMODE##_MODE, flags, 2 * kbits, \
291b077aed3SPierre Pronchery                           AES_XTS_BLOCK_BITS, AES_XTS_IV_BITS);                \
292b077aed3SPierre Pronchery }                                                                              \
293b077aed3SPierre Pronchery const OSSL_DISPATCH ossl_aes##kbits##xts_functions[] = {                       \
294b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_NEWCTX, (void (*)(void))aes_##kbits##_xts_newctx },     \
295b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))aes_xts_einit },          \
296b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))aes_xts_dinit },          \
297b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))aes_xts_stream_update },        \
298b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))aes_xts_stream_final },          \
299b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))aes_xts_cipher },               \
300b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_FREECTX, (void (*)(void))aes_xts_freectx },             \
301b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_DUPCTX, (void (*)(void))aes_xts_dupctx },               \
302b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_GET_PARAMS,                                             \
303b077aed3SPierre Pronchery       (void (*)(void))aes_##kbits##_##lcmode##_get_params },                   \
304b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_GETTABLE_PARAMS,                                        \
305b077aed3SPierre Pronchery       (void (*)(void))ossl_cipher_generic_gettable_params },                   \
306b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_GET_CTX_PARAMS,                                         \
307b077aed3SPierre Pronchery       (void (*)(void))ossl_cipher_generic_get_ctx_params },                    \
308b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS,                                    \
309b077aed3SPierre Pronchery       (void (*)(void))ossl_cipher_generic_gettable_ctx_params },               \
310b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_SET_CTX_PARAMS,                                         \
311b077aed3SPierre Pronchery       (void (*)(void))aes_xts_set_ctx_params },                                \
312b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS,                                    \
313b077aed3SPierre Pronchery      (void (*)(void))aes_xts_settable_ctx_params },                            \
314*e7be843bSPierre Pronchery     OSSL_DISPATCH_END                                                          \
315b077aed3SPierre Pronchery }
316b077aed3SPierre Pronchery 
317b077aed3SPierre Pronchery IMPLEMENT_cipher(xts, XTS, 256, AES_XTS_FLAGS);
318b077aed3SPierre Pronchery IMPLEMENT_cipher(xts, XTS, 128, AES_XTS_FLAGS);
319