diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/ahash.c | 14 | ||||
-rw-r--r-- | crypto/shash.c | 14 |
2 files changed, 28 insertions, 0 deletions
diff --git a/crypto/ahash.c b/crypto/ahash.c index 27128f2c687a..7d4e33dfe212 100644 --- a/crypto/ahash.c +++ b/crypto/ahash.c | |||
@@ -146,6 +146,20 @@ static int ahash_setkey(struct crypto_ahash *tfm, const u8 *key, | |||
146 | return ahash->setkey(tfm, key, keylen); | 146 | return ahash->setkey(tfm, key, keylen); |
147 | } | 147 | } |
148 | 148 | ||
149 | int crypto_ahash_import(struct ahash_request *req, const u8 *in) | ||
150 | { | ||
151 | struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); | ||
152 | struct ahash_alg *alg = crypto_ahash_alg(tfm); | ||
153 | |||
154 | memcpy(ahash_request_ctx(req), in, crypto_ahash_reqsize(tfm)); | ||
155 | |||
156 | if (alg->reinit) | ||
157 | alg->reinit(req); | ||
158 | |||
159 | return 0; | ||
160 | } | ||
161 | EXPORT_SYMBOL_GPL(crypto_ahash_import); | ||
162 | |||
149 | static unsigned int crypto_ahash_ctxsize(struct crypto_alg *alg, u32 type, | 163 | static unsigned int crypto_ahash_ctxsize(struct crypto_alg *alg, u32 type, |
150 | u32 mask) | 164 | u32 mask) |
151 | { | 165 | { |
diff --git a/crypto/shash.c b/crypto/shash.c index 3f4c713a21ea..26aff3feefc0 100644 --- a/crypto/shash.c +++ b/crypto/shash.c | |||
@@ -172,6 +172,20 @@ int crypto_shash_digest(struct shash_desc *desc, const u8 *data, | |||
172 | } | 172 | } |
173 | EXPORT_SYMBOL_GPL(crypto_shash_digest); | 173 | EXPORT_SYMBOL_GPL(crypto_shash_digest); |
174 | 174 | ||
175 | int crypto_shash_import(struct shash_desc *desc, const u8 *in) | ||
176 | { | ||
177 | struct crypto_shash *tfm = desc->tfm; | ||
178 | struct shash_alg *alg = crypto_shash_alg(tfm); | ||
179 | |||
180 | memcpy(shash_desc_ctx(desc), in, crypto_shash_descsize(tfm)); | ||
181 | |||
182 | if (alg->reinit) | ||
183 | alg->reinit(desc); | ||
184 | |||
185 | return 0; | ||
186 | } | ||
187 | EXPORT_SYMBOL_GPL(crypto_shash_import); | ||
188 | |||
175 | static int shash_async_setkey(struct crypto_ahash *tfm, const u8 *key, | 189 | static int shash_async_setkey(struct crypto_ahash *tfm, const u8 *key, |
176 | unsigned int keylen) | 190 | unsigned int keylen) |
177 | { | 191 | { |