 +            doc = ("The label of the unsigned enclave binary to be measured " +
 +                   "and hashed as a SIGSTRUCT field"),
 +        ),
-+        "sigstruct": attr.output(
++        "signing_material": attr.output(
 +            doc = "The name of the output file. Default is \"<name>.dat\".",
 +        ),
 +        "_sign_tool": attr.label(

+            "-config",
+            ctx.file.config.path,
+            "-out",
+            sigstruct.path,
+        ],
+    )
+    return [
+        DefaultInfo(files = depset([sigstruct])),
+        SGXSigstructInfo(
+            config = ctx.file.config,
+            unsigned = ctx.attr.unsigned,
+        ),
+    ]
+
+sgx_generate_sigstruct = rule(
+    implementation = _sgx_generate_sigstruct_impl,
+    attrs = {
+        "config": attr.label(
+            mandatory = True,

+            config,
+            ctx.file.public_key,
+            ctx.file.signature,
+            ctx.file.signing_material,
+            unsigned_file,
+        ],
+        tools = [ctx.executable._sign_tool],
