Commit cd3c1e1e authored by Yann Garcia's avatar Yann Garcia
Browse files

Validate ATsMBR class1 TCs

parent 30fdeda3
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -22,6 +22,28 @@ int etsi_ts103759_data_codec::decode(const OCTETSTRING &p_data, EtsiTs103759Core
  //  _params = params;
  p_etsi_ts_103759_data.decode(*p_etsi_ts_103759_data.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_OER);

  /**
   * FIXME FSCOM Bug in TITAN TTCN-3 and ASN.1 Compiler for the TTCN-3 Test Executor, version 9.0.0
   */
  Ieee1609Dot2::CertificateBase* cert = nullptr;
  if (p_etsi_ts_103759_data.report().content().ischosen(EtsiTs103759Core::AidSpecificReport_content_type::ALT_asrCam)) {
    if (p_etsi_ts_103759_data.report().content().asrCam().v2xPduEvidence()[0].certificate().is_present()) {
      cert = static_cast<Ieee1609Dot2::CertificateBase*>(p_etsi_ts_103759_data.report().content().asrCam().v2xPduEvidence()[0].certificate().get_opt_value());
    }
  /*} else if (p_etsi_ts_103759_data.report().content().ischosen(EtsiTs103759Core::AidSpecificReport_content_type::ALT_asrDenm)) {
    if (p_etsi_ts_103759_data.report().content().asrDenm().v2xPduEvidence()[0].certificate().is_present()) {
      cert = static_cast<Ieee1609Dot2::CertificateBase*>(p_etsi_ts_103759_data.report().content().asrCam().v2xPduEvidence()[0].certificate().get_opt_value());
    }*/
  }
  if (cert != nullptr) {
    cert->toBeSigned().appExtensions().set_to_omit();
    cert->toBeSigned().certIssueExtensions().set_to_omit();
    cert->toBeSigned().certRequestExtension().set_to_omit();
  }
  /**
   * 
   */

  loggers::get_instance().log_msg("<<< etsi_ts103759_data_codec::decode: ", (const Base_Type &)p_etsi_ts_103759_data);
  return 0;
}
+10 −14
Original line number Diff line number Diff line
@@ -26,20 +26,16 @@ int etsi_ts103097_certificate_codec::decode(const OCTETSTRING &p_data, Ieee1609D
  _params = params;
  p_cert.decode(*p_cert.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_OER);

  /**
   * FIXME FSCOM Bug in TITAN TTCN-3 and ASN.1 Compiler for the TTCN-3 Test Executor, version 9.0.0
   */
  p_cert.toBeSigned().appExtensions().set_to_omit();
  p_cert.toBeSigned().certIssueExtensions().set_to_omit();
  p_cert.toBeSigned().certRequestExtension().set_to_omit();
  /**
   * 
   */

  loggers::get_instance().log_msg("<<< etsi_ts103097_certificate_codec::decode: ", (const Base_Type &)p_cert);
  return 0;
}

// extern "C" {
//   extern asn_TYPE_descriptor_t asn_DEF_EtsiTs103097;
// }

// int EtsiTs103097PDUCodec::encode (const Ieee1609Dot2::CertificateBase& p_cert, BITSTRING& p_p_data)
// {
//   return _encode(Ieee1609Dot2::CertificateBase_descr_, asn_DEF_EtsiTs103097Certificate, p_cert, p_p_data);
// }

// int EtsiTs103097PDUCodec::decode (const BITSTRING& p_p_data, Ieee1609Dot2::CertificateBase& p_cert)
// {
//   return _decode(Ieee1609Dot2::CertificateBase_descr_, asn_DEF_EtsiTs103097Certificate, p_p_data, p_cert);
// }
+14 −14
Original line number Diff line number Diff line
@@ -26,20 +26,20 @@ int etsi_ts103097_data_codec::decode(const OCTETSTRING &p_data, Ieee1609Dot2::Ie
  _params = p_params;
  p_ieee1609Dot2Data.decode(*p_ieee1609Dot2Data.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_OER);

  /**
   * FIXME FSCOM Bug in TITAN TTCN-3 and ASN.1 Compiler for the TTCN-3 Test Executor, version 9.0.0
   */
  if (p_ieee1609Dot2Data.content().ischosen(Ieee1609Dot2::Ieee1609Dot2Content::ALT_signedData)) {
    if (p_ieee1609Dot2Data.content().signedData().signer().ischosen(Ieee1609Dot2::SignerIdentifier::ALT_certificate)) {
      p_ieee1609Dot2Data.content().signedData().signer().certificate()[0].toBeSigned().appExtensions().set_to_omit();
      p_ieee1609Dot2Data.content().signedData().signer().certificate()[0].toBeSigned().certIssueExtensions().set_to_omit();
      p_ieee1609Dot2Data.content().signedData().signer().certificate()[0].toBeSigned().certRequestExtension().set_to_omit();
    }
  }
  /**
   * 
   */

  loggers::get_instance().log_msg("<<< etsi_ts103097_data_codec::decode: ", (const Base_Type &)p_ieee1609Dot2Data);
  return 0;
}

// extern "C" {
//   extern asn_TYPE_descriptor_t asn_DEF_EtsiTs103097;
// }

// int EtsiTs103097PDUCodec::encode (const Ieee1609Dot2::Ieee1609Dot2Data& p_cert, BITSTRING& p_data)
// {
//   return _encode(Ieee1609Dot2::Ieee1609Dot2Data_descr_, asn_DEF_EtsiTs103097Certificate, p_cert, p_data);
// }

// int EtsiTs103097PDUCodec::decode (const BITSTRING& p_data, Ieee1609Dot2::Ieee1609Dot2Data& p_cert)
// {
//   return _decode(Ieee1609Dot2::Ieee1609Dot2Data_descr_, asn_DEF_EtsiTs103097Certificate, p_data, p_cert);
// }
+8 −0
Original line number Diff line number Diff line
@@ -904,9 +904,17 @@ int security_ecc::sign(const OCTETSTRING &p_data, const OCTETSTRING &p_entl_a, c
  // FIXME Check returned values and cleanuo on error
  EC_KEY* private_key;
  ::EC_KEY_oct2priv(private_key, static_cast<const unsigned char *>(_pri_key), _pri_key.lengthof());
  #if OPENSSL_CONFIGURED_API >= 30000
  // FIXME FSCOM To be reviewd with new OPENSSL APIs
  //EVP_PKEY_SM2* private_evp_key = ::EVP_PKEY_SM2_new();
  //::EVP_PKEY_set1_EC_KEY(private_evp_key, private_key);
  EVP_PKEY* private_evp_key = ::EVP_PKEY_new();
  ::EVP_PKEY_set1_EC_KEY(private_evp_key, private_key);
  #else
  EVP_PKEY* private_evp_key = ::EVP_PKEY_new();
  ::EVP_PKEY_set1_EC_KEY(private_evp_key, private_key);
  ::EVP_PKEY_set_alias_type(private_evp_key, EVP_PKEY_SM2);
  #endif
  EVP_MD_CTX* ctx = ::EVP_MD_CTX_new();
  ::EVP_MD_CTX_init(ctx);
  ::EVP_SignInit_ex(ctx, ::EVP_sm3(), NULL);
+15 −6
Original line number Diff line number Diff line
@@ -36,6 +36,12 @@ LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates"
LibItsMbr_Pics.PICS_IUT_MA_CERTIFICATE_ID        := "CERT_IUT_A_MA"
LibItsMbr_Pics.PICS_IUT_MA_CERTIFICATE_ID_NO_SSP := "CERT_IUT_A_MA_NO_SSP"

LibItsMbr_Pixits.PX_REPEAT_CONSISTENT_MESSAGE   := 3
LibItsMbr_Pixits.PX_REPEAT_INCONSISTENT_MESSAGE := 1

LibItsCommon_Pixits.PX_TS_LATITUDE  := 515344680 + 1000 # +10000: d=131.098724, +1000:d=13.
LibItsCommon_Pixits.PX_TS_LONGITUDE := 139284390 + 1000

[LOGGING]
# In this section you can specify the name of the log file and the classes of events
# you want to log into the file or display on console (standard error).
@@ -127,14 +133,14 @@ LogEventTypes:= Yes
# Cygwin
#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,beacon_secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=e2b7b30429eb)/PCAP(mac_src=e2b7b30429eb,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)"
# Linux
system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,beacon_secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947)"
#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,beacon_secured_mode=1,its_aid=36)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947)"
system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,beacon_secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlo1,filter=and ether proto 0x8947)"
#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,beacon_secured_mode=1,its_aid=36)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlo1,filter=and ether proto 0x8947)"
# Linux over UDP
#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,beacon_secured_mode=1,its_aid=36)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.43,src_port=4041,dst_port=9091)"
#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,beacon_secured_mode=1,its_aid=36)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.39,src_port=4041,dst_port=9091)"

system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.43)"
system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.39)"

system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)"
system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.39,dst_port=12345,src_port=12346)"

[EXECUTE]

@@ -166,7 +172,7 @@ system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.43,dst_port=12345,src_po
#ItsMbr_TestCases.TC_MRS_ITSS_SEC_MESSAGES_CLASS1_CAM_BV_06

# Check that the IUT provides the certificate of the reported ITS-S when the invalid secured geonetworking packet does not contain the AT certificate
ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_BV_01
#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_BV_01

# Check that the IUT generates an invalid speed value observation on a CAM in the MR message when requested (Class 1) - obs-Speed-ValueTooLarge-VehicleType (e.g. A cycle with a speed of 100km/h) 
#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS1_CAM_BV_01
@@ -177,6 +183,9 @@ ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_BV_01
# Check that the IUT generates an invalid acceleration value observation on a CAM in the MR message when requested (Class 1) - obs-LongAcc-ValueTooLarge
#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS1_CAM_BV_03

# Check that the IUT generates an inconsistent position value observation (regarding own communication coverage observation) on a CAM in the MR message when requested (Class 1) - obs-Position-ChangeTooLarge
ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS1_CAM_BV_04

# Check that the IUT generates a MR message with an observation of an inconsistent speed change (regarding acceleration) in consecutive CAMs when requested (Class 2) - obs-Speed-ChangeTooLarge
#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_01

Loading