xref: /freebsd/sys/dev/qat/qat_api/common/crypto/sym/lac_sym_compile_check.c (revision 78ee8d1c4cdad7a56dbf50f1c8ade75531ce620c)
1 /***************************************************************************
2  *
3  * <COPYRIGHT_TAG>
4  *
5  ***************************************************************************/
6 
7 /**
8  ***************************************************************************
9  * @file lac_sym_compile_check.c
10  *
11  * @ingroup LacSym
12  *
13  * This file checks at compile time that some assumptions about the layout
14  * of key structures are as expected.
15  *
16  *
17  ***************************************************************************/
18 
19 #include "cpa.h"
20 
21 #include "lac_common.h"
22 #include "icp_accel_devices.h"
23 #include "icp_adf_debug.h"
24 #include "lac_sym.h"
25 #include "cpa_cy_sym_dp.h"
26 
27 #define COMPILE_TIME_ASSERT(pred)                                              \
28 	switch (0) {                                                           \
29 	case 0:                                                                \
30 	case pred:;                                                            \
31 	}
32 
33 void
LacSym_CompileTimeAssertions(void)34 LacSym_CompileTimeAssertions(void)
35 {
36 	/* *************************************************************
37 	 * Check sessionCtx is at the same location in bulk cookie and
38 	 * CpaCySymDpOpData.
39 	 * This is required for the callbacks to work as expected -
40 	 * see LacSymCb_ProcessCallback
41 	 * ************************************************************* */
42 
43 	COMPILE_TIME_ASSERT(offsetof(lac_sym_bulk_cookie_t, sessionCtx) ==
44 			    offsetof(CpaCySymDpOpData, sessionCtx));
45 }
46