1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
------------------------------------------------------------------------------------
Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0 OR ISC
------------------------------------------------------------------------------------
*/
// The contents of this file were copied from crypto/crypto.c to this file
// as part of the change that moves the CPU capability logic inside the FIPS
// module to satisfy the FIPS requirements.
// Our assembly does not use the GOT to reference symbols, which means
// references to visible symbols will often require a TEXTREL. This is
// undesirable, so all assembly-referenced symbols should be hidden. CPU
// capabilities are the only such symbols defined in C. Explicitly hide them,
// rather than rely on being built with -fvisibility=hidden.
// This value must be explicitly initialised to zero in order to work around a
// bug in libtool or the linker on OS X.
//
// If not initialised then it becomes a "common symbol". When put into an
// archive, linking on OS X will fail to resolve common symbols. By
// initialising it to zero, it becomes a "data symbol", which isn't so
// affected.
HIDDEN uint32_t OPENSSL_ia32cap_P = ;
HIDDEN unsigned long OPENSSL_ppc64le_hwcap2 = 0;
// See ARM ACLE for the definitions of these macros. Note |__ARM_FEATURE_AES|
// covers both AES and PMULL and |__ARM_FEATURE_SHA2| covers SHA-1 and SHA-256.
// https://developer.arm.com/architectures/system-architectures/software-standards/acle
// https://github.com/ARM-software/acle/issues/152
//
// TODO(davidben): Do we still need |OPENSSL_STATIC_ARMCAP_*| or are the
// standard flags and -march sufficient?
HIDDEN uint32_t OPENSSL_armcap_P =
ARMV7_NEON |
ARMV8_AES |
ARMV8_PMULL |
ARMV8_SHA1 |
ARMV8_SHA256 |
ARMV8_SHA512 |
0;
HIDDEN uint32_t OPENSSL_armcap_P = 0;
// This value must be explicitly initialized to zero. See similar comment above.
HIDDEN uint8_t BORINGSSL_function_hit = ;
// This variable is used only for testing purposes to ensure that the library
// constructor is executed and the capability variable is initialized.
HIDDEN uint8_t OPENSSL_cpucap_initialized = 0;