Blame view

crypto/compress.c 1.08 KB
2874c5fd2   Thomas Gleixner   treewide: Replace...
1
  // SPDX-License-Identifier: GPL-2.0-or-later
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
3
4
5
6
7
  /*
   * Cryptographic API.
   *
   * Compression operations.
   *
   * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
8
9
10
11
   */
  #include <linux/types.h>
  #include <linux/crypto.h>
  #include <linux/errno.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
12
13
14
15
16
17
18
  #include <linux/string.h>
  #include "internal.h"
  
  static int crypto_compress(struct crypto_tfm *tfm,
                              const u8 *src, unsigned int slen,
                              u8 *dst, unsigned int *dlen)
  {
6c2bb98bc   Herbert Xu   [CRYPTO] all: Pas...
19
  	return tfm->__crt_alg->cra_compress.coa_compress(tfm, src, slen, dst,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
20
21
22
23
24
25
26
  	                                                 dlen);
  }
  
  static int crypto_decompress(struct crypto_tfm *tfm,
                               const u8 *src, unsigned int slen,
                               u8 *dst, unsigned int *dlen)
  {
6c2bb98bc   Herbert Xu   [CRYPTO] all: Pas...
27
  	return tfm->__crt_alg->cra_compress.coa_decompress(tfm, src, slen, dst,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
28
29
  	                                                   dlen);
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
30
31
  int crypto_init_compress_ops(struct crypto_tfm *tfm)
  {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
32
  	struct compress_tfm *ops = &tfm->crt_compress;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
33
34
35
  
  	ops->cot_compress = crypto_compress;
  	ops->cot_decompress = crypto_decompress;
0375d66dd   Richard Hartmann   crypto: compress ...
36

c7fc05992   Herbert Xu   [CRYPTO] api: Add...
37
  	return 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
38
  }