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

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

int sbearssl_cert_from (sbearssl_cert *sc, br_x509_certificate const *bc, stralloc *sa)
{
  if (!stralloc_catb(sa, (char const *)bc->data, bc->data_len)) return 0 ;
  sc->data = sa->len - bc->data_len ;
  sc->datalen = bc->data_len ;
  return 1 ;
}