summaryrefslogtreecommitdiff
path: root/src/sbearssl/sbearssl_skey_readfile.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2016-11-25 20:16:06 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2016-11-25 20:16:06 +0000
commit8d532683386121e70810b0d7c6642cc2c2b89cb0 (patch)
tree866010763c829a35b18603c5af58896bd14afd18 /src/sbearssl/sbearssl_skey_readfile.c
parent018025f0f36a4847df265c9948dbaf7073ed3245 (diff)
downloads6-networking-8d532683386121e70810b0d7c6642cc2c2b89cb0.tar.xz
Fix build bugs. It builds!
Two things remain to do: - how to pass SNI information to libtls - how to detect cert issuer key type for ECC in bearssl
Diffstat (limited to 'src/sbearssl/sbearssl_skey_readfile.c')
-rw-r--r--src/sbearssl/sbearssl_skey_readfile.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/sbearssl/sbearssl_skey_readfile.c b/src/sbearssl/sbearssl_skey_readfile.c
index 64ac28d..d5cf2b5 100644
--- a/src/sbearssl/sbearssl_skey_readfile.c
+++ b/src/sbearssl/sbearssl_skey_readfile.c
@@ -22,17 +22,17 @@ static int decode_key (sbearssl_skey *key, char const *s, size_t len, stralloc *
{
case 0 : return br_skey_decoder_last_error(&ctx) ;
case BR_KEYTYPE_RSA :
- if (!sbearssl_rsa_skey_from(&key->data.rsa, ctx.key.rsa, sa) return -1 ;
+ if (!sbearssl_rsa_skey_from(&key->data.rsa, &ctx.key.rsa, sa)) return -1 ;
break ;
case BR_KEYTYPE_EC :
- if (!sbearssl_ec_skey_from(&key->data.ec, ctx.key.ec, sa) return -1 ;
+ if (!sbearssl_ec_skey_from(&key->data.ec, &ctx.key.ec, sa)) return -1 ;
break ;
}
key->type = ktype ;
return 0 ;
}
-int sbearssl_skey_readfile (char const *fn, sbearssl_skey *key, stralloc *sa) ;
+int sbearssl_skey_readfile (char const *fn, sbearssl_skey *key, stralloc *sa)
{
char buf[MAXKEYFILESIZE] ;
stralloc tmp = STRALLOC_ZERO ;
@@ -40,10 +40,10 @@ int sbearssl_skey_readfile (char const *fn, sbearssl_skey *key, stralloc *sa) ;
sbearssl_pemobject *p ;
size_t n ;
size_t i = 0 ;
- int r = openreadnclose(fn, buf, MAKKEYFILESIZE) ;
+ int r = openreadnclose(fn, buf, MAXKEYFILESIZE) ;
if (r < 0) return r ;
n = r ;
- if (sbearssl_isder(buf, n)) return decode_key(key, buf, n) ;
+ if (sbearssl_isder((unsigned char *)buf, n)) return decode_key(key, buf, n, sa) ;
r = sbearssl_pem_decode_from_string(buf, n, &list, &tmp) ;
if (r) return r ;
p = genalloc_s(sbearssl_pemobject, &list) ;
@@ -66,6 +66,6 @@ int sbearssl_skey_readfile (char const *fn, sbearssl_skey *key, stralloc *sa) ;
r = -1 ; errno = EINVAL ;
fail:
stralloc_free(&tmp) ;
- genalloc_free(sbearssl_pemobject, list) ;
+ genalloc_free(sbearssl_pemobject, &list) ;
return r ;
}