pkcs11-tool: Avoid strict-aliasing issues on 32b architectures
This commit is contained in:
parent
544dcc6827
commit
63031b2193
@ -6303,11 +6303,12 @@ static CK_SESSION_HANDLE test_kpgen_certwrite(CK_SLOT_ID slot, CK_SESSION_HANDLE
|
|||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = getID(session, priv_key, (CK_ULONG *) &opt_object_id_len);
|
tmp = getID(session, priv_key, &i);
|
||||||
if (opt_object_id_len == 0) {
|
if (i == 0) {
|
||||||
fprintf(stderr, "ERR: newly generated private key has no (or an empty) CKA_ID\n");
|
fprintf(stderr, "ERR: newly generated private key has no (or an empty) CKA_ID\n");
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
opt_object_id_len = (size_t) i;
|
||||||
memcpy(opt_object_id, tmp, opt_object_id_len);
|
memcpy(opt_object_id, tmp, opt_object_id_len);
|
||||||
|
|
||||||
/* This is done in NSS */
|
/* This is done in NSS */
|
||||||
@ -6485,11 +6486,12 @@ static void test_ec(CK_SLOT_ID slot, CK_SESSION_HANDLE session)
|
|||||||
if (!gen_keypair(slot, session, &pub_key, &priv_key, opt_key_type))
|
if (!gen_keypair(slot, session, &pub_key, &priv_key, opt_key_type))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tmp = getID(session, priv_key, (CK_ULONG *) &opt_object_id_len);
|
tmp = getID(session, priv_key, &i);
|
||||||
if (opt_object_id_len == 0) {
|
if (i == 0) {
|
||||||
printf("ERR: newly generated private key has no (or an empty) CKA_ID\n");
|
printf("ERR: newly generated private key has no (or an empty) CKA_ID\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
i = (size_t) opt_object_id_len;
|
||||||
memcpy(opt_object_id, tmp, opt_object_id_len);
|
memcpy(opt_object_id, tmp, opt_object_id_len);
|
||||||
|
|
||||||
/* This is done in NSS */
|
/* This is done in NSS */
|
||||||
|
Loading…
Reference in New Issue
Block a user