Loading ttcn/Security/LibItsSecurity_Functions.ttcn3 +220 −88 Original line number Diff line number Diff line Loading @@ -734,31 +734,12 @@ module LibItsSecurity_Functions { }// End of group certificateGetters group CertRequests{ function f_askForCertificate (in template (value) HashedId8 p_digest) { // Send CAM message with insert the request_unrecognized_certificate // header containing specified digest /* TODO: Waiting Alex to understand how to send message var SecuredMessage v_msg; if ( f_buildGnSecuredCam (v_msg, in octetstring p_unsecuredPayload, in ThreeDLocation p_threeDLocation, in template (omit) HeaderFields p_headerFileds := omit )) { } */ } } // End of group CertRequests } // End of group helpersFunctions group externalFunctions { group signing { /** * @desc Produces a 256-bit (32-byte) hash value * @param p_toBeHashedData Data to be used to calculate the hash value Loading Loading @@ -794,6 +775,69 @@ module LibItsSecurity_Functions { */ external function fx_generateKeyPair(out octetstring/*UInt64*/ p_privateKey, out octetstring p_publicKeyX, out octetstring p_publicKeyY) return boolean; } // End of group signing group encryption { } // End of group encryption group geodesic { /** * @desc Check that given polygon doesn't have neither self-intersections nor holes. * @param p_region Polygonal Region * @return true on success, false otherwise * @verdict Unchanged */ external function fx_isValidPolygonalRegion(in template (value) PolygonalRegion p_region) return boolean; /** * @desc Check if a polygonal regin is inside another one * @param p_parent The main polygonal region * @param p_region The polygonal region to be included * @return true on success, false otherwise * @verdict Unchanged */ external function fx_isPolygonalRegionInside(in template (value) PolygonalRegion p_parent, in template (value) PolygonalRegion p_region) return boolean; /** * @desc Check that the location is inside a circular region * @param p_region The circular region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ external function fx_isLocationInsideCircularRegion(in template (value) CircularRegion p_region, in template (value) ThreeDLocation p_location) return boolean; /** * @desc Check that the location is inside a rectangular region * @param p_region The rectangular region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ external function fx_isLocationInsideRectangularRegion(in template (value) RectangularRegions p_region, in template (value) ThreeDLocation p_location) return boolean; /** * @desc Check that the location is inside a polygonal region * @param p_region The polygonal region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ external function fx_isLocationInsidePolygonalRegion(in template (value) PolygonalRegion p_region, in template (value) ThreeDLocation p_location) return boolean; /** * @desc Check if the location is inside an identified region * @param p_region The identified region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ external function fx_isLocationInsideIdentifiedRegion(in template (value) IdentifiedRegion p_region, in template (value) ThreeDLocation p_location) return boolean; } // End of group geodesic } // End of group externalFunctions group geometryFunctions { Loading @@ -803,11 +847,13 @@ module LibItsSecurity_Functions { * @param p_location location to be checked * @return true on success, false otherwise */ function f_isValidTwoDLocation(in template (value) TwoDLocation p_location function f_isValidTwoDLocation( in template (value) TwoDLocation p_location ) return boolean { return valueof(p_location).longitude != c_maxLongitude+1 and valueof(p_location).latitude != c_maxLatitude+1; } return (valueof(p_location).longitude != c_maxLongitude + 1) and (valueof(p_location).latitude != c_maxLatitude + 1); } // End of function f_isValidTwoDLocation /** * @desc Check that two given rectanlular regions are intersected Loading @@ -825,51 +871,81 @@ module LibItsSecurity_Functions { or valueof(p_r2).southeast.longitude < valueof(p_r1).northwest.longitude or valueof(p_r2).southeast.latitude > valueof(p_r1).northwest.latitude or valueof(p_r2).northwest.latitude < valueof(p_r1).southeast.latitude); } } // End of function f_isRectangularRegionsIntersected function f_isContinuousRectangularRegions(in template (value) RectangularRegions regions ) return boolean { // TODO: call external function return true; } } // End of function f_isRectangularRegionsIntersected /** * @desc Check if a polygonal regin is inside another one * @param p_parent The main polygonal region * @param p_region The polygonal region to be included * @return true on success, false otherwise * @verdict Unchanged */ function f_isRectangularRegionsInside(in template (value) RectangularRegions p_parent, in template (value) RectangularRegions p_region ) return boolean { // TODO: convert rectangular regions to polygons and check polygons return true; } } // End of function f_isRectangularRegionsInside /** * @desc Check that given polygon doesn't have neither self-intersections no holes. * @desc Check that given polygon doesn't have neither self-intersections nor holes. * @param p_region Polygonal Region * @return true on success, false otherwise * @verdict Unchanged */ function f_isValidPolygonalRegion(in template (value) PolygonalRegion p_region function f_isValidPolygonalRegion( in template (value) PolygonalRegion p_region ) return boolean { // TODO: call external function return true; // Sanity check if (not isbound(p_region) or (lengthof(p_region) == 0)) { return false; } return fx_isValidPolygonalRegion(p_region); } // End of function f_isValidPolygonalRegion /** * @desc Check if a polygonal regin is inside another one * @param p_parent The main polygonal region * @param p_region The polygonal region to be included * @return true on success, false otherwise * @verdict Unchanged */ function f_isPolygonalRegionInside(in template (value) PolygonalRegion p_parent, in template (value) PolygonalRegion p_region ) return boolean { // TODO: call external function return true; } } // End of function f_isPolygonalRegionInside /** * @desc */ function f_isIdentifiedRegionInside(in template (value) UInt16 p_parent, in template (value) UInt16 p_region ) return boolean { // TODO: call external function return valueof(p_parent) == valueof(p_region); } } // End of function f_isIdentifiedRegionInside /** * @desc Check that the location is inside a region * @param p_region The region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ function f_isLocationInsideRegion(in template (value) GeographicRegion p_region, in template (value) ThreeDLocation p_location ) return boolean { var boolean v_ret := false; select (p_region.region_type) { case (e_none) { v_ret := true; Loading @@ -890,40 +966,96 @@ module LibItsSecurity_Functions { v_ret := f_isLocationInsideOtherRegion(p_region.region.other_region, p_location); } } return v_ret; } } // End of function f_isLocationInsideRegion /** * @desc Check that the location is inside a circular region * @param p_region The circular region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ function f_isLocationInsideCircularRegion(in template (value) CircularRegion p_region, in template (value) ThreeDLocation p_location ) return boolean { // TODO: distance between center and location must be less then radius // Do not forget aboout passing throw 0 meridian return true; // Sanity check if (not isbound(p_region) or not isbound(p_location)) { return false; } return fx_isLocationInsideCircularRegion(p_region, p_location); } // End of function f_isLocationInsideCircularRegion /** * @desc Check that the location is inside a rectangular region * @param p_region The rectangular region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ function f_isLocationInsideRectangularRegion(in template (value) RectangularRegions p_region, in template (value) ThreeDLocation p_location ) return boolean { // TODO: implement it // Do not forget aboout passing throw 0 meridian return true; // Sanity check if (not isbound(p_region) or not isbound(p_location) or (lengthof(p_region) == 0)) { return false; } return fx_isLocationInsideRectangularRegion(p_region, p_location); } // End of function f_isLocationInsideRectangularRegion /** * @desc Check that the location is inside a polygonal region * @param p_region The polygonal region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ function f_isLocationInsidePolygonalRegion(in template (value) PolygonalRegion p_region, in template (value) ThreeDLocation p_location ) return boolean { // TODO: implement it // Do not forget aboout passing throw 0 meridian return true; // Sanity check if (not isbound(p_region) or not isbound(p_location) or (lengthof(p_region) == 0)) { return false; } return fx_isLocationInsidePolygonalRegion(p_region, p_location); } // End of function f_isLocationInsidePolygonalRegion /** * @desc Check if the location is inside an identified region * @param p_region The identified region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ function f_isLocationInsideIdentifiedRegion(in template (value) IdentifiedRegion p_region, in template (value) ThreeDLocation p_location ) return boolean { // TODO: implement it return true; // Sanity check if (not isbound(p_region) or not isbound(p_location)) { return false; } return fx_isLocationInsideIdentifiedRegion(p_region, p_location); } // End of function f_isLocationInsideIdentifiedRegion /** * @desc Check if the location is inside an undefined region * @param p_region The identified region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ function f_isLocationInsideOtherRegion(in template (value) octetstring p_region, in template (value) ThreeDLocation p_location ) return boolean { // FIXME To be removed return false; } } // End of function f_isLocationInsideOtherRegion } // End of group geometryFunctions } // End of module LibItsSecurity_Functions Loading
ttcn/Security/LibItsSecurity_Functions.ttcn3 +220 −88 Original line number Diff line number Diff line Loading @@ -734,31 +734,12 @@ module LibItsSecurity_Functions { }// End of group certificateGetters group CertRequests{ function f_askForCertificate (in template (value) HashedId8 p_digest) { // Send CAM message with insert the request_unrecognized_certificate // header containing specified digest /* TODO: Waiting Alex to understand how to send message var SecuredMessage v_msg; if ( f_buildGnSecuredCam (v_msg, in octetstring p_unsecuredPayload, in ThreeDLocation p_threeDLocation, in template (omit) HeaderFields p_headerFileds := omit )) { } */ } } // End of group CertRequests } // End of group helpersFunctions group externalFunctions { group signing { /** * @desc Produces a 256-bit (32-byte) hash value * @param p_toBeHashedData Data to be used to calculate the hash value Loading Loading @@ -794,6 +775,69 @@ module LibItsSecurity_Functions { */ external function fx_generateKeyPair(out octetstring/*UInt64*/ p_privateKey, out octetstring p_publicKeyX, out octetstring p_publicKeyY) return boolean; } // End of group signing group encryption { } // End of group encryption group geodesic { /** * @desc Check that given polygon doesn't have neither self-intersections nor holes. * @param p_region Polygonal Region * @return true on success, false otherwise * @verdict Unchanged */ external function fx_isValidPolygonalRegion(in template (value) PolygonalRegion p_region) return boolean; /** * @desc Check if a polygonal regin is inside another one * @param p_parent The main polygonal region * @param p_region The polygonal region to be included * @return true on success, false otherwise * @verdict Unchanged */ external function fx_isPolygonalRegionInside(in template (value) PolygonalRegion p_parent, in template (value) PolygonalRegion p_region) return boolean; /** * @desc Check that the location is inside a circular region * @param p_region The circular region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ external function fx_isLocationInsideCircularRegion(in template (value) CircularRegion p_region, in template (value) ThreeDLocation p_location) return boolean; /** * @desc Check that the location is inside a rectangular region * @param p_region The rectangular region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ external function fx_isLocationInsideRectangularRegion(in template (value) RectangularRegions p_region, in template (value) ThreeDLocation p_location) return boolean; /** * @desc Check that the location is inside a polygonal region * @param p_region The polygonal region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ external function fx_isLocationInsidePolygonalRegion(in template (value) PolygonalRegion p_region, in template (value) ThreeDLocation p_location) return boolean; /** * @desc Check if the location is inside an identified region * @param p_region The identified region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ external function fx_isLocationInsideIdentifiedRegion(in template (value) IdentifiedRegion p_region, in template (value) ThreeDLocation p_location) return boolean; } // End of group geodesic } // End of group externalFunctions group geometryFunctions { Loading @@ -803,11 +847,13 @@ module LibItsSecurity_Functions { * @param p_location location to be checked * @return true on success, false otherwise */ function f_isValidTwoDLocation(in template (value) TwoDLocation p_location function f_isValidTwoDLocation( in template (value) TwoDLocation p_location ) return boolean { return valueof(p_location).longitude != c_maxLongitude+1 and valueof(p_location).latitude != c_maxLatitude+1; } return (valueof(p_location).longitude != c_maxLongitude + 1) and (valueof(p_location).latitude != c_maxLatitude + 1); } // End of function f_isValidTwoDLocation /** * @desc Check that two given rectanlular regions are intersected Loading @@ -825,51 +871,81 @@ module LibItsSecurity_Functions { or valueof(p_r2).southeast.longitude < valueof(p_r1).northwest.longitude or valueof(p_r2).southeast.latitude > valueof(p_r1).northwest.latitude or valueof(p_r2).northwest.latitude < valueof(p_r1).southeast.latitude); } } // End of function f_isRectangularRegionsIntersected function f_isContinuousRectangularRegions(in template (value) RectangularRegions regions ) return boolean { // TODO: call external function return true; } } // End of function f_isRectangularRegionsIntersected /** * @desc Check if a polygonal regin is inside another one * @param p_parent The main polygonal region * @param p_region The polygonal region to be included * @return true on success, false otherwise * @verdict Unchanged */ function f_isRectangularRegionsInside(in template (value) RectangularRegions p_parent, in template (value) RectangularRegions p_region ) return boolean { // TODO: convert rectangular regions to polygons and check polygons return true; } } // End of function f_isRectangularRegionsInside /** * @desc Check that given polygon doesn't have neither self-intersections no holes. * @desc Check that given polygon doesn't have neither self-intersections nor holes. * @param p_region Polygonal Region * @return true on success, false otherwise * @verdict Unchanged */ function f_isValidPolygonalRegion(in template (value) PolygonalRegion p_region function f_isValidPolygonalRegion( in template (value) PolygonalRegion p_region ) return boolean { // TODO: call external function return true; // Sanity check if (not isbound(p_region) or (lengthof(p_region) == 0)) { return false; } return fx_isValidPolygonalRegion(p_region); } // End of function f_isValidPolygonalRegion /** * @desc Check if a polygonal regin is inside another one * @param p_parent The main polygonal region * @param p_region The polygonal region to be included * @return true on success, false otherwise * @verdict Unchanged */ function f_isPolygonalRegionInside(in template (value) PolygonalRegion p_parent, in template (value) PolygonalRegion p_region ) return boolean { // TODO: call external function return true; } } // End of function f_isPolygonalRegionInside /** * @desc */ function f_isIdentifiedRegionInside(in template (value) UInt16 p_parent, in template (value) UInt16 p_region ) return boolean { // TODO: call external function return valueof(p_parent) == valueof(p_region); } } // End of function f_isIdentifiedRegionInside /** * @desc Check that the location is inside a region * @param p_region The region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ function f_isLocationInsideRegion(in template (value) GeographicRegion p_region, in template (value) ThreeDLocation p_location ) return boolean { var boolean v_ret := false; select (p_region.region_type) { case (e_none) { v_ret := true; Loading @@ -890,40 +966,96 @@ module LibItsSecurity_Functions { v_ret := f_isLocationInsideOtherRegion(p_region.region.other_region, p_location); } } return v_ret; } } // End of function f_isLocationInsideRegion /** * @desc Check that the location is inside a circular region * @param p_region The circular region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ function f_isLocationInsideCircularRegion(in template (value) CircularRegion p_region, in template (value) ThreeDLocation p_location ) return boolean { // TODO: distance between center and location must be less then radius // Do not forget aboout passing throw 0 meridian return true; // Sanity check if (not isbound(p_region) or not isbound(p_location)) { return false; } return fx_isLocationInsideCircularRegion(p_region, p_location); } // End of function f_isLocationInsideCircularRegion /** * @desc Check that the location is inside a rectangular region * @param p_region The rectangular region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ function f_isLocationInsideRectangularRegion(in template (value) RectangularRegions p_region, in template (value) ThreeDLocation p_location ) return boolean { // TODO: implement it // Do not forget aboout passing throw 0 meridian return true; // Sanity check if (not isbound(p_region) or not isbound(p_location) or (lengthof(p_region) == 0)) { return false; } return fx_isLocationInsideRectangularRegion(p_region, p_location); } // End of function f_isLocationInsideRectangularRegion /** * @desc Check that the location is inside a polygonal region * @param p_region The polygonal region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ function f_isLocationInsidePolygonalRegion(in template (value) PolygonalRegion p_region, in template (value) ThreeDLocation p_location ) return boolean { // TODO: implement it // Do not forget aboout passing throw 0 meridian return true; // Sanity check if (not isbound(p_region) or not isbound(p_location) or (lengthof(p_region) == 0)) { return false; } return fx_isLocationInsidePolygonalRegion(p_region, p_location); } // End of function f_isLocationInsidePolygonalRegion /** * @desc Check if the location is inside an identified region * @param p_region The identified region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ function f_isLocationInsideIdentifiedRegion(in template (value) IdentifiedRegion p_region, in template (value) ThreeDLocation p_location ) return boolean { // TODO: implement it return true; // Sanity check if (not isbound(p_region) or not isbound(p_location)) { return false; } return fx_isLocationInsideIdentifiedRegion(p_region, p_location); } // End of function f_isLocationInsideIdentifiedRegion /** * @desc Check if the location is inside an undefined region * @param p_region The identified region to consider * @param p_location The device location * @return true on success, false otherwise * @verdict Unchanged */ function f_isLocationInsideOtherRegion(in template (value) octetstring p_region, in template (value) ThreeDLocation p_location ) return boolean { // FIXME To be removed return false; } } // End of function f_isLocationInsideOtherRegion } // End of group geometryFunctions } // End of module LibItsSecurity_Functions