rename functions, leaks less memory and more paranoia.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20945 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -191,8 +191,9 @@ static const RSA_METHOD kc_rsa_pkcs1_method = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
private_key(hx509_context context, SecKeychainItemRef itemRef,
|
set_private_key(hx509_context context,
|
||||||
hx509_cert cert)
|
SecKeychainItemRef itemRef,
|
||||||
|
hx509_cert cert)
|
||||||
{
|
{
|
||||||
struct kc_rsa *kc;
|
struct kc_rsa *kc;
|
||||||
hx509_private_key key;
|
hx509_private_key key;
|
||||||
@@ -215,7 +216,7 @@ private_key(hx509_context context, SecKeychainItemRef itemRef,
|
|||||||
|
|
||||||
/* Argh, fake modulus since OpenSSL API is on crack */
|
/* Argh, fake modulus since OpenSSL API is on crack */
|
||||||
{
|
{
|
||||||
SecKeychainAttributeList *attrs;
|
SecKeychainAttributeList *attrs = NULL;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
@@ -233,6 +234,7 @@ private_key(hx509_context context, SecKeychainItemRef itemRef,
|
|||||||
data = malloc(kc->keysize);
|
data = malloc(kc->keysize);
|
||||||
memset(data, 0xe0, kc->keysize);
|
memset(data, 0xe0, kc->keysize);
|
||||||
BN_bin2bn(data, kc->keysize, rsa->n);
|
BN_bin2bn(data, kc->keysize, rsa->n);
|
||||||
|
free(data);
|
||||||
}
|
}
|
||||||
rsa->e = NULL;
|
rsa->e = NULL;
|
||||||
|
|
||||||
@@ -426,8 +428,7 @@ keychain_iter(hx509_context context,
|
|||||||
ret = EINVAL;
|
ret = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
set_private_key(context, itemRef, *cert);
|
||||||
private_key(context, itemRef, *cert);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
Reference in New Issue
Block a user