mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-28 08:14:24 +02:00
upstream: get the ex_data (pkcs11_key object) back from the keys at
the index at which it was inserted, rather than assuming index 0 OpenBSD-Commit-ID: 1f3a6ce0346c8014e895e50423bef16401510aa8
This commit is contained in:
parent
0a5f2ea356
commit
ce46c3a077
17
ssh-pkcs11.c
17
ssh-pkcs11.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: ssh-pkcs11.c,v 1.37 2019/01/21 00:47:34 djm Exp $ */
|
/* $OpenBSD: ssh-pkcs11.c,v 1.38 2019/01/21 02:01:03 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010 Markus Friedl. All rights reserved.
|
* Copyright (c) 2010 Markus Friedl. All rights reserved.
|
||||||
* Copyright (c) 2014 Pedro Martelletto. All rights reserved.
|
* Copyright (c) 2014 Pedro Martelletto. All rights reserved.
|
||||||
@ -187,6 +187,11 @@ pkcs11_del_provider(char *provider_id)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static RSA_METHOD *rsa_method;
|
||||||
|
static int rsa_idx = 0;
|
||||||
|
static EC_KEY_METHOD *ec_key_method;
|
||||||
|
static int ec_key_idx = 0;
|
||||||
|
|
||||||
/* release a wrapped object */
|
/* release a wrapped object */
|
||||||
static void
|
static void
|
||||||
pkcs11_k11_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, int idx,
|
pkcs11_k11_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, int idx,
|
||||||
@ -328,7 +333,7 @@ pkcs11_rsa_private_encrypt(int flen, const u_char *from, u_char *to, RSA *rsa,
|
|||||||
CK_RV rv;
|
CK_RV rv;
|
||||||
int rval = -1;
|
int rval = -1;
|
||||||
|
|
||||||
if ((k11 = RSA_get_ex_data(rsa, 0)) == NULL) {
|
if ((k11 = RSA_get_ex_data(rsa, rsa_idx)) == NULL) {
|
||||||
error("RSA_get_ex_data failed for rsa %p", rsa);
|
error("RSA_get_ex_data failed for rsa %p", rsa);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@ -359,9 +364,6 @@ pkcs11_rsa_private_decrypt(int flen, const u_char *from, u_char *to, RSA *rsa,
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static RSA_METHOD *rsa_method;
|
|
||||||
static int rsa_idx = 0;
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pkcs11_rsa_start_wrapper(void)
|
pkcs11_rsa_start_wrapper(void)
|
||||||
{
|
{
|
||||||
@ -424,7 +426,7 @@ ecdsa_do_sign(const unsigned char *dgst, int dgst_len, const BIGNUM *inv,
|
|||||||
u_char *sig;
|
u_char *sig;
|
||||||
BIGNUM *r = NULL, *s = NULL;
|
BIGNUM *r = NULL, *s = NULL;
|
||||||
|
|
||||||
if ((k11 = EC_KEY_get_ex_data(ec, 0)) == NULL) {
|
if ((k11 = EC_KEY_get_ex_data(ec, ec_key_idx)) == NULL) {
|
||||||
ossl_error("EC_KEY_get_key_method_data failed for ec");
|
ossl_error("EC_KEY_get_key_method_data failed for ec");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@ -478,9 +480,6 @@ ecdsa_do_sign(const unsigned char *dgst, int dgst_len, const BIGNUM *inv,
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static EC_KEY_METHOD *ec_key_method;
|
|
||||||
static int ec_key_idx = 0;
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pkcs11_ecdsa_start_wrapper(void)
|
pkcs11_ecdsa_start_wrapper(void)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user