Coverage Report

Created: 2024-05-15 07:16

/src/openssl/fuzz/rand.inc
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
3
 *
4
 * Licensed under the Apache License 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 * https://www.openssl.org/source/license.html
8
 * or in the file LICENSE in the source distribution.
9
 */
10
#include <openssl/rand.h>
11
12
static int fuzz_bytes(unsigned char *buf, int num)
13
28.1k
{
14
28.1k
    unsigned char val = 1;
15
16
1.24M
    while (--num >= 0)
17
1.21M
        *buf++ = val++;
18
28.1k
    return 1;
19
28.1k
}
20
21
static int fuzz_status(void)
22
0
{
23
0
    return 1;
24
0
}
25
26
static RAND_METHOD fuzz_rand_method = {
27
    NULL,
28
    fuzz_bytes,
29
    NULL,
30
    NULL,
31
    fuzz_bytes,
32
    fuzz_status
33
};
34
35
void FuzzerSetRand(void)
36
3.56k
{
37
3.56k
    RAND_set_rand_method(&fuzz_rand_method);
38
3.56k
}
39
40