Commit 0d521c17 authored by garciay's avatar garciay
Browse files

First Q&D degugging

parent df70e235
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -245,14 +245,13 @@
    	altstep a_bac() runs on MRTD {
	
        	var CommandExternalOrMutualAuthenticate v_command;
        	var octetstring v_rndIcc;
        	var octetstring v_response;
        	var octetstring v_challengeResponse;
        	
        	[] mrtdport.receive(mw_getChallenge) {            		
        		// MRTD sends its random challenge to IS
        		v_rndIcc := f_generateRandomOctetstring(c_bacNonceSize);
    			mrtdport.send(m_responseRead(v_rndIcc));
        		vc_simu.rndIcc := f_generateRandomOctetstring(c_bacNonceSize);
    			mrtdport.send(m_responseRead(vc_simu.rndIcc));
				repeat;
        	}
        	
@@ -261,7 +260,9 @@
    			v_challengeResponse := v_command.payload
						.externalOrMutualAuthenticateData.challengeResponse ;
        		
        		v_response := f_basicAccessControl(v_rndIcc, v_challengeResponse);
        		// TODO check vc_simu.rndIcc != omit
        		
        		v_response := f_basicAccessControl(vc_simu.rndIcc, v_challengeResponse);
        		mrtdport.send(m_responseRead(v_response));
        		vc_simu.securityStatus := e_basicAccessControl;
				repeat;
+8 −1
Original line number Diff line number Diff line
@@ -313,8 +313,11 @@
        	var octetstring v_ssc;
    		
	        v_encryptedIfdLength := lengthof(p_challengeResponse) - c_bacMacSize;
	        log("v_encryptedIfdLength: ", v_encryptedIfdLength);
			v_encryptedIfd := substr(p_challengeResponse, 0, v_encryptedIfdLength);
			log("v_encryptedIfd: ", v_encryptedIfd);
    		v_macIfd := substr(p_challengeResponse, v_encryptedIfdLength, c_bacMacSize);
    		log("v_macIfd: ", v_macIfd);
			
			// a) Check the checksum M_IFD of the cryptogram E_IFD.
			v_computedMacIfd := f_cryptographicChecksum(vc_simu.kMac, v_encryptedIfd);
@@ -325,11 +328,15 @@
			
    		// b) Decrypt the cryptogram E_IFD.
			v_s := f_decrypt3Des(f_build3DesKey(vc_simu.kEnc), v_encryptedIfd);	
			log("v_s: ", v_s);
			
    		// c) Extract RND.ICC from S and check if IFD returned the correct value.
    		v_rndIfd := substr(v_s, 0, c_bacNonceSize);
    		log("v_rndIfd: ", v_rndIfd);
    		v_receivedRndIcc := substr(v_s, c_bacNonceSize, c_bacNonceSize); 
    		log("v_receivedRndIcc: ", v_receivedRndIcc);
    		v_keyIfd := substr(v_s, 2*c_bacNonceSize, c_bacKeySize); 
    		log("v_keyIfd: ", v_keyIfd);
    		if(not match(v_receivedRndIcc, p_rndIcc)) {
    			//TODO
    			return ''O;
+2 −2
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ module ePassport_Templates {
		first := {
			tag := c_firstInterindustryClass,
			chaining := e_lastOrOnlyCommand,
            sm := e_noSM,
            sm := ?, //FIXME
            channelNumber := p_channelNumber
		}
	}
@@ -90,7 +90,7 @@ module ePassport_Templates {
		first := {
			tag := c_firstInterindustryClass,
			chaining := e_lastOrOnlyCommand,
            sm := e_noSM,
            sm := ?, //FIXME
            channelNumber := 0
		}
	}
+2 −1
Original line number Diff line number Diff line
@@ -59,7 +59,8 @@ module ePassport_TestSystem {
		CertList trustedCertificates optional, // list of trusted certificates
		
		// Security Environment
		Chr	dst optional	
		Chr	dst optional,	
		octetstring rndIcc optional
	}
/*
	type component TestAdapter {