qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dorjoy Chowdhury <dorjoychy111@gmail.com>
To: qemu-devel@nongnu.org
Cc: graf@amazon.com, agraf@csgraf.de, stefanha@redhat.com,
	pbonzini@redhat.com, slp@redhat.com,
	richard.henderson@linaro.org, eduardo@habkost.net,
	mst@redhat.com, marcel.apfelbaum@gmail.com, berrange@redhat.com,
	philmd@linaro.org
Subject: [PATCH v5 1/8] crypto: Define macros for hash algorithm digest lengths
Date: Thu, 22 Aug 2024 21:08:42 +0600	[thread overview]
Message-ID: <20240822150849.21759-2-dorjoychy111@gmail.com> (raw)
In-Reply-To: <20240822150849.21759-1-dorjoychy111@gmail.com>

Signed-off-by: Dorjoy Chowdhury <dorjoychy111@gmail.com>
---
 crypto/hash.c         | 14 +++++++-------
 include/crypto/hash.h |  8 ++++++++
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/crypto/hash.c b/crypto/hash.c
index b0f8228bdc..8087f5dae6 100644
--- a/crypto/hash.c
+++ b/crypto/hash.c
@@ -23,13 +23,13 @@
 #include "hashpriv.h"
 
 static size_t qcrypto_hash_alg_size[QCRYPTO_HASH_ALG__MAX] = {
-    [QCRYPTO_HASH_ALG_MD5] = 16,
-    [QCRYPTO_HASH_ALG_SHA1] = 20,
-    [QCRYPTO_HASH_ALG_SHA224] = 28,
-    [QCRYPTO_HASH_ALG_SHA256] = 32,
-    [QCRYPTO_HASH_ALG_SHA384] = 48,
-    [QCRYPTO_HASH_ALG_SHA512] = 64,
-    [QCRYPTO_HASH_ALG_RIPEMD160] = 20,
+    [QCRYPTO_HASH_ALG_MD5]       = QCRYPTO_HASH_DIGEST_LEN_MD5,
+    [QCRYPTO_HASH_ALG_SHA1]      = QCRYPTO_HASH_DIGEST_LEN_SHA1,
+    [QCRYPTO_HASH_ALG_SHA224]    = QCRYPTO_HASH_DIGEST_LEN_SHA224,
+    [QCRYPTO_HASH_ALG_SHA256]    = QCRYPTO_HASH_DIGEST_LEN_SHA256,
+    [QCRYPTO_HASH_ALG_SHA384]    = QCRYPTO_HASH_DIGEST_LEN_SHA384,
+    [QCRYPTO_HASH_ALG_SHA512]    = QCRYPTO_HASH_DIGEST_LEN_SHA512,
+    [QCRYPTO_HASH_ALG_RIPEMD160] = QCRYPTO_HASH_DIGEST_LEN_RIPEMD160,
 };
 
 size_t qcrypto_hash_digest_len(QCryptoHashAlgorithm alg)
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index 54d87aa2a1..a113cc3b04 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -23,6 +23,14 @@
 
 #include "qapi/qapi-types-crypto.h"
 
+#define QCRYPTO_HASH_DIGEST_LEN_MD5       16
+#define QCRYPTO_HASH_DIGEST_LEN_SHA1      20
+#define QCRYPTO_HASH_DIGEST_LEN_SHA224    28
+#define QCRYPTO_HASH_DIGEST_LEN_SHA256    32
+#define QCRYPTO_HASH_DIGEST_LEN_SHA384    48
+#define QCRYPTO_HASH_DIGEST_LEN_SHA512    64
+#define QCRYPTO_HASH_DIGEST_LEN_RIPEMD160 20
+
 /* See also "QCryptoHashAlgorithm" defined in qapi/crypto.json */
 
 /**
-- 
2.39.2



  reply	other threads:[~2024-08-22 15:10 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-22 15:08 [PATCH v5 0/8] AWS Nitro Enclave emulation support Dorjoy Chowdhury
2024-08-22 15:08 ` Dorjoy Chowdhury [this message]
2024-08-28 15:33   ` [PATCH v5 1/8] crypto: Define macros for hash algorithm digest lengths Daniel P. Berrangé
2024-08-22 15:08 ` [PATCH v5 2/8] crypto: Support SHA384 hash when using glib Dorjoy Chowdhury
2024-08-22 15:08 ` [PATCH v5 3/8] crypto: Introduce x509 utils Dorjoy Chowdhury
2024-08-22 15:08 ` [PATCH v5 4/8] tests/lcitool: Update libvirt-ci and add libcbor dependency Dorjoy Chowdhury
2024-08-28 15:34   ` Daniel P. Berrangé
2024-08-22 15:08 ` [PATCH v5 5/8] device/virtio-nsm: Support for Nitro Secure Module device Dorjoy Chowdhury
2024-08-28 18:28   ` Michael S. Tsirkin
2024-08-28 19:04     ` Dorjoy Chowdhury
2024-08-28 19:11       ` Michael S. Tsirkin
2024-09-03 19:58         ` Dorjoy Chowdhury
2024-09-03 20:32           ` Michael S. Tsirkin
2024-09-03 20:47             ` Dorjoy Chowdhury
2024-09-04 18:30               ` Dorjoy Chowdhury
2024-09-04 20:27                 ` Michael S. Tsirkin
2024-09-04 20:45                   ` Dorjoy Chowdhury
2024-08-22 15:08 ` [PATCH v5 6/8] hw/core: Add Enclave Image Format (EIF) related helpers Dorjoy Chowdhury
2024-08-28 15:42   ` Daniel P. Berrangé
2024-08-22 15:08 ` [PATCH v5 7/8] machine/nitro-enclave: New machine type for AWS Nitro Enclaves Dorjoy Chowdhury
2024-08-28 15:39   ` Daniel P. Berrangé
2024-08-28 15:50     ` Dorjoy Chowdhury
2024-08-29  8:14       ` Daniel P. Berrangé
2024-09-05 20:00         ` Dorjoy Chowdhury
2024-08-22 15:08 ` [PATCH v5 8/8] docs/nitro-enclave: Documentation for nitro-enclave machine type Dorjoy Chowdhury
2024-09-05 20:03 ` [PATCH v5 0/8] AWS Nitro Enclave emulation support Dorjoy Chowdhury

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240822150849.21759-2-dorjoychy111@gmail.com \
    --to=dorjoychy111@gmail.com \
    --cc=agraf@csgraf.de \
    --cc=berrange@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=graf@amazon.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=slp@redhat.com \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).