projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
66f325f
)
Add sanity checks when generating new RSA keys.
author
Guus Sliepen
<guus@sliepen.org>
Tue, 13 May 2014 18:29:09 +0000
(20:29 +0200)
committer
Guus Sliepen
<guus@sliepen.org>
Tue, 13 May 2014 18:33:20 +0000
(20:33 +0200)
The key size should be a multiple of 8 bits, and it should be between 1024 and
8192 bits.
src/tincctl.c
patch
|
blob
|
history
diff --git
a/src/tincctl.c
b/src/tincctl.c
index
4864fab
..
2f7fe6b
100644
(file)
--- a/
src/tincctl.c
+++ b/
src/tincctl.c
@@
-417,6
+417,15
@@
static bool rsa_keygen(int bits, bool ask) {
FILE *f;
char *pubname, *privname;
+ // Make sure the key size is a multiple of 8 bits.
+ bits &= ~0x7;
+
+ // Force them to be between 1024 and 8192 bits long.
+ if(bits < 1024)
+ bits = 1024;
+ if(bits > 8192)
+ bits = 8192;
+
fprintf(stderr, "Generating %d bits keys:\n", bits);
if(!(key = rsa_generate(bits, 0x10001))) {