[BACK]Return to enc.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / openssl

Diff for /src/usr.bin/openssl/enc.c between version 1.27 and 1.28

version 1.27, 2023/03/06 14:32:06 version 1.28, 2023/06/11 05:45:20
Line 80 
Line 80 
         char *bufsize;          char *bufsize;
         const EVP_CIPHER *cipher;          const EVP_CIPHER *cipher;
         int debug;          int debug;
 #ifdef ZLIB  
         int do_zlib;  
 #endif  
         int enc;          int enc;
         char *hiv;          char *hiv;
         char *hkey;          char *hkey;
Line 287 
Line 284 
                 .type = OPTION_FLAG,                  .type = OPTION_FLAG,
                 .opt.flag = &cfg.verbose,                  .opt.flag = &cfg.verbose,
         },          },
 #ifdef ZLIB  
         {          {
                 .name = "z",  
                 .desc = "Perform zlib compression/decompression",  
                 .type = OPTION_FLAG,  
                 .opt.flag = &cfg.do_zlib,  
         },  
 #endif  
         {  
                 .name = NULL,                  .name = NULL,
                 .type = OPTION_ARGV_FUNC,                  .type = OPTION_ARGV_FUNC,
                 .opt.argvfunc = enc_opt_cipher,                  .opt.argvfunc = enc_opt_cipher,
Line 349 
Line 338 
         int ret = 1, inl;          int ret = 1, inl;
         unsigned char key[EVP_MAX_KEY_LENGTH], iv[EVP_MAX_IV_LENGTH];          unsigned char key[EVP_MAX_KEY_LENGTH], iv[EVP_MAX_IV_LENGTH];
         unsigned char salt[PKCS5_SALT_LEN];          unsigned char salt[PKCS5_SALT_LEN];
 #ifdef ZLIB  
         BIO *bzl = NULL;  
 #endif  
         EVP_CIPHER_CTX *ctx = NULL;          EVP_CIPHER_CTX *ctx = NULL;
         const EVP_MD *dgst = NULL;          const EVP_MD *dgst = NULL;
         BIO *in = NULL, *out = NULL, *b64 = NULL, *benc = NULL;          BIO *in = NULL, *out = NULL, *b64 = NULL, *benc = NULL;
Line 374 
Line 360 
         if (strcmp(pname, "base64") == 0)          if (strcmp(pname, "base64") == 0)
                 cfg.base64 = 1;                  cfg.base64 = 1;
   
 #ifdef ZLIB  
         if (strcmp(pname, "zlib") == 0)  
                 cfg.do_zlib = 1;  
 #endif  
   
         cfg.cipher = EVP_get_cipherbyname(pname);          cfg.cipher = EVP_get_cipherbyname(pname);
   
 #ifdef ZLIB  
         if (!cfg.do_zlib && !cfg.base64 &&  
             cfg.cipher == NULL && strcmp(pname, "enc") != 0)  
 #else  
         if (!cfg.base64 && cfg.cipher == NULL &&          if (!cfg.base64 && cfg.cipher == NULL &&
             strcmp(pname, "enc") != 0)              strcmp(pname, "enc") != 0)
 #endif  
         {          {
                 BIO_printf(bio_err, "%s is an unknown cipher\n", pname);                  BIO_printf(bio_err, "%s is an unknown cipher\n", pname);
                 goto end;                  goto end;
Line 561 
Line 537 
         rbio = in;          rbio = in;
         wbio = out;          wbio = out;
   
 #ifdef ZLIB  
         if (do_zlib) {  
                 if ((bzl = BIO_new(BIO_f_zlib())) == NULL)  
                         goto end;  
                 if (enc)  
                         wbio = BIO_push(bzl, wbio);  
                 else  
                         rbio = BIO_push(bzl, rbio);  
         }  
 #endif  
   
         if (cfg.base64) {          if (cfg.base64) {
                 if ((b64 = BIO_new(BIO_f_base64())) == NULL)                  if ((b64 = BIO_new(BIO_f_base64())) == NULL)
                         goto end;                          goto end;
Line 787 
Line 752 
         BIO_free_all(out);          BIO_free_all(out);
         BIO_free(benc);          BIO_free(benc);
         BIO_free(b64);          BIO_free(b64);
 #ifdef ZLIB  
         BIO_free(bzl);  
 #endif  
         free(pass);          free(pass);
   
         return (ret);          return (ret);

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28