-/* $OpenBSD: curve25519.c,v 1.15 2023/04/02 15:36:53 tb Exp $ */
+/* $OpenBSD: curve25519.c,v 1.16 2023/07/08 15:12:49 beck Exp $ */
/*
* Copyright (c) 2015, Google Inc.
*
ED25519_public_from_private(out_public_key, out_private_key);
}
+LCRYPTO_ALIAS(ED25519_keypair);
int ED25519_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len,
const uint8_t public_key[ED25519_PUBLIC_KEY_LENGTH],
return 1;
}
+LCRYPTO_ALIAS(ED25519_sign);
/*
* Little endian representation of the order of edwards25519,
return timingsafe_memcmp(rcheck, rcopy, sizeof(rcheck)) == 0;
}
+LCRYPTO_ALIAS(ED25519_verify);
/* Replace (f,g) with (g,f) if b == 1;
* replace (f,g) with (f,g) if b == 0.
X25519_public_from_private(out_public_key, out_private_key);
}
+LCRYPTO_ALIAS(X25519_keypair);
int
X25519(uint8_t out_shared_key[X25519_KEY_LENGTH],
/* The all-zero output results when the input is a point of small order. */
return timingsafe_memcmp(kZeros, out_shared_key, 32) != 0;
}
+LCRYPTO_ALIAS(X25519);
--- /dev/null
+/* $OpenBSD: curve25519.h,v 1.1 2023/07/08 15:12:49 beck Exp $ */
+/*
+ * Copyright (c) 2023 Bob Beck <beck@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _LIBCRYPTO_CURVE25519_H
+#define _LIBCRYPTO_CURVE25519_H
+
+#ifndef _MSC_VER
+#include_next <openssl/curve25519.h>
+#else
+#include "../include/openssl/curve25519.h"
+#endif
+#include "crypto_namespace.h"
+
+LCRYPTO_USED(X25519_keypair);
+LCRYPTO_USED(X25519);
+LCRYPTO_USED(ED25519_keypair);
+LCRYPTO_USED(ED25519_sign);
+LCRYPTO_USED(ED25519_verify);
+
+#endif /* _LIBCRYPTO_CURVE25519_H */