diff options
| author | NIIBE Yutaka <[email protected]> | 2025-07-29 06:15:43 +0000 |
|---|---|---|
| committer | NIIBE Yutaka <[email protected]> | 2025-07-29 06:15:43 +0000 |
| commit | fe62b4b00bc6b396be12561f66997a4a80cb12d2 (patch) | |
| tree | 83a42fed684e31b7dc7c325514709005fea34e06 /agent/divert-scd.c | |
| parent | Post release updates (diff) | |
| download | gnupg-fe62b4b00bc6b396be12561f66997a4a80cb12d2.tar.gz gnupg-fe62b4b00bc6b396be12561f66997a4a80cb12d2.zip | |
agent: Fix for smartcard decryption, checking compressed format.
* agent/agent.h (agent_card_pkdecrypt): Fix the type of R_BUF.
* agent/call-scd.c (agent_card_pkdecrypt): Likewise.
* agent/divert-scd.c (divert_pkdecrypt): Follow the change.
* agent/divert-scd.c (agent_card_ecc_kem): The prefix may be
0x02 or 0x03 depending on hidden y-coordinate.
--
Fixes-commit: 4ad08a8998fa16f8329fb57b0a47fe7a9b973700
GnuPG-bug-id: 7709
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'agent/divert-scd.c')
| -rw-r--r-- | agent/divert-scd.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/agent/divert-scd.c b/agent/divert-scd.c index 15d1abd8d..e0b5164b5 100644 --- a/agent/divert-scd.c +++ b/agent/divert-scd.c @@ -394,7 +394,7 @@ divert_pkdecrypt (ctrl_t ctrl, int depth; const unsigned char *ciphertext; size_t ciphertextlen; - char *plaintext; + unsigned char *plaintext; size_t plaintextlen; bin2hex (grip, 20, hexgrip); @@ -504,7 +504,7 @@ agent_card_ecc_kem (ctrl_t ctrl, const unsigned char *ecc_ct, size_t ecc_point_len, unsigned char *ecc_ecdh) { gpg_error_t err = 0; - char *ecdh = NULL; + unsigned char *ecdh = NULL; size_t len; int rc; char hexgrip[KEYGRIP_LEN*2+1]; @@ -517,7 +517,8 @@ 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 && (len - 1) * 2 == ecc_point_len - 1 && ecdh[0] == 0x02) + else if (len && (len - 1) * 2 == ecc_point_len - 1 + && (ecdh[0] & ~1) == 0x02) { /* It's x-coordinate-only (compressed) point representation. */ memcpy (ecc_ecdh, ecdh, len); |
