mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
crypto: sig - Move crypto_sig_*() API calls to include file
The crypto_sig_*() API calls lived in sig.c so far because they needed access to struct crypto_sig_type: This was necessary to differentiate between signature algorithms that had already been migrated from crypto_akcipher to crypto_sig and those that hadn't yet. Now that all algorithms have been migrated, the API calls can become static inlines in <crypto/sig.h> to mimic what <crypto/akcipher.h> is doing. Signed-off-by: Lukas Wunner <lukas@wunner.de> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
6b34562f0c
commit
5ba296674e
46
crypto/sig.c
46
crypto/sig.c
@ -84,52 +84,6 @@ struct crypto_sig *crypto_alloc_sig(const char *alg_name, u32 type, u32 mask)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_alloc_sig);
|
||||
|
||||
int crypto_sig_maxsize(struct crypto_sig *tfm)
|
||||
{
|
||||
struct sig_alg *alg = crypto_sig_alg(tfm);
|
||||
|
||||
return alg->max_size(tfm);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_sig_maxsize);
|
||||
|
||||
int crypto_sig_sign(struct crypto_sig *tfm,
|
||||
const void *src, unsigned int slen,
|
||||
void *dst, unsigned int dlen)
|
||||
{
|
||||
struct sig_alg *alg = crypto_sig_alg(tfm);
|
||||
|
||||
return alg->sign(tfm, src, slen, dst, dlen);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_sig_sign);
|
||||
|
||||
int crypto_sig_verify(struct crypto_sig *tfm,
|
||||
const void *src, unsigned int slen,
|
||||
const void *digest, unsigned int dlen)
|
||||
{
|
||||
struct sig_alg *alg = crypto_sig_alg(tfm);
|
||||
|
||||
return alg->verify(tfm, src, slen, digest, dlen);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_sig_verify);
|
||||
|
||||
int crypto_sig_set_pubkey(struct crypto_sig *tfm,
|
||||
const void *key, unsigned int keylen)
|
||||
{
|
||||
struct sig_alg *alg = crypto_sig_alg(tfm);
|
||||
|
||||
return alg->set_pub_key(tfm, key, keylen);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_sig_set_pubkey);
|
||||
|
||||
int crypto_sig_set_privkey(struct crypto_sig *tfm,
|
||||
const void *key, unsigned int keylen)
|
||||
{
|
||||
struct sig_alg *alg = crypto_sig_alg(tfm);
|
||||
|
||||
return alg->set_priv_key(tfm, key, keylen);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_sig_set_privkey);
|
||||
|
||||
static void sig_prepare_alg(struct sig_alg *alg)
|
||||
{
|
||||
struct crypto_alg *base = &alg->base;
|
||||
|
@ -130,7 +130,12 @@ static inline void crypto_free_sig(struct crypto_sig *tfm)
|
||||
*
|
||||
* @tfm: signature tfm handle allocated with crypto_alloc_sig()
|
||||
*/
|
||||
int crypto_sig_maxsize(struct crypto_sig *tfm);
|
||||
static inline int crypto_sig_maxsize(struct crypto_sig *tfm)
|
||||
{
|
||||
struct sig_alg *alg = crypto_sig_alg(tfm);
|
||||
|
||||
return alg->max_size(tfm);
|
||||
}
|
||||
|
||||
/**
|
||||
* crypto_sig_sign() - Invoke signing operation
|
||||
@ -145,9 +150,14 @@ int crypto_sig_maxsize(struct crypto_sig *tfm);
|
||||
*
|
||||
* Return: zero on success; error code in case of error
|
||||
*/
|
||||
int crypto_sig_sign(struct crypto_sig *tfm,
|
||||
const void *src, unsigned int slen,
|
||||
void *dst, unsigned int dlen);
|
||||
static inline int crypto_sig_sign(struct crypto_sig *tfm,
|
||||
const void *src, unsigned int slen,
|
||||
void *dst, unsigned int dlen)
|
||||
{
|
||||
struct sig_alg *alg = crypto_sig_alg(tfm);
|
||||
|
||||
return alg->sign(tfm, src, slen, dst, dlen);
|
||||
}
|
||||
|
||||
/**
|
||||
* crypto_sig_verify() - Invoke signature verification
|
||||
@ -163,9 +173,14 @@ int crypto_sig_sign(struct crypto_sig *tfm,
|
||||
*
|
||||
* Return: zero on verification success; error code in case of error.
|
||||
*/
|
||||
int crypto_sig_verify(struct crypto_sig *tfm,
|
||||
const void *src, unsigned int slen,
|
||||
const void *digest, unsigned int dlen);
|
||||
static inline int crypto_sig_verify(struct crypto_sig *tfm,
|
||||
const void *src, unsigned int slen,
|
||||
const void *digest, unsigned int dlen)
|
||||
{
|
||||
struct sig_alg *alg = crypto_sig_alg(tfm);
|
||||
|
||||
return alg->verify(tfm, src, slen, digest, dlen);
|
||||
}
|
||||
|
||||
/**
|
||||
* crypto_sig_set_pubkey() - Invoke set public key operation
|
||||
@ -180,8 +195,13 @@ int crypto_sig_verify(struct crypto_sig *tfm,
|
||||
*
|
||||
* Return: zero on success; error code in case of error
|
||||
*/
|
||||
int crypto_sig_set_pubkey(struct crypto_sig *tfm,
|
||||
const void *key, unsigned int keylen);
|
||||
static inline int crypto_sig_set_pubkey(struct crypto_sig *tfm,
|
||||
const void *key, unsigned int keylen)
|
||||
{
|
||||
struct sig_alg *alg = crypto_sig_alg(tfm);
|
||||
|
||||
return alg->set_pub_key(tfm, key, keylen);
|
||||
}
|
||||
|
||||
/**
|
||||
* crypto_sig_set_privkey() - Invoke set private key operation
|
||||
@ -196,6 +216,11 @@ int crypto_sig_set_pubkey(struct crypto_sig *tfm,
|
||||
*
|
||||
* Return: zero on success; error code in case of error
|
||||
*/
|
||||
int crypto_sig_set_privkey(struct crypto_sig *tfm,
|
||||
const void *key, unsigned int keylen);
|
||||
static inline int crypto_sig_set_privkey(struct crypto_sig *tfm,
|
||||
const void *key, unsigned int keylen)
|
||||
{
|
||||
struct sig_alg *alg = crypto_sig_alg(tfm);
|
||||
|
||||
return alg->set_priv_key(tfm, key, keylen);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user