static char *ecc_cache_str_shared( const char *curve_name, mp_int *x, mp_int *y) { strbuf *sb = strbuf_new(); if (curve_name) strbuf_catf(sb, "%s,", curve_name); char *hx = mp_get_hex(x); char *hy = mp_get_hex(y); strbuf_catf(sb, "0x%s,0x%s", hx, hy); sfree(hx); sfree(hy); return strbuf_to_str(sb); }
static void append_hex_to_strbuf(strbuf *sb, mp_int *x) { if (sb->len > 0) put_byte(sb, ','); put_data(sb, "0x", 2); char *hex = mp_get_hex(x); size_t hexlen = strlen(hex); put_data(sb, hex, hexlen); smemclr(hex, hexlen); sfree(hex); }