#!/bin/bash# set -xif[[-z"$ECDSA_SUBSCRIPTION_KEY"]]&&([[-z"$SPID"]]||[[-z"$EPID_SUBSCRIPTION_KEY"]]);thenecho"//Either SPID and EPID_SUBSCRIPTION_KEY or ECDSA_SUBSCRIPTION_KEY is required!"fiif([[!-z"$SPID"]]&&[[-z"$EPID_SUBSCRIPTION_KEY"]])||\([[-z"$SPID"]]&&[[!-z"$EPID_SUBSCRIPTION_KEY"]]);thenecho"//For EPID, Both SPID and EPID_SUBSCRIPTION_KEY must be set!"fiif([["$QUOTE_TYPE"!="SGX_LINKABLE_SIGNATURE"]])&&\([["$QUOTE_TYPE"!="SGX_UNLINKABLE_SIGNATURE"]]);thenecho"//QUOTE_TYPE must be one of SGX_UNLINKABLE_SIGNATURE or SGX_LINKABLE_SIGNATURE"fiSPID_BYTE_ARRAY=$(echo$SPID | python -c'import sys ; s = sys.stdin.readline().strip(); print("".join(["0x"+s[2*i:2*i+2]+"," for i in range(len(s)/2)]))')cat<<HEREDOC#include "ra-attester.h"struct ra_tls_options my_ra_tls_options = { // SPID format is 32 hex-character string, e.g., 0123456789abcdef0123456789abcdef .spid = {{$SPID_BYTE_ARRAY}}, .quote_type = SGX_UNLINKABLE_SIGNATURE, .ias_server = "api.trustedservices.intel.com/sgx/dev", // EPID_SUBSCRIPTION_KEY format is "012345679abcdef012345679abcdef" .subscription_key = "$EPID_SUBSCRIPTION_KEY"};struct ecdsa_ra_tls_options my_ecdsa_ra_tls_options = { // ECDSA_SUBSCRIPTION_KEY format is "012345679abcdef012345679abcdef" .subscription_key = "$ECDSA_SUBSCRIPTION_KEY"};HEREDOC