/src/openssl30/providers/implementations/include/prov/ciphercommon.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. |
3 | | * |
4 | | * Licensed under the Apache License 2.0 (the "License"). You may not use |
5 | | * this file except in compliance with the License. You can obtain a copy |
6 | | * in the file LICENSE in the source distribution or at |
7 | | * https://www.openssl.org/source/license.html |
8 | | */ |
9 | | |
10 | | #include <openssl/params.h> |
11 | | #include <openssl/core_dispatch.h> |
12 | | #include <openssl/core_names.h> |
13 | | #include <openssl/evp.h> |
14 | | #include "internal/cryptlib.h" |
15 | | #include "crypto/modes.h" |
16 | | |
17 | 699 | # define MAXCHUNK ((size_t)1 << 30) |
18 | 0 | # define MAXBITCHUNK ((size_t)1 << (sizeof(size_t) * 8 - 4)) |
19 | | |
20 | | #define GENERIC_BLOCK_SIZE 16 |
21 | 81.2k | #define IV_STATE_UNINITIALISED 0 /* initial state is not initialized */ |
22 | 109k | #define IV_STATE_BUFFERED 1 /* iv has been copied to the iv buffer */ |
23 | 27.9k | #define IV_STATE_COPIED 2 /* iv has been copied from the iv buffer */ |
24 | 84.5k | #define IV_STATE_FINISHED 3 /* the iv has been used - so don't reuse it */ |
25 | | |
26 | | #define PROV_CIPHER_FUNC(type, name, args) typedef type (* OSSL_##name##_fn)args |
27 | | |
28 | | typedef struct prov_cipher_hw_st PROV_CIPHER_HW; |
29 | | typedef struct prov_cipher_ctx_st PROV_CIPHER_CTX; |
30 | | |
31 | | typedef int (PROV_CIPHER_HW_FN)(PROV_CIPHER_CTX *dat, unsigned char *out, |
32 | | const unsigned char *in, size_t len); |
33 | | |
34 | | /* Internal flags that can be queried */ |
35 | 2.30k | #define PROV_CIPHER_FLAG_AEAD 0x0001 |
36 | 3.84k | #define PROV_CIPHER_FLAG_CUSTOM_IV 0x0002 |
37 | 762 | #define PROV_CIPHER_FLAG_CTS 0x0004 |
38 | 762 | #define PROV_CIPHER_FLAG_TLS1_MULTIBLOCK 0x0008 |
39 | 762 | #define PROV_CIPHER_FLAG_RAND_KEY 0x0010 |
40 | | /* Internal flags that are only used within the provider */ |
41 | 6.14k | #define PROV_CIPHER_FLAG_VARIABLE_LENGTH 0x0100 |
42 | 6.14k | #define PROV_CIPHER_FLAG_INVERSE_CIPHER 0x0200 |
43 | | |
44 | | struct prov_cipher_ctx_st { |
45 | | block128_f block; |
46 | | union { |
47 | | cbc128_f cbc; |
48 | | ctr128_f ctr; |
49 | | ecb128_f ecb; |
50 | | } stream; |
51 | | |
52 | | unsigned int mode; |
53 | | size_t keylen; /* key size (in bytes) */ |
54 | | size_t ivlen; |
55 | | size_t blocksize; |
56 | | size_t bufsz; /* Number of bytes in buf */ |
57 | | unsigned int cts_mode; /* Use to set the type for CTS modes */ |
58 | | unsigned int pad : 1; /* Whether padding should be used or not */ |
59 | | unsigned int enc : 1; /* Set to 1 for encrypt, or 0 otherwise */ |
60 | | unsigned int iv_set : 1; /* Set when the iv is copied to the iv/oiv buffers */ |
61 | | unsigned int updated : 1; /* Set to 1 during update for one shot ciphers */ |
62 | | unsigned int variable_keylength : 1; |
63 | | unsigned int inverse_cipher : 1; /* set to 1 to use inverse cipher */ |
64 | | unsigned int use_bits : 1; /* Set to 0 for cfb1 to use bits instead of bytes */ |
65 | | |
66 | | unsigned int tlsversion; /* If TLS padding is in use the TLS version number */ |
67 | | unsigned char *tlsmac; /* tls MAC extracted from the last record */ |
68 | | int alloced; /* |
69 | | * Whether the tlsmac data has been allocated or |
70 | | * points into the user buffer. |
71 | | */ |
72 | | size_t tlsmacsize; /* Size of the TLS MAC */ |
73 | | int removetlspad; /* Whether TLS padding should be removed or not */ |
74 | | size_t removetlsfixed; /* |
75 | | * Length of the fixed size data to remove when |
76 | | * processing TLS data (equals mac size plus |
77 | | * IV size if applicable) |
78 | | */ |
79 | | |
80 | | /* |
81 | | * num contains the number of bytes of |iv| which are valid for modes that |
82 | | * manage partial blocks themselves. |
83 | | */ |
84 | | unsigned int num; |
85 | | |
86 | | /* The original value of the iv */ |
87 | | unsigned char oiv[GENERIC_BLOCK_SIZE]; |
88 | | /* Buffer of partial blocks processed via update calls */ |
89 | | unsigned char buf[GENERIC_BLOCK_SIZE]; |
90 | | unsigned char iv[GENERIC_BLOCK_SIZE]; |
91 | | const PROV_CIPHER_HW *hw; /* hardware specific functions */ |
92 | | const void *ks; /* Pointer to algorithm specific key data */ |
93 | | OSSL_LIB_CTX *libctx; |
94 | | }; |
95 | | |
96 | | struct prov_cipher_hw_st { |
97 | | int (*init)(PROV_CIPHER_CTX *dat, const uint8_t *key, size_t keylen); |
98 | | PROV_CIPHER_HW_FN *cipher; |
99 | | void (*copyctx)(PROV_CIPHER_CTX *dst, const PROV_CIPHER_CTX *src); |
100 | | }; |
101 | | |
102 | | void ossl_cipher_generic_reset_ctx(PROV_CIPHER_CTX *ctx); |
103 | | OSSL_FUNC_cipher_encrypt_init_fn ossl_cipher_generic_einit; |
104 | | OSSL_FUNC_cipher_decrypt_init_fn ossl_cipher_generic_dinit; |
105 | | OSSL_FUNC_cipher_update_fn ossl_cipher_generic_block_update; |
106 | | OSSL_FUNC_cipher_final_fn ossl_cipher_generic_block_final; |
107 | | OSSL_FUNC_cipher_update_fn ossl_cipher_generic_stream_update; |
108 | | OSSL_FUNC_cipher_final_fn ossl_cipher_generic_stream_final; |
109 | | OSSL_FUNC_cipher_cipher_fn ossl_cipher_generic_cipher; |
110 | | OSSL_FUNC_cipher_get_ctx_params_fn ossl_cipher_generic_get_ctx_params; |
111 | | OSSL_FUNC_cipher_set_ctx_params_fn ossl_cipher_generic_set_ctx_params; |
112 | | OSSL_FUNC_cipher_gettable_params_fn ossl_cipher_generic_gettable_params; |
113 | | OSSL_FUNC_cipher_gettable_ctx_params_fn ossl_cipher_generic_gettable_ctx_params; |
114 | | OSSL_FUNC_cipher_settable_ctx_params_fn ossl_cipher_generic_settable_ctx_params; |
115 | | OSSL_FUNC_cipher_set_ctx_params_fn ossl_cipher_var_keylen_set_ctx_params; |
116 | | OSSL_FUNC_cipher_settable_ctx_params_fn ossl_cipher_var_keylen_settable_ctx_params; |
117 | | OSSL_FUNC_cipher_gettable_ctx_params_fn ossl_cipher_aead_gettable_ctx_params; |
118 | | OSSL_FUNC_cipher_settable_ctx_params_fn ossl_cipher_aead_settable_ctx_params; |
119 | | |
120 | | int ossl_cipher_generic_get_params(OSSL_PARAM params[], unsigned int md, |
121 | | uint64_t flags, |
122 | | size_t kbits, size_t blkbits, size_t ivbits); |
123 | | void ossl_cipher_generic_initkey(void *vctx, size_t kbits, size_t blkbits, |
124 | | size_t ivbits, unsigned int mode, |
125 | | uint64_t flags, |
126 | | const PROV_CIPHER_HW *hw, void *provctx); |
127 | | |
128 | | #define IMPLEMENT_generic_cipher_func(alg, UCALG, lcmode, UCMODE, flags, kbits,\ |
129 | | blkbits, ivbits, typ) \ |
130 | | const OSSL_DISPATCH ossl_##alg##kbits##lcmode##_functions[] = { \ |
131 | | { OSSL_FUNC_CIPHER_NEWCTX, \ |
132 | | (void (*)(void)) alg##_##kbits##_##lcmode##_newctx }, \ |
133 | | { OSSL_FUNC_CIPHER_FREECTX, (void (*)(void)) alg##_freectx }, \ |
134 | | { OSSL_FUNC_CIPHER_DUPCTX, (void (*)(void)) alg##_dupctx }, \ |
135 | | { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))ossl_cipher_generic_einit }, \ |
136 | | { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))ossl_cipher_generic_dinit }, \ |
137 | | { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))ossl_cipher_generic_##typ##_update },\ |
138 | | { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))ossl_cipher_generic_##typ##_final }, \ |
139 | | { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))ossl_cipher_generic_cipher }, \ |
140 | | { OSSL_FUNC_CIPHER_GET_PARAMS, \ |
141 | | (void (*)(void)) alg##_##kbits##_##lcmode##_get_params }, \ |
142 | | { OSSL_FUNC_CIPHER_GET_CTX_PARAMS, \ |
143 | | (void (*)(void))ossl_cipher_generic_get_ctx_params }, \ |
144 | | { OSSL_FUNC_CIPHER_SET_CTX_PARAMS, \ |
145 | | (void (*)(void))ossl_cipher_generic_set_ctx_params }, \ |
146 | | { OSSL_FUNC_CIPHER_GETTABLE_PARAMS, \ |
147 | | (void (*)(void))ossl_cipher_generic_gettable_params }, \ |
148 | | { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \ |
149 | | (void (*)(void))ossl_cipher_generic_gettable_ctx_params }, \ |
150 | | { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS, \ |
151 | | (void (*)(void))ossl_cipher_generic_settable_ctx_params }, \ |
152 | | { 0, NULL } \ |
153 | | }; |
154 | | |
155 | | #define IMPLEMENT_var_keylen_cipher_func(alg, UCALG, lcmode, UCMODE, flags, \ |
156 | | kbits, blkbits, ivbits, typ) \ |
157 | | const OSSL_DISPATCH ossl_##alg##kbits##lcmode##_functions[] = { \ |
158 | | { OSSL_FUNC_CIPHER_NEWCTX, \ |
159 | | (void (*)(void)) alg##_##kbits##_##lcmode##_newctx }, \ |
160 | | { OSSL_FUNC_CIPHER_FREECTX, (void (*)(void)) alg##_freectx }, \ |
161 | | { OSSL_FUNC_CIPHER_DUPCTX, (void (*)(void)) alg##_dupctx }, \ |
162 | | { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))ossl_cipher_generic_einit },\ |
163 | | { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))ossl_cipher_generic_dinit },\ |
164 | | { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))ossl_cipher_generic_##typ##_update },\ |
165 | | { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))ossl_cipher_generic_##typ##_final }, \ |
166 | | { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))ossl_cipher_generic_cipher }, \ |
167 | | { OSSL_FUNC_CIPHER_GET_PARAMS, \ |
168 | | (void (*)(void)) alg##_##kbits##_##lcmode##_get_params }, \ |
169 | | { OSSL_FUNC_CIPHER_GET_CTX_PARAMS, \ |
170 | | (void (*)(void))ossl_cipher_generic_get_ctx_params }, \ |
171 | | { OSSL_FUNC_CIPHER_SET_CTX_PARAMS, \ |
172 | | (void (*)(void))ossl_cipher_var_keylen_set_ctx_params }, \ |
173 | | { OSSL_FUNC_CIPHER_GETTABLE_PARAMS, \ |
174 | | (void (*)(void))ossl_cipher_generic_gettable_params }, \ |
175 | | { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \ |
176 | | (void (*)(void))ossl_cipher_generic_gettable_ctx_params }, \ |
177 | | { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS, \ |
178 | | (void (*)(void))ossl_cipher_var_keylen_settable_ctx_params }, \ |
179 | | { 0, NULL } \ |
180 | | }; |
181 | | |
182 | | |
183 | | #define IMPLEMENT_generic_cipher_genfn(alg, UCALG, lcmode, UCMODE, flags, \ |
184 | | kbits, blkbits, ivbits, typ) \ |
185 | | static OSSL_FUNC_cipher_get_params_fn alg##_##kbits##_##lcmode##_get_params; \ |
186 | 408 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ |
187 | 408 | { \ |
188 | 408 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ |
189 | 408 | flags, kbits, blkbits, ivbits); \ |
190 | 408 | } \ cipher_aes.c:aes_256_ecb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_192_ecb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_128_ecb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_256_cbc_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_192_cbc_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_128_cbc_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_256_ofb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_192_ofb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_128_ofb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_256_cfb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_192_cfb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_128_cfb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_256_cfb1_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_192_cfb1_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_128_cfb1_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_256_cfb8_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_192_cfb8_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_128_cfb8_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_256_ctr_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_192_ctr_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aes.c:aes_128_ctr_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_256_ecb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_192_ecb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_128_ecb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_256_cbc_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_192_cbc_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_128_cbc_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_256_ofb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_192_ofb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_128_ofb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_256_cfb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_192_cfb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_128_cfb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_256_cfb1_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_192_cfb1_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_128_cfb1_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_256_cfb8_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_192_cfb8_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_128_cfb8_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_256_ctr_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_192_ctr_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_aria.c:aria_128_ctr_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_256_ecb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_192_ecb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_128_ecb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_256_cbc_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_192_cbc_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_128_cbc_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_256_ofb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_192_ofb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_128_ofb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_256_cfb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_192_cfb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_128_cfb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_256_cfb1_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_192_cfb1_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_128_cfb1_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_256_cfb8_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_192_cfb8_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_128_cfb8_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_256_ctr_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_192_ctr_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_camellia.c:camellia_128_ctr_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_sm4.c:sm4_128_ecb_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_sm4.c:sm4_128_cbc_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_sm4.c:sm4_128_ctr_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_sm4.c:sm4_128_ofb128_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
cipher_sm4.c:sm4_128_cfb128_get_params Line | Count | Source | 186 | 6 | static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ | 187 | 6 | { \ | 188 | 6 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 189 | 6 | flags, kbits, blkbits, ivbits); \ | 190 | 6 | } \ |
|
191 | | static OSSL_FUNC_cipher_newctx_fn alg##_##kbits##_##lcmode##_newctx; \ |
192 | 1.10k | static void * alg##_##kbits##_##lcmode##_newctx(void *provctx) \ |
193 | 1.10k | { \ |
194 | 1.10k | PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\ |
195 | 1.10k | : NULL; \ |
196 | 1.10k | if (ctx != NULL) { \ |
197 | 1.10k | ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits, \ |
198 | 1.10k | EVP_CIPH_##UCMODE##_MODE, flags, \ |
199 | 1.10k | ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\ |
200 | 1.10k | provctx); \ |
201 | 1.10k | } \ |
202 | 1.10k | return ctx; \ |
203 | 1.10k | } \ cipher_aes.c:aes_256_ecb_newctx Line | Count | Source | 192 | 7 | static void * alg##_##kbits##_##lcmode##_newctx(void *provctx) \ | 193 | 7 | { \ | 194 | 7 | PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\ | 195 | 7 | : NULL; \ | 196 | 7 | if (ctx != NULL) { \ | 197 | 7 | ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits, \ | 198 | 7 | EVP_CIPH_##UCMODE##_MODE, flags, \ | 199 | 7 | ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\ | 200 | 7 | provctx); \ | 201 | 7 | } \ | 202 | 7 | return ctx; \ | 203 | 7 | } \ |
Unexecuted instantiation: cipher_aes.c:aes_192_ecb_newctx Unexecuted instantiation: cipher_aes.c:aes_128_ecb_newctx cipher_aes.c:aes_256_cbc_newctx Line | Count | Source | 192 | 631 | static void * alg##_##kbits##_##lcmode##_newctx(void *provctx) \ | 193 | 631 | { \ | 194 | 631 | PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\ | 195 | 631 | : NULL; \ | 196 | 631 | if (ctx != NULL) { \ | 197 | 631 | ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits, \ | 198 | 631 | EVP_CIPH_##UCMODE##_MODE, flags, \ | 199 | 631 | ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\ | 200 | 631 | provctx); \ | 201 | 631 | } \ | 202 | 631 | return ctx; \ | 203 | 631 | } \ |
Unexecuted instantiation: cipher_aes.c:aes_192_cbc_newctx cipher_aes.c:aes_128_cbc_newctx Line | Count | Source | 192 | 91 | static void * alg##_##kbits##_##lcmode##_newctx(void *provctx) \ | 193 | 91 | { \ | 194 | 91 | PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\ | 195 | 91 | : NULL; \ | 196 | 91 | if (ctx != NULL) { \ | 197 | 91 | ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits, \ | 198 | 91 | EVP_CIPH_##UCMODE##_MODE, flags, \ | 199 | 91 | ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\ | 200 | 91 | provctx); \ | 201 | 91 | } \ | 202 | 91 | return ctx; \ | 203 | 91 | } \ |
Unexecuted instantiation: cipher_aes.c:aes_256_ofb_newctx Unexecuted instantiation: cipher_aes.c:aes_192_ofb_newctx Unexecuted instantiation: cipher_aes.c:aes_128_ofb_newctx Unexecuted instantiation: cipher_aes.c:aes_256_cfb_newctx Unexecuted instantiation: cipher_aes.c:aes_192_cfb_newctx Unexecuted instantiation: cipher_aes.c:aes_128_cfb_newctx Unexecuted instantiation: cipher_aes.c:aes_256_cfb1_newctx Unexecuted instantiation: cipher_aes.c:aes_192_cfb1_newctx Unexecuted instantiation: cipher_aes.c:aes_128_cfb1_newctx Unexecuted instantiation: cipher_aes.c:aes_256_cfb8_newctx Unexecuted instantiation: cipher_aes.c:aes_192_cfb8_newctx Unexecuted instantiation: cipher_aes.c:aes_128_cfb8_newctx cipher_aes.c:aes_256_ctr_newctx Line | Count | Source | 192 | 4 | static void * alg##_##kbits##_##lcmode##_newctx(void *provctx) \ | 193 | 4 | { \ | 194 | 4 | PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\ | 195 | 4 | : NULL; \ | 196 | 4 | if (ctx != NULL) { \ | 197 | 4 | ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits, \ | 198 | 4 | EVP_CIPH_##UCMODE##_MODE, flags, \ | 199 | 4 | ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\ | 200 | 4 | provctx); \ | 201 | 4 | } \ | 202 | 4 | return ctx; \ | 203 | 4 | } \ |
Unexecuted instantiation: cipher_aes.c:aes_192_ctr_newctx Unexecuted instantiation: cipher_aes.c:aes_128_ctr_newctx Unexecuted instantiation: cipher_aria.c:aria_256_ecb_newctx Unexecuted instantiation: cipher_aria.c:aria_192_ecb_newctx Unexecuted instantiation: cipher_aria.c:aria_128_ecb_newctx Unexecuted instantiation: cipher_aria.c:aria_256_cbc_newctx Unexecuted instantiation: cipher_aria.c:aria_192_cbc_newctx Unexecuted instantiation: cipher_aria.c:aria_128_cbc_newctx Unexecuted instantiation: cipher_aria.c:aria_256_ofb_newctx Unexecuted instantiation: cipher_aria.c:aria_192_ofb_newctx Unexecuted instantiation: cipher_aria.c:aria_128_ofb_newctx Unexecuted instantiation: cipher_aria.c:aria_256_cfb_newctx Unexecuted instantiation: cipher_aria.c:aria_192_cfb_newctx Unexecuted instantiation: cipher_aria.c:aria_128_cfb_newctx Unexecuted instantiation: cipher_aria.c:aria_256_cfb1_newctx Unexecuted instantiation: cipher_aria.c:aria_192_cfb1_newctx Unexecuted instantiation: cipher_aria.c:aria_128_cfb1_newctx Unexecuted instantiation: cipher_aria.c:aria_256_cfb8_newctx Unexecuted instantiation: cipher_aria.c:aria_192_cfb8_newctx Unexecuted instantiation: cipher_aria.c:aria_128_cfb8_newctx Unexecuted instantiation: cipher_aria.c:aria_256_ctr_newctx Unexecuted instantiation: cipher_aria.c:aria_192_ctr_newctx Unexecuted instantiation: cipher_aria.c:aria_128_ctr_newctx Unexecuted instantiation: cipher_camellia.c:camellia_256_ecb_newctx Unexecuted instantiation: cipher_camellia.c:camellia_192_ecb_newctx Unexecuted instantiation: cipher_camellia.c:camellia_128_ecb_newctx cipher_camellia.c:camellia_256_cbc_newctx Line | Count | Source | 192 | 121 | static void * alg##_##kbits##_##lcmode##_newctx(void *provctx) \ | 193 | 121 | { \ | 194 | 121 | PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\ | 195 | 121 | : NULL; \ | 196 | 121 | if (ctx != NULL) { \ | 197 | 121 | ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits, \ | 198 | 121 | EVP_CIPH_##UCMODE##_MODE, flags, \ | 199 | 121 | ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\ | 200 | 121 | provctx); \ | 201 | 121 | } \ | 202 | 121 | return ctx; \ | 203 | 121 | } \ |
Unexecuted instantiation: cipher_camellia.c:camellia_192_cbc_newctx cipher_camellia.c:camellia_128_cbc_newctx Line | Count | Source | 192 | 249 | static void * alg##_##kbits##_##lcmode##_newctx(void *provctx) \ | 193 | 249 | { \ | 194 | 249 | PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\ | 195 | 249 | : NULL; \ | 196 | 249 | if (ctx != NULL) { \ | 197 | 249 | ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits, \ | 198 | 249 | EVP_CIPH_##UCMODE##_MODE, flags, \ | 199 | 249 | ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\ | 200 | 249 | provctx); \ | 201 | 249 | } \ | 202 | 249 | return ctx; \ | 203 | 249 | } \ |
Unexecuted instantiation: cipher_camellia.c:camellia_256_ofb_newctx Unexecuted instantiation: cipher_camellia.c:camellia_192_ofb_newctx Unexecuted instantiation: cipher_camellia.c:camellia_128_ofb_newctx Unexecuted instantiation: cipher_camellia.c:camellia_256_cfb_newctx Unexecuted instantiation: cipher_camellia.c:camellia_192_cfb_newctx Unexecuted instantiation: cipher_camellia.c:camellia_128_cfb_newctx Unexecuted instantiation: cipher_camellia.c:camellia_256_cfb1_newctx Unexecuted instantiation: cipher_camellia.c:camellia_192_cfb1_newctx Unexecuted instantiation: cipher_camellia.c:camellia_128_cfb1_newctx Unexecuted instantiation: cipher_camellia.c:camellia_256_cfb8_newctx Unexecuted instantiation: cipher_camellia.c:camellia_192_cfb8_newctx Unexecuted instantiation: cipher_camellia.c:camellia_128_cfb8_newctx Unexecuted instantiation: cipher_camellia.c:camellia_256_ctr_newctx Unexecuted instantiation: cipher_camellia.c:camellia_192_ctr_newctx Unexecuted instantiation: cipher_camellia.c:camellia_128_ctr_newctx Unexecuted instantiation: cipher_sm4.c:sm4_128_ecb_newctx Unexecuted instantiation: cipher_sm4.c:sm4_128_cbc_newctx Unexecuted instantiation: cipher_sm4.c:sm4_128_ctr_newctx Unexecuted instantiation: cipher_sm4.c:sm4_128_ofb128_newctx Unexecuted instantiation: cipher_sm4.c:sm4_128_cfb128_newctx |
204 | | |
205 | | #define IMPLEMENT_generic_cipher(alg, UCALG, lcmode, UCMODE, flags, kbits, \ |
206 | | blkbits, ivbits, typ) \ |
207 | | IMPLEMENT_generic_cipher_genfn(alg, UCALG, lcmode, UCMODE, flags, kbits, \ |
208 | | blkbits, ivbits, typ) \ |
209 | | IMPLEMENT_generic_cipher_func(alg, UCALG, lcmode, UCMODE, flags, kbits, \ |
210 | | blkbits, ivbits, typ) |
211 | | |
212 | | #define IMPLEMENT_var_keylen_cipher(alg, UCALG, lcmode, UCMODE, flags, kbits, \ |
213 | | blkbits, ivbits, typ) \ |
214 | | IMPLEMENT_generic_cipher_genfn(alg, UCALG, lcmode, UCMODE, flags, kbits, \ |
215 | | blkbits, ivbits, typ) \ |
216 | | IMPLEMENT_var_keylen_cipher_func(alg, UCALG, lcmode, UCMODE, flags, kbits, \ |
217 | | blkbits, ivbits, typ) |
218 | | |
219 | | PROV_CIPHER_HW_FN ossl_cipher_hw_generic_cbc; |
220 | | PROV_CIPHER_HW_FN ossl_cipher_hw_generic_ecb; |
221 | | PROV_CIPHER_HW_FN ossl_cipher_hw_generic_ofb128; |
222 | | PROV_CIPHER_HW_FN ossl_cipher_hw_generic_cfb128; |
223 | | PROV_CIPHER_HW_FN ossl_cipher_hw_generic_cfb8; |
224 | | PROV_CIPHER_HW_FN ossl_cipher_hw_generic_cfb1; |
225 | | PROV_CIPHER_HW_FN ossl_cipher_hw_generic_ctr; |
226 | | PROV_CIPHER_HW_FN ossl_cipher_hw_chunked_cbc; |
227 | | PROV_CIPHER_HW_FN ossl_cipher_hw_chunked_cfb8; |
228 | | PROV_CIPHER_HW_FN ossl_cipher_hw_chunked_cfb128; |
229 | | PROV_CIPHER_HW_FN ossl_cipher_hw_chunked_ofb128; |
230 | | #define ossl_cipher_hw_chunked_ecb ossl_cipher_hw_generic_ecb |
231 | | #define ossl_cipher_hw_chunked_ctr ossl_cipher_hw_generic_ctr |
232 | | #define ossl_cipher_hw_chunked_cfb1 ossl_cipher_hw_generic_cfb1 |
233 | | |
234 | | #define IMPLEMENT_CIPHER_HW_OFB(MODE, NAME, CTX_NAME, KEY_NAME, FUNC_PREFIX) \ |
235 | | static int cipher_hw_##NAME##_##MODE##_cipher(PROV_CIPHER_CTX *ctx, \ |
236 | | unsigned char *out, \ |
237 | | const unsigned char *in, size_t len) \ |
238 | | { \ |
239 | | int num = ctx->num; \ |
240 | | KEY_NAME *key = &(((CTX_NAME *)ctx)->ks.ks); \ |
241 | | \ |
242 | | while (len >= MAXCHUNK) { \ |
243 | | FUNC_PREFIX##_encrypt(in, out, MAXCHUNK, key, ctx->iv, &num); \ |
244 | | len -= MAXCHUNK; \ |
245 | | in += MAXCHUNK; \ |
246 | | out += MAXCHUNK; \ |
247 | | } \ |
248 | | if (len > 0) { \ |
249 | | FUNC_PREFIX##_encrypt(in, out, (long)len, key, ctx->iv, &num); \ |
250 | | } \ |
251 | | ctx->num = num; \ |
252 | | return 1; \ |
253 | | } |
254 | | |
255 | | #define IMPLEMENT_CIPHER_HW_ECB(MODE, NAME, CTX_NAME, KEY_NAME, FUNC_PREFIX) \ |
256 | | static int cipher_hw_##NAME##_##MODE##_cipher(PROV_CIPHER_CTX *ctx, \ |
257 | | unsigned char *out, \ |
258 | | const unsigned char *in, size_t len) \ |
259 | | { \ |
260 | | size_t i, bl = ctx->blocksize; \ |
261 | | KEY_NAME *key = &(((CTX_NAME *)ctx)->ks.ks); \ |
262 | | \ |
263 | | if (len < bl) \ |
264 | | return 1; \ |
265 | | for (i = 0, len -= bl; i <= len; i += bl) \ |
266 | | FUNC_PREFIX##_encrypt(in + i, out + i, key, ctx->enc); \ |
267 | | return 1; \ |
268 | | } |
269 | | |
270 | | #define IMPLEMENT_CIPHER_HW_CBC(MODE, NAME, CTX_NAME, KEY_NAME, FUNC_PREFIX) \ |
271 | | static int cipher_hw_##NAME##_##MODE##_cipher(PROV_CIPHER_CTX *ctx, \ |
272 | | unsigned char *out, \ |
273 | | const unsigned char *in, size_t len) \ |
274 | | { \ |
275 | | KEY_NAME *key = &(((CTX_NAME *)ctx)->ks.ks); \ |
276 | | \ |
277 | | while (len >= MAXCHUNK) { \ |
278 | | FUNC_PREFIX##_encrypt(in, out, MAXCHUNK, key, ctx->iv, ctx->enc); \ |
279 | | len -= MAXCHUNK; \ |
280 | | in += MAXCHUNK; \ |
281 | | out += MAXCHUNK; \ |
282 | | } \ |
283 | | if (len > 0) \ |
284 | | FUNC_PREFIX##_encrypt(in, out, (long)len, key, ctx->iv, ctx->enc); \ |
285 | | return 1; \ |
286 | | } |
287 | | |
288 | | #define IMPLEMENT_CIPHER_HW_CFB(MODE, NAME, CTX_NAME, KEY_NAME, FUNC_PREFIX) \ |
289 | | static int cipher_hw_##NAME##_##MODE##_cipher(PROV_CIPHER_CTX *ctx, \ |
290 | | unsigned char *out, \ |
291 | | const unsigned char *in, size_t len) \ |
292 | | { \ |
293 | | size_t chunk = MAXCHUNK; \ |
294 | | KEY_NAME *key = &(((CTX_NAME *)ctx)->ks.ks); \ |
295 | | int num = ctx->num; \ |
296 | | \ |
297 | | if (len < chunk) \ |
298 | | chunk = len; \ |
299 | | while (len > 0 && len >= chunk) { \ |
300 | | FUNC_PREFIX##_encrypt(in, out, (long)chunk, key, ctx->iv, &num, \ |
301 | | ctx->enc); \ |
302 | | len -= chunk; \ |
303 | | in += chunk; \ |
304 | | out += chunk; \ |
305 | | if (len < chunk) \ |
306 | | chunk = len; \ |
307 | | } \ |
308 | | ctx->num = num; \ |
309 | | return 1; \ |
310 | | } |
311 | | |
312 | | #define IMPLEMENT_CIPHER_HW_COPYCTX(name, CTX_TYPE) \ |
313 | 0 | static void name(PROV_CIPHER_CTX *dst, const PROV_CIPHER_CTX *src) \ |
314 | 0 | { \ |
315 | 0 | CTX_TYPE *sctx = (CTX_TYPE *)src; \ |
316 | 0 | CTX_TYPE *dctx = (CTX_TYPE *)dst; \ |
317 | 0 | \ |
318 | 0 | *dctx = *sctx; \ |
319 | 0 | dst->ks = &dctx->ks.ks; \ |
320 | 0 | } Unexecuted instantiation: cipher_aes_hw.c:cipher_hw_aes_copyctx Unexecuted instantiation: cipher_aria_hw.c:cipher_hw_aria_copyctx Unexecuted instantiation: cipher_camellia_hw.c:cipher_hw_camellia_copyctx Unexecuted instantiation: cipher_sm4_hw.c:cipher_hw_sm4_copyctx |
321 | | |
322 | | #define CIPHER_DEFAULT_GETTABLE_CTX_PARAMS_START(name) \ |
323 | | static const OSSL_PARAM name##_known_gettable_ctx_params[] = { \ |
324 | | OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_KEYLEN, NULL), \ |
325 | | OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_IVLEN, NULL), \ |
326 | | OSSL_PARAM_uint(OSSL_CIPHER_PARAM_PADDING, NULL), \ |
327 | | OSSL_PARAM_uint(OSSL_CIPHER_PARAM_NUM, NULL), \ |
328 | | OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_IV, NULL, 0), \ |
329 | | OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_UPDATED_IV, NULL, 0), |
330 | | |
331 | | #define CIPHER_DEFAULT_GETTABLE_CTX_PARAMS_END(name) \ |
332 | | OSSL_PARAM_END \ |
333 | | }; \ |
334 | | const OSSL_PARAM * name##_gettable_ctx_params(ossl_unused void *cctx, \ |
335 | 597 | ossl_unused void *provctx) \ |
336 | 597 | { \ |
337 | 597 | return name##_known_gettable_ctx_params; \ |
338 | 597 | } cipher_aes.c:aes_cbc_cts_gettable_ctx_params Line | Count | Source | 335 | 18 | ossl_unused void *provctx) \ | 336 | 18 | { \ | 337 | 18 | return name##_known_gettable_ctx_params; \ | 338 | 18 | } |
cipher_camellia.c:camellia_cbc_cts_gettable_ctx_params Line | Count | Source | 335 | 18 | ossl_unused void *provctx) \ | 336 | 18 | { \ | 337 | 18 | return name##_known_gettable_ctx_params; \ | 338 | 18 | } |
ossl_tdes_gettable_ctx_params Line | Count | Source | 335 | 66 | ossl_unused void *provctx) \ | 336 | 66 | { \ | 337 | 66 | return name##_known_gettable_ctx_params; \ | 338 | 66 | } |
ossl_cipher_generic_gettable_ctx_params Line | Count | Source | 335 | 495 | ossl_unused void *provctx) \ | 336 | 495 | { \ | 337 | 495 | return name##_known_gettable_ctx_params; \ | 338 | 495 | } |
|
339 | | |
340 | | #define CIPHER_DEFAULT_SETTABLE_CTX_PARAMS_START(name) \ |
341 | | static const OSSL_PARAM name##_known_settable_ctx_params[] = { \ |
342 | | OSSL_PARAM_uint(OSSL_CIPHER_PARAM_PADDING, NULL), \ |
343 | | OSSL_PARAM_uint(OSSL_CIPHER_PARAM_NUM, NULL), |
344 | | #define CIPHER_DEFAULT_SETTABLE_CTX_PARAMS_END(name) \ |
345 | | OSSL_PARAM_END \ |
346 | | }; \ |
347 | | const OSSL_PARAM * name##_settable_ctx_params(ossl_unused void *cctx, \ |
348 | 0 | ossl_unused void *provctx) \ |
349 | 0 | { \ |
350 | 0 | return name##_known_settable_ctx_params; \ |
351 | 0 | } Unexecuted instantiation: cipher_aes.c:aes_cbc_cts_settable_ctx_params Unexecuted instantiation: cipher_camellia.c:camellia_cbc_cts_settable_ctx_params Unexecuted instantiation: ossl_cipher_generic_settable_ctx_params Unexecuted instantiation: ossl_cipher_var_keylen_settable_ctx_params |
352 | | |
353 | | int ossl_cipher_generic_initiv(PROV_CIPHER_CTX *ctx, const unsigned char *iv, |
354 | | size_t ivlen); |
355 | | |
356 | | size_t ossl_cipher_fillblock(unsigned char *buf, size_t *buflen, |
357 | | size_t blocksize, |
358 | | const unsigned char **in, size_t *inlen); |
359 | | int ossl_cipher_trailingdata(unsigned char *buf, size_t *buflen, |
360 | | size_t blocksize, |
361 | | const unsigned char **in, size_t *inlen); |