summaryrefslogtreecommitdiff
path: root/src/sbearssl/sbearssl_s6tlsd.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2016-11-25 21:16:58 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2016-11-25 21:16:58 +0000
commitcb31c5e82982447c5036ace732feac15b8042eac (patch)
treedf6700c5747d4e29682dd02e8927a551ef81fcce /src/sbearssl/sbearssl_s6tlsd.c
parenta6b3bddb41db1771ac9190a77caac1c7217e7e4b (diff)
downloads6-networking-cb31c5e82982447c5036ace732feac15b8042eac.tar.xz
Add EC certificate issuer key type detection for sbearssl
Diffstat (limited to 'src/sbearssl/sbearssl_s6tlsd.c')
-rw-r--r--src/sbearssl/sbearssl_s6tlsd.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/sbearssl/sbearssl_s6tlsd.c b/src/sbearssl/sbearssl_s6tlsd.c
index 1198349..35dd18a 100644
--- a/src/sbearssl/sbearssl_s6tlsd.c
+++ b/src/sbearssl/sbearssl_s6tlsd.c
@@ -66,9 +66,20 @@ int sbearssl_s6tlsd (char const *const *argv, char const *const *envp, tain_t co
br_ssl_server_init_full_rsa(&sc, chain, chainlen, &key.rsa) ;
break ;
case BR_KEYTYPE_EC :
+ {
+ int kt, r ;
sbearssl_ec_skey_to(&skey.data.ec, &key.ec, storage.s) ;
- br_ssl_server_init_full_ec(&sc, chain, chainlen, BR_KEYTYPE_EC, &key.ec) ;
+ r = sbearssl_ec_issuer_keytype(&kt, &chain[0]) ;
+ switch (r)
+ {
+ case -2 : strerr_dief1x(96, "certificate issuer key type not recognized") ;
+ case -1 : strerr_diefu1sys(111, "get certificate issuer key type") ;
+ case 0 : break ;
+ default : strerr_diefu3x(96, "get certificate issuer key type", ": ", sbearssl_error_str(r)) ;
+ }
+ br_ssl_server_init_full_ec(&sc, chain, chainlen, kt, &key.ec) ;
break ;
+ }
default :
strerr_dief1x(96, "unsupported private key type") ;
}