From: "plaisthos (Code Review)" Date: Thu, 19 Mar 2026 14:17:13 +0000 In-Reply-To: References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <1c073c35270b5b53aca966efc874cfe206f725d9-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="o5GhYkRqtOc="; 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 --o5GhYkRqtOc= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable plaisthos has uploaded a new patch set (#4). ( 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 Signed-off-by: Arne Schwabe --- M src/openvpn/siphash_openssl.c 1 file changed, 40 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/72/1572/4 diff --git a/src/openvpn/siphash_openssl.c b/src/openvpn/siphash_openssl.c index bb42a38..2a8e64a 100644 --- a/src/openvpn/siphash_openssl.c +++ b/src/openvpn/siphash_openssl.c @@ -118,7 +118,47 @@ 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 /* for now, we only have one implementation of SIPHASH in a libray, so put= the * dummy functions also here */ @@ -145,6 +185,4 @@ siphash_cryptolib_uninit(void *sip_context) { } - - #endif /* if defined(ENABLE_CRYPTO_OPENSSL) && OPENSSL_VERSION_NUMBER >=3D= 0x30000000L */ -- 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: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6 Gerrit-Change-Number: 1572 Gerrit-PatchSet: 4 Gerrit-Owner: plaisthos Gerrit-CC: openvpn-devel --o5GhYkRqtOc= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

plaisthos uploaded patch set #4 to this change.

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
Sig= ned-off-by: Arne Schwabe <arne@...1227...>
---
M src/openvpn/si= phash_openssl.c
1 file changed, 40 insertions(+), 2 deletions(-)

=
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/ch=
anges/72/1572/4
diff --git a/src/openvpn/siphash_openssl.c b/src/op=
envpn/siphash_openssl.c
index bb42a38..2a8e64a 100644
--- a/src/openvpn/siphash_openssl.c
+++ b/src/op= envpn/siphash_openssl.c
@@ -118,7 +118,47 @@
EVP_MAC_free(sip->mac);

free(sip_context);
}
+#e= lif defined(OPENSSL_IS_AWSLC)
+#include <openssl/siphash.h>
+/*
+ * 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 (wri= te-only), outlen bytes must be allocated

+ * outlen: length of the output in bytes, must be 8 o= r 16
+ */
<= span style=3D"color: hsl(120, 100%, 40%);">+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 si= pout =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)
+{
+ return true;
+}
+
+voi= d
+siphash_cryptolib_= uninit(void *sip_context)
+{
+ /* The c= ontext is already NULL */
+}
#else
/* for now, we only have on= e implementation of SIPHASH in a libray, so put the
* dum= my functions also here */
@@ -145,6 +185,4 @@
siphash_cryptolib_uninit(void *sip_context)

{ }
-
= -
#endif /* if d= efined(ENABLE_CRYPTO_OPENSSL) && OPENSSL_VERSION_NUMBER >=3D 0x3= 0000000L */

To view, visit change 1572. To = unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a7= 3e1c7b9101af6
Gerrit-Change-Number: 1572
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --o5GhYkRqtOc=--