1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2; Copyright(c) 2011-2016 Intel Corporation All rights reserved. 3; 4; Redistribution and use in source and binary forms, with or without 5; modification, are permitted provided that the following conditions 6; are met: 7; * Redistributions of source code must retain the above copyright 8; notice, this list of conditions and the following disclaimer. 9; * Redistributions in binary form must reproduce the above copyright 10; notice, this list of conditions and the following disclaimer in 11; the documentation and/or other materials provided with the 12; distribution. 13; * Neither the name of Intel Corporation nor the names of its 14; contributors may be used to endorse or promote products derived 15; from this software without specific prior written permission. 16; 17; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 29 30; Macros for defining data structures 31 32; Usage example 33 34;START_FIELDS ; JOB_AES 35;;; name size align 36;FIELD _plaintext, 8, 8 ; pointer to plaintext 37;FIELD _ciphertext, 8, 8 ; pointer to ciphertext 38;FIELD _IV, 16, 8 ; IV 39;FIELD _keys, 8, 8 ; pointer to keys 40;FIELD _len, 4, 4 ; length in bytes 41;FIELD _status, 4, 4 ; status enumeration 42;FIELD _user_data, 8, 8 ; pointer to user data 43;UNION _union, size1, align1, \ 44 size2, align2, \ 45 size3, align3, \ 46 ... 47;END_FIELDS 48;%assign _JOB_AES_size _FIELD_OFFSET 49;%assign _JOB_AES_align _STRUCT_ALIGN 50 51%ifndef _DATASTRUCT_ASM_ 52%define _DATASTRUCT_ASM_ 53 54;; START_FIELDS 55%macro START_FIELDS 0 56%assign _FIELD_OFFSET 0 57%assign _STRUCT_ALIGN 0 58%endm 59 60;; FIELD name size align 61%macro FIELD 3 62%define %%name %1 63%define %%size %2 64%define %%align %3 65 66%assign _FIELD_OFFSET (_FIELD_OFFSET + (%%align) - 1) & (~ ((%%align)-1)) 67%%name equ _FIELD_OFFSET 68%assign _FIELD_OFFSET _FIELD_OFFSET + (%%size) 69%if (%%align > _STRUCT_ALIGN) 70%assign _STRUCT_ALIGN %%align 71%endif 72%endm 73 74;; END_FIELDS 75%macro END_FIELDS 0 76%assign _FIELD_OFFSET (_FIELD_OFFSET + _STRUCT_ALIGN-1) & (~ (_STRUCT_ALIGN-1)) 77%endm 78 79%endif ; end ifdef _DATASTRUCT_ASM_ 80