summaryrefslogtreecommitdiff
path: root/ssh-pkcs11.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-pkcs11.c')
-rw-r--r--ssh-pkcs11.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ssh-pkcs11.c b/ssh-pkcs11.c
index aaf712d9a..b37491c5d 100644
--- a/ssh-pkcs11.c
+++ b/ssh-pkcs11.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-pkcs11.c,v 1.23 2016/10/28 03:33:52 djm Exp $ */ 1/* $OpenBSD: ssh-pkcs11.c,v 1.25 2017/05/31 09:15:42 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2010 Markus Friedl. All rights reserved. 3 * Copyright (c) 2010 Markus Friedl. All rights reserved.
4 * 4 *
@@ -537,7 +537,8 @@ pkcs11_fetch_keys_filter(struct pkcs11_provider *p, CK_ULONG slotidx,
537 } 537 }
538 if (rsa && rsa->n && rsa->e && 538 if (rsa && rsa->n && rsa->e &&
539 pkcs11_rsa_wrap(p, slotidx, &attribs[0], rsa) == 0) { 539 pkcs11_rsa_wrap(p, slotidx, &attribs[0], rsa) == 0) {
540 key = sshkey_new(KEY_UNSPEC); 540 if ((key = sshkey_new(KEY_UNSPEC)) == NULL)
541 fatal("sshkey_new failed");
541 key->rsa = rsa; 542 key->rsa = rsa;
542 key->type = KEY_RSA; 543 key->type = KEY_RSA;
543 key->flags |= SSHKEY_FLAG_EXT; 544 key->flags |= SSHKEY_FLAG_EXT;
@@ -545,8 +546,8 @@ pkcs11_fetch_keys_filter(struct pkcs11_provider *p, CK_ULONG slotidx,
545 sshkey_free(key); 546 sshkey_free(key);
546 } else { 547 } else {
547 /* expand key array and add key */ 548 /* expand key array and add key */
548 *keysp = xreallocarray(*keysp, *nkeys + 1, 549 *keysp = xrecallocarray(*keysp, *nkeys,
549 sizeof(struct sshkey *)); 550 *nkeys + 1, sizeof(struct sshkey *));
550 (*keysp)[*nkeys] = key; 551 (*keysp)[*nkeys] = key;
551 *nkeys = *nkeys + 1; 552 *nkeys = *nkeys + 1;
552 debug("have %d keys", *nkeys); 553 debug("have %d keys", *nkeys);