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_3_0_2-60-gdd88a88


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_3_0_2-60-gdd88a88
Date: Sat, 17 Sep 2011 22:17:32 +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=dd88a8891b72a300ab986d903bce68dcdede8f20

The branch, master has been updated
       via  dd88a8891b72a300ab986d903bce68dcdede8f20 (commit)
       via  327aacdf029c56bc5e488367c63fe5903dc7e0c6 (commit)
       via  d620e7020092ba1be4e2f170a7f84cc25cd0d2a1 (commit)
      from  c8c99c59b4a09f8ade727bfb3276807d72961108 (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 dd88a8891b72a300ab986d903bce68dcdede8f20
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sat Sep 17 18:15:51 2011 +0200

    Corrected memory leak in privkey deinitialization. Reported by Dan Winship.

commit 327aacdf029c56bc5e488367c63fe5903dc7e0c6
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sat Sep 17 11:44:08 2011 +0200

    eliminated inline assembly.

commit d620e7020092ba1be4e2f170a7f84cc25cd0d2a1
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sat Sep 17 11:22:02 2011 +0200

    Added gnutls_record_get_discarded() to return the number of discarded
    record packets in a DTLS session.

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

Summary of changes:
 NEWS                                     |    7 ++++
 lib/accelerated/accelerated.c            |    2 +-
 lib/accelerated/intel/Makefile.am        |    4 +-
 lib/accelerated/intel/aes-padlock.c      |    2 +-
 lib/accelerated/intel/aes-x86.c          |    6 ++--
 lib/accelerated/intel/asm/cpuid-x86-64.s |   39 +++++++++++++++++++++
 lib/accelerated/intel/asm/cpuid-x86.s    |   54 ++++++++++++++++++++++++++++
 lib/accelerated/x86.h                    |   56 ++++-------------------------
 lib/auth/cert.c                          |    2 +
 lib/gnutls_dtls.c                        |   15 ++++++++
 lib/gnutls_int.h                         |    1 +
 lib/gnutls_record.c                      |    2 +
 lib/includes/gnutls/dtls.h               |    1 +
 lib/libgnutls.map                        |    1 +
 14 files changed, 137 insertions(+), 55 deletions(-)
 create mode 100644 lib/accelerated/intel/asm/cpuid-x86-64.s
 create mode 100644 lib/accelerated/intel/asm/cpuid-x86.s

diff --git a/NEWS b/NEWS
index 45234ec..eedee7b 100644
--- a/NEWS
+++ b/NEWS
@@ -4,9 +4,15 @@ See the end for copying conditions.
 
 * Version 3.0.3 (unreleased)
 
+** libgnutls: Added gnutls_record_get_discarded() to return the
+number of discarded records in a DTLS session.
+
 ** libgnutls: All functions related to RSA-EXPORT were deprecated.
 Support for RSA-EXPORT ciphersuites will be ceased in future versions.
 
+** libgnutls: Memory leak fixes in credentials private key 
+deinitialization. Reported by Dan Winship.
+
 ** libgnutls: Memory leak fixes in ECC ciphersuites.
 
 ** libgnutls: Do not send an empty extension structure in server 
@@ -34,6 +40,7 @@ gnutls_pkcs11_privkey_generate: Added
 gnutls_pubkey_import_ecc_raw: Added
 gnutls_pubkey_import_ecc_x962: Added
 gnutls_pubkey_get_pk_ecc_x962: Added
+gnutls_record_get_discarded: Added
 
 
 * Version 3.0.2 (released 2011-09-01)
diff --git a/lib/accelerated/accelerated.c b/lib/accelerated/accelerated.c
index e2da12f..8a89e3d 100644
--- a/lib/accelerated/accelerated.c
+++ b/lib/accelerated/accelerated.c
@@ -30,7 +30,7 @@ void _gnutls_register_accel_crypto(void)
 {
 
 #if defined(ASM_X86_32) || defined(ASM_X86_64)
-  if (have_cpuid() != 0)
+  if (_gnutls_have_cpuid() != 0)
     {
       register_x86_crypto ();
       register_padlock_crypto ();
diff --git a/lib/accelerated/intel/Makefile.am 
b/lib/accelerated/intel/Makefile.am
index a0ea333..996c0d5 100644
--- a/lib/accelerated/intel/Makefile.am
+++ b/lib/accelerated/intel/Makefile.am
@@ -38,8 +38,8 @@ libintel_la_SOURCES = aes-x86.c aes-padlock.c 
aes-gcm-padlock.c
 
 if ASM_X86_64
 AM_CPPFLAGS += -DASM_X86_64
-libintel_la_SOURCES += asm/appro-aes-x86-64.s asm/appro-aes-gcm-x86-64.s 
aes-gcm-x86.c asm/padlock-x86-64.s
+libintel_la_SOURCES += asm/appro-aes-x86-64.s asm/appro-aes-gcm-x86-64.s 
aes-gcm-x86.c asm/padlock-x86-64.s asm/cpuid-x86-64.s
 else
-libintel_la_SOURCES += asm/appro-aes-x86.s asm/padlock-x86.s
+libintel_la_SOURCES += asm/appro-aes-x86.s asm/padlock-x86.s asm/cpuid-x86.s
 endif
 
diff --git a/lib/accelerated/intel/aes-padlock.c 
b/lib/accelerated/intel/aes-padlock.c
index e0e79c1..59f33bc 100644
--- a/lib/accelerated/intel/aes-padlock.c
+++ b/lib/accelerated/intel/aes-padlock.c
@@ -170,7 +170,7 @@ static int check_padlock(void)
 static unsigned check_via(void)
 {
     unsigned int a, b, c, d;
-    cpuid(0, a, b, c, d);
+    _gnutls_cpuid(0, &a, &b, &c, &d);
 
     if ((memcmp(&b, "VIA ", 4) == 0 &&
          memcmp(&d, "VIA ", 4) == 0 && memcmp(&c, "VIA ", 4) == 0)) {
diff --git a/lib/accelerated/intel/aes-x86.c b/lib/accelerated/intel/aes-x86.c
index 9f4c4cb..5f465a5 100644
--- a/lib/accelerated/intel/aes-x86.c
+++ b/lib/accelerated/intel/aes-x86.c
@@ -126,7 +126,7 @@ static unsigned
 check_optimized_aes (void)
 {
   unsigned int a, b, c, d;
-  cpuid (1, a, b, c, d);
+  _gnutls_cpuid (1, &a, &b, &c, &d);
 
   return (c & 0x2000000);
 }
@@ -136,7 +136,7 @@ static unsigned
 check_pclmul (void)
 {
   unsigned int a, b, c, d;
-  cpuid (1, a, b, c, d);
+  _gnutls_cpuid (1, &a, &b, &c, &d);
 
   return (c & 0x2);
 }
@@ -146,7 +146,7 @@ static unsigned
 check_intel_or_amd (void)
 {
   unsigned int a, b, c, d;
-  cpuid (0, a, b, c, d);
+  _gnutls_cpuid (0, &a, &b, &c, &d);
 
   if ((memcmp (&b, "Genu", 4) == 0 &&
        memcmp (&d, "ineI", 4) == 0 &&
diff --git a/lib/accelerated/intel/asm/cpuid-x86-64.s 
b/lib/accelerated/intel/asm/cpuid-x86-64.s
new file mode 100644
index 0000000..48b2cc4
--- /dev/null
+++ b/lib/accelerated/intel/asm/cpuid-x86-64.s
@@ -0,0 +1,39 @@
+       .file "cpuid.asm"
+        
+       .text
+       .align 16
+.globl _gnutls_cpuid
+.type _gnutls_cpuid,%function
+_gnutls_cpuid:
+       pushq   %rbp
+       movq    %rsp, %rbp
+       pushq   %rbx
+       movl    %edi, -12(%rbp)
+       movq    %rsi, -24(%rbp)
+       movq    %rdx, -32(%rbp)
+       movq    %rcx, -40(%rbp)
+       movq    %r8, -48(%rbp)
+       movl    -12(%rbp), %eax
+       movl    %eax, -60(%rbp)
+       movl    -60(%rbp), %eax
+       cpuid
+       movl    %edx, -56(%rbp)
+       movl    %ecx, %esi
+       movl    %eax, -52(%rbp)
+       movq    -24(%rbp), %rax
+       movl    -52(%rbp), %edx
+       movl    %edx, (%rax)
+       movq    -32(%rbp), %rax
+       movl    %ebx, (%rax)
+       movq    -40(%rbp), %rax
+       movl    %esi, (%rax)
+       movq    -48(%rbp), %rax
+       movl    -56(%rbp), %ecx
+       movl    %ecx, (%rax)
+       popq    %rbx
+       leave
+       ret
+.size _gnutls_cpuid, . - _gnutls_cpuid
+
+
+.section .note.GNU-stack,"",@progbits
diff --git a/lib/accelerated/intel/asm/cpuid-x86.s 
b/lib/accelerated/intel/asm/cpuid-x86.s
new file mode 100644
index 0000000..b286225
--- /dev/null
+++ b/lib/accelerated/intel/asm/cpuid-x86.s
@@ -0,0 +1,54 @@
+       .file "cpuid.asm"
+        
+       .text
+       .align 16
+.globl _gnutls_cpuid
+.type _gnutls_cpuid,%function
+_gnutls_cpuid:
+       pushl   %ebp
+       movl    %esp, %ebp
+       subl    $12, %esp
+       movl    %ebx, (%esp)
+       movl    8(%ebp), %eax
+       movl    %esi, 4(%esp)
+       movl    %edi, 8(%esp)
+       pushl %ebx
+       cpuid
+       movl %ebx, %edi
+       popl %ebx
+       movl    %edx, %esi
+       movl    12(%ebp), %edx
+       movl    %eax, (%edx)
+       movl    16(%ebp), %eax
+       movl    %edi, (%eax)
+       movl    20(%ebp), %eax
+       movl    %ecx, (%eax)
+       movl    24(%ebp), %eax
+       movl    %esi, (%eax)
+       movl    (%esp), %ebx
+       movl    4(%esp), %esi
+       movl    8(%esp), %edi
+       movl    %ebp, %esp
+       popl    %ebp
+       ret
+.size _gnutls_cpuid, . - _gnutls_cpuid
+
+       .globl  _gnutls_have_cpuid
+       .type   _gnutls_have_cpuid, @function
+_gnutls_have_cpuid:
+.LFB0:
+       .cfi_startproc
+       pushfl  
+       pop %eax        
+       orl $0x200000, %eax     
+       push %eax       
+       popfl   
+       pushfl  
+       pop %eax        
+       andl $0x200000, %eax    
+       ret
+       .cfi_endproc
+.LFE0:
+       .size   _gnutls_have_cpuid, .-_gnutls_have_cpuid
+
+.section .note.GNU-stack,"",@progbits
diff --git a/lib/accelerated/x86.h b/lib/accelerated/x86.h
index 0b61272..4a5d5c7 100644
--- a/lib/accelerated/x86.h
+++ b/lib/accelerated/x86.h
@@ -22,55 +22,15 @@
 
 #include <config.h>
 
-#ifdef ASM_X86_64
+#if defined(ASM_X86_32) || defined(ASM_X86_64)
 
-# ifdef HAVE_CPUID_H
-#  include <cpuid.h>
-#  define cpuid __cpuid
-# else
-
-#define cpuid(func,ax,bx,cx,dx)\
-  __asm__ __volatile__ ("cpuid":\
-  "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (func));
-
-# endif
-
-# define have_cpuid() 1
+void _gnutls_cpuid(unsigned int func, unsigned int *ax, unsigned int *bx, 
unsigned int *cx, unsigned int* dx);
 
-#endif /* ASM_X86_64 */
-
-
-#ifdef ASM_X86_32
-/* some GCC versions complain on the version above */
-#  define cpuid(func, a, b, c, d) g_cpuid(func, &a, &b, &c, &d)
+# ifdef ASM_X86_32
+unsigned int _gnutls_have_cpuid(void);
+# else
+#  define _gnutls_have_cpuid() 1
+# endif /* ASM_X86_32 */
 
-inline static void g_cpuid(uint32_t func, unsigned int *ax, unsigned int *bx, 
unsigned int *cx, unsigned int* dx)
-{
-    asm volatile ("pushl %%ebx\n"
-                  "cpuid\n" 
-                  "movl %%ebx, %1\n"
-                  "popl %%ebx\n"
-                  :"=a" (*ax), "=r"(*bx), "=c"(*cx), "=d"(*dx)
-                  :"a"(func)
-                  :"cc");
-}
+#endif
 
-inline static unsigned int have_cpuid(void)
-{
-  unsigned int have_id;
-  asm volatile(
-    "pushfl\t\n"
-    "pop %0\t\n"
-    "orl $0x200000, %0\t\n"
-    "push %0\t\n"
-    "popfl\t\n"
-    "pushfl\t\n"
-    "pop %0\t\n"
-    "andl $0x200000, %0\t\n"
-    :"=r" (have_id)
-    ::
-  );
-  
-  return have_id;
-}
-#endif /* ASM_X86_32 */
diff --git a/lib/auth/cert.c b/lib/auth/cert.c
index e692797..dd321da 100644
--- a/lib/auth/cert.c
+++ b/lib/auth/cert.c
@@ -639,6 +639,7 @@ cleanup:
             {
               gnutls_x509_crt_deinit (st2.cert.x509[i]);
             }
+          gnutls_free(st2.cert.x509);
         }
     }
   else
@@ -2053,6 +2054,7 @@ _gnutls_selected_certs_deinit (gnutls_session_t session)
       session->internals.selected_cert_list = NULL;
       session->internals.selected_cert_list_length = 0;
 
+      gnutls_privkey_deinit(session->internals.selected_key);
       session->internals.selected_key = NULL;
     }
 
diff --git a/lib/gnutls_dtls.c b/lib/gnutls_dtls.c
index ea49fc7..29dc2d1 100644
--- a/lib/gnutls_dtls.c
+++ b/lib/gnutls_dtls.c
@@ -705,3 +705,18 @@ void gnutls_dtls_prestate_set(gnutls_session_t session, 
gnutls_dtls_prestate_st*
   session->internals.dtls.hsk_read_seq = prestate->hsk_read_seq;
   session->internals.dtls.hsk_write_seq = prestate->hsk_write_seq + 1;
 }
+
+/**
+ * gnutls_record_get_discarded:
+ * @session: is a #gnutls_session_t structure.
+ *
+ * Returns the number of discarded packets in a
+ * DTLS connection.
+ *
+ * Returns: The number of discarded packets.
+ **/
+unsigned int gnutls_record_get_discarded (gnutls_session_t session)
+{
+  return session->internals.dtls.packets_dropped;
+}
+
diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h
index 7ad7720..9b0b8bf 100644
--- a/lib/gnutls_int.h
+++ b/lib/gnutls_int.h
@@ -622,6 +622,7 @@ typedef struct
   
   /* last retransmission triggered by record layer */
   time_t last_retransmit;
+  unsigned int packets_dropped;
 } dtls_st;
 
 
diff --git a/lib/gnutls_record.c b/lib/gnutls_record.c
index 874099f..22e4923 100644
--- a/lib/gnutls_record.c
+++ b/lib/gnutls_record.c
@@ -1075,6 +1075,8 @@ begin:
   return ret;
 
 discard:
+  session->internals.dtls.packets_dropped++;
+
   /* discard the whole received fragment. */
   bufel = _mbuffer_head_pop_first(&session->internals.record_recv_buffer);
   _mbuffer_xfree(&bufel);
diff --git a/lib/includes/gnutls/dtls.h b/lib/includes/gnutls/dtls.h
index 2f3369c..3183d60 100644
--- a/lib/includes/gnutls/dtls.h
+++ b/lib/includes/gnutls/dtls.h
@@ -77,6 +77,7 @@ unsigned int gnutls_dtls_get_data_mtu (gnutls_session_t 
session);
   void gnutls_dtls_prestate_set (gnutls_session_t session,
                                 gnutls_dtls_prestate_st* prestate);
 
+  unsigned int gnutls_record_get_discarded (gnutls_session_t session);
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/libgnutls.map b/lib/libgnutls.map
index 97ff01c..70bc841 100644
--- a/lib/libgnutls.map
+++ b/lib/libgnutls.map
@@ -716,6 +716,7 @@ GNUTLS_3_0_0 {
        gnutls_pkcs11_privkey_generate;
        gnutls_pubkey_import_ecc_raw;
        gnutls_pubkey_import_ecc_raw2;
+       gnutls_record_get_discarded;
 } GNUTLS_2_12;
 
 GNUTLS_PRIVATE {


hooks/post-receive
-- 
GNU gnutls



reply via email to

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