Deleted Added
full compact
ssh-pkcs11.c (294464) ssh-pkcs11.c (296633)
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/*
3 * Copyright (c) 2010 Markus Friedl. All rights reserved.
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 307 unchanged lines hidden (view full) ---

317 const RSA_METHOD *def = RSA_get_default_method();
318
319 k11 = xcalloc(1, sizeof(*k11));
320 k11->provider = provider;
321 provider->refcount++; /* provider referenced by RSA key */
322 k11->slotidx = slotidx;
323 /* identify key object on smartcard */
324 k11->keyid_len = keyid_attrib->ulValueLen;
2/*
3 * Copyright (c) 2010 Markus Friedl. All rights reserved.
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 307 unchanged lines hidden (view full) ---

317 const RSA_METHOD *def = RSA_get_default_method();
318
319 k11 = xcalloc(1, sizeof(*k11));
320 k11->provider = provider;
321 provider->refcount++; /* provider referenced by RSA key */
322 k11->slotidx = slotidx;
323 /* identify key object on smartcard */
324 k11->keyid_len = keyid_attrib->ulValueLen;
325 k11->keyid = xmalloc(k11->keyid_len);
326 memcpy(k11->keyid, keyid_attrib->pValue, k11->keyid_len);
325 if (k11->keyid_len > 0) {
326 k11->keyid = xmalloc(k11->keyid_len);
327 memcpy(k11->keyid, keyid_attrib->pValue, k11->keyid_len);
328 }
327 k11->orig_finish = def->finish;
328 memcpy(&k11->rsa_method, def, sizeof(k11->rsa_method));
329 k11->rsa_method.name = "pkcs11";
330 k11->rsa_method.rsa_priv_enc = pkcs11_rsa_private_encrypt;
331 k11->rsa_method.rsa_priv_dec = pkcs11_rsa_private_decrypt;
332 k11->rsa_method.finish = pkcs11_rsa_finish;
333 RSA_set_method(rsa, &k11->rsa_method);
334 RSA_set_app_data(rsa, k11);

--- 359 unchanged lines hidden ---
329 k11->orig_finish = def->finish;
330 memcpy(&k11->rsa_method, def, sizeof(k11->rsa_method));
331 k11->rsa_method.name = "pkcs11";
332 k11->rsa_method.rsa_priv_enc = pkcs11_rsa_private_encrypt;
333 k11->rsa_method.rsa_priv_dec = pkcs11_rsa_private_decrypt;
334 k11->rsa_method.finish = pkcs11_rsa_finish;
335 RSA_set_method(rsa, &k11->rsa_method);
336 RSA_set_app_data(rsa, k11);

--- 359 unchanged lines hidden ---