added check for weak passphrase using entropy test

This commit is contained in:
git@daemon.de
2015-08-17 20:15:20 +02:00
parent 8fb7369d64
commit 64a45583d0
6 changed files with 928 additions and 771 deletions

View File

@@ -87,8 +87,12 @@ void pcp_keygen(char *passwd) {
if(strnlen(passphrase, 1024) > 0) {
double ent = pcp_getentropy(passphrase);
if(ent < 3) {
fprintf(stderr, "WARNING: you are using a weak passphrase (entropy: %lf)\n", ent);
if(ent < 3.32) {
fprintf(stderr, "WARNING: you are using a weak passphrase (entropy: %lf)!\n", ent);
char *yes = pcp_getstdin("Are you sure to use it [yes|NO]?");
if(strncmp(yes, "yes", 1024) != 0) {
goto errkg1;
}
}
key = pcpkey_encrypt(ptx, k, passphrase);
}