Commit 153fb075 authored by hark's avatar hark
Browse files

Merge branch 'master' of 185.52.224.4:yids/avr-pager

Conflicts:
	base-tx/Makefile
	base-tx/receiver.keypair
	base-tx/sender.keypair
	base-tx/test.c
parents 82e2b6f7 8e2ce7ed
CC=colorgcc
CFLAGS="-I ../libs -DNODEBUG"
CFLAGS="-I ../libs"
all: test rx-test tx-test keygen
......@@ -7,7 +7,7 @@ base-tx: base-tx.c
$(CC) -o base-tx base-tx.c $(LIBS) $(CFLAGS)
test: test.c ../libs/pagerlib/pagerlib.c ../libs/pagerlib/things.c ../libs/pagerlib/pagerlib.h ../libs/pagerlib/packets.h
$(CC) -std=c99 -g -o test test.c ../libs/micro-ecc/uECC.c ../libs/pagerlib/pagerlib.c ../libs/pagerlib/things.c -lmbedtls -lmbedx509 -lmbedcrypto $(LIBS) $(CFLAGS)
$(CC) -std=c99 -g -o test test.c ../libs/micro-ecc/uECC.c ../libs/pagerlib/pagerlib.c ../libs/pagerlib/things.c -lmbedtls -lmbedx509 -lmbedcrypto $(LIBS) $(CFLAGS)
rx-test: rx-test.c ../libs/pagerlib/pagerlib.c ../libs/pagerlib/things.c
$(CC) -std=c99 -g -o rx-test rx-test.c ../libs/micro-ecc/uECC.c ../libs/pagerlib/pagerlib.c ../libs/pagerlib/things.c -lmbedtls -lmbedx509 -lmbedcrypto $(LIBS) $(CFLAGS)
......
......@@ -14,5 +14,16 @@ char decompressed_point[64];
int main()
{
struct pl_keypair *receiver, *sender;
struct pl_ctx * context;
context = pl_init(context);
pl_create_keypair(context, sender);
pl_save_key(sender,"sender.keypair");
pl_create_keypair(context, receiver);
pl_save_key(receiver,"receiver.keypair");
return 0;
}
зzUm 0خCA+$G;v G ;t$[nV? R
\ No newline at end of file
<<<<<<< HEAD
зzUm 0خCA+$G;v G ;t$[nV? R
=======
O˪)_UUZ6V*CujD$jG>`><=Ʀ|B.Um&=$
>>>>>>> 8e2ce7edbca8605c6b11a0456b1b93762e4c0935
......@@ -15,22 +15,23 @@ char decompressed_point[64];
int main ()
{
struct pl_keypair *receiver;
char crypt_message[sizeof(struct pl_pagermessage)];
char decrypted_message[128];
struct pl_pagermessage * received_message;
read(STDIN_FILENO, crypt_message, sizeof(struct pl_pagermessage));
char encrypted_message[sizeof(struct pl_pagermessage)];
// initialise the pager
struct pl_ctx * context;
context = pl_init(context);
pl_init();
received_message=(struct pl_pagermessage *) malloc(sizeof(struct pl_pagermessage));
memset(received_message, 7, sizeof(struct pl_pagermessage));
receiver = (struct pl_keypair *) malloc(sizeof(struct pl_keypair));
memset(receiver, 2, sizeof(struct pl_keypair));
pl_load_key(receiver, "receiver.keypair");
memcpy(&context->receiver_compressed_point, &receiver->compressed_point, sizeof(context->receiver_compressed_point));
context->kp = receiver;
memcpy(received_message->msg, crypt_message, MSG_SIZE);
read(STDIN_FILENO, context->msg , sizeof(struct pl_pagermessage));
pl_receive_message(receiver, received_message, &decrypted_message, &shared_secret, &decompressed_point);
pl_receive_message(context);
printf("the decrypted message: %s \n", context->msg->msg);
return 0;
}
......@@ -28,9 +28,7 @@ char decompressed_point[64];
int main() {
struct pl_keypair *receiver, *sender;
char clear_message[] = "Blaat blaat, dit is een test berichtje :), en nog meer en meer en meer 123456744555 blablablablablablabal jajajajaj hee blaat ";
char crypt_message[128];
char decrypted_message[128];
// struct pl_pagermessage * sended_msg;
// initialise the pager
struct pl_ctx * context;
/*
......@@ -55,7 +53,7 @@ int main() {
pl_save_key(sender,"sender.keypair");
pl_create_keypair(context, receiver);
pl_save_key(receiver,"receiver.keypair");
//switch to sender key
// context->kp = sender;
pl_load_key(sender, "sender.keypair");
......@@ -76,7 +74,6 @@ int main() {
DBM("context->kp->private_key (sender)", sizeof(context->kp->private_key), &context->kp->private_key);
*/
memcpy(context->msg->msg, clear_message, MSG_SIZE);
// DBM("receiver->compressed",sizeof(receiver->compressed_point) , &receiver->compressed_point);
......
......@@ -2,6 +2,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "../libs/pagerlib/pagerlib.h"
#ifndef uECC_TEST_NUMBER_OF_ITERATIONS
......@@ -14,23 +15,29 @@ char decompressed_point[64];
int main()
{
struct pl_keypair *transmitter;
char plain_message[] = "test bericht lala";
char crypt_message[sizeof(struct pl_pagermessage)];
char encrypted_message[128];
struct pl_pagermessage * sent_message;
struct pl_keypair *sender, *receiver;
char clear_message[] = "dit is een test berichtje :) ";
pl_init();
// initialise the pager
struct pl_ctx * context;
context = pl_init(context);
sent_message=(struct pl_pagermessage *) malloc(sizeof(struct pl_pagermessage));
memset(sent_message, 7, sizeof(struct pl_pagermessage));
sender = (struct pl_keypair *) malloc(sizeof(struct pl_keypair));
receiver = (struct pl_keypair *) malloc(sizeof(struct pl_keypair));
pl_load_key(transmitter, "receiver.keypair");
pl_load_key(sender, "sender.keypair"); // load tx keypair
pl_load_key(receiver, "receiver.keypair"); // load tx keypair
memcpy(sent_message->msg, crypt_message, MSG_SIZE);
context->kp = sender;
pl_send_message(transmitter, sent_message, &plain_message, &shared_secret, &decompressed_point);
memcpy(context->msg->msg, clear_message, MSG_SIZE);
memcpy(&context->receiver_compressed_point, &receiver->compressed_point, sizeof(context->receiver_compressed_point));
DBM("context->recv_comp_point", sizeof(context->kp->private_key), &context->receiver_compressed_point);
pl_send_message(context);
write(STDOUT_FILENO,context->msg, sizeof(struct pl_pagermessage));
return 0;
}
......@@ -18,27 +18,30 @@ extern "C"
#ifdef ARDUINO
#include <AESLib.h>
#define DBG
#define DB
#define DBM
#else
#endif
#ifdef DEBUG
#define DBG(f_, ...) printf((f_), ##__VA_ARGS__);
#define DB(f_, ...) dump_buffer((f_), ##__VA_ARGS__);
#define DBM(f_, ...) dump_buffer_msg((f_), ##__VA_ARGS__);
#include "mbedtls/entropy.h"
#include "mbedtls/ctr_drbg.h"
#include "mbedtls/aes.h"
#endif
#ifdef NODEBUG
#ifdef ARDUINO // fixme arduino debug functions
#define DBG
#define DB
#define DBM
#endif
#else // no debuging
#define DBG
#define DB
#define DBM
#endif
#include "mbedtls/entropy.h"
#include "mbedtls/ctr_drbg.h"
#include "mbedtls/aes.h"
#include "packets.h"
typedef struct list_kp {
......@@ -67,7 +70,7 @@ struct pl_ctx
struct list_kp *keypairs;
// struct pl_keypair *to, *from;
struct pl_pagermessage *msg;
uint8_t receiver_compressed_point[ECC_COMPRESSED_SIZE];
#ifdef ARDUINO
......
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