Module Name:    src
Committed By:   knakahara
Date:           Wed May 17 06:33:04 UTC 2017

Modified Files:
        src/sys/opencrypto: crypto.c cryptodev.c cryptodev.h cryptosoft.c
            deflate.c ocryptodev.c

Log Message:
opencrypto: cleanup debug messages.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/opencrypto/crypto.c
cvs rdiff -u -r1.89 -r1.90 src/sys/opencrypto/cryptodev.c
cvs rdiff -u -r1.31 -r1.32 src/sys/opencrypto/cryptodev.h
cvs rdiff -u -r1.49 -r1.50 src/sys/opencrypto/cryptosoft.c
cvs rdiff -u -r1.22 -r1.23 src/sys/opencrypto/deflate.c
cvs rdiff -u -r1.6 -r1.7 src/sys/opencrypto/ocryptodev.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/crypto.c
diff -u src/sys/opencrypto/crypto.c:1.63 src/sys/opencrypto/crypto.c:1.64
--- src/sys/opencrypto/crypto.c:1.63	Wed May 10 09:45:51 2017
+++ src/sys/opencrypto/crypto.c	Wed May 17 06:33:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: crypto.c,v 1.63 2017/05/10 09:45:51 knakahara Exp $ */
+/*	$NetBSD: crypto.c,v 1.64 2017/05/17 06:33:04 knakahara Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $	*/
 /*	$OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $	*/
 
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.63 2017/05/10 09:45:51 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.64 2017/05/17 06:33:04 knakahara Exp $");
 
 #include <sys/param.h>
 #include <sys/reboot.h>
@@ -363,7 +363,7 @@ crypto_newsession(u_int64_t *sid, struct
 		/* See if all the algorithms are supported. */
 		for (cr = cri; cr; cr = cr->cri_next)
 			if (crypto_drivers[hid].cc_alg[cr->cri_alg] == 0) {
-				DPRINTF(("crypto_newsession: alg %d not supported\n", cr->cri_alg));
+				DPRINTF("alg %d not supported\n", cr->cri_alg);
 				break;
 			}
 
@@ -387,8 +387,8 @@ crypto_newsession(u_int64_t *sid, struct
 				(*sid) |= (lid & 0xffffffff);
 				crypto_drivers[hid].cc_sessions++;
 			} else {
-				DPRINTF(("%s: crypto_drivers[%d].cc_newsession() failed. error=%d\n",
-					__func__, hid, err));
+				DPRINTF("crypto_drivers[%d].cc_newsession() failed. error=%d\n",
+					hid, err);
 			}
 			goto done;
 			/*break;*/
@@ -746,8 +746,7 @@ crypto_dispatch(struct cryptop *crp)
 	hid = CRYPTO_SESID2HID(crp->crp_sid);
 
 	mutex_spin_enter(&crypto_q_mtx);
-	DPRINTF(("crypto_dispatch: crp %p, alg %d\n",
-		crp, crp->crp_desc->crd_alg));
+	DPRINTF("crp %p, alg %d\n", crp, crp->crp_desc->crd_alg);
 
 	cryptostats.cs_ops++;
 
@@ -980,7 +979,7 @@ crypto_invoke(struct cryptop *crp, int h
 		/*
 		 * Invoke the driver to process the request.
 		 */
-		DPRINTF(("calling process for %p\n", crp));
+		DPRINTF("calling process for %p\n", crp);
 		return (*process)(arg, crp, hint);
 	} else {
 		struct cryptodesc *crd;
@@ -1015,8 +1014,7 @@ crypto_freereq(struct cryptop *crp)
 
 	if (crp == NULL)
 		return;
-	DPRINTF(("crypto_freereq[%u]: crp %p\n",
-		CRYPTO_SESID2LID(crp->crp_sid), crp));
+	DPRINTF("lid[%u]: crp %p\n", CRYPTO_SESID2LID(crp->crp_sid), crp);
 
 	/* sanity check */
 	if (crp->crp_flags & CRYPTO_F_ONRETQ) {
@@ -1076,8 +1074,7 @@ crypto_done(struct cryptop *crp)
 	if (crypto_timing)
 		crypto_tstat(&cryptostats.cs_done, &crp->crp_tstamp);
 #endif
-	DPRINTF(("crypto_done[%u]: crp %p\n",
-		CRYPTO_SESID2LID(crp->crp_sid), crp));
+	DPRINTF("lid[%u]: crp %p\n", CRYPTO_SESID2LID(crp->crp_sid), crp);
 
 	/*
 	 * Normal case; queue the callback for the thread.
@@ -1123,20 +1120,20 @@ crypto_done(struct cryptop *crp)
 			 * the same context, we can skip enqueueing crp_ret_q
 			 * and cv_signal(&cryptoret_cv).
 			 */
-			DPRINTF(("crypto_done[%u]: crp %p CRYPTO_F_USER\n",
-				CRYPTO_SESID2LID(crp->crp_sid), crp));
+			DPRINTF("lid[%u]: crp %p CRYPTO_F_USER\n",
+				CRYPTO_SESID2LID(crp->crp_sid), crp);
 		} else
 #endif
 		{
 			wasempty = TAILQ_EMPTY(&crp_ret_q);
-			DPRINTF(("crypto_done[%u]: queueing %p\n",
-				CRYPTO_SESID2LID(crp->crp_sid), crp));
+			DPRINTF("lid[%u]: queueing %p\n",
+				CRYPTO_SESID2LID(crp->crp_sid), crp);
 			crp->crp_flags |= CRYPTO_F_ONRETQ;
 			TAILQ_INSERT_TAIL(&crp_ret_q, crp, crp_next);
 			if (wasempty) {
-				DPRINTF(("crypto_done[%u]: waking cryptoret, "
+				DPRINTF("lid[%u]: waking cryptoret, "
 					"crp %p hit empty queue\n.",
-					CRYPTO_SESID2LID(crp->crp_sid), crp));
+					CRYPTO_SESID2LID(crp->crp_sid), crp);
 				cv_signal(&cryptoret_cv);
 			}
 		}

Index: src/sys/opencrypto/cryptodev.c
diff -u src/sys/opencrypto/cryptodev.c:1.89 src/sys/opencrypto/cryptodev.c:1.90
--- src/sys/opencrypto/cryptodev.c:1.89	Mon Apr 24 03:29:37 2017
+++ src/sys/opencrypto/cryptodev.c	Wed May 17 06:33:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cryptodev.c,v 1.89 2017/04/24 03:29:37 knakahara Exp $ */
+/*	$NetBSD: cryptodev.c,v 1.90 2017/05/17 06:33:04 knakahara 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.89 2017/04/24 03:29:37 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.90 2017/05/17 06:33:04 knakahara Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -336,11 +336,11 @@ mbail:
 		cse = csefind(fcr, cop->ses);
 		mutex_exit(&crypto_mtx);
 		if (cse == NULL) {
-			DPRINTF(("csefind failed\n"));
+			DPRINTF("csefind failed\n");
 			return EINVAL;
 		}
 		error = cryptodev_op(cse, cop, curlwp);
-		DPRINTF(("cryptodev_op error = %d\n", error));
+		DPRINTF("cryptodev_op error = %d\n", error);
 		break;
 	case CIOCNCRYPTM:
 		mutex_enter(&crypto_mtx);
@@ -362,7 +362,7 @@ mbail:
 		break;
 	case CIOCKEY:
 		error = cryptodev_key((struct crypt_kop *)data);
-		DPRINTF(("cryptodev_key error = %d\n", error));
+		DPRINTF("cryptodev_key error = %d\n", error);
 		break;
 	case CIOCNFKEYM:
 		mutex_enter(&crypto_mtx);
@@ -446,14 +446,14 @@ cryptodev_op(struct csession *cse, struc
 			return EINVAL;
 	}
 
-	DPRINTF(("cryptodev_op[%u]: iov_len %d\n",
-		CRYPTO_SESID2LID(cse->sid), iov_len));
+	DPRINTF("cryptodev_op[%u]: iov_len %d\n",
+		CRYPTO_SESID2LID(cse->sid), iov_len);
 	if ((cse->tcomp) && cop->dst_len) {
 		if (iov_len < cop->dst_len) {
 			/* Need larger iov to deal with decompress */
 			iov_len = cop->dst_len;
 		}
-		DPRINTF(("cryptodev_op: iov_len -> %d for decompress\n", iov_len));
+		DPRINTF("cryptodev_op: iov_len -> %d for decompress\n", iov_len);
 	}
 
 	(void)memset(&cse->uio, 0, sizeof(cse->uio));
@@ -470,17 +470,16 @@ cryptodev_op(struct csession *cse, struc
 	if (iov_len > 0)
 		cse->uio.uio_iov[0].iov_base = kmem_alloc(iov_len, KM_SLEEP);
 	cse->uio.uio_resid = cse->uio.uio_iov[0].iov_len;
-	DPRINTF(("cryptodev_op[%u]: uio.iov_base %p malloced %d bytes\n",
+	DPRINTF("lid[%u]: uio.iov_base %p malloced %d bytes\n",
 		CRYPTO_SESID2LID(cse->sid),
-		cse->uio.uio_iov[0].iov_base, iov_len));
+		cse->uio.uio_iov[0].iov_base, iov_len);
 
 	crp = crypto_getreq((cse->tcomp != NULL) + (cse->txform != NULL) + (cse->thash != NULL));
 	if (crp == NULL) {
 		error = ENOMEM;
 		goto bail;
 	}
-	DPRINTF(("cryptodev_op[%u]: crp %p\n",
-		CRYPTO_SESID2LID(cse->sid), crp));
+	DPRINTF("lid[%u]: crp %p\n", CRYPTO_SESID2LID(cse->sid), crp);
 
 	/* crds are always ordered tcomp, thash, then txform */
 	/* with optional missing links */
@@ -506,10 +505,10 @@ cryptodev_op(struct csession *cse, struc
 		}
 	}
 
-	DPRINTF(("ocf[%u]: iov_len %zu, cop->len %u\n",
+	DPRINTF("ocf[%u]: iov_len %zu, cop->len %u\n",
 			CRYPTO_SESID2LID(cse->sid),
 			cse->uio.uio_iov[0].iov_len, 
-			cop->len));
+			cop->len);
 
 	if ((error = copyin(cop->src, cse->uio.uio_iov[0].iov_base, cop->len)))
 	{
@@ -538,8 +537,8 @@ cryptodev_op(struct csession *cse, struc
 		crdc->crd_alg = cse->comp_alg;
 		crdc->crd_key = NULL;
 		crdc->crd_klen = 0;
-		DPRINTF(("cryptodev_op[%u]: crdc setup for comp_alg %d.\n",
-			CRYPTO_SESID2LID(cse->sid), crdc->crd_alg));
+		DPRINTF("lid[%u]: crdc setup for comp_alg %d.\n",
+			CRYPTO_SESID2LID(cse->sid), crdc->crd_alg);
 	}
 
 	if (crda) {
@@ -550,7 +549,7 @@ cryptodev_op(struct csession *cse, struc
 		crda->crd_alg = cse->mac;
 		crda->crd_key = cse->mackey;
 		crda->crd_klen = cse->mackeylen * 8;
-		DPRINTF(("cryptodev_op: crda setup for mac %d.\n", crda->crd_alg));
+		DPRINTF("crda setup for mac %d.\n", crda->crd_alg);
 	}
 
 	if (crde) {
@@ -575,7 +574,7 @@ cryptodev_op(struct csession *cse, struc
 		crde->crd_alg = cse->cipher;
 		crde->crd_key = cse->key;
 		crde->crd_klen = cse->keylen * 8;
-		DPRINTF(("cryptodev_op: crde setup for cipher %d.\n", crde->crd_alg));
+		DPRINTF("crde setup for cipher %d.\n", crde->crd_alg);
 	}
 
 
@@ -659,28 +658,28 @@ eagain:
 	case 0:
 		break;
 	default:
-		DPRINTF(("cryptodev_op: not waiting, error.\n"));
+		DPRINTF("not waiting, error.\n");
 		mutex_exit(&crypto_mtx);
 		cv_destroy(&crp->crp_cv);
 		goto bail;
 	}
 
 	while (!(crp->crp_flags & CRYPTO_F_DQRETQ)) {
-		DPRINTF(("cryptodev_op[%d]: sleeping on cv %p for crp %p\n",
-			(uint32_t)cse->sid, &crp->crp_cv, crp));
+		DPRINTF("cse->sid[%d]: sleeping on cv %p for crp %p\n",
+			(uint32_t)cse->sid, &crp->crp_cv, crp);
 		cv_wait(&crp->crp_cv, &crypto_mtx);	/* XXX cv_wait_sig? */
 	}
 	mutex_exit(&crypto_mtx);
 	cv_destroy(&crp->crp_cv);
 
 	if (crp->crp_etype != 0) {
-		DPRINTF(("cryptodev_op: crp_etype %d\n", crp->crp_etype));
+		DPRINTF("crp_etype %d\n", crp->crp_etype);
 		error = crp->crp_etype;
 		goto bail;
 	}
 
 	if (cse->error) {
-		DPRINTF(("cryptodev_op: cse->error %d\n", cse->error));
+		DPRINTF("cse->error %d\n", cse->error);
 		error = cse->error;
 		goto bail;
 	}
@@ -696,18 +695,18 @@ eagain:
 	}
 
 	if (cop->dst) {
-		DPRINTF(("cryptodev_op: copyout %d bytes to %p\n", dst_len, cop->dst));
+		DPRINTF("copyout %d bytes to %p\n", dst_len, cop->dst);
 	}
 	if (cop->dst &&
 	    (error = copyout(cse->uio.uio_iov[0].iov_base, cop->dst, dst_len)))
 	{
-		DPRINTF(("cryptodev_op: copyout error %d\n", error));
+		DPRINTF("copyout error %d\n", error);
 		goto bail;
 	}
 
 	if (cop->mac &&
 	    (error = copyout(crp->crp_mac, cop->mac, cse->thash->authsize))) {
-		DPRINTF(("cryptodev_op: mac copyout error %d\n", error));
+		DPRINTF("mac copyout error %d\n", error);
 		goto bail;
 	}
 
@@ -893,8 +892,7 @@ cryptodev_key(struct crypt_kop *kop)
 	mutex_exit(&crypto_mtx);
 
 	if (krp->krp_status != 0) {
-		DPRINTF(("cryptodev_key: krp->krp_status 0x%08x\n",
-		    krp->krp_status));
+		DPRINTF("krp->krp_status 0x%08x\n", krp->krp_status);
 		error = krp->krp_status;
 		goto fail;
 	}
@@ -907,8 +905,8 @@ cryptodev_key(struct crypt_kop *kop)
 		error = copyout(krp->krp_param[i].crp_p,
 		    kop->crk_param[i].crp_p, size);
 		if (error) {
-			DPRINTF(("cryptodev_key: copyout oparam %d failed, "
-			    "error=%d\n", i-krp->krp_iparams, error));
+			DPRINTF("copyout oparam %d failed, "
+			    "error=%d\n", i-krp->krp_iparams, error);
 			goto fail;
 		}
 	}
@@ -926,7 +924,7 @@ fail:
 	}
 	cv_destroy(&krp->krp_cv);
 	pool_put(&cryptkop_pool, krp);
-	DPRINTF(("cryptodev_key: error=0x%08x\n", error));
+	DPRINTF("error=0x%08x\n", error);
 	return error;
 }
 
@@ -1131,7 +1129,7 @@ cryptodev_mop(struct fcrypt *fcr, 
 		mutex_enter(&crypto_mtx);
 		cse = csefind(fcr, cnop[req].ses);
 		if (cse == NULL) {
-			DPRINTF(("csefind failed\n"));
+			DPRINTF("csefind failed\n");
 			cnop[req].status = EINVAL;
 			mutex_exit(&crypto_mtx);
 			continue;
@@ -1139,7 +1137,7 @@ cryptodev_mop(struct fcrypt *fcr, 
 		mutex_exit(&crypto_mtx);
 	
 		if (cnop[req].len > 256*1024-4) {
-			DPRINTF(("length failed\n"));
+			DPRINTF("length failed\n");
 			cnop[req].status = EINVAL;
 			continue;
 		}
@@ -1169,7 +1167,7 @@ cryptodev_mop(struct fcrypt *fcr, 
 				/* Need larger iov to deal with decompress */
 				iov_len = cnop[req].dst_len;
 			}
-			DPRINTF(("cryptodev_mop: iov_len -> %d for decompress\n", iov_len));
+			DPRINTF("iov_len -> %d for decompress\n", iov_len);
 		}
 
 		(void)memset(&crp->uio, 0, sizeof(crp->uio));
@@ -1180,7 +1178,7 @@ cryptodev_mop(struct fcrypt *fcr, 
 		UIO_SETUP_SYSSPACE(&crp->uio);
 		memset(&crp->iovec, 0, sizeof(crp->iovec));
 		crp->uio.uio_iov[0].iov_len = iov_len;
-		DPRINTF(("cryptodev_mop: kmem_alloc(%d) for iov \n", iov_len));
+		DPRINTF("kmem_alloc(%d) for iov \n", iov_len);
 		crp->uio.uio_iov[0].iov_base = kmem_alloc(iov_len, KM_SLEEP);
 		crp->uio.uio_resid = crp->uio.uio_iov[0].iov_len;
 
@@ -1228,10 +1226,10 @@ cryptodev_mop(struct fcrypt *fcr, 
 			crdc->crd_alg = cse->comp_alg;
 			crdc->crd_key = NULL;
 			crdc->crd_klen = 0;
-			DPRINTF(("cryptodev_mop[%d]: crdc setup for comp_alg %d"
+			DPRINTF("cse->sid[%d]: crdc setup for comp_alg %d"
 				 " len %d.\n",
 				(uint32_t)cse->sid, crdc->crd_alg,
-				crdc->crd_len));
+				crdc->crd_len);
 		}
 	
 		if (crda) {
@@ -1280,9 +1278,9 @@ cryptodev_mop(struct fcrypt *fcr, 
 		crp->dst = cnop[req].dst;
 		crp->len = cnop[req].len; /* input len, iov may be larger */
 		crp->mac = cnop[req].mac;
-		DPRINTF(("cryptodev_mop: iov_base %p dst %p len %d mac %p\n",
+		DPRINTF("iov_base %p dst %p len %d mac %p\n",
 			    crp->uio.uio_iov[0].iov_base, crp->dst, crp->len,
-			    crp->mac));
+			    crp->mac);
 
 		if (cnop[req].iv) {
 			if (crde == NULL) {
@@ -1340,7 +1338,7 @@ eagain:
 		case 0:
 			break;
 		default:
-			DPRINTF(("cryptodev_op: not waiting, error.\n"));
+			DPRINTF("not waiting, error.\n");
 			mutex_exit(&crypto_mtx);
 			cv_destroy(&crp->crp_cv);
 			goto bail;
@@ -1500,7 +1498,7 @@ fail:
 		}
 		error = 0;
 	}
-	DPRINTF(("cryptodev_key: error=0x%08x\n", error));
+	DPRINTF("error=0x%08x\n", error);
 	return error;
 }
 
@@ -1517,7 +1515,7 @@ cryptodev_session(struct fcrypt *fcr, st
 	u_int64_t sid;
 	int error = 0;
 
-	DPRINTF(("cryptodev_session() cipher=%d, mac=%d\n", sop->cipher, sop->mac));
+	DPRINTF("cipher=%d, mac=%d\n", sop->cipher, sop->mac);
 
 	/* XXX there must be a way to not embed the list of xforms here */
 	switch (sop->cipher) {
@@ -1560,7 +1558,7 @@ cryptodev_session(struct fcrypt *fcr, st
 		txform = &enc_xform_arc4;
 		break;
 	default:
-		DPRINTF(("Invalid cipher %d\n", sop->cipher));
+		DPRINTF("Invalid cipher %d\n", sop->cipher);
 		return EINVAL;
 	}
 
@@ -1572,10 +1570,10 @@ cryptodev_session(struct fcrypt *fcr, st
 		break;
 	case CRYPTO_GZIP_COMP:
 		tcomp = &comp_algo_gzip;
-		DPRINTF(("cryptodev_session() tcomp for GZIP\n"));
+		DPRINTF("tcomp for GZIP\n");
 		break;
 	default:
-		DPRINTF(("Invalid compression alg %d\n", sop->comp_alg));
+		DPRINTF("Invalid compression alg %d\n", sop->comp_alg);
 		return EINVAL;
 	}
 
@@ -1603,7 +1601,7 @@ cryptodev_session(struct fcrypt *fcr, st
 		} else if (sop->mackeylen == auth_hash_hmac_sha2_512.keysize) {
 			thash = &auth_hash_hmac_sha2_512;
 		} else {
-			DPRINTF(("Invalid mackeylen %d\n", sop->mackeylen));
+			DPRINTF("Invalid mackeylen %d\n", sop->mackeylen);
 			return EINVAL;
 		}
 		break;
@@ -1635,7 +1633,7 @@ cryptodev_session(struct fcrypt *fcr, st
 		thash = &auth_hash_null;
 		break;
 	default:
-		DPRINTF(("Invalid mac %d\n", sop->mac));
+		DPRINTF("Invalid mac %d\n", sop->mac);
 		return EINVAL;
 	}
 
@@ -1646,7 +1644,7 @@ cryptodev_session(struct fcrypt *fcr, st
 	if (tcomp) {
 		cric.cri_alg = tcomp->type;
 		cric.cri_klen = 0;
-		DPRINTF(("tcomp->type = %d\n", tcomp->type));
+		DPRINTF("tcomp->type = %d\n", tcomp->type);
 
 		crihead = &cric;
 		if (txform) {
@@ -1661,8 +1659,8 @@ cryptodev_session(struct fcrypt *fcr, st
 		crie.cri_klen = sop->keylen * 8;
 		if (sop->keylen > txform->maxkey ||
 		    sop->keylen < txform->minkey) {
-			DPRINTF(("keylen %d not in [%d,%d]\n",
-			    sop->keylen, txform->minkey, txform->maxkey));
+			DPRINTF("keylen %d not in [%d,%d]\n",
+			    sop->keylen, txform->minkey, txform->maxkey);
 			error = EINVAL;
 			goto bail;
 		}
@@ -1681,8 +1679,8 @@ cryptodev_session(struct fcrypt *fcr, st
 		cria.cri_alg = thash->type;
 		cria.cri_klen = sop->mackeylen * 8;
 		if (sop->mackeylen != thash->keysize) {
-			DPRINTF(("mackeylen %d != keysize %d\n",
-			    sop->mackeylen, thash->keysize));
+			DPRINTF("mackeylen %d != keysize %d\n",
+			    sop->mackeylen, thash->keysize);
 			error = EINVAL;
 			goto bail;
 		}
@@ -1701,20 +1699,19 @@ cryptodev_session(struct fcrypt *fcr, st
 
 	error = crypto_newsession(&sid, crihead, crypto_devallowsoft);
 	if (!error) {
-		DPRINTF(("cryptodev_session: got session %d\n", (uint32_t)sid));
+		DPRINTF("got session %d\n", (uint32_t)sid);
 		cse = csecreate(fcr, sid, crie.cri_key, crie.cri_klen,
 		    cria.cri_key, cria.cri_klen, (txform ? sop->cipher : 0), sop->mac,
 		    (tcomp ? sop->comp_alg : 0), txform, thash, tcomp);
 		if (cse != NULL) {
 			sop->ses = cse->ses;
 		} else {
-			DPRINTF(("csecreate failed\n"));
+			DPRINTF("csecreate failed\n");
 			crypto_freesession(sid);
 			error = EINVAL;
 		}
 	} else {
-		DPRINTF(("SIOCSESSION violates kernel parameters %d\n",
-		    error));
+		DPRINTF("SIOCSESSION violates kernel parameters %d\n", error);
 	}
 bail:
 	if (error) {
@@ -1813,7 +1810,7 @@ cryptodev_getmstatus(struct fcrypt *fcr,
 			if (cse != NULL) {
 				crypt_res[req].status = 0;
 			} else {
-				DPRINTF(("csefind failed\n"));
+				DPRINTF("csefind failed\n");
 				crypt_res[req].status = EINVAL;
 			}
 			req++;
@@ -1878,9 +1875,8 @@ bail:
 				crypt_res[req].opaque = krp->krp_usropaque;
 				completed++;
 				if (krp->krp_status != 0) {
-					DPRINTF(("cryptodev_key: "
-					    "krp->krp_status 0x%08x\n",
-					    krp->krp_status));
+					DPRINTF("krp->krp_status 0x%08x\n",
+					    krp->krp_status);
 					crypt_res[req].status = krp->krp_status;
 					goto fail;
 				}
@@ -1895,11 +1891,10 @@ bail:
 					    (krp->krp_param[i].crp_p,
 					    krp->crk_param[i].crp_p, size);
 					if (crypt_res[req].status) {
-						DPRINTF(("cryptodev_key: "
-						    "copyout oparam %d failed, "
+						DPRINTF("copyout oparam %d failed, "
 						    "error=%d\n",
 						    i - krp->krp_iparams, 
-						    crypt_res[req].status));
+						    crypt_res[req].status);
 						goto fail;
 					}
 				}
@@ -1943,7 +1938,7 @@ cryptodev_getstatus (struct fcrypt *fcr,
 		        crypt_res->opaque = crp->crp_usropaque;
 			cse = csefind(fcr, cse->ses);
 			if (cse == NULL) {
-				DPRINTF(("csefind failed\n"));
+				DPRINTF("csefind failed\n");
 				crypt_res->status = EINVAL;
 				goto bail;
 			}
@@ -1980,9 +1975,8 @@ bail:
 		if(krp && (krp->krp_reqid == crypt_res->reqid)) {
 			crypt_res[req].opaque = krp->krp_usropaque;
 			if (krp->krp_status != 0) {
-				DPRINTF(("cryptodev_key: "
-				    "krp->krp_status 0x%08x\n", 
-				    krp->krp_status));
+				DPRINTF("krp->krp_status 0x%08x\n", 
+				    krp->krp_status);
 				crypt_res[req].status = krp->krp_status;
 				goto fail;
 			}
@@ -1996,10 +1990,10 @@ bail:
 				    krp->krp_param[i].crp_p, 
 				    krp->crk_param[i].crp_p, size);
 				if (crypt_res[req].status) {
-					DPRINTF(("cryptodev_key: copyout oparam"
+					DPRINTF("copyout oparam "
 					    "%d failed, error=%d\n", 
 					    i - krp->krp_iparams, 
-					    crypt_res[req].status));
+					    crypt_res[req].status);
 					goto fail;
 				}
 			}

Index: src/sys/opencrypto/cryptodev.h
diff -u src/sys/opencrypto/cryptodev.h:1.31 src/sys/opencrypto/cryptodev.h:1.32
--- src/sys/opencrypto/cryptodev.h:1.31	Mon Apr 24 03:29:37 2017
+++ src/sys/opencrypto/cryptodev.h	Wed May 17 06:33:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cryptodev.h,v 1.31 2017/04/24 03:29:37 knakahara Exp $ */
+/*	$NetBSD: cryptodev.h,v 1.32 2017/05/17 06:33:04 knakahara Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/cryptodev.h,v 1.2.2.6 2003/07/02 17:04:50 sam Exp $	*/
 /*	$OpenBSD: cryptodev.h,v 1.33 2002/07/17 23:52:39 art Exp $	*/
 
@@ -640,11 +640,11 @@ extern int	cuio_getptr(struct uio *, int
 
 #ifdef CRYPTO_DEBUG	/* yuck, netipsec defines these differently */
 #ifndef DPRINTF
-#define DPRINTF(a) printf a
+#define DPRINTF(a, ...)	printf("%s: " a, __func__, ##__VA_ARGS__)
 #endif
 #else
 #ifndef DPRINTF
-#define DPRINTF(a)
+#define DPRINTF(a, ...)
 #endif
 #endif
 

Index: src/sys/opencrypto/cryptosoft.c
diff -u src/sys/opencrypto/cryptosoft.c:1.49 src/sys/opencrypto/cryptosoft.c:1.50
--- src/sys/opencrypto/cryptosoft.c:1.49	Tue Apr 18 17:05:05 2017
+++ src/sys/opencrypto/cryptosoft.c	Wed May 17 06:33:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cryptosoft.c,v 1.49 2017/04/18 17:05:05 maya Exp $ */
+/*	$NetBSD: cryptosoft.c,v 1.50 2017/05/17 06:33:04 knakahara Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/cryptosoft.c,v 1.2.2.1 2002/11/21 23:34:23 sam Exp $	*/
 /*	$OpenBSD: cryptosoft.c,v 1.35 2002/04/26 08:43:50 deraadt Exp $	*/
 
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cryptosoft.c,v 1.49 2017/04/18 17:05:05 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptosoft.c,v 1.50 2017/05/17 06:33:04 knakahara Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1250,7 +1250,7 @@ swcr_process(void *arg, struct cryptop *
 		case CRYPTO_DEFLATE_COMP:
 		case CRYPTO_DEFLATE_COMP_NOGROW:
 		case CRYPTO_GZIP_COMP:
-			DPRINTF(("swcr_process: compdec for %d\n", sw->sw_alg));
+			DPRINTF("compdec for %d\n", sw->sw_alg);
 			if ((crp->crp_etype = swcr_compdec(crd, sw,
 			    crp->crp_buf, type, &crp->crp_olen)) != 0)
 				goto done;
@@ -1264,7 +1264,7 @@ swcr_process(void *arg, struct cryptop *
 	}
 
 done:
-	DPRINTF(("request %p done\n", crp));
+	DPRINTF("request %p done\n", crp);
 	crypto_done(crp);
 	return 0;
 }

Index: src/sys/opencrypto/deflate.c
diff -u src/sys/opencrypto/deflate.c:1.22 src/sys/opencrypto/deflate.c:1.23
--- src/sys/opencrypto/deflate.c:1.22	Thu Mar 26 17:40:16 2015
+++ src/sys/opencrypto/deflate.c	Wed May 17 06:33:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: deflate.c,v 1.22 2015/03/26 17:40:16 prlw1 Exp $ */
+/*	$NetBSD: deflate.c,v 1.23 2017/05/17 06:33:04 knakahara Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/deflate.c,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $	*/
 /* $OpenBSD: deflate.c,v 1.3 2001/08/20 02:45:22 hugh Exp $ */
 
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: deflate.c,v 1.22 2015/03/26 17:40:16 prlw1 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: deflate.c,v 1.23 2017/05/17 06:33:04 knakahara Exp $");
 
 #include <sys/types.h>
 #include <sys/malloc.h>
@@ -88,7 +88,7 @@ deflate_global(u_int8_t *data, u_int32_t
 	int error, i, j;
 	struct deflate_buf buf[ZBUF];
 
-	DPRINTF(("deflate_global: size %u\n", size));
+	DPRINTF("size %u\n", size);
 
 	memset(&zbuf, 0, sizeof(z_stream));
 	zbuf.next_in = data;	/* data that is going to be processed */
@@ -236,7 +236,7 @@ gzip_global(u_int8_t *data, u_int32_t si
 	u_int32_t crc;
 	u_int32_t isize = 0, icrc = 0;
 
-	DPRINTF(("gzip_global: decomp %d, size %u\n", decomp, size));
+	DPRINTF("decomp %d, size %u\n", decomp, size);
 
 	memset(&zbuf, 0, sizeof(z_stream));
 	zbuf.zalloc = ocf_zalloc;
@@ -245,13 +245,13 @@ gzip_global(u_int8_t *data, u_int32_t si
 
 	if (!decomp) {
 		/* compress */
-		DPRINTF(("gzip_global: compress malloc %u + %zu + %u = %zu\n",
+		DPRINTF("compress malloc %u + %zu + %u = %zu\n",
 				size, sizeof(gzip_header), GZIP_TAIL_SIZE,
-				size + sizeof(gzip_header) + GZIP_TAIL_SIZE));
+				size + sizeof(gzip_header) + GZIP_TAIL_SIZE);
 
 		buf[0].size = size;
 		crc = crc32(0, data, size);
-		DPRINTF(("gzip_compress: size %u, crc 0x%x\n", size, crc));
+		DPRINTF("size %u, crc 0x%x\n", size, crc);
 		zbuf.avail_in = size;	/* Total length of data to be processed */
 		zbuf.next_in = data;	/* data that is going to be processed */
 	} else {
@@ -259,8 +259,7 @@ gzip_global(u_int8_t *data, u_int32_t si
 		/* check the gzip header */
 		if (size <= sizeof(gzip_header) + GZIP_TAIL_SIZE) {
 			/* Not enough data for the header & tail */
-			DPRINTF(("gzip_global: not enough data (%u)\n",
-					size));
+			DPRINTF("not enough data (%u)\n", size);
 			return 0;
 		}
 
@@ -272,11 +271,11 @@ gzip_global(u_int8_t *data, u_int32_t si
 		 * XXX add flag and field support too.
 		 */
 		if (memcmp(data, gzip_header, sizeof(gzip_header)) != 0) {
-			DPRINTF(("gzip_global: unsupported gzip header (%02x%02x)\n",
-					data[0], data[1]));
+			DPRINTF("unsupported gzip header (%02x%02x)\n",
+					data[0], data[1]);
 			return 0;
 		} else {
-			DPRINTF(("gzip_global.%d: gzip header ok\n",__LINE__));
+			DPRINTF("%d: gzip header ok\n",__LINE__);
 		}
 
 		memcpy(&isize, &data[size-sizeof(uint32_t)], sizeof(uint32_t));
@@ -284,12 +283,12 @@ gzip_global(u_int8_t *data, u_int32_t si
 		memcpy(&icrc, &data[size-2*sizeof(uint32_t)], sizeof(uint32_t));
 		LE32TOH(icrc);
 
-		DPRINTF(("gzip_global: isize = %u (%02x %02x %02x %02x)\n",
+		DPRINTF("isize = %u (%02x %02x %02x %02x)\n",
 				isize,
 				data[size-4],
 				data[size-3],
 				data[size-2],
-				data[size-1]));
+				data[size-1]);
 
 		buf[0].size = isize;
 		crc = crc32(0, NULL, 0);	/* get initial crc value */
@@ -306,8 +305,8 @@ gzip_global(u_int8_t *data, u_int32_t si
 		return 0;
 	zbuf.next_out = buf[0].out;
 	zbuf.avail_out = buf[0].size;
-	DPRINTF(("zbuf avail_in %u, avail_out %u\n",
-			zbuf.avail_in, zbuf.avail_out));
+	DPRINTF("zbuf avail_in %u, avail_out %u\n",
+			zbuf.avail_in, zbuf.avail_out);
 	i = 1;
 
 	error = decomp ? inflateInit2(&zbuf, window_inflate) :
@@ -319,12 +318,12 @@ gzip_global(u_int8_t *data, u_int32_t si
 		goto bad2;
 	}
 	for (;;) {
-		DPRINTF(("pre: %s in:%u out:%u\n", decomp ? "deflate()" : "inflate()", 
-				zbuf.avail_in, zbuf.avail_out));
+		DPRINTF("pre: %s in:%u out:%u\n", decomp ? "deflate()" : "inflate()", 
+				zbuf.avail_in, zbuf.avail_out);
 		error = decomp ? inflate(&zbuf, Z_SYNC_FLUSH) :
 				 deflate(&zbuf, Z_FINISH);
-		DPRINTF(("post: %s in:%u out:%u\n", decomp ? "deflate()" : "inflate()", 
-				zbuf.avail_in, zbuf.avail_out));
+		DPRINTF("post: %s in:%u out:%u\n", decomp ? "deflate()" : "inflate()", 
+				zbuf.avail_in, zbuf.avail_out);
 		if (error == Z_STREAM_END) /* success */
 			break;
 		/*
@@ -359,7 +358,7 @@ gzip_global(u_int8_t *data, u_int32_t si
 		count = zbuf.total_out;
 	}
 
-	DPRINTF(("gzip_global: in %u -> out %u\n", size, result));
+	DPRINTF("in %u -> out %u\n", size, result);
 
 	*out = malloc(result, M_CRYPTO_DATA, M_NOWAIT);
 	if (*out == NULL)
@@ -400,15 +399,15 @@ gzip_global(u_int8_t *data, u_int32_t si
 		HTOLE32(size);
 		memcpy(output + sizeof(uint32_t), &size, sizeof(uint32_t));
 
-		DPRINTF(("gzip_global: size = 0x%x (%02x %02x %02x %02x)\n",
+		DPRINTF("size = 0x%x (%02x %02x %02x %02x)\n",
 				size,
 				output[7],
 				output[3],
 				output[5],
-				output[4]));
+				output[4]);
 	} else {
 		if (crc != icrc || result != isize) {
-			DPRINTF(("gzip_global: crc/size mismatch\n"));
+			DPRINTF("crc/size mismatch\n");
 			free(*out, M_CRYPTO_DATA);
 			*out = NULL;
 			return 0;

Index: src/sys/opencrypto/ocryptodev.c
diff -u src/sys/opencrypto/ocryptodev.c:1.6 src/sys/opencrypto/ocryptodev.c:1.7
--- src/sys/opencrypto/ocryptodev.c:1.6	Fri Sep  5 09:23:40 2014
+++ src/sys/opencrypto/ocryptodev.c	Wed May 17 06:33:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ocryptodev.c,v 1.6 2014/09/05 09:23:40 matt Exp $ */
+/*	$NetBSD: ocryptodev.c,v 1.7 2017/05/17 06:33:04 knakahara 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 $	*/
 
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ocryptodev.c,v 1.6 2014/09/05 09:23:40 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ocryptodev.c,v 1.7 2017/05/17 06:33:04 knakahara Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -151,11 +151,11 @@ mbail:
 		cse = cryptodev_csefind(fcr, ocop->ses);
 		mutex_exit(&crypto_mtx);
 		if (cse == NULL) {
-			DPRINTF(("csefind failed\n"));
+			DPRINTF("csefind failed\n");
 			return EINVAL;
 		}
 		error = ocryptodev_op(cse, ocop, curlwp);
-		DPRINTF(("ocryptodev_op error = %d\n", error));
+		DPRINTF("ocryptodev_op error = %d\n", error);
 		break;
 	case OCIOCNCRYPTM:
 		omop = (struct ocrypt_mop *)data;
@@ -173,7 +173,7 @@ mbail:
 		kmem_free(ocnop, (omop->count * sizeof(struct ocrypt_n_op)));
 		break;	
 	default:
-		DPRINTF(("invalid ioctl cmd 0x%lx\n", cmd));
+		DPRINTF("invalid ioctl cmd 0x%lx\n", cmd);
 		return EINVAL;
 	}
 	return error;

Reply via email to