Coverage Report

Created: 2025-06-13 06:58

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