Coverage Report

Created: 2025-12-10 06:24

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl/providers/implementations/encode_decode/encode_key2any.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 key2any_set_ctx_params_list
14
static const OSSL_PARAM key2any_set_ctx_params_list[] = {
15
    OSSL_PARAM_utf8_string(OSSL_ENCODER_PARAM_CIPHER, NULL, 0),
16
    OSSL_PARAM_utf8_string(OSSL_ENCODER_PARAM_PROPERTIES, NULL, 0),
17
    OSSL_PARAM_int(OSSL_ENCODER_PARAM_SAVE_PARAMETERS, NULL),
18
    OSSL_PARAM_utf8_string(OSSL_PKEY_PARAM_OUTPUT_FORMATS, NULL, 0),
19
    OSSL_PARAM_END
20
};
21
#endif
22
23
#ifndef key2any_set_ctx_params_st
24
struct key2any_set_ctx_params_st {
25
    OSSL_PARAM *cipher;
26
    OSSL_PARAM *output_formats;
27
    OSSL_PARAM *propq;
28
    OSSL_PARAM *svprm;
29
};
30
#endif
31
32
#ifndef key2any_set_ctx_params_decoder
33
static int key2any_set_ctx_params_decoder
34
    (const OSSL_PARAM *p, struct key2any_set_ctx_params_st *r)
35
0
{
36
0
    const char *s;
37
38
0
    memset(r, 0, sizeof(*r));
39
0
    if (p != NULL)
40
0
        for (; (s = p->key) != NULL; p++)
41
0
            switch(s[0]) {
42
0
            default:
43
0
                break;
44
0
            case 'c':
45
0
                if (ossl_likely(strcmp("ipher", s + 1) == 0)) {
46
                    /* OSSL_ENCODER_PARAM_CIPHER */
47
0
                    if (ossl_unlikely(r->cipher != NULL)) {
48
0
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
49
0
                                       "param %s is repeated", s);
50
0
                        return 0;
51
0
                    }
52
0
                    r->cipher = (OSSL_PARAM *)p;
53
0
                }
54
0
                break;
55
0
            case 'o':
56
0
                if (ossl_likely(strcmp("utput_formats", s + 1) == 0)) {
57
                    /* OSSL_PKEY_PARAM_OUTPUT_FORMATS */
58
0
                    if (ossl_unlikely(r->output_formats != NULL)) {
59
0
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
60
0
                                       "param %s is repeated", s);
61
0
                        return 0;
62
0
                    }
63
0
                    r->output_formats = (OSSL_PARAM *)p;
64
0
                }
65
0
                break;
66
0
            case 'p':
67
0
                if (ossl_likely(strcmp("roperties", s + 1) == 0)) {
68
                    /* OSSL_ENCODER_PARAM_PROPERTIES */
69
0
                    if (ossl_unlikely(r->propq != NULL)) {
70
0
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
71
0
                                       "param %s is repeated", s);
72
0
                        return 0;
73
0
                    }
74
0
                    r->propq = (OSSL_PARAM *)p;
75
0
                }
76
0
                break;
77
0
            case 's':
78
0
                if (ossl_likely(strcmp("ave-parameters", s + 1) == 0)) {
79
                    /* OSSL_ENCODER_PARAM_SAVE_PARAMETERS */
80
0
                    if (ossl_unlikely(r->svprm != NULL)) {
81
0
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
82
0
                                       "param %s is repeated", s);
83
0
                        return 0;
84
0
                    }
85
0
                    r->svprm = (OSSL_PARAM *)p;
86
0
                }
87
0
            }
88
0
    return 1;
89
0
}
90
#endif
91
/* End of machine generated */