Coverage Report

Created: 2025-10-28 06:56

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl/providers/implementations/ciphers/cipher_chacha20.inc
Line
Count
Source
1
/*
2
 * Copyright 2025 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
11
12
/* Machine generated by util/perl/OpenSSL/paramnames.pm */
13
#ifndef chacha20_get_ctx_params_list
14
static const OSSL_PARAM chacha20_get_ctx_params_list[] = {
15
    OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_KEYLEN, NULL),
16
    OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_IVLEN, NULL),
17
    OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_UPDATED_IV, NULL, 0),
18
    OSSL_PARAM_END
19
};
20
#endif
21
22
#ifndef chacha20_get_ctx_params_st
23
struct chacha20_get_ctx_params_st {
24
    OSSL_PARAM *ivlen;
25
    OSSL_PARAM *keylen;
26
    OSSL_PARAM *upd_iv;
27
};
28
#endif
29
30
#ifndef chacha20_get_ctx_params_decoder
31
static int chacha20_get_ctx_params_decoder
32
    (const OSSL_PARAM *p, struct chacha20_get_ctx_params_st *r)
33
0
{
34
0
    const char *s;
35
36
0
    memset(r, 0, sizeof(*r));
37
0
    if (p != NULL)
38
0
        for (; (s = p->key) != NULL; p++)
39
0
            switch(s[0]) {
40
0
            default:
41
0
                break;
42
0
            case 'i':
43
0
                if (ossl_likely(strcmp("vlen", s + 1) == 0)) {
44
                    /* OSSL_CIPHER_PARAM_IVLEN */
45
0
                    if (ossl_unlikely(r->ivlen != NULL)) {
46
0
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
47
0
                                       "param %s is repeated", s);
48
0
                        return 0;
49
0
                    }
50
0
                    r->ivlen = (OSSL_PARAM *)p;
51
0
                }
52
0
                break;
53
0
            case 'k':
54
0
                if (ossl_likely(strcmp("eylen", s + 1) == 0)) {
55
                    /* OSSL_CIPHER_PARAM_KEYLEN */
56
0
                    if (ossl_unlikely(r->keylen != NULL)) {
57
0
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
58
0
                                       "param %s is repeated", s);
59
0
                        return 0;
60
0
                    }
61
0
                    r->keylen = (OSSL_PARAM *)p;
62
0
                }
63
0
                break;
64
0
            case 'u':
65
0
                if (ossl_likely(strcmp("pdated-iv", s + 1) == 0)) {
66
                    /* OSSL_CIPHER_PARAM_UPDATED_IV */
67
0
                    if (ossl_unlikely(r->upd_iv != NULL)) {
68
0
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
69
0
                                       "param %s is repeated", s);
70
0
                        return 0;
71
0
                    }
72
0
                    r->upd_iv = (OSSL_PARAM *)p;
73
0
                }
74
0
            }
75
0
    return 1;
76
0
}
77
#endif
78
/* End of machine generated */
79
80
/* Machine generated by util/perl/OpenSSL/paramnames.pm */
81
#ifndef chacha20_set_ctx_params_list
82
static const OSSL_PARAM chacha20_set_ctx_params_list[] = {
83
    OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_KEYLEN, NULL),
84
    OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_IVLEN, NULL),
85
    OSSL_PARAM_END
86
};
87
#endif
88
89
#ifndef chacha20_set_ctx_params_st
90
struct chacha20_set_ctx_params_st {
91
    OSSL_PARAM *ivlen;
92
    OSSL_PARAM *keylen;
93
};
94
#endif
95
96
#ifndef chacha20_set_ctx_params_decoder
97
static int chacha20_set_ctx_params_decoder
98
    (const OSSL_PARAM *p, struct chacha20_set_ctx_params_st *r)
99
0
{
100
0
    const char *s;
101
102
0
    memset(r, 0, sizeof(*r));
103
0
    if (p != NULL)
104
0
        for (; (s = p->key) != NULL; p++)
105
0
            switch(s[0]) {
106
0
            default:
107
0
                break;
108
0
            case 'i':
109
0
                if (ossl_likely(strcmp("vlen", s + 1) == 0)) {
110
                    /* OSSL_CIPHER_PARAM_IVLEN */
111
0
                    if (ossl_unlikely(r->ivlen != NULL)) {
112
0
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
113
0
                                       "param %s is repeated", s);
114
0
                        return 0;
115
0
                    }
116
0
                    r->ivlen = (OSSL_PARAM *)p;
117
0
                }
118
0
                break;
119
0
            case 'k':
120
0
                if (ossl_likely(strcmp("eylen", s + 1) == 0)) {
121
                    /* OSSL_CIPHER_PARAM_KEYLEN */
122
0
                    if (ossl_unlikely(r->keylen != NULL)) {
123
0
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
124
0
                                       "param %s is repeated", s);
125
0
                        return 0;
126
0
                    }
127
0
                    r->keylen = (OSSL_PARAM *)p;
128
0
                }
129
0
            }
130
0
    return 1;
131
0
}
132
#endif
133
/* End of machine generated */