Commit graph

53 commits

Author SHA1 Message Date
Jerry Yu
893be8d10f Replace cpu modifier flags
`crypto` should be replace with `aes`.

See https://arm-software.github.io/acle/main/acle.html#cryptographic-extensions

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-07-13 17:32:11 +08:00
Jerry Yu
b1d06bb29e Add error message for old armclang
when armclang<6.10, cpu modifiers MUST be
specified on command line.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-07-13 10:40:29 +08:00
Jerry Yu
6b00f5a135 Add guards for arm_neon.h
See: https://arm-software.github.io/acle/main/acle.html#arm_neonh



Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-07-13 10:40:28 +08:00
Jerry Yu
580e06fb07 fix armclang compile fail
`__ARM_FEATURE_AES` is not defined with `armclang < 6.10`.
And it raise error on `target("crypto,aes")

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-07-13 10:40:27 +08:00
Jerry Yu
08933d3dbb fix compile fail for armclang
when target flags are not set at command line, armclang
will reports required feature not set error.

This is found and verified at 6.20.1. And it does not work
for 6.6

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-07-13 10:40:08 +08:00
Beniamin Sandu
aa4f621901 aesce: use correct target attribute when building with clang
Seems clang has its own issues when it comes to crypto extensions,
and right now the best way to avoid them is to accurately enable
the needed instructions instead of the broad crypto feature.

E.g.: https://github.com/llvm/llvm-project/issues/61645

Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
2023-07-04 21:15:52 +03:00
Dave Rodgman
c8d81ad54d
Merge pull request #7784 from daverodgman/aesce-unroll 2023-07-04 18:41:13 +01:00
Beniamin Sandu
471a975942 aesce: do not specify an arch version when enabling crypto instructions
Building mbedtls with different aarch64 tuning variations revealed
that we should use the crypto extensions without forcing a particular
architecture version or core, as that can create issues.

Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
2023-06-25 21:10:53 +03:00
Dave Rodgman
73b0c0b051 Improve comment
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-16 14:48:14 +01:00
Dave Rodgman
bd1add94c0 Respect -Os for everything except XTS
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-16 13:50:14 +01:00
Dave Rodgman
9bb7e6f4ce Rename MBEDTLS_OPTIMIZE_ALWAYS
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-16 09:41:21 +01:00
Dave Rodgman
48fd2ab5d5 Improve readability of unrolled AESCE code
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-16 09:36:50 +01:00
Dave Rodgman
f88a68cf51 Use MBEDTLS_OPTIMIZE_ALWAYS in aesce
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 18:46:41 +01:00
Dave Rodgman
1c4451d089 Unroll aesce_decrypt_block
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 16:28:00 +01:00
Dave Rodgman
96fdfb8e62 Unroll aesce_encrypt_block
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 16:26:20 +01:00
Yanray Wang
e2bc158b38 aesce.c: add macro of MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-05-08 10:29:28 +08:00
Jerry Yu
db368dea88 fix clang test fail
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-04-26 16:55:37 +08:00
Jerry Yu
61c4cfa2a7 Add compiler version checks.
When `MBEDTLS_AESCE_C` enabled and the compiler
is not expected, we should raise error to user.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-04-26 13:06:01 +08:00
Jerry Yu
8b6df3fd76 fix msvc fail on embed assembly code
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-04-20 10:32:37 +08:00
Jerry Yu
9db4b1f455 fix msvc type cast fail.
GCC needs the `cast` due to incompatible type error

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-04-20 10:32:36 +08:00
Jerry Yu
07d28d8598 Add msvc build for aesce module
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-04-20 10:32:36 +08:00
Dave Rodgman
c5807a6fa8
Merge pull request #6918 from yuhaoth/pr/add-gcm-with-armv8-crypto-extension
Add GCM  with armv8 crypto extension
2023-03-20 14:45:14 +00:00
Dave Rodgman
f918d42332 Tidy up ARMCE terminology
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-03-17 17:52:23 +00:00
Jerry Yu
be4fdef513 fix comment issues
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-15 14:50:42 +08:00
Jerry Yu
8f81060517 Replace median with `middle
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-15 09:58:34 +08:00
Jerry Yu
f0526a9ad0 fix grammar issue in comment
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-15 09:58:34 +08:00
Jerry Yu
49b4367eee fix comment issue
The algorithm is not karatsuba multiplication.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-15 09:58:33 +08:00
Jerry Yu
1ac7f6b09d Improve readability
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-15 09:58:33 +08:00
Jerry Yu
132d0cb74d Add miss intrinsic by gcc-5.x
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-15 09:58:29 +08:00
Jerry Yu
2c26651938 Improve comments for key expansion
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-15 09:57:37 +08:00
Jerry Yu
df87a12c81 Add GCM support
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-15 09:57:32 +08:00
Dave Rodgman
db6ab247fc Improve macro naming
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-03-14 16:03:57 +00:00
Jerry Yu
ec9be84ae6 skip pragma when cpu modifier has been set
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-14 10:42:47 +08:00
Jerry Yu
b28d55b242 fix wrong typo and indent issue
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-14 10:36:47 +08:00
Jerry Yu
6f86c19d62 Improve readability for compiler version check
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-13 11:03:40 +08:00
Jerry Yu
02487a2123 Rename target option flag macro
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-13 10:19:35 +08:00
Jerry Yu
77a010e3b3 Remove the max version limitation for clang workaround
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-13 10:19:35 +08:00
Jerry Yu
490bf08dd9 fix comment issues
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-13 10:19:34 +08:00
Jerry Yu
ae129c3a20 Add new feature test macros
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-13 10:19:34 +08:00
Jerry Yu
48b999cd6e Add cpu modifiers for aesce.c
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-13 10:19:31 +08:00
Tom Cosgrove
5c8505f061 Fix typos
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-07 11:39:52 +00:00
Jerry Yu
ba1e78f1c2 fix code style and comment issues
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-24 11:18:16 +08:00
Jerry Yu
947bf969e0 Improve readability of expansion size
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-23 11:07:57 +08:00
Jerry Yu
fac5a54f8a fix code style issues
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-23 10:13:40 +08:00
Jerry Yu
3304c204ba Improve readabilities
- Add more comments
- Adjust setkey_enc

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-22 14:37:11 +08:00
Jerry Yu
baae4012bf merge setkey_enc* functions
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-21 15:28:03 +08:00
Jerry Yu
c8bcdc8b91 fix various issues
- Improve some function names
- Improve comments
- improve readability

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-21 15:16:20 +08:00
Jerry Yu
b2783f66b5 fix typo issue
The error message is wrong

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-13 18:03:25 +08:00
Jerry Yu
2bb3d8101f Add en(de)crypt routine
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-07 17:11:53 +08:00
Jerry Yu
e096da1af6 Add inverse key function
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-07 17:11:52 +08:00