From: "plaisthos (Code Review)"
Date: Wed, 11 Mar 2026 17:48:50 +0000
References:
Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net
Message-ID: <2c45da7d4ae697eaacfe6bd6f15239c10d33a10c-HTML@...2715...>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="Bw6kqSGEgZc="; charset=UTF-8
Subject: [Openvpn-devel] [S] Change in openvpn[master]: Add aws-lc siphash
implementation
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Cc: openvpn-devel
--Bw6kqSGEgZc=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
plaisthos has uploaded this change for review. ( http://gerrit.openvpn.net/=
c/openvpn/+/1572?usp=3Demail )
Change subject: Add aws-lc siphash implementation
......................................................................
Add aws-lc siphash implementation
AWS-LC has a siphash implementation that is just a simple function call
that also performs the same/better than the reference implementation that
it looks to be based on. AWS-lc variant seems to have come from boringssl
according to the Google copyright.
Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6
---
M src/openvpn/siphash_openssl.c
1 file changed, 41 insertions(+), 0 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/72/1572/1
diff --git a/src/openvpn/siphash_openssl.c b/src/openvpn/siphash_openssl.c
index 61d9501..5095e4f 100644
--- a/src/openvpn/siphash_openssl.c
+++ b/src/openvpn/siphash_openssl.c
@@ -119,7 +119,48 @@
EVP_MAC_free(sip->mac);
free(sip_context);
}
+#elif defined(OPENSSL_IS_AWSLC)
+#include
+/*
+ * Computes a SipHash value
+ * in: pointer to input data (read-only)
+ * inlen: input data length in bytes (any size_t value)
+ * k: pointer to the key data (read-only), must be 16 bytes
+ * out: pointer to output data (write-only), outlen bytes must be allocated
+ * outlen: length of the output in bytes, must be 8 or 16
+ */
+int
+siphash_cryptolib(void *sip_context, const void *in, const size_t inlen,
+ const void *k, uint8_t *out, const size_t outlen)
+{
+ ASSERT(outlen =3D=3D sizeof(uint64_t));
+ uint64_t sipout =3D SIPHASH_24(k, in, inlen);
+
+ memcpy(out, &sipout, sizeof(uint64_t));
+ return 0;
+}
+
+void *
+siphash_cryptolib_init(size_t hash_size)
+{
+ /* This library only supports 64 bit */
+ ASSERT(hash_size =3D=3D sizeof(uint64_t));
+ /* AWS LC does not need a context */
+ return NULL;
+}
+
+bool
+siphash_cryptolib_available(void *sip_context)
+{
+ return true;
+}
+
+void
+siphash_cryptolib_uninit(void *sip_context)
+{
+ /* The context is already NULL */
+}
#else /* if defined(ENABLE_CRYPTO_OPENSSL) && OPENSSL_VERSION_NUMBER >=3D =
0x30000000L */
/* for now, we only have one implementation of SIPHASH in a libray, so put=
the
* dummy functions also here */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1572?usp=3Demail
To unsubscribe, or for help writing mail filters, visit http://gerrit.openv=
pn.net/settings?usp=3Demail
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6
Gerrit-Change-Number: 1572
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos
Gerrit-CC: openvpn-devel
--Bw6kqSGEgZc=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
plaisthos has upl=
oaded this change for review.
View Change
Add aws-lc siphash implementation
AWS-LC has a siphash implement=
ation that is just a simple function call
that also performs the same/be=
tter than the reference implementation that
it looks to be based on. AWS=
-lc variant seems to have come from boringssl
according to the Google co=
pyright.
Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6
---=
M src/openvpn/siphash_openssl.c
1 file changed, 41 insertions(+), 0 =
deletions(-)
git pull ssh://gerrit.openvpn.net:2=
9418/openvpn refs/changes/72/1572/1
diff --git a/src/openvpn/siphas=
h_openssl.c b/src/openvpn/siphash_openssl.c
index 61d9501..=
5095e4f 100644
--- a/src/openvpn/siphash_openssl.c+++ b/src/openvpn/siphash_openssl.c
@@ -119,7 +119,=
48 @@
EVP_MAC_free(sip->mac);
=
free(sip_context);
}
+#elif defined(OPENSSL_IS_AWSLC)
+#include <openssl/siphash.h>
=
+/*
+ * Computes a SipHash value<=
/span>
+ * in: pointer to in=
put data (read-only)
=
+ * inlen: input data length in bytes (any size_t value)
+ * k: pointer to the key data (read-o=
nly), must be 16 bytes
+ * out: pointer to output data (write-only), outlen bytes must be alloca=
ted
+ * outlen: leng=
th of the output in bytes, must be 8 or 16
+ */
+int
+siphash_c=
ryptolib(void *sip_context, const void *in, const size_t inlen,
<=
span style=3D"color: hsl(120, 100%, 40%);">+ const void *k=
, uint8_t *out, const size_t outlen)
+{
+ =
ASSERT(outlen =3D=3D sizeof(uint64_t));
+ uint64_t sipout =3D SIPHASH_24(k, in, inlen);
+
+ memcpy(out, &sipout, sizeof(uint6=
4_t));
+ return 0;=
+}
+
+void *
+siphash_cryptolib_init(size_t hash_size)
+{
+ /* This library only supports 64 bit */
+ ASSERT(hash_size =3D=3D sizeof(uint64=
_t));
+ /* AWS LC =
does not need a context */
+ return NULL;
+}
+
+bool
+siphash_cryptolib_available(void *sip_context)=
span>
+{
+ return true;
+}
+
+voi=
d
+siphash_cryptolib_=
uninit(void *sip_context)
+{
+ /* The c=
ontext is already NULL */
+}
#else /* if defined(ENABLE_CRYPTO_OPENSSL) &&a=
mp; OPENSSL_VERSION_NUMBER >=3D 0x30000000L */
/* for n=
ow, we only have one implementation of SIPHASH in a libray, so put the
* dummy functions also here */
To view, visit change 1572. To unsubscribe, or for help writing mail filt=
ers, visit setti=
ngs.
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a7=
3e1c7b9101af6
Gerrit-Change-Number: 1572
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <arne-openvpn@...1711...=
27...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...=
ts.sourceforge.net>
=
--Bw6kqSGEgZc=--