 +    },
 +)
 +
-+def _sign_sigstruct_impl(ctx):
++def sgx_generate_sigstruct(name, sigstruct = None, **kwargs):
++    """Creates a file that contains parts of the enclave SIGSTRUCT.
++
++    Args:
++        name: The rule name.
++        sigstruct: The name of the output file. Default is "<name>.dat".
++        **kwargs: The arguments passed to sgx_generate_enclave_signing_material.
++    """
++    sgx_generate_enclave_signing_material(
++        name = name,
++        deprecation = ("Please use sgx_generate_enclave_signing_material " +
++                       "because this macro may be removed or change meaning " +
++                       "in the future."),
++        signing_material = sigstruct,
++        **kwargs
++    )
++
++def _sign_signing_material_impl(ctx):
 +    signature = ctx.attr.signature or ctx.actions.declare_file(ctx.label.name + ".sig")
 +    ctx.actions.run_shell(
 +        outputs = [signature],
-+        inputs = [ctx.file.private_key, ctx.file.sigstruct],
++        inputs = [ctx.file.private_key, ctx.file.signing_material],
 +        tools = [ctx.executable._bssl],
-+        command = "{bssl} {args} < {sigstruct} > {signature}".format(
++        command = "{bssl} {args} < {signing_material} > {signature}".format(
 +            bssl = ctx.file._bssl.path,
 +            args = " ".join(["sign", "-digest", "sha256", "-key", ctx.file.private_key.path]),
-+            sigstruct = ctx.file.sigstruct.path,
++            signing_material = ctx.file.signing_material.path,
 +            signature = signature.path,
 +        ),
 +    )
 +    return [DefaultInfo(files = depset([signature]))]
 +
-+boringssl_sign_sigstruct = rule(
-+    implementation = _sign_sigstruct_impl,
-+    doc = ("Signs a sigstruct file with a given private key for use in " +
-+           "sgx_signed_enclave."),
++boringssl_sign_enclave_signing_material = rule(
++    implementation = _sign_signing_material_impl,
++    doc = ("Signs an enclave signing material file with a given private " +
++           "key for use in sgx_signed_enclave."),
 +    attrs = {
-+        "sigstruct": attr.label(
++        "signing_material": attr.label(
 +            mandatory = True,
 +            allow_single_file = True,
 +            providers = [SGXSigstructInfo],
-+            doc = "A target defined by sgx_generate_sigstruct.",
++            doc = "A target defined by sgx_generate_enclave_signing_material.",
 +        ),
 +        "private_key": attr.label(
 +            mandatory = True,
 +            allow_single_file = True,
 +            doc = ("The RSA-3072 private key with public exponent 3 in PEM " +
-+                   "format used to sign the input sigstruct."),
++                   "format used to sign the input enclave signing material."),
 +        ),
 +        "signature": attr.output(
 +            doc = "The output signature file name [default: <name>.sig].",

+            "-config",
+            config.path,
+            "-unsigned",
+            ctx.file.sigstruct.path,
+            "-out",
+            ctx.outputs.executable.path,
+        ],

+sgx = struct(
+    backend_labels = SGX_BACKEND_LABELS,
+    boringssl_sign_sigstruct = boringssl_sign_sigstruct,
+    boringssl_sign_enclave_signing_material = boringssl_sign_enclave_signing_material,
+    debug_enclave = sgx_debug_enclave,
+    enclave_configuration = sgx_enclave_configuration,
+    full_enclave_configuration = sgx_full_enclave_configuration,
+    generate_enclave_signing_material = sgx_generate_enclave_signing_material,
+    generate_sigstruct = sgx_generate_sigstruct,
+    signed_enclave = sgx_signed_enclave,
+    tags = sgx_tags,
