Fix possible race condition.
This commit is contained in:
parent
43e9f4ca2f
commit
8860f3a82a
1 changed files with 6 additions and 6 deletions
|
@ -358,12 +358,12 @@ BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,
|
|||
CRYPTO_w_lock(lock);
|
||||
if (!*pmont)
|
||||
{
|
||||
*pmont = BN_MONT_CTX_new();
|
||||
if (*pmont && !BN_MONT_CTX_set(*pmont, mod, ctx))
|
||||
{
|
||||
BN_MONT_CTX_free(*pmont);
|
||||
*pmont = NULL;
|
||||
}
|
||||
BN_MONT_CTX *mtmp;
|
||||
mtmp = BN_MONT_CTX_new();
|
||||
if (mtmp && !BN_MONT_CTX_set(mtmp, mod, ctx))
|
||||
BN_MONT_CTX_free(mtmp);
|
||||
else
|
||||
*pmont = mtmp;
|
||||
}
|
||||
CRYPTO_w_unlock(lock);
|
||||
return *pmont;
|
||||
|
|
Loading…
Reference in a new issue