Let me clarify the use case of gpg-error.m4.
- Queries
- All Stories
- Search
- Advanced Search
- Transactions
- Transaction Logs
All Stories
Nov 15 2021
Or, we can use memcmp to avoid arguing semantics of strncmp, and make it a bit cleaner to avoid calling strlen multple times by put_membuf_str.
diff --git a/g10/export.c b/g10/export.c index 98c4623cf..c7cfcfaa4 100644 --- a/g10/export.c +++ b/g10/export.c @@ -2133,14 +2133,15 @@ key_to_sshblob (membuf_t *mb, const char *identifier, ...) size_t buflen; gcry_mpi_t a;
In T5365#144688, @gniibe wrote:If it is new, it may be the change of this commit rC8e3cd4c4677c: build: Update gpg-error.m4.
We know that problematic strncmp implementation: T5443
So, I don't blame Coverity. But I think that it's better to fix strncmp implementation.
The old code using sizeof(kek_params) (which is used for log_printhex) is incorrect; the value is the size of pointer to byte. It may works for 32-bit architectures, though.
On the machine which has 8 for a pointer, it will cause accessing wrong area, when DPG_CRYPTO is enabled.
I tried following the README instructions, but getting:
I just read https://github.com/gpg/libgpg-error/blob/master/README#L119 and realize this is by design...
Nov 14 2021
Nov 13 2021
Nov 12 2021
Okay, I revisited the code:
Do not user Reiner SCT those readers are all buggy and work only on Windows - if at all. Stay away from them and get a real reader and not the incompatible broken stuff from that company. I spent way too much time trying to get those readers working. That time is better invested in support for hardware which is standard compatible or are helpful to get stuff running.
The internal hashing of ed25519 is not used by OpenPGP but instead we pass the hash of the message to the ed25519 function and thus to the card. Pushing a message through a card is a no-go - way too slow for any normal sized message.
Some more info: OpenVPN does not care about the second reader only gnupg agent is sensitive to what is present when it is started. So a workaround that I just found is to disable the Virtual Smartcard reader first so that only the ReinerSCT smartcard reader with an OpenPGP V3.4 card is present. Make sure to open an SSH connection. Then reconnect the second reader. And reconnect to VPN. After the PIN for the OpenPGP V3.4 card is already cached and a connection to the card established I can also open more SSH connections with the second reader attached and disconnect and reconnect the VPN as I want.
Even removing the smartcard from the ReinerSCT reader and plugging it back in works and I can still authenticate with new SSH tunnels and both readers present. So it seems it is actually only important which readers are present when the agent connects for the first time.
So this is a practical woraround. Although disabling the TPM backed reader temporarily needs Admin rights and is really janky.
I am on Windows 10 21H1 and I using gnupg-w32-2.3.3_20211012 from here [1]
Together with win-gpg-agent, which extends gnupg to play nicely with Windows sockets. [2]
Since hashing happens on-card for ed25519 I'm not sure what limits gpg wants to impose, currently the data is passed straight through and scdaemon will happily try to send more than 255 bytes of data as a short apdu here. My patch is probably not correct, I assume it needs to care about cardcap.ext_lc_le and chunking as well.
That does not seem to be right. You don't need 255 bytes for an ECC key. It would be best to get scdaemon logs simialr to the gpg-agent logs. Set "debug ipc,cardio" into scdaemon.conf.
What is the rational for this change?
Under C11, it seems OK (strncmp).
https://stackoverflow.com/questions/38878195/does-this-usage-of-strncmp-contain-an-out-of-bounds-read
I applied most of gnupg-coverity.patch.
- Part 1 is not applied; It should be handled later.
- Part 2: applied
- Part 3: applied
- Part 4: applied, but spell fixes not require ChangeLog entry
- Part 5
- ecdh part is fixed differently
- export.c part is not applied for now, because of semantics/interpretation of strncmp; POSIX says differently although it says it's ISO C standard which defines. https://pubs.opengroup.org/onlinepubs/9699919799/functions/strncmp.html
- Part 6: applied
- Part 7: applied, but empty initializer is GNU extension (or the way of C++), so first 0
- Part 8: applied
- Part 9: applied, but one more fix
Nov 11 2021
A first version has landed.