diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2016-11-25 18:16:05 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2016-11-25 18:16:05 +0000 |
commit | 018025f0f36a4847df265c9948dbaf7073ed3245 (patch) | |
tree | 984c9a4bba06ef8abc02d0fbe81a70ec28c6f529 /src/sbearssl/sbearssl_rsa_skey_from.c | |
parent | 6421a5e923b0f695047b429e4176bca2873c5189 (diff) | |
download | s6-networking-018025f0f36a4847df265c9948dbaf7073ed3245.tar.xz |
Alpha version of the SSL work.
Doesn't build yet, but I'm scared of losing it, so using git as
storage.
Will fix the stupid bugs now, the tricky bugs later.
Diffstat (limited to 'src/sbearssl/sbearssl_rsa_skey_from.c')
-rw-r--r-- | src/sbearssl/sbearssl_rsa_skey_from.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/sbearssl/sbearssl_rsa_skey_from.c b/src/sbearssl/sbearssl_rsa_skey_from.c new file mode 100644 index 0000000..3e6a04b --- /dev/null +++ b/src/sbearssl/sbearssl_rsa_skey_from.c @@ -0,0 +1,28 @@ +/* ISC license. */ + +#include <sys/types.h> +#include <bearssl.h> +#include <skalibs/stralloc.h> +#include <s6-networking/sbearssl.h> + +int sbearssl_rsa_skey_from (sbearssl_rsa_skey *l, br_rsa_private_key const *k, stralloc *sa) +{ + if (!stralloc_readyplus(k->plen + k->qlen + k->dplen + k->dqlen + k->iqlen)) return 0 ; + l->n_bitlen = k->n_bitlen ; + l->p = sa->len ; + stralloc_catb(sa, k->p, k->plen) ; + l->plen = k->plen ; + l->q = sa->len ; + stralloc_catb(sa, k->q, k->qlen) ; + l->qlen = k->qlen ; + l->dp = sa->len ; + stralloc_catb(sa, k->dp, k->dplen) ; + l->dplen = k->dplen ; + l->dq = sa->len ; + stralloc_catb(sa, k->dq, k->dqlen) ; + l->dqlen = k->dqlen ; + l->iq = sa->len ; + stralloc_catb(sa, k->iq, k->iqlen) ; + l->iqlen = k->iqlen ; + return 1 ; +} |