Coverage Report

Created: 2025-08-11 07:04

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