OSDN Git Service

crypto: testmgr - split akcipher tests by a key type
authorVitaly Chikunov <vt@altlinux.org>
Mon, 7 Jan 2019 17:54:27 +0000 (20:54 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 18 Jan 2019 10:40:24 +0000 (18:40 +0800)
commit0507de9404992edafa3d1d86450a37d6a726399d
tree681b8d55bf606da4438939d7b23ca545eca0c5d7
parent2b091e32a2d357beb9ffe283c696eec104729c2a
crypto: testmgr - split akcipher tests by a key type

Before this, if akcipher_testvec have `public_key_vec' set to true
(i.e. having a public key) only sign/encrypt test is performed, but
verify/decrypt test is skipped.

With a public key we could do encrypt and verify, but to sign and decrypt
a private key is required.

This logic is correct for encrypt/decrypt tests (decrypt is skipped if
no private key). But incorrect for sign/verify tests - sign is performed
no matter if there is no private key, but verify is skipped if there is
a public key.

Rework `test_akcipher_one' to arrange tests properly depending on value
of `public_key_vec` and `siggen_sigver_test'.

No tests were missed since there is only one sign/verify test (which
have `siggen_sigver_test' set to true) and it has a private key, but
future tests could benefit from this improvement.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/testmgr.c