1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ssl/tsrc/BC/libcrypto/topenssl/src/dhparam.c Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,562 @@
1.4 +/* apps/dhparam.c */
1.5 +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
1.6 + * All rights reserved.
1.7 + *
1.8 + * This package is an SSL implementation written
1.9 + * by Eric Young (eay@cryptsoft.com).
1.10 + * The implementation was written so as to conform with Netscapes SSL.
1.11 + *
1.12 + * This library is free for commercial and non-commercial use as long as
1.13 + * the following conditions are aheared to. The following conditions
1.14 + * apply to all code found in this distribution, be it the RC4, RSA,
1.15 + * lhash, DES, etc., code; not just the SSL code. The SSL documentation
1.16 + * included with this distribution is covered by the same copyright terms
1.17 + * except that the holder is Tim Hudson (tjh@cryptsoft.com).
1.18 + *
1.19 + * Copyright remains Eric Young's, and as such any Copyright notices in
1.20 + * the code are not to be removed.
1.21 + * If this package is used in a product, Eric Young should be given attribution
1.22 + * as the author of the parts of the library used.
1.23 + * This can be in the form of a textual message at program startup or
1.24 + * in documentation (online or textual) provided with the package.
1.25 + *
1.26 + * Redistribution and use in source and binary forms, with or without
1.27 + * modification, are permitted provided that the following conditions
1.28 + * are met:
1.29 + * 1. Redistributions of source code must retain the copyright
1.30 + * notice, this list of conditions and the following disclaimer.
1.31 + * 2. Redistributions in binary form must reproduce the above copyright
1.32 + * notice, this list of conditions and the following disclaimer in the
1.33 + * documentation and/or other materials provided with the distribution.
1.34 + * 3. All advertising materials mentioning features or use of this software
1.35 + * must display the following acknowledgement:
1.36 + * "This product includes cryptographic software written by
1.37 + * Eric Young (eay@cryptsoft.com)"
1.38 + * The word 'cryptographic' can be left out if the rouines from the library
1.39 + * being used are not cryptographic related :-).
1.40 + * 4. If you include any Windows specific code (or a derivative thereof) from
1.41 + * the apps directory (application code) you must include an acknowledgement:
1.42 + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
1.43 + *
1.44 + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
1.45 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.46 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.47 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1.48 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1.49 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1.50 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.51 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1.52 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1.53 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1.54 + * SUCH DAMAGE.
1.55 + *
1.56 + * The licence and distribution terms for any publically available version or
1.57 + * derivative of this code cannot be changed. i.e. this code cannot simply be
1.58 + * copied and put under another distribution licence
1.59 + * [including the GNU Public Licence.]
1.60 + */
1.61 +/* ====================================================================
1.62 + * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
1.63 + *
1.64 + * Redistribution and use in source and binary forms, with or without
1.65 + * modification, are permitted provided that the following conditions
1.66 + * are met:
1.67 + *
1.68 + * 1. Redistributions of source code must retain the above copyright
1.69 + * notice, this list of conditions and the following disclaimer.
1.70 + *
1.71 + * 2. Redistributions in binary form must reproduce the above copyright
1.72 + * notice, this list of conditions and the following disclaimer in
1.73 + * the documentation and/or other materials provided with the
1.74 + * distribution.
1.75 + *
1.76 + * 3. All advertising materials mentioning features or use of this
1.77 + * software must display the following acknowledgment:
1.78 + * "This product includes software developed by the OpenSSL Project
1.79 + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
1.80 + *
1.81 + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
1.82 + * endorse or promote products derived from this software without
1.83 + * prior written permission. For written permission, please contact
1.84 + * openssl-core@openssl.org.
1.85 + *
1.86 + * 5. Products derived from this software may not be called "OpenSSL"
1.87 + * nor may "OpenSSL" appear in their names without prior written
1.88 + * permission of the OpenSSL Project.
1.89 + *
1.90 + * 6. Redistributions of any form whatsoever must retain the following
1.91 + * acknowledgment:
1.92 + * "This product includes software developed by the OpenSSL Project
1.93 + * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
1.94 + *
1.95 + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
1.96 + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.97 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1.98 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
1.99 + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1.100 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1.101 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1.102 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.103 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1.104 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1.105 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
1.106 + * OF THE POSSIBILITY OF SUCH DAMAGE.
1.107 + * ====================================================================
1.108 + *
1.109 + * This product includes cryptographic software written by Eric Young
1.110 + * (eay@cryptsoft.com). This product includes software written by Tim
1.111 + * Hudson (tjh@cryptsoft.com).
1.112 + *
1.113 + */
1.114 +
1.115 +#include <openssl/opensslconf.h> /* for OPENSSL_NO_DH */
1.116 +#ifndef OPENSSL_NO_DH
1.117 +#include <stdio.h>
1.118 +#include <stdlib.h>
1.119 +#include <time.h>
1.120 +#include <string.h>
1.121 +#include "apps.h"
1.122 +#include <openssl/bio.h>
1.123 +#include <openssl/err.h>
1.124 +#include <openssl/bn.h>
1.125 +#include <openssl/dh.h>
1.126 +#include <openssl/x509.h>
1.127 +#include <openssl/pem.h>
1.128 +
1.129 +#ifndef OPENSSL_NO_DSA
1.130 +#include <openssl/dsa.h>
1.131 +#endif
1.132 +
1.133 +#undef PROG
1.134 +#define PROG dhparam_main
1.135 +
1.136 +#define DEFBITS 512
1.137 +
1.138 +/* -inform arg - input format - default PEM (DER or PEM)
1.139 + * -outform arg - output format - default PEM
1.140 + * -in arg - input file - default stdin
1.141 + * -out arg - output file - default stdout
1.142 + * -dsaparam - read or generate DSA parameters, convert to DH
1.143 + * -check - check the parameters are ok
1.144 + * -noout
1.145 + * -text
1.146 + * -C
1.147 + */
1.148 +
1.149 +static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb);
1.150 +
1.151 +int MAIN(int, char **);
1.152 +
1.153 +int MAIN(int argc, char **argv)
1.154 + {
1.155 +#ifndef OPENSSL_NO_ENGINE
1.156 + ENGINE *e = NULL;
1.157 +#endif
1.158 + DH *dh=NULL;
1.159 + int i,badops=0,text=0;
1.160 +#ifndef OPENSSL_NO_DSA
1.161 + int dsaparam=0;
1.162 +#endif
1.163 + BIO *in=NULL,*out=NULL;
1.164 + int informat,outformat,check=0,noout=0,C=0,ret=1;
1.165 + char *infile,*outfile,*prog;
1.166 + char *inrand=NULL;
1.167 +#ifndef OPENSSL_NO_ENGINE
1.168 + char *engine=NULL;
1.169 +#endif
1.170 + int num = 0, g = 0;
1.171 +
1.172 + apps_startup();
1.173 +
1.174 + if (bio_err == NULL)
1.175 + if ((bio_err=BIO_new(BIO_s_file())) != NULL)
1.176 + BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
1.177 +
1.178 +
1.179 + if (!load_config(bio_err, NULL))
1.180 + goto end;
1.181 +
1.182 + infile=NULL;
1.183 + outfile=NULL;
1.184 + informat=FORMAT_PEM;
1.185 + outformat=FORMAT_PEM;
1.186 +
1.187 + prog=argv[0];
1.188 + argc--;
1.189 + argv++;
1.190 + while (argc >= 1)
1.191 + {
1.192 + if (strcmp(*argv,"-inform") == 0)
1.193 + {
1.194 + if (--argc < 1) goto bad;
1.195 + informat=str2fmt(*(++argv));
1.196 + }
1.197 + else if (strcmp(*argv,"-outform") == 0)
1.198 + {
1.199 + if (--argc < 1) goto bad;
1.200 + outformat=str2fmt(*(++argv));
1.201 + }
1.202 + else if (strcmp(*argv,"-in") == 0)
1.203 + {
1.204 + if (--argc < 1) goto bad;
1.205 + infile= *(++argv);
1.206 + }
1.207 + else if (strcmp(*argv,"-out") == 0)
1.208 + {
1.209 + if (--argc < 1) goto bad;
1.210 + outfile= *(++argv);
1.211 + }
1.212 +#ifndef OPENSSL_NO_ENGINE
1.213 + else if (strcmp(*argv,"-engine") == 0)
1.214 + {
1.215 + if (--argc < 1) goto bad;
1.216 + engine= *(++argv);
1.217 + }
1.218 +#endif
1.219 + else if (strcmp(*argv,"-check") == 0)
1.220 + check=1;
1.221 + else if (strcmp(*argv,"-text") == 0)
1.222 + text=1;
1.223 +#ifndef OPENSSL_NO_DSA
1.224 + else if (strcmp(*argv,"-dsaparam") == 0)
1.225 + dsaparam=1;
1.226 +#endif
1.227 + else if (strcmp(*argv,"-C") == 0)
1.228 + C=1;
1.229 + else if (strcmp(*argv,"-noout") == 0)
1.230 + noout=1;
1.231 + else if (strcmp(*argv,"-2") == 0)
1.232 + g=2;
1.233 + else if (strcmp(*argv,"-5") == 0)
1.234 + g=5;
1.235 + else if (strcmp(*argv,"-rand") == 0)
1.236 + {
1.237 + if (--argc < 1) goto bad;
1.238 + inrand= *(++argv);
1.239 + }
1.240 + else if (((sscanf(*argv,"%d",&num) == 0) || (num <= 0)))
1.241 + goto bad;
1.242 + argv++;
1.243 + argc--;
1.244 + }
1.245 +
1.246 + if (badops)
1.247 + {
1.248 +bad:
1.249 + BIO_printf(bio_err,"%s [options] [numbits]\n",prog);
1.250 + BIO_printf(bio_err,"where options are\n");
1.251 + BIO_printf(bio_err," -inform arg input format - one of DER PEM\n");
1.252 + BIO_printf(bio_err," -outform arg output format - one of DER PEM\n");
1.253 + BIO_printf(bio_err," -in arg input file\n");
1.254 + BIO_printf(bio_err," -out arg output file\n");
1.255 +#ifndef OPENSSL_NO_DSA
1.256 + BIO_printf(bio_err," -dsaparam read or generate DSA parameters, convert to DH\n");
1.257 +#endif
1.258 + BIO_printf(bio_err," -check check the DH parameters\n");
1.259 + BIO_printf(bio_err," -text print a text form of the DH parameters\n");
1.260 + BIO_printf(bio_err," -C Output C code\n");
1.261 + BIO_printf(bio_err," -2 generate parameters using 2 as the generator value\n");
1.262 + BIO_printf(bio_err," -5 generate parameters using 5 as the generator value\n");
1.263 + BIO_printf(bio_err," numbits number of bits in to generate (default 512)\n");
1.264 +#ifndef OPENSSL_NO_ENGINE
1.265 + BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n");
1.266 +#endif
1.267 + BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
1.268 + BIO_printf(bio_err," - load the file (or the files in the directory) into\n");
1.269 + BIO_printf(bio_err," the random number generator\n");
1.270 + BIO_printf(bio_err," -noout no output\n");
1.271 + goto end;
1.272 + }
1.273 +
1.274 + ERR_load_crypto_strings();
1.275 +
1.276 +#ifndef OPENSSL_NO_ENGINE
1.277 + e = setup_engine(bio_err, engine, 0);
1.278 +#endif
1.279 +
1.280 + if (g && !num)
1.281 + num = DEFBITS;
1.282 +
1.283 +#ifndef OPENSSL_NO_DSA
1.284 + if (dsaparam)
1.285 + {
1.286 + if (g)
1.287 + {
1.288 + BIO_printf(bio_err, "generator may not be chosen for DSA parameters\n");
1.289 + goto end;
1.290 + }
1.291 + }
1.292 + else
1.293 +#endif
1.294 + {
1.295 + /* DH parameters */
1.296 + if (num && !g)
1.297 + g = 2;
1.298 + }
1.299 +
1.300 + if(num) {
1.301 +
1.302 + BN_GENCB cb;
1.303 + BN_GENCB_set(&cb, dh_cb, bio_err);
1.304 + if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL)
1.305 + {
1.306 + BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n");
1.307 + }
1.308 + if (inrand != NULL)
1.309 + BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
1.310 + app_RAND_load_files(inrand));
1.311 +
1.312 +#ifndef OPENSSL_NO_DSA
1.313 + if (dsaparam)
1.314 + {
1.315 + DSA *dsa = DSA_new();
1.316 +
1.317 + BIO_printf(bio_err,"Generating DSA parameters, %d bit long prime\n",num);
1.318 + if(!dsa || !DSA_generate_parameters_ex(dsa, num,
1.319 + NULL, 0, NULL, NULL, &cb))
1.320 + {
1.321 + if(dsa) DSA_free(dsa);
1.322 + ERR_print_errors(bio_err);
1.323 + goto end;
1.324 + }
1.325 +
1.326 + dh = DSA_dup_DH(dsa);
1.327 + DSA_free(dsa);
1.328 + if (dh == NULL)
1.329 + {
1.330 + ERR_print_errors(bio_err);
1.331 + goto end;
1.332 + }
1.333 + }
1.334 + else
1.335 +#endif
1.336 + {
1.337 + dh = DH_new();
1.338 + BIO_printf(bio_err,"Generating DH parameters, %d bit long safe prime, generator %d\n",num,g);
1.339 + BIO_printf(bio_err,"This is going to take a long time\n");
1.340 + if(!dh || !DH_generate_parameters_ex(dh, num, g, &cb))
1.341 + {
1.342 + if(dh) DH_free(dh);
1.343 + ERR_print_errors(bio_err);
1.344 + goto end;
1.345 + }
1.346 + }
1.347 +
1.348 + app_RAND_write_file(NULL, bio_err);
1.349 + } else {
1.350 +
1.351 + in=BIO_new(BIO_s_file());
1.352 + if (in == NULL)
1.353 + {
1.354 + ERR_print_errors(bio_err);
1.355 + goto end;
1.356 + }
1.357 + if (infile == NULL)
1.358 + BIO_set_fp(in,stdin,BIO_NOCLOSE);
1.359 +
1.360 + else
1.361 + {
1.362 + if (BIO_read_filename(in,infile) <= 0)
1.363 + {
1.364 + perror(infile);
1.365 + goto end;
1.366 + }
1.367 + }
1.368 +
1.369 + if (informat != FORMAT_ASN1 && informat != FORMAT_PEM)
1.370 + {
1.371 + BIO_printf(bio_err,"bad input format specified\n");
1.372 + goto end;
1.373 + }
1.374 +
1.375 +#ifndef OPENSSL_NO_DSA
1.376 + if (dsaparam)
1.377 + {
1.378 + DSA *dsa;
1.379 +
1.380 + if (informat == FORMAT_ASN1)
1.381 + dsa=d2i_DSAparams_bio(in,NULL);
1.382 + else /* informat == FORMAT_PEM */
1.383 + dsa=PEM_read_bio_DSAparams(in,NULL,NULL,NULL);
1.384 +
1.385 + if (dsa == NULL)
1.386 + {
1.387 + BIO_printf(bio_err,"unable to load DSA parameters\n");
1.388 + ERR_print_errors(bio_err);
1.389 + goto end;
1.390 + }
1.391 +
1.392 + dh = DSA_dup_DH(dsa);
1.393 + DSA_free(dsa);
1.394 + if (dh == NULL)
1.395 + {
1.396 + ERR_print_errors(bio_err);
1.397 + goto end;
1.398 + }
1.399 + }
1.400 + else
1.401 +#endif
1.402 + {
1.403 + if (informat == FORMAT_ASN1)
1.404 + dh=d2i_DHparams_bio(in,NULL);
1.405 + else /* informat == FORMAT_PEM */
1.406 + dh=PEM_read_bio_DHparams(in,NULL,NULL,NULL);
1.407 +
1.408 + if (dh == NULL)
1.409 + {
1.410 + BIO_printf(bio_err,"unable to load DH parameters\n");
1.411 + ERR_print_errors(bio_err);
1.412 + goto end;
1.413 + }
1.414 + }
1.415 +
1.416 + /* dh != NULL */
1.417 + }
1.418 +
1.419 + out=BIO_new(BIO_s_file());
1.420 + if (out == NULL)
1.421 + {
1.422 + ERR_print_errors(bio_err);
1.423 + goto end;
1.424 + }
1.425 + if (outfile == NULL)
1.426 + {
1.427 + BIO_set_fp(out,stdout,BIO_NOCLOSE);
1.428 +#ifdef OPENSSL_SYS_VMS
1.429 + {
1.430 + BIO *tmpbio = BIO_new(BIO_f_linebuffer());
1.431 + out = BIO_push(tmpbio, out);
1.432 + }
1.433 +#endif
1.434 + }
1.435 + else
1.436 + {
1.437 + if (BIO_write_filename(out,outfile) <= 0)
1.438 + {
1.439 + perror(outfile);
1.440 + goto end;
1.441 + }
1.442 + }
1.443 +
1.444 +
1.445 + if (text)
1.446 + {
1.447 + DHparams_print(out,dh);
1.448 + }
1.449 +
1.450 + if (check)
1.451 + {
1.452 + if (!DH_check(dh,&i))
1.453 + {
1.454 + ERR_print_errors(bio_err);
1.455 + goto end;
1.456 + }
1.457 +
1.458 + if (i & DH_CHECK_P_NOT_PRIME)
1.459 + printf("p value is not prime\n");
1.460 + if (i & DH_CHECK_P_NOT_SAFE_PRIME)
1.461 + printf("p value is not a safe prime\n");
1.462 + if (i & DH_UNABLE_TO_CHECK_GENERATOR)
1.463 + printf("unable to check the generator value\n");
1.464 + if (i & DH_NOT_SUITABLE_GENERATOR)
1.465 + printf("the g value is not a generator\n");
1.466 + if (i == 0)
1.467 + printf("DH parameters appear to be ok.\n");
1.468 +
1.469 + }
1.470 + if (C)
1.471 + {
1.472 + unsigned char *data;
1.473 + int len,l,bits;
1.474 +
1.475 + len=BN_num_bytes(dh->p);
1.476 + bits=BN_num_bits(dh->p);
1.477 + data=(unsigned char *)OPENSSL_malloc(len);
1.478 + if (data == NULL)
1.479 + {
1.480 + perror("OPENSSL_malloc");
1.481 + goto end;
1.482 + }
1.483 + printf("#ifndef HEADER_DH_H\n"
1.484 + "#include <openssl/dh.h>\n"
1.485 + "#endif\n");
1.486 + printf("DH *get_dh%d()\n\t{\n",bits);
1.487 +
1.488 + l=BN_bn2bin(dh->p,data);
1.489 + printf("\tstatic unsigned char dh%d_p[]={",bits);
1.490 + for (i=0; i<l; i++)
1.491 + {
1.492 + if ((i%12) == 0) printf("\n\t\t");
1.493 + printf("0x%02X,",data[i]);
1.494 + }
1.495 + printf("\n\t\t};\n");
1.496 +
1.497 + l=BN_bn2bin(dh->g,data);
1.498 + printf("\tstatic unsigned char dh%d_g[]={",bits);
1.499 + for (i=0; i<l; i++)
1.500 + {
1.501 + if ((i%12) == 0) printf("\n\t\t");
1.502 + printf("0x%02X,",data[i]);
1.503 + }
1.504 + printf("\n\t\t};\n");
1.505 +
1.506 + printf("\tDH *dh;\n\n");
1.507 + printf("\tif ((dh=DH_new()) == NULL) return(NULL);\n");
1.508 + printf("\tdh->p=BN_bin2bn(dh%d_p,sizeof(dh%d_p),NULL);\n",
1.509 + bits,bits);
1.510 + printf("\tdh->g=BN_bin2bn(dh%d_g,sizeof(dh%d_g),NULL);\n",
1.511 + bits,bits);
1.512 + printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n");
1.513 + printf("\t\t{ DH_free(dh); return(NULL); }\n");
1.514 + if (dh->length)
1.515 + printf("\tdh->length = %ld;\n", dh->length);
1.516 + printf("\treturn(dh);\n\t}\n");
1.517 +
1.518 + OPENSSL_free(data);
1.519 + }
1.520 +
1.521 +
1.522 + if (!noout)
1.523 + {
1.524 + if (outformat == FORMAT_ASN1)
1.525 + i=i2d_DHparams_bio(out,dh);
1.526 + else if (outformat == FORMAT_PEM)
1.527 + i=PEM_write_bio_DHparams(out,dh);
1.528 + else {
1.529 + BIO_printf(bio_err,"bad output format specified for outfile\n");
1.530 + goto end;
1.531 + }
1.532 + if (!i)
1.533 + {
1.534 + BIO_printf(bio_err,"unable to write DH parameters\n");
1.535 + ERR_print_errors(bio_err);
1.536 + goto end;
1.537 + }
1.538 + }
1.539 + ret=0;
1.540 +end:
1.541 + if (in != NULL) BIO_free(in);
1.542 + if (out != NULL) BIO_free_all(out);
1.543 + if (dh != NULL) DH_free(dh);
1.544 + apps_shutdown();
1.545 + OPENSSL_EXIT(ret);
1.546 + }
1.547 +
1.548 +/* dh_cb is identical to dsa_cb in apps/dsaparam.c */
1.549 +static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb)
1.550 + {
1.551 + char c='*';
1.552 +
1.553 + if (p == 0) c='.';
1.554 + if (p == 1) c='+';
1.555 + if (p == 2) c='*';
1.556 + if (p == 3) c='\n';
1.557 + BIO_write(cb->arg,&c,1);
1.558 + (void)BIO_flush(cb->arg);
1.559 +#ifdef LINT
1.560 + p=n;
1.561 +#endif
1.562 + return 1;
1.563 + }
1.564 +
1.565 +#endif