I'd somehow managed to declare an enum in cmdgen.c with key types
OPENSSH and SSHCOM, and use it interchangeably with the one in ssh.h
with SSH_KEYTYPE_OPENSSH and SSH_KEYTYPE_SSHCOM.
It so happened that the relevant two enum values matched up! So this
hasn't caused a bug yet, but it's an accident waiting to happen. Fix
it before it does.
outfilename = filename_from_str(outfile ? outfile : "");
switch (outtype) {
- int ret;
+ int ret, real_outtype;
case PRIVATE:
if (sshver == 1) {
assert(ssh2key);
random_ref(); /* both foreign key types require randomness,
* for IV or padding */
- ret = export_ssh2(outfilename, outtype, ssh2key, passphrase);
+ switch (outtype) {
+ case OPENSSH:
+ real_outtype = SSH_KEYTYPE_OPENSSH;
+ break;
+ case SSHCOM:
+ real_outtype = SSH_KEYTYPE_SSHCOM;
+ break;
+ }
+ ret = export_ssh2(outfilename, real_outtype, ssh2key, passphrase);
if (!ret) {
fprintf(stderr, "puttygen: unable to export key\n");
return 1;