ascon.h 624 Bytes
Newer Older
Martin Schlaeffer committed
1 2 3 4 5 6 7 8 9 10
#ifndef ASCON_H_
#define ASCON_H_

#include <immintrin.h>
#include <stdint.h>

#include "word.h"

typedef union {
  __m512i z;
Martin Schläffer committed
11
  uint64_t x[5];
Martin Schlaeffer committed
12 13
} state_t;

Martin Schläffer committed
14 15 16 17 18 19 20 21 22
typedef struct {
#if (CRYPTO_KEYBYTES == 20)
  uint64_t k0;
#endif
  uint64_t k1;
  uint64_t k2;
} akey_t;

void ascon_initaead(state_t* s, const uint8_t* npub, const akey_t* k);
Martin Schlaeffer committed
23 24 25
void ascon_adata(state_t* s, const uint8_t* ad, uint64_t adlen);
void ascon_encrypt(state_t* s, uint8_t* c, const uint8_t* m, uint64_t mlen);
void ascon_decrypt(state_t* s, uint8_t* m, const uint8_t* c, uint64_t clen);
Martin Schläffer committed
26
void ascon_final(state_t* s, const akey_t* k);
Martin Schlaeffer committed
27

Martin Schläffer committed
28
#endif /* ASCON_H_ */