summaryrefslogtreecommitdiff
path: root/src/sbearssl/sbearssl_ec_skey_from.c
blob: b579f7d40995ca0c4a894a5a07922c96867eabb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* ISC license. */

#include <bearssl.h>
#include <skalibs/stralloc.h>
#include <s6-networking/sbearssl.h>

int sbearssl_ec_skey_from (sbearssl_ec_skey *l, br_ec_private_key const *k, stralloc *sa)
{
  if (!stralloc_catb(sa, (char const *)k->x, k->xlen)) return 0 ;
  l->curve = k->curve ;
  l->x = sa->len - k->xlen ;
  l->xlen = k->xlen ;
  return 1 ;
}