Linux 4.8.3
[linux/fpc-iii.git] / include / crypto / internal / kpp.h
blobad3acf3649becce4ae32f755ab3d63e7a0bf0635
1 /*
2 * Key-agreement Protocol Primitives (KPP)
4 * Copyright (c) 2016, Intel Corporation
5 * Authors: Salvatore Benedetto <salvatore.benedetto@intel.com>
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.
13 #ifndef _CRYPTO_KPP_INT_H
14 #define _CRYPTO_KPP_INT_H
15 #include <crypto/kpp.h>
16 #include <crypto/algapi.h>
19 * Transform internal helpers.
21 static inline void *kpp_request_ctx(struct kpp_request *req)
23 return req->__ctx;
26 static inline void *kpp_tfm_ctx(struct crypto_kpp *tfm)
28 return tfm->base.__crt_ctx;
31 static inline void kpp_request_complete(struct kpp_request *req, int err)
33 req->base.complete(&req->base, err);
36 static inline const char *kpp_alg_name(struct crypto_kpp *tfm)
38 return crypto_kpp_tfm(tfm)->__crt_alg->cra_name;
41 /**
42 * crypto_register_kpp() -- Register key-agreement protocol primitives algorithm
44 * Function registers an implementation of a key-agreement protocol primitive
45 * algorithm
47 * @alg: algorithm definition
49 * Return: zero on success; error code in case of error
51 int crypto_register_kpp(struct kpp_alg *alg);
53 /**
54 * crypto_unregister_kpp() -- Unregister key-agreement protocol primitive
55 * algorithm
57 * Function unregisters an implementation of a key-agreement protocol primitive
58 * algorithm
60 * @alg: algorithm definition
62 void crypto_unregister_kpp(struct kpp_alg *alg);
64 #endif