]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
nettle: remove files no longer used
authorDaiki Ueno <ueno@gnu.org>
Thu, 11 May 2023 13:13:25 +0000 (22:13 +0900)
committerDaiki Ueno <ueno@gnu.org>
Thu, 11 May 2023 13:13:25 +0000 (22:13 +0900)
Signed-off-by: Daiki Ueno <ueno@gnu.org>
lib/nettle/ecc-gost-curve.h [deleted file]
lib/nettle/gost/ecc-gost-hash.c [deleted file]
lib/nettle/gost/gost-point-mul-g.c [deleted file]
lib/nettle/gost/gost-point.c [deleted file]
lib/nettle/gost/gostdsa-keygen.c [deleted file]
lib/nettle/nettle-alloca.h [deleted file]

diff --git a/lib/nettle/ecc-gost-curve.h b/lib/nettle/ecc-gost-curve.h
deleted file mode 100644 (file)
index 7e53ab4..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/* ecc-gost-curve.h
-
-   Copyright (C) 2013 Niels Möller
-
-   This file is part of GNU Nettle.
-
-   GNU Nettle is free software: you can redistribute it and/or
-   modify it under the terms of either:
-
-     * the GNU Lesser General Public License as published by the Free
-       Software Foundation; either version 3 of the License, or (at your
-       option) any later version.
-
-   or
-
-     * the GNU General Public License as published by the Free
-       Software Foundation; either version 2 of the License, or (at your
-       option) any later version.
-
-   or both in parallel, as here.
-
-   GNU Nettle is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received copies of the GNU General Public License and
-   the GNU Lesser General Public License along with this program.  If
-   not, see https://www.gnu.org/licenses/.
-*/
-
-/* Development of Nettle's ECC support was funded by the .SE Internet Fund. */
-
-#ifndef GNUTLS_LIB_NETTLE_GOST_ECC_GOST_CURVE_H
-#define GNUTLS_LIB_NETTLE_GOST_ECC_GOST_CURVE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* The contents of this struct is internal. */
-struct ecc_curve;
-
-#ifndef NETTLE_PURE
-#ifdef __GNUC__
-#define NETTLE_PURE __attribute__((pure))
-#else
-#define NETTLE_PURE
-#endif
-#endif
-
-#define gost_point_mul_g _gnutls_nettle_ecc_gost_point_mul_g
-#define gost_point_set _gnutls_nettle_ecc_gost_point_set
-#define gostdsa_generate_keypair _gnutls_nettle_ecc_gostdsa_generate_keypair
-void gost_point_mul_g(struct ecc_point *r, const struct ecc_scalar *n);
-int gost_point_set(struct ecc_point *p, const mpz_t x, const mpz_t y);
-void gostdsa_generate_keypair(struct ecc_point *pub, struct ecc_scalar *key,
-                             void *random_ctx, nettle_random_func *random);
-
-#define nettle_get_gost_gc256b _gnutls_nettle_ecc_get_gost_gc256b
-#define nettle_get_gost_gc512a _gnutls_nettle_ecc_get_gost_gc512a
-const struct ecc_curve *NETTLE_PURE nettle_get_gost_gc256b(void);
-const struct ecc_curve *NETTLE_PURE nettle_get_gost_gc512a(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* GNUTLS_LIB_NETTLE_GOST_ECC_GOST_CURVE_H */
diff --git a/lib/nettle/gost/ecc-gost-hash.c b/lib/nettle/gost/ecc-gost-hash.c
deleted file mode 100644 (file)
index 5202a89..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/* ecdsa-hash.c
-
-   Copyright (C) 2013 Niels Möller
-
-   This file is part of GNU Nettle.
-
-   GNU Nettle is free software: you can redistribute it and/or
-   modify it under the terms of either:
-
-     * the GNU Lesser General Public License as published by the Free
-       Software Foundation; either version 3 of the License, or (at your
-       option) any later version.
-
-   or
-
-     * the GNU General Public License as published by the Free
-       Software Foundation; either version 2 of the License, or (at your
-       option) any later version.
-
-   or both in parallel, as here.
-
-   GNU Nettle is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received copies of the GNU General Public License and
-   the GNU Lesser General Public License along with this program.  If
-   not, see https://www.gnu.org/licenses/.
-*/
-
-/* Development of Nettle's ECC support was funded by the .SE Internet Fund. */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gnutls_int.h>
-
-#include "ecc/ecc-internal.h"
-
-/* Convert hash value to an integer. If the digest is larger than
-   the ecc bit size, then we must truncate it and use the leftmost
-   bits. */
-
-/* NOTE: We don't considered the hash value to be secret, so it's ok
-   if the running time of this conversion depends on h.
-
-   Requires m->size + 1 limbs, the extra limb may be needed for
-   unusual limb sizes.
-*/
-
-void gost_hash(const struct ecc_modulo *m, mp_limb_t *hp, size_t length,
-              const uint8_t *digest)
-{
-       if (length > ((size_t)m->bit_size + 7) / 8)
-               length = (m->bit_size + 7) / 8;
-
-       mpn_set_base256_le(hp, m->size + 1, digest, length);
-
-       if (8 * length > m->bit_size)
-               /* We got a few extra bits, at the low end. Discard them. */
-               mpn_rshift(hp, hp, m->size + 1, 8 * length - m->bit_size);
-}
diff --git a/lib/nettle/gost/gost-point-mul-g.c b/lib/nettle/gost/gost-point-mul-g.c
deleted file mode 100644 (file)
index 2909d6e..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/* ecc-point-mul-g.c
-
-   Copyright (C) 2013 Niels Möller
-
-   This file is part of GNU Nettle.
-
-   GNU Nettle is free software: you can redistribute it and/or
-   modify it under the terms of either:
-
-     * the GNU Lesser General Public License as published by the Free
-       Software Foundation; either version 3 of the License, or (at your
-       option) any later version.
-
-   or
-
-     * the GNU General Public License as published by the Free
-       Software Foundation; either version 2 of the License, or (at your
-       option) any later version.
-
-   or both in parallel, as here.
-
-   GNU Nettle is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received copies of the GNU General Public License and
-   the GNU Lesser General Public License along with this program.  If
-   not, see https://www.gnu.org/licenses/.
-*/
-
-/* Development of Nettle's ECC support was funded by the .SE Internet Fund. */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <assert.h>
-
-#include <nettle/ecc.h>
-#include "ecc/ecc-internal.h"
-#include "ecc-gost-curve.h"
-
-void gost_point_mul_g(struct ecc_point *r, const struct ecc_scalar *n)
-{
-       const struct ecc_curve *ecc = r->ecc;
-       mp_limb_t size = ecc->p.size;
-       mp_size_t itch = 3 * size + ecc->mul_g_itch;
-       mp_limb_t *scratch = gmp_alloc_limbs(itch);
-
-       assert(n->ecc == ecc);
-       assert(ecc->h_to_a_itch <= ecc->mul_g_itch);
-
-       ecc->mul_g(ecc, scratch, n->p, scratch + 3 * size);
-       ecc->h_to_a(ecc, 0, r->p, scratch, scratch + 3 * size);
-       gmp_free_limbs(scratch, itch);
-}
diff --git a/lib/nettle/gost/gost-point.c b/lib/nettle/gost/gost-point.c
deleted file mode 100644 (file)
index ecbfb53..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/* ecc-point.c
-
-   Copyright (C) 2013, 2014 Niels Möller
-
-   This file is part of GNU Nettle.
-
-   GNU Nettle is free software: you can redistribute it and/or
-   modify it under the terms of either:
-
-     * the GNU Lesser General Public License as published by the Free
-       Software Foundation; either version 3 of the License, or (at your
-       option) any later version.
-
-   or
-
-     * the GNU General Public License as published by the Free
-       Software Foundation; either version 2 of the License, or (at your
-       option) any later version.
-
-   or both in parallel, as here.
-
-   GNU Nettle is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received copies of the GNU General Public License and
-   the GNU Lesser General Public License along with this program.  If
-   not, see https://www.gnu.org/licenses/.
-*/
-
-/* Development of Nettle's ECC support was funded by the .SE Internet Fund. */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <nettle/ecc.h>
-#include "ecc/ecc-internal.h"
-#include "ecc-gost-curve.h"
-
-int gost_point_set(struct ecc_point *p, const mpz_t x, const mpz_t y)
-{
-       mp_size_t size;
-       mpz_t lhs, rhs;
-       mpz_t t;
-       int res;
-
-       size = p->ecc->p.size;
-
-       if (mpz_sgn(x) < 0 || mpz_limbs_cmp(x, p->ecc->p.m, size) >= 0 ||
-           mpz_sgn(y) < 0 || mpz_limbs_cmp(y, p->ecc->p.m, size) >= 0)
-               return 0;
-
-       mpz_init(lhs);
-       mpz_init(rhs);
-
-       mpz_mul(lhs, y, y);
-
-       if (p->ecc->p.bit_size == 255) {
-               /* ed25519 special case. FIXME: Do in some cleaner way? */
-               mpz_t x2;
-               mpz_init(x2);
-               mpz_mul(x2, x, x);
-               mpz_mul(rhs, x2, lhs);
-               /* Check that -x^2 + y^2 = 1 - (121665/121666) x^2 y^2
-                  or 121666 (1 + x^2 - y^2) = 121665 x^2 y^2 */
-               mpz_sub(lhs, x2, lhs);
-               mpz_add_ui(lhs, lhs, 1);
-               mpz_mul_ui(lhs, lhs, 121666);
-               mpz_mul_ui(rhs, rhs, 121665);
-               mpz_clear(x2);
-       } else if (p->ecc->p.bit_size == 448) {
-               /* curve448 special case. FIXME: Do in some cleaner way? */
-               mpz_t x2, d;
-               mpz_init(x2);
-               mpz_init_set_ui(d, 39081);
-               mpz_mul(x2, x, x); /* x^2 */
-               mpz_mul(d, d, x2); /* 39081 x^2 */
-               mpz_set_ui(rhs, 1);
-               mpz_submul(rhs, d, lhs); /* 1 - 39081 x^2 y^2 */
-               /* Check that x^2 + y^2 = 1 - 39081 x^2 y^2 */
-               mpz_add(lhs, x2, lhs); /* x^2 + y^2 */
-               mpz_clear(d);
-               mpz_clear(x2);
-       } else {
-               /* Check that y^2 = x^3 - 3*x + b (mod p) */
-               mpz_mul(rhs, x, x);
-               mpz_sub_ui(rhs, rhs, 3);
-               mpz_mul(rhs, rhs, x);
-               mpz_add(rhs, rhs, mpz_roinit_n(t, p->ecc->b, size));
-       }
-
-       res = mpz_congruent_p(lhs, rhs, mpz_roinit_n(t, p->ecc->p.m, size));
-
-       mpz_clear(lhs);
-       mpz_clear(rhs);
-
-       if (!res)
-               return 0;
-
-       mpz_limbs_copy(p->p, x, size);
-       mpz_limbs_copy(p->p + size, y, size);
-
-       return 1;
-}
diff --git a/lib/nettle/gost/gostdsa-keygen.c b/lib/nettle/gost/gostdsa-keygen.c
deleted file mode 100644 (file)
index 1e9339c..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ecdsa-keygen.c
-
-   Copyright (C) 2013 Niels Möller
-
-   This file is part of GNU Nettle.
-
-   GNU Nettle is free software: you can redistribute it and/or
-   modify it under the terms of either:
-
-     * the GNU Lesser General Public License as published by the Free
-       Software Foundation; either version 3 of the License, or (at your
-       option) any later version.
-
-   or
-
-     * the GNU General Public License as published by the Free
-       Software Foundation; either version 2 of the License, or (at your
-       option) any later version.
-
-   or both in parallel, as here.
-
-   GNU Nettle is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received copies of the GNU General Public License and
-   the GNU Lesser General Public License along with this program.  If
-   not, see https://www.gnu.org/licenses/.
-*/
-
-/* Development of Nettle's ECC support was funded by the .SE Internet Fund. */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include <nettle/ecc.h>
-#include "ecc/ecc-internal.h"
-#include "ecc-gost-curve.h"
-#include "nettle-alloca.h"
-
-void gostdsa_generate_keypair(struct ecc_point *pub, struct ecc_scalar *key,
-                             void *random_ctx, nettle_random_func *random)
-{
-       TMP_DECL(p, mp_limb_t, 3 * ECC_MAX_SIZE + ECC_MUL_G_ITCH(ECC_MAX_SIZE));
-       const struct ecc_curve *ecc = pub->ecc;
-       mp_size_t itch = 3 * ecc->p.size + ecc->mul_g_itch;
-
-       assert(key->ecc == ecc);
-       assert(ecc->h_to_a_itch <= ecc->mul_g_itch);
-
-       TMP_ALLOC(p, itch);
-
-       ecc_mod_random(&ecc->q, key->p, random_ctx, random, p);
-       ecc->mul_g(ecc, p, key->p, p + 3 * ecc->p.size);
-       ecc->h_to_a(ecc, 0, pub->p, p, p + 3 * ecc->p.size);
-}
diff --git a/lib/nettle/nettle-alloca.h b/lib/nettle/nettle-alloca.h
deleted file mode 100644 (file)
index 96cf026..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* nettle-internal.h
-
-   Things that are used only by the testsuite and benchmark, and
-   not included in the library.
-
-   Copyright (C) 2002, 2014 Niels Möller
-
-   This file is part of GNU Nettle.
-
-   GNU Nettle is free software: you can redistribute it and/or
-   modify it under the terms of either:
-
-     * the GNU Lesser General Public License as published by the Free
-       Software Foundation; either version 3 of the License, or (at your
-       option) any later version.
-
-   or
-
-     * the GNU General Public License as published by the Free
-       Software Foundation; either version 2 of the License, or (at your
-       option) any later version.
-
-   or both in parallel, as here.
-
-   GNU Nettle is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received copies of the GNU General Public License and
-   the GNU Lesser General Public License along with this program.  If
-   not, see https://www.gnu.org/licenses/.
-*/
-
-#ifndef GNUTLS_LIB_NETTLE_GOST_NETTLE_INTERNAL_H
-#define GNUTLS_LIB_NETTLE_GOST_NETTLE_INTERNAL_H
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/* Temporary allocation, for systems that don't support alloca. Note
- * that the allocation requests should always be reasonably small, so
- * that they can fit on the stack. For non-alloca systems, we use a
- * fix maximum size, and abort if we ever need anything larger. */
-
-#if HAVE_ALLOCA
-#include <alloca.h>
-#define TMP_DECL(name, type, max) type *name
-#define TMP_ALLOC(name, size) (name = alloca(sizeof(*name) * (size)))
-#else /* !HAVE_ALLOCA */
-#define TMP_DECL(name, type, max) type name[max]
-#define TMP_ALLOC(name, size)                                  \
-       do {                                                   \
-               if ((size) > (sizeof(name) / sizeof(name[0]))) \
-                       abort();                               \
-       } while (0)
-#endif
-
-#endif /* GNUTLS_LIB_NETTLE_GOST_NETTLE_INTERNAL_H */