Coverage Report

Created: 2023-09-25 06:45

/src/openssl30/providers/implementations/include/prov/ciphercommon_aead.h
Line
Count
Source
1
/*
2
 * Copyright 2019-2021 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
113k
#define UNINITIALISED_SIZET ((size_t)-1)
11
12
#define AEAD_FLAGS (PROV_CIPHER_FLAG_AEAD | PROV_CIPHER_FLAG_CUSTOM_IV)
13
14
#define IMPLEMENT_aead_cipher(alg, lc, UCMODE, flags, kbits, blkbits, ivbits)  \
15
static OSSL_FUNC_cipher_get_params_fn alg##_##kbits##_##lc##_get_params;       \
16
72
static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
17
72
{                                                                              \
18
72
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
19
72
                                          flags, kbits, blkbits, ivbits);      \
20
72
}                                                                              \
cipher_aes_ccm.c:aes_128_ccm_get_params
Line
Count
Source
16
6
static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
17
6
{                                                                              \
18
6
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
19
6
                                          flags, kbits, blkbits, ivbits);      \
20
6
}                                                                              \
cipher_aes_ccm.c:aes_192_ccm_get_params
Line
Count
Source
16
6
static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
17
6
{                                                                              \
18
6
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
19
6
                                          flags, kbits, blkbits, ivbits);      \
20
6
}                                                                              \
cipher_aes_ccm.c:aes_256_ccm_get_params
Line
Count
Source
16
6
static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
17
6
{                                                                              \
18
6
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
19
6
                                          flags, kbits, blkbits, ivbits);      \
20
6
}                                                                              \
cipher_aes_gcm.c:aes_128_gcm_get_params
Line
Count
Source
16
6
static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
17
6
{                                                                              \
18
6
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
19
6
                                          flags, kbits, blkbits, ivbits);      \
20
6
}                                                                              \
cipher_aes_gcm.c:aes_192_gcm_get_params
Line
Count
Source
16
6
static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
17
6
{                                                                              \
18
6
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
19
6
                                          flags, kbits, blkbits, ivbits);      \
20
6
}                                                                              \
cipher_aes_gcm.c:aes_256_gcm_get_params
Line
Count
Source
16
6
static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
17
6
{                                                                              \
18
6
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
19
6
                                          flags, kbits, blkbits, ivbits);      \
20
6
}                                                                              \
cipher_aria_ccm.c:aria_128_ccm_get_params
Line
Count
Source
16
6
static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
17
6
{                                                                              \
18
6
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
19
6
                                          flags, kbits, blkbits, ivbits);      \
20
6
}                                                                              \
cipher_aria_ccm.c:aria_192_ccm_get_params
Line
Count
Source
16
6
static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
17
6
{                                                                              \
18
6
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
19
6
                                          flags, kbits, blkbits, ivbits);      \
20
6
}                                                                              \
cipher_aria_ccm.c:aria_256_ccm_get_params
Line
Count
Source
16
6
static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
17
6
{                                                                              \
18
6
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
19
6
                                          flags, kbits, blkbits, ivbits);      \
20
6
}                                                                              \
cipher_aria_gcm.c:aria_128_gcm_get_params
Line
Count
Source
16
6
static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
17
6
{                                                                              \
18
6
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
19
6
                                          flags, kbits, blkbits, ivbits);      \
20
6
}                                                                              \
cipher_aria_gcm.c:aria_192_gcm_get_params
Line
Count
Source
16
6
static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
17
6
{                                                                              \
18
6
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
19
6
                                          flags, kbits, blkbits, ivbits);      \
20
6
}                                                                              \
cipher_aria_gcm.c:aria_256_gcm_get_params
Line
Count
Source
16
6
static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
17
6
{                                                                              \
18
6
    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
19
6
                                          flags, kbits, blkbits, ivbits);      \
20
6
}                                                                              \
21
static OSSL_FUNC_cipher_newctx_fn alg##kbits##lc##_newctx;                     \
22
2.50k
static void * alg##kbits##lc##_newctx(void *provctx)                           \
23
2.50k
{                                                                              \
24
2.50k
    return alg##_##lc##_newctx(provctx, kbits);                                \
25
2.50k
}                                                                              \
cipher_aes_ccm.c:aes128ccm_newctx
Line
Count
Source
22
104
static void * alg##kbits##lc##_newctx(void *provctx)                           \
23
104
{                                                                              \
24
104
    return alg##_##lc##_newctx(provctx, kbits);                                \
25
104
}                                                                              \
Unexecuted instantiation: cipher_aes_ccm.c:aes192ccm_newctx
cipher_aes_ccm.c:aes256ccm_newctx
Line
Count
Source
22
62
static void * alg##kbits##lc##_newctx(void *provctx)                           \
23
62
{                                                                              \
24
62
    return alg##_##lc##_newctx(provctx, kbits);                                \
25
62
}                                                                              \
cipher_aes_gcm.c:aes128gcm_newctx
Line
Count
Source
22
1.45k
static void * alg##kbits##lc##_newctx(void *provctx)                           \
23
1.45k
{                                                                              \
24
1.45k
    return alg##_##lc##_newctx(provctx, kbits);                                \
25
1.45k
}                                                                              \
Unexecuted instantiation: cipher_aes_gcm.c:aes192gcm_newctx
cipher_aes_gcm.c:aes256gcm_newctx
Line
Count
Source
22
514
static void * alg##kbits##lc##_newctx(void *provctx)                           \
23
514
{                                                                              \
24
514
    return alg##_##lc##_newctx(provctx, kbits);                                \
25
514
}                                                                              \
Unexecuted instantiation: cipher_aria_ccm.c:aria128ccm_newctx
Unexecuted instantiation: cipher_aria_ccm.c:aria192ccm_newctx
Unexecuted instantiation: cipher_aria_ccm.c:aria256ccm_newctx
cipher_aria_gcm.c:aria128gcm_newctx
Line
Count
Source
22
200
static void * alg##kbits##lc##_newctx(void *provctx)                           \
23
200
{                                                                              \
24
200
    return alg##_##lc##_newctx(provctx, kbits);                                \
25
200
}                                                                              \
Unexecuted instantiation: cipher_aria_gcm.c:aria192gcm_newctx
cipher_aria_gcm.c:aria256gcm_newctx
Line
Count
Source
22
166
static void * alg##kbits##lc##_newctx(void *provctx)                           \
23
166
{                                                                              \
24
166
    return alg##_##lc##_newctx(provctx, kbits);                                \
25
166
}                                                                              \
26
const OSSL_DISPATCH ossl_##alg##kbits##lc##_functions[] = {                    \
27
    { OSSL_FUNC_CIPHER_NEWCTX, (void (*)(void))alg##kbits##lc##_newctx },      \
28
    { OSSL_FUNC_CIPHER_FREECTX, (void (*)(void))alg##_##lc##_freectx },        \
29
    { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))ossl_##lc##_einit },      \
30
    { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))ossl_##lc##_dinit },      \
31
    { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))ossl_##lc##_stream_update },    \
32
    { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))ossl_##lc##_stream_final },      \
33
    { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))ossl_##lc##_cipher },           \
34
    { OSSL_FUNC_CIPHER_GET_PARAMS,                                             \
35
      (void (*)(void)) alg##_##kbits##_##lc##_get_params },                    \
36
    { OSSL_FUNC_CIPHER_GET_CTX_PARAMS,                                         \
37
      (void (*)(void)) ossl_##lc##_get_ctx_params },                           \
38
    { OSSL_FUNC_CIPHER_SET_CTX_PARAMS,                                         \
39
      (void (*)(void)) ossl_##lc##_set_ctx_params },                           \
40
    { OSSL_FUNC_CIPHER_GETTABLE_PARAMS,                                        \
41
      (void (*)(void))ossl_cipher_generic_gettable_params },                   \
42
    { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS,                                    \
43
      (void (*)(void))ossl_cipher_aead_gettable_ctx_params },                  \
44
    { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS,                                    \
45
      (void (*)(void))ossl_cipher_aead_settable_ctx_params },                  \
46
    { 0, NULL }                                                                \
47
}