1 /*
2  * Public Key Encryption
3  *
4  * Copyright (c) 2015, Intel Corporation
5  * Authors: Tadeusz Struk <tadeusz.struk@intel.com>
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the Free
9  * Software Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  */
13 #ifndef _CRYPTO_AKCIPHER_INT_H
14 #define _CRYPTO_AKCIPHER_INT_H
15 #include <crypto/akcipher.h>
16 
17 /*
18  * Transform internal helpers.
19  */
20 static inline void *akcipher_request_ctx(struct akcipher_request *req)
21 {
22 	return req->__ctx;
23 }
24 
25 static inline void *akcipher_tfm_ctx(struct crypto_akcipher *tfm)
26 {
27 	return tfm->base.__crt_ctx;
28 }
29 
30 static inline void akcipher_request_complete(struct akcipher_request *req,
31 					     int err)
32 {
33 	req->base.complete(&req->base, err);
34 }
35 
36 static inline const char *akcipher_alg_name(struct crypto_akcipher *tfm)
37 {
38 	return crypto_akcipher_tfm(tfm)->__crt_alg->cra_name;
39 }
40 
41 /**
42  * crypto_register_akcipher() -- Register public key algorithm
43  *
44  * Function registers an implementation of a public key verify algorithm
45  *
46  * @alg:	algorithm definition
47  *
48  * Return: zero on success; error code in case of error
49  */
50 int crypto_register_akcipher(struct akcipher_alg *alg);
51 
52 /**
53  * crypto_unregister_akcipher() -- Unregister public key algorithm
54  *
55  * Function unregisters an implementation of a public key verify algorithm
56  *
57  * @alg:	algorithm definition
58  */
59 void crypto_unregister_akcipher(struct akcipher_alg *alg);
60 #endif
61