Do not cast to a possibly different type size.
Would fail on PowerPC in 64-bits for example. Fix pkcs11-tool.c:2954: warning: dereferencing type-punned pointer will break strict-aliasing rules git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4174 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
5be62d9d67
commit
6add573782
|
@ -2912,6 +2912,7 @@ static int wrap_unwrap(CK_SLOT_ID slot, CK_SESSION_HANDLE session,
|
||||||
int ciphered_len, cleartext_len, len;
|
int ciphered_len, cleartext_len, len;
|
||||||
CK_MECHANISM mech;
|
CK_MECHANISM mech;
|
||||||
CK_ULONG key_type = CKM_DES_CBC;
|
CK_ULONG key_type = CKM_DES_CBC;
|
||||||
|
CK_ULONG key_len_ul;
|
||||||
CK_ATTRIBUTE key_template = { CKA_KEY_TYPE, &key_type, sizeof(key_type) };
|
CK_ATTRIBUTE key_template = { CKA_KEY_TYPE, &key_type, sizeof(key_type) };
|
||||||
|
|
||||||
pkey = get_public_key(session, privKeyObject);
|
pkey = get_public_key(session, privKeyObject);
|
||||||
|
@ -2952,7 +2953,8 @@ static int wrap_unwrap(CK_SLOT_ID slot, CK_SESSION_HANDLE session,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to decrypt */
|
/* Try to decrypt */
|
||||||
key = getVALUE(session, cipherKeyObject, (unsigned long *) &key_len);
|
key = getVALUE(session, cipherKeyObject, &key_len_ul);
|
||||||
|
key_len = key_len_ul;
|
||||||
if (key == NULL) {
|
if (key == NULL) {
|
||||||
printf("Could not get unwrapped key\n");
|
printf("Could not get unwrapped key\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue