Curve25519#
Elliptic-curve Diffie-Hellman key agreement on Curve25519.
Implementations#
There are multiple implementations, i.e., …
a portable implementation (
Hacl_Curve25519_51.h
),a fast 64-bit implementation that requires BMI2 & ADX CPU support (
Hacl_Curve25519_64.h
), anda slower 64-bit implementation without the requirements stated above (
Hacl_Curve25519_64_Slow.h
).
API Reference#
#include "Hacl_Curve25519_51.h"
#include "Hacl_Curve25519_64.h"
#include "Hacl_Curve25519_64_Slow.h"
-
void Hacl_Curve25519_51_scalarmult(uint8_t *out, uint8_t *priv, uint8_t *pub)#
Compute the scalar multiple of a point.
- Parameters:
out – Pointer to 32 bytes of memory, allocated by the caller, where the resulting point is written to.
priv – Pointer to 32 bytes of memory where the secret/private key is read from.
pub – Pointer to 32 bytes of memory where the public point is read from.
-
void Hacl_Curve25519_64_scalarmult(uint8_t *out, uint8_t *priv, uint8_t *pub)#
Compute the scalar multiple of a point.
- Parameters:
out – Pointer to 32 bytes of memory, allocated by the caller, where the resulting point is written to.
priv – Pointer to 32 bytes of memory where the secret/private key is read from.
pub – Pointer to 32 bytes of memory where the public point is read from.
Warning
doxygenfunction: Cannot find function “Hacl_Curve25519_64_Slow_scalarmult” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/
-
void Hacl_Curve25519_51_secret_to_public(uint8_t *pub, uint8_t *priv)#
Calculate a public point from a secret/private key.
This computes a scalar multiplication of the secret/private key with the curve’s basepoint.
- Parameters:
pub – Pointer to 32 bytes of memory, allocated by the caller, where the resulting point is written to.
priv – Pointer to 32 bytes of memory where the secret/private key is read from.
-
void Hacl_Curve25519_64_secret_to_public(uint8_t *pub, uint8_t *priv)#
Calculate a public point from a secret/private key.
This computes a scalar multiplication of the secret/private key with the curve’s basepoint.
- Parameters:
pub – Pointer to 32 bytes of memory, allocated by the caller, where the resulting point is written to.
priv – Pointer to 32 bytes of memory where the secret/private key is read from.
Warning
doxygenfunction: Cannot find function “Hacl_Curve25519_64_Slow_secret_to_public” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/
-
bool Hacl_Curve25519_51_ecdh(uint8_t *out, uint8_t *priv, uint8_t *pub)#
Execute the diffie-hellmann key exchange.
- Parameters:
out – Pointer to 32 bytes of memory, allocated by the caller, where the resulting point is written to.
priv – Pointer to 32 bytes of memory where our secret/private key is read from.
pub – Pointer to 32 bytes of memory where their public point is read from.
-
bool Hacl_Curve25519_64_ecdh(uint8_t *out, uint8_t *priv, uint8_t *pub)#
Execute the diffie-hellmann key exchange.
- Parameters:
out – Pointer to 32 bytes of memory, allocated by the caller, where the resulting point is written to.
priv – Pointer to 32 bytes of memory where our secret/private key is read from.
pub – Pointer to 32 bytes of memory where their public point is read from.
Warning
doxygenfunction: Cannot find function “Hacl_Curve25519_64_Slow_ecdh” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/