#include "layer1.h"

#include <openssl/ec.h>
#include <openssl/pem.h>
#include <openssl/kdf.h>


#define SHA256_DGST_SIZE		32	//bytes
#define PASSPHRASE				"Identity"
#define KDF_KEY_SIZE			32	//bytes
#define KDF_ALG					EVP_sha256()
#define EC_KEY_SIZE				32
#define EC_CURVE				NID_secp224r1

#define lenofstr(a)				(sizeof(a)-1)


void startCDIProtocol();

int deriveKEY(uint8_t * out, size_t * out_len, uint8_t * secret, int secret_len, unsigned char * passphrase, int pass_len);
int deriveECC_KeyPair();
int deriveDEVICE_Key();
int deriveALIAS_key();
int genDEVICE_cert();
int genALIAS_cert();
