Skip to content

Commit

Permalink
Remove the sample program aescrypt2
Browse files Browse the repository at this point in the history
The sample program aescrypt2 shows bad practice: hand-rolled CBC
implementation, CBC+HMAC for AEAD, hand-rolled iterated SHA-2 for key
stretching, no algorithm agility. The new sample program pbcrypt does
the same thing, but better. So remove aescrypt2.

Fix Mbed-TLS#1906

Signed-off-by: Gilles Peskine <[email protected]>
  • Loading branch information
gilles-peskine-arm committed Apr 28, 2021
1 parent b5939e8 commit 98b3cd6
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 658 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.d/aescrypt2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Changes
* Remove the AES sample application programs/aes/aescrypt2 which shows
bad cryptographic practice. Fix #1906.
1 change: 0 additions & 1 deletion programs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*.o
*.exe

aes/aescrypt2
aes/crypt_and_hash
hash/generic_sum
hash/hello
Expand Down
5 changes: 0 additions & 5 deletions programs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ LOCAL_LDFLAGS += -lz
endif

APPS = \
aes/aescrypt2$(EXEXT) \
aes/crypt_and_hash$(EXEXT) \
hash/generic_sum$(EXEXT) \
hash/hello$(EXEXT) \
Expand Down Expand Up @@ -139,10 +138,6 @@ $(MBEDLIBS):
${MBEDTLS_TEST_OBJS}:
$(MAKE) -C ../tests mbedtls_test

aes/aescrypt2$(EXEXT): aes/aescrypt2.c $(DEP)
echo " CC aes/aescrypt2.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) aes/aescrypt2.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@

aes/crypt_and_hash$(EXEXT): aes/crypt_and_hash.c $(DEP)
echo " CC aes/crypt_and_hash.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) aes/crypt_and_hash.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Expand Down
3 changes: 0 additions & 3 deletions programs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ This subdirectory mostly contains sample programs that illustrate specific featu

## Symmetric cryptography (AES) examples

* [`aes/aescrypt2.c`](aes/aescrypt2.c): file encryption and authentication with a key derived from a low-entropy secret, demonstrating the low-level AES interface, the digest interface and HMAC.
Warning: this program illustrates how to use low-level functions in the library. It should not be taken as an example of how to build a secure encryption mechanism. To derive a key from a low-entropy secret such as a password, use a standard key stretching mechanism such as PBKDF2 (provided by the `pkcs5` module). To encrypt and authenticate data, use a standard mode such as GCM or CCM (both available as library module).

* [`aes/crypt_and_hash.c`](aes/crypt_and_hash.c): file encryption and authentication, demonstrating the generic cipher interface and the generic hash interface.

## Hash (digest) examples
Expand Down
1 change: 0 additions & 1 deletion programs/aes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
set(executables
aescrypt2
crypt_and_hash
)

Expand Down
Loading

0 comments on commit 98b3cd6

Please sign in to comment.