Skip to contentSkip to conversation

Change in openvpn[master]: Add aws-lc siphash implementation

Openvpn-devel In review flichtenheld (Code Review) via Openvpn-devel 3 participants 15 messages Jul 17 – Aug 8 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1773251317000.I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6@gerrit.openvpn.net

#1 lore raw

Attention is currently required from: plaisthos.

flichtenheld has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email )

Change subject: Add aws-lc siphash implementation
......................................................................

Patch Set 8: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6
Gerrit-Change-Number: 1572
Gerrit-PatchSet: 8
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Comment-Date: Fri, 17 Jul 2026 15:05:52 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

Hello flichtenheld,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email

to look at the new patch set (#10).

The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld

The change is no longer submittable: Code-Review and checks~ChecksSubmitRule are unsatisfied now.

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, 42 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/72/1572/10

src/openvpn/siphash_openssl.c +42 -2
index 214b3f4..8bf8bd3 100644
@@ -113,7 +113,49 @@
     EVP_MAC_free(sip->mac);
     free(sip_context);
 }
+#elif defined(OPENSSL_IS_AWSLC)
+#include <openssl/siphash.h>
+#include <string.h>
+#include "error.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 (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 == sizeof(uint64_t));
+    uint64_t sipout = 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 == 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 */
@@ -140,6 +182,4 @@
 siphash_cryptolib_uninit(void *sip_context)
 {
 }
-
-
 #endif /* if defined(ENABLE_CRYPTO_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x30000000L */

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6
Gerrit-Change-Number: 1572
Gerrit-PatchSet: 10
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld.

plaisthos has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email )

Change subject: Add aws-lc siphash implementation
......................................................................

Patch Set 10:

(1 comment)

Patchset:

PS10:
Added headers since the cleanup of headers in previous now requires additional headers in aws-lc part.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6
Gerrit-Change-Number: 1572
Gerrit-PatchSet: 10
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>
Gerrit-Comment-Date: Wed, 22 Jul 2026 10:32:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

flichtenheld has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email )

Change subject: Add aws-lc siphash implementation
......................................................................

Patch Set 12: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6
Gerrit-Change-Number: 1572
Gerrit-PatchSet: 12
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Comment-Date: Fri, 24 Jul 2026 10:51:44 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

Hello flichtenheld,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email

to look at the new patch set (#13).

The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld

The change is no longer submittable: Code-Review and checks~ChecksSubmitRule are unsatisfied now.

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.h

1 file changed, 30 insertions(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/72/1572/13

src/openvpn/siphash.h +30 -1
index bddddc3..7ced09f 100644
@@ -33,11 +33,40 @@
                   uint8_t *out, size_t outlen);
 
 
+#if defined(OPENSSL_IS_AWSLC)
+#define USE_CRYPOTOLIB_SIPHASH
+#include <openssl/siphash.h>
+#include <string.h>
+#include "error.h"
+/**
+ *  Computes a SipHash value
+ * @param   in: pointer to input data (read-only)
+ * @param   inlen: input data length in bytes (any size_t value)
+ * @param   k: pointer to the key data (read-only), must be 16 bytes
+ * @param   out: pointer to output data (write-only), outlen bytes must be allocated
+ * @param   outlen: length of the output in bytes, must be 8
+ */
+int
+siphash_cryptolib(const void *in, const size_t inlen,
+                  const void *k, uint8_t *out, const size_t outlen)
+{
+    ASSERT(outlen == sizeof(uint64_t));
+    uint64_t sipout = SIPHASH_24(k, in, inlen);
+
+    memcpy(out, &sipout, sizeof(uint64_t));
+    return 0;
+}
+#endif
+
 static inline int
 siphash(const void *in, size_t inlen, const void *k,
         uint8_t *out, size_t outlen)
 {
+#if defined(USE_CRYPOTOLIB_SIPHASH)
+    return siphash_cryptolib(in, inlen, k, out, outlen);
+#else
     return siphash_reference(in, inlen, k, out, outlen);
+#endif
 }
 
-#endif /* ifndef SIPHASH_H */
\ No newline at end of file
+#endif /* ifndef SIPHASH_H */

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6
Gerrit-Change-Number: 1572
Gerrit-PatchSet: 13
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#6 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

Hello flichtenheld,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email

to look at the new patch set (#21).

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.h

1 file changed, 30 insertions(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/72/1572/21

src/openvpn/siphash.h +30 -1
index bddddc3..d90ae99 100644
@@ -33,11 +33,40 @@
                   uint8_t *out, size_t outlen);
 
 
+#if defined(OPENSSL_IS_AWSLC)
+#define USE_CRYPOTOLIB_SIPHASH
+#include <openssl/siphash.h>
+#include <string.h>
+#include "error.h"
+/**
+ *  Computes a SipHash value
+ * @param   in: pointer to input data (read-only)
+ * @param   inlen: input data length in bytes (any size_t value)
+ * @param   k: pointer to the key data (read-only), must be 16 bytes
+ * @param   out: pointer to output data (write-only), outlen bytes must be allocated
+ * @param   outlen: length of the output in bytes, must be 8
+ */
+static inline int
+siphash_cryptolib(const void *in, const size_t inlen,
+                  const void *k, uint8_t *out, const size_t outlen)
+{
+    ASSERT(outlen == sizeof(uint64_t));
+    uint64_t sipout = SIPHASH_24(k, in, inlen);
+
+    memcpy(out, &sipout, sizeof(uint64_t));
+    return 0;
+}
+#endif
+
 static inline int
 siphash(const void *in, size_t inlen, const void *k,
         uint8_t *out, size_t outlen)
 {
+#if defined(USE_CRYPOTOLIB_SIPHASH)
+    return siphash_cryptolib(in, inlen, k, out, outlen);
+#else
     return siphash_reference(in, inlen, k, out, outlen);
+#endif
 }
 
-#endif /* ifndef SIPHASH_H */
\ No newline at end of file
+#endif /* ifndef SIPHASH_H */

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6
Gerrit-Change-Number: 1572
Gerrit-PatchSet: 21
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#7 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

flichtenheld has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email )

Change subject: Add aws-lc siphash implementation
......................................................................

Patch Set 21: Code-Review-1

(2 comments)

File src/openvpn/siphash.h:

http://gerrit.openvpn.net/c/openvpn/+/1572/comment/50f1bd52_999eb12f?usp=email :
PS21, Line 43: * @param in: pointer to input data (read-only)
I don't think the ":" makes sense in doxygen

http://gerrit.openvpn.net/c/openvpn/+/1572/comment/a725d900_e6ee51cd?usp=email :
PS21, Line 57: return 0;
Can we please have a documentation for the return value. Also above in siphash_reference.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6
Gerrit-Change-Number: 1572
Gerrit-PatchSet: 21
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Comment-Date: Thu, 30 Jul 2026 10:26:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#8 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld.

plaisthos has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email )

Change subject: Add aws-lc siphash implementation
......................................................................

Patch Set 21:

(2 comments)

File src/openvpn/siphash.h:

http://gerrit.openvpn.net/c/openvpn/+/1572/comment/269bfc1b_1414f2fd?usp=email :
PS21, Line 43: * @param in: pointer to input data (read-only)

Quoted 1 line

I don't think the ":" makes sense in doxygen

Acknowledged

http://gerrit.openvpn.net/c/openvpn/+/1572/comment/fc523b81_b0ba030d?usp=email :
PS21, Line 57: return 0;

Quoted 1 line

Can we please have a documentation for the return value. Also above in siphash_reference.

I removed the return type as we no longer use OpenSSL and the other two implementation cannot fail and need no return type.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6
Gerrit-Change-Number: 1572
Gerrit-PatchSet: 21
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>
Gerrit-Comment-Date: Thu, 30 Jul 2026 11:39:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#9 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld.

Hello flichtenheld,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email

to look at the new patch set (#22).

The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld

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.

The return type of the siphash related function has been also removed as neither the reference nor the aws-lc implementation can fail. Only the OpenSSL based implementation needed a return type.

Change-Id I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6

---
M src/openvpn/siphash.h
M src/openvpn/siphash_reference.c

2 files changed, 42 insertions(+), 7 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/72/1572/22

src/openvpn/siphash.h +40 -3
index bddddc3..3c0f560 100644
@@ -18,26 +18,63 @@
 #ifndef SIPHASH_H
 #define SIPHASH_H
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdint.h>
 #include <stdio.h>
 #include <stdbool.h>
 
+/* We need to include this to check for the OPENSSL_IS_AWSLC macro */
+#ifdef ENABLE_CRYPTO_OPENSSL
+#include <openssl/opensslv.h>
+#endif
+
 /* siphash always uses 128-bit keys */
 #define SIPHASH_KEY_SIZE 16
 
 /**
  * Calculates SIPHASH using the reference implementation
  */
-int
+void
 siphash_reference(const void *in, size_t inlen, const void *k,
                   uint8_t *out, size_t outlen);
 
 
-static inline int
+#if defined(OPENSSL_IS_AWSLC)
+#define USE_CRYPOTOLIB_SIPHASH
+#include <openssl/siphash.h>
+#include <string.h>
+#include "error.h"
+/**
+ *  Computes a SipHash value
+ * @param   in      pointer to input data (read-only)
+ * @param   inlen   input data length in bytes (any size_t value)
+ * @param   k       pointer to the key data (read-only), must be 16 bytes
+ * @param   out     pointer to output data (write-only), outlen bytes must be allocated
+ * @param   outlen  length of the output in bytes, must be 8
+ */
+static inline void
+siphash_cryptolib(const void *in, const size_t inlen,
+                  const void *k, uint8_t *out, const size_t outlen)
+{
+    ASSERT(outlen == sizeof(uint64_t));
+    uint64_t sipout = SIPHASH_24(k, in, inlen);
+
+    memcpy(out, &sipout, sizeof(uint64_t));
+}
+#endif
+
+static inline void
 siphash(const void *in, size_t inlen, const void *k,
         uint8_t *out, size_t outlen)
 {
+#if defined(USE_CRYPOTOLIB_SIPHASH)
+    return siphash_cryptolib(in, inlen, k, out, outlen);
+#else
     return siphash_reference(in, inlen, k, out, outlen);
+#endif
 }
 
-#endif /* ifndef SIPHASH_H */
\ No newline at end of file
+#endif /* ifndef SIPHASH_H */
src/openvpn/siphash_reference.c +2 -4
index ad19a51..5f0adb9 100644
@@ -99,7 +99,7 @@
  * 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
+void
 siphash_reference(const void *in, const size_t inlen, const void *k, uint8_t *out,
                   const size_t outlen)
 {
@@ -206,7 +206,7 @@
 
     if (outlen == 8)
     {
-        return 0;
+        return;
     }
 
     v1 ^= 0xdd;
@@ -219,6 +219,4 @@
 
     b = v0 ^ v1 ^ v2 ^ v3;
     U64TO8_LE(out + 8, b);
-
-    return 0;
 }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6
Gerrit-Change-Number: 1572
Gerrit-PatchSet: 22
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#10 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld.

Hello flichtenheld,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email

to look at the new patch set (#23).

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.

The return type of the siphash related function has been also removed as neither the reference nor the aws-lc implementation can fail. Only the OpenSSL based implementation needed a return type.

Change-Id I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6

---
M src/openvpn/siphash.h
M src/openvpn/siphash_reference.c

2 files changed, 43 insertions(+), 8 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/72/1572/23

src/openvpn/siphash.h +41 -4
index bddddc3..ade7762 100644
@@ -18,26 +18,63 @@
 #ifndef SIPHASH_H
 #define SIPHASH_H
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdint.h>
 #include <stdio.h>
 #include <stdbool.h>
 
+/* We need to include this to check for the OPENSSL_IS_AWSLC macro */
+#ifdef ENABLE_CRYPTO_OPENSSL
+#include <openssl/opensslv.h>
+#endif
+
 /* siphash always uses 128-bit keys */
 #define SIPHASH_KEY_SIZE 16
 
 /**
  * Calculates SIPHASH using the reference implementation
  */
-int
+void
 siphash_reference(const void *in, size_t inlen, const void *k,
                   uint8_t *out, size_t outlen);
 
 
-static inline int
+#if defined(OPENSSL_IS_AWSLC)
+#define USE_CRYPOTOLIB_SIPHASH
+#include <openssl/siphash.h>
+#include <string.h>
+#include "error.h"
+/**
+ *  Computes a SipHash value
+ * @param   in      pointer to input data (read-only)
+ * @param   inlen   input data length in bytes (any size_t value)
+ * @param   k       pointer to the key data (read-only), must be 16 bytes
+ * @param   out     pointer to output data (write-only), outlen bytes must be allocated
+ * @param   outlen  length of the output in bytes, must be 8
+ */
+static inline void
+siphash_cryptolib(const void *in, const size_t inlen,
+                  const void *k, uint8_t *out, const size_t outlen)
+{
+    ASSERT(outlen == sizeof(uint64_t));
+    uint64_t sipout = SIPHASH_24(k, in, inlen);
+
+    memcpy(out, &sipout, sizeof(uint64_t));
+}
+#endif
+
+static inline void
 siphash(const void *in, size_t inlen, const void *k,
         uint8_t *out, size_t outlen)
 {
-    return siphash_reference(in, inlen, k, out, outlen);
+#if defined(USE_CRYPOTOLIB_SIPHASH)
+    siphash_cryptolib(in, inlen, k, out, outlen);
+#else
+    siphash_reference(in, inlen, k, out, outlen);
+#endif
 }
 
-#endif /* ifndef SIPHASH_H */
\ No newline at end of file
+#endif /* ifndef SIPHASH_H */
src/openvpn/siphash_reference.c +2 -4
index ad19a51..5f0adb9 100644
@@ -99,7 +99,7 @@
  * 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
+void
 siphash_reference(const void *in, const size_t inlen, const void *k, uint8_t *out,
                   const size_t outlen)
 {
@@ -206,7 +206,7 @@
 
     if (outlen == 8)
     {
-        return 0;
+        return;
     }
 
     v1 ^= 0xdd;
@@ -219,6 +219,4 @@
 
     b = v0 ^ v1 ^ v2 ^ v3;
     U64TO8_LE(out + 8, b);
-
-    return 0;
 }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6
Gerrit-Change-Number: 1572
Gerrit-PatchSet: 23
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#11 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

flichtenheld has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email )

Change subject: Add aws-lc siphash implementation
......................................................................

Patch Set 24: Code-Review+2

(1 comment)

File src/openvpn/siphash.h:

http://gerrit.openvpn.net/c/openvpn/+/1572/comment/840e5c22_91b66536?usp=email :
PS21, Line 57: return 0;

Quoted 1 line

I removed the return type as we no longer use OpenSSL and the other two implementation cannot fail a […]

Done

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6
Gerrit-Change-Number: 1572
Gerrit-PatchSet: 24
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Comment-Date: Thu, 30 Jul 2026 18:27:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: plaisthos <[email protected]>
Comment-In-Reply-To: flichtenheld <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#12 lore raw

PATCH v24 1/1 Add aws-lc siphash implementation

In reply to a message not in the archive

From: Arne Schwabe <[email protected]>

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.

The return type of the siphash related function has been also removed as neither the reference nor the aws-lc implementation can fail. Only the OpenSSL based implementation needed a return type.

Change-Id I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1572
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1572
This mail reflects revision 24 of this Change.

Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]>

src/openvpn/siphash.h +41 -4
index bddddc3..ade7762 100644
@@ -18,26 +18,63 @@
 #ifndef SIPHASH_H
 #define SIPHASH_H
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdint.h>
 #include <stdio.h>
 #include <stdbool.h>
 
+/* We need to include this to check for the OPENSSL_IS_AWSLC macro */
+#ifdef ENABLE_CRYPTO_OPENSSL
+#include <openssl/opensslv.h>
+#endif
+
 /* siphash always uses 128-bit keys */
 #define SIPHASH_KEY_SIZE 16
 
 /**
  * Calculates SIPHASH using the reference implementation
  */
-int
+void
 siphash_reference(const void *in, size_t inlen, const void *k,
                   uint8_t *out, size_t outlen);
 
 
-static inline int
+#if defined(OPENSSL_IS_AWSLC)
+#define USE_CRYPOTOLIB_SIPHASH
+#include <openssl/siphash.h>
+#include <string.h>
+#include "error.h"
+/**
+ *  Computes a SipHash value
+ * @param   in      pointer to input data (read-only)
+ * @param   inlen   input data length in bytes (any size_t value)
+ * @param   k       pointer to the key data (read-only), must be 16 bytes
+ * @param   out     pointer to output data (write-only), outlen bytes must be allocated
+ * @param   outlen  length of the output in bytes, must be 8
+ */
+static inline void
+siphash_cryptolib(const void *in, const size_t inlen,
+                  const void *k, uint8_t *out, const size_t outlen)
+{
+    ASSERT(outlen == sizeof(uint64_t));
+    uint64_t sipout = SIPHASH_24(k, in, inlen);
+
+    memcpy(out, &sipout, sizeof(uint64_t));
+}
+#endif
+
+static inline void
 siphash(const void *in, size_t inlen, const void *k,
         uint8_t *out, size_t outlen)
 {
-    return siphash_reference(in, inlen, k, out, outlen);
+#if defined(USE_CRYPOTOLIB_SIPHASH)
+    siphash_cryptolib(in, inlen, k, out, outlen);
+#else
+    siphash_reference(in, inlen, k, out, outlen);
+#endif
 }
 
-#endif /* ifndef SIPHASH_H */
\ No newline at end of file
+#endif /* ifndef SIPHASH_H */
src/openvpn/siphash_reference.c +2 -4
index ad19a51..5f0adb9 100644
@@ -99,7 +99,7 @@
  * 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
+void
 siphash_reference(const void *in, const size_t inlen, const void *k, uint8_t *out,
                   const size_t outlen)
 {
@@ -206,7 +206,7 @@
 
     if (outlen == 8)
     {
-        return 0;
+        return;
     }
 
     v1 ^= 0xdd;
@@ -219,6 +219,4 @@
 
     b = v0 ^ v1 ^ v2 ^ v3;
     U64TO8_LE(out + 8, b);
-
-    return 0;
 }

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Acked-by Frank Lichtenheld on v24 1/1
#13 lore raw

[Openvpn-devel] [PATCH applied] Re: Add aws-lc siphash implementation

Tested that it does not break anything via a local compile (gentoo with OpenSSL 3.5.7), and also pushed to GHA to see "all green" in the AWS-LC build...

Your patch has been applied to the master branch.

commit a194bb5633388956ecad9e0f2b57f1c2d5384065

Author: Arne Schwabe
Date:   Thu Aug 6 17:32:51 2026 +0200

Add aws-lc siphash implementation

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1572
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg38181.html

--
kind regards,

Gert Doering

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#14 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email )

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.

The return type of the siphash related function has been also removed as neither the reference nor the aws-lc implementation can fail. Only the OpenSSL based implementation needed a return type.

Change-Id I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1572
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg38181.html

---
M src/openvpn/siphash.h
M src/openvpn/siphash_reference.c

2 files changed, 43 insertions(+), 8 deletions(-)
src/openvpn/siphash.h +41 -4
index bddddc3..ade7762 100644
@@ -18,26 +18,63 @@
 #ifndef SIPHASH_H
 #define SIPHASH_H
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdint.h>
 #include <stdio.h>
 #include <stdbool.h>
 
+/* We need to include this to check for the OPENSSL_IS_AWSLC macro */
+#ifdef ENABLE_CRYPTO_OPENSSL
+#include <openssl/opensslv.h>
+#endif
+
 /* siphash always uses 128-bit keys */
 #define SIPHASH_KEY_SIZE 16
 
 /**
  * Calculates SIPHASH using the reference implementation
  */
-int
+void
 siphash_reference(const void *in, size_t inlen, const void *k,
                   uint8_t *out, size_t outlen);
 
 
-static inline int
+#if defined(OPENSSL_IS_AWSLC)
+#define USE_CRYPOTOLIB_SIPHASH
+#include <openssl/siphash.h>
+#include <string.h>
+#include "error.h"
+/**
+ *  Computes a SipHash value
+ * @param   in      pointer to input data (read-only)
+ * @param   inlen   input data length in bytes (any size_t value)
+ * @param   k       pointer to the key data (read-only), must be 16 bytes
+ * @param   out     pointer to output data (write-only), outlen bytes must be allocated
+ * @param   outlen  length of the output in bytes, must be 8
+ */
+static inline void
+siphash_cryptolib(const void *in, const size_t inlen,
+                  const void *k, uint8_t *out, const size_t outlen)
+{
+    ASSERT(outlen == sizeof(uint64_t));
+    uint64_t sipout = SIPHASH_24(k, in, inlen);
+
+    memcpy(out, &sipout, sizeof(uint64_t));
+}
+#endif
+
+static inline void
 siphash(const void *in, size_t inlen, const void *k,
         uint8_t *out, size_t outlen)
 {
-    return siphash_reference(in, inlen, k, out, outlen);
+#if defined(USE_CRYPOTOLIB_SIPHASH)
+    siphash_cryptolib(in, inlen, k, out, outlen);
+#else
+    siphash_reference(in, inlen, k, out, outlen);
+#endif
 }
 
-#endif /* ifndef SIPHASH_H */
\ No newline at end of file
+#endif /* ifndef SIPHASH_H */
src/openvpn/siphash_reference.c +2 -4
index ad19a51..5f0adb9 100644
@@ -99,7 +99,7 @@
  * 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
+void
 siphash_reference(const void *in, const size_t inlen, const void *k, uint8_t *out,
                   const size_t outlen)
 {
@@ -206,7 +206,7 @@
 
     if (outlen == 8)
     {
-        return 0;
+        return;
     }
 
     v1 ^= 0xdd;
@@ -219,6 +219,4 @@
 
     b = v0 ^ v1 ^ v2 ^ v3;
     U64TO8_LE(out + 8, b);
-
-    return 0;
 }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6
Gerrit-Change-Number: 1572
Gerrit-PatchSet: 25
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#15 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#25) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld

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.

The return type of the siphash related function has been also removed as neither the reference nor the aws-lc implementation can fail. Only the OpenSSL based implementation needed a return type.

Change-Id I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1572
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg38181.html

---
M src/openvpn/siphash.h
M src/openvpn/siphash_reference.c

2 files changed, 43 insertions(+), 8 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/72/1572/25

src/openvpn/siphash.h +41 -4
index bddddc3..ade7762 100644
@@ -18,26 +18,63 @@
 #ifndef SIPHASH_H
 #define SIPHASH_H
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdint.h>
 #include <stdio.h>
 #include <stdbool.h>
 
+/* We need to include this to check for the OPENSSL_IS_AWSLC macro */
+#ifdef ENABLE_CRYPTO_OPENSSL
+#include <openssl/opensslv.h>
+#endif
+
 /* siphash always uses 128-bit keys */
 #define SIPHASH_KEY_SIZE 16
 
 /**
  * Calculates SIPHASH using the reference implementation
  */
-int
+void
 siphash_reference(const void *in, size_t inlen, const void *k,
                   uint8_t *out, size_t outlen);
 
 
-static inline int
+#if defined(OPENSSL_IS_AWSLC)
+#define USE_CRYPOTOLIB_SIPHASH
+#include <openssl/siphash.h>
+#include <string.h>
+#include "error.h"
+/**
+ *  Computes a SipHash value
+ * @param   in      pointer to input data (read-only)
+ * @param   inlen   input data length in bytes (any size_t value)
+ * @param   k       pointer to the key data (read-only), must be 16 bytes
+ * @param   out     pointer to output data (write-only), outlen bytes must be allocated
+ * @param   outlen  length of the output in bytes, must be 8
+ */
+static inline void
+siphash_cryptolib(const void *in, const size_t inlen,
+                  const void *k, uint8_t *out, const size_t outlen)
+{
+    ASSERT(outlen == sizeof(uint64_t));
+    uint64_t sipout = SIPHASH_24(k, in, inlen);
+
+    memcpy(out, &sipout, sizeof(uint64_t));
+}
+#endif
+
+static inline void
 siphash(const void *in, size_t inlen, const void *k,
         uint8_t *out, size_t outlen)
 {
-    return siphash_reference(in, inlen, k, out, outlen);
+#if defined(USE_CRYPOTOLIB_SIPHASH)
+    siphash_cryptolib(in, inlen, k, out, outlen);
+#else
+    siphash_reference(in, inlen, k, out, outlen);
+#endif
 }
 
-#endif /* ifndef SIPHASH_H */
\ No newline at end of file
+#endif /* ifndef SIPHASH_H */
src/openvpn/siphash_reference.c +2 -4
index ad19a51..5f0adb9 100644
@@ -99,7 +99,7 @@
  * 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
+void
 siphash_reference(const void *in, const size_t inlen, const void *k, uint8_t *out,
                   const size_t outlen)
 {
@@ -206,7 +206,7 @@
 
     if (outlen == 8)
     {
-        return 0;
+        return;
     }
 
     v1 ^= 0xdd;
@@ -219,6 +219,4 @@
 
     b = v0 ^ v1 ^ v2 ^ v3;
     U64TO8_LE(out + 8, b);
-
-    return 0;
 }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1572?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I05e20f8c82494e4abf96fe1e3a73e1c7b9101af6
Gerrit-Change-Number: 1572
Gerrit-PatchSet: 25
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel