Source-Changes-HG archive

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

[src/trunk]: src/sys/opencrypto allow testing of GCM/GMAC code from userland



details:   https://anonhg.NetBSD.org/src/rev/fa62b650f967
branches:  trunk
changeset: 765454:fa62b650f967
user:      drochner <drochner%NetBSD.org@localhost>
date:      Fri May 27 17:09:09 2011 +0000

description:
allow testing of GCM/GMAC code from userland

diffstat:

 sys/opencrypto/cryptodev.c |  24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diffs (59 lines):

diff -r 5dd8890fb111 -r fa62b650f967 sys/opencrypto/cryptodev.c
--- a/sys/opencrypto/cryptodev.c        Fri May 27 17:06:54 2011 +0000
+++ b/sys/opencrypto/cryptodev.c        Fri May 27 17:09:09 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cryptodev.c,v 1.65 2011/05/26 20:33:24 drochner Exp $ */
+/*     $NetBSD: cryptodev.c,v 1.66 2011/05/27 17:09:09 drochner Exp $ */
 /*     $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $        */
 /*     $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $   */
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.65 2011/05/26 20:33:24 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.66 2011/05/27 17:09:09 drochner Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -556,6 +556,11 @@
                crde->crd_len = cop->len;
                crde->crd_inject = 0;
 
+               if (cse->cipher == CRYPTO_AES_GCM_16 && crda)
+                       crda->crd_len = 0;
+               else if (cse->cipher == CRYPTO_AES_GMAC)
+                       crde->crd_len = 0;
+
                crde->crd_alg = cse->cipher;
                crde->crd_key = cse->key;
                crde->crd_klen = cse->keylen * 8;
@@ -1533,6 +1538,12 @@
        case CRYPTO_AES_CTR:
                txform = &enc_xform_aes_ctr;
                break;
+       case CRYPTO_AES_GCM_16:
+               txform = &enc_xform_aes_gcm;
+               break;
+       case CRYPTO_AES_GMAC:
+               txform = &enc_xform_aes_gmac;
+               break;
        case CRYPTO_NULL_CBC:
                txform = &enc_xform_null;
                break;
@@ -1602,6 +1613,15 @@
        case CRYPTO_AES_XCBC_MAC_96:
                thash = &auth_hash_aes_xcbc_mac_96;
                break;
+       case CRYPTO_AES_128_GMAC:
+               thash = &auth_hash_gmac_aes_128;
+               break;
+       case CRYPTO_AES_192_GMAC:
+               thash = &auth_hash_gmac_aes_192;
+               break;
+       case CRYPTO_AES_256_GMAC:
+               thash = &auth_hash_gmac_aes_256;
+               break;
        case CRYPTO_NULL_HMAC:
                thash = &auth_hash_null;
                break;



Home | Main Index | Thread Index | Old Index