For the first issue, I added a check in: rCf65c30d470f5: cipher:ecc:fips: Reject use of SHAKE when it's ECDSA with RFC6979.
- Queries
- All Stories
- Search
- Advanced Search
- Transactions
- Transaction Logs
Advanced Search
Jun 28 2023
Jun 27 2023
This has long been fixed in 2.4. Given that Libgcrypt has support for PBKDF2 we can back port this.
From the FIPS 186-5 there are some limitations to use the SHAKE in FIPS Mode that we will have to reflect:
Jun 26 2023
Closing since the problem doesn't seem to occur if the operation is canceled properly.
Sorry about that. I tested an old build which didn't call gpgme_cancel_async and therefore probably didn't properly close the channels. It seems to work if gpgme_cancel_async is called to cancel the operation.
This option is already used. Running pgrep -a gpg in a loop (and ignoring gpg-agent processes) I get:
Mo 26. Jun 11:29:11 CEST 2023 19111 gpgtar --batch --status-fd 60 --gpg-args --no-tty --gpg-args --charset=utf8 --gpg-args --enable-progress-filter --gpg-args --exit-on-status-write-error --gpg-args --display=:0 --gpg-args --ttyname=/dev/pts/37 --gpg-args --ttytype=xterm-256color --decrypt --directory /tmp/kleopatra-JqIiXu/src -- /home/ingo/dev/g10/src.tar.gpg 19112 gpg --batch --status-fd=60 --output - --decrypt --no-tty --charset=utf8 --enable-progress-filter --exit-on-status-write-error --display=:0 --ttyname=/dev/pts/37 --ttytype=xterm-256color -- /home/ingo/dev/g10/src.tar.gpg
Can you please test by adding --exit-on-status-write-error to the gpg invocation by gpgtar?
Jun 23 2023
Pushed a change in master.
Jun 22 2023
Due to the double fork in gpgme we won't get the exit code which gpgtar emits. Possible actions in a signal handler are also limited; in particular we can't use stdio or estream. The only option to print a status line would we by using write directly. However, this might mess with the libassuan buffering. Thus, it is not a good idea to pkill gpgtar. Same is true for gpg and gpgsm.
I found the case of X.509, which also uses fixed length output for RSA-PSS and ECDSA: https://www.rfc-editor.org/rfc/rfc8692.html
Jun 20 2023
Thank you for having a look into that! The proposed patch looks good. Should we have this change also in master?
Jun 19 2023
Here is a possible change (... to master, assuming it's good to support use case of RFC 8702):
diff --git a/cipher/keccak.c b/cipher/keccak.c index 22c40302..76e08cb5 100644 --- a/cipher/keccak.c +++ b/cipher/keccak.c @@ -1630,8 +1630,8 @@ const gcry_md_spec_t _gcry_digest_spec_sha3_512 = const gcry_md_spec_t _gcry_digest_spec_shake128 = { GCRY_MD_SHAKE128, {0, 1}, - "SHAKE128", shake128_asn, DIM (shake128_asn), oid_spec_shake128, 0, - shake128_init, keccak_write, keccak_final, NULL, keccak_extract, + "SHAKE128", shake128_asn, DIM (shake128_asn), oid_spec_shake128, 32, + shake128_init, keccak_write, keccak_final, keccak_read, keccak_extract, _gcry_shake128_hash_buffers, sizeof (KECCAK_CONTEXT), run_selftests @@ -1639,8 +1639,8 @@ const gcry_md_spec_t _gcry_digest_spec_shake128 = const gcry_md_spec_t _gcry_digest_spec_shake256 = { GCRY_MD_SHAKE256, {0, 1}, - "SHAKE256", shake256_asn, DIM (shake256_asn), oid_spec_shake256, 0, - shake256_init, keccak_write, keccak_final, NULL, keccak_extract, + "SHAKE256", shake256_asn, DIM (shake256_asn), oid_spec_shake256, 64, + shake256_init, keccak_write, keccak_final, keccak_read, keccak_extract, _gcry_shake256_hash_buffers, sizeof (KECCAK_CONTEXT), run_selftests
Reading RFC 8702, I realized that it defines the hash size in the use of CMS as: SHAKE128 : 32-byte SHAKE256 : 64-byte.
Jun 16 2023
Use Kleopatra which constructs the DN for you ;-).
I found this use case: RFC 8702
"Use of the SHAKE One-Way Hash Functions in the Cryptographic Message Syntax (CMS)": https://www.rfc-editor.org/rfc/rfc8702.html
Another possibility for digest&sign API: it is possible to determine the length of required hash function by the underlining field Fp of the curve in use. Then, use this length instead. It's better than to (try to) get the length by _gcry_md_get_algo_dlen (for SHAKE, it's undefined).
Fixed in both of master and 1.10 branch.
For libgcrypt, initially when the code was put, it made some sense.
Now, it's useless, so, let's simply remove the message.
Jun 15 2023
Jun 14 2023
I found that for EdDSA other than pure Ed25519, it can supply context.
I changed the semantics and API for adding context and input data, as we need to support both simultaneously.
I changed the lg-input-data.diff patch not to break the ABI, reusing the published symbol of gcry_pk_random_override_new.
With this approach, if/when needed, backporting may be easier.
Drawback is debugging internal of libgcrypt will be a bit confusing.
Jun 13 2023
Thanks, we will take care of this.
Let's fix this in Libgcrypt (ignore setting of the handler)
Another approach would be having "non-hash" algo for gcry_md_open.
Before adding FIPS support flag and tests, we need to modify implementation:
- Adding PCT check for EdDSA
- Adding support of gcry_pk_hash_sign/verify API for EdDSA
Thanks. I think that it was the oldest one: FSF used to be there in Cambridge, then moved to Tremont St. in Boston, and now it's in Franklin St.
Jun 12 2023
FYI, while going through the licenses again I noticed one of the pinentry files have even older address that so if you would do sed, this would not be matched:
In T6336#166815, @werner wrote:Actually, the entire systemd based launching is deprecated and thus the logged warning is on purpose.
The problem with the systemd launched gpg-agent is that it creates a race: gpg launches gpg-agent as needed and to avoid concurrent launching by other gpg or gpgsm processes, it takes a file system lock during the launch process. systemd does not know about this and we end up with sometimes end up with two gpg-agent processes. Eventually one of those processes detects that it does not own the socket and terminates itself. No real harm here but you may see smart card lockups or a flushed password cache.
I consider the entire idea of receiving a passphrase and data on the same channel to be a bad for security and robust coding. The whole thing is a historical oddity which we kept for the sake of mutt(1)'s legacy way of invoking pgp. Thus I won't consider 3) the best option.
To summarize, here is the situation:
- Ideally, it would be good to modify GnuPG and Emacs EasyPG to implement status handling and input handling in better way.
Jun 10 2023
Ah, I see https://dev.gnupg.org/rG2f872fa68c6576724b9dabee9fb0844266f55d0d applies cleanly. I guess can go with that, although would prefer it if on the 2.4 branch.
Is there a commit we could backport downstream to 2.4.x? We've had quite a few reports of this.
Jun 8 2023
I'm going to add selftest of EdDSA with test vectors from RFC 8032.
With the fix of T6523, make check goes all well (on Wine emulation and on Windows, for i686 and for x86_64).
Fixed in master.
I modified ffi.c, to have renamed process-spawn-io function doing I/O by C.
Jun 7 2023
Calling assuan_release before kbx_client_data_release is the best (and we join the thread).
Jun 6 2023
works
Jun 5 2023
Works in kleopatra; tested with gpg4win-4.2.0-beta339.
tests/openpgp/import.scm hangs with 4096*4.
Jun 2 2023
Test with Wine (i686) emulation, I encountered another hang at: Checking armored_key_8192
It looks like having the datastream_thread may be not worth.
One possibility is to implement synchronous read from pipe in kbx_client_data_wait, instead of datastream_thread.
Jun 1 2023
When testing please note that the last changes (i.e. "Ignore expired subkeys when looking for newest subkey" and ""Sort by fingerprint as last resort for deterministic sort order") have not been merged to the gpg4win/3.1.27 branch.
They re-used the same file name for the update from March and no history section. Anyway that looks promising and may solve the problem of having different algorithms allowed for restricted communication in the EU and the US.
Correct, but the last revision of FIPS 140-3 lists the EdDSA already. The same for the IG for FIPS 140-3:
My understanding is that FIPS 186-x lists more algorithms than approved for FIPS 140-y; the approved algorithms for 140-y are in the latest revisions of SP800-140. I have not checked the latter document, though.
See also commit rG6fcc263c18 from 2020 where I switched to D-lines.
The problem of hang of tests/openpgp/multisig.scm is solved by rGef4f22b9d98b: gpg: Graceful exit for signature checking with --batch.
But the problem itself is not yet solved.
It is reproducible by testing tests/openpgp/multisig.scm with keyboxd enabled (it hangs), with the modification of following.
May 31 2023
May 30 2023
May 29 2023
And thanks gniibe! I have tested 2.4.1 several times in this month (including existing and new keys), the warning was never shown again.
Hi zhangguangzhi, I think that it's version-specific problem.
I traced the chain and this warning message was added in release 2.3.3 T5565.
The problem should be able to reproduce between 2.3.3 and 2.4.0.
Hi,i try to reproduce the problem, my platform is linux and gnupg2-2.2.32-3, but i can't find “gpg: warning: lower 3 bits of the secret key are not cleared". Excuse me, is this a platform-specific or version-specific problem, or is it my operation wrong.
May 26 2023
Due to back porting another change the fix for 2.2 is now also needed in 2.4.
May 25 2023
FWIW: I have not done any tests but the comment below is about the case I suspected to be the cuase for your problem:
The fix actually does the same as my suggested workaround.
There is an easy workaround: Append an exclamation mark to the adsk key. This way gpg will only search for this subkey.
An example with my test keys: