aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2025-07-17 00:31:31 +0000
committerNIIBE Yutaka <[email protected]>2025-07-17 00:31:31 +0000
commit4ad08a8998fa16f8329fb57b0a47fe7a9b973700 (patch)
treec34ed67532af2d9c6509c800321cf94bff6115be
parentagent: Another fix for a regression with unknown curves and ssh (diff)
downloadgnupg-4ad08a8998fa16f8329fb57b0a47fe7a9b973700.tar.gz
gnupg-4ad08a8998fa16f8329fb57b0a47fe7a9b973700.zip
agent: Fix for smartcard decryption returning x-coordinate only.
* agent/divert-scd.c (agent_card_ecc_kem): Handle the case where smartcard returns x-coordinate only. -- GnuPG-bug-id: 7709 Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--agent/divert-scd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/agent/divert-scd.c b/agent/divert-scd.c
index 1e5de4671..7e0d8eccb 100644
--- a/agent/divert-scd.c
+++ b/agent/divert-scd.c
@@ -517,6 +517,12 @@ agent_card_ecc_kem (ctrl_t ctrl, const unsigned char *ecc_ct,
if (len == ecc_point_len)
memcpy (ecc_ecdh, ecdh, len);
+ else if ((len - 1) * 2 == ecc_point_len - 1 && ecdh[0] == 0x02)
+ {
+ /* It's x-coordinate-only (compressed) point representation. */
+ memcpy (ecc_ecdh, ecdh, len);
+ memset (ecc_ecdh + len, 0, ecc_point_len - len);
+ }
else if (len == ecc_point_len + 1 && ecdh[0] == 0x40) /* The prefix */
memcpy (ecc_ecdh, ecdh + 1, len - 1);
else