[SCM] GNU gnutls branch, master, updated. gnutls_3_0_13-17-g7b3e70c

"Nikos Mavrogiannopoulos" <[email protected]>
Newsgroups gmane.comp.encryption.gpg.gnutls.cvs
Message-ID <[email protected]>
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=7b3e70c11682b84885374eff8d42402540168994

The branch, master has been updated
       via  7b3e70c11682b84885374eff8d42402540168994 (commit)
      from  60cbde88d2e0e67646de751d36b59da06e533aff (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 7b3e70c11682b84885374eff8d42402540168994
Author: Nikos Mavrogiannopoulos <[email protected]>
Date:   Mon Feb 20 19:37:32 2012 +0100

    properly deinitialize cryptodev resources, and only register ciphers if they are hw accelerated.

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

Summary of changes:
 lib/accelerated/cryptodev.c |   56 +++++++++++++++++++++++++++++++++++++-----
 1 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/lib/accelerated/cryptodev.c b/lib/accelerated/cryptodev.c
index 4596997..ca28d62 100644
--- a/lib/accelerated/cryptodev.c
+++ b/lib/accelerated/cryptodev.c
@@ -153,7 +153,7 @@ cryptodev_deinit (void *_ctx)
 {
   struct cryptodev_ctx *ctx = _ctx;
 
-  ioctl (ctx->cfd, CIOCFSESSION, &ctx->sess);
+  ioctl (ctx->cfd, CIOCFSESSION, &ctx->sess.ses);
   gnutls_free (ctx);
 }
 
@@ -173,6 +173,9 @@ register_crypto (int cfd)
   uint8_t fake_key[CRYPTO_CIPHER_MAX_KEY_LEN];
   unsigned int i;
   int ret;
+#ifdef CIOCGSESSINFO
+  struct session_info_op siop;
+#endif
 
   memset (&sess, 0, sizeof (sess));
 
@@ -192,7 +195,19 @@ register_crypto (int cfd)
           continue;
         }
 
-      ioctl (cfd, CIOCFSESSION, &sess);
+#ifdef CIOCGSESSINFO
+      siop.ses = sess.ses; /* do not register ciphers that are not hw accelerated */
+      if (ioctl(cfd, CIOCGSESSINFO, &siop) == 0) 
+        {
+          if (!(siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY))
+            {
+              ioctl (cfd, CIOCFSESSION, &sess.ses);
+              continue;
+            }
+        }
+#endif
+
+      ioctl (cfd, CIOCFSESSION, &sess.ses);
 
       _gnutls_debug_log ("/dev/crypto: registering: %s\n",
                          gnutls_cipher_get_name (i));
@@ -392,7 +407,7 @@ struct crypt_op cryp;
       gnutls_assert ();
       return GNUTLS_E_CRYPTODEV_IOCTL_ERROR;
     }
-  ioctl (cryptodev_fd, CIOCFSESSION, &sess);
+  ioctl (cryptodev_fd, CIOCFSESSION, &sess.ses);
   
   return 0;
 }
@@ -480,7 +495,7 @@ struct crypt_op cryp;
       gnutls_assert ();
       return GNUTLS_E_CRYPTODEV_IOCTL_ERROR;
     }
-  ioctl (cryptodev_fd, CIOCFSESSION, &sess);
+  ioctl (cryptodev_fd, CIOCFSESSION, &sess.ses);
   
   return 0;
 }
@@ -502,6 +517,9 @@ register_mac_digest (int cfd)
   uint8_t fake_key[CRYPTO_CIPHER_MAX_KEY_LEN];
   unsigned int i;
   int ret;
+#ifdef CIOCGSESSINFO
+  struct session_info_op siop;
+#endif
 
   memset (&sess, 0, sizeof (sess));
   for (i = 0; i < sizeof (gnutls_mac_map) / sizeof (gnutls_mac_map[0]); i++)
@@ -518,10 +536,22 @@ register_mac_digest (int cfd)
           continue;
         }
 
-      ioctl (cfd, CIOCFSESSION, &sess);
-
+#ifdef CIOCGSESSINFO
+      siop.ses = sess.ses; /* do not register ciphers that are not hw accelerated */
+      if (ioctl(cfd, CIOCGSESSINFO, &siop) == 0) 
+        {
+          if (!(siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY))
+            {
+              ioctl (cfd, CIOCFSESSION, &sess.ses);
+              continue;
+            }
+        }
+#endif
       _gnutls_debug_log ("/dev/crypto: registering: HMAC-%s\n",
                          gnutls_mac_get_name (i));
+
+      ioctl (cfd, CIOCFSESSION, &sess.ses);
+
       ret = gnutls_crypto_single_mac_register (i, 90, &mac_struct);
       if (ret < 0)
         {
@@ -544,7 +574,19 @@ register_mac_digest (int cfd)
           continue;
         }
 
-      ioctl (cfd, CIOCFSESSION, &sess);
+#ifdef CIOCGSESSINFO
+      siop.ses = sess.ses;
+      if (ioctl(cfd, CIOCGSESSINFO, &siop) == 0) 
+        {
+          if (!(siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY))
+            {
+              ioctl (cfd, CIOCFSESSION, &sess.ses);
+              continue;
+            }
+        }
+#endif
+
+      ioctl (cfd, CIOCFSESSION, &sess.ses);
 
       _gnutls_debug_log ("/dev/crypto: registering: %s\n",
                          gnutls_mac_get_name (i));


hooks/post-receive
-- 
GNU gnutls
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.