Fix from fips branch.
This commit is contained in:
parent
d4736ae701
commit
fb8fcce2ac
@ -117,13 +117,20 @@ static int dsa_builtin_paramgen(DSA *ret, int bits,
|
|||||||
if (bits < 512) bits=512;
|
if (bits < 512) bits=512;
|
||||||
bits=(bits+63)/64*64;
|
bits=(bits+63)/64*64;
|
||||||
|
|
||||||
if (seed_len < 20)
|
/* NB: seed_len == 0 is special case: copy generated seed to
|
||||||
|
* seed_in if it is not NULL.
|
||||||
|
*/
|
||||||
|
if (seed_len && (seed_len < 20))
|
||||||
seed_in = NULL; /* seed buffer too small -- ignore */
|
seed_in = NULL; /* seed buffer too small -- ignore */
|
||||||
if (seed_len > 20)
|
if (seed_len > 20)
|
||||||
seed_len = 20; /* App. 2.2 of FIPS PUB 186 allows larger SEED,
|
seed_len = 20; /* App. 2.2 of FIPS PUB 186 allows larger SEED,
|
||||||
* but our internal buffers are restricted to 160 bits*/
|
* but our internal buffers are restricted to 160 bits*/
|
||||||
if ((seed_in != NULL) && (seed_len == 20))
|
if ((seed_in != NULL) && (seed_len == 20))
|
||||||
|
{
|
||||||
memcpy(seed,seed_in,seed_len);
|
memcpy(seed,seed_in,seed_len);
|
||||||
|
/* set seed_in to NULL to avoid it being copied back */
|
||||||
|
seed_in = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if ((ctx=BN_CTX_new()) == NULL) goto err;
|
if ((ctx=BN_CTX_new()) == NULL) goto err;
|
||||||
|
|
||||||
@ -300,7 +307,7 @@ err:
|
|||||||
ok=0;
|
ok=0;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if ((m > 1) && (seed_in != NULL)) memcpy(seed_in,seed,20);
|
if (seed_in != NULL) memcpy(seed_in,seed,20);
|
||||||
if (counter_ret != NULL) *counter_ret=counter;
|
if (counter_ret != NULL) *counter_ret=counter;
|
||||||
if (h_ret != NULL) *h_ret=h;
|
if (h_ret != NULL) *h_ret=h;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user