enc.c (59191) | enc.c (68651) |
---|---|
1/* apps/enc.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 * --- 329 unchanged lines hidden (view full) --- 338 339 /* It must be large enough for a base64 encoded line */ 340 if (n < 80) n=80; 341 342 bsize=(int)n; 343 if (verbose) BIO_printf(bio_err,"bufsize=%d\n",bsize); 344 } 345 | 1/* apps/enc.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 * --- 329 unchanged lines hidden (view full) --- 338 339 /* It must be large enough for a base64 encoded line */ 340 if (n < 80) n=80; 341 342 bsize=(int)n; 343 if (verbose) BIO_printf(bio_err,"bufsize=%d\n",bsize); 344 } 345 |
346 strbuf=Malloc(SIZE); 347 buff=(unsigned char *)Malloc(EVP_ENCODE_LENGTH(bsize)); | 346 strbuf=OPENSSL_malloc(SIZE); 347 buff=(unsigned char *)OPENSSL_malloc(EVP_ENCODE_LENGTH(bsize)); |
348 if ((buff == NULL) || (strbuf == NULL)) 349 { | 348 if ((buff == NULL) || (strbuf == NULL)) 349 { |
350 BIO_printf(bio_err,"Malloc failure %ld\n",(long)EVP_ENCODE_LENGTH(bsize)); | 350 BIO_printf(bio_err,"OPENSSL_malloc failure %ld\n",(long)EVP_ENCODE_LENGTH(bsize)); |
351 goto end; 352 } 353 354 in=BIO_new(BIO_s_file()); 355 out=BIO_new(BIO_s_file()); 356 if ((in == NULL) || (out == NULL)) 357 { 358 ERR_print_errors(bio_err); --- 52 unchanged lines hidden (view full) --- 411 BIO_printf(bio_err,"bad password read\n"); 412 goto end; 413 } 414 } 415 } 416 417 418 if (outf == NULL) | 351 goto end; 352 } 353 354 in=BIO_new(BIO_s_file()); 355 out=BIO_new(BIO_s_file()); 356 if ((in == NULL) || (out == NULL)) 357 { 358 ERR_print_errors(bio_err); --- 52 unchanged lines hidden (view full) --- 411 BIO_printf(bio_err,"bad password read\n"); 412 goto end; 413 } 414 } 415 } 416 417 418 if (outf == NULL) |
419 { |
|
419 BIO_set_fp(out,stdout,BIO_NOCLOSE); | 420 BIO_set_fp(out,stdout,BIO_NOCLOSE); |
421#ifdef VMS 422 { 423 BIO *tmpbio = BIO_new(BIO_f_linebuffer()); 424 out = BIO_push(tmpbio, out); 425 } 426#endif 427 } |
|
420 else 421 { 422 if (BIO_write_filename(out,outf) <= 0) 423 { 424 perror(outf); 425 goto end; 426 } 427 } --- 148 unchanged lines hidden (view full) --- 576 ret=0; 577 if (verbose) 578 { 579 BIO_printf(bio_err,"bytes read :%8ld\n",BIO_number_read(in)); 580 BIO_printf(bio_err,"bytes written:%8ld\n",BIO_number_written(out)); 581 } 582end: 583 ERR_print_errors(bio_err); | 428 else 429 { 430 if (BIO_write_filename(out,outf) <= 0) 431 { 432 perror(outf); 433 goto end; 434 } 435 } --- 148 unchanged lines hidden (view full) --- 584 ret=0; 585 if (verbose) 586 { 587 BIO_printf(bio_err,"bytes read :%8ld\n",BIO_number_read(in)); 588 BIO_printf(bio_err,"bytes written:%8ld\n",BIO_number_written(out)); 589 } 590end: 591 ERR_print_errors(bio_err); |
584 if (strbuf != NULL) Free(strbuf); 585 if (buff != NULL) Free(buff); | 592 if (strbuf != NULL) OPENSSL_free(strbuf); 593 if (buff != NULL) OPENSSL_free(buff); |
586 if (in != NULL) BIO_free(in); | 594 if (in != NULL) BIO_free(in); |
587 if (out != NULL) BIO_free(out); | 595 if (out != NULL) BIO_free_all(out); |
588 if (benc != NULL) BIO_free(benc); 589 if (b64 != NULL) BIO_free(b64); | 596 if (benc != NULL) BIO_free(benc); 597 if (b64 != NULL) BIO_free(b64); |
590 if(pass) Free(pass); | 598 if(pass) OPENSSL_free(pass); |
591 EXIT(ret); 592 } 593 594int set_hex(char *in, unsigned char *out, int size) 595 { 596 int i,n; 597 unsigned char j; 598 --- 30 unchanged lines hidden --- | 599 EXIT(ret); 600 } 601 602int set_hex(char *in, unsigned char *out, int size) 603 { 604 int i,n; 605 unsigned char j; 606 --- 30 unchanged lines hidden --- |