gnunet-android

GNUnet for Android
Log | Files | Refs | README

crypto_kx.h (2201B)


      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             __attribute__ ((nonnull));
     40 
     41 SODIUM_EXPORT
     42 int crypto_kx_keypair(unsigned char pk[crypto_kx_PUBLICKEYBYTES],
     43                       unsigned char sk[crypto_kx_SECRETKEYBYTES])
     44             __attribute__ ((nonnull));
     45 
     46 SODIUM_EXPORT
     47 int crypto_kx_client_session_keys(unsigned char rx[crypto_kx_SESSIONKEYBYTES],
     48                                   unsigned char tx[crypto_kx_SESSIONKEYBYTES],
     49                                   const unsigned char client_pk[crypto_kx_PUBLICKEYBYTES],
     50                                   const unsigned char client_sk[crypto_kx_SECRETKEYBYTES],
     51                                   const unsigned char server_pk[crypto_kx_PUBLICKEYBYTES])
     52             __attribute__ ((warn_unused_result))  __attribute__ ((nonnull(3, 4, 5)));
     53 
     54 SODIUM_EXPORT
     55 int crypto_kx_server_session_keys(unsigned char rx[crypto_kx_SESSIONKEYBYTES],
     56                                   unsigned char tx[crypto_kx_SESSIONKEYBYTES],
     57                                   const unsigned char server_pk[crypto_kx_PUBLICKEYBYTES],
     58                                   const unsigned char server_sk[crypto_kx_SECRETKEYBYTES],
     59                                   const unsigned char client_pk[crypto_kx_PUBLICKEYBYTES])
     60             __attribute__ ((warn_unused_result))  __attribute__ ((nonnull(3, 4, 5)));
     61 
     62 #ifdef __cplusplus
     63 }
     64 #endif
     65 
     66 #endif