Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aescrypt2 shows bad practice #1906

Closed
gilles-peskine-arm opened this issue Jul 30, 2018 · 1 comment · Fixed by #4437
Closed

aescrypt2 shows bad practice #1906

gilles-peskine-arm opened this issue Jul 30, 2018 · 1 comment · Fixed by #4437
Labels
bug component-crypto Crypto primitives and low-level interfaces

Comments

@gilles-peskine-arm
Copy link
Contributor

The very first sample program in alphabetical order, programs/aes/aescrypt2.c, exhibits several bad practices. It rolls its own CBC mode on top of ECB. It does AEAD by combining AES-CBC with HMAC (at least it does encrypt-then-mac). It rolls its own key stretching by iterating SHA-256.

We should replace this by a program that illustrates best practices, and possibly by one or more other programs that illustrate how to use the low-level functions but not to implement dodgy schemes.

This is a bug, even though the program works, because people who don't know better may copy the code, and it gives a bad impression of the library to people who do know better.

@gilles-peskine-arm gilles-peskine-arm added bug component-crypto Crypto primitives and low-level interfaces labels Jul 30, 2018
@ciarmcom
Copy link

ARM Internal Ref: IOTSSL-2519

gilles-peskine-arm added a commit to gilles-peskine-arm/mbedtls that referenced this issue Feb 26, 2019
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
gilles-peskine-arm added a commit to gilles-peskine-arm/mbedtls that referenced this issue Feb 26, 2019
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
gilles-peskine-arm added a commit to gilles-peskine-arm/mbedtls that referenced this issue Feb 26, 2019
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
gilles-peskine-arm added a commit to gilles-peskine-arm/mbedtls that referenced this issue Feb 26, 2019
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
gilles-peskine-arm added a commit to gilles-peskine-arm/mbedtls that referenced this issue Feb 26, 2019
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
gilles-peskine-arm added a commit to gilles-peskine-arm/mbedtls that referenced this issue Feb 27, 2019
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
gilles-peskine-arm added a commit to gilles-peskine-arm/mbedtls that referenced this issue Feb 27, 2019
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
gilles-peskine-arm added a commit to gilles-peskine-arm/mbedtls that referenced this issue Apr 3, 2020
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
gilles-peskine-arm added a commit to gilles-peskine-arm/mbedtls that referenced this issue Apr 3, 2020
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]>
gilles-peskine-arm added a commit to gilles-peskine-arm/mbedtls that referenced this issue Apr 23, 2020
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]>
gilles-peskine-arm added a commit to gilles-peskine-arm/mbedtls that referenced this issue Mar 10, 2021
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]>
gilles-peskine-arm added a commit to gilles-peskine-arm/mbedtls that referenced this issue Mar 10, 2021
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]>
gilles-peskine-arm added a commit to gilles-peskine-arm/mbedtls that referenced this issue Apr 28, 2021
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]>
gilles-peskine-arm added a commit to gilles-peskine-arm/mbedtls that referenced this issue Apr 28, 2021
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component-crypto Crypto primitives and low-level interfaces
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants