Re: [PATCH RFC v5 2/4] crypto: add PKE API
From: Tadeusz Struk <hidden>
Date: 2015-06-16 02:03:22
Also in:
lkml
On 06/15/2015 05:05 PM, Herbert Xu wrote:
quoted
quoted
+ * @setkey: Function invokes the algorithm specific set key function, which + * knows how to decode and interpret the BER encoded keyWe should split this into two functions: setpubkey and setprivkey.
The two functions will be almost identical. We can do it this way if we want to check if all the required elements of the key are provided. Currently I'm checking this in the actual operation.
quoted
quoted
+ * + * @reqsize: Request context size required by algorithm implementation + * @base: Common crypto API algorithm data structure + */ +struct akcipher_alg { + int (*sign)(struct akcipher_request *req); + int (*verify)(struct akcipher_request *req); + int (*encrypt)(struct akcipher_request *req); + int (*decrypt)(struct akcipher_request *req); + int (*maxsize)(struct crypto_akcipher *tfm);Hmm, we could actually get rid of maxsize by just having each function check the dst_len and if it is insufficient write the required length in it and then return an error.
Can do it that way too. Thanks for your feedback. I will send v6 soon. Thanks T