X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=apps%2Fenc.c;h=8dd243ee7eb2c39a2de03e1b6d1d7d4c59b55862;hb=531b2cf7e92d3e6d4168e77752af87fb027024f5;hp=d7c990911f083dcdf2812a49ff44492807031ca2;hpb=b7896b3cb86d80206af14a14d69b0717786f2729;p=oweals%2Fopenssl.git diff --git a/apps/enc.c b/apps/enc.c index d7c990911f..8dd243ee7e 100644 --- a/apps/enc.c +++ b/apps/enc.c @@ -1,5 +1,5 @@ /* apps/enc.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written @@ -60,22 +60,17 @@ #include #include #include "apps.h" -#include "bio.h" -#include "err.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" -#ifdef NO_MD5 -#include "md5.h" +#include +#include +#include +#include +#include +#ifndef NO_MD5 +#include #endif -#include "pem.h" +#include -#ifndef NOPROTO int set_hex(char *in,unsigned char *out,int size); -#else -int set_hex(); -#endif - #undef SIZE #undef BSIZE #undef PROG @@ -84,9 +79,7 @@ int set_hex(); #define BSIZE (8*1024) #define PROG enc_main -int MAIN(argc,argv) -int argc; -char **argv; +int MAIN(int argc, char **argv) { char *strbuf=NULL; unsigned char *buff=NULL,*bufsize=NULL; @@ -96,8 +89,8 @@ char **argv; char *str=NULL; char *hkey=NULL,*hiv=NULL; int enc=1,printkey=0,i,base64=0; - int debug=0; - EVP_CIPHER *cipher=NULL,*c; + int debug=0,olb64=0; + const EVP_CIPHER *cipher=NULL,*c; char *inf=NULL,*outf=NULL; BIO *in=NULL,*out=NULL,*b64=NULL,*benc=NULL,*rbio=NULL,*wbio=NULL; #define PROG_NAME_SIZE 16 @@ -107,7 +100,7 @@ char **argv; if (bio_err == NULL) if ((bio_err=BIO_new(BIO_s_file())) != NULL) - BIO_set_fp(bio_err,stderr,BIO_NOCLOSE); + BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); /* first check the program name */ program_name(argv[0],pname,PROG_NAME_SIZE); @@ -148,6 +141,8 @@ char **argv; debug=1; else if (strcmp(*argv,"-P") == 0) printkey=2; + else if (strcmp(*argv,"-A") == 0) + olb64=1; else if (strcmp(*argv,"-a") == 0) base64=1; else if (strcmp(*argv,"-base64") == 0) @@ -237,7 +232,7 @@ bad: #ifndef NO_RC4 BIO_printf(bio_err,"rc2 :128 bit key RC2 encryption\n"); #endif -#ifndef NO_BLOWFISH +#ifndef NO_BF BIO_printf(bio_err,"bf :128 bit key BlowFish encryption\n"); #endif #ifndef NO_RC4 @@ -275,11 +270,23 @@ bad: LN_rc2_cfb64, LN_rc2_ofb64); BIO_printf(bio_err," -%-4s (%s)\n","rc2", LN_rc2_cbc); #endif -#ifndef NO_BLOWFISH +#ifndef NO_BF BIO_printf(bio_err," -%-12s -%-12s -%-12s -%-12s", LN_bf_ecb, LN_bf_cbc, LN_bf_cfb64, LN_bf_ofb64); BIO_printf(bio_err," -%-4s (%s)\n","bf", LN_bf_cbc); +#endif +#ifndef NO_CAST + BIO_printf(bio_err," -%-12s -%-12s -%-12s -%-12s", + LN_cast5_ecb, LN_cast5_cbc, + LN_cast5_cfb64, LN_cast5_ofb64); + BIO_printf(bio_err," -%-4s (%s)\n","cast", LN_cast5_cbc); +#endif +#ifndef NO_RC5 + BIO_printf(bio_err," -%-12s -%-12s -%-12s -%-12s", + LN_rc5_ecb, LN_rc5_cbc, + LN_rc5_cfb64, LN_rc5_ofb64); + BIO_printf(bio_err," -%-4s (%s)\n","rc5", LN_rc5_cbc); #endif goto end; } @@ -463,6 +470,8 @@ bad: BIO_set_callback(b64,BIO_debug_callback); BIO_set_callback_arg(b64,bio_err); } + if (olb64) + BIO_set_flags(b64,BIO_FLAGS_BASE64_NO_NL); if (enc) wbio=BIO_push(b64,wbio); else @@ -505,10 +514,7 @@ end: EXIT(ret); } -int set_hex(in,out,size) -char *in; -unsigned char *out; -int size; +int set_hex(char *in, unsigned char *out, int size) { int i,n; unsigned char j;