]> git.saurik.com Git - apple/xnu.git/blame - bsd/crypto/aes/Assert.c
xnu-1699.22.73.tar.gz
[apple/xnu.git] / bsd / crypto / aes / Assert.c
CommitLineData
6d2010ae
A
1/* This module exists solely to check compile-time assertions. It should be
2 compiled when building the project, and building should be terminated if
3 errors are encountered. However, any object it produces need not be
4 included in the build.
5*/
6
7
8#include <stddef.h>
9
10#include "crypto/aes.h"
11#include "Context.h"
12
13/* Declare CheckAssertion so that if any of the declarations below differ
14 from it, the compiler will report an error.
15*/
16extern char CheckAssertion[1];
17
18/* Ensure that ContextKey is the offset of the ks member of the AES context
19 structures.
20*/
21extern char CheckAssertion[ContextKey == offsetof(aes_encrypt_ctx, ks)];
22extern char CheckAssertion[ContextKey == offsetof(aes_decrypt_ctx, ks)];
23 /* If these assertions fail, change the definition of ContextKey in
24 Context.h to match the offset of the ks field.
25 */
26
27/* Ensure that ContextKeyLength is the offset of the inf member of the AES
28 context structures.
29*/
30extern char CheckAssertion[ContextKeyLength == offsetof(aes_encrypt_ctx, inf)];
31extern char CheckAssertion[ContextKeyLength == offsetof(aes_decrypt_ctx, inf)];
32 /* If these assertions fail, change the definition of ContextKeyLength in
33 Context.h to match the offset of the inf field.
34 */