6731839 OpenSSL PKCS#11 engine no longer uses n2cp for symmetric ciphers and digests
authorjp161948
Fri, 01 Aug 2008 05:15:07 -0700
changeset 7250 38da31a10e9f
parent 7249 b0393234b2a8
child 7251 b7bb6b75db90
6731839 OpenSSL PKCS#11 engine no longer uses n2cp for symmetric ciphers and digests
usr/src/common/openssl/crypto/engine/hw_pk11.c
--- a/usr/src/common/openssl/crypto/engine/hw_pk11.c	Fri Aug 01 03:27:13 2008 -0700
+++ b/usr/src/common/openssl/crypto/engine/hw_pk11.c	Fri Aug 01 05:15:07 2008 -0700
@@ -2877,11 +2877,11 @@
 
 		/*
 		 * If the current slot supports more ciphers/digests than 
-		 * the previous best one we change the current best to this one.
+		 * the previous best one we change the current best to this one,
 		 * otherwise leave it where it is.
 		 */
-		if ((current_slot_n_cipher > slot_n_cipher) ||
-		    (current_slot_n_digest > slot_n_digest))
+		if ((current_slot_n_cipher + current_slot_n_digest) >
+		    (slot_n_cipher + slot_n_digest))
 			{
 #ifdef	DEBUG_SLOT_SELECTION
 			fprintf(stderr,
@@ -2889,25 +2889,15 @@
 				PK11_DBG, current_slot);
 #endif	/* DEBUG_SLOT_SELECTION */
 			best_slot_sofar = SLOTID = current_slot;
-			slot_n_cipher = current_slot_n_cipher;
-			slot_n_digest = current_slot_n_digest;
-
+			cipher_count = slot_n_cipher = current_slot_n_cipher;
+			digest_count = slot_n_digest = current_slot_n_digest;
+			memcpy(cipher_nids, local_cipher_nids,
+			    sizeof(local_cipher_nids));
+			memcpy(digest_nids, local_digest_nids, 
+			    sizeof(local_digest_nids));
 			}
 		}
 
-	if (slot_n_cipher > 0)
-		{
-		cipher_count = slot_n_cipher;
-		memcpy(cipher_nids, local_cipher_nids, 
-			sizeof(local_cipher_nids));
-		}
-	if (slot_n_digest > 0)
-		{
-		digest_count = slot_n_digest;
-		memcpy(digest_nids, local_digest_nids, 
-			sizeof(local_digest_nids));
-		}
-
 #ifdef	DEBUG_SLOT_SELECTION
 	fprintf(stderr,
 	  "%s: chosen pubkey slot: %d\n", PK11_DBG, pubkey_SLOTID);