Maximum memory and operations now both uint32

This commit is contained in:
Chris Oei 2012-09-02 20:19:20 -07:00
parent d496cad407
commit 162bda494e
3 changed files with 9 additions and 9 deletions

View file

@ -45,13 +45,13 @@
#define ENCBLOCK 65536 #define ENCBLOCK 65536
static int pickparams(size_t, int, static int pickparams(uint32_t, uint32_t,
int *, uint32_t *, uint32_t *); int *, uint32_t *, uint32_t *);
static int checkparams(size_t, int, int, uint32_t, uint32_t); static int checkparams(uint32_t, uint32_t, int, uint32_t, uint32_t);
static int getsalt(uint8_t[32]); static int getsalt(uint8_t[32]);
static int static int
pickparams(size_t maxmem, int megaops, pickparams(uint32_t maxmem, uint32_t megaops,
int * logN, uint32_t * r, uint32_t * p) int * logN, uint32_t * r, uint32_t * p)
{ {
size_t memlimit; size_t memlimit;
@ -110,7 +110,7 @@ pickparams(size_t maxmem, int megaops,
} }
static int static int
checkparams(size_t maxmem, int megaops, checkparams(uint32_t maxmem, uint32_t megaops,
int logN, uint32_t r, uint32_t p) int logN, uint32_t r, uint32_t p)
{ {
size_t memlimit; size_t memlimit;
@ -186,7 +186,7 @@ err0:
int int
genpass(uint8_t dk[64], genpass(uint8_t dk[64],
const uint8_t * passwd, size_t passwdlen, const uint8_t * passwd, size_t passwdlen,
size_t maxmem, int megaops) uint32_t maxmem, uint32_t megaops)
{ {
uint8_t salt[32]; uint8_t salt[32];
uint8_t hbuf[32]; uint8_t hbuf[32];

View file

@ -74,6 +74,6 @@
int genpass(uint8_t dk[64], int genpass(uint8_t dk[64],
const uint8_t * passwd, size_t passwdlen, const uint8_t * passwd, size_t passwdlen,
size_t maxmem, int megaops); uint32_t maxmem, uint32_t megaops);
#endif /* !_GENPASS_H_ */ #endif /* !_GENPASS_H_ */

6
main.c
View file

@ -51,8 +51,8 @@ main(int argc, char *argv[])
FILE * infile = NULL; FILE * infile = NULL;
FILE * outfile = stdout; FILE * outfile = stdout;
int dec = 0; int dec = 0;
size_t maxmem = 1000; uint32_t maxmem = 1000;
int megaops = 5; uint32_t megaops = 5;
char ch; char ch;
char * passwd; char * passwd;
int rc; int rc;
@ -69,7 +69,7 @@ main(int argc, char *argv[])
while ((ch = getopt(argc, argv, "hm:o:")) != -1) { while ((ch = getopt(argc, argv, "hm:o:")) != -1) {
switch (ch) { switch (ch) {
case 'm': case 'm':
maxmem = strtoumax(optarg, NULL, 0); maxmem = atoi(optarg);
break; break;
case 'o': case 'o':
megaops = atoi(optarg); megaops = atoi(optarg);