Re: [PATCH] crypto: jitterentropy - avoid compiler warnings
On Tue, Jun 23, 2015 at 04:18:54PM +0200, Stephan Mueller wrote: > Hi Geert, Guenter, > > may I ask that you check that the following patch compiles without errors or > warnings on your systems? > > Though, when I test that patch with the AVR32 cross compiler, I get a warning > about the code being not relaxable. > > Thank you very much. > > ---8<--- > The core of the Jitter RNG is intended to be compiled with -O0. To > ensure that the Jitter RNG can be compiled on all architectures, > separate out the RNG core into a stand-alone C file that can be compiled > with -O0 which does not depend on any kernel include file. > > As no kernel includes can be used in the C file implementing the core > RNG, any dependencies on kernel code must be extracted. > > A second file provides the link to the kernel and the kernel crypto API > that can be compiled with the regular compile options of the kernel. > > Signed-off-by: Stephan Mueller Applied. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: jitterentropy - avoid compiler warnings
On 06/23/2015 10:55 AM, Stephan Mueller wrote: Am Dienstag, 23. Juni 2015, 10:41:03 schrieb Guenter Roeck: Hi Guenter, Geert, On Tue, Jun 23, 2015 at 04:18:54PM +0200, Stephan Mueller wrote: Hi Geert, Guenter, may I ask that you check that the following patch compiles without errors or warnings on your systems? No build failures for all architectures. Thank you very much for your help. Now, if Geert would be so kind and have a check on his OpenRISC to ensure that there are no compiler warnings, I would be happy. Though, does anybody have any idea what the AVR32 compiler warning about crypto/builtin.o not being relaxable mean and whether that is an issue? Note, when I was compiling AVR32, I saw some of these warnings for other builtin.o too. At least it compiles ;-). I don't think there is anything else we can do. Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: jitterentropy - avoid compiler warnings
Hi Stephan, On Tue, Jun 23, 2015 at 4:18 PM, Stephan Mueller wrote: > may I ask that you check that the following patch compiles without errors or > warnings on your systems? > > Though, when I test that patch with the AVR32 cross compiler, I get a warning > about the code being not relaxable. > > Thank you very much. > > ---8<--- > The core of the Jitter RNG is intended to be compiled with -O0. To > ensure that the Jitter RNG can be compiled on all architectures, > separate out the RNG core into a stand-alone C file that can be compiled > with -O0 which does not depend on any kernel include file. > > As no kernel includes can be used in the C file implementing the core > RNG, any dependencies on kernel code must be extracted. > > A second file provides the link to the kernel and the kernel crypto API > that can be compiled with the regular compile options of the kernel. > > Signed-off-by: Stephan Mueller Thanks, the warnings I saw before with m68k-linux-gnu-gcc-4.1.2 are gone. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: jitterentropy - avoid compiler warnings
Am Dienstag, 23. Juni 2015, 10:41:03 schrieb Guenter Roeck: Hi Guenter, Geert, >On Tue, Jun 23, 2015 at 04:18:54PM +0200, Stephan Mueller wrote: >> Hi Geert, Guenter, >> >> may I ask that you check that the following patch compiles without errors >> or warnings on your systems? >No build failures for all architectures. Thank you very much for your help. Now, if Geert would be so kind and have a check on his OpenRISC to ensure that there are no compiler warnings, I would be happy. Though, does anybody have any idea what the AVR32 compiler warning about crypto/builtin.o not being relaxable mean and whether that is an issue? Note, when I was compiling AVR32, I saw some of these warnings for other builtin.o too. Ciao Stephan -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: jitterentropy - avoid compiler warnings
On Tue, Jun 23, 2015 at 04:18:54PM +0200, Stephan Mueller wrote: > Hi Geert, Guenter, > > may I ask that you check that the following patch compiles without errors or > warnings on your systems? > No build failures for all architectures. Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: jitterentropy - avoid compiler warnings
Am Dienstag, 23. Juni 2015, 08:31:10 schrieb Guenter Roeck: Hi Guenter, >On Tue, Jun 23, 2015 at 04:18:54PM +0200, Stephan Mueller wrote: >> Hi Geert, Guenter, >> >> may I ask that you check that the following patch compiles without errors >> or warnings on your systems? >Stephan, > >I applied your patch on top of the current mainline (which includes >the crypto updates for 4.2) and pushed it into my 'testing' branch. >You should be able to see the results in a couple of hours at >http://server.roeck-us.net:8010/builders, in the 'testing' column. > >The build system doesn't log warnings, but this should give us an idea >if the build passes for all architectures. > >I'll have a look myself later and let you know as well. Thank you very much! Ciao Stephan -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: jitterentropy - avoid compiler warnings
On Tue, Jun 23, 2015 at 04:18:54PM +0200, Stephan Mueller wrote: > Hi Geert, Guenter, > > may I ask that you check that the following patch compiles without errors or > warnings on your systems? > Stephan, I applied your patch on top of the current mainline (which includes the crypto updates for 4.2) and pushed it into my 'testing' branch. You should be able to see the results in a couple of hours at http://server.roeck-us.net:8010/builders, in the 'testing' column. The build system doesn't log warnings, but this should give us an idea if the build passes for all architectures. I'll have a look myself later and let you know as well. Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] crypto: jitterentropy - avoid compiler warnings
Hi Geert, Guenter, may I ask that you check that the following patch compiles without errors or warnings on your systems? Though, when I test that patch with the AVR32 cross compiler, I get a warning about the code being not relaxable. Thank you very much. ---8<--- The core of the Jitter RNG is intended to be compiled with -O0. To ensure that the Jitter RNG can be compiled on all architectures, separate out the RNG core into a stand-alone C file that can be compiled with -O0 which does not depend on any kernel include file. As no kernel includes can be used in the C file implementing the core RNG, any dependencies on kernel code must be extracted. A second file provides the link to the kernel and the kernel crypto API that can be compiled with the regular compile options of the kernel. Signed-off-by: Stephan Mueller --- crypto/Makefile | 4 +- crypto/jitterentropy-kcapi.c | 208 ++ crypto/jitterentropy.c | 213 --- 3 files changed, 248 insertions(+), 177 deletions(-) create mode 100644 crypto/jitterentropy-kcapi.c diff --git a/crypto/Makefile b/crypto/Makefile index 0077476..a16a7e7 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -106,7 +106,9 @@ obj-$(CONFIG_CRYPTO_842) += 842.o obj-$(CONFIG_CRYPTO_RNG2) += rng.o obj-$(CONFIG_CRYPTO_ANSI_CPRNG) += ansi_cprng.o obj-$(CONFIG_CRYPTO_DRBG) += drbg.o -obj-$(CONFIG_CRYPTO_JITTERENTROPY) += jitterentropy.o +obj-$(CONFIG_CRYPTO_JITTERENTROPY) += jitterentropy_rng.o +CFLAGS_jitterentropy.o = -O0 +jitterentropy_rng-y := jitterentropy.o jitterentropy-kcapi.o obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o obj-$(CONFIG_CRYPTO_GHASH) += ghash-generic.o obj-$(CONFIG_CRYPTO_USER_API) += af_alg.o diff --git a/crypto/jitterentropy-kcapi.c b/crypto/jitterentropy-kcapi.c new file mode 100644 index 000..b32d834 --- /dev/null +++ b/crypto/jitterentropy-kcapi.c @@ -0,0 +1,208 @@ +/* + * Non-physical true random number generator based on timing jitter -- + * Linux Kernel Crypto API specific code + * + * Copyright Stephan Mueller , 2015 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, and the entire permission notice in its entirety, + *including the disclaimer of warranties. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + *products derived from this software without specific prior + *written permission. + * + * ALTERNATIVELY, this product may be distributed under the terms of + * the GNU General Public License, in which case the provisions of the GPL2 are + * required INSTEAD OF the above restrictions. (This clause is + * necessary due to a potential bad interaction between the GPL and + * the restrictions contained in a BSD-style copyright.) + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF + * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include + +struct rand_data; +int jent_read_entropy(struct rand_data *ec, unsigned char *data, + unsigned int len); +int jent_entropy_init(void); +struct rand_data *jent_entropy_collector_alloc(unsigned int osr, + unsigned int flags); +void jent_entropy_collector_free(struct rand_data *entropy_collector); + +/*** + * Helper function + ***/ + +__u64 jent_rol64(__u64 word, unsigned int shift) +{ + return rol64(word, shift); +} + +void *jent_zalloc(unsigned int len) +{ + return kzalloc(len, GFP_KERNEL); +} + +void jent_zfree(void *ptr) +{ + kzfree(ptr); +} + +int jent_fips_enabled(void) +{ + return fips_enabled; +} + +void jent_panic(char *s) +{ + panic(s); +} + +void jent_memcpy(void *dest, const void *src, unsigned