Coverage Report

Created: 2026-09-12 06:55

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