-
-
Notifications
You must be signed in to change notification settings - Fork 326
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
Comments
Please switch to mORMot 2, which already includes the fix. |
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. |
You are welcome to make a pull request here, of course! |
@zunzster May I ask what the fix is? Is it possible to make a pull request or just show us the fixed code? We also use mORMot V1 for few selected pieces, it will be a great help for us if the legacy V1 has fixes for bugs. |
The fix exists in mormot 2. |
@synopse Is it possible to port it back to v1? synopse/mORMot2@4708b03 |
I've forked Mormot and pushed up my SynCrypto.pas changes for inspection. I've adapted my changes to be even closer to the Mormot2 changes but I'm 16-byte aligning the stack so I can use movaps for a slight speed boost. I still have the original changes I made before seeing the v2 changes - that's the {$IFNDEF LINUX} section where I was following the Intel SHA1 convention from the example further down that file. |
Thanks a lot for sharing! I am not sure there is any benefit with using the MORMOT2 version of the code, for these procedures. |
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).
The text was updated successfully, but these errors were encountered: