background image

41-98 Vol. 3D

SGX INSTRUCTION REFERENCES

(* Derive the report key *)
TMP_KEYDEPENDENCIES.KEYNAME  REPORT_KEY;
TMP_KEYDEPENDENCIES.ISVPRODID  0;
TMP_KEYDEPENDENCIES.ISVSVN  0;
TMP_KEYDEPENDENCIES.OWNEREPOCH  CSR_SGX_OWNEREPOCH;
TMP_KEYDEPENDENCIES.ATTRIBUTES  DS:RBX.ATTRIBUTES;
TMP_KEYDEPENDENCIES.ATTRIBUTESMASK  0;
TMP_KEYDEPENDENCIES.MRENCLAVE  DS:RBX.MEASUREMENT;
TMP_KEYDEPENDENCIES.MRSIGNER  0;
TMP_KEYDEPENDENCIES.KEYID  TMP_REPORT.KEYID;
TMP_KEYDEPENDENCIES.SEAL_KEY_FUSES  CR_SEAL_FUSES;
TMP_KEYDEPENDENCIES.CPUSVN  CR_CPUSVN;
TMP_KEYDEPENDENCIES.PADDING  TMP_CURRENTSECS.PADDING;
TMP_KEYDEPENDENCIES.MISCSELECT  DS:RBX.MISCSELECT;
TMP_KEYDEPENDENCIES.MISCMASK  0;

(* Calculate the derived key*)
TMP_REPORTKEY  derive_key(TMP_KEYDEPENDENCIES);

(* call cryptographic CMAC function, CMAC data are not including MAC&KEYID *)
TMP_REPORT.MAC  cmac(TMP_REPORTKEY, TMP_REPORT[3071:0] );
DS:RDX[3455: 0]  TMP_REPORT;

Flags Affected

None

Protected Mode Exceptions

#GP(0)

If the address in RCS is outside the DS segment limit.
If a memory operand is not properly aligned.
If a memory operand is not in the current enclave.

#PF(error code)

If a page fault occurs in accessing memory operands.

64-Bit Mode Exceptions

#GP(0)

If RCX is non-canonical form.
If a memory operand is not properly aligned.
If a memory operand is not in the current enclave.

#PF(error code)

If a page fault occurs in accessing memory operands.