X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/060df5ea7c632b1ac8cc8aac1fb59758165c2084..6d2010ae8f7a6078e10b361c6962983bab233e0f:/bsd/crypto/aes/Assert.c?ds=inline diff --git a/bsd/crypto/aes/Assert.c b/bsd/crypto/aes/Assert.c new file mode 100644 index 000000000..5ba9c4472 --- /dev/null +++ b/bsd/crypto/aes/Assert.c @@ -0,0 +1,34 @@ +/* This module exists solely to check compile-time assertions. It should be + compiled when building the project, and building should be terminated if + errors are encountered. However, any object it produces need not be + included in the build. +*/ + + +#include + +#include "crypto/aes.h" +#include "Context.h" + +/* Declare CheckAssertion so that if any of the declarations below differ + from it, the compiler will report an error. +*/ +extern char CheckAssertion[1]; + +/* Ensure that ContextKey is the offset of the ks member of the AES context + structures. +*/ +extern char CheckAssertion[ContextKey == offsetof(aes_encrypt_ctx, ks)]; +extern char CheckAssertion[ContextKey == offsetof(aes_decrypt_ctx, ks)]; + /* If these assertions fail, change the definition of ContextKey in + Context.h to match the offset of the ks field. + */ + +/* Ensure that ContextKeyLength is the offset of the inf member of the AES + context structures. +*/ +extern char CheckAssertion[ContextKeyLength == offsetof(aes_encrypt_ctx, inf)]; +extern char CheckAssertion[ContextKeyLength == offsetof(aes_decrypt_ctx, inf)]; + /* If these assertions fail, change the definition of ContextKeyLength in + Context.h to match the offset of the inf field. + */