Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <prabhjot.khurana@intel.com>
Signed-off-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Prabhjot Khurana and committed by
Herbert Xu
1730c5aa cad439fc

+35
+4
Documentation/crypto/crypto_engine.rst
··· 69 69 70 70 * crypto_transfer_hash_request_to_engine() 71 71 72 + * crypto_transfer_kpp_request_to_engine() 73 + 72 74 * crypto_transfer_skcipher_request_to_engine() 73 75 74 76 At the end of the request process, a call to one of the following functions is needed: ··· 80 78 * crypto_finalize_akcipher_request() 81 79 82 80 * crypto_finalize_hash_request() 81 + 82 + * crypto_finalize_kpp_request() 83 83 84 84 * crypto_finalize_skcipher_request()
+26
crypto/crypto_engine.c
··· 328 328 EXPORT_SYMBOL_GPL(crypto_transfer_hash_request_to_engine); 329 329 330 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 + 343 + /** 331 344 * crypto_transfer_skcipher_request_to_engine - transfer one skcipher_request 332 345 * to list into the engine queue 333 346 * @engine: the hardware engine ··· 394 381 return crypto_finalize_request(engine, &req->base, err); 395 382 } 396 383 EXPORT_SYMBOL_GPL(crypto_finalize_hash_request); 384 + 385 + /** 386 + * crypto_finalize_kpp_request - finalize one kpp_request if the request is done 387 + * @engine: the hardware engine 388 + * @req: the request need to be finalized 389 + * @err: error number 390 + */ 391 + void crypto_finalize_kpp_request(struct crypto_engine *engine, 392 + struct kpp_request *req, int err) 393 + { 394 + return crypto_finalize_request(engine, &req->base, err); 395 + } 396 + EXPORT_SYMBOL_GPL(crypto_finalize_kpp_request); 397 397 398 398 /** 399 399 * crypto_finalize_skcipher_request - finalize one skcipher_request if
+5
include/crypto/engine.h
··· 16 16 #include <crypto/akcipher.h> 17 17 #include <crypto/hash.h> 18 18 #include <crypto/skcipher.h> 19 + #include <crypto/kpp.h> 19 20 20 21 #define ENGINE_NAME_LEN 30 21 22 /* ··· 97 96 struct akcipher_request *req); 98 97 int crypto_transfer_hash_request_to_engine(struct crypto_engine *engine, 99 98 struct ahash_request *req); 99 + int crypto_transfer_kpp_request_to_engine(struct crypto_engine *engine, 100 + struct kpp_request *req); 100 101 int crypto_transfer_skcipher_request_to_engine(struct crypto_engine *engine, 101 102 struct skcipher_request *req); 102 103 void crypto_finalize_aead_request(struct crypto_engine *engine, ··· 107 104 struct akcipher_request *req, int err); 108 105 void crypto_finalize_hash_request(struct crypto_engine *engine, 109 106 struct ahash_request *req, int err); 107 + void crypto_finalize_kpp_request(struct crypto_engine *engine, 108 + struct kpp_request *req, int err); 110 109 void crypto_finalize_skcipher_request(struct crypto_engine *engine, 111 110 struct skcipher_request *req, int err); 112 111 int crypto_engine_start(struct crypto_engine *engine);