aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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