mirror of
https://github.com/clearml/dropbear
synced 2025-01-31 10:57:01 +00:00
Fix build for dropbearkey and ecdsa with certain options
--HG-- branch : ecc
This commit is contained in:
parent
95a21c8fd7
commit
226671b550
@ -76,7 +76,7 @@ static void printhelp(char * progname) {
|
|||||||
" dss\n"
|
" dss\n"
|
||||||
#endif
|
#endif
|
||||||
#ifdef DROPBEAR_ECDSA
|
#ifdef DROPBEAR_ECDSA
|
||||||
" ecdsa\n"
|
" ecdsa\n"
|
||||||
#endif
|
#endif
|
||||||
"-f filename Use filename for the secret key\n"
|
"-f filename Use filename for the secret key\n"
|
||||||
"-s bits Key size in bits, should be a multiple of 8 (optional)\n"
|
"-s bits Key size in bits, should be a multiple of 8 (optional)\n"
|
||||||
@ -200,23 +200,44 @@ int main(int argc, char ** argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: put RSA and DSS size checks into genrsa.c etc
|
// TODO: put RSA and DSS size checks into genrsa.c etc
|
||||||
if (keytype == DROPBEAR_SIGNKEY_DSS && bits != 1024) {
|
switch (keytype) {
|
||||||
fprintf(stderr, "DSS keys have a fixed size of 1024 bits\n");
|
#ifdef DROPBEAR_RSA
|
||||||
exit(EXIT_FAILURE);
|
case DROPBEAR_SIGNKEY_RSA:
|
||||||
} else if (bits < 512 || bits > 4096 || (bits % 8 != 0)) {
|
if (bits < 512 || bits > 4096 || (bits % 8 != 0)) {
|
||||||
fprintf(stderr, "Bits must satisfy 512 <= bits <= 4096, and be a"
|
fprintf(stderr, "Bits must satisfy 512 <= bits <= 4096, and be a"
|
||||||
" multiple of 8\n");
|
" multiple of 8\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
if (keytype == DROPBEAR_SIGNKEY_DSS) {
|
#endif
|
||||||
bits = DSS_DEFAULT_SIZE;
|
#ifdef DROPEAR_DSS
|
||||||
} else if (keytype == DROPBEAR_SIGNKEY_RSA) {
|
case DROPBEAR_SIGNKEY_DSS:
|
||||||
bits = RSA_DEFAULT_SIZE;
|
if (bits != 1024) {
|
||||||
} else if (keytype == DROPBEAR_SIGNKEY_ECDSA_KEYGEN) {
|
fprintf(stderr, "DSS keys have a fixed size of 1024 bits\n");
|
||||||
bits = ECDSA_DEFAULT_SIZE;
|
exit(EXIT_FAILURE);
|
||||||
} else {
|
}
|
||||||
exit(EXIT_FAILURE); /* not reached */
|
#endif
|
||||||
|
// pass. ecdsa handles checks itself
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (keytype) {
|
||||||
|
#ifdef DROPBEAR_RSA
|
||||||
|
case DROPBEAR_SIGNKEY_RSA:
|
||||||
|
bits = RSA_DEFAULT_SIZE;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef DROPBEAR_DSS
|
||||||
|
case DROPBEAR_SIGNKEY_DSS:
|
||||||
|
bits = DSS_DEFAULT_SIZE;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef DROPBEAR_ECDSA
|
||||||
|
case DROPBEAR_SIGNKEY_ECDSA_KEYGEN:
|
||||||
|
bits = ECDSA_DEFAULT_SIZE;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
exit(EXIT_FAILURE); /* not reached */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
ecdsa.h
4
ecdsa.h
@ -5,6 +5,8 @@
|
|||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "signkey.h"
|
#include "signkey.h"
|
||||||
|
|
||||||
|
#ifdef DROPBEAR_ECDSA
|
||||||
|
|
||||||
#ifdef DROPBEAR_ECC_256
|
#ifdef DROPBEAR_ECC_256
|
||||||
#define ECDSA_DEFAULT_SIZE 256
|
#define ECDSA_DEFAULT_SIZE 256
|
||||||
#elif DROPBEAR_ECC_384
|
#elif DROPBEAR_ECC_384
|
||||||
@ -25,4 +27,6 @@ enum signkey_type ecdsa_signkey_type(ecc_key * key);
|
|||||||
void buf_put_ecdsa_sign(buffer *buf, ecc_key *key, buffer *data_buf);
|
void buf_put_ecdsa_sign(buffer *buf, ecc_key *key, buffer *data_buf);
|
||||||
int buf_ecdsa_verify(buffer *buf, ecc_key *key, buffer *data_buf);
|
int buf_ecdsa_verify(buffer *buf, ecc_key *key, buffer *data_buf);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // _ECDSA_H_
|
#endif // _ECDSA_H_
|
Loading…
Reference in New Issue
Block a user