-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Closed
Labels
branch: 1.0.2Applies to OpenSSL_1_0_2-stable branch (EOL)Applies to OpenSSL_1_0_2-stable branch (EOL)branch: 1.1.1Applies to OpenSSL_1_1_1-stable branch (EOL)Applies to OpenSSL_1_1_1-stable branch (EOL)branch: masterApplies to master branchApplies to master branch
Milestone
Description
Function BN_sub() subtracts b from a and places the result in r (r=a-b). It returns 0 on error. Function BN_X931_generate_Xpq() defined in crypto/bn/bn_x931p.c calls BN_sub() but forgets the return value check. See the following code:
int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx)
{
// omitted...
for (i = 0; i < 1000; i++) {
if (!BN_priv_rand(Xq, nbits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ANY))
goto err;
/* Check that |Xp - Xq| > 2^(nbits - 100) */
BN_sub(t, Xp, Xq); // missing return value check
if (BN_num_bits(t) > (nbits - 100))
break;
}
// omitted...
}Jiecheng Wu, Zuxing Gu
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
branch: 1.0.2Applies to OpenSSL_1_0_2-stable branch (EOL)Applies to OpenSSL_1_0_2-stable branch (EOL)branch: 1.1.1Applies to OpenSSL_1_1_1-stable branch (EOL)Applies to OpenSSL_1_1_1-stable branch (EOL)branch: masterApplies to master branchApplies to master branch