[SmartcardServices-Changes] [127] trunk/Tokend/PKCS11

source_changes at macosforge.org source_changes at macosforge.org
Mon Jun 7 02:13:58 PDT 2010


Revision: 127
          http://trac.macosforge.org/projects/smartcardservices/changeset/127
Author:   ludovic.rousseau at gmail.com
Date:     2010-06-07 02:13:55 -0700 (Mon, 07 Jun 2010)
Log Message:
-----------
Do some space character formatting
'( ' -> '('
' )' -> ')'
'if(' -> 'if ('

Modified Paths:
--------------
    trunk/Tokend/PKCS11/GemaltoAttributeCoder.cpp
    trunk/Tokend/PKCS11/GemaltoError.cpp
    trunk/Tokend/PKCS11/GemaltoKeyHandle.cpp
    trunk/Tokend/PKCS11/GemaltoRecord.cpp
    trunk/Tokend/PKCS11/GemaltoRecord.h
    trunk/Tokend/PKCS11/GemaltoSchema.cpp
    trunk/Tokend/PKCS11/GemaltoToken.cpp
    trunk/Tokend/PKCS11/GemaltoToken.h

Modified: trunk/Tokend/PKCS11/GemaltoAttributeCoder.cpp
===================================================================
--- trunk/Tokend/PKCS11/GemaltoAttributeCoder.cpp	2010-05-27 07:14:20 UTC (rev 126)
+++ trunk/Tokend/PKCS11/GemaltoAttributeCoder.cpp	2010-06-07 09:13:55 UTC (rev 127)
@@ -51,7 +51,7 @@
 
 void KeyEncryptAttributeCoder::decode(Tokend::TokenContext */*tokenContext*/, const Tokend::MetaAttribute &metaAttribute, Tokend::Record &record)
 {
-	GemaltoToken::log( "\nKeyEncryptAttributeCoder::decode <BEGIN>\n" );
+	GemaltoToken::log("\nKeyEncryptAttributeCoder::decode <BEGIN>\n");
 
 	GemaltoKeyRecord &keyRecord = dynamic_cast<GemaltoKeyRecord &>(record);
 	bool boolValue = true;
@@ -66,11 +66,11 @@
 	}
 
 	std::string str = "";
-	GemaltoToken::toStringHex( keyRecord.getLabel( ).ptr( ), keyRecord.getLabel().size( ), str );
-	GemaltoToken::log( "KeyEncryptAttributeCoder::decode - Class <%lu> - Value <%lu>\n", keyRecord.getClass(),  boolValue );
+	GemaltoToken::toStringHex(keyRecord.getLabel().ptr(), keyRecord.getLabel().size(), str);
+	GemaltoToken::log("KeyEncryptAttributeCoder::decode - Class <%lu> - Value <%lu>\n", keyRecord.getClass(),  boolValue);
 	record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute(boolValue));
 
-	GemaltoToken::log( "KeyEncryptAttributeCoder::decode <END>\n" );
+	GemaltoToken::log("KeyEncryptAttributeCoder::decode <END>\n");
 }
 
 
@@ -84,7 +84,7 @@
 
 void KeyDecryptAttributeCoder::decode(Tokend::TokenContext */*tokenContext*/, const Tokend::MetaAttribute &metaAttribute, Tokend::Record &record)
 {
-	GemaltoToken::log( "\nKeyDecryptAttributeCoder::decode <BEGIN>\n" );
+	GemaltoToken::log("\nKeyDecryptAttributeCoder::decode <BEGIN>\n");
 
 	GemaltoKeyRecord &keyRecord = dynamic_cast<GemaltoKeyRecord &>(record);
 	bool boolValue = true;
@@ -99,11 +99,11 @@
 	}
 
 	std::string str = "";
-	GemaltoToken::toStringHex( keyRecord.getLabel( ).ptr( ), keyRecord.getLabel().size( ), str );
-	GemaltoToken::log( "KeyDecryptAttributeCoder::decode - Label <%s> - bool <%u>\n", str.c_str(), boolValue);
+	GemaltoToken::toStringHex(keyRecord.getLabel().ptr(), keyRecord.getLabel().size(), str);
+	GemaltoToken::log("KeyDecryptAttributeCoder::decode - Label <%s> - bool <%u>\n", str.c_str(), boolValue);
 	record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute(boolValue));
 
-	GemaltoToken::log( "KeyDecryptAttributeCoder::decode <END>\n" );
+	GemaltoToken::log("KeyDecryptAttributeCoder::decode <END>\n");
 }
 
 
@@ -117,7 +117,7 @@
 
 void KeySignAttributeCoder::decode(Tokend::TokenContext */*tokenContext*/, const Tokend::MetaAttribute &metaAttribute, Tokend::Record &record)
 {
-	GemaltoToken::log( "\nKeySignAttributeCoder::decode <BEGIN>\n" );
+	GemaltoToken::log("\nKeySignAttributeCoder::decode <BEGIN>\n");
 
 	GemaltoKeyRecord &keyRecord = dynamic_cast<GemaltoKeyRecord &>(record);
 	bool boolValue = true;
@@ -132,11 +132,11 @@
 	}
 
 	std::string str = "";
-	GemaltoToken::toStringHex( keyRecord.getLabel( ).ptr( ), keyRecord.getLabel().size( ), str );
-	GemaltoToken::log( "KeySignAttributeCoder::decode - Label <%s> - bool <%u>\n", str.c_str( ), boolValue);
+	GemaltoToken::toStringHex(keyRecord.getLabel().ptr(), keyRecord.getLabel().size(), str);
+	GemaltoToken::log("KeySignAttributeCoder::decode - Label <%s> - bool <%u>\n", str.c_str(), boolValue);
 	record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute(boolValue));
 
-	GemaltoToken::log( "KeySignAttributeCoder::decode <END>\n" );
+	GemaltoToken::log("KeySignAttributeCoder::decode <END>\n");
 }
 
 
@@ -150,7 +150,7 @@
 
 void KeyVerifyAttributeCoder::decode(Tokend::TokenContext */*tokenContext*/, const Tokend::MetaAttribute &metaAttribute, Tokend::Record &record)
 {
-	GemaltoToken::log( "\nKeyVerifyAttributeCoder::decode <BEGIN>\n" );
+	GemaltoToken::log("\nKeyVerifyAttributeCoder::decode <BEGIN>\n");
 
 	GemaltoKeyRecord &keyRecord = dynamic_cast<GemaltoKeyRecord &>(record);
 	bool boolValue = true;
@@ -165,11 +165,11 @@
 	}
 
 	std::string str = "";
-	GemaltoToken::toStringHex( keyRecord.getLabel( ).ptr( ), keyRecord.getLabel().size( ), str );
-	GemaltoToken::log( "KeyVerifyAttributeCoder::decode - Label <%s> - bool <%u>\n", str.c_str( ), boolValue);
+	GemaltoToken::toStringHex(keyRecord.getLabel().ptr(), keyRecord.getLabel().size(), str);
+	GemaltoToken::log("KeyVerifyAttributeCoder::decode - Label <%s> - bool <%u>\n", str.c_str(), boolValue);
 	record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute(boolValue));
 
-	GemaltoToken::log( "KeyVerifyAttributeCoder::decode <END>\n" );
+	GemaltoToken::log("KeyVerifyAttributeCoder::decode <END>\n");
 }
 
 
@@ -183,7 +183,7 @@
 
 void KeySignRecoverAttributeCoder::decode(Tokend::TokenContext */*tokenContext*/, const Tokend::MetaAttribute &metaAttribute, Tokend::Record &record)
 {
-	GemaltoToken::log( "\nKeySignRecoverAttributeCoder::decode <BEGIN>\n" );
+	GemaltoToken::log("\nKeySignRecoverAttributeCoder::decode <BEGIN>\n");
 
 	GemaltoKeyRecord &keyRecord = dynamic_cast<GemaltoKeyRecord &>(record);
 	bool boolValue = true;
@@ -198,11 +198,11 @@
 	}
 
 	std::string str = "";
-	GemaltoToken::toStringHex( keyRecord.getLabel( ).ptr( ), keyRecord.getLabel().size( ), str );
-	GemaltoToken::log( "KeySignRecoverAttributeCoder::decode - Label <%s> - bool <%u>\n", str.c_str( ), boolValue);
+	GemaltoToken::toStringHex(keyRecord.getLabel().ptr(), keyRecord.getLabel().size(), str);
+	GemaltoToken::log("KeySignRecoverAttributeCoder::decode - Label <%s> - bool <%u>\n", str.c_str(), boolValue);
 	record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute(boolValue));
 
-	GemaltoToken::log( "KeySignRecoverAttributeCoder::decode <END>\n" );
+	GemaltoToken::log("KeySignRecoverAttributeCoder::decode <END>\n");
 }
 
 
@@ -216,7 +216,7 @@
 
 void KeyVerifyRecoverAttributeCoder::decode(Tokend::TokenContext */*tokenContext*/, const Tokend::MetaAttribute &metaAttribute, Tokend::Record &record)
 {
-	GemaltoToken::log( "\nKeyVerifyRecoverAttributeCoder::decode <BEGIN>\n" );
+	GemaltoToken::log("\nKeyVerifyRecoverAttributeCoder::decode <BEGIN>\n");
 
 	GemaltoKeyRecord &keyRecord = dynamic_cast<GemaltoKeyRecord &>(record);
 	bool boolValue = true;
@@ -231,11 +231,11 @@
 	}
 
 	std::string str = "";
-	GemaltoToken::toStringHex( keyRecord.getLabel( ).ptr( ), keyRecord.getLabel().size( ), str );
-	GemaltoToken::log( "KeyVerifyRecoverAttributeCoder::decode - Label <%s> - bool <%u>\n", str.c_str( ), boolValue);
+	GemaltoToken::toStringHex(keyRecord.getLabel().ptr(), keyRecord.getLabel().size(), str);
+	GemaltoToken::log("KeyVerifyRecoverAttributeCoder::decode - Label <%s> - bool <%u>\n", str.c_str(), boolValue);
 	record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute(boolValue));
 
-	GemaltoToken::log( "KeyVerifyRecoverAttributeCoder::decode <END>\n" );
+	GemaltoToken::log("KeyVerifyRecoverAttributeCoder::decode <END>\n");
 }
 
 
@@ -249,7 +249,7 @@
 
 void KeyWrapAttributeCoder::decode(Tokend::TokenContext */*tokenContext*/, const Tokend::MetaAttribute &metaAttribute, Tokend::Record &record)
 {
-	GemaltoToken::log( "\nKeyWrapAttributeCoder::decode <BEGIN>\n" );
+	GemaltoToken::log("\nKeyWrapAttributeCoder::decode <BEGIN>\n");
 
 	GemaltoKeyRecord &keyRecord = dynamic_cast<GemaltoKeyRecord &>(record);
 	bool boolValue = true;
@@ -264,11 +264,11 @@
 	}
 
 	std::string str = "";
-	GemaltoToken::toStringHex( keyRecord.getLabel( ).ptr( ), keyRecord.getLabel().size( ), str );
-	GemaltoToken::log( "KeyWrapAttributeCoder::decode - Label <%s> - bool <%u>\n", str.c_str(), boolValue);
+	GemaltoToken::toStringHex(keyRecord.getLabel().ptr(), keyRecord.getLabel().size(), str);
+	GemaltoToken::log("KeyWrapAttributeCoder::decode - Label <%s> - bool <%u>\n", str.c_str(), boolValue);
 	record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute(boolValue));
 
-	GemaltoToken::log( "KeyWrapAttributeCoder::decode <END>\n" );
+	GemaltoToken::log("KeyWrapAttributeCoder::decode <END>\n");
 }
 
 
@@ -282,7 +282,7 @@
 
 void KeyUnwrapAttributeCoder::decode(Tokend::TokenContext */*tokenContext*/, const Tokend::MetaAttribute &metaAttribute, Tokend::Record &record)
 {
-	GemaltoToken::log( "\nKeyUnwrapAttributeCoder::decode <BEGIN>\n" );
+	GemaltoToken::log("\nKeyUnwrapAttributeCoder::decode <BEGIN>\n");
 
 	GemaltoKeyRecord &keyRecord = dynamic_cast<GemaltoKeyRecord &>(record);
 	bool boolValue = true;
@@ -297,11 +297,11 @@
 	}
 
 	std::string str = "";
-	GemaltoToken::toStringHex( keyRecord.getLabel( ).ptr( ), keyRecord.getLabel().size( ), str );
-	GemaltoToken::log( "KeyUnwrapAttributeCoder::decode - Label <%s> - bool <%u>\n", str.c_str( ), boolValue);
+	GemaltoToken::toStringHex(keyRecord.getLabel().ptr(), keyRecord.getLabel().size(), str);
+	GemaltoToken::log("KeyUnwrapAttributeCoder::decode - Label <%s> - bool <%u>\n", str.c_str(), boolValue);
 	record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute(boolValue));
 
-	GemaltoToken::log( "KeyUnwrapAttributeCoder::decode <END>\n" );
+	GemaltoToken::log("KeyUnwrapAttributeCoder::decode <END>\n");
 }
 
 
@@ -315,17 +315,17 @@
 
 void KeyDeriveAttributeCoder::decode(Tokend::TokenContext */*tokenContext*/, const Tokend::MetaAttribute &metaAttribute, Tokend::Record &record)
 {
-	GemaltoToken::log( "\nKeyDeriveAttributeCoder::decode <BEGIN>\n" );
+	GemaltoToken::log("\nKeyDeriveAttributeCoder::decode <BEGIN>\n");
 
 	GemaltoKeyRecord &keyRecord = dynamic_cast<GemaltoKeyRecord &>(record);
 	bool boolValue = keyRecord.derive();
 
 	std::string str = "";
-	GemaltoToken::toStringHex( keyRecord.getLabel( ).ptr( ), keyRecord.getLabel().size( ), str );
-	GemaltoToken::log( "KeyDeriveAttributeCoder::decode - Label <%s> - keyType <%ld> - bool <%u>\n", keyRecord.getType( ),str.c_str( ), boolValue);
+	GemaltoToken::toStringHex(keyRecord.getLabel().ptr(), keyRecord.getLabel().size(), str);
+	GemaltoToken::log("KeyDeriveAttributeCoder::decode - Label <%s> - keyType <%ld> - bool <%u>\n", keyRecord.getType(),str.c_str(), boolValue);
 	record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute(boolValue));
 
-	GemaltoToken::log( "KeyDeriveAttributeCoder::decode <END>\n" );
+	GemaltoToken::log("KeyDeriveAttributeCoder::decode <END>\n");
 }
 
 
@@ -339,17 +339,17 @@
 
 void KeySensitiveAttributeCoder::decode(Tokend::TokenContext */*tokenContext*/, const Tokend::MetaAttribute &metaAttribute, Tokend::Record &record)
 {
-	GemaltoToken::log( "\nKeySensitiveAttributeCoder::decode <BEGIN>\n" );
+	GemaltoToken::log("\nKeySensitiveAttributeCoder::decode <BEGIN>\n");
 
 	GemaltoKeyRecord &keyRecord = dynamic_cast<GemaltoKeyRecord &>(record);
 	const bool boolValue = (keyRecord.getClass() == CKO_PRIVATE_KEY);
 
 	std::string str = "";
-	GemaltoToken::toStringHex( keyRecord.getLabel( ).ptr( ), keyRecord.getLabel().size( ), str );
-	GemaltoToken::log( "KeySensitiveAttributeCoder::decode - Label <%s> - keyType <%ld> - bool <%u>\n", keyRecord.getType( ), str.c_str( ), boolValue);
+	GemaltoToken::toStringHex(keyRecord.getLabel().ptr(), keyRecord.getLabel().size(), str);
+	GemaltoToken::log("KeySensitiveAttributeCoder::decode - Label <%s> - keyType <%ld> - bool <%u>\n", keyRecord.getType(), str.c_str(), boolValue);
 	record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute(boolValue));
 
-	GemaltoToken::log( "KeySensitiveAttributeCoder::decode <END>\n" );
+	GemaltoToken::log("KeySensitiveAttributeCoder::decode <END>\n");
 }
 
 
@@ -363,17 +363,17 @@
 
 void KeyPrivateAttributeCoder::decode(Tokend::TokenContext */*tokenContext*/, const Tokend::MetaAttribute &metaAttribute, Tokend::Record &record)
 {
-	GemaltoToken::log( "\nKeyPrivateAttributeCoder::decode <BEGIN>\n" );
+	GemaltoToken::log("\nKeyPrivateAttributeCoder::decode <BEGIN>\n");
 
 	GemaltoKeyRecord &keyRecord = dynamic_cast<GemaltoKeyRecord &>(record);
 	const bool boolValue = (keyRecord.getClass() == CKO_PRIVATE_KEY);
 
 	std::string str = "";
-	GemaltoToken::toStringHex( keyRecord.getLabel( ).ptr( ), keyRecord.getLabel().size( ), str );
-	GemaltoToken::log( "KeyPrivateAttributeCoder::decode - Label <%s> - keyType <%ld> - bool <%u>\n", keyRecord.getType( ), str.c_str( ), boolValue);
+	GemaltoToken::toStringHex(keyRecord.getLabel().ptr(), keyRecord.getLabel().size(), str);
+	GemaltoToken::log("KeyPrivateAttributeCoder::decode - Label <%s> - keyType <%ld> - bool <%u>\n", keyRecord.getType(), str.c_str(), boolValue);
 	record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute(boolValue));
 
-	GemaltoToken::log( "KeyPrivateAttributeCoder::decode <END>\n" );
+	GemaltoToken::log("KeyPrivateAttributeCoder::decode <END>\n");
 }
 
 
@@ -387,17 +387,17 @@
 
 void KeyAlwaysSensitiveAttributeCoder::decode(Tokend::TokenContext */*tokenContext*/, const Tokend::MetaAttribute &metaAttribute, Tokend::Record &record)
 {
-	GemaltoToken::log( "\nKeyAlwaysSensitiveAttributeCoder::decode <BEGIN>\n" );
+	GemaltoToken::log("\nKeyAlwaysSensitiveAttributeCoder::decode <BEGIN>\n");
 
 	GemaltoKeyRecord &keyRecord = dynamic_cast<GemaltoKeyRecord &>(record);
 	const bool boolValue = (keyRecord.getClass() == CKO_PRIVATE_KEY);
 
 	std::string str = "";
-	GemaltoToken::toStringHex( keyRecord.getLabel( ).ptr( ), keyRecord.getLabel().size( ), str );
-	GemaltoToken::log( "KeyAlwaysSensitiveAttributeCoder::decode - Label <%s> - keyType <%ld> - bool <%u>\n", keyRecord.getType( ), str.c_str( ), boolValue);
+	GemaltoToken::toStringHex(keyRecord.getLabel().ptr(), keyRecord.getLabel().size(), str);
+	GemaltoToken::log("KeyAlwaysSensitiveAttributeCoder::decode - Label <%s> - keyType <%ld> - bool <%u>\n", keyRecord.getType(), str.c_str(), boolValue);
 	record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute(boolValue));
 
-	GemaltoToken::log( "KeyAlwaysSensitiveAttributeCoder::decode <END>\n" );
+	GemaltoToken::log("KeyAlwaysSensitiveAttributeCoder::decode <END>\n");
 }
 
 
@@ -411,17 +411,17 @@
 
 void KeySizeAttributeCoder::decode(Tokend::TokenContext */*tokenContext*/, const Tokend::MetaAttribute &metaAttribute, Tokend::Record &record)
 {
-	GemaltoToken::log( "\nKeySizeAttributeCoder::decode <BEGIN>\n" );
+	GemaltoToken::log("\nKeySizeAttributeCoder::decode <BEGIN>\n");
 
 	GemaltoKeyRecord &keyRecord = dynamic_cast<GemaltoKeyRecord &>(record);
 	const uint32 longValue = keyRecord.sizeInBits();
 
 	std::string str = "";
-	GemaltoToken::toStringHex( keyRecord.getLabel( ).ptr( ), keyRecord.getLabel().size( ), str );
-	GemaltoToken::log( "KeySizeAttributeCoder::decode - Label <%s> - keyType <%ld> - size <%lu>\n", str.c_str( ), keyRecord.getType( ), longValue);
+	GemaltoToken::toStringHex(keyRecord.getLabel().ptr(), keyRecord.getLabel().size(), str);
+	GemaltoToken::log("KeySizeAttributeCoder::decode - Label <%s> - keyType <%ld> - size <%lu>\n", str.c_str(), keyRecord.getType(), longValue);
 	record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute(longValue));
 
-	GemaltoToken::log( "KeySizeAttributeCoder::decode <END>\n" );
+	GemaltoToken::log("KeySizeAttributeCoder::decode <END>\n");
 }
 
 
@@ -435,7 +435,7 @@
 
 void KeyAlgorithmAttributeCoder::decode(Tokend::TokenContext */*tokenContext*/, const Tokend::MetaAttribute &metaAttribute, Tokend::Record &record)
 {
-	GemaltoToken::log( "\nKeyAlgorithmAttributeCoder::decode <BEGIN>\n" );
+	GemaltoToken::log("\nKeyAlgorithmAttributeCoder::decode <BEGIN>\n");
 
 	GemaltoKeyRecord &keyRecord = dynamic_cast<GemaltoKeyRecord &>(record);
 	const CK_KEY_TYPE keyType = keyRecord.getType();
@@ -507,18 +507,18 @@
 		break;
 */
 	default:
-		GemaltoToken::log( "KeyAlgorithmAttributeCoder::decode - Unknown CKA_KEY_TYPE <%02lX>  - r <%p> - rid <%08lX> - aid <%lu>\n", keyType, &record, metaAttribute.metaRecord().relationId(), metaAttribute.attributeId());
+		GemaltoToken::log("KeyAlgorithmAttributeCoder::decode - Unknown CKA_KEY_TYPE <%02lX>  - r <%p> - rid <%08lX> - aid <%lu>\n", keyType, &record, metaAttribute.metaRecord().relationId(), metaAttribute.attributeId());
 		algID = CSSM_ALGID_CUSTOM;
 		break;
 	}
 
 	std::string str = "";
-	GemaltoToken::toStringHex( keyRecord.getLabel( ).ptr( ), keyRecord.getLabel().size( ), str );
-	GemaltoToken::log( "KeyAlgorithmAttributeCoder::decode - Label <%s> - keyType <%lu> - algID <%lu>\n", str.c_str( ), keyRecord.getType( ), algID);
+	GemaltoToken::toStringHex(keyRecord.getLabel().ptr(), keyRecord.getLabel().size(), str);
+	GemaltoToken::log("KeyAlgorithmAttributeCoder::decode - Label <%s> - keyType <%lu> - algID <%lu>\n", str.c_str(), keyRecord.getType(), algID);
 
 	record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute(algID));
 
-	GemaltoToken::log( "KeyAlgorithmAttributeCoder::decode <END>\n" );
+	GemaltoToken::log("KeyAlgorithmAttributeCoder::decode <END>\n");
 }
 
 
@@ -532,15 +532,15 @@
 
 void KeyNameAttributeCoder::decode(Tokend::TokenContext */*tokenContext*/, const Tokend::MetaAttribute &metaAttribute, Tokend::Record &record)
 {
-	GemaltoToken::log( "\nKeyNameAttributeCoder::decode <BEGIN>\n" );
+	GemaltoToken::log("\nKeyNameAttributeCoder::decode <BEGIN>\n");
 
 	GemaltoKeyRecord &keyRecord = dynamic_cast<GemaltoKeyRecord &>(record);
 
 	std::string str = "";
-	GemaltoToken::toStringHex( keyRecord.getLabel( ).ptr( ), keyRecord.getLabel().size( ), str );
-	GemaltoToken::log( "KeyNameAttributeCoder::decode - Label <%s>\n", str.c_str( ) );
+	GemaltoToken::toStringHex(keyRecord.getLabel().ptr(), keyRecord.getLabel().size(), str);
+	GemaltoToken::log("KeyNameAttributeCoder::decode - Label <%s>\n", str.c_str());
 
-	record.attributeAtIndex( metaAttribute.attributeIndex(), new Attribute( keyRecord.getLabel( ).ptr( ), keyRecord.getLabel( ).size( ) ) );
+	record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute(keyRecord.getLabel().ptr(), keyRecord.getLabel().size()));
 
-	GemaltoToken::log( "KeyNameAttributeCoder::decode <END>\n" );
+	GemaltoToken::log("KeyNameAttributeCoder::decode <END>\n");
 }

Modified: trunk/Tokend/PKCS11/GemaltoError.cpp
===================================================================
--- trunk/Tokend/PKCS11/GemaltoError.cpp	2010-05-27 07:14:20 UTC (rev 126)
+++ trunk/Tokend/PKCS11/GemaltoError.cpp	2010-06-07 09:13:55 UTC (rev 127)
@@ -183,7 +183,7 @@
 
 void CKError::debugDiagnose(const void *id) const
 {
-	GemaltoToken::log( "### Exception - <%p> CKError debugDiagnose <%s> <%08lX>\n", this, pkcs11_error(resultValue), resultValue);
+	GemaltoToken::log("### Exception - <%p> CKError debugDiagnose <%s> <%08lX>\n", this, pkcs11_error(resultValue), resultValue);
 }
 
 //#endif //NDEBUG
@@ -200,7 +200,7 @@
 
 OSStatus CKError::osStatus() const
 {
-	GemaltoToken::log( "### Exception - <%p> CKError osStatus <%s> <%08lX>\n", this, pkcs11_error(resultValue), resultValue);
+	GemaltoToken::log("### Exception - <%p> CKError osStatus <%s> <%08lX>\n", this, pkcs11_error(resultValue), resultValue);
 
 	// Map pkcs11 errors to CSSM
     switch (resultValue)
@@ -244,7 +244,7 @@
 
 int CKError::unixError() const
 {
-	GemaltoToken::log( "### Exception - <%p> CKError unixError <%s> <%08lX>\n", this, pkcs11_error(resultValue), resultValue);
+	GemaltoToken::log("### Exception - <%p> CKError unixError <%s> <%08lX>\n", this, pkcs11_error(resultValue), resultValue);
 
 	switch (resultValue)
 	{

Modified: trunk/Tokend/PKCS11/GemaltoKeyHandle.cpp
===================================================================
--- trunk/Tokend/PKCS11/GemaltoKeyHandle.cpp	2010-05-27 07:14:20 UTC (rev 126)
+++ trunk/Tokend/PKCS11/GemaltoKeyHandle.cpp	2010-06-07 09:13:55 UTC (rev 127)
@@ -54,23 +54,23 @@
 
 void GemaltoKeyHandle::getKeySize(CSSM_KEY_SIZE &keySize)
 {
-	GemaltoToken::log( "\nGemaltoKeyHandle::getKeySize <BEGIN>\n" );
-	GemaltoToken::log( "GemaltoKeyHandle::getOutputSize - sizeInBits <%lu>", mKey.sizeInBits() );
+	GemaltoToken::log("\nGemaltoKeyHandle::getKeySize <BEGIN>\n");
+	GemaltoToken::log("GemaltoKeyHandle::getOutputSize - sizeInBits <%lu>", mKey.sizeInBits());
 
 	keySize.EffectiveKeySizeInBits = mKey.sizeInBits();
 	keySize.LogicalKeySizeInBits = mKey.sizeInBits();
 
-	GemaltoToken::log( "GemaltoKeyHandle::getKeySize <END>\n" );
+	GemaltoToken::log("GemaltoKeyHandle::getKeySize <END>\n");
 }
 
 
 uint32 GemaltoKeyHandle::getOutputSize(const Context &/*context*/, uint32 inputSize, bool encrypting)
 {
-	GemaltoToken::log( "\nGemaltoKeyHandle::getOutputSize <BEGIN>\n" );
-	GemaltoToken::log( "GemaltoKeyHandle::getOutputSize - inputSize <%lu> - encrypting <%d>", inputSize, encrypting );
-	GemaltoToken::log( "GemaltoKeyHandle::getOutputSize - sizeInBits / 8 <%lu>", ( mKey.sizeInBits() / 8 ) );
+	GemaltoToken::log("\nGemaltoKeyHandle::getOutputSize <BEGIN>\n");
+	GemaltoToken::log("GemaltoKeyHandle::getOutputSize - inputSize <%lu> - encrypting <%d>", inputSize, encrypting);
+	GemaltoToken::log("GemaltoKeyHandle::getOutputSize - sizeInBits / 8 <%lu>", (mKey.sizeInBits() / 8));
 
-	GemaltoToken::log( "GemaltoKeyHandle::getOutputSize <END>\n" );
+	GemaltoToken::log("GemaltoKeyHandle::getOutputSize <END>\n");
 
 	return (mKey.sizeInBits() / 8);
 }
@@ -102,18 +102,18 @@
 
 void GemaltoKeyHandle::generateSignature(const Context &context, CSSM_ALGORITHMS signOnly, const CssmData &input, CssmData &signature)
 {
-	GemaltoToken::log( "\nGemaltoKeyHandle::generateSignature <BEGIN>\n" );
-	GemaltoToken::log( "Algo <%lu> - SignOnly <%lu> Input <%s> - Signature <%s>\n", context.algorithm(), signOnly, input.toHex( ).c_str( ), signature.toHex( ).c_str( ) );
+	GemaltoToken::log("\nGemaltoKeyHandle::generateSignature <BEGIN>\n");
+	GemaltoToken::log("Algo <%lu> - SignOnly <%lu> Input <%s> - Signature <%s>\n", context.algorithm(), signOnly, input.toHex().c_str(), signature.toHex().c_str());
 
 	if (context.type() != CSSM_ALGCLASS_SIGNATURE)
 	{
-		GemaltoToken::log( "## Error ## CSSMERR_CSP_INVALID_CONTEXT\n" );
+		GemaltoToken::log("## Error ## CSSMERR_CSP_INVALID_CONTEXT\n");
 		CssmError::throwMe(CSSMERR_CSP_INVALID_CONTEXT);
 	}
 
 	if (context.algorithm() != CSSM_ALGID_RSA)
 	{
-		GemaltoToken::log( "## Error ## CSSMERR_CSP_INVALID_ALGORITHM\n" );
+		GemaltoToken::log("## Error ## CSSMERR_CSP_INVALID_ALGORITHM\n");
 		CssmError::throwMe(CSSMERR_CSP_INVALID_ALGORITHM);
 	}
 
@@ -124,12 +124,12 @@
 	CK_ULONG mech = CKM_RSA_PKCS;
 	if (signOnly == CSSM_ALGID_SHA1)
 	{
-		GemaltoToken::log( "Case CSSM_ALGID_SHA1\n" );
+		GemaltoToken::log("Case CSSM_ALGID_SHA1\n");
 		//secdebug("Gemalto.tokend", "GemaltoKeyHandle: CSSM_ALGID_SHA1 (%lu)", input.Length);
 
 		if (input.Length != 20)
 		{
-			GemaltoToken::log( "## Error ## CSSMERR_CSP_BLOCK_SIZE_MISMATCH\n" );
+			GemaltoToken::log("## Error ## CSSMERR_CSP_BLOCK_SIZE_MISMATCH\n");
 			CssmError::throwMe(CSSMERR_CSP_BLOCK_SIZE_MISMATCH);
 		}
 		header = sha1sigheader;
@@ -137,12 +137,12 @@
 	}
 	else if (signOnly == CSSM_ALGID_MD5)
 	{
-		GemaltoToken::log( "Case CSSM_ALGID_MD5\n" );
+		GemaltoToken::log("Case CSSM_ALGID_MD5\n");
 		//secdebug("Gemalto.tokend", "GemaltoKeyHandle: CSSM_ALGID_MD5 (%lu)", input.Length);
 
 		if (input.Length != 16)
 		{
-			GemaltoToken::log( "## Error ## CSSMERR_CSP_BLOCK_SIZE_MISMATCH\n" );
+			GemaltoToken::log("## Error ## CSSMERR_CSP_BLOCK_SIZE_MISMATCH\n");
 			CssmError::throwMe(CSSMERR_CSP_BLOCK_SIZE_MISMATCH);
 		}
 
@@ -151,7 +151,7 @@
 	}
 	else if (signOnly == CSSM_ALGID_NONE)
 	{
-		GemaltoToken::log( "Case CSSM_ALGID_NONE\n" );
+		GemaltoToken::log("Case CSSM_ALGID_NONE\n");
 		//secdebug("Gemalto.tokend", "GemaltoKeyHandle: CSSM_ALGID_NONE");
 
 		// Special case used by SSL it's an RSA signature, without the ASN1 stuff
@@ -160,7 +160,7 @@
 	}
 	else
 	{
-		GemaltoToken::log( "## Error ## CSSMERR_CSP_INVALID_DIGEST_ALGORITHM\n" );
+		GemaltoToken::log("## Error ## CSSMERR_CSP_INVALID_DIGEST_ALGORITHM\n");
 		//secdebug("Gemalto.tokend", "GemaltoKeyHandle: Invalid sign algo");
 		CssmError::throwMe(CSSMERR_CSP_INVALID_DIGEST_ALGORITHM);
 	}
@@ -175,7 +175,7 @@
 	// Get padding, but default to pkcs1 style padding
 	uint32 padding = CSSM_PADDING_PKCS1;
 	context.getInt(CSSM_ATTRIBUTE_PADDING, padding);
-	GemaltoToken::log( "Padding <%lu>\n", padding );
+	GemaltoToken::log("Padding <%lu>\n", padding);
 
 //JCD
 /*
@@ -185,7 +185,7 @@
 		}
 */
 	// Gemalto pkcs11 can handle PKCS1 padding only
-	switch( padding )
+	switch(padding)
 	{
 		case CSSM_PADDING_PKCS1:
 		mech = CKM_RSA_PKCS;
@@ -206,10 +206,10 @@
 		case CSSM_PADDING_RANDOM:
 		case CSSM_PADDING_VENDOR_DEFINED:
 		default:
-		GemaltoToken::log( "## Error ## CSSMERR_CSP_INVALID_ATTR_PADDING\n" );
+		GemaltoToken::log("## Error ## CSSMERR_CSP_INVALID_ATTR_PADDING\n");
 		CssmError::throwMe(CSSMERR_CSP_INVALID_ATTR_PADDING);
 	}
-	GemaltoToken::log( "Mechanism <%lu>\n", mech );
+	GemaltoToken::log("Mechanism <%lu>\n", mech);
 //JCD
 
 	// Now copy the ASN1 header into the input buffer.
@@ -238,7 +238,7 @@
 	}
 	catch (...)
 	{
-		GemaltoToken::log( "## Error ## key computeSign\n" );
+		GemaltoToken::log("## Error ## key computeSign\n");
 
 		// @@@ Switch to using tokend allocators
 		free(outputData);
@@ -248,15 +248,15 @@
 	signature.Data = outputData;
 	signature.Length = outputLength;
 
-	GemaltoToken::log( "GemaltoKeyHandle::generateSignature <END>\n" );
+	GemaltoToken::log("GemaltoKeyHandle::generateSignature <END>\n");
 }
 
 
 void GemaltoKeyHandle::verifySignature(const Context &/*context*/, CSSM_ALGORITHMS /*signOnly*/, const CssmData &/*input*/, const CssmData &/*signature*/)
 {
-	GemaltoToken::log( "\nGemaltoKeyHandle::verifySignature <BEGIN>\n" );
-	GemaltoToken::log( "## Error ## CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED\n" );
-	GemaltoToken::log( "GemaltoKeyHandle::verifySignature <END>\n" );
+	GemaltoToken::log("\nGemaltoKeyHandle::verifySignature <BEGIN>\n");
+	GemaltoToken::log("## Error ## CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED\n");
+	GemaltoToken::log("GemaltoKeyHandle::verifySignature <END>\n");
 
 	CssmError::throwMe(CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED);
 }
@@ -264,9 +264,9 @@
 
 void GemaltoKeyHandle::generateMac(const Context &/*context*/, const CssmData &/*input*/, CssmData &/*output*/)
 {
-	GemaltoToken::log( "\nGemaltoKeyHandle::generateMac <BEGIN>\n" );
-	GemaltoToken::log( "## Error ## CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED\n" );
-	GemaltoToken::log( "GemaltoKeyHandle::generateMac <END>\n" );
+	GemaltoToken::log("\nGemaltoKeyHandle::generateMac <BEGIN>\n");
+	GemaltoToken::log("## Error ## CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED\n");
+	GemaltoToken::log("GemaltoKeyHandle::generateMac <END>\n");
 
 	CssmError::throwMe(CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED);
 }
@@ -274,9 +274,9 @@
 
 void GemaltoKeyHandle::verifyMac(const Context &, const CssmData &, const CssmData &)
 {
-	GemaltoToken::log( "\nGemaltoKeyHandle::verifyMac <BEGIN>\n" );
-	GemaltoToken::log( "## Error ## CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED\n" );
-	GemaltoToken::log( "GemaltoKeyHandle::verifyMac <END>\n" );
+	GemaltoToken::log("\nGemaltoKeyHandle::verifyMac <BEGIN>\n");
+	GemaltoToken::log("## Error ## CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED\n");
+	GemaltoToken::log("GemaltoKeyHandle::verifyMac <END>\n");
 
 	CssmError::throwMe(CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED);
 }
@@ -284,9 +284,9 @@
 
 void GemaltoKeyHandle::encrypt(const Context &, const CssmData &, CssmData &)
 {
-	GemaltoToken::log( "\nGemaltoKeyHandle::encrypt <BEGIN>\n" );
-	GemaltoToken::log( "## Error ## CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED\n" );
-	GemaltoToken::log( "GemaltoKeyHandle::encrypt <END>\n" );
+	GemaltoToken::log("\nGemaltoKeyHandle::encrypt <BEGIN>\n");
+	GemaltoToken::log("## Error ## CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED\n");
+	GemaltoToken::log("GemaltoKeyHandle::encrypt <END>\n");
 
 	CssmError::throwMe(CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED);
 }
@@ -294,20 +294,20 @@
 
 void GemaltoKeyHandle::decrypt(const Context &context, const CssmData &cipher, CssmData &clear)
 {
-	GemaltoToken::log( "\nGemaltoKeyHandle::decrypt <BEGIN>\n" );
-	GemaltoToken::log( "Alg <%lu> - cipher <%s> - clear <%s>\n", context.algorithm( ), cipher.toHex( ).c_str( ), clear.toHex( ).c_str( ) );
+	GemaltoToken::log("\nGemaltoKeyHandle::decrypt <BEGIN>\n");
+	GemaltoToken::log("Alg <%lu> - cipher <%s> - clear <%s>\n", context.algorithm(), cipher.toHex().c_str(), clear.toHex().c_str());
 
 	size_t keyLength = mKey.sizeInBits() / 8;
 
 	// Get padding, but default to pkcs1 style padding
 	uint32 padding = CSSM_PADDING_PKCS1;
 	context.getInt(CSSM_ATTRIBUTE_PADDING, padding);
-	GemaltoToken::log( "Padding <%lu>\n", padding );
+	GemaltoToken::log("Padding <%lu>\n", padding);
 
 	// Gemalto pkcs11 can handle PKCS1 padding only
 	if (padding != CSSM_PADDING_PKCS1)
 	{
-		GemaltoToken::log( "## Error ## CSSMERR_CSP_INVALID_ATTR_PADDING\n" );
+		GemaltoToken::log("## Error ## CSSMERR_CSP_INVALID_ATTR_PADDING\n");
 		CssmError::throwMe(CSSMERR_CSP_INVALID_ATTR_PADDING);
 	}
 
@@ -323,7 +323,7 @@
 	}
 	catch (...)
 	{
-		GemaltoToken::log( "## Error ## mKey.computeDecrypt\n" );
+		GemaltoToken::log("## Error ## mKey.computeDecrypt\n");
 
 		// @@@ Switch to using tokend allocators
 		free(outputData);
@@ -333,15 +333,15 @@
 	clear.Data = outputData;
 	clear.Length = outputLength;
 
-	GemaltoToken::log( "GemaltoKeyHandle::decrypt <END>\n" );
+	GemaltoToken::log("GemaltoKeyHandle::decrypt <END>\n");
 }
 
 
 void GemaltoKeyHandle::exportKey(const Context &, const AccessCredentials *, CssmKey &)
 {
-	GemaltoToken::log( "\nGemaltoKeyHandle::exportKey <BEGIN>\n" );
-	GemaltoToken::log( "## Error ## CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED\n" );
-	GemaltoToken::log( "GemaltoKeyHandle::exportKey <END>\n" );
+	GemaltoToken::log("\nGemaltoKeyHandle::exportKey <BEGIN>\n");
+	GemaltoToken::log("## Error ## CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED\n");
+	GemaltoToken::log("GemaltoKeyHandle::exportKey <END>\n");
 
 	CssmError::throwMe(CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED);
 }
@@ -357,12 +357,12 @@
 
 Tokend::KeyHandle* GemaltoKeyHandleFactory::keyHandle(Tokend::TokenContext *tokenContext, const Tokend::MetaRecord &metaRecord, Tokend::Record &record) const
 {
-	GemaltoToken::log( "\nGemaltoKeyHandleFactory::keyHandle <BEGIN>\n" );
+	GemaltoToken::log("\nGemaltoKeyHandleFactory::keyHandle <BEGIN>\n");
 
 	GemaltoKeyRecord &key = dynamic_cast<GemaltoKeyRecord &>(record);
 	GemaltoToken &gemaltoToken = static_cast<GemaltoToken &>(*tokenContext);
 
-	GemaltoToken::log( "GemaltoKeyHandleFactory::keyHandle <END>\n" );
+	GemaltoToken::log("GemaltoKeyHandleFactory::keyHandle <END>\n");
 
 	return new GemaltoKeyHandle(gemaltoToken, metaRecord, key);
 }

Modified: trunk/Tokend/PKCS11/GemaltoRecord.cpp
===================================================================
--- trunk/Tokend/PKCS11/GemaltoRecord.cpp	2010-05-27 07:14:20 UTC (rev 126)
+++ trunk/Tokend/PKCS11/GemaltoRecord.cpp	2010-06-07 09:13:55 UTC (rev 127)
@@ -50,14 +50,14 @@
 }
 
 
-GemaltoRecord::GemaltoRecord( )
+GemaltoRecord::GemaltoRecord()
 {
 	mHandle = 0;
 	mClass = 0;
 }
 
 
-GemaltoRecord::~GemaltoRecord( )
+GemaltoRecord::~GemaltoRecord()
 {
 }
 
@@ -75,12 +75,12 @@
 		mKeyPubWrap(FALSE),
         mKeyPubEncrypt(FALSE),
         mKeyPrvSign(FALSE),
-	    mKeyPrvUnwrap( FALSE),
+	    mKeyPrvUnwrap(FALSE),
 		mKeyPrvDecrypt(FALSE),
     	mSelfSigned(FALSE),
 		mCA(FALSE)
 {
-	GemaltoToken::log( "\nGemaltoCertRecord::GemaltoCertRecord <BEGIN>\n" );
+	GemaltoToken::log("\nGemaltoCertRecord::GemaltoCertRecord <BEGIN>\n");
 
 	mClass = CKO_CERTIFICATE;
 
@@ -94,74 +94,74 @@
 	CKError::check(CK_D_(C_GetAttributeValue)(gemaltoToken.session(), mHandle, &valueAttr, 1));
 
 	std::string szOut = "";
-	GemaltoToken::toStringHex( mValue.ptr(), mValue.size( ), szOut );
-	GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - Value - len <%lu> - value <%s>\n", mValue.size( ), szOut.c_str( ) );
+	GemaltoToken::toStringHex(mValue.ptr(), mValue.size(), szOut);
+	GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - Value - len <%lu> - value <%s>\n", mValue.size(), szOut.c_str());
 
 	// Get a X509 OpenSSL certificate instance
-	const unsigned char* p = mValue.ptr( );
-	X509* cert = d2i_X509( NULL, &p, mValue.size( ) );
-	if ( NULL == cert )
+	const unsigned char* p = mValue.ptr();
+	X509* cert = d2i_X509(NULL, &p, mValue.size());
+	if (NULL == cert)
 	{
-		GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - ## ERROR ## Cannot create OpenSSL certificate instance\n" );
+		GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - ## ERROR ## Cannot create OpenSSL certificate instance\n");
 		CssmError::throwMe(CSSM_ERRCODE_INVALID_SAMPLE_VALUE);
 	}
 
 	// Initialize internal registers
-	X509_check_purpose( cert, -1, 0 );
+	X509_check_purpose(cert, -1, 0);
 
 	// Get the subject name
 	char attr[1024];
-	memset( attr, 0, sizeof( attr ) );
+	memset(attr, 0, sizeof(attr));
 	std::string s = "Unknown subject name";
 	/*
-	X509_NAME_oneline( X509_get_subject_name( cert ), attr, sizeof( attr ) );
+	X509_NAME_oneline(X509_get_subject_name(cert), attr, sizeof(attr));
 	s = attr;
-	mSubject.copy( (CK_BYTE*)s.c_str( ), s.size( ) );
+	mSubject.copy((CK_BYTE*)s.c_str(), s.size());
 	*/
-    X509_NAME* pName = X509_get_subject_name( cert );
-    if ( pName )
+    X509_NAME* pName = X509_get_subject_name(cert);
+    if (pName)
     {
-		X509_NAME_get_text_by_NID( pName, NID_commonName, attr, sizeof( attr ) );
+		X509_NAME_get_text_by_NID(pName, NID_commonName, attr, sizeof(attr));
         s = attr;
     }
-	mSubject.copy( (CK_BYTE*)s.c_str( ), s.size( ) );
+	mSubject.copy((CK_BYTE*)s.c_str(), s.size());
 
 	szOut = "";
-	GemaltoToken::toStringHex( mSubject.ptr( ), mSubject.size( ), szOut );
-	GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - Subject - len <%lu> - value <%s>\n", mSubject.size( ), szOut.c_str( ) );
+	GemaltoToken::toStringHex(mSubject.ptr(), mSubject.size(), szOut);
+	GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - Subject - len <%lu> - value <%s>\n", mSubject.size(), szOut.c_str());
 
 	// Get the issuer name
-	memset( attr, 0, sizeof( attr ) );
+	memset(attr, 0, sizeof(attr));
 	s = "";
-	X509_NAME_oneline( X509_get_issuer_name( cert ), attr, sizeof( attr ) );
+	X509_NAME_oneline(X509_get_issuer_name(cert), attr, sizeof(attr));
 	s = attr;
-	mIssuer.copy( (CK_BYTE*)s.c_str( ), s.size( ) );
+	mIssuer.copy((CK_BYTE*)s.c_str(), s.size());
 
 	szOut = "";
-	GemaltoToken::toStringHex( mIssuer.ptr( ), mIssuer.size( ), szOut );
-	GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - Issuer - len <%lu> - value <%s>\n", mIssuer.size( ), szOut.c_str( ) );
-	//GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - Issuer - value <%s>\n", GemaltoDataString( mIssuer ) );
+	GemaltoToken::toStringHex(mIssuer.ptr(), mIssuer.size(), szOut);
+	GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - Issuer - len <%lu> - value <%s>\n", mIssuer.size(), szOut.c_str());
+	//GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - Issuer - value <%s>\n", GemaltoDataString(mIssuer));
 
 	// Compute if the certificate is selfsigned
 	mSelfSigned = FALSE;
 	// First check if the issuer and the subject are the same
-	if ( 0 == X509_NAME_cmp( X509_get_subject_name( cert ), X509_get_issuer_name( cert ) ) )
+	if (0 == X509_NAME_cmp(X509_get_subject_name(cert), X509_get_issuer_name(cert)))
 	{
 		// Then, check the signature
 		// Get the certificate public key
-		//SSL_library_init( );
+		//SSL_library_init();
 
 		// Get issuer public key and verify this signature
 		EVP_PKEY* l_CertPubKey = NULL;
-		l_CertPubKey = X509_get_pubkey( cert );
-		if ( NULL != l_CertPubKey )
+		l_CertPubKey = X509_get_pubkey(cert);
+		if (NULL != l_CertPubKey)
 		{
 			// Verify this signature
-			int l_RetVal = X509_verify( cert, l_CertPubKey );
-			EVP_PKEY_free( l_CertPubKey );
+			int l_RetVal = X509_verify(cert, l_CertPubKey);
+			EVP_PKEY_free(l_CertPubKey);
 
 			// If signature verification is ok, issuer has been found, stop
-			if ( 0 < l_RetVal )
+			if (0 < l_RetVal)
 			{
 				mSelfSigned = TRUE;
 			}
@@ -169,55 +169,55 @@
 
 		//mSelfSigned = TRUE;
    }
-	GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - mSelfSigned - value <%lu>\n", mSelfSigned );
+	GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - mSelfSigned - value <%lu>\n", mSelfSigned);
 
   	// Check that the public key type is RSA
-	if ( NID_rsaEncryption != OBJ_obj2nid(cert->cert_info->key->algor->algorithm))
+	if (NID_rsaEncryption != OBJ_obj2nid(cert->cert_info->key->algor->algorithm))
 	{
-		GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - ## Error CSSM_ERRCODE_SAMPLE_VALUE_NOT_SUPPORTED\n" );
+		GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - ## Error CSSM_ERRCODE_SAMPLE_VALUE_NOT_SUPPORTED\n");
 		CssmError::throwMe(CSSM_ERRCODE_SAMPLE_VALUE_NOT_SUPPORTED);
 	}
 
 	mKeyType = CKK_RSA;
-	GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - Public key type RSA <%lu>\n", mKeyType );
+	GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - Public key type RSA <%lu>\n", mKeyType);
 
 	// Get the public key
-    EVP_PKEY* pKey = X509_get_pubkey( cert );
-	if ( NULL == pKey )
+    EVP_PKEY* pKey = X509_get_pubkey(cert);
+	if (NULL == pKey)
 	{
-		GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - ## ERROR ## CSSM_ERRCODE_INVALID_SAMPLE_VALUE\n" );
+		GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - ## ERROR ## CSSM_ERRCODE_INVALID_SAMPLE_VALUE\n");
 		CssmError::throwMe(CSSM_ERRCODE_INVALID_SAMPLE_VALUE);
 	}
 
 	// Get public key size
 	mKeySize = BN_num_bits(pKey->pkey.rsa->n);
-	GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - Public key size <%lu>\n", mKeySize );
+	GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - Public key size <%lu>\n", mKeySize);
 
 	// Get the public key modulus
-	mKeyModulus.reserve( mKeySize / 8 );
-    BN_bn2bin( pKey->pkey.rsa->n, mKeyModulus.ptr( ) );
+	mKeyModulus.reserve(mKeySize / 8);
+    BN_bn2bin(pKey->pkey.rsa->n, mKeyModulus.ptr());
 
     // If a keyUsage extension is present, parse it
-    if ( EXFLAG_KUSAGE == (cert->ex_flags & EXFLAG_KUSAGE) )
+    if (EXFLAG_KUSAGE == (cert->ex_flags & EXFLAG_KUSAGE))
     {
-		if ( KU_CRL_SIGN == (cert->ex_kusage & KU_CRL_SIGN) )
+		if (KU_CRL_SIGN == (cert->ex_kusage & KU_CRL_SIGN))
 		{
             mKeyPrvSign = TRUE;
 			mKeyPubVerify = TRUE;
 		}
-		if ( KU_DATA_ENCIPHERMENT == (cert->ex_kusage & KU_DATA_ENCIPHERMENT) )
+		if (KU_DATA_ENCIPHERMENT == (cert->ex_kusage & KU_DATA_ENCIPHERMENT))
 		{
             mKeyPubWrap = TRUE;
             mKeyPubEncrypt = TRUE;
             mKeyPrvUnwrap = TRUE;
             mKeyPrvDecrypt = TRUE;
 		}
-		if ( KU_DIGITAL_SIGNATURE == (cert->ex_kusage & KU_DIGITAL_SIGNATURE) )
+		if (KU_DIGITAL_SIGNATURE == (cert->ex_kusage & KU_DIGITAL_SIGNATURE))
 		{
             mKeyPrvSign = TRUE;
 			mKeyPubVerify = TRUE;
 		}
-		if ( KU_ENCIPHER_ONLY == (cert->ex_kusage & KU_ENCIPHER_ONLY) )
+		if (KU_ENCIPHER_ONLY == (cert->ex_kusage & KU_ENCIPHER_ONLY))
 		{
             mKeyPubWrap = TRUE;
             mKeyPubEncrypt = TRUE;
@@ -226,27 +226,27 @@
             mKeyPrvSign = FALSE;
 			mKeyPubVerify = FALSE;
 		}
-		if ( KU_KEY_AGREEMENT == (cert->ex_kusage & KU_KEY_AGREEMENT) )
+		if (KU_KEY_AGREEMENT == (cert->ex_kusage & KU_KEY_AGREEMENT))
 		{
             mKeyPubWrap = TRUE;
             mKeyPubEncrypt = TRUE;
             mKeyPrvUnwrap = TRUE;
             mKeyPrvDecrypt = TRUE;
 		}
-		if ( KU_KEY_CERT_SIGN == (cert->ex_kusage & KU_KEY_CERT_SIGN) )
+		if (KU_KEY_CERT_SIGN == (cert->ex_kusage & KU_KEY_CERT_SIGN))
 		{
 		// Attribut de ca
             mKeyPrvSign = TRUE;
 			mKeyPubVerify = TRUE;
 		}
-		if ( KU_KEY_ENCIPHERMENT == (cert->ex_kusage & KU_KEY_ENCIPHERMENT) )
+		if (KU_KEY_ENCIPHERMENT == (cert->ex_kusage & KU_KEY_ENCIPHERMENT))
 		{
             mKeyPubWrap = TRUE;
             mKeyPubEncrypt = TRUE;
             mKeyPrvUnwrap = TRUE;
             mKeyPrvDecrypt = TRUE;
 		}
-		if ( KU_NON_REPUDIATION == (cert->ex_kusage & KU_NON_REPUDIATION) )
+		if (KU_NON_REPUDIATION == (cert->ex_kusage & KU_NON_REPUDIATION))
 		{
             mKeyPrvSign = TRUE;
 			mKeyPubVerify = TRUE;
@@ -254,19 +254,19 @@
 	}
 
 	// If an extendedKeyUsage extension is present parse it
-	if ( EXFLAG_XKUSAGE == (cert->ex_flags & EXFLAG_XKUSAGE) )
+	if (EXFLAG_XKUSAGE == (cert->ex_flags & EXFLAG_XKUSAGE))
 	{
-		if (  ( XKU_CODE_SIGN == (cert->ex_xkusage & XKU_CODE_SIGN) )
-			  || ( XKU_SSL_CLIENT == (cert->ex_xkusage & XKU_SSL_CLIENT) )
-			  || ( XKU_TIMESTAMP == (cert->ex_xkusage & XKU_TIMESTAMP) )
-			  || ( XKU_OCSP_SIGN == (cert->ex_xkusage & XKU_OCSP_SIGN) )
-			  )
+		if ((XKU_CODE_SIGN == (cert->ex_xkusage & XKU_CODE_SIGN))
+			  || (XKU_SSL_CLIENT == (cert->ex_xkusage & XKU_SSL_CLIENT))
+			  || (XKU_TIMESTAMP == (cert->ex_xkusage & XKU_TIMESTAMP))
+			  || (XKU_OCSP_SIGN == (cert->ex_xkusage & XKU_OCSP_SIGN))
+			)
 		{
             mKeyPrvSign = TRUE;
 			mKeyPubVerify = TRUE;
 		}
-		if ( ( XKU_SMIME == (cert->ex_xkusage & XKU_SMIME) )
-		|| ( XKU_SSL_SERVER == (cert->ex_xkusage & XKU_SSL_SERVER) )
+		if ((XKU_SMIME == (cert->ex_xkusage & XKU_SMIME))
+		|| (XKU_SSL_SERVER == (cert->ex_xkusage & XKU_SSL_SERVER))
 			)
 		{
             mKeyPrvSign = TRUE;
@@ -281,22 +281,22 @@
 
 	BASIC_CONSTRAINTS* bs = (BASIC_CONSTRAINTS*) X509_get_ext_d2i(cert, NID_basic_constraints, NULL, NULL);
 	mCA = (bs && bs->ca);
-	GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - CA <%lu>\n", mCA );
+	GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - CA <%lu>\n", mCA);
 
-	GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - Key usage mKeyPrvSign <%lu>\n", mKeyPrvSign );
-	GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - Key usage mKeyPubVerify <%lu>\n", mKeyPubVerify );
-	GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - Key usage mKeyPubWrap <%lu>\n", mKeyPubWrap );
-	GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - Key usage mKeyPubEncrypt <%lu>\n", mKeyPubEncrypt );
-	GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - Key usage mKeyPrvUnwrap <%lu>\n", mKeyPrvUnwrap );
-	GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord - Key usage mKeyPrvDecrypt <%lu>\n", mKeyPrvDecrypt );
+	GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - Key usage mKeyPrvSign <%lu>\n", mKeyPrvSign);
+	GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - Key usage mKeyPubVerify <%lu>\n", mKeyPubVerify);
+	GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - Key usage mKeyPubWrap <%lu>\n", mKeyPubWrap);
+	GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - Key usage mKeyPubEncrypt <%lu>\n", mKeyPubEncrypt);
+	GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - Key usage mKeyPrvUnwrap <%lu>\n", mKeyPrvUnwrap);
+	GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord - Key usage mKeyPrvDecrypt <%lu>\n", mKeyPrvDecrypt);
 
-	GemaltoToken::log( "GemaltoCertRecord::GemaltoCertRecord <END>\n" );
+	GemaltoToken::log("GemaltoCertRecord::GemaltoCertRecord <END>\n");
 }
 
 
 /* GemaltoCertRecord Default constructor
 */
-GemaltoCertRecord::GemaltoCertRecord( )
+GemaltoCertRecord::GemaltoCertRecord()
 	:	GemaltoRecord(),
 		mSubjectName(NULL),
 		mIssuerName(NULL),
@@ -306,7 +306,7 @@
 		mKeyPubWrap(FALSE),
         mKeyPubEncrypt(FALSE),
         mKeyPrvSign(FALSE),
-	    mKeyPrvUnwrap( FALSE),
+	    mKeyPrvUnwrap(FALSE),
 		mKeyPrvDecrypt(FALSE),
     	mSelfSigned(FALSE),
 		mCA(FALSE)
@@ -317,31 +317,31 @@
 
 GemaltoCertRecord::~GemaltoCertRecord()
 {
-	if( NULL != mSubjectName )
+	if (NULL != mSubjectName)
 	{
-		X509_NAME_free( mSubjectName );
+		X509_NAME_free(mSubjectName);
 		mSubjectName = NULL;
 	}
 
-	if( NULL != mIssuerName )
+	if (NULL != mIssuerName)
 	{
-		X509_NAME_free( mIssuerName );
+		X509_NAME_free(mIssuerName);
 		mIssuerName = NULL;
 	}
 }
 
 
-Tokend::Attribute *GemaltoCertRecord::getDataAttribute( Tokend::TokenContext */*tokenContext*/ )
+Tokend::Attribute *GemaltoCertRecord::getDataAttribute(Tokend::TokenContext */*tokenContext*/)
 {
-	GemaltoToken::log( "\nGemaltoCertRecord::getDataAttribute <BEGIN>\n" );
+	GemaltoToken::log("\nGemaltoCertRecord::getDataAttribute <BEGIN>\n");
 
 	std::string s = "";
-	GemaltoToken::toStringHex( mValue.ptr( ), mValue.size( ), s );
-	GemaltoToken::log( "GemaltoCertRecord::getDataAttribute - size <%lu> - value <%s>\n", mValue.size( ), s.c_str( ) );
+	GemaltoToken::toStringHex(mValue.ptr(), mValue.size(), s);
+	GemaltoToken::log("GemaltoCertRecord::getDataAttribute - size <%lu> - value <%s>\n", mValue.size(), s.c_str());
 
-	GemaltoToken::log( "GemaltoCertRecord::getDataAttribute <END>\n" );
+	GemaltoToken::log("GemaltoCertRecord::getDataAttribute <END>\n");
 
-	return new Tokend::Attribute( mValue.ptr( ), mValue.size( ) );
+	return new Tokend::Attribute(mValue.ptr(), mValue.size());
 }
 
 
@@ -356,7 +356,7 @@
 		mKeyPubWrap(FALSE),
 		mKeyPubEncrypt(FALSE)
 {
-	GemaltoToken::log( "\nGemaltoKeyRecord::GemaltoKeyRecord <BEGIN>\n" );
+	GemaltoToken::log("\nGemaltoKeyRecord::GemaltoKeyRecord <BEGIN>\n");
 
 	mHandle = cert.getHandle();
 
@@ -365,25 +365,25 @@
 	mKeyType = cert.getType();
 	mKeySize = cert.sizeInBits();
 
-	mKeyPubVerify = cert.verify( );
-	mKeyPubWrap = cert.wrap( );
-	mKeyPubEncrypt = cert.encrypt( );
+	mKeyPubVerify = cert.verify();
+	mKeyPubWrap = cert.wrap();
+	mKeyPubEncrypt = cert.encrypt();
 
-	mLabel = cert.getSubject( );
+	mLabel = cert.getSubject();
 
-	GemaltoToken::log( "GemaltoKeyRecord::GemaltoKeyRecord - Handle <%ld>\n", mHandle );
+	GemaltoToken::log("GemaltoKeyRecord::GemaltoKeyRecord - Handle <%ld>\n", mHandle);
 
 	std::string str = "";
-	GemaltoToken::toStringHex( mLabel.ptr( ), mLabel.size( ), str );
-	GemaltoToken::log( "GemaltoKeyRecord::GemaltoKeyRecord() - Class <%lu>\n", mClass );
-	GemaltoToken::log( "GemaltoKeyRecord::GemaltoKeyRecord() - Key type <%lu>\n", mKeyType );
-	GemaltoToken::log( "GemaltoKeyRecord::GemaltoKeyRecord() - Key size <%lu>\n", mKeySize );
-	GemaltoToken::log( "GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPubVerify <%lu>\n", mKeyPubVerify );
-	GemaltoToken::log( "GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPubWrap <%lu>\n", mKeyPubWrap );
-	GemaltoToken::log( "GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPubEncrypt <%lu>\n", mKeyPubEncrypt );
-	GemaltoToken::log( "GemaltoKeyRecord::GemaltoKeyRecord() - Key label <%s>\n", str.c_str( ) );
+	GemaltoToken::toStringHex(mLabel.ptr(), mLabel.size(), str);
+	GemaltoToken::log("GemaltoKeyRecord::GemaltoKeyRecord() - Class <%lu>\n", mClass);
+	GemaltoToken::log("GemaltoKeyRecord::GemaltoKeyRecord() - Key type <%lu>\n", mKeyType);
+	GemaltoToken::log("GemaltoKeyRecord::GemaltoKeyRecord() - Key size <%lu>\n", mKeySize);
+	GemaltoToken::log("GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPubVerify <%lu>\n", mKeyPubVerify);
+	GemaltoToken::log("GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPubWrap <%lu>\n", mKeyPubWrap);
+	GemaltoToken::log("GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPubEncrypt <%lu>\n", mKeyPubEncrypt);
+	GemaltoToken::log("GemaltoKeyRecord::GemaltoKeyRecord() - Key label <%s>\n", str.c_str());
 
-	GemaltoToken::log( "GemaltoKeyRecord::GemaltoKeyRecord <END>\n" );
+	GemaltoToken::log("GemaltoKeyRecord::GemaltoKeyRecord <END>\n");
 }
 
 
@@ -406,12 +406,12 @@
 
 void GemaltoKeyRecord::computeSign(GemaltoToken &/*gemaltoToken*/, CK_ULONG /*mech*/, const AccessCredentials */*cred*/, unsigned char */*data*/, size_t /*dataLength*/, unsigned char */*output*/, size_t &/*outputLength*/)
 {
-	GemaltoToken::log( "\nGemaltoKeyRecord::computeSign <BEGIN>\n" );
+	GemaltoToken::log("\nGemaltoKeyRecord::computeSign <BEGIN>\n");
 	std::string str = "";
-	GemaltoToken::toStringHex( mLabel.ptr( ), mLabel.size( ), str );
-	GemaltoToken::log( "GemaltoKeyRecord::computeSign() - Label <%s>\n", str.c_str( ) );
-	GemaltoToken::log( "trow CSSMERR_CSP_KEY_USAGE_INCORRECT\n" );
-	GemaltoToken::log( "GemaltoKeyRecord::computeSign <END>\n" );
+	GemaltoToken::toStringHex(mLabel.ptr(), mLabel.size(), str);
+	GemaltoToken::log("GemaltoKeyRecord::computeSign() - Label <%s>\n", str.c_str());
+	GemaltoToken::log("trow CSSMERR_CSP_KEY_USAGE_INCORRECT\n");
+	GemaltoToken::log("GemaltoKeyRecord::computeSign <END>\n");
 
 	CssmError::throwMe(CSSMERR_CSP_KEY_USAGE_INCORRECT);
 }
@@ -419,12 +419,12 @@
 
 void GemaltoKeyRecord::computeDecrypt(GemaltoToken &/*gemaltoToken*/, CK_ULONG /*mech*/, const AccessCredentials */*cred*/, unsigned char */*data*/, size_t /*dataLength*/, unsigned char */*output*/, size_t &/*outputLength*/)
 {
-	GemaltoToken::log( "\nGemaltoKeyRecord::computeDecrypt <BEGIN>\n" );
+	GemaltoToken::log("\nGemaltoKeyRecord::computeDecrypt <BEGIN>\n");
 	std::string str = "";
-	GemaltoToken::toStringHex( mLabel.ptr( ), mLabel.size( ), str );
-	GemaltoToken::log( "GemaltoKeyRecord::computeDecrypt - Label <%s>\n", str.c_str( ) );
-	GemaltoToken::log( "trow CSSMERR_CSP_KEY_USAGE_INCORRECT\n" );
-	GemaltoToken::log( "GemaltoKeyRecord::computeDecrypt <END>\n" );
+	GemaltoToken::toStringHex(mLabel.ptr(), mLabel.size(), str);
+	GemaltoToken::log("GemaltoKeyRecord::computeDecrypt - Label <%s>\n", str.c_str());
+	GemaltoToken::log("trow CSSMERR_CSP_KEY_USAGE_INCORRECT\n");
+	GemaltoToken::log("GemaltoKeyRecord::computeDecrypt <END>\n");
 
 	CssmError::throwMe(CSSMERR_CSP_KEY_USAGE_INCORRECT);
 }
@@ -436,9 +436,9 @@
 
 
 GemaltoPrivateKeyRecord::GemaltoPrivateKeyRecord(const GemaltoCertRecord &cert)
-	: GemaltoKeyRecord( cert )
+	: GemaltoKeyRecord(cert)
 {
-	GemaltoToken::log( "\nGemaltoPrivateKeyRecord::GemaltoPrivateKeyRecord <BEGIN>\n" );
+	GemaltoToken::log("\nGemaltoPrivateKeyRecord::GemaltoPrivateKeyRecord <BEGIN>\n");
 
 	secdebug("Gemalto.tokend", "GemaltoPrivateKeyRecord::GemaltoPrivateKeyRecord(cert)");
 
@@ -449,29 +449,29 @@
 	mKeyType = cert.getType();
 	mKeySize = cert.sizeInBits();
 
-	mKeyModulus = cert.getKeyPubModulus( );
+	mKeyModulus = cert.getKeyPubModulus();
 
-	mKeyPrvSign = cert.verify( );
-	mKeyPrvUnwrap = cert.wrap( );
-	mKeyPrvDecrypt = cert.encrypt( );
+	mKeyPrvSign = cert.verify();
+	mKeyPrvUnwrap = cert.wrap();
+	mKeyPrvDecrypt = cert.encrypt();
 
-	mLabel = cert.getSubject( );
+	mLabel = cert.getSubject();
 
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::GemaltoPrivateKeyRecord - Handle <%ld>\n", mHandle );
+	GemaltoToken::log("GemaltoPrivateKeyRecord::GemaltoPrivateKeyRecord - Handle <%ld>\n", mHandle);
 	std::string str = "";
-	GemaltoToken::toStringHex( mLabel.ptr( ), mLabel.size( ), str );
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::GemaltoPrivateKeyRecord() - Class <%lu>\n", mClass );
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::GemaltoPrivateKeyRecord() - Key type <%lu>\n", mKeyType );
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::GemaltoPrivateKeyRecord() - Key size <%lu>\n", mKeySize );
-	GemaltoToken::log( "GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPubVerify <%lu>\n", mKeyPubVerify );
-	GemaltoToken::log( "GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPubWrap <%lu>\n", mKeyPubWrap );
-	GemaltoToken::log( "GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPubEncrypt <%lu>\n", mKeyPubEncrypt );
-	GemaltoToken::log( "GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPrvSign <%lu>\n", mKeyPrvSign );
-	GemaltoToken::log( "GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPrvUnwrap <%lu>\n", mKeyPrvUnwrap );
-	GemaltoToken::log( "GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPrvDecrypt <%lu>\n", mKeyPrvDecrypt );
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::GemaltoPrivateKeyRecord() - Key label <%s>\n", str.c_str( ) );
+	GemaltoToken::toStringHex(mLabel.ptr(), mLabel.size(), str);
+	GemaltoToken::log("GemaltoPrivateKeyRecord::GemaltoPrivateKeyRecord() - Class <%lu>\n", mClass);
+	GemaltoToken::log("GemaltoPrivateKeyRecord::GemaltoPrivateKeyRecord() - Key type <%lu>\n", mKeyType);
+	GemaltoToken::log("GemaltoPrivateKeyRecord::GemaltoPrivateKeyRecord() - Key size <%lu>\n", mKeySize);
+	GemaltoToken::log("GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPubVerify <%lu>\n", mKeyPubVerify);
+	GemaltoToken::log("GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPubWrap <%lu>\n", mKeyPubWrap);
+	GemaltoToken::log("GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPubEncrypt <%lu>\n", mKeyPubEncrypt);
+	GemaltoToken::log("GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPrvSign <%lu>\n", mKeyPrvSign);
+	GemaltoToken::log("GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPrvUnwrap <%lu>\n", mKeyPrvUnwrap);
+	GemaltoToken::log("GemaltoKeyRecord::GemaltoKeyRecord() - Key mKeyPrvDecrypt <%lu>\n", mKeyPrvDecrypt);
+	GemaltoToken::log("GemaltoPrivateKeyRecord::GemaltoPrivateKeyRecord() - Key label <%s>\n", str.c_str());
 
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::GemaltoPrivateKeyRecord <END>\n" );
+	GemaltoToken::log("GemaltoPrivateKeyRecord::GemaltoPrivateKeyRecord <END>\n");
 }
 
 
@@ -482,17 +482,17 @@
 
 void GemaltoPrivateKeyRecord::computeSign(GemaltoToken &gemaltoToken, CK_ULONG mech, const AccessCredentials *cred, unsigned char *data, size_t dataLength, unsigned char *output, size_t &outputLength)
 {
-	GemaltoToken::log( "\nGemaltoPrivateKeyRecord::computeSign <BEGIN>\n" );
+	GemaltoToken::log("\nGemaltoPrivateKeyRecord::computeSign <BEGIN>\n");
 	std::string str = "";
-	GemaltoToken::toStringHex( getLabel( ).ptr( ), getLabel().size( ), str );
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::computeSign - Label <%s>\n", str.c_str( ) );
+	GemaltoToken::toStringHex(getLabel().ptr(), getLabel().size(), str);
+	GemaltoToken::log("GemaltoPrivateKeyRecord::computeSign - Label <%s>\n", str.c_str());
 	str = "";
-	GemaltoToken::toStringHex( getModulus( ).ptr( ), getModulus().size( ), str );
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::computeSign - Modulus <%s>\n", str.c_str( ) );
+	GemaltoToken::toStringHex(getModulus().ptr(), getModulus().size(), str);
+	GemaltoToken::log("GemaltoPrivateKeyRecord::computeSign - Modulus <%s>\n", str.c_str());
 
 	if (dataLength > (mKeySize / 8))
 	{
-		GemaltoToken::log( "## Error ## Bad data length <%lu>\n", dataLength );
+		GemaltoToken::log("## Error ## Bad data length <%lu>\n", dataLength);
 		CssmError::throwMe(CSSMERR_CSP_BLOCK_SIZE_MISMATCH);
 	}
 
@@ -517,21 +517,21 @@
 
 		if (!found)
 		{
-			GemaltoToken::log( "## Error ## Credentials not found\n" );
+			GemaltoToken::log("## Error ## Credentials not found\n");
 			CssmError::throwMe(CSSM_ERRCODE_ACL_SUBJECT_TYPE_NOT_SUPPORTED);
 		}
 	}
 
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::computeSign - Required Class <%lu>\n", mClass );
+	GemaltoToken::log("GemaltoPrivateKeyRecord::computeSign - Required Class <%lu>\n", mClass);
 	std::string s = "";
-	GemaltoToken::toStringHex( mKeyModulus.ptr( ), mKeyModulus.size( ), s );
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::computeSign - Required Modulus <%s>\n", s.c_str( ) );
+	GemaltoToken::toStringHex(mKeyModulus.ptr(), mKeyModulus.size(), s);
+	GemaltoToken::log("GemaltoPrivateKeyRecord::computeSign - Required Modulus <%s>\n", s.c_str());
 
 	CK_ATTRIBUTE attrs[] =
 	{
 		{CKA_CLASS, &mClass, sizeof(mClass)},
 		//{CKA_ID, mId.ptr(), mId.size()}};
-		{ CKA_MODULUS, mKeyModulus.ptr( ), mKeyModulus.size( ) }
+		{ CKA_MODULUS, mKeyModulus.ptr(), mKeyModulus.size() }
 	};
 	CKError::check(CK_D_(C_FindObjectsInit)(gemaltoToken.session(), attrs, 2));
 
@@ -542,7 +542,7 @@
 		CKError::check(CK_D_(C_FindObjects)(gemaltoToken.session(), &hObject, 1, &ulObjectCount));
 		if (ulObjectCount == 0)
 		{
-			GemaltoToken::log( "## Error ## Private key not found\n" );
+			GemaltoToken::log("## Error ## Private key not found\n");
 			CssmError::throwMe(CSSMERR_CSP_PRIVATE_KEY_NOT_FOUND);
 		}
 		CK_D_(C_FindObjectsFinal)(gemaltoToken.session());
@@ -560,29 +560,29 @@
 	CKError::check(CK_D_(C_Sign)(gemaltoToken.session(), (unsigned char*) data, dataLength, output, &dummy));
 	outputLength = dummy;
 
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::computeSign <END>\n" );
+	GemaltoToken::log("GemaltoPrivateKeyRecord::computeSign <END>\n");
 }
 
 
 void GemaltoPrivateKeyRecord::computeDecrypt(GemaltoToken &gemaltoToken, CK_ULONG mech, const AccessCredentials *cred, unsigned char *data, size_t dataLength, unsigned char *output, size_t &outputLength)
 {
-	GemaltoToken::log( "\nGemaltoPrivateKeyRecord::computeDecrypt <BEGIN>\n" );
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::computeDecrypt - mechanism <%lu>\n", mech );
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::computeDecrypt - cred <%p>\n", cred );
+	GemaltoToken::log("\nGemaltoPrivateKeyRecord::computeDecrypt <BEGIN>\n");
+	GemaltoToken::log("GemaltoPrivateKeyRecord::computeDecrypt - mechanism <%lu>\n", mech);
+	GemaltoToken::log("GemaltoPrivateKeyRecord::computeDecrypt - cred <%p>\n", cred);
 	char strData[6000];
-	memset( strData, '\0', sizeof( strData ) );
+	memset(strData, '\0', sizeof(strData));
 	char* str = strData;
 	for (size_t i=0; i<dataLength; i++)
 	{
-		str += sprintf( str, "%02x ", data[i]);
+		str += sprintf(str, "%02x ", data[i]);
 	}
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::computeDecrypt - dataLength <%lu> - data <%s>\n", dataLength, strData );
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::computeDecrypt - output <%p>\n", output );
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::computeDecrypt - outputLength <%lu>\n", outputLength );
+	GemaltoToken::log("GemaltoPrivateKeyRecord::computeDecrypt - dataLength <%lu> - data <%s>\n", dataLength, strData);
+	GemaltoToken::log("GemaltoPrivateKeyRecord::computeDecrypt - output <%p>\n", output);
+	GemaltoToken::log("GemaltoPrivateKeyRecord::computeDecrypt - outputLength <%lu>\n", outputLength);
 
 	if (dataLength > (mKeySize / 8))
 	{
-		GemaltoToken::log( "GemaltoPrivateKeyRecord::computeDecrypt - ## Error bad data length <%lu> !\n", dataLength);
+		GemaltoToken::log("GemaltoPrivateKeyRecord::computeDecrypt - ## Error bad data length <%lu> !\n", dataLength);
 		CssmError::throwMe(CSSMERR_CSP_BLOCK_SIZE_MISMATCH);
 	}
 
@@ -607,7 +607,7 @@
 
 		if (!found)
 		{
-			GemaltoToken::log( "GemaltoPrivateKeyRecord::computeDecrypt - ## Error cred not found!");
+			GemaltoToken::log("GemaltoPrivateKeyRecord::computeDecrypt - ## Error cred not found!");
 			CssmError::throwMe(CSSM_ERRCODE_ACL_SUBJECT_TYPE_NOT_SUPPORTED);
 		}
 	}
@@ -620,7 +620,7 @@
 	{
 		{CKA_CLASS, &mClass, sizeof(mClass)},
 		//{CKA_ID, mId.ptr(), mId.size()}};
-		{ CKA_MODULUS, mKeyModulus.ptr( ), mKeyModulus.size( ) }
+		{ CKA_MODULUS, mKeyModulus.ptr(), mKeyModulus.size() }
 	};
 	CKError::check(CK_D_(C_FindObjectsInit)(gemaltoToken.session(), attrs, 2));
 
@@ -646,14 +646,14 @@
 	CKError::check(CK_D_(C_Decrypt)(gemaltoToken.session(), (unsigned char*) data, dataLength, output, &dummy));
 	outputLength = dummy;
 
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::computeDecrypt <END>\n" );
+	GemaltoToken::log("GemaltoPrivateKeyRecord::computeDecrypt <END>\n");
 }
 
 
 void GemaltoPrivateKeyRecord::getAcl(const char *tag, uint32 &count, AclEntryInfo *&acls)
 {
-	GemaltoToken::log( "\nGemaltoPrivateKeyRecord::getAcl <BEGIN>\n" );
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::getAcl - tag <%s>\n", tag );
+	GemaltoToken::log("\nGemaltoPrivateKeyRecord::getAcl <BEGIN>\n");
+	GemaltoToken::log("GemaltoPrivateKeyRecord::getAcl - tag <%s>\n", tag);
 
 	// @@@ Key 1 has any acl for sign, key 2 has pin1 acl, and key3 has pin1
 	// acl with auto-lock which we express as a prompted password subject.
@@ -680,5 +680,5 @@
 	count = mAclEntries.size();
 	acls = mAclEntries.entries();
 
-	GemaltoToken::log( "GemaltoPrivateKeyRecord::getAcl <END>\n" );
+	GemaltoToken::log("GemaltoPrivateKeyRecord::getAcl <END>\n");
 }

Modified: trunk/Tokend/PKCS11/GemaltoRecord.h
===================================================================
--- trunk/Tokend/PKCS11/GemaltoRecord.h	2010-05-27 07:14:20 UTC (rev 126)
+++ trunk/Tokend/PKCS11/GemaltoRecord.h	2010-06-07 09:13:55 UTC (rev 127)
@@ -45,7 +45,7 @@
 	GemaltoData(CK_BYTE_PTR ptr, CK_ULONG size) : _ptr(NULL) { copy(ptr, size); }
 	~GemaltoData()
 	{
-		if( NULL != _ptr )
+		if (NULL != _ptr)
 		{
 			delete[] _ptr;
 		}
@@ -56,7 +56,7 @@
 
 	void copy(CK_BYTE_PTR ptr, CK_ULONG size)
 	{
-		if( NULL != _ptr )
+		if (NULL != _ptr)
 		{
 			delete[] _ptr;
 		}
@@ -72,7 +72,7 @@
 
 	void reserve(CK_ULONG n)
 	{
-		if( NULL != _ptr )
+		if (NULL != _ptr)
 		{
 			delete[] _ptr;
 		}
@@ -143,13 +143,13 @@
 	CK_KEY_TYPE getType() const { return mKeyType; }
 	uint32 sizeInBits() const { return mKeySize; }
 
-	const GemaltoData& getKeyPubModulus( ) const { return mKeyModulus; }
+	const GemaltoData& getKeyPubModulus() const { return mKeyModulus; }
 
 	CK_BBOOL verify() const { return mKeyPubVerify; }
-	CK_BBOOL verifyRecover() const { return ( mKeyPubVerify | mKeyPrvSign); }
-	CK_BBOOL encrypt() const { return ( mKeyPubWrap | mKeyPubEncrypt); }
+	CK_BBOOL verifyRecover() const { return (mKeyPubVerify | mKeyPrvSign); }
+	CK_BBOOL encrypt() const { return (mKeyPubWrap | mKeyPubEncrypt); }
 	CK_BBOOL derive() const { return FALSE; }
-	CK_BBOOL wrap() const { return ( mKeyPubWrap | mKeyPubEncrypt); }
+	CK_BBOOL wrap() const { return (mKeyPubWrap | mKeyPubEncrypt); }
 
 	CK_BBOOL isSelfSigned() const { return mSelfSigned; }
 	CK_BBOOL isCA() const { return mCA; }
@@ -197,18 +197,18 @@
 
 	virtual CK_BBOOL verify() const { return mKeyPubVerify; }
 	virtual CK_BBOOL verifyRecover() const { return mKeyPubVerify; }
-	virtual CK_BBOOL encrypt() const { return ( mKeyPubWrap | mKeyPubEncrypt); }
+	virtual CK_BBOOL encrypt() const { return (mKeyPubWrap | mKeyPubEncrypt); }
 	virtual CK_BBOOL derive() const { return FALSE; }
 	virtual CK_BBOOL wrap() const { return mKeyPubWrap; }
 
-	virtual const GemaltoData& getModulus( ) const { return mKeyModulus; }
+	virtual const GemaltoData& getModulus() const { return mKeyModulus; }
 
 	virtual void computeSign(GemaltoToken &gemaltoToken, CK_ULONG mech, const AccessCredentials *cred, unsigned char *data, size_t dataLength, unsigned char *result, size_t &resultLength);
 
 	virtual void computeDecrypt(GemaltoToken &gemaltoToken, CK_ULONG mech, const AccessCredentials *cred, unsigned char *data, size_t dataLength, unsigned char *result, size_t &resultLength);
 
 protected:
-	GemaltoKeyRecord( );
+	GemaltoKeyRecord();
 
 	GemaltoData mLabel;
 
@@ -238,10 +238,10 @@
 	void getAcl(const char *tag, uint32 &count, AclEntryInfo *&acls);
 
 	CK_BBOOL verify() const { return mKeyPubVerify; }
-	CK_BBOOL verifyRecover() const { return ( mKeyPubVerify | mKeyPrvSign); }
-	CK_BBOOL encrypt() const { return ( mKeyPubWrap | mKeyPubEncrypt); }
+	CK_BBOOL verifyRecover() const { return (mKeyPubVerify | mKeyPrvSign); }
+	CK_BBOOL encrypt() const { return (mKeyPubWrap | mKeyPubEncrypt); }
 	CK_BBOOL derive() const { return FALSE; }
-	CK_BBOOL wrap() const { return ( mKeyPubWrap | mKeyPubEncrypt); }
+	CK_BBOOL wrap() const { return (mKeyPubWrap | mKeyPubEncrypt); }
 
 protected:
 	CK_BBOOL mKeyPrvSign;

Modified: trunk/Tokend/PKCS11/GemaltoSchema.cpp
===================================================================
--- trunk/Tokend/PKCS11/GemaltoSchema.cpp	2010-05-27 07:14:20 UTC (rev 126)
+++ trunk/Tokend/PKCS11/GemaltoSchema.cpp	2010-06-07 09:13:55 UTC (rev 127)
@@ -43,8 +43,8 @@
 
 Tokend::Relation* GemaltoSchema::createKeyRelation(CSSM_DB_RECORDTYPE keyType)
 {
-	GemaltoToken::log( "\nGemaltoSchema::createKeyRelation <BEGIN>\n" );
-	GemaltoToken::log( "CSSM_DB_RECORDTYPE <%ld>\n", keyType );
+	GemaltoToken::log("\nGemaltoSchema::createKeyRelation <BEGIN>\n");
+	GemaltoToken::log("CSSM_DB_RECORDTYPE <%ld>\n", keyType);
 
 	Relation *rn = createStandardRelation(keyType);
 
@@ -80,7 +80,7 @@
 	mr.attributeCoder(kSecKeyVerifyRecover, &mVerifyRecoverCoder);
 	mr.attributeCoder(kSecKeyDerive, &mDeriveCoder);
 
-	GemaltoToken::log( "\nGemaltoSchema::createKeyRelation <END>\n" );
+	GemaltoToken::log("\nGemaltoSchema::createKeyRelation <END>\n");
 
 	return rn;
 }
@@ -88,7 +88,7 @@
 
 void GemaltoSchema::create()
 {
-	GemaltoToken::log( "\nGemaltoSchema::create <BEGIN>\n" );
+	GemaltoToken::log("\nGemaltoSchema::create <BEGIN>\n");
 
 	Schema::create();
 
@@ -100,5 +100,5 @@
 	rn_publ->metaRecord().attributeCoder(kSecKeyLabel, &mZeroCoder);
 	//rn_publ->metaRecord().attributeCoder(kSecKeyLabel, &mKeyNameCoder);
 
-	GemaltoToken::log( "\nGemaltoSchema::create <END>\n" );
+	GemaltoToken::log("\nGemaltoSchema::create <END>\n");
 }

Modified: trunk/Tokend/PKCS11/GemaltoToken.cpp
===================================================================
--- trunk/Tokend/PKCS11/GemaltoToken.cpp	2010-05-27 07:14:20 UTC (rev 126)
+++ trunk/Tokend/PKCS11/GemaltoToken.cpp	2010-06-07 09:13:55 UTC (rev 127)
@@ -67,7 +67,7 @@
 	mCKSession(CK_INVALID_HANDLE),
 	mDLHandle(NULL)
 {
-	log( "\nGemaltoToken::GemaltoToken <BEGIN>\n" );
+	log("\nGemaltoToken::GemaltoToken <BEGIN>\n");
 
 	mTokenContext = this;
 
@@ -75,15 +75,15 @@
 	::ERR_load_crypto_strings();
 	::X509V3_add_standard_extensions();
 
-	log( "GemaltoToken::GemaltoToken <END>\n" );
+	log("GemaltoToken::GemaltoToken <END>\n");
 }
 
 
 GemaltoToken::~GemaltoToken()
 {
-	log( "\nGemaltoToken::~GemaltoToken <BEGIN>\n" );
+	log("\nGemaltoToken::~GemaltoToken <BEGIN>\n");
 
-	if( NULL != mSchema )
+	if (NULL != mSchema)
 	{
 		delete mSchema;
 	}
@@ -93,41 +93,41 @@
 		if (s_CK_pFunctionList)
 		{
 			CK_D_(C_Logout)(mCKSession);
-			log( "GemaltoToken::~GemaltoToken <LogOut>\n" );
+			log("GemaltoToken::~GemaltoToken <LogOut>\n");
 
 			if (mCKSession != CK_INVALID_HANDLE)
 			{
 				CK_D_(C_CloseSession)(mCKSession);
 				mCKSession = CK_INVALID_HANDLE;
 			}
-			log( "GemaltoToken::~GemaltoToken <CloseSession>\n" );
+			log("GemaltoToken::~GemaltoToken <CloseSession>\n");
 
 			CK_D_(C_Finalize)(NULL_PTR);
 
 			//(*(GemaltoToken::s_CK_pFunctionList->C_Finalize))(NULL_PTR);
-			log( "GemaltoToken::~GemaltoToken <Finalize>\n" );
+			log("GemaltoToken::~GemaltoToken <Finalize>\n");
 
 			s_CK_pFunctionList = NULL;
 		}
 	}
-	catch( ... )
+	catch(...)
 	{
-		log( "## Error ## Crash \n" );
+		log("## Error ## Crash \n");
 	}
 
-	if( NULL != mDLHandle )
+	if (NULL != mDLHandle)
 	{
-		dlclose( mDLHandle );
+		dlclose(mDLHandle);
 	}
 
-	log( "GemaltoToken::~GemaltoToken <END>\n" );
+	log("GemaltoToken::~GemaltoToken <END>\n");
 }
 
 
 void GemaltoToken::changePIN(int pinNum, const unsigned char *oldPin, size_t oldPinLength, const unsigned char *newPin, size_t newPinLength)
 {
-	log( "\nGemaltoToken::changePIN <BEGIN>\n" );
-	//log( "pinNum <%d> - oldPin <%.*s> - newPin <%.*s>\n", pinNum, (int) oldPinLength, oldPin, (int) newPinLength, newPin);
+	log("\nGemaltoToken::changePIN <BEGIN>\n");
+	//log("pinNum <%d> - oldPin <%.*s> - newPin <%.*s>\n", pinNum, (int) oldPinLength, oldPin, (int) newPinLength, newPin);
 
 	if (pinNum != 1)
 		CssmError::throwMe(CSSM_ERRCODE_SAMPLE_VALUE_NOT_SUPPORTED);
@@ -137,15 +137,15 @@
 		CssmError::throwMe(CSSM_ERRCODE_INVALID_SAMPLE_VALUE);
 
 	CK_BYTE* pOldPIN = new CK_BYTE[oldPinLength];
-	memset( pOldPIN, 0, sizeof( CK_BYTE ) * oldPinLength );
-	for( size_t i = 0 ; i < oldPinLength ; i++ )
+	memset(pOldPIN, 0, sizeof(CK_BYTE) * oldPinLength);
+	for(size_t i = 0 ; i < oldPinLength ; i++)
 	{
 		pOldPIN[ i ] = (CK_BYTE)oldPin[ i ];
 	}
 
 	CK_BYTE* pNewPIN = new CK_BYTE[newPinLength];
-	memset( pNewPIN, 0, sizeof( CK_BYTE ) * newPinLength );
-	for( size_t j = 0 ; j < newPinLength ; j++ )
+	memset(pNewPIN, 0, sizeof(CK_BYTE) * newPinLength);
+	for(size_t j = 0 ; j < newPinLength ; j++)
 	{
 		pNewPIN[ j ] = (CK_BYTE)newPin[ j ];
 	}
@@ -153,50 +153,50 @@
 	// Log the user only if he was not previously logged in
 	bool bUserAlreadyLoggedIn = false;
 	CK_RV rv = CK_D_(C_Login)(mCKSession, CKU_USER, pOldPIN, oldPinLength);
-	if( rv == CKR_USER_ALREADY_LOGGED_IN)
+	if (rv == CKR_USER_ALREADY_LOGGED_IN)
 	{
 		bUserAlreadyLoggedIn = true;
 	}
-	else if( rv != CKR_OK )
+	else if (rv != CKR_OK)
 	{
 		delete[] pOldPIN;
 		delete[] pNewPIN;
 
-		log( "GemaltoToken::changePIN - ## Error ## <%ld>\n", rv );
+		log("GemaltoToken::changePIN - ## Error ## <%ld>\n", rv);
 
-		CKError::check( rv );
+		CKError::check(rv);
 	}
 
 	// Change PIN
 	rv = CK_D_(C_SetPIN)(mCKSession, pOldPIN, oldPinLength, pNewPIN, newPinLength);
 	delete[] pOldPIN;
 	delete[] pNewPIN;
-	CKError::check( rv );
+	CKError::check(rv);
 
 	// LogOut only if the user not previously logged in
-	if( false == bUserAlreadyLoggedIn )
+	if (false == bUserAlreadyLoggedIn)
 	{
 		CKError::check(CK_D_(C_Logout)(mCKSession));
 	}
 
 	mPinStatus = SCARD_SUCCESS;
 
-	log( "GemaltoToken::changePIN <END>\n" );
+	log("GemaltoToken::changePIN <END>\n");
 }
 
 
 uint32_t GemaltoToken::pinStatus(int pinNum)
 {
-	log( "\nGemaltoToken::pinStatus <BEGIN>\n" );
-	log( "pinNum <%d>\n", pinNum );
+	log("\nGemaltoToken::pinStatus <BEGIN>\n");
+	log("pinNum <%d>\n", pinNum);
 
 	if (pinNum != 1)
 	{
-		log( "## Error ##  pinStatus CSSM_ERRCODE_SAMPLE_VALUE_NOT_SUPPORTED\n" );
+		log("## Error ##  pinStatus CSSM_ERRCODE_SAMPLE_VALUE_NOT_SUPPORTED\n");
 		CssmError::throwMe(CSSM_ERRCODE_SAMPLE_VALUE_NOT_SUPPORTED);
 	}
 
-	log( "GemaltoToken::pinStatus <END>\n" );
+	log("GemaltoToken::pinStatus <END>\n");
 
 	return mPinStatus;
 }
@@ -204,40 +204,40 @@
 
 void GemaltoToken::verifyPIN(int pinNum, const uint8_t *pin, size_t pinLength)
 {
-	log( "\nGemaltoToken::verifyPIN <BEGIN>\n" );
-	//log( "pinNum <%d> - pin <%.*s>\n", pinNum, (int) pinLength, pin );
+	log("\nGemaltoToken::verifyPIN <BEGIN>\n");
+	//log("pinNum <%d> - pin <%.*s>\n", pinNum, (int) pinLength, pin);
 
 	if (pinNum != 1)
 	{
-		log( "GemaltoToken::verifyPIN - ## ERROR ## Invalid pinNum <%d>\n", pinNum );
+		log("GemaltoToken::verifyPIN - ## ERROR ## Invalid pinNum <%d>\n", pinNum);
 		CssmError::throwMe(CSSM_ERRCODE_SAMPLE_VALUE_NOT_SUPPORTED);
 	}
 
-	if ( ( pinLength < mCKTokenInfo.ulMinPinLen ) || ( pinLength > mCKTokenInfo.ulMaxPinLen ) )
+	if ((pinLength < mCKTokenInfo.ulMinPinLen) || (pinLength > mCKTokenInfo.ulMaxPinLen))
 	{
-		log( "GemaltoToken::verifyPIN - ## ERROR ## Invalid PIN length\n" );
+		log("GemaltoToken::verifyPIN - ## ERROR ## Invalid PIN length\n");
 		CssmError::throwMe(CSSM_ERRCODE_INVALID_SAMPLE_VALUE);
 	}
 
 	CK_BYTE* pPIN = new CK_BYTE[pinLength];
-	memset( pPIN, 0, sizeof( CK_BYTE ) * pinLength );
-	for( size_t i = 0 ; i < pinLength ; i++ )
+	memset(pPIN, 0, sizeof(CK_BYTE) * pinLength);
+	for(size_t i = 0 ; i < pinLength ; i++)
 	{
 		pPIN[ i ] = (CK_BYTE)pin[ i ];
 	}
 
-	CK_RV rv = CK_D_(C_Login)( mCKSession, CKU_USER, pPIN, pinLength );
+	CK_RV rv = CK_D_(C_Login)(mCKSession, CKU_USER, pPIN, pinLength);
 
 	mPinStatus = SCARD_AUTHENTICATION_FAILED;
-	if ( ( CKR_OK == rv ) || ( CKR_USER_ALREADY_LOGGED_IN == rv ) )
+	if ((CKR_OK == rv) || (CKR_USER_ALREADY_LOGGED_IN == rv))
 	{
 		mPinStatus = SCARD_SUCCESS;
 	}
 	else
 	{
-		log( "GemaltoToken::verifyPIN - ## Error ## <%ld>\n", rv );
+		log("GemaltoToken::verifyPIN - ## Error ## <%ld>\n", rv);
 
-		if ( CKR_PIN_LOCKED == rv )
+		if (CKR_PIN_LOCKED == rv)
 		{
 			mPinStatus = SCARD_AUTHENTICATION_BLOCKED;
 		}
@@ -246,14 +246,14 @@
 	delete[ ] pPIN;
 
 
-	log( "GemaltoToken::verifyPIN <END>\n" );
+	log("GemaltoToken::verifyPIN <END>\n");
 }
 
 
 void GemaltoToken::unverifyPIN(int pinNum)
 {
-	log( "\nGemaltoToken::unverifyPIN <BEGIN>\n" );
-	log( "pinNum <%d>\n", pinNum );
+	log("\nGemaltoToken::unverifyPIN <BEGIN>\n");
+	log("pinNum <%d>\n", pinNum);
 
 	if (pinNum != -1)
 		CssmError::throwMe(CSSM_ERRCODE_SAMPLE_VALUE_NOT_SUPPORTED);
@@ -270,16 +270,16 @@
 
 	mPinStatus = 0;
 
-	log( "GemaltoToken::unverifyPIN <END>\n" );
+	log("GemaltoToken::unverifyPIN <END>\n");
 }
 
 
 #define PKCS11_FAILED(fct, rv) log("GemaltoToken::probe - " fct "() failed: %s\n", pkcs11_error(rv));
 uint32 GemaltoToken::probe(SecTokendProbeFlags flags, char tokenUid[TOKEND_MAX_UID])
 {
-	log( "\nGemaltoToken::probe <BEGIN>\n" );
-	log( "GemaltoToken::probe - flags <%x>\n", (unsigned int) flags );
-	log( "GemaltoToken::probe - tokenUid <%s>\n", tokenUid );
+	log("\nGemaltoToken::probe <BEGIN>\n");
+	log("GemaltoToken::probe - flags <%x>\n", (unsigned int) flags);
+	log("GemaltoToken::probe - tokenUid <%s>\n", tokenUid);
 
 	uint32 score = 0;
 
@@ -288,10 +288,10 @@
 		const SCARD_READERSTATE &readerState = *(*startupReaderInfo)();
 		if (readerState.cbAtr)
 		{
-			log( "GemaltoToken::probe - Reader <%s>\n", readerState.szReader);
+			log("GemaltoToken::probe - Reader <%s>\n", readerState.szReader);
 			std::string s = "";
-			GemaltoToken::toStringHex( readerState.rgbAtr, readerState.cbAtr, s );
-			log( "GemaltoToken::probe - ATR <%s>\n", s.c_str( ) );
+			GemaltoToken::toStringHex(readerState.rgbAtr, readerState.cbAtr, s);
+			log("GemaltoToken::probe - ATR <%s>\n", s.c_str());
 
 			DIR *dirp = opendir(PKCS11LIB_PATH);
 			if (NULL == dirp)
@@ -320,19 +320,19 @@
 
 				lib_name.append(dir_entry->d_name);
 				dlPath = lib_name.c_str();
-				log( "GemaltoToken::probe - Using %s PKCS#11 library\n", dlPath );
+				log("GemaltoToken::probe - Using %s PKCS#11 library\n", dlPath);
 				
 				mDLHandle = dlopen(dlPath, RTLD_LAZY | RTLD_GLOBAL);
 				if (NULL == mDLHandle)
 				{
-					log( "GemaltoToken::probe - ## ERROR ## Cannot load the PKCS#11 library\n" );
+					log("GemaltoToken::probe - ## ERROR ## Cannot load the PKCS#11 library\n");
 					continue;
 				}
 				
 				CK_C_GetFunctionList C_GetFunctionList_PTR = (CK_C_GetFunctionList) dlsym(mDLHandle, "C_GetFunctionList");
 				if (NULL == C_GetFunctionList_PTR)
 				{
-					log( "GemaltoToken::probe - ## ERROR ## Cannot load the PKCS#11 function list\n", dlerror() );
+					log("GemaltoToken::probe - ## ERROR ## Cannot load the PKCS#11 function list\n", dlerror());
 					continue;
 				}
 				
@@ -392,13 +392,13 @@
 						// Setup the tokendUID
 						char label[ sizeof(mCKTokenInfo.label)+1 ];
 						label[sizeof(mCKTokenInfo.label)] = '\0';
-						memcpy( label, mCKTokenInfo.label,  sizeof(mCKTokenInfo.label) );
-						char* trimLabel = trim_line( label );
-						snprintf(tokenUid, TOKEND_MAX_UID, "Gemalto smartcard %s (%.*s)", trimLabel, (int) sizeof(mCKTokenInfo.serialNumber), mCKTokenInfo.serialNumber );
+						memcpy(label, mCKTokenInfo.label,  sizeof(mCKTokenInfo.label));
+						char* trimLabel = trim_line(label);
+						snprintf(tokenUid, TOKEND_MAX_UID, "Gemalto smartcard %s (%.*s)", trimLabel, (int) sizeof(mCKTokenInfo.serialNumber), mCKTokenInfo.serialNumber);
 						
 						for (size_t len=strlen(tokenUid); tokenUid[len-1]==' '; len--)
 							tokenUid[len-1] = '\0';
-						log( "tokenUid <%s>\n", tokenUid );
+						log("tokenUid <%s>\n", tokenUid);
 
 						found = true;
 						mCKSlotId = pSlotID[i];
@@ -426,7 +426,7 @@
 		score = 0;
 	}
 
-	log( "GemaltoToken::probe <END>\n" );
+	log("GemaltoToken::probe <END>\n");
 
 	return score;
 }
@@ -434,8 +434,8 @@
 
 void GemaltoToken::establish(const CSSM_GUID *guid, uint32 subserviceId, SecTokendEstablishFlags flags, const char *cacheDirectory, const char *workDirectory, char mdsDirectory[PATH_MAX], char printName[PATH_MAX])
 {
-	log( "\nGemaltoToken::establish <BEGIN>\n" );
-	log( "flags <%x> - cacheDirectory <%s> - workDirectory <%s>\n", (unsigned int)flags, cacheDirectory, workDirectory );
+	log("\nGemaltoToken::establish <BEGIN>\n");
+	log("flags <%x> - cacheDirectory <%s> - workDirectory <%s>\n", (unsigned int)flags, cacheDirectory, workDirectory);
 
 	Token::establish(guid, subserviceId, flags, cacheDirectory, workDirectory, mdsDirectory, printName);
 
@@ -448,15 +448,15 @@
 	populate();
 
 	char label[ 33 ];
-	memset( label, 0, sizeof( label ) );
-	memcpy( label, mCKTokenInfo.label,  sizeof(mCKTokenInfo.label) );
- 	char* trimLabel = trim_line( label );
-	snprintf(printName, PATH_MAX, "Gemalto smartcard %s (%.*s)", trimLabel, (int) sizeof(mCKTokenInfo.serialNumber), mCKTokenInfo.serialNumber );
+	memset(label, 0, sizeof(label));
+	memcpy(label, mCKTokenInfo.label,  sizeof(mCKTokenInfo.label));
+ 	char* trimLabel = trim_line(label);
+	snprintf(printName, PATH_MAX, "Gemalto smartcard %s (%.*s)", trimLabel, (int) sizeof(mCKTokenInfo.serialNumber), mCKTokenInfo.serialNumber);
 	for (size_t len=strlen(printName); printName[len-1]==' '; len--)
 		printName[len-1] = '\0';
 
-	log( "printName <%s>\n", printName );
-	log( "GemaltoToken::establish <END>\n" );
+	log("printName <%s>\n", printName);
+	log("GemaltoToken::establish <END>\n");
 }
 
 
@@ -465,7 +465,7 @@
 //
 void GemaltoToken::getOwner(AclOwnerPrototype &owner)
 {
-	log( "\nGemaltoToken::getOwner <BEGIN>\n" );
+	log("\nGemaltoToken::getOwner <BEGIN>\n");
 
 	// we don't really know (right now), so claim we're owned by PIN #1
 	if (!mAclOwner) {
@@ -474,14 +474,14 @@
 	}
 	owner = mAclOwner;
 
-	log( "GemaltoToken::getOwner <END>\n" );
+	log("GemaltoToken::getOwner <END>\n");
 }
 
 
 void GemaltoToken::getAcl(const char *tag, uint32 &count, AclEntryInfo *&acls)
 {
-	log( "\nGemaltoToken::getAcl <BEGIN>\n" );
-	log( "tag <%s> - count <%lu>\n", tag, count );
+	log("\nGemaltoToken::getAcl <BEGIN>\n");
+	log("tag <%s> - count <%lu>\n", tag, count);
 
 	Allocator &alloc = Allocator::standard();
 
@@ -493,11 +493,11 @@
 		uint32_t status = this->pinStatus(pin);
 		if (status == SCARD_SUCCESS)
 		{
-			_addPinState(acl, pin, CSSM_ACL_PREAUTH_TRACKING_AUTHORIZED );
+			_addPinState(acl, pin, CSSM_ACL_PREAUTH_TRACKING_AUTHORIZED);
 		}
-		else if ( SCARD_AUTHENTICATION_BLOCKED == status )
+		else if (SCARD_AUTHENTICATION_BLOCKED == status)
 		{
-			_addPinState(acl, pin, CSSM_ACL_PREAUTH_TRACKING_BLOCKED );
+			_addPinState(acl, pin, CSSM_ACL_PREAUTH_TRACKING_BLOCKED);
 		}
 		else
 		{
@@ -506,9 +506,9 @@
 		count = acl.size();
 		acls = acl.entries();
 
-		log( "count <%lu>\n", count );
+		log("count <%lu>\n", count);
 
-		log( "GemaltoToken::getAcl <END>\n" );
+		log("GemaltoToken::getAcl <END>\n");
 		return;
 	}
 
@@ -530,8 +530,8 @@
 	count = mAclEntries.size();
 	acls = mAclEntries.entries();
 
-	log( "count <%lu>\n", count );
-	log( "GemaltoToken::getAcl <END>\n" );
+	log("count <%lu>\n", count);
+	log("GemaltoToken::getAcl <END>\n");
 }
 
 
@@ -540,53 +540,53 @@
 
 void GemaltoToken::populate()
 {
-	log( "\nGemaltoToken::populate <BEGIN>\n" );
+	log("\nGemaltoToken::populate <BEGIN>\n");
 
 	Tokend::Relation &certRelation = mSchema->findRelation(CSSM_DL_DB_RECORD_X509_CERTIFICATE);
 	Tokend::Relation &privateKeyRelation = mSchema->findRelation(CSSM_DL_DB_RECORD_PRIVATE_KEY);
 
 	// Find all certificates into the smartcard
 	CK_OBJECT_CLASS	ulClass = CKO_CERTIFICATE;
-	CK_ATTRIBUTE classAttr = { CKA_CLASS, &ulClass, sizeof( CK_OBJECT_CLASS ) };
-	CKError::check( CK_D_(C_FindObjectsInit)( mCKSession, &classAttr, 1 ) );
-	while ( 1 )
+	CK_ATTRIBUTE classAttr = { CKA_CLASS, &ulClass, sizeof(CK_OBJECT_CLASS) };
+	CKError::check(CK_D_(C_FindObjectsInit)(mCKSession, &classAttr, 1));
+	while (1)
 	{
 		CK_OBJECT_HANDLE ulObject = CK_INVALID_HANDLE;
 		CK_ULONG ulObjectCount = 0;
 
-		CKError::check( CK_D_(C_FindObjects)( mCKSession, &ulObject, 1, &ulObjectCount ) );
-		if ( 0 == ulObjectCount )
+		CKError::check(CK_D_(C_FindObjects)(mCKSession, &ulObject, 1, &ulObjectCount));
+		if (0 == ulObjectCount)
 		{
-			log( "GemaltoToken::populate - No more certificate into the smartcard. Nothing more to do !!!\n" );
+			log("GemaltoToken::populate - No more certificate into the smartcard. Nothing more to do !!!\n");
 			break;
 		}
 
-		log( "GemaltoToken::populate - Found a certificate into the smartcard \n" );
+		log("GemaltoToken::populate - Found a certificate into the smartcard \n");
 
 		// Create a certificate instance
-		RefPointer<GemaltoCertRecord> cert( new GemaltoCertRecord( *this, ulObject ) );
-		certRelation.insertRecord( cert );
+		RefPointer<GemaltoCertRecord> cert(new GemaltoCertRecord(*this, ulObject));
+		certRelation.insertRecord(cert);
 
 		// If the current certificate is not a ROOT CA certificate
-		if ( false == cert->isCA( ) )
+		if (false == cert->isCA())
 		{
 			// If the current certificat is able to perform a cryptographic operation
-			if ( cert->verify( ) || cert->verifyRecover( ) || cert->encrypt( ) || cert->wrap( ) )
+			if (cert->verify() || cert->verifyRecover() || cert->encrypt() || cert->wrap())
 			{
-				log( "GemaltoToken::populate - The current certificate is not a ROOT and owns private key usage(s). Create associated private key.\n" );
+				log("GemaltoToken::populate - The current certificate is not a ROOT and owns private key usage(s). Create associated private key.\n");
 
 				// Create a private key
-				RefPointer<GemaltoKeyRecord> keyPrvRecord( new GemaltoPrivateKeyRecord( *cert ) );
-				privateKeyRelation.insertRecord( keyPrvRecord );
+				RefPointer<GemaltoKeyRecord> keyPrvRecord(new GemaltoPrivateKeyRecord(*cert));
+				privateKeyRelation.insertRecord(keyPrvRecord);
 
 				// The Adornment class links a particular CertificateRecord with its corresponding KeyRecord record
-				keyPrvRecord->setAdornment( mSchema->publicKeyHashCoder( ).certificateKey( ), new Tokend::LinkedRecordAdornment( cert ) );
+				keyPrvRecord->setAdornment(mSchema->publicKeyHashCoder().certificateKey(), new Tokend::LinkedRecordAdornment(cert));
 			}
 		}
 	}
-	CK_D_(C_FindObjectsFinal)( mCKSession );
+	CK_D_(C_FindObjectsFinal)(mCKSession);
 
-	log( "GemaltoToken::populate <END>\n" );
+	log("GemaltoToken::populate <END>\n");
 }
 
 
@@ -653,9 +653,9 @@
 void GemaltoToken::_addPinState(AutoAclEntryInfoList& acl, uint32 slot, uint32 status)
 {
 	char tag[20];
-	snprintf( tag, sizeof(tag), "PIN%d?", (int) slot );
+	snprintf(tag, sizeof(tag), "PIN%d?", (int) slot);
 
-	TypedList subj( acl.allocator(), CSSM_WORDID_PIN, new(acl.allocator()) ListElement(slot), new(acl.allocator()) ListElement(status));
+	TypedList subj(acl.allocator(), CSSM_WORDID_PIN, new(acl.allocator()) ListElement(slot), new(acl.allocator()) ListElement(status));
 
 	acl.add(subj, CSSM_WORDID_PIN, tag);
 }
@@ -667,17 +667,17 @@
 // Define to unable if you want to activate trace into the code
 #define __DEBUG_GEMALTO__
 
-void GemaltoToken::toStringHex( const unsigned char* buffer, const std::size_t& size, std::string &result )
+void GemaltoToken::toStringHex(const unsigned char* buffer, const std::size_t& size, std::string &result)
 {
 #ifdef __DEBUG_GEMALTO__
-	if( ( NULL == buffer ) || ( 1 > size ) )
+	if ((NULL == buffer) || (1 > size))
 	{
-		//result.assign( "null" );
+		//result.assign("null");
 		return;
 	}
 
     std::ostringstream oss;
-	oss.rdbuf( )->str( "" );
+	oss.rdbuf()->str("");
 
     // Afficher en hexadecimal et en majuscule
     oss << std::hex << std::uppercase;
@@ -685,7 +685,7 @@
     // Remplir les blancs avec des z\x8Eros
     oss << std::setfill('0');
 
-    for( std::size_t i = 0; i < size; ++i )
+    for(std::size_t i = 0; i < size; ++i)
     {
         // Separer chaque octet par un espace
         /*if (i != 0)
@@ -693,21 +693,21 @@
 
         // Afficher sa valeur hexad\xE9cimale pr\xE9c\xE9d\xE9e de "0x"
         // setw(2) permet de forcer l'affichage \xE0 2 caract\xE8res
-        oss << /*"0x" <<*/ std::setw(2) << static_cast<int>( buffer[i] );
+        oss << /*"0x" <<*/ std::setw(2) << static_cast<int>(buffer[i]);
     }
 
-    result.assign( oss.str( ) );
+    result.assign(oss.str());
 #endif
 }
 
 #define LOG_FILE "/tmp/Gemalto.TokenD.log"
 /* Log a message into the LOG_FILE file */
-void GemaltoToken::log( const char * format, ... )
+void GemaltoToken::log(const char * format, ...)
 {
 #ifdef __DEBUG_GEMALTO__
 	// Try to open the file
-	FILE* pLog = fopen( LOG_FILE, "a" );
-	if ( NULL == pLog )
+	FILE* pLog = fopen(LOG_FILE, "a");
+	if (NULL == pLog)
 	{
 		// The file does not exit
 		// Nothing to log
@@ -715,12 +715,12 @@
 	}
 
 	va_list args;
-	va_start( args, format );
+	va_start(args, format);
 
 	vfprintf(pLog, format, args);
-	va_end( args );
+	va_end(args);
 
 	// Close the file
-	fclose( pLog );
+	fclose(pLog);
 #endif
 }

Modified: trunk/Tokend/PKCS11/GemaltoToken.h
===================================================================
--- trunk/Tokend/PKCS11/GemaltoToken.h	2010-05-27 07:14:20 UTC (rev 126)
+++ trunk/Tokend/PKCS11/GemaltoToken.h	2010-06-07 09:13:55 UTC (rev 127)
@@ -59,8 +59,8 @@
 
 	static CK_FUNCTION_LIST_PTR s_CK_pFunctionList;
 
-	static void log( const char * format, ... );
-	static void toStringHex( const unsigned char* pIn, const std::size_t &ulInLen, std::string &szOut );
+	static void log(const char * format, ...);
+	static void toStringHex(const unsigned char* pIn, const std::size_t &ulInLen, std::string &szOut);
 
 	inline CK_SESSION_HANDLE session(void) const	{ return mCKSession; }
 	inline const CK_TOKEN_INFO* info(void) const	{ return &mCKTokenInfo; }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/smartcardservices-changes/attachments/20100607/e44d4499/attachment-0001.html>


More information about the SmartcardServices-Changes mailing list