X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=sshecc.c;h=46e6fadbec500c077e886ff01c64f074f8b56139;hb=15386cbe927fc85ac2fed0bb47704645c4b67dad;hp=bc842d0b467fa5f667d3a2856f5a6096f25e9ff4;hpb=63b47ed9d504b37ac2e903715ae7bf40036473a1;p=PuTTY.git diff --git a/sshecc.c b/sshecc.c index bc842d0b..46e6fadb 100644 --- a/sshecc.c +++ b/sshecc.c @@ -1648,6 +1648,7 @@ static int decodepoint_ed(const char *p, int length, struct ec_point *point) /* Read x bit and then reset it */ negative = bignum_bit(point->y, point->curve->fieldBits - 1); bignum_set_bit(point->y, point->curve->fieldBits - 1, 0); + bn_restore_invariant(point->y); /* Get the x from the y */ point->x = ecp_edx(point->curve, point->y); @@ -2267,6 +2268,7 @@ static int ecdsa_verifysig(void *key, const char *sig, int siglen, } getstring(&sig, &siglen, &p, &slen); + if (!p) return 0; if (ec->publicKey.curve->type == EC_EDWARDS) { struct ec_point *r; Bignum s, h; @@ -2759,10 +2761,7 @@ void *ssh_ecdhkex_newkey(const struct ssh_kex *kex) bytes[31] &= 127; bytes[31] |= 64; key->privateKey = bignum_from_bytes(bytes, sizeof(bytes)); - for (i = 0; i < sizeof(bytes); ++i) - { - ((volatile char*)bytes)[i] = 0; - } + smemclr(bytes, sizeof(bytes)); if (!key->privateKey) { sfree(key); return NULL; @@ -2938,6 +2937,9 @@ const unsigned char *ec_alg_oid(const struct ssh_signkey *alg, return extra->oid; } +const int ec_nist_curve_lengths[] = { 256, 384, 521 }; +const int n_ec_nist_curve_lengths = lenof(ec_nist_curve_lengths); + const int ec_nist_alg_and_curve_by_bits(int bits, const struct ec_curve **curve, const struct ssh_signkey **alg)