Coverage Report

Created: 2026-05-30 06:06

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