Skip to content

Commit

Permalink
Update src/tools/pkcs11-tool.c
Browse files Browse the repository at this point in the history
fixed filling key type attr on writing object

pointer refers to local variable from destroyed stack frame
  • Loading branch information
mescheryakov1 authored and viktorTarasov committed Jan 27, 2013
1 parent 58679a5 commit f55bb01
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tools/pkcs11-tool.c
Expand Up @@ -1783,6 +1783,7 @@ static int write_object(CK_SESSION_HANDLE session)
struct rsakey_info rsa;
struct gostkey_info gost;
EVP_PKEY *evp_key = NULL;
CK_KEY_TYPE type = CKK_RSA;

memset(&cert, 0, sizeof(cert));
memset(&rsa, 0, sizeof(rsa));
Expand Down Expand Up @@ -1918,7 +1919,6 @@ static int write_object(CK_SESSION_HANDLE session)
n_privkey_attr++;
}
if (evp_key->type == EVP_PKEY_RSA) {
CK_KEY_TYPE type = CKK_RSA;
FILL_ATTR(privkey_templ[n_privkey_attr], CKA_KEY_TYPE, &type, sizeof(type));
n_privkey_attr++;
FILL_ATTR(privkey_templ[n_privkey_attr], CKA_MODULUS, rsa.modulus, rsa.modulus_len);
Expand Down

0 comments on commit f55bb01

Please sign in to comment.