1 #ifndef crypto_kx_H 2 #define crypto_kx_H 3 4 #include <stddef.h> 5 6 #include "export.h" 7 8 #ifdef __cplusplus 9 # ifdef __GNUC__ 10 # pragma GCC diagnostic ignored "-Wlong-long" 11 # endif 12 extern "C" { 13 #endif 14 15 #define crypto_kx_PUBLICKEYBYTES 32 16 SODIUM_EXPORT 17 size_t crypto_kx_publickeybytes(void); 18 19 #define crypto_kx_SECRETKEYBYTES 32 20 SODIUM_EXPORT 21 size_t crypto_kx_secretkeybytes(void); 22 23 #define crypto_kx_SEEDBYTES 32 24 SODIUM_EXPORT 25 size_t crypto_kx_seedbytes(void); 26 27 #define crypto_kx_SESSIONKEYBYTES 32 28 SODIUM_EXPORT 29 size_t crypto_kx_sessionkeybytes(void); 30 31 #define crypto_kx_PRIMITIVE "x25519blake2b" 32 SODIUM_EXPORT 33 const char *crypto_kx_primitive(void); 34 35 SODIUM_EXPORT 36 int crypto_kx_seed_keypair(unsigned char pk[crypto_kx_PUBLICKEYBYTES], 37 unsigned char sk[crypto_kx_SECRETKEYBYTES], 38 const unsigned char seed[crypto_kx_SEEDBYTES]); 39 40 SODIUM_EXPORT 41 int crypto_kx_keypair(unsigned char pk[crypto_kx_PUBLICKEYBYTES], 42 unsigned char sk[crypto_kx_SECRETKEYBYTES]); 43 44 SODIUM_EXPORT 45 int crypto_kx_client_session_keys(unsigned char rx[crypto_kx_SESSIONKEYBYTES], 46 unsigned char tx[crypto_kx_SESSIONKEYBYTES], 47 const unsigned char client_pk[crypto_kx_PUBLICKEYBYTES], 48 const unsigned char client_sk[crypto_kx_SECRETKEYBYTES], 49 const unsigned char server_pk[crypto_kx_PUBLICKEYBYTES]) 50 __attribute__ ((warn_unused_result)); 51 52 SODIUM_EXPORT 53 int crypto_kx_server_session_keys(unsigned char rx[crypto_kx_SESSIONKEYBYTES], 54 unsigned char tx[crypto_kx_SESSIONKEYBYTES], 55 const unsigned char server_pk[crypto_kx_PUBLICKEYBYTES], 56 const unsigned char server_sk[crypto_kx_SECRETKEYBYTES], 57 const unsigned char client_pk[crypto_kx_PUBLICKEYBYTES]) 58 __attribute__ ((warn_unused_result)); 59 60 #ifdef __cplusplus 61 } 62 #endif 63 64 #endif 65