Commit graph

26309 commits

Author SHA1 Message Date
Jerry Yu
6c6b9f602c Change document to match real status
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-17 16:53:01 +08:00
Jerry Yu
e9c6b53e74 remove return-type when runtime detection enabled without plain c
This case does not exist

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-17 13:53:38 +08:00
Jerry Yu
f258d17acd remove aesni + padlock - plain c tests
This test is not valid for padlock depends
on plain c

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-17 12:39:00 +08:00
Jerry Yu
1b4c7eda80 add hardware only check for padlock
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-17 11:25:17 +08:00
Jerry Yu
9e628621b4 Add via padlock detection macro
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-17 11:20:09 +08:00
Jerry Yu
2319af0d64 Change the order of runtime detection
If aesni is available, we will use it.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-17 10:38:57 +08:00
Jerry Yu
35b59d7805 exclude arm64ec mode for aesni
AESNI does not work correctly for msvc arm64ec

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-17 10:34:15 +08:00
Jerry Yu
bdd96b9adf disable aesni for componets without cpu modifiers
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-16 17:34:27 +08:00
Jerry Yu
516cf27d45 fix msvc build fail on i386 target
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-16 17:33:32 +08:00
Jerry Yu
3ce0398d1d Add compiler cflags error message
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-16 17:22:18 +08:00
Jerry Yu
506759f5ce fix build fail for via padlock test
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-16 17:11:22 +08:00
Jerry Yu
b6d39c2f8c Add aesni test for i386
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-16 16:14:02 +08:00
Jerry Yu
c628486cd9 enable runtime detection when padlock enabled and plain c disabled
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-16 16:14:02 +08:00
Jerry Yu
cc068ae631 fix -Werror=return-type when runtime detection enabled and plain c disabled
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-16 16:14:01 +08:00
Jerry Yu
e62ff09569 Restore aesni for i386
intrinsic code can be work on i386 also

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-16 14:33:16 +08:00
Jerry Yu
240bb11171 Add gnu check for aseni assembly code
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-11 10:45:35 +08:00
Jerry Yu
8189f32945 improve aesni check for x86_64
`MBEDTLS_AESNI_C` does not depends on `MBEDTLS_HAVE_ASM`
when intrinsic is available.

And compiler relative checks only work on x86_64, it should
be only checked on x86_64.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-10 15:17:45 +08:00
Jerry Yu
13696bb07b improve check config option for i386
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-10 13:36:32 +08:00
Jerry Yu
ba42b076f9 Remove asm check for aarch64 aesce
we implement it with aesce intrinsic. No asm needed.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-10 12:53:26 +08:00
Jerry Yu
76a51b99b6 replace strings command with grep
`strings | grep` will fail some time.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-09 15:56:26 +08:00
Jerry Yu
a7de78d050 improve test
- `grep '^flags' /proc/cpuino` does not work in my local machine inside script.
- `make test programs/sleftest ` causes `strings | grep ` fail.

For timebeing, I did not figure out the root cause.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-08 14:28:15 +08:00
Jerry Yu
c4508c07f6 improve error message and config check for padlock
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-08 12:57:06 +08:00
Jerry Yu
5fcdd6a28a remove unnecessary definition
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-07 15:32:58 +08:00
Jerry Yu
7802f65a28 Add negative test for aesni only
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-07 10:38:50 +08:00
Jerry Yu
9c0b7d13bf Remove unnecessary name check tag
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-04 17:25:59 +08:00
Jerry Yu
fce351def8 improve platform relative check
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-04 17:13:36 +08:00
Jerry Yu
b241db3e26 remove padlock only mode
padlock depends on pure c implementation

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-04 16:56:04 +08:00
Jerry Yu
29c91ba42d fix unreachable code warnings
It is detected by clang with bellow patch
```
diff --git a/library/Makefile b/library/Makefile
index fdab4f4ba0..967f9e2e65 100644
--- a/library/Makefile
+++ b/library/Makefile
@@ -306,8 +306,8 @@ libmbedcrypto.dll: $(OBJS_CRYPTO)

 .c.o:
        echo "  CC    $<"
-       $(CC) $(LOCAL_CFLAGS) $(CFLAGS) -o $@ -c $<
-
+       $(CC) $(LOCAL_CFLAGS) $(CFLAGS) -o $(@:%.o=%.i) -E $<
+       $(CC) $(LOCAL_CFLAGS) -Wunreachable-code -Werror -Wno-unused-command-line-argument $(CFLAGS) -o $@ -c $(@:%.o=%.i)
 .PHONY: generated_files
 GENERATED_FILES = \
        error.c version_features.c \
```

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-04 16:29:06 +08:00
Jerry Yu
2700ef6bb0 Add aesce test string filter
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-04 16:29:05 +08:00
Jerry Yu
c935aa617b Add via padlock build test
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-04 16:29:05 +08:00
Jerry Yu
193cbc03fe Add aesce build test
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-04 09:38:37 +08:00
Jerry Yu
8a599c03fa Add aesni only test
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-03 17:01:02 +08:00
Jerry Yu
17a9d2e412 Add MBEDTLS_AES_USE_HADWARE_ONLY for test_aesni
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-03 16:14:18 +08:00
Jerry Yu
1221a31cc4 Run aes tests only for test_aesni
That can reduce time of selftest

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-03 16:09:07 +08:00
Jerry Yu
69dd441eb5 Remove test_aes_*
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-03 16:00:20 +08:00
Jerry Yu
1414029ff0 improve document about hardware only
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-02 17:44:03 +08:00
Jerry Yu
6943681820 Improve error message and documents
- fix grammar error
- Add more information for AES_USE_HARDWARE_ONLY
- Improve error message

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-02 17:44:03 +08:00
Jerry Yu
e77c4d95a7 Mention the crash risk without runtime detection
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-02 17:44:02 +08:00
Jerry Yu
9e3e3dd45b Fix code-style too-long line fail
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-02 17:44:02 +08:00
Jerry Yu
02b1519ab6 move accelerator checks to aes.c
Origin position is always validate due to conflict
between the guards in `aes.c` and module undef check

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-02 17:44:02 +08:00
Jerry Yu
4dfbb2e747 add changelog entry
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-02 17:44:01 +08:00
Jerry Yu
d76ded046c fix various issues
- unnecessary command
- extra blank and empty line

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-02 17:44:01 +08:00
Jerry Yu
3660623e59 Rename plain c option and update comments
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-02 17:44:01 +08:00
Jerry Yu
8840a8c574 fix wrong checks
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-02 17:44:00 +08:00
Jerry Yu
3fcf2b5053 Rename HAS_NO_PLAIN_C to DONT_USE_SOFTWARE_CRYPTO
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-02 17:44:00 +08:00
Jerry Yu
1b3ab36b55 Update comments
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-02 17:43:59 +08:00
Jerry Yu
4d030f3acd Add check for no aes implementation provided
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-02 17:43:59 +08:00
Jerry Yu
315fd30201 Rename plain c disable option
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-02 17:43:59 +08:00
Jerry Yu
2f26a59910 Add std output information for AESCE in gcm
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-02 17:43:58 +08:00
Jerry Yu
d767cc4106 Add accelerator only tests.
The cases with runtime detection have been
covered by `full` configuration

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-02 17:43:58 +08:00