• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file is part of the openHiTLS project.
3  *
4  * openHiTLS is licensed under the Mulan PSL v2.
5  * You can use this software according to the terms and conditions of the Mulan PSL v2.
6  * You may obtain a copy of Mulan PSL v2 at:
7  *
8  *     http://license.coscl.org.cn/MulanPSL2
9  *
10  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13  * See the Mulan PSL v2 for more details.
14  */
15 
16 #ifndef CRYPT_ARM_H
17 #define CRYPT_ARM_H
18 
19 #ifndef CRYPT_VAL
20 #define CRYPT_VAL               16
21 #endif
22 #ifndef CRYPT_VAL2
23 #define CRYPT_VAL2              26
24 #endif
25 #if defined(__arm__) || defined (__arm)
26 #define CRYPT_CAP               CRYPT_VAL
27 #define CRYPT_CE                CRYPT_VAL2
28 #define CRYPT_ARM_NEON          (1 << 12)
29 #define CRYPT_ARM_AES           (1 << 0)
30 #define CRYPT_ARM_PMULL         (1 << 1)
31 #define CRYPT_ARM_SHA1          (1 << 2)
32 #define CRYPT_ARM_SHA256        (1 << 3)
33 #elif defined(__aarch64__)
34 #define CRYPT_CAP               CRYPT_VAL
35 #define CRYPT_CE                CRYPT_VAL
36 #define CRYPT_ARM_NEON          (1 << 1)
37 #define CRYPT_ARM_AES           (1 << 3)
38 #define CRYPT_ARM_PMULL         (1 << 4)
39 #define CRYPT_ARM_SHA1          (1 << 5)
40 #define CRYPT_ARM_SHA256        (1 << 6)
41 #define CRYPT_ARM_SM3           (1 << 18)
42 #define CRYPT_ARM_SM4           (1 << 19)
43 #define CRYPT_ARM_SHA512        (1 << 21)
44 
45 #define CRYPT_CAP2              CRYPT_VAL2
46 #define CRYPT_ARM_CAP2_RNG      (1 << 16)
47 #endif
48 
49 #ifndef __ASSEMBLER__
50 extern uint32_t g_cryptArmCpuInfo;
51 #else
52 #  ifdef HITLS_AARCH64_PACIASP
53 #   define AARCH64_PACIASP hint #25
54 #   define AARCH64_AUTIASP hint #29
55 #  else
56 #   define AARCH64_PACIASP
57 #   define AARCH64_AUTIASP
58 #  endif
59 #endif
60 
61 #endif