Linux Audio

Check our new training course

Loading...
v5.4
 1/* SPDX-License-Identifier: GPL-2.0-or-later */
 2/*
 3 * Asynchronous Compression operations
 4 *
 5 * Copyright (c) 2016, Intel Corporation
 6 * Authors: Weigang Li <weigang.li@intel.com>
 7 *          Giovanni Cabiddu <giovanni.cabiddu@intel.com>
 
 
 
 
 
 
 8 */
 9#ifndef _CRYPTO_ACOMP_INT_H
10#define _CRYPTO_ACOMP_INT_H
11#include <crypto/acompress.h>
12
13/*
14 * Transform internal helpers.
15 */
16static inline void *acomp_request_ctx(struct acomp_req *req)
17{
18	return req->__ctx;
19}
20
21static inline void *acomp_tfm_ctx(struct crypto_acomp *tfm)
22{
23	return tfm->base.__crt_ctx;
24}
25
26static inline void acomp_request_complete(struct acomp_req *req,
27					  int err)
28{
29	req->base.complete(&req->base, err);
30}
31
32static inline const char *acomp_alg_name(struct crypto_acomp *tfm)
33{
34	return crypto_acomp_tfm(tfm)->__crt_alg->cra_name;
35}
36
37static inline struct acomp_req *__acomp_request_alloc(struct crypto_acomp *tfm)
38{
39	struct acomp_req *req;
40
41	req = kzalloc(sizeof(*req) + crypto_acomp_reqsize(tfm), GFP_KERNEL);
42	if (likely(req))
43		acomp_request_set_tfm(req, tfm);
44	return req;
45}
46
47static inline void __acomp_request_free(struct acomp_req *req)
48{
49	kzfree(req);
50}
51
52/**
53 * crypto_register_acomp() -- Register asynchronous compression algorithm
54 *
55 * Function registers an implementation of an asynchronous
56 * compression algorithm
57 *
58 * @alg:	algorithm definition
59 *
60 * Return:	zero on success; error code in case of error
61 */
62int crypto_register_acomp(struct acomp_alg *alg);
63
64/**
65 * crypto_unregister_acomp() -- Unregister asynchronous compression algorithm
66 *
67 * Function unregisters an implementation of an asynchronous
68 * compression algorithm
69 *
70 * @alg:	algorithm definition
71 *
72 * Return:	zero on success; error code in case of error
73 */
74int crypto_unregister_acomp(struct acomp_alg *alg);
75
76int crypto_register_acomps(struct acomp_alg *algs, int count);
77void crypto_unregister_acomps(struct acomp_alg *algs, int count);
78
79#endif
v4.17
 
 1/*
 2 * Asynchronous Compression operations
 3 *
 4 * Copyright (c) 2016, Intel Corporation
 5 * Authors: Weigang Li <weigang.li@intel.com>
 6 *          Giovanni Cabiddu <giovanni.cabiddu@intel.com>
 7 *
 8 * This program is free software; you can redistribute it and/or modify it
 9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
12 *
13 */
14#ifndef _CRYPTO_ACOMP_INT_H
15#define _CRYPTO_ACOMP_INT_H
16#include <crypto/acompress.h>
17
18/*
19 * Transform internal helpers.
20 */
21static inline void *acomp_request_ctx(struct acomp_req *req)
22{
23	return req->__ctx;
24}
25
26static inline void *acomp_tfm_ctx(struct crypto_acomp *tfm)
27{
28	return tfm->base.__crt_ctx;
29}
30
31static inline void acomp_request_complete(struct acomp_req *req,
32					  int err)
33{
34	req->base.complete(&req->base, err);
35}
36
37static inline const char *acomp_alg_name(struct crypto_acomp *tfm)
38{
39	return crypto_acomp_tfm(tfm)->__crt_alg->cra_name;
40}
41
42static inline struct acomp_req *__acomp_request_alloc(struct crypto_acomp *tfm)
43{
44	struct acomp_req *req;
45
46	req = kzalloc(sizeof(*req) + crypto_acomp_reqsize(tfm), GFP_KERNEL);
47	if (likely(req))
48		acomp_request_set_tfm(req, tfm);
49	return req;
50}
51
52static inline void __acomp_request_free(struct acomp_req *req)
53{
54	kzfree(req);
55}
56
57/**
58 * crypto_register_acomp() -- Register asynchronous compression algorithm
59 *
60 * Function registers an implementation of an asynchronous
61 * compression algorithm
62 *
63 * @alg:	algorithm definition
64 *
65 * Return:	zero on success; error code in case of error
66 */
67int crypto_register_acomp(struct acomp_alg *alg);
68
69/**
70 * crypto_unregister_acomp() -- Unregister asynchronous compression algorithm
71 *
72 * Function unregisters an implementation of an asynchronous
73 * compression algorithm
74 *
75 * @alg:	algorithm definition
76 *
77 * Return:	zero on success; error code in case of error
78 */
79int crypto_unregister_acomp(struct acomp_alg *alg);
80
81int crypto_register_acomps(struct acomp_alg *algs, int count);
82void crypto_unregister_acomps(struct acomp_alg *algs, int count);
83
84#endif