(history: string[])
| 137 | } |
| 138 | |
| 139 | function replay_rtmr(history: string[]): string { |
| 140 | const INIT_MR = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" |
| 141 | if (history.length === 0) { |
| 142 | return INIT_MR |
| 143 | } |
| 144 | let mr = Buffer.from(INIT_MR, 'hex') |
| 145 | for (const content of history) { |
| 146 | // Convert hex string to buffer |
| 147 | let contentBuffer = Buffer.from(content, 'hex') |
| 148 | // Pad content with zeros if shorter than 48 bytes |
| 149 | if (contentBuffer.length < 48) { |
| 150 | const padding = Buffer.alloc(48 - contentBuffer.length, 0) |
| 151 | contentBuffer = Buffer.concat([contentBuffer, padding]) |
| 152 | } |
| 153 | mr = Buffer.from(crypto.createHash('sha384') |
| 154 | .update(Buffer.concat([mr, contentBuffer])) |
| 155 | .digest()) |
| 156 | } |
| 157 | return mr.toString('hex') |
| 158 | } |
| 159 | |
| 160 | function reply_rtmrs(event_log: EventLog[]): Record<number, string> { |
| 161 | const rtmrs: Array<string> = [] |
no test coverage detected