summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/s2n_bignum_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bn/s2n_bignum_internal.h')
-rw-r--r--src/lib/libcrypto/bn/s2n_bignum_internal.h33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/lib/libcrypto/bn/s2n_bignum_internal.h b/src/lib/libcrypto/bn/s2n_bignum_internal.h
index b82db7d019..4217ca95af 100644
--- a/src/lib/libcrypto/bn/s2n_bignum_internal.h
+++ b/src/lib/libcrypto/bn/s2n_bignum_internal.h
@@ -14,14 +14,14 @@
14 14
15#ifdef __APPLE__ 15#ifdef __APPLE__
16# define S2N_BN_SYMBOL(NAME) _##NAME 16# define S2N_BN_SYMBOL(NAME) _##NAME
17# if defined(__AARCH64EL__) || defined(__ARMEL__)
18# define __LF %%
19# else
20# define __LF ;
21# endif
17#else 22#else
18# define S2N_BN_SYMBOL(name) name 23# define S2N_BN_SYMBOL(name) name
19#endif 24# define __LF ;
20
21#ifdef __CET__
22# include <cet.h>
23#else
24# define _CET_ENDBR
25#endif 25#endif
26 26
27#define S2N_BN_SYM_VISIBILITY_DIRECTIVE(name) .globl S2N_BN_SYMBOL(name) 27#define S2N_BN_SYM_VISIBILITY_DIRECTIVE(name) .globl S2N_BN_SYMBOL(name)
@@ -34,3 +34,24 @@
34#else 34#else
35# define S2N_BN_SYM_PRIVACY_DIRECTIVE(name) /* NO-OP: S2N_BN_SYM_PRIVACY_DIRECTIVE */ 35# define S2N_BN_SYM_PRIVACY_DIRECTIVE(name) /* NO-OP: S2N_BN_SYM_PRIVACY_DIRECTIVE */
36#endif 36#endif
37
38// Enable indirect branch tracking support unless explicitly disabled
39// with -DNO_IBT. If the platform supports CET, simply inherit this from
40// the usual header. Otherwise manually define _CET_ENDBR, used at each
41// x86 entry point, to be the ENDBR64 instruction, with an explicit byte
42// sequence for compilers/assemblers that don't know about it. Note that
43// it is safe to use ENDBR64 on all platforms, since the encoding is by
44// design interpreted as a NOP on all pre-CET x86_64 processors. The only
45// downside is a small increase in code size and potentially a modest
46// slowdown from executing one more instruction.
47
48#if NO_IBT
49# if defined(_CET_ENDBR)
50# error "The s2n-bignum build option NO_IBT was configured, but _CET_ENDBR is defined in this compilation unit. That is weird, so failing the build."
51# endif
52# define _CET_ENDBR
53#elif defined(__CET__)
54# include <cet.h>
55#elif !defined(_CET_ENDBR)
56# define _CET_ENDBR .byte 0xf3,0x0f,0x1e,0xfa
57#endif