Back to home page

LXR

 
 

    


0001 /*
0002  * Cryptographic API.
0003  *
0004  * Compression operations.
0005  *
0006  * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
0007  *
0008  * This program is free software; you can redistribute it and/or modify it
0009  * under the terms of the GNU General Public License as published by the Free
0010  * Software Foundation; either version 2 of the License, or (at your option)
0011  * any later version.
0012  *
0013  */
0014 #include <linux/types.h>
0015 #include <linux/crypto.h>
0016 #include <linux/errno.h>
0017 #include <linux/string.h>
0018 #include "internal.h"
0019 
0020 static int crypto_compress(struct crypto_tfm *tfm,
0021                             const u8 *src, unsigned int slen,
0022                             u8 *dst, unsigned int *dlen)
0023 {
0024     return tfm->__crt_alg->cra_compress.coa_compress(tfm, src, slen, dst,
0025                                                      dlen);
0026 }
0027 
0028 static int crypto_decompress(struct crypto_tfm *tfm,
0029                              const u8 *src, unsigned int slen,
0030                              u8 *dst, unsigned int *dlen)
0031 {
0032     return tfm->__crt_alg->cra_compress.coa_decompress(tfm, src, slen, dst,
0033                                                        dlen);
0034 }
0035 
0036 int crypto_init_compress_ops(struct crypto_tfm *tfm)
0037 {
0038     struct compress_tfm *ops = &tfm->crt_compress;
0039 
0040     ops->cot_compress = crypto_compress;
0041     ops->cot_decompress = crypto_decompress;
0042 
0043     return 0;
0044 }