Make BN_num_bits_word constant-time.
[openssl.git] / crypto / arm_arch.h
1 #ifndef __ARM_ARCH_H__
2 # define __ARM_ARCH_H__
3
4 # if !defined(__ARM_ARCH__)
5 #  if defined(__CC_ARM)
6 #   define __ARM_ARCH__ __TARGET_ARCH_ARM
7 #   if defined(__BIG_ENDIAN)
8 #    define __ARMEB__
9 #   else
10 #    define __ARMEL__
11 #   endif
12 #  elif defined(__GNUC__)
13 #   if   defined(__aarch64__)
14 #    define __ARM_ARCH__ 8
15 #    if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
16 #     define __ARMEB__
17 #    else
18 #     define __ARMEL__
19 #    endif
20   /*
21    * Why doesn't gcc define __ARM_ARCH__? Instead it defines
22    * bunch of below macros. See all_architectires[] table in
23    * gcc/config/arm/arm.c. On a side note it defines
24    * __ARMEL__/__ARMEB__ for little-/big-endian.
25    */
26 #   elif defined(__ARM_ARCH)
27 #    define __ARM_ARCH__ __ARM_ARCH
28 #   elif defined(__ARM_ARCH_8A__)
29 #    define __ARM_ARCH__ 8
30 #   elif defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__)     || \
31         defined(__ARM_ARCH_7R__)|| defined(__ARM_ARCH_7M__)     || \
32         defined(__ARM_ARCH_7EM__)
33 #    define __ARM_ARCH__ 7
34 #   elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__)     || \
35         defined(__ARM_ARCH_6K__)|| defined(__ARM_ARCH_6M__)     || \
36         defined(__ARM_ARCH_6Z__)|| defined(__ARM_ARCH_6ZK__)    || \
37         defined(__ARM_ARCH_6T2__)
38 #    define __ARM_ARCH__ 6
39 #   elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__)     || \
40         defined(__ARM_ARCH_5E__)|| defined(__ARM_ARCH_5TE__)    || \
41         defined(__ARM_ARCH_5TEJ__)
42 #    define __ARM_ARCH__ 5
43 #   elif defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
44 #    define __ARM_ARCH__ 4
45 #   else
46 #    error "unsupported ARM architecture"
47 #   endif
48 #  endif
49 # endif
50
51 # ifdef OPENSSL_FIPSCANISTER
52 #  include <openssl/fipssyms.h>
53 # endif
54
55 # if !defined(__ARM_MAX_ARCH__)
56 #  define __ARM_MAX_ARCH__ __ARM_ARCH__
57 # endif
58
59 # if __ARM_MAX_ARCH__<__ARM_ARCH__
60 #  error "__ARM_MAX_ARCH__ can't be less than __ARM_ARCH__"
61 # elif __ARM_MAX_ARCH__!=__ARM_ARCH__
62 #  if __ARM_ARCH__<7 && __ARM_MAX_ARCH__>=7 && defined(__ARMEB__)
63 #   error "can't build universal big-endian binary"
64 #  endif
65 # endif
66
67 # if !__ASSEMBLER__
68 extern unsigned int OPENSSL_armcap_P;
69 # endif
70
71 # define ARMV7_NEON      (1<<0)
72 # define ARMV7_TICK      (1<<1)
73 # define ARMV8_AES       (1<<2)
74 # define ARMV8_SHA1      (1<<3)
75 # define ARMV8_SHA256    (1<<4)
76 # define ARMV8_PMULL     (1<<5)
77
78 #endif