summary refs log tree commit diff
path: root/tls_signer.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2023-10-11 19:33:38 -0400
committerJune McEnroe <june@causal.agency>2023-10-11 19:33:38 -0400
commit198349012002f8d30013eb23c7d6df6a3c9cc65a (patch)
treebd0567586a018ee4a9d450c2c1de1d10e6f6bd61 /tls_signer.c
parentMerge LibreSSL 3.8.0 (diff)
parentImport LibreSSL 3.8.1 (diff)
downloadlibretls-198349012002f8d30013eb23c7d6df6a3c9cc65a.tar.gz
libretls-198349012002f8d30013eb23c7d6df6a3c9cc65a.zip
Merge LibreSSL 3.8.1 HEAD 3.8.1 master
Diffstat (limited to '')
-rw-r--r--tls_signer.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/tls_signer.c b/tls_signer.c
index 97e5e38..76150fd 100644
--- a/tls_signer.c
+++ b/tls_signer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls_signer.c,v 1.5 2023/04/09 18:26:26 tb Exp $ */
+/* $OpenBSD: tls_signer.c,v 1.9 2023/06/18 19:12:58 tb Exp $ */
 /*
  * Copyright (c) 2021 Eric Faurot <eric@openbsd.org>
  *
@@ -424,17 +424,26 @@ EC_KEY_METHOD *
 tls_signer_ecdsa_method(void)
 {
 	static EC_KEY_METHOD *ecdsa_method = NULL;
+	const EC_KEY_METHOD *default_method;
+	int (*sign)(int type, const unsigned char *dgst, int dlen,
+	    unsigned char *sig, unsigned int *siglen,
+	    const BIGNUM *kinv, const BIGNUM *r, EC_KEY *eckey);
+	int (*sign_setup)(EC_KEY *eckey, BN_CTX *ctx_in,
+	    BIGNUM **kinvp, BIGNUM **rp);
 
 	pthread_mutex_lock(&signer_method_lock);
 
 	if (ecdsa_method != NULL)
 		goto out;
 
-	ecdsa_method = EC_KEY_METHOD_new(NULL);
+	default_method = EC_KEY_get_default_method();
+	ecdsa_method = EC_KEY_METHOD_new(default_method);
 	if (ecdsa_method == NULL)
 		goto out;
 
-	EC_KEY_METHOD_set_sign(ecdsa_method, NULL, NULL, tls_ecdsa_do_sign);
+	EC_KEY_METHOD_get_sign(default_method, &sign, &sign_setup, NULL);
+	EC_KEY_METHOD_set_sign(ecdsa_method, sign, sign_setup,
+	    tls_ecdsa_do_sign);
 
  out:
 	pthread_mutex_unlock(&signer_method_lock);