gnutls-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gnutls branch, master, updated. gnutls_2_99_1-104-g19288b5


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_2_99_1-104-g19288b5
Date: Thu, 26 May 2011 16:37:26 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".

http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=19288b5d88ae012bf0db145a28f2eaccea72a6cf

The branch, master has been updated
       via  19288b5d88ae012bf0db145a28f2eaccea72a6cf (commit)
       via  d2571136136784dfbfc1c4f93eddcb35ca8e045e (commit)
       via  3ca0890658c9359a271bfe9ce4eaf83531cde6da (commit)
      from  8697eeefc3a887671323974687b9db52e9075c19 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 19288b5d88ae012bf0db145a28f2eaccea72a6cf
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Thu May 26 14:10:01 2011 +0200

    Use nettle's functions for integer import/export.

commit d2571136136784dfbfc1c4f93eddcb35ca8e045e
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Thu May 26 18:33:17 2011 +0200

    more updates for ECDSA ciphersuites.

commit 3ca0890658c9359a271bfe9ce4eaf83531cde6da
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Thu May 26 18:31:02 2011 +0200

    reduced debugging.

-----------------------------------------------------------------------

Summary of changes:
 lib/algorithms/publickey.c     |    1 +
 lib/ext/ecc.c                  |    1 -
 lib/gnutls_sig.c               |    1 +
 lib/nettle/Makefile.am         |    2 +-
 lib/nettle/ecc.h               |    4 +---
 lib/nettle/ecc_make_key.c      |    9 +++------
 lib/nettle/ecc_shared_secret.c |   10 ++--------
 lib/nettle/ecc_sign_hash.c     |    7 ++-----
 lib/nettle/ecc_verify_hash.c   |    6 +-----
 lib/nettle/mp_unsigned_bin.c   |   28 ----------------------------
 10 files changed, 12 insertions(+), 57 deletions(-)
 delete mode 100644 lib/nettle/mp_unsigned_bin.c

diff --git a/lib/algorithms/publickey.c b/lib/algorithms/publickey.c
index ce48f9f..5018f77 100644
--- a/lib/algorithms/publickey.c
+++ b/lib/algorithms/publickey.c
@@ -53,6 +53,7 @@ static const gnutls_pk_map pk_mappings[] = {
   {GNUTLS_KX_DHE_RSA, GNUTLS_PK_RSA, CIPHER_SIGN},
   {GNUTLS_KX_SRP_RSA, GNUTLS_PK_RSA, CIPHER_SIGN},
   {GNUTLS_KX_ECDHE_RSA, GNUTLS_PK_RSA, CIPHER_SIGN},
+  {GNUTLS_KX_ECDHE_ECDSA, GNUTLS_PK_ECC, CIPHER_SIGN},
   {GNUTLS_KX_DHE_DSS, GNUTLS_PK_DSA, CIPHER_SIGN},
   {GNUTLS_KX_SRP_DSS, GNUTLS_PK_DSA, CIPHER_SIGN},
   {0, 0, 0}
diff --git a/lib/ext/ecc.c b/lib/ext/ecc.c
index e1eef10..f6d0218 100644
--- a/lib/ext/ecc.c
+++ b/lib/ext/ecc.c
@@ -119,7 +119,6 @@ _gnutls_supported_ecc_recv_params (gnutls_session_t session,
           if ((ret =
                _gnutls_session_supports_ecc_curve (session, new_type)) < 0)
             {
-              gnutls_assert ();
               continue;
             }
           else
diff --git a/lib/gnutls_sig.c b/lib/gnutls_sig.c
index 88d53ea..0bd76af 100644
--- a/lib/gnutls_sig.c
+++ b/lib/gnutls_sig.c
@@ -133,6 +133,7 @@ _gnutls_handshake_sign_data (gnutls_session_t session, 
gnutls_pcert_st* cert,
         }
       break;
     case GNUTLS_PK_DSA:
+    case GNUTLS_PK_ECC:
       _gnutls_hash_deinit (&td_sha, concat);
 
       if ((hash_algo != GNUTLS_DIG_SHA1) && (hash_algo != GNUTLS_DIG_SHA224)
diff --git a/lib/nettle/Makefile.am b/lib/nettle/Makefile.am
index a4bd44c..233ab30 100644
--- a/lib/nettle/Makefile.am
+++ b/lib/nettle/Makefile.am
@@ -39,4 +39,4 @@ libcrypto_la_SOURCES = pk.c mpi.c mac.c cipher.c rnd.c init.c 
egd.c egd.h \
        ecc_test.c ecc_map.c \
        ecc_mulmod.c ecc_points.c ecc_projective_dbl_point_3.c \
        ecc_projective_add_point.c ecc_projective_dbl_point.c \
-       mp_unsigned_bin.c ecc_sign_hash.c ecc_verify_hash.c 
+       ecc_sign_hash.c ecc_verify_hash.c 
diff --git a/lib/nettle/ecc.h b/lib/nettle/ecc.h
index 2a7ce3d..07a882c 100644
--- a/lib/nettle/ecc.h
+++ b/lib/nettle/ecc.h
@@ -1,6 +1,7 @@
 #include <gmp.h>
 #include <nettle/nettle-types.h>
 #include <nettle/dsa.h>
+#include <nettle/bignum.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
@@ -120,9 +121,6 @@ int ecc_map(ecc_point *P, mpz_t modulus);
 /* helper functions */
 int mp_init_multi(mpz_t *a, ...);
 void mp_clear_multi(mpz_t *a, ...);
-unsigned long mp_unsigned_bin_size(mpz_t a);
-int mp_to_unsigned_bin(mpz_t a, unsigned char *b);
-int mp_read_unsigned_bin(mpz_t a, unsigned char *b, unsigned long len);
 #define mp_isodd(a)                  (mpz_size(a) > 0 ? (mpz_getlimbn(a, 0) & 
1 ? 1 : 0) : 0)
 
 #define MP_DIGIT_BIT (sizeof(mp_limb_t) * 8 - GMP_NAIL_BITS)
diff --git a/lib/nettle/ecc_make_key.c b/lib/nettle/ecc_make_key.c
index 08af1bc..3667a5b 100644
--- a/lib/nettle/ecc_make_key.c
+++ b/lib/nettle/ecc_make_key.c
@@ -45,7 +45,7 @@ ecc_make_key_ex (void *random_ctx, nettle_random_func random, 
ecc_key * key,
   assert (key != NULL);
   assert (random != NULL);
 
-  keysize = mp_unsigned_bin_size (order);
+  keysize = nettle_mpz_sizeinbase_256_u (order);
 
   /* allocate ram */
   base = NULL;
@@ -83,11 +83,8 @@ ecc_make_key_ex (void *random_ctx, nettle_random_func 
random, ecc_key * key,
   mpz_set (base->x, key->Gx);
   mpz_set (base->y, key->Gy);
   mpz_set_ui (base->z, 1);
-  if ((err =
-       mp_read_unsigned_bin (key->k, (unsigned char *) buf, keysize)) != 0)
-    {
-      goto errkey;
-    }
+  
+  nettle_mpz_set_str_256_u (key->k, keysize, buf);
 
   /* the key should be smaller than the order of base point */
   if (mpz_cmp (key->k, key->order) >= 0)
diff --git a/lib/nettle/ecc_shared_secret.c b/lib/nettle/ecc_shared_secret.c
index 6207419..c229870 100644
--- a/lib/nettle/ecc_shared_secret.c
+++ b/lib/nettle/ecc_shared_secret.c
@@ -63,7 +63,7 @@ ecc_shared_secret (ecc_key * private_key, ecc_key * 
public_key,
       goto done;
     }
 
-  x = (unsigned long) mp_unsigned_bin_size (private_key->prime);
+  x = nettle_mpz_sizeinbase_256_u (private_key->prime);
   if (*outlen < x)
     {
       *outlen = x;
@@ -71,13 +71,7 @@ ecc_shared_secret (ecc_key * private_key, ecc_key * 
public_key,
       goto done;
     }
   memset (out, 0, x);
-  if ((err =
-       mp_to_unsigned_bin (result->x,
-                           out + (x - mp_unsigned_bin_size (result->x)))) !=
-      0)
-    {
-      goto done;
-    }
+  nettle_mpz_get_str_256(x, out + (x - nettle_mpz_sizeinbase_256_u 
(result->x)), result->x);
 
   err = 0;
   *outlen = x;
diff --git a/lib/nettle/ecc_sign_hash.c b/lib/nettle/ecc_sign_hash.c
index 4111610..12be36d 100644
--- a/lib/nettle/ecc_sign_hash.c
+++ b/lib/nettle/ecc_sign_hash.c
@@ -57,11 +57,8 @@ ecc_sign_hash (const unsigned char *in, unsigned long inlen,
     {
       return err;
     }
-  if ((err =
-       mp_read_unsigned_bin (e, (unsigned char *) in, (int) inlen)) != 0)
-    {
-      goto errnokey;
-    }
+
+  nettle_mpz_set_str_256_u (e, inlen, in);
 
   /* make up a key and export the public copy */
   for (;;)
diff --git a/lib/nettle/ecc_verify_hash.c b/lib/nettle/ecc_verify_hash.c
index df66927..62efae0 100644
--- a/lib/nettle/ecc_verify_hash.c
+++ b/lib/nettle/ecc_verify_hash.c
@@ -82,11 +82,7 @@ ecc_verify_hash (struct dsa_signature *signature,
     }
 
   /* read hash */
-  if ((err =
-       mp_read_unsigned_bin (e, (unsigned char *) hash, (int) hashlen)) != 0)
-    {
-      goto error;
-    }
+  nettle_mpz_set_str_256_u (e, hashlen, hash);
 
   /*  w  = s^-1 mod n */
   mpz_invert (w, signature->s, key->order);
diff --git a/lib/nettle/mp_unsigned_bin.c b/lib/nettle/mp_unsigned_bin.c
deleted file mode 100644
index 0da8bba..0000000
--- a/lib/nettle/mp_unsigned_bin.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include "ecc.h"
-
-unsigned long mp_unsigned_bin_size(mpz_t a)
-{
-  unsigned long t;
-  assert(a != NULL);
-
-  t = mpz_sizeinbase(a, 2);
-  if (mpz_cmp_ui((a), 0) == 0) return 0;
-    return (t>>3) + ((t&7)?1:0);
-}
-
-int mp_to_unsigned_bin(mpz_t a, unsigned char *b)
-{
-   assert(a != NULL);
-   assert(b != NULL);
-   mpz_export(b, NULL, 1, 1, 1, 0, a);
-
-   return 0;
-}
-
-int mp_read_unsigned_bin(mpz_t a, unsigned char *b, unsigned long len)
-{
-   assert(a != NULL);
-   assert(b != NULL);
-   mpz_import(a, len, 1, 1, 1, 0, b);
-   return 0;
-}


hooks/post-receive
-- 
GNU gnutls



reply via email to

[Prev in Thread] Current Thread [Next in Thread]