aboutsummaryrefslogtreecommitdiff
path: root/src/include/ipxe
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2024-03-27 14:28:47 +0000
committerMichael Brown <mcb30@ipxe.org>2024-03-27 14:28:47 +0000
commit37850e0e854292d074c2d35d18d7bb78d8e6ff85 (patch)
tree39b0581719832b892a925706be0af3cbf6768137 /src/include/ipxe
parent9bbe77669c6e2b71826449d854f5aa0e2cee7767 (diff)
downloadipxe-gcmassert.zip
ipxe-gcmassert.tar.gz
ipxe-gcmassert.tar.bz2
[build] Fix build failures with random versions of gccgcmassert
For unknown reasons, miscellaneous versions of gcc seem to struggle with the static assertions used to ensure the correct layout of the GCM structures. Adjust the assertions to use offsetof() rather than direct pointer comparison, on the basis that offsetof() must be a compile-time constant value. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe')
-rw-r--r--src/include/ipxe/gcm.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/include/ipxe/gcm.h b/src/include/ipxe/gcm.h
index 4864445..2c785a9 100644
--- a/src/include/ipxe/gcm.h
+++ b/src/include/ipxe/gcm.h
@@ -89,10 +89,9 @@ static int _gcm_name ## _setkey ( void *ctx, const void *key, \
size_t keylen ) { \
struct _gcm_name ## _context *context = ctx; \
build_assert ( _blocksize == sizeof ( context->gcm.key ) ); \
- build_assert ( ( ( void * ) &context->gcm ) == \
- ( ( void * ) context ) ); \
- build_assert ( ( ( void * ) &context->raw ) == \
- ( ( void * ) context->gcm.raw_ctx ) ); \
+ build_assert ( offsetof ( typeof ( *context ), gcm ) == 0 ); \
+ build_assert ( offsetof ( typeof ( *context ), raw ) == \
+ offsetof ( typeof ( *context ), gcm.raw_ctx ) ); \
return gcm_setkey ( &context->gcm, key, keylen, &_raw_cipher ); \
} \
static void _gcm_name ## _setiv ( void *ctx, const void *iv, \