summaryrefslogtreecommitdiffstats
path: root/wsutil/curve25519.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
commite4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc (patch)
tree68cb5ef9081156392f1dd62a00c6ccc1451b93df /wsutil/curve25519.h
parentInitial commit. (diff)
downloadwireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.tar.xz
wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.zip
Adding upstream version 4.2.2.upstream/4.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wsutil/curve25519.h')
-rw-r--r--wsutil/curve25519.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/wsutil/curve25519.h b/wsutil/curve25519.h
new file mode 100644
index 00000000..1eda0200
--- /dev/null
+++ b/wsutil/curve25519.h
@@ -0,0 +1,34 @@
+/** @file
+ * NaCl/Sodium-compatible API for Curve25519 cryptography.
+ *
+ * Copyright (c) 2018, Peter Wu <peter@lekensteyn.nl>
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef __CURVE25519_H__
+#define __CURVE25519_H__
+
+#include <wireshark.h>
+
+/*
+ * Computes Q = X25519(n, P). In other words, given the secret key n, the public
+ * key P, compute the shared secret Q. Each key is 32 bytes long.
+ * Returns 0 on success or -1 on failure.
+ */
+WS_DLL_PUBLIC
+int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
+ const unsigned char *p);
+
+/*
+ * Computes the Curve25519 32-byte public key Q from the 32-byte secret key n.
+ * Returns 0 on success or -1 on failure.
+ */
+WS_DLL_PUBLIC
+int crypto_scalarmult_curve25519_base(unsigned char *q, const unsigned char *n);
+
+#endif /* __CURVE25519_H__ */