Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X64 AESNI assembler routines corrupt XMM6-XMM15 which the Win64 calling convention expects to be preserved #454

Open
zunzster opened this issue Jun 27, 2024 · 3 comments

Comments

@zunzster
Copy link

zunzster commented Jun 27, 2024

This corruption can be observed when compiling with Optimization on and local Double variables are stored in XMM6 onwards.

Code blocks similar to the {$IFNDEF LINUX} blocks in sha256_sse4 from Intel are needed for the X64 assembler routines which use XMM6-XMM15.

aesni(en|de)crypt128 (xmm6-xmm11), aesni(en|de)crypt192 (xmm6-xmm13), aesni(de|en)crypt256 (xmm6-xmm15)
MakeDecrKeyAesNi (xmm6-xmm7), AesNiEncryptOFB_128 (xmm6-xmm11), AesNiEncryptOFB_256 (xmm6-xmm15).

@zunzster zunzster changed the title AES-NI assembler routines for X64 corrupt XMM6-XMM15 which are expected to be preserved X64 AESNI assembler routines corrupt XMM6-XMM15 in Win64 which are expected to be preserved Jun 27, 2024
@zunzster zunzster changed the title X64 AESNI assembler routines corrupt XMM6-XMM15 in Win64 which are expected to be preserved X64 AESNI assembler routines corrupt XMM6-XMM15 which the Win64 calling convention expected to be preserved Jun 27, 2024
@zunzster zunzster changed the title X64 AESNI assembler routines corrupt XMM6-XMM15 which the Win64 calling convention expected to be preserved X64 AESNI assembler routines corrupt XMM6-XMM15 which the Win64 calling convention expects to be preserved Jun 27, 2024
@synopse
Copy link
Owner

synopse commented Jun 27, 2024

Please switch to mORMot 2, which already includes the fix.

@zunzster
Copy link
Author

zunzster commented Jun 27, 2024

Thanks, Arnaud. I figured that was likely the case.

We're only using a selected few pieces of mORMot v1 so I'll look at what is involved in switching those to mORMot v2. I've coded up the required fixes in case anyone else wants them.

@synopse
Copy link
Owner

synopse commented Jul 2, 2024

You are welcome to make a pull request here, of course!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants