Commit f98c2488 authored by garciay's avatar garciay
Browse files

Add TestSystem

parent f81aa895
Loading
Loading
Loading
Loading
+65 −1
Original line number Diff line number Diff line
@@ -16,9 +16,73 @@ module LibItsSecurity_Functions {
        type 
            Oct32
    }
    import from LibCommon_Sync all;
    
    group helpersFunctions {
    // LibItsSecurity
    import from LibItsSecurity_TestSystem all;
    
    group configurationFunctions {
        
       /**
        * @desc 
        */
        function f_cf01Up() runs on ItsGnSecurity {
            
            // Map
            map(self:acPort, system:acPort);
            map(self:utPort, system:utPort);
            map(self:gnSecurityPort, system:gnSecurityPort);
            
            // Connect
            f_connect4SelfOrClientSync();
            activate(a_cf01Down());
            
            // Initialze the IUT/DUT
            f_initialState();
            
        } // End of function f_cf01Up
        
        function f_cf01Down() runs on ItsGnSecurity {
            
            // Unmap
            unmap(self:acPort, system:acPort);
            unmap(self:utPort, system:utPort);
            unmap(self:gnSecurityPort, system:gnSecurityPort);
            
            // Disconnect
            f_disconnect4SelfOrClientSync();
        } // End of function f_cf01Down
        
    } // End of group configurationFunctions
    
    group preambles {
        
        /**
         * @desc Brings the IUT into an initial state.
         */
        function f_initialState() runs on ItsBaseGnSecurity {
            // TODO
        }
        
    } // End of group preambles
    
    group postambles {
        
    } // End of group postambles
    
    group securityAltsteps {
        
        altstep a_cf01Down() runs on ItsGnSecurity {
            [] a_shutdown() {
                f_cf01Down();
                log("*** a_cf01Down: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
                stop;
            }
        } // End of 'altstep' statement
        
    } // End of group securityAltsteps
    
    group helpersFunctions {
        
        /**
         * @desc    Produces a 256-bit (32-byte) hash value
+16 −0
Original line number Diff line number Diff line
@@ -7,6 +7,13 @@
 */
module LibItsSecurity_Pixits {
    
    // LibCommon
    
    // LibItsSecurity
    import from LibItsSecurity_TypesAndValues {
        type HashedId8
    }
    
    /**
     * 
     */
@@ -17,6 +24,11 @@ module LibItsSecurity_Pixits {
     */
    modulepar octetstring PX_ECDSA_Y_COORDINATE := 'CAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECA'O;
    
    /**
     * 
     */
    modulepar octetstring PX_ECDSA_S := 'CAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECA'O;
    
    /**
     * 
     */
@@ -27,5 +39,9 @@ module LibItsSecurity_Pixits {
     */
    modulepar octetstring PX_AESCCM_Y_COORDINATE := 'CAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECA'O;
    
    /**
     * @desc 
     */
    modulepar HashedId8 PX_ECDSA_DIGEST := '0102030405060708'O;
    
} // End of module LibItsSecurity_Pixits
 No newline at end of file
+196 −49
Original line number Diff line number Diff line
@@ -17,7 +17,9 @@ module LibItsSecurity_Templates {
    import from LibItsSecurity_TypesAndValues all;
    import from LibItsSecurity_Pixits all;
    
    
    /**
     * @desc Constants declaration
     */
    group constants {
        
        /**
@@ -53,11 +55,13 @@ module LibItsSecurity_Templates {
    } // End of group constants
    
    /**
     * @desc Dummy send/receive templates for security headers
     * @see Draft ETSI TS 103 097 V1.1.6 Clause 4   Basic format elements
     */
    group dummyBasicFormatElements {
        
        /**
		 * @desc Dummy send/receive templates for Specification of basic format elements
         * @desc Dummy send templates for security headers
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2    Specification of basic format elements
         */
        group dummyBasicFormatElementsSend {
@@ -73,7 +77,7 @@ module LibItsSecurity_Templates {
                 */
                template (value) EccPoint m_eccPoint_dummy := { 
                    algorithm       := e_ecdsa_nistp256_with_sha256,
                    field_size      := 1 + lengthof(PX_ECDSA_X_COORDINATE), 
                    field_size      := f_int2UInt8(1 + lengthof(PX_ECDSA_X_COORDINATE)), 
                    type_           := e_x_coordinate_only,
                    x               := PX_ECDSA_X_COORDINATE,
                    y               := omit
@@ -86,16 +90,36 @@ module LibItsSecurity_Templates {
                 */
                template (value) EccPoint m_aesccm_dummy := { 
                    algorithm       := e_ecies_nistp256,
                    field_size      := 1 + lengthof(PX_AESCCM_X_COORDINATE), 
                    field_size      := f_int2UInt8(1 + lengthof(PX_AESCCM_X_COORDINATE)), 
                    type_           := e_uncompressed,
                    x               := PX_AESCCM_X_COORDINATE,
                    y               := {
                        y := PX_AESCCM_Y_COORDINATE // WARNING siseof(y) == siseof(x)
                    }
                    } // End of field y
                } // End of template m_aesccm_dummy
                
            } // End of group algorithms
            
            /**
             */
            group signatures {
                
                template (value) Signature m_signature_ecdsa := {
                    algorithm   := e_ecdsa_nistp256_with_sha256,
                    signature_  := {
                        ecdsa_signature := m_ecdsaSignature
                    } // End of field signature_
                } // End of template m_signature_ecdsa
                
                template (value) EcdsaSignature m_ecdsaSignature := {
                    algorithm   := e_ecdsa_nistp256_with_sha256,
                    field_size  := f_int2UInt8(1 + lengthof(PX_ECDSA_S)),
                    r           := m_eccPoint_dummy,
                    s           := PX_ECDSA_S
                } // End of template m_ecdsaSignature
                
            } // End of group signatures
            
            /**
             * @desc Dummy send template for PublicKey/EccPoint
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.4    PublicKey
@@ -107,7 +131,6 @@ module LibItsSecurity_Templates {
                } // End of field public_key
            } // End of template PublicKey
            
            
            /**
             * @desc Dummy send template for PublicKey/AES CCM
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.4    PublicKey
@@ -122,22 +145,55 @@ module LibItsSecurity_Templates {
                } // End of field public_key
            } // End of template m_publicKey_aesccm_dummy
            
        } // End of group dummyBasicFormatElementsSend 
        
        /**
         * @desc Dummy receive templates for security headers
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2    Specification of basic format elements
         */
        group dummyBasicFormatElementsRecv {
            
        } // End of group dummyBasicFormatElementsSend 
            /**
             * @desc Dummy receive template for PublicKey/EccPoint
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.4    PublicKey
             */
            template (present) PublicKey mw_publicKey_eccPoint_dummy := {
                algorithm   := e_ecdsa_nistp256_with_sha256,
                public_key  := {
                    eccPoint := ?
                } // End of field public_key
            } // End of template PublicKey
            
            /**
             * @desc Dummy send template for PublicKey/AES CCM
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.4    PublicKey
             */
            template (present) PublicKey mw_publicKey_aesccm_dummy := {
                algorithm   := e_ecies_nistp256,
                public_key  := {
                    aesCcm := ?
                } // End of field public_key
            } // End of template m_publicKey_aesccm_dummy
            
        } // End of group dummyBasicFormatElementsRecv
        
    } // End of group dummyBasicFormatElements 
    
    /**
     * @desc Dummy send/receive templates for security headers
     * @see Draft ETSI TS 103 097 V1.1.6 Clause 5   Specification of security header
     */
    group dummyMessages {
        
        /**
         * @desc Dummy send templates for security headers
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 5   Specification of security header
         */
        group dummyMessagesSend {
            
            /**
             * @desc Generic send template for SecuredMessage
             * @desc Generic send template for Security profile for CAMs
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 7.1  Security profile for CAMs
             */
            template (value) SecuredMessage m_secureMessageCAMs_dummy := {
                protocol_version     := c_protocol_version,
@@ -156,9 +212,34 @@ module LibItsSecurity_Templates {
                other_header := ''O
            } // End of template m_header_field_container_dummy
            
            template (value) Payload m_payload_signed_dummy := {
                type_   := e_signed,
                data    := m_data_payload_dummy
            } // End of template m_payload_dummy
            
            template (value) Payload m_payload_unsecured_dummy := {
                type_   := e_unsecured,
                data    := m_data_payload_dummy
            } // End of template m_payload_dummy
            
            template (value) PayloadContainer m_data_payload_dummy := {
                rawPayload := ''O
            } // End of template m_data_payload_dummy
            
            template (value) TrailerField m_trailer_field_dummy := {
                type_           := e_signature,
                trailerField    := m_trailer_field_container_dummy
            } // End of template m_trailer_field_dummy
            
            template (value) TrailerFieldContainer m_trailer_field_container_dummy := {
                security_field := ''O
            } // End of template m_trailer_field_container_dummy
            
        } // End of group dummyMessagesSend
        
        /**
         * @desc Dummy receive templates for security headers
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 5   Specification of security header
         */
        group dummyMessagesRecv {
            
@@ -178,7 +259,7 @@ module LibItsSecurity_Templates {
             */
            template (present) Payload mw_signedPayload_dummy := {
                type_   := e_signed, 
                payload  := ?
                data    := ?
            } // End of template mw_signedPayload_dummy
            
            /**
@@ -186,7 +267,7 @@ module LibItsSecurity_Templates {
             */
            template (present) Payload mw_unsecuredPayload_dummy := {
                type_   := e_unsecured, 
                payload  := ?
                data    := ?
            } // End of template mw_unsecuredPayload_dummy
            
        } // End of group dummyMessagesRecv 
@@ -194,10 +275,14 @@ module LibItsSecurity_Templates {
    } // End of group dummyMessages
    
    /**
     * @desc Dummy send/receive templates for certificates
     * @see Draft ETSI TS 103 097 V1.1.6 Clause 6   Specification of certificate format
     */
    group dummyCertifices {
        
        /**
         * @desc Dummy send templates for certificates
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6   Specification of certificate format
         */
        group dummyCertificesSend {
            
@@ -205,19 +290,45 @@ module LibItsSecurity_Templates {
             * @desc Dummy send certificate template
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 6.1    Certificate
             */
            /*template (value) Certificate m_certificate_dummy := {
            template (value) Certificate m_certificate_dummy := {
                version                 := c_certificate_version,
                signer_info             := ,
                subject_info            := ,
                subject_attributes      := ,
                validity_restrictions   := ,
                signature_              := 
            }*/ // End of template m_certificate_dummy
                signer_info             := { 
                    m_signerInfo_ecdsa256(
                        m_signerInfoContainer_digest(
                            PX_ECDSA_DIGEST
                        )
                    )
                },
                subject_info            := m_subject_info_dummy,
                subject_attributes      := { m_subject_attribute_dummy },
                validity_restrictions   := { m_validity_restriction_dummy },
                signature_              := m_signature_ecdsa
            } // End of template m_certificate_dummy
            
            template (value) SubjectInfo m_subject_info_dummy := {
                subject_type := e_root_ca,
                subject_name := ''O
            } // End of template SubjectInfo
            
            template (value) SubjectAttribute m_subject_attribute_dummy := {
                type_       := e_verification_key,
                attribute   := {
                    key := m_publicKey_eccPoint_dummy
                }
            } // End of template m_subject_attribute_dummy
            
        } // End of group dummyCertificesSend
            template (value) ValidityRestriction m_validity_restriction_dummy := {
                type_       := e_time_end,
                validity    :=  {
                    end_validity := 0
                }
            } // End of template m_validity_dummy
            
        } // End of group dummyCertificesSend
        
        /**
         * @desc Dummy receive templates for certificates
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6   Specification of certificate format
         */
        group dummyCertificesRecv {
            
@@ -251,14 +362,13 @@ module LibItsSecurity_Templates {
            group securityProfilesCAMsSend {
                
                /**
                 * @desc Generic send template for SecuredMessage
                 * @desc Generic send template for Security profile for CAMs
                 */
                template (value) SecuredMessage md_secureMessageCAMs(
                                                                     in template (value) HeaderFields p_header_fields,
                                                                     in template (value) Payloads p_payload_fields,
                                                                     in template (value) TrailerFields p_trailer_fields
                ) modifies m_secureMessageCAMs_dummy := {
                    protocol_version    := c_protocol_version,
                    security_profile    := c_security_profileCAMs,
                    header_fields       := p_header_fields,
                    payload_fields      := p_payload_fields,
@@ -296,10 +406,36 @@ module LibItsSecurity_Templates {
                    certificates := p_certificates
                } // End of template m_signerInfoContainer_certificates
                
                template (value) SignerInfoContainer m_signerInfoContainer_digest(
                                                                                  in template (value) HashedId8 p_digest
                ) := {
                    digest := p_digest
                } // End of template m_signerInfoContainer_digest
                
            } // End of group securityProfilesCAMsSend
            
            group securityProfilesCAMsRecv {
                
            } // End of group securityProfilesCAMsSend
                /**
                 * @desc Generic received template for Security profile for CAMs
                 */
                template (present) SecuredMessage mdw_secureMessageCAMs_dummy
                modifies mw_securedMessage_dummy := {
                    security_profile    := c_security_profileCAMs
                } // End of template mw_securedMessage_dummy
                
                /**
                 * @desc Generic received template for Security profile for CAMs
                 */
                template (present) SecuredMessage mdw_secureMessageCAMs
                modifies mdw_secureMessageCAMs_dummy := { // TODO To be continued
                    security_profile    := ?,
                    header_fields       := ?,
                    payload_fields      := ?,
                    trailer_fields      := ?
                } // End of template mw_securedMessage_dummy
                
            } // End of group mdw_secureMessageCAMs_dummy
            
        } // End of group securityProfilesCAMs
        
@@ -317,4 +453,15 @@ module LibItsSecurity_Templates {
        
    } // End of group utPrimitives
    
    /**
     * @desc Function helpers for static_cast<> operation (to reduce warning in TTWB)
     */
    group typeConverters {
        
        function f_int2UInt8(in integer p_value) return UInt8 {
            return p_value;
        }
        
    }
    
} // End of module LibItsSecurity_Templates
 No newline at end of file
+126 −0
Original line number Diff line number Diff line
@@ -6,4 +6,130 @@
 *
 */
module LibItsSecurity_TestSystem {
    
    // LibCommon
    import from LibCommon_Sync {
        type ServerSyncComp
    };
    
    // LibItsCommon
    import from LibItsCommon_TestSystem all;
    import from LibItsCommon_TypesAndValues all;
    
    // LibItsSecurity
    import from LibItsSecurity_TypesAndValues all;
    
    group portDefinitions {
        
        /**
         * @desc Adapter control port
         */
        type port AdapterControlPort message {
            out
                AcGnSecurityPrimitive;
            in
                AcGnSecurityResponse;
        } // End of AdapterControlPort
        
        /**
         * @desc Upper Tester port
         */
        type port UpperTesterPort message {
            out
                UtInitialize;
            in
                UtInitializeResult;
        } // End of UpperTesterPort
        
    } // End of portDefinitions
    
    group interfacePorts {
        
        group networkAndTransportPorts {
            
            group nt2Ports {
                
                /**
                 * @desc NT2 GeoNetworking Secutity Port (GnSec/G5)
                 */
                type port GnSecurityPort message {
                    in GnSecurityInd;
                    out GnSecurityReq;
                } // End of GnSecurityPort
                
            } // End of group nt2Ports
            
        } // End of group networkAndTransportPorts
    
    } // End of group interfacePorts
    
    group componentDefinitions {
        
        /**
         * @desc ITS Main Test Component
         */
        type component ItsMtc extends ItsBaseMtc, ServerSyncComp {
            
            port UpperTesterPort utPort;
            port AdapterControlPort acPort;
            
        } // End of type ItsMtc
        
        /**
         * @desc ITS System Adapter
         */
        type component ItsGnSecuritySystem {
            
            port UpperTesterPort utPort;
            port AdapterControlPort acPort;
            
            // NT2 ports
            port GnSecurityPort gnSecurityPort;
            
        } // End of type ItsGnSecuritySystem
        
    } // End of group componentDefinitions
    
    type component ItsBaseGnSecurity extends ItsBaseComponent {
        
        port UpperTesterPort utPort;
        port AdapterControlPort acPort;
        
    }
    
    /**
     * @desc Test component for ITS Network and Transport layer
     */
    type component ItsGnSecurity extends ItsBaseGnSecurity {
        
        // NT2 ports
        port GnSecurityPort gnSecurityPort;
        
        // Variables for GnSecurity
        
    } // End of component ItsGeoNetworking
    
    group networkAndTransportPrimitives {
        
        group nt2Primitives {
            
            /**
             * @desc NT2 GeoNetworking Indication Primitive
             */
            type record GnSecurityInd {
            } // End of type GnSecurityInd
            
            /**
             * @desc NT2 GeoNetworking Request Primitive
             */
            type record GnSecurityReq {
            } // End of type GnSecurityReq
            
        } // End of nt2Primitives
        
    } // End of group networkAndTransportPrimitives
    with {
        encode "LibIts_Interface"
    } // End of interfacePrimitives
    
} // End of module LibItsSecurity_TestSystem
 No newline at end of file
+25 −8
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ module LibItsSecurity_TypesAndValues {
    import from LibCommon_DataStrings {
        type 
            Bit2, Bit3, 
            Oct2, Oct3, Oct8, Oct12, Oct0to20, Oct1to31, Oct1to255 
            Oct2, Oct0to3, Oct0to8, Oct0to12, Oct0to20, Oct0to31, Oct0to255 
    }
    
    // LibIts
@@ -148,7 +148,7 @@ module LibItsSecurity_TypesAndValues {
         * @member params   Out of scope
         */
        type union EncryptionParametersContainer {
            Oct12       nonce,
            Oct0to12    nonce,
            octetstring params
        } // End of type EncryptionParametersContainer
        
@@ -244,14 +244,14 @@ module LibItsSecurity_TypesAndValues {
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.14  HashedId3
         * @see RFC2246 Clause 4.2. Miscellaneous
         */
        type Oct3 HashedId3;
        type Oct0to3 HashedId3;
        
        /**
         * @desc Identifies data such as a certificate
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.13  HashedId8
         * @see RFC2246 Clause 4.2. Miscellaneous
         */
        type Oct8 HashedId8;
        type Oct0to8 HashedId8;
        
        /**
         * @desc The unsigned 32 bits number of International Atomic Time (TAI) microseconds since 00:00:00 UTC, 01 January 2004
@@ -321,7 +321,7 @@ module LibItsSecurity_TypesAndValues {
        type record ThreeDLocation {
            Int32   latitude,
            Int32   longitude,
            Oct2    elevation
            Oct2    elevation // Due to physical meaning, it cannot be Oct0to2
        } // End of type ThreeDLocation
        
        /**
@@ -475,7 +475,7 @@ module LibItsSecurity_TypesAndValues {
         */
        type record Payload {
            PayloadType         type_,
            PayloadContainer    payload
            PayloadContainer    data
        } // End of type Payload
        
        /**
@@ -608,7 +608,7 @@ module LibItsSecurity_TypesAndValues {
         */
        type record SubjectInfo {
            SubjectType subject_type,
            Oct1to255   subject_name // TODO Oct0to255 or Oct1to255
            Oct0to255   subject_name
        } // End of type SubjectInfo
        
        /**
@@ -754,11 +754,28 @@ module LibItsSecurity_TypesAndValues {
         */
        type record ItsAidSsp {
            IntX        its_aid,
            Oct1to31    service_specific_permissions // TODO Oct0to31 or Oct1to31
            Oct0to31    service_specific_permissions
        } // End of type ItsAidSsp
        
    } // End of group certificateSpecification
    
    group acPrimitives {
        
        type union AcGnSecurityPrimitive {
        } // End of type AcGnSecurityPrimitive
        
        type union AcGnSecurityResponse {
        } // End of type AcGnSecurityResponse
        
    } // End of group acPrimitives
    
    group utPrimitives {
        
    }
    with {
        encode "UpperTester"
    } // End of group utPrimitives
    
} with {
    encode "LibItsSecurity"
} // End of module LibItsSecurity_TypesAndValues