Coverage Report

Created: 2026-05-20 07:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl/providers/implementations/ciphers/cipher_cts.h
Line
Count
Source
1
/*
2
 * Copyright 2020-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
#if !defined(OSSL_PROVIDERS_IMPLEMENTATIONS_CIPHERS_CIPHER_CTS_H)
11
#define OSSL_PROVIDERS_IMPLEMENTATIONS_CIPHERS_CIPHER_CTS_H
12
13
#include "crypto/evp.h"
14
15
/* NOTE: The underlying block cipher is CBC so we reuse most of the code */
16
#define IMPLEMENT_cts_cipher(alg, UCALG, lcmode, UCMODE, flags, kbits,           \
17
    blkbits, ivbits, typ)                                                        \
18
    static OSSL_FUNC_cipher_get_params_fn alg##_##kbits##_##lcmode##_get_params; \
19
    static int alg##_cts_##kbits##_##lcmode##_get_params(OSSL_PARAM params[])    \
20
96
    {                                                                            \
21
96
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,  \
22
96
            flags, kbits, blkbits, ivbits);                                      \
23
96
    }                                                                            \
cipher_aes.c:aes_cts_256_cbc_get_params
Line
Count
Source
20
16
    {                                                                            \
21
16
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,  \
22
16
            flags, kbits, blkbits, ivbits);                                      \
23
16
    }                                                                            \
cipher_aes.c:aes_cts_192_cbc_get_params
Line
Count
Source
20
16
    {                                                                            \
21
16
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,  \
22
16
            flags, kbits, blkbits, ivbits);                                      \
23
16
    }                                                                            \
cipher_aes.c:aes_cts_128_cbc_get_params
Line
Count
Source
20
16
    {                                                                            \
21
16
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,  \
22
16
            flags, kbits, blkbits, ivbits);                                      \
23
16
    }                                                                            \
cipher_camellia.c:camellia_cts_256_cbc_get_params
Line
Count
Source
20
16
    {                                                                            \
21
16
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,  \
22
16
            flags, kbits, blkbits, ivbits);                                      \
23
16
    }                                                                            \
cipher_camellia.c:camellia_cts_192_cbc_get_params
Line
Count
Source
20
16
    {                                                                            \
21
16
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,  \
22
16
            flags, kbits, blkbits, ivbits);                                      \
23
16
    }                                                                            \
cipher_camellia.c:camellia_cts_128_cbc_get_params
Line
Count
Source
20
16
    {                                                                            \
21
16
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,  \
22
16
            flags, kbits, blkbits, ivbits);                                      \
23
16
    }                                                                            \
24
    const OSSL_DISPATCH ossl_##alg##kbits##lcmode##_cts_functions[] = {          \
25
        { OSSL_FUNC_CIPHER_NEWCTX,                                               \
26
            (void (*)(void))alg##_##kbits##_##lcmode##_newctx },                 \
27
        { OSSL_FUNC_CIPHER_FREECTX, (void (*)(void))alg##_freectx },             \
28
        { OSSL_FUNC_CIPHER_DUPCTX, (void (*)(void))alg##_dupctx },               \
29
        { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))alg##_cbc_cts_einit },  \
30
        { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))alg##_cbc_cts_dinit },  \
31
        { OSSL_FUNC_CIPHER_UPDATE,                                               \
32
            (void (*)(void))ossl_cipher_cbc_cts_block_update },                  \
33
        { OSSL_FUNC_CIPHER_FINAL,                                                \
34
            (void (*)(void))ossl_cipher_cbc_cts_block_final },                   \
35
        { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))ossl_cipher_generic_cipher }, \
36
        { OSSL_FUNC_CIPHER_GET_PARAMS,                                           \
37
            (void (*)(void))alg##_cts_##kbits##_##lcmode##_get_params },         \
38
        { OSSL_FUNC_CIPHER_GETTABLE_PARAMS,                                      \
39
            (void (*)(void))ossl_cipher_generic_gettable_params },               \
40
        { OSSL_FUNC_CIPHER_GET_CTX_PARAMS,                                       \
41
            (void (*)(void))alg##_cbc_cts_get_ctx_params },                      \
42
        { OSSL_FUNC_CIPHER_SET_CTX_PARAMS,                                       \
43
            (void (*)(void))alg##_cbc_cts_set_ctx_params },                      \
44
        { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS,                                  \
45
            (void (*)(void))alg##_cbc_cts_gettable_ctx_params },                 \
46
        { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS,                                  \
47
            (void (*)(void))alg##_cbc_cts_settable_ctx_params },                 \
48
        OSSL_DISPATCH_END                                                        \
49
    };
50
51
OSSL_FUNC_cipher_update_fn ossl_cipher_cbc_cts_block_update;
52
OSSL_FUNC_cipher_final_fn ossl_cipher_cbc_cts_block_final;
53
54
const char *ossl_cipher_cbc_cts_mode_id2name(unsigned int id);
55
int ossl_cipher_cbc_cts_mode_name2id(const char *name);
56
57
#endif /* !defined(OSSL_PROVIDERS_IMPLEMENTATIONS_CIPHERS_CIPHER_CTS_H) */