Coverage Report

Created: 2026-10-28 06:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl41/providers/implementations/ciphers/cipher_cts.inc
Line
Count
Source
1
/*
2
 * Copyright 2026 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
#include <string.h>
14
#include <openssl/params.h>
15
#include <openssl/e_os2.h>
16
#include "internal/common.h"
17
#include "prov/proverr.h"
18
19
/* Machine generated */
20
#ifndef cipher_cts_get_ctx_params_list
21
static ossl_unused const OSSL_PARAM cipher_cts_get_ctx_params_list[] = {
22
    OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_KEYLEN, NULL),
23
    OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_IVLEN, NULL),
24
    OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_IV, NULL, 0),
25
    OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_UPDATED_IV, NULL, 0),
26
    OSSL_PARAM_utf8_string(OSSL_CIPHER_PARAM_CTS_MODE, NULL, 0),
27
# if defined(FIPS_MODULE)
28
    OSSL_PARAM_int(OSSL_CIPHER_PARAM_FIPS_APPROVED_INDICATOR, NULL),
29
# endif
30
    OSSL_PARAM_END
31
};
32
#endif
33
34
#ifndef cipher_cts_get_ctx_params_st
35
struct cipher_cts_get_ctx_params_st {
36
    OSSL_PARAM *common.iv;
37
    OSSL_PARAM *common.ivlen;
38
    OSSL_PARAM *common.keylen;
39
    OSSL_PARAM *common.updiv;
40
    OSSL_PARAM *mode;
41
};
42
#endif
43
44
#ifndef cipher_cts_get_ctx_params_decoder
45
static ossl_unused int cipher_cts_get_ctx_params_decoder
46
    (const OSSL_PARAM *p, struct cipher_cts_get_ctx_params_st *r)
47
70
{
48
70
    const char *s;
49
50
70
    memset(r, 0, sizeof(*r));
51
70
    if (p != NULL)
52
140
        for (; (s = p->key) != NULL; p++)
53
70
            switch(s[0]) {
54
0
            default:
55
0
                break;
56
0
            case 'c':
57
0
                if (ossl_likely(strcmp("ts_mode", s + 1) == 0)) {
58
                    /* OSSL_CIPHER_PARAM_CTS_MODE */
59
0
                    if (ossl_unlikely(r->mode != NULL)) {
60
0
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
61
0
                                       "param %s is repeated", s);
62
0
                        return 0;
63
0
                    }
64
0
                    r->mode = (OSSL_PARAM *)p;
65
0
                }
66
0
                break;
67
0
            case 'f':
68
# if defined(FIPS_MODULE)
69
                if (ossl_likely(strcmp("ips-indicator", s + 1) == 0)) {
70
                    /* OSSL_CIPHER_PARAM_FIPS_APPROVED_INDICATOR */
71
                    if (!OSSL_PARAM_set_int((OSSL_PARAM *)p, 1))
72
                        return 0;
73
                }
74
# endif
75
0
                break;
76
35
            case 'i':
77
35
                switch(s[1]) {
78
0
                default:
79
0
                    break;
80
35
                case 'v':
81
35
                    switch(s[2]) {
82
0
                    default:
83
0
                        break;
84
35
                    case 'l':
85
35
                        if (ossl_likely(strcmp("en", s + 3) == 0)) {
86
                            /* OSSL_CIPHER_PARAM_IVLEN */
87
35
                            if (ossl_unlikely(r->common.ivlen != NULL)) {
88
0
                                ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
89
0
                                               "param %s is repeated", s);
90
0
                                return 0;
91
0
                            }
92
35
                            r->common.ivlen = (OSSL_PARAM *)p;
93
35
                        }
94
35
                        break;
95
35
                    case '\0':
96
0
                        if (ossl_unlikely(r->common.iv != NULL)) {
97
0
                            ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
98
0
                                           "param %s is repeated", s);
99
0
                            return 0;
100
0
                        }
101
0
                        r->common.iv = (OSSL_PARAM *)p;
102
35
                    }
103
35
                }
104
35
                break;
105
35
            case 'k':
106
35
                if (ossl_likely(strcmp("eylen", s + 1) == 0)) {
107
                    /* OSSL_CIPHER_PARAM_KEYLEN */
108
35
                    if (ossl_unlikely(r->common.keylen != NULL)) {
109
0
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
110
0
                                       "param %s is repeated", s);
111
0
                        return 0;
112
0
                    }
113
35
                    r->common.keylen = (OSSL_PARAM *)p;
114
35
                }
115
35
                break;
116
35
            case 'u':
117
0
                if (ossl_likely(strcmp("pdated-iv", s + 1) == 0)) {
118
                    /* OSSL_CIPHER_PARAM_UPDATED_IV */
119
0
                    if (ossl_unlikely(r->common.updiv != NULL)) {
120
0
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
121
0
                                       "param %s is repeated", s);
122
0
                        return 0;
123
0
                    }
124
0
                    r->common.updiv = (OSSL_PARAM *)p;
125
0
                }
126
70
            }
127
70
    return 1;
128
70
}
129
#endif
130
/* End of machine generated */
131
132
/* Machine generated */
133
#ifndef cipher_cts_set_ctx_params_list
134
static ossl_unused const OSSL_PARAM cipher_cts_set_ctx_params_list[] = {
135
    OSSL_PARAM_utf8_string(OSSL_CIPHER_PARAM_CTS_MODE, NULL, 0),
136
    OSSL_PARAM_END
137
};
138
#endif
139
140
#ifndef cipher_cts_set_ctx_params_st
141
struct cipher_cts_set_ctx_params_st {
142
    OSSL_PARAM *mode;
143
};
144
#endif
145
146
#ifndef cipher_cts_set_ctx_params_decoder
147
static ossl_unused int cipher_cts_set_ctx_params_decoder
148
    (const OSSL_PARAM *p, struct cipher_cts_set_ctx_params_st *r)
149
70
{
150
70
    const char *s;
151
152
70
    memset(r, 0, sizeof(*r));
153
70
    if (p != NULL)
154
70
        for (; (s = p->key) != NULL; p++)
155
35
            if (ossl_likely(strcmp("cts_mode", s + 0) == 0)) {
156
                /* OSSL_CIPHER_PARAM_CTS_MODE */
157
35
                if (ossl_unlikely(r->mode != NULL)) {
158
0
                    ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
159
0
                                   "param %s is repeated", s);
160
0
                    return 0;
161
0
                }
162
35
                r->mode = (OSSL_PARAM *)p;
163
35
            }
164
70
    return 1;
165
70
}
166
#endif
167
/* End of machine generated */