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 {
var UtGnEventInd v_ind;
[vc_utDefaultActive] utPort.receive(UtGnEventInd:?) -> value v_ind {
//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;
repeat;
}
......
......@@ -83,11 +83,11 @@ module LibItsIvim_Templates {
*/
template IvimInd mw_ivimIndWithGnParameters(
template (present) IVIM p_iviMsg := ?,
in template UInt8 p_gnNextHeader := *,
in template UInt8 p_gnHeaderType := *,
in template UInt8 p_gnHeaderSubtype := *,
in template UInt32 p_gnLifetime := *,
in template UInt8 p_gnTrafficClass := *
template UInt8 p_gnNextHeader := *,
template UInt8 p_gnHeaderType := *,
template UInt8 p_gnHeaderSubtype := *,
template UInt32 p_gnLifetime := *,
template UInt8 p_gnTrafficClass := *
) modifies mw_ivimInd := {
gnNextHeader := p_gnNextHeader,
gnHeaderType := p_gnHeaderType,
......@@ -146,7 +146,7 @@ module LibItsIvim_Templates {
* @param p_optional_ Optional field (Default: omit)
*/
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_validTo := omit,
template (omit) ZidList p_zoneIds := omit,
......@@ -181,7 +181,7 @@ module LibItsIvim_Templates {
*/
template (omit) UtIvimUpdate m_utIvimUpdateEvent(
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_validTo := omit,
template (omit) IVIManagementContainer.connectedIviStructures p_connectedIviStructures := omit
......
......@@ -36,7 +36,7 @@ module LibItsIvim_TypesAndValues {
group ivimConstants {
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_6sec := 6;
......@@ -141,7 +141,7 @@ module LibItsIvim_TypesAndValues {
IviIdentificationNumber iviIdentificationNumber,
TimestampIts validFrom 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
} with {
variant "FIELDORDER(msb)"
......
......@@ -224,13 +224,13 @@ module LibItsMapemSpatem_Templates {
template (omit) UtMapemSpatemTrigger m_utTriggerEvent(
in Event p_event,
in template (omit) IntersectionID p_intersectionID := omit,
in template (omit) RegulatorySpeedLimit p_regulatorySpeedLimit := omit,
in template (omit) Latitude p_latitude := omit
in template (omit) RegulatorySpeedLimit p_regulatorySpeedLimit := omit/*,
in template (omit) Latitude p_latitude := omit*/
) := {
event := p_event,
intersectionID := p_intersectionID,
regulatorySpeedLimit := p_regulatorySpeedLimit,
latitude := p_latitude
regulatorySpeedLimit := p_regulatorySpeedLimit/*,
latitude := p_latitude*/
}
}
......
......@@ -65,9 +65,8 @@ module LibItsMapemSpatem_TypesAndValues {
type record UtMapemSpatemTrigger {
Event event,
IntersectionID intersectionID optional,
RegulatorySpeedLimit regulatorySpeedLimit optional,
Latitude latitude optional
RegulatorySpeedLimit regulatorySpeedLimit optional/*,
Latitude latitude optional*/
} with {
variant "FIELDORDER(msb)"
}
......
......@@ -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
* @param p_securedMessage The signed SecureMessage part
* @param p_protocolVersion The protocol version to be set. Default: 2
* @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_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_alterAACertificateSignature Set to true to alter the AA certificate signature
* @return true on success, false otherwise
......@@ -1196,16 +1189,14 @@ module LibItsSecurity_Functions {
* @see Draft ETSI TS 103 097 V1.1.14 Clause 7.1 Security profile for CAMs
*/
function f_buildGnSecuredCam_Bo(
inout EtsiTs103097Data p_securedMessage,
in UInt8 p_protocolVersion := c_protocol_version,
in integer p_trailerStatus := 0,
out EtsiTs103097Data p_securedMessage,
in ToBeSignedData p_payloadField,
in SignerIdentifier p_signerIdentifierType, // FIXME To be reviewed
in template (omit) HeaderInfo p_headerInfo := omit,
in charstring p_certificateName := "",
in boolean p_addMissingHeaders := true,
in boolean p_alterATCertificateSignature := false,
in boolean p_alterAACertificateSignature := false
in charstring p_certificateName,
in UInt8 p_protocolVersion,
in boolean p_alterIssuerIdentifier,
in boolean p_alterATCertificateSignature,
in boolean p_alterAACertificateSignature
) runs on ItsSecurityBaseComponent return boolean {
// Local variables
......@@ -1218,13 +1209,88 @@ module LibItsSecurity_Functions {
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);
}
if (p_alterAACertificateSignature == true) {
v_aaCertificate.signature_.ecdsaNistP256Signature.sSig := not4b(v_aaCertificate.signature_.ecdsaNistP256Signature.sSig);
}
}*/
/* FIXME To be reviewed if (p_addMissingHeaders == true) {
// Prepare mandatory headers
......@@ -1256,9 +1322,9 @@ module LibItsSecurity_Functions {
valueof(m_header_info_generation_time(1000 * f_getCurrentTime())), // In us
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
......
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