From dd5cc140e3a88b9cfa96aea282ea8f43a77104b3 Mon Sep 17 00:00:00 2001
From: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date: Fri, 16 Dec 2011 04:35:36 +0100
Subject: [PATCH 171/291] cryptodev: No

---
 .../crypto/cryptodev/tests/cipher-aead-srtp.c      | 24 +++-------------------
 .../staging/crypto/cryptodev/tests/cipher-aead.c   | 22 +-------------------
 .../staging/crypto/cryptodev/tests/cipher-gcm.c    | 17 +++------------
 3 files changed, 7 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/crypto/cryptodev/tests/cipher-aead-srtp.c b/drivers/staging/crypto/cryptodev/tests/cipher-aead-srtp.c
index 5a6836a60ca7..e420a40ce986 100644
--- a/drivers/staging/crypto/cryptodev/tests/cipher-aead-srtp.c
+++ b/drivers/staging/crypto/cryptodev/tests/cipher-aead-srtp.c
@@ -87,9 +87,7 @@ test_crypto(int cfd)
 	struct session_op sess;
 	struct crypt_op co;
 	struct crypt_auth_op cao;
-#ifdef CIOCGSESSINFO
 	struct session_info_op siop;
-#endif
 
 	memset(&sess, 0, sizeof(sess));
 	memset(&cao, 0, sizeof(cao));
@@ -112,7 +110,6 @@ test_crypto(int cfd)
 		return 1;
 	}
 
-#ifdef CIOCGSESSINFO
 	siop.ses = sess.ses;
 	if (ioctl(cfd, CIOCGSESSINFO, &siop)) {
 		perror("ioctl(CIOCGSESSINFO)");
@@ -123,10 +120,7 @@ test_crypto(int cfd)
 
 	plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
 	ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
-#else
-	plaintext = plaintext_raw;
-	ciphertext = ciphertext_raw;
-#endif
+
 	memset(plaintext, 0x15, HEADER_SIZE); /* header */
 	memset(&plaintext[HEADER_SIZE], 0x17, PLAINTEXT_SIZE); /* payload */
 	memset(&plaintext[HEADER_SIZE+PLAINTEXT_SIZE], 0x22, FOOTER_SIZE);
@@ -238,9 +232,7 @@ test_encrypt_decrypt(int cfd)
 
 	struct session_op sess;
 	struct crypt_auth_op cao;
-#ifdef CIOCGSESSINFO
 	struct session_info_op siop;
-#endif
 
 	memset(&sess, 0, sizeof(sess));
 	memset(&cao, 0, sizeof(cao));
@@ -262,7 +254,6 @@ test_encrypt_decrypt(int cfd)
 		return 1;
 	}
 
-#ifdef CIOCGSESSINFO
 	siop.ses = sess.ses;
 	if (ioctl(cfd, CIOCGSESSINFO, &siop)) {
 		perror("ioctl(CIOCGSESSINFO)");
@@ -273,10 +264,7 @@ test_encrypt_decrypt(int cfd)
 
 	plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
 	ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
-#else
-	plaintext = plaintext_raw;
-	ciphertext = ciphertext_raw;
-#endif
+
 	memset(plaintext, 0x15, HEADER_SIZE); /* header */
 	memset(&plaintext[HEADER_SIZE], 0x17, PLAINTEXT_SIZE); /* payload */
 	memset(&plaintext[HEADER_SIZE+PLAINTEXT_SIZE], 0x22, FOOTER_SIZE);
@@ -386,9 +374,7 @@ test_encrypt_decrypt_error(int cfd, int err)
 
 	struct session_op sess;
 	struct crypt_auth_op cao;
-#ifdef CIOCGSESSINFO
 	struct session_info_op siop;
-#endif
 
 	memset(&sess, 0, sizeof(sess));
 	memset(&cao, 0, sizeof(cao));
@@ -410,7 +396,6 @@ test_encrypt_decrypt_error(int cfd, int err)
 		return 1;
 	}
 
-#ifdef CIOCGSESSINFO
 	siop.ses = sess.ses;
 	if (ioctl(cfd, CIOCGSESSINFO, &siop)) {
 		perror("ioctl(CIOCGSESSINFO)");
@@ -421,10 +406,7 @@ test_encrypt_decrypt_error(int cfd, int err)
 
 	plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
 	ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
-#else
-	plaintext = plaintext_raw;
-	ciphertext = ciphertext_raw;
-#endif
+
 	memset(plaintext, 0x15, HEADER_SIZE); /* header */
 	memset(&plaintext[HEADER_SIZE], 0x17, PLAINTEXT_SIZE); /* payload */
 	memset(&plaintext[HEADER_SIZE+PLAINTEXT_SIZE], 0x22, FOOTER_SIZE);
diff --git a/drivers/staging/crypto/cryptodev/tests/cipher-aead.c b/drivers/staging/crypto/cryptodev/tests/cipher-aead.c
index 40470304dc7c..eba5ddcfa6cc 100644
--- a/drivers/staging/crypto/cryptodev/tests/cipher-aead.c
+++ b/drivers/staging/crypto/cryptodev/tests/cipher-aead.c
@@ -98,9 +98,7 @@ test_crypto(int cfd)
 	struct session_op sess;
 	struct crypt_op co;
 	struct crypt_auth_op cao;
-#ifdef CIOCGSESSINFO
 	struct session_info_op siop;
-#endif
 
 	memset(&sess, 0, sizeof(sess));
 	memset(&cao, 0, sizeof(cao));
@@ -124,7 +122,6 @@ test_crypto(int cfd)
 		return 1;
 	}
 
-#ifdef CIOCGSESSINFO
 	siop.ses = sess.ses;
 	if (ioctl(cfd, CIOCGSESSINFO, &siop)) {
 		perror("ioctl(CIOCGSESSINFO)");
@@ -135,10 +132,6 @@ test_crypto(int cfd)
 
 	plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
 	ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
-#else
-	plaintext = plaintext_raw;
-	ciphertext = ciphertext_raw;
-#endif
 	memset(plaintext, 0x15, DATA_SIZE);
 
 	if (get_sha1_hmac(cfd, sess.mackey, sess.mackeylen, auth, sizeof(auth), plaintext, DATA_SIZE, sha1mac) != 0) {
@@ -257,9 +250,7 @@ test_encrypt_decrypt(int cfd)
 	struct session_op sess;
 	struct crypt_op co;
 	struct crypt_auth_op cao;
-#ifdef CIOCGSESSINFO
 	struct session_info_op siop;
-#endif
 
 	memset(&sess, 0, sizeof(sess));
 	memset(&cao, 0, sizeof(cao));
@@ -283,7 +274,6 @@ test_encrypt_decrypt(int cfd)
 		return 1;
 	}
 
-#ifdef CIOCGSESSINFO
 	siop.ses = sess.ses;
 	if (ioctl(cfd, CIOCGSESSINFO, &siop)) {
 		perror("ioctl(CIOCGSESSINFO)");
@@ -294,10 +284,7 @@ test_encrypt_decrypt(int cfd)
 
 	plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
 	ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
-#else
-	plaintext = plaintext_raw;
-	ciphertext = ciphertext_raw;
-#endif
+
 	memset(plaintext, 0x15, DATA_SIZE);
 
 	if (get_sha1_hmac(cfd, sess.mackey, sess.mackeylen, auth, sizeof(auth), plaintext, DATA_SIZE, sha1mac) != 0) {
@@ -412,9 +399,7 @@ test_encrypt_decrypt_error(int cfd, int err)
 	struct session_op sess;
 	struct crypt_op co;
 	struct crypt_auth_op cao;
-#ifdef CIOCGSESSINFO
 	struct session_info_op siop;
-#endif
 
 	memset(&sess, 0, sizeof(sess));
 	memset(&cao, 0, sizeof(cao));
@@ -438,7 +423,6 @@ test_encrypt_decrypt_error(int cfd, int err)
 		return 1;
 	}
 
-#ifdef CIOCGSESSINFO
 	siop.ses = sess.ses;
 	if (ioctl(cfd, CIOCGSESSINFO, &siop)) {
 		perror("ioctl(CIOCGSESSINFO)");
@@ -449,10 +433,6 @@ test_encrypt_decrypt_error(int cfd, int err)
 
 	plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
 	ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
-#else
-	plaintext = plaintext_raw;
-	ciphertext = ciphertext_raw;
-#endif
 	memset(plaintext, 0x15, DATA_SIZE);
 
 	if (get_sha1_hmac(cfd, sess.mackey, sess.mackeylen, auth, sizeof(auth), plaintext, DATA_SIZE, sha1mac) != 0) {
diff --git a/drivers/staging/crypto/cryptodev/tests/cipher-gcm.c b/drivers/staging/crypto/cryptodev/tests/cipher-gcm.c
index bf74d4dff53a..33a1e2aef19e 100644
--- a/drivers/staging/crypto/cryptodev/tests/cipher-gcm.c
+++ b/drivers/staging/crypto/cryptodev/tests/cipher-gcm.c
@@ -193,9 +193,7 @@ static int test_encrypt_decrypt(int cfd)
 
 	struct session_op sess;
 	struct crypt_auth_op cao;
-#ifdef CIOCGSESSINFO
 	struct session_info_op siop;
-#endif
 
 	fprintf(stdout, "Tests on AES-GCM encryption/decryption: ");
 	fflush(stdout);
@@ -217,7 +215,6 @@ static int test_encrypt_decrypt(int cfd)
 		return 1;
 	}
 
-#ifdef CIOCGSESSINFO
 	siop.ses = sess.ses;
 	if (ioctl(cfd, CIOCGSESSINFO, &siop)) {
 		my_perror("ioctl(CIOCGSESSINFO)");
@@ -232,10 +229,7 @@ static int test_encrypt_decrypt(int cfd)
 	ciphertext =
 	    (char *) (((unsigned long) ciphertext_raw + siop.alignmask) &
 		      ~siop.alignmask);
-#else
-	plaintext = plaintext_raw;
-	ciphertext = ciphertext_raw;
-#endif
+
 	memset(plaintext, 0x15, DATA_SIZE);
 
 	/* Encrypt data.in to data.encrypted */
@@ -341,9 +335,7 @@ static int test_encrypt_decrypt_error(int cfd, int err)
 	struct session_op sess;
 	struct crypt_op co;
 	struct crypt_auth_op cao;
-#ifdef CIOCGSESSINFO
 	struct session_info_op siop;
-#endif
 
 	fprintf(stdout, "Tests on AES-GCM tag verification: ");
 	fflush(stdout);
@@ -371,7 +363,7 @@ static int test_encrypt_decrypt_error(int cfd, int err)
 		my_perror("ioctl(CIOCGSESSION)");
 		return 1;
 	}
-#ifdef CIOCGSESSINFO
+
 	siop.ses = sess.ses;
 	if (ioctl(cfd, CIOCGSESSINFO, &siop)) {
 		my_perror("ioctl(CIOCGSESSINFO)");
@@ -386,10 +378,7 @@ static int test_encrypt_decrypt_error(int cfd, int err)
 	ciphertext =
 	    (char *) (((unsigned long) ciphertext_raw + siop.alignmask) &
 		      ~siop.alignmask);
-#else
-	plaintext = plaintext_raw;
-	ciphertext = ciphertext_raw;
-#endif
+
 	memset(plaintext, 0x15, DATA_SIZE);
 	memcpy(ciphertext, plaintext, DATA_SIZE);
 
-- 
2.1.0

