veri jet skeleton, still not working

This commit is contained in:
~hatteb-mitlyd 2014-04-12 19:59:02 -07:00
parent 7000bdda2f
commit f0c58605d0
3 changed files with 62 additions and 2 deletions

View File

@ -178,7 +178,8 @@ J164_5_OFILES=\
J164_5_OFILES_ED=\
gen164/5/ed_puck.o \
gen164/5/ed_sign.o
gen164/5/ed_sign.o \
gen164/5/ed_veri.o
J164_6_OFILES=\
gen164/6/al.o \

View File

@ -9,11 +9,13 @@
*/
extern u2_ho_jet j2_mdj(Pt5, coed, ed, sign)[];
extern u2_ho_jet j2_mdj(Pt5, coed, ed, puck)[];
extern u2_ho_jet j2_mdj(Pt5, coed, ed, veri)[];
u2_ho_driver
j2_mcd(Pt5, coed, ed)[] = {
{ j2_sd(Pt5, coed, ed, sign), j2_mdj(Pt5, coed, ed, sign), 0, 0, u2_none },
{ j2_sd(Pt5, coed, ed, puck), j2_mdj(Pt5, coed, ed, puck), 0, 0, u2_none },
{ j2_sd(Pt5, coed, ed, veri), j2_mdj(Pt5, coed, ed, veri), 0, 0, u2_none },
{}
};
@ -21,6 +23,6 @@
*/
u2_ho_driver
j2_mbd(Pt5, coed)[] = {
{ j2_sc(Pt5, coed, ed), 0, j2_mcd(Pt5, coed, ed), 0, 0, u2_none },
{ j2_sc(Pt5, coed, ed), 0, j2_mcd(Pt5, coed, ed), 0, u2_none },
{}
};

57
gen164/5/ed_veri.c Normal file
View File

@ -0,0 +1,57 @@
/* gen164/5/ed_sign.c
**
** This file is in the public domain.
*/
#include "all.h"
#include "../pit.h"
#include <ed25519.h>
/* functions
*/
u2_weak
j2_mdc(Pt5, coed, ed, veri)(u2_wire wir_r,
u2_noun s,
u2_noun m,
u2_noun pk)
{
c3_y sig_y[64];
c3_y pub_y[32];
c3_y* mes_y;
c3_w mesm_w = u2_met(3, s);
c3_w ret;
memset(&sig_y, 64, 0);
memset(&pub_y, 32, 0);
mes_y = c3_malloc(mesm_w);
u2_cr_bytes(0, 64, sig_y, s);
u2_cr_bytes(0, 32, pub_y, pk);
u2_cr_bytes(0, mesm_w, mes_y, m);
ret = ed25519_verify(sig_y, mes_y, mesm_w, pub_y) == 1 ? u2_yes : u2_no;
free(mes_y);
return ret;
}
u2_weak
j2_md(Pt5, coed, ed, veri)(u2_wire wir_r,
u2_noun cor)
{
u2_noun a, b, c;
if ( u2_no == u2_mean(cor,
u2_cv_sam_2, &a, u2_cv_sam_6, &b,
u2_cv_sam_7, &c, 0) ) {
return u2_bl_bail(wir_r, c3__fail);
} else {
return j2_mdc(Pt5, coed, ed, veri)(wir_r, a, b, c);
}
}
/* structures
*/
u2_ho_jet
j2_mdj(Pt5, coed, ed, veri)[] = {
{ ".2", c3__lite, j2_md(Pt5, coed, ed, veri),
u2_jet_test|u2_jet_live, u2_none, u2_none },
{ }
};