David Horstmann
7cdfda12da
Fixup: Correct signedness of val local variable
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-22 18:27:59 +00:00
David Horstmann
0f4ee418d8
Use return for errors only in oid_parse_number()
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-22 18:27:59 +00:00
David Horstmann
59400ffed5
Improve header docs and rename parameter
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-22 18:27:59 +00:00
David Horstmann
03329970de
Correct error in processing of second component
...
Root nodes 0 and 1 may have up to 40 children (0 - 39), not 39 children
(0 - 38) as previously thought.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-22 18:27:59 +00:00
David Horstmann
18ec9d7da1
Change some error codes to be more accurate
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-22 18:27:59 +00:00
David Horstmann
0f852c9277
Add tests for OID parsing from string
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-22 18:27:58 +00:00
David Horstmann
92337c0e62
Add function to parse an OID from a string
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-22 16:34:26 +00:00
Janos Follath
406b9172ad
Merge pull request #7044 from minosgalanakis/bignum/6342_add_named_moduli_setup
...
Bignum: Add named moduli setup
2023-02-22 12:14:33 +00:00
Gilles Peskine
ffb92b0789
Merge pull request #7105 from davidhorstmann-arm/fix-oid-printing-bug
...
Fix bugs in OID to string conversion
2023-02-21 23:16:44 +01:00
Gilles Peskine
88f8eb5844
Merge pull request #7091 from paul-elliott-arm/remove_gcc_warning
...
Fix warning with GCC 12
2023-02-21 23:14:29 +01:00
Paul Elliott
48c591cb56
Fix warning with GCC 12
...
Fix warning about variable being used uninitialised.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-21 16:31:56 +00:00
Gilles Peskine
250a5ac4cb
Merge pull request #7095 from paul-elliott-arm/interruptible_sign_hash_codestyle
...
Implement PSA interruptible sign/verify hash
2023-02-21 15:13:34 +01:00
Dave Rodgman
e42cedf256
Merge pull request #7077 from daverodgman/pkcs7-fixes-dm-rebased
...
Pkcs7 fixes
2023-02-21 11:53:30 +00:00
Gilles Peskine
6df4a9b297
Merge pull request #7045 from lpy4105/issue/6947/apply-exclusions-in-code_style_py
...
code_style.py: Apply exclusions when restyling a list of files
2023-02-21 10:11:13 +01:00
David Horstmann
a4fad2ba67
Correct error code in test_suite_x509parse.data
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-20 14:57:47 +00:00
Dave Rodgman
716163e824
Improve allocation bounds in testing
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-20 14:46:51 +00:00
Dave Rodgman
a1b2bfff46
Add clarifying comments
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-20 14:45:09 +00:00
David Horstmann
5b5a0b618c
Change error codes to more appropriate codes
...
The more precise error codes are borrowed from the ASN1 module.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-20 14:24:12 +00:00
Minos Galanakis
a30afe2216
ecp_curves: Minor refactoring.
...
This patch introduces the following changes:
* Documentation for `mbedtls_ecp_modulus_setup()`
moved to `ecp_invasive.h`.
* Added invalid modulus selector `MBEDTLS_ECP_MOD_NONE`.
* Adjusted negative tests to use invalid selectors.
* Reworded documentation.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-02-20 13:53:06 +00:00
Minos Galanakis
36f7c0e69b
test_suite_ecp: Added .data for ecp_setup_test()
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-02-20 13:51:49 +00:00
Minos Galanakis
9a1d02d738
test_suite_ecp: Added test for mbedtls_ecp_modulus_setup()
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-02-20 13:51:48 +00:00
Minos Galanakis
dd556921c9
ecp_curves: Exposed mbedtls_ecp_modulus_setup()
through ecp_invasive.h
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-02-20 13:50:41 +00:00
Minos Galanakis
d2ca802329
ecp_curves: Added mbedtls_ecp_modulus_setup()
.
...
This patch introduces a new static method, responsible
for automatically initialising an modulus structure,
based on the curve id and a modulus type selector.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-02-20 13:49:46 +00:00
Janos Follath
ec718afb41
Merge pull request #7051 from gabor-mezei-arm/6376_Secp521r1_fast_reduction
...
Add a raw entry point to Secp521r1 fast reduction
2023-02-20 13:03:12 +00:00
Manuel Pégourié-Gonnard
718eb4f190
Merge pull request #7025 from AndrzejKurek/uri_san
...
Add the uniformResourceIdentifier subtype for the subjectAltName
2023-02-20 11:29:59 +01:00
Paul Elliott
f8e5b56ad8
Fix get_num_ops internal code.
...
Previously calling get_num_ops more than once would have ended up with ops
getting double counted, and not calling inbetween completes would have ended up
with ops getting missed. Fix this by moving this to where the work is actually
done, and add tests for double calls to get_num_ops().
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-19 18:55:10 +00:00
Gabor Mezei
ac70ad6576
Fix coding style
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-02-16 19:31:21 +01:00
Dave Rodgman
d652dce9ea
Add failing test case (invalid signature) for zero-length data
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-16 16:39:34 +00:00
Dave Rodgman
fc64352253
Adjust position of empty line
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-16 16:23:09 +00:00
Dave Rodgman
c5874db5b0
Add test-case for signature over zero-length data
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-16 16:14:46 +00:00
Paul Elliott
0af1b5367b
Remove some abbrevations from test descriptions.
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-16 12:15:39 +00:00
Paul Elliott
96b89b208a
Add comment to indicate non-PSA spec assertion.
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-16 12:15:39 +00:00
Paul Elliott
5686533ba2
Add warning to mbedtls_ecp_set_max_ops()
...
Using PSA interruptible interfaces will cause previously set values to be
overwritten.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-16 12:15:39 +00:00
Paul Elliott
21c3951139
Add reference to mbedtls_ecp_set_max_ops() to docs
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-16 12:15:39 +00:00
Paul Elliott
f1743e2440
Add verify call to max ops tests
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-16 12:15:39 +00:00
Paul Elliott
ba70ad4944
Add safety for keys larger than we currently support.
...
Prevent buffer overflow with keys whos grp.nbits is greater than
PSA_VENDOR_ECC_MAX_CURVE_BITS.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-16 12:15:39 +00:00
Paul Elliott
93d9ca83ea
Move num_ops ECP abstraction fully into internal implementation
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-16 12:15:39 +00:00
Andrzej Kurek
81b0b89a34
Clarify comments on subjectAltName types
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-02-16 06:55:10 -05:00
Gabor Mezei
2c8e144ef6
Fix tests for 32bit
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-02-16 10:25:08 +01:00
Paul Elliott
c86d45e8a1
Remove spurious incorrect comment
...
Comment originated from original version of this code, and the newer comment
which was added when it was pulled into a seperate function covers all cases.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-15 23:34:29 +00:00
Paul Elliott
2c9843f2a4
Make mbedtls_sa_ecp_load_public_part return psa_status_t
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-15 23:34:29 +00:00
Paul Elliott
efebad0d67
Run extra complete in failure tests regardless.
...
We do not need to expect to fail, running another complete in either sign or
verify after successful completion should also return BAD_STATE.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-15 23:34:29 +00:00
Paul Elliott
7ef174b285
Correct insufficient memory return documentation.
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-15 23:34:29 +00:00
Paul Elliott
a1c9409d88
Move structure init calls as early as possible
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-15 23:34:29 +00:00
Paul Elliott
ebe225cf7b
Move num ops update to only point where work can be done.
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-15 23:34:29 +00:00
Paul Elliott
53bb312054
Wipe output buffer even when INCOMPLETE is returned.
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-15 23:34:29 +00:00
Paul Elliott
c569fc268f
Switch from nbits to pbits
...
Correct coordinate size is grp.nbits, not grp.pbits.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-15 23:34:29 +00:00
Paul Elliott
6d99f0c265
Fix errors in psa_wipe_output_buffer() doc comment.
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-15 23:34:29 +00:00
Paul Elliott
fe9e77ff7a
Better formatting of include guard comments
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-15 23:34:29 +00:00
Paul Elliott
0290a76fc2
Fix buffer overflow with hashes larger than key size.
...
Truncate input hashes to curve private key size as that is all that is required
for the internal implementation.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-15 23:34:29 +00:00