Commit 6550f6c6 authored by yids's avatar yids
Browse files

started on program for the basestation

parent 62038b1a
Pipeline #10 skipped
CC=gcc
CFLAGS=-I.
LIBS="/usr/share/arduino/libraries/nano-ecc/ecc.c"
base-tx: base-tx.c
$(CC) -o base-tx base-tx.c $(LIBS)
#include "/usr/share/arduino/libraries/nano-ecc/ecc.h"
#include "/usr/share/arduino/libraries/AESLib/AESLib.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
//my pub-priv keypair
uint8_t privkey[NUM_ECC_DIGITS] = {0x14, 0x14, 0x92, 0x2D, 0x2E, 0x00, 0x87, 0x16, 0x2D, 0x43, 0x0E, 0xC1, 0x8A, 0xD0, 0x0A, 0x1E, 0xEE, 0x89, 0x4F, 0x17, 0x3F, 0xB1, 0x1B, 0x5A};
EccPoint localPubkey = {
{0x90, 0x6F, 0xFC, 0xC8, 0x07, 0xA8, 0x93, 0x9C, 0x3B, 0xDC, 0xAF, 0xF1, 0x8D, 0xA9, 0x96, 0xF8, 0xC2, 0x3B, 0x85, 0x3E, 0x5C, 0x65, 0xDE, 0x32},
{0xE1, 0xB1, 0x28, 0x7F, 0xD3, 0xB0, 0x94, 0x24, 0x69, 0x95, 0xDE, 0x76, 0x40, 0x15, 0x6E, 0xAE, 0x74, 0xE9, 0x56, 0x94, 0xA7, 0xE4, 0x63, 0xEF}};
//other pubkey
EccPoint remotePubkey = {
{0xF3, 0xCD, 0x7D, 0x81, 0x15, 0x01, 0xC0, 0x3E, 0xB5, 0x56, 0x5B, 0xF1, 0x1A, 0x99, 0xFB, 0x0B, 0x20, 0x2B, 0x18, 0x82, 0xD3, 0x71, 0x6F, 0x1E},
{0x4B, 0x84, 0xC7, 0xDD, 0x67, 0x6B, 0xED, 0x45, 0x1A, 0x4B, 0x54, 0x5A, 0x19, 0xCA, 0x1B, 0x6F, 0x3B, 0x93, 0xBA, 0xF4, 0x2A, 0x9B, 0x65, 0x69}};
int checkPubkey(EccPoint *p_pubkey)
{
if( ecc_valid_public_key(p_pubkey) == 1 ){
printf("Public key is valid \n");
return 0;
}
else {
printf("Public key is NOT valid \n");
return 1;
}
}
int main(int argc, char **argv)
{
printf("Basestation tx test\n");
checkPubkey(&remotePubkey);
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment