Home | History | Annotate | Download | only in apps

Lines Matching refs:dh

1 /* apps/dh.c */
70 #include <openssl/dh.h>
94 DH *dh=NULL;
179 BIO_printf(bio_err," -check check the DH parameters\n");
180 BIO_printf(bio_err," -text print a text form of the DH parameters\n");
233 dh=d2i_DHparams_bio(in,NULL);
235 dh=PEM_read_bio_DHparams(in,NULL,NULL,NULL);
241 if (dh == NULL)
243 BIO_printf(bio_err,"unable to load DH parameters\n");
252 DHparams_print(out,dh);
255 BN_print(stdout,dh->p);
257 BN_print(stdout,dh->g);
259 if (dh->length != 0)
260 printf("recommended private length=%ld\n",dh->length);
266 if (!DH_check(dh,&i))
280 printf("DH parameters appear to be ok.\n");
287 len=BN_num_bytes(dh->p);
288 bits=BN_num_bits(dh->p);
295 l=BN_bn2bin(dh->p,data);
296 printf("static unsigned char dh%d_p[]={",bits);
304 l=BN_bn2bin(dh->g,data);
305 printf("static unsigned char dh%d_g[]={",bits);
313 printf("DH *get_dh%d()\n\t{\n",bits);
314 printf("\tDH *dh;\n\n");
315 printf("\tif ((dh=DH_new()) == NULL) return(NULL);\n");
316 printf("\tdh->p=BN_bin2bn(dh%d_p,sizeof(dh%d_p),NULL);\n",
318 printf("\tdh->g=BN_bin2bn(dh%d_g,sizeof(dh%d_g),NULL);\n",
320 printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n");
322 printf("\treturn(dh);\n\t}\n");
330 i=i2d_DHparams_bio(out,dh);
332 i=PEM_write_bio_DHparams(out,dh);
339 BIO_printf(bio_err,"unable to write DH parameters\n");
348 if (dh != NULL) DH_free(dh);