<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/crypto/salsa20_generic.c, branch linux-4.17.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.17.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.17.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2018-01-12T12:03:42Z</updated>
<entry>
<title>crypto: salsa20 - export generic helpers</title>
<updated>2018-01-12T12:03:42Z</updated>
<author>
<name>Eric Biggers</name>
</author>
<published>2018-01-05T19:09:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eb772f37ae8163a89e28a435f6a18742ae06653b'/>
<id>urn:sha1:eb772f37ae8163a89e28a435f6a18742ae06653b</id>
<content type='text'>
Export the Salsa20 constants, transform context, and initialization
functions so that they can be reused by the x86 implementation.

Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: salsa20-generic - cleanup and convert to skcipher API</title>
<updated>2018-01-12T12:03:41Z</updated>
<author>
<name>Eric Biggers</name>
</author>
<published>2018-01-05T19:09:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b62b3db76f73c5a8cc132f78e7174bf57d582182'/>
<id>urn:sha1:b62b3db76f73c5a8cc132f78e7174bf57d582182</id>
<content type='text'>
Convert salsa20-generic from the deprecated "blkcipher" API to the
"skcipher" API, in the process fixing it up to be thread-safe (as the
crypto API expects) by maintaining each request's state separately from
the transform context.

Also remove the unnecessary cra_alignmask and tighten validation of the
key size by accepting only 16 or 32 bytes, not anything in between.

These changes bring the code close to the way chacha20-generic does
things, so hopefully it will be easier to maintain in the future.

However, the way Salsa20 interprets the IV is still slightly different;
that was not changed.

Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: salsa20 - fix blkcipher_walk API usage</title>
<updated>2017-11-29T05:25:58Z</updated>
<author>
<name>Eric Biggers</name>
</author>
<published>2017-11-29T04:56:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ecaaab5649781c5a0effdaf298a925063020500e'/>
<id>urn:sha1:ecaaab5649781c5a0effdaf298a925063020500e</id>
<content type='text'>
When asked to encrypt or decrypt 0 bytes, both the generic and x86
implementations of Salsa20 crash in blkcipher_walk_done(), either when
doing 'kfree(walk-&gt;buffer)' or 'free_page((unsigned long)walk-&gt;page)',
because walk-&gt;buffer and walk-&gt;page have not been initialized.

The bug is that Salsa20 is calling blkcipher_walk_done() even when
nothing is in 'walk.nbytes'.  But blkcipher_walk_done() is only meant to
be called when a nonzero number of bytes have been provided.

The broken code is part of an optimization that tries to make only one
call to salsa20_encrypt_bytes() to process inputs that are not evenly
divisible by 64 bytes.  To fix the bug, just remove this "optimization"
and use the blkcipher_walk API the same way all the other users do.

Reproducer:

    #include &lt;linux/if_alg.h&gt;
    #include &lt;sys/socket.h&gt;
    #include &lt;unistd.h&gt;

    int main()
    {
            int algfd, reqfd;
            struct sockaddr_alg addr = {
                    .salg_type = "skcipher",
                    .salg_name = "salsa20",
            };
            char key[16] = { 0 };

            algfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
            bind(algfd, (void *)&amp;addr, sizeof(addr));
            reqfd = accept(algfd, 0, 0);
            setsockopt(algfd, SOL_ALG, ALG_SET_KEY, key, sizeof(key));
            read(reqfd, key, sizeof(key));
    }

Reported-by: syzbot &lt;syzkaller@googlegroups.com&gt;
Fixes: eb6f13eb9f81 ("[CRYPTO] salsa20_generic: Fix multi-page processing")
Cc: &lt;stable@vger.kernel.org&gt; # v2.6.25+
Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: add missing crypto module aliases</title>
<updated>2015-01-13T11:29:11Z</updated>
<author>
<name>Mathias Krause</name>
</author>
<published>2015-01-11T17:17:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3e14dcf7cb80b34a1f38b55bc96f02d23fdaaaaf'/>
<id>urn:sha1:3e14dcf7cb80b34a1f38b55bc96f02d23fdaaaaf</id>
<content type='text'>
Commit 5d26a105b5a7 ("crypto: prefix module autoloading with "crypto-"")
changed the automatic module loading when requesting crypto algorithms
to prefix all module requests with "crypto-". This requires all crypto
modules to have a crypto specific module alias even if their file name
would otherwise match the requested crypto algorithm.

Even though commit 5d26a105b5a7 added those aliases for a vast amount of
modules, it was missing a few. Add the required MODULE_ALIAS_CRYPTO
annotations to those files to make them get loaded automatically, again.
This fixes, e.g., requesting 'ecb(blowfish-generic)', which used to work
with kernels v3.18 and below.

Also change MODULE_ALIAS() lines to MODULE_ALIAS_CRYPTO(). The former
won't work for crypto modules any more.

Fixes: 5d26a105b5a7 ("crypto: prefix module autoloading with "crypto-"")
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Mathias Krause &lt;minipli@googlemail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: prefix module autoloading with "crypto-"</title>
<updated>2014-11-24T14:43:57Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2014-11-21T01:05:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5d26a105b5a73e5635eae0629b42fa0a90e07b7b'/>
<id>urn:sha1:5d26a105b5a73e5635eae0629b42fa0a90e07b7b</id>
<content type='text'>
This prefixes all crypto module loading with "crypto-" so we never run
the risk of exposing module auto-loading to userspace via a crypto API,
as demonstrated by Mathias Krause:

https://lkml.org/lkml/2013/3/4/70

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: cleanup - remove unneeded crypto_alg.cra_list initializations</title>
<updated>2012-08-01T09:47:27Z</updated>
<author>
<name>Jussi Kivilinna</name>
</author>
<published>2012-07-11T11:20:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=77ec2e734d4820c51cbabe1257e9311df5868160'/>
<id>urn:sha1:77ec2e734d4820c51cbabe1257e9311df5868160</id>
<content type='text'>
Initialization of cra_list is currently mixed, most ciphers initialize this
field and most shashes do not. Initialization however is not needed at all
since cra_list is initialized/overwritten in __crypto_register_alg() with
list_add(). Therefore perform cleanup to remove all unneeded initializations
of this field in 'crypto/'.

Signed-off-by: Jussi Kivilinna &lt;jussi.kivilinna@mbnet.fi&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: salsa20 - Remove private wrappers around various operations</title>
<updated>2008-12-25T00:02:30Z</updated>
<author>
<name>Harvey Harrison</name>
</author>
<published>2008-12-17T05:53:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f0d1ec3a227e01a27ce20719bf7b58de86d44f0f'/>
<id>urn:sha1:f0d1ec3a227e01a27ce20719bf7b58de86d44f0f</id>
<content type='text'>
ROTATE -&gt; rol32
XOR was always used with the same destination, use ^=
PLUS/PLUSONE use ++ or +=

Signed-off-by: Harvey Harrison &lt;harvey.harrison@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>[CRYPTO] all: Clean up init()/fini()</title>
<updated>2008-04-21T02:19:34Z</updated>
<author>
<name>Kamalesh Babulal</name>
</author>
<published>2008-04-05T13:00:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3af5b90bde5000abc739996cb03fd718e753d053'/>
<id>urn:sha1:3af5b90bde5000abc739996cb03fd718e753d053</id>
<content type='text'>
On Thu, Mar 27, 2008 at 03:40:36PM +0100, Bodo Eggert wrote:
&gt; Kamalesh Babulal &lt;kamalesh@linux.vnet.ibm.com&gt; wrote:
&gt; 
&gt; &gt; This patch cleanups the crypto code, replaces the init() and fini()
&gt; &gt; with the &lt;algorithm name&gt;_init/_fini
&gt; 
&gt; This part ist OK.
&gt; 
&gt; &gt; or init/fini_&lt;algorithm name&gt; (if the 
&gt; &gt; &lt;algorithm name&gt;_init/_fini exist)
&gt; 
&gt; Having init_foo and foo_init won't be a good thing, will it? I'd start
&gt; confusing them.
&gt; 
&gt; What about foo_modinit instead?

Thanks for the suggestion, the init() is replaced with

	&lt;algorithm name&gt;_mod_init ()

and fini () is replaced with &lt;algorithm name&gt;_mod_fini.
 
Signed-off-by: Kamalesh Babulal &lt;kamalesh@linux.vnet.ibm.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>[CRYPTO] salsa20_generic: Fix multi-page processing</title>
<updated>2008-01-10T21:16:34Z</updated>
<author>
<name>Tan Swee Heng</name>
</author>
<published>2007-12-07T08:38:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eb6f13eb9f812f5812ed5d14f241309da369dee6'/>
<id>urn:sha1:eb6f13eb9f812f5812ed5d14f241309da369dee6</id>
<content type='text'>
This patch fixes the multi-page processing bug that affects large test
vectors (the same bug that previously affected ctr.c).

There is an optimization for the case walk.nbytes == nbytes. Also we
now use crypto_xor() instead of adhoc XOR routines.

Signed-off-by: Tan Swee Heng &lt;thesweeheng@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>[CRYPTO] salsa20: Salsa20 stream cipher</title>
<updated>2008-01-10T21:16:15Z</updated>
<author>
<name>Tan Swee Heng</name>
</author>
<published>2007-11-23T11:45:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2407d60872dd2a95404c6048f775f3b64d438f4b'/>
<id>urn:sha1:2407d60872dd2a95404c6048f775f3b64d438f4b</id>
<content type='text'>
This patch implements the Salsa20 stream cipher using the blkcipher interface.

The core cipher code comes from Daniel Bernstein's submission to eSTREAM:
  http://www.ecrypt.eu.org/stream/svn/viewcvs.cgi/ecrypt/trunk/submissions/salsa20/full/ref/

The test vectors comes from:
  http://www.ecrypt.eu.org/stream/svn/viewcvs.cgi/ecrypt/trunk/submissions/salsa20/full/

It has been tested successfully with "modprobe tcrypt mode=34" on an
UML instance.

Signed-off-by: Tan Swee Heng &lt;thesweeheng@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
</feed>
