Loading...
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Key-agreement Protocol Primitives (KPP)
4 *
5 * Copyright (c) 2016, Intel Corporation
6 * Authors: Salvatore Benedetto <salvatore.benedetto@intel.com>
7 */
8#ifndef _CRYPTO_KPP_INT_H
9#define _CRYPTO_KPP_INT_H
10#include <crypto/kpp.h>
11#include <crypto/algapi.h>
12
13/*
14 * Transform internal helpers.
15 */
16static inline void *kpp_request_ctx(struct kpp_request *req)
17{
18 return req->__ctx;
19}
20
21static inline void *kpp_tfm_ctx(struct crypto_kpp *tfm)
22{
23 return tfm->base.__crt_ctx;
24}
25
26static inline void kpp_request_complete(struct kpp_request *req, int err)
27{
28 req->base.complete(&req->base, err);
29}
30
31static inline const char *kpp_alg_name(struct crypto_kpp *tfm)
32{
33 return crypto_kpp_tfm(tfm)->__crt_alg->cra_name;
34}
35
36/**
37 * crypto_register_kpp() -- Register key-agreement protocol primitives algorithm
38 *
39 * Function registers an implementation of a key-agreement protocol primitive
40 * algorithm
41 *
42 * @alg: algorithm definition
43 *
44 * Return: zero on success; error code in case of error
45 */
46int crypto_register_kpp(struct kpp_alg *alg);
47
48/**
49 * crypto_unregister_kpp() -- Unregister key-agreement protocol primitive
50 * algorithm
51 *
52 * Function unregisters an implementation of a key-agreement protocol primitive
53 * algorithm
54 *
55 * @alg: algorithm definition
56 */
57void crypto_unregister_kpp(struct kpp_alg *alg);
58
59#endif
1/*
2 * Key-agreement Protocol Primitives (KPP)
3 *
4 * Copyright (c) 2016, Intel Corporation
5 * Authors: Salvatore Benedetto <salvatore.benedetto@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_KPP_INT_H
14#define _CRYPTO_KPP_INT_H
15#include <crypto/kpp.h>
16#include <crypto/algapi.h>
17
18/*
19 * Transform internal helpers.
20 */
21static inline void *kpp_request_ctx(struct kpp_request *req)
22{
23 return req->__ctx;
24}
25
26static inline void *kpp_tfm_ctx(struct crypto_kpp *tfm)
27{
28 return tfm->base.__crt_ctx;
29}
30
31static inline void kpp_request_complete(struct kpp_request *req, int err)
32{
33 req->base.complete(&req->base, err);
34}
35
36static inline const char *kpp_alg_name(struct crypto_kpp *tfm)
37{
38 return crypto_kpp_tfm(tfm)->__crt_alg->cra_name;
39}
40
41/**
42 * crypto_register_kpp() -- Register key-agreement protocol primitives algorithm
43 *
44 * Function registers an implementation of a key-agreement protocol primitive
45 * algorithm
46 *
47 * @alg: algorithm definition
48 *
49 * Return: zero on success; error code in case of error
50 */
51int crypto_register_kpp(struct kpp_alg *alg);
52
53/**
54 * crypto_unregister_kpp() -- Unregister key-agreement protocol primitive
55 * algorithm
56 *
57 * Function unregisters an implementation of a key-agreement protocol primitive
58 * algorithm
59 *
60 * @alg: algorithm definition
61 */
62void crypto_unregister_kpp(struct kpp_alg *alg);
63
64#endif