Module Name:    src
Committed By:   drochner
Date:           Fri May 27 17:09:09 UTC 2011

Modified Files:
        src/sys/opencrypto: cryptodev.c

Log Message:
allow testing of GCM/GMAC code from userland


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/opencrypto/cryptodev.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/opencrypto/cryptodev.c
diff -u src/sys/opencrypto/cryptodev.c:1.65 src/sys/opencrypto/cryptodev.c:1.66
--- src/sys/opencrypto/cryptodev.c:1.65	Thu May 26 20:33:24 2011
+++ src/sys/opencrypto/cryptodev.c	Fri May 27 17:09:09 2011
@@ -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;

Reply via email to