4608c48b0c
Same rationale as previous "Rm useless use of MD" commits. Here the first two test functions were already not depending on MD_C, but the new version is much simpler, as it avoids having two versions of the code depending on the value of USE_PSA. Changes to the data file generated with the following Python script: import hashlib suite = 'pk' functions = { 'pk_rsa_verify_test_vec': (2, 1, True), 'pk_rsa_verify_ext_test_vec': (2, 1, True), 'pk_sign_verify_restart': (6, 7, False), } def hash_ctx(s): if s == 'MBEDTLS_MD_MD5': return hashlib.md5() if s == 'MBEDTLS_MD_SHA1': return hashlib.sha1() if s == 'MBEDTLS_MD_SHA224': return hashlib.sha224() if s == 'MBEDTLS_MD_SHA256': return hashlib.sha256() if s == 'MBEDTLS_MD_SHA384': return hashlib.sha384() if s == 'MBEDTLS_MD_SHA512': return hashlib.sha512() if s == 'MBEDTLS_MD_RIPEMD160': return hashlib.new("ripemd160") def fix(l): parts = l.rstrip().split(":") fun = parts[0] if fun not in functions: return l (alg_idx, msg_idx, is_hex) = functions[fun] alg_str = parts[alg_idx] if alg_str == "MBEDTLS_MD_NONE" or alg_str == "255": return l h = hash_ctx(alg_str) msg_str = parts[msg_idx][1:-1] msg = bytes.fromhex(msg_str) if is_hex else bytes(msg_str, 'ascii') h.update(msg) msg_hash = h.hexdigest() msg_hash_str = '"' + msg_hash + '"' parts[msg_idx] = msg_hash_str return ":".join(parts) + '\n' filename = 'tests/suites/test_suite_' + suite + '.data' with open(filename) as f: lines = f.readlines() lines = [fix(l) for l in lines] with open(filename, 'w') as f: f.writelines(lines) Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com> |
||
---|---|---|
.. | ||
.jenkins | ||
configs | ||
data_files | ||
docker/bionic | ||
git-scripts | ||
include | ||
opt-testcases | ||
scripts | ||
src | ||
suites | ||
.gitignore | ||
CMakeLists.txt | ||
compat-in-docker.sh | ||
compat.sh | ||
context-info.sh | ||
Descriptions.txt | ||
make-in-docker.sh | ||
Makefile | ||
ssl-opt-in-docker.sh | ||
ssl-opt.sh |