]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Fix assertion failure in Unix PuTTYgen exports.
authorSimon Tatham <anakin@pobox.com>
Thu, 16 Jan 2014 19:16:19 +0000 (19:16 +0000)
committerSimon Tatham <anakin@pobox.com>
Thu, 16 Jan 2014 19:16:19 +0000 (19:16 +0000)
The assertions I added to sshrand.c in r9930 are now justified,
because they were failing when cmdgen was used to convert a key into
either foreign private key file format - both the export functions
require random_byte() for one reason or another, and random_ref()
hadn't been called first.

[originally from svn r10117]
[r9930 == 33f485c1c3a0942192763f085292aa57d9c3de87]

cmdgen.c

index 69c0177c0878fddbffcca1ce6665760957aae316..c15c01dd34bab2e82bd6529b78387344bbd93980 100644 (file)
--- a/cmdgen.c
+++ b/cmdgen.c
@@ -1034,6 +1034,8 @@ int main(int argc, char **argv)
       case SSHCOM:
        assert(sshver == 2);
        assert(ssh2key);
+       random_ref(); /* both foreign key types require randomness,
+                       * for IV or padding */
        ret = export_ssh2(outfilename, outtype, ssh2key, passphrase);
        if (!ret) {
            fprintf(stderr, "puttygen: unable to export key\n");