Commit graph

2471 commits

Author SHA1 Message Date
Thomas Daubney
d8453bb184 Remove superfluous comment
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-10-11 15:29:02 +01:00
Thomas Daubney
cd79f77439 Add missing newline
Newline character was missing from end of print
statement.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-10-11 15:28:13 +01:00
Thomas Daubney
1c2378b8b1 Add variable for message length
Add variable to store message length to increase
clarity in what the program is doing.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-10-11 15:19:38 +01:00
Thomas Daubney
34500874ce Remove trailing white space in documentation
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-10-11 10:04:54 +01:00
Thomas Daubney
760538885a Inform user when unknown hash algorithm supplied
Excplictly inform the user that their hash algorithm
selection is invalid.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-10-10 17:38:53 +01:00
Thomas Daubney
86f9795b00 Update documentation
Add further information about PSA hashing to the
comment at the beginning of the code.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-10-10 16:50:49 +01:00
Thomas Daubney
a68ef95394 Check length before calling memcmp
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-08-07 11:09:51 +01:00
Thomas Daubney
102033c38d Add new line at end of file to satisfy code style
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-08-03 16:20:09 +01:00
Thomas Daubney
5c2dcbd250 Implement cleanup label
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-08-03 16:03:30 +01:00
Thomas Daubney
21fbe4c90e Remove further superfluous call to psa_hash_abort
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-08-03 15:39:42 +01:00
Thomas Daubney
1ba9744afb Correct code style
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-28 17:25:16 +01:00
Thomas Daubney
c918c32cc0 Stop hashing the null byte
Change the hash data to not include the null byte used to terminate
the string. Pass sizeof() - 1 to the hash operation API functions
so that the null byte can be ignored.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-28 17:15:03 +01:00
Thomas Daubney
fbe742b2d0 Add extra check to one-shot operation results
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-28 16:17:38 +01:00
Thomas Daubney
ce14124f7c Check result of multipart operation
Check that the multi-part operation has produced
the correct result.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-28 16:14:20 +01:00
Thomas Daubney
606110fc19 Restructure start of program
Restructure the start of the program to make it
clear to a user exactly what this program is for.
Add a comment for additional clarity.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-28 15:57:10 +01:00
Thomas Daubney
1f98736e71 Add clarifying comment to new program section
Mark the beginning of the section that prints
the result with a comment.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-28 15:23:06 +01:00
Thomas Daubney
a2b7519d63 Use memcmp instead of reinventing it
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-28 15:21:46 +01:00
Thomas Daubney
9730cb1274 Change hash output formatting
Change the formatting of the hash output
to remove line breaks and spaces.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-28 15:07:19 +01:00
Thomas Daubney
c07fa29b58 Change wording in error message
Change wording from "failed" since this implied the
function had returned an error status instead of
producing the wrong result.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-28 14:58:55 +01:00
Thomas Daubney
3071c85835 Clarify comments
Clarify comments when moving into one-shot part
of demo.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-28 14:47:47 +01:00
Thomas Daubney
c050037c08 Remove mbedtls_ and psa_ prefix from var names
Remove the mbedtls and psa prefixes from variable
names in order to make clearer what is part of
the API and what is just part of the demo program.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-28 14:44:25 +01:00
Thomas Daubney
a79f806225 Remove superfluous calls to psa_hash_abort
Calls were not required since psa_hash_setup was yet
to be called.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-28 14:33:20 +01:00
Thomas Daubney
6fc4ca2d85 Replace hash_size with hash_length
This is to make the variable naming covnention align
with the PSA API documentation.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-28 14:31:06 +01:00
Thomas Daubney
2c872340e8 Fix erroneous macro guards
Replace MBEDTLS_SHA256_C for PSA_WANT_ALG_SHA_256
everywhere, including comments and print statements.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-28 14:21:38 +01:00
Thomas Daubney
1fd916a1a3 Address review comments
- make operation name more generic
- make use of psa_hash_abort

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-25 16:10:48 +01:00
Thomas Daubney
9520df7580 Fix code style
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-25 10:56:54 +01:00
Thomas Daubney
1db78fa32a Demonstrate algorithm agility
Define HALH_ALG to the desired PSA algorithm
to demostrate the ease of swapping algorithms
with the PSA API.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-24 16:49:14 +01:00
Thomas Daubney
f7348ae1fc Improve program from first round review comments
Following an initial review:
- Swap printf for mbedtls_printf
- Remove MBEDTLS_xxx dependencies
- Demonstrate correct buffer sizing

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-24 12:18:40 +01:00
Thomas Daubney
209c9c9492 Bring code-style up-to-date
This PR was originally created before the code
style was changed. This commit updates the style.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-18 14:59:45 +01:00
Hannes Tschofenig
f8b9ebf297 Add example program for PSA hash
This commit adds the example program for PSA
hash as well as the relevant changes to
CMakeLists.txt and the Makefile.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-07-18 13:55:36 +01:00
Manuel Pégourié-Gonnard
828b3acd6b
Merge pull request #7848 from valeriosetti/issue7749
driver-only ECC: EPCf.TLS testing
2023-07-18 10:33:21 +02:00
Dave Rodgman
91d9daf2b3
Merge pull request #7925 from hasheddan/dtls-server-order
Fix order of steps in DTLS server example program
2023-07-17 09:41:43 +01:00
Daniel Mangum
af2f7a6fcb Fix order of steps in DTLS server example program
Fixes the numbered order of steps in the DTLS server example program.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2023-07-14 12:00:33 -04:00
Valerio Setti
dda0019e2e ssl_test_lib: fix rebase error
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-10 10:22:51 +02:00
Valerio Setti
5bdebb2004 ssl_test_lib: fix variable naming for curve group
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-10 09:13:57 +02:00
Valerio Setti
fb6356f003 ssl_test_lib: simplify function which prints supported curves
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-10 09:13:57 +02:00
Valerio Setti
deb676442d ssl_test_lib: manage FFDH keys the same way as ECC ones
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-10 09:13:57 +02:00
Valerio Setti
acd32c005f programs: add helper functions for supported EC curves
- get full list, or
- get TLS ID from name

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-10 09:13:57 +02:00
Manuel Pégourié-Gonnard
461d59b2f8
Merge pull request #7858 from mprse/ffdh_tls13_v2_f
Make use of FFDH keys in TLS 1.3 - follow-up
2023-07-07 16:19:35 +02:00
Dave Rodgman
c4749b1c66
Merge pull request #7584 from gilles-peskine-arm/fuzz-file-open-fail
Fuzz programs: print an error if loading the reproducer fails
2023-07-07 11:51:59 +01:00
Przemek Stekiel
68e7544de8 parse_groups: curve -> group adaptations
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-07-06 12:16:44 +02:00
Przemek Stekiel
45255e4c71 Adapt names (curves -> groups)
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-07-05 09:26:26 +02:00
Manuel Pégourié-Gonnard
56b159a12a
Merge pull request #7627 from mprse/ffdh_tls13_v2
Make use of FFDH keys in TLS 1.3 v.2
2023-07-03 10:12:33 +02:00
Dave Rodgman
c23d2222ea
Merge pull request #7728 from waleed-elmelegy-arm/crypt_and_hash-decrypt-fix
Fix crypt_and_hash decrypt issue when used with stream cipher
2023-06-30 11:42:35 +01:00
Paul Elliott
458b96b1a7
Merge pull request #7638 from AndrzejKurek/cert-apps-use-ips
Use better IP parsing in x509 apps
2023-06-20 17:21:04 +01:00
Przemek Stekiel
7d42c0d0e5 Code cleanup #2
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-13 12:30:40 +02:00
Przemek Stekiel
75a5a9c205 Code cleanup
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-13 09:57:23 +02:00
Waleed Elmelegy
46549cb5fa Replace function calls in crypt_and_hash program with locals
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-06-12 14:53:02 +01:00
Waleed Elmelegy
7d39cc410c Fix crypt_and_hash decrypt issue when used with stream cipher
crypt_and_hash decryption fails when used with a stream cipher
mode of operation due to the input not being multiple of block
size, this only applies to block cipher modes and not stream
ciphers.This change exempts CTR, CFB & OFB modes from this check.

Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-06-09 16:58:23 +01:00
Dave Rodgman
05d71ffe5b Merge remote-tracking branch 'origin/development' into sha3-updated 2023-06-07 18:02:04 +01:00