~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/crypto/internal/scompress.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  * Synchronous Compression operations
  4  *
  5  * Copyright 2015 LG Electronics Inc.
  6  * Copyright (c) 2016, Intel Corporation
  7  * Author: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
  8  */
  9 #ifndef _CRYPTO_SCOMP_INT_H
 10 #define _CRYPTO_SCOMP_INT_H
 11 
 12 #include <crypto/acompress.h>
 13 #include <crypto/algapi.h>
 14 
 15 #define SCOMP_SCRATCH_SIZE      131072
 16 
 17 struct acomp_req;
 18 
 19 struct crypto_scomp {
 20         struct crypto_tfm base;
 21 };
 22 
 23 /**
 24  * struct scomp_alg - synchronous compression algorithm
 25  *
 26  * @alloc_ctx:  Function allocates algorithm specific context
 27  * @free_ctx:   Function frees context allocated with alloc_ctx
 28  * @compress:   Function performs a compress operation
 29  * @decompress: Function performs a de-compress operation
 30  * @base:       Common crypto API algorithm data structure
 31  * @calg:       Cmonn algorithm data structure shared with acomp
 32  */
 33 struct scomp_alg {
 34         void *(*alloc_ctx)(struct crypto_scomp *tfm);
 35         void (*free_ctx)(struct crypto_scomp *tfm, void *ctx);
 36         int (*compress)(struct crypto_scomp *tfm, const u8 *src,
 37                         unsigned int slen, u8 *dst, unsigned int *dlen,
 38                         void *ctx);
 39         int (*decompress)(struct crypto_scomp *tfm, const u8 *src,
 40                           unsigned int slen, u8 *dst, unsigned int *dlen,
 41                           void *ctx);
 42 
 43         union {
 44                 struct COMP_ALG_COMMON;
 45                 struct comp_alg_common calg;
 46         };
 47 };
 48 
 49 static inline struct scomp_alg *__crypto_scomp_alg(struct crypto_alg *alg)
 50 {
 51         return container_of(alg, struct scomp_alg, base);
 52 }
 53 
 54 static inline struct crypto_scomp *__crypto_scomp_tfm(struct crypto_tfm *tfm)
 55 {
 56         return container_of(tfm, struct crypto_scomp, base);
 57 }
 58 
 59 static inline struct crypto_tfm *crypto_scomp_tfm(struct crypto_scomp *tfm)
 60 {
 61         return &tfm->base;
 62 }
 63 
 64 static inline void crypto_free_scomp(struct crypto_scomp *tfm)
 65 {
 66         crypto_destroy_tfm(tfm, crypto_scomp_tfm(tfm));
 67 }
 68 
 69 static inline struct scomp_alg *crypto_scomp_alg(struct crypto_scomp *tfm)
 70 {
 71         return __crypto_scomp_alg(crypto_scomp_tfm(tfm)->__crt_alg);
 72 }
 73 
 74 static inline void *crypto_scomp_alloc_ctx(struct crypto_scomp *tfm)
 75 {
 76         return crypto_scomp_alg(tfm)->alloc_ctx(tfm);
 77 }
 78 
 79 static inline void crypto_scomp_free_ctx(struct crypto_scomp *tfm,
 80                                          void *ctx)
 81 {
 82         return crypto_scomp_alg(tfm)->free_ctx(tfm, ctx);
 83 }
 84 
 85 static inline int crypto_scomp_compress(struct crypto_scomp *tfm,
 86                                         const u8 *src, unsigned int slen,
 87                                         u8 *dst, unsigned int *dlen, void *ctx)
 88 {
 89         return crypto_scomp_alg(tfm)->compress(tfm, src, slen, dst, dlen, ctx);
 90 }
 91 
 92 static inline int crypto_scomp_decompress(struct crypto_scomp *tfm,
 93                                           const u8 *src, unsigned int slen,
 94                                           u8 *dst, unsigned int *dlen,
 95                                           void *ctx)
 96 {
 97         return crypto_scomp_alg(tfm)->decompress(tfm, src, slen, dst, dlen,
 98                                                  ctx);
 99 }
100 
101 /**
102  * crypto_register_scomp() -- Register synchronous compression algorithm
103  *
104  * Function registers an implementation of a synchronous
105  * compression algorithm
106  *
107  * @alg:        algorithm definition
108  *
109  * Return: zero on success; error code in case of error
110  */
111 int crypto_register_scomp(struct scomp_alg *alg);
112 
113 /**
114  * crypto_unregister_scomp() -- Unregister synchronous compression algorithm
115  *
116  * Function unregisters an implementation of a synchronous
117  * compression algorithm
118  *
119  * @alg:        algorithm definition
120  */
121 void crypto_unregister_scomp(struct scomp_alg *alg);
122 
123 int crypto_register_scomps(struct scomp_alg *algs, int count);
124 void crypto_unregister_scomps(struct scomp_alg *algs, int count);
125 
126 #endif
127 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php