Commit 1d082adf authored by berge's avatar berge
Browse files

Huge changes in types (part1)

parent c57f6dd1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -83,7 +83,6 @@ module ePassport_Templates {
		}
	}


	template Class mw_class_00 := {
		first := {
			chaining := e_lastOrOnlyCommand,
@@ -249,5 +248,6 @@ module ePassport_Templates {
    		w1w2 := p_w1w2
    	}
	} // end responseTemplates
	
} // end ePassport_Templates
+42 −2
Original line number Diff line number Diff line
@@ -68,8 +68,48 @@ module ePassport_TestSystem {
group portDefs {
	
	type port MrtdPort message {
		in Command; 
		out Response;
		in 
			CommandDeactivateFile, 
    		CommandEraseRecords,
    		CommandEraseBinary,
    		CommandPerformScqlOperation, 
    		CommandPerformTransactionOperation,
    		CommandPerformUserOperation,
    		CommandVerify,
    		CommandManageSecurityEnvironment,
    		CommandChangeReferenceData,
    		CommandDisableVerificationRequirement,
    		CommandEnableVerificationRequirement,
    		CommandPerformSecurityOperation,
    		CommandResetRetryCounter,
    		CommandActivateFile,
    		CommandGenerateAsymmetricKeyPair,
    		CommandManageChannel,
    		CommandExternalOrMutualAuthenticate, 
    		CommandGetChallenge,
    		CommandGeneralAuthenticate, 
    		CommandInternalAuthenticate,
    		CommandSearchBinary,
    		CommandSearchRecord,
    		CommandSelect,
    		CommandReadBinary,
    		CommandReadRecords,
    		CommandGetResponse,
    		CommandEnvelope,
    		CommandGetData,
    		CommandWriteBinary,
    		CommandWriteRecord,
    		CommandUpdateBinary,
    		CommandPutDataWith,
    		CommandUpdateRecord,
    		CommandCreateFile,
    		CommandAppendRecord,
    		CommandDeleteFile,
    		CommandTerminateDF,
    		CommandTerminateCardUsage,
    		Command; 
		out 
			Response;
	};
	
	type port Mgmt message {
+248 −3
Original line number Diff line number Diff line
@@ -87,11 +87,223 @@ module ePassport_Types {
			type record Command {
				Class  	    	class,
				Instruction    	ins,
				P1Status		p1,
				P2Status 		p2,
				Payload			payload
				CommandMsg		msg
			} with {variant "isPdu;"};
			
			type union CommandMsg {
				ManageSecurityEnvironmentMsg manageSecurityEnvironmentMsg,
				SelectMsg selectMsg
				// ...
			}

			type record RawPayload {
				FailureReason failureReason,
				octetstring undecrypted,
				octetstring undecoded	
			}
			
			type enumerated FailureReason {
				e_badChecksum,
				e_decryptionFailed,
				e_decodingFailed					
			}
			
			group ManageSecurityEnvironment {

    			type record ManageSecurityEnvironmentMsg {
    				ManageSecurityEnvironmentP1 p1,
    				ManageSecurityEnvironmentP2 p2,
    				ManageSecurityEnvironmentPayload payload optional // presence depends on p2 (present if 0xa4, 0xa6, 0xaa, 0xb4, 0xb6, 0xb8)
    			}
				
				group ManageSecurityEnvironmentP1 {
				
    				type record ManageSecurityEnvironmentP1 {
    					MseSecureMessagingInCommandDataField mseSecureMessagingInCommandDataField,
        				MseSecureMessagingInResponseDataField mseSecureMessagingInResponseDataField,
        				MseComputationDeciphermentIntAuthKeyAgreement mseComputationDeciphermentIntAuthKeyAgreement,
        				MseVerificationEnciphermentExtAuthKeyAgreement mseVerificationEnciphermentExtAuthKeyAgreement,
        				MseFunction mseFunction
    				}
    	
    				type enumerated MseSecureMessagingInCommandDataField {
    					e_mseNoSecureMessagingInCommandDataField(0),
    					e_mseSecureMessagingInCommandDataField(1)
    				} with {variant "length=1"}
    					
    				type enumerated MseSecureMessagingInResponseDataField {
    					e_mseNoSecureMessagingInResponseDataField(0),
    					e_mseSecureMessagingInResponseDataField(1)
    				} with {variant "length=1"}
    				
    				type enumerated MseComputationDeciphermentIntAuthKeyAgreement {
    					e_mseNoComputationDeciphermentIntAuthKeyAgreement(0),
    					e_mseComputationDeciphermentIntAuthKeyAgreement(1)
    				} with {variant "length=1"}
    				
    				type enumerated MseVerificationEnciphermentExtAuthKeyAgreement {
    					e_mseNoVerificationEnciphermentExtAuthKeyAgreement(0),
    					e_mseVerificationEnciphermentExtAuthKeyAgreement(1)
    				} with {variant "length=1"}
    
    				type enumerated MseFunction {
    					e_mseFunctionSet(1),
    					e_mseFunctionStore(2),
    					e_mseFunctionRestore(3),
    					e_mseFunctionErase(4)
    				} with {variant "length=4"}
    				
				} // end ManageSecurityEnvironmentP1

				type Oct1 ManageSecurityEnvironmentP2;

				group ManageSecurityEnvironmentPayload {
	
    				type union ManageSecurityEnvironmentPayload {
    					CrtAT crtAT,
    					CrtKAT crtKAT,
    					//CrtHT crtHT,
    					//CrtCCT crtCCT,
    					CrtDST crtDST, 
    					//CrtCT crtCT
    					RawPayload rawPayload
    				}
 				    				
				} // end ManageSecurityEnvironmentPayload
				
			} // end ManageSecurityEnvironment
						
			group Select {
				
        		type record SelectMsg {
        			SelectP1 p1,
        			SelectP2 p2,
        			SelectPayload payload				
        		}
        		
        		type record SelectP1 {
        			Bit4 reserved,
        			SelectionMethod selectionMethod
        		}
        		
        		type enumerated SelectionMethod {
        			e_selectByFileId(0),
        			e_selectChildDF(1),
        			e_selectEFUnderCurrentDF(2),
        			e_selectParentDFOfCurrentDF(3),
        			e_selectByDFName(4),
        			e_selectFromMF(8),
        			e_selectFromCurrentDF(9)
        		} with {variant "length=4"}
        		
        		type record SelectP2 {
        			Bit4 reserved,
        			FileControlInformation fileControlInformation,
        			FileOccurrence fileOccurence	
        		} with {variant "length=2"}
        		
        		type enumerated FileControlInformation {
        			e_returnFCITemplate(0),
        			e_returnFCPTemplate(1),
        			e_returnFMDTemplate(2),
        			e_noResponseOrProprietary(3)	
        		}
        		
        		type enumerated FileOccurrence {
        			e_firstOrLastOccurrence(0),
        			e_lastOccurrence(1),
        			e_nextOccurrence(2),
        			e_previousOccurrence(3)
        		} with {variant "length=2"}
        		
        		type union SelectPayload {
        			octetstring fileID,
        			RawPayload rawPayload	
        		}
        						
			} // end Select
			
			group ControlReferenceTemplates {
				
				type set CrtAT {
					CrtCryptographicMechanismReference crtCryptographicMechanismReference optional,
					CrtFileReference CrtFileReference optional,
					CrtDfName crtDfName optional,
					CrtReferenceOfSecretOrPublicKey crtReferenceOfSecretOrPublicKey optional,
					CrtReferenceOfSessionOrPrivateKey crtReferenceOfSessionOrPrivateKey optional,
					CrtKeyUsageTemplate crtKeyUsageTemplate	optional,
					CrtAuxChallengeOrDataElementForDerivingKey crtAuxChallengeOrDataElementForDerivingKey optional,
					CrtUsageQualifierByte crtUsageQualifierByte optional
				}
				
				type set CrtKAT {
					CrtCryptographicMechanismReference crtCryptographicMechanismReference optional,
					CrtFileReference CrtFileReference optional,
					CrtDfName crtDfName optional,
					CrtReferenceOfSecretOrPublicKey crtReferenceOfSecretOrPublicKey optional,
					CrtReferenceOfSessionOrPrivateKey crtReferenceOfSessionOrPrivateKey optional,
					CrtKeyUsageTemplate crtKeyUsageTemplate	optional,
					CrtAuxPreviousExchangedChallengePlusOne crtAuxPreviousExchangedChallengePlusOne	optional,
					CrtAuxHashCodeProvidedByCard crtAuxHashCodeProvidedByCard optional,				
				  	CrtAuxRandomNumberProvidedByCard crtAuxRandomNumberProvidedByCard optional,
				  	CrtAuxRandomNumber crtAuxRandomNumber optional,
				  	CrtAuxTimestampProvidedByCard crtAuxTimestampProvidedByCard optional,
				  	CrtAuxTimestamp crtAuxTimestamp optional,
				  	CrtAuxPreviousDigitalSignatureCounterPlusOne crtAuxPreviousDigitalSignatureCounterPlusOne optional,
				  	CrtAuxDigitalSignatureCounter crtAuxDigitalSignatureCounter optional,
					CrtUsageQualifierByte crtUsageQualifierByte optional
				}
				
				type set CrtDST {
					CrtCryptographicMechanismReference crtCryptographicMechanismReference optional,
					CrtFileReference CrtFileReference optional,
					CrtDfName crtDfName optional,
					CrtReferenceOfSecretOrPublicKey crtReferenceOfSecretOrPublicKey optional,
					CrtReferenceOfSessionOrPrivateKey crtReferenceOfSessionOrPrivateKey optional,
					CrtKeyUsageTemplate crtKeyUsageTemplate	optional,
					CrtAuxRandomNumber crtAuxRandomNumber optional,
					CrtUsageQualifierByte crtUsageQualifierByte optional
				}
				
			} // end ControlReferenceTemplates	
				
			group DataObjects { // TLVs !!
					
				type octetstring CrtCryptographicMechanismReference; // 0x80
				
				// File and key references
				type octetstring CrtFileReference; // 0x81
				type octetstring CrtDfName; // 0x82
				type octetstring CrtReferenceOfSecretOrPublicKey; // 0x83
				type octetstring CrtReferenceOfSessionOrPrivateKey; // 0x84
				type octetstring CrtKeyUsageTemplate; // 0xA3
				
				// Initial data reference: Initial check block
				type octetstring CrtIcbNullBlock; // 0x85
				type octetstring CrtIcbChainingBlock; // 0x86
				type octetstring CrtIcbPreviousInitialValueBlockPlusOne; // 0x87 L=0
				type octetstring CrtIcbInitialValueBlock; // 0x87 L>0
					
				// Initial data reference: auxiliary data elements
				type octetstring CrtAuxPreviousExchangedChallengePlusOne; // 0x88 L=0
				type octetstring CrtAuxNoFurtherIndication; // 0x88 L>0
				type octetstring CrtAuxIndexOfProprietaryDataElement; // 0x89 -> 0x8D L=0
				type octetstring CrtAuxValueOfProprietaryDataElement; // 0x89 -> 0x8D L>0
				type octetstring CrtAuxHashCodeProvidedByCard; // 0x90 L=0				
				type octetstring CrtAuxRandomNumberProvidedByCard; // 0x91 L=0
				type octetstring CrtAuxRandomNumber; // 0x91 L>0
				type octetstring CrtAuxTimestampProvidedByCard; // 0x92 L=0
				type octetstring CrtAuxTimestamp; // 0x92 L>0
				type octetstring CrtAuxPreviousDigitalSignatureCounterPlusOne; // 0x93 L=0
				type octetstring CrtAuxDigitalSignatureCounter; // 0x93 L>0
				type octetstring CrtAuxChallengeOrDataElementForDerivingKey; // 0x94
				 
				type octetstring CrtUsageQualifierByte; // 0x95
				
				type octetstring CrtCryptogramContentReference; // 0x8E 
					
			} // end DataObjects
			
			type Command CommandDeactivateFile with {variant "isPdu;present=bits(5,8,0x04);"};
			type Command CommandEraseRecords with {variant "isPdu;present=bits(5,8,0x0C);"};
			type Command CommandEraseBinary with {variant "isPdu;present=bits(5,8,0x0E)||bits(5,8,0x0F);"};
@@ -131,6 +343,39 @@ module ePassport_Types {
			type Command CommandTerminateDF with {variant "isPdu;present=bits(5,8,0xE6)||bits(5,8,0xE8);"};
			type Command CommandTerminateCardUsage with {variant "isPdu;present=bits(5,8,0xFE);"};
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			type union Payload {
				PlainTextPayload 	plainText,
				EncryptedPayload 	encrypted
+1 −1

File changed.

Contains only whitespace changes.