Skip to content

Commit 646424e

Browse files
Code review fixes
Reverting some deleted tests and changing the deprecated algo Deleting deprecated headers from /alt-dummy dir Corrections to the comments Removal of deleted functions from compat-2.x.h Corrections to tests/data_files/Makefile Signed-off-by: TRodziewicz <[email protected]>
1 parent 08af16b commit 646424e

File tree

10 files changed

+131
-122
lines changed

10 files changed

+131
-122
lines changed

doxygen/input/doc_hashing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* \c mbedtls_md_setup())
3535
*
3636
* The following hashing-algorithms are provided:
37-
* - MD5 128-bit one-way hash functions by Ron Rivest.
37+
* - MD5 128-bit one-way hash function by Ron Rivest.
3838
* - SHA-1, SHA-256, SHA-384/512 160-bit or more one-way hash functions by
3939
* NIST and NSA.
4040
*

include/mbedtls/compat-2.x.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@
3434
*/
3535
#define mbedtls_ctr_drbg_update_ret mbedtls_ctr_drbg_update
3636
#define mbedtls_hmac_drbg_update_ret mbedtls_hmac_drbg_update
37-
#define mbedtls_md2_starts_ret mbedtls_md2_starts
38-
#define mbedtls_md2_update_ret mbedtls_md2_update
39-
#define mbedtls_md2_finish_ret mbedtls_md2_finish
40-
#define mbedtls_md2_ret mbedtls_md2
41-
#define mbedtls_md4_starts_ret mbedtls_md4_starts
42-
#define mbedtls_md4_update_ret mbedtls_md4_update
43-
#define mbedtls_md4_finish_ret mbedtls_md4_finish
44-
#define mbedtls_md4_ret mbedtls_md4
4537
#define mbedtls_md5_starts_ret mbedtls_md5_starts
4638
#define mbedtls_md5_update_ret mbedtls_md5_update
4739
#define mbedtls_md5_finish_ret mbedtls_md5_finish

include/mbedtls/config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@
335335
//#define MBEDTLS_ECP_ALT
336336

337337
/**
338+
* \def MBEDTLS_SHA256_PROCESS_ALT
339+
*
338340
* MBEDTLS__FUNCTION_NAME__ALT: Uncomment a macro to let mbed TLS use you
339341
* alternate core implementation of symmetric crypto or hash function. Keep in
340342
* mind that function prototypes should remain the same.

library/ssl_ciphersuites.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
/*
3939
* Ordered from most preferred to least preferred in terms of security.
4040
*
41-
* Current rule (except RC4 and 3DES, weak and null which come last):
41+
* Current rule (except weak and null which come last):
4242
* 1. By key exchange:
4343
* Forward-secure non-PSK > forward-secure PSK > ECJPAKE > other non-PSK > other PSK
4444
* 2. By key length and cipher:

tests/data_files/Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,8 @@ rsa_pkcs8_pbe_sha1_1024_2des.pem: rsa_pkcs1_1024_clear.pem
416416
all_final += rsa_pkcs8_pbe_sha1_1024_2des.pem
417417
keys_rsa_enc_pkcs8_v1_1024_2des: rsa_pkcs8_pbe_sha1_1024_2des.pem rsa_pkcs8_pbe_sha1_1024_2des.der
418418

419+
keys_rsa_enc_pkcs8_v1_1024: keys_rsa_enc_pkcs8_v1_1024_3des keys_rsa_enc_pkcs8_v1_1024_2des
420+
419421
### 2048-bit
420422
rsa_pkcs8_pbe_sha1_2048_3des.der: rsa_pkcs1_2048_clear.pem
421423
$(OPENSSL) pkcs8 -inform PEM -in $< -outform DER -out $@ -passout "pass:$(keys_rsa_pkcs8_pwd)" -topk8 -v1 PBE-SHA1-3DES
@@ -433,6 +435,8 @@ rsa_pkcs8_pbe_sha1_2048_2des.pem: rsa_pkcs1_2048_clear.pem
433435
all_final += rsa_pkcs8_pbe_sha1_2048_2des.pem
434436
keys_rsa_enc_pkcs8_v1_2048_2des: rsa_pkcs8_pbe_sha1_2048_2des.pem rsa_pkcs8_pbe_sha1_2048_2des.der
435437

438+
keys_rsa_enc_pkcs8_v1_2048: keys_rsa_enc_pkcs8_v1_2048_3des keys_rsa_enc_pkcs8_v1_2048_2des
439+
436440
### 4096-bit
437441
rsa_pkcs8_pbe_sha1_4096_3des.der: rsa_pkcs1_4096_clear.pem
438442
$(OPENSSL) pkcs8 -inform PEM -in $< -outform DER -out $@ -passout "pass:$(keys_rsa_pkcs8_pwd)" -topk8 -v1 PBE-SHA1-3DES
@@ -450,6 +454,8 @@ rsa_pkcs8_pbe_sha1_4096_2des.pem: rsa_pkcs1_4096_clear.pem
450454
all_final += rsa_pkcs8_pbe_sha1_4096_2des.pem
451455
keys_rsa_enc_pkcs8_v1_4096_2des: rsa_pkcs8_pbe_sha1_4096_2des.pem rsa_pkcs8_pbe_sha1_4096_2des.der
452456

457+
keys_rsa_enc_pkcs8_v1_4096: keys_rsa_enc_pkcs8_v1_4096_3des keys_rsa_enc_pkcs8_v1_4096_2des
458+
453459
###
454460
### PKCS8-v2 encoded, encrypted RSA keys, no PRF specified (default for OpenSSL1.0: hmacWithSHA1)
455461
###
@@ -863,10 +869,6 @@ server1.req.sha1: server1.key
863869
$(MBEDTLS_CERT_REQ) output_file=$@ filename=$< subject_name="C=NL,O=PolarSSL,CN=PolarSSL Server 1" md=SHA1
864870
all_final += server1.req.sha1
865871

866-
server1.req.md4: server1.key
867-
$(MBEDTLS_CERT_REQ) output_file=$@ filename=$< subject_name="C=NL,O=PolarSSL,CN=PolarSSL Server 1" md=MD4
868-
all_final += server1.req.md4
869-
870872
server1.req.md5: server1.key
871873
$(MBEDTLS_CERT_REQ) output_file=$@ filename=$< subject_name="C=NL,O=PolarSSL,CN=PolarSSL Server 1" md=MD5
872874
all_final += server1.req.md5

tests/suites/test_suite_ccm.data

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ CCM init #3 AES-224: bad key size
1313
depends_on:MBEDTLS_AES_C
1414
mbedtls_ccm_setkey:MBEDTLS_CIPHER_ID_AES:224:MBEDTLS_ERR_CCM_BAD_INPUT
1515

16+
CCM init #4 BLOWFISH-128: bad block size
17+
depends_on:MBEDTLS_DES_C
18+
mbedtls_ccm_setkey:MBEDTLS_CIPHER_ID_DES:128:MBEDTLS_ERR_CCM_BAD_INPUT
19+
1620
CCM lengths #1 all OK
1721
ccm_lengths:5:10:5:8:0
1822

tests/suites/test_suite_pkparse.data

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -984,31 +984,31 @@ Parse EC Key #5c (PKCS8 PEM, with parameters)
984984
depends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED
985985
pk_parse_keyfile_ec:"data_files/ec_prv.pk8param.pem":"NULL":0
986986

987-
Parse EC Key #6 (SEC1 PEM, secp224r1)
987+
Parse EC Key #8 (SEC1 PEM, secp224r1)
988988
depends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP224R1_ENABLED
989989
pk_parse_keyfile_ec:"data_files/ec_224_prv.pem":"NULL":0
990990

991-
Parse EC Key #7 (SEC1 PEM, secp256r1)
991+
Parse EC Key #9 (SEC1 PEM, secp256r1)
992992
depends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED
993993
pk_parse_keyfile_ec:"data_files/ec_256_prv.pem":"NULL":0
994994

995-
Parse EC Key #8 (SEC1 PEM, secp384r1)
995+
Parse EC Key #10 (SEC1 PEM, secp384r1)
996996
depends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED
997997
pk_parse_keyfile_ec:"data_files/ec_384_prv.pem":"NULL":0
998998

999-
Parse EC Key #9 (SEC1 PEM, secp521r1)
999+
Parse EC Key #11 (SEC1 PEM, secp521r1)
10001000
depends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP521R1_ENABLED
10011001
pk_parse_keyfile_ec:"data_files/ec_521_prv.pem":"NULL":0
10021002

1003-
Parse EC Key #10 (SEC1 PEM, bp256r1)
1003+
Parse EC Key #12 (SEC1 PEM, bp256r1)
10041004
depends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_BP256R1_ENABLED
10051005
pk_parse_keyfile_ec:"data_files/ec_bp256_prv.pem":"NULL":0
10061006

1007-
Parse EC Key #11 (SEC1 PEM, bp384r1)
1007+
Parse EC Key #13 (SEC1 PEM, bp384r1)
10081008
depends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_BP384R1_ENABLED
10091009
pk_parse_keyfile_ec:"data_files/ec_bp384_prv.pem":"NULL":0
10101010

1011-
Parse EC Key #12 (SEC1 PEM, bp512r1)
1011+
Parse EC Key #14 (SEC1 PEM, bp512r1)
10121012
depends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_BP512R1_ENABLED
10131013
pk_parse_keyfile_ec:"data_files/ec_bp512_prv.pem":"NULL":0
10141014

tests/suites/test_suite_psa_crypto.data

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,10 @@ PSA MAC setup: bad algorithm (HMAC without specified hash)
11301130
# Either INVALID_ARGUMENT or NOT_SUPPORTED would be reasonable here
11311131
mac_setup:PSA_KEY_TYPE_HMAC:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f":PSA_ALG_HMAC(0):PSA_ERROR_NOT_SUPPORTED
11321132

1133+
PSA MAC setup: bad algorithm (unsupported HMAC hash algorithm)
1134+
depends_on:!PSA_WANT_ALG_MD5
1135+
mac_setup:PSA_KEY_TYPE_HMAC:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f":PSA_ALG_HMAC(PSA_ALG_MD5):PSA_ERROR_NOT_SUPPORTED
1136+
11331137
PSA MAC setup: bad algorithm (not a MAC algorithm)
11341138
depends_on:PSA_WANT_ALG_CBC_NO_PADDING:PSA_WANT_KEY_TYPE_AES
11351139
mac_setup:PSA_KEY_TYPE_AES:"000102030405060708090a0b0c0d0e0f":PSA_ALG_CBC_NO_PADDING:PSA_ERROR_INVALID_ARGUMENT
@@ -1390,6 +1394,11 @@ depends_on:MBEDTLS_CIPHER_MODE_CTR
13901394
# Either INVALID_ARGUMENT or NOT_SUPPORTED would be reasonable here
13911395
cipher_setup:PSA_KEY_TYPE_RAW_DATA:"000102030405060708090a0b0c0d0e0f":PSA_ALG_CTR:PSA_ERROR_NOT_SUPPORTED
13921396

1397+
PSA cipher setup: incompatible key ChaCha20 for CTR
1398+
depends_on:MBEDTLS_ARC4_C:MBEDTLS_CIPHER_MODE_CTR
1399+
# Either INVALID_ARGUMENT or NOT_SUPPORTED would be reasonable here
1400+
cipher_setup:PSA_KEY_TYPE_CHACHA20:"000102030405060708090a0b0c0d0e0f":PSA_ALG_CTR:PSA_ERROR_NOT_SUPPORTED
1401+
13931402
PSA cipher: bad order function calls
13941403
cipher_bad_order:
13951404

0 commit comments

Comments
 (0)