Page MenuHome GnuPG

0001-cipher-proto-remove-forward-typedef-of-cipher_bulk_o.patch

Authored By
jukivili
Jan 25 2021, 8:27 PM
Size
6 KB
Subscribers
None

0001-cipher-proto-remove-forward-typedef-of-cipher_bulk_o.patch

From 700c7f602143597221198206c103f8cd2de3de3b Mon Sep 17 00:00:00 2001
From: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Date: Mon, 25 Jan 2021 21:17:52 +0200
Subject: [PATCH] cipher-proto: remove forward typedef of cipher_bulk_ops_t
* cipher/cipher-proto (cipher_bulk_ops_t): Remove typedef, leave
forward declaration of 'struct cipher_bulk_ops'.
(gcry_cipher_setkey_t): Change 'bulk_ops' to
'struct cipher_bulk_ops *'.
* cipher/arcfour.c: Include 'cipher-internal.h'.
* cipher/gost28147.c: Ditto.
* cipher/idea.c: Ditto.
* cipher/rfc2268.c: Ditto.
* cipher/salsa20.c: Ditto.
* cipher/seed.c: Ditto.
* cipher/mac-internal.h (CTX_MAGIC_NORMAL): Rename to...
(CTX_MAC_MAGIC_NORMAL): ... this.
(CTX_MAGIC_SECURE): Rename to...
(CTX_MAC_MAGIC_SECURE): ... this.
* cipher/mac-cmac.c (cmac_open): Use CTX_MAC_MAGIC_SECURE.
* cipher/mac-gmac.c (gmac_open): Ditto.
* cipher/mac-hmac.c (hmac_open): Ditto.
* cipher/mac-poly1305.c (poly1305mac_open): Ditto.
* cipher/mac.c (mac_open): Use CTX_MAC_MAGIC_SECURE and
CTX_MAC_MAGIC_NORMAL.
--
CTX_MAC_MAGIC_* change is needed since gost28147.c now includes
both 'cipher-internal.h' and 'mac-internal.h' which both defined
CTX_MAC_MAGIC_* with different values.
GnuPG-bug-id: 5264
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
---
cipher/arcfour.c | 1 +
cipher/gost28147.c | 1 +
cipher/idea.c | 1 +
cipher/mac-cmac.c | 2 +-
cipher/mac-gmac.c | 2 +-
cipher/mac-hmac.c | 2 +-
cipher/mac-internal.h | 4 ++--
cipher/mac-poly1305.c | 2 +-
cipher/mac.c | 2 +-
cipher/rfc2268.c | 1 +
cipher/salsa20.c | 1 +
cipher/seed.c | 1 +
src/cipher-proto.h | 4 ++--
13 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/cipher/arcfour.c b/cipher/arcfour.c
index 9e71857c..353de00b 100644
--- a/cipher/arcfour.c
+++ b/cipher/arcfour.c
@@ -30,6 +30,7 @@
#include "types.h"
#include "g10lib.h"
#include "cipher.h"
+#include "cipher-internal.h"
/* USE_AMD64_ASM indicates whether to use AMD64 assembly code. */
#undef USE_AMD64_ASM
diff --git a/cipher/gost28147.c b/cipher/gost28147.c
index 1bafe317..9445b378 100644
--- a/cipher/gost28147.c
+++ b/cipher/gost28147.c
@@ -35,6 +35,7 @@
#include "cipher.h"
#include "mac-internal.h"
#include "bufhelp.h"
+#include "cipher-internal.h"
#include "gost.h"
#include "gost-sb.h"
diff --git a/cipher/idea.c b/cipher/idea.c
index a503c08f..0a810818 100644
--- a/cipher/idea.c
+++ b/cipher/idea.c
@@ -48,6 +48,7 @@
#include "types.h" /* for byte and u32 typedefs */
#include "g10lib.h"
#include "cipher.h"
+#include "cipher-internal.h"
#define IDEA_KEYSIZE 16
diff --git a/cipher/mac-cmac.c b/cipher/mac-cmac.c
index d4760bc2..8d5d5ca3 100644
--- a/cipher/mac-cmac.c
+++ b/cipher/mac-cmac.c
@@ -69,7 +69,7 @@ cmac_open (gcry_mac_hd_t h)
{
gcry_err_code_t err;
gcry_cipher_hd_t hd;
- int secure = (h->magic == CTX_MAGIC_SECURE);
+ int secure = (h->magic == CTX_MAC_MAGIC_SECURE);
int cipher_algo;
unsigned int flags;
diff --git a/cipher/mac-gmac.c b/cipher/mac-gmac.c
index b9805eea..e04c6d1e 100644
--- a/cipher/mac-gmac.c
+++ b/cipher/mac-gmac.c
@@ -54,7 +54,7 @@ gmac_open (gcry_mac_hd_t h)
{
gcry_err_code_t err;
gcry_cipher_hd_t hd;
- int secure = (h->magic == CTX_MAGIC_SECURE);
+ int secure = (h->magic == CTX_MAC_MAGIC_SECURE);
int cipher_algo;
unsigned int flags;
diff --git a/cipher/mac-hmac.c b/cipher/mac-hmac.c
index e38a74c9..4e10dd2c 100644
--- a/cipher/mac-hmac.c
+++ b/cipher/mac-hmac.c
@@ -107,7 +107,7 @@ hmac_open (gcry_mac_hd_t h)
{
gcry_err_code_t err;
gcry_md_hd_t hd;
- int secure = (h->magic == CTX_MAGIC_SECURE);
+ int secure = (h->magic == CTX_MAC_MAGIC_SECURE);
unsigned int flags;
int md_algo;
diff --git a/cipher/mac-internal.h b/cipher/mac-internal.h
index d907a46f..e49885be 100644
--- a/cipher/mac-internal.h
+++ b/cipher/mac-internal.h
@@ -39,8 +39,8 @@ struct poly1305mac_context_s;
/* Magic values for the context structure. */
-#define CTX_MAGIC_NORMAL 0x59d9b8af
-#define CTX_MAGIC_SECURE 0x12c27cd0
+#define CTX_MAC_MAGIC_NORMAL 0x59d9b8af
+#define CTX_MAC_MAGIC_SECURE 0x12c27cd0
/* MAC module functions. */
diff --git a/cipher/mac-poly1305.c b/cipher/mac-poly1305.c
index d27a31c6..46ea735f 100644
--- a/cipher/mac-poly1305.c
+++ b/cipher/mac-poly1305.c
@@ -45,7 +45,7 @@ static gcry_err_code_t
poly1305mac_open (gcry_mac_hd_t h)
{
struct poly1305mac_context_s *mac_ctx;
- int secure = (h->magic == CTX_MAGIC_SECURE);
+ int secure = (h->magic == CTX_MAC_MAGIC_SECURE);
unsigned int flags = (secure ? GCRY_CIPHER_SECURE : 0);
gcry_err_code_t err;
int cipher_algo;
diff --git a/cipher/mac.c b/cipher/mac.c
index e274b356..babe99e3 100644
--- a/cipher/mac.c
+++ b/cipher/mac.c
@@ -517,7 +517,7 @@ mac_open (gcry_mac_hd_t * hd, int algo, int secure, gcry_ctx_t ctx)
if (!h)
return gpg_err_code_from_syserror ();
- h->magic = secure ? CTX_MAGIC_SECURE : CTX_MAGIC_NORMAL;
+ h->magic = secure ? CTX_MAC_MAGIC_SECURE : CTX_MAC_MAGIC_NORMAL;
h->spec = spec;
h->algo = algo;
h->gcry_ctx = ctx;
diff --git a/cipher/rfc2268.c b/cipher/rfc2268.c
index 348c4d41..f018b640 100644
--- a/cipher/rfc2268.c
+++ b/cipher/rfc2268.c
@@ -35,6 +35,7 @@
#include "g10lib.h"
#include "types.h"
#include "cipher.h"
+#include "cipher-internal.h"
#define RFC2268_BLOCKSIZE 8
diff --git a/cipher/salsa20.c b/cipher/salsa20.c
index 58e2dc6f..d8c5c81f 100644
--- a/cipher/salsa20.c
+++ b/cipher/salsa20.c
@@ -39,6 +39,7 @@
#include "g10lib.h"
#include "cipher.h"
#include "bufhelp.h"
+#include "cipher-internal.h"
/* USE_AMD64 indicates whether to compile with AMD64 code. */
diff --git a/cipher/seed.c b/cipher/seed.c
index c8ae4a01..2c8958fa 100644
--- a/cipher/seed.c
+++ b/cipher/seed.c
@@ -30,6 +30,7 @@
#include "g10lib.h"
#include "cipher.h"
#include "bufhelp.h"
+#include "cipher-internal.h"
#define NUMKC 16
diff --git a/src/cipher-proto.h b/src/cipher-proto.h
index bb16d48d..f9fbb553 100644
--- a/src/cipher-proto.h
+++ b/src/cipher-proto.h
@@ -129,13 +129,13 @@ typedef struct gcry_pk_spec
*
*/
-typedef struct cipher_bulk_ops cipher_bulk_ops_t;
+struct cipher_bulk_ops;
/* Type for the cipher_setkey function. */
typedef gcry_err_code_t (*gcry_cipher_setkey_t) (void *c,
const unsigned char *key,
unsigned keylen,
- cipher_bulk_ops_t *bulk_ops);
+ struct cipher_bulk_ops *bulk_ops);
/* Type for the cipher_encrypt function. */
typedef unsigned int (*gcry_cipher_encrypt_t) (void *c,
--
2.27.0

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1353191

Event Timeline