You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PKCS12, aka RFC 7292, is a standard for, among other things, representing private keys, possibly encrypted with a password. We implement part of this standard in pkcs12.c and optionally use it in pkparse.c to parse those types of encrypted keys. It uses iterated hashing in order to derive an encryption key from a password. Currently this uses MD, which means it doesn't work in builds where hashes are provided only by drivers; this task is to make it work.
In mbedtls_pkcs12_derivation() use mbedtls_hash_info_get_size() (from library/hash_info.h) instead of mbedtls_md_get_size().
In the same function, reduce the scope of md_ctx and md_info to the beginning of the while loop if possible, or preferably extract the code that computes to a new static function. (Note: this is similar to the creation of hash_mprime() in Driver hashes rsa v21 #6141 and is a preparation for the next point.)
Provide an implementation of the new static function (or code block inside mbedtls_pkcs12_derivation()) based on PSA, to be used only when MD_C is not available (in order to preserve backwards compatibility: the PSA version requires psa_crypto_init() to have been called, we don't want to impose this requirement on existing code, but we can impose it in builds where this just didn't work at all before). (Again, this is similar to hash_mprime() in Driver hashes rsa v21 #6141.)
Adjust the dependency in check_config.h: PKCS12 now only requires MD_C || PSA_CRYPTO_C.
Remove the unset PKCS12_C lines from all.sh components component_test_crypto_full_no_md() and component_test_psa_crypto_config_accel_hash_use_psa().
Adjust dependencies in test_suite_pkcs12.data, replacing MBEDTLS_MD5_C with MBEDTLS_HAS_ALG_MD5_VIA_MD_OR_PSA (from legacy_or_psa.h which needs to be #included in the .function file).
Similarly adjust hash dependencies in test_suite_pkparse.data for tests that depend on PKCS12_C (again, legacy_or_psa.h needs to be #included in the .function file).
Fix any issue that may arise.
Check test coverage for test_suite_pkcs5 and test_suite_pkparse: see docs/architecture/psa-migration/outcome-analysis.sh (don't forget to remove unset PKCS12_C in reference_config() and edit SUITES in your copy).
The text was updated successfully, but these errors were encountered:
PKCS12, aka RFC 7292, is a standard for, among other things, representing private keys, possibly encrypted with a password. We implement part of this standard in
pkcs12.c
and optionally use it inpkparse.c
to parse those types of encrypted keys. It uses iterated hashing in order to derive an encryption key from a password. Currently this uses MD, which means it doesn't work in builds where hashes are provided only by drivers; this task is to make it work.mbedtls_pkcs12_derivation()
usembedtls_hash_info_get_size()
(fromlibrary/hash_info.h
) instead ofmbedtls_md_get_size()
.md_ctx
andmd_info
to the beginning of thewhile
loop if possible, or preferably extract the code that computes to a new static function. (Note: this is similar to the creation ofhash_mprime()
in Driver hashes rsa v21 #6141 and is a preparation for the next point.)mbedtls_pkcs12_derivation()
) based on PSA, to be used only whenMD_C
is not available (in order to preserve backwards compatibility: the PSA version requirespsa_crypto_init()
to have been called, we don't want to impose this requirement on existing code, but we can impose it in builds where this just didn't work at all before). (Again, this is similar tohash_mprime()
in Driver hashes rsa v21 #6141.)check_config.h
: PKCS12 now only requiresMD_C || PSA_CRYPTO_C
.unset PKCS12_C
lines fromall.sh
componentscomponent_test_crypto_full_no_md()
andcomponent_test_psa_crypto_config_accel_hash_use_psa()
.test_suite_pkcs12.data
, replacingMBEDTLS_MD5_C
withMBEDTLS_HAS_ALG_MD5_VIA_MD_OR_PSA
(fromlegacy_or_psa.h
which needs to be#include
d in the.function
file).test_suite_pkparse.data
for tests that depend onPKCS12_C
(again,legacy_or_psa.h
needs to be#include
d in the.function
file).test_suite_pkcs5
andtest_suite_pkparse
: seedocs/architecture/psa-migration/outcome-analysis.sh
(don't forget to removeunset PKCS12_C
inreference_config()
and editSUITES
in your copy).The text was updated successfully, but these errors were encountered: