29 #if defined(__linux__) || defined(__CYGWIN__)
30 #include <arpa/inet.h>
84 Hacl_Curve25519_crypto_scalarmult(sk->
pub, sk->
priv, basepoint);
99 Hacl_SHA2_512_hash(tmp, input,
sizeof(input));
107 Hacl_SHA2_512_hash(tmp, input,
sizeof(input));
120 uint32_t x = (bytes[3] << 24) + (bytes[2] << 16) + (bytes[1] << 8) + bytes[0];
123 #if defined(__linux__) || defined(__CYGWIN__)
126 #elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
130 #elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
135 #pragma message "Please define __BYTE_ORDER__!"
146 #if defined(__linux__) || defined(__CYGWIN__)
149 #elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
153 #elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
158 #pragma message "Error: Please define __BYTE_ORDER__!"
161 bytes[3] = (n >> 24) & 0xFF;
162 bytes[2] = (n >> 16) & 0xFF;
163 bytes[1] = (n >> 8) & 0xFF;
uint8_t key[PPRZ_KEY_LEN]
struct gec_privkey my_private_ephemeral
void gec_clear_sts(struct gec_sts_ctx *sts)
Galois embedded crypto implementation.
struct gec_pubkey their_public_key
void gec_derive_key_material(struct gec_sts_ctx *ctx, uint8_t *z)
Derive key material for both sender and receiver.
uint32_t gec_bytes_to_counter(uint8_t *bytes)
Convert from network byte order (big endian) to the machine byte order.
struct gec_sym_key rx_sym_key
uint8_t pub[PPRZ_KEY_LEN]
struct gec_pubkey their_public_ephemeral
void gec_sts_init(struct gec_sts_ctx *sts)
struct gec_sym_key tx_sym_key
uint8_t nonce[PPRZ_NONCE_LEN]
uint32_t rng_wait_and_get(void)
void gec_generate_ephemeral_keys(struct gec_privkey *sk)
Generate private and public key pairs for future use.
void gec_counter_to_bytes(uint32_t n, uint8_t *bytes)
Convert counter to bytes in network byte order.
uint8_t priv[PPRZ_KEY_LEN]
struct gec_privkey my_private_key