Support unnamed tuple struct
diff --git a/sgx_types/Cargo.toml b/sgx_types/Cargo.toml
index e0f14c2..1c9812e 100644
--- a/sgx_types/Cargo.toml
+++ b/sgx_types/Cargo.toml
@@ -17,4 +17,4 @@
 debug = ["sgx_types_debug"]
 
 [dependencies]
-sgx_types_debug = { version = "0.1", optional = true }
+sgx_types_debug = { path = "../sgx_types_debug", version = "0.1", optional = true }
diff --git a/sgx_types/src/types.rs b/sgx_types/src/types.rs
index 9fdd419..fee73e2 100644
--- a/sgx_types/src/types.rs
+++ b/sgx_types/src/types.rs
@@ -232,7 +232,26 @@
 pub type sgx_key_128bit_t = [uint8_t; 16];
 pub type sgx_isv_svn_t = uint16_t;
 pub type sgx_config_svn_t = uint16_t;
-pub type sgx_config_id_t = [uint8_t; SGX_CONFIGID_SIZE];
+
+// This should be FFI compatible
+// https://rust-lang.github.io/unsafe-code-guidelines/layout/structs-and-tuples.html
+#[repr(transparent)]
+#[cfg_attr(feature = "debug", derive(SgxTypeDebug))]
+#[derive(Copy, Clone)]
+pub struct sgx_config_id_t(pub [uint8_t; SGX_CONFIGID_SIZE]);
+
+impl core::ops::Deref for sgx_config_id_t {
+    type Target = [uint8_t; SGX_CONFIGID_SIZE];
+    fn deref(&self) -> &Self::Target {
+        &self.0
+    }
+}
+
+impl core::ops::DerefMut for sgx_config_id_t {
+    fn deref_mut(&mut self) -> &mut Self::Target {
+        &mut self.0
+    }
+}
 
 impl_struct! {
     #[cfg_attr(feature = "debug", derive(SgxTypeDebug))]
@@ -519,7 +538,7 @@
         pub config_svn: sgx_config_svn_t,
         pub misc_select: sgx_misc_select_t,
         pub reserved2: [uint8_t; SGX_TARGET_INFO_RESERVED2_BYTES],
-        pub config_id: [uint8_t; SGX_CONFIGID_SIZE],
+        pub config_id: sgx_config_id_t,
         pub reserved3: [uint8_t; SGX_TARGET_INFO_RESERVED3_BYTES],
     }
 
@@ -534,7 +553,7 @@
         pub reserved2: [uint8_t; SGX_REPORT_BODY_RESERVED2_BYTES],
         pub mr_signer: sgx_measurement_t,
         pub reserved3: [uint8_t; SGX_REPORT_BODY_RESERVED3_BYTES],
-        pub config_id: [uint8_t; SGX_CONFIGID_SIZE],
+        pub config_id: sgx_config_id_t,
         pub isv_prod_id: sgx_prod_id_t,
         pub isv_svn: sgx_isv_svn_t,
         pub config_svn: sgx_config_svn_t,
@@ -1082,7 +1101,7 @@
     #[repr(packed)]
     #[cfg_attr(feature = "debug", derive(SgxTypeDebug))]
     pub struct sgx_kss_config_t {
-        pub config_id: [uint8_t; SGX_CONFIGID_SIZE],
+        pub config_id: sgx_config_id_t,
         pub config_svn: sgx_config_svn_t,
     }
 }
diff --git a/sgx_types_debug/src/lib.rs b/sgx_types_debug/src/lib.rs
index 57d69c1..4703411 100644
--- a/sgx_types_debug/src/lib.rs
+++ b/sgx_types_debug/src/lib.rs
@@ -1,6 +1,6 @@
-use quote::quote;
-use syn::{Data, Fields, DataStruct, DeriveInput, parse_macro_input};
 use proc_macro::TokenStream;
+use quote::quote;
+use syn::{parse_macro_input, Data, DataStruct, DeriveInput, Fields};
 
 #[proc_macro_derive(SgxTypeDebug)]
 pub fn derive_sgx_type_debug(item: TokenStream) -> TokenStream {
@@ -8,16 +8,15 @@
     let struct_name = &input.ident;
 
     let expanded = match input.data {
-        Data::Struct(DataStruct{ref fields,..}) => {
-            if let Fields::Named(ref fields_name) = fields {
+        Data::Struct(DataStruct { ref fields, .. }) => match fields {
+            Fields::Named(ref fields_name) => {
                 let get_selfs: Vec<_> = fields_name.named.iter().map(|field| {
-                    let field_name = field.ident.as_ref().unwrap();
-                    match &field.ty {
-                        syn::Type::Array(_) => quote! { add_debug_array_field(&mut s, stringify!(#field_name), &self.#field_name[..]); },
-                        _ =>
-                        quote! { add_debug_reg_field(&mut s, stringify!(#field_name), &self.#field_name); },
-                    }
-                }).collect();
+                        let field_name = field.ident.as_ref().unwrap();
+                        match &field.ty {
+                            syn::Type::Array(_) => quote! { add_debug_array_field(&mut s, stringify!(#field_name), &self.#field_name[..]); },
+                            _ => quote! { add_debug_reg_field(&mut s, stringify!(#field_name), &self.#field_name); },
+                        }
+                    }).collect();
 
                 let implemented_debug = quote! {
                     impl core::fmt::Debug for #struct_name {
@@ -29,12 +28,37 @@
                     }
                 };
                 implemented_debug
-            
-            } else {
-                panic!("SgxTypeDebug does not supports types other than Named Fields")
             }
-        }
-        _ => panic!("SgxTypeDebug only support Struct")
+            Fields::Unnamed(ref fields_unname) => {
+                let get_selfs: Vec<_> = fields_unname
+                    .unnamed
+                    .iter()
+                    .enumerate()
+                    .map(|(i, field)| match &field.ty {
+                        syn::Type::Array(_) => {
+                            let index = syn::Index::from(i);
+                            quote! { add_debug_array_field(&mut s, stringify!(#index), &self.#index[..]); }
+                        }
+                        _ => {
+                            let index = syn::Index::from(i);
+                            quote! { add_debug_reg_field(&mut s, stringify!(#index), &self.#index) }
+                        },
+                    })
+                    .collect();
+                let implemented_debug = quote! {
+                    impl core::fmt::Debug for #struct_name {
+                        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
+                            let mut s = f.debug_struct(stringify!(#struct_name));
+                            unsafe { #(#get_selfs)* }
+                            s.finish()
+                        }
+                    }
+                };
+                implemented_debug
+            }
+            Fields::Unit => panic!("SgxTypeDebug does not supports types other than Named Fields"),
+        },
+        _ => panic!("SgxTypeDebug only support Struct"),
     };
     expanded.into()
 }