crypto: skcipher - Add default key size helper
[cascardo/linux.git] / include / crypto / skcipher.h
index d8dd41f..2f07b4f 100644 (file)
@@ -60,6 +60,7 @@ struct crypto_skcipher {
 
        unsigned int ivsize;
        unsigned int reqsize;
+       unsigned int keysize;
 
        struct crypto_tfm base;
 };
@@ -305,6 +306,17 @@ static inline int crypto_skcipher_setkey(struct crypto_skcipher *tfm,
        return tfm->setkey(tfm, key, keylen);
 }
 
+static inline bool crypto_skcipher_has_setkey(struct crypto_skcipher *tfm)
+{
+       return tfm->keysize;
+}
+
+static inline unsigned int crypto_skcipher_default_keysize(
+       struct crypto_skcipher *tfm)
+{
+       return tfm->keysize;
+}
+
 /**
  * crypto_skcipher_reqtfm() - obtain cipher handle from request
  * @req: skcipher_request out of which the cipher handle is to be obtained