mirror of
https://github.com/cathugger/mkp224o.git
synced 2025-12-05 21:27:13 -06:00
tweak passphrase code
This commit is contained in:
13
main.c
13
main.c
@@ -926,8 +926,10 @@ int main(int argc,char **argv)
|
|||||||
#ifdef PASSPHRASE
|
#ifdef PASSPHRASE
|
||||||
} else if (*arg == 'p') {
|
} else if (*arg == 'p') {
|
||||||
if (argc--) {
|
if (argc--) {
|
||||||
|
const char *phrase = *argv++;
|
||||||
|
|
||||||
|
deterministic = 1;
|
||||||
static unsigned char salt[crypto_pwhash_SALTBYTES] = {0};
|
static unsigned char salt[crypto_pwhash_SALTBYTES] = {0};
|
||||||
const char *phrase = *argv;
|
|
||||||
if (!strcmp(phrase,"@")) {
|
if (!strcmp(phrase,"@")) {
|
||||||
phrase = getenv("PASSPHRASE");
|
phrase = getenv("PASSPHRASE");
|
||||||
if (phrase == NULL) {
|
if (phrase == NULL) {
|
||||||
@@ -935,17 +937,16 @@ int main(int argc,char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deterministic = 1;
|
|
||||||
fprintf(stderr, "expanding passphrase..."); fflush(stderr);
|
fprintf(stderr,"expanding passphrase...");
|
||||||
if (crypto_pwhash(determseed,sizeof(determseed),
|
if (crypto_pwhash(determseed,sizeof(determseed),
|
||||||
phrase,strlen(phrase),salt,
|
phrase,strlen(phrase),salt,
|
||||||
PWHASH_OPSLIMIT, PWHASH_MEMLIMIT, PWHASH_ALG)) {
|
PWHASH_OPSLIMIT,PWHASH_MEMLIMIT,PWHASH_ALG) != 0)
|
||||||
|
{
|
||||||
fprintf(stderr," out of memory!\n");
|
fprintf(stderr," out of memory!\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
fprintf(stderr," done.\n");
|
fprintf(stderr," done.\n");
|
||||||
argv++;
|
|
||||||
} else
|
} else
|
||||||
e_additional();
|
e_additional();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user