Commit c60111cf authored by YannGarcia's avatar YannGarcia
Browse files

Validation of IVIM ATS againt CNIT

parent c5c42ae7
...@@ -1275,6 +1275,9 @@ module LibItsGeoNetworking_Functions { ...@@ -1275,6 +1275,9 @@ module LibItsGeoNetworking_Functions {
var UtGnEventInd v_ind; var UtGnEventInd v_ind;
[vc_utDefaultActive] utPort.receive(UtGnEventInd:?) -> value v_ind { [vc_utDefaultActive] utPort.receive(UtGnEventInd:?) -> value v_ind {
//store every upper tester indication received //store every upper tester indication received
log("################# v_ind: ", v_ind);
log("################# vc_utInds: ", vc_utInds);
log("################# lengthof(vc_utInds): ", lengthof(vc_utInds));
vc_utInds[lengthof(vc_utInds)] := v_ind; vc_utInds[lengthof(vc_utInds)] := v_ind;
repeat; repeat;
} }
......
...@@ -47,7 +47,7 @@ module LibItsIvim_Templates { ...@@ -47,7 +47,7 @@ module LibItsIvim_Templates {
*/ */
template (value) IvimReq m_ivimReq( template (value) IvimReq m_ivimReq(
in template (value) IVIM p_iviMsg in template (value) IVIM p_iviMsg
) := { ) := {
msgOut := p_iviMsg msgOut := p_iviMsg
} // End of template m_ivimReq } // End of template m_ivimReq
...@@ -57,7 +57,7 @@ module LibItsIvim_Templates { ...@@ -57,7 +57,7 @@ module LibItsIvim_Templates {
*/ */
template (present) IvimInd mw_ivimInd( template (present) IvimInd mw_ivimInd(
template (present) IVIM p_iviMsg := ? template (present) IVIM p_iviMsg := ?
) := { ) := {
msgIn := p_iviMsg, msgIn := p_iviMsg,
recvTime := ?, recvTime := ?,
gnNextHeader := *, gnNextHeader := *,
...@@ -83,12 +83,12 @@ module LibItsIvim_Templates { ...@@ -83,12 +83,12 @@ module LibItsIvim_Templates {
*/ */
template IvimInd mw_ivimIndWithGnParameters( template IvimInd mw_ivimIndWithGnParameters(
template (present) IVIM p_iviMsg := ?, template (present) IVIM p_iviMsg := ?,
in template UInt8 p_gnNextHeader := *, template UInt8 p_gnNextHeader := *,
in template UInt8 p_gnHeaderType := *, template UInt8 p_gnHeaderType := *,
in template UInt8 p_gnHeaderSubtype := *, template UInt8 p_gnHeaderSubtype := *,
in template UInt32 p_gnLifetime := *, template UInt32 p_gnLifetime := *,
in template UInt8 p_gnTrafficClass := * template UInt8 p_gnTrafficClass := *
) modifies mw_ivimInd := { ) modifies mw_ivimInd := {
gnNextHeader := p_gnNextHeader, gnNextHeader := p_gnNextHeader,
gnHeaderType := p_gnHeaderType, gnHeaderType := p_gnHeaderType,
gnHeaderSubtype := p_gnHeaderSubtype, gnHeaderSubtype := p_gnHeaderSubtype,
...@@ -104,9 +104,9 @@ module LibItsIvim_Templates { ...@@ -104,9 +104,9 @@ module LibItsIvim_Templates {
*/ */
template IvimInd mw_ivimIndWithBtpParameters( template IvimInd mw_ivimIndWithBtpParameters(
template (present) IVIM p_iviMsg := ?, template (present) IVIM p_iviMsg := ?,
template UInt16 p_btpDestinationPort := *, template UInt16 p_btpDestinationPort := *,
template UInt16 p_btpInfo := * template UInt16 p_btpInfo := *
) modifies mw_ivimInd := { ) modifies mw_ivimInd := {
btpDestinationPort := p_btpDestinationPort, btpDestinationPort := p_btpDestinationPort,
btpInfo := p_btpInfo btpInfo := p_btpInfo
} // End of template mw_ivimIndWithBtpParameters } // End of template mw_ivimIndWithBtpParameters
...@@ -119,9 +119,9 @@ module LibItsIvim_Templates { ...@@ -119,9 +119,9 @@ module LibItsIvim_Templates {
*/ */
template IvimInd mw_ivimIndWithSecurityParameters( template IvimInd mw_ivimIndWithSecurityParameters(
template (present) IVIM p_iviMsg := ?, template (present) IVIM p_iviMsg := ?,
template Bit256 p_ssp := *, template Bit256 p_ssp := *,
template UInt32 p_its_aid := * template UInt32 p_its_aid := *
) modifies mw_ivimInd := { ) modifies mw_ivimInd := {
ssp := p_ssp, ssp := p_ssp,
its_aid := p_its_aid its_aid := p_its_aid
} // End of template mw_ivimIndWithSecurityParameters } // End of template mw_ivimIndWithSecurityParameters
...@@ -133,7 +133,7 @@ module LibItsIvim_Templates { ...@@ -133,7 +133,7 @@ module LibItsIvim_Templates {
*/ */
template (value) UtIvimInitialize m_ivimStructureInitialize( template (value) UtIvimInitialize m_ivimStructureInitialize(
in HashedId8 p_hashedId8 := '0000000000000000'O in HashedId8 p_hashedId8 := '0000000000000000'O
) := { ) := {
hashedId8 := p_hashedId8 hashedId8 := p_hashedId8
} // End of template m_ivimStructureInitialize } // End of template m_ivimStructureInitialize
...@@ -146,7 +146,7 @@ module LibItsIvim_Templates { ...@@ -146,7 +146,7 @@ module LibItsIvim_Templates {
* @param p_optional_ Optional field (Default: omit) * @param p_optional_ Optional field (Default: omit)
*/ */
template (value) UtIvimTrigger m_utTriggerEvent( template (value) UtIvimTrigger m_utTriggerEvent(
template (omit) TimestampIts p_repetitionInterval := c_duration_4sec, template (omit) TimestampIts p_repetitionInterval := c_duration_4sec * 1000, // TimeStampIts in millseconds
template (omit) TimestampIts p_validFrom := omit, template (omit) TimestampIts p_validFrom := omit,
template (omit) TimestampIts p_validTo := omit, template (omit) TimestampIts p_validTo := omit,
template (omit) ZidList p_zoneIds := omit, template (omit) ZidList p_zoneIds := omit,
...@@ -157,7 +157,7 @@ module LibItsIvim_Templates { ...@@ -157,7 +157,7 @@ module LibItsIvim_Templates {
template (omit) VarLengthNumber p_itsRrid := omit, template (omit) VarLengthNumber p_itsRrid := omit,
template (omit) Direction p_directionGic := omit, template (omit) Direction p_directionGic := omit,
template (omit) integer p_layoutId := omit template (omit) integer p_layoutId := omit
) := { ) := {
validFrom := p_validFrom, validFrom := p_validFrom,
validTo := p_validTo, validTo := p_validTo,
repetitionInterval := p_repetitionInterval, repetitionInterval := p_repetitionInterval,
...@@ -180,12 +180,12 @@ module LibItsIvim_Templates { ...@@ -180,12 +180,12 @@ module LibItsIvim_Templates {
* @param p_connectedIviStructures List of ConnectedIviStructure (Default: omit) * @param p_connectedIviStructures List of ConnectedIviStructure (Default: omit)
*/ */
template (omit) UtIvimUpdate m_utIvimUpdateEvent( template (omit) UtIvimUpdate m_utIvimUpdateEvent(
template (value) IviIdentificationNumber p_iviIdentificationNumber, template (value) IviIdentificationNumber p_iviIdentificationNumber,
template (omit) TimestampIts p_timeStamp := c_duration_2sec, template (omit) TimestampIts p_timeStamp := c_duration_2sec * 1000, // TimeStampIts in millseconds
template (omit) TimestampIts p_validFrom := omit, template (omit) TimestampIts p_validFrom := omit,
template (omit) TimestampIts p_validTo := omit, template (omit) TimestampIts p_validTo := omit,
template (omit) IVIManagementContainer.connectedIviStructures p_connectedIviStructures := omit template (omit) IVIManagementContainer.connectedIviStructures p_connectedIviStructures := omit
) := { ) := {
iviIdentificationNumber := p_iviIdentificationNumber, iviIdentificationNumber := p_iviIdentificationNumber,
validFrom := p_validFrom, validFrom := p_validFrom,
validTo := p_validTo, validTo := p_validTo,
...@@ -232,9 +232,9 @@ module LibItsIvim_Templates { ...@@ -232,9 +232,9 @@ module LibItsIvim_Templates {
* @param p_messageID The expected message id (Default: IVI message id) * @param p_messageID The expected message id (Default: IVI message id)
*/ */
template (present) ItsPduHeader mw_itsPduHeader( template (present) ItsPduHeader mw_itsPduHeader(
template (present) StationID p_stationID := ?, template (present) StationID p_stationID := ?,
template (present) ItsPduHeader.protocolVersion p_protocolVersion := LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_protocolVersion_currentVersion_, template (present) ItsPduHeader.protocolVersion p_protocolVersion := LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_protocolVersion_currentVersion_,
template (present) ItsPduHeader.messageID p_messageID := LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_messageID_ivim_ template (present) ItsPduHeader.messageID p_messageID := LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_messageID_ivim_
) := { ) := {
protocolVersion := p_protocolVersion, protocolVersion := p_protocolVersion,
messageID := p_messageID, messageID := p_messageID,
......
...@@ -36,7 +36,7 @@ module LibItsIvim_TypesAndValues { ...@@ -36,7 +36,7 @@ module LibItsIvim_TypesAndValues {
group ivimConstants { group ivimConstants {
const TimestampIts c_repetition_interval_deactivated := 0; const TimestampIts c_repetition_interval_deactivated := 0;
const TimestampIts c_duration_2sec := 2; const TimestampIts c_duration_2sec := 2; // FIXME Change them into milliseconds and remove *1000 factor in Tp & Template (default values)
const TimestampIts c_duration_4sec := 4; const TimestampIts c_duration_4sec := 4;
const TimestampIts c_duration_6sec := 6; const TimestampIts c_duration_6sec := 6;
...@@ -141,7 +141,7 @@ module LibItsIvim_TypesAndValues { ...@@ -141,7 +141,7 @@ module LibItsIvim_TypesAndValues {
IviIdentificationNumber iviIdentificationNumber, IviIdentificationNumber iviIdentificationNumber,
TimestampIts validFrom optional, TimestampIts validFrom optional,
TimestampIts validTo optional, TimestampIts validTo optional,
TimestampIts timeStamp optional, TimestampIts timeStamp optional, // FIXME Rename timeStamp into repetitionInterval as described in ETSI TR 103 099 Clause C.9.2 UpdateIvimEvent
IVIManagementContainer.connectedIviStructures connectedIviStructures optional IVIManagementContainer.connectedIviStructures connectedIviStructures optional
} with { } with {
variant "FIELDORDER(msb)" variant "FIELDORDER(msb)"
......
...@@ -75,7 +75,7 @@ module LibItsMapemSpatem_Functions { ...@@ -75,7 +75,7 @@ module LibItsMapemSpatem_Functions {
//deactivate mapemSpatemPort default alts //deactivate mapemSpatemPort default alts
vc_mapemSpatemDefaultActive := false; vc_mapemSpatemDefaultActive := false;
utPort.send ( p_event ); utPort.send ( p_event );
tc_wait.start; tc_wait.start;
alt { alt {
......
...@@ -224,13 +224,13 @@ module LibItsMapemSpatem_Templates { ...@@ -224,13 +224,13 @@ module LibItsMapemSpatem_Templates {
template (omit) UtMapemSpatemTrigger m_utTriggerEvent( template (omit) UtMapemSpatemTrigger m_utTriggerEvent(
in Event p_event, in Event p_event,
in template (omit) IntersectionID p_intersectionID := omit, in template (omit) IntersectionID p_intersectionID := omit,
in template (omit) RegulatorySpeedLimit p_regulatorySpeedLimit := omit, in template (omit) RegulatorySpeedLimit p_regulatorySpeedLimit := omit/*,
in template (omit) Latitude p_latitude := omit in template (omit) Latitude p_latitude := omit*/
) := { ) := {
event := p_event, event := p_event,
intersectionID := p_intersectionID, intersectionID := p_intersectionID,
regulatorySpeedLimit := p_regulatorySpeedLimit, regulatorySpeedLimit := p_regulatorySpeedLimit/*,
latitude := p_latitude latitude := p_latitude*/
} }
} }
......
...@@ -65,9 +65,8 @@ module LibItsMapemSpatem_TypesAndValues { ...@@ -65,9 +65,8 @@ module LibItsMapemSpatem_TypesAndValues {
type record UtMapemSpatemTrigger { type record UtMapemSpatemTrigger {
Event event, Event event,
IntersectionID intersectionID optional, IntersectionID intersectionID optional,
RegulatorySpeedLimit regulatorySpeedLimit optional, RegulatorySpeedLimit regulatorySpeedLimit optional/*,
Latitude latitude optional Latitude latitude optional*/
} with { } with {
variant "FIELDORDER(msb)" variant "FIELDORDER(msb)"
} }
......
...@@ -1178,17 +1178,10 @@ module LibItsSecurity_Functions { ...@@ -1178,17 +1178,10 @@ module LibItsSecurity_Functions {
/** /**
* @desc This function build and sign the SecureMessage part covered by the signature process including wrong elements of protocols. It is used for BO test cases * @desc This function build and sign the SecureMessage part covered by the signature process including wrong elements of protocols. It is used for BO test cases
* @param p_securedMessage The signed SecureMessage part * @param p_securedMessage The signed SecureMessage part
* @param p_protocolVersion The protocol version to be set. Default: 2 * @param p_signerIdentifierType Add digest or AT certificate or certificate chain
* @param p_trailerStatus The Traile behaviour:
* <li>0 for no trailer</li>
* <li>1 for invalid trailer</li>
* <li>2 for duplicated trailer</li>
* @param p_payloadField Payloads to be included in the message
* @param p_signerIdentifierType Add digest or AT certificate or certificate chain
* @param p_threeDLocation The 3D location
* @param p_headerInfo HeaderInfo to be inserted in the message
* @param p_certificateName The certificate identifier to be used. Default: TA_CERT_A * @param p_certificateName The certificate identifier to be used. Default: TA_CERT_A
* @param p_addMissingHeaders Whether to add mandatory headers not present in p_headerInfo * @param p_protocolVersion The protocol version to be set. Default: 2
* @param p_alterIssuerIdentifier Set to true to alter IssuerIdentifier
* @param p_alterATCertificateSignature Set to true to alter the AT certificate signature * @param p_alterATCertificateSignature Set to true to alter the AT certificate signature
* @param p_alterAACertificateSignature Set to true to alter the AA certificate signature * @param p_alterAACertificateSignature Set to true to alter the AA certificate signature
* @return true on success, false otherwise * @return true on success, false otherwise
...@@ -1196,16 +1189,14 @@ module LibItsSecurity_Functions { ...@@ -1196,16 +1189,14 @@ module LibItsSecurity_Functions {
* @see Draft ETSI TS 103 097 V1.1.14 Clause 7.1 Security profile for CAMs * @see Draft ETSI TS 103 097 V1.1.14 Clause 7.1 Security profile for CAMs
*/ */
function f_buildGnSecuredCam_Bo( function f_buildGnSecuredCam_Bo(
inout EtsiTs103097Data p_securedMessage, out EtsiTs103097Data p_securedMessage,
in UInt8 p_protocolVersion := c_protocol_version,
in integer p_trailerStatus := 0,
in ToBeSignedData p_payloadField, in ToBeSignedData p_payloadField,
in SignerIdentifier p_signerIdentifierType, // FIXME To be reviewed in SignerIdentifier p_signerIdentifierType, // FIXME To be reviewed
in template (omit) HeaderInfo p_headerInfo := omit, in charstring p_certificateName,
in charstring p_certificateName := "", in UInt8 p_protocolVersion,
in boolean p_addMissingHeaders := true, in boolean p_alterIssuerIdentifier,
in boolean p_alterATCertificateSignature := false, in boolean p_alterATCertificateSignature,
in boolean p_alterAACertificateSignature := false in boolean p_alterAACertificateSignature
) runs on ItsSecurityBaseComponent return boolean { ) runs on ItsSecurityBaseComponent return boolean {
// Local variables // Local variables
...@@ -1218,14 +1209,89 @@ module LibItsSecurity_Functions { ...@@ -1218,14 +1209,89 @@ module LibItsSecurity_Functions {
return false; return false;
} }
if (p_alterATCertificateSignature == true) { // Fill the structure with default values, these values will be updated later
p_securedMessage := valueof(m_etsiTs103097Data_signed(
m_signedData(
sha256,
p_payloadField,
m_signerIdentifier_self,
m_signature_ecdsaNistP256(
m_ecdsaP256Signature(
m_eccP256CurvePoint_x_only(int2oct(0, 32)),
int2oct(0, 32)
)
)
)
));
// Prepare mandatory headers
//log("f_buildGnSecuredCam: p_signerIdentifierType=", p_signerIdentifierType);
if (ischosen(p_signerIdentifierType.certificate)) { // Add the AT certificate
log("*** " & testcasename() & "f_buildGnSecuredCam: TODO ***");
stop;
/* TODO
* v_signerInfo := valueof(
m_header_info_signer_info(
m_signerIdentifier_certificate(
v_atCertificate
)));
} else if (valueof(p_signerIdentifierType) == e_certificate_chain) { // Add the AT certificate + AA EtsiTs103097Certificate
v_signerInfo := valueof(
m_header_info_signer_info(
m_signerIdentifier_certificates(
{
v_aaCertificate,
v_atCertificate
}
)
));*/
} else if (ischosen(p_signerIdentifierType.digest)) { // Add the AT certificate digest
if (ischosen(v_atCertificate.issuer.sha256AndDigest)) {
p_securedMessage.content.signedData.hashId := sha256;
p_securedMessage.content.signedData.signer := valueof(m_signerIdentifier_digest(
f_calculateDigestSha256FromCertificate(v_atCertificate)
));
} else if (ischosen(v_atCertificate.issuer.sha384AndDigest)) {
p_securedMessage.content.signedData.hashId := sha384;
p_securedMessage.content.signedData.signer := valueof(m_signerIdentifier_digest(
f_calculateDigestSha384FromCertificate(v_atCertificate)
));
}
} else {
log("*** " & testcasename() & "f_buildGnSecuredCam: TODO ***");
stop;
}
if (ispresent(v_atCertificate.signature_)) {
if (ischosen(v_atCertificate.signature_.ecdsaBrainpoolP256r1Signature)) {
p_securedMessage.content.signedData.signature_ := valueof(m_signature_ecdsaBrainpoolP256r1(
m_ecdsaP256Signature(
m_eccP256CurvePoint_x_only(int2oct(0, 32)),
int2oct(0, 32)
)
));
} else if (ischosen(v_atCertificate.signature_.ecdsaBrainpoolP384r1Signature)) {
p_securedMessage.content.signedData.signature_ := valueof(m_signature_ecdsaBrainpoolP384r1(
m_ecdsaP384Signature(
m_eccP384CurvePoint_x_only(int2oct(0, 48)),
int2oct(0, 48)
)
));
} // else, m_signature_ecdsaNistP256 already chosen by default
}
log("f_buildGnSecuredCam_Bo: p_securedMessage = ", p_securedMessage);
// Alter protocolVersion
p_securedMessage.protocolVersion := p_protocolVersion;
return f_buildGnSecuredMessage(p_securedMessage, p_certificateName, p_payloadField);
/*if (p_alterATCertificateSignature == true) {
v_atCertificate.signature_.ecdsaNistP256Signature.sSig := not4b(v_atCertificate.signature_.ecdsaNistP256Signature.sSig); v_atCertificate.signature_.ecdsaNistP256Signature.sSig := not4b(v_atCertificate.signature_.ecdsaNistP256Signature.sSig);
} }
if (p_alterAACertificateSignature == true) { if (p_alterAACertificateSignature == true) {
v_aaCertificate.signature_.ecdsaNistP256Signature.sSig := not4b(v_aaCertificate.signature_.ecdsaNistP256Signature.sSig); v_aaCertificate.signature_.ecdsaNistP256Signature.sSig := not4b(v_aaCertificate.signature_.ecdsaNistP256Signature.sSig);
} }*/
/* FIXME To be reviewed if (p_addMissingHeaders == true) { /* FIXME To be reviewed if (p_addMissingHeaders == true) {
// Prepare mandatory headers // Prepare mandatory headers
if (valueof(p_signerIdentifierType) == e_certificate) { // Add the AT certificate if (valueof(p_signerIdentifierType) == e_certificate) { // Add the AT certificate
...@@ -1256,9 +1322,9 @@ module LibItsSecurity_Functions { ...@@ -1256,9 +1322,9 @@ module LibItsSecurity_Functions {
valueof(m_header_info_generation_time(1000 * f_getCurrentTime())), // In us valueof(m_header_info_generation_time(1000 * f_getCurrentTime())), // In us
valueof(m_header_info_its_aid(c_its_aid_CAM)) valueof(m_header_info_its_aid(c_its_aid_CAM))
} }
}*/ }
return f_buildGnSecuredMessage_Bo(p_securedMessage, p_certificateName, p_protocolVersion, p_trailerStatus, p_payloadField, v_mandatoryHeaders, p_headerInfo); return f_buildGnSecuredMessage_Bo(p_securedMessage, p_certificateName, p_protocolVersion, p_trailerStatus, p_payloadField, v_mandatoryHeaders, p_headerInfo);*/
} // End of function f_buildGnSecuredCam_Bo } // End of function f_buildGnSecuredCam_Bo
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment