Coverage Report

Created: 2026-05-20 07:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl/providers/implementations/kdfs/snmpkdf.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 snmp_set_ctx_params_list
19
static const OSSL_PARAM snmp_set_ctx_params_list[] = {
20
    OSSL_PARAM_utf8_string(OSSL_KDF_PARAM_PROPERTIES, NULL, 0),
21
    OSSL_PARAM_utf8_string(OSSL_KDF_PARAM_DIGEST, NULL, 0),
22
    OSSL_PARAM_octet_string(OSSL_KDF_PARAM_SNMPKDF_EID, NULL, 0),
23
    OSSL_PARAM_octet_string(OSSL_KDF_PARAM_PASSWORD, NULL, 0),
24
    OSSL_PARAM_END
25
};
26
#endif
27
28
#ifndef snmp_set_ctx_params_st
29
struct snmp_set_ctx_params_st {
30
    OSSL_PARAM *digest;
31
    OSSL_PARAM *eid;
32
    OSSL_PARAM *propq;
33
    OSSL_PARAM *pw;
34
};
35
#endif
36
37
#ifndef snmp_set_ctx_params_decoder
38
static int snmp_set_ctx_params_decoder
39
    (const OSSL_PARAM *p, struct snmp_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 'd':
50
0
                if (ossl_likely(strcmp("igest", s + 1) == 0)) {
51
                    /* OSSL_KDF_PARAM_DIGEST */
52
0
                    if (ossl_unlikely(r->digest != 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->digest = (OSSL_PARAM *)p;
58
0
                }
59
0
                break;
60
0
            case 'e':
61
0
                if (ossl_likely(strcmp("id", s + 1) == 0)) {
62
                    /* OSSL_KDF_PARAM_SNMPKDF_EID */
63
0
                    if (ossl_unlikely(r->eid != 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->eid = (OSSL_PARAM *)p;
69
0
                }
70
0
                break;
71
0
            case 'p':
72
0
                switch(s[1]) {
73
0
                default:
74
0
                    break;
75
0
                case 'a':
76
0
                    if (ossl_likely(strcmp("ss", s + 2) == 0)) {
77
                        /* OSSL_KDF_PARAM_PASSWORD */
78
0
                        if (ossl_unlikely(r->pw != NULL)) {
79
0
                            ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
80
0
                                           "param %s is repeated", s);
81
0
                            return 0;
82
0
                        }
83
0
                        r->pw = (OSSL_PARAM *)p;
84
0
                    }
85
0
                    break;
86
0
                case 'r':
87
0
                    if (ossl_likely(strcmp("operties", s + 2) == 0)) {
88
                        /* OSSL_KDF_PARAM_PROPERTIES */
89
0
                        if (ossl_unlikely(r->propq != NULL)) {
90
0
                            ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
91
0
                                           "param %s is repeated", s);
92
0
                            return 0;
93
0
                        }
94
0
                        r->propq = (OSSL_PARAM *)p;
95
0
                    }
96
0
                }
97
0
            }
98
0
    return 1;
99
0
}
100
#endif
101
/* End of machine generated */
102
103
/* Machine generated by util/perl/OpenSSL/paramnames.pm */
104
#include <string.h>
105
#include <openssl/params.h>
106
#include "internal/common.h"
107
#include "prov/proverr.h"
108
109
#ifndef snmp_get_ctx_params_list
110
static const OSSL_PARAM snmp_get_ctx_params_list[] = {
111
    OSSL_PARAM_size_t(OSSL_KDF_PARAM_SIZE, NULL),
112
    OSSL_PARAM_END
113
};
114
#endif
115
116
#ifndef snmp_get_ctx_params_st
117
struct snmp_get_ctx_params_st {
118
    OSSL_PARAM *size;
119
};
120
#endif
121
122
#ifndef snmp_get_ctx_params_decoder
123
static int snmp_get_ctx_params_decoder
124
    (const OSSL_PARAM *p, struct snmp_get_ctx_params_st *r)
125
0
{
126
0
    const char *s;
127
128
0
    memset(r, 0, sizeof(*r));
129
0
    if (p != NULL)
130
0
        for (; (s = p->key) != NULL; p++)
131
0
            if (ossl_likely(strcmp("size", s + 0) == 0)) {
132
                /* OSSL_KDF_PARAM_SIZE */
133
0
                if (ossl_unlikely(r->size != NULL)) {
134
0
                    ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
135
0
                                   "param %s is repeated", s);
136
0
                    return 0;
137
0
                }
138
0
                r->size = (OSSL_PARAM *)p;
139
0
            }
140
0
    return 1;
141
0
}
142
#endif
143
/* End of machine generated */