Coverage Report

Created: 2026-09-12 06:55

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl41/providers/implementations/asymciphers/sm2_enc.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 sm2_get_ctx_params_list
21
static ossl_unused const OSSL_PARAM sm2_get_ctx_params_list[] = {
22
    OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_DIGEST, NULL, 0),
23
    OSSL_PARAM_END
24
};
25
#endif
26
27
#ifndef sm2_get_ctx_params_st
28
struct sm2_get_ctx_params_st {
29
    OSSL_PARAM *digest;
30
};
31
#endif
32
33
#ifndef sm2_get_ctx_params_decoder
34
static ossl_unused int sm2_get_ctx_params_decoder
35
    (const OSSL_PARAM *p, struct sm2_get_ctx_params_st *r)
36
0
{
37
0
    const char *s;
38
39
0
    memset(r, 0, sizeof(*r));
40
0
    if (p != NULL)
41
0
        for (; (s = p->key) != NULL; p++)
42
0
            if (ossl_likely(strcmp("digest", s + 0) == 0)) {
43
                /* OSSL_ASYM_CIPHER_PARAM_DIGEST */
44
0
                if (ossl_unlikely(r->digest != NULL)) {
45
0
                    ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
46
0
                                   "param %s is repeated", s);
47
0
                    return 0;
48
0
                }
49
0
                r->digest = (OSSL_PARAM *)p;
50
0
            }
51
0
    return 1;
52
0
}
53
#endif
54
/* End of machine generated */
55
56
/* Machine generated */
57
#ifndef sm2_set_ctx_params_list
58
static ossl_unused const OSSL_PARAM sm2_set_ctx_params_list[] = {
59
    OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_DIGEST, NULL, 0),
60
    OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_PROPERTIES, NULL, 0),
61
    OSSL_PARAM_END
62
};
63
#endif
64
65
#ifndef sm2_set_ctx_params_st
66
struct sm2_set_ctx_params_st {
67
    OSSL_PARAM *digest;
68
    OSSL_PARAM *propq;
69
};
70
#endif
71
72
#ifndef sm2_set_ctx_params_decoder
73
static ossl_unused int sm2_set_ctx_params_decoder
74
    (const OSSL_PARAM *p, struct sm2_set_ctx_params_st *r)
75
0
{
76
0
    const char *s;
77
78
0
    memset(r, 0, sizeof(*r));
79
0
    if (p != NULL)
80
0
        for (; (s = p->key) != NULL; p++)
81
0
            switch(s[0]) {
82
0
            default:
83
0
                break;
84
0
            case 'd':
85
0
                if (ossl_likely(strcmp("igest", s + 1) == 0)) {
86
                    /* OSSL_ASYM_CIPHER_PARAM_DIGEST */
87
0
                    if (ossl_unlikely(r->digest != 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
0
                    r->digest = (OSSL_PARAM *)p;
93
0
                }
94
0
                break;
95
0
            case 'p':
96
0
                if (ossl_likely(strcmp("roperties", s + 1) == 0)) {
97
                    /* OSSL_ASYM_CIPHER_PARAM_PROPERTIES */
98
0
                    if (ossl_unlikely(r->propq != NULL)) {
99
0
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
100
0
                                       "param %s is repeated", s);
101
0
                        return 0;
102
0
                    }
103
0
                    r->propq = (OSSL_PARAM *)p;
104
0
                }
105
0
            }
106
0
    return 1;
107
0
}
108
#endif
109
/* End of machine generated */