diff options
author | Like Ma <likemartinma@gmail.com> | 2015-01-23 22:23:23 +0800 |
---|---|---|
committer | Like Ma <likemartinma@gmail.com> | 2015-01-23 22:23:23 +0800 |
commit | 9105371dc8125838a0a4ed80bc748ab4c7841cdd (patch) | |
tree | f3b98ab9cd5adef95eb0d7b67f1213a3d7343ef3 | |
parent | ae2da22ed2b219c75e16114e2f503b1d09b9494a (diff) | |
download | dropbear-9105371dc8125838a0a4ed80bc748ab4c7841cdd.tar.gz |
Fix variables may be uninitialized.
(fixup of pull request #7)
-rw-r--r-- | keyimport.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/keyimport.c b/keyimport.c index 3da14ad..272fcce 100644 --- a/keyimport.c +++ b/keyimport.c @@ -602,13 +602,18 @@ static sign_key *openssh_read(const char *filename, char * UNUSED(passphrase)) */ blobbuf = buf_new(3000); +#ifdef DROPBEAR_DSS if (key->type == OSSH_DSA) { buf_putstring(blobbuf, "ssh-dss", 7); retkey->type = DROPBEAR_SIGNKEY_DSS; - } else if (key->type == OSSH_RSA) { + } +#endif +#ifdef DROPBEAR_RSA + if (key->type == OSSH_RSA) { buf_putstring(blobbuf, "ssh-rsa", 7); retkey->type = DROPBEAR_SIGNKEY_RSA; } +#endif for (i = 0; i < num_integers; i++) { ret = ber_read_id_len(p, key->keyblob+key->keyblob_len-p, @@ -622,7 +627,7 @@ static sign_key *openssh_read(const char *filename, char * UNUSED(passphrase)) if (i == 0) { /* First integer is a version indicator */ - int expected; + int expected = -1; switch (key->type) { case OSSH_RSA: case OSSH_DSA: @@ -821,7 +826,7 @@ static int openssh_write(const char *filename, sign_key *key, unsigned char *outblob = NULL; int outlen = -9999; struct mpint_pos numbers[9]; - int nnumbers = -1, pos, len, seqlen, i; + int nnumbers = -1, pos = 0, len = 0, seqlen, i; char *header = NULL, *footer = NULL; char zero[1]; int ret = 0; @@ -831,7 +836,14 @@ static int openssh_write(const char *filename, sign_key *key, mp_int dmp1, dmq1, iqmp, tmpval; /* for rsa */ #endif - if (key->type == DROPBEAR_SIGNKEY_RSA || key->type == DROPBEAR_SIGNKEY_DSS) + if ( +#ifdef DROPBEAR_RSA + key->type == DROPBEAR_SIGNKEY_RSA || +#endif +#ifdef DROPBEAR_DSS + key->type == DROPBEAR_SIGNKEY_DSS || +#endif + 0) { /* * Fetch the key blobs. |