Home | History | Annotate | Download | only in apps

Lines Matching refs:dh

122 #include <openssl/dh.h>
139 * -dsaparam - read or generate DSA parameters, convert to DH
155 DH *dh=NULL;
252 BIO_printf(bio_err," -dsaparam read or generate DSA parameters, convert to DH\n");
254 BIO_printf(bio_err," -check check the DH parameters\n");
255 BIO_printf(bio_err," -text print a text form of the DH parameters\n");
291 /* DH parameters */
322 dh = DSA_dup_DH(dsa);
324 if (dh == NULL)
333 dh = DH_new();
334 BIO_printf(bio_err,"Generating DH parameters, %d bit long safe prime, generator %d\n",num,g);
336 if(!dh || !DH_generate_parameters_ex(dh, num, g, &cb))
338 if(dh) DH_free(dh);
387 dh = DSA_dup_DH(dsa);
389 if (dh == NULL)
399 dh=d2i_DHparams_bio(in,NULL);
401 dh=PEM_read_bio_DHparams(in,NULL,NULL,NULL);
403 if (dh == NULL)
405 BIO_printf(bio_err,"unable to load DH parameters\n");
411 /* dh != NULL */
442 DHparams_print(out,dh);
447 if (!DH_check(dh,&i))
461 printf("DH parameters appear to be ok.\n");
468 len=BN_num_bytes(dh->p);
469 bits=BN_num_bits(dh->p);
477 "#include <openssl/dh.h>\n"
479 printf("DH *get_dh%d()\n\t{\n",bits);
481 l=BN_bn2bin(dh->p,data);
482 printf("\tstatic unsigned char dh%d_p[]={",bits);
490 l=BN_bn2bin(dh->g,data);
491 printf("\tstatic unsigned char dh%d_g[]={",bits);
499 printf("\tDH *dh;\n\n");
500 printf("\tif ((dh=DH_new()) == NULL) return(NULL);\n");
501 printf("\tdh->p=BN_bin2bn(dh%d_p,sizeof(dh%d_p),NULL);\n",
503 printf("\tdh->g=BN_bin2bn(dh%d_g,sizeof(dh%d_g),NULL);\n",
505 printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n");
506 printf("\t\t{ DH_free(dh); return(NULL); }\n");
507 if (dh->length)
508 printf("\tdh->length = %ld;\n", dh->length);
509 printf("\treturn(dh);\n\t}\n");
517 i=i2d_DHparams_bio(out,dh);
519 i=PEM_write_bio_DHparams(out,dh);
526 BIO_printf(bio_err,"unable to write DH parameters\n");
535 if (dh != NULL) DH_free(dh);