blob: ac16969137fec1bc6af78448607fd17eb5f3b6a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
/* ISC license. */
#include <errno.h>
#include <bearssl.h>
#include <s6-networking/sbearssl.h>
int sbearssl_skey_from (sbearssl_skey *l, br_skey const *k, stralloc *sa)
{
switch (k->type)
{
case BR_KEYTYPE_RSA :
if (!sbearssl_rsa_skey_from(&l->data.rsa, &k->data.rsa, sa)) return 0 ;
break ;
case BR_KEYTYPE_EC :
if (!sbearssl_ec_skey_from(&l->data.ec, &k->data.ec, sa)) return 0 ;
break ;
default :
return (errno = EINVAL, 0) ;
}
l->type = k->type ;
return 1 ;
}
|