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

"plaisthos \(Code Review\) via Openvpn-devel" <[email protected]> Mon, 27 Jul 2026 14:05:18 +0000
Newsgroups gmane.network.openvpn.devel
Message-ID <af3e4ea07175009b07356e7476123db45b875897-EmailReplacePatchSet-HTML@gerrit.openvpn.net>
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
Signed-off-by: Arne Schwabe <[email protected]>
---
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

diff --git a/src/openvpn/siphash.h b/src/openvpn/siphash.h
index bddddc3..d90ae99 100644
--- a/src/openvpn/siphash.h
+++ b/src/openvpn/siphash.h
@@ -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