Network wrapper protocol as part of the practical master thesis
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.
 
 

33 lines
919 B

#ifndef ECDAA_COMMON_H
#define ECDAA_COMMON_H
#include <sys/random.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#define ISSUERPORT 6590
#define MEMBERPORT 6591
#define VERIFIERPORT 6592
#define MAX_CLIENTS 10
#define MAX_MSGSIZE 15360
#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 MAX_BSNSIZE 128
#define NONCE_SIZE 384
#define MSGFILE "msg.txt"
#define CHKSUMFILE "chksum.txt"
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