qemu-devel
[Top][All Lists]
Advanced

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

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


From: Richard Henderson
Subject: Re: [PULL 54/54] crypto: Introduce RSA algorithm
Date: Fri, 10 Jun 2022 11:05:13 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

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~



reply via email to

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