u3: renames secp init/stop functions, fixes comment

This commit is contained in:
Joe Bryan 2021-08-19 22:14:52 -04:00
parent c73e595d32
commit 5b7af05bb4
2 changed files with 10 additions and 8 deletions

View File

@ -8,20 +8,22 @@
static urcrypt_secp_context* sec_u; static urcrypt_secp_context* sec_u;
/* call at process start */ /* call at process start */
void u3e_secp_init() void
u3je_secp_init()
{ {
c3_y ent_y[32]; c3_y ent_y[32];
ent_getentropy(ent_y, 32); ent_getentropy(ent_y, 32);
sec_u = malloc(urcrypt_secp_prealloc_size()); sec_u = malloc(urcrypt_secp_prealloc_size());
if ( 0 != urcrypt_secp_init(sec_u, ent_y) ) { if ( 0 != urcrypt_secp_init(sec_u, ent_y) ) {
u3l_log("%s\r\n", "u3e_secp_init failed"); u3l_log("u3e_secp_init failed\r\n");
abort(); abort();
} }
} }
/* call at process end */ /* call at process end */
void u3e_secp_stop() void
u3je_secp_stop()
{ {
urcrypt_secp_destroy(sec_u); urcrypt_secp_destroy(sec_u);
free(sec_u); free(sec_u);
@ -58,7 +60,7 @@ _cqes_in_order(u3_atom a)
else { else {
c3_y i_y; c3_y i_y;
c3_w *buf_w = a_u->buf_w; c3_w *buf_w = a_u->buf_w;
// loop from most to least significant bytes // loop from most to least significant words
for ( i_y = 8; i_y > 0; ) { for ( i_y = 8; i_y > 0; ) {
c3_w b_w = buf_w[i_y], c3_w b_w = buf_w[i_y],
o_w = now_w[--i_y]; o_w = now_w[--i_y];

View File

@ -1678,8 +1678,8 @@ _cm_signals(void)
# endif # endif
} }
extern void u3e_secp_init(void); extern void u3je_secp_init(void);
extern void u3e_secp_stop(void); extern void u3je_secp_stop(void);
static void static void
_cm_crypto() _cm_crypto()
@ -1692,7 +1692,7 @@ _cm_crypto()
abort(); abort();
} }
u3e_secp_init(); u3je_secp_init();
} }
/* u3m_init(): start the environment. /* u3m_init(): start the environment.
@ -1745,7 +1745,7 @@ u3m_init(void)
void void
u3m_stop() u3m_stop()
{ {
u3e_secp_stop(); u3je_secp_stop();
} }
/* u3m_boot(): start the u3 system. return next event, starting from 1. /* u3m_boot(): start the u3 system. return next event, starting from 1.