dsaparam.c (59191) | dsaparam.c (68651) |
---|---|
1/* apps/dsaparam.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 191 unchanged lines hidden (view full) --- 200 { 201 if (BIO_read_filename(in,infile) <= 0) 202 { 203 perror(infile); 204 goto end; 205 } 206 } 207 if (outfile == NULL) | 1/* apps/dsaparam.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 191 unchanged lines hidden (view full) --- 200 { 201 if (BIO_read_filename(in,infile) <= 0) 202 { 203 perror(infile); 204 goto end; 205 } 206 } 207 if (outfile == NULL) |
208 { |
|
208 BIO_set_fp(out,stdout,BIO_NOCLOSE); | 209 BIO_set_fp(out,stdout,BIO_NOCLOSE); |
210#ifdef VMS 211 { 212 BIO *tmpbio = BIO_new(BIO_f_linebuffer()); 213 out = BIO_push(tmpbio, out); 214 } 215#endif 216 } |
|
209 else 210 { 211 if (BIO_write_filename(out,outfile) <= 0) 212 { 213 perror(outfile); 214 goto end; 215 } 216 } --- 38 unchanged lines hidden (view full) --- 255 { 256 unsigned char *data; 257 int l,len,bits_p,bits_q,bits_g; 258 259 len=BN_num_bytes(dsa->p); 260 bits_p=BN_num_bits(dsa->p); 261 bits_q=BN_num_bits(dsa->q); 262 bits_g=BN_num_bits(dsa->g); | 217 else 218 { 219 if (BIO_write_filename(out,outfile) <= 0) 220 { 221 perror(outfile); 222 goto end; 223 } 224 } --- 38 unchanged lines hidden (view full) --- 263 { 264 unsigned char *data; 265 int l,len,bits_p,bits_q,bits_g; 266 267 len=BN_num_bytes(dsa->p); 268 bits_p=BN_num_bits(dsa->p); 269 bits_q=BN_num_bits(dsa->q); 270 bits_g=BN_num_bits(dsa->g); |
263 data=(unsigned char *)Malloc(len+20); | 271 data=(unsigned char *)OPENSSL_malloc(len+20); |
264 if (data == NULL) 265 { | 272 if (data == NULL) 273 { |
266 perror("Malloc"); | 274 perror("OPENSSL_malloc"); |
267 goto end; 268 } 269 l=BN_bn2bin(dsa->p,data); 270 printf("static unsigned char dsa%d_p[]={",bits_p); 271 for (i=0; i<l; i++) 272 { 273 if ((i%12) == 0) printf("\n\t"); 274 printf("0x%02X,",data[i]); --- 67 unchanged lines hidden (view full) --- 342 } 343 DSA_free(dsakey); 344 } 345 if (need_rand) 346 app_RAND_write_file(NULL, bio_err); 347 ret=0; 348end: 349 if (in != NULL) BIO_free(in); | 275 goto end; 276 } 277 l=BN_bn2bin(dsa->p,data); 278 printf("static unsigned char dsa%d_p[]={",bits_p); 279 for (i=0; i<l; i++) 280 { 281 if ((i%12) == 0) printf("\n\t"); 282 printf("0x%02X,",data[i]); --- 67 unchanged lines hidden (view full) --- 350 } 351 DSA_free(dsakey); 352 } 353 if (need_rand) 354 app_RAND_write_file(NULL, bio_err); 355 ret=0; 356end: 357 if (in != NULL) BIO_free(in); |
350 if (out != NULL) BIO_free(out); | 358 if (out != NULL) BIO_free_all(out); |
351 if (dsa != NULL) DSA_free(dsa); 352 EXIT(ret); 353 } 354 355static void MS_CALLBACK dsa_cb(int p, int n, void *arg) 356 { 357 char c='*'; 358 359 if (p == 0) c='.'; 360 if (p == 1) c='+'; 361 if (p == 2) c='*'; 362 if (p == 3) c='\n'; 363 BIO_write(arg,&c,1); 364 (void)BIO_flush(arg); 365#ifdef LINT 366 p=n; 367#endif 368 } 369#endif | 359 if (dsa != NULL) DSA_free(dsa); 360 EXIT(ret); 361 } 362 363static void MS_CALLBACK dsa_cb(int p, int n, void *arg) 364 { 365 char c='*'; 366 367 if (p == 0) c='.'; 368 if (p == 1) c='+'; 369 if (p == 2) c='*'; 370 if (p == 3) c='\n'; 371 BIO_write(arg,&c,1); 372 (void)BIO_flush(arg); 373#ifdef LINT 374 p=n; 375#endif 376 } 377#endif |