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

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

int sbearssl_rsa_pkey_from (sbearssl_rsa_pkey *l, br_rsa_public_key const *k, stralloc *sa)
{
  if (!stralloc_readyplus(k->nlen + k->elen)) return 0 ;
  l->n = sa->len ;
  stralloc_catb(sa, k->n, k->nlen) ;
  l->nlen = k->nlen ;
  l->e = sa->len ;
  stralloc_catb(sa, k->e, k->elen) ;
  l->elen = k->elen ;
  return 1 ;
}