mirror of
https://git.code.sf.net/p/linux-ima/ima-evm-utils
synced 2025-04-29 15:13:38 +02:00
ima-evm-utils: Fix clang warning about possible unaligned pointer for hdr->keyid
Struct signature_v2_hdr is packed so clang complains that taking address of packed member may result in an unaligned pointer value: libimaevm.c:481:21: warning: taking address of packed member 'keyid' of class or structure 'signature_v2_hdr' may result in an unaligned pointer value [-Waddress-of-packed-member] __be32_to_cpup(&hdr->keyid)); ^~~~~~~~~~ libimaevm.c:905:17: warning: taking address of packed member 'keyid' of class or structure 'signature_v2_hdr' may result in an unaligned pointer value [-Waddress-of-packed-member] calc_keyid_v2(&hdr->keyid, name, pkey); ^~~~~~~~~~ Signed-off-by: Vitaly Chikunov <vt@altlinux.org> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
parent
ae57a3e1e4
commit
40c842ace3
@ -475,10 +475,12 @@ int verify_hash_v2(const char *file, const unsigned char *hash, int size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (public_keys) {
|
if (public_keys) {
|
||||||
pkey = find_keyid(hdr->keyid);
|
uint32_t keyid = hdr->keyid;
|
||||||
|
|
||||||
|
pkey = find_keyid(keyid);
|
||||||
if (!pkey) {
|
if (!pkey) {
|
||||||
log_err("%s: unknown keyid: %x\n", file,
|
log_err("%s: unknown keyid: %x\n", file,
|
||||||
__be32_to_cpup(&hdr->keyid));
|
__be32_to_cpup(&keyid));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -869,6 +871,7 @@ int sign_hash_v2(const char *algo, const unsigned char *hash, int size, const ch
|
|||||||
const EVP_MD *md;
|
const EVP_MD *md;
|
||||||
size_t sigsize;
|
size_t sigsize;
|
||||||
const char *st;
|
const char *st;
|
||||||
|
uint32_t keyid;
|
||||||
|
|
||||||
if (!hash) {
|
if (!hash) {
|
||||||
log_err("sign_hash_v2: hash is null\n");
|
log_err("sign_hash_v2: hash is null\n");
|
||||||
@ -902,7 +905,8 @@ int sign_hash_v2(const char *algo, const unsigned char *hash, int size, const ch
|
|||||||
|
|
||||||
hdr->hash_algo = get_hash_algo(algo);
|
hdr->hash_algo = get_hash_algo(algo);
|
||||||
|
|
||||||
calc_keyid_v2(&hdr->keyid, name, pkey);
|
calc_keyid_v2(&keyid, name, pkey);
|
||||||
|
hdr->keyid = keyid;
|
||||||
|
|
||||||
st = "EVP_PKEY_CTX_new";
|
st = "EVP_PKEY_CTX_new";
|
||||||
if (!(ctx = EVP_PKEY_CTX_new(pkey, NULL)))
|
if (!(ctx = EVP_PKEY_CTX_new(pkey, NULL)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user