Commit b12aa230 authored by garciay's avatar garciay
Browse files

Re-organise function for signature check

parent d6bdf59d
Loading
Loading
Loading
Loading
+17 −4
Original line number Original line Diff line number Diff line
@@ -24,6 +24,9 @@ module LibItsGeoNetworking_Functions {
    import from LibItsSecurity_TypesAndValues all;
    import from LibItsSecurity_TypesAndValues all;
    import from LibItsSecurity_Templates all;
    import from LibItsSecurity_Templates all;
    import from LibItsSecurity_Functions all;
    import from LibItsSecurity_Functions all;
    import from LibItsSecurity_Pixits {
        modulepar PX_CERTIFICATE_CONFIG_IDX, PX_TA_CONFIGS
    };
    
    
    // LibItsGeoNetworking
    // LibItsGeoNetworking
    import from LibItsGeoNetworking_TestSystem all;
    import from LibItsGeoNetworking_TestSystem all;
@@ -1663,12 +1666,22 @@ module LibItsGeoNetworking_Functions {
         * @return  FncRetCode
         * @return  FncRetCode
         */
         */
        function f_acEnableSecurity() runs on ItsGeoNetworking return FncRetCode {
        function f_acEnableSecurity() runs on ItsGeoNetworking return FncRetCode {
            var template (value) ToBeSignedSecuredMessage v_ToBeSignedSecuredMessage;
            var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
            
            
            // Build the beacon template
            // Build the beacon template
            v_ToBeSignedSecuredMessage := f_buildSecuredMessagePayloadToBeSigned();
            v_toBeSignedSecuredMessage := f_buildSecuredMessagePayloadToBeSigned();
            
            
            return f_acTriggerEvent(AcGnPrimitive:{ acEnableSecurity := m_enableSecurity(bit2oct(encvalue(v_ToBeSignedSecuredMessage))) } );
            return f_acTriggerEvent(
                AcGnPrimitive:{ acEnableSecurity := m_enableSecurity(
                    PX_TA_CONFIGS[PX_CERTIFICATE_CONFIG_IDX].signingPrivateKey,
                    PX_TA_CONFIGS[PX_CERTIFICATE_CONFIG_IDX].atCertificate.subject_attributes[0].attribute.key.public_key.eccPoint.x,
                    PX_TA_CONFIGS[PX_CERTIFICATE_CONFIG_IDX].atCertificate.subject_attributes[0].attribute.key.public_key.eccPoint.y.y,
                    PX_TA_CONFIGS[PX_CERTIFICATE_CONFIG_IDX].encryptPrivateKey,
                    PX_TA_CONFIGS[PX_CERTIFICATE_CONFIG_IDX].atCertificate.subject_attributes[1].attribute.key.public_key.aesCcm.eccPoint.x,
                    PX_TA_CONFIGS[PX_CERTIFICATE_CONFIG_IDX].atCertificate.subject_attributes[1].attribute.key.public_key.aesCcm.eccPoint.y.y,
                    bit2oct(encvalue(v_toBeSignedSecuredMessage
                ))) } 
            );
        }
        }
        
        
        /**
        /**