diff options
author | Lei He | 2022-05-25 11:01:16 +0200 |
---|---|---|
committer | Daniel P. Berrangé | 2022-05-26 12:41:54 +0200 |
commit | 689309c4ac40f01b93f29d66282d044c10d8e2e1 (patch) | |
tree | 9a75b33987272e807772b720ec4203127cd2415c /crypto | |
parent | crypto: Implement RSA algorithm by gcrypt (diff) | |
download | qemu-689309c4ac40f01b93f29d66282d044c10d8e2e1.tar.gz qemu-689309c4ac40f01b93f29d66282d044c10d8e2e1.tar.xz qemu-689309c4ac40f01b93f29d66282d044c10d8e2e1.zip |
test/crypto: Add test suite for crypto akcipher
Add unit test and benchmark test for crypto akcipher.
Signed-off-by: lei he <helei.sig11@bytedance.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/akcipher-nettle.c.inc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crypto/akcipher-nettle.c.inc b/crypto/akcipher-nettle.c.inc index a7c0c6a1ee..02699e6e6d 100644 --- a/crypto/akcipher-nettle.c.inc +++ b/crypto/akcipher-nettle.c.inc @@ -171,14 +171,14 @@ static int qcrypto_nettle_rsa_encrypt(QCryptoAkCipher *akcipher, int ret = -1; if (data_len > rsa->pub.size) { - error_setg(errp, "Plaintext length %zu is greater than key size: %zu" + error_setg(errp, "Plaintext length %zu is greater than key size: %zu", data_len, rsa->pub.size); return ret; } if (enc_len < rsa->pub.size) { error_setg(errp, "Ciphertext buffer length %zu is less than " - "key size: %zu", rsa->pub.size); + "key size: %zu", enc_len, rsa->pub.size); return ret; } @@ -218,7 +218,7 @@ static int qcrypto_nettle_rsa_decrypt(QCryptoAkCipher *akcipher, if (enc_len > rsa->priv.size) { error_setg(errp, "Ciphertext length %zu is greater than key size: %zu", - rsa->priv.size); + enc_len, rsa->priv.size); return ret; } @@ -264,13 +264,13 @@ static int qcrypto_nettle_rsa_sign(QCryptoAkCipher *akcipher, if (data_len > rsa->priv.size) { error_setg(errp, "Data length %zu is greater than key size: %zu", - rsa->priv.size); + data_len, rsa->priv.size); return ret; } if (sig_len < rsa->priv.size) { error_setg(errp, "Signature buffer length %zu is less than " - "key size: %zu", rsa->priv.size); + "key size: %zu", sig_len, rsa->priv.size); return ret; } @@ -330,12 +330,12 @@ static int qcrypto_nettle_rsa_verify(QCryptoAkCipher *akcipher, } if (data_len > rsa->pub.size) { error_setg(errp, "Data length %zu is greater than key size: %zu", - rsa->pub.size); + data_len, rsa->pub.size); return ret; } if (sig_len < rsa->pub.size) { error_setg(errp, "Signature length %zu is greater than key size: %zu", - rsa->pub.size); + sig_len, rsa->pub.size); return ret; } |