You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.6 KiB
45 lines
1.6 KiB
|
|
#ifndef ECDAA_COMMON_H
|
|
#define ECDAA_COMMON_H
|
|
|
|
#include <sys/random.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdint.h>
|
|
|
|
#define DEBUG //enable on screen debug information
|
|
|
|
#define ISSUERPORT 6590
|
|
#define MEMBERPORT 6591
|
|
#define VERIFIERPORT 6592
|
|
|
|
#define MAX_CLIENTS 10
|
|
#define MAX_BSNSIZE 128
|
|
#define NONCE_SIZE 64
|
|
#define MAX_MSGSIZE 15000
|
|
#define MAX_CHKSUMSIZE 1024
|
|
#define MAX_BUFSIZE (((MAX_MSGSIZE + 2) / 3) * 4) + (((MAX_CHKSUMSIZE + 2) / 3) * 4) + 1536
|
|
/* #define MAX_MSGSIZE ((MAX_BUFSIZE - 1536) / 2) - MAX_CHKSUMSIZE //for bin to hex*/
|
|
/* #define MAX_MSGSIZE ((MAX_BUFSIZE - 1536) / 4 * 3) - MAX_CHKSUMSIZE //for base64 */
|
|
|
|
#define ISSUER_PUBLIC_KEY_FILE "ipk.bin"
|
|
#define ISSUER_SECRET_KEY_FILE "isk.bin"
|
|
#define MEMBER_TPM_HANDLE_FILE "tpmhndl.bin" //Handle to access tpm key
|
|
#define MEMBER_TPM_KEY_FILE "tpmpk.bin" //public key to access TPM key (!= mpk)
|
|
#define MEMBER_SECRET_KEY_FILE "msk.bin" //for TPM less members only
|
|
#define MEMBER_PUBLIC_KEY_FILE "mpk.bin"
|
|
#define MEMBER_CREDENTIAL_FILE "mcred.bin"
|
|
#define MEMBER_NONCE_FILE "mnonce.bin"
|
|
#define VERIFIER_GROUP_PK_FILE "gpk.bin"
|
|
#define MESSAGE_FILE "msg.txt" //Checksum of message in chksum.txt
|
|
#define CHECKSUM_FILE "chksum.txt" //Only this file is signed due to 1024 bytes size limit
|
|
|
|
typedef int (*conn_handler)(char *buffer);
|
|
|
|
void ecdaa_rand(void *buffer, size_t buflen);
|
|
|
|
size_t ecdaa_decode(const char *in_enc, uint8_t *out_dec, size_t outlen);
|
|
|
|
size_t ecdaa_encode(const uint8_t *in_dec, char *out_enc, size_t inlen);
|
|
|
|
#endif //ECDAA_COMMON_H
|
|
|