Skip to content

Commit 27c2570

Browse files
committed
Merge tag 'v6.16-p7' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu: "This fixes buffer overflows in qat and chelsio" * tag 'v6.16-p7' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: qat - Use crypto_shash_export_core crypto: chelsio - Use crypto_shash_export_core
2 parents 414aaef + ccafe28 commit 27c2570

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

drivers/crypto/chelsio/chcr_algo.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,30 +314,30 @@ static int chcr_compute_partial_hash(struct shash_desc *desc,
314314
if (digest_size == SHA1_DIGEST_SIZE) {
315315
error = crypto_shash_init(desc) ?:
316316
crypto_shash_update(desc, iopad, SHA1_BLOCK_SIZE) ?:
317-
crypto_shash_export(desc, (void *)&sha1_st);
317+
crypto_shash_export_core(desc, &sha1_st);
318318
memcpy(result_hash, sha1_st.state, SHA1_DIGEST_SIZE);
319319
} else if (digest_size == SHA224_DIGEST_SIZE) {
320320
error = crypto_shash_init(desc) ?:
321321
crypto_shash_update(desc, iopad, SHA256_BLOCK_SIZE) ?:
322-
crypto_shash_export(desc, (void *)&sha256_st);
322+
crypto_shash_export_core(desc, &sha256_st);
323323
memcpy(result_hash, sha256_st.state, SHA256_DIGEST_SIZE);
324324

325325
} else if (digest_size == SHA256_DIGEST_SIZE) {
326326
error = crypto_shash_init(desc) ?:
327327
crypto_shash_update(desc, iopad, SHA256_BLOCK_SIZE) ?:
328-
crypto_shash_export(desc, (void *)&sha256_st);
328+
crypto_shash_export_core(desc, &sha256_st);
329329
memcpy(result_hash, sha256_st.state, SHA256_DIGEST_SIZE);
330330

331331
} else if (digest_size == SHA384_DIGEST_SIZE) {
332332
error = crypto_shash_init(desc) ?:
333333
crypto_shash_update(desc, iopad, SHA512_BLOCK_SIZE) ?:
334-
crypto_shash_export(desc, (void *)&sha512_st);
334+
crypto_shash_export_core(desc, &sha512_st);
335335
memcpy(result_hash, sha512_st.state, SHA512_DIGEST_SIZE);
336336

337337
} else if (digest_size == SHA512_DIGEST_SIZE) {
338338
error = crypto_shash_init(desc) ?:
339339
crypto_shash_update(desc, iopad, SHA512_BLOCK_SIZE) ?:
340-
crypto_shash_export(desc, (void *)&sha512_st);
340+
crypto_shash_export_core(desc, &sha512_st);
341341
memcpy(result_hash, sha512_st.state, SHA512_DIGEST_SIZE);
342342
} else {
343343
error = -EINVAL;

drivers/crypto/intel/qat/qat_common/qat_algs.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
#include <linux/crypto.h>
66
#include <crypto/internal/aead.h>
77
#include <crypto/internal/cipher.h>
8+
#include <crypto/internal/hash.h>
89
#include <crypto/internal/skcipher.h>
910
#include <crypto/aes.h>
1011
#include <crypto/sha1.h>
1112
#include <crypto/sha2.h>
12-
#include <crypto/hash.h>
1313
#include <crypto/hmac.h>
1414
#include <crypto/algapi.h>
1515
#include <crypto/authenc.h>
@@ -154,19 +154,19 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash,
154154

155155
switch (ctx->qat_hash_alg) {
156156
case ICP_QAT_HW_AUTH_ALGO_SHA1:
157-
if (crypto_shash_export(shash, &ctx->sha1))
157+
if (crypto_shash_export_core(shash, &ctx->sha1))
158158
return -EFAULT;
159159
for (i = 0; i < digest_size >> 2; i++, hash_state_out++)
160160
*hash_state_out = cpu_to_be32(ctx->sha1.state[i]);
161161
break;
162162
case ICP_QAT_HW_AUTH_ALGO_SHA256:
163-
if (crypto_shash_export(shash, &ctx->sha256))
163+
if (crypto_shash_export_core(shash, &ctx->sha256))
164164
return -EFAULT;
165165
for (i = 0; i < digest_size >> 2; i++, hash_state_out++)
166166
*hash_state_out = cpu_to_be32(ctx->sha256.state[i]);
167167
break;
168168
case ICP_QAT_HW_AUTH_ALGO_SHA512:
169-
if (crypto_shash_export(shash, &ctx->sha512))
169+
if (crypto_shash_export_core(shash, &ctx->sha512))
170170
return -EFAULT;
171171
for (i = 0; i < digest_size >> 3; i++, hash512_state_out++)
172172
*hash512_state_out = cpu_to_be64(ctx->sha512.state[i]);
@@ -190,19 +190,19 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash,
190190

191191
switch (ctx->qat_hash_alg) {
192192
case ICP_QAT_HW_AUTH_ALGO_SHA1:
193-
if (crypto_shash_export(shash, &ctx->sha1))
193+
if (crypto_shash_export_core(shash, &ctx->sha1))
194194
return -EFAULT;
195195
for (i = 0; i < digest_size >> 2; i++, hash_state_out++)
196196
*hash_state_out = cpu_to_be32(ctx->sha1.state[i]);
197197
break;
198198
case ICP_QAT_HW_AUTH_ALGO_SHA256:
199-
if (crypto_shash_export(shash, &ctx->sha256))
199+
if (crypto_shash_export_core(shash, &ctx->sha256))
200200
return -EFAULT;
201201
for (i = 0; i < digest_size >> 2; i++, hash_state_out++)
202202
*hash_state_out = cpu_to_be32(ctx->sha256.state[i]);
203203
break;
204204
case ICP_QAT_HW_AUTH_ALGO_SHA512:
205-
if (crypto_shash_export(shash, &ctx->sha512))
205+
if (crypto_shash_export_core(shash, &ctx->sha512))
206206
return -EFAULT;
207207
for (i = 0; i < digest_size >> 3; i++, hash512_state_out++)
208208
*hash512_state_out = cpu_to_be64(ctx->sha512.state[i]);

0 commit comments

Comments
 (0)