diff options
author | Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> | 2009-03-04 02:05:33 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2009-03-04 02:05:33 -0500 |
commit | a1d2f09544065b60598b8167d94a6371bff3e892 (patch) | |
tree | cd8b88e7ea0cd44e7e369f670f9fdfcba78f4326 /include/crypto/internal | |
parent | e9cc8bddaea3944fabfebb968bc88d603239beed (diff) |
crypto: compress - Add pcomp interface
The current "comp" crypto interface supports one-shot (de)compression only,
i.e. the whole data buffer to be (de)compressed must be passed at once, and
the whole (de)compressed data buffer will be received at once.
In several use-cases (e.g. compressed file systems that store files in big
compressed blocks), this workflow is not suitable.
Furthermore, the "comp" type doesn't provide for the configuration of
(de)compression parameters, and always allocates workspace memory for both
compression and decompression, which may waste memory.
To solve this, add a "pcomp" partial (de)compression interface that provides
the following operations:
- crypto_compress_{init,update,final}() for compression,
- crypto_decompress_{init,update,final}() for decompression,
- crypto_{,de}compress_setup(), to configure (de)compression parameters
(incl. allocating workspace memory).
The (de)compression methods take a struct comp_request, which was mimicked
after the z_stream object in zlib, and contains buffer pointer and length
pairs for input and output.
The setup methods take an opaque parameter pointer and length pair. Parameters
are supposed to be encoded using netlink attributes, whose meanings depend on
the actual (name of the) (de)compression algorithm.
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto/internal')
-rw-r--r-- | include/crypto/internal/compress.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/crypto/internal/compress.h b/include/crypto/internal/compress.h new file mode 100644 index 000000000000..178a888d1d93 --- /dev/null +++ b/include/crypto/internal/compress.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * Compress: Compression algorithms under the cryptographic API. | ||
3 | * | ||
4 | * Copyright 2008 Sony Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; version 2 of the License. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. | ||
17 | * If not, see <http://www.gnu.org/licenses/>. | ||
18 | */ | ||
19 | |||
20 | #ifndef _CRYPTO_INTERNAL_COMPRESS_H | ||
21 | #define _CRYPTO_INTERNAL_COMPRESS_H | ||
22 | |||
23 | #include <crypto/compress.h> | ||
24 | |||
25 | extern int crypto_register_pcomp(struct pcomp_alg *alg); | ||
26 | extern int crypto_unregister_pcomp(struct pcomp_alg *alg); | ||
27 | |||
28 | #endif /* _CRYPTO_INTERNAL_COMPRESS_H */ | ||