From gnupg-users at gnupg.org Mon Jul 6 16:39:31 2020 From: gnupg-users at gnupg.org (Werner Koch via Gnupg-users) Date: Mon, 06 Jul 2020 16:39:31 +0200 Subject: [Announce] Libgcrypt 1.8.6 released Message-ID: <87eepou2qk.fsf@wheatstone.g10code.de> Hi! The GnuPG Project is pleased to announce the availability of Libgcrypt version 1.8.6. This is a maintenance release. Libgcrypt is a general purpose library of cryptographic building blocks. It is used by GnuPG and many other programs. Libgcrypt does not provide any implementation of OpenPGP, S/MIME, or other protocols. Thorough understanding of applied cryptography is required to use Libgcrypt. Noteworthy changes in version 1.8.6 =================================== * Bug fixes: - Fix build problems on OpenIndiana et al. [#4818] - Fix GCM bug on arm64 which troubles for example OMEMO. [#4986] - Fix wrong code execution in Poly1305 ARM/NEON implementation. [#4833] - Detect a div-by-zero in a debug helper tool. [#4868] - Use a constant time mpi_inv in some cases and change the order mpi_invm is called. [#4869] - Fix mpi_copy to correctly handle flags of opaque MPIs. - Fix mpi_cmp to consider +0 and -0 the same. * Other features: - Add OIDs from RFC-8410 as aliases for Ed25519 and Curve25519. Release-info: https://dev.gnupg.org/T4985 Download ======== Source code is hosted at the GnuPG FTP server and its mirrors as listed at . On the primary server the source tarball and its digital signature are: https://gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.6.tar.bz2 https://gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.6.tar.bz2.sig or gzip compressed: https://gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.6.tar.gz https://gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.6.tar.gz.sig In order to check that the version of Libgcrypt you downloaded is an original and unmodified file please follow the instructions found at . In short, you may use one of the following methods: - Check the supplied OpenPGP signature. For example to check the signature of the file libgcrypt-1.8.6.tar.bz2 you would use this command: gpg --verify libgcrypt-1.8.6.tar.bz2.sig libgcrypt-1.8.6.tar.bz2 This checks whether the signature file matches the source file. You should see a message indicating that the signature is good and made by one or more of the release signing keys. Make sure that this is a valid key, either by matching the shown fingerprint against a trustworthy list of valid release signing keys or by checking that the key has been signed by trustworthy other keys. See the end of this mail for information on the signing keys. - If you are not able to use an existing version of GnuPG, you have to verify the SHA-1 checksum. On Unix systems the command to do this is either "sha1sum" or "shasum". Assuming you downloaded the file libgcrypt-1.8.6.tar.bz2, you run the command like this: sha1sum libgcrypt-1.8.6.tar.bz2 and check that the output matches the first line from the this list: 406b02873833427898d16bcc8483bc5c91c73d4a libgcrypt-1.8.6.tar.bz2 1aa882e816f6ab9375307f19f26c5ea7a5d27b76 libgcrypt-1.8.6.tar.gz You should also verify that the checksums above are authentic by matching them with copies of this announcement. Those copies can be found at other mailing lists, web sites, and search engines. Copying ======= Libgcrypt is distributed under the terms of the GNU Lesser General Public License (LGPLv2.1+). The helper programs as well as the documentation are distributed under the terms of the GNU General Public License (GPLv2+). The file LICENSES has notices about contributions that require that these additional notices are distributed. Support ======= For help on developing with Libgcrypt you should read the included manual and if needed ask on the gcrypt-devel mailing list. In case of problems specific to this release please first check for updated information. Please also consult the archive of the gcrypt-devel mailing list before reporting a bug: . We suggest to send bug reports for a new release to this list in favor of filing a bug at . If you need commercial support go to or . If you are a developer and you need a certain feature for your project, please do not hesitate to bring it to the gcrypt-devel mailing list for discussion. Thanks ====== Maintenance and development of GnuPG is mostly financed by donations. The GnuPG project currently employs two full-time developers and one contractor. They all work exclusively on GnuPG and closely related software like Libgcrypt, GPGME and Gpg4win. We have to thank all the people who helped the GnuPG project, be it testing, coding, translating, suggesting, auditing, administering the servers, spreading the word, and answering questions on the mailing lists. Many thanks to our numerous financial supporters, both corporate and individuals. Without you it would not be possible to keep GnuPG in a good shape and to address all the small and larger requests made by our users. Thanks. Happy hacking, Your GnuPG hackers p.s. This is an announcement only mailing list. Please send replies only to the gcrypt-devel'at'gnupg.org mailing list. p.p.s List of Release Signing Keys: To guarantee that a downloaded GnuPG version has not been tampered by malicious entities we provide signature files for all tarballs and binary versions. The keys are also signed by the long term keys of their respective owners. Current releases are signed by one or more of these three keys: rsa2048 2011-01-12 [expires: 2021-12-31] Key fingerprint = D869 2123 C406 5DEA 5E0F 3AB5 249B 39D2 4F25 E3B6 Werner Koch (dist sig) rsa2048 2014-10-29 [expires: 2020-10-30] Key fingerprint = 031E C253 6E58 0D8E A286 A9F2 2071 B08A 33BD 3F06 NIIBE Yutaka (GnuPG Release Key) rsa3072 2017-03-17 [expires: 2027-03-15] Key fingerprint = 5B80 C575 4298 F0CB 55D8 ED6A BCEF 7E29 4B09 2E28 Andre Heinecke (Release Signing Key) The keys are available at and in any recently released GnuPG tarball in the file g10/distsigkey.gpg . Note that this mail has been signed by a different key. -- Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 227 bytes Desc: not available URL: -------------- next part -------------- _______________________________________________ Gnupg-announce mailing list Gnupg-announce at gnupg.org http://lists.gnupg.org/mailman/listinfo/gnupg-announce -------------- next part -------------- _______________________________________________ Gnupg-users mailing list Gnupg-users at gnupg.org http://lists.gnupg.org/mailman/listinfo/gnupg-users From jussi.kivilinna at iki.fi Thu Jul 23 18:25:26 2020 From: jussi.kivilinna at iki.fi (Jussi Kivilinna) Date: Thu, 23 Jul 2020 19:25:26 +0300 Subject: [PATCH] Enable jitter entropy also on non-x86 architectures Message-ID: <20200723162526.1673710-1-jussi.kivilinna@iki.fi> * configure.ac: Do not force jentsupport to "n/a" on non-x86 architectures. -- GnuPG-bug-id: 4966 Signed-off-by: Jussi Kivilinna --- configure.ac | 1 - 1 file changed, 1 deletion(-) diff --git a/configure.ac b/configure.ac index 1f03e79f..9a5359c2 100644 --- a/configure.ac +++ b/configure.ac @@ -1278,7 +1278,6 @@ if test "$mpi_cpu_arch" != "x86" ; then avxsupport="n/a" avx2support="n/a" padlocksupport="n/a" - jentsupport="n/a" drngsupport="n/a" fi -- 2.25.1 From jussi.kivilinna at iki.fi Thu Jul 23 18:25:34 2020 From: jussi.kivilinna at iki.fi (Jussi Kivilinna) Date: Thu, 23 Jul 2020 19:25:34 +0300 Subject: [PATCH] tests/bench-slope: improve CPU frequency auto-detection Message-ID: <20200723162534.1673777-1-jussi.kivilinna@iki.fi> * configure.ac (gcry_cv_have_asm_volatile_memory): Check also if assembly memory barrier with input/output register is supported. * tests/bench-slope.c (auto_ghz_bench): Change to use base operation that takes two CPU cycles and unroll loop by 1024 operations. -- CPU frequency is now correctly detected on AWS Graviton CPU (2.3Ghz). Signed-off-by: Jussi Kivilinna --- configure.ac | 11 +++++++-- tests/bench-slope.c | 57 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 58 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 9a5359c2..96a18d19 100644 --- a/configure.ac +++ b/configure.ac @@ -1117,7 +1117,11 @@ if test "$gcry_cv_have_asm" = "no" ; then [gcry_cv_have_asm_volatile_memory], [gcry_cv_have_asm_volatile_memory=no AC_COMPILE_IFELSE([AC_LANG_SOURCE( - [[void a(void) { __asm__ volatile("":::"memory"); }]])], + [[void a(int x) + { + __asm__ volatile("":::"memory"); + __asm__ volatile("":"+r"(x)::"memory"); + }]])], [gcry_cv_have_asm_volatile_memory=yes])]) fi else @@ -1125,7 +1129,10 @@ else [gcry_cv_have_asm_volatile_memory], [gcry_cv_have_asm_volatile_memory=no AC_COMPILE_IFELSE([AC_LANG_SOURCE( - [[void a(void) { asm volatile("":::"memory"); }]])], + [[void a(int x) + { + asm volatile("":::"memory"); + asm volatile("":"+r"(x)::"memory"); }]])], [gcry_cv_have_asm_volatile_memory=yes])]) fi if test "$gcry_cv_have_asm_volatile_memory" = "yes" ; then diff --git a/tests/bench-slope.c b/tests/bench-slope.c index 63f8f7ae..cfb3dd66 100644 --- a/tests/bench-slope.c +++ b/tests/bench-slope.c @@ -509,18 +509,59 @@ auto_ghz_bench (struct bench_obj *obj, void *buf, size_t buflen) * function will give cycles/iteration result 1024.0 on high-end CPUs. * With turbo, result will be less and can be used detect turbo-clock. */ - do - { #ifdef HAVE_GCC_ASM_VOLATILE_MEMORY - /* Use memory barrier to prevent compiler from optimizing this loop - * away. */ - - asm volatile ("":::"memory"); + /* Auto-ghz operation takes two CPU cycles to perform. Memory barriers + * are used to prevent compiler from optimizing this loop away. */ + #define AUTO_GHZ_OPERATION \ + asm volatile ("":"+r"(buflen)::"memory"); \ + buflen ^= 1; \ + asm volatile ("":"+r"(buflen)::"memory"); \ + buflen -= 2 #else - /* TODO: Needs alternative way. */ + /* TODO: Needs alternative way of preventing compiler optimizations. + * Mix of XOR and subtraction appears to do the trick for now. */ + #define AUTO_GHZ_OPERATION \ + buflen ^= 1; \ + buflen -= 2 #endif + +#define AUTO_GHZ_OPERATION_2 \ + AUTO_GHZ_OPERATION; \ + AUTO_GHZ_OPERATION + +#define AUTO_GHZ_OPERATION_4 \ + AUTO_GHZ_OPERATION_2; \ + AUTO_GHZ_OPERATION_2 + +#define AUTO_GHZ_OPERATION_8 \ + AUTO_GHZ_OPERATION_4; \ + AUTO_GHZ_OPERATION_4 + +#define AUTO_GHZ_OPERATION_16 \ + AUTO_GHZ_OPERATION_8; \ + AUTO_GHZ_OPERATION_8 + +#define AUTO_GHZ_OPERATION_32 \ + AUTO_GHZ_OPERATION_16; \ + AUTO_GHZ_OPERATION_16 + +#define AUTO_GHZ_OPERATION_64 \ + AUTO_GHZ_OPERATION_32; \ + AUTO_GHZ_OPERATION_32 + +#define AUTO_GHZ_OPERATION_128 \ + AUTO_GHZ_OPERATION_64; \ + AUTO_GHZ_OPERATION_64 + + do + { + /* 1024 auto-ghz operations per loop, total 2048 instructions. */ + AUTO_GHZ_OPERATION_128; AUTO_GHZ_OPERATION_128; + AUTO_GHZ_OPERATION_128; AUTO_GHZ_OPERATION_128; + AUTO_GHZ_OPERATION_128; AUTO_GHZ_OPERATION_128; + AUTO_GHZ_OPERATION_128; AUTO_GHZ_OPERATION_128; } - while (--buflen); + while (buflen); } static struct bench_ops auto_ghz_detect_ops = { -- 2.25.1 From jussi.kivilinna at iki.fi Thu Jul 23 18:25:38 2020 From: jussi.kivilinna at iki.fi (Jussi Kivilinna) Date: Thu, 23 Jul 2020 19:25:38 +0300 Subject: [PATCH] chacha20-aarch64: improve performance through higher SIMD interleaving Message-ID: <20200723162538.1673828-1-jussi.kivilinna@iki.fi> * cipher/chacha20-aarch64.S (ROTATE2, ROTATE2_8, ROTATE2_16) (QUARTERROUND2): Replace with... (ROTATE4, ROTATE4_8, ROTATE4_16, QUARTERROUND4): ...these. (_gcry_chacha20_aarch64_blocks4) (_gcry_chacha20_poly1305_aarch64_blocks4): Adjust to use QUARTERROUND4. -- This change improves chacha20 performance on larger ARM cores, such as Cortex-A72. Performance on Cortex-A53 stays the same. Benchmark on AWS Graviton (Cortex-A72): Before: CHACHA20 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz STREAM enc | 3.11 ns/B 306.3 MiB/s 7.16 c/B 2300 STREAM dec | 3.12 ns/B 306.0 MiB/s 7.17 c/B 2300 POLY1305 enc | 3.14 ns/B 304.2 MiB/s 7.21 c/B 2300 POLY1305 dec | 3.11 ns/B 306.6 MiB/s 7.15 c/B 2300 POLY1305 auth | 0.929 ns/B 1027 MiB/s 2.14 c/B 2300 After (~41% faster): CHACHA20 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz STREAM enc | 2.19 ns/B 435.1 MiB/s 5.04 c/B 2300 STREAM dec | 2.20 ns/B 434.1 MiB/s 5.05 c/B 2300 POLY1305 enc | 2.22 ns/B 429.2 MiB/s 5.11 c/B 2300 POLY1305 dec | 2.20 ns/B 434.3 MiB/s 5.05 c/B 2300 POLY1305 auth | 0.931 ns/B 1025 MiB/s 2.14 c/B 2300 Signed-off-by: Jussi Kivilinna --- cipher/chacha20-aarch64.S | 130 ++++++++++++++++++++++++-------------- 1 file changed, 81 insertions(+), 49 deletions(-) diff --git a/cipher/chacha20-aarch64.S b/cipher/chacha20-aarch64.S index 7ace023f..b8f9724a 100644 --- a/cipher/chacha20-aarch64.S +++ b/cipher/chacha20-aarch64.S @@ -116,41 +116,69 @@ 4-way chacha20 **********************************************************************/ -#define ROTATE2(dst1,dst2,c,src1,src2,iop1) \ +#define XOR(d,s1,s2) \ + eor d.16b, s2.16b, s1.16b; + +#define PLUS(ds,s) \ + add ds.4s, ds.4s, s.4s; + +#define ROTATE4(dst1,dst2,dst3,dst4,c,src1,src2,src3,src4,iop1,iop2,iop3) \ shl dst1.4s, src1.4s, #(c); \ shl dst2.4s, src2.4s, #(c); \ iop1; \ + shl dst3.4s, src3.4s, #(c); \ + shl dst4.4s, src4.4s, #(c); \ + iop2; \ sri dst1.4s, src1.4s, #(32 - (c)); \ - sri dst2.4s, src2.4s, #(32 - (c)); + sri dst2.4s, src2.4s, #(32 - (c)); \ + iop3; \ + sri dst3.4s, src3.4s, #(32 - (c)); \ + sri dst4.4s, src4.4s, #(32 - (c)); -#define ROTATE2_8(dst1,dst2,src1,src2,iop1) \ +#define ROTATE4_8(dst1,dst2,dst3,dst4,src1,src2,src3,src4,iop1,iop2,iop3) \ tbl dst1.16b, {src1.16b}, ROT8.16b; \ iop1; \ - tbl dst2.16b, {src2.16b}, ROT8.16b; + tbl dst2.16b, {src2.16b}, ROT8.16b; \ + iop2; \ + tbl dst3.16b, {src3.16b}, ROT8.16b; \ + iop3; \ + tbl dst4.16b, {src4.16b}, ROT8.16b; -#define ROTATE2_16(dst1,dst2,src1,src2) \ +#define ROTATE4_16(dst1,dst2,dst3,dst4,src1,src2,src3,src4,iop1) \ rev32 dst1.8h, src1.8h; \ - rev32 dst2.8h, src2.8h; - -#define XOR(d,s1,s2) \ - eor d.16b, s2.16b, s1.16b; - -#define PLUS(ds,s) \ - add ds.4s, ds.4s, s.4s; - -#define QUARTERROUND2(a1,b1,c1,d1,a2,b2,c2,d2,ign,tmp1,tmp2,iop1,iop2,iop3,iop4,iop5,iop6,iop7,iop8,iop9,iop10,iop11,iop12,iop13,iop14) \ - PLUS(a1,b1); PLUS(a2,b2); iop1; \ - XOR(tmp1,d1,a1); XOR(tmp2,d2,a2); iop2; \ - ROTATE2_16(d1, d2, tmp1, tmp2); iop3; \ - PLUS(c1,d1); PLUS(c2,d2); iop4; \ - XOR(tmp1,b1,c1); XOR(tmp2,b2,c2); iop5; \ - ROTATE2(b1, b2, 12, tmp1, tmp2, _(iop6)); iop7; \ - PLUS(a1,b1); PLUS(a2,b2); iop8; \ - XOR(tmp1,d1,a1); XOR(tmp2,d2,a2); iop9; \ - ROTATE2_8(d1, d2, tmp1, tmp2, _(iop10)); iop11; \ - PLUS(c1,d1); PLUS(c2,d2); iop12; \ - XOR(tmp1,b1,c1); XOR(tmp2,b2,c2); iop13; \ - ROTATE2(b1, b2, 7, tmp1, tmp2, _(iop14)); + rev32 dst2.8h, src2.8h; \ + iop1; \ + rev32 dst3.8h, src3.8h; \ + rev32 dst4.8h, src4.8h; + +#define QUARTERROUND4(a1,b1,c1,d1,a2,b2,c2,d2,a3,b3,c3,d3,a4,b4,c4,d4,ign,tmp1,tmp2,tmp3,tmp4,\ + iop1,iop2,iop3,iop4,iop5,iop6,iop7,iop8,iop9,iop10,iop11,iop12,iop13,iop14,\ + iop15,iop16,iop17,iop18,iop19,iop20,iop21,iop22,iop23,iop24,iop25,iop26,\ + iop27,iop28,iop29) \ + PLUS(a1,b1); PLUS(a2,b2); iop1; \ + PLUS(a3,b3); PLUS(a4,b4); iop2; \ + XOR(tmp1,d1,a1); XOR(tmp2,d2,a2); iop3; \ + XOR(tmp3,d3,a3); XOR(tmp4,d4,a4); iop4; \ + ROTATE4_16(d1, d2, d3, d4, tmp1, tmp2, tmp3, tmp4, _(iop5)); \ + iop6; \ + PLUS(c1,d1); PLUS(c2,d2); iop7; \ + PLUS(c3,d3); PLUS(c4,d4); iop8; \ + XOR(tmp1,b1,c1); XOR(tmp2,b2,c2); iop9; \ + XOR(tmp3,b3,c3); XOR(tmp4,b4,c4); iop10; \ + ROTATE4(b1, b2, b3, b4, 12, tmp1, tmp2, tmp3, tmp4, \ + _(iop11), _(iop12), _(iop13)); iop14; \ + PLUS(a1,b1); PLUS(a2,b2); iop15; \ + PLUS(a3,b3); PLUS(a4,b4); iop16; \ + XOR(tmp1,d1,a1); XOR(tmp2,d2,a2); iop17; \ + XOR(tmp3,d3,a3); XOR(tmp4,d4,a4); iop18; \ + ROTATE4_8(d1, d2, d3, d4, tmp1, tmp2, tmp3, tmp4, \ + _(iop19), _(iop20), _(iop21)); iop22; \ + PLUS(c1,d1); PLUS(c2,d2); iop23; \ + PLUS(c3,d3); PLUS(c4,d4); iop24; \ + XOR(tmp1,b1,c1); XOR(tmp2,b2,c2); iop25; \ + XOR(tmp3,b3,c3); XOR(tmp4,b4,c4); iop26; \ + ROTATE4(b1, b2, b3, b4, 7, tmp1, tmp2, tmp3, tmp4, \ + _(iop27), _(iop28), _(iop29)); .align 4 .globl _gcry_chacha20_aarch64_blocks4_data_inc_counter @@ -219,14 +247,14 @@ _gcry_chacha20_aarch64_blocks4: .Lround2: subs ROUND, ROUND, #2 - QUARTERROUND2(X0, X4, X8, X12, X1, X5, X9, X13, tmp:=,VTMP0,VTMP1, - ,,,,,,,,,,,,,) - QUARTERROUND2(X2, X6, X10, X14, X3, X7, X11, X15, tmp:=,VTMP0,VTMP1, - ,,,,,,,,,,,,,) - QUARTERROUND2(X0, X5, X10, X15, X1, X6, X11, X12, tmp:=,VTMP0,VTMP1, - ,,,,,,,,,,,,,) - QUARTERROUND2(X2, X7, X8, X13, X3, X4, X9, X14, tmp:=,VTMP0,VTMP1, - ,,,,,,,,,,,,,) + QUARTERROUND4(X0, X4, X8, X12, X1, X5, X9, X13, + X2, X6, X10, X14, X3, X7, X11, X15, + tmp:=,VTMP0,VTMP1,VTMP2,VTMP3, + ,,,,,,,,,,,,,,,,,,,,,,,,,,,,) + QUARTERROUND4(X0, X5, X10, X15, X1, X6, X11, X12, + X2, X7, X8, X13, X3, X4, X9, X14, + tmp:=,VTMP0,VTMP1,VTMP2,VTMP3, + ,,,,,,,,,,,,,,,,,,,,,,,,,,,,) b.ne .Lround2; ld1 {VTMP0.16b, VTMP1.16b}, [INPUT_POS], #32; @@ -400,7 +428,9 @@ _gcry_chacha20_poly1305_aarch64_blocks4: mov POLY_CHACHA_ROUND, #6; .Lround4_with_poly1305_inner1: POLY1305_BLOCK_PART1(0 * 16) - QUARTERROUND2(X0, X4, X8, X12, X1, X5, X9, X13, tmp:=,VTMP0,VTMP1, + QUARTERROUND4(X0, X4, X8, X12, X1, X5, X9, X13, + X2, X6, X10, X14, X3, X7, X11, X15, + tmp:=,VTMP0,VTMP1,VTMP2,VTMP3, POLY1305_BLOCK_PART2(0 * 16), POLY1305_BLOCK_PART3(), POLY1305_BLOCK_PART4(), @@ -414,9 +444,8 @@ _gcry_chacha20_poly1305_aarch64_blocks4: POLY1305_BLOCK_PART12(), POLY1305_BLOCK_PART13(), POLY1305_BLOCK_PART14(), - POLY1305_BLOCK_PART15()) - POLY1305_BLOCK_PART16() - QUARTERROUND2(X2, X6, X10, X14, X3, X7, X11, X15, tmp:=,VTMP0,VTMP1, + POLY1305_BLOCK_PART15(), + POLY1305_BLOCK_PART16(), POLY1305_BLOCK_PART17(), POLY1305_BLOCK_PART18(), POLY1305_BLOCK_PART19(), @@ -432,7 +461,9 @@ _gcry_chacha20_poly1305_aarch64_blocks4: POLY1305_BLOCK_PART29(), POLY1305_BLOCK_PART1(1 * 16)) POLY1305_BLOCK_PART2(1 * 16) - QUARTERROUND2(X0, X5, X10, X15, X1, X6, X11, X12, tmp:=,VTMP0,VTMP1, + QUARTERROUND4(X0, X5, X10, X15, X1, X6, X11, X12, + X2, X7, X8, X13, X3, X4, X9, X14, + tmp:=,VTMP0,VTMP1,VTMP2,VTMP3, _(add POLY_RSRC, POLY_RSRC, #(2*16)), POLY1305_BLOCK_PART3(), POLY1305_BLOCK_PART4(), @@ -446,9 +477,8 @@ _gcry_chacha20_poly1305_aarch64_blocks4: POLY1305_BLOCK_PART12(), POLY1305_BLOCK_PART13(), POLY1305_BLOCK_PART14(), - POLY1305_BLOCK_PART15()) - POLY1305_BLOCK_PART16() - QUARTERROUND2(X2, X7, X8, X13, X3, X4, X9, X14, tmp:=,VTMP0,VTMP1, + POLY1305_BLOCK_PART15(), + POLY1305_BLOCK_PART16(), POLY1305_BLOCK_PART17(), POLY1305_BLOCK_PART18(), POLY1305_BLOCK_PART19(), @@ -468,15 +498,16 @@ _gcry_chacha20_poly1305_aarch64_blocks4: mov POLY_CHACHA_ROUND, #4; .Lround4_with_poly1305_inner2: POLY1305_BLOCK_PART1(0 * 16) - QUARTERROUND2(X0, X4, X8, X12, X1, X5, X9, X13, tmp:=,VTMP0,VTMP1,, + QUARTERROUND4(X0, X4, X8, X12, X1, X5, X9, X13, + X2, X6, X10, X14, X3, X7, X11, X15, + tmp:=,VTMP0,VTMP1,VTMP2,VTMP3,, POLY1305_BLOCK_PART2(0 * 16),, _(add POLY_RSRC, POLY_RSRC, #(1*16)),, POLY1305_BLOCK_PART3(),, POLY1305_BLOCK_PART4(),, POLY1305_BLOCK_PART5(),, POLY1305_BLOCK_PART6(),, - POLY1305_BLOCK_PART7()) - QUARTERROUND2(X2, X6, X10, X14, X3, X7, X11, X15, tmp:=,VTMP0,VTMP1, + POLY1305_BLOCK_PART7(),, POLY1305_BLOCK_PART8(),, POLY1305_BLOCK_PART9(),, POLY1305_BLOCK_PART10(),, @@ -485,15 +516,16 @@ _gcry_chacha20_poly1305_aarch64_blocks4: POLY1305_BLOCK_PART13(),, POLY1305_BLOCK_PART14(),) POLY1305_BLOCK_PART15() - QUARTERROUND2(X0, X5, X10, X15, X1, X6, X11, X12, tmp:=,VTMP0,VTMP1,, + QUARTERROUND4(X0, X5, X10, X15, X1, X6, X11, X12, + X2, X7, X8, X13, X3, X4, X9, X14, + tmp:=,VTMP0,VTMP1,VTMP2,VTMP3, POLY1305_BLOCK_PART16(),, POLY1305_BLOCK_PART17(),, POLY1305_BLOCK_PART18(),, POLY1305_BLOCK_PART19(),, POLY1305_BLOCK_PART20(),, POLY1305_BLOCK_PART21(),, - POLY1305_BLOCK_PART22()) - QUARTERROUND2(X2, X7, X8, X13, X3, X4, X9, X14, tmp:=,VTMP0,VTMP1, + POLY1305_BLOCK_PART22(),, POLY1305_BLOCK_PART23(),, POLY1305_BLOCK_PART24(),, POLY1305_BLOCK_PART25(),, @@ -501,7 +533,7 @@ _gcry_chacha20_poly1305_aarch64_blocks4: POLY1305_BLOCK_PART27(),, POLY1305_BLOCK_PART28(),, POLY1305_BLOCK_PART29(), - _(subs POLY_CHACHA_ROUND, POLY_CHACHA_ROUND, #2)) + _(subs POLY_CHACHA_ROUND, POLY_CHACHA_ROUND, #2),) b.ne .Lround4_with_poly1305_inner2; subs ROUND, ROUND, #10 -- 2.25.1 From jussi.kivilinna at iki.fi Thu Jul 23 21:49:05 2020 From: jussi.kivilinna at iki.fi (Jussi Kivilinna) Date: Thu, 23 Jul 2020 22:49:05 +0300 Subject: [PATCH] random/jitterentropy: fix USE_JENT == JENT_USES_GETTIME code path Message-ID: <20200723194905.1947831-1-jussi.kivilinna@iki.fi> * random/jitterentropy-base-user.h (jent_get_nstime): Use 'tv' variable instead of non-existing 'time'. -- GnuPG-bug-id: 4966 Signed-off-by: Jussi Kivilinna --- random/jitterentropy-base-user.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/random/jitterentropy-base-user.h b/random/jitterentropy-base-user.h index 75dd7681..8a8dbd55 100644 --- a/random/jitterentropy-base-user.h +++ b/random/jitterentropy-base-user.h @@ -86,9 +86,9 @@ jent_get_nstime(u64 *out) * not rely on that extra little entropy. */ if (!clock_gettime (CLOCK_REALTIME, &tv)) { - tmp = time.tv_sec; + tmp = tv.tv_sec; tmp = tmp << 32; - tmp = tmp | time.tv_nsec; + tmp = tmp | tv.tv_nsec; } else tmp = 0; -- 2.25.1 From tstellar at redhat.com Mon Jul 27 21:09:46 2020 From: tstellar at redhat.com (Tom Stellard) Date: Mon, 27 Jul 2020 19:09:46 +0000 Subject: [PATCH] Fix build of jitterentropy-base.c with clang Message-ID: <20200727190946.14768-1-tstellar@redhat.com> Clang has a slightly different pragma to disable optimizations. --- random/jitterentropy-base.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/random/jitterentropy-base.c b/random/jitterentropy-base.c index 32fdea46..2c198ef5 100644 --- a/random/jitterentropy-base.c +++ b/random/jitterentropy-base.c @@ -50,6 +50,14 @@ */ #undef _FORTIFY_SOURCE +#ifdef __clang__ +#pragma clang optimize off + +/* clang does not undefine the __OPTIMIZE__ macro after using the + * clang optimize off pragma, so the same __OPTIMIZE__ check below that + * is used for gcc won't work. + */ +#else #pragma GCC optimize ("O0") #include "jitterentropy.h" @@ -60,6 +68,7 @@ #error "The CPU Jitter random number generator must not be compiled with optimizations. See documentation. Use the compiler switch -O0 for compiling jitterentropy-base.c." #endif #endif +#endif #define MAJVERSION 2 /* API / ABI incompatible changes, functional changes that * require consumer to be updated (as long as this number -- 2.26.2 From tstellar at redhat.com Mon Jul 27 22:00:19 2020 From: tstellar at redhat.com (Tom Stellard) Date: Mon, 27 Jul 2020 20:00:19 +0000 Subject: [PATCH] Fix build of jitterentropy-base.c with clang v2 In-Reply-To: <20200727190946.14768-1-tstellar@redhat.com> References: <20200727190946.14768-1-tstellar@redhat.com> Message-ID: <20200727200019.5761-1-tstellar@redhat.com> Clang has a slightly different pragma to disable optimizations. v2: Make sure jitterentropy.h is included when buiding with clang. --- random/jitterentropy-base.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/random/jitterentropy-base.c b/random/jitterentropy-base.c index 32fdea46..cd5af22b 100644 --- a/random/jitterentropy-base.c +++ b/random/jitterentropy-base.c @@ -50,9 +50,16 @@ */ #undef _FORTIFY_SOURCE +#ifdef __clang__ +#pragma clang optimize off + +/* clang does not undefine the __OPTIMIZE__ macro after using the + * clang optimize off pragma, so the same __OPTIMIZE__ check below that + * is used for gcc won't work. + */ +#else #pragma GCC optimize ("O0") -#include "jitterentropy.h" #ifndef CONFIG_CRYPTO_CPU_JITTERENTROPY_STAT /* only check optimization in a compilation for real work */ @@ -60,6 +67,9 @@ #error "The CPU Jitter random number generator must not be compiled with optimizations. See documentation. Use the compiler switch -O0 for compiling jitterentropy-base.c." #endif #endif +#endif + +#include "jitterentropy.h" #define MAJVERSION 2 /* API / ABI incompatible changes, functional changes that * require consumer to be updated (as long as this number -- 2.26.2