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.
 
 

64 lines
2.5 KiB

/*
** Copyright (C) 2020 Johannes Kepler University Linz, Institute of Networks and Security
** Copyright (C) 2020 CDL Digidow <https://www.digidow.eu/>
**
** Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
** the European Commission - subsequent versions of the EUPL (the "Licence").
** You may not use this work except in compliance with the Licence.
**
** You should have received a copy of the European Union Public License along
** with this program. If not, you may obtain a copy of the Licence at:
** <https://joinup.ec.europa.eu/software/page/eupl>
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the Licence is distributed on an "AS IS" basis,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the Licence for the specific language governing permissions and
** limitations under the Licence.
**
*/
#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) + 900
/* #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