shrub/jets/e/ed_puck.c

34 lines
566 B
C
Raw Normal View History

2014-05-29 02:40:21 +04:00
/* gen164/5/ed_puck.c
**
*/
#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
2014-11-06 22:13:57 +03:00
u3wee_puck(u3_noun cor)
{
c3_y pub_y[32];
c3_y sec_y[64];
c3_y sed_y[32];
c3_w met_w;
2014-11-18 00:56:51 +03:00
u3_noun a = u3r_at(u3x_sam, cor);
2014-11-06 02:36:30 +03:00
if ( (u3_none == a) || (c3n == u3ud(a)) ) {
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__exit);
}
2014-11-06 03:20:01 +03:00
met_w = u3r_met(3, a);
if ( met_w > 32 ) {
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__exit);
}
memset(sed_y, 0, 32);
2014-11-06 03:20:01 +03:00
u3r_bytes(0, met_w, sed_y, a);
ed25519_create_keypair(pub_y, sec_y, sed_y);
2014-11-06 03:20:01 +03:00
return u3i_bytes(32, pub_y);
}