qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: [PULL 54/54] crypto: Introduce RSA algorithm


From: zhenwei pi
Subject: Re: Re: [PULL 54/54] crypto: Introduce RSA algorithm
Date: Sat, 11 Jun 2022 10:03:17 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1



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 <pizhenwei@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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]