xref: /freebsd-src/crypto/openssl/providers/implementations/ciphers/cipher_aes_siv.c (revision aa7957345732816fb0ba8308798d2f79f45597f9)
1b077aed3SPierre Pronchery /*
2*aa795734SPierre Pronchery  * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.
3b077aed3SPierre Pronchery  *
4b077aed3SPierre Pronchery  * Licensed under the Apache License 2.0 (the "License").  You may not use
5b077aed3SPierre Pronchery  * this file except in compliance with the License.  You can obtain a copy
6b077aed3SPierre Pronchery  * in the file LICENSE in the source distribution or at
7b077aed3SPierre Pronchery  * https://www.openssl.org/source/license.html
8b077aed3SPierre Pronchery  */
9b077aed3SPierre Pronchery 
10b077aed3SPierre Pronchery /* Dispatch functions for AES SIV mode */
11b077aed3SPierre Pronchery 
12b077aed3SPierre Pronchery /*
13b077aed3SPierre Pronchery  * This file uses the low level AES functions (which are deprecated for
14b077aed3SPierre Pronchery  * non-internal use) in order to implement provider AES ciphers.
15b077aed3SPierre Pronchery  */
16b077aed3SPierre Pronchery #include "internal/deprecated.h"
17b077aed3SPierre Pronchery 
18b077aed3SPierre Pronchery #include <openssl/proverr.h>
19b077aed3SPierre Pronchery #include "cipher_aes_siv.h"
20b077aed3SPierre Pronchery #include "prov/implementations.h"
21b077aed3SPierre Pronchery #include "prov/providercommon.h"
22b077aed3SPierre Pronchery #include "prov/ciphercommon_aead.h"
23b077aed3SPierre Pronchery #include "prov/provider_ctx.h"
24b077aed3SPierre Pronchery 
25b077aed3SPierre Pronchery #define siv_stream_update siv_cipher
26b077aed3SPierre Pronchery #define SIV_FLAGS AEAD_FLAGS
27b077aed3SPierre Pronchery 
28b077aed3SPierre Pronchery static OSSL_FUNC_cipher_set_ctx_params_fn aes_siv_set_ctx_params;
29b077aed3SPierre Pronchery 
aes_siv_newctx(void * provctx,size_t keybits,unsigned int mode,uint64_t flags)30b077aed3SPierre Pronchery static void *aes_siv_newctx(void *provctx, size_t keybits, unsigned int mode,
31b077aed3SPierre Pronchery                             uint64_t flags)
32b077aed3SPierre Pronchery {
33b077aed3SPierre Pronchery     PROV_AES_SIV_CTX *ctx;
34b077aed3SPierre Pronchery 
35b077aed3SPierre Pronchery     if (!ossl_prov_is_running())
36b077aed3SPierre Pronchery         return NULL;
37b077aed3SPierre Pronchery 
38b077aed3SPierre Pronchery     ctx = OPENSSL_zalloc(sizeof(*ctx));
39b077aed3SPierre Pronchery     if (ctx != NULL) {
40b077aed3SPierre Pronchery         ctx->taglen = SIV_LEN;
41b077aed3SPierre Pronchery         ctx->mode = mode;
42b077aed3SPierre Pronchery         ctx->keylen = keybits / 8;
43b077aed3SPierre Pronchery         ctx->hw = ossl_prov_cipher_hw_aes_siv(keybits);
44b077aed3SPierre Pronchery         ctx->libctx = PROV_LIBCTX_OF(provctx);
45b077aed3SPierre Pronchery     }
46b077aed3SPierre Pronchery     return ctx;
47b077aed3SPierre Pronchery }
48b077aed3SPierre Pronchery 
aes_siv_freectx(void * vctx)49b077aed3SPierre Pronchery static void aes_siv_freectx(void *vctx)
50b077aed3SPierre Pronchery {
51b077aed3SPierre Pronchery     PROV_AES_SIV_CTX *ctx = (PROV_AES_SIV_CTX *)vctx;
52b077aed3SPierre Pronchery 
53b077aed3SPierre Pronchery     if (ctx != NULL) {
54b077aed3SPierre Pronchery         ctx->hw->cleanup(ctx);
55b077aed3SPierre Pronchery         OPENSSL_clear_free(ctx,  sizeof(*ctx));
56b077aed3SPierre Pronchery     }
57b077aed3SPierre Pronchery }
58b077aed3SPierre Pronchery 
siv_dupctx(void * vctx)59b077aed3SPierre Pronchery static void *siv_dupctx(void *vctx)
60b077aed3SPierre Pronchery {
61b077aed3SPierre Pronchery     PROV_AES_SIV_CTX *in = (PROV_AES_SIV_CTX *)vctx;
62b077aed3SPierre Pronchery     PROV_AES_SIV_CTX *ret;
63b077aed3SPierre Pronchery 
64b077aed3SPierre Pronchery     if (!ossl_prov_is_running())
65b077aed3SPierre Pronchery         return NULL;
66b077aed3SPierre Pronchery 
67b077aed3SPierre Pronchery     ret = OPENSSL_malloc(sizeof(*ret));
68b077aed3SPierre Pronchery     if (ret == NULL) {
69b077aed3SPierre Pronchery         ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
70b077aed3SPierre Pronchery         return NULL;
71b077aed3SPierre Pronchery     }
72b077aed3SPierre Pronchery     if (!in->hw->dupctx(in, ret)) {
73b077aed3SPierre Pronchery         OPENSSL_free(ret);
74b077aed3SPierre Pronchery         ret = NULL;
75b077aed3SPierre Pronchery     }
76b077aed3SPierre Pronchery     return ret;
77b077aed3SPierre Pronchery }
78b077aed3SPierre Pronchery 
siv_init(void * vctx,const unsigned char * key,size_t keylen,const unsigned char * iv,size_t ivlen,const OSSL_PARAM params[],int enc)79b077aed3SPierre Pronchery static int siv_init(void *vctx, const unsigned char *key, size_t keylen,
80b077aed3SPierre Pronchery                     const unsigned char *iv, size_t ivlen,
81b077aed3SPierre Pronchery                     const OSSL_PARAM params[], int enc)
82b077aed3SPierre Pronchery {
83b077aed3SPierre Pronchery     PROV_AES_SIV_CTX *ctx = (PROV_AES_SIV_CTX *)vctx;
84b077aed3SPierre Pronchery 
85b077aed3SPierre Pronchery     if (!ossl_prov_is_running())
86b077aed3SPierre Pronchery         return 0;
87b077aed3SPierre Pronchery 
88b077aed3SPierre Pronchery     ctx->enc = enc;
89b077aed3SPierre Pronchery 
90b077aed3SPierre Pronchery     if (key != NULL) {
91b077aed3SPierre Pronchery         if (keylen != ctx->keylen) {
92b077aed3SPierre Pronchery             ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH);
93b077aed3SPierre Pronchery             return 0;
94b077aed3SPierre Pronchery         }
95b077aed3SPierre Pronchery         if (!ctx->hw->initkey(ctx, key, ctx->keylen))
96b077aed3SPierre Pronchery             return 0;
97b077aed3SPierre Pronchery     }
98b077aed3SPierre Pronchery     return aes_siv_set_ctx_params(ctx, params);
99b077aed3SPierre Pronchery }
100b077aed3SPierre Pronchery 
siv_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 siv_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 {
105b077aed3SPierre Pronchery     return siv_init(vctx, key, keylen, iv, ivlen, params, 1);
106b077aed3SPierre Pronchery }
107b077aed3SPierre Pronchery 
siv_dinit(void * vctx,const unsigned char * key,size_t keylen,const unsigned char * iv,size_t ivlen,const OSSL_PARAM params[])108b077aed3SPierre Pronchery static int siv_dinit(void *vctx, const unsigned char *key, size_t keylen,
109b077aed3SPierre Pronchery                      const unsigned char *iv, size_t ivlen,
110b077aed3SPierre Pronchery                      const OSSL_PARAM params[])
111b077aed3SPierre Pronchery {
112b077aed3SPierre Pronchery     return siv_init(vctx, key, keylen, iv, ivlen, params, 0);
113b077aed3SPierre Pronchery }
114b077aed3SPierre Pronchery 
siv_cipher(void * vctx,unsigned char * out,size_t * outl,size_t outsize,const unsigned char * in,size_t inl)115b077aed3SPierre Pronchery static int siv_cipher(void *vctx, unsigned char *out, size_t *outl,
116b077aed3SPierre Pronchery                       size_t outsize, const unsigned char *in, size_t inl)
117b077aed3SPierre Pronchery {
118b077aed3SPierre Pronchery     PROV_AES_SIV_CTX *ctx = (PROV_AES_SIV_CTX *)vctx;
119b077aed3SPierre Pronchery 
120b077aed3SPierre Pronchery     if (!ossl_prov_is_running())
121b077aed3SPierre Pronchery         return 0;
122b077aed3SPierre Pronchery 
123*aa795734SPierre Pronchery     /* Ignore just empty encryption/decryption call and not AAD. */
124*aa795734SPierre Pronchery     if (out != NULL) {
125b077aed3SPierre Pronchery         if (inl == 0) {
126*aa795734SPierre Pronchery             if (outl != NULL)
127b077aed3SPierre Pronchery                 *outl = 0;
128b077aed3SPierre Pronchery             return 1;
129b077aed3SPierre Pronchery         }
130b077aed3SPierre Pronchery 
131b077aed3SPierre Pronchery         if (outsize < inl) {
132b077aed3SPierre Pronchery             ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
133b077aed3SPierre Pronchery             return 0;
134b077aed3SPierre Pronchery         }
135*aa795734SPierre Pronchery     }
136b077aed3SPierre Pronchery 
137b077aed3SPierre Pronchery     if (ctx->hw->cipher(ctx, out, in, inl) <= 0)
138b077aed3SPierre Pronchery         return 0;
139b077aed3SPierre Pronchery 
140b077aed3SPierre Pronchery     if (outl != NULL)
141b077aed3SPierre Pronchery         *outl = inl;
142b077aed3SPierre Pronchery     return 1;
143b077aed3SPierre Pronchery }
144b077aed3SPierre Pronchery 
siv_stream_final(void * vctx,unsigned char * out,size_t * outl,size_t outsize)145b077aed3SPierre Pronchery static int siv_stream_final(void *vctx, unsigned char *out, size_t *outl,
146b077aed3SPierre Pronchery                             size_t outsize)
147b077aed3SPierre Pronchery {
148b077aed3SPierre Pronchery     PROV_AES_SIV_CTX *ctx = (PROV_AES_SIV_CTX *)vctx;
149b077aed3SPierre Pronchery 
150b077aed3SPierre Pronchery     if (!ossl_prov_is_running())
151b077aed3SPierre Pronchery         return 0;
152b077aed3SPierre Pronchery 
153b077aed3SPierre Pronchery     if (!ctx->hw->cipher(vctx, out, NULL, 0))
154b077aed3SPierre Pronchery         return 0;
155b077aed3SPierre Pronchery 
156b077aed3SPierre Pronchery     if (outl != NULL)
157b077aed3SPierre Pronchery         *outl = 0;
158b077aed3SPierre Pronchery     return 1;
159b077aed3SPierre Pronchery }
160b077aed3SPierre Pronchery 
aes_siv_get_ctx_params(void * vctx,OSSL_PARAM params[])161b077aed3SPierre Pronchery static int aes_siv_get_ctx_params(void *vctx, OSSL_PARAM params[])
162b077aed3SPierre Pronchery {
163b077aed3SPierre Pronchery     PROV_AES_SIV_CTX *ctx = (PROV_AES_SIV_CTX *)vctx;
164b077aed3SPierre Pronchery     SIV128_CONTEXT *sctx = &ctx->siv;
165b077aed3SPierre Pronchery     OSSL_PARAM *p;
166b077aed3SPierre Pronchery 
167b077aed3SPierre Pronchery     p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_AEAD_TAG);
168b077aed3SPierre Pronchery     if (p != NULL && p->data_type == OSSL_PARAM_OCTET_STRING) {
169b077aed3SPierre Pronchery         if (!ctx->enc
170b077aed3SPierre Pronchery             || p->data_size != ctx->taglen
171b077aed3SPierre Pronchery             || !OSSL_PARAM_set_octet_string(p, &sctx->tag.byte, ctx->taglen)) {
172b077aed3SPierre Pronchery             ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
173b077aed3SPierre Pronchery             return 0;
174b077aed3SPierre Pronchery         }
175b077aed3SPierre Pronchery     }
176b077aed3SPierre Pronchery     p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_AEAD_TAGLEN);
177b077aed3SPierre Pronchery     if (p != NULL && !OSSL_PARAM_set_size_t(p, ctx->taglen)) {
178b077aed3SPierre Pronchery         ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
179b077aed3SPierre Pronchery         return 0;
180b077aed3SPierre Pronchery     }
181b077aed3SPierre Pronchery     p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_KEYLEN);
182b077aed3SPierre Pronchery     if (p != NULL && !OSSL_PARAM_set_size_t(p, ctx->keylen)) {
183b077aed3SPierre Pronchery         ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
184b077aed3SPierre Pronchery         return 0;
185b077aed3SPierre Pronchery     }
186b077aed3SPierre Pronchery     return 1;
187b077aed3SPierre Pronchery }
188b077aed3SPierre Pronchery 
189b077aed3SPierre Pronchery static const OSSL_PARAM aes_siv_known_gettable_ctx_params[] = {
190b077aed3SPierre Pronchery     OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_KEYLEN, NULL),
191b077aed3SPierre Pronchery     OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_AEAD_TAGLEN, NULL),
192b077aed3SPierre Pronchery     OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_AEAD_TAG, NULL, 0),
193b077aed3SPierre Pronchery     OSSL_PARAM_END
194b077aed3SPierre Pronchery };
aes_siv_gettable_ctx_params(ossl_unused void * cctx,ossl_unused void * provctx)195b077aed3SPierre Pronchery static const OSSL_PARAM *aes_siv_gettable_ctx_params(ossl_unused void *cctx,
196b077aed3SPierre Pronchery                                                      ossl_unused void *provctx)
197b077aed3SPierre Pronchery {
198b077aed3SPierre Pronchery     return aes_siv_known_gettable_ctx_params;
199b077aed3SPierre Pronchery }
200b077aed3SPierre Pronchery 
aes_siv_set_ctx_params(void * vctx,const OSSL_PARAM params[])201b077aed3SPierre Pronchery static int aes_siv_set_ctx_params(void *vctx, const OSSL_PARAM params[])
202b077aed3SPierre Pronchery {
203b077aed3SPierre Pronchery     PROV_AES_SIV_CTX *ctx = (PROV_AES_SIV_CTX *)vctx;
204b077aed3SPierre Pronchery     const OSSL_PARAM *p;
205b077aed3SPierre Pronchery     unsigned int speed = 0;
206b077aed3SPierre Pronchery 
207b077aed3SPierre Pronchery     if (params == NULL)
208b077aed3SPierre Pronchery         return 1;
209b077aed3SPierre Pronchery 
210b077aed3SPierre Pronchery     p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_AEAD_TAG);
211b077aed3SPierre Pronchery     if (p != NULL) {
212b077aed3SPierre Pronchery         if (ctx->enc)
213b077aed3SPierre Pronchery             return 1;
214b077aed3SPierre Pronchery         if (p->data_type != OSSL_PARAM_OCTET_STRING
215b077aed3SPierre Pronchery             || !ctx->hw->settag(ctx, p->data, p->data_size)) {
216b077aed3SPierre Pronchery             ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
217b077aed3SPierre Pronchery             return 0;
218b077aed3SPierre Pronchery         }
219b077aed3SPierre Pronchery     }
220b077aed3SPierre Pronchery     p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_SPEED);
221b077aed3SPierre Pronchery     if (p != NULL) {
222b077aed3SPierre Pronchery         if (!OSSL_PARAM_get_uint(p, &speed)) {
223b077aed3SPierre Pronchery             ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
224b077aed3SPierre Pronchery             return 0;
225b077aed3SPierre Pronchery         }
226b077aed3SPierre Pronchery         ctx->hw->setspeed(ctx, (int)speed);
227b077aed3SPierre Pronchery     }
228b077aed3SPierre Pronchery     p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_KEYLEN);
229b077aed3SPierre Pronchery     if (p != NULL) {
230b077aed3SPierre Pronchery         size_t keylen;
231b077aed3SPierre Pronchery 
232b077aed3SPierre Pronchery         if (!OSSL_PARAM_get_size_t(p, &keylen)) {
233b077aed3SPierre Pronchery             ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
234b077aed3SPierre Pronchery             return 0;
235b077aed3SPierre Pronchery         }
236b077aed3SPierre Pronchery         /* The key length can not be modified */
237b077aed3SPierre Pronchery         if (keylen != ctx->keylen)
238b077aed3SPierre Pronchery             return 0;
239b077aed3SPierre Pronchery     }
240b077aed3SPierre Pronchery     return 1;
241b077aed3SPierre Pronchery }
242b077aed3SPierre Pronchery 
243b077aed3SPierre Pronchery static const OSSL_PARAM aes_siv_known_settable_ctx_params[] = {
244b077aed3SPierre Pronchery     OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_KEYLEN, NULL),
245b077aed3SPierre Pronchery     OSSL_PARAM_uint(OSSL_CIPHER_PARAM_SPEED, NULL),
246b077aed3SPierre Pronchery     OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_AEAD_TAG, NULL, 0),
247b077aed3SPierre Pronchery     OSSL_PARAM_END
248b077aed3SPierre Pronchery };
aes_siv_settable_ctx_params(ossl_unused void * cctx,ossl_unused void * provctx)249b077aed3SPierre Pronchery static const OSSL_PARAM *aes_siv_settable_ctx_params(ossl_unused void *cctx,
250b077aed3SPierre Pronchery                                                      ossl_unused void *provctx)
251b077aed3SPierre Pronchery {
252b077aed3SPierre Pronchery     return aes_siv_known_settable_ctx_params;
253b077aed3SPierre Pronchery }
254b077aed3SPierre Pronchery 
255b077aed3SPierre Pronchery #define IMPLEMENT_cipher(alg, lc, UCMODE, flags, kbits, blkbits, ivbits)       \
256b077aed3SPierre Pronchery static OSSL_FUNC_cipher_newctx_fn alg##kbits##lc##_newctx;                     \
257b077aed3SPierre Pronchery static OSSL_FUNC_cipher_freectx_fn alg##_##lc##_freectx;                       \
258b077aed3SPierre Pronchery static OSSL_FUNC_cipher_dupctx_fn lc##_dupctx;                                 \
259b077aed3SPierre Pronchery static OSSL_FUNC_cipher_encrypt_init_fn lc##_einit;                            \
260b077aed3SPierre Pronchery static OSSL_FUNC_cipher_decrypt_init_fn lc##_dinit;                            \
261b077aed3SPierre Pronchery static OSSL_FUNC_cipher_update_fn lc##_stream_update;                          \
262b077aed3SPierre Pronchery static OSSL_FUNC_cipher_final_fn lc##_stream_final;                            \
263b077aed3SPierre Pronchery static OSSL_FUNC_cipher_cipher_fn lc##_cipher;                                 \
264b077aed3SPierre Pronchery static OSSL_FUNC_cipher_get_params_fn alg##_##kbits##_##lc##_get_params;       \
265b077aed3SPierre Pronchery static OSSL_FUNC_cipher_get_ctx_params_fn alg##_##lc##_get_ctx_params;         \
266b077aed3SPierre Pronchery static OSSL_FUNC_cipher_gettable_ctx_params_fn                                 \
267b077aed3SPierre Pronchery             alg##_##lc##_gettable_ctx_params;                                  \
268b077aed3SPierre Pronchery static OSSL_FUNC_cipher_set_ctx_params_fn alg##_##lc##_set_ctx_params;         \
269b077aed3SPierre Pronchery static OSSL_FUNC_cipher_settable_ctx_params_fn                                 \
270b077aed3SPierre Pronchery             alg##_##lc##_settable_ctx_params;                                  \
271b077aed3SPierre Pronchery static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
272b077aed3SPierre Pronchery {                                                                              \
273b077aed3SPierre Pronchery     return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
274b077aed3SPierre Pronchery                                           flags, 2*kbits, blkbits, ivbits);    \
275b077aed3SPierre Pronchery }                                                                              \
276b077aed3SPierre Pronchery static void * alg##kbits##lc##_newctx(void *provctx)                           \
277b077aed3SPierre Pronchery {                                                                              \
278b077aed3SPierre Pronchery     return alg##_##lc##_newctx(provctx, 2*kbits, EVP_CIPH_##UCMODE##_MODE,     \
279b077aed3SPierre Pronchery                                flags);                                         \
280b077aed3SPierre Pronchery }                                                                              \
281b077aed3SPierre Pronchery const OSSL_DISPATCH ossl_##alg##kbits##lc##_functions[] = {                    \
282b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_NEWCTX, (void (*)(void))alg##kbits##lc##_newctx },      \
283b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_FREECTX, (void (*)(void))alg##_##lc##_freectx },        \
284b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_DUPCTX, (void (*)(void)) lc##_dupctx },                 \
285b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void)) lc##_einit },            \
286b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void)) lc##_dinit },            \
287b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void)) lc##_stream_update },          \
288b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_FINAL, (void (*)(void)) lc##_stream_final },            \
289b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void)) lc##_cipher },                 \
290b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_GET_PARAMS,                                             \
291b077aed3SPierre Pronchery       (void (*)(void)) alg##_##kbits##_##lc##_get_params },                    \
292b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_GETTABLE_PARAMS,                                        \
293b077aed3SPierre Pronchery       (void (*)(void))ossl_cipher_generic_gettable_params },                   \
294b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_GET_CTX_PARAMS,                                         \
295b077aed3SPierre Pronchery       (void (*)(void)) alg##_##lc##_get_ctx_params },                          \
296b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS,                                    \
297b077aed3SPierre Pronchery       (void (*)(void)) alg##_##lc##_gettable_ctx_params },                     \
298b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_SET_CTX_PARAMS,                                         \
299b077aed3SPierre Pronchery       (void (*)(void)) alg##_##lc##_set_ctx_params },                          \
300b077aed3SPierre Pronchery     { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS,                                    \
301b077aed3SPierre Pronchery       (void (*)(void)) alg##_##lc##_settable_ctx_params },                     \
302b077aed3SPierre Pronchery     { 0, NULL }                                                                \
303b077aed3SPierre Pronchery };
304b077aed3SPierre Pronchery 
305b077aed3SPierre Pronchery IMPLEMENT_cipher(aes, siv, SIV, SIV_FLAGS, 128, 8, 0)
306b077aed3SPierre Pronchery IMPLEMENT_cipher(aes, siv, SIV, SIV_FLAGS, 192, 8, 0)
307b077aed3SPierre Pronchery IMPLEMENT_cipher(aes, siv, SIV, SIV_FLAGS, 256, 8, 0)
308