diff options
author | Darren Tucker <dtucker@zip.com.au> | 2013-06-02 07:31:17 +1000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2013-06-02 07:31:17 +1000 |
commit | a627d42e51ffa71e014d7b2d2c07118122fd3ec3 (patch) | |
tree | 7bda769de81f509e28d800916fa20abd37906d79 /ssh-pkcs11.c | |
parent | c7aad0058c957afeb26a3f703e8cb0eddeb62365 (diff) |
- djm@cvs.openbsd.org 2013/05/17 00:13:13
[xmalloc.h cipher.c sftp-glob.c ssh-keyscan.c ssh.c sftp-common.c
ssh-ecdsa.c auth2-chall.c compat.c readconf.c kexgexs.c monitor.c
gss-genr.c cipher-3des1.c kex.c monitor_wrap.c ssh-pkcs11-client.c
auth-options.c rsa.c auth2-pubkey.c sftp.c hostfile.c auth2.c
servconf.c auth.c authfile.c xmalloc.c uuencode.c sftp-client.c
auth2-gss.c sftp-server.c bufaux.c mac.c session.c jpake.c kexgexc.c
sshconnect.c auth-chall.c auth2-passwd.c sshconnect1.c buffer.c
kexecdhs.c kexdhs.c ssh-rsa.c auth1.c ssh-pkcs11.c auth2-kbdint.c
kexdhc.c sshd.c umac.c ssh-dss.c auth2-jpake.c bufbn.c clientloop.c
monitor_mm.c scp.c roaming_client.c serverloop.c key.c auth-rsa.c
ssh-pkcs11-helper.c ssh-keysign.c ssh-keygen.c match.c channels.c
sshconnect2.c addrmatch.c mux.c canohost.c kexecdhc.c schnorr.c
ssh-add.c misc.c auth2-hostbased.c ssh-agent.c bufec.c groupaccess.c
dns.c packet.c readpass.c authfd.c moduli.c]
bye, bye xfree(); ok markus@
Diffstat (limited to 'ssh-pkcs11.c')
-rw-r--r-- | ssh-pkcs11.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/ssh-pkcs11.c b/ssh-pkcs11.c index 1f4c1c8e4..a17326baa 100644 --- a/ssh-pkcs11.c +++ b/ssh-pkcs11.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-pkcs11.c,v 1.6 2010/06/08 21:32:19 markus Exp $ */ | 1 | /* $OpenBSD: ssh-pkcs11.c,v 1.7 2013/05/17 00:13:14 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2010 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2010 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -120,9 +120,9 @@ pkcs11_provider_unref(struct pkcs11_provider *p) | |||
120 | if (--p->refcount <= 0) { | 120 | if (--p->refcount <= 0) { |
121 | if (p->valid) | 121 | if (p->valid) |
122 | error("pkcs11_provider_unref: %p still valid", p); | 122 | error("pkcs11_provider_unref: %p still valid", p); |
123 | xfree(p->slotlist); | 123 | free(p->slotlist); |
124 | xfree(p->slotinfo); | 124 | free(p->slotinfo); |
125 | xfree(p); | 125 | free(p); |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
@@ -180,9 +180,8 @@ pkcs11_rsa_finish(RSA *rsa) | |||
180 | rv = k11->orig_finish(rsa); | 180 | rv = k11->orig_finish(rsa); |
181 | if (k11->provider) | 181 | if (k11->provider) |
182 | pkcs11_provider_unref(k11->provider); | 182 | pkcs11_provider_unref(k11->provider); |
183 | if (k11->keyid) | 183 | free(k11->keyid); |
184 | xfree(k11->keyid); | 184 | free(k11); |
185 | xfree(k11); | ||
186 | } | 185 | } |
187 | return (rv); | 186 | return (rv); |
188 | } | 187 | } |
@@ -266,11 +265,11 @@ pkcs11_rsa_private_encrypt(int flen, const u_char *from, u_char *to, RSA *rsa, | |||
266 | return (-1); /* bail out */ | 265 | return (-1); /* bail out */ |
267 | if ((rv = f->C_Login(si->session, CKU_USER, pin, strlen(pin))) | 266 | if ((rv = f->C_Login(si->session, CKU_USER, pin, strlen(pin))) |
268 | != CKR_OK) { | 267 | != CKR_OK) { |
269 | xfree(pin); | 268 | free(pin); |
270 | error("C_Login failed: %lu", rv); | 269 | error("C_Login failed: %lu", rv); |
271 | return (-1); | 270 | return (-1); |
272 | } | 271 | } |
273 | xfree(pin); | 272 | free(pin); |
274 | si->logged_in = 1; | 273 | si->logged_in = 1; |
275 | } | 274 | } |
276 | key_filter[1].pValue = k11->keyid; | 275 | key_filter[1].pValue = k11->keyid; |
@@ -470,7 +469,7 @@ pkcs11_fetch_keys(struct pkcs11_provider *p, CK_ULONG slotidx, Key ***keysp, | |||
470 | } | 469 | } |
471 | } | 470 | } |
472 | for (i = 0; i < 3; i++) | 471 | for (i = 0; i < 3; i++) |
473 | xfree(attribs[i].pValue); | 472 | free(attribs[i].pValue); |
474 | } | 473 | } |
475 | if ((rv = f->C_FindObjectsFinal(session)) != CKR_OK) | 474 | if ((rv = f->C_FindObjectsFinal(session)) != CKR_OK) |
476 | error("C_FindObjectsFinal failed: %lu", rv); | 475 | error("C_FindObjectsFinal failed: %lu", rv); |
@@ -579,11 +578,9 @@ fail: | |||
579 | if (need_finalize && (rv = f->C_Finalize(NULL)) != CKR_OK) | 578 | if (need_finalize && (rv = f->C_Finalize(NULL)) != CKR_OK) |
580 | error("C_Finalize failed: %lu", rv); | 579 | error("C_Finalize failed: %lu", rv); |
581 | if (p) { | 580 | if (p) { |
582 | if (p->slotlist) | 581 | free(p->slotlist); |
583 | xfree(p->slotlist); | 582 | free(p->slotinfo); |
584 | if (p->slotinfo) | 583 | free(p); |
585 | xfree(p->slotinfo); | ||
586 | xfree(p); | ||
587 | } | 584 | } |
588 | if (handle) | 585 | if (handle) |
589 | dlclose(handle); | 586 | dlclose(handle); |