mirror of
https://github.com/openssl/openssl.git
synced 2026-01-18 17:11:31 +01:00
Recently, the addition of some vector register save restore logic from: https://github.com/openssl/openssl/pull/28990 Triggered an issue in our quic_multistream_test, notably causing a connection shutdown with error code 1, rather than successful completion. The problem has been root caused to an error in how the ppc aes code saves and restores vector registers. The aes gcm code uses VSR instructions (vsldoi, etc), to maniuplate vector registers, which only operate on the upper half of the vector register file (VS32-63), and operands are implicitly offset to do this. (i.e. <instr> v31 actually operates on register vs63). However, the SAVE/RESTORE macros which save and restore those values use stxv/lxv instructions to do the save and restore, which are VSX instructions that have access to the full vector register file, and so by restoring V1, rather than V33, etc, we actuall restore values to the wrong registers, causing various issues (most notably the above misconfiguration of the quic SSL shutdown event, which sets the error code erroneously to 1 instead of the expected 0 value). Fix it by offsetting the SAVE_REGS and RESTORE_REGS macros to reference the proper registers when doing save and restore. Fixes #29516 Reviewed-by: Saša Nedvědický <sashan@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/29528)