Commit 75058f70 authored by Denis Filatov's avatar Denis Filatov
Browse files

fix asn1c encoding of bitstring default value

parent 3d84577a
......@@ -28,10 +28,12 @@ ASN_FILES = CAM/CAM.asn \
Security/1609Dot2/IEEE1609dot2.asn \
Security/1609Dot2/IEEE1609dot2BaseTypes.asn \
Security/EtsiTs103097Module.asn
# PDUs
PDU = CAM DENM MAPEM SPATEM SREM SSEM IVIM EtsiTs103097Data EtsiTs103097Certificate
#patches
PATCHES = PsidGroupPermissions.c.diff
ASN1C:=asn1c
#Override ASN1C instalation path
#ASN1C_PATH =
......@@ -89,6 +91,7 @@ all: Makefile $(CONVERTER)
$(LIB_MAKEFILE): $(addprefix $(ASN_DIR)/, $(ASN_FILES))
$(ASN1C) -gen-PER -gen-OER $(addprefix -pdu=,$(PDU)) -fcompound-names $^
-for n in $(PATCHES); do patch -i "$(SCRIPT_DIR)/$$n"; done
$(CONVERTER): $(ASN_LIBRARY) $(CONVERTER_OBJS)
$(CC) $(CFLAGS) -o $@ $(CONVERTER_OBJS) $(ASN_LIBRARY) $(LIBS)
......
--- PsidGroupPermissions.c-orig 2018-08-23 15:50:25.762030100 +0200
+++ PsidGroupPermissions.c 2018-09-10 16:47:19.921571200 +0200
@@ -51,6 +51,22 @@
*st = 0;
return 0;
}
+static int asn_DFL_5_cmp_0(const void *sptr) {
+ uint8_t def_buf[] = { 0 };
+ BIT_STRING_t def = { &def_buf[0], 1, 7 };
+ return BIT_STRING_compare(&asn_DEF_EndEntityType, sptr, &def);
+}
+
+static int asn_DFL_5_set_0(void **sptr) {
+ BIT_STRING_t * st = *(BIT_STRING_t **)sptr;
+ if (!st) {
+ st = (*sptr = CALLOC(1, sizeof(*st)));
+ if (!st) return -1;
+ }
+ OCTET_STRING_fromBuf((OCTET_STRING_t *)st, "\x0", 1);
+ return 0;
+}
+
asn_TYPE_member_t asn_MBR_PsidGroupPermissions_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct PsidGroupPermissions, subjectPermissions),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
@@ -87,7 +103,8 @@
&asn_DEF_EndEntityType,
0,
{ 0, 0, 0 },
- 0, 0, /* No default value */
+ asn_DFL_5_cmp_0,
+ asn_DFL_5_set_0,
"eeType"
},
};
......@@ -7,7 +7,7 @@ LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := {
typeOfAddress := e_initial,
stationType := e_unknown, #e_roadSideUnit,
stationCountryCode := 0, #33,
mid := '4C5E0C14D2EA'O
mid := '4C5E0C14D2EC'O
}
LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB
......@@ -15,9 +15,9 @@ LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB
# Enable Security support
LibItsGeoNetworking_Pics.PICS_GN_SECURITY := true
# Root path to access certificate stored in files, identified by certficate ID
LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "/home/vagrant/tmp";
LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "../data/v3/certificates";
# Configuration sub-directory to access certificate stored in files
LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "test_01";
LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "";
[LOGGING]
......@@ -101,33 +101,212 @@ LogEventTypes:= Yes
# save_mode : 1 to save sent packet, 0 otherwise
# Single GeoNetworking component port
system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730)/ETH(mac_src=080027d2b658,mac_bc=FFFFFFFFFFFF,eth_type=8947)/PCAP(mac_src=080027d2b658,nic=eth1,filter=and ether proto 0x8947)"
#system.geoNetworkingPort.params := "
# GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730)/
# ETH(mac_src=803f5d092bdc,eth_type=8947)/
# PCAP(nic=34D76261-24AC-42B1-8340-9C5EAEE17E27,filter=and ether proto 0x8947)"
system.geoNetworkingPort.params := "
GN(ll_address=4C5E0C14D2EC,latitude=43551050,longitude=10298730,beaconing=0,expiry=1000)/
ETH(mac_src=803f5d092bdc,mac_bc=FFFFFFFFFFFF,eth_type=8947)/
PCAP_FILE(file=../testdata/TC_SEC_ITSS_SND_CAM_01_BV.pcap,realtime=yes, delay=5000)"
# GeoNetworking UpperTester port based on UDP
system.utPort.params := "UT_GN(loopback=0)/UDP(dst_ip=192.168.1.250,dst_port=12345,src_ip=192.168.1.253,src_port=12345)/ETH(mac_src=080027d2b658,mac_dst=90fd61e61902,eth_type=0800)/PCAP(mac_src=080027d2b658,nic=eth1,filter=and udp port 12345)"
system.utPort.params := "UT_GN(loopback=1)"
# CAM UpperTester port based on UDP
system.camUtPort.params := "UT_GN(loopback=0)/UDP(dst_ip=192.168.1.250,dst_port=12345,src_ip=192.168.1.253,src_port=12345)/ETH(mac_src=080027d2b658,mac_dst=90fd61e61902,eth_type=0800)/PCAP(mac_src=080027d2b658,nic=eth1,filter=and udp port 12345)"
system.camUtPort.params := "UT_CAM(loopback=1)"
[EXECUTE]
ItsSecurity_TestCases.TC_TEST_1
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_MSG_01_BV
#Check that ITS-S sends a Ieee1609Dot2Data containing protocol version set to 3
ItsSecurity_TestCases.TC_SEC_ITSS_SND_MSG_01_BV
# ------------------------- CAM ---------------------------
# Check that IUT sends the secured CAM using SignedData container.
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_01_BV
# Check that IUT sends the secured CAM containing the HeaderInfo field psid set to 'AID_CAM'.
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_02_BV
# Check that IUT sends the secured CAM with the HeaderInfo containing generationTime
# and doesn't containing expiryTime, generationLocation, encryptionKey, p2pcdLearningRequest, missingCrlIdentifier.
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_03_BV
# Check that IUT sends the secured CAM containing signer containing either certificate or digest;
# Check that signing certificate has permissions to sign CAM messages.
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_04_BV
# Check that IUT calculate the digest of certificate using proper hash algorithm;
# Check that IUT canonicalize certificates before hash calculation.
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_05_BV
# Check that IUT sends the secured CAM containing the signing certificate when over the time of one
# second no other secured CAM contained the certificate was sent.
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_06_BV
# Check that IUT sends the secured CAM containing the signing certificate when the timeout of one second
# has been expired after the previous CAM containing the certificate.
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_07_BV
# Check that IUT sends the secured CAM containing the signing certificate when the IUT received CAM from an unknown ITS-S.
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_08_BV
# Check that IUT restarts the certificate sending timer when the certificate has been sent.
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_09_BV
# Check that the IUT sends certificate request when it receives secured CAM containing
# digest of unknown certificate as a message signer.
# (PICS_SEC_P2P_AT_DISTRIBUTION)
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_10_BV
# Check that the IUT sends certificate request when it receives secured CAM
# containing certificate signed by unknown AA certificate.
# (PICS_SEC_P2P_AT_DISTRIBUTION and PICS_SEC_SHA256)
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_11_01_BV
# Check that the IUT sends certificate request when it receives secured CAM
# containing certificate signed by unknown AA certificate.
# (PICS_SEC_P2P_AT_DISTRIBUTION and PICS_SEC_SHA384)
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_11_02_BV
# Check that IUT sends the secured CAM containing the signing certificate when it received
# a CAM containing a request for unrecognized certificate that matches with the currently
# used AT certificate ID of the IUT.
# (PICS_SEC_P2P_AT_DISTRIBUTION)
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_12_BV
# Check that IUT sends the secured CAM containing the AA certificate in the requestedCertificate
# headerInfo field when it received a CAM containing a request for unrecognized certificate that
# matches with the currently used AA certificate ID of the IUT.
# (PICS_SEC_P2P_AT_DISTRIBUTION)
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_13_BV
# Check that IUT sends the secured CAM containing the AA certificate in the requestedCertificate headerInfo
# field when it received a CAM containing a request for unrecognized certificate that matches with the known
# AA certificate ID which is not currently used by the IUT.
# (PICS_SEC_P2P_AA_DISTRIBUTION)
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_14_BV
# Check that the IUT doesn't send a secured CAM containing the AA certificate in the requestedCertificate
# headerInfo field when it was previously requested and already received from another ITS-S.
# (PICS_SEC_P2P_AA_DISTRIBUTION)
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_15_BV
# Check that the IUT doesn't send a secured CAM containing the AA certificate in the requestedCertificate
# headerInfo field when it contains certificate in the signer field.
# (PICS_SEC_P2P_AA_DISTRIBUTION)
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_16_BV
# Check that the IUT send a secured CAM containing the AA certificate in the
# requestedCertificate headerInfo field with the next CAM containing digest as a signer info.
# (PICS_SEC_P2P_AA_DISTRIBUTION)
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_17_BV
# Check that IUT sends the secured CAM containing generation time and this time is inside the validity period of the signing certificate;
# Check that message generation time value is realistic
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_18_BV
# Check that IUT sends the secured CAM containing the 'data' field in signed data payload,
# containing the EtsiTs103097Data of type unsecured, contained the CAM payload
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_19_BV
# Check that the IUT sends the secured CAM signed with the certificate containing appPermisions
# allowing to sign CA messages
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_20_BV
# Check that IUT sends the secured CAM containing signature;
# Check that the signature is calculated over the right fields
# and using right hash algorythm by cryptographically verifying the signature
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_21_BV
# Check that IUT sends the secured CAM containing signature containing the ECC point of type set to
# either compressed_lsb_y_0, compressed_lsb_y_1 or x_coordinate_only.
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_22_BV
# Check that IUT doesn't send secured CAMs if IUT is authorized with AT certificate doesn't allowing sending messages in this location.
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_23_BV
# Check that IUT doesn't send the secured CAM if IUT is configured to use an AT certificate without
# region validity restriction and generation location is outside of the region of the issuing AA certificate.
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_24_BV
# Check that IUT doesn't send secured CAMs if all AT certificates installed on the IUT was expired.
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_25_BV
# Check that IUT doesn't send secured CAMs if all AT certificates installed on the IUT have the starting time in the future.
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_26_BV
# Check that IUT doesn't send secured CAMs if IUT doesn't possess an AT certificate allowing sending CAM by its appPermissions.
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_27_BV
#--------------------------------------- DENM ------------------------------------------
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_01_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_02_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_03_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_04_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_05_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_06_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_07_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_08_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_09_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_10_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_11_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_12_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_13_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_14_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_15_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_16_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_17_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_DENM_18_BV
#--------------------------------------- OTHER MESSAGES ------------------------------------------
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_GENMSG_01_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_GENMSG_02_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_GENMSG_03_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_GENMSG_04_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_GENMSG_05_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_GENMSG_06_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_GENMSG_07_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_GENMSG_08_BV
#--------------------------------------- ENCRYPTED MESSAGES ------------------------------------------
# (PICS_SEC_ENCRYPTION_SUPPORT)
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_ENC_01_BV
# (PICS_SEC_ENCRYPTION_SUPPORT)
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_ENC_02_BV
# (PICS_SEC_ENCRYPTION_SUPPORT)
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_ENC_03_BV
# (PICS_SEC_ENCRYPTION_SUPPORT)
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_ENC_04_BV
# (PICS_SEC_ENCRYPTION_SUPPORT)
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_ENC_05_BV
# (PICS_SEC_ENCRYPTION_SUPPORT)
#--------------------------------------- CERTIFICATE TESTING ------------------------------------------
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_01_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_02_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_03_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_04_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_05_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_06_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_07_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_08_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_09_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_10_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_11_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_12_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_13_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_14_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_15_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_16_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_17_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_18_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_19_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_20_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_21_BV
#--------------------------------------- Internal tests (to be removed) ------------------------------------------
#ItsSecurity_TestCases.TC_TEST_1
[MAIN_CONTROLLER]
# The options herein control the behavior of MC.
......
......@@ -51,6 +51,22 @@ static int asn_DFL_4_set_0(void **sptr) {
*st = 0;
return 0;
}
static int asn_DFL_5_cmp_0(const void *sptr) {
uint8_t def_buf[] = { 0 };
BIT_STRING_t def = { &def_buf[0], 1, 7 };
return BIT_STRING_compare(&asn_DEF_EndEntityType, sptr, &def);
}
static int asn_DFL_5_set_0(void **sptr) {
BIT_STRING_t * st = *(BIT_STRING_t **)sptr;
if (!st) {
st = (*sptr = CALLOC(1, sizeof(*st)));
if (!st) return -1;
}
OCTET_STRING_fromBuf((OCTET_STRING_t *)st, "\x0", 1);
return 0;
}
asn_TYPE_member_t asn_MBR_PsidGroupPermissions_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct PsidGroupPermissions, subjectPermissions),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
......@@ -87,7 +103,8 @@ asn_TYPE_member_t asn_MBR_PsidGroupPermissions_1[] = {
&asn_DEF_EndEntityType,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
asn_DFL_5_cmp_0,
asn_DFL_5_set_0,
"eeType"
},
};
......@@ -110,6 +127,7 @@ asn_SEQUENCE_specifics_t asn_SPC_PsidGroupPermissions_specs_1 = {
3, 0, /* Root/Additions */
-1, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_PsidGroupPermissions = {
"PsidGroupPermissions",
"PsidGroupPermissions",
......
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