Move aead_non_psa out of the psa/ directory
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
diff --git a/programs/.gitignore b/programs/.gitignore
index 6500174..076821f 100644
--- a/programs/.gitignore
+++ b/programs/.gitignore
@@ -13,6 +13,7 @@
*.exe
aes/crypt_and_hash
+cipher/aead_demo
hash/generic_sum
hash/hello
hash/hmac_demo
@@ -39,8 +40,7 @@
pkey/rsa_sign_pss
pkey/rsa_verify
pkey/rsa_verify_pss
-psa/aead_non_psa
-psa/aead_psa
+psa/aead_demo
psa/crypto_examples
psa/hmac_demo
psa/key_ladder_demo
diff --git a/programs/CMakeLists.txt b/programs/CMakeLists.txt
index a8492c6..0633aa6 100644
--- a/programs/CMakeLists.txt
+++ b/programs/CMakeLists.txt
@@ -1,4 +1,5 @@
add_subdirectory(aes)
+add_subdirectory(cipher)
if (NOT WIN32)
add_subdirectory(fuzz)
endif()
diff --git a/programs/Makefile b/programs/Makefile
index d2f7d8d..fccddc6 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -62,6 +62,7 @@
## make sure to check that it still works if you tweak the format here.
APPS = \
aes/crypt_and_hash \
+ cipher/aead_demo \
hash/generic_sum \
hash/hello \
hash/hmac_demo \
@@ -85,8 +86,7 @@
pkey/rsa_sign_pss \
pkey/rsa_verify \
pkey/rsa_verify_pss \
- psa/aead_non_psa \
- psa/aead_psa \
+ psa/aead_demo \
psa/crypto_examples \
psa/hmac_demo \
psa/key_ladder_demo \
@@ -177,6 +177,10 @@
echo " CC aes/crypt_and_hash.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) aes/crypt_and_hash.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
+cipher/aead_demo$(EXEXT): cipher/aead_demo.c $(DEP)
+ echo " CC cipher/aead_demo.c"
+ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) cipher/aead_demo.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
+
hash/generic_sum$(EXEXT): hash/generic_sum.c $(DEP)
echo " CC hash/generic_sum.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) hash/generic_sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
@@ -269,13 +273,9 @@
echo " CC pkey/rsa_encrypt.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_encrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
-psa/aead_non_psa$(EXEXT): psa/aead_non_psa.c $(DEP)
- echo " CC psa/aead_non_psa.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) psa/aead_non_psa.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
-
-psa/aead_psa$(EXEXT): psa/aead_psa.c $(DEP)
- echo " CC psa/aead_psa.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) psa/aead_psa.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
+psa/aead_demo$(EXEXT): psa/aead_demo.c $(DEP)
+ echo " CC psa/aead_demo.c"
+ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) psa/aead_demo.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
psa/crypto_examples$(EXEXT): psa/crypto_examples.c $(DEP)
echo " CC psa/crypto_examples.c"
diff --git a/programs/cipher/CMakeLists.txt b/programs/cipher/CMakeLists.txt
new file mode 100644
index 0000000..cc16849
--- /dev/null
+++ b/programs/cipher/CMakeLists.txt
@@ -0,0 +1,13 @@
+set(executables
+ aead_demo
+)
+
+foreach(exe IN LISTS executables)
+ add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
+ target_link_libraries(${exe} ${mbedcrypto_target})
+ target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include)
+endforeach()
+
+install(TARGETS ${executables}
+ DESTINATION "bin"
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
diff --git a/programs/psa/aead_non_psa.c b/programs/cipher/aead_demo.c
similarity index 96%
rename from programs/psa/aead_non_psa.c
rename to programs/cipher/aead_demo.c
index 00c7f0e..894225d 100644
--- a/programs/psa/aead_non_psa.c
+++ b/programs/cipher/aead_demo.c
@@ -4,7 +4,7 @@
* This program AEAD-encrypts a message, using the algorithm and key size
* specified on the command line, using the multi-part API.
*
- * It comes with a companion program aead_psa.c, which does the same
+ * It comes with a companion program psa/aead_demo.c, which does the same
* operations with the PSA Crypto API. The goal is that comparing the two
* programs will help people migrating to the PSA Crypto API.
*
@@ -18,7 +18,7 @@
* On the other hand, with PSA, the algorithms encodes the desired tag length;
* with Cipher the desired tag length needs to be tracked separately.
*
- * This program and its companion aead_psa.c illustrate this by doing the
+ * This program and its companion psa/aead_demo.c illustrate this by doing the
* same sequence of multi-part AEAD computation with both APIs; looking at the
* two side by side should make the differences and similarities clear.
*/
@@ -66,7 +66,7 @@
/* The real program starts here. */
-const char usage[] = "Usage: aead_psa [aes128-gcm|aes256-gcm|aes128-gcm_8|chachapoly]";
+const char usage[] = "Usage: aead_demo [aes128-gcm|aes256-gcm|aes128-gcm_8|chachapoly]";
/* Dummy data for encryption: IV/nonce, additional data, 2-part message */
const unsigned char iv1[12] = { 0x00 };
diff --git a/programs/psa/CMakeLists.txt b/programs/psa/CMakeLists.txt
index 37192e3..7ba4af6 100644
--- a/programs/psa/CMakeLists.txt
+++ b/programs/psa/CMakeLists.txt
@@ -1,6 +1,5 @@
set(executables
- aead_non_psa
- aead_psa
+ aead_demo
crypto_examples
hmac_demo
key_ladder_demo
diff --git a/programs/psa/aead_psa.c b/programs/psa/aead_demo.c
similarity index 97%
rename from programs/psa/aead_psa.c
rename to programs/psa/aead_demo.c
index 2f0663d..4c7a522 100644
--- a/programs/psa/aead_psa.c
+++ b/programs/psa/aead_demo.c
@@ -4,7 +4,7 @@
* This program AEAD-encrypts a message, using the algorithm and key size
* specified on the command line, using the multi-part API.
*
- * It comes with a companion program aead_non_psa.c, which does the same
+ * It comes with a companion program cipher/aead_demo.c, which does the same
* operations with the legacy Cipher API. The goal is that comparing the two
* programs will help people migrating to the PSA Crypto API.
*
@@ -18,7 +18,7 @@
* On the other hand, with PSA, the algorithms encodes the desired tag length;
* with Cipher the desired tag length needs to be tracked separately.
*
- * This program and its companion aead_non_psa.c illustrate this by doing the
+ * This program and its companion cipher/aead_demo.c illustrate this by doing the
* same sequence of multi-part AEAD computation with both APIs; looking at the
* two side by side should make the differences and similarities clear.
*/
@@ -68,7 +68,7 @@
/* The real program starts here. */
-const char usage[] = "Usage: aead_psa [aes128-gcm|aes256-gcm|aes128-gcm_8|chachapoly]";
+const char usage[] = "Usage: aead_demo [aes128-gcm|aes256-gcm|aes128-gcm_8|chachapoly]";
/* Dummy data for encryption: IV/nonce, additional data, 2-part message */
const unsigned char iv1[12] = { 0x00 };