Skip to content

Commit

Permalink
Merge tag 'v6.6-p3' of git://git.kernel.org/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…herbert/crypto-2.6

Pull crypto fix from Herbert Xu:
 "This fixes a regression in sm2"

* tag 'v6.6-p3' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: sm2 - Fix crash caused by uninitialized context
  • Loading branch information
Linus Torvalds committed Sep 22, 2023
2 parents 3a457d2 + 2115562 commit 2f8d62d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crypto/sm2.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,14 @@ int sm2_compute_z_digest(struct shash_desc *desc,
if (!ec)
return -ENOMEM;

err = __sm2_set_pub_key(ec, key, keylen);
err = sm2_ec_ctx_init(ec);
if (err)
goto out_free_ec;

err = __sm2_set_pub_key(ec, key, keylen);
if (err)
goto out_deinit_ec;

bits_len = SM2_DEFAULT_USERID_LEN * 8;
entl[0] = bits_len >> 8;
entl[1] = bits_len & 0xff;
Expand Down

0 comments on commit 2f8d62d

Please sign in to comment.