Mercurial > dropbear
comparison keyimport.c @ 846:b298bb438625 keyondemand
refactor key generation, make it generate as required.
Needs UI in server command line options
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 07 Nov 2013 00:18:52 +0800 |
parents | 774ad9b112ef |
children | f4bb964c8678 |
comparison
equal
deleted
inserted
replaced
845:774ad9b112ef | 846:b298bb438625 |
---|---|
110 | 110 |
111 static sign_key *dropbear_read(const char* filename) { | 111 static sign_key *dropbear_read(const char* filename) { |
112 | 112 |
113 buffer * buf = NULL; | 113 buffer * buf = NULL; |
114 sign_key *ret = NULL; | 114 sign_key *ret = NULL; |
115 int type; | 115 enum signkey_type type; |
116 | 116 |
117 buf = buf_new(MAX_PRIVKEY_SIZE); | 117 buf = buf_new(MAX_PRIVKEY_SIZE); |
118 if (buf_readfile(buf, filename) == DROPBEAR_FAILURE) { | 118 if (buf_readfile(buf, filename) == DROPBEAR_FAILURE) { |
119 goto error; | 119 goto error; |
120 } | 120 } |
499 memset(&key, 0, sizeof(key)); | 499 memset(&key, 0, sizeof(key)); |
500 m_free(key); | 500 m_free(key); |
501 return ret; | 501 return ret; |
502 } | 502 } |
503 | 503 |
504 static sign_key *openssh_read(const char *filename, char *passphrase) | 504 static sign_key *openssh_read(const char *filename, char * UNUSED(passphrase)) |
505 { | 505 { |
506 struct openssh_key *key; | 506 struct openssh_key *key; |
507 unsigned char *p; | 507 unsigned char *p; |
508 int ret, id, len, flags; | 508 int ret, id, len, flags; |
509 int i, num_integers = 0; | 509 int i, num_integers = 0; |
510 sign_key *retval = NULL; | 510 sign_key *retval = NULL; |
511 char *errmsg; | 511 char *errmsg; |
512 char *modptr = NULL; | 512 char *modptr = NULL; |
513 int modlen = -9999; | 513 int modlen = -9999; |
514 int type; | 514 enum signkey_type type; |
515 | 515 |
516 sign_key *retkey; | 516 sign_key *retkey; |
517 buffer * blobbuf = NULL; | 517 buffer * blobbuf = NULL; |
518 | 518 |
519 retkey = new_sign_key(); | 519 retkey = new_sign_key(); |
1016 parameters [0] ECDomainParameters {{ SECGCurveNames }} OPTIONAL, | 1016 parameters [0] ECDomainParameters {{ SECGCurveNames }} OPTIONAL, |
1017 publicKey [1] BIT STRING OPTIONAL | 1017 publicKey [1] BIT STRING OPTIONAL |
1018 } | 1018 } |
1019 */ | 1019 */ |
1020 buffer *seq_buf = buf_new(400); | 1020 buffer *seq_buf = buf_new(400); |
1021 ecc_key **eck = signkey_ecc_key_ptr(key, key->type); | 1021 ecc_key **eck = (ecc_key**)signkey_key_ptr(key, key->type); |
1022 const unsigned long curve_size = (*eck)->dp->size; | 1022 const long curve_size = (*eck)->dp->size; |
1023 int curve_oid_len = 0; | 1023 int curve_oid_len = 0; |
1024 const void* curve_oid = NULL; | 1024 const void* curve_oid = NULL; |
1025 unsigned long pubkey_size = 2*curve_size+1; | 1025 unsigned long pubkey_size = 2*curve_size+1; |
1026 | 1026 |
1027 /* version. less than 10 bytes */ | 1027 /* version. less than 10 bytes */ |