Coverage Report

Created: 2025-08-11 07:04

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