Home | History | Annotate | Download | only in apps

Lines Matching refs:dh

1 /* apps/dh.c */
70 #include <openssl/dh.h>
91 DH *dh=NULL;
176 BIO_printf(bio_err," -check check the DH parameters\n");
177 BIO_printf(bio_err," -text print a text form of the DH parameters\n");
230 dh=d2i_DHparams_bio(in,NULL);
232 dh=PEM_read_bio_DHparams(in,NULL,NULL,NULL);
238 if (dh == NULL)
240 BIO_printf(bio_err,"unable to load DH parameters\n");
249 DHparams_print(out,dh);
252 BN_print(stdout,dh->p);
254 BN_print(stdout,dh->g);
256 if (dh->length != 0)
257 printf("recommended private length=%ld\n",dh->length);
263 if (!DH_check(dh,&i))
277 printf("DH parameters appear to be ok.\n");
284 len=BN_num_bytes(dh->p);
285 bits=BN_num_bits(dh->p);
292 l=BN_bn2bin(dh->p,data);
293 printf("static unsigned char dh%d_p[]={",bits);
301 l=BN_bn2bin(dh->g,data);
302 printf("static unsigned char dh%d_g[]={",bits);
310 printf("DH *get_dh%d()\n\t{\n",bits);
311 printf("\tDH *dh;\n\n");
312 printf("\tif ((dh=DH_new()) == NULL) return(NULL);\n");
313 printf("\tdh->p=BN_bin2bn(dh%d_p,sizeof(dh%d_p),NULL);\n",
315 printf("\tdh->g=BN_bin2bn(dh%d_g,sizeof(dh%d_g),NULL);\n",
317 printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n");
319 printf("\treturn(dh);\n\t}\n");
327 i=i2d_DHparams_bio(out,dh);
329 i=PEM_write_bio_DHparams(out,dh);
336 BIO_printf(bio_err,"unable to write DH parameters\n");
345 if (dh != NULL) DH_free(dh);