Coverage Report

Created: 2025-06-13 06:58

/src/openssl31/providers/implementations/include/prov/ciphercommon.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
3
 *
4
 * Licensed under the Apache License 2.0 (the "License").  You may not use
5
 * this file except in compliance with the License.  You can obtain a copy
6
 * in the file LICENSE in the source distribution or at
7
 * https://www.openssl.org/source/license.html
8
 */
9
10
#include <openssl/params.h>
11
#include <openssl/core_dispatch.h>
12
#include <openssl/core_names.h>
13
#include <openssl/evp.h>
14
#include "internal/cryptlib.h"
15
#include "crypto/modes.h"
16
17
21.5k
# define MAXCHUNK    ((size_t)1 << 30)
18
0
# define MAXBITCHUNK ((size_t)1 << (sizeof(size_t) * 8 - 4))
19
20
#define GENERIC_BLOCK_SIZE 16
21
5.23M
#define IV_STATE_UNINITIALISED 0  /* initial state is not initialized */
22
6.83M
#define IV_STATE_BUFFERED      1  /* iv has been copied to the iv buffer */
23
1.50M
#define IV_STATE_COPIED        2  /* iv has been copied from the iv buffer */
24
6.13M
#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
37.1k
#define PROV_CIPHER_FLAG_AEAD             0x0001
36
43.6k
#define PROV_CIPHER_FLAG_CUSTOM_IV        0x0002
37
1.27k
#define PROV_CIPHER_FLAG_CTS              0x0004
38
1.27k
#define PROV_CIPHER_FLAG_TLS1_MULTIBLOCK  0x0008
39
1.27k
#define PROV_CIPHER_FLAG_RAND_KEY         0x0010
40
/* Internal flags that are only used within the provider */
41
107k
#define PROV_CIPHER_FLAG_VARIABLE_LENGTH  0x0100
42
107k
#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
125k
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
125k
{                                                                              \
190
125k
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
125k
                                          flags, kbits, blkbits, ivbits);      \
192
125k
}                                                                              \
cipher_aes.c:aes_256_ecb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_192_ecb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_128_ecb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_256_cbc_get_params
Line
Count
Source
188
31.0k
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
31.0k
{                                                                              \
190
31.0k
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
31.0k
                                          flags, kbits, blkbits, ivbits);      \
192
31.0k
}                                                                              \
cipher_aes.c:aes_192_cbc_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_128_cbc_get_params
Line
Count
Source
188
31.0k
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
31.0k
{                                                                              \
190
31.0k
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
31.0k
                                          flags, kbits, blkbits, ivbits);      \
192
31.0k
}                                                                              \
cipher_aes.c:aes_256_ofb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_192_ofb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_128_ofb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_256_cfb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_192_cfb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_128_cfb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_256_cfb1_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_192_cfb1_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_128_cfb1_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_256_cfb8_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_192_cfb8_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_128_cfb8_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_256_ctr_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_192_ctr_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aes.c:aes_128_ctr_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_256_ecb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_192_ecb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_128_ecb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_256_cbc_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_192_cbc_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_128_cbc_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_256_ofb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_192_ofb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_128_ofb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_256_cfb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_192_cfb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_128_cfb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_256_cfb1_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_192_cfb1_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_128_cfb1_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_256_cfb8_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_192_cfb8_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_128_cfb8_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_256_ctr_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_192_ctr_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_aria.c:aria_128_ctr_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_256_ecb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_192_ecb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_128_ecb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_256_cbc_get_params
Line
Count
Source
188
31.0k
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
31.0k
{                                                                              \
190
31.0k
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
31.0k
                                          flags, kbits, blkbits, ivbits);      \
192
31.0k
}                                                                              \
cipher_camellia.c:camellia_192_cbc_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_128_cbc_get_params
Line
Count
Source
188
31.0k
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
31.0k
{                                                                              \
190
31.0k
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
31.0k
                                          flags, kbits, blkbits, ivbits);      \
192
31.0k
}                                                                              \
cipher_camellia.c:camellia_256_ofb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_192_ofb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_128_ofb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_256_cfb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_192_cfb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_128_cfb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_256_cfb1_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_192_cfb1_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_128_cfb1_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_256_cfb8_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_192_cfb8_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_128_cfb8_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_256_ctr_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_192_ctr_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_camellia.c:camellia_128_ctr_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_sm4.c:sm4_128_ecb_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_sm4.c:sm4_128_cbc_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_sm4.c:sm4_128_ctr_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_sm4.c:sm4_128_ofb128_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
cipher_sm4.c:sm4_128_cfb128_get_params
Line
Count
Source
188
25
static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])          \
189
25
{                                                                              \
190
25
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
191
25
                                          flags, kbits, blkbits, ivbits);      \
192
25
}                                                                              \
193
static OSSL_FUNC_cipher_newctx_fn alg##_##kbits##_##lcmode##_newctx;           \
194
92.2k
static void * alg##_##kbits##_##lcmode##_newctx(void *provctx)                 \
195
92.2k
{                                                                              \
196
92.2k
     PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\
197
92.2k
                                                     : NULL;                   \
198
92.2k
     if (ctx != NULL) {                                                        \
199
92.2k
         ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits,              \
200
92.2k
                                     EVP_CIPH_##UCMODE##_MODE, flags,          \
201
92.2k
                                     ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\
202
92.2k
                                     provctx);                                 \
203
92.2k
     }                                                                         \
204
92.2k
     return ctx;                                                               \
205
92.2k
}                                                                              \
cipher_aes.c:aes_256_ecb_newctx
Line
Count
Source
194
30.3k
static void * alg##_##kbits##_##lcmode##_newctx(void *provctx)                 \
195
30.3k
{                                                                              \
196
30.3k
     PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\
197
30.3k
                                                     : NULL;                   \
198
30.3k
     if (ctx != NULL) {                                                        \
199
30.3k
         ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits,              \
200
30.3k
                                     EVP_CIPH_##UCMODE##_MODE, flags,          \
201
30.3k
                                     ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\
202
30.3k
                                     provctx);                                 \
203
30.3k
     }                                                                         \
204
30.3k
     return ctx;                                                               \
205
30.3k
}                                                                              \
Unexecuted instantiation: cipher_aes.c:aes_192_ecb_newctx
cipher_aes.c:aes_128_ecb_newctx
Line
Count
Source
194
58.7k
static void * alg##_##kbits##_##lcmode##_newctx(void *provctx)                 \
195
58.7k
{                                                                              \
196
58.7k
     PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\
197
58.7k
                                                     : NULL;                   \
198
58.7k
     if (ctx != NULL) {                                                        \
199
58.7k
         ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits,              \
200
58.7k
                                     EVP_CIPH_##UCMODE##_MODE, flags,          \
201
58.7k
                                     ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\
202
58.7k
                                     provctx);                                 \
203
58.7k
     }                                                                         \
204
58.7k
     return ctx;                                                               \
205
58.7k
}                                                                              \
cipher_aes.c:aes_256_cbc_newctx
Line
Count
Source
194
2.01k
static void * alg##_##kbits##_##lcmode##_newctx(void *provctx)                 \
195
2.01k
{                                                                              \
196
2.01k
     PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\
197
2.01k
                                                     : NULL;                   \
198
2.01k
     if (ctx != NULL) {                                                        \
199
2.01k
         ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits,              \
200
2.01k
                                     EVP_CIPH_##UCMODE##_MODE, flags,          \
201
2.01k
                                     ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\
202
2.01k
                                     provctx);                                 \
203
2.01k
     }                                                                         \
204
2.01k
     return ctx;                                                               \
205
2.01k
}                                                                              \
cipher_aes.c:aes_192_cbc_newctx
Line
Count
Source
194
4
static void * alg##_##kbits##_##lcmode##_newctx(void *provctx)                 \
195
4
{                                                                              \
196
4
     PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\
197
4
                                                     : NULL;                   \
198
4
     if (ctx != NULL) {                                                        \
199
4
         ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits,              \
200
4
                                     EVP_CIPH_##UCMODE##_MODE, flags,          \
201
4
                                     ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\
202
4
                                     provctx);                                 \
203
4
     }                                                                         \
204
4
     return ctx;                                                               \
205
4
}                                                                              \
cipher_aes.c:aes_128_cbc_newctx
Line
Count
Source
194
188
static void * alg##_##kbits##_##lcmode##_newctx(void *provctx)                 \
195
188
{                                                                              \
196
188
     PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\
197
188
                                                     : NULL;                   \
198
188
     if (ctx != NULL) {                                                        \
199
188
         ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits,              \
200
188
                                     EVP_CIPH_##UCMODE##_MODE, flags,          \
201
188
                                     ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\
202
188
                                     provctx);                                 \
203
188
     }                                                                         \
204
188
     return ctx;                                                               \
205
188
}                                                                              \
Unexecuted instantiation: cipher_aes.c:aes_256_ofb_newctx
Unexecuted instantiation: cipher_aes.c:aes_192_ofb_newctx
Unexecuted instantiation: cipher_aes.c:aes_128_ofb_newctx
Unexecuted instantiation: cipher_aes.c:aes_256_cfb_newctx
Unexecuted instantiation: cipher_aes.c:aes_192_cfb_newctx
Unexecuted instantiation: cipher_aes.c:aes_128_cfb_newctx
Unexecuted instantiation: cipher_aes.c:aes_256_cfb1_newctx
Unexecuted instantiation: cipher_aes.c:aes_192_cfb1_newctx
Unexecuted instantiation: cipher_aes.c:aes_128_cfb1_newctx
Unexecuted instantiation: cipher_aes.c:aes_256_cfb8_newctx
Unexecuted instantiation: cipher_aes.c:aes_192_cfb8_newctx
Unexecuted instantiation: cipher_aes.c:aes_128_cfb8_newctx
cipher_aes.c:aes_256_ctr_newctx
Line
Count
Source
194
17
static void * alg##_##kbits##_##lcmode##_newctx(void *provctx)                 \
195
17
{                                                                              \
196
17
     PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\
197
17
                                                     : NULL;                   \
198
17
     if (ctx != NULL) {                                                        \
199
17
         ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits,              \
200
17
                                     EVP_CIPH_##UCMODE##_MODE, flags,          \
201
17
                                     ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\
202
17
                                     provctx);                                 \
203
17
     }                                                                         \
204
17
     return ctx;                                                               \
205
17
}                                                                              \
Unexecuted instantiation: cipher_aes.c:aes_192_ctr_newctx
Unexecuted instantiation: cipher_aes.c:aes_128_ctr_newctx
Unexecuted instantiation: cipher_aria.c:aria_256_ecb_newctx
Unexecuted instantiation: cipher_aria.c:aria_192_ecb_newctx
Unexecuted instantiation: cipher_aria.c:aria_128_ecb_newctx
cipher_aria.c:aria_256_cbc_newctx
Line
Count
Source
194
43
static void * alg##_##kbits##_##lcmode##_newctx(void *provctx)                 \
195
43
{                                                                              \
196
43
     PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\
197
43
                                                     : NULL;                   \
198
43
     if (ctx != NULL) {                                                        \
199
43
         ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits,              \
200
43
                                     EVP_CIPH_##UCMODE##_MODE, flags,          \
201
43
                                     ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\
202
43
                                     provctx);                                 \
203
43
     }                                                                         \
204
43
     return ctx;                                                               \
205
43
}                                                                              \
cipher_aria.c:aria_192_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_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
}                                                                              \
Unexecuted instantiation: cipher_aria.c:aria_256_ofb_newctx
Unexecuted instantiation: cipher_aria.c:aria_192_ofb_newctx
Unexecuted instantiation: cipher_aria.c:aria_128_ofb_newctx
Unexecuted instantiation: cipher_aria.c:aria_256_cfb_newctx
Unexecuted instantiation: cipher_aria.c:aria_192_cfb_newctx
Unexecuted instantiation: cipher_aria.c:aria_128_cfb_newctx
Unexecuted instantiation: cipher_aria.c:aria_256_cfb1_newctx
Unexecuted instantiation: cipher_aria.c:aria_192_cfb1_newctx
Unexecuted instantiation: cipher_aria.c:aria_128_cfb1_newctx
Unexecuted instantiation: cipher_aria.c:aria_256_cfb8_newctx
Unexecuted instantiation: cipher_aria.c:aria_192_cfb8_newctx
Unexecuted instantiation: cipher_aria.c:aria_128_cfb8_newctx
Unexecuted instantiation: cipher_aria.c:aria_256_ctr_newctx
Unexecuted instantiation: cipher_aria.c:aria_192_ctr_newctx
Unexecuted instantiation: cipher_aria.c:aria_128_ctr_newctx
Unexecuted instantiation: cipher_camellia.c:camellia_256_ecb_newctx
Unexecuted instantiation: cipher_camellia.c:camellia_192_ecb_newctx
Unexecuted instantiation: cipher_camellia.c:camellia_128_ecb_newctx
cipher_camellia.c:camellia_256_cbc_newctx
Line
Count
Source
194
215
static void * alg##_##kbits##_##lcmode##_newctx(void *provctx)                 \
195
215
{                                                                              \
196
215
     PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\
197
215
                                                     : NULL;                   \
198
215
     if (ctx != NULL) {                                                        \
199
215
         ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits,              \
200
215
                                     EVP_CIPH_##UCMODE##_MODE, flags,          \
201
215
                                     ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\
202
215
                                     provctx);                                 \
203
215
     }                                                                         \
204
215
     return ctx;                                                               \
205
215
}                                                                              \
Unexecuted instantiation: cipher_camellia.c:camellia_192_cbc_newctx
cipher_camellia.c:camellia_128_cbc_newctx
Line
Count
Source
194
662
static void * alg##_##kbits##_##lcmode##_newctx(void *provctx)                 \
195
662
{                                                                              \
196
662
     PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\
197
662
                                                     : NULL;                   \
198
662
     if (ctx != NULL) {                                                        \
199
662
         ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits,              \
200
662
                                     EVP_CIPH_##UCMODE##_MODE, flags,          \
201
662
                                     ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\
202
662
                                     provctx);                                 \
203
662
     }                                                                         \
204
662
     return ctx;                                                               \
205
662
}                                                                              \
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
6
static void * alg##_##kbits##_##lcmode##_newctx(void *provctx)                 \
195
6
{                                                                              \
196
6
     PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\
197
6
                                                     : NULL;                   \
198
6
     if (ctx != NULL) {                                                        \
199
6
         ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits,              \
200
6
                                     EVP_CIPH_##UCMODE##_MODE, flags,          \
201
6
                                     ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\
202
6
                                     provctx);                                 \
203
6
     }                                                                         \
204
6
     return ctx;                                                               \
205
6
}                                                                              \
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
2.49k
                                              ossl_unused void *provctx)       \
338
2.49k
{                                                                              \
339
2.49k
    return name##_known_gettable_ctx_params;                                   \
340
2.49k
}
cipher_aes.c:aes_cbc_cts_gettable_ctx_params
Line
Count
Source
337
75
                                              ossl_unused void *provctx)       \
338
75
{                                                                              \
339
75
    return name##_known_gettable_ctx_params;                                   \
340
75
}
cipher_camellia.c:camellia_cbc_cts_gettable_ctx_params
Line
Count
Source
337
75
                                              ossl_unused void *provctx)       \
338
75
{                                                                              \
339
75
    return name##_known_gettable_ctx_params;                                   \
340
75
}
ossl_tdes_gettable_ctx_params
Line
Count
Source
337
275
                                              ossl_unused void *provctx)       \
338
275
{                                                                              \
339
275
    return name##_known_gettable_ctx_params;                                   \
340
275
}
ossl_cipher_generic_gettable_ctx_params
Line
Count
Source
337
2.06k
                                              ossl_unused void *provctx)       \
338
2.06k
{                                                                              \
339
2.06k
    return name##_known_gettable_ctx_params;                                   \
340
2.06k
}
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
34
                                              ossl_unused void *provctx)       \
351
34
{                                                                              \
352
34
    return name##_known_settable_ctx_params;                                   \
353
34
}
cipher_aes.c:aes_cbc_cts_settable_ctx_params
Line
Count
Source
350
1
                                              ossl_unused void *provctx)       \
351
1
{                                                                              \
352
1
    return name##_known_settable_ctx_params;                                   \
353
1
}
cipher_camellia.c:camellia_cbc_cts_settable_ctx_params
Line
Count
Source
350
1
                                              ossl_unused void *provctx)       \
351
1
{                                                                              \
352
1
    return name##_known_settable_ctx_params;                                   \
353
1
}
ossl_cipher_generic_settable_ctx_params
Line
Count
Source
350
32
                                              ossl_unused void *provctx)       \
351
32
{                                                                              \
352
32
    return name##_known_settable_ctx_params;                                   \
353
32
}
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);