Skip to content

Add vpaes_ctr32_encrypt_blocks for x86_64 - #11666

Closed
bernd-edlinger wants to merge 2 commits into
openssl:OpenSSL_1_1_1-stablefrom
bernd-edlinger:add_vpaes_ctr32_crypt_blocks_1
Closed

bernd-edlinger wants to merge 2 commits into
openssl:OpenSSL_1_1_1-stablefrom
bernd-edlinger:add_vpaes_ctr32_crypt_blocks_1

Conversation

@bernd-edlinger

Copy link
Copy Markdown
Member

This adds an analog to the (currently unused) "2x" optimization from
vpaes-armv8.pl and a ctr128_f implementation.

Checklist
  • documentation is added or updated
  • tests are added or updated

@bernd-edlinger bernd-edlinger added the branch: 1.1.1 Applies to OpenSSL_1_1_1-stable branch (EOL) label Apr 28, 2020
@bernd-edlinger
bernd-edlinger force-pushed the add_vpaes_ctr32_crypt_blocks_1 branch from 035d462 to 3872a0f Compare April 29, 2020 09:28
@bernd-edlinger bernd-edlinger changed the title [WIP] Add vpaes_ctr32_encrypt_blocks for x86_64 Add vpaes_ctr32_encrypt_blocks for x86_64 Apr 29, 2020
@bernd-edlinger
bernd-edlinger requested a review from davidben May 9, 2020 11:54

@davidben davidben left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The integration seems reasonable, though I'm not up-to-date with how landing on master vs. 1.1.1 works. One comment, however: this PR is currently a no-op. BSAES_CAPABLE and VPAES_CAPABLE are identical on x86_64, so everything that would have used vpaes_ctr32_encrypt_blocks would just use bsaes_ctr32_encrypt_blocks instead.

Comment thread crypto/evp/e_aes.c Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but grepping for __x86_64 in the source tree, I see a lot of variations of this ifdef. Perhaps there's something to be said for having some common architecture ifdefs in some common file?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't even know which compiler made this mess necessary.
I could find out for GCC, but there are lots of other compilers
where I cannot look at the source code. I do not understand
if that was just s stupid idea from the beginning. or was there
a reason for this multiple defines? There is no comment
anywhere, giving the rationale, therefore I personally think
that was driven by irrational fear about possible bugs in
unknown / ancient no longer supported compiler versions.

Comment thread crypto/evp/e_aes.c Resolved
@bernd-edlinger

Copy link
Copy Markdown
Member Author

@davidben FYI: This is a back-port of your contribution to #9677
The main body of that PR was already merged to 1.1.1 in 87bea65

So there is no BSAES any more for X86_64, therefore this PR should make
a difference. There is still BSAES for ARMv8 IIRC, therfore I did not remove
BSAES completely.
But I can try to add a "int3" to the assembler module, and see if I can
trigger that.

I do not understand why that was approved for 1.1.1 but the same PR for
master is stuck, and I will probably close it soon.

Frankly in the moment I feel like creating my own personal totallyBoringSSL branch.
What were your reasons for ceating BoringSSL?

@bernd-edlinger

Copy link
Copy Markdown
Member Author

I just confirmed,

diff --git a/crypto/aes/asm/vpaes-x86_64.pl b/crypto/aes/asm/vpaes-x86_64.pl
index c15618d..6e66642 100644
--- a/crypto/aes/asm/vpaes-x86_64.pl
+++ b/crypto/aes/asm/vpaes-x86_64.pl
@@ -92,6 +92,7 @@ $code.=<<___;
 .align 16
 _vpaes_encrypt_core:
 .cfi_startproc
+int3
        mov     %rdx,   %r9
        mov     \$16,   %r11
        mov     240(%rdx),%eax

OPENSSL_ia32cap=2199023255552 make test
gives many test errors. without the int3 the above test is good.

@davidben

Copy link
Copy Markdown
Contributor

So there is no BSAES any more for X86_64, therefore this PR should make a difference. There is still BSAES for ARMv8 IIRC, therfore I did not remove BSAES completely.
But I can try to add a "int3" to the assembler module, and see if I can trigger that.

Ah, sorry, I'd missed that! Ignore what I said about this being a no-op then. Is the x86 BSAES_CAPABLE definition still needed then?

(Regarding BoringSSL, I didn't start the project, but the README has some comment about how it came about. I got involved because I work on Chrome and was distractable. :-) )

@bernd-edlinger

Copy link
Copy Markdown
Member Author

No reason to feel sorry about that. I am happy you looked at this PR.
So it is probably my fault to not start the conversation with
"Thank you very much for your review" :-)

@bernd-edlinger

Copy link
Copy Markdown
Member Author

Is the x86 BSAES_CAPABLE definition still needed then?

good point I will check that.

@bernd-edlinger

Copy link
Copy Markdown
Member Author

regarding "Chrome"

isn't that a toxic element?
By the way does it alse have the "omni.ja" file, I found recently in my firefox/thunderbird
installation, where hidden extensions are installed that are next to impossible to uninstall?

davidben and others added 2 commits May 16, 2020 14:35
This adds an analog to the (currently unused) "2x" optimization from
vpaes-armv8.pl and a ctr128_f implementation.
@bernd-edlinger
bernd-edlinger force-pushed the add_vpaes_ctr32_crypt_blocks_1 branch from 8984dda to 5a5086d Compare May 16, 2020 12:37
@t8m t8m added the triaged: feature The issue/pr requests/adds a feature label Jul 23, 2021
@t8m t8m added this to the Post 3.0.0 milestone Sep 24, 2021
@t8m t8m closed this Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

branch: 1.1.1 Applies to OpenSSL_1_1_1-stable branch (EOL) triaged: feature The issue/pr requests/adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants