Commit 3416e945 authored by berge's avatar berge
Browse files

Added more logs

parent 9458e1e2
Loading
Loading
Loading
Loading
+37 −19
Original line number Diff line number Diff line
@@ -264,6 +264,7 @@ module ePassport_Altsteps {
                // Check current file
                v_logicalChannel := f_getLogicalChannel(v_readCommand.class);
                if(vc_simu.currentFiles[v_logicalChannel] == c_noFileInfo) {
                	log("**** a_aisReadCertificateData: ERROR: No file selected ****");
                    mrtdport.send(m_responseNOK(c_w1w2NoCurrentEF));
                    t_ac.start;
                    repeat;
@@ -275,6 +276,7 @@ module ePassport_Altsteps {
                v_result := f_readFileData(vc_simu.currentFiles[v_logicalChannel].filename, v_offset, v_dataLength, v_data);
                
                if(v_data == ''O) {
                	log("**** a_aisReadCertificateData: ERROR: read error ****");
                    mrtdport.send(m_responseNOK(c_w1w2WrongParametersP1P2));
                }
                else {
@@ -437,6 +439,7 @@ module ePassport_Altsteps {
                    f_setInitialSscForMessageAuthentication(c_8ZeroBytes);
                }
                else {
                	log("**** a_chipAuthentication: ERROR: Chip Authentication failed ****");
                    mrtdport.send(m_responseNOK(v_chipAuthenticationResult));
                }
                t_ac.start;
@@ -467,6 +470,7 @@ module ePassport_Altsteps {
                    mrtdport.send(m_responseOK);
                }
                else {
                	log("**** a_terminalAuthentication: ERROR: Certificate not trusted ****");
                    mrtdport.send(m_responseNOK(c_w1w2ReferencedDataOrReferenceDataNotFound));
                }
                t_ac.start;
@@ -475,7 +479,7 @@ module ePassport_Altsteps {
            
            [] mrtdport.receive(mw_psoVerifyCertificate) -> value v_psoCommand {
                
                // FIXME : ifpresent, ifchosen
                if(ischosen(v_psoCommand.payload.performSecurityOperationData.psoVerifyCertificate.psoVerifyCertificateOverFullTemplate)) {
                    v_certificate := bit2oct(encvalue(v_psoCommand.payload.performSecurityOperationData.psoVerifyCertificate
                                        .psoVerifyCertificateOverFullTemplate.cvCertificateBody));
                    v_publicKey := v_psoCommand.payload.performSecurityOperationData.psoVerifyCertificate
@@ -490,8 +494,14 @@ module ePassport_Altsteps {
                        mrtdport.send(m_responseOK);
                    }
                    else {
                    	log("**** a_terminalAuthentication: ERROR: Certificate verification failed ****");
                        mrtdport.send(m_responseNOK(c_w1w2ConditionsOfUseNotSatisfied));
                    }
                }
                else {
                	log("**** a_terminalAuthentication: ERROR: psoVerifyCertificateOverFullTemplate not chosen ****");
                    mrtdport.send(m_responseNOK(c_w1w2NoPreciseDiagnosis));
                }
                t_ac.start;
                repeat;
            }
@@ -523,6 +533,7 @@ module ePassport_Altsteps {
                    mrtdport.send(m_responseOK);
                }
                else {
                	log("**** a_terminalAuthentication: ERROR: Challenge verification failed ****");
                    mrtdport.send(m_responseNOK(c_w1w2StateOfNonVolatileMemoryHasChanged));
                }
                
@@ -613,6 +624,7 @@ module ePassport_Altsteps {
                // Check current file
                v_logicalChannel := f_getLogicalChannel(v_readCommand.class);
                if(vc_simu.currentFiles[v_logicalChannel] == c_noFileInfo) {
                	log("**** a_readFile: ERROR: No file selected ****");
                    mrtdport.send(m_responseNOK(c_w1w2NoCurrentEF));
                    t_ac.start;
                    repeat;
@@ -653,6 +665,7 @@ module ePassport_Altsteps {
                
                v_result := f_readFileData(vc_simu.currentFiles[v_logicalChannel].filename, v_offset, v_dataLength, v_data);
                if(v_data == ''O ) {
                	log("**** a_readFile: ERROR: read error ****");
                    mrtdport.send(m_responseNOK(v_result));
                }
                else {
@@ -668,6 +681,7 @@ module ePassport_Altsteps {
                // Check current file
                v_logicalChannel := f_getLogicalChannel(v_readB1Command.class);
                if(match(vc_simu.currentFiles[v_logicalChannel], c_noFileInfo)) {
                	log("**** a_readFile: ERROR: No file selected ****");
                    mrtdport.send(m_responseNOK(c_w1w2NoCurrentEF));
                    t_ac.start;
                    repeat;
@@ -732,6 +746,7 @@ module ePassport_Altsteps {
                // Check current file
                v_logicalChannel := f_getLogicalChannel(v_readCommand.class);
                if(match(vc_simu.currentFiles[v_logicalChannel], c_noFileInfo)) {
                	log("**** a_readAnyFile: ERROR: No file selected ****");
                    mrtdport.send(m_responseNOK(c_w1w2NoCurrentEF));
                    t_ac.start;
                    repeat;
@@ -781,6 +796,7 @@ module ePassport_Altsteps {
                }
                
                if(v_data == ''O ) {
                	log("**** a_readAnyFile: ERROR: read error ****");
                    mrtdport.send(m_responseNOK(v_result));
                }
                else {
@@ -796,6 +812,7 @@ module ePassport_Altsteps {
                // Check current file
                v_logicalChannel := f_getLogicalChannel(v_readB1Command.class);
                if(match(vc_simu.currentFiles[v_logicalChannel], c_noFileInfo)) {
                	log("**** a_readAnyFile: ERROR: No file selected ****");
                    mrtdport.send(m_responseNOK(c_w1w2NoCurrentEF));
                    t_ac.start;
                    repeat;
@@ -822,6 +839,7 @@ module ePassport_Altsteps {
                    v_result := c_w1w2WrongLength;
                }
                if(v_data == ''O ) {
                	log("**** a_readAnyFile: ERROR: read error ****");
                    mrtdport.send(m_responseNOK(v_result));
                }
                else {
+5 −2
Original line number Diff line number Diff line
@@ -580,6 +580,7 @@
            v_receivedRndIcc := substr(v_s, c_bacNonceSize, c_bacNonceSize); 
            v_keyIfd := substr(v_s, 2*c_bacNonceSize, c_bacKeySize); 
            if(not match(v_receivedRndIcc, p_rndIcc)) {
            	log("**** f_basicAccessControl: ERROR: RND.ICC mismatch ****");
                mrtdport.send(m_responseNOK(c_w1w2NoPreciseDiagnosis));
                return ''O;
            }
@@ -1309,10 +1310,12 @@
            var ChrList v_trustPointIds := {};
            var octetstring v_trustPointId;
            var integer v_next := 0;
            var charstring v_chr := "";
            
            do {    
                v_next := f_extractId(p_trustPointIds, v_next, v_trustPointId) + 1;
                v_trustPointIds[sizeof(v_trustPointIds)] := oct2char(v_trustPointId);
                v_chr := oct2char(v_trustPointId);
                v_trustPointIds[sizeof(v_trustPointIds)] := v_chr; 
            } while(v_next < lengthof(p_trustPointIds));
            return v_trustPointIds;
        }