Page MenuHome GnuPG
Feed Advanced Search

Aug 5 2024

jukivili added a comment to T7220: The CF protection not enabled in libgcrypt.

This excludes 32-bit ARM assembly from Aarch64 builds:

Aug 5 2024, 7:23 PM · libgcrypt, Bug Report
ametzler1 added a comment to T7226: libgcrypt 1.11.0 buid error on armhf with gcc-14.

This patch should fix the issue:

Aug 5 2024, 6:14 PM · FTBFS, arm, libgcrypt, Bug Report
Jakuje added a comment to T7220: The CF protection not enabled in libgcrypt.

Tested in our build environment and indeed, just this patch does not solve the issue for aarch64.

Aug 5 2024, 11:50 AM · libgcrypt, Bug Report

Aug 4 2024

jukivili added a comment to T7220: The CF protection not enabled in libgcrypt.

Here's patch:

Aug 4 2024, 5:58 PM · libgcrypt, Bug Report
jukivili added a comment to T7226: libgcrypt 1.11.0 buid error on armhf with gcc-14.

This patch should fix the issue:

Aug 4 2024, 5:20 PM · FTBFS, arm, libgcrypt, Bug Report
jukivili added a comment to T7220: The CF protection not enabled in libgcrypt.

Ok, so aarch64 assembly would need PAC and BTI support. As far as I have understood these, is that PAC instructions are not needed with current assembly as none of those is storing/loading LR register (all aarch64 assembly functions are leaf functions). So only BTI is needed and that is basically same modification as CET on x86.

Aug 4 2024, 4:36 PM · libgcrypt, Bug Report
ametzler1 added a comment to T7226: libgcrypt 1.11.0 buid error on armhf with gcc-14.

This already shows with 9d909cb67e70fd792926ac1e2ab305b2cc96bc27 which initially added ec-inline.h. (Reproducing with old versions like this one requires cherry-picking 693ffa145378682229473b0e811a9cea7c4d307a since otherwise NEON support is disabled at configure time due to implicit functions.)

Aug 4 2024, 11:17 AM · FTBFS, arm, libgcrypt, Bug Report

Jul 29 2024

Jakuje added a comment to T7220: The CF protection not enabled in libgcrypt.

Recent changes fixed the issue for the x86_64 builds, but I see similar symptoms in the aarch64 build now. Annocheck reports the following failures:

Hardened: /usr/lib64/libgcrypt.so.20.5.0: FAIL: dynamic-tags test because the BTI_PLT flag is missing from the dynamic tags 
Hardened: /usr/lib64/libgcrypt.so.20.5.0: info: For more information visit: https://sourceware.org/annobin/annobin.html/Test-dynamic-tags.html
Hardened: /usr/lib64/libgcrypt.so.20.5.0: FAIL: property-note test because properly formatted .note.gnu.property not found (it is needed for branch protection support) 
Hardened: /usr/lib64/libgcrypt.so.20.5.0: info: For more information visit: https://sourceware.org/annobin/annobin.html/Test-property-note.html

I do not have aarch64 machine at hand now to investigate this further, but this sounds like orthogonal functionality to the CET on Intel.

Jul 29 2024, 3:18 PM · libgcrypt, Bug Report
werner added projects to T7226: libgcrypt 1.11.0 buid error on armhf with gcc-14: arm, FTBFS.
Jul 29 2024, 10:16 AM · FTBFS, arm, libgcrypt, Bug Report

Jul 28 2024

ametzler1 created T7226: libgcrypt 1.11.0 buid error on armhf with gcc-14.
Jul 28 2024, 6:20 PM · FTBFS, arm, libgcrypt, Bug Report

Jul 27 2024

Jakuje added a comment to T7220: The CF protection not enabled in libgcrypt.

Thank you. With this patch the IBT flags are present on the shared object and CF protection test passes.

Jul 27 2024, 8:40 AM · libgcrypt, Bug Report
jukivili added a comment to T7220: The CF protection not enabled in libgcrypt.

"rijndael-vaes-avx2-i386.S" should not be build for x86-64 but until now that has not had any affect as #ifdefs in that source file result empty object file on x86-64.

Jul 27 2024, 7:23 AM · libgcrypt, Bug Report

Jul 26 2024

Jakuje added a comment to T7220: The CF protection not enabled in libgcrypt.

Thank you for having a look into this!

Jul 26 2024, 3:25 PM · libgcrypt, Bug Report
werner triaged T7221: Disable -O flag munging when the libgcrypt is not compiled with rndjent as Low priority.

Not for a broken compiler but for several CC versions which consumed lots of memory for unrulling stuff. iirc, this was not only gcc.

Jul 26 2024, 11:52 AM · libgcrypt, Bug Report
werner triaged T7220: The CF protection not enabled in libgcrypt as Normal priority.
Jul 26 2024, 11:49 AM · libgcrypt, Bug Report
jukivili added a comment to T7220: The CF protection not enabled in libgcrypt.

Here's patches for adding CET support to x86-64 and i386 assembly.

Jul 26 2024, 10:11 AM · libgcrypt, Bug Report
jukivili added a comment to T7220: The CF protection not enabled in libgcrypt.

OpenBSD carries libgcrypt patch for CET which adds endbr64 instruction to CFI_STARTPROC() macro in "asm-common-amd64.h". We could do the same and also add endbr32 to i386 too. That would be easiest way to add required endbr instructions. OpenBSD also has patch for arm64 to add similar BTI instructions to aarch64 variant of CFI_STARTPROC.

Jul 26 2024, 10:02 AM · libgcrypt, Bug Report
jukivili added a comment to T7221: Disable -O flag munging when the libgcrypt is not compiled with rndjent.

There is -O flag munging for "tiger.o" in "cipher/Makefile.am", an old workaround for broken compiler I think. IMHO tiger.o case can and should be removed.

Jul 26 2024, 9:33 AM · libgcrypt, Bug Report
jukivili added a comment to T7220: The CF protection not enabled in libgcrypt.

OpenBSD carries libgcrypt patch for CET which adds endbr64 instruction to CFI_STARTPROC() macro in "asm-common-amd64.h". We could do the same and also add endbr32 to i386 too. That would be easiest way to add required endbr instructions. OpenBSD also has patch for arm64 to add similar BTI instructions to aarch64 variant of CFI_STARTPROC.

Jul 26 2024, 9:29 AM · libgcrypt, Bug Report

Jul 25 2024

Jakuje created T7221: Disable -O flag munging when the libgcrypt is not compiled with rndjent.
Jul 25 2024, 1:52 PM · libgcrypt, Bug Report
Jakuje created T7220: The CF protection not enabled in libgcrypt.
Jul 25 2024, 11:54 AM · libgcrypt, Bug Report

Jul 11 2024

fse added a comment to T6637: PQC for Libgcrypt.

We hereby deliver with some delay our completed version of the integration of PQC algorithms into Libgcrypt from our project. The code features the following algorithms:

Jul 11 2024, 12:26 PM · PQC, libgcrypt

Jul 7 2024

jukivili updated the task description for T4460: libgcrypt performance TODOs.
Jul 7 2024, 1:36 PM · libgcrypt
jukivili added a project to T7184: Libgcrypt v1.11.0 make fails at cipher/blake2.c:834:6 (has no member named 'use_avx512'): libgcrypt.
Jul 7 2024, 1:23 PM · libgcrypt, Bug Report

Jul 2 2024

werner added a parent task for T7170: Building libgcrypt-1.11.0 produces a dylib with unresolved symbols at runtime: T7165: Release Libgcrypt 1.11.0.
Jul 2 2024, 3:58 PM · MacOS, libgcrypt, Bug Report
werner added a subtask for T7165: Release Libgcrypt 1.11.0: T7170: Building libgcrypt-1.11.0 produces a dylib with unresolved symbols at runtime.
Jul 2 2024, 3:58 PM · Release Info, libgcrypt

Jun 24 2024

debohman added a comment to T7170: Building libgcrypt-1.11.0 produces a dylib with unresolved symbols at runtime.

Verified the fix.

Jun 24 2024, 6:21 PM · MacOS, libgcrypt, Bug Report
jukivili closed T7175: libgcrypt 1.11.0 fails to build on 32bit Windows with Clang as Resolved.
Jun 24 2024, 6:40 AM · clang, Windows, libgcrypt, Bug Report
gniibe changed the status of T7170: Building libgcrypt-1.11.0 produces a dylib with unresolved symbols at runtime from Open to Testing.

Pushed the change to master. Please test.
rCbb0895bbb7c6: m4: Fix acinclude.m4 for underscore detection in the symbol.

Jun 24 2024, 3:21 AM · MacOS, libgcrypt, Bug Report
gniibe claimed T7170: Building libgcrypt-1.11.0 produces a dylib with unresolved symbols at runtime.

Thank you for the report.

Jun 24 2024, 3:06 AM · MacOS, libgcrypt, Bug Report

Jun 23 2024

jukivili closed T7167: The libgcrypt 1.11.0 tests fail on s390x, a subtask of T7165: Release Libgcrypt 1.11.0, as Resolved.
Jun 23 2024, 4:39 PM · Release Info, libgcrypt
jukivili closed T7167: The libgcrypt 1.11.0 tests fail on s390x as Resolved.
Jun 23 2024, 4:39 PM · libgcrypt, s390, Bug Report
werner updated subscribers of T7170: Building libgcrypt-1.11.0 produces a dylib with unresolved symbols at runtime.

Thanks for the detailed analysis; we will check to tomorrow why this was changed.

Jun 23 2024, 10:54 AM · MacOS, libgcrypt, Bug Report
lazka added a comment to T7175: libgcrypt 1.11.0 fails to build on 32bit Windows with Clang.

Hm, CFI directives should not be used on WIN32 target. This patch should solve the issue for now:

Jun 23 2024, 9:20 AM · clang, Windows, libgcrypt, Bug Report

Jun 22 2024

debohman added a comment to T7170: Building libgcrypt-1.11.0 produces a dylib with unresolved symbols at runtime.

Here is a fix for the issue which preserves the removal of cut:

Jun 22 2024, 9:30 PM · MacOS, libgcrypt, Bug Report
werner triaged T7175: libgcrypt 1.11.0 fails to build on 32bit Windows with Clang as Low priority.

Using clang for Windows is not tested or suggested. Thus low priority.

Jun 22 2024, 5:01 PM · clang, Windows, libgcrypt, Bug Report
jukivili added a comment to T7167: The libgcrypt 1.11.0 tests fail on s390x.

Thanks for testing. I pushed this fix to libgcrypt master.

Jun 22 2024, 2:35 PM · libgcrypt, s390, Bug Report

Jun 21 2024

werner added a project to T7167: The libgcrypt 1.11.0 tests fail on s390x: libgcrypt.
Jun 21 2024, 1:24 PM · libgcrypt, s390, Bug Report
gniibe closed T7022: libgcrypt-1.10.3 regression on hppa as Resolved.
Jun 21 2024, 8:48 AM · libgcrypt, Gentoo, hppa, Bug Report
gniibe closed T6964: don't use deprecated grep aliases as Resolved.
Jun 21 2024, 8:48 AM · libgcrypt
gniibe closed T6863: [patch] libgcrypt copyright header cleanup as Resolved.
Jun 21 2024, 8:48 AM · patch, libgcrypt, Bug Report
gniibe closed T6858: libgcrypt fails to be cross-compiled. as Resolved.
Jun 21 2024, 8:47 AM · libgcrypt
gniibe closed T5817: libgcrypt: Add Balloon KDF as Resolved.

Done.

Jun 21 2024, 8:45 AM · libgcrypt, Feature Request
gniibe closed T6271: The old FSF address in libgcrypt source code as Resolved.

Done in 1.11.0.

Jun 21 2024, 8:42 AM · Documentation, libgcrypt, Bug Report

Jun 20 2024

debohman added a comment to T7170: Building libgcrypt-1.11.0 produces a dylib with unresolved symbols at runtime.

This diff for 1.11.0 fixes the problem for me:

Jun 20 2024, 2:45 PM · MacOS, libgcrypt, Bug Report
debohman added a comment to T7170: Building libgcrypt-1.11.0 produces a dylib with unresolved symbols at runtime.

The following logic from 1.11.0 acinclude.m4 cannot possibly work to detect _ at the beginning of symbol names:

Jun 20 2024, 2:34 PM · MacOS, libgcrypt, Bug Report
debohman added a comment to T7170: Building libgcrypt-1.11.0 produces a dylib with unresolved symbols at runtime.

The toolchain is clang / llvm and the apple ld, native build, not cross compiling.

Jun 20 2024, 1:00 PM · MacOS, libgcrypt, Bug Report
werner triaged T7170: Building libgcrypt-1.11.0 produces a dylib with unresolved symbols at runtime as Normal priority.
Jun 20 2024, 12:22 PM · MacOS, libgcrypt, Bug Report
werner added a project to T7170: Building libgcrypt-1.11.0 produces a dylib with unresolved symbols at runtime: MacOS.
Jun 20 2024, 12:21 PM · MacOS, libgcrypt, Bug Report
werner edited projects for T7170: Building libgcrypt-1.11.0 produces a dylib with unresolved symbols at runtime, added: libgcrypt; removed gpgrt.
Jun 20 2024, 12:14 PM · MacOS, libgcrypt, Bug Report
Jakuje added a comment to T7167: The libgcrypt 1.11.0 tests fail on s390x.

Thank you for having a look into that. If I see right, Fedora has a real s390 hardware for builders so I can verify the fix when available.

Jun 20 2024, 9:43 AM · libgcrypt, s390, Bug Report
jukivili added a comment to T7167: The libgcrypt 1.11.0 tests fail on s390x.

Algo 329 and 330 are the new CSHAKE128 and CSHAKE256 digest algos. Looks that s390x only support accelerating SHA3 and SHAKE, as only SHA3 and SHAKE suffix are supported (see keccak_final_s390x()). So s390x acceleration needs to be disabled for CSHAKE algos.

Jun 20 2024, 6:06 AM · libgcrypt, s390, Bug Report

Jun 19 2024

werner added a subtask for T7165: Release Libgcrypt 1.11.0: T7167: The libgcrypt 1.11.0 tests fail on s390x.
Jun 19 2024, 10:31 PM · Release Info, libgcrypt
werner added a parent task for T7167: The libgcrypt 1.11.0 tests fail on s390x: T7165: Release Libgcrypt 1.11.0.
Jun 19 2024, 10:31 PM · libgcrypt, s390, Bug Report
Jakuje created T7167: The libgcrypt 1.11.0 tests fail on s390x.
Jun 19 2024, 2:36 PM · libgcrypt, s390, Bug Report
werner closed T5822: libgcrypt: Remove GCRYCTL_ENABLE_M_GUARD support (was: _gcry_private_malloc returns 4-byte alignment memory when use_m_guard==1) as Resolved.
Jun 19 2024, 12:12 PM · Bug Report, libgcrypt
werner closed T5811: libgcrypt: Remove random-daemon (server side) as Resolved.
Jun 19 2024, 12:12 PM · libgcrypt
werner closed T7130: Fix static reports by static analyser in libgcrypt as Resolved.
Jun 19 2024, 12:12 PM · libgcrypt, Bug Report
werner closed T6976: RSA PKCS#1v1.5 signatures with SHA3 use invalid encoding as Resolved.
Jun 19 2024, 12:11 PM · FIPS, libgcrypt, Bug Report
werner closed T7035: libgcrypt: New function gcry_md_hash_buffers_ext (for extendable-output function) as Resolved.
Jun 19 2024, 12:10 PM · libgcrypt, Feature Request, Bug Report
werner closed T6557: Support of SHAKE in MGF function of RSA, a subtask of T6539: The digest&sign/verify API with SHAKE-class digests does not work, as Resolved.
Jun 19 2024, 12:10 PM · libgcrypt, FIPS, Bug Report
werner closed T6557: Support of SHAKE in MGF function of RSA as Resolved.
Jun 19 2024, 12:10 PM · libgcrypt, FIPS, Bug Report
werner closed T6755: libgcrypt: KEM API as Resolved.
Jun 19 2024, 12:08 PM · PQC, libgcrypt
werner closed T6755: libgcrypt: KEM API, a subtask of T6637: PQC for Libgcrypt, as Resolved.
Jun 19 2024, 12:08 PM · PQC, libgcrypt
werner updated the task description for T7165: Release Libgcrypt 1.11.0.
Jun 19 2024, 11:40 AM · Release Info, libgcrypt
werner triaged T7166: Release Libgcrypt 1.11.1 as Low priority.
Jun 19 2024, 11:39 AM · Release Info, libgcrypt
werner triaged T7165: Release Libgcrypt 1.11.0 as Normal priority.
Jun 19 2024, 11:37 AM · Release Info, libgcrypt

Jun 6 2024

gniibe changed the status of T7130: Fix static reports by static analyser in libgcrypt from Open to Testing.

Applied in: rCdc8d84383a6b: cipher:aeswrap: Fix padding length check.

Jun 6 2024, 8:08 AM · libgcrypt, Bug Report

May 29 2024

Jakuje added a comment to T7136: libgcrypt: Implement constant-time RSA decryption (Marvin attack fix).

I left review comments in gitlab.

May 29 2024, 3:03 PM · libgcrypt, Bug Report
werner triaged T7136: libgcrypt: Implement constant-time RSA decryption (Marvin attack fix) as Low priority.

We discussed this forth and back with the RedHat people at our jour-fix to explain that the Kairo fix is done at the wrong layer - this needs to be done at the protocol layer and not in the building blocks. This is not covered by our security policy and @gniibe already came up with some extra support to help at the protocol layer. There are only a few use cases where this side-channel or the Minerva one (for ECDSA) should be considered (e.g. time stamping services). Generally required protection against DoS are also pat of the mitigation.

May 29 2024, 8:22 AM · libgcrypt, Bug Report
jukivili added a comment to T7136: libgcrypt: Implement constant-time RSA decryption (Marvin attack fix).

I left review comments in gitlab. One additional concern is license for mpi-mul-cs.c, original code not having copyright information... "does not have any copyright information, assuming public domain".

May 29 2024, 8:01 AM · libgcrypt, Bug Report

May 28 2024

Jakuje created T7136: libgcrypt: Implement constant-time RSA decryption (Marvin attack fix).
May 28 2024, 7:07 PM · libgcrypt, Bug Report
werner assigned T7130: Fix static reports by static analyser in libgcrypt to gniibe.
May 28 2024, 11:08 AM · libgcrypt, Bug Report

May 21 2024

Jakuje added a comment to T7130: Fix static reports by static analyser in libgcrypt.

Right, thats my understanding from reading of the RFC that the padding should be strictly < 8B. We can reword though.

May 21 2024, 11:53 AM · libgcrypt, Bug Report
werner added a comment to T7130: Fix static reports by static analyser in libgcrypt.

Well, but if the padding is indeed limited to 7 bytes the fix should be applied anyway.

May 21 2024, 11:46 AM · libgcrypt, Bug Report
werner triaged T7130: Fix static reports by static analyser in libgcrypt as Normal priority.
May 21 2024, 11:45 AM · libgcrypt, Bug Report
Jakuje added a comment to T7130: Fix static reports by static analyser in libgcrypt.

The report went like this

Error: OVERRUN (CWE-119):
libgcrypt-1.10.3/cipher/cipher-aeswrap.c:303: cond_at_most: Checking "plen > 8U" implies that "plen" may be up to 8 on the false branch.
libgcrypt-1.10.3/cipher/cipher-aeswrap.c:305: cond_between: Checking "plen" implies that "plen" is between 1 and 8 (inclusive) on the true branch.
libgcrypt-1.10.3/cipher/cipher-aeswrap.c:309: assignment: Assigning: "i" = "0".
libgcrypt-1.10.3/cipher/cipher-aeswrap.c:310: overrun-local: Overrunning array "t" of 16 bytes at byte offset 16 using index "8U + plen + i" (which evaluates to 16).
#  308|   
#  309|                 for (i = 0; i < 16 - (8+plen); i++)
#  310|->                 if (t[8+plen+i])
#  311|                     {
#  312|                       err = GPG_ERR_CHECKSUM;

but looking again, it is wrong as it did not reflect the end condition for the cycle, which obviously means the cycle does not run. Sorry for the noise.

May 21 2024, 11:44 AM · libgcrypt, Bug Report
werner added a comment to T7130: Fix static reports by static analyser in libgcrypt.

Can you give a hint where there is a buffer overrun in the first patch? Padding limit might be correct but I can't see an overrun.

May 21 2024, 11:31 AM · libgcrypt, Bug Report

May 20 2024

Jakuje created T7130: Fix static reports by static analyser in libgcrypt.
May 20 2024, 7:13 PM · libgcrypt, Bug Report

May 16 2024

gniibe added a comment to T7114: AM_PATH_LIBGCRYPT does not use gpgrt-config without AM_PATH_GPG_ERROR.

Thank you. Applied by : rM87061c0260bb: gpgme.m4: Set $host correctly always.

May 16 2024, 2:28 AM · gpgrt, libgcrypt, Bug Report

May 15 2024

ametzler1 added a comment to T7114: AM_PATH_LIBGCRYPT does not use gpgrt-config without AM_PATH_GPG_ERROR.

Ditto for ksba and assuan.

May 15 2024, 6:27 PM · gpgrt, libgcrypt, Bug Report
gniibe changed the status of T7114: AM_PATH_LIBGCRYPT does not use gpgrt-config without AM_PATH_GPG_ERROR from Open to Testing.
May 15 2024, 4:22 AM · gpgrt, libgcrypt, Bug Report

May 14 2024

ametzler1 added a comment to T7114: AM_PATH_LIBGCRYPT does not use gpgrt-config without AM_PATH_GPG_ERROR.

The gcrypt change works for me. Thanks!

May 14 2024, 6:38 PM · gpgrt, libgcrypt, Bug Report
gniibe added a comment to T7114: AM_PATH_LIBGCRYPT does not use gpgrt-config without AM_PATH_GPG_ERROR.

In general, asking an application change is not good. Migrating to pkg-config should be an option (not requirement).
However, it's usually recommended to use libgpg-error when an application is used with libgcrypt/libksba/libassuan.

May 14 2024, 4:38 AM · gpgrt, libgcrypt, Bug Report

May 13 2024

gniibe claimed T7114: AM_PATH_LIBGCRYPT does not use gpgrt-config without AM_PATH_GPG_ERROR.
May 13 2024, 9:57 AM · gpgrt, libgcrypt, Bug Report

May 12 2024

ametzler1 added a comment to T7114: AM_PATH_LIBGCRYPT does not use gpgrt-config without AM_PATH_GPG_ERROR.

Just to clarify: I personally think it would be perfectly fine to say that AM_PATH_* is only supported when AM_PATH_GPG_ERROR is also used. Adding an invocation AM_PATH_GPG_ERROR is not a great hassle and alternatively pkg-config/pkgconf exists and works perfectly fine (and is a lot faster).

May 12 2024, 3:57 PM · gpgrt, libgcrypt, Bug Report
werner added a project to T7114: AM_PATH_LIBGCRYPT does not use gpgrt-config without AM_PATH_GPG_ERROR: gpgrt.

I noticed this recently too on some boxes. Thanks for the good decription. This support for pkg-config style .pc files for our config scripts seems to be a never ending story. The alternative name for libgpg-error-config does not make it easier.

May 12 2024, 2:29 PM · gpgrt, libgcrypt, Bug Report
ametzler1 updated the task description for T7114: AM_PATH_LIBGCRYPT does not use gpgrt-config without AM_PATH_GPG_ERROR.
May 12 2024, 11:24 AM · gpgrt, libgcrypt, Bug Report

May 11 2024

ametzler1 added a project to T7114: AM_PATH_LIBGCRYPT does not use gpgrt-config without AM_PATH_GPG_ERROR: libgcrypt.
May 11 2024, 1:20 PM · gpgrt, libgcrypt, Bug Report

May 8 2024

jukivili closed T7111: aarch64 assembly code for chacha20 should use local symbols for internal data as Resolved.
May 8 2024, 9:02 PM · asm, arm, libgcrypt, Bug Report
jukivili claimed T7111: aarch64 assembly code for chacha20 should use local symbols for internal data.
May 8 2024, 9:01 PM · asm, arm, libgcrypt, Bug Report
jukivili added a comment to T7111: aarch64 assembly code for chacha20 should use local symbols for internal data.

Thanks for report. I've applied this change to master.

May 8 2024, 9:01 PM · asm, arm, libgcrypt, Bug Report
werner closed T6511: EdDSA support in FIPS mode as Resolved.
May 8 2024, 8:32 AM · FIPS, libgcrypt, Bug Report

May 7 2024

Jakuje added a comment to T6511: EdDSA support in FIPS mode.

I think so. We did not submit a modules for recertification with these changes, but we do not plan this in close future so you can consider it completed.

May 7 2024, 3:01 PM · FIPS, libgcrypt, Bug Report
werner added a comment to T6511: EdDSA support in FIPS mode.

Can we close this?

May 7 2024, 2:44 PM · FIPS, libgcrypt, Bug Report
saurik created T7111: aarch64 assembly code for chacha20 should use local symbols for internal data.
May 7 2024, 9:52 AM · asm, arm, libgcrypt, Bug Report

Apr 22 2024

gniibe added a comment to T7085: libgcrypt: New functions to support waiting time.

Here is current version:

diff --git a/src/misc.c b/src/misc.c
index 4db2d9a4..bf50b00b 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -577,3 +577,61 @@ _gcry_divide_by_zero (void)
     gpg_err_set_errno (EDOM);
     _gcry_fatal_error (gpg_err_code_from_errno (errno), "divide by zero");
 }
+
+#ifdef HAVE_CLOCK_GETTIME
+#include <time.h>
+# if defined(CLOCK_THREAD_CPUTIME_ID) && defined(CLOCK_TAI)
+struct gcry_timedwait
+{
+  clockid_t id;
+  struct timespec ts;
+};
+
+typedef struct gcry_timedwait *gcry_timedwait_t;
+
+gcry_err_code_t
+_gcry_timedwait_init (gcry_timedwait_t tw, unsigned int flags)
+{
+  /* Possibly, it would be good to be able to select the wall clock.
+   * For now, it's CPU time by the thread.  */
+  if (flags != 0)
+    return GPG_ERR_INV_ARG;
+
+  tw->id = CLOCK_THREAD_CPUTIME_ID;
+  if (clock_gettime (tw->id, &tw->ts) < 0)
+    return gpg_err_code_from_syserror ();
+
+  return 0;
+}
+
+gcry_err_code_t
+_gcry_timedwait_finish (gcry_timedwait_t tw, struct timespec ts_r)
+{
+  struct timespec ts;
+  u32 negative;
+
+  if (clock_gettime (tw->id, &ts) < 0)
+    return gpg_err_code_from_syserror ();
+
+  ts.tv_sec -= tw->ts.tv_sec;
+  ts.tv_nsec -= tw->ts.tv_nsec;
+  negative = ((u32)ts.tv_nsec) >> 31;
+  ts.tv_sec -= negative;
+  ts.tv_nsec += (1000000000 * negative);
+
+  ts_r.tv_sec -= ts.tv_sec;
+  ts_r.tv_nsec -= ts.tv_nsec;
+  negative = ((u32)ts_r.tv_nsec) >> 31;
+  ts_r.tv_sec -= negative;
+  ts_r.tv_nsec += (1000000000 * negative);
+
+  if (ts_r.tv_sec < 0)
+    return GPG_ERR_TIME_CONFLICT;
+
+  if (clock_nanosleep (CLOCK_TAI, 0, &ts_r, &ts_r))
+    return gpg_err_code_from_syserror ();
+
+  return 0;
+}
+# endif
+#endif
Apr 22 2024, 8:01 AM · libgcrypt

Apr 12 2024

gniibe added a comment to T7085: libgcrypt: New functions to support waiting time.

API which does not require allocation internally would be better. In this case, it is allocated on stack by the caller.

Apr 12 2024, 8:07 AM · libgcrypt
gniibe added a comment to T7085: libgcrypt: New functions to support waiting time.

I mean, something like this (for GNU/Linux):

diff --git a/src/misc.c b/src/misc.c
index 4db2d9a4..74864334 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -577,3 +577,80 @@ _gcry_divide_by_zero (void)
     gpg_err_set_errno (EDOM);
     _gcry_fatal_error (gpg_err_code_from_errno (errno), "divide by zero");
 }
+
+#ifdef HAVE_CLOCK_GETTIME
+#include <time.h>
+# if defined(CLOCK_THREAD_CPUTIME_ID) && defined(CLOCK_TAI)
+struct gcry_timedwait
+{
+  struct timespec ts;
+};
+
+typedef struct gcry_timedwait *gcry_timedwait_t;
+
+gcry_err_code_t
+_gcry_timedwait_new (gcry_timedwait_t *r_tw, unsigned int flags)
+{
+  gcry_err_code_t err;
+  gcry_timedwait_t tw;
+
+  *r_tw = NULL;
+
+  /* Possibly, it would be good to be able to select the wall clock.
+   * For now, it's CPU time by the thread.  */
+  if (flags != 0)
+    return GPG_ERR_INV_ARG;
+
+  tw = xtrymalloc (sizeof (gcry_timedwait_t));
+  if (!tw)
+    return gpg_err_code_from_syserror ();
+
+  if (clock_gettime (CLOCK_THREAD_CPUTIME_ID, &tw->ts) < 0)
+    {
+      err = gpg_err_code_from_syserror ();
+      xfree (tw);
+      return err;
+    }
+
+  *r_tw = tw;
+  return 0;
+}
+
+gcry_err_code_t
+_gcry_timedwait_release (gcry_timedwait_t tw, struct timespec ts_r)
+{
+  gcry_err_code_t err;
+  struct timespec ts;
+  u32 negative;
+
+  if (clock_gettime (CLOCK_THREAD_CPUTIME_ID, &ts) < 0)
+    {
+      err = gpg_err_code_from_syserror ();
+      xfree (tw);
+      return err;
+    }
+
+  ts.tv_sec -= tw->ts.tv_sec;
+  ts.tv_nsec -= tw->ts.tv_nsec;
+  negative = ((u32)ts.tv_nsec) >> 31;
+  ts.tv_sec -= negative;
+  ts.tv_nsec += (1000000000 * negative);
+
+  xfree (tw);
+
+  ts_r.tv_sec -= ts.tv_sec;
+  ts_r.tv_nsec -= ts.tv_nsec;
+  negative = ((u32)ts_r.tv_nsec) >> 31;
+  ts_r.tv_sec -= negative;
+  ts_r.tv_nsec += (1000000000 * negative);
+
+  if (ts_r.tv_sec < 0)
+    return GPG_ERR_TIME_CONFLICT;
+
+  if (clock_nanosleep (CLOCK_TAI, 0, &ts_r, &ts_r))
+    return gpg_err_code_from_syserror ();
+
+  return 0;
+}
+# endif
+#endif
Apr 12 2024, 5:07 AM · libgcrypt
gniibe triaged T7085: libgcrypt: New functions to support waiting time as Wishlist priority.
Apr 12 2024, 5:04 AM · libgcrypt