In the implementation of PRNO, when handling the "SHA-512-DRNG generate"
operation, the updated length is written back to the wrong register.
Also, while the instruction fills the output buffer from right-to-left,
the memory tracking is done as if it were the other way around. Fix both
of these issues.
cc = do_PRNO_insn(func, parms, &addr1, &len1, &addr2, &len2);
POST_MEM_WRITE(tst, parms, parms_len);
if (mflag == 0) {
- WRITE_GPR(tst, r2 + 1, len1);
- POST_MEM_WRITE(tst, orig_addr1, orig_len1 - len1);
+ WRITE_GPR(tst, r1 + 1, len1);
+ // The operand is filled from right to left
+ POST_MEM_WRITE(tst, orig_addr1 + len1, orig_len1 - len1);
}
break;
case 114: // TRNG