Skip to content

Commit 1730c5a

Browse files
PrabhjotKhuranaIntelherbertx
authored andcommitted
crypto: engine - Add KPP Support to Crypto Engine
Add KPP support to the crypto engine queue manager, so that it can be used to simplify the logic of KPP device drivers as done for other crypto drivers. Signed-off-by: Prabhjot Khurana <[email protected]> Signed-off-by: Daniele Alessandrelli <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent cad439f commit 1730c5a

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

Documentation/crypto/crypto_engine.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ the crypto engine via one of:
6969

7070
* crypto_transfer_hash_request_to_engine()
7171

72+
* crypto_transfer_kpp_request_to_engine()
73+
7274
* crypto_transfer_skcipher_request_to_engine()
7375

7476
At the end of the request process, a call to one of the following functions is needed:
@@ -79,4 +81,6 @@ At the end of the request process, a call to one of the following functions is n
7981

8082
* crypto_finalize_hash_request()
8183

84+
* crypto_finalize_kpp_request()
85+
8286
* crypto_finalize_skcipher_request()

crypto/crypto_engine.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,19 @@ int crypto_transfer_hash_request_to_engine(struct crypto_engine *engine,
327327
}
328328
EXPORT_SYMBOL_GPL(crypto_transfer_hash_request_to_engine);
329329

330+
/**
331+
* crypto_transfer_kpp_request_to_engine - transfer one kpp_request to list
332+
* into the engine queue
333+
* @engine: the hardware engine
334+
* @req: the request need to be listed into the engine queue
335+
*/
336+
int crypto_transfer_kpp_request_to_engine(struct crypto_engine *engine,
337+
struct kpp_request *req)
338+
{
339+
return crypto_transfer_request_to_engine(engine, &req->base);
340+
}
341+
EXPORT_SYMBOL_GPL(crypto_transfer_kpp_request_to_engine);
342+
330343
/**
331344
* crypto_transfer_skcipher_request_to_engine - transfer one skcipher_request
332345
* to list into the engine queue
@@ -382,6 +395,19 @@ void crypto_finalize_hash_request(struct crypto_engine *engine,
382395
}
383396
EXPORT_SYMBOL_GPL(crypto_finalize_hash_request);
384397

398+
/**
399+
* crypto_finalize_kpp_request - finalize one kpp_request if the request is done
400+
* @engine: the hardware engine
401+
* @req: the request need to be finalized
402+
* @err: error number
403+
*/
404+
void crypto_finalize_kpp_request(struct crypto_engine *engine,
405+
struct kpp_request *req, int err)
406+
{
407+
return crypto_finalize_request(engine, &req->base, err);
408+
}
409+
EXPORT_SYMBOL_GPL(crypto_finalize_kpp_request);
410+
385411
/**
386412
* crypto_finalize_skcipher_request - finalize one skcipher_request if
387413
* the request is done

include/crypto/engine.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <crypto/akcipher.h>
1717
#include <crypto/hash.h>
1818
#include <crypto/skcipher.h>
19+
#include <crypto/kpp.h>
1920

2021
#define ENGINE_NAME_LEN 30
2122
/*
@@ -96,6 +97,8 @@ int crypto_transfer_akcipher_request_to_engine(struct crypto_engine *engine,
9697
struct akcipher_request *req);
9798
int crypto_transfer_hash_request_to_engine(struct crypto_engine *engine,
9899
struct ahash_request *req);
100+
int crypto_transfer_kpp_request_to_engine(struct crypto_engine *engine,
101+
struct kpp_request *req);
99102
int crypto_transfer_skcipher_request_to_engine(struct crypto_engine *engine,
100103
struct skcipher_request *req);
101104
void crypto_finalize_aead_request(struct crypto_engine *engine,
@@ -104,6 +107,8 @@ void crypto_finalize_akcipher_request(struct crypto_engine *engine,
104107
struct akcipher_request *req, int err);
105108
void crypto_finalize_hash_request(struct crypto_engine *engine,
106109
struct ahash_request *req, int err);
110+
void crypto_finalize_kpp_request(struct crypto_engine *engine,
111+
struct kpp_request *req, int err);
107112
void crypto_finalize_skcipher_request(struct crypto_engine *engine,
108113
struct skcipher_request *req, int err);
109114
int crypto_engine_start(struct crypto_engine *engine);

0 commit comments

Comments
 (0)