summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ssh-pkcs11.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ssh-pkcs11.c b/ssh-pkcs11.c
index 92614a52d..d1f750db0 100644
--- a/ssh-pkcs11.c
+++ b/ssh-pkcs11.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-pkcs11.c,v 1.21 2015/07/18 08:02:17 djm Exp $ */ 1/* $OpenBSD: ssh-pkcs11.c,v 1.22 2016/02/12 00:20:30 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2010 Markus Friedl. All rights reserved. 3 * Copyright (c) 2010 Markus Friedl. All rights reserved.
4 * 4 *
@@ -322,8 +322,10 @@ pkcs11_rsa_wrap(struct pkcs11_provider *provider, CK_ULONG slotidx,
322 k11->slotidx = slotidx; 322 k11->slotidx = slotidx;
323 /* identify key object on smartcard */ 323 /* identify key object on smartcard */
324 k11->keyid_len = keyid_attrib->ulValueLen; 324 k11->keyid_len = keyid_attrib->ulValueLen;
325 k11->keyid = xmalloc(k11->keyid_len); 325 if (k11->keyid_len > 0) {
326 memcpy(k11->keyid, keyid_attrib->pValue, k11->keyid_len); 326 k11->keyid = xmalloc(k11->keyid_len);
327 memcpy(k11->keyid, keyid_attrib->pValue, k11->keyid_len);
328 }
327 k11->orig_finish = def->finish; 329 k11->orig_finish = def->finish;
328 memcpy(&k11->rsa_method, def, sizeof(k11->rsa_method)); 330 memcpy(&k11->rsa_method, def, sizeof(k11->rsa_method));
329 k11->rsa_method.name = "pkcs11"; 331 k11->rsa_method.name = "pkcs11";