X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/c2603631178b688a6f8ce5eccd461e74718058d5..1aaccf40b93719fd3df7cc89e023b9bb48b358b6:/pub/ed25519.c diff --git a/pub/ed25519.c b/pub/ed25519.c index f23c272a..7fddf987 100644 --- a/pub/ed25519.c +++ b/pub/ed25519.c @@ -441,6 +441,8 @@ int ed25519_verify(const octet K[ED25519_PUBSZ], #include #include +#include "ct.h" + static int vrf_pubkey(dstr dv[]) { dstr dpub = DSTR_INIT; @@ -448,8 +450,10 @@ static int vrf_pubkey(dstr dv[]) if (dv[1].len != ED25519_PUBSZ) die(1, "bad pub length"); + ct_poison(dv[0].buf, dv[0].len); dstr_ensure(&dpub, ED25519_PUBSZ); dpub.len = ED25519_PUBSZ; ed25519_pubkey((octet *)dpub.buf, dv[0].buf, dv[0].len); + ct_remedy(dpub.buf, dpub.len); if (memcmp(dpub.buf, dv[1].buf, ED25519_PUBSZ) != 0) { ok = 0; fprintf(stderr, "failed!"); @@ -473,6 +477,7 @@ static int vrf_sign(dstr *priv, int phflag, dstr *perso, if (want->len != ED25519_SIGSZ) die(1, "bad result length"); + ct_poison(priv->buf, priv->len); dstr_ensure(&dsig, ED25519_SIGSZ); dsig.len = ED25519_SIGSZ; if (phflag <= 0) m = msg; @@ -487,6 +492,7 @@ static int vrf_sign(dstr *priv, int phflag, dstr *perso, ed25519ctx_sign((octet *)dsig.buf, priv->buf, priv->len, K, phflag, perso ? perso->buf : 0, perso ? perso->len : 0, m->buf, m->len); + ct_remedy(dsig.buf, dsig.len); if (memcmp(dsig.buf, want->buf, ED25519_SIGSZ) != 0) { ok = 0; fprintf(stderr, "failed!");