Gilles Peskine
28cd41676e
Fix possible error code mangling in psa_mac_verify_finish
...
If psa_mac_finish_internal fails (which can only happen due to bad
parameters or hardware problem), the error code was converted to
PSA_ERROR_INVALID_SIGNATURE if the uninitialized stack variable
actual_mac happened to contain the expected MAC. This is a minor bug
but it may be possible to leverage it as part of a longer attack path
in some scenarios.
Reported externally. Found by static analysis.
2020-01-20 16:31:06 +01:00
Janos Follath
83f33d33eb
Bump version to Mbed TLS 2.20.0
2020-01-20 14:52:29 +00:00
Jaeden Amero
dbcb44202c
Update Mbed Crypto to 3.0.0
2020-01-15 18:08:44 +00:00
Jaeden Amero
d56a2af3f8
Add date to ChangeLog for 2.20.0 release
2020-01-15 18:07:20 +00:00
Janos Follath
dbd3304e8f
Merge branch 'development' into development-restricted
2020-01-15 16:06:15 +00:00
Janos Follath
d27a88438f
Merge branch 'development' into development-restricted
2020-01-15 15:55:11 +00:00
Jaeden Amero
a337167543
Merge pull request #342 from Patater/reseed-counter-value-comment
...
ctr_drbg: Clarify reseed_counter values before seeding
2020-01-10 13:49:33 +00:00
Jaeden Amero
a15c71374b
ctr_drbg: Clarify reseed_counter values before seeding
...
Before the initial seeding, reseed_counter used to always be 0. Now, the
value depends on whether or not the user has explicitly set the amount
of data to get from the nonce (via e.g.
mbedtls_ctr_drbg_set_nonce_len()). Add comments to clarify the possible
values reseed_counter can have before the initial seeding.
2020-01-09 13:48:52 +00:00
Manuel Pégourié-Gonnard
1e6fb01448
Make SHA512_NO_SHA384 depend on SHA512_C
2020-01-07 11:00:34 +01:00
Manuel Pégourié-Gonnard
86a39bdbc5
Improve readability of test dependencies
...
- Always put MBEDTLS_SHA512_NO_SHA384 immediately after MBEDTLS_SHA512_C
- Remove duplicate occurrences of MBEDTLS_SHA512_NO_SHA384 on the same line
2020-01-07 10:24:17 +01:00
Manuel Pégourié-Gonnard
2d88549c6b
Improve readability of macro in selftest
2020-01-07 10:17:35 +01:00
Manuel Pégourié-Gonnard
0b9db441c8
Make optional parameter validation more precise
2020-01-07 10:14:54 +01:00
Manuel Pégourié-Gonnard
792b16d83b
Make more code paths conditional in psa_crypto.c
2020-01-07 10:13:18 +01:00
Manuel Pégourié-Gonnard
663ee2019a
Clarify documentation on is384.
2020-01-07 10:11:22 +01:00
Manuel Pégourié-Gonnard
20f236de37
Adjust depends-hashes.pl to test NO_SHA384 as well
2020-01-06 11:40:23 +01:00
Manuel Pégourié-Gonnard
d602084cde
Implement NO_SHA384 in MD layer and PSA
2020-01-06 11:40:23 +01:00
Manuel Pégourié-Gonnard
6ba5a3fc57
Declare test dependencies on !SHA512_NO_SHA384
2020-01-06 11:40:23 +01:00
Manuel Pégourié-Gonnard
39ea19a35c
Adapt sha512 selftest to NO_SHA384 option
2020-01-06 11:40:23 +01:00
Manuel Pégourié-Gonnard
3df4e60561
Implement SHA512_NO_SHA384 in sha512 module
...
Saves 140 bytes on sha512.o, measured with:
arm-none-eabi-gcc -Wall -Wextra -Iinclude -Os -mcpu=cortex-m0plus -mthumb -c library/sha512.c && arm-none-eabi-size sha512.o
arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2018-q2-update) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
Todo:
- fix selftest
- fix dependencies in test suites
- implement in MD layer
2020-01-06 11:40:23 +01:00
Manuel Pégourié-Gonnard
ad6cb11461
Declare new config.h option MBEDTLS_SHA512_NO_SHA384
2020-01-06 11:40:23 +01:00
Jaeden Amero
252faff19f
Merge pull request #2966 from dgreen-arm/fix-pylint-warnings
...
Sideport: Fix some pylint warnings
2019-12-20 16:07:07 +00:00
Jaeden Amero
448d1cc854
Merge pull request #334 from dgreen-arm/fix-pylint-warnings
...
Fix some pylint warnings
2019-12-20 16:06:53 +00:00
Darryl Green
fb5faa2582
Fix some pylint warnings
...
Add docstrings where they were missing and fix a too-long line
2019-12-20 15:14:59 +00:00
Darryl Green
1822061093
Fix some pylint warnings
...
Add docstrings where they were missing and fix a too-long line
2019-12-20 15:13:45 +00:00
Gilles Peskine
180850a229
Merge pull request #291 from gilles-peskine-arm/ctr_drbg-test_aes_128
...
Test MBEDTLS_CTR_DRBG_USE_128_BIT_KEY
2019-12-20 10:43:44 +01:00
Jaeden Amero
ccdeb47cdf
Merge pull request #2958 from yanesca/iotcrypt-942-initialise-return-values
...
Initialize return values to an error
2019-12-19 11:33:03 +00:00
Janos Follath
73c616bdc1
Put includes in alphabetical order
...
The library style is to start with the includes corresponding to the
current module and then the rest in alphabetical order. Some modules
have several header files (eg. ssl_internal.h).
The recently added error.h includes did not respect this convention and
this commit restores it. In some cases this is not possible just by
moving the error.h declarations. This commit fixes the pre-existing
order in these instances too.
2019-12-19 10:27:57 +00:00
Janos Follath
df587ee6d6
Remove duplicate include statement
...
Now that the Error module has error codes as well and is processed by
the generate_errors script like any other module, we don't need to
include the header manually.
2019-12-19 10:27:57 +00:00
Janos Follath
d8752858fc
Update crypto submodule
2019-12-19 10:27:04 +00:00
Jaeden Amero
795c6bab62
Merge pull request #323 from yanesca/iotcrypt-942-initialise-return-values
...
Initialise return values to an error
2019-12-19 10:24:22 +00:00
Jaeden Amero
40f923ecf7
Merge pull request #2961 from RonEld/update_readme_to_vs_2012
...
Update the VS version in the Readme file
2019-12-18 13:43:05 +00:00
Ron Eldor
05b44892c0
Change the version of VS
...
Change the miniaml version to the correct one - 2013. Revet the
VS version in the tests to 2010, since the solution file
hasn't been updated yet.
2019-12-18 14:28:18 +02:00
Ron Eldor
c5074be0ce
Update the VS version in the Readme file
...
Update the VS version in the README file to 2012, as this is the
minimal version supported.
2019-12-18 14:00:13 +02:00
Janos Follath
865b3ebf84
Initialize return values to an error
...
Initializing the return values to an error is best practice and makes
the library more robust against programmer errors.
2019-12-16 15:15:16 +00:00
Janos Follath
2d20567122
Add two error codes to the Error module
...
One of the error codes was already reserved, this commit just makes it
explicit. The other one is a new error code for initializing return
values in the library: `MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED` should
not be returned by the library. If it is returned, then it is surely a
bug in the library or somebody is tampering with the device.
2019-12-16 15:15:16 +00:00
Jaeden Amero
16027956cd
Merge pull request #333 from gilles-peskine-arm/psa-streamline_encodings-prepare_for_types
...
Streamline PSA key type encodings: prepare
2019-12-13 09:39:03 +00:00
Janos Follath
ab534cfd62
Fix number of allocated errors in Platform
2019-12-12 14:34:30 +00:00
Janos Follath
9c2ccd2e7a
Fix error code range in documentation
2019-12-12 14:24:46 +00:00
Jaeden Amero
88d1c05644
Merge pull request #2953 from gilles-peskine-arm/update-crypto-20191206
...
Update crypto submodule
2019-12-12 12:17:11 +00:00
Gilles Peskine
4cd3277656
Factor common code of psa_import_ec_{public,private}_key
2019-12-12 09:00:27 +01:00
Gilles Peskine
46c33801f3
Remove unused macros
2019-12-12 09:00:27 +01:00
Gilles Peskine
7a1925c453
Add a few EC public key import/export test cases
...
Test a Brainpool curve and a curve whose bit size is not a multiple of 8.
2019-12-12 09:00:27 +01:00
Gilles Peskine
f8210f2bd5
Test the block size for symmetric keys
...
Also insist on their category.
Fix a missing implementation of PSA_BLOCK_CIPHER_BLOCK_SIZE for
ChaCha20.
2019-12-12 09:00:27 +01:00
Gilles Peskine
92f2da9d67
More precise descriptions for format and parse tests
2019-12-12 09:00:27 +01:00
Gilles Peskine
fb745bf618
Fix memory failure handling in test_format_storage_data_check
...
Fail the test instead of crashing if a memory allocation fails.
Free memory even if the test fails.
2019-12-12 09:00:26 +01:00
Gilles Peskine
667c111416
Sanity checks for key attributes in exercise_key
2019-12-12 09:00:26 +01:00
Gilles Peskine
325584889d
Add option to show what values are tested
...
This is useful to inspect what the script does manually, in particular
to check that expected values do get tested. --keep-c provides the
same information but in a way that's harder to access.
2019-12-11 11:03:07 +01:00
Gilles Peskine
49af2d3a4f
Support non-ASCII characters in headers
...
Filter out non-ASCII characters in automatically processed headers.
Do this in a way that minimizes the code change: keep manipulating
strings, but strip off non-ASCII characters when reading lines, which
should only remove characters in comments that we don't parse anyway.
2019-12-11 11:03:07 +01:00
Jaeden Amero
caf88ff8f5
Merge pull request #2938 from yanesca/iotssl-2954-custom-io-unit-test
...
Mock TCP sockets and callbacks for SSL unit tests
2019-12-10 09:49:59 +00:00
Jaeden Amero
1a61d455e9
Merge pull request #2841 from k-stachowiak/improve-memory-operation-clarity
...
Improve clarity of a memory operation call
2019-12-09 19:54:29 +02:00