Mercurial > dropbear
comparison dropbearconvert.c @ 910:89555751c489 asm
merge up to 2013.63, improve ASM makefile rules a bit
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 27 Feb 2014 21:35:58 +0800 |
parents | 220f55d540ae |
children | 750ec4ec4cbe |
comparison
equal
deleted
inserted
replaced
909:e4b75744acab | 910:89555751c489 |
---|---|
26 #include "includes.h" | 26 #include "includes.h" |
27 #include "signkey.h" | 27 #include "signkey.h" |
28 #include "buffer.h" | 28 #include "buffer.h" |
29 #include "dbutil.h" | 29 #include "dbutil.h" |
30 #include "keyimport.h" | 30 #include "keyimport.h" |
31 #include "crypto_desc.h" | |
32 #include "dbrandom.h" | |
31 | 33 |
32 | 34 |
33 static int do_convert(int intype, const char* infile, int outtype, | 35 static int do_convert(int intype, const char* infile, int outtype, |
34 const char* outfile); | 36 const char* outfile); |
35 | 37 |
59 #endif | 61 #endif |
60 | 62 |
61 int intype, outtype; | 63 int intype, outtype; |
62 const char* infile; | 64 const char* infile; |
63 const char* outfile; | 65 const char* outfile; |
66 | |
67 crypto_init(); | |
68 seedrandom(); | |
64 | 69 |
65 #ifdef DEBUG_TRACE | 70 #ifdef DEBUG_TRACE |
66 /* It's hard for it to get in the way _too_ much */ | 71 /* It's hard for it to get in the way _too_ much */ |
67 debug_trace = 1; | 72 debug_trace = 1; |
68 #endif | 73 #endif |
109 | 114 |
110 static int do_convert(int intype, const char* infile, int outtype, | 115 static int do_convert(int intype, const char* infile, int outtype, |
111 const char* outfile) { | 116 const char* outfile) { |
112 | 117 |
113 sign_key * key = NULL; | 118 sign_key * key = NULL; |
114 char * keytype = NULL; | 119 const char * keytype = NULL; |
115 int ret = 1; | 120 int ret = 1; |
116 | 121 |
117 key = import_read(infile, NULL, intype); | 122 key = import_read(infile, NULL, intype); |
118 if (!key) { | 123 if (!key) { |
119 fprintf(stderr, "Error reading key from '%s'\n", | 124 fprintf(stderr, "Error reading key from '%s'\n", |
120 infile); | 125 infile); |
121 goto out; | 126 goto out; |
122 } | 127 } |
123 | 128 |
124 #ifdef DROPBEAR_RSA | 129 keytype = signkey_name_from_type(key->type, NULL); |
125 if (key->rsakey != NULL) { | |
126 keytype = "RSA"; | |
127 } | |
128 #endif | |
129 #ifdef DROPBEAR_DSS | |
130 if (key->dsskey != NULL) { | |
131 keytype = "DSS"; | |
132 } | |
133 #endif | |
134 | 130 |
135 fprintf(stderr, "Key is a %s key\n", keytype); | 131 fprintf(stderr, "Key is a %s key\n", keytype); |
136 | 132 |
137 if (import_write(outfile, key, NULL, outtype) != 1) { | 133 if (import_write(outfile, key, NULL, outtype) != 1) { |
138 fprintf(stderr, "Error writing key to '%s'\n", outfile); | 134 fprintf(stderr, "Error writing key to '%s'\n", outfile); |