2014-05-29 02:40:21 +04:00
|
|
|
/* gen164/5/ed_puck.c
|
2014-04-12 04:02:10 +04:00
|
|
|
**
|
|
|
|
*/
|
|
|
|
#include "all.h"
|
2014-09-04 07:10:43 +04:00
|
|
|
|
2014-04-12 04:02:10 +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)
|
2014-04-12 04:02:10 +04:00
|
|
|
{
|
|
|
|
c3_y pub_y[32];
|
|
|
|
c3_y sec_y[64];
|
|
|
|
c3_y sed_y[32];
|
2014-04-20 01:17:35 +04:00
|
|
|
c3_w met_w;
|
2014-11-18 00:56:51 +03:00
|
|
|
u3_noun a = u3r_at(u3x_sam, cor);
|
2014-04-12 04:02:10 +04:00
|
|
|
|
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-04-12 04:02:10 +04:00
|
|
|
}
|
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
met_w = u3r_met(3, a);
|
2014-04-20 01:17:35 +04:00
|
|
|
if ( met_w > 32 ) {
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__exit);
|
2014-04-20 01:17:35 +04:00
|
|
|
}
|
|
|
|
|
2014-04-19 02:34:16 +04:00
|
|
|
memset(sed_y, 0, 32);
|
2014-11-06 03:20:01 +03:00
|
|
|
u3r_bytes(0, met_w, sed_y, a);
|
2014-04-12 04:02:10 +04:00
|
|
|
ed25519_create_keypair(pub_y, sec_y, sed_y);
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3i_bytes(32, pub_y);
|
2014-04-12 04:02:10 +04:00
|
|
|
}
|