ftu/fstoken.h

30 lines
998 B
C

#ifndef __FSTOKEN_H__
#define __FSTOKEN_H__
#include "blst/blst.h"
#include <stdbool.h>
#include <stdint.h>
#define IDBITS_DEFAULT 128
#define IDBITS_MAX 256
#define HASHBITS_DEFAULT 256
#define HASHBITS_MAX 256
// For efficiency's sake, structs intended for use with the FemtoStar Protocol must be strictly-aligned without padding, with little-endian byte ordering.
// This avoids wasting network capacity on padding, and avoids the performance impact of reordering on most modern platforms (most importantly x86 and RISC-V)
// while ensuring compatibility with strict-alignment architectures. Take note: This is NOT typical network-order!
typedef struct{
#pragma scalar_storage_order little-endian
uint8_t target_descriptor_version;
bool sk_available;
uint16_t idbits;
uint16_t hashbits;
byte sk[32];
byte pk[96];
} target_descriptor;
void fstoken_keygen(byte* ikm, byte* sk_byte, byte* pk_byte);
void fstoken_get_pk_from_sk(byte* sk_byte, byte* pk_byte);
#endif