/* This program converts to/from Dropbear and OpenSSH private-key formats */
#include "includes.h"
-#include "runopts.h"
#include "signkey.h"
#include "buffer.h"
-#include "util.h"
+#include "dbutil.h"
#include "keyimport.h"
static void printhelp(char * progname) {
fprintf(stderr, "Usage: %s <inputtype> <outputtype> <inputfile> <outputfile>\n\n"
- "Caution: This program is for convenience only, and is not secure if used on\n"
- "untrusted input files -- don't run this as root on random luser's files :)\n"
+ "CAUTION: This program is for convenience only, and is not secure if used on\n"
+ "untrusted input files, ie it could allow arbitrary code execution.\n"
"All parameters must be specified in order.\n"
"\n"
"The input and output types are one of:\n"
"dropbear\n"
"\n"
"Example:\n"
- "dropbearconvert openssh dropbear /etc/ssh/ssh_host_rsa_key /etc/dropbear_rsa_host_key\n"
- "\n"
- "The inputfile and output file can be '-' to specify"
- "standard input or standard output.", progname);
+ "dropbearconvert openssh dropbear /etc/ssh/ssh_host_rsa_key /etc/dropbear_rsa_host_key\n",
+ progname);
}
+#if defined(DBMULTI_dropbearconvert) || !defined(DROPBEAR_MULTI)
+#if defined(DBMULTI_dropbearconvert) && defined(DROPBEAR_MULTI)
+int dropbearconvert_main(int argc, char ** argv) {
+#else
int main(int argc, char ** argv) {
+#endif
int intype, outtype;
const char* infile;
const char* outfile;
+#ifdef DEBUG_TRACE
+ /* It's hard for it to get in the way _too_ much */
+ debug_trace = 1;
+#endif
+
/* get the commandline options */
if (argc != 5) {
fprintf(stderr, "All arguments must be specified\n");
printhelp(argv[0]);
return 1;
}
+#endif
static int do_convert(int intype, const char* infile, int outtype,
const char* outfile) {
sign_key * key = NULL;
- char * keytype;
+ char * keytype = NULL;
int ret = 1;
key = import_read(infile, NULL, intype);
goto out;
}
- keytype = key->rsakey != NULL ? "RSA" : "DSS";
+#ifdef DROPBEAR_RSA
+ if (key->rsakey != NULL) {
+ keytype = "RSA";
+ }
+#endif
+#ifdef DROPBEAR_DSS
+ if (key->dsskey != NULL) {
+ keytype = "DSS";
+ }
+#endif
fprintf(stderr, "Key is a %s key\n", keytype);