libcr51sign: Fix struct size warning
The code is currently correct in the usage of the
signature_rsa4096_pkcs15 struct, but GCC infers that we could use
members past the end of the buffer it comes from.
Change-Id: I728e7361dd677fcce498857124dbe8908aaac64d
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/subprojects/libcr51sign/src/libcr51sign.c b/subprojects/libcr51sign/src/libcr51sign.c
index 06183d3..d89c88d 100644
--- a/subprojects/libcr51sign/src/libcr51sign.c
+++ b/subprojects/libcr51sign/src/libcr51sign.c
@@ -185,8 +185,6 @@
read_len = SIGNATURE_OFFSET
};
uint8_t buffer[read_len];
- // "modulus" & "signature" will not be indexed.
- struct signature_rsa4096_pkcs15* sig_data = (void*)&buffer;
int rv;
rv = intf->read(ctx, signature_struct_offset, read_len, buffer);
if (rv != LIBCR51SIGN_SUCCESS)
@@ -195,7 +193,7 @@
"validate_transition: failed to read signature struct");
return LIBCR51SIGN_ERROR_RUNTIME_FAILURE;
}
- if (sig_data->signature_magic != SIGNATURE_MAGIC)
+ if (*(uint32_t*)buffer != SIGNATURE_MAGIC)
{
CPRINTS(ctx, "validate_transition: bad signature magic");
return LIBCR51SIGN_ERROR_INVALID_DESCRIPTOR;