Coverage Report

Created: 2026-05-20 07:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl/providers/implementations/rands/seed_src.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 seed_src_get_ctx_params_list
19
static const OSSL_PARAM seed_src_get_ctx_params_list[] = {
20
    OSSL_PARAM_int(OSSL_RAND_PARAM_STATE, NULL),
21
    OSSL_PARAM_uint(OSSL_RAND_PARAM_STRENGTH, NULL),
22
    OSSL_PARAM_size_t(OSSL_RAND_PARAM_MAX_REQUEST, NULL),
23
    OSSL_PARAM_END
24
};
25
#endif
26
27
#ifndef seed_src_get_ctx_params_st
28
struct seed_src_get_ctx_params_st {
29
    OSSL_PARAM *maxreq;
30
    OSSL_PARAM *state;
31
    OSSL_PARAM *str;
32
};
33
#endif
34
35
#ifndef seed_src_get_ctx_params_decoder
36
static int seed_src_get_ctx_params_decoder
37
    (const OSSL_PARAM *p, struct seed_src_get_ctx_params_st *r)
38
128
{
39
128
    const char *s;
40
41
128
    memset(r, 0, sizeof(*r));
42
128
    if (p != NULL)
43
256
        for (; (s = p->key) != NULL; p++)
44
128
            switch(s[0]) {
45
64
            default:
46
64
                break;
47
64
            case 'm':
48
0
                if (ossl_likely(strcmp("ax_request", s + 1) == 0)) {
49
                    /* OSSL_RAND_PARAM_MAX_REQUEST */
50
0
                    if (ossl_unlikely(r->maxreq != NULL)) {
51
0
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
52
0
                                       "param %s is repeated", s);
53
0
                        return 0;
54
0
                    }
55
0
                    r->maxreq = (OSSL_PARAM *)p;
56
0
                }
57
0
                break;
58
64
            case 's':
59
64
                switch(s[1]) {
60
0
                default:
61
0
                    break;
62
64
                case 't':
63
64
                    switch(s[2]) {
64
0
                    default:
65
0
                        break;
66
0
                    case 'a':
67
0
                        if (ossl_likely(strcmp("te", s + 3) == 0)) {
68
                            /* OSSL_RAND_PARAM_STATE */
69
0
                            if (ossl_unlikely(r->state != 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->state = (OSSL_PARAM *)p;
75
0
                        }
76
0
                        break;
77
64
                    case 'r':
78
64
                        if (ossl_likely(strcmp("ength", s + 3) == 0)) {
79
                            /* OSSL_RAND_PARAM_STRENGTH */
80
64
                            if (ossl_unlikely(r->str != 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
64
                            r->str = (OSSL_PARAM *)p;
86
64
                        }
87
64
                    }
88
64
                }
89
128
            }
90
128
    return 1;
91
128
}
92
#endif
93
/* End of machine generated */