chiark / gitweb /
server/dh.c: Set the correct scalar size when loading XDH keys.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 9 Jul 2017 18:31:58 +0000 (19:31 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 9 Jul 2017 18:31:58 +0000 (19:31 +0100)
This was left hardcoded as 32 bytes, which means that X448 could never
work.  (The `x448_stsc' function always fails because the buffer size
doesn't match its expectation.)

server/dh.c

index 5c27a07..014446e 100644 (file)
@@ -702,7 +702,9 @@ static void ecdh_freege(const dhgrp *gg, dhge *YY)
   }                                                                    \
                                                                        \
   KLOAD(xdh, xdh, XDH,                                                 \
-       { kd->grp = CREATE(dhgrp); kd->grp->scsz = 32; },               \
+       { kd->grp = CREATE(dhgrp);                                      \
+         kd->grp->scsz = XDH##_KEYSZ;                                  \
+       },                                                              \
        { if ((kd->k = xdh##_bintosc(&p.priv)) == 0) {                  \
            a_format(e, "bad-private-key", A_END);                      \
            goto fail;                                                  \