Lines Matching refs:bnN
25859 201 BIGNUM *bnN;
25876 213 bnN = BN_CTX_get(context);
25883 220 || BN_bin2bn(n->buffer, n->size, bnN) == NULL
25892 229 if (BN_div(bnQ, bnR, bnN, bnD, context) != 1)
26054 340 BIGNUM *bnN;
26064 350 bnN = BN_CTX_get(context);
26067 353 if(bnN == NULL)
26078 359 || BN_bin2bn(n, nSize, bnN) == NULL)
26083 364 if(BN_ucmp(bnM, bnN) >= 0)
26089 370 if(!(BN_mod_exp(bnC, bnM, bnE, bnN, context)))
28865 11 BIGNUM *bnN;
28888 29 bnN = BN_CTX_get(context);
28900 41 if( BN_bin2bn(key->publicKey->buffer, key->publicKey->size, bnN) == NULL
28909 50 if(BN_num_bits(bnP) < BN_num_bits(bnN)/2)
28915 56 if (BN_div(bnQ, bnQr, bnN, bnP, context) != 1)
28925 66 if( BN_copy(bnPhi, bnN) == NULL
28994 115 BIGNUM *bnN;
29024 140 bnN = BN_CTX_get(context); // public modulus (n)
29051 167 if(BN_mul(bnN, bnP, bnQ, context) != 1)
29056 172 if(BN_num_bits(bnN) != (publicKey->size * 8))
29061 177 BN_bn2bin(bnN, publicKey->buffer);
29066 182 BN_bin2bn(publicKey->buffer, publicKey->size, bnN);
29069 185 if(BN_div(bnQ, bnQr, bnN, bnP, context) != 1)
29080 196 BN_copy(bnPhi, bnN);
30232 1040 BIGNUM *bnN;
30266 1069 bnN = BN_CTX_get(context);
30267 1070 if(bnN == NULL)
30403 1196 BN_mul(bnN, bnP, bnQ, context);
30404 1197 if(BN_num_bits(bnN) != keySizeInBits)
30408 1201 BnTo2B(n, bnN, n->size); // Will pad the buffer to the correct size
30419 1212 BN_sub(bnT, bnN, bnP);
30457 1250 || BN_mod_exp(bnQ, bnP, bnE, bnN, context) != 1
30459 1252 || BN_mod_exp(bnQ, bnQ, bnT, bnN, context) != 1)
31130 …unction does a prime sieve over the input field which has as its starting address the value in bnN.
31138 348 BIGNUM *bnN, // IN/OUT: number to sieve
31164 369 pAssert(field != NULL && bnN != NULL);
31174 379 adjust = BN_mod_word(bnN,105);
31185 390 BN_sub_word(bnN, adjust);
31222 427 composite = BN_mod_word(bnN, composite);
31540 670 BIGNUM *bnN;
31567 697 bnN = BN_CTX_get(context);
31568 698 if(bnN == NULL)
31636 761 if( BN_mul(bnN, bnP, bnQ, context) != 1
31637 762 || BN_num_bits(bnN) != keySizeInBits)
31640 765 BnTo2B(n, bnN, n->size);
31654 774 if( BN_sub(bnT, bnN, bnP) != 1
31684 804 || BN_mod_exp(bnQ, bnP, bnE, bnN, context) != 1
31686 806 || BN_mod_exp(bnQ, bnQ, bnT, bnN, context) != 1)
33211 97 BIGNUM *bnN;
33228 114 bnN = BN_CTX_get(context);
33241 127 BnFrom2B(bnN, curveData->n);
33254 135 && EC_GROUP_set_generator(group, P, bnN, bnH)
34000 699 BIGNUM *bnN;
34022 715 bnN = BN_CTX_get(context);
34032 725 || BN_bin2bn(curveData->n->buffer, curveData->n->size, bnN) == NULL)
34079 767 BN_mod(bnR, bnR, bnN, context);
34090 778 if( BN_mod_inverse(bnIk, bnK, bnN, context) != NULL)
34127 815 // now have inverse of K (bnIk), z (bnZ), r (bnR), d (bnD) and n (bnN)
34130 818 if( !BN_mod_mul(bnD, bnR, bnD, bnN, context)
34136 824 || !BN_mod_mul(bnD, bnIk, bnD, bnN, context)
34190 858 BIGNUM *bnN, *bnK, *bnT, *bnD;
34224 886 bnN = BN_CTX_get(context);
34234 896 if( BN_bin2bn(n->buffer, n->size, bnN) == NULL
34241 903 OK = OK && BN_mod(bnT, bnT, bnN, context);
34245 907 OK = OK && BN_mod_mul(bnD, bnT, bnD, bnN, context) == 1;
34247 909 OK = OK && BN_mod_add(bnD, bnK, bnD, bnN, context) == 1;
34299 937 BIGNUM *bnR, *bnN, *bnK, *bnT, *bnD;
34336 974 bnN = BN_CTX_get(context);
34353 986 if(BN_bin2bn(curveData->n->buffer, curveData->n->size, bnN) == NULL)
34381 1014 BN_mod(bnR, bnR, bnN, context);
34398 1031 BN_div(NULL, bnT, bnT, bnN, context);
34505 1113 BIGNUM *bnN;
34525 1133 bnN = BN_CTX_get(context);
34533 1141 BnFrom2B(bnN, curveData->n);
34560 1163 if( BN_ucmp(bnK, bnN) >= 0
34574 1177 if(!BN_mod_add(bnR, bnE, bnX1, bnN, context))
34586 1189 if(BN_is_zero(bnR) || BN_ucmp(bnT, bnN) == 0)
34593 1196 || !BN_mod_inverse(bnT, bnT, bnN, context) // (1 + dA)^-1 mod n
34602 1205 if( !BN_mod_mul(bnS, bnD, bnR, bnN, context) // (r * dA) mod n
34603 1206 || !BN_mod_sub(bnS, bnK, bnS, bnN, context) // (k - (r * dA) mod n
34604 1207 || !BN_mod_mul(bnS, bnT, bnS, bnN, context))// t * (k - (r * dA) mod n
34730 1301 BIGNUM *bnN;
34759 1330 bnN = BN_CTX_get(context);
34801 1367 || BN_bin2bn(curveData->n->buffer, curveData->n->size, bnN) == NULL)
34813 1379 if (BN_mod_inverse(bnW, bnS, bnN, context) == NULL)
34817 1383 if( !BN_mod_mul(bnU1, bnE, bnW, bnN, context)
34818 1384 || !BN_mod_mul(bnU2, bnR, bnW, bnN, context))
34831 1397 || !BN_mod(bnV, bnV, bnN, context))
35160 1655 BIGNUM *bnN // IN: the order of the curve
35164 1659 int f = (BN_num_bits(bnN) + 1) / 2;
35213 1686 BIGNUM *bnN;
35230 1703 bnN = BN_CTX_get(context);
35251 1724 BnFrom2B(bnN, curveData->n);
35274 1742 avf1(bnTa, bnN);
35276 1744 !BN_mod_mul(bnTa, bnDsA, bnTa, bnN, context)
35279 1747 || !BN_mod_add(bnTa, bnDeA, bnTa, bnN, context)
35297 1765 avf1(bnXeB, bnN);
35310 1778 Point2B(group, outZ, pQeB, (INT16)BN_num_bytes(bnN), context);
35343 1796 BIGNUM *bnN // IN: the order of the curve
35347 1800 int w = ((BN_num_bits(bnN) + 1) / 2) - 1;
35388 1829 BIGNUM *bnN;
35411 1846 bnN = BN_CTX_get(context);
35426 1861 BnFrom2B(bnN, curveData->n);
35443 1878 avfSm2(bnTa, bnN);
35445 1880 !BN_mod_mul(bnTa, bnDeA, bnTa, bnN, context)
35448 1883 || !BN_mod_add(bnTa, bnDsA, bnTa, bnN, context)
35471 1901 avfSm2(bnXeB, bnN);
35484 1914 Point2B(group, outZ, pQeB, (INT16)BN_num_bytes(bnN), context);