From 689309c4ac40f01b93f29d66282d044c10d8e2e1 Mon Sep 17 00:00:00 2001 From: Lei He Date: Wed, 25 May 2022 17:01:16 +0800 Subject: test/crypto: Add test suite for crypto akcipher Add unit test and benchmark test for crypto akcipher. Signed-off-by: lei he Signed-off-by: zhenwei pi Signed-off-by: Daniel P. Berrangé --- crypto/akcipher-nettle.c.inc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'crypto') 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; } -- cgit v1.2.3-55-g7522