67 #include "../../internal.h" 
   68 #include "../bn/internal.h" 
   71 #define OPENSSL_DH_MAX_MODULUS_BITS 10000 
  123                  const BIGNUM **out_priv_key) {
 
  124   if (out_pub_key != NULL) {
 
  127   if (out_priv_key != NULL) {
 
  133   if (pub_key != NULL) {
 
  138   if (priv_key != NULL) {
 
  160   if ((dh->
p == NULL && 
p == NULL) ||
 
  161       (dh->
g == NULL && 
g == NULL)) {
 
  190   int generate_new_key = 0;
 
  192   BIGNUM *pub_key = NULL, *priv_key = NULL;
 
  206     if (priv_key == NULL) {
 
  209     generate_new_key = 1;
 
  216     if (pub_key == NULL) {
 
  228   if (generate_new_key) {
 
  236       if (priv_bits == 0) {
 
  242         priv_bits = p_bits - 1;
 
  313       BN_cmp(out_shared_key, p_minus_1) == 0) {
 
  365                           size_t max_out_len, 
const BIGNUM *peers_key,
 
  367   *out_len = (size_t)-1;
 
  370   if (digest_len > max_out_len) {
 
  375   const size_t dh_len = 
DH_size(dh);
 
  377   unsigned out_len_unsigned;
 
  386       !
EVP_Digest(shared_bytes, dh_len, 
out, &out_len_unsigned, digest, NULL) ||
 
  387       out_len_unsigned != digest_len) {
 
  391   *out_len = digest_len;
 
  411   static const BN_ULONG kFFDHE2048Data[] = {
 
  412       TOBN(0xffffffff, 0xffffffff), TOBN(0x886b4238, 0x61285c97),
 
  413       TOBN(0xc6f34a26, 0xc1b2effa), TOBN(0xc58ef183, 0x7d1683b2),
 
  414       TOBN(0x3bb5fcbc, 0x2ec22005), TOBN(0xc3fe3b1b, 0x4c6fad73),
 
  415       TOBN(0x8e4f1232, 0xeef28183), TOBN(0x9172fe9c, 0xe98583ff),
 
  416       TOBN(0xc03404cd, 0x28342f61), TOBN(0x9e02fce1, 0xcdf7e2ec),
 
  417       TOBN(0x0b07a7c8, 0xee0a6d70), TOBN(0xae56ede7, 0x6372bb19),
 
  418       TOBN(0x1d4f42a3, 0xde394df4), TOBN(0xb96adab7, 0x60d7f468),
 
  419       TOBN(0xd108a94b, 0xb2c8e3fb), TOBN(0xbc0ab182, 0xb324fb61),
 
  420       TOBN(0x30acca4f, 0x483a797a), TOBN(0x1df158a1, 0x36ade735),
 
  421       TOBN(0xe2a689da, 0xf3efe872), TOBN(0x984f0c70, 0xe0e68b77),
 
  422       TOBN(0xb557135e, 0x7f57c935), TOBN(0x85636555, 0x3ded1af3),
 
  423       TOBN(0x2433f51f, 0x5f066ed0), TOBN(0xd3df1ed5, 0xd5fd6561),
 
  424       TOBN(0xf681b202, 0xaec4617a), TOBN(0x7d2fe363, 0x630c75d8),
 
  425       TOBN(0xcc939dce, 0x249b3ef9), TOBN(0xa9e13641, 0x146433fb),
 
  426       TOBN(0xd8b9c583, 0xce2d3695), TOBN(0xafdc5620, 0x273d3cf1),
 
  427       TOBN(0xadf85458, 0xa2bb4a9a), TOBN(0xffffffff, 0xffffffff),
 
  435   if (!ffdhe2048_p || !ffdhe2048_q || !ffdhe2048_g || !dh) {
 
  444       !
DH_set0_pqg(dh, ffdhe2048_p, ffdhe2048_q, ffdhe2048_g)) {