On 6/11/22 02:05, Richard Henderson wrote:
On 6/10/22 08:55, Philippe Mathieu-Daudé wrote:
On 10/6/22 09:59, Michael S. Tsirkin wrote:
From: zhenwei pi <pizhen...@bytedance.com>
+static int cryptodev_builtin_set_rsa_options(
+ int virtio_padding_algo,
+ int virtio_hash_algo,
+ QCryptoAkCipherOptionsRSA *opt,
+ Error **errp)
+{
+ if (virtio_padding_algo == VIRTIO_CRYPTO_RSA_PKCS1_PADDING) {
+ opt->padding_alg = QCRYPTO_RSA_PADDING_ALG_PKCS1;
+ opt->hash_alg =
+ cryptodev_builtin_get_rsa_hash_algo(virtio_hash_algo,
errp);
+ if (opt->hash_alg < 0) {
+ return -1;
+ }
+ return 0;
+ }
+
+ if (virtio_padding_algo == VIRTIO_CRYPTO_RSA_RAW_PADDING) {
+ opt->padding_alg = QCRYPTO_RSA_PADDING_ALG_RAW;
+ return 0;
+ }
+
+ error_setg(errp, "Unsupported rsa padding algo: %d",
virtio_padding_algo);
+ return -1;
+}
Build failure:
../backends/cryptodev-builtin.c:187:27: error: result of comparison of
unsigned enum expression < 0 is always false
[-Werror,-Wtautological-unsigned-enum-zero-compare]
if (opt->hash_alg < 0) {
~~~~~~~~~~~~~ ^ ~
Yep, e.g.
https://gitlab.com/qemu-project/qemu/-/jobs/2574418442
r~
I checked this building log, and noticed that clang-13 reports this
error. I tested this by clang-11(from Debian10). Sadly, clang-11 did not
report this.
I'll fix&test this patch by clang-13, then send this patch again.
Thanks!
--
zhenwei pi