|
Lines 186-191
_pkcs11_convert_to_ssh_key(const pkcs11h
Link Here
|
| 186 |
pkcs11h_openssl_session_t openssl_session = NULL; |
186 |
pkcs11h_openssl_session_t openssl_session = NULL; |
| 187 |
Key *internal_key = NULL; |
187 |
Key *internal_key = NULL; |
| 188 |
char *internal_comment = NULL; |
188 |
char *internal_comment = NULL; |
|
|
189 |
#if defined(ENABLE_PKCS11_X509) |
| 190 |
X509 *x509 = NULL; |
| 191 |
#endif |
| 189 |
RSA *rsa = NULL; |
192 |
RSA *rsa = NULL; |
| 190 |
size_t temp; |
193 |
size_t temp; |
| 191 |
CK_RV rv = CKR_OK; |
194 |
CK_RV rv = CKR_OK; |
|
Lines 245-255
_pkcs11_convert_to_ssh_key(const pkcs11h
Link Here
|
| 245 |
goto cleanup; |
248 |
goto cleanup; |
| 246 |
} |
249 |
} |
| 247 |
|
250 |
|
|
|
251 |
#if defined(ENABLE_PKCS11_X509) |
| 252 |
if ((x509 = pkcs11h_openssl_session_getX509(openssl_session)) == NULL) { |
| 253 |
error("PKCS#11: Unable get certificate object"); |
| 254 |
goto cleanup; |
| 255 |
} |
| 256 |
#endif |
| 257 |
|
| 248 |
internal_key = key_new_private(KEY_UNSPEC); |
258 |
internal_key = key_new_private(KEY_UNSPEC); |
| 249 |
internal_key->flags |= KEY_FLAG_EXT; |
259 |
internal_key->flags |= KEY_FLAG_EXT; |
| 250 |
internal_key->rsa = rsa; |
260 |
internal_key->rsa = rsa; |
| 251 |
rsa = NULL; |
261 |
rsa = NULL; |
|
|
262 |
#if defined(ENABLE_PKCS11_X509) |
| 263 |
internal_key->type = KEY_X509_RSA; |
| 264 |
internal_key->x509 = x509; |
| 265 |
x509 = NULL; |
| 266 |
#else |
| 252 |
internal_key->type = KEY_RSA; |
267 |
internal_key->type = KEY_RSA; |
|
|
268 |
#endif |
| 253 |
|
269 |
|
| 254 |
*key = internal_key; |
270 |
*key = internal_key; |
| 255 |
internal_key = NULL; |
271 |
internal_key = NULL; |
|
Lines 257-262
_pkcs11_convert_to_ssh_key(const pkcs11h
Link Here
|
| 257 |
internal_comment = NULL; |
273 |
internal_comment = NULL; |
| 258 |
|
274 |
|
| 259 |
cleanup: |
275 |
cleanup: |
|
|
276 |
#if defined(ENABLE_PKCS11_X509) |
| 277 |
if (x509 != NULL) { |
| 278 |
X509_free(x509); |
| 279 |
x509 = NULL; |
| 280 |
} |
| 281 |
#endif |
| 282 |
|
| 260 |
if (internal_key != NULL) { |
283 |
if (internal_key != NULL) { |
| 261 |
key_free(internal_key); |
284 |
key_free(internal_key); |
| 262 |
internal_key = NULL; |
285 |
internal_key = NULL; |