 +            doc = ("Indicates whether the enclave has access to the " +
 +                   "Provisioning Key and the Provisioning Seal Key"),
 +        ),
++        "kss": attr.bool(
++            default = False,
++            doc = ("Indicates whether the enclave can use Key Sharing and " +
++                   "Separation (KSS)"),
++        ),
++        "isvextprodid": attr.string(
++            default = "",
++            doc = ("The enclave's 16-byte extended ISVPRODID value. It is an " +
++                   "error to set this attribute if 'kss' is set to False"),
++        ),
++        "isvfamilyid": attr.string(
++            default = "",
++            doc = ("The enclave's 16-byte extended ISV Family ID. It is an " +
++                   "error to set this attribute if 'kss' is set to False"),
++        ),
 +        "stack_max_size": attr.string(
 +            default = "0x40000",
 +            doc = "The enclave's maximum stack size in bytes (4KB aligned)",

+        **kwargs
+    )
+
+def _sgx_enclave_configuration(ctx):
+    """Implementation of enclave signing configuration file formatting."""
+    xml_file = ctx.actions.declare_file(ctx.label.name + ".xml")
+    ctx.actions.write(
+        output = xml_file,
+        content = "\n".join([
+            "<EnclaveConfiguration>",
+            "  <ProdID>%s</ProdID>" % ctx.attr.prodid,
+            "  <ISVSVN>%s</ISVSVN>" % ctx.attr.isvsvn,
+            "  <StackMaxSize>%s</StackMaxSize>" % ctx.attr.stack_max_size,
+            "  <HeapMaxSize>%s</HeapMaxSize>" % ctx.attr.heap_max_size,
+            "  <TCSNum>%s</TCSNum>" % ctx.attr.tcs_num,
+            "  <TCSPolicy>%s</TCSPolicy>" % ctx.attr.tcs_policy,
+            "  <DisableDebug>%s</DisableDebug>" % ctx.attr.disable_debug,
+            "  <ProvisionKey>%s</ProvisionKey>" % ctx.attr.provision_key,
+            "  <MiscSelect>%s</MiscSelect>" % ctx.attr.misc_select,
+            "  <MiscMask>%s</MiscMask>" % ctx.attr.misc_mask,
+            "</EnclaveConfiguration>\n\n",
+        ]),
+    )
+    return [DefaultInfo(files = depset([xml_file])), SGXEnclaveConfigInfo()]
+

+)
--- /dev/null
+++ sgx_sdk.bzl
@@ -0,0 +1,317 @@
+"""Build tools for supporting Intel's SDK."""
+
+load("@com_google_asylo_backend_provider//:enclave_info.bzl", "EnclaveInfo")
