op-packages/ShadowVPN/patches/001-fix-gcc11-support.patch
github-actions[bot] 32600acc60 🌴 Sync 2026-03-05 23:51:42
2026-03-05 23:51:42 +08:00

111 lines
4.6 KiB
Diff

--- a/libsodium/src/libsodium/Makefile.am
+++ b/libsodium/src/libsodium/Makefile.am
@@ -31,6 +31,9 @@ libsodium_la_SOURCES = \
crypto_core/salsa20/ref/core_salsa20.c \
crypto_core/salsa20/core_salsa20_api.c \
crypto_core/salsa20/ref/api.h \
+ crypto_core/salsa208/ref/core_salsa208.c \
+ crypto_core/salsa208/core_salsa208_api.c \
+ crypto_core/salsa208/ref/api.h \
crypto_generichash/crypto_generichash.c \
crypto_generichash/blake2/generichash_blake2_api.c \
crypto_generichash/blake2/ref/api.h \
@@ -136,6 +139,10 @@ libsodium_la_SOURCES = \
crypto_stream/chacha20/ref/api.h \
crypto_stream/chacha20/ref/stream_chacha20_ref.c \
crypto_stream/salsa20/stream_salsa20_api.c \
+ crypto_stream/salsa208/stream_salsa208_api.c \
+ crypto_stream/salsa208/ref/api.h \
+ crypto_stream/salsa208/ref/stream_salsa208.c \
+ crypto_stream/salsa208/ref/xor_salsa208.c \
crypto_stream/xsalsa20/stream_xsalsa20_api.c \
crypto_stream/xsalsa20/ref/api.h \
crypto_stream/xsalsa20/ref/stream_xsalsa20.c \
@@ -204,9 +211,6 @@ libsodium_la_SOURCES += \
crypto_core/salsa2012/ref/core_salsa2012.c \
crypto_core/salsa2012/core_salsa2012_api.c \
crypto_core/salsa2012/ref/api.h \
- crypto_core/salsa208/ref/core_salsa208.c \
- crypto_core/salsa208/core_salsa208_api.c \
- crypto_core/salsa208/ref/api.h \
crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c \
crypto_sign/edwards25519sha512batch/ref/api.h \
crypto_sign/edwards25519sha512batch/ref/fe25519.h \
@@ -232,11 +236,7 @@ libsodium_la_SOURCES += \
crypto_stream/salsa2012/stream_salsa2012_api.c \
crypto_stream/salsa2012/ref/api.h \
crypto_stream/salsa2012/ref/stream_salsa2012.c \
- crypto_stream/salsa2012/ref/xor_salsa2012.c \
- crypto_stream/salsa208/stream_salsa208_api.c \
- crypto_stream/salsa208/ref/api.h \
- crypto_stream/salsa208/ref/stream_salsa208.c \
- crypto_stream/salsa208/ref/xor_salsa208.c
+ crypto_stream/salsa2012/ref/xor_salsa2012.c
endif
libsodium_la_LDFLAGS = \
--- a/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2.h
+++ b/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2.h
@@ -98,7 +98,7 @@ extern "C" {
uint8_t personal[BLAKE2B_PERSONALBYTES]; // 64
} blake2b_param;
-#ifndef DEFINE_BLAKE2B_STATE
+#if 1
typedef crypto_generichash_blake2b_state blake2b_state;
#else
ALIGN( 64 ) typedef struct blake2b_state_
@@ -110,7 +110,6 @@ typedef crypto_generichash_blake2b_state blake2b_state;
size_t buflen;
uint8_t last_node;
} blake2b_state;
-#endif
typedef struct blake2sp_state_
{
@@ -127,6 +126,8 @@ typedef crypto_generichash_blake2b_state blake2b_state;
uint8_t buf[4 * BLAKE2B_BLOCKBYTES];
size_t buflen;
} blake2bp_state;
+#endif
+
#pragma pack(pop)
// Streaming API
@@ -146,6 +147,7 @@ typedef crypto_generichash_blake2b_state blake2b_state;
int blake2b_update( blake2b_state *S, const uint8_t *in, uint64_t inlen );
int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen );
+#if 0
int blake2sp_init( blake2sp_state *S, const uint8_t outlen );
int blake2sp_init_key( blake2sp_state *S, const uint8_t outlen, const void *key, const uint8_t keylen );
int blake2sp_update( blake2sp_state *S, const uint8_t *in, uint64_t inlen );
@@ -155,6 +157,7 @@ typedef crypto_generichash_blake2b_state blake2b_state;
int blake2bp_init_key( blake2bp_state *S, const uint8_t outlen, const void *key, const uint8_t keylen );
int blake2bp_update( blake2bp_state *S, const uint8_t *in, uint64_t inlen );
int blake2bp_final( blake2bp_state *S, uint8_t *out, uint8_t outlen );
+#endif
// Simple API
int blake2s( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen );
--- a/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c
+++ b/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c
@@ -415,7 +415,7 @@ int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen )
/* inlen, at least, should be uint64_t. Others can be size_t. */
int blake2b( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen )
{
- blake2b_state S[1];
+ blake2b_state *S;
/* Verify parameters */
if ( NULL == in ) return -1;
@@ -441,7 +441,7 @@ int blake2b( uint8_t *out, const void *in, const void *key, const uint8_t outlen
int blake2b_salt_personal( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen,
const void *salt, const void *personal )
{
- blake2b_state S[1];
+ blake2b_state *S;
/* Verify parameters */
if ( NULL == in ) return -1;