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_2-43-g82ad8ca


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_2_99_2-43-g82ad8ca
Date: Thu, 02 Jun 2011 20:01:51 +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=82ad8cac4b23990bef76be1de4e0a1740b59241c

The branch, master has been updated
       via  82ad8cac4b23990bef76be1de4e0a1740b59241c (commit)
       via  67b80d69ebe910c47f993cb0e6240c3e5115deab (commit)
      from  bc8910cb1cd4c4534119e71f6de842b0c5c61233 (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 82ad8cac4b23990bef76be1de4e0a1740b59241c
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Thu Jun 2 04:19:47 2011 +0200

    gnutls/crypto.h no longer includes functions to register ciphers.
    Thus the following functions
    -    gnutls_crypto_bigint_register
    -    gnutls_crypto_cipher_register
    -    gnutls_crypto_digest_register
    -    gnutls_crypto_mac_register
    -    gnutls_crypto_pk_register
    -    gnutls_crypto_rnd_register
    -    gnutls_crypto_single_cipher_register
    -    gnutls_crypto_single_digest_register
    -    gnutls_crypto_single_mac_register
    are only available internally via crypto-backend.h.

commit 67b80d69ebe910c47f993cb0e6240c3e5115deab
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Thu Jun 2 04:19:08 2011 +0200

    updated

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

Summary of changes:
 NEWS                                               |    9 +
 build-aux/config.rpath                             |  136 ++++------
 lib/Makefile.am                                    |    7 +-
 lib/auth/psk_passwd.c                              |    2 +-
 lib/auth/rsa.c                                     |    4 +-
 lib/auth/rsa_export.c                              |    2 +-
 lib/auth/srp_passwd.c                              |    6 +-
 lib/crypto-api.c                                   |    2 +-
 lib/{crypto.c => crypto-backend.c}                 |  146 +++-------
 lib/{includes/gnutls/crypto.h => crypto-backend.h} |  175 +++----------
 lib/ext/session_ticket.c                           |    2 +-
 lib/gnutls_cipher.c                                |    4 +-
 lib/gnutls_cipher_int.h                            |    1 +
 lib/gnutls_handshake.c                             |    4 +-
 lib/gnutls_hash_int.h                              |    1 +
 lib/gnutls_mpi.c                                   |    2 +-
 lib/gnutls_mpi.h                                   |    2 +-
 lib/gnutls_pk.c                                    |    4 +-
 lib/includes/gnutls/crypto.h                       |  294 +-------------------
 lib/libgnutls.map                                  |   11 +-
 lib/nettle/mpi.c                                   |    6 +-
 lib/nettle/pk.c                                    |    2 +-
 lib/opencdk/misc.c                                 |    2 +-
 lib/pkcs11_secret.c                                |    2 +-
 lib/random.h                                       |    3 +-
 lib/x509/pkcs12.c                                  |    2 +-
 lib/x509/privkey_pkcs8.c                           |    6 +-
 libextra/gnutls_openssl.c                          |    4 +-
 src/psk.c                                          |    2 +-
 src/srptool.c                                      |    2 +-
 tests/Makefile.am                                  |    2 +-
 tests/crypto_rng.c                                 |   84 ------
 tests/rng-fork.c                                   |    5 +-
 33 files changed, 186 insertions(+), 750 deletions(-)
 rename lib/{crypto.c => crypto-backend.c} (80%)
 copy lib/{includes/gnutls/crypto.h => crypto-backend.h} (64%)
 delete mode 100644 tests/crypto_rng.c

diff --git a/NEWS b/NEWS
index 02b87ea..4acf21b 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,15 @@ instruction. Uses Andy Polyakov's assembly code.
 ** libgnutls: Added ECDHE-PSK ciphersuites for TLS (RFC 5489).
 
 ** API and ABI modifications:
+gnutls_crypto_bigint_register: REMOVED
+gnutls_crypto_cipher_register: REMOVED
+gnutls_crypto_digest_register: REMOVED
+gnutls_crypto_mac_register: REMOVED
+gnutls_crypto_pk_register: REMOVED
+gnutls_crypto_rnd_register: REMOVED
+gnutls_crypto_single_cipher_register: REMOVED
+gnutls_crypto_single_digest_register: REMOVED
+gnutls_crypto_single_mac_register: REMOVED
 GNUTLS_KX_ECDHE_PSK: New key exchange method
 
 
diff --git a/build-aux/config.rpath b/build-aux/config.rpath
index 8bd7f5d..c547c68 100755
--- a/build-aux/config.rpath
+++ b/build-aux/config.rpath
@@ -2,7 +2,7 @@
 # Output a system dependent set of variables, describing how to set the
 # run time search path of shared libraries in an executable.
 #
-#   Copyright 1996-2011 Free Software Foundation, Inc.
+#   Copyright 1996-2007 Free Software Foundation, Inc.
 #   Taken from GNU libtool, 2001
 #   Originally by Gordon Matzigkeit <address@hidden>, 1996
 #
@@ -47,7 +47,7 @@ for cc_temp in $CC""; do
 done
 cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
 
-# Code taken from libtool.m4's _LT_COMPILER_PIC.
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
 
 wl=
 if test "$GCC" = yes; then
@@ -57,7 +57,14 @@ else
     aix*)
       wl='-Wl,'
       ;;
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
+    darwin*)
+      case $cc_basename in
+        xlc*)
+          wl='-Wl,'
+          ;;
+      esac
+      ;;
+    mingw* | cygwin* | pw32* | os2*)
       ;;
     hpux9* | hpux10* | hpux11*)
       wl='-Wl,'
@@ -65,37 +72,24 @@ else
     irix5* | irix6* | nonstopux*)
       wl='-Wl,'
       ;;
-    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+    newsos6)
+      ;;
+    linux* | k*bsd*-gnu)
       case $cc_basename in
-        ecc*)
+        icc* | ecc*)
           wl='-Wl,'
           ;;
-        icc* | ifort*)
-          wl='-Wl,'
-          ;;
-        lf95*)
-          wl='-Wl,'
-          ;;
-        nagfor*)
-          wl='-Wl,-Wl,,'
-          ;;
-        pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        pgcc | pgf77 | pgf90)
           wl='-Wl,'
           ;;
         ccc*)
           wl='-Wl,'
           ;;
-        xl* | bgxl* | bgf* | mpixl*)
-          wl='-Wl,'
-          ;;
         como)
           wl='-lopt='
           ;;
         *)
           case `$CC -V 2>&1 | sed 5q` in
-            *Sun\ F* | *Sun*Fortran*)
-              wl=
-              ;;
             *Sun\ C*)
               wl='-Wl,'
               ;;
@@ -103,24 +97,13 @@ else
           ;;
       esac
       ;;
-    newsos6)
-      ;;
-    *nto* | *qnx*)
-      ;;
     osf3* | osf4* | osf5*)
       wl='-Wl,'
       ;;
     rdos*)
       ;;
     solaris*)
-      case $cc_basename in
-        f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
-          wl='-Qoption ld '
-          ;;
-        *)
-          wl='-Wl,'
-          ;;
-      esac
+      wl='-Wl,'
       ;;
     sunos4*)
       wl='-Qoption ld '
@@ -141,7 +124,7 @@ else
   esac
 fi
 
-# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
 
 hardcode_libdir_flag_spec=
 hardcode_libdir_separator=
@@ -149,7 +132,7 @@ hardcode_direct=no
 hardcode_minus_L=no
 
 case "$host_os" in
-  cygwin* | mingw* | pw32* | cegcc*)
+  cygwin* | mingw* | pw32*)
     # FIXME: the MSVC++ port hasn't been tested in a loooong time
     # When not using gcc, we currently assume that we are using
     # Microsoft Visual C++.
@@ -175,21 +158,22 @@ if test "$with_gnu_ld" = yes; then
   # option of GNU ld is called -rpath, not --rpath.
   hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
   case "$host_os" in
-    aix[3-9]*)
+    aix3* | aix4* | aix5*)
       # On AIX/PPC, the GNU linker is very broken
       if test "$host_cpu" != ia64; then
         ld_shlibs=no
       fi
       ;;
     amigaos*)
-      case "$host_cpu" in
-        powerpc)
-          ;;
-        m68k)
-          hardcode_libdir_flag_spec='-L$libdir'
-          hardcode_minus_L=yes
-          ;;
-      esac
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # Samuel A. Falvo II <address@hidden> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we cannot use
+      # them.
+      ld_shlibs=no
       ;;
     beos*)
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
@@ -198,7 +182,7 @@ if test "$with_gnu_ld" = yes; then
         ld_shlibs=no
       fi
       ;;
-    cygwin* | mingw* | pw32* | cegcc*)
+    cygwin* | mingw* | pw32*)
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
       hardcode_libdir_flag_spec='-L$libdir'
@@ -208,13 +192,11 @@ if test "$with_gnu_ld" = yes; then
         ld_shlibs=no
       fi
       ;;
-    haiku*)
-      ;;
     interix[3-9]*)
       hardcode_direct=no
       hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
       ;;
-    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+    gnu* | linux* | k*bsd*-gnu)
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
         :
       else
@@ -272,7 +254,7 @@ else
         hardcode_direct=unsupported
       fi
       ;;
-    aix[4-9]*)
+    aix4* | aix5*)
       if test "$host_cpu" = ia64; then
         # On IA64, the linker does run time linking by default, so we don't
         # have to do anything special.
@@ -282,7 +264,7 @@ else
         # Test if we are trying to use run time linking or normal
         # AIX style linking. If -brtl is somewhere in LDFLAGS, we
         # need to do runtime linking.
-        case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+        case $host_os in aix4.[23]|aix4.[23].*|aix5*)
           for ld_flag in $LDFLAGS; do
             if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
               aix_use_runtimelinking=yes
@@ -337,18 +319,14 @@ else
       fi
       ;;
     amigaos*)
-      case "$host_cpu" in
-        powerpc)
-          ;;
-        m68k)
-          hardcode_libdir_flag_spec='-L$libdir'
-          hardcode_minus_L=yes
-          ;;
-      esac
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs=no
       ;;
     bsdi[45]*)
       ;;
-    cygwin* | mingw* | pw32* | cegcc*)
+    cygwin* | mingw* | pw32*)
       # When not using gcc, we currently assume that we are using
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
@@ -358,15 +336,24 @@ else
       ;;
     darwin* | rhapsody*)
       hardcode_direct=no
-      if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; 
then
+      if test "$GCC" = yes ; then
         :
       else
-        ld_shlibs=no
+        case $cc_basename in
+          xlc*)
+            ;;
+          *)
+            ld_shlibs=no
+            ;;
+        esac
       fi
       ;;
     dgux*)
       hardcode_libdir_flag_spec='-L$libdir'
       ;;
+    freebsd1*)
+      ld_shlibs=no
+      ;;
     freebsd2.2*)
       hardcode_libdir_flag_spec='-R$libdir'
       hardcode_direct=yes
@@ -427,8 +414,6 @@ else
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
       hardcode_libdir_separator=:
       ;;
-    *nto* | *qnx*)
-      ;;
     openbsd*)
       if test -f /usr/libexec/ld.so; then
         hardcode_direct=yes
@@ -509,7 +494,7 @@ else
 fi
 
 # Check dynamic linker characteristics
-# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
+# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
 # Unlike libtool.m4, here we don't care about _all_ names of the library, but
 # only about the one the linker finds when passed -lNAME. This is the last
 # element of library_names_spec in libtool.m4, or possibly two of them if the
@@ -520,16 +505,11 @@ case "$host_os" in
   aix3*)
     library_names_spec='$libname.a'
     ;;
-  aix[4-9]*)
+  aix4* | aix5*)
     library_names_spec='$libname$shrext'
     ;;
   amigaos*)
-    case "$host_cpu" in
-      powerpc*)
-        library_names_spec='$libname$shrext' ;;
-      m68k)
-        library_names_spec='$libname.a' ;;
-    esac
+    library_names_spec='$libname.a'
     ;;
   beos*)
     library_names_spec='$libname$shrext'
@@ -537,7 +517,7 @@ case "$host_os" in
   bsdi[45]*)
     library_names_spec='$libname$shrext'
     ;;
-  cygwin* | mingw* | pw32* | cegcc*)
+  cygwin* | mingw* | pw32*)
     shrext=.dll
     library_names_spec='$libname.dll.a $libname.lib'
     ;;
@@ -548,6 +528,8 @@ case "$host_os" in
   dgux*)
     library_names_spec='$libname$shrext'
     ;;
+  freebsd1*)
+    ;;
   freebsd* | dragonfly*)
     case "$host_os" in
       freebsd[123]*)
@@ -559,9 +541,6 @@ case "$host_os" in
   gnu*)
     library_names_spec='$libname$shrext'
     ;;
-  haiku*)
-    library_names_spec='$libname$shrext'
-    ;;
   hpux9* | hpux10* | hpux11*)
     case $host_cpu in
       ia64*)
@@ -597,7 +576,7 @@ case "$host_os" in
     ;;
   linux*oldld* | linux*aout* | linux*coff*)
     ;;
-  linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  linux* | k*bsd*-gnu)
     library_names_spec='$libname$shrext'
     ;;
   knetbsd*-gnu)
@@ -609,7 +588,7 @@ case "$host_os" in
   newsos6)
     library_names_spec='$libname$shrext'
     ;;
-  *nto* | *qnx*)
+  nto-qnx*)
     library_names_spec='$libname$shrext'
     ;;
   openbsd*)
@@ -640,9 +619,6 @@ case "$host_os" in
   sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
     library_names_spec='$libname$shrext'
     ;;
-  tpf*)
-    library_names_spec='$libname$shrext'
-    ;;
   uts4*)
     library_names_spec='$libname$shrext'
     ;;
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 1110daa..48bf752 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -71,10 +71,11 @@ COBJECTS = gnutls_record.c gnutls_compress.c debug.c 
gnutls_cipher.c        \
        gnutls_mem.c gnutls_ui.c gnutls_sig.c gnutls_ecc.c              \
        gnutls_dh_primes.c gnutls_alert.c system.c              \
        gnutls_str.c gnutls_state.c gnutls_x509.c gnutls_rsa_export.c   \
-       gnutls_helper.c gnutls_supplemental.c crypto.c random.c  \
+       gnutls_helper.c gnutls_supplemental.c random.c  \
        crypto-api.c gnutls_privkey.c gnutls_pcert.c \
        pkcs11.c pkcs11_privkey.c gnutls_pubkey.c pkcs11_write.c locks.c \
-       pkcs11_secret.c hash.c gnutls_dtls.c system_override.c
+       pkcs11_secret.c hash.c gnutls_dtls.c system_override.c \
+       crypto-backend.c
 
 
 if ENABLE_NETTLE
@@ -92,7 +93,7 @@ HFILES = abstract_int.h debug.h gnutls_compress.h 
gnutls_cipher.h     \
        gnutls_mpi.h gnutls_pk.h gnutls_record.h                \
        gnutls_constate.h gnutls_global.h gnutls_sig.h gnutls_mem.h     \
        gnutls_session_pack.h gnutls_str.h              \
-       gnutls_state.h gnutls_x509.h                    \
+       gnutls_state.h gnutls_x509.h crypto-backend.h                   \
        gnutls_rsa_export.h gnutls_srp.h auth/srp.h auth/srp_passwd.h   \
        gnutls_helper.h gnutls_supplemental.h crypto.h random.h system.h\
        locks.h gnutls_mbuffers.h pkcs11_int.h \
diff --git a/lib/auth/psk_passwd.c b/lib/auth/psk_passwd.c
index 71437d5..f25d988 100644
--- a/lib/auth/psk_passwd.c
+++ b/lib/auth/psk_passwd.c
@@ -109,7 +109,7 @@ _randomize_psk (gnutls_datum_t * psk)
 
   psk->size = 16;
 
-  ret = _gnutls_rnd (GNUTLS_RND_NONCE, (char *) psk->data, 16);
+  ret = gnutls_rnd (GNUTLS_RND_NONCE, (char *) psk->data, 16);
   if (ret < 0)
     {
       gnutls_assert ();
diff --git a/lib/auth/rsa.c b/lib/auth/rsa.c
index f43bab8..cb5cf13 100644
--- a/lib/auth/rsa.c
+++ b/lib/auth/rsa.c
@@ -215,7 +215,7 @@ proc_rsa_client_kx (gnutls_session_t session, opaque * data,
 
       /* we do not need strong random numbers here.
        */
-      ret = _gnutls_rnd (GNUTLS_RND_NONCE, session->key->key.data,
+      ret = gnutls_rnd (GNUTLS_RND_NONCE, session->key->key.data,
                          session->key->key.size);
       if (ret < 0)
         {
@@ -270,7 +270,7 @@ _gnutls_gen_rsa_client_kx (gnutls_session_t session, 
gnutls_buffer_st* data)
       return GNUTLS_E_MEMORY_ERROR;
     }
 
-  ret = _gnutls_rnd (GNUTLS_RND_RANDOM, session->key->key.data,
+  ret = gnutls_rnd (GNUTLS_RND_RANDOM, session->key->key.data,
                      session->key->key.size);
   if (ret < 0)
     {
diff --git a/lib/auth/rsa_export.c b/lib/auth/rsa_export.c
index baa990f..18b39a2 100644
--- a/lib/auth/rsa_export.c
+++ b/lib/auth/rsa_export.c
@@ -206,7 +206,7 @@ proc_rsa_export_client_kx (gnutls_session_t session, opaque 
* data,
 
       /* we do not need strong random numbers here.
        */
-      ret = _gnutls_rnd (GNUTLS_RND_NONCE, session->key->key.data,
+      ret = gnutls_rnd (GNUTLS_RND_NONCE, session->key->key.data,
                          session->key->key.size);
       if (ret < 0)
         {
diff --git a/lib/auth/srp_passwd.c b/lib/auth/srp_passwd.c
index 84c703a..b2b1c19 100644
--- a/lib/auth/srp_passwd.c
+++ b/lib/auth/srp_passwd.c
@@ -406,7 +406,7 @@ _randomize_pwd_entry (SRP_PWD_ENTRY * entry)
       return GNUTLS_E_INTERNAL_ERROR;
     }
 
-  ret = _gnutls_rnd (GNUTLS_RND_NONCE, &rnd, 1);
+  ret = gnutls_rnd (GNUTLS_RND_NONCE, &rnd, 1);
   if (ret < 0)
     {
       gnutls_assert ();
@@ -423,7 +423,7 @@ _randomize_pwd_entry (SRP_PWD_ENTRY * entry)
       return GNUTLS_E_MEMORY_ERROR;
     }
 
-  ret = _gnutls_rnd (GNUTLS_RND_RANDOM, entry->v.data, 20);
+  ret = gnutls_rnd (GNUTLS_RND_RANDOM, entry->v.data, 20);
   if (ret < 0)
     {
       gnutls_assert ();
@@ -437,7 +437,7 @@ _randomize_pwd_entry (SRP_PWD_ENTRY * entry)
       return GNUTLS_E_MEMORY_ERROR;
     }
 
-  ret = _gnutls_rnd (GNUTLS_RND_NONCE, entry->salt.data, entry->salt.size);
+  ret = gnutls_rnd (GNUTLS_RND_NONCE, entry->salt.data, entry->salt.size);
   if (ret < 0)
     {
       gnutls_assert ();
diff --git a/lib/crypto-api.c b/lib/crypto-api.c
index 5e3f5c7..bdf9584 100644
--- a/lib/crypto-api.c
+++ b/lib/crypto-api.c
@@ -502,7 +502,7 @@ gnutls_key_generate (gnutls_datum_t * key, unsigned int 
key_size)
       return GNUTLS_E_MEMORY_ERROR;
     }
 
-  ret = _gnutls_rnd (GNUTLS_RND_RANDOM, key->data, key->size);
+  ret = gnutls_rnd (GNUTLS_RND_RANDOM, key->data, key->size);
   if (ret < 0)
     {
       gnutls_assert ();
diff --git a/lib/crypto.c b/lib/crypto-backend.c
similarity index 80%
rename from lib/crypto.c
rename to lib/crypto-backend.c
index aa914b0..df881d9 100644
--- a/lib/crypto.c
+++ b/lib/crypto-backend.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2010 Free Software Foundation, Inc.
+ * Copyright (C) 2008, 2010, 2011 Free Software Foundation, Inc.
  *
  * Author: Nikos Mavrogiannopoulos
  *
@@ -25,6 +25,7 @@
 #include <gnutls_errors.h>
 #include <gnutls_int.h>
 #include <gnutls/crypto.h>
+#include <crypto-backend.h>
 #include <crypto.h>
 #include <gnutls_mpi.h>
 #include <gnutls_pk.h>
@@ -146,11 +147,10 @@ _gnutls_crypto_deregister (void)
   _deregister (&glob_dl);
 }
 
-/**
- * gnutls_crypto_single_cipher_register2:
+/*-
+ * gnutls_crypto_single_cipher_register:
  * @algorithm: is the gnutls algorithm identifier
  * @priority: is the priority of the algorithm
- * @version: should be set to %GNUTLS_CRYPTO_API_VERSION
  * @s: is a structure holding new cipher's data
  *
  * This function will register a cipher algorithm to be used by
@@ -167,18 +167,12 @@ _gnutls_crypto_deregister (void)
  * Returns: %GNUTLS_E_SUCCESS on success, otherwise an error.
  *
  * Since: 2.6.0
- **/
+ -*/
 int
-gnutls_crypto_single_cipher_register2 (gnutls_cipher_algorithm_t algorithm,
-                                       int priority, int version,
+gnutls_crypto_single_cipher_register (gnutls_cipher_algorithm_t algorithm,
+                                       int priority,
                                        const gnutls_crypto_cipher_st * s)
 {
-  if (version != GNUTLS_CRYPTO_API_VERSION)
-    {
-      gnutls_assert ();
-      return GNUTLS_E_UNIMPLEMENTED_FEATURE;
-    }
-
   return _algo_register (&glob_cl, algorithm, priority, s);
 }
 
@@ -188,10 +182,9 @@ _gnutls_get_crypto_cipher (gnutls_cipher_algorithm_t algo)
   return _get_algo (&glob_cl, algo);
 }
 
-/**
- * gnutls_crypto_rnd_register2:
+/*-
+ * gnutls_crypto_rnd_register:
  * @priority: is the priority of the generator
- * @version: should be set to %GNUTLS_CRYPTO_API_VERSION
  * @s: is a structure holding new generator's data
  *
  * This function will register a random generator to be used by
@@ -208,17 +201,11 @@ _gnutls_get_crypto_cipher (gnutls_cipher_algorithm_t algo)
  * Returns: %GNUTLS_E_SUCCESS on success, otherwise an error.
  *
  * Since: 2.6.0
- **/
+ -*/
 int
-gnutls_crypto_rnd_register2 (int priority, int version,
+gnutls_crypto_rnd_register (int priority,
                              const gnutls_crypto_rnd_st * s)
 {
-  if (version != GNUTLS_CRYPTO_API_VERSION)
-    {
-      gnutls_assert ();
-      return GNUTLS_E_UNIMPLEMENTED_FEATURE;
-    }
-
   if (crypto_rnd_prio > priority)
     {
       memcpy (&_gnutls_rnd_ops, s, sizeof (*s));
@@ -229,11 +216,10 @@ gnutls_crypto_rnd_register2 (int priority, int version,
   return GNUTLS_E_CRYPTO_ALREADY_REGISTERED;
 }
 
-/**
- * gnutls_crypto_single_mac_register2:
+/*-
+ * gnutls_crypto_single_mac_register:
  * @algorithm: is the gnutls algorithm identifier
  * @priority: is the priority of the algorithm
- * @version: should be set to %GNUTLS_CRYPTO_API_VERSION
  * @s: is a structure holding new algorithms's data
  *
  * This function will register a MAC algorithm to be used by gnutls.
@@ -250,18 +236,12 @@ gnutls_crypto_rnd_register2 (int priority, int version,
  * Returns: %GNUTLS_E_SUCCESS on success, otherwise an error.
  *
  * Since: 2.6.0
- **/
+ -*/
 int
-gnutls_crypto_single_mac_register2 (gnutls_mac_algorithm_t algorithm,
-                                    int priority, int version,
+gnutls_crypto_single_mac_register (gnutls_mac_algorithm_t algorithm,
+                                    int priority, 
                                     const gnutls_crypto_mac_st * s)
 {
-  if (version != GNUTLS_CRYPTO_API_VERSION)
-    {
-      gnutls_assert ();
-      return GNUTLS_E_UNIMPLEMENTED_FEATURE;
-    }
-
   return _algo_register (&glob_ml, algorithm, priority, s);
 }
 
@@ -271,11 +251,10 @@ _gnutls_get_crypto_mac (gnutls_mac_algorithm_t algo)
   return _get_algo (&glob_ml, algo);
 }
 
-/**
- * gnutls_crypto_single_digest_register2:
+/*-
+ * gnutls_crypto_single_digest_register:
  * @algorithm: is the gnutls algorithm identifier
  * @priority: is the priority of the algorithm
- * @version: should be set to %GNUTLS_CRYPTO_API_VERSION
  * @s: is a structure holding new algorithms's data
  *
  * This function will register a digest (hash) algorithm to be used by
@@ -292,18 +271,12 @@ _gnutls_get_crypto_mac (gnutls_mac_algorithm_t algo)
  * Returns: %GNUTLS_E_SUCCESS on success, otherwise an error.
  *
  * Since: 2.6.0
- **/
+ -*/
 int
-gnutls_crypto_single_digest_register2 (gnutls_digest_algorithm_t algorithm,
-                                       int priority, int version,
+gnutls_crypto_single_digest_register (gnutls_digest_algorithm_t algorithm,
+                                       int priority,
                                        const gnutls_crypto_digest_st * s)
 {
-  if (version != GNUTLS_CRYPTO_API_VERSION)
-    {
-      gnutls_assert ();
-      return GNUTLS_E_UNIMPLEMENTED_FEATURE;
-    }
-
   return _algo_register (&glob_dl, algorithm, priority, s);
 }
 
@@ -313,10 +286,9 @@ _gnutls_get_crypto_digest (gnutls_digest_algorithm_t algo)
   return _get_algo (&glob_dl, algo);
 }
 
-/**
- * gnutls_crypto_bigint_register2:
+/*-
+ * gnutls_crypto_bigint_register:
  * @priority: is the priority of the interface
- * @version: should be set to %GNUTLS_CRYPTO_API_VERSION
  * @s: is a structure holding new interface's data
  *
  * This function will register an interface for gnutls to operate
@@ -336,17 +308,11 @@ _gnutls_get_crypto_digest (gnutls_digest_algorithm_t algo)
  * Returns: %GNUTLS_E_SUCCESS on success, otherwise an error.
  *
  * Since: 2.6.0
- **/
+ -*/
 int
-gnutls_crypto_bigint_register2 (int priority, int version,
+gnutls_crypto_bigint_register (int priority,
                                 const gnutls_crypto_bigint_st * s)
 {
-  if (version != GNUTLS_CRYPTO_API_VERSION)
-    {
-      gnutls_assert ();
-      return GNUTLS_E_UNIMPLEMENTED_FEATURE;
-    }
-
   if (crypto_bigint_prio > priority)
     {
       memcpy (&_gnutls_mpi_ops, s, sizeof (*s));
@@ -357,10 +323,9 @@ gnutls_crypto_bigint_register2 (int priority, int version,
   return GNUTLS_E_CRYPTO_ALREADY_REGISTERED;
 }
 
-/**
- * gnutls_crypto_pk_register2:
+/*-
+ * gnutls_crypto_pk_register:
  * @priority: is the priority of the interface
- * @version: should be set to %GNUTLS_CRYPTO_API_VERSION
  * @s: is a structure holding new interface's data
  *
  * This function will register an interface for gnutls to operate
@@ -380,17 +345,11 @@ gnutls_crypto_bigint_register2 (int priority, int version,
  * Returns: %GNUTLS_E_SUCCESS on success, otherwise an error.
  *
  * Since: 2.6.0
- **/
+ -*/
 int
-gnutls_crypto_pk_register2 (int priority, int version,
+gnutls_crypto_pk_register (int priority,
                             const gnutls_crypto_pk_st * s)
 {
-  if (version != GNUTLS_CRYPTO_API_VERSION)
-    {
-      gnutls_assert ();
-      return GNUTLS_E_UNIMPLEMENTED_FEATURE;
-    }
-
   if (crypto_pk_prio > priority)
     {
       memcpy (&_gnutls_pk_ops, s, sizeof (*s));
@@ -401,10 +360,9 @@ gnutls_crypto_pk_register2 (int priority, int version,
   return GNUTLS_E_CRYPTO_ALREADY_REGISTERED;
 }
 
-/**
- * gnutls_crypto_cipher_register2:
+/*-
+ * gnutls_crypto_cipher_register:
  * @priority: is the priority of the cipher interface
- * @version: should be set to %GNUTLS_CRYPTO_API_VERSION
  * @s: is a structure holding new interface's data
  *
  * This function will register a cipher interface to be used by
@@ -421,17 +379,11 @@ gnutls_crypto_pk_register2 (int priority, int version,
  * Returns: %GNUTLS_E_SUCCESS on success, otherwise an error.
  *
  * Since: 2.6.0
- **/
+ -*/
 int
-gnutls_crypto_cipher_register2 (int priority, int version,
-                                const gnutls_crypto_cipher_st * s)
+gnutls_crypto_cipher_register (int priority,
+                               const gnutls_crypto_cipher_st * s)
 {
-  if (version != GNUTLS_CRYPTO_API_VERSION)
-    {
-      gnutls_assert ();
-      return GNUTLS_E_UNIMPLEMENTED_FEATURE;
-    }
-
   if (crypto_cipher_prio > priority)
     {
       memcpy (&_gnutls_cipher_ops, s, sizeof (*s));
@@ -442,10 +394,9 @@ gnutls_crypto_cipher_register2 (int priority, int version,
   return GNUTLS_E_CRYPTO_ALREADY_REGISTERED;
 }
 
-/**
- * gnutls_crypto_mac_register2:
+/*-
+ * gnutls_crypto_mac_register:
  * @priority: is the priority of the mac interface
- * @version: should be set to %GNUTLS_CRYPTO_API_VERSION
  * @s: is a structure holding new interface's data
  *
  * This function will register a mac interface to be used by
@@ -462,17 +413,11 @@ gnutls_crypto_cipher_register2 (int priority, int version,
  * Returns: %GNUTLS_E_SUCCESS on success, otherwise an error.
  *
  * Since: 2.6.0
- **/
+ -*/
 int
-gnutls_crypto_mac_register2 (int priority, int version,
+gnutls_crypto_mac_register (int priority,
                              const gnutls_crypto_mac_st * s)
 {
-  if (version != GNUTLS_CRYPTO_API_VERSION)
-    {
-      gnutls_assert ();
-      return GNUTLS_E_UNIMPLEMENTED_FEATURE;
-    }
-
   if (crypto_mac_prio > priority)
     {
       memcpy (&_gnutls_mac_ops, s, sizeof (*s));
@@ -483,10 +428,9 @@ gnutls_crypto_mac_register2 (int priority, int version,
   return GNUTLS_E_CRYPTO_ALREADY_REGISTERED;
 }
 
-/**
- * gnutls_crypto_digest_register2:
+/*-
+ * gnutls_crypto_digest_register:
  * @priority: is the priority of the digest interface
- * @version: should be set to %GNUTLS_CRYPTO_API_VERSION
  * @s: is a structure holding new interface's data
  *
  * This function will register a digest interface to be used by
@@ -503,17 +447,11 @@ gnutls_crypto_mac_register2 (int priority, int version,
  * Returns: %GNUTLS_E_SUCCESS on success, otherwise an error.
  *
  * Since: 2.6.0
- **/
+ -*/
 int
-gnutls_crypto_digest_register2 (int priority, int version,
+gnutls_crypto_digest_register (int priority,
                                 const gnutls_crypto_digest_st * s)
 {
-  if (version != GNUTLS_CRYPTO_API_VERSION)
-    {
-      gnutls_assert ();
-      return GNUTLS_E_UNIMPLEMENTED_FEATURE;
-    }
-
   if (crypto_digest_prio > priority)
     {
       memcpy (&_gnutls_digest_ops, s, sizeof (*s));
diff --git a/lib/includes/gnutls/crypto.h b/lib/crypto-backend.h
similarity index 64%
copy from lib/includes/gnutls/crypto.h
copy to lib/crypto-backend.h
index d781c07..828222b 100644
--- a/lib/includes/gnutls/crypto.h
+++ b/lib/crypto-backend.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+ * Copyright (C) 2011 Free Software Foundation, Inc.
  *
  * Author: Nikos Mavrogiannopoulos
  *
@@ -22,70 +22,14 @@
  *
  */
 
-#ifndef GNUTLS_CRYPTO_H
-#define GNUTLS_CRYPTO_H
+#ifndef GNUTLS_CRYPTO_BACKEND_H
+# define GNUTLS_CRYPTO_BACKEND_H
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-  typedef struct cipher_hd_st *gnutls_cipher_hd_t;
-
-  int gnutls_cipher_init (gnutls_cipher_hd_t * handle,
-                          gnutls_cipher_algorithm_t cipher,
-                          const gnutls_datum_t * key,
-                          const gnutls_datum_t * iv);
-  int gnutls_cipher_encrypt (const gnutls_cipher_hd_t handle,
-                             void *text, size_t textlen);
-  int gnutls_cipher_decrypt (const gnutls_cipher_hd_t handle,
-                             void *ciphertext, size_t ciphertextlen);
-  int gnutls_cipher_decrypt2 (gnutls_cipher_hd_t handle,
-                              const void *ciphertext, size_t ciphertextlen,
-                              void *text, size_t textlen);
-  int gnutls_cipher_encrypt2 (gnutls_cipher_hd_t handle, const void *text,
-                              size_t textlen, void *ciphertext,
-                              size_t ciphertextlen);
-
-  void gnutls_cipher_set_iv (gnutls_cipher_hd_t handle, void *iv, size_t 
ivlen);
-
-  int gnutls_cipher_tag( gnutls_cipher_hd_t handle, void* tag, size_t 
tag_size);
-  int gnutls_cipher_add_auth( gnutls_cipher_hd_t handle, const void* test, 
size_t textlen);
-
-  void gnutls_cipher_deinit (gnutls_cipher_hd_t handle);
-  int gnutls_cipher_get_block_size (gnutls_cipher_algorithm_t algorithm);
-
-
-  typedef struct hash_hd_st *gnutls_hash_hd_t;
-  typedef struct hmac_hd_st *gnutls_hmac_hd_t;
+# include <gnutls/crypto.h>
 
-  int gnutls_hmac_init (gnutls_hmac_hd_t * dig,
-                        gnutls_digest_algorithm_t algorithm, const void *key,
-                        size_t keylen);
-  int gnutls_hmac (gnutls_hmac_hd_t handle, const void *text, size_t textlen);
-  void gnutls_hmac_output (gnutls_hmac_hd_t handle, void *digest);
-  void gnutls_hmac_deinit (gnutls_hmac_hd_t handle, void *digest);
-  int gnutls_hmac_get_len (gnutls_mac_algorithm_t algorithm);
-  int gnutls_hmac_fast (gnutls_mac_algorithm_t algorithm, const void *key,
-                        size_t keylen, const void *text, size_t textlen,
-                        void *digest);
-
-  int gnutls_hash_init (gnutls_hash_hd_t * dig,
-                        gnutls_digest_algorithm_t algorithm);
-  int gnutls_hash (gnutls_hash_hd_t handle, const void *text, size_t textlen);
-  void gnutls_hash_output (gnutls_hash_hd_t handle, void *digest);
-  void gnutls_hash_deinit (gnutls_hash_hd_t handle, void *digest);
-  int gnutls_hash_get_len (gnutls_digest_algorithm_t algorithm);
-  int gnutls_hash_fast (gnutls_digest_algorithm_t algorithm,
-                        const void *text, size_t textlen, void *digest);
-
-/* register ciphers */
-
-#define GNUTLS_CRYPTO_API_VERSION 0x04
-
-#define gnutls_crypto_single_cipher_st gnutls_crypto_cipher_st
-#define gnutls_crypto_single_mac_st gnutls_crypto_mac_st
-#define gnutls_crypto_single_digest_st gnutls_crypto_digest_st
+# define gnutls_crypto_single_cipher_st gnutls_crypto_cipher_st
+# define gnutls_crypto_single_mac_st gnutls_crypto_mac_st
+# define gnutls_crypto_single_digest_st gnutls_crypto_digest_st
 
   typedef struct
   {
@@ -121,37 +65,6 @@ extern "C"
     void (*deinit) (void *ctx);
   } gnutls_crypto_digest_st;
 
-/**
- * gnutls_rnd_level_t:
- * @GNUTLS_RND_NONCE: Non-predictable random number.  Fatal in parts
- *   of session if broken, i.e., vulnerable to statistical analysis.
- * @GNUTLS_RND_RANDOM: Pseudo-random cryptographic random number.
- *   Fatal in session if broken.
- * @GNUTLS_RND_KEY: Fatal in many sessions if broken.
- *
- * Enumeration of random quality levels.
- */
-  typedef enum gnutls_rnd_level
-  {
-    GNUTLS_RND_NONCE = 0,
-    GNUTLS_RND_RANDOM = 1,
-    GNUTLS_RND_KEY = 2
-  } gnutls_rnd_level_t;
-
-  int gnutls_rnd (gnutls_rnd_level_t level, void *data, size_t len);
-
-
-/**
- * gnutls_pk_flag_t:
- * @GNUTLS_PK_FLAG_NONE: No flag.
- *
- * Enumeration of public-key flag.
- */
-  typedef enum
-  {
-    GNUTLS_PK_FLAG_NONE = 0
-  } gnutls_pk_flag_t;
-
   typedef struct gnutls_crypto_rnd
   {
     int (*init) (void **ctx);
@@ -161,6 +74,12 @@ extern "C"
 
   typedef void *bigint_t;
 
+  typedef struct
+  {
+    bigint_t g;                 /* group generator */
+    bigint_t p;                 /* prime */
+  } gnutls_group_st;
+
 /**
  * gnutls_bigint_format_t:
  * @GNUTLS_MPI_FORMAT_USG: Raw unsigned integer format.
@@ -180,12 +99,6 @@ extern "C"
     GNUTLS_MPI_FORMAT_PGP = 2
   } gnutls_bigint_format_t;
 
-  typedef struct
-  {
-    bigint_t g;                 /* group generator */
-    bigint_t p;                 /* prime */
-  } gnutls_group_st;
-
 /* Multi precision integer arithmetic */
   typedef struct gnutls_crypto_bigint
   {
@@ -255,6 +168,18 @@ extern "C"
     unsigned int flags;
   } gnutls_pk_params_st;
 
+/**
+ * gnutls_pk_flag_t:
+ * @GNUTLS_PK_FLAG_NONE: No flag.
+ *
+ * Enumeration of public-key flag.
+ */
+  typedef enum
+  {
+    GNUTLS_PK_FLAG_NONE = 0
+  } gnutls_pk_flag_t;
+
+
   void gnutls_pk_params_release (gnutls_pk_params_st * p);
   void gnutls_pk_params_init (gnutls_pk_params_st * p);
 
@@ -338,63 +263,33 @@ extern "C"
 /* priority: infinity for backend algorithms, 90 for kernel
    algorithms, lowest wins
  */
-#define gnutls_crypto_single_cipher_register(algo, prio, st)           \
-  gnutls_crypto_single_cipher_register2 (algo, prio, \
-                                        GNUTLS_CRYPTO_API_VERSION, st)
-#define gnutls_crypto_single_mac_register(algo, prio, st)              \
-  gnutls_crypto_single_mac_register2 (algo, prio, \
-                                     GNUTLS_CRYPTO_API_VERSION, st)
-#define gnutls_crypto_single_digest_register(algo, prio, st)           \
-  gnutls_crypto_single_digest_register2(algo, prio,                    \
-                                       GNUTLS_CRYPTO_API_VERSION, st)
-
-  int gnutls_crypto_single_cipher_register2 (gnutls_cipher_algorithm_t
+  int gnutls_crypto_single_cipher_register (gnutls_cipher_algorithm_t
                                              algorithm, int priority,
-                                             int version,
                                              const
                                              gnutls_crypto_single_cipher_st *
                                              s);
-  int gnutls_crypto_single_mac_register2 (gnutls_mac_algorithm_t algorithm,
-                                          int priority, int version,
+  int gnutls_crypto_single_mac_register (gnutls_mac_algorithm_t algorithm,
+                                          int priority,
                                           const gnutls_crypto_single_mac_st *
                                           s);
-  int gnutls_crypto_single_digest_register2 (gnutls_digest_algorithm_t
+  int gnutls_crypto_single_digest_register (gnutls_digest_algorithm_t
                                              algorithm, int priority,
-                                             int version,
                                              const
                                              gnutls_crypto_single_digest_st *
                                              s);
 
-#define gnutls_crypto_cipher_register(prio, st)                        \
-  gnutls_crypto_cipher_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
-#define gnutls_crypto_mac_register(prio, st)                           \
-  gnutls_crypto_mac_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
-#define gnutls_crypto_digest_register(prio, st)                        \
-  gnutls_crypto_digest_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
-
-  int gnutls_crypto_cipher_register2 (int priority, int version,
+  int gnutls_crypto_cipher_register (int priority,
                                       const gnutls_crypto_cipher_st * s);
-  int gnutls_crypto_mac_register2 (int priority, int version,
+  int gnutls_crypto_mac_register (int priority, 
                                    const gnutls_crypto_mac_st * s);
-  int gnutls_crypto_digest_register2 (int priority, int version,
+  int gnutls_crypto_digest_register (int priority, 
                                       const gnutls_crypto_digest_st * s);
 
-#define gnutls_crypto_rnd_register(prio, st)                           \
-  gnutls_crypto_rnd_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
-#define gnutls_crypto_pk_register(prio, st)                            \
-  gnutls_crypto_pk_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
-#define gnutls_crypto_bigint_register(prio, st)                        \
-  gnutls_crypto_bigint_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
-
-  int gnutls_crypto_rnd_register2 (int priority, int version,
+  int gnutls_crypto_rnd_register (int priority,
                                    const gnutls_crypto_rnd_st * s);
-  int gnutls_crypto_pk_register2 (int priority, int version,
+  int gnutls_crypto_pk_register (int priority,
                                   const gnutls_crypto_pk_st * s);
-  int gnutls_crypto_bigint_register2 (int priority, int version,
+  int gnutls_crypto_bigint_register (int priority,
                                       const gnutls_crypto_bigint_st * s);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif
diff --git a/lib/ext/session_ticket.c b/lib/ext/session_ticket.c
index 3bae19b..bb9eaf6 100644
--- a/lib/ext/session_ticket.c
+++ b/lib/ext/session_ticket.c
@@ -557,7 +557,7 @@ gnutls_session_ticket_enable_server (gnutls_session_t 
session,
     }
   epriv.ptr = priv;
 
-  ret = _gnutls_rnd (GNUTLS_RND_NONCE, priv->session_ticket_IV, IV_SIZE);
+  ret = gnutls_rnd (GNUTLS_RND_NONCE, priv->session_ticket_IV, IV_SIZE);
   if (ret < 0)
     {
       gnutls_assert ();
diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c
index 1130ab8..3ad6a3b 100644
--- a/lib/gnutls_cipher.c
+++ b/lib/gnutls_cipher.c
@@ -232,7 +232,7 @@ calc_enc_length (gnutls_session_t session, int data_size,
 
       break;
     case CIPHER_BLOCK:
-      ret = _gnutls_rnd (GNUTLS_RND_NONCE, &rnd, 1);
+      ret = gnutls_rnd (GNUTLS_RND_NONCE, &rnd, 1);
       if (ret < 0)
         return gnutls_assert_val(ret);
 
@@ -369,7 +369,7 @@ _gnutls_compressed2ciphertext (gnutls_session_t session,
         {
           /* copy the random IV.
            */
-          ret = _gnutls_rnd (GNUTLS_RND_NONCE, data_ptr, blocksize);
+          ret = gnutls_rnd (GNUTLS_RND_NONCE, data_ptr, blocksize);
           if (ret < 0)
             return gnutls_assert_val(ret);
 
diff --git a/lib/gnutls_cipher_int.h b/lib/gnutls_cipher_int.h
index 13de477..f16e11a 100644
--- a/lib/gnutls_cipher_int.h
+++ b/lib/gnutls_cipher_int.h
@@ -27,6 +27,7 @@
 #define GNUTLS_CIPHER_INT
 
 #include <gnutls/crypto.h>
+#include <crypto-backend.h>
 
 extern int crypto_cipher_prio;
 extern gnutls_crypto_cipher_st _gnutls_cipher_ops;
diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c
index 9eeafae..ff1a650 100644
--- a/lib/gnutls_handshake.c
+++ b/lib/gnutls_handshake.c
@@ -350,7 +350,7 @@ _gnutls_tls_create_random (opaque * dst)
   /* generate server random value */
   _gnutls_write_uint32 (tim, dst);
 
-  ret = _gnutls_rnd (GNUTLS_RND_NONCE, &dst[4], GNUTLS_RANDOM_SIZE - 4);
+  ret = gnutls_rnd (GNUTLS_RND_NONCE, &dst[4], GNUTLS_RANDOM_SIZE - 4);
   if (ret < 0)
     {
       gnutls_assert ();
@@ -3102,7 +3102,7 @@ _gnutls_generate_session_id (opaque * session_id, uint8_t 
* len)
 
   *len = TLS_MAX_SESSION_ID_SIZE;
 
-  ret = _gnutls_rnd (GNUTLS_RND_NONCE, session_id, *len);
+  ret = gnutls_rnd (GNUTLS_RND_NONCE, session_id, *len);
   if (ret < 0)
     {
       gnutls_assert ();
diff --git a/lib/gnutls_hash_int.h b/lib/gnutls_hash_int.h
index 75a8bb8..5a06024 100644
--- a/lib/gnutls_hash_int.h
+++ b/lib/gnutls_hash_int.h
@@ -28,6 +28,7 @@
 
 #include <gnutls_int.h>
 #include <gnutls/crypto.h>
+#include <crypto-backend.h>
 #include <crypto.h>
 
 /* for message digests */
diff --git a/lib/gnutls_mpi.c b/lib/gnutls_mpi.c
index 2193654..33f95f6 100644
--- a/lib/gnutls_mpi.c
+++ b/lib/gnutls_mpi.c
@@ -68,7 +68,7 @@ _gnutls_mpi_randomize (bigint_t r, unsigned int bits,
     }
 
 
-  ret = _gnutls_rnd (level, buf, size);
+  ret = gnutls_rnd (level, buf, size);
   if (ret < 0)
     {
       gnutls_assert ();
diff --git a/lib/gnutls_mpi.h b/lib/gnutls_mpi.h
index 19154ef..ef0d33f 100644
--- a/lib/gnutls_mpi.h
+++ b/lib/gnutls_mpi.h
@@ -28,7 +28,7 @@
 
 #include <gnutls_int.h>
 
-#include <gnutls/crypto.h>
+#include <crypto-backend.h>
 
 extern int crypto_bigint_prio;
 extern gnutls_crypto_bigint_st _gnutls_mpi_ops;
diff --git a/lib/gnutls_pk.c b/lib/gnutls_pk.c
index 38632f9..fa72e13 100644
--- a/lib/gnutls_pk.c
+++ b/lib/gnutls_pk.c
@@ -93,7 +93,7 @@ _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext,
           return GNUTLS_E_INTERNAL_ERROR;
         }
 
-      ret = _gnutls_rnd (GNUTLS_RND_RANDOM, ps, psize);
+      ret = gnutls_rnd (GNUTLS_RND_RANDOM, ps, psize);
       if (ret < 0)
         {
           gnutls_assert ();
@@ -103,7 +103,7 @@ _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext,
       for (i = 0; i < psize; i++)
         while (ps[i] == 0)
           {
-            ret = _gnutls_rnd (GNUTLS_RND_RANDOM, &ps[i], 1);
+            ret = gnutls_rnd (GNUTLS_RND_RANDOM, &ps[i], 1);
             if (ret < 0)
               {
                 gnutls_assert ();
diff --git a/lib/includes/gnutls/crypto.h b/lib/includes/gnutls/crypto.h
index d781c07..2681d81 100644
--- a/lib/includes/gnutls/crypto.h
+++ b/lib/includes/gnutls/crypto.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+ * Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
  *
  * Author: Nikos Mavrogiannopoulos
  *
@@ -81,45 +81,6 @@ extern "C"
 
 /* register ciphers */
 
-#define GNUTLS_CRYPTO_API_VERSION 0x04
-
-#define gnutls_crypto_single_cipher_st gnutls_crypto_cipher_st
-#define gnutls_crypto_single_mac_st gnutls_crypto_mac_st
-#define gnutls_crypto_single_digest_st gnutls_crypto_digest_st
-
-  typedef struct
-  {
-    int (*init) (gnutls_cipher_algorithm_t, void **ctx);
-    int (*setkey) (void *ctx, const void *key, size_t keysize);
-    int (*setiv) (void *ctx, const void *iv, size_t ivsize);
-    int (*encrypt) (void *ctx, const void *plain, size_t plainsize,
-                    void *encr, size_t encrsize);
-    int (*decrypt) (void *ctx, const void *encr, size_t encrsize,
-                    void *plain, size_t plainsize);
-    int (*auth) (void *ctx, const void *data, size_t datasize);
-    void (*tag) (void *ctx, void *tag, size_t tagsize);
-    void (*deinit) (void *ctx);
-  } gnutls_crypto_cipher_st;
-
-  typedef struct
-  {
-    int (*init) (gnutls_mac_algorithm_t, void **ctx);
-    int (*setkey) (void *ctx, const void *key, size_t keysize);
-    void (*reset) (void *ctx);
-    int (*hash) (void *ctx, const void *text, size_t textsize);
-    int (*output) (void *src_ctx, void *digest, size_t digestsize);
-    void (*deinit) (void *ctx);
-  } gnutls_crypto_mac_st;
-
-  typedef struct
-  {
-    int (*init) (gnutls_mac_algorithm_t, void **ctx);
-    void (*reset) (void *ctx);
-    int (*hash) (void *ctx, const void *text, size_t textsize);
-    int (*copy) (void **dst_ctx, void *src_ctx);
-    int (*output) (void *src_ctx, void *digest, size_t digestsize);
-    void (*deinit) (void *ctx);
-  } gnutls_crypto_digest_st;
 
 /**
  * gnutls_rnd_level_t:
@@ -140,259 +101,6 @@ extern "C"
 
   int gnutls_rnd (gnutls_rnd_level_t level, void *data, size_t len);
 
-
-/**
- * gnutls_pk_flag_t:
- * @GNUTLS_PK_FLAG_NONE: No flag.
- *
- * Enumeration of public-key flag.
- */
-  typedef enum
-  {
-    GNUTLS_PK_FLAG_NONE = 0
-  } gnutls_pk_flag_t;
-
-  typedef struct gnutls_crypto_rnd
-  {
-    int (*init) (void **ctx);
-    int (*rnd) (void *ctx, int level, void *data, size_t datasize);
-    void (*deinit) (void *ctx);
-  } gnutls_crypto_rnd_st;
-
-  typedef void *bigint_t;
-
-/**
- * gnutls_bigint_format_t:
- * @GNUTLS_MPI_FORMAT_USG: Raw unsigned integer format.
- * @GNUTLS_MPI_FORMAT_STD: Raw signed integer format, always a leading
- *   zero when positive.
- * @GNUTLS_MPI_FORMAT_PGP: The pgp integer format.
- *
- * Enumeration of different bignum integer encoding formats.
- */
-  typedef enum
-  {
-    /* raw unsigned integer format */
-    GNUTLS_MPI_FORMAT_USG = 0,
-    /* raw signed integer format - always a leading zero when positive */
-    GNUTLS_MPI_FORMAT_STD = 1,
-    /* the pgp integer format */
-    GNUTLS_MPI_FORMAT_PGP = 2
-  } gnutls_bigint_format_t;
-
-  typedef struct
-  {
-    bigint_t g;                 /* group generator */
-    bigint_t p;                 /* prime */
-  } gnutls_group_st;
-
-/* Multi precision integer arithmetic */
-  typedef struct gnutls_crypto_bigint
-  {
-    bigint_t (*bigint_new) (int nbits);
-    void (*bigint_release) (bigint_t n);
-    /* 0 for equality, > 0 for m1>m2, < 0 for m1<m2 */
-    int (*bigint_cmp) (const bigint_t m1, const bigint_t m2);
-    /* as bigint_cmp */
-    int (*bigint_cmp_ui) (const bigint_t m1, unsigned long m2);
-    /* ret = a % b */
-      bigint_t (*bigint_mod) (const bigint_t a, const bigint_t b);
-    /* a = b -> ret == a */
-      bigint_t (*bigint_set) (bigint_t a, const bigint_t b);
-    /* a = b -> ret == a */
-      bigint_t (*bigint_set_ui) (bigint_t a, unsigned long b);
-    unsigned int (*bigint_get_nbits) (const bigint_t a);
-    /* w = b ^ e mod m */
-      bigint_t (*bigint_powm) (bigint_t w, const bigint_t b,
-                               const bigint_t e, const bigint_t m);
-    /* w = a + b mod m */
-      bigint_t (*bigint_addm) (bigint_t w, const bigint_t a,
-                               const bigint_t b, const bigint_t m);
-    /* w = a - b mod m */
-      bigint_t (*bigint_subm) (bigint_t w, const bigint_t a, const bigint_t b,
-                               const bigint_t m);
-    /* w = a * b mod m */
-      bigint_t (*bigint_mulm) (bigint_t w, const bigint_t a, const bigint_t b,
-                               const bigint_t m);
-    /* w = a + b */ bigint_t (*bigint_add) (bigint_t w, const bigint_t a,
-                                            const bigint_t b);
-    /* w = a - b */ bigint_t (*bigint_sub) (bigint_t w, const bigint_t a,
-                                            const bigint_t b);
-    /* w = a * b */
-      bigint_t (*bigint_mul) (bigint_t w, const bigint_t a, const bigint_t b);
-    /* w = a + b */
-      bigint_t (*bigint_add_ui) (bigint_t w, const bigint_t a,
-                                 unsigned long b);
-    /* w = a - b */
-      bigint_t (*bigint_sub_ui) (bigint_t w, const bigint_t a,
-                                 unsigned long b);
-    /* w = a * b */
-      bigint_t (*bigint_mul_ui) (bigint_t w, const bigint_t a,
-                                 unsigned long b);
-    /* q = a / b */
-      bigint_t (*bigint_div) (bigint_t q, const bigint_t a, const bigint_t b);
-    /* 0 if prime */
-    int (*bigint_prime_check) (const bigint_t pp);
-    int (*bigint_generate_group) (gnutls_group_st * gg, unsigned int bits);
-
-    /* reads an bigint from a buffer */
-    /* stores an bigint into the buffer.  returns
-     * GNUTLS_E_SHORT_MEMORY_BUFFER if buf_size is not sufficient to
-     * store this integer, and updates the buf_size;
-     */
-      bigint_t (*bigint_scan) (const void *buf, size_t buf_size,
-                               gnutls_bigint_format_t format);
-    int (*bigint_print) (const bigint_t a, void *buf, size_t * buf_size,
-                         gnutls_bigint_format_t format);
-  } gnutls_crypto_bigint_st;
-
-#define GNUTLS_MAX_PK_PARAMS 16
-
-  typedef struct
-  {
-    bigint_t params[GNUTLS_MAX_PK_PARAMS];
-    unsigned int params_nr;     /* the number of parameters */
-    unsigned int flags;
-  } gnutls_pk_params_st;
-
-  void gnutls_pk_params_release (gnutls_pk_params_st * p);
-  void gnutls_pk_params_init (gnutls_pk_params_st * p);
-
-/* params are:
- * RSA:
- *  [0] is modulus
- *  [1] is public exponent
- *  [2] is private exponent (private key only)
- *  [3] is prime1 (p) (private key only)
- *  [4] is prime2 (q) (private key only)
- *  [5] is coefficient (u == inverse of p mod q) (private key only)
- *  [6] e1 == d mod (p-1)
- *  [7] e2 == d mod (q-1)
- *
- *  note that for libgcrypt that does not use the inverse of q mod p,
- *  we need to perform conversions using fixup_params().
- *
- * DSA:
- *  [0] is p
- *  [1] is q
- *  [2] is g
- *  [3] is y (public key)
- *  [4] is x (private key only)
- *
- * ECC:
- *  [0] is prime
- *  [1] is order
- *  [2] is A
- *  [3] is Gx
- *  [4] is Gy
- *  [5] is x
- *  [6] is y
- *  [7] is k (private key)
- */
-
-/**
- * gnutls_direction_t:
- * @GNUTLS_IMPORT: Import direction.
- * @GNUTLS_EXPORT: Export direction.
- *
- * Enumeration of different directions.
- */
-  typedef enum
-  {
-    GNUTLS_IMPORT = 0,
-    GNUTLS_EXPORT = 1
-  } gnutls_direction_t;
-
-/* Public key algorithms */
-  typedef struct gnutls_crypto_pk
-  {
-    /* The params structure should contain the private or public key
-     * parameters, depending on the operation */
-    int (*encrypt) (gnutls_pk_algorithm_t, gnutls_datum_t * ciphertext,
-                    const gnutls_datum_t * plaintext,
-                    const gnutls_pk_params_st * pub);
-    int (*decrypt) (gnutls_pk_algorithm_t, gnutls_datum_t * plaintext,
-                    const gnutls_datum_t * ciphertext,
-                    const gnutls_pk_params_st * priv);
-
-    int (*sign) (gnutls_pk_algorithm_t, gnutls_datum_t * signature,
-                 const gnutls_datum_t * data,
-                 const gnutls_pk_params_st * priv);
-    int (*verify) (gnutls_pk_algorithm_t, const gnutls_datum_t * data,
-                   const gnutls_datum_t * signature,
-                   const gnutls_pk_params_st * pub);
-    int (*generate) (gnutls_pk_algorithm_t, unsigned int nbits,
-                     gnutls_pk_params_st *);
-    /* this function should convert params to ones suitable
-     * for the above functions
-     */
-    int (*pk_fixup_private_params) (gnutls_pk_algorithm_t, gnutls_direction_t,
-                                    gnutls_pk_params_st *);
-    int (*derive) (gnutls_pk_algorithm_t, gnutls_datum_t * out,
-                   const gnutls_pk_params_st * priv,
-                   const gnutls_pk_params_st * pub);
-
-
-  } gnutls_crypto_pk_st;
-
-/* priority: infinity for backend algorithms, 90 for kernel
-   algorithms, lowest wins
- */
-#define gnutls_crypto_single_cipher_register(algo, prio, st)           \
-  gnutls_crypto_single_cipher_register2 (algo, prio, \
-                                        GNUTLS_CRYPTO_API_VERSION, st)
-#define gnutls_crypto_single_mac_register(algo, prio, st)              \
-  gnutls_crypto_single_mac_register2 (algo, prio, \
-                                     GNUTLS_CRYPTO_API_VERSION, st)
-#define gnutls_crypto_single_digest_register(algo, prio, st)           \
-  gnutls_crypto_single_digest_register2(algo, prio,                    \
-                                       GNUTLS_CRYPTO_API_VERSION, st)
-
-  int gnutls_crypto_single_cipher_register2 (gnutls_cipher_algorithm_t
-                                             algorithm, int priority,
-                                             int version,
-                                             const
-                                             gnutls_crypto_single_cipher_st *
-                                             s);
-  int gnutls_crypto_single_mac_register2 (gnutls_mac_algorithm_t algorithm,
-                                          int priority, int version,
-                                          const gnutls_crypto_single_mac_st *
-                                          s);
-  int gnutls_crypto_single_digest_register2 (gnutls_digest_algorithm_t
-                                             algorithm, int priority,
-                                             int version,
-                                             const
-                                             gnutls_crypto_single_digest_st *
-                                             s);
-
-#define gnutls_crypto_cipher_register(prio, st)                        \
-  gnutls_crypto_cipher_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
-#define gnutls_crypto_mac_register(prio, st)                           \
-  gnutls_crypto_mac_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
-#define gnutls_crypto_digest_register(prio, st)                        \
-  gnutls_crypto_digest_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
-
-  int gnutls_crypto_cipher_register2 (int priority, int version,
-                                      const gnutls_crypto_cipher_st * s);
-  int gnutls_crypto_mac_register2 (int priority, int version,
-                                   const gnutls_crypto_mac_st * s);
-  int gnutls_crypto_digest_register2 (int priority, int version,
-                                      const gnutls_crypto_digest_st * s);
-
-#define gnutls_crypto_rnd_register(prio, st)                           \
-  gnutls_crypto_rnd_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
-#define gnutls_crypto_pk_register(prio, st)                            \
-  gnutls_crypto_pk_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
-#define gnutls_crypto_bigint_register(prio, st)                        \
-  gnutls_crypto_bigint_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
-
-  int gnutls_crypto_rnd_register2 (int priority, int version,
-                                   const gnutls_crypto_rnd_st * s);
-  int gnutls_crypto_pk_register2 (int priority, int version,
-                                  const gnutls_crypto_pk_st * s);
-  int gnutls_crypto_bigint_register2 (int priority, int version,
-                                      const gnutls_crypto_bigint_st * s);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/libgnutls.map b/lib/libgnutls.map
index 3d906e6..042b2f9 100644
--- a/lib/libgnutls.map
+++ b/lib/libgnutls.map
@@ -102,15 +102,6 @@ GNUTLS_1_4
     gnutls_compression_set_priority;
     gnutls_credentials_clear;
     gnutls_credentials_set;
-    gnutls_crypto_bigint_register2;
-    gnutls_crypto_cipher_register2;
-    gnutls_crypto_digest_register2;
-    gnutls_crypto_mac_register2;
-    gnutls_crypto_pk_register2;
-    gnutls_crypto_rnd_register2;
-    gnutls_crypto_single_cipher_register2;
-    gnutls_crypto_single_digest_register2;
-    gnutls_crypto_single_mac_register2;
     gnutls_db_check_entry;
     gnutls_db_get_ptr;
     gnutls_db_remove_session;
@@ -724,6 +715,8 @@ GNUTLS_3_0_0 {
 GNUTLS_PRIVATE {
   global:
     # Internal symbols needed by libgnutls-extra:
+    gnutls_crypto_single_mac_register;
+    gnutls_crypto_single_digest_register;
     _gnutls_log_level;
     _gnutls_write_uint24;
     _gnutls_log;
diff --git a/lib/nettle/mpi.c b/lib/nettle/mpi.c
index e6082dd..523804b 100644
--- a/lib/nettle/mpi.c
+++ b/lib/nettle/mpi.c
@@ -461,7 +461,7 @@ gen_group (mpz_t * prime, mpz_t * generator, unsigned int 
nbits)
    */
   for (;;)
     {
-      ret = _gnutls_rnd (GNUTLS_RND_RANDOM, buffer, q_bytes);
+      ret = gnutls_rnd (GNUTLS_RND_RANDOM, buffer, q_bytes);
       if (ret < 0)
         {
           gnutls_assert ();
@@ -493,7 +493,7 @@ gen_group (mpz_t * prime, mpz_t * generator, unsigned int 
nbits)
 
   for (;;)
     {
-      ret = _gnutls_rnd (GNUTLS_RND_RANDOM, buffer, w_bytes);
+      ret = gnutls_rnd (GNUTLS_RND_RANDOM, buffer, w_bytes);
       if (ret < 0)
         {
           gnutls_assert ();
@@ -541,7 +541,7 @@ gen_group (mpz_t * prime, mpz_t * generator, unsigned int 
nbits)
 
   for (;;)
     {
-      ret = _gnutls_rnd (GNUTLS_RND_RANDOM, buffer, r_bytes);
+      ret = gnutls_rnd (GNUTLS_RND_RANDOM, buffer, r_bytes);
       if (ret < 0)
         {
           gnutls_assert ();
diff --git a/lib/nettle/pk.c b/lib/nettle/pk.c
index 2689a60..15696cd 100644
--- a/lib/nettle/pk.c
+++ b/lib/nettle/pk.c
@@ -50,7 +50,7 @@ static inline int is_supported_curve(int curve);
 static void
 rnd_func (void *_ctx, unsigned length, uint8_t * data)
 {
-  _gnutls_rnd (GNUTLS_RND_RANDOM, data, length);
+  gnutls_rnd (GNUTLS_RND_RANDOM, data, length);
 }
 
 static void
diff --git a/lib/opencdk/misc.c b/lib/opencdk/misc.c
index 7173ee8..4c50156 100644
--- a/lib/opencdk/misc.c
+++ b/lib/opencdk/misc.c
@@ -188,7 +188,7 @@ _cdk_tmpfile (void)
   FILE *fp;
   int fd, i;
 
-  _gnutls_rnd (GNUTLS_RND_NONCE, rnd, DIM (rnd));
+  gnutls_rnd (GNUTLS_RND_NONCE, rnd, DIM (rnd));
   for (i = 0; i < DIM (rnd) - 1; i++)
     {
       char c = letters[(unsigned char) rnd[i] % 26];
diff --git a/lib/pkcs11_secret.c b/lib/pkcs11_secret.c
index 3cfb1e1..3b8a80c 100644
--- a/lib/pkcs11_secret.c
+++ b/lib/pkcs11_secret.c
@@ -69,7 +69,7 @@ gnutls_pkcs11_copy_secret_key (const char *token_url, 
gnutls_datum_t * key,
     }
 
   /* generate a unique ID */
-  ret = _gnutls_rnd (GNUTLS_RND_NONCE, id, sizeof (id));
+  ret = gnutls_rnd (GNUTLS_RND_NONCE, id, sizeof (id));
   if (ret < 0)
     {
       gnutls_assert ();
diff --git a/lib/random.h b/lib/random.h
index 8475d9a..0ed2632 100644
--- a/lib/random.h
+++ b/lib/random.h
@@ -26,12 +26,11 @@
 #define RANDOM_H
 
 #include <gnutls/crypto.h>
+#include <crypto-backend.h>
 
 extern int crypto_rnd_prio;
 extern gnutls_crypto_rnd_st _gnutls_rnd_ops;
 
-int _gnutls_rnd (gnutls_rnd_level_t level, void *data, size_t len);
-#define _gnutls_rnd gnutls_rnd
 void _gnutls_rnd_deinit (void);
 int _gnutls_rnd_init (void);
 
diff --git a/lib/x509/pkcs12.c b/lib/x509/pkcs12.c
index f278612..f184c0f 100644
--- a/lib/x509/pkcs12.c
+++ b/lib/x509/pkcs12.c
@@ -880,7 +880,7 @@ gnutls_pkcs12_generate_mac (gnutls_pkcs12_t pkcs12, const 
char *pass)
 
   /* Generate the salt.
    */
-  result = _gnutls_rnd (GNUTLS_RND_NONCE, salt, sizeof (salt));
+  result = gnutls_rnd (GNUTLS_RND_NONCE, salt, sizeof (salt));
   if (result < 0)
     {
       gnutls_assert ();
diff --git a/lib/x509/privkey_pkcs8.c b/lib/x509/privkey_pkcs8.c
index 4bb99c5..3d7b21f 100644
--- a/lib/x509/privkey_pkcs8.c
+++ b/lib/x509/privkey_pkcs8.c
@@ -1905,7 +1905,7 @@ generate_key (schema_id schema,
   opaque rnd[2];
   int ret;
 
-  ret = _gnutls_rnd (GNUTLS_RND_RANDOM, rnd, 2);
+  ret = gnutls_rnd (GNUTLS_RND_RANDOM, rnd, 2);
   if (ret < 0)
     {
       gnutls_assert ();
@@ -1948,7 +1948,7 @@ generate_key (schema_id schema,
       return GNUTLS_E_INVALID_REQUEST;
     }
 
-  ret = _gnutls_rnd (GNUTLS_RND_RANDOM, kdf_params->salt,
+  ret = gnutls_rnd (GNUTLS_RND_RANDOM, kdf_params->salt,
                      kdf_params->salt_size);
   if (ret < 0)
     {
@@ -1990,7 +1990,7 @@ generate_key (schema_id schema,
 
       if (enc_params->iv_size)
         {
-          ret = _gnutls_rnd (GNUTLS_RND_NONCE,
+          ret = gnutls_rnd (GNUTLS_RND_NONCE,
                              enc_params->iv, enc_params->iv_size);
           if (ret < 0)
             {
diff --git a/libextra/gnutls_openssl.c b/libextra/gnutls_openssl.c
index 3754d96..88752a9 100644
--- a/libextra/gnutls_openssl.c
+++ b/libextra/gnutls_openssl.c
@@ -806,14 +806,14 @@ RAND_seed (const void *buf, int num)
 int
 RAND_bytes (unsigned char *buf, int num)
 {
-  _gnutls_rnd (GNUTLS_RND_RANDOM, buf, num);
+  gnutls_rnd (GNUTLS_RND_RANDOM, buf, num);
   return 1;
 }
 
 int
 RAND_pseudo_bytes (unsigned char *buf, int num)
 {
-  _gnutls_rnd (GNUTLS_RND_NONCE, buf, num);
+  gnutls_rnd (GNUTLS_RND_NONCE, buf, num);
   return 1;
 }
 
diff --git a/src/psk.c b/src/psk.c
index dab0c14..5488d61 100644
--- a/src/psk.c
+++ b/src/psk.c
@@ -44,7 +44,7 @@ main (int argc, char **argv)
 #include <gnutls/extra.h>
 #include <psk-gaa.h>
 
-#include "../lib/random.h"      /* for random */
+#include <gnutls/crypto.h>      /* for random */
 
 #include <sys/types.h>
 #include <sys/stat.h>
diff --git a/src/srptool.c b/src/srptool.c
index 742cafa..5c25c85 100644
--- a/src/srptool.c
+++ b/src/srptool.c
@@ -27,7 +27,7 @@
 #include <gnutls/gnutls.h>
 #include <gnutls/extra.h>
 #include <srptool-gaa.h>
-#include "../lib/random.h"      /* for random */
+#include <gnutls/crypto.h>      /* for random */
 
 #include <sys/types.h>
 #include <sys/stat.h>
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 48b1e41..bd25931 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -59,7 +59,7 @@ noinst_LTLIBRARIES = libutils.la
 libutils_la_SOURCES = utils.h utils.c
 
 ctests = simple gc set_pkcs12_cred certder certuniqueid mpi                    
\
-       certificate_set_x509_crl dn parse_ca moredn crypto_rng mini     \
+       certificate_set_x509_crl dn parse_ca moredn mini        \
        hostname-check cve-2008-4989 pkcs12_s2k chainverify     \
        crq_key_id x509sign-verify cve-2009-1415 cve-2009-1416          \
        crq_apis init_roundtrip pkcs12_s2k_pem dn2 mini-eagain          \
diff --git a/tests/crypto_rng.c b/tests/crypto_rng.c
deleted file mode 100644
index fbeb10c..0000000
--- a/tests/crypto_rng.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2008, 2010 Free Software Foundation, Inc.
- *
- * Author: Nikos Mavrogiannopoulos
- *
- * This file is part of GnuTLS.
- *
- * GnuTLS is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GnuTLS 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 a copy of the GNU General Public License
- * along with GnuTLS.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-
-#include "utils.h"
-
-#include <gnutls/gnutls.h>
-#include <gnutls/crypto.h>
-#include "../lib/random.h"
-
-static int
-rng_init (void **ctx)
-{
-  return 0;
-}
-
-static int
-rng_rnd (void *ctx, int level, void *data, size_t datasize)
-{
-  memset (data, 1, datasize);
-  return 0;
-}
-
-static void
-rng_deinit (void *ctx)
-{
-}
-
-void
-doit (void)
-{
-  int rc;
-  char buf1[32];
-  char buf2[32];
-  int failed = 0;
-  gnutls_crypto_rnd_st rng = { rng_init, rng_rnd, rng_deinit };
-
-
-  rc = gnutls_crypto_rnd_register (0, &rng);
-
-  gnutls_global_init ();
-
-  memset (buf2, 1, sizeof (buf2));
-
-  _gnutls_rnd (GNUTLS_RND_RANDOM, buf1, sizeof (buf1));
-
-  if (memcmp (buf1, buf2, sizeof (buf1)) != 0)
-    failed = 1;
-
-  gnutls_global_deinit ();
-
-  if (failed == 0)
-    {
-      success ("rng registered ok\n");
-    }
-  else
-    {
-      fail ("rng register test failed: %d\n", rc);
-    }
-}
diff --git a/tests/rng-fork.c b/tests/rng-fork.c
index 4bb396b..5b086b9 100644
--- a/tests/rng-fork.c
+++ b/tests/rng-fork.c
@@ -34,7 +34,6 @@
 #include "utils.h"
 #include <gnutls/gnutls.h>
 #include <gnutls/crypto.h>
-#include "../lib/random.h"
 
 #if !defined(_WIN32)
 static void dump(const char* name, unsigned char* buf, int buf_size)
@@ -65,7 +64,7 @@ doit (void)
       if (fp == NULL)
         fail("cannot open file");
       
-      _gnutls_rnd (GNUTLS_RND_RANDOM, buf1, sizeof (buf1));
+      gnutls_rnd (GNUTLS_RND_RANDOM, buf1, sizeof (buf1));
       if (debug) dump("buf1", buf1, sizeof(buf1));
       
       fwrite(buf1, 1, sizeof(buf1), fp);
@@ -74,7 +73,7 @@ doit (void)
   else
     {
       /* daddy */
-      _gnutls_rnd (GNUTLS_RND_RANDOM, buf2, sizeof (buf2));
+      gnutls_rnd (GNUTLS_RND_RANDOM, buf2, sizeof (buf2));
       if (debug) dump("buf2", buf2, sizeof(buf2));
       waitpid(pid, NULL, 0);
       


hooks/post-receive
-- 
GNU gnutls



reply via email to

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