diff options
author | tb <> | 2023-07-28 09:42:44 +0000 |
---|---|---|
committer | tb <> | 2023-07-28 09:42:44 +0000 |
commit | 52f7bdc5fb75e3796bdf3fa19043d8ee5213cf45 (patch) | |
tree | 1f5e1a8c04786d64759fed9d810d805ff607f9ae /src/lib/libcrypto/comp/c_rle.c | |
parent | 9c5ea71bae1a127e105ddfec83aabaa35ad748d2 (diff) | |
download | openbsd-52f7bdc5fb75e3796bdf3fa19043d8ee5213cf45.tar.gz openbsd-52f7bdc5fb75e3796bdf3fa19043d8ee5213cf45.tar.bz2 openbsd-52f7bdc5fb75e3796bdf3fa19043d8ee5213cf45.zip |
Drop the comp module
opensslfeatures.h has long defined OPENSSL_NO_COMP and the build with
ZLIB was broken in openssl(1) since 2015 and in libcrypto since 2022.
ZLIB was unifdefed a while ago, now we can retire the public API.
The comp.h header stays devoid of code because a number of ports use it
for historic reasons.
ok jsing
Diffstat (limited to 'src/lib/libcrypto/comp/c_rle.c')
-rw-r--r-- | src/lib/libcrypto/comp/c_rle.c | 172 |
1 files changed, 0 insertions, 172 deletions
diff --git a/src/lib/libcrypto/comp/c_rle.c b/src/lib/libcrypto/comp/c_rle.c deleted file mode 100644 index 7907dd83cd..0000000000 --- a/src/lib/libcrypto/comp/c_rle.c +++ /dev/null | |||
@@ -1,172 +0,0 @@ | |||
1 | /* $OpenBSD: c_rle.c,v 1.12 2023/07/08 08:26:26 beck Exp $ */ | ||
2 | /* | ||
3 | * --------------------------------------------------------------------------- | ||
4 | * Patches to this file were contributed by | ||
5 | * Ulf Moeller <ulf@openssl.org> and Bodo Moeller <bodo@openssl.org>. | ||
6 | * --------------------------------------------------------------------------- | ||
7 | * Copyright (c) 1999, 2011 The OpenSSL Project. All rights reserved. | ||
8 | * | ||
9 | * Redistribution and use in source and binary forms, with or without | ||
10 | * modification, are permitted provided that the following conditions | ||
11 | * are met: | ||
12 | * | ||
13 | * 1. Redistributions of source code must retain the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer. | ||
15 | * | ||
16 | * 2. Redistributions in binary form must reproduce the above copyright | ||
17 | * notice, this list of conditions and the following disclaimer in | ||
18 | * the documentation and/or other materials provided with the | ||
19 | * distribution. | ||
20 | * | ||
21 | * 3. All advertising materials mentioning features or use of this | ||
22 | * software must display the following acknowledgment: | ||
23 | * "This product includes software developed by the OpenSSL Project | ||
24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
25 | * | ||
26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
27 | * endorse or promote products derived from this software without | ||
28 | * prior written permission. For written permission, please contact | ||
29 | * licensing@OpenSSL.org. | ||
30 | * | ||
31 | * 5. Products derived from this software may not be called "OpenSSL" | ||
32 | * nor may "OpenSSL" appear in their names without prior written | ||
33 | * permission of the OpenSSL Project. | ||
34 | * | ||
35 | * 6. Redistributions of any form whatsoever must retain the following | ||
36 | * acknowledgment: | ||
37 | * "This product includes software developed by the OpenSSL Project | ||
38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
39 | * | ||
40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
51 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
52 | * | ||
53 | * --------------------------------------------------------------------------- | ||
54 | * Parts of this file are derived from SSLeay code | ||
55 | * which is covered by the following Copyright and license: | ||
56 | * --------------------------------------------------------------------------- | ||
57 | * Copyright (c) 1998 Eric Young <eay@cryptsoft.com> | ||
58 | * All rights reserved. | ||
59 | * | ||
60 | * This package is an SSL implementation written | ||
61 | * by Eric Young <eay@cryptsoft.com>. | ||
62 | * The implementation was written so as to conform with Netscapes SSL. | ||
63 | * | ||
64 | * This library is free for commercial and non-commercial use as long as | ||
65 | * the following conditions are aheared to. The following conditions | ||
66 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
67 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
68 | * included with this distribution is covered by the same copyright terms | ||
69 | * except that the holder is Tim Hudson <tjh@cryptsoft.com>. | ||
70 | * | ||
71 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
72 | * the code are not to be removed. | ||
73 | * If this package is used in a product, Eric Young should be given | ||
74 | * attribution as the author of the parts of the library used. | ||
75 | * This can be in the form of a textual message at program startup or | ||
76 | * in documentation (online or textual) provided with the package. | ||
77 | * | ||
78 | * Redistribution and use in source and binary forms, with or without | ||
79 | * modification, are permitted provided that the following conditions | ||
80 | * are met: | ||
81 | * 1. Redistributions of source code must retain the copyright | ||
82 | * notice, this list of conditions and the following disclaimer. | ||
83 | * 2. Redistributions in binary form must reproduce the above copyright | ||
84 | * notice, this list of conditions and the following disclaimer in the | ||
85 | * documentation and/or other materials provided with the distribution. | ||
86 | * 3. All advertising materials mentioning features or use of this software | ||
87 | * must display the following acknowledgement: | ||
88 | * "This product includes cryptographic software written by | ||
89 | * Eric Young <eay@cryptsoft.com>" | ||
90 | * The word 'cryptographic' can be left out if the rouines from the | ||
91 | * library being used are not cryptographic related :-). | ||
92 | * 4. If you include any Windows specific code (or a derivative thereof) | ||
93 | * from the apps directory (application code) you must include an | ||
94 | * acknowledgement: "This product includes software written | ||
95 | * by Tim Hudson <tjh@cryptsoft.com>" | ||
96 | * | ||
97 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
98 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
99 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
100 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
101 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
102 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
103 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
104 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
105 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
106 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
107 | * SUCH DAMAGE. | ||
108 | * | ||
109 | * The licence and distribution terms for any publically available version | ||
110 | * or derivative of this code cannot be changed. i.e. this code cannot | ||
111 | * simply be copied and put under another distribution licence | ||
112 | * [including the GNU Public Licence.] | ||
113 | */ | ||
114 | |||
115 | #include <stdio.h> | ||
116 | #include <stdlib.h> | ||
117 | #include <string.h> | ||
118 | |||
119 | #include <openssl/objects.h> | ||
120 | #include <openssl/comp.h> | ||
121 | |||
122 | #include "comp_local.h" | ||
123 | |||
124 | static int rle_compress_block(COMP_CTX *ctx, unsigned char *out, | ||
125 | unsigned int olen, unsigned char *in, unsigned int ilen); | ||
126 | static int rle_expand_block(COMP_CTX *ctx, unsigned char *out, | ||
127 | unsigned int olen, unsigned char *in, unsigned int ilen); | ||
128 | |||
129 | static COMP_METHOD rle_method = { | ||
130 | .type = NID_rle_compression, | ||
131 | .name = LN_rle_compression, | ||
132 | .compress = rle_compress_block, | ||
133 | .expand = rle_expand_block | ||
134 | }; | ||
135 | |||
136 | COMP_METHOD * | ||
137 | COMP_rle(void) | ||
138 | { | ||
139 | return (&rle_method); | ||
140 | } | ||
141 | LCRYPTO_ALIAS(COMP_rle); | ||
142 | |||
143 | static int | ||
144 | rle_compress_block(COMP_CTX *ctx, unsigned char *out, unsigned int olen, | ||
145 | unsigned char *in, unsigned int ilen) | ||
146 | { | ||
147 | |||
148 | if (ilen == 0 || olen < (ilen - 1)) { | ||
149 | return (-1); | ||
150 | } | ||
151 | |||
152 | *(out++) = 0; | ||
153 | memcpy(out, in, ilen); | ||
154 | return (ilen + 1); | ||
155 | } | ||
156 | |||
157 | static int | ||
158 | rle_expand_block(COMP_CTX *ctx, unsigned char *out, unsigned int olen, | ||
159 | unsigned char *in, unsigned int ilen) | ||
160 | { | ||
161 | int i; | ||
162 | |||
163 | if (olen < (ilen - 1)) { | ||
164 | return (-1); | ||
165 | } | ||
166 | |||
167 | i= *(in++); | ||
168 | if (i == 0) { | ||
169 | memcpy(out, in, ilen - 1); | ||
170 | } | ||
171 | return (ilen - 1); | ||
172 | } | ||