From 923c030c8f3a8e3a2b7d6be5126c0de64bba07eb Mon Sep 17 00:00:00 2001 From: Sam James Date: Fri, 20 Feb 2026 13:36:08 +0000 Subject: [PATCH] dev-libs/libgcrypt/files: drop unused patches Signed-off-by: Sam James --- ...c-Make-sure-to-have-MPI-limbs-in-ECC.patch | 736 ------------------ ...x512-add-PIC-PLT-for-AVX2-function-j.patch | 106 --- ...ify-POINT-in-_gcry_mpi_ec_get_affine.patch | 52 -- ..._new-with-NBITS-instead-of-mpi_alloc.patch | 89 --- ...eierstrass-curve-with-PUBKEY_FLAG_PA.patch | 80 -- 5 files changed, 1063 deletions(-) delete mode 100644 dev-libs/libgcrypt/files/0001-mpi-ec-Make-sure-to-have-MPI-limbs-in-ECC.patch delete mode 100644 dev-libs/libgcrypt/files/0001-rijndael-vaes-avx512-add-PIC-PLT-for-AVX2-function-j.patch delete mode 100644 dev-libs/libgcrypt/files/0002-mpi-ec-Don-t-modify-POINT-in-_gcry_mpi_ec_get_affine.patch delete mode 100644 dev-libs/libgcrypt/files/0002-mpi-ec-Use-mpi_new-with-NBITS-instead-of-mpi_alloc.patch delete mode 100644 dev-libs/libgcrypt/files/0003-cipher-ecc-Fix-Weierstrass-curve-with-PUBKEY_FLAG_PA.patch diff --git a/dev-libs/libgcrypt/files/0001-mpi-ec-Make-sure-to-have-MPI-limbs-in-ECC.patch b/dev-libs/libgcrypt/files/0001-mpi-ec-Make-sure-to-have-MPI-limbs-in-ECC.patch deleted file mode 100644 index 02ab540d5abe4..0000000000000 --- a/dev-libs/libgcrypt/files/0001-mpi-ec-Make-sure-to-have-MPI-limbs-in-ECC.patch +++ /dev/null @@ -1,736 +0,0 @@ -diff --git a/cipher/ecc-common.h b/cipher/ecc-common.h -index 01fb9042..54270eab 100644 ---- a/cipher/ecc-common.h -+++ b/cipher/ecc-common.h -@@ -47,7 +47,7 @@ point_set (mpi_point_t d, mpi_point_t s) - mpi_set (d->z, s->z); - } - --#define point_init(a) _gcry_mpi_point_init ((a)) -+#define point_init(a,nbits) _gcry_mpi_point_init ((a),(nbits)) - #define point_free(a) _gcry_mpi_point_free_parts ((a)) - - -diff --git a/cipher/ecc-curves.c b/cipher/ecc-curves.c -index 975f6a07..5478e69d 100644 ---- a/cipher/ecc-curves.c -+++ b/cipher/ecc-curves.c -@@ -863,7 +863,7 @@ _gcry_ecc_get_curve (gcry_sexp_t keyparms, int iterator, unsigned int *r_nbits) - if (rc) - goto leave; - -- _gcry_mpi_point_init (&E.G); -+ _gcry_mpi_point_init (&E.G, 0); - _gcry_mpi_point_set (&E.G, G->x, G->y, G->z); - - for (idx = 0; domain_parms[idx].desc; idx++) -@@ -991,7 +991,7 @@ point_from_keyparam (gcry_mpi_point_t *r_a, - if (!a) - return GPG_ERR_INV_OBJ; - -- point = mpi_point_new (0); -+ point = mpi_point_new (ec->nbits); - rc = _gcry_mpi_ec_decode_point (point, a, ec); - mpi_free (a); - if (rc) -@@ -1120,7 +1120,7 @@ mpi_ec_get_elliptic_curve (elliptic_curve_t *E, int *r_flags, - goto leave; - if (G) - { -- _gcry_mpi_point_init (&E->G); -+ _gcry_mpi_point_init (&E->G, 0); - mpi_point_set (&E->G, G->x, G->y, G->z); - mpi_point_set (G, NULL, NULL, NULL); - mpi_point_release (G); -@@ -1551,7 +1551,7 @@ _gcry_ecc_set_mpi (const char *name, gcry_mpi_t newvalue, mpi_ec_t ec) - if (newvalue) - { - if (!ec->Q) -- ec->Q = mpi_point_new (0); -+ ec->Q = mpi_point_new (ec->nbits); - rc = _gcry_mpi_ec_decode_point (ec->Q, newvalue, ec); - } - if (rc || !newvalue) -diff --git a/cipher/ecc-ecdh.c b/cipher/ecc-ecdh.c -index c690d221..385f5c2a 100644 ---- a/cipher/ecc-ecdh.c -+++ b/cipher/ecc-ecdh.c -@@ -131,7 +131,7 @@ _gcry_ecc_curve_keypair (const char *curve, - return GPG_ERR_UNKNOWN_CURVE; - - x = mpi_new (nbits); -- point_init (&Q); -+ point_init (&Q, ec->nbits); - - _gcry_mpi_ec_mul_point (&Q, mpi_k, ec->G, ec); - -@@ -254,14 +254,14 @@ _gcry_ecc_curve_mul_point (const char *curve, - goto leave; - } - -- point_init (&Q); -+ point_init (&Q, ec->nbits); - - if (point) - { - gcry_mpi_t mpi_u = _gcry_mpi_set_opaque_copy (NULL, point, point_len*8); - mpi_point_struct P; - -- point_init (&P); -+ point_init (&P, ec->nbits); - if (ec->model == MPI_EC_WEIERSTRASS) - err = _gcry_ecc_sec_decodepoint (mpi_u, ec, &P); - else /* MPI_EC_MONTGOMERY */ -diff --git a/cipher/ecc-ecdsa.c b/cipher/ecc-ecdsa.c -index 6231ae0b..34f2903b 100644 ---- a/cipher/ecc-ecdsa.c -+++ b/cipher/ecc-ecdsa.c -@@ -89,7 +89,7 @@ _gcry_ecc_ecdsa_sign (gcry_mpi_t input, gcry_mpi_t k_supplied, mpi_ec_t ec, - sum = mpi_alloc (0); - k_1 = mpi_alloc (0); - x = mpi_alloc (0); -- point_init (&I); -+ point_init (&I, ec->nbits); - - /* Two loops to avoid R or S are zero. This is more of a joke than - a real demand because the probability of them being zero is less -@@ -268,9 +268,9 @@ _gcry_ecc_ecdsa_verify (gcry_mpi_t input, mpi_ec_t ec, - h1 = mpi_alloc (0); - h2 = mpi_alloc (0); - x = mpi_alloc (0); -- point_init (&Q); -- point_init (&Q1); -- point_init (&Q2); -+ point_init (&Q, ec->nbits); -+ point_init (&Q1, ec->nbits); -+ point_init (&Q2, ec->nbits); - - /* h = s^(-1) (mod n) */ - mpi_invm (h, s, ec->n); -diff --git a/cipher/ecc-eddsa.c b/cipher/ecc-eddsa.c -index fb952baf..d3c6b6f2 100644 ---- a/cipher/ecc-eddsa.c -+++ b/cipher/ecc-eddsa.c -@@ -126,8 +126,8 @@ _gcry_ecc_eddsa_encodepoint (mpi_point_t point, mpi_ec_t ec, - gpg_err_code_t rc; - gcry_mpi_t x, y; - -- x = x_in? x_in : mpi_new (0); -- y = y_in? y_in : mpi_new (0); -+ x = x_in? x_in : mpi_new (ec->nbits); -+ y = y_in? y_in : mpi_new (ec->nbits); - - if (_gcry_mpi_ec_get_affine (x, y, point, ec)) - { -@@ -219,11 +219,11 @@ ecc_ed448_recover_x (gcry_mpi_t x, gcry_mpi_t y, int x_0, mpi_ec_t ec) - p34 = scanval ("3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - "BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"); - -- u = mpi_new (0); -- v = mpi_new (0); -- u3 = mpi_new (0); -- v3 = mpi_new (0); -- t = mpi_new (0); -+ u = mpi_new (ec->nbits); -+ v = mpi_new (ec->nbits); -+ u3 = mpi_new (ec->nbits); -+ v3 = mpi_new (ec->nbits); -+ t = mpi_new (ec->nbits); - - /* Compute u and v */ - /* u = y^2 */ -@@ -300,10 +300,10 @@ _gcry_ecc_eddsa_recover_x (gcry_mpi_t x, gcry_mpi_t y, int sign, mpi_ec_t ec) - if (!seven) - seven = mpi_set_ui (NULL, 7); - -- u = mpi_new (0); -- v = mpi_new (0); -- v3 = mpi_new (0); -- t = mpi_new (0); -+ u = mpi_new (ec->nbits); -+ v = mpi_new (ec->nbits); -+ v3 = mpi_new (ec->nbits); -+ t = mpi_new (ec->nbits); - - /* Compute u and v */ - /* u = y^2 */ -@@ -592,7 +592,7 @@ _gcry_ecc_eddsa_genkey (mpi_ec_t ec, int flags) - { - gpg_err_code_t rc; - int b; -- gcry_mpi_t a, x, y; -+ gcry_mpi_t a; - mpi_point_struct Q; - gcry_random_level_t random_level; - char *dbuf; -@@ -616,8 +616,6 @@ _gcry_ecc_eddsa_genkey (mpi_ec_t ec, int flags) - dlen = b; - - a = mpi_snew (0); -- x = mpi_new (0); -- y = mpi_new (0); - - /* Generate a secret. */ - dbuf = _gcry_random_bytes_secure (dlen, random_level); -@@ -631,7 +629,7 @@ _gcry_ecc_eddsa_genkey (mpi_ec_t ec, int flags) - /* log_printmpi ("ecgen a", a); */ - - /* Compute Q. */ -- point_init (&Q); -+ point_init (&Q, ec->nbits); - _gcry_mpi_ec_mul_point (&Q, a, ec->G, ec); - if (DBG_CIPHER) - log_printpnt ("ecgen pk", &Q, ec); -@@ -643,8 +641,6 @@ _gcry_ecc_eddsa_genkey (mpi_ec_t ec, int flags) - - leave: - _gcry_mpi_release (a); -- _gcry_mpi_release (x); -- _gcry_mpi_release (y); - return rc; - } - -@@ -716,11 +712,11 @@ _gcry_ecc_eddsa_sign (gcry_mpi_t input, mpi_ec_t ec, - return GPG_ERR_INV_DATA; - - /* Initialize some helpers. */ -- point_init (&I); -+ point_init (&I, ec->nbits); - a = mpi_snew (0); -- x = mpi_new (0); -- y = mpi_new (0); -- r = mpi_snew (0); -+ x = mpi_new (ec->nbits); -+ y = mpi_new (ec->nbits); -+ r = mpi_snew (ec->nbits); - - rc = _gcry_ecc_eddsa_compute_h_d (&digest, ec); - if (rc) -@@ -732,7 +728,7 @@ _gcry_ecc_eddsa_sign (gcry_mpi_t input, mpi_ec_t ec, - { - mpi_point_struct Q; - -- point_init (&Q); -+ point_init (&Q, ec->nbits); - _gcry_mpi_ec_mul_point (&Q, a, ec->G, ec); - ec->Q = mpi_point_snatch_set (NULL, Q.x, Q.y, Q.z); - } -@@ -939,8 +935,8 @@ _gcry_ecc_eddsa_verify (gcry_mpi_t input, mpi_ec_t ec, - else - return GPG_ERR_NOT_IMPLEMENTED; - -- point_init (&Ia); -- point_init (&Ib); -+ point_init (&Ia, ec->nbits); -+ point_init (&Ib, ec->nbits); - h = mpi_new (0); - s = mpi_new (0); - -diff --git a/cipher/ecc-gost.c b/cipher/ecc-gost.c -index 36230f8a..179660fa 100644 ---- a/cipher/ecc-gost.c -+++ b/cipher/ecc-gost.c -@@ -63,7 +63,7 @@ _gcry_ecc_gost_sign (gcry_mpi_t input, mpi_ec_t ec, - ke = mpi_alloc (0); - e = mpi_alloc (0); - x = mpi_alloc (0); -- point_init (&I); -+ point_init (&I, ec->nbits); - - mpi_mod (e, input, ec->n); /* e = hash mod n */ - -@@ -148,9 +148,9 @@ _gcry_ecc_gost_verify (gcry_mpi_t input, mpi_ec_t ec, - rv = mpi_alloc (0); - zero = mpi_alloc (0); - -- point_init (&Q); -- point_init (&Q1); -- point_init (&Q2); -+ point_init (&Q, ec->nbits); -+ point_init (&Q1, ec->nbits); -+ point_init (&Q2, ec->nbits); - - mpi_mod (e, input, ec->n); /* e = hash mod n */ - if (!mpi_cmp_ui (e, 0)) -diff --git a/cipher/ecc-misc.c b/cipher/ecc-misc.c -index 6796ba2c..40303ac4 100644 ---- a/cipher/ecc-misc.c -+++ b/cipher/ecc-misc.c -@@ -60,7 +60,7 @@ _gcry_ecc_curve_copy (elliptic_curve_t E) - R.p = mpi_copy (E.p); - R.a = mpi_copy (E.a); - R.b = mpi_copy (E.b); -- _gcry_mpi_point_init (&R.G); -+ _gcry_mpi_point_init (&R.G, 0); - point_set (&R.G, &E.G); - R.n = mpi_copy (E.n); - R.h = E.h; -@@ -159,8 +159,8 @@ _gcry_mpi_ec_ec2os (gcry_mpi_point_t point, mpi_ec_t ec) - { - gcry_mpi_t g_x, g_y, result; - -- g_x = mpi_new (0); -- g_y = mpi_new (0); -+ g_x = mpi_new (ec->nbits); -+ g_y = mpi_new (ec->nbits); - if (_gcry_mpi_ec_get_affine (g_x, g_y, point, ec)) - result = NULL; - else -@@ -236,10 +236,10 @@ _gcry_ecc_sec_decodepoint (gcry_mpi_t value, mpi_ec_t ec, mpi_point_t result) - * Recover Y. The Weierstrass curve: y^2 = x^3 + a*x + b - */ - -- x3 = mpi_new (0); -- t = mpi_new (0); -- p1_4 = mpi_new (0); -- y = mpi_new (0); -+ x3 = mpi_new (ec->nbits); -+ t = mpi_new (ec->nbits); -+ p1_4 = mpi_new (ec->nbits); -+ y = mpi_new (ec->nbits); - - /* Compute right hand side. */ - mpi_powm (x3, x, mpi_const (MPI_C_THREE), ec->p); -@@ -344,7 +344,7 @@ _gcry_ecc_compute_public (mpi_point_t Q, mpi_ec_t ec) - - /* And finally the public key. */ - if (!Q) -- Q = mpi_point_new (0); -+ Q = mpi_point_new (ec->nbits); - if (Q) - _gcry_mpi_ec_mul_point (Q, a, ec->G, ec); - mpi_free (a); -@@ -352,7 +352,7 @@ _gcry_ecc_compute_public (mpi_point_t Q, mpi_ec_t ec) - else - { - if (!Q) -- Q = mpi_point_new (0); -+ Q = mpi_point_new (ec->nbits); - if (Q) - _gcry_mpi_ec_mul_point (Q, ec->d, ec->G, ec); - } -diff --git a/cipher/ecc-sm2.c b/cipher/ecc-sm2.c -index c52629fd..8c3241e4 100644 ---- a/cipher/ecc-sm2.c -+++ b/cipher/ecc-sm2.c -@@ -114,12 +114,12 @@ _gcry_ecc_sm2_encrypt (gcry_sexp_t *r_ciph, gcry_mpi_t input, mpi_ec_t ec) - unsigned char *cipher = NULL; - int i; - -- point_init (&kG); -- point_init (&kP); -- x1 = mpi_new (0); -- y1 = mpi_new (0); -- x2 = mpi_new (0); -- y2 = mpi_new (0); -+ point_init (&kG, ec->nbits); -+ point_init (&kP, ec->nbits); -+ x1 = mpi_new (ec->nbits); -+ y1 = mpi_new (ec->nbits); -+ x2 = mpi_new (ec->nbits); -+ y2 = mpi_new (ec->nbits); - - in = _gcry_mpi_get_buffer (input, 0, &inlen, NULL); - if (!in) -@@ -268,10 +268,10 @@ _gcry_ecc_sm2_decrypt (gcry_sexp_t *r_plain, gcry_sexp_t data_list, mpi_ec_t ec) - unsigned int c3_len; - int i; - -- point_init (&c1); -- point_init (&kP); -- x2 = mpi_new (0); -- y2 = mpi_new (0); -+ point_init (&c1, ec->nbits); -+ point_init (&kP, ec->nbits); -+ x2 = mpi_new (ec->nbits); -+ y2 = mpi_new (ec->nbits); - - in = mpi_get_opaque (data_c2, &inlen); - inlen = (inlen + 7) / 8; -@@ -401,10 +401,10 @@ _gcry_ecc_sm2_sign (gcry_mpi_t input, mpi_ec_t ec, - if (rc) - return rc; - -- point_init (&kG); -- x1 = mpi_new (0); -- rk = mpi_new (0); -- tmp = mpi_new (0); -+ point_init (&kG, ec->nbits); -+ x1 = mpi_new (ec->nbits); -+ rk = mpi_new (ec->nbits); -+ tmp = mpi_new (ec->nbits); - - for (;;) - { -@@ -514,11 +514,11 @@ _gcry_ecc_sm2_verify (gcry_mpi_t input, mpi_ec_t ec, - if (err) - return err; - -- point_init (&sG); -- point_init (&tP); -- x1 = mpi_new (0); -- y1 = mpi_new (0); -- t = mpi_new (0); -+ point_init (&sG, ec->nbits); -+ point_init (&tP, ec->nbits); -+ x1 = mpi_new (ec->nbits); -+ y1 = mpi_new (ec->nbits); -+ t = mpi_new (ec->nbits); - - /* t = (r + s) % n, t != 0 */ - mpi_addm (t, r, s, ec->n); -diff --git a/cipher/ecc.c b/cipher/ecc.c -index 51364b64..95dc0535 100644 ---- a/cipher/ecc.c -+++ b/cipher/ecc.c -@@ -256,7 +256,7 @@ nist_generate_key (mpi_ec_t ec, int flags, - gcry_mpi_t x, y; - const unsigned int pbits = ec->nbits; - -- point_init (&Q); -+ point_init (&Q, ec->nbits); - - if ((flags & PUBKEY_FLAG_TRANSIENT_KEY)) - random_level = GCRY_STRONG_RANDOM; -@@ -387,7 +387,7 @@ test_keys (mpi_ec_t ec, unsigned int nbits) - if (DBG_CIPHER) - log_debug ("Testing key.\n"); - -- point_init (&R_); -+ point_init (&R_, ec->nbits); - - _gcry_mpi_randomize (test, nbits, GCRY_WEAK_RANDOM); - -@@ -544,7 +544,7 @@ test_ecdh_only_keys (mpi_ec_t ec, unsigned int nbits, int flags) - if (DBG_CIPHER) - log_debug ("Testing ECDH only key.\n"); - -- point_init (&R_); -+ point_init (&R_, ec->nbits); - - if (ec->dialect == ECC_DIALECT_SAFECURVE || (flags & PUBKEY_FLAG_DJB_TWEAK)) - { -@@ -572,8 +572,8 @@ test_ecdh_only_keys (mpi_ec_t ec, unsigned int nbits, int flags) - _gcry_mpi_randomize (test, nbits, GCRY_WEAK_RANDOM); - } - -- x0 = mpi_new (0); -- x1 = mpi_new (0); -+ x0 = mpi_new (ec->nbits); -+ x1 = mpi_new (ec->nbits); - - /* R_ = hkQ <=> R_ = hkdG */ - _gcry_mpi_ec_mul_point (&R_, test, ec->Q, ec); -@@ -617,12 +617,12 @@ check_secret_key (mpi_ec_t ec, int flags) - gcry_mpi_t x2 = NULL; - gcry_mpi_t y2 = NULL; - -- point_init (&Q); -- x1 = mpi_new (0); -+ point_init (&Q, ec->nbits); -+ x1 = mpi_new (ec->nbits); - if (ec->model == MPI_EC_MONTGOMERY) - y1 = NULL; - else -- y1 = mpi_new (0); -+ y1 = mpi_new (ec->nbits); - - /* G in E(F_p) */ - if (!_gcry_mpi_ec_curve_point (ec->G, ec)) -@@ -687,8 +687,8 @@ check_secret_key (mpi_ec_t ec, int flags) - } - else - { -- x2 = mpi_new (0); -- y2 = mpi_new (0); -+ x2 = mpi_new (ec->nbits); -+ y2 = mpi_new (ec->nbits); - if (_gcry_mpi_ec_get_affine (x2, y2, ec->Q, ec)) - { - if (DBG_CIPHER) -@@ -751,8 +751,8 @@ ecc_generate (const gcry_sexp_t genparms, gcry_sexp_t *r_skey) - goto leave; - - /* Copy data to the result. */ -- Gx = mpi_new (0); -- Gy = mpi_new (0); -+ Gx = mpi_new (ec->nbits); -+ Gy = mpi_new (ec->nbits); - if (ec->model != MPI_EC_MONTGOMERY) - { - if (_gcry_mpi_ec_get_affine (Gx, Gy, ec->G, ec)) -@@ -787,8 +787,8 @@ ecc_generate (const gcry_sexp_t genparms, gcry_sexp_t *r_skey) - { - /* This is the case for a key from _gcry_ecc_eddsa_generate - with no compression. */ -- Qx = mpi_new (0); -- Qy = mpi_new (0); -+ Qx = mpi_new (ec->nbits); -+ Qy = mpi_new (ec->nbits); - if (_gcry_mpi_ec_get_affine (Qx, Qy, ec->Q, ec)) - log_fatal ("ecgen: Failed to get affine coordinates for %s\n", "Q"); - } -@@ -1369,13 +1369,13 @@ ecc_encrypt_raw (gcry_sexp_t *r_ciph, gcry_sexp_t s_data, gcry_sexp_t keyparms) - unsigned int rawmpilen; - - rc = 0; -- x = mpi_new (0); -+ x = mpi_new (ec->nbits); - if (ec->model == MPI_EC_MONTGOMERY) - y = NULL; - else -- y = mpi_new (0); -+ y = mpi_new (ec->nbits); - -- point_init (&R); -+ point_init (&R, ec->nbits); - - /* R = kQ <=> R = kdG */ - _gcry_mpi_ec_mul_point (&R, data, ec->Q, ec); -@@ -1478,11 +1478,12 @@ ecc_decrypt_raw (gcry_sexp_t *r_plain, gcry_sexp_t s_data, gcry_sexp_t keyparms) - int flags = GCRYECC_FLAG_LEAST_LEAK; - int enable_specific_point_validation; - -- point_init (&kG); -- point_init (&R); -+ nbits = ecc_get_nbits (keyparms); - -- _gcry_pk_util_init_encoding_ctx (&ctx, PUBKEY_OP_DECRYPT, -- (nbits = ecc_get_nbits (keyparms))); -+ point_init (&kG, nbits); -+ point_init (&R, nbits); -+ -+ _gcry_pk_util_init_encoding_ctx (&ctx, PUBKEY_OP_DECRYPT, nbits); - - /* - * Extract the key. -@@ -1564,11 +1565,11 @@ ecc_decrypt_raw (gcry_sexp_t *r_plain, gcry_sexp_t s_data, gcry_sexp_t keyparms) - { - gcry_mpi_t x, y; - -- x = mpi_new (0); -+ x = mpi_new (ec->nbits); - if (ec->model == MPI_EC_MONTGOMERY) - y = NULL; - else -- y = mpi_new (0); -+ y = mpi_new (ec->nbits); - - if (_gcry_mpi_ec_get_affine (x, y, &R, ec)) - { -@@ -1887,10 +1888,10 @@ compute_keygrip (gcry_md_hd_t md, gcry_sexp_t keyparms) - * Recover Y. The Weierstrass curve: y^2 = x^3 + a*x + b - */ - -- x3 = mpi_new (0); -- t = mpi_new (0); -- p1_4 = mpi_new (0); -- y = mpi_new (0); -+ x3 = mpi_new (ec->nbits); -+ t = mpi_new (ec->nbits); -+ p1_4 = mpi_new (ec->nbits); -+ y = mpi_new (ec->nbits); - - /* Compute right hand side. */ - mpi_powm (x3, x, mpi_const (MPI_C_THREE), ec->p); -diff --git a/mpi/ec-hw-s390x.c b/mpi/ec-hw-s390x.c -index 149a061d..d5d72a9b 100644 ---- a/mpi/ec-hw-s390x.c -+++ b/mpi/ec-hw-s390x.c -@@ -242,8 +242,8 @@ _gcry_s390x_ec_hw_mul_point (mpi_point_t result, gcry_mpi_t scalar, - if (!(pcc_query () & km_function_to_mask (pcc_func))) - return -1; /* HW does not support acceleration for this curve. */ - -- x = mpi_new (0); -- y = mpi_new (0); -+ x = mpi_new (ctx->nbits); -+ y = mpi_new (ctx->nbits); - - if (_gcry_mpi_ec_get_affine (x, y, point, ctx) < 0) - { -@@ -352,7 +352,7 @@ s390_mul_point_montgomery (mpi_point_t result, gcry_mpi_t scalar, - if (!(pcc_query () & km_function_to_mask (pcc_func))) - return -1; /* HW does not support acceleration for this curve. */ - -- x = mpi_new (0); -+ x = mpi_new (ctx->nbits); - - if (mpi_is_opaque (scalar)) - { -diff --git a/mpi/ec.c b/mpi/ec.c -index b0b6f427..1ab45594 100644 ---- a/mpi/ec.c -+++ b/mpi/ec.c -@@ -33,7 +33,7 @@ - - extern void reverse_buffer (unsigned char *buffer, unsigned int length); - --#define point_init(a) _gcry_mpi_point_init ((a)) -+#define point_init(a, nbits) _gcry_mpi_point_init ((a), (nbits)) - #define point_free(a) _gcry_mpi_point_free_parts ((a)) - - -@@ -55,8 +55,8 @@ _gcry_mpi_point_log (const char *name, mpi_point_t point, mpi_ec_t ctx) - - if (ctx) - { -- x = mpi_new (0); -- y = mpi_new (0); -+ x = mpi_new (ctx->nbits); -+ y = mpi_new (ctx->nbits); - } - if (!ctx || _gcry_mpi_ec_get_affine (x, y, point, ctx)) - { -@@ -90,10 +90,8 @@ _gcry_mpi_point_new (unsigned int nbits) - { - mpi_point_t p; - -- (void)nbits; /* Currently not used. */ -- - p = xmalloc (sizeof *p); -- _gcry_mpi_point_init (p); -+ _gcry_mpi_point_init (p, nbits); - return p; - } - -@@ -113,11 +111,11 @@ _gcry_mpi_point_release (mpi_point_t p) - /* Initialize the fields of a point object. gcry_mpi_point_free_parts - may be used to release the fields. */ - void --_gcry_mpi_point_init (mpi_point_t p) -+_gcry_mpi_point_init (mpi_point_t p, unsigned int nbits) - { -- p->x = mpi_new (0); -- p->y = mpi_new (0); -- p->z = mpi_new (0); -+ p->x = mpi_new (nbits); -+ p->y = mpi_new (nbits); -+ p->z = mpi_new (nbits); - } - - -@@ -1213,8 +1211,8 @@ _gcry_mpi_ec_get_affine (gcry_mpi_t x, gcry_mpi_t y, mpi_point_t point, - saved_flags = ctx->flags; - ctx->flags |= GCRYECC_FLAG_LEAST_LEAK; - -- z1 = mpi_new (0); -- z2 = mpi_new (0); -+ z1 = mpi_new (ctx->nbits); -+ z2 = mpi_new (ctx->nbits); - ec_invm (z1, point->z, ctx); /* z1 = z^(-1) mod p */ - ec_mulm_lli (z2, z1, z1, ctx); /* z2 = z^(-2) mod p */ - -@@ -1231,7 +1229,7 @@ _gcry_mpi_ec_get_affine (gcry_mpi_t x, gcry_mpi_t y, mpi_point_t point, - mpi_set (y, point->y); - mpi_resize (y, ctx->p->nlimbs); - y->nlimbs = ctx->p->nlimbs; -- z3 = mpi_new (0); -+ z3 = mpi_new (ctx->nbits); - ec_mulm_lli (z3, z2, z1, ctx); /* z3 = z^(-3) mod p */ - ec_mulm_lli (y, y, z3, ctx); - mpi_free (z3); -@@ -1271,7 +1269,7 @@ _gcry_mpi_ec_get_affine (gcry_mpi_t x, gcry_mpi_t y, mpi_point_t point, - return 0; - } - -- z = mpi_new (0); -+ z = mpi_new (ctx->nbits); - ec_invm (z, point->z, ctx); - - mpi_resize (z, ctx->p->nlimbs); -@@ -2113,10 +2111,10 @@ montgomery_mul_point (mpi_point_t result, - int scalar_copied = 0; - - nbits = mpi_get_nbits (scalar); -- point_init (&p1); -- point_init (&p2); -- point_init (&p1_); -- point_init (&p2_); -+ point_init (&p1, ctx->nbits); -+ point_init (&p2, ctx->nbits); -+ point_init (&p1_, ctx->nbits); -+ point_init (&p2_, ctx->nbits); - mpi_set_ui (p1.x, 1); - mpi_free (p2.x); - p2.x = mpi_copy (point->x); -@@ -2186,7 +2184,7 @@ montgomery_mul_point (mpi_point_t result, - } - else - { -- z1 = mpi_new (0); -+ z1 = mpi_new (ctx->nbits); - ec_invm (z1, p1.z, ctx); - ec_mulm (result->x, p1.x, z1, ctx); - mpi_set_ui (result->z, 1); -@@ -2218,13 +2216,13 @@ mpi_ec_mul_point_lli (mpi_point_t result, - - /* Convert POINT1 into affine coordinate, so that we can use - add_points_*_a routine with affine coordinate. */ -- point_init (point); -+ point_init (point, ctx->nbits); - if (_gcry_mpih_cmp_ui (point1->z->d, ctx->p->nlimbs, 1)) - { - gcry_mpi_t x, y; - -- x = mpi_new (0); -- y = mpi_new (0); -+ x = mpi_new (ctx->nbits); -+ y = mpi_new (ctx->nbits); - - if (_gcry_mpi_ec_get_affine (x, y, point1, ctx)) - { -@@ -2263,7 +2261,7 @@ mpi_ec_mul_point_lli (mpi_point_t result, - mpi_set_ui (result->z, 1); - } - -- point_init (&tmppnt); -+ point_init (&tmppnt, ctx->nbits); - mpi_point_resize (result, ctx); - mpi_point_resize (&tmppnt, ctx); - if (ctx->model == MPI_EC_WEIERSTRASS) -@@ -2420,8 +2418,8 @@ _gcry_mpi_ec_mul_point (mpi_point_t result, - p1.x = x1; x1 = NULL; - p1.y = y1; y1 = NULL; - p1.z = z1; z1 = NULL; -- point_init (&p2); -- point_init (&p1inv); -+ point_init (&p2, ctx->nbits); -+ point_init (&p1inv, ctx->nbits); - - /* Invert point: y = p - y mod p */ - point_set (&p1inv, &p1); -@@ -2457,9 +2455,9 @@ _gcry_mpi_ec_curve_point (gcry_mpi_point_t point, mpi_ec_t ctx) - int res = 0; - gcry_mpi_t x, y, w; - -- x = mpi_new (0); -- y = mpi_new (0); -- w = mpi_new (0); -+ x = mpi_new (ctx->nbits); -+ y = mpi_new (ctx->nbits); -+ w = mpi_new (ctx->nbits); - - /* Check that the point is in range. This needs to be done here and - * not after conversion to affine coordinates. */ -@@ -2479,7 +2477,7 @@ _gcry_mpi_ec_curve_point (gcry_mpi_point_t point, mpi_ec_t ctx) - if (_gcry_mpi_ec_get_affine (x, y, point, ctx)) - goto leave; - -- xxx = mpi_new (0); -+ xxx = mpi_new (ctx->nbits); - - /* y^2 == x^3 + a·x + b */ - ec_pow2 (y, y, ctx); -diff --git a/src/mpi.h b/src/mpi.h -index 2a314a21..0edbda52 100644 ---- a/src/mpi.h -+++ b/src/mpi.h -@@ -243,7 +243,7 @@ struct gcry_mpi_point - typedef struct gcry_mpi_point mpi_point_struct; - typedef struct gcry_mpi_point *mpi_point_t; - --void _gcry_mpi_point_init (mpi_point_t p); -+void _gcry_mpi_point_init (mpi_point_t p, unsigned int nbits); - void _gcry_mpi_point_free_parts (mpi_point_t p); - void _gcry_mpi_get_point (gcry_mpi_t x, gcry_mpi_t y, gcry_mpi_t z, - mpi_point_t point); diff --git a/dev-libs/libgcrypt/files/0001-rijndael-vaes-avx512-add-PIC-PLT-for-AVX2-function-j.patch b/dev-libs/libgcrypt/files/0001-rijndael-vaes-avx512-add-PIC-PLT-for-AVX2-function-j.patch deleted file mode 100644 index 344277940841d..0000000000000 --- a/dev-libs/libgcrypt/files/0001-rijndael-vaes-avx512-add-PIC-PLT-for-AVX2-function-j.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 927850875c6254282697dbbed8aff65275bdeff5 Mon Sep 17 00:00:00 2001 -Message-ID: <927850875c6254282697dbbed8aff65275bdeff5.1770174288.git.sam@gentoo.org> -From: Jussi Kivilinna -Date: Sun, 1 Feb 2026 09:50:50 +0200 -Subject: [PATCH 1/2] rijndael-vaes-avx512: add PIC @PLT for AVX2 function - jumps - -* cipher/asm-common-amd64.h (AT_PLT): New. -* cipher/rijndael-vaes-avx512-amd64.S: Use AT_PLT for jumps to -AVX2/VAES functions. --- - -GnuPG-bug-id: 8071 -Signed-off-by: Jussi Kivilinna ---- - cipher/asm-common-amd64.h | 6 ++++++ - cipher/rijndael-vaes-avx512-amd64.S | 14 +++++++------- - 2 files changed, 13 insertions(+), 7 deletions(-) - -diff --git a/cipher/asm-common-amd64.h b/cipher/asm-common-amd64.h -index 465ef62b..d0cc6426 100644 ---- a/cipher/asm-common-amd64.h -+++ b/cipher/asm-common-amd64.h -@@ -53,6 +53,12 @@ - # define ADD_RIP - #endif - -+#ifdef __PIC__ -+# define AT_PLT ELF(@PLT) -+#else -+# define AT_PLT -+#endif -+ - #if defined(HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS) || !defined(__PIC__) - # define GET_EXTERN_POINTER(name, reg) movabsq $name, reg - #else -diff --git a/cipher/rijndael-vaes-avx512-amd64.S b/cipher/rijndael-vaes-avx512-amd64.S -index b7dba5e3..f20998b0 100644 ---- a/cipher/rijndael-vaes-avx512-amd64.S -+++ b/cipher/rijndael-vaes-avx512-amd64.S -@@ -277,7 +277,7 @@ _gcry_vaes_avx512_cbc_dec_amd64: - .Lcbc_dec_skip_avx512: - /* Handle trailing blocks with AVX2 implementation. */ - cmpq $0, %r8; -- ja _gcry_vaes_avx2_cbc_dec_amd64; -+ ja _gcry_vaes_avx2_cbc_dec_amd64 AT_PLT; - - ret_spec_stop - CFI_ENDPROC(); -@@ -491,7 +491,7 @@ _gcry_vaes_avx512_cfb_dec_amd64: - .Lcfb_dec_skip_avx512: - /* Handle trailing blocks with AVX2 implementation. */ - cmpq $0, %r8; -- ja _gcry_vaes_avx2_cfb_dec_amd64; -+ ja _gcry_vaes_avx2_cfb_dec_amd64 AT_PLT; - - ret_spec_stop - CFI_ENDPROC(); -@@ -813,7 +813,7 @@ _gcry_vaes_avx512_ctr_enc_amd64: - .Lctr_enc_skip_avx512: - /* Handle trailing blocks with AVX2 implementation. */ - cmpq $0, %r8; -- ja _gcry_vaes_avx2_ctr_enc_amd64; -+ ja _gcry_vaes_avx2_ctr_enc_amd64 AT_PLT; - - ret_spec_stop - CFI_ENDPROC(); -@@ -1037,7 +1037,7 @@ _gcry_vaes_avx512_ctr32le_enc_amd64: - .Lctr32le_enc_skip_avx512: - /* Handle trailing blocks with AVX2 implementation. */ - cmpq $0, %r8; -- ja _gcry_vaes_avx2_ctr32le_enc_amd64; -+ ja _gcry_vaes_avx2_ctr32le_enc_amd64 AT_PLT; - - ret_spec_stop - CFI_ENDPROC(); -@@ -1721,7 +1721,7 @@ _gcry_vaes_avx512_ocb_aligned_crypt_amd64: - .Locb_skip_avx512: - /* Handle trailing blocks with AVX2 implementation. */ - cmpq $0, %r8; -- ja _gcry_vaes_avx2_ocb_crypt_amd64; -+ ja _gcry_vaes_avx2_ocb_crypt_amd64 AT_PLT; - - xorl %eax, %eax; - ret_spec_stop -@@ -2084,7 +2084,7 @@ _gcry_vaes_avx512_xts_crypt_amd64: - .Lxts_crypt_skip_avx512: - /* Handle trailing blocks with AVX2 implementation. */ - cmpq $0, %r8; -- ja _gcry_vaes_avx2_xts_crypt_amd64; -+ ja _gcry_vaes_avx2_xts_crypt_amd64 AT_PLT; - - ret_spec_stop - CFI_ENDPROC(); -@@ -2347,7 +2347,7 @@ _gcry_vaes_avx512_ecb_crypt_amd64: - .Lecb_crypt_skip_avx512: - /* Handle trailing blocks with AVX2 implementation. */ - cmpq $0, %r8; -- ja _gcry_vaes_avx2_ecb_crypt_amd64; -+ ja _gcry_vaes_avx2_ecb_crypt_amd64 AT_PLT; - - ret_spec_stop - CFI_ENDPROC(); --- -2.53.0 - diff --git a/dev-libs/libgcrypt/files/0002-mpi-ec-Don-t-modify-POINT-in-_gcry_mpi_ec_get_affine.patch b/dev-libs/libgcrypt/files/0002-mpi-ec-Don-t-modify-POINT-in-_gcry_mpi_ec_get_affine.patch deleted file mode 100644 index 282faf989e950..0000000000000 --- a/dev-libs/libgcrypt/files/0002-mpi-ec-Don-t-modify-POINT-in-_gcry_mpi_ec_get_affine.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 949557945cf806dfbc646c8919a398ae637f7c25 Mon Sep 17 00:00:00 2001 -Message-ID: <949557945cf806dfbc646c8919a398ae637f7c25.1770174288.git.sam@gentoo.org> -In-Reply-To: <927850875c6254282697dbbed8aff65275bdeff5.1770174288.git.sam@gentoo.org> -References: <927850875c6254282697dbbed8aff65275bdeff5.1770174288.git.sam@gentoo.org> -From: NIIBE Yutaka -Date: Tue, 3 Feb 2026 15:10:41 +0900 -Subject: [PATCH 2/2] mpi:ec: Don't modify POINT in _gcry_mpi_ec_get_affine. - -* mpi/ec.c (_gcry_mpi_ec_get_affine): Don't modify POINT. - --- - -GnuPG-bug-id: 8080 -Signed-off-by: NIIBE Yutaka ---- - mpi/ec.c | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/mpi/ec.c b/mpi/ec.c -index d7bad4a6..b0b6f427 100644 ---- a/mpi/ec.c -+++ b/mpi/ec.c -@@ -1220,18 +1220,20 @@ _gcry_mpi_ec_get_affine (gcry_mpi_t x, gcry_mpi_t y, mpi_point_t point, - - if (x) - { -- mpi_resize (point->x, ctx->p->nlimbs); -- point->x->nlimbs = ctx->p->nlimbs; -- ec_mulm_lli (x, point->x, z2, ctx); -+ mpi_set (x, point->x); -+ mpi_resize (x, ctx->p->nlimbs); -+ x->nlimbs = ctx->p->nlimbs; -+ ec_mulm_lli (x, x, z2, ctx); - } - - if (y) - { -- mpi_resize (point->y, ctx->p->nlimbs); -- point->y->nlimbs = ctx->p->nlimbs; -+ mpi_set (y, point->y); -+ mpi_resize (y, ctx->p->nlimbs); -+ y->nlimbs = ctx->p->nlimbs; - z3 = mpi_new (0); - ec_mulm_lli (z3, z2, z1, ctx); /* z3 = z^(-3) mod p */ -- ec_mulm_lli (y, point->y, z3, ctx); -+ ec_mulm_lli (y, y, z3, ctx); - mpi_free (z3); - } - --- -2.53.0 - diff --git a/dev-libs/libgcrypt/files/0002-mpi-ec-Use-mpi_new-with-NBITS-instead-of-mpi_alloc.patch b/dev-libs/libgcrypt/files/0002-mpi-ec-Use-mpi_new-with-NBITS-instead-of-mpi_alloc.patch deleted file mode 100644 index 1afc3892e5f2c..0000000000000 --- a/dev-libs/libgcrypt/files/0002-mpi-ec-Use-mpi_new-with-NBITS-instead-of-mpi_alloc.patch +++ /dev/null @@ -1,89 +0,0 @@ -diff --git a/cipher/ecc-ecdsa.c b/cipher/ecc-ecdsa.c -index 34f2903b..d91922d0 100644 ---- a/cipher/ecc-ecdsa.c -+++ b/cipher/ecc-ecdsa.c -@@ -85,10 +85,10 @@ _gcry_ecc_ecdsa_sign (gcry_mpi_t input, gcry_mpi_t k_supplied, mpi_ec_t ec, - while (!mpi_invm (bi, b, ec->n)); - - k = NULL; -- dr = mpi_alloc (0); -- sum = mpi_alloc (0); -- k_1 = mpi_alloc (0); -- x = mpi_alloc (0); -+ dr = mpi_new (ec->nbits); -+ sum = mpi_new (ec->nbits); -+ k_1 = mpi_new (ec->nbits); -+ x = mpi_new (ec->nbits); - point_init (&I, ec->nbits); - - /* Two loops to avoid R or S are zero. This is more of a joke than -@@ -264,10 +264,10 @@ _gcry_ecc_ecdsa_verify (gcry_mpi_t input, mpi_ec_t ec, - return err; - } - -- h = mpi_alloc (0); -- h1 = mpi_alloc (0); -- h2 = mpi_alloc (0); -- x = mpi_alloc (0); -+ h = mpi_new (ec->nbits); -+ h1 = mpi_new (ec->nbits); -+ h2 = mpi_new (ec->nbits); -+ x = mpi_new (ec->nbits); - point_init (&Q, ec->nbits); - point_init (&Q1, ec->nbits); - point_init (&Q2, ec->nbits); -diff --git a/cipher/ecc-gost.c b/cipher/ecc-gost.c -index 179660fa..455d529e 100644 ---- a/cipher/ecc-gost.c -+++ b/cipher/ecc-gost.c -@@ -58,11 +58,11 @@ _gcry_ecc_gost_sign (gcry_mpi_t input, mpi_ec_t ec, - return rc; - - k = NULL; -- dr = mpi_alloc (0); -- sum = mpi_alloc (0); -- ke = mpi_alloc (0); -- e = mpi_alloc (0); -- x = mpi_alloc (0); -+ dr = mpi_new (ec->nbits); -+ sum = mpi_new (ec->nbits); -+ ke = mpi_new (ec->nbits); -+ e = mpi_new (ec->nbits); -+ x = mpi_new (ec->nbits); - point_init (&I, ec->nbits); - - mpi_mod (e, input, ec->n); /* e = hash mod n */ -@@ -140,13 +140,13 @@ _gcry_ecc_gost_verify (gcry_mpi_t input, mpi_ec_t ec, - if( !(mpi_cmp_ui (s, 0) > 0 && mpi_cmp (s, ec->n) < 0) ) - return GPG_ERR_BAD_SIGNATURE; /* Assertion 0 < s < n failed. */ - -- x = mpi_alloc (0); -- e = mpi_alloc (0); -- z1 = mpi_alloc (0); -- z2 = mpi_alloc (0); -- v = mpi_alloc (0); -- rv = mpi_alloc (0); -- zero = mpi_alloc (0); -+ x = mpi_new (ec->nbits); -+ e = mpi_new (ec->nbits); -+ z1 = mpi_new (ec->nbits); -+ z2 = mpi_new (ec->nbits); -+ v = mpi_new (ec->nbits); -+ rv = mpi_new (ec->nbits); -+ zero = mpi_new (ec->nbits); - - point_init (&Q, ec->nbits); - point_init (&Q1, ec->nbits); -diff --git a/mpi/ec.c b/mpi/ec.c -index 1ab45594..6f6a7f8d 100644 ---- a/mpi/ec.c -+++ b/mpi/ec.c -@@ -827,7 +827,7 @@ ec_get_two_inv_p (mpi_ec_t ec) - { - ec->t.valid.two_inv_p = 1; - if (!ec->t.two_inv_p) -- ec->t.two_inv_p = mpi_alloc (0); -+ ec->t.two_inv_p = mpi_new (ec->nbits); - ec_invm (ec->t.two_inv_p, mpi_const (MPI_C_TWO), ec); - } - return ec->t.two_inv_p; diff --git a/dev-libs/libgcrypt/files/0003-cipher-ecc-Fix-Weierstrass-curve-with-PUBKEY_FLAG_PA.patch b/dev-libs/libgcrypt/files/0003-cipher-ecc-Fix-Weierstrass-curve-with-PUBKEY_FLAG_PA.patch deleted file mode 100644 index 03e9ebc28c375..0000000000000 --- a/dev-libs/libgcrypt/files/0003-cipher-ecc-Fix-Weierstrass-curve-with-PUBKEY_FLAG_PA.patch +++ /dev/null @@ -1,80 +0,0 @@ ->From 07efee1de2dac1b2a6ce29698b2abec9dd1f6820 Mon Sep 17 00:00:00 2001 -Message-ID: <07efee1de2dac1b2a6ce29698b2abec9dd1f6820.1771055590.git.gniibe@fsij.org> -In-Reply-To: <43b648f0465fb449471944a84bb40f45996f6de3.1771055590.git.gniibe@fsij.org> -References: <43b648f0465fb449471944a84bb40f45996f6de3.1771055590.git.gniibe@fsij.org> -From: NIIBE Yutaka -Date: Sat, 14 Feb 2026 16:49:05 +0900 -Subject: [PATCH 3/3] cipher:ecc: Fix Weierstrass curve with PUBKEY_FLAG_PARAM. -To: gcrypt-devel@gnupg.org -MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary="------------2.47.3" - -This is a multi-part message in MIME format. ---------------2.47.3 -Content-Type: text/plain; charset=UTF-8; format=fixed -Content-Transfer-Encoding: 8bit - - -* cipher/ecc-curves.c (point_from_keyparam): Handle the case where -EC==NULL. -* cipher/ecc-misc.c (_gcry_ecc_sec_decodepoint): Care about -EC==NULL. - --- - -GnuPG-bug-id: 8094 -Signed-off-by: NIIBE Yutaka ---- - cipher/ecc-curves.c | 6 +++++- - cipher/ecc-misc.c | 4 ++-- - 2 files changed, 7 insertions(+), 3 deletions(-) - - ---------------2.47.3 -Content-Type: text/x-patch; name="0003-cipher-ecc-Fix-Weierstrass-curve-with-PUBKEY_FLAG_PA.patch" -Content-Transfer-Encoding: 8bit -Content-Disposition: attachment; filename="0003-cipher-ecc-Fix-Weierstrass-curve-with-PUBKEY_FLAG_PA.patch" - -diff --git a/cipher/ecc-curves.c b/cipher/ecc-curves.c -index 5478e69d..08b374d5 100644 ---- a/cipher/ecc-curves.c -+++ b/cipher/ecc-curves.c -@@ -991,7 +991,11 @@ point_from_keyparam (gcry_mpi_point_t *r_a, - if (!a) - return GPG_ERR_INV_OBJ; - -- point = mpi_point_new (ec->nbits); -+ /* NOTE: EC may be NULL, when it's for Weierstrass curve for -+ * parameter "g". And it's OK for _gcry_mpi_ec_decode_point -+ * (and _gcry_ecc_sec_decodepoint) to be called with EC=NULL. -+ */ -+ point = mpi_point_new (ec? ec->nbits: 0); - rc = _gcry_mpi_ec_decode_point (point, a, ec); - mpi_free (a); - if (rc) -diff --git a/cipher/ecc-misc.c b/cipher/ecc-misc.c -index 40303ac4..615b0df2 100644 ---- a/cipher/ecc-misc.c -+++ b/cipher/ecc-misc.c -@@ -176,7 +176,7 @@ _gcry_mpi_ec_ec2os (gcry_mpi_point_t point, mpi_ec_t ec) - RESULT must have been initialized and is set on success to the - point given by VALUE. */ - gpg_err_code_t --_gcry_ecc_sec_decodepoint (gcry_mpi_t value, mpi_ec_t ec, mpi_point_t result) -+_gcry_ecc_sec_decodepoint (gcry_mpi_t value, mpi_ec_t ec, mpi_point_t result) - { - gpg_err_code_t rc; - size_t n; -@@ -220,7 +220,7 @@ _gcry_ecc_sec_decodepoint (gcry_mpi_t value, mpi_ec_t ec, mpi_point_t result) - gcry_mpi_t p1_4; - int y_bit = (*buf == 3); - -- if (!mpi_test_bit (ec->p, 1)) -+ if (ec == NULL || !mpi_test_bit (ec->p, 1)) - { - xfree (buf_memory); - return GPG_ERR_NOT_IMPLEMENTED; /* No support for point compression. */ - ---------------2.47.3-- - -