r3179 - in trunk/libmikey: include/libmikey keyagreement

xuan at minisip.org xuan at minisip.org
Thu Feb 1 15:50:18 CET 2007


Author: xuan
Date: 2007-02-01 15:50:16 +0100 (Thu, 01 Feb 2007)
New Revision: 3179

Modified:
   trunk/libmikey/include/libmikey/KeyAgreementDH.h
   trunk/libmikey/keyagreement/KeyAgreementDH.cxx
   trunk/libmikey/keyagreement/KeyAgreementDHHMAC.cxx
Log:

 * Fix for KeyAgreement with smart card: DH base class was not properly initiated with SIM card



Modified: trunk/libmikey/include/libmikey/KeyAgreementDH.h
===================================================================
--- trunk/libmikey/include/libmikey/KeyAgreementDH.h	2007-02-01 14:48:35 UTC (rev 3178)
+++ trunk/libmikey/include/libmikey/KeyAgreementDH.h	2007-02-01 14:50:16 UTC (rev 3179)
@@ -60,7 +60,7 @@
 
 class LIBMIKEY_API KeyAgreementDHBase: virtual public ITgk{
 	public:
-		KeyAgreementDHBase(MRef<SipSim* > sim=NULL);
+		KeyAgreementDHBase(MRef<SipSim* > sim);
 		~KeyAgreementDHBase();
 
 		int computeTgk();

Modified: trunk/libmikey/keyagreement/KeyAgreementDH.cxx
===================================================================
--- trunk/libmikey/keyagreement/KeyAgreementDH.cxx	2007-02-01 14:48:35 UTC (rev 3178)
+++ trunk/libmikey/keyagreement/KeyAgreementDH.cxx	2007-02-01 14:50:16 UTC (rev 3179)
@@ -70,7 +70,9 @@
 	dh(NULL)
 
 {
+	
 	if (!sim){
+		cerr << "EEEE: DHBase created WITHOUT SIM"<<endl;
 		dh = new OakleyDH();
 		if( dh == NULL )
 		{
@@ -78,6 +80,8 @@
 					"DH parameters." );
 		}
 	}
+	else
+		cerr << "EEEE: DHBase created with SIM"<<endl;
 
 }
 
@@ -100,12 +104,14 @@
 KeyAgreementDH::KeyAgreementDH( MRef<certificate_chain *> certChainPtr,
 		MRef<ca_db *> certDbPtr ):
 	KeyAgreement(),
+	KeyAgreementDHBase(NULL),
 	PeerCertificates( certChainPtr, certDbPtr )
 {
 }
 
 KeyAgreementDH::KeyAgreementDH( MRef<SipSim*> s ):
 	KeyAgreement(s),
+	KeyAgreementDHBase(s),
 	PeerCertificates( s->getCertificateChain(), s->getCAs() )
 {
 
@@ -121,9 +127,9 @@
 
 int KeyAgreementDHBase::setGroup( int groupValue ){
 #ifdef SCSIM_SUPPORT
-	if (dynamic_cast<SipSimSmartCardGD*>(*sim)){
+	if (sim && dynamic_cast<SipSimSmartCardGD*>(*sim)){
 		SipSimSmartCardGD* gd = dynamic_cast<SipSimSmartCardGD*>(*sim);
-
+		cerr<<"EEEE: the public key is generated+++++++++++"<<endl;
 		assert (groupValue==DH_GROUP_OAKLEY5);
 
 		publicKeyPtr = new unsigned char[192];
@@ -134,6 +140,7 @@
 	else
 #endif
 	{
+		cerr <<"EEEE: KeyAgreementDHBase: sim is NULL or not GD sim"<< endl;
 
 		if( !dh->setGroup( groupValue ) )
 			return 1;

Modified: trunk/libmikey/keyagreement/KeyAgreementDHHMAC.cxx
===================================================================
--- trunk/libmikey/keyagreement/KeyAgreementDHHMAC.cxx	2007-02-01 14:48:35 UTC (rev 3178)
+++ trunk/libmikey/keyagreement/KeyAgreementDHHMAC.cxx	2007-02-01 14:50:16 UTC (rev 3179)
@@ -35,7 +35,7 @@
 KeyAgreementDHHMAC::KeyAgreementDHHMAC( const unsigned char * pskPtr,
 					int pskLengthValue )
 		:KeyAgreementPSK(pskPtr, pskLengthValue),
-		 KeyAgreementDHBase(){
+		 KeyAgreementDHBase(NULL){
 }
 
 KeyAgreementDHHMAC::~KeyAgreementDHHMAC(){



More information about the Minisip-devel mailing list