diff options
Diffstat (limited to 'src/lib/libcrypto/comp/c_rle.c')
| -rw-r--r-- | src/lib/libcrypto/comp/c_rle.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/src/lib/libcrypto/comp/c_rle.c b/src/lib/libcrypto/comp/c_rle.c deleted file mode 100644 index 7004c35029..0000000000 --- a/src/lib/libcrypto/comp/c_rle.c +++ /dev/null | |||
| @@ -1,55 +0,0 @@ | |||
| 1 | /* $OpenBSD: c_rle.c,v 1.8 2014/11/03 16:58:28 tedu Exp $ */ | ||
| 2 | #include <stdio.h> | ||
| 3 | #include <stdlib.h> | ||
| 4 | #include <string.h> | ||
| 5 | #include <openssl/objects.h> | ||
| 6 | #include <openssl/comp.h> | ||
| 7 | |||
| 8 | static int rle_compress_block(COMP_CTX *ctx, unsigned char *out, | ||
| 9 | unsigned int olen, unsigned char *in, unsigned int ilen); | ||
| 10 | static int rle_expand_block(COMP_CTX *ctx, unsigned char *out, | ||
| 11 | unsigned int olen, unsigned char *in, unsigned int ilen); | ||
| 12 | |||
| 13 | static COMP_METHOD rle_method = { | ||
| 14 | .type = NID_rle_compression, | ||
| 15 | .name = LN_rle_compression, | ||
| 16 | .compress = rle_compress_block, | ||
| 17 | .expand = rle_expand_block | ||
| 18 | }; | ||
| 19 | |||
| 20 | COMP_METHOD * | ||
| 21 | COMP_rle(void) | ||
| 22 | { | ||
| 23 | return (&rle_method); | ||
| 24 | } | ||
| 25 | |||
| 26 | static int | ||
| 27 | rle_compress_block(COMP_CTX *ctx, unsigned char *out, unsigned int olen, | ||
| 28 | unsigned char *in, unsigned int ilen) | ||
| 29 | { | ||
| 30 | |||
| 31 | if (ilen == 0 || olen < (ilen - 1)) { | ||
| 32 | return (-1); | ||
| 33 | } | ||
| 34 | |||
| 35 | *(out++) = 0; | ||
| 36 | memcpy(out, in, ilen); | ||
| 37 | return (ilen + 1); | ||
| 38 | } | ||
| 39 | |||
| 40 | static int | ||
| 41 | rle_expand_block(COMP_CTX *ctx, unsigned char *out, unsigned int olen, | ||
| 42 | unsigned char *in, unsigned int ilen) | ||
| 43 | { | ||
| 44 | int i; | ||
| 45 | |||
| 46 | if (olen < (ilen - 1)) { | ||
| 47 | return (-1); | ||
| 48 | } | ||
| 49 | |||
| 50 | i= *(in++); | ||
| 51 | if (i == 0) { | ||
| 52 | memcpy(out, in, ilen - 1); | ||
| 53 | } | ||
| 54 | return (ilen - 1); | ||
| 55 | } | ||
