1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
/* Copyright (c) Jethro G. Beekman and Fortanix, Inc.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use super::*;

macro_rules! impl_default_clone_eq {
    ($t:ident) => {
        impl Default for $t {
            fn default() -> $t {
                unsafe { ::core::mem::zeroed() }
            }
        }
        impl Clone for $t {
            fn clone(&self) -> $t {
                unsafe { ::core::ptr::read(self) }
            }
        }
        impl PartialEq for $t {
            fn eq(&self, other: &$t) -> bool {
                unsafe {
                    let lhs: &[u8; Self::UNPADDED_SIZE] = ::core::mem::transmute(self);
                    let rhs: &[u8; Self::UNPADDED_SIZE] = ::core::mem::transmute(other);
                    lhs.get(..) == rhs.get(..)
                }
            }
        }
        // This cannot be derived because the derivation asserts that the members are Eq.
        impl Eq for $t {}
    }
}

impl ::core::fmt::Debug for Secs {
    fn fmt(&self, __arg_0: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match *self {
            Secs {
                size: ref __self_0_0,
                baseaddr: ref __self_0_1,
                ssaframesize: ref __self_0_2,
                miscselect: ref __self_0_3,
                attributes: ref __self_0_5,
                mrenclave: ref __self_0_6,
                mrsigner: ref __self_0_8,
                isvprodid: ref __self_0_10,
                isvsvn: ref __self_0_11,
                ..
            } => {
                let mut builder = __arg_0.debug_struct("Secs");
                let _ = builder.field("size", &&(*__self_0_0));
                let _ = builder.field("baseaddr", &&(*__self_0_1));
                let _ = builder.field("ssaframesize", &&(*__self_0_2));
                let _ = builder.field("miscselect", &&(*__self_0_3));
                let _ = builder.field("attributes", &&(*__self_0_5));
                let _ = builder.field("mrenclave", &&(*__self_0_6));
                let _ = builder.field("mrsigner", &&(*__self_0_8));
                let _ = builder.field("isvprodid", &&(*__self_0_10));
                let _ = builder.field("isvsvn", &&(*__self_0_11));
                builder.finish()
            }
        }
    }
}

impl ::core::fmt::Debug for Tcs {
    fn fmt(&self, __arg_0: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match *self {
            Tcs {
                flags: ref __self_0_1,
                ossa: ref __self_0_2,
                cssa: ref __self_0_3,
                nssa: ref __self_0_4,
                oentry: ref __self_0_5,
                ofsbasgx: ref __self_0_7,
                ogsbasgx: ref __self_0_8,
                fslimit: ref __self_0_9,
                gslimit: ref __self_0_10,
                ..
            } => {
                let mut builder = __arg_0.debug_struct("Tcs");
                let _ = builder.field("flags", &&(*__self_0_1));
                let _ = builder.field("ossa", &&(*__self_0_2));
                let _ = builder.field("cssa", &&(*__self_0_3));
                let _ = builder.field("nssa", &&(*__self_0_4));
                let _ = builder.field("oentry", &&(*__self_0_5));
                let _ = builder.field("ofsbasgx", &&(*__self_0_7));
                let _ = builder.field("ogsbasgx", &&(*__self_0_8));
                let _ = builder.field("fslimit", &&(*__self_0_9));
                let _ = builder.field("gslimit", &&(*__self_0_10));
                builder.finish()
            }
        }
    }
}

impl ::core::fmt::Debug for Secinfo {
    fn fmt(&self, __arg_0: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match *self {
            Secinfo {
                flags: ref __self_0_0,
                ..
            } => {
                let mut builder = __arg_0.debug_struct("Secinfo");
                let _ = builder.field("flags", &&(*__self_0_0));
                builder.finish()
            }
        }
    }
}

impl ::core::fmt::Debug for Pcmd {
    fn fmt(&self, __arg_0: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match *self {
            Pcmd {
                secinfo: ref __self_0_0,
                enclaveid: ref __self_0_1,
                mac: ref __self_0_3,
                ..
            } => {
                let mut builder = __arg_0.debug_struct("Pcmd");
                let _ = builder.field("secinfo", &&(*__self_0_0));
                let _ = builder.field("enclaveid", &&(*__self_0_1));
                let _ = builder.field("mac", &&(*__self_0_3));
                builder.finish()
            }
        }
    }
}

impl ::core::fmt::Debug for Sigstruct {
    fn fmt(&self, __arg_0: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match *self {
            Sigstruct {
                header: ref __self_0_0,
                vendor: ref __self_0_1,
                date: ref __self_0_2,
                header2: ref __self_0_3,
                swdefined: ref __self_0_4,
                modulus: ref __self_0_6,
                exponent: ref __self_0_7,
                signature: ref __self_0_8,
                miscselect: ref __self_0_9,
                miscmask: ref __self_0_10,
                attributes: ref __self_0_12,
                attributemask: ref __self_0_13,
                enclavehash: ref __self_0_14,
                isvprodid: ref __self_0_16,
                isvsvn: ref __self_0_17,
                q1: ref __self_0_19,
                q2: ref __self_0_20,
                ..
            } => {
                let mut builder = __arg_0.debug_struct("Sigstruct");
                let _ = builder.field("header", &&(*__self_0_0));
                let _ = builder.field("vendor", &&(*__self_0_1));
                let _ = builder.field("date", &&(*__self_0_2));
                let _ = builder.field("header2", &&(*__self_0_3));
                let _ = builder.field("swdefined", &&(*__self_0_4));
                let _ = builder.field("modulus", &"(384 bytes)");
                let _ = builder.field("exponent", &&(*__self_0_7));
                let _ = builder.field("signature", &"(384 bytes)");
                let _ = builder.field("miscselect", &&(*__self_0_9));
                let _ = builder.field("miscmask", &&(*__self_0_10));
                let _ = builder.field("attributes", &&(*__self_0_12));
                let _ = builder.field("attributemask", &&(*__self_0_13));
                let _ = builder.field("enclavehash", &&(*__self_0_14));
                let _ = builder.field("isvprodid", &&(*__self_0_16));
                let _ = builder.field("isvsvn", &&(*__self_0_17));
                let _ = builder.field("q1", &"(384 bytes)");
                let _ = builder.field("q2", &"(384 bytes)");
                builder.finish()
            }
        }
    }
}

impl ::core::fmt::Debug for Einittoken {
    fn fmt(&self, __arg_0: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match *self {
            Einittoken {
                valid: ref __self_0_0,
                attributes: ref __self_0_2,
                mrenclave: ref __self_0_3,
                mrsigner: ref __self_0_5,
                cpusvnle: ref __self_0_7,
                isvprodidle: ref __self_0_8,
                isvsvnle: ref __self_0_9,
                maskedmiscselectle: ref __self_0_11,
                maskedattributesle: ref __self_0_12,
                keyid: ref __self_0_13,
                mac: ref __self_0_14,
                ..
            } => {
                let mut builder = __arg_0.debug_struct("Einittoken");
                let _ = builder.field("valid", &&(*__self_0_0));
                let _ = builder.field("attributes", &&(*__self_0_2));
                let _ = builder.field("mrenclave", &&(*__self_0_3));
                let _ = builder.field("mrsigner", &&(*__self_0_5));
                let _ = builder.field("cpusvnle", &&(*__self_0_7));
                let _ = builder.field("isvprodidle", &&(*__self_0_8));
                let _ = builder.field("isvsvnle", &&(*__self_0_9));
                let _ = builder.field("maskedmiscselectle", &&(*__self_0_11));
                let _ = builder.field("maskedattributesle", &&(*__self_0_12));
                let _ = builder.field("keyid", &&(*__self_0_13));
                let _ = builder.field("mac", &&(*__self_0_14));
                builder.finish()
            }
        }
    }
}

impl ::core::fmt::Debug for Report {
    fn fmt(&self, __arg_0: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match *self {
            Report {
                cpusvn: ref __self_0_0,
                miscselect: ref __self_0_1,
                attributes: ref __self_0_3,
                mrenclave: ref __self_0_4,
                mrsigner: ref __self_0_6,
                isvprodid: ref __self_0_8,
                isvsvn: ref __self_0_9,
                reportdata: ref __self_0_11,
                keyid: ref __self_0_12,
                mac: ref __self_0_13,
                ..
            } => {
                let mut builder = __arg_0.debug_struct("Report");
                let _ = builder.field("cpusvn", &&(*__self_0_0));
                let _ = builder.field("miscselect", &&(*__self_0_1));
                let _ = builder.field("attributes", &&(*__self_0_3));
                let _ = builder.field("mrenclave", &&(*__self_0_4));
                let _ = builder.field("mrsigner", &&(*__self_0_6));
                let _ = builder.field("isvprodid", &&(*__self_0_8));
                let _ = builder.field("isvsvn", &&(*__self_0_9));
                let _ = builder.field("reportdata", &"(64 bytes)");
                let _ = builder.field("keyid", &"(32 bytes)");
                let _ = builder.field("mac", &&(*__self_0_13));
                builder.finish()
            }
        }
    }
}

impl ::core::fmt::Debug for Targetinfo {
    fn fmt(&self, __arg_0: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match *self {
            Targetinfo {
                measurement: ref __self_0_0,
                attributes: ref __self_0_1,
                miscselect: ref __self_0_3,
                ..
            } => {
                let mut builder = __arg_0.debug_struct("Targetinfo");
                let _ = builder.field("measurement", &&(*__self_0_0));
                let _ = builder.field("attributes", &&(*__self_0_1));
                let _ = builder.field("miscselect", &&(*__self_0_3));
                builder.finish()
            }
        }
    }
}

impl ::core::fmt::Debug for Keyrequest {
    fn fmt(&self, __arg_0: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match *self {
            Keyrequest {
                keyname: ref __self_0_0,
                keypolicy: ref __self_0_1,
                isvsvn: ref __self_0_2,
                cpusvn: ref __self_0_4,
                attributemask: ref __self_0_5,
                keyid: ref __self_0_6,
                miscmask: ref __self_0_7,
                ..
            } => {
                let mut builder = __arg_0.debug_struct("Keyrequest");
                let _ = builder.field("keyname", &&(*__self_0_0));
                let _ = builder.field("keypolicy", &&(*__self_0_1));
                let _ = builder.field("isvsvn", &&(*__self_0_2));
                let _ = builder.field("cpusvn", &&(*__self_0_4));
                let _ = builder.field("attributemask", &&(*__self_0_5));
                let _ = builder.field("keyid", &&(*__self_0_6));
                let _ = builder.field("miscmask", &&(*__self_0_7));
                builder.finish()
            }
        }
    }
}