Debian Codegraph @

ChangeLog

raw
1 2026-04-15 NIIBE Yutaka <[email protected]>
2
3 cipher:kem:ecc: Raise an error by validating a point on curve.
4 + commit f95ba3c063a5e67e895b93564164593890b5063c
5 * cipher/ecc-ecdh.c (_gcry_ecc_curve_mul_point): Add new argument
6 ENABLE_MONT_CHECK to enable check for Montgomery curve. Add point
7 validation. Raise GPG_ERR_INV_DATA on failure.
8 (_gcry_ecc_mul_point): Call _gcry_ecc_curve_mul_point with Montgomery
9 curve check disabled.
10 * cipher/kem-ecc.c (ecc_mul_point): Call _gcry_ecc_curve_mul_point
11 with Montgomery curve check enabled.
12 * src/gcrypt-int.h (_gcry_ecc_curve_mul_point): Change the proto.
13
14 cipher:ecc: Fix decoding a point on Montgomery curve.
15 + commit 2d3d732c9bf87cc10729f69678dd9e6862f99fa3
16 * cipher/ecc-misc.c (_gcry_ecc_mont_decodepoint): Fix the padding
17 mistake and add updating RAWMPILEN.
18
19 2026-04-13 NIIBE Yutaka <[email protected]>
20 Thai Duong <[email protected]>
21
22 cipher:dilithium: Check the label length by caller.
23 + commit 905e00f046a71e5670517779afaf85a354952832
24 * cipher/dilithium.h (dilithium_keypair, dilithium_sign)
25 (dilithium_verify): Return gpg_err_code_t.
26 * cipher/dilithium.c (dilithium_keypair): Return gpg_err_code_t.
27 (dilithium_sign, dilithium_verify): Ditto. Check CTXLEN.
28 * cipher/pubkey-dilithium.c (mldsa_generate): Follow the change.
29 (mldsa_sign, mldsa_verify): Likewise.
30
31 2026-04-09 NIIBE Yutaka <[email protected]>
32
33 cipher:dilithium: Fix the glue of libgcrypt.
34 + commit 5a875908cb95407e12c7d206e31c287b0e06dbca
35 * cipher/dilithium.h (dilithium_sign, dilithium_verify): Define the
36 macro correctly so that we can keep using _gcry namespace for internal
37 functions.
38
39 2026-04-07 NIIBE Yutaka <[email protected]>
40
41 tests:kem: Don't emit a message each time, but once.
42 + commit 460695d0538b2d9df6511e7ae686469bcecc686a
43 * tests/t-kem.c (test_kem_sntrup761, test_kem_mceliece6688128f)
44 (test_kem_mlkem512, test_kem_mlkem768, test_kem_mlkem1024): Don't emit
45 message here.
46 (check_kem): But here, before the loop.
47
48 2026-03-24 NIIBE Yutaka <[email protected]>
49
50 cipher:rsa: Fix the dead-code of stronger_key_check.
51 + commit 39aca53012e098c1c049e28d759a051e173709ec
52 * cipher/rsa.c (check_secret_key): Rename from stronger_key_check
53 to be enabled with ENABLE_STRONGER_CHECK.
54
55 2026-03-16 Werner Koch <[email protected]>
56
57 Add the commit-id to the VERSION file.
58 + commit 1f85852506bd8765a00a34d90822c6be4630c587
59 * compat/compat.c (_gcry_compat_identification): Also use here.
60 * configure.ac (mym4_commitid): New.
61 (BUILD_COMMITID): New ac_define.
62
63 2026-02-20 Werner Koch <[email protected]>
64
65 Release 1.12.1.
66 + commit 7e91b2a334d568297b7d81e05acd74e1d841b69d
67
68
69 2026-02-16 NIIBE Yutaka <[email protected]>
70
71 cipher:ecc: Fix Weierstrass curve with PUBKEY_FLAG_PARAM.
72 + commit 4aa07eeca100512e87117db8ef4b41cce12b10cb
73 * cipher/ecc-curves.c (point_from_keyparam): Handle the case where
74 EC==NULL.
75 * cipher/ecc-misc.c (_gcry_ecc_sec_decodepoint): Care about
76 EC==NULL.
77
78 mpi:ec: Use mpi_new with NBITS, instead of mpi_alloc.
79 + commit 740915ea5f20cfce21d182391389b26a462075c8
80 * mpi/ec.c (ec_get_two_inv_p): Use mpi_new with NBITS.
81 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_sign): Likewise.
82 (_gcry_ecc_ecdsa_verify): Likewise.
83 * cipher/ecc-gost.c (_gcry_ecc_gost_sign): Likewise.
84 (_gcry_ecc_gost_verify): Likewise.
85
86 mpi:ec: Make sure to have MPI limbs in ECC.
87 + commit 1468aaaa473d7f73623247580441bcc4aef07ee1
88 * src/mpi.h (_gcry_mpi_point_init): Add NBITS argument.
89 * mpi/ec.c (point_init): Follow the change.
90 (_gcry_mpi_point_log): Fix mpi_new with NBITS.
91 (_gcry_mpi_point_new): Fix _gcry_mpi_point_init with NBITS.
92 (_gcry_mpi_point_init): Initialize with mpi_new with NBITS.
93 (_gcry_mpi_ec_get_affine): Fix mpi_new with NBITS.
94 (montgomery_mul_point): Fix point_init with NBITS.
95 (mpi_ec_mul_point_lli): Fix point_init and mpi_new with NBITS.
96 (_gcry_mpi_ec_mul_point): Fix point_init with NBITS.
97 (_gcry_mpi_ec_curve_point): Fix mpi_new with NBITS.
98 * mpi/ec-hw-s390x.c (_gcry_s390x_ec_hw_mul_point): Likewise.
99 (s390_mul_point_montgomery): Likewise.
100 * cipher/ecc-common.h (point_init): Follow the change of
101 _gcry_mpi_point_init.
102 * cipher/ecc-curves.c (_gcry_ecc_get_curve): Likewise.
103 (point_from_keyparam): Fix mpi_point_new with NBITS.
104 (mpi_ec_get_elliptic_curve): Follow the change of
105 _gcry_mpi_point_init.
106 (_gcry_ecc_set_mpi): Fix mpi_point_new with NBITS.
107 * cipher/ecc-ecdh.c (_gcry_ecc_curve_keypair)
108 (_gcry_ecc_curve_mul_point): Fix point_init with NBITS.
109 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_sign): Likewise.
110 (_gcry_ecc_ecdsa_verify): Likewise.
111 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_encodepoint, ecc_ed448_recover_x)
112 (_gcry_ecc_eddsa_recover_x): Fix mpi_new with NBITS.
113 (_gcry_ecc_eddsa_genkey): Remove unused X and Y. Fix point_init with
114 NBITS.
115 (_gcry_ecc_eddsa_sign): Fix mpi_new with NBITS. Fix point_init with
116 NBITS.
117 (_gcry_ecc_eddsa_verify): Fix point_init with NBITS.
118 * cipher/ecc-gost.c (_gcry_ecc_gost_sign, _gcry_ecc_gost_verify):
119 Likewise.
120 * cipher/ecc-misc.c (_gcry_ecc_curve_copy): Follow the change of
121 _gcry_mpi_point_init.
122 (_gcry_mpi_ec_ec2os, _gcry_ecc_sec_decodepoint): Fix mpi_new with
123 NBITS.
124 (_gcry_ecc_compute_public): Fix mpi_point_new with NBITS.
125 * cipher/ecc-sm2.c (_gcry_ecc_sm2_encrypt): Fix point_init with NBITS.
126 Fix mpi_new with NBITS.
127 (_gcry_ecc_sm2_decrypt, _gcry_ecc_sm2_sign, _gcry_ecc_sm2_verify):
128 Likewise.
129 * cipher/ecc.c (nist_generate_key): Fix point_init with NBITS.
130 (test_keys): Likewise.
131 (test_ecdh_only_keys): Fix point_init and mpi_new with NBITS.
132 (check_secret_key): Likewise.
133 (ecc_generate): Fix mpi_new with NBITS.
134 (ecc_encrypt_raw): Fix mpi_new and point_init with NBITS.
135 (ecc_decrypt_raw): Fix point_init and mpi_new with NBITS.
136 (compute_keygrip): Fix mpi_new with NBITS.
137
138 2026-02-15 Jussi Kivilinna <[email protected]>
139
140 configure.ac: fix HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS on x32 targets.
141 + commit 722c5894ea8e08f668246add7332c2503d4b856c
142 * configure.ac (gcry_cv_compiler_defines__x86_64__): New.
143 (HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS): Enable if __x86_64__ macro is
144 defined by compiler and size of long is 4 (x32) or 8 (amd64).
145
146 2026-02-05 Rudi Heitbaum <[email protected]>
147
148 sexp: Fix for use of strchr wrt const qualifier.
149 + commit 581478c9ef9a77a0dd7c2abf6fe31cc35f730fe2
150 * src/misc.c (_gcry_log_printsxp): Use const char * for PEND.
151
152 cipher: remove unused variable idx in _gcry_pk_get_keygrip.
153 + commit b7ea9e3afc9fe9ee4e39e2663fbbe3ab5484eaea
154 * cipher/pubkey.c (_gcry_pk_get_keygrip): Remove IDX.
155
156 2026-02-03 NIIBE Yutaka <[email protected]>
157
158 mpi:ec: Don't modify POINT in _gcry_mpi_ec_get_affine.
159 + commit 949557945cf806dfbc646c8919a398ae637f7c25
160 * mpi/ec.c (_gcry_mpi_ec_get_affine): Don't modify POINT.
161
162 2026-02-01 Jussi Kivilinna <[email protected]>
163
164 rijndael-vaes-avx512: add PIC @PLT for AVX2 function jumps.
165 + commit 927850875c6254282697dbbed8aff65275bdeff5
166 * cipher/asm-common-amd64.h (AT_PLT): New.
167 * cipher/rijndael-vaes-avx512-amd64.S: Use AT_PLT for jumps to
168 AVX2/VAES functions.
169
170 2026-01-29 Werner Koch <[email protected]>
171
172 Release 1.12.0.
173 + commit efd5e1e7b4e7861b53eafdbf197fd6d4ff6f45e1
174 * configure.ac (NEED_GPG_ERROR_VERSION): Bump to 1.56
175
176 tests: Also distribute tests for RSA-PSS, Kyber and Dilithium.
177 + commit 2284db4553c3e469a7457811bbe68909f276691f
178 * tests/testdrv.c (testpgms): Add t-rsa-pss, t-mlda, and t-mlkem.
179 * tests/t-fips-service-ind.c (check_cipher_o_s_e_d_c): Fix printf
180 format.
181
182 tests: Fix building of testdrv-build.
183 + commit 12b067260d7866259af18ac302bf66bf6931c26f
184 * tests/Makefile.am (testdrv-build): Add -DPACKAGE_VERSION.
185
186 2026-01-21 NIIBE Yutaka <[email protected]>
187
188 fips,cipher: Fix the regression with disabled public-key algo.
189 + commit 2c1d41b5f86f93db56432616bc3ee704b9c9cc39
190 * cipher/pubkey.c (_gcry_pk_decrypt): Continue the computation when
191 marking non-compliant.
192 (_gcry_pk_encrypt): When disabled, return an error.
193 (_gcry_pk_sign, _gcry_pk_sign_md): Likewise.
194 (gcry_pk_verify, _gcry_pk_verify_md, _gcry_pk_testkey): Likewise.
195
196 2026-01-15 NIIBE Yutaka <[email protected]>
197
198 build: Apply local change to texinfo.tex.
199 + commit 85bbb33734362cdaaab46abd4b10b3200f026235
200 * build-aux/texinfo.tex: Fix typos.
201
202 2026-01-14 NIIBE Yutaka <[email protected]>
203
204 build: Update build-aux and m4 from libgpg-error.
205 + commit e53ae4f14f880ac73ade669c0ad6bd1a73883813
206 * build-aux/compile, build-aux/depcomp: Update.
207 * build-aux/ltmain.sh, build-aux/mdate-sh: Likewise.
208 * build-aux/missing, build-aux/texinfo.tex: Likewise.
209 * m4/libtool.m4, m4/ltoptions.m4: Likewise.
210 * m4/ltsugar.m4, m4/ltversion.m4, m4/lt~obsolete.m4: Likewise.
211 * m4/gpg-error.m4: Likewise.
212
213 2026-01-13 NIIBE Yutaka <[email protected]>
214
215 mpi: Use secure MPI in _gcry_mpi_assign_limb_space.
216 + commit 6e77b09cff56dd357cd2be332e3a2af200190382
217 * mpi/mpiutil.c (_gcry_mpi_assign_limb_space): Use secure memory
218 when destination is secure memory.
219
220 2026-01-02 Jussi Kivilinna <[email protected]>
221
222 rijndael: add VAES/AVX512 accelerated implementation.
223 + commit 9e3af928ee1100fc979a75dd4ae6a4ace2c36bef
224 * cipher/Makefile.am: Add 'rijndael-vaes-avx512-amd64.S'.
225 * cipher/rijndael-internal.h (USE_VAES_AVX512): New.
226 (RIJNDAEL_context_s) [USE_VAES_AVX512]: Add 'use_vaes_avx512'.
227 * cipher/rijndael-vaes-avx2-amd64.S
228 (_gcry_vaes_avx2_ocb_crypt_amd64): Minor optimization for aligned
229 blk8 OCB path.
230 * cipher/rijndael-vaes-avx512-amd64.S: New.
231 * cipher/rijndael-vaes.c [USE_VAES_AVX512]
232 (_gcry_vaes_avx512_cbc_dec_amd64, _gcry_vaes_avx512_cfb_dec_amd64)
233 (_gcry_vaes_avx512_ctr_enc_amd64)
234 (_gcry_vaes_avx512_ctr32le_enc_amd64)
235 (_gcry_vaes_avx512_ocb_aligned_crypt_amd64)
236 (_gcry_vaes_avx512_xts_crypt_amd64)
237 (_gcry_vaes_avx512_ecb_crypt_amd64): New.
238 (_gcry_aes_vaes_ecb_crypt, _gcry_aes_vaes_cbc_dec)
239 (_gcry_aes_vaes_cfb_dec, _gcry_aes_vaes_ctr_enc)
240 (_gcry_aes_vaes_ctr32le_enc, _gcry_aes_vaes_ocb_crypt)
241 (_gcry_aes_vaes_ocb_auth, _gcry_aes_vaes_xts_crypt)
242 [USE_VAES_AVX512]: Add AVX512 code paths.
243 * cipher/rijndael.c (do_setkey) [USE_VAES_AVX512]: Add setup for
244 'ctx->use_vaes_avx512'.
245 * configure.ac: Add 'rijndael-vaes-avx512-amd64.lo'.
246
247 rijndael-aesni: use assembly for moving first and last round key.
248 + commit d5cf2b90c7d081988c84e23a8f874562fba1d775
249 * cipher/rijndael-aesni.c (do_aesni_prepare_decryption): Use
250 assembly for moving first and last round keys for decryption.
251
252 rijndael-aesni: prevent inlining AESNI functions by LTO.
253 + commit 7afdbb2812b2fdeea7911f1f67e4079d4f6466e0
254 * cipher/rijndael-aesni.c (_gcry_aes_aesni_do_setkey)
255 (_gcry_aes_aesni_prepare_decryption, _gcry_aes_aesni_encrypt)
256 (_gcry_aes_aesni_ecb_crypt, _gcry_aes_aesni_cfb_enc)
257 (_gcry_aes_aesni_cbc_enc, _gcry_aes_aesni_ctr_enc)
258 (_gcry_aes_aesni_ctr32le_enc, _gcry_aes_aesni_decrypt)
259 (_gcry_aes_aesni_cfb_dec, _gcry_aes_aesni_cbc_dec)
260 (_gcry_aes_aesni_ocb_crypt, _gcry_aes_aesni_ocb_auth)
261 (_gcry_aes_aesni_xts_crypt): Mark function as noinline.
262
263 rijndael-riscv-zvkned: optimize do_prepare_decryption.
264 + commit 4c9d7a3ba939255d78320d887eb648410949071d
265 * cipher/rijndael-riscv-zvkned.c (do_prepare_decryption): Unroll
266 loop.
267
268 rijndael-riscv-zvkned: optimize aes192 key setup.
269 + commit ef372b484e0f0876a6657f5ca692c101b8c113bd
270 * cipher/rijndael-riscv-zvkned.c (AES192_KF1_GEN): Avoid use of
271 stack array for loading scalar value to vector register.
272
273 chacha20: avoid AVX512/AVX2/SSSE3 for single block processing with Zen5.
274 + commit c1d9fff3b2ebde8d54b29e2ad0dce75c74de73ba
275 * cipher/chacha20.c (CHACHA20_context_s): Add
276 'skip_one_block_hw_impl'.
277 (chacha20_blocks, do_chacha20_encrypt_stream_tail): Avoid single
278 block / non-parallel processing with AVX512/AVX2/SSSE3.
279
280 blake2: avoid AVX/AVX2/AVX512 when CPU has high vector inst latency.
281 + commit e5bc3b28260ef9967d713a75ad381ee7e97dcb88
282 * cipher/blake2.c (blake2b_init_ctx, blake2s_init_ctx): Disable
283 AVX/AVX2/AVX512 implementation if x86 CPU prefers GPR implementation
284 over scalar integer vector.
285 * src/hwf-common.h (hwf_x86_cpu_details)
286 (_gcry_hwf_x86_cpu_details): New.
287 * src/hwf-x86.c (x86_cpu_details, x86_hw_features)
288 (x86_detect_done, _gcry_hwf_x86_cpu_details): New.
289 (detect_x86_gnuc): Detect Zen5 and add 'cpu_details'.
290 (_gcry_hwf_detect_x86): Add 'x86_cpu_details' setup.
291
292 camellia-gfni-avx512: add 1-block constant-time implementation.
293 + commit 8b538a8c766922337c6c0718271e9399072518f3
294 * cipher/camellia-gfni-avx512-amd64.S
295 (_gcry_camellia_gfni_avx512_enc_blk1)
296 (_gcry_camellia_gfni_avx512_dec_blk1): New.
297 * cipher/camellia-glue.c [USE_GFNI_AVX512]
298 (_gcry_camellia_gfni_avx512_enc_blk1)
299 (_gcry_camellia_gfni_avx512_dec_blk1): New prototypes.
300 (camellia_decrypt, camellia_encrypt) [USE_GFNI_AVX512]: Use
301 GFNI/AVX512 1-block implementation if supported by CPU.
302
303 aria-x86_64: fixes for CFI markings.
304 + commit 861896b0fad8a7bac5c3ec303391d7b23ff22898
305 * cipher/aria-aesni-avx-amd64.S: Add missing CFI stack adjustments
306 after pushq/popq.
307 * cipher/aria-aesni-avx2-amd64.S: Likewise.
308 * cipher/aria-gfni-avx512-amd64.S: Likewise.
309
310 camellia-simd128: optimize round key loading and key setup.
311 + commit b9bafd6c6cc59ac65d0103f2fd3ccc4a4a24a325
312 * cipher/camellia-simd128.h (if_vprolb128, vprolb128)
313 (vmovd128_amemld, vmovq128_amemld, vmovq128_memld)
314 (memory_barrier_with_vec, filter_8bit_3op): New.
315 (LE64_LO32, LE64_HI32): Remove.
316 (roundsm16, fls16, inpack16_pre, outunpack16): Use 'vmovd128_amemld'
317 and 'vmovq128_amemld' for loading round keys.
318 (camellia_f): Optimize/Rewrite and split core to ...
319 (camellia_f_core): ... this.
320 (camellia_f_xor_x): New.
321 (sp0044440444044404mask, sp1110111010011110mask)
322 (sp0222022222000222mask, sp3033303303303033mask): Adjust constants
323 for optimized/rewritten 'camellia_f'.
324 (camellia_setup128, camellia_setup256): Adjust for optimized
325 'camellia_f'; Use 'vmovq128_amemld' for loading round keys.
326 (FUNC_KEY_SETUP): Use 'vmovq128_amemld' instead of 'vmovq128'.
327
328 camellia-aesni-avx: optimize camellia_f used for key setup.
329 + commit f5848080d41a6d706c881fcde0dd47390f609802
330 * cipher/camellia-aesni-avx-amd64.S (split_nibbles)
331 (filter_8bit_nibbles): New.
332 (filter_8bit): Refactor.
333 (transpose_8x8b): Remove.
334 (camellia_f, camellia_f_core): Refactor.
335 (.Lsbox4_input_mask): Remove.
336 (__camellia_avx_setup128, __camellia_avx_setup256): Adjust for new
337 'camellia_f'.
338
339 2025-12-12 NIIBE Yutaka <[email protected]>
340
341 mpi:ec: Fix for use of ec_mulm_lli in _gcry_mpi_ec_get_affine.
342 + commit 92bbe34514ee180c074b882d8459cdf6b873ba0c
343 * mpi/ec.c (_gcry_mpi_ec_get_affine): Resize X and Y. Add
344 GCRYECC_FLAG_LEAST_LEAK flag.
345
346 w32: Fix use of GetProcAddress.
347 + commit 028926d3edb52ac2ea6bfabf92748c323265a1d7
348 * src/hwfeatures.c (_gcry_get_sysconfdir): Add a type cast.
349
350 2025-12-04 NIIBE Yutaka <[email protected]>
351
352 build: Add support for IBM z/OS, fixing -lpthread check with glibc.
353 + commit 5af59d8454cea0231b622ee3ded6f4ead16d05b0
354 * configure.ac: Care about PRINTABLE_OS_NAME for IBM z/OS.
355 Handle have_pthread for IBM z/OS.
356 No check with -lpthread when we know about have_pthread.
357
358 2025-12-02 Sachin T <[email protected]>
359
360 Add support for IBM z/OS.
361 + commit 550b2e2f13df95d8d8371181a6a606a0c062107d
362 * m4/libtool.m4: Add openedition* case.
363 * mpi/longlong.h: Exclude s390x GCC assembly on z/OS.
364 * src/secmem.c (lock_pool_pages): Allow !HAVE_MLOCK on z/OS.
365
366 2025-11-27 Werner Koch <[email protected]>
367
368 w32: Use CSIDL_COMMON_APPDATA instead of /etc.
369 + commit d5e3cbfd8845a872d39f468da27a443cea4587e2
370 * src/hwfeatures.c [W32]: Include shlobj.h
371 (_gcry_get_sysconfdir): New.
372 (get_hwf_deny_file): New. Use this instead of the HWF_DENY_FILE
373 macro.
374 * src/fips.c (get_fips_force_file): New. Use this instead of
375 FIPS_FORCE_FILE.
376 (_gcry_initialize_fips_mode) [W32]: Do not parse files under "/proc".
377 * random/random.c (get_random_conf_file): New. Use instead of
378 RANDOM_CONF_FILE macro.
379
380 2025-11-25 NIIBE Yutaka <[email protected]>
381
382 cipher:kyber: Apply a change from upstream.
383 + commit bdc3724d721dfd65fdd8cad311855461f9a101c1
384 * cipher/kyber-kdep.c (crypto_kem_dec): Fix the buffer size.
385
386 2025-11-20 Gary Lin <[email protected]>
387
388 kdf: Avoid redundant memcpy()
389 + commit 670646bbf185587c7de039430d71a38b7f0f8597
390 * cipher/kdf.c (fill_block): Xor 'ref_block' and 'prev_block' directly
391 to avoid a redundant memcpy().
392
393 2025-11-19 NIIBE Yutaka <[email protected]>
394
395 mpi: Introduce mpi_tfr and use it for point_tfr.
396 + commit 4e65996bb8707c890bff7aeb6e1ec44610b49257
397 * mpi/ec.c (point_tfr): New.
398 (mpi_ec_mul_point_lli): Use point_tfr.
399 * mpi/mpiutil.c (_gcry_mpi_tfr): New.
400 * src/mpi.h (mpi_tfr): New.
401 (_gcry_mpi_tfr): New.
402
403 2025-10-29 NIIBE Yutaka <[email protected]>
404
405 secmem: Handle HAVE_BROKEN_MLOCK for the case with ASAN.
406 + commit fe06287003a153d358f2ddb62ce5d1ec112b2e5c
407 * src/secmem.c [HAVE_BROKEN_MLOCK] (lock_pool_pages): Take care when
408 build with address sanitizer.
409
410 random:jent: Fix build with address sanitizer.
411 + commit def1d4ea8f66abf23ef0def6d8d34060e1ee923e
412 * random/jitterentropy-base.c (jent_entropy_collector_alloc_internal):
413 Annotate with gpgrt_annotate_leaked_object.
414
415 2025-10-23 NIIBE Yutaka <[email protected]>
416
417 random:jent: Fix for jent_rng_is_initialized.
418 + commit 0ceca9993f5a94389624f6cf12e07165cd2391e4
419 * random/rndjent.c (_gcry_rndjent_poll): Set jent_rng_is_initialized
420 after successful initialization.
421 (_gcry_rndjent_fini): Clear jent_rng_is_initialized.
422
423 2025-09-30 Jussi Kivilinna <[email protected]>
424
425 Add stack burning for PQC algorithms.
426 + commit 1003c9412a4be0c1d248929267a73cf3849fa60b
427 * cipher/dilithium.h (DILITHIUM_KEYPAIR_STACK_BURN)
428 (DILITHIUM_SIGN_STACK_BURN, DILITHIUM_VERIFY_STACK_BURN): New.
429 * cipher/kem.c (_gcry_kem_genkey, _gcry_kem_encap)
430 (_gcry_kem_decap): Burn stack after calls to sntrup761, kyber and
431 mceliece6688128f algos.
432 * cipher/kyber.h (KYBER_KEYPAIR_STACK_BURN, KYBER_ENCAP_STACK_BURN)
433 (KYBER_DECAP_STACK_BURN): New.
434 * cipher/mceliece6688128f.h (MCELIECE6688128F_KEYPAIR_STACK_BURN)
435 (MCELIECE6688128F_ENC_STACK_BURN, MCELIECE6688128F_DEC_STACK_BURN): New.
436 * cipher/pubkey-dilithium.c (mldsa_generate, mldsa_sign)
437 (mldsa_verify): Burn stack after calls to dilithium algo.
438 * cipher/sntrup761.h (SNTRUP761_KEYPAIR_STACK_BURN)
439 (SNTRUP761_ENC_STACK_BURN, SNTRUP761_DEC_STACK_BURN): New.
440
441 const-time: add 64-bit fast paths for const-time buffer functions.
442 + commit 11e8f4a8de263d9199479b290b8550e6a6ecc619
443 * src/const-time.c (_gcry_ct_not_memequal, _gcry_ct_memequal): Add
444 64-bit processing for larger than 7 byte inputs.
445
446 2025-09-28 Jussi Kivilinna <[email protected]>
447
448 mceliece6688128f: use const-time helper for memory comparison.
449 + commit 4c253746e52020254ede4f41d0440b41ca3aa8ec
450 * cipher/mceliece6688128f.c (sync_cmp): Use const-time helper for
451 comparison.
452
453 mceliece6688128f: harden mask generation against branch optimization.
454 + commit 4012e9a037c5bf9f296ca89a6e94bb3600ec0d35
455 * cipher/mceliece6688128f.c (crypto_int64_negative_mask)
456 (crypto_int16_negative_mask, crypto_int32_negative_mask)
457 (crypto_uint64_signed_negative_mask, crypto_uint16_signed_negative_mask)
458 (crypto_uint32_signed_negative_mask, mask_nonzero, mask_leq, vec_cmov)
459 (layer, gen_e, gf_mul, same_mask, pk_gen): Generate masks with
460 const-time helper function.
461 * src/const-time.h (ct_u64_gen_mask, ct_u64_gen_inv_mask): New.
462
463 sntrup761: use const-time helpers for memory comparison and cond move.
464 + commit 4e963e91dbe55b23ed0da2003c2de053c40f4c9a
465 * cipher/sntrup761.c (Ciphertexts_diff_mask): Use
466 '_gcry_ct_not_memequal' for checking if arrays are different.
467 (sntrup761_dec): Use '_gcry_ct_memmov_cond' for conditionally setting
468 'r_enc'.
469
470 sntrup761: harden mask generation against branch optimization.
471 + commit bf7546c5028b0c740c4a7a7142de17bcee588e58
472 * cipher/sntrup761.c (int32_MINMAX, uint32_divmod_uint14)
473 (int32_divmod_uint14, int16_t_nonzero_mask, int16_t_negative_mask)
474 (Ciphertexts_diff_mask): Generate mask with const-time helper function.
475
476 kyber: harden mask generation against branch optimization.
477 + commit 052b03fb0c6edea1a208ca0abb31ad09a86aa8e7
478 * cipher/kyber-kdep.c (polyvec_compress, polyvec_compress): Generate
479 mask with const-time helper function.
480
481 mpih-pow: harden condition calculation against branch optimization.
482 + commit 96534d8c26c6c146482996cf120050e493b267c2
483 * mpi/mpih-pow.c (mont_reduc): Pass condition code through mask
484 generator to avoid optimization to branch by certain compilers.
485
486 cipher-xts: harden mask generation against branch optimization.
487 + commit ee5cb3833d5b649ca360ab2bbde5ffaa28cbb717
488 * cipher/cipher-xts.c (xts_gfmul_byA): Generate mask with const-time
489 helper.
490
491 rijndael: harden mask generation against branch optimization.
492 + commit f6b7a40f23c62a45ec1285388a5336c5cf313222
493 * cipher/rijndael.c (do_setkey): Generate 'rcon' mask with const-time
494 helper.
495 (_gcry_aes_xts_crypt): Generate tweak mask with const-time helper.
496
497 mceliece6688128f: fix stack overflow crash on win64/wine.
498 + commit 5bd932017116f0edf49641d56382356b4c5c876e
499 * cipher/mceliece6688128f.c (pk_gen): Remove 'mat' array allocation and
500 rename function to ...
501 (pk_gen_mat): ... this.
502 (pk_gen): New wrapper for 'pk_gen_mat' with dynamic allocation of 'mat'
503 array.
504
505 2025-09-27 Jussi Kivilinna <[email protected]>
506
507 t-kem: add info print for each algoritm.
508 + commit 593525b4ce43db885068b4b968f70a609fe7edf2
509 * tests/t-kem.c (test_kem_sntrup761, test_kem_mceliece6688128f)
510 (test_kem_mlkem512, test_kem_mlkem768, test_kem_mlkem1024, test_kem_raw_x25519)
511 (test_kem_dhkem_x25519): Add 'Checking <algo>' info print.
512
513 2025-09-25 Jussi Kivilinna <[email protected]>
514
515 hwfeatures: restore "intel-fast-vpgather" as dummy entry.
516 + commit d2ec4e84b40a29564f1b0a7491993e35e92b6466
517 * src/hwfeatures.c (hwflist) [HAVE_CPU_ARCH_X86]: Add "intel-fast-vpgather"
518 HW feature string without mapping to any HWF flag.
519
520 2025-09-24 Jussi Kivilinna <[email protected]>
521
522 mceliece6688128f: fix UBSAN runtime errors.
523 + commit a786e3b6bf8cdc29aaa209b6528cf9b455677e1a
524 * cipher/mceliece6688128f.c (cbrecursion): Fix left shift of signed integer
525 by too many places, by casting to unsigned integer before shift.
526 (syndrome): Fix misaligned memory loads by using 'bufhelp.h'.
527
528 configure.ac: perform RISC-V vector crypto intrinsics bug checks without LTO
529 + commit 5c9ce0cc51d9fdbd8d859756a26ab42c8a89333a
530 * configure.ac (gcry_cv_riscv_vsha2cl_intrinsics_work)
531 (gcry_cv_riscv_vaes_vs_intrinsics_work): Run check with '-fno-lto' compiler
532 flag.
533
534 hwf-x86: remove unused HWF_INTEL_FAST_VPGATHER.
535 + commit 2bbbaca1824055d20975029a733ce84d8be5b297
536 * cipher/twofish-avx2-amd64.S (RNOT): Update comment on usage of this register
537 macro.
538 * doc/gcrypt.texi: Remove 'intel-fast-vpgather'.
539 * src/g10lib.h (HWF_INTEL_FAST_VPGATHER): Remove.
540 (HWF_INTEL_RDTSC, HWF_INTEL_SHAEXT, HWF_INTEL_VAES_VPCLMUL, HWF_INTEL_AVX512)
541 (HWF_INTEL_GFNI): Shift bit position to close the gap left by FAST_VPGATHER
542 removal.
543 * src/hwf-x86.c (detect_x86_gnuc): Remove HWF_INTEL_FAST_VPGATHER detection.
544 * src/hwfeatures.c (hwflist): Remove 'intel-fast-vpgather'.
545
546 2025-09-23 Werner Koch <[email protected]>
547
548 tests: Add helper option --exec to testdrv.
549 + commit 276fe34410ccea1a48abc38f773d83b756b1c76c
550 * tests/testdrv.c (main): Add options --exec and --version.
551 (my_spawn): Remove DETACHED_PROCESS flag.
552
553 2025-09-17 Jussi Kivilinna <[email protected]>
554
555 t-kem: fix test loop iteration.
556 + commit 9f26fa62ee73ea4bac6b3fd28e50be811ff27f24
557 * tests/t-kem.c (check_kem): Reset loop iterator for each algo test loop.
558
559 hwfeature: fix "riscv-zvkg" HW feature mapping.
560 + commit 561b2ffbeb632c9bfe135003209a05393018e745
561 * src/hwfeatures.c (hwflist) [HAVE_CPU_ARCH_RISCV]: Fix mapping from
562 ZVKNED to ZVKG for "riscv-zvkg".
563
564 2025-08-20 Jussi Kivilinna <[email protected]>
565
566 cipher-gcm-riscv-zbb-zbc: add POLYVAL acceleration.
567 + commit 00815c4207a151b5aea6591a4befbcdb832edc34
568 * cipher/cipher-gcm-riscv-zbb-zbc.c (_gcry_ghash_riscv_zbb_zbc): Rename to ...
569 (ghash_polyval_riscv_zbb_zbc): ... this; Add 'is_polyval' argument.
570 (_gcry_ghash_riscv_zbb_zbc): New.
571 (ghash_polyval_riscv_zbb_zbc): New.
572 * cipher/cipher-gcm.c [GCM_USE_RISCV_ZBB_ZBC]
573 (ghash_polyval_riscv_zbb_zbc): New.
574 (setupM) [GCM_USE_RISCV_ZBB_ZBC]: Add setup for 'c->u_mode.gcm.polyval_fn'.
575
576 Require RISC-V B extension for vector intrinsics implementations.
577 + commit 729794458fc731fcecd168785c56ada69c800c2a
578 * cipher/Makefile.am (riscv_vector_cflags, riscv_vector_crypto_aes_cflags)
579 (riscv_vector_crypto_sha_cflags, riscv_vector_crypto_gcm_cflags): Use
580 MARCH_RVA22U64_WITH_VEC and MARCH_RVA23U64_BASE.
581 * cipher/chacha20.c (chacha20_do_setkey) [USE_RISCV_V]: Require HWF_RISCV_B.
582 * cipher/cipher-gcm.c (setupM) [GCM_UNSE_RISCV_ZVKG]: Likewise.
583 * cipher/rijndael.c (do_setkey) [USE_RISCV_V_CRYPTO]: Likewise.
584 (do_setkey) [USE_VP_RISCV]: Likewise.
585 * cipher/sha256.c (sha256_common_init) [USE_RISCV_V_CRYPTO]: Likewise.
586 * cipher/sha512.c (sha512_init_common) [USE_RISCV_V_CRYPTO]: Likewise.
587 * doc/gcrypt.texi: Document riscv-imafdc, riscv-b, riscv-v, riscv-zbb,
588 riscv-zbc, riscv-zvkb, riscv-zvkg, riscv-zvkned, riscv-zvknha and
589 riscv-zvknhb as supported hardware features.
590 * configure.ac (MARCH_RVA22U64_WITH_VEC, MARCH_RVA23U64_BASE)
591 (MARCH_RVA23U64_WITH_VEC_CRYPTO): New.
592 * src/g10lib.h (HWF_RISCV_B): Insert before HWF_RISCV_V.
593 * src/hwf-riscv.c (hwcap_features, hwprobe_features): Add HWF_RISCV_V.
594 (detect_riscv_hwf_by_toolchain) [__riscv_zba&&__riscv_zbb&&__riscv_zbs]: Add
595 faulty toolchain check for B extension.
596 * src/hwfeatures.c (hwflist) [HAVE_CPU_ARCH_RISCV]: Add "riscv-b".
597
598 2025-08-16 Jussi Kivilinna <[email protected]>
599
600 Add RISC-V Zbb+Zbc implementation of CRC.
601 + commit ab4fa2a19c9fb900e7864eb0a64656aa093f0ecb
602 * cipher/Makefile.am: Add 'crc-riscv-zbb-zbc.c'.
603 * cipher/crc-riscv-zbb-zbc.c: New.
604 * cipher/crc.c (USE_RISCV_ZBB_ZBC): New.
605 (CRC_CONTEXT) [USE_RISCV_ZBB_ZBC]: Add 'use_riscv_zbc'.
606 [USE_RISCV_ZBB_ZBC] (_gcry_crc32_riscv_zbb_zbc)
607 (_gcry_crc24rfc2440_riscv_zbb_zbc): New.
608 (crc32_init): Rename to ...
609 (generic_crc32_init): ... this; Add 'init_value' parameter.
610 (generic_crc32_init) [USE_RISCV_ZBB_ZBC]: Add HW feature check for RISC-V
611 Zbb+Zbc implementation.
612 (crc24rfc2440_init) [USE_RISCV_ZBB_ZBC]: Likewise.
613 (crc32_init, crc32rfc1510_init): Use 'generic_crc32_init'.
614 (crc32_write) [USE_RISCV_ZBB_ZBC]: Add RISC-V Zbb+Zbc implementation.
615 (crc24rfc2440_write) [USE_RISCV_ZBB_ZBC]: Likewise.
616 * configure.ac: Add 'crc-riscv-zbb-zbc.lo'.
617
618 Add RISC-V vector cryptography implementation of GHASH.
619 + commit cc2a4b63889ea1b33bdeafd8bf5f31a424d4dfc0
620 * cipher/Makefile.am: Add 'cipher-gcm-riscv-zvkg.c'.
621 * cipher/cipher-gcm-riscv-zbb-zbc.c: Fix cipher-internal.h include.
622 * cipher/cipher-gcm-riscv-zvkg.c: New.
623 * cipher/cipher-gcm.c [GCM_USE_RISCV_ZVKG] (_gcry_ghash_setup_riscv_zvkg)
624 (_gcry_ghash_riscv_zvkg, _gcry_polyval_riscv_zvkg): New.
625 (setupM) [GCM_USE_RISCV_ZVKG]: Add setup for Zvkg implementation.
626 * cipher/cipher-internal.h (GCM_USE_RISCV_ZVKG): New.
627 * configure.ac: Add 'cipher-gcm-riscv-zvkg.lo'.
628 (GCRY_RISCV_VECTOR_CRYPTO_INTRINSICS_TEST): Add check for Zvkg instrinsic.
629 * src/g10lib.h (HWF_RISCV_ZVKG): Insert before HWF_RISCV_ZVKNED.
630 * src/hwdf-riscv.h (HWF_RISCV_HWPROBE_EXT_ZVKG): New.
631 (hwprobe_features): Add HWF_RISCV_ZVKG.
632 * src/hwfeatures.c (hwflist) [HAVE_CPU_ARCH_RISCV]: Add "riscv-zvkg".
633
634 2025-08-12 NIIBE Yutaka <[email protected]>
635
636 mpi: Fix redefinition of types.
637 + commit 85927387741fad2aba4f8cc01e3b10ff4ff4c57f
638 * mpi/mpi-internal.h (mpi_ptr_t): Remove, as it moved to mpi.h.
639 (mpi_size_t): Likewise.
640
641 2025-08-09 Jussi Kivilinna <[email protected]>
642
643 Add RISC-V vector cryptography implementation of AES.
644 + commit b000ab602531b2c29e93736afc1686dea8ed6782
645 * cipher/Makefile.am: Add 'rijndael-riscv-zvkned.c'.
646 * cipher/rijndael-internal.h (USE_RISCV_V_CRYPTO): New.
647 * cipher/rijndael-riscv-zvkned.c: New.
648 * cipher/rijndael.c [USE_RISCV_V_CRYPTO]
649 (_gcry_aes_riscv_zvkned_setup_acceleration, _gcry_aes_riscv_zvkned_setkey)
650 (_gcry_aes_riscv_zvkned_prepare_decryption)
651 (_gcry_aes_riscv_zvkned_encrypt, _gcry_aes_riscv_zvkned_decrypt)
652 (_gcry_aes_riscv_zvkned_cfb_enc, _gcry_aes_riscv_zvkned_cbc_enc)
653 (_gcry_aes_riscv_zvkned_ctr_enc, _gcry_aes_riscv_zvkned_ctr32le_enc)
654 (_gcry_aes_riscv_zvkned_cfb_dec, _gcry_aes_riscv_zvkned_cbc_dec)
655 (_gcry_aes_riscv_zvkned_ocb_crypt, _gcry_aes_riscv_zvkned_ocb_auth)
656 (_gcry_aes_riscv_zvkned_ecb_crypt, _gcry_aes_riscv_zvkned_xts_crypt): New.
657 (do_setkey) [USE_RISCV_V_CRYPTO]: Add setup for RISC-V vector cryptography
658 extension implementation.
659 * configure.ac: Add 'rijndael-riscv-zvkned.lo'.
660 (GCRY_RISCV_VECTOR_CRYPTO_INTRINSICS_TEST): Add AES intrinsics.
661 (gcry_cv_riscv_vaes_vs_intrinsics_work, HAVE_BROKEN_VAES_VS_INTRINSIC): New.
662 * src/g10lib.h (HWF_RISCV_ZVKNED): Insert before HWF_RISCV_ZVKNHA.
663 * src/hwf-riscv.c (HWF_RISCV_HWPROBE_EXT_ZVKNED): New.
664 (hwprobe_features): Add Zvkned.
665 * src/hwfeatures.c (hwflist): Add "riscv-zvkned".
666
667 2025-08-07 Jussi Kivilinna <[email protected]>
668
669 riscv: always use -mstrict-align for vector intrinsic implementations.
670 + commit 79149be2b0bac5b62dd333e0deff86dec170d6af
671 * cipher/Makefile.am (riscv_vector_cflags, riscv_vector_crypto_cflags): Use
672 "-mstrict-align" if SUPPORT_CC_RISCV_MSTRICT_ALIGN is set.
673 * configure.ac (SUPPORT_CC_RISCV_MSTRICT_ALIGN): Add check for "-mstrict-align"
674 compiler flag support.
675
676 Add RISC-V vector cryptography implementations of SHA256 and SHA512.
677 + commit cc1d5b0b5ed30d4c36edbea128a6ab825d15415e
678 * cipher/Makefile.am: Add 'sha256-riscv-zvknha-zvkb.c' and
679 'sha512-riscv-zvknhb-zvkb.c'.
680 * cipher/sha256-riscv-zvknha-zvkb.c: New.
681 * cipher/sha256.c (USE_RISCV_V_CRYPTO): New.
682 [USE_RISCV_V_CRYPTO] (_gcry_sha256_riscv_v_check_hw)
683 (_gcry_sha256_transform_riscv_zvknha_zvkb)
684 (do_sha256_transform_riscv_zvknha): New.
685 (sha256_common_init) [sha256_common_init]: Enable new implementation
686 if supported by HW.
687 * cipher/sha512-riscv-zvknhb-zvkb.c: New.
688 * cipher/sha512.c (USE_RISCV_V_CRYPTO): New.
689 [USE_RISCV_V_CRYPTO] (_gcry_sha512_riscv_v_check_hw)
690 (_gcry_sha512_transform_riscv_zvknhb_zvkb)
691 (do_sha512_transform_riscv_zvknhb): New.
692 (sha512_common_init) [sha512_common_init]: Enable new implementation
693 if supported by HW.
694 * configure.ac: Add 'sha256-riscv-zvknha-zvkb.lo' and
695 'sha512-riscv-zvknhb-zvkb.lo'.
696 (GCRY_RISCV_VECTOR_INTRINSICS_TEST): New.
697 (gcry_cv_cc_riscv_vector_intrinsics)
698 (gcry_cv_cc_riscv_vector_intrinsics_cflags): Move test code to new
699 macro GCRY_RISCV_VECTOR_INTRINSICS_TEST.
700 (GCRY_RISCV_VECTOR_CRYPTO_INTRINSICS_TEST)
701 (gcry_cv_cc_riscv_vector_crypto_intrinsics)
702 (gcry_cv_cc_riscv_vector_crypto_intrinsics_cflags)
703 (gcry_cv_riscv_vsha2cl_intrinsics_work): New.
704 * src/g10lib.h [HAVE_CPU_ARCH_RISCV] (HWF_RISCV_ZVKB, HWF_RISCV_ZVKNHA)
705 (HWF_RISCV_ZVKNHB): New.
706 * src/hwf-riscv.c (HWF_RISCV_HWPROBE_EXT_ZVKB)
707 (HWF_RISCV_HWPROBE_EXT_ZVKNHA, HWF_RISCV_HWPROBE_EXT_ZVKNHB): New.
708 * src/hwfeatures.c (hwflist) [HAVE_CPU_ARCH_RISCV]: Add "riscv-zvkb",
709 "riscv-zvknha" and "riscv-zvknhb".
710
711 bithelp: fix __riscv_zbb check for _gcry_ctz_no_zero.
712 + commit ca951abe818e26b8cefb11329f249213bc35b8d8
713 * cipher/bithelp.h (_gcry_ctz_no_zero): Fix __riscv_zbb version check.
714
715 rijndael-vp: clean-ups.
716 + commit 788e40f888032407c9001e1e54e7acc19db3f23d
717 * cipher/rijndael-vp-riscv.c: Remove "./" from "cipher-internal.h" include.
718 * cipher/rijndael-vp-simd128.h (aes_simd128_xts_enc, aes_simd128_xts_dec): Make
719 these functions static.
720
721 configure.ac: deduplicate intrinsics test code.
722 + commit 9001f098680ab1a365380974b7f183ecb756a026
723 * configure.ac (gcry_cv_cc_aarch64_neon_intrinsics)
724 (gcry_cv_cc_aarch64_neon_intrinsics_cflags): Move test source code
725 to new macro GCRY_AARCH64_NEON_INTRINSICS_TEST.
726 (gcry_cv_cc_ppc_altivec, gcry_cv_cc_ppc_altivec_cflags):
727 Move test source code to new macro GCRY_POWERPC_VECTOR_INTRINSICS_TEST.
728
729 crc-intel-pclmul: add AVX2 and AVX512 code paths.
730 + commit c30788969d3f2760933eb8e7bf1271c8e010b6d1
731 * cipher/crc-intel-pclmul.c (crc32_consts_s, crc32_consts)
732 (crc24rfc2440_consts): Add k_ymm and k_zmm.
733 (crc32_reflected_bulk, crc32_bulk): Add VPCLMUL+AVX2 and VAES_VPCLMUL+AVX512
734 code paths; Add 'hwfeatures' parameter.
735 (_gcry_crc32_intel_pclmul, _gcry_crc24rfc2440_intel_pclmul): Add 'hwfeatures'
736 parameter.
737 * cipher/crc.c (CRC_CONTEXT) [USE_INTEL_PCLMUL]: Add 'hwfeatures'.
738 (_gcry_crc32_intel_pclmul, _gcry_crc24rfc2440_intel_pclmul): Add 'hwfeatures'
739 parameter.
740 (crc32_init, crc32rfc1510_init, crc24rfc2440_init) [USE_INTEL_PCLMUL]: Store
741 HW features to context.
742
743 2025-07-30 Jussi Kivilinna <[email protected]>
744
745 poly1305-p10le: use '.rodata' section for read-only data.
746 + commit 0c2d120e1124ee491712bbf93329c50a5b4d287f
747 * cipher/poly1305-p10le.s: Change '.data' section to '.rodata'.
748
749 Add missing abiversion tag for PowerPC assembly.
750 + commit 5cdb3b08fdd44c70ba9d771d2135e296c7d95e2d
751 * cipher/chacha20-p10le-8x.s: Add abiversion tag.
752 * cipher/poly1305-p10le.s: Likewise.
753 * configure.ac (gcry_cv_gcc_inline_asm_ppc_altivec)
754 (gcry_cv_gcc_inline_asm_ppc_arch_3_00): Likewise.
755
756 Add missing machine tags for PowerPC assembly.
757 + commit 660ed722aed20f274daf6972930b9714cacef2fb
758 * cipher/chacha20-p10le-8x.s: Add "any" machine tag.
759 * cipher/poly1305-p10le.s: Likewise.
760 * configure.ac (gcry_cv_gcc_inline_asm_ppc_altivec)
761 (gcry_cv_gcc_inline_asm_ppc_arch_3_00): Likewise.
762
763 2025-07-30 NIIBE Yutaka <[email protected]>
764
765 mpi: Provide the function prototype of __udiv_qrnnd.
766 + commit b61a7661d017c37bbc867a61a75213986954796b
767 * mpi/longlong.h [__alpha] (__udiv_qrnnd): Add the prototype.
768 [__hppa] (__udiv_qrnnd): Likewise.
769 [__sparc__] (__udiv_qrnnd): Likewise.
770
771 2025-07-21 Jussi Kivilinna <[email protected]>
772
773 blake2s-avx512: mark merged load as such.
774 + commit 41c3747ebec07d8572668d231524666698c3b563
775 * cipher/blake2s-amd64-avx512.S (GATHER_MSG_8): Add comment
776 on 'vmovq' that it is merged load.
777
778 blake2s-avx512: remove duplicate load.
779 + commit 0c48dcaad7554e16b1c233fc7c0176612f1c768c
780 * cipher/blake2s-amd64-avx512.S (GATHER_MSG_3): Remove
781 duplicate load which is already handled with 'vmovdqu32'
782 earlier.
783
784 2025-07-04 NIIBE Yutaka <[email protected]>
785
786 cipher:ecc: Silence GCC 15 warning.
787 + commit f06e90f4137a3dfaead69c21a8993c3530e0d913
788 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_ensure_compact): Initialize
789 ENC and ENCLEN before use.
790
791 cipher:gcm: Minor fix for buffer size.
792 + commit e414699f5da7b54665c5496487beb68b753514f2
793 * cipher/cipher-internal.h (struct gcry_cipher_handle): Use
794 GCRY_GCM_BLOCK_LEN.
795
796 2025-07-03 NIIBE Yutaka <[email protected]>
797
798 cipher:kem: Provide each enum constant as macro.
799 + commit e9b1c3ec91a17c62f46e6ffd5909d0ed95a89121
800 src/gcrypt.h.in (GCRY_KEM_CM6688128F, GCRY_KEM_DHKEM25519)
801 (GCRY_KEM_DHKEM448, GCRY_KEM_DHKEMP256R1, GCRY_KEM_DHKEMP384R1)
802 (GCRY_KEM_DHKEMP521R1, GCRY_KEM_RAW_BP256, GCRY_KEM_RAW_BP384)
803 (GCRY_KEM_RAW_BP512, GCRY_KEM_RAW_MLKEM512, GCRY_KEM_RAW_MLKEM768)
804 (GCRY_KEM_RAW_MLKEM1024, GCRY_KEM_RAW_P256K1, GCRY_KEM_RAW_P256R1)
805 (GCRY_KEM_RAW_P384R1, GCRY_KEM_RAW_P521R1, GCRY_KEM_RAW_X25519)
806 (GCRY_KEM_RAW_X448, GCRY_KEM_SNTRUP761): New defines.
807
808 cipher:rsa: Fix missing initialization in generate_fips.
809 + commit 292cb75a723c74b79ccd482c48620bd5f75c9e2e
810 * cipher/rsa.c (generate_fips): Initialize E, P and Q.
811
812 build: More changes to allow build with no Kyber.
813 + commit d9acecb02a90f8a746d7a9349782a08b014c82ba
814 * cipher/Makefile.am (libcipher_la_SOURCES): Move kyber.c and kyber.h
815 to ...
816 (EXTRA_libcipher_la_SOURCES): ... here.
817 * cipher/kem.c: [USE_KYBER]: Only include kyber.h when USE_KYBER.
818 (_gcry_kem_genkey, _gcry_kem_encap, _gcry_kem_decap): [USE_KYBER]:
819 Enable Kyber when USE_KYBER.
820 * tests/keygen.c (check_kem_keys): [USE_KYBER]: Enable Kyber when
821 USE_KYBER.
822
823 2025-07-02 NIIBE Yutaka <[email protected]>
824
825 build: Allow build with no Kyber.
826 + commit f2b7d7862ff91457966b7f14ce92bf15655766cd
827 * configure.ac (GCRYPT_PUBKEY_CIPHERS): It's kyber.lo.
828 * tests/Makefile.am (tests_bin): [USE_KYBER]: Add t-mlkem only when
829 USE_KYBER.
830 * tests/t-kem.c: Allow building with no Kyber.
831
832 tests: Add a test for Dilithium.
833 + commit 95beae48241222336c5060a5969adb9b14afe25e
834 * tests/Makefile.am (tests_bin) [USE_DILITHIUM]: Add t-mldsa.
835 (EXTRA_DIST): Add t-mldsa.inp.
836 * tests/t-mldsa.c: New.
837 * tests/t-mldsa.inp: New.
838
839 cipher:dilithium: Support "no-prefix" flag for Dilithium testing.
840 + commit 0a1fda8ce4d0111bd33049d87653985b5ef99b6f
841 * src/cipher.h (PUBKEY_FLAG_NO_PREFIX): New.
842 * cipher/pubkey-dilithium.c (mldsa_sign, mldsa_verify): Support
843 PUBKEY_FLAG_NO_PREFIX.
844 * cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist): Support
845 PUBKEY_FLAG_NO_PREFIX.
846
847 cipher:dilithium: Add ML-DSA into libgcrypt pubkey interface.
848 + commit 40c84d8a4c764631e50384d7d2a1898a88fe3c4f
849 * configure.ac (available_pubkey_ciphers): Add dilithium.
850 (USE_DILITHIUM): New.
851 * cipher/Makefile.am (EXTRA_libcipher_la_SOURCES): Add
852 pubkey-dilithium.c.
853 * cipher/pubkey-dilithium.c: New.
854 * cipher/pubkey.c (pubkey_list): Add _gcry_pubkey_spec_mldsa.
855 * src/cipher.h (_gcry_pubkey_spec_mldsa): New.
856 * src/gcrypt-int.h (enum gcry_mldsa_algos): New.
857 * src/gcrypt.h.in (GCRY_PK_MLDSA): New.
858
859 cipher:dilithium: Add dilithium functions for libgcrypt internal use.
860 + commit 81a8332963e2a5581ee0e7d0393363e8b9015bbf
861 * cipher/dilithium.c (dilithium_keypair, dilithium_sign)
862 (dilithium_verify): New.
863 * cipher/dilithium.h: Likewise.
864
865 2025-07-01 NIIBE Yutaka <[email protected]>
866
867 cipher:dilithium: List the dilithium implementation to Makefile.am.
868 + commit bef89f9316c8f37c4806f757e9f38fc478fcc8db
869 * cipher/Makefile.am (EXTRA_DIST): Add dilithium-common.c and
870 dilithium-dep.c.
871 (EXTRA_libcipher_la_SOURCES): Add dilithium.c and dilithium.h.
872
873 cipher:dilithium: Don't include unused freeze function.
874 + commit aeb775adfafd4520b1d67c5fc58f1e4c50ee174d
875 * cipher/dilithium-common.c (freeze): Remove.
876 * cipher/dilithium.c (freeze): Remove.
877
878 cipher:dilithium: Have cipher/dilithium.h.
879 + commit cce9c02988c25f98b3097310963586bd3033f224
880 * cipher/dilithium.h: New.
881 * cipher/dilithium-common.c: Add static qualifier to functions.
882 * cipher/dilithium-dep.c: Move function delclarations from
883 dilithium.c and add undef-s.
884 * cipher/dilithium.c: Support use of DILITHIUM_MODE.
885
886 cipher:dilithium: Add DILITHIUM_INTERNAL_API_ONLY.
887 + commit f78099b5a022b417aeea324ff94fdd2a1e5bf5b9
888 * cipher/dilithium-dep.c (crypto_sign_keypair_internal): New.
889 (crypto_sign_signature) [DILITHIUM_INTERNAL_API_ONLY]: Don't define.
890 (crypto_sign) [DILITHIUM_INTERNAL_API_ONLY]: Don't define.
891 (crypto_sign_verify) [DILITHIUM_INTERNAL_API_ONLY]: Don't define.
892 (crypto_sign_open) [DILITHIUM_INTERNAL_API_ONLY]: Don't define.
893 * cipher/dilithium.c: Define DILITHIUM_INTERNAL_API_ONLY for use
894 within libgcrypt.
895
896 cipher:dilithium: For _GCRYPT_IN_LIBGCRYPT, add *_close function.
897 + commit 92f129fb9ddc7b076a1942983f593869264ea8d5
898 * cipher/dilithium-common.c (poly_uniform): Add stream128_close.
899 (poly_uniform_eta_2, poly_uniform_eta_4): Add stream256_close.
900 (poly_uniform_gamma1_17, poly_uniform_gamma1_19): Likewise.
901 * cipher/dilithium-dep.c (poly_challenge): Add shake256_close.
902 (crypto_sign_signature_internal): Likewise.
903 (crypto_sign_verify_internal): Likewise.
904 * cipher/dilithium.c [_GCRYPT_IN_LIBGCRYPT]: Add glue code
905 for shake128_* and shake256_*.
906
907 cipher:dilithium: Functions of poly for different DILITHIUM_MODE.
908 + commit 28fb2e30790b07882b7ac2f5ccacd09e4e70de9c
909 * cipher/dilithium-common.c (decompose): Make it into...
910 (decompose_88, decompose_32): ... these two functions.
911 (make_hint): Make it into...
912 (make_hint_88, make_hint_32): ... these two functions.
913 (use_hint): Make it into...
914 (use_hint_88, use_hint_32): ... these two functions.
915 (poly_decompose): Make it into...
916 (poly_decompose_88, poly_decompose_32): ... these two functions.
917 (poly_make_hint): Make it into...
918 (poly_make_hint_88, poly_make_hint_32): ... these two functions.
919 (poly_use_hint): Make it into...
920 (poly_use_hint_88, poly_use_hint_32): ... these two functions.
921 (rej_eta): Make it into...
922 (rej_eta_2, rej_eta_4): ... these two functions.
923 (poly_uniform_eta): Make it into...
924 (poly_uniform_eta_2, poly_uniform_eta_4): ... these two functions.
925 (POLY_UNIFORM_ETA_NBLOCKS): Make it into...
926 (POLY_UNIFORM_ETA_NBLOCKS_2, POLY_UNIFORM_ETA_NBLOCKS_4): ... these
927 two macros.
928 (poly_uniform_gamma1): Make it into...
929 (poly_uniform_gamma1_17, poly_uniform_gamma1_19): ... these two
930 functions.
931 (POLY_UNIFORM_GAMMA1_NBLOCKS): Make it into...
932 (POLY_UNIFORM_GAMMA1_NBLOCKS_17, POLY_UNIFORM_GAMMA1_NBLOCKS_19):
933 ... these two macros.
934 (polyeta_pack): Make it into...
935 (polyeta_pack_2, polyeta_pack_4): ... these two functions.
936 (polyeta_unpack): Make it into...
937 (polyeta_unpack_2, polyeta_unpack_4): ... these two functions.
938 (polyz_pack): Make it into...
939 (polyz_pack_17, polyz_pack_19): ... these two functions.
940 (polyz_unpack): Make it into...
941 (polyz_unpack_17, polyz_unpack_19): ... these two functions.
942 (polyw1_pack): Make it into...
943 (polyw1_pack_88, polyw1_pack_32): ... these two functions.
944
945 cipher:dilithium: Fix comment style.
946 + commit a0bd76300f606c9b2d9a5720ed4643f89e90db8b
947 * cipher/dilithium.c: Fix comments.
948
949 cipher:dilithium: Make the implementation into three files.
950 + commit 5cbf3180533dd84fb74c32e22e2f8fcecab90532
951 * cipher/dilithium-common.c: New. Common part.
952 * cipher/dilithium-dep.c: New. DILITHIUM_MODE dependent part.
953 * cipher/dilithium.c: Move functions and variables to two files.
954
955 cipher:dilithium: Export the external API only.
956 + commit cc7d750be1c71c05f5e9fa0439edbc6dabff4410
957 * cipher/dilithium.c: Don't export other functions.
958
959 2025-06-28 NIIBE Yutaka <[email protected]>
960
961 cipher: Editorial clean up cipher/dilithium.c for headers.
962 + commit cb15a5563ade6828312311682ddbdc0e5ae1eb6e
963 * cipher/dilithium.c: Clean up.
964
965 cipher: Add headers to the Dilithium implementation.
966 + commit a7fdda036591dd9022e58b6613e25b23c8d9a50f
967 * cipher/dilithium.c: Add headers from the reference implementation.
968
969 cipher: Put the original Dilithium implementation.
970 + commit 1b422366e2b3b5438713418b50f8a0a1abf8d365
971 * cipher/dilithium.c: Add the Dilithium reference implementation into
972 one file.
973
974 2025-06-26 NIIBE Yutaka <[email protected]>
975
976 tests:common: Increse buffer size to allow input for PQC testing.
977 + commit b945002e44ce79227599e723fc1faa961494062b
978 * tests/t-common.h (read_textline): Increase the buffer size.
979
980 2025-06-25 NIIBE Yutaka <[email protected]>
981
982 cipher:kem:ecc: Support secp256k1 by KEM API.
983 + commit 10c0ce88ba3fbba6b04ee6ded9d0f6ae15171d6b
984 * src/gcrypt.h.in (GCRY_KEM_RAW_P256K1): New.
985 * cipher/kem-ecc.c (algo_to_curve, algo_to_seckey_len): Support
986 GCRY_KEM_RAW_P256K1.
987
988 2025-06-24 NIIBE Yutaka <[email protected]>
989
990 cipher: Support random-override with PUBKEY_FLAG_BYTE_STRING.
991 + commit cbefff5fcaa66dbd6ee652a9a5bc376b86d44d30
992 * cipher/pubkey-util.c (_gcry_pk_util_init_encoding_ctx): Initialize
993 RND and RNDLEN field.
994 (_gcry_pk_util_free_encoding_ctx): Release memory by RND field.
995 (_gcry_pk_util_data_to_mpi): Support optional "random-override".
996 * src/cipher.h (struct pk_encoding_ctx): Add RND and RNDLEN.
997
998 cipher: Add PUBKEY_FLAG_BYTE_STRING to support byte string data.
999 + commit 3bb4a54f43876a169ce16b62bd73742374370db4
1000 * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi): Add support for
1001 PUBKEY_FLAG_BYTE_STRING.
1002 * src/cipher.h (PUBKEY_FLAG_BYTE_STRING): New.
1003
1004 2025-05-19 Collin Funk <[email protected]>
1005
1006 Fix missing simd-common-riscv.h in libgcrypt tarball.
1007 + commit b100dd25eb6821d58851c2b802bfe9ef2f441228
1008 * cipher/Makefile.am (EXTRA_libcipher_la_SOURCES): Add
1009 simd-common-riscv.h.
1010
1011 2025-05-13 NIIBE Yutaka <[email protected]>
1012
1013 mpi:ec: Least leak with k^(-1) for ECDSA.
1014 + commit 0bd4c77be6e04f5c8734926234742c3a2bb8fb18
1015 * src/mpi.h (_gcry_mpi_assign_limb_space): Add.
1016 (_gcry_mpih_mod_lli, _gcry_mpih_mul_lli): Add.
1017 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_sign): Take care
1018 about least leak with k^(-1).
1019
1020 mpi:ec: Use ec_mulm_lli in _gcry_mpi_ec_get_affine.
1021 + commit aa089ec89badcd74817e5008c66036b1e28674f5
1022 * mpi/ec.c (_gcry_mpi_ec_get_affine): Fix for possible leak.
1023
1024 2025-05-12 Paul Eggert <[email protected]>
1025
1026 Fix ungrammatical use of "allow to"
1027 + commit 93034d649124841a962e6e832afe4675d99abb7a
1028
1029
1030 2025-05-12 Collin Funk via Gcrypt-devel <[email protected]>
1031
1032 Remove occurrences of old FSF postal address.
1033 + commit 67b8da4ef62734927e061327efa9a6f48616d114
1034 * COPYING: Update to latest from Gnulib.
1035 * COPYING.LIB: Likewise.
1036 * doc/gpl.texi: Likewise.
1037 * doc/lgpl.texi: Likewise.
1038 * cipher/scrypt.c: Link to gnu.org instead of mentioning the old FSF
1039 address.
1040
1041 2025-05-03 Collin Funk <[email protected]>
1042
1043 tests: Fix link errors for t-thread-local.
1044 + commit 793eda7b258a562757b51c96044b103b638f1a63
1045 On platforms where pthread_create is not in libc t-thread-local fails to
1046 link. Issue found on NetBSD 10.0.
1047 * tests/Makefile.am (t_thread_local_LDADD): Add $(standard_ldadd),
1048 $(GPG_ERROR_MT_LIBS), and @LDADD_FOR_TESTS_KLUDGE@.
1049 (t_thread_local_CFLAGS): Add $(GPG_ERROR_MT_CFLAGS).
1050
1051 cipher:aria: Fix compiler error on NetBSD.
1052 + commit df684aca7407a4179771d79b5ef04ef8e4bedcc6
1053 * cipher/aria.c (bswap32): Remove function that conflicts with system
1054 definitions on NetBSD.
1055 (aria_diff_byte): Use _gcry_bswap32.
1056
1057 2025-04-21 NIIBE Yutaka <[email protected]>
1058
1059 Mark nonstring use cases with __nonstring__ attribute.
1060 + commit d5fb7cd9b3512ef5326638bb8930583fad127882
1061 * src/gcrypt.h.in (_GCRY_GCC_ATTR_NONSTRING): New.
1062 * cipher/chacha20.c (chacha20_keysetup): Use _GCRY_GCC_ATTR_NONSTRING.
1063 * cipher/cipher-gcm-siv.c (gcm_siv_selftest): Likewise.
1064 * cipher/ecc.c (compute_keygrip): Likewise.
1065 * cipher/serpent.c (serpent_test): Likewise.
1066 * tests/basic.c (check_aes128_cbc_cts_cipher): Likewise.
1067 (_check_gcm_cipher, check_gcm_siv_cipher): Likewise.
1068 (check_ocb_cipher_largebuf_split, check_ocb_cipher_checksum): Likewise.
1069 * tests/keygrip.c (key_grips): Likewise.
1070
1071 2025-04-08 NIIBE Yutaka <[email protected]>
1072
1073 mpi:ec: Set GCRYECC_FLAG_LEAST_LEAK, calling mpi_ec_mul_point_lli.
1074 + commit 32f848ef9dca726a0bfe1b895b93880522938aab
1075 * mpi/ec.c (_gcry_mpi_ec_mul_point): Enable GCRYECC_FLAG_LEAST_LEAK
1076 when calling mpi_ec_mul_point_lli.
1077
1078 2025-04-07 Jussi Kivilinna <[email protected]>
1079
1080 mpi/ec-nist: fix NIST-P224 failing on 32-bit architectures.
1081 + commit e34aa59b014eba6fd56d789e1b066c050f1e149a
1082 * mpi/ec-nist.c (_gcry_mpi_ec_nist224_mod): Set output size
1083 based on bit per limb.
1084
1085 2025-03-28 NIIBE Yutaka <[email protected]>
1086
1087 mpi:ec: Introduce ec_*_lli for Weierstrass curves to be less leaky.
1088 + commit d1c471c78d6f045a2ec53fd7bdc10308b6305096
1089 * mpi/ec.c (ec_addm_lli, ec_subm_lli, ec_mulm_lli): New.
1090 (dup_point_weierstrass_lli): New, using ec_*_lli.
1091 (add_points_weierstrass_a): Use ec_*_lli.
1092 (mpi_ec_mul_point_lli): Use dup_point_weierstrass_lli.
1093 Remove mpi_point_resize.
1094
1095 mpi:ec: Don't normalize the MPIs when GCRYECC_FLAG_LEAST_LEAK.
1096 + commit 4f56fd8c5e03f389a9f27a5e9206b9dfb49c92e3
1097 * mpi/ec-nist.c (_gcry_mpi_ec_nist192_mod): Don't do MPN_NORMALIZE
1098 when GCRYECC_FLAG_LEAST_LEAK.
1099 (_gcry_mpi_ec_nist224_mod): Likewise.
1100 (_gcry_mpi_ec_nist256_mod): Likewise.
1101 (_gcry_mpi_ec_nist384_mod): Likewise.
1102 (_gcry_mpi_ec_nist521_mod): Likewise.
1103 * mpi/ec.c (ec_mod): Keep ->NLIMBS when GCRYECC_FLAG_LEAST_LEAK.
1104
1105 mpi:ec: Use affine coordinate for mpi_ec_mul_point_lli.
1106 + commit 0680408b37515db8437e18d6d2a1e973155b6565
1107 * mpi/ec.c (add_points_weierstrass_a, add_points_edwards_a): New.
1108 (mpi_ec_mul_point_lli): Use those routines directly.
1109
1110 2025-03-27 NIIBE Yutaka <[email protected]>
1111
1112 mpi:ec: Resize when GCRYECC_FLAG_LEAST_LEAK.
1113 + commit 794b8e7378e84c344a0629af61b1154f8830aca4
1114 * mpi/ec.c (ec_p_init): Also resize when GCRYECC_FLAG_LEAST_LEAK.
1115
1116 cipher:ecc: Introduce GCRYECC_FLAG_LEAST_LEAK.
1117 + commit 6419bd17f034bb7dad17bbd6c1f90c4c28cc4348
1118 * src/cipher.h (GCRYECC_FLAG_LEAST_LEAK): New.
1119 * cipher/ecc.c (ecc_generate): Use GCRYECC_FLAG_LEAST_LEAK.
1120 (ecc_check_secret_key, ecc_sign, ecc_decrypt_raw): Likewise.
1121
1122 mpi:ec: Refactor _gcry_mpi_ec_mul_point.
1123 + commit 5e3dbfb8233d5849e5031c527aefed1ff460089c
1124 * mpi/ec.c (montgomery_mul_point, mpi_ec_mul_point_lli): Factor out
1125 from _gcry_mpi_ec_mul_point.
1126 (_gcry_mpi_ec_mul_point): Use montgomery_mul_point and
1127 mpi_ec_mul_point_lli.
1128
1129 mpi:ec: Keep A untouched in ec_get_a_is_pminus3.
1130 + commit d698ed5386e8e3be43296e77938f513261523503
1131 * mpi/ec.c (ec_get_a_is_pminus3): Change the calculation
1132 so that it keeps the MPI of A untouched.
1133
1134 mpi:ec: Use ec_addm for ec_mul2.
1135 + commit 38cdb7fecc80c7f834bdd4fdc77e37f73ca8149f
1136 * mpi/ec.c (ec_mul2): Use ec_addm.
1137
1138 mpi:ec: Remove runtime check in ec_mod.
1139 + commit 16c6936c811a3af4c53ddd9526eac61569c436d0
1140 * mpi/ec-inline.h (mpi_nbits_more_than): Remove.
1141 * mpi/ec-nist.c (_gcry_mpi_ec_nist192_mod): Remove
1142 runtime check for the size of W.
1143 (_gcry_mpi_ec_nist224_mod): Likewise.
1144 (_gcry_mpi_ec_nist256_mod): Likewise.
1145 (_gcry_mpi_ec_nist384_mod): Likewise.
1146 (_gcry_mpi_ec_nist521_mod): Likewise.
1147 (ec_secp256k1_mod): Likewise.
1148
1149 2025-03-23 Jussi Kivilinna <[email protected]>
1150
1151 t-mpi-point: fix test failing in FIPS mode.
1152 + commit 058c2fab9aa8e0fda62f29ad0bbe253313d5c810
1153 * tests/t-mpi-point.c (point_on_curve): Skip non-NIST test-vectors
1154 in FIPS mode.
1155
1156 2025-03-21 NIIBE Yutaka <[email protected]>
1157
1158 mpi:ec: Use ec_addm to multiply with small integer.
1159 + commit 17d5d3262c148cf6b1e1040052984bca7169b064
1160 * mpi/ec.c (dup_point_weierstrass): Use ec_addm instead of ec_mulm for
1161 small integer.
1162
1163 mpi:ec: Use mpi_set_ui in _gcry_mpi_ec_mul_point.
1164 + commit 191c2340c4a6cdb35208d4cf78f4a399bcf2af8f
1165 * mpi/ec.c (_gcry_mpi_ec_mul_point): mpi_set_ui to initialize 1.
1166
1167 mpi:ec: Avoid use mpi_const.
1168 + commit 522566b15a31a5352bb1605d3e4622e770cb7e59
1169 * mpi/ec.c (_gcry_mpi_ec_mul_point): Use mpi_mul_ui.
1170 (_gcry_mpi_ec_curve_point): Use mpi_mul_ui and mpi_add_ui.
1171 Don't use mpi_const.
1172 * tests/t-mpi-point.c (point_on_curve): Add Curve25519.
1173
1174 mpi:ec: Don't use mpi_powm for small exponent.
1175 + commit 5052efed9f540add726bf604fbf70ee6a608b101
1176 * mpi/ec.c (ec_pow3): Remove.
1177 (_gcry_mpi_ec_curve_point): Don't use ec_pow3.
1178 (dup_point_weierstrass): Use ec_pow2 twice for Z^4.
1179 (add_points_weierstrass): Don't use ec_powm.
1180
1181 mpi:ec: Remove the minor optimization for the case of Z==1.
1182 + commit 53993003db9b9e90b518318ddb3bc67e61aa2735
1183 * mpi/ec.c (add_points_weierstrass): Always multiply with Z^2.
1184
1185 2025-03-13 NIIBE Yutaka <[email protected]>
1186
1187 doc: Add about GCRYCTL_FIPS_SERVICE_INDICATOR.
1188 + commit 636f40cb78587635ef663bfc3430937cf140f245
1189 * doc/gcrypt.texi (GCRYCTL_FIPS_SERVICE_INDICATOR): Add a description.
1190 (GCRYCTL_FIPS_REJECT_NON_FIPS): Likewise.
1191
1192 fips: Fix GCRY_FIPS_FLAG_REJECT_MD.
1193 + commit b9eb8f4cb81801d68580627ad2188607a8c5f2ec
1194 * src/gcrypt.h.in (GCRY_FIPS_FLAG_REJECT_MD): Include SHA1.
1195
1196 2025-03-11 NIIBE Yutaka <[email protected]>
1197 Lucas Mulling <[email protected]>
1198
1199 md: Make SHA-1 non-FIPS internally for 1.12 API.
1200 + commit 4ee91a94bcdad32aed4364d09e3daf8841fa579f
1201 * src/gcrypt.h.in (GCRY_FIPS_FLAG_REJECT_MD_SHA1): New.
1202 * cipher/md.c (check_digest_algo_spec, _gcry_md_open, md_enable)
1203 (_gcry_md_enable, md_copy): Care about SHA1.
1204 * cipher/sha1.c (_gcry_digest_spec_sha1): Make SHA1 non-FIPS.
1205 * tests/t-fips-service-ind.c (check_mac_o_w_r_c): SHA1 is non-FIPS.
1206 (check_md_o_w_r_c, check_hash_buffer, check_hash_buffers): Likewise.
1207 (main): Add GCRY_FIPS_FLAG_REJECT_MD_SHA1 for gcry_control.
1208
1209 2025-03-06 NIIBE Yutaka <[email protected]>
1210
1211 mpi: Use const-time modular exponentiation on 64-bit arch.
1212 + commit 71d17c0b4c01728aec2b587a85a60354ba67f354
1213 * mpi/mpi-pow.c (USE_ALGORITHM_LLI_EXPONENTIATION): Enable on 64-bit.
1214 * src/global.c (print_config): Fix to "mpi-powm".
1215
1216 cipher,fips: Fix for random-override.
1217 + commit ca8bf05e111b41e482a2a4b34cda6bcf5aa1f27e
1218 * cipher/pubkey-util.c (gcry_pk_util_data_to_mpi): Keep
1219 the behavior of 1.10.
1220 * src/visibility.c (gcry_pk_random_override_new): Likewise.
1221 * tests/t-fips-service-ind.c (main): Use GCRY_FIPS_FLAG_REJECT_PK_FLAGS.
1222
1223 2025-03-06 Lucas Mulling via Gcrypt-devel <[email protected]>
1224
1225 cipher,visibility: Differentiate use of random-override in the SLI.
1226 + commit 234eb316b0a04c50e8511a570775ded45060f18b
1227 * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi,
1228 _gcry_pk_single_data_push, _gcry_pk_util_free_encoding_ctx):
1229 Differentiate use of random-override in the SLI.
1230 * src/visibility.c (gcry_pk_random_override_new):
1231 Differentiate use explicit random override in the SLI.
1232
1233 2025-03-06 NIIBE Yutaka <[email protected]>
1234
1235 cipher,ecc: Fix for supplied K.
1236 + commit 755e6dce727915249cbb1a98f22832d940b99c24
1237 * cipher/ecc.c (ecc_sign): Check if it's under FIPS mode.
1238 (ecc_verify): Supplied K does no sense for verification, but add
1239 comment of clarification mark/reject-ing under FIPS mode.
1240
1241 fips,cipher: Add GCRY_FIPS_FLAG_REJECT_PK_FLAGS.
1242 + commit 0414e126b939f0b11ecf441908d923e87c1caf02
1243 * src/gcrypt.h.in (GCRY_FIPS_FLAG_REJECT_PK_FLAGS): New.
1244 * cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist): Keep the
1245 behavior of 1.10.
1246 * cipher/rsa.c (rsa_decrypt, rsa_sign): Likewise.
1247
1248 2025-03-05 Lucas Mulling via Gcrypt-devel <[email protected]>
1249
1250 cipher: Differentiate no-blinding flag in the SLI.
1251 + commit cc0a40bd74120dc06fd80f163b30abb91f60b63b
1252 * cipher/rsa.c (rsa_decrypt, rsa_encrypt): Differentiate use of flag
1253 no-blinding in the service level indicator.
1254
1255 cipher: Differentiate igninvflag in the SLI.
1256 + commit 3bdb59c21b77711cf7d44d692a7a02f5f469033e
1257 * cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist): Differentiate use
1258 of igninvflag.
1259
1260 2025-03-04 Lucas Mulling via Gcrypt-devel <[email protected]>
1261
1262 cipher: Differentiate use of label K in the SLI.
1263 + commit 2f6d2db1a4c28775a568c1f81ca127d2daebaf1c
1264 * cipher/ecc.c (ecc_sign, ecc_verify): Use of label K is not allowed in
1265 fips mode, differentiate with the GCRY_FIPS_FLAG_REJECT_PK_ECC_K flag.
1266 * src/gcrypt.h.in: New GCRY_FIPS_FLAG_REJECT_PK_ECC_K.
1267 * tests/t-fips-service-ind.c (check_pk_hash_sign_verify): Mark non
1268 compliant use of label.
1269
1270 cipher: Add KAT for non-rfc6979 ECDSA with fixed k.
1271 + commit be57179f42f8a7cb64f72f73ccea753400573b4f
1272 * cipher/ecc.c (run_selftests): Implement KAT for non-deterministic
1273 ECDSA.
1274 * cipher/ecc. (rfc6979_ecdsa_sample_data, rfc6979_ecdsa_sample_data_bad,
1275 rfc6979_ecdsa_data_tmpl): New.
1276
1277 2025-03-04 NIIBE Yutaka <[email protected]>
1278
1279 tests: Allow tests with !USE_RSA.
1280 + commit 8404a048b7c58eb903717e09cffaa7735f7d8520
1281 * tests/t-fips-service-ind.c [USE_RSA] (check_pk_s_v): Ifdef-out.
1282
1283 fips,cipher: Do the computation when marking non-compliant.
1284 + commit 54a6617b3679cfeb6d986ddf3c9c73641929f02c
1285 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_sign): Continue the computation
1286 when marking non-compliant.
1287 * cipher/pubkey.c (_gcry_pk_encrypt, _gcry_pk_sign): Likewise.
1288 (_gcry_pk_sign_md, _gcry_pk_verify, _gcry_pk_verify_md): Likewise.
1289 (_gcry_pk_testkey): Likewise.
1290
1291 2025-02-26 NIIBE Yutaka <[email protected]>
1292
1293 tests: Update t-fips-service-ind using GCRY_MD_SHA256 for KDF tests.
1294 + commit e5989e08a556117ec3f19f098765963358b71051
1295 * tests/t-fips-service-ind.c (check_kdf_derive): Use GCRY_MD_SHA256.
1296
1297 md: Use check_digest_algo_spec in _gcry_md_selftest.
1298 + commit ce4755d5c5500cede6d7d380fdab2d15f5d77796
1299 * cipher/md.c (check_digest_algo_spec): New.
1300 (check_digest_algo): Use check_digest_algo_spec.
1301 (_gcry_md_selftest): Likewise.
1302
1303 md: Fix gcry_md_algo_info to mark/reject under FIPS mode.
1304 + commit 2f17a98a80b155e750ab77d4703e33612e545d58
1305 * cipher/md.c (check_digest_algo): Fix for marking non-compliance.
1306 * src/visibility.c (gcry_md_algo_info): Add check with
1307 fips_is_operational.
1308
1309 2025-02-25 NIIBE Yutaka <[email protected]>
1310
1311 cipher:rsa: Mark/reject SHA1/unknown with RSA signature generation.
1312 + commit 60e5039793c2474d29ded039cf1a6b8107733a20
1313 * cipher/rsa-common.c (_gcry_rsa_pkcs1_encode_raw_for_sig): We can't
1314 determine if it's compliant when raw PKCS1 encoding is used.
1315 (_gcry_rsa_pss_encode): Add the behavior of marking non-compliant use.
1316 (_gcry_rsa_pss_verify): Likewise.
1317 * cipher/rsa.c (rsa_sign): Handle the check for SHA1.
1318 (rsa_verify): Likewise.
1319 * tests/t-fips-service-ind.c (check_pk_s_v): Add use cases for RSA
1320 and Ed25519.
1321
1322 Revert "md: Make SHA1 non-FIPS and differentiate in the SLI"
1323 + commit 1e815a00c302921adb9b41b372a8f6f908e23620
1324 This reverts commit 13a71215c255377863b0154ac602c86fe5450c49.
1325
1326 cipher:(EC)DSA: Simply use mpi_clear_highbit in _gcry_dsa_gen_k.
1327 + commit 54caef02afa90ad43d70f5772cd5550bb2055555
1328 * cipher/dsa-common.c (_gcry_dsa_gen_k): Use mpi_clear_highbit.
1329
1330 mpi: Avoid normalizing MPI in _gcry_mpi_invm.
1331 + commit c1da86e45a6e9c462cdb511c4c9c7fd375da1303
1332 * mpi/mpi-inv.c (_gcry_mpi_invm): Use _gcry_mpih_cmp_ui.
1333
1334 2025-02-20 NIIBE Yutaka <[email protected]>
1335
1336 cipher,mpi: Expose some MPI helper functions by mpi.h.
1337 + commit 88ae76d069c331ad947ecab8419df9a00f979b0e
1338 * cipher/dsa-common.c: Don't include mpi-internal.h.
1339 * mpi/mpi-inline.h (_gcry_mpih_add_lli): Move this to ...
1340 * src/mpi.h (_gcry_mpih_add_lli): ... here.
1341 (_gcry_mpih_rshift, _gcry_mpih_add_n_cond): Add.
1342 (_gcry_mpih_cmp_ui, _gcry_mpih_cmp_lli): Add.
1343 (_gcry_mpih_add_n): Add.
1344 * mpi/mpi-internal.h (_gcry_mpih_cmp_ui, _gcry_mpih_cmp_lli): Remove.
1345
1346 2025-02-19 NIIBE Yutaka <[email protected]>
1347
1348 mpi: Fix _gcry_mpih_add_lli, as macro.
1349 + commit bd53c51b03383ade2b63132d0034a75ab526c546
1350 * mpi/mpi-inline.h (_gcry_mpih_add_lli): Use _gcry_mpih_add_n.
1351 * mpi/mpi-internal.h (_gcry_mpih_add_lli): Remove.
1352 * mpi/mpih-const-time.c (_gcry_mpih_add_lli): Remove.
1353
1354 2025-02-18 NIIBE Yutaka <[email protected]>
1355
1356 mpi: Add MPI helper modular exponentiation, Least Leak Intended.
1357 + commit 2039d93289dbc1a90089466390777c756660ba5a
1358 * mpi/Makefile.am (libmpi_la_SOURCES): Add mpih-pow.c.
1359 * mpi/mpi-internal.h (_gcry_mpih_powm_lli): New.
1360 * mpi/mpi-pow.c (_gcry_mpi_get_powm_config): New.
1361 (USE_ALGORITHM_LLI_EXPONENTIATION): New, enabled as default.
1362 [USE_ALGORITHM_LLI_EXPONENTIATION] (_gcry_mpi_powm): Call
1363 _gcry_mpih_powm_lli when it's on secure memory.
1364 * mpi/mpih-pow.c (_gcry_mpih_powm_lli): New.
1365 * src/gcrypt-int.h (_gcry_mpi_get_powm_config): New.
1366 * src/global.c (print_config): Call _gcry_mpi_get_powm_config.
1367
1368 mpi: Add MPH helper of table lookup, Least Leak Intended.
1369 + commit 8fd2aab881c733a29c26459ed1d1d7f234728314
1370 * mpi/mpi-internal.h (ct_limb_select): New.
1371 (_gcry_mpih_lookup_lli): New.
1372 * mpi/mpih-const-time.c (_gcry_mpih_lookup_lli): New.
1373
1374 cipher:(EC)DSA: Fix _gcry_dsa_gen_*k not to normalize MPI.
1375 + commit bb5e893456b10c8a4fa336a281bf3008c0f9eb5e
1376 * cipher/dsa-common.c (_gcry_dsa_gen_k): Use _gcry_mpih_cmp_lli
1377 and _gcry_mpih_cmp_ui.
1378 (_gcry_dsa_gen_rfc6979_k): Likewise.
1379
1380 cipher:(EC)DSA: Avoid MPI normalize by mpi_rshift.
1381 + commit 0b794c208db39d959f8f532bc9920daefa853d2a
1382 * cipher/dsa-common.c (_gcry_dsa_gen_rfc6979_k): Use
1383 _gcry_mpi_set_buffer and _gcry_mpih_rshift, instead of _gcry_mpi_scan
1384 and mpi_rshift.
1385
1386 cipher:(EC)DSA: Fix _gcry_dsa_modify_k to least leak.
1387 + commit d05cdb31689a45733751393a819a71c7c3386675
1388 * cipher/dsa-common.c (_gcry_dsa_modify_k): Use _gcry_mpih_add_lli.
1389
1390 2025-02-17 NIIBE Yutaka <[email protected]>
1391
1392 mpi: Add _gcry_mpih_add_lli.
1393 + commit 58e72af4eac4711993191919b6890b5ebb554acc
1394 * mpi/mpi-internal.h (_gcry_mpih_add_lli): New.
1395 * mpi/mpih-const-time.c (_gcry_mpih_add_lli): New.
1396
1397 2025-02-17 NIIBE Yutaka <[email protected]>
1398 Jussi Kivilinna <[email protected]>
1399
1400 mpi: Add _gcry_mpih_cmp_lli, Least Leak Intended.
1401 + commit 459a6c9c81ee28ddf5baa9fe47f3138fd34334d5
1402 * mpi/mpi-internal.h (_gcry_mpih_cmp_lli): New.
1403 * mpi/mpih-const-time.c (_gcry_mpih_cmp_lli): New.
1404
1405 mpi: Add _gcry_mpih_add_1_lli as Least Leak Intended.
1406 + commit 06de5bc277532d1ef42b81464af81d2a22b90ad4
1407 * mpi/mpi-inline.h (_gcry_mpih_add_1_lli): New.
1408
1409 2025-02-14 Lucas Mulling <[email protected]>
1410
1411 md: Make SHA1 non-FIPS and differentiate in the SLI.
1412 + commit 13a71215c255377863b0154ac602c86fe5450c49
1413 * cipher/md.c (_gcry_md_open, md_enable, _gcry_md_enable, md_copy):
1414 Differentiate SHA1.
1415 * cipher/sha1.c (_gcry_digest_spec_sha1): Make SHA1 not FIPS.
1416 * src/fips.c (_gcry_fips_indicator_mac, _gcry_fips_indicator_md,
1417 run_digest_selftests, run_mac_selftests): Differentiate SHA1.
1418 * src/gcrypt.h.in (GCRY_FIPS_FLAG_REJECT_MD_SHA1): New.
1419 * tests/basic.c: (check_pubkey_sign): Use sha256 for baddata, add
1420 FLAG_NOFIPS to non FIPS compliant tests that use SHA1, and improve error
1421 messages.
1422 * tests/pkcs1v2.c (main): Skip tests in FIPS mode.
1423 * tests/t-fips-service-ind.c (check_kdf_derive): Use sha256 as pbkdf2
1424 subalgo.
1425 * tests/t-fips-service-ind.c (check_mac_o_w_r_c): Check for rejection of
1426 SHA1 test cases if in FIPS mode.
1427
1428 2025-02-13 Jussi Kivilinna <[email protected]>
1429
1430 mpih-const-time: fix return value for _gcry_mpih_cmp_ui.
1431 + commit 957ac97097d0960a621ea1ea9f751b422afa8949
1432 * mpi/mpih-const-time.c (_gcry_mpih_cmp_ui): Return '1' when
1433 upper part of MPI is not all zeros.
1434 * tests/mpitests.c (test_invm_cmpui, test_invm): Add tests
1435 for gcry_mpi_invm().
1436
1437 2025-02-12 Lucas Mulling <[email protected]>
1438
1439 cipher: Don't differentiate GCRY_CIPHER_MODE_CMAC in FIPS mode.
1440 + commit 608ff4b2261e2d8961f0ef4189e74b1173b2802c
1441 * cipher/cipher.c (_gcry_cipher_mode_fips_compliance): Allow
1442 GCRY_CIPHER_MODE_CMAC in fips mode.
1443 * cipher/cipher.c (cipher_modes_fips_compliance)
1444 (cipher_int_modes_fips_compliance): New.
1445
1446 cipher: Rename _gcry_cipher_is_mode_fips_compliant.
1447 + commit 6b0fbb7e5e0da77787e3a87d74359ee21c44904e
1448 * cipher/cipher.c (_gcry_cipher_is_mode_fips_compliant): Rename to
1449 _gcry_cipher_mode_fips_compliance for better clarity and change the
1450 return type to gcry_err_code_t.
1451 * cipher/cipher.c (_gcry_cipher_mode_fips_compliance): Use
1452 gcry_cipher_modes instead of int for mode.
1453 * tests/t-fips-service-ind.c (check_cipher_o_s_e_d_c): Fix typo in fail.
1454
1455 2025-02-11 Jussi Kivilinna <[email protected]>
1456
1457 mpi/longlong: prevent optimization of carry instructions to branches.
1458 + commit dd480b1e797463f71a7e69e9509833ff7a923bd6
1459 * mpi/longlong.h: Include "const-time.h"
1460 (add_ssaaaa, sub_ddmmss): Prevent optimization of carry handling to
1461 conditional branches in generic variant of double width addition and
1462 subtraction as was seen with GCC on riscv64.
1463 (umul_ppmm): Avoid conditional branch in generic 16x16=>32bit
1464 multiplication version of umul_ppmm.
1465 * src/const-time.h (CT_DEOPTIMIZE_VAR): New.
1466
1467 mpih-const-time: avoid branches in _gcry_mpih_cmp_ui.
1468 + commit 9c658cc8214f277d43b18d722bbc316972802d47
1469 * mpi/mpih-const-time.c (_gcry_mpih_cmp_ui): Avoid conditional
1470 branches for return value selection.
1471
1472 2025-02-06 NIIBE Yutaka <[email protected]>
1473
1474 Fix _gcry_dsa_modify_k.
1475 + commit 35a6a6feb9dcd0f4650a0fe73eb2581f481602c6
1476 * cipher/dsa-common.c (_gcry_dsa_modify_k): Don't use ! to negate the
1477 logical value.
1478
1479 2025-02-03 NIIBE Yutaka <[email protected]>
1480
1481 mpi: Rename _gcry_mpih_mod as the one of Least Leak Intended.
1482 + commit ff6c905bea7b2fb5526423ec9fba53f8d08f014b
1483 * mpi/mpi-internal.h (mpih_mod_lli): Add _lli suffix.
1484 (_gcry_mpih_mod_lli): Likewise.
1485 * mpi/mpih-const-time.c (_gcry_mpih_mod_lli): Rename.
1486 * mpi/mpi-inv.c (_gcry_mpi_invm): Follow the change.
1487
1488 mpi: Add _gcry_mpih_mul_lli as Least Leak Intended.
1489 + commit 5c5089ba36205ee5af0c83eec782eac68bf55d2e
1490 * mpi/mpi-internal.h (_gcry_mpih_mul_lli): New.
1491 * mpi/mpih-mul.c (_gcry_mpih_mul_lli): New.
1492
1493 2025-01-31 NIIBE Yutaka <[email protected]>
1494
1495 cipher:prime: Fix long standing bug for PRIME % 2 == 0.
1496 + commit 639b0fca15054f18c83fe3a6132a7765e558b984
1497 * cipher/primegen.c (check_prime): Check if it's even.
1498
1499 2025-01-27 Jussi Kivilinna <[email protected]>
1500
1501 Add SHA3 acceleration for RISC-V Zbb extension.
1502 + commit 1a660068ba5b58861de2c71b119ae2b6b6db0263
1503 * cipher/keccak.c (USE_RISCV_ZBB): New.
1504 [NEED_COMMON64, HAVE_GCC_INLINE_ASM_RISCV] (load_aligned_u64)
1505 (HAVE_ALIGNED_ABSORB_LANES64, aligned_absorb_lanes64_8)
1506 (aligned_absorb_lanes64_4, aligned_absorb_lanes64_2)
1507 (aligned_absorb_lanes64_1, HAVE_ALIGNED_EXTRACT64)
1508 (aligned_extract64): New.
1509 [NEED_COMMON64] (keccak_extract64): Add 'aligned_extract64' path.
1510 [USE_64BIT] (absorb_lanes64_8, absorb_lanes64_4, absorb_lanes64_2)
1511 (absorb_lanes64_1): Rename these functions to …
1512 [USE_64BIT] (unaligned_absorb_lanes64_8, unaligned_absorb_lanes64_4)
1513 (unaligned_absorb_lanes64_2, unaligned_absorb_lanes64_1): … these.
1514 [USE_64BIT] (absorb_lanes64_21, absorb_lanes64_18, absorb_lanes64_17)
1515 (absorb_lanes64_13, absorb_lanes64_9): New.
1516 [USE_RISCV_ZBB]: (ANDN64, ROL64, keccak_riscv_zbb_64_ops): New.
1517 (keccak_init) [USE_RISCV_ZBB]: Use 'keccak_riscv_zbb_64_ops' if
1518 HWF_RISCV_IMAFDC and HWF_RISCV_ZBB available.
1519 * cipher/keccak_permute_64.h (KECCAK_F1600_ABSORB_FUNC_NAME): Use
1520 absorb_lanes64_21, absorb_lanes64_18, absorb_lanes64_17,
1521 absorb_lanes64_13 and absorb_lanes64_9.
1522
1523 chacha20: add RISC-V vector intrinsics implementation.
1524 + commit 8dbee93ac2f1bba095a0519a6e0656319cfddfa4
1525 * cipher/Makefile.am: Add 'chacha20-riscv-v.c' and
1526 add ENABLE_RISCV_VECTOR_INTRINSICS_EXTRA_CFLAGS handling for
1527 'chacha20-riscv-v.o' and 'chacha20-riscv-v.lo'.
1528 * cipher/chacha20-riscv-v.c: New.
1529 * cipher/chacha20.c (USE_RISCV_V): New.
1530 (CHACHA20_context_s): Add 'use_riscv_v'.
1531 [USE_RISCV_V] (_gcry_chacha20_riscv_v_blocks)
1532 (_gcry_chacha20_riscv_v_check_hw): New.
1533 (chacha20_blocks) [USE_RISCV_V]: Add RISC-V vector code path.
1534 (chacha20_do_setkey) [USE_RISCV_V]: Add HW feature detection for
1535 RISC-V vector implementation.
1536 * configure.ac: Add 'chacha20-riscv-v.lo'.
1537
1538 Add GHASH RISC-V Zbb+Zbc implementation.
1539 + commit 0f1fec12b0e9c952afaf78d3c973df41627cb3ff
1540 * cipher/Makefile.am: Add 'cipher-gcm-riscv-zbb-zbc.c'.
1541 * cipher/cipher-gcm-riscv-zbb-zbc.c: New.
1542 * cipher/cipher-gcm.c [GCM_USE_RISCV_ZBB_ZBC]
1543 (_gcry_ghash_setup_riscv_zbb_zbc, _gcry_ghash_riscv_zbb_zbc): New.
1544 (setupM) [GCM_USE_RISCV_ZBB_ZBC]: Check for HWF_RISCV_IMAFDC,
1545 HWF_RISCV_ZBB and HWF_RISCV_ZBC to enable RISC-V Zbb+Zbc implementation.
1546 * cipher/cipher-internal.h (GCM_USE_RISCV_ZBB_ZBC): New.
1547 * configure.ac: Add 'cipher-gcm-riscv-zbb-zbc.lo'.
1548
1549 Add RISC-V vector permute AES.
1550 + commit b24ebd61630486600530ebfc2cc81634a0fb373e
1551 * cipher/Makefile.am: Add 'rinjdael-vp-riscv.c' and
1552 CFLAG handling for 'rijndael-vp-riscv.o' and 'rijndael-vp-riscv.lo'.
1553 (ENABLE_RISCV_VECTOR_INTRINSICS_EXTRA_CFLAGS): New.
1554 * cipher/rijndael-internal.h (USE_VP_RISCV): New.
1555 * cipher/rijndael-vp-simd128.h [__ARM_NEON]: Move ARM NEON macros to ...
1556 * cipher/rijndael-vp-aarch64.c: ... here.
1557 * cipher/rijndael-vp-riscv.c: New.
1558 * cipher/rijndael-vp-simd128.h: Use '__m128i_const' type for constant
1559 vector values and use *_amemld() macros to load these values to vector
1560 registers.
1561 [__x86_64__] (vpaddd128, vpaddb128): Remove.
1562 [__x86_64__] (psrl_byte_128, movdqa128_memld, pand128_amemld)
1563 (paddq128_amemld, paddd128_amemld, pshufb128_amemld): New.
1564 [HAVE_SIMD256] (aes_encrypt_core_4blks_simd256)
1565 (aes_decrypt_core_4blks_simd256): New.
1566 (FUNC_CTR_ENC, FUNC_CTR32LE_ENC, FUNC_CFB_DEC, FUNC_CBC_DEC)
1567 (aes_simd128_ocb_enc, aes_simd128_ocb_dec, FUNC_OCB_AUTH)
1568 (aes_simd128_ecb_enc, aes_simd128_ecb_dec, aes_simd128_xts_enc)
1569 (aes_simd128_xts_dec) [HAVE_SIMD256]: Add 4 block parallel code paths
1570 for HW with 256-bit wide vectors.
1571 * cipher/rijndael.c [USE_VP_RISCV]
1572 (_gcry_aes_vp_riscv_setup_acceleration, _gcry_aes_vp_riscv_do_setkey)
1573 (_gcry_aes_vp_riscv_prepare_decryption, _gcry_aes_vp_riscv_encrypt)
1574 (_gcry_aes_vp_riscv_decrypt, _gcry_aes_vp_riscv_cfb_enc)
1575 (_gcry_aes_vp_riscv_cbc_enc, _gcry_aes_vp_riscv_ctr_enc)
1576 (_gcry_aes_vp_riscv_ctr32le_enc, _gcry_aes_vp_riscv_cfb_dec)
1577 (_gcry_aes_vp_riscv_cbc_dec, _gcry_aes_vp_riscv_ocb_crypt)
1578 (_gcry_aes_vp_riscv_ocb_auth, _gcry_aes_vp_riscv_ecb_crypt)
1579 (_gcry_aes_vp_riscv_xts_crypt): New.
1580 (do_setkey) [USE_VP_RISCV]: Setup vector permute AES for RISC-V with
1581 HWF_RISCV_IMAFDC and HWF_RISCV_V.
1582 * cipher/simd-common-riscv.h: New.
1583 * configure.ac: Add 'rijndael-vp-riscv.lo'.
1584 (gcry_cv_cc_riscv_vector_intrinsics)
1585 (gcry_cv_cc_riscv_vector_intrinsics_cflags): New.
1586
1587 bithelp: add count trailing zero bits variant for RISC-V.
1588 + commit 60104c2f92dc0d89bc67aa12a403533a65c34a2f
1589 * cipher/bithelp.h (_gcry_ctz_no_zero): New.
1590 (_gcry_ctz): Use '_gcry_ctz_no_zero'.
1591 * cipher/cipher-internal.h (ocb_get_l): Use '_gcry_ctz_no_zero'.
1592
1593 hwf: add detection of RISC-V (64-bit) hardware features.
1594 + commit df9de2a5e5a847fa4f11a923cf3397bf1cf7a562
1595 * configure.ac
1596 (gcry_cv_gcc_inline_asm_riscv, gcry_cv_gcc_inline_asm_riscv_v)
1597 (HAVE_GCC_INLINE_ASM_RISCV_V, HAVE_CPU_ARCH_RISCV): Add RISC-V
1598 detection support.
1599 * mpi/config.links: Add setup for RISC-V links.
1600 * src/Makefile.am: Add 'hwf-riscv.c'.
1601 * src/g10lib.h (HWF_RISCV_IMAFDC, HWF_RISCV_V, HWF_RISCV_ZBB)
1602 (HWF_RISCV_ZBC): New.
1603 * src/hwf_common.h (_gcry_hwf_detect_riscv): New.
1604 * src/hwf-riscv.c: New.
1605 * src/hwfeatures.c: Add "riscv-imafdc", "riscv-v", "riscv-zbb",
1606 and "riscv-zbc".
1607
1608 2025-01-27 Lucas Mulling <[email protected]>
1609
1610 cipher: Check and mark non-compliant cipher modes in the SLI.
1611 + commit 9f0fd2656d7d7ba26fcf95cc64d2514ae9ac8ec1
1612 * cipher/cipher.c (_gcry_cipher_open_internal): Check and mark if the
1613 cipher mode is compliant and reject accordingly.
1614 (_gcry_cipher_is_mode_fips_compliant): New.
1615 * src/gcrypt.h.in (GCRY_FIPS_FLAG_REJECT_CIPHER_MODE): New.
1616 * tests/t-fips-service-ind.c (check_cipher_o_s_e_d_c): Add test to
1617 verify that the service level indication is correctly set for non-
1618 compliant cipher modes, and correctly rejected if
1619 GCRY_FIPS_FLAG_REJECT_CIPHER_MODE is set.
1620
1621 2025-01-16 NIIBE Yutaka <[email protected]>
1622
1623 Remove WindowsCE support.
1624 + commit 24a2ca672b2198d3f420399bd01cc626d9de99f8
1625 * compat/clock.c, compat/getpid.c, random/rndw32ce.c: Remove.
1626 * compat/Makefile.am: Remove comment for clock.c and getpid.c.
1627 * compat/libcompat.h: Remove replacement functions.
1628 * configure.ac (GPG_ERR_ENABLE_ERRNO_MACROS): Remove.
1629 (have_w32ce_system, HAVE_W32CE_SYSTEM): Remove.
1630 (AC_REPLACE_FUNCS): Remove.
1631 (USE_RNDW32CE): Remove.
1632 * random/Makefile.am (EXTRA_librandom_la_SOURCES): Remove rndw32ce.c.
1633 * random/random-csprng.c [USE_RNDW32CE] (getfnc_gather_random):
1634 Remove WindowsCE support.
1635 (getfnc_fast_random_poll): Likewise.
1636 * src/Makefile.am [HAVE_W32CE_SYSTEM]: Remove WindowsCE support.
1637 * src/dumpsexp.c [__MINGW32CE__]: Remove WindowsCE support.
1638 * tests/stopwatch.h [__MINGW32CE__] (start_timer, stop_timer): Remove
1639 WindowsCE support.
1640
1641 2025-01-09 NIIBE Yutaka <[email protected]>
1642
1643 build: Improve __thread specifier check.
1644 + commit 42e8858566e32080aaf818b168f34c698a9ef084
1645 * configure.ac (AC_COMPILE_IFELSE __thread): Move the declaration to
1646 global, referring the variable with (void) in main to avoid an error
1647 buidling with -Werror=unused-variable. Don't need to include
1648 stdlib.h.
1649
1650 2025-01-06 NIIBE Yutaka <[email protected]>
1651
1652 fips,cipher: Fix memory leak for gcry_pk_hash_sign.
1653 + commit 5e925e6c348450bf80b4560abac9a035903bff59
1654 * cipher/pubkey.c (prepare_datasexp_to_be_signed): Release
1655 copied HD when error.
1656
1657 2024-12-26 NIIBE Yutaka <[email protected]>
1658
1659 fips,ecc: Check DATA in gcry_pk_sign/verify in FIPS mode.
1660 + commit 53c97483b17fee280e24f595bc0d82d9b362ffde
1661 * src/gcrypt.h.in (GCRY_FIPS_FLAG_REJECT_PK_MD): New.
1662 (GCRY_FIPS_FLAG_REJECT_PK_GOST_SM2): New.
1663
1664 * cipher/ecc.c (ecc_sign): Check if GOST or SM2. Check if hash is
1665 compliant.
1666 (ecc_verify): Likewise.
1667 * tests/t-fips-service-ind.c (check_pk_s_v): Modify tests including
1668 hash compliance.
1669
1670 2024-12-24 NIIBE Yutaka <[email protected]>
1671
1672 tests: Add more tests to tests/t-fips-service-ind.
1673 + commit d71c88f78a4f1b72f92de90791fc6fe81a3cb861
1674 * tests/t-fips-service-ind.c (check_pk_g_t_n_c, check_pk_s_v): New.
1675 (main): Call check_pk_g_t_n_c and check_pk_s_v.
1676
1677 fips,ecc: Add rejecting or marking for gcry_pk_get_curve.
1678 + commit c6a092abbe7bea315394b15f28fd231dae0e4d7c
1679 * cipher/ecc-curves.c (_gcry_ecc_get_curve): Check under FIPS mode.
1680
1681 2024-12-20 NIIBE Yutaka <[email protected]>
1682
1683 fips,cipher: Add behavior not to reject but mark non-compliant.
1684 + commit a776b692669af7a6c089779989b626c4795e30b0
1685 * cipher/dsa.c (dsa_check_keysize): Check reject flag for rejection,
1686 or mark non-comliant in FIPS mode.
1687 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_sign): Likewise.
1688 * cipher/ecc.c (ecc_sign, ecc_verify): Likewise.
1689 * cipher/pubkey.c (_gcry_pk_encrypt, _gcry_pk_sign): Likewise.
1690 (_gcry_pk_verify, _gcry_pk_testkey, _gcry_pk_genkey): Likewise.
1691 (_gcry_pk_get_nbits, _gcry_pk_get_curve): Likewise.
1692 * src/visibility.c (gcry_pk_encrypt): Initialize the indicator.
1693 (gcry_pk_decrypt, gcry_pk_sign, gcry_pk_verify): Likewise.
1694 (gcry_pk_testkey, gcry_pk_genkey), gcry_pk_get_nbits)
1695 (gcry_pk_get_curve): Likewise.
1696
1697 fips: Rejection by GCRYCTL_FIPS_REJECT_NON_FIPS, not by open flags.
1698 + commit d060dd58b82882dec0d8bfcc593536bc0083b4b1
1699 * src/gcrypt.h.in (GCRY_CIPHER_FLAG_REJECT_NON_FIPS): Remove.
1700 (GCRY_MD_FLAG_REJECT_NON_FIPS): Remove.
1701 (GCRY_MAC_FLAG_REJECT_NON_FIPS): Remove.
1702 * tests/t-fips-service-ind.c: Update tests with
1703 GCRYCTL_FIPS_REJECT_NON_FIPS.
1704 * cipher/cipher.c (_gcry_cipher_open_internal, cipher_setkey): Use
1705 fips_check_rejection.
1706 * cipher/mac.c (mac_open): Likewise.
1707 * cipher/md.c (struct gcry_md_context): Remove reject_non_fips.
1708 (md_open, md_enable): Use fips_check_rejection.
1709 (_gcry_md_enable, md_copy): Likewise.
1710
1711 2024-12-19 NIIBE Yutaka <[email protected]>
1712
1713 Fix the previous change.
1714 + commit b4eb23dc01a40e13d542fbfc5169dffa7fae5677
1715 * cipher/pubkey.c (_gcry_pk_sign_md): Fix memory leak.
1716 (_gcry_pk_verify_md): Likewise.
1717
1718 fips: Introduce GCRYCTL_FIPS_REJECT_NON_FIPS.
1719 + commit e52adf0948c60b2e9accd7996fcece0f9b443763
1720 * src/gcrypt.h.in (GCRYCTL_FIPS_REJECT_NON_FIPS): New.
1721 (GCRY_FIPS_FLAG_REJECT_*): New.
1722 * src/fips.c (struct gcry_thread_context): Add flags_reject_non_fips.
1723 (the_tc): Add initial value.
1724 (_gcry_thread_context_set_reject): New.
1725 (_gcry_thread_context_check_rejection): New.
1726 * src/gcrypt-int.h (fips_check_rejection): New.
1727 * src/global.c (_gcry_vcontrol): Handle GCRYCTL_FIPS_REJECT_NON_FIPS.
1728 * tests/t-fips-service-ind.c (main): Use GCRYCTL_FIPS_REJECT_NON_FIPS.
1729
1730 2024-12-18 NIIBE Yutaka <[email protected]>
1731
1732 fips,cipher: Implement FIPS service indicator for gcry_pk_hash_ API.
1733 + commit edb43bc290046bd22548bf69ae2fbeb453112e44
1734 * src/visibility.c (gcry_pk_hash_sign): Initialize the indicator.
1735 (gcry_pk_hash_verify): Likewise.
1736 * tests/t-fips-service-ind.c (check_pk_hash_sign_verify): New.
1737 (main): Call check_pk_hash_sign_verify.
1738 * cipher/ecc-curves.c (_gcry_ecc_fill_in_curve): Don't reject, but
1739 mark non-compliance.
1740 * cipher/pubkey.c (prepare_datasexp_to_be_signed): Likewise.
1741 (_gcry_pk_sign_md, _gcry_pk_verify_md): Likewise.
1742
1743 fips,md: gcry_md_copy should care about FIPS service indicator.
1744 + commit 60db2a175d120aba6818de49638b36006878abf7
1745 * cipher/md.c (md_copy): In a case of non-compliant, mark with
1746 fips_service_indicator_mark_non_compliant.
1747 * src/visibility.c (gcry_md_copy): Initialize the indicator.
1748
1749 2024-12-17 NIIBE Yutaka <[email protected]>
1750
1751 tests,fips: Add gcry_cipher_open tests.
1752 + commit cfd2d2f41ad4aef40d83f8f7237d1da13c7e240c
1753 * tests/t-fips-service-ind.c (check_cipher_o_s_e_d_c): New.
1754 (main): Call check_cipher_o_s_e_d_c.
1755
1756 2024-12-16 NIIBE Yutaka <[email protected]>
1757
1758 tests,fips: Move KDF tests to t-fips-service-ind.
1759 + commit b59bde31ded9e829e2a53ddb8c533bf35a144972
1760 * tests/t-fips-service-ind.c (check_kdf_derive): Move from...
1761 * tests/t-kdf.c (check_fips_gcry_kdf_derive): ... here.
1762
1763 tests,fips: Rename t-fips-service-ind.
1764 + commit 132f346232b33fe41ffee3b3870ec189626676e7
1765 * tests/t-fips-service-ind.c: Rename from t-digest.c.
1766 * tests/Makefile.am (tests_bin): Follow the change.
1767
1768 tests,fips: Add gcry_mac_open tests.
1769 + commit c4f75014cb8af732f87c02fe7c2e7a488fe71c6d
1770 * tests/t-digest.c (check_mac_o_w_r_c): New.
1771 (main): Call check_mac_o_w_r_c.
1772
1773 fips,cipher: Implement new FIPS service indicator for cipher_open.
1774 + commit 69a5d0ed18a3ddc6f297de783c7cef5ad2257df0
1775 * src/gcrypt.h.in (GCRY_CIPHER_FLAG_REJECT_NON_FIPS): New.
1776 * cipher/cipher.c (_gcry_cipher_open_internal): Don't reject
1777 but mark the service indicator in FIPS mode.
1778 (cipher_setkey): Likewise.
1779 * src/visibility.c (gcry_cipher_open): Initialize the service
1780 indicator.
1781 (gcry_cipher_setkey): Likewise.
1782
1783 fips,mac: Implement new FIPS service indicator for gcry_mac_open.
1784 + commit fcb0c7004b0b6b318fdcced2bf61d9acb1e28cfc
1785 * src/gcrypt.h.in (GCRY_MAC_FLAG_REJECT_NON_FIPS): New.
1786 * cipher/mac.c (mac_open): Have FLAGS, instead of SECURE. Reject when
1787 GCRY_MAC_FLAG_REJECT_NON_FIPS, otherwise, mark non compliant.
1788 (_gcry_mac_open): Follow the change.
1789 * src/visibility.c (gcry_mac_open): Add initialization for FIPS
1790 service indicator.
1791 (gcry_mac_setkey): Likewise. Don't reject but mark.
1792
1793 2024-12-13 NIIBE Yutaka <[email protected]>
1794
1795 fips,tests: Add tests for md_open/write/read/close for t-digest.
1796 + commit 917fc6000dfebd8854f0d1c220b85dec0dbf4676
1797 * tests/t-digest.c (check_md_o_w_r_c): New.
1798 (main): Call check_md_o_w_r_c.
1799
1800 fips,md: Implement new FIPS service indicator for gcry_md_open API.
1801 + commit 9757e280794f537efc82c4eaa9a2944ece6a068a
1802 * src/gcrypt.h.in (GCRY_MD_FLAG_FIPS_NO_REJECTION): Remove.
1803 (GCRY_MD_FLAG_REJECT_NON_FIPS): New.
1804 * cipher/md.c (struct gcry_md_context): Add reject_non_fips.
1805 (md_enable): Remove NO_REJECT argument.
1806 (md_open): Change the FLAGS handling.
1807 (_gcry_md_open): Add checking of FIPS compliance against ALGO.
1808 (_gcry_md_enable): Likewise.
1809 (_gcry_md_hash_buffer): Follow the change of md_open change
1810 which now defaults to no rejection.
1811 (_gcry_md_hash_buffers_extract): Likewise.
1812 * src/visibility.c (gcry_md_open): Add fips_service_indicator_init.
1813 (gcry_md_enable): Likewise.
1814 (gcry_md_setkey): Don't reject but mark non-compliance.
1815 * tests/t-kdf.c (check_fips_gcry_kdf_derive): Add a test with
1816 non-compliant hash function.
1817 * cipher/mac-hmac.c (_gcry_mac_type_spec_hmac_md5): It's not
1818 compliant.
1819 * cipher/md5.c (gcry_md_oid_spec_t oid_spec_md5): It's not compliant.
1820 * tests/t-digest.c (check_hash_buffer, check_hash_buffers): MD5
1821 tests enabled.
1822
1823 fips: Change the internal API for new FIPS service indicator.
1824 + commit 4799914966a7f94f41e1ed5b7b62fded7ba09704
1825 * src/gcrypt-int.h (fips_service_indicator_init): Initialize by 0.
1826 (fips_service_indicator_mark_success): Remove.
1827 (fips_service_indicator_mark_non_compliant): New.
1828 * cipher/kdf.c (_gcry_kdf_derive): Follow the change of the API.
1829 * cipher/md.c (_gcry_md_hash_buffer): Likewise.
1830 (_gcry_md_hash_buffers_extract): Likewise.
1831
1832 2024-12-12 Simon Josefsson <[email protected]>
1833
1834 cipher: Add script to re-generate mceliece6688128f.c.
1835 + commit 47ed744465ae7461771a3ca08799264a3d32a7fd
1836 * cipher/mceliece6688128f.sh: Add.
1837 * cipher/mceliece6688128f.c: Regenerate from script.
1838
1839 2024-12-11 Milan Broz <[email protected]>
1840
1841 kdf: Fix memory cost overflow in Argon2 KDF.
1842 + commit 28327dba6b5ffae4a5e33da827fe0e2b48e99adb
1843 * cipher/kdf.c (argon2_init) Fix memory cost overflow in Argon2 KDF.
1844
1845 2024-12-11 NIIBE Yutaka <[email protected]>
1846
1847 tests: Fix comment in t-thread-local.
1848 + commit 75744f721d8d9c3bfc0ee1f8fec760718eb924a2
1849 * tests/t-thread-local.c: Fix the name.
1850
1851 2024-12-10 NIIBE Yutaka <[email protected]>
1852
1853 tests: Extend tests/t-digest to test hmac too.
1854 + commit 41cbcc0f0e786364972a4df213eff1b0ae362a40
1855 * tests/t-digest.c (check_hash_buffer): Rename.
1856 (check_hash_buffers): New.
1857 (main): Call check_hash_buffer and check_hash_buffers.
1858
1859 tests: Fix t-digest for a minimal configuration.
1860 + commit 06f6aafedc9f53d54468611744c67e0b7aa13c0c
1861 * tests/t-digest.c (check_digests): Care about minimal configuration.
1862
1863 2024-12-09 NIIBE Yutaka <[email protected]>
1864
1865 fips,tests: Add t-digest.
1866 + commit 7faf542f157330f3b247fa2542182ac805f06737
1867 * tests/Makefile.am (tests_bin): Add t-digest.
1868 * tests/t-digest.c: New.
1869
1870 2024-12-06 NIIBE Yutaka <[email protected]>
1871
1872 fips,md: Implement new FIPS service indicator for gcry_md_hash_*.
1873 + commit 3478caac62c712547f7c0e07f4cf9602bc317997
1874 * cipher/md.c (md_enable): Add an NO_REJECT argument.
1875 (md_open): Check flags against GCRY_MD_FLAG_FIPS_NO_REJECTION to
1876 call md_enable.
1877 (_gcry_md_enable): Follow the change.
1878 (_gcry_md_hash_buffer): Don't reject but keep the computation.
1879 Call fips_service_indicator_mark_success.
1880 (_gcry_md_hash_buffers_extract): Likewise.
1881 * src/gcrypt.h.in (GCRY_MD_FLAG_FIPS_NO_REJECTION): New.
1882 * src/visibility.c (gcry_md_hash_buffer, gcry_md_hash_buffers): Call
1883 fips_service_indicator_init.
1884 (gcry_md_hash_buffers_ext): Likewise.
1885
1886 2024-12-05 NIIBE Yutaka <[email protected]>
1887 David Sugar <[email protected]>
1888
1889 fips,kdf: Implement new FIPS service indicator for gcry_kdf_derive.
1890 + commit 5cfa1aee5b98baf0d66333344e0fa45b79cca28b
1891 * cipher/kdf.c (_gcry_kdf_derive): Don't reject by GPG_ERR_INV_VALUE
1892 but continue the computation, clearing IS_COMPLIANT. After successful
1893 computation, call fips_service_indicator_mark_success with
1894 IS_COMPLIANT.
1895 * src/visibility.c (gcry_kdf_derive): Call fips_service_indicator_init.
1896 * tests/t-kdf.c (check_fips_gcry_kdf_derive): New.
1897 (main): Call check_fips_gcry_kdf_derive.
1898
1899 2024-12-05 NIIBE Yutaka <[email protected]>
1900
1901 fips: Introduce GCRYCTL_FIPS_SERVICE_INDICATOR and the macro.
1902 + commit f51f4e98930e6b2175e85fe8a95b8b6a15ad5efa
1903 * src/fips.c (_gcry_fips_indicator): New.
1904 * src/g10lib.h (_gcry_fips_indicator): New.
1905 * src/gcrypt.h.in (GCRYCTL_FIPS_SERVICE_INDICATOR): New.
1906 (gcry_get_fips_service_indicator): New.
1907 * src/global.c (_gcry_vcontrol): Handle GCRYCTL_FIPS_SERVICE_INDICATOR.
1908
1909 fips: Introduce an internal API for FIPS service indicator.
1910 + commit e1cf3123282525693b646499eb7efe4f2be4010a
1911 * configure.ac (HAVE_GCC_STORAGE_CLASS__THREAD): New.
1912 * src/fips.c (struct gcry_thread_context): New.
1913 (_gcry_thread_context_set_fsi, _gcry_thread_context_get_fsi): New.
1914 * src/gcrypt-int.h (fips_service_indicator_init): New macro.
1915 (fips_service_indicator_mark_success): New macro.
1916 * tests/Makefile.am (tests_bin): Add t-thread-local.
1917 * tests/t-thread-local.c: New.
1918
1919 2024-11-06 Jussi Kivilinna <[email protected]>
1920
1921 Add vector register clearing for PowerPC implementations.
1922 + commit 022f44b6d894ba631cb20623a1e39267a953dff9
1923 * cipher/Makefile.am: Add 'simd-common-ppc.h'.
1924 * cipher/camellia-simd128.h
1925 [HAVE_GCC_INLINE_ASM_PPC_ALTIVEC]: Include "simd-common-ppc.h".
1926 [HAVE_GCC_INLINE_ASM_PPC_ALTIVEC] (memory_barrier_with_vec)
1927 (clear_vec_regs): Remove.
1928 * cipher/chacha20-p10le-8x.s (clear_vec_regs): New.
1929 (_gcry_chacha20_p10le_8x): Add clear_vec_regs.
1930 * cipher/chacha20-ppc.c: Include "simd-common-ppc.h".
1931 (chacha20_ppc_blocks1, chacha20_ppc_blocks4)
1932 (chacha20_poly1305_ppc_blocks4): Add clear_vec_regs.
1933 * cipher/cipher-gcm-ppc.c: Include "simd-common-ppc.h".
1934 (_gcry_ghash_setup_ppc_vpmsum, _gcry_ghash_ppc_vpmsum): Add
1935 clear_vec_regs.
1936 * cipher/poly1305-p10le.s (clear_vec_regs): New.
1937 (gcry_poly1305_p10le_4blocks): Add clear_vec_regs.
1938 * cipher/rijndael-p10le.c: Include "simd-common-ppc.h".
1939 (_gcry_aes_p10le_gcm_crypt): Add clear_vec_regs.
1940 * cipher/rijndael-ppc-common.h: Include "simd-common-ppc.h".
1941 * cipher/rijndael-ppc-functions.h (ENCRYPT_BLOCK_FUNC):
1942 (DECRYPT_BLOCK_FUNC, CFB_ENC_FUNC, ECB_CRYPT_FUNC, CFB_DEC_FUNC)
1943 (CBC_ENC_FUNC, CBC_DEC_FUNC, CTR_ENC_FUNC, OCB_CRYPT_FUNC)
1944 (OCB_AUTH_FUNC, XTS_CRYPT_FUNC, CTR32LE_ENC_FUNC): Add
1945 clear_vec_regs.
1946 * cipher/rijndael-ppc.c (_gcry_aes_ppc8_setkey)
1947 (_gcry_aes_ppc8_prepare_decryption): Add clear_vec_regs.
1948 * cipher/sha256-ppc.c: Include "simd-common-ppc.h".
1949 (sha256_transform_ppc): Add clear_vec_regs.
1950 * cipher/sha512-ppc.c: Include "simd-common-ppc.h".
1951 (sha512_transform_ppc): Add clear_vec_regs.
1952 * cipher/simd-common-ppc.h: New.
1953 * cipher/sm4-ppc.c: Include "simd-common-ppc.h".
1954 (sm4_ppc_crypt_blk1_16): Add clear_vec_regs.
1955
1956 rijndael-ppc: fix 'may be used uninitialized' warnings.
1957 + commit 52bd6fc0c0383c183870966069a7548dc2b8641a
1958 * cipher/rijndael-ppc-common.h (PRELOAD_ROUND_KEYS_ALL): Load
1959 rkey10-rkey13 with zero value by default.
1960
1961 salsa20-amd64: clear vectors registers.
1962 + commit 6a128b2380a4deb6086a904f17a1ff40c5af9b64
1963 * cipher/salsa20-amd64.S (CLEAR_REG): New.
1964 (_gcry_salsa20_amd64_encrypt_blocks): Clear vectors registers
1965 at exit.
1966
1967 whirlpool-sse2-amd64: clear vectors registers.
1968 + commit c479b9dd5a3863d81d88c305da1b61e3aa2d274e
1969 * cipher/whirlpool-sse2-amd64.S (CLEAR_REG): New.
1970 (_gcry_whirlpool_transform_amd64): Clear vectors registers
1971 at exit.
1972
1973 camellia-aarch64-ce: clear volatile vectors registers.
1974 + commit 762ccf64429d94530727bf8508e4d499fcfd062c
1975 * cipher/camellia-simd128.h [__powerpc__] (clear_vec_regs): New.
1976 [__ARM_NEON]: Include 'simd-common-aarch64.h'.
1977 [__ARM_NEON] (memory_barrier_with_vec): Remove.
1978 [__x86_64__] (clear_vec_regs): New.
1979 (FUNC_ENC_BLK16, FUNC_DEC_BLK16, camellia_setup128)
1980 (camellia_setup256): Add clear_vec_regs.
1981
1982 gcm-aarch64-ce: clear volatile vector registers at setup function.
1983 + commit 3d3e346cc3f52a423d67118203f0543feb430545
1984 * cipher/cipher-gcm-armv8-aarch64-ce.S
1985 (_gcry_ghash_setup_armv8_ce_pmull): Clear used vectors registers
1986 before function exit.
1987
1988 sm3-aarch64-ce: clear volatile vector registers.
1989 + commit af84aa32427d841eedbad0c2d1e53cf1df6dd732
1990 * cipher/sm3-armv8-aarch64-ce.S: Add CLEAR_ALL_REGS.
1991
1992 sm4-aarch64-ce: clear volatile vector registers.
1993 + commit 42495ad3a80eadb0b853c95377777fe9435b03ac
1994 * cipher/sm4-armv8-aarch64-ce.S (_gcry_sm4_armv8_ce_expand_key)
1995 (_gcry_sm4_armv8_ce_crypt_blk1_8, _gcry_sm4_armv8_ce_crypt)
1996 (_gcry_sm4_armv8_ce_cbc_dec, _gcry_sm4_armv8_ce_cfb_dec)
1997 (_gcry_sm4_armv8_ce_ctr_enc, _gcry_sm4_armv8_ce_xts_crypt): Add
1998 CLEAR_ALL_REGS.
1999
2000 sm4-aarch64: clear volatile vectors registers.
2001 + commit f6cebb330d87b88543949ae36a2bfef8b45c41d8
2002 * cipher/sm4-aarch64.S (clear_volatile_vec_regs): New.
2003 (_gcry_sm4_aarch64_crypt_blk1_8, _gcry_sm4_aarch64_crypt)
2004 (_gcry_sm4_aarch64_cbc_dec, _gcry_sm4_aarch64_cfb_dec)
2005 (_gcry_sm4_aarch64_ctr_enc): Add clear_volatile_vec_regs.
2006
2007 sm4-aarch64-sve: clear volatile vectors registers.
2008 + commit fb78bc85dfe183f381ad83142e5abf46f4096ca6
2009 * cipher/asm-common-aarch64.h (CLEAR_ALL_REGS): New.
2010 * cipher/sm4-armv9-aarch64-sve-ce.S
2011 (_gcry_sm4_armv9_sve_ce_cbc_dec, _gcry_sm4_armv9_sve_ce_cfb_dec)
2012 (_gcry_sm4_armv9_sve_ce_ctr_enc): Add CLEAR_ALL_REGS.
2013
2014 sm4-aarch64-sve: add missing .text section.
2015 + commit 341945ae9651b42e07fe5c29d6634b8af110ce4c
2016 * cipher/sm4-armv9-aarch64-sve-ce.S: Add missing '.text'.
2017
2018 Add GHASH AArch64/SIMD intrinsics implementation.
2019 + commit fec871fd18c73d790ac64a2a3b9e422212c2a6af
2020 * cipher/Makefile.am: Add 'cipher-gcm-aarch64-simd.c'.
2021 * cipher/cipher-gcm-aarch64-simd.c: New.
2022 * cipher/cipher-gcm.c [GCM_USE_AARCH64]: Add function
2023 prototypes for AArch64/SIMD implementation.
2024 (setupM) [GCM_USE_AARCH64]: Add setup for AArch64/SIMD
2025 implementation.
2026 * cipher/cipher-internal.h (GCM_USE_AARCH64): New.
2027 * configure.ac: Add 'cipher-gcm-aarch64-simd.c'.
2028
2029 Add AES Vector Permute intrinsics implementation for AArch64.
2030 + commit 94a63aedbbd252305c865912e59400dc6f3bc3b8
2031 * cipher/Makefile: Add 'rijndael-vp-aarch64.c',
2032 'rijndael-vp-simd128.h' and 'simd-common-aarch64.h'.
2033 * cipher/rijndael-internal.h (USE_VP_AARCH64): New.
2034 * cipher/rijndael-vp-aarch64.c: New.
2035 * cipher/rijndael-vp-simd128.h: New.
2036 * cipher/rijndael.c [USE_VP_AARCH64]: Add function prototypes
2037 for AArch64 vector permutation implementation.
2038 (do_setkey) [USE_VP_AARCH64]: Setup function pointers for
2039 AArch64 vector permutation implementation.
2040 * cipher/simd-common-aarch64.h: New.
2041 * configure.ac: Add 'rijndael-vp-aarch64.lo'.
2042
2043 2024-10-25 NIIBE Yutaka <[email protected]>
2044
2045 config: Include Kyber in GCRYPT_PUBKEY_CIPHERS.
2046 + commit 7eaa43bf0931494afccbd413d83a3010aa80cee0
2047 * configure.ac (available_pubkey_ciphers): Add kyber.
2048
2049 2024-09-17 NIIBE Yutaka <[email protected]>
2050
2051 tests:kyber: Add genkey and encap KAT tests.
2052 + commit 4876a1a45c25d7e3ffb45a0af4e7c8995ce3a552
2053 * tests/t-kem.c (test_kem_sntrup761): Use gcry_kem_genkey API.
2054 (test_kem_mceliece6688128f): Likewise.
2055 (test_kem_mlkem512, test_kem_mlkem768, test_kem_mlkem1024): Likewise.
2056 (test_kem_raw_x25519, test_kem_dhkem_x25519): Likewise.
2057 * tests/t-mlkem.c (N_TESTS): Update the number of tests.
2058 (one_genkey_test, one_encap_test): New.
2059 (one_decap_test): Rename from one_test.
2060 (check_mlkem_kat): Support KAT tests for genkey ane encap.
2061 * tests/t-mlkem.inp: Add test data sets for genkey and encap.
2062
2063 cipher:kyber: Add gcry_kem_genkey to support deterministic op.
2064 + commit 38742196c04c99de3366156221dda9e0ceddc0d7
2065 * cipher/kem.c (_gcry_kem_genkey): Rename from _gcry_kem_keypair,
2066 adding OPTIONAL argument.
2067 (_gcry_kem_encap): Allow OPTIONAL for deterministic operation.
2068 (kem_generate): Use _gcry_kem_genkey instead of _gcry_kem_keypair.
2069 * cipher/kyber.c (crypto_kem_keypair_derand_2)
2070 (crypto_kem_keypair_derand_3, crypto_kem_keypair_derand_4): Expose.
2071 (crypto_kem_enc_derand_2, crypto_kem_enc_derand_3): Likewise.
2072 (crypto_kem_enc_derand_4): Likewise.
2073 (kyber_keypair): Allow COINS for deterministic operation.
2074 (kyber_encap): Likewise.
2075 * cipher/kyber.h: Allow COINS for deterministic operation.
2076 (crypto_kem_keypair_derand, crypto_kem_enc_derand): New.
2077 * src/gcrypt-int.h (_gcry_kem_genkey): Rename from _gcry_kem_keypair.
2078 * src/gcrypt.h.in (gcry_kem_genkey): New.
2079 * src/libgcrypt.def (gcry_kem_genkey): New.
2080 * src/libgcrypt.vers (gcry_kem_genkey): New.
2081 * src/visibility.c (gcry_kem_genkey): New.
2082 * src/visibility.h (gcry_kem_genkey): New.
2083
2084 2024-08-27 NIIBE Yutaka <[email protected]>
2085
2086 cipher:kyber: Apply changes from upstream for final FIPS 203.
2087 + commit cc95c36e7f79ac47c201b7cbd375ee37b9689d0d
2088 * cipher/kyber-kdep.c (gen_matrix): Simplify for the case of
2089 XOF_BLOCKBYTES%3 == 0.
2090 (indcpa_keypair_derand): Add domain separation to key generation.
2091
2092 2024-08-26 NIIBE Yutaka <[email protected]>
2093
2094 Fix previous commit.
2095 + commit bfbddd64002d80e2d0a7e62adff2ed57abc99392
2096 * tests/pkcs1v2.c (check_oaep): Need to specify HASH-ALGO.
2097
2098 2024-08-22 NIIBE Yutaka <[email protected]>
2099
2100 tests: More fixes for tests/pkcs1v2.c.
2101 + commit ced3a39b29af341edb2e025e398c31c177b78bfe
2102 * tests/pkcs1v2.c (check_oaep): Don't specify SHA1.
2103 Don't supply SEED for decryption.
2104 (check_pss): Don't supply SALT for verification.
2105
2106 2024-08-22 Jakub Jelen <[email protected]>
2107
2108 tests: Remove needless PKCS#1.5 encryption and decryption parameters.
2109 + commit 081e18a98f629926bd1306680f6bfa5936345d59
2110 * tests/pkcs1v2.c (check_v15crypt): Remove needless flags from s-exp.
2111
2112 2024-08-21 Werner Koch <[email protected]>
2113
2114 Return a proper error code on malloc failure in hex2buffer.
2115 + commit c51151f5b0b3e5c9ebf6935d85fe1505aa7a124a
2116 * src/sexp.c (_gcry_hex2buffer): Replace xmalloc by xtrymalloc.
2117
2118 2024-08-21 NIIBE Yutaka <[email protected]>
2119
2120 Fix memory leaks.
2121 + commit 0e186b31d7bcdab793e82e73295804351c3dffd7
2122 * src/sexp.c (_gcry_hex2buffer): Free buffer on error.
2123 * cipher/ecc-ecdh.c (_gcry_ecc_curve_keypair): Free buffer on exit path.
2124 (_gcry_ecc_curve_mul_point): Free buffer on all exit paths.
2125 * tests/t-common.h (hex2buffer): Free memory on error path.
2126
2127 2024-08-07 Jussi Kivilinna <[email protected]>
2128
2129 Add PAC/BTI support for AArch64 assembly.
2130 + commit 55e2e23401c64541e88aad84b5f9e8b1e4ab6acb
2131 * cipher/asm-common-aarch64.h (AARCH64_BTI_PROPERTY_FLAG)
2132 (AARCH64_HINT_BTI_C, AARCH64_PAC_PROPERTY_FLAG)
2133 (note.gnu.property): New.
2134 (CFI_STARTPROC): Add AARCH64_HINT_BTI_C.
2135
2136 camellia-aarch64: do not store/load link register to/from stack.
2137 + commit b73f54fed2c440128982b4ee23e9226768b75681
2138 * cipher/camellia-aarch64.S (_gcry_camellia_arm_encrypt_block)
2139 (_gcry_camellia_arm_decrypt_block): Store/load dummy x20 instead
2140 of x30.
2141
2142 Do not build 32-bit ARM assembly on Aarch64.
2143 + commit 93aad101d5796242558c26b7851624449edeba52
2144 * configure.ac: Build "serpent-armv7-neon", "salsa20-armv7-neon",
2145 "chacha20-armv7-neon", "sha512-armv7-neon" and "keccak-armv7-neon"
2146 only on 32-bit ARM.
2147
2148 2024-08-04 Jussi Kivilinna <[email protected]>
2149
2150 mpi/ec-inline: reduce register pressure on 32-bit ARM.
2151 + commit 9c93b4607adcf9b3efd53aba43e2d33bf5aef9df
2152 * mpi/ec-inline.h [HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS] (ADD4_LIMB32)
2153 (ADD6_LIMB32, SUB4_LIMB32, SUB6_LIMB32): Reuse input registers
2154 as output (use just two unique operators).
2155
2156 2024-07-28 Jussi Kivilinna <[email protected]>
2157
2158 Add CET support for i386 assembly.
2159 + commit 64ec13d11b08fbe31cc6f83e9464e7e251d41019
2160 * cipher/asm-common-i386.h (ENDBRANCH): New.
2161 (CFI_STARTPROC): Add ENDBRANCH.
2162 [__CET__] (note.gnu.property): Add CET property section.
2163
2164 Add CET support for x86-64 assembly.
2165 + commit d69e6a29b986cf1cb21e09d337a0de2564ef34f2
2166 * cipher/asm-common-amd64.h (ENDBRANCH): New.
2167 (CFI_STARTPROC): Add ENDBRANCH.
2168 [__CET__] (note.gnu.property): Add CET property section.
2169
2170 Do not build amd64 assembly on i386.
2171 + commit 5797d75e3b916caf504bed73a8629c6c168be58d
2172 * configure.ac: Build "serpent-avx2-amd64" and
2173 "camellia-*-amd64" only on x86-64.
2174
2175 Do not build i386 assembly on x86-64.
2176 + commit dd42a4e03e066c49a6d83e0d3a07e4261d77121a
2177 * configure.ac: Enable building i386 "rijndael-vaes" only
2178 on i?86 host instead of x86 MPI arch ("i?86 + x86-64").
2179
2180 asm-common-amd64: add missing CFI directives for large memory model code
2181 + commit 7ee2e73495d051ca09dd57c90132a7a9cc53bc62
2182 * cipher/asm-common-amd64.h [__code_model_large__]
2183 (GET_EXTERN_POINTER): Add CFI_PUSH/CFI_POP directives.
2184
2185 2024-07-04 NIIBE Yutaka <[email protected]>
2186
2187 cipher:blake2: Fix for use_avx512.
2188 + commit b42116d6067a5233f72e5598032d4b396bb8eaac
2189 * cipher/blake2.c (blake2s_init_ctx): Conditional with USE_AVX512.
2190
2191 2024-07-02 NIIBE Yutaka <[email protected]>
2192
2193 cipher:kyber: Use ct_int16_select of libgcrypt .
2194 + commit 8b898670e9150cd04ab57c763e9aedb7091c5e18
2195 * cipher/kyber-common.c (poly_frommsg): Use ct_int16_select.
2196 * cipher/kyber.c: Require ct_int16_select for external use case.
2197 * src/const-time.h: Add ct_int16_select.
2198
2199 cipher:kyber: Apply a change from upstream.
2200 + commit f765778e82b33efa6a9c0ec0b4f97564ac229c46
2201 * cipher/kyber-common.c (poly_frommsg): Remove secret-dependent
2202 branch.
2203
2204 2024-06-24 simit.ghane <[email protected]>
2205
2206 random:cipher: handle substitution in sed command.
2207 + commit e96df0c82e086bf348753d2d0fa37fa6191b4b14
2208 * cipher/Makefile.am (o_flag_munging): Add 'g' flag for first sed
2209 expression.
2210 * random/Makefile.am (o_flag_munging): Likewise.
2211
2212 2024-06-24 NIIBE Yutaka <[email protected]>
2213
2214 m4: Fix acinclude.m4 for underscore detection in the symbol.
2215 + commit bb0895bbb7c6d2b9502cbbf03da14d4ecf27a183
2216 * acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): Fix for a case with
2217 underscore.
2218
2219 2024-06-23 Jussi Kivilinna <[email protected]>
2220
2221 mpi/generic: use longlong.h for carry handling.
2222 + commit d37cdd5bcb1e0960c3f4164a8163893438811f29
2223 * mpi/generic/mpih-add1.c (_gcry_mpih_add_n): Use add_ssaaaa for
2224 carry handling.
2225 * mpi/generic/mpih-mul1.c (_gcry_mpih_mul_1): Likewise.
2226 * mpi/generic/mpih-mul2.c (_gcry_mpih_addmul_1): Likewise.
2227 * mpi/generic/mpih-mul3.c (_gcry_mpih_submul_1): Use add_ssaaaa
2228 and sub_ddmmss for carry handling.
2229 * mpi/generic/mpih-sub1.c (_gcry_mpih_sub_n): Likewise.
2230
2231 chacha20-ppc: fix implicit conversion between vector types warnings.
2232 + commit 414b4251fdb3c701912a0fc56ae8ef6e3fe35ecf
2233 * cipher/chacha20-ppc.c (chacha20_ppc_blocks4)
2234 (chacha20_ppc_blocks4, chacha20_poly1305_ppc_blocks4): Explicitly
2235 convert return values from vec_cmplt.
2236
2237 chacha20-ppc: silence GCC cast alignment warning.
2238 + commit a9f112f36392c87b3d6153b8452cd86211d15ce0
2239 * cipher/chacha20-ppc.c (vec_load_le, vec_store_le): Cast
2240 pointers through void pointer type.
2241
2242 rijndael-p10le: silence incorrect GCC cast alignment warning.
2243 + commit 1f8a5aa86dad71c77af9a2b4387e7fc2e5bf015f
2244 * cipher/rijndael-p10le.c (_gcry_aes_p10le_gcm_crypt): Cast
2245 context to RIJNDAEL_context type through void pointer.
2246
2247 src/hwf-x86: disable inline assembly CFI directivies for WIN32.
2248 + commit 26a462925e2230de82d5e1b91c9306b1f2668a02
2249 * src/hwf-x86.c (CFI_ADJUST_CFA_OFFSET, CFI_PUSH4)
2250 (CFI_POP4): Define only if _WIN32 is not defined.
2251
2252 2024-06-20 Jussi Kivilinna <[email protected]>
2253
2254 Disable SHA3 s390x acceleration for CSHAKE.
2255 + commit 2486d9b5ae015c1786cb84466a751da4bc0d7122
2256 * cipher/keccak.c (keccak_final_s390x): Add assert check for
2257 expected SHAKE suffix.
2258 (_gcry_cshake_customize, cshake_hash_buffers): Disable s390x
2259 acceleration when selecting CSHAKE suffix.
2260
2261 2024-06-19 Werner Koch <[email protected]>
2262
2263 Release 1.11.0.
2264 + commit 9d94d7846cde272b8b1519ba96e53967bf0b90d2
2265
2266
2267 2024-06-14 NIIBE Yutaka <[email protected]>
2268
2269 m4: Update gpg-error.m4.
2270 + commit 89adba4518d2c7f83a37361f66b3ac290c96525c
2271 * m4/gpg-error.m4: Update from libgpg-error master.
2272
2273 2024-06-13 NIIBE Yutaka <[email protected]>
2274
2275 libgcrypt.m4: Fix setting/using GPG_ERROR_CONFIG.
2276 + commit 0fd9ec3403ea66d39f32602dce53bc5219e4c158
2277 libgcrypt.m4 (_AM_PATH_GPGRT_CONFIG): Don't set GPG_ERROR_CONFIG and
2278 gpg_error_config_version.
2279
2280 2024-06-06 Jakub Jelen <[email protected]>
2281
2282 cipher:aeswrap: Fix padding length check.
2283 + commit dc8d84383a6bfa44f397132eae203efa0bf20e82
2284 * cipher/cipher-aeswrap.c (_gcry_cipher_keywrap_decrypt_auto): When
2285 padding length is 8, correctly return GPG_ERR_CHECKSUM.
2286
2287 2024-05-21 Jakub Jelen <[email protected]>
2288
2289 mpi: Fix loop condition in bad point check.
2290 + commit 1875758440158fe1943d1b19b29d77421d269256
2291 * mpi/ec.c (ec_p_init): Fix loop condition to avoid out-of-range read.
2292
2293 2024-05-17 Werner Koch <[email protected]>
2294
2295 build: Remove cruft from configure.ac.
2296 + commit 0526d65afd34f9282e7fd125df6ee9a3c757ae79
2297 * configure.ac: Remove unused cruft.
2298
2299 2024-05-14 NIIBE Yutaka <[email protected]>
2300
2301 m4: Include _AM_PATH_GPGRT_CONFIG definition.
2302 + commit ad3b599462bdbc459f6c7be867e9a12ab46481b3
2303 * src/libgcrypt.m4: Find gpgrt-config.
2304
2305 2024-05-09 Jussi Kivilinna <[email protected]>
2306
2307 random: fix o_flag_munging for -O1.
2308 + commit 5afadba008918d651afefb842ae123cc18454c74
2309 * random/Makefile.am (o_flag_munging): Also convert -O1 to -O0.
2310
2311 2024-05-08 Jussi Kivilinna <[email protected]>
2312
2313 chacha20-aarch64: use local symbols for read-only data.
2314 + commit 3f5989014a1b7c01aced88897d878ce5105d15df
2315 * cipher/chacha20-aarch64.S: Remove '.globl' mark for RODATA section
2316 objects.
2317
2318 2024-05-07 simit.ghane <[email protected]>
2319
2320 Fix building error with '-O2' in sysroot path.
2321 + commit b99952adc6ee611641709610d2e4dc90ba9acf37
2322 * cipher/Makefile.am (o_flag_munging): Tweak the sed script.
2323 * random/Makefile.am (o_flag_munging): Ditto.
2324
2325 2024-05-07 NIIBE Yutaka <[email protected]>
2326
2327 cipher:kem: Remove the experimental KEMs (PGP and CMS).
2328 + commit c9affe97d20bc958d733206adf350214b32ae0b2
2329 * src/gcrypt.h.in (enum gcry_kem_algos): Remove
2330 GCRY_KEM_OPENPGP_X25519, GCRY_KEM_CMS_X25519_X963_SHA256, and
2331 GCRY_KEM_CMS_X25519_HKDF_SHA256.
2332 * cipher/kem.c (_gcry_kem_keypair, _gcry_kem_encap): Likewise.
2333 (_gcry_kem_decap): Likewise.
2334 * cipher/kem-ecc.c (algo_to_curve): Follow the removal.
2335 (algo_to_seckey_len): Likewise.
2336 (openpgp_kem_kdf, _gcry_openpgp_kem_encap): Remove.
2337 (_gcry_openpgp_kem_decap, cms_kem_kdf): Remove.
2338 (_gcry_cms_kem_encap, _gcry_cms_kem_decap): Remove.
2339 * cipher/kem-ecc.h: Follow the removal.
2340 * tests/t-kem.c (test_kem_openpgp_x25519) Remove.
2341 (test_kem_cms_x25519): Remove.
2342 (check_kem, main): Follow the change.
2343
2344 2024-04-30 Jussi Kivilinna <[email protected]>
2345
2346 serpent-avx512-x86: fix CBC and CFB decryption with clang-18.
2347 + commit 5a653a9129d7cc2f203ab9ad37ccdbcb832337d1
2348 * cipher/serpent-avx512-x86.c (serpent_avx512_blk32): Avoid
2349 '_mm512_castsi128_si512' usage to prevent non-initialized
2350 vector register parts getting XOR into calculations for
2351 CBC and CFB decryption.
2352
2353 2024-04-26 Werner Koch <[email protected]>
2354
2355 Let gcry_print_config show whether it is amd64 or i686.
2356 + commit 0729fb84a6a1c038d4ed10f9c60be7df48558d9e
2357 * src/global.c (print_config): Append a sub-cpu string.
2358
2359 2024-04-25 Werner Koch <[email protected]>
2360
2361 Require GpgRT 1.49.
2362 + commit f895a69d3b4bd5b8f6fab11345c2663947b7e5e3
2363 * configure.ac (LIBGCRYPT_LT_REVISION): Require 1.49
2364 * src/global.c (print_config): Repalce gpgrt backward compatibility.
2365 * src/misc.c (_gcry_set_gpgrt_post_log_handler): Ditto.
2366 (_gcry_logv): Use new gpgrt_logv_domain.
2367
2368 2024-04-24 NIIBE Yutaka <[email protected]>
2369
2370 cipher:kem:ecc: Support NIST curves.
2371 + commit 005292cf9f41179247918711b2968dd188aae122
2372 * cipher/kem-ecc (ECC_SECKEY_LEN_MAX): Fix for P521R1.
2373 (algo_to_curve): Using canonical name, add NIST curves,
2374 (algo_to_seckey_len): Likewise.
2375 * cipher/kem.c (_gcry_kem_keypair, _gcry_kem_encap): Likewise.
2376 (_gcry_kem_decap): Likewise.
2377 * src/gcrypt.h.in (enum gcry_kem_algos): Likewise.
2378
2379 cipher:kem:ecc: Fix DHKEM implementation.
2380 + commit 118fa95d8d36efb07dbebdbcbc0e3408e69ac5d2
2381 * cipher/kem-ecc.c (_gcry_ecc_dhkem_decap): Fix the size.
2382
2383 2024-04-23 Werner Koch <[email protected]>
2384
2385 cipher:kem:ecc: Support brainpoolP512r1.
2386 + commit 4fb99ec266e5d38e0f6df5c2fd27da71f2fb441f
2387 * cipher/kem-ecc.c (algo_to_curve): Add GCRY_KEM_RAW_BP512.
2388 (algo_to_seckey_len): Ditto.
2389 * cipher/kem.c (_gcry_kem_keypair): Ditto.
2390 (_gcry_kem_encap): Ditto.
2391 (_gcry_kem_decap): Ditto.
2392
2393 Use explicit values for the gcry_kem_algos enum.
2394 + commit 66884c2d6b35bf418a267697a2726142a95188be
2395 * src/gcrypt.h.in (enum gcry_kem_algos): Use explicit values for
2396 improved ABI stability.
2397 (GCRY_KEM_RAW_BP512): New.
2398
2399 cipher:kem:ecc: Fix for Weierstrass.
2400 + commit 7ad308434f159952baf578eca60efc1f5bf93019
2401 * cipher/ecc-ecdh.c (_gcry_ecc_curve_mul_point): Use POINT_LEN and not
2402 NBYTES to create mpi_u.
2403
2404 Divert log functions to the gpgrt log functions.
2405 + commit ab0bdc72c79d5655e63047f768a202e063d8c18b
2406 * src/misc.c (my_gpgrt_post_fatal_handler): New.
2407 (_gcry_set_gpgrt_post_log_handler): New.
2408 (map_log_level): New.
2409 (_gcry_logv): Use gcrypt log function unless a handler has been
2410 installed.
2411 * src/global.c (global_init): Install post log handler.
2412 * src/gcrypt.h.in (gcry_set_log_handler): Deprecate.
2413
2414 2024-04-22 NIIBE Yutaka <[email protected]>
2415
2416 cipher:kem:ecc: Support brainpoolP256r1 and brainpoolP384r1.
2417 + commit 9c65260f915f3eeebf10b51ab7c3c9b5f0004d9b
2418 * cipher/kem.c (_gcry_kem_keypair): Support classic curves.
2419 (_gcry_kem_encap, _gcry_kem_decap): Likewise.
2420 * cipher/kem-ecc.c (algo_to_curve, algo_to_seckey_len): New.
2421 (_gcry_ecc_raw_keypair): Support classic curves.
2422 (_gcry_ecc_raw_encap, _gcry_ecc_raw_decap): Likewise.
2423 (ecc_tweak_bits): Move to ...
2424 * cipher/ecc-ecdh.c (ecc_tweak_bits): here.
2425 (_gcry_ecc_curve_keypair): New.
2426 (_gcry_ecc_curve_mul_point): Add length arguments.
2427 * src/gcrypt-int.h (_gcry_ecc_curve_keypair): New.
2428 * src/gcrypt.h.in: Add constants for brainpoolP256r1 and
2429 brainpoolP384r1.
2430
2431 2024-04-19 NIIBE Yutaka <[email protected]>
2432
2433 cipher:ecc: Return the result in SEC1 point format for Weierstrass.
2434 + commit 47f2cb8f6f35cf962158d9cffc79c23fab163585
2435 * cipher/ecc-ecdh.c (_gcry_ecc_curve_mul_point): Fix for
2436 MPI_EC_WEIERSTRASS curve.
2437
2438 cipher:ecc: Add _gcry_ecc_curve_mul_point function with curve name.
2439 + commit b1da8247dcbc036a5dc55dc7121ccd537c9b7ff3
2440 * cipher/ecc-ecdh.c (_gcry_ecc_curve_mul_point): New. Also support
2441 Weierstrass curve as well as Montgomery one.
2442 (_gcry_ecc_mul_point): Use _gcry_ecc_curve_mul_point.
2443
2444 cipher:kem: Rename Classic McEliece API constants.
2445 + commit 72b1b8d447fb8046e5546998619206646dde2ea7
2446 * src/gcrypt.h.in (GCRY_KEM_CM6688128F): Rename.
2447 * cipher/kem.c (_gcry_kem_keypair): Follow the change.
2448 (_gcry_kem_encap, _gcry_kem_decap): Likewise.
2449 * tests/t-kem.c (test_kem_mceliece6688128f): Likewise.
2450 (main): Also change CLI option name.
2451
2452 2024-04-18 NIIBE Yutaka <[email protected]>
2453
2454 cipher: More clean up for Classic McEliece implementation.
2455 + commit 9a552b80d6c44a05ab733e441664d19de6f23da3
2456 * cipher/mceliece6688128f.h: Provide GCC_ATTR_UNUSED.
2457 * cipher/mceliece6688128f.c: Use GCC_ATTR_UNUSED.
2458
2459 cipher: Fix comments of Classic McEliece implementation.
2460 + commit 6478203e77d173128c4c0810db6f41198c360ca2
2461 * cipher/mceliece6688128f.c: Don't use C++-style comments for old
2462 compilers (< C99).
2463
2464 2024-04-17 Simon Josefsson <[email protected]>
2465
2466 cipher: Add Classic McEliece mceliece6688128f.
2467 + commit 003367b91272f499d6eecb32ab9a09f383bdc788
2468 * cipher/Makefile.am (libcipher_la_SOURCES): Add mceliece6688128f.{c,h}.
2469 * cipher/mceliece6688128f.c, cipher/mceliece6688128f.h: New.
2470 * tests/t-kem.c: Support mceliece6688128f.
2471
2472 2024-04-16 NIIBE Yutaka <[email protected]>
2473
2474 cipher: Fix copyright notices for Kyber implementation.
2475 + commit eec1a576dbd080eb54ad7c6027271fe3f71c8847
2476 * cipher/kyber-common.c: Fix copyright notice sentences.
2477 * cipher/kyber-kdep.c, cipher/kyber.c, cipher/kyber.h: Likewise.
2478
2479 2024-04-09 NIIBE Yutaka <[email protected]>
2480
2481 cipher: Add X448 based ECC KEM.
2482 + commit 40b4781022c5f5ebf1ec6e6d814f9c2a346cb3ca
2483 * src/gcrypt.h.in (GCRY_KEM_RAW_X448, GCRY_KEM_DHKEM448): New.
2484 * cipher/kem-ecc.c (_gcry_ecc_raw_encap): Support X448.
2485 (ecc_dhkem_kdf, _gcry_ecc_dhkem_encap): Likewise.
2486 (_gcry_ecc_dhkem_decap): Likewise.
2487 * cipher/kem.c (_gcry_kem_keypair): Add support for GCRY_KEM_RAW_X448
2488 and GCRY_KEM_DHKEM448.
2489 (_gcry_kem_encap, _gcry_kem_decap): Likewise.
2490
2491 2024-04-05 Werner Koch <[email protected]>
2492
2493 Trailing comma removal for better portability.
2494 + commit 9e6db9d74631e623164319f1fc9713afdf9e3eb9
2495 * cipher/kem.c (kem_names): Remove trailing comma.
2496 * src/gcrypt.h.in (enum gcry_kem_algos): Ditto.
2497
2498 ecc: Add bp256, bp384, bp512 aliases for Brainpool curves.
2499 + commit d211e7fe967381bfb19e4f18e0be067c68200c50
2500 * cipher/ecc-curves.c (curve_aliases): Add new aliases for Brainpool.
2501
2502 2024-04-03 NIIBE Yutaka <[email protected]>
2503
2504 tests: Fix t-kem for tests with X25519 for FIPS mode.
2505 + commit a78dcad69872e1d6e6eb7ead174e398d9c7d4800
2506 * tests/t-kem.c (test_kem_raw_x25519): It is expected to fail.
2507 (test_kem_dhkem_x25519, test_kem_openpgp_x25519): Likewise.
2508 (test_kem_cms_x25519): Likewise.
2509
2510 2024-03-28 NIIBE Yutaka <[email protected]>
2511
2512 cipher:kem: Add ECC KEM for X25519.
2513 + commit 5da6c63fed34f6027a9531780252f0f54087c379
2514 * cipher/Makefile.am (libcipher_la_SOURCES): Add kem-ecc.{c,h}.
2515 * cipher/kem-ecc.c: New.
2516 * cipher/kem-ecc.h: New.
2517 * cipher/kem.c (_gcry_kem_keypair): Dispatch to _gcry_ecc_raw_keypair.
2518 (_gcry_kem_encap): Dispatch to _gcry_ecc_raw_encap,
2519 _gcry_ecc_dhkem_encap, _gcry_openpgp_kem_encap, and
2520 _gcry_cms_kem_encap.
2521 (_gcry_kem_decap): Dispatch to _gcry_ecc_raw_decap,
2522 _gcry_ecc_dhkem_decap, _gcry_openpgp_kem_decap, and
2523 _gcry_cms_kem_decap.
2524 * src/gcrypt.h.in: Add constants for ECC KEM.
2525 * tests/t-kem.c (test_kem_raw_x25519, test_kem_dhkem_x25519)
2526 (test_kem_openpgp_x25519, test_kem_cms_x25519): New.
2527 (check_kem, main): Add tests for ECC KEM.
2528
2529 2024-03-27 NIIBE Yutaka <[email protected]>
2530 Falko Strenzke <[email protected]>
2531
2532 tests:basic: Add cSHAKE test vectors.
2533 + commit b81076beba280c24923b0259a8973c777204c5df
2534 * tests/basic.c (check_one_md): Extend with customization N and S.
2535 (check_one_md_multi): Likewise.
2536 (check_digests): Add test vectors for GCRY_MD_CSHAKE128 and
2537 GCRY_MD_CSHAKE256.
2538
2539 2024-03-27 NIIBE Yutaka <[email protected]>
2540
2541 md: Add cSHAKE digest algorithm and the implementation.
2542 + commit 065b3f4e0271cc410c002842ea640f93e56c6a20
2543 * src/gcrypt.h.in (gcry_ctl_cmds): Add GCRYCTL_MD_CUSTOMIZE.
2544 (gcry_md_algos): Add GCRY_MD_CSHAKE128 and GCRY_MD_CSHAKE256.
2545 (struct gcry_cshake_customization): New.
2546 * cipher/keccak.c (CSHAKE_DELIMITED_SUFFIX): New.
2547 (keccak_init): Support GCRY_MD_CSHAKE128 and GCRY_MD_CSHAKE256.
2548 (selftests_keccak): Likewise.
2549 (cshake_input_n, cshake_input_s, _gcry_cshake_customize): New.
2550 (cshake128_init, cshake256_init, cshake_hash_buffers): New.
2551 (_gcry_cshake128_hash_buffers, _gcry_cshake256_hash_buffers): New.
2552 (_gcry_digest_spec_cshake128, _gcry_digest_spec_cshake256): New.
2553 * cipher/md.c (digest_list): Add cSHAKE md_specs.
2554 (digest_list_algo301): Likewise.
2555 (md_customize): New.
2556 (_gcry_md_ctl): Support GCRYCTL_MD_CUSTOMIZE.
2557 * src/cipher.h (_gcry_cshake_customize): New.
2558 (_gcry_digest_spec_cshake128, _gcry_digest_spec_cshake256): New.
2559 * src/fips.c (_gcry_fips_indicator_md): Support GCRY_MD_CSHAKE128 and
2560 GCRY_MD_CSHAKE256.
2561 * tests/basic.c (check_one_md): Support GCRY_MD_CSHAKE128 and
2562 GCRY_MD_CSHAKE256 as xof.
2563 (check_one_md_multi): Exclude GCRY_MD_CSHAKE128 and GCRY_MD_CSHAKE256
2564 as xof.
2565 * tests/bench-slope.c (hash_bench, kdf_bench): Exclude
2566 GCRY_MD_CSHAKE128 and GCRY_MD_CSHAKE256.
2567 * tests/benchmark.c (md_bench): Exclude GCRY_MD_CSHAKE128 and
2568 GCRY_MD_CSHAKE256.
2569
2570 2024-03-11 NIIBE Yutaka <[email protected]>
2571
2572 Add gcry_md_hash_buffers_ext function.
2573 + commit 3d48e6e37b040c955a84e58ce3147562fa74d1f3
2574 * src/gcrypt.h.in (gcry_md_hash_buffers_ext): New.
2575 * src/libgcrypt.def: Add gcry_md_hash_buffers_ext.
2576 * src/libgcrypt.vers: Likewise.
2577 * src/visibility.c: Add gcry_md_hash_buffers_ext.
2578 * src/visibility.h: Add gcry_md_hash_buffers_ext.
2579
2580 2024-03-05 NIIBE Yutaka <[email protected]>
2581
2582 kem: Fix the previous commit.
2583 + commit f4bcc69c3c9b0c2c948a9944cec7894cb590b211
2584 * cipher/kem.c (kem_compute_keygrip): Rever the change.
2585
2586 2024-03-04 NIIBE Yutaka <[email protected]>
2587
2588 cipher: Fix Kyber key in SEXP, and its keygrip computation.
2589 + commit 47c594386ebec3f9dea2d091c38cc7768a1840d9
2590 * cipher/kem.c (kem_generate): Include public key part in SEXP of
2591 private key.
2592 (kem_compute_keygrip): Fix keygrip computation.
2593
2594 mpi: Fix ECC computation on hppa.
2595 + commit b757f4130af987bdfc769b754b6e9e27882c349c
2596 * mpi/ec-inline.h [__hppa] (ADD4_LIMB32, SUB4_LIMB32): New.
2597 * mpi/longlong.h [__hppa] (add_ssaaaa, sub_ddmmss): Add __CLOBBER_CC.
2598
2599 2024-03-03 NIIBE Yutaka <[email protected]>
2600
2601 tests: Fix the previous commit.
2602 + commit 23ccf8eafbc452fa5cf466bee219846400bd2424
2603 * tests/keygen.c (check_kem_keys): Those are not yet in the standard.
2604
2605 2024-03-02 NIIBE Yutaka <[email protected]>
2606
2607 tests: Fix keygen for FIPS mode.
2608 + commit 58f93ea56f7173a5fc3f85710dbf167cb0e5e203
2609 * tests/keygen.c (check_kem_keys): Care about FIPS mode.
2610
2611 2024-02-29 NIIBE Yutaka <[email protected]>
2612
2613 mpi: Silence warning for some architecture.
2614 + commit 813a96de4ffec5d72dbb4473a42bd2b5b3f56b50
2615 * mpi/mpih-const-time.c (mpih_ct_limb_greater_than): DIFF_LO is not
2616 used.
2617
2618 2024-02-22 Werner Koch <[email protected]>
2619
2620 cipher: Add a way to get a keygrip for KEM algos.
2621 + commit 4db7f3b07be5fc7b4c1c3b2e7548167cb1968533
2622 * src/gcrypt.h.in (GCRY_PK_KEM): New.
2623 * cipher/kem.c (kem_infos): New.
2624 (kem_names): New.
2625 (kem_generate): New.
2626 (kem_compute_keygrip): New.
2627 (kem_get_nbits): New.
2628 (_gcry_pubkey_spec_kem): New.
2629 * cipher/pubkey.c (pubkey_list): Add spec for KEM.
2630 * src/cipher.h (_gcry_pubkey_spec_kem): Declare.
2631 (_gcry_pubkey_spec_elg_e): Remove this used declaration.
2632
2633 * tests/keygen.c (check_generated_kem_key): New.
2634 (check_kem_keys): New.
2635 (main): Add optional argument kem and all new function.
2636
2637 cipher: Slight refactoring of kem.c.
2638 + commit b36aee33dd00906a98d5d1295bf471140844f737
2639 * cipher/kem.c (_gcry_kem_keypair): Do not claim used variables.
2640 Slight refactoring to allow for a enum-case check.
2641 (_gcry_kem_encap): Ditto.
2642 (_gcry_kem_decap): Ditto.
2643
2644 * cipher/kyber.h (crypto_kem_keypair_3) [KYBER_K]: Fix syntax error.
2645
2646 2024-02-09 Clemens Lang <[email protected]>
2647
2648 sha3: Fill OIDs and partial ASN.1 structs.
2649 + commit b3750fb42a44760e65d8869bc9a64e79197ae96d
2650 * cipher/keccak.c (sha3_224_asn): New.
2651 (oid_spec_sha3_224, oid_spec_sha3_256): Update the OIDs.
2652 (sha3_256_asn): Have a correct value.
2653 (sha3_384_asn): Have a correct value.
2654 (oid_spec_sha3_384, oid_spec_sha3_512): Update the OIDs.
2655 (sha3_512_asn): Have a correct value.
2656 (shake128_asn): Have a correct value.
2657 (oid_spec_shake128, oid_spec_shake256): Update the OIDs.
2658 (shake256_asn): Have a correct value.
2659
2660 2024-02-06 Werner Koch <[email protected]>
2661
2662 doc: Fix link to the s-expression description.
2663 + commit 52f18b9ffe6ce38eba159c39550c10a95bce3d11
2664 Note that there is also thr description at
2665
2666 https://people.csail.mit.edu/rivest/pubs
2667 /RL96.ver-1.1.html#secSexpressions
2668
2669 2024-02-04 Jussi Kivilinna <[email protected]>
2670
2671 Fix Kyber segfaulting on Win64.
2672 + commit 0929a9f1ede27dc6c629a92d92002da14eafa68a
2673 * cipher/kyber.c (prg, pkprf): Cast variadic parameters to expected
2674 types ('void *' and 'size_t').
2675
2676 rijndael-s390x: fix AES256-XTS feature mask.
2677 + commit 679b07898897e16029dbf596dbcf0141ebb99792
2678 * cipher/rijndael-s390x.c (_gcry_aes_s390x_setup_acceleration): Fix
2679 AES256-XTS feature mask.
2680
2681 2024-01-30 NIIBE Yutaka <[email protected]>
2682
2683 cipher:kdf: Add X963KDF for use in CMS.
2684 + commit 3abac420b30ad4aeef803b23995303ac6bb563fa
2685 * src/gcrypt.h.in (gcry_kdf_algos): Add GCRY_KDF_X963_KDF.
2686 * cipher/kdf.c (x963_kdf_open, x963_kdf_compute): New.
2687 (x963_kdf_final, x963_kdf_close): New.
2688 (_gcry_kdf_open, _gcry_kdf_final, _gcry_kdf_close): Add
2689 support for GCRY_KDF_X963_KDF.
2690
2691 Fix the version script for non-existing symbols.
2692 + commit be328b4a3476d5cbe543a761c043c5923ea1e280
2693 * src/libgcrypt.vers: Remove gcry_md_get and gcry_pk_register.
2694
2695 2024-01-29 NIIBE Yutaka <[email protected]>
2696
2697 build: Use @FGREP@ by configure for libgcrypt-config.
2698 + commit 128121e74b66793fabd24e478df6ea2ab568e24a
2699 * configure.ac (AC_PROG_FGREP): Add.
2700 * src/libgcrypt-config.in: Use @FGREP@.
2701
2702 2024-01-16 NIIBE Yutaka <[email protected]>
2703
2704 tests: Fix tests/basic.
2705 + commit 86812491c7541a6e76cc2f2c45538b4715121b88
2706 * tests/basic.c (check_ecb_cipher): Use 'i' instead of '0'.
2707
2708 m4: Update acinclude.m4 to use $GREP.
2709 + commit 656ca459e3d87f91dc20a2fb1001344f4c872ee3
2710 * acinclude.m4: Use $GREP, instead of egrep. Simplify the detection.
2711
2712 2024-01-15 NIIBE Yutaka <[email protected]>
2713
2714 cipher: Fix copyright notices for LGPL.
2715 + commit 2eaaa8846f226ccd54f3165afe10583936d9d940
2716 * cipher/kem.c: Fix LGPL name, with correct capitalizing..
2717 * cipher/kyber-common.c: Likewise.
2718 * cipher/kyber-kdep.c: Likewise.
2719 * cipher/kyber.c: Likewise.
2720 * cipher/kyber.h: Likewise.
2721 * cipher/sntrup761.c: Likewise.
2722 * cipher/sntrup761.h: Likewise.
2723
2724 tests: Add known answers test for ML-KEM (Kyber).
2725 + commit 6765916e3b55dc45d93123e789973c7528df5232
2726 * tests/Makefile.am (tests_bin): Add t-mlkem.
2727 (EXTRA_DIST): Add t-mlkem.inp.
2728 * tests/t-mlkem.c: New.
2729 * tests/t-mlkem.inp: New.
2730
2731 cipher:kyber: Fix comment style.
2732 + commit 384638bc4a0dd4315ce2955d08f51f007ba88df9
2733 * cipher/kyber-common.c: Fix comments.
2734 * cipher/kyber-kdep.c: Likewise.
2735 * cipher/kyber.c: Likewise.
2736
2737 cipher: Add use of the Kyber implementation.
2738 + commit f2f9d56358acf3b38764bc4465db627162f42bbf
2739 * cipher/Makefile.am (EXTRA_DIST): Add kyber-common.c kyber-kdep.c.
2740 (libcipher_la_SOURCES): Add kyber.c and kyber.h.
2741 * cipher/kem.c (_gcry_kem_keypair): Add call to kyber_keypair.
2742 (_gcry_kem_encap): Add call to kyber_encap.
2743 (_gcry_kem_decap): Add call to kyber_decap.
2744 * tests/t-common.h (show_note): Factor from existing uses.
2745 (show_sexp, prepend_srcdir, read_textline, copy_data): Likewise.
2746 (hex2buffer, reverse_buffer): Likewise.
2747 * tests/t-kem.c (show_note): Remove.
2748 (test_kem_sntrup761): Rename from test_kem.
2749 (test_kem_mlkem512, test_kem_mlkem768, test_kem_mlkem1024): New.
2750 (check_kem): Add N_LOOPS argument. Call relevant tests by the
2751 variable SELECTED_ALGO.
2752 (main): Add option handling to select testing specific algorithm.
2753
2754 cipher:kyber: Modify VERIFY function.
2755 + commit 5c9c4dca39f2806443aaec60972e648715d3b048
2756 * cipher/kyber-kdep.c (crypto_kem_dec): Use verify1.
2757 * cipher/kyber.c (verify1): Return 1 when success.
2758
2759 cipher:kyber: Modification for xof_ routines.
2760 + commit fe3ecf810370086df40f4cc980d0a290e5f3a9a5
2761 * cipher/kyber-kdep.c (gen_matrix): Remove comment for
2762 gen_matrix. Add calls to xof_init and xof_close.
2763
2764 cipher:kyber: Integrate into libgcrypt, adding glue code.
2765 + commit 4e9aa70078c5537f1c56f54e78d769c8b5dc9f0c
2766 * cipher/kyber-common.c: Add copyright notice.
2767 * cipher/kyber-kdep.c: Likewise.
2768 * cipher/kyber.c: Likewise.
2769 * cipher/kyber-kdep.c: Add #undef to clear the definitions.
2770 * cipher/kyber.c: Integrate into libgcrypt, also allow standalone use.
2771
2772 cipher:kyber: Have cipher/kyber.h.
2773 + commit 31743c17d7bd1f6dc653e6dfcf76fab5356649ae
2774 * cipher/kyber.h: New.
2775
2776 cipher:kyber: Move declarations to kyber-kdep.c.
2777 + commit b6e20ed580e08278eb963a87f6355c43ba0d34d2
2778 * cipher/kyber.c: Move KYBER_K-dependent declarations into...
2779 * cipher/kyber-kdep.c: ... here, or kyber.h.
2780
2781 cipher:kyber: Functions in poly for different KYBER_K.
2782 + commit efd55d9ecae549318425dc7a867c9698cbc78410
2783 * cipher/kyber-common.c (load24_littleendian, cbd3): Fix the
2784 compile-time condition.
2785 (poly_cbd_eta1, poly_cbd_eta2): Remove.
2786 (zetas): Don't export.
2787 (poly_compress): Remove.
2788 (poly_compress_128, poly_compress_160): New.
2789 (poly_decompress): Remove.
2790 (poly_decompress_128, poly_decompress_160): New.
2791 (poly_getnoise_eta1): Remove.
2792 (poly_getnoise_eta1_2): New. Directly call cbd3.
2793 (poly_getnoise_eta1_3_4): New. Directly call cbd2.
2794 (poly_getnoise_eta2): Directly call cbd2.
2795 * cipher/kyber.c: Fix declarations for poly_compress,
2796 poly_decompress and poly_getnoise_eta1.
2797
2798 cipher:kyber: Make the implementation into three files.
2799 + commit 01a14c0df2957900903895a3c49de2bdb708816f
2800 * cipher/kyber-common.c: New. Common part.
2801 * cipher/kyber-kdep.c: New. KYBER_K dependent part.
2802 * cipher/kyber.c: Move functions and variables to two files.
2803
2804 cipher:kyber: Constants common and k-dependent.
2805 + commit fc35a5372a74c696f45b10dccbb84331673412b4
2806 * cipher/kyber.c (KYBER_ETA1): Remove.
2807 (KYBER_ETA1_2, KYBER_ETA1_3_4): New.
2808 (KYBER_POLYCOMPRESSEDBYTES): Remove.
2809 (KYBER_POLYCOMPRESSEDBYTES_2_3): New.
2810 (KYBER_POLYCOMPRESSEDBYTES_4): New.
2811
2812 cipher:kyber: Export the KEM API only.
2813 + commit 34dd0a1a75b2ee37ccd1215235f8b9f00f38bff1
2814 * cipher/kyber.c: Don't export other functions and data.
2815
2816 cipher: Editorial clean up cipher/kyber.c for headers.
2817 + commit 4b601fe5b3cff021e265df6eb64911e6a8105bd3
2818 * cipher/kyber.c: Clean up.
2819
2820 cipher: Add headers to Kyber implementation.
2821 + commit 10e9bcd5c67ed40292b06901b38fa9b94ccc09ba
2822 * cipher/kyber.c: Add headers from the reference implementation.
2823
2824 cipher: Put the original Kyber implementation.
2825 + commit 18e5c0d268b1aeac59f526b9730b39520750ca14
2826 * cipher/kyber.c: Kyber reference implementation.
2827
2828 cipher: Allow standalone use of SNTRUP761 implementation.
2829 + commit bdadd65d440b7f689f49450530a548c32007f71b
2830 * cipher/sntrup761.c [HAVE_CONFIG_H]: Conditionalize.
2831
2832 2024-01-08 NIIBE Yutaka <[email protected]>
2833
2834 Avoid use of C99 feature for enum.
2835 + commit dbfb7cc76ef3f98fe62f0549b97d76f395864ae0
2836 * src/gcrypt.h.in (enum gcry_kdf_algos): Remove last comma.
2837 (enum gcry_kem_algos): Likewise.
2838
2839 2023-12-21 Jussi Kivilinna <[email protected]>
2840
2841 bench-slope: restore compiler barriers for auto-GHZ check.
2842 + commit c9cb10f3be226dfd65c670ff2565d81dfc668376
2843 * tests/bench-slope.c (auto_ghz_bench): Add memory barriers to
2844 AUTO_GHZ_OPERATION macro when barrier is supported by compiler.
2845
2846 mpi/ec-inline: refactor i386 assembly to reduce register usage.
2847 + commit 956f1ed4ec6ead59dc56f574f943f1fe25dac723
2848 * mpi/ec-inline.h [__i386__] (ADD2_LIMB32_CARRY_OUT)
2849 (ADD2_LIMB32_CARRY_IN_OUT, ADD2_LIB32_CARRY_IN, SUB2_LIMB32_CARRY_OUT)
2850 (SUB2_LIMB32_CARRY_IN_OUT, SUB2_LIB32_CARRY_IN, ADD8_LIMB32)
2851 (ADD10_LIMB32, ADD14_LIMB32, SUB8_LIMB32, SUB10_LIMB32)
2852 (SUB14_LIMB32): New.
2853 [__i386__] (ADD4_LIMB32, ADD6_LIMB32, SUB4_LIMB32, SUB6_LIMB32): Rewrite
2854 to use new *_CARRY_* macros.
2855 [BYTES_PER_MPI_LIMB == 4] (ADD4_LIMB64): Use ADD8_LIMB32 if available.
2856 [BYTES_PER_MPI_LIMB == 4] (ADD5_LIMB64): Use ADD10_LIMB32 if available.
2857 [BYTES_PER_MPI_LIMB == 4] (ADD7_LIMB64): Use ADD14_LIMB32 if available.
2858 [BYTES_PER_MPI_LIMB == 4] (SUB4_LIMB64): Use SUB8_LIMB32 if available.
2859 [BYTES_PER_MPI_LIMB == 4] (SUB5_LIMB64): Use SUB10_LIMB32 if available.
2860 [BYTES_PER_MPI_LIMB == 4] (SUB7_LIMB64): Use SUB14_LIMB32 if available.
2861
2862 2023-12-16 Jussi Kivilinna <[email protected]>
2863
2864 mpi/ec-nist: fix for -Og build failure on i386.
2865 + commit 90097bd2f41c217dc5c666570e5680f432cf92d3
2866 * mpi/ec-nist.c (_gcry_mpi_ec_nist256_mod)
2867 (_gcry_mpi_ec_nist384_mod): Load p_mult constant with carry offset
2868 to stack.
2869
2870 2023-12-12 NIIBE Yutaka <[email protected]>
2871
2872 tests: Update digest values following input changes.
2873 + commit 4a104752d8a2f0ca15d7873011a14226925a773b
2874 * tests/basic.c (check_digests): Update the values.
2875
2876 2023-12-12 Andreas Metzler <[email protected]>
2877
2878 Point to gnu.org as canonical license location.
2879 + commit cd056b4d1614e9e245b66782b54aad1697e22a01
2880
2881
2882 Fix license header inconsistency.
2883 + commit 25e93a02268b9f533b1ffa4f6a5fe47d686e2145
2884
2885
2886 Unify capitalization of LGPL copyright statements.
2887 + commit ca5689367a837b6541307f6ae19e0176b051d06f
2888
2889
2890 2023-12-08 NIIBE Yutaka <[email protected]>
2891
2892 cipher: Fix sntrup761.h, so that it can be used outside.
2893 + commit ebc9aaacd62bbc7f048020531398ccb9f97e4437
2894 * cipher/sntrup761.h [_GCRYPT_IN_LIBGCRYPT]: Ifdef-out
2895 libgcrypt specific glue code. Recover the constants.
2896
2897 cipher: Minor fix for C90 compiler.
2898 + commit 2149888d47afea9946c3a748310ad27dfcda48c3
2899 * cipher/sntrup761.c (crypto_sort_int32): Declare A, before its use.
2900
2901 2023-12-07 NIIBE Yutaka <[email protected]>
2902
2903 cipher: Add sntrup761 to KEM API.
2904 + commit 947ad42450eadec079a1c50deba90e6453f0113c
2905 * cipher/kem.c (sntrup761_random): New glue code.
2906 ( _gcry_kem_keypair, _gcry_kem_encap, _gcry_kem_decap): Call sntrup761
2907 functions.
2908 * cipher/sntrup761.h: Add glue code to libgcrypt.
2909 * src/visibility.h: Update for KEM functions.
2910 * tests/t-kem.c: Fix for the final KEM API.
2911
2912 2023-12-07 Simon Josefsson <[email protected]>
2913
2914 cipher: Add Streamlined NTRU Prime sntrup761.
2915 + commit cf9923e1a59f2f535311f3676345d34e593ba108
2916 * cipher/Makefile.am (libcipher_la_SOURCES): Add sntrup761.c and h.
2917 * cipher/sntrup761.c: New.
2918 * tests/Makefile.am (tests_bin): Add t-kem.
2919 * tests/t-kem.c: New.
2920
2921 2023-12-07 NIIBE Yutaka <[email protected]>
2922
2923 Add an API for Key Encapsulation Mechanism.
2924 + commit 7e503fa9170fd290105714d15a335f7748860e23
2925 * cipher/Makefile.am (libcipher_la_SOURCES): Add kem.c.
2926 * cipher/kem.c: New.
2927 * src/gcrypt-int.h (_gcry_kem_keypair, _gcry_kem_encap)
2928 (_gcry_kem_decap): New.
2929 * src/gcrypt.h.in (gcry_kem_keypair, gcry_kem_encap)
2930 (gcry_kem_decap): New. Add constants.
2931 * src/libgcrypt.def (gcry_kem_keypair, gcry_kem_encap)
2932 (gcry_kem_decap): Add symbols.
2933 * src/libgcrypt.vers: Likewise.
2934
2935 2023-11-22 NIIBE Yutaka <[email protected]>
2936
2937 tests: Fix t-x448 for error handling.
2938 + commit dc1c916da4ba3960495bca450d8f4bc6897d9167
2939 * tests/t-x448.c (test_cv_x448): Take the error code from ERR.
2940
2941 2023-11-16 NIIBE Yutaka <[email protected]>
2942
2943 cipher: Fix return type of _gcry_ecc_mul_point.
2944 + commit 354e53558e55fe5bc8fa4be32e1c1bace7623536
2945 * cipher/ecc-ecdh.c (_gcry_ecc_mul_point): Return gpg_err_code_t.
2946 * src/gcrypt-int.h (_gcry_ecc_mul_point): Return gpg_err_code_t.
2947 * src/visibility.c (gcry_ecc_mul_point): Follow the change.
2948
2949 2023-11-04 Jussi Kivilinna <[email protected]>
2950
2951 mpih_mod: avoid unintentional conditional branch.
2952 + commit 39d5364a9557d6f423de117601cb1e6414814f47
2953 * mpi/mpih-const-time.c (_gcry_mpih_mod): Avoid conditional branch
2954 on the_bit extraction.
2955
2956 mpih-const-time: use constant-time comparisons conditional add/sub/abs.
2957 + commit c419a04d529af7b5fb43732ec2b4304166c2579a
2958 * mpi/mpih-const-time.c (mpih_ct_limb_greater_than)
2959 (mpih_ct_limb_less_than): New.
2960 (_gcry_mpih_add_n_cond, _gcry_mpih_sub_n_cond, _gcry_mpih_abs_cond): Use
2961 mpih_ct_limb_greater_than and mpih_ct_limb_less_than for comparisons.
2962
2963 const-time: add functions for generating masks from 0/1 input.
2964 + commit cf757cf90e9ae966b95dcebfd2f31b9212697f0c
2965 * mpi/ec-nist.c (_gcry_mpi_ec_nist192_mod, _gcry_mpi_ec_nist224_mod)
2966 (_gcry_mpi_ec_nist256_mod, _gcry_mpi_ec_nist384_mod): Use mask generating
2967 functions.
2968 * mpi/mpi-internal.h (ct_limb_gen_mask, ct_limb_gen_inv_mask): New.
2969 * mpi/mpih-const-time.c (_gcry_mpih_set_cond, _gcry_mpih_add_n_cond)
2970 (_gcry_mpih_sub_n_cond, _gcry_mpih_sub_n_cond, _gcry_mpih_swap_cond): Use
2971 mask generating functions.
2972 * mpi/mpiutil.c (_gcry_mpi_set_cond, _gcry_mpi_swap_cond): Use mask
2973 generating functions.
2974 * src/const-time.h (DEFINE_CT_TYPE_GEN_MASK, ct_uintptr_gen_mask)
2975 (ct_ulong_gen_mask, DEFINE_CT_TYPE_GEN_INV_MASK, ct_uintptr_gen_inv_mask)
2976 (ct_ulong_gen_inv_mask): New.
2977 (DEFINE_CT_TYPE_SELECT_FUNC): Use mask generating functions.
2978 * src/const-time.c (_gcry_ct_memmov_cond): Use mask generating functions.
2979
2980 ec: avoid unintentional condition branches for 25519, 448 and 256k1.
2981 + commit 305a65c1ede8f78160100478d46efa199d334a64
2982 * mpi/ec.c (ec_addm_25519, ec_subm_25519, ec_mulm_25519, ec_addm_448)
2983 (ec_subm_448, ec_mulm_448, ec_secp256k1_mod): Use mpih_limb_is_zero
2984 and mpih_limb_is_not_zero instead of comparison to zero.
2985
2986 ec-nist: avoid unintentional conditional branch by comparison.
2987 + commit a9e7aa647e4b84964c76230370d71235383e5c2d
2988 * mpi/ec-nist.c (_gcry_mpi_ec_nist521_mod): Use mpih_limb_is_not_zero.
2989 * mpi/mpi-internal.h (mpih_limb_is_not_zero): New.
2990
2991 mpih_cmp_ui: avoid unintentional conditional branch.
2992 + commit aab6a42d5f44724b73a02598546a5e7d8b33298e
2993 * mpi/mpi-internal.h (mpih_limb_is_zero): New.
2994 * mpi/mpih-const-time.c (_gcry_mpih_cmp_ui): Use mpih_limb_is_zero
2995 instead of comparison.
2996
2997 ec-nist: use global vone and vzero.
2998 + commit 5c5ba1ec2b505726ee1311339ac9e8b5c62cac4a
2999 * mpi/ec-nist.c (vzero, vone): Remove.
3000 (_gcry_mpi_ec_nist192_mod, _gcry_mpi_ec_nist224_mod)
3001 (_gcry_mpi_ec_nist256_mod, _gcry_mpi_ec_nist384_mod): Use _gcry_ct_vzero
3002 and _gcry_ct_vone.
3003
3004 mpiutil: use global vone and vzero.
3005 + commit d4aee9ace9a904446b987dddc2999119c4d62dae
3006 * mpi/mpiutil.c (_gcry_mpi_set_cond, _gcry_mpi_swap_cond): Use
3007 _gcry_ct_vzero and _gcry_ct_vone.
3008
3009 mpih-const-time: use global vzero/vone variable.
3010 + commit 179df341162c74da312f76363a0ff1f2f303aa78
3011 * mpi/mpih-const-time.c (vzero, vone): Remove.
3012 (_gcry_mpih_set_cond, _gcry_mpih_add_n_cond, _gcry_mpih_sub_n_cond)
3013 (_gcry_mpih_swap_cond, _gcry_mpih_abs_cond): Use _gcry_ct_vzero and
3014 _gcry_ct_vone.
3015
3016 const-time: ct_memmov_cond: switch to use dual mask approach.
3017 + commit 4d3e0e30b98b2acb90acb2792b8327c26824a66f
3018 * src/const-time.c (_gcry_ct_memmov_cond): Use dual mask + AND/OR
3019 instead of single mask + XOR.
3020
3021 const-time: prefix global symbols with _gcry_
3022 + commit 22dde5150ee2be01651410ed9756601ba6a29c93
3023 * cipher/const-time.c (ct_not_memequal, ct_memequal)
3024 (ct_memmov_cond): Rename these to ...
3025 (_gcry_ct_not_memequal, _gcry_ct_memequal)
3026 (_gcry_ct_memmov_cond): ... these.
3027 * cipher/const-time.h (ct_not_memequal, ct_memequal)
3028 (ct_memmov_cond): Rename these to ...
3029 (_gcry_ct_not_memequal, _gcry_ct_memequal)
3030 (_gcry_ct_memmov_cond): ... these.
3031 (ct_not_memequal, ct_memequal, ct_memmov_cond): New macros.
3032
3033 mpih_set_cond: restore EM leakage mitigation.
3034 + commit 0c6ec6bbe788b8c4a6982b2128d442b51323c898
3035 * mpi/mpih-const-time.c (_gcry_mpih_set_cond): Replace single mask + XOR
3036 with dual mask + AND/OR; Add comment about reason for dual mask usage.
3037 (_gcry_mpih_add_n_cond, _gcry_mpih_sub_n_cond, _gcry_mpih_swap_cond)
3038 (_gcry_mpih_abs_cond): Add comment about reason for dual mask usage.
3039
3040 rsa, elgamal: avoid logical not operator in constant-time code.
3041 + commit 84f934c09afac18b3f4351646c0fe6f93aede277
3042 * cipher/elgamal.c (elg_decrypt): Replace ! operator with calls to
3043 ct_is_not_zero/ct_is_zero/ct_ulong_select.
3044 * cipher/rsa-common.c (_gcry_rsa_pkcs1_decode_for_enc): Replace !
3045 operator with call to ct_is_zero.
3046 * cipher/rsa.c (rsa_decrypt): Replace ! operator with calls to
3047 ct_is_not_zero/ct_is_zero/ct_ulong_select.
3048 * src/const-time.c (_gcry_ct_vzero, _gcry_ct_vone): New.
3049 * src/const-time.h (_gcry_ct_vzero, _gcry_ct_vone): New.
3050 (ct_is_not_zero, ct_is_zero, DEFINE_CT_TYPE_SELECT_FUNC)
3051 (ct_uintptr_select, ct_ulong_select): New.
3052 (sexp_null_cond): Use ct_uintptr_select.
3053
3054 const-time: always avoid comparison operator for byte comparison.
3055 + commit 137e35ad47ee8734d0f3ffb6af1d1669c4621e0b
3056 * configure.ac: Remove POSSIBLE_CONDITIONAL_BRANCH_IN_BYTE_COMPARISON
3057 macro.
3058 * src/const-time.h (ct_not_equal_byte): Remove
3059 POSSIBLE_CONDITIONAL_BRANCH_IN_BYTE_COMPARISON ifdef.
3060
3061 Use single constant-time memory comparison implementation.
3062 + commit 1e9ddbd65c4627235611d75c3198c4ec197c9a05
3063 * src/const-time.c (ct_not_memequal): Use original 'buf_eq_const'
3064 implementation here.
3065 (ct_memequal): New.
3066 * cipher/bufhelp.h (buf_eq_const): Call to 'ct_memequal'.
3067
3068 2023-11-01 Jussi Kivilinna <[email protected]>
3069
3070 bench-slope: update auto-GHZ for alderlake-P.
3071 + commit a047a9c7d10824593d5c9ae43d8a3d6319ef3c0b
3072 * tests/bench-slope.c (vone): New.
3073 (auto_ghz_bench): Remove memory barrier usage; Generate constant
3074 values from volatile variable.
3075
3076 2023-10-31 NIIBE Yutaka <[email protected]>
3077
3078 cipher: Fix ElGamal decryption.
3079 + commit 6d1d50ba3aad1850975f717adbedb4cb8b236fa7
3080 * cipher/elgamal.c (elg_decrypt): Call sexp_build always.
3081 * cipher/rsa.c (rsa_decrypt): Return an error code of sexp_build
3082 when RC != 0.
3083
3084 rsa: Use memmov_independently when unpadding.
3085 + commit 58b62be844549ad3d57c507d834027f1e2756567
3086 * cipher/rsa-common.c (memmov_independently): New.
3087 (_gcry_rsa_pkcs1_decode_for_enc): Use memmov_independently.
3088 (_gcry_rsa_oaep_decode): Use memmov_independently.
3089
3090 const-time: Add ct_memmov_cond, fix _gcry_mpih_set_cond.
3091 + commit bd08357436a9559766cd458d25781ee4f94012a2
3092 * src/const-time.c (ct_memmov_cond): New.
3093 * src/const-time.h (ct_memmov_cond): New.
3094 * mpi/mpih-const-time.c (_gcry_mpih_set_cond): Use XOR and a MASK.
3095
3096 2023-10-30 NIIBE Yutaka <[email protected]>
3097
3098 const-time: Use ct_not_memequal, instead. Tested with AVR.
3099 + commit c31b70b2660c3d24bd54ee08c255c36d867fdea7
3100 * cipher/rsa-common.c (_gcry_rsa_oaep_decode): Use ct_not_memequal.
3101 * src/const-time.c (ct_not_memequal): Use ct_not_equal_byte.
3102 * src/const-time.h (ct_not_memequal): Rename from ct_memequal.
3103
3104 build: Check if arch is VAX or compiler is MSVC.
3105 + commit c848459e512615c1865a23cf24debb3ad4a1e85b
3106 * configure.ac (AH_BOTTOM): Add check for VAX and MSVC.
3107 * src/const-time.h (POSSIBLE_CONDITIONAL_BRANCH_IN_BYTE_COMPARISON):
3108 Rename.
3109
3110 2023-10-27 NIIBE Yutaka <[email protected]>
3111
3112 rsa: Fix decoding of PKCS#1 v1.5 and OAEP padding.
3113 + commit 34c20427926010d6fa95b1666e4b1b60f60a8742
3114 * src/Makefile.am (libgcrypt_la_SOURCES): Add const-time.h and
3115 const-time.c.
3116 * src/const-time.h (ct_not_equal_byte, sexp_null_cond): New.
3117 (ct_memequal): New from NetBSD, modified return type and name.
3118 * src/const-time.c: New.
3119 * cipher/rsa-common.c (_gcry_rsa_pkcs1_decode_for_enc): Examine whole
3120 sequence of the byte-array. Use N0 to find the separator position, with
3121 ct_not_equal_byte. Return the MPI even when the case of an error.
3122 * cipher/rsa-common.c (_gcry_rsa_oaep_decode): Use ct_memequal to
3123 check LHASH. Examine all the sequence of the byte-array. Use N1 to
3124 find the separator of 0x01. Return the MPI even when the case of an
3125 error.
3126 * cipher/rsa.c (rsa_decrypt): Always build a SEXP.
3127
3128 2023-10-06 NIIBE Yutaka <[email protected]>
3129
3130 sexp: Minor clean-up of sexp output handling.
3131 + commit 5e5dff0551fcd9a826db18188fa1e4a6ca45099a
3132 * src/sexp.c (suitable_encoding): Remove check for starting zero.
3133
3134 2023-10-05 NIIBE Yutaka <[email protected]>
3135
3136 doc: Minor style fixes.
3137 + commit edddc5738e6b1652ccc5db6861888de66112427f
3138
3139
3140 sexp: String with \0 is considered "binary".
3141 + commit ddd41eb6ace02626b0bf7704fdec9b765fb717c4
3142 * src/sexp.c (suitable_encoding): It's "binary" when
3143 the buffer contains '\0'.
3144
3145 2023-09-15 Jussi Kivilinna <[email protected]>
3146
3147 blake2-avx512: merge some of the gather loads.
3148 + commit 325786acd445f9e74e4c44ba86c5b4e06788ea46
3149 * cipher/blake2b-amd64-avx512.S (GATHER_MSG_2, GATHER_MSG_3)
3150 (GATHER_MSG_5, GATHER_MSG_6, GATHER_MSG_8, GATHER_MSG_9): New.
3151 (LOAD_MSG_2, LOAD_MSG_3, LOAD_MSG_5, LOAD_MSG_6, LOAD_MSG_8)
3152 (LOAD_MSG_9): Use GATHER_MSG_<number>.
3153 (_blake2b_avx512_data): Add merged load masks ".L[4-7]_mask".
3154 (_gcry_blake2b_transform_amd64_avx512): Load merged load masks
3155 to %k[4-7] and clear registers on exit.
3156 * cipher/blake2s-amd64-avx512.S (VPINSRD_KMASK, GATHER_MSG_2)
3157 (GATHER_MSG_3, GATHER_MSG_5, GATHER_MSG_6, GATHER_MSG_8)
3158 (GATHER_MSG_9): New.
3159 (LOAD_MSG_2, LOAD_MSG_3, LOAD_MSG_5, LOAD_MSG_6, LOAD_MSG_8)
3160 (LOAD_MSG_9): Use GATHER_MSG_<number>.
3161 (_blake2s_avx512_data): Add merged load masks ".L[4-7]_mask".
3162 (_gcry_blake2s_transform_amd64_avx512): Load merged load masks
3163 to %k[4-7] and clear registers on exit.
3164
3165 2023-09-01 NIIBE Yutaka <[email protected]>
3166
3167 build: Change the default for --with-libtool-modification.
3168 + commit 36d014f919d1c5f00dde4509da9b5e02895467c9
3169 * configure.ac (--with-libtool-modification): default=never.
3170
3171 2023-08-20 Jussi Kivilinna <[email protected]>
3172
3173 blake2b-avx512: replace VPGATHER with manual gather.
3174 + commit 59f14c1db37e16aba37af185dd0677f9783536ce
3175 * cipher/blake2.c (blake2b_init_ctx): Remove HWF_INTEL_FAST_VPGATHER
3176 check for AVX512 implementation.
3177 * cipher/blake2b-amd64-avx512.S (R16, VPINSRQ_KMASK, .Lshuf_ror16)
3178 (.Lk1_mask): New.
3179 (GEN_GMASK, RESET_KMASKS, .Lgmask*): Remove.
3180 (GATHER_MSG): Use manual gather instead of VPGATHER.
3181 (ROR_16): Use vpshufb for small speed improvement on tigerlake.
3182 (_gcry_blake2b_transform_amd64_avx512): New setup & clean-up for
3183 kmask registers; Reduce excess loop aligned from 64B to 16B.
3184
3185 twofish-avx2-amd64: replace VPGATHER with manual gather.
3186 + commit ded3a1ec2ec6980750e3e9eabde001cdbebece51
3187 * cipher/twofish-avx2-amd64.S (do_gather): New.
3188 (g16): Switch to use 'do_gather' instead of VPGATHER instruction.
3189 (__twofish_enc_blk16, __twofish_dec_blk16): Prepare stack
3190 for 'do_gather'.
3191 * cipher/twofish.c (twofish) [USE_AVX2]: Remove now unneeded
3192 HWF_INTEL_FAST_VPGATHER check.
3193
3194 Avoid VPGATHER usage for most of Intel CPUs.
3195 + commit f2bf9997d46590e688bad213267b8fb466e95ecd
3196 * cipher/blake2.c (blake2b_init_ctx): Check for fast VPGATHER
3197 for AVX512 implementation.
3198 * src/hwf-x86.c (detect_x86_gnuc): Do not enable
3199 HWF_INTEL_FAST_VPGATHER for Intel CPUs suffering from
3200 "Downfall" vulnerability.
3201
3202 2023-08-16 NIIBE Yutaka <[email protected]>
3203
3204 build: New configure option --with-libtool-modification.
3205 + commit 2143503b8f56a4e6909dc8b4f86e20c8ad76aaed
3206 * Makefile.am (EXTRA_DIST): Add build-aux/libtool-patch.sed.
3207 * build-aux/libtool-patch.sed: New.
3208 * configure.ac (--with-libtool-modification): New.
3209 * build-aux/ltmain.sh: Revert our own local modification.
3210
3211 2023-07-26 NIIBE Yutaka <[email protected]>
3212
3213 doc: yat2m-stamp should depend on version.texi.
3214 + commit f019c98fd418596074ffd2cc755be6c483aac932
3215 * doc/Makefile.am (yat2m-stamp): Depend on version.texi.
3216
3217 2023-07-17 Jussi Kivilinna <[email protected]>
3218
3219 hwf-x86: use CFI statements for 'is_cpuid_available'
3220 + commit a5f88f30ce612b0239b946c4424d81cf0d552e96
3221 * src/hwf-x86.c (FORCE_FUNC_FRAME_POINTER): Remove.
3222 (CFI_ADJUST_CFA_OFFSET, CFI_PUSH4, CFI_POP4): New.
3223 (is_cpuid_available): Use CFI statements instead of frame-pointer
3224 attribute.
3225
3226 configure: fix HAVE_GCC_ASM_CFI_DIRECTIVES check.
3227 + commit 35829d38d61fa3130d88eaeea1af2591a3f07208
3228 * cipher/camellia-aesni-avx2-amd64.h (enc_blk1_32): Fix dual
3229 CFI_ENDPROC() usage.
3230 * configure.ac (gcry_cv_gcc_asm_cfi_directives): Add missing ';'
3231 after 'void asmfunc(void)'.
3232 * mpi/asm-common-i386.h: New.
3233 * mpi/i386/syntax.h: Remove CFI macros and instead include
3234 "asm-common-i386.h".
3235
3236 Add VAES/AVX2 accelerated i386 implementation for AES.
3237 + commit 4a42a042bcf6b25f13957207c2d13d420f450bb8
3238 * cipher/Makefile.am: Add 'rijndael-vaes-i386.c' and
3239 'rijndael-vaes-avx2-i386.S'.
3240 * cipher/asm-common-i386.h: New.
3241 * cipher/rijndael-internal.h (USE_VAES_I386): New.
3242 * cipher/rijndael-vaes-avx2-i386.S: New.
3243 * cipher/rijndael-vaes-i386.c: New.
3244 * cipher/rijndael-vaes.c: Update header description (add 'AMD64').
3245 * cipher/rijndael.c [USE_VAES]: Add 'USE_VAES_I386' to ifdef around
3246 '_gcry_aes_vaes_*' function prototypes.
3247 (setkey) [USE_VAES_I386]: Add setup of VAES/AVX2/i386 bulk functions.
3248 * configure.ac: Add 'rijndael-vaes-i386.lo' and
3249 'rijndael-vaes-avx2-i386.lo'.
3250 (gcry_cv_gcc_amd64_platform_as_ok): Rename this to ...
3251 (gcry_cv_gcc_x86_platform_as_ok): ... this and change to check for
3252 both AMD64 and i386 assembler compatibility.
3253 (gcry_cv_gcc_win32_platform_as_ok): New.
3254
3255 rijndael-vaes-avx2-amd64: avoid extra load in CFB & CBC IV handling.
3256 + commit 13f288edd5274880cf6833c80eba24183440a66d
3257 * cipher/rijndael-vaes-avx2-amd64.S
3258 (_gcry_vaes_avx2_cbc_dec_amd64, _gcry_vaes_avx2_cfb_dec_amd64): Avoid
3259 duplicate memory load from source buffer.
3260
3261 rijndael-vaes-avx2-amd64: acceleration for OCB auth.
3262 + commit 6b47e85d65158f3b6b1c3c24476249bfe3a7f943
3263 * cipher/rijndael-vaes-avx2-amd64.S
3264 (_gcry_vaes_avx2_ocb_crypt_amd64): Add authentication mode support.
3265 * cipher/rijndael-vaes.c (_gcry_vaes_avx2_ocb_crypt_amd64): Change
3266 to return 'size_t' value.
3267 (_gcry_aes_vaes_ocb_auth): New.
3268 * cipher/rijndael.c (_gcry_aes_vaes_ocb_auth): New.
3269 (do_setkey) [USE_VAES]: Add setup for 'bulk_ops->ocb_auth'.
3270
3271 2023-07-14 Bernhard Reiter <[email protected]>
3272
3273 build: Fix the notice in configure.ac.
3274 + commit 77ce5866e06cb5ebd82a0ce34206395aa03b9352
3275 * configure.ac: Fix typo.
3276
3277 2023-07-12 NIIBE Yutaka <[email protected]>
3278
3279 Use unsigned int for a bit field.
3280 + commit e76e88eef7811ada4c6e1d57520ba8c439139782
3281 * random/random-drbg.c (struct drbg_state_ops_s): Use unsigned.
3282 (struct drbg_state_s): Likewise.
3283 * src/hmac256.c (struct hmac256_context): Likewise.
3284
3285 2023-06-28 NIIBE Yutaka <[email protected]>
3286
3287 cipher:ecc:fips: Only allow defined digest algo for EdDSA.
3288 + commit d15fe6aac10b0ffc2eb8974c23095d8123025e5c
3289 * cipher/ecc.c (ecc_sign): Add the check if it's proper digest
3290 algo for EdDSA on FIPS mode.
3291
3292 cipher:ecc:fips: Reject use of SHAKE when it's ECDSA with RFC6979.
3293 + commit f65c30d470f581e4df91a5aff8bb202ff0fd56ad
3294 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_sign): Check if it's SHAKE.
3295
3296 2023-06-25 Jussi Kivilinna <[email protected]>
3297
3298 keccak: add md_read support for SHAKE algorithms.
3299 + commit 794695ff45d64f6586d7f08e74c075c098ac3b5d
3300 * cipher/hash-common.c (_gcry_hash_selftest_check_one): Adjust
3301 for SHAKE algorithms now returning non-zero for digest length.
3302 * cipher/keccak.c (KECCAK_CONTEXT_S): Add 'shake_in_extract_mode'
3303 and 'shake_in_read_mode' flags.
3304 (keccak_init): Initialize new context fields; set output length
3305 for SHAKE algorithms.
3306 (keccak_extract): Rename to ...
3307 (do_keccak_extract): this and add return value.
3308 (keccak_extract): New with 'shake_in_???_mode' checks & setup.
3309 (keccak_shake_read): New.
3310 (_gcry_sha3_hash_buffers): Adjust for 'spec->mdlen' not being
3311 zero for SHAKE algorithms, instead check 'suffix' for type.
3312 (_gcry_digest_spec_shake128): Set mdlen to 32 bytes; Set read
3313 function.
3314 (_gcry_digest_spec_shake256): Set mdlen to 64 bytes; Set read
3315 function.
3316 * cipher/md.c (md_extract): Pass return value from algo extract
3317 function.
3318 (_gcry_md_hash_buffers_extract): Adjust for 'spec->mdlen' not
3319 being zero for SHAKE algorithms.
3320 * src/cipher-proto.h (gcry_md_extract_t): Change return type
3321 from 'void' to 'gpg_err_code_t'.
3322 * tests/basic.c (check_one_md, check_one_md_multi): Adjust
3323 for 'gcry_md_get_algo_dlen()' not being zero for SHAKE
3324 algorithms.
3325 (check_digests): Add md_read interface test-vectors for SHAKE128
3326 and SHAKE256.
3327
3328 2023-06-23 NIIBE Yutaka <[email protected]>
3329
3330 cipher:rsa: Add support of SHAKE as MGF.
3331 + commit 8802faadab79ec84714bbaf28eaa882860779cba
3332 * cipher/rsa-common.c (_gcry_rsa_pss_encode): Support SHAKE.
3333 (_gcry_rsa_pss_verify): Likewise.
3334
3335 2023-06-16 NIIBE Yutaka <[email protected]>
3336
3337 tests: Allow KDF measurement in FIPS mode.
3338 + commit 70b1b036f3ee06c5894e996cbd742cf3c174ca79
3339 * tests/bench-slope.c (bench_kdf_init): Tweak the iterations in FIPS
3340 mode.
3341 (bench_kdf_do_bench): Use larger values to avoid rejection in FIPS
3342 mode.
3343
3344 cipher:kdf: Move FIPS mode check to _gcry_kdf_derive.
3345 + commit f4bff832c7f5a54879c1858d7b426cd12088c57c
3346 * cipher/kdf.c (_gcry_kdf_pkdf2): Move the checks to...
3347 (_gcry_kdf_derive): ... here.
3348
3349 Remove out of core handler setting message in FIPS mode.
3350 + commit 6c79dcddd151b6b01a760f7aab54e6882ea5a475
3351 * src/global.c (_gcry_set_outofcore_handler): Don't call log_info.
3352
3353 cipher:ecc: Implement PCT for EdDSA.
3354 + commit 3ac2bba4a4b11388949e235d0d9555478468a379
3355 * cipher/ecc.c (test_keys_eddsa_fips): New.
3356 (ecc_generate): Use test_keys_eddsa_fips for EdDSA.
3357
3358 build: Detect broken GCC for x86/AVX512 intrinsics.
3359 + commit 97f4a94d5960bb53b690bbd5cdf87b64311e21cc
3360 * configure.ac (HAVE_COMPATIBLE_CC_X86_AVX512_INTRINSICS): Check
3361 the GCC bug 90980.
3362
3363 cipher:ecc: Add selftests for EdDSA.
3364 + commit 547dfb5aecc1ae057e0bc599e8565f8c3fb84894
3365 * cipher/ecc.c (selftest_hash_sign_eddsa): New.
3366 (selftests_ecc): Add IS_EDDSA argument.
3367 (run_selftests): Add tests for Ed25519 and Ed448.
3368 * src/g10lib.h (_gcry_hex2buffer): New.
3369 * src/sexp.c (_gcry_hex2buffer): Add.
3370
3371 2023-06-16 Jakub Jelen <[email protected]>
3372
3373 tests: EdDSA keys work in FIPS mode.
3374 + commit 73d2f5d93541747befe9a791991553d691f3a1ae
3375 * tests/bench-slope.c (ecc_algo_fips_allowed): Adjust list of FIPS
3376 allowed algorithms.
3377 * tests/benchmark.c (ecc_bench): Ditto.
3378 * tests/curves.c (check_get_params): Ditto.
3379 * tests/keygrip.c (global): Ditto.
3380 * tests/pubkey.c (main): Run Ed25519 test in FIPS mode.
3381 * tests/t-ed25519.c (one_test): Remove FIPS exception.
3382 (main): Do not record FIPS status.
3383 * tests/t-ed448.c (one_test): Remove FIPS exception.
3384 (main): Do not record FIPS status.
3385 * tests/keygen.c (check_ecc_keys): Remove FIPS exceptions.
3386
3387 ecc: Enable Ed25519 and Ed448 in FIPS mode.
3388 + commit c08ea202d91651b7c8f7ed37f5554330deac52b8
3389 * cipher/ecc-curves.c (domain_parms): Flip the FIPS byte for EdDSA
3390 curves to enable them in FIPS mode
3391 * src/fips.c (valid_string_in_sexp): Mark eddsa flag valid in FIPS mode
3392
3393 2023-06-15 NIIBE Yutaka <[email protected]>
3394
3395 cipher:ecc: Fix EdDSA secret key check.
3396 + commit ed879d832659f51c40bfadcd3b96fb8890b1eefb
3397 * cipher/ecc.c (check_secret_key): No reason to exclude EdDSA key.
3398
3399 context: Make the context chain-able.
3400 + commit f4019ed225bf4478b06fdb54e01bd7b9264694a9
3401 * src/context.h (_gcry_ctx_alloc): Add NEXT argurment.
3402 * src/context.c (struct gcry_context): Add NEXT field.
3403 (_gcry_ctx_alloc): Support the NEXT field.
3404 (_gcry_ctx_get_pointer): Allow access to the NEXT field.
3405 (_gcry_ctx_release): Loop following NEXT.
3406 * cipher/pubkey.c (struct pk_single_data): Remove CTX_NEXT.
3407 (release_single_data): Remove.
3408 (_gcry_pk_single_data_push): Call _gcry_ctx_alloc with NEXT.
3409 (_gcry_pk_get_single_data): Use _gcry_ctx_get_pointer to
3410 access NEXT.
3411
3412 2023-06-14 NIIBE Yutaka <[email protected]>
3413
3414 cipher:pubkey: Fix non-use of flexible array member.
3415 + commit c160e1a85f8295e388de7a0b09a351bc271f0d95
3416 * cipher/pubkey.c (struct pk_single_data): Use 1 as the size.
3417 (_gcry_pk_single_data_push): Use offsetof.
3418
3419 cipher:ecc: Support gcry_pk_hash_sign/verify for EdDSA.
3420 + commit 86fcf8292208838b47c08e74cd0941694287e7dd
3421 * cipher/pubkey.c (prepare_datasexp_to_be_signed): Allow HD=NULL,
3422 and use of CTX for supplying input data and random_override.
3423 (_gcry_pk_sign_md, _gcry_pk_verify_md): Support the case of HD==NULL.
3424 (release_single_data): New.
3425 (_gcry_pk_single_data_push, _gcry_pk_get_single_data): New.
3426 (_gcry_pk_random_override_new, _gcry_pk_get_random_override): Remove.
3427 * src/context.h (CONTEXT_TYPE_SINGLE_DATA): New.
3428 (CONTEXT_TYPE_RANDOM_OVERRIDE): Remove.
3429 * src/context.c (_gcry_ctx_alloc): Use CONTEXT_TYPE_SINGLE_DATA.
3430 * src/gcrypt-int.h (_gcry_pk_single_data_push,
3431 _gcry_pk_get_single_data): New.
3432 (_gcry_pk_random_override_new, _gcry_pk_get_random_override): Remove.
3433 * src/gcrypt.h.in (gcry_pk_input_data_push): New.
3434 * src/visibility.c (gcry_pk_random_override_new): Follow the change.
3435 * tests/t-ed25519.c (one_test): Use gcry_pk_hash_sign/verify API.
3436 * tests/t-ed448.c (one_test): Use gcry_pk_hash_sign/verify API.
3437
3438 2023-06-13 NIIBE Yutaka <[email protected]>
3439
3440 cipher:ecc: Fix public key computation for EdDSA.
3441 + commit 469919751d6eb46ceff9df80676416ca8f474459
3442 * cipher/ecc-misc.c (_gcry_ecc_compute_public): Fix hard-coded length
3443 for digest lower bits.
3444
3445 2023-06-12 NIIBE Yutaka <[email protected]>
3446
3447 cipher:pubkey: Factor out data SEXP preparation.
3448 + commit 263aa80b39dcf6d98c475784b319cb91b87cec3b
3449 * cipher/pubkey.c (prepare_datasexp_to_be_signed): New.
3450 (_gcry_pk_sign_md, _gcry_pk_verify_md): Use the function.
3451
3452 2023-06-09 NIIBE Yutaka <[email protected]>
3453
3454 cipher: Factor functions for ECC selftests.
3455 + commit e0f7e927c594bec46afc23b782526546d0024ff5
3456 * cipher/ecc.c: Factor out data for ECC selftests.
3457 (selftest_hash_sign, selftest_sign): Have more arguments.
3458 (selftests_ecc): Rename from selftests_ecdsa, having more args.
3459 Follow the change of selftest_hash_sign, selftest_sign with data.
3460 (run_selftests): Call selftests_ecc with constants of ECDSA.
3461
3462 2023-06-04 Jussi Kivilinna <[email protected]>
3463
3464 addm/subm/mulm: fix case when destination is same MPI as divider.
3465 + commit f490ffd739f713fcf0be35b7fbbb8502dea40a0c
3466 * mpi/mpi-add.c (_gcry_mpi_addm, _gcry_mpi_subm): Take copy of M when
3467 W and M are the same MPI.
3468 * mpi/mpi-mul.c (_gcry_mpi_mulm): Likewise.
3469 * tests/mpitests.c (test_addm_subm_mulm): New.
3470 (main): Run addm/subm/mulm test.
3471
3472 2023-06-01 Jussi Kivilinna <[email protected]>
3473
3474 twofish-avx2: de-unroll round function.
3475 + commit beeff8eda4a94187ee2c72c4372ab3e634335e45
3476 * cipher/twofish-avx2-amd64.S (__twofish_enc_blk16)
3477 (__twofish_dec_blk16): Use loop structure instead of unrolling.
3478
3479 2023-05-28 Jussi Kivilinna <[email protected]>
3480
3481 serpent: add x86/AVX512 implementation.
3482 + commit ce95b6ec3554aec0e4a26f700889a19d85b5d9ac
3483 * cipher/Makefile.am: Add `serpent-avx512-x86.c`; Add extra CFLAG
3484 handling for `serpent-avx512-x86.o` and `serpent-avx512-x86.lo`.
3485 * cipher/serpent-avx512-x86.c: New.
3486 * cipher/serpent.c (USE_AVX512): New.
3487 (serpent_context_t): Add `use_avx512`.
3488 [USE_AVX512] (_gcry_serpent_avx512_cbc_dec)
3489 (_gcry_serpent_avx512_cfb_dec, _gcry_serpent_avx512_ctr_enc)
3490 (_gcry_serpent_avx512_ocb_crypt, _gcry_serpent_avx512_blk32): New.
3491 (serpent_setkey_internal) [USE_AVX512]: Set `use_avx512` is
3492 AVX512 HW available.
3493 (_gcry_serpent_ctr_enc) [USE_AVX512]: New.
3494 (_gcry_serpent_cbc_dec) [USE_AVX512]: New.
3495 (_gcry_serpent_cfb_dec) [USE_AVX512]: New.
3496 (_gcry_serpent_ocb_crypt) [USE_AVX512]: New.
3497 (serpent_crypt_blk1_16): Rename to...
3498 (serpent_crypt_blk1_32): ... this; Add AVX512 code-path; Adjust for
3499 increase from max 16 blocks to max 32 blocks.
3500 (serpent_encrypt_blk1_16): Rename to ...
3501 (serpent_encrypt_blk1_32): ... this.
3502 (serpent_decrypt_blk1_16): Rename to ...
3503 (serpent_decrypt_blk1_32): ... this.
3504 (_gcry_serpent_xts_crypt, _gcry_serpent_ecb_crypt): Increase bulk
3505 block count from 16 to 32.
3506 * configure.ac (gcry_cv_cc_x86_avx512_intrinsics)
3507 (ENABLE_X86_AVX512_INTRINSICS_EXTRA_CFLAGS): New.
3508 (GCRYPT_ASM_CIPHERS): Add `serpent-avx512-x86.lo`.
3509
3510 2023-05-16 NIIBE Yutaka <[email protected]>
3511
3512 build: Sync libtool from libgpg-error for 64-bit Windows.
3513 + commit 01c0185e63605ec7e0b9e90ca99ef9f435b67261
3514 * build-aux/ltmain.hs: Update from libgpg-error.
3515
3516 2023-05-10 NIIBE Yutaka <[email protected]>
3517
3518 tests: Use -no-fast-install LDFLAGS for Windows.
3519 + commit 33f9f0dec26df64e8184395eb6554ee379a87e3d
3520 * tests/Makefile.am [HAVE_W32_SYSTEM] (AM_LDFLAGS): Conditionalize.
3521
3522 w32: Silence GCC warning for -Wcast-function-type.
3523 + commit 501dee123efe3d7d9488bb806ac9af5f56053f06
3524 * random/rndw32.c (init_system_rng): Add (void *).
3525 (slow_gatherer): Likewise.
3526
3527 2023-04-27 NIIBE Yutaka <[email protected]>
3528
3529 Update copyright notices to use URL.
3530 + commit f5284460ac4c8cc41ad9d39c5d15bd063710d956
3531 * build-aux/db2any: Update copyright notice.
3532 * cipher/arcfour.c, cipher/blowfish.ccipher/cast5.c: Likewise.
3533 * cipher/crc-armv8-ce.c, cipher/crc-intel-pclmul.c: Likewise.
3534 * cipher/crc-ppc.c, cipher/crc.c, cipher/des.c: Likewise.
3535 * cipher/md2.c, cipher/md4.c, cipher/md5.c: Likewise.
3536 * cipher/primegen.c, cipher/rfc2268.c, cipher/rmd160.c: Likewise.
3537 * cipher/seed.c, cipher/serpent.c, cipher/tiger.c: Likewise.
3538 * cipher/twofish.c: Likewise.
3539 * mpi/alpha/mpih-add1.S, mpi/alpha/mpih-lshift.S: Likewise.
3540 * mpi/alpha/mpih-mul1.S, mpi/alpha/mpih-mul2.S: Likewise.
3541 * mpi/alpha/mpih-mul3.S, mpi/alpha/mpih-rshift.S: Likewise.
3542 * mpi/alpha/mpih-sub1.S, mpi/alpha/udiv-qrnnd.S: Likewise.
3543 * mpi/amd64/mpih-add1.S, mpi/amd64/mpih-lshift.S: Likewise.
3544 * mpi/amd64/mpih-mul1.S, mpi/amd64/mpih-mul2.S: Likewise.
3545 * mpi/amd64/mpih-mul3.S, mpi/amd64/mpih-rshift.S: Likewise.
3546 * mpi/amd64/mpih-sub1.S, mpi/config.links: Likewise.
3547 * mpi/generic/mpih-add1.c, mpi/generic/mpih-lshift.c: Likewise.
3548 * mpi/generic/mpih-mul1.c, mpi/generic/mpih-mul2.c: Likewise.
3549 * mpi/generic/mpih-mul3.c, mpi/generic/mpih-rshift.c: Likewise.
3550 * mpi/generic/mpih-sub1.c, mpi/generic/udiv-w-sdiv.c: Likewise.
3551 * mpi/hppa/mpih-add1.S, mpi/hppa/mpih-lshift.S: Likewise.
3552 * mpi/hppa/mpih-rshift.S, mpi/hppa/mpih-sub1.S: Likewise.
3553 * mpi/hppa/udiv-qrnnd.S, mpi/hppa1.1/mpih-mul1.S: Likewise.
3554 * mpi/hppa1.1/mpih-mul2.S, mpi/hppa1.1/mpih-mul3.S: Likewise.
3555 * mpi/hppa1.1/udiv-qrnnd.S, mpi/i386/mpih-add1.S: Likewise.
3556 * mpi/i386/mpih-lshift.S, mpi/i386/mpih-mul1.S: Likewise.
3557 * mpi/i386/mpih-mul2.S, mpi/i386/mpih-mul3.S: Likewise.
3558 * mpi/i386/mpih-rshift.S, mpi/i386/mpih-sub1.S: Likewise.
3559 * mpi/i386/syntax.h, mpi/longlong.h: Likewise.
3560 * mpi/m68k/mc68020/mpih-mul1.S, mpi/m68k/mc68020/mpih-mul2.S: Likewise.
3561 * mpi/m68k/mc68020/mpih-mul3.S, mpi/m68k/mpih-add1.S: Likewise.
3562 * mpi/m68k/mpih-lshift.S, mpi/m68k/mpih-rshift.S: Likewise.
3563 * mpi/m68k/mpih-sub1.S, mpi/m68k/syntax.h: Likewise.
3564 * mpi/mips3/mpih-add1.S, mpi/mips3/mpih-lshift.S: Likewise.
3565 * mpi/mips3/mpih-mul1.S, mpi/mips3/mpih-mul2.S: Likewise.
3566 * mpi/mips3/mpih-mul3.S, mpi/mips3/mpih-rshift.S: Likewise.
3567 * mpi/mips3/mpih-sub1.S, mpi/mpi-add.c: Likewise.
3568 * mpi/mpi-bit.c, mpi/mpi-cmp.c, mpi/mpi-div.c: Likewise.
3569 * mpi/mpi-gcd.c, mpi/mpi-inline.c, mpi/mpi-inline.h: Likewise.
3570 * mpi/mpi-internal.h, mpi/mpi-mpow.c, mpi/mpi-mul.c: Likewise.
3571 * mpi/mpi-scan.c, mpi/mpih-div.c, mpi/mpih-mul.c: Likewise.
3572 * mpi/pa7100/mpih-lshift.S, mpi/pa7100/mpih-rshift.S: Likewise.
3573 * mpi/power/mpih-add1.S, mpi/power/mpih-lshift.S: Likewise.
3574 * mpi/power/mpih-mul1.S, mpi/power/mpih-mul2.S: Likewise.
3575 * mpi/power/mpih-mul3.S, mpi/power/mpih-rshift.S: Likewise.
3576 * mpi/power/mpih-sub1.S, mpi/powerpc32/mpih-add1.S: Likewise.
3577 * mpi/powerpc32/mpih-lshift.S, mpi/powerpc32/mpih-mul1.S: Likewise.
3578 * mpi/powerpc32/mpih-mul2.S, mpi/powerpc32/mpih-mul3.S: Likewise.
3579 * mpi/powerpc32/mpih-rshift.S, mpi/powerpc32/mpih-sub1.S: Likewise.
3580 * mpi/powerpc32/syntax.h, mpi/sparc32/mpih-add1.S: Likewise.
3581 * mpi/sparc32/mpih-lshift.S, mpi/sparc32/mpih-rshift.S: Likewise.
3582 * mpi/sparc32/udiv.S, mpi/sparc32v8/mpih-mul1.S: Likewise.
3583 * mpi/sparc32v8/mpih-mul2.S, mpi/sparc32v8/mpih-mul3.S: Likewise.
3584 * mpi/supersparc/udiv.S: Likewise.
3585 * random/random.h, random/rndegd.c: Likewise.
3586 * src/cipher.h, src/libgcrypt.def, src/libgcrypt.vers: Likewise.
3587 * src/missing-string.c, src/mpi.h, src/secmem.h: Likewise.
3588 * src/stdmem.h, src/types.h: Likewise.
3589 * tests/aeswrap.c, tests/curves.c, tests/hmac.c: Likewise.
3590 * tests/keygrip.c, tests/prime.c, tests/random.c: Likewise.
3591 * tests/t-kdf.c, tests/testapi.c: Likewise.
3592
3593 Update m4 files and Makefiles.
3594 + commit 17a3394b47cb82535ef7187e8819931b00cf4fa6
3595 * acinclude.m4: Use URL and add SPDX identifier.
3596 * m4/noexecstack.m4: Likewise.
3597 * Makefile.am: Likewise.
3598 * doc/Makefile.am: Likewise.
3599 * mpi/Makefile.am: Likewise.
3600 * tests/Makefile.am: Likewise.
3601
3602 2023-04-23 Jussi Kivilinna <[email protected]>
3603
3604 mpi: optimize mpi_rshift and mpi_lshift to avoid extra MPI copying.
3605 + commit fdf2e8ba654a4dcfee25586dd7e0749f2b7a92c0
3606 * mpi/mpi-bit.c (_gcry_mpi_rshift): Refactor so that _gcry_mpih_rshift
3607 is used to do the copying along with shifting when copying is needed
3608 and refactor so that same code-path is used for both in-place and
3609 copying operation.
3610 (_gcry_mpi_lshift): Refactor so that _gcry_mpih_lshift is used to do
3611 the copying along with shifting when copying is needed and refactor
3612 so that same code-path is used for both in-place and copying operation.
3613
3614 mpi/amd64: optimize add_n and sub_n.
3615 + commit ad4ee8d52f7199ba8bdee767044337060529069f
3616 * mpi/amd64/mpih-add1.S (_gcry_mpih_add_n): New implementation
3617 with 4x unrolled fast-path loop.
3618 * mpi/amd64/mpih-sub1.S (_gcry_mpih_sub_n): Likewise.
3619
3620 mpi/amd64: fix use of 'movd' for 64-bit register move in lshift&rshift.
3621 + commit 3e17e819a6a4d505828cf93fc2c258a753f1d38c
3622 * mpi/amd64/mpih-lshift.S: Use 'movq' instead of 'movd' for moving
3623 value to %rax.
3624 * mpi/amd64/mpih-rshift.S: Likewise.
3625
3626 mpi: avoid MPI copy at gcry_mpi_sub.
3627 + commit 8b09db4cce1040f061034ab899cd1369a51dceeb
3628 * mpi/mpi-add.c (_gcry_mpi_add): Rename function...
3629 (_gcry_mpi_add_inv_sign): ... to this and add parameter for inverting
3630 sign of second operand.
3631 (_gcry_mpi_add): New.
3632 (_gcry_mpi_sub): Remove mpi_copy and instead use new
3633 '_gcry_mpi_add_inv_sign' function with inverted sign for second
3634 operand.
3635
3636 bench-slope: add MPI benchmarking.
3637 + commit e90fbf6f8dacf280d03e557a65528fc2df24f1d7
3638 * tests/bench-slope.c (MPI_START_SIZE, MPI_END_SIZE, MPI_STEP_SIZE)
3639 (MPI_NUM_STEPS, bench_mpi_test, mpi_test_names, bench_mpi_mode)
3640 (bench_mpi_hd, bench_mpi_init, bench_mpi_fre, bench_mpi_do_bench)
3641 (mpi_ops, mpi_modes, mpi_bench_one, _mpi_bench, mpi_match_test)
3642 (mpi_bench): New.
3643 (print_help): Add mention of 'mpi'.
3644 (main): Add "mpi" tests.
3645
3646 cipher: restore weak-key error-code after mode specific setkey.
3647 + commit 5d18b401f8a780e2465662e88cbac6974033bf3f
3648 * cipher/cipher.c (cipher_setkey): Restore weak-key error-code
3649 in case mode specific setkey returned success for the return code.
3650
3651 2023-04-20 Jussi Kivilinna <[email protected]>
3652
3653 doc: add documentation for GCRYCTL_SET_ALLOW_WEAK_KEY.
3654 + commit f3ca9fa4f7e0aee1bb5012c419deb7b927da844d
3655 * doc/gcrypt.texi: Add 'GCRYCTL_SET_ALLOW_WEAK_KEY' under
3656 'gcry_cipher_ctl'.
3657
3658 Revert "cipher: Fix edge case for SET_ALLOW_WEAK_KEY."
3659 + commit 7146b69b490595d654228bae8c3fb5d1525e3b60
3660 * cipher/cipher.c (cipher_setkey): Do not reset RC.
3661
3662 2023-04-16 Werner Koch <[email protected]>
3663
3664 cipher: Fix edge case for SET_ALLOW_WEAK_KEY.
3665 + commit 30840c2c45d718e0fd93cfd40771fbefa50e31f5
3666 * cipher/cipher.c (cipher_setkey): Reset RC.
3667
3668 2023-04-10 NIIBE Yutaka <[email protected]>
3669
3670 random: Use getrandom only when it's appropriate.
3671 + commit fa21ddc158b5d7b5900856e5b131071302217a51
3672 * random/rndgetentropy.c (_gcry_rndgetentropy_gather_random)
3673 [GRND_RANDOM]: Conditionalize the use of getrandom, as it's
3674 not a portable function.
3675
3676 2023-04-04 NIIBE Yutaka <[email protected]>
3677
3678 cipher: Enable the fast path to ChaCha20 only when supported.
3679 + commit 137f1fd82bc9136d434ca41f58d62091b64df6db
3680 cipher/cipher-poly1305.c (_gcry_cipher_poly1305_encrypt)
3681 (_gcry_cipher_poly1305_decrypt) [USE_CHACHA20]: Conditionalize.
3682
3683 2023-04-03 Jussi Kivilinna <[email protected]>
3684
3685 cipher-gcm-ppc: tweak loop structure a bit.
3686 + commit 278ba98497e126358a6b0ee8b566cc62ebb96ab9
3687 * cipher/cipher-gcm-ppc.c (_gcry_ghash_ppc_vpmsum): Increament
3688 'buf' pointer right after use; Use 'for' loop for inner 4-blocks
3689 loop to allow compiler to better optimize loop.
3690
3691 2023-04-03 NIIBE Yutaka <[email protected]>
3692
3693 build: Allow build with -Oz.
3694 + commit 7edf1abb9a0d892a80cbf7ab42f64b2720671ee9
3695 * cipher/Makefile.am [ENABLE_O_FLAG_MUNGING]: Support -Oz.
3696 * random/Makefile.am [ENABLE_O_FLAG_MUNGING]: Support -Oz.
3697
3698 2023-04-01 NIIBE Yutaka <[email protected]>
3699
3700 m4: Update gpg-error.m4.
3701 + commit bcf5922eaac274f5ace991ecace01e718a9fe964
3702 * m4/gpg-error.m4: Update from libgpg-error master.
3703
3704 2023-03-24 NIIBE Yutaka <[email protected]>
3705
3706 fips: More elaborate way of getting FIPS pk flags indicators.
3707 + commit 1c916b8c99ea0e30f1d81d606fd63b0c45657186
3708 * src/fips.c (_gcry_fips_indicator_pk_flags): List more allowed string
3709 in the S-expression.
3710 * doc/gcrypt.texi: Add document for the FIPS service indicator
3711 GCRYCTL_FIPS_SERVICE_INDICATOR_PK_FLAGS with example.
3712
3713 2023-03-23 NIIBE Yutaka <[email protected]>
3714
3715 build: Update gpg-error.m4.
3716 + commit 0af15f1fa0ca277fba17b365519f710b41a5b78f
3717 * m4/gpg-error.m4: Update from libgpg-error master.
3718
3719 2023-03-19 Jussi Kivilinna <[email protected]>
3720
3721 camellia-simd128: use 8-bit right shift for rotate function.
3722 + commit 79a79d3dc6268f4d72597f7db6c83511dbbef645
3723 * cipher/camellia-simd128.h (rol32_1_16): Use vpsrlb128 for uint8
3724 right shift by 7 if available.
3725
3726 camellia-gfni: use GFNI for uint8 right shift in FLS.
3727 + commit 3c98ae9cb60a8a72d3fa6641e59775f98ec78786
3728 * cipher/camellia-aesni-avx2-amd64.h (IF_GFNI, IF_NOT_GFNI): New.
3729 [CAMELLIA_GFNI_BUILD] (rol32_1_32): Add GFNI variant which uses
3730 vgf2p8affineqb for uint8 right shift by 7.
3731 (fls32): Load 'right shift by 7' bit-matrix on GFNI build.
3732 [CAMELLIA_GFNI_BUILD] (.Lright_shift_by_7): New.
3733 * cipher/camellia-gfni-avx512-amd64.S (clear_regs): Don't clear %k1.
3734 (rol32_1_64): Use vgf2p8affineqb for uint8 right shift by 7.
3735 (fls64): Adjust for rol32_1_64 changes.
3736 (.Lbyte_ones): Remove.
3737 (.Lright_shift_by_7): New.
3738 (_gcry_camellia_gfni_avx512_ctr_enc): Clear %k1 after use.
3739
3740 2023-03-14 Jakub Jelen <[email protected]>
3741
3742 tests: Improve test coverage for FIPS service indicators.
3743 + commit fae63f517906ba8f46d255f1b5770665f2197ad9
3744 * tests/basic.c (check_digests): Check the FIPS indicators.
3745 (check_mac): Ditto.
3746
3747 fips: Explicitly disable overriding random in FIPS mode.
3748 + commit e0a5a9eb8301991c28fae8632add8dacce81aeb4
3749 * src/fips.c: (_gcry_fips_indicator_function): Mark using random
3750 override non-approved in FIPS mode.
3751
3752 fips: Explicitly allow only some PK flags.
3753 + commit 4c1c8a707f9652dbfad8f8b531d8b84556f655f1
3754 * src/fips.c (_gcry_fips_indicator_pk_flags): New function for explicit
3755 FIPS indicator for public key algorithm flags.
3756 * src/g10lib.h (_gcry_fips_indicator_pk_flags): New.
3757 * src/gcrypt.h.in (GCRYCTL_FIPS_SERVICE_INDICATOR_PK_FLAGS): New.
3758 * src/global.c (_gcry_vcontrol): Handle the new option.
3759 * doc/gcrypt.texi: Document new options.
3760
3761 2023-03-14 Tobias Heider <[email protected]>
3762
3763 doc: Document the new FIPS indicators.
3764 + commit 0b7ad923978f708b41933d6b91d3159ffc7a84a1
3765 * doc/gcrypt.texi: Document the new options for FIPS indicators.
3766
3767 2023-03-08 Tobias Heider <[email protected]>
3768
3769 fips: Unblock MD5 in fips mode but mark non-approved in indicator.
3770 + commit dc4a60e2d70bc52ba2955f8e676341d675ab89a0
3771 * cipher/mac-hmac.c (_gcry_mac_type_spec_hmac_md5): Allow in fips mode.
3772 * cipher/md5.c (_gcry_digest_spec_md5): Allow in fips mode.
3773
3774 fips: Add explicit indicators for md and mac algorithms.
3775 + commit c88672a327f6774a66d75a35f25266eec99b16f4
3776 * src/fips.c (_gcry_fips_indicator_mac): New function indicating
3777 non-approved mac algorithms.
3778 (_gcry_fips_indicator_md): new functions indicating non-approved
3779 message digest algorithms.
3780 * src/g10lib.h (_gcry_fips_indicator_mac): New function.
3781 (_gcry_fips_indicator_md): Ditto.
3782 * src/gcrypt.h.in (enum gcry_ctl_cmds): New symbols,
3783 GCRYCTL_FIPS_SERVICE_INDICATOR_MAC and
3784 GCRYCTL_FIPS_SERVICE_INDICATOR_MD.
3785 * src/global.c (_gcry_vcontrol): Handle new FIPS indicators.
3786
3787 2023-03-07 Jakub Jelen <[email protected]>
3788
3789 kdf: Update tests in regards to the allowed parameters in FIPS mode.
3790 + commit f5fe94810f3099c9ccc2ca3a5891502922ab0576
3791 * cipher/kdf.c (check_one): run selftests for more approved parameters
3792 and check that wrong parameters correctly fail in FIPS mode.
3793
3794 fips: Check return value from ftell.
3795 + commit 3fd3bb31597f80c76a94ea62e42d58d796beabf1
3796 * src/fips.c (get_file_offset): Check return value of ftell to be able
3797 to detect errors.
3798
3799 random: Remove unused SHA384 DRBGs.
3800 + commit 45b80678109e5817b7cd15566a9d6c96b064b95f
3801 * random/random-drbg.c (global): Remove unused SHA384-based defines.
3802 (drbg_cores): Remove SHA384 configurations.
3803 (drbg_sec_strength): Remove unused SHA384.
3804
3805 visibility: Check FIPS operational status for MD+Sign operation.
3806 + commit 654d0dfa04993ebe28c0536d42f4bc6d87c28369
3807 * src/visibility.c (gcry_pk_hash_sign): Check fips status before
3808 calling the operation itself.
3809 (gcry_pk_hash_verify): Ditto.
3810
3811 ecc: Make the PCT recoverable in FIPS mode and consistent with RSA.
3812 + commit 23a2d1285e35b2eb91bb422609eb1c965c8a9bf6
3813 * cipher/ecc.c (test_keys_fips): Replace calls to log_fatal with
3814 return code on error.
3815 (ecc_generate): Signal error when PCT fails in FIPS mode.
3816
3817 ecc: Do not allow skipping tests in FIPS Mode.
3818 + commit 2ddeec574bc1ae90bb4242c4ce9ad9e7975a27bd
3819 * cipher/ecc.c (ecc_generate): Do not allow skipping tests PCT tests
3820 in FIPS mode.
3821
3822 2023-03-06 Jussi Kivilinna <[email protected]>
3823
3824 rijndael-ppc: use vector registers for key schedule calculations.
3825 + commit 855f8c513d6db58cbc9d45f3e0bb2cee3ab5a189
3826 * cipher/rijndael-ppc.c (_gcry_aes_sbox4_ppc8): Remove.
3827 (bcast_u32_to_vec, u32_from_vec): New.
3828 (_gcry_aes_ppc8_setkey): Use vectors for round key calculation
3829 variables.
3830
3831 Add PowerPC vector implementation of SM4.
3832 + commit 0b2da804ee813eee22c386ba7f253415103b34ea
3833 * cipher/Makefile.am: Add 'sm4-ppc.c'.
3834 * cipher/sm4-ppc.c: New.
3835 * cipher/sm4.c (USE_PPC_CRYPTO): New.
3836 (SM4_context): Add 'use_ppc8le' and 'use_ppc9le'.
3837 [USE_PPC_CRYPTO] (_gcry_sm4_ppc8le_crypt_blk1_16)
3838 (_gcry_sm4_ppc9le_crypt_blk1_16, sm4_ppc8le_crypt_blk1_16)
3839 (sm4_ppc9le_crypt_blk1_16): New.
3840 (sm4_setkey) [USE_PPC_CRYPTO]: Set use_ppc8le and use_ppc9le
3841 based on HW features.
3842 (sm4_get_crypt_blk1_16_fn) [USE_PPC_CRYPTO]: Add PowerPC
3843 implementation selection.
3844
3845 2023-03-02 Jussi Kivilinna <[email protected]>
3846
3847 camellia-simd128: faster sbox filtering with uint8 right shift.
3848 + commit 6c05c808e4e848964f67157e80f1835c5146e2bc
3849 * cipher/camellia-simd128.h (if_vpsrlb128)
3850 (if_not_vpsrlb128): New.
3851 (filter_8bit): Use 'vpsrlb128' when available on target
3852 architecture (PowerPC and AArch64).
3853
3854 chacha20-ppc: do not generate p9 code when target attr unavailable.
3855 + commit 652598096325c2478d7d033585dadc13bec6fb1d
3856 * cipher/chacha20-ppc.c (HAVE_FUNC_ATTR_TARGET): New.
3857 (_gcry_chacha20_ppc9_blocks1, _gcry_chacha20_ppc9_blocks4)
3858 (_gcry_chacha20_poly1305_ppc8_blocks4): Use inline functions
3859 only if HAVE_FUNC_ATTR_TARGET is defined.
3860
3861 2023-03-01 Jussi Kivilinna <[email protected]>
3862
3863 Fix "'inline' is not at beginning of declaration" warnings.
3864 + commit 0a5f7e9543a823034f6dd6dae2f647c4e213f213
3865 * cipher/chacha20-ppc.c (chacha20_ppc_blocks1)
3866 (chacha20_ppc_blocks4, chacha20_poly1305_ppc_blocks4): Move
3867 'ASM_FUNC_ATTR_INLINE' right after 'static'.
3868 * cipher/sha256-ppc.c (sha256_transform_ppc): Likewise.
3869 * cipher/sha512-ppc.c (sha512_transform_ppc): Likewise.
3870
3871 Improve PPC target function attribute checks.
3872 + commit 66bae697a853b21e0a2ff2a5031d23e3691a9084
3873 * configure.ac (gcry_cv_gcc_attribute_ppc_target)
3874 (gcry_cv_clang_attribute_ppc_target): Add 'always_inline'
3875 function to test.
3876
3877 2023-02-28 Jussi Kivilinna <[email protected]>
3878
3879 camellia: add AArch64 crypto-extension implementation.
3880 + commit 898c857206ada06d70c5f46ac5adaa9d7058e672
3881 * cipher/Makefile.am: Add 'camellia-aarch64-ce.(c|o|lo)'.
3882 (aarch64_neon_cflags): New.
3883 * cipher/camellia-aarch64-ce.c: New.
3884 * cipher/camellia-glue.c (USE_AARCH64_CE): New.
3885 (CAMELLIA_context): Add 'use_aarch64ce'.
3886 (_gcry_camellia_aarch64ce_encrypt_blk16)
3887 (_gcry_camellia_aarch64ce_decrypt_blk16)
3888 (_gcry_camellia_aarch64ce_keygen, camellia_aarch64ce_enc_blk16)
3889 (camellia_aarch64ce_dec_blk16, aarch64ce_burn_stack_depth): New.
3890 (camellia_setkey) [USE_AARCH64_CE]: Set use_aarch64ce if HW has
3891 HWF_ARM_AES; Use AArch64/CE key generation if supported by HW.
3892 (camellia_encrypt_blk1_32, camellia_decrypt_blk1_32)
3893 [USE_AARCH64_CE]: Add AArch64/CE code path.
3894
3895 camellia: add POWER8/POWER9 vcrypto implementation.
3896 + commit 6fa11d8b7070eb7c4c296c879213c9596bd00b1c
3897 * cipher/Makefile.am: Add 'camellia-simd128.h',
3898 'camellia-ppc8le.c' and 'camellia-ppc9le.c'.
3899 * cipher/camellia-glue.c (USE_PPC_CRYPTO): New.
3900 (CAMELLIA_context) [USE_PPC_CRYPTO]: Add 'use_ppc', 'use_ppc8'
3901 and 'use_ppc9'.
3902 [USE_PPC_CRYPTO] (_gcry_camellia_ppc8_encrypt_blk16)
3903 (_gcry_camellia_ppc8_decrypt_blk16, _gcry_camellia_ppc8_keygen)
3904 (_gcry_camellia_ppc9_encrypt_blk16)
3905 (_gcry_camellia_ppc9_decrypt_blk16, _gcry_camellia_ppc9_keygen)
3906 (camellia_ppc_enc_blk16, camellia_ppc_dec_blk16)
3907 (ppc_burn_stack_depth): New.
3908 (camellia_setkey) [USE_PPC_CRYPTO]: Setup 'use_ppc', 'use_ppc8'
3909 and 'use_ppc9' and use PPC key-generation if HWF is available.
3910 (camellia_encrypt_blk1_32)
3911 (camellia_decrypt_blk1_32) [USE_PPC_CRYPTO]: Add 'use_ppc' paths.
3912 (_gcry_camellia_ocb_crypt, _gcry_camellia_ocb_auth): Enable
3913 generic bulk path when USE_PPC_CRYPTO is defined.
3914 * cipher/camellia-ppc8le.c: New.
3915 * cipher/camellia-ppc9le.c: New.
3916 * cipher/camellia-simd128.h: New.
3917 * configure.ac: Add 'camellia-ppc8le.lo' and 'camellia-ppc9le.lo'.
3918
3919 2023-02-26 Jussi Kivilinna <[email protected]>
3920
3921 aes-amd64-vaes: fix fast exit path in XTS function.
3922 + commit 0d42d9674458a22cfccec419f4c358d743c5effb
3923 * cipher/rijndael-vaes-avx2-amd64.S
3924 (_gcry_vaes_avx2_xts_crypt_amd64): On fast exit path, compare
3925 number of blocks left against '1' instead of '0' as following
3926 branch is 'less than'.
3927
3928 ppc: add support for clang target attribute.
3929 + commit 937a76a34540bd2558f5b34a98fbe53227000646
3930 * configure.ac (gcry_cv_clang_attribute_ppc_target): New.
3931 * cipher/chacha20-ppc.c [HAVE_CLANG_ATTRIBUTE_PPC_TARGET]
3932 (FUNC_ATTR_TARGET_P8, FUNC_ATTR_TARGET_P9): New.
3933 * cipher/rijndael-ppc.c [HAVE_CLANG_ATTRIBUTE_PPC_TARGET]
3934 (FPC_OPT_ATTR): New.
3935 * cipher/rijndael-ppc9le.c [HAVE_CLANG_ATTRIBUTE_PPC_TARGET]
3936 (FPC_OPT_ATTR): New.
3937 * cipher/sha256-ppc.c [HAVE_CLANG_ATTRIBUTE_PPC_TARGET]
3938 (FUNC_ATTR_TARGET_P8, FUNC_ATTR_TARGET_P9): New.
3939 * cipher/sha512-ppc.c [HAVE_CLANG_ATTRIBUTE_PPC_TARGET]
3940 (FUNC_ATTR_TARGET_P8, FUNC_ATTR_TARGET_P9): New.
3941 (ror64): Remove unused function.
3942
3943 chacha20-ppc: use target and optimize attributes for P8 and P9.
3944 + commit f3d1d4a8c9f0df107a57e2cd3699253766d6e45a
3945 * cipher/chacha20-ppc.c (_gcry_chacha20_ppc8_blocks1): Rename to...
3946 (chacha20_ppc_blocks1): ...this; Add 'always inline' attribute.
3947 (_gcry_chacha20_ppc8_blocks4): Rename to...
3948 (chacha20_ppc_blocks4): ...this; Add 'always inline' attribute.
3949 (_gcry_chacha20_poly1305_ppc8_blocks4): Rename to...
3950 (chacha20_poly1305_ppc_blocks4): ...this; Add 'always inline'
3951 attribute.
3952 (FUNC_ATTR_OPT_O2, FUNC_ATTR_TARGET_P8, FUNC_ATTR_TARGET_P9): New.
3953 (_gcry_chacha20_ppc8_blocks1, _gcry_chacha20_ppc8_blocks4)
3954 (_gcry_chacha20_poly1305_ppc8_blocks4): New.
3955 (_gcry_chacha20_ppc9_blocks1, _gcry_chacha20_ppc9_blocks4)
3956 (_gcry_chacha20_poly1305_ppc9_blocks4): New.
3957 * cipher/chacha20.c (CHACHA20_context_t): Add 'use_p9'.
3958 (_gcry_chacha20_ppc9_blocks1, _gcry_chacha20_ppc9_blocks4)
3959 (_gcry_chacha20_poly1305_ppc9_blocks4): New.
3960 (chacha20_do_setkey): Set 'use_p9' if HW has HWF_PPC_ARCH_3_00.
3961 (chacha20_blocks, do_chacha20_encrypt_stream_tail)
3962 (_gcry_chacha20_poly1305_encrypt)
3963 (_gcry_chacha20_poly1305_decrypt) [USE_PPC_VEC]: Add 'use_p9' paths.
3964
3965 aes-ppc: use target and optimize attributes for P8 and P9.
3966 + commit 100063cf4e1ca3350f05a343d8fa0ccf305debb1
3967 * cipher/rijndael-ppc-functions.h: Add PPC_OPT_ATTR attribute
3968 macro for all functions.
3969 * cipher/rijndael-ppc.c (FUNC_ATTR_OPT, PPC_OPT_ATTR): New.
3970 (_gcry_aes_ppc8_setkey, _gcry_aes_ppc8_prepare_decryption): Add
3971 PPC_OPT_ATTR attribute macro.
3972 * cipher/rijndael-ppc9le.c (FUNC_ATTR_OPT, PPC_OPT_ATTR): New.
3973
3974 aes-ppc: add CTR32LE bulk acceleration.
3975 + commit 84f2e2d0b51b7b3e75d96d8188ae6a8d8174542b
3976 * cipher/rijndael-ppc-functions.h (CTR32LE_ENC_FUNC): New.
3977 * cipher/rijndael-ppc.c (_gcry_aes_ppc8_ctr32le_enc): New.
3978 * cipher/rijndael-ppc9le.c (_gcry_aes_ppc9le_ctr32le_enc): New.
3979 * cipher/rijndael.c (_gcry_aes_ppc8_ctr32le_enc)
3980 (_gcry_aes_ppc9le_ctr32le_enc): New.
3981 (do_setkey): Setup _gcry_aes_ppc8_ctr32le_enc for POWER8 and
3982 _gcry_aes_ppc9le_ctr32le_enc for POWER9.
3983
3984 aes-ppc: add ECB bulk acceleration for benchmarking purposes.
3985 + commit a7ebf9d52e67015c0ae175c0a9bbff9da9fe6f32
3986 * cipher/rijndael-ppc-functions.h (ECB_CRYPT_FUNC): New.
3987 * cipher/rijndael-ppc.c (_gcry_aes_ppc8_ecb_crypt): New.
3988 * cipher/rijndael-ppc9le.c (_gcry_aes_ppc9le_ecb_crypt): New.
3989 * cipher/rijndael.c (_gcry_aes_ppc8_ecb_crypt)
3990 (_gcry_aes_ppc9le_ecb_crypt): New.
3991 (do_setkey): Set up _gcry_aes_ppc8_ecb_crypt for POWER8 and
3992 _gcry_aes_ppc9le_ecb_crypt for POWER9.
3993
3994 sha2-ppc: better optimization for POWER9.
3995 + commit 161614ecc1c20d94a8599888524b1d1fd0eb2754
3996 * cipher/sha256-ppc.c: Change to use vector registers, generate
3997 POWER8 and POWER9 from same code with help of 'target' and
3998 'optimize' attribute.
3999 * cipher/sha512-ppc.c: Likewise.
4000 * configure.ac (gcry_cv_gcc_attribute_optimize)
4001 (gcry_cv_gcc_attribute_ppc_target): New.
4002
4003 2023-02-22 Jussi Kivilinna <[email protected]>
4004
4005 camellia-aesni-avx: speed up for round key broadcasting.
4006 + commit dd4cb5d75c8e4e666db4352d999b2111b9ddb80d
4007 * cipher/camellia-aesni-avx2-amd64.h (roundsm16, fls16): Broadcast
4008 round key bytes directly with 'vpshufb'.
4009
4010 camellia-avx2: speed up for round key broadcasting.
4011 + commit b9a9755742c7bf7ca8c007d33f98aaa076a382c7
4012 * cipher/camellia-aesni-avx2-amd64.h (roundsm32, fls32): Use
4013 'vpbroadcastb' for loading round key.
4014 * cipher/camellia-glue.c (camellia_encrypt_blk1_32)
4015 (camellia_decrypt_blk1_32): Adjust num_blks thresholds for AVX2
4016 implementations, 2 blks for GFNI, 4 blks for VAES and 5 blks for AESNI.
4017
4018 camellia-gfni-avx512: speed up for round key broadcasting.
4019 + commit a4c22331f57d23832ddd019ac3108b5fa3dd942b
4020 * cipher/camellia-gfni-avx512-amd64.S (roundsm64, fls64): Use
4021 'vpbroadcastb' for loading round key.
4022
4023 camellia-avx2: add fast path for full 32 block ECB input.
4024 + commit 5f25ad09fdb5eb5f83f7cc4cefe79bbeab29fec8
4025 * cipher/camellia-aesni-avx2-amd64.h (enc_blk1_32, dec_blk1_32): Add
4026 fast path for 32 block input.
4027
4028 camellia: add CTR-mode byte addition for AVX/AVX2/AVX512 impl.
4029 + commit 87ae2a660d59751ddd7da40da05cfaee73f35ea7
4030 * cipher/camellia-aesni-avx-amd64.S
4031 (_gcry_camellia_aesni_avx_ctr_enc): Add byte addition fast-path.
4032 * cipher/camellia-aesni-avx2-amd64.h (ctr_enc): Likewise.
4033 * cipher/camellia-gfni-avx512-amd64.S
4034 (_gcry_camellia_gfni_avx512_ctr_enc): Likewise.
4035 * cipher/camellia-glue.c (CAMELLIA_context): Add 'use_avx2'.
4036 (camellia_setkey, _gcry_camellia_ctr_enc, _gcry_camellia_cbc_dec)
4037 (_gcry_camellia_cfb_dec, _gcry_camellia_ocb_crypt)
4038 (_gcry_camellia_ocb_auth) [USE_AESNI_AVX2]: Use 'use_avx2' to check
4039 if any of the AVX2 implementations is enabled.
4040
4041 camellia-aesni-avx: add acceleration for ECB/XTS/CTR32LE modes.
4042 + commit 926cc22058a39c7a931e14590eab6fd7a78ba455
4043 * cipher/camellia-aesni-avx-amd64.S (_gcry_camellia_aesni_avx_ecb_enc)
4044 (_gcry_camellia_aesni_avx_ecb_dec): New.
4045 * cipher/camellia-glue.c (_gcry_camellia_aesni_avx_ecb_enc)
4046 (_gcry_camellia_aesni_avx_ecb_dec): New.
4047 (camellia_setkey): Always enable XTS/ECB/CTR32LE bulk functions.
4048 (camellia_encrypt_blk1_32, camellia_decrypt_blk1_32)
4049 [USE_AESNI_AVX]: Add AESNI/AVX code-path.
4050
4051 sm4: add CTR-mode byte addition for AVX/AVX2/AVX512 implementations.
4052 + commit 978b02fca682c9ecb71e30cdeeb6922fc8331f6e
4053 * cipher/sm4-aesni-avx-amd64.S
4054 (_gcry_sm4_aesni_avx_ctr_enc): Add byte addition fast-path.
4055 * cipher/sm4-aesni-avx2-amd64.S
4056 (_gcry_sm4_aesni_avx2_ctr_enc): Likewise.
4057 * cipher/sm4-gfni-avx2-amd64.S
4058 (_gcry_sm4_gfni_avx2_ctr_enc): Likewise.
4059 * cipher/sm4-gfni-avx512-amd64.S
4060 (_gcry_sm4_gfni_avx512_ctr_enc)
4061 (_gcry_sm4_gfni_avx512_ctr_enc_blk32): Likewise.
4062
4063 aes-vaes-avx2: improve case when only CTR needs carry handling.
4064 + commit 8f7f5a9fc63968304bacedbc2f22b9f7188bbd53
4065 * cipher/rijndael-vaes-avx2-amd64.S
4066 (_gcry_vaes_avx2_ctr_enc_amd64): Add handling for the case when
4067 only main counter needs carry handling but generated vector counters
4068 do not.
4069
4070 aria-avx2: add VAES accelerated implementation.
4071 + commit caf402e9b41fff6cf39b914b088ea1e5f8fd3bd1
4072 * cipher/aria-aesni-avx2-amd64.S (CONFIG_AS_VAES): New.
4073 [CONFIG_AS_VAES]: Add VAES accelerated assembly macros and functions.
4074 * cipher/aria.c (USE_VAES_AVX2): New.
4075 (ARIA_context): Add 'use_vaes_avx2'.
4076 (_gcry_aria_vaes_avx2_ecb_crypt_blk32)
4077 (_gcry_aria_vaes_avx2_ctr_crypt_blk32)
4078 (aria_avx2_ecb_crypt_blk32, aria_avx2_ctr_crypt_blk32): Add VAES/AVX2
4079 code paths.
4080 (aria_setkey): Enable VAES/AVX2 implementation based on HW features.
4081
4082 aria-avx512: small optimization for aria_diff_m.
4083 + commit f359a3ec7e845aa446836bd47994fe18d6d41e08
4084 * cipher/aria-gfni-avx512-amd64.S (aria_diff_m): Use 'vpternlogq' for
4085 3-way XOR operation.
4086 ---
4087
4088 Using vpternlogq gives small performance improvement on AMD Zen4. With
4089 Intel tiger-lake speed is the same as before.
4090
4091 Benchmark on AMD Ryzen 9 7900X (zen4, turbo-freq off):
4092
4093 Before:
4094 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4095 ECB enc | 0.203 ns/B 4703 MiB/s 0.953 c/B 4700
4096 ECB dec | 0.204 ns/B 4675 MiB/s 0.959 c/B 4700
4097 CTR enc | 0.207 ns/B 4609 MiB/s 0.973 c/B 4700
4098 CTR dec | 0.207 ns/B 4608 MiB/s 0.973 c/B 4700
4099
4100 After (~3% faster):
4101 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4102 ECB enc | 0.197 ns/B 4847 MiB/s 0.925 c/B 4700
4103 ECB dec | 0.197 ns/B 4852 MiB/s 0.924 c/B 4700
4104 CTR enc | 0.200 ns/B 4759 MiB/s 0.942 c/B 4700
4105 CTR dec | 0.200 ns/B 4772 MiB/s 0.939 c/B 4700
4106
4107 Cc: Taehee Yoo <[email protected]>
4108
4109 aria-avx: small optimization for aria_ark_8way.
4110 + commit 855f1551fd921ced652dc0c3c03601dfcd063f1c
4111 * cipher/aria-aesni-avx-amd64.S (aria_ark_8way): Use 'vmovd' for
4112 loading key material and 'vpshufb' for broadcasting from byte
4113 locations 3, 2, 1 and 0.
4114
4115 aria: add x86_64 GFNI/AVX512 accelerated implementation.
4116 + commit 45351e6474cbbe5baaa4c488222610edc417176e
4117 * cipher/Makefile.am: Add 'aria-gfni-avx512-amd64.S'.
4118 * cipher/aria-gfni-avx512-amd64.S: New.
4119 * cipher/aria.c (USE_GFNI_AVX512): New.
4120 [USE_GFNI_AVX512] (MAX_PARALLEL_BLKS): New.
4121 (ARIA_context): Add 'use_gfni_avx512'.
4122 (_gcry_aria_gfni_avx512_ecb_crypt_blk64)
4123 (_gcry_aria_gfni_avx512_ctr_crypt_blk64)
4124 (aria_gfni_avx512_ecb_crypt_blk64)
4125 (aria_gfni_avx512_ctr_crypt_blk64): New.
4126 (aria_crypt_blocks) [USE_GFNI_AVX512]: Add 64 parallel block
4127 AVX512/GFNI processing.
4128 (_gcry_aria_ctr_enc) [USE_GFNI_AVX512]: Add 64 parallel block
4129 AVX512/GFNI processing.
4130 (aria_setkey): Enable GFNI/AVX512 based on HW features.
4131 * configure.ac: Add 'aria-gfni-avx512-amd64.lo'.
4132
4133 aria: add x86_64 AESNI/GFNI/AVX/AVX2 accelerated implementations.
4134 + commit f4268a8f51a89a7c0374a23f669d7a19cad304ae
4135 * cipher/Makefile.am: Add 'aria-aesni-avx-amd64.S' and
4136 'aria-aesni-avx2-amd64.S'.
4137 * cipher/aria-aesni-avx-amd64.S: New.
4138 * cipher/aria-aesni-avx2-amd64.S: New.
4139 * cipher/aria.c (USE_AESNI_AVX, USE_GFNI_AVX, USE_AESNI_AVX2)
4140 (USE_GFNI_AVX2, MAX_PARALLEL_BLKS, ASM_FUNC_ABI, ASM_EXTRA_STACK): New.
4141 (ARIA_context): Add 'use_aesni_avx', 'use_gfni_avx',
4142 'use_aesni_avx2' and 'use_gfni_avx2'.
4143 (_gcry_aria_aesni_avx_ecb_crypt_blk1_16)
4144 (_gcry_aria_aesni_avx_ctr_crypt_blk16)
4145 (_gcry_aria_gfni_avx_ecb_crypt_blk1_16)
4146 (_gcry_aria_gfni_avx_ctr_crypt_blk16)
4147 (aria_avx_ecb_crypt_blk1_16, aria_avx_ctr_crypt_blk16)
4148 (_gcry_aria_aesni_avx2_ecb_crypt_blk32)
4149 (_gcry_aria_aesni_avx2_ctr_crypt_blk32)
4150 (_gcry_aria_gfni_avx2_ecb_crypt_blk32)
4151 (_gcry_aria_gfni_avx2_ctr_crypt_blk32)
4152 (aria_avx2_ecb_crypt_blk32, aria_avx2_ctr_crypt_blk32): New.
4153 (aria_crypt_blocks) [USE_AESNI_AVX2]: Add 32 parallel block
4154 AVX2/AESNI/GFNI processing.
4155 (aria_crypt_blocks) [USE_AESNI_AVX]: Add 3 to 16 parallel block
4156 AVX/AESNI/GFNI processing.
4157 (_gcry_aria_ctr_enc) [USE_AESNI_AVX2]: Add 32 parallel block
4158 AVX2/AESNI/GFNI processing.
4159 (_gcry_aria_ctr_enc) [USE_AESNI_AVX]: Add 16 parallel block
4160 AVX/AESNI/GFNI processing.
4161 (_gcry_aria_ctr_enc, _gcry_aria_cbc_dec, _gcry_aria_cfb_enc)
4162 (_gcry_aria_ecb_crypt, _gcry_aria_xts_crypt, _gcry_aria_ctr32le_enc)
4163 (_gcry_aria_ocb_crypt, _gcry_aria_ocb_auth): Use MAX_PARALLEL_BLKS
4164 for parallel processing width.
4165 (aria_setkey): Enable AESNI/AVX, GFNI/AVX, AESNI/AVX2, GFNI/AVX2 based
4166 on HW features.
4167 * configure.ac: Add 'aria-aesni-avx-amd64.lo' and
4168 'aria-aesni-avx2-amd64.lo'.
4169 ---
4170
4171 This patch adds AVX/AVX2/AESNI/GFNI accelerated ARIA block cipher
4172 implementations for libgcrypt. This implementation is based on work
4173 by Taehee Yoo, with following notable changes:
4174 - Integration to libgcrypt, use of 'aes-common-amd64.h'.
4175 - Use 'vmovddup' for loading GFNI constants.
4176 - Use round loop instead of unrolling for smaller code size and
4177 increased performance.
4178 - Use stack for temporary storage instead of external buffers.
4179 - Use merge ECB encryption/decryption to single function.
4180 - Add 1 to 15 blocks support for AVX ECB functions.
4181 - Add byte-addition fast path for CTR.
4182
4183 ===
4184
4185 Benchmark on AMD Ryzen 9 7900X (zen4, turbo-freq off):
4186
4187 AESNI/AVX:
4188 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4189 ECB enc | 0.715 ns/B 1333 MiB/s 3.36 c/B 4700
4190 ECB dec | 0.712 ns/B 1339 MiB/s 3.35 c/B 4700
4191 CTR enc | 0.714 ns/B 1336 MiB/s 3.36 c/B 4700
4192 CTR dec | 0.714 ns/B 1335 MiB/s 3.36 c/B 4700
4193
4194 GFNI/AVX:
4195 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4196 ECB enc | 0.516 ns/B 1847 MiB/s 2.43 c/B 4700
4197 ECB dec | 0.519 ns/B 1839 MiB/s 2.44 c/B 4700
4198 CTR enc | 0.517 ns/B 1846 MiB/s 2.43 c/B 4700
4199 CTR dec | 0.518 ns/B 1843 MiB/s 2.43 c/B 4700
4200
4201 AESNI/AVX2:
4202 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4203 ECB enc | 0.416 ns/B 2292 MiB/s 1.96 c/B 4700
4204 ECB dec | 0.421 ns/B 2266 MiB/s 1.98 c/B 4700
4205 CTR enc | 0.415 ns/B 2298 MiB/s 1.95 c/B 4700
4206 CTR dec | 0.415 ns/B 2300 MiB/s 1.95 c/B 4700
4207
4208 GFNI/AVX2:
4209 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4210 ECB enc | 0.235 ns/B 4056 MiB/s 1.11 c/B 4700
4211 ECB dec | 0.234 ns/B 4079 MiB/s 1.10 c/B 4700
4212 CTR enc | 0.232 ns/B 4104 MiB/s 1.09 c/B 4700
4213 CTR dec | 0.233 ns/B 4094 MiB/s 1.10 c/B 4700
4214
4215 ===
4216
4217 Benchmark on Intel Core i3-1115G4 (tiger-lake, turbo-freq off):
4218
4219 AESNI/AVX:
4220 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4221 ECB enc | 1.26 ns/B 757.6 MiB/s 3.77 c/B 2993
4222 ECB dec | 1.27 ns/B 753.1 MiB/s 3.79 c/B 2992
4223 CTR enc | 1.25 ns/B 760.3 MiB/s 3.75 c/B 2992
4224 CTR dec | 1.26 ns/B 759.1 MiB/s 3.76 c/B 2992
4225
4226 GFNI/AVX:
4227 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4228 ECB enc | 0.967 ns/B 986.6 MiB/s 2.89 c/B 2992
4229 ECB dec | 0.966 ns/B 987.1 MiB/s 2.89 c/B 2992
4230 CTR enc | 0.972 ns/B 980.8 MiB/s 2.91 c/B 2993
4231 CTR dec | 0.971 ns/B 982.5 MiB/s 2.90 c/B 2993
4232
4233 AESNI/AVX2:
4234 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4235 ECB enc | 0.817 ns/B 1167 MiB/s 2.44 c/B 2992
4236 ECB dec | 0.819 ns/B 1164 MiB/s 2.45 c/B 2992
4237 CTR enc | 0.819 ns/B 1164 MiB/s 2.45 c/B 2992
4238 CTR dec | 0.819 ns/B 1164 MiB/s 2.45 c/B 2992
4239
4240 GFNI/AVX2:
4241 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4242 ECB enc | 0.506 ns/B 1886 MiB/s 1.51 c/B 2992
4243 ECB dec | 0.505 ns/B 1887 MiB/s 1.51 c/B 2992
4244 CTR enc | 0.564 ns/B 1691 MiB/s 1.69 c/B 2992
4245 CTR dec | 0.565 ns/B 1689 MiB/s 1.69 c/B 2992
4246
4247 ===
4248
4249 Benchmark on AMD Ryzen 7 5800X (zen3, turbo-freq off):
4250
4251 AESNI/AVX:
4252 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4253 ECB enc | 0.921 ns/B 1035 MiB/s 3.50 c/B 3800
4254 ECB dec | 0.922 ns/B 1034 MiB/s 3.50 c/B 3800
4255 CTR enc | 0.923 ns/B 1033 MiB/s 3.51 c/B 3800
4256 CTR dec | 0.923 ns/B 1033 MiB/s 3.51 c/B 3800
4257
4258 AESNI/AVX2:
4259 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4260 ECB enc | 0.559 ns/B 1707 MiB/s 2.12 c/B 3800
4261 ECB dec | 0.560 ns/B 1703 MiB/s 2.13 c/B 3800
4262 CTR enc | 0.570 ns/B 1672 MiB/s 2.17 c/B 3800
4263 CTR dec | 0.568 ns/B 1679 MiB/s 2.16 c/B 3800
4264
4265 ===
4266
4267 Benchmark on AMD EPYC 7642 (zen2):
4268
4269 AESNI/AVX:
4270 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4271 ECB enc | 1.22 ns/B 784.5 MiB/s 4.01 c/B 3298
4272 ECB dec | 1.22 ns/B 784.8 MiB/s 4.00 c/B 3292
4273 CTR enc | 1.22 ns/B 780.1 MiB/s 4.03 c/B 3299
4274 CTR dec | 1.22 ns/B 779.1 MiB/s 4.04 c/B 3299
4275
4276 AESNI/AVX2:
4277 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4278 ECB enc | 0.735 ns/B 1298 MiB/s 2.42 c/B 3299
4279 ECB dec | 0.738 ns/B 1292 MiB/s 2.44 c/B 3299
4280 CTR enc | 0.732 ns/B 1303 MiB/s 2.41 c/B 3299
4281 CTR dec | 0.732 ns/B 1303 MiB/s 2.41 c/B 3299
4282
4283 ===
4284
4285 Benchmark on Intel Core i5-6500 (skylake):
4286
4287 AESNI/AVX:
4288 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4289 ECB enc | 1.24 ns/B 766.6 MiB/s 4.48 c/B 3598
4290 ECB dec | 1.25 ns/B 764.9 MiB/s 4.49 c/B 3598
4291 CTR enc | 1.25 ns/B 761.7 MiB/s 4.50 c/B 3598
4292 CTR dec | 1.25 ns/B 761.6 MiB/s 4.51 c/B 3598
4293
4294 AESNI/AVX2:
4295 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4296 ECB enc | 0.829 ns/B 1150 MiB/s 2.98 c/B 3599
4297 ECB dec | 0.831 ns/B 1147 MiB/s 2.99 c/B 3598
4298 CTR enc | 0.829 ns/B 1150 MiB/s 2.98 c/B 3598
4299 CTR dec | 0.828 ns/B 1152 MiB/s 2.98 c/B 3598
4300
4301 ===
4302
4303 Benchmark on Intel Core i5-2450M (sandy-bridge, turbo-freq off):
4304
4305 AESNI/AVX:
4306 ARIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
4307 ECB enc | 2.11 ns/B 452.7 MiB/s 5.25 c/B 2494
4308 ECB dec | 2.10 ns/B 454.5 MiB/s 5.23 c/B 2494
4309 CTR enc | 2.10 ns/B 453.2 MiB/s 5.25 c/B 2494
4310 CTR dec | 2.10 ns/B 453.2 MiB/s 5.25 c/B 2494
4311
4312 [v2]
4313 - Optimization for CTR mode: Use CTR byte-addition path when
4314 counter carry-overflow happen only on ctr-variable but not in
4315 generated counter vector registers.
4316
4317 Cc: Taehee Yoo <[email protected]>
4318
4319 2023-01-21 Jussi Kivilinna <[email protected]>
4320
4321 asm-common-aarch64: fix read-only section for Windows target.
4322 + commit 833a904faf2b90a1b1d1b58e1e9a12f2e8e2378c
4323 * cipher/asm-common-aarch64.h (SECTION_RODATA): Use .rdata for
4324 _WIN32.
4325
4326 2023-01-19 Jussi Kivilinna <[email protected]>
4327
4328 aarch64-asm: align functions to 16 bytes.
4329 + commit 6f8e750c42ffd34900fad30540e92e382111d567
4330 * cipher/camellia-aarch64.S: Align functions to 16 bytes.
4331 * cipher/chacha20-aarch64.S: Likewise.
4332 * cipher/cipher-gcm-armv8-aarch64-ce.S: Likewise.
4333 * cipher/crc-armv8-aarch64-ce.S: Likewise.
4334 * cipher/rijndael-aarch64.S: Likewise.
4335 * cipher/rijndael-armv8-aarch64-ce.S: Likewise.
4336 * cipher/sha1-armv8-aarch64-ce.S: Likewise.
4337 * cipher/sha256-armv8-aarch64-ce.S: Likewise.
4338 * cipher/sha512-armv8-aarch64-ce.S: Likewise.
4339 * cipher/sm3-aarch64.S: Likewise.
4340 * cipher/sm3-armv8-aarch64-ce.S: Likewise.
4341 * cipher/sm4-aarch64.S: Likewise.
4342 * cipher/sm4-armv8-aarch64-ce.S: Likewise.
4343 * cipher/sm4-armv9-aarch64-sve-ce.S: Likewise.
4344 * cipher/twofish-aarch64.S: Likewise.
4345 * mpi/aarch64/mpih-add1.S: Likewise.
4346 * mpi/aarch64/mpih-mul1.S: Likewise.
4347 * mpi/aarch64/mpih-mul2.S: Likewise.
4348 * mpi/aarch64/mpih-mul3.S: Likewise.
4349 * mpi/aarch64/mpih-sub1.S: Likewise.
4350
4351 aarch64-asm: move constant data to read-only section.
4352 + commit b3d7d520a0aab8b3356749fa4765a7f1f5c676d6
4353 * cipher/asm-common-aarch64.h (SECTION_RODATA)
4354 (GET_DATA_POINTER): New.
4355 (GET_LOCAL_POINTER): Remove.
4356 * cipher/camellia-aarch64.S: Move constant data to read-only data
4357 section; Remove unneeded '.ltorg'.
4358 * cipher/chacha20-aarch64.S: Likewise.
4359 * cipher/cipher-gcm-armv8-aarch64-ce.S: Likewise.
4360 * cipher/crc-armv8-aarch64-ce.S: Likewise.
4361 * cipher/rijndael-aarch64.S: Likewise.
4362 * cipher/sha1-armv8-aarch64-ce.S: Likewise.
4363 * cipher/sha256-armv8-aarch64-ce.S: Likewise.
4364 * cipher/sm3-aarch64.S: Likewise.
4365 * cipher/sm3-armv8-aarch64-ce.S: Likewise.
4366 * cipher/sm4-aarch64.S: Likewise.
4367 * cipher/sm4-armv9-aarch64-sve-ce.S: Likewise.
4368 * cipher/twofish-aarch64.S: Likewise.
4369
4370 s390x-asm: move constant data to read-only section.
4371 + commit 65f52773d4bb59a4ea4b7e373fe79b3559ddf312
4372 * cipher/chacha20-s390x.S: Move constant data to read-only
4373 section; Align functions to 16 bytes.
4374 * cipher/poly1305-s390x.S: Likewise.
4375
4376 powerpc-asm: move constant data to read-only section.
4377 + commit d0a109148b799e6ba24bb0e030009e5ac3eaf5dc
4378 * cipher/chacha20-p10le-8x.s: Move constant data to read-only
4379 section.
4380
4381 mpi/amd64: align functions and inner loops to 16 bytes.
4382 + commit 12ad3ea6b49b12ba7ca44bc77e4e87025a6fd095
4383 * mpi/amd64/mpih-add1.S: Align function and inner loop to 16 bytes.
4384 * mpi/amd64/mpih-lshift.S: Likewise.
4385 * mpi/amd64/mpih-mul1.S: Likewise.
4386 * mpi/amd64/mpih-mul2.S: Likewise.
4387 * mpi/amd64/mpih-mul3.S: Likewise.
4388 * mpi/amd64/mpih-rshift.S: Likewise.
4389 * mpi/amd64/mpih-sub1.S: Likewise.
4390
4391 amd64-asm: move constant data to read-only section for cipher algos.
4392 + commit 208b1f3a7bd8709889aa566ff030bcff57ce1cfd
4393 * cipher/camellia-aesni-avx-amd64.S: Move constant data to
4394 read-only section.
4395 * cipher/camellia-aesni-avx2-amd64.h: Likewise.
4396 * cipher/camellia-gfni-avx512-amd64.S: Likewise.
4397 * cipher/chacha20-amd64-avx2.S: Likewise.
4398 * cipher/chacha20-amd64-avx512.S: Likewise.
4399 * cipher/chacha20-amd64-ssse3.S: Likewise.
4400 * cipher/des-amd64.s: Likewise.
4401 * cipher/rijndael-ssse3-amd64-asm.S: Likewise.
4402 * cipher/rijndael-vaes-avx2-amd64.S: Likewise.
4403 * cipher/serpent-avx2-amd64.S: Likewise.
4404 * cipher/sm4-aesni-avx-amd64.S: Likewise.
4405 * cipher/sm4-aesni-avx2-amd64.S: Likewise.
4406 * cipher/sm4-gfni-avx2-amd64.S: Likewise.
4407 * cipher/sm4-gfni-avx512-amd64.S: Likewise.
4408 * cipher/twofish-avx2-amd64.S: Likewise.
4409
4410 amd64-asm: align functions to 16 bytes for cipher algos.
4411 + commit 9d62c54de2b0cd3b1849a27f8998e1f0d43f1583
4412 * cipher/blowfish-amd64.S: Align functions to 16 bytes.
4413 * cipher/camellia-aesni-avx-amd64.S: Likewise.
4414 * cipher/camellia-aesni-avx2-amd64.h: Likewise.
4415 * cipher/camellia-gfni-avx512-amd64.S: Likewise.
4416 * cipher/cast5-amd64.S: Likewise.
4417 * cipher/chacha20-amd64-avx2.S: Likewise.
4418 * cipher/chacha20-amd64-ssse3.S: Likewise.
4419 * cipher/des-amd64.s: Likewise.
4420 * cipher/rijndael-amd64.S: Likewise.
4421 * cipher/rijndael-ssse3-amd64-asm.S: Likewise.
4422 * cipher/salsa20-amd64.S: Likewise.
4423 * cipher/serpent-avx2-amd64.S: Likewise.
4424 * cipher/serpent-sse2-amd64.S: Likewise.
4425 * cipher/sm4-aesni-avx-amd64.S: Likewise.
4426 * cipher/sm4-aesni-avx2-amd64.S: Likewise.
4427 * cipher/sm4-gfni-avx2-amd64.S: Likewise.
4428 * cipher/twofish-amd64.S: Likewise.
4429 * cipher/twofish-avx2-amd64.S: Likewise.
4430
4431 amd64-asm: move constant data to read-only section for hash/mac algos.
4432 + commit 14137d685cf8d779ac4656b64b7d5adcdcf90e3a
4433 * cipher/asm-common-amd64.h (SECTION_RODATA): New.
4434 * cipher/blake2b-amd64-avx2.S: Use read-only section for constant
4435 data.
4436 * cipher/blake2b-amd64-avx512.S: Likewise.
4437 * cipher/blake2s-amd64-avx.S: Likewise.
4438 * cipher/blake2s-amd64-avx512.S: Likewise.
4439 * cipher/poly1305-amd64-avx512.S: Likewise.
4440 * cipher/sha1-avx-amd64.S: Likewise.
4441 * cipher/sha1-avx-bmi2-amd64.S: Likewise.
4442 * cipher/sha1-avx2-bmi2-amd64.S: Likewise.
4443 * cipher/sha1-ssse3-amd64.S: Likewise.
4444 * cipher/sha256-avx-amd64.S: Likewise.
4445 * cipher/sha256-avx2-bmi2-amd64.S: Likewise.
4446 * cipher/sha256-ssse3-amd64.S: Likewise.
4447 * cipher/sha512-avx-amd64.S: Likewise.
4448 * cipher/sha512-avx2-bmi2-amd64.S: Likewise.
4449 * cipher/sha512-avx512-amd64.S: Likewise.
4450 * cipher/sha512-ssse3-amd64.S: Likewise.
4451 * cipher/sha3-avx-bmi2-amd64.S: Likewise.
4452
4453 2023-01-17 Jussi Kivilinna <[email protected]>
4454
4455 tests/bench-slope: skip CPU warm-up in regression tests.
4456 + commit ec57b50bc60a6a5cc98249e2607b4e31bdcba553
4457 * tests/bench-slope.c (warm_up_cpu): Skip in regression tests.
4458
4459 tests/basic: perform x86 vector cluttering only when __SSE2__ is set.
4460 + commit 308a70ac9907de136fae86db40ebe25c904167a2
4461 * tests/basic.c (CLUTTER_VECTOR_REGISTER_AMD64)
4462 (CLUTTER_VECTOR_REGISTER_I386): Set only if __SSE2__ defined.
4463 (clutter_vector_registers) [CLUTTER_VECTOR_REGISTER_AMD64]: Remove
4464 __SSE2__ check for "xmm" clobbers.
4465 (clutter_vector_registers) [CLUTTER_VECTOR_REGISTER_I386]: Likewise.
4466
4467 tests/basic: fix clutter vector register asm for amd64 and i386.
4468 + commit 1a758b08bba09a7bba72b764d4f7c6c7c8f08cf1
4469 * tests/basic.c (clutter_vector_registers): Pass data pointers through
4470 single register for CLUTTER_VECTOR_REGISTER_AMD64 and
4471 CLUTTER_VECTOR_REGISTER_I386 as compiler might attempt to allocate
4472 separate pointer register for each "m" operator.
4473
4474 avx512: tweak zmm16-zmm31 register clearing.
4475 + commit 7de2fb66e065a97f121bd16ab37efba32983a6bd
4476 * cipher/asm-common-amd64.h (spec_stop_avx512): Clear ymm16
4477 before and after vpopcntb.
4478 * cipher/camellia-gfni-avx512-amd64.S (clear_zmm16_zmm31): Clear
4479 YMM16-YMM31 registers instead of XMM16-XMM31.
4480 * cipher/chacha20-amd64-avx512.S (clear_zmm16_zmm31): Likewise.
4481 * cipher/keccak-amd64-avx512.S (clear_regs): Likewise.
4482 (clear_avx512_4regs): Clear all 4 registers with XOR.
4483 * cipher/cipher-gcm-intel-pclmul.c (_gcry_ghash_intel_pclmul)
4484 (_gcry_polyval_intel_pclmul): Clear YMM16-YMM19 registers instead of
4485 ZMM16-ZMM19.
4486 * cipher/poly1305-amd64-avx512.S (POLY1305_BLOCKS): Clear YMM16-YMM31
4487 registers after vector processing instead of XMM16-XMM31.
4488 * cipher/sha512-avx512-amd64.S
4489 (_gcry_sha512_transform_amd64_avx512): Likewise.
4490
4491 2023-01-06 Jussi Kivilinna <[email protected]>
4492
4493 aria: add generic 2-way bulk processing.
4494 + commit 5e1a04f77933a8295df69d818e9effc076dc68cd
4495 * cipher/aria.c (ARIA_context): Add 'bulk_prefetch_ready'.
4496 (aria_crypt_2blks, aria_crypt_blocks, aria_enc_blocks, aria_dec_blocks)
4497 (_gcry_aria_ctr_enc, _gcry_aria_cbc_enc, _gcry_aria_cbc_dec)
4498 (_gcry_aria_cfb_enc, _gcry_aria_cfb_dec, _gcry_aria_ecb_crypt)
4499 (_gcry_aria_xts_crypt, _gcry_aria_ctr32le_enc, _gcry_aria_ocb_crypt)
4500 (_gcry_aria_ocb_auth): New.
4501 (aria_setkey): Setup 'bulk_ops' function pointers.
4502
4503 Add ARIA block cipher.
4504 + commit 316c6d7715d931a0fbe3ebc4e20e6f4d77b716cb
4505 * cipher/Makefile.am: Add 'aria.c'.
4506 * cipher/aria.c: New.
4507 * cipher/cipher.c (cipher_list, cipher_list_algo301): Add ARIA cipher
4508 specs.
4509 * cipher/mac-cmac.c (map_mac_algo_to_cipher): Add GCRY_MAC_CMAC_ARIA.
4510 (_gcry_mac_type_spec_cmac_aria): New.
4511 * cipher/mac-gmac.c (map_mac_algo_to_cipher): Add GCRY_MAC_GMAC_ARIA.
4512 (_gcry_mac_type_spec_gmac_aria): New.
4513 * cipher/mac-internal.h (_gcry_mac_type_spec_cmac_aria)
4514 (_gcry_mac_type_spec_gmac_aria)
4515 (_gcry_mac_type_spec_poly1305mac_aria): New.
4516 * cipher/mac-poly1305.c (poly1305mac_open): Add GCRY_MAC_GMAC_ARIA.
4517 (_gcry_mac_type_spec_poly1305mac_aria): New.
4518 * cipher/mac.c (mac_list, mac_list_algo201, mac_list_algo401)
4519 (mac_list_algo501): Add ARIA MAC specs.
4520 * configure.ac (available_ciphers): Add 'aria'.
4521 (GCRYPT_CIPHERS): Add 'aria.lo'.
4522 (USE_ARIA): New.
4523 * doc/gcrypt.texi: Add GCRY_CIPHER_ARIA128, GCRY_CIPHER_ARIA192,
4524 GCRY_CIPHER_ARIA256, GCRY_MAC_CMAC_ARIA, GCRY_MAC_GMAC_ARIA and
4525 GCRY_MAC_POLY1305_ARIA.
4526 * src/cipher.h (_gcry_cipher_spec_aria128, _gcry_cipher_spec_aria192)
4527 (_gcry_cipher_spec_aria256): New.
4528 * src/gcrypt.h.in (gcry_cipher_algos): Add GCRY_CIPHER_ARIA128,
4529 GCRY_CIPHER_ARIA192 and GCRY_CIPHER_ARIA256.
4530 (gcry_mac_algos): GCRY_MAC_CMAC_ARIA, GCRY_MAC_GMAC_ARIA and
4531 GCRY_MAC_POLY1305_ARIA.
4532 * tests/basic.c (check_ecb_cipher, check_ctr_cipher)
4533 (check_cfb_cipher, check_ocb_cipher) [USE_ARIA]: Add ARIA test-vectors.
4534 (check_ciphers) [USE_ARIA]: Add GCRY_CIPHER_ARIA128, GCRY_CIPHER_ARIA192
4535 and GCRY_CIPHER_ARIA256.
4536 (main): Also run 'check_bulk_cipher_modes' for 'cipher_modes_only'-mode.
4537 * tests/bench-slope.c (bench_mac_init): Add GCRY_MAC_POLY1305_ARIA
4538 setiv-handling.
4539 * tests/benchmark.c (mac_bench): Likewise.
4540
4541 2023-01-04 Jussi Kivilinna <[email protected]>
4542
4543 sm4: add missing OCB 16-way GFNI-AVX512 path.
4544 + commit 30c9a1d101b45908a17c68fa50f4cdf9bd113792
4545 * cipher/sm4.c (_gcry_sm4_ocb_crypt) [USE_GFNI_AVX512]: Add 16-way
4546 GFNI-AVX512 handling.
4547
4548 bulkhelp: change bulk function definition to allow modifying context.
4549 + commit 86db4b02c6e5fd41ae958fb5e1fcf3e296a820ad
4550 * cipher/bulkhelp.h (bulk_crypt_fn_t): Make 'ctx' non-constant and
4551 change 'num_blks' from 'unsigned int' to 'size_t'.
4552 * cipher/camellia-glue.c (camellia_encrypt_blk1_32)
4553 (camellia_encrypt_blk1_64, camellia_decrypt_blk1_32)
4554 (camellia_decrypt_blk1_64): Adjust to match 'bulk_crypt_fn_t'.
4555 * cipher/serpent.c (serpent_crypt_blk1_16, serpent_encrypt_blk1_16)
4556 (serpent_decrypt_blk1_16): Likewise.
4557 * cipher/sm4.c (crypt_blk1_16_fn_t, _gcry_sm4_aesni_avx_crypt_blk1_8)
4558 (sm4_aesni_avx_crypt_blk1_16, _gcry_sm4_aesni_avx2_crypt_blk1_16)
4559 (sm4_aesni_avx2_crypt_blk1_16, _gcry_sm4_gfni_avx2_crypt_blk1_16)
4560 (sm4_gfni_avx2_crypt_blk1_16, _gcry_sm4_gfni_avx512_crypt_blk1_16)
4561 (_gcry_sm4_gfni_avx512_crypt_blk32, sm4_gfni_avx512_crypt_blk1_16)
4562 (_gcry_sm4_aarch64_crypt_blk1_8, sm4_aarch64_crypt_blk1_16)
4563 (_gcry_sm4_armv8_ce_crypt_blk1_8, sm4_armv8_ce_crypt_blk1_16)
4564 (_gcry_sm4_armv9_sve_ce_crypt, sm4_armv9_sve_ce_crypt_blk1_16)
4565 (sm4_crypt_blocks, sm4_crypt_blk1_32, sm4_encrypt_blk1_32)
4566 (sm4_decrypt_blk1_32): Likewise.
4567 * cipher/twofish.c (twofish_crypt_blk1_16, twofish_encrypt_blk1_16)
4568 (twofish_decrypt_blk1_16): Likewise.
4569
4570 Add GMAC-SM4 and Poly1305-SM4.
4571 + commit d1ccc409d4c655f695c7dc042a629a8898bd14eb
4572 * cipher/cipher.c (cipher_list_algo301): Remove comma at the end
4573 of last entry.
4574 * cipher/mac-gmac.c (map_mac_algo_to_cipher): Add SM4.
4575 (_gcry_mac_type_spec_gmac_sm4): New.
4576 * cipher/max-internal.h (_gcry_mac_type_spec_gmac_sm4)
4577 (_gcry_mac_type_spec_poly1305mac_sm4): New.
4578 * cipher/mac-poly1305.c (poly1305mac_open): Add SM4.
4579 (_gcry_mac_type_spec_poly1305mac_sm4): New.
4580 * cipher/mac.c (mac_list, mac_list_algo401, mac_list_algo501): Add
4581 GMAC-SM4 and Poly1304-SM4.
4582 (mac_list_algo101): Remove comma at the end of last entry.
4583 * cipher/md.c (digest_list_algo301): Remove comma at the end of
4584 last entry.
4585 * doc/gcrypt.texi: Add GCRY_MAC_GMAC_SM4 and GCRY_MAC_POLY1305_SM4.
4586 * src/gcrypt.h.in (GCRY_MAC_GMAC_SM4, GCRY_MAC_POLY1305_SM4): New.
4587 * tests/bench-slope.c (bench_mac_init): Setup IV for
4588 GCRY_MAC_POLY1305_SM4.
4589 * tests/benchmark.c (mac_bench): Likewise.
4590
4591 Fix compiler warnings seen with clang-powerpc64le target.
4592 + commit f2153d797f43a5fc8b80c2d908bf7dd6ad1fcc2a
4593 * cipher/rijndael-ppc-common.h (asm_sbox_be): New.
4594 * cipher/rijndael-ppc.c (_gcry_aes_sbox4_ppc8): Use 'asm_sbox_be'
4595 instead of 'vec_sbox_be' since this instrinsics has different
4596 prototype definition on GCC and Clang ('vector uchar' vs 'vector
4597 ulong long').
4598 * cipher/sha256-ppc.c (vec_ror_u32): Remove unused function.
4599
4600 2022-12-14 Jussi Kivilinna <[email protected]>
4601
4602 Add clang support for ARM 32-bit assembly.
4603 + commit 02d5d1d97b3f281cf9c854d7143e346ab76fa384
4604 * configure.ac (gcry_cv_gcc_arm_platform_as_ok)
4605 (gcry_cv_gcc_inline_asm_neon): Remove % prefix from register names.
4606 * cipher/cipher-gcm-armv7-neon.S (vmull_p64): Prefix constant values
4607 with # character instead of $.
4608 * cipher/blowfish-arm.S: Remove % prefix from all register names.
4609 * cipher/camellia-arm.S: Likewise.
4610 * cipher/cast5-arm.S: Likewise.
4611 * cipher/rijndael-arm.S: Likewise.
4612 * cipher/rijndael-armv8-aarch32-ce.S: Likewise.
4613 * cipher/sha512-arm.S: Likewise.
4614 * cipher/sha512-armv7-neon.S: Likewise.
4615 * cipher/twofish-arm.S: Likewise.
4616 * mpi/arm/mpih-add1.S: Likewise.
4617 * mpi/arm/mpih-mul1.S: Likewise.
4618 * mpi/arm/mpih-mul2.S: Likewise.
4619 * mpi/arm/mpih-mul3.S: Likewise.
4620 * mpi/arm/mpih-sub1.S: Likewise.
4621
4622 rijndael-ppc: fix wrong inline assembly constraint.
4623 + commit 3d20308cc529b53d49954e9f0b8d10fa14422303
4624 * cipher/rijndael-ppc-function.h (CBC_ENC_FUNC): Fix outiv constraint.
4625
4626 Fix building AVX512 Intel-syntax assembly with x86-64 clang.
4627 + commit 31837163fbc36680140a17892374380a214c5d16
4628 * cipher/asm-common-amd64.h (spec_stop_avx512_intel_syntax): New.
4629 * cipher/poly1305-amd64-avx512.S: Use spec_stop_avx512_intel_syntax
4630 instead of spec_stop_avx512.
4631 * cipher/sha512-avx512-amd64.S: Likewise.
4632
4633 2022-12-14 NIIBE Yutaka <[email protected]>
4634
4635 build: Fix m4 macros for strict C compiler.
4636 + commit e3b441214f93d8f61875b8223480e57afa2a3f10
4637 * m4/ax_cc_for_build.m4: Fix for no arg.
4638 * m4/noexecstack.m4: Likewise.
4639
4640 build: Fix configure.ac for strict C99.
4641 + commit f62d5cf9f2683efa867fb04332c84ec899818d22
4642 * configure.ac: More fixes for other architecture.
4643
4644 2022-12-13 NIIBE Yutaka <[email protected]>
4645
4646 build: Fix configure.ac for strict C99.
4647 + commit 693ffa145378682229473b0e811a9cea7c4d307a
4648 * configure.ac: Add function declarations for asm functions.
4649
4650 2022-12-12 Jussi Kivilinna <[email protected]>
4651
4652 avx512: tweak AVX512 spec stop, use common macro in assembly.
4653 + commit 8b4e0e9e9a3696be1404938226f0ec3582f12258
4654 * cipher/cipher-gcm-intel-pclmul.c: Use xmm registers for AVX512
4655 spec stop.
4656 * cipher/asm-common-amd64.h (spec_stop_avx512): New.
4657 * cipher/blake2b-amd64-avx512.S: Use spec_stop_avx512.
4658 * cipher/blake2s-amd64-avx512.S: Likewise.
4659 * cipher/camellia-gfni-avx512-amd64.S: Likewise.
4660 * cipher/chacha20-avx512-amd64.S: Likewise.
4661 * cipher/keccak-amd64-avx512.S: Likewise.
4662 * cipher/poly1305-amd64-avx512.S: Likewise.
4663 * cipher/sha512-avx512-amd64.S: Likewise.
4664 * cipher/sm4-gfni-avx512-amd64.S: Likewise.
4665 ---
4666
4667 chacha20-avx512: add handling for any input block count and tweak 16 block code a bit
4668 + commit 996f81dd86ab299f92df581edad49e69ee932139
4669 * cipher/chacha20-amd64-avx512.S: Add tail handling for 8/4/2/1
4670 blocks; Rename `_gcry_chacha20_amd64_avx512_blocks16` to
4671 `_gcry_chacha20_amd64_avx512_blocks`; Tweak 16 parallel block processing
4672 for small speed improvement.
4673 * cipher/chacha20.c (_gcry_chacha20_amd64_avx512_blocks16): Rename to ...
4674 (_gcry_chacha20_amd64_avx512_blocks): ... this.
4675 (chacha20_blocks) [USE_AVX512]: Add AVX512 code-path.
4676 (do_chacha20_encrypt_stream_tail) [USE_AVX512]: Change to handle any
4677 number of full input blocks instead of multiples of 16.
4678
4679 2022-12-06 Jakub Jelen <[email protected]>
4680
4681 fips,rsa: Prevent usage of X9.31 keygen in FIPS mode.
4682 + commit 06ea5b5332ffdb44a0a394d766be8989bcb6a95c
4683 * cipher/rsa.c (rsa_generate): Do not accept use-x931 or derive-parms
4684 in FIPS mode.
4685 * tests/pubkey.c (get_keys_x931_new): Expect failure in FIPS mode.
4686 (check_run): Skip checking X9.31 keys in FIPS mode.
4687 * doc/gcrypt.texi: Document "test-parms" and clarify some cases around
4688 the X9.31 keygen.
4689
4690 2022-11-30 Jakub Jelen <[email protected]>
4691
4692 rsa: Prevent usage of long salt in FIPS mode.
4693 + commit bf1e62e59200b2046680d1d3d1599facc88cfe63
4694 * cipher/rsa-common.c (_gcry_rsa_pss_encode): Prevent usage of large
4695 salt lengths
4696 (_gcry_rsa_pss_verify): Ditto.
4697 * tests/basic.c (check_pubkey_sign): Check longer salt length fails in
4698 FIPS mode
4699 * tests/t-rsa-pss.c (one_test_sexp): Fix function name in error message
4700
4701 2022-11-21 NIIBE Yutaka <[email protected]>
4702
4703 random:w32: Don't emit message for diskperf when it's not useful.
4704 + commit 35abf4d2eb582b78873aa324f6d02976788ffbbc
4705 * random/rndw32.c (slow_gatherer): Suppress emitting by log_info.
4706
4707 2022-11-18 Jakub Jelen <[email protected]>
4708
4709 fips: Mark AES key wrapping as approved.
4710 + commit c34c9e70055ee43e5ef257384fa15941f064e5a4
4711 * src/fips.c (_gcry_fips_indicator_cipher): Add key wrapping mode as
4712 approved.
4713
4714 pkdf2: Add checks for FIPS.
4715 + commit f4a861f3e5ae82f278284061e4829c03edf9c3a7
4716 * cipher/kdf.c (_gcry_kdf_pkdf2): Require 8 chars passphrase for FIPS.
4717 Set bounds for salt length and iteration count in FIPS mode.
4718
4719 2022-11-01 NIIBE Yutaka <[email protected]>
4720
4721 build: Prefer gpgrt-config when available.
4722 + commit 0dcb7e05c9e1c9c2a23abe0a0390680741b61414
4723 * src/libgcrypt.m4: Overriding the decision by
4724 --with-libgcrypt-prefix, use gpgrt-config libgcrypt when gpgrt-config
4725 is available.
4726
4727 2022-10-26 Jussi Kivilinna <[email protected]>
4728
4729 sha3-avx512: fix for "x32" target.
4730 + commit eab1caae7bd529c09d809d4d7c64c97ab7abeab8
4731 * cipher/keccak.c (_gcry_keccak_absorb_blocks_avx512): Change size_t
4732 to u64; change 'const byte **new_lanes' to 'u64 *new_lanes'.
4733 (keccak_absorb_lanes64_avx512): Get new lines pointer from assembly
4734 through 'u64' type.
4735
4736 serpent: accelerate XTS and ECB modes.
4737 + commit 8a1fe5f78f9fed32cd641b3d9d02197f7ba394d8
4738 * cipher/serpent-armv7-neon.S (_gcry_serpent_neon_blk8): New.
4739 * cipher/serpent-avx2-amd64.S (_gcry_serpent_avx2_blk16): New.
4740 * cipher/serpent-sse2-amd64.S (_gcry_serpent_sse2_blk8): New.
4741 * cipher/serpent.c (_gcry_serpent_sse2_blk8)
4742 (_gcry_serpent_avx2_blk16, _gcry_serpent_neon_blk8)
4743 (_gcry_serpent_xts_crypt, _gcry_serpent_ecb_crypt)
4744 (serpent_crypt_blk1_16, serpent_encrypt_blk1_16)
4745 (serpent_decrypt_blk1_16): New.
4746 (serpent_setkey): Setup XTS and ECB bulk functions.
4747
4748 serpent: fix compiler warning on 32-bit ARM.
4749 + commit b50b7ea5cabaf3729afe370b285d78fff9e27d31
4750 * cipher/serpent.c (_gcry_serpent_ocb_crypt)
4751 (_gcry_serpent_ocb_auth) [USE_NEON]: Cast "Ls" to 'const void **'.
4752
4753 twofish: accelerate XTS and ECB modes.
4754 + commit d078a928f5c6024fde89388582b83742d2b8638a
4755 * cipher/twofish-amd64.S (_gcry_twofish_amd64_blk3): New.
4756 * cipher/twofish-avx2-amd64.S (_gcry_twofish_avx2_blk16): New.
4757 (_gcry_twofish_xts_crypt, _gcry_twofish_ecb_crypt)
4758 (_gcry_twofish_avx2_blk16, _gcry_twofish_amd64_blk3)
4759 (twofish_crypt_blk1_16, twofish_encrypt_blk1_16)
4760 (twofish_decrypt_blk1_16): New.
4761 (twofish_setkey): Setup XTS and ECB bulk functions.
4762
4763 sm4: accelerate ECB (for benchmarking)
4764 + commit 14f39993d632815db68a5dca90e021891c9547ab
4765 * cipher/sm4.c (_gcry_sm4_ecb_crypt): New.
4766 (sm4_setkey): Setup ECB bulk function.
4767
4768 sm4: fix lookup-table prefetching.
4769 + commit a43e03ef842b2bb93b10cd2b85230af1f0269ca0
4770 * cipher/sm4.c (sm4_expand_key): Prefetch sbox table.
4771 (sm4_get_crypt_blk1_16_fn): Do not prefetch sbox table.
4772 (sm4_expand_key, _gcry_sm4_ctr_enc, _gcry_sm4_cbc_dec)
4773 (_gcry_sm4_cfb_dec): Prefetch sbox table if table look-up
4774 implementation is used.
4775
4776 camellia: accelerate ECB (for benchmarking)
4777 + commit 6475d0915ffecc54a8d1105262edb28ff4026803
4778 * cipher/bulkhelp.h (bulk_ecb_crypt_128): New.
4779 * cipher/camellia-glue.c (_gcry_camellia_ecb_crypt): New.
4780 (camellia_setkey): Select ECB bulk function with AESNI/AVX2, VAES/AVX2
4781 and GFNI/AVX2.
4782
4783 rijndael-vaes: align asm functions.
4784 + commit 7c1aa4c9452aa1259039680bc1d5ba15124c5f76
4785 * cipher/rijndael-vaes-avx2-amd64.S: Align functions to 16 bytes.
4786
4787 rijndael: add ECB acceleration (for benchmarking purposes)
4788 + commit 84f3d41acb2377d1ed0c2b9e8268de9d35e90af0
4789 * cipher/cipher-internal.h (cipher_bulk_ops): Add 'ecb_crypt'.
4790 * cipher/cipher.c (do_ecb_crypt): Use bulk function if available.
4791 * cipher/rijndael-aesni.c (do_aesni_enc_vec8): Change asm label
4792 '.Ldeclast' to '.Lenclast'.
4793 (_gcry_aes_aesni_ecb_crypt): New.
4794 * cipher/rijndael-armv8-aarch32-ce.S (_gcry_aes_ecb_enc_armv8_ce)
4795 (_gcry_aes_ecb_dec_armv8_ce): New.
4796 * cipher/rijndael-armv8-aarch64-ce.S (_gcry_aes_ecb_enc_armv8_ce)
4797 (_gcry_aes_ecb_dec_armv8_ce): New.
4798 * cipher/rijndael-armv8-ce.c (_gcry_aes_ocb_enc_armv8_ce)
4799 (_gcry_aes_ocb_dec_armv8_ce, _gcry_aes_ocb_auth_armv8_ce): Change
4800 return value from void to size_t.
4801 (ocb_crypt_fn_t, xts_crypt_fn_t): Remove.
4802 (_gcry_aes_armv8_ce_ocb_crypt, _gcry_aes_armv8_ce_xts_crypt): Remove
4803 indirect function call; Return value from called function (allows tail
4804 call optimization).
4805 (_gcry_aes_armv8_ce_ocb_auth): Return value from called function (allows
4806 tail call optimization).
4807 (_gcry_aes_ecb_enc_armv8_ce, _gcry_aes_ecb_dec_armv8_ce)
4808 (_gcry_aes_armv8_ce_ecb_crypt): New.
4809 * cipher/rijndael-vaes-avx2-amd64.S
4810 (_gcry_vaes_avx2_ecb_crypt_amd64): New.
4811 * cipher/rijndael-vaes.c (_gcry_vaes_avx2_ecb_crypt_amd64)
4812 (_gcry_aes_vaes_ecb_crypt): New.
4813 * cipher/rijndael.c (_gcry_aes_aesni_ecb_crypt)
4814 (_gcry_aes_vaes_ecb_crypt, _gcry_aes_armv8_ce_ecb_crypt): New.
4815 (do_setkey): Setup ECB bulk function for x86 AESNI/VAES and ARM CE.
4816
4817 mpi/longlong: update powerpc macros from GCC.
4818 + commit bf5ec001dfcbd4a293d0bd577fd70a0f8286c4e6
4819 * mpi/longlong.h [__powerpc__, __powerpc64__]: Update macros.
4820
4821 hwf-x86: enable VPGATHER usage for AMD CPUs with AVX512.
4822 + commit 4b1cb76e3587a8fdf59673a8368d47e4cd2fe151
4823 * src/hwf-x86.c (detect_x86_gnuc): Move model based checks and
4824 forced soft hwfeatures enablement at end; Enable VPGATHER for
4825 AMD CPUs with AVX512.
4826
4827 sha512-avx512: enable only on Intel CPUs for now.
4828 + commit c0f85e0c8657030eb979a465199a07e2819f81e4
4829 * cipher/sha512.c (sha512_init_common): Enable AVX512 implementation
4830 only for Intel CPUs.
4831
4832 2022-10-26 Jakub Jelen <[email protected]>
4833
4834 hmac,hkdf: Check the HMAC key length in FIPS mode.
4835 + commit b095ea7559734f519fbe92d570afe567330eb474
4836 * src/visibility.c (gcry_md_setkey): Add the check here, too.
4837
4838 Revert "kdf:pkdf2: Require longer input when FIPS mode."
4839 + commit 47db7fe3a0c36523d2ccec31705cffff9a2337bc
4840 * cipher/kdf.c (_gcry_kdf_pkdf2): Remove the length limitation of
4841 passphrase input length.
4842
4843 2022-10-24 NIIBE Yutaka <[email protected]>
4844
4845 build: Update gpg-error.m4.
4846 + commit 12b3bc5a0d9c453d02ae229aadfee82808c10220
4847 * m4/gpg-error.m4: Update from libgpg-error 1.46.
4848
4849 2022-10-19 Jakub Jelen <[email protected]>
4850
4851 tests: Use proper format string for size_t.
4852 + commit b77e7a225bc40ea09fa66969625b97b09a1cbf23
4853
4854
4855 cipher: Do not run RSA encryption selftest by default.
4856 + commit 4e7941587c95fc3ae5fb5686346855395ef6754b
4857 * cipher/rsa.c (selftests_rsa): Skip encryption selftest as this
4858 operation is not claimed as part of the certification.
4859
4860 Revert "tests: Expect the RSA PKCS #1.5 encryption to fail in FIPS mode"
4861 + commit 7468cdfc8b6aa0c6e17c41218d5c5f2b575b16e4
4862 This reverts commit f736f3c70182d9c948f9105eb769c47c5578df35. The pubkey
4863 encryption has already separate explicit FIPS service indicator.
4864
4865 Revert "Do not allow PKCS #1.5 padding for encryption in FIPS"
4866 + commit e83280b36be3be3775427c5842f4274d01992763
4867 This reverts commit c7709f7b23848abf4ba65cb99cb2a9e9c7ebdefc. The pubkey
4868 encryption has already separate explicit FIPS service indicator.
4869
4870 Revert "tests: Expect the OEAP tests to fail in FIPS mode."
4871 + commit 9d56af04dce0795d30374fd575a8500fcf0ae158
4872 This reverts commit 249ca431ef881d510b90a5d3db9cd8507c4d697b. The pubkey
4873 encryption has already separate explicit FIPS service indicator.
4874
4875 Revert "fips: Disable RSA-OAEP padding in FIPS mode."
4876 + commit a7b5cab05f6a7de23c565b1303eb3f198d0b7e2b
4877 This reverts commit e552e37983da0c54840786eeff34481685fde1e9. The pubkey
4878 encryption has already separate explicit FIPS service indicator.
4879
4880 fips: Mark gcry_pk_encrypt/decrypt function non-approved.
4881 + commit 05cb8355d3e66f15425ad85ae2203882e80f4792
4882 * src/fips.c (_gcry_fips_indicator_function): Add
4883 gcry_pk_encrypt/decrypt as non-approved.
4884
4885 fips: Fix fips indicator function.
4886 + commit c5de9e77fb332939695918710b0842030515cce0
4887 * src/fips.c (_gcry_fips_indicator_function): Fix typo in sign/verify
4888 function names.
4889
4890 2022-10-08 Jussi Kivilinna <[email protected]>
4891
4892 doc: fix RFC reference for GCM-SIV.
4893 + commit 94dcd2cf5cd17244eaa96920218f32b64c0cec44
4894 * doc/gcrypt.texi: Fix GCM-SIV RFC reference to RFC-8452.
4895
4896 mpi/longlong.h: i386: use tzcnt instruction for trailing zeros.
4897 + commit f01d4b7a601f68e52c7c7b4647bfe97cb60be26e
4898 * mpi/longlong.h [__i386__] (count_trailing_zeros): Add 'rep' prefix
4899 for 'bsfq'.
4900
4901 mpi/longlong.h: x86-64: use tzcnt instruction for trailing zeros.
4902 + commit 38bd31bc46b992f68c9455ed50a6280943fe6a75
4903 * mpi/longlong.h [__x86_64__] (count_trailing_zeros): Add 'rep' prefix
4904 for 'bsfq'.
4905
4906 mpi/longlong: fix generic smul_ppmm ifdef.
4907 + commit d67f453d1b9de0ddb579de3a14ca8a3801bfead6
4908 * mpi/longlong.h [!umul_ppmm] (smul_ppmm): Change ifdef
4909 from !defined(umul_ppmm) to !defined(smul_ppmm).
4910
4911 mpi/longlong: provide generic implementation using double word type.
4912 + commit aef0ddf4d37ae7667cdf49d406e740e8d8d311cd
4913 * configure.ac: Add check for 'unsigned __int128'.
4914 * mpi/longlong.h (UDWtype): Define for 32-bit or 64-bit when
4915 'unsigned long long' or 'unsigned __int128' is available.
4916 (add_ssaaaa, sub_ddmmss, umul_ppmm, udiv_qrnnd) [UDWtype]: New.
4917
4918 2022-10-06 Jakub Jelen <[email protected]>
4919
4920 tests: Reproducer for short dklen in FIPS mode.
4921 + commit efdc87b305ff326f37acd3a9c2606de24a706cce
4922 * tests/t-kdf.c (check_pbkdf2): Add test vector with short dklen and
4923 verify it fails in FIPS mode
4924
4925 random: Extend the comment about FIPS specifics.
4926 + commit 6e832840a8b7cdd30f77e66685ad0de863d7e84d
4927 * random/rndgetentropy.c (_gcry_rndgetentropy_gather_random): Clarify
4928 description of the chainging DRBG in FIPS mode.
4929
4930 2022-10-04 Jakub Jelen <[email protected]>
4931
4932 random: Get maximum 32B of entropy at once in FIPS Mode.
4933 + commit a6a6e94027abf18a51f5f93bf9fb2cfe5496bdf8
4934 * random/rndgetentropy.c (_gcry_rndgetentropy_gather_random): In fips
4935 mode, gather max 32 B of strong entropy for initialization.
4936
4937 2022-10-02 Jakub Jelen <[email protected]>
4938
4939 tests: Avoid memory leak.
4940 + commit 567bc62e1c3046594088de7209fee7c545ece1e3
4941 * tests/hashtest.c (run_longtest): Avoid memory leak on error
4942
4943 2022-10-02 Jussi Kivilinna <[email protected]>
4944
4945 t-rsa-testparm: fix 'function declaration isn’t a prototype' warning.
4946 + commit 0909186b9e66aa3a8fac7b2571915c45a7bfaeb3
4947 * cipher/t-rsa-testparm.c (check_rsa_testparm): Define parameters as
4948 void.
4949
4950 tests/benchmark: remove VLA usage.
4951 + commit 6419fbb1d3dd365a89623a94448a0335ae4a8554
4952 * cipher/benchmark.c (ccm_aead_init): Avoid VLA in stack array.
4953
4954 tests/bench-slope: remove VLA usage.
4955 + commit 335b8eb1211b3b67541c689da949101db3b669fd
4956 * tests/bench-slope.c (bench_set_cipher_key): New.
4957 (bench_encrypt_init, bench_xts_encrypt_init): Use
4958 'bench_set_cipher_key' to remove VLA usage.
4959
4960 cipher-ccm: remove VLA usage.
4961 + commit ce60a68a1172ea20c1ff72e27e4b0115d805bf48
4962 * cipher/cipher-ccm.c (do_cbc_mac): Avoid VLA for stack array.
4963
4964 mpi/ec: remove VLA usage.
4965 + commit 9978fc22045ca7623a6e0cbf704fb48ab1550419
4966 * mpi/ec-nist.c (_gcry_mpi_ec_nist192_mod, _gcry_mpi_ec_nist224_mod)
4967 (_gcry_mpi_ec_nist256_mod, _gcry_mpi_ec_nist384_mod)
4968 (_gcry_mpi_ec_nist521_mod): Avoid VLA for arrays.
4969 * mpi/ec.c (ec_secp256k1_mod): Avoid VLA for arrays.
4970
4971 2022-09-27 Jussi Kivilinna <[email protected]>
4972
4973 tests/hashtest: add hugeblock & disable-hwf options and 6 gig test vectors
4974 + commit 0cb29a5736cfcd6bce4ce2495cd0481f0bdb34a4
4975 * .gitignore: Add 'tests/hashtest-6g'.
4976 * configure.ac: Add 'tests/hashtest-6g'.
4977 * tests/Makefile: Add 'hashtest-6g'.
4978 * tests/hashtest-6g.in: New.
4979 * tests/hashtest-256g.in: Add SHA3-512 to algos.
4980 * tests/hashtest.c (use_hugeblock): New.
4981 (testvectors): Add 256 GiB test vectors for BLAKE2S, BLAKE2B and
4982 whirlpool; Add 6 GiB test vectors for SHA1, SHA256, SHA512, SHA3, SM3,
4983 BLAKE2S, BLAKE2B, WHIRLPOOL, CRC32 and CRC24.
4984 (run_longtest); Use huge 5 GiB pattern block when requested.
4985 (main): Add '--hugeblock' and '--disable-hwf' options.
4986 * tests/testdrv.c: Add 'hashtest-6g'; Add SHA3 to 'hashtest-256g'.
4987
4988 2022-09-27 Jakub Jelen <[email protected]>
4989
4990 keccak: Use size_t to avoid integer overflow.
4991 + commit 9c828129b2058c3f36e07634637929a54e8377ee
4992 * cipher/keccak-armv7-neon.S: Fix function name in comment and change
4993 parameter type to size_t.
4994 * cipher/keccak.c (keccak_ops_t): Change absorb function signature to
4995 use size_t.
4996 (keccak_absorb_lanes64_avx512): Change nlanes type to size_t.
4997 (_gcry_keccak_absorb_lanes64_armv7_neon): Ditto.
4998 (keccak_absorb_lanes64_armv7_neon): Ditto.
4999 (keccak_absorb_lanes32bi): Ditto.
5000 (keccak_absorb_lanes32bi_bmi2): Ditto.
5001 (keccak_write): Change nlanes variable to use size_t and avoid
5002 overflow when calculating count.
5003 * cipher/keccak_permute_64.h (KECCAK_F1600_ABSORB_FUNC_NAME): Change
5004 nlanes argument to use size_t.
5005
5006 2022-09-27 Tobias Heider <[email protected]>
5007
5008 kdf:pkdf2: Check minimum allowed key size when running in FIPS mode.
5009 + commit 3c04b692de1e7b45b764ff8d66bf84609b012e3a
5010 * cipher/kdf.c (_gcry_kdf_pkdf2): Add output length check.
5011
5012 2022-09-27 NIIBE Yutaka <[email protected]>
5013
5014 kdf:pkdf2: Require longer input when FIPS mode.
5015 + commit 857e6f467d0fc9fd858a73d84122695425970075
5016 * cipher/kdf.c (_gcry_kdf_pkdf2): Add length check.
5017
5018 2022-09-22 Clemens Lang <[email protected]>
5019
5020 fips: Skip PCT if RSA keygen test-parms specified.
5021 + commit c20022ffd4ad2cea51928a109dfa102d711d30ac
5022 * cipher/rsa.c (rsa_generate): Skip PCT is test-parms were specified.
5023 * tests/t-rsa-testparm.c: Add test for this functionality
5024 * tests/Makefile.am: Add test to build system
5025
5026 2022-09-16 NIIBE Yutaka <[email protected]>
5027
5028 More clean up.
5029 + commit 82226dad7ae0effa0d96645476f0401f94361141
5030 * cipher/cipher-ccm.c (_gcry_cipher_ccm_tag): Add static qualifier.
5031 * mpi/ec-ed25519.c: Include ec-internal.h.
5032 * src/secmem.c (MB_WIPE_OUT): Remove extra semicolon.
5033
5034 Move function prototype to cipher.h.
5035 + commit f97b2f706dd0a8820828e9015340a895539ed216
5036 * cipher/kdf-internal.h: Move from here.
5037 * src/cipher.h (blake2b_vl_hash): To here.
5038
5039 Minor clean up.
5040 + commit 984d94fa9ffff69bd1bdb5d418889d2e6b2745e2
5041 * mpi/mpi-internal.h: Remove extra semicolon from the macro.
5042 * mpi/mpih-mul.c: Likewise.
5043 * src/cipher-proto.h: Remove duplication for enum pk_encoding.
5044 * mpi/mpi-pow.c (_gcry_mpi_powm): Initialize XSIZE.
5045
5046 Fix _gcry_err_code_to_errno.
5047 + commit 3962623fe6de5c6d6604db90c8c0869fc3d3b7cf
5048 * src/gcrypt-int.h: Use gpg_err_code_to_errno.
5049
5050 Fix use of noreturn.
5051 + commit 000c50e0781920d691cc60c345a7bd4d770e92d5
5052 * doc/yat2m.c: Use __noreturn__.
5053 * src/g10lib.h: Likewise.
5054
5055 2022-09-08 NIIBE Yutaka <[email protected]>
5056
5057 Silence compiler warnings for unused internal value.
5058 + commit 37dc9f8fd00a3aff175f34f094557899207d7ef8
5059 * cipher/primegen.c (gen_prime): Fix write only variable.
5060 * src/dumpsexp.c (parse_and_print): Likewise.
5061
5062 Fix function prototypes.
5063 + commit 10d9878dd84fe89a598b6d5ac313869e5f8ffdae
5064 * random/random-csprng.c (random_poll): It's no args.
5065 * src/secmem.c (_gcry_secmem_module_init): Likewise.
5066 (_gcry_secmem_term): Likewise.
5067
5068 2022-08-26 NIIBE Yutaka <[email protected]>
5069
5070 cipher: Check arguments for setup_geniv.
5071 + commit c9008345c114ddf2f2ecbfe8dbab03c6d0649408
5072 * cipher/cipher.c (_gcry_cipher_setup_geniv): Validate the lengths.
5073
5074 2022-08-25 NIIBE Yutaka <[email protected]>
5075
5076 cipher: Support internal generation of IV for AEAD cipher mode.
5077 + commit 373b1f6c17948fa7d31880c3705391bef08a0471
5078 * cipher/cipher-gcm.c (_gcry_cipher_gcm_setiv_zero): New.
5079 (_gcry_cipher_gcm_encrypt, _gcry_cipher_gcm_decrypt)
5080 (_gcry_cipher_gcm_authenticate): Use _gcry_cipher_gcm_setiv_zero.
5081 * cipher/cipher-internal.h (struct gcry_cipher_handle): Add aead field.
5082 * cipher/cipher.c (_gcry_cipher_setiv): Check calling setiv to reject
5083 direct invocation in FIPS mode.
5084 (_gcry_cipher_setup_geniv, _gcry_cipher_geniv): New.
5085 * doc/gcrypt.texi: Add explanation for two new functions.
5086 * src/gcrypt-int.h (_gcry_cipher_setup_geniv, _gcry_cipher_geniv): New.
5087 * src/gcrypt.h.in (enum gcry_cipher_geniv_methods): New.
5088 (gcry_cipher_setup_geniv, gcry_cipher_geniv): New.
5089 * src/libgcrypt.def (gcry_cipher_setup_geniv, gcry_cipher_geniv): Add.
5090 * src/libgcrypt.vers: Likewise.
5091 * src/visibility.c (gcry_cipher_setup_geniv, gcry_cipher_geniv): Add.
5092 * src/visibility.h: Likewise.
5093
5094 2022-08-23 Jakub Jelen <[email protected]>
5095
5096 tests: Expect the OEAP tests to fail in FIPS mode.
5097 + commit 249ca431ef881d510b90a5d3db9cd8507c4d697b
5098 * tests/basic.c (check_pubkey_crypt): Expect the OAEP padding encryption
5099 to fail in FIPS mode
5100 * tests/pkcs1v2.c (check_oaep): Expect the OAEP tests to fail in FIPS
5101 mode
5102
5103 fips: Disable RSA-OAEP padding in FIPS mode.
5104 + commit e552e37983da0c54840786eeff34481685fde1e9
5105 * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi): Block OAEP padding
5106 in FIPS mode for encryption
5107 * cipher/rsa.c (rsa_decrypt): Block OAEP padding in FIPS mode for
5108 decryption
5109
5110 gcrypt.h: Fix function name in comment.
5111 + commit 0d69847e41e1803654180544fffd4cba3f49cb12
5112
5113
5114 random: Use getrandom (GRND_RANDOM) in FIPS mode.
5115 + commit aab1d63e4def41593312f76de016c885ffafecde
5116 * random/rndgetentropy.c (_gcry_rndgetentropy_gather_random): Use
5117 GRND_RANDOM in FIPS Mode
5118
5119 Simplify the PCT for RSA and ECDSA.
5120 + commit a527d252b89958864153da9ad149e97bb96e1692
5121 Could be squashed.
5122
5123 * cipher/ecc.c (test_keys_fips): Simplify to accept key in SEXP format
5124 (nist_generate_key): Skip call to test keys
5125 (ecc_generate): Call test keys in FIPS mode later, when we have
5126 complete SEXP key structure.
5127 * cipher/rsa.c (test_keys_fips): Simplify to accept key in SEXP format
5128 (generate_fips): Skip selftest at this stage
5129 (rsa_generate): Test the keys later when we already have key in SEXP
5130 format
5131
5132 ecc: Run PCT also with the digest step.
5133 + commit d259993b9456c7abe465f234c4a6f9688a16db40
5134 * cipher/ecc.c (test_keys_fips): New function
5135 (nist_generate_key): In FIPS mode, execute new PCT test
5136 ---
5137
5138 rsa: Run PCT in FIPS mode also with digest step.
5139 + commit 505f048cac8e5af92d3431bd97ade492d1a30bc2
5140 * cipher/rsa.c (test_keys_fips): New.
5141 (generate_fips): Call test_keys_fips.
5142
5143 fips: Add function-name based FIPS indicator.
5144 + commit 05a9c9d1ba1db6c1cd160fba979e9ddf4700a0c0
5145 * doc/gcrypt.texi: Document the new function-based fips indicator
5146 GCRYCTL_FIPS_SERVICE_INDICATOR_FUNCTION
5147 * src/fips.c (_gcry_fips_indicator_function): New function indicating
5148 non-approved functions.
5149 * src/gcrypt.h.in (enum gcry_ctl_cmds): New symbol
5150 GCRYCTL_FIPS_SERVICE_INDICATOR_FUNCTION
5151 * src/global.c (_gcry_vcontrol): Handle new FIPS indicator.
5152
5153 fips: Run digest&sign self tests for RSA and ECC in FIPS mode.
5154 + commit 1fc7bfc351ba1d7fa31c0c62a24ad78e9e1cfd5b
5155 * cipher/ecc.c (selftest_hash_sign): Implement digest & sign KAT
5156 (selftests_ecdsa): Run the original basic test only with extended tests
5157 (run_selftests): Pass-through the extended argument
5158 * cipher/rsa.c (selftest_hash_sign_2048): Implement digest & sign KAT
5159 (selftests_rsa): Run the original basic test only with extended tests
5160 (run_selftests): Pass-through the extended argument
5161
5162 2022-08-18 Milan Broz <[email protected]>
5163
5164 kdf: Allow empty password for Argon2.
5165 + commit a20700c55f0eb8dbb8368b756a571c116163a0bc
5166 * cipher/kdf.c (_gcry_kdf_open) allow empty password for Argon2.
5167
5168 kdf: Restructure KDF test vectors.
5169 + commit 8a1f50e66364389b8a867801ead8327a663b0c03
5170 * tests/t-kdf.c: Restructure KDF test vectors to allow easy addition
5171 new vectors. Also remove some ugly C code like goto again.
5172
5173 2022-08-02 Clemens Lang <[email protected]>
5174
5175 tests/basic: Add ifdefs for SM4 and CAMELLIA tests.
5176 + commit 97e2c237f15dcdb44152887f4773f1f212b529bd
5177 * tests/basic.c (check_gcm_siv_cipher): Do not run test vectors that
5178 are known to fail when compiled without support for SM4 or CAMELLIA.
5179
5180 2022-08-01 Jussi Kivilinna <[email protected]>
5181
5182 basic: gcm-siv: add fips checks for SM4 and CAMELLIA128.
5183 + commit a8f66410ca0ded040abea4790efaeb36bb4ccc91
5184 * tests/basic.c (check_gcm_siv_cipher): Add 'flags' for test vectors
5185 and set FLAG_NOFIPS for SM4 and CAMELLIA128 test vectors; Add FIPS check
5186 for test vectors; Change printing "aes-gcm-siv" on fail messages to
5187 "algo %d GCM-SIV".
5188
5189 2022-07-31 Jussi Kivilinna <[email protected]>
5190
5191 sm4: fix unused parameter compiler warning.
5192 + commit a0c933f6fed0612558ff75fb23cbf78e2dea1f16
5193 * cipher/sm4.c (sm4_get_crypt_blk1_16_fn): '(void)'-access ctx
5194 parameter to avoid compiler warning on powerpc.
5195
5196 2022-07-31 Tianjia Zhang <[email protected]>
5197
5198 sm4: add ARMv8 CE accelerated implementation for XTS mode.
5199 + commit 8287dea8379fa9e43dc331c6bd444dd25a962e4b
5200 * cipher/sm4-armv8-aarch64-ce.S (_gcry_sm4_armv8_ce_xts_crypt): New.
5201 * cipher/sm4.c (_gcry_sm4_armv8_ce_xts_crypt): New.
5202 (_gcry_sm4_xts_crypt) [USE_ARM_CE]: Add ARMv8 CE implementation for XTS.
5203
5204 2022-07-31 Jussi Kivilinna <[email protected]>
5205
5206 Simplify AES key schedule implementation.
5207 + commit db5136c4d9331c001bbe91cfe6625ae7738f8575
5208 * cipher/rijndael-armv8-ce.c (_gcry_aes_armv8_ce_setkey): New key
5209 schedule with simplified structure and less stack usage.
5210 * cipher/rijndael-internal.h (RIJNDAEL_context_s): Add
5211 'keyschedule32b'.
5212 (keyschenc32b): New.
5213 * cipher/rijndael-ppc-common.h (vec_u32): New.
5214 * cipher/rijndael-ppc.c (vec_bswap32_const): Remove.
5215 (_gcry_aes_sbox4_ppc8): Optimize for less instructions emitted.
5216 (keysched_idx): New.
5217 (_gcry_aes_ppc8_setkey): New key schedule with simplified structure.
5218 * cipher/rijndael-tables.h (rcon): Remove.
5219 * cipher/rijndael.c (sbox4): New.
5220 (do_setkey): New key schedule with simplified structure and less
5221 stack usage.
5222
5223 rijndael-ppc: small speed-up for CBC and CFB encryption.
5224 + commit 2ac6c24aa53024eb415d49f52229e868f72f47f8
5225 * cipher/rijndael-ppc-common.h (AES_ENCRYPT_ALL): Remove
5226 * cipher/rijndael-ppc-functions.h (CFB_ENC_FUNC)
5227 (CBC_ENC_FUNC): Removed two block unrolled loop; Optimized single
5228 block loop for shorter critical-path.
5229
5230 2022-07-25 Jussi Kivilinna <[email protected]>
5231
5232 sha512: add AArch64 crypto/SHA512 extension implementation.
5233 + commit e51d3b8330a1d4b15e3484df90646e075c02f54b
5234 * cipher/Makefile.am: Add 'sha512-armv8-aarch64-ce.S'.
5235 * cipher/sha512-armv8-aarch64-ce.S: New.
5236 * cipher/sha512.c (ATTR_ALIGNED_64, USE_ARM64_SHA512): New.
5237 (k): Make array aligned to 64 bytes.
5238 [USE_ARM64_SHA512] (_gcry_sha512_transform_armv8_ce): New.
5239 [USE_ARM64_SHA512] (do_sha512_transform_armv8_ce): New.
5240 (sha512_init_common) [USE_ARM64_SHA512]: Use ARMv8-SHA512 accelerated
5241 implementation if HW feature available.
5242 * configure.ac: Add 'sha512-armv8-aarch64-ce.lo'.
5243 (gcry_cv_gcc_inline_asm_aarch64_sha3_sha512_sm3_sm4)
5244 (HAVE_GCC_INLINE_ASM_AARCH64_SHA3_SHA512_SM3_SM4): New.
5245
5246 blake2: add AVX512 accelerated implementations.
5247 + commit 909daa700e4b45d75469df298ee564b8fc2f4b72
5248 * cipher/Makefile.am: Add 'blake2b-amd64-avx512.S' and
5249 'blake2s-amd64-avx512.S'.
5250 * cipher/blake2.c (USE_AVX512): New.
5251 (ASM_FUNC_ABI): Setup attribute if USE_AVX2 or USE_AVX512 enabled in
5252 addition to USE_AVX.
5253 (BLAKE2B_CONTEXT_S, BLAKE2S_CONTEXT_S): Add 'use_avx512'.
5254 (_gcry_blake2b_transform_amd64_avx512)
5255 (_gcry_blake2s_transform_amd64_avx512): New.
5256 (blake2b_transform, blake2s_transform) [USE_AVX512]: Add AVX512 path.
5257 (blake2b_init_ctx, blake2s_init_ctx) [USE_AVX512]: Use AVX512 if HW
5258 feature available.
5259 * cipher/blake2b-amd64-avx512.S: New.
5260 * cipher/blake2s-amd64-avx512.S: New.
5261 * configure.ac: Add 'blake2b-amd64-avx512.lo' and
5262 'blake2s-amd64-avx512.lo'.
5263
5264 sha3: Add x86-64 AVX512 accelerated implementation.
5265 + commit beaad75f4655e5316ce24f75ef172c231fd47fc1
5266 * LICENSES: Add 'cipher/keccak-amd64-avx512.S'.
5267 * configure.ac: Add 'keccak-amd64-avx512.lo'.
5268 * cipher/Makefile.am: Add 'keccak-amd64-avx512.S'.
5269 * cipher/keccak-amd64-avx512.S: New.
5270 * cipher/keccak.c (USE_64BIT_AVX512, ASM_FUNC_ABI): New.
5271 [USE_64BIT_AVX512] (_gcry_keccak_f1600_state_permute64_avx512)
5272 (_gcry_keccak_absorb_blocks_avx512, keccak_f1600_state_permute64_avx512)
5273 (keccak_absorb_lanes64_avx512, keccak_avx512_64_ops): New.
5274 (keccak_init) [USE_64BIT_AVX512]: Enable x86-64 AVX512 implementation
5275 if supported by HW features.
5276
5277 2022-07-21 Jussi Kivilinna <[email protected]>
5278
5279 sm4-arm-sve-ce: use 32 parallel blocks for XTS and CTR32LE.
5280 + commit dca0bd133dd08ec88e0b4c454cfc26c9093572a9
5281 * cipher/sm4.c (sm4_crypt_blk1_32) [USE_ARM_SVE_CE]: Add SVE-SM4 code
5282 path.
5283
5284 sm4 & camellia: add generic bulk acceleration for CTR32LE mode (GCM-SIV)
5285 + commit cf956793afc2cdbd3b20caa3d186ccb8023b804c
5286 * cipher/bulkhelp.h (bulk_ctr32le_enc_128): New.
5287 * cipher/camellia-glue.c (_gcry_camellia_ctr32le_enc): New.
5288 (camellia_setkey): Setup `bulk_ops->ctr32le_enc` if any AVX2
5289 implementation is available.
5290 * cipher/sm4.c (_gcry_sm4_ctr32le_enc): New.
5291 (sm4_setkey): Setup `bulk_ops->ctr32le_enc`.
5292 * tests/basic.c (check_gcm_siv_cipher): Add large bulk encryption
5293 test vectors for SM4 and CAMELLIA128.
5294
5295 sm4: add amd64 GFNI/AVX512 implementation.
5296 + commit eaed633c1662d8a98042ac146c981113f2807b22
5297 * cipher/Makefile.am: Add 'sm4-gfni-avx512-amd64.S'.
5298 * cipher/sm4-gfni-avx512-amd64.S: New.
5299 * cipher/sm4-gfni.c (USE_GFNI_AVX512): New.
5300 (SM4_context): Add 'use_gfni_avx512' and 'crypt_blk1_16'.
5301 (_gcry_sm4_gfni_avx512_expand_key, _gcry_sm4_gfni_avx512_ctr_enc)
5302 (_gcry_sm4_gfni_avx512_cbc_dec, _gcry_sm4_gfni_avx512_cfb_dec)
5303 (_gcry_sm4_gfni_avx512_ocb_enc, _gcry_sm4_gfni_avx512_ocb_dec)
5304 (_gcry_sm4_gfni_avx512_ocb_auth, _gcry_sm4_gfni_avx512_ctr_enc_blk32)
5305 (_gcry_sm4_gfni_avx512_cbc_dec_blk32)
5306 (_gcry_sm4_gfni_avx512_cfb_dec_blk32)
5307 (_gcry_sm4_gfni_avx512_ocb_enc_blk32)
5308 (_gcry_sm4_gfni_avx512_ocb_dec_blk32)
5309 (_gcry_sm4_gfni_avx512_crypt_blk1_16)
5310 (_gcry_sm4_gfni_avx512_crypt_blk32, sm4_gfni_avx512_crypt_blk1_16)
5311 (sm4_crypt_blk1_32, sm4_encrypt_blk1_32, sm4_decrypt_blk1_32): New.
5312 (sm4_expand_key): Add GFNI/AVX512 code-path
5313 (sm4_setkey): Use GFNI/AVX512 if supported by CPU; Setup
5314 `ctx->crypt_blk1_16`.
5315 (sm4_encrypt, sm4_decrypt, sm4_get_crypt_blk1_16_fn, _gcry_sm4_ctr_enc)
5316 (_gcry_sm4_cbc_dec, _gcry_sm4_cfb_dec, _gcry_sm4_ocb_crypt)
5317 (_gcry_sm4_ocb_auth) [USE_GFNI_AVX512]: Add GFNI/AVX512 code path.
5318 (_gcry_sm4_xts_crypt): Change parallel block size from 16 to 32.
5319 * configure.ac: Add 'sm4-gfni-avx512-amd64.lo'.
5320
5321 2022-07-21 Tianjia Zhang <[email protected]>
5322
5323 Add SM4 ARMv9 SVE CE assembly implementation.
5324 + commit 2dc2654006746a25f9cb6b24786867f1725ac244
5325 * cipher/Makefile.am: Add 'sm4-armv9-aarch64-sve-ce.S'.
5326 * cipher/sm4-armv9-aarch64-sve-ce.S: New.
5327 * cipher/sm4.c (USE_ARM_SVE_CE): New.
5328 (SM4_context) [USE_ARM_SVE_CE]: Add 'use_arm_sve_ce'.
5329 (_gcry_sm4_armv9_sve_ce_crypt, _gcry_sm4_armv9_sve_ce_ctr_enc)
5330 (_gcry_sm4_armv9_sve_ce_cbc_dec, _gcry_sm4_armv9_sve_ce_cfb_dec)
5331 (sm4_armv9_sve_ce_crypt_blk1_16): New.
5332 (sm4_setkey): Enable ARMv9 SVE CE if supported by HW.
5333 (sm4_get_crypt_blk1_16_fn) [USE_ARM_SVE_CE]: Add ARMv9 SVE CE
5334 bulk functions.
5335 (_gcry_sm4_ctr_enc, _gcry_sm4_cbc_dec, _gcry_sm4_cfb_dec)
5336 [USE_ARM_SVE_CE]: Add ARMv9 SVE CE bulk functions.
5337 * configure.ac: Add 'sm4-armv9-aarch64-sve-ce.lo'.
5338
5339 Add ARMv9 SVE2 and optional Crypto Extension HW features.
5340 + commit ea5e71f9c8eb32d8b820be85eb34a8926cfa834d
5341 * configure.ac (sve2support, gcry_cv_gcc_inline_asm_aarch64_sve2)
5342 (ENABLE_SVE2_SUPPORT): New.
5343 * doc/gcrypt.texi: Add "sve2, sveaes, svepmull, svesha3, svesm4" to
5344 ARM hardware features list.
5345 * src/g10lib.h (HWF_ARM_SVE2, HWF_ARM_SVEAES, HWF_ARM_SVEPMULL)
5346 (HWF_ARM_SVESHA3, HWF_ARM_SVESM4): New.
5347 * src/hwf-arm.c (arm_features): Add
5348 "sve2, sveaes, svepmull, svesha3, svesm4".
5349 * src/hwfeatures.c (hwflist): Add
5350 "arm-sve2, arm-sveaes, arm-svepmull, arm-svesha3, arm-svesm4".
5351
5352 Add detection for HW feature "ARMv8 SVE"
5353 + commit 8921b5221e333626884ad291881f79e0583d574a
5354 * configure.ac (svesupport, gcry_cv_gcc_inline_asm_aarch64_sve)
5355 (ENABLE_SVE_SUPPORT): New.
5356 * doc/gcrypt.texi: Add "arm-sve" to HW features list.
5357 * src/g10lib.h (HWF_ARM_SVE): New.
5358 * src/hwf-arm.c (arm_features): Add "sve".
5359 * src/hwfeatures.c (hwflist): Add "arm-sve".
5360
5361 2022-07-21 NIIBE Yutaka <[email protected]>
5362
5363 Cleanup for type definitions of byte, ushort, u32, and u64.
5364 + commit 3494140847cb8056d017418fefa25e7bbcfaa32c
5365 * src/types.h: Use macros defined by configure script.
5366 * src/hmac256.c: Fix for HAVE_U32.
5367 * cipher/poly1305.c: Fix for HAVE_U64.
5368
5369 2022-07-20 Jussi Kivilinna <[email protected]>
5370
5371 visibility: add missing fips_is_operational check for gcry_md_extract.
5372 + commit 434a58d0e784958d56ad4eceebec10ee97933108
5373 * src/visibility.c (gcry_md_extract): Add 'fips_is_operational' check.
5374
5375 hwf-x86: fix UBSAN warning.
5376 + commit 9636c88262fc5704cb4136cae975932acee6d08f
5377 * src/hwf-x86.c (detect_x86_gnuc): Change `(1 << 31)` to `(1U << 31)`
5378 to fix undefined behaviour.
5379
5380 hwf-arm: add ARM HW feature detection support for MacOS.
5381 + commit 4abcedcea82036b18b3906e99f8aaf0a1f6c8b9a
5382 * configure.ac: Add detection for header 'sys/sysctl.h' and system
5383 function 'sysctlbyname'.
5384 * src/hwf-arm.c (HAS_APPLE_SYSCTLBYNAME)
5385 (detect_arm_apple_sysctlbyname): New.
5386 (detect_arm_hwf_by_toolchain) [__ARM_FEATURE_CRYPTO]: Also check for
5387 ENABLE_ARM_CRYPTO_SUPPORT.
5388 (_gcry_hwf_detect_arm) [HAS_APPLE_SYSCTLBYNAME]: Check HWFs with
5389 'detect_arm_apple_sysctlbyname' function.
5390
5391 2022-07-19 NIIBE Yutaka <[email protected]>
5392
5393 cipher: Add buildhelp.h to source to be distributed.
5394 + commit 9a134fb7f286b94904585f3c3958c944999f20cc
5395 * cipher/Makefile.am (libcipher_la_SOURCES): Add bulkhelp.h.
5396
5397 build: Fix configure script.
5398 + commit 2efb90104591eda490d9f7ba281aa29bceb92487
5399 * configure.ac (AC_USE_SYSTEM_EXTENSIONS): Use it earlier.
5400
5401 build: Update config.guess, config.sub, and config.rpath.
5402 + commit e633cc3315aa350d9d28cc27a6deb6304c68ef77
5403 * build-aux/config.guess: Update from upstream.
5404 * build-aux/config.sub: Ditto.
5405 * build-aux/config.rpath: Update from gettext 0.21.
5406
5407 2022-07-07 NIIBE Yutaka <[email protected]>
5408
5409 cipher: Fix gcry_pk_hash_verify for explicit hash.
5410 + commit b2a64ed4f34abbd3871336503bec5ffeb3ad547b
5411 * cipher/pubkey.c (_gcry_pk_verify_md): Implement support of explicit
5412 hash.
5413 * tests/t-ecdsa.c (one_test_sexp): Use explicit hash.
5414
5415 2022-07-07 Clemens Lang via Gcrypt-devel <[email protected]>
5416
5417 tests/t-kdf: Test KDF FIPS indicator.
5418 + commit 37b812f5e2a3c80d4bc104512248a07268f3c98b
5419 * tests/t-kdf.c (check_fips_indicators): Add test for gcry_control
5420 (GCRYCTL_FIPS_SERVICE_INDICATOR_KDF).
5421
5422 tests: Test gcry_pk_hash_sign w/explicit hash algo.
5423 + commit 45a139b166a3fa18eb1eddf7e02b5cdd890a6c37
5424 * tests/t-ecdsa.c (one_test_sexp): Re-run signature operation with hash
5425 algorithm explicitly specified in data_tmpl as documented in the
5426 manpage.
5427
5428 2022-07-06 Jussi Kivilinna <[email protected]>
5429
5430 sm4: fix wrong macro used for GFNI/AVX2 code-path.
5431 + commit 66ef99bb1804d754edaa5d6b37651e92e918540e
5432 * cipher/sm4.c (sm4_get_crypt_blk1_16_fn): Use USE_GFNI_AVX2 for
5433 GFNI/AVX2 block.
5434
5435 sm4: fix use of GFNI/AVX2 accelerated key expansion.
5436 + commit 935e211af145c559c9147026339ceb947edb6d6a
5437 * cipher/sm4.c [USE_GFNI_AVX2] (_gcry_sm4_gfni_avx_expand_key): Remove.
5438 [USE_GFNI_AVX2] (_gcry_sm4_gfni_avx2_expand_key): New.
5439 (sm4_expand_key): Change '_gcry_sm4_gfni_avx_expand_key' to
5440 '_gcry_sm4_gfni_avx2_expand_key'.
5441
5442 camellia-gfni-avx512: remove copy-paste / leftover extra instructions.
5443 + commit 99b7375bd6162c7c3f481ab6d0d106bfcb5b2b07
5444 * cipher/camellia-gfni-avx512-amd64.S: Remove extranous copy-pasted
5445 instructions after `.Lbswap128_mask` constant; Remove left-over plaintext
5446 xorring in OCB encryption input loading macro.
5447
5448 camellia-gfni-avx512: add missing register clearing on function exits.
5449 + commit ac14d9ee7a094a2b9a26b1e3f4d36f59dbf68b40
5450 * cipher/camellia-gfni-avx512-amd64.S: Add clear_regs() at externally
5451 visible function epilogues.
5452
5453 tests/basic: enable IV checks for CBC/CFB/CTR bulk tests.
5454 + commit fd3ed68754eb1741cef22bce8bc2957f3853a292
5455 * cipher/cipher.c (_gcry_cipher_ctl): Add handling for
5456 'PRIV_CIPHERCTL_GET_COUNTER'.
5457 * src/gcrypt-testapi.h (PRIV_CIPHERCTL_GET_COUNTER): New.
5458 * tests/basic.c (cipher_cbc_bulk_test, cipher_cfb_bulk_test): Restore
5459 IV checks by reading current IV from CBC/CFB cipher handle using
5460 PRIV_CIPHERCTL_GET_INPUT_VECTOR.
5461 (cipher_ctr_bulk_test): Restore counter checks by reading current
5462 counter from CTR cipher handle using PRIV_CIPHERCTL_GET_COUNTER.
5463
5464 2022-07-06 NIIBE Yutaka <[email protected]>
5465
5466 cipher,chacha20: Conditionalize a variable.
5467 + commit 8d5053fb08cf2a38360be2d2f5534b137c299e74
5468 * cipher/chacha20.c (_gcry_chacha20_poly1305_decrypt): Only
5469 use skip_stitched when one of macros is defined.
5470
5471 2022-07-06 Clemens Lang <[email protected]>
5472
5473 tests/basic: Skip non-FIPS tests in FIPS mode.
5474 + commit 9d6203532d9012ff82aa218bd1a17797cf8017e5
5475 * tests/basic.c (check_pubkey): Skip non-FIPS tests in FIPS mode, fixes
5476 a logic error previously introduced in e9698002.
5477
5478 2022-07-05 NIIBE Yutaka <[email protected]>
5479
5480 kdf: Fix memory leak on error.
5481 + commit e2a7a0c9f5d258051b26babeac20e4a7cfb5a6ac
5482 * cipher/kdf.c (hkdf_open): Free the memory on the error path.
5483
5484 2022-07-01 Clemens Lang <[email protected]>
5485
5486 fips: Skip selftests of unsupported PK algos.
5487 + commit c5480b4934bb0adecdfc29a47b5e123f995507e1
5488 * src/fips.c (run_pubkey_selftests): Do not run selftests for disabled
5489 public key algorithms.
5490
5491 build: Skip PK-specific tests if algo is disabled.
5492 + commit 56000fb5c42f01f1ced4e3dd0bb30662c0ba87c3
5493 * configure.ac: Define AM_CONDITIONALs for USE_DSA, USE_RSA,
5494 USE_ELGAMAL, USE_ECC so Makefiles can depend on them.
5495 * tests/Makefile.am: Skip tests that test only one public key algorithm
5496 if that algorithm is disabled.
5497
5498 tests/keygen.c: Skip unavailable PK algorithms.
5499 + commit 572b0bf9668d6a01cd7ce1c2227d5a4899ad3502
5500 * tests/keygen.c (show_mpi, check_rsa_keys, check_elg_keys,
5501 check_dsa_keys, check_generated_ecc_key, check_ecc_keys): Skip tests
5502 if the required public key algorithm is not available.
5503
5504 tests/benchmark: Skip unavailable PK algorithms.
5505 + commit 78c0d76f809262184ef0198be087fc2b133c880b
5506 * tests/benchmark.c (cipher_bench, rsa_bench, elg_bench, dsa_bench,
5507 ecc_bench): Do not run benchmarks for PK algorithms that are not
5508 supported in the current build.
5509
5510 tests/basic: Skip tests if PK algo is unavailable.
5511 + commit e78cf3df23a2bf33dc7fdc99e55949732521668d
5512 * tests/basic.c (check_pubkey): Skip tests if the required public key
5513 algorithm is not available.
5514
5515 tests/pubkey: Skip tests if PK algo is unavailable.
5516 + commit 4f4da6cbf065b3ae675e2b0d3ff56765025c2852
5517 * tests/pubkey.c (check_run, main): Skip tests for unavailable
5518 algorithms.
5519
5520 kdf: Skip tests if hash algo is not available.
5521 + commit 96fafffeeba5899d3d1b4d68ce99faed23cef641
5522 * tests/t-kdf.c (check_openpgp, check_pbkdf2): Test digest availability.
5523
5524 2022-06-24 NIIBE Yutaka <[email protected]>
5525
5526 hmac,hkdf: Allow use of shorter salt for HKDF.
5527 + commit 58c92098d053aae7c78cc42bdd7c80c13efc89bb
5528 * cipher/md.c (prepare_macpads): Move the check to...
5529 * src/visibility.c (gcry_mac_setkey): ... here.
5530 * tests/t-kdf.c (check_hkdf): No failure is expected.
5531
5532 2022-06-21 NIIBE Yutaka <[email protected]>
5533
5534 kdf,fips: Modify HKDF test for FIPS mode.
5535 + commit 07722d89bac1a739b084b4412c3ff42e215d5968
5536 * tests/t-kdf.c (check_hkdf): Check if shorter salts are rejected
5537 correctly when FIPS mode.
5538
5539 kdf: Add input check for hkdf.
5540 + commit e0f0c788dc0f268965c0f63eb33d9f98c0575d58
5541 * cipher/kdf.c (hkdf_open): Validate the output size.
5542
5543 2022-06-16 NIIBE Yutaka <[email protected]>
5544
5545 kdf: Add HKDF of RFC5869.
5546 + commit fbddfb964f0b1c1ec131194b2273c3f834041c84
5547 * src/gcrypt.h.in (GCRY_KDF_HKDF): New.
5548 * cipher/kdf.c (hkdf_open, hkdf_compute, hkdf_final, hkdf_close): New.
5549 (_gcry_kdf_open, _gcry_kdf_compute, _gcry_kdf_final, _gcry_kdf_close):
5550 Handle GCRY_KDF_HKDF.
5551 * tests/t-kdf.c (check_hkdf): New. Test vectors from RFC5869.
5552 (main): Call check_hkdf.
5553
5554 2022-06-12 Jussi Kivilinna <[email protected]>
5555
5556 ppc: enable P10 assembly with ENABLE_FORCE_SOFT_HWFEATURES on arch-3.00.
5557 + commit 2c5e5ab6843d747c4b877d2c6f47226f61e9ff14
5558 * cipher/chacha20.c (chacha20_do_setkey) [USE_PPC_VEC]: Enable
5559 P10 assembly for HWF_PPC_ARCH_3_00 if ENABLE_FORCE_SOFT_HWFEATURES is
5560 defined.
5561 * cipher/poly1305.c (poly1305_init) [POLY1305_USE_PPC_VEC]: Likewise.
5562 * cipher/rijndael.c (do_setkey) [USE_PPC_CRYPTO_WITH_PPC9LE]: Likewise.
5563 ---
5564
5565 This change allows testing P10 implementations with P9 and with QEMU-PPC.
5566
5567 2022-06-12 Danny Tsen <[email protected]>
5568
5569 Chacha20/poly1305 - Optimized chacha20/poly1305 for P10 operation.
5570 + commit 88fe7ac33eb4cb4dff76a5cc7fca50da5fb0ee3a
5571 * configure.ac: Added chacha20 and poly1305 assembly implementations.
5572 * cipher/chacha20-p10le-8x.s: (New) - support 8 blocks (512 bytes)
5573 unrolling.
5574 * cipher/poly1305-p10le.s: (New) - support 4 blocks (128 bytes)
5575 unrolling.
5576 * cipher/Makefile.am: Added new chacha20 and poly1305 files.
5577 * cipher/chacha20.c: Added PPC p10 le support for 8x chacha20.
5578 * cipher/poly1305.c: Added PPC p10 le support for 4x poly1305.
5579 * cipher/poly1305-internal.h: Added PPC p10 le support for poly1305.
5580 ---
5581
5582 [jk: cosmetic changes to C code]
5583 [jk: fix building on ppc64be]
5584
5585 2022-06-08 NIIBE Yutaka <[email protected]>
5586
5587 kdf: Add support for One-Step KDF with MAC.
5588 + commit 6d32bf80846a22568575a101a3fe6769ab058bb9
5589 * src/gcrypt.h.in (GCRY_KDF_ONESTEP_KDF_MAC): New.
5590 * cipher/kdf.c (onestep_kdf_mac_open, onestep_kdf_mac_compute): New.
5591 (onestep_kdf_mac_final, onestep_kdf_mac_close): New.
5592 (_gcry_kdf_open, _gcry_kdf_compute, _gcry_kdf_final, _gcry_kdf_close):
5593 Add support for GCRY_KDF_ONESTEP_KDF_MAC.
5594
5595 2022-06-07 NIIBE Yutaka <[email protected]>
5596
5597 kdf: Add One-Step KDF with hash.
5598 + commit f8c983cb14f8ba0921ce8fa52ea3519feae07861
5599 * src/gcrypt.h.in (GCRY_KDF_ONESTEP_KDF): New.
5600 * cipher/kdf.c (onestep_kdf_open, onestep_kdf_compute): New.
5601 (onestep_kdf_final): New.
5602 (_gcry_kdf_open, _gcry_kdf_compute, _gcry_kdf_final): Add
5603 GCRY_KDF_ONESTEP_KDF support.
5604 * tests/t-kdf.c (check_onestep_kdf): Add the test.
5605 (main): Call check_onestep_kdf.
5606
5607 Fix for struct gcry_thread_cbs.
5608 + commit 8d8e80ad753645b5fcbe28bb3e768079415ef848
5609 * src/gcrypt.h.in (struct gcry_thread_cbs): Since it's no use any
5610 more, even internally, use _GCRY_GCC_ATTR_DEPRECATED instead.
5611
5612 2022-06-01 NIIBE Yutaka <[email protected]>
5613
5614 secmem: Remove RISC OS support.
5615 + commit fd9aa21983a114e1aab605536bc2371235e9a060
5616 * src/secmem.c [__riscos__]: Remove.
5617
5618 secmem: Clean up ERRNO handling.
5619 + commit d7c900a97b62a44d6667e065c6d2384136aefa63
5620 * src/secmem.c (lock_pool_pages): Use ERR only for the return value
5621 from mlock.
5622
5623 secmem: Remove getting cap_ipc_lock by capabilities support.
5624 + commit 43f51d0ec6b50a6317a6e67642bc87b9ddf45927
5625 * src/secmem.c (lock_pool_pages): Remove escalation of the capability.
5626
5627 2022-05-31 Jakub Jelen <[email protected]>
5628
5629 Fix memory leaks in tests.
5630 + commit ef2e1523c33c3143b4fee0c00f88a5a0842b337f
5631 * tests/aeswrap.c (check_one_with_padding): Free hd on error paths
5632 * tests/basic.c (check_ccm_cipher): Free context on error paths
5633 (check_ocb_cipher_checksum): Ditto.
5634 (do_check_xts_cipher): Ditto.
5635 (check_gost28147_cipher_basic): Ditto.
5636 * tests/bench-slope.c (bench_ecc_init): Free memory on invalid input.
5637 * tests/t-cv25519.c (test_it): Free memory on error path
5638 * tests/t-dsa.c (hex2buffer): Free memory on error path
5639 * tests/t-ecdsa.c (hex2buffer): Free memory on error path
5640 (one_test_sexp): Cleanup memory on exit
5641 * tests/t-mpi-point.c (check_ec_mul): Free memory on error
5642 (check_ec_mul_reduction): Ditto
5643 * tests/t-rsa-15.c (hex2buffer): Ditto
5644 * tests/t-rsa-pss.c (hex2buffer): Ditto
5645 * tests/t-x448.c (test_it): Free memory on error path
5646 * tests/testdrv.c (my_spawn): Free memory on error paths
5647
5648 2022-05-19 Jakub Jelen <[email protected]>
5649
5650 cipher: Allow verification of small RSA signatures in FIPS mode.
5651 + commit ca2afc9fb64d9a9b2f8930ba505d9ab6c8a57667
5652 * cipher/rsa.c (rsa_check_keysize): Formatting.
5653 (rsa_check_verify_keysize): New function.
5654 (rsa_verify): Allow using smaller keys for verification.
5655
5656 2022-05-17 NIIBE Yutaka <[email protected]>
5657
5658 Fix internal declaration of _gcry_kdf_compute.
5659 + commit 4019f1a66b15d2ef82eb059c432e6b09b2c69b21
5660 * src/gcrypt-int.h (_gcry_kdf_compute): Return gcry_err_code_t.
5661
5662 mpi: Allow building with --disable-asm for HPPA.
5663 + commit c0692324fe8b3806eefc5017767917dca9cd94d0
5664 * mpi/longlong.h [__hppa] (udiv_qrnnd): Only define
5665 when assembler is enabled.
5666
5667 2022-05-15 Jussi Kivilinna <[email protected]>
5668
5669 aarch64-asm: use ADR for getting pointers for local labels.
5670 + commit fd02e8e78470deb661269c429f3348f811c054c6
5671 * cipher/asm-common-aarch64.h (GET_DATA_POINTER): Remove.
5672 (GET_LOCAL_POINTER): New.
5673 * cipher/camellia-aarch64.S: Use GET_LOCAL_POINTER instead of ADR
5674 instruction directly.
5675 * cipher/chacha20-aarch64.S: Use GET_LOCAL_POINTER instead of
5676 GET_DATA_POINTER.
5677 * cipher/cipher-gcm-armv8-aarch64-ce.S: Likewise.
5678 * cipher/crc-armv8-aarch64-ce.S: Likewise.
5679 * cipher/sha1-armv8-aarch64-ce.S: Likewise.
5680 * cipher/sha256-armv8-aarch64-ce.S: Likewise.
5681 * cipher/sm3-aarch64.S: Likewise.
5682 * cipher/sm3-armv8-aarch64-ce.S: Likewise.
5683 * cipher/sm4-aarch64.S: Likewise.
5684 ---
5685
5686 Switch to use ADR instead of ADRP/LDR or ADRP/ADD for getting
5687 data pointers within assembly files. ADR is more portable across
5688 targets and does not require labels to be declared in GOT tables.
5689
5690 2022-05-11 Jussi Kivilinna <[email protected]>
5691
5692 cipher: move CBC/CFB/CTR self-tests to tests/basic.
5693 + commit a9700956361d280746f2bffe94cbdb72c95eb3ed
5694 * cipher/Makefile.am: Remove 'cipher-selftest.c' and 'cipher-selftest.h'.
5695 * cipher/cipher-selftest.c: Remove (refactor these tests to
5696 tests/basic.c).
5697 * cipher/cipher-selftest.h: Remove.
5698 * cipher/blowfish.c (selftest_ctr, selftest_cbc, selftest_cfb): Remove.
5699 (selftest): Remove CTR/CBC/CFB bulk self-tests.
5700 * cipher/camellia-glue.c (selftest_ctr_128, selftest_cbc_128)
5701 (selftest_cfb_128): Remove.
5702 (selftest): Remove CTR/CBC/CFB bulk self-tests.
5703 * cipher/cast5.c (selftest_ctr, selftest_cbc, selftest_cfb): Remove.
5704 (selftest): Remove CTR/CBC/CFB bulk self-tests.
5705 * cipher/des.c (bulk_selftest_setkey, selftest_ctr, selftest_cbc)
5706 (selftest_cfb): Remove.
5707 (selftest): Remove CTR/CBC/CFB bulk self-tests.
5708 * cipher/rijndael.c (selftest_basic_128, selftest_basic_192)
5709 (selftest_basic_256): Allocate context from stack instead of heap and
5710 handle alignment manually.
5711 (selftest_ctr_128, selftest_cbc_128, selftest_cfb_128): Remove.
5712 (selftest): Remove CTR/CBC/CFB bulk self-tests.
5713 * cipher/serpent.c (selftest_ctr_128, selftest_cbc_128)
5714 (selftest_cfb_128): Remove.
5715 (selftest): Remove CTR/CBC/CFB bulk self-tests.
5716 * cipher/sm4.c (selftest_ctr_128, selftest_cbc_128)
5717 (selftest_cfb_128): Remove.
5718 (selftest): Remove CTR/CBC/CFB bulk self-tests.
5719 * cipher/twofish.c (selftest_ctr, selftest_cbc, selftest_cfb): Remove.
5720 (selftest): Remove CTR/CBC/CFB bulk self-tests.
5721 * tests/basic.c (buf_xor, cipher_cbc_bulk_test, buf_xor_2dst)
5722 (cipher_cfb_bulk_test, cipher_ctr_bulk_test): New.
5723 (check_ciphers): Run cipher_cbc_bulk_test(), cipher_cfb_bulk_test() and
5724 cipher_ctr_bulk_test() for block ciphers.
5725 ---
5726
5727 CBC/CFB/CTR bulk self-tests are quite computationally heavy and
5728 slow down use cases where application opens cipher context once,
5729 does processing and exits. Better place for these tests is in
5730 `tests/basic`.
5731
5732 camellia: add amd64 GFNI/AVX512 implementation.
5733 + commit 9ab61ba24b72bc109b7578a7868716910d2ea9d1
5734 * cipher/Makefile.am: Add 'camellia-gfni-avx512-amd64.S'.
5735 * cipher/bulkhelp.h (bulk_ocb_prepare_L_pointers_array_blk64): New.
5736 * cipher/camellia-aesni-avx2-amd64.h: Rename internal functions from
5737 "__camellia_???" to "FUNC_NAME(???)"; Minor changes to comments.
5738 * cipher/camellia-gfni-avx512-amd64.S: New.
5739 * cipher/camellia-gfni.c (USE_GFNI_AVX512): New.
5740 (CAMELLIA_context): Add 'use_gfni_avx512'.
5741 (_gcry_camellia_gfni_avx512_ctr_enc, _gcry_camellia_gfni_avx512_cbc_dec)
5742 (_gcry_camellia_gfni_avx512_cfb_dec, _gcry_camellia_gfni_avx512_ocb_enc)
5743 (_gcry_camellia_gfni_avx512_ocb_dec)
5744 (_gcry_camellia_gfni_avx512_enc_blk64)
5745 (_gcry_camellia_gfni_avx512_dec_blk64, avx512_burn_stack_depth): New.
5746 (camellia_setkey): Use GFNI/AVX512 if supported by CPU.
5747 (camellia_encrypt_blk1_64, camellia_decrypt_blk1_64): New.
5748 (_gcry_camellia_ctr_enc, _gcry_camellia_cbc_dec, _gcry_camellia_cfb_dec)
5749 (_gcry_camellia_ocb_crypt) [USE_GFNI_AVX512]: Add GFNI/AVX512 code path.
5750 (_gcry_camellia_xts_crypt): Change parallel block size from 32 to 64.
5751 (selftest_ctr_128, selftest_cbc_128, selftest_cfb_128): Increase test
5752 block size.
5753 * cipher/chacha20-amd64-avx512.S: Clear k-mask registers with xor.
5754 * cipher/poly1305-amd64-avx512.S: Likewise.
5755 * cipher/sha512-avx512-amd64.S: Likewise.
5756 ---
5757
5758 Benchmark on Intel i3-1115G4 (tigerlake):
5759
5760 Before (GFNI/AVX2):
5761 CAMELLIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
5762 CBC dec | 0.356 ns/B 2679 MiB/s 1.46 c/B 4089
5763 CFB dec | 0.374 ns/B 2547 MiB/s 1.53 c/B 4089
5764 CTR enc | 0.409 ns/B 2332 MiB/s 1.67 c/B 4089
5765 CTR dec | 0.406 ns/B 2347 MiB/s 1.66 c/B 4089
5766 XTS enc | 0.430 ns/B 2216 MiB/s 1.76 c/B 4090
5767 XTS dec | 0.433 ns/B 2201 MiB/s 1.77 c/B 4090
5768 OCB enc | 0.460 ns/B 2071 MiB/s 1.88 c/B 4089
5769 OCB dec | 0.492 ns/B 1939 MiB/s 2.01 c/B 4089
5770
5771 After (GFNI/AVX512):
5772 CAMELLIA128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
5773 CBC dec | 0.207 ns/B 4600 MiB/s 0.827 c/B 3989
5774 CFB dec | 0.207 ns/B 4610 MiB/s 0.825 c/B 3989
5775 CTR enc | 0.218 ns/B 4382 MiB/s 0.868 c/B 3990
5776 CTR dec | 0.217 ns/B 4389 MiB/s 0.867 c/B 3990
5777 XTS enc | 0.330 ns/B 2886 MiB/s 1.35 c/B 4097±4
5778 XTS dec | 0.328 ns/B 2904 MiB/s 1.35 c/B 4097±3
5779 OCB enc | 0.246 ns/B 3879 MiB/s 0.981 c/B 3990
5780 OCB dec | 0.247 ns/B 3855 MiB/s 0.987 c/B 3990
5781
5782 CBC dec: 70% faster
5783 CFB dec: 80% faster
5784 CTR: 87% faster
5785 XTS: 31% faster
5786 OCB: 92% faster
5787
5788 2022-05-10 NIIBE Yutaka <[email protected]>
5789
5790 mpi: Fix for 64-bit for _gcry_mpih_cmp_ui.
5791 + commit a611e3a25d61505698e2bb38ec2db38bc6a74820
5792 * mpi/mpih-const-time.c (_gcry_mpih_cmp_ui): Compare 64-bit
5793 value correctly.
5794
5795 random: Fix rndjent for Windows.
5796 + commit 5dc97e855bb27705a548a297b666b7be7b1c59a3
5797 * random/jitterentropy-base-user.h [HAVE_W32_SYSTEM] (jent_ncpu):
5798 Implement.
5799 * random/rndjent.c (_WIN32_WINNT): Define for GetNativeSystemInfo.
5800 (EOPNOTSUPP): Define when not available.
5801
5802 2022-04-30 Jussi Kivilinna <[email protected]>
5803
5804 tests/basic: add testing for partial bulk processing code paths.
5805 + commit 9ba1f0091ff408d6140ee75a56fd67f02d0d3f30
5806 * tests/basic.c (check_one_cipher_core): Add 'split_mode' parameter and
5807 handling for split_mode==1.
5808 (check_one_cipher): Use split_mode==0 for existing check_one_cipher_core
5809 calls; Add new large buffer check with split_mode==1.
5810
5811 sm4-aesni-avx2: add generic 1 to 16 block bulk processing function.
5812 + commit e239738b4af28b64ab617900fced8a216552e9f1
5813 * cipher/sm4-aesni-avx2-amd64.S: Remove unnecessary vzeroupper at
5814 function entries.
5815 (_gcry_sm4_aesni_avx2_crypt_blk1_16): New.
5816 * cipher/sm4.c (_gcry_sm4_aesni_avx2_crypt_blk1_16)
5817 (sm4_aesni_avx2_crypt_blk1_16): New.
5818 (sm4_get_crypt_blk1_16_fn) [USE_AESNI_AVX2]: Add
5819 'sm4_aesni_avx2_crypt_blk1_16'.
5820
5821 Add SM4 x86-64/GFNI/AVX2 implementation.
5822 + commit 5095d60af42d898311d66b10f5204a3418a4a8af
5823 * cipher/Makefile.am: Add 'sm4-gfni-avx2-amd64.S'.
5824 * cipher/sm4-aesni-avx2-amd64.S: New.
5825 * cipher/sm4.c (USE_GFNI_AVX2): New.
5826 (SM4_context): Add 'use_gfni_avx2'.
5827 (crypt_blk1_8_fn_t): Rename to...
5828 (crypt_blk1_16_fn_t): ...this.
5829 (sm4_aesni_avx_crypt_blk1_8): Rename to...
5830 (sm4_aesni_avx_crypt_blk1_16): ...this and add handling for 9 to 16
5831 input blocks.
5832 (_gcry_sm4_gfni_avx_expand_key, _gcry_sm4_gfni_avx2_ctr_enc)
5833 (_gcry_sm4_gfni_avx2_cbc_dec, _gcry_sm4_gfni_avx2_cfb_dec)
5834 (_gcry_sm4_gfni_avx2_ocb_enc, _gcry_sm4_gfni_avx2_ocb_dec)
5835 (_gcry_sm4_gfni_avx2_ocb_auth, _gcry_sm4_gfni_avx2_crypt_blk1_16)
5836 (sm4_gfni_avx2_crypt_blk1_16): New.
5837 (sm4_aarch64_crypt_blk1_8): Rename to...
5838 (sm4_aarch64_crypt_blk1_16): ...this and add handling for 9 to 16
5839 input blocks.
5840 (sm4_armv8_ce_crypt_blk1_8): Rename to...
5841 (sm4_armv8_ce_crypt_blk1_16): ...this and add handling for 9 to 16
5842 input blocks.
5843 (sm4_expand_key): Add GFNI/AVX2 path.
5844 (sm4_setkey): Enable GFNI/AVX2 implementation if HW features
5845 available; Disable AESNI implementations when GFNI implementation is
5846 enabled.
5847 (sm4_encrypt) [USE_GFNI_AVX2]: New.
5848 (sm4_decrypt) [USE_GFNI_AVX2]: New.
5849 (sm4_get_crypt_blk1_8_fn): Rename to...
5850 (sm4_get_crypt_blk1_16_fn): ...this; Update to use *_blk1_16 functions;
5851 Add GFNI/AVX2 selection.
5852 (_gcry_sm4_ctr_enc, _gcry_sm4_cbc_dec, _gcry_sm4_cfb_dec)
5853 (_gcry_sm4_ocb_crypt, _gcry_sm4_ocb_auth): Add GFNI/AVX2 path; Widen
5854 generic bulk processing from 8 blocks to 16 blocks.
5855 (_gcry_sm4_xts_crypt): Widen generic bulk processing from 8 blocks to
5856 16 blocks.
5857
5858 sm4: add XTS bulk processing.
5859 + commit aad3381e93846212c2022dba50e621e4b48f3295
5860 * cipher/sm4.c (_gcry_sm4_xts_crypt): New.
5861 (sm4_setkey): Set XTS bulk function.
5862
5863 2022-04-29 Jussi Kivilinna <[email protected]>
5864
5865 camellia-avx2: add bulk processing for XTS mode.
5866 + commit 32b18cdb87b771f5c1ec87ef5e0f115f3f2d362f
5867 * cipher/bulkhelp.h (bulk_xts_crypt_128): New.
5868 * cipher/camellia-glue.c (_gcry_camellia_xts_crypt): New.
5869 (camellia_set_key) [USE_AESNI_AVX2]: Set XTS bulk function if AVX2
5870 implementation is available.
5871
5872 camellia-avx2: add partial parallel block processing.
5873 + commit bacdc1de3f4fe063054af4e36e7fdfa5b00ccb64
5874 * cipher/camellia-aesni-avx2-amd64.h: Remove unnecessary vzeroupper
5875 from function entry.
5876 (enc_blk1_32, dec_blk1_32): New.
5877 * cipher/camellia-glue.c (avx_burn_stack_depth)
5878 (avx2_burn_stack_depth): Move outside of bulk functions to deduplicate.
5879 (camellia_setkey): Disable AESNI & VAES implementation when GFNI
5880 implementation is enabled.
5881 (_gcry_camellia_aesni_avx2_enc_blk1_32)
5882 (_gcry_camellia_aesni_avx2_dec_blk1_32)
5883 (_gcry_camellia_vaes_avx2_enc_blk1_32)
5884 (_gcry_camellia_vaes_avx2_dec_blk1_32)
5885 (_gcry_camellia_gfni_avx2_enc_blk1_32)
5886 (_gcry_camellia_gfni_avx2_dec_blk1_32, camellia_encrypt_blk1_32)
5887 (camellia_decrypt_blk1_32): New.
5888 (_gcry_camellia_ctr_enc, _gcry_camellia_cbc_dec, _gcry_camellia_cfb_dec)
5889 (_gcry_camellia_ocb_crypt, _gcry_camellia_ocb_auth): Use new bulk
5890 processing helpers from 'bulkhelp.h' and 'camellia_encrypt_blk1_32'
5891 and 'camellia_decrypt_blk1_32' for partial parallel processing.
5892
5893 2022-04-24 Jussi Kivilinna <[email protected]>
5894
5895 cipher/bulkhelp: add functions for CTR/CBC/CFB/OCB bulk processing.
5896 + commit 754055ccd0438b96961601438fafb7799eae612f
5897 * cipher/bulkhelp.h (bulk_crypt_fn_t, bulk_ctr_enc_128)
5898 (bulk_cbc_dec_128, bulk_cfb_dec_128, bulk_ocb_crypt_128)
5899 (bulk_ocb_auth_128): New.
5900 * cipher/sm4.c (_gcry_sm4_ctr_enc, _gcry_sm4_cbc_dec)
5901 (_gcry_sm4_cfb_dec, _gcry_sm4_ocb_crypt, _gcry_sm4_ocb_auth): Switch
5902 to use helper functions from 'bulkhelp.h'.
5903
5904 Move bulk OCB L pointer array setup code to common header.
5905 + commit 9388279803ff82ea0ccd12a83157b94c807e7a8f
5906 * cipher/bulkhelp.h: New.
5907 * cipher/camellia-glue.c (_gcry_camellia_ocb_crypt)
5908 (_gcry_camellia_ocb_crypt): Use new
5909 `bulk_ocb_prepare_L_pointers_array_blkXX` function for OCB L pointer
5910 array setup.
5911 * cipher/serpent.c (_gcry_serpent_ocb_crypt)
5912 (_gcry_serpent_ocb_auth): Likewise.
5913 * cipher/sm4.c (_gcry_sm4_ocb_crypt, _gcry_sm4_ocb_auth): Likewise.
5914 * cipher/twofish.c (_gcry_twofish_ocb_crypt)
5915 (_gcry_twofish_ocb_auth): Likewise.
5916
5917 sm4: deduplicate bulk processing function selection.
5918 + commit e1c5f950838b2fa086a798f7194b618f581dca96
5919 * cipher/sm4.c (crypt_blk1_8_fn_t): New.
5920 (sm4_aesni_avx_crypt_blk1_8, sm4_aarch64_crypt_blk1_8)
5921 (sm4_armv8_ce_crypt_blk1_8, sm4_crypt_blocks): Change first parameter
5922 to void pointer type.
5923 (sm4_get_crypt_blk1_8_fn): New.
5924 (_gcry_sm4_ctr_enc, _gcry_sm4_cbc_dec, _gcry_sm4_cfb_dec)
5925 (_gcry_sm4_ocb_crypt, _gcry_sm4_ocb_auth): Use sm4_get_crypt_blk1_8_fn
5926 for selecting crypt_blk1_8.
5927
5928 Add GFNI/AVX2 implementation of Camellia.
5929 + commit 4e6896eb9fce74908e15e085da00edfed0fa1923
5930 * cipher/Makefile.am: Add "camellia-gfni-avx2-amd64.S".
5931 * cipher/camellia-aesni-avx2-amd64.h [CAMELLIA_GFNI_BUILD]: Add GFNI
5932 support.
5933 * cipher/camellia-gfni-avx2-amd64.S: New.
5934 * cipher/camellia-glue.c (USE_GFNI_AVX2): New.
5935 (CAMELLIA_context) [USE_AESNI_AVX2]: New member "use_gfni_avx2".
5936 [USE_GFNI_AVX2] (_gcry_camellia_gfni_avx2_ctr_enc)
5937 (_gcry_camellia_gfni_avx2_cbc_dec, _gcry_camellia_gfni_avx2_cfb_dec)
5938 (_gcry_camellia_gfni_avx2_ocb_enc, _gcry_camellia_gfni_avx2_ocb_dec)
5939 (_gcry_camellia_gfni_avx2_ocb_auth): New.
5940 (camellia_setkey) [USE_GFNI_AVX2]: Enable GFNI if supported by HW.
5941 (_gcry_camellia_ctr_enc) [USE_GFNI_AVX2]: Add GFNI support.
5942 (_gcry_camellia_cbc_dec) [USE_GFNI_AVX2]: Add GFNI support.
5943 (_gcry_camellia_cfb_dec) [USE_GFNI_AVX2]: Add GFNI support.
5944 (_gcry_camellia_ocb_crypt) [USE_GFNI_AVX2]: Add GFNI support.
5945 (_gcry_camellia_ocb_auth) [USE_GFNI_AVX2]: Add GFNI support.
5946 * configure.ac: Add "camellia-gfni-avx2-amd64.lo".
5947
5948 Add detection for HW feature "intel-gfni"
5949 + commit 3410d40996d8f7377935192ebecf4cad66688b25
5950 * configure.ac (gfnisupport, gcry_cv_gcc_inline_asm_gfni)
5951 (ENABLE_GFNI_SUPPORT): New.
5952 * src/g10lib.h (HWF_INTEL_GFNI): New.
5953 * src/hwf-x86.c (detect_x86_gnuc): Add GFNI detection.
5954 * src/hwfeatures.c (hwflist): Add "intel-gfni".
5955 * doc/gcrypt.texi: Add "intel-gfni" to HW features list.
5956
5957 2022-04-21 Jakub Jelen <[email protected]>
5958
5959 tests: Expect the RSA PKCS #1.5 encryption to fail in FIPS mode.
5960 + commit f736f3c70182d9c948f9105eb769c47c5578df35
5961 * tests/basic.c (check_pubkey_crypt): Expect RSA PKCS #1.5 encryption to
5962 fail in FIPS mode. Expect failure when wrong padding is selected
5963 * tests/pkcs1v2.c (check_v15crypt): Expect RSA PKCS #1.5 encryption to
5964 fail in FIPS mode
5965
5966 tests: Replace custom bit with more generic flags.
5967 + commit 299e2f93415984919181e0ee651719bbf83bdd2f
5968 * tests/basic.c (global): New flag FLAG_SPECIAL
5969 (check_pubkey_crypt): Change to use bitfield flags
5970
5971 Do not allow PKCS #1.5 padding for encryption in FIPS.
5972 + commit c7709f7b23848abf4ba65cb99cb2a9e9c7ebdefc
5973 * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi): Block PKCS #1.5
5974 padding for encryption in FIPS mode
5975 * cipher/rsa.c (rsa_decrypt): Block PKCS #1.5 decryption in FIPS mode
5976
5977 2022-04-21 NIIBE Yutaka <[email protected]>
5978
5979 random: Not use secure memory for DRBG instance.
5980 + commit f436bf4451cb2ad0a1f56aa843bf79a58878022f
5981 * random/random-drbg.c (drbg_instance): New at BSS.
5982 (_drbg_init_internal): Don't allocate at secure memory.
5983 (_gcry_rngdrbg_close_fds): Follow the change.
5984
5985 2022-04-20 NIIBE Yutaka <[email protected]>
5986
5987 cipher: Change the bounds for RSA key generation round.
5988 + commit cd30ed3c0d715aa0c58a32a29cfb1476163a5b94
5989 * cipher/rsa.c (generate_fips): Use 10 for p, 20 for q.
5990
5991 2022-04-19 NIIBE Yutaka <[email protected]>
5992
5993 Use offsetof instead of null ptr calculation.
5994 + commit 9e9f3073369905707b718aa1628d0fe5b1affed9
5995 * src/secmem.c (_gcry_secmem_realloc_internal): Use offsetof.
5996
5997 2022-04-18 NIIBE Yutaka <[email protected]>
5998
5999 cipher: Fix rsa key generation.
6000 + commit 51754fa2ed06cc41487324432dbea654642ef244
6001 * cipher/rsa.c (generate_fips): Set the least significant bit.
6002
6003 2022-04-12 Clemens Lang <[email protected]>
6004
6005 build: Fix make dist after socklen.m4 removal.
6006 + commit 922f9957f94a24c58812db9bbabfb55a8ce211a8
6007 * m4/Makefile.am: Remove socklen.m4 from EXTRA_DIST
6008
6009 2022-04-08 NIIBE Yutaka <[email protected]>
6010
6011 build: Remove configure checking for socklen_t.
6012 + commit e5260b6b9f38a91797b2cb5d789e9cbbc97ec485
6013 * configure.ac (gl_TYPE_SOCKLEN_T): Remove.
6014 * m4/socklen.m4: Remove.
6015
6016 2022-04-06 Tianjia Zhang <[email protected]>
6017
6018 doc: Fix missing ARM hardware features.
6019 + commit a7c3e0b9b0ff636d498a9d82f4ced8b5fac50a8b
6020 * doc/gcrypt.texi: Add sha3/sm3/sm4/sha512 to ARM hardware features.
6021
6022 build: Fix for arm crypto support.
6023 + commit 972aae9fc337ecf25139737cc7083a1bb56457f8
6024 * configure.ac: Correct wrong variable names.
6025
6026 2022-04-06 Jussi Kivilinna <[email protected]>
6027
6028 chacha20: add AVX512 implementation.
6029 + commit 9a63cfd61753b2c7ef7a872a01565154f10a72c0
6030 * cipher/Makefile.am: Add 'chacha20-amd64-avx512.S'.
6031 * cipher/chacha20-amd64-avx512.S: New.
6032 * cipher/chacha20.c (USE_AVX512): New.
6033 (CHACHA20_context_s): Add 'use_avx512'.
6034 [USE_AVX512] (_gcry_chacha20_amd64_avx512_blocks16): New.
6035 (chacha20_do_setkey) [USE_AVX512]: Setup 'use_avx512' based on
6036 HW features.
6037 (do_chacha20_encrypt_stream_tail) [USE_AVX512]: Use AVX512
6038 implementation if supported.
6039 (_gcry_chacha20_poly1305_encrypt) [USE_AVX512]: Disable stitched
6040 chacha20-poly1305 implementations if AVX512 implementation is used.
6041 (_gcry_chacha20_poly1305_decrypt) [USE_AVX512]: Disable stitched
6042 chacha20-poly1305 implementations if AVX512 implementation is used.
6043
6044 poly1305: add AVX512 implementation.
6045 + commit cd3ed4977076343bb6092001cafe55673dc30e34
6046 * LICENSES: Add 3-clause BSD license for poly1305-amd64-avx512.S.
6047 * cipher/Makefile.am: Add 'poly1305-amd64-avx512.S'.
6048 * cipher/poly1305-amd64-avx512.S: New.
6049 * cipher/poly1305-internal.h (POLY1305_USE_AVX512): New.
6050 (poly1305_context_s): Add 'use_avx512'.
6051 * cipher/poly1305.c (ASM_FUNC_ABI, ASM_FUNC_WRAPPER_ATTR): New.
6052 [POLY1305_USE_AVX512] (_gcry_poly1305_amd64_avx512_blocks)
6053 (poly1305_amd64_avx512_blocks): New.
6054 (poly1305_init): Use AVX512 is HW feature available (set use_avx512).
6055 [USE_MPI_64BIT] (poly1305_blocks): Rename to ...
6056 [USE_MPI_64BIT] (poly1305_blocks_generic): ... this.
6057 [USE_MPI_64BIT] (poly1305_blocks): New.
6058
6059 2022-04-05 NIIBE Yutaka <[email protected]>
6060
6061 doc: Update yat2m from libgpg-error.
6062 + commit 5f357784662a7d3a3d3498d6ca5d5781e9e60ac0
6063 * doc/yat2m.c: Update.
6064
6065 2022-04-04 Tianjia Zhang <[email protected]>
6066
6067 Add SM3 ARMv8/AArch64/CE assembly implementation.
6068 + commit fe891ff4a3cdc74957b215db4a9a9e01fefe0cd4
6069 * cipher/Makefile.am: Add 'sm3-armv8-aarch64-ce.S'.
6070 * cipher/sm3-armv8-aarch64-ce.S: New.
6071 * cipher/sm3.c (USE_ARM_CE): New.
6072 [USE_ARM_CE] (_gcry_sm3_transform_armv8_ce)
6073 (do_sm3_transform_armv8_ce): New.
6074 (sm3_init) [USE_ARM_CE]: New.
6075 * configure.ac: Add 'sm3-armv8-aarch64-ce.lo'.
6076
6077 2022-04-01 Jussi Kivilinna <[email protected]>
6078
6079 hwf-ppc: fix missing HWF_PPC_ARCH_3_10 in HW feature.
6080 + commit 29bfb3ebbc63d7ed18b916c5c6946790fb3d15df
6081 * src/hwf-ppc.c (ppc_features): Add HWF_PPC_ARCH_3_10.
6082
6083 2022-03-31 NIIBE Yutaka <[email protected]>
6084
6085 random:drbg: Fix the behavior for child process.
6086 + commit df7879a86b1de8eaf2d784687155c4274574b120
6087 * random/random-drbg.c (_gcry_rngdrbg_randomize): Update change of PID
6088 detection.
6089
6090 build: When no gpg-error-config, not install libgcrypt-config.
6091 + commit 2db5b5e995c21c5bd9cd193c2ed1109ba9b1a440
6092 * configure.ac (USE_GPGRT_CONFIG): New.
6093 * src/Makefile.am [USE_GPGRT_CONFIG]: Conditionalize the install
6094 of libgcrypt-config.
6095
6096 2022-03-30 Werner Koch <[email protected]>
6097
6098 tests: Add brainpoolP256r1 to bench-slope.
6099 + commit 67b36154f88ebe271a40c3f3f7b963943c656b71
6100 * tests/bench-slope.c (ECC_ALGO_BRAINP256R1): New.
6101 (ecc_algo_fips_allowed): Support this curve.
6102 (ecc_algo_name): Ditto.
6103 (ecc_algo_curve): Ditto.
6104 (ecc_nbits): Ditto.
6105 (bench_ecc_init): Ditto.
6106
6107 2022-03-29 Jussi Kivilinna <[email protected]>
6108
6109 configure: fix avx512 check for i386.
6110 + commit a5d126c61cc00aa2d63c389a956330067c90cbfd
6111 * configure.ac (gcry_cv_gcc_inline_asm_avx512): Do not use ZMM22
6112 register; Check for broadcast memory source.
6113
6114 2022-03-29 Tianjia Zhang <[email protected]>
6115
6116 Fix configure.ac error of intel-avx512.
6117 + commit 4dc707e336a91ca9ca5a59787b9245a1ca3042c6
6118 * configure.ac: Correctly set value for avx512support.
6119
6120 2022-03-29 NIIBE Yutaka <[email protected]>
6121
6122 kdf:argon2: Fix for the case output > 64.
6123 + commit 564739a58426d89db2f0c9334659949e503d2c59
6124 * cipher/blake2.c (blake2b_vl_hash): Fix the last step.
6125 * cipher/kdf.c (argon2_open): Check the value.
6126
6127 2022-03-28 NIIBE Yutaka <[email protected]>
6128
6129 build: Fix for build for Windows.
6130 + commit 5d6a1c396396ba7b44f11af10a9c51b1b573e03c
6131 * cipher/Makefile.am: Use EXEEXT_FOR_BUILD.
6132 * doc/Makefile.am: Likewise.
6133
6134 test: Fix cast for Windows 64-bit.
6135 + commit e24fe678656156502bd3ef1b7805cddede1dd2de
6136 * tests/bench-slope.c (slope_benchmark): Use uintptr_t.
6137
6138 2022-03-28 Werner Koch <[email protected]>
6139
6140 hash: Add more OIDs.
6141 + commit 26ac5e30018f2bf0a973b3a45410e6a0c8067f0e
6142 * cipher/sha256.c: Add X9.62 OID.
6143 * cipher/sha512.c: Ditto.
6144
6145 build: Improve sign-release traget.
6146 + commit ec656616bbbb5db87d3cdf4f4ea695217935d843
6147 * Makefile.am (sign-release): Allow running in the dist dir.
6148
6149 2022-03-28 NIIBE Yutaka <[email protected]>
6150
6151 tests: Fix null pointer arithmetic.
6152 + commit 1517a31ea476b76f67289d07e2c2821aa4ef83ef
6153 * tests/bench-slope.c (slope_benchmark): Don't use null pointer.
6154
6155 2022-03-12 Jussi Kivilinna <[email protected]>
6156
6157 Fix building sha512-avx512 with clang.
6158 + commit a0db0a121571129b7149e51e98e5fbc6e35413e8
6159 * cipher/sha512-avx512-amd64.S
6160 (_gcry_sha512_transform_amd64_avx512): Change "%xmm??" registers to
6161 "xmm??" for clear_reg parameter.
6162 * configure.ac (gcry_cv_gcc_inline_asm_avx512): Check support for
6163 registers in range "zmm16-zmm31".
6164
6165 2022-03-10 Jussi Kivilinna <[email protected]>
6166
6167 SHA512: Add AVX512 implementation.
6168 + commit 089223aa3b554e5c9a07d9176470308dab10ac8a
6169 * LICENSES: Add 'cipher/sha512-avx512-amd64.S'.
6170 * cipher/Makefile.am: Add 'sha512-avx512-amd64.S'.
6171 * cipher/sha512-avx512-amd64.S: New.
6172 * cipher/sha512.c (USE_AVX512): New.
6173 (do_sha512_transform_amd64_ssse3, do_sha512_transform_amd64_avx)
6174 (do_sha512_transform_amd64_avx2): Add ASM_EXTRA_STACK to return value
6175 only if assembly routine returned non-zero value.
6176 [USE_AVX512] (_gcry_sha512_transform_amd64_avx512)
6177 (do_sha512_transform_amd64_avx512): New.
6178 (sha512_init_common) [USE_AVX512]: Use AVX512 implementation if HW
6179 feature supported.
6180 ---
6181
6182 Benchmark on Intel Core i3-1115G4 (tigerlake):
6183
6184 Before:
6185 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
6186 SHA512 | 1.51 ns/B 631.6 MiB/s 6.17 c/B 4089
6187
6188 After (~29% faster):
6189 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz
6190 SHA512 | 1.16 ns/B 819.0 MiB/s 4.76 c/B 4090
6191
6192 2022-03-09 Jussi Kivilinna <[email protected]>
6193
6194 rijndael-vaes-avx2: perform checksumming inline.
6195 + commit d820d27a3bce6365523fbcb6ec607b23dd4ca4e2
6196 * cipher/rijndael-vaes-avx2-amd64.S
6197 (_gcry_vaes_avx2_ocb_checksum): Remove.
6198 (_gcry_vaes_avx2_ocb_crypt_amd64): Add inline checksumming.
6199
6200 2022-03-07 Jussi Kivilinna <[email protected]>
6201
6202 ghash|polyval: add x86_64 VPCLMUL/AVX512 accelerated implementation.
6203 + commit e6f360019369fff42411b4cca976cc8ebe09281d
6204 * cipher/cipher-gcm-intel-pclmul.c (GCM_INTEL_USE_VPCLMUL_AVX512)
6205 (GCM_INTEL_AGGR32_TABLE_INITIALIZED): New.
6206 (ghash_setup_aggr16_avx2): Store H16 for aggr32 setup.
6207 [GCM_USE_INTEL_VPCLMUL_AVX512] (GFMUL_AGGR32_ASM_VPCMUL_AVX512)
6208 (gfmul_vpclmul_avx512_aggr32, gfmul_vpclmul_avx512_aggr32_le)
6209 (gfmul_pclmul_avx512, gcm_lsh_avx512, load_h1h4_to_zmm1)
6210 (ghash_setup_aggr8_avx512, ghash_setup_aggr16_avx512)
6211 (ghash_setup_aggr32_avx512, swap128b_perm): New.
6212 (_gcry_ghash_setup_intel_pclmul) [GCM_USE_INTEL_VPCLMUL_AVX512]: Enable
6213 AVX512 implementation based on HW features.
6214 (_gcry_ghash_intel_pclmul, _gcry_polyval_intel_pclmul): Add
6215 VPCLMUL/AVX512 code path; Small tweaks to VPCLMUL/AVX2 code path; Tweaks
6216 on register clearing.
6217
6218 Add detection for HW feature "intel-avx512"
6219 + commit 8cf06145263eb23b5411fae03e1ea13e146d605e
6220 * configure.ac (avx512support, gcry_cv_gcc_inline_asm_avx512)
6221 (ENABLE_AVX512_SUPPORT): New.
6222 * src/g10lib.h (HWF_INTEL_AVX512): New.
6223 * src/hwf-x86.c (detect_x86_gnuc): Add AVX512 detection.
6224 * src/hwfeatures.c (hwflist): Add "intel-avx512".
6225 * doc/gcrypt.texi: Add "intel-avx512" to HW features list.
6226
6227 2022-03-06 Jussi Kivilinna <[email protected]>
6228
6229 ghash|polyval: add x86_64 VPCLMUL/AVX2 accelerated implementation.
6230 + commit d857e85cb4d4cb9702a59364ce9a4b9d81328cb5
6231 * cipher/cipher-gcm-intel-pclmul.c (GCM_INTEL_USE_VPCLMUL_AVX2)
6232 (GCM_INTEL_AGGR8_TABLE_INITIALIZED)
6233 (GCM_INTEL_AGGR16_TABLE_INITIALIZED): New.
6234 (gfmul_pclmul): Fixes to comments.
6235 [GCM_USE_INTEL_VPCLMUL_AVX2] (GFMUL_AGGR16_ASM_VPCMUL_AVX2)
6236 (gfmul_vpclmul_avx2_aggr16, gfmul_vpclmul_avx2_aggr16_le)
6237 (gfmul_pclmul_avx2, gcm_lsh_avx2, load_h1h2_to_ymm1)
6238 (ghash_setup_aggr8_avx2, ghash_setup_aggr16_avx2): New.
6239 (_gcry_ghash_setup_intel_pclmul): Add 'hw_features' parameter; Setup
6240 ghash and polyval function pointers for context; Add VPCLMUL/AVX2 code
6241 path; Defer aggr8 and aggr16 table initialization to until first use in
6242 '_gcry_ghash_intel_pclmul' or '_gcry_polyval_intel_pclmul'.
6243 [__x86_64__] (ghash_setup_aggr8): New.
6244 (_gcry_ghash_intel_pclmul): Add VPCLMUL/AVX2 code path; Add call for
6245 aggr8 table initialization.
6246 (_gcry_polyval_intel_pclmul): Add VPCLMUL/AVX2 code path; Add call for
6247 aggr8 table initialization.
6248 * cipher/cipher-gcm.c [GCM_USE_INTEL_PCLMUL] (_gcry_ghash_intel_pclmul)
6249 (_gcry_polyval_intel_pclmul): Remove.
6250 [GCM_USE_INTEL_PCLMUL] (_gcry_ghash_setup_intel_pclmul): Add
6251 'hw_features' parameter.
6252 (setupM) [GCM_USE_INTEL_PCLMUL]: Pass HW features to
6253 '_gcry_ghash_setup_intel_pclmul'; Let '_gcry_ghash_setup_intel_pclmul'
6254 setup function pointers.
6255 * cipher/cipher-internal.h (GCM_USE_INTEL_VPCLMUL_AVX2): New.
6256 (gcry_cipher_handle): Add member 'gcm.hw_impl_flags'.
6257
6258 2022-03-02 Tianjia Zhang <[email protected]>
6259
6260 Add SM4 ARMv8/AArch64/CE assembly implementation.
6261 + commit 47cafffb09d8a224f07e0750f4ba882bb86cb15a
6262 * cipher/Makefile.am: Add 'sm4-armv8-aarch64-ce.S'.
6263 * cipher/sm4-armv8-aarch64-ce.S: New.
6264 * cipher/sm4.c (USE_ARM_CE): New.
6265 (SM4_context) [USE_ARM_CE]: Add 'use_arm_ce'.
6266 [USE_ARM_CE] (_gcry_sm4_armv8_ce_expand_key)
6267 (_gcry_sm4_armv8_ce_crypt, _gcry_sm4_armv8_ce_ctr_enc)
6268 (_gcry_sm4_armv8_ce_cbc_dec, _gcry_sm4_armv8_ce_cfb_dec)
6269 (_gcry_sm4_armv8_ce_crypt_blk1_8, sm4_armv8_ce_crypt_blk1_8): New.
6270 (sm4_expand_key) [USE_ARM_CE]: Use ARMv8/AArch64/CE key setup.
6271 (sm4_setkey): Enable ARMv8/AArch64/CE if supported by HW.
6272 (sm4_encrypt) [USE_ARM_CE]: Use SM4 CE encryption.
6273 (sm4_decrypt) [USE_ARM_CE]: Use SM4 CE decryption.
6274 (_gcry_sm4_ctr_enc, _gcry_sm4_cbc_dec, _gcry_sm4_cfb_dec)
6275 (_gcry_sm4_ocb_crypt, _gcry_sm4_ocb_auth) [USE_ARM_CE]: Add
6276 ARMv8/AArch64/CE bulk functions.
6277 * configure.ac: Add 'sm4-armv8-aarch64-ce.lo'.
6278
6279 hwf-arm: add ARMv8.2 optional crypto extension HW features.
6280 + commit 7d2983979866223d96aad4806af0311671585f64
6281 * src/g10lib.h (HWF_ARM_SHA3, HWF_ARM_SM3, HWF_ARM_SM4)
6282 (HWF_ARM_SHA512): New.
6283 * src/hwf-arm.c (arm_features): Add sha3, sm3, sm4, sha512 HW features.
6284 * src/hwfeatures.c (hwflist): Add sha3, sm3, sm4, sha512 HW features.
6285
6286 2022-02-24 Jussi Kivilinna <[email protected]>
6287
6288 powerpc: check for missing optimization level for vector register usage.
6289 + commit 6951e0f591ccff24b9ce2e43c2dcab955e3302c4
6290 * cipher/Makefile.am [ENABLE_PPC_VCRYPTO_EXTRA_CFLAGS]
6291 (ppc_vcrypto_cflags): Add '-O2'.
6292 * configure.ac (gcry_cv_cc_ppc_altivec): Check for missing compiler
6293 optimization with vec_sld_u32 inline function.
6294 * configure.ac (gcry_cv_cc_ppc_altivec_cflags): Check for missing
6295 compiler optimization with vec_sld_u32 inline function; Add '-O2' to
6296 CFLAGS.
6297
6298 2022-02-23 Tianjia Zhang <[email protected]>
6299
6300 Add SM4 ARMv8/AArch64 assembly implementation.
6301 + commit d8825601f10aec20db118496bb68a5cd1372b7da
6302 * cipher/Makefile.am: Add 'sm4-aarch64.S'.
6303 * cipher/sm4-aarch64.S: New.
6304 * cipher/sm4.c (USE_AARCH64_SIMD): New.
6305 (SM4_context) [USE_AARCH64_SIMD]: Add 'use_aarch64_simd'.
6306 [USE_AARCH64_SIMD] (_gcry_sm4_aarch64_crypt)
6307 (_gcry_sm4_aarch64_ctr_enc, _gcry_sm4_aarch64_cbc_dec)
6308 (_gcry_sm4_aarch64_cfb_dec, _gcry_sm4_aarch64_crypt_blk1_8)
6309 (sm4_aarch64_crypt_blk1_8): New.
6310 (sm4_setkey): Enable ARMv8/AArch64 if supported by HW.
6311 (_gcry_sm4_ctr_enc, _gcry_sm4_cbc_dec, _gcry_sm4_cfb_dec)
6312 (_gcry_sm4_ocb_crypt, _gcry_sm4_ocb_auth) [USE_AARCH64_SIMD]:
6313 Add ARMv8/AArch64 bulk functions.
6314 * configure.ac: Add 'sm4-aarch64.lo'.
6315
6316 Move VPUSH_API/VPOP_API macros to common header.
6317 + commit 83e1649edd5eedd8faf24e5c10cb643218ce3c6f
6318 * cipher/asm-common-aarch64.h: Add VPUSH_API/VPOP_API/CLEAR_REG macros.
6319 * cipher/cipher-gcm-armv8-aarch64-ce.S: Remove common macros.
6320
6321 2022-02-22 Jussi Kivilinna <[email protected]>
6322
6323 Perform AEAD input 24KiB splitting only when input larger than 32KiB.
6324 + commit 2508b755608ce182a7e570dc2717a6a70346b927
6325 * cipher/chacha20.c (_gcry_chacha20_poly1305_encrypt)
6326 (_gcry_chacha20_poly1305_decrypt): Process in 24KiB chunks if input
6327 larger than 32KiB.
6328 * cipher/cipher-ccm.c (_gcry_cipher_ccm_encrypt)
6329 (_gcry_cipher_ccm_decrypt): Likewise.
6330 * cipher/cipher-eax.c (_gcry_cipher_eax_encrypt)
6331 (_gcry_cipher_eax_decrypt): Likewise.
6332 * cipher/cipher-gcm.c (gcm_cipher_inner): Likewise.
6333 * cipher/cipher-ocb.c (ocb_crypt): Likewise.
6334 * cipher/cipher-poly2305.c (_gcry_cipher_poly1305_encrypt)
6335 (_gcry_cipher_poly1305_decrypt): Likewise.
6336
6337 2022-02-17 NIIBE Yutaka <[email protected]>
6338
6339 fips: Clarify what to be hashed for the integrity check.
6340 + commit 052c5ef4cea56772b7015e36f231fa0bcbf91410
6341 * src/fips.c (get_file_offset): Compute the maximum offset
6342 of segments.
6343 * src/gen-note-integrity.sh: Likewise.
6344
6345 fips: Fix gen-note-integrity.sh script not to use cmp utility.
6346 + commit 3c8b6c4a9cad59c5e1db5706f6774a3141b60210
6347 * src/gen-note-integrity.sh: Simplify detecting 32-bit machine
6348 or 64-bit machine.
6349
6350 Silence compiler warnings for possible alignment problem.
6351 + commit 5420cbbd3ec7ebf081224796e8d1f8299f7ad985
6352 * cipher/kdf.c (balloon_final): Fix the cast.
6353 (_gcry_kdf_compute, _gcry_kdf_final, _gcry_kdf_close): Likewise.
6354
6355 2022-02-16 NIIBE Yutaka <[email protected]>
6356
6357 fips: More portable integrity check.
6358 + commit a340e980388243ceae6df57d101036f3f2a955be
6359 * src/Makefile.am (EXTRA_DIST): Change the name of the script.
6360 (libgcrypt.la.done): Invoce OBJCOPY with --add-section.
6361 (libgcrypt.so.hmac): Specify ECHO_N.
6362 * src/fips.c (get_file_offset): Rename from get_file_offsets.
6363 Find the note section and return the value in HMAC.
6364 (hmac256_check): Simplify by HMAC from the note section, not loaded.
6365 (check_binary_integrity): Use dladdr instead of dladdr1.
6366 * src/gen-note-integrity.sh: Rename from genhmac.sh.
6367 Generate ElfN_Nhdr, and then the hmac.
6368
6369 fips: Integrity check improvement, with only loadable segments.
6370 + commit 9dcf9305962b90febdf2d7cc73b49feadbf6a01f
6371 * configure.ac (READELF): Check the tool.
6372 * src/Makefile.am (libgcrypt.so.hmac): Use genhmac.sh with hmac256.
6373 * src/fips.c (get_file_offsets): Rename from get_file_offset.
6374 Determine the OFFSET2 at the end of loadable segments, too.
6375 Add fixup of the ELF header to exclude section information.
6376 (hmac256_check): Finish scanning at the end of loadble segments.
6377 * src/genhmac.sh: New.
6378
6379 build: Clean up acinclude.m4.
6380 + commit b2f110f99626afce84c23c76db0ebaaadac4ee48
6381 * acinclude.m4 (GNUPG_CHECK_TYPEDEF): Remove. We can just use
6382 AC_CHECK_TYPES.
6383 (GNUPG_CHECK_GNUMAKE): Remove. It may build with other Make.
6384 (GNUPG_SYS_LIBTOOL_CYGWIN32): Remove. Now, it's done by LT_INIT.
6385 (TYPE_SOCKLEN_T): Remove. Now, we use gl_TYPE_SOCKLEN_T.
6386
6387 build: Remove checking Pth library.
6388 + commit d98a78f0eb7711d32f473a04ea417e0f0bde6a00
6389 * acinclude.m4 (GNUPG_PTH_VERSION_CHECK): Remove.
6390 * configure.ac (PTH_CFLAGS, PTH_LIBS): Remove.
6391
6392 2022-02-15 Clemens Lang via Gcrypt-devel <[email protected]>
6393
6394 fips: Use ELF header to find hmac file offset.
6395 + commit beb5d6df5c5785db7c32a24a5d2a351cb964bfbc
6396 * src/fips.c [ENABLE_HMAC_BINARY_CHECK] (hmac256_check): Use ELF headers
6397 to locate the file offset for the HMAC in addition to information from
6398 the loader
6399
6400 2022-02-15 NIIBE Yutaka <[email protected]>
6401
6402 build: Fix m4/gpg-error.m4.
6403 + commit bff9f1b024647e18b2c87dcd769c0e449f7752e6
6404 * m4/gpg-error.m4: Unset GPGRT_CONFIG when it doesn't work well.
6405
6406 2022-02-14 Clemens Lang via Gcrypt-devel <[email protected]>
6407
6408 hmac: Fix memory leak.
6409 + commit 6994d874af865cc6ba95a8a6eb5a8fe048e88e07
6410 * src/hmac.c: Release HMAC256 context
6411
6412 fips: Fix memory leaks in FIPS mode.
6413 + commit 7fc5d33e74164519edcd8127a35cc21228d2727f
6414 * cipher/pubkey.c (_gcry_pk_sign_md): Fix memory leak in FIPS mode when
6415 used with SHA1
6416 * tests/basic.c (check_one_cipher_core): Add missing free in error code
6417 triggered in FIPS mode
6418 * tests/dsa-rfc6979.c (check_dsa_rfc6979): Likewise
6419 * tests/pubkey.c (check_x931_derived_key): Likewise
6420
6421 2022-02-10 NIIBE Yutaka <[email protected]>
6422
6423 Clean up for removal of memory guard support.
6424 + commit 738723a1cd20b24fc667a457163a4aa6617dc182
6425 * mpi/mpiutil.c (_gcry_mpi_m_check): Remove.
6426 * src/g10lib.h (_gcry_check_heap): Remove.
6427 * src/global.c (_gcry_check_heap): Remove.
6428 * src/mpi.h (mpi_m_check): Remove.
6429
6430 Remove the built-in memory guard support.
6431 + commit f98ca6aa34ccdbbaf94f93ae30beafe400303c97
6432 * configure.ac (--enable-m-guard): Remove.
6433 * src/global.c (_gcry_vcontrol): Return GPG_ERR_NOT_SUPPORTED for
6434 GCRYCTL_ENABLE_M_GUARD.
6435 * src/stdmem.c (use_m_guard, _gcry_private_enable_m_guard): Remove.
6436 (_gcry_private_malloc): Remove the code path with use_m_guard==1.
6437 (_gcry_private_malloc_secure): Likewise.
6438 (_gcry_private_realloc, _gcry_private_free): Likewise.
6439 (_gcry_private_check_heap): Remove.
6440 * src/stdmem.h: Remove declarations for memory guard functions.
6441
6442 2022-02-09 NIIBE Yutaka <[email protected]>
6443
6444 Fix memory allocation when GCRYCTL_ENABLE_M_GUARD.
6445 + commit 90f41a1898e421c04080d35d7fea98ee18e74865
6446 * configure.ac: Add check for ALIGNOF_LONG_DOUBLE.
6447 * src/stdmem.c: Adjust EXTRA_ALIGN.
6448
6449 kdf: Prepare aligned memory in balloon_final.
6450 + commit 6936f234220d12a87fe17f7fbdbb29ba9787dd95
6451 * cipher/kdf.c (BALLOON_BLOCK_LEN_MAX): Rename from
6452 BALLOON_SALT_LEN_MAX.
6453 (balloon_xor_block): Revert the previous change.
6454 (balloon_final): Prepare memory for u64.
6455
6456 2022-02-08 Jussi Kivilinna <[email protected]>
6457
6458 kdf: fix unaligned memory access in balloon_xor_block.
6459 + commit 59b2504df8f02f82adf0dd83db219bc451b0d9cc
6460 * cipher/kdf.c (balloon_xor_block): Use 'buf_xor' helper function; Change
6461 pointer parameters to 'void *' type.
6462 (balloon_final): Don't cast last_block to 'u64 *' for balloon_xor_block
6463 call.
6464
6465 2022-02-08 NIIBE Yutaka <[email protected]>
6466
6467 kdf: Extend original Balloon to other digest algos.
6468 + commit 26bfa41e2413621c8e73dacba9b7c5ed69a1da35
6469 * cipher/kdf.c (struct balloon_thread_data): Use pointer to md_spec.
6470 (prng_aes_ctr_init): Select relevant cipher to match BLKLEN.
6471 Use other half of digest for IV if not original Balloon.
6472 (balloon_open): Support other digest algos.
6473 (balloon_final): Check the error code in compute.
6474
6475 2022-02-07 NIIBE Yutaka <[email protected]>
6476
6477 kdf: Add experimental Balloon KDF.
6478 + commit 08ab32228ad20fd730979d700bf46b18e469703c
6479 * cipher/kdf.c (prng_aes_ctr_init, prng_aes_ctr_get_rand64): New.
6480 (prng_aes_ctr_fini, ballon_context_size): New.
6481 (balloon_open): Implement with SHA-256.
6482 (balloon_xor_block, balloon_compress, balloon_expand): New.
6483 (balloon_compute_fill, balloon_compute_mix, balloon_compute): New.
6484 (balloon_compute_all, balloon_final, balloon_close): New.
6485 (_gcry_kdf_open): Check argument for GCRY_KDF_BALLOON.
6486 (_gcry_kdf_compute): Dispatch for GCRY_KDF_BALLOON.
6487 (_gcry_kdf_final, _gcry_kdf_close): Likewise.
6488 * tests/t-kdf.c (check_balloon): New.
6489 (main): Add check_balloon.
6490
6491 kdf: Use u64.
6492 + commit e257fe39b8ffafa3b1fc72b00db1ea43d29c9983
6493 * cipher/kdf.c (rotr64): We use u64 in libgcrypt.
6494
6495 2022-02-04 Heiko Becker <[email protected]>
6496
6497 jitterentropy: Include <fcntl.h> and <limits.h>
6498 + commit a484bd665f4afaf39eaa0fdf3aa1c7dae75078b4
6499 * random/jitterentropy-base-user.h: Include <fcntl.h> for O_RDONLY
6500 * random/jitterentropy-base-user.h: Include <limits.h> for LONG_MAX
6501
6502 2022-02-02 Jussi Kivilinna <[email protected]>
6503
6504 hwf-arm: add detection of ARMv8 crypto extension by toolchain config.
6505 + commit d480db6e6c806835405c6795024a8fd91448c16b
6506 * src/hwf-arm.c (detect_arm_hwf_by_toolchain): New.
6507 (_gcry_hwf_detect_arm): Move __ARM_NEON check to
6508 'detect_arm_hwf_by_toolchain' and add call to the new function.
6509
6510 2022-02-02 NIIBE Yutaka <[email protected]>
6511
6512 Remove random-daemon server and util.
6513 + commit d918d8aee27987c3bb99f44a7ed3508d81009f51
6514 * configure.ac (--enable-random-daemon): Remove.
6515 * src/Makefile.am: Remove ENABLE_RANDOM_DAEMON things.
6516 * src/gcryptrnd.c, src/getrandom.c: Remove.
6517
6518 2022-01-31 Werner Koch <[email protected]>
6519
6520 rsa: Fix regression in not returning an error for prime generation.
6521 + commit 217bf0a0e7be4a216a405a4bfb719e0fd437c2a3
6522 * cipher/rsa.c (generate_fips): Set the default EC again.
6523
6524 2022-01-31 Jakub Jelen <[email protected]>
6525
6526 cipher: Initialize values not to confuse static analyzers.
6527 + commit cb9df21fcbb05d9650df7b45671d335eefad405b
6528 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_sign): Initialize integer values
6529 not to confuse static analyzers.
6530 (_gcry_ecc_eddsa_verify): Ditto.
6531
6532 fips: Remove unused assignment.
6533 + commit d2003618e6bf733f0c913f5c8961779f8e4dc05c
6534 * src/fips.c (hmac256_check): Remove unused assignment.
6535
6536 cipher: Remove dead code in for the siv mode.
6537 + commit 0f38e6a877f19db303672ca899b36333fb84c8fa
6538 * cipher/cipher-siv.c (_gcry_cipher_siv_setkey): Remove dead code
6539
6540 random: Avoid dereference of the ec before checking for NULL.
6541 + commit 904e168bdb2ac4cbfe32db86a6cd11ab462340ad
6542 * random/jitterentropy-noise.c (jent_memaccess): Move check before
6543 dereferencing the pointer.
6544
6545 2022-01-31 NIIBE Yutaka <[email protected]>
6546
6547 kdf: Fix computation by big-endian machine.
6548 + commit 77512c510bf744b341d3173e65e22b9dd0b5df03
6549 * cipher/kdf.c (beswap64_block): New.
6550 (argon2_fill_first_blocks): Convert to native endian.
6551 (pseudo_random_generate): Run in native endian.
6552 (argon2_compute_segment): Run in native endian.
6553 (argon2_final): Convert from native endian.
6554
6555 ciper/blake2: Make sure to clean up the stack.
6556 + commit 7dc488ae036addd69878681a4eab6d25e9d99c8e
6557 * cipher/blake2.c (blake2b_vl_hash): Wipe the memory.
6558
6559 2022-01-28 Jussi Kivilinna <[email protected]>
6560
6561 kdf: handle errors from thread dispatch/wait functions.
6562 + commit 54369c66bedd20d6846ed8fab678082ec8eecf5d
6563 * cipher/kdf.c (argon2_compute): Handle failed job dispatch/wait.
6564 * tests/t-kdf.c (pthread_jobs_launch_job)
6565 (wait_all_jobs_completion): Handle errors returned from pthread functions.
6566
6567 kdf/argon2: use BLAKE2b hash_buffers function instead of _gcry_md_*
6568 + commit 409f69167983deacee6d6c85c80a4be0e4b5d7c1
6569 * cipher/kdf.c (argon2_fill_first_blocks): Convert to use iov
6570 hash_buffers API instead of _gcry_md_*.
6571
6572 Rename KDF job functions and function types.
6573 + commit c5aead8aebc7dfb699597eb6adf334bd2edbc374
6574 * src/gcrypt.h.in (gcry_kdf_job_fn_t): New.
6575 (gcry_kdf_dispatch_job_fn_t): Renamed from 'gcry_kdf_lauch_job_t'; Use
6576 'gcry_kdf_job_fn_t' for function pointer parameter.
6577 (gcry_kdf_wait_all_jobs_fn_t): Renamed from
6578 'gcry_kdf_wait_all_jobs_completion_t'.
6579 (gcry_kdf_thread_ops_t): Rename functions to 'dispatch_job' and
6580 'wait_all_jobs'.
6581 * cipher/kdf.c (argon2_compute): Change to use 'dispatch_job' and
6582 'wait_all_jobs'.
6583 * tests/t-kdf.c (job_thread_param, pthread_jobs_launch_job): Use
6584 'gcry_kdf_job_fn_t' type for 'job'.
6585
6586 tests/t-kdf: few changes to pthread example and fix win32/win64 builds.
6587 + commit 03a0eedefe3e8b979aee6fb9800fe8e794f50089
6588 * src/gcrypt.h.in (gcry_kdf_thread_ops_t): New based on
6589 'struct gcry_kdf_thread_ops'.
6590 (gcry_kdf_compute): Use 'gcry_kdf_thread_ops_t' instead of
6591 'struct gcry_kdf_thread_ops'.
6592 * tests/Makefile.am: Define 't_kdf_LDADD' and 't_kdf_CFLAGS' on
6593 win32/win64 target too.
6594 * tests/t-kdf.c (pthread_jobs_launch_job): Set 'oldest_thread_idx' on
6595 first thread creation.
6596 (wait_all_jobs_completion): Reset 'oldest_thread_idx' to -1.
6597 (my_kdf_derive): Merge HAVE_PTHREAD ifdefs; Initialize 'oldest_thread_idx'
6598 to -1.
6599
6600 2022-01-28 NIIBE Yutaka <[email protected]>
6601 Jussi Kivilinna <[email protected]>
6602
6603 kdf: Change new KDF API.
6604 + commit 254fb14044cfce87b619138dec7bb78a2534d1b3
6605 * cipher/kdf.c (argon2_ctl): Remove.
6606 (argon2_iterator): Remove.
6607 (argon2_compute_segment): Change the API.
6608 (argon2_compute): New.
6609 (argon2_open): No optional N_THERADS any more.
6610 (_gcry_kdf_ctl): Remove.
6611 (_gcry_kdf_iterator, _gcry_kdf_compute_segment): Remove.
6612 (_gcry_kdf_compute): New.
6613 * src/gcrypt-int.h: Update declarations.
6614 * src/gcrypt.h.in: Likewise.
6615 * src/libgcrypt.def: Update.
6616 * src/libgcrypt.vers: Update.
6617 * src/visibility.c: Update.
6618 * src/visibility.h: Update.
6619 * tests/t-kdf.c (check_argon2): Update the test with change of new
6620 API.
6621
6622 2022-01-28 NIIBE Yutaka <[email protected]>
6623
6624 kdf: Implement Argon2 KDF using blake2b_vl_hash function.
6625 + commit 4cbbd87e2af00c7b3f0236a56f12bd51e9295816
6626 * cipher/kdf.c (hash): Remove, as it's not possible to implement with
6627 _gcry_md_* programming interface.
6628 (xor_block): New.
6629 (argon2_fill_first_blocks): Rename from argon2_genh0_first_blocks.
6630 (argon2_init): Don't use ->HD any more.
6631 (fill_block, pseudo_random_generate, index_alpha): New.
6632 (argon2_compute_segment): Implement ARGOND, ARGON2I and ARGON2ID.
6633 (argon2_final): Fix using blake2b_vl_hash.
6634 (argon2_open): Fix for parameters and the restriction for output length.
6635 * tests/t-kdf.c (check_argon2): Update test vector for version 0x13.
6636 (main): Enable the test.
6637
6638 cipher: Implement variable-length hash function for Argon2.
6639 + commit 6467287ba121df9e5965d5a3a7a4f349793d49d2
6640 * cipher/blake2.c (blake2b_vl_hash): New.
6641
6642 2022-01-26 NIIBE Yutaka <[email protected]>
6643
6644 kdf: Improve new KDF API.
6645 + commit f21871e241e96148cef3ad4314ad596178cf8967
6646 * cipher/kdf.c (struct argon2_thread_data): Change layout.
6647 (argon2_iterator): Use struct gcry_kdf_pt_head.
6648 (argon2_compute_segment): Rename from argon2_compute_row.
6649 (argon2_open): Handle N_THREAD maximum.
6650 (_gcry_kdf_iterator): Use struct gcry_kdf_pt_head.
6651 (_gcry_kdf_compute_segment): Rename from _gcry_kdf_compute_row.
6652 * src/gcrypt-int.h: Update declarations.
6653 * src/gcrypt.h.in (struct gcry_kdf_pt_head): Expose the data type.
6654 * src/libgcrypt.def, src/libgcrypt.vers: Update.
6655 * src/visibility.c, src/visibility.h: Update.
6656 * tests/t-kdf.c (start_thread, my_kdf_derive): Follow the change.
6657
6658 2022-01-25 NIIBE Yutaka <[email protected]>
6659
6660 random: Include sys/random.h when available.
6661 + commit 5e2d792eb8d9e5aaf1b71205f9298286b8145462
6662 * configure.ac (AC_CHECK_HEADERS): Check sys/random.h.
6663 * random/rndgetentropy.c [HAVE_SYS_RANDOM_H]: Include it.
6664
6665 cipher: Add new API for modern KDF function.
6666 + commit bafdb90d97b65db541ea917088ca956e6a364f6b
6667 * cipher/kdf.c (hash, argon2_genh0_first_blocks): New for Argon2.
6668 (argon2_init, argon2_ctl, argon2_iterator): Likewise.
6669 (argon2_compute_row, argon2_final, argon2_close): Likewise.
6670 (argon2_open): Likewise.
6671 (balloon_open): New for Balloon.
6672 (_gcry_kdf_open, _gcry_kdf_ctl, _gcry_kdf_iterator): Add new API.
6673 (_gcry_kdf_compute_row, _gcry_kdf_final, _gcry_kdf_close): Likewise.
6674 * src/gcrypt-int.h: Add declarations for new API.
6675 * src/gcrypt.h.in: Likewise.
6676 (enum gcry_kdf_algos): Add GCRY_KDF_ARGON2 and GCRY_KDF_BALLOON.
6677 (enum gcry_kdf_subalgo_argon2): Add GCRY_KDF_ARGON2D,
6678 GCRY_KDF_ARGON2I, and GCRY_KDF_ARGON2ID.
6679 * src/libgcrypt.def, src/libgcrypt.vers: Update.
6680 * src/visibility.h: Likewise.
6681 * src/visibility.c: Add new API.
6682 * tests/Makefile.am (t_kdf_LDADD, t_kdf_CFLAGS): Enable use of pthread.
6683 * tests/t-kdf.c (check_argon2): New, not enabled yet.
6684
6685 Prefer uint64_t for the definition of u64.
6686 + commit 3d353782d84b9720262d7b05adfae3aef7ff843b
6687 * src/types.h (u64): Prefer use of uint64_t with C99 compliant
6688 compiler.
6689
6690 tests: Fix variable initialization for tests.
6691 + commit 99642f18ccbe45fb4cae55945af49f7884bcaceb
6692 * tests/t-rsa-15.c (one_test_sexp): Initialize OUT_LEN.
6693 * tests/t-rsa-pss.c (one_test_sexp): Initialize CTX and OUT_LEN.
6694 Fix the if condition.
6695
6696 2022-01-25 Jakub Jelen <[email protected]>
6697
6698 mpi: Add missing header file to the tarball.
6699 + commit 08f3e0909f8c4fefc2c020dca206037693282186
6700 * mpi/Makefile.am: Add missing header file.
6701
6702 doc: Update more information about FIPS selftests and algorithms.
6703 + commit 1f299cb16afdfd0ccc3cd9e9ae65a789be6514f7
6704 * doc/gcrypt.texi: List implemented GOST curves.
6705 Update location of the HMAC selftests and add SHA3 ones.
6706 Add information about ECC selftests.
6707 Add information about KDF selftests.
6708 Update information about additional MAC selftests.
6709 Update ifnromation about FIPS allowed algorithms.
6710
6711 2022-01-22 Jussi Kivilinna <[email protected]>
6712
6713 tests/t-kdf: fix format string argument type mismatch.
6714 + commit e9e723d5e320ff2c67bf9a9841777749a44e54d0
6715 * tests/t-kdf.c (check_pbkdf2, check_scrypt): Change fprintf format
6716 for plen from "%ld" to "%u" and cast plen to 'unsigned int'.
6717
6718 Fix building GCM when GCM_USE_ARM_NEON defined but GCM_USE_ARM_PMULL not
6719 + commit a35ac62ee7b5a6e799eb4a89a934da0313fb1158
6720 * cipher/cipher-gcm.c (setupM): Remove ifdef around 'features'.
6721
6722 2022-01-20 NIIBE Yutaka <[email protected]>
6723
6724 scrypt: Fix the last step of SCRYPT.
6725 + commit 867435cf8847fb80e922eb818fbcfac131863b8c
6726 * cipher/scrypt.c (_gcry_kdf_scrypt): Single call to PBKDF2.
6727
6728 fips: Recover test cases for selftest, add skipping in FIPS mode.
6729 + commit 535a4d345872aa2cd2ab3a5f9c4411d0a0313328
6730 * cipher/kdf.c (check_one): Skip a test with shorter passphrase in
6731 FIPS mode.
6732 (selftest_pbkdf2): Recover selftest cases.
6733 * cipher/mac-hmac.c (check_one): Skip a test with shorter key in FIPS
6734 mode.
6735 (selftests_sha224, selftests_sha256): Recover selftest cases.
6736 (selftests_sha384, selftests_sha512, selftests_sha3): Likewise.
6737
6738 2022-01-19 NIIBE Yutaka <[email protected]>
6739
6740 fips: Reject shorter key for HMAC in FIPS mode.
6741 + commit 76aad97dd312e83f2f9b8d086553f2b72ab6546f
6742 * cipher/md.c (prepare_macpads): Reject < 112-bit key.
6743 * cipher/kdf.c (selftest_pbkdf2): Remove selftest cases with shorter
6744 key.
6745 * cipher/mac-hmac.c (selftests_sha224, selftests_sha256): Likewise.
6746 (selftests_sha384, selftests_sha512, selftests_sha3): Likewise.
6747 * tests/basic.c (check_one_hmac) Handle an error when shorter key
6748 is rejected.
6749 (check_one_mac): Likewise.
6750 * tests/t-kdf.c (check_pbkdf2, check_scrypt): Likewise.
6751
6752 2022-01-18 NIIBE Yutaka <[email protected]>
6753
6754 build: Fix .m4 files in distribution.
6755 + commit 6f225308d3e59f8749403ad743d8e6c591142f8f
6756 * m4/Makefile.am (EXTRA_DIST): Remove sys_socket_h.m4.
6757
6758 2022-01-17 NIIBE Yutaka <[email protected]>
6759
6760 fips: Remove GCRYCTL_FIPS_SERVICE_INDICATOR and renumber the enum.
6761 + commit d0db6a5abf7b8cc5637de5a080a7ed986e3ff63f
6762 * src/gcrypt.h.in (enum gcry_ctl_cmds): Remove
6763 GCRYCTL_FIPS_SERVICE_INDICATOR.
6764 * src/fips.c (_gcry_fips_indicator_cipher): Use gcry_kdf_algos.
6765 * tests/basic.c: Use GCRYCTL_FIPS_SERVICE_INDICATOR_CIPHER.
6766
6767 2022-01-17 Jakub Jelen <[email protected]>
6768
6769 Update documentation related to FIPS.
6770 + commit e023e10ee89baf5d5909de4d8c13ba6dfbc8ed99
6771 * cipher/rsa.c (selftest_encr_2048): Fix error message
6772 * doc/gcrypt.texi: Add missing hwfeatures
6773 Add description of the service indicator API
6774 Fix typo in tampered word
6775 Add some missing curves
6776 Remove algoriths no longer used in FIPS mode and update claims given
6777
6778 fips: Add support for KDF FIPS indicators.
6779 + commit 8611c9f276ad0f51fcdd4da0481108880104338f
6780 * src/fips.c (_gcry_fips_indicator): rename to
6781 _gcry_fips_indicator_cipher().
6782 (_gcry_fips_indicator_kdf): New function.
6783 * src/g10lib.h: Rename _gcry_fips_indicator to
6784 _gcry_fips_indicator_cipher() and add _gcry_fips_indicator_kdf()
6785 * src/gcrypt.h.in (enum gcry_ctl_cmds): Add
6786 GCRYCTL_FIPS_SERVICE_INDICATOR_CIPHER and
6787 GCRYCTL_FIPS_SERVICE_INDICATOR_KDF.
6788 * src/global.c (_gcry_vcontrol): Implement support for KDF FIPS
6789 Indicator separate from the cipher one.
6790
6791 2022-01-11 Jussi Kivilinna <[email protected]>
6792
6793 rijndael-aesni: small optimization for cbc-enc and cfb-enc.
6794 + commit dfd53c7eddf0beaf9e85daaed92c0bd756112470
6795 * cipher/rijndael-aesni.c (_gcry_aes_aesni_cfb_enc)
6796 (_gcry_aes_aesni_cbc_enc): Copy contents of 'do_aesni_enc' here and
6797 merge input/output and first/last round key xoring to shorten critical
6798 path.
6799
6800 mpi/amd64: remove extra 'ret' from assembly functions.
6801 + commit 0c0f27a89205842b5ef8e56a9726074f6b738f73
6802 * mpi/amd64/mpih-add1.S: Remove 'ret' as it is already included by
6803 FUNC_EXIT macro.
6804 * mpi/amd64/mpih-lshift.S: Likewise.
6805 * mpi/amd64/mpih-mul1.S: Likewise.
6806 * mpi/amd64/mpih-mul2.S: Likewise.
6807 * mpi/amd64/mpih-mul3.S: Likewise.
6808 * mpi/amd64/mpih-rshift.S: Likewise.
6809 * mpi/amd64/mpih-sub1.S: Likewise.
6810
6811 mpi/config.links: merge i586 targets with rest i*86 targets.
6812 + commit 9bbb6c2c5d03c19b7f4356628a76eb8bde3ab026
6813 * mpi/config.links: Merge i586 targets with rest i[3467]86 targets.
6814
6815 mpi: remove unused i586 and pentium4 assembly.
6816 + commit 2800de892585c405099039d6f9dc346c3a71c16e
6817 * mpi/config.links: Remove 'i586' from paths.
6818 * mpi/i586*: Remove.
6819 * mpi/pentium4/*: Remove.
6820
6821 Add straight-line speculation hardening for aarch64 assembly.
6822 + commit 34bcc102158a651781f4e7639e2654068a39db6d
6823 * cipher/asm-common-aarch64.h (ret_spec_stop): New.
6824 * cipher/asm-poly1305-aarch64.h: Use 'ret_spec_stop' for 'ret'
6825 instruction.
6826 * cipher/camellia-aarch64.S: Likewise.
6827 * cipher/chacha20-aarch64.S: Likewise.
6828 * cipher/cipher-gcm-armv8-aarch64-ce.S: Likewise.
6829 * cipher/crc-armv8-aarch64-ce.S: Likewise.
6830 * cipher/rijndael-aarch64.S: Likewise.
6831 * cipher/rijndael-armv8-aarch64-ce.S: Likewise.
6832 * cipher/sha1-armv8-aarch64-ce.S: Likewise.
6833 * cipher/sha256-armv8-aarch64-ce.S: Likewise.
6834 * cipher/sm3-aarch64.S: Likewise.
6835 * cipher/twofish-aarch64.S: Likewise.
6836 * mpi/aarch64/mpih-add1.S: Likewise.
6837 * mpi/aarch64/mpih-mul1.S: Likewise.
6838 * mpi/aarch64/mpih-mul2.S: Likewise.
6839 * mpi/aarch64/mpih-mul3.S: Likewise.
6840 * mpi/aarch64/mpih-sub1.S: Likewise.
6841
6842 Add straight-line speculation hardening for amd64 and i386 assembly.
6843 + commit 11ade08efbfbc36dbf3571f1026946269950bc40
6844 * cipher/asm-common-amd64.h (ret_spec_stop): New.
6845 * cipher/arcfour-amd64.S: Use 'ret_spec_stop' for 'ret' instruction.
6846 * cipher/blake2b-amd64-avx2.S: Likewise.
6847 * cipher/blake2s-amd64-avx.S: Likewise.
6848 * cipher/blowfish-amd64.S: Likewise.
6849 * cipher/camellia-aesni-avx-amd64.S: Likewise.
6850 * cipher/camellia-aesni-avx2-amd64.h: Likewise.
6851 * cipher/cast5-amd64.S: Likewise.
6852 * cipher/chacha20-amd64-avx2.S: Likewise.
6853 * cipher/chacha20-amd64-ssse3.S: Likewise.
6854 * cipher/des-amd64.S: Likewise.
6855 * cipher/rijndael-aarch64.S: Likewise.
6856 * cipher/rijndael-amd64.S: Likewise.
6857 * cipher/rijndael-ssse3-amd64-asm.S: Likewise.
6858 * cipher/rijndael-vaes-avx2-amd64.S: Likewise.
6859 * cipher/salsa20-amd64.S: Likewise.
6860 * cipher/serpent-avx2-amd64.S: Likewise.
6861 * cipher/serpent-sse2-amd64.S: Likewise.
6862 * cipher/sha1-avx-amd64.S: Likewise.
6863 * cipher/sha1-avx-bmi2-amd64.S: Likewise.
6864 * cipher/sha1-avx2-bmi2-amd64.S: Likewise.
6865 * cipher/sha1-ssse3-amd64.S: Likewise.
6866 * cipher/sha256-avx-amd64.S: Likewise.
6867 * cipher/sha256-avx2-bmi2-amd64.S: Likewise.
6868 * cipher/sha256-ssse3-amd64.S: Likewise.
6869 * cipher/sha512-avx-amd64.S: Likewise.
6870 * cipher/sha512-avx2-bmi2-amd64.S: Likewise.
6871 * cipher/sha512-ssse3-amd64.S: Likewise.
6872 * cipher/sm3-avx-bmi2-amd64.S: Likewise.
6873 * cipher/sm4-aesni-avx-amd64.S: Likewise.
6874 * cipher/sm4-aesni-avx2-amd64.S: Likewise.
6875 * cipher/twofish-amd64.S: Likewise.
6876 * cipher/twofish-avx2-amd64.S: Likewise.
6877 * cipher/whirlpool-sse2-amd64.S: Likewise.
6878 * mpi/amd64/func_abi.h (CFI_*): Remove, include from "asm-common-amd64.h"
6879 instead.
6880 (FUNC_EXIT): Use 'ret_spec_stop' for 'ret' instruction.
6881 * mpi/asm-common-amd64.h: New.
6882 * mpi/i386/mpih-add1.S: Use 'ret_spec_stop' for 'ret' instruction.
6883 * mpi/i386/mpih-lshift.S: Likewise.
6884 * mpi/i386/mpih-mul1.S: Likewise.
6885 * mpi/i386/mpih-mul2.S: Likewise.
6886 * mpi/i386/mpih-mul3.S: Likewise.
6887 * mpi/i386/mpih-rshift.S: Likewise.
6888 * mpi/i386/mpih-sub1.S: Likewise.
6889 * mpi/i386/syntax.h (ret_spec_stop): New.
6890
6891 Optimizations for AES aarch64-ce assembly implementation.
6892 + commit ff2a647d36677f6ad9edbe992a6c0ab0f7cf9510
6893 * cipher/rijndael-armv8-aarch64-ce.S (vk14): Remove.
6894 (vklast, __, _): New.
6895 (aes_preload_keys): Setup vklast.
6896 (do_aes_one128/192/256): Split to ...
6897 (do_aes_one_part1, do_aes_part2_128/192/256): ... these and add
6898 interleave ops.
6899 (do_aes_one128/192/256): New using above part1 and part2 macros.
6900 (aes_round_4): Rename to ...
6901 (aes_round_4_multikey): ... this and allow different key used for
6902 parallel blocks.
6903 (aes_round_4): New using above multikey macro.
6904 (aes_lastround_4): Reorder AES round and xor instructions, allow
6905 different last key for parallel blocks.
6906 (do_aes_4_128/192/256): Split to ...
6907 (do_aes_4_part1_multikey, do_aes_4_part1)
6908 (do_aes_4_part2_128/192/256): ... these.
6909 (do_aes_4_128/192/256): New using above part1 and part2 macros.
6910 (CLEAR_REG): Use movi for clearing registers.
6911 (aes_clear_keys): Remove branching and clear all key registers.
6912 (_gcry_aes_enc_armv8_ce, _gcry_aes_dec_armv8_ce): Adjust to macro
6913 changes.
6914 (_gcry_aes_cbc_enc_armv8_ce, _gcry_aes_cbc_dec_armv8_ce)
6915 (_gcry_aes_cfb_enc_armv8_ce, _gcry_aes_cfb_enc_armv8_ce)
6916 (_gcry_aes_ctr32le_enc_armv8_ce): Apply entry/loop-body/exit
6917 optimization for better interleaving of input/output processing;
6918 First/last round key and input/output xoring optimization to reduce
6919 critical path length.
6920 (_gcry_aes_ctr_enc_armv8_ce): Add fast path for counter incrementing
6921 without byte-swaps when counter does not overflow 8-bit; Apply
6922 entry/loop-body/exit optimization for better interleaving of
6923 input/output processing; First/last round key and input/output
6924 xoring optimization to reduce critical path length.
6925 (_gcry_aes_ocb_enc_armv8_ce, _gcry_aes_ocb_dec_armv8_ce): Add aligned
6926 processing for nblk and OCB offsets; Apply entry/loop-body/exit
6927 optimization for better interleaving of input/output processing;
6928 First/last round key and input/output xoring optimization to reduce
6929 critical path length; Change to use same function body macro for
6930 both encryption and decryption.
6931 (_gcry_aes_xts_enc_armv8_ce, _gcry_aes_xts_dec_armv8_ce): Apply
6932 entry/loop-body/exit optimization for better interleaving of
6933 input/output processing; First/last round key and input/output
6934 xoring optimization to reduce critical path length; Change to use
6935 same function body macro for both encryption and decryption.
6936
6937 Add armv8/pmull accelerated POLYVAL for GCM-SIV.
6938 + commit 4e6f1ef5a00e15128e5f2398e2c282d31152d276
6939 * cipher/cipher-gcm-armv8-aarch32-ce.S
6940 (_gcry_polyval_armv8_ce_pmull): New.
6941 * cipher/cipher-gcm-armv8-aarch64-ce.S
6942 (_gcry_polyval_armv8_ce_pmull): New.
6943 * cipher/cipher-gcm.c (_gcry_polyval_armv8_ce_pmull)
6944 (polyval_armv8_ce_pmull): New.
6945 (setupM) [GCM_USE_ARM_PMULL]: Setup 'polyval_armv8_ce_pmull' as POLYVAL
6946 function.
6947
6948 Use 'vmov' and 'movi' for vector register clearing in ARM assembly.
6949 + commit 859b6ac7fbdb6ec18d1536e14b9ee83c1add224e
6950 * cipher/chacha20-aarch64.S (clear): Use 'movi'.
6951 * cipher/chacha20-armv7-neon.S (clear): Use 'vmov'.
6952 * cipher/cipher-gcm-armv7-neon.S (clear): Use 'vmov'.
6953 * cipher/cipher-gcm-armv8-aarch32-ce.S (CLEAR_REG): Use 'vmov'.
6954 * cipher/cipher-gcm-armv8-aarch64-ce.S (CLEAR_REG): Use 'movi'.
6955 * cipher/rijndael-armv8-aarch32-ce.S (CLEAR_REG): Use 'vmov'.
6956 * cipher/sha1-armv7-neon.S (clear): Use 'vmov'.
6957 * cipher/sha1-armv8-aarch32-ce.S (CLEAR_REG): Use 'vmov'.
6958 * cipher/sha1-armv8-aarch64-ce.S (CLEAR_REG): Use 'movi'.
6959 * cipher/sha256-armv8-aarch32-ce.S (CLEAR_REG): Use 'vmov'.
6960 * cipher/sha256-armv8-aarch64-ce.S (CLEAR_REG): Use 'movi'.
6961 * cipher/sha512-armv7-neon.S (CLEAR_REG): New using 'vmov'.
6962 (_gcry_sha512_transform_armv7_neon): Use CLEAR_REG for clearing
6963 registers.
6964
6965 Add SM3 ARM/AArch64 assembly implementation.
6966 + commit f664333a4749eab03c6b19bae2f28863b8501a24
6967 * cipher/Makefile.am: Add 'sm3-aarch64.S'.
6968 * cipher/sm3-aarch64.S: New.
6969 * cipher/sm3.c (USE_AARCH64_SIMD): New.
6970 [USE_AARCH64_SIMD] (_gcry_sm3_transform_aarch64)
6971 (do_sm3_transform_aarch64): New.
6972 (sm3_init) [USE_AARCH64_SIMD]: New.
6973 * configure.ac: Add 'sm3-aarch64.lo'.
6974 * tests/basic.c (main): Add command-line option '--hash' for running
6975 only hash algorithm tests.
6976
6977 2022-01-11 NIIBE Yutaka <[email protected]>
6978
6979 random: Rename rndlinux module to rndoldlinux.
6980 + commit 560943805a525a6f479b666578b0ff7d51e6f833
6981 * configure.ac (USE_RNDOLDLINUX): Rename from USE_RNDLINUX.
6982 (GCRYPT_RANDOM): Use rndoldlinux.lo.
6983 * doc/gcrypt.texi: Update.
6984 * random/Makefile.am (EXTRA_librandom_la_SOURCES): Update.
6985 * random/rndoldlinux.c: Rename from rndlinux.c. Rename the function.
6986 * random/rand-internal.h: Update the function name.
6987 * random/random-csprng.c: Update the calls to the function.
6988 * random/random-drbg.c: Likewise.
6989 * random/random-system.c: Likewise.
6990 * src/global.c: Use USE_RNDOLDLINUX.
6991
6992 2022-01-11 Jakub Jelen <[email protected]>
6993
6994 configure: Fix help text for the fips module version.
6995 + commit 83e58191d3d960b3efda960dd6fe50e8f0b02bda
6996 * configure.ac: Fix unmatched parenthesis and add more verbose
6997 description of the --with-fips-module-version configure option.
6998
6999 2022-01-11 NIIBE Yutaka <[email protected]>
7000
7001 fips: Provide a mechanizm to put libgcrypt in non-FIPS mode.
7002 + commit 2a8b3fed1a80e74dfb12c03e426373a300407eda
7003 * doc/gcrypt.texi (Disabling FIPS mode): Add.
7004 * src/gcrypt.h.in (GCRYCTL_NO_FIPS_MODE): New.
7005 * src/global.c (_gcry_vcontrol): Support GCRYCTL_NO_FIPS_MODE.
7006 * tests/t-ed25519.c: Add --no-fips option to test non-FIPS mode.
7007
7008 cipher: Keep original behavior of Key Unwrap when not extended.
7009 + commit 383866f014f2ae8487d15e3fd99fe688b489d364
7010 * cipher/cipher-aeswrap.c (_gcry_cipher_keywrap_decrypt_auto): Only
7011 allow unwrapping by KWP when GCRY_CIPHER_EXTENDED is specified.
7012
7013 2022-01-05 NIIBE Yutaka <[email protected]>
7014
7015 cipher: Add an API to retrieve unwrapped key length for KWP.
7016 + commit 746b8e29969be56e086191dbe93978f7e0355aa0
7017 * cipher/cipher-aeswrap.c (_gcry_cipher_keywrap_decrypt)
7018 (_gcry_cipher_keywrap_decrypt_padding): Merged into...
7019 (_gcry_cipher_keywrap_decrypt_auto): ... this.
7020 Write length information to struct gcry_cipher_handle.
7021 * cipher/cipher-internal.h (struct gcry_cipher_handle): Add
7022 u_mode.wrap.
7023 * cipher/cipher.c (_gcry_cipher_setup_mode_ops): Use
7024 _gcry_cipher_keywrap_decrypt_auto.
7025 (_gcry_cipher_info): Support GCRYCTL_GET_KEYLEN for
7026 GCRY_CIPHER_MODE_AESWRAP. Not that it's not length of KEK,
7027 but length of unwrapped key.
7028 * tests/aeswrap.c (check_one_with_padding): Add check
7029 for length of unwrapped key.
7030
7031 2022-01-04 NIIBE Yutaka <[email protected]>
7032
7033 cipher: Use const for *_spec_t, if possible.
7034 + commit f9ba07942b10c72af50bd73c92c4851b6981546e
7035 * cipher/blake2.c: Use const.
7036 * cipher/camellia-glue.c, cipher/cipher.c, cipher/crc.c: Likewise.
7037 * cipher/des.c, cipher/gost28147.c, cipher/gostr3411-94.c: Likewise.
7038 * cipher/keccak.c, cipher/mac-cmac.c, cipher/mac-gmac.c: Likewise.
7039 * cipher/mac-hmac.c, cipher/mac-internal.h: Likewise.
7040 * cipher/mac-poly1305.c, cipher/mac.c, cipher/md.c: Likewise.
7041 * cipher/md.c, cipher/md2.c, cipher/md4.c, cipher/md5.c: Likewise.
7042 * cipher/pubkey.c, cipher/rfc2268.c, cipher/rijndael.c: Likewise.
7043 * cipher/rmd160.c, cipher/seed.c, cipher/serpent.c: Likewise.
7044 * cipher/sha1.c, cipher/sha256.c, cipher/sha512.c: Likewise.
7045 * cipher/sm3.c, cipher/sm4.c, cipher/stribog.c: Likewise.
7046 * cipher/pubkey.c, cipher/rfc2268.c, cipher/rijndael.c: Likewise.
7047 * src/cipher-proto.h, src/cipher.h: Likewise.
7048
7049 fips: Use flags.fips to check algo availability.
7050 + commit 034e4402dade7a4bcc239913b78c702c5c6f0dbb
7051 * cipher/cipher.c (check_cipher_algo): Check ->flags.fips.
7052 (_gcry_cipher_open_internal, _gcry_cipher_selftest): Likewise.
7053 (_gcry_cipher_init): Don't modify ->flags.disabled.
7054 * cipher/mac.c (_gcry_mac_init): Don't modify ->flags.disabled.
7055 (check_mac_algo): Check ->flags.fips.
7056 (mac_open, _gcry_mac_selftest): Likewise.
7057 * cipher/md.c (check_digest_algo): Check ->flags.fips.
7058 (md_enable, _gcry_md_hash_buffer): Likewise.
7059 (_gcry_md_hash_buffers_extract, _gcry_md_selftest): Likewise.
7060 (_gcry_md_init): Don't modify ->flags.disabled.
7061
7062 doc: Update doc/gcrypt.texi for random/.
7063 + commit 11ef7b50a708b92d94e1e1f47433fc53b3fd2cf3
7064 * doc/gcrypt.texi: Address rndgetentropy module. Remove X9.31 RPNG
7065 documentation, as the implementation has been removed already.
7066
7067 2022-01-03 NIIBE Yutaka <[email protected]>
7068
7069 cipher: Add support of Key wrap with padding (KWP).
7070 + commit 2914f169f95467b9c789000105773b38ad2dea5a
7071 * src/gcrypt.h.in (GCRY_CIPHER_EXTENDED): New enum value.
7072 * cipher/cipher-aeswrap.c (wrap): New.
7073 (_gcry_cipher_keywrap_encrypt, unwrap): Use wrap.
7074 (_gcry_cipher_keywrap_encrypt_padding): New.
7075 (_gcry_cipher_keywrap_decrypt): Use unwrap.
7076 (_gcry_cipher_keywrap_decrypt_padding): New.
7077 * cipher/cipher-internal.h: Add declarations.
7078 * cipher/cipher.c (_gcry_cipher_open_internal): Support
7079 GCRY_CIPHER_EXTENDED.
7080 (_gcry_cipher_setup_mode_ops): Extend for GCRY_CIPHER_MODE_AESWRAP.
7081 * tests/aeswrap.c: Add two tests from RFC5649.
7082
7083 2021-12-22 NIIBE Yutaka <[email protected]>
7084
7085 build: Update for newer autoconf.
7086 + commit 3204c3827e9840915af2b6cbf603f3cf51664568
7087 * configure.ac (AC_PREREQ): Require >= 2.69.
7088 (AC_CONFIG_HEADERS): Use it, instead of AC_CONFIG_HEADER.
7089 (AC_HEADER_STDC): Remove.
7090 * m4/sys_socket_h.m4: Remove.
7091
7092 2021-12-21 Danny Tsen <[email protected]>
7093
7094 AES-GCM: Bulk implementation of AES-GCM acceleration for ppc64le.
7095 + commit 7205c715b3e0f6fd0b853e8916d174048f43c03b
7096 * configure.ac: Added p10 assembly implementation file and assiciated file.
7097 * cipher/Makefile.am: Added p10 assembly implementation file and associated
7098 file.
7099 * cipher/rijndael.c: Added p10 function.
7100 * cipher/rijndael-p10le.c: New wrapper file for AES-GCM call.
7101 * cipher/rijndael-gcm-p10le.s: New implementation of AES-GCM bulk function in
7102 Power Assembly.
7103 * src/g10lib.h: Added Power arch 3.1 definition for p10.
7104 * src/hwf-ppc.c: Added Power arch 3.1 definition for p10.
7105 * src/hwfeatures.c: Added Power arch 3.1 definition for p10.
7106
7107 2021-12-21 Tianjia Zhang <[email protected]>
7108
7109 cipher: Fix SM3 avx/bmi2 compilation error.
7110 + commit 3b9f746c2fb16234dffe0582059dfe36b2c21bf8
7111 * cipher/sm3-avx-bmi2-amd64.S: Change K0-K63 macros to signed decimal.
7112
7113 2021-12-17 NIIBE Yutaka <[email protected]>
7114
7115 random: Keep --enable-random-daemon, but not its use from runtime.
7116 + commit 27d945084f6926d0ebe8066fb60db785f3a8fb57
7117 * configure.ac (--enable-random-daemon): Don't define
7118 USE_RANDOM_DAEMON, but use the conditional ENABLE_RANDOM_DAEMON.
7119 * src/Makefile.am: Use the conditional ENABLE_RANDOM_DAEMON.
7120
7121 random: Remove random-daemon use remained.
7122 + commit 14f5d73e2731b83b18e9771eb3068c6dbba6f069
7123 * configure.ac (--enable-random-daemon): Fix the message.
7124 * random/random-csprng.c [USE_RANDOM_DAEMON] (initialize_basics):
7125 Remove the dependency to random daemon.
7126 * random/random.h [USE_RANDOM_DAEMON]: Likewise.
7127
7128 fips: Add constructor to run selftests.
7129 + commit 45974d87753978b953940045280e9f28f951dbe0
7130 * src/fips.c (_gcry_fips_to_activate): New.
7131 * src/g10lib.h (_gcry_fips_to_activate): New.
7132 * src/global.c [ENABLE_HMAC_BINARY_CHECK] (_gcry_global_constructor):
7133 New.
7134
7135 2021-12-16 NIIBE Yutaka <[email protected]>
7136
7137 Simplify the logic for no_secure_memory.
7138 + commit 209d98dcf66bd7baeca37cd6b13b31c7f00f4625
7139 * src/global.c (_gcry_vcontrol): Don't set NO_SECURE_MEMORY when
7140 FIPS mode is enabled.
7141 (get_no_secure_memory): Remove. Don't touch NO_SECURE_MEMORY,
7142 when examining the variable.
7143 (do_malloc, _gcry_is_secure): Just use NO_SECURE_MEMORY.
7144
7145 2021-12-14 Jussi Kivilinna <[email protected]>
7146
7147 Add SM3 x86-64 AVX/BMI2 assembly implementation.
7148 + commit 0c1d55a84c8970b8568ae645f24ce534bebdb5a4
7149 * cipher/Makefile.am: Add 'sm3-avx-bmi2-amd64.S'.
7150 * cipher/sm3-avx-bmi2-amd64.S: New.
7151 * cipher/sm3.c (USE_AVX_BMI2, ASM_FUNC_ABI, ASM_EXTRA_STACK): New.
7152 (SM3_CONTEXT): Define 'h' as array instead of separate fields 'h1',
7153 'h2', etc.
7154 [USE_AVX_BMI2] (_gcry_sm3_transform_amd64_avx_bmi2)
7155 (do_sm3_transform_amd64_avx_bmi2): New.
7156 (sm3_init): Select AVX/BMI2 transform function if support by HW; Update
7157 to use 'hd->h' as array.
7158 (transform_blk, sm3_final): Update to use 'hd->h' as array.
7159 * configure.ac: Add 'sm3-avx-bmi2-amd64.lo'.
7160
7161 2021-12-10 Jakub Jelen <[email protected]>
7162
7163 tests: Include the new input files for tests.
7164 + commit 02583e1216bc7e6f9f4219771bb274d1fe4491c8
7165 * tests/Makefile.am: Include the new .inp files needed for tests
7166
7167 2021-12-09 NIIBE Yutaka <[email protected]>
7168
7169 tests,fips: Align the use of variable in_fips_mode.
7170 + commit 7d8403b59a105d2d3e5d0fd9d5d25b7e3b2d2787
7171 * tests/pubkey.c (check_run): Fix use of pkey and skey.
7172 * tests/*.c (in_fips_mode): No initialize by 0.
7173
7174 2021-12-09 Jakub Jelen <[email protected]>
7175
7176 Adjust tests for proper disablement of non-approve PK operations.
7177 + commit 5b82f4b4dbf393d0ce901fc9e0c559c488b013cb
7178 * cipher/pubkey.c (_gcry_pk_genkey): Do not allow key generation of
7179 disabled key types
7180 * tests/benchmark.c (elg_bench): Skip Elgamal keys benchmark in FIPS
7181 mode
7182 (dsa_bench): Skip DSA keys benchmarking in FIPS mode
7183 * tests/dsa-rfc6979.c (check_dsa_rfc6979): DSA keys are no longer
7184 allowed in FIPS mode
7185 * tests/fips186-dsa.c (global): Use global in_fips_mode flag
7186 (check_dsa_gen_186_2): Expect DSA keygen fail in FIPS mode
7187 (check_dsa_gen_186_3): Ditto.
7188 (main): Use global fips mode flag.
7189 * tests/keygen.c (check_elg_keys): Verify Elgamal keys can not be
7190 generated in FIPS mode
7191 (check_dsa_keys): Verify DSA keys can not be generated in FIPS mode.
7192 * tests/pubkey.c (get_elg_key_new): Expect key generation to fail in
7193 FIPS mode
7194 (get_dsa_key_new): Expect DSA key generation to fail in FIPS mode
7195 (get_dsa_key_fips186_new): Ditto.
7196 (get_dsa_key_with_domain_new): Ditto.
7197 (get_dsa_key_fips186_with_seed_new): Ditto.
7198 (check_run): Do not try the Elgamal and DSA key operations in FIPS
7199 mode.
7200 * tests/t-dsa.c (one_test_sexp): Skip the DSA tests in FIPS mode.
7201
7202 2021-12-08 NIIBE Yutaka <[email protected]>
7203
7204 tests: Add tests for gcry_pk_hash_sign/verify API.
7205 + commit a0a2b6796f58f9aac0fe49100b1ee4c68f9bdc72
7206 * tests/Makefile.am (tests_bin): Add t-dsa t-ecdsa t-rsa-pss t-rsa-15.
7207 * tests/t-dsa.c, tests/t-ecdsa.c: New tests.
7208 * tests/t-rsa-15.c, tests/t-rsa-pss.c: New tests.
7209 * tests/t-dsa.inp, tests/t-ecdsa.inp: New data for tests.
7210 * tests/t-rsa-15.inp, tests/t-rsa-pss.inp: New data for tests.
7211
7212 2021-12-08 Jakub Jelen <[email protected]>
7213
7214 fips: Disable DSA in FIPS mode.
7215 + commit ea362090fc11caa28643153fc6444442243c8765
7216 * cipher/dsa.c (run_selftests): Disable DSA spec in FIPS mode.
7217 * src/fips.c (run_pubkey_selftests): Skip DSA power-on selftests.
7218
7219 2021-12-08 NIIBE Yutaka <[email protected]>
7220
7221 random: Remove random-fips.c from repo.
7222 + commit 5521cac32d75f2b94894cd5a94deb2c5d25f43a5
7223 * random/random-fips.c: Remove.
7224
7225 2021-12-07 Alexander Kanavin <[email protected]>
7226
7227 build: cipher/Makefile.am, doc/Makefile.am: add a missing space.
7228 + commit 05472c1882df2fb84b867c0bdbbff510065785ba
7229 * cipher/Makefile.am: Add a space.
7230 * doc/Makefile.am: Ditto.
7231
7232 2021-12-07 NIIBE Yutaka <[email protected]>
7233
7234 md: Fix disabled check.
7235 + commit 8ca3fe07d03e9329ee97534f40208593cde11bf7
7236 * cipher/md.c (md_enable): Fix accessing the disabled flag.
7237
7238 2021-12-07 Jakub Jelen <[email protected]>
7239
7240 Properly enforce disablement in other pubkey API.
7241 + commit e96980022e5ec079c9d4e3492eb6a1131c68e0f2
7242 * cipher/pubkey.c (_gcry_pk_encrypt): Fail if algo is disabled
7243 (_gcry_pk_decrypt): Ditto.
7244 (_gcry_pk_sign): Ditto.
7245 (_gcry_pk_sign_md): Ditto.
7246 (_gcry_pk_verify): Ditto.
7247 (_gcry_pk_verify_md): Ditto.
7248 (_gcry_pk_testkey): Ditto.
7249 (_gcry_pk_get_nbits): Ditto.
7250 (_gcry_pk_get_curve): Ditto.
7251 * tests/basic.c (check_pubkey): Test also other API in FIPS mode to
7252 verify they fail as expected.
7253
7254 2021-12-07 NIIBE Yutaka <[email protected]>
7255
7256 tests: Add paren for readability.
7257 + commit bea8b9672c3c47c9bffb7edc52fb32cf9091c231
7258 * tests/basic.c (check_pubkey): Add parentheses.
7259
7260 md: Fix checking to use ->disabled instead of ->fips directly.
7261 + commit 3152a565d9a426b6c984e161d1a95a8df347dc15
7262 * cipher/md.c (md_enable): Check by ->disabled.
7263 (_gcry_md_hash_buffer, _gcry_md_hash_buffers_extract): Likewise.
7264
7265 random: Remove use of experimental random daemon.
7266 + commit 754ad5815b5bb7462260414f2bc5f449bee0b1c6
7267 * random/Makefile.am (librandom_la_SOURCES): Remove random-daemon.c.
7268 * random/random-daemon.c: Remove.
7269 * random/rand-internal.h: Remove declarations.
7270 * random/random-csprng.c (_gcry_rngcsprng_set_daemon_socket)
7271 (_gcry_rngcsprng_use_daemon): Remove.
7272 [USE_RANDOM_DAEMON] (_gcry_rngcsprng_randomize): Don't call
7273 _gcry_daemon_randomize.
7274 * random/random.c (_gcry_set_random_daemon_socket)
7275 (_gcry_use_random_daemon): Remove.
7276 * src/global.c (_gcry_vcontrol): Return GPG_ERR_NOT_SUPPORTED.
7277 * tests/benchmark.c (main): Remove support of use_random_daemon.
7278
7279 2021-12-06 NIIBE Yutaka <[email protected]>
7280
7281 random: Release memory in DRBG.
7282 + commit 751fcadd34ed42b2e595664e9ec3f88fd074d7b7
7283 * random/random-drbg.c (_gcry_rngdrbg_close_fds): Release DRBG_STATE.
7284
7285 fips: Factor out check_fips_system_setting function.
7286 + commit 5425052f38cd41a99469e4c3245a1c3e037410fe
7287 * src/fips.c (check_fips_system_setting): New.
7288 (_gcry_initialize_fips_mode): Use the new function.
7289
7290 cipher,tests: Consitent use of #if/#endif for algo selection.
7291 + commit b14aaf1a2dc71560e1f7c19ac88a7b16cc491f25
7292 * cipher/cipher.c: Use #if instead of #ifdef for algo.
7293 * cipher/mac-cmac.c: Likewise.
7294 * cipher/mac-hmac.c: Likewise.
7295 * cipher/mac-internal.h: Likewise.
7296 * cipher/mac.c: Likewise.
7297 * tests/basic.c: Likewise.
7298
7299 2021-12-06 Jakub Jelen <[email protected]>
7300
7301 tests: Conditionalize other algorithms that might not be built-in.
7302 + commit 57b61b0f4f1be7513ed064a90321849bb9f47f29
7303 * tests/basic.c (check_cbc_mac_cipher): Do not run DES tests without DES
7304 being built-in.
7305 (check_ecb_cipher): Do not run blowfish and DES tests without them
7306 being built-in
7307 (check_cfb_cipher): Do not run DES tests without DES being built-in.
7308 (check_ccm_cipher): Do not run camellia tests without it being
7309 built-in.
7310 (check_ocb_cipher): Do not run Camellia, Twofish and Serpent tests
7311 without them being built-in.
7312 (check_digests): Do not run SM3 tests without them being built-in.
7313 (check_digests): Do not run DES, Camellia and GOST tests without them
7314 being built-in.
7315
7316 tests: Unbreak tests with SM4 disabled.
7317 + commit b601ef4dc9f9a337e3019fc5ad3c7b31fcdc43f3
7318 * tests/basic.c (check_ecb_cipher): Do not run SM4 tests when SM4 is not
7319 built.
7320 (check_ctr_cipher): Ditto.
7321 (check_cfb_cipher): Ditto.
7322 (check_ofb_cipher): Ditto.
7323 (check_ocb_cipher): Ditto.
7324
7325 2021-12-03 NIIBE Yutaka <[email protected]>
7326 Jakub Jelen <[email protected]>
7327
7328 rsa: Allow e=0 to select 65537 for keygeneration under X931.
7329 + commit e4a450d1d966cf19cc5ba4d772254be08782e463
7330 * cipher/rsa.c (generate_x931): Use e=65537.
7331
7332 2021-12-03 Jakub Jelen <[email protected]>
7333
7334 random: Add missing header file to the release tarball.
7335 + commit 78ce1f9e0afe296eab916f1b547f967166f80e10
7336 * random/Makefile.am: Add missing header file.
7337
7338 2021-12-01 Jussi Kivilinna <[email protected]>
7339
7340 gcry_mpi_sub_ui: fix subtracting from negative value.
7341 + commit d5bf106468e6c6b0f33b193abf04590e4e9fc011
7342 * mpi/mpi-add.c (_gcry_mpi_sub_ui): Set output sign bit when 'u'
7343 is negative.
7344 * tests/mpitests.c (test_add): Additional tests for mpi_add_ui; Check
7345 test output and fail if output does not match expected.
7346 (test_sub): Additional tests for mpi_sub_ui; Check test output and fail
7347 if output does not match expected.
7348 (test_mul): Additional tests for mpi_mul_ui; Check test output and fail
7349 if output does not match expected.
7350
7351 2021-12-01 NIIBE Yutaka <[email protected]>
7352
7353 tests: Fix basic.c to show useful information on error.
7354 + commit bff9ed54285b9a332382589d89e317da987b5b38
7355 * tests/basic.c (check_ctr_cipher): Assign return value to ERR.
7356 (check_siv_cipher, check_ccm_cipher): Likewise.
7357
7358 2021-12-01 Jakub Jelen <[email protected]>
7359
7360 tests: Improve error checking in regards to FIPS.
7361 + commit c8d2b0069e3cc97138c4e09224a84bb6ccf1b6b5
7362 * tests/basic.c (check_cbc_mac_cipher): Improve verbose alignment
7363 (check_ecb_cipher): Improve verbose message alignment.
7364 (check_ctr_cipher): Improve verbose message alignment.
7365 (check_cfb_cipher): Improve verbose message alignment and error
7366 reporting.
7367 (check_ofb_cipher): Improve verbose message alignment and error
7368 reporting.
7369 (_check_gcm_cipher): Improve error checking.
7370 (_check_eax_cipher): Improve error checking.
7371 (check_siv_cipher): Improve error checking.
7372 (check_gcm_siv_cipher): Improve error checking and indentation.
7373 (_check_poly1305_cipher): Improve verbose message alignment.
7374 (check_ccm_cipher): Improve verbose message alignment.
7375 (do_check_ocb_cipher): Improve error checking.
7376 (check_ocb_cipher_largebuf_split): Improve error checking.
7377 (check_ocb_cipher_checksum): Improve error checking.
7378 (check_ocb_cipher_splitaad): Improve error checking.
7379 (check_gost28147_cipher_basic): Improve verbose message alignment.
7380 (check_stream_cipher): Improve verbose message alignment.
7381 (check_one_cipher_core): Improve error checking.
7382 (check_ciphers): Improve error checking.
7383 (check_pubkey): Check explicitly the for failure in FIPS mode.
7384
7385 Disable 3DES in FIPS mode.
7386 + commit 23a58b779e31e6244a481c26096d1ad061eb024c
7387 * cipher/des.c (_gcry_cipher_spec_tripledes): Mark as non-FIPS
7388 * cipher/mac-cmac.c ( _gcry_mac_type_spec_cmac_tripledes): Mark non-FIPS
7389 * src/fips.c (run_cipher_selftests): skip 3DES selftests)
7390 (run_mac_selftests): skip CMAC_3DES selftests
7391 * tests/basic.c (check_cfb_cipher): Do not expect the 3DES working in
7392 FIPS mode
7393
7394 2021-11-30 Jakub Jelen <[email protected]>
7395
7396 Implement explicit FIPS indicators for cipher modes.
7397 + commit 3d38968f4b751c5561679040c055c34a690bed75
7398 * src/fips.c (_gcry_fips_indicator): New.
7399 * src/g10lib.h (_gcry_fips_indicator): New declaration.
7400 * src/gcrypt.h.in (gcry_ctl_cmds): New GCRYCTL_FIPS_SERVICE_INDICATOR
7401 * src/global.c (_gcry_vcontrol): Handle GCRYCTL_FIPS_SERVICE_INDICATOR
7402 * tests/basic.c (do_check_ocb_cipher): Check excplicit FIPS indicator
7403 (check_ocb_cipher_largebuf_split): Ditto.
7404 (check_ocb_cipher_checksum): Ditto.
7405 (check_ocb_cipher_splitaad): Ditto.
7406 (check_bulk_cipher_modes): Ditto.
7407
7408 2021-11-24 NIIBE Yutaka <[email protected]>
7409
7410 fips: Release random resources after selftests.
7411 + commit 40ab39966650489449bee3e2a68f43a9d38c4dd4
7412 * src/fips.c (_gcry_fips_is_operational): Call _cgry_random_close_fds.
7413
7414 random: Extend semantics of _gcry_random_close_fds.
7415 + commit 204be8a385ae6140175e3b495989a261410c34d0
7416 * random/random-csprng.c (_gcry_rngcsprng_close_fds): Add
7417 de-initialization.
7418 * random/random-drbg.c (_gcry_rngdrbg_close_fds): Likewise.
7419
7420 2021-11-18 Jussi Kivilinna <[email protected]>
7421
7422 Do not build 'cipher/' assembly files when --disable-asm used.
7423 + commit 33f1a7ad3cd13602d8bffe156f383c3a704dfd67
7424 * configure.ac: Collect assembly implementation *.lo files under
7425 GCRYPT_ASM_CIPHERS and GCRYPT_ASM_DIGEST for --disable-asm
7426 selection.
7427
7428 Do not build poly1305-s390x.S on foreign architectures.
7429 + commit f10fa6b9a6ca7565408c4685d88a38893396d02b
7430 * configure.ac [host=s390x-*-*]: Add 'poly1305-s390x.lo'.
7431 * cipher/Makefile.am: Move 'poly1305-s390x.S' to
7432 'EXTRA_libcipher_la_SOURCES'.
7433
7434 jitterentropy: use wipememory for jent_memset_secure.
7435 + commit a44301f6d2051b6b4e20b4459f41aa2b95f8b2b7
7436 * random/jitterentropy-base-user.h (jent_memset_secure): Use wipememory.
7437
7438 jitterentropy: fix building on Win32.
7439 + commit c38ebc3b6c7d6844209a58677379b61750b6504d
7440 * random/jitterentropy.h (jent_notime_ctx): Add #ifdef
7441 JENT_CONF_ENABLE_INTERNAL_TIMER around pthread variables.
7442
7443 2021-11-18 NIIBE Yutaka <[email protected]>
7444
7445 tests: Remove tweak for FIPS enabled.
7446 + commit 1183ffdd7a242955c1cc34eef0b02c002202a9ec
7447 * tests/t-secmem.c (test_secmem): Remove the tweak.
7448
7449 jitternetropy: Put our local change to use non-secure memory.
7450 + commit 85cb7375fec39bb9fb195ca0bbe95bbbfd6deb98
7451 * random/jitterentropy-base.c (jent_entropy_collector_alloc_internal):
7452 Let jent_memaccess use normal memory.
7453
7454 build: Fix excess quotation to enable config.status --recheck works.
7455 + commit 17f9eb20c94fd6711370546437b7150dc11a6335
7456 * configure.ac (DEF_HMAC_BINARY_CHECK): Fix quatation.
7457
7458 random: Fix rndgetentropy correctly uses rndjent.
7459 + commit 5493282b4aacd6b466c4ddd366ce9eb4036b3562
7460 * random/rndgetentropy.c (_gcry_rndgetentropy_gather_random): Call
7461 _gcry_rndjent_poll for GCRY_VERY_STRONG_RANDOM.
7462
7463 2021-11-17 NIIBE Yutaka <[email protected]>
7464
7465 jitterentropy: Use jent_read_entropy_safe for rndjent.
7466 + commit 2101da04924b1361e2a1021b406a519a3bde9aee
7467 * random/rndjent.c (_gcry_rndjent_poll): Use jent_read_entropy_safe.
7468
7469 Fix jent_read_entropy for JENT_CPU_JITTERENTROPY_SECURE_MEMORY.
7470 + commit d0fcb4da98a05097bc0cd6dc7377cb02aaa8b61c
7471 * random/jitterentropy-base.c (jent_read_entropy): Fix conditional
7472 compile.
7473
7474 jitterentropy: Fix for C90 compiler.
7475 + commit cf85258e6aff87f5b0614097b4ff2972ceb703fd
7476 * random/jitterentropy-noise.c (jent_hash_time): Declare hash_loop_cnt
7477 at the beginning of the function.
7478
7479 jitterentropy: Disable use of pthread.
7480 + commit 964c9c5eee30cc45488b88ec4c0199a41861e4aa
7481 * random/jitterentropy.h (JENT_CONF_ENABLE_INTERNAL_TIMER): Undefine.
7482 * random/jitterentropy-base.c [JENT_CONF_ENABLE_INTERNAL_TIMER]
7483 (jent_entropy_switch_notime_impl): Add conditional compilation.
7484 * random/jitterentropy-base-user.h [JENT_CONF_ENABLE_INTERNAL_TIMER]
7485 (jent_yield): Likewise.
7486 * random/jitterentropy.h [JENT_CONF_ENABLE_INTERNAL_TIMER]
7487 (jent_entropy_switch_notime_impl): Likewise.
7488
7489 jitterentropy: Fix building rndjent.
7490 + commit d5ae5229db70f71301a3f3eefdd38a73a4fde499
7491 * random/Makefile.am: Update for new jitterentropy.
7492 * random/rndjent.c: Update to include the other files.
7493
7494 jitterentropy: Merge from jitterentropy-library-3.3.0.
7495 + commit 3bacdac611b9eb3bd5ae8d78156b1110e77e9518
7496 * random/jitterentropy-base.h: New.
7497 * random/jitterentropy-gcd.c: New.
7498 * random/jitterentropy-gcd.h: New.
7499 * random/jitterentropy-health.c: New.
7500 * random/jitterentropy-health.h: New.
7501 * random/jitterentropy-noise.c: New.
7502 * random/jitterentropy-noise.h: New.
7503 * random/jitterentropy-sha3.c: New.
7504 * random/jitterentropy-sha3.h: New.
7505 * random/jitterentropy-timer.c: New.
7506 * random/jitterentropy-timer.h: New.
7507 * random/jitterentropy-base.c: Update.
7508 * random/jitterentropy.h: Update.
7509 * random/jitterentropy-base-user.h: Update, keeping ours mostly.
7510
7511 2021-11-15 Jussi Kivilinna <[email protected]>
7512
7513 Add intel-pclmul accelerated POLYVAL for GCM-SIV.
7514 + commit 5e0187d84fc16d9ff0fbb0ccd4348657fea90d36
7515 * cipher/cipher-gcm-intel-pclmul.c (gfmul_pclmul_aggr4)
7516 (gfmul_pclmul_aggr8): Move assembly to new GFMUL_AGGRx_ASM* macros.
7517 (GFMUL_AGGR4_ASM_1, GFMUL_AGGR4_ASM_2, gfmul_pclmul_aggr4_le)
7518 (GFMUL_AGGR8_ASM, gfmul_pclmul_aggr8_le)
7519 (_gcry_polyval_intel_pclmul): New.
7520 * cipher/cipher-gcm-siv.c (do_polyval_buf): Use polyval function
7521 if available.
7522 * cipher/cipher-gcm.c (_gcry_polyval_intel_pclmul): New.
7523 (setupM): Setup 'c->u_mode.gcm.polyval_fn' with accelerated polyval
7524 function if available.
7525 * cipher/cipher-internal.h (gcry_cipher_handle): Add member
7526 'u_mode.gcm.polyval_fn'.
7527
7528 2021-11-15 NIIBE Yutaka <[email protected]>
7529
7530 random: Include getentropy random module.
7531 + commit ec671cfa239888b67fcafda40b19006b61d9bbf2
7532 * random/rand-internal.h (_gcry_rndgetentropy_gather_random): Add.
7533 * random/random-csprng.c [USE_RNDLINUX] (_gcry_rngcsprng_close_fds)
7534 (getfnc_gather_random): Support getentropy random module.
7535 * random/random-drbg.c: Likewise.
7536 * random/random-fips.c: Likewise.
7537 * random/random-system.c: Likewise.
7538 * src/global.c [USE_RNDLINUX] (print_config): Show getentropy.
7539
7540 build: Support rndgetentropy random module.
7541 + commit e562e34c824dda9ce1c4a0af58e8366699a3d88b
7542 * configure.ac: Add getentropy random module.
7543 * random/Makefile.am (EXTRA_librandom_la_SOURCES): Add.
7544
7545 random:getentropy: Simplify more.
7546 + commit 6de43f11c625de381e75f01ce83cbb2d2634fb35
7547 * random/rndgetentropy.c (_gcry_rndgetentropy_gather_random): Remove
7548 'if'.
7549
7550 random:getentropy: Limit the size of buffer in exact size.
7551 + commit cebe5c78a9493c7b4ee894305c0ede0899815e6a
7552 * random/rndgetentropy.c (_gcry_rndgetentropy_gather_random):
7553 Redundant space had no sense.
7554
7555 random: Simplify rndgetentropy.
7556 + commit a8395fd7a40f4d9a8f57154a28cd1cae97e708f2
7557 * random/rndgetentropy.c (_gcry_rndgetentropy_gather_random): Simply
7558 call getentropy.
7559
7560 random: Start rnd-getentropy.c.
7561 + commit f36bfe7ec1b2cef7760aa338292fadb93783ced4
7562 * random/rnd-getentropy.c: Copied from rndlinux.c.
7563
7564 2021-11-11 NIIBE Yutaka <[email protected]>
7565
7566 tests:pkcs1v2: Skip tests with small keys in FIPS mode.
7567 + commit 1481607cb9db977468a75f9f4638dc1cf3ade007
7568 * tests/pkcs1v2.c (in_fips_mode): New.
7569 (check_oaep): Skip when key size is less than 2048 in FIPS mode.
7570 (check_pss, check_v15crypt, check_v15sign): Likewise.
7571
7572 tests:pubkey: Replace RSA key to one of 2k.
7573 + commit 66119e0c1a024f7cf059393c3db827eb338339b0
7574 * tests/pubkey.c (sample_private_key_1): Use 2k key from basic.c.
7575 (sample_private_key_1_1): Likewise.
7576 (sample_private_key_1_2): Likewise.
7577
7578 2021-11-09 Jakub Jelen <[email protected]>
7579
7580 tests: Benchmark also larger RSA keys in FIPS mode.
7581 + commit 2a899b5b84583f2e68bd8564034aa10846810e85
7582 * tests/benchmark.c (rsa_bench): Test also large RSA keys in FIPS mode
7583
7584 tests: Explicit FIPS checking for symmetric algorithms.
7585 + commit fb931073707ed521366f0e4a2e54b3935ce649a3
7586 * tests/basic.c (FLAG_CFB8): New.
7587 (check_ecb_cipher): Introduce new flag and explicitly check for
7588 algorithm functionality in regards to FIPS.
7589 (check_ctr_cipher): Ditto.
7590 (check_cfb_cipher): Replace the cfb8 flag with generic flag and
7591 explicitly check for algorithm funcionality in regards to FIPS.
7592 (check_ofb_cipher): Introduce new flag and explicitly check for
7593 algorithm functionality in regards to FIPS.
7594 (_check_poly1305_cipher): Explicitly check functionality in regards to
7595 FIPS mode.
7596 (check_ccm_cipher): Introduce new flag and explicitly check for
7597 algorithm functionality in regards to FIPS.
7598 (check_gost28147_cipher_basic): Explicitly check functionality in
7599 regards to FIPS mode.
7600 (check_stream_cipher_large_block): Explicitly check functionality in
7601 regards to FIPS mode.
7602
7603 2021-11-08 NIIBE Yutaka <[email protected]>
7604
7605 dsa: Add checks in FIPS mode.
7606 + commit df66bd94e6e3650216b0d179d79d4c296f173855
7607 * cipher/dsa.c (dsa_check_keysize): New.
7608 (generate_fips186): Add call to dsa_check_keysize.
7609 (dsa_sign, dsa_verify): Likewise.
7610 * tests/benchmark.c (dsa_bench): Skip 1024-bit.
7611 * tests/dsa-rfc6979.c (check_dsa_rfc6979): 1024-bit
7612 now fails.
7613 * tests/fips186-dsa.c (main): Only test check_dsa_gen_186_3 in FIPS
7614 mode.
7615
7616 2021-11-08 Jakub Jelen <[email protected]>
7617
7618 tests: Add 2k RSA key working in FIPS mode.
7619 + commit 1f45fec2082247f3634af050f1fdbf0a5858cf46
7620 * tests/basic.c (check_pubkey): The 1k RSA keys are no longer supposed
7621 to be working so have a new 2k one that should work. Taken from
7622 ciper/rsa.c's sample_secret_key.
7623
7624 2021-11-08 Jakub Jelen <[email protected]>
7625 NIIBE Yutaka <[email protected]>
7626
7627 rsa: Check keylen constraints for key operations.
7628 + commit 40d63d09b2d06631f4d2c3d1b167a620d50c99f8
7629 * cipher/rsa.c (rsa_check_keysize): New.
7630 (generate_fips): Factor out the bits check.
7631 (rsa_encrypt): Add checking key length.
7632 (rsa_decrypt, rsa_sign, rsa_verify): Likewise.
7633
7634 2021-11-08 NIIBE Yutaka <[email protected]>
7635 NIIBE Yutaka <[email protected]>
7636
7637 tests: Expect errors from algorithms not supported in FIPS mode.
7638 + commit cc3571a1f2244bdf829d7d16dd546131711eb8a9
7639 * tests/basic.c (FLAG_NOFIPS): New.
7640 (check_pubkey_sign): Pass and handle NOFIPS flag.
7641 (check_pubkey_sign_ecdsa): Likewise.
7642 (check_pubkey_crypt): Likewise.
7643 (do_check_one_pubkey): Pass flags.
7644 (check_pubkey): Mark explicitly algorithms expected not to work in
7645 FIPS mode and make sure they fail.
7646
7647 2021-11-08 NIIBE Yutaka <[email protected]>
7648
7649 tests: Fix basic.c:check_pubkey.
7650 + commit 1b29be8e7e49a6ee04734b86db5732dc3eaca84b
7651 * tests/basic.c (check_pubkey): Don't call check_one_pubkey_new
7652 multiple times.
7653
7654 2021-11-08 Jakub Jelen <[email protected]>
7655
7656 cipher: Respect the disabled flag of pubkey algorithms.
7657 + commit ff5ab6a809345112f02a6037957ef21bc4bf3bce
7658 * cipher/pubkey.c (check_pubkey_algo): Check the disabled flag before
7659 using the algorithm.
7660
7661 2021-11-05 Jakub Jelen <[email protected]>
7662
7663 doc: Reference the new FIPS 140-3.
7664 + commit 976673425784eb2d056a4dbbe13b6d2ca5f8cbf2
7665 * doc/gcrypt.texi: Replace -2 with -3
7666 * cipher/ecc-curves.c: Replace -2 with -3
7667
7668 2021-11-01 NIIBE Yutaka <[email protected]>
7669
7670 cipher:md: Check digest algo is supported when FIPS enabled.
7671 + commit cfd1dd6a838f70324a749dad0d589bc2dbe33651
7672 * cipher/md.c (_gcry_md_hash_buffer): Check for FIPS for
7673 hash_buffers method case.
7674 (_gcry_md_hash_buffers_extract): Likewise.
7675
7676 2021-10-29 NIIBE Yutaka <[email protected]>
7677
7678 mpi: Allow opaque MPI with zero length.
7679 + commit 34d55589b7d91a239435d77e3d45cf0deeba59b6
7680 * mpi/mpiutil.c (_gcry_mpi_copy): Support zero length.
7681
7682 2021-10-25 Jussi Kivilinna <[email protected]>
7683
7684 tests/bench-slope: avoid divide by zero.
7685 + commit ecd4d348ac87c073ced38eb1e6dbec03b532cdf2
7686 * tests/bench-slope.c (safe_div): New.
7687 (get_slope): Make static; Skip if number of points is too small; Use
7688 safe_div.
7689 (do_slope_benchmark): Retry benchmark if result does not make sense;
7690 Limit retries to 4 for non-auto-ghz and 1000 for auto-ghz.
7691 (get_auto_ghz, do_slope_benchmark, bench_print_result_csv)
7692 (bench_print_result_std): Use safe_div.
7693
7694 md: clear context with wipememory to avoid false warning.
7695 + commit 5881114e08601745857a68bc3318f3421155f645
7696 * cipher/md.c (md_open): Initialize ctx with wipememory2 instead
7697 of memset.
7698
7699 cipher/sha512: fix 'accessing 64 bytes in a region of size 8' warnings.
7700 + commit 6333cdeee5c1ca5bd4255f9cdcd266db314a2122
7701 * cipher/sha512.c (SHA512_STATESHA256_CONTEXT): Replace h0-h7 with h[8].
7702 (do_sha512_transform_i386_ssse3, do_sha512_transform_ppc8)
7703 (do_sha512_transform_ppc9, do_sha512_transform_s390x)
7704 (do_sha512_final_s390x, sha512_init, sha384_init, sha512_256_init)
7705 (sha512_224_init, do_transform_generic, sha512_final): Convert use
7706 of h0-h7 to h[0]-h[7].
7707
7708 poly1305: fix building with 'arm-linux-gnueabihf-gcc-11 -O3'
7709 + commit e4ce7ad0ecf6c356fa377e139d08c4dbcf6bf533
7710 * cipher/poly1305.c [HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS]
7711 (ADD_1305_32): Reduce number of register operands.
7712
7713 2021-10-20 NIIBE Yutaka <[email protected]>
7714
7715 cipher: Reject SHA-1 for hash+sign/verify when FIPS enabled.
7716 + commit a23cf78102f3200dc441a3123c3fbeaa28f38b50
7717 * cipher/pubkey.c (_gcry_pk_sign_md): Reject SHA-1 when FIPS.
7718 (_gcry_pk_verify_md): Likewise.
7719
7720 2021-10-15 NIIBE Yutaka <[email protected]>
7721
7722 doc: Add entries for hash+sign functions.
7723 + commit 8f31f652d453f480d4d2559dfa17e7bd42145a49
7724
7725
7726 2021-10-15 Jakub Jelen <[email protected]>
7727
7728 fips: Improve selftests invocation.
7729 + commit d45db4ad16fec0fe7d32aae60f356a386fbf909b
7730 * src/fips.c (run_digest_selftests): Skip SHA256 selftest if they were
7731 already executed as part of the integrity check.
7732 (run_mac_selftests): Skip HMAC-SHA256 selftest if they were already
7733 executed as part of the integrity check.
7734 (run_hmac_sha256_selftests): Run SHA256 selftest too.
7735 (_gcry_fips_run_selftests): Run the sha256 selftests regardless of the
7736 fips mode status.
7737
7738 2021-10-14 Jakub Jelen <[email protected]>
7739
7740 fips: Verify library integrity before running selftests.
7741 + commit d2c68849d19bd0ed4c8c3c040c5939737aa15981
7742 * src/fips.c (run_hmac_sha256_selftests): New function.
7743 (_gcry_fips_run_selftests): Move integrity check earlier and run
7744 HMAC-SHA256 tests before that.
7745
7746 cipher: Allow generation of RSA keys > 2k.
7747 + commit bba63fab1a22232e494d3de93d74280d300faf8d
7748 * cipher/rsa.c (generate_fips): Allow any larger key than 2k in FIPS
7749 mode.
7750
7751 2021-10-12 NIIBE Yutaka <[email protected]>
7752
7753 build: Support specifying HMAC key by --enable-hmac-binary-check.
7754 + commit 10e02b90f65f3a85d72a719806b9d8873377c1a4
7755 * configure.ac (DEF_HMAC_BINARY_CHECK): New SUBSTITUTION.
7756 (DL_LIBS): Fix the condition.
7757 * src/Makefile.am (libgcrypt_la_CFLAGS): Use DEF_HMAC_BINARY_CHECK.
7758 (hmac256_CFLAGS): Likewise.
7759
7760 2021-10-11 NIIBE Yutaka <[email protected]>
7761
7762 build: Use KEY_FOR_BINARY_CHECK for --enable-hmac-binary-check.
7763 + commit 0709359657633271c8c018d67b40d9052c630022
7764 * src/fips.c (KEY_FOR_BINARY_CHECK): Allow supplying externally.
7765 * src/hmac256.c: Use KEY_FOR_BINARY_CHECK macro.
7766
7767 2021-10-08 Jussi Kivilinna <[email protected]>
7768
7769 cipher/sha256: fix 'accessing 32 bytes in a region of size 4' warnings.
7770 + commit 95425c6b0b96a4d2eae4e2a55a23d293b08f7993
7771 * cipher/sha256.c (SHA256_CONTEXT): Replace h0-h7 with h[8].
7772 (do_sha256_transform_amd64_ssse3, do_sha256_transform_amd64_avx)
7773 (do_sha256_transform_amd64_avx2, do_sha256_transform_intel_shaext)
7774 (do_sha256_transform_armv8_ce, do_sha256_transform_ppc8)
7775 (do_sha256_transform_ppc9, do_sha256_transform_s390x)
7776 (do_sha256_final_s390x, sha256_init, sha224_init)
7777 (do_transform_generic, sha256_final): Convert use of h0-h7 to h[0]-h[7].
7778
7779 2021-10-07 NIIBE Yutaka <[email protected]>
7780
7781 cipher: Add sign+hash, verify+hash, and random-override API.
7782 + commit 082ea0efa9b129e8ca7703eeb6b1c9325caeedfd
7783 * cipher/pubkey.c (_gcry_pk_sign_md, _gcry_pk_verify_md): New.
7784 (_gcry_pk_random_override_new): New.
7785 (_gcry_pk_get_random_override): New.
7786 * src/gcrypt-int.h: Add those routines.
7787 * src/context.h (CONTEXT_TYPE_RANDOM_OVERRIDE): New.
7788 * src/context.c (_gcry_ctx_alloc, _gcry_ctx_release): Handle
7789 CONTEXT_TYPE_RANDOM_OVERRIDE.
7790 * src/gcrypt.h.in (gcry_error_t gcry_pk_hash_sign): New.
7791 (gcry_error_t gcry_pk_hash_verify): New.
7792 (gcry_pk_random_override_new): New.
7793 * src/libgcrypt.def, src/libgcrypt.vers: Update.
7794 * src/visibility.c (gcry_pk_hash_sign, gcry_pk_hash_verify): New.
7795 (gcry_pk_random_override_new): New.
7796 * src/visibility.h: Add those routines.
7797
7798 cipher:dsa,ecdsa: Support supplying K externally.
7799 + commit 16a9eaad5d1add3a95b1da6e037b074f18b094c7
7800 * cipher/dsa.c (sign): Add an argument K for DSA.
7801 (test_keys, dsa_sign): Follow the change.
7802 * cipher/ecc-common.h (_gcry_ecc_ecdsa_sign): Likewise for ECDSA.
7803 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_sign): Likewise for ECDSA.
7804 * cipher/ecc.c (test_keys, ecc_sign): Follow the change.
7805 * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi): Support "label"
7806 for K.
7807
7808 2021-10-06 Jussi Kivilinna <[email protected]>
7809
7810 Fix building for Win64 target.
7811 + commit 9fc0d145278d46bb129660a57b7ca2f94577d461
7812 * random/random-csprng.c [HAVE_W32_SYSTEM]: Include <windows.h>.
7813 * tests/bench-slope.c [_WIN32]: Include <windows.h>.
7814
7815 2021-10-05 NIIBE Yutaka <[email protected]>
7816
7817 build,gcrypt.h: Don't define gcry_socklen_t.
7818 + commit 71d4d592d8910ea6f9e091ae578cf68907cb5758
7819 * configure.ac (FALLBACK_SOCKLEN_T): Remove.
7820 * src/gcrypt.h.in: Remove FALLBACK_SOCKLEN_T.
7821
7822 build,gcrypt.h: Remove INSERT_SYS_SELECT_H.
7823 + commit 0f43570af93e56bdd4a4b2bf6eef722d0bff4a4f
7824 * configure.ac (INSERT_SYS_SELECT_H): Remove.
7825 Remove checking sys/select.h.
7826 * src/gcrypt.h.in: Remove INSERT_SYS_SELECT_H.
7827
7828 2021-10-05 NIIBE Yutaka <[email protected]>
7829 Tomáš Mráz <[email protected]>
7830
7831 random: Use poll instead of select.
7832 + commit 7da42a8e8cc587ced46dffefc8448c8a286b1ca0
7833 * random/rndlinux.c (open_device): Use poll.
7834 (_gcry_rndlinux_gather_random): Use poll.
7835
7836 2021-09-27 Werner Koch <[email protected]>
7837
7838 tests: Remove old CAVS test scripts.
7839 + commit db928d97b4b69f9aa1fee3c2a38a138534608c89
7840 * tests/cavs_driver.pl: Remove.
7841 * tests/cavs_tests.sh: Remove
7842 * tests/Makefile.am: (EXTRA_DIST): Remove them.
7843
7844 2021-09-27 NIIBE Yutaka <[email protected]>
7845
7846 libtool: Link without -flat_namespace for macOS.
7847 + commit c9cebf3d1824d6ec90fd864a744bb81c97ac7d31
7848 * m4/libtool.m4: Not setting 10.0 to MACOSX_DEPLOYMENT_TARGET when not
7849 defined. Only specify -flat_namespace to linker for specific
7850 (older) versions and hosts.
7851
7852 2021-09-24 NIIBE Yutaka <[email protected]>
7853
7854 build: Add hmac256.h to distribution.
7855 + commit 9511f469363b629a06e1f3dab6ee4ba333e72b93
7856 * src/Makefile.am (hmac256_SOURCES): Add hmac256.h.
7857
7858 2021-09-20 Jakub Jelen <[email protected]>
7859
7860 Allow passing FIPS module version.
7861 + commit c74fde0c3f6114c594332fb28a09c7b817969231
7862 * README: Document new --with-fips-module-version=version switch
7863 * configure.ac: Implementation of the --with-fips-module-version
7864 * src/global.c (print_config): Print FIPS module version from above
7865
7866 Remove the forced fips mode.
7867 + commit 3f4dd47ba74e0a9f18feba1809eeddff8790707e
7868 * cipher/rsa.c (generate_fips): Drop reference to enforced fips mode and
7869 use normal FIPS mode check
7870 * doc/gcrypt.texi: Drop references to enforced FIPS mode
7871 * src/fips.c (enforced_fips_mode): Removed
7872 (_gcry_initialize_fips_mode): Remove reading of the FIPS_FORCE_FILE
7873 to enforce FIPS mode
7874 (_gcry_enforced_fips_mode): Remove
7875 (_gcry_set_enforced_fips_mode): Remove
7876 * src/g10lib.h (_gcry_enforced_fips_mode): Remove declaration
7877 (_gcry_set_enforced_fips_mode): Remova declaration
7878 * src/global.c (print_config): Remove the forced fips flag
7879 (_gcry_vcontrol): Deprecate GCRYCTL_SET_ENFORCED_FIPS_FLAG
7880 (get_no_secure_memory): Ignore the option in FIPS mode
7881
7882 Remove a way to inactive FIPS mode.
7883 + commit edbc1dd10bc3e1fcc0e355fe1a9c4c8769f51daf
7884 * cipher/md.c (_gcry_md_hash_buffer): Remove inactivation of FIPS mode
7885 when MD5 is used
7886 (_gcry_md_hash_buffers_extract): Ditto.
7887 * src/fips.c (gcry_is_fips_mode_inactive): Removed
7888 (_gcry_inactivate_fips_mode): Removed
7889 (_gcry_is_fips_mode_inactive): Removed
7890 * src/g10lib.h (_gcry_inactivate_fips_mode): Remove declaration
7891 (_gcry_is_fips_mode_inactive): Remove declaration
7892 * global.c (_gcry_vcontrol): Update the GCRYCTL_FIPS_MODE_P
7893 (_gcry_set_allocation_handler): Silently ignore custom alocation
7894 handlers in FIPS mode
7895
7896 2021-09-16 Jakub Jelen <[email protected]>
7897
7898 tests: Improve FIPS detection in curves test.
7899 + commit fd116968ef2dcecb4058be2b2b3e8ab90f1e3181
7900 * tests/curves.c (check_matching): When FIPS mode enabled, skip a test
7901 with sample_key_2, which uses brainpoolP160r1 curve.
7902 (check_get_params): Replace "error_expected" filed to "flags" to hold
7903 TEST_ERROR_EXPECTED and/or TEST_NOFIPS. Put TEST_NOFIPS flags for
7904 non-FIPS curves. When FIPS mode enabled, don't skip supported curves.
7905
7906 tests: Fix typo in comment.
7907 + commit f9ae351c954c01a382c8ac915298efa25fc45177
7908 * tests/curves.c: Typo in comment
7909
7910 2021-09-14 NIIBE Yutaka <[email protected]>
7911
7912 cipher: Fix support of sha512-224 and sha512-256.
7913 + commit d04b1be9edacd7be6f03faba6f4d6c44c4247eb7
7914 * cipher/pubkey-util.c (get_hash_algo): Add.
7915
7916 * cipher/sha512.c (sha512_256_asn, sha512_224_asn): Fill correct values.
7917
7918 cipher: Support internal hashing with "prehash" for RSA PKCS#1.
7919 + commit 422031a5943f2e698036e3c0df5955c585f22c16
7920 * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi): Support internal
7921 hashing.
7922
7923 2021-09-13 Werner Koch <[email protected]>
7924
7925 cipher: Clear AESWRAP scratch area immediately after use.
7926 + commit df4fe02794bb3511f7006d641e99736bad091c58
7927 * cipher/cipher-aeswrap.c (_gcry_cipher_aeswrap_decrypt): Call
7928 wipememory.
7929
7930 2021-08-26 Jussi Kivilinna <[email protected]>
7931
7932 Add ARMv8-CE HW acceleration for GCM-SIV counter mode.
7933 + commit 47e425e07995454573e28c13c08229d2f8a75642
7934 * cipher/rijndael-armv8-aarch32-ce.S
7935 (_gcry_aes_ctr32le_enc_armv8_ce): New.
7936 * cipher/rijndael-armv8-aarch64-ce.S
7937 (_gcry_aes_ctr32le_enc_armv8_ce): New.
7938 * cipher/rijndael-armv8-ce.c
7939 (_gcry_aes_ctr32le_enc_armv8_ce)
7940 (_gcry_aes_armv8_ce_ctr32le_enc): New.
7941 * cipher/rijndael.c
7942 (_gcry_aes_armv8_ce_ctr32le_enc): New prototype.
7943 (do_setkey): Add setup of 'bulk_ops->ctr32le_enc' for ARMv8-CE.
7944
7945 Add x86 HW acceleration for GCM-SIV counter mode.
7946 + commit 33aebb30d210768d510a2843d9cc0c0ecd4237d1
7947 * cipher/cipher-gcm-siv.c (do_ctr_le32): Use bulk function if
7948 available.
7949 * cipher/cipher-internal.h (cipher_bulk_ops): Add 'ctr32le_enc'.
7950 * cipher/rijndael-aesni.c (_gcry_aes_aesni_ctr32le_enc): New.
7951 * cipher/rijndael-vaes-avx2-amd64.S
7952 (_gcry_vaes_avx2_ctr32le_enc_amd64, .Lle_addd_*): New.
7953 * cipher/rijndael-vaes.c (_gcry_vaes_avx2_ctr32le_enc_amd64)
7954 (_gcry_aes_vaes_ctr32le_enc): New.
7955 * cipher/rijndael.c (_gcry_aes_aesni_ctr32le_enc)
7956 (_gcry_aes_vaes_ctr32le_enc): New prototypes.
7957 (do_setkey): Add setup of 'bulk_ops->ctr32le_enc' for AES-NI and
7958 VAES.
7959 * tests/basic.c (check_gcm_siv_cipher): Add large test-vector for
7960 bulk ops testing.
7961
7962 Add AES-GCM-SIV mode (RFC 8452)
7963 + commit 1b8994c4ecf2cb53fff46fa84a95a7c259e7cec7
7964 * cipher/Makefile.am: Add 'cipher-gcm-siv.c'.
7965 * cipher/cipher-gcm-siv.c: New.
7966 * cipher/cipher-gcm.c (_gcry_cipher_gcm_setupM): New.
7967 * cipher/cipher-internal.h (gcry_cipher_handle): Add 'siv_keylen'.
7968 (_gcry_cipher_gcm_setupM, _gcry_cipher_gcm_siv_encrypt)
7969 (_gcry_cipher_gcm_siv_decrypt, _gcry_cipher_gcm_siv_set_nonce)
7970 (_gcry_cipher_gcm_siv_authenticate)
7971 (_gcry_cipher_gcm_siv_set_decryption_tag)
7972 (_gcry_cipher_gcm_siv_get_tag, _gcry_cipher_gcm_siv_check_tag)
7973 (_gcry_cipher_gcm_siv_setkey): New prototypes.
7974 (cipher_block_bswap): New helper function.
7975 * cipher/cipher.c (_gcry_cipher_open_internal): Add
7976 'GCRY_CIPHER_MODE_GCM_SIV'; Refactor mode requirement checks for
7977 better size optimization (check pointers & blocksize in same order
7978 for all).
7979 (cipher_setkey, cipher_reset, _gcry_cipher_setup_mode_ops)
7980 (_gcry_cipher_setup_mode_ops, _gcry_cipher_info): Add GCM-SIV.
7981 (_gcry_cipher_ctl): Handle 'set decryption tag' for GCM-SIV.
7982 * doc/gcrypt.texi: Add GCM-SIV.
7983 * src/gcrypt.h.in (GCRY_CIPHER_MODE_GCM_SIV): New.
7984 (GCRY_SIV_BLOCK_LEN, gcry_cipher_set_decryption_tag): Add to comment
7985 that these are also for GCM-SIV in addition to SIV mode.
7986 * tests/basic.c (check_gcm_siv_cipher): New.
7987 (check_cipher_modes): Check for GCM-SIV.
7988 * tests/bench-slope.c (bench_gcm_siv_encrypt_do_bench)
7989 (bench_gcm_siv_decrypt_do_bench, bench_gcm_siv_authenticate_do_bench)
7990 (gcm_siv_encrypt_ops, gcm_siv_decrypt_ops)
7991 (gcm_siv_authenticate_ops): New.
7992 (cipher_modes): Add GCM-SIV.
7993 (cipher_bench_one): Check key length requirement for GCM-SIV.
7994
7995 Add SIV mode (RFC 5297)
7996 + commit 659a208cb065d686f60e2c4f51856f460d6b44f5
7997 * cipher/Makefile.am: Add 'cipher-siv.c'.
7998 * cipher/cipher-ctr.c (_gcry_cipher_ctr_encrypt): Rename to
7999 _gcry_cipher_ctr_encrypt_ctx and add algo context parameter.
8000 (_gcry_cipher_ctr_encrypt): New using _gcry_cipher_ctr_encrypt_ctx.
8001 * cipher/cipher-internal.h (gcry_cipher_handle): Add 'u_mode.siv'.
8002 (_gcry_cipher_ctr_encrypt_ctx, _gcry_cipher_siv_encrypt)
8003 (_gcry_cipher_siv_decrypt, _gcry_cipher_siv_set_nonce)
8004 (_gcry_cipher_siv_authenticate, _gcry_cipher_siv_set_decryption_tag)
8005 (_gcry_cipher_siv_get_tag, _gcry_cipher_siv_check_tag)
8006 (_gcry_cipher_siv_setkey): New.
8007 * cipher/cipher-siv.c: New.
8008 * cipher/cipher.c (_gcry_cipher_open_internal, cipher_setkey)
8009 (cipher_reset, _gcry_cipher_setup_mode_ops, _gcry_cipher_info): Add
8010 GCRY_CIPHER_MODE_SIV handling.
8011 (_gcry_cipher_ctl): Add GCRYCTL_SET_DECRYPTION_TAG handling.
8012 * doc/gcrypt.texi: Add documentation for SIV mode.
8013 * src/gcrypt.h.in (GCRYCTL_SET_DECRYPTION_TAG): New.
8014 (GCRY_CIPHER_MODE_SIV): New.
8015 (gcry_cipher_set_decryption_tag): New.
8016 * tests/basic.c (check_siv_cipher): New.
8017 (check_cipher_modes): Add call for 'check_siv_cipher'.
8018 * tests/bench-slope.c (bench_encrypt_init): Use double size key for
8019 SIV mode.
8020 (bench_aead_encrypt_do_bench, bench_aead_decrypt_do_bench)
8021 (bench_aead_authenticate_do_bench): Reset cipher context on each run.
8022 (bench_aead_authenticate_do_bench): Support nonce-less operation.
8023 (bench_siv_encrypt_do_bench, bench_siv_decrypt_do_bench)
8024 (bench_siv_authenticate_do_bench, siv_encrypt_ops)
8025 (siv_decrypt_ops, siv_authenticate_ops): New.
8026 (cipher_modes): Add SIV mode benchmarks.
8027 (cipher_bench_one): Restrict SIV mode testing to 16 byte block-size.
8028
8029 mpi/longlong: fix variable shadowing from MIPS umul_ppmm macros.
8030 + commit 9e3b0446653fda6912e91fae84883cdbefdc2195
8031 * mpi/longlong.h [__mips__ && W_TIPE_SIZE == 32] (umul_ppmm): Rename
8032 temporary variable '_r' to '__r'.
8033 [__mips && W_TIPE_SIZE == 64] (umul_ppmm): Ditto.
8034
8035 2021-08-23 NIIBE Yutaka <[email protected]>
8036
8037 cipher: Use offsetof for allocation of gcry_md_context.
8038 + commit 581e04386d875672ba6c3fc4a4232ca72bc46c8c
8039 * cipher/md.c (md_open): Allocate exact space for the allocation and
8040 use offsetof for the calculation.
8041
8042 2021-08-19 NIIBE Yutaka <[email protected]>
8043
8044 hmac: Don't have the second implementation of hmac256.
8045 + commit c9acca865ba4abaa4443712f87fb8926fe7ad8b7
8046 * src/Makefile.am (libgcrypt_la_SOURCES): Remove hmac256.
8047 * cipher/mac-hmac.c (selftests_sha256): Remove the tests.
8048
8049 fips: Don't use gcry_check_version for integrity check any more.
8050 + commit c11788e5641be26371adc90f63e5a191cfc796f8
8051 * src/visibility.h [FIPS_FORCE_FILE]: Remove ifdef/endif.
8052
8053 fips: Use a .rodata1 section integrity check with hmac256.
8054 + commit f02dc5235e4751c57b16683ee9a8ef53014c6d13
8055 * src/fips.c (hmac256_check): New.
8056 (check_binary_integrity): Use hmac256_check.
8057
8058 build: Generate hash for integrity check with hmac256 (2).
8059 + commit 24aaded244a2b9427f2e90e4bf7adf086e0e0fef
8060 * src/Makefile.am (libgcrypt.la.done): Use the rodata1 section.
8061 * src/fips.c (_gcry_fips_run_selftests): Only enable
8062 check_binary_integrity by ENABLE_HMAC_BINARY_CHECK.
8063 [ENABLE_HMAC_BINARY_CHECK] (hmac_for_the_implementation): New.
8064 [ENABLE_HMAC_BINARY_CHECK] (check_binary_integrity): Use
8065 hmac_for_the_implementation in rodata.
8066
8067 2021-08-18 NIIBE Yutaka <[email protected]>
8068
8069 build: Generate hash for integrity check with hmac256.
8070 + commit 3c89aad4a0d7f836fd747d4e2f0edfbf648ae318
8071 * configure.ac [ENABLE_HMAC_BINARY_CHECK]: Check objcopy.
8072 (USE_HMAC_BINARY_CHECK): New Automake conditional.
8073
8074 * src/Makefile.am (libgcrypt.la.done): New target.
8075 [USE_HMAC_BINARY_CHECK] (libgcrypt.so.hmac): Compute the hash.
8076 [USE_HMAC_BINARY_CHECK] (libgcrypt.la.done): Add .hmac section.
8077
8078 hmac: Fix hmac256 command option handling.
8079 + commit 07c21dd7d134e6403c9ee4e09250ec577c9b2867
8080 * src/hmac256.c (main): Fix use of --stdkey.
8081
8082 cipher: Fix the order of fields of gcry_md_context.
8083 + commit cbbdc015bf522d4aff656ff0417b83144ab4bb2a
8084 * cipher/md.c (struct gcry_md_context): Fix for better memory usage.
8085
8086 2021-08-17 Jakub Jelen <[email protected]>
8087
8088 tests: Generating large-enough DSA keys works in FIPS mode.
8089 + commit 6e40fca726357f13790065a27e2a0b333129fc54
8090 The a93d678f previously added this condition, but the DSA key size
8091 changed since then to 2k, which is still allowed.
8092
8093 * tests/pubkey.c (get_dsa_key_with_domain_new): DSA keys still work in
8094 FIPS mode.
8095
8096 dsa: Drop dead code.
8097 + commit 564e51fde71116757cdb6bc813aacf481bb826ed
8098 * cipher/dsa.c (generate): This function is never called in FIPS mode
8099
8100 rsa: Do not allow 1024 RSA keys in FIPS mode.
8101 + commit 034055ffdca28602a40c4d0b5997173e8597af18
8102 Previously, the condition was in generate_std, which is never called in
8103 FIPS mode.
8104
8105 * cipher/rsa.c (generate_std): Remove dead code as FIPS is using
8106 'generate_fips'
8107 (generate_fips): Do not allow 1024 bit key generation
8108
8109 tests: Avoid confusing 'success' on error message.
8110 + commit 588b8bb6ef091db299ff2eade295d3119b62283a
8111 * tests/pubkey.c (get_dsa_key_with_domain_new): Remove bogus "success"
8112 on error.
8113
8114 2021-08-17 NIIBE Yutaka <[email protected]>
8115
8116 fips: Fix tests in fips mode and non-fips mode.
8117 + commit 2ae56abd0eb60d755509d82155f52263bf2e37e8
8118 * tests/t-secmem.c (test_secmem): Only tweak when FIPS enabled.
8119
8120 2021-08-16 NIIBE Yutaka <[email protected]>
8121
8122 tests: Skip tests when FIPS for keygrip computations.
8123 + commit 44c7c41af21c668826280abfee1257853020ba2d
8124 * tests/keygrip.c (check): Skip non-FIPS curves when FIPS.
8125 (main): Check if FIPS is enabled.
8126
8127 cipher: Raise an error for non-approved digests correctly.
8128 + commit acc1598ea891180660d1a531823a1b5385e7f4e6
8129 * cipher/md.c (md_enable): Remove check if it's enforced or not.
8130
8131 fips: Fix tests in fips mode.
8132 + commit 347817438990b7adf22dc71e4fb581e3232f03a7
8133 * src/global.c (_gcry_vcontrol): Don't check NO_SECURE_MEMORY for
8134 GCRYCTL_FIPS_MODE_P.
8135 * tests/t-secmem.c (test_secmem): Use smaller value.
8136
8137 2021-08-10 Jussi Kivilinna <[email protected]>
8138
8139 tests/bench-slope: allow non-FIPS ECC benchmarking in non-FIPS mode.
8140 + commit a5982e35088a382b49c0e95e9a87365202267601
8141 * tests/bench-slope.c (_ecc_bench): Check for 'in_fips_mode'.
8142
8143 2021-08-06 NIIBE Yutaka <[email protected]>
8144
8145 fips: Fix check_binary_integrity.
8146 + commit ca6797c5c5c61a0eae1f5aa82988d4870fe5edab
8147 * src/fips.c: Define FIPS_FORCE_FILE macro earlier.
8148 (check_binary_integrity): Use the address of gcry_check_version.
8149 * src/visibility.h [FIPS_FORCE_FILE] (gcry_check_version): Allow
8150 internal use of exported function.
8151
8152 2021-08-05 NIIBE Yutaka <[email protected]>
8153
8154 build: Update checking headers.
8155 + commit 538090d829483696de6342f2ea564b2e25d6a294
8156 * configure.ac (AC_CHECK_HEADERS): Remove sys/msg.h.
8157
8158 2021-08-03 NIIBE Yutaka <[email protected]>
8159
8160 tests: Fix values for DSA with larger key length.
8161 + commit 8bf9ade071b80c1141d4a76d1b51b9a235b8b340
8162 * tests/pubkey.c (get_dsa_key_with_domain_new): Update.
8163
8164 fips: Support LIBGCRYPT_FORCE_FIPS_MODE envvar.
8165 + commit 7ac72ebaf7f723203c5fe9befa249e9bcc78ee92
8166 * src/fips.c (_gcry_initialize_fips_mode): Check the
8167 environment variable LIBGCRYPT_FORCE_FIPS_MODE.
8168
8169 2021-07-29 Jakub Jelen <[email protected]>
8170
8171 tests: Verify unsupported KDF tests fail in FIPS mode.
8172 + commit 0ab4e8063729147fb9abd463055785aac831bf5c
8173 * tests/t-kdf.c (check_pbkdf2): Verify tests based on algorithms
8174 unsupported in FIPS mode fail.
8175
8176 cipher: Do not use of non-approved digests in FIPS mode.
8177 + commit 0f118c2dfb8e1236893c30a9b86e7e231c8e5758
8178 * cipher/md.c (md_enable): Block all non-approved digest algorithms, not
8179 only the MD5 and do not drop from FIPS mode if not enforced.
8180
8181 tests: Generating DSA from domain should fail in FIPS mode.
8182 + commit a93d678fa5a349600fabdce3fbe5919837cdc282
8183 * tests/pubkey.c (get_dsa_key_with_domain_new): Expect failure in FIPS
8184 mode
8185 (check_x931_derived_key): Simplify testing for FIPS mode.
8186 (main): Check for fips mode.
8187
8188 tests: Transient DSA keys work in FIPS mode.
8189 + commit 83893f3f77da986951be98306a82238c97522bc1
8190 * tests/pubkey.c (check_run): Enable tests with DSA transient keys which
8191 work in FIPS.
8192
8193 tests: Skip secmem overflow test in FIPS mode.
8194 + commit 6df523bfb095bf4c3d9dc6a0699fefcdfc6cd594
8195 * tests/t-secmem.c (main): Skip overflow tests in FIPS mode because they
8196 are fatal and there is no way to override the outofcore handler.
8197
8198 tests: Expect the 192b ECDSA tests to fail in fips mode.
8199 + commit d2a26b30b5dbfa7b26a606e5b2fe5c238ab1afa1
8200 * tests/dsa-rfc6979.c (check_dsa_rfc6979): Expect ECDSA 192b keys to
8201 fail in FIPS mode.
8202 (main): Detect FIPS mode.
8203
8204 tests: Expect curves 25519/448 to fail in FIPS mode.
8205 + commit 3026148331523ec7ca81031339b5629431cafa23
8206 * tests/t-cv25519.c (test_cv_hl): Expect the operation to fail in FIPS
8207 mode.
8208 (test_cv_x25519, test_it): Ditto.
8209 (main) Detect FIPS mode.
8210 * tests/t-ed25519.c (one_test): Expect the operation to fail in FIPS
8211 mode.
8212 (main) Detect FIPS mode.
8213 * tests/t-ed448.c (one_test): Expect the operation to fail in FIPS
8214 mode.
8215 (main) Detect FIPS mode.
8216 * tests/t-x448.c (test_cv_hl): Expect the operation to fail in FIPS
8217 mode.
8218 (test_cv_x448, test_cv): Ditto.
8219 (main) Detect FIPS mode.
8220
8221 tests: Skip unsupported mechanisms in FIPS mode.
8222 + commit 55dbac435c5ba31ef140f72ce997662e5f9fe55b
8223 * tests/bench-slope.c (cipher_bench_one): Skip GCM mode in FIPS mode
8224 (ecc_algo_fips_allowed): New function
8225 (_ecc_bench): Skip algorithms disabled in FIPS mode
8226 (main): Check for FIPS mode
8227 * tests/benchmark.c (cipher_bench): Skip GCM in FIPS mode
8228
8229 tests: Do not expect GCM work in FIPS.
8230 + commit f56a33df60dcce78c2b1aa5aeeee64549a26a0ce
8231 * tests/basic.c (check_one_cipher_core): Expect GCM ciphers to fail in
8232 FIPS mode
8233 (check_cipher_modes): Skip GCM ciphers tests as they fail quite late
8234 in gcry_cipher_gettag().
8235
8236 mac: Disable AES GMAC in FIPS mode.
8237 + commit aa1e9ebf8bdbe6ed27c8667dbe4e1a69713210a5
8238 * cipher/mac-gmac.c (_gcry_mac_type_spec_gmac_aes): Remove FIPS flag
8239
8240 2021-07-29 NIIBE Yutaka <[email protected]>
8241
8242 hwfeatures: Enable hardware support also in FIPS mode.
8243 + commit 70e6cec07d86332f1aaf7a69bec75c7138306f6a
8244 * src/hwfeatures.c (_gcry_detect_hw_features): Remove skipping in FIPS
8245 mode.
8246
8247 cipher: Support internal hashing for DSA and ECDSA signing.
8248 + commit 4a3e71403225bd60a96d6747a8141a268bedda78
8249 * cipher/dsa-common.c (_gcry_dsa_compute_hash): New.
8250 * cipher/pubkey-internal.h (_gcry_dsa_compute_hash): New.
8251 * cipher/dsa.c (verify): Add FLAGS and HASHALGO.
8252 (test_keys): Follow the change of verify API.
8253 (sign, verify): Support PUBKEY_FLAG_PREHASH flag to hash internally.
8254 (selftest_sign): Test with "prehash" flag.
8255 * cipher/ecc-common.h (_gcry_ecc_ecdsa_verify): Add FLAGS and
8256 HASHALGO.
8257 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_sign): Support
8258 PUBKEY_FLAG_PREHASH flag to hash internally.
8259 (_gcry_ecc_ecdsa_verify): Likewise.
8260 * cipher/ecc.c (test_keys): Follow the change of
8261 _gcry_ecc_ecdsa_verify API.
8262 (selftest_sign): Test with "prehash" flag.
8263 * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi): Support handling
8264 of "hash-algo" and "value" with "prehash" flag.
8265
8266 2021-07-23 NIIBE Yutaka <[email protected]>
8267
8268 cipher: Support internal hashing for RSA-PSS.
8269 + commit 877be1bf9df0b4e9aed9036db1592a64582a4bac
8270 * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi): Support
8271 "hash-algo" with "value" for internal hashing with RSA-PSS.
8272 * tests/basic.c (check_pubkey_sign): Add test cases.
8273
8274 cipher: Extend RSA-PSS internal function for verify, too.
8275 + commit 285b4cb70df1553c60fb5da6c94e1106694d4f9e
8276 * cipher/pubkey-internal.h (_gcry_rsa_pss_verify): Support internal
8277 hashing.
8278 * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi): Use opaque MPI for
8279 RSA-PSS.
8280 * cipher/rsa-common.c (_gcry_rsa_pss_verify): Support internal
8281 hashing.
8282 * cipher/rsa.c (rsa_verify): Allow opaque MPI for RSA-PSS.
8283
8284 cipher: Extend RSA-PSS internal function.
8285 + commit 51307b1ceaa752d5a737b06ab0217d310faea403
8286 * cipher/pubkey-internal.h (_gcry_rsa_pss_encode): Change the API.
8287 * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi): Follow the change.
8288 * cipher/rsa-common.c (_gcry_rsa_pss_encode): Support internal hashing.
8289
8290 cipher: Check by caller instead, not by callee for RSA-PSS.
8291 + commit 652e115e10f2bd53d1e1fbe161c2528f4ca89012
8292 * cipher/pubkey-internal.h (_gcry_rsa_pss_encode): Change the API.
8293 * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi): Before the call to
8294 _gcry_rsa_pss_encode, check the condition here, raise GPG_ERR_INV_ARG
8295 if it's not good.
8296 * cipher/rsa-common.c (_gcry_rsa_pss_encode): No check inside.
8297
8298 2021-07-15 NIIBE Yutaka <[email protected]>
8299
8300 hmac: Use xfree.
8301 + commit db9f7abb7af7b5c5bc2ec356c614a5cdb88d75a6
8302 * src/hmac256.c [STANDALONE] (xfree): Define.
8303 (_gcry_hmac256_new, _gcry_hmac256_release): Use xfree.
8304 (_gcry_hmac256_file): Likewise.
8305
8306 2021-07-07 Jussi Kivilinna <[email protected]>
8307
8308 tests/basic: use SHA256 instead of RMD160 for SHAKE extract testing.
8309 + commit b98ca3f798abd17696f52163665204c4e83d9092
8310 * tests/basic.c (check_one_md): Use GCRY_MD_SHA256 as 'crcalgo' for
8311 SHAKE128/SHAKE256 testing.
8312
8313 2021-07-07 NIIBE Yutaka <[email protected]>
8314
8315 tests: Fix tests/basic.c for FIPS mode.
8316 + commit ccb076e8aabb9c49e7026258b3a36a8422f6bbe4
8317 * tests/basic.c (main): Use bare gcry_control for
8318 GCRYCTL_FORCE_FIPS_MODE.
8319
8320 tests: Skip unavailable ciphers in FIPS mode.
8321 + commit 61c87070abc4baeb9d847db015e6a3031f349483
8322 * tests/basic.c (_check_poly1305_cipher):
8323 (check_ocb_cipher_largebuf_split): Skip unavailable ciphers when
8324 IN_FIPS_MODE.
8325 (check_ocb_cipher_checksum, check_gost28147_cipher_basic): Likewise.
8326
8327 2021-07-07 NIIBE Yutaka <[email protected]>
8328 Jakub Jelen <[email protected]>
8329
8330 tests: Fix messages to STDERR when FIPS mode is enabled.
8331 + commit 297d31294333f39201ae6f387108300b311bedd1
8332 * tests/basic.c (check_digests): Emit message when IN_FIPS_MODE.
8333 (check_hmac, check_mac): Likewise.
8334
8335 2021-07-05 Jussi Kivilinna <[email protected]>
8336
8337 rinjdael-s390x: fix UBSAN warning on using index beyond end of array.
8338 + commit 4b76fa6a1f924a56d2a8c323a9c2d95de763d0dc
8339 * cipher/rijndael-s390x.c (aes_s390x_ocb_get_l): New.
8340 (aes_s390x_ocb_enc, aes_s390x_ocb_dec, aes_s390x_ocb_auth): Use
8341 'aes_s390x_ocb_get_l'.
8342
8343 2021-07-02 Jussi Kivilinna <[email protected]>
8344
8345 ec: add zSeries/s390x accelerated scalar multiplication.
8346 + commit 69fdcb5433236c4fc5d24c1dcc269424a088086c
8347 * cipher/asm-inline-s390x.h (PCC_FUNCTION_*): New.
8348 (pcc_query, pcc_scalar_multiply): New.
8349 * mpi/Makefile.am: Add 'ec-hw-s390x.c'.
8350 * mpi/ec-hw-s390x.c: New.
8351 * mpi/ec-internal.h (_gcry_s390x_ec_hw_mul_point)
8352 (mpi_ec_hw_mul_point): New.
8353 * mpi/ec.c (_gcry_mpi_ec_mul_point): Call 'mpi_ec_hw_mul_point'.
8354 * src/g10lib.h (HWF_S390X_MSA_9): New.
8355 * src/hwf-s390x.c (s390x_features): Add MSA9.
8356 * src/hwfeatures.c (hwflist): Add 's390x-msa-9'.
8357
8358 tests/t-mpi-point: add one more NIST P-256 reduction test-vector.
8359 + commit 3f4a59299134c6804c5d29fb3f275ea0e04ac8ac
8360 * tests/t-mpi-point.c (check_ec_mul_reduction): Add second NIST P-256
8361 test vector from T5510.
8362
8363 2021-07-01 Jussi Kivilinna <[email protected]>
8364
8365 bench-slope: add X25519 and X448 scalar multiplication.
8366 + commit 9911069388e762d2a85bc2a11ca6cfcc4c895e4f
8367 * tests/bench-slope.c (ECC_ALGO_X25519, ECC_ALGO_X448): New.
8368 (ecc_algo_name, ecc_algo_curve, ecc_nbits): Add X25519 and X448.
8369 (bench_ecc_mult_do_bench): Pass Y as NULL to ec_get_affine with
8370 X25519 and X448.
8371 (cipher_ecc_one): Run only multiplication bench for X25519 and X448.
8372
8373 mpi: optimizations for MPI scanning and printing.
8374 + commit 2fcac487069f9e40ff30366546624a8aff355b55
8375 * mpi/mpicoder.c (mpi_read_from_buffer): Add word-size buffer
8376 reading loop using 'buf_get_be(32|64)'.
8377 (mpi_fromstr): Use look-up tables for HEX conversion; Add fast-path
8378 loop for converting 8 hex-characters at once; Add string length
8379 parameter.
8380 (do_get_buffer): Use 'buf_put_be(32|64)' instead of byte writes; Add
8381 fast-path for reversing buffer with 'buf_get_(be64|be32|le64|le32)'.
8382 (_gcry_mpi_set_buffer): Use 'buf_get_be(32|64)' instead of byte reads.
8383 (twocompl): Use _gcry_ctz instead of open-coded if-clauses to get
8384 first bit set; Add fast-path for inverting buffer with
8385 'buf_get_(he64|he32)'.
8386 (_gcry_mpi_scan): Use 'buf_get_be32' where possible; Provide string
8387 length to 'mpi_fromstr'.
8388 (_gcry_mpi_print): Use 'buf_put_be32' where possible; Use look-up
8389 table for HEX conversion; Add fast-path loop for converting to
8390 8 hex-characters at once.
8391 * tests/t-convert.c (check_formats): Add new tests for larger values.
8392
8393 mpi/ec: cache converted field_table MPIs.
8394 + commit ef676b9c14da1c45db8f8538b740a8bbf603652d
8395 * mpi/ec.c (field_table_mpis): New.
8396 (ec_p_init): Cache converted field table MPIs.
8397
8398 mpi_ec_get_affine: fast path for Z==1 case.
8399 + commit 38d80fdfddd027fe87bf5508e453d3e2cdbaa337
8400 * mpi/ec.c (_gcry_mpi_ec_get_affine): Return X and Y as is
8401 if Z is 1 (for Weierstrass and Edwards curves).
8402
8403 tests/t-mpi-point: add reduction test-vectors for secp256k1.
8404 + commit 1652377763892213fa2cd53aa64884934b2c900f
8405 * tests/t-mpi-point.c (check_ec_mul_reduction): Add secp256k1 test
8406 vectors.
8407
8408 2021-06-30 Jussi Kivilinna <[email protected]>
8409
8410 ec-nist: fix 'mod p' carry adjustment and output masking.
8411 + commit fc92c609dfdbcf59a09ca3aaf53a1c1b8408c351
8412 * mpi/ec-inline.h (MASK_AND64, LIMB_OR64): New.
8413 [__x86_64__]: Use "rme" operand type instead of "g" to fix use
8414 of large 32-bit constants.
8415 * mpi/ec-nist.c (_gcry_mpi_ec_nist192_mod, _gcry_mpi_ec_nist224_mod)
8416 (_gcry_mpi_ec_nist256_mod, _gcry_mpi_ec_nist384_mod): At end,
8417 check if 's[]' is negative instead result of last addition, for
8418 output masks; Use 'p_mult' table entry for P instead of 'ctx->p'.
8419 (_gcry_mpi_ec_nist256_mod): Handle corner case were 2*P needs to be
8420 added after carry based subtraction.
8421 * tests/t-mpi-point.c (check_ec_mul_reduction): New.
8422 (main): Call 'check_ec_mul_reduction'.
8423
8424 2021-06-19 Jussi Kivilinna <[email protected]>
8425
8426 mpi/ec: add fast reduction for secp256k1.
8427 + commit 6dfab8cfb94ccb485a15b13df3c499cbb06fddf2
8428 * mpi/ec.c (ec_secp256k1_mod): New.
8429 (field_table): Add 'secp256k1'.
8430 * tests/t-mpi-point.c (check_ec_mul): Add secp256k1 test vectors.
8431
8432 mpi/ec: add fast reduction functions for NIST curves.
8433 + commit 9d909cb67e70fd792926ac1e2ab305b2cc96bc27
8434 * configure.ac (ASM_DISABLED): New.
8435 * mpi/Makefile.am: Add 'ec-nist.c' and 'ec-inline.h'.
8436 * mpi/ec-nist.c: New.
8437 * mpi/ec-inline.h: New.
8438 * mpi/ec-internal.h (_gcry_mpi_ec_nist192_mod)
8439 (_gcry_mpi_ec_nist224_mod, _gcry_mpi_ec_nist256_mod)
8440 (_gcry_mpi_ec_nist384_mod, _gcry_mpi_ec_nist521_mod): New.
8441 * mpi/ec.c (ec_addm, ec_subm, ec_mulm, ec_mul2): Use
8442 'ctx->mod'.
8443 (field_table): Add 'mod' function; Add NIST reduction
8444 functions.
8445 (ec_p_init): Setup ctx->mod; Setup function pointers
8446 from field_table only if pointer is not NULL; Resize
8447 ctx->a and ctx->b only if set.
8448 * mpi/mpi-internal.h (RESIZE_AND_CLEAR_IF_NEEDED): New.
8449 * mpi/mpiutil.c (_gcry_mpi_resize): Clear all unused
8450 limbs also in realloc case.
8451 * src/ec-context.h (mpi_ec_ctx_s): Add 'mod' function.
8452
8453 mpi/ec: small optimization for ec_mulm_448.
8454 + commit ccfa9f2c1427b40483984198c3df41f8057f69f8
8455 * mpi/ec.c (ec_addm_448, ec_subm_448): Change order of sub_n and
8456 set_cond to remove need to clear 'n'.
8457 (ec_mulm_448): Use memcpy where possible; Use mpih_rshift where
8458 possible; Use mpih_lshift for doubling a3; Remove one addition
8459 at end.
8460
8461 mpi/ec: small optimization for ec_mulm_25519.
8462 + commit 9c12226c31d4fed4942c049724591a82c4428408
8463 * mpi/ec.c (ec_addm_25519): Remove one addition.
8464 (ec_subm_25519): Change order of add_n and set_cond to remove
8465 need to clear 'n'.
8466 (ec_mulm_25519): Avoid extra memory copies; Use _gcry_mpih_addmul_1
8467 for multiplying by 19 and adding; Remove one addition at end.
8468
8469 mpi/longlong.h: fix missing macro parameter parentheses.
8470 + commit 9722da5bfc4a519365f081b75319e96c4dd238f2
8471 * mpi/longlong.h [__alpha] (umul_ppmm): Add parentheses around
8472 used parameters.
8473 [__i370__] (sdiv_qrnnd): Ditto.
8474 [__mips__] (umul_ppmm): Ditto.
8475 [__vax__] (sdiv_qrnnd): Ditto.
8476
8477 tests/t-mpi-point: add NIST curve multiplication test vectors.
8478 + commit a0871a1e817f49e81b36b52e6b629f044bbd902e
8479 * tests/t-mpi-point.c (mpi_base10_scan, check_ec_mul): New.
8480 (main): Call 'check_ec_mul'.
8481
8482 tests/bench-slope: add ECC benchmarking.
8483 + commit 57cf83834bc00a7431378aabda692bf700e4876c
8484 * tests/bench-slope.c (bench_print_result_nsec_per_iteration): New.
8485 (bench_print_header_nsec_per_iteration): New.
8486 (kdf_bench_one, kdf_bench): Use new print helper functions.
8487 [USE_ECC]: New ECC benchmarks.
8488 (ecc_bench): New.
8489 (print_help): Add 'ecc' option.
8490 (main): Add ECC benchmarks.
8491
8492 tests/benchmark: add benchmark for Ed448.
8493 + commit b53abf7905e05c39a2bdeffb77414458d2697d89
8494 * tests/benchmark.c (ecc_bench): Add Ed448.
8495
8496 2021-06-17 Werner Koch <[email protected]>
8497
8498 ecc: Fix bug in gcry_pk_get_param for Curve25519.
8499 + commit 692e9b1935ed4ad9517077c1f87da41ddefb9937
8500 * cipher/ecc-curves.c (_gcry_ecc_get_param_sexp): Simplify.
8501
8502 * cipher/pubkey.c (map_algo): Also map EDDSA to ECC.
8503 * tests/curves.c (check_get_params): Add simple param lookup tests by
8504 for all curves.
8505
8506 2021-06-16 Johannes Schindelin via Gcrypt-devel <[email protected]>
8507
8508 build: Fix broken mlock detection.
8509 + commit 66ff25ed4a8fd0c6897d8b18600be483c90ee436
8510 * acinclude.m4 [GNUPG_CHECK_MLOCK]: Use size_t for the ptr test.
8511
8512 2021-06-02 Werner Koch <[email protected]>
8513
8514 cipher: Extend convenience OID mapping table for AES.
8515 + commit 585f153e1f741c1952c8e8c1a7f3a89a1e641572
8516 * cipher/rijndael.c: Add OIDs for GCM and CCM.
8517
8518 Minor tweak to gcry_free.
8519 + commit b6de4080a97385423b6a78fd400606d31093806f
8520 * src/global.c (_gcry_free): Avoid setting errno again if it did not
8521 change.
8522
8523 2021-06-01 NIIBE Yutaka <[email protected]>
8524
8525 random: Silence a warning for building rndjent by Clang.
8526 + commit f6a4e22d86d2e2e03d164ec6515bb662eb762ef3
8527 * random/jitterentropy-base.c: Conditionalize by __OPTIMIZE__.
8528
8529 2021-05-27 NIIBE Yutaka <[email protected]>
8530
8531 build: _DARWIN_C_SOURCE should be 1.
8532 + commit b9a14725ec13747dab1d96658b2f7ce09b1ec874
8533 * configure.ac (*-apple-darwin*): Set _DARWIN_C_SOURCE 1.
8534
8535 2021-05-26 NIIBE Yutaka <[email protected]>
8536
8537 cipher: Fix ElGamal encryption for other implementations.
8538 + commit 632d80ef30e13de6926d503aa697f92b5dbfbc5e
8539 * cipher/elgamal.c (gen_k): Remove support of smaller K.
8540 (do_encrypt): Never use smaller K.
8541 (sign): Folllow the change of gen_k.
8542
8543 2021-05-17 Tianjia Zhang <[email protected]>
8544
8545 cipher: Fix memory leaks for EdDSA.
8546 + commit 14bb6d4ea0dcb4db008057df93396d105d4a8672
8547 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_genkey): Initialize point Q when used.
8548
8549 2021-05-17 H.J. Lu <[email protected]>
8550
8551 Always include <config.h> in cipher assembly codes.
8552 + commit a1f5d87ed49beaab2e4754532b84bd201ef3f68c
8553 * cipher/poly1305-s390x.S: Always include <config.h>.
8554
8555 2021-05-06 NIIBE Yutaka <[email protected]>
8556
8557 ecc: Fix the input length check for Montgomery curve.
8558 + commit 5f814e8a4968c01a7ffc7762bcaf3ce040594caf
8559 * cipher/ecc-misc.c (_gcry_ecc_mont_decodepoint): Fix the condition.
8560
8561 2021-04-28 Jussi Kivilinna <[email protected]>
8562
8563 hwf-x86: fix use of wrong operand type.
8564 + commit ec87511d9cd2dc31434e939b6351d74a38d4ceaa
8565 * src/hwf-x86.c (get_cpuid): Use xchg for swapping %ebx back
8566 and forth between operand register.
8567
8568 2021-04-27 NIIBE Yutaka <[email protected]>
8569
8570 ecc: Check the input length for the point.
8571 + commit 060c378c050e7ec6206358c681a313d6e1967dcf
8572 * cipher/ecc-misc.c (_gcry_ecc_mont_decodepoint): Check the length
8573 of valid point representation.
8574
8575 2021-04-26 Jussi Kivilinna <[email protected]>
8576
8577 keccak: add hash_buffers functions for SHAKE128 & SHAKE256.
8578 + commit e866c01e645d35475614d892665ac1c09513156d
8579 * cipher/keccak.c (_gcry_shake128_hash_buffers)
8580 (_gcry_shake256_hash_buffers): New.
8581 (_gcry_digest_spec_shake128, _gcry_digest_spec_shake256): Add
8582 hash_buffers pointer.
8583
8584 hash_buffers: add output length param for XOF support.
8585 + commit eb96baf28473302b3d78187de92eb10093919f18
8586 * src/cipher-proto.h (gcry_md_hash_buffers_t): Add nbytes parameter
8587 for outbuf size for XOF algorithms.
8588 * cipher/md.c (_gcry_md_hash_buffer)
8589 (_gcry_md_hash_buffers_extract): Adjust for spec->hash_buffers
8590 parameter change.
8591 * cipher/keccak.c (_gcry_sha3_hash_buffers): Add nbytes parameter and
8592 handling for XOF output.
8593 * cipher/blake2.c (DEFINE_BLAKE2_VARIANT): Add nbytes parameter for
8594 hash_buffers.
8595 * cipher/rmd160.c (_gcry_rmd160_hash_buffers): Add nbytes parameter.
8596 * cipher/sha1.c (_gcry_sha1_hash_buffers): Add nbytes parameter.
8597 (_gcry_sha1_hash_buffer): Pass nbytes to _gcry_sha1_hash_buffers.
8598 * cipher/sha256.c (_gcry_sha256_hash_buffers)
8599 (_gcry_sha224_hash_buffers): Add nbytes parameter.
8600 * cipher/sha512.c (_gcry_sha512_hash_buffers)
8601 (_gcry_sha384_hash_buffers, _gcry_sha512_256_hash_buffers)
8602 (_gcry_sha512_224_hash_buffers): Add nbytes parameter.
8603 * cipher/sm3.c (_gcry_sm3_hash_buffers): Add nbytes parameter.
8604
8605 md: remove hash_buffer function from algorithms.
8606 + commit 580ae61db5fe47b558135c2c794fd72c2680fa20
8607 * cipher/md.c (_gcry_md_hash_buffer): Remove used of
8608 'spec->hash_buffer'.
8609 * cipher/blake2.c (DEFINE_BLAKE2_VARIANT): Remove *_hash_buffer.
8610 * cipher/crc.c: Remove spec hash_buffer NULL pointers.
8611 * cipher/gostr3411-94.c: Remove spec hash_buffer NULL pointers.
8612 * cipher/keccak.c (_gcry_sha3_hash_buffer
8613 (_gcry_sha3_224_hash_buffer, _gcry_sha3_256_hash_buffer): Remove.
8614 (_gcry_sha3_384_hash_buffer, _gcry_sha3_512_hash_buffer): Remove.
8615 * cipher/md2.c: Remove spec hash_buffer NULL pointers.
8616 * cipher/md4.c: Remove spec hash_buffer NULL pointers.
8617 * cipher/md5.c: Remove spec hash_buffer NULL pointers.
8618 * cipher/rmd160.c (_gcry_rmd160_hash_buffer): Remove.
8619 * cipher/sha1.c (_gcry_sha1_hash_buffer): Rewrite using
8620 _gcry_sha1_hash_buffers.
8621 (_gcry_sha1_hash_buffers): Make static.
8622 (_gcry_digest_spec_sha1): Remove hash_buffer pointer.
8623 * cipher/sha256.c (_gcry_sha256_hash_buffer)
8624 (_gcry_sha224_hash_buffer): Remove.
8625 (_gcry_sha256_hash_buffers): Make static.
8626 * cipher/sha512.c (_gcry_sha512_hash_buffer)
8627 (_gcry_sha384_hash_buffer, _gcry_sha512_256_hash_buffer)
8628 (_gcry_sha512_224_hash_buffer): Remove.
8629 (_gcry_sha512_hash_buffers): Make static.
8630 * cipher/sm3.c (_gcry_sm3_hash_buffer): Remove.
8631 (_gcry_sm3_hash_buffers): Make static.
8632 * cipher/stribog.c: Remove spec hash_buffer NULL pointers.
8633 * cipher/tiger.c: Remove spec hash_buffer NULL pointers.
8634 * cipher/whirlpool.c: Remove spec hash_buffer NULL pointers.
8635 * src/cipher-proto.h (gcry_md_hash_buffer_t): Remove.
8636 (gcry_md_spec_t): Remove 'hash_buffer'.
8637 * src/cipher.h (_gcry_rmd160_hash_buffer, _gcry_sha1_hash_buffers)
8638 (_gcry_sha256_hash_buffer, _gcry_sha256_hash_buffers)
8639 (_gcry_sha512_hash_buffer, _gcry_sha512_hash_buffers)
8640 (_gcry_sm3_hash_buffer, _gcry_sm3_hash_buffers): Remove.
8641
8642 Add XOF output support for internal _gcry_md_hash_buffers.
8643 + commit f53d541d0947a894e6f09b4568658a859505a649
8644 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_compute_h_d, _gcry_ecc_eddsa_sign)
8645 (_gcry_ecc_eddsa_verify): Use same _gcry_md_hash_buffers_extract code
8646 path for SHA512 and SHAKE256.
8647 * cipher/md.c (_gcry_md_hash_buffers): Rename to ...
8648 (_gcry_md_hash_buffers_extract): ... this; Add digestlen and handling
8649 for XOF algorithms (SHAKE128, SHAKE256).
8650 (_gcry_md_hash_buffers): New.
8651 * src/gcrypt-int.h (_gcry_md_hash_buffers_extract): New.
8652
8653 Use memset for constant length wipememory2.
8654 + commit 4770ad72607f73b9d529511c687556a6b4109875
8655 * src/g10lib.h (fast_wipememory2_inline): New.
8656 (wipememory2): Use 'fast_wipememory2_inline', remove 'fast_wipememory2'
8657 use; Use _gcry_fast_wipememory* when _len or _set is not constant.
8658 (fast_wipememory_s, fast_wipememory2): Remove.
8659
8660 2021-04-19 Werner Koch <[email protected]>
8661
8662 Release 1.9.3.
8663 + commit cb78627203705365d24b48ec4fc4cf2fc804b277
8664
8665
8666 2021-04-15 NIIBE Yutaka <[email protected]>
8667 Jakub Jelen <[email protected]>
8668
8669 cipher: Fix memory leaks for EdDSA.
8670 + commit a8d6c6c1b258548260748eefba0532fd35c8ce47
8671 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_genkey): Free the point Q.
8672 (_gcry_ecc_eddsa_verify): Avoid memory leaks for points and MPIs.
8673
8674 2021-04-13 NIIBE Yutaka <[email protected]>
8675
8676 api: Avoid use of C99 feature.
8677 + commit 9c42db0b379c277ee976fcc696e84e31863a85a8
8678 * src/gcrypt.h.in (enum gcry_md_algos): Remove last comma.
8679
8680 random: Fix for iOS.
8681 + commit 0007f889bda884e40459ad86f13b6cd8b14c91df
8682 * random/rndlinux.c [TARGET_OS_IPHONE]: Don't define HAVE_GETENTROPY.
8683
8684 cipher: Hardening ElGamal by introducing exponent blinding too.
8685 + commit e8b7f10be275bcedb5fc05ed4837a89bfd605c61
8686 * cipher/elgamal.c (do_encrypt): Also do exponent blinding.
8687
8688 2021-04-09 Jussi Kivilinna <[email protected]>
8689
8690 mpi: harden add_n_cond, sub_n_cond and abs_cond against EM leakage.
8691 + commit 9bc3d8de6e2a8cdef37c118f0a70376ed777eeee
8692 * mpi/mpih-const-time.c (_gcry_mpih_add_n_cond)
8693 (_gcry_mpih_sub_n_cond): Always perform calculation with both UP and
8694 VP; Use two masks for selecting output.
8695 (_gcry_mpih_abs_cond): Always calculate absolute value of UP; Use
8696 two masks for selecting output.
8697
8698 mpi: harden set_cond functions against EM leakage.
8699 + commit c7c25b6e6e6b52bbed26d8016145c404eb118f19
8700 * mpi/mpih-const-time.c (_gcry_mpih_set_cond): Use two masks for
8701 selecting output.
8702 * mpi/mpiutil.c (_gcry_mpi_set_cond): Use two masks for selecting
8703 output.
8704
8705 mpi: harden swap_cond functions against EM leakage.
8706 + commit 1266f5bb02b7f76f2e4697ecfb85ef19c2ae04a9
8707 * mpi/mpih-const-time.c (vzero, vone): New.
8708 (_gcry_mpih_swap_cond): Use two masks for selecting output.
8709 * mpi/mpiutil.c (vzero, vone): New.
8710 (_gcry_mpi_swap_cond): Use to masks for selecting output.
8711
8712 2021-04-02 NIIBE Yutaka <[email protected]>
8713
8714 cipher: Return GPG_ERR_INV_KEYLEN when wrong key length.
8715 + commit 840713de1a685920b6b1e1379902d545eccc74cf
8716 * cipher/idea.c (do_setkey): Return GPG_ERR_INV_KEYLEN.
8717 * cipher/rfc2268.c (setkey_core): Likewise.
8718 * cipher/serpent.c (serpent_setkey_internal): Likewise.
8719 (serpent_setkey): Likewise.
8720
8721 2021-04-01 Jussi Kivilinna <[email protected]>
8722
8723 cipher-gcm-ppc: add big-endian support.
8724 + commit aaa30381eac3cdb49a21e279b2d89ef6e695a138
8725 * cipher/cipher-gcm-ppc.c (ALIGNED_16): New.
8726 (vec_store_he, vec_load_he): Remove WORDS_BIGENDIAN ifdef.
8727 (vec_dup_byte_elem): New.
8728 (_gcry_ghash_setup_ppc_vpmsum): Match function declaration with
8729 prototype in cipher-gcm.c; Load C2 with VEC_LOAD_BE; Use
8730 vec_dup_byte_elem; Align constants to 16 bytes.
8731 (_gcry_ghash_ppc_vpmsum): Match function declaration with
8732 prototype in cipher-gcm.c; Align constant to 16 bytes.
8733 * cipher/cipher-gcm.c (ghash_ppc_vpmsum): Return value from
8734 _gcry_ghash_ppc_vpmsum.
8735 * cipher/cipher-internal.h (GCM_USE_PPC_VPMSUM): Remove requirement
8736 for !WORDS_BIGENDIAN.
8737
8738 mpi/aarch64: use C_SYMBOL_NAME for assembly function names.
8739 + commit 1cf5a568f2b2f2c3d83c154cdcf5a40aa1f83c50
8740 * mpi/aarch64/mpih-add1.S: Add missing C_SYMBOL_NAME.
8741 * mpi/aarch64/mpih-mul1.S: Add missing C_SYMBOL_NAME.
8742 * mpi/aarch64/mpih-mul2.S: Add missing C_SYMBOL_NAME.
8743 * mpi/aarch64/mpih-mul3.S: Add missing C_SYMBOL_NAME.
8744 * mpi/aarch64/mpih-sub1.S: Add missing C_SYMBOL_NAME.
8745
8746 2021-03-31 NIIBE Yutaka <[email protected]>
8747
8748 build: Update gpg-error.m4.
8749 + commit d2b3d046fc66a3166dc0c003a430ce756532ff74
8750 * m4/gpg-error.m4: Update from libgpg-error.
8751
8752 2021-03-30 NIIBE Yutaka <[email protected]>
8753
8754 build: Fix for make distcheck, no EPS support.
8755 + commit 35917373d64521d9c0d33b5fa9b60abd28964dd4
8756 * Makefile.am (AM_DISTCHECK_DVI_TARGET): Specify 'pdf'.
8757 * doc/Makefile.am (EXTRA_DIST, BUILT_SOURCES): Remove .eps files.
8758
8759 ecc: Fix the regression of gcry_mpi_ec_add.
8760 + commit 45e88b8ec6dfbd8f981ca89ded80ef48eca6f0e9
8761 * mpi/ec.c (_gcry_mpi_ec_point_resize): Export the routine
8762 for internal use.
8763 (add_points_edwards, _gcry_mpi_ec_mul_point): Use mpi_point_resize.
8764 * src/gcrypt-int.h (_gcry_mpi_ec_point_resize): Declare.
8765
8766 * src/visibility.c (gcry_mpi_ec_dup, gcry_mpi_ec_add): Make sure for
8767 the size of limb before calling the internal functions.
8768 (gcry_mpi_ec_sub): Likewise.
8769
8770 2021-03-25 Jussi Kivilinna <[email protected]>
8771
8772 rijndael-s390x: fix checksum calculation in OCB decryption.
8773 + commit 68bb0ddc5504c9c0f3f52259a4085bb2fc1a02ad
8774 * cipher/rijndael-s390x.c (aes_s390x_ocb_dec): Calculate checksum
8775 after decryption instead of inlining.
8776
8777 tests/basic: OCB large buffer check: make input buffer non-repeatable.
8778 + commit 21c273cecfd58408b8d3287f5bc8c246c3010313
8779 * tests/basic.c (check_ocb_cipher_largebuf_split): Use SHA1 to
8780 initialize input buffer.
8781 (check_ocb_cipher): Update largebuf test vectors.
8782
8783 tests/basic: add decryption check to check_ocb_cipher_checksum.
8784 + commit 56da81ac47209dc41af08a129f5e0c15538261b2
8785 * tests/basic.c (check_ocb_cipher_checksum): Add decryption.
8786
8787 2021-03-25 NIIBE Yutaka <[email protected]>
8788
8789 build: Remove intermediate PDF files from EXTRA_DIST.
8790 + commit 52f6e95159885431f3c7e9f64290d0132ca547ef
8791 * doc/Makefile.am (EXTRA_DIST): Remove PDF files.
8792 (BUILT_SOURCES): Likewise.
8793
8794 2021-03-24 Werner Koch <[email protected]>
8795
8796 ecc: Fix keygrip computation for compressed points.
8797 + commit c8c38757c428871af980a548bc38f38e5d9238d1
8798 * cipher/ecc-misc.c (_gcry_ecc_ec2os): Factor most code out to ...
8799 (_gcry_ecc_ec2os_buf): new.
8800 * cipher/ecc.c (compute_keygrip): Handle compressed keys.
8801 * tests/keygrip.c: Add new tests.
8802
8803 2021-03-07 Jussi Kivilinna <[email protected]>
8804
8805 Compile arch specific GCM implementations only on target arch.
8806 + commit 43302b960f546fd60ed7fefb2b0404ee69491e93
8807 * cipher/Makefile.am: Move arch specific 'cipher-gcm-*.[cS]' files
8808 from libcipher_la_SOURCES to EXTRA_libcipher_la_SOURCES.
8809 * configure.ac: Add 'cipher-gcm-intel-pclmul.lo' and
8810 'cipher-gcm-arm*.lo'.
8811
8812 configure.ac: fix digest implementations going to cipher list.
8813 + commit 8892510bb8f45438144a7449440fcb32ae4c5f7b
8814 * configure.ac: Add 'crc-arm*.lo', 'crc-ppc.lo', 'sha*-ppc.lo' to
8815 GCRYPT_DIGESTS instead of GCRYPT_CIPHERS.
8816
8817 cipher-gcm-ppc: tweak for better performance.
8818 + commit 760ef8baee06db5ce4da55eb5648e605aa511d2d
8819 * cipher/cipher-gcm-ppc.c (asm_xor, asm_mergelo, asm_mergehi)
8820 (vec_be_swap, vec_load_he, vec_store_he): New.
8821 (vec_load_be, vec_perm2, vec_aligned_st, vec_aligned_ld): Remove.
8822 (asm_vpmsumd, asm_swap_u64, vec_perm2, asm_rot_block_left)
8823 (asm_rot_block_right, asm_ashl_128, vec_aligned_ld)
8824 (_gcry_ghash_setup_ppc_vpmsum): Update 'bswap_const'.
8825 (_gcry_ghash_ppc_vpmsum): Update 'bswap_const'; Use 'asm_mergehi'
8826 and 'asm_mergelo' instead of vec_perm2; Use 'asm_xor' for
8827 fast path to enforce instruction ordering; Use 'vec_load_he' and
8828 'vec_be_swap' for big-endian loads.
8829
8830 2021-03-07 Shawn Landden <[email protected]>
8831
8832 VPMSUMD acceleration for GCM mode on PPC.
8833 + commit 440332532a1c107e2baeafda5464e0707f634be1
8834 * cipher/Makefile.am: Add 'cipher-gcm-ppc.c'.
8835 * cipher/cipher-gcm-ppc.c: New.
8836 * cipher/cipher-gcm.c [GCM_USE_PPC_VPMSUM] (_gcry_ghash_setup_ppc_vpmsum)
8837 (_gcry_ghash_ppc_vpmsum, ghash_setup_ppc_vpsum, ghash_ppc_vpmsum): New.
8838 (setupM) [GCM_USE_PPC_VPMSUM]: Select ppc-vpmsum implementation if
8839 HW feature "ppc-vcrypto" is available.
8840 * cipher/cipher-internal.h (GCM_USE_PPC_VPMSUM): New.
8841 (gcry_cipher_handle): Move 'ghash_fn' at end of 'gcm' block to align
8842 'gcm_table' to 16 bytes.
8843 * configure.ac: Add 'cipher-gcm-ppc.lo'.
8844 * tests/basic.c (_check_gcm_cipher): New AES256 test vector.
8845 * AUTHORS: Add 'CRYPTOGAMS'.
8846 * LICENSES: Add original license to 3-clause-BSD section.
8847
8848 2021-03-06 Jussi Kivilinna <[email protected]>
8849
8850 src/hwfeatures: add reminder about documenting new HW features.
8851 + commit 7c4c992fe96f781e387bd26a11b17e70a27aa3c0
8852 * src/hwfeatures.c (hwflist): Add comment about updating
8853 'doc/gcrypt.texi' with new HW features.
8854
8855 2021-03-06 Jakub Jelen <[email protected]>
8856
8857 doc: Document newly added optimizations.
8858 + commit 49ab649c69951cd7b6d40d3527e21db51d93a207
8859 * doc/gcrypt.texi: Add HW features 'intel-vaes-vpclmul', 'ppc-vcrypto',
8860 'ppc-arch_3_00', 'ppc-arch_2_07', 's390x-msa', 's390x-msa-4',
8861 's390x-msa-8' and 's390x-vx'.
8862
8863 2021-03-03 Jussi Kivilinna <[email protected]>
8864
8865 poly1305: make --disable-asm work on x86, aarch64 and ppc.
8866 + commit 2b84da922660918129c610f4d27cb5c510ab0489
8867 * cipher/poly1305.c [__aarch64__] (ADD_1305_64): Check for
8868 HAVE_CPU_ARCH_ARM.
8869 [__x86_64__] (ADD_1305_64): Check for HAVE_CPU_ARCH_X86.
8870 [__powerpc__] (ADD_1305_64): Check for HAVE_CPU_ARCH_PPC.
8871 [__i386__] (ADD_1305_32): Check for HAVE_CPU_ARCH_X86.
8872
8873 poly1305: fix compiling on i386 gcc-4.7.
8874 + commit bcb180190e8921356c039b0475fd71f2c45d986d
8875 * cipher/poly1305.c [__i386__]: Limit i386 variant of ADD_1305_32 to
8876 GCC-5 or newer.
8877
8878 cipher-gcm-intel-pclmul: fix compiling with i386 gcc-4.7.
8879 + commit d1fcf3975c57c5312890199832100c8c363d5b18
8880 * cipher/cipher-gcm-intel-pclmul.c (gcm_lsh): Pass '*pconst' instead of
8881 'pconst' to asm block.
8882
8883 2021-02-28 Jussi Kivilinna <[email protected]>
8884
8885 rijndael: add x86_64 VAES/AVX2 accelerated implementation.
8886 + commit e72498a54fdead503fb0c1c93e2b747cd91e7681
8887 * cipher/Makefile.am: Add 'rijndael-vaes.c' and
8888 'rijndael-vaes-avx2-amd64.S'.
8889 * cipher/rijndael-internal.h (USE_VAES): New.
8890 * cipher/rijndael-vaes-avx2-amd64.S: New.
8891 * cipher/rijndael-vaes.c: New.
8892 * cipher/rijndael.c (_gcry_aes_vaes_cfb_dec, _gcry_aes_vaes_cbc_dec)
8893 (_gcry_aes_vaes_ctr_enc, _gcry_aes_vaes_ocb_crypt)
8894 (_gcry_aes_vaes_xts_crypt): New.
8895 (do_setkey) [USE_VAES]: Add detection for VAES.
8896 (selftest_ctr_128, selftest_cbc_128, selftest_cfb_128)
8897 [USE_VAES]: Increase number of selftest blocks.
8898 * configure.ac: Add 'rijndael-vaes.lo' and
8899 'rijndael-vaes-avx2-amd64.lo'.
8900
8901 rijndael-aesni: add 8-block parallel code path for XTS.
8902 + commit ffe1d53197031eeb65601c5aeafe55e78079a75e
8903 * cipher/rijndael-aesni.c (xts_gfmul_const): Fix array size from 16
8904 to 2.
8905 (_gcry_aes_aesni_xts_enc, _gcry_aes_aesni_xts_dec) [__x86_64__]: Add
8906 8-block parallel code paths.
8907
8908 camellia: add x86_64 VAES/AVX2 accelerated implementation.
8909 + commit 0e7e60241a0d054eae7a98116636a831ec6ccc97
8910 * cipher/Makefile.am: Add 'camellia-aesni-avx2-amd64.h' and
8911 'camellia-vaes-avx2-amd64.S'.
8912 * cipher/camellia-aesni-avx2-amd64.S: New, old content moved to...
8913 * cipher/camellia-aesni-avx2-amd64.h: ...here.
8914 (IF_AESNI, IF_VAES, FUNC_NAME): New.
8915 * cipher/camellia-vaes-avx2-amd64.S: New.
8916 * cipher/camellia-glue.c (USE_VAES_AVX2): New.
8917 (CAMELLIA_context): New member 'use_vaes_avx2'.
8918 (_gcry_camellia_vaes_avx2_ctr_enc, _gcry_camellia_vaes_avx2_cbc_dec)
8919 (_gcry_camellia_vaes_avx2_cfb_dec, _gcry_camellia_vaes_avx2_ocb_enc)
8920 (_gcry_camellia_vaes_avx2_ocb_dec)
8921 (_gcry_camellia_vaes_avx2_ocb_auth): New.
8922 (camellia_setkey): Check for HWF_INTEL_VAES.
8923 (_gcry_camellia_ctr_enc, _gcry_camellia_cbc_dec)
8924 (_gcry_camellia_cfb_dec, _gcry_camellia_ocb_crypt)
8925 (_gcry_camellia_ocb_auth): Add USE_VAES_AVX2 code.
8926 * configure.ac: Add 'camellia-vaes-avx2-amd64.lo'.
8927
8928 hwf-x86: add "intel-vaes-vpclmul" HW feature.
8929 + commit eb404d8904532f6dca82421c952be286a1f4e11c
8930 * configure.ac (HAVE_GCC_INLINE_ASM_VAES_VPCLMUL): New.
8931 * src/g10lib.h (HWF_INTEL_VAES_VPCLMUL): New.
8932 * src/hwf-x86.c (detect_x86_gnuc): Check for VAES and VPCLMUL.
8933 * src/hwfeatures.c (hwflist): Add "intel-vaes-vpclmul".
8934
8935 2021-02-17 Werner Koch <[email protected]>
8936
8937 Release 1.9.2.
8938 + commit 24bd7e8215f7982b0c8db46fd87b47b370a52ec6
8939
8940
8941 2021-02-16 NIIBE Yutaka <[email protected]>
8942
8943 build: Update gpg-error.m4.
8944 + commit 8e3cd4c4677c3b10ac6265a1b31f84c63c95cac4
8945 * m4/gpg-error.m4: Update from libgpg-error.
8946
8947 2021-02-12 NIIBE Yutaka <[email protected]>
8948
8949 random: Fix build for macOS.
8950 + commit d78cdf42854b17e2216890e7b78f9e7e05c0b1f8
8951 * random/rndlinux.c [__APPLE__] (HAVE_GETENTROPY): Valid only when the
8952 macro __MAC_10_11 is available.
8953
8954 2021-02-08 Werner Koch <[email protected]>
8955
8956 tests: Fix minor glitches.
8957 + commit 82395f11b444651f544f5e51c62fc6b65c04f9ef
8958 * tests/basic.c (ALWAYS_INLINE): Make sure it is defined.
8959 * tests/version.c (main): Print the config info to stdout.
8960
8961 New test Makefile target xtestsuite.
8962 + commit ebc4d5670a1ada54ad907a4836eb8f6f573c2c38
8963 * tests/Makefile.am (xtestsuite, xcheck): New targets.
8964
8965 New test driver to allow for standalone regression tests.
8966 + commit b142da4c88deef4798ef96061dac399df3ddd73d
8967 * tests/testdrv.c: New.
8968
8969 2021-02-03 Jussi Kivilinna <[email protected]>
8970
8971 sha256-avx2: fix reading beyond end of input buffer.
8972 + commit 24af2a55d862d45fe3aef6b5626a52d9bb0fb17e
8973 * cipher/sha256-avx2-bmi2-amd64.S
8974 (_gcry_sha256_transform_amd64_avx2): Use 'last block' code path if
8975 input length is only one block.
8976 * tests/basic.c (check_one_md_final): Use dynamic allocated buffer
8977 so that in future similar access errors get detected by
8978 tests/basic + valgrind.
8979
8980 ecc-ecdh: fix memory leak.
8981 + commit 289543544e41cd5fe90352c5c7548ac09da533cc
8982 * cipher/ecc-ecdh.c (_gcry_ecc_mul_point): Free 'ec' at function exit.
8983
8984 tests: allow running 'make check' with ASAN.
8985 + commit f46a6bd9b3d7ef7d1a72c5b6da5cf34ace2ff156
8986 * tests/t-secmem.c (main): Skip test if environment variable
8987 GCRYPT_IN_ASAN_TEST is defined.
8988 * tests/t-sexp.c (main): Do not initialize secmem if environment
8989 variable GCRYPT_IN_ASAN_TEST is defined.
8990
8991 global: make sure that bulk config string is null-terminated.
8992 + commit 8716e4b2ada21456802aee67c2bc8edfec78f820
8993 * src/global.c (_gcry_get_config): Append null-terminator to output
8994 in the 'what == NULL' case.
8995
8996 Add handling for -Og with O-flag munging.
8997 + commit a71b7de32b0c7c41359335a488cfe4dd70c65121
8998 * cipher/Makefile.am (o_flag_munging): Add handling for '-Og'.
8999 * random/Makefile.am (o_flag_munging): Add handling for '-Og'.
9000
9001 jent: silence ubsan warning about signed overflow.
9002 + commit 6fc11291282a668839040c72a1d558a6ebbd4972
9003 * random/jitterentropy-base.c (jent_stuck): Cast 'delta2' values to
9004 'uint64_t' for calculation.
9005
9006 Fix ubsan warnings for i386 build.
9007 + commit 364e9e9d10503b36f98fbb1b489e00026f22c9d7
9008 * mpi/mpicoder.c (_gcry_mpi_set_buffer) [BYTES_PER_MPI_LIMB == 4]: Cast
9009 "*p--" values to mpi_limb_t before left shifting.
9010 * tests/t-lock.c (main): Cast 'time(NULL)' to unsigned type.
9011
9012 Fix building with --disable-asm on x86.
9013 + commit af23ab5c5482d625ff52e60606cf044e2b0106c8
9014 * cipher/keccak.c (USE_64BIT_BMI2, USE_64BIT_SHLD)
9015 (USE_32BIT_BMI2): Depend also on HAVE_CPU_ARCH_X86.
9016 * random/rndjent.c [__i386__ || __x86_64__] (USE_JENT): Depend
9017 also on HAVE_CPU_ARCH_X86.
9018
9019 md: clear bctx.count at final function.
9020 + commit cb95fc53003e9f34ff80fc33627ceda605de223c
9021 * cipher/md4.c (md4_final): Set bctx.count zero after
9022 finalizing.
9023 * cipher/md5.c (md5_final): Ditto.
9024 * cipher/rmd160.c (rmd160_final): Ditto.
9025 * cipher/sha1.c (sha1_final): Ditto.
9026 * cipher/sha256.c (sha256_final): Ditto.
9027 * cipher/sha512.c (sha512_final): Ditto.
9028 * cipher/sm3.c (sm3_final): Ditto.
9029 * cipher/stribog.c (stribog_final): Ditto.
9030 * cipher/tiger.c (tiger_final): Ditto.
9031
9032 2021-02-02 NIIBE Yutaka <[email protected]>
9033
9034 ecc: Add checking key for ECDSA.
9035 + commit 598d0f3e0294a487e01b88cc714a8cd0a47329bb
9036 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_verify): Validate public key.
9037 * cipher/ecc-gost.c (_gcry_ecc_gost_verify): Likewise.
9038 * cipher/ecc-sm2.c (_gcry_ecc_sm2_verify): Likewise.
9039
9040 2021-01-29 Werner Koch <[email protected]>
9041
9042 Release 1.9.1.
9043 + commit 466299b1ceb82ec7c4dd0ca376de50399a896adf
9044 * configure.ac: Bump LT version to C23/A3/R1.
9045
9046 2021-01-29 Jussi Kivilinna <[email protected]>
9047
9048 hash-common: fix heap overflow when writing more data after final.
9049 + commit 512c0c75276949f13b6373b5c04f7065af750b08
9050 * tests/basic.c (check_one_md): Test writing to digest after read.
9051 * cipher/hash-common.c (_gcry_md_block_write): Reset 'hd->count' if
9052 greater than blocksize.
9053
9054 2021-01-28 Werner Koch <[email protected]>
9055
9056 Add a compliance keyword to gcry_get_config.
9057 + commit aa3f595341eb263980210776c7fe377b2ed24c5e
9058 * src/global.c (print_config): New config line.
9059
9060 2021-01-27 Jussi Kivilinna <[email protected]>
9061
9062 asm-common-aarch64: add MacOS support for GET_DATA_POINTER.
9063 + commit 014fed5153647641376b9131ea1d87dc5e88cf42
9064 * cipher/asm-common-aarch64.h [__APPLE__] (GET_DATA_POINTER): Add MacOS
9065 variant of macro.
9066
9067 2021-01-27 NIIBE Yutaka <[email protected]>
9068
9069 random: Use getentropy on macOS when available.
9070 + commit 6cb0faf6ceec5b2e799e6fb5f04b85d135a7da9b
9071 * random/rndlinux.c [__APPLE__ && __MACH__] (getentropy): Declare.
9072 (_gcry_rndlinux_gather_random): Check the symbol and use getentropy.
9073
9074 mpi: Fix _gcry_mpih_mod implementation.
9075 + commit f06ff4e31c8e162f4a59986241c7ab43d5085927
9076 * mpi/mpih-const-time.c (_gcry_mpih_mod): Handle the overflow.
9077
9078 build: Check spawn.h for MacOS X Tiger.
9079 + commit fc901e978a0c18a3524cad5d1ef3451ed11b9347
9080 * configure.ac: Add check for spawn.h.
9081 * tests/random.c: Only use posix_spawn if available.
9082
9083 2021-01-26 Jussi Kivilinna <[email protected]>
9084
9085 global: fix compile error at pragma GCC diagnostic.
9086 + commit 3d095206c30d772d5fc68bf69bfc384e43f766e9
9087 * src/global.c (_gcry_vcontrol): Move "pragma GCC diagnostics" outside
9088 function.
9089
9090 cipher-proto: remove forward typedef of cipher_bulk_ops_t.
9091 + commit 17aad639d29c7c835a7effb89181c7c99b16cb6a
9092 * cipher/cipher-proto (cipher_bulk_ops_t): Remove typedef, leave
9093 forward declaration of 'struct cipher_bulk_ops'.
9094 (gcry_cipher_setkey_t): Change 'bulk_ops' to
9095 'struct cipher_bulk_ops *'.
9096 * cipher/arcfour.c: Include 'cipher-internal.h'.
9097 * cipher/gost28147.c: Ditto.
9098 * cipher/idea.c: Ditto.
9099 * cipher/rfc2268.c: Ditto.
9100 * cipher/salsa20.c: Ditto.
9101 * cipher/seed.c: Ditto.
9102 * cipher/mac-internal.h (CTX_MAGIC_NORMAL): Rename to...
9103 (CTX_MAC_MAGIC_NORMAL): ... this.
9104 (CTX_MAGIC_SECURE): Rename to...
9105 (CTX_MAC_MAGIC_SECURE): ... this.
9106 * cipher/mac-cmac.c (cmac_open): Use CTX_MAC_MAGIC_SECURE.
9107 * cipher/mac-gmac.c (gmac_open): Ditto.
9108 * cipher/mac-hmac.c (hmac_open): Ditto.
9109 * cipher/mac-poly1305.c (poly1305mac_open): Ditto.
9110 * cipher/mac.c (mac_open): Use CTX_MAC_MAGIC_SECURE and
9111 CTX_MAC_MAGIC_NORMAL.
9112
9113 2021-01-26 David Michael <[email protected]>
9114
9115 cipher/sha512: Fix non-NEON ARM assembly implementation.
9116 + commit 1e72c50f864ae1c77ba80c191224b9ef1d22a2e2
9117 * cipher/sha512.c (do_transform_generic)
9118 [USE_ARM_ASM]: Switch to the non-NEON assembly implementation.
9119
9120 2021-01-26 Jussi Kivilinna <[email protected]>
9121
9122 blake2: fix RIP register access for AVX/AVX2 implementations.
9123 + commit b2f78ae034b8d4aa3d4cc7bf85262317832f6e0a
9124 * cipher/blake2b-amd64-avx2.S: Use rRIP instead of (RIP).
9125 * cipher/blake2s-amd64-avx.S: Use rRIP instead of (RIP).
9126
9127 sha512/sha256: remove assembler macros from AMD64 implementations.
9128 + commit 9f49e806f9506533236fd44b17f17b85961b20f1
9129 * configure.ac (gcry_cv_gcc_platform_as_ok_for_intel_syntax): Remove
9130 assembler macro check from Intel syntax assembly support check.
9131 * cipher/sha256-avx-amd64.S: Replace assembler macros with C
9132 preprocessor counterparts.
9133 * cipher/sha256-avx2-bmi2-amd64.S: Ditto.
9134 * cipher/sha256-ssse3-amd64.S: Ditto.
9135 * cipher/sha512-avx-amd64.S: Ditto.
9136 * cipher/sha512-avx2-bmi2-amd64.S: Ditto.
9137 * cipher/sha512-ssse3-amd64.S: Ditto.
9138
9139 configure.ac: run assembler checks through linker for better LTO support
9140 + commit 393bd6c3d1aa2b2a1b05be0e2d7fb2514e6c5ad0
9141 * configure.ac (gcry_cv_gcc_arm_platform_as_ok)
9142 (gcry_cv_gcc_aarch64_platform_as_ok)
9143 (gcry_cv_gcc_inline_asm_ssse3, gcry_cv_gcc_inline_asm_pclmul)
9144 (gcry_cv_gcc_inline_asm_shaext, gcry_cv_gcc_inline_asm_sse41)
9145 (gcry_cv_gcc_inline_asm_avx, gcry_cv_gcc_inline_asm_avx2)
9146 (gcry_cv_gcc_inline_asm_bmi2, gcry_cv_gcc_as_const_division_ok)
9147 (gcry_cv_gcc_as_const_division_with_wadivide_ok)
9148 (gcry_cv_gcc_amd64_platform_as_ok, gcry_cv_gcc_win64_platform_as_ok)
9149 (gcry_cv_gcc_platform_as_ok_for_intel_syntax)
9150 (gcry_cv_gcc_inline_asm_neon, gcry_cv_gcc_inline_asm_aarch32_crypto)
9151 (gcry_cv_gcc_inline_asm_aarch64_neon)
9152 (gcry_cv_gcc_inline_asm_aarch64_crypto)
9153 (gcry_cv_gcc_inline_asm_ppc_altivec)
9154 (gcry_cv_gcc_inline_asm_ppc_arch_3_00)
9155 (gcry_cv_gcc_inline_asm_s390x, gcry_cv_gcc_inline_asm_s390x): Use
9156 AC_LINK_IFELSE check instead of AC_COMPILE_IFELSE.
9157
9158 rijndael: remove unused use_xxx flags.
9159 + commit a14447f8169aff30a49f5c2ab06bd5bbd1cc3531
9160 * cipher/rijndael-internal.h (RIJNDAEL_context_s): Remove unused
9161 'use_padlock', 'use_aesni', 'use_ssse3', 'use_arm_ce', 'use_ppc_crypto'
9162 and 'use_ppc9le_crypto'.
9163 * cipher/rijndael.c (do_setkey): Do not setup 'use_padlock',
9164 'use_aesni', 'use_ssse3', 'use_arm_ce', 'use_ppc_crypto' and
9165 'use_ppc9le_crypto'.
9166
9167 Define HW-feature flags per architecture.
9168 + commit 8d404a629167d67ed56e45de3e65d1e0b7cdeb24
9169 * random/rand-internal.h (_gcry_rndhw_poll_slow): Add requested length
9170 parameter.
9171 * random/rndhw.c (_gcry_rndhw_poll_slow): Limit accounted bytes to 50%
9172 (or 25% for RDRAND) - this code is moved from caller side.
9173 * random/rndlinux.c (_gcry_rndlinux_gather_random): Move
9174 HWF_INTEL_RDRAND check to _gcry_rndhw_poll_slow.
9175 * src/g10lib.h (HWF_PADLOCK_*, HWF_INTEL_*): Define only if
9176 HAVE_CPU_ARCH_X86.
9177 (HWF_ARM_*): Define only if HAVE_CPU_ARCH_ARM.
9178 (HWF_PPC_*): Define only if HAVE_CPU_ARCH_PPC.
9179 (HWF_S390X_*): Define only if HAVE_CPU_ARCH_S390X.
9180
9181 Add configure option to force enable 'soft' HW feature bits.
9182 + commit 3b34bd6e178614d6021ee7d1140646f7c8ed7519
9183 * configure.ac (force_soft_hwfeatures)
9184 (ENABLE_FORCE_SOFT_HWFEATURES): New.
9185 * src/hwf-x86.c (detect_x86_gnuc): Enable HWF_INTEL_FAST_SHLD
9186 and HWF_INTEL_FAST_VPGATHER if ENABLE_FORCE_SOFT_HWFEATURES enabled.
9187
9188 2021-01-26 NIIBE Yutaka <[email protected]>
9189
9190 ecc: Fix Ed25519 private key handling for preceding ZEROs.
9191 + commit 1b74f633bd3e358fb07a856a70597019980651d2
9192 * cipher/ecc-curves.c (mpi_ec_setup_elliptic_curve): Fill-up or remove
9193 preceding ZEROs correctly, fixing the third argument of mpi_set_opaque.
9194
9195 ecc: Fix initialization of CTX for sign and verify.
9196 + commit 652b102697cbfe2d7bc642fc7374cb21a9cf03e6
9197 * cipher/ecc.c (ecc_sign, ecc_verify): Call
9198 _gcry_pk_util_init_encoding_ctx at first.
9199
9200 2021-01-21 NIIBE Yutaka <[email protected]>
9201
9202 build: Fix build of tests with non-default installation.
9203 + commit fa3420b011c105ca21894489e62c7e882a3ac4dd
9204 * tests/Makefile.am: Add forgotten @LDADD_FOR_TESTS_KLUDGE@.
9205
9206 2021-01-20 Jussi Kivilinna <[email protected]>
9207
9208 Split inline assembly blocks with many memory operands.
9209 + commit 00df9f27181d77166ceb55f319329400bf2e6a48
9210 * cipher/rijndael-aesni.c (aesni_ocb_checksum, aesni_ocb_enc)
9211 (aesni_ocb_dec, _gcry_aes_aesni_ocb_auth): Split assembly blocks
9212 with more than 4 memory operands to smaller blocks.
9213 * cipher/sha512-ssse3-i386.c (W2): Split big assembly block to
9214 three smaller blocks.
9215
9216 tests/basic: fix build on ARM32 when NEON disabled.
9217 + commit 81354e911bfa3e135d3e07f6a8d9e98033cd921a
9218 * tests/basic.c (CLUTTER_VECTOR_REGISTER_NEON)
9219 (CLUTTER_VECTOR_REGISTER_AARCH64): Remove check for __ARM_FEATURE_SIMD32.
9220
9221 kdf: make self-test test-vector array read-only.
9222 + commit 097148bc89ec8c18b9e4795733e0f0b1ae0ecd1d
9223 * cipher/kdf.c (selftest_pbkdf2): Make 'tv[]' constant.
9224
9225 kdf: add missing null-terminator for self-test test-vector array.
9226 + commit c6425a5537294dfe2beaafc9105f7af4ceac677f
9227 * cipher/kdf.c (selftest_pbkdf2): Add null-terminator to TV array.
9228
9229 cipher/bithelp: use __builtin_ctzl when available.
9230 + commit 807827cda3bacf5f475167ee6d34657713111838
9231 * cipher/bithelp.h (_gcry_ctz64): Use __builtin_ctzl if available.
9232
9233 mpi/longlong: make use of compiler provided __builtin_ctz/__builtin_clz.
9234 + commit 477355047e5c75ad2b2238a8716e4646b861184c
9235 * configure.ac (gcry_cv_have_builtin_ctzl, gcry_cv_have_builtin_clz)
9236 (gcry_cv_have_builtin_clzl): New checks.
9237 * mpi/longlong.h (count_leading_zeros, count_trailing_zeros): Use
9238 __buildin_clz[l]/__builtin_ctz[l] if available and bit counting
9239 macros not yet provided by inline assembly.
9240
9241 2021-01-19 Werner Koch <[email protected]>
9242
9243 Release 1.9.0.
9244 + commit 0dc49af9b5371c5e2f766b70c3bede2b10db9f7e
9245
9246
9247 2021-01-19 NIIBE Yutaka <[email protected]>
9248
9249 Fix DSA for FIPS 186-3.
9250 + commit 30ed9593f632c728d918598037358deaeccd1968
9251 * cipher/dsa.c (generate_fips186): Supply INITIAL_SEED to
9252 _gcry_generate_fips186_3_prime.
9253 * tests/fips186-dsa.c (check_dsa_gen_186_2): Add where tv comes from.
9254 (check_dsa_gen_186_3): Implement tests.
9255 * tests/pubkey.c (get_dsa_key_fips186_with_seed_new): Use the qbits
9256 and seed of tests/fips186-dsa.c.
9257
9258 2021-01-19 NIIBE Yutaka <[email protected]>
9259 Tomáš Mráz <[email protected]>
9260
9261 Check if FIPS is operational and error return if not.
9262 + commit ebeae53222648c637907f4b358888fc0e7123dc9
9263 * src/visibility.c (gcry_kdf_derive): Add the check.
9264 (gcry_prime_generate, gcry_prime_group_generator): Likewise.
9265 (gcry_mpi_randomize): Likewise, but no return.
9266
9267 2021-01-18 Werner Koch <[email protected]>
9268
9269 ecc: Change an error code of gcry_ecc_mul_point.
9270 + commit ca5a90bf70598247589078478d237287ca524453
9271 * cipher/ecc-ecdh.c (_gcry_ecc_mul_point): Return
9272 GPG_ERR_UNKNOWN_CURVE.
9273
9274 2021-01-15 NIIBE Yutaka <[email protected]>
9275 Tomáš Mráz <[email protected]>
9276
9277 kdf: Add selftest.
9278 + commit 7a0da24925361a3109474d0e433511467a9e35d1
9279 * src/cipher-proto.h (_gcry_kdf_selftest): New.
9280 * cipher/kdf.c (check_one, selftest_pbkdf2): New.
9281 (_gcry_kdf_selftest): New.
9282 * src/fips.c (run_kdf_selftests): New.
9283 (_gcry_fips_run_selftests): Call run_kdf_selftests.
9284
9285 2021-01-13 NIIBE Yutaka <[email protected]>
9286 Tomáš Mráz <[email protected]>
9287
9288 cmac: Add selftest.
9289 + commit 385a89e35b0b95f15b4c6e4d5482b1fc6906f7c5
9290 * cipher/mac-cmac.c (check_one, selftests_cmac_3des): New.
9291 (selftests_cmac_aes, cmac_selftest): New.
9292 (cmac_ops): Add cmac_selftest.
9293 * src/fips.c (run_mac_selftests): Add CMAC selftests.
9294
9295 2021-01-13 NIIBE Yutaka <[email protected]>
9296
9297 sexp: Raise an error when an integer is negative with USG.
9298 + commit 00d7c1c632019066a4884930d413ccc044d81af5
9299 * src/sexp.c (do_vsexp_sscan): Return GPG_ERR_INV_ARG if negative.
9300
9301 2021-01-08 NIIBE Yutaka <[email protected]>
9302
9303 ecc: Add backward compatibility support for Ed25519 key in SEXP.
9304 + commit 4768baf74be03d8973d004725f796aef329c45bf
9305 * cipher/ecc-curves.c (_gcry_ecc_get_curve): Support Ed25519 keys with
9306 parameter {p,a,b,g,n}.
9307
9308 ecc: Minor implementation change for _gcry_ecc_get_curve.
9309 + commit 3fe7036d05f283df9441d42242f0047b6ea11a32
9310 * cipher/ecc-curves.c (_gcry_ecc_get_curve): Flatten.
9311
9312 2020-12-30 Jussi Kivilinna <[email protected]>
9313
9314 Add s390x/zSeries implementation of Poly1305.
9315 + commit 1f75681cbba895ea2f7ea0637900721f4522e729
9316 * cipher/Makefile.am: Add 'poly1305-s390x.S' and
9317 'asm-poly1305-s390x.h'.
9318 * cipher/asm-poly1305-s390x.h: New
9319 * cipher/chacha20-s390x.S (_gcry_chacha20_poly1305_s390x_vx_blocks8)
9320 (_gcry_chacha20_poly1305_s390x_vx_blocks4_2_1): New, stitched
9321 chacha20-poly1305 implementation.
9322 * cipher/chacha20.c (USE_S390X_VX_POLY1305): New.
9323 (_gcry_chacha20_poly1305_s390x_vx_blocks8)
9324 (_gcry_chacha20_poly1305_s390x_vx_blocks4_2_1): New prototypes.
9325 (_gcry_chacha20_poly1305_encrypt, _gcry_chacha20_poly1305_decrypt): Add
9326 s390x/VX stitched chacha20-poly1305 code-path.
9327 * cipher/poly1305-s390x.S: New.
9328 * cipher/poly1305.c (USE_S390X_ASM, HAVE_ASM_POLY1305_BLOCKS): New.
9329 [USE_S390X_ASM] (_gcry_poly1305_s390x_blocks1, poly1305_blocks): New.
9330 * configure.ac (gcry_cv_gcc_inline_asm_s390x): Check for 'risbgn' and
9331 'algrk' instructions.
9332 * tests/basic.c (_check_poly1305_cipher): Add large chacha20-poly1305
9333 test vector.
9334
9335 Add s390x/zSeries implementation of ChaCha20.
9336 + commit 6a0bb9ab7f886087d7edb0725c90485086a1c0b4
9337 * cipher/Makefile.am: Add 'asm-common-s390x.h' and 'chacha20-s390x.S'.
9338 * cipher/asm-common-s390x.h: New.
9339 * cipher/chacha20-s390x.S: New.
9340 * cipher/chacha20.c (USE_S390X_VX): New.
9341 (CHACHA20_context_t): Change 'use_*' bit-field to unsigned type; Add
9342 'use_s390x'.
9343 (_gcry_chacha20_s390x_vx_blocks8)
9344 (_gcry_chacha20_s390x_vx_blocks4_2_1): New.
9345 (chacha20_do_setkey): Add HW feature detect for s390x/VX.
9346 (chacha20_blocks, do_chacha20_encrypt_stream_tail): Add s390x/VX
9347 code-path.
9348 * configure.ac: Add 'chacha20-s390x.lo'.
9349
9350 hwf-s390x: add VX vector instruction set detection.
9351 + commit 1d13794780e3d052cd5ed6f900bf5900cf44b377
9352 * configure.ac (gcry_cv_gcc_inline_asm_s390x_vx): New check.
9353 * src/g10lib.h (HWF_S390X_VX): New.
9354 * src/hwf-s390x.c (HWCAP_S390_VXRS): New.
9355 (s390x_features) [HAVE_GCC_INLINE_ASM_S390X_VX]: Add VX feature check.
9356 * src/hwfeatures.c (hwlist): Add "s390x-vx".
9357
9358 mpi/longlong: add s390x/zSeries macros.
9359 + commit 0252cc9b62dfe20c77211f093b4fda54786177d3
9360 * mpi/longlong.h [__s390x__] (add_ssaaaa, sub_ddmmss, UTItype)
9361 (umul_ppmm, udiv_qrnnd): New.
9362
9363 2020-12-22 Jussi Kivilinna <[email protected]>
9364
9365 hwf-arm: fix incorrect HWCAP2 for SHA1 and SHA2 on AArch32.
9366 + commit 6b6bfd57d0a6b2b4577c084db35078cd9fadafa5
9367 * src/hwf-arm.c (HWCAP2_SHA1, HWCAP2_SHA2): Change from bit indexes to
9368 flags.
9369
9370 Add missing prototype for _gcry_mac_selftest.
9371 + commit e47f04b4a28947c90db70ccaf93e149cfd5213c9
9372 * src/cipher-proto.h (_gcry_hmac_selftest): Rename to...
9373 (_gcry_mac_selftest): ... this.
9374
9375 2020-12-21 NIIBE Yutaka <[email protected]>
9376
9377 Merge hmac-tests.c into mac-hmac.c.
9378 + commit 2ab14b23afc092fd25395954c2a94db932ca4d95
9379 * cipher/Makefile.am (EXTRA_DIST): Remove hmac-tests.c.
9380 * cipher/hmac-tests.c: Remove, merge into...
9381 * cipher/mac-hmac.c: ... here.
9382
9383 2020-12-18 Jussi Kivilinna <[email protected]>
9384
9385 Add s390x/zSeries acceleration for SHA3.
9386 + commit 7532e27cacb74c92fd561524a0897163b0fcd7f4
9387 * cipher/asm-inline-s390x.h (KLMD_PADDING_STATE): New.
9388 (kimd_execute): Change 'reg0' from read-only to read/write.
9389 (klmd_shake_execute): New.
9390 * cipher/keccak.c (USE_S390X_CRYPTO): New.
9391 (KECCAK_CONTEXT) [USE_S390X_CRYPTO]: New members.
9392 [USE_S390X_CRYPTO] (keccak_bwrite_s390x, keccak_final_s390x)
9393 (keccak_bextract_s390x, keccak_write_s390x, keccak_extract_s390x): New.
9394 (keccak_write) [USE_S390X_CRYPTO]: Use accelerated function if enabled.
9395 (keccak_final) [USE_S390X_CRYPTO]: Likewise.
9396 (keccak_extract) [USE_S390X_CRYPTO]: Likewise.
9397 (keccak_init) [USE_S390X_CRYPTO]: Detect and setup zSeries
9398 acceleration.
9399
9400 Add s390x/zSeries acceleration for SHA512.
9401 + commit 45f0ec0c4e3b08627cbf7e65f5f110c321710d01
9402 * cipher/sha512.c (USE_S390X_CRYPTO): New.
9403 (SHA512_CONTEXT) [USE_S390X_CRYPTO]: New members.
9404 (do_sha512_transform_s390x, do_sha512_final_s390x): New.
9405 (sha512_init_common) [USE_S390X_CRYPTO]: Detect and setup s390x/zSeries
9406 acceleration.
9407 (sha512_final) [USE_S390X_CRYPTO]: Use accelerated final function.
9408
9409 Add s390x/zSeries acceleration for SHA256.
9410 + commit 0b555c3cc7c2b80ec2628685946a6139a1996911
9411 * cipher/sha256.c (USE_S390X_CRYPTO): New.
9412 (SHA256_CONTEXT) [USE_S390X_CRYPTO]: New members.
9413 (do_sha256_transform_s390x, do_sha256_final_s390x): New.
9414 (sha256_common_init) [USE_S390X_CRYPTO]: Detect and setup s390x/zSeries
9415 acceleration.
9416 (sha256_final) [USE_S390X_CRYPTO]: Use accelerated final function.
9417
9418 Add s390x/zSeries acceleration for SHA1.
9419 + commit 88570515b4ca92a44c4e40c31f877c11cc00ab68
9420 * cipher/asm-inline-s390x.h (ALWAYS_INLINE): New.
9421 (klmd_query): New.
9422 (km_function_to_mask, kimd_execute, klmd_execute): Mark as always
9423 inline.
9424 * cipher/rijndael-s390x.c (ALWAYS_INLINE): Remove.
9425 * cipher/sha1.c (do_sha1_transform_s390x, do_sha1_final_s390x): New.
9426 (sha1_init) [SHA1_USE_S390X_CRYPTO]: Detect and setup s390x/zSeries
9427 acceleration.
9428 (sha1_final) [SHA1_USE_S390X_CRYPTO]: Use accelerated final function.
9429 * cipher/sha1.h (SHA1_USE_S390X_CRYPTO): New.
9430 (SHA1_CONTEXT) [SHA1_USE_S390X_CRYPTO]: New.
9431
9432 Add bulk AES-GCM acceleration for s390x/zSeries.
9433 + commit 5aeb091f911398217b2e9facb9bdeb05c63d7844
9434 * cipher/Makefile.am: Add 'asm-inline-s390x.h'.
9435 * cipher/asm-inline-s390x.h: New.
9436 * cipher/cipher-gcm.c [GCM_USE_S390X_CRYPTO] (ghash_s390x_kimd): New.
9437 (setupM) [GCM_USE_S390X_CRYPTO]: Add setup for s390x GHASH function.
9438 * cipher/cipher-internal.h (GCM_USE_S390X_CRYPTO): New.
9439 * cipher/rijndael-s390x.c (u128_t, km_functions_e): Move to
9440 'asm-inline-s390x.h'.
9441 (aes_s390x_gcm_crypt): New.
9442 (_gcry_aes_s390x_setup_acceleration): Use 'km_function_to_mask'; Add
9443 setup for GCM bulk function.
9444
9445 Add bulk function interface for GCM mode.
9446 + commit f4e63e92dc0b79633f48b11d292dd7bdf2752ede
9447 * cipher/cipher-gcm.c (do_ghash_buf): Proper handling for the case
9448 where 'unused' gets filled to full blocksize.
9449 (gcm_crypt_inner): New.
9450 (_gcry_cipher_gcm_encrypt, _gcry_cipher_gcm_decrypt): Use
9451 'gcm_crypt_inner'.
9452 * cipher/cipher-internal.h (cipher_bulk_ops_t): Add 'gcm_crypt'.
9453
9454 Add s390x/zSeries acceleration for AES.
9455 + commit 9219d9d1b60c01a4c7dbde05ee6b5b52e0d7d072
9456 * configure.ac: Add 'rijndael-s390x.lo'.
9457 * cipher/Makefile.am: Add 'rijndael-s390x.c'.
9458 * cipher/rijndael-internal.c (USE_S390X_CRYPTO): New.
9459 (RIJNDAEL_context_s) [USE_S390X_CRYPTO]: New 'km*_func' members.
9460 * cipher/rijndael-s390x.c: New.
9461 * cipher/rijndael.c (_gcry_aes_s390x_setup_acceleration)
9462 (_gcry_aes_s390x_setup_setkey)
9463 (_gcry_aes_s390x_setup_prepare_decryption, _gcry_aes_s390x_encrypt)
9464 (_gcry_aes_s390x_decrypt): New.
9465 (do_setkey) [USE_S390X_CRYPTO]: Add s390x acceleration setup.
9466
9467 Add bulk function interface for OFB mode.
9468 + commit f12b6788f2297391265af93a7794bfbc503de6d7
9469 * cipher/cipher-internal.h (cipher_bulk_ops): Add 'ofb_enc'.
9470 * cipher/cipher-ofb.c (_gcry_cipher_ofb_encrypt): Use bulk encryption
9471 function if defined.
9472 * cipher/basic.c (check_bulk_cipher_modes): Add OFB-AES test vectors.
9473
9474 hwf: add detection of s390x/zSeries hardware features.
9475 + commit 128054767d5f864798a39d432997f7d38c4bf729
9476 * configure.ac (gcry_cv_gcc_inline_asm_s390x)
9477 (HAVE_CPU_ARCH_S390X): Add s390x detection support.
9478 * mpi/config.links: Add setup for s390x links.
9479 * src/Makefile.am: Add 'hwf-s390x.c'.
9480 * src/g10lib.h (HWF_S390X_MSA, HWF_S390X_MSA_4, HWF_S390X_8): New.
9481 * src/hwf_common.h (_gcry_hwf_detect_s390x): New.
9482 * src/hwf-s390x.c: New.
9483 * src/hwfeatures.c: Add "s390x-msa", "s390x-msa-4" and "s390x-msa-8".
9484
9485 tests/bench-slope: use same benchmarking for XTS as for other modes.
9486 + commit 0e37bb32e215feb4716341f7053c4f54806645cb
9487 * tests/bench-slope.c (bench_xts_encrypt_init): Use same buffer
9488 sizes as other tests.
9489 (bench_xts_encrypt_do_bench, bench_xts_decrypt_do_bench): Remove.
9490 (xts_encrypt_ops): Use 'bench_encrypt_do_bench'.
9491 (xts_decrypt_ops): Use 'bench_decrypt_do_bench'.
9492
9493 aarch64: mpi/longlong.h: fix operand size mismatch.
9494 + commit c59b5b03a063ebc73935dbb10bc4f568faddbedf
9495 * mpi/longlong.h [__aarch64__] (count_leading_zeros): Use correctly
9496 sized temporary variable for asm output.
9497
9498 aarch64: use configure check for assembly ELF directives support.
9499 + commit 8352b0ece5237e3f86f1525b072e8f690ad0fa94
9500 * configure.ac (gcry_cv_gcc_asm_elf_directives): New check.
9501 (HAVE_GCC_ASM_ELF_DIRECTIVES): New 'config.h' macro.
9502 * cipher/asm-common-aarch64.h (ELF): Change feature macro check from
9503 __ELF__ to HAVE_GCC_ASM_ELF_DIRECTIVES.
9504
9505 2020-12-18 NIIBE Yutaka <[email protected]>
9506
9507 Reorganize self-tests for HMAC.
9508 + commit c90fb0d8fb7a84bbcc8d6832de6a554405591850
9509 * cipher/Makefile.am: Prepare merge of hmac-test.c into mac-hmac.c.
9510 * cipher/hmac-tests.c: Ifdef-out run_selftests and _gcry_hmac_selftest.
9511 * cipher/mac-internal.h: Include cipher-proto.h for selftest.
9512 (gcry_mac_spec_ops): Add selftest field.
9513 * cipher/mac-hmac.c: Include hmac-tests.c for migration.
9514 (hmac_selftest) New.
9515 (hmac_ops): Add hmac_selftest.
9516 * cipher/gost28147.c, cipher/mac-cmac.c: Add new field for selftest.
9517 * cipher/mac-gmac.c, cipher/mac-poly1305.c: Likewise..
9518 * cipher/mac.c (_gcry_mac_selftest): New.
9519 * src/fips.c (run_mac_selftests): Rename from run_hmac_selftests.
9520 Use GCRY_MAC_HMAC_*, and call _gcry_mac_selftest.
9521 (_gcry_fips_run_selftests): Use run_mac_selftests.
9522
9523 2020-12-03 Jussi Kivilinna <[email protected]>
9524
9525 Prevent link-time optimization from inlining __gcry_burn_stack.
9526 + commit 1a83df98b198902ee6d71549231a3af37088d452
9527 * src/g10lib.h (NOINLINE_FUNC): New attribute macro.
9528 * src/misc.c (__gcry_burn_stack): Add NOINLINE_FUNC attribute.
9529
9530 tests/basic: check 32-bit and 64-bit overflow for CTR and ChaCha20.
9531 + commit 2065720b5b0642cc1a0e08086a434244ebb1abf2
9532 * tests/basic.c (check_one_cipher_ctr_reset)
9533 (check_one_cipher_ctr_overflow): New.
9534 (check_one_cipher): Add counter overflow tests for ChaCha20 and CTR
9535 mode.
9536
9537 chacha20-ppc: fix 32-bit counter overflow handling.
9538 + commit ed45eac3b721c1313902b977379fbd4886ccca7b
9539 * cipher/chacha20-ppc.c (vec_add_ctr_u64, ADD_U64): New.
9540 (_gcry_chacha20_ppc8_blocks1, _gcry_chacha20_ppc8_blocks4)
9541 (_gcry_chacha20_poly1305_ppc8_blocks4): Use ADD_U64 when incrementing
9542 counter.
9543
9544 2020-12-03 NIIBE Yutaka <[email protected]>
9545
9546 tests: Put a work around to tests/random for macOS.
9547 + commit 9769b40b54cf010a0c41c4ab05a7a88e17d70613
9548 * configure.ac [*-apple-darwin*] (USE_POSIX_SPAWN_FOR_TESTS): New.
9549 * tests/random.c [USE_POSIX_SPAWN_FOR_TESTS] (run_all_rng_tests): New.
9550
9551 2020-11-18 NIIBE Yutaka <[email protected]>
9552
9553 build: Update to newer autoconf constructs.
9554 + commit 9485ca7b5bf11194cff59edbfa6a0fba3bf6162a
9555 * acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): Use AS_MESSAGE_LOG_FD
9556 instead of AC_FD_CC.
9557 (GNUPG_CHECK_MLOCK): Use AC_LINK_IFELSE instead of AC_TRY_LINK.
9558 Use AC_RUN_IFELSE instead of AC_TRY_RUN.
9559 * configure.ac (AC_ISC_POSIX): Replace by AC_SEARCH_LIBS.
9560 Use AC_USE_SYSTEM_EXTENSIONS instead of AC_GNU_SOURCE.
9561 Use AS_HELP_STRING instead of AC_HELP_STRING.
9562 (AC_TYPE_SIGNAL): Remove.
9563 (AC_DECL_SYS_SIGLIST): Remove.
9564 * m4/Makefile.am (EXTRA_DIST): Update.
9565 * m4/onceonly.m4: Remove.
9566 * m4/socklen.m4: Update from gnulib.
9567 * m4/libtool.m4: Update from libgpg-error.
9568 * m4/gpg-error.m4: Update from libgpg-error.
9569 * m4/noexecstack.m4: Use AS_HELP_STRING instead of AC_HELP_STRING.
9570
9571 build: Use modern Autoconf check for type.
9572 + commit 425bf499185d78aa8fcad6a30b8771e7865d449d
9573 * configure.ac (byte, ushort, us6, u32, u64): Use AC_CHECK_TYPES.
9574 * cipher/poly1305.c: Use HAVE_TYPE_U64.
9575 * src/hmac256.c: HAVE_TYPE_U32.
9576 * src/types.h: Use HAVE_TYPE_BYTE, HAVE_TYPE_USHORT, HAVE_TYPE_U16,
9577 HAVE_TYPE_U32, and HAVE_TYPE_U64.
9578
9579 m4: Update with newer autoconf constructs.
9580 + commit 908e347fb68b28e180ac816b5050406358e81a0f
9581 * src/libgcrypt.m4: Replace AC_HELP_STRING to AS_HELP_STRING.
9582
9583 2020-10-30 NIIBE Yutaka <[email protected]>
9584
9585 ecc: Handle removed zeros at the beginning for Ed25519.
9586 + commit 361a0588489cf4a539da8debd1771024a1faa218
9587 * cipher/ecc-curves.c (mpi_ec_setup_elliptic_curve): Accept private
9588 key with removed zeros.
9589
9590 2020-10-23 Werner Koch <[email protected]>
9591
9592 random: Allow for a Unicode random seed file on Windows.
9593 + commit 24341f58f0d38bd62c45d285bcf8472f82b56135
9594 * random/random-csprng.c (utf8_to_wchar) [W32]: New.
9595 (any8bitchar) [W32]: New.
9596 (my_open): New. Replace all calls to open with this.
9597
9598 2020-10-01 Tianjia Zhang <[email protected]>
9599
9600 tests: Fix typo in comment.
9601 + commit 4a50c6b88d6d8d843e50add851a8a5e691349097
9602 * tests/basic.c: Fix typo in comment.
9603
9604 2020-09-27 Jussi Kivilinna <[email protected]>
9605
9606 rijndael: clean-up prepare_decryption function.
9607 + commit 2051d5bd6f732a36e5a536cba734531a9e2e915f
9608 * cipher/rijndael-internal.h (rijndael_prepare_decfn_t): New.
9609 (RIJNDAEL_context_s): New member 'prepare_decryption'.
9610 * cipher/rijndael-padlock.c (_gcry_aes_padlock_prepare_decryption): New.
9611 * cipher/rijndael.c (_gcry_aes_padlock_prepare_decryption): New.
9612 (do_setkey): Setup 'ctx->prepare_decryption' for each acceleration type.
9613 (prepare_decryption): Remove calls to other prepare decryption functions.
9614 (check_decryption_preparation): Call 'ctx->prepare_decryption' instead
9615 of 'prepare_decryption'.
9616
9617 rijndael: clean-up generic bulk functions.
9618 + commit 7679c918ade9d334bc80cb8c10916bbc847ff382
9619 * cipher/rijndael.c (_gcry_aes_cfb_enc, _gcry_aes_cbc_enc)
9620 (_gcry_aes_ctr_enc, _gcry_aes_cfb_dec, _gcry_aes_cbc_dec)
9621 (_gcry_aes_ocb_crypt, _gcry_aes_ocb_auth, _gcry_aes_xts_crypt): Remove
9622 calls to hardware accelerated AES bulk functions.
9623
9624 cipher: setup bulk functions at each algorithms key setup.
9625 + commit 51271eb86bcb0eb89e55a2add9607c503f182c89
9626 * cipher/cipher-internal.h (cipher_mode_ops_t, cipher_bulk_ops_t): New.
9627 (gcry_cipher_handle): Define members 'mode_ops' and 'bulk' using new
9628 types.
9629 * cipher/cipher.c (_gcry_cipher_open_internal): Remove bulk function
9630 setup.
9631 (cipher_setkey): Pass context bulk function pointer to algorithm setkey
9632 function.
9633 * cipher/cipher-selftest.c (_gcry_selftest_helper_cbc)
9634 (_gcry_selftest_helper_cfb, _gcry_selftest_helper_ctr): Remove bulk
9635 function parameter; Use bulk function returned by setkey function.
9636 * cipher/cipher-selftest.h (_gcry_selftest_helper_cbc)
9637 (_gcry_selftest_helper_cfb, _gcry_selftest_helper_ctr): Remove bulk
9638 function parameter.
9639 * cipher/arcfour.c (arcfour_setkey): Change 'hd' parameter to
9640 'bulk_ops'.
9641 * cipher/blowfish.c (bf_setkey): Change 'hd' parameter to
9642 'bulk_ops'; Setup 'bulk_ops' with bulk acceleration functions.
9643 (_gcry_blowfish_ctr_enc, _gcry_blowfish_cbc_dec)
9644 (_gcry_blowfish_cfb_dec): Make static.
9645 (selftest_ctr, selftest_cbc, selftest_cfb): Do not pass bulk function
9646 to selftest helper.
9647 (selftest): Pass 'bulk_ops' to setkey function.
9648 * cipher/camellia.c (camellia_setkey): Change 'hd' parameter to
9649 'bulk_ops'; Setup 'bulk_ops' with bulk acceleration functions.
9650 (_gcry_camellia_ctr_enc, _gcry_camellia_cbc_dec)
9651 (_gcry_camellia_cfb_dec, _gcry_camellia_ocb_crypt)
9652 (_gcry_camellia_ocb_auth): Make static.
9653 (selftest_ctr, selftest_cbc, selftest_cfb): Do not pass bulk function
9654 to selftest helper.
9655 (selftest): Pass 'bulk_ops' to setkey function.
9656 * cipher/cast5.c (cast_setkey): Change 'hd' parameter to
9657 'bulk_ops'; Setup 'bulk_ops' with bulk acceleration functions.
9658 (_gcry_cast5_ctr_enc, _gcry_cast5_cbc_dec, _gcry_cast5_cfb_dec): Make
9659 static.
9660 (selftest_ctr, selftest_cbc, selftest_cfb): Do not pass bulk function
9661 to selftest helper.
9662 (selftest): Pass 'bulk_ops' to setkey function.
9663 * cipher/chacha20.c (chacha20_setkey): Change 'hd' parameter to
9664 'bulk_ops'.
9665 * cipher/cast5.c (do_tripledes_setkey): Change 'hd' parameter to
9666 'bulk_ops'; Setup 'bulk_ops' with bulk acceleration functions.
9667 (_gcry_3des_ctr_enc, _gcry_3des_cbc_dec, _gcry_3des_cfb_dec): Make
9668 static.
9669 (bulk_selftest_setkey): Change 'hd' parameter to 'bulk_ops'.
9670 (selftest_ctr, selftest_cbc, selftest_cfb): Do not pass bulk function
9671 to selftest helper.
9672 (do_des_setkey): Change 'hd' parameter to 'bulk_ops'.
9673 * cipher/gost28147.c (gost_setkey): Change 'hd' parameter to
9674 'bulk_ops'.
9675 * cipher/idea.c (idea_setkey): Change 'hd' parameter to 'bulk_ops'.
9676 * cipher/rfc2268.c (do_setkey): Change 'hd' parameter to 'bulk_ops'.
9677 * cipher/rijndael.c (do_setkey): Change 'hd' parameter to
9678 'bulk_ops'; Setup 'bulk_ops' with bulk acceleration functions.
9679 (rijndael_setkey): Change 'hd' parameter to 'bulk_ops'.
9680 (_gcry_aes_cfb_enc, _gcry_aes_cfb_dec, _gcry_aes_cbc_enc)
9681 (_gcry_aes_cbc_dec, _gcry_aes_ctr_enc, _gcry_aes_ocb_crypt)
9682 (_gcry_aes_ocb_auth, _gcry_aes_xts_crypt): Make static.
9683 (selftest_basic_128, selftest_basic_192, selftest_basic_256): Pass
9684 'bulk_ops' to setkey function.
9685 (selftest_ctr, selftest_cbc, selftest_cfb): Do not pass bulk function
9686 to selftest helper.
9687 * cipher/salsa20.c (salsa20_setkey): Change 'hd' parameter to
9688 'bulk_ops'.
9689 * cipher/seed.c (seed_setkey): Change 'hd' parameter to 'bulk_ops'.
9690 * cipher/serpent.c (serpent_setkey): Change 'hd' parameter to
9691 'bulk_ops'; Setup 'bulk_ops' with bulk acceleration functions.
9692 (_gcry_serpent_ctr_enc, _gcry_serpent_cbc_dec, _gcry_serpent_cfb_dec)
9693 (_gcry_serpent_ocb_crypt, _gcry_serpent_ocb_auth): Make static.
9694 (selftest_ctr_128, selftest_cbc_128, selftest_cfb_128): Do not pass
9695 bulk function to selftest helper.
9696 * cipher/sm4.c (sm4_setkey): Change 'hd' parameter to 'bulk_ops'; Setup
9697 'bulk_ops' with bulk acceleration functions.
9698 (_gcry_sm4_ctr_enc, _gcry_sm4_cbc_dec, _gcry_sm4_cfb_dec)
9699 (_gcry_sm4_ocb_crypt, _gcry_sm4_ocb_auth): Make static.
9700 (selftest_ctr_128, selftest_cbc_128, selftest_cfb_128): Do not pass
9701 bulk function to selftest helper.
9702 * cipher/twofish.c (twofish_setkey): Change 'hd' parameter to
9703 'bulk_ops'; Setup 'bulk_ops' with bulk acceleration functions.
9704 (_gcry_twofish_ctr_enc, _gcry_twofish_cbc_dec)
9705 (_gcry_twofish_cfb_dec, _gcry_twofish_ocb_crypt)
9706 (_gcry_twofish_ocb_auth): Make static.
9707 (selftest_ctr, selftest_cbc, selftest_cfb): Do not pass bulk function
9708 to selftest helper.
9709 (selftest, main): Pass 'bulk_ops' to setkey function.
9710 * src/cipher-proto.h: Forward declare 'cipher_bulk_ops_t'.
9711 (gcry_cipher_setkey_t): Replace 'hd' with 'bulk_ops'.
9712 * src/cipher.h: Remove bulk acceleration function prototypes for
9713 'aes', 'blowfish', 'cast5', 'camellia', '3des', 'serpent', 'sm4' and
9714 'twofish'.
9715
9716 2020-09-21 Jussi Kivilinna <[email protected]>
9717
9718 rijndael: tidy do_setkey little bit.
9719 + commit e0829ae648d9d9da67cd8a8fae7aa05774a0d0f7
9720 * cipher/rijndael.c (do_setkey): Reduce number of ifdefs by using
9721 function pointer for accelerated key-setup.
9722
9723 2020-09-18 Jussi Kivilinna <[email protected]>
9724
9725 rijndael-aesni: tweak x86_64 AES-NI for better performance on AMD Zen2.
9726 + commit f96989f0e9085fa58b475131d29b37f68ba564ec
9727 * cipher/rijndael-aesni.c (do_aesni_enc_vec8, do_aesni_dec_vec8): Move
9728 first round key xoring and last round out to caller.
9729 (do_aesni_ctr_4): Change low 8-bit counter overflow check to 8-bit
9730 addition to low-bits and detect overflow from carry flag; Adjust
9731 slow path to restore counter.
9732 (do_aesni_ctr_8): Same as above; Interleave first round key xoring and
9733 first round with CTR generation on fast path; Interleave last round
9734 with output xoring.
9735 (_gcry_aes_aesni_cfb_dec, _gcry_aes_aesni_cbc_dec): Add first round
9736 key xoring; Change order of last round xoring and output xoring
9737 (shorten the dependency path).
9738 (_gcry_aes_aesni_ocb_auth): Add first round key xoring and last round
9739 handling.
9740
9741 2020-08-26 Werner Koch <[email protected]>
9742
9743 build: Allow customization of the signing key.
9744 + commit 9cd92ebae21900e54cc3d8b607c8ed1afbf2eb9b
9745 * Makefile.am (sign-release): Read variabales from user configuration.
9746
9747 2020-08-21 NIIBE Yutaka <[email protected]>
9748
9749 tests: Fix basic.c.
9750 + commit fd51bc523d095168ee9367fe3f18d18f7a88ad90
9751 * tests/basic.c (check_one_hmac): Fix error paths.
9752 (check_pubkey_crypt): Fix wrong call of gcry_sexp_new.
9753
9754 ecc: Fix an error path.
9755 + commit 65a2cd139e21250e6581a4f610015937e7b91451
9756 * cipher/ecc-ecdh.c (_gcry_ecc_mul_point): Avoid null dereference on
9757 error.
9758
9759 2020-07-23 Jussi Kivilinna <[email protected]>
9760
9761 chacha20-aarch64: improve performance through higher SIMD interleaving.
9762 + commit 8d7b1d0a52bde173646e5b42b31d23593eabecf2
9763 * cipher/chacha20-aarch64.S (ROTATE2, ROTATE2_8, ROTATE2_16)
9764 (QUARTERROUND2): Replace with...
9765 (ROTATE4, ROTATE4_8, ROTATE4_16, QUARTERROUND4): ...these.
9766 (_gcry_chacha20_aarch64_blocks4)
9767 (_gcry_chacha20_poly1305_aarch64_blocks4): Adjust to use QUARTERROUND4.
9768
9769 tests/bench-slope: improve CPU frequency auto-detection.
9770 + commit f1c3db3bf40e07cfd1a6a92209865ee7a98129ca
9771 * configure.ac (gcry_cv_have_asm_volatile_memory): Check also if
9772 assembly memory barrier with input/output register is supported.
9773 * tests/bench-slope.c (auto_ghz_bench): Change to use base operation
9774 that takes two CPU cycles and unroll loop by 1024 operations.
9775
9776 Enable jitter entropy also on non-x86 architectures.
9777 + commit 886120f33bd3f10e6e6a09920eca1f9ed81044e7
9778 * configure.ac: Do not force jentsupport to "n/a" on non-x86
9779 architectures.
9780
9781 random/jitterentropy: fix USE_JENT == JENT_USES_GETTIME code path.
9782 + commit 4ed9b949485448816a70d86260d572f08ae34621
9783 * random/jitterentropy-base-user.h (jent_get_nstime): Use 'tv' variable
9784 instead of non-existing 'time'.
9785
9786 Camellia AES-NI/AVX/AVX2 size optimization.
9787 + commit 4c0e244fc53e0f7b927bfe4cf54695b5d282fd27
9788 * cipher/camellia-aesni-avx-amd64.S: Use loop for handling repeating
9789 '(enc|dec)_rounds16/fls16' portions of encryption/decryption.
9790 * cipher/camellia-aesni-avx2-amd64.S: Use loop for handling repeating
9791 '(enc|dec)_rounds32/fls32' portions of encryption/decryption.
9792
9793 2020-07-14 NIIBE Yutaka <[email protected]>
9794
9795 ecc: Support reading EC point in compressed format for good curves.
9796 + commit e0dabf74bf276500257f15b85ded9cf24ccc8334
9797 * cipher/ecc-curves.c (gcry_ecc_get_curve): Handle G, differently.
9798 * cipher/ecc-misc.c (_gcry_ecc_sec_decodepoint): Support compressed
9799 representation of EC point. Rename from _gcry_ecc_os2ec.
9800 * cipher/ecc-sm2.c (_gcry_ecc_sm2_decrypt) Follow the change.
9801 * cipher/ecc.c (ecc_decrypt_raw): Likewise.
9802 * mpi/ec.c (_gcry_mpi_ec_set_point): Likewise.
9803 * src/ec-context.h: API change _gcry_ecc_sec_decodepoint from
9804 _gcry_ecc_os2ec.
9805 * tests/basic.c (check_pubkey): Use compressed representation
9806 for two public keys of NIST P192 and NIST P256.
9807
9808 2020-07-06 Werner Koch <[email protected]>
9809
9810 mpi: Consider +0 and -0 the same in mpi_cmp.
9811 + commit 1f3a92e103d4a8e019d8d022647a2b9fb2681327
9812 * mpi/mpi-cmp.c (do_mpi_cmp): Check size of U an V.
9813
9814 2020-06-23 NIIBE Yutaka <[email protected]>
9815
9816 ecc: Fix length computation.
9817 + commit 1db1dc7945b111b6e20a8420ad38a358316681ab
9818 * cipher/ecc-curves.c (mpi_ec_setup_elliptic_curve): Add one only for
9819 Edwards case.
9820
9821 2020-06-20 Jussi Kivilinna <[email protected]>
9822
9823 Add SM4 x86-64/AES-NI/AVX2 implementation.
9824 + commit 35a78eb248d6bacd2a58477a122a0020d796ce63
9825 * cipher/Makefile.am: Add 'sm4-aesni-avx2-amd64.S'.
9826 * cipher/sm4-aesni-avx2-amd64.S: New.
9827 * cipher/sm4.c (USE_AESNI_AVX2): New.
9828 (SM4_context) [USE_AESNI_AVX2]: Add 'use_aesni_avx2'.
9829 [USE_AESNI_AVX2] (_gcry_sm4_aesni_avx2_ctr_enc)
9830 (_gcry_sm4_aesni_avx2_cbc_dec, _gcry_sm4_aesni_avx2_cfb_dec)
9831 (_gcry_sm4_aesni_avx2_ocb_enc, _gcry_sm4_aesni_avx2_ocb_dec)
9832 (_gcry_sm4_aesni_avx_ocb_auth): New.
9833 (sm4_setkey): Enable AES-NI/AVX2 if supported by HW.
9834 (_gcry_sm4_ctr_enc, _gcry_sm4_cbc_dec, _gcry_sm4_cfb_dec)
9835 (_gcry_sm4_ocb_crypt, _gcry_sm4_ocb_auth) [USE_AESNI_AVX2]: Add
9836 AES-NI/AVX2 bulk functions.
9837 * configure.ac: Add ''sm4-aesni-avx2-amd64.lo'.
9838
9839 Add SM4 x86-64/AES-NI/AVX implementation.
9840 + commit c9a3f1bb91e63033e3bf3e06bdd6075622626d0d
9841 * cipher/Makefile.am: Add 'sm4-aesni-avx-amd64.S'.
9842 * cipher/sm4-aesni-avx-amd64.S: New.
9843 * cipher/sm4.c (USE_AESNI_AVX, ASM_FUNC_ABI): New.
9844 (SM4_context) [USE_AESNI_AVX]: Add 'use_aesni_avx'.
9845 [USE_AESNI_AVX] (_gcry_sm4_aesni_avx_expand_key)
9846 (_gcry_sm4_aesni_avx_crypt_blk1_8, _gcry_sm4_aesni_avx_ctr_enc)
9847 (_gcry_sm4_aesni_avx_cbc_dec, _gcry_sm4_aesni_avx_cfb_dec)
9848 (_gcry_sm4_aesni_avx_ocb_enc, _gcry_sm4_aesni_avx_ocb_dec)
9849 (_gcry_sm4_aesni_avx_ocb_auth, sm4_aesni_avx_crypt_blk1_8): New.
9850 (sm4_expand_key) [USE_AESNI_AVX]: Use AES-NI/AVX key setup.
9851 (sm4_setkey): Enable AES-NI/AVX if supported by HW.
9852 (_gcry_sm4_ctr_enc, _gcry_sm4_cbc_dec, _gcry_sm4_cfb_dec)
9853 (_gcry_sm4_ocb_crypt, _gcry_sm4_ocb_auth) [USE_AESNI_AVX]: Add
9854 AES-NI/AVX bulk functions.
9855 * configure.ac: Add ''sm4-aesni-avx-amd64.lo'.
9856
9857 Optimizations for SM4 cipher.
9858 + commit 81fee26bbbae820a311a3ce3ac55e304655c2acd
9859 * cipher/cipher.c (_gcry_cipher_open_internal): Add SM4 bulk
9860 functions.
9861 * cipher/sm4.c (ATTR_ALIGNED_64): New.
9862 (sbox): Convert to ...
9863 (sbox_table): ... this structure for sbox hardening as is done
9864 for AES and GCM.
9865 (prefetch_sbox_table): New.
9866 (sm4_t_non_lin_sub): Make inline; Optimize sbox access pattern.
9867 (sm4_key_lin_sub): Make inline; Tune slightly.
9868 (sm4_key_sub, sm4_enc_sub): Make inline.
9869 (sm4_round): Make inline; Take 'x' as separate parameters instead
9870 of array.
9871 (sm4_expand_key): Return void; Drop keylen; Unroll loops by 4;
9872 Wipe sensitive variables at end; Move key-length check to
9873 'sm4_setkey'.
9874 (sm4_setkey): Add initial self-test step; Add key-length check;
9875 Remove burn stack (as variables wiped in 'sm4_expand_key').
9876 (sm4_do_crypt): Return burn stack depth; Unroll loops by 4.
9877 (sm4_encrypt, sm4_decrypt): Prefetch sbox table; Return burn
9878 stack from 'sm4_do_crypt', as allows tail-call optimization
9879 by compiler.
9880 (sm4_do_crypt_blks2): New two parallel block function for greater
9881 instruction level parallelism.
9882 (sm4_crypt_blocks, _gcry_sm4_ctr_enc, _gcry_sm4_cbc_dec)
9883 (_gcry_sm4_cfb_dec, _gcry_sm4_ocb_crypt, _gcry_sm4_ocb_auth): New
9884 bulk processing functions.
9885 (selftest_ctr_128, selftest_cbc_128, selftest_cfb_128): New
9886 bulk processing self-tests.
9887 (sm4_selftest): Clear SM4 context before use; Use 'sm4_expand_key'
9888 instead of 'sm4_setkey'; Call bulk processing self-tests.
9889 * src/cipher.h (_gcry_sm4_ctr_enc, _gcry_sm4_ctr_dec)
9890 (_gcry_sm4_cfb_dec, _gcry_sm4_ocb_crypt, _gcry_sm4_ocb_auth): New.
9891 * tests/basic.c (check_ocb_cipher): Add SM4-OCB test vector.
9892
9893 2020-06-18 NIIBE Yutaka <[email protected]>
9894
9895 ecc: For Ed448, it's only for EdDSA.
9896 + commit a6177e1bc948a7af052d62bcd62aa6b5825bfaff
9897 * cipher/ecc.c (ecc_sign): Ed448 is only for EdDSA.
9898 Hash algo is determined by the curve.
9899 (ecc_verify): Likewise.
9900 * tests/t-ed448.c (one_test): Don't specify (flags eddsa).
9901 Don't specify hash-algo.
9902
9903 ecc: Fix the condition for EdDSA data handling.
9904 + commit f2847d56cce2afdd993f797812a673495a41c234
9905 * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi): It may be
9906 the encoding context which determines EdDSA. Hash-algo can be
9907 omitted. Flags are OR-ed.
9908
9909 ecc: Support EdDSA with context and enabling PH(M).
9910 + commit ba78ad8f19674b94edfdf4998f40feee081481bc
9911 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_compute_h_d): Simplify.
9912 (DOM4_0_NONE, DOM4_0_NONE_LEN): Remove.
9913 (DOM25519, DOM25519_LEN): New.
9914 (DOM448, DOM448_LEN): New.
9915 (_gcry_ecc_eddsa_sign): Support EdDSA with context and PH.
9916 (_gcry_ecc_eddsa_verify): Likewise.
9917 * tests/t-ed448.c: Add tests with context and PH=1.
9918 * tests/t-ed448.inp: Add test data.
9919
9920 ecc: Change EdDSA internal API.
9921 + commit 2856ac14ae3e4c9e6288e1f0d8bc1945bb874081
9922 * cipher/ecc-common.h (_gcry_ecc_eddsa_sign): Last arg is CTX.
9923 (_gcry_ecc_eddsa_verify): Ditto.
9924 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_sign): Get hash algo from CTX.
9925 (_gcry_ecc_eddsa_verify): Ditto.
9926 * cipher/ecc.c (ecc_sign, ecc_verify): Follow the change.
9927
9928 2020-06-17 NIIBE Yutaka <[email protected]>
9929
9930 ecc: Support "label" for EdDSA context in data.
9931 + commit 1cf49754694611620fd383327cf127e91f6883df
9932 * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi): Handle ctx->label.
9933
9934 ecc: Initialize key before handling data.
9935 + commit d51a9c259d49c63121fab48bce48d826e9b57733
9936 * cipher/ecc.c (ecc_sign): Initialize key at first.
9937 (ecc_verify): Likewise.
9938
9939 ecc: Add new flag "prehash".
9940 + commit 9a640eba6dd7504c90a65151cdaf1e4093a8b475
9941 * src/cipher.h (PUBKEY_FLAG_PREHASH): New.
9942 * cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist): Parse it.
9943
9944 ecc: No (flags eddsa) required for Ed448.
9945 + commit b1721f9b291a4c226caa2bfbe4fefe8fde5216e0
9946 * cipher/ecc.c (check_secret_key): Ed448 means EdDSA.
9947 (ecc_generate): Likewise.
9948 * tests/t-ed448.c (one_test): Remove the flag in key.
9949
9950 ecc: Support Ed448 by _gcry_ecc_compute_public.
9951 + commit 5585ee4947082f932ee01d93dfe295c769e96671
9952 * cipher/ecc-misc.c (_gcry_ecc_compute_public): Handle Ed448.
9953
9954 2020-06-16 Tianjia Zhang <[email protected]>
9955
9956 tests: Add basic test-vectors for SM4.
9957 + commit c1535d0b8797e9b3bbfb5193b6ab23bf788ffd36
9958 * tests/basic.c (check_ciphers): Add SM4 check and test-vectors.
9959
9960 Add SM4 symmetric cipher algorithm.
9961 + commit ddcce166ab8bc6f51f5b509bcbea13a8746384ec
9962 * cipher/Makefile.am (EXTRA_libcipher_la_SOURCES): Add sm4.c.
9963 * cipher/cipher.c (cipher_list, cipher_list_algo301): Add
9964 _gcry_cipher_spec_sm4.
9965 * cipher/mac-cmac.c (map_mac_algo_to_cipher): Add cmac SM4.
9966 (_gcry_mac_type_spec_cmac_sm4): Add cmac SM4.
9967 * cipher/mac-internal.h: Declare spec_cmac_sm4.
9968 * cipher/mac.c (mac_list, mac_list_algo201): Add cmac SM4.
9969 * cipher/sm4.c: New.
9970 * configure.ac (available_ciphers): Add sm4.
9971 * doc/gcrypt.texi: Add SM4 document.
9972 * src/cipher.h: Add declarations for SM4 and cmac SM4.
9973 * src/gcrypt.h.in (gcry_cipher_algos): Add algorithm ID for SM4.
9974
9975 2020-06-16 Jussi Kivilinna <[email protected]>
9976
9977 doc: add GCRY_MD_SM3, GCRY_MAC_HMAC_SM3 and GCRY_MAC_GOST28147_IMIT.
9978 + commit 6c571bfda6409d7d668f5d44cea0c6c31e2688be
9979 * doc/gcrypt.texi: add GCRY_MD_SM3, GCRY_MAC_HMAC_SM3 and
9980 GCRY_MAC_GOST28147_IMIT.
9981
9982 2020-06-16 NIIBE Yutaka <[email protected]>
9983
9984 ecc: Fix Ed448 key generation.
9985 + commit c15cc1a38199cf0d758579eb01d0e88c99cd4b80
9986 * cipher/ecc.c (ecc_generate): Fix point representation for Ed448.
9987
9988 ecc,test: Add testing Ed448.
9989 + commit c7779e499e9051ee79ed720f576dbf40d90cdfb1
9990
9991
9992 ecc: Support Ed448 for verify.
9993 + commit d1baad35c65030e41fcba69854c57032eee0d111
9994 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_verify): Support Ed448.
9995
9996 ecc: Support Ed448 signing.
9997 + commit 951b37c5038667b461692454397bb058b5e1e184
9998 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_sign): Support Ed448.
9999
10000 ecc: Use SHAKE256 in EdDSA with Ed448.
10001 + commit 32d6d73d44d372dd1ec0b08ba03f1b7b085c09d9
10002 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_compute_h_d): Fix for SHAKE256.
10003
10004 ecc: Support shake128 and shake256 for message digest.
10005 + commit f6815a96e51be44a361ddcd3a20a5b969b1dab1b
10006 * cipher/pubkey-util.c (get_hash_algo): Add shake128 and shake256.
10007
10008 ecc: Support Ed448 for key generation.
10009 + commit e25446ecc04442b399302ce72db6d5ea2e9e85e8
10010 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_compute_h_d): Support Ed448.
10011 (_gcry_ecc_eddsa_genkey): Support Ed448, using
10012 _gcry_ecc_eddsa_compute_h_d.
10013
10014 ecc: Support Ed448 in decoding point.
10015 + commit bd22b029bbf50737f90535c506fba4f812bcf040
10016 * cipher/ecc-eddsa.c (ecc_ed448_recover_x): New.
10017 (_gcry_ecc_eddsa_recover_x): Support Ed448.
10018 (_gcry_ecc_eddsa_decodepoint): Support Ed448.
10019 * mpi/ec.c (_gcry_mpi_ec_decode_point): For Ed448, use
10020 _gcry_ecc_eddsa_decodepoint.
10021
10022 ecc: Add new curve: Ed448.
10023 + commit 339b03acf0971a31997901dd674fb75c4dde31d0
10024 * cipher/ecc-curves.c (curve_aliases): Add Ed448.
10025 (domain_parms): Add domain parameters for Ed448.
10026 * tests/curves.c (N_CURVES): Increment.
10027
10028 ecc: Fix EdDSA encoding for Ed448.
10029 + commit 3386aaf84d4d89b6ff931533df2ff82ed3f7c7f9
10030 * cipher/ecc-curves.c (mpi_ec_setup_elliptic_curve): Fix point/scalar
10031 length condition.
10032 * cipher/ecc-eddsa.c (eddsa_encodempi): The second argument is NBITS.
10033 (eddsa_encode_x_y): Likewise.
10034 (_gcry_ecc_eddsa_encodepoint): Follow the change.
10035 (_gcry_ecc_eddsa_ensure_compact): Likewise.
10036 (_gcry_ecc_eddsa_decodepoint): Likewise.
10037 (_gcry_ecc_eddsa_sign): Likewise. Remove restriction of 256 bits.
10038
10039 2020-06-12 NIIBE Yutaka <[email protected]>
10040
10041 ecc: Fix NBITS in domain_parms.
10042 + commit db7b2c591004868abedbc2c19d3bb2efebf8529d
10043 * cipher/ecc-curves.c (cipher/ecc-curves.c): It's NBITS of 'p'.
10044
10045 2020-06-08 Jussi Kivilinna <[email protected]>
10046
10047 rijndael: fix UBSAN warning on left shift by 24 places with type 'int'
10048 + commit 6cdd7268fe19b066ddb373e2f3c0b7ebf9b938dd
10049 * cipher/rijndael.c (do_encrypt_fn, do_decrypt_fn): Cast final
10050 sbox/inv_sbox look-ups to 'u32' type.
10051
10052 Disable all assembly modules with --disable-asm.
10053 + commit 3060aadec396802af13f08c4b2dd1b28f2a68c5d
10054 * configure.ac (try_asm_modules): Update description,
10055 "MPI" => "MPI and cipher".
10056 (gcry_cv_gcc_arm_platform_as_ok, gcry_cv_gcc_aarch64_platform_as_ok)
10057 (gcry_cv_gcc_inline_asm_ssse3, gcry_cv_gcc_inline_asm_pclmul)
10058 (gcry_cv_gcc_inline_asm_shaext, gcry_cv_gcc_inline_asm_sse41)
10059 (gcry_cv_gcc_inline_asm_avx, gcry_cv_gcc_inline_asm_avx2)
10060 (gcry_cv_gcc_inline_asm_bmi2, gcry_cv_gcc_amd64_platform_as_ok)
10061 (gcry_cv_gcc_platform_as_ok_for_intel_syntax)
10062 (gcry_cv_cc_arm_arch_is_v6, gcry_cv_gcc_inline_asm_neon)
10063 (gcry_cv_gcc_inline_asm_aarch32_crypto)
10064 (gcry_cv_gcc_inline_asm_aarch64_neon)
10065 (gcry_cv_gcc_inline_asm_aarch64_crypto)
10066 (gcry_cv_cc_ppc_altivec, gcry_cv_gcc_inline_asm_ppc_altivec)
10067 (gcry_cv_gcc_inline_asm_ppc_arch_3_00): Check for "try_asm_modules".
10068 * mpi/config.links: Set "mpi_cpu_arch" to "disabled"
10069 with --disable-asm.
10070
10071 2020-06-05 Dmitry Eremin-Solenikov <[email protected]>
10072
10073 mpicalc: fix typo.
10074 + commit 2dd3e27fc53cf408f799d2e7b379c1441e0d62c8
10075 * src/mpicalc.c (print_help): fix typo in commands description.
10076
10077 2020-06-04 NIIBE Yutaka <[email protected]>
10078
10079 mpi: Fix flags in mpi_copy for opaque MPI.
10080 + commit 78a5a1aa7627afaa24e2ea1eb9b08f1cfdd71561
10081 * mpi/mpiutil.c (_gcry_mpi_copy): Copy flags.
10082
10083 2020-06-03 NIIBE Yutaka <[email protected]>
10084
10085 ecc: Use opaque MPI for 'd' of Ed25519/EdDSA.
10086 + commit 0d8346f84a1f5865da3375ce92420d92fb5ae652
10087 * cipher/ecc-curves.c (mpi_ec_setup_elliptic_curve): Add FLAGS.
10088 Use opaque MPI for Ed25519/EdDSA, too.
10089 (_gcry_mpi_ec_internal_new): Follow the change.
10090 (_gcry_mpi_ec_new): Likewise.
10091
10092 2020-06-01 Jussi Kivilinna <[email protected]>
10093
10094 cipher-ocb: fix out-of-array stack memory access.
10095 + commit 8cfaeae42522778052c36fceccab504826a30cbf
10096 * cipher/cipher-ocb.c (bit_copy): Do not access memory beyond
10097 's' array when bitoff > 8.
10098
10099 2020-06-01 NIIBE Yutaka <[email protected]>
10100
10101 mpi: More fix of off-by-one mistake mpi_invm_pow2.
10102 + commit 6a2cd0fe78a9cdc78911694a84b08762dd8658b4
10103 * mpi/mpi-inv.c (mpi_invm_pow2): Avoid out-of-band read/write.
10104
10105 ecc: Consistently handle parameters as unsigned value.
10106 + commit 6f8b1d4cb798375e6d830fd6b73c71da93ee5f3f
10107 * cipher/ecc-curves.c (_gcry_ecc_get_curve): Parse as unsigned value.
10108
10109 2020-05-27 NIIBE Yutaka <[email protected]>
10110
10111 sexp: Fix coding of line break.
10112 + commit 33c972b6a6fe79aacb0a732d1df9a9deacafca29
10113 * src/sexp.c (_gcry_sexp_vextract_param): Add missing newline.
10114
10115 2020-05-14 NIIBE Yutaka <[email protected]>
10116
10117 ecc: Make sure it's the fixed size bytes.
10118 + commit eb2288f3b1f338a9aec11d559ec84bdb201960e1
10119 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_decodepoint): Checking the size
10120 of EC point representation, return GPG_ERR_INV_OBJ if not valid.
10121
10122 2020-05-13 Werner Koch <[email protected]>
10123
10124 ecc: Detect the use of a Montgomery curve earlier in ecc_verify.
10125 + commit d0f995afe2e0228d3b9e30b0fc7091631d7d0090
10126 * cipher/ecc.c (ecc_verify): Do not allow a Montgomery curve.
10127
10128 2020-05-13 NIIBE Yutaka <[email protected]>
10129
10130 mpi: Fix off-by-one mistake mpi_invm_pow2.
10131 + commit 69b55f87053ce2494cd4b38dc600f867bc4355be
10132 * mpi/mpi-inv.c (mpi_invm_pow2): Avoid out-of-band read/write.
10133
10134 2020-05-12 Werner Koch <[email protected]>
10135
10136 ecc: Initialize a dummy parameter.
10137 + commit 75a7b17878e02c3882070d6c86e0d2efbc3d680a
10138 * cipher/ecc.c (ecc_verify): Rename flags to dummy_flags and
10139 initialize.
10140
10141 2020-05-06 Dmitry Eremin-Solenikov <[email protected]>
10142
10143 tests/benchmark.c: fix error message for invalid MAC algo.
10144 + commit 79e196a610b1b734a1f573288b148d62787f5281
10145
10146
10147 2020-04-27 Tianjia Zhang <[email protected]>
10148
10149 ecc: Fix typo error in ecc-gost.
10150 + commit fe688ce7e14f14d7d3a7e16aa0304d24b5b1a179
10151 * cipher/ecc-gost.c (_gcry_ecc_gost_verify): Fix typo in comment.
10152
10153 2020-04-27 NIIBE Yutaka <[email protected]>
10154
10155 mpi: Fix the return value of mpi_invm_generic.
10156 + commit f10eb240a30ac115cfeb63848c67a936e1059ab9
10157 * mpi/mpi-inv.c (mpi_invm_generic): Return correct value.
10158
10159 2020-04-24 NIIBE Yutaka <[email protected]>
10160
10161 mpi: Fix return value of mpi_invm_generic.
10162 + commit bc3b6a6a45cf9fa6cc0556da870628c53570f52f
10163 * mpi/mpi-inv.c (mpi_invm_generic): Return 0 if inverse does not exist.
10164
10165 mpi: More use of mpih API for _gcry_mpi_invm.
10166 + commit 559ba9b36c9cdf4762d28beb3b4c59665c671818
10167 * mpi/mpi-inv.c (mpi_invm_pow2): Remove.
10168 (_gcry_mpi_invm): Use mpih_invm_pow2 instead.
10169
10170 mpi: Use mpih interface internally for mpi-inv.
10171 + commit beefbb90d71d7fbd0b4429472b7d4b39670ff64b
10172 * mpi/mpi-inv.c (mpih_invm_pow2): Converted from mpi_invm_pow2.
10173 (mpi_invm_pow2): Use mpih_invm_pow2.
10174
10175 mpi: Fix size of A in mpi_invm_pow2.
10176 + commit efa5151ea1c2a2c049b2651581e71b6becba4e16
10177 * mpi/mpi-inv.c (mpi_invm_pow2): Fix size of A.
10178
10179 2020-04-23 NIIBE Yutaka <[email protected]>
10180
10181 mpi: More fix for _gcry_mpi_invm.
10182 + commit f81a1dd7317513000e5bc4d1bfffd6d2bfb8c2a2
10183 * mpi/mpi-inv.c (_gcry_mpi_invm): Fix comments and use of CRT path.
10184
10185 2020-04-22 NIIBE Yutaka <[email protected]>
10186
10187 mpi: Fix off-by-one mistake mpi_invm_pow2.
10188 + commit 3bb9f74764b3626ed1116fc7e517921232d6be54
10189 * mpi/mpi-inv.c (mpi_invm_pow2): Fix computation of iterations.
10190
10191 2020-04-21 NIIBE Yutaka <[email protected]>
10192
10193 mpi: Use mpi_invm_pow2 for mpi_invm.
10194 + commit bac01a6cfb3d645ff8439cbd3b310d255735d792
10195 * mpi/mpi-inv.c (_gcry_mpi_invm): Use mpi_invm_pow2.
10196
10197 mpi: Fix mpi_invm_pow2.
10198 + commit 2a3c58a0b4db01c17da0bf8c035fb1def2af114c
10199 * mpi/mpi-inv.c (mpi_invm_pow2): Fix the algo implementation.
10200
10201 2020-04-19 Dmitry Baryshkov <[email protected]>
10202
10203 gost28147: implement special MAC mode called imitovstavka (IMIT)
10204 + commit 45f21f871982753716d4a7676d948e8c7d644db5
10205 * src/gcrypt.h.in (GCRY_MAC_GOST28147_IMIT): New.
10206 * cipher/gost28147.c (gost_imit_open, gost_imit_close)
10207 (gost_imit_setkey, gost_imit_setiv, gost_imit_reset, _gost_imit_block)
10208 (gost_imit_block, gost_imit_write, gost_imit_finish, gost_imit_read)
10209 (gost_imit_verify, gost_imit_get_maclen, gost_imit_get_keylen)
10210 (gost_imit_set_extra_info): New functions implementing GOST 28147-89
10211 MAC (imitovstavka, IMIT) mode.
10212 * cipher/gost28147.c (gost_imit_ops)
10213 (_gcry_mac_type_spec_gost28147_imit): declare GOST 28147-89 IMIT
10214 handler.
10215 * cipher/mac-internal.h (gcry_mac_handle): add fields to support GOST
10216 28147-89 IMIT mode.
10217 * cipher/mac.c (mac_list): add _gcry_mac_type_spec_gost28147_imit.
10218 (spec_from_algo): handle GCRY_MAC_GOST28147_IMIT.
10219 * tests/basic.c (check_mac): add GOST28147-89 IMIT test vector.
10220
10221 mac: add support for gcry_mac_ctl(GCRYCTL_SET_SBOX)
10222 + commit d7fa70ed9ddc6e0189a8b59016b1f17717a26865
10223 * cipher/mac-internal.h (gcry_mac_spec_ops_t): add set_extra_info field
10224 for providing additional settings.
10225 * cipher/mac.c (_gcry_mac_ctl): support GCRYCTL_SET_SBOX call.
10226 * cipher/mac-cmac.c (cmac_ops): set set_extra_info to NULL.
10227 * cipher/mac-gmac.c (gmac_ops): the same.
10228 * cipher/mac-hmac.c (hmac_ops): the same.
10229 * cipher/mac-poly1305.c (poly1305mac_ops): the same.
10230
10231 2020-04-17 NIIBE Yutaka <[email protected]>
10232
10233 mpi: Use mpi_invm_pow2 for N=2^k.
10234 + commit 469e2fefb64e3a4bd80995935f82caf416e3a4ae
10235 * mpi/mpi-inv.c (mpi_invm_pow2): Fix.
10236 (_gcry_mpi_invm): Use mpi_invm_pow2.
10237
10238 mpi: Rewrite mpi_invm_odd into mpih_invm_odd.
10239 + commit 05ceac8e2f6f28f97428c005d0a318d71d7cf9d9
10240 * mpi/mpi-inv.c (mpih_invm_odd): Use mpi_ptr_t API.
10241 (_gcry_mpi_invm): Use _gcry_mpih_mod and mpih_invm_odd.
10242
10243 mpi: Add _gcry_mpih_cmp_ui.
10244 + commit 128045a12139fe2e4be877df59da10c7d4857d9a
10245 * mpi/mpih-const-time.c (_gcry_mpih_cmp_ui): New.
10246
10247 mpi: Add internal functipn mpi_invm_pow2.
10248 + commit 515bd6e9fae448e966f71e23635503716201158d
10249 * mpi/mpi-inv.c (mpi_invm_pow2): New.
10250
10251 2020-04-16 NIIBE Yutaka <[email protected]>
10252
10253 mpi: Add mpi_set_bit_cond.
10254 + commit a91bd0211c4e5f0ce575b3a63a36049dd9edbf90
10255 * mpi/mpiutil.c (_gcry_mpi_set_bit_cond): New.
10256 * src/mpi.h (mpi_set_bit_cond): New macro.
10257 (_gcry_mpi_set_bit_cond): New.
10258
10259 mpi: Add _gcry_mpih_mod.
10260 + commit 95bdfd9ce9e114f447f3639e551e8f4f63d024fe
10261 * mpi/mpi-internal.h (mpih_mod, _gcry_mpih_mod): New.
10262 * mpi/mpih-const-time.c (_gcry_mpih_mod): New.
10263
10264 mpih: Expose const-time MPI helper functions.
10265 + commit 9b7e0d89006fce0641da05d8ef2696b1fb73145b
10266 * mpi/Makefile.am (libmpi_la_SOURCES): Add mpih-const-time.c.
10267 * mpi/ec.c (mpih_set_cond): Move to mpih-const-time.c.
10268 * mpi/mpi-internal.h: Add macros and declarations.
10269 * mpi/mpi-inv.c (mpih_add_n_cond): Likewise.
10270 (mpih_sub_n_cond, mpih_swap_cond, mpih_abs_cond): Likewise.
10271 * mpi/mpih-const-time.c: New.
10272
10273 2020-04-14 Werner Koch <[email protected]>
10274
10275 sexp: Extend gcry_sexp_extract_param with a multi-string extractor.
10276 + commit 32b08e38628b3ed409054db05a7f73b1ab86464a
10277 * src/sexp.c (_gcry_sexp_vextract_param): Implement "%#s" control
10278 sequence.
10279
10280 2020-04-14 NIIBE Yutaka <[email protected]>
10281
10282 ecc: Remove hard-coded value for ECC_DIALECT_ED25519.
10283 + commit 0ff36e04f7cdef961610e7bc674a9c9ef0fd4853
10284 * mpi/ec.c (ec_p_init): Remove special handling for Ed25519.
10285 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_encodepoint): Fix assumption
10286 ec->nbits is 256 for EdDSA.
10287 (_gcry_ecc_eddsa_decodepoint): Likewise.
10288 (_gcry_ecc_eddsa_verify): Likewise.
10289
10290 2020-04-09 Werner Koch <[email protected]>
10291
10292 sexp: Extend gcry_sexp_extract_param with new format specifiers.
10293 + commit 60c179b59e538aebb3a5f7621d92eee60b90c785
10294 * src/sexp.c (_gcry_sexp_vextract_param): Add new conversion methods.
10295 * tests/t-sexp.c (check_extract_param): Add corresponding tests.
10296
10297 2020-04-04 Jussi Kivilinna <[email protected]>
10298
10299 ppc: avoid using vec_vsx_ld/vec_vsx_st for 2x64-bit vectors.
10300 + commit 1250a9cd859d99f487ca8d76a98d70d464324bbe
10301 * cipher/crc-ppc.c (CRC_VEC_U64_LOAD, CRC_VEC_U64_LOAD_LE)
10302 (CRC_VEC_U64_LOAD_BE): Remove vec_vsx_ld usage.
10303 (asm_vec_u64_load, asm_vec_u64_load_le): New.
10304 * cipher/sha512-ppc.c (vec_vshasigma_u64): Use '__asm__' instead of
10305 'asm' for assembly block.
10306 (vec_u64_load, vec_u64_store): New.
10307 (_gcry_sha512_transform_ppc8): Use vec_u64_load/store instead of
10308 vec_vsx_ld/vec_vsx_st.
10309 * configure.ac (gcy_cv_cc_ppc_altivec)
10310 (gcy_cv_cc_ppc_altivec_cflags): Add check for vec_vsx_ld with
10311 'unsigned int *' pointer type.
10312
10313 2020-04-02 Jussi Kivilinna <[email protected]>
10314
10315 asm-poly1305-aarch64: fix building with clang.
10316 + commit 89b3ded8df969fe5fb31313c60419dd34d36b605
10317 * cipher/asm-poly1305-aarch64.h (POLY1305_BLOCK_PART25): Use correct
10318 instruction format for right-shifting.
10319
10320 2020-03-31 Daniel Kahn Gillmor <[email protected]>
10321
10322 libgcrypt.m4: Fix spelling.
10323 + commit 6a5743469a4366b1e238d378e427442f04400950
10324
10325
10326 libgcrypt.m4: Fix spelling.
10327 + commit e16e7e619183f36720d17855419860d1dc6fe3a5
10328
10329
10330 2020-03-20 Dmitry Baryshkov <[email protected]>
10331
10332 tests/basic: add GOST 28147 keymeshing testcase from LibreSSL testsuite.
10333 + commit 3441f4c94c49a589c5e323b1526d2d6b5974cf2f
10334 * tests/basic.c (check_cfb_cipher): add check for GOST 28147 CFB with
10335 KeyMeshing enabled.
10336
10337 gost28147: add support for CryptoPro key meshing per RFC 4357.
10338 + commit dcee00adbd1c0a2cde1aeed1bb94421e81d0de3b
10339 * cipher/gost28147.c (gost_do_set_sbox, cryptopro_key_meshing,
10340 CryptoProMeshingKey, gost_encrypt_block_mesh): New.
10341 (_gcry_cipher_spec_gost28147_mesh): New cipher with keymeshing,
10342 (_gcry_cipher_spec_gost28147): Remove OIDs for this cipher should not
10343 be selected using these OIDs (they are for CFB with keymeshing).
10344
10345 * cipher/cipher.c (cipher_list, cipher_list_algo301): add
10346 _gcry_cipher_spec_gost28147_mesh.
10347
10348 * src/gcrypt.h.in (GCRY_CIPHER_GOST28147_MESH): New cipher with
10349 keymeshing.
10350
10351 * doc/gcrypt.texi (GCRY_CIPHER_GOST28147_MESH): Add definition.
10352
10353 * tests/basic.c (check_gost28147_cipher, check_gost28147_cipher_basic):
10354 Run basic tests on GCRY_CIPHER_GOST28147_MESH.
10355
10356 gost: add keymeshing support per RFC 4357.
10357 + commit 18cd3f0c473ae909cdaa5a820faef50d7670fcbb
10358 * cipher/gost-s-box.c (gost_sbox): define if keymeshing should be
10359 enabled or not.
10360 (main): output whether we should enable or disable keymeshing for a
10361 particular parameters set.
10362
10363 2020-03-18 NIIBE Yutaka <[email protected]>
10364
10365 DSA,ECDSA: Fix use of mpi_invm.
10366 + commit ada758e3019c2585213a132960613b1ac48502b8
10367 * cipher/dsa.c (sign): Call mpi_invm before _gcry_dsa_modify_k.
10368 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_sign): Likewise.
10369
10370 mpi: Constant time mpi_inv with some conditions.
10371 + commit 20082ca965eab5665af60956c4ed72709836b1ed
10372 * mpi/mpi-inv.c (mpih_add_n_cond, mpih_sub_n_cond, mpih_swap_cond)
10373 (mpih_abs_cond): New.
10374 (mpi_invm_odd): New.
10375 (mpi_invm_generic): Rename from _gcry_mpi_invm.
10376 (_gcry_mpi_invm): Use mpi_invm_odd for usual odd cases.
10377
10378 2020-03-11 NIIBE Yutaka <[email protected]>
10379
10380 mpi: Support opaque MPI with gcry_mpi_print.
10381 + commit b4b04ae6c2e55bc2b24efc663d1eeaa0b3613f4c
10382 * mpi/mpicoder.c (_gcry_mpi_get_buffer): Return the bytes as-is.
10383
10384 2020-03-09 Werner Koch <[email protected]>
10385
10386 mpi: Abort on division by zero also in _gcry_mpi_tdiv_qr.
10387 + commit afbab896fa04d9481dbb9f4d01f607b12e31dcbf
10388 * mpi/mpi-div.c (_gcry_mpi_tdiv_qr): Error out on division by zero.
10389
10390 2020-02-25 NIIBE Yutaka <[email protected]>
10391
10392 build: More accurate dependency to -lgpg-error.
10393 + commit 9b8ac13761f0407bd701e43b0a65fbada204958f
10394 * configure.ac (LIBGCRYPT_CONFIG_LIBS): Remove DL_LIBS.
10395 * src/libgcrypt.c.in: Distinguish static link use case.
10396 * tests/Makefile.am: Fix use of -lgpg-error.
10397
10398 build: Fix linking -ldl.
10399 + commit c21e5d72e24e62752559f92b1825287298ae2f03
10400 * src/Makefile.am (libgcrypt_la_LIBADD): Add DL_LIBS.
10401 (mpicalc_LDADD): Remove DL_LIBS.
10402 * tests/Makefile.am (standard_ldadd): Remove DL_LIBS.
10403
10404 2020-02-02 Jussi Kivilinna <[email protected]>
10405
10406 crc-ppc: fix bad register used for vector load/store assembly.
10407 + commit b64b029318e7d0b66123015146614118f466a7a9
10408 * cipher/crc-ppc.c (CRC_VEC_U64_LOAD_BE): Move implementation to...
10409 (asm_vec_u64_load_be): ...here; Add "r0" to clobber list for load
10410 instruction when offset is not zero; Add zero offset path.
10411
10412 rinjdael-aes: use zero offset vector load/store when possible.
10413 + commit 89776d45c824032409f581e5fd1db6bf149df57f
10414 * cipher/rijndael-ppc-common.h (asm_aligned_ld, asm_aligned_st): Use
10415 zero offset instruction variant when input offset is constant zero.
10416 * cipher/rijndael-ppc.c (asm_load_be_noswap)
10417 (asm_store_be_noswap): Likewise.
10418
10419 Add POWER9 little-endian variant of PPC AES implementation.
10420 + commit 114bbc45e9717f9ad9641f64d8df8690db8da434
10421 * configure.ac: Add 'rijndael-ppc9le.lo'.
10422 * cipher/Makefile.am: Add 'rijndael-ppc9le.c', 'rijndael-ppc-common.h'
10423 and 'rijndael-ppc-functions.h'.
10424 * cipher/rijndael-internal.h (USE_PPC_CRYPTO_WITH_PPC9LE): New.
10425 (RIJNDAEL_context_s): Add 'use_ppc9le_crypto'.
10426 * cipher/rijndael.c (_gcry_aes_ppc9le_encrypt)
10427 (_gcry_aes_ppc9le_decrypt, _gcry_aes_ppc9le_cfb_enc)
10428 (_gcry_aes_ppc9le_cfb_dec, _gcry_aes_ppc9le_ctr_enc)
10429 (_gcry_aes_ppc9le_cbc_enc, _gcry_aes_ppc9le_cbc_dec)
10430 (_gcry_aes_ppc9le_ocb_crypt, _gcry_aes_ppc9le_ocb_auth)
10431 (_gcry_aes_ppc9le_xts_crypt): New.
10432 (do_setkey, _gcry_aes_cfb_enc, _gcry_aes_cbc_enc)
10433 (_gcry_aes_ctr_enc, _gcry_aes_cfb_dec, _gcry_aes_cbc_dec)
10434 (_gcry_aes_ocb_crypt, _gcry_aes_ocb_auth, _gcry_aes_xts_crypt)
10435 [USE_PPC_CRYPTO_WITH_PPC9LE]: New.
10436 * cipher/rijndael-ppc.c: Split common code to headers
10437 'rijndael-ppc-common.h' and 'rijndael-ppc-functions.h'.
10438 * cipher/rijndael-ppc-common.h: Split from 'rijndael-ppc.c'.
10439 (asm_add_uint64, asm_sra_int64, asm_swap_uint64_halfs): New.
10440 * cipher/rijndael-ppc-functions.h: Split from 'rijndael-ppc.c'.
10441 (CFB_ENC_FUNC, CBC_ENC_FUNC): Unroll loop by 2.
10442 (XTS_CRYPT_FUNC, GEN_TWEAK): Tweak generation without vperm
10443 instruction.
10444 * cipher/rijndael-ppc9le.c: New.
10445
10446 Add gcry_cipher_ctl command to allow weak keys in testing use-cases.
10447 + commit 5beadf201312d0c649971b0c1d4c3827b434a0b5
10448 * cipher/cipher-internal.h (gcry_cipher_handle): Add
10449 'marks.allow_weak_key' flag.
10450 * cipher/cipher.c (cipher_setkey): Do not handle weak key as error when
10451 weak keys are allowed.
10452 (cipher_reset): Preserve 'marks.allow_weak_key' flag on object reset.
10453 (_gcry_cipher_ctl): Add handling for GCRYCTL_SET_ALLOW_WEAK_KEY.
10454 * src/gcrypt.h.in (gcry_ctl_cmds): Add GCRYCTL_SET_ALLOW_WEAK_KEY.
10455 * tests/basic.c (check_ecb_cipher): Add tests for weak key errors and
10456 for GCRYCTL_SET_ALLOW_WEAK_KEY.
10457
10458 2020-01-23 NIIBE Yutaka <[email protected]>
10459
10460 random: Fix include of config.h.
10461 + commit e0898d0628789414da23e0526c87df1885c8b3ae
10462 * random/random-drbg.c: Include config.h earlier.
10463
10464 2020-01-22 Jussi Kivilinna <[email protected]>
10465
10466 sexp: fix cast from 'int' pointer to 'size_t' pointer.
10467 + commit 8b31091da092e22dba78b2402c2f436bbffc1c73
10468 * src/sexp.c (do_vsexp_sscan): Change 'datalen' from 'int' to
10469 'size_t'; Remove &datalen pointer cast to 'size_t *' type.
10470
10471 mpi/i386: fix DWARF CFI for _gcry_mpih_sub_n and _gcry_mpih_add_n.
10472 + commit 5f098f7e6ceb899ac27a0a30ee036de5f1be4e3d
10473 * mpi/i386/mpih-add1.S (_gcry_mpih_add_n) [PIC]: Adjust CFI CFA offset
10474 when making call and restoring stack pointer.
10475 * mpi/i386/mpih-sub1.S (_gcry_mpih_sub_n) [PIC]: Ditto.
10476
10477 2020-01-22 H.J. Lu <[email protected]>
10478
10479 i386: Add _CET_ENDBR to indirect jump targets.
10480 + commit cb9f0a2df8225eed071ae0a56265e38e9f6ff184
10481 * mpi/i386/mpih-add1.S (_gcry_mpih_add_n): Save and restore
10482 %ebx if IBT is enabed. Add _CET_ENDBR to indirect jump targets
10483 and adjust jump destination for _CET_ENDBR.
10484 * mpi/i386/mpih-sub1.S (_gcry_mpih_sub_n): Likewise.
10485
10486 amd64: Always include <config.h> in cipher assembly codes.
10487 + commit 22e577071790834f07753c42a191a568c9f2644d
10488 * cipher/camellia-aesni-avx-amd64.S: Always include <config.h>.
10489 * cipher/camellia-aesni-avx2-amd64.S: Likewise.
10490 * cipher/serpent-avx2-amd64.S: Likewise.
10491
10492 mpi: Add .note.gnu.property section for Intel CET.
10493 + commit 24b4d5c10a97aaf82ac7402cc3a5b429d580cd66
10494 * mpi/config.links: Include <cet.h> in <asm-syntax.h>.
10495
10496 x86: Add .note.gnu.property section for Intel CET.
10497 + commit 4c88c2bd2a418435506325cd53246acaaa52750c
10498 * configure.ac: Include <cet.h> in <config.h> for assembly
10499 codes.
10500
10501 2020-01-22 Jussi Kivilinna <[email protected]>
10502
10503 tests/basic: add vector cluttering to detect implementation bugs.
10504 + commit 4aa8ff904262f331abbb8c988069a7029ca13502
10505 * src/global.c (_gcry_check_version): Fix missing newline.
10506 * src/basic.c (ALWAYS_INLINE, CLUTTER_REGISTER_*, prepare_vector_data)
10507 (clutter_vector_registers): New.
10508 (progress_handler): Make static function.
10509 (check_bulk_cipher_modes, check_one_cipher_core_reset)
10510 (check_one_cipher_core, check_one_md, check_one_md_multi)
10511 (check_one_md_final, check_one_mac): Clutter vector registers before
10512 gcry_* calls to cipher/md/mac algorithms.
10513
10514 2020-01-22 Marvin W <[email protected]>
10515
10516 Set vZZ.16b register to zero before use in armv8 gcm implementation.
10517 + commit 79ed620ec46adbb08f5cea6a4865a95a436e4109
10518 * cipher/cipher-gcm-armv8-aarch64-ce.S
10519 (_gcry_ghash_setup_armv8_ce_pmull): Set vZZ to zero.
10520
10521 2020-01-21 Tianjia Zhang <[email protected]>
10522
10523 tests: Add basic test cases for sm2.
10524 + commit aa9c78afa1d867bb7b9b3c695cf31a832c9419e5
10525 * tests/basic.c (check_pubkey): Add test cases for ecc-sm2.
10526
10527 Add elliptic curve SM2 implementation.
10528 + commit 6b55246c77089dd372eb1807808111660fd789c7
10529 * configure.ac (enabled_pubkey_ciphers): Add ecc-sm2.
10530 * cipher/Makefile.am (EXTRA_libcipher_la_SOURCES): Add ecc-sm2.c.
10531 * cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist,
10532 _gcry_pk_util_preparse_sigval): Add sm2 flags.
10533 * cipher/ecc.c: Support ecc-sm2.
10534 * cipher/ecc-common.h: Add declarations for ecc-sm2.
10535 * cipher/ecc-sm2.c: New.
10536 * src/cipher.h: Define PUBKEY_FLAG_SM2.
10537
10538 ecc: Simplify signature code.
10539 + commit 8d9958910e54f3fecbab6e133c3971843f6ef310
10540 * cipher/ecc-gost.c (_gcry_ecc_gost_sign): Use implemented function.
10541 * cipher/ecc.c (ecc_verify): Remove redundant code.
10542
10543 2020-01-21 NIIBE Yutaka <[email protected]>
10544 NIIBE Yutaka <[email protected]>
10545
10546 tests: Fix check_pubkey.
10547 + commit 95e9cee802419adf6f4b01b29d7874793004fa8d
10548 * tests/basic.c (check_pubkey): Fix constants of pubkeys.
10549
10550 2020-01-21 NIIBE Yutaka <[email protected]>
10551
10552 Avoid use of ulong in internal code.
10553 + commit 4997139b3e83761c9af0246cec829305c3d7d13b
10554 * configure.ac (HAVE_ULONG_TYPEDEF): Remove.
10555 * mpi/mpi-div.c (_gcry_mpi_fdiv_r_ui): Use unsigned long.
10556 (_gcry_mpi_divisible_ui): Likewise.
10557 * random/rndunix.c (_gcry_rndunix_gather_random): Likewise.
10558 * random/rndw32.c (_gcry_rndw32_gather_random_fast): Likewise.
10559 (ADDINT): Likewise.
10560 * random/rndw32ce.c (_gcry_rndw32ce_gather_random_fast): Likewise.
10561 * src/mpi.h: Follow the change.
10562 * src/types.h (HAVE_ULONG_TYPEDEF): Remove.
10563
10564 2020-01-19 Jussi Kivilinna <[email protected]>
10565
10566 gcrypt.texi: fix GCRYCTL_GET_ALGO_NENCR typo.
10567 + commit 5ebb2f0671c902863eee91cbcfc85a72be506410
10568 * doc/gcrypt.texi: Fix GCRYCTL_GET_ALGO_NENC to GCRYCTL_GET_ALGO_NENCR.
10569
10570 2020-01-19 Tianjia Zhang <[email protected]>
10571
10572 mpi: Fix error that point not uninitialized.
10573 + commit 7e3aac7ba49b3b6e6c5ebe7c880b5b323c423ef7
10574 * cipher/ecc-curves.c (mpi_ec_get_elliptic_curve): Initialize E->G poing
10575
10576 ecc: Wrong flag and elements_enc fix.
10577 + commit 43cfc1632dd3a9579a906f31cd3b6c88d242d1a5
10578 * cipher/ecc.c (ecc_generate): Fix wrong flag and elements_enc.
10579
10580 Update .gitignore.
10581 + commit 176a5f162acd0cfebc5517d061205681bc3658d0
10582
10583
10584 2020-01-16 Tianjia Zhang <[email protected]>
10585
10586 Add new curve named sm2p256v1.
10587 + commit d154c1e9e11019980253f0a65758932cd0656470
10588 * cipher/ecc-curves.c (domain_parms): Add sm2p256v1 for SM2.
10589 * tests/curves.c (N_CURVES): Update N_CURVES for SM2.
10590
10591 2019-12-23 Jussi Kivilinna <[email protected]>
10592
10593 rijndael-ppc: performance improvements.
10594 + commit 110077505acacae62cec3d09b32a084b9cee0368
10595 * cipher/rijndael-ppc.c (ALIGNED_LOAD, ALIGNED_STORE, VEC_LOAD_BE)
10596 (VEC_STORE_BE): Rewrite.
10597 (VEC_BE_SWAP, VEC_LOAD_BE_NOSWAP, VEC_STORE_BE_NOSWAP): New.
10598 (PRELOAD_ROUND_KEYS, AES_ENCRYPT, AES_DECRYPT): Adjust to new
10599 input parameters for vector load macros.
10600 (ROUND_KEY_VARIABLES_ALL, PRELOAD_ROUND_KEYS_ALL)
10601 (AES_ENCRYPT_ALL): New.
10602 (vec_bswap32_const_neg): New.
10603 (vec_aligned_ld, vec_aligned_st, vec_load_be_const): Rename to...
10604 (asm_aligned_ls, asm_aligned_st, asm_load_be_const): ...these.
10605 (asm_be_swap, asm_vperm1, asm_load_be_noswap)
10606 (asm_store_be_noswap): New.
10607 (vec_add_uint128): Rename to...
10608 (asm_add_uint128): ...this.
10609 (asm_xor, asm_cipher_be, asm_cipherlast_be, asm_ncipher_be)
10610 (asm_ncipherlast_be): New inline assembly functions with volatile
10611 keyword to allow manual instruction ordering.
10612 (_gcry_aes_ppc8_setkey, aes_ppc8_prepare_decryption)
10613 (_gcry_aes_ppc8_encrypt, _gcry_aes_ppc8_decrypt)
10614 (_gcry_aes_ppc8_cfb_enc, _gcry_aes_ppc8_cbc_enc)
10615 (_gcry_aes_ppc8_ocb_auth): Update to use new&rewritten helper macros.
10616 (_gcry_aes_ppc8_cfb_dec, _gcry_aes_ppc8_cbc_dec)
10617 (_gcry_aes_ppc8_ctr_enc, _gcry_aes_ppc8_ocb_crypt)
10618 (_gcry_aes_ppc8_xts_crypt): Update to use new&rewritten helper
10619 macros; Tune 8-block parallel paths with manual instruction ordering.
10620
10621 rijndael-ppc: fix bad register used for vector load/store assembly.
10622 + commit 0837d7e6be3e604c1f7b86d18c582d8aa7ed858c
10623 * cipher/rijndael-ppc.c (vec_aligned_ld, vec_load_be, vec_aligned_st)
10624 (vec_store_be): Add "r0" to clobber list for load/store instructions.
10625
10626 2019-12-22 Jussi Kivilinna <[email protected]>
10627
10628 cipher: fix typo in error log.
10629 + commit 5b9ea3df0dc355d77b9f061f63064614a97b8b67
10630 * cipher/cipher.c (_gcry_cipher_encrypt): Fix log "cipher_decrypt: ..."
10631 to "cipher_encrypt: ...".
10632
10633 2019-11-21 Dmitry Eremin-Solenikov <[email protected]>
10634
10635 gost28147: inline gost_val function to speed up code.
10636 + commit e5c4cf0efb8fd297963e6b4392ab98c41dbad536
10637 * cipher/gost28147.c (gost_val): mark function as inline
10638
10639 gost28147: do not use GOST28147_CONTEXT outside of GOST 28147 calculation
10640 + commit f9894240bed36eab17fabf5aa482799b148618e2
10641 * cipher/gost28147.c (_gcry_gost_enc_data): remove unused context
10642 argument
10643 * cipher/gostr3411-94.c (GOSTR3411_CONTEXT, gostr3411_init,
10644 do_hash_step): remove unused GOST 28147-89 context.
10645
10646 gost28147: simplify internal code.
10647 + commit d164a8e7f6829163f1279517f07b61805311f8f2
10648 * cipher/gost28147.c (gost_val, _gost_encrypt_data): don't use gost
10649 context internally
10650 * cipher/gost28147.c (gost_encrypt_block, gost_decrypt_block,
10651 _gcry_gost_enc_data): adapt to internal changes.
10652
10653 gostr3411-94: small speedup.
10654 + commit 8f573a67d12e6d9026f1676a6dae7813105bc490
10655 * cipher/gostr3411-94.c (do_p): unroll loop for a small spedup
10656
10657 2019-11-18 Paul Wolneykien <[email protected]>
10658
10659 ecc: update GOST2012 curves.
10660 + commit a3a866f63e7a527fe3c053758b84d70c142f8283
10661 * cipher/ecc-curves.c (domain_parms): rename GOST 2012 curves to contain
10662 curve bit size
10663 (curve_aliases): rename curves, provide backwards-compatible
10664 aliases, add new OIDs and two new curves.
10665 * cipher/ecc-curves.c (curve_aliases): add new OIDs and aliases for
10666 * tests/basic.c (check_pubkey): use new name for GOST2012 512-bit test
10667 curve.
10668 * tests/benchmark.c (ecc_bench): use new name for GOST2012 512-bit test
10669 curve.
10670
10671 2019-11-05 Jussi Kivilinna <[email protected]>
10672
10673 ec: fix left shift overflows on WIN64 build.
10674 + commit bdbd032d1626dbb34e1840e5f5393524dd546a1d
10675 * mpi/ec.c (ec_mulm_448): Cast constants to (mpi_limb_t) before
10676 shifting left by 32.
10677
10678 mpi/amd64: use SSE2 for shifting instead of MMX.
10679 + commit 1322c6a5d1e9aa0c69a2b259aa5ec7bcf5cb5653
10680 * mpi/amd64/mpih-lshift.S: Convert to SSE2.
10681 * mpi/amd64/mpih-rshift.S: Ditto.
10682
10683 Add i386/SSSE3 implementation of SHA512.
10684 + commit b52dde860963c794b12d14b0a9c5848bca7ba51e
10685 * LICENSES: Add 'sha512-ssse3-i386.c'.
10686 * configure.ac: Add 'sha512-ssse3-i386.lo'.
10687 * cipher/Makefile.am: Add 'sha512-ssse3-i386.c'.
10688 * cipher/sha512-ssse3-i386.c: New.
10689 * cipher/sha512.c (USE_SSSE3_I386, _gcry_sha512_transform_i386_ssse3)
10690 (do_sha512_transform_i386_ssse3): New.
10691 (_gcry_sha512_transform_arm) [USE_SSSE3_I386]: Use i386/SSSE3 transform
10692 function if supported by CPU.
10693
10694 2019-10-28 NIIBE Yutaka <[email protected]>
10695
10696 ecc: Add Curve for X448 with ECC_DIALECT_SAFECURVE.
10697 + commit d9c418305e1053decebefbd5a98a95f845404a09
10698 * cipher/ecc-curves.c (domain_parms): Add X448.
10699 * cipher/ecc-ecdh.c (_gcry_ecc_mul_point): Support X448.
10700 * mpi/ec.c (ec_addm_448, ec_subm_448, ec_mulm_448): New.
10701 (ec_mul2_448, ec_pow2_448): New.
10702 (field_table): Add for X448.
10703 (curve448_bad_points): New.
10704 (bad_points_table): New.
10705 (ec_p_init): Use bad_points_table.
10706 * tests/Makefile.am (t-x448): Add.
10707 * tests/curves.c (N_CURVES): Update.
10708 * tests/t-x448.c: New.
10709
10710 2019-10-25 NIIBE Yutaka <[email protected]>
10711
10712 ecc: Introduce new dialect: ECC_DIALECT_SAFECURVE.
10713 + commit 498ab6d9f2f8b0775da41553be7868e59cf4cc2e
10714 * src/mpi.h (ECC_DIALECT_SAFECURVE): New.
10715 * cipher/ecc-misc.c (_gcry_ecc_dialect2str): Support the new dialect.
10716 * cipher/ecc-curves.c (mpi_ec_setup_elliptic_curve): Support opaque
10717 MPI handling of secret 'd' for ECC_DIALECT_SAFECURVE.
10718 * cipher/ecc.c (nist_generate_key): Support opaque secret for
10719 ECC_DIALECT_SAFECURVE.
10720 (test_ecdh_only_keys): Likewise.
10721 (ecc_generate): Support native point representation for
10722 ECC_DIALECT_SAFECURVE.
10723 (ecc_encrypt_raw): Support opaque MPI handling of secret and
10724 native point representation for ECC_DIALECT_SAFECURVE.
10725 (ecc_decrypt_raw): Support native point representation for
10726 ECC_DIALECT_SAFECURVE.
10727 (_gcry_pk_ecc_get_sexp): Likewise.
10728
10729 ecc: Make _gcry_mpi_ec_mul_point friendly to X25519 computation.
10730 + commit 2dfedafe08ac57a87e6892d1af4d72cbb398fe40
10731 * mpi/ec.c (_gcry_mpi_ec_mul_point): Support scalar input as an opaque
10732 MPI in little-endian native format.
10733 * cipher/ecc-ecdh.c (_gcry_ecc_mul_point): Use an opaque scalar.
10734
10735 pubkey: Support a method to get data as an opaque MPI.
10736 + commit 050e0b4accfae6a49dda6b1bac52749edec5ce22
10737 * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi): Support an
10738 opaque MPI in old style.
10739
10740 2019-10-24 NIIBE Yutaka <[email protected]>
10741
10742 ecc: Support an opaque MPI handling in mpi_from_keyparam.
10743 + commit 05a7d2f262bc5c2d108dcfa6e3d907dd895a4074
10744 * cipher/ecc-curves.c (mpi_from_keyparam): Add OPAQUE argument.
10745
10746 ecc: Fix handling of point representation in EdDSA.
10747 + commit 3d5a05767b84e0f781ed5dfe434adb4d4e9d2aa5
10748 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_ensure_compact): Use
10749 GCRYMPI_FMT_USG, since integer is defined as unsigned in SEC1.
10750 (_gcry_ecc_eddsa_decodepoint): Likewise.
10751
10752 ecc: Return an opaque MPI by _gcry_ecc_ec2os.
10753 + commit 8fce1027c2531127dd52a8b883f34333ffd3763b
10754 * cipher/ecc-misc.c (_gcry_ecc_ec2os): Use mpi_set_opaque instead of
10755 _gcry_mpi_scan to make an opaque MPI.
10756
10757 ecc: String constant fix.
10758 + commit 35c1faaea2b0aee9b127d02d93158826d17eb107
10759 * cipher/ecc-curves.c (domain_parms): Same string length for NIST
10760 P-521.
10761
10762 ecc: Simplify _gcry_ecc_compute_public.
10763 + commit ad8927f40169364003f72fc188ea60b295ef5e59
10764 * cipher/ecc-misc.c (_gcry_ecc_compute_public): Don't need G and d.
10765 Use ec->G and ec->d.
10766 * cipher/ecc-curves.c (_gcry_ecc_get_mpi): Follow the change.
10767 (_gcry_ecc_get_point): Likewise.
10768 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_compute_h_d): Don't need d,
10769 but use ec->d.
10770 (_gcry_ecc_eddsa_sign): Follow the change.
10771
10772 2019-10-23 NIIBE Yutaka <[email protected]>
10773
10774 ecc: Use opaque MPI for _gcry_ecc_mul_point.
10775 + commit c5a7191c1bd18292a34ad4da45d743dfac035f9a
10776 * cipher/ecc-ecdh.c (_gcry_ecc_mul_point): Use opaque MPI for U.
10777
10778 ecc: Fix _gcry_ecc_mont_decodepoint for data by old implementation.
10779 + commit bbe15758c893dbf546416c1a6bccdad1ab000ad7
10780 * cipher/ecc-misc.c (_gcry_ecc_mont_decodepoint): Support data by old
10781 implementation by opaque public key.
10782 Fix confusion of endian, in the handling of data by normal MPI key.
10783
10784 ecc: ECDH clean up for use of ec->nbits.
10785 + commit 27e848666b4a03939b0c8db15aa6e6f79bc7db30
10786 * cipher/ecc-ecdh.c (_gcry_ecc_mul_point): Use ec->nbits.
10787 * cipher/ecc.c (test_ecdh_only_keys): Likewise.
10788 (ecc_encrypt_raw): Likewise.
10789 (ecc_generate): Fix debug output format.
10790
10791 2019-10-22 NIIBE Yutaka <[email protected]>
10792
10793 ecc: Fix key generation for ECDH.
10794 + commit 82441bbb82903c21cd2b9b4e2d50202b14fdc24c
10795 * cipher/ecc.c (test_ecdh_only_keys): Don't free EC here.
10796
10797 ecc: Fix debug output.
10798 + commit 6d93812aa312a92d4de2dc034bdf87c276a24b8a
10799 * cipher/ecc-curves.c (_gcry_mpi_ec_internal_new): Fix debug output.
10800
10801 ecc: Simplify using mpi_ec_t directly.
10802 + commit 6a30a9a2cc48d2343c3e9815567dbd4bf9eec058
10803 * cipher/ecc-common.h (ECC_public_key, ECC_secret_key): Remove.
10804 (_gcry_ecc_ecdsa_sign, _gcry_ecc_ecdsa_verify): Use mpi_ec_t.
10805 (_gcry_ecc_eddsa_genkey, gcry_ecc_eddsa_sign): Likewise.
10806 (_gcry_ecc_eddsa_verify): Likewise.
10807 (_gcry_ecc_gost_sign, _gcry_ecc_gost_verify): Likewise.
10808 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_sign): Use mpi_ec_t directly.
10809 (_gcry_ecc_ecdsa_verify): Likewise.
10810 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_genkey): Likewise.
10811 (_gcry_ecc_eddsa_sign, _gcry_ecc_eddsa_verify): Likewise.
10812 * cipher/ecc-gost.c (_gcry_ecc_gost_sign): Likewise.
10813 (_gcry_ecc_gost_verify): Likewise.
10814
10815 ecc: Fix for NBITS support.
10816 + commit 975de38796917392e83152447c6575648a5a5ee3
10817 * cipher/ecc-curves.c (mpi_ec_get_elliptic_curve): Fill curve
10818 parameters by NBITS.
10819 (_gcry_mpi_ec_internal_new): Show "EdDSA".
10820
10821 ecc: Add NAME member to struct mpi_ec_ctx_s.
10822 + commit e921ad5b3ad093304312aca90a3c971de05cbf03
10823 * src/ec-context.h (struct mpi_ec_ctx_s): Add NAME.
10824 * cipher/ecc-curves.c (mpi_ec_setup_elliptic_curve): Initialize NAME.
10825
10826 ecc: Add key generation support to mpi_ec_get_elliptic_curve.
10827 + commit 488704be6e044e23770d95344511c5a347b533c5
10828 * cipher/ecc-curves.c (mpi_ec_get_elliptic_curve): Handle params for
10829 key generation.
10830 (_gcry_mpi_ec_internal_new): Remove duplication for handling of flags.
10831
10832 ecc: Consolidate with _gcry_mpi_ec_internal_new.
10833 + commit 5415bc578080018e1cd36aa44cf5c0a9995cbafc
10834 * cipher/ecc-ecdh.c (prepare_ec): Use _gcry_mpi_ec_internal_new.
10835 (_gcry_ecc_mul_point): Don't need to have E of elliptic_curve_t.
10836 * cipher/ecc.c (ecc_encrypt_raw): Use _gcry_mpi_ec_internal_new.
10837 (ecc_decrypt_raw): Likewise.
10838
10839 ecc: Support flags and debug print in _gcry_mpi_ec_internal_new.
10840 + commit c2aa333dd88b4cd337329128a2018dd3b00f5114
10841 * cipher/ecc-curves.c (mpi_ec_get_elliptic_curve): Don't set *r_flags.
10842 (_gcry_mpi_ec_internal_new): Add r_flags argument.
10843 Parse the flag list.
10844 Output to debug channel when DBG_CIPHER.
10845
10846 2019-10-21 NIIBE Yutaka <[email protected]>
10847
10848 ecc: Add new function _gcry_mpi_ec_internal_new.
10849 + commit c7b97ac9bdf96f5a89ae553cac12954043ab174d
10850 * cipher/ecc-curves.c (mpi_ec_get_elliptic_curve)
10851 (mpi_ec_setup_elliptic_curve): Factor out from _gcry_mpi_ec_new.
10852 (_gcry_mpi_ec_internal_new): New.
10853 (_gcry_mpi_ec_new): Rewrite using mpi_ec_get_elliptic_curve and
10854 mpi_ec_setup_elliptic_curve.
10855
10856 ecc: Simplify ecc_encrypt_raw and ecc_decrypt_raw.
10857 + commit 10b8cc280a535f14b017106c87f2b26bb68d9489
10858 * cipher/ecc.c (ecc_encrypt_raw): Use elliptic_curve_t directly.
10859 (ecc_decrypt_raw): Likewise.
10860
10861 ecc: More fixes for cofactor with PUBKEY_FLAG_PARAM.
10862 + commit 61a0518282537ad52367354c96986c3d1b698d6f
10863 * cipher/ecc.c (ecc_check_secret_key): Support "h" in KEYPARMS.
10864 (ecc_sign, ecc_verify, ecc_encrypt_raw, ecc_decrypt_raw): Likewise.
10865
10866 ecc: Simply use unsigned int for cofactor, not MPI.
10867 + commit a258ae728de62607b3ef4eca940cfbcf9965fa5f
10868 * cipher/ecc-common.h (elliptic_curve_t): Use unsigned int for H.
10869 * src/ec-context.h (struct mpi_ec_ctx_s): Ditto.
10870 * cipher/ecc-curves.c (ecc_domain_parms_t): Ditto.
10871 (domain_parms): Update for the cofactors.
10872 (_gcry_ecc_fill_in_curve): H is no longer MPI, but unsigned int.
10873 (_gcry_ecc_get_curve): Remove handling for H.
10874 (_gcry_mpi_ec_new): In KEYPARM, cofactor is still MPI.
10875 (_gcry_ecc_get_param_sexp): H is no longer MPI, but unsigned int.
10876 (_gcry_ecc_get_mpi): Keep the API, returning MPI for "h".
10877 (_gcry_ecc_set_mpi): Likewise.
10878 * cipher/ecc-ecdh.c (_gcry_ecc_mul_point): Fix for unsigned int.
10879 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_genkey): Likewise.
10880 * cipher/ecc-misc.c (_gcry_ecc_curve_free): Likewise.
10881 * cipher/ecc.c (nist_generate_key, test_ecdh_only_keys): Likewise.
10882 (test_ecdh_only_keys, ecc_generate, ecc_check_secret_key): Likewise.
10883 (ecc_sign, ecc_verify, ecc_encrypt_raw, ecc_decrypt_raw): Likewise.
10884 (_gcry_pk_ecc_get_sexp): Likewise.
10885 * mpi/ec.c (ec_deinit): Likewise.
10886
10887 2019-10-18 NIIBE Yutaka <[email protected]>
10888
10889 ecc: Simplify compute_keygrip.
10890 + commit 579d5d6017d63b5eabec588b24d1a22566455bac
10891 * cipher/ecc-curves.c (_gcry_ecc_update_curve_param): Remove H.
10892 * cipher/ecc.c (compute_keygrip): Don't get H, since it's not
10893 used in the computation.
10894
10895 ecc: Clean up key generation code.
10896 + commit 95cc9b8f4483fd7edfc7555199f6a05cfa68a236
10897 * cipher/ecc.c (test_ecdh_only_keys): No need to make PK by SK.
10898
10899 2019-10-14 Jussi Kivilinna <[email protected]>
10900
10901 Fix building t-lock for WIN32.
10902 + commit 7e1383cfd43fdc2b6f743e6a1304f0f0b2142847
10903 * tests/t-lock.c (external_lock_test_init, external_lock_test_lock)
10904 (externel_lock_test_unlock, external_lock_test_destroy)
10905 (nonce_thread, get_rand, pick_account, pick_value, revision_thread)
10906 (accountant_thread): Build also if _WIN32 defined in addition to
10907 HAVE_PTHREAD.
10908
10909 hash-common: avoid integer division to reduce call overhead.
10910 + commit f9d8b5a0369cc94e125d36d9c8864d5cd2eaa1d2
10911 * cipher/hash-common.h (gcry_md_block_ctx): Replace 'blocksize' with
10912 'blocksize_shift'.
10913 * cipher/hash-common.c (_gcry_md_block_write): Use bit-level operations
10914 instead of division to get number of blocks.
10915 * cipher/gostr2411-94.c (gost3411_init): Initialize 'blocksize_shift'
10916 instead of 'blocksize'.
10917 * cipher/md2.c (md2_init): Ditto.
10918 * cipher/md4.c (md4_init): Ditto.
10919 * cipher/md5.c (md5_init): Ditto.
10920 * cipher/rmd160.c (rmd160_init): Ditto.
10921 * cipher/sha1.c (sha1_init): Ditto.
10922 * cipher/sha256.c (sha256_common_init): Ditto.
10923 * cipher/sha512.c (sha512_init_common): Ditto.
10924 * cipher/sm3.c (sm3_init): Ditto.
10925 * cipher/stribog.c (stribog_init_512): Ditto.
10926 * cipher/tiger.c (do_init): Ditto.
10927 * cipher/whirlpool.c (whirlpool_init): Ditto.
10928
10929 2019-10-11 NIIBE Yutaka <[email protected]>
10930
10931 ecc: Handle ephemeral key as opaque octets.
10932 + commit ff0f1782560eb45458d9a8dd97088dabeddb34e7
10933 * cipher/ecc.c (ecc_decrypt_raw): Extract an ephemeral key
10934 as opaque octets.
10935
10936 2019-10-10 NIIBE Yutaka <[email protected]>
10937
10938 ecc: Consolidate encoding a point for Montgomery curve.
10939 + commit 80cf289905ace9f174eb06d7f55f38980f7e4dbd
10940 * cipher/ecc-common.h (_gcry_ecc_mont_encodepoint): New.
10941 * cipher/ecc-misc.c (_gcry_ecc_mont_encodepoint): New.
10942 * cipher/ecc.c (ecc_generate): Use _gcry_ecc_mont_encodepoint.
10943 (ecc_encrypt_raw, ecc_decrypt_raw, _gcry_pk_ecc_get_sexp): Likewise.
10944
10945 2019-10-09 NIIBE Yutaka <[email protected]>
10946
10947 ecc: More clean-up for Ed25519 and Curve25519.
10948 + commit ba0b31f2636632b1b39ebd2202de3ba5d60588b8
10949 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_ensure_compact): Fix calc for
10950 bytes.
10951 * cipher/ecc.c (ecc_encrypt_raw): Use public key as opaque byte-string
10952 with "/q" for both cases, since it is always fixed size with a prefix.
10953 (compute_keygrip): Likewise.
10954 Fix hard-coded value of 256 for Ed25519.
10955 Handle Curve25519 differently.
10956
10957 2019-10-08 NIIBE Yutaka <[email protected]>
10958
10959 ecc: Fix hard-coded value for 25519 to allow other modern curves.
10960 + commit d66a4856eb0c39823bf3414b3ca4cf6322f32aef
10961 * cipher/ecc.c (nist_generate_key): Support other modern curves.
10962 (test_ecdh_only_keys): Likewise.
10963 (check_secret_key): Don't use ECC_DIALECT_ED25519 for the check.
10964 (_gcry_pk_ecc_get_sexp): Support Montgomery curve.
10965
10966 ecc: Clean up for decoding point.
10967 + commit 254c5279058f0aea2d3568d6e756002242e82f8f
10968 * cipher/ecc-curves.c (point_from_keyparam): Possibly supporting
10969 Montgomery curve, use _gcry_mpi_ec_decode_point.
10970 (_gcry_ecc_set_mpi): Likewise.
10971 * cipher/ecc.c (ecc_check_secret_key): Likewise.
10972
10973 random: Clean up unused old internal API.
10974 + commit 6e57242c61bca38b3cc8fdf424b5667ab953e4cd
10975 * random/random.h (_gcry_get_random_bits): Remove.
10976
10977 2019-10-02 NIIBE Yutaka <[email protected]>
10978
10979 ecc: Fix regression in keygrip computation for cv25519 (2).
10980 + commit 1cfe2329b91cc7be30f7c3a14fc634ec89a1be96
10981 * cipher/ecc-curves.c (_gcry_ecc_fill_in_curve): Recover g_y
10982 for Curve25519.
10983
10984 2019-09-28 Werner Koch <[email protected]>
10985
10986 ecc: Fix regression in keygrip computation for cv25519.
10987 + commit f67b6492e0b0a2a661cd53a08b20f23e6e3f9f89
10988 * cipher/ecc-curves.c (domain_parms): Revert g_y for cv25519.
10989 * tests/keygrip.c: Add test case for cv25519.
10990
10991 2019-09-24 Jussi Kivilinna <[email protected]>
10992
10993 Add stitched ChaCha20-Poly1305 ARMv8/AArch64 implementation.
10994 + commit 4bebafb7bae8343f543728937caf7d3453c88b7c
10995 * cipher/Makefile.am: Add 'asm-poly1305-aarch64.h'.
10996 * cipher/asm-poly1305-aarch64.h: New.
10997 * cipher/chacha20-aarch64.S (ROT8, _, ROTATE2_8): New.
10998 (ROTATE2): Add interleave operator.
10999 (QUARTERROUND2): Add interleave operators; Use ROTATE2_8.
11000 (chacha20_data): Rename to...
11001 (_gcry_chacha20_aarch64_blocks4_data_inc_counter): ...to this.
11002 (_gcry_chacha20_aarch64_blocks4_data_rot8): New.
11003 (_gcry_chacha20_aarch64_blocks4): Preload ROT8; Fill empty parameters
11004 for QUARTERROUND2 interleave operators.
11005 (_gcry_chacha20_poly1305_aarch64_blocks4): New.
11006 * cipher/chacha20.c
11007 [USE_AARCH64_SIMD] (_gcry_chacha20_poly1305_aarch64_blocks4): New.
11008 (_gcry_chacha20_poly1305_encrypt, _gcry_chacha20_poly1305_decrypt)
11009 [USE_AARCH64_SIMD]: Use stitched implementation if ctr->use_neon is
11010 set.
11011
11012 2019-09-22 Jussi Kivilinna <[email protected]>
11013
11014 Small tweak for PowerPC Chacha20-Poly1305 round loop.
11015 + commit 96b91e164160dfbd913aefe258f472d386f5b642
11016 * cipher/chacha20-ppc.c (_gcry_chacha20_poly1305_ppc8_block4): Use
11017 inner/outer round loop structure instead of two separate loops for
11018 stitched and non-stitched parts.
11019
11020 Reduce size of x86-64 stitched Chacha20-Poly1305 implementations.
11021 + commit 664370ea02df883d16db1ffdd9ada023335b0f63
11022 * cipher/chacha20-amd64-avx2.c
11023 (_gcry_chacha20_poly1305_amd64_avx2_blocks8): De-unroll round loop.
11024 * cipher/chacha20-amd64-ssse3.c
11025 (_gcry_chacha20_poly1305_amd64_ssse3_blocks4):
11026 (_gcry_chacha20_poly1305_amd64_ssse3_blocks1): Ditto.
11027
11028 2019-09-16 Jussi Kivilinna <[email protected]>
11029
11030 Add PowerPC extra CFLAGS also for chacha20-ppc and crc-ppc.
11031 + commit 5516072451d46be8827455afff840eb6d49155fb
11032 * cipher/Makefile.am: Add 'ppc_vcrypto_cflags' for chacha20-ppc.o/.lo
11033 and crc-ppc.o/.lo.
11034
11035 2019-09-15 Jussi Kivilinna <[email protected]>
11036
11037 Add PowerPC vpmsum implementation of CRC.
11038 + commit 0486b85bd1fb65013e77f858cae9ea4530f868df
11039 * cipher/Makefile.am: Add 'crc-ppc.c'.
11040 * cipher/crc-armv8-ce.c: Remove 'USE_INTEL_PCLMUL' comment.
11041 * cipher/crc-ppc.c: New.
11042 * cipher/crc.c (USE_PPC_VPMSUM): New.
11043 (CRC_CONTEXT): Add 'use_vpmsum'.
11044 (_gcry_crc32_ppc8_vpmsum, _gcry_crc24rfc2440_ppc8_vpmsum): New.
11045 (crc32_init, crc24rfc2440_init): Add HWF check for 'use_vpmsum'.
11046 (crc32_write, crc24rfc2440_write): Add 'use_vpmsum' code-path.
11047 * configure.ac: Add 'vpmsumd' instruction to PowerPC VSX inline
11048 assembly check; Add 'crc-ppc.lo'.
11049
11050 Add PowerPC vector implementation of ChaCha20.
11051 + commit 557702f0d53a7ad1cf2ce0333c9df799a8abad59
11052 * cipher/Makefile.am: Add 'chacha20-ppc.c'.
11053 * cipher/chacha20-ppc.c: New.
11054 * cipher/chacha20.c (USE_PPC_VEC, _gcry_chacha20_ppc8_blocks4)
11055 (_gcry_chacha20_ppc8_blocks1, USE_PPC_VEC_POLY1305)
11056 (_gcry_chacha20_poly1305_ppc8_blocks4): New.
11057 (CHACHA20_context_t): Add 'use_ppc'.
11058 (chacha20_blocks, chacha20_keysetup)
11059 (do_chacha20_encrypt_stream_tail): Add USE_PPC_VEC code.
11060 (_gcry_chacha20_poly1305_encrypt, _gcry_chacha20_poly1305_decrypt): Add
11061 USE_PPC_VEC_POLY1305 code.
11062 * configure.ac: Add 'chacha20-ppc.lo'.
11063 * src/g10lib.h (HWF_PPC_ARCH_2_07): New.
11064 * src/hwf-ppc.c (PPC_FEATURE2_ARCH_2_07): New.
11065 (ppc_features): Add HWF_PPC_ARCH_2_07.
11066 * src/hwfeatures.c (hwflist): Add 'ppc-arch_2_07'.
11067
11068 2019-09-06 Jussi Kivilinna <[email protected]>
11069
11070 poly1305: add fast addition macro for ppc64.
11071 + commit 0564757b934d24c7fef10df8594099985fbbc0ac
11072 * cipher/poly1305.c [USE_MPI_64BIT && __powerpc__] (ADD_1305_64): New.
11073
11074 2019-09-03 Jussi Kivilinna <[email protected]>
11075
11076 Add SHA-512 implementations for POWER8 and POWER9.
11077 + commit 93632f1adf57f142e5d9e9653c405f2ca8c601c0
11078 * cipher/Makefile.am: Add 'sha512-ppc.c'; Add extra CFLAG handling for
11079 'sha512-ppc.c'.
11080 * cipher/sha512-ppc.c: New.
11081 * cipher/sha512.c (USE_PPC_CRYPTO, _gcry_sha512_transform_ppc8)
11082 (_gcry_sha512_transform_ppc9, do_sha512_transform_ppc8)
11083 (do_sha512_transform_ppc9): New.
11084 (sha512_init_common): Add PowerPC HW feature detection and
11085 implementation selection.
11086 * configure.ac: Add 'vshasigmad' instruction to PowerPC assembly
11087 support check; Add 'sha512-ppc.lo'.
11088
11089 2019-08-31 Jussi Kivilinna <[email protected]>
11090
11091 Add SHA-256 implementations for POWER8 and POWER9.
11092 + commit e19dc973bc8e2a0ce92dd87515df3ee338265a8d
11093 * cipher/Makefile.am: Add 'sha256-ppc.c'; Add extra CFLAG handling for
11094 'sha256-ppc.c'.
11095 * cipher/sha256-ppc.c: New.
11096 * cipher/sha256.c (USE_PPC_CRYPTO, _gcry_sha256_transform_ppc8)
11097 (_gcry_sha256_transform_ppc9, do_sha256_transform_ppc8)
11098 (do_sha256_transform_ppc9): New.
11099 (sha256_init, sha224_init): Split common part to new function named...
11100 (sha256_common_init): ...this; Add PowerPC HW feature detection and
11101 implementation selection.
11102 * configure.ac: Add 'vshasigmaw' instruction to PowerPC assembly
11103 support check; Add 'sha256-ppc.lo'.
11104
11105 2019-08-26 Jussi Kivilinna <[email protected]>
11106
11107 hwf-ppc: add detection for PowerISA 3.00.
11108 + commit 418179593080f3028426657c4ef1941cdad85513
11109 * src/g10lib.h (HWF_PPC_ARCH_3_00): New.
11110 * src/hwf-ppc.c (feature_map_s): Remove unused 'feature_match'.
11111 (PPC_FEATURE2_ARCH_3_00): New.
11112 (ppc_features, get_hwcap): Add PowerISA 3.00.
11113 * src/hwfeatures.c (hwflist): Rename "ppc-crypto" to "ppc-vcrypto"; Add
11114 "ppc-arch_3_00".
11115
11116 rijndael-ppc: add bulk modes for CBC, CFB, CTR and XTS.
11117 + commit 81d555d3473016eb9382fb1df153ba1effbbe32e
11118 * cipher/rijndael-ppc.c (vec_add_uint128, _gcry_aes_ppc8_cfb_enc)
11119 (_gcry_aes_ppc8_cfb_dec, _gcry_aes_ppc8_cbc_enc)
11120 (_gcry_aes_ppc8_cbc_dec, _gcry_aes_ppc8_ctr_enc)
11121 (_gcry_aes_ppc8_xts_crypt): New.
11122 * cipher/rijndael.c [USE_PPC_CRYPTO] (_gcry_aes_ppc8_cfb_enc)
11123 (_gcry_aes_ppc8_cfb_dec, _gcry_aes_ppc8_cbc_enc)
11124 (_gcry_aes_ppc8_cbc_dec, _gcry_aes_ppc8_ctr_enc)
11125 (_gcry_aes_ppc8_xts_crypt): New.
11126 (do_setkey, _gcry_aes_cfb_enc, _gcry_aes_cfb_dec, _gcry_aes_cbc_enc)
11127 (_gcry_aes_cbc_dec, _gcry_aes_ctr_enc)
11128 (_gcry_aes_xts_crypto) [USE_PPC_CRYPTO]: Enable PowerPC AES
11129 CFB/CBC/CTR/XTS bulk implementations.
11130 * configure.ac (gcry_cv_gcc_inline_asm_ppc_altivec): Add 'vadduwm'
11131 instruction.
11132
11133 rijndael-ppc: add bulk mode for ocb_auth.
11134 + commit bd1367bb607846d582ad09ded6c4ce4be4e52778
11135 * cipher/rijndael-ppc.c (_gcry_aes_ppc8_ocb_auth): New.
11136 * cipher/rijndael.c [USE_PPC_CRYPTO] (_gcry_aes_ppc8_ocb_auth): New
11137 prototype.
11138 (do_setkey, _gcry_aes_ocb_auth) [USE_PPC_CRYPTO]: Add PowerPC AES
11139 ocb_auth.
11140
11141 rijndael-ppc: enable PowerPC AES-OCB implemention.
11142 + commit 821602c60c7d144c978c335f91ae1641cf668df5
11143 * cipher/rijndael-ppc.c (ROUND_KEY_VARIABLES, PRELOAD_ROUND_KEYS)
11144 (AES_ENCRYPT, AES_DECRYPT): New.
11145 (_gcry_aes_ppc8_prepare_decryption): Rename to...
11146 (aes_ppc8_prepare_decryption): ... this.
11147 (_gcry_aes_ppc8_prepare_decryption): New.
11148 (aes_ppc8_encrypt_altivec, aes_ppc8_decrypt_altivec): Remove.
11149 (_gcry_aes_ppc8_encrypt): Use AES_ENCRYPT macro.
11150 (_gcry_aes_ppc8_decrypt): Use AES_DECRYPT macro.
11151 (_gcry_aes_ppc8_ocb_crypt): Uncomment; Optimizations for OCB offset
11152 calculations, etc; Use new load/store and encryption/decryption macros.
11153 * cipher/rijndaelc [USE_PPC_CRYPTO] (_gcry_aes_ppc8_ocb_crypt): New
11154 prototype.
11155 (do_setkey, _gcry_aes_ocb_crypt) [USE_PPC_CRYPTO]: Add PowerPC AES OCB
11156 encryption/decryption.
11157
11158 rijndael-ppc: add key setup and enable single block PowerPC AES.
11159 + commit 9dca65ef71b4bdbd89a087f41f4dbba71e6d2822
11160 * cipher/Makefile.am: Add 'rijndael-ppc.c'.
11161 * cipher/rijndael-internal.h (USE_PPC_CRYPTO): New.
11162 (RIJNDAEL_context): Add 'use_ppc_crypto'.
11163 * cipher/rijndael-ppc.c (backwards, swap_if_le): Remove.
11164 (u128_t, ALWAYS_INLINE, NO_INLINE, NO_INSTRUMENT_FUNCTION)
11165 (ASM_FUNC_ATTR, ASM_FUNC_ATTR_INLINE, ASM_FUNC_ATTR_NOINLINE)
11166 (ALIGNED_LOAD, ALIGNED_STORE, VEC_LOAD_BE, VEC_STORE_BE)
11167 (vec_bswap32_const, vec_aligned_ld, vec_load_be_const)
11168 (vec_load_be, vec_aligned_st, vec_store_be, _gcry_aes_sbox4_ppc8)
11169 (_gcry_aes_ppc8_setkey, _gcry_aes_ppc8_prepare_decryption)
11170 (aes_ppc8_encrypt_altivec, aes_ppc8_decrypt_altivec): New.
11171 (_gcry_aes_ppc8_encrypt, _gcry_aes_ppc8_decrypt): Rewrite.
11172 (_gcry_aes_ppc8_ocb_crypt): Comment out.
11173 * cipher/rijndael.c [USE_PPC_CRYPTO] (_gcry_aes_ppc8_setkey)
11174 (_gcry_aes_ppc8_prepare_decryption, _gcry_aes_ppc8_encrypt)
11175 (_gcry_aes_ppc8_decrypt): New prototypes.
11176 (do_setkey) [USE_PPC_CRYPTO]: Add setup for PowerPC AES.
11177 (prepare_decryption) [USE_PPC_CRYPTO]: Ditto.
11178 * configure.ac: Add 'rijndael-ppc.lo'.
11179 (gcry_cv_ppc_altivec, gcry_cv_cc_ppc_altivec_cflags)
11180 (gcry_cv_gcc_inline_asm_ppc_altivec)
11181 (gcry_cv_gcc_inline_asm_ppc_arch_3_00): New checks.
11182
11183 2019-08-26 Shawn Landden <[email protected]>
11184
11185 rijndael/ppc: implement single-block mode, and implement OCB block cipher
11186 + commit 92f38a619b1cf759057e9cd532ae7c1d0331100f
11187 * cipher/rijndael-ppc.c: New implementation of single-block mode, and
11188 implementation of OCB mode.
11189
11190 hwf: add detection of PowerPC hardware features.
11191 + commit b4a3c76fabfa07c10fd18b90230f60b806ad9620
11192 * src/Makefile.am: PowerPC hardware detection.
11193 * src/g10lib.h: Likewise.
11194 * src/hwf-common.h: Likewise.
11195 * src/hwf-ppc.c: Likewise.
11196 * src/hwfeatures.c: Likewise.
11197 * configure.ac: Likewise.
11198
11199 2019-08-20 NIIBE Yutaka <[email protected]>
11200
11201 pkgconfig: Fix libgcrypt.pc.
11202 + commit 761d12f140b77b907087590646651d9578b68a54
11203 * src/libgcrypt.pc.in (Cflags, Libs): Have flags.
11204
11205 2019-08-16 NIIBE Yutaka <[email protected]>
11206
11207 build: Fix build with !HAVE_PTHREAD.
11208 + commit 900647d96cb7806cd9b2de343e4a4bd66c073fba
11209 * tests/t-lock.c [!HAVE_PTHREAD]: Buildable now.
11210
11211 ecdsa: Fix unblinding too early.
11212 + commit cdaeb86f067b94d9dff4235ade20dde6479d9bb8
11213 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_sign): Keep the blinding until
11214 the last step.
11215
11216 2019-08-12 NIIBE Yutaka <[email protected]>
11217
11218 build: Fix testapi.c to be buildable.
11219 + commit 376124f86097414cf1f9cbbc17af935d30064c82
11220 * tests/testapi.c: Fix for xgcry_control.
11221
11222 2019-08-08 NIIBE Yutaka <[email protected]>
11223
11224 dsa,ecdsa: Fix use of nonce, use larger one.
11225 + commit 7c2943309d14407b51c8166c4dcecb56a3628567
11226 * cipher/dsa-common.c (_gcry_dsa_modify_k): New.
11227 * cipher/pubkey-internal.h (_gcry_dsa_modify_k): New.
11228 * cipher/dsa.c (sign): Use _gcry_dsa_modify_k.
11229 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_sign): Likewise.
11230 * cipher/ecc-gost.c (_gcry_ecc_gost_sign): Likewise.
11231
11232 2019-08-07 NIIBE Yutaka <[email protected]>
11233 Ján Jančár <[email protected]>
11234
11235 ecc: Add mitigation against timing attack.
11236 + commit b9577f7c89b4327edc09f2231bc8b31521102c79
11237 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_sign): Add the order N to K.
11238 * mpi/ec.c (_gcry_mpi_ec_mul_point): Compute with NBITS of P or larger.
11239
11240 2019-08-07 NIIBE Yutaka <[email protected]>
11241
11242 dsa,ecdsa: Allocate secure memory for RFC6979 generation.
11243 + commit 75c2fbc43d2f2cf5f4c60cb28001fda7324185c2
11244 * cipher/dsa-common.c (_gcry_dsa_gen_rfc6979_k): Use secure memory
11245 just like _gcry_dsa_gen_k does.
11246
11247 2019-07-22 NIIBE Yutaka <[email protected]>
11248
11249 build: Fix previous commit.
11250 + commit 6126fc2f180a9b61064cea5c838d2ff7e0b7774a
11251
11252
11253 build: Use {CFLAGS,CPPFLAGS,LDFLAGS}_FOR_BUILD for helper programs.
11254 + commit 6d80f3f12dc2ff04b0eaa3ba29ee8725b6fb4f69
11255 * configure.ac (CC_FOR_BUILD): Use AX_CC_FOR_BUILD.
11256 * cipher/Makefile.am (gost-s-box): Add
11257 {CFLAGS,CPPFLAGS,LDFLAGS}_FOR_BUILD.
11258 * doc/Makefile.am (yat2m): Likewise.
11259 * m4/ax_cc_for_build.m4: New.
11260
11261 2019-07-18 Jussi Kivilinna <[email protected]>
11262
11263 Fix use of AVX instruction in SHA1/SSSE3 assembly.
11264 + commit 320ed47963032aab7aadd8aefa054b9a7725c9f7
11265 * cipher/sha1-ssse3-amd64.S: Replace 'vmovdqa' with 'movdqa'
11266 instruction.
11267
11268 2019-07-15 Werner Koch <[email protected]>
11269
11270 sexp: Improve argument checking of sexp parser.
11271 + commit 1c2cecbb35e1a0760121d76c327651fe7b2b791a
11272 * src/sexp.c (do_vsexp_sscan): Check for bad length in '%b'.
11273
11274 2019-07-15 NIIBE Yutaka <[email protected]>
11275
11276 tests: t-mpi-point: Remove implementation dependent checks.
11277 + commit 8a0bde8c211c70756a2d8aa46e1bcf1f6f89e55d
11278 * tests/t-mpi-point.c (basic_ec_math): Remove comparing X and Y,
11279 only comparison of Z is relevant, mathematically.
11280 Remove useless check, where different values in equivalence class
11281 exist.
11282 (basic_ec_math_simplified): Likewise.
11283
11284 2019-06-25 NIIBE Yutaka <[email protected]>
11285
11286 sexp: Support reading base64.
11287 + commit ab57613f10ad57d2fec648017c18d7abb189863b
11288 * configure.ac (NEED_GPG_ERROR_VERSION): Require libgpg-error >= 1.27.
11289 * src/sexp.c (do_vsexp_sscan): Support data in base64 format.
11290 * tests/t-sexp.c (check_extract_param): Add a test case.
11291
11292 2019-06-24 NIIBE Yutaka <[email protected]>
11293
11294 ecc: Correctly return an error.
11295 + commit b4a1114dc77617f0e772ddc4faf8820399b4354a
11296 * cipher/ecc-ecdh.c (_gcry_ecc_get_algo_keylen): Return 0 for
11297 unknow algorithm.
11298 (_gcry_ecc_mul_point): Return GPG_ERR_UNSUPPORTED_ALGORITHM for
11299 GCRY_ECC_CURVE448 for now.
11300 Return GPG_ERR_UNKNOWN_ALGORITHM, otherwise.
11301
11302 2019-06-21 NIIBE Yutaka <[email protected]>
11303
11304 tests: Fix the Curve25519 test.
11305 + commit 6934711d572e13e9e78fb2c53bb119034b088c5a
11306 * tests/t-cv25519.c (test_cv_x25519): Initialize SCALAR.
11307
11308 ecc: Improve new ECDH API.
11309 + commit a658c9ccc2c741f40b0b5cdbcd184cfb9a841d17
11310 * cipher/ecc-ecdh.c (_gcry_ecc_get_algo_keylen): New.
11311 (_gcry_ecc_mul_point): Fill into the RESULT buffer, instead of
11312 allocating new buffer.
11313 * src/gcrypt-int.h: Change the API.
11314 * src/gcrypt.h.in: Likewise.
11315 * src/libgcrypt.def (gcry_ecc_get_algo_keylen): New.
11316 * src/libgcrypt.vers (gcry_ecc_get_algo_keylen): New.
11317 * src/visibility.c (gcry_ecc_get_algo_keylen): New.
11318 * src/visibility.h (gcry_ecc_get_algo_keylen): New.
11319 * tests/t-cv25519.c: Fix the use case.
11320
11321 2019-06-20 NIIBE Yutaka <[email protected]>
11322
11323 ecc: X25519 API change to allow NULL for POINT.
11324 + commit 6d77c2054ea0358fb4c6f59b4c91c673c0a83b03
11325 * cipher/ecc-ecdh.c (_gcry_ecc_mul_point): Allow NULL for point,
11326 meaning G.
11327
11328 ecc: Add an API for X25519 function as gcry_ecc_mul_point.
11329 + commit ec8c2cdf977aa8d9ca5af0a9bd25aeb9190570b3
11330 * configure.ac: Add ecc-ecdh.lo.
11331 * cipher/Makefile.am: Add ecc-ecdh.c.
11332 * cipher/ecc-common.h (reverse_buffer): Expose.
11333 * cipher/ecc-eddsa.c (reverse_buffer): Expose.
11334 * cipher/ecc-curves.c (domain_parms): Fix as the errata of RFC.
11335 * cipher/ecc-ecdh.c: New.
11336 * cipher/ecc-misc.c (_gcry_ecc_mont_decodepoint): Fix for other curves
11337 than Curve25519.
11338 * src/gcrypt-int.h (_gcry_ecc_mul_point): New.
11339 * src/gcrypt.h.in (enum gcry_ecc_curves): New.
11340 (gcry_ecc_mul_point): new.
11341 * src/libgcrypt.def (gcry_ecc_mul_point): New.
11342 * src/libgcrypt.vers (gcry_ecc_mul_point): New.
11343 * src/visibility.h (gcry_ecc_mul_point): New.
11344 * src/visibility.c (gcry_ecc_mul_point): New.
11345 * tests/t-cv25519.c (test_cv_hl): Rename from test_cv.
11346 (test_cv_x25519): New.
11347 (test_cv): Call both of test_cv_hl and test_cv_x25519.
11348
11349 2019-06-05 Jussi Kivilinna <[email protected]>
11350
11351 tests/basic: add CTR mode carry overflow test vectors.
11352 + commit 971d372f512ff6805d5b8b54e9ac1446f3f66643
11353 * tests/basic.c (check_ctr_cipher): Change tv structure 'plaintext'
11354 and 'out' to pointers; Add counter carry overflow test vectors; Make
11355 temporary buffer large enough for new test vectors.
11356
11357 GCM: move look-up table to .data section and unshare between processes.
11358 + commit a4c561aab1014c3630bc88faf6f5246fee16b020
11359 * cipher/cipher-gcm.c (ATTR_ALIGNED_64): New.
11360 (gcmR): Move to 'gcm_table' structure.
11361 (gcm_table): New structure for look-up table with counters before and
11362 after.
11363 (gcmR): New macro.
11364 (prefetch_table): Handle input with length not multiple of 256.
11365 (do_prefetch_tables): Modify pre- and post-table counters to unshare
11366 look-up table pages between processes.
11367
11368 AES: move look-up tables to .data section and unshare between processes.
11369 + commit daedbbb5541cd8ecda1459d3b843ea4d92788762
11370 * cipher/rijndael-internal.h (ATTR_ALIGNED_64): New.
11371 * cipher/rijndael-tables.h (encT): Move to 'enc_tables' structure.
11372 (enc_tables): New structure for encryption table with counters before
11373 and after.
11374 (encT): New macro.
11375 (dec_tables): Add counters before and after encryption table; Move
11376 from .rodata to .data section.
11377 (do_encrypt): Change 'encT' to 'enc_tables.T'.
11378 (do_decrypt): Change '&dec_tables' to 'dec_tables.T'.
11379 * cipher/cipher-gcm.c (prefetch_table): Make inline; Handle input
11380 with length not multiple of 256.
11381 (prefetch_enc, prefetch_dec): Modify pre- and post-table counters
11382 to unshare look-up table pages between processes.
11383
11384 2019-05-19 Jussi Kivilinna <[email protected]>
11385
11386 cipher/Makefile.am: add '-fcoverage-*' to instrumentation munging.
11387 + commit c6ffa216976d80a13486b13f64d6776cdb8b6ccf
11388 * cipher/Makefile.am: Remove '-fcoverage-*' flag for mixed asm/C
11389 i386+amd64 implementations.
11390
11391 2019-05-15 Jussi Kivilinna <[email protected]>
11392
11393 md: fix UBSAN warning.
11394 + commit dad94696d9c48c18b59576776c7caa95123dfa1b
11395 * cipher/md.c (gcry_md_list): Define 'context' as array of
11396 PROPERLY_ALIGNED_TYPE.
11397 (md_enable, _gcry_md_reset, _gcry_md_close, md_final, md_set_key)
11398 (prepare_macpads, md_read, md_extract): Access md context through
11399 'gcry_md_list->context' pointer instead of 'gcry_md_list->context.c'.
11400
11401 Disable instrumentation on mixed Intel SSE C/assembly implementations.
11402 + commit d24dae4538dbbda9e6c72a34fae69682cfb2fef0
11403 * cipher/Makefile.am: Make 'tiger.o' and 'tiger.lo' depend on Makefile;
11404 Add instrumentation option munging.
11405 * cipher/cipher-gcm-intel-pcmul.c (ALWAYS_INLINE)
11406 (NO_INSTRUMENT_FUNCTION, ASM_FUNC_ATTR, ASM_FUNC_ATTR_INLINE): New.
11407 (reduction, gfmul_pclmul, gfmul_pclmul_aggr4, gfmul_pclmul_aggr8)
11408 (gcm_lsh): Define with 'ASM_FUNC_ATTR_INLINE' instead of 'inline'.
11409 (_gcry_ghash_setup_intel_pclmul, _gcry_ghash_intel_pclmul): Define with
11410 'ASM_FUNC_ATTR'.
11411 * cipher/crc-intel-pcmul.c (ALWAYS_INLINE, NO_INSTRUMENT_FUNCTION)
11412 (ASM_FUNC_ATTR, ASM_FUNC_ATTR_INLINE): New.
11413 (crc32_reflected_bulk, crc32_reflected_less_than_16, crc32_bulk)
11414 (crc32_less_than_16): Define with 'ASM_FUNC_ATTR_INLINE' instead of
11415 'inline'.
11416 (_gcry_crc32_intel_pclmul, _gcry_crc24rfc2440_intel_pclmul): Define
11417 with 'ASM_FUNC_ATTR'.
11418 * cipher/rijndael-aesni.c (NO_INSTRUMENT_FUNCTION, ASM_FUNC_ATTR)
11419 (ASM_FUNC_ATTR_INLINE, ASM_FUNC_ATTR_NOINLINE): New.
11420 (aes_ocb_get_l, do_aesni_prepare_decryption, do_aesni_enc)
11421 (do_aesni_dec, do_aesni_enc_vec4, do_aesni_dec_vec4, do_aesni_enc_vec8)
11422 (do_aesni_dec_vec8, aesni_ocb_checksum): Define with
11423 'ASM_FUNC_ATTR_INLINE' instead of 'inline'.
11424 (do_aesni_ctr, do_aesni_ctr_4, do_aesni_ctr_8): Define wtih
11425 'ASM_FUNC_ATTR_INLINE'.
11426 (aesni_ocb_enc, aesni_ocb_dec): Define with 'ASM_FUNC_ATTR_NOINLINE'
11427 instead of 'NO_INLINE'.
11428 (_gcry_aes_aesni_do_setkey, _gcry_aes_aesni_prepare_decryption)
11429 (_gcry_aes_aesni_encrypt, _gcry_aes_aesni_cfg_enc)
11430 (_gcry_aes_aesni_cbc_enc, _gcry_aes_aesni_ctr_enc)
11431 (_gcry_aes_aesni_decrypt, _gcry_aes_aesni_cfb_dec)
11432 (_gcry_aes_aesni_cbc_dec, _gcry_aes_aesni_ocb_crypt)
11433 (_gcry_aes_aesni_ocb_auth, _gcry_aes_aesni_xts_enc)
11434 (_gcry_aes_aesni_xts_dec, _gcry_aes_aesni_xts_crypt): Define with
11435 'ASM_FUNC_ATTR'.
11436 * cipher/rijndael-ssse3-amd64.c (ALWAYS_INLINE, NO_INSTRUMENT_FUNCTION)
11437 (ASM_FUNC_ATTR, ASM_FUNC_ATTR_INLINE): New.
11438 (aes_ocb_get_l, do_ssse3_prepare_decryption, do_vpaes_ssse3_enc)
11439 (do_vpaes_ssse3_dec): Define with 'ASM_FUNC_ATTR_INLINE' instead of
11440 'inline'.
11441 (_gcry_aes_ssse3_do_setkey, _gcry_aes_ssse3_prepare_decryption)
11442 (_gcry_aes_ssse3_encrypt, _gcry_aes_ssse3_cfb_enc)
11443 (_gcry_aes_ssse3_cbc_enc, _gcry_aes_ssse3_ctr_enc)
11444 (_gcry_aes_ssse3_decrypt, _gcry_aes_ssse3_cfb_dec)
11445 (_gcry_aes_ssse3_cbc_dec, ssse3_ocb_enc, ssse3_ocb_dec)
11446 (_gcry_aes_ssse3_ocb_crypt, _gcry_aes_ssse3_ocb_auth): Define with
11447 'ASM_FUNC_ATTR'.
11448 * cipher/sha1-intel-shaext.c (NO_INSTRUMENT_FUNCTION)
11449 (ASM_FUNC_ATTR): New.
11450 (_gcry_sha1_transform_intel_shaext): Define with 'ASM_FUNC_ATTR'.
11451 * cipher/sha256-intel-shaext.c (NO_INSTRUMENT_FUNCTION)
11452 (ASM_FUNC_ATTR): New.
11453 (_gcry_sha256_transform_intel_shaext): Define with 'ASM_FUNC_ATTR'.
11454 * configure.ac (ENABLE_INSTRUMENTATION_MUNGING): New.
11455
11456 tests/basic: fix signed interger overflow.
11457 + commit 3c7ff6bd1c40d5216d6c12b6b28f77fd1a57baa7
11458 * tests/basic.c (check_ocb_cipher_largebuf_split): Cast to unsigned
11459 when generating buffer values.
11460
11461 2019-05-14 Jussi Kivilinna <[email protected]>
11462
11463 tests: do not use GCC variadic macro extension for xgcry_control.
11464 + commit be567cb5dd629e9aa22d81b29d4326e5aa97efa7
11465 * tests/t-common.h (xgcry_control): Use doubly nested parenthesis for
11466 passing arguments for gcry_control instead of GCC specific variadic
11467 macro extension.
11468 * tests/aeswrap.c: Change xgcry_control to use doubly nested
11469 parenthesis.
11470 * tests/basic.c: Ditto.
11471 * tests/bench-slope.c: Ditto.
11472 * tests/benchmark.c: Ditto.
11473 * tests/curves.c: Ditto.
11474 * tests/dsa-rfc6979.c: Ditto.
11475 * tests/fips186-dsa: Ditto.
11476 * tests/fipsdrv.c: Ditto.
11477 * tests/fipsrngdrv.c: Ditto.
11478 * tests/gchash.c: Ditto.
11479 * tests/hashtest.c: Ditto.
11480 * tests/hmac.c: Ditto.
11481 * tests/keygen.c: Ditto.
11482 * tests/keygrip.c: Ditto.
11483 * tests/mpitests.c: Ditto.
11484 * tests/pkbench.c: Ditto.
11485 * tests/pkcs1v2.c: Ditto.
11486 * tests/prime.c: Ditto.
11487 * tests/pubkey.c: Ditto.
11488 * tests/random.c: Ditto.
11489 * tests/rsacvt.c: Ditto.
11490 * tests/t-convert.c: Ditto.
11491 * tests/t-cv25519.c: Ditto.
11492 * tests/t-ed25519.c: Ditto.
11493 * tests/t-kdf.c: Ditto.
11494 * tests/t-lock.c: Ditto.
11495 * tests/t-mpi-bit.c: Ditto.
11496 * tests/t-mpi-point.c: Ditto.
11497 * tests/t-secmem.c: Ditto.
11498 * tests/t-sexp.c: Ditto.
11499 * tests/version.c: Ditto.
11500
11501 2019-05-10 Jussi Kivilinna <[email protected]>
11502
11503 tests/basic: mark CFB and CFB8 as stream block cipher modes.
11504 + commit 34e9306a66b47785ddbab6594ae4c23581d35b5a
11505 * tests/basic.c (get_algo_mode_blklen): Return '1' for CFB and CFB8.
11506
11507 2019-05-09 Jussi Kivilinna <[email protected]>
11508
11509 Fix message digest final function for MD4, MD5 and RMD160.
11510 + commit 15592cd52f543aadb2fab8f6c112c68075309ad6
11511 * cipher/md4.c (md4_final): Use buffer offset '64 + 56' for bit count
11512 on 'need one extra block' path.
11513 * cipher/md5.c (md5_final): Ditto.
11514 * cipher/rmd160.c (rmd160_final): Ditto.
11515 * tests/basic.c (check_one_md_final): New.
11516 (check_digest): Add new '*' test vectors and handle them with
11517 check_one_md_final.
11518
11519 2019-05-06 Dmitry Eremin-Solenikov <[email protected]>
11520
11521 Fix carry overflow in Stribog in 512-bit addition.
11522 + commit da6cd4fea30f79cf9d8f9b2f1c6daf3aea39fa9c
11523 * cipher/stribog.c (transform_bits): properly calculate carry flag
11524 * tests/basic.c (check_digests): add two more test cases
11525
11526 2019-04-27 Jussi Kivilinna <[email protected]>
11527
11528 Add support for explicit_memset.
11529 + commit 71b0eb3fb75d2e6bbd86df055dc667b2debab0c1
11530 * configure.ac: Add function check for 'explicit_memset'.
11531 * src/misc.c (_gcry_fast_wipememory, _gcry_fast_wipememory2): Use
11532 explicit_memset if available.
11533
11534 Fix CFI_PUSH/CFI_POP redefine build warning with AMD64 MPI.
11535 + commit 78b1047eded8d5f8a13162d13160fce1809f6ee4
11536 * mpi/amd64/func_abi.h: Move CFI macros into [__x86_64__] block.
11537 * mpi/i386/syntax.h: Move CFI macros into [__i386__] block.
11538
11539 Enable four block aggregated GCM Intel PCLMUL implementation on i386.
11540 + commit a6e7c411e5f67a9473675ca8d49017a4d13a8d3e
11541 * cipher/cipher-gcm-intel-pclmul.c (reduction): Change "%%xmm7" to
11542 "%%xmm5".
11543 (gfmul_pclmul_aggr4): Move outside [__x86_64__] block; Remove usage of
11544 XMM8-XMM15 registers; Do not preload H-values and be_mask to reduce
11545 register usage for i386.
11546 (_gcry_ghash_setup_intel_pclmul): Enable calculation of H2, H3 and H4
11547 on i386.
11548 (_gcry_ghash_intel_pclmul): Adjust to above gfmul_pclmul_aggr4
11549 changes; Move 'aggr4' code path outside [__x86_64__] block.
11550
11551 Prefetch GCM look-up tables.
11552 + commit 1374254c2904ab5b18ba4a890856824a102d4705
11553 * cipher/cipher-gcm.c (prefetch_table, do_prefetch_tables)
11554 (prefetch_tables): New.
11555 (ghash_internal): Call prefetch_tables.
11556
11557 Optimizations for generic table-based GCM implementations.
11558 + commit ecd02cdd61e8c690f48637656f0e1e08b750fe30
11559 * cipher/cipher-gcm.c [GCM_TABLES_USE_U64] (do_fillM): Precalculate
11560 M[32..63] values.
11561 [GCM_TABLES_USE_U64] (do_ghash): Split processing of two 64-bit halfs
11562 of the input to two separate loops; Use precalculated M[] values.
11563 [GCM_USE_TABLES && !GCM_TABLES_USE_U64] (do_fillM): Precalculate
11564 M[64..127] values.
11565 [GCM_USE_TABLES && !GCM_TABLES_USE_U64] (do_ghash): Use precalculated
11566 M[] values.
11567 [GCM_USE_TABLES] (bshift): Avoid conditional execution for mask
11568 calculation.
11569 * cipher/cipher-internal.h (gcry_cipher_handle): Double gcm_table size.
11570
11571 2019-04-26 Jussi Kivilinna <[email protected]>
11572
11573 Optimizations for GCM Intel/PCLMUL implementation.
11574 + commit af5f3fb08674608acf6617ea622ed0b9a2ee77a5
11575 * cipher/cipher-gcm-intel-pclmul.c (reduction): New.
11576 (glmul_pclmul): Include shifting to left into pclmul operations; Use
11577 'reduction' helper function.
11578 [__x86_64__] (gfmul_pclmul_aggr4): Reorder instructions and adjust
11579 register usage to free up registers; Use 'reduction' helper function;
11580 Include shifting to left into pclmul operations; Moving load H values
11581 and input from caller into this function.
11582 [__x86_64__] (gfmul_pclmul_aggr8): New.
11583 (gcm_lsh): New.
11584 (_gcry_ghash_setup_intel_pclmul): Left shift H values to left by
11585 one; Preserve XMM6-XMM15 registers on WIN64.
11586 (_gcry_ghash_intel_pclmul) [__x86_64__]: Use 8 block aggregated
11587 reduction function.
11588
11589 Move data pointer macro for 64-bit ARM assembly to common header.
11590 + commit b9be297bb8eba7a09fa8413261de1587adcfd381
11591 * cipher/asm-common-aarch64.h (GET_DATA_POINTER): New.
11592 * cipher/chacha20-aarch64.S (GET_DATA_POINTER): Remove.
11593 * cipher/cipher-gcm-armv8-aarch64-ce.S (GET_DATA_POINTER): Remove.
11594 * cipher/crc-armv8-aarch64-ce.S (GET_DATA_POINTER): Remove.
11595 * cipher/rijndael-armv8-aarch64-ce.S (GET_DATA_POINTER): Remove.
11596 * cipher/sha1-armv8-aarch64-ce.S (GET_DATA_POINTER): Remove.
11597 * cipher/sha256-armv8-aarch64-ce.S (GET_DATA_POINTER): Remove.
11598
11599 Add CFI unwind assembly directives for 64-bit ARM assembly.
11600 + commit 5a2a96a63517838e04f9fc0fb2d932fac5124b8a
11601 * cipher/asm-common-aarch64.h (CFI_STARTPROC, CFI_ENDPROC)
11602 (CFI_REMEMBER_STATE, CFI_RESTORE_STATE, CFI_ADJUST_CFA_OFFSET)
11603 (CFI_REL_OFFSET, CFI_DEF_CFA_REGISTER, CFI_REGISTER, CFI_RESTORE)
11604 (DW_REGNO_SP, DW_SLEB128_7BIT, DW_SLEB128_28BIT, CFI_CFA_ON_STACK)
11605 (CFI_REG_ON_STACK): New.
11606 * cipher/camellia-aarch64.S: Add CFI directives.
11607 * cipher/chacha20-aarch64.S: Add CFI directives.
11608 * cipher/cipher-gcm-armv8-aarch64-ce.S: Add CFI directives.
11609 * cipher/crc-armv8-aarch64-ce.S: Add CFI directives.
11610 * cipher/rijndael-aarch64.S: Add CFI directives.
11611 * cipher/rijndael-armv8-aarch64-ce.S: Add CFI directives.
11612 * cipher/sha1-armv8-aarch64-ce.S: Add CFI directives.
11613 * cipher/sha256-armv8-aarch64-ce.S: Add CFI directives.
11614 * cipher/twofish-aarch64.S: Add CFI directives.
11615 * mpi/aarch64/mpih-add1.S: Add CFI directives.
11616 * mpi/aarch64/mpih-mul1.S: Add CFI directives.
11617 * mpi/aarch64/mpih-mul2.S: Add CFI directives.
11618 * mpi/aarch64/mpih-mul3.S: Add CFI directives.
11619 * mpi/aarch64/mpih-sub1.S: Add CFI directives.
11620 * mpi/asm-common-aarch64.h: Include "../cipher/asm-common-aarch64.h".
11621 (ELF): Remove.
11622
11623 Add 64-bit ARMv8/CE PMULL implementation of CRC.
11624 + commit 14c8a593ede42f51f567ed7ba77b53124151aa38
11625 * cipher/Makefile.am: Add 'crc-armv8-ce.c' and
11626 'crc-armv8-aarch64-ce.S'.
11627 * cipher/asm-common-aarch64.h [HAVE_GCC_ASM_CFI_DIRECTIVES]: Add CFI
11628 helper macros.
11629 * cipher/crc-armv8-aarch64-ce.S: New.
11630 * cipher/crc-armv8-ce.c: New.
11631 * cipher/crc.c (USE_ARM_PMULL): New.
11632 (CRC_CONTEXT) [USE_ARM_PMULL]: Add 'use_pmull'.
11633 [USE_ARM_PMULL] (_gcry_crc32_armv8_ce_pmull)
11634 (_gcry_crc24rfc2440_armv8_ce_pmull): New prototypes.
11635 (crc32_init, crc32rfc1510_init, crc24rfc2440_init): Enable ARM PMULL
11636 implementations if supported by HW features.
11637 (crc32_write, crc24rfc2440_write) [USE_ARM_PMULL]: Use ARM PMULL
11638 implementations if enabled.
11639 * configure.ac: Add 'crc-armv8-ce.lo' and 'crc-armv8-aarch64-ce.lo'.
11640
11641 2019-04-18 Jussi Kivilinna <[email protected]>
11642
11643 mpi: make stack unwinding work at i386 mpi functions.
11644 + commit b878a986f3ab2c35aff89c7f66f137a91542ed5b
11645 * mpi/i386/syntax.h: Include 'config.h'.
11646 (CFI_STARTPROC, CFI_ENDPROC, CFI_ADJUST_CFA_OFFSET, CFI_REL_OFFSET)
11647 (CFI_RESTORE, CFI_PUSH, CFI_POP): New.
11648 * mpi/i386/mpih-add1.S: Add CFI directives.
11649 * mpi/i386/mpih-lshift.S: Add CFI directives.
11650 * mpi/i386/mpih-mul1.S: Add CFI directives.
11651 * mpi/i386/mpih-mul2.S: Add CFI directives.
11652 * mpi/i386/mpih-mul3.S: Add CFI directives.
11653 * mpi/i386/mpih-rshift.S: Add CFI directives.
11654 * mpi/i386/mpih-sub1.S: Add CFI directives.
11655
11656 hwf-x86: make stack unwinding work at i386 cpuid functions.
11657 + commit 0bd18e8bf7d67072f8c77352140b4ed4cfde3c6c
11658 * src/hwf-x86.c (FORCE_FUNC_FRAME_POINTER): New.
11659 [__i386__] (is_cpuid_available): Force use of stack frame pointer as
11660 inline assembly modifies stack register; Add 'memory' constraint for
11661 inline assembly.
11662 [__i386__] (get_cpuid): Avoid push/pop instruction when preserving
11663 %ebx register over cpuid.
11664
11665 Limit and document Blowfish key lengths to 8-576 bits.
11666 + commit 3546599e5578f89f9e77b08bf599f9c44b23da5f
11667 * cipher/blowfish.c (BLOWFISH_KEY_MIN_BITS)
11668 (BLOWFISH_KEY_MAX_BITS): New.
11669 (do_bf_setkey): Check input key length to MIN_BITS and MAX_BITS.
11670 * doc/gcrypt.texi: Update supported Blowfish key lengths.
11671 * tests/basic.c (check_ecb_cipher): New, with Blowfish test vectors
11672 for different key lengths.
11673 (check_cipher_modes): Call 'check_ecb_cipher'.
11674
11675 2019-04-16 Jussi Kivilinna <[email protected]>
11676
11677 Add CFI unwind assembly directives for AMD64 assembly.
11678 + commit d11ae95d05dc39ec6b825d1109afadd964589880
11679 * configure.ac (gcry_cv_gcc_asm_cfi_directives): New.
11680 * cipher/asm-common-amd64.h (ADD_RIP, CFI_STARTPROC, CFI_ENDPROC)
11681 (CFI_REMEMBER_STATE, CFI_RESTORE_STATE, CFI_ADJUST_CFA_OFFSET)
11682 (CFI_REL_OFFSET, CFI_DEF_CFA_REGISTER, CFI_REGISTER, CFI_RESTORE)
11683 (CFI_PUSH, CFI_POP, CFI_POP_TMP_REG, CFI_LEAVE, DW_REGNO)
11684 (DW_SLEB128_7BIT, DW_SLEB128_28BIT, CFI_CFA_ON_STACK)
11685 (CFI_REG_ON_STACK): New.
11686 (ENTER_SYSV_FUNCPARAMS_0_4, EXIT_SYSV_FUNC): Add CFI directives.
11687 * cipher/arcfour-amd64.S: Add CFI directives.
11688 * cipher/blake2b-amd64-avx2.S: Add CFI directives.
11689 * cipher/blake2s-amd64-avx.S: Add CFI directives.
11690 * cipher/blowfish-amd64.S: Add CFI directives.
11691 * cipher/camellia-aesni-avx-amd64.S: Add CFI directives; Use
11692 'asm-common-amd64.h'.
11693 * cipher/camellia-aesni-avx2-amd64.S: Add CFI directives; Use
11694 'asm-common-amd64.h'.
11695 * cipher/cast5-amd64.S: Add CFI directives.
11696 * cipher/chacha20-amd64-avx2.S: Add CFI directives.
11697 * cipher/chacha20-amd64-ssse3.S: Add CFI directives.
11698 * cipher/des-amd64.S: Add CFI directives.
11699 * cipher/rijndael-amd64.S: Add CFI directives.
11700 * cipher/rijndael-ssse3-amd64-asm.S: Add CFI directives.
11701 * cipher/salsa20-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'.
11702 * cipher/serpent-avx2-amd64.S: Add CFI directives; Use
11703 'asm-common-amd64.h'.
11704 * cipher/serpent-sse2-amd64.S: Add CFI directives; Use
11705 'asm-common-amd64.h'.
11706 * cipher/sha1-avx-amd64.S: Add CFI directives; Use
11707 'asm-common-amd64.h'.
11708 * cipher/sha1-avx-bmi2-amd64.S: Add CFI directives; Use
11709 'asm-common-amd64.h'.
11710 * cipher/sha1-avx2-bmi2-amd64.S: Add CFI directives; Use
11711 'asm-common-amd64.h'.
11712 * cipher/sha1-ssse3-amd64.S: Add CFI directives; Use
11713 'asm-common-amd64.h'.
11714 * cipher/sha256-avx-amd64.S: Add CFI directives; Use
11715 'asm-common-amd64.h'.
11716 * cipher/sha256-avx2-bmi2-amd64.S: Add CFI directives; Use
11717 'asm-common-amd64.h'.
11718 * cipher/sha256-ssse3-amd64.S: Add CFI directives; Use
11719 'asm-common-amd64.h'.
11720 * cipher/sha512-avx-amd64.S: Add CFI directives; Use
11721 'asm-common-amd64.h'.
11722 * cipher/sha512-avx2-bmi2-amd64.S: Add CFI directives; Use
11723 'asm-common-amd64.h'.
11724 * cipher/sha512-ssse3-amd64.S: Add CFI directives; Use
11725 'asm-common-amd64.h'.
11726 * cipher/twofish-amd64.S: Add CFI directives.
11727 * cipher/twofish-avx2-amd64.S: Add CFI directives; Use
11728 'asm-common-amd64.h'.
11729 * cipher/whirlpool-sse2-amd64.S: Add CFI directives; Use
11730 'asm-common-amd64.h'.
11731 * mpi/amd64/func_abi.h: Include 'config.h'.
11732 (CFI_STARTPROC, CFI_ENDPROC, CFI_ADJUST_CFA_OFFSET, CFI_REL_OFFSET)
11733 (CFI_RESTORE, CFI_PUSH, CFI_POP): New.
11734 (FUNC_ENTRY, FUNC_EXIT): Add CFI directives.
11735
11736 2019-04-15 Jussi Kivilinna <[email protected]>
11737
11738 twofish-amd64: do not use xchg instruction.
11739 + commit 0903b215ef5a18332b740a24e6e2bfbed9e1d97b
11740 * cipher/twofish-amd64.S (g1g2_3): Swap ab and cd registers using
11741 'movq' instructions instead of 'xchgq'.
11742
11743 2019-04-09 Jussi Kivilinna <[email protected]>
11744
11745 Use FreeBSD's elf_aux_info for detecting ARM HW features.
11746 + commit 2ffc689d4757f31f1e2c4961b94b0b0c8dc302b7
11747 * configure.ac: Add function check for 'elf_aux_info'.
11748 * src/hwf-arm.c [HAVE_ELF_AUX_INFO]: Include 'sys/auxv.h'.
11749 [HAVE_ELF_AUX_INFO && !HAVE_GETAUXVAL] (HAVE_GETAUXVAL)
11750 (getauxval): New.
11751
11752 2019-04-08 Jussi Kivilinna <[email protected]>
11753
11754 Use getauxval system function for detecting ARM HW features.
11755 + commit 6812a2c5bd2d9129bfdf34f3daf89cd8543ed8e5
11756 * configure.ac: Add header check for 'sys/auxv.h'; Add function check
11757 for 'getauxval'.
11758 * src/hwf-arm.c [HAVE_SYS_AUXV_H && HAVE_GETAUXVAL]: Include
11759 'sys/auxv.h'.
11760 (HAS_SYS_AT_HWCAP): Enable AT_HWCAP if have 'getauxval' in addition of
11761 __linux__.
11762 (AT_HWCAP, AT_HWCAP2, HWCAP_NEON, HWCAP2_AES, HWCAP2_PMULL)
11763 (HWCAP2_SHA1, HWCAP2_SHA2, HWCAP_ASIMD, HWCAP_AES)
11764 (HWCAP_PMULL, HWCAP_SHA1, HWCAP_SHA2): Define these macros only if not
11765 already defined.
11766 (get_hwcap) [HAVE_SYS_AUXV_H && HAVE_GETAUXVAL]: Use 'getauxval' to
11767 fetch HW capability flags.
11768
11769 Disable SM3 in FIPS mode.
11770 + commit 04a6c3c7482dd1ecb5113a049b1765b0d5f212fb
11771 * cipher/sm3.h (_gcry_digest_spec_sm3): Set flags.fips to zero.
11772
11773 2019-04-07 Jussi Kivilinna <[email protected]>
11774
11775 Tune SHA-512/AVX2 and SHA-256/AVX2 implementations.
11776 + commit 478581c5107ae75281c54e56cdcef5165f3155ca
11777 * cipher/sha256-avx2-bmi2-amd64.S (ONE_ROUND_PART1, ONE_ROUND_PART2)
11778 (ONE_ROUND): New round function.
11779 (FOUR_ROUNDS_AND_SCHED, FOUR_ROUNDS): Use new round function.
11780 (_gcry_sha256_transform_amd64_avx2): Exit early if number of blocks is
11781 zero; Writing XFER to stack earlier and handle XREF writing in
11782 FOUR_ROUNDS_AND_SCHED.
11783 * cipher/sha512-avx2-bmi2-amd64.S (MASK_YMM_LO, MASK_YMM_LOx): New.
11784 (ONE_ROUND_PART1, ONE_ROUND_PART2, ONE_ROUND): New round function.
11785 (FOUR_ROUNDS_AND_SCHED, FOUR_ROUNDS): Use new round function.
11786 (_gcry_sha512_transform_amd64_avx2): Writing XFER to stack earlier and
11787 handle XREF writing in FOUR_ROUNDS_AND_SCHED.
11788
11789 2019-04-05 Jussi Kivilinna <[email protected]>
11790
11791 Add SHA512/224 and SHA512/256 algorithms.
11792 + commit a3683b6f623189a4b65bb584bb9e65e3ad7b3139
11793 * cipher/mac-hmac.c (map_mac_algo_to_md): Add mapping for SHA512/224
11794 and SHA512/256.
11795 (_gcry_mac_type_spec_hmac_sha512_256)
11796 (_gcry_mac_type_spec_hmac_sha512_224): New.
11797 * cipher/mac-internal.h (_gcry_mac_type_spec_hmac_sha512_256)
11798 (_gcry_mac_type_spec_hmac_sha512_224): New.
11799 * cipher/mac.c (mac_list, mac_list_algo101): Add SHA512/224 and
11800 SHA512/256.
11801 * cipher/md.c (digest_list, digest_list_algo301)
11802 (prepare_macpads): Ditto.
11803 * cipher/sha512.c (run_selftests): Ditto.
11804 (sha512_init_common): Move common initialization here.
11805 (sha512_init, sha384_init): Use common initialization function.
11806 (sha512_224_init, sha512_256_init, _gcry_sha512_224_hash_buffer)
11807 (_gcry_sha512_224_hash_buffers, _gcry_sha512_256_hash_buffer)
11808 (_gcry_sha512_256_hash_buffers, selftests_sha512_224)
11809 (selftests_sha512_256, sha512_224_asn, oid_spec_sha512_224)
11810 (_gcry_digest_spec_sha512_224, sha512_256_asn, oid_spec_sha512_256)
11811 (_gcry_digest_spec_sha512_256): New.
11812 * doc/gcrypt.texi: Add SHA512/224 and SHA512/256; Add missing
11813 HMAC-BLAKE2s and HMAC-BLAKE2b.
11814 * src/cipher.h (_gcry_digest_spec_sha512_224)
11815 (_gcry_digest_spec_sha512_256): New.
11816 * src/gcrypt.h.in (GCRY_MD_SHA512_256, GCRY_MD_SHA512_224): New.
11817 (GCRY_MAC_HMAC_SHA512_256, GCRY_MAC_HMAC_SHA512_224): New.
11818 * tests/basic.c (check_digests): Add SHA512/224 and SHA512/256
11819 test vectors.
11820
11821 Remove extra buffer flush at begining of digest final functions.
11822 + commit c6055aaccac86e1ca8a9d35c980d7abbacf2a9ff
11823 * cipher/md2.c (md2_final): Remove _gcry_md_block_write flush call
11824 from entry.
11825 * cipher/md4.c (md4_final): Ditto.
11826 * cipher/md5.c (md5_final): Ditto.
11827 * cipher/rmd160.c (rmd160_final): Ditto.
11828 * cipher/sha1.c (sha1_final): Ditto.
11829 * cipher/sha256.c (sha256_final): Ditto.
11830 * cipher/sha512.c (sha512_final): Ditto.
11831 * cipher/sm3.c (sm3_final): Ditto.
11832 * cipher/stribog.c (stribog_final): Ditto.
11833 * cipher/tiger.c (tiger_final): Ditto.
11834
11835 Optimizations for digest final functions.
11836 + commit e76cd0e2b1f6025c1319576a5848815d1d231aeb
11837 * cipher/md4.c (md4_final): Avoid byte-by-byte buffer setting when
11838 padding; Merge extra and last block processing.
11839 * cipher/md5.c (md5_final): Ditto.
11840 * cipher/rmd160.c (rmd160_final): Ditto.
11841 * cipher/sha1.c (sha1_final): Ditto.
11842 * cipher/sha256.c (sha256_final): Ditto.
11843 * cipher/sm3.c (sm3_final): Ditto.
11844 * cipher/tiger.c (tiger_final): Ditto.
11845 * cipher/sha512.c (sha512_final): Avoid byte-by-byte buffer setting
11846 when padding.
11847 * cipher/stribog.c (stribog_final): Ditto.
11848 * cipher/whirlpool.c (whirlpool_final): Ditto.
11849
11850 tests/basic: add hash test for small block sizes.
11851 + commit c54b1c96c644c941f3eb3d2a09432b82f25b6ff1
11852 * tests/basic.c (check_one_md): Compare hashing buffers sizes from 1 to
11853 129 as full buffer input and byte-by-byte input.
11854
11855 Burn stack in transform functions for SHA2 AMD64 implementations.
11856 + commit 74ef3ecbf94e704975e238a99c0e0480cebf46ac
11857 * cipher/sha256-avx-amd64.S: Burn stack inside transform functions.
11858 * cipher/sha256-avx2-bmi2-amd64.S: Ditto.
11859 * cipher/sha256-ssse3-amd64.S: Ditto.
11860 * cipher/sha512-avx-amd64.S: Ditto.
11861 * cipher/sha512-avx2-bmi2-amd64.S: Ditto.
11862 * cipher/sha512-ssse3-amd64.S: Ditto.
11863
11864 Burn stack in transform functions for SHA1 AMD64 implementations.
11865 + commit f3d4bd90662faaedd37ce0dae1f9e7f91748e91e
11866 * cipher/sha1-avx-amd64.S: Burn stack inside transform functions.
11867 * cipher/sha1-avx-bmi2-amd64.S: Ditto.
11868 * cipher/sha1-avx2-bmi2-amd64.S: Ditto.
11869 * cipher/sha1-ssse3-amd64.S: Ditto.
11870
11871 Add AVX2/BMI2 implementation of SHA1.
11872 + commit b982900bfe6403e95a157271d8d811c9c573af9e
11873 * cipher/Makefile.am: Add 'sha1-avx2-bmi2-amd64.S'.
11874 * cipher/hash-common.h (MD_BLOCK_CTX_BUFFER_SIZE): New.
11875 (gcry_md_block_ctx): Change buffer length to MD_BLOCK_CTX_BUFFER_SIZE.
11876 * cipher/sha1-avx-amd64.S: Add missing .size for transform function.
11877 * cipher/sha1-ssse3-amd64.S: Add missing .size for transform function.
11878 * cipher/sha1-avx-bmi2-amd64.S: Add missing .size for transform
11879 function; Tweak implementation for small ~1% speed increase.
11880 * cipher/sha1-avx2-bmi2-amd64.S: New.
11881 * cipher/sha1.c (USE_AVX2, _gcry_sha1_transform_amd64_avx2_bmi2)
11882 (do_sha1_transform_amd64_avx2_bmi2): New.
11883 (sha1_init) [USE_AVX2]: Enable AVX2 implementation if supported by
11884 HW features.
11885 (sha1_final): Merge processing of two last blocks when extra block is
11886 needed.
11887
11888 2019-03-31 Jussi Kivilinna <[email protected]>
11889
11890 blowfish: add three rounds parallel handling to generic C implementation
11891 + commit ced7508c857c0cc37da2299a393e5b167dd28e54
11892 * cipher/blowfish.c (BLOWFISH_ROUNDS): Remove.
11893 [BLOWFISH_ROUNDS != 16] (function_F): Remove.
11894 (F): Replace big-endian and little-endian version with single
11895 endian-neutral version.
11896 (R3, do_encrypt_3, do_decrypt_3): New.
11897 (_gcry_blowfish_ctr_enc, _gcry_blowfish_cbc_dec)
11898 (_gcry_blowfish_cfb_dec): Use new three block functions.
11899
11900 cast5: add three rounds parallel handling to generic C implementation.
11901 + commit 4ec566b3689eff4a712eacfcbb4161eb243bb1df
11902 * cipher/cast5.c (do_encrypt_block_3, do_decrypt_block_3): New.
11903 (_gcry_cast5_ctr_enc, _gcry_cast5_cbc_dec, _gcry_cast5_cfb_dec): Use
11904 new three block functions.
11905
11906 cast5: read Kr four blocks at time and shift for current round.
11907 + commit 8a0e68be1020d0c359bf8191159ac1ebe32a5aa0
11908 * cipher/cast5.c (do_encrypt_block, do_decrypt_block): Read Kr as
11909 32-bit words instead of bytes and shift value for each round.
11910
11911 Add helper function for adding value to cipher block.
11912 + commit 0fe918fa897cca9e01cbdb80d14106cfe5af680e
11913 * cipher/cipher-internal.h (cipher_block_add): New.
11914 * cipher/blowfish.c (_gcry_blowfish_ctr_enc): Use new helper function
11915 for CTR block increment.
11916 * cipher/camellia-glue.c (_gcry_camellia_ctr_enc): Ditto.
11917 * cipher/cast5.c (_gcry_cast5_ctr_enc): Ditto.
11918 * cipher/cipher-ctr.c (_gcry_cipher_ctr_encrypt): Ditto.
11919 * cipher/des.c (_gcry_3des_ctr_enc): Ditto.
11920 * cipher/rijndael.c (_gcry_aes_ctr_enc): Ditto.
11921 * cipher/serpent.c (_gcry_serpent_ctr_enc): Ditto.
11922 * cipher/twofish.c (_gcry_twofish_ctr_enc): Ditto.
11923
11924 2019-03-28 Jussi Kivilinna <[email protected]>
11925
11926 Optimize OCB set_key and set_nonce.
11927 + commit efd700e31dc8e1e386d367d1b682000977e0c810
11928 * cipher/cipher-ocb.c (double_block): Change to input/output
11929 host-endian block instead of big-endian buffer.
11930 (double_block_cpy): Remove.
11931 (bit_copy): Use fixed length copy and 'u64' for calculations.
11932 (ocb_get_L_big): Handle block endian conversions for double_block.
11933 (_gcry_cipher_ocb_setkey): Handle block endian conversions for
11934 double_block.
11935 (_gcry_cipher_ocb_set_nonce): Set full length of 'ktop' to zero; Drop
11936 length parameter for bit_copy.
11937
11938 AES-NI/OCB: Optimize last and first key XORing.
11939 + commit eacbd59b1333b95858886999c8049e04bf72ad74
11940 * cipher/rijndael-aesni.c (aesni_ocb_enc, aesni_ocb_dec)
11941 [__x86_64__]: Reorder and mix first and last key XORing with OCB offset
11942 XOR operations.
11943
11944 AES-NI/OCB: Perform checksumming inline with encryption.
11945 + commit e924ce456d5728a81c148de4a6eb23373cb70ca0
11946 * cipher/rijndael-aesni.c (aesni_ocb_enc): Remove call to
11947 'aesni_ocb_checksum', instead perform checksumming inline with offset
11948 calculations.
11949
11950 2019-03-27 Jussi Kivilinna <[email protected]>
11951
11952 AES-NI/OCB: Use stack for temporary storage.
11953 + commit b82dbbedf027327e0b4444a01edb045f51c4152b
11954 * cipher/rijndael-aesni.c (aesni_ocb_enc, aesni_ocb_dec): Use stack
11955 allocated 'tmpbuf' instead of output buffer as temporary storage.
11956
11957 2019-03-26 Jussi Kivilinna <[email protected]>
11958
11959 tests/basic: add large buffer testing for ciphers.
11960 + commit cabeebfc1179c8f5982834a8cbce02c55b3468e2
11961 * tests/basic.c (check_one_cipher_core): Allocate buffers from heap.
11962 (check_one_cipher): Add testing with large buffer (~65 KiB) in addition
11963 to medium size buffer (~2 KiB).
11964
11965 chacha20-poly1305: fix wrong en/decryption on large input buffers.
11966 + commit 049376470b31832d3331fc0037d273b4147e9d38
11967 * cipher/chacha20.c (_gcry_chacha20_poly1305_encrypt)
11968 (_gcry_chacha20_poly1305_decrypt): Correctly use 'currlen' for chacha20
11969 on the non-stitched code path.
11970
11971 2019-03-24 Jussi Kivilinna <[email protected]>
11972
11973 doc: add mention about aligning data to cachelines for best performance.
11974 + commit bb03edcbba95e06686188957a65c1967ee07cd6a
11975 * doc/gcrypt.text: Add mention about aligning data to cachelines for
11976 best performance.
11977
11978 random-drbg: do not use calloc for zero ctr.
11979 + commit 5a20151213c2e496513c541c36e4ebd086b20be9
11980 * random/random-drbg.c (DRBG_CTR_NULL_LEN): Move to 'constants'
11981 section.
11982 (drbg_state_s): Remove 'ctr_null' member.
11983 (drbg_ctr_generate): Add 'drbg_ctr_null'.
11984 (drbg_sym_fini, drbg_sym_init): Remove 'drbg->ctr_null' usage.
11985
11986 2019-03-23 Jussi Kivilinna <[email protected]>
11987
11988 Add ARMv7/NEON accelerated GCM implementation.
11989 + commit 2445cf7431fab921f6c1870da7084ee698992064
11990 * cipher/Makefile.am: Add 'cipher-gcm-armv7-neon.S'.
11991 * cipher/cipher-gcm-armv7-neon.S: New.
11992 * cipher/cipher-gcm.c [GCM_USE_ARM_NEON] (_gcry_ghash_setup_armv7_neon)
11993 (_gcry_ghash_armv7_neon, ghash_setup_armv7_neon)
11994 (ghash_armv7_neon): New.
11995 (setupM) [GCM_USE_ARM_NEON]: Use armv7/neon implementation if have
11996 HWF_ARM_NEON.
11997 * cipher/cipher-internal.h (GCM_USE_ARM_NEON): New.
11998
11999 Use memset instead of setting buffers byte by byte.
12000 + commit 6f2391d2df029b0e1a4e5dde17c3d97cc594a1c7
12001 * cipher/cipher-ccm.c (do_cbc_mac): Replace buffer setting loop with memset call.
12002 * cipher/cipher-gcm.c (do_ghash_buf): Ditto.
12003 * cipher/poly1305.c (poly1305_final): Ditto.
12004
12005 Use buf_cpy instead of copying buffers byte by byte.
12006 + commit 4db6d8796c0d95ab89e9ad69336509b604b957cd
12007 * cipher/bufhelp.h (buf_cpy): Skip memcpy if length is zero.
12008 * cipher/cipher-ccm.c (do_cbc_mac): Replace buffer copy loops with buf_cpy call.
12009 * cipher/cipher-cmac.c (_gcry_cmac_write): Ditto.
12010 * cipher/cipher-ocb.c (_gcry_cipher_ocb_authenticate): Ditto.
12011
12012 Reduce overhead on generic hash write function.
12013 + commit e76617cbab018dd8f41fd6b4ec6740b5303f7e13
12014 * cipher/hash-common.c (_gcry_md_block_write): Remove recursive
12015 function call; Use buf_cpy for copying buffers; Burn stack only once.
12016
12017 sha1-avx: use vmovdqa instead of movdqa.
12018 + commit f8d14df1abd645c3279b14da43b4a7983d87f89f
12019 * cipher/sha1-avx-amd64.S: Replace 'movdqa' with 'vmovdqa'.
12020 * cipher/sha1-avx-bmi2-amd64.S: Replace 'movdqa' with 'vmovdqa'.
12021
12022 doc/gcrypt.texi: update HW feature list.
12023 + commit 7abf65da84c7106250a5ed2de78b05610cf251f4
12024 * doc/gcrypt.texi: Update FW feature list.
12025
12026 2019-03-20 Daniel Kahn Gillmor <[email protected]>
12027
12028 ecc: Adjust debugging output.
12029 + commit 54db6a4b44124ed7e95897174f32262482b4b0cb
12030 * cipher/ecc.c (ecc_check_secret_key): Adjust debugging output to use
12031 full column titles.
12032
12033 2019-02-25 NIIBE Yutaka <[email protected]>
12034
12035 fips: Only test check_binary_integrity when fips_mode is enabled.
12036 + commit ad133fc79757236359252e92244fe16e9adb45a3
12037 * src/fips.c (_gcry_fips_run_selftests): Check the status of fips_mode
12038 before calling check_binary_integrity.
12039
12040 2019-02-07 Jussi Kivilinna <[email protected]>
12041
12042 Add 2-way path for SSSE3 version of ChaCha20.
12043 + commit d455068988e5779b0200c51415ddab6b51e12dc4
12044 * cipher/chacha20-amd64-ssse3.S (_gcry_chacha20_amd64_ssse3_blocks1)
12045 (_gcry_chacha20_poly1305_amd64_ssse3_blocks1): Add 2-way code paths.
12046 * cipher/chacha20.c (_gcry_chacha20_poly1305_encrypt): Add
12047 preprosessing of 2 blocks with SSSE3.
12048
12049 2019-01-27 Jussi Kivilinna <[email protected]>
12050
12051 Do not precalculate OCB offset L0+L1+L0.
12052 + commit afab94d222425ecb838eb56cb0723bdaf3e5de36
12053 * cipher/cipher-internal.h (gcry_cipher_handle): Remove OCB L0L1L0.
12054 * cipher/cipher-ocb.c (_gcry_cipher_ocb_setkey): Ditto.
12055 * cipher/rijndael-aesni.c (aesni_ocb_enc, aesni_ocb_dec)
12056 (_gcry_aes_aesni_ocb_auth): Replace L0L1L0 use with L1.
12057
12058 Calculate OCB L-tables when setting key instead of when setting nonce.
12059 + commit c15409c49993166ab1325d45360b3a8fe72a5556
12060 * cipher/cipher-internal.h (gcry_cipher_handle): Mark areas of
12061 u_mode.ocb that are and are not cleared by gcry_cipher_reset.
12062 (_gcry_cipher_ocb_setkey): New.
12063 * cipher/cipher-ocb.c (_gcry_cipher_ocb_set_nonce): Split
12064 L-table generation to ...
12065 (_gcry_cipher_ocb_setkey): ... this new function.
12066 * cipher/cipher.c (cipher_setkey): Add handling for OCB mode.
12067 (cipher_reset): Do not clear L-values for OCB mode.
12068
12069 chacha20-amd64-avx2: optimize output xoring.
12070 + commit 08e0650c21984bb9ddf5a1dabb1cc890fabf63ab
12071 * cipher/chacha20-amd64-avx2.S (STACK_TMP2): Remove.
12072 (transpose_16byte_2x2, xor_src_dst): New.
12073 (BUF_XOR_256_TO_128): Remove.
12074 (_gcry_chaha20_amd64_avx2_blocks8)
12075 (_gcry_chacha20_poly1305_amd64_avx2_blocks8): Replace
12076 BUF_XOR_256_TO_128 with transpose_16byte_2x2/xor_src_dst; Reduce stack
12077 usage; Better interleave chacha20 state merging and output xoring.
12078
12079 tests/bench-slope: prevent auto-mhz detection getting stuck.
12080 + commit 28614a77a28190ab902a2b98039de2cd0635c7c7
12081 * cipher/bench-slope.c (bench_ghz, bench_ghz_diff): New static
12082 variables.
12083 (AUTO_GHZ_TARGET_DIFF): New macro.
12084 (do_slope_benchmark): Reduce target auto-mhz accuracy after
12085 repeated failures.
12086 (bench_print_result_csv, bench_print_result_std): Print auto-ghz
12087 different if 1 Mhz or more.
12088 (do_slope_benchmark, bench_print_result_csv, bench_print_result_std)
12089 (bench_print_result): Remove 'bench_ghz' parameter.
12090 (cipher_bench_one, hash_bench_one, mac_bench_one)
12091 (kdf_bench_one): Remove 'bench_ghz' variable.
12092
12093 tests/bench-slope: add missing cipher context reset.
12094 + commit 546f13ae08918726791600cdd0d0be56cc52c790
12095 * tests/bench-slope.c (bench_encrypt_do_bench)
12096 (bench_decrypt_do_bench): Add call to 'gcry_cipher_reset'.
12097
12098 Add stitched ChaCha20-Poly1305 SSSE3 and AVX2 implementations.
12099 + commit d6330dfb4b0e9fb3f8eef65ea13146060b804a97
12100 * cipher/asm-poly1305-amd64.h: New.
12101 * cipher/Makefile.am: Add 'asm-poly1305-amd64.h'.
12102 * cipher/chacha20-amd64-avx2.S (QUATERROUND2): Add interleave
12103 operators.
12104 (_gcry_chacha20_poly1305_amd64_avx2_blocks8): New.
12105 * cipher/chacha20-amd64-ssse3.S (QUATERROUND2): Add interleave
12106 operators.
12107 (_gcry_chacha20_poly1305_amd64_ssse3_blocks4)
12108 (_gcry_chacha20_poly1305_amd64_ssse3_blocks1): New.
12109 * cipher/chacha20.c (_gcry_chacha20_poly1305_amd64_ssse3_blocks4)
12110 (_gcry_chacha20_poly1305_amd64_ssse3_blocks1)
12111 (_gcry_chacha20_poly1305_amd64_avx2_blocks8): New prototypes.
12112 (chacha20_encrypt_stream): Split tail to...
12113 (do_chacha20_encrypt_stream_tail): ... new function.
12114 (_gcry_chacha20_poly1305_encrypt)
12115 (_gcry_chacha20_poly1305_decrypt): New.
12116 * cipher/cipher-internal.h (_gcry_chacha20_poly1305_encrypt)
12117 (_gcry_chacha20_poly1305_decrypt): New prototypes.
12118 * cipher/cipher-poly1305.c (_gcry_cipher_poly1305_encrypt): Call
12119 '_gcry_chacha20_poly1305_encrypt' if cipher is ChaCha20.
12120 (_gcry_cipher_poly1305_decrypt): Call
12121 '_gcry_chacha20_poly1305_decrypt' if cipher is ChaCha20.
12122 * cipher/poly1305-internal.h (_gcry_cipher_poly1305_update_burn): New
12123 prototype.
12124 * cipher/poly1305.c (poly1305_blocks): Make static.
12125 (_gcry_poly1305_update): Split main function body to ...
12126 (_gcry_poly1305_update_burn): ... new function.
12127
12128 Add SSSE3 optimized non-parallel ChaCha20 function.
12129 + commit 7d9b2f114f3edf4d13640616cf34c79364234781
12130 * cipher/chacha20-amd64-ssse3.S (ROTATE_SHUF, ROTATE, WORD_SHUF)
12131 (QUARTERROUND4, _gcry_chacha20_amd64_ssse3_blocks1): New.
12132 * cipher/chacha20.c (_gcry_chacha20_amd64_ssse3_blocks1): New
12133 prototype.
12134 (chacha20_blocks): Rename to ...
12135 (do_chacha20_blocks): ... this.
12136 (chacha20_blocks): New.
12137 (chacha20_encrypt_stream): Adjust for new chacha20_blocks function.
12138
12139 tests/basic: increase buffer size for check_one_cipher.
12140 + commit 88e482d16ee80de41b6f133e77f0d15423fcd266
12141 * tests/basic.c (check_one_cipher_core)
12142 (check_one_cipher): Increase buffer from 1040 to 1904 bytes.
12143
12144 tests/basic: check AEAD tags in check_one_cipher test.
12145 + commit eee1f152a5b3040f6723d287d1b01fb939be67b7
12146 * tests/basic.c (get_algo_mode_taglen): New.
12147 (check_one_cipher_core_reset): Check that tags are same with
12148 AEAD modes.
12149
12150 2019-01-15 NIIBE Yutaka <[email protected]>
12151
12152 build: With LD_LIBRARY_PATH defined, use --disable-new-dtags.
12153 + commit e5c2f8a2cd2b89d90ea30de2dedb0e92498a5f70
12154 * configure.ac (LDADD_FOR_TESTS_KLUDGE): New for --disable-new-dtags.
12155 * tests/Makefile.am (LDADD, t_lock_LDADD): Use LDADD_FOR_TESTS_KLUDGE.
12156
12157 random: Fix previous commit for getentropy function.
12158 + commit 17f246c7044ab9ed236f6ec73fc126654257f0f9
12159 * random/rndlinux.c [__NR_getrandom] (_gcry_rndlinux_gather_random):
12160 Check return value only for use of syscall.
12161
12162 random: Use getentropy when available for not GNU/Linux.
12163 + commit 2677d7d482bf2d078c1dce64854747c5b148924b
12164 * configure.ac: Detect getentropy.
12165 * random/rndlinux.c [__linux__] (getentropy): Macro defined.
12166 [HAVE_GETENTROPY] (_gcry_rndlinux_gather_random): Use getentropy.
12167
12168 2019-01-14 Jussi Kivilinna <[email protected]>
12169
12170 camellia-aarch64: do not export look-up table globally.
12171 + commit 09c27280cc09798d15369b3a143036b7ab5ddd69
12172 * cipher/camellia-aarch64.S (_gcry_camellia_arm_tables): Remove
12173 '.globl' export.
12174
12175 2019-01-02 Jussi Kivilinna <[email protected]>
12176
12177 Process CCM/EAX/GCM/Poly1305 AEAD cipher modes input in 24 KiB chucks.
12178 + commit 3ee6588de8311b461ef8707c70ff86d2b252966d
12179 * cipher/cipher-ccm.c (_gcry_cipher_ccm_encrypt)
12180 (_gcry_cipher_ccm_decrypt): Process data in 24 KiB chunks.
12181 * cipher/cipher-eax.c (_gcry_cipher_eax_encrypt)
12182 (_gcry_cipher_eax_decrypt): Ditto.
12183 * cipher/cipher-gcm.c (_gcry_cipher_gcm_encrypt)
12184 (_gcry_cipher_gcm_decrypt): Ditto.
12185 * cipher/cipher-poly1305.c (_gcry_cipher_poly1305_encrypt)
12186 (_gcry_cipher_poly1305_decrypt): Ditto.
12187
12188 tests/benchmark: add Chacha20-Poly1305 benchmarking.
12189 + commit 4871f11745f33c5c5051bfe6f325ac1c10764b04
12190 * tests/benchmark.c (cipher_bench): Add Chacha20-Poly1305.
12191
12192 tests/benchmark: add --huge-buffers option for cipher tests.
12193 + commit edde61f325e4b345f17c47369f3b6b1400656f04
12194 * tests/benchmark.c (huge_buffers, cipher_encrypt, cipher_decrypt): New.
12195 (cipher_bench): Add 'max_inlen' to modes structure; add huge buffers
12196 mode selection.
12197 (main): Add '--huge-buffers'.
12198
12199 2018-12-19 NIIBE Yutaka <[email protected]>
12200
12201 random: Add finalizer for rndjent.
12202 + commit 3028a221d39c1b593ea0c1bcbfccd33959769692
12203 * random/rand-internal.h (_gcry_rndjent_fini): New.
12204 * random/rndjent.c (_gcry_rndjent_fini): New.
12205 * random/rndlinux.c (_gcry_rndlinux_gather_random): Call the finalizer
12206 when GCRYCTL_CLOSE_RANDOM_DEVICE.
12207
12208 2018-12-12 Werner Koch <[email protected]>
12209
12210 secmem: Prepare for easier debugging.
12211 + commit 876f7280e8604bc99ddda0526339ec5ec6b23c4b
12212 * src/secmem.c (_gcry_secmem_dump_stats): Factor code out to ...
12213 (secmem_dump_stats_internal): new.
12214
12215 2018-12-01 Jussi Kivilinna <[email protected]>
12216
12217 rijndael-aesni: interleave last CTR encryption round with xoring.
12218 + commit 66d2b7fc17258f1424f4ca4adb1096e48b818bd0
12219 * cipher/rijndael-aesni.c (do_aesni_ctr_8): Interleave aesenclast
12220 with input xoring.
12221
12222 2018-11-20 Jussi Kivilinna <[email protected]>
12223
12224 Use explicit_bzero for wipememory.
12225 + commit 168668228c7c49e70612cb4d602d6d603a2add2c
12226 * configure.ac (AC_CHECK_FUNCS): Check for 'explicit_bzero'.
12227 * src/g10lib.h (wipememory2): Use _gcry_fast_wipememory if _SET is
12228 zero.
12229 (_gcry_fast_wipememory): New.
12230 (_gcry_wipememory2): Rename to...
12231 (_gcry_fast_wipememory2): ...this.
12232 * src/misc.c (_gcry_wipememory): New.
12233 (_gcry_wipememory2): Rename to...
12234 (_gcry_fast_wipememory2): ...this.
12235 (_gcry_fast_wipememory2) [HAVE_EXPLICIT_BZERO]: Use explicit_bzero if
12236 SET is zero.
12237 (_gcry_burn_stack): Use _gcry_fast_wipememory.
12238
12239 Add clang target pragma for mixed C/assembly x86-64 implementations.
12240 + commit 9d9c4fd18b445ff414d11678285d54af3afdb222
12241 * cipher/cipher-gcm-intel-pclmul.c: Add target 'no-sse' attribute
12242 pragma for clang.
12243 * cipher/crc-intel-pclmul.c: Ditto.
12244 * cipher/rijndael-aesni.c: Ditto.
12245 * cipher/rijndael-ssse3-amd64.c: Ditto.
12246 * cipher/sha1-intel-shaext.c: Ditto.
12247 * cipher/sha256-intel-shaext.c: Ditto.
12248
12249 Optimizations for AES-NI OCB.
12250 + commit b42de67f34871a2520cfe370af513f2aab6e4f75
12251 * cipher/cipher-internal.h (gcry_cipher_handle): New pre-computed OCB
12252 values L0L1 and L0L1L0; Swap dimensions for OCB L table.
12253 * cipher/cipher-ocb.c (_gcry_cipher_ocb_set_nonce): Setup L0L1 and
12254 L0L1L0 values.
12255 (ocb_crypt): Process input in 24KiB chunks for better cache locality
12256 for checksumming.
12257 * cipher/rijndael-aesni.c (ALWAYS_INLINE): New macro for always
12258 inlining functions, change all functions with 'inline' to use
12259 ALWAYS_INLINE.
12260 (NO_INLINE): New macro.
12261 (aesni_prepare_2_6_variable, aesni_prepare_7_15_variable): Rename to...
12262 (aesni_prepare_2_7_variable, aesni_prepare_8_15_variable): ...these and
12263 adjust accordingly (xmm7 moved from *_7_15 to *_2_7).
12264 (aesni_prepare_2_6, aesni_prepare_7_15): Rename to...
12265 (aesni_prepare_2_7, aesni_prepare_8_15): ...these and adjust
12266 accordingly.
12267 (aesni_cleanup_2_6, aesni_cleanup_7_15): Rename to...
12268 (aesni_cleanup_2_7, aesni_cleanup_8_15): ...these and adjust
12269 accordingly.
12270 (aesni_ocb_checksum): New.
12271 (aesni_ocb_enc, aesni_ocb_dec): Calculate OCB offsets in parallel
12272 with help of pre-computed offsets L0+L1 ja L0+L1+L0; Do checksum
12273 calculation as separate pass instead of inline; Use NO_INLINE.
12274 (_gcry_aes_aesni_ocb_auth): Calculate OCB offsets in parallel
12275 with help of pre-computed offsets L0+L1 ja L0+L1+L0.
12276 * cipher/rijndael-internal.h (RIJNDAEL_context_s) [USE_AESNI]: Add
12277 'use_avx2' and 'use_avx'.
12278 * cipher/rijndael.c (do_setkey) [USE_AESNI]: Set 'use_avx2' if
12279 Intel AVX2 HW feature is available and 'use_avx' if Intel AVX HW
12280 feature is available.
12281 * tests/basic.c (do_check_ocb_cipher): New test vector; increase
12282 size of temporary buffers for new test vector.
12283 (check_ocb_cipher_largebuf_split): Make test plaintext non-uniform
12284 for better checksum testing.
12285 (check_ocb_cipher_checksum): New.
12286 (check_ocb_cipher_largebuf): Call check_ocb_cipher_checksum.
12287 (check_ocb_cipher): New expected tags for check_ocb_cipher_largebuf
12288 test runs.
12289
12290 2018-11-19 Andreas Metzler <[email protected]>
12291
12292 doc: Fix library initialization examples.
12293 + commit af0bbdb9019e0b4a72e87e8b1b4a55506d349834
12294
12295
12296 2018-11-14 Werner Koch <[email protected]>
12297
12298 random: Initialize variable as requested by valgrind.
12299 + commit aa686dfc9b563ff79c01d2f8560b88f69c42ecba
12300 random/jitterentropy-base.c: Init.
12301
12302 2018-11-13 NIIBE Yutaka <[email protected]>
12303
12304 libgcrypt.m4: Prefer gpgrt-config to SYSROOT support.
12305 + commit 852245390ef7fd8ca9e36010886a4cf42cf710bf
12306 * libgcrypt.m4: Move SYSROOT support after check of GPGRT_CONFIG.
12307
12308 build: Update autogen.rc.
12309 + commit bea193446351c24b10a4342466978d57bd53f599
12310 * autogen.rc: Remove obsolete --with-gpg-error-prefix option.
12311
12312 2018-11-07 Jussi Kivilinna <[email protected]>
12313
12314 Fix 'variable may be used uninitialized' warning for CTR mode.
12315 + commit 3f76319803a4abcd33fa29a0ac39f8ed9d646226
12316 * cipher/cipher-ctr.c (_gcry_cipher_ctr_encrypt): Set N to BLOCKSIZE
12317 before counter loop.
12318
12319 2018-11-06 Jussi Kivilinna <[email protected]>
12320
12321 Fix inlining of ocb_get_l for x86 AES implementations.
12322 + commit 9d6431604b5ee21572c1c2cfa8376e6d81162cbb
12323 * cipher/rijndael-aesni.c (aes_ocb_get_l): New.
12324 (aesni_ocb_enc, aesni_ocb_dec, _gcry_aes_aesni_ocb_auth): Use
12325 'aes_ocb_get_l'.
12326 * cipher/rijndael-ssse3-amd4.c (aes_ocb_get_l): New.
12327 (ssse3_ocb_enc, ssse3_ocb_dec, _gcry_aes_ssse3_ocb_auth): Use
12328 'aes_ocb_get_l'.
12329
12330 2018-11-05 Jussi Kivilinna <[email protected]>
12331
12332 stdmem: free: only call _gcry_secmem_free if needed.
12333 + commit 23f56d3359ca7d152aa87874ddd6305171a91408
12334 * src/stdmem.c (_gcry_private_free): Check if memory is secure before
12335 calling _gcry_secmem_free to avoid unnecessarily taking secmem lock.
12336
12337 secmem: fix potential memory visibility issue.
12338 + commit d6c6680ca31c05bafbb8becda56da051346eceb3
12339 * configure.ac (gcry_cv_have_sync_synchronize): New check.
12340 * src/secmem.c (pooldesc_s): Make next pointer volatile.
12341 (memory_barrier): New.
12342 (_gcry_secmem_malloc_internal): Insert memory barrier between
12343 pool->next and mainpool.next assigments.
12344 (_gcry_private_is_secure): Update comments.
12345
12346 wipememory: use memset for non-constant length or large buffer wipes.
12347 + commit 4faeaa1cbd235a2560fa04a8ac3766a07029acd8
12348 * src/g10lib.h (CONSTANT_P): New.
12349 (_gcry_wipememory2): New prototype.
12350 (wipememory2): Use _gcry_wipememory2 if _len not constant expression or
12351 lenght is larger than 64 bytes.
12352 (FASTWIPE_T, FASTWIPE_MULT, fast_wipememory2_unaligned_head): Remove.
12353 (fast_wipememory2): Always handle buffer as unaligned.
12354 * src/misc.c (__gcry_burn_stack): Move memset_ptr variable to...
12355 (memset_ptr): ... here. New.
12356 (_gcry_wipememory2): New.
12357
12358 Change buf_cpy and buf_xor* functions to use buf_put/buf_get helpers.
12359 + commit 0068d41d9304ebcdb2caba1fa8848925e2bfaac7
12360 * cipher/bufhelp.h (BUFHELP_FAST_UNALIGNED_ACCESS)
12361 (bufhelp_int_s, buf_xor_1): Remove.
12362 (buf_cpy, buf_xor, buf_xor_2dst, buf_xor_n_copy_2): Use
12363 buf_put/buf_get helpers to handle unaligned memory accesses.
12364
12365 rijndael: fix unused parameter warning.
12366 + commit 30e783ec487466132324673f197d36b85a91b060
12367 * cipher/rijndael.c (do_setkey): Silence unused 'hd' warning.
12368
12369 mpi/longlong.h: enable inline assembly for powerpc64.
12370 + commit ec49013d23d9a7b874c42d77ceb08bd313ba69e1
12371 * mpi/longlong.h [__powerpc__ && W_TYPE_SIZE == 64]: Remove '#if 0'.
12372
12373 Change remaining users of _gcry_fips_mode to use fips_mode.
12374 + commit 2aece89d3967e692743541cea857f2e4771b0b62
12375 * src/fips.c (_gcry_fips_mode): Remove.
12376 (_gcry_enforced_fips_mode, _gcry_inactivate_fips_mode)
12377 (_gcry_is_fips_mode_inactive): Use fips_mode.
12378 * src/g10lib.h (_gcry_fips_mode): Remove.
12379
12380 2018-11-02 NIIBE Yutaka <[email protected]>
12381
12382 aarch64: mpi: Distribute the header file as a part of source.
12383 + commit a2e0cb1542818ad8a71de34ccbf191adab0a0b86
12384 * mpi/Makefile.am (EXTRA_libmpi_la_SOURCES): Add asm-common-aarch64.h.
12385
12386 build: Fix GCRYPT_HWF_MODULES.
12387 + commit f7395338d71d4d82180a11707fd6e77787162e24
12388 * configure.ac (GCRYPT_HWF_MODULES): Add libgcrypt_la- prefix.
12389
12390 build: Update gpg-error.m4 and libgcrypt.m4.
12391 + commit f46286851158878d5041ac5381b2807ecec541eb
12392 * m4/gpg-error.m4: Update to 2018-11-02.
12393 * src/libgrypt.m4: Add AC_MSG_NOTICE.
12394 Bump the version date.
12395
12396 2018-10-29 NIIBE Yutaka <[email protected]>
12397
12398 build: Update gpg-error.m4 and ksba.m4.
12399 + commit 4a4d4a284ca996df874e2534f8529c1611289943
12400 * m4/gpg-error.m4: Update to 2018-10-29.
12401 * src/libgrypt.m4: Follow the change of gpgrt-config.
12402 Bump the version date.
12403
12404 2018-10-27 Jussi Kivilinna <[email protected]>
12405
12406 Fix missing global initialization in fips_is_operational.
12407 + commit 6e669e09603e5a98b59dcf35f77f346db6c81eac
12408 * src/g10lib.h (_gcry_global_any_init_done): New extern.
12409 (fips_is_operational): Check for _gcry_global_any_init_done and call
12410 _gcry_global_is_operational.
12411 * src/global.c (any_init_done): Rename to ...
12412 (_gcry_global_any_init_done): ... this and make externally available.
12413
12414 2018-10-26 Daniel Kahn Gillmor <[email protected]>
12415
12416 random: use getrandom() on Linux where available.
12417 + commit 7e662680c170968661ee0105d132813f8281d229
12418 * random/rndlinux.c (_gcry_rndlinux_gather_random): use the
12419 getrandom() syscall on Linux if it exists, regardless of what kind of
12420 entropy was requested.
12421
12422 2018-10-26 Werner Koch <[email protected]>
12423
12424 random: Make sure to re-open /dev/random after a fork.
12425 + commit 319f55e6e5793c59f1ba4cfe481b562bca42194d
12426 * random/rndlinux.c (_gcry_rndlinux_gather_random): Detect fork and
12427 re-open devices.
12428
12429 primes: Avoid leaking bits of the prime test to pageable memory.
12430 + commit 2e2e68ad4874a4678cfbe452b70ae987e0402eca
12431 * cipher/primegen.c (gen_prime): Allocate MODS in secure memory.
12432
12433 2018-10-26 NIIBE Yutaka <[email protected]>
12434
12435 libgcrypt.m4: Better compatibility support.
12436 + commit a755bd0ea09af2ae5a66e3f5aeb8707673c687cf
12437 * src/gpg-error.m4: Update.
12438 * src/libgcrypt.m4: Don't assume libgcrypt-config is newer.
12439
12440 build: Fix libgcrypt.m4.
12441 + commit 630ece1b7e0a94442bca91d8e96d9b1d4cd3ec66
12442 * src/libgcrypt.m4: Use AC_PATH_PROG to detect libgcrypt-config.
12443
12444 build: Relax build requirements.
12445 + commit 8e5641ed65f86783542d5caccdeeee42eeb9457c
12446 * m4/gpg-error.m4: Update from libgpg-error 1.33.
12447 * src/libgcrypt.m4: Don't require AM_PATH_GPG_ERROR. Use GPGRT_CONFIG
12448 instead of libgcrypt-config when it is confirmed that it is available
12449 and working well.
12450 * configure.ac (AM_PATH_GPG_ERROR): No requirement for newer version
12451 (It was because of new gpgrt-config which supports *.pc files).
12452
12453 2018-10-25 NIIBE Yutaka <[email protected]>
12454
12455 build: Require libgpg-error >= 1.33.
12456 + commit b376dc2abbb208b10bbc76998ff39adb2f301905
12457 * configure.ac (NEED_GPG_ERROR_VERSION): Require 1.33.
12458 * m4/gpg-error.m4: Update from libgpg-error 1.33.
12459 * src/libgcrypt.m4: Bump version date.
12460 Use --variable option.
12461
12462 2018-10-24 Werner Koch <[email protected]>
12463
12464 build: Add release make target.
12465 + commit 03bb25ee7ed6f1076bf788ab981ca68672880daa
12466 * Makefile.am (release, sign-release): New targets.
12467
12468 build: Make distcheck work again.
12469 + commit b0ad66e48c46b79af69349606e276cf0a6b9a020
12470 * cipher/Makefile.am: Prettified source file lists.
12471 EXTRA_libcipher_la_SOURCES): Add missing asm-common-aarch64.h.
12472
12473 Fix memory leak in secmem in out of core conditions.
12474 + commit f74687fd43f5772a372f54031d5a9527597f4ce4
12475 * src/secmem.c (_gcry_secmem_malloc_internal): Release pool descriptor
12476 if the pool could not be allocated.
12477
12478 ecc: Fix memory leak in the error case of ecc_encrypt_raw.
12479 + commit e57e75ea517f32109b508113f18298fc69fd1192
12480 * cipher/ecc.c (ecc_encrypt_raw): Add proper error cleanup in the main
12481 block.
12482
12483 ecc: Fix possible memory leakage in parameter check of eddsa.
12484 + commit 149ceb3cae03d0385341d32430aa5ae57de90007
12485 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_verify): Fix mem leak.
12486
12487 2018-10-24 NIIBE Yutaka <[email protected]>
12488
12489 build: Fix libgcrypt.pc.
12490 + commit 0e071372fc0e6fed4a449955ed0789803ba5e709
12491 * src/libgcrypt.pc.in: Fix typo.
12492
12493 build: Compatibility to pkg-config.
12494 + commit c60eabb11435665fa84a3a82b2a15f48870cc4d7
12495 * src/libgcrypt-config.in: Support --variable and --modversion.
12496
12497 build: Make libgcrypt.m4 use gpg-error-config.
12498 + commit 7da887d69d72ea0ea0d106054c48a8c03e242a18
12499 * src/libgcrypt.m4: Use gpg-error-config.
12500
12501 build: Provide libgcrypt.pc, generated by configure.
12502 + commit 97194b422bc89a6137f4e218d4cdee118c63e96e
12503 * configure.ac: Generate src/libgcrypt.pc.
12504 * src/Makefile.am (pkgconfigdir, pkgconfig_DATA): New.
12505 (EXTRA_DIST): Add libgcrypt.pc.in.
12506 * src/libgcrypt-config.in: Use @PACKAGE_VERSION@.
12507 * src/libgcrypt.pc.in: New.
12508
12509 build: Update gpg-error.m4 from libgpg-error.
12510 + commit 5b1febb5e40d92072bef425bd9e63f7a07edd57e
12511 * m4/gpg-error.m4: Update from libgpg-error 1.33.
12512
12513 build: Don't default to underscore=yes for cross-build.
12514 + commit 0f4545b441b6fbdd6e9c4e95f5f2a367483e78ad
12515 * acinclude.m4: Don't set ac_cv_sys_symbol_underscore
12516 for cross build.
12517
12518 2018-10-23 Werner Koch <[email protected]>
12519
12520 ecc: Fix potential unintended freeing of an internal param.
12521 + commit e2da4e8dee4b371804f3b2659b53431fb6380d93
12522 * cipher/ecc-curves.c (_gcry_ecc_get_mpi): Fix c+p error
12523
12524 sexp: Fix uninitialized use of a var in the error case.
12525 + commit 9f2c7ec4d8b07e82663ad084c90c016d3c3b80c2
12526 * src/sexp.c (_gcry_sexp_vextract_param): Initialize L1.
12527
12528 2018-10-16 NIIBE Yutaka <[email protected]>
12529
12530 build: Let configure create the VERSION file.
12531 + commit 0f2c6ce2c9504c6df435463243edaa669e57b109
12532 * autogen.sh: Update from libgpg-error.
12533 * configure.ac: Use mym4_versoin to create VERSION file.
12534 * Makefile.am (dist-hook): Do not create VERSION file.
12535 (EXTRA_DIST): Add VERSION.
12536
12537 2018-07-21 Jussi Kivilinna <[email protected]>
12538
12539 Add size optimized cipher block copy and xor functions.
12540 + commit 86e5e06a97ae13b8bbf6923ecc76e02b9c429b46
12541 * cipher/bufhelp.h (buf_get_he32, buf_put_he32, buf_get_he64)
12542 (buf_put_he64): New.
12543 * cipher/cipher-internal.h (cipher_block_cpy, cipher_block_xor)
12544 (cipher_block_xor_1, cipher_block_xor_2dst, cipher_block_xor_n_copy_2)
12545 (cipher_block_xor_n_copy): New.
12546 * cipher/cipher-gcm-intel-pclmul.c
12547 (_gcry_ghash_setup_intel_pclmul): Use assembly for swapping endianness
12548 instead of buf_get_be64 and buf_cpy.
12549 * cipher/blowfish.c: Use new cipher_block_* functions for cipher block
12550 sized buf_cpy/xor* operations.
12551 * cipher/camellia-glue.c: Ditto.
12552 * cipher/cast5.c: Ditto.
12553 * cipher/cipher-aeswrap.c: Ditto.
12554 * cipher/cipher-cbc.c: Ditto.
12555 * cipher/cipher-ccm.c: Ditto.
12556 * cipher/cipher-cfb.c: Ditto.
12557 * cipher/cipher-cmac.c: Ditto.
12558 * cipher/cipher-ctr.c: Ditto.
12559 * cipher/cipher-eax.c: Ditto.
12560 * cipher/cipher-gcm.c: Ditto.
12561 * cipher/cipher-ocb.c: Ditto.
12562 * cipher/cipher-ofb.c: Ditto.
12563 * cipher/cipher-xts.c: Ditto.
12564 * cipher/des.c: Ditto.
12565 * cipher/rijndael.c: Ditto.
12566 * cipher/serpent.c: Ditto.
12567 * cipher/twofish.c: Ditto.
12568
12569 2018-07-04 NIIBE Yutaka <[email protected]>
12570
12571 RFC-8439 was published.
12572 + commit 9660c3fafd732b1857bb2697c6f43aed077b9ad6
12573 * cipher/cipher-poly1305.c: Update RFC reference.
12574
12575 2018-06-19 Jussi Kivilinna <[email protected]>
12576
12577 Clean-up implementation selection for SHA1 and SHA2.
12578 + commit 8a44c55d2fb758f726b8b436aa5c0b88a6c6f112
12579 * cipher/sha1.c (ASM_EXTRA_STACK): Increase by sizeof(void*)*4.
12580 (do_sha1_transform_amd64_ssse3, do_sha1_transform_amd64_avx)
12581 (do_sha1_transform_amd64_avx_bmi2, do_sha1_transform_intel_shaext)
12582 (do_sha1_transform_armv7_neon, do_sha1_transform_armv8_ce): New.
12583 (transform_blk, transform): Merge to ...
12584 (do_transform_generic): ... this and remove calls to assembly
12585 implementations.
12586 (sha1_init): Select hd->bctx.bwrite based on HW features.
12587 (_gcry_sha1_mixblock, sha1_final): Call hd->bctx.bwrite instead of
12588 transform.
12589 * cipher/sha1.h (SHA1_CONTEXT): Remove implementation selection bits.
12590 * cipher/sha256.h (SHA256_CONTEXT): Remove implementation selection
12591 bits.
12592 (ASM_EXTRA_STACK): Increase by sizeof(void*)*4.
12593 (do_sha256_transform_amd64_ssse3, do_sha256_transform_amd64_avx)
12594 (do_sha256_transform_amd64_avx2, do_sha256_transform_intel_shaext)
12595 (do_sha256_transform_armv8_ce): New.
12596 (transform_blk, transform): Merge to ...
12597 (do_transform_generic): ... this and remove calls to assembly
12598 implementations.
12599 (sha256_init, sha224_init): Select hd->bctx.bwrite based on HW
12600 features.
12601 (sha256_final): Call hd->bctx.bwrite instead of transform.
12602 * cipher/sha512-armv7-neon.S
12603 (_gcry_sha512_transform_armv7_neon): Return zero.
12604 * cipher/sha512.h (SHA512_CONTEXT): Remove implementation selection
12605 bits.
12606 (ASM_EXTRA_STACK): Increase by sizeof(void*)*4.
12607 (do_sha512_transform_armv7_neon, do_sha512_transform_amd64_ssse3)
12608 (do_sha512_transform_amd64_avx, do_sha512_transform_amd64_avx2): New.
12609 [USE_ARM_ASM] (do_transform_generic): New.
12610 (transform_blk, transform): Merge to ...
12611 [!USE_ARM_ASM] (do_transform_generic): ... this and remove calls to
12612 assembly implementations.
12613 (sha512_init, sha384_init): Select hd->bctx.bwrite based on HW
12614 features.
12615 (sha512_final): Call hd->bctx.bwrite instead of transform.
12616
12617 Add hash_buffer and hash_buffers for SHA-224, SHA-385, SHA3 and BLAKE2.
12618 + commit 59c4e344eec61cff45185e1caea6815b3266a0f8
12619 * cipher/blake2.c (DEFINE_BLAKE2_VARIANT): Add hash_buffer and
12620 hash_buffers functions for BLAKE2 variants.
12621 * cipher/keccak.c (_gcry_sha3_hash_buffer, _gcry_sha3_hash_buffers)
12622 (_gcry_sha3_224_hash_buffer, _gcry_sha3_224_hash_buffers)
12623 (_gcry_sha3_256_hash_buffer, _gcry_sha3_256_hash_buffers)
12624 (_gcry_sha3_384_hash_buffer, _gcry_sha3_384_hash_buffers)
12625 (_gcry_sha3_512_hash_buffer, _gcry_sha3_512_hash_buffers): New.
12626 * cipher/sha256.c (_gcry_sha224_hash_buffer)
12627 (_gcry_sha224_hash_buffers): New.
12628 * cipher/sha512.c (_gcry_sha384_hash_buffer)
12629 (_gcry_sha384_hash_buffers): New.
12630
12631 Add hash_buffer and hash_buffers pointers to message digest spec.
12632 + commit b136703ea0ddbd9fec6dfd1f8dfda8373653ba39
12633 * src/cipher-proto.h (gcry_md_hash_buffer_t)
12634 (gcry_md_hash_buffers_t): New.
12635 (gcry_md_spec): Add hash_buffer and hash_buffers.
12636 * cipher/md.c (_gcry_md_hash_buffer, _gcry_md_hash_buffers): Use
12637 hash_buffer/hash_buffers from MD spec instead of hard-coding supported
12638 algorithms.
12639 * cipher/blake2.c: Add NULL to MD spec hash_buffer and hash_buffers
12640 pointers.
12641 * cipher/crc.c: Ditto.
12642 * cipher/gostr3411-94.c: Ditto.
12643 * cipher/keccak.c: Ditto.
12644 * cipher/md2.c: Ditto.
12645 * cipher/md4.c: Ditto.
12646 * cipher/md5.c: Ditto.
12647 * cipher/stribog.c: Ditto.
12648 * cipher/tiger.c: Ditto.
12649 * cipher/whirlpool.c: Ditto.
12650 * cipher/rmd160.c (_gcry_rmd160_hash_buffers): New.
12651 (_gcry_digest_spec_rmd160): Add hash_buffer and hash_buffers functions.
12652 * cipher/sha1.c (_gcry_digest_spec_sha1): Add hash_buffer and
12653 hash_buffers functions.
12654 * cipher/sha256.c (_gcry_digest_spec_sha256): Add hash_buffer and
12655 hash_buffers functions.
12656 (_gcry_digest_spec_sha224): Add NULL pointers for hash_buffer and
12657 hash_buffers.
12658 * cipher/sha512.c (_gcry_digest_spec_sha1): Add hash_buffer and
12659 hash_buffers functions.
12660 (_gcry_digest_spec_sha384): Add NULL pointers for hash_buffer and
12661 hash_buffers.
12662 * cipher/sm3.c (_gcry_digest_spec_sha1): Add hash_buffer and
12663 hash_buffers functions.
12664
12665 AES: setup cipher object bulk routines with optimized versions.
12666 + commit a15c1def7e0f170f6663635db84fecab1cbfcca7
12667 * cipher/rijndael-aesni.c
12668 (_gcry_aes_aesni_prepare_decryption): Rename...
12669 (do_aesni_prepare_decryption): .. to this.
12670 (_gcry_aes_aesni_prepare_decryption): New.
12671 (_gcry_aes_aesni_cfb_enc, _gcry_aes_aesni_cbc_enc)
12672 (_gcry_aes_aesni_ctr_enc, _gcry_aes_aesni_cfb_dec)
12673 (_gcry_aes_aesni_cbc_dec): Reorder parameters to match bulk
12674 operations.
12675 (_gcry_aes_aesni_cbc_dec, aesni_ocb_dec)
12676 (_gcry_aes_aesni_xts_dec): Check and prepare decryption.
12677 (_gcry_aes_aesni_ocb_crypt, _gcry_aes_aesni_ocb_auth): Change return
12678 type to size_t.
12679 * cipher/rijndael-armv8-ce.c
12680 (_gcry_aes_armv8_ce_cfb_enc, _gcry_aes_armv8_ce_cbc_enc)
12681 (_gcry_aes_armv8_ce_ctr_enc, _gcry_aes_armv8_ce_cfb_dec)
12682 (_gcry_aes_armv8_ce_cbc_dec): Reorder parameters to match bulk
12683 operations.
12684 (_gcry_aes_armv8_ce_cbc_dec, _gcry_aes_armv8_ce_ocb_crypt)
12685 (_gcry_aes_armv8_ce_xts_dec): Check and prepare decryption.
12686 (_gcry_aes_armv8_ce_ocb_crypt, _gcry_aes_armv8_ce_ocb_auth): Change
12687 return type to size_t.
12688 * cipher/rijndael-ssse3-amd64.c
12689 (_gcry_ssse3_prepare_decryption): Rename...
12690 (do_ssse3_prepare_decryption): .. to this.
12691 (_gcry_ssse3_prepare_decryption): New.
12692 (_gcry_aes_ssse3_cfb_enc, _gcry_aes_ssse3_cbc_enc)
12693 (_gcry_aes_ssse3_ctr_enc, _gcry_aes_ssse3_cfb_dec)
12694 (_gcry_aes_ssse3_cbc_dec): Reorder parameters to match bulk
12695 operations.
12696 (_gcry_aes_ssse3_cbc_dec, ssse3_ocb_dec): Check and prepare decryption.
12697 (_gcry_aes_ssse3_ocb_crypt, _gcry_aes_ssse3_ocb_auth): Change return
12698 type to size_t.
12699 * cipher/rijndael.c
12700 (_gcry_aes_aesni_cfb_enc, _gcry_aes_aesni_cbc_enc)
12701 (_gcry_aes_aesni_ctr_enc, _gcry_aes_aesni_cfb_dec)
12702 (_gcry_aes_aesni_cbc_dec, _gcry_aes_aesni_ocb_crypt)
12703 (_gcry_aes_aesni_ocb_auth, _gcry_aes_aesni_xts_crypt)
12704 (_gcry_aes_ssse3_cfb_enc, _gcry_aes_ssse3_cbc_enc)
12705 (_gcry_aes_ssse3_ctr_enc, _gcry_aes_ssse3_cfb_dec)
12706 (_gcry_aes_ssse3_cbc_dec, _gcry_aes_ssse3_ocb_crypt)
12707 (_gcry_aes_ssse3_ocb_auth, _gcry_aes_ssse3_xts_crypt)
12708 (_gcry_aes_armv8_ce_cfb_enc, _gcry_aes_armv8_ce_cbc_enc)
12709 (_gcry_aes_armv8_ce_ctr_enc, _gcry_aes_armv8_ce_cfb_dec)
12710 (_gcry_aes_armv8_ce_cbc_dec, _gcry_aes_armv8_ce_ocb_crypt)
12711 (_gcry_aes_armv8_ce_ocb_auth, _gcry_aes_armv8_ce_xts_crypt): Change
12712 prototypes to match bulk operations.
12713 (do_setkey): Setup bulk operations with optimized implementations.
12714 (_gcry_aes_cfb_enc, _gcry_aes_cbc_enc, _gcry_aes_ctr_enc)
12715 (_gcry_aes_cfb_dec, _gcry_aes_cbc_dec, _gcry_aes_ocb_crypt)
12716 (_gcry_aes_ocb_crypt, _gcry_aes_ocb_auth, _gcry_aes_xts_crypt): Update
12717 usage to match new prototypes, avoid prefetch and decryption
12718 preparation on optimized code paths.
12719
12720 Pass cipher object pointer to setkey functions.
12721 + commit ca21a24808efa5d562ac91f683504ae0d6dfa69f
12722 * cipher/cipher.c (cipher_setkey): Pass cipher object pointer to
12723 cipher's setkey function.
12724 * cipher/arcfour.c: Add gcry_cipher_hd_t parameter for setkey
12725 functions and update selftests to pass NULL pointer.
12726 * cipher/blowfish.c: Ditto.
12727 * cipher/camellia-glue.c: Ditto.
12728 * cipher/cast5.c: Ditto.
12729 * cipher/chacha20.c: Ditto.
12730 * cipher/cipher-selftest.c: Ditto.
12731 * cipher/des.c: Ditto.
12732 * cipher/gost28147.c: Ditto.
12733 * cipher/idea.c: Ditto.
12734 * cipher/rfc2268.c: Ditto.
12735 * cipher/rijndael.c: Ditto.
12736 * cipher/salsa20.c: Ditto.
12737 * cipher/seed.c: Ditto.
12738 * cipher/serpent.c: Ditto.
12739 * cipher/twofish.c: Ditto.
12740 * src/cipher-proto.h: Ditto.
12741
12742 Add fast path for _gcry_fips_is_operational.
12743 + commit b6e6ace324440f564df664e27f8276ef01f76795
12744 * src/fips.c (no_fips_mode_required): Rename to...
12745 (_gcry_no_fips_mode_required): ...this and make externally available.
12746 * src/g10lib.h (_gcry_no_fips_mode_required): New extern.
12747 (fips_mode): Inline _gcry_fips_mode to macro, use
12748 _gcry_no_fips_mode_required directly.
12749 (fips_is_operational): Inline fips_mode check from
12750 _gcry_fips_in_operational.
12751
12752 Access cipher mode routines through routine pointers.
12753 + commit 233e2049a2cc1c1110f541b6a7ef145a737e2c65
12754 * cipher/cipher-internal.h (gcry_cipher_handle): Add function pointers
12755 for mode operations.
12756 (_gcry_cipher_xts_crypt): Remove.
12757 (_gcry_cipher_xts_encrypt, _gcry_cipher_xts_decrypt): New.
12758 * cipher/cipher-xts.c (_gcry_cipher_xts_encrypt)
12759 (_gcry_cipher_xts_decrypt): New.
12760 * cipher/cipher.c (_gcry_cipher_setup_mode_ops): New.
12761 (_gcry_cipher_open_internal): Setup mode routines.
12762 (cipher_encrypt, cipher_decrypt): Remove.
12763 (do_stream_encrypt, do_stream_decrypt, do_encrypt_none_unknown)
12764 (do_decrypt_none_unknown): New.
12765 (_gcry_cipher_encrypt, _gcry_cipher_decrypt, _gcry_cipher_setiv)
12766 (_gcry_cipher_authenticate, _gcry_cipher_gettag)
12767 (_gcry_cipher_checktag): Adapted to use mode routines through pointers.
12768
12769 Add separate handlers for CBC-CTS variant.
12770 + commit 87d8caa47e00f1b1cea968fe38cf30c0ccc9749c
12771 * cipher/cipher-cbc.c (cbc_encrypt_inner, cbc_decrypt_inner)
12772 (_gcry_cipher_cbc_cts_encrypt, _gcry_cipher_cbc_cts_decrypt): New.
12773 (_gcry_cipher_cbc_encrypt, _gcry_cipher_cbc_decrypt): Remove CTS
12774 handling.
12775 * cipher/cipher-internal.h (_gcry_cipher_cbc_cts_encrypt)
12776 (_gcry_cipher_cbc_cts_decrypt): New.
12777 * cipher/cipher.c (cipher_encrypt, cipher_decrypt): Call CBC-CTS
12778 handler if CBC-CTS flag is set.
12779
12780 Avoid division by spec->blocksize in cipher mode handlers.
12781 + commit f5168091c1930e948af8f25da11cad5dfa62c7ba
12782 * cipher/cipher-internal.h (_gcry_blocksize_shift): New.
12783 * cipher/cipher-cbc.c (_gcry_cipher_cbc_encrypt)
12784 (_gcry_cipherp_cbc_decrypt): Use bit-level operations instead of
12785 division to get number of blocks and check input length against
12786 blocksize.
12787 * cipher/cipher-cfb.c (_gcry_cipher_cfb_encrypt)
12788 (_gcry_cipher_cfb_decrypt): Ditto.
12789 * cipher/cipher-cmac.c (_gcry_cmac_write): Ditto.
12790 * cipher/cipher-ctr.c (_gcry_cipher_ctr_crypt): Ditto.
12791 * cipher/cipher-ofb.c (_gcry_cipher_ofb_encrypt)
12792 (_gcry_cipher_ofb_decrypt): Ditto.
12793
12794 Fix CBC-CTS+CBC-MAC flag check.
12795 + commit a69021535b472556651eb2bab65666206c56c24b
12796 * cipher/cipher.c (_gcry_cipher_open_internal): Check flags separately
12797 instead of AND masking two flags to zero.
12798
12799 tests/basic: silence GCC-8 warning.
12800 + commit 2a94bdfc0538a340a24c1a7b524bb0c5f606457c
12801 * tests/basic.c (check_ofb_cipher, check_stream_cipher): Change
12802 tv[].data[].inlen type from signed to unsigned integer.
12803
12804 2018-06-19 Will Dietz <[email protected]>
12805
12806 random: Fix hang of _gcry_rndjent_get_version.
12807 + commit 355f5b7f69075c010fe33aa5b10ac60c08fae0c7
12808 * random/rndjent.c (_gcry_rndjent_get_version): Move locking.
12809
12810 2018-06-13 NIIBE Yutaka <[email protected]>
12811
12812 ecc: Add blinding for ECDSA.
12813 + commit 9010d1576e278a4274ad3f4aa15776c28f6ba965
12814 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_sign): Blind secret D with
12815 randomized nonce B.
12816
12817 2018-06-06 Werner Koch <[email protected]>
12818
12819 ecc: Improve gcry_mpi_ec_curve_point.
12820 + commit 7b6c2afd699e889f5f054cc3d202a61bd0ee1dcf
12821 * mpi/ec.c (_gcry_mpi_ec_curve_point): Check range of coordinates.
12822 * tests/t-mpi-point.c (point_on_curve): New.
12823
12824 2018-06-05 Werner Koch <[email protected]>
12825
12826 mpi: New internal function _gcry_mpi_cmpabs.
12827 + commit 6606ae44e0de1069b29dd4215ee9748280940e1b
12828 * mpi/mpi-cmp.c (_gcry_mpi_cmp): Factor out to ...
12829 (do_mpi_cmp): New. Add arg absmode.
12830 (_gcry_mpi_cmpabs): New.
12831 * src/gcrypt-int.h (mpi_cmpabs): New macro.
12832
12833 2018-04-29 Werner Koch <[email protected]>
12834
12835 build: Convince gcc not to delete NULL ptr checks.
12836 + commit 61dbb7c08ab11c10060e193b52e3e1d2ec6dd062
12837 * configure.ac: Try to use -fno-delete-null-pointer-checks.
12838
12839 2018-04-28 Werner Koch <[email protected]>
12840
12841 prime: Avoid rare assertion failure in gcry_prime_check.
12842 + commit f3362f10f6f671246c38115ed12b0047966c200e
12843 * cipher/primegen.c (is_prime): Don't fail on the assert X > 1.
12844
12845 2018-04-17 Werner Koch <[email protected]>
12846
12847 mpi: Fix for buidling for MIPS64 with Clang.
12848 + commit e7ae0ae243c8978a67c802169183187d88557be8
12849 * mpi/longlong.h [MIPS64][__clang__]: Use the C version like we
12850 already do for 32 bit MIPS.
12851
12852 2018-04-11 NIIBE Yutaka <[email protected]>
12853
12854 hmac: Use xtrymalloc.
12855 + commit 3e3b520fb32a37c5c23762531a7b3168e112ac36
12856 * src/hmac256.c (_gcry_hmac256_new): Use xtrymalloc.
12857 (_gcry_hmac256_file): Likewise.
12858
12859 2018-04-10 Jussi Kivilinna <[email protected]>
12860
12861 basic_all_hwfeature_combinations.sh: use $njobs to limit parallel tasks.
12862 + commit 5e01705ca90830c27a4cbd8bad41243915f4538a
12863 * tests/basic_all_hwfeature_combinations.sh: Use $njobs to limit
12864 parallel tasks instead of fixed number "8".
12865
12866 Faster look-up for spec by algo for digests, ciphers and MAC.
12867 + commit 634a85412a4073aa1890589ce5e97eac7b0f3ca3
12868 * cipher/cipher.c (cipher_list_algo0, cipher_list_algo301): New cipher
12869 spec lists with same order and spacing as 'gcry_cipher_algos'
12870 enumeration.
12871 (spec_from_algo): Use new spec lists for faster look-up.
12872 * cipher/mac.c (mac_list_algo101, mac_list_algo201, mac_list_algo401)
12873 (mac_list_algo501): New MAC spec lists with same order and spacing as
12874 'gcry_mac_algos' enumeration.
12875 (spec_from_algo): Use new spec lists for faster look-up.
12876 * cipher/md.c (digest_list_algo0, digest_list_algo301): New digest
12877 spec lists with same order and spacing as 'gcry_md_algos'
12878 enumeration.
12879 (spec_from_algo): Use new spec lists for faster look-up.
12880
12881 Fix building with BLAKE2 disabled.
12882 + commit 35b59d0ea52e8a1c30c43554dc4dbca97da4bf87
12883 * cipher/md.c (md_setkey): Enclose Blake2 part with USE_BLAKE2.
12884
12885 Add missing BLAKE2, SM3 and GOSTR3411_CP to MAC-HMAC interface.
12886 + commit 52e52eb0e3e5541cfc86e04c5047500db5d538b7
12887 * cipher/mac-hmac.c (map_mac_algo_to_md): Add GOSTR3411_CP, BLAKE2 and
12888 SM3.
12889 (_gcry_mac_type_spec_hmac_gost3411_cp)
12890 (_gcry_mac_type_spec_hmac_blake2b_512)
12891 (_gcry_mac_type_spec_hmac_blake2b_384)
12892 (_gcry_mac_type_spec_hmac_blake2b_256)
12893 (_gcry_mac_type_spec_hmac_blake2b_160)
12894 (_gcry_mac_type_spec_hmac_blake2s_256)
12895 (_gcry_mac_type_spec_hmac_blake2s_224)
12896 (_gcry_mac_type_spec_hmac_blake2s_160)
12897 (_gcry_mac_type_spec_hmac_blake2s_128)
12898 (_gcry_mac_type_spec_hmac_sm3): New.
12899 * cipher/mac-internal.h (_gcry_mac_type_spec_hmac_gost3411_cp)
12900 (_gcry_mac_type_spec_hmac_blake2b_512)
12901 (_gcry_mac_type_spec_hmac_blake2b_384)
12902 (_gcry_mac_type_spec_hmac_blake2b_256)
12903 (_gcry_mac_type_spec_hmac_blake2b_160)
12904 (_gcry_mac_type_spec_hmac_blake2s_256)
12905 (_gcry_mac_type_spec_hmac_blake2s_224)
12906 (_gcry_mac_type_spec_hmac_blake2s_160)
12907 (_gcry_mac_type_spec_hmac_blake2s_128)
12908 (_gcry_mac_type_spec_hmac_sm3): New.
12909 * cipher/mac.c (mac_list): Add GOSTR3411_CP, BLAKE2 and SM3.
12910 * src/gcrypt.h.in (GCRY_MAC_HMAC_GOSTR3411_CP)
12911 (GCRY_MAC_HMAC_BLAKE2B_512, GCRY_MAC_HMAC_BLAKE2B_384)
12912 (GCRY_MAC_HMAC_BLAKE2B_256, GCRY_MAC_HMAC_BLAKE2B_160)
12913 (GCRY_MAC_HMAC_BLAKE2S_256, GCRY_MAC_HMAC_BLAKE2S_224)
12914 (GCRY_MAC_HMAC_BLAKE2S_160, GCRY_MAC_HMAC_BLAKE2S_128)
12915 (GCRY_MAC_HMAC_SM3): New.
12916
12917 2018-04-10 NIIBE Yutaka <[email protected]>
12918
12919 random: Protect another use of jent_rng_collector.
12920 + commit 0de2a22fcf6607d0aecb550feefa414cee3731b2
12921 * random/rndjent.c (_gcry_rndjent_get_version): Lock the access.
12922
12923 2018-03-28 Jussi Kivilinna <[email protected]>
12924
12925 aarch64/assembly: only use the lower 32 bit of an int parameters.
12926 + commit 9b58e4a03ba3aeff7bae3f40da706977870c9649
12927 * cipher/camellia-aarch64.S (_gcry_camellia_arm_encrypt_block)
12928 (__gcry_camellia_arm_decrypt_block): Make comment section about input
12929 registers match usage.
12930 * cipher/rijndael-armv8-aarch64-ce.S (_gcry_aes_ocb_auth_armv8_ce): Use
12931 'w12' and 'w7' instead of 'x12' and 'x7'.
12932 (_gcry_aes_xts_enc_armv8_ce, _gcry_aes_xts_dec_armv8_ce): Fix function
12933 prototype in comments.
12934 * mpi/aarch64/mpih-add1.S: Use 32-bit registers for 32-bit mpi_size_t
12935 parameters.
12936 * mpi/aarch64/mpih-mul1.S: Ditto.
12937 * mpi/aarch64/mpih-mul2.S: Ditto.
12938 * mpi/aarch64/mpih-mul3.S: Ditto.
12939 * mpi/aarch64/mpih-sub1.S: Ditto.
12940
12941 poly1305: silence compiler warning on clang/aarch64.
12942 + commit 8cdb010f04528703a502344e00d52447de12547d
12943 * cipher/poly1305.c (MUL_MOD_1305_64): cast zero constant to 64-bits.
12944
12945 2018-03-28 Martin Storsjö <[email protected]>
12946
12947 aarch64: Enable building the aarch64 cipher assembly for windows.
12948 + commit 0de2191a07d69ef1fa34ca4c5d5fc4985ff7b4c4
12949 * cipher/asm-common-aarch64.h: New.
12950 * cipher/camellia-aarch64.S: Use ELF macro, use x19 instead of x18.
12951 * cipher/chacha20-aarch64.S: Use ELF macro, don't use GOT on windows.
12952 * cipher/cipher-gcm-armv8-aarch64-ce.S: Use ELF macro.
12953 * cipher/rijndael-aarch64.S: Use ELF macro.
12954 * cipher/rijndael-armv8-aarch64-ce.S: Use ELF macro.
12955 * cipher/sha1-armv8-aarch64-ce.S: Use ELF macro.
12956 * cipher/sha256-armv8-aarch64-ce.S: Use ELF macro.
12957 * cipher/twofish-aarch64.S: Use ELF macro.
12958 * configure.ac: Don't require .size and .type in aarch64 assembly check.
12959
12960 aarch64: camellia: Only use the lower 32 bit of an int parameter.
12961 + commit 4e1b628f492643d4e9b830bcdab7b49daaec5854
12962 * cipher/camellia-aarch64.S: Use 'w3' instead of 'x3'.
12963
12964 aarch64: Fix assembling chacha20-aarch64.S with clang/llvm.
12965 + commit 36e916fc332eda74963192b1c0bf6860a3e5d67b
12966 * cipher/chacha20-aarch64.S: Remove superfluous lane counts.
12967
12968 aarch64: mpi: Fix building the mpi aarch64 assembly for windows.
12969 + commit ec0a2f25c0f64a7b65b373508ce9081e10461965
12970 * mpi/aarch64/mpih-add1.S: Use ELF macro.
12971 * mpi/aarch64/mpih-mul1.S: Use ELF macro.
12972 * mpi/aarch64/mpih-mul2.S: Use ELF macro.
12973 * mpi/aarch64/mpih-mul3.S: Use ELF macro.
12974 * mpi/aarch64/mpih-sub1.S: Use ELF macro.
12975 * mpi/asm-common-aarch64.h: New.
12976
12977 random: Don't assume that _WIN64 implies x86_64.
12978 + commit ed41d6d6fb4551342b22ef763de1bd60e964e186
12979 * random/rndw32.c: Change _WIN64 ifdef into __x86_64__.
12980
12981 2018-03-22 Jussi Kivilinna <[email protected]>
12982
12983 tests/aeswrap: add in-place encryption/decryption testing.
12984 + commit 885f031fbd17abc1c0fedbb98df22823b647fc11
12985 * tests/aeswrap.c (check): Rename to...
12986 (check_one): ...this and add in-place testing.
12987 (check): New.
12988
12989 2018-03-22 Stephan Mueller <[email protected]>
12990
12991 AES-KW: fix in-place encryption.
12992 + commit 330ec66e0babdabb658dc7d6db78f37b2a1b996e
12993 * cipher/cipher-aeswrap.c: move memmove call before KW IV setting
12994
12995 2018-03-22 Jussi Kivilinna <[email protected]>
12996
12997 bench-slope: add CPU frequency auto-detection.
12998 + commit 617f5e746f8295cc36d1002c8c53edc95d04d0f6
12999 * tests/bench-slope.c (bench_obj): Add 'hd'.
13000 (bench_encrypt_init, bench_encrypt_free, bench_encrypt_do_bench)
13001 (bench_decrypt_do_bench, bench_xts_encrypt_init)
13002 (bench_xts_encrypt_do_bench, bench_xts_decrypt_do_bench)
13003 (bench_ccm_encrypt_init, bench_ccm_encrypt_do_bench)
13004 (bench_ccm_decrypt_do_bench, bench_aead_encrypt_init)
13005 (bench_aead_encrypt_do_bench, bench_aead_decrypt_do_bench)
13006 (bench_hash_init, bench_hash_free, bench_hash_do_bench)
13007 (bench_mac_init, bench_mac_free, bench_mac_do_bench): Use 'obj->hd'
13008 for storing pointer to crypto context.
13009 (auto_ghz): New.
13010 (do_slope_benchmark): Rename to...
13011 (slope_benchmark): ...this.
13012 (auto_ghz_init, auto_ghz_free, auto_ghz_bench, auto_ghz_detect_ops)
13013 (get_auto_ghz, do_slope_benchmark): New.
13014 (double_to_str): Round number larger than 1000 to integer.
13015 (bench_print_result_csv, bench_print_result_std)
13016 (bench_print_result, bench_print_header, cipher_bench_one)
13017 (hash_bench_one, mac_bench_one, kdf_bench_one, kdf_bench): Add
13018 auto-detected frequency printing.
13019 (print_help): Help for CPU speed auto-detection mode.
13020 (main): Add parsing for "--cpu-mhz auto".
13021
13022 _gcry_burn_stack: use memset for clearing memory.
13023 + commit 3841b23c0ccb24d555b7570083bba958e3126d26
13024 * src/misc.c (__gcry_burn_stack) [HAVE_VLA]: Use 'memset' for clearing
13025 stack.
13026
13027 Improve constant-time buffer compare.
13028 + commit a1127dbbada4302abf09eec90fbaceca87bfcdf0
13029 * cipher/bufhelp.h (buf_eq_const): Rewrite logic.
13030
13031 2018-02-16 Jussi Kivilinna <[email protected]>
13032
13033 Add Intel SHA Extensions accelerated SHA256 implementation.
13034 + commit 0b3ec359e2279c3b46b171372b1b7733bba20cd7
13035 * cipher/Makefile.am: Add 'sha256-intel-shaext.c'.
13036 * cipher/sha256-intel-shaext.c: New.
13037 * cipher/sha256.c (USE_SHAEXT)
13038 (_gcry_sha256_transform_intel_shaext): New.
13039 (SHA256_CONTEXT): Add 'use_shaext'.
13040 (sha256_init, sha224_init) [USE_SHAEXT]: Use shaext if supported.
13041 (transform) [USE_SHAEXT]: Use shaext if enabled.
13042 (transform): Only add ASM_EXTRA_STACK if returned burn length is not
13043 zero.
13044 * configure.ac: Add 'sha256-intel-shaext.lo'.
13045
13046 Add Intel SHA Extensions accelerated SHA1 implementation.
13047 + commit d02958bd300d2c80bc92b1e072103e95e256b297
13048 * cipher/Makefile.am: Add 'sha1-intel-shaext.c'.
13049 * cipher/sha1-intel-shaext.c: New.
13050 * cipher/sha1.c (USE_SHAEXT, _gcry_sha1_transform_intel_shaext): New.
13051 (sha1_init) [USE_SHAEXT]: Use shaext implementation is supported.
13052 (transform) [USE_SHAEXT]: Use shaext if enabled.
13053 (transform): Only add ASM_EXTRA_STACK if returned burn length is not
13054 zero.
13055 * cipher/sha1.h (SHA1_CONTEXT): Add 'use_shaext'.
13056 * configure.ac: Add 'sha1-intel-shaext.lo'.
13057 (shaextsupport, gcry_cv_gcc_inline_asm_shaext): New.
13058 * src/g10lib.h: Add HWF_INTEL_SHAEXT and reorder HWF flags.
13059 * src/hwf-x86.c (detect_x86_gnuc): Detect SHA Extensions.
13060 * src/hwfeatures.c (hwflist): Add 'intel-shaext'.
13061
13062 AVX implementation of BLAKE2s.
13063 + commit da58a62ac1b7a8d97b0895dcb41d15af531e45e5
13064 * cipher/Makefile.am: Add 'blake2s-amd64-avx.S'.
13065 * cipher/blake2.c (USE_AVX, _gry_blake2s_transform_amd64_avx): New.
13066 (BLAKE2S_CONTEXT) [USE_AVX]: Add 'use_avx'.
13067 (blake2s_transform): Rename to ...
13068 (blake2s_transform_generic): ... this.
13069 (blake2s_transform): New.
13070 (blake2s_final): Pass 'ctx' pointer to transform function instead of
13071 'S'.
13072 (blake2s_init_ctx): Check HW features and enable AVX implementation
13073 if supported.
13074 * cipher/blake2s-amd64-avx.S: New.
13075 * configure.ac: Add 'blake2s-amd64-avx.lo'.
13076
13077 2018-02-04 Jussi Kivilinna <[email protected]>
13078
13079 AVX2 implementation of BLAKE2b.
13080 + commit af7fc732f9a7af7a70276f1e8364d2132db314f1
13081 * cipher/Makefile.am: Add 'blake2b-amd64-avx2.S'.
13082 * cipher/blake2.c (USE_AVX2, ASM_FUNC_ABI, ASM_EXTRA_STACK)
13083 (_gry_blake2b_transform_amd64_avx2): New.
13084 (BLAKE2B_CONTEXT) [USE_AVX2]: Add 'use_avx2'.
13085 (blake2b_transform): Rename to ...
13086 (blake2b_transform_generic): ... this.
13087 (blake2b_transform): New.
13088 (blake2b_final): Pass 'ctx' pointer to transform function instead of
13089 'S'.
13090 (blake2b_init_ctx): Check HW features and enable AVX2 implementation
13091 if supported.
13092 * cipher/blake2b-amd64-avx2.S: New.
13093 * configure.ac: Add 'blake2b-amd64-avx2.lo'.
13094
13095 2018-01-31 Jussi Kivilinna <[email protected]>
13096
13097 Fix incorrect counter overflow handling for GCM.
13098 + commit ffdc6f3623a0bcb41324d562340b2cd1c288e387
13099 * cipher/cipher-gcm.c (gcm_ctr_encrypt): New function to handle
13100 32-bit CTR increment for GCM.
13101 (_gcry_cipher_gcm_encrypt, _gcry_cipher_gcm_decrypt): Do not use
13102 generic CTR implementation directly, use gcm_ctr_encrypt instead.
13103 * tests/basic.c (_check_gcm_cipher): Add test-vectors for 32-bit
13104 CTR overflow.
13105 (check_gcm_cipher): Add 'split input to 15 bytes and 17 bytes'
13106 test-runs.
13107
13108 2018-01-22 Jussi Kivilinna <[email protected]>
13109
13110 Fix use of AVX instructions in Chaha20 SSSE3 implementation.
13111 + commit 0b55f349a8b8f4b0ac9ed724c2d5b8dcc9f5401c
13112 * cipher/chacha20-amd64-ssse3.S: Replace two 'vmovdqa' instructions
13113 with 'movdqa'.
13114
13115 2018-01-20 Jussi Kivilinna <[email protected]>
13116
13117 doc: fix double "See" in front of reference.
13118 + commit bd75f0e89817b5708c57efab49e3eb4e035186e2
13119 * doc/gcrypt.texi: Change @xref to @ref when text already has 'see' in
13120 the front.
13121
13122 Add EAX mode.
13123 + commit e8629e535bd0e9711b07904d4501de8ad57aaecd
13124 * cipher/Makefile.am: Add 'cipher-eax.c'.
13125 * cipher/cipher-cmac.c (cmac_write): Rename to ...
13126 (_gcry_cmac_write): ... this; Take CMAC context as new input
13127 parameter; Return error code.
13128 (cmac_generate_subkeys): Rename to ...
13129 (_gcry_cmac_generate_subkeys): ... this; Take CMAC context as new
13130 input parameter; Return error code.
13131 (cmac_final): Rename to ...
13132 (_gcry_cmac_final): ... this; Take CMAC context as new input
13133 parameter; Return error code.
13134 (cmac_tag): Take CMAC context as new input parameter.
13135 (_gcry_cmac_reset): New.
13136 (_gcry_cipher_cmac_authenticate): Remove duplicate tag flag check;
13137 Adapt to changes above.
13138 (_gcry_cipher_cmac_get_tag): Adapt to changes above.
13139 (_gcry_cipher_cmac_check_tag): Ditto.
13140 (_gcry_cipher_cmac_set_subkeys): Ditto.
13141 * cipher-eax.c: New.
13142 * cipher-internal.h (gcry_cmac_context_t): New.
13143 (gcry_cipher_handle): Update u_mode.cmac; Add u_mode.eax.
13144 (_gcry_cmac_write, _gcry_cmac_generate_subkeys, _gcry_cmac_final)
13145 (_gcry_cmac_reset, _gcry_cipher_eax_encrypt, _gcry_cipher_eax_decrypt)
13146 (_gcry_cipher_eax_set_nonce, _gcry_cipher_eax_authenticate)
13147 (_gcry_cipher_eax_get_tag, _gcry_cipher_eax_check_tag)
13148 (_gcry_cipher_eax_setkey): New prototypes.
13149 * cipher/cipher.c (_gcry_cipher_open_internal, cipher_setkey)
13150 (cipher_reset, cipher_encrypt, cipher_decrypt, _gcry_cipher_setiv)
13151 (_gcry_cipher_authenticate, _gcry_cipher_gettag, _gcry_cipher_checktag)
13152 (_gcry_cipher_info): Add EAX mode.
13153 * doc/gcrypt.texi: Add EAX mode.
13154 * src/gcrypt.h.in (GCRY_CIPHER_MODE_EAX): New.
13155 * tests/basic.c (_check_gcm_cipher, _check_poly1305_cipher): Constify
13156 test vectors array.
13157 (_check_eax_cipher, check_eax_cipher): New.
13158 (check_ciphers, check_cipher_modes): Add EAX mode.
13159 * tests/bench-slope.c (bench_eax_encrypt_do_bench)
13160 (bench_eax_decrypt_do_bench, bench_eax_authenticate_do_bench)
13161 (eax_encrypt_ops, eax_decrypt_ops, eax_authenticate_ops): New.
13162 (cipher_modes): Add EAX mode.
13163 * tests/benchmark.c (cipher_bench): Add EAX mode.
13164
13165 cipher: constify spec arrays.
13166 + commit cd7ed2e3546b12dd98df4211949f1cdbf5827013
13167 * cipher/cipher.c (cipher_list): Constify array.
13168 * cipher/mac.c (mac_list): Constify array.
13169 * cipher/md.c (digest_list): Constify array.
13170 * cipher/pubkey.c (pubkey_list): Constify array.
13171
13172 Add ARMv8/CE acceleration for AES-XTS.
13173 + commit 93503c127a52c1f6a193750e2bf181a744ba3e6b
13174 * cipher/rijndael-armv8-aarch32-ce.S (_gcry_aes_xts_enc_armv8_ce)
13175 (_gcry_aes_xts_dec_armv8_ce): New.
13176 * cipher/rijndael-armv8-aarch64-ce.S (_gcry_aes_xts_enc_armv8_ce)
13177 (_gcry_aes_xts_dec_armv8_ce): New.
13178 * cipher/rijndael-armv8-ce.c (_gcry_aes_xts_enc_armv8_ce)
13179 (_gcry_aes_xts_dec_armv8_ce, xts_crypt_fn_t)
13180 (_gcry_aes_armv8_ce_xts_crypt): New.
13181 * cipher/rijndael.c (_gcry_aes_armv8_ce_xts_crypt): New.
13182 (_gcry_aes_xts_crypt) [USE_ARM_CE]: New.
13183
13184 2018-01-09 Jussi Kivilinna <[email protected]>
13185
13186 rijndael-ssse3: call assembly functions directly.
13187 + commit c3d60acc3ab5c6d60c2258882175bf31351cc998
13188 * cipher/rijndael-ssse3-amd64-asm.S (_gcry_aes_ssse3_enc_preload)
13189 (_gcry_aes_ssse3_dec_preload, _gcry_aes_ssse3_encrypt_core)
13190 (_gcry_aes_ssse3_decrypt_core, _gcry_aes_schedule_core): Add
13191 ENTER_SYSV_FUNC_PARAMS_* at function entry and EXIT_SYSV_FUNC at exit.
13192 (_gcry_aes_ssse3_encrypt_core, _gcry_aes_ssse3_decrypt_core): Change
13193 to input parameters to RDI and RSI registers.
13194 * cipher/rijndael-ssse3-amd64.c (_gcry_aes_ssse3_encrypt_core)
13195 (_gcry_aes_ssse3_decrypt_core, _gcry_aes_schedule_core): Add parameters
13196 for function prototypes.
13197 (PUSH_STACK_PTR, POP_STACK_PTR): Remove.
13198 (vpaes_ssse3_prepare_enc, vpaes_ssse3_prepare_dec)
13199 (_gcry_aes_ssse3_do_setkey, _gcry_aes_ssse3_prepare_decryption)
13200 (do_vpaes_ssse3_enc, do_vpaes_ssse3_dec): Remove inline assembly to
13201 call functions, and call directly instead.
13202
13203 Move AMD64 MS to SysV calling convention conversion to assembly side.
13204 + commit a518b6680ea80a4325731028545a701c1d71fc02
13205 * cipher/Makefile.am: Add 'asm-common-amd64.h'.
13206 * cipher/asm-common-amd64.h: New.
13207 * cipher/blowfish-amd64.S: Add ENTER_SYSV_FUNC_* and EXIT_SYSV_FUNC for
13208 each global function from 'asm-common-amd64.h'.
13209 * cipher/cast5-amd64.S: Ditto.
13210 * cipher/des-amd64.S: Ditto.
13211 * cipher/rijndael-amd64.S: Ditto.
13212 * cipher/twofish-amd64.S: Ditto.
13213 * cipher/arcfour-amd64.S: Ditto.
13214 * cipher/blowfish.c [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS]
13215 (call_sysv_fn): Remove.
13216 * cipher/cast5.c [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS]
13217 (call_sysv_fn): Remove.
13218 * cipher/twofish.c [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS]
13219 (call_sysv_fn, call_sysv_fn5, call_sysv_fn6): Remove.
13220 * cipher/rijndael.c (do_encrypt, do_decrypt)
13221 [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS]: Remove assembly block for
13222 calling SysV ABI function.
13223 * cipher/arcfour.c [USE_AMD64_ASM] (encrypt_stream): Ditto.
13224
13225 Make BMI2 inline assembly check more robust.
13226 + commit 135250e3060e79be698d4f36a819aa8a880789f8
13227 * configure.ac (gcry_cv_gcc_inline_asm_bmi2): New assembly test.
13228
13229 Add AES-NI acceleration for AES-XTS.
13230 + commit a00c5b2988cea256c7823a76ce601febf02c790f
13231 * cipher/cipher-internal.h (gcry_cipher_handle): Change bulk
13232 XTS function to take cipher context.
13233 * cipher/cipher-xts.c (_gcry_cipher_xts_crypt): Ditto.
13234 * cipher/cipher.c (_gcry_cipher_open_internal): Setup AES-NI
13235 XTS bulk function.
13236 * cipher/rijndael-aesni.c (xts_gfmul_const, _gcry_aes_aesni_xts_enc)
13237 (_gcry_aes_aesni_xts_enc, _gcry_aes_aesni_xts_crypt): New.
13238 * cipher/rijndael.c (_gcry_aes_aesni_xts_crypt)
13239 (_gcry_aes_xts_crypt): New.
13240 * src/cipher.h (_gcry_aes_xts_crypt): New.
13241
13242 AES-NI improvements for AMD64.
13243 + commit c9e9cb2eb6a1c659d3825ca627228b732f2f2152
13244 * cipher/rijndael-aesni.c [__x86_64__] (aesni_prepare_7_15_variable)
13245 (aesni_prepare_7_15, aesni_cleanup_7_15, do_aesni_enc_vec8)
13246 (do_aesni_dec_vec8, do_aesni_ctr_8): New.
13247 (_gcry_aes_aesni_ctr_enc, _gcry_aes_aesni_cfb_dec)
13248 (_gcry_aes_aesni_cbc_dec, aesni_ocb_enc, aesni_ocb_dec)
13249 (_gcry_aes_aesni_ocb_auth) [__x86_64__]: Add 8 parallel blocks
13250 processing.
13251
13252 Add ARMv8/AArch64 implementation of chacha20.
13253 + commit b3ec0f752c925cde36f560f0f9309ab6450bbfd9
13254 * cipher/Makefile.am: Add 'chacha20-aarch64.S'.
13255 * cipher/chacha20-aarch64.S: New.
13256 * cipher/chacha20.c (USE_AARCH64_SIMD): New.
13257 (_gcry_chacha20_aarch_blocks4): New.
13258 (chacha20_do_setkey): Add HWF selection for Aarch64 implementation.
13259 * configure.ac: Add 'chacha20-aarch64.lo'.
13260
13261 New ChaCha implementations.
13262 + commit 172ad09cbedc893f147180875335f4c525393c0b
13263 * cipher/Makefile.am: Remove 'chacha20-sse2-amd64.S',
13264 'chacha20-ssse3-amd64.S', 'chacha20-avx2-amd64.S'; Add
13265 'chacha20-amd64-ssse3.S', 'chacha20-amd64-avx2.S'.
13266 * cipher/chacha20-amd64-avx2.S: New.
13267 * cipher/chacha20-amd64-ssse3.S: New.
13268 * cipher/chacha20-armv7-neon.S: Rewrite.
13269 * cipher/chacha20-avx2-amd64.S: Remove.
13270 * cipher/chacha20-sse2-amd64.S: Remove.
13271 * cipher/chacha20-ssse3-amd64.S: Remove.
13272 * cipher/chacha20.c (CHACHA20_INPUT_LENGTH, USE_SSE2, USE_NEON)
13273 (ASM_EXTRA_STACK, chacha20_blocks_t, _gcry_chacha20_amd64_sse2_blocks)
13274 (_gcry_chacha20_amd64_ssse3_blocks, _gcry_chacha20_amd64_avx2_blocks)
13275 (_gcry_chacha20_armv7_neon_blocks, QROUND, QOUT, chacha20_core)
13276 (chacha20_do_encrypt_stream): Remove.
13277 (_gcry_chacha20_amd64_ssse3_blocks4, _gcry_chacha20_amd64_avx2_blocks8)
13278 (_gcry_chacha20_armv7_neon_blocks4, ROTATE, XOR, PLUS, PLUSONE)
13279 (QUARTERROUND, BUF_XOR_LE32): New.
13280 (CHACHA20_context_s, chacha20_blocks, chacha20_keysetup)
13281 (chacha20_encrypt_stream): Rewrite.
13282 (chacha20_do_setkey): Adjust for new CHACHA20_context_s.
13283 * configure.ac: Remove 'chacha20-sse2-amd64.lo',
13284 'chacha20-ssse3-amd64.lo', 'chacha20-avx2-amd64.lo'; Add
13285 'chacha20-amd64-ssse3.lo', 'chacha20-amd64-avx2.lo'.
13286
13287 New Poly1305 implementations.
13288 + commit b9a471ccf5f02f89e25c7ccc29898d0e4e486099
13289 * cipher/Makefile.am: Include '../mpi' for 'longlong.h'; Remove
13290 'poly1305-sse2-amd64.S', 'poly1305-avx2-amd64.S' and
13291 'poly1305-armv7-neon.S'.
13292 * cipher/poly1305-armv7-neon.S: Remove.
13293 * cipher/poly1305-avx2-amd64.S: Remove.
13294 * cipher/poly1305-sse2-amd64.S: Remove.
13295 * cipher/poly1305-internal.h (POLY1305_BLOCKSIZE)
13296 (POLY1305_STATE): New.
13297 (POLY1305_SYSV_FUNC_ABI, POLY1305_REF_BLOCKSIZE)
13298 (POLY1305_REF_STATESIZE, POLY1305_REF_ALIGNMENT)
13299 (POLY1305_USE_SSE2, POLY1305_SSE2_BLOCKSIZE, POLY1305_SSE2_STATESIZE)
13300 (POLY1305_SSE2_ALIGNMENT, POLY1305_USE_AVX2, POLY1305_AVX2_BLOCKSIZE)
13301 (POLY1305_AVX2_STATESIZE, POLY1305_AVX2_ALIGNMENT)
13302 (POLY1305_USE_NEON, POLY1305_NEON_BLOCKSIZE, POLY1305_NEON_STATESIZE)
13303 (POLY1305_NEON_ALIGNMENT, POLY1305_LARGEST_BLOCKSIZE)
13304 (POLY1305_LARGEST_STATESIZE, POLY1305_LARGEST_ALIGNMENT)
13305 (POLY1305_STATE_BLOCKSIZE, POLY1305_STATE_STATESIZE)
13306 (POLY1305_STATE_ALIGNMENT, OPS_FUNC_ABI, poly1305_key_s)
13307 (poly1305_ops_s): Remove.
13308 (poly1305_context_s): Rewrite.
13309 * cipher/poly1305.c (_gcry_poly1305_amd64_sse2_init_ext)
13310 (_gcry_poly1305_amd64_sse2_finish_ext)
13311 (_gcry_poly1305_amd64_sse2_blocks, poly1305_amd64_sse2_ops)
13312 (poly1305_init_ext_ref32, poly1305_blocks_ref32)
13313 (poly1305_finish_ext_ref32, poly1305_default_ops)
13314 (_gcry_poly1305_amd64_avx2_init_ext)
13315 (_gcry_poly1305_amd64_avx2_finish_ext)
13316 (_gcry_poly1305_amd64_avx2_blocks)
13317 (poly1305_amd64_avx2_ops, poly1305_get_state): Remove.
13318 (poly1305_init): Rewrite.
13319 (USE_MPI_64BIT, USE_MPI_32BIT): New.
13320 [USE_MPI_64BIT] (ADD_1305_64, MUL_MOD_1305_64, poly1305_blocks)
13321 (poly1305_final): New implementation using 64-bit limbs.
13322 [USE_MPI_32BIT] (UMUL_ADD_32, ADD_1305_32, MUL_MOD_1305_32)
13323 (poly1305_blocks): New implementation using 32-bit limbs.
13324 (_gcry_poly1305_update, _gcry_poly1305_finish)
13325 (_gcry_poly1305_init): Adapt to new implementation.
13326 * configure.ac: Remove 'poly1305-sse2-amd64.lo',
13327 'poly1305-avx2-amd64.lo' and 'poly1305-armv7-neon.lo'.
13328
13329 mpi/ec: fix when 'unsigned long' is 32-bit but limb size is 64-bit.
13330 + commit d39deb0a41dbeec81174704904d3d29c66d10d7e
13331 * mpi/ec.c (ec_addm_25519, ec_subm_25519, ec_mulm_25519): Cast '1' to
13332 mpi_limb_t before left shift.
13333
13334 2017-11-24 Werner Koch <[email protected]>
13335
13336 sexp: Avoid a fatal error in case of ENOMEM in called functions.
13337 + commit 2ad912d5b7794fb32192fddab1b559c7b86303a2
13338 * src/sexp.c (do_vsexp_sscan): Replace BUG() by a proper error
13339 return. Replace sprintf by snprintf.
13340 (convert_to_hex): Replace sprintf by snprintf.
13341 (convert_to_string): Ditto.
13342 (_gcry_sexp_sprint): Ditto.
13343
13344 api: Add GCRYCTL_AUTO_EXPAND_SECMEM.
13345 + commit 1f6b2f6099ebcfd785e2d2ae0aeca810394dbbac
13346 * src/gcrypt.h.in (GCRYCTL_AUTO_EXPAND_SECMEM): New enum.
13347 * src/global.c (_gcry_vcontrol): Implement that.
13348 * src/secmem.c (auto_expand): New var.
13349 (_gcry_secmem_set_auto_expand): New.
13350 (_gcry_secmem_malloc_internal): Act upon AUTO_EXPAND.
13351
13352 2017-11-14 NIIBE Yutaka <[email protected]>
13353
13354 tests: Add HAVE_MMAP check for MinGW.
13355 + commit c594f187bd457b757112adc551ffa4db92962dc1
13356 * tests/t-secmem.c (main): Conditionalize with HAVE_MMAP.
13357
13358 2017-11-09 NIIBE Yutaka <[email protected]>
13359
13360 Fix secmem test for machine with larger page.
13361 + commit 621f5c4e837347308a6b06a8cfbfc47ca9fae69e
13362 * tests/t-secmem.c (main): Detect page size and setup chunk size.
13363 * src/secmem.c (init_pool): Simplify the expression.
13364
13365 2017-10-25 NIIBE Yutaka <[email protected]>
13366
13367 Add OID information for SM3.
13368 + commit 94b84360ca55c407222a3eb8222d8b1816fc617f
13369 * cipher/sm3.c (asn_sm3, oid_spec_sm3): New.
13370 (_gcry_digest_spec_sm3): Add asn_sm3, oid_spec_sm3.
13371
13372 2017-10-24 Jia Zhang <[email protected]>
13373
13374 Add crypto hash SM3.
13375 + commit 4423bf3cc4432b9bfe801ff74cb05e6f0dd3eccd
13376 * configure.ac (available_digests): Add sm3.
13377 * src/cipher.h: Add declarations for SM3.
13378 * cipher/Makefile.am (EXTRA_libcipher_la_SOURCES): Add sm3.c.
13379 * cipher/md.c [USE_SM3] (digest_list): Add _gcry_digest_spec_sm3.
13380 * cipher/pubkey-util.c (hashnames): Add "sm3".
13381 * cipher/sm3.c: New.
13382 * tests/basic.c (check_digests): Add test vectors for SM3.
13383 * tests/hashtest-256g.in (algos): Add SM3.
13384 * tests/hashtest.c (testvectors): Add for SM3.
13385
13386 2017-10-24 NIIBE Yutaka <[email protected]>
13387
13388 Add new constant GCRY_MD_SM3 for crypto hash SM3.
13389 + commit 5b31e22d9fc542bdccb1586ef2c83d9794a731d3
13390 * src/gcrypt.h.in (GCRY_MD_SM3): New.
13391
13392 2017-10-17 Werner Koch <[email protected]>
13393
13394 api: New function gcry_mpi_get_ui.
13395 + commit c6e42e7ec3d1046969d783c443c13aad7cb61bb8
13396 * src/gcrypt.h.in (gcry_mpi_get_ui): New.
13397 (mpi_get_ui): New macro.
13398 * src/libgcrypt.def, src/libgcrypt.vers: Add new function.
13399 * src/visibility.c (gcry_mpi_get_ui): New.
13400 * src/visibility.h: Mark that function.
13401 (gcry_mpi_get_ui): New.
13402 * mpi/mpiutil.c (MY_UINT_MAX): New macro.
13403 (_gcry_mpi_get_ui): Re-implemented. This function existed but was
13404 never imported or used.
13405 * tests/mpitests.c (test_maxsize): Add some test for this function.
13406
13407 2017-08-29 NIIBE Yutaka <[email protected]>
13408
13409 Tweak GCC version check.
13410 + commit e4dc458b0b7dc9b8417a2177ef17822d9b9064ec
13411 * src/global.c (_gcry_vcontrol): It's GCC 4.2 which started to support
13412 diagnostic pragma.
13413
13414 random: Fix warnings on Windows.
13415 + commit 8126a6717c80d4fc1766d7f975e872bee2f9f203
13416 * random/random-csprng.c (lock_seed_file): Vars with no use.
13417
13418 tests: Fix warnings on Windows.
13419 + commit a848ef44470a524c05624afb54b92cf25595acd2
13420 * tests/fipsdrv.c (print_dsa_domain_parameters, print_ecdsa_dq): Fix.
13421
13422 ecc: Fix scratch MPI.
13423 + commit db3a8d6890fb4a6436e082b49378c0bd891563ca
13424 * mpi/ec.c (ec_p_init): Check if scratch MPI is allocated.
13425
13426 ecc: Fix ec_mulm_25519.
13427 + commit 1d5f726668b9cc32d6bb601f2329987058146c6c
13428 * mpi/ec.c (ec_mulm_25519): Improve reduction to 25519.
13429
13430 ecc: Use 25519 method also for ed25519.
13431 + commit fab712d654b2ccd24696ed90bc239860a128ad5b
13432 * cipher/ecc-curves.c (_gcry_ecc_fill_in_curve): Don't use mpi_add
13433 since it resizes to have more limbs.
13434 * mpi/ec.c (point_resize): Fix for Edwards curve.
13435 (ec_p_init): Support Edwards curve.
13436 (_gcry_mpi_ec_get_affine): Use the methods.
13437 (dup_point_edwards, add_points_edwards, sub_points_edwards): Ditto.
13438 (_gcry_mpi_ec_mul_point): Resize MPIs of point to fixed size.
13439 (_gcry_mpi_ec_curve_point): Use the methods.
13440
13441 ecc: Clean up curve specific method support.
13442 + commit 1ac3d3637dd80013b78e03b9b9f582091710d908
13443 * src/ec-context.h (struct mpi_ec_ctx_s): Remove MOD method.
13444 * mpi/ec.c (ec_mod_25519): Remove.
13445 (ec_p_init): Follow the removal of the MOD method.
13446
13447 ecc: Relax condition for 25519 computations.
13448 + commit e9be23c4ad9f42c9d3198c706f912b7e27f574bc
13449 * mpi/ec.c (ec_addm_25519, ec_subm_25519, ec_mulm_25519): Check number
13450 of limbs, allocated more is OK.
13451
13452 ecc: Fix ec_mulm_25519.
13453 + commit 449459a2770d3aecb1f36502bf1903e0cbd2873e
13454 * mpi/ec.c (ec_mulm_25519): Fix the cases of 0 to 18.
13455
13456 ecc: field specific routines for 25519.
13457 + commit 9ed0fb37bd637d1a2e9498c24097cfeadec682ec
13458 * mpi/ec.c (point_resize): Improve for X25519.
13459 (mpih_set_cond): New.
13460 (ec_mod_25519, ec_addm_25519, ec_subm_25519, ec_mulm_25519)
13461 (ec_mul2_25519, ec_pow2_25519): New.
13462 (ec_p_init): Fill by FIELD_TABLE.
13463
13464 ecc: Add field specific computation methods.
13465 + commit d4cd381defe5b37dda19bbda0986bdd38065bd31
13466 * src/ec-context.h (struct mpi_ec_ctx_s): Add methods.
13467 * mpi/ec.c (ec_p_init): Initialize the default methods.
13468 (montgomery_ladder): Use the methods.
13469
13470 2017-08-27 Werner Koch <[email protected]>
13471
13472 Release 1.8.1.
13473 + commit 80fd8615048c3897b91a315cca22ab139b056ccd
13474 * configure.ac: Set LT version to C22/A2/R1.
13475
13476 2017-08-27 NIIBE Yutaka <[email protected]>
13477
13478 ecc: Add input validation for X25519.
13479 + commit bf76acbf0da6b0f245e491bec12c0f0a1b5be7c9
13480 * cipher/ecc.c (ecc_decrypt_raw): Add input validation.
13481 * mpi/ec.c (ec_p_init): Use scratch buffer for bad points.
13482 (_gcry_mpi_ec_bad_point): New.
13483
13484 2017-08-07 Marcus Brinkmann <[email protected]>
13485
13486 cipher: Add OID for SHA384WithECDSA.
13487 + commit a7bd2cbd3eabda88fb3cac5cbc13c21c97a7b315
13488 * cipher/sha512.c (oid_spec_sha384): Add SHA384WithECDSA.
13489
13490 2017-08-02 Werner Koch <[email protected]>
13491
13492 tests: Fix a printf glitch for a Windows test.
13493 + commit df1e221b3012e96bbffbc7d5fd70836a9ae1cc19
13494 * tests/t-convert.c (check_formats): Fix print format glitch on
13495 Windows.
13496 * tests/t-ed25519.c: Typo fix.
13497
13498 tests: Add benchmarking option to tests/random.
13499 + commit 21d0f068a721c022f955084c28304934fd198c5e
13500 * tests/random.c: Always include unistd.h.
13501 (prepend_srcdir): New.
13502 (run_benchmark): New.
13503 (main): Add options --benchmark and --with-seed-file. Print whetehr
13504 JENT has been used.
13505 * tests/t-common.h (split_fields_colon): New. Taken from GnuPG.
13506 License of that code changed to LGPLv2.1.
13507
13508 random: Add more bytes to the pool in addition to the seed file.
13509 + commit eea36574f37830a6a80b4fad884825e815b2912f
13510 * random/random-csprng.c (read_seed_file): Read 128 or 32 butes
13511 depending on whether we have the Jitter RNG.
13512
13513 2017-08-01 Jussi Kivilinna <[email protected]>
13514
13515 Add script to run basic tests with all supported HWF combinations.
13516 + commit 94a92a3db909aef0ebcc009c2d7f5a2663e99004
13517 * tests/basic_all_hwfeature_combinations.sh: New.
13518 * tests/Makefile.am: Add basic_all_hwfeature_combinations.sh.
13519
13520 2017-07-29 Jussi Kivilinna <[email protected]>
13521
13522 Fix return value type for _gcry_md_extract.
13523 + commit cf1528e7f2761774d06ace0de48f39c96b52dc4f
13524 * src/gcrypt-int.h (_gcry_md_extract): Use gpg_err_code_t instead of
13525 gpg_error_t for internal function return type.
13526
13527 Fix building AArch32 CE implementations when target is ARMv6 arch.
13528 + commit 4a7aa30ae9f3ce798dd886c2f2d4164c43027748
13529 * cipher/cipher-gcm-armv8-aarch32-ce.S: Select ARMv8 architecure.
13530 * cipher/rijndael-armv8-aarch32-ce.S: Ditto.
13531 * cipher/sha1-armv8-aarch32-ce.S: Ditto.
13532 * cipher/sha256-armv8-aarch32-ce.S: Ditto.
13533 * configure.ac (gcry_cv_gcc_inline_asm_aarch32_crypto): Ditto.
13534
13535 2017-07-25 NIIBE Yutaka <[email protected]>
13536
13537 sexp: Add fall through annotation.
13538 + commit b7cd44335d9cde43be6f693dca6399ed0762649c
13539 * src/dumpsexp.c (parse_and_print): It's fall through.
13540
13541 2017-07-24 Werner Koch <[email protected]>
13542
13543 random: Fix the command line munging for jitterbase.
13544 + commit ac39522ab08fcd2483edc223334c6ab9d19e91f3
13545 * random/Makefile.am (o_flag_munging): Make the first sed term also
13546 global.
13547
13548 2017-07-19 NIIBE Yutaka <[email protected]>
13549
13550 Remove byte order mark.
13551 + commit 1d8e4c2c3a7d0a4154caf5bd720a9a0b04179390
13552 * random/jitterentropy-base.c, random/jitterentropy.h: Remove
13553 byte order mark.
13554
13555 2017-07-18 Werner Koch <[email protected]>
13556
13557 Release 1.8.0.
13558 + commit 850aca744eeda5fd410f478a0778e353045ac962
13559
13560
13561 mac: Add selftests for HMAC-SHA3-xxx.
13562 + commit 95194c550443e8d5558856633f920daec8a975c4
13563 * cipher/hmac-tests.c (check_one): Add arg trunc and change all
13564 callers to pass false.
13565 (selftests_sha3): New.
13566 (run_selftests): Call new selftests.
13567
13568 api: New function gcry_mpi_point_copy.
13569 + commit ecf73dafb7aafed0d0f339d07235b58c2113f94c
13570 * src/gcrypt.h.in (gcry_mpi_point_copy): New.
13571 (mpi_point_copy): New macro.
13572 * src/visibility.c (gcry_mpi_point_copy): New.
13573 * src/libgcrypt.def, src/libgcrypt.vers: Add function.
13574 * mpi/ec.c (_gcry_mpi_point_copy): New.
13575 * tests/t-mpi-point.c (set_get_point): Add test.
13576
13577 2017-07-17 Werner Koch <[email protected]>
13578
13579 random: Minor fix for getting the rndjent version.
13580 + commit 9d99c6b973caa7fdf93b53cf764066214f763803
13581 * random/rndjent.c (_gcry_rndjent_get_version): Always set R_ACTIVE.
13582 * tests/version.c (test_get_config): Check number of fields for
13583 rng-type.
13584
13585 2017-07-07 NIIBE Yutaka <[email protected]>
13586
13587 mpi: Minor fix of mpi_pow.
13588 + commit 61b0f52c1cc85bf8c3cac9aba40e28682e4e1b8b
13589 * mpi/mpi-pow.c (_gcry_mpi_powm): Allocate size fix.
13590
13591 mpi: Fix mpi_pow alternative implementation.
13592 + commit 66ed4d53789892def7b237756d8a0ab28df9d222
13593 * mpi/mpi-pow.c
13594 [USE_ALGORITHM_SIMPLE_EXPONENTIATION] (_gcry_mpi_powm): Use
13595 mpi_set_cond.
13596
13597 Fix mpi_pow alternative implementation.
13598 + commit 619ebae9847831f43314a95cc3180f4b329b4d3b
13599 * mpi/mpi-pow.c [USE_ALGORITHM_SIMPLE_EXPONENTIATION] (_gcry_mpi_powm):
13600 Allocate size fix.
13601
13602 2017-07-06 Werner Koch <[email protected]>
13603
13604 rsa: Use modern MPI allocation function.
13605 + commit 208aba6f9a0475ba049f5a66fe02cf9a6214a887
13606 * cipher/rsa.c (secret_core_crt): Use modern function _gcry_mpi_snew.
13607
13608 2017-07-05 Werner Koch <[email protected]>
13609
13610 build: Minor API fixes to fix build problems on AIX.
13611 + commit 85a9a913da9ecc6b2cd6f743e90e49983251d706
13612 * src/gcrypt.h.in (gcry_error_from_errno): Fix return type.
13613 * src/visibility.c (gcry_md_extract): Change return type to match the
13614 prototype.
13615
13616 tools: Add left shift to mpicalc.
13617 + commit 0d30a4a9791d20c8881b5b12bd44611d9f4274cd
13618 * src/mpicalc.c (do_lshift): New.
13619 (main): Handle '<'.
13620
13621 2017-07-04 NIIBE Yutaka <[email protected]>
13622
13623 mpi: Fix mpi_set_secure.
13624 + commit 5feaf1cc8f22c1f8d19a34850d86fe190f1432e2
13625 * mpi/mpiutil.c (mpi_set_secure): Allocate by ->alloced.
13626
13627 2017-06-29 NIIBE Yutaka <[email protected]>
13628 Werner Koch <[email protected]>
13629
13630 rsa: Add exponent blinding.
13631 + commit 8725c99ffa41778f382ca97233183bcd687bb0ce
13632 * cipher/rsa.c (secret_core_crt): Blind secret D with randomized
13633 nonce R for mpi_powm computation.
13634
13635 2017-06-28 NIIBE Yutaka <[email protected]>
13636
13637 Same computation for square and multiply.
13638 + commit 78130828e9a140a9de4dafadbc844dbb64cb709a
13639 * mpi/mpi-pow.c (_gcry_mpi_powm): Compare msize for max_u_size. Move
13640 the assignment to base_u into the loop. Copy content refered by RP to
13641 BASE_U except the last of the loop.
13642
13643 2017-06-24 Werner Koch <[email protected]>
13644
13645 rsa: Minor refactoring.
13646 + commit e6a3dc9900433bbc8ad362a595a3837318c28fa9
13647 * cipher/rsa.c (secret): Factor code out to ...
13648 (secret_core_std, secret_core_crt): new functions.
13649
13650 2017-06-23 Werner Koch <[email protected]>
13651
13652 random: Add missing dependency.
13653 + commit d091610377b2c92cf385282b1adfc30fa6cd5c75
13654 * random/Makefile.am (EXTRA_librandom_la_SOURCES): Fix file name.
13655 (rndjent.o, rndjent.lo): Depend on jitterentropy-base-user.h.
13656
13657 random: Update jitterentropy to 2.1.0.
13658 + commit 8dfae89ecd3e9ae0967586cb38d12ef9111fc7cd
13659 * random/rndjent.c (jent_get_nstime, jent_zfree)
13660 (jent_fips_enabled, jent_zalloc): Move functions and macros to ...
13661 * random/jitterentropy-base-user.h: this file. That files was not
13662 used before.
13663 * random/Makefile.am (EXTRA_librandom_la_SOURCES): Add
13664 jitterentropy-base-user.
13665 * random/jitterentropy-base.c: Update to version 2.1.0.
13666 * random/jitterentropy.h: Ditto.
13667
13668 2017-06-21 Werner Koch <[email protected]>
13669
13670 api: New function gcry_get_config.
13671 + commit 27148e60ba15b0cb73b47a75c688fcb48a1a3444
13672 * src/misc.c (_gcry_log_info_with_dummy_fp): Remove.
13673 * src/global.c (print_config): New arg WHAT. Remove arg FNC and use
13674 gpgrt_fprintf directly.
13675 (_gcry_get_config): New.
13676 (_gcry_vcontrol) <GCRYCTL_PRINT_CONFIG>: Use _gcry_get_config instead
13677 of print_config.
13678 * src/gcrypt.h.in (gcry_get_config): New.
13679 * src/libgcrypt.def, src/libgcrypt.vers: Add new function.
13680 * src/visibility.c (gcry_get_config): New.
13681 * src/visibility.h: Mark new function.
13682
13683 * tests/version.c (test_get_config): New.
13684 (main): Call new test.
13685
13686 random: Allow building rndjent on non-x86.
13687 + commit c2319464b03e61aaf34ef6d5f4b59b0c0483a373
13688 * random/jitterentropy-base.c (jent_version): Uncomment function.
13689 * random/rndjent.c: Include time.h
13690 (JENT_USES_RDTSC): New.
13691 (JENT_USES_GETTIME): New.
13692 (JENT_USES_READ_REAL_TIME): New.
13693 (jent_get_nstime): Support clock_gettime and AIX specific
13694 function. Taken from Stephan Müller's code.
13695 (is_rng_available): New.
13696 (_gcry_rndjent_dump_stats): Use that function.
13697 (_gcry_rndjent_poll): Use that fucntion. Allow an ADD of NULL for an
13698 intialize only mode.
13699 (_gcry_rndjent_get_version): New.
13700
13701 2017-06-18 Jussi Kivilinna <[email protected]>
13702
13703 rijndael-padlock: change asm operands from read-only to read/write.
13704 + commit 32b4ab209067f6f08b87b27bc78ec27dc497b708
13705 * cipher/rijndael-padlock.c (do_padlock): Change ESI/EDI/ECX to use
13706 read/write operands as XCRYPT instruction modifies these registers.
13707
13708 2017-06-16 Werner Koch <[email protected]>
13709
13710 random: Make rndjent.c NTG.1 compliant.
13711 + commit 82bc052eda5b3897724c7ad11e54f8203e8e88e9
13712 * random/rndjent.c (_gcry_rndjent_poll): Hash the retrieved jitter.
13713
13714 md: Optimize gcry_md_hash_buffers for SHA-256 and SHA-512.
13715 + commit e6f90a392a1fd59b19b16f7a2bc7c439ae369d5f
13716 * cipher/sha256.c (_gcry_sha256_hash_buffer): New.
13717 (_gcry_sha256_hash_buffers): New.
13718 * cipher/sha512.c (_gcry_sha512_hash_buffer): New.
13719 (_gcry_sha512_hash_buffers): New.
13720 * cipher/md.c (_gcry_md_hash_buffer): Optimize for SHA246 and SHA512.
13721 (_gcry_md_hash_buffers): Ditto.
13722
13723 random: Allow building rndjent.c with stats collecting enabled.
13724 + commit ee3a74f5539cbc5182ce089994e37c16ce612149
13725 * random/rndjent.c: Change license to the one used by jitterentropy.h.
13726 (jent_init_statistic): New.
13727 (jent_bit_count): New.
13728 (jent_statistic_copy_stat): new.
13729 (jent_calc_statistic): New.
13730
13731 New global config option "only-urandom".
13732 + commit 8f6082e95f30c1ba68d2de23da90146f87f0c66c
13733 * random/rand-internal.h (RANDOM_CONF_ONLY_URANDOM): New.
13734 * random/random.c (_gcry_random_read_conf): Add option "only-urandom".
13735 * random/rndlinux.c (_gcry_rndlinux_gather_random): Implement that
13736 option.
13737 * tests/keygen.c (main): Add option --no-quick for better manual
13738 tests.
13739
13740 Implement global config file /etc/gcrypt/random.conf.
13741 + commit b05a4abc358b204dba343d9cfbd59fdc828c1686
13742 * src/hwfeatures.c (my_isascii): Move macro to ...
13743 * src/g10lib.h: here.
13744 * tests/random.c (main): Dump random stats.
13745 * random/random.c (RANDOM_CONF_FILE): New.
13746 (_gcry_random_read_conf): New.
13747 (_gcry_random_dump_stats): Call rndjent stats.
13748 * random/rndjent.c (jent_rng_totalcalls, jent_rng_totalbytes): New.
13749 (_gcry_rndjent_poll): Take care of config option disable-jent. Wipe
13750 buffer. Bump counters.
13751 (_gcry_rndjent_dump_stats): New.
13752
13753 2017-06-14 Werner Koch <[email protected]>
13754
13755 random: Add jitter RND based entropy collector.
13756 + commit f5e7763ddca59dcd9ac9f2f4d50cb41b14a34a9e
13757 * random/rndjent.c: New.
13758 * random/rndlinux.c (_gcry_rndlinux_gather_random): Use rndjent.
13759 * random/rndw32.c (_gcry_rndw32_gather_random): Use rndjent.
13760 (slow_gatherer): Fix compiler warning.
13761 * random/Makefile.am (librandom_la_SOURCES): Add rndjent.c
13762 (EXTRA_librandom_la_SOURCES): Add jitterentropy-base.c and
13763 jitterentropy.h.
13764 (rndjent.o, rndjent.lo): New rules.
13765 * configure.ac: New option --disbale-jent-support
13766 (ENABLE_JENT_SUPPORT): New ac-define.
13767
13768 cipher: New helper function rol64.
13769 + commit 6c882fb1fdb6c7cba2215fa7391110d63e24b9dc
13770 * cipher/bithelp.h (rol64): New inline functions.
13771
13772 New hardware feature flag HWF_INTEL_RDTSC.
13773 + commit 06f303a633ea2b992259688bef2b023c3f388f73
13774 * src/g10lib.h (HWF_INTEL_RDTSC): New.
13775 * src/hwfeatures.c (hwflist): Add "intel-rdtsc".
13776 * src/hwf-x86.c (detect_x86_gnuc): Get EDX features and test for TSC.
13777
13778 random: Changes to original Jitter RNG implementation.
13779 + commit a44c45675f8b631e11048a540bb1fbb7a022ebb4
13780 * random/jitterentropy-base.c: Change double underscore symbols and
13781 make all functions static.
13782 * random/jitterentropy.h: Likewise.
13783
13784 2017-06-13 Stephan Mueller <[email protected]>
13785
13786 random: Add original Jitter RNG implementation.
13787 + commit f0ae18ecf48fbe2da0b9fb3f354d0dd3173d91d3
13788 * random/jitterentropy-base-user.h: New.
13789 * random/jitterentropy-base.c: New.
13790 * random/jitterentropy.h: New.
13791
13792 2017-06-08 Werner Koch <[email protected]>
13793
13794 build: Fix ChangeLog building for builds from other worktrees.
13795 + commit cdfd7ea72a44657f037dd0dbba6e5ea0c2b344aa
13796 * Makefile.am (gen-ChangeLog): Test for existance of ".git" regardless
13797 on whether it is a file or directory.
13798
13799 2017-06-02 NIIBE Yutaka <[email protected]>
13800
13801 secmem: Fix SEGV and stat calculation.
13802 + commit e0958debe1a7db1bec1283115cdc6a14bf3b43e5
13803 * src/secmem (init_pool): Care about the header size.
13804 (_gcry_secmem_malloc_internal): Likewise.
13805 (_gcry_secmem_malloc_internal): Use mb->size for stats.
13806
13807 2017-06-01 Jo Van Bulck <[email protected]>
13808
13809 ecc: Store EdDSA session key in secure memory.
13810 + commit 5a22de904a0a366ae79f03ff1e13a1232a89e26b
13811 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_sign): use mpi_snew to allocate
13812 session key.
13813
13814 2017-05-31 Werner Koch <[email protected]>
13815
13816 api: Deprecate gcry_md_info.
13817 + commit 45c39340c9926c2c5801dbab7609687c41e9ff1f
13818
13819
13820 2017-05-30 Werner Koch <[email protected]>
13821
13822 mpi: Distribute asm files for aarch64 and asm.
13823 + commit c65f9558f12ffa2810538ef616e71b4052dacb81
13824 * mpi/aarch64/distfiles: New.
13825 * mpi/arm/distfiles: New.
13826
13827 mpi: Distribute asm definitions for amd64.
13828 + commit 87e481137debabb7f989d7fa9b1c21c336e10c98
13829 * mpi/amd64/distfiles: Add mpi-asm-defs.h.
13830
13831 2017-05-23 Werner Koch <[email protected]>
13832
13833 cipher: Fix compiler warnings.
13834 + commit d764c9894013727ff82eb194da6030209c273528
13835 * cipher/poly1305.c (poly1305_default_ops): Move to the top. Add
13836 prototypes and compile only if USE_SSE2 is not defined.
13837 (poly1305_init_ext_ref32): Compile only if USE_SSE2 is not defined.
13838 (poly1305_blocks_ref32): Ditto.
13839 (poly1305_finish_ext_ref32): Ditto.
13840
13841 doc: Comment fixes.
13842 + commit c1bb3d9fdb6fe5f336af1d5a03fc42bfdc1f8b0b
13843
13844
13845 2017-05-18 Jussi Kivilinna <[email protected]>
13846
13847 rijndael-ssse3: fix functions calls from assembly blocks.
13848 + commit 4cd94994a9abec9b92fa5972869baf089a28fa76
13849 * cipher/rijndael-ssse3-amd64.c (PUSH_STACK_PTR, POP_STACK_PTR): New.
13850 (vpaes_ssse3_prepare_enc, vpaes_ssse3_prepare_dec)
13851 (_gcry_aes_ssse3_do_setkey, _gcry_aes_ssse3_prepare_decryption)
13852 (do_vpaes_ssse3_enc, do_vpaes_ssse3_dec): Use PUSH_STACK_PTR and
13853 POP_STACK_PTR.
13854
13855 chacha20-armv7-neon: fix to use fast code path when memory is aligned.
13856 + commit 68861ae5d3e007d7a39f14ea27dc3dd8ef13ba02
13857 * cipher/chacha20-armv7-neon.S (UNALIGNED_LDMIA4): Uncomment
13858 instruction for jump to aligned code path.
13859
13860 Move data in AMD64 assembly to text section.
13861 + commit 1a094bc5b2aa730833faf593a931d4e5d7f9ab4d
13862 * cipher/camellia-aesni-avx-amd64.S: Move data to .text section to
13863 ensure that RIP relative addressing of data will work.
13864 * cipher/camellia-aesni-avx2-amd64.S: Ditto.
13865 * cipher/chacha20-avx2-amd64.S: Ditto.
13866 * cipher/chacha20-ssse3-amd64.S: Ditto.
13867 * cipher/des-amd64.S: Ditto.
13868 * cipher/serpent-avx2-amd64.S: Ditto.
13869 * cipher/sha1-avx-amd64.S: Ditto.
13870 * cipher/sha1-avx-bmi2-amd64.S: Ditto.
13871 * cipher/sha1-ssse3-amd64.S: Ditto.
13872 * cipher/sha256-avx-amd64.S: Ditto.
13873 * cipher/sha256-avx2-bmi2-amd64.S: Ditto.
13874 * cipher/sha256-ssse3-amd64.S: Ditto.
13875 * cipher/sha512-avx-amd64.S: Ditto.
13876 * cipher/sha512-avx2-bmi2-amd64.S: Ditto.
13877 * cipher/sha512-ssse3-amd64.S: Ditto.
13878
13879 cast5-amd64: use 64-bit relocation with large PIC memory model.
13880 + commit ff02fca39c83bcf30c79368611ac65e273e77f6c
13881 * cipher/cast5-amd64.S [__code_model_large__]
13882 (GET_EXTERN_POINTER): New.
13883
13884 2017-05-13 Jussi Kivilinna <[email protected]>
13885
13886 Fix building with x86-64 medium and large memory models.
13887 + commit 434d4f2af39033fc626044ba9a060da298522293
13888 * cipher/cast5-amd64.S [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS]
13889 (GET_EXTERN_POINTER): Load 64-bit address instead of 32-bit.
13890 * cipher/rijndael.c (do_encrypt, do_decrypt)
13891 [USE_AMD64_ASM && !HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS]: Load
13892 table pointer through register instead of generic reference.
13893
13894 2017-04-04 NIIBE Yutaka <[email protected]>
13895
13896 mpi: Simplify mpi_powm.
13897 + commit 719468e53133d3bdf12156c5bfdea2bf15f9f6f1
13898 * mpi/mpi-pow.c (_gcry_mpi_powm): Simplify the loop.
13899
13900 2017-03-08 Justus Winter <[email protected]>
13901
13902 build: Use macOS' compatibility macros to enable all features.
13903 + commit 654024081cfa103c87bb163b117ea3568171d408
13904 * configure.ac: On macOS, use the compatibility macros to expose every
13905 feature of the libc. This is the equivalent of _GNU_SOURCE on GNU
13906 libc.
13907
13908 2017-02-27 Jussi Kivilinna <[email protected]>
13909
13910 Add BLAKE2b and BLAKE2s hash algorithms (RFC 7693)
13911 + commit 5bd530b8a4624f101b8d42e68f1b28bcc13f4f76
13912 * cipher/blake2.c: New.
13913 * cipher/Makefile.am: Add 'blake2.c'.
13914 * cipher/md.c (digest_list, prepare_macpads): Add BLAKE2.
13915 (md_setkey): New.
13916 (_gcry_md_setkey): Call 'md_setkey' for non-HMAC md.
13917 * configure.ac: Add BLAKE2 digest.
13918 * doc/gcrypt.texi: Add BLAKE2.
13919 * src/cipher.h (_gcry_blake2_init_with_key)
13920 (_gcry_digest_spec_blake2b_512, _gcry_digest_spec_blake2b_384)
13921 (_gcry_digest_spec_blake2b_256, _gcry_digest_spec_blake2b_160)
13922 (_gcry_digest_spec_blake2s_256, _gcry_digest_spec_blake2s_224)
13923 (_gcry_digest_spec_blake2s_160, _gcry_digest_spec_blake2s_128): New.
13924 * src/gcrypt.h.in (GCRY_MD_BLAKE2B_512, GCRY_MD_BLAKE2B_384)
13925 (GCRY_MD_BLAKE2B_256, GCRY_MD_BLAKE2B_160, GCRY_MD_BLAKE2S_256)
13926 (GCRY_MD_BLAKE2S_224, GCRY_MD_BLAKE2S_160, GCRY_MD_BLAKE2S_128): New.
13927 * tests/basic.c (check_one_md): Add testing for keyed hashes.
13928 (check_digests): Add BLAKE2 test vectors; Add testing for keyed hashes.
13929 * tests/blake2b.h: New.
13930 * tests/blake2s.h: New.
13931 * tests/Makefile.am: Add 'blake2b.h' and 'blake2s.h'.
13932
13933 Fix building with clang on ARM64/FreeBSD.
13934 + commit da213db2c6cda6f57e5853e8c591d69bfa1cfa74
13935 * cipher/cipher-gcm-armv8-aarch64-ce.S: Use '.cpu generic+simd+crypto'
13936 instead of '.arch armv8-a+crypto'.
13937 * cipher/rijndael-armv8-aarch64-ce.S: Ditto.
13938 * cipher/sha1-armv8-aarch64-ce.S: Ditto.
13939 * cipher/sha256-armv8-aarch64-ce.S: Ditto.
13940 * configure.ac (gcry_cv_gcc_inline_asm_aarch64_neon): Ditto.
13941 (gcry_cv_gcc_inline_asm_aarch64_crypto): Ditto; and include NEON
13942 instructions to crypto instructions check.
13943
13944 2017-02-07 Justus Winter <[email protected]>
13945
13946 Fix building with a pre C99 compiler.
13947 + commit 75d91ffeaf83098ade325bb3b6b2c8a76eb1f6a6
13948 * cipher/cipher-cfb.c (_gcry_cipher_cfb8_encrypt): Move the
13949 declaration of 'i' out of the loop.
13950 (_gcry_cipher_cfb8_decrypt): Likewise.
13951
13952 2017-02-04 Mathias L. Baumann <mathias.baumann_at_sociomantic.com>
13953
13954 Implement CFB with 8-bit mode.
13955 + commit d1ee9a660571ce4a998c9ab2299d4f2419f99127
13956 * cipher/cipher-cfb.c (_gcry_cipher_cfb8_encrypt)
13957 (_gcry_cipher_cfg8_decrypt): Add 8-bit variants of decrypt/encrypt
13958 functions.
13959 * cipher/cipher-internal.h (_gcry_cipher_cfb8_encrypt)
13960 (_gcry_cipher_cfg8_decrypt): Ditto.
13961 * cipher/cipher.c: Adjust code flow to work with GCRY_CIPHER_MODE_CFB8.
13962 * tests/basic.c: Add tests for cfb8 with AES and 3DES.
13963
13964 2017-02-04 Jussi Kivilinna <[email protected]>
13965
13966 rndhw: add missing "memory" clobbers.
13967 + commit c67c728478e8f47b6e8296b643fd35d66d4a1052
13968 * random/rndhw.c: (poll_padlock, rdrand_long): Add "memory" to asm
13969 clobbers.
13970
13971 Add UNLIKELY and LIKELY macros.
13972 + commit 4b7451d3e8e7b87d8e407fbbd924ad5b13bd0f00
13973 * src/g10lib.h (LIKELY, UNLIKELY): New.
13974 (gcry_assert): Use LIKELY for assert check.
13975 (fast_wipememory2_unaligned_head): Use UNLIKELY for unaligned
13976 branching.
13977 * cipher/bufhelp.h (buf_cpy, buf_xor, buf_xor_1, buf_xor_2dst)
13978 (buf_xor_n_copy_2): Ditto.
13979
13980 rndhw: avoid type-punching.
13981 + commit 37b537600f33fcf8e1c8dc2c658a142fbba44199
13982 * random/rndhw.c (rdrand_long, rdrand_nlong): Add 'volatile' for
13983 pointer.
13984 (poll_drng): Convert buffer to 'unsigned long[]' and make use of DIM
13985 macro.
13986
13987 2017-01-28 Jussi Kivilinna <[email protected]>
13988
13989 hwf-x86: avoid type-punching.
13990 + commit 1407317a6112a23d4fec5827a9d74faef4196f66
13991 * src/hwf-x86.c (detect_x86_gnuc): Use union for vendor_id.
13992
13993 cipher: add explicit blocksize checks to allow better optimization.
13994 + commit efa9042f82ffed3d076b8e26ac62d29e00bb756a
13995 * cipher/cipher-cbc.c (_gcry_cipher_cbc_encrypt)
13996 (_gcry_cipher_cbc_decrypt): Add explicit check for cipher blocksize of
13997 64-bit or 128-bit.
13998 * cipher/cipher-cfb.c (_gcry_cipher_cfb_encrypt)
13999 (_gcry_cipher_cfb_decrypt): Ditto.
14000 * cipher/cipher-cmac.c (cmac_write, cmac_generate_subkeys)
14001 (cmac_final): Ditto.
14002 * cipher/cipher-ctr.c (_gcry_cipher_ctr_encrypt): Ditto.
14003 * cipher/cipher-ofb.c (_gcry_cipher_ofb_encrypt): Ditto.
14004
14005 bufhelp: use unaligned dword and qword types for endianess helpers.
14006 + commit e7b941c3de9c9b6319298c02f844cc0cadbf8562
14007 * cipher/bufhelp.h (BUFHELP_UNALIGNED_ACCESS): New, defined
14008 if attributes 'packed', 'aligned' and 'may_alias' are supported.
14009 (BUFHELP_FAST_UNALIGNED_ACCESS): Define if have
14010 BUFHELP_UNALIGNED_ACCESS.
14011
14012 rijndael-aesni: fix u128_t strict-aliasing rule breaking.
14013 + commit 92b4a29d2453712192ced2d7226abc49679dcb1e
14014 * cipher/rijndael-aesni.c (u128_t): Add attributes to tell GCC and clang
14015 that casting from 'char *' to 'u128_t *' is ok.
14016
14017 cipher-xts: fix pointer casting to wrong alignment and aliasing.
14018 + commit 4f31d816dcc1e95dc647651e92acbdfed53f5c14
14019 * cipher/cipher-xts.c (xts_gfmul_byA, xts_inc128): Use buf_get_le64
14020 and buf_put_le64 for accessing data; Change parameter pointers to
14021 'unsigned char *' type.
14022 (_gcry_cipher_xts_crypt): Do not cast buffer pointers to 'u64 *'
14023 for helper functions.
14024
14025 crc-intel-pclmul: fix undefined behavior with unaligned access.
14026 + commit 55cf1b5588705cab5f45e2817c4aa1d204dc0042
14027 * cipher/crc-intel-pclmul.c (u16_unaligned_s): New.
14028 (crc32_reflected_less_than_16, crc32_less_than_16): Use
14029 'u16_unaligned_s' for unaligned memory access.
14030
14031 configure.ac: fix attribute checks.
14032 + commit b29b1b9f576f501d4b993be0a751567045274a1a
14033 * configure.ac: Add -Werror flag for attribute checks.
14034
14035 configure.ac: fix may_alias attribute check.
14036 + commit 136c8416ea540dd126be3997d94d7063b3aaf577
14037 * configure.ac: Test may_alias attribute on type, not on variable.
14038
14039 bufhelp: add 'may_alias' attribute for properly aligned 'bufhelp_int_t'
14040 + commit d1ae52a0e23308f33b78cffeba56005b687f23c0
14041 * cipher/bufhelp.h [!BUFHELP_FAST_UNALIGNED_ACCESS]
14042 (bufhelp_int_t): Add 'may_alias' attribute.
14043
14044 2017-01-27 Werner Koch <[email protected]>
14045
14046 w32: New envvar GCRYPT_RNDW32_DBG.
14047 + commit a351fbde8548ce3f57298c618426f043844fbc78
14048 * random/rndw32.c (_gcry_rndw32_gather_random): Use getenv to set
14049 DEBUG_ME.
14050
14051 2017-01-23 Jussi Kivilinna <[email protected]>
14052
14053 rijndael-ssse3-amd64: fix building on x32.
14054 + commit 39b9302da5d08bd52688d20befe626fee0b6c41d
14055 * cipher/rijndael-ssse3-amd64.c: Use 64-bit call instructions
14056 with 64-bit registers.
14057
14058 bufhelp: use 'may_alias' attribute unaligned pointer types.
14059 + commit bf9e0b79e620ca2324224893b07522462b125412
14060 * configure.ac (gcry_cv_gcc_attribute_may_alias)
14061 (HAVE_GCC_ATTRIBUTE_MAY_ALIAS): New check for 'may_alias' attribute.
14062 * cipher/bufhelp.h (BUFHELP_FAST_UNALIGNED_ACCESS): Enable only if
14063 HAVE_GCC_ATTRIBUTE_MAY_ALIAS is defined.
14064 [BUFHELP_FAST_UNALIGNED_ACCESS] (bufhelp_int_t, bufhelp_u32_t)
14065 (bufhelp_u64_t): Add 'may_alias' attribute.
14066 * src/g10lib.h (fast_wipememory_t): Add HAVE_GCC_ATTRIBUTE_MAY_ALIAS
14067 defined check; Add 'may_alias' attribute.
14068
14069 2017-01-18 Werner Koch <[email protected]>
14070
14071 random: Call getrandom before select and emitting a progress callback.
14072 + commit 623aab8a940ea61afe3fef650ad485a755ed9fe7
14073 * random/rndlinux.c (_gcry_rndlinux_gather_random): Move the getrandom
14074 call before the select.
14075
14076 2017-01-06 Jussi Kivilinna <[email protected]>
14077
14078 mpi: amd64: fix too large jump alignment in mpih-rshift.
14079 + commit ddcfe31e2425e88b280e7cdaf3f0eaaad8ccc023
14080 * mpi/amd64/mpih-rshift.S (_gcry_mpih_rshift): Use 16-byte alignment
14081 with 'ALIGN(4)' instead of 256-byte.
14082
14083 rijndael-ssse3: move assembly functions to separate source-file.
14084 + commit 54c57bc49edb5c00e9ed8103cc4837bb72c5e863
14085 * cipher/Makefile.am: Add 'rinjdael-ssse3-amd64-asm.S'.
14086 * cipher/rinjdael-ssse3-amd64-asm.S: Moved assembly functions
14087 here ...
14088 * cipher/rinjdael-ssse3-amd64.c: ... from this file.
14089 (_gcry_aes_ssse3_enc_preload, _gcry_aes_ssse3_dec_preload)
14090 (_gcry_aes_ssse3_shedule_core, _gcry_aes_ssse3_encrypt_core)
14091 (_gcry_aes_ssse3_decrypt_core): New.
14092 (vpaes_ssse3_prepare_enc, vpaes_ssse3_prepare_dec)
14093 (_gcry_aes_ssse3_do_setkey, _gcry_aes_ssse3_prepare_decryption)
14094 (do_vpaes_ssse3_enc, do_vpaes_ssse3_dec): Update to use external
14095 assembly functions; remove 'aes_const_ptr' variable usage.
14096 (_gcry_aes_ssse3_encrypt, _gcry_aes_ssse3_decrypt)
14097 (_gcry_aes_ssse3_cfb_enc, _gcry_aes_ssse3_cbc_enc)
14098 (_gcry_aes_ssse3_ctr_enc, _gcry_aes_ssse3_cfb_dec)
14099 (_gcry_aes_ssse3_cbc_dec, ssse3_ocb_enc, ssse3_ocb_dec)
14100 (_gcry_aes_ssse3_ocb_auth): Remove 'aes_const_ptr' variable usage.
14101 * configure.ac: Add 'rinjdael-ssse3-amd64-asm.lo'.
14102
14103 Add AVX2/vpgather bulk implementation of Twofish.
14104 + commit c59a8ce51ceb9a80169c44ef86a67e95cf8528c3
14105 * cipher/Makefile.am: Add 'twofish-avx2-amd64.S'.
14106 * cipher/twofish-avx2-amd64.S: New.
14107 * cipher/twofish.c (USE_AVX2): New.
14108 (TWOFISH_context) [USE_AVX2]: Add 'use_avx2' member.
14109 (ASM_FUNC_ABI): New.
14110 (twofish_setkey): Add check for AVX2 and fast VPGATHER HW features.
14111 (_gcry_twofish_avx2_ctr_enc, _gcry_twofish_avx2_cbc_dec)
14112 (_gcry_twofish_avx2_cfb_dec, _gcry_twofish_avx2_ocb_enc)
14113 (_gcry_twofish_avx2_ocb_dec, _gcry_twofish_avx2_ocb_auth): New.
14114 (_gcry_twofish_ctr_enc, _gcry_twofish_cbc_dec, _gcry_twofish_cfb_dec)
14115 (_gcry_twofish_ocb_crypt, _gcry_twofish_ocb_auth): Add AVX2 bulk
14116 handling.
14117 (selftest_ctr, selftest_cbc, selftest_cfb): Increase nblocks from
14118 3+X to 16+X.
14119 * configure.ac: Add 'twofish-avx2-amd64.lo'.
14120 * src/g10lib.h (HWF_INTEL_FAST_VPGATHER): New.
14121 * src/hwf-x86.c (detect_x86_gnuc): Add detection for
14122 HWF_INTEL_FAST_VPGATHER.
14123 * src/hwfeatures.c (HWF_INTEL_FAST_VPGATHER): Add
14124 "intel-fast-vpgather" for HWF_INTEL_FAST_VPGATHER.
14125
14126 Add XTS cipher mode.
14127 + commit 232a129b1f915fc54881506e4b07c89cf84932e6
14128 * cipher/Makefile.am: Add 'cipher-xts.c'.
14129 * cipher/cipher-internal.h (gcry_cipher_handle): Add 'bulk.xts_crypt'
14130 and 'u_mode.xts' members.
14131 (_gcry_cipher_xts_crypt): New prototype.
14132 * cipher/cipher-xts.c: New.
14133 * cipher/cipher.c (_gcry_cipher_open_internal, cipher_setkey)
14134 (cipher_reset, cipher_encrypt, cipher_decrypt): Add XTS mode handling.
14135 * doc/gcrypt.texi: Add XTS mode to documentation.
14136 * src/gcrypt.h.in (GCRY_CIPHER_MODE_XTS, GCRY_XTS_BLOCK_LEN): New.
14137 * tests/basic.c (do_check_xts_cipher, check_xts_cipher): New.
14138 (check_bulk_cipher_modes): Add XTS test-vectors.
14139 (check_one_cipher_core, check_one_cipher, check_ciphers): Add XTS
14140 testing support.
14141 (check_cipher_modes): Add XTS test.
14142 * tests/bench-slope.c (bench_xts_encrypt_init)
14143 (bench_xts_encrypt_do_bench, bench_xts_decrypt_do_bench)
14144 (xts_encrypt_ops, xts_decrypt_ops): New.
14145 (cipher_modes, cipher_bench_one): Add XTS.
14146 * tests/benchmark.c (cipher_bench): Add XTS testing.
14147
14148 2017-01-04 Jussi Kivilinna <[email protected]>
14149
14150 rijndael-ssse3: fix counter operand from read-only to read/write.
14151 + commit aada604594fd42224d366d3cb98f67fd3b989cd6
14152 * cipher/rijndael-ssse3-amd64.c (_gcry_aes_ssse3_ctr_enc): Change
14153 'ctrlow' operand from read-only to read-write.
14154
14155 2017-01-03 Werner Koch <[email protected]>
14156
14157 Extend GCRYCTL_PRINT_CONFIG to print compiler version.
14158 + commit 98b49695b1ffe3c406ae39a45051b8594f903b9d
14159 * src/global.c (print_config): Print version of libgpg-error and used
14160 compiler.
14161
14162 tests: Add option --disable-hwf to the version utility.
14163 + commit 3582641469f1c74078f0d758c4d5458cc0ee5649
14164 * src/hwfeatures.c (_gcry_disable_hw_feature): Rewrite to allow
14165 passing a colon delimited feature set.
14166 (parse_hwf_deny_file): Remove unused var I.
14167 * tests/version.c (main): Add options --verbose and --disable-hwf.
14168
14169 2016-12-15 Werner Koch <[email protected]>
14170 Nicolas Porcel <[email protected]>
14171
14172 Fix regression in broken mlock detection.
14173 + commit 0a90f87799903a3fb97189ef7cba19e7b3534e1c
14174 * acinclude.m4 (GNUPG_CHECK_MLOCK): Fix typo EGAIN->EAGAIN.
14175
14176 2016-12-10 Jussi Kivilinna <[email protected]>
14177
14178 hwfeatures: add 'all' for disabling all hardware features.
14179 + commit c83d0d2a26059cf471d09f5cb8e7fc5d76c4907b
14180 * .gitignore: Add 'tests/basic-disable-all-hwf'.
14181 * configure.ac: Ditto.
14182 * tests/Makefile.am: Ditto.
14183 * src/hwfeatures.c (_gcry_disable_hw_feature): Match 'all' for
14184 masking all HW features off.
14185 (parse_hwf_deny_file): Use '_gcry_disable_hw_feature' for matching.
14186 * tests/basic-disable-all-hwf.in: New.
14187
14188 tests/hashtest-256g: add missing executable extension for Win32.
14189 + commit 2b7b227b8a0bd5ff286258bc187782efac180a7e
14190 * tests/hashtest-256g.in: Add @EXEEXT@.
14191
14192 OCB ARM CE: Move ocb_get_l handling to assembly part.
14193 + commit 5c418e597f0f20a546d953161695e6caf1f57689
14194 * cipher/rijndael-armv8-aarch32-ce.S: Add OCB 'L_{ntz(i)}' calculation.
14195 * cipher/rijndael-armv8-aarch64-ce.S: Ditto.
14196 * cipher/rijndael-armv8-ce.c (_gcry_aes_ocb_enc_armv8_ce)
14197 (_gcry_aes_ocb_dec_armv8_ce, _gcry_aes_ocb_auth_armv8_ce)
14198 (ocb_cryt_fn_t): Updated arguments.
14199 (_gcry_aes_armv8_ce_ocb_crypt, _gcry_aes_armv8_ce_ocb_auth): Remove
14200 'ocb_get_l' handling and splitting input to 32 block chunks, instead
14201 pass full buffers to assembly.
14202
14203 OCB: Move large L handling from bottom to upper level.
14204 + commit 2d2e5286d53e1f62fe040dff4c6e01961f00afe2
14205 * cipher/cipher-ocb.c (_gcry_cipher_ocb_get_l): Remove.
14206 (ocb_get_L_big): New.
14207 (_gcry_cipher_ocb_authenticate): L-big handling done in upper
14208 processing loop, so that lower level never sees the case where
14209 'aad_nblocks % 65536 == 0'; Add missing stack burn.
14210 (ocb_aad_finalize): Add missing stack burn.
14211 (ocb_crypt): L-big handling done in upper processing loop, so that
14212 lower level never sees the case where 'data_nblocks % 65536 == 0'.
14213 * cipher/cipher-internal.h (_gcry_cipher_ocb_get_l): Remove.
14214 (ocb_get_l): Remove 'l_tmp' usage and simplify since input
14215 is more limited now, 'N is not multiple of 65536'.
14216 * cipher/rijndael-aesni.c (get_l): Remove.
14217 (aesni_ocb_enc, aesni_ocb_dec, _gcry_aes_aesni_ocb_auth): Remove
14218 l_tmp; Use 'ocb_get_l'.
14219 * cipher/rijndael-ssse3-amd64.c (get_l): Remove.
14220 (ssse3_ocb_enc, ssse3_ocb_dec, _gcry_aes_ssse3_ocb_auth): Remove
14221 l_tmp; Use 'ocb_get_l'.
14222 * cipher/camellia-glue.c: Remove OCB l_tmp usage.
14223 * cipher/rijndael-armv8-ce.c: Ditto.
14224 * cipher/rijndael.c: Ditto.
14225 * cipher/serpent.c: Ditto.
14226 * cipher/twofish.c: Ditto.
14227
14228 OCB: remove 'int64_t' usage.
14229 + commit 161d339f48c03be7fd0f4249d730f7f1767ef8e4
14230 * cipher/cipher-ocb.c (double_block): Use alternative way to generate
14231 sign-bit mask, without 'int64_t'.
14232
14233 random-drbg: use bufhelp function for big-endian store.
14234 + commit 0b03b658bebc69a84d87ef13f9b60a27b0c42305
14235 * random/random-drbg.c (drbg_cpu_to_be32): Remove.
14236 (drbg_ctr_df, drbg_hash_df): Use 'buf_put_be32' instead of
14237 'drbg_cpu_to_be32'.
14238
14239 2016-12-09 Werner Koch <[email protected]>
14240
14241 Improve handling of mlock error codes.
14242 + commit 618b8978f46f4011c11512fd5f30c15e01652e2e
14243 * acinclude.m4 (GNUPG_CHECK_MLOCK): Check also for EAGAIN which is a
14244 legitimate return code and does not indicate a broken mlock().
14245 * src/secmem.c (lock_pool_pages): Test ERR instead of ERRNO which
14246 could have been overwritten by cap_from+text et al.
14247
14248 2016-12-08 Stephan Mueller <[email protected]>
14249
14250 random: Eliminate unneeded memcpy invocations in the DRBG.
14251 + commit 656395ba4cf34f42dda3a120bda3ed1220755a3d
14252 * random/random-drbg.c (drbg_hash): Remove arg 'outval' and return a
14253 pointer instead.
14254 (drbg_instantiate): Reduce size of scratchpad.
14255 (drbg_hmac_update): Avoid use of scratch buffers for the hash.
14256 (drbg_hmac_generate, drbg_hash_df): Ditto.
14257 (drbg_hash_process_addtl): Ditto.
14258 (drbg_hash_hashgen): Ditto.
14259 (drbg_hash_generate): Ditto.
14260
14261 random: Add performance improvements for the DRBG.
14262 + commit 20886fdcb841b0bf89bb1d44303d42f1804e38cb
14263 * random/random-drbg.c (struct drbg_state_ops_s): New function
14264 pointers 'crypto_init' and 'crypto-fini'.
14265 (struct drbg_state_s): New fields 'priv_data', 'ctr_handle', and
14266 'ctr_null'.
14267 (drbg_hash_init, drbg_hash_fini): New.
14268 (drbg_hmac_init, drbg_hmac_setkey): New.
14269 (drbg_sym_fini, drbg_sym_init, drbg_sym_setkey): New.
14270 (drbg_sym_ctr): New.
14271 (drbg_ctr_bcc): Set the key.
14272 (drbg_ctr_df): Ditto.
14273 (drbg_hmac_update): Ditto.
14274 (drbg_hmac_generate): Replace drgb_hmac by drbg_hash.
14275 (drbg_hash_df): Ditto.
14276 (drbg_hash_process_addtl): Ditto.
14277 (drbg_hash_hashgen): Ditto.
14278 (drbg_ctr_update): Rework.
14279 (drbg_ctr_generate): Rework.
14280 (drbg_ctr_ops): Init new functions pointers.
14281 (drbg_uninstantiate): Call fini function.
14282 (drbg_instantiate): Call init function.
14283
14284 cipher: New function for reading the counter in CTR mode.
14285 + commit 227099f179df9dcf083d0ef6be9883c775df0874
14286 * cipher/cipher.c (gcry_cipher_getctr): New.
14287
14288 2016-12-07 Werner Koch <[email protected]>
14289
14290 Document the overflow pools and add a stupid test case.
14291 + commit 95bac312644ad45e486c94c2efd25d0748b9a20b
14292 * tests/t-secmem.c (test_secmem_overflow): New func.
14293 (main): Disable warning and call new function.
14294
14295 Implement overflow secmem pools for xmalloc style allocators.
14296 + commit b6870cf25c0b1eb9c127a94af8326c446421a472
14297 * src/secmem.c (pooldesc_s): Add fields next, cur_alloced, and
14298 cur_blocks.
14299 (cur_alloced, cur_blocks): Remove vars.
14300 (ptr_into_pool_p): Make it inline.
14301 (stats_update): Add arg pool and update the new pool specific
14302 counters.
14303 (_gcry_secmem_malloc_internal): Add arg xhint and allocate overflow
14304 pools as needed.
14305 (_gcry_secmem_malloc): Pass XHINTS along.
14306 (_gcry_secmem_realloc_internal): Ditto.
14307 (_gcry_secmem_realloc): Ditto.
14308 (_gcry_secmem_free_internal): Take multiple pools in account. Add
14309 return value to indicate whether the arg was freed.
14310 (_gcry_secmem_free): Add return value to indicate whether the arg was
14311 freed.
14312 (_gcry_private_is_secure): Take multiple pools in account.
14313 (_gcry_secmem_term): Release all pools.
14314 (_gcry_secmem_dump_stats): Print stats for all pools.
14315 * src/stdmem.c (_gcry_private_free): Replace _gcry_private_is_secure
14316 test with a direct call of _gcry_secmem_free to avoid double checking.
14317
14318 Give the secmem allocators a hint when a xmalloc calls them.
14319 + commit b7df907dca4d525f8930c533b763ffce44ceed87
14320 * src/secmem.c (_gcry_secmem_malloc): New not yet used arg XHINT.
14321 (_gcry_secmem_realloc): Ditto.
14322 * src/stdmem.c (_gcry_private_malloc_secure): New arg XHINT to be
14323 passed to the secmem functions.
14324 (_gcry_private_realloc): Ditto.
14325 * src/g10lib.h (GCRY_ALLOC_FLAG_XHINT): New.
14326 * src/global.c (do_malloc): Pass this flag as XHINT to the private
14327 allocator.
14328 (_gcry_malloc_secure): Factor code out to ...
14329 (_gcry_malloc_secure_core): this. Add arg XHINT.
14330 (_gcry_realloc): Factor code out to ...
14331 (_gcry_realloc_core): here. Add arg XHINT.
14332 (_gcry_strdup): Factor code out to ...
14333 (_gcry_strdup_core): here. Add arg XHINT.
14334 (_gcry_xrealloc): Use the core function and pass true for XHINT.
14335 (_gcry_xmalloc_secure): Ditto.
14336 (_gcry_xstrdup): Ditto.
14337
14338 tests: New test t-secmem.
14339 + commit e366c19b34922c770af82cd035fd815680b29dee
14340 * src/secmem.c (_gcry_secmem_dump_stats): Add arg EXTENDED and adjust
14341 caller.
14342 * src/gcrypt-testapi.h (PRIV_CTL_DUMP_SECMEM_STATS): New.
14343 * src/global.c (_gcry_vcontrol): Implement that.
14344 * tests/t-secmem.c: New.
14345 * tests/Makefile.am (tests_bin): Add that test.
14346
14347 2016-12-06 Werner Koch <[email protected]>
14348
14349 Fix compiler warning about possible-NULL-dreference.
14350 + commit 995ce697308320c6a52a307f83dc49eeb8d784b4
14351 * src/mpi.h (mpi_is_const, mpi_is_immutable): Do check arg before
14352 deref-ing. The are only used at places where the arg shall not be NULL.
14353
14354 Fix possible NULL-deref in gcry_log_debugsxp.
14355 + commit 984a97f0750f812f0ad3c343ee6a67560953a504
14356 * src/misc.c (_gcry_log_printsxp): Prevent passing NULL to strlen.
14357
14358 Reorganize code in secmem.c.
14359 + commit 603f479a919311f720a05da738150c2192d5e562
14360 * src/secmem.c (pooldesc_t): New type to collect information about one
14361 pool.
14362 (pool_size): Remove. Now a member of pooldesc_t.
14363 (pool_okay): Ditto.
14364 (pool_is_mmapped): Ditto.
14365 (pool): Rename variable ...
14366 (mainpool): And change type to pooldesc_t.
14367 (ptr_into_pool_p): Add arg 'pool'.
14368 (mb_get_next): Ditto.
14369 (mb_get_prev): Ditto.
14370 (mb_merge): Ditto.
14371 (mb_get_new): Ditto.
14372 (init_pool): Ditto.
14373 (lock_pool): Rename to ...
14374 (look_pool_pages: this.
14375 (secmem_init): Rename to ...
14376 (_gcry_secmem_init_internal): this. Add local var POOL and init with
14377 address of MAINPOOL.
14378 (_gcry_secmem_malloc_internal): Add local var POOL and init with
14379 address of MAINPOOL.
14380 (_gcry_private_is_secure): Ditto.
14381 (_gcry_secmem_term): Ditto.
14382 (_gcry_secmem_dump_stats): Ditto.
14383 (_gcry_secmem_free_internal): Ditto. Remove check for NULL arg.
14384 (_gcry_secmem_free): Add check for NULL arg before taking the lock.
14385 (_gcry_secmem_realloc): Factor most code out to ...
14386 (_gcry_secmem_realloc_internal): this.
14387
14388 2016-11-28 Dmitry Eremin-Solenikov <[email protected]>
14389
14390 tests: Add PBKDF2 tests for Stribog512.
14391 + commit a0580d446fef648a177ca4ab060d0e449780db84
14392 * tests/t-kdf.c (check_pbkdf2): Add Stribog512 test cases from TC26's
14393 additions to PKCS#5.
14394
14395 tests: Add Stribog HMAC tests from TC26ALG.
14396 + commit fe6077e6ee8565bfcc91bad14a73e68f45b3c32b
14397 * tests/basic.c (check_mac): add HMAC test vectors from TC26ALG document
14398 for Stribog.
14399
14400 cipher: Add Stribog OIDs from TC26 space.
14401 + commit ccffacaf6c3abe6120a0898db922981d28ab7af2
14402 * cipher/stribog.c (oid_spec_stribog256, oid_spec_stribog512): New.
14403
14404 2016-11-25 Justus Winter <[email protected]>
14405
14406 tests: Fix memory leak.
14407 + commit 5530a8234d703ce9b685f78fb6e951136eb0aeb2
14408 * tests/basic.c (check_gost28147_cipher): Free cipher handles.
14409
14410 2016-11-25 Dmitry Eremin-Solenikov <[email protected]>
14411
14412 Cast oid argument of gcry_cipher_set_sbox to disable compiler warning.
14413 + commit 1a67e3195896704f8b3ba09e3db1214bab834491
14414 * src/gcrypt.h.in (gcry_cipher_set_sbox): Cast oid to (void *).
14415
14416 gost: Rename tc26 s-box from A to Z.
14417 + commit dc8ceb8d2dfef949f3afa14fc75f9de8cd07c7ad
14418 * cipher/gost-s-box.c (gost_sboxes): Rename TC26_A to TC26_Z as it is
14419 the name that ended up in all standards.
14420
14421 tests: Add test to verify GOST 28147-89 against known results.
14422 + commit 4f5c26c73c66daf2e4aff966e43c22b2db7e0138
14423 * tests/basic.c (check_gost28147_cipher): new test function.
14424
14425 2016-11-17 Dmitry Eremin-Solenikov <[email protected]>
14426
14427 cipher/gost28147: Fix CryptoPro-B S-BOX.
14428 + commit 5ca63c92825453fdb369a97bbc19cb95b49b4296
14429 * cipher/gost-s-box.c: CryptoPro_B s-box missed one line, resulting in
14430 incorrect encryption/decryption using that s-box. Add missing data.
14431
14432 2016-11-12 Werner Koch <[email protected]>
14433
14434 Put blocking calls into Libgpg-error's system call clamp.
14435 + commit b829dfe9f0eeff08c956ba3f3a6b559b9d2199dd
14436 * src/gcrypt.h.in (GCRYCTL_REINIT_SYSCALL_CLAMP): New.
14437 * configure.ac: Require Libgpg-error 1.25. Set version number to
14438 1.8.0.
14439 * src/gcrypt-int.h: Remove error code emulation.
14440 * src/global.c (pre_syscall_func, post_syscall_func): New.
14441 (global_init): Call gpgrt_get_syscall_clamp.
14442 (_gcry_vcontrol) <GCRYCTL_REINIT_SYSCALL_CLAMP>: Ditto.
14443 (_gcry_pre_syscall, _gcry_post_syscall): New.
14444 * random/rndlinux.c (_gcry_rndlinux_gather_random): Use the new
14445 functions.
14446
14447 2016-11-01 NIIBE Yutaka <[email protected]>
14448
14449 cipher: Fix IDEA cipher for clearing memory.
14450 + commit bf6d5b10cb4173826f47ac080506b68bb001acb2
14451 * cipher/idea.c (invert_key): Use wipememory, since this kind of memset
14452 may be removed by compiler optimization.
14453
14454 2016-10-09 Jussi Kivilinna <[email protected]>
14455
14456 GCM: Add bulk processing for ARMv8/AArch64 implementation.
14457 + commit bfd732f53a9b5dfe14217a68a0fa289bf6913ec0
14458 * cipher/cipher-gcm-armv8-aarch64-ce.S: Add 6 blocks bulk processing.
14459
14460 GCM: Add bulk processing for ARMv8/AArch32 implementation.
14461 + commit 27747921cb1dfced83c5666cd1c474764724c52b
14462 * cipher/cipher-gcm-armv8-aarch32-ce.S: Add 4 blocks bulk processing.
14463 * tests/basic.c (check_digests): Print correct data length for "?"
14464 tests.
14465 (check_one_mac): Add large 1000000 bytes tests, when input is "!" or
14466 "?".
14467 (check_mac): Add "?" tests vectors for HMAC, CMAC, GMAC and POLY1305.
14468
14469 2016-09-11 Jussi Kivilinna <[email protected]>
14470
14471 Add Aarch64 assembly implementation of Twofish.
14472 + commit 5418d9ca4c0e087fd6872ad350a996fe74880d86
14473 * cipher/Makefile.am: Add 'twofish-aarch64.S'.
14474 * cipher/twofish-aarch64.S: New.
14475 * cipher/twofish.c: Enable USE_ARM_ASM if __AARCH64EL__ and
14476 HAVE_COMPATIBLE_GCC_AARCH64_PLATFORM_AS defined.
14477 * configure.ac [host=aarch64]: Add 'twofish-aarch64.lo'.
14478
14479 2016-09-05 Jussi Kivilinna <[email protected]>
14480
14481 Add Aarch64 assembly implementation of Camellia.
14482 + commit de73a2e7237ba7c34ce48bb5fb671aa3993de832
14483 * cipher/Makefile.am: Add 'camellia-aarch64.S'.
14484 * cipher/camellia-aarch64.S: New.
14485 * cipher/camellia-glue.c [USE_ARM_ASM][__aarch64__]: Set stack burn
14486 size to zero.
14487 * cipher/camellia.h: Enable USE_ARM_ASM if __AARCH64EL__ and
14488 HAVE_COMPATIBLE_GCC_AARCH64_PLATFORM_AS defined.
14489 * configure.ac [host=aarch64]: Add 'rijndael-aarch64.lo'.
14490
14491 Add ARMv8/AArch64 Crypto Extension implementation of AES.
14492 + commit 4cd8d40d698564d24ece2af24546e34c58bf2961
14493 * cipher/Makefile.am: Add 'rijndael-armv-aarch64-ce.S'.
14494 * cipher/rijndael-armv8-aarch64-ce.S: New.
14495 * cipher/rijndael-internal.h (USE_ARM_CE): Enable for ARMv8/AArch64.
14496 * configure.ac: Add 'rijndael-armv-aarch64-ce.lo' and
14497 'rijndael-armv8-ce.lo' for ARMv8/AArch64.
14498
14499 Add ARMv8/AArch64 Crypto Extension implementation of GCM.
14500 + commit 0b332c1aef03a735c1fb0df184f74d523deb2f98
14501 * cipher/Makefile.am: Add 'cipher-gcm-armv8-aarch64-ce.S'.
14502 * cipher/cipher-gcm-armv8-aarch64-ce.S: New.
14503 * cipher/cipher-internal.h (GCM_USE_ARM_PMULL): Enable on
14504 ARMv8/AArch64.
14505
14506 Add ARMv8/AArch64 Crypto Extension implementation of SHA-256.
14507 + commit 2d4bbc0ad62c54bbdef77799f9db82d344b7219e
14508 * cipher/Makefile.am: Add 'sha256-armv8-aarch64-ce.S'.
14509 * cipher/sha256-armv8-aarch64-ce.S: New.
14510 * cipher/sha256-armv8-aarch32-ce.S: Move round macros to correct
14511 section.
14512 * cipher/sha256.c (USE_ARM_CE): Enable on ARMv8/AArch64.
14513 * configure.ac: Add 'sha256-armv8-aarch64-ce.lo'; Swap places for
14514 'sha512-arm.lo' and 'sha256-armv8-aarch32-ce.lo'.
14515
14516 Add ARMv8/AArch64 Crypto Extension implementation of SHA-1.
14517 + commit e4eb03f56683317c908cb55be727832810dc8c72
14518 * cipher/Makefile.am: Add 'sha1-armv8-aarch64-ce.S'.
14519 * cipher/sha1-armv8-aarch64-ce.S: New.
14520 * cipher/sha1.c (USE_ARM_CE): Enable on ARMv8/AArch64.
14521 * configure.ac: Add 'sha1-armv8-aarch64-ce.lo'.
14522
14523 2016-09-04 Jussi Kivilinna <[email protected]>
14524
14525 Add AArch64 assembly implementation of AES.
14526 + commit 595251ad37bf1968261d7e781752513f67525803
14527 * cipher/Makefile.am: Add 'rijndael-aarch64.S'.
14528 * cipher/rijndael-aarch64.S: New.
14529 * cipher/rijndael-internal.h: Enable USE_ARM_ASM if __AARCH64EL__ and
14530 HAVE_COMPATIBLE_GCC_AARCH64_PLATFORM_AS defined.
14531 * configure.ac (gcry_cv_gcc_aarch64_platform_as_ok): New check.
14532 [host=aarch64]: Add 'rijndael-aarch64.lo'.
14533
14534 2016-08-17 Werner Koch <[email protected]>
14535
14536 Release 1.7.3.
14537 + commit f8241874971478bdcd2bc2082d901d05db7b256d
14538 * configure.ac: Set LT version to C21/A1/R3.
14539
14540 random: Hash continuous areas in the csprng pool.
14541 + commit 8dd45ad957b54b939c288a68720137386c7f6501
14542 * random/random-csprng.c (mix_pool): Store the first hash at the end
14543 of the pool.
14544
14545 random: Improve the diagram showing the random mixing.
14546 + commit 2f62103b4bb6d6f9ce806e01afb7fdc58aa33513
14547 * random/random-csprng.c (mix_pool): Use DIGESTLEN instead of 20.
14548
14549 2016-07-19 Jussi Kivilinna <[email protected]>
14550
14551 crc-intel-pclmul: split assembly block to ease register pressure.
14552 + commit f38199dbc290003898a1799adc367265267784c2
14553 * cipher/crc-intel-pclmul.c (crc32_less_than_16): Split inline
14554 assembly block handling 4 byte input into multiple blocks.
14555
14556 rijndael-aesni: split assembly block to ease register pressure.
14557 + commit a4d1595a2638db63ac4c73e722c8ba95fdd85ff7
14558 * cipher/rijndael-aesni.c (do_aesni_ctr_4): Use single register
14559 constraint for passing 'bige_addb' to assembly block; split
14560 first inline assembly block into two parts.
14561
14562 2016-07-14 Jussi Kivilinna <[email protected]>
14563
14564 Add ARMv8/AArch32 Crypto Extension implementation of AES.
14565 + commit 05a4cecae0c02d2b4ee1cadd9c08115beae3a94a
14566 * cipher/Makefile.am: Add 'rijndael-armv8-ce.c' and
14567 'rijndael-armv-aarch32-ce.S'.
14568 * cipher/rijndael-armv8-aarch32-ce.S: New.
14569 * cipher/rijndael-armv8-ce.c: New.
14570 * cipher/rijndael-internal.h (USE_ARM_CE): New.
14571 (RIJNDAEL_context_s): Add 'use_arm_ce'.
14572 * cipher/rijndael.c [USE_ARM_CE] (_gcry_aes_armv8_ce_setkey)
14573 (_gcry_aes_armv8_ce_prepare_decryption)
14574 (_gcry_aes_armv8_ce_encrypt, _gcry_aes_armv8_ce_decrypt)
14575 (_gcry_aes_armv8_ce_cfb_enc, _gcry_aes_armv8_ce_cbc_enc)
14576 (_gcry_aes_armv8_ce_ctr_enc, _gcry_aes_armv8_ce_cfb_dec)
14577 (_gcry_aes_armv8_ce_cbc_dec, _gcry_aes_armv8_ce_ocb_crypt)
14578 (_gcry_aes_armv8_ce_ocb_auth): New.
14579 (do_setkey) [USE_ARM_CE]: Add ARM CE/AES HW feature check and key
14580 setup for ARM CE.
14581 (prepare_decryption, _gcry_aes_cfb_enc, _gcry_aes_cbc_enc)
14582 (_gcry_aes_ctr_enc, _gcry_aes_cfb_dec, _gcry_aes_cbc_dec)
14583 (_gcry_aes_ocb_crypt, _gcry_aes_ocb_auth) [USE_ARM_CE]: Add
14584 ARM CE support.
14585 * configure.ac: Add 'rijndael-armv8-ce.lo' and
14586 'rijndael-armv8-aarch32-ce.lo'.
14587
14588 Add ARMv8/AArch32 Crypto Extension implementation of GCM.
14589 + commit 962b15470663db11e5c35b86768f1b5d8e600017
14590 * cipher/Makefile.am: Add 'cipher-gcm-armv8-aarch32-ce.S'.
14591 * cipher/cipher-gcm-armv8-aarch32-ce.S: New.
14592 * cipher/cipher-gcm.c [GCM_USE_ARM_PMULL]
14593 (_gcry_ghash_setup_armv8_ce_pmull, _gcry_ghash_armv8_ce_pmull)
14594 (ghash_setup_armv8_ce_pmull, ghash_armv8_ce_pmull): New.
14595 (setupM) [GCM_USE_ARM_PMULL]: Enable ARM PMULL implementation if
14596 HWF_ARM_PULL HW feature flag is enabled.
14597 * cipher/cipher-gcm.h (GCM_USE_ARM_PMULL): New.
14598
14599 Add ARMv8/AArch32 Crypto Extension implemenation of SHA-256.
14600 + commit 34c64eb03178fbfd34190148fec5a189df2b8f83
14601 * cipher/Makefile.am: Add 'sha256-armv8-aarch32-ce.S'.
14602 * cipher/sha256-armv8-aarch32-ce.S: New.
14603 * cipher/sha256.c (USE_ARM_CE): New.
14604 (sha256_init, sha224_init): Check features for HWF_ARM_SHA1.
14605 [USE_ARM_CE] (_gcry_sha256_transform_armv8_ce): New.
14606 (transform) [USE_ARM_CE]: Use ARMv8 CE implementation if HW supports.
14607 (SHA256_CONTEXT): Add 'use_arm_ce'.
14608 * configure.ac: Add 'sha256-armv8-aarch32-ce.lo'.
14609
14610 Add ARMv8/AArch32 Crypto Extension implementation of SHA-1.
14611 + commit 3d6334f8d94c2a4df10eed203ae928298a4332ef
14612 * cipher/Makefile.am: Add 'sha1-armv8-aarch32-ce.S'.
14613 * cipher/sha1-armv7-neon.S (_gcry_sha1_transform_armv7_neon): Add
14614 missing size.
14615 * cipher/sha1-armv8-aarch32-ce.S: New.
14616 * cipher/sha1.c (USE_ARM_CE): New.
14617 (sha1_init): Check features for HWF_ARM_SHA1.
14618 [USE_ARM_CE] (_gcry_sha1_transform_armv8_ce): New.
14619 (transform) [USE_ARM_CE]: Use ARMv8 CE implementation if HW supports
14620 it.
14621 * cipher/sha1.h (SHA1_CONTEXT): Add 'use_arm_ce'.
14622 * configure.ac: Add 'sha1-armv8-aarch32-ce.lo'.
14623
14624 Add HW feature check for ARMv8 AArch64 and crypto extensions.
14625 + commit eee78f6e1fbce7d54c43fb7efc5aa8be9f52755f
14626 * configure.ac: Add '--disable-arm-crypto-support'; enable hwf-arm
14627 module on 64-bit ARM.
14628 (armcryptosupport, gcry_cv_gcc_inline_aarch32_crypto)
14629 (gcry_cv_inline_asm_aarch64_neon)
14630 (gcry_cv_gcc_inline_asm_aarch64_crypto): New.
14631 * src/g10lib.h (HWF_ARM_AES, HWF_ARM_SHA1, HWF_ARM_SHA2)
14632 (HWF_ARM_PMULL): New.
14633 * src/hwf-arm.c [__aarch64__]: Enable building in AArch64 mode.
14634 (feature_map_s): New.
14635 [__arm__] (AT_HWCAP, AT_HWCAP2, HWCAP2_AES, HWCAP2_PMULL)
14636 (HWCAP2_SHA1, HWCAP2_SHA2, arm_features): New.
14637 [__aarch64__] (AT_HWCAP, AT_HWCAP2, HWCAP_ASIMD, HWCAP_AES)
14638 (HWCAP_PMULL, HWCAP_SHA1, HWCAP_SHA2, arm_features): New.
14639 (get_hwcap): Add reading of 'AT_HWCAP2'; Change auxv use
14640 'unsigned long'.
14641 (detect_arm_at_hwcap): Add mapping of HWCAP/HWCAP2 to HWF flags.
14642 (detect_arm_proc_cpuinfo): Add mapping of CPU features to HWF flags.
14643 (_gcry_hwf_detect_arm): Use __ARM_NEON instead of legacy __ARM_NEON__.
14644 * src/hwfeatures.c (hwflist): Add 'arm-aes', 'arm-sha1', 'arm-sha2'
14645 and 'arm-pmull'.
14646
14647 2016-07-14 Werner Koch <[email protected]>
14648
14649 Release 1.7.2.
14650 + commit be0bec7d9208b2f2d2ffce9cc2ca6154853e7e59
14651 * configure.ac: Set LT version to C21/A1/R2.
14652 * Makefile.am (distcheck-hook): New.
14653
14654 2016-07-13 Werner Koch <[email protected]>
14655
14656 build: Update config.{guess,sub} to {2016-05-15,2016-06-20}.
14657 + commit e535ea1bdc42309553007d60599d3147b8defe93
14658 * build-aux/config.guess: Update.
14659 * build-aux/config.sub: Update.
14660
14661 2016-07-08 Jussi Kivilinna <[email protected]>
14662
14663 Fix unaligned accesses with ldm/stm in ChaCha20 and Poly1305 ARM/NEON.
14664 + commit 1111d311fd6452abd4080d1072c75ddb1b5a3dd1
14665 * cipher/chacha20-armv7-neon.S (UNALIGNED_STMIA8)
14666 (UNALIGNED_LDMIA4): New.
14667 (_gcry_chacha20_armv7_neon_blocks): Use new helper macros instead of
14668 ldm/stm instructions directly.
14669 * cipher/poly1305-armv7-neon.S (UNALIGNED_LDMIA2)
14670 (UNALIGNED_LDMIA4): New.
14671 (_gcry_poly1305_armv7_neon_init_ext, _gcry_poly1305_armv7_neon_blocks)
14672 (_gcry_poly1305_armv7_neon_finish_ext): Use new helper macros instead
14673 of ldm instruction directly.
14674
14675 2016-07-03 Jussi Kivilinna <[email protected]>
14676
14677 bench-slope: add unaligned buffer mode.
14678 + commit 496790940753226f96b731a43d950bd268acd97a
14679 * tests/bench-slope.c (unaligned_mode): New.
14680 (do_slope_benchmark): Unalign buffer if in unaligned mode enabled.
14681 (print_help, main): Add '--unaligned' parameter.
14682
14683 2016-07-01 Jussi Kivilinna <[email protected]>
14684
14685 Fix static build.
14686 + commit cb79630ec567a5f2e03e5f863cda168faa7b8cc8
14687 * tests/pubkey.c (_gcry_pk_util_get_nbits): Make function 'static'.
14688
14689 2016-06-30 Jussi Kivilinna <[email protected]>
14690
14691 Disallow encryption/decryption if key is not set.
14692 + commit 07de9858032826f5a7b08c372f6bcc73bbb503eb
14693 * cipher/cipher.c (cipher_encrypt, cipher_decrypt): If mode is not
14694 NONE, make sure that key is set.
14695 * cipher/cipher-ccm.c (_gcry_cipher_ccm_set_nonce): Do not clear
14696 'marks.key' when reseting state.
14697
14698 Avoid unaligned accesses with ARM ldm/stm instructions.
14699 + commit a6158a01a4d81a5d862e1e0a60bfd6063443311d
14700 * cipher/rijndael-arm.S: Remove __ARM_FEATURE_UNALIGNED ifdefs, always
14701 compile with unaligned load/store code paths.
14702 * cipher/sha512-arm.S: Ditto.
14703
14704 Fix non-PIC reference in PIC for poly1305/ARMv7-NEON.
14705 + commit a09126242a51c4ea4564b0f70b808e4f27fe5a91
14706 * cipher/poly1305-armv7-neon.S (GET_DATA_POINTER): New.
14707 (_gcry_poly1305_armv7_neon_init_ext): Use GET_DATA_POINTER.
14708
14709 Fix wrong CPU feature #ifdef for SHA1/AVX.
14710 + commit 4a983e3bef58b9d056517e25e0ab10b72d12ceba
14711 * cipher/sha1-avx-amd64.S: Check for HAVE_GCC_INLINE_ASM_AVX instead of
14712 HAVE_GCC_INLINE_ASM_AVX2 & HAVE_GCC_INLINE_ASM_BMI2.
14713
14714 2016-06-30 Werner Koch <[email protected]>
14715
14716 random: Remove debug message about not supported getrandom syscall.
14717 + commit 6965515c73632a088fb126a4a55e95121671fa98
14718 * random/rndlinux.c (_gcry_rndlinux_gather_random): Remove log_debug
14719 for getrandom error ENOSYS.
14720
14721 2016-06-27 Werner Koch <[email protected]>
14722
14723 tests: Do not test SHAKE128 et al with gcry_md_hash_buffer.
14724 + commit 4d634a098742ff425b324e9f2a67b9f62de09744
14725 * tests/benchmark.c (md_bench): Do not test variable lengths algos
14726 with the gcry_md_hash_buffer.
14727
14728 md: Improve diagnostic when using SHAKE128 with gcry_md_hash_buffer.
14729 + commit ae26edf4b60359bfa5fe3a27b2c24b336e7ec35c
14730 * cipher/md.c (md_read): Detect missing read function.
14731 (_gcry_md_hash_buffers): Return an error.
14732
14733 2016-06-25 Werner Koch <[email protected]>
14734
14735 ecc: Fix memory leak.
14736 + commit 7a7f7c147f888367dfee6093d26bfeaf750efc3a
14737 * cipher/ecc.c (ecc_check_secret_key): Do not init point if already
14738 set.
14739
14740 doc: Update yat2m.
14741 + commit 1feb01940062a74c27230434fc3babdddca8caf4
14742 * doc/yat2m.c: Update from Libgpg-error
14743
14744 tests: Add attributes to helper functions.
14745 + commit c870cb5d385c1d6e1e28ca481cf9cf44b3bfeea9
14746 * tests/t-common.h (die, fail, info): Add attributes.
14747 * tests/random.c (die, inf): Ditto.
14748 * tests/pubkey.c (die, fail, info): Add attributes.
14749 * tests/fipsdrv.c (die): Add attribute.
14750 (main): Take care of missing --key,--iv,--dt options.
14751
14752 Improve robustness and help lint.
14753 + commit 5a5b055b81ee60a22a846bdf2031516b1c24df98
14754 * cipher/rsa.c (rsa_encrypt): Check for !DATA.
14755 * cipher/md.c (search_oid): Check early for !OID.
14756 (md_copy): Use gpg_err_code_from_syserror. Replace chains of if(!err)
14757 tests.
14758 * cipher/cipher.c (search_oid): Check early for !OID.
14759 * src/misc.c (do_printhex): Allow for BUFFER==NULL even with LENGTH>0.
14760 * mpi/mpicoder.c (onecompl): Allow for A==NULL to help static
14761 analyzers.
14762
14763 cipher: Improve fatal error message for bad use of gcry_md_read.
14764 + commit 3f98b1e92d5afd720d7cea5b4e8295c5018bf9ac
14765 * cipher/md.c (md_read): Use _gcry_fatal_error instead of BUG.
14766
14767 2016-06-16 Niibe Yutaka <[email protected]>
14768
14769 ecc: Default cofactor 1 for PUBKEY_FLAG_PARAM.
14770 + commit b0b70e7fe37b1bf13ec0bfc8effcb5c7f5db6b7d
14771 * cipher/ecc.c (ecc_check_secret_key, ecc_sign, ecc_verify)
14772 (ecc_encrypt_raw, ecc_decrypt_raw, compute_keygrip): Set default
14773 cofactor as 1, when not specified.
14774
14775 ecc: Default cofactor 1 for PUBKEY_FLAG_PARAM.
14776 + commit 0f3a069211d8d24a61aa0dc2cc6c4ef04cc4fab7
14777 * cipher/ecc.c (ecc_check_secret_key, ecc_sign, ecc_verify)
14778 (ecc_encrypt_raw, ecc_decrypt_raw, compute_keygrip): Set default
14779 cofactor as 1, when not specified.
14780
14781 2016-06-15 Werner Koch <[email protected]>
14782
14783 Release 1.7.1.
14784 + commit 48aa6d6602564d6ba0cef10cf08f9fb0c59b3223
14785
14786
14787 doc: Describe envvars.
14788 + commit c3173bbe3f1a9c73f81a538dd49ccfa0447bfcdc
14789 * doc/gcrypt.texi: Add chapter Configuration.
14790
14791 random: Change names of debug envvars.
14792 + commit 131b4f0634cee0e5c47d2250c59f51127b10f7b3
14793 * random/rndunix.c (start_gatherer): Change GNUPG_RNDUNIX_DBG to
14794 GCRYPT_RNDUNIX_DBG, change GNUPG_RNDUNIX_DBG to GCRYPT_RNDUNIX_DBG.
14795 * random/rndw32.c (registry_poll): Change GNUPG_RNDW32_NOPERF to
14796 GCRYPT_RNDW32_NOPERF.
14797
14798 2016-06-14 Werner Koch <[email protected]>
14799
14800 cipher: Assign OIDs to the Serpent cipher.
14801 + commit e13a6a1ba53127af602713d0c2aaa85c94b3cd7e
14802 * cipher/serpent.c (serpent128_oids, serpent192_oids)
14803 (serpent256_oids): New. Add them to the specs blow.
14804 (serpent128_aliases): Add "SERPENT-128".
14805 (serpent256_aliases, serpent192_aliases): New.
14806
14807 cipher: Assign OIDs to the Serpent cipher.
14808 + commit 6cc2100c00a65dff07b095dea7b32cb5c5cd96d4
14809 * cipher/serpent.c (serpent128_oids, serpent192_oids)
14810 (serpent256_oids): New. Add them to the specs blow.
14811 (serpent128_aliases): Add "SERPENT-128".
14812 (serpent256_aliases, serpent192_aliases): New.
14813
14814 2016-06-08 Werner Koch <[email protected]>
14815
14816 rsa: Implement blinding also for signing.
14817 + commit 1f769e3e8442bae2f1f73c656920bb2df70153c0
14818 * cipher/rsa.c (rsa_decrypt): Factor blinding code out to ...
14819 (secret_blinded): new.
14820 (rsa_sign): Use blinding by default.
14821
14822 random: Remove debug output for getrandom(2) output.
14823 + commit 52cdfb1960808aaad48b5a501bbce0e3141c3961
14824 * random/rndlinux.c (_gcry_rndlinux_gather_random): Remove debug
14825 output.
14826
14827 Fix gcc portability on Solaris 9 SPARC boxes.
14828 + commit b766ea14ad1c27d6160531b200cc70aaa479c6dc
14829 * mpi/longlong.h: Use __sparcv8 as alias for __sparc_v8__.
14830
14831 2016-06-08 Jérémie Courrèges-Anglas <[email protected]>
14832
14833 Check for compiler SSE4.1 support in PCLMUL CRC code.
14834 + commit dc76313308c184c92eb78452b503405b90fc7ebd
14835 * cipher/crc-intel-pclmul.c: Build PCLMUL CRC implementation only if
14836 compiler supports PCLMUL *and* SSE4.1
14837 * cipher/crc.c: Ditto
14838 * configure.ac (sse41support, gcry_cv_gcc_inline_asm_sse41): New.
14839
14840 2016-06-08 NIIBE Yutaka <[email protected]>
14841
14842 ecc: Fix ecc_verify for cofactor support.
14843 + commit bd39eb9fba47dc8500c83769a679cc8b683d6c6e
14844 * cipher/ecc.c (ecc_verify): Fix the argument for cofactor "h".
14845
14846 2016-06-08 Werner Koch <[email protected]>
14847
14848 random: Try to use getrandom() instead of /dev/urandom (Linux only).
14849 + commit c05837211e5221d3f56146865e823bc20b4ff1ab
14850 * configure.ac: Check for syscall.
14851 * random/rndlinux.c [HAVE_SYSCALL]: Include sys/syscall.h.
14852 (_gcry_rndlinux_gather_random): Use getrandom is available.
14853
14854 2016-06-03 Werner Koch <[email protected]>
14855
14856 rsa: Implement blinding also for signing.
14857 + commit ef6e4d004b10f5740bcd2125fb70e199dd21e3e8
14858 * cipher/rsa.c (rsa_decrypt): Factor blinding code out to ...
14859 (secret_blinded): new.
14860 (rsa_sign): Use blinding by default.
14861
14862 random: Remove debug output for getrandom(2) output.
14863 + commit 82df6c63a72fdd969c3923523f10d0cef5713ac7
14864 * random/rndlinux.c (_gcry_rndlinux_gather_random): Remove debug
14865 output.
14866
14867 2016-06-02 Werner Koch <[email protected]>
14868
14869 Fix gcc portability on Solaris 9 SPARC boxes.
14870 + commit 4121f15122501d8946f1589b303d1f7949c15e30
14871 * mpi/longlong.h: Use __sparcv8 as alias for __sparc_v8__.
14872
14873 2016-05-28 Jérémie Courrèges-Anglas <[email protected]>
14874
14875 Check for compiler SSE4.1 support in PCLMUL CRC code.
14876 + commit 3e8074ecd3a534e8bd7f11cf17f0b22d252584c8
14877 * cipher/crc-intel-pclmul.c: Build PCLMUL CRC implementation only if
14878 compiler supports PCLMUL *and* SSE4.1
14879 * cipher/crc.c: Ditto
14880 * configure.ac (sse41support, gcry_cv_gcc_inline_asm_sse41): New.
14881
14882 2016-05-06 NIIBE Yutaka <[email protected]>
14883
14884 ecc: Fix ecc_verify for cofactor support.
14885 + commit c7430aa752232aa690c5d8f16575a345442ad8d7
14886 * cipher/ecc.c (ecc_verify): Fix the argument for cofactor "h".
14887
14888 2016-04-26 Werner Koch <[email protected]>
14889
14890 random: Try to use getrandom() instead of /dev/urandom (Linux only).
14891 + commit ee5a32226a7ca4ab067864e06623fc11a1768900
14892 * configure.ac: Check for syscall.
14893 * random/rndlinux.c [HAVE_SYSCALL]: Include sys/syscall.h.
14894 (_gcry_rndlinux_gather_random): Use getrandom is available.
14895
14896 2016-04-19 Werner Koch <[email protected]>
14897
14898 asm fix for older gcc versions.
14899 + commit caa9d14c914bf6116ec3f773a322a94e2be0c0fb
14900 * cipher/crc-intel-pclmul.c: Remove extra trailing colon from
14901 asm statements.
14902
14903 asm fix for older gcc versions.
14904 + commit 4545372c0f8dd35aef2a7abc12b588ed1a4a0363
14905 * cipher/crc-intel-pclmul.c: Remove extra trailing colon from
14906 asm statements.
14907
14908 2016-04-15 Werner Koch <[email protected]>
14909
14910 Release 1.7.0.
14911 + commit 795f9cb090c776658a0e3117996e3fb7e2ebd94a
14912
14913
14914 2016-04-14 Werner Koch <[email protected]>
14915
14916 tests: Add test vectors for 256 GiB test of SHA3-256.
14917 + commit 1737c546dc7268fa9edcd4a23b7439c56d37ee4f
14918 * tests/hashtest.c: Add new test vectros.
14919
14920 2016-04-14 Justus Winter <[email protected]>
14921
14922 src: Improve S-expression parsing.
14923 + commit 491586bc7f7b9edc6b78331a77e653543983c9e4
14924 * src/sexp.c (do_vsexp_sscan): Return an error if a closing
14925 parenthesis is encountered with no matching opening parenthesis.
14926
14927 2016-04-14 Werner Koch <[email protected]>
14928
14929 cipher: Add constant for 8 bit CFB mode.
14930 + commit 47c6a1f88eb763e9baa394e34d873b761abcebbe
14931 * src/gcrypt.h.in (GCRY_CIPHER_MODE_CFB8): New.
14932 * tests/basic.c (check_cfb_cipher): Prepare for CFB-8 tests.
14933
14934 tests: Add a new test for S-expressions.
14935 + commit 88c6b98350193abbdcfb227754979b0c097ee09c
14936 * tests/t-sexp.c (compare_to_canon): New.
14937 (back_and_forth_one): Add another test.
14938
14939 2016-04-13 NIIBE Yutaka <[email protected]>
14940
14941 ecc: Fix corner cases for X25519.
14942 + commit 8472b71812e71c69d66e2fcc02a6e21b66755f8b
14943 * cipher/ecc.c (ecc_encrypt_raw): For invalid input, returns
14944 GPG_ERR_INV_DATA instead of aborting with log_fatal. For X25519,
14945 it's not an error, thus, let it return 0.
14946 (ecc_decrypt_raw): Use the flag PUBKEY_FLAG_DJB_TWEAK to distinguish
14947 X25519, not by the name of the curve.
14948 (ecc_decrypt_raw): For invalid input, returns GPG_ERR_INV_DATA instead
14949 of aborting with log_fatal. For X25519, it's not an error by its
14950 definition, but we deliberately let it return the error to detect
14951 looks-like-encrypted-message.
14952 * tests/t-cv25519.c: Add points to record the issue.
14953
14954 2016-04-12 Werner Koch <[email protected]>
14955
14956 cipher: Buffer data from gcry_cipher_authenticate in OCB mode.
14957 + commit b6d2a25a275a35ec4dbd53ecaa9ea0ed7aa99c7b
14958 * cipher/cipher-internal.h (gcry_cipher_handle): Add fields
14959 aad_leftover and aad_nleftover to u_mode.ocb.
14960 * cipher/cipher-ocb.c (_gcry_cipher_ocb_set_nonce): Clear
14961 aad_nleftover.
14962 (_gcry_cipher_ocb_authenticate): Add buffering and facor some code out
14963 to ...
14964 (ocb_aad_finalize): new.
14965 (compute_tag_if_needed): Call new function.
14966 * tests/basic.c (check_ocb_cipher_splitaad): New.
14967 (check_ocb_cipher): Call new function.
14968 (main): Also call check_cipher_modes with --ciper-modes.
14969
14970 2016-04-12 NIIBE Yutaka <[email protected]>
14971
14972 ecc: Fix X25519 computation on Curve25519.
14973 + commit ee7e1a0e835f8ffcfbcba2a44abab8632db8fed5
14974 * cipher/ecc.c (ecc_encrypt_raw): Tweak of bits when
14975 PUBKEY_FLAG_DJB_TWEAK is enabled.
14976 (ecc_decrypt_raw): Return 0 when PUBKEY_FLAG_DJB_TWEAK is enabled.
14977 * tests/t-cv25519.c (test_cv): Update by using gcry_pk_encrypt.
14978
14979 ecc: Fix initialization of EC context.
14980 + commit 7fbdb99b8c56360adfd1fb4e7f4c95e0f8aa34de
14981 * cipher/ecc.c (test_ecdh_only_keys, ecc_generate)
14982 (ecc_check_secret_key, ecc_encrypt_raw, ecc_decrypt_raw): Initialize
14983 by _gcry_mpi_ec_p_internal_new should carry FLAGS.
14984
14985 2016-04-06 Werner Koch <[email protected]>
14986
14987 Allow building with configure option --enable-hmac-binary-check.
14988 + commit 65c63144b66392f40b991684789b8b793248e3ba
14989 * src/Makefile.am (mpicalc_LDADD): Add DL_LIBS.
14990 * src/fips.c (check_binary_integrity): Allow use of hmac256 output.
14991 * src/hmac256.c (main): Add option --stdkey
14992
14993 2016-04-06 NIIBE Yutaka <[email protected]>
14994
14995 ecc: Positive values in computation.
14996 + commit 6f386ceae86a058e26294f744750f1ed2a95e604
14997 * cipher/ecc-curves.c (_gcry_ecc_fill_in_curve): Make sure
14998 coefficients A and B are positive.
14999 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_recover_x): For negation, do
15000 "P - T" instead of "-T", so that the result will be positive.
15001 (_gcry_ecc_eddsa_verify): Likewise.
15002 * cipher/ecc.c (ecc_check_secret_key): Use _gcry_ecc_fill_in_curve
15003 instead of _gcry_ecc_update_curve_param.
15004 * mpi/ec.c (ec_subm): Make sure the result will be positive.
15005 (dup_point_edwards, sub_points_edwards, _gcry_mpi_ec_curve_point): Use
15006 mpi_sub instead of mpi_neg.
15007 (add_points_edwards): Simply use ec_addm.
15008 * tests/t-mpi-point.c (test_curve): Define curves with positive
15009 coefficients.
15010
15011 2016-04-01 Werner Koch <[email protected]>
15012
15013 mpi: Explicitly limit the allowed input length for gcry_mpi_scan.
15014 + commit 862cf19a119427dd7ee7959a36c72d905f5ea5ca
15015 * mpi/mpicoder.c (MAX_EXTERN_SCAN_BYTES): New.
15016 (mpi_fromstr): Check against this limit.
15017 (_gcry_mpi_scan): Ditto.
15018 * tests/mpitests.c (test_maxsize): New.
15019 (main): Cal that test.
15020
15021 2016-03-31 Werner Koch <[email protected]>
15022
15023 cipher: Remove specialized rmd160 functions.
15024 + commit fcce0cb6e8af70b134c6ecc3f56afa07a7d31f27
15025 * cipher/rmd160.c: Replace rmd.h by hash-common.h.
15026 (RMD160_CONTEXT): Move from rmd.h to here.
15027 (_gcry_rmd160_init): Remove.
15028 (_gcry_rmd160_mixblock): Remove.
15029 (_gcry_rmd160_hash_buffer): Use rmd160_init directly.
15030 * cipher/md.c: Remove rmd.h which was not actually used.
15031 * cipher/rmd.h: Remove.
15032 * cipher/Makefile.am (libcipher_la_SOURCES): Remove rmd.h.
15033 * configure.ac (USE_RMD160): Allow to build without RMD160.
15034
15035 random: Replace RMD160 by SHA-1 for mixing the CSPRNG pool.
15036 + commit a9cbe2d1f6a517a831517da8bc1d29e3e0b2c0c0
15037 * cipher/sha1.c (_gcry_sha1_mixblock_init): New.
15038 (_gcry_sha1_mixblock): New.
15039 * random/random-csprng.c: Include sha1.h instead of rmd.h.
15040 (mix_pool): Use SHA-1 instead of RIPE-MD-160 for mixing.
15041
15042 cipher: Move sha1 context definition to a separate file.
15043 + commit 142a479a484cb4e84d0561be9b05b44dac9e6fe2
15044 * cipher/sha1.c: Replace hash-common.h by sha1.h.
15045 (SHA1_CONTEXT): Move to ...
15046 * cipher/sha1.h: new. Always include all flags.
15047 * cipher/Makefile.am (libcipher_la_SOURCES): Add sha1.h.
15048
15049 2016-03-29 Werner Koch <[email protected]>
15050
15051 tests: Fix buffer overflow in bench-slope.
15052 + commit 48ee918400762281bec5b6fc218a9f0d119aac7c
15053 * tests/bench-slope.c (bench_print_result_std): Remove wrong use of
15054 strncat.
15055
15056 2016-03-27 Jussi Kivilinna <[email protected]>
15057
15058 cipher: GCM: check that length of supplied tag is one of valid lengths.
15059 + commit f2260e3a2e962ac80124ef938e54041bbea08561
15060 * cipher/cipher-gcm.c (is_tag_length_valid): New.
15061 (_gcry_cipher_gcm_tag): Check that 'outbuflen' has valid tag length.
15062 * tests/basic.c (_check_gcm_cipher): Add test-vectors with different
15063 valid tag lengths and negative test vectors with invalid lengths.
15064
15065 2016-03-24 Peter Wu <[email protected]>
15066
15067 cipher: Fix memleaks in (self)tests.
15068 + commit 4a064e2a06fe737f344d1dfd8a45cc4c2abbe4c9
15069 * cipher/dsa.c: Release memory for MPI and sexp structures.
15070 * cipher/ecc.c: Release memory for sexp structure.
15071 * tests/keygen.c: Likewise.
15072
15073 Mark constant MPIs as non-leaked.
15074 + commit 470a30db241a2d567739ef2adb2a2ee64992d8b4
15075 * mpi/mpiutil.c: Mark "constant" MPIs as explicitly leaked.
15076
15077 2016-03-23 Werner Koch <[email protected]>
15078
15079 Add new control GCRYCTL_GET_TAGLEN for use with gcry_cipher_info.
15080 + commit fea5971488e049f902d7912df22a945bc755ad6d
15081 * src/gcrypt.h.in (GCRYCTL_GET_TAGLEN): New.
15082 * cipher/cipher.c (_gcry_cipher_info): Add GCRYCTL_GET_TAGLEN feature.
15083
15084 * tests/basic.c (_check_gcm_cipher): Check that new feature.
15085 (_check_poly1305_cipher): Ditto.
15086 (check_ccm_cipher): Ditto.
15087 (do_check_ocb_cipher): Ditto.
15088 (check_ctr_cipher): Add negative test for new feature.
15089
15090 cipher: Avoid NULL-segv in GCM mode if a key has not been set.
15091 + commit e709d86fe596a4bcf235799468947c13ae657d78
15092 * cipher/cipher-gcm.c (_gcry_cipher_gcm_encrypt): Check that GHASH_FN
15093 has been initialized.
15094 (_gcry_cipher_gcm_decrypt): Ditto.
15095 (_gcry_cipher_gcm_authenticate): Ditto.
15096 (_gcry_cipher_gcm_initiv): Ditto.
15097 (_gcry_cipher_gcm_tag): Ditto.
15098
15099 cipher: Check length of supplied tag in _gcry_cipher_poly1305_check_tag.
15100 + commit 7c9c82feecf94a455c66d9c38576f36c9c4b484c
15101 * cipher/cipher-poly1305.c (_gcry_cipher_poly1305_tag): Check that the
15102 provided tag length matches the actual tag length.
15103
15104 2016-03-23 Peter Wu <[email protected]>
15105
15106 Fix buffer overrun in gettag for Poly1305.
15107 + commit 6821e1bd94969106a70e3de17b86f6e6181f4e59
15108 * cipher/cipher-poly1305.c: copy a fixed length instead of the
15109 user-supplied number.
15110
15111 2016-03-23 Werner Koch <[email protected]>
15112
15113 cipher: Check length of supplied tag in _gcry_cipher_gcm_check_tag.
15114 + commit 15785bc9fb1787554bf371945ecb191830c15bfd
15115 * cipher/cipher-gcm.c (_gcry_cipher_gcm_tag): Check that the provided
15116 tag length matches the actual tag length. Avoid gratuitous return
15117 statements.
15118
15119 2016-03-23 Peter Wu <[email protected]>
15120
15121 Fix buffer overrun in gettag for GCM.
15122 + commit d3d7bdf8215275b3b20690dfde3f43dbe25b6f85
15123 * cipher/cipher-gcm.c: copy a fixed length instead of the user-supplied
15124 number.
15125
15126 2016-03-22 Werner Koch <[email protected]>
15127
15128 tests: Add options --fips to keygen for manual tests.
15129 + commit d328095dd4de83b839d9d8c4bdbeec0956971016
15130 (main): Add option --fips.
15131 * tests/keygen.c (check_rsa_keys): Create an 2048 bit key with e=65539
15132 because that is valid in FIPS mode. Check that key generation fails
15133 for too short keys in FIPS mode.
15134 (check_ecc_keys): Check that key generation fails for Ed25519 keys in
15135 FIPS mode.
15136
15137 2016-03-22 Tomáš Mráz <[email protected]>
15138
15139 rsa: Add FIPS 186-4 compliant RSA probable prime key generator.
15140 + commit 5f9b3c2e220ca6d0eaff32324a973ef67933a844
15141 * cipher/primegen.c (_gcry_fips186_4_prime_check): New.
15142 * cipher/rsa.c (generate_fips): New.
15143 (rsa_generate): Use new function in fips mode or with test-parms.
15144
15145 * tests/keygen.c (check_rsa_keys): Add test using e=65539.
15146
15147 2016-03-20 Jussi Kivilinna <[email protected]>
15148
15149 Fix ARM NEON support detection on ARMv6 target.
15150 + commit 583919d70763671ed9feeaa14e1f66379aff88cc
15151 * configure.ac (gcry_cv_gcc_inline_asm_neon): Use '.arm' directive
15152 instead of '.thumb'.
15153
15154 2016-03-18 Werner Koch <[email protected]>
15155
15156 Always require a 64 bit integer type.
15157 + commit 897ccd21b7221982806b5c024518f4e989152f14
15158 * configure.ac (available_digests_64): Merge with available_digests.
15159 (available_kdfs_64): Merge with available_kdfs.
15160 <64 bit datatype test>: Bail out if no such type is available.
15161 * src/types.h: Emit #error if no u64 can be defined.
15162 (PROPERLY_ALIGNED_TYPE): Always add u64 type.
15163 * cipher/bithelp.h: Remove all code paths which handle the
15164 case of !HAVE_U64_TYPEDEF.
15165 * cipher/bufhelp.h: Ditto.
15166 * cipher/cipher-ccm.c: Ditto.
15167 * cipher/cipher-gcm.c: Ditto.
15168 * cipher/cipher-internal.h: Ditto.
15169 * cipher/cipher.c: Ditto.
15170 * cipher/hash-common.h: Ditto.
15171 * cipher/md.c: Ditto.
15172 * cipher/poly1305.c: Ditto.
15173 * cipher/scrypt.c: Ditto.
15174 * cipher/tiger.c: Ditto.
15175 * src/g10lib.h: Ditto.
15176 * tests/basic.c: Ditto.
15177 * tests/bench-slope.c: Ditto.
15178 * tests/benchmark.c: Ditto.
15179
15180 2016-03-18 Vitezslav Cizek <[email protected]>
15181
15182 tests: Fix testsuite after the FIPS adjustments.
15183 + commit 9ecc2690181ba0bb44f66451a7dce2fc19965793
15184 * tests/benchmark.c (ecc_bench): Avoid not approved curves in FIPS.
15185 * tests/curves.c (check_get_params): Skip Brainpool curves in FIPS.
15186 * tests/keygen.c (check_dsa_keys): Generate 2048 and 3072 bits keys.
15187 (check_ecc_keys): Skip Ed25519 in FIPS mode.
15188 * tests/random.c (main): Don't switch DRBG in FIPS mode.
15189 * tests/t-ed25519.c (main): Ed25519 isn't supported in FIPS mode.
15190 * tests/t-kdf.c (check_openpgp): Skip vectors using md5 in FIPS.
15191 * tests/t-mpi-point.c (context_param): Skip P-192 and Ed25519 in FIPS.
15192 (main): Skip math tests that use P-192 and Ed25519 in FIPS.
15193
15194 tests: Add new --pss option to fipsdrv.
15195 + commit 1a02d741cacc3b57fe3d6ffebd794d53a60c9e97
15196 * tests/fipsdrv.c (run_rsa_sign, run_rsa_verify): Set salt-length
15197 to 0 for PSS.
15198
15199 cipher: Add option to specify salt length for PSS verification.
15200 + commit 0bd8137e68c201b6c2290710e348aaf57efa2b2e
15201 * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi): Check for
15202 salt-length token.
15203
15204 tests: Add support for RSA keygen tests to fipsdrv.
15205 + commit 2e139456369a834cf87d983da4f61241fda76efe
15206 * tests/fipsdrv.c (run_rsa_keygen): New.
15207 (main): Support RSA keygen and RSA keygen KAT tests.
15208
15209 tests: Fixes for RSA testsuite in FIPS mode.
15210 + commit c690230af5a66b809f8f6fbab1a6262a5ba078cb
15211 * tests/basic.c (get_keys_new): Generate 2048 bit key.
15212 * tests/benchmark.c (rsa_bench): Skip keys of lengths different
15213 than 2048 and 3072 in FIPS mode.
15214 * tests/keygen.c (check_rsa_keys): Failure if short keys can be
15215 generated in FIPS mode.
15216 (check_dsa_keys): Ditto for DSA keys.
15217 * tests/pubkey.c (check_x931_derived_key): Skip keys < 2048 in FIPS.
15218
15219 rsa: Use 2048 bit RSA keys for selftest.
15220 + commit 78cec8b4754fdf774edb2d575000cb3e972e244c
15221 * cipher/rsa.c (selftests_rsa): Use 2048 bit keys.
15222 (selftest_encr_1024): Replaced by selftest_encr_2048.
15223 (selftest_sign_1024): Replaced by selftest_sign_2048.
15224 (selftest_encr_2048): Add check against known ciphertext.
15225 (selftest_sign_2048): Add check against known signature.
15226 (selftest_sign_2048): Free SIG_MPI.
15227 * tests/pubkey.c (get_keys_new): Generate 2048 bit keys.
15228
15229 Disable non-allowed algorithms in FIPS mode.
15230 + commit ce1cbe16992a7340edcf8e6576973e3508267640
15231 * cipher/cipher.c (_gcry_cipher_init),
15232 * cipher/mac.c (_gcry_mac_init),
15233 * cipher/md.c (_gcry_md_init),
15234 * cipher/pubkey.c (_gcry_pk_init): In the FIPS mode, disable all the
15235 non-allowed ciphers.
15236 * cipher/md5.c: Mark MD5 as not allowed in FIPS.
15237 * src/g10lib.h (_gcry_mac_init): New.
15238 * src/global.c (global_init): Call the new _gcry_mac_init.
15239 * tests/basic.c (check_ciphers): Fix a typo.
15240
15241 2016-03-18 Werner Koch <[email protected]>
15242
15243 kdf: Make PBKDF2 check work on all platforms.
15244 + commit c478cf175887c84dc071c4f73a7667603b354789
15245 * cipher/kdf.c (_gcry_kdf_pkdf2): Chnage DKLEN to unsigned long.
15246
15247 2016-03-18 Vitezslav Cizek <[email protected]>
15248
15249 kdf: Add upper bound for derived key length in PBKDF2.
15250 + commit 0f741b0704bac5c0e2d2a0c2b34b44b35baa76d6
15251 * cipher/kdf.c (_gcry_kdf_pkdf2): limit dkLen.
15252
15253 ecc: ECDSA adjustments for FIPS 186-4.
15254 + commit a242e3d9185e6e2dc13902ea9331131755bbba01
15255 * cipher/ecc-curves.c: Unmark curve P-192 for FIPS.
15256 * cipher/ecc.c: Add ECDSA self test.
15257 * cipher/pubkey-util.c (_gcry_pk_util_init_encoding_ctx): Use SHA-2
15258 in FIPS mode.
15259 * tests/fipsdrv.c: Add support for ECDSA signatures.
15260
15261 2016-03-18 Werner Koch <[email protected]>
15262
15263 dsa: Make regression tests work.
15264 + commit e40939b2141306238cc30a340b867b60fa4dc2a3
15265 * cipher/dsa.c (sample_secret_key_1024): Comment out unused constant.
15266 (ogenerate_fips186): Make it work with use-fips183-2 flag.
15267 * cipher/primegen.c (_gcry_generate_fips186_3_prime): Use Emacs
15268 standard comment out format.
15269 * tests/fips186-dsa.c (check_dsa_gen_186_3): New dummy fucntion.
15270 (main): Call it.
15271 (main): Compare against current version.
15272 * tests/pubkey.c (get_dsa_key_fips186_new): Create 2048 bit key.
15273 (get_dsa_key_fips186_with_seed_new): Ditto.
15274 (get_dsa_key_fips186_with_domain_new): Comment out.
15275 (check_run): Do not call that function.
15276
15277 2016-03-18 Vitezslav Cizek <[email protected]>
15278
15279 dsa: Adjustments to conform with FIPS 186-4.
15280 + commit 80e9f95e6f419daa765e4876c858e3e36e808897
15281 * cipher/dsa.c (generate_fips186): FIPS 186-4 adjustments.
15282 * cipher/primegen.c (_gcry_generate_fips186_3_prime): Fix incorrect
15283 buflen passed to _gcry_mpi_scan.
15284
15285 2016-03-16 Justus Winter <[email protected]>
15286
15287 Update documentation for 'gcry_sexp_extract_param'.
15288 + commit 4051fe7fec6ffdc7a2f5c3856665478866991ee7
15289 * doc/gcrypt.texi (gcry_sexp_extract_param): Mention that all MIPs
15290 must be set to NULL first, and document how the function behaves in
15291 case of errors.
15292 * src/sexp.c (_gcry_sexp_extract_param): Likewise.
15293 * src/gcrypt.h.in (gcry_sexp_extract_param): Copy the comment from
15294 '_gcry_sexp_extract_param'.
15295
15296 cipher: Update comment.
15297 + commit fcf4358a7a7ba8d32bf385ea99ced5f47cbd3ae2
15298 * cipher/ecc.c (ecc_get_nbits): Update comment to reflect the fact
15299 that a curve parameter can be given.
15300
15301 2016-03-12 Jussi Kivilinna <[email protected]>
15302
15303 Add Intel PCLMUL implementations of CRC algorithms.
15304 + commit 5d601dd57fcb41aa2015ab655fd6fc51537da667
15305 * cipher/Makefile.am: Add 'crc-intel-pclmul.c'.
15306 * cipher/crc-intel-pclmul.c: New.
15307 * cipher/crc.c (USE_INTEL_PCLMUL): New macro.
15308 (CRC_CONTEXT) [USE_INTEL_PCLMUL]: Add 'use_pclmul'.
15309 [USE_INTEL_PCLMUL] (_gcry_crc32_intel_pclmul)
15310 (gcry_crc24rfc2440_intel_pclmul): New.
15311 (crc32_init, crc32rfc1510_init, crc24rfc2440_init)
15312 [USE_INTEL_PCLMUL]: Select PCLMUL implementation if SSE4.1 and PCLMUL
15313 HW features detected.
15314 (crc32_write, crc24rfc2440_write) [USE_INTEL_PCLMUL]: Use PCLMUL
15315 implementation if enabled.
15316 (crc24_init): Document storage format of 24-bit CRC.
15317 (crc24_next4): Use only 'data' for last table look-up.
15318 * configure.ac: Add 'crc-intel-pclmul.lo'.
15319 * src/g10lib.h (HWF_*, HWF_INTEL_SSE4_1): Update HWF flags to include
15320 Intel SSE4.1.
15321 * src/hwf-x86.c (detect_x86_gnuc): Add SSE4.1 detection.
15322 * src/hwfeatures.c (hwflist): Add 'intel-sse4.1'.
15323 * tests/basic.c (fillbuf_count): New.
15324 (check_one_md): Add "?" check (million byte data-set with byte pattern
15325 0x00,0x01,0x02,...); Test all buffer sizes 1 to 1000, for "!" and "?"
15326 checks.
15327 (check_one_md_multi): Skip "?".
15328 (check_digests): Add "?" test-vectors for MD5, SHA1, SHA224, SHA256,
15329 SHA384, SHA512, SHA3_224, SHA3_256, SHA3_384, SHA3_512, RIPEMD160,
15330 CRC32, CRC32_RFC1510, CRC24_RFC2440, TIGER1 and WHIRLPOOL; Add "!"
15331 test-vectors for CRC32_RFC1510 and CRC24_RFC2440.
15332
15333 2016-02-25 NIIBE Yutaka <[email protected]>
15334
15335 mpi: Normalize EXPO for mpi_powm.
15336 + commit fdfa5bfefdde316688a3c8021bd3528c5273b0f4
15337 * mpi/mpi-pow.c (gcry_mpi_powm): Normalize EP.
15338
15339 2016-02-22 Andreas Metzler <[email protected]>
15340
15341 Do not ship generated header file in tarball.
15342 + commit 2b40a16333fa75f1cee85ab901a5aa9cff845a92
15343 * src/Makefile.am: Move gcrypt.h from include_HEADERS to
15344 nodist_include_HEADERS to prevent inclusion in release tarball.
15345 This could break out-of-tree-builds because the potentially outdated
15346 src/gcrypt.h was not updated but was in the compiler search path.
15347
15348 2016-02-20 Jussi Kivilinna <[email protected]>
15349
15350 Fix building random-drbg for Win32/64.
15351 + commit 531b25aa94c58f6d2168a9537c8cea6c53d7bbe0
15352 * random/random-drbg.c: Remove include for sys/types.h and asm/types.h.
15353 (DRBG_PREDICTION_RESIST, DRBG_CTRAES, DRBG_CTRSERPENT, DRBG_CTRTWOFISH)
15354 (DRBG_HASHSHA1, DRBG_HASHSHA224, DRBG_HASHSHA256, DRBG_HASHSHA384)
15355 (DRBG_HASHSHA512, DRBG_HMAC, DRBG_SYM128, DRBG_SYM192)
15356 (DRBG_SYM256): Change 'u_int32_t' to 'u32'.
15357 (drbg_get_entropy) [USE_RNDUNIX, USE_RNDW32]: Fix parameters
15358 'drbg_read_cb' and 'len'.
15359
15360 2016-02-20 Werner Koch <[email protected]>
15361
15362 tests: Do not test DRBG_REINIT from "make check"
15363 + commit 839d12c221430b60db5e0d6fbb107f22e0a6837f
15364 * tests/random.c (main): Run check_drbg_reinit only if the envvar
15365 GCRYPT_IN_REGRESSION_TEST is set.
15366
15367 doc: Fix possible dependency problem.
15368 + commit 3b57e5a1ba68e26dcaea38b763287fddba9b6b7c
15369 * doc/Makefile.am (gcrypt.texi): Use the right traget.
15370
15371 2016-02-19 Stephan Mueller <[email protected]>
15372
15373 random: Remove ANSI X9.31 DRNG.
15374 + commit e9b692d25d1c149b5417b70e18f2ce173bc25b6d
15375 * random-fips.c: Remove.
15376
15377 2016-02-19 Werner Koch <[email protected]>
15378
15379 random: Add a test case for DRBG_REINIT.
15380 + commit 934ba2ae5a95a96fdbb3b935b51ba43df66f11df
15381 * src/global.c (_gcry_vcontrol) <DRBG_REINIT>: Test for FIPS RNG.
15382 * tests/random.c (check_drbg_reinit): New.
15383 (main): Call new test.
15384
15385 random: Allow DRBG_REINIT before initialization.
15386 + commit 7cdbd6e6a3cf1ee366b981e148d41b1187a6fdcf
15387 * random/random-drbg.c (DRBG_DEFAULT_TYPE): New.
15388 (_drbg_init_internal): Set the default type if no type has been set
15389 before.
15390 (_gcry_rngdrbg_inititialize): Pass 0 for flags to use the default.
15391
15392 Add new private header gcrypt-testapi.h.
15393 + commit 744b030cff61fd25114b0b25394c62782c153343
15394 * src/gcrypt-testapi.h: New.
15395 * src/Makefile.am (libgcrypt_la_SOURCES): Add new file.
15396 * random/random.h: Include gcrypt-testapi.h.
15397 (struct gcry_drbg_test_vector) : Move to gcrypt-testapi.h.
15398 * src/global.c: Include gcrypt-testapi.h.
15399 (_gcry_vcontrol): Use PRIV_CTL_* constants instead of 58, 59, 60, 61.
15400 * cipher/cipher.c: Include gcrypt-testapi.h.
15401 (_gcry_cipher_ctl): Use PRIV_CIPHERCTL_ constants instead of 61, 62.
15402 * tests/fipsdrv.c: Include gcrypt-testapi.h. Remove definition of
15403 PRIV_CTL_ constants and replace their use by the new PRIV_CIPHERCTL_
15404 constants.
15405 * tests/t-lock.c: Include gcrypt-testapi.h. Remove
15406 PRIV_CTL_EXTERNAL_LOCK_TEST and EXTERNAL_LOCK_TEST_ constants.
15407
15408 * random/random-drbg.c (gcry_rngdrbg_cavs_test): Rename to ...
15409 (_gcry_rngdrbg_cavs_test): this.
15410 (gcry_rngdrbg_healthcheck_one): Rename to ...
15411 (_gcry_rngdrbg_healthcheck_one): this.
15412
15413 random: Make the DRBG C-90 clean and use a flag string.
15414 + commit 95f1db3affb9f5b8a2c814c211d4a02b30446c15
15415 * random/random.h (struct gcry_drbg_test_vector): Rename "flags" to
15416 "flagstr" and turn it into a string.
15417 * random/random-drbg.c (drbg_test_pr, drbg_test_nopr): Replace use of
15418 designated initializers. Use a string for the flags.
15419 (gcry_rngdrbg_cavs_test): Parse the flag string into a flag value.
15420 (drbg_healthcheck_sanity): Ditto.
15421
15422 random: Symbol name cleanup for random-drbg.c.
15423 + commit 85ed07790552297586258e8fe09b546eee357a8b
15424 * random/random-drbg.c: Rename all static objects and macros from
15425 "gcry_drbg" to "drbg".
15426 (drbg_string_t): New typedef.
15427 (drbg_gen_t): New typedef.
15428 (drbg_state_t): New typedef. Replace all "struct drbg_state_s *" by
15429 this.
15430 (_drbg_init_internal): Replace xcalloc_secure by xtrycalloc_secure so
15431 that an error if actually returned.
15432 (gcry_rngdrbg_cavs_test): Ditto.
15433 (gcry_drbg_healthcheck_sanity): Ditto.
15434
15435 random: Use our symbol name pattern also for drbg functions.
15436 + commit 7cf3c929331133e4381dbceac53d3addd921c929
15437 * random/random-drbg.c: Rename global functions from _gcry_drbg_*
15438 to _gcry_rngdrbg_*.
15439 * random/random.c: Adjust for this change.
15440 * src/global.c: Ditto.
15441
15442 random: Rename drbg.c to random-drbg.c.
15443 + commit e49b3f2c10e012509b5930c0df4d6df378d3b9f4
15444 * random/drbg.c: Rename to ...
15445 * random/random-drbg.c: this.
15446 * random/Makefile.am (librandom_la_SOURCES): Adjust accordingly.
15447
15448 random: Remove the new API introduced by the new DRBG.
15449 + commit dfac2b13d0068b2b1b420d77e9771a49964b81c1
15450 * src/gcrypt.h.in (struct gcry_drbg_gen): Move to random/drbg.c.
15451 (struct gcry_drbg_string): Ditto.
15452 (gcry_drbg_string_fill): Ditto.
15453 (gcry_randomize_drbg): Remove.
15454 * random/drbg.c (parse_flag_string): New.
15455 (_gcry_drbg_reinit): Change the way the arguments are passed.
15456 * src/global.c (_gcry_vcontrol) <GCRYCTL_DRBG_REINIT>: Change calling
15457 convention.
15458
15459 Add helper function _gcry_strtokenize.
15460 + commit 4e134b6e77f558730ec1eceb6b816b0bcfd845e9
15461 * src/misc.c (_gcry_strtokenize): New.
15462
15463 2016-02-18 Werner Koch <[email protected]>
15464
15465 random: Remove DRBG constants from the public API.
15466 + commit fd13372fa9069d3a72947ea59c57e33637c936bf
15467 * src/gcrypt.h.in (GCRY_DRBG_): Remove all new flags to ...
15468 * random/drbg.c: here.
15469
15470 2016-02-18 Stephan Mueller <[email protected]>
15471
15472 random: Add SP800-90A DRBG.
15473 + commit ed57fed6de1465e02ec5e3bc0affeabdd35e2eb7
15474 * random/drbg.c: New.
15475 * random/random.c (_gcry_random_initialize): Replace rngfips init by
15476 drbg init.
15477 (__gcry_random_close_fds): Likewise.
15478 (_gcry_random_dump_stats): Likewise.
15479 (_gcry_random_is_faked): Likewise.
15480 (do_randomize): Likewise.
15481 (_gcry_random_selftest): Likewise.
15482 (_gcry_create_nonce): Replace rngfips_create_noce by drbg_randomize.
15483 (_gcry_random_init_external_test): Remove.
15484 (_gcry_random_run_external_test): Remove.
15485 (_gcry_random_deinit_external_test): Remove.
15486 * random/random.h (struct gcry_drbg_test_vector): New.
15487 * src/gcrypt.h.in (struct gcry_drbg_gen): New.
15488 (struct gcry_drbg_string): New.
15489 (gcry_drbg_string_fill): New.
15490 (gcry_randomize_drbg): New.
15491 (GCRY_DRBG_): Lots of new macros.
15492 * src/global.c (_gcry_vcontrol) <Init external random test>: Turn into
15493 a nop.
15494 (_gcry_vcontrol) <Deinit external random test>: Ditto.
15495 (_gcry_vcontrol) <Run external random test>: Change.
15496 (_gcry_vcontrol) <GCRYCTL_DRBG_REINIT>: New.
15497
15498 2016-02-13 Jussi Kivilinna <[email protected]>
15499
15500 bufhelp: disable unaligned memory accesses on powerpc.
15501 + commit 1da793d089b65ac8c1ead65dacb6b8699f5b6e69
15502 * cipher/bufhelp.h (BUFHELP_FAST_UNALIGNED_ACCESS): Disable for
15503 __powerpc__ and __powerpc64__.
15504
15505 2016-02-12 NIIBE Yutaka <[email protected]>
15506
15507 ecc: Not validate input point for Curve25519.
15508 + commit 7a019bc7ecdbdfdef51094e090ce95e062da9b64
15509 * cipher/ecc.c (ecc_decrypt_raw): Curve25519 is an exception.
15510
15511 2016-02-10 NIIBE Yutaka <[email protected]>
15512
15513 ecc: Fix memory leaks on error.
15514 + commit b12dd550fd6af687ef95c584d0d8366c34965cc8
15515 * cipher/ecc.c (ecc_decrypt_raw): Go to leave to release memory.
15516 * mpi/ec.c (_gcry_mpi_ec_curve_point): Likewise.
15517
15518 2016-02-09 NIIBE Yutaka <[email protected]>
15519
15520 ecc: input validation on ECDH.
15521 + commit 23b72901f8a5ba9a78485b235c7a917fbc8faae0
15522 * cipher/ecc.c (ecc_decrypt_raw): Validate the point.
15523
15524 2016-02-08 Jussi Kivilinna <[email protected]>
15525
15526 Add ARM assembly implementation of SHA-512.
15527 + commit 8353884bc65c820d5bcacaf1ac23cdee72091a09
15528 * cipher/Makefile.am: Add 'sha512-arm.S'.
15529 * cipher/sha512-arm.S: New.
15530 * cipher/sha512.c (USE_ARM_ASM): New.
15531 (_gcry_sha512_transform_arm): New.
15532 (transform) [USE_ARM_ASM]: Use ARM assembly implementation instead of
15533 generic.
15534 * configure.ac: Add 'sha512-arm.lo'.
15535
15536 2016-02-03 NIIBE Yutaka <[email protected]>
15537
15538 tests: Add a test for Curve25519.
15539 + commit b8b3361504950689ef1e779fb3357cecf8a9f739
15540 * tests/Makefile.am (tests_bin): Add t-cv25519.
15541 * tests/t-cv25519.c: New.
15542
15543 2016-02-02 NIIBE Yutaka <[email protected]>
15544
15545 ecc: Fix Curve25519 for data by older implementation.
15546 + commit 6cb6df9dddac6ad246002b83c2ce0aaa0ecf30e5
15547 * cipher/ecc-misc.c (gcry_ecc_mont_decodepoint): Fix code path for
15548 short length data.
15549
15550 ecc: more fix of Curve25519.
15551 + commit 48ba5a50066611ecacea850ced13f5cb66097a81
15552 * cipher/ecc-misc.c (gcry_ecc_mont_decodepoint): Fix removing of
15553 prefix. Clear the MSB, according to RFC7748.
15554
15555 ecc: Fix ECDH of Curve25519.
15556 + commit a2f9afcd7fcdafd5951498b07f34957f9766dce9
15557 * cipher/ecc-misc.c (_gcry_ecc_mont_decodepoint): Fix calc of NBITS
15558 and prefix detection.
15559 * cipher/ecc.c (ecc_generate): Use NBITS instead of CTX->NBITS.
15560 (ecc_encrypt_raw): Use NBITS from curve instead of from P.
15561 Fix rawmpilen calculation.
15562 (ecc_decrypt_raw): Likewise. Add debug output.
15563
15564 2016-01-29 Jussi Kivilinna <[email protected]>
15565
15566 Improve performance of generic SHA256 implementation.
15567 + commit f3e51161036382429c3491c7c881f36c0a653c7b
15568 * cipher/sha256.c (R): Let caller do variable shuffling.
15569 (Chro, Maj, Sum0, Sum1): Convert from inline functions to macros.
15570 (W, I): New.
15571 (transform_blk): Unroll round loop; inline message expansion to rounds
15572 to make message expansion buffer smaller.
15573
15574 2016-01-28 Werner Koch <[email protected]>
15575
15576 ecc: New API function gcry_mpi_ec_decode_point.
15577 + commit 2cf2ca7bb9741ac86e8aa92d8f03b1c5f5938897
15578 * mpi/ec.c (_gcry_mpi_ec_decode_point): New.
15579 * cipher/ecc-common.h: Move two prototypes to ...
15580 * src/ec-context.h: here.
15581 * src/gcrypt.h.in (gcry_mpi_ec_decode_point): New.
15582 * src/libgcrypt.def (gcry_mpi_ec_decode_point): New.
15583 * src/libgcrypt.vers (gcry_mpi_ec_decode_point): New.
15584 * src/visibility.c (gcry_mpi_ec_decode_point): New.
15585 * src/visibility.h: Add new function.
15586
15587 2016-01-15 Werner Koch <[email protected]>
15588
15589 Fix build problem for rndegd.c.
15590 + commit 191c2e4fe2dc0e00f61aa44e011a9596887e6ce1
15591 * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Test all RND modules.
15592 * random/rndegd.c (_gcry_rndegd_connect_socket)
15593 (my_make_filename): Use functions with '_' prefix.
15594
15595 random: Fix possible AIX problem with sysconf in rndunix.
15596 + commit 6303b0e83856ee89374b447e710f0ab2af61caec
15597 * random/rndunix.c [HAVE_STDINT_H]: Include stdint.h.
15598 (start_gatherer): Detect misbehaving sysconf.
15599
15600 2015-12-27 Werner Koch <[email protected]>
15601
15602 random: Take at max 25% from RDRAND.
15603 + commit 5a78e7f15e0dd96a8bf64e2bb142880bf8ea6965
15604 * random/rndlinux.c (_gcry_rndlinux_gather_random): Change use of
15605 RDRAND from 50% to 25%.
15606
15607 2015-12-07 Justus Winter <[email protected]>
15608
15609 cipher: Improve error handling.
15610 + commit b9c02fbeb7efb7d0593b33485fb30c298291cf80
15611 * cipher/ecc.c (ecc_decrypt_raw): Improve error handling.
15612
15613 cipher: Initialize 'flags'.
15614 + commit ca06cd7f77acb317c2649c58918908f043dfe6bd
15615 * cipher/ecc.c (ecc_encrypt_raw): Initialize 'flags' to 0.
15616
15617 2015-12-05 NIIBE Yutaka <[email protected]>
15618
15619 ecc: CHANGE point representation of Curve25519.
15620 + commit dd3d06e7f113cf7608f060ceb043262efd0b0c9d
15621 * cipher/ecc-misc.c (_gcry_ecc_mont_decodepoint): Decode point with
15622 the prefix 0x40, additional 0x00 by MPI handling, and shorter octets
15623 by MPI normalization.
15624 * cipher/ecc.c (ecc_generate, ecc_encrypt_raw, ecc_decrypt_raw):
15625 Always add the prefix 0x40.
15626
15627 2015-12-03 Jussi Kivilinna <[email protected]>
15628
15629 chacha20: fix alignment of self-test context.
15630 + commit 6fadbcd088e2af3e48407b95d8d0c2a8b7ad6c38
15631 * cipher/chacha20.c (selftest): Ensure 16-byte alignment for chacha20
15632 context structure.
15633
15634 salsa20: fix alignment of self-test context.
15635 + commit 2cba0dbda462237f55438d4199eccd10c5e3f6ca
15636 * cipher/salsa20.c (selftest): Ensure 16-byte alignment for salsa20
15637 context structure.
15638
15639 2015-12-02 Justus Winter <[email protected]>
15640
15641 random: Drop fake entropy gathering function.
15642 + commit d421ac283ec46d0ecaf6278ba4c24843f65fb2fa
15643 * random/random-csprng.c (faked_rng): Drop variable.
15644 (gather_faked): Drop prototype and function.
15645 (initialize): Drop fallback code.
15646 (_gcry_rngcsprng_is_faked): Change accordingly.
15647
15648 random: Fix selection of entropy gathering function.
15649 + commit 468a5796ffb1a7776db4004d534376c1b981d740
15650 * random/random-csprng.c (getfnc_gather_random): Do return NULL if no
15651 usable entropy gathering function is found. The callsite then
15652 installs the fake gather function.
15653
15654 2015-11-26 NIIBE Yutaka <[email protected]>
15655
15656 ecc: minor improvement of point multiplication.
15657 + commit 3658afd09c3b03b4398aaa5748387220c93b1a94
15658 * mpi/ec.c (_gcry_mpi_ec_mul_point): Move ec_subm out of the loop.
15659
15660 2015-11-25 NIIBE Yutaka <[email protected]>
15661
15662 ecc: Constant-time multiplication for Weierstrass curve.
15663 + commit 88e1358962e902ff1cbec8d53ba3eee46407851a
15664 * mpi/ec.c (_gcry_mpi_ec_mul_point): Use simple left-to-right binary
15665 method for Weierstrass curve when SCALAR is secure.
15666
15667 mpi: fix gcry_mpi_swap_cond.
15668 + commit f88adee3e1f3e2de7d63f92f90bfb3078afd3b4f
15669 * mpi/mpiutil.c (_gcry_mpi_swap_cond): Relax the condition.
15670
15671 mpi: Fix mpi_set_cond and mpi_swap_cond .
15672 + commit 8ad682c412047d3b9196950709dbd7bd14ac8732
15673 * mpi/mpiutil.c (_gcry_mpi_set_cond, _gcry_mpi_swap_cond): Don't use
15674 the operator of !!, but assume SET/SWAP is 0 or 1.
15675
15676 ecc: multiplication of Edwards curve to be constant-time.
15677 + commit 295b1c3540752af4fc5e6f41480e6db215222fba
15678 * mpi/ec.c (_gcry_mpi_ec_mul_point): Use point_swap_cond.
15679
15680 ecc: Add point_resize and point_swap_cond.
15681 + commit b6015176df6bfae107ac82f9baa29ef2c175c9f9
15682 * mpi/ec.c (point_resize, point_swap_cond): New.
15683 (_gcry_mpi_ec_mul_point): Use point_resize and point_swap_cond.
15684
15685 2015-11-18 Justus Winter <[email protected]>
15686
15687 cipher: Fix error handling.
15688 + commit 940dc8adc034a6c6c38742f6bfd7d837a532d537
15689 * cipher/cipher.c (_gcry_cipher_ctl): Fix error handling.
15690
15691 2015-11-18 Jussi Kivilinna <[email protected]>
15692
15693 Tweak Keccak for small speed-up.
15694 + commit 6571a64331839d7d952292163afbf34c8bef62e0
15695 * cipher/keccak_permute_32.h (KECCAK_F1600_PERMUTE_FUNC_NAME): Track
15696 rounds with round constant pointer instead of separate round counter.
15697 * cipher/keccak_permute_64.h (KECCAK_F1600_PERMUTE_FUNC_NAME): Ditto.
15698 (KECCAK_F1600_ABSORB_FUNC_NAME): Tweak lanes pointer increment for bulk
15699 absorb loops.
15700
15701 Update license information for CRC.
15702 + commit 15ea0acf8bb0aa307eccc23024a0bd7878fb8080
15703 * LICENSES: Remove 'Simple permissive' and 'IETF permissive' licenses
15704 for 'cipher/crc.c' as result of rewrite of CRC implementations.
15705
15706 2015-11-17 Justus Winter <[email protected]>
15707
15708 Fix typos found using codespell.
15709 + commit 0e395944b70c7a92a6437f6bcc14f287c19ce9de
15710 * cipher/cipher-ocb.c: Fix typos.
15711 * cipher/des.c: Likewise.
15712 * cipher/dsa-common.c: Likewise.
15713 * cipher/ecc.c: Likewise.
15714 * cipher/pubkey.c: Likewise.
15715 * cipher/rsa-common.c: Likewise.
15716 * cipher/scrypt.c: Likewise.
15717 * random/random-csprng.c: Likewise.
15718 * random/random-fips.c: Likewise.
15719 * random/rndw32.c: Likewise.
15720 * src/cipher-proto.h: Likewise.
15721 * src/context.c: Likewise.
15722 * src/fips.c: Likewise.
15723 * src/gcrypt.h.in: Likewise.
15724 * src/global.c: Likewise.
15725 * src/sexp.c: Likewise.
15726 * tests/mpitests.c: Likewise.
15727 * tests/t-lock.c: Likewise.
15728
15729 2015-11-01 Jussi Kivilinna <[email protected]>
15730
15731 Improve performance of Tiger hash algorithms.
15732 + commit 89fa74d6b3e58cd4fcd6e0939a35e46cbaca2ea0
15733 * cipher/tiger.c (tiger_round, pass, key_schedule): Convert functions
15734 to macros.
15735 (transform_blk): Pass variable names instead of pointers to 'pass'.
15736
15737 Add ARMv7/NEON implementation of Keccak.
15738 + commit a1cc7bb15473a2419b24ecac765ae0ce5989a13b
15739 * cipher/Makefile.am: Add 'keccak-armv7-neon.S'.
15740 * cipher/keccak-armv7-neon.S: New.
15741 * cipher/keccak.c (USE_64BIT_ARM_NEON): New.
15742 (NEED_COMMON64): Select if USE_64BIT_ARM_NEON.
15743 [NEED_COMMON64] (round_consts_64bit): Rename to...
15744 [NEED_COMMON64] (_gcry_keccak_round_consts_64bit): ...this; Add
15745 terminator at end.
15746 [USE_64BIT_ARM_NEON] (_gcry_keccak_permute_armv7_neon)
15747 (_gcry_keccak_absorb_lanes64_armv7_neon, keccak_permute64_armv7_neon)
15748 (keccak_absorb_lanes64_armv7_neon, keccak_armv7_neon_64_ops): New.
15749 (keccak_init) [USE_64BIT_ARM_NEON]: Select ARM/NEON implementation
15750 if supported by HW.
15751 * cipher/keccak_permute_64.h (KECCAK_F1600_PERMUTE_FUNC_NAME): Update
15752 to use new round constant table.
15753 * configure.ac: Add 'keccak-armv7-neon.lo'.
15754
15755 Optimize Keccak 64-bit absorb functions.
15756 + commit 2857cb89c6dc1c02266600bc1fd2967a3cd5cf88
15757 * cipher/keccak.c [USE_64BIT] [__x86_64__] (absorb_lanes64_8)
15758 (absorb_lanes64_4, absorb_lanes64_2, absorb_lanes64_1): New.
15759 * cipher/keccak.c [USE_64BIT] [!__x86_64__] (absorb_lanes64_8)
15760 (absorb_lanes64_4, absorb_lanes64_2, absorb_lanes64_1): New.
15761 [USE_64BIT] (KECCAK_F1600_ABSORB_FUNC_NAME): New.
15762 [USE_64BIT] (keccak_absorb_lanes64): Remove.
15763 [USE_64BIT_SHLD] (KECCAK_F1600_ABSORB_FUNC_NAME): New.
15764 [USE_64BIT_SHLD] (keccak_absorb_lanes64_shld): Remove.
15765 [USE_64BIT_BMI2] (KECCAK_F1600_ABSORB_FUNC_NAME): New.
15766 [USE_64BIT_BMI2] (keccak_absorb_lanes64_bmi2): Remove.
15767 * cipher/keccak_permute_64.h (KECCAK_F1600_ABSORB_FUNC_NAME): New.
15768
15769 2015-10-31 Jussi Kivilinna <[email protected]>
15770
15771 Enable CRC test vectors with zero bytes.
15772 + commit 07e4839e75a7bca3a6c0a94aecfe75efe61d7ff2
15773 * tests/basic.c (check_digests): Enable CRC test-vectors with zero
15774 bytes.
15775
15776 Keccak: Add SHAKE Extendable-Output Functions.
15777 + commit c0b9eee2d93a13930244f9ce0c14ed6b4aeb6c29
15778 * src/hash-common.c (_gcry_hash_selftest_check_one): Add handling for
15779 XOFs.
15780 * src/keccak.c (keccak_ops_t): Rename 'extract_inplace' to 'extract'
15781 and add 'pos' argument.
15782 (KECCAK_CONTEXT): Add 'suffix'.
15783 (keccak_extract_inplace64): Rename to...
15784 (keccak_extract64): ...this; Add handling for 'pos' argument.
15785 (keccak_extract_inplace32bi): Rename to...
15786 (keccak_extract32bi): ...this; Add handling for 'pos' argument.
15787 (keccak_extract_inplace64): Rename to...
15788 (keccak_extract64): ...this; Add handling for 'pos' argument.
15789 (keccak_extract_inplace32bi_bmi2): Rename to...
15790 (keccak_extract32bi_bmi2): ...this; Add handling for 'pos' argument.
15791 (keccak_init): Setup 'suffix'; add SHAKE128 & SHAKE256.
15792 (shake128_init, shake256_init): New.
15793 (keccak_final): Do not initial permute for SHAKE output; use correct
15794 suffix for SHAKE.
15795 (keccak_extract): New.
15796 (keccak_selftests_keccak): Add SHAKE128 & SHAKE256 test-vectors.
15797 (run_selftests): Add SHAKE128 & SHAKE256.
15798 (shake128_asn, oid_spec_shake128, shake256_asn, oid_spec_shake256)
15799 (_gcry_digest_spec_shake128, _gcry_digest_spec_shake256): New.
15800 * cipher/md.c (digest_list): Add SHAKE128 & SHAKE256.
15801 * doc/gcrypt.texi: Ditto.
15802 * src/cipher.h (_gcry_digest_spec_shake128)
15803 (_gcry_digest_spec_shake256): New.
15804 * src/gcrypt.h.in (GCRY_MD_SHAKE128, GCRY_MD_SHAKE256): New.
15805 * tests/basic.c (check_one_md): Add XOF check; Add 'elen' argument.
15806 (check_one_md_multi): Skip if algo is XOF.
15807 (check_digests): Add SHAKE128 & SHAKE256 test vectors.
15808 * tests/bench-slope.c (kdf_bench_one): Skip XOFs.
15809
15810 Few updates to documentation.
15811 + commit 28de6f9e16e386018e81a9cdaee596be7616ccab
15812 * doc/gcrypt.text: Add mention of new 'intel-fast-shld' hw feature
15813 flag; Add mention of x86 RDRAND support in rndhw.
15814
15815 Add HMAC-SHA3 test vectors.
15816 + commit 92ad19873562cfce7bcc4a0b5aed8195d8284cfc
15817 * tests/basic.c (check_mac): Add HMAC_SHA3 test vectors.
15818
15819 2015-10-28 Jussi Kivilinna <[email protected]>
15820
15821 md: add variable length output interface.
15822 + commit 577dc2b63ceca6a8a716256d034ea4e7414f65fa
15823 * cipher/crc.c (_gcry_digest_spec_crc32)
15824 (_gcry_digest_spec_crc32_rfc1510, _gcry_digest_spec_crc24_rfc2440): Set
15825 'extract' NULL.
15826 * cipher/gostr3411-94.c (_gcry_digest_spec_gost3411_94)
15827 (_gcry_digest_spec_gost3411_cp): Ditto.
15828 * cipher/keccak.c (_gcry_digest_spec_sha3_224)
15829 (_gcry_digest_spec_sha3_256, _gcry_digest_spec_sha3_384)
15830 (_gcry_digest_spec_sha3_512): Ditto.
15831 * cipher/md2.c (_gcry_digest_spec_md2): Ditto.
15832 * cipher/md4.c (_gcry_digest_spec_md4): Ditto.
15833 * cipher/md5.c (_gcry_digest_spec_md5): Ditto.
15834 * cipher/rmd160.c (_gcry_digest_spec_rmd160): Ditto.
15835 * cipher/sha1.c (_gcry_digest_spec_sha1): Ditto.
15836 * cipher/sha256.c (_gcry_digest_spec_sha224)
15837 (_gcry_digest_spec_sha256): Ditto.
15838 * cipher/sha512.c (_gcry_digest_spec_sha384)
15839 (_gcry_digest_spec_sha512): Ditto.
15840 * cipher/stribog.c (_gcry_digest_spec_stribog_256)
15841 (_gcry_digest_spec_stribog_512): Ditto.
15842 * cipher/tiger.c (_gcry_digest_spec_tiger)
15843 (_gcry_digest_spec_tiger1, _gcry_digest_spec_tiger2): Ditto.
15844 * cipher/whirlpool.c (_gcry_digest_spec_whirlpool): Ditto.
15845 * cipher/md.c (md_enable): Do not allow combination of HMAC and
15846 'expandable-output function'.
15847 (md_final): Check if spec->read is NULL before calling.
15848 (md_read): Ditto.
15849 (md_extract, _gcry_md_extract): New.
15850 * doc/gcrypt.texi: Add SHA3 algorithms and gcry_md_extract.
15851 * src/cipher-proto.h (gcry_md_extract_t): New.
15852 (gcry_md_spec_t): Add 'extract'.
15853 * src/gcrypt-int.g (_gcry_md_extract): New.
15854 * src/gcrypt.h.in (gcry_md_extract): New.
15855 * src/libgcrypt.def: Add gcry_md_extract.
15856 * src/libgcrypt.vers: Add gcry_md_extract.
15857 * src/visibility.c (gcry_md_extract): New.
15858 * src/visibility.h (gcry_md_extract): New.
15859
15860 md: check hmac flag in prepare_macpads.
15861 + commit cee2e122ec6c1886957a8d47498eb63a6a921725
15862 * cipher/md.c (prepare_macpads): Check hmac flag.
15863
15864 keccak: rewrite for improved performance.
15865 + commit 74184c28fbe7ff58cf57f0094ef957d94045da7d
15866 * cipher/Makefile.am: Add 'keccak_permute_32.h' and
15867 'keccak_permute_64.h'.
15868 * cipher/hash-common.h [USE_SHA3] (MD_BLOCK_MAX_BLOCKSIZE): Remove.
15869 * cipher/keccak.c (USE_64BIT, USE_32BIT, USE_64BIT_BMI2)
15870 (USE_64BIT_SHLD, USE_32BIT_BMI2, NEED_COMMON64, NEED_COMMON32BI)
15871 (keccak_ops_t): New.
15872 (KECCAK_STATE): Add 'state64' and 'state32bi' members.
15873 (KECCAK_CONTEXT): Remove 'bctx'; add 'blocksize', 'count' and 'ops'.
15874 (rol64, keccak_f1600_state_permute): Remove.
15875 [NEED_COMMON64] (round_consts_64bit, keccak_extract_inplace64): New.
15876 [NEED_COMMON32BI] (round_consts_32bit, keccak_extract_inplace32bi)
15877 (keccak_absorb_lane32bi): New.
15878 [USE_64BIT] (ANDN64, ROL64, keccak_f1600_state_permute64)
15879 (keccak_absorb_lanes64, keccak_generic64_ops): New.
15880 [USE_64BIT_SHLD] (ANDN64, ROL64, keccak_f1600_state_permute64_shld)
15881 (keccak_absorb_lanes64_shld, keccak_shld_64_ops): New.
15882 [USE_64BIT_BMI2] (ANDN64, ROL64, keccak_f1600_state_permute64_bmi2)
15883 (keccak_absorb_lanes64_bmi2, keccak_bmi2_64_ops): New.
15884 [USE_32BIT] (ANDN64, ROL64, keccak_f1600_state_permute32bi)
15885 (keccak_absorb_lanes32bi, keccak_generic32bi_ops): New.
15886 [USE_32BIT_BMI2] (ANDN64, ROL64, keccak_f1600_state_permute32bi_bmi2)
15887 (pext, pdep, keccak_absorb_lane32bi_bmi2, keccak_absorb_lanes32bi_bmi2)
15888 (keccak_extract_inplace32bi_bmi2, keccak_bmi2_32bi_ops): New.
15889 (keccak_write): New.
15890 (keccak_init): Adjust to KECCAK_CONTEXT changes; add implementation
15891 selection based on HWF features.
15892 (keccak_final): Adjust to KECCAK_CONTEXT changes; use selected 'ops'
15893 for state manipulation.
15894 (keccak_read): Adjust to KECCAK_CONTEXT changes.
15895 (_gcry_digest_spec_sha3_224, _gcry_digest_spec_sha3_256)
15896 (_gcry_digest_spec_sha3_348, _gcry_digest_spec_sha3_512): Use
15897 'keccak_write' instead of '_gcry_md_block_write'.
15898 * cipher/keccak_permute_32.h: New.
15899 * cipher/keccak_permute_64.h: New.
15900
15901 hwf-x86: add detection for Intel CPUs with fast SHLD instruction.
15902 + commit 909644ef5883927262366c356eed530e55aba478
15903 * cipher/sha1.c (sha1_init): Use HWF_INTEL_FAST_SHLD instead of
15904 HWF_INTEL_CPU.
15905 * cipher/sha256.c (sha256_init, sha224_init): Ditto.
15906 * cipher/sha512.c (sha512_init, sha384_init): Ditto.
15907 * src/g10lib.h (HWF_INTEL_FAST_SHLD): New.
15908 (HWF_INTEL_BMI2, HWF_INTEL_SSSE3, HWF_INTEL_PCLMUL, HWF_INTEL_AESNI)
15909 (HWF_INTEL_RDRAND, HWF_INTEL_AVX, HWF_INTEL_AVX2)
15910 (HWF_ARM_NEON): Update.
15911 * src/hwf-x86.c (detect_x86_gnuc): Add detection of Intel Core
15912 CPUs with fast SHLD/SHRD instruction.
15913 * src/hwfeatures.c (hwflist): Add "intel-fast-shld".
15914
15915 Fix OCB amd64 assembly implementations for x32.
15916 + commit 16fd540f4d01eb6dc23d9509ae549353617c7a67
15917 * cipher/camellia-glue.c (_gcry_camellia_aesni_avx_ocb_enc)
15918 (_gcry_camellia_aesni_avx_ocb_dec, _gcry_camellia_aesni_avx_ocb_auth)
15919 (_gcry_camellia_aesni_avx2_ocb_enc, _gcry_camellia_aesni_avx2_ocb_dec)
15920 (_gcry_camellia_aesni_avx2_ocb_auth, _gcry_camellia_ocb_crypt)
15921 (_gcry_camellia_ocb_auth): Change 'Ls' from pointer array to u64 array.
15922 * cipher/serpent.c (_gcry_serpent_sse2_ocb_enc)
15923 (_gcry_serpent_sse2_ocb_dec, _gcry_serpent_sse2_ocb_auth)
15924 (_gcry_serpent_avx2_ocb_enc, _gcry_serpent_avx2_ocb_dec)
15925 (_gcry_serpent_ocb_crypt, _gcry_serpent_ocb_auth): Ditto.
15926 * cipher/twofish.c (_gcry_twofish_amd64_ocb_enc)
15927 (_gcry_twofish_amd64_ocb_dec, _gcry_twofish_amd64_ocb_auth)
15928 (twofish_amd64_ocb_enc, twofish_amd64_ocb_dec, twofish_amd64_ocb_auth)
15929 (_gcry_twofish_ocb_crypt, _gcry_twofish_ocb_auth): Ditto.
15930
15931 bench-slope: add KDF/PBKDF2 benchmark.
15932 + commit ae40af427fd2a856b24ec2a41323ec8b80ffc9c0
15933 * tests/bench-slope.c (bench_kdf_mode, bench_kdf_init, bench_kdf_free)
15934 (bench_kdf_do_bench, kdf_ops, kdf_bench_one, kdf_bench): New.
15935 (print_help): Add 'kdf'.
15936 (main): Add KDF benchmarks.
15937
15938 2015-10-22 NIIBE Yutaka <[email protected]>
15939
15940 md: keep contexts for HMAC in GcryDigestEntry.
15941 + commit f7505b550dd591e33d3a3fab9277c43c460f1bad
15942 * cipher/md.c (struct gcry_md_context): Add flags.hmac.
15943 Remove macpads and mcpads_Bsize.
15944 (md_open): Initialize flags.hmac. Remove macpads initialization.
15945 (md_enable): Allocate contexts when flags.hmac is enabled.
15946 (md_copy): Remove macpads copying. Add copying contexts.
15947 (_gcry_md_reset): When flags.hmac is enabled, restore precomputed
15948 context with input pad
15949 (md_close): Remove macpads wiping.
15950 (md_final): When flags.hmac is enabled, compute hmac by precomputed
15951 context with output pad.
15952 (prepare_macpads): Prepare precomputed contexts with input pad and
15953 output pad for each registered digest entry.
15954 (_gcry_md_setkey): Just call prepare_macpads.
15955
15956 2015-10-15 NIIBE Yutaka <[email protected]>
15957
15958 Fix double free on error.
15959 + commit 1c6d2698a84e4bf82735287c1d64954bfc1a1982
15960 * src/hmac256.c (_gcry_hmac256_finalize): Don't free HD.
15961
15962 2015-10-14 NIIBE Yutaka <[email protected]>
15963
15964 Fix gpg_error_t and gpg_err_code_t confusion.
15965 + commit 813565a07ca575c87e1252c6ed26018653ecd338
15966 * src/gcrypt-int.h (_gcry_sexp_extract_param): Revert the change.
15967 * cipher/dsa.c (dsa_check_secret_key): Ditto.
15968 * src/sexp.c (_gcry_sexp_extract_param): Return gpg_err_code_t.
15969
15970 * src/gcrypt-int.h (_gcry_err_make_from_errno)
15971 (_gcry_error_from_errno): Return gpg_error_t.
15972 * cipher/cipher.c (_gcry_cipher_open_internal)
15973 (_gcry_cipher_ctl, _gcry_cipher_ctl): Don't use gcry_error.
15974 * src/global.c (_gcry_vcontrol): Likewise.
15975 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_genkey): Use
15976 gpg_err_code_from_syserror.
15977 * cipher/mac.c (mac_reset, mac_setkey, mac_setiv, mac_write)
15978 (mac_read, mac_verify): Return gcry_err_code_t.
15979 * cipher/rsa-common.c (mgf1): Use gcry_err_code_t for ERR.
15980 * src/visibility.c (gcry_error_from_errno): Return gpg_error_t.
15981
15982 2015-10-13 Jussi Kivilinna <[email protected]>
15983
15984 Fix compiling AES/AES-NI implementation on linux-i386.
15985 + commit fa94b6111948a614ebdcb67f7942eced8b84c579
15986 * cipher/rijndael-aesni.c (do_aesni_ctr_4): Split assembly block in
15987 two parts to reduce number of register constraints needed.
15988
15989 2015-10-13 NIIBE Yutaka <[email protected]>
15990
15991 Fix declaration of return type.
15992 + commit 73374fdd27c7ba28b19f9672c68a6f5b72252fe5
15993 * src/gcrypt-int.h (_gcry_sexp_extract_param): Return gpg_error_t.
15994 * cipher/dsa.c (dsa_generate): Fix call to _gcry_sexp_extract_param.
15995 * src/g10lib.h (_gcry_vcontrol): Return gcry_err_code_t.
15996 * src/visibility.c (gcry_mpi_snatch): Fix call to _gcry_mpi_snatch.
15997
15998 2015-09-07 Werner Koch <[email protected]>
15999
16000 Improve GCRYCTL_DISABLE_PRIV_DROP by also disabling cap_ calls.
16001 + commit 3a3d5410cc83f7069c7cb1ab384905f382292d32
16002 * src/secmem.c (lock_pool, secmem_init): Do not call any cap_
16003 functions if NO_PRIV_DROP is set.
16004
16005 2015-09-04 Werner Koch <[email protected]>
16006
16007 w32: Avoid a few compiler warnings.
16008 + commit e97c62a4a687b56d00a2d0a63e072a977f8eb81c
16009 * cipher/cipher-selftest.c (_gcry_selftest_helper_cbc)
16010 (_gcry_selftest_helper_cfb, _gcry_selftest_helper_ctr): Mark variable
16011 as unused.
16012 * random/rndw32.c (slow_gatherer): Avoid signed pointer mismatch
16013 warning.
16014 * src/secmem.c (init_pool): Avoid unused variable warning.
16015 * tests/random.c (writen, readn): Include on if needed.
16016
16017 w32: Fix alignment problem with AESNI on Windows >= 8.
16018 + commit e2785a2268702312529521df3bd2f4e6b43cea3a
16019 * cipher/cipher-selftest.c (_gcry_cipher_selftest_alloc_ctx): New.
16020 * cipher/rijndael.c (selftest_basic_128, selftest_basic_192)
16021 (selftest_basic_256): Allocate context on the heap.
16022
16023 2015-08-31 Werner Koch <[email protected]>
16024
16025 rsa: Add verify after sign to avoid Lenstra's CRT attack.
16026 + commit c17f84bd02d7ee93845e92e20f6ddba814961588
16027 * cipher/rsa.c (rsa_sign): Check the CRT.
16028
16029 Add pubkey algo id for EdDSA.
16030 + commit dd87639abd38afc91a6f27af33f0ba17402ad02d
16031 * src/gcrypt.h.in (GCRY_PK_EDDSA): New.
16032
16033 2015-08-25 Werner Koch <[email protected]>
16034
16035 Add configure option --enable-build-timestamp.
16036 + commit a785cc3db0c4e8eb8ebbf784b833a40d2c42ec3e
16037 * configure.ac (BUILD_TIMESTAMP): Set to "<none>" by default.
16038
16039 2015-08-23 Werner Koch <[email protected]>
16040
16041 tests: Add missing files for the make distcheck target.
16042 + commit fb3cb47b0a29d3e73150297aa4495c20915e4a75
16043 * tests/Makefile.am (EXTRA_DIST): Add sha3-x test vector files.
16044
16045 2015-08-19 Werner Koch <[email protected]>
16046
16047 Change SHA-3 algorithm ids.
16048 + commit 65639ecaaeba642e40487446c40d045482001285
16049 * src/gcrypt.h.in (GCRY_MD_SHA3_224, GCRY_MD_SHA3_256)
16050 (GCRY_MD_SHA3_384, GCRY_MD_SHA3_512): Change values.
16051
16052 2015-08-12 Jussi Kivilinna <[email protected]>
16053
16054 Keccak: Fix array indexes in θ step.
16055 + commit 48822ae0b436bcea0fe92dbf0d88475ba3179320
16056 * cipher/keccak.c (keccak_f1600_state_permute): Fix indexes for D[5].
16057
16058 Simplify OCB offset calculation for parallel implementations.
16059 + commit 24ebf53f1e8a8afa27dcd768339bda70a740bb03
16060 * cipher/camellia-glue.c (_gcry_camellia_ocb_crypt)
16061 (_gcry_camellia_ocb_auth): Precalculate Ls array always, instead of
16062 just if 'blkn % <parallel blocks> == 0'.
16063 * cipher/serpent.c (_gcry_serpent_ocb_crypt)
16064 (_gcry_serpent_ocb_auth): Ditto.
16065 * cipher/rijndael-aesni.c (get_l): Remove low-bit checks.
16066 (aes_ocb_enc, aes_ocb_dec, _gcry_aes_aesni_ocb_auth): Handle leading
16067 blocks until block counter is multiple of 4, so that parallel block
16068 processing loop can use 'c->u_mode.ocb.L' array directly.
16069 * tests/basic.c (check_ocb_cipher_largebuf): Rename to...
16070 (check_ocb_cipher_largebuf_split): ...this and add option to process
16071 large buffer as two split buffers.
16072 (check_ocb_cipher_largebuf): New.
16073
16074 Add carryless 8-bit addition fast-path for AES-NI CTR mode.
16075 + commit e11895da1f4af9782d89e92ba2e6b1a63235b54b
16076 * cipher/rijndael-aesni.c (do_aesni_ctr_4): Do addition using
16077 CTR in big-endian form, if least-significant byte does not overflow.
16078
16079 2015-08-10 Jussi Kivilinna <[email protected]>
16080
16081 Add additional SHA3 test-vectors.
16082 + commit 80321eb3a63a20f86734d6eebb3f419c0ec895aa
16083 * tests/basic.c (check_digests): Allow datalen to be specified so that
16084 input data can have byte with value 0x00; Include sha3-*.h header files
16085 to test-vector structure.
16086 * tests/sha3-224.h: New.
16087 * tests/sha3-256.h: New.
16088 * tests/sha3-384.h: New.
16089 * tests/sha3-512.h: New.
16090
16091 Add generic SHA3 implementation.
16092 + commit 434ba17d1d5ad59c70d721ad3ecb376c2403a7e5
16093 * cipher/hash-common.h (MD_BLOCK_MAX_BLOCKSIZE): Increase blocksize
16094 USE_SHA3 enabled.
16095 * cipher/keccak.c (SHA3_DELIMITED_SUFFIX, SHAKE_DELIMITED_SUFFIX): New.
16096 (KECCAK_STATE): Add proper state.
16097 (KECCAK_CONTEXT): Add 'outlen'.
16098 (rol64, keccak_f1600_state_permute, transform_blk, transform): New.
16099 (keccak_init): Add proper initialization.
16100 (keccak_final): Add proper finalization.
16101 (selftests_keccak): Add selftests.
16102 (oid_spec_sha3_224, oid_spec_sha3_256, oid_spec_sha3_384)
16103 (oid_spec_sha3_512): Add OID.
16104 (_gcry_digest_spec_sha3_224, _gcry_digest_spec_sha3_256)
16105 (_gcry_digest_spec_sha3_384, _gcry_digest_spec_sha3_512): Fix output
16106 length.
16107 * cipher/mac-hmac.c (map_mac_algo_to_md): Fix mapping for SHA3-512.
16108 (hmac_get_keylen): Return proper blocksizes for SHA3 algorithms.
16109 [USE_SHA3] (_gcry_mac_type_spec_hmac_sha3_224)
16110 (_gcry_mac_type_spec_hmac_sha3_256, _gcry_mac_type_spec_hmac_sha3_384)
16111 (_gcry_mac_type_spec_hmac_sha3_512): New.
16112 * cipher/mac-internal [USE_SHA3] (_gcry_mac_type_spec_hmac_sha3_224)
16113 (_gcry_mac_type_spec_hmac_sha3_256, _gcry_mac_type_spec_hmac_sha3_384)
16114 (_gcry_mac_type_spec_hmac_sha3_512): New.
16115 * cipher/mac.c (mac_list) [USE_SHA3]: Add SHA3 algorithms.
16116 * cipher/md.c (md_open): Use proper SHA-3 blocksizes for HMAC macpads.
16117 * tests/basic.c (check_digests): Add SHA3 test vectors.
16118
16119 Optimize OCB offset calculation.
16120 + commit 49f52c67fb42c0656c8f9af655087f444562ca82
16121 * cipher/cipher-internal.h (ocb_get_l): New.
16122 * cipher/cipher-ocb.c (_gcry_cipher_ocb_authenticate)
16123 (ocb_crypt): Use 'ocb_get_l' instead of '_gcry_cipher_ocb_get_l'.
16124 * cipher/camellia-glue.c (get_l): Remove.
16125 (_gcry_camellia_ocb_crypt, _gcry_camellia_ocb_auth): Precalculate
16126 offset array when block count matches parallel operation size; Use
16127 'ocb_get_l' instead of 'get_l'.
16128 * cipher/rijndael-aesni.c (get_l): Add fast path for 75% most common
16129 offsets.
16130 (aesni_ocb_enc, aesni_ocb_dec, _gcry_aes_aesni_ocb_auth): Precalculate
16131 offset array when block count matches parallel operation size.
16132 * cipher/rijndael-ssse3-amd64.c (get_l): Add fast path for 75% most
16133 common offsets.
16134 * cipher/rijndael.c (_gcry_aes_ocb_crypt, _gcry_aes_ocb_auth): Use
16135 'ocb_get_l' instead of '_gcry_cipher_ocb_get_l'.
16136 * cipher/serpent.c (get_l): Remove.
16137 (_gcry_serpent_ocb_crypt, _gcry_serpent_ocb_auth): Precalculate
16138 offset array when block count matches parallel operation size; Use
16139 'ocb_get_l' instead of 'get_l'.
16140 * cipher/twofish.c (get_l): Remove.
16141 (_gcry_twofish_ocb_crypt, _gcry_twofish_ocb_auth): Use 'ocb_get_l'
16142 instead of 'get_l'.
16143
16144 2015-08-10 NIIBE Yutaka <[email protected]>
16145
16146 ecc: fix Montgomery curve bugs.
16147 + commit ce746936b6c210e602d106cfbf45cf60b408d871
16148 * cipher/ecc.c (check_secret_key): Y1 should not be NULL when check.
16149 (ecc_check_secret_key): Support Montgomery curve.
16150 * mpi/ec.c (_gcry_mpi_ec_curve_point): Fix condition.
16151
16152 2015-08-08 Werner Koch <[email protected]>
16153
16154 Add framework to eventually support SHA3.
16155 + commit 0e17f7a05bba309a87811992aa47a77af9935b99
16156 * src/gcrypt.h.in (GCRY_MD_SHA3_224, GCRY_MD_SHA3_256)
16157 (GCRY_MD_SHA3_384, GCRY_MD_SHA3_512): New.
16158 (GCRY_MAC_HMAC_SHA3_224, GCRY_MAC_HMAC_SHA3_256)
16159 (GCRY_MAC_HMAC_SHA3_384, GCRY_MAC_HMAC_SHA3_512): New.
16160 * cipher/keccak.c: New with stub functions.
16161 * cipher/Makefile.am (EXTRA_libcipher_la_SOURCES): Add keccak.c.
16162 * configure.ac (available_digests): Add sha3.
16163 (USE_SHA3): New.
16164 * src/fips.c (run_hmac_selftests): Add SHA3 to the required selftests.
16165 * cipher/md.c (digest_list) [USE_SHA3]: Add standard SHA3 algos.
16166 (md_open): Ditto for hmac processing.
16167 * cipher/mac-hmac.c (map_mac_algo_to_md): Add mapping.
16168 * cipher/hmac-tests.c (run_selftests): Prepare for tests.
16169 * cipher/pubkey-util.c (get_hash_algo): Add "sha3-xxx".
16170
16171 2015-08-06 Werner Koch <[email protected]>
16172
16173 tools: Fix memory leak for functions "I" and "G".
16174 + commit 10789e3cdda7b944acb4b59624c34a2ccfaea6e5
16175 * src/mpicalc.c (do_inv, do_gcd): Init A after stack check.
16176
16177 2015-08-06 Ismo Puustinen <[email protected]>
16178
16179 ecc: Free memory also when in error branch.
16180 + commit 1d896371fbc94c605fce35eabcde01e24dd22892
16181 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_sign): Init DISGEST and goto
16182 leave on error.
16183
16184 2015-08-06 NIIBE Yutaka <[email protected]>
16185
16186 Add Curve25519 support.
16187 + commit e93f4c21c59756604440ad8cbf27e67d29c99ffd
16188 * cipher/ecc-curves.c (curve_aliases, domain_parms): Add Curve25519.
16189 * tests/curves.c (N_CURVES): It's 22 now.
16190 * src/cipher.h (PUBKEY_FLAG_DJB_TWEAK): New.
16191 * cipher/ecc-common.h (_gcry_ecc_mont_decodepoint): New.
16192 * cipher/ecc-misc.c (_gcry_ecc_mont_decodepoint): New.
16193 * cipher/ecc.c (nist_generate_key): Handle the case of
16194 PUBKEY_FLAG_DJB_TWEAK and Montgomery curve.
16195 (test_ecdh_only_keys, check_secret_key): Likewise.
16196 (ecc_generate): Support Curve25519 which is Montgomery curve with flag
16197 PUBKEY_FLAG_DJB_TWEAK and PUBKEY_FLAG_COMP.
16198 (ecc_encrypt_raw): Get flags from KEYPARMS and handle
16199 PUBKEY_FLAG_DJB_TWEAK and Montgomery curve.
16200 (ecc_decrypt_raw): Likewise.
16201 (compute_keygrip): Handle the case of PUBKEY_FLAG_DJB_TWEAK.
16202 * cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist):
16203 PUBKEY_FLAG_EDDSA implies PUBKEY_FLAG_DJB_TWEAK.
16204 Parse "djb-tweak" for PUBKEY_FLAG_DJB_TWEAK.
16205
16206 2015-07-27 Jussi Kivilinna <[email protected]>
16207
16208 Reduce code size for Twofish key-setup and remove key dependend branch.
16209 + commit b4b1d872ba651bc44761b35d245b1a519a33f515
16210 * cipher/twofish.c (poly_to_exp): Increase size by one, change type
16211 from byte to u16 and insert '492' to index 0.
16212 (exp_to_poly): Increase size by 256, let new cells have zero value.
16213 (CALC_S): Execute unconditionally with help of modified tables.
16214 (do_twofish_setkey): Change type for 'tmp' to 'unsigned int'; Un-unroll
16215 CALC_K256 and CALC_K phases to reduce generated object size.
16216
16217 Reduce amount of duplicated code in OCB bulk implementations.
16218 + commit e950052bc6f5ff11a7c23091ff3f6b5cc431e875
16219 * cipher/cipher-ocb.c (_gcry_cipher_ocb_authenticate)
16220 (ocb_crypt): Change bulk function to return number of unprocessed
16221 blocks.
16222 * src/cipher.h (_gcry_aes_ocb_crypt, _gcry_aes_ocb_auth)
16223 (_gcry_camellia_ocb_crypt, _gcry_camellia_ocb_auth)
16224 (_gcry_serpent_ocb_crypt, _gcry_serpent_ocb_auth)
16225 (_gcry_twofish_ocb_crypt, _gcry_twofish_ocb_auth): Change return type
16226 to 'size_t'.
16227 * cipher/camellia-glue.c (get_l): Only if USE_AESNI_AVX or
16228 USE_AESNI_AVX2 defined.
16229 (_gcry_camellia_ocb_crypt, _gcry_camellia_ocb_auth): Change return type
16230 to 'size_t' and return remaining blocks; Remove unaccelerated common
16231 code path. Enable remaining common code only if USE_AESNI_AVX or
16232 USE_AESNI_AVX2 defined; Remove unaccelerated common code.
16233 * cipher/rijndael.c (_gcry_aes_ocb_crypt, _gcry_aes_ocb_auth): Change
16234 return type to 'size_t' and return zero.
16235 * cipher/serpent.c (get_l): Only if USE_SSE2, USE_AVX2 or USE_NEON
16236 defined.
16237 (_gcry_serpent_ocb_crypt, _gcry_serpent_ocb_auth): Change return type
16238 to 'size_t' and return remaining blocks; Remove unaccelerated common
16239 code path. Enable remaining common code only if USE_SSE2, USE_AVX2 or
16240 USE_NEON defined; Remove unaccelerated common code.
16241 * cipher/twofish.c (get_l): Only if USE_AMD64_ASM defined.
16242 (_gcry_twofish_ocb_crypt, _gcry_twofish_ocb_auth): Change return type
16243 to 'size_t' and return remaining blocks; Remove unaccelerated common
16244 code path. Enable remaining common code only if USE_AMD64_ASM defined;
16245 Remove unaccelerated common code.
16246
16247 Add bulk OCB for Serpent SSE2, AVX2 and NEON implementations.
16248 + commit adbdca0d58f9c06dc3850b95e3455e179c1e6960
16249 * cipher/cipher.c (_gcry_cipher_open_internal): Setup OCB bulk
16250 functions for Serpent.
16251 * cipher/serpent-armv7-neon.S: Add OCB assembly functions.
16252 * cipher/serpent-avx2-amd64.S: Add OCB assembly functions.
16253 * cipher/serpent-sse2-amd64.S: Add OCB assembly functions.
16254 * cipher/serpent.c (_gcry_serpent_sse2_ocb_enc)
16255 (_gcry_serpent_sse2_ocb_dec, _gcry_serpent_sse2_ocb_auth)
16256 (_gcry_serpent_neon_ocb_enc, _gcry_serpent_neon_ocb_dec)
16257 (_gcry_serpent_neon_ocb_auth, _gcry_serpent_avx2_ocb_enc)
16258 (_gcry_serpent_avx2_ocb_dec, _gcry_serpent_avx2_ocb_auth): New
16259 prototypes.
16260 (get_l, _gcry_serpent_ocb_crypt, _gcry_serpent_ocb_auth): New.
16261 * src/cipher.h (_gcry_serpent_ocb_crypt)
16262 (_gcry_serpent_ocb_auth): New.
16263 * tests/basic.c (check_ocb_cipher): Add test-vector for serpent.
16264
16265 Add bulk OCB for Twofish AMD64 implementation.
16266 + commit 7f6804c37c4b41d85fb26aa723b1c41e4a3cf278
16267 * cipher/cipher.c (_gcry_cipher_open_internal): Setup OCB bulk
16268 functions for Twofish.
16269 * cipher/twofish-amd64.S: Add OCB assembly functions.
16270 * cipher/twofish.c (_gcry_twofish_amd64_ocb_enc)
16271 (_gcry_twofish_amd64_ocb_dec, _gcry_twofish_amd64_ocb_auth): New
16272 prototypes.
16273 (call_sysv_fn5, call_sysv_fn6, twofish_amd64_ocb_enc)
16274 (twofish_amd64_ocb_dec, twofish_amd64_ocb_auth, get_l)
16275 (_gcry_twofish_ocb_crypt, _gcry_twofish_ocb_auth): New.
16276 * src/cipher.h (_gcry_twofish_ocb_crypt)
16277 (_gcry_twofish_ocb_auth): New.
16278 * tests/basic.c (check_ocb_cipher): Add test-vector for Twofish.
16279
16280 Add bulk OCB for Camellia AES-NI/AVX and AES-NI/AVX2 implementations.
16281 + commit bb088c6b1620504fdc79e89af27c2bf3fb02b4b4
16282 * cipher/camellia-aesni-avx-amd64.S: Add OCB assembly functions.
16283 * cipher/camellia-aesni-avx2-amd64.S: Add OCB assembly functions.
16284 * cipher/camellia-glue.c (_gcry_camellia_aesni_avx_ocb_enc)
16285 (_gcry_camellia_aesni_avx_ocb_dec, _gcry_camellia_aesni_avx_ocb_auth)
16286 (_gcry_camellia_aesni_avx2_ocb_enc, _gcry_camellia_aesni_avx2_ocb_dec)
16287 (_gcry_camellia_aesni_avx2_ocb_auth): New prototypes.
16288 (get_l, _gcry_camellia_ocb_crypt, _gcry_camellia_ocb_auth): New.
16289 * cipher/cipher.c (_gcry_cipher_open_internal): Setup OCB bulk
16290 functions for Camellia.
16291 * src/cipher.h (_gcry_camellia_ocb_crypt)
16292 (_gcry_camellia_ocb_auth): New.
16293 * tests/basic.c (check_ocb_cipher): Add test-vector for Camellia.
16294
16295 2015-07-26 Jussi Kivilinna <[email protected]>
16296
16297 Add OCB bulk mode for AES SSSE3 implementation.
16298 + commit 620e1e0300c79943a1846a49563b04386dc60546
16299 * cipher/rijndael-ssse3-amd64.c (SSSE3_STATE_SIZE): New.
16300 [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS] (vpaes_ssse3_prepare): Use
16301 'ssse3_state' for storing current SSSE3 state.
16302 [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS]
16303 (vpaes_ssse3_cleanup): Restore SSSE3 state from 'ssse3_state'.
16304 (_gcry_aes_ssse3_do_setkey, _gcry_aes_ssse3_prepare_decryption)
16305 (_gcry_aes_ssse3_encrypt, _gcry_aes_ssse3_cfb_enc)
16306 (_gcry_aes_ssse3_cbc_enc, _gcry_aes_ssse3_ctr_enc)
16307 (_gcry_aes_ssse3_decrypt, _gcry_aes_ssse3_cfb_dec)
16308 (_gcry_aes_ssse3_cbc_dec, _gcry_aes_ssse3_cbc_dec): Add 'ssse3_state'
16309 array.
16310 (get_l, ssse3_ocb_enc, ssse3_ocb_dec, _gcry_aes_ssse3_ocb_crypt)
16311 (_gcry_aes_ssse3_ocb_auth): New.
16312 * cipher/rijndael.c (_gcry_aes_ssse3_ocb_crypt)
16313 (_gcry_aes_ssse3_ocb_auth): New.
16314 (_gcry_aes_ocb_crypt, _gcry_aes_ocb_auth) [USE_SSSE3]: Use SSSE3
16315 implementation for OCB.
16316
16317 2015-07-26 Peter Wu <[email protected]>
16318
16319 Fix undefined behavior wrt memcpy.
16320 + commit 46c072669eb81ed610cc5b3c0dc0c75a143afbb4
16321 * cipher/cipher-gcm.c: Do not copy zero bytes from an empty buffer. Let
16322 the function continue to add padding as needed though.
16323 * cipher/mac-poly1305.c: If the caller requested to finish the hash
16324 function without a copy of the result, return immediately.
16325
16326 2015-07-23 Peter Wu <[email protected]>
16327
16328 build: ignore scissor line for the commit-msg hook.
16329 + commit ada0a7d302cca97b327faaacac7a5d0b8043df88
16330 * build-aux/git-hooks/commit-msg: Stop processing more lines when the
16331 scissor line is encountered.
16332
16333 2015-07-16 Peter Wu <[email protected]>
16334
16335 rsa: Fix error in comments.
16336 + commit 9cd55e8e948f0049cb23495f536decf797d072f7
16337 * cipher/rsa.c: Fix.
16338
16339 2015-07-14 Peter Wu <[email protected]>
16340
16341 sexp: Fix invalid deallocation in error path.
16342 + commit 0f9532b186c1e0b54d7e7a6d76bce82b6226122b
16343 * src/sexp.c: Fix wrong condition.
16344
16345 2015-07-10 Peter Wu <[email protected]>
16346
16347 ecc: fix memory leak.
16348 + commit 2a7aa3ea4d03a9c808d5888f5509c08cd27aa27c
16349 * cipher/ecc.c (ecc_verify): Release memory which was allocated before
16350 by _gcry_pk_util_preparse_sigval.
16351 (ecc_decrypt_raw): Likewise.
16352
16353 2015-07-06 NIIBE Yutaka <[email protected]>
16354
16355 ecc: fix memory leaks.
16356 + commit 0a7547e487a8bc4e7ac9599c55579eb2e4a13f06
16357 cipher/ecc.c (ecc_generate): Fix memory leak on error of
16358 _gcry_pk_util_parse_flaglist and _gcry_ecc_eddsa_encodepoint.
16359 (ecc_check_secret_key): Fix memory leak on error of
16360 _gcry_ecc_update_curve_param.
16361 (ecc_sign, ecc_verify, ecc_encrypt_raw, ecc_decrypt_raw): Remove
16362 unnecessary sexp_release and fix memory leak on error of
16363 _gcry_ecc_fill_in_curve.
16364 (ecc_decrypt_raw): Fix double free of the point kG and memory leak
16365 on error of _gcry_ecc_os2ec.
16366
16367 2015-06-11 NIIBE Yutaka <[email protected]>
16368
16369 mpi: Support FreeBSD 10 or later.
16370 + commit a36ee7501f68ad7ebcfe31f9659430b9d2c3ddd1
16371 * mpi/config.links: Include FreeBSD 10 to 29.
16372
16373 2015-05-21 Werner Koch <[email protected]>
16374
16375 ecc: Add key generation flag "no-keytest".
16376 + commit 2bddd947fd1c11b4ec461576db65a5e34fea1b07
16377 * src/cipher.h (PUBKEY_FLAG_NO_KEYTEST): New.
16378 * cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist): Add flag
16379 "no-keytest". Return an error for invalid flags of length 10.
16380
16381 * cipher/ecc.c (nist_generate_key): Replace arg random_level by flags
16382 set random level depending on flags.
16383 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_genkey): Ditto.
16384 * cipher/ecc.c (ecc_generate): Pass flags to generate fucntion and
16385 remove var random_level.
16386 (nist_generate_key): Implement "no-keytest" flag.
16387
16388 * tests/keygen.c (check_ecc_keys): Add tests for transient-key and
16389 no-keytest.
16390
16391 ecc: Avoid double conversion to affine coordinates in keygen.
16392 + commit 102d68b3bd77813a3ff989526855bb1e283bf9d7
16393 * cipher/ecc.c (nist_generate_key): Add args r_x and r_y.
16394 (ecc_generate): Rename vars. Convert to affine coordinates only if
16395 not returned by the lower level generation function.
16396
16397 random: Change initial extra seeding from 2400 bits to 128 bits.
16398 + commit 8124e357b732a719696bfd5271def4e528f2a1e1
16399 * random/random-csprng.c (read_pool): Reduce initial seeding.
16400
16401 2015-05-14 Jussi Kivilinna <[email protected]>
16402
16403 Enable AMD64 Twofish implementation on WIN64.
16404 + commit 9b0c6c8141ae9bd056392a3f6b5704b505fc8501
16405 * cipher/twofish-amd64.S: Enable when
16406 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16407 (ELF): New macro to mask lines with ELF specific commands.
16408 * cipher/twofish.c (USE_AMD64_ASM): Enable when
16409 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16410 [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS] (call_sysv_fn): New.
16411 (twofish_amd64_encrypt_block, twofish_amd64_decrypt_block)
16412 (twofish_amd64_ctr_enc, twofish_amd64_cbc_dec)
16413 (twofish_amd64_cfb_dec): New wrapper functions for AMD64
16414 assembly functions.
16415
16416 Enable AMD64 Serpent implementations on WIN64.
16417 + commit eb0ed576893b6c7990dbcb568510f831d246cea6
16418 * cipher/serpent-avx2-amd64.S: Enable when
16419 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16420 (ELF): New macro to mask lines with ELF specific commands.
16421 * cipher/serpent-sse2-amd64.S: Enable when
16422 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16423 (ELF): New macro to mask lines with ELF specific commands.
16424 * cipher/chacha20.c (USE_SSE2, USE_AVX2): Enable when
16425 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16426 [USE_SSE2 || USE_AVX2] (ASM_FUNC_ABI): New.
16427 (_gcry_serpent_sse2_ctr_enc, _gcry_serpent_sse2_cbc_dec)
16428 (_gcry_serpent_sse2_cfb_dec, _gcry_serpent_avx2_ctr_enc)
16429 (_gcry_serpent_avx2_cbc_dec, _gcry_serpent_avx2_cfb_dec): Add
16430 ASM_FUNC_ABI.
16431
16432 Enable AMD64 Salsa20 implementation on WIN64.
16433 + commit 12bc93ca8187b8061c2e705427ef22f5a71d29b0
16434 * cipher/salsa20-amd64.S: Enable when
16435 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16436 (ELF): New macro to mask lines with ELF specific commands.
16437 * cipher/salsa20.c (USE_AMD64): Enable when
16438 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16439 [USE_AMD64] (ASM_FUNC_ABI, ASM_EXTRA_STACK): New.
16440 (_gcry_salsa20_amd64_keysetup, _gcry_salsa20_amd64_ivsetup)
16441 (_gcry_salsa20_amd64_encrypt_blocks): Add ASM_FUNC_ABI.
16442 [USE_AMD64] (salsa20_core): Add ASM_EXTRA_STACK.
16443 (salsa20_do_encrypt_stream) [USE_AMD64]: Add ASM_EXTRA_STACK.
16444
16445 Enable AMD64 Poly1305 implementations on WIN64.
16446 + commit 8d7de4dbf7732c6eb9e9853ad7c19c89075ace6f
16447 * cipher/poly1305-avx2-amd64.S: Enable when
16448 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16449 (ELF): New macro to mask lines with ELF specific commands.
16450 * cipher/poly1305-sse2-amd64.S: Enable when
16451 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16452 (ELF): New macro to mask lines with ELF specific commands.
16453 * cipher/poly1305-internal.h (POLY1305_SYSV_FUNC_ABI): New.
16454 (POLY1305_USE_SSE2, POLY1305_USE_AVX2): Enable when
16455 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16456 (OPS_FUNC_ABI): New.
16457 (poly1305_ops_t): Use OPS_FUNC_ABI.
16458 * cipher/poly1305.c (_gcry_poly1305_amd64_sse2_init_ext)
16459 (_gcry_poly1305_amd64_sse2_finish_ext)
16460 (_gcry_poly1305_amd64_sse2_blocks, _gcry_poly1305_amd64_avx2_init_ext)
16461 (_gcry_poly1305_amd64_avx2_finish_ext)
16462 (_gcry_poly1305_amd64_avx2_blocks, _gcry_poly1305_armv7_neon_init_ext)
16463 (_gcry_poly1305_armv7_neon_finish_ext)
16464 (_gcry_poly1305_armv7_neon_blocks, poly1305_init_ext_ref32)
16465 (poly1305_blocks_ref32, poly1305_finish_ext_ref32)
16466 (poly1305_init_ext_ref8, poly1305_blocks_ref8)
16467 (poly1305_finish_ext_ref8): Use OPS_FUNC_ABI.
16468
16469 Enable AMD64 3DES implementation on WIN64.
16470 + commit b65e9e71d5ee992db5c96793c6af999545daad28
16471 * cipher/des-amd64.S: Enable when
16472 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16473 (ELF): New macro to mask lines with ELF specific commands.
16474 * cipher/des.c (USE_AMD64_ASM): Enable when
16475 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16476 [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS] (call_sysv_fn): New.
16477 (tripledes_ecb_crypt) [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS]: Call
16478 assembly function through 'call_sysv_fn'.
16479 (tripledes_amd64_ctr_enc, tripledes_amd64_cbc_dec)
16480 (tripledes_amd64_cfb_dec): New wrapper functions for bulk
16481 assembly functions.
16482
16483 Enable AMD64 ChaCha20 implementations on WIN64.
16484 + commit 9597cfddf03c467825da152be5ca0d12a8c30d88
16485 * cipher/chacha20-avx2-amd64.S: Enable when
16486 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16487 (ELF): New macro to mask lines with ELF specific commands.
16488 * cipher/chacha20-sse2-amd64.S: Enable when
16489 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16490 (ELF): New macro to mask lines with ELF specific commands.
16491 * cipher/chacha20-ssse3-amd64.S: Enable when
16492 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16493 (ELF): New macro to mask lines with ELF specific commands.
16494 * cipher/chacha20.c (USE_SSE2, USE_SSSE3, USE_AVX2): Enable when
16495 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16496 (ASM_FUNC_ABI, ASM_EXTRA_STACK): New.
16497 (chacha20_blocks_t, _gcry_chacha20_amd64_sse2_blocks)
16498 (_gcry_chacha20_amd64_ssse3_blocks, _gcry_chacha20_amd64_avx2_blocks)
16499 (_gcry_chacha20_armv7_neon_blocks, chacha20_blocks): Add ASM_FUNC_ABI.
16500 (chacha20_core): Add ASM_EXTRA_STACK.
16501
16502 Enable AMD64 CAST5 implementation on WIN64.
16503 + commit 6a6646df80386204675d8b149ab60e74d7ca124c
16504 * cipher/cast5-amd64.S: Enable when
16505 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16506 (RIP): Remove.
16507 (GET_EXTERN_POINTER): Use 'leaq' version on WIN64.
16508 (ELF): New macro to mask lines with ELF specific commands.
16509 * cipher/cast5.c (USE_AMD64_ASM): Enable when
16510 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16511 [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS] (call_sysv_fn): New.
16512 (do_encrypt_block, do_decrypt_block)
16513 [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS]: Call assembly
16514 function through 'call_sysv_fn'.
16515 (cast5_amd64_ctr_enc, cast5_amd64_cbc_dec)
16516 (cast5_amd64_cfb_dec): New wrapper functions for bulk
16517 assembly functions.
16518
16519 Enable AMD64 Camellia implementations on WIN64.
16520 + commit 9a4fb3709864bf3e3918800d44ff576590cd4e92
16521 * cipher/camellia-aesni-avx-amd64.S: Enable when
16522 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16523 (ELF): New macro to mask lines with ELF specific commands.
16524 * cipher/camellia-aesni-avx2-amd64.S: Enable when
16525 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16526 (ELF): New macro to mask lines with ELF specific commands.
16527 * cipher/camellia-glue.c (USE_AESNI_AVX, USE_AESNI_AVX2): Enable when
16528 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16529 [USE_AESNI_AVX || USE_AESNI_AVX2] (ASM_FUNC_ABI, ASM_EXTRA_STACK): New.
16530 (_gcry_camellia_aesni_avx_ctr_enc, _gcry_camellia_aesni_avx_cbc_dec)
16531 (_gcry_camellia_aesni_avx_cfb_dec, _gcry_camellia_aesni_avx_keygen)
16532 (_gcry_camellia_aesni_avx2_ctr_enc, _gcry_camellia_aesni_avx2_cbc_dec)
16533 (_gcry_camellia_aesni_avx2_cfb_dec): Add ASM_FUNC_ABI.
16534
16535 Enable AMD64 Blowfish implementation on WIN64.
16536 + commit e05682093ffb003b589a697428d918d755ac631d
16537 * cipher/blowfish-amd64.S: Enable when
16538 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16539 (ELF): New macro to mask lines with ELF specific commands.
16540 * cipher/blowfish.c (USE_AMD64_ASM): Enable when
16541 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16542 [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS] (call_sysv_fn): New.
16543 (do_encrypt, do_encrypt_block, do_decrypt_block)
16544 [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS]: Call assembly
16545 function through 'call_sysv_fn'.
16546 (blowfish_amd64_ctr_enc, blowfish_amd64_cbc_dec)
16547 (blowfish_amd64_cfb_dec): New wrapper functions for bulk
16548 assembly functions.
16549 ..
16550
16551 Enable AMD64 arcfour implementation on WIN64.
16552 + commit c46b015bedba7ce0db68929bd33a86a54ab3d919
16553 * cipher/arcfour-amd64.S: Enable when
16554 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16555 (ELF): New macro to mask lines with ELF specific commands.
16556 * cipher/arcfour.c (USE_AMD64_ASM): Enable when
16557 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16558 (do_encrypt, do_decrypt) [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS]: Use
16559 assembly block to call AMD64 assembly function.
16560
16561 Update documentation for Poly1305-ChaCha20 AEAD, RFC-7539.
16562 + commit ee8fc4edcb3466b03246c8720b90731bf274ff1d
16563 * cipher/cipher-poly1305.c: Add RFC-7539 to header.
16564 * doc/gcrypt.texi: Update Poly1305 AEAD documentation with mention of
16565 RFC-7539; Drop Salsa from supported stream ciphers for Poly1305 AEAD.
16566
16567 hwf-x86: use edi for passing value to ebx for i386 cpuid.
16568 + commit bac42c68b069f17abcca810a21439c7233815747
16569 * src/hwf-x86.c [__i386__] (get_cpuid): Use '=D' for regs[1] instead
16570 of '=r'.
16571
16572 hwf-x86: add EDX as output register for xgetbv asm block.
16573 + commit e15beb584a5ebdfc363e1ff15f87102508652d71
16574 * src/hwf-x86.c (get_xgetbv): Add EDX as output.
16575
16576 2015-05-04 Werner Koch <[email protected]>
16577
16578 build: Update build-aux files.
16579 + commit 5a7d55eed3316f40ca61acbee032bfc285e28803
16580
16581
16582 Fix possible regression on old 32 bit mingw compilers.
16583 + commit 090ca7435156b5f52064357dd59059570d466f46
16584 * acinclude.m4: Add new pattern for mingw32.
16585
16586 build: Add new file.
16587 + commit 4af52b2e72ce004b7d8f99e09c4324e3c2a84379
16588 * mpi/amd64/distfiles: Add func_abi.h.
16589
16590 2015-05-03 Jussi Kivilinna <[email protected]>
16591
16592 Fix WIN64 assembly glue for AES.
16593 + commit 24a769a7c7601dbb85332e550f6fbd121b56df5f
16594 * cipher/rinjdael.c (do_encrypt, do_decrypt)
16595 [!HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS]: Change input operands to
16596 input+output to mark volatile nature of the used registers.
16597
16598 Add '1 million a characters' test vectors.
16599 + commit 2f4fefdbc62857b6e2da26ce111ee140a068c471
16600 * tests/basic.c (check_digests): Add "!" test vectors for MD5, SHA-384,
16601 SHA-512, RIPEMD160 and CRC32.
16602
16603 2015-05-02 Jussi Kivilinna <[email protected]>
16604
16605 More optimized CRC implementations.
16606 + commit 06e122baa3321483a47bbf82fd2a4540becfa0c9
16607 * cipher/crc.c (crc32_table, crc24_table): Replace with new table
16608 contents.
16609 (update_crc32, CRC24_INIT, CRC24_POLY): Remove.
16610 (crc32_next, crc32_next4, crc24_init, crc24_next, crc24_next4)
16611 (crc24_final): New.
16612 (crc24rfc2440_init): Use crc24_init.
16613 (crc32_write): Rewrite to use crc32_next & crc32_next4.
16614 (crc24_write): Rewrite to use crc24_next & crc24_next4.
16615 (crc32_final, crc32rfc1510_final): Use buf_put_be32.
16616 (crc24rfc2440_final): Use crc24_final & buf_put_le32.
16617 * tests/basic.c (check_digests): Add CRC "123456789" tests.
16618
16619 Enable AMD64 AES implementation for WIN64.
16620 + commit 66129b3334a5aa54ff8a97981507e4704f759571
16621 * cipher/rijndael-amd64.S: Enable when
16622 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16623 (ELF): New macro to mask lines with ELF specific commands.
16624 * cipher/rijndael-internal.h (USE_AMD64_ASM): Enable when
16625 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16626 (do_encrypt, do_decrypt)
16627 [USE_AMD64_ASM && !HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS]: Use
16628 assembly block to call AMD64 assembly encrypt/decrypt function.
16629
16630 Enable AMD64 Whirlpool implementation for WIN64.
16631 + commit 8422d5d699265b960bd1ca837044ee052fc5b614
16632 * cipher/whirlpool-sse2-amd64.S: Enable when
16633 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16634 (ELF): New macro to mask lines with ELF specific commands.
16635 * cipher/whirlpool.c (USE_AMD64_ASM): Enable when
16636 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16637 [USE_AMD64_ASM] (ASM_FUNC_ABI, ASM_EXTRA_STACK): New.
16638 [USE_AMD64_ASM] (_gcry_whirlpool_transform_amd64): Add ASM_FUNC_ABI to
16639 prototype.
16640 [USE_AMD64_ASM] (whirlpool_transform): Add ASM_EXTRA_STACK to stack
16641 burn value.
16642
16643 Enable AMD64 SHA512 implementations for WIN64.
16644 + commit 1089a13073c26a9a456e43ec38d937e6ee7f4077
16645 * cipher/sha512-avx-amd64.S: Enable when
16646 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16647 (ELF): New macro to mask lines with ELF specific commands.
16648 * cipher/sha512-avx-bmi2-amd64.S: Ditto.
16649 * cipher/sha512-ssse3-amd64.S: Ditto.
16650 * cipher/sha512.c (USE_SSSE3, USE_AVX, USE_AVX2): Enable when
16651 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16652 [USE_SSSE3 || USE_AVX || USE_AVX2] (ASM_FUNC_ABI)
16653 (ASM_EXTRA_STACK): New.
16654 (_gcry_sha512_transform_amd64_ssse3, _gcry_sha512_transform_amd64_avx)
16655 (_gcry_sha512_transform_amd64_avx_bmi2): Add ASM_FUNC_ABI to
16656 prototypes.
16657 (transform): Add ASM_EXTRA_STACK to stack burn value.
16658
16659 Enable AMD64 SHA256 implementations for WIN64.
16660 + commit 022959099644f64df5f2a83ade21159864f64837
16661 * cipher/sha256-avx-amd64.S: Enable when
16662 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16663 (ELF): New macro to mask lines with ELF specific commands.
16664 * cipher/sha256-avx2-bmi2-amd64.S: Ditto.
16665 * cipher/sha256-ssse3-amd64.S: Ditto.
16666 * cipher/sha256.c (USE_SSSE3, USE_AVX, USE_AVX2): Enable when
16667 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16668 [USE_SSSE3 || USE_AVX || USE_AVX2] (ASM_FUNC_ABI)
16669 (ASM_EXTRA_STACK): New.
16670 (_gcry_sha256_transform_amd64_ssse3, _gcry_sha256_transform_amd64_avx)
16671 (_gcry_sha256_transform_amd64_avx2): Add ASM_FUNC_ABI to prototypes.
16672 (transform): Add ASM_EXTRA_STACK to stack burn value.
16673
16674 Enable AMD64 SHA1 implementations for WIN64.
16675 + commit e433676a899fa0d274d40547166b03c7c8bd8e78
16676 * cipher/sha1-avx-amd64.S: Enable when
16677 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16678 (ELF): New macro to mask lines with ELF specific commands.
16679 * cipher/sha1-avx-bmi2-amd64.S: Ditto.
16680 * cipher/sha1-ssse3-amd64.S: Ditto.
16681 * cipher/sha1.c (USE_SSSE3, USE_AVX, USE_BMI2): Enable
16682 when HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined.
16683 [USE_SSSE3 || USE_AVX || USE_BMI2] (ASM_FUNC_ABI)
16684 (ASM_EXTRA_STACK): New.
16685 (_gcry_sha1_transform_amd64_ssse3, _gcry_sha1_transform_amd64_avx)
16686 (_gcry_sha1_transform_amd64_avx_bmi2): Add ASM_FUNC_ABI to
16687 prototypes.
16688 (transform): Add ASM_EXTRA_STACK to stack burn value.
16689
16690 2015-05-01 Jussi Kivilinna <[email protected]>
16691
16692 Enable AES/AES-NI, AES/SSSE3 and GCM/PCLMUL implementations on WIN64.
16693 + commit 4e09aaa36d151c3312019724a77fc09aa345b82f
16694 * cipher/cipher-gcm-intel-pclmul.c (_gcry_ghash_intel_pclmul)
16695 ( _gcry_ghash_intel_pclmul) [__WIN64__]: Store non-volatile vector
16696 registers before use and restore after.
16697 * cipher/cipher-internal.h (GCM_USE_INTEL_PCLMUL): Remove dependency
16698 on !defined(__WIN64__).
16699 * cipher/rijndael-aesni.c [__WIN64__] (aesni_prepare_2_6_variable,
16700 aesni_prepare, aesni_prepare_2_6, aesni_cleanup)
16701 ( aesni_cleanup_2_6): New.
16702 [!__WIN64__] (aesni_prepare_2_6_variable, aesni_prepare_2_6): New.
16703 (_gcry_aes_aesni_do_setkey, _gcry_aes_aesni_cbc_enc)
16704 (_gcry_aesni_ctr_enc, _gcry_aesni_cfb_dec, _gcry_aesni_cbc_dec)
16705 (_gcry_aesni_ocb_crypt, _gcry_aesni_ocb_auth): Use
16706 'aesni_prepare_2_6'.
16707 * cipher/rijndael-internal.h (USE_SSSE3): Enable if
16708 HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS or
16709 HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS.
16710 (USE_AESNI): Remove dependency on !defined(__WIN64__)
16711 * cipher/rijndael-ssse3-amd64.c [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS]
16712 (vpaes_ssse3_prepare, vpaes_ssse3_cleanup): New.
16713 [!HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS] (vpaes_ssse3_prepare): New.
16714 (vpaes_ssse3_prepare_enc, vpaes_ssse3_prepare_dec): Use
16715 'vpaes_ssse3_prepare'.
16716 (_gcry_aes_ssse3_do_setkey, _gcry_aes_ssse3_prepare_decryption): Use
16717 'vpaes_ssse3_prepare' and 'vpaes_ssse3_cleanup'.
16718 [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS] (X): Add masking macro to
16719 exclude '.type' and '.size' markers from assembly code, as they are
16720 not support on WIN64/COFF objects.
16721 * configure.ac (gcry_cv_gcc_attribute_ms_abi)
16722 (gcry_cv_gcc_attribute_sysv_abi, gcry_cv_gcc_default_abi_is_ms_abi)
16723 (gcry_cv_gcc_default_abi_is_sysv_abi)
16724 (gcry_cv_gcc_win64_platform_as_ok): New checks.
16725
16726 Add W64 support for mpi amd64 assembly.
16727 + commit 460355f23e770637d29e3af7b998a957a2b5bc88
16728 acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): Set
16729 'ac_cv_sys_symbol_underscore=no' on MingW-W64.
16730 mpi/amd64/func_abi.h: New.
16731 mpi/amd64/mpih-add1.S (_gcry_mpih_add_n): Add FUNC_ENTRY and FUNC_EXIT.
16732 mpi/amd64/mpih-lshift.S (_gcry_mpih_lshift): Ditto.
16733 mpi/amd64/mpih-mul1.S (_gcry_mpih_mul_1): Ditto.
16734 mpi/amd64/mpih-mul2.S (_gcry_mpih_addmul_1): Ditto.
16735 mpi/amd64/mpih-mul3.S (_gcry_mpih_submul_1): Ditto.
16736 mpi/amd64/mpih-rshift.S (_gcry_mpih_rshift): Ditto.
16737 mpi/amd64/mpih-sub1.S (_gcry_mpih_sub_n): Ditto.
16738 mpi/config.links [host=x86_64-*mingw*]: Enable assembly modules.
16739 [host=x86_64-*-*]: Append mpi/amd64/func_abi.h to mpi/asm-syntax.h.
16740
16741 DES: Silence compiler warnings on Windows.
16742 + commit 6c21cf5fed1ad430fa41445eac2350802bc8aaed
16743 * cipher/des.c (working_memcmp): Make pointer arguments 'const void *'.
16744
16745 Cast pointers to integers using uintptr_t instead of long.
16746 + commit 9cf224322007d90193d4910f0da6e0e29ce01d70
16747
16748
16749 Fix rndhw for 64-bit Windows build.
16750 + commit d5a7e00b6b222566a5650639ef29684b047c1909
16751 * configure.ac: Add sizeof check for 'void *'.
16752 * random/rndhw.c (poll_padlock): Check for SIZEOF_VOID_P == 8
16753 instead of defined(__LP64__).
16754 (RDRAND_LONG): Check for SIZEOF_UNSIGNED_LONG == 8 instead of
16755 defined(__LP64__).
16756
16757 Prepare random/win32.c fast poll for 64-bit Windows.
16758 + commit 0cdd24456b33defc7f8176fa82ab694fbc284385
16759 * random/win32.c (_gcry_rndw32_gather_random_fast) [ADD]: Rename to
16760 ADDINT.
16761 (_gcry_rndw32_gather_random_fast): Add ADDPTR.
16762 (_gcry_rndw32_gather_random_fast): Disable entropy gathering from
16763 GetQueueStatus(QS_ALLEVENTS).
16764 (_gcry_rndw32_gather_random_fast): Change minimumWorkingSetSize and
16765 maximumWorkingSetSize to SIZE_T from DWORD.
16766 (_gcry_rndw32_gather_random_fast): Only add lower 32-bits of
16767 minimumWorkingSetSize and maximumWorkingSetSize to random poll.
16768 (_gcry_rndw32_gather_random_fast) [__WIN64__]: Read TSC directly
16769 using intrinsic.
16770
16771 Disable GCM and AES-NI assembly implementations for WIN64.
16772 + commit f701954555340a503f6e52cc18d58b0c515427b7
16773 * cipher/cipher-internal.h (GCM_USE_INTEL_PCLMUL): Do not enable when
16774 __WIN64__ defined.
16775 * cipher/rijndael-internal.h (USE_AESNI): Ditto.
16776
16777 Disable building mpi assembly routines on WIN64.
16778 + commit e78560a4b717f7154f910a8ce4128de152f586da
16779 * mpi/config.links: Disable assembly for host 'x86_64-*mingw32*'.
16780
16781 Fix packed attribute check for Windows targets.
16782 + commit e886e4f5e73fe6a9f9191f5155852ce5d8bb88fe
16783 * configure.ac (gcry_cv_gcc_attribute_packed): Move 'long b' to its
16784 own packed structure.
16785
16786 Fix tail handling in buf_xor_1.
16787 + commit c2dba93e639639bdac139b3a3a456d10ddc61f79
16788 * cipher/bufhelp.h (buf_xor_1): Increment source pointer at tail
16789 handling.
16790
16791 Add --disable-hwf for basic tests.
16792 + commit 839a3bbe2bb045139223b32753d656cc6c3d4669
16793 * tests/basic.c (main): Add handling for '--disable-hwf'.
16794
16795 Use more odd chuck sizes for check_one_md.
16796 + commit 9f086ffa43f2507b9d17522a0a2e394cb273baf8
16797 * tests/basic.c (check_one_md): Make chuck size vary oddly, instead
16798 of using fixed length of 1000 bytes.
16799
16800 Enable more modes in basic ciphers test.
16801 + commit e40eff94f9f8654c3d29e03bbb7e5ee6a43c1435
16802 * src/gcrypt.h.in (GCRY_OCB_BLOCK_LEN): New.
16803 * tests/basic.c (check_one_cipher_core_reset): New.
16804 (check_one_cipher_core): Use check_one_cipher_core_reset inplace of
16805 gcry_cipher_reset.
16806 (check_ciphers): Add CCM and OCB modes for block cipher tests.
16807
16808 Fix reseting cipher in OCB mode.
16809 + commit 88842cbc68beb4f73c87fdbcb74182cba818f789
16810 * cipher/cipher.c (cipher_reset): Setup default taglen for OCB after
16811 clearing state.
16812
16813 2015-04-30 Jussi Kivilinna <[email protected]>
16814
16815 Fix buggy RC4 AMD64 assembly and add test to notice similar issues.
16816 + commit 124dfce7c5a2d9405fa2b2832e91ac1267943830
16817 * cipher/arcfour-amd64.S (_gcry_arcfour_amd64): Fix swapped store of
16818 'x' and 'y'.
16819 * tests/basic.c (get_algo_mode_blklen): New.
16820 (check_one_cipher_core): Add new tests for split buffer input on
16821 encryption and decryption.
16822
16823 2015-04-26 Jussi Kivilinna <[email protected]>
16824
16825 Disallow compiler from generating SSE instructions in mixed C+asm source
16826 + commit f88266c0f868d7bf51a215d5531bb9f2b4dad19e
16827 * cipher/cipher-gcm-intel-pclmul.c [gcc-version >= 4.4]: Add GCC target
16828 pragma to disable compiler use of SSE.
16829 * cipher/rijndael-aesni.c [gcc-version >= 4.4]: Ditto.
16830 * cipher/rijndael-ssse3-amd64.c [gcc-version >= 4.4]: Ditto.
16831
16832 2015-04-18 Jussi Kivilinna <[email protected]>
16833
16834 Add OCB bulk crypt/auth functions for AES/AES-NI.
16835 + commit 305cc878d395475c46b4ef52f4764bd0c85bf8ac
16836 * cipher/cipher-internal.h (gcry_cipher_handle): Add bulk.ocb_crypt
16837 and bulk.ocb_auth.
16838 (_gcry_cipher_ocb_get_l): New prototype.
16839 * cipher/cipher-ocb.c (get_l): Rename to ...
16840 (_gcry_cipher_ocb_get_l): ... this.
16841 (_gcry_cipher_ocb_authenticate, ocb_crypt): Use bulk function when
16842 available.
16843 * cipher/cipher.c (_gcry_cipher_open_internal): Setup OCB bulk
16844 functions for AES.
16845 * cipher/rijndael-aesni.c (get_l, aesni_ocb_enc, aes_ocb_dec)
16846 (_gcry_aes_aesni_ocb_crypt, _gcry_aes_aesni_ocb_auth): New.
16847 * cipher/rijndael.c [USE_AESNI] (_gcry_aes_aesni_ocb_crypt)
16848 (_gcry_aes_aesni_ocb_auth): New prototypes.
16849 (_gcry_aes_ocb_crypt, _gcry_aes_ocb_auth): New.
16850 * src/cipher.h (_gcry_aes_ocb_crypt, _gcry_aes_ocb_auth): New
16851 prototypes.
16852 * tests/basic.c (check_ocb_cipher_largebuf): New.
16853 (check_ocb_cipher): Add large buffer encryption/decryption test.
16854
16855 2015-04-15 Werner Koch <[email protected]>
16856
16857 tests: Add option to time the S2K function.
16858 + commit fe38d3815b4cd203cd529949e244aca80d32897f
16859 * tests/t-kdf.c: Include stopwatch.h.
16860 (dummy_consumer): new.
16861 (bench_s2k): New.
16862 (main): Add option parser and option --s2k.
16863
16864 tests: Improve stopwatch.h.
16865 + commit 3b03a3b493233a472da531d8d9582d1be6d376b0
16866 * tests/stopwatch.h (elapsed_time): Add arg divisor.
16867
16868 2015-04-13 Werner Koch <[email protected]>
16869
16870 mpi: Fix gcry_mpi_copy for NULL opaque data.
16871 + commit 9fca46864e1b5a9c788072113589454adb89fa97
16872 * mpi/mpiutil.c (_gcry_mpi_copy): Copy opaque only if needed.
16873
16874 2015-03-21 Jussi Kivilinna <[email protected]>
16875
16876 wipememory: use one-byte aligned type for unaligned memory accesses.
16877 + commit a06fbc0d1e98eb1218eff55ad2f37d471e4f33b2
16878 * src/g10lib.h (fast_wipememory2_unaligned_head): Enable unaligned
16879 access only when HAVE_GCC_ATTRIBUTE_PACKED and
16880 HAVE_GCC_ATTRIBUTE_ALIGNED defined.
16881 (fast_wipememory_t): New.
16882 (fast_wipememory2): Use 'fast_wipememory_t'.
16883
16884 bufhelp: use one-byte aligned type for unaligned memory accesses.
16885 + commit 92fa5f16d69707e302c0f85b2e5e80af8dc037f1
16886 * cipher/bufhelp.h (BUFHELP_FAST_UNALIGNED_ACCESS): Enable only when
16887 HAVE_GCC_ATTRIBUTE_PACKED and HAVE_GCC_ATTRIBUTE_ALIGNED are defined.
16888 (bufhelp_int_t): New type.
16889 (buf_cpy, buf_xor, buf_xor_1, buf_xor_2dst, buf_xor_n_copy_2): Use
16890 'bufhelp_int_t'.
16891 [BUFHELP_FAST_UNALIGNED_ACCESS] (bufhelp_u32_t, bufhelp_u64_t): New.
16892 [BUFHELP_FAST_UNALIGNED_ACCESS] (buf_get_be32, buf_get_le32)
16893 (buf_put_be32, buf_put_le32, buf_get_be64, buf_get_le64)
16894 (buf_put_be64, buf_put_le64): Use 'bufhelp_uXX_t'.
16895 * configure.ac (gcry_cv_gcc_attribute_packed): New.
16896
16897 tests/bench-slope: fix memory-leak and use-after-free bugs.
16898 + commit aa234561d00c3fb15fe501df4bf58f3db7c7c06b
16899 * tests/bench-slope.c (do_slope_benchmark): Free 'measurements' at end.
16900 (bench_mac_init): Move 'key' free at end of function.
16901
16902 2015-03-19 Werner Koch <[email protected]>
16903
16904 Fix two pedantic warnings.
16905 + commit f5832285b0e420d77be1b8da10a1e1d86583b414
16906 * src/gcrypt.h.in (gcry_mpi_flag, gcry_mac_algos): Remove trailing
16907 comma.
16908
16909 2015-03-16 Werner Koch <[email protected]>
16910
16911 Use well defined type instead of size_t in secmem.c.
16912 + commit db8ae3616987fa288173446398a107e31e2e28aa
16913 * src/secmem.c (ptr_into_pool_p): Replace size_t by uintptr_t.
16914
16915 Make uintptr_t global available.
16916 + commit f0f60c1a04d664936bcf52e8f46705bdc63e7ad9
16917 * cipher/bufhelp.h: Move include for uintptr_t to ...
16918 * src/types.h: here. Check that config.h has been included.
16919
16920 mpi: Remove useless condition.
16921 + commit 0a9cdb8ae092d050ca12a7a4f2f50e25b82154ec
16922 * mpi/mpi-pow.c: Remove condition rp==mp.
16923
16924 cipher: Remove useless NULL check.
16925 + commit fbb97dcf763e28e81e01092ad4c934b3eaf88cc8
16926 * cipher/hash-common.c (_gcry_md_block_write): Remove NUL check for
16927 hd->buf.
16928
16929 2015-02-28 Jussi Kivilinna <[email protected]>
16930
16931 Fix in-place encryption for OCB mode.
16932 + commit 5e66a4f8d5a63f58caeee367433dd8dd32346083
16933 * cipher/cipher-ocb.c (ocb_checksum): New.
16934 (ocb_crypt): Move checksum calculation outside main crypt loop, do
16935 checksum calculation for encryption before inbuf is overwritten.
16936 * tests/basic.c (check_ocb_cipher): Rename to ...
16937 (do_check_ocb_cipher): ... to this and add argument for testing
16938 in-place encryption/decryption.
16939 (check_ocb_cipher): New.
16940
16941 2015-02-27 NIIBE Yutaka <[email protected]>
16942
16943 tests: fix t-sexp.c.
16944 + commit 505decf5369970219ddc9e78a20f97c623957b78
16945 * tests/t-sexp.c (bug_1594): Free N and PUBKEY.
16946
16947 mpi: Avoid data-dependent timing variations in mpi_powm.
16948 + commit 6636c4fd0c6ceab9f79827bf96967d1e112c0b82
16949 * mpi/mpi-pow.c (mpi_powm): Access all data in the table by
16950 mpi_set_cond.
16951
16952 mpi: Revise mpi_powm.
16953 + commit 1fa8cdb933505960d4e4b4842b122d4e06953e88
16954 * mpi/mpi-pow.c (_gcry_mpi_powm): Rename the table to PRECOMP.
16955
16956 2015-02-23 Werner Koch <[email protected]>
16957
16958 cipher: Use ciphertext blinding for Elgamal decryption.
16959 + commit 410d70bad9a650e3837055e36f157894ae49a57d
16960 * cipher/elgamal.c (USE_BLINDING): New.
16961 (decrypt): Rewrite to use ciphertext blinding.
16962
16963 2015-02-12 NIIBE Yutaka <[email protected]>
16964
16965 mpi: Add mpi_set_cond.
16966 + commit 653a9fa1a3a4c35a4dc1841cb57d7e2a318f3288
16967 * mpi/mpiutil.c (_gcry_mpi_set_cond): New.
16968 (_gcry_mpi_swap_cond): Fix types.
16969 * src/mpi.h (mpi_set_cond): New.
16970
16971 2015-01-30 Werner Koch <[email protected]>
16972
16973 w32: Use -static-libgcc to avoid linking to libgcc_s_sjlj-1.dll.
16974 + commit 40a7bdf50e19faaf106470897fed72af623adc50
16975 * src/Makefile.am (extra_ltoptions): New.
16976 (libgcrypt_la_LDFLAGS): Use it.
16977
16978 2015-01-28 Werner Koch <[email protected]>
16979
16980 Fix building of GOST s-boxes when cross-compiling.
16981 + commit 2564d204e408b296425ac0660c6bdc6270575fb6
16982 * cipher/Makefile.am (gost-s-box): USe CC_FOR_BUILD.
16983 (noinst_PROGRAMS): Remove.
16984 (EXTRA_DIST): New.
16985 (CLEANFILES): New.
16986
16987 2015-01-20 Jussi Kivilinna <[email protected]>
16988
16989 rijndael: fix wrong ifdef for SSSE3 setkey.
16990 + commit ceaa97f0d849c07f3a15b642fc3a2b0a477b4a47
16991 * cipher/rijndael.c (do_setkey): Use USE_SSSE3 instead of USE_AESNI
16992 around SSSE3 setkey selection.
16993
16994 2015-01-16 Werner Koch <[email protected]>
16995
16996 Add OCB cipher mode.
16997 + commit 067d7d8752d4d8a98f8e0e5e9b1a5b13e1b7ff9c
16998 * cipher/cipher-ocb.c: New.
16999 * cipher/Makefile.am (libcipher_la_SOURCES): Add cipher-ocb.c
17000 * cipher/cipher-internal.h (OCB_BLOCK_LEN, OCB_L_TABLE_SIZE): New.
17001 (gcry_cipher_handle): Add fields marks.finalize and u_mode.ocb.
17002 * cipher/cipher.c (_gcry_cipher_open_internal): Add OCB mode.
17003 (_gcry_cipher_open_internal): Setup default taglen of OCB.
17004 (cipher_reset): Clear OCB specific data.
17005 (cipher_encrypt, cipher_decrypt, _gcry_cipher_authenticate)
17006 (_gcry_cipher_gettag, _gcry_cipher_checktag): Call OCB functions.
17007 (_gcry_cipher_setiv): Add OCB specific nonce setting.
17008 (_gcry_cipher_ctl): Add GCRYCTL_FINALIZE and GCRYCTL_SET_TAGLEN
17009
17010 * src/gcrypt.h.in (GCRYCTL_SET_TAGLEN): New.
17011 (gcry_cipher_final): New.
17012
17013 * cipher/bufhelp.h (buf_xor_1): New.
17014
17015 * tests/basic.c (hex2buffer): New.
17016 (check_ocb_cipher): New.
17017 (main): Call it here. Add option --cipher-modes.
17018 * tests/bench-slope.c (bench_aead_encrypt_do_bench): Call
17019 gcry_cipher_final.
17020 (bench_aead_decrypt_do_bench): Ditto.
17021 (bench_aead_authenticate_do_bench): Ditto. Check error code.
17022 (bench_ocb_encrypt_do_bench): New.
17023 (bench_ocb_decrypt_do_bench): New.
17024 (bench_ocb_authenticate_do_bench): New.
17025 (ocb_encrypt_ops): New.
17026 (ocb_decrypt_ops): New.
17027 (ocb_authenticate_ops): New.
17028 (cipher_modes): Add them.
17029 (cipher_bench_one): Skip wrong block length for OCB.
17030 * tests/benchmark.c (cipher_bench): Add field noncelen to MODES. Add
17031 OCB support.
17032
17033 2015-01-15 Werner Koch <[email protected]>
17034
17035 Add functions to count trailing zero bits in a word.
17036 + commit 9d2a22c94ae99f9301321082c4fb8d73f4085fda
17037 * cipher/bithelp.h (_gcry_ctz, _gcry_ctz64): New.
17038 * configure.ac (HAVE_BUILTIN_CTZ): Add new test.
17039
17040 2015-01-08 Werner Koch <[email protected]>
17041
17042 cipher: Prepare for OCB mode.
17043 + commit 9d328962660da72f094dc5424d5ef67abbaffdf6
17044 * src/gcrypt.h.in (GCRY_CIPHER_MODE_OCB): New.
17045
17046 2015-01-06 Werner Koch <[email protected]>
17047
17048 Make make distcheck work again.
17049 + commit 4f7dcdc25af269b12275126edeef30b262fb891d
17050 * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Remove --enable-ciphers.
17051 * cipher/Makefile.am (DISTCLEANFILES): Add gost-sb.h.
17052
17053 2015-01-06 Dmitry Eremin-Solenikov <[email protected]>
17054
17055 stribog: Reduce table size to the needed one.
17056 + commit e4de52378a85cf383994ded8edf0d5cf98dcb10c
17057 * cipher/stribog.c (C16): Avoid allocating superfluous space.
17058
17059 gostr3411-94: Fix the iteration count for length filling loop.
17060 + commit 05dc5bcd234909ae9c9366b653346076b9a834ed
17061 * cipher/gostr3411-94.c (gost3411_final): Fix loop
17062
17063 2015-01-05 Werner Koch <[email protected]>
17064
17065 random: Silent warning under NetBSD using rndunix.
17066 + commit 817472358a093438e802380caecf7139406400cf
17067 * random/rndunix.c (STDERR_FILENO): Define if needed.
17068 (start_gatherer): Re-open standard descriptors. Fix an
17069 unsigned/signed pointer warning.
17070
17071 primegen: Fix memory leak for invalid call sequences.
17072 + commit 8c5eee51d9a25b143e41ffb7ff4a6b2a29b82d83
17073 * cipher/primegen.c (prime_generate_internal): Refactor generator code
17074 to not leak memory for non-implemented feature.
17075 (_gcry_prime_group_generator): Refactor to not leak memory for invalid
17076 args. Also make sure that R_G is set as soon as possible.
17077
17078 doc: Update yat2m to current upstream version (GnuPG).
17079 + commit dd5df198727ea5d8f6b04288e14fd732051453c8
17080
17081
17082 build: Require automake 1.14.
17083 + commit f65276970a6dcd6d9bca94cecc49b68acdcc9492
17084 * configure.ac (AM_INIT_AUTOMAKE): Add serial-tests.
17085
17086 Replace camel case of internal scrypt functions.
17087 + commit 1a6d65ac0aab335541726d02f2046d883a768ec3
17088 * cipher/scrypt.c (_salsa20_core): Rename to salsa20_core. Change
17089 callers.
17090 (_scryptBlockMix): Rename to scrypt_block_mix. Change callers.
17091 (_scryptROMix): Rename to scrypt_ro_mix. Change callers.
17092
17093 2015-01-02 Jussi Kivilinna <[email protected]>
17094
17095 rmd160: restore native-endian store in _gcry_rmd160_mixblock.
17096 + commit d7c7453cf5e6b8f3c6b522a30e680f844a28c9de
17097 * cipher/rmd160.c (_gcry_rmd160_mixblock): Store result to buffer in
17098 native-endianess.
17099
17100 2014-12-27 Jussi Kivilinna <[email protected]>
17101
17102 Add Intel SSSE3 based vector permutation AES implementation.
17103 + commit 8eabecc883332156adffc1df42d27f614c157e06
17104 * cipher/Makefile.am: Add 'rijndael-ssse3-amd64.c'.
17105 * cipher/rijndael-internal.h (USE_SSSE3): New.
17106 (RIJNDAEL_context_s) [USE_SSSE3]: Add 'use_ssse3'.
17107 * cipher/rijndael-ssse3-amd64.c: New.
17108 * cipher/rijndael.c [USE_SSSE3] (_gcry_aes_ssse3_do_setkey)
17109 (_gcry_aes_ssse3_prepare_decryption, _gcry_aes_ssse3_encrypt)
17110 (_gcry_aes_ssse3_decrypt, _gcry_aes_ssse3_cfb_enc)
17111 (_gcry_aes_ssse3_cbc_enc, _gcry_aes_ssse3_ctr_enc)
17112 (_gcry_aes_ssse3_cfb_dec, _gcry_aes_ssse3_cbc_dec): New.
17113 (do_setkey): Add HWF check for SSSE3 and setup for SSSE3
17114 implementation.
17115 (prepare_decryption, _gcry_aes_cfb_enc, _gcry_aes_cbc_enc)
17116 (_gcry_aes_ctr_enc, _gcry_aes_cfb_dec, _gcry_aes_cbc_dec): Add
17117 selection for SSSE3 implementation.
17118 * configure.ac [host=x86_64]: Add 'rijndael-ssse3-amd64.lo'.
17119
17120 2014-12-25 Jussi Kivilinna <[email protected]>
17121
17122 random-csprng: fix compiler warnings on ARM.
17123 + commit c2e1f8fea271f3ef8027809547c4a52e0b1e24a2
17124 * random/random-csprng.c (_gcry_rngcsprng_update_seed_file)
17125 (read_pool): Cast keypool and rndpool to 'unsigned long *' through
17126 'void *'.
17127
17128 scrypt: fix compiler warnings on ARM.
17129 + commit 1dab4c9422bf0f3cdc7a4d3ccf9db090abd90e94
17130 * cipher/scrypt.c (_scryptBlockMix): Cast X to 'u32 *' through 'void *'.
17131
17132 secmem: fix compiler warnings on ARM.
17133 + commit 99faf9cb34f872144313403f29f3379798debfc9
17134 * src/secmem.c (ADDR_TO_BLOCK, mb_get_next, mb_get_new): Cast pointer
17135 from 'char *' to 'memblock_t *' through 'void *'.
17136 (MB_WIPE_OUT): Remove unneeded cast to 'memblock_t *'.
17137
17138 hash: fix compiler warning on ARM.
17139 + commit 4515315f61fbf79413e150fbd1d5f5a2435f2bc5
17140 * cipher/md.c (md_open, md_copy): Cast 'char *' to ctx through
17141 'void *'.
17142 * cipher/md4.c (md4_final): Use buf_put_* helper instead of
17143 converting 'char *' to 'u32 *'.
17144 * cipher/md5.c (md5_final): Ditto.
17145 * cipher/rmd160.c (_gcry_rmd160_mixblock, rmd160_final): Ditto.
17146 * cipher/sha1.c (sha1_final): Ditto.
17147 * cipher/sha256.c (sha256_final): Ditto.
17148 * cipher/sha512.c (sha512_final): Ditto.
17149 * cipher/tiger.c (tiger_final): Ditto.
17150
17151 rijndael: fix compiler warnings on ARM.
17152 + commit cc26106dbebeb84d481661813edc3e5aea9a7d99
17153 * cipher/rijndael-internal.h (RIJNDAEL_context_s): Add u32 variants of
17154 keyschedule arrays to unions u1 and u2.
17155 (keyschedenc32, keyscheddec32): New.
17156 * cipher/rijndael.c (u32_a_t): Remove.
17157 (do_setkey): Add and use tkk[].data32, k_u32, tk_u32 and W_u32; Remove
17158 casting byte arrays to u32_a_t.
17159 (prepare_decryption, do_encrypt_fn, do_decrypt_fn): Use keyschedenc32
17160 and keyscheddec32; Remove casting byte arrays to u32_a_t.
17161
17162 2014-12-23 Jussi Kivilinna <[email protected]>
17163
17164 Poly1305-AEAD: updated implementation to match draft-irtf-cfrg-chacha20-poly1305-03
17165 + commit 520070e02e2e6ee7228945015573a6e1f4895ec3
17166 * cipher/cipher-internal.h (gcry_cipher_handle): Use separate byte
17167 counters for AAD and data in Poly1305.
17168 * cipher/cipher-poly1305.c (poly1305_fill_bytecount): Remove.
17169 (poly1305_fill_bytecounts, poly1305_do_padding): New.
17170 (poly1305_aad_finish): Fill padding to Poly1305 and do not fill AAD
17171 length.
17172 (_gcry_cipher_poly1305_authenticate, _gcry_cipher_poly1305_encrypt)
17173 (_gcry_cipher_poly1305_decrypt): Update AAD and data length separately.
17174 (_gcry_cipher_poly1305_tag): Fill padding and bytecounts to Poly1305.
17175 (_gcry_cipher_poly1305_setkey, _gcry_cipher_poly1305_setiv): Reset
17176 AAD and data byte counts; only allow 96-bit IV.
17177 * cipher/cipher.c (_gcry_cipher_open_internal): Limit Poly1305-AEAD to
17178 ChaCha20 cipher.
17179 * tests/basic.c (_check_poly1305_cipher): Update test-vectors.
17180 (check_ciphers): Limit Poly1305-AEAD checks to ChaCha20.
17181 * tests/bench-slope.c (cipher_bench_one): Ditto.
17182
17183 chacha20: allow setting counter for stream random access.
17184 + commit 11b8d2d449a7bc664b4371ae14c57caa6704d272
17185 * cipher/chacha20.c (CHACHA20_CTR_SIZE): New.
17186 (chacha20_ivsetup): Add setup for full counter.
17187 (chacha20_setiv): Allow ivlen == CHACHA20_CTR_SIZE.
17188
17189 gcm: do not pass extra key pointer for setupM/fillM.
17190 + commit c964321c8a1328e89d636d899a45d68802f5ac9f
17191 * cipher/cipher-gcm-intel-pclmul.c
17192 (_gcry_ghash_setup_intel_pclmul): Remove 'h' parameter.
17193 * cipher/cipher-gcm.c (_gcry_ghash_setup_intel_pclmul): Ditto.
17194 (fillM): Get 'h' pointer from 'c'.
17195 (setupM): Remome 'h' parameter.
17196 (_gcry_cipher_gcm_setkey): Only pass 'c' to setupM.
17197
17198 rijndael: use more compact look-up tables and add table prefetching.
17199 + commit 2374753938df64f6fd8015b44613806a326eff1a
17200 * cipher/rijndael-internal.h (rijndael_prefetchfn_t): New.
17201 (RIJNDAEL_context): Add 'prefetch_enc_fn' and 'prefetch_dec_fn'.
17202 * cipher/rijndael-tables.h (S, T1, T2, T3, T4, T5, T6, T7, T8, S5, U1)
17203 (U2, U3, U4): Remove.
17204 (encT, dec_tables, decT, inv_sbox): Add.
17205 * cipher/rijndael.c (_gcry_aes_amd64_encrypt_block)
17206 (_gcry_aes_amd64_decrypt_block, _gcry_aes_arm_encrypt_block)
17207 (_gcry_aes_arm_encrypt_block): Add parameter for passing table pointer
17208 to assembly implementation.
17209 (prefetch_table, prefetch_enc, prefetch_dec): New.
17210 (do_setkey): Setup context prefetch functions depending on selected
17211 rijndael implementation; Use new tables for key setup.
17212 (prepare_decryption): Use new tables for decryption key setup.
17213 (do_encrypt_aligned): Rename to...
17214 (do_encrypt_fn): ... to this, change to use new compact tables,
17215 make handle unaligned input and unroll rounds loop by two.
17216 (do_encrypt): Remove handling of unaligned input/output; pass table
17217 pointer to assembly implementations.
17218 (rijndael_encrypt, _gcry_aes_cfb_enc, _gcry_aes_cbc_enc)
17219 (_gcry_aes_ctr_enc, _gcry_aes_cfb_dec): Prefetch encryption tables
17220 before encryption.
17221 (do_decrypt_aligned): Rename to...
17222 (do_decrypt_fn): ... to this, change to use new compact tables,
17223 make handle unaligned input and unroll rounds loop by two.
17224 (do_decrypt): Remove handling of unaligned input/output; pass table
17225 pointer to assembly implementations.
17226 (rijndael_decrypt, _gcry_aes_cbc_dec): Prefetch decryption tables
17227 before decryption.
17228 * cipher/rijndael-amd64.S: Use 1+1.25 KiB tables for
17229 encryption+decryption; remove tables from assembly file.
17230 * cipher/rijndael-arm.S: Ditto.
17231
17232 2014-12-15 Werner Koch <[email protected]>
17233
17234 build: Add configure option --disable-doc.
17235 + commit ad50e360ef4851e66e51a03fc420175636336b58
17236 * Makefile.am (AUTOMAKE_OPTIONS): Remove.
17237 (doc) [!BUILD_DOC]: Do not recurse into the dir.
17238 * configure.ac (AM_INIT_AUTOMAKE): Add option formerly in Makefile.am.
17239 (BUILD_DOC): Add new am_conditional.
17240
17241 2014-12-12 Jussi Kivilinna <[email protected]>
17242
17243 rijndael: further optimizations for AES-NI accelerated CBC and CFB bulk modes
17244 + commit 4f46374502eb988d701b904f83819e2cf7b1755c
17245 * cipher/rijndael-aesni.c (do_aesni_enc, do_aesni_dec): Pass
17246 input/output through SSE register XMM0.
17247 (do_aesni_cfb): Remove.
17248 (_gcry_aes_aesni_encrypt, _gcry_aes_aesni_decrypt): Add loading/storing
17249 input/output to/from XMM0.
17250 (_gcry_aes_aesni_cfb_enc, _gcry_aes_aesni_cbc_enc)
17251 (_gcry_aes_aesni_cfb_dec): Update to use renewed 'do_aesni_enc' and
17252 move IV loading/storing outside loop.
17253 (_gcry_aes_aesni_cbc_dec): Update to use renewed 'do_aesni_dec'.
17254
17255 GCM: move Intel PCLMUL accelerated implementation to separate file.
17256 + commit 4a0795af021305f9240f23626a3796157db46bd7
17257 * cipher/Makefile.am: Add 'cipher-gcm-intel-pclmul.c'.
17258 * cipher/cipher-gcm-intel-pclmul.c: New.
17259 * cipher/cipher-gcm.c [GCM_USE_INTEL_PCLMUL]
17260 (_gcry_ghash_setup_intel_pclmul, _gcry_ghash_intel_pclmul): New
17261 prototypes.
17262 [GCM_USE_INTEL_PCLMUL] (gfmul_pclmul, gfmul_pclmul_aggr4): Move
17263 to 'cipher-gcm-intel-pclmul.c'.
17264 (ghash): Rename to...
17265 (ghash_internal): ...this and move GCM_USE_INTEL_PCLMUL part to new
17266 function in 'cipher-gcm-intel-pclmul.c'.
17267 (setupM): Move GCM_USE_INTEL_PCLMUL part to new function in
17268 'cipher-gcm-intel-pclmul.c'; Add selection of ghash function based
17269 on available HW acceleration.
17270 (do_ghash_buf): Change use of 'ghash' to 'c->u_mode.gcm.ghash_fn'.
17271 * cipher/internal.h (ghash_fn_t): New.
17272 (gcry_cipher_handle): Remove 'use_intel_pclmul'; Add 'ghash_fn'.
17273
17274 2014-12-06 Jussi Kivilinna <[email protected]>
17275
17276 rijndael: split Padlock part to separate file.
17277 + commit cbf4c8cb6bbda15eea61885279f2a6f1d4bcedfd
17278 * cipher/Makefile.am: Add 'rijndael-padlock.c'.
17279 * cipher/rijndael-padlock.c: New.
17280 * cipher/rijndael.c (do_padlock, do_padlock_encrypt)
17281 (do_padlock_decrypt): Move to 'rijndael-padlock.c'.
17282 * configure.ac [mpi_cpu_arch=x86]: Add 'rijndael-padlock.lo'.
17283
17284 2014-12-01 Jussi Kivilinna <[email protected]>
17285
17286 rijndael: refactor to reduce number of #ifdefs and branches.
17287 + commit 3d5b51786e2050c461e9791b59142a731462b66d
17288 * cipher/rijndael-aesni.c (_gcry_aes_aesni_encrypt)
17289 (_gcry_aes_aesni_decrypt): Make return stack burn depth.
17290 * cipher/rijndael-amd64.S (_gcry_aes_amd64_encrypt_block)
17291 (_gcry_aes_amd64_decrypt_block): Ditto.
17292 * cipher/rijndael-arm.S (_gcry_aes_arm_encrypt_block)
17293 (_gcry_aes_arm_decrypt_block): Ditto.
17294 * cipher/rijndael-internal.h (RIJNDAEL_context_s)
17295 (rijndael_cryptfn_t): New.
17296 (RIJNDAEL_context): New members 'encrypt_fn' and 'decrypt_fn'.
17297 * cipher/rijndael.c (_gcry_aes_amd64_encrypt_block)
17298 (_gcry_aes_amd64_decrypt_block, _gcry_aes_aesni_encrypt)
17299 (_gcry_aes_aesni_decrypt, _gcry_aes_arm_encrypt_block)
17300 (_gcry_aes_arm_decrypt_block): Change prototypes.
17301 (do_padlock_encrypt, do_padlock_decrypt): New.
17302 (do_setkey): Separate key-length to rounds conversion from
17303 HW features check; Add selection for ctx->encrypt_fn and
17304 ctx->decrypt_fn.
17305 (do_encrypt_aligned, do_decrypt_aligned): Move inside
17306 '[!USE_AMD64_ASM && !USE_ARM_ASM]'; Move USE_AMD64_ASM and
17307 USE_ARM_ASM to...
17308 (do_encrypt, do_decrypt): ...here; Return stack depth; Remove second
17309 temporary buffer from non-aligned input/output case.
17310 (do_padlock): Move decrypt_flag to last argument; Return stack depth.
17311 (rijndael_encrypt): Remove #ifdefs, just call ctx->encrypt_fn.
17312 (_gcry_aes_cfb_enc, _gcry_aes_cbc_enc): Remove USE_PADLOCK; Call
17313 ctx->encrypt_fn in place of do_encrypt/do_encrypt_aligned.
17314 (_gcry_aes_ctr_enc): Call ctx->encrypt_fn in place of
17315 do_encrypt_aligned; Make tmp buffer 16-byte aligned and wipe buffer
17316 after use.
17317 (rijndael_encrypt): Remove #ifdefs, just call ctx->decrypt_fn.
17318 (_gcry_aes_cfb_dec): Remove USE_PADLOCK; Call ctx->decrypt_fn in place
17319 of do_decrypt/do_decrypt_aligned.
17320 (_gcry_aes_cbc_dec): Ditto; Make savebuf buffer 16-byte aligned.
17321
17322 rijndael: move AES-NI blocks before Padlock.
17323 + commit dbf9e95dd3891f6e6ad370e8ab78fec03595687b
17324 * cipher/rijndael.c (do_setkey, rijndael_encrypt, _gcry_aes_cfb_enc)
17325 (rijndael_decrypt, _gcry_aes_cfb_dec): Move USE_AESNI before
17326 USE_PADLOCK.
17327 (check_decryption_praparation) [USE_PADLOCK]: Move to...
17328 (prepare_decryption) [USE_PADLOCK]: ...here.
17329
17330 rijndael: split AES-NI functions to separate file.
17331 + commit 67d529630e838daeb8cb9c6d7ef660c01ef34fee
17332 * cipher/Makefile.in: Add 'rijndael-aesni.c'.
17333 * cipher/rijndael-aesni.c: New.
17334 * cipher/rijndael-internal.h: New.
17335 * cipher/rijndael.c (MAXKC, MAXROUNDS, BLOCKSIZE, ATTR_ALIGNED_16)
17336 (USE_AMD64_ASM, USE_ARM_ASM, USE_PADLOCK, USE_AESNI, RIJNDAEL_context)
17337 (keyschenc, keyschdec, padlockkey): Move to 'rijndael-internal.h'.
17338 (u128_s, aesni_prepare, aesni_cleanup, aesni_cleanup_2_6)
17339 (aesni_do_setkey, do_aesni_enc, do_aesni_dec, do_aesni_enc_vec4)
17340 (do_aesni_dec_vec4, do_aesni_cfb, do_aesni_ctr, do_aesni_ctr_4): Move
17341 to 'rijndael-aesni.c'.
17342 (prepare_decryption, rijndael_encrypt, _gcry_aes_cfb_enc)
17343 (_gcry_aes_cbc_enc, _gcry_aes_ctr_enc, rijndael_decrypt)
17344 (_gcry_aes_cfb_dec, _gcry_aes_cbc_dec) [USE_AESNI]: Move to functions
17345 in 'rijdael-aesni.c'.
17346 * configure.ac [mpi_cpu_arch=x86]: Add 'rijndael-aesni.lo'.
17347
17348 2014-11-24 Werner Koch <[email protected]>
17349
17350 Remove duplicated prototypes.
17351 + commit d53ea84bed37b973f7ce59262c50b33700cd8311
17352 * src/gcrypt-int.h (_gcry_mpi_ec_new, _gcry_mpi_ec_set_mpi)
17353 (gcry_mpi_ec_set_point): Remove.
17354
17355 tests: Add a prime mode to benchmark.
17356 + commit 1b4210c204a5ef5e631187509e011b8468a134ef
17357 * tests/benchmark.c (progress_cb): Add a single char mode.
17358 (prime_bench): New.
17359 (main): Add a "prime" mode. Factor with_progress out to file scope.
17360
17361 2014-11-19 NIIBE Yutaka <[email protected]>
17362
17363 ecc: Improve Montgomery curve implementation.
17364 + commit e6130034506013d6153465a2bedb6fb08a43f74d
17365 * cipher/ecc-curves.c (_gcry_ecc_fill_in_curve): Support
17366 MPI_EC_MONTGOMERY.
17367 * cipher/ecc.c (test_ecdh_only_keys): New.
17368 (nist_generate_key): Call test_ecdh_only_keys for MPI_EC_MONTGOMERY.
17369 (check_secret_key): Handle Montgomery curve of x-coordinate only.
17370 * mpi/ec.c (_gcry_mpi_ec_mul_point): Resize points before the loop.
17371 Simplify, using pointers of Q1, Q2, PRD, and SUM.
17372
17373 2014-11-02 Jussi Kivilinna <[email protected]>
17374
17375 Disable NEON for CPUs that are known to have broken NEON implementation.
17376 + commit 95eef21583d8e998efc48f22898c1ae31b77cb48
17377 * src/hwf-arm.c (detect_arm_proc_cpuinfo): Add parsing for CPU version
17378 information and check if CPU is known to have broken NEON
17379 implementation.
17380 (_gcry_hwf_detect_arm): Filter out broken HW features.
17381
17382 Add ARM/NEON implementation of Poly1305.
17383 + commit 0b520128551054d83fb0bb2db8873394f38de498
17384 * cipher/Makefile.am: Add 'poly1305-armv7-neon.S'.
17385 * cipher/poly1305-armv7-neon.S: New.
17386 * cipher/poly1305-internal.h (POLY1305_USE_NEON)
17387 (POLY1305_NEON_BLOCKSIZE, POLY1305_NEON_STATESIZE)
17388 (POLY1305_NEON_ALIGNMENT): New.
17389 * cipher/poly1305.c [POLY1305_USE_NEON]
17390 (_gcry_poly1305_armv7_neon_init_ext)
17391 (_gcry_poly1305_armv7_neon_finish_ext)
17392 (_gcry_poly1305_armv7_neon_blocks, poly1305_armv7_neon_ops): New.
17393 (_gcry_poly1305_init) [POLY1305_USE_NEON]: Select NEON implementation
17394 if HWF_ARM_NEON set.
17395 * configure.ac [neonsupport=yes]: Add 'poly1305-armv7-neon.lo'.
17396
17397 chacha20: add ARMv7/NEON implementation.
17398 + commit c584f44543883346d5a565581ff99a0afce9c5e1
17399 * cipher/Makefile.am: Add 'chacha20-armv7-neon.S'.
17400 * cipher/chacha20-armv7-neon.S: New.
17401 * cipher/chacha20.c (USE_NEON): New.
17402 [USE_NEON] (_gcry_chacha20_armv7_neon_blocks): New.
17403 (chacha20_do_setkey) [USE_NEON]: Use Neon implementation if
17404 HWF_ARM_NEON flag set.
17405 (selftest): Self-test encrypting buffer byte by byte.
17406 * configure.ac [neonsupport=yes]: Add 'chacha20-armv7-neon.lo'.
17407
17408 2014-10-08 Markus Teich <[email protected]>
17409
17410 mpi: Add gcry_mpi_ec_sub.
17411 + commit 23ecadf309f8056c35cc092e58df801ac0eab862
17412 * NEWS (gcry_mpi_ec_sub): New.
17413 * doc/gcrypt.texi (gcry_mpi_ec_sub): New.
17414 * mpi/ec.c (_gcry_mpi_ec_sub, sub_points_edwards): New.
17415 (sub_points_montgomery, sub_points_weierstrass): New stubs.
17416 * src/gcrypt-int.h (_gcry_mpi_ec_sub): New.
17417 * src/gcrypt.h.in (gcry_mpi_ec_sub): New.
17418 * src/libgcrypt.def (gcry_mpi_ec_sub): New.
17419 * src/libgcrypt.vers (gcry_mpi_ec_sub): New.
17420 * src/mpi.h (_gcry_mpi_ec_sub_points): New.
17421 * src/visibility.c (gcry_mpi_ec_sub): New.
17422 * src/visibility.h (gcry_mpi_ec_sub): New.
17423
17424 2014-10-08 Werner Koch <[email protected]>
17425
17426 Fix prime test for 2 and lower and add check command to mpicalc.
17427 + commit 5c906e2cdb14e93fb4915fdc69c7353a5fa35709
17428 * cipher/primegen.c (check_prime): Return true for the small primes.
17429 (_gcry_prime_check): Return correct values for 2 and lower numbers.
17430
17431 * src/mpicalc.c (do_primecheck): New.
17432 (main): Add command 'P'.
17433 (main): Allow for larger input data.
17434
17435 2014-10-04 Jussi Kivilinna <[email protected]>
17436
17437 Add Whirlpool AMD64/SSE2 assembly implementation.
17438 + commit de0ccd4dce7ec185a678d78878d4538dd609ca0f
17439 * cipher/Makefile.am: Add 'whirlpool-sse2-amd64.S'.
17440 * cipher/whirlpool-sse2-amd64.S: New.
17441 * cipher/whirlpool.c (USE_AMD64_ASM): New.
17442 (whirlpool_tables_s): New.
17443 (rc, C0, C1, C2, C3, C4, C5, C6, C7): Combine these tables into single
17444 structure and replace old tables with macros of same name.
17445 (tab): New structure containing above tables.
17446 [USE_AMD64_ASM] (_gcry_whirlpool_transform_amd64)
17447 (whirlpool_transform): New.
17448 * configure.ac [host=x86_64]: Add 'whirlpool-sse2-amd64.lo'.
17449
17450 2014-10-04 Andrei Scherer <[email protected]>
17451
17452 Improved ripemd160 performance.
17453 + commit 30bd759f398f45b04d0a783b875f59ce9bd1e51d
17454 * cipher/rmd160.c (transform): Interleave the left and right lane
17455 rounds to introduce more instruction level parallelism.
17456
17457 2014-10-02 Werner Koch <[email protected]>
17458
17459 build: Document SYSROOT.
17460 + commit 0ecd136a6ca02252f63ad229fa5240897bfe6544
17461 * configure.ac: Mark SYSROOT as arg var.
17462
17463 build: Support SYSROOT based config script finding.
17464 + commit 1e8b86494cf8fa045696bd447b16267ffd1797f0
17465 * src/libgcrypt.m4: Add support for SYSROOT and set
17466 gpg_config_script_warn. Use AC_PATH_PROG instead of AC_PATH_TOOL
17467 because the config script is not expected to be installed with a
17468 prefix for its name
17469 * configure.ac: Print a library mismatch warning.
17470 * m4/gpg-error.m4: Update from git master.
17471
17472 2014-09-30 Werner Koch <[email protected]>
17473
17474 mac: Fix gcry_mac_close to allow for a NULL handle.
17475 + commit 51dae8c8c4b63bb5e1685cbd8722e35342524737
17476 * cipher/mac.c (_gcry_mac_close): Check for NULL.
17477
17478 2014-09-03 Werner Koch <[email protected]>
17479
17480 Add a constant for a forthcoming new RNG.
17481 + commit 8b960a807d168000d2690897a7634bd384ac1346
17482 * src/gcrypt.h.in (GCRYCTL_DRBG_REINIT): New constant.
17483
17484 2014-09-02 Jussi Kivilinna <[email protected]>
17485
17486 Add new Poly1305 MAC test vectors.
17487 + commit 8a2a328742012a7c528dd007437185e4584c1e48
17488 * tests/basic.c (check_mac): Add new test vectors for Poly1305 MAC.
17489
17490 2014-09-02 Werner Koch <[email protected]>
17491
17492 asm: Allow building x86 and amd64 using old compilers.
17493 + commit 5eec04a43e6c562e956353449be931dd43dfe1cc
17494 * src/hwf-x86.c (get_xgetbv): Build only if AVX support is enabled.
17495
17496 2014-08-21 Werner Koch <[email protected]>
17497
17498 sexp: Check args of gcry_sexp_build.
17499 + commit e606d5f1bada1f2d21faeedd3fa2cf2dca7b274c
17500 * src/sexp.c (do_vsexp_sscan): Return error for invalid args.
17501
17502 cipher: Fix a segv in case of calling with wrong parameters.
17503 + commit f850add813d783f31ca6a60459dea25ef71bce7e
17504 * cipher/md.c (_gcry_md_info): Fix arg testing.
17505
17506 cipher: Fix possible NULL deref in call to prime generator.
17507 + commit 18056ace7f466cb8c1eaf08e5dc0400516d83b4c
17508 * cipher/primegen.c (_gcry_generate_elg_prime): Change to return an
17509 error code.
17510 * cipher/dsa.c (generate): Take care of new return code.
17511 * cipher/elgamal.c (generate): Change to return an error code. Take
17512 care of _gcry_generate_elg_prime return code.
17513 (generate_using_x): Take care of _gcry_generate_elg_prime return code.
17514 (elg_generate): Propagate return code from generate.
17515
17516 2014-08-12 NIIBE Yutaka <[email protected]>
17517
17518 ecc: Support Montgomery curve for gcry_mpi_ec_mul_point.
17519 + commit 34bb55ee36df3aca3ebca88f8b61c786cd0c0701
17520 * mpi/ec.c (_gcry_mpi_ec_get_affine): Support Montgomery curve.
17521 (montgomery_ladder): New.
17522 (_gcry_mpi_ec_mul_point): Implemention using montgomery_ladder.
17523 (_gcry_mpi_ec_curve_point): Check x-coordinate is valid.
17524
17525 2014-08-09 Werner Koch <[email protected]>
17526
17527 tests: Add a benchmark for Elgamal.
17528 + commit e6d354865bf8f3d4c1bb5e8157a76fdd442cff41
17529 * tests/benchmark.c (sample_public_elg_key_1024): New.
17530 (sample_private_elg_key_1024): New.
17531 (sample_public_elg_key_2048, sample_private_elg_key_2048): New.
17532 (sample_public_elg_key_3072, sample_private_elg_key_3072): New.
17533 (elg_bench): New.
17534 (main): Add elg_bench. Add commands "elg" and "public".
17535
17536 2014-08-08 NIIBE Yutaka <[email protected]>
17537
17538 ecc: Add cofactor to domain parameters.
17539 + commit 9933b9e5e1a3f5b1019c75f93bd265d4a1ecc270
17540 * src/ec-context.h (mpi_ec_ctx_s): Add cofactor 'h'.
17541 * cipher/ecc-common.h (elliptic_curve_t): Add cofactor 'h'.
17542 (_gcry_ecc_update_curve_param): New API adding cofactor.
17543
17544 * cipher/ecc-curves.c (ecc_domain_parms_t): Add cofactor 'h'.
17545 (ecc_domain_parms_t domain_parms): Add cofactors.
17546 (_gcry_ecc_fill_in_curve, _gcry_ecc_update_curve_param)
17547 (_gcry_ecc_get_curve, _gcry_mpi_ec_new, _gcry_ecc_get_param_sexp)
17548 (_gcry_ecc_get_mpi): Handle cofactor.
17549 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_genkey): Likewise.
17550 * cipher/ecc-misc.c (_gcry_ecc_curve_free)
17551 (_gcry_ecc_curve_copy): Likewise.
17552 * cipher/ecc.c (nist_generate_key, ecc_generate)
17553 (ecc_check_secret_key, ecc_sign, ecc_verify, ecc_encrypt_raw)
17554 (ecc_decrypt_raw, _gcry_pk_ecc_get_sexp, _gcry_pubkey_spec_ecc):
17555 Likewise.
17556 (compute_keygrip): Handle cofactor, but skip it for its computation.
17557 * mpi/ec.c (ec_deinit): Likewise.
17558 * tests/t-mpi-point.c (context_param): Likewise.
17559 (test_curve): Add cofactors.
17560 * tests/curves.c (sample_key_1, sample_key_2): Add cofactors.
17561 * tests/keygrip.c (key_grips): Add cofactors.
17562
17563 2014-08-05 Werner Koch <[email protected]>
17564
17565 mpi: Fix regression for powerpc-apple-darwin detection.
17566 + commit 4ce77b0a810d3c889c07dfb385127d90fa1ae36a
17567 * mpi/config.links: Add separate entry for powerpc-apple-darwin.
17568
17569 Fix bug inhibiting the use of the sentinel attribute.
17570 + commit d2d28298ccc0d0f3c0b03fd323deb1e8808ef74f
17571 * src/gcrypt.h.in: Fix typo in macro.
17572
17573 mpi: Use BSD syntax for x86_64-apple-darwin.
17574 + commit 71939faa7c54e7b4b28d115e748a85f134876a02
17575 * mpi/config.links: Add case for x86_64-apple-darwin.
17576
17577 2014-08-05 Kristian Fiskerstrand <[email protected]>
17578
17579 Fix building for the x32 target without asm modules.
17580 + commit a17c29844b63e9e869f7855d901bc9d859234ead
17581 * mpi/generic/mpi-asm-defs.h: Use a fixed value for the x32 ABI.
17582
17583 2014-07-25 Werner Koch <[email protected]>
17584
17585 ecc: Support the non-standard 0x40 compression flag for EdDSA.
17586 + commit 4556f9b19c024f16bdf542da7173395c0741b91d
17587 * cipher/ecc.c (ecc_generate): Check the "comp" flag for EdDSA.
17588 * cipher/ecc-eddsa.c (eddsa_encode_x_y): Add arg WITH_PREFIX.
17589 (_gcry_ecc_eddsa_encodepoint): Ditto.
17590 (_gcry_ecc_eddsa_ensure_compact): Handle the 0x40 compression prefix.
17591 (_gcry_ecc_eddsa_decodepoint): Ditto.
17592 * tests/keygrip.c: Check an compresssed with prefix Ed25519 key.
17593 * tests/t-ed25519.inp: Ditto.
17594
17595 mpi: Extend the internal mpi_get_buffer.
17596 + commit 0e10902ad7584277ac966367efc712b183784532
17597 * mpi/mpicoder.c (do_get_buffer): Add arg EXTRAALLOC.
17598 (_gcry_mpi_get_buffer_extra): New.
17599
17600 cipher: Fix compiler warning for chacha20.
17601 + commit 4e0bf1b9190ce08fb23eb3ae0c3be58954ff36ab
17602 * cipher/chacha20.c (chacha20_blocks) [!USE_SSE2]: Do not build.
17603
17604 2014-07-16 NIIBE Yutaka <[email protected]>
17605
17606 mpi: Add mpi_swap_cond.
17607 + commit 4846e52728970e3117f3a046ef9010be089a3ae4
17608 * mpi/mpiutil.c (_gcry_mpi_swap_cond): New.
17609 * src/mpi.h (mpi_swap_cond): New.
17610
17611 2014-06-29 Jussi Kivilinna <[email protected]>
17612
17613 Speed-up SHA-1 NEON assembly implementation.
17614 + commit 1b9b00bbe41bbed32563f1102049521e703e72bd
17615 * cipher/sha1-armv7-neon.S: Tweak implementation for speed-up.
17616
17617 2014-06-28 Dmitry Eremin-Solenikov <[email protected]>
17618
17619 gostr3411_94: rewrite to use u32 mathematic.
17620 + commit 066f068bd0bc4d8e01f1f18b6153cdc8d2c245d7
17621 * cipher/gost28147.c (_gcry_gost_enc_data): New.
17622 * cipher/gostr3411-94.c: Rewrite implementation to use u32 mathematic
17623 internally.
17624 * cipher/gost28147.c (_gcry_gost_enc_one): Remove.
17625
17626 gost28147: use bufhelp helpers.
17627 + commit 7aeba6c449169926076df83b01ddbfa6b41fe411
17628 * cipher/gost28147.c (gost_setkey, gost_encrypt_block, gost_decrypt_block):
17629 use buf_get_le32/buf_put_le32 helpers.
17630
17631 Fixup curve name in the GOST2012 test case.
17632 + commit b78d504fa8745b8b04589acbbcf7dd5fe9279d13
17633 * tests/basic.c (check_pubkey): fixup curve name in public key.
17634
17635 Update PBKDF2 tests with GOST R 34.11-94 test cases.
17636 + commit 7533b2ad46f42e98d9dba52e88e79c0311d2d3b7
17637 * tests/t-kdf.c (check_pbkdf2): Add MD_GOSTR3411_CP test cases.
17638
17639 Add GOST R 34.11-94 variant using id-GostR3411-94-CryptoProParamSet.
17640 + commit 25d6af77e2336b5979ddbe8b90978fe5b61dfaf9
17641 * src/gcrypt.h.in (GCRY_MD_GOSTR3411_CP): New.
17642 * src/cipher.h (_gcry_digest_spec_gost3411_cp): New.
17643 * cipher/gost28147.c (_gcry_gost_enc_one): Differentiate between
17644 CryptoPro and Test S-Boxes.
17645 * cipher/gostr3411-94.c (_gcry_digest_spec_gost3411_cp,
17646 gost3411_cp_init): New.
17647 * cipher/md.c (md_open): GCRY_MD_GOSTR3411_CP also uses B=32.
17648
17649 gost28147: support GCRYCTL_SET_SBOX.
17650 + commit 5ee35a04362c94e680ef3633fa83b72e0aee8626
17651 cipher/gost28147.c (gost_set_extra_info, gost_set_sbox): New.
17652
17653 Support setting s-box for the ciphers that require it.
17654 + commit fb074d113fcbf66a5c20592625cb19051f3430f5
17655 * src/gcrypt.h.in (GCRYCTL_SET_SBOX, gcry_cipher_set_sbox): New.
17656 * cipher/cipher.c (_gcry_cipher_ctl): pass GCRYCTL_SET_SBOX to
17657 set_extra_info callback.
17658
17659 cipher/gost28147: generate optimized s-boxes from compact ones.
17660 + commit 164738a0292b3f32c7747099ad9cadace58e5eda
17661 * cipher/gost-s-box.c: New. Outputs optimized expanded representation of
17662 s-boxes (4x256) from compact 16x8 representation.
17663 * cipher/Makefile.am: Add gost-sb.h dependency to gost28147.lo
17664 * cipher/gost.h: Add sbox to the GOST28147_context structure.
17665 * cipher/gost28147.c (gost_setkey): Set default s-box to test s-box from
17666 GOST R 34.11 (this was the only one S-box before).
17667 * cipher/gost28147.c (gost_val): Use sbox from the context.
17668
17669 gost28147: add OIDs used to define cipher mode.
17670 + commit 34a58010000288515636706811c3837f32957b2e
17671 * cipher/gost28147 (oids_gost28147): Add OID from RFC4357.
17672
17673 GOST R 34.11-94 add OIDs.
17674 + commit 8b221cf5ce233c8c49a4e4ecebb70d523fc37837
17675 * cipher/gostr3411-94.c: Add OIDs for GOST R 34.11-94 from RFC 4357.
17676
17677 2014-05-21 Jussi Kivilinna <[email protected]>
17678
17679 tests: add larger test-vectors for hash algorithms.
17680 + commit f14fb5b427b5159fcd9603d2b3cde936889cf430
17681 * tests/basic.c (check_digests): Add large test-vectors for MD5, SHA1,
17682 SHA224, SHA256, SHA384, RMD160, CRC32, TIGER1, WHIRLPOOL and
17683 GOSTR3411_94.
17684
17685 sha512: fix ARM/NEON implementation.
17686 + commit beb901575f0d6cd6a0a27506ebea9a725754d0cc
17687 * cipher/sha512-armv7-neon.S
17688 (_gcry_sha512_transform_armv7_neon): Byte-swap RW67q and RW1011q
17689 correctly in multi-block loop.
17690 * tests/basic.c (check_digests): Add large test vector for SHA512.
17691
17692 2014-05-20 Jussi Kivilinna <[email protected]>
17693
17694 Fix ARM assembly when building __PIC__
17695 + commit 994c758d8f5471c7e9c38c2834742cca2502d35f
17696 * cipher/camellia-arm.S (GET_DATA_POINTER): New.
17697 (_gcry_camellia_arm_encrypt_block): Use GET_DATA_POINTER.
17698 (_gcry_camellia_arm_decrypt_block): Ditto.
17699 * cipher/cast5-arm.S (GET_DATA_POINTER): New.
17700 (_gcry_cast5_arm_encrypt_block, _gcry_cast5_arm_decrypt_block)
17701 (_gcry_cast5_arm_enc_blk2, _gcry_cast5_arm_dec_blk2): Use
17702 GET_DATA_POINTER.
17703 * cipher/rijndael-arm.S (GET_DATA_POINTER): New.
17704 (_gcry_aes_arm_encrypt_block, _gcry_aes_arm_decrypt_block): Use
17705 GET_DATA_POINTER.
17706 * cipher/sha1-armv7-neon.S (GET_DATA_POINTER): New.
17707 (.LK_VEC): Move from .text to .data section.
17708 (_gcry_sha1_transform_armv7_neon): Use GET_DATA_POINTER.
17709
17710 2014-05-17 Jussi Kivilinna <[email protected]>
17711
17712 Add Poly1305 to documentation.
17713 + commit bf4943932dae95a0573b63bf32a9b9acd5a6ddf3
17714 * doc/gcrypt.texi: Add documentation for Poly1305 MACs and AEAD mode.
17715
17716 2014-05-16 Jussi Kivilinna <[email protected]>
17717
17718 chacha20: add SSE2/AMD64 optimized implementation.
17719 + commit 323b1eb80ff3396d83fedbe5bba9a4e6c412d192
17720 * cipher/Makefile.am: Add 'chacha20-sse2-amd64.S'.
17721 * cipher/chacha20-sse2-amd64.S: New.
17722 * cipher/chacha20.c (USE_SSE2): New.
17723 [USE_SSE2] (_gcry_chacha20_amd64_sse2_blocks): New.
17724 (chacha20_do_setkey) [USE_SSE2]: Use SSE2 implementation for blocks
17725 function.
17726 * configure.ac [host=x86-64]: Add 'chacha20-sse2-amd64.lo'.
17727
17728 poly1305: add AMD64/AVX2 optimized implementation.
17729 + commit 98f021961ee65669037bc8bb552a69fd78f610fc
17730 * cipher/Makefile.am: Add 'poly1305-avx2-amd64.S'.
17731 * cipher/poly1305-avx2-amd64.S: New.
17732 * cipher/poly1305-internal.h (POLY1305_USE_AVX2)
17733 (POLY1305_AVX2_BLOCKSIZE, POLY1305_AVX2_STATESIZE)
17734 (POLY1305_AVX2_ALIGNMENT): New.
17735 (POLY1305_LARGEST_BLOCKSIZE, POLY1305_LARGEST_STATESIZE)
17736 (POLY1305_STATE_ALIGNMENT): Use AVX2 versions when needed.
17737 * cipher/poly1305.c [POLY1305_USE_AVX2]
17738 (_gcry_poly1305_amd64_avx2_init_ext)
17739 (_gcry_poly1305_amd64_avx2_finish_ext)
17740 (_gcry_poly1305_amd64_avx2_blocks, poly1305_amd64_avx2_ops): New.
17741 (_gcry_poly1305_init) [POLY1305_USE_AVX2]: Use AVX2 implementation if
17742 AVX2 supported by CPU.
17743 * configure.ac [host=x86_64]: Add 'poly1305-avx2-amd64.lo'.
17744
17745 2014-05-12 Jussi Kivilinna <[email protected]>
17746
17747 poly1305: add AMD64/SSE2 optimized implementation.
17748 + commit 297532602ed2d881d8fdc393d1961068a143a891
17749 * cipher/Makefile.am: Add 'poly1305-sse2-amd64.S'.
17750 * cipher/poly1305-internal.h (POLY1305_USE_SSE2)
17751 (POLY1305_SSE2_BLOCKSIZE, POLY1305_SSE2_STATESIZE)
17752 (POLY1305_SSE2_ALIGNMENT): New.
17753 (POLY1305_LARGEST_BLOCKSIZE, POLY1305_LARGEST_STATESIZE)
17754 (POLY1305_STATE_ALIGNMENT): Use SSE2 versions when needed.
17755 * cipher/poly1305-sse2-amd64.S: New.
17756 * cipher/poly1305.c [POLY1305_USE_SSE2]
17757 (_gcry_poly1305_amd64_sse2_init_ext)
17758 (_gcry_poly1305_amd64_sse2_finish_ext)
17759 (_gcry_poly1305_amd64_sse2_blocks, poly1305_amd64_sse2_ops): New.
17760 (_gcry_polu1305_init) [POLY1305_USE_SSE2]: Use SSE2 version.
17761 * configure.ac [host=x86_64]: Add 'poly1305-sse2-amd64.lo'.
17762
17763 Add Poly1305 based cipher AEAD mode.
17764 + commit e813958419b0ec4439e6caf07d3b2234cffa2bfa
17765 * cipher/Makefile.am: Add 'cipher-poly1305.c'.
17766 * cipher/cipher-internal.h (gcry_cipher_handle): Add 'u_mode.poly1305'.
17767 (_gcry_cipher_poly1305_encrypt, _gcry_cipher_poly1305_decrypt)
17768 (_gcry_cipher_poly1305_setiv, _gcry_cipher_poly1305_authenticate)
17769 (_gcry_cipher_poly1305_get_tag, _gcry_cipher_poly1305_check_tag): New.
17770 * cipher/cipher-poly1305.c: New.
17771 * cipher/cipher.c (_gcry_cipher_open_internal, cipher_setkey)
17772 (cipher_reset, cipher_encrypt, cipher_decrypt, _gcry_cipher_setiv)
17773 (_gcry_cipher_authenticate, _gcry_cipher_gettag)
17774 (_gcry_cipher_checktag): Handle 'GCRY_CIPHER_MODE_POLY1305'.
17775 (cipher_setiv): Move handling of 'GCRY_CIPHER_MODE_GCM' to ...
17776 (_gcry_cipher_setiv): ... here, as with other modes.
17777 * src/gcrypt.h.in: Add 'GCRY_CIPHER_MODE_POLY1305'.
17778 * tests/basic.c (_check_poly1305_cipher, check_poly1305_cipher): New.
17779 (check_ciphers): Add Poly1305 check.
17780 (check_cipher_modes): Call 'check_poly1305_cipher'.
17781 * tests/bench-slope.c (bench_gcm_encrypt_do_bench): Rename to
17782 bench_aead_... and take nonce as argument.
17783 (bench_gcm_decrypt_do_bench, bench_gcm_authenticate_do_bench): Ditto.
17784 (bench_gcm_encrypt_do_bench, bench_gcm_decrypt_do_bench)
17785 (bench_gcm_authenticate_do_bench, bench_poly1305_encrypt_do_bench)
17786 (bench_poly1305_decrypt_do_bench)
17787 (bench_poly1305_authenticate_do_bench, poly1305_encrypt_ops)
17788 (poly1305_decrypt_ops, poly1305_authenticate_ops): New.
17789 (cipher_modes): Add Poly1305.
17790 (cipher_bench_one): Add special handling for Poly1305.
17791
17792 Add Poly1305-AES (-Camellia, etc) MACs.
17793 + commit 73b3b75c2221a6e3bed4117e0a206a1193acd2ed
17794 * cipher/mac-internal.h (_gcry_mac_type_spec_poly1305_aes)
17795 (_gcry_mac_type_spec_poly1305_camellia)
17796 (_gcry_mac_type_spec_poly1305_twofish)
17797 (_gcry_mac_type_spec_poly1305_serpent)
17798 (_gcry_mac_type_spec_poly1305_seed): New.
17799 * cipher/mac-poly1305.c (poly1305mac_context_s): Add 'hd' and
17800 'nonce_set'.
17801 (poly1305mac_open, poly1305mac_close, poly1305mac_setkey): Add handling
17802 for Poly1305-*** MACs.
17803 (poly1305mac_prepare_key, poly1305mac_setiv): New.
17804 (poly1305mac_reset, poly1305mac_write, poly1305mac_read): Add handling
17805 for 'nonce_set'.
17806 (poly1305mac_ops): Add 'poly1305mac_setiv'.
17807 (_gcry_mac_type_spec_poly1305_aes)
17808 (_gcry_mac_type_spec_poly1305_camellia)
17809 (_gcry_mac_type_spec_poly1305_twofish)
17810 (_gcry_mac_type_spec_poly1305_serpent)
17811 (_gcry_mac_type_spec_poly1305_seed): New.
17812 * cipher/mac.c (mac_list): Add Poly1305-AES, Poly1305-Twofish,
17813 Poly1305-Serpent, Poly1305-SEED and Poly1305-Camellia.
17814 * src/gcrypt.h.in: Add 'GCRY_MAC_POLY1305_AES',
17815 'GCRY_MAC_POLY1305_CAMELLIA', 'GCRY_MAC_POLY1305_TWOFISH',
17816 'GCRY_MAC_POLY1305_SERPENT' and 'GCRY_MAC_POLY1305_SEED'.
17817 * tests/basic.c (check_mac): Add Poly1305-AES test vectors.
17818 * tests/bench-slope.c (bench_mac_init): Set IV for Poly1305-*** MACs.
17819 * tests/bench-slope.c (mac_bench): Set IV for Poly1305-*** MACs.
17820
17821 Add Poly1305 MAC.
17822 + commit b8794fed68ebe7567f4617141f0996ad290d9120
17823 * cipher/Makefile.am: Add 'mac-poly1305.c', 'poly1305.c' and
17824 'poly1305-internal.h'.
17825 * cipher/mac-internal.h (poly1305mac_context_s): New.
17826 (gcry_mac_handle): Add 'u.poly1305mac'.
17827 (_gcry_mac_type_spec_poly1305mac): New.
17828 * cipher/mac-poly1305.c: New.
17829 * cipher/mac.c (mac_list): Add Poly1305.
17830 * cipher/poly1305-internal.h: New.
17831 * cipher/poly1305.c: New.
17832 * src/gcrypt.h.in: Add 'GCRY_MAC_POLY1305'.
17833 * tests/basic.c (check_mac): Add Poly1035 test vectors; Allow
17834 overriding lengths of data and key buffers.
17835 * tests/bench-slope.c (mac_bench): Increase max algo number from 500 to
17836 600.
17837 * tests/benchmark.c (mac_bench): Ditto.
17838
17839 chacha20/AVX2: clear upper-halfs of YMM registers on entry.
17840 + commit c20daeeb05329bfc6cc2c562cbd4b965291fe0e1
17841 * cipher/chacha20-avx2-amd64.S (_gcry_chacha20_amd64_avx2_blocks): Add
17842 'vzeroupper' at beginning.
17843
17844 chacha20/AVX2: check for ENABLE_AVX2_SUPPORT instead of HAVE_GCC_INLINE_ASM_AVX2
17845 + commit a3062db748f272e0f7346e1ed9e0bf7ed61a4eae
17846 * cipher/chacha20.c (USE_AVX2): Enable depending on
17847 ENABLE_AVX2_SUPPORT, not HAVE_GCC_INLINE_ASM_AVX2.
17848 * cipher/chacha20-avx2-amd64.S: Ditto.
17849
17850 chacha20/SSSE3: clear XMM registers after use.
17851 + commit a7d9eeeba632b7eb4a5b15ff17f6565181642f3c
17852 * cipher/chacha20-ssse3-amd64.S (_gcry_chacha20_amd64_ssse3_blocks): On
17853 return, clear XMM registers.
17854
17855 2014-05-11 Jussi Kivilinna <[email protected]>
17856
17857 chacha20: add AVX2/AMD64 assembly implementation.
17858 + commit a39ee7555691d18cae97560f130aaf952bfbd278
17859 * cipher/Makefile.am: Add 'chacha20-avx2-amd64.S'.
17860 * cipher/chacha20-avx2-amd64.S: New.
17861 * cipher/chacha20.c (USE_AVX2): New macro.
17862 [USE_AVX2] (_gcry_chacha20_amd64_avx2_blocks): New.
17863 (chacha20_do_setkey): Select AVX2 implementation if there is HW
17864 support.
17865 (selftest): Increase size of buf by 256.
17866 * configure.ac [host=x86-64]: Add 'chacha20-avx2-amd64.lo'.
17867
17868 chacha20: add SSSE3 assembly implementation.
17869 + commit def7d4cad386271c6d4e2f10aabe0cb4abd871e4
17870 * cipher/Makefile.am: Add 'chacha20-ssse3-amd64.S'.
17871 * cipher/chacha20-ssse3-amd64.S: New.
17872 * cipher/chacha20.c (USE_SSSE3): New macro.
17873 [USE_SSSE3] (_gcry_chacha20_amd64_ssse3_blocks): New.
17874 (chacha20_do_setkey): Select SSSE3 implementation if there is HW
17875 support.
17876 * configure.ac [host=x86-64]: Add 'chacha20-ssse3-amd64.lo'.
17877
17878 Add ChaCha20 stream cipher.
17879 + commit 23f33d57c9b6f2295a8ddfc9a8eee5a2c30cf406
17880 * cipher/Makefile.am: Add 'chacha20.c'.
17881 * cipher/chacha20.c: New.
17882 * cipher/cipher.c (cipher_list): Add ChaCha20.
17883 * configure.ac: Add ChaCha20.
17884 * doc/gcrypt.texi: Add ChaCha20.
17885 * src/cipher.h (_gcry_cipher_spec_chacha20): New.
17886 * src/gcrypt.h.in (GCRY_CIPHER_CHACHA20): Add new algo.
17887 * tests/basic.c (MAX_DATA_LEN): Increase to 128 from 100.
17888 (check_stream_cipher): Add ChaCha20 test-vectors.
17889 (check_ciphers): Add ChaCha20.
17890
17891 2014-05-09 Werner Koch <[email protected]>
17892
17893 mpi: Fix a subtle bug setting spurious bits with in mpi_set_bit.
17894 + commit 246b7aaae1ee459f440260bbc4ec2c01c5dc3362
17895 * mpi/mpi-bit.c (_gcry_mpi_set_bit, _gcry_mpi_set_highbit): Clear
17896 allocated but not used bits before resizing.
17897 * tests/t-mpi-bits.c (set_bit_with_resize): New.
17898
17899 2014-05-07 Werner Koch <[email protected]>
17900
17901 Bump LT version.
17902 + commit fc6ff6f73a51bcbbbb3757dc1386da40aa3ae75d
17903 * configure.ac: Bumb LT version to C21/A1/R0.
17904
17905 2014-04-22 Werner Koch <[email protected]>
17906
17907 random: Small patch for consistency and really burn the stack.
17908 + commit a79c4ad7c56ee4410f17beb73eeb58b0dd36bfc6
17909 * random/rndlinux.c (_gcry_rndlinux_gather_random): s/int/size_t/.
17910 (_gcry_rndlinux_gather_random): Replace memset by wipememory.
17911
17912 2014-04-16 Werner Koch <[email protected]>
17913
17914 pubkey: Re-map all depreccated RSA algo numbers.
17915 + commit 773e23698218755e9172d2507031a8263c47cc0b
17916 * cipher/pubkey.c (map_algo): Mape RSA_E and RSA_S.
17917
17918 2014-04-15 Werner Koch <[email protected]>
17919
17920 cipher: Fix possible NULL dereference.
17921 + commit ae1fbce6dacf14747af0126e640bd4e54cb8c680
17922 * cipher/md.c (_gcry_md_selftest): Check for spec being NULL.
17923
17924 2014-03-30 Jussi Kivilinna <[email protected]>
17925
17926 3des: add amd64 assembly implementation for 3DES.
17927 + commit b76b632a453b8d100d024e2439b4358454dc286e
17928 * cipher/Makefile.am: Add 'des-amd64.S'.
17929 * cipher/cipher-selftests.c (_gcry_selftest_helper_cbc)
17930 (_gcry_selftest_helper_cfb, _gcry_selftest_helper_ctr): Handle failures
17931 from 'setkey' function.
17932 * cipher/cipher.c (_gcry_cipher_open_internal) [USE_DES]: Setup bulk
17933 functions for 3DES.
17934 * cipher/des-amd64.S: New file.
17935 * cipher/des.c (USE_AMD64_ASM, ATTR_ALIGNED_16): New macros.
17936 [USE_AMD64_ASM] (_gcry_3des_amd64_crypt_block)
17937 (_gcry_3des_amd64_ctr_enc), _gcry_3des_amd64_cbc_dec)
17938 (_gcry_3des_amd64_cfb_dec): New prototypes.
17939 [USE_AMD64_ASM] (tripledes_ecb_crypt): New function.
17940 (TRIPLEDES_ECB_BURN_STACK): New macro.
17941 (_gcry_3des_ctr_enc, _gcry_3des_cbc_dec, _gcry_3des_cfb_dec)
17942 (bulk_selftest_setkey, selftest_ctr, selftest_cbc, selftest_cfb): New
17943 functions.
17944 (selftest): Add call to CTR, CBC and CFB selftest functions.
17945 (do_tripledes_encrypt, do_tripledes_decrypt): Use
17946 TRIPLEDES_ECB_BURN_STACK.
17947 * configure.ac [host=x86-64]: Add 'des-amd64.lo'.
17948 * src/cipher.h (_gcry_3des_ctr_enc, _gcry_3des_cbc_dec)
17949 (_gcry_3des_cfb_dec): New prototypes.
17950
17951 2014-03-13 Werner Koch <[email protected]>
17952
17953 tests: Print diagnostics for skipped tests.
17954 + commit 50aeee51a0b1a09dd9fff2bb71749a816fe7a791
17955 * tests/basic.c (show_note): New.
17956 (show_md_not_available):
17957 (show_old_hmac_not_available):
17958 (show_mac_not_available):
17959 (check_digests): Remove USE_foo cpp tests from the test table. Call
17960 show_md_not_available if algo is not available.
17961 (check_hmac): Likewise.
17962 (check_mac): Likewise.
17963
17964 2014-03-11 Dmitry Eremin-Solenikov <[email protected]>
17965
17966 Add MD2 message digest implementation.
17967 + commit 5a8e1504bf8a2ffbc018be576dea77b685200444
17968 * cipher/md2.c: New.
17969 * cipher/md.c (digest_list): add _gcry_digest_spec_md2.
17970 * tests/basic.c (check_digests): add MD2 test vectors.
17971 * configure.ac (default_digests): disable md2 by default.
17972
17973 2014-03-04 Dmitry Eremin-Solenikov <[email protected]>
17974
17975 Add an utility to calculate hashes over a set of files.
17976 + commit 2b5403c408dfbd71be24c7635f5fa0b61ab4c9bb
17977 * tests/gchash.c: New.
17978
17979 Add a simple (raw) PKCS#1 padding mode.
17980 + commit ea8d597726305274214224757b32730644e12bd8
17981 * src/cipher.h (PUBKEY_ENC_PKCS1_RAW): New.
17982 * cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist): Handle pkcs1-raw
17983 flag.
17984 * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi):
17985 Handle s-exp like (data (flags pkcs1-raw) (value xxxxx))
17986 * cipher/rsa-common.c (_gcry_rsa_pkcs1_encode_raw_for_sig):
17987 PKCS#1-encode data with embedded hash OID for signature verification.
17988 * tests/basic.c (check_pubkey_sign): Add tests for s-exps with pkcs1-raw
17989 flag.
17990
17991 2014-02-04 Jussi Kivilinna <[email protected]>
17992
17993 Fix ARMv6 detection when CFLAGS modify target CPU architecture.
17994 + commit 6be3032048ee2466511d2384fcf2d28b856219b2
17995 * configure.ac (gcry_cv_cc_arm_arch_is_v6): Use compiler test instead
17996 of preprocessor test.
17997
17998 2014-01-29 Werner Koch <[email protected]>
17999
18000 Reserve control code for FIPS extensions.
18001 + commit aea96a64fbc58a0b6f9f435e97e93294c6eb1052
18002 * src/gcrypt.h.in (GCRYCTL_INACTIVATE_FIPS_FLAG): New.
18003 (GCRYCTL_REACTIVATE_FIPS_FLAG): New.
18004 * src/global.c (_gcry_vcontrol): Add them but return not_implemented.
18005
18006 2014-01-29 NIIBE Yutaka <[email protected]>
18007
18008 Fix RSA Blinding.
18009 + commit 121a90d8931944974054f7d94f63b7f89df87fa5
18010 * cipher/rsa.c (rsa_decrypt): Loop to get multiplicative inverse.
18011
18012 2014-01-28 Werner Koch <[email protected]>
18013
18014 cipher: Take care of ENABLE_NEON_SUPPORT.
18015 + commit 52f7c48c901a3de51bd690a218f3de2f71e8d790
18016 * cipher/salsa20.c (USE_ARM_NEON_ASM): Define only if
18017 ENABLE_NEON_SUPPORT is defined.
18018 * cipher/serpent.c (USE_NEON): Ditto.
18019 * cipher/sha1.c (USE_NEON): Ditto.
18020 * cipher/sha512.c (USE_ARM_NEON_ASM): Ditto.
18021
18022 sexp: Fix broken gcry_sexp_nth.
18023 + commit cbdc355415f83ed62da4f3618767eba54d7e6d37
18024 * src/sexp.c (_gcry_sexp_nth): Return a valid S-expression for a data
18025 element.
18026 (NODE): Remove unused typedef.
18027 (ST_HINT): Comment unused macro.
18028
18029 * tests/t-sexp.c (bug_1594): New.
18030 (main): Run new test.
18031
18032 2014-01-27 Werner Koch <[email protected]>
18033
18034 tests: Improve t-common.h.
18035 + commit 7460e9243b3cc050631c37ed4f2713ae7bcb6762
18036 * tests/t-common.h: Add couple of macros. Check that config.h has
18037 been included.
18038 (show): Rename to info.
18039 * tests/t-lock.c, tests/t-sexp.c: Adjust for changes.
18040
18041 mpi: Minor fix for Atari-mint.
18042 + commit 3caa0f1319dc4779e0d6eee4460c1af2a12b2c3c
18043 * mpi/config.links [m68k-atari-mint]: Do not assume 68020. Suggested
18044 by Alan Hourihane.
18045
18046 (cherry picked from commit 420f42a5752e90a8b27d58ffa1ddfe6e4ab341e8)
18047
18048 2014-01-27 Dmitry Eremin-Solenikov <[email protected]>
18049
18050 Fix most of memory leaks in tests code.
18051 + commit 5c150ece094bf0a504a111ce6c7b72e8d0b0457a
18052 * tests/basic.c (check_ccm_cipher): Close cipher after use.
18053 * tests/basic.c (check_one_cipher): Correct length of used buffer.
18054 * tests/benchmark.c (cipher_bench): Use xcalloc to make buffer
18055 initialized.
18056 * tests/keygen.c (check_ecc_keys): Release generated key.
18057 * tests/t-mpi-point.c (context_param): Release mpi Q.
18058 * tests/t-sexp.c (check_extract_param): Release extracted number.
18059
18060 Fix memory leaks in ecc code.
18061 + commit 6d87e6abdfb7552323a95401f14e6367398a3e5a
18062 * cipher/ecc-curves.c (_gcry_ecc_update_curve_param): Release passed mpi
18063 values.
18064 * cipher/ecc.c (compute_keygrip): Fix potential memory leak in error
18065 path.
18066 * cipher/ecc.c (_gcry_ecc_get_curve): Release temporary mpi.
18067
18068 Fix number of blocks passed used in _gcry_rmd160_mixblock.
18069 + commit 5d23e7b9a77421f3ebfda4a84c459a8729f3bb41
18070 * cipher/rmd160.c (_gcry_rmd160_mixblock): pass 1 to transform
18071
18072 2014-01-27 Werner Koch <[email protected]>
18073
18074 Small Windows build tweaks.
18075 + commit f7df906171854b6b6506b82d4fee2c2ebb0327ea
18076 * configure.ac (HAVE_PTHREAD): Do test when building for Windows.
18077
18078 * tests/basic.c: Replace "%zi" by "%z" and a cast to make it work
18079 under Windows.
18080
18081 Update gpg-error autoconf macros to fix threading problems.
18082 + commit 79da0358fd555361e1ce4202f55494a8918eb8ae
18083 * m4/gpg-error.m4: Update to version 2014-01-24.
18084 * tests/Makefile.am (t_lock_LDADD): Use MT Libs.
18085
18086 2014-01-24 Dmitry Eremin-Solenikov <[email protected]>
18087
18088 tests: Pass -no-install to libtool.
18089 + commit bf34bfa5c458ee5ece91f25e3b4194d768498ab6
18090 * tests/Makefile.am: add AM_LDFLAGS = -no-install
18091
18092 2014-01-24 Werner Koch <[email protected]>
18093
18094 tests: Add a test for the internal locking.
18095 + commit ff91ec934ed52294cddcd7dcfacc04721a0487bf
18096 * src/global.c (external_lock_test): New.
18097 (_gcry_vcontrol): Call new function with formerly reserved code 61.
18098
18099 * tests/t-common.h: New. Taken from current libgpg-error.
18100 * tests/t-lock.c: New. Based on t-lock.c from libgpg-error.
18101 * configure.ac (HAVE_PTHREAD): Set macro to 1 if defined.
18102 (AC_CHECK_FUNCS): Check for flockfile.
18103 * tests/Makefile.am (tests_bin): Add t-lock.
18104 (noinst_HEADERS): Add t-common.h
18105 (LDADD): Move value to ...
18106 (default_ldadd): new.
18107 (t_lock_LDADD): New.
18108
18109 Check compiler features only for the relevant platform.
18110 + commit 24e65d715812cea28732397870cb1585b8435521
18111 * mpi/config.links (mpi_cpu_arch): Always set for ARM. Set for HPPA.
18112 Set to "undefined" for unknown platforms.
18113 (try_asm_modules): Act upon only after having detected the CPU.
18114 * configure.ac: Move the call to config.links before the platform
18115 specific compiler checks. Check platform specific features only if
18116 the platform is targeted.
18117
18118 2014-01-23 Werner Koch <[email protected]>
18119
18120 Support building using the latest mingw-w64 toolchain.
18121 + commit 4ad3417acab5021db1f722c314314ce4b781833a
18122 * acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): Change mingw detection.
18123
18124 2014-01-20 Werner Koch <[email protected]>
18125
18126 cipher: Fix commit 94030e44.
18127 + commit dad06e4d1b835bac778b87090b1d3894b7535b14
18128 * cipher/tiger.c (tiger_init): Add arg FLAGS.
18129 (tiger1_init, tiger2_init): Ditto.
18130
18131 tests: Rename tsexp.c.
18132 + commit 192e77d123fdb04c459c998b9eb1731618a833fa
18133 * tests/tsexp.c: Rename to t-sexp.c
18134
18135 2014-01-19 Werner Koch <[email protected]>
18136
18137 md: Add Whirlpool bug emulation feature.
18138 + commit 94030e44aaff805d754e368507f16dd51a531b72
18139 * src/gcrypt.h.in (GCRY_MD_FLAG_BUGEMU1): New.
18140 * src/cipher-proto.h (gcry_md_init_t): Add arg FLAGS. Change all code
18141 to implement that flag.
18142 * cipher/md.c (gcry_md_context): Replace SECURE and FINALIZED by bit
18143 field FLAGS. Add flag BUGEMU1. Change all users.
18144 (md_open): Replace args SECURE and HMAC by FLAGS. Init flags.bugemu1.
18145 (_gcry_md_open): Add for GCRY_MD_FLAG_BUGEMU1.
18146 (md_enable): Pass bugemu1 flag to the hash init function.
18147 (_gcry_md_reset): Ditto.
18148
18149 2014-01-17 Werner Koch <[email protected]>
18150
18151 Actually check for uint64_t.
18152 + commit c3b30bae7d1e157f8b65e32ba1b3a516f2bbf58b
18153 * configure.ac: Check size of uint64_t and the UINT64_C macro.
18154
18155 2014-01-16 Werner Koch <[email protected]>
18156
18157 Replace ath based mutexes by gpgrt based locks.
18158 + commit cfc151ba637200e4fc05d9481a8df2071b2f9a47
18159 * configure.ac (NEED_GPG_ERROR_VERSION): Require 1.13.
18160 (gl_LOCK): Remove.
18161 * src/ath.c, src/ath.h: Remove. Remove from all files. Replace all
18162 mutexes by gpgrt based statically initialized locks.
18163 * src/global.c (global_init): Remove ath_init.
18164 (_gcry_vcontrol): Make ath install a dummy function.
18165 (print_config): Remove threads info line.
18166
18167 * doc/gcrypt.texi: Simplify the multi-thread related documentation.
18168
18169 2014-01-15 NIIBE Yutaka <[email protected]>
18170
18171 ecc: Fix _gcry_mpi_ec_p_new to allow secp256k1.
18172 + commit 49edeebb43174865cf4fa2c170a42a8e4274c4f0
18173 * mpi/ec.c (_gcry_mpi_ec_p_new): Remove checking a!=0.
18174 * tests/t-mpi-point.c (context_alloc): Remove two spurious tests.
18175
18176 2014-01-14 Milan Broz <[email protected]>
18177
18178 PBKDF2: Use gcry_md_reset to speed up calculation.
18179 + commit 04cda6b7cc16f3f52c12d9d3e46c56701003496e
18180 * cipher/kdf.c (_gcry_kdf_pkdf2): Use gcry_md_reset
18181 to speed up calculation.
18182
18183 2014-01-13 Werner Koch <[email protected]>
18184
18185 Fix macro conflict in NetBSD.
18186 + commit 5f2af6c26bc04975c0b518881532871d7387d7ce
18187 * cipher/bithelp.h (bswap32): Rename to _gcry_bswap32.
18188 (bswap64): Rename to _gcry_bswap64.
18189
18190 Use internal malloc function in fips.c.
18191 + commit 518ae274a1845ce626b2b4223a9b3805cbbab1a7
18192 * src/fips.c (check_binary_integrity): s/gcry_malloc/xtrymalloc/.
18193
18194 2014-01-13 Dmitry Eremin-Solenikov <[email protected]>
18195
18196 Truncate hash values for ECDSA signature scheme.
18197 + commit 9edcf1090e0485f9f383b6c54b18ea8ca3d4a225
18198 * cipher/dsa-common (_gcry_dsa_normalize_hash): New. Truncate opaque
18199 mpis as required for DSA and ECDSA signature schemas.
18200 * cipher/dsa.c (verify): Return gpg_err_code_t value from verify() to
18201 behave like the rest of internal sign/verify functions.
18202 * cipher/dsa.c (sign, verify, dsa_verify): Factor out hash truncation.
18203 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_sign): Factor out hash truncation.
18204 * cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_verify):
18205 as required by ECDSA scheme, truncate hash values to bitlength of
18206 used curve.
18207 * tests/pubkey.c (check_ecc_sample_key): add a testcase for hash
18208 truncation.
18209
18210 Add GOST R 34.10-2012 curves proposed by TC26.
18211 + commit 2c5ec803100ed8261e51442fb93b75367b7725ea
18212 * cipher/ecc-curves.c (domain_parmss): Add two GOST R 34.10-2012 curves
18213 proposed/pending to standardization by TC26 (Russian cryptography
18214 technical comitee).
18215 * cipher/ecc-curves.c (curve_alias): Add OID aliases.
18216 * tests/curves.c: Increase N_CURVES.
18217
18218 Add GOST R 34.10-2001 curves per RFC4357.
18219 + commit 9bedc5c3b646dfe481678ca58f5466ac46decaf7
18220 * cipher/ecc-curves.c (domain_parms): Add 3 curves defined in rfc4357.
18221 * cipher/ecc-curves.c (curve_aliases): Add OID and Xch aliases for GOST
18222 curves.
18223 * tests/curves.c (N_CURVES): Update value.
18224
18225 Fix typo in search_oid.
18226 + commit 7edcb574d8d6dffb6e234c2ba1996a9a04923859
18227 * cipher/md.c (search_oid): Invert condition on oid comparison.
18228
18229 Add MD2-HMAC calculation support.
18230 + commit 653b58cb5e85511b6c04c3f85ef3e372c2e9f74f
18231 * src/gcrypt.h.in (GCRY_MAC_HMAC_MD2): New.
18232 * cipher/mac-hmac.c: Support GCRY_MAC_HMAC_MD2.
18233
18234 Add a function to retrieve algorithm used by MAC handler.
18235 + commit 8439a379c86ef1088465ea70ac10840759a1638e
18236 * cipher/mac.c (_gcry_mac_get_algo): New function, returns used algo.
18237 * src/visibility.c (gcry_mac_get_algo): New wrapper.
18238 * src/visibility.h: Hanlde gcry_mac_get_algo.
18239 * src/gcrypt-int.h (_gcry_mac_get_algo): New.
18240 * src/gcrypt.h.in (gcry_mac_get_algo): New.
18241 * src/libgcrypt.def (gcry_mac_get_algo): New.
18242 * src/libgcrypt.vers (gcry_mac_get_algo): New.
18243 * doc/gcrypt.texi: Document gcry_mac_get_algo.
18244 * tests/basic.c (check_one_mac): Verify gcry_mac_get_algo.
18245
18246 Correct formatting of gcry_mac_get_algo_keylen documentation.
18247 + commit 36c9e0e4eb4f935da90df1c8df484d1940bda5eb
18248 * doc/gcrypt.texi: add braces near gcry_mac_get_algo_keylen
18249 documentation.
18250
18251 Use braces around unsigned int in gcry_mac_get_algo_keylen
18252 documentation, otherwise texinfo breaks that and uses 'int' as a
18253 function definition.
18254
18255 2014-01-13 Werner Koch <[email protected]>
18256
18257 ecc: Make a macro shorter.
18258 + commit 2ef48ba59c32bfa1a9265d5eea8ab225a658903a
18259 * src/mpi.h (MPI_EC_TWISTEDEDWARDS): Rename to MPI_EC_EDWARDS. CHnage
18260 all users.
18261 * cipher/ecc-curves.c (domain_parms): Add parameters for Curve3617 as
18262 comment.
18263 * mpi/ec.c (dup_point_twistededwards): Rename to dup_point_edwards.
18264 (add_points_twistededwards): Rename to add_points_edwards.
18265
18266 2014-01-12 Jussi Kivilinna <[email protected]>
18267
18268 Fix assembly division check.
18269 + commit ef3e66e168c4b9b86bfc4903001631e53a7125d8
18270 * configure.ac (gcry_cv_gcc_as_const_division_ok): Correct variable
18271 name mismatch at '--Wa,--divide' workaround check.
18272
18273 2014-01-12 NIIBE Yutaka <[email protected]>
18274
18275 Add secp256k1 curve.
18276 + commit 019e0e9e8c77a2edf283745e05e9301673ea6a0a
18277 * cipher/ecc-curves.c (curve_aliases): Add secp256k1 and its OID.
18278 (domain_parms): Add secp256k1's domain paramerter.
18279
18280 * tests/basic.c (check_pubkey): Add a key of secp256k1.
18281
18282 * tests/curves.c (N_CURVES): Updated.
18283
18284 2014-01-12 Jussi Kivilinna <[email protected]>
18285
18286 Fix constant division for AMD64 assembly on Solaris/x86.
18287 + commit 43376891c01f4aff1fbfb23beafebb5adfd0868c
18288 * configure.ac (gcry_cv_gcc_as_const_division_ok): Add new check for
18289 constant division in assembly and test for "-Wa,--divide" workaround.
18290 (gcry_cv_gcc_amd64_platform_as_ok): Check for also constant division.
18291
18292 2014-01-10 Werner Koch <[email protected]>
18293
18294 Use the generic autogen.sh script.
18295 + commit b0ac1f9b143aa15855914ba93fef900288d45c9c
18296 * autogen.rc: New.
18297 * Makefile.am (EXTRA_DIST): Add it.
18298 * autogen.sh: Update from current GnuPG.
18299
18300 Move all helper scripts to build-aux/
18301 + commit df9b4eabf52faee6f289a4bc62219684442ae383
18302 * scripts/: Rename to build-aux/.
18303 * compile, config.guess, config.rpath, config.sub
18304 * depcomp, doc/mdate-sh, doc/texinfo.tex
18305 * install-sh, ltmain.sh, missing: Move to build-aux/.
18306 * Makefile.am (EXTRA_DIST): Adjust.
18307 * configure.ac (AC_CONFIG_AUX_DIR): New.
18308 (AM_SILENT_RULES): New.
18309
18310 2013-12-30 Jussi Kivilinna <[email protected]>
18311
18312 Add blowfish/serpent ARM assembly files to Makefile.am.
18313 + commit 7fef7f481c0a1542be34d1dc831f58d41846ac29
18314 * cipher/Makefile.am: Add 'blowfish-arm.S' and 'serpent-armv7-neon.S'.
18315
18316 Add AMD64 assembly implementation for arcfour.
18317 + commit 7547898109c72a97e3102b2a045ee4fdb2aa40bf
18318 * cipher/Makefile.am: Add 'arcfour-amd64.S'.
18319 * cipher/arcfour-amd64.S: New.
18320 * cipher/arcfour.c (USE_AMD64_ASM): New.
18321 [USE_AMD64_ASM] (ARCFOUR_context, _gcry_arcfour_amd64)
18322 (encrypt_stream): New.
18323 * configure.ac [host=x86_64]: Add 'arcfour-amd64.lo'.
18324
18325 Parse /proc/cpuinfo for ARM HW features.
18326 + commit a05be441d8cd89b90d8d58e3a343a436dae377d0
18327 * src/hwf-arm.c [__linux__] (HAS_PROC_CPUINFO)
18328 (detect_arm_proc_cpuinfo): New.
18329 (_gcry_hwf_detect_arm) [HAS_PROC_CPUINFO]: Check '/proc/cpuinfo' for
18330 HW features.
18331
18332 Fix buggy/incomplete detection of AVX/AVX2 support.
18333 + commit bbcb12187afb1756cb27296166b57fa19ee45d4d
18334 * configure.ac: Also check for 'xgetbv' instruction in AVX and AVX2
18335 inline assembly checks.
18336 * src/hwf-x86.c [__i386__] (get_xgetbv): New function.
18337 [__x86_64__] (get_xgetbv): New function.
18338 [HAS_X86_CPUID] (detect_x86_gnuc): Check for OSXSAVE and OS support for
18339 XMM&YMM registers and enable AVX/AVX2 only if XMM&YMM registers are
18340 supported by OS.
18341
18342 2013-12-18 Jussi Kivilinna <[email protected]>
18343
18344 Change utf-8 copyright characters to '(C)'
18345 + commit b7e814f93ee40fcfe17a187a8989c07fde2ba0cd
18346 cipher/blowfish-amd64.S: Change utf-8 encoded copyright character to
18347 '(C)'.
18348 cipher/blowfish-arm.S: Ditto.
18349 cipher/bufhelp.h: Ditto.
18350 cipher/camellia-aesni-avx-amd64.S: Ditto.
18351 cipher/camellia-aesni-avx2-amd64.S: Ditto.
18352 cipher/camellia-arm.S: Ditto.
18353 cipher/cast5-amd64.S: Ditto.
18354 cipher/cast5-arm.S: Ditto.
18355 cipher/cipher-ccm.c: Ditto.
18356 cipher/cipher-cmac.c: Ditto.
18357 cipher/cipher-gcm.c: Ditto.
18358 cipher/cipher-selftest.c: Ditto.
18359 cipher/cipher-selftest.h: Ditto.
18360 cipher/mac-cmac.c: Ditto.
18361 cipher/mac-gmac.c: Ditto.
18362 cipher/mac-hmac.c: Ditto.
18363 cipher/mac-internal.h: Ditto.
18364 cipher/mac.c: Ditto.
18365 cipher/rijndael-amd64.S: Ditto.
18366 cipher/rijndael-arm.S: Ditto.
18367 cipher/salsa20-amd64.S: Ditto.
18368 cipher/salsa20-armv7-neon.S: Ditto.
18369 cipher/serpent-armv7-neon.S: Ditto.
18370 cipher/serpent-avx2-amd64.S: Ditto.
18371 cipher/serpent-sse2-amd64.S: Ditto.
18372
18373 Add ARM/NEON implementation for SHA-1.
18374 + commit fc7dcf616937afaf73cfda1bf7bd79566a96b130
18375 * cipher/Makefile.am: Add 'sha1-armv7-neon.S'.
18376 * cipher/sha1-armv7-neon.S: New.
18377 * cipher/sha1.c (USE_NEON): New.
18378 (SHA1_CONTEXT, sha1_init) [USE_NEON]: Add and initialize 'use_neon'.
18379 [USE_NEON] (_gcry_sha1_transform_armv7_neon): New.
18380 (transform) [USE_NEON]: Use ARM/NEON assembly if enabled.
18381 * configure.ac: Add 'sha1-armv7-neon.lo'.
18382
18383 Improve performance of SHA-512/ARM/NEON implementation.
18384 + commit df629ba53a662427ebd3ddca90c3fe9ddd6511d3
18385 * cipher/sha512-armv7-neon.S (RT01q, RT23q, RT45q, RT67q): New.
18386 (round_0_63, round_64_79): Remove.
18387 (rounds2_0_63, rounds2_64_79): New.
18388 (_gcry_sha512_transform_armv7_neon): Add 'nblks' input; Handle multiple
18389 input blocks; Use new round macros.
18390 * cipher/sha512.c [USE_ARM_NEON_ASM]
18391 (_gcry_sha512_transform_armv7_neon): Add 'num_blks'.
18392 (transform) [USE_ARM_NEON_ASM]: Pass nblks to assembly.
18393
18394 Add AVX and AVX2/BMI implementations for SHA-256.
18395 + commit a5c2bbfe0db515d739ab683297903c77b1eec124
18396 * LICENSES: Add 'cipher/sha256-avx-amd64.S' and
18397 'cipher/sha256-avx2-bmi2-amd64.S'.
18398 * cipher/Makefile.am: Add 'sha256-avx-amd64.S' and
18399 'sha256-avx2-bmi2-amd64.S'.
18400 * cipher/sha256-avx-amd64.S: New.
18401 * cipher/sha256-avx2-bmi2-amd64.S: New.
18402 * cipher/sha256-ssse3-amd64.S: Use 'lea' instead of 'add' in few
18403 places for tiny speed improvement.
18404 * cipher/sha256.c (USE_AVX, USE_AVX2): New.
18405 (SHA256_CONTEXT) [USE_AVX, USE_AVX2]: Add 'use_avx' and 'use_avx2'.
18406 (sha256_init, sha224_init) [USE_AVX, USE_AVX2]: Initialize above
18407 new context members.
18408 [USE_AVX] (_gcry_sha256_transform_amd64_avx): New.
18409 [USE_AVX2] (_gcry_sha256_transform_amd64_avx2): New.
18410 (transform) [USE_AVX2]: Use AVX2 assembly if enabled.
18411 (transform) [USE_AVX]: Use AVX assembly if enabled.
18412 * configure.ac: Add 'sha256-avx-amd64.lo' and
18413 'sha256-avx2-bmi2-amd64.lo'.
18414
18415 2013-12-17 Jussi Kivilinna <[email protected]>
18416
18417 Add AVX and AVX/BMI2 implementations for SHA-1.
18418 + commit e4e458465b124e25b6aec7a60174bf1ca32dc5fd
18419 * cipher/Makefile.am: Add 'sha1-avx-amd64.S' and
18420 'sha1-avx-bmi2-amd64.S'.
18421 * cipher/sha1-avx-amd64.S: New.
18422 * cipher/sha1-avx-bmi2-amd64.S: New.
18423 * cipher/sha1.c (USE_AVX, USE_BMI2): New.
18424 (SHA1_CONTEXT) [USE_AVX]: Add 'use_avx'.
18425 (SHA1_CONTEXT) [USE_BMI2]: Add 'use_bmi2'.
18426 (sha1_init): Initialize 'use_avx' and 'use_bmi2'.
18427 [USE_AVX] (_gcry_sha1_transform_amd64_avx): New.
18428 [USE_BMI2] (_gcry_sha1_transform_amd64_bmi2): New.
18429 (transform) [USE_BMI2]: Use BMI2 assembly if enabled.
18430 (transform) [USE_AVX]: Use AVX assembly if enabled.
18431 * configure.ac: Add 'sha1-avx-amd64.lo' and 'sha1-avx-bmi2-amd64.lo'.
18432
18433 SHA-1/SSSE3: Improve performance on large buffers.
18434 + commit 6fd0dd2a5f1362f91e2861cd9d300341a43842a5
18435 * cipher/sha1-ssse3-amd64.S (RNBLKS): New.
18436 (_gcry_sha1_transform_amd64_ssse3): Handle multiple input blocks, with
18437 software pipelining of next data block processing.
18438 * cipher/sha1.c [USE_SSSE3] (_gcry_sha1_transform_amd64_ssse3): Add
18439 'nblks'.
18440 (transform) [USE_SSSE3]: Pass nblks to assembly function.
18441
18442 Add bulk processing for hash transform functions.
18443 + commit 50b8c8342d023038a4b528af83153293dd2756ea
18444 * cipher/hash-common.c (_gcry_md_block_write): Preload 'hd->blocksize'
18445 to stack, pass number of blocks to 'hd->bwrite'.
18446 * cipher/hash-common.c (_gcry_md_block_write_t): Add 'nblks'.
18447 * cipher/gostr3411-94.c: Rename 'transform' function to
18448 'transform_blk', add new 'transform' function with 'nblks' as
18449 additional input.
18450 * cipher/md4.c: Ditto.
18451 * cipher/md5.c: Ditto.
18452 * cipher/md4.c: Ditto.
18453 * cipher/rmd160.c: Ditto.
18454 * cipher/sha1.c: Ditto.
18455 * cipher/sha256.c: Ditto.
18456 * cipher/sha512.c: Ditto.
18457 * cipher/stribog.c: Ditto.
18458 * cipher/tiger.c: Ditto.
18459 * cipher/whirlpool.c: Ditto.
18460
18461 2013-12-16 Werner Koch <[email protected]>
18462
18463 Release 1.6.0.
18464 + commit 0ea9731e1c93a962f6266004ab0e7418c19d6277
18465
18466
18467 doc: Change yat2m to allow arbitrary condition names.
18468 + commit 9a912f8c4f366c53f1cdb94513b67b937e87178b
18469 * doc/yat2m.c (MAX_CONDITION_NESTING): New.
18470 (gpgone_defined): Remove.
18471 (condition_s, condition_stack, condition_stack_idx): New.
18472 (cond_is_active, cond_in_verbatim): New.
18473 (add_predefined_macro, set_macro, macro_set_p): New.
18474 (evaluate_conditions, push_condition, pop_condition): New.
18475 (parse_file): Rewrite to use the condition stack.
18476 (top_parse_file): Set prefined macros.
18477 (main): Change -D to define arbitrary macros.
18478
18479 tests: Add SHA-512 to the long hash test.
18480 + commit 0d3bd23d7f730b9bbc81fc8da8d99f4853c36020
18481 * tests/hashtest.c (testvectors): Add vectors for 256GiB SHA-512.
18482 * tests/hashtest-256g.in (algos): Add test for SHA-512.
18483
18484 Add configure option --enable-large-data-tests.
18485 + commit a6b9304a889397ac98e1c2c4ac3e178669d94492
18486 * configure.ac: Add option --enable-large-data-tests.
18487 * tests/hashtest-256g.in: New.
18488 * tests/Makefile.am (EXTRA_DIST): Add hashtest-256g.in.
18489 (TESTS): Split up into tests_bin, tests_bin_last, tests_sh, and
18490 tests_sh_last.
18491 (tests_sh_last): Add hashtest-256g
18492 (noinst_PROGRAMS): Add only tests_bin and tests_bin_last.
18493 (bench-slope.log, hashtest-256g.log): New rules to enforce serial run.
18494
18495 random: Call random progress handler more often.
18496 + commit 5a7ce59396fe56f0d681df314bfbdb5f7732d4b1
18497 * random/rndlinux.c (_gcry_rndlinux_gather_random): Update progress
18498 indicator earlier.
18499
18500 cipher: Normalize the MPIs used as input to secret key functions.
18501 + commit dec048b2ec79271a2f4405be5b87b1e768b3f1a9
18502 * cipher/dsa.c (sign): Normalize INPUT.
18503 * cipher/elgamal.c (decrypt): Normalize A and B.
18504 * cipher/rsa.c (secret): Normalize the INPUT.
18505 (rsa_decrypt): Reduce DATA before passing to secret.
18506
18507 2013-12-16 Jussi Kivilinna <[email protected]>
18508
18509 Change dummy variable in mpih-div.c to mpi_limb_t type.
18510 + commit 953535a7de68cf62b5b1ad6f96ea3a9edd83762c
18511 * mpi/mpih-div.c (_gcry_mpih_mod_1, _gcry_mpih_divmod_1): Change dummy
18512 variable to 'mpi_limb_t' type from 'int'.
18513
18514 Remove duplicate gcry_mac_hd_t typedef.
18515 + commit 5c31990214b58c4e17edb01fbbe6d9f573975a22
18516 * cipher/mac-internal.h (gcry_mac_hd_t): Remove.
18517
18518 2013-12-15 Jussi Kivilinna <[email protected]>
18519
18520 Use u64 for CCM data lengths.
18521 + commit 110fed2d6b0bbc97cb5cc0a3a564e05fc42afa2d
18522 * cipher/cipher-ccm.c: Move code inside [HAVE_U64_TYPEDEF].
18523 [HAVE_U64_TYPEDEF] (_gcry_cipher_ccm_set_lengths): Use 'u64' for
18524 data lengths.
18525 [!HAVE_U64_TYPEDEF] (_gcry_cipher_ccm_encrypt)
18526 (_gcry_cipher_ccm_decrypt, _gcry_cipher_ccm_set_nonce)
18527 (_gcry_cipher_ccm_authenticate, _gcry_cipher_ccm_get_tag)
18528 (_gcry_cipher_ccm_check_tag): Dummy functions returning
18529 GPG_ERROR_NOT_SUPPORTED.
18530 * cipher/cipher-internal.h (gcry_cipher_handle.u_mode.ccm)
18531 (_gcry_cipher_ccm_set_lengths): Move inside [HAVE_U64_TYPEDEF] and use
18532 u64 instead of size_t for CCM data lengths.
18533 * cipher/cipher.c (_gcry_cipher_open_internal, cipher_reset)
18534 (_gcry_cipher_ctl) [!HAVE_U64_TYPEDEF]: Return GPG_ERR_NOT_SUPPORTED
18535 for CCM.
18536 (_gcry_cipher_ctl) [HAVE_U64_TYPEDEF]: Use u64 for
18537 GCRYCTL_SET_CCM_LENGTHS length parameters.
18538 * tests/basic.c: Do not use CCM if !HAVE_U64_TYPEDEF.
18539 * tests/bench-slope.c: Ditto.
18540 * tests/benchmark.c: Ditto.
18541
18542 2013-12-14 Werner Koch <[email protected]>
18543
18544 tests: Prevent rare failure of gcry_pk_decrypt test.
18545 + commit bfb43a17d8db571fca4ed433ee8be5c366745844
18546 * tests/basic.c (check_pubkey_crypt): Add special mode 1.
18547 (main): Add option --loop.
18548
18549 2013-12-14 Jussi Kivilinna <[email protected]>
18550
18551 Minor fixes to SHA assembly implementations.
18552 + commit ffd9b2aa5abda7f4d7790ed48116ed5d71ab9995
18553 * cipher/Makefile.am: Correct 'sha256-avx*.S' to 'sha512-avx*.S'.
18554 * cipher/sha1-ssse3-amd64.S: First line, correct filename.
18555 * cipher/sha256-ssse3-amd64.S: Return correct stack burn depth.
18556 * cipher/sha512-avx-amd64.S: Use 'vzeroall' to clear registers.
18557 * cipher/sha512-avx2-bmi2-amd64.S: Ditto and return correct stack burn
18558 depth.
18559
18560 SHA-1/SSSE3: Do not check for Intel syntax assembly support.
18561 + commit c86c35534a153b13e880d0bb0ea3e48e1c0ecaf9
18562 * cipher/sha1-ssse3-amd64.S: Remove check for
18563 HAVE_INTEL_SYNTAX_PLATFORM_AS.
18564 * cipher/sha1.c [USE_SSSE3]: Ditto.
18565
18566 2013-12-13 Jussi Kivilinna <[email protected]>
18567
18568 Convert SHA-1 SSSE3 implementation from mixed asm&C to pure asm.
18569 + commit d2b853246c2ed056a92096d89c3ca057e45c9c92
18570 * cipher/Makefile.am: Change 'sha1-ssse3-amd64.c' to
18571 'sha1-ssse3-amd64.S'.
18572 * cipher/sha1-ssse3-amd64.c: Remove.
18573 * cipher/sha1-ssse3-amd64.S: New.
18574
18575 SHA-1: Add SSSE3 implementation.
18576 + commit be2238f68abcc6f2b4e8c38ad9141376ce622a22
18577 * cipher/Makefile.am: Add 'sha1-ssse3-amd64.c'.
18578 * cipher/sha1-ssse3-amd64.c: New.
18579 * cipher/sha1.c (USE_SSSE3): New.
18580 (SHA1_CONTEXT) [USE_SSSE3]: Add 'use_ssse3'.
18581 (sha1_init) [USE_SSSE3]: Initialize 'use_ssse3'.
18582 (transform): Rename to...
18583 (_transform): this.
18584 (transform): New.
18585 * configure.ac [host=x86_64]: Add 'sha1-ssse3-amd64.lo'.
18586
18587 Add missing register clearing in to SHA-256 and SHA-512 assembly.
18588 + commit 04615cc6803cdede25fa92e3ff697e252a23cd7a
18589 * cipher/sha256-ssse3-amd64.S: Clear used XMM/YMM registers at return.
18590 * cipher/sha512-avx-amd64.S: Ditto.
18591 * cipher/sha512-avx2-bmi2-amd64.S: Ditto.
18592 * cipher/sha512-ssse3-amd64.S: Ditto.
18593
18594 2013-12-13 Werner Koch <[email protected]>
18595
18596 Update license information.
18597 + commit 764643a3d5634bcbc47790bd8505f6a1a5280d9c
18598 * LICENSES: New.
18599 * Makefile.am (EXTRA_DIST): Add LICENSES.
18600 * AUTHORS: Add list of copyright holders.
18601 * README: Reference AUTHORS.
18602
18603 2013-12-13 Jussi Kivilinna <[email protected]>
18604
18605 Fix empty clobber in AVX2 assembly check.
18606 + commit e41d605ee41469e8a33cdc4d38f742cfb931f835
18607 * configure.ac (gcry_cv_gcc_inline_asm_avx2): Add "cc" as assembly
18608 globber.
18609
18610 Fix W32 build.
18611 + commit a71b810ddd67ca3a1773d8f929d162551abb58eb
18612 * random/rndw32.c (register_poll, slow_gatherer): Change gcry_xmalloc to
18613 xmalloc, and gcry_xrealloc to xrealloc.
18614
18615 2013-12-12 Jussi Kivilinna <[email protected]>
18616
18617 SHA-512: Add AVX and AVX2 implementations for x86-64.
18618 + commit 2e4253dc8eb512cd0e807360926dc6ba912c95b4
18619 * cipher/Makefile.am: Add 'sha512-avx-amd64.S' and
18620 'sha512-avx2-bmi2-amd64.S'.
18621 * cipher/sha512-avx-amd64.S: New.
18622 * cipher/sha512-avx2-bmi2-amd64.S: New.
18623 * cipher/sha512.c (USE_AVX, USE_AVX2): New.
18624 (SHA512_CONTEXT) [USE_AVX]: Add 'use_avx'.
18625 (SHA512_CONTEXT) [USE_AVX2]: Add 'use_avx2'.
18626 (sha512_init, sha384_init) [USE_AVX]: Initialize 'use_avx'.
18627 (sha512_init, sha384_init) [USE_AVX2]: Initialize 'use_avx2'.
18628 [USE_AVX] (_gcry_sha512_transform_amd64_avx): New.
18629 [USE_AVX2] (_gcry_sha512_transform_amd64_avx2): New.
18630 (transform) [USE_AVX2]: Add call for AVX2 implementation.
18631 (transform) [USE_AVX]: Add call for AVX implementation.
18632 * configure.ac (HAVE_GCC_INLINE_ASM_BMI2): New check.
18633 (sha512): Add 'sha512-avx-amd64.lo' and 'sha512-avx2-bmi2-amd64.lo'.
18634 * doc/gcrypt.texi: Document 'intel-cpu' and 'intel-bmi2'.
18635 * src/g10lib.h (HWF_INTEL_CPU, HWF_INTEL_BMI2): New.
18636 * src/hwfeatures.c (hwflist): Add "intel-cpu" and "intel-bmi2".
18637 * src/hwf-x86.c (detect_x86_gnuc): Check for HWF_INTEL_CPU and
18638 HWF_INTEL_BMI2.
18639
18640 SHA-512: Add SSSE3 implementation for x86-64.
18641 + commit 69a6d0f9562fcd26112a589318c13de66ce1700e
18642 * cipher/Makefile.am: Add 'sha512-ssse3-amd64.S'.
18643 * cipher/sha512-ssse3-amd64.S: New.
18644 * cipher/sha512.c (USE_SSSE3): New.
18645 (SHA512_CONTEXT) [USE_SSSE3]: Add 'use_ssse3'.
18646 (sha512_init, sha384_init) [USE_SSSE3]: Initialize 'use_ssse3'.
18647 [USE_SSSE3] (_gcry_sha512_transform_amd64_ssse3): New.
18648 (transform) [USE_SSSE3]: Call SSSE3 implementation.
18649 * configure.ac (sha512): Add 'sha512-ssse3-amd64.lo'.
18650
18651 SHA-256: Add SSSE3 implementation for x86-64.
18652 + commit e1a3931263e67aacec3c0bfcaa86c7d1441d5c6a
18653 * cipher/Makefile.am: Add 'sha256-ssse3-amd64.S'.
18654 * cipher/sha256-ssse3-amd64.S: New.
18655 * cipher/sha256.c (USE_SSSE3): New.
18656 (SHA256_CONTEXT) [USE_SSSE3]: Add 'use_ssse3'.
18657 (sha256_init, sha224_init) [USE_SSSE3]: Initialize 'use_ssse3'.
18658 (transform): Rename to...
18659 (_transform): This.
18660 [USE_SSSE3] (_gcry_sha256_transform_amd64_ssse3): New.
18661 (transform): New.
18662 * configure.ac (HAVE_INTEL_SYNTAX_PLATFORM_AS): New check.
18663 (sha256): Add 'sha256-ssse3-amd64.lo'.
18664 * doc/gcrypt.texi: Document 'intel-ssse3'.
18665 * src/g10lib.h (HWF_INTEL_SSSE3): New.
18666 * src/hwfeatures.c (hwflist): Add "intel-ssse3".
18667 * src/hwf-x86.c (detect_x86_gnuc): Test for SSSE3.
18668
18669 2013-12-12 Werner Koch <[email protected]>
18670
18671 Add a configuration file to disable hardware features.
18672 + commit 5e1239b1e2948211ff2675f45cce2b28c3379cfb
18673 * src/hwfeatures.c: Inclyde syslog.h and ctype.h.
18674 (HWF_DENY_FILE): New.
18675 (my_isascii): New.
18676 (parse_hwf_deny_file): New.
18677 (_gcry_detect_hw_features): Call it.
18678
18679 * src/mpicalc.c (main): Correctly initialize Libgcrypt. Add options
18680 "--print-config" and "--disable-hwf".
18681
18682 Move list of hardware features to hwfeatures.c.
18683 + commit 4ae77322b681a13da62d01274bcab25be2af12d0
18684 * src/global.c (hwflist, disabled_hw_features): Move to ..
18685 * src/hwfeatures.c: here.
18686 (_gcry_disable_hw_feature): New.
18687 (_gcry_enum_hw_features): New.
18688 (_gcry_detect_hw_features): Remove arg DISABLED_FEATURES.
18689 * src/global.c (print_config, _gcry_vcontrol, global_init): Adjust
18690 accordingly.
18691
18692 Remove macro hacks for internal vs. external functions. Part 2 and last.
18693 + commit 3b30e9840d4b351c4de73b126e561154cb7df4cc
18694 * src/visibility.h: Remove remaining define/undef hacks for symbol
18695 visibility. Add macros to detect the use of the public functions.
18696 Change all affected functions by replacing them by the x-macros.
18697 * src/g10lib.h: Add internal prototypes.
18698 (xtrymalloc, xtrycalloc, xtrymalloc_secure, xtrycalloc_secure)
18699 (xtryrealloc, xtrystrdup, xmalloc, xcalloc, xmalloc_secure)
18700 (xcalloc_secure, xrealloc, xstrdup, xfree): New macros.
18701
18702 2013-12-11 Werner Koch <[email protected]>
18703
18704 random: Add a feature to close device file descriptors.
18705 + commit cd548ba2dc777b8b27d8d33182ba733c20222120
18706 * src/gcrypt.h.in (GCRYCTL_CLOSE_RANDOM_DEVICE): New.
18707 * src/global.c (_gcry_vcontrol): Call _gcry_random_close_fds.
18708 * random/random.c (_gcry_random_close_fds): New.
18709 * random/random-csprng.c (_gcry_rngcsprng_close_fds): New.
18710 * random/random-fips.c (_gcry_rngfips_close_fds): New.
18711 * random/random-system.c (_gcry_rngsystem_close_fds): New.
18712 * random/rndlinux.c (open_device): Add arg retry.
18713 (_gcry_rndlinux_gather_random): Add mode to close open fds.
18714
18715 * tests/random.c (check_close_random_device): New.
18716 (main): Call new test.
18717
18718 2013-12-10 Werner Koch <[email protected]>
18719
18720 Fix last commit (9a37470c)
18721 + commit eae1e7712e1b687bd77eb37d0eb505fc9d46d93c
18722 * src/secmem.c (lock_pool): Remove remaining line. Reported by Ian
18723 Goldberg.
18724
18725 2013-12-09 Werner Koch <[email protected]>
18726
18727 Fix one-off memory leak when build with Linux capability support.
18728 + commit 9a37470c50ee9966cb2652617a404ddd54a9c096
18729 * src/secmem.c (lock_pool, secmem_init): Use cap_free. Reported by
18730 Mike Crowe <[email protected]>.
18731
18732 2013-12-09 David 'Digit' Turner <[email protected]>
18733
18734 Update libtool to support Android.
18735 + commit 2516f0b660b1a7181ad38c44310c627f4f498595
18736 * m4/libtool.m4: Add "linux*android*" case. Taken from the libtool
18737 repository.
18738
18739 2013-12-09 Werner Koch <[email protected]>
18740
18741 tests: Speed up benchmarks in regression test mode.
18742 + commit 2e5354fe8db5288939733d0fb63ad4c87bc20105
18743 * tests/tsexp.c (check_extract_param): Fix compiler warning.
18744 * tests/Makefile.am (TESTS_ENVIRONMENT): Set GCRYPT_IN_REGRESSION_TEST.
18745 * tests/bench-slope.c (main): Speed up if in regression test mode.
18746 * tests/benchmark.c (main): Ditto.
18747
18748 tests: Add --csv option to bench-slope.
18749 + commit 8072e9fa4b42ae8e65e266aa158fd903f1bb0927
18750 * tests/bench-slope.c (STR, STR2): New.
18751 (cvs_mode): New.
18752 (num_measurement_repetitions): New. Replace use of
18753 NUM_MEASUREMENT_REPETITIONS by this.
18754 (current_section_name, current_algo_name, current_mode_name): New.
18755 (bench_print_result_csv): New.
18756 (bench_print_result_std): Rename from bench_print_result.
18757 (bench_print_result): New. Divert depending on CSV_MODE.
18758 (bench_print_header, bench_print_footer): take care of CSV_MODE.
18759 (bench_print_algo, bench_print_mode): New. Use them instead of
18760 explicit printfs.
18761 (main): Add options --csv and --repetitions.
18762
18763 2013-12-07 Werner Koch <[email protected]>
18764
18765 sexp: Allow long names and white space in gcry_sexp_extract_param.
18766 + commit d4555433b6e422fa69a85cae99961f513e55d82b
18767 * src/sexp.c (_gcry_sexp_vextract_param): Skip white space. Support
18768 long parameter names.
18769 * tests/tsexp.c (check_extract_param): Add test cases for long parameter
18770 names and white space.
18771
18772 2013-12-06 Werner Koch <[email protected]>
18773
18774 ecc: Merge partly duplicated code.
18775 + commit 405021cb6d4e470337302c65dec5bc91491a89c1
18776 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_sign): Factor A hashing out to ...
18777 (_gcry_ecc_eddsa_compute_h_d): new function.
18778 * cipher/ecc-misc.c (_gcry_ecc_compute_public): Use new function.
18779 (reverse_buffer): Remove.
18780
18781 ecc: Remove unused internal function.
18782 + commit 4cf2c65fe15173c8d68a141a01b34fc1fb9080b7
18783 * src/cipher-proto.h (gcry_pk_spec): Remove get_param.
18784 * cipher/ecc-curves.c (_gcry_ecc_get_param_sexp): Merge in code from
18785 _gcry_ecc_get_param.
18786 (_gcry_ecc_get_param): Remove.
18787 * cipher/ecc.c (_gcry_pubkey_spec_ecc): Remove _gcry_ecc_get_param.
18788
18789 2013-12-06 Jussi Kivilinna <[email protected]>
18790
18791 Fix building on mingw32.
18792 + commit 5917ce34e3b3eac4c15f62577e4723974024f818
18793 * src/gcrypt-int.h: Include <types.h>.
18794
18795 2013-12-05 Werner Koch <[email protected]>
18796
18797 ecc: Change OID for Ed25519.
18798 + commit 7ef43d1eebb4f8226e860982dfe5fa2e2c82ad0f
18799 * cipher/ecc-curves.c (curve_aliased): Add more suitable OID for
18800 Ed25519.
18801
18802 Remove macro hacks for internal vs. external functions. Part 1.
18803 + commit 7bacf1812b55fa78db63abaa1f5a9220e9c6cccc
18804 * src/visibility.h: Remove almost all define/undef hacks for symbol
18805 visibility. Add macros to detect the use of the public functions.
18806 Change all affected functions by prefixing them explicitly with an
18807 underscore and change all internal callers to call the underscore
18808 prefixed versions. Provide convenience macros from sexp and mpi
18809 functions.
18810 * src/visibility.c: Change all functions to use only gpg_err_code_t
18811 and translate to gpg_error_t only in visibility.c.
18812
18813 2013-12-04 Jussi Kivilinna <[email protected]>
18814
18815 mpi: add inline assembly for x86-64.
18816 + commit 85bb0a98ea5add0296cbcc415d557eaa1f6bd294
18817 * mpi/longlong.h [__x86_64] (add_ssaaaa, sub_ddmmss, umul_ppmm)
18818 (udiv_qrnnd, count_leading_zeros, count_trailing_zeros): New.
18819
18820 2013-12-04 NIIBE Yutaka <[email protected]>
18821
18822 mpi: fix gcry_mpi_powm for negative base.
18823 + commit c56080c26186d25dec05f01831494c77d8d07e13
18824 * mpi/mpi-pow.c (gcry_mpi_powm) [USE_ALGORITHM_SIMPLE_EXPONENTIATION]:
18825 Fix for the case where BASE is negative.
18826 * tests/mpitests.c (test_powm): Add a test case of (-17)^6 mod 19.
18827
18828 2013-12-03 Werner Koch <[email protected]>
18829
18830 Add build support for ppc64le.
18831 + commit 2ff86db2e1b0f6cc22a1ca86037b526c5fa3be51
18832 * config.guess, config.sub: Update to latest version (2013-11-29).
18833 * m4/libtool.m4: Add patches for ppc64le.
18834
18835 2013-12-03 Jussi Kivilinna <[email protected]>
18836
18837 rijndael: fix compiler warning on aarch64.
18838 + commit 59b1a1b7ee2923e1bf091071ae716d180c6c6006
18839 * cipher/rijndael.c (do_setkey): Use braces for empty if statement
18840 instead of semicolon.
18841
18842 Add aarch64 (arm64) mpi assembly.
18843 + commit 80896bc8f5e6ed9a627374e34f040ad5f3617584
18844 * mpi/aarch64/mpi-asm-defs.h: New.
18845 * mpi/aarch64/mpih-add1.S: New.
18846 * mpi/aarch64/mpih-mul1.S: New.
18847 * mpi/aarch64/mpih-mul2.S: New.
18848 * mpi/aarch64/mpih-mul3.S: New.
18849 * mpi/aarch64/mpih-sub1.S: New.
18850 * mpi/config.links [host=aarch64-*-*]: Add configguration for aarch64
18851 assembly.
18852 * mpi/longlong.h [__aarch64__] (add_ssaaaa, sub_ddmmss, umul_ppmm)
18853 (count_leading_zeros): New.
18854
18855 2013-12-02 Werner Koch <[email protected]>
18856
18857 ecc: Use constant time point operation for Twisted Edwards.
18858 + commit d4ce0cfe0d35d7ec69c115456848b5b735c928ea
18859 * mpi/ec.c (_gcry_mpi_ec_mul_point): Try to do a constant time
18860 operation if needed.
18861 * tests/benchmark.c (main): Add option --use-secmem.
18862
18863 ecc: Make gcry_pk_testkey work for Ed25519.
18864 + commit 14ae6224b1b17abbfc80c26ad0f4c60f1e8635e2
18865 * cipher/ecc-misc.c (_gcry_ecc_compute_public): Add optional args G
18866 and d. Change all callers.
18867 * cipher/ecc.c (gen_y_2): Remove.
18868 (check_secret_key): Use generic public key compute function. Adjust
18869 for use with Ed25519 and EdDSA.
18870 (nist_generate_key): Do not use the compliant key thingy for Ed25519.
18871 (ecc_check_secret_key): Make parameter parsing similar to the other
18872 functions.
18873 * cipher/ecc-curves.c (domain_parms): Zero prefix some parameters so
18874 that _gcry_ecc_update_curve_param works correctly.
18875 * tests/keygen.c (check_ecc_keys): Add "param" flag. Check all
18876 Ed25519 keys.
18877
18878 ecc: Fix eddsa point decompression.
18879 + commit 485f35124b1a74af0bad321ed70be3a79d8d11d7
18880 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_recover_x): Fix the negative
18881 case.
18882
18883 ecc: Fix gcry_mpi_ec_curve_point for Weierstrass.
18884 + commit ecb90f8e7c6f2516080d27ed7da6a25f2314da3c
18885 * mpi/ec.c (_gcry_mpi_ec_curve_point): Use correct equation.
18886 (ec_pow3): New.
18887 (ec_p_init): Always copy B.
18888
18889 mpi: Introduce 4 user flags for gcry_mpi_t.
18890 + commit 29eddc2558d4cf39995f66d5fccd62f584d5b203
18891 * src/gcrypt.h.in (GCRYMPI_FLAG_USER1, GCRYMPI_FLAG_USER2)
18892 (GCRYMPI_FLAG_USER3, GCRYMPI_FLAG_USER4): New.
18893 * mpi/mpiutil.c (gcry_mpi_set_flag, gcry_mpi_clear_flag)
18894 (gcry_mpi_get_flag, _gcry_mpi_free): Implement them.
18895 (gcry_mpi_set_opaque): Keep user flags.
18896
18897 2013-11-29 Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]>
18898
18899 Fix armv3 compile error.
18900 + commit 3b1cc9e6c357574f54160298d731c18f3d717b6c
18901 * mpi/longlong.h [__arm__ && __ARM_ARCH < 4] (umul_ppmm): Use
18902 __AND_CLOBBER_CC instead of __CLOBBER_CC.
18903
18904 longlong.h on mips with clang.
18905 + commit 1ecbd0bca31d462719a2a6590c1d03244e76ef89
18906 * mpi/longlong.h [__mips__]: Use C-language version with clang.
18907
18908 2013-11-24 Jussi Kivilinna <[email protected]>
18909
18910 Camellia: Tweaks for AES-NI implementations.
18911 + commit 3ef21e7e1b8003db9792155044db95f9d9ced184
18912 * cipher/camellia-aesni-avx-amd64.S: Align stack to 16 bytes; tweak
18913 key-setup for small speed up.
18914 * cipher/camellia-aesni-avx2-amd64.S: Use vmovdqu even with aligned
18915 stack; reorder vinsert128 instructions; use rbp for stack frame.
18916
18917 2013-11-21 Jussi Kivilinna <[email protected]>
18918
18919 Add GMAC to MAC API.
18920 + commit a34448c929b13bfb7b66d69169c89e7319a18b31
18921 * cipher/Makefile.am: Add 'mac-gmac.c'.
18922 * cipher/mac-gmac.c: New.
18923 * cipher/mac-internal.h (gcry_mac_handle): Add 'u.gcm'.
18924 (_gcry_mac_type_spec_gmac_aes, _gcry_mac_type_spec_gmac_twofish)
18925 (_gcry_mac_type_spec_gmac_serpent, _gcry_mac_type_spec_gmac_seed)
18926 (_gcry_mac_type_spec_gmac_camellia): New externs.
18927 * cipher/mac.c (mac_list): Add GMAC specifications.
18928 * doc/gcrypt.texi: Add mention of GMAC.
18929 * src/gcrypt.h.in (gcry_mac_algos): Add GCM algorithms.
18930 * tests/basic.c (check_one_mac): Add support for MAC IVs.
18931 (check_mac): Add support for MAC IVs and add GMAC test vectors.
18932 * tests/bench-slope.c (mac_bench): Iterate algorithm numbers to 499.
18933 * tests/benchmark.c (mac_bench): Iterate algorithm numbers to 499.
18934
18935 GCM: Move gcm_table initialization to setkey.
18936 + commit dbfa651618693da7ea73b4d2d00d4efd411bfb46
18937 * cipher/cipher-gcm.c: Change all 'c->u_iv.iv' to
18938 'c->u_mode.gcm.u_ghash_key.key'.
18939 (_gcry_cipher_gcm_setkey): New.
18940 (_gcry_cipher_gcm_initiv): Move ghash initialization to function above.
18941 * cipher/cipher-internal.h (gcry_cipher_handle): Add
18942 'u_mode.gcm.u_ghash_key'; Reorder 'u_mode.gcm' members for partial
18943 clearing in gcry_cipher_reset.
18944 (_gcry_cipher_gcm_setkey): New prototype.
18945 * cipher/cipher.c (cipher_setkey): Add GCM setkey.
18946 (cipher_reset): Clear 'u_mode' only partially for GCM.
18947
18948 2013-11-20 Jussi Kivilinna <[email protected]>
18949
18950 GCM: Add support for split data buffers and online operation.
18951 + commit fb1e52e3fe231671de546eacd6becd31c26c4f7b
18952 * cipher/cipher-gcm.c (do_ghash_buf): Add buffering for less than
18953 blocksize length input and padding handling.
18954 (_gcry_cipher_gcm_encrypt, _gcry_cipher_gcm_decrypt): Add handling
18955 for AAD padding and check if data has already being padded.
18956 (_gcry_cipher_gcm_authenticate): Check that AAD or data has not being
18957 padded yet.
18958 (_gcry_cipher_gcm_initiv): Clear padding marks.
18959 (_gcry_cipher_gcm_tag): Add finalization and padding; Clear sensitive
18960 data from cipher handle, since they are not used after generating tag.
18961 * cipher/cipher-internal.h (gcry_cipher_handle): Add 'u_mode.gcm.macbuf',
18962 'u_mode.gcm.mac_unused', 'u_mode.gcm.ghash_data_finalized' and
18963 'u_mode.gcm.ghash_aad_finalized'.
18964 * tests/basic.c (check_gcm_cipher): Rename to...
18965 (_check_gcm_cipher): ...this and add handling for different buffer step
18966 lengths; Enable per byte buffer testing.
18967 (check_gcm_cipher): Call _check_gcm_cipher with different buffer step
18968 sizes.
18969
18970 GCM: Use size_t for buffer sizes.
18971 + commit 2d870a9142e8c8b3f008e1ad8e83e4bdf7a8e4e7
18972 * cipher/cipher-gcm.c (ghash, gcm_bytecounter_add, do_ghash_buf)
18973 (_gcry_cipher_gcm_encrypt, _gcry_cipher_gcm_decrypt)
18974 (_gcry_cipher_gcm_authenticate, _gcry_cipher_gcm_geniv)
18975 (_gcry_cipher_gcm_tag): Use size_t for buffer lengths.
18976 * cipher/cipher-internal.h (_gcry_cipher_gcm_encrypt)
18977 (_gcry_cipher_gcm_decrypt, _gcry_cipher_gcm_authenticate): Use size_t
18978 for buffer lengths.
18979
18980 GCM: add FIPS mode restrictions.
18981 + commit 56d352d6bdcf7abaa33c3399741f5063e2ddc32a
18982 * cipher/cipher-gcm.c (_gcry_cipher_gcm_encrypt)
18983 (_gcry_cipher_gcm_get_tag): Do not allow using in FIPS mode is setiv
18984 was invocated directly.
18985 (_gcry_cipher_gcm_setiv): Rename to...
18986 (_gcry_cipher_gcm_initiv): ...this.
18987 (_gcry_cipher_gcm_setiv): New setiv function with check for FIPS mode.
18988 [TODO] (_gcry_cipher_gcm_getiv): New.
18989 * cipher/cipher-internal.h (gcry_cipher_handle): Add
18990 'u_mode.gcm.disallow_encryption_because_of_setiv_in_fips_mode'.
18991
18992 GCM: Add clearing and checking of marks.tag.
18993 + commit 32a2da9abc91394b23cf565c1c833fa964394083
18994 * cipher/cipher-gcm.c (_gcry_cipher_gcm_encrypt)
18995 (_gcry_cipher_gcm_decrypt, _gcry_cipher_gcm_authenticate): Make sure
18996 that tag has not been finalized yet.
18997 (_gcry_cipher_gcm_setiv): Clear 'marks.tag'.
18998
18999 GCM: Add stack burning.
19000 + commit 018f08354b1b116672e82f9ce942884b288aaf9e
19001 * cipher/cipher-gcm.c (do_ghash, ghash): Return stack burn depth.
19002 (setupM): Wipe 'tmp' buffer.
19003 (do_ghash_buf): Wipe 'tmp' buffer and add stack burning.
19004
19005 Add aggregated bulk processing for GCM on x86-64.
19006 + commit c9537fbf8ff0af919cff2bebadc4c6e7caea8076
19007 * cipher/cipher-gcm.c [__x86_64__] (gfmul_pclmul_aggr4): New.
19008 (ghash) [GCM_USE_INTEL_PCLMUL]: Add aggregated bulk processing
19009 for __x86_64__.
19010 (setupM) [__x86_64__]: Add initialization for aggregated bulk
19011 processing.
19012
19013 GCM: Tweak Intel PCLMUL ghash loop for small speed-up.
19014 + commit 9b6764944284fed733c2f88619b3d9eb5d5c259a
19015 * cipher/cipher-gcm.c (do_ghash): Mark 'inline'.
19016 [GCM_USE_INTEL_PCLMUL] (do_ghash_pclmul): Rename to...
19017 [GCM_USE_INTEL_PCLMUL] (gfmul_pclmul): ..this and make inline function.
19018 (ghash) [GCM_USE_INTEL_PCLMUL]: Preload data before ghash-pclmul loop.
19019
19020 GCM: Use counter mode code for speed-up.
19021 + commit bd4bd23a2511a4bce63c3217cca0d4ecf0c79532
19022 * cipher/cipher-gcm.c (ghash): Add process for multiple blocks.
19023 (gcm_bytecounter_add, gcm_add32_be128, gcm_check_datalen)
19024 (gcm_check_aadlen_or_ivlen, do_ghash_buf): New functions.
19025 (_gcry_cipher_gcm_encrypt, _gcry_cipher_gcm_decrypt)
19026 (_gcry_cipher_gcm_authenticate, _gcry_cipher_gcm_set_iv)
19027 (_gcry_cipher_gcm_tag): Adjust to use above new functions and
19028 counter mode functions for encryption/decryption.
19029 * cipher/cipher-internal.h (gcry_cipher_handle): Remove 'length'; Add
19030 'u_mode.gcm.(addlen|datalen|tagiv|datalen_over_limits)'.
19031 (_gcry_cipher_gcm_setiv): Return gcry_err_code_t.
19032 * cipher/cipher.c (cipher_setiv): Return error code.
19033 (_gcry_cipher_setiv): Handle error code from 'cipher_setiv'.
19034
19035 Add Intel PCLMUL acceleration for GCM.
19036 + commit 5a65ffabadd50f174ab7375faad7a726cce49e61
19037 * cipher/cipher-gcm.c (fillM): Rename...
19038 (do_fillM): ...to this.
19039 (ghash): Remove.
19040 (fillM): New macro.
19041 (GHASH): Use 'do_ghash' instead of 'ghash'.
19042 [GCM_USE_INTEL_PCLMUL] (do_ghash_pclmul): New.
19043 (ghash): New.
19044 (setupM): New.
19045 (_gcry_cipher_gcm_encrypt, _gcry_cipher_gcm_decrypt)
19046 (_gcry_cipher_gcm_authenticate, _gcry_cipher_gcm_setiv)
19047 (_gcry_cipher_gcm_tag): Use 'ghash' instead of 'GHASH' and
19048 'c->u_mode.gcm.u_tag.tag' instead of 'c->u_tag.tag'.
19049 * cipher/cipher-internal.h (GCM_USE_INTEL_PCLMUL): New.
19050 (gcry_cipher_handle): Move 'u_tag' and 'gcm_table' under
19051 'u_mode.gcm'.
19052 * configure.ac (pclmulsupport, gcry_cv_gcc_inline_asm_pclmul): New.
19053 * src/g10lib.h (HWF_INTEL_PCLMUL): New.
19054 * src/global.c: Add "intel-pclmul".
19055 * src/hwf-x86.c (detect_x86_gnuc): Add check for Intel PCLMUL.
19056
19057 GCM: GHASH optimizations.
19058 + commit 0e9e7d72f3c9eb7ac832746c3034855faaf8d02c
19059 * cipher/cipher-gcm.c [GCM_USE_TABLES] (gcmR, ghash): Replace with new.
19060 [GCM_USE_TABLES] [GCM_TABLES_USE_U64] (bshift, fillM, do_ghash): New.
19061 [GCM_USE_TABLES] [!GCM_TABLES_USE_U64] (bshift, fillM): Replace with
19062 new.
19063 [GCM_USE_TABLES] [!GCM_TABLES_USE_U64] (do_ghash): New.
19064 (_gcry_cipher_gcm_tag): Remove extra memcpy to outbuf and use
19065 buf_eq_const for comparing authentication tag.
19066 * cipher/cipher-internal.h (gcry_cipher_handle): Different 'gcm_table'
19067 for 32-bit and 64-bit platforms.
19068
19069 Add some documentation for GCM mode.
19070 + commit 332da0ed7c8fab6c2bee841c94d8364c2ab4e30d
19071 * doc/gcrypt.texi: Add mention of GCM mode.
19072
19073 2013-11-19 Dmitry Eremin-Solenikov <[email protected]>
19074
19075 Initial implementation of GCM.
19076 + commit 90cce18b9eced4f412ceeec5bcae18c4493322df
19077 * cipher/Makefile.am: Add 'cipher-gcm.c'.
19078 * cipher/cipher-ccm.c (_gcry_ciphert_ccm_set_lengths)
19079 (_gcry_cipher_ccm_authenticate, _gcry_cipher_ccm_tag)
19080 (_gcry_cipher_ccm_encrypt, _gcry_cipher_ccm_decrypt): Change
19081 'c->u_mode.ccm.tag' to 'c->marks.tag'.
19082 * cipher/cipher-gcm.c: New.
19083 * cipher/cipher-internal.h (GCM_USE_TABLES): New.
19084 (gcry_cipher_handle): Add 'marks.tag', 'u_tag', 'length' and
19085 'gcm_table'; Remove 'u_mode.ccm.tag'.
19086 (_gcry_cipher_gcm_encrypt, _gcry_cipher_gcm_decrypt)
19087 (_gcry_cipher_gcm_setiv, _gcry_cipher_gcm_authenticate)
19088 (_gcry_cipher_gcm_get_tag, _gcry_cipher_gcm_check_tag): New.
19089 * cipher/cipher.c (_gcry_cipher_open_internal, cipher_setkey)
19090 (cipher_encrypt, cipher_decrypt, _gcry_cipher_authenticate)
19091 (_gcry_cipher_gettag, _gcry_cipher_checktag): Add GCM mode handling.
19092 * src/gcrypt.h.in (gcry_cipher_modes): Add GCRY_CIPHER_MODE_GCM.
19093 (GCRY_GCM_BLOCK_LEN): New.
19094 * tests/basic.c (check_gcm_cipher): New.
19095 (check_ciphers): Add GCM check.
19096 (check_cipher_modes): Call 'check_gcm_cipher'.
19097 * tests/bench-slope.c (bench_gcm_encrypt_do_bench)
19098 (bench_gcm_decrypt_do_bench, bench_gcm_authenticate_do_bench)
19099 (gcm_encrypt_ops, gcm_decrypt_ops, gcm_authenticate_ops): New.
19100 (cipher_modes): Add GCM enc/dec/auth.
19101 (cipher_bench_one): Limit GCM to block ciphers with 16 byte block-size.
19102 * tests/benchmark.c (cipher_bench): Add GCM.
19103
19104 2013-11-19 Jussi Kivilinna <[email protected]>
19105
19106 Camellia: fix compiler warning.
19107 + commit 9816ae9d9931b75e4fdc9a5be10e6af447132313
19108 * cipher/camellia-glue.c (camellia_setkey): Use braces around empty if
19109 statement.
19110
19111 Tweak Camellia-AVX key-setup for small speed-up.
19112 + commit 77922a82c3f2e30eca04511fa5a355208349c657
19113 * cipher/camellia-aesni-avx-amd64.S (camellia_f): Merge S-function output
19114 rotation with P-function.
19115
19116 Add CMAC (Cipher-based MAC) to MAC API.
19117 + commit b49cd64aaaff2e5488a84665362ef7150683226c
19118 * cipher/Makefile.am: Add 'cipher-cmac.c' and 'mac-cmac.c'.
19119 * cipher/cipher-cmac.c: New.
19120 * cipher/cipher-internal.h (gcry_cipher_handle.u_mode): Add 'cmac'.
19121 * cipher/cipher.c (gcry_cipher_open): Rename to...
19122 (_gcry_cipher_open_internal): ...this and add CMAC.
19123 (gcry_cipher_open): New wrapper that disallows use of internal
19124 modes (CMAC) from outside.
19125 (cipher_setkey, cipher_encrypt, cipher_decrypt)
19126 (_gcry_cipher_authenticate, _gcry_cipher_gettag)
19127 (_gcry_cipher_checktag): Add handling for CMAC mode.
19128 (cipher_reset): Do not reset 'marks.key' and do not clear subkeys in
19129 'u_mode' in CMAC mode.
19130 * cipher/mac-cmac.c: New.
19131 * cipher/mac-internal.h: Add CMAC support and algorithms.
19132 * cipher/mac.c: Add CMAC algorithms.
19133 * doc/gcrypt.texi: Add documentation for CMAC.
19134 * src/cipher.h (gcry_cipher_internal_modes): New.
19135 (_gcry_cipher_open_internal, _gcry_cipher_cmac_authenticate)
19136 (_gcry_cipher_cmac_get_tag, _gcry_cipher_cmac_check_tag)
19137 (_gcry_cipher_cmac_set_subkeys): New prototypes.
19138 * src/gcrypt.h.in (gcry_mac_algos): Add CMAC algorithms.
19139 * tests/basic.c (check_mac): Add CMAC test vectors.
19140
19141 2013-11-16 Jussi Kivilinna <[email protected]>
19142
19143 Add new MAC API, initially with HMAC.
19144 + commit fcd6da37d55f248d3558ee0ff385b41b866e7ded
19145 * cipher/Makefile.am: Add 'mac.c', 'mac-internal.h' and 'mac-hmac.c'.
19146 * cipher/bufhelp.h (buf_eq_const): New.
19147 * cipher/cipher-ccm.c (_gcry_cipher_ccm_tag): Use 'buf_eq_const' for
19148 constant-time compare.
19149 * cipher/mac-hmac.c: New.
19150 * cipher/mac-internal.h: New.
19151 * cipher/mac.c: New.
19152 * doc/gcrypt.texi: Add documentation for MAC API.
19153 * src/gcrypt-int.h [GPG_ERROR_VERSION_NUMBER < 1.13]
19154 (GPG_ERR_MAC_ALGO): New.
19155 * src/gcrypt.h.in (gcry_mac_handle, gcry_mac_hd_t, gcry_mac_algos)
19156 (gcry_mac_flags, gcry_mac_open, gcry_mac_close, gcry_mac_ctl)
19157 (gcry_mac_algo_info, gcry_mac_setkey, gcry_mac_setiv, gcry_mac_write)
19158 (gcry_mac_read, gcry_mac_verify, gcry_mac_get_algo_maclen)
19159 (gcry_mac_get_algo_keylen, gcry_mac_algo_name, gcry_mac_map_name)
19160 (gcry_mac_reset, gcry_mac_test_algo): New.
19161 * src/libgcrypt.def (gcry_mac_open, gcry_mac_close, gcry_mac_ctl)
19162 (gcry_mac_algo_info, gcry_mac_setkey, gcry_mac_setiv, gcry_mac_write)
19163 (gcry_mac_read, gcry_mac_verify, gcry_mac_get_algo_maclen)
19164 (gcry_mac_get_algo_keylen, gcry_mac_algo_name, gcry_mac_map_name): New.
19165 * src/libgcrypt.vers (gcry_mac_open, gcry_mac_close, gcry_mac_ctl)
19166 (gcry_mac_algo_info, gcry_mac_setkey, gcry_mac_setiv, gcry_mac_write)
19167 (gcry_mac_read, gcry_mac_verify, gcry_mac_get_algo_maclen)
19168 (gcry_mac_get_algo_keylen, gcry_mac_algo_name, gcry_mac_map_name): New.
19169 * src/visibility.c (gcry_mac_open, gcry_mac_close, gcry_mac_ctl)
19170 (gcry_mac_algo_info, gcry_mac_setkey, gcry_mac_setiv, gcry_mac_write)
19171 (gcry_mac_read, gcry_mac_verify, gcry_mac_get_algo_maclen)
19172 (gcry_mac_get_algo_keylen, gcry_mac_algo_name, gcry_mac_map_name): New.
19173 * src/visibility.h (gcry_mac_open, gcry_mac_close, gcry_mac_ctl)
19174 (gcry_mac_algo_info, gcry_mac_setkey, gcry_mac_setiv, gcry_mac_write)
19175 (gcry_mac_read, gcry_mac_verify, gcry_mac_get_algo_maclen)
19176 (gcry_mac_get_algo_keylen, gcry_mac_algo_name, gcry_mac_map_name): New.
19177 * tests/basic.c (check_one_mac, check_mac): New.
19178 (main): Call 'check_mac'.
19179 * tests/bench-slope.c (bench_print_header, bench_print_footer): Allow
19180 variable algorithm name width.
19181 (_cipher_bench, hash_bench): Update to above change.
19182 (bench_hash_do_bench): Add 'gcry_md_reset'.
19183 (bench_mac_mode, bench_mac_init, bench_mac_free, bench_mac_do_bench)
19184 (mac_ops, mac_modes, mac_bench_one, _mac_bench, mac_bench): New.
19185 (main): Add 'mac' benchmark options.
19186 * tests/benchmark.c (mac_repetitions, mac_bench): New.
19187 (main): Add 'mac' benchmark options.
19188
19189 Use correct blocksize of 32 bytes for GOSTR3411-94 HMAC.
19190 + commit b95a557a43aeed68ea5e5ce02aca42ee97bfdb3b
19191 * cipher/md.c (md_open): Set macpads_Bsize to 32 for
19192 GCRY_MD_GOST24311_94.
19193
19194 2013-11-15 Jussi Kivilinna <[email protected]>
19195
19196 cipher: use size_t for internal buffer lengths.
19197 + commit b787657a9d2c1d8e19f9fcb0b21e31cb062630cf
19198 * cipher/arcfour.c (do_encrypt_stream, encrypt_stream): Use 'size_t'
19199 for buffer lengths.
19200 * cipher/blowfish.c (_gcry_blowfish_ctr_enc, _gcry_blowfish_cbc_dec)
19201 (_gcry_blowfish_cfb_dec): Ditto.
19202 * cipher/camellia-glue.c (_gcry_camellia_ctr_enc)
19203 (_gcry_camellia_cbc_dec, _gcry_blowfish_cfb_dec): Ditto.
19204 * cipher/cast5.c (_gcry_cast5_ctr_enc, _gcry_cast5_cbc_dec)
19205 (_gcry_cast5_cfb_dec): Ditto.
19206 * cipher/cipher-aeswrap.c (_gcry_cipher_aeswrap_encrypt)
19207 (_gcry_cipher_aeswrap_decrypt): Ditto.
19208 * cipher/cipher-cbc.c (_gcry_cipher_cbc_encrypt)
19209 (_gcry_cipher_cbc_decrypt): Ditto.
19210 * cipher/cipher-ccm.c (_gcry_cipher_ccm_encrypt)
19211 (_gcry_cipher_ccm_decrypt): Ditto.
19212 * cipher/cipher-cfb.c (_gcry_cipher_cfb_encrypt)
19213 (_gcry_cipher_cfb_decrypt): Ditto.
19214 * cipher/cipher-ctr.c (_gcry_cipher_ctr_encrypt): Ditto.
19215 * cipher/cipher-internal.h (gcry_cipher_handle->bulk)
19216 (_gcry_cipher_cbc_encrypt, _gcry_cipher_cbc_decrypt)
19217 (_gcry_cipher_cfb_encrypt, _gcry_cipher_cfb_decrypt)
19218 (_gcry_cipher_ofb_encrypt, _gcry_cipher_ctr_encrypt)
19219 (_gcry_cipher_aeswrap_encrypt, _gcry_cipher_aeswrap_decrypt)
19220 (_gcry_cipher_ccm_encrypt, _gcry_cipher_ccm_decrypt): Ditto.
19221 * cipher/cipher-ofb.c (_gcry_cipher_cbc_encrypt): Ditto.
19222 * cipher/cipher-selftest.h (gcry_cipher_bulk_cbc_dec_t)
19223 (gcry_cipher_bulk_cfb_dec_t, gcry_cipher_bulk_ctr_enc_t): Ditto.
19224 * cipher/cipher.c (cipher_setkey, cipher_setiv, do_ecb_crypt)
19225 (do_ecb_encrypt, do_ecb_decrypt, cipher_encrypt)
19226 (cipher_decrypt): Ditto.
19227 * cipher/rijndael.c (_gcry_aes_ctr_enc, _gcry_aes_cbc_dec)
19228 (_gcry_aes_cfb_dec, _gcry_aes_cbc_enc, _gcry_aes_cfb_enc): Ditto.
19229 * cipher/salsa20.c (salsa20_setiv, salsa20_do_encrypt_stream)
19230 (salsa20_encrypt_stream, salsa20r12_encrypt_stream): Ditto.
19231 * cipher/serpent.c (_gcry_serpent_ctr_enc, _gcry_serpent_cbc_dec)
19232 (_gcry_serpent_cfb_dec): Ditto.
19233 * cipher/twofish.c (_gcry_twofish_ctr_enc, _gcry_twofish_cbc_dec)
19234 (_gcry_twofish_cfb_dec): Ditto.
19235 * src/cipher-proto.h (gcry_cipher_stencrypt_t)
19236 (gcry_cipher_stdecrypt_t, cipher_setiv_fuct_t): Ditto.
19237 * src/cipher.h (_gcry_aes_cfb_enc, _gcry_aes_cfb_dec)
19238 (_gcry_aes_cbc_enc, _gcry_aes_cbc_dec, _gcry_aes_ctr_enc)
19239 (_gcry_blowfish_cfb_dec, _gcry_blowfish_cbc_dec)
19240 (_gcry_blowfish_ctr_enc, _gcry_cast5_cfb_dec, _gcry_cast5_cbc_dec)
19241 (_gcry_cast5_ctr_enc, _gcry_camellia_cfb_dec, _gcry_camellia_cbc_dec)
19242 (_gcry_camellia_ctr_enc, _gcry_serpent_cfb_dec, _gcry_serpent_cbc_dec)
19243 (_gcry_serpent_ctr_enc, _gcry_twofish_cfb_dec, _gcry_twofish_cbc_dec)
19244 (_gcry_twofish_ctr_enc): Ditto.
19245
19246 Camellia: Add AVX/AES-NI key setup.
19247 + commit ef9f52cbb39e46918c96200b09c21e931eff174f
19248 * cipher/camellia-aesni-avx-amd64.S (key_bitlength, key_table): New
19249 order of fields in ctx.
19250 (camellia_f, vec_rol128, vec_ror128): New macros.
19251 (__camellia_avx_setup128, __camellia_avx_setup256)
19252 (_gcry_camellia_aesni_avx_keygen): New functions.
19253 * cipher/camellia-aesni-avx2-amd64.S (key_bitlength, key_table): New
19254 order of fields in ctx.
19255 * cipher/camellia-arm.S (CAMELLIA_TABLE_BYTE_LEN, key_length): Remove
19256 unused macros.
19257 * cipher/camellia-glue.c (CAMELLIA_context): Move keytable to head for
19258 better alignment; Make 'use_aesni_avx' and 'use_aesni_avx2' bitfield
19259 members.
19260 [USE_AESNI_AVX] (_gcry_camellia_aesni_avx_keygen): New prototype.
19261 (camellia_setkey) [USE_AESNI_AVX || USE_AESNI_AVX2]: Read hw features
19262 to variable 'hwf' and match features from it.
19263 (camellia_setkey) [USE_AESNI_AVX]: Use AES-NI/AVX key setup if
19264 available.
19265
19266 Avoid unneeded stack burning with AES-NI and reduce number of 'decryption_prepared' checks
19267 + commit c8ad83fb605fdbf6dc0b0dbcc8aedfbd477640da
19268 * cipher/rijndael.c (RIJNDAEL_context): Make 'decryption_prepared',
19269 'use_padlock' and 'use_aesni' 1-bit members in bitfield.
19270 (do_setkey): Move 'hwfeatures' inside [USE_AESNI || USE_PADLOCK].
19271 (do_aesni_enc_aligned): Rename to...
19272 (do_aesni_enc): ...this, as function does not require aligned input.
19273 (do_aesni_dec_aligned): Rename to...
19274 (do_aesni_dec): ...this, as function does not require aligned input.
19275 (do_aesni): Remove.
19276 (rijndael_encrypt): Call 'do_aesni_enc' instead of 'do_aesni'.
19277 (rijndael_decrypt): Call 'do_aesni_dec' instead of 'do_aesni'.
19278 (check_decryption_preparation): New.
19279 (do_decrypt): Remove 'decryption_prepared' check.
19280 (rijndael_decrypt): Ditto and call 'check_decryption_preparation'.
19281 (_gcry_aes_cbc_dec): Ditto.
19282 (_gcry_aes_cfb_enc): Add 'burn_depth' and burn stack only when needed.
19283 (_gcry_aes_cbc_enc): Ditto.
19284 (_gcry_aes_ctr_enc): Ditto.
19285 (_gcry_aes_cfb_dec): Ditto.
19286 (_gcry_aes_cbc_dec): Ditto and correct clearing of 'savebuf'.
19287
19288 2013-11-14 Werner Koch <[email protected]>
19289
19290 md: Fix hashing for data >= 256 GB.
19291 + commit c43a8c0d81a711161f7a81b24ef7c33a1353eee0
19292 * cipher/hash-common.h (gcry_md_block_ctx): Add "nblocks_high".
19293 * cipher/hash-common.c (_gcry_md_block_write): Bump NBLOCKS_HIGH.
19294 * cipher/md4.c (md4_init, md4_final): Take care of NBLOCKS_HIGH.
19295 * cipher/md5.c (md5_init, md5_final): Ditto.
19296 * cipher/rmd160.c (_gcry_rmd160_init, rmd160_final): Ditto.
19297 * cipher/sha1.c (sha1_init, sha1_final): Ditto.
19298 * cipher/sha256.c (sha256_init, sha224_init, sha256_final): Ditto.
19299 * cipher/sha512.c (sha512_init, sha384_init, sha512_final): Ditto.
19300 * cipher/tiger.c (do_init, tiger_final): Ditto.
19301 * cipher/whirlpool.c (whirlpool_final): Ditto.
19302
19303 * cipher/md.c (gcry_md_algo_info): Add GCRYCTL_SELFTEST.
19304 (_gcry_md_selftest): Return "not implemented" as required.
19305 * tests/hashtest.c: New.
19306 * tests/genhashdata.c: New.
19307 * tests/Makefile.am (TESTS): Add hashtest.
19308 (noinst_PROGRAMS): Add genhashdata
19309
19310 2013-11-13 Christian Grothoff <[email protected]>
19311
19312 ecc: Fix key generation for a plain Ed25519 key.
19313 + commit 7d91e99bcd30a463dd4faed014b8521a663d8316
19314 * cipher/ecc.c (nist_generate_key): Use custom code for ED25519.
19315
19316 ecc: Fix some memory leaks.
19317 + commit c4f9af49f228df59c218381a25fa3c0f93ccbeae
19318 * cipher/ecc-curves.c (_gcry_mpi_ec_new): Free ec->b before assigning.
19319 * cipher/ecc.c (nist_generate_key): Release Q.
19320 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_genkey): Ditto.
19321
19322 2013-11-11 Werner Koch <[email protected]>
19323
19324 ecc: Change keygrip computation for Ed25519+EdDSA.
19325 + commit 4fb3c8e5a7fc6a1568f54bcc0be17fecf75e0742
19326 * cipher/ecc.c (compute_keygrip): Rework.
19327 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_ensure_compact): New.
19328 * cipher/ecc-curves.c (_gcry_ecc_update_curve_param): New.
19329 * tests/keygrip.c (key_grips): Add flag param and test cases for
19330 Ed25519.
19331
19332 mpi: Add special format GCRYMPI_FMT_OPAQUE.
19333 + commit 8b3eecee2d89179297e43de7d650f74759c61a58
19334 * src/gcrypt.h.in (GCRYMPI_FMT_OPAQUE): New.
19335 (_gcry_sexp_nth_opaque_mpi): Remove.
19336 * src/sexp.c (gcry_sexp_nth_mpi): Add support for GCRYMPI_FMT_OPAQUE.
19337 (_gcry_sexp_vextract_param): Replace removed function by
19338 GCRYMPI_FMT_OPAQUE.
19339
19340 2013-11-10 Jussi Kivilinna <[email protected]>
19341
19342 Fix error output in CTR selftest.
19343 + commit 7b26586e35a6d407ca31b41528b0810b1408fd4b
19344 * cipher/cipher-selftest.c (_gcry_selftest_helper_ctr): Change
19345 fprintf(stderr,...) to syslog(); Correct error output for bulk
19346 IV check, plaintext mismatch => ciphertext mismatch.
19347
19348 2013-11-09 Jussi Kivilinna <[email protected]>
19349
19350 Fix Serpent-AVX2 and Camellia-AVX2 counter modes.
19351 + commit df29831d008e32faf74091d080a415731418d158
19352 * cipher/camellia-aesni-avx2-amd64.S
19353 (_gcry_camellia_aesni_avx2_ctr_enc): Byte-swap before checking for
19354 overflow handling.
19355 * cipher/camellia-glue.c (selftest_ctr_128, selftest_cfb_128)
19356 (selftest_cbc_128): Add 16 to nblocks.
19357 * cipher/cipher-selftest.c (_gcry_selftest_helper_ctr): Add test with
19358 non-overflowing IV and modify overflow IV to detect broken endianness
19359 handling.
19360 * cipher/serpent-avx2-amd64.S (_gcry_serpent_avx2_ctr_enc): Byte-swap
19361 before checking for overflow handling; Fix crazy-mixed-endian IV
19362 construction to big-endian.
19363 * cipher/serpent.c (selftest_ctr_128, selftest_cfb_128)
19364 (selftest_cbc_128): Add 8 to nblocks.
19365
19366 2013-11-09 Sergey V <[email protected]>
19367
19368 cipher/gost28147: optimization: use precomputed S-box tables.
19369 + commit 51501b638546665163bbb85a14308fdb99211a28
19370 * cipher/gost.h (GOST28147_context): Remove unneeded subst and
19371 subst_set members.
19372 * cipher/gost28147.c (max): Remove unneeded macro.
19373 (test_sbox): Replace with new precomputed tables.
19374 (gost_set_subst): Remove function.
19375 (gost_val): Use new S-box tables.
19376 (gost_encrypt_block, gost_decrypt_block): Tweak to use new ctx and
19377 S-box tables.
19378
19379 2013-11-09 Jussi Kivilinna <[email protected]>
19380
19381 Fix tail handling for AES-NI counter mode.
19382 + commit 60ed0abbbc7cb15812f1e713143c72555acea69e
19383 * cipher/rijndael.c (do_aesni_ctr): Fix outputting of updated
19384 counter-IV.
19385
19386 2013-11-08 Werner Koch <[email protected]>
19387
19388 ecc: Improve gcry_pk_get_curve.
19389 + commit 03aed1acec611362285db5156a6b92c91604fba4
19390 * cipher/ecc-curves.c (_gcry_ecc_fill_in_curve): Factor some code out
19391 to ..
19392 (find_domain_parms_idx): new.
19393 (_gcry_ecc_get_curve): Find by curve name on error.
19394
19395 cipher: Avoid signed divisions in idea.c.
19396 + commit e241dde1420475459e32608137829e52748d0212
19397 * cipher/idea.c (mul_inv): Use unsigned division.
19398
19399 ecc: Implement the "nocomp" flag for key generation.
19400 + commit 9f63c0f7a3b2c15c7e258cd17395cabd0a8f00cc
19401 * cipher/ecc.c (ecc_generate): Support the "nocomp" flag.
19402 * tests/keygen.c (check_ecc_keys): Add a test for it.
19403
19404 ecc: Make "noparam" the default and replace by "param".
19405 + commit ed45fd2e60c88e2f005282e6eadd018b59dcf65b
19406 * src/cipher.h (PUBKEY_FLAG_NOCOMP): New.
19407 (PUBKEY_FLAG_NOPARAM): Remove.
19408 (PUBKEY_FLAG_PARAM): New.
19409 * cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist): Support the new
19410 flags and ignore the obsolete "noparam" flag.
19411 * cipher/ecc-curves.c (_gcry_ecc_fill_in_curve): Return the curve name
19412 also for curves selected by NBITS.
19413 (_gcry_mpi_ec_new): Support the "param" flag.
19414 * cipher/ecc.c (ecc_generate, ecc_sign, ecc_verify): Ditto.
19415 * tests/keygen.c (check_ecc_keys): Remove the "noparam" flag.
19416
19417 2013-11-07 Jussi Kivilinna <[email protected]>
19418
19419 Fix decryption function size in AES AMD64 assembly.
19420 + commit bfe4f6523b80bae0040328ef324b9000ee5b38a4
19421 * cipher/rijndael-amd64.S (_gcry_aes_amd64_decrypt_block): Set '.size'
19422 for '_gcry_aes_amd64_decrypt_block', not '..._encrypt_block'.
19423
19424 Change 64-bit shift to 32-bit in AES AMD64 assembly.
19425 + commit 57b296ea3a5204cd3711b7bf57c8fb14d8542402
19426 * cipher/rijndael-amd64.S (do16bit_shr): Change 'shrq' to 'shrl'.
19427
19428 2013-11-06 Jussi Kivilinna <[email protected]>
19429
19430 Speed-up AES-NI key setup.
19431 + commit f702d62d888b30e24c19f203566a1473098b2b31
19432 * cipher/rijndael.c [USE_AESNI] (m128i_t): Remove.
19433 [USE_AESNI] (u128_t): New.
19434 [USE_AESNI] (aesni_do_setkey): New.
19435 (do_setkey) [USE_AESNI]: Move AES-NI accelerated key setup to
19436 'aesni_do_setkey'.
19437 (do_setkey): Call _gcry_get_hw_features only once. Clear stack after
19438 use in generic key setup part.
19439 (rijndael_setkey): Remove stack burning.
19440 (prepare_decryption) [USE_AESNI]: Use 'u128_t' instead of 'm128i_t' to
19441 avoid compiler generated SSE2 instructions and XMM register usage,
19442 unroll 'aesimc' setup loop
19443 (prepare_decryption): Clear stack after use.
19444 [USE_AESNI] (do_aesni_enc_aligned): Update comment about alignment.
19445 (do_decrypt): Do not burning stack after prepare_decryption.
19446
19447 Avoid burn stack in Arcfour setkey.
19448 + commit a50a6ba3540f49fc7dcdb32e691327d5942e3509
19449 * cipher/arcfour.c (arcfour_setkey): Remove stack burning.
19450
19451 Avoid burn_stack in CAST5 setkey.
19452 + commit 5797ebc268b4e953cedd0c729c5cdb1f8fd764e4
19453 * cipher/cast5.c (do_cast_setkey): Use wipememory instead of memset.
19454 (cast_setkey): Remove stack burning.
19455
19456 Improve Serpent key setup speed.
19457 + commit 9897ccb381503455edc490679b2e9251a09ac5cb
19458 * cipher/serpent.c (SBOX, SBOX_INVERSE): Remove index argument.
19459 (serpent_subkeys_generate): Use smaller temporary arrays for subkey
19460 generation and perform stack clearing locally.
19461 (serpent_setkey_internal): Use wipememory to clear stack and remove
19462 _gcry_burn_stack.
19463 (serpent_setkey): Remove unneeded _gcry_burn_stack.
19464
19465 Modify encrypt/decrypt arguments for in-place.
19466 + commit b8515aa70b00baba3fba8121ed305edcd029c8c7
19467 * cipher/cipher.c (gcry_cipher_encrypt, gcry_cipher_decrypt): Modify
19468 local arguments if in-place operation.
19469
19470 Speed up Stribog.
19471 + commit a48d07ccadee4cb8b666a9a4ba2f00129bad5b2f
19472 * cipher/stribog.c (STRIBOG_TABLES): Remove.
19473 (Pi): Remove.
19474 [!STRIBOG_TABLES] (A, strido): Remove.
19475 (stribog_table): New table pre-reordered with Pi values.
19476 (strido): Rewrite for new table.
19477 (LPSX): Rewrite for new table.
19478 (xor): Remove.
19479 (g): Small tweaks.
19480
19481 Tweak AES-NI bulk CTR mode slightly.
19482 + commit 3b5058b58a183fa23ecf3ef819e2ae6ac64c0216
19483 * cipher/rijndael.c [USE_AESNI] (aesni_cleanup_2_5): Rename to...
19484 (aesni_cleanup_2_6): ...this and clear also 'xmm6'.
19485 [USE_AESNI && __i386__] (do_aesni_ctr, do_aesni_ctr_4): Prevent
19486 inlining only on i386, allow on AMD64.
19487 [USE_AESNI] (do_aesni_ctr, do_aesni_ctr_4): Use counter block from
19488 'xmm5' and byte-swap mask from 'xmm6'.
19489 (_gcry_aes_ctr_enc) [USE_AESNI]: Preload counter block to 'xmm5' and
19490 byte-swap mask to 'xmm6'.
19491 (_gcry_aes_ctr_enc, _gcry_aes_cfb_dec, _gcry_aes_cbc_dec): Use
19492 'aesni_cleanup_2_6'.
19493
19494 Tweak bench-slope parameters.
19495 + commit 7e98eecc1a955bc253765f92a166b6560f085b8c
19496 * tests/bench-slope.c (BUF_STEP_SIZE): Half step size to 64.
19497 (NUM_MEASUREMENT_REPETITIONS): Double repetitions to 64.
19498
19499 Optimize Blowfish weak key check.
19500 + commit 8e1c0f9b894c39b6554c544208dc000682f520c7
19501 * cipher/blowfish.c (hashset_elem, val_to_hidx, add_val): New.
19502 (do_bf_setkey): Use faster algorithm for detecting weak keys.
19503 (bf_setkey): Move stack burning to do_bf_setkey.
19504
19505 Fix __builtin_bswap32/64 checks.
19506 + commit 2590a5df6f5fc884614c8c379324027d2d61b9b5
19507 * configure.ac (gcry_cv_have_builtin_bswap32)
19508 (gcry_cv_have_builtin_bswap64): Change compile checks to link checks.
19509
19510 Fix 'u32' build error with Camellia.
19511 + commit 84bcb400e7db7268abfc29b5ab1513b0c063b293
19512 * cipher/camellia.c: Add include for <config.h> and "types.h".
19513 (u32): Remove.
19514 (u8): Typedef as 'byte'.
19515
19516 2013-11-06 Werner Koch <[email protected]>
19517
19518 pubkey: Add forward compatibility feature.
19519 + commit 6d169b654c7ff04c10f73afe80b2c70cefa410c1
19520 * cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist): Add
19521 "igninvflag".
19522
19523 2013-11-05 Werner Koch <[email protected]>
19524
19525 ecc: Require "eddsa" flag for curve Ed25519.
19526 + commit b9fd3988b54b50109f4e7179e7fe0739bb1d97c5
19527 * src/cipher.h (PUBKEY_FLAG_ECDSA): Remove.
19528 * cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist): Remove "ecdsa".
19529 * cipher/ecc.c (ecc_generate, ecc_sign, ecc_verify): Require "eddsa" flag.
19530 * cipher/ecc-misc.c (_gcry_ecc_compute_public): Depend "eddsa" flag.
19531 * tests/benchmark.c, tests/keygen.c, tests/pubkey.c
19532 * tests/t-ed25519.c, tests/t-mpi-point.c: Adjust for changed flags.
19533
19534 ecc: Fully implement Ed25519 compression in ECDSA mode.
19535 + commit f09ffe8a4802af65a116e79eceeb1cb4ed4fa2f4
19536 * src/ec-context.h (mpi_ec_ctx_s): Add field FLAGS.
19537 * mpi/ec.c (ec_p_init): Add arg FLAGS. Change all callers to pass it.
19538 * cipher/ecc-curves.c (point_from_keyparam): Add arg EC, parse as
19539 opaque mpi and use eddsa decoding depending on the flag.
19540 (_gcry_mpi_ec_new): Rearrange to parse Q and D after knowing the
19541 curve.
19542
19543 mpi: Add function gcry_mpi_set_opaque_copy.
19544 + commit 630aca794ddf057fb7265b7dc346374743036af4
19545 * src/gcrypt.h.in (gcry_mpi_set_opaque_copy): New.
19546 * src/visibility.c (gcry_mpi_set_opaque_copy): New.
19547 * src/visibility.h (gcry_mpi_set_opaque_copy): Mark visible.
19548 * src/libgcrypt.def, src/libgcrypt.vers: Add new API.
19549 * tests/mpitests.c (test_opaque): Add test.
19550
19551 2013-11-04 Jussi Kivilinna <[email protected]>
19552
19553 Make test vectors 'static const'
19554 + commit d50a88d1e29124d038196fec6082fd093e922604
19555 * cipher/arcfour.c (selftest): Change test vectors to 'static const'.
19556 * cipher/blowfish.c (selftest): Ditto.
19557 * cipher/camellia-glue.c (selftest): Ditto.
19558 * cipher/cast5.c (selftest): Ditto.
19559 * cipher/des.c (selftest): Ditto.
19560 * cipher/rijndael.c (selftest): Ditto.
19561 * tests/basic.c (cipher_cbc_mac_cipher, check_aes128_cbc_cts_cipher)
19562 (check_ctr_cipher, check_cfb_cipher, check_ofb_cipher)
19563 (check_ccm_cipher, check_stream_cipher)
19564 (check_stream_cipher_large_block, check_bulk_cipher_modes)
19565 (check_ciphers, check_digests, check_hmac, check_pubkey_sign)
19566 (check_pubkey_sign_ecdsa, check_pubkey_crypt, check_pubkey): Ditto.
19567
19568 2013-11-03 Jussi Kivilinna <[email protected]>
19569
19570 Make jump labels local in Salsa20 assembly.
19571 + commit d4697862266f3c96b6946dc92139dd8f3e81e5f6
19572 * cipher/salsa20-amd64.S: Rename '._labels' to '.L_labels'.
19573 * cipher/salsa20-armv7-neon.S: Ditto.
19574
19575 2013-10-30 Jussi Kivilinna <[email protected]>
19576
19577 bithelp: fix undefined behaviour with rol and ror.
19578 + commit d1cadd145199040299538891ab2ccd1208f7776e
19579 * cipher/bithelp.h (rol, ror): Mask shift with 31.
19580
19581 2013-10-29 Werner Koch <[email protected]>
19582
19583 tests: Add feature to skip benchmarks.
19584 + commit ba6bffafd17bea11985afc500022d66da261d59a
19585 * tests/benchmark.c (main): Add feature to skip the test.
19586 * tests/bench-slope.c (main): Ditto.
19587 (get_slope): Repace C++ style comment.
19588 (double_cmp, cipher_bench, _hash_bench): Repalce system reserved
19589 symbols.
19590
19591 ecc: Finish Ed25519/ECDSA hack.
19592 + commit c284f15db99e9cb135612de710199abb23baafd3
19593 * cipher/ecc.c (ecc_generate): Fix Ed25519/ECDSA case.
19594 (ecc_verify): Implement ED25519/ECDSA uncompression.
19595
19596 ecc: Add flags "noparam" and "comp".
19597 + commit ba892a0a874c8b2a83dbf0940608cd7e2911ce01
19598 * src/cipher.h (PUBKEY_FLAG_NOPARAM, PUBKEY_FLAG_COMP): New.
19599 * cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist): Parse new flags
19600 and change code for possible faster parsing.
19601 * cipher/ecc.c (ecc_generate): Implement the "noparam" flag.
19602 (ecc_sign): Ditto.
19603 (ecc_verify): Ditto.
19604 * tests/keygen.c (check_ecc_keys): Use the "noparam" flag.
19605
19606 * cipher/ecc.c (ecc_generate): Fix parsing of the deprecated
19607 transient-flag parameter.
19608 (ecc_verify): Do not make Q optional in the extract-param call.
19609
19610 2013-10-28 Jussi Kivilinna <[email protected]>
19611
19612 Fix typos in documentation.
19613 + commit 1faa61845f180bd47e037e400dde2d864ee83c89
19614 * doc/gcrypt.texi: Fix some typos.
19615
19616 Add ARM NEON assembly implementation of Serpent.
19617 + commit 2cb6e1f323d24359b1c5b113be5c2f79a2a4cded
19618 * cipher/Makefile.am: Add 'serpent-armv7-neon.S'.
19619 * cipher/serpent-armv7-neon.S: New.
19620 * cipher/serpent.c (USE_NEON): New macro.
19621 (serpent_context_t) [USE_NEON]: Add 'use_neon'.
19622 [USE_NEON] (_gcry_serpent_neon_ctr_enc, _gcry_serpent_neon_cfb_dec)
19623 (_gcry_serpent_neon_cbc_dec): New prototypes.
19624 (serpent_setkey_internal) [USE_NEON]: Detect NEON support.
19625 (_gcry_serpent_neon_ctr_enc, _gcry_serpent_neon_cfb_dec)
19626 (_gcry_serpent_neon_cbc_dec) [USE_NEON]: Use NEON implementations
19627 to process eight blocks in parallel.
19628 * configure.ac [neonsupport]: Add 'serpent-armv7-neon.lo'.
19629
19630 Add ARM NEON assembly implementation of Salsa20.
19631 + commit 3ff9d2571c18cd7a34359f9c60a10d3b0f932b23
19632 * cipher/Makefile.am: Add 'salsa20-armv7-neon.S'.
19633 * cipher/salsa20-armv7-neon.S: New.
19634 * cipher/salsa20.c [USE_ARM_NEON_ASM]: New macro.
19635 (struct SALSA20_context_s, salsa20_core_t, salsa20_keysetup_t)
19636 (salsa20_ivsetup_t): New.
19637 (SALSA20_context_t) [USE_ARM_NEON_ASM]: Add 'use_neon'.
19638 (SALSA20_context_t): Add 'keysetup', 'ivsetup' and 'core'.
19639 (salsa20_core): Change 'src' argument to 'ctx'.
19640 [USE_ARM_NEON_ASM] (_gcry_arm_neon_salsa20_encrypt): New prototype.
19641 [USE_ARM_NEON_ASM] (salsa20_core_neon, salsa20_keysetup_neon)
19642 (salsa20_ivsetup_neon): New.
19643 (salsa20_do_setkey): Setup keysetup, ivsetup and core with default
19644 functions.
19645 (salsa20_do_setkey) [USE_ARM_NEON_ASM]: When NEON support detect,
19646 set keysetup, ivsetup and core with ARM NEON functions.
19647 (salsa20_do_setkey): Call 'ctx->keysetup'.
19648 (salsa20_setiv): Call 'ctx->ivsetup'.
19649 (salsa20_do_encrypt_stream) [USE_ARM_NEON_ASM]: Process large buffers
19650 in ARM NEON implementation.
19651 (salsa20_do_encrypt_stream): Call 'ctx->core' instead of directly
19652 calling 'salsa20_core'.
19653 (selftest): Add test to check large buffer processing and block counter
19654 updating.
19655 * configure.ac [neonsupport]: 'Add salsa20-armv7-neon.lo'.
19656
19657 Add AMD64 assembly implementation of Salsa20.
19658 + commit 5a3d43485efdc09912be0967ee0a3ce345b3b15a
19659 * cipher/Makefile.am: Add 'salsa20-amd64.S'.
19660 * cipher/salsa20-amd64.S: New.
19661 * cipher/salsa20.c (USE_AMD64): New macro.
19662 [USE_AMD64] (_gcry_salsa20_amd64_keysetup, _gcry_salsa20_amd64_ivsetup)
19663 (_gcry_salsa20_amd64_encrypt_blocks): New prototypes.
19664 [USE_AMD64] (salsa20_keysetup, salsa20_ivsetup, salsa20_core): New.
19665 [!USE_AMD64] (salsa20_core): Change 'src' to non-constant, update block
19666 counter in 'salsa20_core' and return burn stack depth.
19667 [!USE_AMD64] (salsa20_keysetup, salsa20_ivsetup): New.
19668 (salsa20_do_setkey): Move generic key setup to 'salsa20_keysetup'.
19669 (salsa20_setkey): Fix burn stack depth.
19670 (salsa20_setiv): Move generic IV setup to 'salsa20_ivsetup'.
19671 (salsa20_do_encrypt_stream) [USE_AMD64]: Process large buffers in AMD64
19672 implementation.
19673 (salsa20_do_encrypt_stream): Move stack burning to this function...
19674 (salsa20_encrypt_stream, salsa20r12_encrypt_stream): ...from these
19675 functions.
19676 * configure.ac [x86-64]: Add 'salsa20-amd64.lo'.
19677
19678 Add new benchmarking utility, bench-slope.
19679 + commit e214e8392671dd30e9c33260717b5e756debf3bf
19680 * tests/Makefile.am (TESTS): Add 'bench-slope'.
19681 * tests/bench-slope.c: New.
19682
19683 Change .global to .globl in assembly files.
19684 + commit ebc8abfcb09d6106fcfce40f240a513e276f46e9
19685 * cipher/blowfish-arm.S: Change '.global' to '.globl'.
19686 * cipher/camellia-aesni-avx-amd64.S: Ditto.
19687 * cipher/camellia-aesni-avx2-amd64.S: Ditto.
19688 * cipher/camellia-arm.S: Ditto.
19689 * cipher/cast5-amd64.S: Ditto.
19690 * cipher/rijndael-amd64.S: Ditto.
19691 * cipher/rijndael-arm.S: Ditto.
19692 * cipher/serpent-avx2-amd64.S: Ditto.
19693 * cipher/serpent-sse2-amd64.S: Ditto.
19694 * cipher/twofish-amd64.S: Ditto.
19695 * cipher/twofish-arm.S: Ditto.
19696
19697 2013-10-26 Jussi Kivilinna <[email protected]>
19698
19699 Deduplicate code for ECB encryption and decryption.
19700 + commit 51f1beab3d1e879942a95f58b08de7dbcce75dce
19701 * cipher/cipher.c (do_ecb_crypt): New, based on old 'do_ecb_encrypt'.
19702 (do_ecb_encrypt): Use 'do_ecb_crypt', pass encryption function.
19703 (do_ecb_decrypt): Use 'do_ecb_crypt', pass decryption function.
19704
19705 2013-10-26 Dmitry Eremin-Solenikov <[email protected]>
19706
19707 Drop _gcry_cipher_ofb_decrypt as it duplicates _gcry_cipher_ofb_encrypt.
19708 + commit d9431725952e40f201c7eda000d3c8511ebd5b33
19709 * cipher/cipher.c (cipher_decrypt): Use _gcry_cipher_ofb_encrypt for OFB
19710 decryption.
19711 * cipher/cipher-internal.h: Remove _gcry_cipher_ofb_decrypt declaration.
19712 * cipher/cipher-ofb.c (_gcry_cipher_ofb_decrypt): Remove.
19713 (_gcry_cipher_ofb_encrypt): remove copying of IV to lastiv, it's
19714 unused there.
19715
19716 2013-10-25 Werner Koch <[email protected]>
19717
19718 tests: Add tests for mpi_cmp.
19719 + commit 6c6d4810927de7310ae7bac61b4ff5467d7cb485
19720 * tests/mpitests.c (die): Modernize.
19721 (fail): New.
19722 (test_opaque, test_add, test_sub, test_mul): Use gcry_log_xx
19723 (main): Return error count.
19724 (test_cmp): New.
19725
19726 2013-10-24 Werner Koch <[email protected]>
19727
19728 ecc: Change algorithm for Ed25519 x recovery.
19729 + commit c630fd71b336eb9209e914d24dc1e26a34521882
19730 * cipher/ecc-eddsa.c (scanval): Add as temporary hack.
19731 (_gcry_ecc_eddsa_recover_x): Use the algorithm from page 15 of the
19732 paper. Return an error code.
19733 (_gcry_ecc_eddsa_decodepoint): Take care of the error code.
19734 * mpi/mpi-mul.c (gcry_mpi_mulm): Use truncated division.
19735
19736 ecc: Refactor _gcry_ecc_eddsa_decodepoint.
19737 + commit 1cf5699b6febab1ef9d300531acc2ee33a7df739
19738 * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_decodepoint): Factor some code
19739 out to ..
19740 (_gcry_ecc_eddsa_recover_x): new.
19741
19742 2013-10-24 Jussi Kivilinna <[email protected]>
19743
19744 ecc-gost: Add missing include.
19745 + commit 9ce54e5b512418ddf45ce18f2cbd48cdced779f5
19746 * ecc-gost.c: Include "pubkey-internal.h".
19747
19748 2013-10-23 Jussi Kivilinna <[email protected]>
19749
19750 Replace architecture specific fast_wipememory2 with generic.
19751 + commit 54df6fcd806f8c150cffe6cc09925bb8b638bb5b
19752 * src/g10lib.h (fast_wipememory2): Remove architecture specific
19753 implementations and add generic implementation.
19754
19755 Improve the speed of the cipher mode code.
19756 + commit 293e93672fdabc829e35cc624c397276342bafe4
19757 * cipher/bufhelp.h (buf_cpy): New.
19758 (buf_xor, buf_xor_2dst): If buffers unaligned, always jump to per-byte
19759 processing.
19760 (buf_xor_n_copy_2): New.
19761 (buf_xor_n_copy): Use 'buf_xor_n_copy_2'.
19762 * cipher/blowfish.c (_gcry_blowfish_cbc_dec): Avoid extra memory copy
19763 and use new 'buf_xor_n_copy_2'.
19764 * cipher/camellia-glue.c (_gcry_camellia_cbc_dec): Ditto.
19765 * cipher/cast5.c (_gcry_cast_cbc_dec): Ditto.
19766 * cipher/serpent.c (_gcry_serpent_cbc_dec): Ditto.
19767 * cipher/twofish.c (_gcry_twofish_cbc_dec): Ditto.
19768 * cipher/rijndael.c (_gcry_aes_cbc_dec): Ditto.
19769 (do_encrypt, do_decrypt): Use 'buf_cpy' instead of 'memcpy'.
19770 (_gcry_aes_cbc_enc): Avoid copying IV, use 'last_iv' pointer instead.
19771 * cipher/cipher-cbc.c (_gcry_cipher_cbc_encrypt): Avoid copying IV,
19772 update pointer to IV instead.
19773 (_gcry_cipher_cbc_decrypt): Avoid extra memory copy and use new
19774 'buf_xor_n_copy_2'.
19775 (_gcry_cipher_cbc_encrypt, _gcry_cipher_cbc_decrypt): Avoid extra
19776 accesses to c->spec, use 'buf_cpy' instead of memcpy.
19777 * cipher/cipher-ccm.c (do_cbc_mac): Ditto.
19778 * cipher/cipher-cfb.c (_gcry_cipher_cfb_encrypt)
19779 (_gcry_cipher_cfb_decrypt): Ditto.
19780 * cipher/cipher-ctr.c (_gcry_cipher_ctr_encrypt): Ditto.
19781 * cipher/cipher-ofb.c (_gcry_cipher_ofb_encrypt)
19782 (_gcry_cipher_ofb_decrypt): Ditto.
19783 * cipher/cipher.c (do_ecb_encrypt, do_ecb_decrypt): Ditto.
19784
19785 bufhelp: enable unaligned memory accesses for AArch64 (64-bit ARM)
19786 + commit 2901a10dbf1264707debc8402546c07eeac60932
19787 * cipher/bufhelp.h [__aarch64__] (BUFHELP_FAST_UNALIGNED_ACCESS): Set
19788 macro on AArch64.
19789
19790 2013-10-23 Dmitry Eremin-Solenikov <[email protected]>
19791
19792 Enable assembler optimizations on earlier ARM cores.
19793 + commit 2fd83faa876d0be91ab7884b1a9eaa7793559eb9
19794 * cipher/blowfish-armv6.S => cipher/blowfish-arm.S: adapt to pre-armv6 CPUs.
19795 * cipher/blowfish.c: enable assembly on armv4/armv5 little-endian CPUs.
19796 * cipher/camellia-armv6.S => cipher/camellia-arm.S: adapt to pre-armv6 CPUs.
19797 * cipher/camellia.c, cipher-camellia-glue.c: enable assembly on armv4/armv5
19798 little-endian CPUs.
19799 * cipher/cast5-armv6.S => cipher/cast5-arm.S: adapt to pre-armv6 CPUs.
19800 * cipher/cast5.c: enable assembly on armv4/armv5 little-endian CPUs.
19801 * cipher/rijndael-armv6.S => cipher/rijndael-arm.S: adapt to pre-armv6 CPUs.
19802 * cipher/rijndael.c: enable assembly on armv4/armv5 little-endian CPUs.
19803 * cipher/twofish-armv6.S => cipher/twofish-arm.S: adapt to pre-armv6 CPUs.
19804 * cipher/twofish.c: enable assembly on armv4/armv5 little-endian CPUs.
19805
19806 mpi: enable assembler on all arm architectures.
19807 + commit 0b39fce7e3ce6761d6bd5195d093ec6857edb7c2
19808 * mpi/config.links: remove check for arm >= v6
19809 * mpi/armv6 => mpi/arm: rename directory to reflect that is is generic
19810 enough
19811
19812 Correct ASM assembly test in configure.ac.
19813 + commit 10bf6a7e16ed193f90d2749970a420f00d1d3320
19814 * configure.ac: correct HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS test to
19815 require neither ARMv6, nor thumb mode. Our assembly code works
19816 perfectly even on ARMv4 now.
19817
19818 2013-10-23 Werner Koch <[email protected]>
19819
19820 ecc: Refactor ecc.c.
19821 + commit 164eb8c85d773ef4f0939115ec45f5e4b47c1700
19822 * cipher/ecc-ecdsa.c, cipher/ecc-eddsa.c, cipher/ecc-gost.c: New.
19823 * cipher/Makefile.am (EXTRA_libcipher_la_SOURCES): Add new files.
19824 * configure.ac (GCRYPT_PUBKEY_CIPHERS): Add new files.
19825 * cipher/ecc.c (point_init, point_free): Move to ecc-common.h.
19826 (sign_ecdsa): Move to ecc-ecdsa.c as _gcry_ecc_ecdsa_sign.
19827 (verify_ecdsa): Move to ecc-ecdsa.c as _gcry_ecc_ecdsa_verify.
19828 (sign_gost): Move to ecc-gots.c as _gcry_ecc_gost_sign.
19829 (verify_gost): Move to ecc-gost.c as _gcry_ecc_gost_verify.
19830 (sign_eddsa): Move to ecc-eddsa.c as _gcry_ecc_eddsa_sign.
19831 (verify_eddsa): Move to ecc-eddsa.c as _gcry_ecc_eddsa_verify.
19832 (eddsa_generate_key): Move to ecc-eddsa.c as _gcry_ecc_eddsa_genkey.
19833 (reverse_buffer): Move to ecc-eddsa.c.
19834 (eddsa_encodempi, eddsa_encode_x_y): Ditto.
19835 (_gcry_ecc_eddsa_encodepoint, _gcry_ecc_eddsa_decodepoint): Ditto.
19836
19837 mpi: Fix scanning of negative SSH formats and add more tests.
19838 + commit 45f6e6268bfdc4b608beaba6b7086b2286e33c71
19839 * mpi/mpicoder.c (gcry_mpi_scan): Fix sign setting for SSH format.
19840 * tests/t-convert.c (negative_zero): Test all formats.
19841 (check_formats): Add tests for PGP and scan tests for SSH and USG.
19842
19843 * src/gcrypt.h.in (mpi_is_neg): Fix macro.
19844
19845 * mpi/mpi-scan.c (_gcry_mpi_getbyte, _gcry_mpi_putbyte): Comment out
19846 these unused functions.
19847
19848 2013-10-22 Jussi Kivilinna <[email protected]>
19849
19850 twofish: add ARMv6 assembly implementation.
19851 + commit 98674fdaa30ab22a3ac86ca05d688b5b6112895d
19852 * cipher/Makefile.am: Add 'twofish-armv6.S'.
19853 * cipher/twofish-armv6.S: New.
19854 * cipher/twofish.c (USE_ARMV6_ASM): New macro.
19855 [USE_ARMV6_ASM] (_gcry_twofish_armv6_encrypt_block)
19856 (_gcry_twofish_armv6_decrypt_block): New prototypes.
19857 [USE_AMDV6_ASM] (twofish_encrypt, twofish_decrypt): Add.
19858 [USE_AMD64_ASM] (do_twofish_encrypt, do_twofish_decrypt): Remove.
19859 (_gcry_twofish_ctr_enc, _gcry_twofish_cfb_dec): Use 'twofish_encrypt'
19860 instead of 'do_twofish_encrypt'.
19861 (_gcry_twofish_cbc_dec): Use 'twofish_decrypt' instead of
19862 'do_twofish_decrypt'.
19863 * configure.ac [arm]: Add 'twofish-armv6.lo'.
19864
19865 mpi: allow building with clang on ARM.
19866 + commit e67c67321ce240c93dd0fa2b21c649c0a8e233f7
19867 * mpi/longlong.h [__arm__] (add_ssaaaa, sub_ddmmss, umul_ppmm)
19868 (count_leading_zeros): Do not cast assembly output arguments.
19869 [__arm__] (umul_ppmm): Remove the extra '%' ahead of assembly comment.
19870 [_ARM_ARCH >= 4] (umul_ppmm): Use correct inputs and outputs instead of
19871 registers.
19872
19873 serpent-amd64: do not use GAS macros.
19874 + commit c7efaa5fe0ee92e321a7b49d56752cc12eb75fe0
19875 * cipher/serpent-avx2-amd64.S: Remove use of GAS macros.
19876 * cipher/serpent-sse2-amd64.S: Ditto.
19877 * configure.ac [HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS]: Do not check
19878 for GAS macros.
19879
19880 Add Counter with CBC-MAC mode (CCM)
19881 + commit 335d9bf7b035815750b63a3a8334d6ce44dc4449
19882 * cipher/Makefile.am: Add 'cipher-ccm.c'.
19883 * cipher/cipher-ccm.c: New.
19884 * cipher/cipher-internal.h (gcry_cipher_handle): Add 'u_mode'.
19885 (_gcry_cipher_ccm_encrypt, _gcry_cipher_ccm_decrypt)
19886 (_gcry_cipher_ccm_set_nonce, _gcry_cipher_ccm_authenticate)
19887 (_gcry_cipher_ccm_get_tag, _gcry_cipher_ccm_check_tag)
19888 (_gcry_cipher_ccm_set_lengths): New prototypes.
19889 * cipher/cipher.c (gcry_cipher_open, cipher_encrypt, cipher_decrypt)
19890 (_gcry_cipher_setiv, _gcry_cipher_authenticate, _gcry_cipher_gettag)
19891 (_gcry_cipher_checktag, gry_cipher_ctl): Add handling for CCM mode.
19892 * doc/gcrypt.texi: Add documentation for GCRY_CIPHER_MODE_CCM.
19893 * src/gcrypt.h.in (gcry_cipher_modes): Add 'GCRY_CIPHER_MODE_CCM'.
19894 (gcry_ctl_cmds): Add 'GCRYCTL_SET_CCM_LENGTHS'.
19895 (GCRY_CCM_BLOCK_LEN): New.
19896 * tests/basic.c (check_ccm_cipher): New.
19897 (check_cipher_modes): Call 'check_ccm_cipher'.
19898 * tests/benchmark.c (ccm_aead_init): New.
19899 (cipher_bench): Add handling for AEAD modes and add CCM benchmarking.
19900
19901 Add API to support AEAD cipher modes.
19902 + commit 95654041f2aa62f71aac4d8614dafe8433d10f95
19903 * cipher/cipher.c (_gcry_cipher_authenticate, _gcry_cipher_checktag)
19904 (_gcry_cipher_gettag): New.
19905 * doc/gcrypt.texi: Add documentation for new API functions.
19906 * src/visibility.c (gcry_cipher_authenticate, gcry_cipher_checktag)
19907 (gcry_cipher_gettag): New.
19908 * src/gcrypt.h.in, src/visibility.h: add declarations of these
19909 functions.
19910 * src/libgcrypt.defs, src/libgcrypt.vers: export functions.
19911
19912 2013-10-22 NIIBE Yutaka <[email protected]>
19913
19914 ecc: Correct compliant key generation for Edwards curves.
19915 + commit a5a277a9016ccb34f1858a65e0ed1791b2fc3db3
19916 * cipher/ecc.c: Add case for Edwards curves.
19917
19918 2013-10-17 Werner Koch <[email protected]>
19919
19920 tests: Add test options to keygen.
19921 + commit f7711e6eb5f02d03c74911f6f037ab28075e7c0d
19922 * tests/keygen.c (usage): New.
19923 (main): Print usage info. Allow running just one algo.
19924
19925 mpi: Do not clear the sign of the mpi_mod result.
19926 + commit 91e007606f1f6f8e1416c403fe809d47fddf9b1f
19927 * mpi/mpi-mod.c (_gcry_mpi_mod): Remove sign setting.
19928
19929 ecc: Put the curve name again into the output of gcry_pk_genkey.
19930 + commit 4776dcd394ce59fa50d959921857b3427c5a63c8
19931 * cipher/ecc.c (ecc_generate): Use the correct var. Release
19932 CURVE_FLAGS.
19933
19934 ecc: Support Weierstrass curves in gcry_mpi_ec_curve_point.
19935 + commit b22417158c50ec3a0b2ff55b4ade063b42a87e8f
19936 * mpi/ec.c (_gcry_mpi_ec_curve_point): Support MPI_EC_WEIERSTRASS.
19937
19938 2013-10-16 Jussi Kivilinna <[email protected]>
19939
19940 arcfour: more optimized version for non-i386 architectures.
19941 + commit f9371c026aad09ff48746d22c8333746c886e773
19942 * cipher/arcfour.c (ARCFOUR_context): Reorder members.
19943 (do_encrypt_stream) [!__i386__]: Faster implementation for non-i386.
19944 (do_arcfour_setkey): Avoid modulo operations.
19945
19946 Avoid void* pointer arithmetic.
19947 + commit c89ab921ccfaefe6c4f6a724d01e0df41a1a381f
19948 * tests/tsexp.c (check_extract_param): Cast void* pointers to char*
19949 before doing arithmetics.
19950
19951 2013-10-16 Dmitry Eremin-Solenikov <[email protected]>
19952
19953 ecc: Add support for GOST R 34.10-2001/-2012 signatures.
19954 + commit 83902f1f1dbc8263a0c3f61be59cd2eb95293c97
19955 * src/cipher.h: define PUBKEY_FLAG_GOST
19956 * cipher/ecc-curves.c: Add GOST2001-test and GOST2012-test curves
19957 defined in standards. Typical applications would use either those
19958 curves, or curves defined in RFC 4357 (will be added later).
19959 * cipher/ecc.c (sign_gost, verify_gost): New.
19960 (ecc_sign, ecc_verify): use sign_gost/verify_gost if PUBKEY_FLAG_GOST
19961 is set.
19962 (ecc_names): add "gost" for gost signatures.
19963 * cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist,
19964 _gcry_pk_util_preparse_sigval): set PUBKEY_FLAG_GOST if gost flag
19965 is present in s-exp.
19966 * tests/benchmark.c (ecc_bench): also benchmark GOST signatures.
19967 * tests/basic.c (check_pubkey): add two public keys from
19968 GOST R 34.10-2012 standard.
19969 (check_pubkey_sign_ecdsa): add two data sets to check gost signatures.
19970 * tests/curves.c: correct N_CURVES as we now have 2 more curves.
19971
19972
19973 Removed some comments from the new curve definitions in ecc-curves.c
19974 to avoid line wrapping. Eventually we will develop a precompiler to
19975 avoid parsing those hex strings. -wk
19976
19977 Fix 256-bit ecdsa test key definition.
19978 + commit 187b2bb541b985255aee262d181434a7cb4ae2e7
19979 * tests/basic.c (check_pubkey): fix nistp256 testing key declaration -
19980 add missing comma.
19981
19982 2013-10-16 Werner Koch <[email protected]>
19983
19984 sexp: Add function gcry_sexp_extract_param.
19985 + commit a329b6abf00c990faf1986f9fbad7b4d71c13bcb
19986 * src/gcrypt.h.in (_GCRY_GCC_ATTR_SENTINEL): New.
19987 (gcry_sexp_extract_param): New.
19988 * src/visibility.c (gcry_sexp_extract_param): New.
19989 * src/visibility.h (gcry_sexp_extract_param): Add hack to detect
19990 internal use.
19991 * cipher/pubkey-util.c (_gcry_pk_util_extract_mpis): Move and split
19992 into ...
19993 * src/sexp.c (_gcry_sexp_vextract_param)
19994 (_gcry_sexp_extract_param): this. Change all callers. Add support for buffer
19995 descriptors and a path option/
19996
19997 * tests/tsexp.c (die, hex2buffer, hex2mpi, hex2mpiopa): New.
19998 (cmp_mpihex, cmp_bufhex): New.
19999 (check_extract_param): New.
20000
20001 2013-10-16 NIIBE Yutaka <[email protected]>
20002
20003 mpi: mpi-pow improvement.
20004 + commit 45aa6131e93fac89d46733b3436d960f35fb99b2
20005 * mpi/mpi-pow.c (gcry_mpi_powm): New implementation of left-to-right
20006 k-ary exponentiation.
20007
20008 2013-10-15 Werner Koch <[email protected]>
20009
20010 ecc: Support use of Ed25519 with ECDSA.
20011 + commit 537969fbbb1104b8305a7edb331b7666d54eff2c
20012 * src/cipher.h (PUBKEY_FLAG_ECDSA): New.
20013 * cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist): Add flag "ecdsa".
20014 * cipher/ecc.c (verify_ecdsa, verify_eddsa): Remove some debug output.
20015 (ecc_generate, ecc_sign, ecc_verify): Support Ed25519 with ECDSA.
20016 * tests/keygen.c (check_ecc_keys): Create such a test key.
20017 * tests/pubkey.c (fail, info, data_from_hex, extract_cmp_data): New.
20018 Take from dsa-6979.c
20019 (check_ed25519ecdsa_sample_key): new.
20020 (main): Call new test.
20021
20022 2013-10-14 Werner Koch <[email protected]>
20023
20024 pubkey: Support flags list in gcry_pk_genkey.
20025 + commit d3a605d7827b8a73ef844e9e5183590bd6b1389a
20026 * src/cipher.h (PUBKEY_FLAG_TRANSIENT_KEY): New.
20027 (PUBKEY_FLAG_USE_X931): New.
20028 (PUBKEY_FLAG_USE_FIPS186): New.
20029 (PUBKEY_FLAG_USE_FIPS186_2): New.
20030 * cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist): Rename from
20031 parse_flags_list. Parse new flags.
20032 * cipher/dsa.c (dsa_generate): Support flag list.
20033 * cipher/ecc.c (ecc_generate): Ditto.
20034 * cipher/rsa.c (rsa_generate): Ditto.
20035
20036 pubkey: Remove duplicated flag parsing code.
20037 + commit 5be2345ddec4147e535d5b039ee74f84bcacf9e4
20038 * cipher/pubkey-util.c (_gcry_pk_util_preparse_encval)
20039 (_gcry_pk_util_data_to_mpi): Factor flag parsing code out to ..
20040 (parse_flag_list): New.
20041 * src/cipher.h (PUBKEY_FLAG_RAW_FLAG): New.
20042
20043 mpicalc: Accept lowercase hex digits.
20044 + commit 0cd551faa775ad5309a40629ae30bf86b75fca09
20045 * src/mpicalc.c (main): Test for lowercase hex digits.
20046
20047 2013-10-11 Werner Koch <[email protected]>
20048
20049 pubkey: Move sexp parsing of remaining fucntions to the modules.
20050 + commit a951c061523e1c13f1358c9760fc3a9d787ab2d4
20051 * cipher/pubkey.c (release_mpi_array): Remove.
20052 (pubkey_check_secret_key): Remove.
20053 (sexp_elements_extract): Remove.
20054 (sexp_elements_extract_ecc): Remove.
20055 (sexp_to_key): Remove.
20056 (get_hash_algo): Remove.
20057 (gcry_pk_testkey): Revamp.
20058 (gcry_pk_get_curve): Revamp.
20059 * cipher/rsa.c (rsa_check_secret_key): Revamp.
20060 * cipher/elgamal.c (elg_check_secret_key): Revamp.
20061 * cipher/dsa.c (dsa_check_secret_key): Revamp.
20062 * cipher/ecc.c (ecc_check_secret_key): Revamp.
20063 * cipher/ecc-curves.c: Include cipher.h and pubkey-internal.h
20064 (_gcry_ecc_get_curve): Revamp.
20065
20066 * cipher/pubkey-util.c (_gcry_pk_util_extract_mpis): Set passed and
20067 used parameters on error to NULL.
20068
20069 pubkey: Move sexp parsing for gcry_pk_decrypt to the modules.
20070 + commit 07950c865a901afc48acb46f0695040cadfd5068
20071 * cipher/rsa.c (rsa_decrypt): Revamp.
20072 * cipher/elgamal.c (elg_decrypt): Revamp.
20073 * cipher/ecc.c (ecc_decrypt_raw): Revamp.
20074 * cipher/pubkey.c (gcry_pk_decrypt): Simplify.
20075 (sexp_to_enc): Remove.
20076 * cipher/pubkey-util.c (_gcry_pk_util_preparse_encval): New.
20077
20078 pubkey: Move sexp parsing for gcry_pk_encrypt to the modules.
20079 + commit 6bd5d18c45a4a3ce8f0f66f56c83b80594877f53
20080 * cipher/rsa.c (rsa_encrypt): Revamp.
20081 * cipher/elgamal.c (elg_encrypt): Revamp.
20082 * cipher/ecc.c (ecc_encrypt_raw): Revamp.
20083 * cipher/pubkey.c (gcry_pk_encrypt): Simplify.
20084
20085 * tests/basic.c (check_pubkey_crypt): Init plain, ciph, and data so
20086 that they are initialized even after an encrypt failure.
20087
20088 pubkey: Move sexp parsing for gcry_pk_sign to the modules.
20089 + commit d0ae6635e4e6ae273c3a137c513d518f28f6eab3
20090 * cipher/rsa.c (rsa_sign): Revamp.
20091 * cipher/dsa.c (dsa_sign): Revamp.
20092 * cipher/elgamal.c (elg_sign): Revamp.
20093 * cipher/ecc.c (ecc_sign): Revamp.
20094 * cipher/pubkey.c (gcry_pk_sign): Simplify.
20095
20096 2013-10-10 Jussi Kivilinna <[email protected]>
20097
20098 Prevent tail call optimization with _gcry_burn_stack.
20099 + commit 150c0313f971bcea62d2802f0389c883e11ebb31
20100 * configure.ac: New check, HAVE_GCC_ASM_VOLATILE_MEMORY.
20101 * src/g10lib.h (_gcry_burn_stack): Rename to __gcry_burn_stack.
20102 (__gcry_burn_stack_dummy): New.
20103 (_gcry_burn_stack): New macro.
20104 * src/misc.c (_gcry_burn_stack): Rename to __gcry_burn_stack.
20105 (__gcry_burn_stack_dummy): New.
20106
20107 2013-10-09 Werner Koch <[email protected]>
20108
20109 pubkey: Move sexp parsing for gcry_pk_verify to the modules.
20110 + commit 94b652ecb006c29fa2ffb1badc9f02b758581737
20111 * cipher/rsa.c (rsa_verify): Revamp.
20112 * cipher/dsa.c (dsa_verify): Revamp.
20113 * cipher/elgamal.c (elg_verify): Revamp.
20114 * cipher/ecc.c (ecc_verify): Revamp.
20115 * cipher/pubkey.c (sexp_to_sig): Remove.
20116 (pss_verify_cmp): Move to pubkey-util.c
20117 (sexp_data_to_mpi): Ditto.
20118 (init_encoding_ctx): Ditto.
20119 (gcry_pk_verify): Simplify.
20120 * cipher/pubkey-util.c (_gcry_pk_util_init_encoding_ctx): Add. Take
20121 from pubkey.c
20122 (get_hash_algo): Ditto.
20123 (_gcry_pk_util_data_to_mpi): Ditto.
20124 (pss_verify_cmp): Ditto.
20125 (_gcry_pk_util_extract_mpis): New.
20126 (_gcry_pk_util_preparse_sigval): New.
20127 (_gcry_pk_util_free_encoding_ctx): New.
20128 * cipher/ecc-curves.c (_gcry_ecc_fill_in_curve): Make curve init
20129 optional.
20130
20131 * src/g10lib.h (GCC_ATTR_SENTINEL): New.
20132
20133 * tests/basic.c (check_pubkey_sign): Print the algo name.
20134 (main): Add option --pubkey.
20135
20136 2013-10-08 Werner Koch <[email protected]>
20137
20138 pubkey: Move sexp parsing for gcry_pk_get_nbits to the modules.
20139 + commit 4645f3728bb0900591b0aef85831fdee52c59e3c
20140 * cipher/pubkey.c (spec_from_sexp): New.
20141 (gcry_pk_get_nbits): Simplify.
20142 * cipher/rsa.c (rsa_get_nbits): Take only PARMS as args and do sexp
20143 parsing here.
20144 * cipher/dsa.c (dsa_get_nbits): Ditto.
20145 * cipher/elgamal.c (elg_get_nbits): Ditto.
20146 * cipher/ecc.c (ecc_get_nbits): Ditto.
20147 * cipher/ecc-curves.c (_gcry_ecc_fill_in_curve): Allow NULL for arg
20148 CURVE.
20149
20150 pubkey: Move sexp parsing for gcry_pk_getkey to the modules.
20151 + commit 3816e46ce211e63adf46dbc775510aa137572248
20152 * cipher/pubkey-util.c: New.
20153 (_gcry_pk_util_get_nbits): New. Based on code from gcry_pk_genkey.
20154 (_gcry_pk_util_get_rsa_use_e): Ditto.
20155 * cipher/pubkey.c (gcry_pk_genkey): Strip most code and pass.
20156 * cipher/rsa.c (rsa_generate): Remove args ALGO, NBITS and EVALUE.
20157 Call new fucntions to get these values.
20158 * cipher/dsa.c (dsa_generate): Remove args ALGO, NBITS and EVALUE.
20159 Call _gcry_pk_util_get_nbits to get nbits. Always parse genparms.
20160 * cipher/elgamal.c (elg_generate): Ditto.
20161 * cipher/ecc.c (ecc_generate): Ditto.
20162
20163 cipher: Deprecate GCRY_PK_ELG_E.
20164 + commit f79d3e13d3229115c47cbe5007647cb44105fe3f
20165 * cipher/elgamal.c (_gcry_pubkey_spec_elg_e): Remove.
20166 * cipher/pubkey.c (pubkey_list): Remove double included
20167 _gcry_pubkey_spec_elg.
20168 (map_algo): MAke ELG_E to ELG.
20169
20170 2013-10-02 Werner Koch <[email protected]>
20171
20172 Provide Pth compatiblity for use with GnuPG 2.0.
20173 + commit 2f767f6a17f7e99da4075882f7fe3ca597b31bdb
20174 * src/ath.c (ath_install): Call ath_init and declare Pth as
20175 compatible.
20176
20177 2013-10-02 Jussi Kivilinna <[email protected]>
20178
20179 sha512: fix building on ARM.
20180 + commit 6410152338a2b2ac1216e70c153cd16f9199c94e
20181 * cipher/sha512.c (transform) [USE_ARM_NEON_ASM]: Fix 'hd' to 'ctx'.
20182
20183 2013-10-02 Werner Koch <[email protected]>
20184
20185 Remove deprecated control codes.
20186 + commit f04a1db22d982627ba87da4e5df52df9b994c779
20187 * src/gcrypt.h.in (GCRYCTL_SET_KEY): Remove.
20188 (GCRYCTL_SET_IV): Remove.
20189 (GCRYCTL_SET_CTR): Remove.
20190 * cipher/md.c (gcry_md_ctl): Remove deprecated GCRYCTL_SET_KEY.
20191 * cipher/cipher.c (gcry_cipher_ctl): Remove deprecated
20192 GCRYCTL_SET_KEY, GCRYCTL_SET_IV, GCRYCTL_SET_CTR.
20193
20194 2013-10-02 Dmitry Eremin-Solenikov <[email protected]>
20195
20196 Fix errors when building with Clang on PPC.
20197 + commit 33757c1e03f1d885920633edf543cd1c77999455
20198 * mpi/longlong.h (add_ssaaaa, sub_ddmmss, count_leading_zeros,
20199 umul_ppmm): Do not cast asm output to USItype.
20200
20201 2013-10-02 Werner Koch <[email protected]>
20202
20203 Remove last remains of the former module system.
20204 + commit 628ed5ba0ef4b1f04b5a77e29e4bc49a1fe13c07
20205 * src/gcrypt-module.h, src/module.c: Remove.
20206 * src/visibility.h: Do not include gcrypt-module.h.
20207 * src/g10lib.h: Remove all prototypes from module.c
20208 (gcry_module): Remove.
20209 * cipher/cipher-internal.h (gcry_cipher_handle): Remove unused field.
20210
20211 Fix missing prototype warning in visibility.c.
20212 + commit 52783d483293d48cd468143ae6ae2cccbfe17200
20213 * src/ec-context.h (_gcry_mpi_ec_new): Move prototype to mpi.h.
20214
20215 md: Simplify the message digest dispatcher md.c.
20216 + commit 0d39997932617ba20656f8bcc230ba744b76c87e
20217 * src/gcrypt-module.h (gcry_md_spec_t): Move to ...
20218 * src/cipher-proto.h: here. Merge with md_extra_spec_t. Add fields
20219 ALGO and FLAGS. Set these fields in all digest modules.
20220 * cipher/md.c: Change most code to replace the former module
20221 system by a simpler system to gain information about the algorithms.
20222
20223 2013-10-01 Werner Koch <[email protected]>
20224
20225 cipher: Simplify the cipher dispatcher cipher.c.
20226 + commit 3ca180b25e8df252fc16f802cfdc27496e307830
20227 * src/gcrypt-module.h (gcry_cipher_spec_t): Move to ...
20228 * src/cipher-proto.h (gcry_cipher_spec_t): here. Merge with
20229 cipher_extra_spec_t. Add fields ALGO and FLAGS. Set these fields in
20230 all cipher modules.
20231 * cipher/cipher.c: Change most code to replace the former module
20232 system by a simpler system to gain information about the algorithms.
20233 (disable_pubkey_algo): Simplified. Not anymore thread-safe, though.
20234
20235 * cipher/md.c (_gcry_md_selftest): Use correct structure. Not a real
20236 problem because both define the same function as their first field.
20237
20238 * cipher/pubkey.c (_gcry_pk_selftest): Take care of the disabled flag.
20239
20240 mpi: Fix gcry_mpi_neg.
20241 + commit 4153fa859816e799e506055321a22e6450aacdcc
20242 * mpi/mpiutil.c (_gcry_mpi_neg): Copy U to W.
20243
20244 2013-10-01 Peter Wu <[email protected]>
20245
20246 cipher: Add support for 128-bit keys in RC2.
20247 + commit 738177ec0eae05069ec61bc4f724a69d4e052e42
20248 * cipher/rfc2268.c (oids_rfc2268_128): New
20249 (_gcry_cipher_spec_rfc2268_128): New.
20250 * cipher/cipher.c (cipher_table_entry): Add GCRY_CIPHER_RFC2268_128.
20251
20252 2013-09-30 Werner Koch <[email protected]>
20253
20254 ecc: Use faster b parameter for Ed25519.
20255 + commit 1d85452412b65e7976bc94969fc513ff6b880ed8
20256 * cipher/ecc-curves.c (domain_parms): Replace b.
20257 * tests/t-mpi-point.c (test_curve): Ditto.
20258
20259 ecc: Prepare for future Ed25519 optimization.
20260 + commit a2618c822e666d4121cba29bee3fd50bf70c9743
20261 * mpi/ec-ed25519.c: New but empty file.
20262 * mpi/ec-internal.h: New.
20263 * mpi/ec.c: Include ec-internal.h.
20264 (ec_mod): New.
20265 (ec_addm): Use ec_mod.
20266 (ec_mulm): Remove commented code. Use ec_mod.
20267 (ec_subm): Call simple sub.
20268 (ec_pow2): Use ec_mulm.
20269 (ec_mul2): New.
20270 (dup_point_weierstrass): Use ec_mul2.
20271 (dup_point_twistededwards): Add special case for a == -1. Use
20272 ec_mul2.
20273 (add_points_weierstrass): Use ec_mul2.
20274 (add_points_twistededwards): Add special case for a == -1.
20275 (_gcry_mpi_ec_curve_point): Ditto.
20276 (ec_p_init): Add hack to test Barrett functions.
20277 * src/ec-context.h (mpi_ec_ctx_s): Add P_BARRETT.
20278
20279 * mpi/mpi-mod.c (_gcry_mpi_mod_barrett): Fix sign problem.
20280
20281 ecc: Fix recomputing of Q for Ed25519.
20282 + commit c325adb8f5092b80a626bd3bb5e49cf7f3a29fc8
20283 * cipher/ecc-misc.c (reverse_buffer): New.
20284 (_gcry_ecc_compute_public): Add ED255519 specific code.
20285 * cipher/ecc.c (sign_eddsa): Allocate DIGEST in secure memory. Get
20286 rid of HASH_D.
20287 * tests/t-mpi-point.c (context_param): Test recomputing of Q for
20288 Ed25519.
20289
20290 log: Try to print s-expressions in a more compact format.
20291 + commit d69a13d3d1c14ad6a6aa7cd349d6d2dfb152d422
20292 * src/misc.c (count_closing_parens): New.
20293 (_gcry_log_printsxp): Use new function.
20294 * mpi/ec.c (_gcry_mpi_point_log): Take care of a NULL point.
20295
20296 2013-09-30 Jussi Kivilinna <[email protected]>
20297
20298 Make Whirlpool use the _gcry_md_block_write helper.
20299 + commit 68cefd0f1d60ac33b58031df9b1d165cb1bf0f14
20300 * cipher/whirlpool.c (whirlpool_context_t): Add 'bctx', remove
20301 'buffer', 'count' and 'nblocks'.
20302 (whirlpool_init): Initialize 'bctx'.
20303 (whirlpool_transform): Adjust context argument type and burn stack
20304 depth.
20305 (whirlpool_add): Remove.
20306 (whirlpool_write): Use _gcry_md_block_write.
20307 (whirlpool_final, whirlpool_read): Adjust for 'bctx' usage.
20308
20309 whirlpool: add stack burning after transform.
20310 + commit a96d622e1a36d40d1504b7ada567e90ec9957443
20311 * cipher/whirlpool.c (whirlpool_transform): Return burn stack depth.
20312 (whirlpool_add): Do burn_stack.
20313
20314 whirlpool: do bitcount calculation in finalization part.
20315 + commit 10d7351411f19bb2c03d2e24ca5a38dabe45023b
20316 * cipher/whirlpool.c (whirlpool_context_t): Remove 'length', add
20317 'nblocks'.
20318 (whirlpool_add): Update 'nblocks' instead of 'length', and add early
20319 return at one spot.
20320 (whirlpool_write): Check for 'nblocks' overflow.
20321 (whirlpool_final): Convert 'nblocks' to bit-counter, and use
20322 whirlpool_write instead of whirlpool_add.
20323
20324 2013-09-30 Werner Koch <[email protected]>
20325
20326 Add logging functions to the API.
20327 + commit d2076f27bb7c5d505abf25fc622d21794c4a5df3
20328 * src/gcrypt.h.in (_GCRY_GCC_ATTR_PRINTF): New.
20329 (gcry_log_debug, gcry_log_debughex, gcry_log_debugmpi): New.
20330 (gcry_log_debugpnt, gcry_log_debugsxp): New.
20331 * src/visibility.c (gcry_log_debug): New.
20332 (gcry_log_debughex, gcry_log_debugmpi, gcry_log_debugpnt): New.
20333 (gcry_log_debugsxp): New.
20334 * src/libgcrypt.def, src/libgcrypt.vers: Add new functions.
20335 * src/misc.c (_gcry_logv): Make public.
20336 (_gcry_log_printsxp): New.
20337 * src/g10lib.h (log_printsxp): New macro.
20338
20339 2013-09-26 Jussi Kivilinna <[email protected]>
20340
20341 Make libgcrypt build with Clang on i386.
20342 + commit db60d828137c4f3682ca4ca2a54fe3d96d3db5f9
20343 * cipher/longlong.h [__i386__] (add_ssaaaa, sub_ddmmss)
20344 (umul_ppmm, udiv_qrnnd): Do not cast asm output to USItype.
20345
20346 2013-09-25 Werner Koch <[email protected]>
20347
20348 mpi: Change not yet used _gcry_mpi_set_opaque_copy.
20349 + commit 1c6660debdbf1e4c3e80074c846a3e3097f214bb
20350 * mpi/mpiutil.c (_gcry_mpi_set_opaque_copy): Change prototype.
20351 (_gcry_mpi_get_opaque_copy): Take care of gcry_malloc failure.
20352
20353 sexp: Improve printing of data with a leading zero.
20354 + commit 9b7c49971588edf6acfc74bfb797eb79d19cb350
20355 * src/sexp.c (suitable_encoding): Detect leading zero byte.
20356
20357 ecc: Allow the name "q@eddsa" to get/set the public key.
20358 + commit d6683d2a6065986a9198d2d2eaa02c005b68cea4
20359 * cipher/ecc-curves.c (_gcry_ecc_get_mpi): Support "q@eddsa".
20360 (_gcry_ecc_set_mpi): Support "q".
20361 * cipher/ecc.c (eddsa_encodepoint): Rename to ...
20362 (_gcry_ecc_eddsa_encodepoint): this and make global. Remove arg
20363 MINLEN and take from context.
20364 (eddsa_decodepoint): Rename to
20365 (_gcry_ecc_eddsa_decodepoint): this and make global. Remove arg LEN
20366 and take from context.
20367 (sign_eddsa, verify_eddsa): Take B from context.
20368 (ecc_sign, ecc_verify): Add hack to set DIALECT.
20369 (_gcry_pk_ecc_get_sexp): Use _gcry_ecc_compute_public. Handle EdDSA.
20370 * src/ec-context.h (mpi_ec_ctx_s): Add field NBITS.
20371 * mpi/ec.c (ec_p_init): Init NBITS.
20372 * tests/t-mpi-point.c (test_curve): Add Ed25519.
20373 (sample_ed25519_q): New.
20374 (context_param): Check new sample key.
20375 (hex2buffer, hex2mpiopa): New.
20376 (cmp_mpihex): Take care of opaque MPIs.
20377
20378 mpicalc: Add statement to compute the number of bits.
20379 + commit 9a4447ccd1b90bcd701941e80a7f484a1825fcea
20380 * src/mpicalc.c (do_nbits): New.
20381 (main): Add statement 'b'.
20382
20383 ecc: Refactor low-level access functions.
20384 + commit 64a7d347847d606eb5f4c156e24ba060271b8f6b
20385 * mpi/ec.c (point_copy): Move to cipher/ecc-curves.c.
20386 (ec_get_reset): Rename to _gcry_mpi_ec_get_reset and make global.
20387 (_gcry_mpi_ec_get_mpi): Factor most code out to _gcry_ecc_get_mpi.
20388 (_gcry_mpi_ec_get_point): Factor most code out to _gcry_ecc_get_point.
20389 (_gcry_mpi_ec_set_mpi): Factor most code out to _gcry_ecc_set_mpi.
20390 (_gcry_mpi_ec_set_point): Factor most code out to _gcry_ecc_set_point.
20391 * cipher/ecc-curves.c (_gcry_ecc_get_mpi): New.
20392 (_gcry_ecc_get_point, _gcry_ecc_set_mpi, _gcry_ecc_set_point): New.
20393 * cipher/ecc-misc.c (_gcry_ecc_compute_public): New.
20394
20395 ecc: Fix highly unlikely endless loop in sign_ecdsa.
20396 + commit 1f5f4452e5bca105ec2197a4facbf9778e7dc31e
20397 * cipher/ecc.c (sign_ecdsa): Turn while-do into do-while loops.
20398
20399 2013-09-24 Werner Koch <[email protected]>
20400
20401 ecc: Allow the use of an uncompressed public key.
20402 + commit df013c9820709421ef9550158ac5df0060d73379
20403 * cipher/ecc.c (eddsa_encodepoint): Factor most code out to ...
20404 (eddsa_encode_x_y): new fucntion.
20405 (eddsa_decodepoint): Allow use of an uncompressed public key.
20406 * tests/t-ed25519.c (N_TESTS): Adjust.
20407 * tests/t-ed25519.inp: Add test 1025.
20408
20409 2013-09-23 Werner Koch <[email protected]>
20410
20411 pk: Add algo id GCRY_PK_ECC and deprecate ECDSA and ECDH.
20412 + commit d5f91466695c5736f441c9bf1998436184a4bf61
20413 * src/gcrypt.h.in (GCRY_PK_ECC): New.
20414 * cipher/pubkey.c (map_algo): New.
20415 (spec_from_algo, gcry_pk_get_param, _gcry_pk_selftest): Use it.
20416 * cipher/ecc.c (selftests_ecdsa): Report using GCRY_PK_ECC.
20417 (run_selftests): Simplify.
20418 (ecdh_names, ecdsa_names): Merge into a new ecc_names.
20419 (_gcry_pubkey_spec_ecdh, _gcry_pubkey_spec_ecdsa): Merge into new
20420 _gcry_pubkey_spec_ecc.
20421
20422 ec: Use mpi_mulm instead of mpi_powm.
20423 + commit 4552437bb3c5ff96a889fd31e4bc504b2a12fac7
20424 * mpi/ec.c (ec_pow2): New.
20425 (ec_powm): Remove call to mpi_abs.
20426 (dup_point_weierstrass, dup_point_twistededwards)
20427 (add_points_weierstrass, add_points_twistededwards)
20428 (_gcry_mpi_ec_curve_point): Use ec_pow2.
20429
20430 2013-09-21 Jussi Kivilinna <[email protected]>
20431
20432 bufhelp: enable fast unaligned memory accesses on powerpc.
20433 + commit 925d4fb3e8f2df3c5566ec6b5df7620a3d3504e5
20434 * cipher/bufhelp.h [__powerpc__] (BUFHELP_FAST_UNALIGNED_ACCESS): Set
20435 macro enabled.
20436 [__powerpc64__] (BUFHELP_FAST_UNALIGNED_ACCESS): Ditto.
20437
20438 Remove i386 inline assembly version of rotation functions.
20439 + commit cfea5c28a3822e1e7e401e5107ebe07ba7fdcf37
20440 * cipher/bithelp.h (rol, ror): Remove i386 version, change
20441 macros to inline functions.
20442 * src/hmac256.c (ror): Ditto.
20443
20444 Optimize and cleanup 32-bit and 64-bit endianess transforms.
20445 + commit 9337e03824a5bdd3bbbcb8382cabefe6d6c32e1e
20446 * cipher/bithelp.h (bswap32, bswap64, le_bswap32, be_bswap32)
20447 (le_bswap64, be_bswap64): New.
20448 * cipher/bufhelp.h (buf_get_be32, buf_get_le32, buf_put_le32)
20449 (buf_put_be32, buf_get_be64, buf_get_le64, buf_put_be64)
20450 (buf_put_le64): New.
20451 * cipher/blowfish.c (do_encrypt_block, do_decrypt_block): Use new
20452 endian conversion helpers.
20453 (do_bf_setkey): Turn endian specific code to generic.
20454 * cipher/camellia.c (GETU32, PUTU32): Use new endian conversion
20455 helpers.
20456 * cipher/cast5.c (rol): Remove, use rol from bithelp.
20457 (F1, F2, F3): Fix to use rol from bithelp.
20458 (do_encrypt_block, do_decrypt_block, do_cast_setkey): Use new endian
20459 conversion helpers.
20460 * cipher/des.c (READ_64BIT_DATA, WRITE_64BIT_DATA): Ditto.
20461 * cipher/md4.c (transform, md4_final): Ditto.
20462 * cipher/md5.c (transform, md5_final): Ditto.
20463 * cipher/rmd160.c (transform, rmd160_final): Ditto.
20464 * cipher/salsa20.c (LE_SWAP32, LE_READ_UINT32): Ditto.
20465 * cipher/scrypt.c (READ_UINT64, LE_READ_UINT64, LE_SWAP32): Ditto.
20466 * cipher/seed.c (GETU32, PUTU32): Ditto.
20467 * cipher/serpent.c (byte_swap_32): Remove.
20468 (serpent_key_prepare, serpent_encrypt_internal)
20469 (serpent_decrypt_internal): Use new endian conversion helpers.
20470 * cipher/sha1.c (transform, sha1_final): Ditto.
20471 * cipher/sha256.c (transform, sha256_final): Ditto.
20472 * cipher/sha512.c (__transform, sha512_final): Ditto.
20473 * cipher/stribog.c (transform, stribog_final): Ditto.
20474 * cipher/tiger.c (transform, tiger_final): Ditto.
20475 * cipher/twofish.c (INPACK, OUTUNPACK): Ditto.
20476 * cipher/whirlpool.c (buffer_to_block, block_to_buffer): Ditto.
20477 * configure.ac (gcry_cv_have_builtin_bswap32): Check for compiler
20478 provided __builtin_bswap32.
20479 (gcry_cv_have_builtin_bswap64): Check for compiler provided
20480 __builtin_bswap64.
20481
20482 gostr3411_94: set better burn stack depth estimate.
20483 + commit 7409de7bc28ff8847c9d71d8c3e35e1968d59d60
20484 * cipher/gost28147.c (_gcry_gost_enc_one): Account function stack to
20485 burn stack depth.
20486 * cipher/gostr3411-94.c (max): New macro.
20487 (do_hash_step, transform): Return stack burn depth.
20488
20489 Use hash transform function return type for passing burn stack depth.
20490 + commit 592c2ab3deeeccbb6d3b078ed7bf0e6627c8e1fb
20491 * cipher/gostr4311-94.c (transform): Return stack burn depth.
20492 * cipher/hash-common.c (_gcry_md_block_write): Use stack burn depth
20493 returned by 'hd->bwrite'.
20494 * cipher/hash-common.h (_gcry_md_block_write_t): Change return type to
20495 'unsigned int'.
20496 (gry_md_block_ctx_t): Remove 'stack_burn'.
20497 * cipher/md4.c (transform): Return stack burn depth.
20498 (md4_final): Use stack burn depth from transform.
20499 * cipher/md5.c (transform): Return stack burn depth.
20500 (md5_final): Use stack burn depth from transform.
20501 * cipher/rmd160.c (transform): Return stack burn depth.
20502 (rmd160_final): Use stack burn depth from transform.
20503 * cipher/sha1.c (transform): Return stack burn depth.
20504 (sha1_final): Use stack burn depth from transform.
20505 * cipher/sha256.c (transform): Return stack burn depth.
20506 (sha256_final): Use stack burn depth from transform.
20507 * cipher/sha512.c (__transform, transform): Return stack burn depth.
20508 (sha512_final): Use stack burn depth from transform.
20509 * cipher/stribog.c (transform64): Return stack burn depth.
20510 * cipher/tiger.c (transform): Return stack burn depth.
20511 (tiger_final): Use stack burn depth from transform.
20512
20513 Make STRIBOG use the new _gcry_md_block_write helper.
20514 + commit 902ea6052c11108bd19333c31b03e084bed1fb86
20515 * cipher/stribog.c (STRIBOG_STRUCT): Add 'bctx' and remove 'buf' and
20516 'count'.
20517 (stribog_init_512): Initialize 'bctx'.
20518 (transform64): New function.
20519 (stribog_write): Remove.
20520 (stribog_final): Use _gcry_md_block_write and bctx.
20521 (_gcry_digest_spec_stribog_256, _gcry_digest_spec_stribog_512): Use
20522 _gcry_md_block_write.
20523
20524 Make SHA-512 use the new _gcry_md_block_write helper.
20525 + commit cce7449efe471b076c5a97929ac8907162011394
20526 * cipher/hash-common.c (_gcry_md_block_write): Check that hd->buf is
20527 large enough.
20528 * cipher/hash-common.h (MD_BLOCK_MAX_BLOCKSIZE, MD_NBLOCKS_TYPE): New
20529 macros.
20530 (gcry_md_block_ctx_t): Use above macros for 'nblocks' and 'buf'.
20531 * cipher/sha512.c (SHA512_STATE): New struct.
20532 (SHA512_CONTEXT): Add 'bctx' and 'state'.
20533 (sha512_init, sha384_init): Initialize 'bctx'.
20534 (__transform, _gcry_sha512_transform_armv7_neon): Use SHA512_STATE for
20535 'hd'.
20536 (transform): For now, do not return burn stack.
20537 (sha512_write): Remove.
20538 (sha512_final): Use _gcry_md_block_write and bctx.
20539 (_gcry_digest_spec_sha512, _gcry_digest_spec_sha384): Use
20540 _gcry_md_block_write.
20541
20542 2013-09-20 Werner Koch <[email protected]>
20543
20544 sexp: Change internal versions to always use gpg_err_code_t.
20545 + commit 3e5cfa20acfeccb9df2c3fae2730344b40b36104
20546 * src/sexp.c (gcry_sexp_new, gcry_sexp_create, gcry_sexp_build)
20547 (gcry_sexp_build_array, gcry_sexp_canon_len): Change error return type
20548 from gpg_error_t to gpg_err_code_t. Remove all calls to gpg_error.
20549 * src/visibility.c (gcry_sexp_new, gcry_sexp_create, gcry_sexp_sscan)
20550 (gcry_sexp_build, gcry_sexp_build_array, gcry_sexp_canon_len): Map
20551 error codes via gpg_error.
20552 * cipher/dsa.c, cipher/ecc.c, cipher/elgamal.c, cipher/rsa.c: Remove
20553 use gpg_err_code wrappers.
20554
20555 pk: Move s-exp creation for gcry_pk_decrypt to the modules.
20556 + commit 722bfc1e5f2268453db62f38cc46b5ec6ef3adee
20557 * cipher/pubkey.c (sexp_to_enc): Remove RET_MODERN arg and merge it
20558 into FLAGS.
20559 (gcry_pk_decrypt): Move result s-exp building into the modules.
20560 * src/cipher-proto.h (gcry_pk_decrypt_t): Add some args.
20561 * cipher/ecc.c (ecc_decrypt_raw): Change to return an s-exp.
20562 * cipher/elgamal.c (elg_decrypt): Ditto.
20563 * cipher/rsa.c (rsa_decrypt): Ditto.
20564 (rsa_blind, rsa_unblind): Merge into rsa_decrypt. This saves several
20565 extra MPI allocations.
20566
20567 pk: Remove unused function.
20568 + commit 64cd7ab93da7c95cc8aa320c61c6e29f9e2399c4
20569 * cipher/pubkey.c (_gcry_pk_aliased_algo_name): Remove
20570
20571 2013-09-19 Werner Koch <[email protected]>
20572
20573 Beautify debug output of the prime generator.
20574 + commit 6576f0a7684292cb5691bfcabad0acca4c06c014
20575 * cipher/primegen.c: Adjust output of log_mpidump to recently changed
20576 log_mpidump code changes.
20577
20578 pk: Move s-expr creation for genkey to the modules.
20579 + commit 1bf08850bf9343146c938bc03917417e16393e9a
20580 * cipher/pubkey.c (pubkey_generate): Fold into gcry_pk_genkey
20581 (gcry_pk_genkey): Move result s-exp creation into the modules.
20582 * cipher/dsa.c (dsa_generate): Create result as s-exp.
20583 * cipher/elgamal.c (elg_generate): Ditto.
20584 * cipher/rsa.c (rsa_generate): Ditto.
20585 * cipher/ecc.c (ecc_generate): Ditto.
20586 * src/cipher-proto.h (pk_ext_generate_t): Remove type
20587 (gcry_pk_spec): and remove from struct.
20588
20589 tests: Beautify some diagnostics.
20590 + commit 2fe084873333c4d67bcfba0b527d63cd3cff6c47
20591 * tests/benchmark.c (ecc_bench): Print the key sexp in very verbose
20592 mode.
20593 (main): Add option --pk-count.
20594 * tests/keygen.c: Add Elgamal generation and improved diagnostics.
20595 * tests/t-ed25519.c (check_ed25519): Print running number of tests
20596 done.
20597
20598 sexp: Improve printing data representing a negative number.
20599 + commit b3f3d47d347c14ed41d755cee580f000309b9c03
20600 * src/sexp.c (suitable_encoding): Detect a negative number.
20601
20602 pk: Move RSA encoding functions to a new file.
20603 + commit 071f70b9a766187fc70f6abc6a69d50752449285
20604 * cipher/rsa-common: New.
20605 * cipher/pubkey.c (pkcs1_encode_for_encryption): Move to rsa-common.c
20606 and rename to _gcry_rsa_pkcs1_encode_for_enc.
20607 (pkcs1_decode_for_encryption): Move to rsa-common.c and rename to
20608 _gcry_rsa_pkcs1_decode_for_enc.
20609 (pkcs1_encode_for_signature): Move to rsa-common.c and rename to
20610 _gcry_rsa_pkcs1_encode_for_sig.
20611 (oaep_encode): Move to rsa-common.c and rename to
20612 _gcry_rsa_oaep_encode.
20613 (oaep_decode): Move to rsa-common.c and rename to
20614 _gcry_rsa_oaep_decode.
20615 (pss_encode): Move to rsa-common.c and rename to _gcry_rsa_pss_encode.
20616 (pss_verify): Move to rsa-common.c and rename to _gcry_rsa_pss_decode.
20617 (octet_string_from_mpi, mgf1): Move to rsa-common.c.
20618
20619 pk: Move s-expr creation for sign and encrypt to the modules.
20620 + commit eca9e2e50ddd4c9020fe1d4a9a3c77d20ebb90f6
20621 * cipher/pubkey.c (pubkey_encrypt): Fold into gcry_pk_encrypt.
20622 (pubkey_decrypt): Fold into gcry_pk_decrypt.
20623 (pubkey_sign): Fold into gcry_pk_sign.
20624 (pubkey_verify): Fold into gcry_pk_verify.
20625 (octet_string_from_mpi): Make it a wrapper and factor code out to ...
20626 * mpi/mpicoder.c (_gcry_mpi_to_octet_string): New function.
20627
20628 * src/cipher.h (PUBKEY_FLAG_FIXEDLEN): New.
20629 * cipher/pubkey.c (sexp_data_to_mpi): Set flag for some encodings.
20630 (gcry_pk_encrypt): Simply by moving the s-expr generation to the modules.
20631 (gcry_pk_sign): Ditto.
20632 * cipher/dsa.c (dsa_sign): Create s-expr.
20633 * cipher/elgamal.c (elg_encrypt, elg_sign): Ditto.
20634 * cipher/rsa.c (rsa_encrypt, rsa_sign): Ditto.
20635 * cipher/ecc.c (ecc_sign, ecc_encrypt_raw): Ditto.
20636 (ecdsa_names): Add "eddsa".
20637 * tests/t-ed25519.c (one_test): Expect "eddsa" token.
20638
20639 2013-09-19 Dmitry Eremin-Solenikov <[email protected]>
20640
20641 Fix Stribog digest on bigendian platforms.
20642 + commit d399faf5db71d429bfd6fa4a9cfc82e2a55055f0
20643 * cipher/stribog.c (stribog_final): swap bytes in the result of digest
20644 calculations.
20645
20646 2013-09-18 Werner Koch <[email protected]>
20647
20648 pk: Simplify the public key dispatcher pubkey.c.
20649 + commit 85722afb379f7a392a8117b895de273fd88c4ebc
20650 * src/cipher-proto.h (gcry_pk_spec_t): Add fields ALGO and FLAGS.
20651 * cipher/dsa.c (_gcry_pubkey_spec_dsa): Set these fields.
20652 * cipher/ecc.c (_gcry_pubkey_spec_ecdsa): Ditto.
20653 (_gcry_pubkey_spec_ecdh): Ditto.
20654 * cipher/rsa.c (_gcry_pubkey_spec_rsa): Ditto.
20655 * cipher/elgamal.c (_gcry_pubkey_spec_elg): Ditto
20656 (_gcry_pubkey_spec_elg_e): New.
20657 * cipher/pubkey.c: Change most code to replace the former module
20658 system by a simpler system to gain information about the algorithms.
20659 (disable_pubkey_algo): SImplified. Not anymore thread-safe, though.
20660
20661 pk: Merge extraspecs struct with standard specs struct.
20662 + commit 89103ce00e862cc709e80fa41f2ee13d54093ec5
20663 * src/gcrypt-module.h (gcry_pk_spec_t): Move this typedef and the
20664 corresponding function typedefs to ...
20665 * src/cipher-proto.h: here.
20666 (pk_extra_spec_t): Remove typedef and merge fields into
20667 gcry_pk_spec_t.
20668 * cipher/rsa.c, cipher/dsa.c, cipher/elg.c, cipher/ecc.c: Ditto.
20669 * cipher/pubkey.c: Change accordingly.
20670 * src/cipher.h (_gcry_pubkey_extraspec_rsa): Remove.
20671 (_gcry_pubkey_extraspec_dsa): Remove.
20672 (_gcry_pubkey_extraspec_elg): Remove.
20673 (_gcry_pubkey_extraspec_ecdsa): Remove.
20674
20675 2013-09-18 Jussi Kivilinna <[email protected]>
20676
20677 Fix encryption/decryption return type for GOST28147.
20678 + commit 2ad7ea9cb388fd31e4b0852b68d77f599ef4adce
20679 * cipher/gost.h (_gcry_gost_enc_one): Change return type to
20680 'unsigned int'.
20681 * cipher/gost28147.c (max): New macro.
20682 (gost_encrypt_block, gost_decrypt_block): Return burn stack depth.
20683 (_gcry_gost_enc_one): Return burn stack depth from gost_encrypt_block.
20684
20685 2013-09-18 Dmitry Eremin-Solenikov <[email protected]>
20686
20687 doc: fix building of ps and pdf documentation.
20688 + commit bd33fa21c9afc6c81e0da24016fc13001e9c7390
20689 * doc/gcrypt.texi, doc/gpl.texi, doc/lgpl.texi: fix texinfo errors.
20690
20691 Add GOST R 34.11-2012 implementation (Stribog)
20692 + commit c22064bdd773a807801e300aa9214b2fdcafcf20
20693 * src/gcrypt.h.in (GCRY_MD_GOSTR3411_12_256)
20694 (GCRY_MD_GOSTR3411_12_512): New.
20695 * cipher/stribog.c: New.
20696 * configure.ac (available_digests_64): Add stribog.
20697 * src/cipher.h: Declare Stribog declarations.
20698 * cipher/md.c: Register Stribog digest.
20699 * tests/basic.c (check_digests) Add 4 testcases for Stribog from
20700 standard.
20701 * doc/gcrypt.texi: Document new constants.
20702
20703 Add basic implementation of GOST R 34.11-94 message digest.
20704 + commit b0579baaa04fb91eabbbdc295bcabea04cf84056
20705 * src/gcrypt.h.in (GCRY_MD_GOSTR3411_94): New.
20706 * cipher/gostr3411-94.c: New.
20707 * configure.ac (available_digests): Add gostr3411-94.
20708 * src/cipher.h: Add gostr3411-94 definitions.
20709 * cipher/md.c: Register GOST R 34.11-94.
20710 * tests/basic.c (check_digests): Add 4 tests for GOST R 34.11-94
20711 hash algo. Two are defined in the standard itself, two other are
20712 more or less common tests - an empty string an exclamation mark.
20713 * doc/gcrypt.texi: Add an entry describing GOST R 34.11-94 to the MD
20714 algorithms table.
20715
20716 Separate common md block code.
20717 + commit ecde77ad98690540abb21db08e5531297ed72bd0
20718 * cipher/hash-common.c (_gcry_md_block_write): New function to handle
20719 block md operations. The current implementation is limited to 64 byte
20720 buffer and u32 block counter.
20721
20722 * cipher/md4.c, cipher/md5.c, cipher/rmd.h, cipher/rmd160.c
20723 *cipher/sha1.c, cipher/sha256.c, cipher/tiger.c: Convert to use
20724 _gcry_md_block_write.
20725
20726 Add limited implementation of GOST 28147-89 cipher.
20727 + commit 56b5949f71f501744998f5ebc12488ebf6f1c0b5
20728 * src/gcrypt.h.in (GCRY_CIPHER_GOST28147): New.
20729 * cipher/gost.h, cipher/gost28147.c: New.
20730 * configure.ac (available_ciphers): Add gost28147.
20731 * src/cipher.h: Add gost28147 definitions.
20732 * cipher/cipher.c: Register gost28147.
20733 * tests/basic.c (check_ciphers): Enable simple test for gost28147.
20734 * doc/gcrypt.texi: document GCRY_CIPHER_GOST28147.
20735
20736 2013-09-18 Werner Koch <[email protected]>
20737
20738 ecc: Add Ed25519 key generation and prepare for optimizations.
20739 + commit 63cd3474425cb5a7ec4d1a56be15b248ecda4680
20740 * src/mpi.h (enum ecc_dialects): New.
20741 * src/ec-context.h (mpi_ec_ctx_s): Add field DIALECT.
20742 * cipher/ecc-common.h (elliptic_curve_t): Ditto.
20743 * cipher/ecc-curves.c (ecc_domain_parms_t): Ditto.
20744 (domain_parms): Add dialect values.
20745 (_gcry_ecc_fill_in_curve): Set dialect.
20746 (_gcry_ecc_get_curve): Ditto.
20747 (_gcry_mpi_ec_new): Ditto.
20748 (_gcry_ecc_get_param): Use ECC_DIALECT_STANDARD for now.
20749 * cipher/ecc-misc.c (_gcry_ecc_curve_copy): Copy dialect.
20750 (_gcry_ecc_dialect2str): New.
20751 * mpi/ec.c (ec_p_init): Add arg DIALECT.
20752 (_gcry_mpi_ec_p_internal_new): Ditto.
20753 (_gcry_mpi_ec_p_new): Ditto.
20754
20755 * mpi/mpiutil.c (gcry_mpi_set_opaque): Set the secure flag.
20756 (_gcry_mpi_set_opaque_copy): New.
20757
20758 * cipher/ecc-misc.c (_gcry_ecc_os2ec): Take care of an opaque MPI.
20759 * cipher/ecc.c (eddsa_generate_key): New.
20760 (generate_key): Rename to nist_generate_key and factor some code out
20761 to ...
20762 (ecc_generate_ext): here. Divert to eddsa_generate_key if desired.
20763 (eddsa_decodepoint): Take care of an opaque MPI.
20764 (ecc_check_secret_key): Ditto.
20765 (ecc_sign): Ditto.
20766 * cipher/pubkey.c (sexp_elements_extract_ecc): Store public and secret
20767 key as opaque MPIs.
20768 (gcry_pk_genkey): Add the curve_name also to the private key part of
20769 the result.
20770
20771 * tests/benchmark.c (ecc_bench): Support Ed25519.
20772 (main): Add option --debug.
20773 * tests/curves.c (sample_key_2): Make sure that P and N are positive.
20774 * tests/keygen.c (show): New.
20775 (check_ecc_keys): Support Ed25519.
20776
20777 2013-09-17 Werner Koch <[email protected]>
20778
20779 mpi: Support printing of negative numbers.
20780 + commit 89fe2173649a72019d75e059e6c6938efd10421f
20781 * mpi/mpicoder.c (twocompl, onecompl): New.
20782 (gcry_mpi_print): Use it for STD and SSH.
20783 (gcry_mpi_scan): Use it for STD and SSH. Always set NSCANNED.
20784 (gcry_mpi_aprint): Clear the extra allocated byte.
20785 * tests/t-convert.c (showhex, showmpi): New.
20786 (mpi2bitstr_nlz): New.
20787 (check_formats): New.
20788 (main): Call new test.
20789
20790 2013-09-16 Werner Koch <[email protected]>
20791
20792 Fix bug in _gcry_mpi_tdiv_q_2exp.
20793 + commit a7a9cdcaaf3979baa18dad51e722882581349f45
20794 * mpi/mpi-internal.h (MPN_COPY_INCR): Make it work.
20795
20796 ecc: Implement Curve Ed25519 signing and verification.
20797 + commit bc5199a02abe428ad377443280b3eda60141a1d6
20798 * cipher/ecc-curves.c (domain_parms): Add curve "Ed25519".
20799 * cipher/ecc.c (reverse_buffer): New.
20800 (eddsa_encodempi): New.
20801 (eddsa_encodepoint): New.
20802 (eddsa_decodepoint): New.
20803 (sign_eddsa): Implement.
20804 (verify_eddsa): Implement.
20805 (ecc_sign): Init unused Q. Pass public key to sign_eddsa.
20806 (ecc_verify): Init pk.Q if not used. Pass public key verbatim to
20807 verify_eddsa.
20808 * cipher/pubkey.c (sexp_elements_extract): Add arg OPAQUE. Change all
20809 callers to pass 0.
20810 (sexp_to_sig): Add arg OPAQUE and pass it to sexp_elements_extract.
20811 (sexp_data_to_mpi): Allow for a zero length "value".
20812 (gcry_pk_verify): Reorder parameter processing. Pass OPAQUE flag as
20813 required.
20814 * mpi/ec.c (ec_invm): Print a warning if the inverse does not exist.
20815 (_gcry_mpi_ec_get_affine): Implement for our Twisted Edwards curve
20816 model.
20817 (dup_point_twistededwards): Implement.
20818 (add_points_twistededwards): Implement.
20819 (_gcry_mpi_ec_mul_point): Support Twisted Edwards.
20820
20821 * mpi/mpicoder.c (do_get_buffer): Add arg FILL_LE.
20822 (_gcry_mpi_get_buffer): Ditto. Change all callers.
20823 (_gcry_mpi_get_secure_buffer): Ditto.
20824
20825 * src/sexp.c (_gcry_sexp_nth_opaque_mpi): New.
20826
20827 * tests/t-ed25519.c: New.
20828 * tests/t-ed25519.inp: New.
20829 * tests/t-mpi-point.c (basic_ec_math_simplified): Print some output
20830 only in debug mode.
20831 (twistededwards_math): New test.
20832 (main): Call new test.
20833
20834 mpi: Add internal convenience function.
20835 + commit 44a2c34e90ed7de149952398787906d8823b636b
20836 * mpi/mpiutil.c (_gcry_mpi_get_opaque_copy): New.
20837
20838 mpi: Add debug function to print a point.
20839 + commit 8ebc94d11a1eb93f2365c93f555e958700fdfbd4
20840 * mpi/ec.c (_gcry_mpi_point_log): New.
20841 * src/mpi.h (log_printpnt): new macro.
20842
20843 tests: Factor time measurement code out.
20844 + commit 58eaf0c4332ac2f645ede28c4d18337389dfa753
20845 * tests/benchmark.c (started_at, stopped_at, start_timer, stop_timer)
20846 (elapsed time): Factor out to ..
20847 * tests/stopwatch.h: new file.
20848
20849 2013-09-12 Werner Koch <[email protected]>
20850
20851 Fix _gcry_log_printmpi to print 00 instead of a sole sign.
20852 + commit 1c76349c69c70a62b516a4f837c6287def640807
20853 * src/misc.c: Special case an mpi length of 0.
20854
20855 2013-09-11 Werner Koch <[email protected]>
20856
20857 Streamline the use of the internal mpi and hex debug functions.
20858 + commit e35ed615acc624a8b6c07576ea0650aac2bdb0db
20859 * mpi/mpicoder.c (gcry_mpi_dump): Remove.
20860 (_gcry_log_mpidump): Remove.
20861 * src/misc.c (_gcry_log_printhex): Factor all code out to ...
20862 (do_printhex): new. Add line wrapping a and compact printing.
20863 (_gcry_log_printmpi): New.
20864 * src/mpi.h (log_mpidump): Remove macro.
20865 * src/g10lib.h (log_mpidump): Add compatibility macro.
20866 (log_printmpi): New macro
20867 * src/visibility.c (gcry_mpi_dump): Call _gcry_log_printmpi.
20868 * cipher/primegen.c (prime_generate_internal): Replace gcry_mpi_dump
20869 by log_printmpi.
20870 (gcry_prime_group_generator): Ditto.
20871 * cipher/pubkey.c: Remove extra colons from log_mpidump call.
20872 * cipher/rsa.c (stronger_key_check): Use log_printmpi.
20873
20874 2013-09-10 Werner Koch <[email protected]>
20875
20876 md: Add function gcry_md_hash_buffers.
20877 + commit f3bca0c77c4979504f95fdbc618f7458e61e3e45
20878 * src/gcrypt.h.in (gcry_buffer_t): new.
20879 (gcry_md_hash_buffers): New.
20880 * src/visibility.c, src/visibility.h: Add wrapper for new function.
20881 * src/libgcrypt.def, src/libgcrypt.vers: Export new function.
20882 * cipher/md.c (gcry_md_hash_buffers): New.
20883 * cipher/sha1.c (_gcry_sha1_hash_buffers): New.
20884 * tests/basic.c (check_one_md_multi): New.
20885 (check_digests): Run that test.
20886 * tests/hmac.c (check_hmac_multi): New.
20887 (main): Run that test.
20888
20889 md: Fix Whirlpool flaw.
20890 + commit 0a28b2d2c9181a536fc894e24626714832619923
20891 * cipher/whirlpool.c (whirlpool_add): Remove shortcut return so that
20892 byte counter is always properly updated.
20893
20894 2013-09-07 Jussi Kivilinna <[email protected]>
20895
20896 Fix static build on AMD64.
20897 + commit 90fdf25f0dcc5feac7195ede55bd15948a11363e
20898 * cipher/rijndael-amd64.S: Correct 'RIP' macro for non-PIC build.
20899
20900 scrypt: fix for big-endian systems.
20901 + commit 38a038a135d82231eff9d84f1ae3c4a25c6a5e75
20902 * cipher/scrypt.c (_salsa20_core): Fix endianess issues.
20903
20904 2013-09-07 Werner Koch <[email protected]>
20905
20906 Use gcc "unused" attribute only with gcc >= 3.5.
20907 + commit f7135e299e659d78906aac3dfdf30f380b5cf9c6
20908 * src/g10lib.h (GCC_ATTR_UNUSED): Fix gcc version detection.
20909
20910 2013-09-07 Dmitry Eremin-Solenikov <[email protected]>
20911
20912 Add support for Salsa20/12 - 12 round version of Salsa20.
20913 + commit ae6f6c47d2e0c536f3eab0823b5f23d26956cda2
20914 * src/gcrypt.h.in (GCRY_CIPHER_SALSA20R12): New.
20915 * src/salsa20.c (salsa20_core, salsa20_do_encrypt_stream): Add support
20916 for reduced round versions.
20917 (salsa20r12_encrypt_stream, _gcry_cipher_spec_salsa20r12): Implement
20918 Salsa20/12 - a 12 round version of Salsa20 selected by eStream.
20919 * src/cipher.h: Declsare Salsa20/12 definition.
20920 * cipher/cipher.c: Register Salsa20/12
20921 * tests/basic.c: (check_stream_cipher, check_stream_cipher_large_block):
20922 Populate Salsa20/12 tests with test vectors from ecrypt
20923 (check_ciphers): Add simple test for Salsa20/12
20924
20925 2013-09-07 Werner Koch <[email protected]>
20926
20927 Add configure option --disable-amd64-as-feature-detection.
20928 + commit 49d5b9dcd622cdc87fb02a211bd51e3d46345bf2
20929 * configure.ac: Implement new disable flag.
20930
20931 mpi: Improve support for non-Weierstrass support.
20932 + commit 4d8c8c7aa88cddb1624301957e6245405f46d027
20933 * mpi/ec.c (ec_p_init): Add args MODEL and P. Change all callers.
20934 (_gcry_mpi_ec_p_internal_new): Ditto.
20935 (_gcry_mpi_ec_p_new): Ditto.
20936 * cipher/ecc-curves.c (_gcry_ecc_fill_in_curve): Return
20937 GPG_ERR_UNKNOWN_CURVE instead of invalid value. Init curve model.
20938 * cipher/ecc.c (ecc_verify, ecc_encrypt_raw): Ditto.
20939 * cipher/pubkey.c (sexp_data_to_mpi): Fix EDDSA flag error checking.
20940
20941 mpi: Add gcry_mpi_ec_curve_point.
20942 + commit ddfefe429660cc5d798f3517208936449247ae5c
20943 * mpi/ec.c (_gcry_mpi_ec_curve_point): New.
20944 (ec_powm): Return the absolute value.
20945 * src/visibility.c, src/visibility.c: Add wrappers.
20946 * src/libgcrypt.def, src/libgcrypt.vers: Export them.
20947
20948 mpi: Add functions to manipulate the sign.
20949 + commit 1bd2c67aa55b40589654d3fa5dea05cf1ed7dc5f
20950 * src/gcrypt.h.in (gcry_mpi_is_neg): New.
20951 (gcry_mpi_neg, gcry_mpi_abs): New.
20952 * mpi/mpiutil.c (_gcry_mpi_is_neg): New.
20953 (_gcry_mpi_neg, _gcry_mpi_abs): New.
20954 * src/visibility.c, src/visibility.h: Add wrappers.
20955 * src/libgcrypt.def, src/libgcrypt.vers: Export them.
20956 * src/mpi.h (mpi_is_neg): New. Rename old macro to mpi_has_sign.
20957 * mpi/mpi-mod.c (_gcry_mpi_mod_barrett): Use mpi_has_sign.
20958 * mpi/mpi-mpow.c (calc_barrett): Ditto.
20959 * cipher/primegen.c (_gcry_derive_x931_prime): Ditto
20960 * cipher/rsa.c (secret): Ditto.
20961
20962 2013-09-06 Jussi Kivilinna <[email protected]>
20963
20964 Tune armv6 mpi assembly.
20965 + commit 4e4440153258e2f0dfdcaa8443820af06984ecb1
20966 * mpi/armv6/mpih-mul1.S: Tune assembly for Cortex-A8.
20967 * mpi/armv6/mpih-mul2.S: Ditto.
20968 * mpi/armv6/mpih-mul3.S: Ditto.
20969
20970 2013-09-05 Jussi Kivilinna <[email protected]>
20971
20972 Change _gcry_burn_stack take burn depth as unsigned integer.
20973 + commit e0ae31fcce3bd57b24751ff3c82cba820e493c3a
20974 * src/misc.c (_gcry_burn_stack): Change to handle 'unsigned int' bytes.
20975
20976 mpicalc: fix building on linux and win32.
20977 + commit 50ec983666f0ca9d50c84aa1afad0d7bd5810779
20978 * src/Makefile.am (mpicalc): Adjust CFLAGS and LDADD.
20979
20980 2013-09-04 Werner Koch <[email protected]>
20981
20982 Change mpicalc to use Libgcrypt and install it.
20983 + commit 1d23040b659661b4086c079cb9fd5f37189a7020
20984 * src/mpicalc.c: Make use of gcry_ functions.
20985 (MPICALC_VERSION): New. Set to 2.0.
20986 (strusage): Remove.
20987 (scan_mpi): New. Replaces mpi_fromstr.
20988 (print_mpi): New. Replaces mpi_print.
20989 (my_getc): New.
20990 (print_help): New.
20991 (main): Use simple option parser and print version info.
20992 * src/Makefile.am (bin_PROGRAMS): Add mpicalc.
20993 (mpicalc_SOURCES, mpicalc_CFLAGS, mpicalc_LDADD): New.
20994
20995 Add mpicalc.c to help with testing.
20996 + commit a70c46e29c480fa0f56ab4814666a5b115f84fd7
20997 * src/mpicalc.c: Take from GnuPG 1.4
20998
20999 Prepare support for EdDSA.
21000 + commit c47d4001033f68212d2847b3074a0bdda990342e
21001 * src/cipher.h (PUBKEY_FLAG_EDDSA): New.
21002 * cipher/pubkey.c (pubkey_verify): Repalce args CMP and OPAQUEV by
21003 CTX. Pass flags and hash algo to the verify function. Change all
21004 verify functions to accept these args.
21005 (sexp_data_to_mpi): Implement new flag "eddsa".
21006 (gcry_pk_verify): Pass CTX instead of the compare function to
21007 pubkey_verify.
21008 * cipher/ecc.c (sign): Rename to sign_ecdsa. Change all callers.
21009 (verify): Rename to verify_ecdsa. Change all callers.
21010 (sign_eddsa, verify_eddsa): New stub functions.
21011 (ecc_sign): Divert to sign_ecdsa or sign_eddsa.
21012 (ecc_verify): Divert to verify_ecdsa or verify_eddsa.
21013
21014 Prepare support for non-Weierstrass EC equations.
21015 + commit c26be7a337d0bf98193bc58e043209e46d0769bb
21016 * src/mpi.h (gcry_mpi_ec_models): New.
21017 * src/ec-context.h (mpi_ec_ctx_s): Add MODEL.
21018 * cipher/ecc-common.h (elliptic_curve_t): Ditto.
21019 * cipher/ecc-curves.c (ecc_domain_parms_t): Ditto.
21020 (domain_parms): Mark als as Weierstrass.
21021 (_gcry_ecc_fill_in_curve): Check model.
21022 (_gcry_ecc_get_curve): Set model to Weierstrass.
21023 * cipher/ecc-misc.c (_gcry_ecc_model2str): New.
21024 * cipher/ecc.c (generate_key, ecc_generate_ext): Print model in the
21025 debug output.
21026
21027 * mpi/ec.c (_gcry_mpi_ec_dup_point): Switch depending on model.
21028 Factor code out to ...
21029 (dup_point_weierstrass): new.
21030 (dup_point_montgomery, dup_point_twistededwards): New stub functions.
21031 (_gcry_mpi_ec_add_points): Switch depending on model. Factor code out
21032 to ...
21033 (add_points_weierstrass): new.
21034 (add_points_montgomery, add_points_twistededwards): New stub
21035 functions.
21036
21037 * tests/Makefile.am (TESTS): Reorder tests.
21038
21039 mpi: Suppress newer gcc warnings.
21040 + commit 8698530b2f9ef95542f1dd550961de7af86cc256
21041 * src/g10lib.h (GCC_ATTR_UNUSED): Define for gcc >= 3.5.
21042 * mpi/mpih-div.c (_gcry_mpih_mod_1, _gcry_mpih_divmod_1): Mark dummy
21043 as unused.
21044 * mpi/mpi-internal.h (UDIV_QRNND_PREINV): Mark _ql as unused.
21045
21046 Do not check with cpp for typedefed constants.
21047 + commit b28b1f732e1b4f9c62a9de87c22c6bb0d3f8fdb8
21048 * src/gcrypt-int.h: Include error code replacements depeding on the
21049 version of libgpg-error.
21050
21051 2013-09-04 Jussi Kivilinna <[email protected]>
21052
21053 Make _gcry_burn_stack use variable length array.
21054 + commit 4b0edf53440239d3bcc95941980c062a0801a149
21055 * configure.ac (HAVE_VLA): Add check.
21056 * src/misc.c (_gcry_burn_stack) [HAVE_VLA]: Add VLA code.
21057
21058 Move stack burning from block ciphers to cipher modes.
21059 + commit a3aaa6ad03388ea3eaa24304b604cb864633332f
21060 * src/gcrypt-module.h (gcry_cipher_encrypt_t)
21061 (gcry_cipher_decrypt_t): Return 'unsigned int'.
21062 * cipher/cipher.c (dummy_encrypt_block, dummy_decrypt_block): Return
21063 zero.
21064 (do_ecb_encrypt, do_ecb_decrypt): Get largest stack burn depth from
21065 block cipher crypt function and burn stack at end.
21066 * cipher/cipher-aeswrap.c (_gcry_cipher_aeswrap_encrypt)
21067 (_gcry_cipher_aeswrap_decrypt): Ditto.
21068 * cipher/cipher-cbc.c (_gcry_cipher_cbc_encrypt)
21069 (_gcry_cipher_cbc_decrypt): Ditto.
21070 * cipher/cipher-cfb.c (_gcry_cipher_cfb_encrypt)
21071 (_gcry_cipher_cfb_decrypt): Ditto.
21072 * cipher/cipher-ctr.c (_gcry_cipher_cbc_encrypt): Ditto.
21073 * cipher/cipher-ofb.c (_gcry_cipher_ofb_encrypt)
21074 (_gcry_cipher_ofb_decrypt): Ditto.
21075 * cipher/blowfish.c (encrypt_block, decrypt_block): Return burn stack
21076 depth.
21077 * cipher/camellia-glue.c (camellia_encrypt, camellia_decrypt): Ditto.
21078 * cipher/cast5.c (encrypt_block, decrypt_block): Ditto.
21079 * cipher/des.c (do_tripledes_encrypt, do_tripledes_decrypt)
21080 (do_des_encrypt, do_des_decrypt): Ditto.
21081 * cipher/idea.c (idea_encrypt, idea_decrypt): Ditto.
21082 * cipher/rijndael.c (rijndael_encrypt, rijndael_decrypt): Ditto.
21083 * cipher/seed.c (seed_encrypt, seed_decrypt): Ditto.
21084 * cipher/serpent.c (serpent_encrypt, serpent_decrypt): Ditto.
21085 * cipher/twofish.c (twofish_encrypt, twofish_decrypt): Ditto.
21086 * cipher/rfc2268.c (encrypt_block, decrypt_block): New.
21087 (_gcry_cipher_spec_rfc2268_40): Use encrypt_block and decrypt_block.
21088
21089 2013-09-01 Jussi Kivilinna <[email protected]>
21090
21091 camellia-aesni-avx2-amd64: Move register clearing to assembly functions.
21092 + commit f3515240de9513ead975985c9f8ab714022cac8e
21093 * cipher/camellia-aesni-avx2-amd64.S
21094 (_gcry_camellia_aesni_avx2_ctr_enc): Add 'vzeroall'.
21095 (_gcry_camellia_aesni_avx2_cbc_dec)
21096 (_gcry_camellia_aesni_avx2_cfb_dec): Add 'vzeroupper' at head and
21097 'vzeroall' at tail.
21098 * cipher/camellia-glue.c (_gcry_serpent_ctr_enc, _gcry_serpent_cbc_dec)
21099 (_gcry_serpent_avx2_cfb_dec) [USE_AESNI_AVX2]: Remove register
21100 clearing.
21101
21102 camellia-aesni-avx-amd64: Move register clearing to assembly functions.
21103 + commit 8b735cb563dff7aafbf8a970972522b5621e665c
21104 * cipher/camellia-aesni-avx-amd64.S (_gcry_camellia_aesni_avx_ctr_enc)
21105 (_gcry_camellia_aesni_avx_cbc_dec)
21106 (_gcry_camellia_aesni_avx_cfb_dec): Add 'vzeroupper' at head and
21107 'vzeroall' at tail.
21108 * cipher/camellia-glue.c (_gcry_serpent_ctr_enc, _gcry_serpent_cbc_dec)
21109 (_gcry_serpent_avx2_cfb_dec) [USE_AESNI_AVX]: Remove register clearing.
21110
21111 serpent-avx2-amd64: Move register clearing to assembly.
21112 + commit d12828cd821a4b4428eae19de5aee02cf536e536
21113 * cipher/serpent-avx2-amd64.S (_gcry_serpent_avx2_ctr_enc)
21114 (_gcry_serpent_avx2_cbc_dec, _gcry_serpent_avx2_cfb_dec): Change last
21115 'vzeroupper' to 'vzeroall'.
21116 * cipher/serpent.c (_gcry_serpent_ctr_enc, _gcry_serpent_cbc_dec)
21117 (_gcry_serpent_avx2_cfb_dec) [USE_AVX2]: Remove register clearing with
21118 'vzeroall'.
21119
21120 Fix building for x32 target.
21121 + commit fd6721c235a5bdcb332c8eb708fbd4f96e52e824
21122 * mpi/amd64/mpi-asm-defs.h: New file.
21123 * random/rndhw.c (poll_padlock) [__x86_64__]: Also check if __LP64__ is
21124 defined.
21125 [USE_DRNG, __x86_64__]: Also check if __LP64__ is defined.
21126
21127 2013-08-31 Jussi Kivilinna <[email protected]>
21128
21129 sha512: add ARM/NEON assembly version of transform function.
21130 + commit 99d15543b8d94a8f1ef66c6ccb862b0ce82c514d
21131 * cipher/Makefile.am: Add 'sha512-armv7-neon.S'.
21132 * cipher/sha512-armv7-neon.S: New file.
21133 * cipher/sha512.c (USE_ARM_NEON_ASM): New macro.
21134 (SHA512_CONTEXT) [USE_ARM_NEON_ASM]: Add 'use_neon'.
21135 (sha512_init, sha384_init) [USE_ARM_NEON_ASM]: Enable 'use_neon' if
21136 CPU support NEON instructions.
21137 (k): Round constant array moved outside of 'transform' function.
21138 (__transform): Renamed from 'tranform' function.
21139 [USE_ARM_NEON_ASM] (_gcry_sha512_transform_armv7_neon): New prototype.
21140 (transform): New wrapper function for different transform versions.
21141 (sha512_write, sha512_final): Burn stack by the amount returned by
21142 transform function.
21143 * configure.ac (sha512) [neonsupport]: Add 'sha512-armv7-neon.lo'.
21144
21145 sha512: reduce stack use in transform function by 512 bytes.
21146 + commit 03da7f8ba3ec24d4639a2bcebbc0d9d831734c08
21147 * cipher/sha512.c (transform): Change 'u64 w[80]' to 'u64 w[16]' and
21148 inline input expansion to first 64 rounds.
21149 (sha512_write, sha512_final): Reduce burn_stack depth by 512 bytes.
21150
21151 Add ARM HW feature detection module and add NEON detection.
21152 + commit 9c95be105f518d18407115c2c06893857c24b116
21153 * configure.ac: Add option --disable-neon-support.
21154 (HAVE_GCC_INLINE_ASM_NEON): New.
21155 (ENABLE_NEON_SUPPORT): New.
21156 [arm]: Add 'hwf-arm.lo' as HW feature module.
21157 * src/Makefile.am: Add 'hwf-arm.c'.
21158 * src/g10lib.h (HWF_ARM_NEON): New macro.
21159 * src/global.c (hwflist): Add HWF_ARM_NEON entry.
21160 * src/hwf-arm.c: New file.
21161 * src/hwf-common.h (_gcry_hwf_detect_arm): New prototype.
21162 * src/hwfeatures.c (_gcry_detect_hw_features) [HAVE_CPU_ARCH_ARM]: Add
21163 call to _gcry_hwf_detect_arm.
21164
21165 Correct mpi_cpu_arch for ARMv6.
21166 + commit 7b0ebe69fe35f2ee13e1e1beb2766a1eaadb7f0c
21167 * mpi/config.links [armv6]: Set mpi_cpu_arch to "arm", instead of
21168 "armv6".
21169
21170 2013-08-30 Werner Koch <[email protected]>
21171
21172 mpi: Make gcry_mpi_print work with negative zeroes.
21173 + commit e9b711e6ddb480a71d2996465074e436c752c005
21174 * mpi/mpicoder.c (gcry_mpi_print): Take care of negative zero.
21175 (gcry_mpi_aprint): Allocate at least 1 byte.
21176 * tests/t-convert.c: New.
21177 * tests/Makefile.am (TESTS): Add t-convert.
21178
21179 Refactor the ECC code into 3 files.
21180 + commit 800d4e01376d52a94a157b53978c7c3f957fc476
21181 * cipher/ecc-common.h, cipher/ecc-curves.c, cipher/ecc-misc.c: New.
21182 * cipher/Makefile.am (EXTRA_libcipher_la_SOURCES): Add new files.
21183 * configure.ac (GCRYPT_PUBKEY_CIPHERS): Add new .c files.
21184 * cipher/ecc.c (curve_aliases, ecc_domain_parms_t, domain_parms)
21185 (scanval): Move to ecc-curves.c.
21186 (fill_in_curve): Move to ecc-curve.c as _gcry_ecc_fill_in_curve.
21187 (ecc_get_curve): Move to ecc-curve.c as _gcry_ecc_get_curve.
21188 (_gcry_mpi_ec_ec2os): Move to ecc-misc.c.
21189 (ec2os): Move to ecc-misc.c as _gcry_ecc_ec2os.
21190 (os2ec): Move to ecc-misc.c as _gcry_ecc_os2ec.
21191 (point_set): Move as inline function to ecc-common.h.
21192 (_gcry_ecc_curve_free): Move to ecc-misc.c as _gcry_ecc_curve_free.
21193 (_gcry_ecc_curve_copy): Move to ecc-misc.c as _gcry_ecc_curve_copy.
21194 (mpi_from_keyparam, point_from_keyparam): Move to ecc-curves.c.
21195 (_gcry_mpi_ec_new): Move to ecc-curves.c.
21196 (ecc_get_param): Move to ecc-curves.c as _gcry_ecc_get_param.
21197 (ecc_get_param_sexp): Move to ecc-curves.c as _gcry_ecc_get_param_sexp.
21198
21199 2013-08-22 Jussi Kivilinna <[email protected]>
21200
21201 serpent-sse2-amd64: Move register clearing to assembly functions.
21202 + commit 040aa7688296e93659cb32ca31e9a001a6ab1edd
21203 cipher/serpent-sse2-amd64.S (_gcry_serpent_sse2_ctr_enc)
21204 (_gcry_serpent_sse2_cbc_dec, _gcry_serpent_sse2_cfb_dec): Clear used
21205 XMM registers.
21206 cipher/serpent.c (_gcry_serpent_ctr_enc, _gcry_serpent_cbc_dec)
21207 ( _gcry_serpent_cfb_dec) [USE_SSE2]: Remove XMM register clearing from
21208 bulk functions.
21209
21210 twofish-amd64: do not make __twofish_dec_blk3 global.
21211 + commit 82db04a6a0058cf870485459abe7c1659b138ec5
21212 * cipher/twofish-amd64.S (__twofish_dec_blk3): Do not export symbol as
21213 global.
21214 (__twofish_dec_blk3): Mark symbol as function.
21215
21216 2013-08-20 Jussi Kivilinna <[email protected]>
21217
21218 mpi: add ARMv6 assembly.
21219 + commit da327aef3fe24fdf98fffbc8aea69de42ed12456
21220 * mpi/armv6/mpi-asm-defs.h: New.
21221 * mpi/armv6/mpih-add1.S: New.
21222 * mpi/armv6/mpih-mul1.S: New.
21223 * mpi/armv6/mpih-mul2.S: New.
21224 * mpi/armv6/mpih-mul3.S: New.
21225 * mpi/armv6/mpih-sub1.S: New.
21226 * mpi/config.links [arm]: Enable ARMv6 assembly.
21227
21228 Move ARMv6 detection to configure.ac.
21229 + commit 151f1e518be2d16bed748ba832384b0472ddcf9b
21230 * cipher/blowfish-armv6.S: Replace __ARM_ARCH >= 6 checks with
21231 HAVE_ARM_ARCH_V6.
21232 * cipher/blowfish.c: Ditto.
21233 * cipher/camellia-armv6.S: Ditto.
21234 * cipher/camellia.h: Ditto.
21235 * cipher/cast5-armv6.S: Ditto.
21236 * cipher/cast5.c: Ditto.
21237 * cipher/rijndael-armv6.S: Ditto.
21238 * cipher/rijndael.c: Ditto.
21239 * configure.ac: Add HAVE_ARM_ARCH_V6 check.
21240
21241 2013-08-19 Jussi Kivilinna <[email protected]>
21242
21243 Add optimized wipememory for ARM.
21244 + commit c030e33533fb819afe195eff5f89ec39863b1fbc
21245 src/g10lib.h [__arm__] (fast_wipememory2_unaligned_head)
21246 (fast_wipememory2): New macros.
21247
21248 cipher: bufhelp: allow unaligned memory accesses on ARM.
21249 + commit 796dda37b957b20dba391343937c6325a8c8b288
21250 * cipher/bufhelp.h [__arm__ && __ARM_FEATURE_UNALIGNED]: Enable
21251 BUFHELP_FAST_UNALIGNED_ACCESS.
21252
21253 2013-08-17 Jussi Kivilinna <[email protected]>
21254
21255 Remove burn_stack optimization.
21256 + commit 79895b9459b9bf8c60cb7abf09d5bf16ed0cf6e3
21257 * src/misc.c (_gcry_burn_stack): Remove SIZEOF_UNSIGNED_LONG == 4 or 8
21258 optimization.
21259
21260 2013-08-16 Jussi Kivilinna <[email protected]>
21261
21262 camellia: add ARMv6 assembly implementation.
21263 + commit cafadc1e4fb97581262b0081ba251e05613d4394
21264 * cipher/Makefile.am: Add 'camellia-armv6.S'.
21265 * cipher/camellia-armv6.S: New file.
21266 * cipher/camellia-glue.c [USE_ARMV6_ASM]
21267 (_gcry_camellia_armv6_encrypt_block)
21268 (_gcry_camellia_armv6_decrypt_block): New prototypes.
21269 [USE_ARMV6_ASM] (Camellia_EncryptBlock, Camellia_DecryptBlock)
21270 (camellia_encrypt, camellia_decrypt): New functions.
21271 * cipher/camellia.c [!USE_ARMV6_ASM]: Compile encryption and decryption
21272 routines if USE_ARMV6_ASM macro is _not_ defined.
21273 * cipher/camellia.h (USE_ARMV6_ASM): New macro.
21274 [!USE_ARMV6_ASM] (Camellia_EncryptBlock, Camellia_DecryptBlock): If
21275 USE_ARMV6_ASM is defined, disable these function prototypes.
21276 (camellia) [arm]: Add 'camellia-armv6.lo'.
21277
21278 blowfish: add ARMv6 assembly implementation.
21279 + commit 31e4b1a96a07e9a3698fcb7be0643a136ebb8e5c
21280 * cipher/Makefile.am: Add 'blowfish-armv6.S'.
21281 * cipher/blowfish-armv6.S: New file.
21282 * cipher/blowfish.c (USE_ARMV6_ASM): New macro.
21283 [USE_ARMV6_ASM] (_gcry_blowfish_armv6_do_encrypt)
21284 (_gcry_blowfish_armv6_encrypt_block)
21285 (_gcry_blowfish_armv6_decrypt_block, _gcry_blowfish_armv6_ctr_enc)
21286 (_gcry_blowfish_armv6_cbc_dec, _gcry_blowfish_armv6_cfb_dec): New
21287 prototypes.
21288 [USE_ARMV6_ASM] (do_encrypt, do_encrypt_block, do_decrypt_block)
21289 (encrypt_block, decrypt_block): New functions.
21290 (_gcry_blowfish_ctr_enc) [USE_ARMV6_ASM]: Use ARMv6 assembly function.
21291 (_gcry_blowfish_cbc_dec) [USE_ARMV6_ASM]: Use ARMv6 assembly function.
21292 (_gcry_blowfish_cfb_dec) [USE_ARMV6_ASM]: Use ARMv6 assembly function.
21293 * configure.ac (blowfish) [arm]: Add 'blowfish-armv6.lo'.
21294
21295 cast5: add ARMv6 assembly implementation.
21296 + commit 8d1faf56714598301580ce370e0bfa6d65e73644
21297 * cipher/Makefile.am: Add 'cast5-armv6.S'.
21298 * cipher/cast5-armv6.S: New file.
21299 * cipher/cast5.c (USE_ARMV6_ASM): New macro.
21300 (CAST5_context) [USE_ARMV6_ASM]: New members 'Kr_arm_enc' and
21301 'Kr_arm_dec'.
21302 [USE_ARMV6_ASM] (_gcry_cast5_armv6_encrypt_block)
21303 (_gcry_cast5_armv6_decrypt_block, _gcry_cast5_armv6_ctr_enc)
21304 (_gcry_cast5_armv6_cbc_dec, _gcry_cast5_armv6_cfb_dec): New prototypes.
21305 [USE_ARMV6_ASM] (do_encrypt_block, do_decrypt_block, encrypt_block)
21306 (decrypt_block): New functions.
21307 (_gcry_cast5_ctr_enc) [USE_ARMV6_ASM]: Use ARMv6 assembly function.
21308 (_gcry_cast5_cbc_dec) [USE_ARMV6_ASM]: Use ARMv6 assembly function.
21309 (_gcry_cast5_cfb_dec) [USE_ARMV6_ASM]: Use ARMv6 assembly function.
21310 (do_cast_setkey) [USE_ARMV6_ASM]: Initialize 'Kr_arm_enc' and
21311 'Kr_arm_dec'.
21312 * configure.ac (cast5) [arm]: Add 'cast5-armv6.lo'.
21313
21314 2013-08-14 Jussi Kivilinna <[email protected]>
21315
21316 rijndael: add ARMv6 assembly implementation.
21317 + commit f365961422f1c8b3d89b8bcd9c99828f38c1f158
21318 * cipher/Makefile.am: Add 'rijndael-armv6.S'.
21319 * cipher/rijndael-armv6.S: New file.
21320 * cipher/rijndael.c (USE_ARMV6_ASM): New macro.
21321 [USE_ARMV6_ASM] (_gcry_aes_armv6_encrypt_block)
21322 (_gcry_aes_armv6_decrypt_block): New prototypes.
21323 (do_encrypt_aligned) [USE_ARMV6_ASM]: Use ARMv6 assembly function.
21324 (do_encrypt): Disable input/output alignment when USE_ARMV6_ASM.
21325 (do_decrypt_aligned) [USE_ARMV6_ASM]: Use ARMv6 assembly function.
21326 (do_decrypt): Disable input/output alignment when USE_ARMV6_ASM.
21327 * configure.ac (HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS): New check for
21328 gcc/as compatibility with ARM assembly implementations.
21329 (aes) [arm]: Add 'rijndael-armv6.lo'.
21330
21331 2013-08-09 NIIBE Yutaka <[email protected]>
21332
21333 cipher: fix memory leak.
21334 + commit 2b5bbe264fcd61e5e458e5f71a6507ba0271c729
21335 * cipher/pubkey.c (gcry_pk_sign): Handle the specific case of ECC,
21336 where there is NULL whichi is not the sentinel.
21337
21338 2013-08-08 Werner Koch <[email protected]>
21339
21340 mpi: Clear immutable flag on the result of gcry_mpi_set.
21341 + commit 426cbc9feca0c8f46208fb3670adab95f9e46087
21342 * mpi/mpiutil.c (gcry_mpi_set): Reset immutable and const flags.
21343 * tests/mpitests.c (test_const_and_immutable): Add a test for this.
21344
21345 2013-08-07 NIIBE Yutaka <[email protected]>
21346
21347 tests: fix memory leaks.
21348 + commit cc082642c1b0f2a3e9ca78e1ffd3f64417c204bd
21349 * tests/benchmark.c (dsa_bench): Release SIG.
21350
21351 * tests/mpitests.c (test_powm): Release BASE, EXP, MOD, and RES.
21352
21353 * tests/prime.c (check_primes): Release PRIME.
21354
21355 * tests/tsexp.c (basic): Use intermediate variable M for constant.
21356 Release S1, S2 and A.
21357
21358 2013-08-07 Jussi Kivilinna <[email protected]>
21359
21360 Fix building on W32 (cannot export symbol 'gcry_sexp_get_buffer')
21361 + commit 065d446478bf68553339fc77a89b8369bd110a18
21362 * src/libgcrypt.def: Change 'gcry_sexp_get_buffer' to
21363 'gcry_sexp_nth_buffer'.
21364
21365 2013-08-06 NIIBE Yutaka <[email protected]>
21366
21367 cipher: fix another memory leak.
21368 + commit 9a421813123a2f5db0a91eaee4a45138efc9ad34
21369 * cipher/ecc.c (ecc_get_curve): Free TMP.
21370
21371 tests: fix memory leaks.
21372 + commit 87eddc31ccba6decbddd1761dd42a208666cd311
21373 * tests/pubkey.c (check_keys_crypt): Release L, X0, and X1.
21374 (check_keys): Release X.
21375
21376 cipher: fix memory leaks.
21377 + commit ae6ffd9af38cbcac57c220960f683aab91db85cb
21378 * cipher/elgamal.c (elg_generate_ext): Free XVALUE.
21379
21380 * cipher/pubkey.c (sexp_elements_extract): Don't use IDX for loop.
21381 Call mpi_free.
21382 (sexp_elements_extract_ecc): Call mpi_free.
21383
21384 2013-08-05 Werner Koch <[email protected]>
21385
21386 mpi: Improve gcry_mpi_invm to detect bad input.
21387 + commit d8e99a04dba6a606e879464cd11deee760d1e000
21388 * mpi/mpi-inv.c (gcry_mpi_invm): Return 0 for bad input.
21389
21390 2013-07-31 Dmitry Eremin-Solenikov <[email protected]>
21391
21392 Correct checks for ecc secret key.
21393 + commit 10dfa41b43a906031bc674ea41cd3073701011f3
21394 * cipher/ecc.c (check_secret_key): replace wrong comparison of Q and
21395 sk->Q points with correct one.
21396
21397 2013-07-29 Werner Koch <[email protected]>
21398
21399 sexp: Allow white space anywhere in a hex format.
21400 + commit 43320961a8751ee28dc95cdb0ae01ea8a7ff7f91
21401 * src/sexp.c (hextobyte): Remove.
21402 (hextonibble): New.
21403 (vsexp_sscan): Skip whtespace between hex nibbles.
21404
21405 Implement deterministic ECDSA as specified by rfc-6979.
21406 + commit 6e0a9786637d649b48aae0e611a12e12beef9b3b
21407 * cipher/ecc.c (sign): Add args FLAGS and HASHALGO. Convert an opaque
21408 MPI as INPUT. Implement rfc-6979.
21409 (ecc_sign): Remove the opaque MPI code and pass FLAGS to sign.
21410 (verify): Do not allocate and compute Y; it is not used.
21411 (ecc_verify): Truncate the hash value if needed.
21412 * tests/dsa-rfc6979.c (check_dsa_rfc6979): Add ECDSA test cases.
21413
21414 2013-07-26 Werner Koch <[email protected]>
21415
21416 Implement deterministic DSA as specified by rfc-6979.
21417 + commit 1cfa79aabc5d0fd8d124901054475e90ab7d9cde
21418 * cipher/dsa.c (dsa_sign): Move opaque mpi extraction to sign.
21419 (sign): Add args FLAGS and HASHALGO. Implement deterministic DSA.
21420 Add code path for R==0 to comply with the standard.
21421 (dsa_verify): Left fill opaque mpi based hash values.
21422 * cipher/dsa-common.c (int2octets, bits2octets): New.
21423 (_gcry_dsa_gen_rfc6979_k): New.
21424 * tests/dsa-rfc6979.c: New.
21425 * tests/Makefile.am (TESTS): Add dsa-rfc6979.
21426
21427 Allow the use of a private-key s-expression with gcry_pk_verify.
21428 + commit b72d312ad11887fc416aa821786f6bdb663c0f4a
21429 * cipher/pubkey.c (sexp_to_key): Fallback to private key.
21430
21431 2013-07-25 Werner Koch <[email protected]>
21432
21433 Mitigate a flush+reload cache attack on RSA secret exponents.
21434 + commit 287bf0e543f244d784cf8b58340bf0ab3c6aba97
21435 * mpi/mpi-pow.c (gcry_mpi_powm): Always perfrom the mpi_mul for
21436 exponents in secure memory.
21437
21438 2013-07-19 Werner Koch <[email protected]>
21439
21440 pk: Allow the use of a hash element for DSA sign and verify.
21441 + commit 37d0a1ebdc2dc74df4fb6bf0621045018122a68f
21442 * cipher/pubkey.c (pubkey_sign): Add arg ctx and pass it to the sign
21443 module.
21444 (gcry_pk_sign): Pass CTX to pubkey_sign.
21445 (sexp_data_to_mpi): Add flag rfc6979 and code to alls hash with *DSA
21446 * cipher/rsa.c (rsa_sign, rsa_verify): Return an error if an opaque
21447 MPI is given for DATA/HASH.
21448 * cipher/elgamal.c (elg_sign, elg_verify): Ditto.
21449 * cipher/dsa.c (dsa_sign, dsa_verify): Convert a given opaque MPI.
21450 * cipher/ecc.c (ecc_sign, ecc_verify): Ditto.
21451 * tests/basic.c (check_pubkey_sign_ecdsa): Add a test for using a hash
21452 element with DSA.
21453
21454 sexp: Add function gcry_sexp_nth_buffer.
21455 + commit 2d3e8d4d9562d666420aadd9ffa8ac0456a1cd91
21456 * src/sexp.c (gcry_sexp_nth_buffer): New.
21457 * src/visibility.c, src/visibility.h: Add function wrapper.
21458 * src/libgcrypt.vers, src/libgcrypt.def: Add to API.
21459 * src/gcrypt.h.in: Add prototype.
21460
21461 2013-07-18 Werner Koch <[email protected]>
21462
21463 Add support for Salsa20.
21464 + commit c4885092088431e7928e4459fda20cc0e8ceb201
21465 * src/gcrypt.h.in (GCRY_CIPHER_SALSA20): New.
21466 * cipher/salsa20.c: New.
21467 * configure.ac (available_ciphers): Add Salsa20.
21468 * cipher/cipher.c: Register Salsa20.
21469 (cipher_setiv): Allow to divert an IV to a cipher module.
21470 * src/cipher-proto.h (cipher_setiv_func_t): New.
21471 (cipher_extra_spec): Add field setiv.
21472 * src/cipher.h: Declare Salsa20 definitions.
21473 * tests/basic.c (check_stream_cipher): New.
21474 (check_stream_cipher_large_block): New.
21475 (check_cipher_modes): Run new test functions.
21476 (check_ciphers): Add simple test for Salsa20.
21477
21478 2013-07-17 Werner Koch <[email protected]>
21479
21480 Allow gcry_mpi_dump to print opaque MPIs.
21481 + commit 364d019e3ffedfcb434576702f73e767cb9389ef
21482 * mpi/mpicoder.c (gcry_mpi_dump): Detect abd print opaque MPIs.
21483 * tests/mpitests.c (test_opaque): New.
21484 (main): Call new test.
21485
21486 cipher: Prepare to pass extra info to the sign functions.
21487 + commit 5940e66cbefea3de5924f494f18aed69bb694bff
21488 * src/gcrypt-module.h (gcry_pk_sign_t): Add parms flags and hashalgo.
21489 * cipher/rsa.c (rsa_sign): Add parms and mark them as unused.
21490 * cipher/dsa.c (dsa_sign): Ditto.
21491 * cipher/elgamal.c (elg_sign): Ditto.
21492 * cipher/pubkey.c (dummy_sign): Ditto.
21493 (pubkey_sign): Pass 0 for the new args.
21494
21495 Fix a special case bug in mpi_powm for e==0.
21496 + commit 6e1adb05d290aeeb1c230c763970695f4a538526
21497 * mpi/mpi-pow.c (gcry_mpi_powm): For a zero exponent, make sure that
21498 the result has been allocated.
21499
21500 2013-07-15 Dmitry Eremin-Solenikov <[email protected]>
21501
21502 Fix memory leak in t-mpi-point test.
21503 + commit a7b80e9fba6b1b095f7c53469747967b40ebfbfd
21504 * tests/t-mpi-point.c (basic_ec_math, basic_ec_math_simplified): add
21505 calls to gcry_ctx_release() to free contexts after they become unused.
21506
21507 2013-07-10 Jussi Kivilinna <[email protected]>
21508
21509 Fix 'Please include winsock2.h before windows.h' warnings with mingw32.
21510 + commit d6c9c86cb7f571ae0bd9aee4efa01a0f9c4c3104
21511 * random/rndw32.c: include winsock2.h before windows.h.
21512 * src/ath.h [_WIN32]: Ditto.
21513 * tests/benchmark.c [_WIN32]: Ditto.
21514
21515 Remove duplicate header from mpi/amd64/mpih-mul2.S.
21516 + commit c64a0dcbefc5b0055954e37a3c86b32ff7a1b1da
21517 * mpi/amd64/mpih-mul2.S: remove duplicated header.
21518
21519 Fix i386/amd64 inline assembly "cc" clobbers.
21520 + commit ed0a598172208ec67234a4edd73189bf6808fd04
21521 * cipher/bithelp.h [__GNUC__, __i386__] (rol, ror): add "cc" globber
21522 for inline assembly.
21523 * cipher/cast5.c [__GNUC__, __i386__] (rol): Ditto.
21524 * random/rndhw.c [USE_DRNG] (rdrand_long): Ditto.
21525 * src/hmac256.c [__GNUC__, __i386__] (ror): Ditto.
21526 * mpi/longlong.c [__i386__] (add_ssaaaa, sub_ddmmss, umul_ppmm)
21527 (udiv_qrnnd, count_leading_zeros, count_trailing_zeros): Ditto.
21528
21529 bufhelp: Suppress 'cast increases required alignment' warning.
21530 + commit c3902a6b5cea9acef2e15fbee24eb601eeb25168
21531 * cipher/bufhelp.h (buf_xor, buf_xor_2dst, buf_xor_n_copy): Cast
21532 to larger element pointer through (void *) to suppress -Wcast-error.
21533
21534 mpi: Add __ARM_ARCH for older GCC.
21535 + commit 97f392f43cf2e4da1297cbecacbfbff33a869478
21536 * mpi/longlong.h [__arm__]: Construct __ARM_ARCH if not provided by
21537 compiler.
21538
21539 mpi: add missing "cc" clobber for ARM assembly.
21540 + commit 8aa4f2161cf643ce36d87d2e2786b546736f8232
21541 * mpi/longlong.h [__arm__] (add_ssaaaa, sub_ddmmss): Add __CLOBBER_CC.
21542 [__arm__][__ARM_ARCH <= 3] (umul_ppmm): Ditto.
21543
21544 Tweak ARM inline assembly for mpi.
21545 + commit 71dda4507053379433dc8b0fc6462c15de7299df
21546 mpi/longlong.h [__arm__]: Enable inline assembly if __thumb2__ is
21547 defined.
21548 [__arm__]: Use __ARCH_ARM when defined.
21549 [__arm__] [__ARM_ARCH >= 5] (count_leading_zeros): New.
21550
21551 2013-06-26 Werner Koch <[email protected]>
21552
21553 Make gpg-error replacement defines more robust.
21554 + commit 6540b84a6e9113813e7e49e3ad2024d4a0073300
21555 * configure.ac (AH_BOTTOM): Move GPG_ERR_ replacement defines to ...
21556 * src/gcrypt-int.h: new file.
21557 * src/visibility.h, src/cipher.h: Replace gcrypt.h by gcrypt-int.h.
21558 * tests/: Ditto for all test files.
21559
21560 2013-06-20 Jussi Kivilinna <[email protected]>
21561
21562 Check if assembler is compatible with AMD64 assembly implementations.
21563 + commit 3544fa8aa63bef9a35abf236e9376191b5ec206b
21564 * cipher/blowfish-amd64.S: Enable only if
21565 HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS is defined.
21566 * cipher/camellia-aesni-avx-amd64.S: Ditto.
21567 * cipher/camellia-aesni-avx2-amd64.S: Ditto.
21568 * cipher/cast5-amd64.S: Ditto.
21569 * cipher/rinjdael-amd64.S: Ditto.
21570 * cipher/serpent-avx2-amd64.S: Ditto.
21571 * cipher/serpent-sse2-amd64.S: Ditto.
21572 * cipher/twofish-amd64.S: Ditto.
21573 * cipher/blowfish.c: Use AMD64 assembly implementation only if
21574 HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS is defined
21575 * cipher/camellia-glue.c: Ditto.
21576 * cipher/cast5.c: Ditto.
21577 * cipher/rijndael.c: Ditto.
21578 * cipher/serpent.c: Ditto.
21579 * cipher/twofish.c: Ditto.
21580 * configure.ac: Check gcc/as compatibility with AMD64 assembly
21581 implementations.
21582
21583 2013-06-09 Jussi Kivilinna <[email protected]>
21584
21585 Optimize _gcry_burn_stack for 32-bit and 64-bit architectures.
21586 + commit ec2f8de409a93c80efa658134df22074a9bca5a4
21587 * src/misc.c (_gcry_burn_stack): Add optimization for 32-bit and 64-bit
21588 architectures.
21589
21590 Add Camellia AES-NI/AVX2 implementation.
21591 + commit d94ec5f5f8a5d40a7d344025aa466f276f9718df
21592 * cipher/Makefile.am: Add 'camellia-aesni-avx2-amd64.S'.
21593 * cipher/camellia-aesni-avx2-amd64.S: New file.
21594 * cipher/camellia-glue.c (USE_AESNI_AVX2): New macro.
21595 (CAMELLIA_context) [USE_AESNI_AVX2]: Add 'use_aesni_avx2'.
21596 [USE_AESNI_AVX2] (_gcry_camellia_aesni_avx2_ctr_enc)
21597 (_gcry_camellia_aesni_avx2_cbc_dec)
21598 (_gcry_camellia_aesni_avx2_cfb_dec): New prototypes.
21599 (camellia_setkey) [USE_AESNI_AVX2]: Check AVX2+AES-NI capable hardware
21600 and set 'ctx->use_aesni_avx2'.
21601 (_gcry_camellia_ctr_enc) [USE_AESNI_AVX2]: Add AVX2 accelerated code.
21602 (_gcry_camellia_cbc_dec) [USE_AESNI_AVX2]: Add AVX2 accelerated code.
21603 (_gcry_camellia_cfb_dec) [USE_AESNI_AVX2]: Add AVX2 accelerated code.
21604 (selftest_ctr_128, selftest_cbc_128, selftest_cfb_128): Grow 'nblocks'
21605 so that AVX2 codepaths get tested.
21606 * configure.ac (camellia) [avx2support, aesnisupport]: Add
21607 'camellia-aesni-avx2-amd64.lo'.
21608
21609 Add Serpent AVX2 implementation.
21610 + commit e7ab4e1a7396f4609b9033207015b239ab4a5140
21611 * cipher/Makefile.am: Add 'serpent-avx2-amd64.S'.
21612 * cipher/serpent-avx2-amd64.S: New file.
21613 * cipher/serpent.c (USE_AVX2): New macro.
21614 (serpent_context_t) [USE_AVX2]: Add 'use_avx2'.
21615 [USE_AVX2] (_gcry_serpent_avx2_ctr_enc, _gcry_serpent_avx2_cbc_dec)
21616 (_gcry_serpent_avx2_cfb_dec): New prototypes.
21617 (serpent_setkey_internal) [USE_AVX2]: Check for AVX2 capable hardware
21618 and set 'use_avx2'.
21619 (_gcry_serpent_ctr_enc) [USE_AVX2]: Use AVX2 accelerated functions.
21620 (_gcry_serpent_cbc_dec) [USE_AVX2]: Use AVX2 accelerated functions.
21621 (_gcry_serpent_cfb_dec) [USE_AVX2]: Use AVX2 accelerated functions.
21622 (selftest_ctr_128, selftest_cbc_128, selftest_cfb_128): Grow 'nblocks'
21623 so that AVX2 codepaths are tested.
21624 * configure.ac (serpent) [avx2support]: Add 'serpent-avx2-amd64.lo'.
21625
21626 Add detection for Intel AVX2 instruction set.
21627 + commit 3289bca708bdd02c69a331095ac6ca9a1efd74cc
21628 * configure.ac: Add option --disable-avx2-support.
21629 (HAVE_GCC_INLINE_ASM_AVX2): New.
21630 (ENABLE_AVX2_SUPPORT): New.
21631 * src/g10lib.h (HWF_INTEL_AVX2): New.
21632 * src/global.c (hwflist): Add HWF_INTEL_AVX2.
21633 * src/hwf-x86.c [__i386__] (get_cpuid): Initialize registers to zero
21634 before cpuid.
21635 [__x86_64__] (get_cpuid): Initialize registers to zero before cpuid.
21636 (detect_x86_gnuc): Store maximum cpuid level.
21637 (detect_x86_gnuc) [ENABLE_AVX2_SUPPORT]: Add detection for AVX2.
21638
21639 twofish: add amd64 assembly implementation.
21640 + commit d325ab5d86e6107a46007a4d0131122bbd719f8c
21641 * cipher/Makefile.am: Add 'twofish-amd64.S'.
21642 * cipher/twofish-amd64.S: New file.
21643 * cipher/twofish.c (USE_AMD64_ASM): New macro.
21644 [USE_AMD64_ASM] (_gcry_twofish_amd64_encrypt_block)
21645 (_gcry_twofish_amd64_decrypt_block, _gcry_twofish_amd64_ctr_enc)
21646 (_gcry_twofish_amd64_cbc_dec, _gcry_twofish_amd64_cfb_dec): New
21647 prototypes.
21648 [USE_AMD64_ASM] (do_twofish_encrypt, do_twofish_decrypt)
21649 (twofish_encrypt, twofish_decrypt): New functions.
21650 (_gcry_twofish_ctr_enc, _gcry_twofish_cbc_dec, _gcry_twofish_cfb_dec)
21651 (selftest_ctr, selftest_cbc, selftest_cfb): New functions.
21652 (selftest): Call new bulk selftests.
21653 * cipher/cipher.c (gcry_cipher_open) [USE_TWOFISH]: Register Twofish
21654 bulk functions for ctr-enc, cbc-dec and cfb-dec.
21655 * configure.ac (twofish) [x86_64]: Add 'twofish-amd64.lo'.
21656 * src/cipher.h (_gcry_twofish_ctr_enc, _gcry_twofish_cbc_dec)
21657 (gcry_twofish_cfb_dec): New prototypes.
21658
21659 2013-05-29 Jussi Kivilinna <[email protected]>
21660
21661 rinjdael: add amd64 assembly implementation.
21662 + commit 7317fcfadf00789df140e51c0d16b60f6b144b59
21663 * cipher/Makefile.am: Add 'rijndael-amd64.S'.
21664 * cipher/rijndael-amd64.S: New file.
21665 * cipher/rijndael.c (USE_AMD64_ASM): New macro.
21666 [USE_AMD64_ASM] (_gcry_aes_amd64_encrypt_block)
21667 (_gcry_aes_amd64_decrypt_block): New prototypes.
21668 (do_encrypt_aligned) [USE_AMD64_ASM]: Use amd64 assembly function.
21669 (do_encrypt): Disable input/output alignment when USE_AMD64_ASM is set.
21670 (do_decrypt_aligned) [USE_AMD64_ASM]: Use amd64 assembly function.
21671 (do_decrypt): Disable input/output alignment when USE_AMD64_AES is set.
21672 * configure.ac (aes) [x86-64]: Add 'rijndael-amd64.lo'.
21673
21674 blowfish: add amd64 assembly implementation.
21675 + commit 9a61edd1f00cefe8ffa3ad54a53eed163883053c
21676 * cipher/Makefile.am: Add 'blowfish-amd64.S'.
21677 * cipher/blowfish-amd64.S: New file.
21678 * cipher/blowfish.c (USE_AMD64_ASM): New macro.
21679 [USE_AMD64_ASM] (_gcry_blowfish_amd64_do_encrypt)
21680 (_gcry_blowfish_amd64_encrypt_block)
21681 (_gcry_blowfish_amd64_decrypt_block, _gcry_blowfish_amd64_ctr_enc)
21682 (_gcry_blowfish_amd64_cbc_dec, _gcry_blowfish_amd64_cfb_dec): New
21683 prototypes.
21684 [USE_AMD64_ASM] (do_encrypt, do_encrypt_block, do_decrypt_block)
21685 (encrypt_block, decrypt_block): New functions.
21686 (_gcry_blowfish_ctr_enc, _gcry_blowfish_cbc_dec)
21687 (_gcry_blowfish_cfb_dec, selftest_ctr, selftest_cbc, selftest_cfb): New
21688 functions.
21689 (selftest): Call new bulk selftests.
21690 * cipher/cipher.c (gcry_cipher_open) [USE_BLOWFISH]: Register Blowfish
21691 bulk functions for ctr-enc, cbc-dec and cfb-dec.
21692 * configure.ac (blowfish) [x86_64]: Add 'blowfish-amd64.lo'.
21693 * src/cipher.h (_gcry_blowfish_ctr_enc, _gcry_blowfish_cbc_dec)
21694 (gcry_blowfish_cfb_dec): New prototypes.
21695
21696 2013-05-24 Werner Koch <[email protected]>
21697
21698 ecc: Simplify the compliant point generation.
21699 + commit 99b18aa536703ef90c9a1f5c8f40bc68b2064593
21700 * cipher/ecc.c (generate_key): Use point_snatch_set, replaces unneeded
21701 variable copies, etc.
21702
21703 ecc: Fix a minor flaw in the generation of K.
21704 + commit 9711384f75564a71979e3fb971b5f4cadcf1afef
21705 * cipher/dsa.c (gen_k): Factor code out to ..
21706 * cipher/dsa-common.c (_gcry_dsa_gen_k): new file and function. Add
21707 arg security_level and re-indent a bit.
21708 * cipher/ecc.c (gen_k): Remove and change callers to _gcry_dsa_gen_k.
21709 * cipher/dsa.c: Include pubkey-internal.
21710 * cipher/Makefile.am (libcipher_la_SOURCES): Add dsa-common.c
21711
21712 2013-05-24 Jussi Kivilinna <[email protected]>
21713
21714 cast5: add amd64 assembly implementation.
21715 + commit 0bdf26eea8cdbffefe7e37578f8f896c4f5f5275
21716 * cipher/Makefile.am: Add 'cast5-amd64.S'.
21717 * cipher/cast5-amd64.S: New file.
21718 * cipher/cast5.c (USE_AMD64_ASM): New macro.
21719 (_gcry_cast5_s1tos4): Merge arrays s1, s2, s3, s4 to single array to
21720 simplify access from assembly implementation.
21721 (s1, s2, s3, s4): New macros pointing to subarrays in
21722 _gcry_cast5_s1tos4.
21723 [USE_AMD64_ASM] (_gcry_cast5_amd64_encrypt_block)
21724 (_gcry_cast5_amd64_decrypt_block, _gcry_cast5_amd64_ctr_enc)
21725 (_gcry_cast5_amd64_cbc_dec, _gcry_cast5_amd64_cfb_dec): New prototypes.
21726 [USE_AMD64_ASM] (do_encrypt_block, do_decrypt_block, encrypt_block)
21727 (decrypt_block): New functions.
21728 (_gcry_cast5_ctr_enc, _gcry_cast5_cbc_dec, _gcry_cast5_cfb_dec)
21729 (selftest_ctr, selftest_cbc, selftest_cfb): New functions.
21730 (selftest): Call new bulk selftests.
21731 * cipher/cipher.c (gcry_cipher_open) [USE_CAST5]: Register CAST5 bulk
21732 functions for ctr-enc, cbc-dec and cfb-dec.
21733 * configure.ac (cast5) [x86_64]: Add 'cast5-amd64.lo'.
21734 * src/cipher.h (_gcry_cast5_ctr_enc, _gcry_cast5_cbc_dec)
21735 (gcry_cast5_cfb_dec): New prototypes.
21736
21737 cipher-selftest: make selftest work with any block-size.
21738 + commit ab8fc70b5f0c396a5bc941267f59166e860b8c5d
21739 * cipher/cipher-selftest.c (_gcry_selftest_helper_cbc_128)
21740 (_gcry_selftest_helper_cfb_128, _gcry_selftest_helper_ctr_128): Renamed
21741 functions from '<name>_128' to '<name>'.
21742 (_gcry_selftest_helper_cbc, _gcry_selftest_helper_cfb)
21743 (_gcry_selftest_helper_ctr): Make work with different block sizes.
21744 * cipher/cipher-selftest.h (_gcry_selftest_helper_cbc_128)
21745 (_gcry_selftest_helper_cfb_128, _gcry_selftest_helper_ctr_128): Renamed
21746 prototypes from '<name>_128' to '<name>'.
21747 * cipher/camellia-glue.c (selftest_ctr_128, selftest_cfb_128)
21748 (selftest_ctr_128): Change to use new function names.
21749 * cipher/rijndael.c (selftest_ctr_128, selftest_cfb_128)
21750 (selftest_ctr_128): Change to use new function names.
21751 * cipher/serpent.c (selftest_ctr_128, selftest_cfb_128)
21752 (selftest_ctr_128): Change to use new function names.
21753
21754 2013-05-23 Jussi Kivilinna <[email protected]>
21755
21756 serpent: add parallel processing for CFB decryption.
21757 + commit 6deb0ccdf718a0670f80e6762a3842caf76437d6
21758 * cipher/cipher.c (gcry_cipher_open): Add bulf CFB decryption function
21759 for Serpent.
21760 * cipher/serpent-sse2-amd64.S (_gcry_serpent_sse2_cfb_dec): New
21761 function.
21762 * cipher/serpent.c (_gcry_serpent_sse2_cfb_dec): New prototype.
21763 (_gcry_serpent_cfb_dec) New function.
21764 (selftest_cfb_128) New function.
21765 (selftest) Call selftest_cfb_128.
21766 * src/cipher.h (_gcry_serpent_cfb_dec): New prototype.
21767
21768 camellia: add parallel processing for CFB decryption.
21769 + commit b60f06f70227c1e69e1010da8b47ea51ade48145
21770 * cipher/camellia-aesni-avx-amd64.S
21771 (_gcry_camellia_aesni_avx_cfb_dec): New function.
21772 * cipher/camellia-glue.c (_gcry_camellia_aesni_avx_cfb_dec): New
21773 prototype.
21774 (_gcry_camellia_cfb_dec): New function.
21775 (selftest_cfb_128): New function.
21776 (selftest): Call selftest_cfb_128.
21777 * cipher/cipher.c (gry_cipher_open): Add bulk CFB decryption function
21778 for Camellia.
21779 * src/cipher.h (_gcry_camellia_cfb_dec): New prototype.
21780
21781 rinjdael: add parallel processing for CFB decryption with AES-NI.
21782 + commit 319ee14f2aab8db56a830fd7ac8926f91b4f738a
21783 * cipher/cipher-selftest.c (_gcry_selftest_helper_cfb_128): New
21784 function for CFB selftests.
21785 * cipher/cipher-selftest.h (_gcry_selftest_helper_cfb_128): New
21786 prototype.
21787 * cipher/rijndael.c [USE_AESNI] (do_aesni_enc_vec4): New function.
21788 (_gcry_aes_cfb_dec) [USE_AESNI]: Add parallelized CFB decryption.
21789 (selftest_cfb_128): New function.
21790 (selftest): Call selftest_cfb_128.
21791
21792 2013-05-23 Werner Koch <[email protected]>
21793
21794 Avoid compiler warning due to the global symbol setkey.
21795 + commit b402de8b9c4a9f269faf03ca952b1eb68a1f33c8
21796 * cipher/cipher-selftest.c (_gcry_selftest_helper_cbc_128)
21797 (_gcry_selftest_helper_ctr_128): Rename setkey to setkey_func.
21798
21799 2013-05-23 Jussi Kivilinna <[email protected]>
21800
21801 serpent: add SSE2 accelerated amd64 implementation.
21802 + commit 2fd06e207dcea1d8a7f0e7e92f3359615a99421b
21803 * configure.ac (serpent): Add 'serpent-sse2-amd64.lo'.
21804 * cipher/Makefile.am (EXTRA_libcipher_la_SOURCES): Add
21805 'serpent-sse2-amd64.S'.
21806 * cipher/cipher.c (gcry_cipher_open) [USE_SERPENT]: Register bulk
21807 functions for CBC-decryption and CTR-mode.
21808 * cipher/serpent.c (USE_SSE2): New macro.
21809 [USE_SSE2] (_gcry_serpent_sse2_ctr_enc, _gcry_serpent_sse2_cbc_dec):
21810 New prototypes to assembler functions.
21811 (serpent_setkey): Set 'serpent_init_done' before calling serpent_test.
21812 (_gcry_serpent_ctr_enc): New function.
21813 (_gcry_serpent_cbc_dec): New function.
21814 (selftest_ctr_128): New function.
21815 (selftest_cbc_128): New function.
21816 (selftest): Call selftest_ctr_128 and selftest_cbc_128.
21817 * cipher/serpent-sse2-amd64.S: New file.
21818 * src/cipher.h (_gcry_serpent_ctr_enc): New prototype.
21819 (_gcry_serpent_cbc_dec): New prototype.
21820
21821 Serpent: faster S-box implementation.
21822 + commit c85501af8222913f0a1e20e77fceb88e93417925
21823 * cipher/serpent.c (SBOX0, SBOX1, SBOX2, SBOX3, SBOX4, SBOX5, SBOX6)
21824 (SBOX7, SBOX0_INVERSE, SBOX1_INVERSE, SBOX2_INVERSE, SBOX3_INVERSE)
21825 (SBOX4_INVERSE, SBOX5_INVERSE, SBOX6_INVERSE, SBOX7_INVERSE): Replace
21826 with new definitions.
21827
21828 2013-05-22 Werner Koch <[email protected]>
21829
21830 w32: Fix installing of .def file.
21831 + commit 4e46d8bc78008ba06f106b368cefb0dddf15fe38
21832 * src/Makefile.am (install-def-file): Create libdir first.
21833
21834 Add control commands to disable mlock and setuid dropping.
21835 + commit 2b8014af202c9e0f7619f7a4377f5eb752235220
21836 * src/gcrypt.h.in (GCRYCTL_DISABLE_LOCKED_SECMEM): New.
21837 (GCRYCTL_DISABLE_PRIV_DROP): New.
21838 * src/global.c (_gcry_vcontrol): Implement them.
21839 * src/secmem.h (GCRY_SECMEM_FLAG_NO_MLOCK): New.
21840 (GCRY_SECMEM_FLAG_NO_PRIV_DROP): New.
21841 * src/secmem.c (no_mlock, no_priv_drop): New.
21842 (_gcry_secmem_set_flags, _gcry_secmem_get_flags): Set and get them.
21843 (lock_pool): Handle no_mlock and no_priv_drop.
21844
21845 Fix libtool 2.4.2 to correctly detect .def files.
21846 + commit 05b3e2dda61d3d532a7f1ffd2487a85ed1c4f3ab
21847 * ltmain.sh (sed_uncomment_deffile): New.
21848 (orig_export_symbols): Uncomment def file before testing for EXPORTS.
21849 * m4/libtool.m4: Do the same for the generated code.
21850
21851 2013-05-22 Jussi Kivilinna <[email protected]>
21852
21853 Add AES bulk CBC decryption selftest.
21854 + commit b65281a1b76d7898eb7607932246b78277d8570b
21855 * cipher/rinjdael.c (selftest_cbc_128): New.
21856 (selftest): Call selftest_cbc_128.
21857
21858 Change AES bulk CTR encryption selftest use new selftest helper function
21859 + commit 3637bdbb5f30a5e06745d448a6a8ad00e5cdd740
21860 * cipher/rinjdael.c: (selftest_ctr_128): Change to use new selftest
21861 helper function.
21862
21863 Convert bulk CTR and CBC selftest functions in Camellia to generic selftest helper functions
21864 + commit eed4042fa028b3f73bad6a768f5b0a82f642e545
21865 * cipher/Makefile.am (libcipher_la_SOURCES): Add cipher-selftest files.
21866 * cipher/camellia-glue.c (selftest_ctr_128, selftest_cbc_128): Change
21867 to use the new selftest helper functions.
21868 * cipher/cipher-selftest.c: New.
21869 * cipher/cipher-selftest.h: New.
21870
21871 camellia: add bulk CBC decryption selftest.
21872 + commit f2986f03d1ae59f973bae56ce4333e5457003de5
21873 * cipher/camellia-glue.c: (selftest_cbc_128): New selftest function for
21874 bulk CBC decryption.
21875 (selftest): Add call to selftest_cbc_128.
21876
21877 camellia: Rename camellia_aesni_avx_x86-64.S to camellia-aesni-avx-amd64.S
21878 + commit 194ae35da7830a76b96e9b21121a2e1248762d3f
21879 * cipher/camellia_aesni_avx_x86-64.S: Remove.
21880 * cipher/camellia-aesni-avx-amd64.S: New.
21881 * cipher/Makefile.am: Use the new filename.
21882 * configure.ac: Use the new filename.
21883
21884 2013-05-21 Werner Koch <[email protected]>
21885
21886 Fix indentation and save on string space.
21887 + commit 2ac3a7c2b7154379738d17cfde8cd9017dc142f0
21888 * cipher/ecc.c (generate_key): Use the same string for both fatal
21889 messages.
21890
21891 2013-05-20 Andrey <[email protected]>
21892
21893 cipher: Fix segv in last ECC change.
21894 + commit eb4937914db3fb7317502e97e4f0e40c1857f59d
21895 * cipher/ecc.c (generate_key): Make sure R is initialized.
21896
21897 2013-05-09 Andrey <[email protected]>
21898
21899 cipher: Generate compliant ECC keys.
21900 + commit 296f38a2bd2e25788643a42e4881faed00884a40
21901 * cipher/ecc.c (generate_key): Make sure a key is compliant for
21902 using the compact representation.
21903
21904 2013-04-18 Werner Koch <[email protected]>
21905
21906 cipher: Fix regression in Padlock support.
21907 + commit 6c942ec4d63032539f1fc56c3b970cfec2369e2b
21908 * cipher/rijndael.c (do_setkey): Remove dummy padlock key generation case
21909 and use the standard one.
21910
21911 mpi: Yet another fix to get option flag munging right.
21912 + commit 03557687a09b9c8878c77cbfdd0f5049940c72da
21913 * cipher/Makefile.am (o_flag_munging): Yet another fix.
21914
21915 mpi: Make using gcc's -Ofast easier.
21916 + commit 1ab26bc304c559b0a8d29823d656f7ad8d10a59d
21917 * cipher/Makefile.am (o_flag_munging): Take -Ofast in account.
21918
21919 Fix alignment problem in idea.c.
21920 + commit 3271b0dfda67e26c381d7ed667737f08f865ee40
21921 * cipher/idea.c (cipher): Rework parameter use to fix alignment
21922 problems.
21923
21924 * cipher/idea.c (FNCCAST_SETKEY, FNCCAST_CRYPT): Remove unused macros.
21925
21926 Fix alignment problem in idea.c.
21927
21928 * cipher/idea.c (cipher): Rework parameter use to fix alignment
21929 problems.
21930
21931 * cipher/idea.c (FNCCAST_SETKEY, FNCCAST_CRYPT): Remove unused macros.
21932
21933
21934 (cherry picked from 4cd279556777e02eda79973f68efaa4b741f9175)
21935
21936 2013-04-18 Vladimir Serbinenko <[email protected]>
21937
21938 Add some const attributes.
21939 + commit ff0b94c22b36600fff1db9f1d48f9de61f9038f7
21940 * cipher/md4.c (transform): Add const attribute.
21941 * cipher/md5.c (transform): Ditto.
21942 * cipher/rmd160.c (transform): Ditto.
21943
21944 Fix alignment problem in serpent.c.
21945 + commit 86e72b490a5790a9c23341067c7e4d3e38be1634
21946 * cipher/serpent.c (serpent_key_prepare): Fix misaligned access.
21947 (serpent_setkey): Likewise.
21948 (serpent_encrypt_internal): Likewise.
21949 (serpent_decrypt_internal): Likewise.
21950 (serpent_encrypt): Don't put an alignment-increasing cast.
21951 (serpent_decrypt): Likewise.
21952 (serpent_test): Likewise.
21953
21954 2013-04-16 Werner Koch <[email protected]>
21955
21956 Fix multiply by zero in gcry_mpi_ec_mul.
21957 + commit 78cd0ba8a8eceee9d0b3397a2ab3bda6ba37c8a4
21958 * mpi/ec.c (_gcry_mpi_ec_mul_point): Handle case of SCALAR == 0.
21959 * tests/t-mpi-point.c (basic_ec_math): Add a test case for this.
21960
21961 2013-04-15 Werner Koch <[email protected]>
21962
21963 Add macros to return pre-defined MPIs.
21964 + commit bd3afc27459a44df8cf501a7e1ae37bb849a8b0e
21965 * src/gcrypt.h.in (GCRYMPI_CONST_ONE, GCRYMPI_CONST_TWO)
21966 (GCRYMPI_CONST_THREE, GCRYMPI_CONST_FOUR, GCRYMPI_CONST_EIGHT): New.
21967 (_gcry_mpi_get_const): New private function.
21968 * src/visibility.c (_gcry_mpi_get_const): New.
21969 * src/visibility.h: Mark it visible.
21970
21971 Fix addition of EC points.
21972 + commit 71b25a5562f68aad81eae52cc1bab9ca7731a7e9
21973 * mpi/ec.c (_gcry_mpi_ec_add_points): Fix case of P1 given in affine
21974 coordinates.
21975
21976 2013-04-12 Werner Koch <[email protected]>
21977
21978 Add hack to allow using an "ecc" key for "ecdsa" or "ecdh".
21979 + commit af8a79aea80217a0c85a592db1fa001792a6bf0f
21980 * cipher/pubkey.c (sexp_to_key): Add optional arg USE.
21981 (gcry_pk_encrypt, gcry_pk_decrypt): Call sexp_to_key with usage sign.
21982 (gcry_pk_sign, gcry_pk_verify): Call sexp_to_key with usage encrypt.
21983 * tests/basic.c (show_sexp): New.
21984 (check_pubkey_sign): Print test number and add cases for ecc.
21985 (check_pubkey_sign_ecdsa): New.
21986 (do_check_one_pubkey): Divert to new function.
21987
21988 2013-04-11 Werner Koch <[email protected]>
21989
21990 Add gcry_pubkey_get_sexp.
21991 + commit 1f3cfad66456dd6f2e48f20b8eb0c51343449a1c
21992 * src/gcrypt.h.in (GCRY_PK_GET_PUBKEY): New.
21993 (GCRY_PK_GET_SECKEY): New.
21994 (gcry_pubkey_get_sexp): New.
21995 * src/visibility.c (gcry_pubkey_get_sexp): New.
21996 * src/visibility.h (gcry_pubkey_get_sexp): Mark visible.
21997 * src/libgcrypt.def, src/libgcrypt.vers: Add new function.
21998 * cipher/pubkey-internal.h: New.
21999 * cipher/Makefile.am (libcipher_la_SOURCES): Add new file.
22000 * cipher/ecc.c: Include pubkey-internal.h
22001 (_gcry_pk_ecc_get_sexp): New.
22002 * cipher/pubkey.c: Include pubkey-internal.h and context.h.
22003 (_gcry_pubkey_get_sexp): New.
22004 * src/context.c (_gcry_ctx_find_pointer): New.
22005 * src/cipher-proto.h: Add _gcry_pubkey_get_sexp.
22006 * tests/t-mpi-point.c (print_sexp): New.
22007 (context_param, basic_ec_math_simplified): Add tests for the new
22008 function.
22009
22010 * configure.ac (NEED_GPG_ERROR_VERSION): Set to 1.11.
22011 (AH_BOTTOM) Add error codes from gpg-error 1.12
22012 * src/g10lib.h (fips_not_operational): Use GPG_ERR_NOT_OPERATIONAL.
22013
22014 * mpi/ec.c (_gcry_mpi_ec_get_mpi): Fix computation of Q.
22015 (_gcry_mpi_ec_get_point): Ditto.
22016
22017 Remove unused code.
22018 + commit 7524da2ba83d83a766c22d704006380c893e1c49
22019 * cipher/pubkey.c (_gcry_pk_module_lookup, _gcry_pk_module_release)
22020 (_gcry_pk_get_elements): Remove.
22021
22022 2013-04-05 Werner Koch <[email protected]>
22023
22024 Make the Q parameter optional for ECC signing.
22025 + commit fe91a642c7c257aca095b96406fbcace88fa3df4
22026 * cipher/ecc.c (ecc_sign): Remove the need for Q.
22027 * cipher/pubkey.c (sexp_elements_extract_ecc): Make Q optional for a
22028 private key.
22029 (sexp_to_key): Add optional arg R_IS_ECC.
22030 (gcry_pk_sign): Do not call gcry_pk_get_nbits for ECC keys.
22031 * tests/pubkey.c (die): Make sure to print a LF.
22032 (check_ecc_sample_key): New.
22033 (main): Call new test.
22034
22035 Add test case for SCRYPT and rework the code.
22036 + commit f23a068bcb6ec9788710698578d8be0a2a006dbc
22037 * tests/t-kdf.c (check_scrypt): New.
22038 (main): Call new test.
22039
22040 * configure.ac: Support disabling of the scrypt algorithm. Make KDF
22041 enabling similar to the other algorithm classes. Disable scrypt if we
22042 don't have a 64 bit type.
22043 * cipher/memxor.c, cipher/memxor.h: Remove.
22044 * cipher/scrypt.h: Remove.
22045 * cipher/kdf-internal.h: New.
22046 * cipher/Makefile.am: Remove files. Add new file. Move scrypt.c to
22047 EXTRA_libcipher_la_SOURCES.
22048 (GCRYPT_MODULES): Add GCRYPT_KDFS.
22049 * src/gcrypt.h.in (GCRY_KDF_SCRYPT): Change value.
22050 * cipher/kdf.c (pkdf2): Rename to _gcry_kdf_pkdf2.
22051 (_gcry_kdf_pkdf2): Don't bail out for SALTLEN==0.
22052 (gcry_kdf_derive): Allow for a passwordlen of zero for scrypt. Check
22053 for SALTLEN > 0 for GCRY_KDF_PBKDF2. Pass algo to _gcry_kdf_scrypt.
22054 (gcry_kdf_derive) [!USE_SCRYPT]: Return an error.
22055 * cipher/scrypt.c: Replace memxor.h by bufhelp.h. Replace scrypt.h by
22056 kdf-internal.h. Enable code only if HAVE_U64_TYPEDEF is defined.
22057 Replace C99 types uint64_t, uint32_t, and uint8_t by libgcrypt types.
22058 (_SALSA20_INPUT_LENGTH): Remove underscore from identifier.
22059 (_scryptBlockMix): Replace memxor by buf_xor.
22060 (_gcry_kdf_scrypt): Use gcry_malloc and gcry_free. Check for integer
22061 overflow. Add hack to support blocksize of 1 for tests. Return
22062 errors from calls to _gcry_kdf_pkdf2.
22063
22064 * cipher/kdf.c (openpgp_s2k): Make static.
22065
22066 2013-04-04 Christian Grothoff <[email protected]>
22067
22068 Add the SCRYPT KDF function.
22069 + commit 855b1a8f81b5a3b5b31d0c3c303675425f58a5af
22070 * scrypt.c, scrypt.h: New files.
22071 * memxor.c, memxor.h: New files.
22072 * cipher/Makefile.am: Add new files.
22073 * cipher/kdf.c (gcry_kdf_derive): Support GCRY_KDF_SCRYPT.
22074 * src/gcrypt.h.in (GCRY_KDF_SCRYPT): New.
22075
22076 2013-03-22 Werner Koch <[email protected]>
22077
22078 Replace deprecated AM_CONFIG_HEADER macro.
22079 + commit d0c8fda5af45354ac32928c9a01e688d6893599d
22080 * configure.ac: s/AM_CONFIG_HEADER/AC_CONFIG_HEADER/
22081
22082 Disable AES-NI support if as does not support SSSE3.
22083 + commit 9f4df1612ae21a5ce70d98930cb194e5193f5e2d
22084 * configure.ac (HAVE_GCC_INLINE_ASM_SSSE3): New test.
22085 (ENABLE_AESNI_SUPPORT): Do not define without SSSE3 support.
22086 (HAVE_GCC_INLINE_ASM_SSSE3, ENABLE_AVX_SUPPORT): Split up detection
22087 and definition.
22088
22089 2013-03-21 Werner Koch <[email protected]>
22090
22091 Fix make dependency regression.
22092 + commit 2a1e03c5a481689c43d197dd8034a1d73de0a1a4
22093 * src/Makefile.am (libgcrypt_la_DEPENDENCIES): Add missing backslash.
22094 Reported by LRN.
22095
22096 2013-03-20 Werner Koch <[email protected]>
22097
22098 Use finer grained on-the-fly helper computations for EC.
22099 + commit 5fb3501aa0cf5f2b2a9012706bb9ad2b1c4bfd7d
22100 * src/ec-context.h (mpi_ec_ctx_s): Replace NEED_SYNC by a bitfield.
22101 * mpi/ec.c (ec_p_sync): Remove.
22102 (ec_get_reset, ec_get_a_is_pminus3, ec_get_two_inv_p): New.
22103 (ec_p_init): Use ec_get_reset.
22104 (_gcry_mpi_ec_set_mpi, _gcry_mpi_ec_dup_point)
22105 (_gcry_mpi_ec_add_points): Replace ec_p_sync by the ec_get_ accessors.
22106
22107 Allow building with w64-mingw32.
22108 + commit b402e550041782b770a6ae267c7c28ca8324a12e
22109 * autogen.sh <--build-w32>: Support the w64-mingw32 toolchain. Also
22110 prepare for 64 bit building.
22111
22112 Provide GCRYPT_VERSION_NUMBER macro, add build info to the binary.
22113 + commit 1eaad0a8c4cab227685a6a8768e539df2f1f4dac
22114 * src/gcrypt.h.in (GCRYPT_VERSION_NUMBER): New.
22115 * configure.ac (VERSION_NUMBER): New ac_subst.
22116 * src/global.c (_gcry_vcontrol): Move call to above function ...
22117 (gcry_check_version): .. here.
22118
22119 * configure.ac (BUILD_REVISION, BUILD_FILEVERSION)
22120 (BUILD_TIMESTAMP): Define on all platforms.
22121 * compat/compat.c (_gcry_compat_identification): Include revision and
22122 timestamp.
22123
22124 Fix a memory leak in the new EC code.
22125 + commit de07974d807b703a2554d6ba885ea249e648bd44
22126 * cipher/ecc.c (point_from_keyparam): Always call mpi_free on A.
22127
22128 2013-03-19 Werner Koch <[email protected]>
22129
22130 Extend the new EC interface and fix two bugs.
22131 + commit 931e409e877d1e444edd53dead327ec8e64daf9a
22132 * src/ec-context.h (mpi_ec_ctx_s): Add field NEED_SYNC.
22133 * mpi/ec.c (ec_p_sync): New.
22134 (ec_p_init): Only set NEED_SYNC.
22135 (_gcry_mpi_ec_set_mpi): Set NEED_SYNC for 'p' and 'a'.
22136 (_gcry_mpi_ec_dup_point, _gcry_mpi_ec_add_points)
22137 (_gcry_mpi_ec_mul_point): Call ec_p_sync.
22138 (_gcry_mpi_ec_get_point): Recompute 'q' is needed.
22139 (_gcry_mpi_ec_get_mpi): Ditto. Also allow for names 'q', 'q.x',
22140 'q.y', and 'g'.
22141 * cipher/ecc.c (_gcry_mpi_ec_ec2os): New.
22142
22143 * cipher/ecc.c (_gcry_mpi_ec_new): Fix init from parameters 'Q'->'q',
22144 'G'->'q'.
22145
22146 2013-03-15 Werner Koch <[email protected]>
22147
22148 mpi: Add functions to manipulate an EC context.
22149 + commit 229f3219f80c9369ed9624242c0436ae6d293201
22150 * src/gcrypt.h.in (gcry_mpi_ec_p_new): Remove.
22151 (gcry_mpi_ec_new): New.
22152 (gcry_mpi_ec_get_mpi): New.
22153 (gcry_mpi_ec_get_point): New.
22154 (gcry_mpi_ec_set_mpi): New.
22155 (gcry_mpi_ec_set_point): New.
22156 * src/visibility.c (gcry_mpi_ec_p_new): Remove.
22157 * mpi/ec.c (_gcry_mpi_ec_p_new): Make it an internal function and
22158 change to return an error code.
22159 (_gcry_mpi_ec_get_mpi): New.
22160 (_gcry_mpi_ec_get_point): New.
22161 (_gcry_mpi_ec_set_mpi): New.
22162 (_gcry_mpi_ec_set_point): New.
22163 * src/mpi.h: Add new prototypes.
22164 * src/ec-context.h: New.
22165 * mpi/ec.c: Include that header.
22166 (mpi_ec_ctx_s): Move to ec-context.h, add new fields, and put some
22167 fields into an inner struct.
22168 (point_copy): New.
22169 * cipher/ecc.c (fill_in_curve): Allow passing NULL for R_NBITS.
22170 (mpi_from_keyparam, point_from_keyparam): New.
22171 (_gcry_mpi_ec_new): New.
22172
22173 * tests/t-mpi-point.c (test-curve): New.
22174 (ec_p_new): New. Use it instead of the removed gcry_mpi_ec_p_new.
22175 (get_and_cmp_mpi, get_and_cmp_point): New.
22176 (context_param): New test.
22177 (basic_ec_math_simplified): New test.
22178 (main): Call new tests.
22179
22180 * src/context.c (_gcry_ctx_get_pointer): Check for a NULL CTX.
22181
22182 2013-03-13 Werner Koch <[email protected]>
22183
22184 Add GCRYMPI_FLAG_CONST and make use constants.
22185 + commit e005629bd7bebb3e13945645c6e1230b44ab16a2
22186 * src/gcrypt.h.in (GCRYMPI_FLAG_CONST): New.
22187 * src/mpi.h (mpi_is_const, mpi_const): New.
22188 (enum gcry_mpi_constants, MPI_NUMBER_OF_CONSTANTS): New.
22189 * mpi/mpiutil.c (_gcry_mpi_init): New.
22190 (constants): New.
22191 (_gcry_mpi_free): Do not release a constant flagged MPI.
22192 (gcry_mpi_copy): Clear the const and immutable flags.
22193 (gcry_mpi_set_flag, gcry_mpi_clear_flag, gcry_mpi_get_flag): Support
22194 GCRYMPI_FLAG_CONST.
22195 (_gcry_mpi_const): New.
22196 * src/global.c (global_init): Call _gcry_mpi_init.
22197 * mpi/ec.c (mpi_ec_ctx_s): Remove fields one, two, three, four, and
22198 eight. Change all users to call mpi_const() instead.
22199
22200 * src/mpiutils.c (gcry_mpi_set_opaque): Check the immutable flag.
22201
22202 Add GCRYMPI_FLAG_IMMUTABLE to help debugging.
22203 + commit 1fecae98ee7e0fa49b29f98efa6817ca121ed98a
22204 * src/gcrypt.h.in (GCRYMPI_FLAG_IMMUTABLE): New.
22205 * src/mpi.h (mpi_is_immutable): New macro.
22206 * mpi/mpiutil.c (gcry_mpi_set_flag, gcry_mpi_clear_flag)
22207 (gcry_mpi_get_flag): Implement new flag
22208 (_gcry_mpi_immutable_failed): New.
22209
22210 * mpi/mpiutil.c (_gcry_mpi_clear, _gcry_mpi_free, gcry_mpi_snatch)
22211 (gcry_mpi_set, gcry_mpi_randomize): Act upon the immutable flag.
22212 * mpi/mpi-bit.c (gcry_mpi_set_bit, gcry_mpi_set_highbit)
22213 (gcry_mpi_clear_highbit, gcry_mpi_clear_bit)
22214 (_gcry_mpi_rshift_limbs, gcry_mpi_lshift): Ditto.
22215 * mpi/mpicoder.c (_gcry_mpi_set_buffer): Ditto.
22216
22217 2013-03-08 Werner Koch <[email protected]>
22218
22219 mpi: Add an API for EC math.
22220 + commit 8ac9e756d3ca545a9b97e61ad3d42fc2e877d788
22221 * src/context.c, src/context.h: New.
22222 * src/Makefile.am (libgcrypt_la_SOURCES): Add new files.
22223 * src/gcrypt.h.in (struct gcry_context, gcry_ctx_t): New types.
22224 (gcry_ctx_release): New prototype.
22225 (gcry_mpi_ec_p_new, gcry_mpi_ec_get_affine, gcry_mpi_ec_dup)
22226 (gcry_mpi_ec_add, gcry_mpi_ec_mul): New prototypes.
22227 * mpi/ec.c: Include errno.h and context.h.
22228 (_gcry_mpi_ec_init): Rename to ..
22229 (ec_p_init): this, make static, remove allocation and add arg CTX.
22230 (_gcry_mpi_ec_p_internal_new): New; to replace _gcry_mpi_ec_init.
22231 Change all callers to use this func.
22232 (_gcry_mpi_ec_free): Factor code out to ..
22233 (ec_deinit): New func.
22234 (gcry_mpi_ec_p_new): New.
22235 * src/visibility.c: Include context.h and mpi.h.
22236 (gcry_mpi_ec_p_new, gcry_mpi_ec_get_affine, gcry_mpi_ec_dup)
22237 (gcry_mpi_ec_add, gcry_mpi_ec_mul)
22238 (gcry_ctx_release): New wrapper functions.
22239 * src/visibility.h: Mark new wrapper functions visible.
22240 * src/libgcrypt.def, src/libgcrypt.vers: Add new symbols.
22241 * tests/t-mpi-point.c (print_mpi, hex2mpi, cmp_mpihex): New.
22242 (context_alloc): New.
22243 (make_point, basic_ec_math): New.
22244
22245 mpi: Add an API for EC point operations.
22246 + commit 7cce620acddac2df024ca421ed3abc32a88f3738
22247 * mpi/ec.c (gcry_mpi_point_new, gcry_mpi_point_release): New.
22248 (gcry_mpi_point_get, gcry_mpi_point_snatch_get): New.
22249 (gcry_mpi_point_set, gcry_mpi_point_snatch_set): New.
22250 * src/visibility.h, src/visibility.c: Add corresponding macros and
22251 wrappers.
22252 * src/gcrypt.h.in (struct gcry_mpi_point, gcry_mpi_point_t): New.
22253 (gcry_mpi_point_new, gcry_mpi_point_release, gcry_mpi_point_get)
22254 (gcry_mpi_point_snatch_get, gcry_mpi_point_set)
22255 (gcry_mpi_point_snatch_set): New prototypes.
22256 (mpi_point_new, mpi_point_release, mpi_point_get, mpi_point_snatch_get)
22257 (mpi_point_set, mpi_point_snatch_set): New macros.
22258 * src/libgcrypt.vers (gcry_mpi_point_new, gcry_mpi_point_release)
22259 (gcry_mpi_point_get, gcry_mpi_point_snatch_get, gcry_mpi_point_set)
22260 (gcry_mpi_point_snatch_set): New symbols.
22261 * src/libgcrypt.def: Ditto.
22262 * tests/t-mpi-point.c: New.
22263 * tests/Makefile.am (TESTS): Add t-mpi-point
22264
22265 2013-03-07 Werner Koch <[email protected]>
22266
22267 mpi: Add mpi_snatch and change an internal typedef.
22268 + commit 6c4767637c512127a4362732b3ec51068554d328
22269 * src/mpi.h (struct mpi_point_s): Rename to struct gcry_mpi_point.
22270 (mpi_point_struct): New typedef.
22271 (mpi_point_t): Change typedef to a pointer. Replace all occurrences
22272 to use mpi_point_struct.
22273 * mpi/ec.c (_gcry_mpi_ec_point_init): Rename to ..
22274 (_gcry_mpi_point_init): this. Change all callers.
22275 (_gcry_mpi_ec_point_free): Rename to ..
22276 (_gcry_mpi_point_free_parts): this. Change all callers.
22277
22278 * mpi/mpiutil.c (gcry_mpi_snatch): New function.
22279 * src/gcrypt.h.in (gcry_mpi_snatch, mpi_snatch): Add protoype and
22280 macro.
22281 * src/visibility.c (gcry_mpi_snatch): Add wrapper.
22282 * src/visibility.h (gcry_mpi_snatch): Add macro magic.
22283 * src/libgcrypt.def, src/libgcrypt.vers: Add new function.
22284
22285 Pretty print the configure feedback.
22286 + commit c620099e4ab2f35e0196b395a805bb655c984ac2
22287 * acinclude.m4 (GNUPG_MSG_PRINT): Remove.
22288 (GCRY_MSG_SHOW, GCRY_MSG_WRAP): New.
22289 * configure.ac: Use new macros for the feedback.
22290
22291 2013-02-20 Werner Koch <[email protected]>
22292
22293 Fix building of hwf-x86.c.
22294 + commit 70dcac663de06b012417015c175973d64e6980df
22295 * src/Makefile.am (AM_CFLAGS): Set to GPG_ERROR_CFLAGS
22296 (AM_CCASFLAGS): Set NOEXECSTACK_FLAGS.
22297
22298 Remove build hacks for FreeBSD.
22299 + commit fb48ebf7081400a24ee48f8a9894a361e8834b6e
22300 * configure.ac [freebsd]: Do not add /usr/local to CPPFLAGS and
22301 LDFLAGS.
22302
22303 2013-02-19 Jussi Kivilinna <[email protected]>
22304
22305 Rinjdael: Fix use of SSE2 outside USE_AESNI/ctx->use_aesni.
22306 + commit 0da77955a097bfd2469ad084b3e9fcac4fb1e3fa
22307 * cipher/rijndael.c (_gcry_aes_cbc_enc): Check if AES-NI is enabled before
22308 calling aesni_prepare() and aesni_cleanup().
22309
22310 Add AES-NI/AVX accelerated Camellia implementation.
22311 + commit 63ac3ba07dba82fde040d31b90b4eff627bd92b9
22312 * configure.ac: Add option --disable-avx-support.
22313 (HAVE_GCC_INLINE_ASM_AVX): New.
22314 (ENABLE_AVX_SUPPORT): New.
22315 (camellia) [ENABLE_AVX_SUPPORT, ENABLE_AESNI_SUPPORT]: Add
22316 camellia_aesni_avx_x86-64.lo.
22317 * cipher/Makefile.am (AM_CCASFLAGS): Add.
22318 (EXTRA_libcipher_la_SOURCES): Add camellia_aesni_avx_x86-64.S
22319 * cipher/camellia-glue.c [ENABLE_AESNI_SUPPORT, ENABLE_AVX_SUPPORT]
22320 [__x86_64__] (USE_AESNI_AVX): Add macro.
22321 (struct Camellia_context) [USE_AESNI_AVX]: Add use_aesni_avx.
22322 [USE_AESNI_AVX] (_gcry_camellia_aesni_avx_ctr_enc)
22323 (_gcry_camellia_aesni_avx_cbc_dec): New prototypes to assembly
22324 functions.
22325 (camellia_setkey) [USE_AESNI_AVX]: Enable AES-NI/AVX if hardware
22326 support both.
22327 (_gcry_camellia_ctr_enc) [USE_AESNI_AVX]: Add AES-NI/AVX code.
22328 (_gcry_camellia_cbc_dec) [USE_AESNI_AVX]: Add AES-NI/AVX code.
22329 * cipher/camellia_aesni_avx_x86-64.S: New.
22330 * src/g10lib.h (HWF_INTEL_AVX): New.
22331 * src/global.c (hwflist): Add HWF_INTEL_AVX.
22332 * src/hwf-x86.c (detect_x86_gnuc) [ENABLE_AVX_SUPPORT]: Add detection
22333 for AVX.
22334
22335 camellia.c: Prepare for AES-NI/AVX implementation.
22336 + commit 4de62d80644228fc5db2a9f9c94a7eb633d8de2e
22337 * cipher/camellia-glue.c (CAMELLIA_encrypt_stack_burn_size)
22338 (CAMELLIA_decrypt_stack_burn_size): Increase stack burn size.
22339 * cipher/camellia.c (CAMELLIA_ROUNDSM): Move key-material mixing in
22340 the front.
22341 (camellia_setup128, camellia_setup256): Remove now unneeded
22342 key-material mangling.
22343 (camellia_encrypt128, camellia_decrypt128, amellia_encrypt256)
22344 (camellia_decrypt256): Copy block to stack, so that compiler can
22345 optimize it for register usage.
22346
22347 Camellia, prepare glue code for AES-NI/AVX implementation.
22348 + commit 537f12ce072d568f9fa344c447d32b2e0efffbe8
22349 * cipher/camellia-glue.c (ATTR_ALIGNED_16): Add macro.
22350 (CAMELLIA_encrypt_stack_burn_size): Add macro.
22351 (camellia_encrypt): Use macro above for stack burn size.
22352 (CAMELLIA_decrypt_stack_burn_size): Add macro.
22353 (camellia_decrypt): Use macro above for stack burn size.
22354 (_gcry_camellia_ctr_enc): New function.
22355 (_gcry_camellia_cbc_dec): New function.
22356 (selftest_ctr_128): New function.
22357 (selftest): Call function above.
22358 * cipher/cipher.c (gcry_cipher_open) [USE_CAMELLIA]: Register bulk
22359 functions for CBC-decryption and CTR-mode.
22360 * src/cipher.h (_gcry_camellia_ctr_enc): New prototype.
22361 (_gcry_camellia_cbc_dec): New prototype.
22362
22363 2012-12-21 Werner Koch <[email protected]>
22364
22365 Prepare for hardware feature detection on other platforms.
22366 + commit 09ac5d87d11aa0b1fa0e0a4184ab03b3671a73e2
22367 * configure.ac (GCRYPT_HWF_MODULES): New.
22368 (HAVE_CPU_ARCH_X86, HAVE_CPU_ARCH_ALPHA, HAVE_CPU_ARCH_SPARC)
22369 (HAVE_CPU_ARCH_MIPS, HAVE_CPU_ARCH_M68K, HAVE_CPU_ARCH_PPC)
22370 (HAVE_CPU_ARCH_ARM): New AC_DEFINEs.
22371 * mpi/config.links (mpi_cpu_arch): New.
22372 * src/global.c (print_config): Print new tag "cpu-arch".
22373 * src/Makefile.am (libgcrypt_la_SOURCES): Add hwf-common.h
22374 (EXTRA_libgcrypt_la_SOURCES): New.
22375 (gcrypt_hwf_modules): New.
22376 (libgcrypt_la_DEPENDENCIES, libgcrypt_la_LIBADD): Add that one.
22377 * src/hwfeatures.c: Factor most code out to ...
22378 * src/hwf-x86.c: New file.
22379 (detect_x86_gnuc): Return the feature vector.
22380 (_gcry_hwf_detect_x86): New.
22381 * src/hwf-common.h: New.
22382 * src/hwfeatures.c (_gcry_detect_hw_features): Dispatch using
22383 HAVE_CPU_ARCH_ macros.
22384
22385 2012-12-21 Jussi Kivilinna <[email protected]>
22386
22387 Clean up i386/x86-64 cpuid usage in hwfeatures.c.
22388 + commit d842eea55e22c05da3959a7a4422b5fcd7884f60
22389 * src/hwfeatures.c [__i386__ && __GNUC__] (detect_ia32_gnuc): Remove.
22390 [__x86_64__ && __GNUC__] (detect_x86_64_gnuc): Remove.
22391 [__i386__ && __GNUC__] (is_cpuid_available, get_cpuid)
22392 (HAS_X86_CPUID): New.
22393 [__x86_64__ && __GNUC__] (is_cpuid_available, get_cpuid)
22394 (HAS_X86_CPUID): New.
22395 [HAS_X86_CPUID] (detect_x86_gnuc): New.
22396 (_gcry_detect_hw_features) [__i386__ && GNUC]: Remove detect_ia32_gnuc
22397 call.
22398 (_gcry_detect_hw_features) [__x86_64__ && GNUC]: Remove
22399 detect_x86_64_gnuc call.
22400 (_gcry_detect_hw_features) [HAS_X86_CPUID]: Add detect_x86_gnuc call.
22401
22402 2012-12-18 Dmitry Kasatkin <[email protected]>
22403
22404 Add support for using DRNG random number generator.
22405 + commit efd7002188e6d50013e4d9a920a8b9afa9d210e5
22406 * configure.ac: Add option --disable-drng-support.
22407 (ENABLE_DRNG_SUPPORT): New.
22408 * random/rndhw.c (USE_DRNG): New.
22409 (rdrand_long, rdrand_nlong, poll_drng): New.
22410 (_gcry_rndhw_poll_fast, _gcry_rndhw_poll_slow): Call poll function.
22411 * src/g10lib.h (HWF_INTEL_RDRAND): New.
22412 * src/global.c (hwflist): Add "intel-rdrand".
22413 * src/hwfeatures.c (detect_x86_64_gnuc) [ENABLE_DRNG_SUPPORT]: Detect
22414 RDRAND.
22415 (detect_ia32_gnuc) [ENABLE_DRNG_SUPPORT]: Detect RDRAND.
22416
22417 2012-12-03 Werner Koch <[email protected]>
22418
22419 random: Add a RNG selection interface and system RNG wrapper.
22420 + commit 7607ab81504ce44060ed0b331d309606f5da1e75
22421 * random/random-system.c: New.
22422 * random/Makefile.am (librandom_la_SOURCES): Add new module.
22423 * random/random.c (struct rng_types): New.
22424 (_gcry_set_preferred_rng_type, _gcry_get_rng_type): New.
22425 (_gcry_random_initialize, gcry_random_add_bytes, do_randomize)
22426 (_gcry_set_random_seed_file, _gcry_update_random_seed_file)
22427 (_gcry_fast_random_poll): Dispatch to the actual RNG.
22428 * src/gcrypt.h.in (GCRYCTL_SET_PREFERRED_RNG_TYPE): New.
22429 GCRYCTL_GET_CURRENT_RNG_TYPE): New.
22430 (gcry_rng_types): New.
22431 * src/global.c (print_config): Print the TNG type.
22432 (global_init, _gcry_vcontrol): Implement the new control codes.
22433 * doc/gcrypt.texi (Controlling the library): Document the new control
22434 codes.
22435
22436 * tests/benchmark.c (main): Add options to test the RNG types.
22437 * tests/random.c (main): Add new options.
22438 (print_hex): Print to stderr.
22439 (progress_cb, rng_type): New.
22440 (check_rng_type_switching, check_early_rng_type_switching): New.
22441 (run_all_rng_tests): New.
22442
22443 tests: Allow use of random.c under Windows.
22444 + commit 76c622e24a07f7c826812be173aa173b4334776b
22445 * tests/Makefile.am (TESTS): Always include random.c
22446 * tests/random.c [!W32]: Include sys/wait.h.
22447 (inf): New.
22448 (check_forking, check_nonce_forking): Print a notice what will be done.
22449 (main) [W32]: Do not call signal.
22450
22451 Make random-fips.c work multi-threaded.
22452 + commit 75760021b511ba438606af746431223357e7a155
22453 * random/random-fips.c (basic_initialization): Fix reversed logic.
22454
22455 Move nonce creation from csprng backend to random main module.
22456 + commit c324644aa14e54fc7051983b38222db32b8ab227
22457 * random/random-csprng.c (_gcry_rngcsprng_create_nonce): Remove.
22458 (nonce_buffer_lock): Remove.
22459 (initialize_basics): Remove init of nonce_buffer_lock.
22460 * random/random.c: Add a few header files.
22461 (nonce_buffer_lock): New.
22462 (_gcry_random_initialize): Init nonce_buffer_lock.
22463 (gcry_create_nonce): Add code from _gcry_rngcsprng_create_nonce.
22464
22465 * random/random-daemon.c (_gcry_daemon_create_nonce): Remove.
22466
22467 2012-12-03 Jussi Kivilinna <[email protected]>
22468
22469 Fix building with CC="gcc -std=c90".
22470 + commit f851b9a932ee64fa5a06000d1ac763ba4349f07d
22471 * configure.ac: Add check for missing 'asm' keyword in C90 mode and
22472 replacement with '__asm__'.
22473
22474 2012-12-03 Werner Koch <[email protected]>
22475
22476 Try to use inttypes.h if stdint.h is not available.
22477 + commit d9ec7aec1301b13a89e5c9c54d7ad52e1a29b846
22478 * cipher/bufhelp.h [HAVE_INTTYPES_H]: Include inttypes.h
22479
22480 2012-12-03 Jussi Kivilinna <[email protected]>
22481
22482 Optimize buffer xoring.
22483 + commit 162791bc08f4fc9b3882671e68ecdfd9e130ae59
22484 * cipher/Makefile.am (libcipher_la_SOURCES): Add 'bufhelp.h'.
22485 * cipher/bufhelp.h: New.
22486 * cipher/cipher-aeswrap.c (_gcry_cipher_aeswrap_encrypt)
22487 (_gcry_cipher_aeswrap_decrypt): Use 'buf_xor' for buffer xoring.
22488 * cipher/cipher-cbc.c (_gcry_cipher_cbc_encrypt)
22489 (_gcry_cipher_cbc_decrypt): Use 'buf_xor' for buffer xoring and remove
22490 resulting unused variables.
22491 * cipher/cipher-cfb.c (_gcry_cipher_cfb_encrypt) Use 'buf_xor_2dst'
22492 for buffer xoring and remove resulting unused variables.
22493 (_gcry_cipher_cfb_decrypt): Use 'buf_xor_n_copy' for buffer xoring and
22494 remove resulting unused variables.
22495 * cipher/cipher-ctr.c (_gcry_cipher_ctr_encrypt): Use 'buf_xor' for
22496 buffer xoring and remove resulting unused variables.
22497 * cipher/cipher-ofb.c (_gcry_cipher_ofb_encrypt)
22498 (_gcry_cipher_ofb_decrypt): Use 'buf_xor' for buffer xoring and remove
22499 resulting used variables.
22500 * cipher/rijndael.c (_gry_aes_cfb_enc): Use 'buf_xor_2dst' for buffer
22501 xoring and remove resulting unused variables.
22502 (_gry_aes_cfb_dev): Use 'buf_xor_n_copy' for buffer xoring and remove
22503 resulting unused variables.
22504 (_gry_aes_cbc_enc, _gry_aes_ctr_enc, _gry_aes_cbc_dec): Use 'buf_xor'
22505 for buffer xoring and remove resulting unused variables.
22506
22507 2012-11-29 Jussi Kivilinna <[email protected]>
22508
22509 Optimize AES-NI CTR mode.
22510 + commit 9ee9e25f519696d509b1a5c1cc04ab0121e98a51
22511 * cipher/rijndael.c [USE_AESNI] (do_aesni_ctr, do_aesni_ctr_4): Make
22512 handling of 64-bit overflow and carry conditional. Avoid generic to
22513 vector register passing of value '1'. Generate and use '-1' instead.
22514
22515 2012-11-28 Werner Koch <[email protected]>
22516
22517 Make a cpp conditional in rijndael.c better readable.
22518 + commit 6765e0a8618000d3dc7bda035163e0708c43791b
22519 * cipher/rijndael.c (USE_AESNI): Modify cpp conditionals for better
22520 readability.
22521
22522 2012-11-28 Jussi Kivilinna <[email protected]>
22523
22524 Fix building with Clang on x86-64 and i386.
22525 + commit 99e272d938fe23efec25af409bdb91dae0e659e5
22526 * cipher/rijndael.c [USE_AESNI] (do_aesni_enc_aligned)
22527 (do_aesni_dec_vec4, do_aesni_cfb, do_aesni_ctr, do_aesni_ctr_4): Add
22528 explicit suffix to 'cmp' instructions.
22529
22530 2012-11-26 Jussi Kivilinna <[email protected]>
22531
22532 Optimize wipememory2 for i386 and x86-64.
22533 + commit faec12e23f03c7cd1614594bfdd51f1302cadb42
22534 * src/g10lib.h (wipememory2): Add call to fast_wipememory2.
22535 (fast_wipememory2): New macros for i386 and x86-64 architectures.
22536 Empty macro provided for other architectures.
22537
22538 Fix missing 64bit carry handling in AES-NI CTR mode.
22539 + commit fc37e805c6394c2e635d1a033670be961f36a6d2
22540 * cipher/rijndael.c [USE_AESNI] (do_aesni_ctr, do_aesni_ctr_4): Add
22541 carry handling to 64-bit addition.
22542 (selftest_ctr_128): New function for testing IV handling in bulk CTR
22543 function.
22544 (selftest): Add call to selftest_ctr_128.
22545
22546 Add parallelized AES-NI CBC decryption.
22547 + commit 35aff0cd43885b5f5c076432ec614698abeb63d8
22548 * cipher/rijndael.c [USE_AESNI] (aesni_cleanup_5): New macro.
22549 [USE_AESNI] (do_aesni_dec_vec4): New function.
22550 (_gcry_aes_cbc_dec) [USE_AESNI]: Add parallelized CBC loop.
22551 (_gcry_aes_cbc_dec) [USE_AESNI]: Change IV storage register from xmm3
22552 to xmm5.
22553
22554 Clear xmm5 after use in AES-NI CTR mode.
22555 + commit 5acd0e5ae2a58dda51c2b56c879b80a1a6d2c42f
22556 * cipher/rijndael.c [USE_AESNI]: Rename aesni_cleanup_2_4 to
22557 aesni_cleanup_2_5.
22558 [USE_AESNI] (aesni_cleanup_2_5): Clear xmm5 register.
22559 (_gcry_aes_ctr_enc, _gcry_aes_cbc_dec) [USE_AESNI]: Use
22560 aesni_cleanup_2_5 instead of aesni_cleanup_2_4.
22561
22562 Optimize AES-NI CBC encryption.
22563 + commit be3768994ad362dfc849a8cd0146b4c9bb287d20
22564 * cipher/rijndeal.c (_gcry_aes_cbc_enc) [USE_AESNI]: Add AES-NI
22565 spesific loop and use SSE2 assembler for xoring and copying of
22566 blocks.
22567
22568 Improve parallelizability of CBC decryption for AES-NI.
22569 + commit 3369d960158ab4231b83926a0f982e2a8819f173
22570 * cipher/rijndael.c (_gcry_aes_cbc_dec) [USE_AESNI]: Add AES-NI
22571 specific CBC mode loop with temporary block and IV stored in free SSE
22572 registers.
22573
22574 Extend test of chained modes for 128bit ciphers.
22575 + commit 55b96be08531664ed3f4230acebe0f45954bbc33
22576 * tests/basic.c (check_one_cipher_core, check_one_cipher): Increase
22577 input and output buffer sizes from 16 bytes to 1024+16=1040 bytes.
22578 (check_one_cipher_core): Add asserts to verify sizes of temporary
22579 buffers.
22580
22581 2012-11-21 Werner Koch <[email protected]>
22582
22583 Fix for strict aliasing rules.
22584 + commit dfb4673da8ee52d95e0a62c9f49ca8599943f22e
22585 * cipher/rijndael.c (do_setkey, prepare_decryption): Use u32_a_t for
22586 casting.
22587
22588 Do not detect AES-NI support if disabled by configure.
22589 + commit 3047795794eb238aa684bd0729acf64c82a19e09
22590 * src/hwfeatures.c (detect_ia32_gnuc): Detect AESNI support only if
22591 that support has been enabled.
22592
22593 2012-11-21 Jussi Kivilinna <[email protected]>
22594
22595 Fix too large burn_stack in camellia-glue.c.
22596 + commit 8afabc2813948778a3db52d9dee9a041a3dd50d4
22597 * cipher/camellia-glue.c (camellia_encrypt, camellia_decrypt): Do not
22598 take full array size of KEY_TABLE_TYPE, but argument size instead.
22599
22600 Add x86_64 support for AES-NI.
22601 + commit d8bdfa42ed582655c180e7db9b16d4e756a12a6e
22602 * cipher/rijndael.c [ENABLE_AESNI_SUPPORT]: Enable USE_AESNI on x86-64.
22603 (do_setkey) [USE_AESNI_is_disabled_here]: Use %[key] and %[ksch]
22604 directly as registers instead of using temporary register %%esi.
22605 [USE_AESNI] (do_aesni_enc_aligned, do_aesni_dec_aligned, do_aesni_cfb,
22606 do_aesni_ctr, do_aesni_ctr_4): Use %[key] directly as register instead
22607 of using temporary register %%esi.
22608 [USE_AESNI] (do_aesni_cfb, do_aesni_ctr, do_aesni_ctr_4): Change %[key]
22609 from generic "g" type to register "r".
22610 * src/hwfeatures.c (_gcry_detect_hw_features) [__x86_64__]: Do not
22611 clear AES-NI feature flag.
22612
22613 Fix cpuid vendor-id check for i386 and x86-64.
22614 + commit 9e1552517f68459a165ddebbba85e7cf37ff4f0c
22615 * src/hwfeatures.c (detect_x86_64_gnuc, detect_ia32_gnuc): Allow
22616 Intel features be detect from CPU by other vendors too.
22617
22618 Fix hwdetect assembler clobbers.
22619 + commit 19b9efd1f47a5de9c450ce8212dfa3174a029c7a
22620 * src/hwfeatures.c (detect_x86_64_gnuc): Add missing %ebx assembler
22621 clobbers.
22622 (detect_x86_64_gnuc, detect_ia32_gnuc) [ENABLE_PADLOCK_SUPPORT]: Add
22623 missing %ecx assembler clobbers.
22624
22625 2012-11-21 Werner Koch <[email protected]>
22626
22627 Use configure test for aligned attribute.
22628 + commit 6368ed542150956ff4ba8170a15bbc534143675c
22629 * configure.ac (HAVE_GCC_ATTRIBUTE_ALIGNED): New test and ac_define.
22630 * cipher/cipher-internal.h, cipher/rijndael.c, random/rndhw.c: Use new
22631 macro instead of a fixed test for __GNUC__.
22632
22633 Fix segv with AES-NI on some platforms.
22634 + commit a96974de734beb51a733a89b3283bcf7b433b54c
22635 * cipher/rijndael.c (RIJNDAEL_context): Align on 16 bytes.
22636
22637 2012-11-16 Werner Koch <[email protected]>
22638
22639 Improve parsing of the GIT revision number.
22640 + commit 4b18e530f417d4af401a3fd721ad2a07e5310e3e
22641 * configure.ac (mmm4_revision): Use git rev-parse.
22642
22643 2012-11-08 Werner Koch <[email protected]>
22644
22645 Fix extern inline use for gcc > 4.3 in c99 mode.
22646 + commit 5abc06114e91beca0177331e1c79815f5fb6d7be
22647 * mpi/mpi-inline.h [!G10_MPI_INLINE_DECL]: Take care of changed extern
22648 inline semantics in gcc.
22649
22650 2012-11-07 Werner Koch <[email protected]>
22651
22652 Fix memory leak in gcry_pk_testkey for ECC.
22653 + commit 8cbbad5f94f6e0429fffe66d689aea20f7e35957
22654 * cipher/ecc.c (check_secret_key): Restructure for easier allocation
22655 tracking. Fix memory leak.
22656
22657 2012-11-05 Werner Koch <[email protected]>
22658
22659 Prepare for a backported interface in 1.5.1.
22660 + commit 7af98ef78d45e813f47ae4e180a02757a379953f
22661 * configure.ac: Bump LT version at C20/A0/R0 to adjust for a planned
22662 API update in 1.5.1.
22663
22664 Adjust for stricter autoconf requirements.
22665 + commit 1241fbbc896e9bbad68f1007a17b20493f6cd1af
22666 * configure.ac: Fix usage of AC_LANG_PROGRAM.
22667
22668 Update build helper scripts.
22669 + commit a5c4d45e8d12737cd21b095c81da5c18e2afc39e
22670 * config.guess, config.sub: Update to version 2012-07-31.
22671 * ltmain.sh: Update to version 2.4.2.
22672 * install-sh, m4/libtool.m4, m4/ltoptions.m4, m4/ltversion.m4
22673 * m4/lt~obsolete.m4: Update to autoconf 2.69 versions.
22674
22675 Do not distribute a copy of gitlog-to-changelog.
22676 + commit 40976d7da5420453bf93a9c99f0cc4c7044d0774
22677 * Makefile.am (GITLOG_TO_CHANGELOG): New.
22678 (gen-ChangeLog): Require an installed gitlog-to-changelog.
22679 * scripts/gitlog-to-changelog: Remove.
22680
22681 * README.SVN: Remove.
22682 * REMOVE.GIT: New.
22683
22684 Allow building with w64-mingw32.
22685 + commit 4f6fb150558d0ed250bfbd50352c258a4456ba50
22686 * autogen.sh <--build-w32>: Support the w64-mingw32 toolchain. Also
22687 prepare for 64 bit building.
22688 <git-setup>: Remove option -c from chmod.
22689
22690 Switch to the new automagic beta numbering scheme.
22691 + commit 7d5195be76d9dd4adc28976ad153e8f7761c5855
22692 * configure.ac: Add all the required m4 magic.
22693
22694 Avoid dereferencing pointer right after the end.
22695 + commit 79502e2c1982047dcf2b776f52826f38bbd9b1fe
22696 * mpi/mpicoder.c (do_get_buffer): Check the length before derefing P.
22697
22698 2012-10-30 Werner Koch <[email protected]>
22699
22700 Make ancient test program useful again.
22701 + commit 66adf76e634423bb72ce1f0b5ed78f4e4798f190
22702 * tests/testapi.c (test_sexp): Adjust to current API. Print the
22703 return code. Mark unused args.
22704 (test_genkey): Mark unused args.
22705 (main): Do not pass NULL to printf.
22706
22707 tests: Add ECC key generation tests.
22708 + commit c13164884ade6b1e945cddacce2d244fd881de6b
22709 * tests/keygen.c (check_generated_ecc_key): New.
22710 (check_ecc_keys): New.
22711 (main): Call simple ECC checks.
22712
22713 2012-10-30 Milan Broz <[email protected]>
22714
22715 PBKDF2: Allow empty passphrase.
22716 + commit 8528f1ba40e587dc17e02822e529fbd7ac69a189
22717 * cipher/kdf.c (gcry_kdf_derive): Allow empty passphrase for PBKDF2.
22718 * tests/t-kdf.c (check_pbkdf2): Add test case for above.
22719
22720 2012-08-16 Xi Wang <[email protected]>
22721
22722 Replace deliberate division by zero with _gcry_divide_by_zero.
22723 + commit 2c54c4da19d3a79e9f749740828026dd41f0521a
22724 * mpi/mpi-pow.c: Replace 1 / msize.
22725 * mpi/mpih-div.c: Replace 1 / dsize.
22726 * src/misc.c: Add _gcry_divide_by_zero.
22727
22728 2012-06-21 Werner Koch <[email protected]>
22729
22730 Clear AESNI feature flag for x86_64.
22731 + commit 2196728e2252917849c1be94417258076767021b
22732 * src/hwfeatures.c (_gcry_detect_hw_features) [__x86_64__]: Clear
22733 AESNI feature flag.
22734
22735 Beautify last change.
22736 + commit 20e423212c9710ee663e12dd0f62580ceb245a6f
22737 * cipher/rijndael.c: Replace C99 feature from last patch. Keep cpp
22738 lines short.
22739 * random/rndhw.c: Keep cpp lines short.
22740 * src/hwfeatures.c (_gcry_detect_hw_features): Make cpp def chain
22741 better readable.
22742
22743 2012-06-21 Rafaël Carré <[email protected]>
22744
22745 Enable VIA Padlock on x86_64 platforms.
22746 + commit baf0dc7e9c26167ab43ba2adebcf2f1abc9d9b3b
22747 * cipher/rijndael.c: Duplicate x86 assembly and convert to x86_64.
22748 * random/rndhw.c: Likewise.
22749 * src/hwfeatures.c: Likewise.
22750
22751 2012-05-14 Werner Koch <[email protected]>
22752
22753 Add curve aliases from RFC-5656.
22754 + commit 39c123b729a472ace039f8536d07f8b9a5f4675a
22755 * cipher/ecc.c (curve_aliases): Add "nistp???" entries.
22756
22757 2012-04-16 Werner Koch <[email protected]>
22758
22759 State new contribution rules.
22760 + commit 3bb858551cd5d84e43b800edfa2b07d1529718a9
22761 * doc/DCO: New.
22762 * doc/HACKING: Document new rules.
22763
22764 2012-04-04 Tomas Mraz <[email protected]>
22765
22766 Add GCRYCTL_SET_ENFORCED_FIPS_FLAG command.
22767 + commit 90e49a11733bfba9c3c505ac487282d35757f682
22768 * doc/gcrypt.texi: Add documentation of the new command.
22769 * src/fips.c (_gcry_enforced_fips_mode): Report the enforced fips mode
22770 only when fips mode is enabled.
22771 (_gcry_set_enforced_fips_mode): New function.
22772 * src/g10lib.h: Add the _gcry_set_enforced_fips_mode prototype.
22773 * src/gcrypt.h.in: Add the GCRYCTL_SET_ENFORCED_FIPS_FLAG.
22774 * src/global.c (_gcry_vcontrol): Handle the new command.
22775
22776 2012-02-17 Ulrich Müller <[email protected]>
22777
22778 Rework selftest in idea.c.
22779 + commit 70cca617ed75ea292e1fed769114dda5cc1d76f1
22780 * cipher/idea.c (do_setkey): Execute selftest when first called.
22781 (decrypt_block): Remove commented-out code.
22782 (selftest): Execute all selftests. Return NULL on success, or
22783 string in case of error.
22784
22785 2012-02-16 Werner Koch <[email protected]>
22786
22787 Fix missing prototype.
22788 + commit 46035d28c9b413851d43a4008fdc8e4cdf5d686b
22789 * src/g10lib.h (_gcry_secmem_module_init): Make it a real prototype.
22790
22791 2012-02-16 Ulrich Müller <[email protected]>
22792
22793 Add support for the IDEA cipher.
22794 + commit 318fd85f377c060908d371f792d41e599b3b7483
22795 Adapt idea.c to the Libgcrypt framework.
22796 Add IDEA to cipher_table and to the build system.
22797
22798 Patents on IDEA have expired:
22799 Europe: EP0482154 on 2011-05-16,
22800 Japan: JP3225440 on 2011-05-16,
22801 U.S.: 5,214,703 on 2012-01-07.
22802
22803 * configure.ac: Add idea to the list of available ciphers.
22804 Define USE_IDEA if idea is enabled.
22805 * cipher/cipher.c (cipher_table): Add entry for IDEA.
22806 * cipher/idea.c: Update comment about patents.
22807 Include proper header files and remove redundant declarations.
22808 (expand_key, cipher, do_setkey, encrypt_block, decrypt_block):
22809 Define function arguments as const where appropriate.
22810 (cipher): Test for !WORDS_BIGENDIAN instead of LITTLE_ENDIAN_HOST.
22811 (do_setkey, decrypt_block): Don't call selftest.
22812 (idea_setkey): New function, wrapper for do_setkey.
22813 (idea_encrypt): New function, wrapper for encrypt_block.
22814 (_gcry_cipher_spec_idea): Define.
22815 * cipher/Makefile.am (EXTRA_libcipher_la_SOURCES): Add idea.c.
22816 * src/cipher.h (_gcry_cipher_spec_idea): Declare.
22817 * tests/basic.c (check_ciphers): Add GCRY_CIPHER_IDEA.
22818
22819 2012-01-09 Werner Koch <[email protected]>
22820
22821 Include an IDEA implementation.
22822 + commit 6078b05f5340d886e0b9e6cee1d9b5043e0cb210
22823 The code is the old IDEA test code, written by me back in 1997 and
22824 distributed on a Danish FTP server. This commit is only for
22825 reference. To use the code it has to be adjusted to the Libgcrypt
22826 framework.
22827
22828 2012-01-03 Marcus Brinkmann <[email protected]>
22829
22830 Fix pthread locking and remove defunctional support for static lock init.
22831 + commit 38fcd59ce774eaa3d65f2f7534c989afd860eb56
22832 * src/ath.c: Include assert.h.
22833 (ath_mutex_destroy, ath_mutex_lock, ath_mutex_unlock): Dereference LOCK.
22834 * src/g10lib.h (_gcry_secmem_module_init): New declaration.
22835 * src/global.c (global_init): Call _gcry_secmem_module_init.
22836 * src/secmem.c (_gcry_secmem_module_init): New function.
22837
22838 2011-12-16 Werner Koch <[email protected]>
22839
22840 Add alignment tests for the cipher tests.
22841 + commit 14cf1f7e338fedb8edaff5631441746605152bd6
22842 * tests/basic.c (check_one_cipher): Factor most code out to
22843 check_one_cipher_core. Call that core function several times using
22844 different alignment settings.
22845 (check_one_cipher_core): New. Add extra args to allow alignment
22846 testing.
22847
22848 2011-12-07 Werner Koch <[email protected]>
22849
22850 tests/prime: Add option to create a well known private key.
22851 + commit 16f5654643d584e3bc739b636752d779176b2191
22852 * tests/prime.c (print_mpi, create_42prime): New.
22853 (main): Add option --42.
22854
22855 2011-12-01 Werner Koch <[email protected]>
22856
22857 Do not build the random-daemon by make distcheck.
22858 + commit ea1fb538d99f1ec093f2fef86f4f29176ec27826
22859 * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Disable building of the
22860 random daemon
22861
22862 Generate the ChangeLog from commit logs.
22863 + commit 137d73191c904926ba529376144ee8239af4ca02
22864 * scripts/gitlog-to-changelog: New script. Taken from gnulib.
22865 * scripts/git-log-fix: New file.
22866 * scripts/git-log-footer: New file.
22867 * doc/HACKING: Describe the ChangeLog policy
22868 * ChangeLog: New file.
22869 * Makefile.am (EXTRA_DIST): Add new files.
22870 (gen-ChangeLog): New.
22871 (dist-hook): Run gen-ChangeLog.
22872
22873 Rename all ChangeLog files to ChangeLog-2011.
22874
22875 2011-12-01 Werner Koch <[email protected]>
22876
22877 NB: Changes done before December 1st, 2011 are described in
22878 per directory files named ChangeLog-2011. See doc/HACKING for
22879 details.
22880
22881 -----
22882 Copyright (C) 2011 Free Software Foundation, Inc.
22883
22884 Copying and distribution of this file and/or the original GIT
22885 commit log messages, with or without modification, are
22886 permitted provided the copyright notice and this notice are
22887 preserved.