Skip to content

Commit

Permalink
Begin adding the public key test vectors for use with tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
diagprov committed Dec 5, 2019
1 parent 2cc8bbd commit 8c95feb
Show file tree
Hide file tree
Showing 6 changed files with 436 additions and 4 deletions.
48 changes: 48 additions & 0 deletions c89ize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/python3

import os
import re

def process_line(line):
r = re.compile(r'.*?//(.*)')
if r.match(line):
newline = line.replace("//", "/*")
newline = newline + " */"
return True, newline
return False, ""

def c_read_replace(filename):

print("Processing %s" % filename)
with open(filename, 'rb+') as f:
filetext = ""
line = f.readline().decode("utf-8")

while line:
line = line.strip("\n")
changed, newline = process_line(line)
if changed:
line = newline
filetext = filetext + line + "\n"

line = f.readline().decode("utf-8")

f.seek(0)
f.write(filetext.encode("utf-8"))
print("Done")

def find_c_h_files():

file_list = []
for root, dirs, files in os.walk("."):
for f in files:
if f.endswith(".c"):
file_list.append(os.path.join(root, f))
if f.endswith(".h"):
file_list.append(os.path.join(root, f))
return file_list

if __name__ == '__main__':
c_files = find_c_h_files()
for f in c_files:
c_read_replace(f)
6 changes: 4 additions & 2 deletions mk/objects.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

OBJS = $(OBJDIR)/e4symclient.$O \
$(OBJDIR)/e4c_store_file.$O \
OBJS = $(OBJDIR)/e4c_store_file.$O \
$(OBJDIR)/e4util.$O \
$(OBJDIR)/crypto/aes_siv.$O \
$(OBJDIR)/crypto/aes256enc_ref.$O \
Expand All @@ -11,6 +10,9 @@ OBJS = $(OBJDIR)/e4symclient.$O \
$(OBJDIR)/strlcpy.$O


OBJS += $(OBJDIR)/e4pkcclient.$O


OBJS += $(OBJDIR)/crypto/curve25519/curve25519-donna.$O \
$(OBJDIR)/crypto/ed25519/add_scalar.$O \
$(OBJDIR)/crypto/ed25519/ed25519_test.$O \
Expand Down
2 changes: 2 additions & 0 deletions src/crypto/ed25519/ge.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

#include "e4/stdint.h"
#include "ge.h"
#include "precomp_data.h"

Expand Down
3 changes: 2 additions & 1 deletion src/e4pkc255client.c → src/e4pkcclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* (c) 2018-2019 Copyright Teserakt AG
*/


#include <string.h>
#ifndef __AVR__
#include <stdio.h>
Expand Down Expand Up @@ -120,7 +121,7 @@ int e4c_unprotect_message(uint8_t *mptr,
control = 1;
}

/* check timestamp */
/* Retrieve timestamp encoded as little endian */
tstamp = 0;
for (j = 7; j >= 0; j--)
{
Expand Down
1 change: 0 additions & 1 deletion test/e4.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
Loading

0 comments on commit 8c95feb

Please sign in to comment.