Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
z
Classes
Class List
Class Hierarchy
Class Members
All
:
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Properties
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
grpc
third_party
boringssl-with-bazel
src
crypto
rand_extra
forkunsafe.c
Go to the documentation of this file.
1
/* Copyright (c) 2017, Google Inc.
2
*
3
* Permission to use, copy, modify, and/or distribute this software for any
4
* purpose with or without fee is hereby granted, provided that the above
5
* copyright notice and this permission notice appear in all copies.
6
*
7
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14
15
#include <
openssl/rand.h
>
16
17
#include <stdlib.h>
18
19
#include "../fipsmodule/rand/internal.h"
20
21
22
// g_buffering_enabled is true if fork-unsafe buffering has been enabled.
23
static
int
g_buffering_enabled
= 0;
24
25
// g_lock protects |g_buffering_enabled|.
26
static
struct
CRYPTO_STATIC_MUTEX
g_lock
=
CRYPTO_STATIC_MUTEX_INIT
;
27
28
#if !defined(OPENSSL_WINDOWS)
29
void
RAND_enable_fork_unsafe_buffering
(
int
fd) {
30
// We no longer support setting the file-descriptor with this function.
31
if
(fd != -1) {
32
abort();
33
}
34
35
CRYPTO_STATIC_MUTEX_lock_write
(&
g_lock
);
36
g_buffering_enabled
= 1;
37
CRYPTO_STATIC_MUTEX_unlock_write
(&
g_lock
);
38
}
39
#endif
40
41
int
rand_fork_unsafe_buffering_enabled
(
void
) {
42
CRYPTO_STATIC_MUTEX_lock_read
(&
g_lock
);
43
const
int
ret
=
g_buffering_enabled
;
44
CRYPTO_STATIC_MUTEX_unlock_read
(&
g_lock
);
45
return
ret
;
46
}
CRYPTO_STATIC_MUTEX_INIT
#define CRYPTO_STATIC_MUTEX_INIT
Definition:
third_party/boringssl-with-bazel/src/crypto/internal.h:536
rand_fork_unsafe_buffering_enabled
int rand_fork_unsafe_buffering_enabled(void)
Definition:
forkunsafe.c:41
CRYPTO_STATIC_MUTEX_unlock_write
#define CRYPTO_STATIC_MUTEX_unlock_write
Definition:
boringssl_prefix_symbols.h:1135
CRYPTO_STATIC_MUTEX
Definition:
third_party/boringssl-with-bazel/src/crypto/internal.h:533
CRYPTO_STATIC_MUTEX_unlock_read
#define CRYPTO_STATIC_MUTEX_unlock_read
Definition:
boringssl_prefix_symbols.h:1134
CRYPTO_STATIC_MUTEX_lock_write
#define CRYPTO_STATIC_MUTEX_lock_write
Definition:
boringssl_prefix_symbols.h:1133
g_buffering_enabled
static int g_buffering_enabled
Definition:
forkunsafe.c:23
g_lock
static struct CRYPTO_STATIC_MUTEX g_lock
Definition:
forkunsafe.c:26
rand.h
ret
UniquePtr< SSL_SESSION > ret
Definition:
ssl_x509.cc:1029
CRYPTO_STATIC_MUTEX_lock_read
#define CRYPTO_STATIC_MUTEX_lock_read
Definition:
boringssl_prefix_symbols.h:1132
RAND_enable_fork_unsafe_buffering
void RAND_enable_fork_unsafe_buffering(int fd)
Definition:
forkunsafe.c:29
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:22