blob: 9048fe390c463069e454c117fb04f74a6835d3af [file] [log] [blame]
Thomas Gleixner2874c5f2019-05-27 08:55:01 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
3 * Cryptographic API.
4 *
5 * Compression operations.
6 *
7 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#include <linux/crypto.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include "internal.h"
11
Eric Biggersc441a902019-12-02 13:42:29 -080012int crypto_comp_compress(struct crypto_comp *comp,
13 const u8 *src, unsigned int slen,
14 u8 *dst, unsigned int *dlen)
Linus Torvalds1da177e2005-04-16 15:20:36 -070015{
Eric Biggersc441a902019-12-02 13:42:29 -080016 struct crypto_tfm *tfm = crypto_comp_tfm(comp);
17
Herbert Xu6c2bb982006-05-16 22:09:29 +100018 return tfm->__crt_alg->cra_compress.coa_compress(tfm, src, slen, dst,
Linus Torvalds1da177e2005-04-16 15:20:36 -070019 dlen);
20}
Eric Biggersc441a902019-12-02 13:42:29 -080021EXPORT_SYMBOL_GPL(crypto_comp_compress);
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
Eric Biggersc441a902019-12-02 13:42:29 -080023int crypto_comp_decompress(struct crypto_comp *comp,
24 const u8 *src, unsigned int slen,
25 u8 *dst, unsigned int *dlen)
Linus Torvalds1da177e2005-04-16 15:20:36 -070026{
Eric Biggersc441a902019-12-02 13:42:29 -080027 struct crypto_tfm *tfm = crypto_comp_tfm(comp);
28
Herbert Xu6c2bb982006-05-16 22:09:29 +100029 return tfm->__crt_alg->cra_compress.coa_decompress(tfm, src, slen, dst,
Linus Torvalds1da177e2005-04-16 15:20:36 -070030 dlen);
31}
Eric Biggersc441a902019-12-02 13:42:29 -080032EXPORT_SYMBOL_GPL(crypto_comp_decompress);