This push fixes a regression in sm2.

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEn51F/lCuNhUwmDeSxycdCkmxi6cFAmUKfywACgkQxycdCkmx
 i6cJ0hAAoz9gCFqHD5yJqTfvatgMfLkJaQ1wLIBOkVYpbX2ry8YfBmk0T3UgT9cY
 J/pNZsFo8rdAO4ewVG35sY1s1avSUAvJLF1u8Cq1xou+OkfG9bFxZb/3FjYSmG9T
 CNIAreBjqzC3BDEuF4MhSJRWqZEJaAPNX/jih0D9XRp9d+qzpY4BUmD+tfrU1q1x
 Y6lsnuCIimP2J7T5qA0ZskgH3ZoMu4KRY6FLtpnaPCTpNz0K0WlwCXOncOhszYoa
 Yw5wIDGRonYB+KjFo43PmLjn8126EBizl7cQL3XR18o0Vy4m73S7FoRfCC4L/BmA
 56tr3eX0OMpDborY6i0XR9Hab+XnpUqZ9l9+PdIcHx9QAttpw+nT/8e/yJ1FqGlm
 +A7uN6eLDTyUykwbMyzi82zVgpGd2hHkRmlxg47PFzkN2+JAtIB+pB8XRtNqRtY8
 z+H22XgBKdIReQIBisYjCTrIS5lGdjPu1HlWFAJb7bvT8kUubPK3z0WCdMjCnPtO
 uDn7g9iGM0crPCOPx5O8RtRsv3v9UbqmHTaA84LF5ckiGUbgbQqawv76b23TP1+v
 qa59y6Bu0JjqsprWsjPCyHkMXXtnng5oal/Ab4EjGuHEOkAvAY7jr2ADKj08phDE
 A3Mn+QGcNdesWBiUfbXJzHuUYd9F7XwcvyKml5zn0EN66Jum+7s=
 =Rv4L
 -----END PGP SIGNATURE-----

Merge tag 'v6.6-p3' of git://git.kernel.org/pub/scm/linux/kernel/git/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
This commit is contained in:
Linus Torvalds 2023-09-22 09:15:37 -07:00
commit 2f8d62daf2

View File

@ -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;