From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Stefan Weil" <sw@weilnetz.de>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Willian Rampazzo" <willianr@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>
Subject: [PATCH 04/12] crypto: drop back compatibility typedefs for nettle
Date: Tue, 11 May 2021 14:26:33 +0100 [thread overview]
Message-ID: <20210511132641.1022161-5-berrange@redhat.com> (raw)
In-Reply-To: <20210511132641.1022161-1-berrange@redhat.com>
Now that we only support modern nettle, we don't need to have local
typedefs to mask the real nettle types.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
crypto/cipher-nettle.c.inc | 60 ++++++++++++++++----------------------
crypto/hash-nettle.c | 6 ++--
crypto/hmac-nettle.c | 8 ++---
3 files changed, 30 insertions(+), 44 deletions(-)
diff --git a/crypto/cipher-nettle.c.inc b/crypto/cipher-nettle.c.inc
index 490472656c..fc6f40c026 100644
--- a/crypto/cipher-nettle.c.inc
+++ b/crypto/cipher-nettle.c.inc
@@ -34,16 +34,6 @@
#include <nettle/xts.h>
#endif
-typedef void (*QCryptoCipherNettleFuncWrapper)(const void *ctx,
- size_t length,
- uint8_t *dst,
- const uint8_t *src);
-
-typedef nettle_cipher_func * QCryptoCipherNettleFuncNative;
-typedef const void * cipher_ctx_t;
-typedef size_t cipher_length_t;
-#define CONST_CTX const
-
static inline bool qcrypto_length_check(size_t len, size_t blocksize,
Error **errp)
{
@@ -166,12 +156,12 @@ static const struct QCryptoCipherDriver NAME##_driver_ctr = { \
static void NAME##_xts_wrape(const void *ctx, size_t length, \
uint8_t *dst, const uint8_t *src) \
{ \
- ENCRYPT((cipher_ctx_t)ctx, length, dst, src); \
+ ENCRYPT((const void *)ctx, length, dst, src); \
} \
static void NAME##_xts_wrapd(const void *ctx, size_t length, \
uint8_t *dst, const uint8_t *src) \
{ \
- DECRYPT((cipher_ctx_t)ctx, length, dst, src); \
+ DECRYPT((const void *)ctx, length, dst, src); \
} \
static int NAME##_encrypt_xts(QCryptoCipher *cipher, const void *in, \
void *out, size_t len, Error **errp) \
@@ -251,13 +241,13 @@ typedef struct QCryptoNettleDESRFB {
uint8_t iv[DES_BLOCK_SIZE];
} QCryptoNettleDESRFB;
-static void des_encrypt_native(cipher_ctx_t ctx, cipher_length_t length,
+static void des_encrypt_native(const void *ctx, size_t length,
uint8_t *dst, const uint8_t *src)
{
des_encrypt(ctx, length, dst, src);
}
-static void des_decrypt_native(cipher_ctx_t ctx, cipher_length_t length,
+static void des_decrypt_native(const void *ctx, size_t length,
uint8_t *dst, const uint8_t *src)
{
des_decrypt(ctx, length, dst, src);
@@ -273,13 +263,13 @@ typedef struct QCryptoNettleDES3 {
uint8_t iv[DES3_BLOCK_SIZE];
} QCryptoNettleDES3;
-static void des3_encrypt_native(cipher_ctx_t ctx, cipher_length_t length,
+static void des3_encrypt_native(const void *ctx, size_t length,
uint8_t *dst, const uint8_t *src)
{
des3_encrypt(ctx, length, dst, src);
}
-static void des3_decrypt_native(cipher_ctx_t ctx, cipher_length_t length,
+static void des3_decrypt_native(const void *ctx, size_t length,
uint8_t *dst, const uint8_t *src)
{
des3_decrypt(ctx, length, dst, src);
@@ -296,17 +286,17 @@ typedef struct QCryptoNettleAES128 {
struct aes128_ctx key[2], key_xts[2];
} QCryptoNettleAES128;
-static void aes128_encrypt_native(cipher_ctx_t ctx, cipher_length_t length,
+static void aes128_encrypt_native(const void *ctx, size_t length,
uint8_t *dst, const uint8_t *src)
{
- CONST_CTX struct aes128_ctx *keys = ctx;
+ const struct aes128_ctx *keys = ctx;
aes128_encrypt(&keys[0], length, dst, src);
}
-static void aes128_decrypt_native(cipher_ctx_t ctx, cipher_length_t length,
+static void aes128_decrypt_native(const void *ctx, size_t length,
uint8_t *dst, const uint8_t *src)
{
- CONST_CTX struct aes128_ctx *keys = ctx;
+ const struct aes128_ctx *keys = ctx;
aes128_decrypt(&keys[1], length, dst, src);
}
@@ -322,17 +312,17 @@ typedef struct QCryptoNettleAES192 {
struct aes192_ctx key[2], key_xts[2];
} QCryptoNettleAES192;
-static void aes192_encrypt_native(cipher_ctx_t ctx, cipher_length_t length,
+static void aes192_encrypt_native(const void *ctx, size_t length,
uint8_t *dst, const uint8_t *src)
{
- CONST_CTX struct aes192_ctx *keys = ctx;
+ const struct aes192_ctx *keys = ctx;
aes192_encrypt(&keys[0], length, dst, src);
}
-static void aes192_decrypt_native(cipher_ctx_t ctx, cipher_length_t length,
+static void aes192_decrypt_native(const void *ctx, size_t length,
uint8_t *dst, const uint8_t *src)
{
- CONST_CTX struct aes192_ctx *keys = ctx;
+ const struct aes192_ctx *keys = ctx;
aes192_decrypt(&keys[1], length, dst, src);
}
@@ -348,17 +338,17 @@ typedef struct QCryptoNettleAES256 {
struct aes256_ctx key[2], key_xts[2];
} QCryptoNettleAES256;
-static void aes256_encrypt_native(cipher_ctx_t ctx, cipher_length_t length,
+static void aes256_encrypt_native(const void *ctx, size_t length,
uint8_t *dst, const uint8_t *src)
{
- CONST_CTX struct aes256_ctx *keys = ctx;
+ const struct aes256_ctx *keys = ctx;
aes256_encrypt(&keys[0], length, dst, src);
}
-static void aes256_decrypt_native(cipher_ctx_t ctx, cipher_length_t length,
- uint8_t *dst, const uint8_t *src)
+static void aes256_decrypt_native(const void *ctx, size_t length,
+ uint8_t *dst, const uint8_t *src)
{
- CONST_CTX struct aes256_ctx *keys = ctx;
+ const struct aes256_ctx *keys = ctx;
aes256_decrypt(&keys[1], length, dst, src);
}
@@ -373,13 +363,13 @@ typedef struct QCryptoNettleCAST128 {
struct cast128_ctx key, key_xts;
} QCryptoNettleCAST128;
-static void cast128_encrypt_native(cipher_ctx_t ctx, cipher_length_t length,
+static void cast128_encrypt_native(const void *ctx, size_t length,
uint8_t *dst, const uint8_t *src)
{
cast128_encrypt(ctx, length, dst, src);
}
-static void cast128_decrypt_native(cipher_ctx_t ctx, cipher_length_t length,
+static void cast128_decrypt_native(const void *ctx, size_t length,
uint8_t *dst, const uint8_t *src)
{
cast128_decrypt(ctx, length, dst, src);
@@ -397,13 +387,13 @@ typedef struct QCryptoNettleSerpent {
} QCryptoNettleSerpent;
-static void serpent_encrypt_native(cipher_ctx_t ctx, cipher_length_t length,
+static void serpent_encrypt_native(const void *ctx, size_t length,
uint8_t *dst, const uint8_t *src)
{
serpent_encrypt(ctx, length, dst, src);
}
-static void serpent_decrypt_native(cipher_ctx_t ctx, cipher_length_t length,
+static void serpent_decrypt_native(const void *ctx, size_t length,
uint8_t *dst, const uint8_t *src)
{
serpent_decrypt(ctx, length, dst, src);
@@ -420,13 +410,13 @@ typedef struct QCryptoNettleTwofish {
struct twofish_ctx key, key_xts;
} QCryptoNettleTwofish;
-static void twofish_encrypt_native(cipher_ctx_t ctx, cipher_length_t length,
+static void twofish_encrypt_native(const void *ctx, size_t length,
uint8_t *dst, const uint8_t *src)
{
twofish_encrypt(ctx, length, dst, src);
}
-static void twofish_decrypt_native(cipher_ctx_t ctx, cipher_length_t length,
+static void twofish_decrypt_native(const void *ctx, size_t length,
uint8_t *dst, const uint8_t *src)
{
twofish_decrypt(ctx, length, dst, src);
diff --git a/crypto/hash-nettle.c b/crypto/hash-nettle.c
index 5c8977fb80..1ca1a41062 100644
--- a/crypto/hash-nettle.c
+++ b/crypto/hash-nettle.c
@@ -26,14 +26,12 @@
#include <nettle/sha.h>
#include <nettle/ripemd160.h>
-typedef size_t hash_length_t;
-
typedef void (*qcrypto_nettle_init)(void *ctx);
typedef void (*qcrypto_nettle_write)(void *ctx,
- hash_length_t len,
+ size_t len,
const uint8_t *buf);
typedef void (*qcrypto_nettle_result)(void *ctx,
- hash_length_t len,
+ size_t len,
uint8_t *buf);
union qcrypto_hash_ctx {
diff --git a/crypto/hmac-nettle.c b/crypto/hmac-nettle.c
index da6b6fa014..1ad6c4f253 100644
--- a/crypto/hmac-nettle.c
+++ b/crypto/hmac-nettle.c
@@ -18,18 +18,16 @@
#include "hmacpriv.h"
#include <nettle/hmac.h>
-typedef size_t hmac_length_t;
-
typedef void (*qcrypto_nettle_hmac_setkey)(void *ctx,
- hmac_length_t key_length,
+ size_t key_length,
const uint8_t *key);
typedef void (*qcrypto_nettle_hmac_update)(void *ctx,
- hmac_length_t length,
+ size_t length,
const uint8_t *data);
typedef void (*qcrypto_nettle_hmac_digest)(void *ctx,
- hmac_length_t length,
+ size_t length,
uint8_t *digest);
typedef struct QCryptoHmacNettle QCryptoHmacNettle;
--
2.31.1
next prev parent reply other threads:[~2021-05-11 13:31 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-11 13:26 [PATCH 00/12] Wave goodbye to RHEL 7 vintage distros Daniel P. Berrangé
2021-05-11 13:26 ` [PATCH 01/12] gitlab: move linux user build job from CentOS 7 to CentOS 8 Daniel P. Berrangé
2021-05-11 13:54 ` Thomas Huth
2021-05-11 14:04 ` Daniel P. Berrangé
2021-05-12 16:19 ` Philippe Mathieu-Daudé
2021-05-12 16:28 ` Peter Maydell
2021-05-11 13:26 ` [PATCH 02/12] patchew: move quick build job from CentOS 7 to CentOS 8 container Daniel P. Berrangé
2021-05-11 13:57 ` Thomas Huth
2021-05-11 13:26 ` [PATCH 03/12] crypto: bump min nettle to 3.3, dropping RHEL-7 support Daniel P. Berrangé
2021-05-11 14:01 ` Thomas Huth
2021-05-11 20:56 ` Willian Rampazzo
2021-05-12 0:40 ` Richard Henderson
2021-05-11 13:26 ` Daniel P. Berrangé [this message]
2021-05-11 14:03 ` [PATCH 04/12] crypto: drop back compatibility typedefs for nettle Thomas Huth
2021-05-12 0:40 ` Richard Henderson
2021-05-11 13:26 ` [PATCH 05/12] crypto: bump min gcrypt to 1.7.6, dropping RHEL-7 support Daniel P. Berrangé
2021-05-11 14:06 ` Thomas Huth
2021-05-11 20:58 ` Willian Rampazzo
2021-05-12 0:40 ` Richard Henderson
2021-05-11 13:26 ` [PATCH 06/12] crypto: bump min gnutls to 3.5.8, " Daniel P. Berrangé
2021-05-11 14:07 ` Thomas Huth
2021-05-11 20:59 ` Willian Rampazzo
2021-05-12 0:39 ` Richard Henderson
2021-05-11 13:26 ` [PATCH 07/12] crypto: drop used conditional check Daniel P. Berrangé
2021-05-11 21:01 ` Willian Rampazzo
2021-05-12 0:41 ` Richard Henderson
2021-05-11 13:26 ` [PATCH 08/12] tests/vm: convert centos VM recipe to CentOS 8 Daniel P. Berrangé
2021-05-11 15:04 ` Daniel P. Berrangé
2021-05-11 13:26 ` [PATCH 09/12] tests/docker: drop CentOS 7 container Daniel P. Berrangé
2021-05-11 14:09 ` Thomas Huth
2021-05-11 14:25 ` Alex Bennée
2021-05-11 20:52 ` Willian Rampazzo
2021-05-11 13:26 ` [PATCH 10/12] bump min required glib version to 2.50 Daniel P. Berrangé
2021-05-11 14:11 ` Thomas Huth
2021-05-11 21:03 ` Willian Rampazzo
2021-05-11 13:26 ` [PATCH 11/12] configure: bump min required GCC to 6.3.0 Daniel P. Berrangé
2021-05-11 14:15 ` Thomas Huth
2021-05-11 14:31 ` Daniel P. Berrangé
2021-05-11 21:04 ` Willian Rampazzo
2021-05-12 0:43 ` Richard Henderson
2021-05-11 13:26 ` [PATCH 12/12] configure: bump min required CLang to 7.0.0 / XCode 10.2 Daniel P. Berrangé
2021-05-11 14:18 ` Thomas Huth
2021-05-11 14:32 ` Daniel P. Berrangé
2021-05-11 21:05 ` Willian Rampazzo
2021-05-12 0:44 ` Richard Henderson
2021-05-12 11:44 ` Philippe Mathieu-Daudé
2021-05-12 11:53 ` non-x86 runners in the Gitlab-CI (was: Re: [PATCH 12/12] configure: bump min required CLang to 7.0.0 / XCode 10.2) Thomas Huth
2021-05-12 13:47 ` Willian Rampazzo
2021-05-12 13:55 ` Thomas Huth
2021-05-12 13:59 ` Willian Rampazzo
2021-05-12 14:33 ` Thomas Huth
2021-05-12 14:00 ` Daniel P. Berrangé
2021-05-12 14:51 ` Philippe Mathieu-Daudé
2021-05-12 15:29 ` Daniel P. Berrangé
2021-05-12 12:25 ` [PATCH 12/12] configure: bump min required CLang to 7.0.0 / XCode 10.2 Daniel P. Berrangé
2021-05-12 14:10 ` Philippe Mathieu-Daudé
2021-05-12 14:43 ` Daniel P. Berrangé
2021-05-11 14:33 ` [PATCH 00/12] Wave goodbye to RHEL 7 vintage distros Thomas Huth
2021-05-13 10:05 ` Daniel P. Berrangé
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=20210511132641.1022161-5-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=f4bug@amsat.org \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
--cc=thuth@redhat.com \
--cc=wainersm@redhat.com \
--cc=willianr@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).