Thread (16 messages) 16 messages, 4 authors, 2022-11-28

Re: [PATCH v7 3/3] x86: vdso: Wire up getrandom() vDSO implementation

From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: 2022-11-28 00:19:53
Also in: linux-crypto, linux-patches, lkml

On Sun, Nov 27, 2022 at 10:39:27PM +0000, Samuel Neves wrote:
On Sun, Nov 27, 2022 at 10:13 PM Jason A. Donenfeld [off-list ref] wrote:
quoted
Hi Thomas,

On Sat, Nov 26, 2022 at 12:08:41AM +0100, Thomas Gleixner wrote:
quoted
Jason!

On Thu, Nov 24 2022 at 17:55, Jason A. Donenfeld wrote:
quoted
+++ b/arch/x86/entry/vdso/vgetrandom-chacha.S
+/*
+ * Very basic SSE2 implementation of ChaCha20. Produces a given positive number
+ * of blocks of output with a nonce of 0, taking an input key and 8-byte
+ * counter. Importantly does not spill to the stack. Its arguments are:
Basic or not.
Heh, FYI I didn't mean "basic" here as in "doesn't need a review", but
just that it's a straightforward technique and doesn't do any
complicated multiblock pyrotechnics (which frankly aren't really
needed).
quoted
This needs a Reviewed-by from someone who understands SSE2
and ChaCha20 before this can go anywhere near the x86 tree.
No problem. I'll see to it that somebody qualified gives this a review.
I did look at this earlier. It looks fine. I would recommend changing

+ /* copy1,copy2 = key */
+ movdqu 0x00(key),copy1
+ movdqu 0x10(key),copy2

to

+ /* copy1,copy2 = key */
+ movups 0x00(key),copy1
+ movups 0x10(key),copy2

which has the same semantics, but saves a couple of code bytes. Likewise for

+ movdqu state0,0x00(output)
+ movdqu state1,0x10(output)
+ movdqu state2,0x20(output)
+ movdqu state3,0x30(output)

Otherwise,

Reviewed-by: Samuel Neves <redacted> # for vgetrandom-chacha.S
Thanks for the review and for the suggestion. Will do.

Jason
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help