dword sid_read_32(dword addr) { dword value; dword prctl; dword status; prctl = read_volatile_4(SID_PRCTL_REG); write_volatile_4(SID_PRCTL_REG,prctl & 0xfe00fffc | addr << 0x10); write_volatile_4(SID_PRCTL_REG,prctl & 0xfe0000fc | addr << 0x10 | 0xac02); do { status = read_volatile_4(SID_PRCTL_REG); } while ((status & 2) != 0); write_volatile_4(SID_PRCTL_REG,prctl & 0xfe0000fc | addr_bits & 0xfe0000fc); value = read_volatile_4(SID_RDKEY_REG); return value; } int sid_read_rotpk_hash(dword *dest,dword n) { dword dVar1; uint i_bytes; int i_words; i_words = 0; memset(dest,0,n); for (i_bytes = 0; i_bytes < n; i_bytes = i_bytes + 4) { dVar1 = sid_read_32(i_bytes + 100); dest[i_words] = dVar1; i_words = i_words + 1; } return 0; } int cert_get_pubkey_hash(struct certificate_item *cert,byte *digest,uint digest_len) { int ret; dword n_len; uint total_len; byte buf[800]; n_len = (cert->data).subj_pub_n_len; if ((digest_len < 0x20) || (digest == (byte *)0x0)) { ret = -1; } else { memcpy(buf,(cert->data).subj_pub_n,(cert->data).subj_pub_n_len); memcpy(buf + n_len,(cert->data).subj_pub_e,(cert->data).subj_pub_e_len); total_len = (cert->data).subj_pub_e_len + n_len; if (n_len * 2 < total_len) { ret = -1; } else { memset(buf + total_len,0x91,n_len * 2 - total_len); sha256(1,buf,n_len << 1,digest,digest_len); ret = 0; } } return ret; } SBROM calls each function with a 32-byte buffer and then memcmp()s the two buffers.