fixed improper use of negative value
This commit is contained in:
parent
761e175212
commit
a4c8d67110
|
@ -803,9 +803,10 @@ static void ask_for_password(char **pwd, int *pwdlen)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int generate_pwd_shares(sc_card_t *card, char **pwd, int *pwdlen, int password_shares_threshold, int password_shares_total)
|
static int generate_pwd_shares(sc_card_t *card, char **pwd, int *pwdlen, int password_shares_threshold, unsigned int password_shares_total)
|
||||||
{
|
{
|
||||||
int r, i;
|
int r;
|
||||||
|
unsigned int i;
|
||||||
BIGNUM prime;
|
BIGNUM prime;
|
||||||
BIGNUM secret;
|
BIGNUM secret;
|
||||||
unsigned char buf[64];
|
unsigned char buf[64];
|
||||||
|
@ -907,7 +908,7 @@ static int generate_pwd_shares(sc_card_t *card, char **pwd, int *pwdlen, int pas
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int create_dkek_share(sc_card_t *card, const char *outf, int iter, const char *password, int password_shares_threshold, int password_shares_total)
|
static int create_dkek_share(sc_card_t *card, const char *outf, int iter, const char *password, int password_shares_threshold, unsigned int password_shares_total)
|
||||||
{
|
{
|
||||||
EVP_CIPHER_CTX ctx;
|
EVP_CIPHER_CTX ctx;
|
||||||
FILE *out = NULL;
|
FILE *out = NULL;
|
||||||
|
@ -1568,8 +1569,15 @@ int main(int argc, char * const argv[])
|
||||||
if (do_initialize && initialize(card, opt_so_pin, opt_pin, opt_retry_counter, opt_dkek_shares, opt_label))
|
if (do_initialize && initialize(card, opt_so_pin, opt_pin, opt_retry_counter, opt_dkek_shares, opt_label))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (do_create_dkek_share && create_dkek_share(card, opt_filename, opt_iter, opt_password, opt_password_shares_threshold, opt_password_shares_total))
|
if (do_create_dkek_share) {
|
||||||
|
if (opt_password_shares_total <= 0) {
|
||||||
|
fprintf(stderr, "The number of password shares must be bigger than 0.");
|
||||||
goto fail;
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (create_dkek_share(card, opt_filename, opt_iter, opt_password, opt_password_shares_threshold, opt_password_shares_total))
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
if (do_import_dkek_share && import_dkek_share(card, opt_filename, opt_iter, opt_password, opt_password_shares_total))
|
if (do_import_dkek_share && import_dkek_share(card, opt_filename, opt_iter, opt_password, opt_password_shares_total))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
Loading…
Reference in New Issue