diff options
author | Todd Short <tshort@akamai.com> | 2021-08-09 22:56:37 +0200 |
---|---|---|
committer | Todd Short <todd.short@me.com> | 2022-10-18 15:30:21 +0200 |
commit | caf9317d7d75213990014e07048384be15688889 (patch) | |
tree | 50cf59d363c17f389d6c8dbc2372795e3e53658d /apps | |
parent | Add brotli compression support (RFC7924) (diff) | |
download | openssl-caf9317d7d75213990014e07048384be15688889.tar.xz openssl-caf9317d7d75213990014e07048384be15688889.zip |
Add ZSTD compression support (RFC8478bis)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18186)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/enc.c | 22 | ||||
-rw-r--r-- | apps/list.c | 3 | ||||
-rw-r--r-- | apps/progs.pl | 2 |
3 files changed, 26 insertions, 1 deletions
diff --git a/apps/enc.c b/apps/enc.c index 4da2342791..cbeaeaa8aa 100644 --- a/apps/enc.c +++ b/apps/enc.c @@ -136,6 +136,8 @@ int enc_main(int argc, char **argv) #endif int do_brotli = 0; BIO *bbrot = NULL; + int do_zstd = 0; + BIO *bzstd = NULL; /* first check the command name */ if (strcmp(argv[0], "base64") == 0) @@ -148,6 +150,10 @@ int enc_main(int argc, char **argv) else if (strcmp(argv[0], "brotli") == 0) do_brotli = 1; #endif +#ifndef OPENSSL_NO_ZSTD + else if (strcmp(argv[0], "zstd") == 0) + do_zstd = 1; +#endif else if (strcmp(argv[0], "enc") != 0) ciphername = argv[0]; @@ -332,6 +338,8 @@ int enc_main(int argc, char **argv) #endif if (do_brotli) base64 = 0; + if (do_zstd) + base64 = 0; if (base64) { if (enc) @@ -436,6 +444,19 @@ int enc_main(int argc, char **argv) else rbio = BIO_push(bbrot, rbio); } + + if (do_zstd) { + if ((bzstd = BIO_new(BIO_f_zstd())) == NULL) + goto end; + if (debug) { + BIO_set_callback_ex(bzstd, BIO_debug_callback_ex); + BIO_set_callback_arg(bzstd, (char *)bio_err); + } + if (enc) + wbio = BIO_push(bzstd, wbio); + else + rbio = BIO_push(bzstd, rbio); + } #endif if (base64) { @@ -682,6 +703,7 @@ int enc_main(int argc, char **argv) BIO_free(bzl); #endif BIO_free(bbrot); + BIO_free(bzstd); release_engine(e); OPENSSL_free(pass); return ret; diff --git a/apps/list.c b/apps/list.c index f198c1cda7..76067f6b3b 100644 --- a/apps/list.c +++ b/apps/list.c @@ -1427,6 +1427,9 @@ static void list_disabled(void) #ifdef OPENSSL_NO_BROTLI BIO_puts(bio_out, "BROTLI\n"); #endif +#ifdef OPENSSL_NO_ZSTD + BIO_puts(bio_out, "ZSTD\n"); +#endif } /* Unified enum for help and list commands. */ diff --git a/apps/progs.pl b/apps/progs.pl index c4e7ae59cf..77404e78dc 100644 --- a/apps/progs.pl +++ b/apps/progs.pl @@ -188,7 +188,7 @@ EOF "camellia-128-cbc", "camellia-128-ecb", "camellia-192-cbc", "camellia-192-ecb", "camellia-256-cbc", "camellia-256-ecb", - "base64", "zlib", "brotli", + "base64", "zlib", "brotli", "zstd", "des", "des3", "desx", "idea", "seed", "rc4", "rc4-40", "rc2", "bf", "cast", "rc5", "des-ecb", "des-ede", "des-ede3", |