xref: /OK3568_Linux_fs/kernel/drivers/crypto/cavium/zip/zip_crypto.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /***********************license start************************************
2*4882a593Smuzhiyun  * Copyright (c) 2003-2017 Cavium, Inc.
3*4882a593Smuzhiyun  * All rights reserved.
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * License: one of 'Cavium License' or 'GNU General Public License Version 2'
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * This file is provided under the terms of the Cavium License (see below)
8*4882a593Smuzhiyun  * or under the terms of GNU General Public License, Version 2, as
9*4882a593Smuzhiyun  * published by the Free Software Foundation. When using or redistributing
10*4882a593Smuzhiyun  * this file, you may do so under either license.
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  * Cavium License:  Redistribution and use in source and binary forms, with
13*4882a593Smuzhiyun  * or without modification, are permitted provided that the following
14*4882a593Smuzhiyun  * conditions are met:
15*4882a593Smuzhiyun  *
16*4882a593Smuzhiyun  *  * Redistributions of source code must retain the above copyright
17*4882a593Smuzhiyun  *    notice, this list of conditions and the following disclaimer.
18*4882a593Smuzhiyun  *
19*4882a593Smuzhiyun  *  * Redistributions in binary form must reproduce the above
20*4882a593Smuzhiyun  *    copyright notice, this list of conditions and the following
21*4882a593Smuzhiyun  *    disclaimer in the documentation and/or other materials provided
22*4882a593Smuzhiyun  *    with the distribution.
23*4882a593Smuzhiyun  *
24*4882a593Smuzhiyun  *  * Neither the name of Cavium Inc. nor the names of its contributors may be
25*4882a593Smuzhiyun  *    used to endorse or promote products derived from this software without
26*4882a593Smuzhiyun  *    specific prior written permission.
27*4882a593Smuzhiyun  *
28*4882a593Smuzhiyun  * This Software, including technical data, may be subject to U.S. export
29*4882a593Smuzhiyun  * control laws, including the U.S. Export Administration Act and its
30*4882a593Smuzhiyun  * associated regulations, and may be subject to export or import
31*4882a593Smuzhiyun  * regulations in other countries.
32*4882a593Smuzhiyun  *
33*4882a593Smuzhiyun  * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
34*4882a593Smuzhiyun  * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS
35*4882a593Smuzhiyun  * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
36*4882a593Smuzhiyun  * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
37*4882a593Smuzhiyun  * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
38*4882a593Smuzhiyun  * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY)
39*4882a593Smuzhiyun  * WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A
40*4882a593Smuzhiyun  * PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET
41*4882a593Smuzhiyun  * ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE
42*4882a593Smuzhiyun  * ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES
43*4882a593Smuzhiyun  * WITH YOU.
44*4882a593Smuzhiyun  ***********************license end**************************************/
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun #ifndef __ZIP_CRYPTO_H__
47*4882a593Smuzhiyun #define __ZIP_CRYPTO_H__
48*4882a593Smuzhiyun 
49*4882a593Smuzhiyun #include <linux/crypto.h>
50*4882a593Smuzhiyun #include <crypto/internal/scompress.h>
51*4882a593Smuzhiyun #include "common.h"
52*4882a593Smuzhiyun #include "zip_deflate.h"
53*4882a593Smuzhiyun #include "zip_inflate.h"
54*4882a593Smuzhiyun 
55*4882a593Smuzhiyun struct zip_kernel_ctx {
56*4882a593Smuzhiyun 	struct zip_operation zip_comp;
57*4882a593Smuzhiyun 	struct zip_operation zip_decomp;
58*4882a593Smuzhiyun };
59*4882a593Smuzhiyun 
60*4882a593Smuzhiyun int  zip_alloc_comp_ctx_deflate(struct crypto_tfm *tfm);
61*4882a593Smuzhiyun int  zip_alloc_comp_ctx_lzs(struct crypto_tfm *tfm);
62*4882a593Smuzhiyun void zip_free_comp_ctx(struct crypto_tfm *tfm);
63*4882a593Smuzhiyun int  zip_comp_compress(struct crypto_tfm *tfm,
64*4882a593Smuzhiyun 		       const u8 *src, unsigned int slen,
65*4882a593Smuzhiyun 		       u8 *dst, unsigned int *dlen);
66*4882a593Smuzhiyun int  zip_comp_decompress(struct crypto_tfm *tfm,
67*4882a593Smuzhiyun 			 const u8 *src, unsigned int slen,
68*4882a593Smuzhiyun 			 u8 *dst, unsigned int *dlen);
69*4882a593Smuzhiyun 
70*4882a593Smuzhiyun void *zip_alloc_scomp_ctx_deflate(struct crypto_scomp *tfm);
71*4882a593Smuzhiyun void *zip_alloc_scomp_ctx_lzs(struct crypto_scomp *tfm);
72*4882a593Smuzhiyun void  zip_free_scomp_ctx(struct crypto_scomp *tfm, void *zip_ctx);
73*4882a593Smuzhiyun int   zip_scomp_compress(struct crypto_scomp *tfm,
74*4882a593Smuzhiyun 			 const u8 *src, unsigned int slen,
75*4882a593Smuzhiyun 			 u8 *dst, unsigned int *dlen, void *ctx);
76*4882a593Smuzhiyun int   zip_scomp_decompress(struct crypto_scomp *tfm,
77*4882a593Smuzhiyun 			   const u8 *src, unsigned int slen,
78*4882a593Smuzhiyun 			   u8 *dst, unsigned int *dlen, void *ctx);
79*4882a593Smuzhiyun #endif
80