summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
14ec1d8)
half-filled with null pointers.
git-svn-id: svn://svn.tartarus.org/sgt/putty@9986
cda61777-01e9-0310-a592-
d414129be87e
+static void dss_freekey(void *key); /* forward reference */
+
static void *dss_newkey(char *data, int len)
{
char *p;
static void *dss_newkey(char *data, int len)
{
char *p;
dss->y = getmp(&data, &len);
dss->x = NULL;
dss->y = getmp(&data, &len);
dss->x = NULL;
+ if (!dss->p || !dss->q || !dss->g || !dss->y ||
+ !bignum_cmp(dss->q, Zero) || !bignum_cmp(dss->p, Zero)) {
+ /* Invalid key. */
+ dss_freekey(dss);
+ return NULL;
+ }
+
Bignum ytest;
dss = dss_newkey((char *) pub_blob, pub_len);
Bignum ytest;
dss = dss_newkey((char *) pub_blob, pub_len);
+ if (!dss)
+ return NULL;
dss->x = getmp(&pb, &priv_len);
dss->x = getmp(&pb, &priv_len);
+ if (!dss->x) {
+ dss_freekey(dss);
+ return NULL;
+ }
/*
* Check the obsolete hash in the old DSS key format.
/*
* Check the obsolete hash in the old DSS key format.
dss->y = getmp(b, len);
dss->x = getmp(b, len);
dss->y = getmp(b, len);
dss->x = getmp(b, len);
- if (!dss->p || !dss->q || !dss->g || !dss->y || !dss->x) {
- freebn(dss->p);
- freebn(dss->q);
- freebn(dss->g);
- freebn(dss->y);
- freebn(dss->x);
- sfree(dss);
- return NULL;
+ if (!dss->p || !dss->q || !dss->g || !dss->y || !dss->x ||
+ !bignum_cmp(dss->q, Zero) || !bignum_cmp(dss->p, Zero)) {
+ /* Invalid key. */
+ dss_freekey(dss);
+ return NULL;
int ret;
dss = dss_newkey((char *) blob, len);
int ret;
dss = dss_newkey((char *) blob, len);
ret = bignum_bitcount(dss->p);
dss_freekey(dss);
ret = bignum_bitcount(dss->p);
dss_freekey(dss);