shrub/j/5/ed_puck.c

35 lines
618 B
C
Raw Normal View History

2014-05-29 02:40:21 +04:00
/* gen164/5/ed_puck.c
**
** This file is in the public domain.
*/
#include "all.h"
2014-09-04 07:10:43 +04:00
#include <ed25519.h>
/* functions
*/
2014-09-06 00:13:24 +04:00
u3_noun
u3_cwee_puck(u3_noun cor)
{
c3_y pub_y[32];
c3_y sec_y[64];
c3_y sed_y[32];
c3_w met_w;
2014-09-06 00:13:24 +04:00
u3_noun a = u3_cr_at(u3_cv_sam, cor);
2014-11-05 04:18:47 +03:00
if ( (c3nne == a) || (c3n == u3ud(a)) ) {
2014-09-06 00:13:24 +04:00
return u3_cm_bail(c3__exit);
}
2014-09-06 00:13:24 +04:00
met_w = u3_cr_met(3, a);
if ( met_w > 32 ) {
2014-09-06 00:13:24 +04:00
return u3_cm_bail(c3__exit);
}
memset(sed_y, 0, 32);
2014-09-06 00:13:24 +04:00
u3_cr_bytes(0, met_w, sed_y, a);
ed25519_create_keypair(pub_y, sec_y, sed_y);
2014-09-06 00:13:24 +04:00
return u3_ci_bytes(32, pub_y);
}