From 564981a8c807e415ec678f119e7f64b3ca3b05c6 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Tue, 22 Feb 2022 14:38:06 +0100 Subject: [PATCH 001/178] fix 'if' mismatch in security_services::extract_verification_keys --- .gitignore | 13 +++++-- ccsrc/Protocols/Security/security_services.cc | 37 +++++++++++++++++-- 2 files changed, 43 insertions(+), 7 deletions(-) mode change 100755 => 100644 .gitignore diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 index a8e8edc..80adcbd --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,10 @@ -build -bin -config.mk +build +bin +config.mk +data/certificates/certificates +data/certificates/xer +data/certificates/iut +data/certificates/temp + + + diff --git a/ccsrc/Protocols/Security/security_services.cc b/ccsrc/Protocols/Security/security_services.cc index 876e2f8..48bae15 100644 --- a/ccsrc/Protocols/Security/security_services.cc +++ b/ccsrc/Protocols/Security/security_services.cc @@ -1268,7 +1268,7 @@ int security_services::extract_verification_keys(const Ieee1609Dot2::Certificate p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().uncompressedP256().x(); p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().uncompressedP256().y(); } else { - loggers::get_instance().error("security_services::extract_verification_keys: Unsupported VerificationKey"); + loggers::get_instance().error("security_services::extract_verification_keys: Unsupported ecdsaNistP256 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().get_selection()); return -1; } } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP256r1)) { @@ -1290,7 +1290,13 @@ int security_services::extract_verification_keys(const Ieee1609Dot2::Certificate Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_uncompressedP256)) { p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().uncompressedP256().x(); p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().uncompressedP256().y(); - } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP384r1)) { + } else { + loggers::get_instance().error("security_services::extract_verification_keys: Unsupported ecdsaBrainpoolP256r1 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().get_selection()); + return -1; + } + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP384r1)) { + if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().ischosen( + Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__0)) { p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().compressed__y__0(); security_ecc ecc(ec_elliptic_curves::brainpool_p_384_r1, p_public_comp_key, ecc_compressed_mode::compressed_y_0); p_public_key_x = ecc.public_key_x(); @@ -1308,11 +1314,34 @@ int security_services::extract_verification_keys(const Ieee1609Dot2::Certificate p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().uncompressedP384().x(); p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().uncompressedP384().y(); } else { - loggers::get_instance().error("security_services::extract_verification_keys: Unsupported VerificationKey"); + loggers::get_instance().error("security_services::extract_verification_keys: Unsupported ecdsaBrainpoolP384r1 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().get_selection()); + return -1; + } + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP384)) { + if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().ischosen( + Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__0)) { + p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().compressed__y__0(); + security_ecc ecc(ec_elliptic_curves::nist_p_384, p_public_comp_key, ecc_compressed_mode::compressed_y_0); + p_public_key_x = ecc.public_key_x(); + p_public_key_y = ecc.public_key_y(); + p_public_comp_key_mode = INTEGER(0); + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().ischosen( + Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__1)) { + p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().compressed__y__1(); + security_ecc ecc(ec_elliptic_curves::nist_p_384, p_public_comp_key, ecc_compressed_mode::compressed_y_1); + p_public_key_x = ecc.public_key_x(); + p_public_key_y = ecc.public_key_y(); + p_public_comp_key_mode = INTEGER(1); + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().ischosen( + Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_uncompressedP384)) { + p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().uncompressedP384().x(); + p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().uncompressedP384().y(); + } else { + loggers::get_instance().error("security_services::extract_verification_keys: Unsupported ecdsaNistP384 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().get_selection()); return -1; } } else { - loggers::get_instance().error("security_services::extract_verification_keys: Unsupported VerificationKey"); + loggers::get_instance().error("security_services::extract_verification_keys: Unsupported VerificationKey curve %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().get_selection()); return -1; } -- GitLab From 4068611ac8db2de71aa179fa643f84781df84c47 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Wed, 23 Feb 2022 20:56:01 +0100 Subject: [PATCH 002/178] Add FA and FA3 certificate profiles --- Makefile | 300 +++++++++--------- data/certificates/Makefile | 118 ++++--- data/certificates/profiles/CERT_TS_FA3_AA.xml | 44 +++ data/certificates/profiles/CERT_TS_FA3_AT.xml | 36 +++ data/certificates/profiles/CERT_TS_FA_AA.xml | 44 +++ data/certificates/profiles/CERT_TS_FA_AT.xml | 36 +++ 6 files changed, 380 insertions(+), 198 deletions(-) create mode 100644 data/certificates/profiles/CERT_TS_FA3_AA.xml create mode 100644 data/certificates/profiles/CERT_TS_FA3_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_FA_AA.xml create mode 100644 data/certificates/profiles/CERT_TS_FA_AT.xml diff --git a/Makefile b/Makefile index a771918..97cfa11 100644 --- a/Makefile +++ b/Makefile @@ -1,150 +1,150 @@ --include config.mk - -ifeq (,$(ATS)) - $(error ATS shall be defined) -endif - -ifeq (,$(TOPDIR)) - TOPDIR := . -endif - -ifeq (,$(TTCN3_DIR)) - $(error TTCN3_DIR shall be defined in config.mk) -endif - -export ASN1C_PATH - -first: all - -define IncludeModule -undefine sources -undefine modules -undefine includes -include $(1)/module.mk -$$(foreach S, $$(sources), $$(eval all_sources += $$(if $$(filter /%, $$(S)), $$(TOPDIR)/$$(S), $(1)/$$(S)))) -$$(foreach I, $$(includes), $$(eval all_includes += $$(if $$(filter /%, $$(I)), $$(TOPDIR)/$$(I), $(1)/$$(I)))) -$$(foreach M, $$(modules), $$(eval $$(call IncludeModule, $$(if $$(filter /%, $$(M)), $$(TOPDIR)/$$(M), $(1)/$$(M))))) -endef - -all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src $(TOPDIR)/ccsrc/Framework /usr/include/jsoncpp -defines += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS) -libs += $(TTCN3_DIR)/lib/libttcn3-rt2-parallel.a -lstdc++fs - -ifeq (Windows_NT,$(OS)) -# Silence linker warnings. -LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc -defines += WIN32 -libs += $(patsubst %, -L%/lib, $(OPENSSL_DIR)) -all_includes += $(addsuffix /include, $(OPENSSL_DIR)) -libs += $(WPCAP_DLL_PATH) -else -defines += LINUX -libs += -lpcap -lrt -lpthread -endif - -libs += -lssl -lcrypto -lxml2 -ljsoncpp - -$(eval $(call IncludeModule, $(TOPDIR)/ttcn/$(ATS))) - -outdir := $(TOPDIR)/build/$(ATS) -bindir := $(TOPDIR)/bin - -sources := $(sort $(all_sources)) -includes := $(outdir) $(outdir)/.. $(outdir)/../asn1 $(all_includes) $(NPCAP_INCLUDE) - -ifeq (Windows_NT,$(OS)) - EXE=.exe -endif - -ttcn_sources := $(filter %.ttcn , $(sources)) -ttcn3_sources := $(filter %.ttcn3, $(sources)) -asn_sources := $(filter %.asn, $(sources)) -asn1_sources := $(filter %.asn1, $(sources)) - -tt_sources := $(ttcn_sources) $(ttcn3_sources) $(asn_sources) $(asn1_sources) -cc_sources := $(filter %.cc, $(sources)) - -gen_ttcn_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn, %.cc, $(ttcn_sources)))) -gen_ttcn_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn, %.hh, $(ttcn_sources)))) -gen_ttcn3_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn3, %.cc, $(ttcn3_sources)))) -gen_ttcn3_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn3, %.hh, $(ttcn3_sources)))) -gen_asn_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn, %.cc, $(asn_sources)))) -gen_asn_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn, %.hh, $(asn_sources)))) -gen_asn1_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn1, %.cc, $(asn1_sources)))) -gen_asn1_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn1, %.hh, $(asn1_sources)))) - -gen_sources := $(gen_ttcn_sources) $(gen_ttcn3_sources) $(gen_asn_sources) $(gen_asn1_sources) -gen_headers := $(gen_ttcn_headers) $(gen_ttcn3_headers) $(gen_asn_headers) $(gen_asn1_headers) - -gen_objects := $(patsubst %.cc, %.o, $(gen_sources)) -cc_objects := $(patsubst %.cc, $(outdir)/%.o, $(cc_sources)) - -.PHONY: all FORCE echo - -all: $(bindir) $(outdir) $(bindir)/$(ATS)$(EXE) - -echo_sources: - @echo -e "$(addsuffix \n,$(all_sources))" - -echo: echo_sources - @echo -e "sources:\n $(addsuffix \n, $(sources))" - @echo -e "gen_sources:\n $(addsuffix \n, $(gen_sources))" - @echo -e "gen_objects:\n $(addsuffix \n, $(gen_objects))" - @echo -e "cc_objects:\n $(addsuffix \n, $(cc_objects))" - @echo -e "includes:\n $(addsuffix \n, $(includes))" - @echo -e "defines: $(addsuffix \n, $(defines))" - -clean: - rm -f $(outdir)/$(ATS)$(EXE) $(gen_objects) $(gen_sources) $(gen_headers) $(cc_objects) $(outdir)/.generate $(outdir)/../libItsAsn.so -# rm -f $(outdir)/asn1/*.so $(outdir)/asn1/*.o $(outdir)/asn1/*.c $(outdir)/asn1/*.h $(outdir)/asn1/Makefile.am.libasncodec - -regen: force_regen $(outdir)/.generate -force_regen: - rm -f $(outdir)/.generate - -t3q: all - @echo -e "Code checking in progress..." - @java -Xmx3g -Xss512m -jar $(T3Q_PATH)/t3q.jar --config $(T3Q_PATH)/$(T3Q_CONFIG) $(tt_sources) > $(outdir)/t3q.out 2>&1 ; cd - - @echo -e "Code checking in done..." - @echo -e "Output file is located here: $(outdir)/t3q.out" - -t3d: all - @echo -e "TTCN-3 doc generation in progress..." - @java -Xmx3g -Xss512m -jar $(T3D_PATH)/t3d.jar --config $(T3D_PATH)/$(T3D_CONFIG) $(tt_sources) > $(outdir)/t3d.out 2>&1 ; cd - - @echo -e "TTCN-3 doc generation done..." - @echo -e "Output file is located here: $(outdir)/t3d.out" - -$(outdir) $(bindir): - mkdir -p $@ - -$(bindir)/$(ATS)$(EXE): $(outdir)/../asn1/libItsAsn.a $(gen_objects) $(cc_objects) - g++ -g -O0 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(outdir)/../asn1/libItsAsn.a $(libs) - -$(gen_objects) :%.o :%.cc - g++ -g -O0 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< - -$(cc_objects) : $(outdir)/%.o : %.cc - mkdir -p $(dir $@) - g++ -g -O0 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< - -#$(gen_sources): -# $(TTCN3_DIR)/bin/compiler -n -e -L -R -U none -o $(outdir) $(tt_sources) - -$(gen_sources): $(outdir)/.generate - -$(outdir)/.generate: Makefile $(tt_sources) - $(TTCN3_DIR)/bin/compiler -w -d -e -f -g -l -L -R -U none -x -X -o $(outdir) $(tt_sources) - touch $@ - -$(bindir)/libItsAsn.so: $(outdir)/asn1/libItsAsn.so - cp -f $< $@ - -$(outdir)/../asn1/libItsAsn.a: FORCE - mkdir -p $(outdir)/../asn1 - $(MAKE) -C $(outdir)/../asn1 -f ../../asn1/Makefile - -$(foreach S, $(ttcn_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn, %.cc, $(S))): $(S))) -$(foreach S, $(ttcn3_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn3, %.cc, $(S))): $(S))) -$(foreach S, $(asn_sources), $(eval $(outdir)/$(notdir $(patsubst %.asn, %.cc, $(S))): $(S))) -$(foreach S, $(asn1_sources), $(eval $(outdir)/$(notdir $(patsubst %.asn1, %.cc, $(S))): $(S))) - +-include config.mk + +ifeq (,$(ATS)) + $(error ATS shall be defined) +endif + +ifeq (,$(TOPDIR)) + TOPDIR := . +endif + +ifeq (,$(TTCN3_DIR)) + $(error TTCN3_DIR shall be defined in config.mk) +endif + +export ASN1C_PATH + +first: all + +define IncludeModule +undefine sources +undefine modules +undefine includes +include $(1)/module.mk +$$(foreach S, $$(sources), $$(eval all_sources += $$(if $$(filter /%, $$(S)), $$(TOPDIR)/$$(S), $(1)/$$(S)))) +$$(foreach I, $$(includes), $$(eval all_includes += $$(if $$(filter /%, $$(I)), $$(TOPDIR)/$$(I), $(1)/$$(I)))) +$$(foreach M, $$(modules), $$(eval $$(call IncludeModule, $$(if $$(filter /%, $$(M)), $$(TOPDIR)/$$(M), $(1)/$$(M))))) +endef + +all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src $(TOPDIR)/ccsrc/Framework /usr/include/jsoncpp +defines += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS) +libs += $(TTCN3_DIR)/lib/libttcn3-rt2-parallel.a -lstdc++fs + +ifeq (Windows_NT,$(OS)) +# Silence linker warnings. +LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc +defines += WIN32 +libs += $(patsubst %, -L%/lib, $(OPENSSL_DIR)) +all_includes += $(addsuffix /include, $(OPENSSL_DIR)) +libs += $(WPCAP_DLL_PATH) +else +defines += LINUX +libs += -lpcap -lrt -lpthread +endif + +libs += -lssl -lcrypto -lxml2 -ljsoncpp + +$(eval $(call IncludeModule, $(TOPDIR)/ttcn/$(ATS))) + +outdir := $(TOPDIR)/build/$(ATS) +bindir := $(TOPDIR)/bin + +sources := $(sort $(all_sources)) +includes := $(outdir) $(outdir)/.. $(outdir)/../asn1 $(all_includes) $(NPCAP_INCLUDE) + +ifeq (Windows_NT,$(OS)) + EXE=.exe +endif + +ttcn_sources := $(filter %.ttcn , $(sources)) +ttcn3_sources := $(filter %.ttcn3, $(sources)) +asn_sources := $(filter %.asn, $(sources)) +asn1_sources := $(filter %.asn1, $(sources)) + +tt_sources := $(ttcn_sources) $(ttcn3_sources) $(asn_sources) $(asn1_sources) +cc_sources := $(filter %.cc, $(sources)) + +gen_ttcn_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn, %.cc, $(ttcn_sources)))) +gen_ttcn_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn, %.hh, $(ttcn_sources)))) +gen_ttcn3_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn3, %.cc, $(ttcn3_sources)))) +gen_ttcn3_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn3, %.hh, $(ttcn3_sources)))) +gen_asn_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn, %.cc, $(asn_sources)))) +gen_asn_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn, %.hh, $(asn_sources)))) +gen_asn1_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn1, %.cc, $(asn1_sources)))) +gen_asn1_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn1, %.hh, $(asn1_sources)))) + +gen_sources := $(gen_ttcn_sources) $(gen_ttcn3_sources) $(gen_asn_sources) $(gen_asn1_sources) +gen_headers := $(gen_ttcn_headers) $(gen_ttcn3_headers) $(gen_asn_headers) $(gen_asn1_headers) + +gen_objects := $(patsubst %.cc, %.o, $(gen_sources)) +cc_objects := $(patsubst %.cc, $(outdir)/%.o, $(cc_sources)) + +.PHONY: all FORCE echo + +all: $(bindir) $(outdir) $(bindir)/$(ATS)$(EXE) + +echo_sources: + @echo -e "$(addsuffix \n,$(all_sources))" + +echo: echo_sources + @echo -e "sources:\n $(addsuffix \n, $(sources))" + @echo -e "gen_sources:\n $(addsuffix \n, $(gen_sources))" + @echo -e "gen_objects:\n $(addsuffix \n, $(gen_objects))" + @echo -e "cc_objects:\n $(addsuffix \n, $(cc_objects))" + @echo -e "includes:\n $(addsuffix \n, $(includes))" + @echo -e "defines: $(addsuffix \n, $(defines))" + +clean: + rm -f $(outdir)/$(ATS)$(EXE) $(gen_objects) $(gen_sources) $(gen_headers) $(cc_objects) $(outdir)/.generate $(outdir)/../libItsAsn.so +# rm -f $(outdir)/asn1/*.so $(outdir)/asn1/*.o $(outdir)/asn1/*.c $(outdir)/asn1/*.h $(outdir)/asn1/Makefile.am.libasncodec + +regen: force_regen $(outdir)/.generate +force_regen: + rm -f $(outdir)/.generate + +t3q: all + @echo -e "Code checking in progress..." + @java -Xmx3g -Xss512m -jar $(T3Q_PATH)/t3q.jar --config $(T3Q_PATH)/$(T3Q_CONFIG) $(tt_sources) > $(outdir)/t3q.out 2>&1 ; cd - + @echo -e "Code checking in done..." + @echo -e "Output file is located here: $(outdir)/t3q.out" + +t3d: all + @echo -e "TTCN-3 doc generation in progress..." + @java -Xmx3g -Xss512m -jar $(T3D_PATH)/t3d.jar --config $(T3D_PATH)/$(T3D_CONFIG) $(tt_sources) > $(outdir)/t3d.out 2>&1 ; cd - + @echo -e "TTCN-3 doc generation done..." + @echo -e "Output file is located here: $(outdir)/t3d.out" + +$(outdir) $(bindir): + mkdir -p $@ + +$(bindir)/$(ATS)$(EXE): $(outdir)/../asn1/libItsAsn.a $(gen_objects) $(cc_objects) + g++ -g -O0 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(outdir)/../asn1/libItsAsn.a $(libs) + +$(gen_objects) :%.o :%.cc + g++ -g -O0 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< + +$(cc_objects) : $(outdir)/%.o : %.cc + mkdir -p $(dir $@) + g++ -g -O0 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< + +#$(gen_sources): +# $(TTCN3_DIR)/bin/compiler -n -e -L -R -U none -o $(outdir) $(tt_sources) + +$(gen_sources): $(outdir)/.generate + +$(outdir)/.generate: Makefile $(tt_sources) + $(TTCN3_DIR)/bin/compiler -w -d -e -f -g -l -L -R -U none -x -X -o $(outdir) $(tt_sources) + touch $@ + +$(bindir)/libItsAsn.so: $(outdir)/asn1/libItsAsn.so + cp -f $< $@ + +$(outdir)/../asn1/libItsAsn.a: FORCE + mkdir -p $(outdir)/../asn1 + $(MAKE) -C $(outdir)/../asn1 -f ../../asn1/Makefile + +$(foreach S, $(ttcn_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn, %.cc, $(S))): $(S))) +$(foreach S, $(ttcn3_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn3, %.cc, $(S))): $(S))) +$(foreach S, $(asn_sources), $(eval $(outdir)/$(notdir $(patsubst %.asn, %.cc, $(S))): $(S))) +$(foreach S, $(asn1_sources), $(eval $(outdir)/$(notdir $(patsubst %.asn1, %.cc, $(S))): $(S))) + diff --git a/data/certificates/Makefile b/data/certificates/Makefile index 4858194..1d6e7a8 100644 --- a/data/certificates/Makefile +++ b/data/certificates/Makefile @@ -1,48 +1,70 @@ -ifeq ($(ARCH),) - ARCH = $(shell gcc -dumpmachine) -else - ifeq ($(OS),Windows_NT) - ARCH=msvc - endif -endif - -outdir=certificates -in=profiles -xerdir=xer -depdir=temp -keydir=certificates - -ifeq ($(ARCH),msvc) - asn1certgen= ../../../itscertgen/build/msvc/x64/Debug/certgen.exe -else - asn1certgen=../../../itscertgen/build/$(ARCH)-d/certgen -endif - -xsl_cvt=../../../itscertgen/certgen/asn1certgen.xslt -xsl_dep=../../../itscertgen/certgen/prof2dep.xsl - -profiles=$(wildcard $(in)/*.xml) -certificates_oer=$(patsubst $(in)/%.xml, $(outdir)/%.oer, $(profiles)) -certificates_xer=$(patsubst $(in)/%.xml, $(xerdir)/%.xer, $(profiles)) -deps=$(patsubst $(in)/%.xml, $(depdir)/%.dep, $(profiles)) - -all: $(sort $(outdir) $(xerdir) $(depdir)) $(certificates_oer) - -$(sort $(outdir) $(xerdir) $(depdir)): - mkdir -p $@ -clean: - rm -f $(certificates_oer) $(certificates_xer) - -$(certificates_xer): $(xerdir)/%.xer : $(in)/%.xml - xsltproc $(xsl_cvt) $< | xmllint --format -o $@ - - -$(certificates_oer): $(outdir)/%.oer : $(xerdir)/%.xer - $(asn1certgen) -o $(outdir) -K $(keydir) $< - -$(deps): $(depdir)/%.dep : $(in)/%.xml - -mkdir -p $(depdir) - xsltproc --param profile "'$*'" -o $@ $(xsl_dep) $< - -$(certificates_xer) : $(xsl_cvt) - -include $(deps) +ifeq ($(ARCH),) + ARCH = $(shell gcc -dumpmachine) +else + ifeq ($(OS),Windows_NT) + ARCH=msvc + endif +endif + +ifeq (,$(CERTGEN)) + $(error CERTGEN variable shall point to the certgen project) +endif + +outdir=certificates +in=profiles +xerdir=xer +depdir=temp +keydir=certificates +iutdir=iut + +ifeq ($(ARCH),msvc) + asn1certgen= $(CERTGEN)/build/msvc/x64/Debug/certgen.exe +else + asn1certgen=$(CERTGEN)/build/$(ARCH)-d/certgen +endif + +xsl_cvt=$(CERTGEN)/itscertgen/certgen/asn1certgen.xslt +xsl_dep=$(CERTGEN)/itscertgen/certgen/prof2dep.xsl + +profiles=$(wildcard $(in)/*.xml) +certificates_oer=$(patsubst $(in)/%.xml, $(outdir)/%.oer, $(profiles)) +certificates_xer=$(patsubst $(in)/%.xml, $(xerdir)/%.xer, $(profiles)) +deps=$(patsubst $(in)/%.xml, $(depdir)/%.dep, $(profiles)) + +all: $(sort $(outdir) $(xerdir) $(depdir)) $(certificates_oer) + +$(sort $(outdir) $(xerdir) $(depdir) $(iutdir)): + mkdir -p $@ +clean: + rm -f $(certificates_oer) $(certificates_xer) + +$(certificates_xer): $(xerdir)/%.xer : $(in)/%.xml + xsltproc $(xsl_cvt) $< | xmllint --format -o $@ - + +$(certificates_oer): $(outdir)/%.oer : $(xerdir)/%.xer + $(asn1certgen) -o $(outdir) -K $(keydir) $< + +$(deps): $(depdir)/%.dep : $(in)/%.xml + -mkdir -p $(depdir) + xsltproc --param profile "'$*'" -o $@ $(xsl_dep) $< + +$(certificates_xer) : $(xsl_cvt) + +certs_iut_at = $(filter $(outdir)/CERT_IUT_%_AT.oer, $(certificates_oer)) +vkeys_iut_at = $(patsubst %.oer, %.vkey, $(certs_iut_at)) +ekeys_iut_at = $(patsubst %.oer, %.ekey, $(certs_iut_at)) + +certs_iut := $(filter $(outdir)/CERT_IUT_%_RCA.oer, $(certificates_oer)) +certs_iut += $(filter $(outdir)/CERT_IUT_%_AA.oer, $(certificates_oer)) +certs_iut += $(certs_iut_at) + +iut_files = $(patsubst $(outdir)/%, $(iutdir)/%, $(certs_iut) $(vkeys_iut_at) $(ekeys_iut_at)) + +install: $(iutdir) $(iut_files) + +$(iut_files): $(iutdir)/%: $(outdir)/% + -cp -f $@ $< + +$(vkeys_iut_at) $(ekeys_iut_at): + +include $(deps) diff --git a/data/certificates/profiles/CERT_TS_FA3_AA.xml b/data/certificates/profiles/CERT_TS_FA3_AA.xml new file mode 100644 index 0000000..deb8ec6 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_FA3_AA.xml @@ -0,0 +1,44 @@ + + + 3 + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + 01 32 + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_FA3_AT.xml b/data/certificates/profiles/CERT_TS_FA3_AT.xml new file mode 100644 index 0000000..8253bbd --- /dev/null +++ b/data/certificates/profiles/CERT_TS_FA3_AT.xml @@ -0,0 +1,36 @@ + + + 3 + + + + + + + + + + + + > + + + + + + + + + 01 FF FC + 01 FF FF FF + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_FA_AA.xml b/data/certificates/profiles/CERT_TS_FA_AA.xml new file mode 100644 index 0000000..cb1e4a6 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_FA_AA.xml @@ -0,0 +1,44 @@ + + + 3 + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + 01 32 + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_FA_AT.xml b/data/certificates/profiles/CERT_TS_FA_AT.xml new file mode 100644 index 0000000..1019947 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_FA_AT.xml @@ -0,0 +1,36 @@ + + + 3 + + + + + + + + + + + + > + + + + + + + + + 01 FF FC + 01 FF FF FF + + + + + + + + + + + -- GitLab From 67a6fc7376ef02f87a2016e65a8443dd30d9b26a Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Wed, 23 Feb 2022 21:00:39 +0100 Subject: [PATCH 003/178] do not assert on requestedCertificate reception --- ccsrc/Protocols/Security/security_services.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccsrc/Protocols/Security/security_services.cc b/ccsrc/Protocols/Security/security_services.cc index 48bae15..4137b15 100644 --- a/ccsrc/Protocols/Security/security_services.cc +++ b/ccsrc/Protocols/Security/security_services.cc @@ -219,7 +219,7 @@ int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::Si // Check requested certificate if (header_info.requestedCertificate().is_present()) { - loggers::get_instance().error("security_services::process_ieee_1609_dot2_signed_data: requestedCertificate not supported yet"); + // loggers::get_instance().error("security_services::process_ieee_1609_dot2_signed_data: requestedCertificate not supported yet"); // TODO Not supported by C-ITS Protocol } -- GitLab From 47ec69c4dfb4fe30ea12ac20f658e72ebdcb4e95 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Wed, 23 Feb 2022 21:11:19 +0100 Subject: [PATCH 004/178] Use new commits in AtsSecurity --- ttcn/AtsSecurity | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index ac50713..56ee2c5 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit ac5071354fd23fa0f1ce59ded50dd894dda2e58b +Subproject commit 56ee2c55d7581cf0bb09b6b4fc94e3b68bac1933 -- GitLab From e292ea882ce3fe101928ea2f2f559c5757351cae Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Thu, 24 Feb 2022 18:06:21 +0100 Subject: [PATCH 005/178] use warnings instead of errors in general sec message processing in adapter --- ccsrc/Protocols/Security/security_services.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ccsrc/Protocols/Security/security_services.cc b/ccsrc/Protocols/Security/security_services.cc index 4137b15..59aae19 100644 --- a/ccsrc/Protocols/Security/security_services.cc +++ b/ccsrc/Protocols/Security/security_services.cc @@ -189,19 +189,19 @@ int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::Si // Check p2pcdLearningRequest keys if present if (header_info.p2pcdLearningRequest().is_present()) { - loggers::get_instance().error("security_services::process_ieee_1609_dot2_signed_data: p2pcdLearningRequest not supported yet"); + loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: p2pcdLearningRequest not supported yet"); // TODO Not supported by C-ITS Protocol } // Check missingCrlIdentifier keys if present if (header_info.missingCrlIdentifier().is_present()) { - loggers::get_instance().error("security_services::process_ieee_1609_dot2_signed_data: missingCrlIdentifier not supported yet"); + loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: missingCrlIdentifier not supported yet"); // TODO Not supported by C-ITS Protocol } // Check encryption keys if present if (header_info.encryptionKey().is_present()) { - loggers::get_instance().error("security_services::process_ieee_1609_dot2_signed_data: encryptionKey not supported yet"); + loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: encryptionKey not supported yet"); // TODO Not supported by C-ITS Protocol } -- GitLab From 4a15be9caf21be07c92629d774c6b2c1625da2c2 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Thu, 24 Feb 2022 18:08:10 +0100 Subject: [PATCH 006/178] update AtsSecurity (TC-14) --- ttcn/AtsSecurity | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 56ee2c5..89984da 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 56ee2c55d7581cf0bb09b6b4fc94e3b68bac1933 +Subproject commit 89984da49953b00040777bdc69812ffa2447d12e -- GitLab From 9250b223a8845819c30ffbd50a501ea4211edc1e Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Fri, 25 Feb 2022 22:19:32 +0100 Subject: [PATCH 007/178] Security TC01-TC22 --- ttcn/AtsSecurity | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 89984da..64608ae 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 89984da49953b00040777bdc69812ffa2447d12e +Subproject commit 64608aea464a82d668d242be3d54ed8e58bd075f -- GitLab From 68a227663738568d8a45d4a321132dc24f41ddd9 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Mon, 28 Feb 2022 11:16:49 +0100 Subject: [PATCH 008/178] fix CERT_IUT_C1_AT.xml --- data/certificates/Makefile | 20 ++++++++++++++++++- data/certificates/profiles/CERT_IUT_C1_AT.xml | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/data/certificates/Makefile b/data/certificates/Makefile index 1d6e7a8..b85d5ed 100644 --- a/data/certificates/Makefile +++ b/data/certificates/Makefile @@ -63,8 +63,26 @@ iut_files = $(patsubst $(outdir)/%, $(iutdir)/%, $(certs_iut) $(vkeys_iut_at) $( install: $(iutdir) $(iut_files) $(iut_files): $(iutdir)/%: $(outdir)/% - -cp -f $@ $< + -cp -f $< $@ $(vkeys_iut_at) $(ekeys_iut_at): +IUT_TC23 = CERT_IUT_C1_AT.oer CERT_IUT_C1_AT.vkey CERT_IUT_C1_AT.ekey CERT_IUT_CC_AA.oer CERT_IUT_C_RCA.oer CERT_TS_A_AT.oer CERT_IUT_A_AA.oer +IUT_TC24 = CERT_IUT_CA3_AT.oer CERT_IUT_CA3_AT.vkey CERT_IUT_CA3_AT.ekey CERT_IUT_C3_AA.oer CERT_IUT_C_RCA.oer CERT_TS_A_AT.oer CERT_IUT_A_AA.oer +IUT_TC25 = CERT_IUT_A1_AT.oer CERT_IUT_A1_AT.vkey CERT_IUT_A1_AT.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer +IUT_TC26 = CERT_IUT_A2_AT.oer CERT_IUT_A2_AT.vkey CERT_IUT_A2_AT.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer +IUT_TC27 = CERT_IUT_A3_AT.oer CERT_IUT_A3_AT.vkey CERT_IUT_A3_AT.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer +IUT_TC28 = CERT_IUT_A_AT_A8.oer CERT_IUT_A_AT_A8.vkey CERT_IUT_A_AT_A8.ekey CERT_IUT_A_AA_A8.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_IUT_A_AA.oer + +IUT_TCS = TC23 TC24 TC25 TC26 TC27 TC28 + +define InstallTC +$(addprefix $(TC)/,$(IUT_$(TC))): $(TC)/% : $$(outdir)/% + mkdir -p $(TC) + -cp -f $$< $$@ +endef +$(foreach TC, $(IUT_TCS), $(eval $(InstallTC))) + +install_tc: $(foreach TC, $(IUT_TCS), $(addprefix $(TC)/, $(IUT_$(TC)))) + include $(deps) diff --git a/data/certificates/profiles/CERT_IUT_C1_AT.xml b/data/certificates/profiles/CERT_IUT_C1_AT.xml index b568a19..05061fa 100644 --- a/data/certificates/profiles/CERT_IUT_C1_AT.xml +++ b/data/certificates/profiles/CERT_IUT_C1_AT.xml @@ -27,10 +27,12 @@ + + -- GitLab From 31dbfbe8aa0f980f463552c4f6d982e9ac092803 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Fri, 4 Mar 2022 18:40:44 +0100 Subject: [PATCH 009/178] Add certificates for AA region test cases --- data/certificates/profiles/CERT_IUT_C2_AA.xml | 46 +++++++++++++++++++ data/certificates/profiles/CERT_IUT_C2_AT.xml | 35 ++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 data/certificates/profiles/CERT_IUT_C2_AA.xml create mode 100644 data/certificates/profiles/CERT_IUT_C2_AT.xml diff --git a/data/certificates/profiles/CERT_IUT_C2_AA.xml b/data/certificates/profiles/CERT_IUT_C2_AA.xml new file mode 100644 index 0000000..5a08a55 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_C2_AA.xml @@ -0,0 +1,46 @@ + + 3 + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + 01 32 + + + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_C2_AT.xml b/data/certificates/profiles/CERT_IUT_C2_AT.xml new file mode 100644 index 0000000..875e120 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_C2_AT.xml @@ -0,0 +1,35 @@ + + 3 + + + + + + + + + + + + > + + + + + + + + + 01 FF FC + 01 FF FF FF + + + + + + + + + + + -- GitLab From 77468498f120b7e15e4a5565b90124d3b42ebbbf Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Fri, 4 Mar 2022 18:43:22 +0100 Subject: [PATCH 010/178] Certificate generation rules --- .gitignore | 10 +++------- config.mk | 4 ++-- ttcn/AtsSecurity | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 80adcbd..b026989 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,6 @@ build bin config.mk -data/certificates/certificates -data/certificates/xer -data/certificates/iut -data/certificates/temp - - - +data/certificates/* +!data/certificates/profiles +!data/certificates/Makefile diff --git a/config.mk b/config.mk index a53d762..d6cfe15 100644 --- a/config.mk +++ b/config.mk @@ -1,5 +1,5 @@ -#TTCN3_DIR := /cygdrive/c/Tools/Titan -ASN1C_PATH := /home/yann/frameworks/asn1c.denis +#TTCN3_DIR := /cygdrive/c/Tools/Titan +#ASN1C_PATH := /home/yann/frameworks/asn1c.denis #WPCAP_DLL_PATH := /cygdrive/c/windows/system32/npcap/wpcap.dll #NPCAP_INCLUDE := /cygdrive/c/PROGRA~1/Npcap/sdk/include #T3Q_PATH=./tools/t3q-v2.0.0b30 diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 64608ae..84ba216 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 64608aea464a82d668d242be3d54ed8e58bd075f +Subproject commit 84ba2164d26a0c8f744efaf89db3f715de9484ac -- GitLab From 8c135c9a70b63cb1d9e8d8b8324c63883053fbc1 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Fri, 4 Mar 2022 18:45:13 +0100 Subject: [PATCH 011/178] certificate generation rules --- data/certificates/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/certificates/Makefile b/data/certificates/Makefile index b85d5ed..c5745c0 100644 --- a/data/certificates/Makefile +++ b/data/certificates/Makefile @@ -68,7 +68,7 @@ $(iut_files): $(iutdir)/%: $(outdir)/% $(vkeys_iut_at) $(ekeys_iut_at): IUT_TC23 = CERT_IUT_C1_AT.oer CERT_IUT_C1_AT.vkey CERT_IUT_C1_AT.ekey CERT_IUT_CC_AA.oer CERT_IUT_C_RCA.oer CERT_TS_A_AT.oer CERT_IUT_A_AA.oer -IUT_TC24 = CERT_IUT_CA3_AT.oer CERT_IUT_CA3_AT.vkey CERT_IUT_CA3_AT.ekey CERT_IUT_C3_AA.oer CERT_IUT_C_RCA.oer CERT_TS_A_AT.oer CERT_IUT_A_AA.oer +IUT_TC24 = CERT_IUT_C2_AT.oer CERT_IUT_C2_AT.vkey CERT_IUT_C2_AT.ekey CERT_IUT_C2_AA.oer CERT_IUT_C_RCA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_IUT_A_AA.oer IUT_TC25 = CERT_IUT_A1_AT.oer CERT_IUT_A1_AT.vkey CERT_IUT_A1_AT.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer IUT_TC26 = CERT_IUT_A2_AT.oer CERT_IUT_A2_AT.vkey CERT_IUT_A2_AT.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer IUT_TC27 = CERT_IUT_A3_AT.oer CERT_IUT_A3_AT.vkey CERT_IUT_A3_AT.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer -- GitLab From f33134339d2176fc5b74a02af4e6a200021e41f6 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Mon, 21 Mar 2022 17:49:36 +0100 Subject: [PATCH 012/178] fix CERT_REQ eeType --- data/certificates/profiles/CERT_TS_A_EA.xml | 4 +++- .../profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_01.xml | 4 +++- .../profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_02.xml | 4 +++- .../profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_03.xml | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/data/certificates/profiles/CERT_TS_A_EA.xml b/data/certificates/profiles/CERT_TS_A_EA.xml index 5a781e8..a284655 100644 --- a/data/certificates/profiles/CERT_TS_A_EA.xml +++ b/data/certificates/profiles/CERT_TS_A_EA.xml @@ -20,7 +20,7 @@ - + @@ -29,6 +29,8 @@ + + 01 C0 diff --git a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_01.xml b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_01.xml index 802585d..7e215b5 100644 --- a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_01.xml +++ b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_01.xml @@ -20,7 +20,7 @@ - + @@ -29,6 +29,8 @@ + + 01 C0 diff --git a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_02.xml b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_02.xml index 5a71c29..612b69a 100644 --- a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_02.xml +++ b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_02.xml @@ -20,7 +20,7 @@ - + @@ -29,6 +29,8 @@ + + 01 C0 diff --git a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_03.xml b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_03.xml index a165dd0..78e89b7 100644 --- a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_03.xml +++ b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_03.xml @@ -20,7 +20,7 @@ - + @@ -29,6 +29,8 @@ + + 01 40 -- GitLab From 048d29e5ce0955daa61b816ca71b84876c08d8a6 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Tue, 22 Mar 2022 10:25:29 +0100 Subject: [PATCH 013/178] fix CERT_REQ minChainLength in RCA --- data/certificates/profiles/CERT_IUT_A_RCA.xml | 2 +- data/certificates/profiles/CERT_IUT_C_RCA.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/certificates/profiles/CERT_IUT_A_RCA.xml b/data/certificates/profiles/CERT_IUT_A_RCA.xml index bbd4d05..b8865e7 100644 --- a/data/certificates/profiles/CERT_IUT_A_RCA.xml +++ b/data/certificates/profiles/CERT_IUT_A_RCA.xml @@ -30,7 +30,7 @@ - + 01 FE/FF 01 diff --git a/data/certificates/profiles/CERT_IUT_C_RCA.xml b/data/certificates/profiles/CERT_IUT_C_RCA.xml index d536970..e3c2c73 100644 --- a/data/certificates/profiles/CERT_IUT_C_RCA.xml +++ b/data/certificates/profiles/CERT_IUT_C_RCA.xml @@ -29,7 +29,7 @@ - + 01 FE/FF 01 -- GitLab From c26045bbfae8fef1c1e4005c56069441a98dc8fa Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Mon, 23 May 2022 12:17:11 +0200 Subject: [PATCH 014/178] fix certgen paths in Makefile --- data/certificates/Makefile | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/data/certificates/Makefile b/data/certificates/Makefile index c5745c0..eef7a91 100644 --- a/data/certificates/Makefile +++ b/data/certificates/Makefile @@ -1,8 +1,8 @@ ifeq ($(ARCH),) - ARCH = $(shell gcc -dumpmachine) -else ifeq ($(OS),Windows_NT) - ARCH=msvc + ARCH=MSVC-x64-Debug + else + ARCH = $(shell gcc -dumpmachine) endif endif @@ -17,14 +17,10 @@ depdir=temp keydir=certificates iutdir=iut -ifeq ($(ARCH),msvc) - asn1certgen= $(CERTGEN)/build/msvc/x64/Debug/certgen.exe -else - asn1certgen=$(CERTGEN)/build/$(ARCH)-d/certgen -endif +asn1certgen=$(CERTGEN)/build/$(ARCH)/certgen -xsl_cvt=$(CERTGEN)/itscertgen/certgen/asn1certgen.xslt -xsl_dep=$(CERTGEN)/itscertgen/certgen/prof2dep.xsl +xsl_cvt=$(CERTGEN)/certgen/asn1certgen.xslt +xsl_dep=$(CERTGEN)/certgen/prof2dep.xsl profiles=$(wildcard $(in)/*.xml) certificates_oer=$(patsubst $(in)/%.xml, $(outdir)/%.oer, $(profiles)) -- GitLab From 9f0047ec47f03bf615a9fc24b966181849bca8b9 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Wed, 1 Jun 2022 21:18:32 +0200 Subject: [PATCH 015/178] support for certidx --- data/certificates/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/data/certificates/Makefile b/data/certificates/Makefile index eef7a91..16b831b 100644 --- a/data/certificates/Makefile +++ b/data/certificates/Makefile @@ -18,6 +18,7 @@ keydir=certificates iutdir=iut asn1certgen=$(CERTGEN)/build/$(ARCH)/certgen +asn1certidx=$(CERTGEN)/build/$(ARCH)/certidx -c xsl_cvt=$(CERTGEN)/certgen/asn1certgen.xslt xsl_dep=$(CERTGEN)/certgen/prof2dep.xsl @@ -27,7 +28,7 @@ certificates_oer=$(patsubst $(in)/%.xml, $(outdir)/%.oer, $(profiles)) certificates_xer=$(patsubst $(in)/%.xml, $(xerdir)/%.xer, $(profiles)) deps=$(patsubst $(in)/%.xml, $(depdir)/%.dep, $(profiles)) -all: $(sort $(outdir) $(xerdir) $(depdir)) $(certificates_oer) +all: $(sort $(outdir) $(xerdir) $(depdir)) $(outdir)/index.lst $(sort $(outdir) $(xerdir) $(depdir) $(iutdir)): mkdir -p $@ @@ -37,6 +38,9 @@ clean: $(certificates_xer): $(xerdir)/%.xer : $(in)/%.xml xsltproc $(xsl_cvt) $< | xmllint --format -o $@ - +$(outdir)/index.lst: $(certificates_oer) + $(asn1certidx) -o $@ $^ + $(certificates_oer): $(outdir)/%.oer : $(xerdir)/%.xer $(asn1certgen) -o $(outdir) -K $(keydir) $< -- GitLab From 7fa0ba3d2df7a5e441e2ce12870f6884ceba3d54 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Fri, 17 Jun 2022 13:23:01 +0200 Subject: [PATCH 016/178] sync actual test suites versions in modules --- ttcn/AtsCAM | 2 +- ttcn/AtsDENM | 2 +- ttcn/AtsIPv6OverGeoNetworking | 2 +- ttcn/AtsIS | 2 +- ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- ttcn/LibIts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 4fcb322..8dfd505 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 4fcb322a3f486cf77559290eac59a4cd709f1363 +Subproject commit 8dfd505f959fe6132e209c5433cbf4afd19d56ba diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index 286ded8..bd47e3e 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit 286ded8ff00f6a239cf1480f78c690e4157d8b44 +Subproject commit bd47e3e45bf3787d8ec3d1e5554c6952d5f86ba7 diff --git a/ttcn/AtsIPv6OverGeoNetworking b/ttcn/AtsIPv6OverGeoNetworking index 066a09a..d809854 160000 --- a/ttcn/AtsIPv6OverGeoNetworking +++ b/ttcn/AtsIPv6OverGeoNetworking @@ -1 +1 @@ -Subproject commit 066a09ac1f915e76eb628d1501755196ec39ff47 +Subproject commit d809854002df6eb2ebb5cb120a51e11ee6277c25 diff --git a/ttcn/AtsIS b/ttcn/AtsIS index b4ae053..8110f6c 160000 --- a/ttcn/AtsIS +++ b/ttcn/AtsIS @@ -1 +1 @@ -Subproject commit b4ae0532b5c48abaf5c02686bcbf157bee130a41 +Subproject commit 8110f6c72909313ab017fe72f7fa23130f77f3be diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 63d369f..ba3b34d 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 63d369f5077c4a49d7f51dddff2e88d0af8722cd +Subproject commit ba3b34d02b0307ee7419053eb79f13dae07cf530 diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 84ba216..7dc348f 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 84ba2164d26a0c8f744efaf89db3f715de9484ac +Subproject commit 7dc348f631c1ce89adf120fb2925fe5810463305 diff --git a/ttcn/LibIts b/ttcn/LibIts index bf54862..9ce6990 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit bf548622aec06cafeb5615f4750d5ef980a118bf +Subproject commit 9ce699037696f6d088db00279cced8ac2a14845c -- GitLab From bd0920b7b212b970782c56ed78900a5b457088fa Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Fri, 17 Jun 2022 13:49:07 +0200 Subject: [PATCH 017/178] sync with BTP module --- ttcn/AtsBTP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ttcn/AtsBTP b/ttcn/AtsBTP index 8fb9b43..0a29c30 160000 --- a/ttcn/AtsBTP +++ b/ttcn/AtsBTP @@ -1 +1 @@ -Subproject commit 8fb9b439d6f4f84598a4f4ce52f6e420cf111832 +Subproject commit 0a29c3037d0554893bc23de26cb792f94376acfe -- GitLab From ddaab7bb5de23f79a3f9c2c6f37e2f81c177f6c7 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Mon, 20 Jun 2022 07:55:00 +0200 Subject: [PATCH 018/178] Replace command line argument -c into -n to generate index.lst --- .../Protocols/Security/certificates_loader.cc | 14 ++++++- ccsrc/Protocols/Security/security_cache.cc | 40 +++++++++++++++++++ ccsrc/Protocols/Security/security_db.cc | 1 + config.mk | 8 ++-- data/certificates/Makefile | 2 +- ttcn/AtsCAM | 2 +- ttcn/LibIts | 2 +- 7 files changed, 61 insertions(+), 8 deletions(-) diff --git a/ccsrc/Protocols/Security/certificates_loader.cc b/ccsrc/Protocols/Security/certificates_loader.cc index 8e237bf..cb2f0fd 100644 --- a/ccsrc/Protocols/Security/certificates_loader.cc +++ b/ccsrc/Protocols/Security/certificates_loader.cc @@ -62,6 +62,18 @@ int certificates_loader::load_certificates(std::map files; if (retrieve_certificates_list(files) == -1) { @@ -70,7 +82,7 @@ int certificates_loader::load_certificates(std::map v(static_cast(p_hashed_id8), p_hashed_id8.lengthof() + static_cast(p_hashed_id8)); // std::map, std::string>::const_iterator it = _hashed_id8s.find(v); if (it == _hashed_id8s.cend()) { + // TODO try to load the certificate from the disk + /*if (certificates_loader::get_instance().load_certificate(p_hashed_id8, _certificates, _hashed_id8s) == -1) { + loggers::get_instance().warning("security_cache::get_certificate: record not found"); + dump(); + p_certificate_id = ""; + return -1; + } else { + it = _hashed_id8s.find(p_hashed_id8); + }*/ + loggers::get_instance().warning("security_cache::get_certificate: record not found"); dump(); p_certificate_id = ""; return -1; } + p_certificate_id = it->second; return 0; @@ -78,6 +89,15 @@ int security_cache::get_certificate(const std::string &p_certificate_id, OCTETST std::map>::const_iterator it = _certificates.find(p_certificate_id); if (it == _certificates.cend()) { + // TODO try to load the certificate from the disk + /*if (certificates_loader::get_instance().load_certificate(it->second(), _certificates, _hashed_id8s) == -1) { + loggers::get_instance().warning("security_cache::get_certificate: record not found"); + dump(); + p_certificate_id = ""; + return -1; + } else { + it = _hashed_id8s.find(it->second()); + }*/ loggers::get_instance().warning("security_cache::get_certificate: record not found"); dump(); return -1; @@ -92,7 +112,17 @@ int security_cache::get_certificate(const std::string &p_certificate_id, Ieee160 std::map>::const_iterator it = _certificates.find(p_certificate_id); if (it == _certificates.cend()) { + // TODO try to load the certificate from the disk + /*if (certificates_loader::get_instance().load_certificate(it->second(), _certificates, _hashed_id8s) == -1) { + loggers::get_instance().warning("security_cache::get_certificate: record not found"); + dump(); + p_certificate_id = ""; + return -1; + } else { + it = _hashed_id8s.find(it->second()); + }*/ loggers::get_instance().warning("security_cache::get_certificate: record not found"); + dump(); return -1; } p_certificate = it->second.get()->decoded_certificate(); @@ -121,7 +151,17 @@ int security_cache::get_certificate(const OCTETSTRING &p_hashed_id3, Ieee1609Dot );*/ std::map>::const_iterator it = _certificates.find(s->second); if (it == _certificates.cend()) { + // TODO try to load the certificate from the disk + /*if (certificates_loader::get_instance().load_certificate(p_hashed_id8, _certificates, _hashed_id8s) == -1) { + loggers::get_instance().warning("security_cache::get_certificate: record not found"); + dump(); + p_certificate_id = ""; + return -1; + } else { + it = _certificates.find(s->first); + }*/ loggers::get_instance().warning("security_cache::get_certificate: record not found"); + dump(); return -1; } p_certificate = it->second.get()->decoded_certificate(); diff --git a/ccsrc/Protocols/Security/security_db.cc b/ccsrc/Protocols/Security/security_db.cc index 36af16c..13495a4 100644 --- a/ccsrc/Protocols/Security/security_db.cc +++ b/ccsrc/Protocols/Security/security_db.cc @@ -30,6 +30,7 @@ int security_db::load_from_files(const std::string &p_db_path) { return -1; } + // TODO Build the maps of couple {HasehedId8, Certificate} if (certificates_loader::get_instance().load_certificates(_certificates, _hashed_id8s) == -1) { loggers::get_instance().log(">>> security_db::load_from_files: certificates_loader::load_certificates method failed"); return -1; diff --git a/config.mk b/config.mk index e174d0f..c6a59a3 100644 --- a/config.mk +++ b/config.mk @@ -1,7 +1,7 @@ -TTCN3_DIR := /cygdrive/c/Tools/Titan -ASN1C_PATH := ../../../../../asn1c-fillabs -WPCAP_DLL_PATH := /cygdrive/c/windows/system32/npcap/wpcap.dll -NPCAP_INCLUDE := /cygdrive/c/PROGRA~1/Npcap/sdk/include +TTCN3_DIR := $(HOME)/frameworks/titan/titan.core/Install +ASN1C_PATH := $(HOME)/frameworks/asn1c.denis +#WPCAP_DLL_PATH := /cygdrive/c/windows/system32/npcap/wpcap.dll +#NPCAP_INCLUDE := /cygdrive/c/PROGRA~1/Npcap/sdk/include #T3Q_PATH=./tools/t3q-v2.0.0b30 #T3Q_CONFIG=t3q.cfg #T3D_PATH=./tools/t3d-v2.0.0b30 diff --git a/data/certificates/Makefile b/data/certificates/Makefile index 16b831b..de6191b 100644 --- a/data/certificates/Makefile +++ b/data/certificates/Makefile @@ -18,7 +18,7 @@ keydir=certificates iutdir=iut asn1certgen=$(CERTGEN)/build/$(ARCH)/certgen -asn1certidx=$(CERTGEN)/build/$(ARCH)/certidx -c +asn1certidx=$(CERTGEN)/build/$(ARCH)/certidx -n xsl_cvt=$(CERTGEN)/certgen/asn1certgen.xslt xsl_dep=$(CERTGEN)/certgen/prof2dep.xsl diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 8dfd505..4fcb322 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 8dfd505f959fe6132e209c5433cbf4afd19d56ba +Subproject commit 4fcb322a3f486cf77559290eac59a4cd709f1363 diff --git a/ttcn/LibIts b/ttcn/LibIts index 9ce6990..d431152 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit 9ce699037696f6d088db00279cced8ac2a14845c +Subproject commit d4311521a528842673b0b0c0404cfe38649f16ed -- GitLab From 929120f98b4fee098c017c40388aaa81c6682902 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Wed, 22 Jun 2022 10:49:11 +0200 Subject: [PATCH 019/178] Fixed bug issue #11 (https://forge.etsi.org/rep/ITS/TS.ITS/-/issues/11) and bug issue #6 (https://forge.etsi.org/rep/ITS/TS.ITS/-/issues/6) --- .../Protocols/Security/certificates_loader.cc | 459 ++++++++---------- .../Protocols/Security/certificates_loader.hh | 49 +- ccsrc/Protocols/Security/security_cache.cc | 270 +++++------ ccsrc/Protocols/Security/security_cache.hh | 158 +++++- ccsrc/Protocols/Security/security_db.cc | 15 +- ccsrc/Protocols/Security/security_db.hh | 4 +- data/certificates/Makefile | 5 +- etc/AtsCAM/AtsCAM.cfg | 4 +- scripts/run_tshark.bash | 11 - .../docker/home/etc/init.d/45-certgen.sh | 1 + .../docker/home/etc/init.d/50-ats.sh | 5 +- virtualization/vagrant/provisioner.bash | 1 + 12 files changed, 529 insertions(+), 453 deletions(-) delete mode 100755 scripts/run_tshark.bash diff --git a/ccsrc/Protocols/Security/certificates_loader.cc b/ccsrc/Protocols/Security/certificates_loader.cc index cb2f0fd..4ee8fe3 100644 --- a/ccsrc/Protocols/Security/certificates_loader.cc +++ b/ccsrc/Protocols/Security/certificates_loader.cc @@ -53,300 +53,231 @@ int certificates_loader::build_path(const std::string &p_root_directory) { return 0; } // End of method build_path -int certificates_loader::load_certificates(std::map> & p_certificates, - std::map*/, std::string, security_cache_comp> &p_hashed_id8s) { - // loggers::get_instance().log(">>> certificates_loader::load_certificates"); +int certificates_loader::build_certificates_index(std::map &p_certificates_idx, std::map &p_hashed_id8s) { + loggers::get_instance().log(">>> certificates_loader::build_certificates_index"); // Sanity check if (_is_cache_initialized) { return 0; } - // TODO Build the maps of couple {HasehedId8, Certificate} - /*if (build_certificates_index() == -1) { - loggers::get_instance().warning("certificates_loader::build_certificates_index: Failed to build the list of certificate files"); - return -1; - }*/ - // TODO Initialize the cache mechanism - /*if (initialize_certificates_cache(files, p_certificates, p_hashed_id8s) == -1) { - loggers::get_instance().warning("certificates_loader::initialize_certificates_cache: Failed to build the certificate cache"); - return -1; - }*/ - // No certificate will be loded here - - // Retrieve the list of the files in the path - std::set files; - if (retrieve_certificates_list(files) == -1) { - loggers::get_instance().warning("certificates_loader::load_certificates: Failed to build the list of certificate files"); - return -1; - } - // Build the certificates cache - if (build_certificates_cache(files, p_certificates, p_hashed_id8s) == -1) { - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Failed to build the certificate cache"); + // Load index file + std::experimental::filesystem::path p = _full_path.string() + "/index.lst"; + loggers::get_instance().log("certificates_loader::build_certificates_index: Caching certificate '%s'", p.string().c_str()); + std::ifstream is(p, ios::in); + if (!is.is_open()) { + loggers::get_instance().warning("certificates_loader::build_certificates_index: Failed to open index file"); return -1; } + std::string hashed_id8, certificate; + while (is >> hashed_id8 >> certificate) { // Process lines + //loggers::get_instance().log("certificates_loader::build_certificates_index: Processing '%s - %s'", hashed_id8.c_str(), certificate.c_str()); + // Convert HashedId8 into oectet string_to_into + OCTETSTRING h = str2oct(CHARSTRING(static_cast(hashed_id8.c_str()))); + // Remove extension file + p = certificate; + certificate = p.stem(); + // Update index maps + std::pair::iterator, bool> result = p_certificates_idx.insert(std::pair(certificate, h)); + if (result.second == false) { + loggers::get_instance().warning("certificates_loader::build_certificates_index: Failed to insert new record '%s'", certificate.c_str()); + continue; + } + p_hashed_id8s.insert(std::pair(h, certificate)); + } // End of 'while' statement + is.close(); _is_cache_initialized = true; return 0; -} // End of method load_certificates - -int certificates_loader::retrieve_certificates_list(std::set &p_files) { - // loggers::get_instance().log(">>> certificates_loader::retrieve_certificates_list"); - - // Walk through directories - std::set folders; - for (const std::experimental::filesystem::directory_entry it : std::experimental::filesystem::recursive_directory_iterator(_full_path.string())) { - // loggers::get_instance().log("certificates_loader::retrieve_certificates_list: Processing directory '%s'", it.path().string().c_str()); - if (std::experimental::filesystem::is_directory(it)) { - std::set::const_iterator i = _directory_filter.find(it.path().filename()); - if (i != _directory_filter.cend()) { - // loggers::get_instance().log("certificates_loader::retrieve_certificates_list: Exclude directory '%s'", it.path().string().c_str()); - continue; - } - // loggers::get_instance().log("certificates_loader::retrieve_certificates_list: Add directory '%s'", it.path().string().c_str()); - folders.insert(it.path()); - } - } // End of 'for' statement - - if (folders.size() == 0) { - loggers::get_instance().warning("certificates_loader::retrieve_certificates_list: No folder after filtering"); - folders.insert(_full_path); - } - // Process files - p_files.clear(); - for (std::set::const_reverse_iterator f = folders.crbegin(); f != folders.crend(); ++f) { - // loggers::get_instance().log("certificates_loader::retrieve_certificates_list: Processing directory '%s'", f->string().c_str()); - for (const std::experimental::filesystem::directory_entry it : std::experimental::filesystem::recursive_directory_iterator(*f)) { - // loggers::get_instance().log("certificates_loader::retrieve_certificates_list: Processing file '%s'", it.path().filename().string().c_str()); - if (std::experimental::filesystem::is_regular_file(it)) { - // loggers::get_instance().log("certificates_loader::retrieve_certificates_list: Check extension '%s'", it.path().extension().string().c_str()); - if (it.path().extension().string().compare(_certificateExt) == 0) { - // loggers::get_instance().log("certificates_loader::retrieve_certificates_list: Add file '%s'", it.path().filename().string().c_str()); - p_files.insert(it); - } - } - } // End of 'for' statement - } // End of 'for' statement - // loggers::get_instance().log("certificates_loader::retrieve_certificates_list: # of files to cache: %d", p_files.size()); - if (p_files.size() == 0) { - loggers::get_instance().warning("certificates_loader::retrieve_certificates_list: No certificate found"); +} // End of method build_certificates_index + +int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const std::string p_certificate_name, std::map> & p_certificates) { + loggers::get_instance().log_msg(">>> certificates_loader::load_certificate", p_hashed_id8); + loggers::get_instance().log(">>> certificates_loader::load_certificate: %s", p_certificate_name.c_str()); + + std::experimental::filesystem::path p = _full_path.string() + "/" + p_certificate_name + _certificateExt; + const std::string& key = p.stem(); + loggers::get_instance().log("certificates_loader::load_certificate: Caching certificate '%s'", p.string().c_str()); + std::ifstream is(p.string().c_str(), ios::in | ios::binary); + if (!is.is_open()) { + loggers::get_instance().warning("certificates_loader::load_certificate: Failed to open certificate file"); return -1; } - - return 0; -} // End of method retrieve_certificates_list - -int certificates_loader::build_certificates_cache(std::set & p_files, - std::map> & p_certificates, - std::map*/, std::string, security_cache_comp> &p_hashed_id8s) { - // loggers::get_instance().log(">>> certificates_loader::build_certificates_cache"); - - std::set::const_iterator it = p_files.cbegin(); - std::pair>::iterator, bool> result; - do { - loggers::get_instance().log("certificates_loader::build_certificates_cache: Caching '%s'", it->string().c_str()); - std::experimental::filesystem::path p = *it; - const std::string & key = p.stem(); - // loggers::get_instance().log("certificates_loader::build_certificates_cache: Key = '%s'", key.c_str()); - - // Load certificate file - it = p_files.find(p.replace_extension(_certificateExt)); - if (it == p_files.cend()) { - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Certificate file not found for '%s'", key.c_str()); + OCTETSTRING certificate = int2oct(0, std::experimental::filesystem::file_size(p)); + is.read((char *)static_cast(certificate), certificate.lengthof()); + is.close(); + + // Load private key file + OCTETSTRING private_key; + p = p.replace_extension(_privateKeyExt); + // loggers::get_instance().log("certificates_loader::build_certificates_cache: Caching private keys '%s'", p.string().c_str()); + is.open(p, ios::in | ios::binary); + if (!is.is_open()) { + loggers::get_instance().warning("certificates_loader::build_certificates_cache: Failed to open Private key"); + private_key = OCTETSTRING(0, nullptr); + } else { + int size = std::experimental::filesystem::file_size(p); + if ((size != 32) && (size != 48)) { + loggers::get_instance().warning("certificates_loader::build_certificates_cache: Private key size is incorrect for '%s'", key.c_str()); return -1; } - // loggers::get_instance().log("certificates_loader::build_certificates_cache: Caching certificate '%s'", it->string().c_str()); - std::ifstream is(it->string(), ios::in | ios::binary); - if (!is.is_open()) { - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Failed to open certificate file"); + private_key = int2oct(0, size); + is.read((char *)static_cast(private_key), private_key.lengthof()); + is.close(); + } + + // Load private encryption key file if present + OCTETSTRING private_enc_key; + p = p.replace_extension(_privateEncKeyExt); + // loggers::get_instance().log("certificates_loader::build_certificates_cache: Caching private encryption key '%s'", p.string().c_str()); + is.open(p, ios::in | ios::binary); + if (!is.is_open()) { + loggers::get_instance().warning("certificates_loader::build_certificates_cache: Failed to open Private encryption key file"); + private_enc_key = OCTETSTRING(0, nullptr); + } else { + int size = std::experimental::filesystem::file_size(p); + if (size != 32) { // IEEE Std 1609.2 2017: NistP256 or BrainpoolP256r1 + loggers::get_instance().warning("certificates_loader::build_certificates_cache: Private encryption key size is incorrect for '%s'", key.c_str()); return -1; } - OCTETSTRING certificate = int2oct(0, std::experimental::filesystem::file_size(*it)); - is.read((char *)static_cast(certificate), certificate.lengthof()); + private_enc_key = int2oct(0, size); + is.read((char *)static_cast(private_enc_key), private_enc_key.lengthof()); is.close(); - // Remove items from the list - p_files.erase(it); - - // Load private key file - OCTETSTRING private_key; - p = p.replace_extension(_privateKeyExt); - // loggers::get_instance().log("certificates_loader::build_certificates_cache: Caching private keys '%s'", p.string().c_str()); - is.open(p, ios::in | ios::binary); - if (!is.is_open()) { - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Failed to open Private key"); - private_key = OCTETSTRING(0, nullptr); - } else { - int size = std::experimental::filesystem::file_size(p); - if ((size != 32) && (size != 48)) { - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Private key size is incorrect for '%s'", key.c_str()); - return -1; - } - private_key = int2oct(0, size); - is.read((char *)static_cast(private_key), private_key.lengthof()); - is.close(); - } + } - // Load private encryption key file if present - OCTETSTRING private_enc_key; - p = p.replace_extension(_privateEncKeyExt); - // loggers::get_instance().log("certificates_loader::build_certificates_cache: Caching private encryption key '%s'", p.string().c_str()); - is.open(p, ios::in | ios::binary); - if (!is.is_open()) { - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Failed to open Private encryption key file"); - private_enc_key = OCTETSTRING(0, nullptr); - } else { - int size = std::experimental::filesystem::file_size(p); - if (size != 32) { // IEEE Std 1609.2 2017: NistP256 or BrainpoolP256r1 - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Private encryption key size is incorrect for '%s'", key.c_str()); - return -1; + std::pair>::iterator, bool> result; + // Build DB record + etsi_ts103097_certificate_codec codec; + Ieee1609Dot2::CertificateBase decoded_certificate; + codec.decode(certificate, decoded_certificate); + if (!decoded_certificate.is_value()) { + loggers::get_instance().warning("certificates_loader::build_certificates_cache: Failed to decode certificate for '%s'", key.c_str()); + return -1; + } else { + // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Decoded certificate: ", decoded_certificate); + // Prepare all fields + if (!decoded_certificate.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_verificationKey)) { + loggers::get_instance().warning("certificates_loader::build_certificates_cache: Wrong VerificationKeyIndicator variant for '%s'", key.c_str()); + return -1; + } + OCTETSTRING public_key_x; + OCTETSTRING public_key_y; + OCTETSTRING public_comp_key; // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) + Ieee1609Dot2BaseTypes::PublicVerificationKey &b = decoded_certificate.toBeSigned().verifyKeyIndicator().verificationKey(); + if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP256)) { + Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaNistP256(); + fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, public_comp_key, public_key_x, public_key_y); + } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP384)) { + Ieee1609Dot2BaseTypes::EccP384CurvePoint &p = b.ecdsaNistP384(); + fill_public_key_vectors(ec_elliptic_curves::nist_p_384, p, public_comp_key, public_key_x, public_key_y); + } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP256r1)) { + Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaBrainpoolP256r1(); + fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, public_comp_key, public_key_x, public_key_y); + } else { // ALT_ecdsaBrainpoolP384r1 + Ieee1609Dot2BaseTypes::EccP384CurvePoint &p = b.ecdsaBrainpoolP384r1(); + fill_public_key_vectors(ec_elliptic_curves::brainpool_p_384_r1, p, public_comp_key, public_key_x, public_key_y); + } + // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_key_x: ", public_key_x); + // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_key_y: ", public_key_y); + // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_comp_key: ", public_comp_key); + + OCTETSTRING public_enc_key_x; + OCTETSTRING public_enc_key_y; + OCTETSTRING public_enc_comp_key; + if (decoded_certificate.toBeSigned().encryptionKey().ispresent()) { + Ieee1609Dot2BaseTypes::PublicEncryptionKey &v = + static_cast(decoded_certificate.toBeSigned().encryptionKey()); + Ieee1609Dot2BaseTypes::BasePublicEncryptionKey &b = v.publicKey(); + if (b.ischosen(Ieee1609Dot2BaseTypes::BasePublicEncryptionKey::ALT_eciesNistP256)) { + Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = v.publicKey().eciesNistP256(); + fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, public_enc_comp_key, public_enc_key_x, public_enc_key_y); + } else if (b.ischosen(Ieee1609Dot2BaseTypes::BasePublicEncryptionKey::ALT_eciesBrainpoolP256r1)) { + Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = v.publicKey().eciesBrainpoolP256r1(); + fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, public_enc_comp_key, public_enc_key_x, public_enc_key_y); } - private_enc_key = int2oct(0, size); - is.read((char *)static_cast(private_enc_key), private_enc_key.lengthof()); - is.close(); + // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_enc_key_x: ", public_enc_key_x); + // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_enc_key_y: ", public_enc_key_y); + // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_enc_comp_key: ", public_enc_comp_key); + } else { + public_enc_key_x = OCTETSTRING(0, nullptr); + public_enc_key_y = OCTETSTRING(0, nullptr); + public_enc_comp_key = OCTETSTRING(0, nullptr); } - // Build DB record - etsi_ts103097_certificate_codec codec; - Ieee1609Dot2::CertificateBase decoded_certificate; - codec.decode(certificate, decoded_certificate); - if (!decoded_certificate.is_value()) { - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Failed to decode certificate for '%s'", key.c_str()); - return -1; + OCTETSTRING hash_sha_256; // Whole-certificate hash using SHA-256 + sha256 sha; + sha.generate(certificate, hash_sha_256); + loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Whole-certificate SHA-256 hash for encryption: ", hash_sha_256); + + OCTETSTRING hash; // Whole-certificate hash + OCTETSTRING hashed_id; // Whole-certificate hashedid-8 + OCTETSTRING issuer; // Certificate issuer + if (public_key_x.lengthof() == 32) { // See IEEE Std 1609.2a-2017 Clause 6.4.3 CertificateBase + hash = hash_sha_256; + loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Whole-certificate SHA-256 hash: ", hash); + hashed_id = OCTETSTRING(8, static_cast(hash) + hash.lengthof() - 8); + } else if (public_key_x.lengthof() == 48) { + sha384 sha; + sha.generate(certificate, hash); + loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Whole-certificate SHA-384 hash: ", hash); + hashed_id = OCTETSTRING(8, static_cast(hash) + hash.lengthof() - 8); } else { - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Decoded certificate: ", decoded_certificate); - // Prepare all fields - if (!decoded_certificate.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_verificationKey)) { - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Wrong VerificationKeyIndicator variant for '%s'", key.c_str()); - return -1; - } - OCTETSTRING public_key_x; - OCTETSTRING public_key_y; - OCTETSTRING public_comp_key; // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) - Ieee1609Dot2BaseTypes::PublicVerificationKey &b = decoded_certificate.toBeSigned().verifyKeyIndicator().verificationKey(); - if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP256)) { - Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaNistP256(); - fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, public_comp_key, public_key_x, public_key_y); - } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP384)) { - Ieee1609Dot2BaseTypes::EccP384CurvePoint &p = b.ecdsaNistP384(); - fill_public_key_vectors(ec_elliptic_curves::nist_p_384, p, public_comp_key, public_key_x, public_key_y); - } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP256r1)) { - Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaBrainpoolP256r1(); - fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, public_comp_key, public_key_x, public_key_y); - } else { // ALT_ecdsaBrainpoolP384r1 - Ieee1609Dot2BaseTypes::EccP384CurvePoint &p = b.ecdsaBrainpoolP384r1(); - fill_public_key_vectors(ec_elliptic_curves::brainpool_p_384_r1, p, public_comp_key, public_key_x, public_key_y); - } - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_key_x: ", public_key_x); - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_key_y: ", public_key_y); - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_comp_key: ", public_comp_key); - - OCTETSTRING public_enc_key_x; - OCTETSTRING public_enc_key_y; - OCTETSTRING public_enc_comp_key; - if (decoded_certificate.toBeSigned().encryptionKey().ispresent()) { - Ieee1609Dot2BaseTypes::PublicEncryptionKey &v = - static_cast(decoded_certificate.toBeSigned().encryptionKey()); - Ieee1609Dot2BaseTypes::BasePublicEncryptionKey &b = v.publicKey(); - if (b.ischosen(Ieee1609Dot2BaseTypes::BasePublicEncryptionKey::ALT_eciesNistP256)) { - Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = v.publicKey().eciesNistP256(); - fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, public_enc_comp_key, public_enc_key_x, public_enc_key_y); - } else if (b.ischosen(Ieee1609Dot2BaseTypes::BasePublicEncryptionKey::ALT_eciesBrainpoolP256r1)) { - Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = v.publicKey().eciesBrainpoolP256r1(); - fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, public_enc_comp_key, public_enc_key_x, public_enc_key_y); - } - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_enc_key_x: ", public_enc_key_x); - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_enc_key_y: ", public_enc_key_y); - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_enc_comp_key: ", public_enc_comp_key); + hash = OCTETSTRING(0, nullptr); + hash_sha_256 = OCTETSTRING(0, nullptr); + hashed_id = int2oct(0, 8); + } + loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: hash: ", hash); + loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: hashed_id: ", hashed_id); + + if (decoded_certificate.issuer().ischosen(Ieee1609Dot2::IssuerIdentifier::ALT_sha256AndDigest)) { + issuer = decoded_certificate.issuer().sha256AndDigest(); + } else if (decoded_certificate.issuer().ischosen(Ieee1609Dot2::IssuerIdentifier::ALT_sha384AndDigest)) { + issuer = decoded_certificate.issuer().sha384AndDigest(); + } else if (decoded_certificate.issuer().ischosen(Ieee1609Dot2::IssuerIdentifier::ALT_self__)) { + OCTETSTRING h; + if (decoded_certificate.issuer().self__() == Ieee1609Dot2BaseTypes::HashAlgorithm::sha256) { + sha256 sha; + sha.generate(certificate, h); + // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Whole-certificate SHA-256 hash: ", hash); } else { - public_enc_key_x = OCTETSTRING(0, nullptr); - public_enc_key_y = OCTETSTRING(0, nullptr); - public_enc_comp_key = OCTETSTRING(0, nullptr); - } - - OCTETSTRING hash_sha_256; // Whole-certificate hash using SHA-256 - sha256 sha; - sha.generate(certificate, hash_sha_256); - loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Whole-certificate SHA-256 hash for encryption: ", hash_sha_256); - - OCTETSTRING hash; // Whole-certificate hash - OCTETSTRING hashed_id; // Whole-certificate hashedid-8 - OCTETSTRING issuer; // Certificate issuer - if (public_key_x.lengthof() == 32) { // See IEEE Std 1609.2a-2017 Clause 6.4.3 CertificateBase - hash = hash_sha_256; - loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Whole-certificate SHA-256 hash: ", hash); - hashed_id = OCTETSTRING(8, static_cast(hash) + hash.lengthof() - 8); - } else if (public_key_x.lengthof() == 48) { sha384 sha; - sha.generate(certificate, hash); - loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Whole-certificate SHA-384 hash: ", hash); - hashed_id = OCTETSTRING(8, static_cast(hash) + hash.lengthof() - 8); - } else { - hash = OCTETSTRING(0, nullptr); - hash_sha_256 = OCTETSTRING(0, nullptr); - hashed_id = int2oct(0, 8); - } - loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: hash: ", hash); - loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: hashed_id: ", hashed_id); - - if (decoded_certificate.issuer().ischosen(Ieee1609Dot2::IssuerIdentifier::ALT_sha256AndDigest)) { - issuer = decoded_certificate.issuer().sha256AndDigest(); - } else if (decoded_certificate.issuer().ischosen(Ieee1609Dot2::IssuerIdentifier::ALT_sha384AndDigest)) { - issuer = decoded_certificate.issuer().sha384AndDigest(); - } else if (decoded_certificate.issuer().ischosen(Ieee1609Dot2::IssuerIdentifier::ALT_self__)) { - OCTETSTRING h; - if (decoded_certificate.issuer().self__() == Ieee1609Dot2BaseTypes::HashAlgorithm::sha256) { - sha256 sha; - sha.generate(certificate, h); - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Whole-certificate SHA-256 hash: ", hash); - } else { - sha384 sha; - sha.generate(certificate, h); - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Whole-certificate SHA-384 hash: ", hash); - } - issuer = OCTETSTRING(8, static_cast(h) + h.lengthof() - 8); - } else { - issuer = int2oct(0, 8); - } - loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: issuer: ", issuer); - - // Create new record - security_db_record *p = new security_db_record( - key, - certificate, // Certificate - decoded_certificate, - issuer, // Hashed ID fo the issuer - hash, hash_sha_256, - hashed_id, // Hashed ID - private_key, // Private key - public_key_x, // public keys X-coordinate - public_key_y, // public keys Y-coordinate - public_comp_key, // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) - private_enc_key, // Private encryption key - public_enc_key_x, // Public encryption key X-coordinate - public_enc_key_y, // Public encryption key Y-coordinate - public_enc_comp_key // Public compressed encryption key - ); - result = p_certificates.insert(std::pair>(key, std::unique_ptr(p))); - if (result.second == false) { - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Failed to insert new record '%s'", key.c_str()); - delete p; - return -1; + sha.generate(certificate, h); + // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Whole-certificate SHA-384 hash: ", hash); } - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: add key: ", result.first->second.get()->hashed_id()); - // loggers::get_instance().log("certificates_loader::build_certificates_cache: for : %s", result.first->first.c_str()); - p_hashed_id8s.insert(std::pair(result.first->second.get()->hashed_id(), result.first->first)); - /*std::vector v(static_cast(result.first->second.get()->hashed_id()), - result.first->second.get()->hashed_id().lengthof() + static_cast(result.first->second.get()->hashed_id())); - loggers::get_instance().log_to_hexa("security_cache::store_certificate: Converted hashed_id8: ", v.data(), v.size()); - p_hashed_id8s.insert(std::pair, std::string>(v, result.first->first));*/ + issuer = OCTETSTRING(8, static_cast(h) + h.lengthof() - 8); + } else { + issuer = int2oct(0, 8); + } + loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: issuer: ", issuer); + + // Create new record + security_db_record *p = new security_db_record( + key, + certificate, // Certificate + decoded_certificate, + issuer, // Hashed ID fo the issuer + hash, hash_sha_256, + hashed_id, // Hashed ID + private_key, // Private key + public_key_x, // public keys X-coordinate + public_key_y, // public keys Y-coordinate + public_comp_key, // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) + private_enc_key, // Private encryption key + public_enc_key_x, // Public encryption key X-coordinate + public_enc_key_y, // Public encryption key Y-coordinate + public_enc_comp_key // Public compressed encryption key + ); + result = p_certificates.insert(std::pair>(key, std::unique_ptr(p))); + if (result.second == false) { + loggers::get_instance().warning("certificates_loader::build_certificates_cache: Failed to insert new record '%s'", key.c_str()); + delete p; + return -1; } - // Reset pointer - it = p_files.cbegin(); - } while (it != p_files.cend()); + } return 0; -} // End of method build_certificates_cache +} int certificates_loader::save_certificate(const security_db_record &p_certificate) { loggers::get_instance().log(">>> certificates_loader::save_certificate: certificate_id=%s", p_certificate.certificate_id().c_str()); diff --git a/ccsrc/Protocols/Security/certificates_loader.hh b/ccsrc/Protocols/Security/certificates_loader.hh index a6bd969..20e5364 100644 --- a/ccsrc/Protocols/Security/certificates_loader.hh +++ b/ccsrc/Protocols/Security/certificates_loader.hh @@ -65,22 +65,49 @@ public: /*! \publicsection */ return *instance; }; + /*! + * \fn int build_path(const std::string &p_root_directory); + * \brief Build the full path to the certitifcates storage location + * \param[in] p_root_directory The root path to the certificates storage + * \return 0 on success, -1 otherwise + */ int build_path(const std::string &p_root_directory); - - int load_certificates(std::map> & p_certificates, - std::map*/, std::string, security_cache_comp> &p_hashed_id8s); - // int load_certificate(std::unique_ptr >& p_certificate, std::map& p_hashed_id8s); + /*! + * \fn int build_certificates_index(std::map &p_certificates_idx, std::map &p_hashed_id8s); + * \brief Store in memory the index of the certitifcates as a tuple {HashedId8, Certificate Name} + * \param[in] p_certificates_idx Memory stored index, key is the certificate name + * \param[in] p_hashed_id8s Memory stored index, key is the HashedId8 + * \return 0 on success, -1 otherwise + */ + int build_certificates_index(std::map &p_certificates_idx, std::map &p_hashed_id8s); + /*! + * \fn int load_certificate(const OCTETSTRING& p_hashed_id8, const std::string p_certificate_name, std::map> & p_certificates); + * \brief Store in memory the specified certificate + * \param[in] p_hashed_id8 The HashedId8 of the certificate + * \param[in] p_certificate_name The certificate name + * \param[inout] p_certificates The map of the loaded in memory certificates + * \return 0 on success, -1 otherwise + */ + int load_certificate(const OCTETSTRING& p_hashed_id8, const std::string p_certificate_name, std::map> & p_certificates); + /*! + * \fn int save_certificate(const security_db_record &p_certificate); + * \brief Save the specified certificate and update the internal maps + * \param[in] p_certificate The certificate to save + * \return 0 on success, -1 otherwise + */ int save_certificate(const security_db_record &p_certificate); -private: - int retrieve_certificates_list(std::set &p_files); - - int build_certificates_cache(std::set & p_files, - std::map> & p_certificates, - std::map*/, std::string, security_cache_comp> &p_hashed_id8s); - +private: /*! \privatesection */ + /*! + * \fn int fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p_ecc_point, OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y); + * \brief Initialize public key vectors, based on 256 bits curve + */ void fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p_ecc_point, OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y); + /*! + * \fn int fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p_ecc_point, OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y); + * \brief Initialize public key vectors, based on 384 bits curve + */ void fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP384CurvePoint &p_ecc_point, OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y); }; // End of class certificates_loader diff --git a/ccsrc/Protocols/Security/security_cache.cc b/ccsrc/Protocols/Security/security_cache.cc index 3a620bb..e1b631b 100644 --- a/ccsrc/Protocols/Security/security_cache.cc +++ b/ccsrc/Protocols/Security/security_cache.cc @@ -19,6 +19,7 @@ using namespace std; // Required for isnan() #include "etsi_ts103097_certificate_codec.hh" +#include "certificates_loader.hh" #include "loggers.hh" @@ -42,7 +43,7 @@ bool security_cache_comp::operator()(const OCTETSTRING &p_lhs, const OCTETSTRING return (first2 != last2); } -security_cache::security_cache() : _certificates(), _hashed_id8s() { loggers::get_instance().log(">>> security_cache::security_cache"); } // End of ctor +security_cache::security_cache() : _certificates_idx(), _certificates(), _hashed_id8s() { loggers::get_instance().log(">>> security_cache::security_cache"); } // End of ctor security_cache::~security_cache() { loggers::get_instance().log(">>> security_cache::~security_cache"); @@ -52,29 +53,44 @@ security_cache::~security_cache() { int security_cache::clear() { loggers::get_instance().log(">>> security_cache::clear"); _certificates.clear(); // Smart pointers will do the job + _certificates_idx.clear(); _hashed_id8s.clear(); return 0; } // End of clear method +int security_cache::load_certificate(const std::string &p_certificate_id, const security_db_record** p_record) { + loggers::get_instance().log(">>> security_cache::load_certificate: '%s'", p_certificate_id.c_str()); + + // Sanity check + std::map::const_iterator s = _certificates_idx.find(p_certificate_id); + if (s == _certificates_idx.cend()) { + loggers::get_instance().warning("security_cache::load_certificate: record not found"); + return -1; + } + // Certificate is on the DB, load it if required + std::map>::const_iterator it = _certificates.find(p_certificate_id); + if (it == _certificates.cend()) { + if (certificates_loader::get_instance().load_certificate(s->second, p_certificate_id, _certificates) == -1) { + loggers::get_instance().warning("security_cache::load_certificate: Failed to load certificate"); + return -1; + } else { + it = _certificates.find(p_certificate_id); + } + } + + *p_record = it->second.get(); + + return 0; +} + int security_cache::get_certificate_id(const OCTETSTRING &p_hashed_id8, std::string &p_certificate_id) const { loggers::get_instance().log_msg(">>> security_cache::get_certificate_id: ", p_hashed_id8); - std::map::const_iterator it = _hashed_id8s.find(p_hashed_id8); - // std::vector v(static_cast(p_hashed_id8), p_hashed_id8.lengthof() + static_cast(p_hashed_id8)); - // std::map, std::string>::const_iterator it = _hashed_id8s.find(v); + // Get the certificate id from the hashedid8 + std::map::const_iterator it = _hashed_id8s.find(p_hashed_id8); if (it == _hashed_id8s.cend()) { - // TODO try to load the certificate from the disk - /*if (certificates_loader::get_instance().load_certificate(p_hashed_id8, _certificates, _hashed_id8s) == -1) { - loggers::get_instance().warning("security_cache::get_certificate: record not found"); - dump(); - p_certificate_id = ""; - return -1; - } else { - it = _hashed_id8s.find(p_hashed_id8); - }*/ - loggers::get_instance().warning("security_cache::get_certificate: record not found"); - dump(); + loggers::get_instance().warning("security_cache::get_certificate_id: record not found in index"); p_certificate_id = ""; return -1; } @@ -84,56 +100,38 @@ int security_cache::get_certificate_id(const OCTETSTRING &p_hashed_id8, std::str return 0; } -int security_cache::get_certificate(const std::string &p_certificate_id, OCTETSTRING &p_certificate) const { +int security_cache::get_certificate(const std::string &p_certificate_id, OCTETSTRING &p_certificate) { loggers::get_instance().log(">>> security_cache::get_certificate: '%s'", p_certificate_id.c_str()); - std::map>::const_iterator it = _certificates.find(p_certificate_id); - if (it == _certificates.cend()) { - // TODO try to load the certificate from the disk - /*if (certificates_loader::get_instance().load_certificate(it->second(), _certificates, _hashed_id8s) == -1) { - loggers::get_instance().warning("security_cache::get_certificate: record not found"); - dump(); - p_certificate_id = ""; - return -1; - } else { - it = _hashed_id8s.find(it->second()); - }*/ - loggers::get_instance().warning("security_cache::get_certificate: record not found"); - dump(); + const security_db_record* record; + if (load_certificate(p_certificate_id, &record) == -1) { + loggers::get_instance().warning("security_cache::get_private_key: Failed to load certificate"); return -1; } - p_certificate = it->second.get()->certificate(); + + p_certificate = record->certificate(); return 0; } -int security_cache::get_certificate(const std::string &p_certificate_id, Ieee1609Dot2::CertificateBase &p_certificate) const { - loggers::get_instance().log(">>> security_cache::get_certificate: '%s'", p_certificate_id.c_str()); +int security_cache::get_certificate(const std::string &p_certificate_id, Ieee1609Dot2::CertificateBase &p_certificate) { + loggers::get_instance().log(">>> security_cache::get_certificate (1): '%s'", p_certificate_id.c_str()); - std::map>::const_iterator it = _certificates.find(p_certificate_id); - if (it == _certificates.cend()) { - // TODO try to load the certificate from the disk - /*if (certificates_loader::get_instance().load_certificate(it->second(), _certificates, _hashed_id8s) == -1) { - loggers::get_instance().warning("security_cache::get_certificate: record not found"); - dump(); - p_certificate_id = ""; - return -1; - } else { - it = _hashed_id8s.find(it->second()); - }*/ - loggers::get_instance().warning("security_cache::get_certificate: record not found"); - dump(); + const security_db_record* record; + if (load_certificate(p_certificate_id, &record) == -1) { + loggers::get_instance().warning("security_cache::get_private_key: Failed to load certificate"); return -1; } - p_certificate = it->second.get()->decoded_certificate(); + + p_certificate = record->decoded_certificate(); return 0; } -int security_cache::get_certificate(const OCTETSTRING &p_hashed_id3, Ieee1609Dot2::CertificateBase &p_certificate) const { - loggers::get_instance().log_msg(">>> security_cache::get_certificate: ", p_hashed_id3); +int security_cache::get_certificate(const OCTETSTRING &p_hashed_id3, Ieee1609Dot2::CertificateBase &p_certificate) { + loggers::get_instance().log_msg(">>> security_cache::get_certificate (2): ", p_hashed_id3); - std::map::const_iterator s; + std::map::const_iterator s; for (s = _hashed_id8s.cbegin(); s != _hashed_id8s.cend(); ++s) { if ((p_hashed_id3[2] == (s->first)[(s->first).lengthof() - 1]) && (p_hashed_id3[1] == (s->first)[(s->first).lengthof() - 2]) && (p_hashed_id3[0] == (s->first)[(s->first).lengthof() - 3])) { @@ -141,30 +139,17 @@ int security_cache::get_certificate(const OCTETSTRING &p_hashed_id3, Ieee1609Dot } } // End of 'for' statement if (s == _hashed_id8s.cend()) { - loggers::get_instance().warning("security_cache::get_certificate: hashedId3 does not match"); + loggers::get_instance().warning("security_cache::get_certificate (2): hashedId3 does not match"); return -1; } - /*TODO std::map::const_iterator s = std::find_if( - _hashed_id8s.cbegin(), - _hashed_id8s.cend(), - hashed_id_matching - );*/ - std::map>::const_iterator it = _certificates.find(s->second); - if (it == _certificates.cend()) { - // TODO try to load the certificate from the disk - /*if (certificates_loader::get_instance().load_certificate(p_hashed_id8, _certificates, _hashed_id8s) == -1) { - loggers::get_instance().warning("security_cache::get_certificate: record not found"); - dump(); - p_certificate_id = ""; - return -1; - } else { - it = _certificates.find(s->first); - }*/ - loggers::get_instance().warning("security_cache::get_certificate: record not found"); - dump(); + + const security_db_record* record; + if (load_certificate(s->second, &record) == -1) { + loggers::get_instance().warning("security_cache::get_private_key: Failed to load certificate"); return -1; } - p_certificate = it->second.get()->decoded_certificate(); + + p_certificate = record->decoded_certificate(); return 0; } @@ -172,7 +157,7 @@ int security_cache::get_certificate(const OCTETSTRING &p_hashed_id3, Ieee1609Dot int security_cache::get_certificate_hashed_id3(const OCTETSTRING &p_hashed_id3, std::string &p_certificate_id) const { loggers::get_instance().log_msg(">>> security_cache::get_certificate_hashed_id3: ", p_hashed_id3); - std::map::const_iterator s; + std::map::const_iterator s; for (s = _hashed_id8s.cbegin(); s != _hashed_id8s.cend(); ++s) { if ((p_hashed_id3[2] == (s->first)[(s->first).lengthof() - 1]) && (p_hashed_id3[1] == (s->first)[(s->first).lengthof() - 2]) && (p_hashed_id3[0] == (s->first)[(s->first).lengthof() - 3])) { @@ -181,27 +166,25 @@ int security_cache::get_certificate_hashed_id3(const OCTETSTRING &p_hashed_id3, } // End of 'for' statement if (s == _hashed_id8s.cend()) { loggers::get_instance().warning("security_cache::get_certificate_hashed_id3: hashedId3 does not match"); + p_certificate_id = ""; return -1; } - /*TODO std::map::const_iterator s = std::find_if( - _hashed_id8s.cbegin(), - _hashed_id8s.cend(), - hashed_id_matching - );*/ + p_certificate_id = s->second; return 0; } -int security_cache::get_issuer(const std::string &p_certificate_id, OCTETSTRING &p_hashed_id_issuer) const { +int security_cache::get_issuer(const std::string &p_certificate_id, OCTETSTRING &p_hashed_id_issuer) { loggers::get_instance().log(">>> security_cache::get_issuer: '%s'", p_certificate_id.c_str()); - std::map>::const_iterator it = _certificates.find(p_certificate_id); - if (it == _certificates.cend()) { - loggers::get_instance().warning("security_cache::get_issuer: record not found"); + const security_db_record* record; + if (load_certificate(p_certificate_id, &record) == -1) { + loggers::get_instance().warning("security_cache::get_private_key: Failed to load certificate"); return -1; } - p_hashed_id_issuer = it->second.get()->issuer(); + + p_hashed_id_issuer = record->issuer(); return 0; } @@ -209,120 +192,130 @@ int security_cache::get_issuer(const std::string &p_certificate_id, OCTETSTRING int security_cache::get_hashed_id(const std::string &p_certificate_id, OCTETSTRING &p_hashed_id) const { loggers::get_instance().log(">>> security_cache::get_hashed_id: '%s'", p_certificate_id.c_str()); - std::map>::const_iterator it = _certificates.find(p_certificate_id); - if (it == _certificates.cend()) { + std::map::const_iterator it = _certificates_idx.find(p_certificate_id); + if (it == _certificates_idx.cend()) { loggers::get_instance().warning("security_cache::get_hashed_id: record not found"); + p_hashed_id = OCTETSTRING(0, nullptr); return -1; } - p_hashed_id = it->second.get()->hashed_id(); + + p_hashed_id = it->second; return 0; } -int security_cache::get_hash(const std::string &p_certificate_id, OCTETSTRING &p_hash) const { +int security_cache::get_hash(const std::string &p_certificate_id, OCTETSTRING &p_hash) { loggers::get_instance().log(">>> security_cache::get_hash: '%s'", p_certificate_id.c_str()); - std::map>::const_iterator it = _certificates.find(p_certificate_id); - if (it == _certificates.cend()) { - loggers::get_instance().warning("security_cache::get_hash: record not found"); + const security_db_record* record; + if (load_certificate(p_certificate_id, &record) == -1) { + loggers::get_instance().warning("security_cache::get_private_key: Failed to load certificate"); return -1; } - p_hash = it->second.get()->hash(); + + p_hash = record->hash(); return 0; } -int security_cache::get_hash_sha_256(const std::string &p_certificate_id, OCTETSTRING &p_hash) const { +int security_cache::get_hash_sha_256(const std::string &p_certificate_id, OCTETSTRING &p_hash) { loggers::get_instance().log(">>> security_cache::get_hash_sha_256: '%s'", p_certificate_id.c_str()); - std::map>::const_iterator it = _certificates.find(p_certificate_id); - if (it == _certificates.cend()) { - loggers::get_instance().warning("security_cache::get_hash_sha_256: record not found"); + const security_db_record* record; + if (load_certificate(p_certificate_id, &record) == -1) { + loggers::get_instance().warning("security_cache::get_private_key: Failed to load certificate"); return -1; } - p_hash = it->second.get()->hash_sha_256(); + + p_hash = record->hash_sha_256(); return 0; } -int security_cache::get_private_key(const std::string &p_certificate_id, OCTETSTRING &p_private_key) const { +int security_cache::get_private_key(const std::string &p_certificate_id, OCTETSTRING &p_private_key) { loggers::get_instance().log(">>> security_cache::get_private_key: '%s'", p_certificate_id.c_str()); - std::map>::const_iterator it = _certificates.find(p_certificate_id); - if (it == _certificates.cend()) { - loggers::get_instance().warning("security_cache::get_private_key: record not found"); + const security_db_record* record; + if (load_certificate(p_certificate_id, &record) == -1) { + loggers::get_instance().warning("security_cache::get_private_key: Failed to load certificate"); return -1; } - p_private_key = it->second.get()->private_key(); + + p_private_key = record->private_key(); return 0; } -int security_cache::get_public_keys(const std::string &p_certificate_id, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y) const { +int security_cache::get_public_keys(const std::string &p_certificate_id, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y) { loggers::get_instance().log(">>> security_cache::get_public_keys: '%s'", p_certificate_id.c_str()); - std::map>::const_iterator it = _certificates.find(p_certificate_id); - if (it == _certificates.cend()) { - loggers::get_instance().warning("security_cache::get_public_keys: record not found"); + const security_db_record* record; + if (load_certificate(p_certificate_id, &record) == -1) { + loggers::get_instance().warning("security_cache::get_private_key: Failed to load certificate"); return -1; } - p_public_key_x = it->second.get()->public_key_x(); - p_public_key_y = it->second.get()->public_key_y(); + + p_public_key_x = record->public_key_x(); + p_public_key_y = record->public_key_y(); return 0; } -int security_cache::get_public_comp_key(const std::string &p_certificate_id, OCTETSTRING &p_public_comp_key, INTEGER &p_comp_mode) const { +int security_cache::get_public_comp_key(const std::string &p_certificate_id, OCTETSTRING &p_public_comp_key, INTEGER &p_comp_mode) { loggers::get_instance().log(">>> security_cache::get_public_comp_key: '%s'", p_certificate_id.c_str()); - std::map>::const_iterator it = _certificates.find(p_certificate_id); - if (it == _certificates.cend()) { - loggers::get_instance().warning("security_cache::get_public_comp_key: record not found"); + const security_db_record* record; + if (load_certificate(p_certificate_id, &record) == -1) { + loggers::get_instance().warning("security_cache::get_private_key: Failed to load certificate"); return -1; } - const OCTETSTRING public_comp_key = it->second.get()->public_comp_key(); // 33 or 49 bytes length + + const OCTETSTRING public_comp_key = record->public_comp_key(); // 33 or 49 bytes length p_public_comp_key = OCTETSTRING(public_comp_key.lengthof() - 1, 1 + static_cast(public_comp_key)); // 32 or 48 bytes length p_comp_mode = INTEGER(((public_comp_key[0].get_octet() % 2) == 0) ? 0 : 1); // compressed-y-0 or compressed-y-1 return 0; } -int security_cache::get_private_enc_key(const std::string &p_certificate_id, OCTETSTRING &p_private_enc_key) const { +int security_cache::get_private_enc_key(const std::string &p_certificate_id, OCTETSTRING &p_private_enc_key) { loggers::get_instance().log(">>> security_cache::get_private_enc_key: '%s'", p_certificate_id.c_str()); - std::map>::const_iterator it = _certificates.find(p_certificate_id); - if (it == _certificates.cend()) { - loggers::get_instance().warning("security_cache::get_private_enc_key: record not found"); + const security_db_record* record; + if (load_certificate(p_certificate_id, &record) == -1) { + loggers::get_instance().warning("security_cache::get_private_key: Failed to load certificate"); return -1; } - p_private_enc_key = it->second.get()->private_enc_key(); + + p_private_enc_key = record->private_enc_key(); return 0; } -int security_cache::get_public_enc_keys(const std::string &p_certificate_id, OCTETSTRING &p_public_enc_key_x, OCTETSTRING &p_public_enc_key_y) const { +int security_cache::get_public_enc_keys(const std::string &p_certificate_id, OCTETSTRING &p_public_enc_key_x, OCTETSTRING &p_public_enc_key_y) { loggers::get_instance().log(">>> security_cache::get_public_enc_keys: '%s'", p_certificate_id.c_str()); - std::map>::const_iterator it = _certificates.find(p_certificate_id); - if (it == _certificates.cend()) { - loggers::get_instance().warning("security_cache::get_public_enc_keys: record not found"); + const security_db_record* record; + if (load_certificate(p_certificate_id, &record) == -1) { + loggers::get_instance().warning("security_cache::get_private_key: Failed to load certificate"); return -1; } - p_public_enc_key_x = it->second.get()->public_enc_key_x(); - p_public_enc_key_y = it->second.get()->public_enc_key_y(); + + p_public_enc_key_x = record->public_enc_key_x(); + p_public_enc_key_y = record->public_enc_key_y(); return 0; } -int security_cache::get_public_enc_comp_key(const std::string &p_certificate_id, OCTETSTRING &p_public_enc_comp_key, INTEGER &p_enc_comp_mode) const { +int security_cache::get_public_enc_comp_key(const std::string &p_certificate_id, OCTETSTRING &p_public_enc_comp_key, INTEGER &p_enc_comp_mode) { loggers::get_instance().log(">>> security_cache::get_public_enc_comp_key: '%s'", p_certificate_id.c_str()); - std::map>::const_iterator it = _certificates.find(p_certificate_id); - if (it == _certificates.cend()) { - loggers::get_instance().warning("security_cache::get_public_enc_comp_key: record not found"); + const security_db_record* record; + if (load_certificate(p_certificate_id, &record) == -1) { + loggers::get_instance().warning("security_cache::get_private_key: Failed to load certificate"); return -1; } - const OCTETSTRING public_enc_comp_key = it->second.get()->public_enc_comp_key(); // 33 or 49 bytes length + + const OCTETSTRING public_enc_comp_key = record->public_enc_comp_key(); // 33 or 49 bytes length p_public_enc_comp_key = OCTETSTRING(public_enc_comp_key.lengthof() - 1, 1 + static_cast(public_enc_comp_key)); // 32 or 48 bytes length p_enc_comp_mode = INTEGER(((public_enc_comp_key[0].get_octet() % 2) == 0) ? 0 : 1); // compressed-y-0 or compressed-y-1 @@ -398,34 +391,35 @@ int security_cache::store_certificate(const CHARSTRING &p_cert_id, const OCTETST if (p == nullptr) { return -1; } - std::map>::const_iterator i = _certificates.find(key); + std::map>::const_iterator i = _certificates.find(key); if (i != _certificates.cend()) { _certificates.erase(i); } - _certificates.insert(std::pair>(key, std::unique_ptr(p))); + _certificates.insert(std::pair>(key, std::unique_ptr(p))); - std::map::const_iterator h = _hashed_id8s.find(hashed_id8); - // std::vector v(static_cast(hashed_id8), hashed_id8.lengthof() + static_cast(hashed_id8)); - // std::map, std::string>::const_iterator h = _hashed_id8s.find(v); + std::map::const_iterator h = _hashed_id8s.find(hashed_id8); if (h != _hashed_id8s.cend()) { - loggers::get_instance().log_msg("security_cache::store_certificate: Replace entry ", h->first); + loggers::get_instance().log_msg("security_cache::store_certificate: Replace entry in _hashed_id8s: ", h->first); _hashed_id8s.erase(h); } + std::map::const_iterator k = _certificates_idx.find(h->second); + if (k != _certificates_idx.cend()) { + loggers::get_instance().log("security_cache::store_certificate: Replace entry in _certificates_idx: %s", k->first.c_str()); + _certificates_idx.erase(k); + } loggers::get_instance().log_msg("security_cache::store_certificate: Add entry ", hashed_id8); loggers::get_instance().log("security_cache::store_certificate: Add entry for key %s", key.c_str()); - _hashed_id8s.insert(std::pair(hashed_id8, key)); - //_hashed_id8s.insert(std::pair, std::string&>(v, key)); - - // dump(); + _hashed_id8s.insert(std::pair(hashed_id8, key)); + _certificates_idx.insert(std::pair(key, hashed_id8)); return 0; } void security_cache::dump() const { loggers::get_instance().log("security_cache::dump_certificates: # items = %d", _certificates.size()); - for (std::map>::const_iterator it = _certificates.cbegin(); it != _certificates.cend(); ++it) { - security_db_record *p = it->second.get(); + for (std::map>::const_iterator it = _certificates.cbegin(); it != _certificates.cend(); ++it) { + const security_db_record *p = it->second.get(); loggers::get_instance().log("security_cache::dump: certificate_id = %s", p->certificate_id().c_str()); loggers::get_instance().log_msg("security_cache::dump: certificate = ", p->certificate()); loggers::get_instance().log_msg("security_cache::dump: decoded certificate = ", p->decoded_certificate()); @@ -444,7 +438,7 @@ void security_cache::dump() const { } // End of 'for' statement // for (std::map::const_iterator it = _hashed_id8s.cbegin(); it != _hashed_id8s.cend(); ++it) { loggers::get_instance().log("security_cache::dump: Hashedid8 table length: %d", _hashed_id8s.size()); - for (std::map*/, std::string>::const_iterator it = _hashed_id8s.cbegin(); it != _hashed_id8s.cend(); ++it) { + for (std::map::const_iterator it = _hashed_id8s.cbegin(); it != _hashed_id8s.cend(); ++it) { loggers::get_instance().log_msg("security_cache::dump: Hashedid8 key = ", it->first); loggers::get_instance().log("security_cache::dump: Hashedid8 idx ==> %s", it->second.c_str()); } // End of 'for' statement diff --git a/ccsrc/Protocols/Security/security_cache.hh b/ccsrc/Protocols/Security/security_cache.hh index 9cf2ab6..6aed014 100644 --- a/ccsrc/Protocols/Security/security_cache.hh +++ b/ccsrc/Protocols/Security/security_cache.hh @@ -35,9 +35,12 @@ class security_cache { protected: /*! \protectedsection */ // TODO Enforce with const security_cache_record, and const std::string - std::map> _certificates; //! List of the certificates indexed by the certificate identifier - std::map _hashed_id8s; //! List of the certificates indexed by the HashedId8 - // std::map, std::string> _hashed_id8s; //! List of the certificates indexed by the HashedId8 + std::map _certificates_idx; //! List of the certificates indexed by the certificate identifier + std::map _hashed_id8s; //! List of the certificates indexed by the HashedId8 + std::map> _certificates; //! List of the certificates indexed by the certificate identifier + + // FIXME In _certificates: relace key by hashed_id8s: std::map> _certificates; + public: /*! \publicsection */ /*! @@ -49,21 +52,130 @@ public: /*! \publicsection */ */ virtual ~security_cache(); + /*! + * \fn int get_certificate_id(const OCTETSTRING &p_hashed_id8, std::string &p_certificate_id) const; + * \brief Retrive the certificate name based of the specified HashedId8 + * \param[in] p_hashed_id8 The HashedId8 of the certificate + * \param[out] p_certificate_name The certificate name + * \return 0 on success, -1 otherwise + */ int get_certificate_id(const OCTETSTRING &p_hashed_id8, std::string &p_certificate_id) const; - int get_certificate(const std::string &p_certificate_id, OCTETSTRING &p_certificate) const; - int get_certificate(const std::string &p_certificate_id, Ieee1609Dot2::CertificateBase &p_certificate) const; - int get_certificate(const OCTETSTRING &p_hashed_id3, Ieee1609Dot2::CertificateBase &p_certificate) const; + /*! + * \fn int get_certificate(const OCTETSTRING &p_hashed_id8, OCTETSTRING &p_certificate); + * \brief Retrive the specified certificate either from memory + * \param[in] p_certificate_id The certificate name + * \param[out] p_certificate The raw certificate value + * \return 0 on success, -1 otherwise + */ + int get_certificate(const std::string &p_certificate_id, OCTETSTRING &p_certificate); + /*! + * \fn int get_certificate(const OCTETSTRING &p_hashed_id8, Ieee1609Dot2::CertificateBase &p_certificate); + * \brief Retrive the specified certificate either from memory + * \param[in] p_certificate_id The certificate name + * \param[out] p_certificate The Ieee1609Dot2 decoded certificate value + * \return 0 on success, -1 otherwise + */ + int get_certificate(const std::string &p_certificate_id, Ieee1609Dot2::CertificateBase &p_certificate); + /*! + * \fn int get_certificate(const OCTETSTRING &p_hashed_id3, Ieee1609Dot2::CertificateBase &p_certificate); + * \brief Retrive the specified certificate either from memory + * \param[in] p_certificate_id The HashedId3 of the certificate + * \param[out] p_certificate The Ieee1609Dot2 decoded certificate value + * \return 0 on success, -1 otherwise + */ + int get_certificate(const OCTETSTRING &p_hashed_id3, Ieee1609Dot2::CertificateBase &p_certificate); + /*! + * \fn int get_certificate_hashed_id3(const OCTETSTRING &p_hashed_id3, std::string &p_certificate_id) const; + * \brief Retrive the specified certificate either from memory + * \param[in] p_hashed_id3 The HashedId3 of the certificate + * \param[out] p_certificate_id The certificate name + * \return 0 on success, -1 otherwise + */ int get_certificate_hashed_id3(const OCTETSTRING &p_hashed_id3, std::string &p_certificate_id) const; - int get_issuer(const std::string &p_certificate_id, OCTETSTRING &p_hashed_id_issuer) const; + /*! + * \fn int get_issuer(const std::string &p_certificate_id, OCTETSTRING &p_hashed_id_issuer); + * \brief Retrive the issuer of the specified certificate + * \param[in] p_certificate_id The certificate name + * \param[out] p_hashed_id_issuer The HashedId8 of the isseur certificate + * \return 0 on success, -1 otherwise + */ + int get_issuer(const std::string &p_certificate_id, OCTETSTRING &p_hashed_id_issuer); + /*! + * \fn int get_hashed_id(const std::string &p_certificate_id, OCTETSTRING &p_hashed_id) const; + * \brief Retrive the HashedId8 of the whole certificate + * \param[in] p_certificate_id The certificate name + * \param[out] p_hashed_id The HashedId8 of the whole certificate + * \return 0 on success, -1 otherwise + */ int get_hashed_id(const std::string &p_certificate_id, OCTETSTRING &p_hashed_id) const; - int get_hash(const std::string &p_certificate_id, OCTETSTRING &p_hash) const; - int get_hash_sha_256(const std::string &p_certificate_id, OCTETSTRING &p_hash) const; - int get_private_key(const std::string &p_certificate_id, OCTETSTRING &p_private_key) const; - int get_public_keys(const std::string &p_certificate_id, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y) const; - int get_public_comp_key(const std::string &p_certificate_id, OCTETSTRING &p_public_comp_key, INTEGER &p_comp_mode) const; - int get_private_enc_key(const std::string &p_certificate_id, OCTETSTRING &p_private_enc_key) const; - int get_public_enc_keys(const std::string &p_certificate_id, OCTETSTRING &p_public_enc_key_x, OCTETSTRING &p_public_enc_key_y) const; - int get_public_enc_comp_key(const std::string &p_certificate_id, OCTETSTRING &p_public_enc_comp_key, INTEGER &p_enc_comp_mode) const; + /*! + * \fn int get_hash(const std::string &p_certificate_id, OCTETSTRING &p_hash); + * \brief Retrive the hash (256 or 384) of the whole certificate + * \param[in] p_certificate_id The certificate name + * \param[out] p_hash The hash of the whole certificate + * \return 0 on success, -1 otherwise + */ + int get_hash(const std::string &p_certificate_id, OCTETSTRING &p_hash); + /*! + * \fn int get_hash_sha_256(const std::string &p_certificate_id, OCTETSTRING &p_hash); + * \brief Retrive the SHA-256 of the whole certificate + * \param[in] p_certificate_id The certificate name + * \param[out] p_hash The SHA-256 of the whole certificate + * \return 0 on success, -1 otherwise + */ + int get_hash_sha_256(const std::string &p_certificate_id, OCTETSTRING &p_hash); + /*! + * \fn int get_private_key(const std::string &p_certificate_id, OCTETSTRING &p_private_key); + * \brief Retrive the private key of the specified certificate + * \param[in] p_certificate_id The certificate name + * \param[out] p_private_key The private key + * \return 0 on success, -1 otherwise + */ + int get_private_key(const std::string &p_certificate_id, OCTETSTRING &p_private_key); + /*! + * \fn int get_public_keys(const std::string &p_certificate_id, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y); + * \brief Retrive the public keys (in uncompressed format) of the specified certificate + * \param[in] p_certificate_id The certificate name + * \param[out] p_public_key_x The X-coordinate of the public key + * \param[out] p_public_key_y The Y-coordinate of the public key + * \return 0 on success, -1 otherwise + */ + int get_public_keys(const std::string &p_certificate_id, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y); + /*! + * \fn int get_public_keys(const std::string &p_certificate_id, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y); + * \brief Retrive the public keys (in compressed format) of the specified certificate + * \param[in] p_certificate_id The certificate name + * \param[out] p_public_comp_key The X-coordinate of the public key + * \param[out] p_comp_mode The compressed mode (2 for compress-y0, 3 otherwise) + * \return 0 on success, -1 otherwise + */ + int get_public_comp_key(const std::string &p_certificate_id, OCTETSTRING &p_public_comp_key, INTEGER &p_comp_mode); + /*! + * \fn int get_private_enc_key(const std::string &p_certificate_id, OCTETSTRING &p_private_enc_key); + * \brief Retrive the private key for encryption of the specified certificate + * \param[in] p_certificate_id The certificate name + * \param[out] p_private_enc_key The private key for encryption + * \return 0 on success, -1 otherwise + */ + int get_private_enc_key(const std::string &p_certificate_id, OCTETSTRING &p_private_enc_key); + /*! + * \fn int get_public_enc_keys(const std::string &p_certificate_id, OCTETSTRING &p_public_enc_key_x, OCTETSTRING &p_public_enc_key_y); + * \brief Retrive the public keys (in uncompressed format) for encryption of the specified certificate + * \param[in] p_certificate_id The certificate name + * \param[out] p_public_enc_key_x The X-coordinate of the public key for encryption + * \param[out] p_public_enc_key_y The Y-coordinate of the public key for encryption + * \return 0 on success, -1 otherwise + */ + int get_public_enc_keys(const std::string &p_certificate_id, OCTETSTRING &p_public_enc_key_x, OCTETSTRING &p_public_enc_key_y); + /*! + * \fn int get_public_enc_comp_key(const std::string &p_certificate_id, OCTETSTRING &p_public_enc_comp_key, INTEGER &p_enc_comp_mode); + * \brief Retrive the public keys (in compressed format) for encryption of the specified certificate + * \param[in] p_certificate_id The certificate name + * \param[out] p_public_enc_comp_key The X-coordinate of the public key for encryption + * \param[out] p_enc_comp_mode The compressed mode (2 for compress-y0, 3 otherwise) + * \return 0 on success, -1 otherwise + */ + int get_public_enc_comp_key(const std::string &p_certificate_id, OCTETSTRING &p_public_enc_comp_key, INTEGER &p_enc_comp_mode); virtual int store_certificate(const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, const OCTETSTRING &p_public_key_x, const OCTETSTRING &p_public_key_y, const OCTETSTRING &p_public_compressed_key, const INTEGER &p_public_compressed_key_mode, @@ -71,8 +183,24 @@ public: /*! \publicsection */ const OCTETSTRING &p_private_enc_key, const OCTETSTRING &p_public_enc_key_x, const OCTETSTRING &p_public_enc_key_y, const OCTETSTRING &p_public_enc_compressed_key, const INTEGER &p_public_enc_compressed_key_mode); + /*! + * \fn int int clear(); + * \brief Cleanup the cache + * \return 0 on success, -1 otherwise + * \virtual + */ virtual int clear(); void dump() const; +private: /*! \privatesection */ + /*! + * \fn int load_certificate(const std::string &p_certificate_id, const security_db_record** p_record); + * \brief Retrive the specified certificate either from memory of from storage location + * \param[in] p_certificate_id The certificate name + * \param[out] p_record A reference to the certificate record + * \return 0 on success, -1 otherwise + */ + int load_certificate(const std::string &p_certificate_id, const security_db_record** p_record); + }; // End of class security_cache diff --git a/ccsrc/Protocols/Security/security_db.cc b/ccsrc/Protocols/Security/security_db.cc index 13495a4..f61c1dd 100644 --- a/ccsrc/Protocols/Security/security_db.cc +++ b/ccsrc/Protocols/Security/security_db.cc @@ -16,23 +16,22 @@ using namespace std; // Required for isnan() security_db::security_db(const std::string &p_db_path) { loggers::get_instance().log(">>> security_db::security_db: '%s'", p_db_path.c_str()); - load_from_files(p_db_path); - dump(); + initialize_cache(p_db_path); } // End of ctor security_db::~security_db() { loggers::get_instance().log(">>> security_db::~security_db"); } // End of dtor -int security_db::load_from_files(const std::string &p_db_path) { - loggers::get_instance().log(">>> security_db::load_from_files: '%s'", p_db_path.c_str()); +int security_db::initialize_cache(const std::string &p_db_path) { + loggers::get_instance().log(">>> security_db::initialize_cache: '%s'", p_db_path.c_str()); if (certificates_loader::get_instance().build_path(p_db_path) == -1) { - loggers::get_instance().log(">>> security_db::load_from_files: certificates_loader::build_path method failed"); + loggers::get_instance().log(">>> security_db::initialize_cache: certificates_loader::build_path method failed"); return -1; } // TODO Build the maps of couple {HasehedId8, Certificate} - if (certificates_loader::get_instance().load_certificates(_certificates, _hashed_id8s) == -1) { - loggers::get_instance().log(">>> security_db::load_from_files: certificates_loader::load_certificates method failed"); + if (certificates_loader::get_instance().build_certificates_index(_certificates_idx, _hashed_id8s) == -1) { + loggers::get_instance().log(">>> security_db::initialize_cache: certificates_loader::build_certificates_index method failed"); return -1; } @@ -52,7 +51,7 @@ int security_db::store_certificate(const CHARSTRING &p_cert_id, const OCTETSTRIN return -1; } - std::map>::const_iterator it = _certificates.find(std::string(static_cast(p_cert_id))); + std::map>::const_iterator it = _certificates.find(std::string(static_cast(p_cert_id))); if (it == _certificates.cend()) { loggers::get_instance().warning("security_db::get_certificate: record not found"); return -1; diff --git a/ccsrc/Protocols/Security/security_db.hh b/ccsrc/Protocols/Security/security_db.hh index 9ab98c9..dd21a21 100644 --- a/ccsrc/Protocols/Security/security_db.hh +++ b/ccsrc/Protocols/Security/security_db.hh @@ -47,10 +47,10 @@ public: /*! \publicsection */ private: /*! \privatesection */ /*! - * \fn int load_from_files(const std::string& p_db_path); + * \fn int initialize_cache(const std::string& p_db_path); * \brief Initialise the storage of certificates mechanism * \param[in] p_db_path The full path to the certificates storage * \return 0 on success, -1 otherwise */ - int load_from_files(const std::string &p_db_path); + int initialize_cache(const std::string &p_db_path); }; // End of class security_db diff --git a/data/certificates/Makefile b/data/certificates/Makefile index de6191b..2681cd1 100644 --- a/data/certificates/Makefile +++ b/data/certificates/Makefile @@ -60,11 +60,14 @@ certs_iut += $(certs_iut_at) iut_files = $(patsubst $(outdir)/%, $(iutdir)/%, $(certs_iut) $(vkeys_iut_at) $(ekeys_iut_at)) -install: $(iutdir) $(iut_files) +install: $(iutdir) $(iut_files) $(iutdir)/index.lst $(iut_files): $(iutdir)/%: $(outdir)/% -cp -f $< $@ +$(iutdir)/index.lst: $(certs_iut) + $(asn1certidx) -o $@ $^ + $(vkeys_iut_at) $(ekeys_iut_at): IUT_TC23 = CERT_IUT_C1_AT.oer CERT_IUT_C1_AT.vkey CERT_IUT_C1_AT.ekey CERT_IUT_CC_AA.oer CERT_IUT_C_RCA.oer CERT_TS_A_AT.oer CERT_IUT_A_AA.oer diff --git a/etc/AtsCAM/AtsCAM.cfg b/etc/AtsCAM/AtsCAM.cfg index 49848a2..61f266c 100644 --- a/etc/AtsCAM/AtsCAM.cfg +++ b/etc/AtsCAM/AtsCAM.cfg @@ -108,7 +108,7 @@ system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port= #system.utPort.params := "UT_CAM/UDP(dst_ip=172.16.35.1)" [EXECUTE] -#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 +ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 @@ -161,7 +161,7 @@ system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port= #ItsCam_TestCases.TC_CAM_MSP_SSP_BV_03 #ItsCam_TestCases.TC_CAM_MSD_SSP_BO_01 #ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 -ItsCam_TestCases.TC_CAM_MSD_SSP_BO_03 +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_03 [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/scripts/run_tshark.bash b/scripts/run_tshark.bash deleted file mode 100755 index 09889dd..0000000 --- a/scripts/run_tshark.bash +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# Debug mode -#set -vx -#set -e - -PCAP_SAVE_PATH=~/tmp -rm $PCAP_SAVE_PATH/capture_*.pcap* -#~/frameworks/wireshark-build/run/tshark -ieth1 -V -f"ether proto 0x8947 or udp src port 12345 or udp dst port 12345" -Tfields -eframe.time -eeth.dst -eeth.src -eeth.type -edata -g -w $PCAP_SAVE_PATH/capture_`date +'%Y%m%d'`.pcap -F pcap -#~/frameworks/wireshark-build/run/tshark -ieth1 -V -f"udp port 9091 or udp port 7946" -Tfields -eframe.time -eeth.dst -eeth.src -eeth.type -edata -g -w $PCAP_SAVE_PATH/capture_`date +'%Y%m%d'`.pcap -F pcap -tcpdump -i wlp0s20f3 -vvv -xx -w $PCAP_SAVE_PATH/capture_`date +'%Y%m%d'`.pcap diff --git a/virtualization/docker/home/etc/init.d/45-certgen.sh b/virtualization/docker/home/etc/init.d/45-certgen.sh index 1e1c23b..9c8b61f 100755 --- a/virtualization/docker/home/etc/init.d/45-certgen.sh +++ b/virtualization/docker/home/etc/init.d/45-certgen.sh @@ -14,6 +14,7 @@ cd certgen/ && make && cd - echo -e "*****************************\n* Generate ETSI ITS certificates \n*****************************\n" cd ${HOME}/dev/TS.ITS/data/certificates CERTGEN=${HOME}/dev/itscertgen make +CERTGEN=${HOME}/dev/itscertgen make install cd ${HOME} diff --git a/virtualization/docker/home/etc/init.d/50-ats.sh b/virtualization/docker/home/etc/init.d/50-ats.sh index 0587d6c..4a014f1 100755 --- a/virtualization/docker/home/etc/init.d/50-ats.sh +++ b/virtualization/docker/home/etc/init.d/50-ats.sh @@ -18,8 +18,11 @@ do make done +echo -e "*****************************\n* Cleanup build\n*****************************\n" +rm -fr ./build + echo -e "*****************************\n* Change sudo in command line\n*****************************\n" -cd /home/etsi/dev/TS.ITS/scripts +cd ${HOME}/dev/TS.ITS/scripts sed --in-place 's/sudo/echo "etsi" \| sudo -S/' ./run_mtc.bash sed --in-place 's/sudo/echo "etsi" \| sudo -S/' ./run_ptcs.bash diff --git a/virtualization/vagrant/provisioner.bash b/virtualization/vagrant/provisioner.bash index 12024d2..9dee974 100755 --- a/virtualization/vagrant/provisioner.bash +++ b/virtualization/vagrant/provisioner.bash @@ -175,6 +175,7 @@ cd certgen/ && make && cd - # Generate ETSI ITS certificates cd /home/vagrant/dev/TS.ITS/data/certificates CERTGEN=${HOME}/dev/itscertgen make +CERTGEN=${HOME}/dev/itscertgen install cd ${OLD_PWD} -- GitLab From 20a3697297f6b0747a4fb126d0fbdb0e7259eee8 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 23 Jun 2022 15:33:42 +0200 Subject: [PATCH 020/178] Closed bug issue #2 (https://forge.etsi.org/rep/ITS/TS.ITS/-/issues/2) --- ccsrc/Externals/LibItsSecurity_externals.cc | 135 ++++++++++++++++++++ 1 file changed, 135 insertions(+) diff --git a/ccsrc/Externals/LibItsSecurity_externals.cc b/ccsrc/Externals/LibItsSecurity_externals.cc index b398619..bad96ff 100644 --- a/ccsrc/Externals/LibItsSecurity_externals.cc +++ b/ccsrc/Externals/LibItsSecurity_externals.cc @@ -255,6 +255,57 @@ namespace LibItsSecurity__Functions { return OCTETSTRING(0, nullptr); } + /** + * \fn OCTETSTRING fx__signWithEcdsaNistp384WithSha384(const OCTETSTRING& p__toBeSignedSecuredMessage, const OCTETSTRING& p__privateKey); + * \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature based on standard IEEE 1609.2 + * \param[in] p__toBeSignedSecuredMessage The data to be signed + * \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate + * \param[in] p__privateKey The private key + * \return The signature value + */ + OCTETSTRING fx__signWithEcdsaNistp384WithSha384(const OCTETSTRING &p__toBeSignedSecuredMessage, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__privateKey) { + loggers::get_instance().log_msg(">>> fx__signWithEcdsaNistp384WithSha384: data=", p__toBeSignedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__signWithEcdsaNistp384WithSha384: issuer=", p__certificateIssuer); + loggers::get_instance().log_msg(">>> fx__signWithEcdsaNistp384WithSha384: private key=", p__privateKey); + + // Sanity checks + if ((p__certificateIssuer.lengthof() != 48) || (p__privateKey.lengthof() != 48)) { + loggers::get_instance().log("fx__signWithEcdsaNistp384WithSha384: Wrong parameters"); + return OCTETSTRING(0, nullptr); + } + + // Calculate the SHA384 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha384 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeSignedSecuredMessage, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 48)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha384_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Calculate the signature + security_ecc k(ec_elliptic_curves::nist_p_384, p__privateKey); + OCTETSTRING r_sig; + OCTETSTRING s_sig; + if (k.sign(hashData, r_sig, s_sig) == 0) { + OCTETSTRING os = r_sig + s_sig; + loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: r_sig= ", r_sig); + loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: s_sig= ", s_sig); + loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: sig= ", os); + return os; + } + + return OCTETSTRING(0, nullptr); + } + /** * \fn BOOLEAN fx__verifyWithEcdsaNistp256WithSha256(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& * p__ecdsaNistp256PublicKeyCompressed); \brief Verify the signature of the specified data based on standard IEEE 1609.2 \param[in] p__toBeVerifiedData The @@ -542,6 +593,90 @@ namespace LibItsSecurity__Functions { return FALSE; } + /** + * \fn BOOLEAN fx__verifyWithEcdsaNistp384WithSha384(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& + * p__ecdsaBrainpoolp384PublicKeyCompressed); \brief Verify the signature of the specified data based on standard IEEE 1609.2 \param[in] p__toBeVerifiedData + * The data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate \param[in] + * p__signature The signature \param[in] p__ecdsaBrainpoolp384PublicKeyCompressed The compressed public key (x coordinate only) \return true on success, false + * otherwise + */ + BOOLEAN fx__verifyWithEcdsaNistp384WithSha384(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaNistp384PublicKeyCompressed, + const INTEGER &p__compressedMode) { + // Sanity checks + if ((p__certificateIssuer.lengthof() != 48) || (p__signature.lengthof() != 96) || (p__ecdsaNistp384PublicKeyCompressed.lengthof() != 48)) { + loggers::get_instance().log("fx__verifyWithEcdsaNistp384WithSha384: Wrong parameters"); + return FALSE; + } + + // Calculate the SHA384 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha384 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeVerifiedData, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 48)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha384_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Check the signature + security_ecc k(ec_elliptic_curves::nist_p_384, p__ecdsaNistp384PublicKeyCompressed, + (p__compressedMode == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); + if (k.sign_verif(hashData, p__signature) == 0) { + return TRUE; + } + + return FALSE; + } + + /** + * \fn BOOLEAN fx__verifyWithEcdsaBrainpoolp384r1WithSha384_1(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& + * p__ecdsaBrainpoolp384PublicKeyX, const OCTETSTRING& p__ecdsaBrainpoolp384PublicKeyY); \brief Verify the signature of the specified data based on standard + * IEEE 1609.2 \param[in] p__toBeVerifiedData The data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in + * case of self signed certificate \param[in] p__signature The signature \param[in] p__ecdsaBrainpoolp384PublicKeyX The public key (x coordinate) \param[in] + * p__ecdsaBrainpoolp384PublicKeyY The public key (y coordinate) \return true on success, false otherwise + */ + BOOLEAN fx__verifyWithEcdsaNistp384WithSha384__1(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaNistp384PublicKeyX, + const OCTETSTRING &p__ecdsaNistp384PublicKeyY) { + // Sanity checks + if ((p__certificateIssuer.lengthof() != 48) || (p__signature.lengthof() != 96) || (p__ecdsaNistp384PublicKeyX.lengthof() != 48) || + (p__ecdsaNistp384PublicKeyY.lengthof() != 48)) { + loggers::get_instance().log("fx__verifyWithEcdsaNistp384WithSha384__1: Wrong parameters"); + return FALSE; + } + + // Calculate the SHA384 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha384 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeVerifiedData, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha384_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384__1: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384__1: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384__1: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Check the signature + security_ecc k(ec_elliptic_curves::nist_p_384, p__ecdsaNistp384PublicKeyX, p__ecdsaNistp384PublicKeyY); + if (k.sign_verif(hashData, p__signature) == 0) { + return TRUE; + } + + return FALSE; + } + /** * \fn OCTETSTRING fx__hmac__sha256(const OCTETSTRING& p__k, const OCTETSTRING& p__m); * \brief Generate a HMAC-SHA256 value based on the provided secret key -- GitLab From fb25e8af26594cc79fef830845d6f49423d49516 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 23 Sep 2022 08:51:10 +0200 Subject: [PATCH 021/178] Reorganize modules before to link with titan-test-system-framework --- ccsrc/EncDec/LibItsHttp_Encdec.cc | 28 - ccsrc/EncDec/module.mk | 4 +- ccsrc/Externals/LibItsSecurity_externals.cc | 2 +- ccsrc/Framework/include/base_time.hh | 73 -- ccsrc/Framework/include/codec_factory.hh | 45 -- .../Framework/include/codec_stack_builder.hh | 75 -- ccsrc/Framework/include/converter.hh | 387 --------- ccsrc/Framework/include/layer.hh | 143 ---- ccsrc/Framework/include/layer_factory.hh | 121 --- .../Framework/include/layer_stack_builder.hh | 66 -- ccsrc/Framework/include/oer_codec.hh | 48 -- ccsrc/Framework/include/per_codec.hh | 50 -- ccsrc/Framework/include/per_codec.t.hh | 26 - ccsrc/Framework/include/registration.hh | 58 -- ccsrc/Framework/include/t_layer.hh | 70 -- ccsrc/Framework/module.mk | 6 - ccsrc/Framework/src/base_time.cc | 13 - ccsrc/Framework/src/codec_stack_builder.cc | 4 - ccsrc/Framework/src/converter.cc | 195 ----- ccsrc/Framework/src/layer_factory.cc | 61 -- ccsrc/Framework/src/params.cc | 152 ---- ccsrc/Ports/LibIts_ports/BTP_ports/BtpPort.cc | 8 +- ccsrc/Ports/LibIts_ports/BTP_ports/BtpPort.hh | 8 +- ccsrc/Ports/LibIts_ports/CAM_ports/CamPort.cc | 12 +- ccsrc/Ports/LibIts_ports/CAM_ports/CamPort.hh | 8 +- .../CAM_ports/UpperTesterPort_CAM.cc | 2 +- .../CAM_ports/UpperTesterPort_CAM.hh | 6 +- .../Ports/LibIts_ports/DENM_ports/DenmPort.cc | 6 +- .../Ports/LibIts_ports/DENM_ports/DenmPort.hh | 2 +- .../DENM_ports/UpperTesterPort_DENM.cc | 2 +- .../DENM_ports/UpperTesterPort_DENM.hh | 6 +- .../GN_ports/GeoNetworkingPort.cc | 10 +- .../GN_ports/GeoNetworkingPort.hh | 8 +- .../GN_ports/UpperTesterPort_GN.cc | 2 +- .../GN_ports/UpperTesterPort_GN.hh | 6 +- .../Ports/LibIts_ports/Http_ports/HttpPort.cc | 12 +- .../Ports/LibIts_ports/Http_ports/HttpPort.hh | 12 +- .../Ports/LibIts_ports/IVIM_ports/IvimPort.cc | 8 +- .../Ports/LibIts_ports/IVIM_ports/IvimPort.hh | 2 +- .../IVIM_ports/UpperTesterPort_IVIM.cc | 2 +- .../IVIM_ports/UpperTesterPort_IVIM.hh | 8 +- .../MapemSpatem_ports/MapemSpatemPort.cc | 6 +- .../UpperTesterPort_MapemSpatem.cc | 2 +- .../UpperTesterPort_MapemSpatem.hh | 6 +- .../Pki_ports/UpperTesterPkiPort.cc | 2 +- .../ConfigRsuSimulatorCodec.cc | 2 +- .../ConfigRsuSimulatorCodec.hh | 4 +- .../ConfigRsuSimulatorPort.cc | 2 +- .../LibIts_ports/Rtcmem_ports/RtcmemPort.cc | 4 +- .../Rtcmem_ports/UpperTesterPort_Rtcmem.cc | 4 +- .../Rtcmem_ports/UpperTesterPort_Rtcmem.hh | 8 +- .../SremSsem_ports/SremSsemPort.cc | 6 +- .../UpperTesterPort_SremSsem.cc | 2 +- .../UpperTesterPort_SremSsem.hh | 6 +- ccsrc/Protocols/BTP/btp_codec.cc | 14 +- ccsrc/Protocols/BTP/btp_codec.hh | 4 +- ccsrc/Protocols/BTP/btp_layer.cc | 56 +- ccsrc/Protocols/BTP/btp_layer.hh | 10 +- ccsrc/Protocols/CAM/cam_codec.cc | 2 +- ccsrc/Protocols/CAM/cam_codec.hh | 4 +- ccsrc/Protocols/CAM_layers/cam_layer.cc | 26 +- ccsrc/Protocols/CAM_layers/cam_layer.hh | 10 +- .../Protocols/Commsignia/commsignia_layer.cc | 12 +- .../Protocols/Commsignia/commsignia_layer.hh | 8 +- ccsrc/Protocols/DENM/denm_codec.cc | 2 +- ccsrc/Protocols/DENM/denm_codec.hh | 4 +- ccsrc/Protocols/DENM_layers/denm_layer.cc | 24 +- ccsrc/Protocols/DENM_layers/denm_layer.hh | 8 +- ccsrc/Protocols/ETH/ethernet_layer.cc | 82 -- ccsrc/Protocols/ETH/ethernet_layer.hh | 48 -- ccsrc/Protocols/ETH/ethernet_layer_factory.hh | 42 - ccsrc/Protocols/ETH/module.mk | 3 - .../GeoNetworking/geonetworking_codec.cc | 20 +- .../GeoNetworking/geonetworking_codec.hh | 4 +- .../GeoNetworking/geonetworking_layer.cc | 114 +-- .../GeoNetworking/geonetworking_layer.hh | 22 +- ccsrc/Protocols/Http/http_codec.cc | 754 ------------------ ccsrc/Protocols/Http/http_codec.hh | 72 -- ccsrc/Protocols/Http/http_layer.cc | 128 --- ccsrc/Protocols/Http/http_layer.hh | 83 -- ccsrc/Protocols/Http/http_layer_factory.hh | 42 - ccsrc/Protocols/Http/module.mk | 3 - ccsrc/Protocols/IVIM/ivim_codec.cc | 2 +- ccsrc/Protocols/IVIM/ivim_codec.hh | 4 +- ccsrc/Protocols/IVIM_layers/ivim_layer.cc | 30 +- ccsrc/Protocols/IVIM_layers/ivim_layer.hh | 10 +- ccsrc/Protocols/LTE/lte_layer.cc | 12 +- ccsrc/Protocols/LTE/lte_layer.hh | 8 +- ccsrc/Protocols/LTE/lte_tcp_layer.cc | 13 +- ccsrc/Protocols/LTE/lte_tcp_layer.hh | 6 +- ccsrc/Protocols/LTE/lte_udp_layer.cc | 4 +- ccsrc/Protocols/LTE/lte_udp_layer.hh | 6 +- ccsrc/Protocols/LTE/uu_amqp.cc | 10 +- ccsrc/Protocols/LTE/uu_amqp.hh | 10 +- ccsrc/Protocols/LTE/uu_interface.hh | 6 +- ccsrc/Protocols/LTE/uu_mqtt.cc | 32 +- ccsrc/Protocols/LTE/uu_mqtt.hh | 18 +- ccsrc/Protocols/LTE/uu_raw.cc | 10 +- ccsrc/Protocols/LTE/uu_raw.hh | 10 +- ccsrc/Protocols/MapemSpatem/mapem_codec.cc | 2 +- ccsrc/Protocols/MapemSpatem/mapem_codec.hh | 4 +- ccsrc/Protocols/MapemSpatem/spatem_codec.cc | 2 +- ccsrc/Protocols/MapemSpatem/spatem_codec.hh | 4 +- .../MapemSpatem_layers/mapem_spatem_layer.cc | 50 +- .../MapemSpatem_layers/mapem_spatem_layer.hh | 10 +- ccsrc/Protocols/Pcap/module.mk | 3 - ccsrc/Protocols/Pcap/pcap_cygwin_layer.cc | 265 ------ ccsrc/Protocols/Pcap/pcap_cygwin_layer.hh | 79 -- ccsrc/Protocols/Pcap/pcap_layer.cc | 276 ------- ccsrc/Protocols/Pcap/pcap_layer.hh | 5 - ccsrc/Protocols/Pcap/pcap_layer_factory.hh | 42 - ccsrc/Protocols/Pcap/pcap_linux_layer.cc | 198 ----- ccsrc/Protocols/Pcap/pcap_linux_layer.hh | 62 -- ccsrc/Protocols/Pcap/pcap_offline_layer.cc | 227 ------ ccsrc/Protocols/Pcap/pcap_offline_layer.hh | 80 -- .../Pcap/pcap_offline_layer_factory.hh | 42 - .../etsi_ts102941_trust_lists_ctl_format.cc | 2 +- .../etsi_ts102941_trust_lists_ctl_format.hh | 4 +- ccsrc/Protocols/Qualcomm/qualcomm_layer.cc | 4 +- ccsrc/Protocols/Qualcomm/qualcomm_layer.hh | 11 +- ccsrc/Protocols/Rtcmem/RtcmemCodec.cc | 2 +- ccsrc/Protocols/Rtcmem/RtcmemCodec.hh | 4 +- ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.cc | 28 +- ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.hh | 8 +- .../etsi_ts102941_base_types_public_keys.hh | 6 +- .../Security/etsi_ts102941_data_codec.hh | 6 +- .../etsi_ts102941_data_content_codec.hh | 6 +- ...02941_types_authorization_inner_request.hh | 6 +- ...2941_types_authorization_inner_response.hh | 6 +- ...1_types_authorization_shared_at_request.hh | 6 +- ..._types_authorization_validation_request.hh | 6 +- ...types_authorization_validation_response.hh | 6 +- ..._ts102941_types_enrolment_inner_request.hh | 6 +- ...ts102941_types_enrolment_inner_response.hh | 6 +- .../etsi_ts103097_certificate_codec.hh | 9 +- .../Security/etsi_ts103097_data_codec.hh | 8 +- ...i_ts103097_tobesigned_certificate_codec.hh | 8 +- .../etsi_ts103097_tobesigned_data_codec.hh | 8 +- .../Security/http_etsi_ieee1609dot2_codec.cc | 2 +- .../Security/http_etsi_ieee1609dot2_codec.hh | 6 +- .../http_etsi_ieee1609dot2_codec_factory.hh | 2 +- ...09dot2_base_types_public_encryption_key.hh | 6 +- ...dot2_base_types_public_verification_key.hh | 6 +- ccsrc/Protocols/Security/security_services.cc | 120 +-- ccsrc/Protocols/Security/security_services.hh | 42 +- ccsrc/Protocols/SremSsem/SremCodec.cc | 2 +- ccsrc/Protocols/SremSsem/SremCodec.hh | 4 +- ccsrc/Protocols/SremSsem/SsemCodec.cc | 2 +- ccsrc/Protocols/SremSsem/SsemCodec.hh | 4 +- .../SremSsem_layers/SremSsemLayer.cc | 54 +- .../SremSsem_layers/SremSsemLayer.hh | 14 +- ccsrc/Protocols/Tcp/module.mk | 3 - ccsrc/Protocols/Tcp/tcp_layer.cc | 259 ------ ccsrc/Protocols/Tcp/tcp_layer.hh | 108 --- ccsrc/Protocols/Tcp/tcp_layer_factory.hh | 41 - ccsrc/Protocols/UDP/module.mk | 4 - ccsrc/Protocols/UDP/udp_layer.cc | 196 ----- ccsrc/Protocols/UDP/udp_layer.hh | 84 -- ccsrc/Protocols/UDP/udp_layer_factory.hh | 42 - .../UpperTester/UpperTesterRtcmemCodec.cc | 8 +- .../UpperTester/UpperTesterRtcmemCodec.hh | 8 +- .../UpperTester/UpperTesterRtcmemLayer.cc | 20 +- .../UpperTester/UpperTesterRtcmemLayer.hh | 16 +- .../UpperTester/UpperTesterSremSsemCodec.cc | 10 +- .../UpperTester/UpperTesterSremSsemCodec.hh | 10 +- .../UpperTester/UpperTesterSremSsemLayer.cc | 18 +- .../UpperTester/UpperTesterSremSsemLayer.hh | 14 +- ccsrc/Protocols/UpperTester/module.mk | 2 +- .../UpperTester/uppertester_cam_codec.cc | 8 +- .../UpperTester/uppertester_cam_codec.hh | 8 +- .../UpperTester/uppertester_cam_layer.cc | 10 +- .../UpperTester/uppertester_cam_layer.hh | 12 +- .../UpperTester/uppertester_debug_layer.cc | 4 +- .../UpperTester/uppertester_debug_layer.hh | 6 +- .../UpperTester/uppertester_denm_codec.cc | 8 +- .../UpperTester/uppertester_denm_codec.hh | 8 +- .../UpperTester/uppertester_denm_layer.cc | 44 +- .../UpperTester/uppertester_denm_layer.hh | 18 +- .../uppertester_geonetworking_codec.cc | 8 +- .../uppertester_geonetworking_codec.hh | 8 +- .../uppertester_geonetworking_layer.cc | 12 +- .../uppertester_geonetworking_layer.hh | 14 +- .../UpperTester/uppertester_ivim_codec.cc | 8 +- .../UpperTester/uppertester_ivim_codec.hh | 8 +- .../UpperTester/uppertester_ivim_layer.cc | 12 +- .../UpperTester/uppertester_ivim_layer.hh | 14 +- .../uppertester_mapem_spatem_codec.cc | 10 +- .../uppertester_mapem_spatem_codec.hh | 10 +- .../uppertester_mapem_spatem_layer.cc | 16 +- .../uppertester_mapem_spatem_layer.hh | 10 +- .../UpperTester/uppertester_pki_codec.cc | 4 +- .../UpperTester/uppertester_pki_codec.hh | 4 +- .../UpperTester/uppertester_pki_layer.hh | 10 +- .../{Framework => framework}/include/codec.hh | 10 +- .../include/data_event_notifier.hh | 4 +- .../include/data_event_observer.hh | 2 +- .../include/params_its.hh} | 73 +- ccsrc/framework/module.mk | 2 + ccsrc/framework/src/params_its.cc | 69 ++ ccsrc/loggers/loggers.cc | 4 - ccsrc/loggers/loggers.hh | 273 ------- ccsrc/loggers/module.mk | 3 - data/certificates/profiles/CERT_IUT_A_RCA.xml | 19 +- etc/AtsPki/AtsPki_Atos.cfg_ | 4 +- etc/AtsPki/AtsPki_Autocrypt.cfg_ | 2 +- etc/AtsPki/AtsPki_Commsignia.cfg_ | 4 +- etc/AtsPki/AtsPki_Ctag.cfg_ | 4 +- etc/AtsPki/AtsPki_Etas.cfg_ | 13 +- etc/AtsPki/AtsPki_Microsec.cfg_ | 4 +- etc/AtsPki/AtsPki_Simu.cfg_ | 6 +- etc/AtsSecurity/AtsSecurity.cfg | 20 +- 211 files changed, 933 insertions(+), 6074 deletions(-) delete mode 100644 ccsrc/EncDec/LibItsHttp_Encdec.cc delete mode 100644 ccsrc/Framework/include/base_time.hh delete mode 100644 ccsrc/Framework/include/codec_factory.hh delete mode 100644 ccsrc/Framework/include/codec_stack_builder.hh delete mode 100644 ccsrc/Framework/include/converter.hh delete mode 100644 ccsrc/Framework/include/layer.hh delete mode 100644 ccsrc/Framework/include/layer_factory.hh delete mode 100644 ccsrc/Framework/include/layer_stack_builder.hh delete mode 100644 ccsrc/Framework/include/oer_codec.hh delete mode 100644 ccsrc/Framework/include/per_codec.hh delete mode 100644 ccsrc/Framework/include/per_codec.t.hh delete mode 100644 ccsrc/Framework/include/registration.hh delete mode 100644 ccsrc/Framework/include/t_layer.hh delete mode 100644 ccsrc/Framework/module.mk delete mode 100644 ccsrc/Framework/src/base_time.cc delete mode 100644 ccsrc/Framework/src/codec_stack_builder.cc delete mode 100644 ccsrc/Framework/src/converter.cc delete mode 100644 ccsrc/Framework/src/layer_factory.cc delete mode 100644 ccsrc/Framework/src/params.cc delete mode 100644 ccsrc/Protocols/ETH/ethernet_layer.cc delete mode 100644 ccsrc/Protocols/ETH/ethernet_layer.hh delete mode 100644 ccsrc/Protocols/ETH/ethernet_layer_factory.hh delete mode 100644 ccsrc/Protocols/ETH/module.mk delete mode 100644 ccsrc/Protocols/Http/http_codec.cc delete mode 100644 ccsrc/Protocols/Http/http_codec.hh delete mode 100644 ccsrc/Protocols/Http/http_layer.cc delete mode 100644 ccsrc/Protocols/Http/http_layer.hh delete mode 100644 ccsrc/Protocols/Http/http_layer_factory.hh delete mode 100644 ccsrc/Protocols/Http/module.mk delete mode 100644 ccsrc/Protocols/Pcap/module.mk delete mode 100644 ccsrc/Protocols/Pcap/pcap_cygwin_layer.cc delete mode 100644 ccsrc/Protocols/Pcap/pcap_cygwin_layer.hh delete mode 100644 ccsrc/Protocols/Pcap/pcap_layer.cc delete mode 100644 ccsrc/Protocols/Pcap/pcap_layer.hh delete mode 100644 ccsrc/Protocols/Pcap/pcap_layer_factory.hh delete mode 100644 ccsrc/Protocols/Pcap/pcap_linux_layer.cc delete mode 100644 ccsrc/Protocols/Pcap/pcap_linux_layer.hh delete mode 100644 ccsrc/Protocols/Pcap/pcap_offline_layer.cc delete mode 100644 ccsrc/Protocols/Pcap/pcap_offline_layer.hh delete mode 100644 ccsrc/Protocols/Pcap/pcap_offline_layer_factory.hh delete mode 100644 ccsrc/Protocols/Tcp/module.mk delete mode 100644 ccsrc/Protocols/Tcp/tcp_layer.cc delete mode 100644 ccsrc/Protocols/Tcp/tcp_layer.hh delete mode 100644 ccsrc/Protocols/Tcp/tcp_layer_factory.hh delete mode 100644 ccsrc/Protocols/UDP/module.mk delete mode 100644 ccsrc/Protocols/UDP/udp_layer.cc delete mode 100644 ccsrc/Protocols/UDP/udp_layer.hh delete mode 100644 ccsrc/Protocols/UDP/udp_layer_factory.hh rename ccsrc/{Framework => framework}/include/codec.hh (86%) rename ccsrc/{Framework => framework}/include/data_event_notifier.hh (65%) rename ccsrc/{Framework => framework}/include/data_event_observer.hh (93%) rename ccsrc/{Framework/include/params.hh => framework/include/params_its.hh} (61%) create mode 100644 ccsrc/framework/module.mk create mode 100644 ccsrc/framework/src/params_its.cc delete mode 100644 ccsrc/loggers/loggers.cc delete mode 100644 ccsrc/loggers/loggers.hh delete mode 100644 ccsrc/loggers/module.mk diff --git a/ccsrc/EncDec/LibItsHttp_Encdec.cc b/ccsrc/EncDec/LibItsHttp_Encdec.cc deleted file mode 100644 index 89fe0d1..0000000 --- a/ccsrc/EncDec/LibItsHttp_Encdec.cc +++ /dev/null @@ -1,28 +0,0 @@ - -#include "LibItsHttp_MessageBodyTypes.hh" - -#include "http_codec.hh" - -#include "loggers.hh" - -namespace LibItsHttp__EncdecDeclarations { - - BITSTRING fx__enc__http__message(const LibItsHttp__TypesAndValues::HttpMessage& p) { - loggers::get_instance().log_msg(">>> fx__enc__http__message: ", (const Base_Type&)p); - - OCTETSTRING os; - http_codec codec; - codec.encode(p, os); - - return oct2bit(os); - } - INTEGER fx__dec__http__message(BITSTRING& pdu, LibItsHttp__TypesAndValues::HttpMessage& p) { - loggers::get_instance().log_msg(">>> fx__dec__http__message: ", pdu); - - OCTETSTRING os = bit2oct(pdu); - http_codec codec; - codec.decode(os, p); - - return 0; - } -} // End of namespace LibItsHttp__EncdecDeclarations diff --git a/ccsrc/EncDec/module.mk b/ccsrc/EncDec/module.mk index 890f857..e99d90e 100644 --- a/ccsrc/EncDec/module.mk +++ b/ccsrc/EncDec/module.mk @@ -25,7 +25,7 @@ sources += \ LibItsBtp_Encdec.cc \ LibItsCam_Encdec.cc \ LibItsDenm_Encdec.cc \ - LibItsHttp_Encdec.cc \ + LibHttp_Encdec.cc \ LibItsMapemSpatem_Encdec.cc \ LibItsSremSsem_Encdec.cc \ LibItsRtcmem_Encdec.cc \ @@ -55,5 +55,5 @@ sources += \ LibItsBtp_Encdec.cc \ LibItsPki_Encdec.cc \ LibItsCam_Encdec.cc \ - LibItsHttp_Encdec.cc + LibHttp_Encdec.cc endif diff --git a/ccsrc/Externals/LibItsSecurity_externals.cc b/ccsrc/Externals/LibItsSecurity_externals.cc index bad96ff..36d0f67 100644 --- a/ccsrc/Externals/LibItsSecurity_externals.cc +++ b/ccsrc/Externals/LibItsSecurity_externals.cc @@ -1369,7 +1369,7 @@ namespace LibItsSecurity__Functions { str += "/"; str += std::string(static_cast(p__configId)); } - params params; + params_its params; params.insert(std::pair(std::string("sec_db_path"), str)); if (security_services::get_instance().setup(params) == -1) { return FALSE; diff --git a/ccsrc/Framework/include/base_time.hh b/ccsrc/Framework/include/base_time.hh deleted file mode 100644 index 03fa8f6..0000000 --- a/ccsrc/Framework/include/base_time.hh +++ /dev/null @@ -1,73 +0,0 @@ -/*! - * \file base_time.hh - * \brief Header file for the control port base_time functionality. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include - -/** - * \class base_time - * \brief This class provides time tools such as getting current time - */ -class base_time { - const unsigned long long its_base_time_ms = 1072915200000L; //! Base time 01/01/2004 12:00am in millseconds - - unsigned long long leap_delay; - - static base_time *_instance; - -private: - base_time() : leap_delay{0} {}; //! Can not be created manually -public: - static inline base_time &get_instance(); - - virtual ~base_time() { - if (_instance != nullptr) - delete _instance; - }; - -public: - inline const unsigned long long get_current_time_ms() const; - inline const unsigned long long get_its_base_time_ms() const; - inline const unsigned long long get_its_current_time_ms() const; - inline const unsigned long long get_its_current_time_us() const; - inline const unsigned long long get_its_current_time_mod_ms() const; - inline void set_leap_delay_us(const unsigned long long p_leap_delay); - inline const unsigned long long get_leap_delay_us() const; -}; // End of class base_time - -// static functions -base_time &base_time::get_instance() { return (_instance != nullptr) ? *_instance : *(_instance = new base_time()); } - -const unsigned long long base_time::get_current_time_ms() const { - return (leap_delay / 1000) + std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); -} - -const unsigned long long base_time::get_its_base_time_ms() const { return base_time::its_base_time_ms; } - -const unsigned long long base_time::get_its_current_time_ms() const { - return (leap_delay / 1000) + std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count() - - base_time::its_base_time_ms; -} - -const unsigned long long base_time::get_its_current_time_us() const { - return leap_delay + std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count() - - base_time::its_base_time_ms * 1000; -} - -const unsigned long long base_time::get_its_current_time_mod_ms() const { - return ((leap_delay / 1000) + std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count() - - base_time::its_base_time_ms) % - 65536; -} - -void base_time::set_leap_delay_us(const unsigned long long p_leap_delay) { leap_delay = p_leap_delay; } - -inline const unsigned long long base_time::get_leap_delay_us() const { return leap_delay; } diff --git a/ccsrc/Framework/include/codec_factory.hh b/ccsrc/Framework/include/codec_factory.hh deleted file mode 100644 index 037247a..0000000 --- a/ccsrc/Framework/include/codec_factory.hh +++ /dev/null @@ -1,45 +0,0 @@ -/*! - * \file codec_factory.hh - * \brief Header file for ITS abstract protocol codec definition. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include -#include -#include -#include - -#include "codec.hh" - -class Record_Type; //! TITAN forward declaration - -/*! - * \class codec_factory - * \brief This class provides a factory class to create codec class instances - * \abstract - */ -class codec_factory { -public: //! \publicsection - /*! - * \fn codec(); - * \brief Default constructor - */ - codec_factory(){}; - /*! - * \fn codec* create_codec(const std::string & type, const std::string & param); - * \brief Create the codecs stack based on the provided codecs stack description (cf. remark) - * \param[in] p_type The provided codecs stack description - * \param[in] p_params Optional parameters - * \return 0 on success, -1 otherwise - * \remark The description below introduces codecs stack in case of ITS project: - * HTTP(codecs=xml:held_codec;html:html_codec,json:json_codec)/TCP(debug=1,server=httpbin.org,port=80,use_ssl=0) - * \pure - */ - virtual codec *create_codec() = 0; -}; // End of class codec_factory diff --git a/ccsrc/Framework/include/codec_stack_builder.hh b/ccsrc/Framework/include/codec_stack_builder.hh deleted file mode 100644 index e3440de..0000000 --- a/ccsrc/Framework/include/codec_stack_builder.hh +++ /dev/null @@ -1,75 +0,0 @@ -/*! - * \file codec_stack_builder.hh - * \brief Header file for ITS protocol stack builder. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include "codec_factory.hh" - -class Record_Type; //! TITAN forward declaration - -/*! - * \class codec_stack_builder - * \brief This class provides a factory class to create Codec class instances - */ -class codec_stack_builder { -private: //! \privatesection - static codec_stack_builder * _instance; //! Smart pointer to the unique instance of the logger framework - std::map _codecs; //! The list of the registered \see t_codec factories - - /*! - * \brief Default constructor - * Create a new instance of the codec_stack_builder class - * \private - */ - codec_stack_builder(){}; // can not be created manually -public: //! \publicsection - /*! - * \fn codec_stack_builder* get_instance(); - * \brief Accessor for the unique instance of the logger framework - * \static - */ - static codec_stack_builder *get_instance() { return _instance ? _instance : _instance = new codec_stack_builder(); }; - - /*! - * \fn void register_codec_factory(const std::string & p_type, codec_factory* p_codec_factory); - * \brief Add a new codec factory - * \param[in] p_type The codec identifier (e.g. GN for the GeoNetworking codec...) - * \param[in] p_codec_factory A reference to the \see codec_factory - * \static - */ - static void register_codec_factory(const std::string &p_type, codec_factory *p_codec_factory) { - codec_stack_builder::get_instance()->_register_codec_factory(p_type, p_codec_factory); - }; - -private: //! \privatesection - /*! - * \fn void _register_codec_factory(const std::string & p_type, codec_factory* p_codec_factory); - * \brief Add a new codec factory - * \param[in] p_type The codec identifier (e.g. GN for the GeoNetworking codec...) - * \param[in] p_codec_factory A reference to the \see codec_factory - */ - void _register_codec_factory(const std::string &p_type, codec_factory *p_codec_factory) { _codecs[p_type] = p_codec_factory; }; - -public: //! \publicsection - /*! - * \fn codec* get_codec(const char* p_codec_name); - * \brief Retrieve the specified codec name from the list of the registered codecs - * \param[in] p_codec_name The codec indentifier - * \return The pointer to the codec object on success, nullptr otherwise - */ - inline codec *get_codec(const char *p_codec_name) { // NOTE A virtual method cannot not be a template ==> polymorphism required here - typename std::map::const_iterator it = _codecs.find(p_codec_name); - if (it != _codecs.cend()) { - return it->second->create_codec(); - } - - return nullptr; - } -}; // End of class codec_stack_builder diff --git a/ccsrc/Framework/include/converter.hh b/ccsrc/Framework/include/converter.hh deleted file mode 100644 index 6070f2d..0000000 --- a/ccsrc/Framework/include/converter.hh +++ /dev/null @@ -1,387 +0,0 @@ -/*! - * \file converter.hh - * \brief Helper class for types converter. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include -#include -#include - -#include -#include -#include - -#include -#include // LONG_MAX, LLONG_MAX -#include -#include // time_t, struct tm, difftime, time, mktime - -/*! - * \class converter - * \brief This class provide a set of methods for types conversions - * \remark Singleton pattern - */ -class converter { - - /*! - * \brief Unique static object reference of this class - */ - static converter *instance; - - /*! - * \brief Default private ctor - */ - converter(){}; - /*! - * \brief Default private dtor - */ - ~converter() { - if (instance != NULL) { - delete instance; - instance = NULL; - } - }; - -public: /*! \publicsection */ - /*! - * \brief Public accessor to the single object reference - */ - inline static converter &get_instance() { - if (instance == NULL) - instance = new converter(); - return *instance; - }; - -public: - /*! - * \enum endian_t - * \brief Endianess style - */ - typedef enum { big_endian, little_endian } endian_t; - -public: - /*! - * \brief Convert a Binary Coded Decimal value into a binary value - * \param[in] p_value The BDC value - * \return The binary value - * \inline - */ - inline uint8_t bcd_to_bin(const uint8_t p_value) { return ((p_value / 16 * 10) + (p_value % 16)); }; - - /*! - * \brief Convert a binary value into a Binary Coded Decimal value - * \param[in] p_value The binary value - * \return The BCD value - * \inline - */ - inline uint8_t bin_to_bcd(const uint8_t p_value) { return ((p_value / 10 * 16) + (p_value % 10)); }; - - /*! - * \brief Swap two bytes length value (e.g. 0xCAFE becomes 0xFECA) - * \param[in] p_value The value to swap - * \return The swapped value - * \inline - */ - uint16_t swap(const uint16_t p_value); - inline int16_t swap(const int16_t p_value) { return static_cast(swap(static_cast(p_value))); }; - /*! - * \brief Swap four bytes length value (used for littel endian / big endian) - * \param[in] p_value The value to swap - * \return The swapped value - */ - uint32_t swap(const uint32_t p_value); - inline int32_t swap(const int32_t p_value) { return static_cast(swap(static_cast(p_value))); }; - - /*! - * \brief Convert a string into an hexadecimal string - * \param[in] p_value The string value - * \return The hexadecimal value - */ - std::string string_to_hexa(const std::string &p_value, const bool p_uppercase = false); - /*! - * \brief Convert a bytes array int32_t an hexadecimal string - * \param[in] p_value The bytes array value - * \return The hexadecimal value - */ - std::string bytes_to_hexa(const std::vector &p_value, const bool p_uppercase = false); - /*! - * \brief Convert an hexadecimal string into a bytes array - * \param[in] p_value The hexadecimal value - * \return The bytes array value - */ - std::vector hexa_to_bytes(const std::string &p_value); - - /*! - * \brief Convert a time in time_t format into a string formated according to RFC 822, 1036, 1123, 2822 - * \param[in] p_time The time to convert in time_t format - * \return The time string formated - * \see http://www.unixtimestamp.com/ - * @code - * std::string result = time_to_string(1489755780); - * result.compare("Fri, 17 Mar 2017 13:03:00 +0000") == 0 // When time zone is set to UTC - * @endcode - * \remark Use commands 1) timedatectl to change your machine timezone (e.g. sudo timedatectl set-timezone UTC to change machine timezone to UTC, 2) - * timedatectl list-timezones to get the list of the timezones) - */ - std::string time_to_string(const time_t p_time); - /*! - * \brief Convert a time in struct tm format into a string formated according to RFC 822, 1036, 1123, 2822 - * \param[in] p_time The time to convert in struct tm format - * \return The time string formated - * \see http://www.unixtimestamp.com/ - */ - std::string time_to_string(const struct tm &p_time); - - /*! - * \brief Convert a 16-bits integer (int16_t) into a bytes array - * \param[in] p_value The 16-bits integer value - * \param[in] p_endianess Endianess style. Default: big_endian - * \return The bytes array value - */ - inline std::vector short_to_bytes(const int16_t p_value, const endian_t p_endianess = big_endian) const { - std::vector result(sizeof(short), 0x00); - for (int i = sizeof(short) - 1; i >= 0; i--) { - int offset = (sizeof(short) - 1 - i) * 8; - result[i] = static_cast((p_value >> offset) & 0xFF); - } // End of 'for' statement - return result; - }; // End of short_to_bytes - - /*! - * \brief Convert a bytes array into a 16-bits integer (int16_t) - * \param[in] p_value The bytes array - * \param[in] p_endianess Endianess style. Default: big_endian - * \return The 16-bits integer on success, SHRT_MAX on error (wrong bytes array size) - */ - inline int16_t bytes_to_short(const std::vector &p_value, const endian_t p_endianess = big_endian) const { - // Sanity check - if (p_value.size() > sizeof(short)) { - return SHRT_MAX; - } - int16_t value = 0; - for (size_t i = 0; i < p_value.size(); i++) { - value = (value << 8) + (p_value[i] & 0xff); - } // End of 'for' statement - return value; - }; // End of bytes_to_short - - /*! - * \brief Convert a 32-bits integer (int32_t) into a bytes array - * \param[in] p_value The 32-bits integer value - * \param[in] p_endianess Endianess style. Default: big_endian - * \return The bytes array value - */ - inline std::vector int_to_bytes(const int32_t p_value, const endian_t p_endianess = big_endian) const { - /*uint8_t bytes[sizeof(p_value)]; - std::copy( - static_cast(static_cast(&p_value)), - static_cast(static_cast(&p_value)) + sizeof(p_value), - bytes - ); - std::vector result(bytes, bytes + sizeof(bytes) / sizeof(uint8_t));*/ - std::vector result(sizeof(int), 0x00); - for (int i = sizeof(int) - 1; i >= 0; i--) { - int offset = (sizeof(int) - 1 - i) * 8; - result[i] = static_cast((p_value >> offset) & 0xFF); - } // End of 'for' statement - return result; - }; // End of int_to_bytes - - /*! - * \brief Convert a bytes array into a 32-bits integer (int32_t) - * \param[in] p_value The bytes array - * \param[in] p_endianess Endianess style. Default: big_endian - * \return The 32-bits integer on success, LONG_MAX on error (wrong bytes array size) - */ - inline int32_t bytes_to_int(const std::vector &p_value, const endian_t p_endianess = big_endian) const { - // Sanity check - if (p_value.size() > sizeof(int)) { - return INT_MAX; - } - int32_t value = 0; - for (size_t i = 0; i < p_value.size(); i++) { - value = (value << 8) + (p_value[i] & 0xff); - } // End of 'for' statement - return value; - // return *((int *)(&p_value[0])); - }; // End of bytes_to_int - - /*! - * \brief Convert a 64-bits integer (int64_t) into a bytes array - * \param[in] p_value The 64-bits integer value - * \param[in] p_endianess Endianess style. Default: big_endian - * \return The bytes array value - */ - inline std::vector long_to_bytes(const int64_t p_value, const endian_t p_endianess = big_endian) const { - /*uint8_t bytes[sizeof(p_value)]; - std::copy( - static_cast(static_cast(&p_value)), - static_cast(static_cast(&p_value)) + sizeof(p_value), - bytes - ); - std::vector result(bytes, bytes + sizeof(bytes) / sizeof(uint8_t));*/ - std::vector result(sizeof(int64_t), 0x00); - for (int i = sizeof(int64_t) - 1; i >= 0; i--) { - int offset = (sizeof(int64_t) - 1 - i) * 8; - result[i] = static_cast((p_value >> offset) & 0xFF); - } // End of 'for' statement - return result; - }; // End of long_to_bytes - - /*! - * \brief Convert a bytes array into a 64-bits integer (int64_t) - * \param[in] p_value The bytes array - * \param[in] p_endianess Endianess style. Default: big_endian - * \return The 64-bits integer on success, LLONG_MAX on error (wrong bytes array size) - */ - inline int64_t bytes_to_long(const std::vector &p_value, const endian_t p_endianess = big_endian) const { - // Sanity check - if (p_value.size() > sizeof(int64_t)) { - return LLONG_MAX; - } - int64_t value = 0; - for (size_t i = 0; i < p_value.size(); i++) { - value = (value << 8) + (p_value[i] & 0xff); - } // End of 'for' statement - return value; - // return *((long *)(&p_value[0])); - }; // End of bytes_to_long - - /*! - * \brief Convert a float value into a bytes array - * \param[in] p_value The float value - * \return The bytes array value - */ - inline std::vector float_to_bytes(const float p_value) const { - uint8_t bytes[sizeof(p_value)]; - std::copy(static_cast(static_cast(&p_value)), - static_cast(static_cast(&p_value)) + sizeof(p_value), bytes); - std::vector result(bytes, bytes + sizeof(bytes) / sizeof(uint8_t)); - return result; - }; // End of float_to_long - - /*! - * \brief Convert a bytes array into a float - * \param[in] p_value The bytes array - * \return The float value - */ - inline float bytes_to_float(const std::vector &p_value) const { return *((float *)(&p_value[0])); }; // End of bytes_to_float - - /*! - * \brief Convert a string into a bytes array - * \param[in] p_value The string value - * \return The bytes array value - */ - inline std::vector string_to_bytes(const std::string &p_value) const { - return std::vector(p_value.begin(), p_value.end()); - }; // End of string_to_bytes - - /*! - * \brief Convert a bytes array into a string - * \param[in] p_value The bytes array value - * \return The string value - */ - inline std::string bytes_to_string(const std::vector &p_value) const { - return std::string(p_value.begin(), p_value.end()); - }; // End of bytes_to_string - -public: - /*! - * \brief Convert a string into an integer - * \param[in] p_value The string value - * \return The integer value - */ - inline int32_t string_to_int(const std::string &p_value) const { - return std::stoi(p_value); - // return atoi(p_value.c_str()); - }; // End of string_to_int - - /*! - * \brief Convert an integer into a string - * \param[in] p_value The integer value - * \return The string value - */ - inline std::string int_to_string(const int32_t &p_value) const { - std::ostringstream ss; - ss << p_value; - return ss.str(); - }; // End of string_to_bytes - - /*! - * \brief Convert a string in to lower case - * \param[in/out] p_value The string value to convert - */ - inline void to_lower(std::string &p_value) { std::transform(p_value.begin(), p_value.end(), p_value.begin(), ::tolower); } - - /*! - * \brief Convert a string in to upper case - * \param[in/out] p_value The string value to convert - */ - inline void to_upper(std::string &p_value) { std::transform(p_value.begin(), p_value.end(), p_value.begin(), ::toupper); } - -public: - /*! - * \brief Returns a copy of the string, with leading and trailing special characters omitted - * \param[in] p_value The string value - * \param[in] p_trim_chars The special characters to be omitted. Default: ' ' and TAB - * \return The new string value - */ - std::string trim(const std::string &p_value, const std::string &p_trim_chars = " \t"); - - /*! - * \brief Convert the provided string into a list of arguments - * \param[in] p_value The string value - * \param[in] p_separator The separator sequence to use for the spliting process - * \return The item list - * \code{.cc} - * std::string str = "This is a test for spliting a string with a white spave"; - * std::vector tokens = converter::get_instance().split(str, " "); - * std::clog << "Tokens: " << std::endl; - * for (auto it = tokens.begin(); it != tokens.end(); ++it) { - * std::clog << " " << *it << std::endl; - * } - * \endcode - */ - std::vector split(const std::string &p_value, const std::string &p_separator); - - /*! - * \brief Convert the provided string into a list of arguments - * \param[in] p_value The string value - * \return The arguments list - * \code{.cc} - * std::string str = "--host localhost --port 12345 --duration -1"; - * std::vector tokens = converter::get_instance().split_arguments_line(str); - * std::clog << "Tokens: " << std::endl; - * for (auto it = tokens.begin(); it != tokens.end(); ++it) { - * std::clog << " " << *it << std::endl; - * } - * \endcode - */ - std::vector split_arguments_line(const std::string &p_value); - - /*! - * \brief Convert the provided buffer into a Base64 - * \param[in] p_value The buffer value - * \return The Base64 encoded buffert - */ - std::vector buffer_to_base64(const std::vector &p_value); - - /*! - * \brief Convert the provided Base64 buffer - * \param[in] p_value The buffer value - * \return The Base64 encoded buffert - */ - std::vector base64_to_buffer(const std::vector &p_value); - - static const std::string lut_u; - static const std::string lut_l; - static const std::string base64_enc_map; - -}; // End of class converter diff --git a/ccsrc/Framework/include/layer.hh b/ccsrc/Framework/include/layer.hh deleted file mode 100644 index d964e4d..0000000 --- a/ccsrc/Framework/include/layer.hh +++ /dev/null @@ -1,143 +0,0 @@ -/*! - * \file layer.hh - * \brief Header file for ITS abstract protocol layer definition. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include -#include -#include -#include - -#include "params.hh" - -class OCTETSTRING; //! Forward declaration of TITAN class -class BITSTRING; //! Forward declaration of TITAN class -class CHARSTRING; //! Forward declaration of TITAN class -class INTEGER; //! Forward declaration of TITAN class - -/*! - * \class layer - * \brief This class provides basic description of an ITS protocol layer - */ -class layer { - std::vector upperLayers; //! List of the upper protocol layers - std::vector lowerLayers; //! List of the lower protocol layers - -protected: - std::string type; //! Type description, it indicates the protocol type (e.g. CAM, DENM, GN, ETH, PCAP...) - -public: //! \publicsection - /*! - * \brief Default constructor - * Create a new instance of the layer class - */ - explicit layer() : upperLayers(), lowerLayers(), type(std::string("")){}; - - /*! - * \brief Specialized constructor - * Create a new instance of the layer class with its type description - * \param[in] p_type The port type name (e.g. GN for the GeoNetworking layer) - * \remark This constructor is called by the layer factory - * \see layer_factory - */ - explicit layer(const std::string &p_type) : upperLayers(), lowerLayers(), type(std::string(p_type.begin(), p_type.end())){}; - - /*! - * \brief Default destructor - * \todo Remove logs - */ - virtual ~layer() { - // Double linked list, only remove layers in lowerLayers from the lowest one - std::for_each(lowerLayers.rbegin(), lowerLayers.rend(), [](layer *it) { delete it; }); - lowerLayers.clear(); - upperLayers.clear(); - }; - - /*! - * \fn void delete_layer(); - * \brief Delete this layer - * \todo To be implemented - */ - void delete_layer(){}; - -public: //! \publicsection - /*! - * \inline - * \fn void add_upper_layer(layer* p_layer); - * \brief Add a new layer in the list of the upper layer - * \param[in] p_layer The layer protocol to be removed - */ - inline void add_upper_layer(layer *p_layer) { - if (p_layer != NULL) { - upperLayers.push_back(p_layer); - p_layer->lowerLayers.push_back(this); - }; - }; - - /*! - * \fn void remove_upper_layer(layer* p_layer); - * \brief Remove the specified upper layer protocol from the list of the upper layer - * \param[in] p_layer The layer protocol to be removed - * \todo To be implemented - */ - void remove_upper_layer(layer *p_layer){}; - - /*! - * \virtual - * \fn void send_data(OCTETSTRING& data, params& params); - * \brief Send bytes formated data to the lower layers - * \param[in] p_data The data to be sent - * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters - * \todo Remove the logs - * \virtual - */ - virtual void send_data(OCTETSTRING &p_data, params &p_params){}; - - /*! - * \virtual - * \fn void receive_data(OCTETSTRING& data, params& params); - * \brief Receive bytes formated data from the lower layers - * \param[in] p_data The bytes formated data received - * \param[in] p_params Some lower layers parameters values when data was received - * \todo Remove the logs - * \virtual - */ - virtual void receive_data(OCTETSTRING &p_data, params &p_params) {} - - /*! - * \inline - * \fn const std::string& to_string(); - * \brief Remove the specified upper layer protocol from the list of the upper layer - * \param[in] The layer protocol to be removed - */ - inline const std::string &to_string() const { return type; }; - -protected: //! \protectedsection - inline void to_all_layers(std::vector &layers, OCTETSTRING &data, params ¶ms) { - for (std::vector::const_iterator it = layers.cbegin(); it != layers.cend(); ++it) { - layer *p = *it; - p->receive_data(data, params); // FIXME BUG I - } // End of 'for' statement - }; - - inline void receive_to_all_layers(OCTETSTRING &data, params ¶ms) { - for (std::vector::const_iterator it = upperLayers.cbegin(); it != upperLayers.cend(); ++it) { - layer *p = *it; - p->receive_data(data, params); - } // End of 'for' statement - }; - - inline void send_to_all_layers(OCTETSTRING &data, params ¶ms) { - for (std::vector::const_iterator it = lowerLayers.cbegin(); it != lowerLayers.cend(); ++it) { - layer *p = *it; - p->send_data(data, params); - } // End of 'for' statement - }; -}; // End of class layer diff --git a/ccsrc/Framework/include/layer_factory.hh b/ccsrc/Framework/include/layer_factory.hh deleted file mode 100644 index 7b8ac35..0000000 --- a/ccsrc/Framework/include/layer_factory.hh +++ /dev/null @@ -1,121 +0,0 @@ -/*! - * \file layer_factory.hh - * \brief Header file for ITS abstract protocol layer definition. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include -#include -#include -#include - -#include "layer.hh" - -/*! - * \class layer_factory - * \brief This class provides a factory class to create layer class instances - * \abstract - */ -class layer_factory { -public: //! \publicsection - /*! - * \fn codec(); - * \brief Default constructor - */ - layer_factory(){}; - /*! - * \fn layer* create_layer(const std::string & type, const std::string & param); - * \brief Create the layers stack based on the provided layers stack description (cf. remark) - * \param[in] p_type The provided layers stack description - * \param[in] p_params Optional parameters - * \return 0 on success, -1 otherwise - * \remark The description below introduces layers stack in case of ITS project: - * CAM layer - * next_header : btpA|btpB (overwrite BTP.type) - * header_type : tsb|gbc - * header_sub_type : sh (single hop) - * DENM layer - * next_header : btpA|btpB (overwrite BTP.type) - * header_type : tsb|gbc - * BTP layer - * type : btpA|btpB - * destination port: dst_port - * source port : src_port - * device_mode : Set to 1 if the layer shall encapsulate upper layer PDU - * GN layer - * its_aid : ITS AID as defined by ETSI TS 102 965 V1.2.1. Default: 141 - * ll_address : GeoNetworking address of the Test System - * latitude : latitude of the Test System - * longitude : longitude of the Test System - * beaconing : Set to 1 if GnLayer shall start beaconing - * Beaconing timer expiry : expiry (ms) - * device_mode : Set to 1 if the layer shall encapsulate upper layer PDU - * secured_mode : Set to 1 if message exchanges shall be signed - * encrypted_mode : Set to 1 if message exchanges shall be encrypted - * NOTE: For signed & encrypted message exchanges, both secured_mode and encrypted_mode shall be set to 1 - * certificate : Certificate identifier the Test Adapter shall use - * secure_db_path : Path to the certificates and keys storage location - * hash : Hash algorithm to be used when secured mode is set - * Authorized values are SHA-256 or SHA-384 - * Default: SHA-256 - * signature : Signature algorithm to be used when secured mode is set - * Authorized values are NISTP-256, BP-256 and BP-384 - * Default: NISTP-256 - * cypher : Cyphering algorithm to be used when secured mode is set - * Ethernet layer - * mac_src :Source MAC address - * mac_bc :Broadcast address - * eth_type : Ethernet type - * Commsignia layer - * mac_src : Device MAC address, used to discard packets - * To indicate no filering, use the value 000000000000 - * mac_bc : Broadcast address - * eth_type : Ethernet type, used to discard packets - * target_host : Device address - * target_port : Device port - * source_port : Test System port - * interface_id: Interface id, used to discard packets - * tx_power : TX power (dB) - * UDP layer (IP/UDP based on Pcap) - * dst_ip : destination IPv4 address (aa.bb.cc.dd) - * dst_port: destination port - * src_ip : source IPv4 address (aa.bb.cc.dd) - * src_port: source port - * Pcap layer - * mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System - * filter : Pcap filter (compliant with tcpdump syntax) - * E.g. filter=and ether src 04e548000001 - * Online mode: - * nic: Local NIC - * If set, online mode is used - * Offline mode (nic is present but not set): - * file : File to read - * frame_offset: Frame offset, used to skip packets with frame number < frame_offset - * time_offset : Time offset, used to skip packets with time offset < time_offset - * save_mode : 1 to save sent packet, 0 otherwise - * Here are some examples: - * GeoNetworking multiple component case: - * NodeB.geoNetworkingPort.params := -"GN(ll_address=04e548000001,latitude=43551050,longitude=10298730,beaconing=0,expiry=1000,its_aid=141)/COMMSIGNIA(mac_src=04e548000001,mac_bc=FFFFFFFFFFFF,eth_type=8947,target_host=10.200.1.101,target_port=7942,source_port=7943,its_aid=141,interface_id=2,tx_power=-32)/UDP(dst_ip=192.168.56.1,dst_port=12346,src_ip=192.168.156.4,src_port=12345)/ETH(mac_src=04e548000001,mac_dst=0A0027000011,eth_type=0800)/PCAP(mac_src=04e548000001,file=/home/vagrant/TriesAndDelete/etsi_its/testdata/TC_AUTO_IOT_DENM_RWW_BV_01_short.pcap,filter=and -(udp port 30000 or udp port 7943))" NodeC.geoNetworkingPort.params := -"GN(ll_address=70b3d5791b48,latitude=43551050,longitude=10298730,beaconing=0,expiry=1000,its_aid=141)/COMMSIGNIA(mac_src=70b3d5791b48,mac_bc=FFFFFFFFFFFF,eth_type=8947,target_host=10.200.1.101,target_port=7942,source_port=7943,its_aid=141,interface_id=2,tx_power=-32)/UDP(dst_ip=192.168.56.1,dst_port=12346,src_ip=192.168.156.4,src_port=12345)/ETH(mac_src=70b3d5791b48,mac_dst=0A0027000011,eth_type=0800)/PCAP(mac_src=70b3d5791b48,file=/home/vagrant/TriesAndDelete/etsi_its/testdata/TC_AUTO_IOT_DENM_RWW_BV_01_short.pcap,filter=and -(udp port 30000 or udp port 7943))" - * NodeB.geoNetworkingPort.params := -"GN(ll_address=04e548000001,latitude=43551050,longitude=10298730,beaconing=0,expiry=1000,its_aid=141)/ETH(mac_src=04e548000001,mac_dst=0A0027000011,eth_type=0800)/PCAP(mac_src=04e548000001,file=/home/vagrant/TriesAndDelete/etsi_its/testdata/TC_AUTO_IOT_DENM_RWW_BV_01.pcap,filter=and -ether src 04e548000001)" #NodeC.geoNetworkingPort.params := -"GN(ll_address=70b3d5791b48,latitude=43551050,longitude=10298730,beaconing=0,expiry=1000,its_aid=141)/ETH(mac_src=70b3d5791b48,mac_dst=0A0027000011,eth_type=0800)/PCAP(mac_src=70b3d5791b48,file=/home/vagrant/TriesAndDelete/etsi_its/testdata/TC_AUTO_IOT_DENM_RWW_BV_01.pcap,filter=and -ether src 70b3d5791b48)" - * UpperTester port based on UDP - * system.utPort.params := -"UT_GN/UDP(dst_ip=192.168.1.1,dst_port=12346,src_ip=192.168.156.4,src_port=12345)/ETH(mac_src=026f8338c1e5,mac_dst=0A0027000011,eth_type=0800)/PCAP(mac_src=0800275c4959,nic=enp0s8,filter=and -udp port 12346)" - * \pure - */ - virtual layer *create_layer(const std::string &p_type, const std::string &p_params) = 0; -}; // End of class layer_factory diff --git a/ccsrc/Framework/include/layer_stack_builder.hh b/ccsrc/Framework/include/layer_stack_builder.hh deleted file mode 100644 index 2d1b25a..0000000 --- a/ccsrc/Framework/include/layer_stack_builder.hh +++ /dev/null @@ -1,66 +0,0 @@ -/*! - * \file layer_stack_builder.hh - * \brief Header file for ITS protocol stack builder. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include "layer_factory.hh" - -/*! - * \class layer_stack_builder - * \brief This class provides a factory class to create Layer class instances - */ -class layer_stack_builder { -private: //! \privatesection - typedef std::map LayerFactoryMap; - - static layer_stack_builder * _instance; //! Smart pointer to the unique instance of the logger framework - std::map _layer_factories; //! The list of the registered \see t_layer factories - - /*! - * \brief Default constructor - * Create a new instance of the layer_stack_builder class - * \private - */ - layer_stack_builder(); // can not be created manually -public: //! \publicsection - /*! - * \fn layer_stack_builder* get_instance(); - * \brief Accessor for the unique instance of the logger framework - * \static - */ - static layer_stack_builder *get_instance(); - - /*! - * \fn void register_layer_factory(const std::string & p_type, layer_factory* p_layer_factory); - * \brief Add a new layer factory - * \param[in] p_type The layer identifier (e.g. GN for the GeoNetworking layer...) - * \param[in] p_layer_factory A reference to the \see layer_factory - * \static - */ - static void register_layer_factory(const std::string &p_type, layer_factory *p_layer_factory); - -private: //! \privatesection - /*! - * \fn void _register_layer_factory(const std::string & p_type, layer_factory* p_layer_factory); - * \brief Add a new layer factory - * \param[in] p_type The layer identifier (e.g. GN for the GeoNetworking layer...) - * \param[in] p_layer_factory A reference to the \see layer_factory - */ - void _register_layer_factory(const std::string &p_type, layer_factory *p_layer_factory); - -public: //! \publicsection - /*! - * \fn layer* create_layer_stack(const char* p_layer_stack_description); - * \brief Add a new layer factory - * \param[in] p_layer_stack_description A textual description of the layer to create - * \return The created layer object on success, nullptr otherwise - */ - layer *create_layer_stack(const char *p_layer_stack_description); -}; // End of class layer_stack_builder diff --git a/ccsrc/Framework/include/oer_codec.hh b/ccsrc/Framework/include/oer_codec.hh deleted file mode 100644 index 51a32cd..0000000 --- a/ccsrc/Framework/include/oer_codec.hh +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include "params.hh" - -class OCTETSTRING; -class CHARSTRING; -class BITSTRING; - -struct asn_TYPE_descriptor_s; -class asn1_recode_oer { -protected: - int xer2oer(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf); - int oer2xer(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf); - int recode(const asn_TYPE_descriptor_s &td, int from, int to, TTCN_Buffer &buf); -}; - -template class oer_codec : public asn1_recode_oer { -public: - virtual int encode(const TPDU &msg, BITSTRING &bits) = 0; - virtual int decode(const BITSTRING &bits, TPDU &msg) = 0; - -protected: - inline int _decode(const TTCN_Typedescriptor_t &ttcn, const asn_TYPE_descriptor_s &td, const BITSTRING &p_data, TPDU &msg) { - TTCN_Buffer buf(bit2oct(p_data)); - TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); - int rc = oer2xer(td, buf); - if (rc > 0) { - msg.decode(ttcn, buf, TTCN_EncDec::CT_BER, BER_ACCEPT_ALL); - rc = buf.get_len(); - } - return rc; - } - inline int _encode(const TTCN_Typedescriptor_t &ttcn, const asn_TYPE_descriptor_s &td, const TPDU &msg, BITSTRING &p_data) { - int rc = -1; - TTCN_Buffer buf; - TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); - msg.encode(ttcn, buf, TTCN_EncDec::CT_BER, BER_ENCODE_DER); - if (buf.get_len() > 0) { - rc = xer2oer(td, buf); - if (rc > 0) { - p_data = oct2bit(OCTETSTRING(buf.get_len(), buf.get_data())); - } - } - return rc; - } -}; - -#endif diff --git a/ccsrc/Framework/include/per_codec.hh b/ccsrc/Framework/include/per_codec.hh deleted file mode 100644 index 077d74a..0000000 --- a/ccsrc/Framework/include/per_codec.hh +++ /dev/null @@ -1,50 +0,0 @@ -/*! - * \file per_codec.hh - * \brief Header file for TITAN message to ASN.1 PER message codec. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include "asn1_recode_per.hh" -#include "params.hh" - -class BITSTRING; //! Forward declaration of TITAN class -class TTCN_Typedescriptor_t; //! Forward declaration of TITAN class - -struct asn_TYPE_descriptor_s; //! Declare asn1c class - -/*! - * \class per_codec - * \brief This class provides the interface for all ASN.1 PER codecs. - * \remark This class uses asn1c external tool - */ -template class per_codec : public asn1_recode_per { -public: //! \publicsection - /*! - * \fn int encode(const TPDU& p_message, BITSTRING& p_bitstring); - * \brief Encode TITAN message into ASN.1 PER message - * \param[in] p_message The PDU message to encode - * \param[out] p_bitstring The encoded PDU message in bit string format - * \pure - */ - virtual int encode(const TPDU &p_message, BITSTRING &p_bitstring) = 0; - /*! - * \fn int decode(const BITSTRING& p_bitstring, TPDU& p_message); - * \brief Decode ASN.1 PER message into TITAN message - * \param[in] p_bitstring The network message in bit string format to decode - * \param[out] p_message The PDU message - * \pure - */ - virtual int decode(const BITSTRING &p_bitstring, TPDU &p_message) = 0; - -protected: //! \protectedsection - int _decode(const TTCN_Typedescriptor_t &ttcn, const asn_TYPE_descriptor_s &td, const BITSTRING &p_data, TPDU &msg); - int _encode(const TTCN_Typedescriptor_t &ttcn, const asn_TYPE_descriptor_s &td, const TPDU &msg, BITSTRING &p_data); -}; // End of class per_codec - -#include "per_codec.t.hh" diff --git a/ccsrc/Framework/include/per_codec.t.hh b/ccsrc/Framework/include/per_codec.t.hh deleted file mode 100644 index 6973dc6..0000000 --- a/ccsrc/Framework/include/per_codec.t.hh +++ /dev/null @@ -1,26 +0,0 @@ -#include - -template int per_codec::_decode(const TTCN_Typedescriptor_t &ttcn, const asn_TYPE_descriptor_s &td, const BITSTRING &p_data, TPDU &msg) { - TTCN_Buffer buf(bit2oct(p_data)); - TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); - int rc = per2ber(td, buf); - if (rc > 0) { - msg.decode(ttcn, buf, TTCN_EncDec::CT_BER, BER_ACCEPT_ALL); - rc = buf.get_len(); - } - return rc; -} - -template int per_codec::_encode(const TTCN_Typedescriptor_t &ttcn, const asn_TYPE_descriptor_s &td, const TPDU &msg, BITSTRING &p_data) { - int rc = -1; - TTCN_Buffer buf; - TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); - msg.encode(ttcn, buf, TTCN_EncDec::CT_BER, BER_ENCODE_DER); - if (buf.get_len() > 0) { - rc = ber2per(td, buf); - if (rc > 0) { - p_data = oct2bit(OCTETSTRING(buf.get_len(), buf.get_data())); - } - } - return rc; -} diff --git a/ccsrc/Framework/include/registration.hh b/ccsrc/Framework/include/registration.hh deleted file mode 100644 index df24ea1..0000000 --- a/ccsrc/Framework/include/registration.hh +++ /dev/null @@ -1,58 +0,0 @@ -/*! - * \file registration.hh - * \brief Header file for the control port registration functionality. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include -#include - -/** - * \class registration - * \brief This class provides a way to register items and its object reference - * The registered items are accessible from any object (singleton pattern) - * \remark There is one limitation: each item is uniquely defined in the process - */ -template class registration { // TODO Refine the naming, derive from std::map - std::map _items; - - static registration *_instance; - -private: - registration() : _items(){}; // can not be created manually -public: - static registration &get_instance(); - - virtual ~registration() { - if (_instance != nullptr) - delete _instance; - }; - -public: - void add_item(const std::string &type, TItem *f); - TItem *get_item(const std::string &type); -}; // End of class registration - -template registration *registration::_instance = nullptr; - -// static functions -template registration ®istration::get_instance() { - return (_instance != nullptr) ? *_instance : *(_instance = new registration()); -} - -template void registration::add_item(const std::string &type, TItem *f) { _items[type] = f; } - -template TItem *registration::get_item(const std::string &type) { - typename std::map::const_iterator it = _items.find(type); - if (it == _items.cend()) { - return nullptr; - } - - return it->second; -} // End of class registration diff --git a/ccsrc/Framework/include/t_layer.hh b/ccsrc/Framework/include/t_layer.hh deleted file mode 100644 index 2934952..0000000 --- a/ccsrc/Framework/include/t_layer.hh +++ /dev/null @@ -1,70 +0,0 @@ -/*! - * \file t_layer.hh - * \brief Header file for ITS abstract protocol layer definition. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include "layer.hh" - -/*! - * \class t_layer - * \brief This class provides basic description of an ITS port protocol layer. - * A port protocol layer is the final layer which provides the access to the physical communication channel - * A port protocol layer derives from both a layer class and a template port class - */ -template class t_layer : public layer { - typedef std::vector TPortList; - typedef typename std::vector::iterator TPortListIterator; - - TPortList upperPorts; //! The list of the upper ports - -public: //! \publicsection - /*! - * \brief Default constructor - * Create a new instance of the t_layer class - * \todo Remove logs - */ - explicit t_layer() : layer(), upperPorts(){}; - - /*! - * \brief Specialized constructor - * Create a new instance of the layer class with its type description - * \param[in] p_type The port type name (e.g. TCP for the TCP sockect based layer) - * \remark This constructor is called by the layer factory - * \see layer_factory - */ - explicit t_layer(const std::string &p_type) : layer(p_type), upperPorts(){}; - /*! - * \inline - * \fn void add_upper_port(TPort * p_port); - * \brief Add a new upper port layer - * \todo To be done - */ - inline void add_upper_port(TPort *p_port) { upperPorts.push_back(p_port); }; - /*! - * \fn void remove_upper_port(TPort*); - * \brief Remove the specified upper layer port protocol from the list of the upper layers - * \param[in] p_layer The layer protocol to be removed - */ - void remove_upper_port(TPort *); - -protected: //! \protectedsection - /*! - * \inline - * \fn void to_all_upper_ports(const TMessage& m, const params& param); - * \brief Forward the message to all available upper port layers - * \param[in] p_message The message to be forwarded - * \param[in] p_params Some lower layers parameters values when data was received - */ - template inline void to_all_upper_ports(const TMessage &p_message, const params &p_params) { - for (TPortListIterator it = upperPorts.begin(); it < upperPorts.end(); ++it) { - (*it)->receiveMsg(p_message, p_params); - } - } -}; // End of class t_layer diff --git a/ccsrc/Framework/module.mk b/ccsrc/Framework/module.mk deleted file mode 100644 index 8592d3c..0000000 --- a/ccsrc/Framework/module.mk +++ /dev/null @@ -1,6 +0,0 @@ -sources := src/base_time.cc \ - src/codec_stack_builder.cc \ - src/converter.cc \ - src/layer_factory.cc \ - src/params.cc -includes += ./include diff --git a/ccsrc/Framework/src/base_time.cc b/ccsrc/Framework/src/base_time.cc deleted file mode 100644 index 3833119..0000000 --- a/ccsrc/Framework/src/base_time.cc +++ /dev/null @@ -1,13 +0,0 @@ -/*! - * \file base_time.cc - * \brief Source file for the control port base_time functionality. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#include "base_time.hh" - -base_time* base_time::_instance = nullptr; diff --git a/ccsrc/Framework/src/codec_stack_builder.cc b/ccsrc/Framework/src/codec_stack_builder.cc deleted file mode 100644 index bb5a706..0000000 --- a/ccsrc/Framework/src/codec_stack_builder.cc +++ /dev/null @@ -1,4 +0,0 @@ -#include "codec_stack_builder.hh" - -codec_stack_builder* codec_stack_builder::_instance = NULL; - diff --git a/ccsrc/Framework/src/converter.cc b/ccsrc/Framework/src/converter.cc deleted file mode 100644 index e9ad4d1..0000000 --- a/ccsrc/Framework/src/converter.cc +++ /dev/null @@ -1,195 +0,0 @@ -#include "converter.hh" -#include -converter *converter::instance = NULL; - -uint16_t converter::swap(const uint16_t p_value) { - uint8_t *ptr = (uint8_t *)&p_value; - return (ptr[0] << 8) | ptr[1]; -} - -uint32_t converter::swap(const uint32_t p_value) { - uint8_t *ptr = (uint8_t *)&p_value; - return (ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | ptr[3]; -} - -const std::string converter::lut_u = "0123456789ABCDEF"; -const std::string converter::lut_l = "0123456789abcdef"; -std::string converter::string_to_hexa(const std::string &p_value, const bool p_uppercase) { - - std::string input(p_value); - std::for_each(input.begin(), input.end(), [](char &c) { c = std::toupper(c); }); - - std::string output; - uint32_t length = p_value.length(); - output.reserve(2 * length); - if (p_uppercase) { // TODO Use pointer to reduce code size - for (uint32_t i = 0; i < length; ++i) { - const uint8_t c = input[i]; - output.push_back(lut_u[c >> 4]); - output.push_back(lut_u[c & 15]); - } // End of 'for' statement - } else { - for (uint32_t i = 0; i < length; ++i) { - const uint8_t c = input[i]; - output.push_back(lut_l[c >> 4]); - output.push_back(lut_l[c & 15]); - } // End of 'for' statement - } - - return output; -} - -std::string converter::bytes_to_hexa(const std::vector &p_value, const bool p_uppercase) { - std::string ret; - ret.assign(p_value.size() * 2, ' '); - if (p_uppercase) { // TODO Use pointer to reduce code size - for (size_t i = 0; i < p_value.size(); i++) { - uint8_t c = p_value[i]; - ret[i * 2] = lut_u[c >> 4]; - ret[i * 2 + 1] = lut_u[c & 0xF]; - } - } else { - for (size_t i = 0; i < p_value.size(); i++) { - uint8_t c = p_value[i]; - ret[i * 2] = lut_l[c >> 4]; - ret[i * 2 + 1] = lut_l[c & 0xF]; - } - } - return ret; -} - -inline uint8_t char2byte(const char p_ch) { - size_t s = converter::lut_l.find(p_ch); - if (s == std::string::npos) { - if ((s = converter::lut_u.find(p_ch)) == std::string::npos) { - throw(std::length_error("")); - } - } - return s; -} - -std::vector converter::hexa_to_bytes(const std::string &p_value) { - // Sanity check - std::vector output; - size_t i = 0, idx = 0, outlen = (p_value.length() + 1) / 2; - - output.assign(outlen, 0x00); - try { - if (p_value.length() & 1) - output[idx++] = char2byte(p_value[i++]); - for (; idx < outlen; idx++) { - uint8_t b0 = char2byte(p_value[i++]); - uint8_t b1 = char2byte(p_value[i++]); - output[idx] = (b0 << 4) | b1; - } - } catch (const std::length_error &le) { - output.clear(); - } - return output; -} - -std::string converter::time_to_string(const time_t p_time) { - struct tm *t = std::localtime(&p_time); - return time_to_string(*t); -} - -std::string converter::time_to_string(const struct tm &p_time) { - char buffer[64] = {0}; - // Format: RFC 822, 1036, 1123, 2822 - std::strftime(buffer, 64, "%a, %d %b %Y %H:%M:%S %z", &p_time); - return std::string(buffer); -} - -std::string converter::trim(const std::string &str, const std::string &whitespace) { - size_t strBegin = str.find_first_not_of(whitespace); - if (strBegin == std::string::npos) - return ""; // no content - - size_t strEnd = str.find_last_not_of(whitespace); - size_t strRange = strEnd - strBegin + 1; - - return str.substr(strBegin, strRange); -} - -std::vector converter::split(const std::string &p_value, const std::string &p_separator) { - std::vector output; - std::size_t current, previous = 0; - current = p_value.find(p_separator); - while (current != std::string::npos) { - output.push_back(p_value.substr(previous, current - previous)); - previous = current + 1; - current = p_value.find(p_separator, previous); - } - output.push_back(p_value.substr(previous, current - previous)); - - return output; -} - -std::vector converter::split_arguments_line(const std::string &p_value) { - std::vector output; - std::string line = trim(p_value); - if (!line.empty() && (line[0] == '-')) { // Valid command line - size_t current = 0; - size_t next = (size_t)-1; - size_t pos = 0; - do { - if (line[pos + 1] == '-') { // -- - current = pos + 2; - } else { - current = pos + 1; - } - next = line.find("-", current); - std::string str(line.substr(pos, next - pos)); - output.push_back(str); - pos = next; - } while (next != std::string::npos); - } // else, invalid command line - return output; -} - -const std::string converter::base64_enc_map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -std::vector converter::buffer_to_base64(const std::vector &p_value) { - std::vector out; - - int val = 0, valb = -6; - for (unsigned char c : p_value) { - val = (val << 8) + c; - valb += 8; - while (valb >= 0) { - out.push_back(converter::base64_enc_map[(val >> valb) & 0x3F]); - valb -= 6; - } // End of 'while' statement - } // End of 'for' statement - if (valb > -6) { - out.push_back(converter::base64_enc_map[((val << 8) >> (valb + 8)) & 0x3F]); - } - while (out.size() % 4) { - out.push_back('='); - } // End of 'while' statement - - return out; -} - -std::vector converter::base64_to_buffer(const std::vector &p_value) { - std::vector out; - - std::vector T(256, -1); - for (int i = 0; i < 64; i++) { - T[converter::base64_enc_map[i]] = i; - } - - int val = 0, valb = -8; - for (unsigned char c : p_value) { - if (T[c] == -1) { - break; - } - val = (val << 6) + T[c]; - valb += 6; - if (valb >= 0) { - out.push_back((unsigned char)char((val >> valb) & 0xFF)); - valb -= 8; - } - } // End of 'for' statement - return out; -} diff --git a/ccsrc/Framework/src/layer_factory.cc b/ccsrc/Framework/src/layer_factory.cc deleted file mode 100644 index ef3ad21..0000000 --- a/ccsrc/Framework/src/layer_factory.cc +++ /dev/null @@ -1,61 +0,0 @@ -#include -#include - -#include "layer_stack_builder.hh" - -#include "loggers.hh" - -layer_stack_builder *layer_stack_builder::_instance = NULL; - -// static functions -layer_stack_builder *layer_stack_builder::get_instance() { return _instance ? _instance : _instance = new layer_stack_builder(); } - -void layer_stack_builder::register_layer_factory(const std::string &p_type, layer_factory *p_layer_factory) { - layer_stack_builder::get_instance()->_register_layer_factory(p_type, p_layer_factory); -} - -// member functions -layer_stack_builder::layer_stack_builder() {} - -void layer_stack_builder::_register_layer_factory(const std::string &p_type, layer_factory *p_layer_factory) { _layer_factories[p_type] = p_layer_factory; } - -layer *layer_stack_builder::create_layer_stack(const char *p_layer_stack_description) { - loggers::get_instance().log(">>> layer_stack_builder::create_layer_stack: %s", p_layer_stack_description); - - layer *entry = NULL; // Initial layer (the first declared) - layer *up = NULL; // Upper layer - // Parse the layer description - try { - std::regex rgx("(\\w+)(\\((.*?)\\))?(\\/|$)"); - std::string str = p_layer_stack_description; - std::sregex_iterator begin(str.cbegin(), str.cend(), rgx); - std::sregex_iterator end = std::sregex_iterator(); - for (std::sregex_iterator it = begin; it != end; ++it) { - std::smatch m = *it; - loggers::get_instance().log("layer_stack_builder::create_layer_stack: %d - %s - %s - %s - %s", m.size(), m[0].str().c_str(), m[1].str().c_str(), - m[2].str().c_str(), m[3].str().c_str()); - LayerFactoryMap::iterator i = _layer_factories.find(m[1].str()); - if (i == _layer_factories.end()) { - loggers::get_instance().error("layer_stack_builder::create_layer_stack: %s: Unknown layer type", m[1].str().c_str()); - } - loggers::get_instance().log("layer_stack_builder::create_layer_stack: Create layer %s, %s", m[1].str().c_str(), m[3].str().c_str()); - layer *l = i->second->create_layer(m[1].str(), m[3].str()); - if (NULL == l) { - loggers::get_instance().error("layer_stack_builder::create_layer_stack: %s: Layer creation error", m[1].str().c_str()); - } - - loggers::get_instance().log("layer_stack_builder::create_layer_stack: Setup layers for %s", l->to_string().c_str()); - l->add_upper_layer(up); - if (entry == NULL) { // Set the first declared layer - entry = l; - } - up = l; // Build the linked list of layers - } // End of 'for' statement - } catch (const std::logic_error &e) { - if (up) { // FIXME To be reviewed - up->delete_layer(); - up = NULL; - } - } - return entry; -} diff --git a/ccsrc/Framework/src/params.cc b/ccsrc/Framework/src/params.cc deleted file mode 100644 index 7ca6566..0000000 --- a/ccsrc/Framework/src/params.cc +++ /dev/null @@ -1,152 +0,0 @@ -/*! - * \file params.cc - * \brief Source file for the parameter dictionary. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#include -#include - -#include "loggers.hh" -#include "params.hh" - -const std::string& params::debug = std::string("debug"); - -const std::string& params::loopback = std::string("loopback"); - -const std::string& params::mac_src = std::string("mac_src"); -const std::string& params::mac_dst = std::string("mac_dst"); -const std::string& params::mac_bc = std::string("mac_bc"); -const std::string& params::eth_type = std::string("eth_type"); -const std::string& params::filter = std::string("filter"); -const std::string& params::beaconing = std::string("beaconing"); -const std::string& params::timestamp = std::string("timestamp"); -const std::string& params::station_type = std::string("station_type"); -const std::string& params::country = std::string("country"); -const std::string& params::type_of_address = std::string("type_of_address"); -const std::string& params::its_aid = std::string("its_aid"); -const std::string& params::ssp = std::string("ssp"); -const std::string& params::gn_payload = std::string("gn_payload"); -const std::string& params::gn_next_header = std::string("gnNextHeader"); -const std::string& params::gn_header_type = std::string("gnHeaderType"); -const std::string& params::gn_header_sub_type = std::string("gnHeaderSubtype"); -const std::string& params::gn_lifetime = std::string("gnLifetime"); -const std::string& params::gn_traffic_class = std::string("gnTrafficClass"); -const std::string& params::btp_type = std::string("btp_type"); -const std::string& params::btp_payload = std::string("btp_payload"); -const std::string& params::btp_destination_port = std::string("dst_port"); -const std::string& params::btp_info = std::string("btp_info"); - -const std::string& params::nic = std::string("nic"); -const std::string& params::latitude = std::string("latitude"); -const std::string& params::longitude = std::string("longitude"); -const std::string& params::ll_address = std::string("ll_address"); -const std::string& params::expiry = std::string("expiry"); - -const std::string& params::station_id = std::string("station_id"); - -const std::string& params::device_mode = std::string("device_mode"); -const std::string& params::secured_mode = std::string("secured_mode"); -const std::string& params::encrypted_mode = std::string("encrypted_mode"); -const std::string& params::enable_security_checks = std::string("enable_security_checks"); -const std::string& params::force_certificate = std::string("force_certificate"); -const std::string& params::certificate = std::string("certificate"); -const std::string& params::peer_certificate = std::string("peer_certificate"); -const std::string& params::sec_db_path = std::string("sec_db_path"); -const std::string& params::hash = std::string("hash"); -const std::string& params::signature = std::string("signature"); -const std::string& params::cypher = std::string("cypher"); -const std::string& params::distanceA = std::string("distanceA"); -const std::string& params::distanceB = std::string("distanceB"); -const std::string& params::angle = std::string("angle"); - -const std::string& params::payload_type = std::string("payload_type"); - -const std::string& params::next_header = std::string("next_header"); -const std::string& params::header_type = std::string("header_type"); -const std::string& params::header_sub_type = std::string("header_sub_type"); - -const std::string& params::interface_id = std::string("interface_id"); - -const std::string& params::uu_protocol = std::string("uu_protocol"); -const std::string& params::uu_transport = std::string("uu_transport"); -const std::string& params::pc5_layer = std::string("pc5_layer"); -const std::string& params::mqtt_topics = std::string("mqtt_topics"); -const std::string& params::mqtt_protocol = std::string("mqtt_protocol"); -const std::string& params::mqtt_client_id = std::string("mqtt_client_id"); - -const std::string& params::server = std::string("server"); -const std::string& params::port = std::string("port"); -const std::string& params::use_ssl = std::string("use_ssl"); -const std::string& params::mutual_auth = std::string("mutual_auth"); -const std::string& params::trusted_ca_list = std::string("trusted_ca_list"); - -const std::string& params::server_mode = std::string("server_mode"); -const std::string& params::local_port = std::string("local_port"); - -const std::string& params::method = std::string("method"); -const std::string& params::uri = std::string("uri"); -const std::string& params::host = std::string("host"); -const std::string& params::content_type = std::string("content_type"); - -// const std::string& params::sip_url = std::string("sip_url"); -// const std::string& params::sip_version = std::string("sip_version"); -// const std::string& params::payload = std::string("payload"); - -const std::string& params::codecs = std::string("codecs"); - -void params::convert(params &p_param, const std::string p_parameters) { - // Sanity checks - if (p_parameters.length() == 0) { - return; - } - loggers::get_instance().log(">>> params::convert: %s", p_parameters.c_str()); - // Extract parameters - try { - std::regex rgx("(\\w+)=(.*?)(,|$)"); - std::sregex_iterator begin(p_parameters.cbegin(), p_parameters.cend(), rgx); - std::sregex_iterator end = std::sregex_iterator(); - for (std::sregex_iterator it = begin; it != end; ++it) { - std::smatch m = *it; - loggers::get_instance().log("params::convert: %d - %s - %s - %s - %s", m.size(), m[0].str().c_str(), m[1].str().c_str(), m[2].str().c_str(), - m[3].str().c_str()); - p_param.insert(std::pair(m[1].str(), m[2].str())); - } // End of 'for' statement - } catch (const std::logic_error &e) { - p_param.clear(); - } - loggers::get_instance().log("<<< params::convert"); -} - -void params::log() const { - loggers::get_instance().log("params::log"); - if (size() == 0) { - loggers::get_instance().log("\tEmpty"); - } else { - for (const_iterator it = cbegin(); it != cend(); ++it) { - loggers::get_instance().log("\t(%s, %s)", it->first.c_str(), it->second.c_str()); - } // End of 'for' statement - } -} - -void params::log() { - loggers::get_instance().log("params::log"); - if (size() == 0) { - loggers::get_instance().log("\tEmpty"); - } else { - for (const_iterator it = cbegin(); it != cend(); ++it) { - loggers::get_instance().log("\t(%s, %s)", it->first.c_str(), it->second.c_str()); - } // End of 'for' statement - } -} - -void params::reset() { - loggers::get_instance().log("params::reset"); - for (iterator it = begin(); it != end(); ++it) { - it->second.clear(); - } // End of 'for' statement -} diff --git a/ccsrc/Ports/LibIts_ports/BTP_ports/BtpPort.cc b/ccsrc/Ports/LibIts_ports/BTP_ports/BtpPort.cc index 6146ed7..eb9f647 100644 --- a/ccsrc/Ports/LibIts_ports/BTP_ports/BtpPort.cc +++ b/ccsrc/Ports/LibIts_ports/BTP_ports/BtpPort.cc @@ -41,11 +41,11 @@ namespace LibItsBtp__TestSystem { void BtpPort::user_map(const char *system_port) { loggers::get_instance().log(">>> BtpPort::user_map: %s", system_port); // Build layer stack - params::iterator it = _cfg_params.find(std::string("params")); + params_its::iterator it = _cfg_params.find(std::string("params")); if (it != _cfg_params.end()) { loggers::get_instance().log("BtpPort::user_map: %s", it->second.c_str()); // Setup parameters - params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless + params_its::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless // Create layer _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); if (static_cast(_layer) == NULL) { @@ -78,8 +78,10 @@ namespace LibItsBtp__TestSystem { loggers::get_instance().set_stop_time(_time_key, duration); } - void BtpPort::receiveMsg(const LibItsBtp__TypesAndValues::BtpInd &p_ind, const params &p_params) { + void BtpPort::receiveMsg(const LibItsBtp__TypesAndValues::BtpInd& p_ind, const params& p_params) { // loggers::get_instance().log_msg(">>> BtpPort::receive_msg: ", p_ind); + const params_its& p = static_cast(p_params); + loggers::get_instance().log(">>> BtpPort::receive_msg: %s", p.btp_destination_port.c_str()); incoming_message(p_ind); } diff --git a/ccsrc/Ports/LibIts_ports/BTP_ports/BtpPort.hh b/ccsrc/Ports/LibIts_ports/BTP_ports/BtpPort.hh index cb00d76..21c8b0d 100644 --- a/ccsrc/Ports/LibIts_ports/BTP_ports/BtpPort.hh +++ b/ccsrc/Ports/LibIts_ports/BTP_ports/BtpPort.hh @@ -13,13 +13,13 @@ #include "LibItsBtp_TestSystem.hh" #include "layer.hh" -#include "params.hh" +#include "params_its.hh" namespace LibItsBtp__TestSystem { class BtpPort : public BtpPort_BASE { - params _cfg_params; - params _layer_params; + params_its _cfg_params; + params_its _layer_params; layer * _layer; std::string _time_key; @@ -29,7 +29,7 @@ namespace LibItsBtp__TestSystem { void set_parameter(const char *parameter_name, const char *parameter_value); - void receiveMsg(const LibItsBtp__TypesAndValues::BtpInd &, const params &); + void receiveMsg(const LibItsBtp__TypesAndValues::BtpInd&, const params&); private: /* void Handle_Fd_Event(int fd, boolean is_readable, diff --git a/ccsrc/Ports/LibIts_ports/CAM_ports/CamPort.cc b/ccsrc/Ports/LibIts_ports/CAM_ports/CamPort.cc index d8fa778..8188d95 100644 --- a/ccsrc/Ports/LibIts_ports/CAM_ports/CamPort.cc +++ b/ccsrc/Ports/LibIts_ports/CAM_ports/CamPort.cc @@ -41,11 +41,11 @@ namespace LibItsCam__TestSystem { void CamPort::user_map(const char *system_port) { loggers::get_instance().log(">>> CamPort::user_map: %s", system_port); // Build layer stack - params::iterator it = _cfg_params.find(std::string("params")); + params_its::iterator it = _cfg_params.find(std::string("params")); if (it != _cfg_params.end()) { loggers::get_instance().log("CamPort::user_map: %s", it->second.c_str()); // Setup parameters - params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless + params_its::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless // Create layer _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); if (static_cast(_layer) == NULL) { @@ -74,13 +74,15 @@ namespace LibItsCam__TestSystem { float duration; loggers::get_instance().set_start_time(_time_key); - params params; + params_its params; static_cast(_layer)->sendMsg(send_par, params); loggers::get_instance().set_stop_time(_time_key, duration); } - void CamPort::receiveMsg(const LibItsCam__TypesAndValues::CamInd &p_ind, const params &p_params) { - loggers::get_instance().log_msg(">>> CamPort::receive_msg: ", p_ind); + void CamPort::receiveMsg(const LibItsCam__TypesAndValues::CamInd &p_ind, const params& p_params) { + //loggers::get_instance().log_msg(">>> CamPort::receive_msg: ", p_ind); + const params_its& p = static_cast(p_params); + loggers::get_instance().log(">>> CamPort::receive_msg: %s", p.station_id.c_str()); incoming_message(p_ind); } diff --git a/ccsrc/Ports/LibIts_ports/CAM_ports/CamPort.hh b/ccsrc/Ports/LibIts_ports/CAM_ports/CamPort.hh index f358382..9fd64d9 100644 --- a/ccsrc/Ports/LibIts_ports/CAM_ports/CamPort.hh +++ b/ccsrc/Ports/LibIts_ports/CAM_ports/CamPort.hh @@ -13,13 +13,13 @@ #include "LibItsCam_TestSystem.hh" #include "layer.hh" -#include "params.hh" +#include "params_its.hh" namespace LibItsCam__TestSystem { class CamPort : public CamPort_BASE { - params _cfg_params; - params _layer_params; + params_its _cfg_params; + params_its _layer_params; layer * _layer; std::string _time_key; @@ -29,7 +29,7 @@ namespace LibItsCam__TestSystem { void set_parameter(const char *parameter_name, const char *parameter_value); - void receiveMsg(const LibItsCam__TypesAndValues::CamInd &, const params &); + void receiveMsg(const LibItsCam__TypesAndValues::CamInd&, const params&); private: /* void Handle_Fd_Event(int fd, boolean is_readable, diff --git a/ccsrc/Ports/LibIts_ports/CAM_ports/UpperTesterPort_CAM.cc b/ccsrc/Ports/LibIts_ports/CAM_ports/UpperTesterPort_CAM.cc index 1d88b48..3b2b77a 100644 --- a/ccsrc/Ports/LibIts_ports/CAM_ports/UpperTesterPort_CAM.cc +++ b/ccsrc/Ports/LibIts_ports/CAM_ports/UpperTesterPort_CAM.cc @@ -37,7 +37,7 @@ namespace LibItsCam__TestSystem { void UpperTesterPort::user_map(const char *system_port) { loggers::get_instance().log(">>> UpperTesterPort_Cam::user_map: %s", system_port); // Build layer stack - params::iterator it = _cfg_params.find(std::string("params")); + params_its::iterator it = _cfg_params.find(std::string("params")); if (it != _cfg_params.end()) { loggers::get_instance().log("UpperTesterPort_Cam::user_map: %s", it->second.c_str()); _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); diff --git a/ccsrc/Ports/LibIts_ports/CAM_ports/UpperTesterPort_CAM.hh b/ccsrc/Ports/LibIts_ports/CAM_ports/UpperTesterPort_CAM.hh index 1afc996..e8cd585 100644 --- a/ccsrc/Ports/LibIts_ports/CAM_ports/UpperTesterPort_CAM.hh +++ b/ccsrc/Ports/LibIts_ports/CAM_ports/UpperTesterPort_CAM.hh @@ -2,15 +2,15 @@ #define UpperTesterPort_CAM_HH #include "layer.hh" -#include "params.hh" +#include "params_its.hh" //============================================================================= #include "LibItsCam_TestSystem.hh" namespace LibItsCam__TestSystem { class UpperTesterPort : public UpperTesterPort_BASE { - params _cfg_params; - params _layer_params; + params_its _cfg_params; + params_its _layer_params; layer * _layer; std::string _time_key; diff --git a/ccsrc/Ports/LibIts_ports/DENM_ports/DenmPort.cc b/ccsrc/Ports/LibIts_ports/DENM_ports/DenmPort.cc index b5266bd..6248727 100644 --- a/ccsrc/Ports/LibIts_ports/DENM_ports/DenmPort.cc +++ b/ccsrc/Ports/LibIts_ports/DENM_ports/DenmPort.cc @@ -69,17 +69,17 @@ namespace LibItsDenm__TestSystem { void DenmPort::user_stop() {} - void DenmPort::outgoing_send(const LibItsDenm__TypesAndValues::DenmReq &send_par) { + void DenmPort::outgoing_send(const LibItsDenm__TypesAndValues::DenmReq& send_par) { // loggers::get_instance().log_msg(">>> DenmPort::outgoing_send: payload=", send_par); float duration; loggers::get_instance().set_start_time(_time_key); - params params; + params_its params; static_cast(_layer)->sendMsg(send_par, params); loggers::get_instance().set_stop_time(_time_key, duration); } - void DenmPort::receiveMsg(const LibItsDenm__TypesAndValues::DenmInd &p_ind, const params &p_params) { + void DenmPort::receiveMsg(const LibItsDenm__TypesAndValues::DenmInd& p_ind, const params& p_params) { // loggers::get_instance().log_msg(">>> DenmPort::receive_msg: ", p_ind); incoming_message(p_ind); diff --git a/ccsrc/Ports/LibIts_ports/DENM_ports/DenmPort.hh b/ccsrc/Ports/LibIts_ports/DENM_ports/DenmPort.hh index 8d45dbd..c60c6df 100644 --- a/ccsrc/Ports/LibIts_ports/DENM_ports/DenmPort.hh +++ b/ccsrc/Ports/LibIts_ports/DENM_ports/DenmPort.hh @@ -29,7 +29,7 @@ namespace LibItsDenm__TestSystem { void set_parameter(const char *parameter_name, const char *parameter_value); - void receiveMsg(const LibItsDenm__TypesAndValues::DenmInd &, const params &); + void receiveMsg(const LibItsDenm__TypesAndValues::DenmInd&, const params&); private: /* void Handle_Fd_Event(int fd, boolean is_readable, diff --git a/ccsrc/Ports/LibIts_ports/DENM_ports/UpperTesterPort_DENM.cc b/ccsrc/Ports/LibIts_ports/DENM_ports/UpperTesterPort_DENM.cc index d24aa72..e3d59f3 100644 --- a/ccsrc/Ports/LibIts_ports/DENM_ports/UpperTesterPort_DENM.cc +++ b/ccsrc/Ports/LibIts_ports/DENM_ports/UpperTesterPort_DENM.cc @@ -36,7 +36,7 @@ namespace LibItsDenm__TestSystem { void UpperTesterPort::user_map(const char *system_port) { loggers::get_instance().log(">>> UpperTesterPort_Denm::user_map: %s", system_port); // Build layer stack - params::iterator it = _cfg_params.find(std::string("params")); + params_its::iterator it = _cfg_params.find(std::string("params")); if (it != _cfg_params.end()) { loggers::get_instance().log("UpperTesterPort_Denm::user_map: %s", it->second.c_str()); _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); diff --git a/ccsrc/Ports/LibIts_ports/DENM_ports/UpperTesterPort_DENM.hh b/ccsrc/Ports/LibIts_ports/DENM_ports/UpperTesterPort_DENM.hh index d4f95ed..f0f9837 100644 --- a/ccsrc/Ports/LibIts_ports/DENM_ports/UpperTesterPort_DENM.hh +++ b/ccsrc/Ports/LibIts_ports/DENM_ports/UpperTesterPort_DENM.hh @@ -2,15 +2,15 @@ #define UpperTesterPort_DENM_HH #include "layer.hh" -#include "params.hh" +#include "params_its.hh" //============================================================================= #include "LibItsDenm_TestSystem.hh" namespace LibItsDenm__TestSystem { class UpperTesterPort : public UpperTesterPort_BASE { - params _cfg_params; - params _layer_params; + params_its _cfg_params; + params_its _layer_params; layer * _layer; std::string _time_key; diff --git a/ccsrc/Ports/LibIts_ports/GN_ports/GeoNetworkingPort.cc b/ccsrc/Ports/LibIts_ports/GN_ports/GeoNetworkingPort.cc index c146944..929b376 100644 --- a/ccsrc/Ports/LibIts_ports/GN_ports/GeoNetworkingPort.cc +++ b/ccsrc/Ports/LibIts_ports/GN_ports/GeoNetworkingPort.cc @@ -45,7 +45,7 @@ namespace LibItsGeoNetworking__TestSystem { void GeoNetworkingPort::user_map(const char *system_port) { loggers::get_instance().log(">>> GeoNetworkingPort::user_map: %s", system_port); // Build layer stack - params::iterator it = _cfg_params.find(std::string("params")); + params_its::iterator it = _cfg_params.find(std::string("params")); if (it != _cfg_params.end()) { loggers::get_instance().log("GeoNetworkingPort::user_map: %s", it->second.c_str()); // Setup parameters @@ -81,13 +81,15 @@ namespace LibItsGeoNetworking__TestSystem { float duration; loggers::get_instance().set_start_time(_time_key); - params params; + params_its params; static_cast(_layer)->sendMsg(send_par, params); loggers::get_instance().set_stop_time(_time_key, duration); } - void GeoNetworkingPort::receiveMsg(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd &p_ind, const params &p_params) { - loggers::get_instance().log_msg(">>> GeoNetworkingPort::receive_msg: ", p_ind); + void GeoNetworkingPort::receiveMsg(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd &p_ind, const params& p_params) { + //loggers::get_instance().log_msg(">>> GeoNetworkingPort::receive_msg: ", p_ind); + const params_its& p = static_cast(p_params); + loggers::get_instance().log(">>> GeoNetworkingPort::receive_msg: %s", p.ll_address.c_str()); // Sanity check if (!p_ind.is_bound()) { return; diff --git a/ccsrc/Ports/LibIts_ports/GN_ports/GeoNetworkingPort.hh b/ccsrc/Ports/LibIts_ports/GN_ports/GeoNetworkingPort.hh index 10dca94..1ef9d04 100644 --- a/ccsrc/Ports/LibIts_ports/GN_ports/GeoNetworkingPort.hh +++ b/ccsrc/Ports/LibIts_ports/GN_ports/GeoNetworkingPort.hh @@ -12,13 +12,13 @@ #include "LibItsGeoNetworking_TestSystem.hh" #include "layer.hh" -#include "params.hh" +#include "params_its.hh" namespace LibItsGeoNetworking__TestSystem { class GeoNetworkingPort : public GeoNetworkingPort_BASE { - params _cfg_params; - params _layer_params; + params_its _cfg_params; + params_its _layer_params; layer * _layer; std::string _time_key; @@ -27,7 +27,7 @@ namespace LibItsGeoNetworking__TestSystem { ~GeoNetworkingPort(); void set_parameter(const char *parameter_name, const char *parameter_value); - void receiveMsg(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd &, const params &); + void receiveMsg(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd&, const params&); private: /* void Handle_Fd_Event(int fd, boolean is_readable, diff --git a/ccsrc/Ports/LibIts_ports/GN_ports/UpperTesterPort_GN.cc b/ccsrc/Ports/LibIts_ports/GN_ports/UpperTesterPort_GN.cc index 69bfcec..3903537 100644 --- a/ccsrc/Ports/LibIts_ports/GN_ports/UpperTesterPort_GN.cc +++ b/ccsrc/Ports/LibIts_ports/GN_ports/UpperTesterPort_GN.cc @@ -36,7 +36,7 @@ namespace LibItsGeoNetworking__TestSystem { void UpperTesterPort::user_map(const char *system_port) { loggers::get_instance().log(">>> UpperTesterPort_Gn::user_map: %s", system_port); // Build layer stack - params::iterator it = _cfg_params.find(std::string("params")); + params_its::iterator it = _cfg_params.find(std::string("params")); if (it != _cfg_params.end()) { loggers::get_instance().log("UpperTesterPort_Gn::user_map: %s", it->second.c_str()); _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); diff --git a/ccsrc/Ports/LibIts_ports/GN_ports/UpperTesterPort_GN.hh b/ccsrc/Ports/LibIts_ports/GN_ports/UpperTesterPort_GN.hh index a6d9b80..108b5cb 100644 --- a/ccsrc/Ports/LibIts_ports/GN_ports/UpperTesterPort_GN.hh +++ b/ccsrc/Ports/LibIts_ports/GN_ports/UpperTesterPort_GN.hh @@ -1,15 +1,15 @@ #ifndef UpperTesterPort_GN_HH #define UpperTesterPort_GN_HH #include "layer.hh" -#include "params.hh" +#include "params_its.hh" //============================================================================= #include "LibItsGeoNetworking_TestSystem.hh" namespace LibItsGeoNetworking__TestSystem { class UpperTesterPort : public UpperTesterPort_BASE { - params _cfg_params; - params _layer_params; + params_its _cfg_params; + params_its _layer_params; layer * _layer; std::string _time_key; diff --git a/ccsrc/Ports/LibIts_ports/Http_ports/HttpPort.cc b/ccsrc/Ports/LibIts_ports/Http_ports/HttpPort.cc index d28e93a..0696d26 100644 --- a/ccsrc/Ports/LibIts_ports/Http_ports/HttpPort.cc +++ b/ccsrc/Ports/LibIts_ports/Http_ports/HttpPort.cc @@ -2,9 +2,11 @@ #include "http_layer_factory.hh" #include "loggers.hh" -#include "LibItsHttp_TypesAndValues.hh" +#include "LibHttp_TypesAndValues.hh" -namespace LibItsHttp__TestSystem { +#include "params.hh" + +namespace LibHttp__TestSystem { HttpPort::HttpPort(const char *par_port_name) : HttpPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("HttpPort::outgoing_send") { @@ -69,7 +71,7 @@ namespace LibItsHttp__TestSystem { void HttpPort::user_stop() { loggers::get_instance().log(">>> HttpPort::user_stop"); } // End of user_stop method - void HttpPort::outgoing_send(const LibItsHttp__TypesAndValues::HttpMessage &send_par) { + void HttpPort::outgoing_send(const LibHttp__TypesAndValues::HttpMessage &send_par) { loggers::get_instance().log_msg(">>> HttpPort::outgoing_send: payload=", send_par); float duration; @@ -79,7 +81,7 @@ namespace LibItsHttp__TestSystem { loggers::get_instance().set_stop_time(_time_key, duration); } - void HttpPort::receiveMsg(const LibItsHttp__TypesAndValues::HttpMessage &p_ind, const params &p_params) { + void HttpPort::receiveMsg(const LibHttp__TypesAndValues::HttpMessage &p_ind, const params &p_params) { loggers::get_instance().log_msg(">>> HttpPort::receive_msg: ", p_ind); // Sanity check if (!p_ind.is_bound()) { @@ -89,4 +91,4 @@ namespace LibItsHttp__TestSystem { incoming_message(p_ind); } -} // namespace LibItsHttp__TestSystem +} // namespace LibHttp__TestSystem diff --git a/ccsrc/Ports/LibIts_ports/Http_ports/HttpPort.hh b/ccsrc/Ports/LibIts_ports/Http_ports/HttpPort.hh index 48024dd..b0e70a5 100644 --- a/ccsrc/Ports/LibIts_ports/Http_ports/HttpPort.hh +++ b/ccsrc/Ports/LibIts_ports/Http_ports/HttpPort.hh @@ -1,15 +1,15 @@ #pragma once -#include "LibItsHttp_TestSystem.hh" +#include "LibHttp_TestSystem.hh" #include "layer.hh" #include "params.hh" -namespace LibItsHttp__TypesAndValues { +namespace LibHttp__TypesAndValues { class HttpMessage; } -namespace LibItsHttp__TestSystem { +namespace LibHttp__TestSystem { class HttpPort : public HttpPort_BASE { params _cfg_params; @@ -22,7 +22,7 @@ namespace LibItsHttp__TestSystem { ~HttpPort(); void set_parameter(const char *parameter_name, const char *parameter_value); - void receiveMsg(const LibItsHttp__TypesAndValues::HttpMessage &p_ind, const params &p_params); + void receiveMsg(const LibHttp__TypesAndValues::HttpMessage &p_ind, const params &p_params); private: /* void Handle_Fd_Event(int fd, boolean is_readable, @@ -40,7 +40,7 @@ namespace LibItsHttp__TestSystem { void user_stop(); protected: - void outgoing_send(const LibItsHttp__TypesAndValues::HttpMessage &send_par); + void outgoing_send(const LibHttp__TypesAndValues::HttpMessage &send_par); }; // End of class HttpPort -} // namespace LibItsHttp__TestSystem +} // namespace LibHttp__TestSystem diff --git a/ccsrc/Ports/LibIts_ports/IVIM_ports/IvimPort.cc b/ccsrc/Ports/LibIts_ports/IVIM_ports/IvimPort.cc index 8a2d75d..4c5932d 100644 --- a/ccsrc/Ports/LibIts_ports/IVIM_ports/IvimPort.cc +++ b/ccsrc/Ports/LibIts_ports/IVIM_ports/IvimPort.cc @@ -41,7 +41,7 @@ namespace LibItsIvim__TestSystem { void IvimPort::user_map(const char *system_port) { loggers::get_instance().log(">>> IvimPort::user_map: %s", system_port); // Build layer stack - params::iterator it = _cfg_params.find(std::string("params")); + params_its::iterator it = _cfg_params.find(std::string("params")); if (it != _cfg_params.end()) { loggers::get_instance().log("IvimPort::user_map: %s", it->second.c_str()); _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); @@ -71,7 +71,7 @@ namespace LibItsIvim__TestSystem { float duration; loggers::get_instance().set_start_time(_time_key); - params params; + params_its params; static_cast(_layer)->sendMsg(send_par, params); loggers::get_instance().set_stop_time(_time_key, duration); } @@ -81,12 +81,12 @@ namespace LibItsIvim__TestSystem { float duration; loggers::get_instance().set_start_time(_time_key); - params params; + params_its params; static_cast(_layer)->sendMsg(send_par, params); loggers::get_instance().set_stop_time(_time_key, duration); } - void IvimPort::receiveMsg(const LibItsIvim__TypesAndValues::IvimInd &p_ind, const params &p_params) { + void IvimPort::receiveMsg(const LibItsIvim__TypesAndValues::IvimInd& p_ind, const params& p_params) { loggers::get_instance().log_msg(">>> IvimPort::receive_msg: ", p_ind); incoming_message(p_ind); diff --git a/ccsrc/Ports/LibIts_ports/IVIM_ports/IvimPort.hh b/ccsrc/Ports/LibIts_ports/IVIM_ports/IvimPort.hh index 778592c..4048c4d 100644 --- a/ccsrc/Ports/LibIts_ports/IVIM_ports/IvimPort.hh +++ b/ccsrc/Ports/LibIts_ports/IVIM_ports/IvimPort.hh @@ -29,7 +29,7 @@ namespace LibItsIvim__TestSystem { void set_parameter(const char *parameter_name, const char *parameter_value); - void receiveMsg(const LibItsIvim__TypesAndValues::IvimInd &, const params &); + void receiveMsg(const LibItsIvim__TypesAndValues::IvimInd&, const params&); private: /* void Handle_Fd_Event(int fd, boolean is_readable, diff --git a/ccsrc/Ports/LibIts_ports/IVIM_ports/UpperTesterPort_IVIM.cc b/ccsrc/Ports/LibIts_ports/IVIM_ports/UpperTesterPort_IVIM.cc index 1d2a5f8..be1fdeb 100644 --- a/ccsrc/Ports/LibIts_ports/IVIM_ports/UpperTesterPort_IVIM.cc +++ b/ccsrc/Ports/LibIts_ports/IVIM_ports/UpperTesterPort_IVIM.cc @@ -36,7 +36,7 @@ namespace LibItsIvim__TestSystem { void UpperTesterPort::user_map(const char *system_port) { loggers::get_instance().log(">>> UpperTesterPort_Ivim::user_map: %s", system_port); // Build layer stack - params::iterator it = _cfg_params.find(std::string("params")); + params_its::iterator it = _cfg_params.find(std::string("params")); if (it != _cfg_params.end()) { loggers::get_instance().log("UpperTesterPort_Ivim::user_map: %s", it->second.c_str()); _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); diff --git a/ccsrc/Ports/LibIts_ports/IVIM_ports/UpperTesterPort_IVIM.hh b/ccsrc/Ports/LibIts_ports/IVIM_ports/UpperTesterPort_IVIM.hh index 0e530eb..3015307 100644 --- a/ccsrc/Ports/LibIts_ports/IVIM_ports/UpperTesterPort_IVIM.hh +++ b/ccsrc/Ports/LibIts_ports/IVIM_ports/UpperTesterPort_IVIM.hh @@ -3,14 +3,14 @@ #define UpperTesterPort_IVIM_HH #include "layer.hh" -#include "params.hh" +#include "params_its.hh" #include "LibItsIvim_TestSystem.hh" namespace LibItsIvim__TestSystem { class UpperTesterPort : public UpperTesterPort_BASE { - params _cfg_params; - params _layer_params; + params_its _cfg_params; + params_its _layer_params; layer * _layer; std::string _time_key; @@ -46,4 +46,4 @@ namespace LibItsIvim__TestSystem { }; } // namespace LibItsIvim__TestSystem -#endif \ No newline at end of file +#endif diff --git a/ccsrc/Ports/LibIts_ports/MapemSpatem_ports/MapemSpatemPort.cc b/ccsrc/Ports/LibIts_ports/MapemSpatem_ports/MapemSpatemPort.cc index d878041..9b335d5 100644 --- a/ccsrc/Ports/LibIts_ports/MapemSpatem_ports/MapemSpatemPort.cc +++ b/ccsrc/Ports/LibIts_ports/MapemSpatem_ports/MapemSpatemPort.cc @@ -41,7 +41,7 @@ namespace LibItsMapemSpatem__TestSystem { void MapemSpatemPort::user_map(const char *system_port) { loggers::get_instance().log(">>> MapemSpatemPort::user_map: %s", system_port); // Build layer stack - params::iterator it = _cfg_params.find(std::string("params")); + params_its::iterator it = _cfg_params.find(std::string("params")); if (it != _cfg_params.end()) { loggers::get_instance().log("MapemSpatemPort::user_map: %s", it->second.c_str()); _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); @@ -71,7 +71,7 @@ namespace LibItsMapemSpatem__TestSystem { float duration; loggers::get_instance().set_start_time(_time_key); - params params; + params_its params; static_cast(_layer)->sendMsg(send_par, params); loggers::get_instance().set_stop_time(_time_key, duration); } @@ -81,7 +81,7 @@ namespace LibItsMapemSpatem__TestSystem { float duration; loggers::get_instance().set_start_time(_time_key); - params params; + params_its params; static_cast(_layer)->sendMsg(send_par, params); loggers::get_instance().set_stop_time(_time_key, duration); } diff --git a/ccsrc/Ports/LibIts_ports/MapemSpatem_ports/UpperTesterPort_MapemSpatem.cc b/ccsrc/Ports/LibIts_ports/MapemSpatem_ports/UpperTesterPort_MapemSpatem.cc index 7e11080..af0caa3 100644 --- a/ccsrc/Ports/LibIts_ports/MapemSpatem_ports/UpperTesterPort_MapemSpatem.cc +++ b/ccsrc/Ports/LibIts_ports/MapemSpatem_ports/UpperTesterPort_MapemSpatem.cc @@ -36,7 +36,7 @@ namespace LibItsMapemSpatem__TestSystem { void UpperTesterPort::user_map(const char *system_port) { loggers::get_instance().log(">>> UpperTesterPort_MapemSpatem::user_map: %s", system_port); // Build layer stack - params::iterator it = _cfg_params.find(std::string("params")); + params_its::iterator it = _cfg_params.find(std::string("params")); if (it != _cfg_params.end()) { loggers::get_instance().log("UpperTesterPort_MapemSpatem::user_map: %s", it->second.c_str()); _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); diff --git a/ccsrc/Ports/LibIts_ports/MapemSpatem_ports/UpperTesterPort_MapemSpatem.hh b/ccsrc/Ports/LibIts_ports/MapemSpatem_ports/UpperTesterPort_MapemSpatem.hh index 4195d03..ed626c5 100644 --- a/ccsrc/Ports/LibIts_ports/MapemSpatem_ports/UpperTesterPort_MapemSpatem.hh +++ b/ccsrc/Ports/LibIts_ports/MapemSpatem_ports/UpperTesterPort_MapemSpatem.hh @@ -5,13 +5,13 @@ #include "LibItsMapemSpatem_TestSystem.hh" #include "layer.hh" -#include "params.hh" +#include "params_its.hh" namespace LibItsMapemSpatem__TestSystem { class UpperTesterPort : public UpperTesterPort_BASE { - params _cfg_params; - params _layer_params; + params_its _cfg_params; + params_its _layer_params; layer * _layer; std::string _time_key; diff --git a/ccsrc/Ports/LibIts_ports/Pki_ports/UpperTesterPkiPort.cc b/ccsrc/Ports/LibIts_ports/Pki_ports/UpperTesterPkiPort.cc index b516042..b93f873 100644 --- a/ccsrc/Ports/LibIts_ports/Pki_ports/UpperTesterPkiPort.cc +++ b/ccsrc/Ports/LibIts_ports/Pki_ports/UpperTesterPkiPort.cc @@ -41,7 +41,7 @@ namespace LibItsPki__TestSystem { void UpperTesterPkiPort::user_map(const char *system_port) { loggers::get_instance().log(">>> UpperTesterPkiPort_Pki::user_map: %s", system_port); // Build layer stack - params::iterator it = _cfg_params.find(std::string("params")); + params_its::iterator it = _cfg_params.find(std::string("params")); if (it != _cfg_params.end()) { loggers::get_instance().log("UpperTesterPkiPort_Pki::user_map: %s", it->second.c_str()); _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorCodec.cc b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorCodec.cc index 682a5e7..88dac5c 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorCodec.cc +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorCodec.cc @@ -44,7 +44,7 @@ int ConfigRsuSimulatorCodec::encode_(const Base_Type &type, const TTCN_Typedescr return 0; } -int ConfigRsuSimulatorCodec::decode(const OCTETSTRING &data, Record_Type &msg, params *params) { +int ConfigRsuSimulatorCodec::decode(const OCTETSTRING &data, Record_Type &msg, params_its *params) { TTCN_EncDec::clear_error(); TTCN_Buffer decoding_buffer(data); _params = params; diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorCodec.hh b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorCodec.hh index 7b31e47..1db3a34 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorCodec.hh +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorCodec.hh @@ -1,7 +1,7 @@ #pragma once #include "codec.hh" -#include "params.hh" +#include "params_its.hh" class Record_Type; class Base_Type; @@ -20,5 +20,5 @@ public: virtual ~ConfigRsuSimulatorCodec(){}; virtual int encode(const Record_Type &, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, Record_Type &, params *params = NULL); + virtual int decode(const OCTETSTRING &data, Record_Type &, params_its *params = NULL); }; // End of class ConfigRsuSimulatorCodec diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.cc b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.cc index f397e21..7975ba6 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.cc +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.cc @@ -36,7 +36,7 @@ namespace ItsRSUsSimulator__TestSystem { void ConfigRsuSimulatorPort::user_map(const char *system_port) { loggers::get_instance().log(">>> ConfigRsuSimulatorPort::user_map: %s", system_port); // Build layer stack - params::iterator it = _cfg_params.find(std::string("params")); + params_its::iterator it = _cfg_params.find(std::string("params")); if (it != _cfg_params.end()) { loggers::get_instance().log("ConfigRsuSimulatorPort::user_map: %s", it->second.c_str()); // Setup parameters diff --git a/ccsrc/Ports/LibIts_ports/Rtcmem_ports/RtcmemPort.cc b/ccsrc/Ports/LibIts_ports/Rtcmem_ports/RtcmemPort.cc index 377289d..b276d95 100644 --- a/ccsrc/Ports/LibIts_ports/Rtcmem_ports/RtcmemPort.cc +++ b/ccsrc/Ports/LibIts_ports/Rtcmem_ports/RtcmemPort.cc @@ -41,7 +41,7 @@ namespace LibItsRtcmem__TestSystem { void RtcmemPort::user_map(const char *system_port) { loggers::get_instance().log(">>> RtcmemPort::user_map: %s", system_port); // Build layer stack - params::iterator it = _cfg_params.find(std::string("params")); + params_its::iterator it = _cfg_params.find(std::string("params")); if (it != _cfg_params.end()) { loggers::get_instance().log("RtcmemPort::user_map: %s", it->second.c_str()); _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); @@ -71,7 +71,7 @@ namespace LibItsRtcmem__TestSystem { float duration; loggers::get_instance().set_start_time(_time_key); - params params; + params_its params; static_cast(_layer)->sendMsg(send_par, params); loggers::get_instance().set_stop_time(_time_key, duration); } diff --git a/ccsrc/Ports/LibIts_ports/Rtcmem_ports/UpperTesterPort_Rtcmem.cc b/ccsrc/Ports/LibIts_ports/Rtcmem_ports/UpperTesterPort_Rtcmem.cc index 5ff19f8..231387c 100644 --- a/ccsrc/Ports/LibIts_ports/Rtcmem_ports/UpperTesterPort_Rtcmem.cc +++ b/ccsrc/Ports/LibIts_ports/Rtcmem_ports/UpperTesterPort_Rtcmem.cc @@ -36,7 +36,7 @@ namespace LibItsRtcmem__TestSystem { void UpperTesterPort::user_map(const char *system_port) { loggers::get_instance().log(">>> UpperTesterPort_Rtcmem::user_map: %s", system_port); // Build layer stack - params::iterator it = _cfg_params.find(std::string("params")); + params_its::iterator it = _cfg_params.find(std::string("params")); if (it != _cfg_params.end()) { loggers::get_instance().log("UpperTesterPort_Rtcmem::user_map: %s", it->second.c_str()); _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); @@ -97,7 +97,7 @@ namespace LibItsRtcmem__TestSystem { loggers::get_instance().set_stop_time(_time_key, duration); } - void UpperTesterPort::receiveMsg(const Base_Type &p_ind, const params &p_params) { + void UpperTesterPort::receiveMsg(const Base_Type& p_ind, const params& p_params) { loggers::get_instance().log_msg(">>> UpperTesterPort_Rtcmem::receive_msg: ", p_ind); // Sanity check if (!p_ind.is_bound()) { diff --git a/ccsrc/Ports/LibIts_ports/Rtcmem_ports/UpperTesterPort_Rtcmem.hh b/ccsrc/Ports/LibIts_ports/Rtcmem_ports/UpperTesterPort_Rtcmem.hh index 7db3b7c..791cf8c 100644 --- a/ccsrc/Ports/LibIts_ports/Rtcmem_ports/UpperTesterPort_Rtcmem.hh +++ b/ccsrc/Ports/LibIts_ports/Rtcmem_ports/UpperTesterPort_Rtcmem.hh @@ -2,15 +2,15 @@ #define UpperTesterPort_Rtcmem_HH #include "layer.hh" -#include "params.hh" +#include "params_its.hh" //============================================================================= #include "LibItsRtcmem_TestSystem.hh" namespace LibItsRtcmem__TestSystem { class UpperTesterPort : public UpperTesterPort_BASE { - params _cfg_params; - params _layer_params; + params_its _cfg_params; + params_its _layer_params; layer * _layer; std::string _time_key; @@ -20,7 +20,7 @@ namespace LibItsRtcmem__TestSystem { void set_parameter(const char *parameter_name, const char *parameter_value); - void receiveMsg(const Base_Type &, const params &); + void receiveMsg(const Base_Type&, const params&); private: /* void Handle_Fd_Event(int fd, boolean is_readable, diff --git a/ccsrc/Ports/LibIts_ports/SremSsem_ports/SremSsemPort.cc b/ccsrc/Ports/LibIts_ports/SremSsem_ports/SremSsemPort.cc index 365debd..80eca24 100644 --- a/ccsrc/Ports/LibIts_ports/SremSsem_ports/SremSsemPort.cc +++ b/ccsrc/Ports/LibIts_ports/SremSsem_ports/SremSsemPort.cc @@ -41,7 +41,7 @@ namespace LibItsSremSsem__TestSystem { void SremSsemPort::user_map(const char *system_port) { loggers::get_instance().log(">>> SremSsemPort::user_map: %s", system_port); // Build layer stack - params::iterator it = _cfg_params.find(std::string("params")); + params_its::iterator it = _cfg_params.find(std::string("params")); if (it != _cfg_params.end()) { loggers::get_instance().log("SremSsemPort::user_map: %s", it->second.c_str()); _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); @@ -71,7 +71,7 @@ namespace LibItsSremSsem__TestSystem { float duration; loggers::get_instance().set_start_time(_time_key); - params params; + params_its params; static_cast(_layer)->sendMsg(send_par, params); loggers::get_instance().set_stop_time(_time_key, duration); } @@ -81,7 +81,7 @@ namespace LibItsSremSsem__TestSystem { float duration; loggers::get_instance().set_start_time(_time_key); - params params; + params_its params; static_cast(_layer)->sendMsg(send_par, params); loggers::get_instance().set_stop_time(_time_key, duration); } diff --git a/ccsrc/Ports/LibIts_ports/SremSsem_ports/UpperTesterPort_SremSsem.cc b/ccsrc/Ports/LibIts_ports/SremSsem_ports/UpperTesterPort_SremSsem.cc index 96e48e3..3f597f9 100644 --- a/ccsrc/Ports/LibIts_ports/SremSsem_ports/UpperTesterPort_SremSsem.cc +++ b/ccsrc/Ports/LibIts_ports/SremSsem_ports/UpperTesterPort_SremSsem.cc @@ -36,7 +36,7 @@ namespace LibItsSremSsem__TestSystem { void UpperTesterPort::user_map(const char *system_port) { loggers::get_instance().log(">>> UpperTesterPort_SremSsem::user_map: %s", system_port); // Build layer stack - params::iterator it = _cfg_params.find(std::string("params")); + params_its::iterator it = _cfg_params.find(std::string("params")); if (it != _cfg_params.end()) { loggers::get_instance().log("UpperTesterPort_SremSsem::user_map: %s", it->second.c_str()); _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); diff --git a/ccsrc/Ports/LibIts_ports/SremSsem_ports/UpperTesterPort_SremSsem.hh b/ccsrc/Ports/LibIts_ports/SremSsem_ports/UpperTesterPort_SremSsem.hh index 8a55043..aaaadf9 100644 --- a/ccsrc/Ports/LibIts_ports/SremSsem_ports/UpperTesterPort_SremSsem.hh +++ b/ccsrc/Ports/LibIts_ports/SremSsem_ports/UpperTesterPort_SremSsem.hh @@ -5,13 +5,13 @@ #include "LibItsSremSsem_TestSystem.hh" #include "layer.hh" -#include "params.hh" +#include "params_its.hh" namespace LibItsSremSsem__TestSystem { class UpperTesterPort : public UpperTesterPort_BASE { - params _cfg_params; - params _layer_params; + params_its _cfg_params; + params_its _layer_params; layer * _layer; std::string _time_key; diff --git a/ccsrc/Protocols/BTP/btp_codec.cc b/ccsrc/Protocols/BTP/btp_codec.cc index 4746644..5e29b82 100644 --- a/ccsrc/Protocols/BTP/btp_codec.cc +++ b/ccsrc/Protocols/BTP/btp_codec.cc @@ -57,7 +57,7 @@ int btp_codec::encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field return 0; } -int btp_codec::decode(const OCTETSTRING &data, LibItsBtp__TypesAndValues::BtpPacket &msg, params *params) { +int btp_codec::decode(const OCTETSTRING &data, LibItsBtp__TypesAndValues::BtpPacket &msg, params_its *params) { TTCN_EncDec::clear_error(); TTCN_Buffer decoding_buffer(data); _params = params; @@ -91,15 +91,15 @@ int btp_codec::decode_(Base_Type &type, const TTCN_Typedescriptor_t &field_descr if (_type == btp_codec::btpA) { decode_(b.btpAHeader(), *b.btpAHeader().get_descriptor(), decoding_buffer); if (_params != NULL) { - (*_params)[params::btp_type] = std::string("btpA"); - (*_params)[params::btp_destination_port] = std::to_string(static_cast(b.btpAHeader().destinationPort())); + (*_params)[params_its::btp_type] = std::string("btpA"); + (*_params)[params_its::btp_destination_port] = std::to_string(static_cast(b.btpAHeader().destinationPort())); } } else if (_type == btp_codec::btpB) { decode_(b.btpBHeader(), *b.btpBHeader().get_descriptor(), decoding_buffer); if (_params != NULL) { - (*_params)[params::btp_type] = std::string("btpB"); - (*_params)[params::btp_destination_port] = std::to_string(static_cast(b.btpBHeader().destinationPort())); - (*_params)[params::btp_info] = std::to_string(static_cast(b.btpBHeader().destinationPortInfo())); + (*_params)[params_its::btp_type] = std::string("btpB"); + (*_params)[params_its::btp_destination_port] = std::to_string(static_cast(b.btpBHeader().destinationPort())); + (*_params)[params_its::btp_info] = std::to_string(static_cast(b.btpBHeader().destinationPortInfo())); } } else { // loggers::get_instance().error("btp_codec::decode_: Invalid BTP type"); // Cannot be reached @@ -114,7 +114,7 @@ int btp_codec::decode_(Base_Type &type, const TTCN_Typedescriptor_t &field_descr OCTETSTRING os(decoding_buffer.get_len() - decoding_buffer.get_pos(), decoding_buffer.get_data() + decoding_buffer.get_pos()); // loggers::get_instance().log_msg("btp_codec::decode_: s=", os); if (_params != NULL) { - (*_params)[params::btp_payload] = std::string(static_cast(oct2str(os))); + (*_params)[params_its::btp_payload] = std::string(static_cast(oct2str(os))); } if (os.lengthof() != 0) { dynamic_cast &>(type) = OPTIONAL(os); diff --git a/ccsrc/Protocols/BTP/btp_codec.hh b/ccsrc/Protocols/BTP/btp_codec.hh index e4570f6..e895543 100644 --- a/ccsrc/Protocols/BTP/btp_codec.hh +++ b/ccsrc/Protocols/BTP/btp_codec.hh @@ -2,7 +2,7 @@ #define BTPCODEC_H #include "codec.hh" -#include "params.hh" +#include "params_its.hh" class Base_Type; class TTCN_Typedescriptor_t; @@ -28,7 +28,7 @@ public: virtual ~btp_codec(){}; virtual int encode(const LibItsBtp__TypesAndValues::BtpPacket &, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, LibItsBtp__TypesAndValues::BtpPacket &, params *params = NULL); + virtual int decode(const OCTETSTRING &data, LibItsBtp__TypesAndValues::BtpPacket &, params_its *params = NULL); inline void set_btp_type(const btp_codec::BtpType p_btp_type) { _type = p_btp_type; }; diff --git a/ccsrc/Protocols/BTP/btp_layer.cc b/ccsrc/Protocols/BTP/btp_layer.cc index 33d6376..58000b9 100644 --- a/ccsrc/Protocols/BTP/btp_layer.cc +++ b/ccsrc/Protocols/BTP/btp_layer.cc @@ -10,28 +10,28 @@ btp_layer::btp_layer(const std::string &p_type, const std::string ¶m) : t_layer(p_type), _params(), _codec(), _device_mode{true} { loggers::get_instance().log(">>> btp_layer::btp_layer: %s, %s", to_string().c_str(), param.c_str()); // Setup parameters - params::convert(_params, param); + params_its::convert(_params, param); // Sanity check - params::const_iterator it = _params.find(params::btp_type); + params_its::const_iterator it = _params.find(params_its::btp_type); if (it == _params.cend()) { - _params[params::btp_type] = std::string("btpB"); + _params[params_its::btp_type] = std::string("btpB"); } - it = _params.find(params::btp_destination_port); + it = _params.find(params_its::btp_destination_port); if (it == _params.cend()) { - _params[params::btp_destination_port] = std::to_string(2001); + _params[params_its::btp_destination_port] = std::to_string(2001); } - it = _params.find(params::btp_info); + it = _params.find(params_its::btp_info); if (it == _params.cend()) { - _params[params::btp_info] = std::to_string(0); + _params[params_its::btp_info] = std::to_string(0); } - it = _params.find(params::device_mode); + it = _params.find(params_its::device_mode); if (it != _params.cend()) { _device_mode = (1 == converter::get_instance().string_to_int(it->second)); } } -void btp_layer::sendMsg(const LibItsBtp__TypesAndValues::BtpReq &p, params ¶ms) { +void btp_layer::sendMsg(const LibItsBtp__TypesAndValues::BtpReq &p, params_its ¶ms) { loggers::get_instance().log(">>> btp_layer::sendMsg"); // params.log(); @@ -41,7 +41,7 @@ void btp_layer::sendMsg(const LibItsBtp__TypesAndValues::BtpReq &p, params ¶ send_data(data, params); } -void btp_layer::send_data(OCTETSTRING &data, params ¶ms) { +void btp_layer::send_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> btp_layer::send_data: ", data); params.log(); // TODO To be removed _params.log(); // TODO To be removed @@ -49,23 +49,23 @@ void btp_layer::send_data(OCTETSTRING &data, params ¶ms) { if (_device_mode) { LibItsBtp__TypesAndValues::BtpHeader header; std::string btp_type; - params::const_iterator it = params.find(params::next_header); + params_its::const_iterator it = params.find(params_its::next_header); if (it != params.cend()) { btp_type = it->second; } else { - btp_type = _params[params::btp_type]; + btp_type = _params[params_its::btp_type]; } loggers::get_instance().log("btp_layer::send_data: btp_type=%s", btp_type.c_str()); - int btp_destination_port = std::stoi(_params[params::btp_destination_port]); // Default value - it = params.find(params::btp_destination_port); + int btp_destination_port = std::stoi(_params[params_its::btp_destination_port]); // Default value + it = params.find(params_its::btp_destination_port); if (it != params.cend()) { - btp_destination_port = std::stoi(params[params::btp_destination_port]); // Overwritting default value + btp_destination_port = std::stoi(params[params_its::btp_destination_port]); // Overwritting default value } loggers::get_instance().log("btp_layer::send_data: btp_destination_port=%d", btp_destination_port); if (btp_type.compare("btpA") == 0) { - header.btpAHeader() = LibItsBtp__TypesAndValues::BtpAHeader(btp_destination_port, std::stoi(_params[params::btp_info])); + header.btpAHeader() = LibItsBtp__TypesAndValues::BtpAHeader(btp_destination_port, std::stoi(_params[params_its::btp_info])); } else { - header.btpBHeader() = LibItsBtp__TypesAndValues::BtpBHeader(btp_destination_port, std::stoi(_params[params::btp_info])); + header.btpBHeader() = LibItsBtp__TypesAndValues::BtpBHeader(btp_destination_port, std::stoi(_params[params_its::btp_info])); } LibItsBtp__TypesAndValues::BtpPacket p(header, data); loggers::get_instance().log_msg("btp_layer::send_data: ", p); @@ -79,32 +79,32 @@ void btp_layer::send_data(OCTETSTRING &data, params ¶ms) { send_to_all_layers(data, params); } -void btp_layer::receive_data(OCTETSTRING &data, params ¶ms) { +void btp_layer::receive_data(OCTETSTRING &data, params_its &p_params) { loggers::get_instance().log_msg(">>> btp_layer::receive_data: ", data); - params.log(); + //p_params.log(); // Decode the payload LibItsBtp__TypesAndValues::BtpInd p; - loggers::get_instance().log("btp_layer::receive_data: Looking for %s", params::gn_next_header.c_str()); - params::const_iterator it = params.find(params::gn_next_header); - if (it != params.cend()) { + loggers::get_instance().log("btp_layer::receive_data: Looking for %s", params_its::gn_next_header.c_str()); + params_its::const_iterator it = p_params.find(params_its::gn_next_header); + if (it != p_params.cend()) { loggers::get_instance().log("btp_layer::receive_data: Call set_btp_type with %s/%d", it->second.c_str(), (it->second.compare("2") == 0) ? btp_codec::btpB : btp_codec::btpA); _codec.set_btp_type((it->second.compare("2") == 0) ? btp_codec::btpB : btp_codec::btpA); } - _codec.decode(data, p.msgIn(), ¶ms); + _codec.decode(data, p.msgIn(), &p_params); // Pass the BTP raw payload to the upper layers if any - it = params.find(params::btp_payload); - if (it != params.cend()) { + it = p_params.find(params_its::btp_payload); + if (it != p_params.cend()) { loggers::get_instance().log("btp_layer::receive_data: btp_payload=%s", it->second.c_str()); OCTETSTRING os(str2oct(CHARSTRING(it->second.c_str()))); - receive_to_all_layers(os, params); + receive_to_all_layers(os, p_params); } else { loggers::get_instance().warning("btp_layer::receive_data: No payload to pass to upper layers"); } // Pass it to the ports if any - // params.log(); - to_all_upper_ports(p, params); + // p_params.log(); + to_all_upper_ports(p, static_cast(p_params)); } btp_layer_factory btp_layer_factory::_f; diff --git a/ccsrc/Protocols/BTP/btp_layer.hh b/ccsrc/Protocols/BTP/btp_layer.hh index daaef45..de1426e 100644 --- a/ccsrc/Protocols/BTP/btp_layer.hh +++ b/ccsrc/Protocols/BTP/btp_layer.hh @@ -24,7 +24,7 @@ namespace LibItsBtp__TestSystem { * \brief This class provides description of ITS BTP protocol layer */ class btp_layer : public t_layer { - params _params; //! Layer parameters + params_its _params; //! Layer parameters btp_codec _codec; //! BTP codec bool _device_mode; //! Set to true if the BTP layer shall encapsulate the upper layer PDU public: //! \publicsection @@ -43,12 +43,12 @@ public: //! \publicsection virtual ~btp_layer(){}; /*! - * \fn void sendMsg(const LibItsBtp__TestSystem::BtpReq& p_btp_req, params& p_param); + * \fn void sendMsg(const LibItsBtp__TestSystem::BtpReq& p_btp_req, params_its& p_param); * \brief Send BTP message to the lower layers * \param[in] p_btp_req The BTP message to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - void sendMsg(const LibItsBtp__TypesAndValues::BtpReq &p_btp_req, params &p_param); + void sendMsg(const LibItsBtp__TypesAndValues::BtpReq &p_btp_req, params_its &p_param); /*! * \virtual @@ -57,7 +57,7 @@ public: //! \publicsection * \param[in] p_data The data to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - virtual void send_data(OCTETSTRING &data, params ¶ms); + virtual void send_data(OCTETSTRING &data, params_its ¶ms); /*! * \virtual * \fn void receive_data(OCTETSTRING& data, params& params); @@ -65,5 +65,5 @@ public: //! \publicsection * \param[in] p_data The bytes formated data received * \param[in] p_params Some lower layers parameters values when data was received */ - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void receive_data(OCTETSTRING &data, params_its &info); }; // End of class btp_layer diff --git a/ccsrc/Protocols/CAM/cam_codec.cc b/ccsrc/Protocols/CAM/cam_codec.cc index 274f283..5dc0dae 100644 --- a/ccsrc/Protocols/CAM/cam_codec.cc +++ b/ccsrc/Protocols/CAM/cam_codec.cc @@ -15,7 +15,7 @@ int cam_codec::encode(const CAM__PDU__Descriptions::CAM &cam, OCTETSTRING &data) return rc; } -int cam_codec::decode(const OCTETSTRING &data, CAM__PDU__Descriptions::CAM &cam, params *params) { +int cam_codec::decode(const OCTETSTRING &data, CAM__PDU__Descriptions::CAM &cam, params_its *params) { loggers::get_instance().log_msg(">>> cam_codec::decode: ", data); int rc = asn_codec.decode(oct2bit(data), cam); diff --git a/ccsrc/Protocols/CAM/cam_codec.hh b/ccsrc/Protocols/CAM/cam_codec.hh index 0e5b5e4..cea9846 100644 --- a/ccsrc/Protocols/CAM/cam_codec.hh +++ b/ccsrc/Protocols/CAM/cam_codec.hh @@ -2,7 +2,7 @@ #include "cam_pdu_codec.hh" #include "codec.hh" -#include "params.hh" +#include "params_its.hh" class BITSTRING; //! Forward declaration of TITAN class class OCTETSTRING; //! Forward declaration of TITAN class @@ -19,5 +19,5 @@ public: virtual ~cam_codec(){}; virtual int encode(const CAM__PDU__Descriptions::CAM &cam, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, CAM__PDU__Descriptions::CAM &, params *params = NULL); + virtual int decode(const OCTETSTRING &data, CAM__PDU__Descriptions::CAM &, params_its *params = NULL); }; diff --git a/ccsrc/Protocols/CAM_layers/cam_layer.cc b/ccsrc/Protocols/CAM_layers/cam_layer.cc index d5c6645..32f77d3 100644 --- a/ccsrc/Protocols/CAM_layers/cam_layer.cc +++ b/ccsrc/Protocols/CAM_layers/cam_layer.cc @@ -21,7 +21,7 @@ cam_layer::cam_layer(const std::string &p_type, const std::string ¶m) : t_la registration::get_instance().add_item(p_type, this); } -void cam_layer::sendMsg(const LibItsCam__TypesAndValues::CamReq &p, params ¶ms) { +void cam_layer::sendMsg(const LibItsCam__TypesAndValues::CamReq &p, params_its ¶ms) { loggers::get_instance().log_msg(">>> cam_layer::sendMsg: ", p); // Encode CAM PDU @@ -34,13 +34,13 @@ void cam_layer::sendMsg(const LibItsCam__TypesAndValues::CamReq &p, params ¶ send_data(data, _params); } -void cam_layer::send_data(OCTETSTRING &data, params ¶ms) { +void cam_layer::send_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> cam_layer::send_data: ", data); send_to_all_layers(data, params); } -void cam_layer::receive_data(OCTETSTRING &data, params ¶ms) { +void cam_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> cam_layer::receive_data: ", data); // Sanity check @@ -60,63 +60,63 @@ void cam_layer::receive_data(OCTETSTRING &data, params ¶ms) { // Process lower layer data // recvTime - params::const_iterator it = params.find(params::timestamp); + params_its::const_iterator it = params.find(params_its::timestamp); if (it != params.cend()) { p.recvTime().set_long_long_val(std::stoll(it->second)); } else { p.recvTime().set_to_omit(); } // gnNextHeader - it = params.find(params::gn_next_header); + it = params.find(params_its::gn_next_header); if (it != params.cend()) { p.gnNextHeader() = std::stoi(it->second); } else { p.gnNextHeader().set_to_omit(); } // gnHeaderType - it = params.find(params::gn_header_type); + it = params.find(params_its::gn_header_type); if (it != params.cend()) { p.gnHeaderType() = std::stoi(it->second); } else { p.gnHeaderType().set_to_omit(); } // gnHeaderSubtype - it = params.find(params::gn_header_sub_type); + it = params.find(params_its::gn_header_sub_type); if (it != params.cend()) { p.gnHeaderSubtype() = std::stoi(it->second); } else { p.gnHeaderSubtype().set_to_omit(); } // gnLifetime - it = params.find(params::gn_lifetime); + it = params.find(params_its::gn_lifetime); if (it != params.cend()) { p.gnLifetime() = std::stoi(it->second); } else { p.gnLifetime().set_to_omit(); } // gnTrafficClass - it = params.find(params::gn_traffic_class); + it = params.find(params_its::gn_traffic_class); if (it != params.cend()) { p.gnTrafficClass() = std::stoi(it->second); } else { p.gnTrafficClass().set_to_omit(); } // btpDestinationPort - it = params.find(params::btp_destination_port); + it = params.find(params_its::btp_destination_port); if (it != params.cend()) { p.btpDestinationPort() = std::stoi(it->second); } else { p.btpDestinationPort().set_to_omit(); } // btpInfo - it = params.find(params::btp_info); + it = params.find(params_its::btp_info); if (it != params.cend()) { p.btpInfo() = std::stoi(it->second); } else { p.btpInfo().set_to_omit(); } // ssp - it = params.find(params::ssp); + it = params.find(params_its::ssp); if (it != params.cend()) { loggers::get_instance().log("cam_layer::receive_data: ssp=%s", it->second.c_str()); p.ssp() = oct2bit(str2oct(CHARSTRING(it->second.c_str()))); @@ -124,7 +124,7 @@ void cam_layer::receive_data(OCTETSTRING &data, params ¶ms) { p.ssp().set_to_omit(); } // its_aid - it = params.find(params::its_aid); + it = params.find(params_its::its_aid); if (it != params.cend()) { p.its__aid() = std::stoi(it->second); } else { diff --git a/ccsrc/Protocols/CAM_layers/cam_layer.hh b/ccsrc/Protocols/CAM_layers/cam_layer.hh index 12ef6a5..1f94911 100644 --- a/ccsrc/Protocols/CAM_layers/cam_layer.hh +++ b/ccsrc/Protocols/CAM_layers/cam_layer.hh @@ -24,8 +24,8 @@ namespace LibItsCam__TestSystem { * \brief This class provides description of ITS CAM protocol layer */ class cam_layer : public t_layer { - params _params; //! Layer parameters - cam_codec _codec; //! CAM codec + params_its _params; //! Layer parameters + cam_codec _codec; //! CAM codec public: //! \publicsection /*! * \brief Default constructor @@ -50,7 +50,7 @@ public: //! \publicsection * \param[in] p_cam_req The CA message to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - void sendMsg(const LibItsCam__TypesAndValues::CamReq &p_cam_req, params &p_params); + void sendMsg(const LibItsCam__TypesAndValues::CamReq &p_cam_req, params_its &p_params); /*! * \virtual @@ -59,7 +59,7 @@ public: //! \publicsection * \param[in] p_data The data to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - virtual void send_data(OCTETSTRING &data, params ¶ms); + virtual void send_data(OCTETSTRING &data, params_its ¶ms); /*! * \virtual * \fn void receive_data(OCTETSTRING& data, params& params); @@ -67,7 +67,7 @@ public: //! \publicsection * \param[in] p_data The bytes formated data received * \param[in] p_params Some lower layers parameters values when data was received */ - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void receive_data(OCTETSTRING &data, params_its &info); int enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security); diff --git a/ccsrc/Protocols/Commsignia/commsignia_layer.cc b/ccsrc/Protocols/Commsignia/commsignia_layer.cc index 81fd554..dd36b98 100644 --- a/ccsrc/Protocols/Commsignia/commsignia_layer.cc +++ b/ccsrc/Protocols/Commsignia/commsignia_layer.cc @@ -29,7 +29,7 @@ commsignia_layer::commsignia_layer(const std::string &p_type, const std::string _params.insert(std::pair(std::string("eth_type"), "8947")); } _eth_type = converter::get_instance().hexa_to_bytes(_params[params::eth_type]); - it = _params.find(params::interface_id); + it = _params.find(params_its::interface_id); if (it == _params.cend()) { _params.insert(std::pair(std::string("interface_id"), "1")); // The interfce id for filtering & to send on } @@ -52,7 +52,7 @@ commsignia_layer::commsignia_layer(const std::string &p_type, const std::string //_params.log(); } -void commsignia_layer::send_data(OCTETSTRING &data, params ¶ms) { +void commsignia_layer::send_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> commsignia_layer::send_data: ", data); OCTETSTRING buffer = OCTETSTRING(0, nullptr); @@ -65,7 +65,7 @@ void commsignia_layer::send_data(OCTETSTRING &data, params ¶ms) { } buffer += int2oct(0, 1); // Fix loggers::get_instance().log_msg("commsignia_layer::send_data: buffer: Injection=", buffer); - buffer += int2oct(std::stoi(_params[params::interface_id]), 4); + buffer += int2oct(std::stoi(_params[params_its::interface_id]), 4); loggers::get_instance().log_msg("commsignia_layer::send_data: buffer: Interface=", buffer); buffer += int2oct(std::stoi(_params[std::string("data_rate")]), 2); loggers::get_instance().log_msg("commsignia_layer::send_data: buffer: data_rate=", buffer); @@ -109,7 +109,7 @@ void commsignia_layer::send_data(OCTETSTRING &data, params ¶ms) { send_to_all_layers(buffer, params); } -void commsignia_layer::receive_data(OCTETSTRING &data, params ¶ms) { +void commsignia_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> commsignia_layer::receive_data: ", data); const unsigned char *p = static_cast(data); @@ -169,8 +169,8 @@ void commsignia_layer::receive_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log("commsignia_layer::receive_data: cbr_ant_2=%04x", r.u16_cbr_ant_2); // Filtering on antenna index loggers::get_instance().log("commsignia_layer::receive_data: compare %02x with %02x", r.u8_antenna, - static_cast(std::stoi(_params[params::interface_id]))); - if (r.u8_antenna != std::stoi(_params[params::interface_id])) { + static_cast(std::stoi(_params[params_its::interface_id]))); + if (r.u8_antenna != std::stoi(_params[params_its::interface_id])) { // Discard packet loggers::get_instance().warning("commsignia_layer::receive_data: Discard packet due to wrong antenna id"); // TODO return; diff --git a/ccsrc/Protocols/Commsignia/commsignia_layer.hh b/ccsrc/Protocols/Commsignia/commsignia_layer.hh index 5b2d52d..75e5e1b 100644 --- a/ccsrc/Protocols/Commsignia/commsignia_layer.hh +++ b/ccsrc/Protocols/Commsignia/commsignia_layer.hh @@ -10,7 +10,7 @@ */ #pragma once -#include "params.hh" +#include "params_its.hh" #include "t_layer.hh" class OCTETSTRING; //! Forward declaration of TITAN class @@ -108,7 +108,7 @@ class commsignia_layer : public layer { unsigned short type; } __attribute__((__packed__)) c2p_llc_hdr; - params _params; //! Layer parameters + params_its _params; //! Layer parameters std::vector _mac_src; //! Used to optimize filtering on source mac address in \see commsignia_layer::receive_data method std::vector _eth_type; //! Used to optimize filtering on ethernet type in \see commsignia_layer::receive_data method @@ -131,6 +131,6 @@ public: */ virtual ~commsignia_layer(){}; - virtual void send_data(OCTETSTRING &data, params ¶ms); - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void send_data(OCTETSTRING &data, params_its ¶ms); + virtual void receive_data(OCTETSTRING &data, params_its &info); }; // End of class commsignia_layer diff --git a/ccsrc/Protocols/DENM/denm_codec.cc b/ccsrc/Protocols/DENM/denm_codec.cc index 2a70c8f..86a53bb 100644 --- a/ccsrc/Protocols/DENM/denm_codec.cc +++ b/ccsrc/Protocols/DENM/denm_codec.cc @@ -15,7 +15,7 @@ int denm_codec::encode(const DENM__PDU__Descriptions::DENM &p_denm, OCTETSTRING return rc; } -int denm_codec::decode(const OCTETSTRING &p_data, DENM__PDU__Descriptions::DENM &p_denm, params *params) { +int denm_codec::decode(const OCTETSTRING &p_data, DENM__PDU__Descriptions::DENM &p_denm, params_its *params) { loggers::get_instance().log_msg(">>> denm_codec::decode:", p_data); int rc = asn_codec.decode(oct2bit(p_data), p_denm); diff --git a/ccsrc/Protocols/DENM/denm_codec.hh b/ccsrc/Protocols/DENM/denm_codec.hh index 9590674..2490cb0 100644 --- a/ccsrc/Protocols/DENM/denm_codec.hh +++ b/ccsrc/Protocols/DENM/denm_codec.hh @@ -2,7 +2,7 @@ #include "codec.hh" #include "denm_pdu_codec.hh" -#include "params.hh" +#include "params_its.hh" class BITSTRING; class OCTETSTRING; @@ -22,5 +22,5 @@ public: virtual ~denm_codec(){}; virtual int encode(const DENM__PDU__Descriptions::DENM &denm, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, DENM__PDU__Descriptions::DENM &, params *params = NULL); + virtual int decode(const OCTETSTRING &data, DENM__PDU__Descriptions::DENM &, params_its *params = NULL); }; diff --git a/ccsrc/Protocols/DENM_layers/denm_layer.cc b/ccsrc/Protocols/DENM_layers/denm_layer.cc index 921194f..535f0ed 100644 --- a/ccsrc/Protocols/DENM_layers/denm_layer.cc +++ b/ccsrc/Protocols/DENM_layers/denm_layer.cc @@ -19,7 +19,7 @@ denm_layer::denm_layer(const std::string &p_type, const std::string ¶m) : t_ registration::get_instance().add_item(p_type, this); } -void denm_layer::sendMsg(const LibItsDenm__TypesAndValues::DenmReq &p, params ¶ms) { +void denm_layer::sendMsg(const LibItsDenm__TypesAndValues::DenmReq &p, params_its ¶ms) { loggers::get_instance().log_msg(">>> denm_layer::sendMsg: ", p); // Encode DENM PDU @@ -32,13 +32,13 @@ void denm_layer::sendMsg(const LibItsDenm__TypesAndValues::DenmReq &p, params &p send_data(data, _params); } -void denm_layer::send_data(OCTETSTRING &data, params ¶ms) { +void denm_layer::send_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> denm_layer::send_data: ", data); // params.log(); send_to_all_layers(data, params); } -void denm_layer::receive_data(OCTETSTRING &data, params ¶ms) { +void denm_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> denm_layer::receive_data: ", data); // Sanity check @@ -65,56 +65,56 @@ void denm_layer::receive_data(OCTETSTRING &data, params ¶ms) { p.recvTime().set_to_omit(); } // gnNextHeader - it = params.find(params::gn_next_header); + it = params.find(params_its::gn_next_header); if (it != params.cend()) { p.gnNextHeader() = std::stoi(it->second); } else { p.gnNextHeader().set_to_omit(); } // gnHeaderType - it = params.find(params::gn_header_type); + it = params.find(params_its::gn_header_type); if (it != params.cend()) { p.gnHeaderType() = std::stoi(it->second); } else { p.gnHeaderType().set_to_omit(); } // gnHeaderSubtype - it = params.find(params::gn_header_sub_type); + it = params.find(params_its::gn_header_sub_type); if (it != params.cend()) { p.gnHeaderSubtype() = std::stoi(it->second); } else { p.gnHeaderSubtype().set_to_omit(); } // gnLifetime - it = params.find(params::gn_lifetime); + it = params.find(params_its::gn_lifetime); if (it != params.cend()) { p.gnLifetime() = std::stoi(it->second); } else { p.gnLifetime().set_to_omit(); } // gnTrafficClass - it = params.find(params::gn_traffic_class); + it = params.find(params_its::gn_traffic_class); if (it != params.cend()) { p.gnTrafficClass() = std::stoi(it->second); } else { p.gnTrafficClass().set_to_omit(); } // btpDestinationPort - it = params.find(params::btp_destination_port); + it = params.find(params_its::btp_destination_port); if (it != params.cend()) { p.btpDestinationPort() = std::stoi(it->second); } else { p.btpDestinationPort().set_to_omit(); } // btpInfo - it = params.find(params::btp_info); + it = params.find(params_its::btp_info); if (it != params.cend()) { p.btpInfo() = std::stoi(it->second); } else { p.btpInfo().set_to_omit(); } // ssp - it = params.find(params::ssp); + it = params.find(params_its::ssp); if (it != params.cend()) { loggers::get_instance().log("denm_layer::receive_data: ssp=%s", it->second.c_str()); p.ssp() = oct2bit(str2oct(CHARSTRING(it->second.c_str()))); @@ -122,7 +122,7 @@ void denm_layer::receive_data(OCTETSTRING &data, params ¶ms) { p.ssp().set_to_omit(); } // its_aid - it = params.find(params::its_aid); + it = params.find(params_its::its_aid); if (it != params.cend()) { p.its__aid() = std::stoi(it->second); } else { diff --git a/ccsrc/Protocols/DENM_layers/denm_layer.hh b/ccsrc/Protocols/DENM_layers/denm_layer.hh index 8997e67..d5a095c 100644 --- a/ccsrc/Protocols/DENM_layers/denm_layer.hh +++ b/ccsrc/Protocols/DENM_layers/denm_layer.hh @@ -24,7 +24,7 @@ namespace LibItsDenm__TestSystem { * \brief This class provides description of ITS DENM protocol layer */ class denm_layer : public t_layer { - params _params; //! Layer parameters + params_its _params; //! Layer parameters denm_codec _codec; //! DENM codec public: //! \publicsection /*! @@ -50,7 +50,7 @@ public: //! \publicsection * \param[in] p_denm_req The DEN message to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - void sendMsg(const LibItsDenm__TypesAndValues::DenmReq &p_denm_req, params ¶ms); + void sendMsg(const LibItsDenm__TypesAndValues::DenmReq &p_denm_req, params_its ¶ms); /*! * \virtual @@ -59,7 +59,7 @@ public: //! \publicsection * \param[in] p_data The data to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - virtual void send_data(OCTETSTRING &data, params ¶ms); + virtual void send_data(OCTETSTRING &data, params_its ¶ms); /*! * \virtual * \fn void receive_data(OCTETSTRING& data, params& params); @@ -67,7 +67,7 @@ public: //! \publicsection * \param[in] p_data The bytes formated data received * \param[in] p_params Some lower layers parameters values when data was received */ - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void receive_data(OCTETSTRING &data, params_its &info); int enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security); diff --git a/ccsrc/Protocols/ETH/ethernet_layer.cc b/ccsrc/Protocols/ETH/ethernet_layer.cc deleted file mode 100644 index f4004de..0000000 --- a/ccsrc/Protocols/ETH/ethernet_layer.cc +++ /dev/null @@ -1,82 +0,0 @@ -#include "ethernet_layer_factory.hh" - -#include "loggers.hh" - -ethernet_layer::ethernet_layer(const std::string & p_type, const std::string & param) : layer(p_type), _params() { - loggers::get_instance().log(">>> ethernet_layer::ethernet_layer: %s, %s", to_string().c_str(), param.c_str()); - // Setup parameters - params::convert(_params, param); - params::const_iterator it = _params.find("mac_src"); - if (it == _params.cend()) { - _params.insert(std::pair(std::string("mac_src"), "000000000000")); - } - it = _params.find("mac_bc"); - if (it == _params.cend()) { - _params.insert(std::pair(std::string("mac_bc"), "FFFFFFFFFFFF")); - } - it = _params.find("eth_type"); - if (it == _params.cend()) { - _params.insert(std::pair(std::string("eth_type"), "8947")); - } - //_params.log(); -} - -void ethernet_layer::send_data(OCTETSTRING& data, params& params) { - loggers::get_instance().log_msg(">>> ethernet_layer::send_data: ", data); - - OCTETSTRING eth; - // Destination MAC address - params::const_iterator it = params.find(params::mac_dst); // Find in provided parameters, params - if (it != params.cend()) { - eth = str2oct(CHARSTRING(it->second.c_str())); - } else { - it = _params.find(params::mac_dst); - if (it != _params.cend()) { - eth = str2oct(CHARSTRING(it->second.c_str())); - } else { - eth = str2oct(CHARSTRING(_params[params::mac_bc].c_str())); - } - } - // Source MAC address - it = params.find(params::mac_src); // Find in provided parameters, params - if (it != params.cend()) { - eth += str2oct(CHARSTRING(it->second.c_str())); - } else { - eth += str2oct(CHARSTRING(_params[params::mac_src].c_str())); - } - // Ethernet type - it = params.find(params::eth_type); // Find in layer parameters - if (it != params.cend()) { - eth += str2oct(CHARSTRING(it->second.c_str())); - } else { - eth += str2oct(CHARSTRING(_params[params::eth_type].c_str())); - } - - eth += data; - send_to_all_layers(eth, params); -} - -void ethernet_layer::receive_data(OCTETSTRING& data, params& params) { - loggers::get_instance().log_msg(">>> ethernet_layer::receive_data: ", data); - - // Extract dest MAC Address - OCTETSTRING dst = OCTETSTRING(6, static_cast(data)); - //loggers::get_instance().log_msg("ethernet_layer::receive_data: dst: ", dst); - // Extract source MAC Address - OCTETSTRING src = OCTETSTRING(6, 6 + static_cast(data)); - //loggers::get_instance().log_msg("ethernet_layer::receive_data: src: ", src); - // Extract ethertype - OCTETSTRING proto = OCTETSTRING(2, 2 + static_cast(data)); - //loggers::get_instance().log_msg("ethernet_layer::receive_data: proto: ", proto); - data = OCTETSTRING(data.lengthof() - 14, 14 + static_cast(data)); - // Update params - CHARSTRING s = oct2str(dst); - params.insert(std::pair(params::mac_dst, std::string(static_cast(s)))); - s = oct2str(src); - params.insert(std::pair(params::mac_src, std::string(static_cast(s)))); - //loggers::get_instance().log_msg("ethernet_layer::receive_data: payload for upper layer:", data); - - receive_to_all_layers(data, params); -} - -ethernet_layer_factory ethernet_layer_factory::_f; diff --git a/ccsrc/Protocols/ETH/ethernet_layer.hh b/ccsrc/Protocols/ETH/ethernet_layer.hh deleted file mode 100644 index e4d8b35..0000000 --- a/ccsrc/Protocols/ETH/ethernet_layer.hh +++ /dev/null @@ -1,48 +0,0 @@ -/*! - * \file udp_layer.hh - * \brief Header file for ITS UDP/IP protocol layer definition. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include "params.hh" -#include "t_layer.hh" - -class ethernet_layer : public layer { - params _params; //! Layer parameters - -public: //! \publicsection - /*! - * \brief Specialised constructor - * Create a new instance of the ethernet_layer class - * \param[in] p_type \todo - * \param[in] p_param \todo - */ - ethernet_layer(const std::string &p_type, const std::string ¶m); - /*! - * \brief Default destructor - */ - virtual ~ethernet_layer(){}; - - /*! - * \virtual - * \fn void send_data(OCTETSTRING& data, params& params); - * \brief Send bytes formated data to the lower layers - * \param[in] p_data The data to be sent - * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters - */ - virtual void send_data(OCTETSTRING &data, params ¶ms); - /*! - * \virtual - * \fn void receive_data(OCTETSTRING& data, params& params); - * \brief Receive bytes formated data from the lower layers - * \param[in] p_data The bytes formated data received - * \param[in] p_params Some lower layers parameters values when data was received - */ - virtual void receive_data(OCTETSTRING &data, params &info); -}; // End of class ethernet_layer diff --git a/ccsrc/Protocols/ETH/ethernet_layer_factory.hh b/ccsrc/Protocols/ETH/ethernet_layer_factory.hh deleted file mode 100644 index 7adf9f4..0000000 --- a/ccsrc/Protocols/ETH/ethernet_layer_factory.hh +++ /dev/null @@ -1,42 +0,0 @@ -/*! - * \file ethernet_layer_factory.hh - * \brief Header file for ITS Ethernet protocol layer factory. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include "layer_stack_builder.hh" - -#include "ethernet_layer.hh" - -/*! - * \class ethernet_layer_factory - * \brief This class provides a factory class to create an ethernet_layer class instance - */ -class ethernet_layer_factory : public layer_factory { - static ethernet_layer_factory _f; //! Reference to the unique instance of this class -public: //! \publicsection - /*! - * \brief Default constructor - * Create a new instance of the ethernet_layer_factory class - * \remark The ETH layer identifier is ETH - */ - ethernet_layer_factory() { - // register factory - layer_stack_builder::register_layer_factory("ETH", this); - }; - /*! - * \fn layer* create_layer(const std::string & type, const std::string & param); - * \brief Create the layers stack based on the provided layers stack description - * \param[in] p_type The provided layers stack description - * \param[in] p_params Optional parameters - * \return 0 on success, -1 otherwise - * \inline - */ - inline virtual layer *create_layer(const std::string &p_type, const std::string &p_param) { return new ethernet_layer(p_type, p_param); }; -}; // End of class ethernet_layer_factory diff --git a/ccsrc/Protocols/ETH/module.mk b/ccsrc/Protocols/ETH/module.mk deleted file mode 100644 index eb2f4a8..0000000 --- a/ccsrc/Protocols/ETH/module.mk +++ /dev/null @@ -1,3 +0,0 @@ -sources := ethernet_layer.cc -includes := . - diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_codec.cc b/ccsrc/Protocols/GeoNetworking/geonetworking_codec.cc index b883063..be8b6b8 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_codec.cc +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_codec.cc @@ -144,7 +144,7 @@ int geonetworking_codec::encode_(const Base_Type &type, const TTCN_Typedescripto return 0; } -int geonetworking_codec::decode(const OCTETSTRING &data, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu &msg, params *params) { +int geonetworking_codec::decode(const OCTETSTRING &data, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu &msg, params_its *params) { TTCN_EncDec::clear_error(); TTCN_Buffer decoding_buffer(data); @@ -157,11 +157,11 @@ int geonetworking_codec::decode(const OCTETSTRING &data, LibItsGeoNetworking__Ty loggers::get_instance().log("geonetworking_codec::decode: After decoding, payload: plLength=%d", _dc.get_length()); // Set layer parameters if (_params != NULL) { - (*_params)[params::gn_next_header] = std::to_string((unsigned int)_dc.get_next_header()); - (*_params)[params::gn_header_type] = std::to_string((unsigned int)_dc.get_header_type()); - (*_params)[params::gn_header_sub_type] = std::to_string((unsigned int)_dc.get_header_sub_type()); - (*_params)[params::gn_traffic_class] = std::to_string((unsigned int)_dc.get_traffic_class()); - (*_params)[params::gn_lifetime] = std::to_string(_dc.get_lifetime()); + (*_params)[params_its::gn_next_header] = std::to_string((unsigned int)_dc.get_next_header()); + (*_params)[params_its::gn_header_type] = std::to_string((unsigned int)_dc.get_header_type()); + (*_params)[params_its::gn_header_sub_type] = std::to_string((unsigned int)_dc.get_header_sub_type()); + (*_params)[params_its::gn_traffic_class] = std::to_string((unsigned int)_dc.get_traffic_class()); + (*_params)[params_its::gn_lifetime] = std::to_string(_dc.get_lifetime()); params->log(); } @@ -247,17 +247,17 @@ int geonetworking_codec::decode_(Base_Type &type, const TTCN_Typedescriptor_t &f if (_dc.get_length() != 0) { if ((unsigned char)s.lengthof() <= _dc.get_length()) { os = OCTETSTRING(s.lengthof(), p); - (*_params)[params::gn_payload] = static_cast(oct2str(os)); + (*_params)[params_its::gn_payload] = static_cast(oct2str(os)); } else { os = OCTETSTRING(_dc.get_length(), p); - (*_params)[params::gn_payload] = static_cast(oct2str(os)); + (*_params)[params_its::gn_payload] = static_cast(oct2str(os)); } } else { os = OCTETSTRING(0, nullptr); - (*_params)[params::gn_payload] = ""; + (*_params)[params_its::gn_payload] = ""; } // loggers::get_instance().log_msg("geonetworking_codec::decode_: Payload: os: ", os); - // loggers::get_instance().log("geonetworking_codec::decode_: Payload: '%s'", (*_params)[params::gn_payload].c_str()); + // loggers::get_instance().log("geonetworking_codec::decode_: Payload: '%s'", (*_params)[params_its::gn_payload].c_str()); if (os.lengthof() != 0) { dynamic_cast &>(type) = OPTIONAL(os); // loggers::get_instance().log_msg("geonetworking_codec::decode_: Set OPTIONAL to ", type); diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_codec.hh b/ccsrc/Protocols/GeoNetworking/geonetworking_codec.hh index 1cca7ec..c63b5ec 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_codec.hh +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_codec.hh @@ -3,7 +3,7 @@ #include #include "codec.hh" -#include "params.hh" +#include "params_its.hh" #include "decoding_context.hh" #include "encoding_context.hh" @@ -42,7 +42,7 @@ public: virtual ~geonetworking_codec(){}; virtual int encode(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu &msg, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu &msg, params *params = NULL); + virtual int decode(const OCTETSTRING &data, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu &msg, params_its *params = NULL); int encode(const LibItsGeoNetworking__TypesAndValues::GnNonSecuredPacket &p_gnNonSecuredPacket, OCTETSTRING & data); // TODO Duplicate code with virtual encode, to be enhanced diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc index 7349a20..5692eb5 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc @@ -59,81 +59,81 @@ void geonetworking_layer::init(const std::string &p_type, const std::string &p_p loggers::get_instance().log(">>> geonetworking_layer::init: %s, %s", to_string().c_str(), p_param.c_str()); // Setup parameters - params::convert(_params, p_param); + params_its::convert(_params, p_param); // Sanity checks - params::const_iterator it = _params.find(params::latitude); + params_its::const_iterator it = _params.find(params_its::latitude); if (it != _params.cend()) { _latitude = converter::get_instance().string_to_int(it->second); } - it = _params.find(params::longitude); + it = _params.find(params_its::longitude); if (it != _params.cend()) { _longitude = converter::get_instance().string_to_int(it->second); } OCTETSTRING ll_address; - it = _params.find(params::ll_address); + it = _params.find(params_its::ll_address); if (it != _params.cend()) { ll_address = str2oct(CHARSTRING(it->second.c_str())); } INTEGER distanceA = 1000; // 1km - it = _params.find(params::distanceA); + it = _params.find(params_its::distanceA); if (it != _params.cend()) { distanceA = converter::get_instance().string_to_int(it->second); } INTEGER distanceB = 1000; // 1Km - it = _params.find(params::distanceB); + it = _params.find(params_its::distanceB); if (it != _params.cend()) { distanceB = converter::get_instance().string_to_int(it->second); } INTEGER angle = 0; - it = _params.find(params::angle); + it = _params.find(params_its::angle); if (it != _params.cend()) { angle = converter::get_instance().string_to_int(it->second); } INTEGER station_type = 5; // passangerCar - it = _params.find(params::station_type); + it = _params.find(params_its::station_type); if (it != _params.cend()) { station_type = converter::get_instance().string_to_int(it->second); } INTEGER country = 0; - it = _params.find(params::country); + it = _params.find(params_its::country); if (it != _params.cend()) { country = converter::get_instance().string_to_int(it->second); } INTEGER type_of_address = 1; // Manual - it = _params.find(params::type_of_address); + it = _params.find(params_its::type_of_address); if (it != _params.cend()) { type_of_address = converter::get_instance().string_to_int(it->second); } - it = _params.find(params::device_mode); + it = _params.find(params_its::device_mode); if (it != _params.cend()) { _device_mode = (1 == converter::get_instance().string_to_int(it->second)); } - it = _params.find(params::secured_mode); + it = _params.find(params_its::secured_mode); if (it != _params.cend()) { _secured_mode = (1 == converter::get_instance().string_to_int(it->second)); } else { - _params.insert(std::pair(params::secured_mode, "0")); + _params.insert(std::pair(params_its::secured_mode, "0")); } - it = _params.find(params::encrypted_mode); + it = _params.find(params_its::encrypted_mode); if (it != _params.cend()) { _encrypted_mode = (1 == converter::get_instance().string_to_int(it->second)); } else { - _params.insert(std::pair(params::encrypted_mode, "0")); + _params.insert(std::pair(params_its::encrypted_mode, "0")); } - it = _params.find(params::enable_security_checks); + it = _params.find(params_its::enable_security_checks); if (it != _params.cend()) { _enable_security_checks = (1 == converter::get_instance().string_to_int(it->second)); } // Add broadcast address if needed - it = _params.find(params::its_aid); + it = _params.find(params_its::its_aid); if (it == _params.cend()) { - _params.insert(std::pair(params::its_aid, "141")); + _params.insert(std::pair(params_its::its_aid, "141")); } - it = _params.find(params::mac_bc); + it = _params.find(params_its::mac_bc); if (it == _params.cend()) { - _params.insert(std::pair(params::its_aid, "FFFFFFFFFFFF")); + _params.insert(std::pair(params_its::its_aid, "FFFFFFFFFFFF")); } // Set up default security parameters value @@ -144,7 +144,7 @@ void geonetworking_layer::init(const std::string &p_type, const std::string &p_p // Automatic beaconing mode fill_beacon(ll_address, station_type, country, type_of_address); - params::const_iterator i = _params.find(params::beaconing); + params_its::const_iterator i = _params.find(params_its::beaconing); if ((i != _params.cend()) && (i->second.compare("1") == 0)) { // Immediate beaconing was requested // Prepare beaconing operation start_beaconing(); @@ -166,27 +166,27 @@ void geonetworking_layer::init(const std::string &p_type, const std::string &p_p base_time::get_instance().set_leap_delay_us(4 * 1000000); // TODO Set it as parameter } // End of init_params -void geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingReq &p, params &p_params) { +void geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingReq &p, params_its &p_params) { loggers::get_instance().log(">>> geonetworking_layer::sendMsg"); - params param(_params); + params_its param(_params); // Encode GeoNetworking PDU OCTETSTRING data; _codec.encode(p.msgOut(), data); - params::const_iterator it = param.find(params::its_aid); + params_its::const_iterator it = param.find(params_its::its_aid); if (it != param.cend()) { - int aid = std::stoi(param[params::its_aid]); + int aid = std::stoi(param[params_its::its_aid]); loggers::get_instance().log("geonetworking_layer::sendMsg: aid=%d/%d", aid, (int)p.its__aid()); if (aid != (int)p.its__aid()) { - param[params::its_aid] = std::to_string((int)p.its__aid()); - loggers::get_instance().log("geonetworking_layer::sendMsg: New aid=%s", param[params::its_aid].c_str()); + param[params_its::its_aid] = std::to_string((int)p.its__aid()); + loggers::get_instance().log("geonetworking_layer::sendMsg: New aid=%s", param[params_its::its_aid].c_str()); } } else{ - param.insert(std::pair(params::its_aid, std::to_string((int)p.its__aid()))); + param.insert(std::pair(params_its::its_aid, std::to_string((int)p.its__aid()))); } if (_force_certificate == true) { // Force certificate instead of hashed_id in next message _force_certificate = false; - param.insert(std::pair(params::force_certificate, std::string("1"))); + param.insert(std::pair(params_its::force_certificate, std::string("1"))); } loggers::get_instance().log("geonetworking_layer::sendMsg: _params"); _params.log(); @@ -195,13 +195,13 @@ void geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::Geo send_data(data, param); } -void geonetworking_layer::send_data(OCTETSTRING &data, params ¶ms) { +void geonetworking_layer::send_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> geonetworking_layer::send_data: ", data); params.log(); if (_device_mode) { // Need to build a GN packet - params[params::certificate] = _params[params::certificate]; - params[params::hash] = _params[params::hash]; // TODO Should be removed + params[params_its::certificate] = _params[params_its::certificate]; + params[params_its::hash] = _params[params_its::hash]; // TODO Should be removed if (build_geonetworking_pdu(data, params) != 0) { return; } @@ -226,7 +226,7 @@ const TTCN_RAWdescriptor_t _intx_raw_ = {RAW_INTX, SG_NO, ORDER_MSB, TOP_BIT_INHERITED, 0, 0, 0, 8, 0, NULL, -1, CharCoding::UNKNOWN}; const TTCN_Typedescriptor_t _intx_descr_ = {"IntX", NULL, &_intx_raw_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE}; -void geonetworking_layer::receive_data(OCTETSTRING &data, params ¶ms) { +void geonetworking_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> geonetworking_layer::receive_data: ", data); // Check security mode @@ -369,7 +369,7 @@ void geonetworking_layer::receive_data(OCTETSTRING &data, params ¶ms) { // Add lower layers parameters // 1. Destination MAC address - params::const_iterator it = params.find(params::mac_dst); + params_its::const_iterator it = params.find(params_its::mac_dst); if (it != params.cend()) { loggers::get_instance().log("geonetworking_layer::receive_data: dst=%s", it->second.c_str()); ind.macDestinationAddress() = str2oct(CHARSTRING(it->second.c_str())); @@ -377,7 +377,7 @@ void geonetworking_layer::receive_data(OCTETSTRING &data, params ¶ms) { ind.macDestinationAddress() = str2oct(CHARSTRING(_params["mac_bc"].c_str())); } // 2. ssp - it = params.find(params::ssp); + it = params.find(params_its::ssp); if (it != params.cend()) { loggers::get_instance().log("geonetworking_layer::receive_data: ssp=%s", it->second.c_str()); ind.ssp() = oct2bit(str2oct(CHARSTRING(it->second.c_str()))); @@ -385,7 +385,7 @@ void geonetworking_layer::receive_data(OCTETSTRING &data, params ¶ms) { ind.ssp().set_to_omit(); } // 3. its_aid - it = params.find(params::its_aid); + it = params.find(params_its::its_aid); if (it != params.cend()) { loggers::get_instance().log("geonetworking_layer::receive_data: its_aid=%s", it->second.c_str()); ind.its__aid() = std::stoi(it->second.c_str()); @@ -394,7 +394,7 @@ void geonetworking_layer::receive_data(OCTETSTRING &data, params ¶ms) { } // Pass the GeoNetworking raw payload to the upper layers if any - it = params.find(params::gn_payload); + it = params.find(params_its::gn_payload); if (it != params.cend()) { loggers::get_instance().log("geonetworking_layer::receive_data: gn_payload=%s", it->second.c_str()); OCTETSTRING os(str2oct(CHARSTRING(it->second.c_str()))); @@ -407,7 +407,7 @@ void geonetworking_layer::receive_data(OCTETSTRING &data, params ¶ms) { to_all_upper_ports(ind, params); } -OCTETSTRING geonetworking_layer::trigger_ac_event(OCTETSTRING &data, params ¶ms) { +OCTETSTRING geonetworking_layer::trigger_ac_event(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_to_hexa(">>> geonetworking_layer::trigger_ac_event: ", data); return int2oct(0, 2); @@ -442,7 +442,7 @@ void geonetworking_layer::start_beaconing() { loggers::get_instance().log("geonetworking_layer::start_beaconing: timer ID is 0x%x\n", (long)_timerid); // Start the timer unsigned int expiry = 1000; // Default expiry time 1000ms - params::const_iterator i = _params.find("expiry"); + params_its::const_iterator i = _params.find("expiry"); if (i != _params.cend()) { expiry = static_cast(std::strtoul(i->second.c_str(), nullptr, 10)); } @@ -501,9 +501,9 @@ void geonetworking_layer::send_beacon() { TTCN_Buffer encoding_buffer; _beacon->encode(*(_beacon->get_descriptor()), encoding_buffer, TTCN_EncDec::CT_RAW); OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); - params params(_params); + params_its params(_params); if (_secured_mode) { // Apply Security - if (build_secured_pdu(data, _params) != 0) { + if (build_secured_pdu(data, params) != 0) { return; } } @@ -544,14 +544,14 @@ int geonetworking_layer::enable_secured_mode(const std::string &p_certificate_id setup_secured_mode(); } _enable_security_checks = p_enforce_security; - params::const_iterator it = _params.find(params::certificate); + params_its::const_iterator it = _params.find(params_its::certificate); if (it == _params.cend()) { - _params.insert(std::pair(params::certificate, p_certificate_id)); + _params.insert(std::pair(params_its::certificate, p_certificate_id)); } else { - _params[params::certificate] = p_certificate_id; + _params[params_its::certificate] = p_certificate_id; } - loggers::get_instance().log("geonetworking_layer::enable_secured_mode: Certificate to be used: '%s'", _params[params::certificate].c_str()); + loggers::get_instance().log("geonetworking_layer::enable_secured_mode: Certificate to be used: '%s'", _params[params_its::certificate].c_str()); return 0; } @@ -724,22 +724,22 @@ void geonetworking_layer::timer_irq_sigalrm_handler(int p_signal, siginfo_t *p_s static_cast(p_signal_info->si_value.sival_ptr)->send_beacon(); } // End of method timer_irq_sigalrm_handler -int geonetworking_layer::build_geonetworking_pdu(OCTETSTRING &data, params ¶ms) { +int geonetworking_layer::build_geonetworking_pdu(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log(">>> geonetworking_layer::build_geonetworking_pdu"); // params.log(); std::string next_header; - params::const_iterator it = params.find(params::next_header); + params_its::const_iterator it = params.find(params_its::next_header); if (it != params.cend()) { next_header = it->second.c_str(); } std::string header_type; - it = params.find(params::header_type); + it = params.find(params_its::header_type); if (it != params.cend()) { header_type = it->second.c_str(); } std::string header_sub_type; - it = params.find(params::header_sub_type); + it = params.find(params_its::header_sub_type); if (it != params.cend()) { header_sub_type = it->second.c_str(); } @@ -753,7 +753,7 @@ int geonetworking_layer::build_geonetworking_pdu(OCTETSTRING &data, params ¶ return -1; } // Update NextHeader - it = params.find(params::next_header); + it = params.find(params_its::next_header); if (next_header.compare("btpB") == 0) { _shb_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpB; } else { // Default btp is btpA @@ -779,7 +779,7 @@ int geonetworking_layer::build_geonetworking_pdu(OCTETSTRING &data, params ¶ // Update sequence number eh->tsbHeader().seqNumber() = _sequence_number++; // Update NextHeader - it = params.find(params::next_header); + it = params.find(params_its::next_header); if (next_header.compare("btpB") == 0) { _tsb_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpB; } else { // Default btp is btpA @@ -804,7 +804,7 @@ int geonetworking_layer::build_geonetworking_pdu(OCTETSTRING &data, params ¶ return -1; } // Update NextHeader - it = params.find(params::next_header); + it = params.find(params_its::next_header); if (next_header.compare("btpB") == 0) { _uni_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpB; } else { // Default btp is btpA @@ -832,7 +832,7 @@ int geonetworking_layer::build_geonetworking_pdu(OCTETSTRING &data, params ¶ return -1; } // Update NextHeader - it = params.find(params::next_header); + it = params.find(params_its::next_header); if (next_header.compare("btpB") == 0) { _gbc_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpB; } else { // Default btp is btpA @@ -857,7 +857,7 @@ int geonetworking_layer::build_geonetworking_pdu(OCTETSTRING &data, params ¶ return 0; } -int geonetworking_layer::build_secured_pdu(OCTETSTRING &data, params ¶ms) { +int geonetworking_layer::build_secured_pdu(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> geonetworking_layer::build_secured_pdu: ", data); // params.log(); @@ -914,15 +914,15 @@ int geonetworking_layer::setup_secured_mode() { loggers::get_instance().log("geonetworking_layer::setup_secured_mode: GN Layer address = %p", this); - params::const_iterator it = _params.find(params::certificate); + params_its::const_iterator it = _params.find(params_its::certificate); if (it == _params.cend()) { _params.insert(std::pair(std::string("certificate"), "CERT_TS_A_AT")); } - it = _params.find(params::sec_db_path); + it = _params.find(params_its::sec_db_path); if (it == _params.cend()) { _params.insert(std::pair(std::string("sec_db_path"), "")); } - it = _params.find(params::hash); + it = _params.find(params_its::hash); if (it == _params.cend()) { _params.insert(std::pair(std::string("hash"), "SHA-256")); } diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh index 8224853..07d6bd8 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh @@ -43,7 +43,7 @@ namespace LibItsGeoNetworking__TypesAndValues { * \brief This class provides description of ITS GeoNetworking protocol layer */ class geonetworking_layer : public t_layer { - params _params; /*!< Layer parameters */ + params_its _params; /*!< Layer parameters */ geonetworking_codec _codec; /*!< GeoNetworking codec object reference. \see geonetworking_codec */ LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu *_beacon; /*!< Data structure used for beaconing */ LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu @@ -145,38 +145,38 @@ public: virtual ~geonetworking_layer(); /*! - * \fn void sendMsg(const LibItsGeoNetworking__TestSystem::GeoNetworkingReq& p_gn_req, params& p_param); + * \fn void sendMsg(const LibItsGeoNetworking__TestSystem::GeoNetworkingReq& p_gn_req, params_its& p_param); * \brief Send GeoNetworking message to the lower layers * \param[in] p_gn_req The GeoNetworking message to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - void sendMsg(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingReq &p_gn_req, params &p_param); + void sendMsg(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingReq &p_gn_req, params_its &p_param); /*! * \virtual - * \fn void send_data(OCTETSTRING& data, params& params); + * \fn void send_data(OCTETSTRING& data, params_its& params); * \brief Send bytes formated data to the lower layers * \param[in] p_data The data to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - virtual void send_data(OCTETSTRING &data, params ¶ms); + virtual void send_data(OCTETSTRING &data, params_its ¶ms); /*! * \virtual - * \fn void receive_data(OCTETSTRING& data, params& params); + * \fn void receive_data(OCTETSTRING& data, params_its& params); * \brief Receive bytes formated data from the lower layers * \param[in] p_data The bytes formated data received * \param[in] p_params Some lower layers parameters values when data was received */ - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void receive_data(OCTETSTRING &data, params_its &info); /*! * \virtual - * \fn void send_data(OCTETSTRING& data, params& params); + * \fn void send_data(OCTETSTRING& data, params_its& params); * \brief Send bytes formated data to the lower layers * \param[in] p_data The data to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - virtual OCTETSTRING trigger_ac_event(OCTETSTRING &data, params ¶ms); + virtual OCTETSTRING trigger_ac_event(OCTETSTRING &data, params_its ¶ms); const LibItsGeoNetworking__TypesAndValues::LongPosVector *get_lpv(const LibItsGeoNetworking__TypesAndValues::GN__Address &p_gn_address); void start_beaconing(); @@ -191,8 +191,8 @@ public: private: void init(const std::string &p_type, const std::string &p_param); void send_beacon(); - int build_geonetworking_pdu(OCTETSTRING &data, params ¶ms); - int build_secured_pdu(OCTETSTRING &data, params ¶ms); + int build_geonetworking_pdu(OCTETSTRING &data, params_its ¶ms); + int build_secured_pdu(OCTETSTRING &data, params_its ¶ms); int decode_basic_header(const OCTETSTRING &p_data, LibItsGeoNetworking__TypesAndValues::BasicHeader &p_basic_header); int setup_secured_mode(); diff --git a/ccsrc/Protocols/Http/http_codec.cc b/ccsrc/Protocols/Http/http_codec.cc deleted file mode 100644 index f78ad74..0000000 --- a/ccsrc/Protocols/Http/http_codec.cc +++ /dev/null @@ -1,754 +0,0 @@ -#include -#include -#include - -#include "codec_stack_builder.hh" - -#include "http_codec.hh" - -#include "loggers.hh" - -#include "LibItsHttp_MessageBodyTypes.hh" -#include "LibItsHttp_TypesAndValues.hh" -#include "LibItsHttp_XmlMessageBodyTypes.hh" - -#include "http_etsi_ieee1609dot2_codec.hh" - -int http_codec::encode(const LibItsHttp__TypesAndValues::HttpMessage &msg, OCTETSTRING &data) { - loggers::get_instance().log_msg(">>> http_codec::encode: ", (const Base_Type &)msg); - loggers::get_instance().log(">>> http_codec::encode: %p", this); - - TTCN_EncDec::clear_error(); - TTCN_Buffer encoding_buffer; - - _ec.reset(); - - int result; - if (msg.ischosen(LibItsHttp__TypesAndValues::HttpMessage::ALT_request)) { - result = encode_request(msg.request(), encoding_buffer); - } else if (msg.ischosen(LibItsHttp__TypesAndValues::HttpMessage::ALT_response)) { - result = encode_response(msg.response(), encoding_buffer); - } else { - loggers::get_instance().warning("http_codec::encode: Unbound HttpMessage"); - return -1; - } - - data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); - - loggers::get_instance().log_msg("<<< http_codec::encode: data=", data); - return result; -} - -int http_codec::decode(const OCTETSTRING &data, LibItsHttp__TypesAndValues::HttpMessage &msg, params *params) { - loggers::get_instance().log_msg(">>> http_codec::decode: data=", data); - - TTCN_EncDec::clear_error(); - TTCN_Buffer decoding_buffer(data); - loggers::get_instance().log_to_hexa("http_codec::decode: decoding_buffer=", decoding_buffer); - - _dc.reset(); - - _params = params; - - // Get the first line (e.g. HTTP/1.1 302 Found or POST / HTTP/1.1) - CHARSTRING message_id; - if (get_line(decoding_buffer, message_id) == -1) { - return -1; - } - loggers::get_instance().log_msg("http_codec::decode: message_id: ", message_id); - // Extract parameters - try { - std::string str(static_cast(message_id)); - std::regex rgx("\\s*(\\w+)/"); - std::sregex_iterator begin(str.cbegin(), str.cend(), rgx); - std::smatch m = *begin; - loggers::get_instance().log("http_codec::decode: %d - %s", m.size(), m[0].str().c_str()); - if (m[0].str().compare("HTTP/") == 0) { // HTTP response - LibItsHttp__TypesAndValues::Response response; - std::regex rgx("\\s*HTTP/(\\d+)\\.(\\d+)\\s+(\\d+)\\s+([\\w\\s\\t\\v\\f]+)*"); - std::sregex_iterator begin(str.cbegin(), str.cend(), rgx); - std::smatch m = *begin; - loggers::get_instance().log("http_codec::decode: Process response: %d", m.size()); - if (m.size() != 5) { - loggers::get_instance().error("http_codec::decode: Unsupported tag"); - return -1; - } - response.version__major() = std::stoi(m[1].str().c_str()); - response.version__minor() = std::stoi(m[2].str().c_str()); - response.statuscode() = std::stoi(m[3].str().c_str()); - response.statustext() = CHARSTRING(m[4].str().c_str()); - LibItsHttp__TypesAndValues::Headers headers; - std::string content_type; - decode_headers(decoding_buffer, headers, content_type); - response.header() = headers; - loggers::get_instance().log_to_hexa("Before decoding Body: ", decoding_buffer); - LibItsHttp__MessageBodyTypes::HttpMessageBody body; - if (decode_body(decoding_buffer, body, content_type) == -1) { - response.body().set_to_omit(); - } else { - response.body() = OPTIONAL(body); - } - msg.response() = response; - } else { // HTTP request - LibItsHttp__TypesAndValues::Request request; - std::regex rgx("\\s*(\\w+)\\s+(.+)\\s+HTTP/(\\d)\\.(\\d)"); - std::sregex_iterator begin(str.cbegin(), str.cend(), rgx); - std::smatch m = *begin; - if (m.size() != 5) { - loggers::get_instance().error("http_codec::decode: Unsupported tag"); - return -1; - } - request.method() = CHARSTRING(m[1].str().c_str()); - request.uri() = CHARSTRING(m[2].str().c_str()); - request.version__major() = std::stoi(m[3].str().c_str()); - request.version__minor() = std::stoi(m[4].str().c_str()); - LibItsHttp__TypesAndValues::Headers headers; - std::string content_type; - decode_headers(decoding_buffer, headers, content_type); - request.header() = headers; - OPTIONAL body; - body.set_to_omit(); - if (decode_body(decoding_buffer, body, content_type) == -1) { - request.body().set_to_omit(); - } else { - request.body() = body; - } - msg.request() = request; - } - - loggers::get_instance().log_msg("<<< http_codec::decode: ", (const Base_Type &)msg); - return 0; - } catch (const std::logic_error &e) { - return -1; - } -} - -int http_codec::encode_request(const LibItsHttp__TypesAndValues::Request &p_request, TTCN_Buffer &p_encoding_buffer) { - loggers::get_instance().log_msg(">>> http_codec::encode_request: ", (const Base_Type &)p_request); - - // Encode generic part - p_encoding_buffer.put_cs(p_request.method()); - p_encoding_buffer.put_c(' '); - p_encoding_buffer.put_cs(p_request.uri()); - p_encoding_buffer.put_cs(" HTTP/"); - p_encoding_buffer.put_cs(int2str(p_request.version__major())); - p_encoding_buffer.put_c('.'); - p_encoding_buffer.put_cs(int2str(p_request.version__minor())); - p_encoding_buffer.put_cs("\r\n"); - - // Encode headers excepeted the Content-Length - const LibItsHttp__TypesAndValues::Headers &headers = p_request.header(); - std::string content_type; - for (int i = 0; i < headers.size_of(); i++) { - const LibItsHttp__TypesAndValues::Header &header = headers[i]; - loggers::get_instance().log_msg("http_codec::encode_request: Processing header ", header.header__name()); - if (std::string(static_cast(header.header__name())).compare("Content-Length") == 0) { // Skip it, processed later - loggers::get_instance().log("http_codec::encode_request: Skip it"); - continue; - } else { - p_encoding_buffer.put_cs(header.header__name()); - p_encoding_buffer.put_cs(": "); - const OPTIONAL &o = header.header__value(); - if (o.ispresent()) { - const LibItsHttp__TypesAndValues::charstring__list &v = dynamic_cast &>(o); - if (v.size_of() > 0) { - loggers::get_instance().log_msg("http_codec::encode_request: Processing value ", v[0]); - if (std::string(static_cast(header.header__name())).compare("Content-Type") == 0) { // Store it for HTTP body payload encoding - loggers::get_instance().log("http_codec::encode_request: Storing Content-Type"); - int j = 0; - while (j < v.size_of()) { - content_type += v[j++]; - } // End of 'while' statement - } - p_encoding_buffer.put_cs(v[0]); - int j = 1; - while (j < v.size_of()) { - p_encoding_buffer.put_cs(", "); - loggers::get_instance().log_msg("http_codec::encode_request: Processing value ", v[j]); - p_encoding_buffer.put_cs(v[j++]); - } // End of 'while' statement - } - } // else, do not include it - } - p_encoding_buffer.put_cs("\r\n"); - } // End of 'for' statement - - // Encode message body - const OPTIONAL &v = p_request.body(); - OCTETSTRING os; - if (v.ispresent()) { - const LibItsHttp__MessageBodyTypes::HttpMessageBody &body = static_cast(*v.get_opt_value()); - loggers::get_instance().log_msg("http_codec::encode_request: body: ", body); - if (encode_body(body, os, content_type) == -1) { - loggers::get_instance().warning("http_codec::encode_request: Failed to encode HTTP body"); - _ec.length = 0; - _ec.is_content_length_present = 0x00; - } else { - _ec.length = os.lengthof(); - _ec.is_content_length_present = 0x01; - } - loggers::get_instance().log("http_codec::encode_request: length=%d", _ec.length); - } else { - loggers::get_instance().log("http_codec::encode_request: HTTP body field not present"); - _ec.length = 0; - _ec.is_content_length_present = 0x00; - } - - // Encode Content-Length header - p_encoding_buffer.put_cs("Content-Length: "); - if (_ec.length != 0) { - loggers::get_instance().log("http_codec::encode_request: Content-Length: %s", - static_cast(int2str(_ec.length + 2 /*Stand for the last CRLF*/))); - p_encoding_buffer.put_cs(static_cast(int2str(_ec.length))); - _ec.is_content_length_present = 0x01; - } else { - p_encoding_buffer.put_cs("0"); - _ec.is_content_length_present = 0x00; - } - loggers::get_instance().log("http_codec::encode_request: Content-Length: %d - %x", _ec.length, _ec.is_content_length_present); - p_encoding_buffer.put_cs("\r\n"); - - // Add message body - p_encoding_buffer.put_cs("\r\n"); - if (_ec.is_content_length_present == 0x01) { - loggers::get_instance().log_msg("http_codec::encode_request: Add body ", os); - p_encoding_buffer.put_os(os); - // p_encoding_buffer.put_cs("\r\n"); - } - - loggers::get_instance().log_to_hexa("<<< http_codec::encode_request: ", p_encoding_buffer); - return 0; -} - -int http_codec::encode_response(const LibItsHttp__TypesAndValues::Response &p_response, TTCN_Buffer &p_encoding_buffer) { - loggers::get_instance().log_msg(">>> http_codec::encode_response: ", (const Base_Type &)p_response); - - // Encode generic part - p_encoding_buffer.put_cs("HTTP/"); - p_encoding_buffer.put_cs(int2str(p_response.version__major())); - p_encoding_buffer.put_c('.'); - p_encoding_buffer.put_cs(int2str(p_response.version__minor())); - p_encoding_buffer.put_cs(" "); - p_encoding_buffer.put_cs(int2str(p_response.statuscode())); - p_encoding_buffer.put_cs(" "); - if (p_response.statustext().lengthof() != 0) { - p_encoding_buffer.put_cs(p_response.statustext()); - } - p_encoding_buffer.put_cs("\r\n"); - - // Encode headers excepeted the Content-Length - const LibItsHttp__TypesAndValues::Headers &headers = p_response.header(); - std::string content_type; - for (int i = 0; i < headers.size_of(); i++) { - const LibItsHttp__TypesAndValues::Header &header = headers[i]; - loggers::get_instance().log_msg("http_codec::encode_response: Processing header ", header.header__name()); - if (std::string(static_cast(header.header__name())).compare("Content-Length") == 0) { - continue; - } else { - p_encoding_buffer.put_cs(header.header__name()); - p_encoding_buffer.put_cs(": "); - const OPTIONAL &o = header.header__value(); - if (o.ispresent()) { - const LibItsHttp__TypesAndValues::charstring__list &v = dynamic_cast &>(o); - if (v.size_of() > 0) { - loggers::get_instance().log_msg("http_codec::encode_response: Processing value ", v[0]); - if (std::string(static_cast(header.header__name())).compare("Content-Type") == 0) { // Store it for HTTP body payload encoding - loggers::get_instance().log("http_codec::encode_response: Storing Content-Type"); - int j = 0; - while (j < v.size_of()) { - content_type += v[j++]; - } // End of 'while' statement - } - p_encoding_buffer.put_cs(v[0]); - int j = 1; - while (j < v.size_of()) { - p_encoding_buffer.put_cs(", "); - loggers::get_instance().log_msg("http_codec::encode_response: Processing value ", v[j]); - p_encoding_buffer.put_cs(v[j++]); - j += 1; - } // End of 'while' statement - } - } // else, do not include it - } - p_encoding_buffer.put_cs("\r\n"); - } // End of 'for' statement - - // Encode message body - const OPTIONAL &v = p_response.body(); - OCTETSTRING os; - if (v.ispresent()) { - const LibItsHttp__MessageBodyTypes::HttpMessageBody &body = static_cast(*v.get_opt_value()); - loggers::get_instance().log_msg("http_codec::encode_response: body: ", body); - if (encode_body(body, os, content_type) == -1) { - _ec.length = 0; - _ec.is_content_length_present = 0x00; - } else { - _ec.length = os.lengthof(); - _ec.is_content_length_present = 0x01; - } - loggers::get_instance().log("http_codec::encode_response: length=%d", _ec.length); - } else { - loggers::get_instance().log("http_codec::encode_response: HTTP body field not present"); - _ec.length = 0; - _ec.is_content_length_present = 0x00; - } - - // Encode Content-Length header - p_encoding_buffer.put_cs("Content-Length: "); - if (_ec.length != 0) { - loggers::get_instance().log("http_codec::encode_request: Content-Length: %s", - static_cast(int2str(_ec.length + 2 /*Stand for the last CRLF*/))); - p_encoding_buffer.put_cs(static_cast(int2str(_ec.length))); - _ec.is_content_length_present = 0x01; - } else { - p_encoding_buffer.put_cs("0"); - _ec.is_content_length_present = 0x00; - } - loggers::get_instance().log("http_codec::encode_request: Content-Length: %d - %x", _ec.length, _ec.is_content_length_present); - p_encoding_buffer.put_cs("\r\n"); - - // Add message body - p_encoding_buffer.put_cs("\r\n"); - if (_ec.is_content_length_present == 0x01) { - loggers::get_instance().log_msg("http_codec::encode_request: Add body ", os); - p_encoding_buffer.put_os(os); - // p_encoding_buffer.put_cs("\r\n"); - } - - loggers::get_instance().log_to_hexa("<<< http_codec::encode_response: ", p_encoding_buffer); - return 0; -} - -int http_codec::decode_headers(TTCN_Buffer &decoding_buffer, LibItsHttp__TypesAndValues::Headers &headers, std::string &p_content_type) { - loggers::get_instance().log(">>> http_codec::decode_headers"); - loggers::get_instance().log_to_hexa("http_codec::decode_headers: ", decoding_buffer); - - CHARSTRING cstr; - int i = 0; - while (true) { - switch (get_line(decoding_buffer, cstr, true)) { - case 0: { - loggers::get_instance().log_msg("http_codec::decode_headers: ", cstr); - LibItsHttp__TypesAndValues::Header header; - if (decode_header(cstr, header) == -1) { - loggers::get_instance().warning("http_codec::decode_headers: Failed to decode header %s", static_cast(cstr)); - return -1; - } - headers[i++] = header; - if (std::string(static_cast(header.header__name())).compare("Content-Type") == 0) { - if (header.header__value().is_present() != 0) { - const PreGenRecordOf::PREGEN__RECORD__OF__CHARSTRING &l = - static_cast(*header.header__value().get_opt_value()); - p_content_type = static_cast(l[0]); - } else { - p_content_type = ""; - } - } - } break; - case 1: - loggers::get_instance().log_msg("<<< http_codec::decode_headers: ", headers); - return 0; - case -1: - loggers::get_instance().warning("http_codec::decode_headers: Failed to decode headers"); - return -1; - } // End of 'switch' statement - } // End of 'while' statement -} - -int http_codec::decode_header(CHARSTRING &header_line, LibItsHttp__TypesAndValues::Header &header) { - loggers::get_instance().log_msg(">>> http_codec::decode_header", header_line); - - try { - std::string str(static_cast(header_line)); - std::regex rgx("([0-9a-zA-Z-]+)\\:\\s+(.+)(,(.+))*"); - std::sregex_iterator begin(str.cbegin(), str.cend(), rgx); - std::smatch m = *begin; - if (m.size() < 5) { - loggers::get_instance().warning("http_codec::decode_header: Failed to decode header %s", str.c_str()); - return -1; - } - loggers::get_instance().log("http_codec::decode_header: %d", m.size()); - header.header__name() = CHARSTRING(m[1].str().c_str()); - LibItsHttp__TypesAndValues::charstring__list v; - for (unsigned int j = 0; j < m.size(); j++) { - if (m[j + 2].str().length() == 0) { - break; - } - v[j] = CHARSTRING(m[j + 2].str().c_str()); - } // End of 'for' statement - header.header__value() = OPTIONAL(v); - - if (m[1].str().compare("Content-Length") == 0) { - // Save the the body length - loggers::get_instance().log("http_codec::decode_header: decoded Content-Length %s", m[2].str().c_str()); - _dc.length = std::stoi(m[2].str()); - } else if (m[1].str().compare("Transfer-Encoding") == 0) { - if (m[2].str().find("chunked") != std::string::npos) { - _dc.chunked = true; - loggers::get_instance().log("http_codec::decode_header: decoded Transfer-Encoding %x", _dc.chunked); - } - } - - return 0; - } catch (const std::logic_error &e) { - return -1; - } -} - -int http_codec::encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody &p_message_body, OCTETSTRING &p_encoding_buffer, - const std::string &p_content_type) { - loggers::get_instance().log_msg(">>> http_codec::encode_body: ", (const Base_Type &)p_message_body); - - // Sanity check - if (p_content_type.empty()) { - loggers::get_instance().warning("http_codec::encode_body: Failed to select a codec for HTTP body payload"); - return -1; - } - - if (p_message_body.ischosen(LibItsHttp__MessageBodyTypes::HttpMessageBody::ALT_binary__body)) { - const LibItsHttp__BinaryMessageBodyTypes::BinaryBody &binary_body = p_message_body.binary__body(); - if (binary_body.ischosen(LibItsHttp__BinaryMessageBodyTypes::BinaryBody::ALT_raw)) { - p_encoding_buffer = OCTETSTRING(binary_body.raw().lengthof(), (unsigned char *)static_cast(binary_body.raw())); - } else { - std::map>>::const_iterator it; - bool processed = false; - if (p_content_type.find("x-its") != std::string::npos) { - loggers::get_instance().log("http_codec::encode_body: Find x-its"); - it = _codecs.find("http_its"); // TODO Use params - if (it != _codecs.cend()) { - loggers::get_instance().log("http_codec::encode_body: Call '%s'", it->first.c_str()); - if (binary_body.ischosen(LibItsHttp__BinaryMessageBodyTypes::BinaryBody::ALT_ieee1609dot2__data)) { - _codecs["http_its"]->encode((Record_Type &)binary_body.ieee1609dot2__data(), p_encoding_buffer); // TODO Use params - processed = true; - } else if (binary_body.ischosen(LibItsHttp__BinaryMessageBodyTypes::BinaryBody::ALT_ieee1609dot2__certificate)) { - _codecs["http_its"]->encode((Record_Type &)binary_body.ieee1609dot2__certificate(), p_encoding_buffer); // TODO Use params - processed = true; - } else { - loggers::get_instance().warning("http_codec::encode_body: Unsupported variant"); - } - } - } // TODO Add new HTTP message codec here - if (!processed) { - loggers::get_instance().warning("http_codec::encode_body: Unsupported HTTP codec, use raw field as default"); - p_encoding_buffer = OCTETSTRING(0, nullptr); - } - } - } else if (p_message_body.ischosen(LibItsHttp__MessageBodyTypes::HttpMessageBody::ALT_html__body)) { - p_encoding_buffer = OCTETSTRING(p_message_body.html__body().lengthof(), (unsigned char *)static_cast(p_message_body.html__body())); - } else if (p_message_body.ischosen(LibItsHttp__MessageBodyTypes::HttpMessageBody::ALT_text__body)) { - p_encoding_buffer = OCTETSTRING(p_message_body.text__body().lengthof(), (unsigned char *)static_cast(p_message_body.text__body())); - } else if (p_message_body.ischosen(LibItsHttp__MessageBodyTypes::HttpMessageBody::ALT_xml__body)) { - const LibItsHttp__XmlMessageBodyTypes::XmlBody &xml_body = p_message_body.xml__body(); - if (xml_body.ischosen(LibItsHttp__XmlMessageBodyTypes::XmlBody::ALT_raw)) { - p_encoding_buffer = OCTETSTRING(xml_body.raw().lengthof(), (unsigned char *)static_cast(xml_body.raw())); - } else { - std::map>>::const_iterator it; - bool processed = false; - loggers::get_instance().log("http_codec::encode_body: Content-Type:'%s'", p_content_type.c_str()); - if (p_content_type.find("held") != std::string::npos) { - it = _codecs.find("held"); // TODO Use params - if (it != _codecs.cend()) { - loggers::get_instance().log("http_codec::encode_body: Call 'held_codec'"); - _codecs["held"]->encode((Record_Type &)xml_body, p_encoding_buffer); // TODO Use params - processed = true; - } - } else if (p_content_type.find("lost") != std::string::npos) { - it = _codecs.find("lost"); // TODO Use params - if (it != _codecs.cend()) { - loggers::get_instance().log("http_codec::encode_body: Call 'lost_codec'"); - _codecs["lost"]->encode((Record_Type &)xml_body, p_encoding_buffer); // TODO Use params - processed = true; - } - } // TODO Add new HTTP message codec here - if (!processed) { - loggers::get_instance().warning("http_codec::encode_body: Unsupported HTTP codec, use raw field as default"); - p_encoding_buffer = OCTETSTRING(0, nullptr); - } - } - } else { - loggers::get_instance().warning("http_codec::encode_body: Failed to encode HTTP message body"); - return -1; - } - loggers::get_instance().log_msg("http_codec::encode_body: HTTP message ", p_encoding_buffer); - _ec.length = p_encoding_buffer.lengthof(); - loggers::get_instance().log("http_codec::encode_body: HTTP message length: %d", _ec.length); - - return 0; -} - -int http_codec::decode_body(TTCN_Buffer &decoding_buffer, LibItsHttp__MessageBodyTypes::HttpMessageBody &message_body, const std::string &p_content_type) { - loggers::get_instance().log(">>> http_codec::decode_body"); - loggers::get_instance().log_to_hexa("http_codec::decode_body", decoding_buffer); - loggers::get_instance().log("http_codec::decode_body: # of codecs=%d - %p", _codecs.size(), this); - loggers::get_instance().log("http_codec::decode_body: Content-Type=%s", p_content_type.c_str()); - - // Sanity checks - if (decoding_buffer.get_len() - decoding_buffer.get_pos() <= 0) { - return -1; - } - /* TODO Uncommentif (p_content_type.empty()) { - loggers::get_instance().warning("http_codec::encode_body: Failed to select a codec for HTTP body payload"); - return -1; - }*/ - - OCTETSTRING s(decoding_buffer.get_len() - decoding_buffer.get_pos(), decoding_buffer.get_data() + decoding_buffer.get_pos()); - loggers::get_instance().log_msg("http_codec::decode_body: raw body=", s); - - // Align the payload length with the specified Content-Lenght value - loggers::get_instance().log("http_codec::decode_body: _dc.length=%d - body length=%d", _dc.length, s.lengthof()); - OCTETSTRING body; - if (_dc.length != 0) { - const unsigned char *p = static_cast(s); - if ((unsigned int)s.lengthof() <= _dc.length) { - body = OCTETSTRING(s.lengthof(), p); - } else { - body = OCTETSTRING(_dc.length, p); - } - } else { - loggers::get_instance().warning("http_codec::decode_body: No Conten-Length header, process all remaining bytes"); - body = s; - } - loggers::get_instance().log_msg("http_codec::decode_body: Aligned body=", body); - loggers::get_instance().log("http_codec::decode_body: body length=%d", body.lengthof()); - /* TODO To be removed - // Remove CRLF if any - int counter = 0; - if ((body[body.lengthof() - 1].get_octet() == 0x0d) || (body[body.lengthof() - 1].get_octet() == 0x0a)) { - counter += 1; - if ((body[body.lengthof() - 2].get_octet() == 0x0d) || (body[body.lengthof() - 2].get_octet() == 0x0a)) { - counter += 1; - } - } - loggers::get_instance().log("http_codec::decode_body: counter=%d", counter); - body = OCTETSTRING(body.lengthof() - counter, static_cast(body)); - */ - if (_dc.chunked) { - int counter = 0; - int prev = 0; - OCTETSTRING os(0, nullptr); - do { - while (counter < body.lengthof()) { // Extract the size of the chunk \r[\n] - if ((body[counter].get_octet() == '\r') || (body[counter].get_octet() == '\n')) { - break; - } - counter += 1; - } // End of 'while' statement - loggers::get_instance().log("http_codec::decode_body: Chunked(0): prev = %d, counter=%d / %d", prev, counter, body.lengthof()); - if (counter < body.lengthof()) { - int idx = counter - prev; - OCTETSTRING trunk(idx, static_cast(body)); - loggers::get_instance().log_msg("http_codec::decode_body: trunk: ", trunk); - std::string str((const char *)static_cast(trunk), idx); - loggers::get_instance().log("http_codec::decode_body: str: '%s'", str.c_str()); - int len = std::stoi(str, nullptr, 16); // converter::get_instance().string_to_int(str); - loggers::get_instance().log("http_codec::decode_body: Chunk len: %d", len); - while (counter < body.lengthof() && ((body[counter].get_octet() == '\r') || (body[counter].get_octet() == '\n'))) { // Skip additional \n - counter += 1; - } // End of 'while' statement - if (counter < body.lengthof()) { - loggers::get_instance().log("http_codec::decode_body: Chunked (1): prev = %d, counter=%d / %d", prev, counter, body.lengthof()); - os += OCTETSTRING(len, counter + static_cast(body)); - loggers::get_instance().log_msg("http_codec::decode_body: os=", os); - counter += len; - loggers::get_instance().log("http_codec::decode_body: Chunked: %02x %02x %02x", body[counter].get_octet(), body[counter + 1].get_octet(), - body[counter + 2].get_octet()); - loggers::get_instance().log("http_codec::decode_body: Chunked (2): prev = %d, counter=%d / %d", prev, counter, body.lengthof()); - while (counter < body.lengthof() && ((body[counter].get_octet() == '\r') || (body[counter].get_octet() == '\n'))) { // Skip additional \n - counter += 1; - } // End of 'while' statement - prev = counter; - loggers::get_instance().log("http_codec::decode_body: Chunked (3): prev = %d, counter=%d / %d", prev, counter, body.lengthof()); - } - } - } while (counter < body.lengthof()); // Process next chunk if any - body = os; - loggers::get_instance().log_msg("http_codec::decode_body: Finalised body=", body); - } - // Check if HTTP message body contains binary characters - for (int i = 0; i < body.lengthof(); i++) { - unsigned char c = body[i].get_octet(); - if (!std::isprint(c) && !std::isspace(c) && !std::ispunct(c)) { - loggers::get_instance().log("http_codec::decode_body: Byte #%d is not printable: 0x%02x", i, body[i].get_octet()); - _dc.is_binary = 0x01; - break; - } - } // End of 'for' statement - loggers::get_instance().log("http_codec::decode_body: Binary mode: %x", _dc.is_binary); - LibItsHttp__MessageBodyTypes::HttpMessageBody v; - if (_dc.is_binary == 0x01) { - LibItsHttp__BinaryMessageBodyTypes::BinaryBody binary_body; - std::map>>::const_iterator it; - bool processed = false; - // TODO To be refined adding a string identifier to check which codec to use. E.g. held_code.id() returns "xmlns=\"urn:ietf:params:xml:ns:geopriv:held\">" - if ((p_content_type.find("x-its") != std::string::npos) || (p_content_type.find("application/octet-stream") != std::string::npos)) { - loggers::get_instance().log("http_codec::decode_body: Find 'x-its'"); - it = _codecs.cbegin(); //_codecs.find("http_its"); - if (it != _codecs.cend()) { - /*** - FIXME: - This code generate a codedump, I don't undertsand the reason. - The same code works file for Ng112 HELD & LOST codec. Ununderstandable!!!! - ==> Use a patch - if (_codecs["http_its"].get() != nullptr) { - loggers::get_instance().log("http_codec::decode_body: Call 'http_etsi_ieee1609dot2_codec'"); - if (_codecs["http_its"]->decode(body, (Record_Type&)binary_body) == 0) { - processed = true; - } - }*/ - loggers::get_instance().log("http_codec::decode_body: Call '%s'", it->first.c_str()); - http_etsi_ieee1609dot2_codec *codec = new http_etsi_ieee1609dot2_codec(); - if (body[0].get_octet() != 0x80) { - if (codec->decode(body, binary_body.ieee1609dot2__data()) == 0) { - message_body.binary__body() = binary_body; - processed = true; - } - } else { - if (codec->decode(body, binary_body.ieee1609dot2__certificate()) == 0) { - message_body.binary__body() = binary_body; - processed = true; - } - } - delete codec; - } - } // TODO Add new HTTP message codec here - if (!processed) { - loggers::get_instance().warning("http_codec::decode_body: Unsupported HTTP codec, use raw field as default"); - binary_body.raw() = body; - message_body.binary__body() = binary_body; - } - } else { - // Convert into string - params p; - p["decode_str"] = std::string(static_cast(body), body.lengthof() + static_cast(body)); - loggers::get_instance().log("http_codec::decode_body: decode_str: %s", p["decode_str"].c_str()); - // Try to identify xml - if (p["decode_str"].find("" - if ((p["decode_str"].find("=\"urn:ietf:params:xml:ns:geopriv:held\"") != std::string::npos) || - (p["decode_str"].find("=\"urn:ietf:params:xml:ns:pidf\"") != std::string::npos)) { - loggers::get_instance().log("http_codec::decode_body: Find 'urn:ietf:params:xml:ns:geopriv:held'"); - if (_codecs["held"].get() != nullptr) { - loggers::get_instance().log("http_codec::decode_body: Call 'held_codec'"); - if (_codecs["held"]->decode(body, (Record_Type &)xml_body, &p) == -1) { - loggers::get_instance().warning("http_codec::decode_body: Failed to decode HELD message"); - xml_body.raw() = CHARSTRING(body.lengthof(), (char *)static_cast(body)); - } else { - loggers::get_instance().log_msg("http_codec::decode_body: Decoded message:", xml_body); - message_body.xml__body() = xml_body; - } - } else { - loggers::get_instance().warning("http_codec::decode_body: No codec for HELD"); - xml_body.raw() = CHARSTRING(body.lengthof(), (char *)static_cast(body)); - } - message_body.xml__body() = xml_body; - } else if (p["decode_str"].find("=\"urn:ietf:params:xml:ns:lost1\"") != std::string::npos) { - loggers::get_instance().log("http_codec::decode_body: Find 'urn:ietf:params:xml:ns:lost1'"); - if (_codecs["lost"].get() != nullptr) { - loggers::get_instance().log("http_codec::decode_body: Call 'lost_codec'"); - if (_codecs["lost"]->decode(body, (Record_Type &)xml_body, &p) == -1) { - loggers::get_instance().warning("http_codec::decode_body: Failed to decode LOST message"); - xml_body.raw() = CHARSTRING(body.lengthof(), (char *)static_cast(body)); - } else { - loggers::get_instance().log_msg("http_codec::decode_body: Decoded message:", xml_body); - message_body.xml__body() = xml_body; - } - } else { - loggers::get_instance().warning("http_codec::decode_body: No codec for LOST"); - xml_body.raw() = CHARSTRING(body.lengthof(), (char *)static_cast(body)); - } - message_body.xml__body() = xml_body; - } else { - loggers::get_instance().warning("http_codec::decode_body: No XML codec found"); - xml_body.raw() = CHARSTRING(body.lengthof(), (char *)static_cast(body)); - message_body.xml__body() = xml_body; - } - } else if (p["decode_str"].find("") != std::string::npos) { // Try to identify HTML - loggers::get_instance().log("http_codec::decode_body: Find html message"); - LibItsHttp__MessageBodyTypes::HtmlBody html_body; - message_body.html__body() = CHARSTRING(body.lengthof(), (char *)static_cast(body)); - } else { - loggers::get_instance().log("http_codec::decode_body: Use textBdy as default"); - LibItsHttp__MessageBodyTypes::TextBody text_body; - message_body.text__body() = CHARSTRING(body.lengthof(), (char *)static_cast(body)); - } - } - - return 0; -} - -int http_codec::get_line(TTCN_Buffer &buffer, CHARSTRING &to, const bool concatenate_header_lines) { - unsigned int i = 0; - const unsigned char *cc_to = buffer.get_read_data(); - - // Sanity checks - if (buffer.get_read_len() == 0) { - return -1; - } - - while (true) { - // Skip spaces, and empty lines - for (; i < buffer.get_read_len() && cc_to[i] != '\0' && cc_to[i] != '\r' && cc_to[i] != '\n'; i++) - ; - if (i >= buffer.get_read_len()) { // No more characters to process - to = CHARSTRING(""); - return -1; - } else if (cc_to[i] == '\n') { // New line found, we don't care is '\r' is missing - if ((i > 0) && ((i + 1) < buffer.get_read_len()) && concatenate_header_lines && ((cc_to[i + 1] == ' ') || (cc_to[i + 1] == '\t'))) { - i += 1; // Skip it - } else { - to = CHARSTRING(i, (const char *)cc_to); - buffer.set_pos(buffer.get_pos() + i + 1); - return i == 0 ? 1 : 0; - } - } else { - if ((i + 1) < buffer.get_read_len() && cc_to[i + 1] != '\n') { - return -1; - } else if (i > 0 && (i + 2) < buffer.get_read_len() && concatenate_header_lines && (cc_to[i + 2] == ' ' || cc_to[i + 2] == '\t')) { - i += 2; - } else { - to = CHARSTRING(i, (const char *)cc_to); - buffer.set_pos(buffer.get_pos() + i + 2); - return i == 0 ? 1 : 0; - } - } - } // End of 'while' statement -} - -void http_codec::set_payload_codecs(const std::string &p_codecs) { - loggers::get_instance().log(">>> http_codec::set_payload_codecs: %s", p_codecs.c_str()); - - // Sanity check - if (p_codecs.length() == 0) { - return; - } - - // Extract codecs - try { - std::regex rgx("(\\w+):(\\w+)(;(\\w+):(\\w+))*"); - std::sregex_iterator begin(p_codecs.cbegin(), p_codecs.cend(), rgx); - std::sregex_iterator end = std::sregex_iterator(); - // E.g. 9 - xml - :held_codec - held_codec - ;html:html_codec - html:html_codec - html - :html_codec - html_codec - for (std::sregex_iterator it = begin; it != end; ++it) { - std::smatch m = *it; - loggers::get_instance().log("http_codec::set_payload_codecs: %d - %s - %s - %s - %s - %s - %s - %s - %s", m.size(), m[1].str().c_str(), - m[2].str().c_str(), m[3].str().c_str(), m[4].str().c_str(), m[5].str().c_str(), m[6].str().c_str(), m[7].str().c_str(), - m[8].str().c_str()); - for (unsigned int j = 1; j < m.size() - 1; j += 3) { // Exclude m[0] - loggers::get_instance().log("http_codec::set_payload_codecs: insert (%s, %s), j = %d", m[j].str().c_str(), m[j + 1].str().c_str(), j); - if (m[j].str().empty()) { - break; - } - std::string key(m[j].str()); - loggers::get_instance().log("http_codec::set_payload_codecs: Add codec %s", key.c_str()); - _codecs.insert( - std::make_pair(key, std::unique_ptr>(codec_stack_builder::get_instance()->get_codec(m[j + 1].str().c_str())))); - } // End of 'for' statement - } // End of 'for' statement - loggers::get_instance().log("http_codec::set_payload_codecs: _codecs length=%d - %p", _codecs.size(), this); - } catch (const std::logic_error &e) { - loggers::get_instance().warning("http_codec::set_payload_codecs: std::logic_error: %s", e.what()); - _codecs.clear(); - } -} diff --git a/ccsrc/Protocols/Http/http_codec.hh b/ccsrc/Protocols/Http/http_codec.hh deleted file mode 100644 index 91c799e..0000000 --- a/ccsrc/Protocols/Http/http_codec.hh +++ /dev/null @@ -1,72 +0,0 @@ -#pragma once - -#include - -#include "codec.hh" -#include "params.hh" - -class Base_Type; -class Record_Type; -class TTCN_Typedescriptor_t; -class TTCN_Buffer; - -namespace LibItsHttp__TypesAndValues { - class HttpMessage; - class Request; - class Response; - class Headers; - class Header; -} // namespace LibItsHttp__TypesAndValues -namespace LibItsHttp__MessageBodyTypes { - class HttpMessageBody; -} - -struct encoding_context { - unsigned int length; - unsigned char is_content_length_present; - - encoding_context() { reset(); }; - void reset() { - length = -1; - is_content_length_present = 0x00; - }; -}; - -struct decoding_context { - unsigned int length; - unsigned char is_binary; - bool chunked; - - decoding_context() { reset(); }; - void reset() { - length = -1; - is_binary = 0x00; - chunked = false; - }; -}; - -class http_codec : public codec { - encoding_context _ec; - decoding_context _dc; - std::map>> _codecs; - -public: - explicit http_codec() : codec(), _ec(), _dc(), _codecs(){}; - virtual ~http_codec(){}; - - virtual int encode(const LibItsHttp__TypesAndValues::HttpMessage &, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, LibItsHttp__TypesAndValues::HttpMessage &, params *params = NULL); - - void set_payload_codecs(const std::string &p_codecs); - -private: - int encode_request(const LibItsHttp__TypesAndValues::Request &p_request, TTCN_Buffer &p_encoding_buffer); - int encode_response(const LibItsHttp__TypesAndValues::Response &p_response, TTCN_Buffer &p_encoding_buffer); - int encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody &p_message_body, OCTETSTRING &p_encoding_buffer, const std::string &p_content_type); - - int decode_headers(TTCN_Buffer &decoding_buffer, LibItsHttp__TypesAndValues::Headers &headers, std::string &p_content_type); - int decode_header(CHARSTRING &header_line, LibItsHttp__TypesAndValues::Header &header); - int decode_body(TTCN_Buffer &decoding_buffer, LibItsHttp__MessageBodyTypes::HttpMessageBody &message_body, const std::string &p_content_type); - int get_line(TTCN_Buffer &buffer, CHARSTRING &to, const bool concatenate_header_lines = false); - -}; // End of class http_codec diff --git a/ccsrc/Protocols/Http/http_layer.cc b/ccsrc/Protocols/Http/http_layer.cc deleted file mode 100644 index 227e5c0..0000000 --- a/ccsrc/Protocols/Http/http_layer.cc +++ /dev/null @@ -1,128 +0,0 @@ -#include "LibItsHttp_TypesAndValues.hh" - -#include "codec_stack_builder.hh" -#include "http_layer_factory.hh" - -#include "loggers.hh" - -#include "converter.hh" - -using namespace std; // Required for isnan() -#include "LibItsHttp_TestSystem.hh" -#include "LibItsHttp_TypesAndValues.hh" - -http_layer::http_layer(const std::string &p_type, const std::string ¶m) - : t_layer(p_type), _params(), _device_mode{false} { - loggers::get_instance().log(">>> http_layer::http_layer: %s, %s", to_string().c_str(), param.c_str()); - // Setup parameters - params::convert(_params, param); - - params::const_iterator it = _params.find(params::codecs); - if (it != _params.cend()) { - _codec.set_payload_codecs(it->second); - } - it = _params.find(params::device_mode); - if (it != _params.cend()) { - _device_mode = (1 == converter::get_instance().string_to_int(it->second)); - } - it = _params.find(params::method); - if (it == _params.cend()) { - _params[params::method] = "POST"; - } - it = _params.find(params::uri); - if (it == _params.cend()) { - _params[params::uri] = "/"; - } - it = _params.find(params::host); - if (it == _params.cend()) { - _params[params::host] = "127.0.0.1"; - } - it = _params.find(params::content_type); - if (it == _params.cend()) { - _params[params::content_type] = "application/text"; - } -} - -void http_layer::sendMsg(const LibItsHttp__TypesAndValues::HttpMessage &p_http_message, params &p_param) { - loggers::get_instance().log_msg(">>> http_layer::sendMsg: ", p_http_message); - - // Encode HttpMessage - OCTETSTRING data; - _codec.encode(p_http_message, data); - send_data(data, _params); -} - -void http_layer::send_data(OCTETSTRING &data, params ¶ms) { - loggers::get_instance().log_msg(">>> http_layer::send_data: ", data); - - if (_device_mode) { // Need to build an HTTP packet - loggers::get_instance().log("http_layer::send_data: Build http layer"); - TTCN_Buffer buffer; - buffer.put_cs(_params[params::method].c_str()); - buffer.put_c(' '); - buffer.put_cs(_params[params::uri].c_str()); - buffer.put_cs(" HTTP/1.1\r\n"); - buffer.put_cs("Host: "); - buffer.put_cs(_params[params::host].c_str()); - buffer.put_cs("\r\n"); - buffer.put_cs("Content-type: "); - buffer.put_cs(_params[params::content_type].c_str()); - buffer.put_cs("\r\n"); - buffer.put_cs("Content-length: "); - buffer.put_cs(static_cast(int2str(data.lengthof() + 2 /*Stand for the last CRLF*/))); - buffer.put_cs("\r\n\r\n"); - buffer.put_os(data); - buffer.put_cs("\r\n"); - data = OCTETSTRING(buffer.get_len(), buffer.get_data()); - } - - loggers::get_instance().log_msg("http_layer::send_data: ", data); - send_to_all_layers(data, params); -} - -void http_layer::receive_data(OCTETSTRING &data, params ¶ms) { - loggers::get_instance().log_msg(">>> http_layer::receive_data: ", data); - - // Decode HTTP message - LibItsHttp__TypesAndValues::HttpMessage http_message; - if (_codec.decode(data, http_message) == -1) { - loggers::get_instance().warning("http_layer::receive_data: Failed to decode data"); - return; - } - if (_device_mode) { - OCTETSTRING os; - if (http_message.ischosen(LibItsHttp__TypesAndValues::HttpMessage::ALT_response)) { - if (http_message.response().body().ispresent()) { - LibItsHttp__MessageBodyTypes::HttpMessageBody &body = - static_cast(*http_message.response().body().get_opt_value()); - if (body.ischosen(LibItsHttp__MessageBodyTypes::HttpMessageBody::ALT_binary__body)) { - LibItsHttp__BinaryMessageBodyTypes::BinaryBody &binary = body.binary__body(); - if (binary.ischosen(LibItsHttp__BinaryMessageBodyTypes::BinaryBody::ALT_raw)) { - os = binary.raw(); - } else { - loggers::get_instance().warning("http_layer::receive_data: A raw binary payload is expected"); - } - } else if (body.ischosen(LibItsHttp__MessageBodyTypes::HttpMessageBody::ALT_html__body)) { - // TODO To be done - loggers::get_instance().warning("http_layer::receive_data: Not implemented yet"); - } else if (body.ischosen(LibItsHttp__MessageBodyTypes::HttpMessageBody::ALT_xml__body)) { - // TODO To be done - loggers::get_instance().warning("http_layer::receive_data: Not implemented yet"); - } else if (body.ischosen(LibItsHttp__MessageBodyTypes::HttpMessageBody::ALT_text__body)) { - // TODO To be done - loggers::get_instance().warning("http_layer::receive_data: Not implemented yet"); - } - receive_to_all_layers(os, params); - } else { - loggers::get_instance().warning("http_layer::receive_data: No body present"); - } - } else { - loggers::get_instance().warning("http_layer::receive_data: An HTTP response is expected"); - } - } else { - // Pass it to the ports - to_all_upper_ports(http_message, params); - } -} - -http_layer_factory http_layer_factory::_f; diff --git a/ccsrc/Protocols/Http/http_layer.hh b/ccsrc/Protocols/Http/http_layer.hh deleted file mode 100644 index 5a94e82..0000000 --- a/ccsrc/Protocols/Http/http_layer.hh +++ /dev/null @@ -1,83 +0,0 @@ -/*! - * \file http_layer.hh - * \brief Header file for ITS HTTP protocol layer. - * \author ETSI STF549 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include - -#include "t_layer.hh" - -#include "http_codec.hh" - -namespace LibItsHttp__TestSystem { - class HttpPort; -} - -namespace LibItsHttp__TypesAndValues { - class HttpMessage; //! Forward declaration of TITAN class -} - -class OCTETSTRING; //! Forward declaration of TITAN class - -/*! - * \class http_layer - * \brief This class provides a factory class to create an tcp_layer class instance - */ -class http_layer : public t_layer { - params _params; - http_codec _codec; - bool _device_mode; - -public: //! \publicsection - /*! - * \brief Specialised constructor - * Create a new instance of the http_layer class - * \param[in] p_type \todo - * \param[in] p_param \todo - */ - http_layer() : t_layer(), _params(), _device_mode{false} { }; - /*! - * \brief Specialised constructor - * Create a new instance of the http_layer class - * \param[in] p_type \todo - * \param[in] p_param \todo - */ - http_layer(const std::string& p_type, const std::string& p_param); - /*! - * \brief Default destructor - */ - virtual ~http_layer() { }; - - /*! - * \fn void sendMsg(const LibItsHttp__TypesAndValues::HttpMessage& p_http_message, params& p_param); - * \brief Send HTTP message to the lower layers - * \param[in] p_http_message The GeoNetworking message to be sent - * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters - */ - void sendMsg(const LibItsHttp__TypesAndValues::HttpMessage& p_http_message, params& p_param); - - /*! - * \virtual - * \fn void send_data(OCTETSTRING& data, params& params); - * \brief Send bytes formated data to the lower layers - * \param[in] p_data The data to be sent - * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters - */ - virtual void send_data(OCTETSTRING& data, params& params); - /*! - * \virtual - * \fn void receive_data(OCTETSTRING& data, params& params); - * \brief Receive bytes formated data from the lower layers - * \param[in] p_data The bytes formated data received - * \param[in] p_params Some lower layers parameters values when data was received - */ - virtual void receive_data(OCTETSTRING& data, params& info); -}; // End of class http_layer - diff --git a/ccsrc/Protocols/Http/http_layer_factory.hh b/ccsrc/Protocols/Http/http_layer_factory.hh deleted file mode 100644 index 5e4e71a..0000000 --- a/ccsrc/Protocols/Http/http_layer_factory.hh +++ /dev/null @@ -1,42 +0,0 @@ -/*! - * \file http_layer_factory.hh - * \brief Header file for ITS Http protocol layer factory. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include "layer_stack_builder.hh" - -#include "http_layer.hh" - -/*! - * \class http_layer_factory - * \brief This class provides a factory class to create an http_layer class instance - */ -class http_layer_factory : public layer_factory { - static http_layer_factory _f; //! Reference to the unique instance of this class -public: //! \publicsection - /*! - * \brief Default constructor - * Create a new instance of the http_layer_factory class - * \remark The HTTP layer identifier is HTTP - */ - http_layer_factory() { - // Register factory - layer_stack_builder::register_layer_factory("HTTP", this); - }; - /*! - * \fn layer* create_layer(const std::string & type, const std::string & param); - * \brief Create the layers stack based on the provided layers stack description - * \param[in] p_type The provided layers stack description - * \param[in] p_params Optional parameters - * \return 0 on success, -1 otherwise - * \inline - */ - inline virtual layer *create_layer(const std::string &p_type, const std::string &p_param) { return new http_layer(p_type, p_param); }; -}; // End of class http_layer_factory diff --git a/ccsrc/Protocols/Http/module.mk b/ccsrc/Protocols/Http/module.mk deleted file mode 100644 index 2c92703..0000000 --- a/ccsrc/Protocols/Http/module.mk +++ /dev/null @@ -1,3 +0,0 @@ -sources := http_codec.cc http_layer.cc -includes := . - diff --git a/ccsrc/Protocols/IVIM/ivim_codec.cc b/ccsrc/Protocols/IVIM/ivim_codec.cc index 5fcca96..711a36a 100644 --- a/ccsrc/Protocols/IVIM/ivim_codec.cc +++ b/ccsrc/Protocols/IVIM/ivim_codec.cc @@ -15,7 +15,7 @@ int ivim_codec::encode(const IVIM__PDU__Descriptions::IVIM &ivim, OCTETSTRING &d return rc; } -int ivim_codec::decode(const OCTETSTRING &data, IVIM__PDU__Descriptions::IVIM &ivim, params *params) { +int ivim_codec::decode(const OCTETSTRING &data, IVIM__PDU__Descriptions::IVIM &ivim, params_its *params) { loggers::get_instance().log_msg(">>> ivim_codec::decode: ", data); int rc = asn_codec.decode(oct2bit(data), ivim); diff --git a/ccsrc/Protocols/IVIM/ivim_codec.hh b/ccsrc/Protocols/IVIM/ivim_codec.hh index 3181981..5a94e2a 100644 --- a/ccsrc/Protocols/IVIM/ivim_codec.hh +++ b/ccsrc/Protocols/IVIM/ivim_codec.hh @@ -2,7 +2,7 @@ #include "codec.hh" #include "ivim_pdu_codec.hh" -#include "params.hh" +#include "params_its.hh" #include "LibItsIvim_TypesAndValues.hh" // class BITSTRING; @@ -17,5 +17,5 @@ public: virtual ~ivim_codec(){}; virtual int encode(const IVIM__PDU__Descriptions::IVIM &ivim, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, IVIM__PDU__Descriptions::IVIM &, params *params = NULL); + virtual int decode(const OCTETSTRING &data, IVIM__PDU__Descriptions::IVIM &, params_its *params = NULL); }; // End of class ivim_codec diff --git a/ccsrc/Protocols/IVIM_layers/ivim_layer.cc b/ccsrc/Protocols/IVIM_layers/ivim_layer.cc index 7470291..f186773 100644 --- a/ccsrc/Protocols/IVIM_layers/ivim_layer.cc +++ b/ccsrc/Protocols/IVIM_layers/ivim_layer.cc @@ -12,7 +12,7 @@ ivim_layer::ivim_layer(const std::string &p_type, const std::string ¶m) : t_layer(p_type), _params(), _codec() { loggers::get_instance().log(">>> ivim_layer::ivim_layer: %s, %s", to_string().c_str(), param.c_str()); // Setup parameters - params::convert(_params, param); + params_its::convert(_params, param); _params.insert(std::make_pair("its_aid", "139")); // ETSI TS 102 965 V1.2.1 (2015-06) _params.insert(std::make_pair("payload_type", "6")); // IVI message id - See ETSI TS 103 301 @@ -21,7 +21,7 @@ ivim_layer::ivim_layer(const std::string &p_type, const std::string ¶m) : t_ registration::get_instance().add_item(p_type, this); } -void ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::IvimReq &p, params ¶ms) { +void ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::IvimReq &p, params_its ¶ms) { loggers::get_instance().log_msg(">>> ivim_layer::sendMsg: ", p); // Encode IVIM PDU @@ -33,7 +33,7 @@ void ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::IvimReq &p, params &p send_data(data, _params); } -void ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::IvimInd &p, params ¶ms) { +void ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::IvimInd &p, params_its ¶ms) { loggers::get_instance().log_msg(">>> ivim_layer::sendMsg: ", p); // Encode IVIM PDU @@ -45,13 +45,13 @@ void ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::IvimInd &p, params &p send_data(data, _params); } -void ivim_layer::send_data(OCTETSTRING &data, params ¶ms) { +void ivim_layer::send_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> ivim_layer::send_data: ", data); // params.log(); send_to_all_layers(data, params); } -void ivim_layer::receive_data(OCTETSTRING &data, params ¶ms) { +void ivim_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> ivim_layer::receive_data: ", data); params.log(); @@ -72,63 +72,63 @@ void ivim_layer::receive_data(OCTETSTRING &data, params ¶ms) { // Process lower layer data // recvTime - params::const_iterator it = params.find(params::timestamp); + params_its::const_iterator it = params.find(params_its::timestamp); if (it != params.cend()) { p.recvTime().set_long_long_val(std::stoll(it->second)); } else { p.recvTime().set_to_omit(); } // gnNextHeader - it = params.find(params::gn_next_header); + it = params.find(params_its::gn_next_header); if (it != params.cend()) { p.gnNextHeader() = std::stoi(it->second); } else { p.gnNextHeader().set_to_omit(); } // gnHeaderType - it = params.find(params::gn_header_type); + it = params.find(params_its::gn_header_type); if (it != params.cend()) { p.gnHeaderType() = std::stoi(it->second); } else { p.gnHeaderType().set_to_omit(); } // gnHeaderSubtype - it = params.find(params::gn_header_sub_type); + it = params.find(params_its::gn_header_sub_type); if (it != params.cend()) { p.gnHeaderSubtype() = std::stoi(it->second); } else { p.gnHeaderSubtype().set_to_omit(); } // gnLifetime - it = params.find(params::gn_lifetime); + it = params.find(params_its::gn_lifetime); if (it != params.cend()) { p.gnLifetime() = std::stoi(it->second); } else { p.gnLifetime().set_to_omit(); } // gnTrafficClass - it = params.find(params::gn_traffic_class); + it = params.find(params_its::gn_traffic_class); if (it != params.cend()) { p.gnTrafficClass() = std::stoi(it->second); } else { p.gnTrafficClass().set_to_omit(); } // btpDestinationPort - it = params.find(params::btp_destination_port); + it = params.find(params_its::btp_destination_port); if (it != params.cend()) { p.btpDestinationPort() = std::stoi(it->second); } else { p.btpDestinationPort().set_to_omit(); } // btpInfo - it = params.find(params::btp_info); + it = params.find(params_its::btp_info); if (it != params.cend()) { p.btpInfo() = std::stoi(it->second); } else { p.btpInfo().set_to_omit(); } // ssp - it = params.find(params::ssp); + it = params.find(params_its::ssp); if (it != params.cend()) { loggers::get_instance().log("ivim_layer::receive_data: ssp=%s", it->second.c_str()); p.ssp() = oct2bit(str2oct(CHARSTRING(it->second.c_str()))); @@ -136,7 +136,7 @@ void ivim_layer::receive_data(OCTETSTRING &data, params ¶ms) { p.ssp().set_to_omit(); } // its_aid - it = params.find(params::its_aid); + it = params.find(params_its::its_aid); if (it != params.cend()) { p.its__aid() = std::stoi(it->second); } else { diff --git a/ccsrc/Protocols/IVIM_layers/ivim_layer.hh b/ccsrc/Protocols/IVIM_layers/ivim_layer.hh index b6aac14..b5c8ed4 100644 --- a/ccsrc/Protocols/IVIM_layers/ivim_layer.hh +++ b/ccsrc/Protocols/IVIM_layers/ivim_layer.hh @@ -20,7 +20,7 @@ namespace LibItsIvim__TestSystem { } // namespace LibItsIvim__TestSystem class ivim_layer : public t_layer { - params _params; + params_its _params; ivim_codec _codec; public: @@ -28,11 +28,11 @@ public: ivim_layer(const std::string &p_type, const std::string ¶m); virtual ~ivim_layer(){}; - void sendMsg(const LibItsIvim__TypesAndValues::IvimReq &, params ¶ms); - void sendMsg(const LibItsIvim__TypesAndValues::IvimInd &, params ¶ms); + void sendMsg(const LibItsIvim__TypesAndValues::IvimReq &, params_its ¶ms); + void sendMsg(const LibItsIvim__TypesAndValues::IvimInd &, params_its ¶ms); - virtual void send_data(OCTETSTRING &data, params ¶ms); - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void send_data(OCTETSTRING &data, params_its ¶ms); + virtual void receive_data(OCTETSTRING &data, params_its &info); int enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security); diff --git a/ccsrc/Protocols/LTE/lte_layer.cc b/ccsrc/Protocols/LTE/lte_layer.cc index 4bcb362..5492967 100644 --- a/ccsrc/Protocols/LTE/lte_layer.cc +++ b/ccsrc/Protocols/LTE/lte_layer.cc @@ -15,13 +15,13 @@ lte_layer::lte_layer(const std::string &p_type, const std::string ¶ms) params::convert(_params, params); // Uu interface - params::const_iterator it = _params.find(params::uu_transport); + params_its::const_iterator it = _params.find(params_its::uu_transport); if (it != _params.cend()) { if (it->second.compare("tcp") == 0) { _uu_transport.assign("tcp"); } } - it = _params.find(params::uu_protocol); + it = _params.find(params_its::uu_protocol); if (it == _params.cend()) { // No protocol specify, use raw V2X message setup_raw_v2x(); @@ -39,7 +39,7 @@ lte_layer::lte_layer(const std::string &p_type, const std::string ¶ms) _uu_layer->incoming_packet_observer_attach(this); // PC#5 interface - it = _params.find(params::pc5_layer); + it = _params.find(params_its::pc5_layer); if (it == _params.cend()) { _pc5_layer_id.assign("QUALCOMM"); } else { @@ -80,7 +80,7 @@ void lte_layer::close() { } } -void lte_layer::send_data(OCTETSTRING &data, params ¶ms) { +void lte_layer::send_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> lte_layer::send_data: ", data); params::const_iterator it = params.find(std::string("its_aid")); @@ -101,7 +101,7 @@ void lte_layer::send_data(OCTETSTRING &data, params ¶ms) { } } -void lte_layer::receive_data(OCTETSTRING &data, params ¶ms) { +void lte_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> lte_layer::receive_data: ", data); receive_to_all_layers(data, params); @@ -112,7 +112,7 @@ void lte_layer::Handle_Fd_Event_Readable(int fd) { } -void lte_layer::update(OCTETSTRING &p_data, params &p_params) { +void lte_layer::update(OCTETSTRING &p_data, params_its &p_params) { loggers::get_instance().log_msg(">>> lte_layer::update: ", p_data); p_params.log(); diff --git a/ccsrc/Protocols/LTE/lte_layer.hh b/ccsrc/Protocols/LTE/lte_layer.hh index 920cac6..4713bb2 100644 --- a/ccsrc/Protocols/LTE/lte_layer.hh +++ b/ccsrc/Protocols/LTE/lte_layer.hh @@ -20,7 +20,7 @@ * \brief This class provides description of ITS UDP/IP protocol layer */ class lte_layer : public layer, public data_event_notifier { - params _params; //! Layer parameters + params_its _params; //! Layer parameters std::string _uu_transport; std::string _uu_protocol; std::string _pc5_layer_id; @@ -49,7 +49,7 @@ class lte_layer : public layer, public data_event_notifier { * \param[in] p_data The data to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - virtual void send_data(OCTETSTRING &data, params ¶ms); + virtual void send_data(OCTETSTRING &data, params_its ¶ms); /*! * \virtual * \fn void receive_data(OCTETSTRING& data, params& params); @@ -57,9 +57,9 @@ class lte_layer : public layer, public data_event_notifier { * \param[in] p_data The bytes formated data received * \param[in] p_params Some lower layers parameters values when data was received */ - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void receive_data(OCTETSTRING &data, params_its &info); - virtual void update(OCTETSTRING &p_data, params &p_params); + virtual void update(OCTETSTRING &p_data, params_its &p_params); void Handle_Fd_Event_Readable(int fd); diff --git a/ccsrc/Protocols/LTE/lte_tcp_layer.cc b/ccsrc/Protocols/LTE/lte_tcp_layer.cc index 2d62525..6a1a43c 100644 --- a/ccsrc/Protocols/LTE/lte_tcp_layer.cc +++ b/ccsrc/Protocols/LTE/lte_tcp_layer.cc @@ -7,19 +7,22 @@ lte_tcp_layer::lte_tcp_layer(const std::string &p_type, const std::string &p_par } -lte_tcp_layer::lte_tcp_layer(const std::string &p_type, const params &p_param): tcp_layer(p_type, p_param), data_event_observer() { +lte_tcp_layer::lte_tcp_layer(const std::string &p_type, const params_its &p_param): tcp_layer(p_type, p_param), data_event_observer() { loggers::get_instance().log(">>> lte_tcp_layer::lte_tcp_layer (2)"); } -void lte_tcp_layer::receive_data(OCTETSTRING &data, params ¶ms) { - loggers::get_instance().log_msg(">>> lte_tcp_layer::receive_data: ", data); +void lte_tcp_layer::receive_data(OCTETSTRING& p_data, params& p_params) { + loggers::get_instance().log_msg(">>> lte_tcp_layer::receive_data: ", p_data); + + const params_its& params = static_cast(p_params); + loggers::get_instance().log(">>> lte_tcp_layer::receive_msg: %s", params.uu_protocol.c_str()); if (_observers.size() != 0) { - incoming_packet_notify(data, params); + incoming_packet_notify(p_data, (params_its&)params); } else { // Pass the packet to the upper layers - receive_to_all_layers(data, params); + receive_to_all_layers(p_data, (params_its&)params); } } diff --git a/ccsrc/Protocols/LTE/lte_tcp_layer.hh b/ccsrc/Protocols/LTE/lte_tcp_layer.hh index 3ba673d..df2f3f2 100644 --- a/ccsrc/Protocols/LTE/lte_tcp_layer.hh +++ b/ccsrc/Protocols/LTE/lte_tcp_layer.hh @@ -35,14 +35,14 @@ public: //! \publicsection * \param[in] p_type \todo * \param[in] p_param \todo */ - lte_tcp_layer(const std::string &p_type, const params &p_param); + lte_tcp_layer(const std::string &p_type, const params_its &p_param); /*! * \brief Default destructor * \remark If \see _reconnect_on_send is set to false, the disconnection is done by the destructor */ virtual ~lte_tcp_layer() {}; - void receive_data(OCTETSTRING &data, params ¶ms); + void receive_data(OCTETSTRING& p_data, params& p_params); inline void incoming_packet_observer_attach(data_event_notifier* p_observer) { _observers.push_back(p_observer); @@ -52,7 +52,7 @@ public: //! \publicsection _observers.erase(std::remove(_observers.begin(), _observers.end(), p_observer), _observers.end()); }; - inline void incoming_packet_notify(OCTETSTRING &p_data, params &p_params) { + inline void incoming_packet_notify(OCTETSTRING &p_data, params_its &p_params) { for (auto o : _observers) { o->update(p_data, p_params); } diff --git a/ccsrc/Protocols/LTE/lte_udp_layer.cc b/ccsrc/Protocols/LTE/lte_udp_layer.cc index be53598..6e73180 100644 --- a/ccsrc/Protocols/LTE/lte_udp_layer.cc +++ b/ccsrc/Protocols/LTE/lte_udp_layer.cc @@ -7,12 +7,12 @@ lte_udp_layer::lte_udp_layer(const std::string &p_type, const std::string &p_par } -lte_udp_layer::lte_udp_layer(const std::string &p_type, const params &p_param): udp_layer(p_type, p_param), data_event_observer() { +lte_udp_layer::lte_udp_layer(const std::string &p_type, const params_its &p_param): udp_layer(p_type, p_param), data_event_observer() { loggers::get_instance().log(">>> lte_udp_layer::lte_udp_layer (2)"); } -void lte_udp_layer::receive_data(OCTETSTRING &data, params ¶ms) { +void lte_udp_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> lte_udp_layer::receive_data: ", data); if (_observers.size() != 0) { diff --git a/ccsrc/Protocols/LTE/lte_udp_layer.hh b/ccsrc/Protocols/LTE/lte_udp_layer.hh index 50ed918..e172464 100644 --- a/ccsrc/Protocols/LTE/lte_udp_layer.hh +++ b/ccsrc/Protocols/LTE/lte_udp_layer.hh @@ -35,13 +35,13 @@ public: //! \publicsection * \param[in] p_type \todo * \param[in] p_param \todo */ - lte_udp_layer(const std::string &p_type, const params &p_param); + lte_udp_layer(const std::string &p_type, const params_its &p_param); /*! * \brief Default destructor */ virtual ~lte_udp_layer() {}; - void receive_data(OCTETSTRING &data, params ¶ms); + void receive_data(OCTETSTRING &data, params_its ¶ms); inline void incoming_packet_observer_attach(data_event_notifier* p_observer) { _observers.push_back(p_observer); @@ -51,7 +51,7 @@ public: //! \publicsection _observers.erase(std::remove(_observers.begin(), _observers.end(), p_observer), _observers.end()); }; - inline void incoming_packet_notify(OCTETSTRING &p_data, params &p_params) { + inline void incoming_packet_notify(OCTETSTRING &p_data, params_its &p_params) { for (auto o : _observers) { o->update(p_data, p_params); } diff --git a/ccsrc/Protocols/LTE/uu_amqp.cc b/ccsrc/Protocols/LTE/uu_amqp.cc index da25d39..50b8fd9 100644 --- a/ccsrc/Protocols/LTE/uu_amqp.cc +++ b/ccsrc/Protocols/LTE/uu_amqp.cc @@ -26,11 +26,11 @@ void uu_amqp::close() { } } -int uu_amqp::setup(const params ¶ms) { +int uu_amqp::setup(const params_its ¶ms) { loggers::get_instance().log(">>> uu_amqp::setup"); // Transport layer to the broker - params::const_iterator it = params.find(params::uu_transport); + params_its::const_iterator it = params.find(params_its::uu_transport); if (it != params.cend()) { if (it->second.compare("tcp") == 0) { loggers::get_instance().log("uu_amqp::setup: Create TCP layer"); @@ -60,17 +60,17 @@ int uu_amqp::shutdown() { return 0; } -void uu_amqp::send_data(OCTETSTRING &data, params ¶ms) { +void uu_amqp::send_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log(">>> uu_amqp::send_data"); _layer->send_data(data, params); } -void uu_amqp::receive_data(OCTETSTRING &p_data, params &p_params) { +void uu_amqp::receive_data(OCTETSTRING &p_data, params_its &p_params) { loggers::get_instance().log(">>> uu_amqp::receive_data"); } -void uu_amqp::update(OCTETSTRING &p_data, params &p_params) { +void uu_amqp::update(OCTETSTRING &p_data, params_its &p_params) { loggers::get_instance().log_msg(">>> uu_amqp::update: ", p_data); receive_data(p_data, p_params); diff --git a/ccsrc/Protocols/LTE/uu_amqp.hh b/ccsrc/Protocols/LTE/uu_amqp.hh index 95c4d11..3f98138 100644 --- a/ccsrc/Protocols/LTE/uu_amqp.hh +++ b/ccsrc/Protocols/LTE/uu_amqp.hh @@ -12,13 +12,13 @@ public: uu_amqp(); ~uu_amqp(); - int setup(const params ¶ms); + int setup(const params_its ¶ms); int shutdown(); - void send_data(OCTETSTRING &data, params ¶ms); - void receive_data(OCTETSTRING &p_data, params &p_params); + void send_data(OCTETSTRING &data, params_its ¶ms); + void receive_data(OCTETSTRING &p_data, params_its &p_params); - void update(OCTETSTRING &p_data, params &p_params); + void update(OCTETSTRING &p_data, params_its &p_params); inline void incoming_packet_observer_attach(data_event_notifier* p_observer) { _observers.push_back(p_observer); @@ -28,7 +28,7 @@ public: _observers.erase(std::remove(_observers.begin(), _observers.end(), p_observer), _observers.end()); }; - inline void incoming_packet_notify(OCTETSTRING &p_data, params &p_params) { + inline void incoming_packet_notify(OCTETSTRING &p_data, params_its &p_params) { for (auto o : _observers) { o->update(p_data, p_params); } diff --git a/ccsrc/Protocols/LTE/uu_interface.hh b/ccsrc/Protocols/LTE/uu_interface.hh index 26bf133..c0a8f12 100644 --- a/ccsrc/Protocols/LTE/uu_interface.hh +++ b/ccsrc/Protocols/LTE/uu_interface.hh @@ -1,6 +1,6 @@ #pragma once -#include "params.hh" +#include "params_its.hh" #include "layer.hh" #include "data_event_observer.hh" @@ -11,7 +11,7 @@ protected: public: uu_interface(): _layer{0} { }; - virtual int setup(const params ¶ms) = 0; + virtual int setup(const params_its ¶ms) = 0; virtual int shutdown() = 0; inline void incoming_packet_observer_attach(data_event_notifier* p_observer) { @@ -22,7 +22,7 @@ public: _observers.erase(std::remove(_observers.begin(), _observers.end(), p_observer), _observers.end()); }; - inline void incoming_packet_notify(OCTETSTRING &p_data, params &p_params) { + inline void incoming_packet_notify(OCTETSTRING &p_data, params_its &p_params) { for (auto o : _observers) { o->update(p_data, p_params); } diff --git a/ccsrc/Protocols/LTE/uu_mqtt.cc b/ccsrc/Protocols/LTE/uu_mqtt.cc index 6ab51c9..329f670 100644 --- a/ccsrc/Protocols/LTE/uu_mqtt.cc +++ b/ccsrc/Protocols/LTE/uu_mqtt.cc @@ -31,21 +31,21 @@ void uu_mqtt::close() { } } -int uu_mqtt::setup(const params ¶ms) { +int uu_mqtt::setup(const params_its ¶ms) { loggers::get_instance().log(">>> uu_mqtt::setup"); // Extract protocol name - params::const_iterator it = params.find(params::mqtt_protocol); + params::const_iterator it = params.find(params_its::mqtt_protocol); if (it != params.cend()) { _protocol_name.assign(it->second); } // Extract client identity - it = params.find(params::mqtt_client_id); + it = params.find(params_its::mqtt_client_id); if (it != params.cend()) { _client_id.assign(it->second); } // Extract topics - it = params.find(params::mqtt_topics); + it = params.find(params_its::mqtt_topics); if (it != params.cend()) { if (it->second.compare("obu") == 0) { // Subscribe to /3gpp/v2x/obu published messages // OBUs publishes to RSUs topics @@ -93,7 +93,7 @@ int uu_mqtt::setup(const params ¶ms) { // TODO: Protocol name and client_id // Transport layer to the broker - it = params.find(params::uu_transport); + it = params.find(params_its::uu_transport); if (it != params.cend()) { if (it->second.compare("tcp") == 0) { loggers::get_instance().log("uu_mqtt::setup: Create TCP layer"); @@ -131,13 +131,13 @@ int uu_mqtt::shutdown() { return 0; } -void uu_mqtt::send_data(OCTETSTRING &data, params ¶ms) { +void uu_mqtt::send_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log(">>> uu_mqtt::send_data"); send_publish_command(data, params); } -void uu_mqtt::receive_data(OCTETSTRING &p_data, params &p_params) { +void uu_mqtt::receive_data(OCTETSTRING &p_data, params_its &p_params) { loggers::get_instance().log(">>> uu_mqtt::receive_data: %d", _state); switch (_state) { @@ -173,7 +173,7 @@ void uu_mqtt::receive_data(OCTETSTRING &p_data, params &p_params) { } // End of 'switch'statement } -void uu_mqtt::update(OCTETSTRING &p_data, params &p_params) { +void uu_mqtt::update(OCTETSTRING &p_data, params_its &p_params) { loggers::get_instance().log_msg(">>> uu_mqtt::update: ", p_data); receive_data(p_data, p_params); @@ -200,7 +200,7 @@ void uu_mqtt::send_connect_command() { data.put_string(calculate_message_length(data_message.get_len())); // Message length data.put_string(OCTETSTRING(data_message.get_len(), data_message.get_data())); - params param; + params_its param; OCTETSTRING os = OCTETSTRING(data.get_len(), data.get_data()); loggers::get_instance().log_msg("uu_mqtt::send_connect_command: ", os); _state = await_connect_ack; @@ -253,13 +253,13 @@ void uu_mqtt::send_subscribe_command() { data.put_string(calculate_message_length(data_message.get_len())); // Message length data.put_string(OCTETSTRING(data_message.get_len(), data_message.get_data())); - params param; + params_its param; OCTETSTRING os = OCTETSTRING(data.get_len(), data.get_data()); loggers::get_instance().log_msg("uu_mqtt::send_subscribe_command: ", os); _layer->send_data(os, param); } -void uu_mqtt::send_publish_command(const OCTETSTRING &p_data, const params &p_params) { +void uu_mqtt::send_publish_command(const OCTETSTRING &p_data, const params_its &p_params) { loggers::get_instance().log(">>> uu_mqtt::send_publish_command: %d", _state); if (_state != publishing) { @@ -289,7 +289,7 @@ void uu_mqtt::send_publish_command(const OCTETSTRING &p_data, const params &p_pa data.put_string(calculate_message_length(data_message.get_len())); // Message length data.put_string(OCTETSTRING(data_message.get_len(), data_message.get_data())); - params param; + params_its param; OCTETSTRING os = OCTETSTRING(data.get_len(), data.get_data()); loggers::get_instance().log_msg("uu_mqtt::send_publish_command: ", os); _layer->send_data(os, param); @@ -307,7 +307,7 @@ void uu_mqtt::send_disconnect_command() { _state = idle; } -int uu_mqtt::recv_connect_ack(OCTETSTRING &p_data, params &p_params) { +int uu_mqtt::recv_connect_ack(OCTETSTRING &p_data, params_its &p_params) { loggers::get_instance().log(">>> uu_mqtt::recv_connect_ack: %d", _state); loggers::get_instance().log_msg(">>> uu_mqtt::recv_connect_ack", p_data); @@ -331,7 +331,7 @@ int uu_mqtt::recv_connect_ack(OCTETSTRING &p_data, params &p_params) { return 0; } -int uu_mqtt::recv_subscribe_ack(OCTETSTRING &p_data, params &p_params) { +int uu_mqtt::recv_subscribe_ack(OCTETSTRING &p_data, params_its &p_params) { loggers::get_instance().log(">>> uu_mqtt::recv_subscribe_ack: %d", _state); loggers::get_instance().log_msg(">>> uu_mqtt::recv_subscribe_ack", p_data); @@ -350,7 +350,7 @@ int uu_mqtt::recv_subscribe_ack(OCTETSTRING &p_data, params &p_params) { return 0; } -int uu_mqtt::recv_publish(OCTETSTRING &p_data, params &p_params, OCTETSTRING& p_message) { +int uu_mqtt::recv_publish(OCTETSTRING &p_data, params_its &p_params, OCTETSTRING& p_message) { loggers::get_instance().log(">>> uu_mqtt::recv_publish: %d", _state); loggers::get_instance().log_msg(">>> uu_mqtt::recv_publish", p_data); @@ -449,4 +449,4 @@ int uu_mqtt::extract_message_length(OCTETSTRING &p_data, unsigned int* p_counter loggers::get_instance().log("<<< uu_mqtt::extract_message_length: %d", value); return value; -} \ No newline at end of file +} diff --git a/ccsrc/Protocols/LTE/uu_mqtt.hh b/ccsrc/Protocols/LTE/uu_mqtt.hh index 32a01c5..e31245d 100644 --- a/ccsrc/Protocols/LTE/uu_mqtt.hh +++ b/ccsrc/Protocols/LTE/uu_mqtt.hh @@ -32,13 +32,13 @@ public: uu_mqtt(); ~uu_mqtt(); - int setup(const params ¶ms); + int setup(const params_its ¶ms); int shutdown(); - void send_data(OCTETSTRING &data, params ¶ms); - void receive_data(OCTETSTRING &p_data, params &p_params); + void send_data(OCTETSTRING &data, params_its ¶ms); + void receive_data(OCTETSTRING &p_data, params_its &p_params); - void update(OCTETSTRING &p_data, params &p_params); + void update(OCTETSTRING &p_data, params_its &p_params); inline void incoming_packet_observer_attach(data_event_notifier* p_observer) { _observers.push_back(p_observer); @@ -48,7 +48,7 @@ public: _observers.erase(std::remove(_observers.begin(), _observers.end(), p_observer), _observers.end()); }; - inline void incoming_packet_notify(OCTETSTRING &p_data, params &p_params) { + inline void incoming_packet_notify(OCTETSTRING &p_data, params_its &p_params) { for (auto o : _observers) { o->update(p_data, p_params); } @@ -60,12 +60,12 @@ private: void send_first_subscribe_command(); void send_next_subscribe_command(); void send_subscribe_command(); - void send_publish_command(const OCTETSTRING &p_data, const params &p_params); + void send_publish_command(const OCTETSTRING &p_data, const params_its &p_params); void send_disconnect_command(); - int recv_connect_ack(OCTETSTRING &p_data, params &p_params); - int recv_subscribe_ack(OCTETSTRING &p_data, params &p_params); - int recv_publish(OCTETSTRING &p_data, params &p_params, OCTETSTRING& p_message); + int recv_connect_ack(OCTETSTRING &p_data, params_its &p_params); + int recv_subscribe_ack(OCTETSTRING &p_data, params_its &p_params); + int recv_publish(OCTETSTRING &p_data, params_its &p_params, OCTETSTRING& p_message); OCTETSTRING calculate_message_length(const int p_payload_len); int extract_message_length(OCTETSTRING &p_data, unsigned int* p_counter); diff --git a/ccsrc/Protocols/LTE/uu_raw.cc b/ccsrc/Protocols/LTE/uu_raw.cc index 579b6ff..137c009 100644 --- a/ccsrc/Protocols/LTE/uu_raw.cc +++ b/ccsrc/Protocols/LTE/uu_raw.cc @@ -24,11 +24,11 @@ void uu_raw::close() { } } -int uu_raw::setup(const params ¶ms) { +int uu_raw::setup(const params_its ¶ms) { loggers::get_instance().log(">>> uu_raw::setup"); // Transport layer - params::const_iterator it = params.find(params::uu_transport); + params::const_iterator it = params.find(params_its::uu_transport); if (it != params.cend()) { if (it->second.compare("tcp") == 0) { loggers::get_instance().log("uu_raw::setup: Create TCP layer"); @@ -58,18 +58,18 @@ int uu_raw::shutdown() { return 0; } -void uu_raw::send_data(OCTETSTRING &data, params ¶ms) { +void uu_raw::send_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log(">>> uu_raw::send_data"); _layer->send_data(data, params); } -void uu_raw::receive_data(OCTETSTRING &p_data, params &p_params) { +void uu_raw::receive_data(OCTETSTRING &p_data, params_its &p_params) { loggers::get_instance().log(">>> uu_raw::receive_data"); incoming_packet_notify(p_data, p_params); } -void uu_raw::update(OCTETSTRING &p_data, params &p_params) { +void uu_raw::update(OCTETSTRING &p_data, params_its &p_params) { loggers::get_instance().log_msg(">>> uu_raw::update: ", p_data); receive_data(p_data, p_params); diff --git a/ccsrc/Protocols/LTE/uu_raw.hh b/ccsrc/Protocols/LTE/uu_raw.hh index 6485cf6..4dfa9f0 100644 --- a/ccsrc/Protocols/LTE/uu_raw.hh +++ b/ccsrc/Protocols/LTE/uu_raw.hh @@ -12,13 +12,13 @@ public: uu_raw(); ~uu_raw(); - int setup(const params ¶ms); + int setup(const params_its ¶ms); int shutdown(); - void send_data(OCTETSTRING &data, params ¶ms); - void receive_data(OCTETSTRING &p_data, params &p_params); + void send_data(OCTETSTRING &data, params_its ¶ms); + void receive_data(OCTETSTRING &p_data, params_its &p_params); - void update(OCTETSTRING &p_data, params &p_params); + void update(OCTETSTRING &p_data, params_its &p_params); inline void incoming_packet_observer_attach(data_event_notifier* p_observer) { _observers.push_back(p_observer); @@ -28,7 +28,7 @@ public: _observers.erase(std::remove(_observers.begin(), _observers.end(), p_observer), _observers.end()); }; - inline void incoming_packet_notify(OCTETSTRING &p_data, params &p_params) { + inline void incoming_packet_notify(OCTETSTRING &p_data, params_its &p_params) { for (auto o : _observers) { o->update(p_data, p_params); } diff --git a/ccsrc/Protocols/MapemSpatem/mapem_codec.cc b/ccsrc/Protocols/MapemSpatem/mapem_codec.cc index a83dc7c..2ce09cb 100644 --- a/ccsrc/Protocols/MapemSpatem/mapem_codec.cc +++ b/ccsrc/Protocols/MapemSpatem/mapem_codec.cc @@ -15,7 +15,7 @@ int mapem_codec::encode(const MAPEM__PDU__Descriptions::MAPEM &mapem, OCTETSTRIN return rc; } -int mapem_codec::decode(const OCTETSTRING &data, MAPEM__PDU__Descriptions::MAPEM &mapem, params *params) { +int mapem_codec::decode(const OCTETSTRING &data, MAPEM__PDU__Descriptions::MAPEM &mapem, params_its *params) { loggers::get_instance().log_msg(">>> mapem_codec::decode: ", data); int rc = asn_codec.decode(oct2bit(data), mapem); diff --git a/ccsrc/Protocols/MapemSpatem/mapem_codec.hh b/ccsrc/Protocols/MapemSpatem/mapem_codec.hh index 0a1e3b8..a9cd2db 100644 --- a/ccsrc/Protocols/MapemSpatem/mapem_codec.hh +++ b/ccsrc/Protocols/MapemSpatem/mapem_codec.hh @@ -2,7 +2,7 @@ #include "codec.hh" #include "mapem_pdu_codec.hh" -#include "params.hh" +#include "params_its.hh" #include "LibItsMapemSpatem_TypesAndValues.hh" @@ -14,5 +14,5 @@ public: virtual ~mapem_codec(){}; virtual int encode(const MAPEM__PDU__Descriptions::MAPEM &sapem, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, MAPEM__PDU__Descriptions::MAPEM &, params *params = NULL); + virtual int decode(const OCTETSTRING &data, MAPEM__PDU__Descriptions::MAPEM &, params_its *params = NULL); }; // End of class mapem_codec diff --git a/ccsrc/Protocols/MapemSpatem/spatem_codec.cc b/ccsrc/Protocols/MapemSpatem/spatem_codec.cc index 787efca..25ecde1 100644 --- a/ccsrc/Protocols/MapemSpatem/spatem_codec.cc +++ b/ccsrc/Protocols/MapemSpatem/spatem_codec.cc @@ -15,7 +15,7 @@ int spatem_codec::encode(const SPATEM__PDU__Descriptions::SPATEM &spatem, OCTETS return rc; } -int spatem_codec::decode(const OCTETSTRING &data, SPATEM__PDU__Descriptions::SPATEM &spatem, params *params) { +int spatem_codec::decode(const OCTETSTRING &data, SPATEM__PDU__Descriptions::SPATEM &spatem, params_its *params) { loggers::get_instance().log_msg(">>> spatem_codec::decode: ", data); int rc = asn_codec.decode(oct2bit(data), spatem); diff --git a/ccsrc/Protocols/MapemSpatem/spatem_codec.hh b/ccsrc/Protocols/MapemSpatem/spatem_codec.hh index ec18d7b..bfb07b6 100644 --- a/ccsrc/Protocols/MapemSpatem/spatem_codec.hh +++ b/ccsrc/Protocols/MapemSpatem/spatem_codec.hh @@ -1,7 +1,7 @@ #pragma once #include "codec.hh" -#include "params.hh" +#include "params_its.hh" #include "spatem_pdu_codec.hh" #include "mapem_spatem_types.hh" @@ -14,5 +14,5 @@ public: virtual ~spatem_codec(){}; virtual int encode(const SPATEM__PDU__Descriptions::SPATEM &spatem, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, SPATEM__PDU__Descriptions::SPATEM &, params *params = NULL); + virtual int decode(const OCTETSTRING &data, SPATEM__PDU__Descriptions::SPATEM &, params_its *params = NULL); }; // End of class spatem_codec diff --git a/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.cc b/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.cc index 5029a8b..8cfcf40 100644 --- a/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.cc +++ b/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.cc @@ -11,7 +11,7 @@ mapem_spatem_layer::mapem_spatem_layer(const std::string &p_type, const std::str : t_layer(p_type), _params(), _mapem_codec(), _spatem_codec() { loggers::get_instance().log(">>> mapem_spatem_layer::mapem_spatem_layer: %s, %s", to_string().c_str(), param.c_str()); // Setup parameters - params::convert(_params, param); + params_its::convert(_params, param); _params.insert(std::make_pair("its_aid", "138")); // ETSI TS 102 965 V1.2.1 (2015-06) _params.insert(std::make_pair("payload_type", "2")); // MAPE message id - See ETSI TS 102 894 @@ -20,7 +20,7 @@ mapem_spatem_layer::mapem_spatem_layer(const std::string &p_type, const std::str registration::get_instance().add_item(p_type, this); } -void mapem_spatem_layer::sendMsg(const LibItsMapemSpatem__TypesAndValues::MapemReq &p, params ¶ms) { +void mapem_spatem_layer::sendMsg(const LibItsMapemSpatem__TypesAndValues::MapemReq &p, params_its ¶ms) { loggers::get_instance().log_msg(">>> mapem_spatem_layer::sendMsg: ", p); // Encode mapem PDU @@ -33,7 +33,7 @@ void mapem_spatem_layer::sendMsg(const LibItsMapemSpatem__TypesAndValues::MapemR send_data(data, _params); } -void mapem_spatem_layer::sendMsg(const LibItsMapemSpatem__TypesAndValues::SpatemReq &p, params ¶ms) { +void mapem_spatem_layer::sendMsg(const LibItsMapemSpatem__TypesAndValues::SpatemReq &p, params_its ¶ms) { loggers::get_instance().log_msg(">>> mapem_spatem_layer::sendMsg: ", p); // Encode spatem PDU @@ -45,13 +45,13 @@ void mapem_spatem_layer::sendMsg(const LibItsMapemSpatem__TypesAndValues::Spatem send_data(data, _params); } -void mapem_spatem_layer::send_data(OCTETSTRING &data, params ¶ms) { +void mapem_spatem_layer::send_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> mapem_spatem_layer::send_data: ", data); // params.log(); send_to_all_layers(data, params); } -void mapem_spatem_layer::receive_data(OCTETSTRING &data, params ¶ms) { +void mapem_spatem_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> mapem_spatem_layer::receive_data: ", data); // Sanity check @@ -65,63 +65,63 @@ void mapem_spatem_layer::receive_data(OCTETSTRING &data, params ¶ms) { } // else, continue // Process lower layer data // recvTime - params::const_iterator it = params.find(params::timestamp); + params_its::const_iterator it = params.find(params_its::timestamp); if (it != params.cend()) { p.recvTime().set_long_long_val(std::stoll(it->second)); } else { p.recvTime().set_to_omit(); } // gnNextHeader - it = params.find(params::gn_next_header); + it = params.find(params_its::gn_next_header); if (it != params.cend()) { p.gnNextHeader() = std::stoi(it->second); } else { p.gnNextHeader().set_to_omit(); } // gnHeaderType - it = params.find(params::gn_header_type); + it = params.find(params_its::gn_header_type); if (it != params.cend()) { p.gnHeaderType() = std::stoi(it->second); } else { p.gnHeaderType().set_to_omit(); } // gnHeaderSubtype - it = params.find(params::gn_header_sub_type); + it = params.find(params_its::gn_header_sub_type); if (it != params.cend()) { p.gnHeaderSubtype() = std::stoi(it->second); } else { p.gnHeaderSubtype().set_to_omit(); } // gnLifetime - it = params.find(params::gn_lifetime); + it = params.find(params_its::gn_lifetime); if (it != params.cend()) { p.gnLifetime() = std::stoi(it->second); } else { p.gnLifetime().set_to_omit(); } // gnTrafficClass - it = params.find(params::gn_traffic_class); + it = params.find(params_its::gn_traffic_class); if (it != params.cend()) { p.gnTrafficClass() = std::stoi(it->second); } else { p.gnTrafficClass().set_to_omit(); } // btpDestinationPort - it = params.find(params::btp_destination_port); + it = params.find(params_its::btp_destination_port); if (it != params.cend()) { p.btpDestinationPort() = std::stoi(it->second); } else { p.btpDestinationPort().set_to_omit(); } // btpInfo - it = params.find(params::btp_info); + it = params.find(params_its::btp_info); if (it != params.cend()) { p.btpInfo() = std::stoi(it->second); } else { p.btpInfo().set_to_omit(); } // ssp - it = params.find(params::ssp); + it = params.find(params_its::ssp); if (it != params.cend()) { loggers::get_instance().log("mapem_spatem_layer::receive_data: ssp=%s", it->second.c_str()); p.ssp() = oct2bit(str2oct(CHARSTRING(it->second.c_str()))); @@ -129,7 +129,7 @@ void mapem_spatem_layer::receive_data(OCTETSTRING &data, params ¶ms) { p.ssp().set_to_omit(); } // its_aid - it = params.find(params::its_aid); + it = params.find(params_its::its_aid); if (it != params.cend()) { p.its__aid() = std::stoi(it->second); } else { @@ -148,63 +148,63 @@ void mapem_spatem_layer::receive_data(OCTETSTRING &data, params ¶ms) { } // else, continue // Process lower layer data // recvTime - params::const_iterator it = params.find(params::timestamp); + params_its::const_iterator it = params.find(params_its::timestamp); if (it != params.cend()) { p.recvTime().set_long_long_val(std::stoll(it->second)); } else { p.recvTime().set_to_omit(); } // gnNextHeader - it = params.find(params::gn_next_header); + it = params.find(params_its::gn_next_header); if (it != params.cend()) { p.gnNextHeader() = std::stoi(it->second); } else { p.gnNextHeader().set_to_omit(); } // gnHeaderType - it = params.find(params::gn_header_type); + it = params.find(params_its::gn_header_type); if (it != params.cend()) { p.gnHeaderType() = std::stoi(it->second); } else { p.gnHeaderType().set_to_omit(); } // gnHeaderSubtype - it = params.find(params::gn_header_sub_type); + it = params.find(params_its::gn_header_sub_type); if (it != params.cend()) { p.gnHeaderSubtype() = std::stoi(it->second); } else { p.gnHeaderSubtype().set_to_omit(); } // gnLifetime - it = params.find(params::gn_lifetime); + it = params.find(params_its::gn_lifetime); if (it != params.cend()) { p.gnLifetime() = std::stoi(it->second); } else { p.gnLifetime().set_to_omit(); } // gnTrafficClass - it = params.find(params::gn_traffic_class); + it = params.find(params_its::gn_traffic_class); if (it != params.cend()) { p.gnTrafficClass() = std::stoi(it->second); } else { p.gnTrafficClass().set_to_omit(); } // btpDestinationPort - it = params.find(params::btp_destination_port); + it = params.find(params_its::btp_destination_port); if (it != params.cend()) { p.btpDestinationPort() = std::stoi(it->second); } else { p.btpDestinationPort().set_to_omit(); } // btpInfo - it = params.find(params::btp_info); + it = params.find(params_its::btp_info); if (it != params.cend()) { p.btpInfo() = std::stoi(it->second); } else { p.btpInfo().set_to_omit(); } // ssp - it = params.find(params::ssp); + it = params.find(params_its::ssp); if (it != params.cend()) { loggers::get_instance().log("mapem_spatem_layer::receive_data: ssp=%s", it->second.c_str()); p.ssp() = oct2bit(str2oct(CHARSTRING(it->second.c_str()))); @@ -212,7 +212,7 @@ void mapem_spatem_layer::receive_data(OCTETSTRING &data, params ¶ms) { p.ssp().set_to_omit(); } // its_aid - it = params.find(params::its_aid); + it = params.find(params_its::its_aid); if (it != params.cend()) { p.its__aid() = std::stoi(it->second); } else { diff --git a/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.hh b/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.hh index a666a76..b0a5b68 100644 --- a/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.hh +++ b/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.hh @@ -23,7 +23,7 @@ namespace LibItsMapemSpatem__TestSystem { } // namespace LibItsMapemSpatem__TestSystem class mapem_spatem_layer : public t_layer { - params _params; + params_its _params; mapem_codec _mapem_codec; spatem_codec _spatem_codec; @@ -32,11 +32,11 @@ public: mapem_spatem_layer(const std::string &p_type, const std::string ¶m); virtual ~mapem_spatem_layer(){}; - void sendMsg(const LibItsMapemSpatem__TypesAndValues::MapemReq &, params ¶ms); - void sendMsg(const LibItsMapemSpatem__TypesAndValues::SpatemReq &, params ¶ms); + void sendMsg(const LibItsMapemSpatem__TypesAndValues::MapemReq &, params_its ¶ms); + void sendMsg(const LibItsMapemSpatem__TypesAndValues::SpatemReq &, params_its ¶ms); - virtual void send_data(OCTETSTRING &data, params ¶ms); - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void send_data(OCTETSTRING &data, params_its ¶ms); + virtual void receive_data(OCTETSTRING &data, params_its &info); int enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security); diff --git a/ccsrc/Protocols/Pcap/module.mk b/ccsrc/Protocols/Pcap/module.mk deleted file mode 100644 index 0bb7431..0000000 --- a/ccsrc/Protocols/Pcap/module.mk +++ /dev/null @@ -1,3 +0,0 @@ -sources := pcap_cygwin_layer.cc pcap_layer.cc pcap_linux_layer.cc pcap_offline_layer.cc -includes := . - diff --git a/ccsrc/Protocols/Pcap/pcap_cygwin_layer.cc b/ccsrc/Protocols/Pcap/pcap_cygwin_layer.cc deleted file mode 100644 index 56f9bbc..0000000 --- a/ccsrc/Protocols/Pcap/pcap_cygwin_layer.cc +++ /dev/null @@ -1,265 +0,0 @@ -#if defined(__CYGWIN__) - -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "pcap_layer_factory.hh" - -#include "loggers.hh" - -#include - -typedef struct { - bpf_int32 tv_sec; /* seconds */ - bpf_int32 tv_usec; /* microseconds */ -} pcap_o_timeval; - -typedef struct pcap_o_pkthdr { - pcap_o_timeval ts; /* time stamp */ - bpf_u_int32 caplen; /* length of portion present */ - bpf_u_int32 len; /* length this packet (off wire) */ -} pcap_o_pkthdr; - -extern "C" int pcap_oid_get_request(pcap_t *p, bpf_u_int32 oid, void *data, size_t *lenp); - -static const char *_hexDigits = "0123456789ABCDEF"; -static char * _bin2hex(char *hex, size_t hlen, const char *bin, size_t blen) { - const unsigned char *b, *e; - char * s; - - // sanity check - if (hlen >= 0 && hlen < blen * 2) - return NULL; - - b = (const unsigned char *)bin; - e = b + blen - 1; - s = hex + blen * 2; - if (s < hex + hlen) - *s = 0; - for (; b <= e; e--) { - *(--s) = _hexDigits[(*e) & 0xF]; - *(--s) = _hexDigits[(*e) >> 4]; - } - return hex + blen * 2; -} - -pcap_layer::pcap_layer(const std::string &p_type, const std::string ¶m) - : layer(p_type), PORT(p_type.c_str()), _params(), _device(NULL), _running(FALSE), _time_key("pcap_layer::Handle_Fd_Event_Readable") { - loggers::get_instance().log(">>> pcap_layer::pcap_layer: %s, %s", p_type.c_str(), param.c_str()); - params::convert(_params, param); - - char error_buffer[PCAP_ERRBUF_SIZE]; - params::const_iterator it; - std::string nic; // network interface name - bpf_u_int32 mask; // subnet mask - bpf_u_int32 net; // ip address - - it = _params.find(params::nic); - if ((it == _params.end()) || it->second.empty()) { - loggers::get_instance().error("pcap_layer::pcap_layer: NIC must be specified"); - return; - } - - nic = std::string("\\Device\\NPF_{") + it->second + "}"; - - if (pcap_lookupnet(nic.c_str(), &net, &mask, error_buffer) != 0) { - loggers::get_instance().error("pcap_layer::pcap_layer: pcap_layer::pcap_layer: Failed to fetch newtork address for device %s", nic.c_str()); - } - loggers::get_instance().log("pcap_layer::pcap_layer: Device %s Network address: %d", nic.c_str(), net); - - // Open the device - _device = pcap_open_live(nic.c_str(), 65536 /*64*1024*/, 1, 100, error_buffer); - if (_device == NULL) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to open device %s", nic.c_str()); - return; - } - - // Setup filter - std::string filter = ""; - std::string mac_src; - it = _params.find(params::mac_src); - if (it != _params.end() && !it->second.empty()) { - mac_src = it->second; - } else { - // Not found - // determine it automatically -#ifndef OID_802_3_CURRENT_ADDRESS -#define OID_802_3_CURRENT_ADDRESS 0x01010102 -#endif - char mac[6] = {0}; - size_t l = sizeof(mac); - pcap_oid_get_request(_device, OID_802_3_CURRENT_ADDRESS, mac, &l); - char buf[13]; - *_bin2hex(buf, sizeof(buf), mac, 6) = 0; - mac_src = buf; - loggers::get_instance().user("pcap_layer::pcap_layer: local MAC is %s", mac_src.c_str()); - _params[params::mac_src] = mac_src; - } - - std::string mac_bc; - it = _params.find(params::mac_bc); - if (it != _params.end() && !it->second.empty()) - mac_bc = it->second; - else - mac_bc = "ffffffffffff"; - - if (mac_bc == mac_src || mac_src.empty()) - filter = "ether dst " + mac_bc; - else - filter = "( ether dst " + mac_bc + " or ether dst " + mac_src + " )"; - - if (!mac_src.empty()) - // Reject ITS messages sent by this component - filter += " and not ether src " + mac_src; - - // Add user defined filter - it = _params.find(params::filter); - if ((it != _params.end()) && !it->second.empty()) { - filter += std::string(" ") + it->second; - } - - // Log final PCAP filter - loggers::get_instance().user("pcap_layer::pcap_layer: Filter: %s", filter.c_str()); - - // setup filter - { - struct bpf_program f = {0}; - if (pcap_compile(_device, &f, filter.c_str(), 1, PCAP_NETMASK_UNKNOWN) != 0) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to compile PCAP filter"); - } else { - if (pcap_setfilter(_device, &f) != 0) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to set PCAP filter"); - } - } - pcap_freecode(&f); - } - - _o_params.insert(std::pair(std::string("timestamp"), std::string())); - - // create pipe and run thread - if (pipe2(_fd, O_NONBLOCK) == -1) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to create a pipe: %s", ::strerror(errno)); - } - // Pass the pipe handler to the polling procedure - loggers::get_instance().log("pcap_layer::pcap_layer: Call handler with descriptor %d", _fd[0]); - Handler_Add_Fd_Read(_fd[0]); - - // Create the reader thread - _thread = new std::thread(&pcap_layer::run, (void *)this); - if (_thread == NULL) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to start offline thread"); - } - while (_running == FALSE) { - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - } - // Thread was started - loggers::get_instance().log("<<< pcap_layer::pcap_layer"); -} // End of ctor - -pcap_layer::~pcap_layer() { - loggers::get_instance().log(">>> pcap_layer::~pcap_layer"); - - if (_device != NULL) { - if (_thread != NULL) { - _running = FALSE; - // Wait for the working thread to terminate - _thread->join(); - loggers::get_instance().log("pcap_layer::~pcap_layer: Thread were stops"); - // Cleanup - delete _thread; - close(_fd[0]); - close(_fd[1]); - } - pcap_close(_device); - } -} // End of dtor - -void *pcap_layer::run(void *p_this) { - pcap_layer &p = *static_cast(p_this); - return p.thread(); -} - -void *pcap_layer::thread() { - pcap_o_pkthdr *pkt_header; - const u_char * pkt_data; - unsigned char pkt_count = 0; - - // loggers::get_instance().log(">>> pcap_layer::run"); - - _running = TRUE; - - // wait a bit before sending first packet - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - - while (_running) { // Loop while _running flag is up - // get next frame - int result = pcap_next_ex(_device, (struct pcap_pkthdr **)&pkt_header, &pkt_data); - if (result == 0) { - continue; - } - if (result < 0) { - // loggers::get_instance().log("<<< pcap_layer::run: error %s", pcap_geterr(_device)); - break; - } - - while (_running && !_resume.try_lock()) { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } -#if 0 - { - char buf[128]; - std::time_t t = pkt_header->ts.tv_sec; - std::tm * pt = std::localtime( &t ); - t = std::strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", pt); - std::sprintf(buf+t, "%ld", pkt_header->ts.tv_sec * 1000 + static_cast(pkt_header->ts.tv_usec / 1000)); // Use milliseconds - _o_params[params::timestamp] = std::string(buf); - } -#else - _o_params[params::timestamp] = std::to_string(pkt_header->ts.tv_sec * 1000 + static_cast(pkt_header->ts.tv_usec / 1000)); // Use milliseconds -#endif - _o_data = OCTETSTRING(pkt_header->len, pkt_data); - write(_fd[1], &pkt_count, 1); - pkt_count++; - } - _running = FALSE; - // loggers::get_instance().log("<<< pcap_layer::run"); - return NULL; -} - -void pcap_layer::send_data(OCTETSTRING &data, params ¶ms) { - loggers::get_instance().log_msg(">>> pcap_layer::send_data: ", data); - if (pcap_sendpacket(_device, static_cast(data), data.lengthof()) == -1) { - loggers::get_instance().error("pcap_layer::send_data: Failed to send packet: %s", pcap_geterr(_device)); - } -} - -void pcap_layer::receive_data(OCTETSTRING &data, params ¶ms) { - loggers::get_instance().log(">>> pcap_layer::receive_data: Received %d bytes", data.lengthof()); - loggers::get_instance().log_to_hexa("Packet dump", data); - - // Pass the packet to the upper layers - receive_to_all_layers(data, params); -} - -void pcap_layer::Handle_Fd_Event_Readable(int fd) { - char c[2]; - float duration; - loggers::get_instance().set_start_time(_time_key); - this->receive_data(_o_data, _o_params); - loggers::get_instance().set_stop_time(_time_key, duration); - read(_fd[0], &c, 1); - _resume.unlock(); -} - -pcap_layer_factory pcap_layer_factory::_f; - -#endif //__CYGWIN__ diff --git a/ccsrc/Protocols/Pcap/pcap_cygwin_layer.hh b/ccsrc/Protocols/Pcap/pcap_cygwin_layer.hh deleted file mode 100644 index d7d477a..0000000 --- a/ccsrc/Protocols/Pcap/pcap_cygwin_layer.hh +++ /dev/null @@ -1,79 +0,0 @@ -/*! - * \file pcap_layer.hh - * \brief Header file for ITS Offline Pcap port layer. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include -#include - -#include "params.hh" -#include "t_layer.hh" - -#include - -class PORT; //! Forward declaration of TITAN class - -typedef struct pcap pcap_t; - -/*! - * \class pcap_layer - * \brief This class provides description of ITS PCAP port protocol layer - */ -class pcap_layer : public layer, public PORT { - - params _params; //! Layer parameters - pcap_t * _device; //! Device handle - std::thread *_thread; //! Thread handle, used to read PCAP file instead of NIC, used in file mode - std::mutex _resume; - bool _running; //! Set to true when the thread is running, used in file mode - int _fd[2]; //! pipe to signal to Titan - - OCTETSTRING _o_data; - params _o_params; - - std::string _time_key; - - static void *run(void *p_this); - -public: - void *thread(void); - -public: //! \publicsection - /*! - * \brief Specialised constructor - * Create a new instance of the pcap_layer class - * \param[in] p_type \todo - * \param[in] p_param \todo - */ - pcap_layer(const std::string &p_type, const std::string ¶m); - /*! - * \brief Default destructor - */ - virtual ~pcap_layer(); - - /*! - * \virtual - * \fn void send_data(OCTETSTRING& data, params& params); - * \brief Send bytes formated data to the lower layers - * \param[in] p_data The data to be sent - * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters - */ - virtual void send_data(OCTETSTRING &data, params ¶ms); - /*! - * \virtual - * \fn void receive_data(OCTETSTRING& data, params& params); - * \brief Receive bytes formated data from the lower layers - * \param[in] p_data The bytes formated data received - * \param[in] p_params Some lower layers parameters values when data was received - */ - virtual void receive_data(OCTETSTRING &data, params &info); - - void Handle_Fd_Event_Readable(int fd); -}; diff --git a/ccsrc/Protocols/Pcap/pcap_layer.cc b/ccsrc/Protocols/Pcap/pcap_layer.cc deleted file mode 100644 index 8313c9f..0000000 --- a/ccsrc/Protocols/Pcap/pcap_layer.cc +++ /dev/null @@ -1,276 +0,0 @@ -#if 0 -#include -#include -#include -#include -#include - -#include - -#include "pcap_layer_factory.hh" - -typedef struct pcap_pkthdr pcap_o_pkthdr; -typedef struct timeval pcap_o_timeval; - -#include "loggers.hh" - -pcap_layer::pcap_layer(const std::string& p_type, const std::string& param) : layer(p_type), PORT(p_type.c_str()), _params(), _device(NULL), _pcap_h(-1), _thread(NULL), _running(FALSE), _resume(), _sent_file(NULL), _time_key("pcap_layer::Handle_Fd_Event_Readable") { - bool online = false; - loggers::get_instance().log(">>> pcap_layer::pcap_layer: %s, %s", to_string().c_str(), param.c_str()); - _fd[0] = -1; _fd[1] = -1; - // Setup parameters - params::convert(_params, param); - //_params.log(); - // Prepare capture processing - char error_buffer[PCAP_ERRBUF_SIZE]; - params::const_iterator it = _params.find(params::nic); - if ((it != _params.end()) && !it->second.empty()) { // Use online capture - // Fetch the network address and network mask - bpf_u_int32 mask; // subnet mask - bpf_u_int32 net; // ip address - std::string nic; - online = true; - nic = _params[params::nic]; - if (pcap_lookupnet(nic.c_str(), &net, &mask, error_buffer) != 0) { - loggers::get_instance().error("pcap_layer::pcap_layer: pcap_layer::pcap_layer: Failed to fetch newtork address for device %s", nic.c_str()); - } - loggers::get_instance().log("pcap_layer::pcap_layer: Device %s Network address: %d", nic.c_str(), net); - // Open the device - _device = pcap_open_live(nic.c_str(), 65536, 1, 1000, error_buffer); // TODO Replace hard coded values by pcap_layer:: - if (_device == NULL) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to open device %s", nic.c_str()); - } // else, continue - // Set non-blocking flag for the polling procedure - if (pcap_setnonblock(_device, 1, error_buffer) != 0) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to set blocking mode: %s", error_buffer); - } - // Retrieve the device file handler - _pcap_h = pcap_get_selectable_fd(_device); - if (_pcap_h == -1) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to get device handler"); - } - } else { - // Check file name - it = _params.find(std::string("file")); - if ((it != _params.cend()) && !it->second.empty()) { // Use offline capture - struct stat s = {0}; - if ((stat(_params["file"].c_str(), &s) != 0) || !S_ISREG(s.st_mode)) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to acces PCAP file %s", _params["file"].c_str()); - } - // File exist, open it - _device = pcap_open_offline(_params["file"].c_str(), error_buffer); - if (_device == NULL) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to open PCAP file %s", error_buffer); - } // else, continue - // Create the dump file for the sent packet based on the openned file name and the current time in milliseconds - it = _params.find("save_mode"); - if ((it != _params.cend()) && (it->second.compare("1") == 0)) { - unsigned long ms = std::chrono::system_clock::now().time_since_epoch() / std::chrono::milliseconds(1); - std::string ext("_" + std::to_string(ms)); - int i = _params["file"].find(".pcap"); - if (i > 0) { - std::string f(_params["file"].substr(0, i) + ext + ".pcap"); - loggers::get_instance().log("pcap_layer::pcap_layer: Save file name: %s", f.c_str()); - if ((_sent_file = pcap_dump_open(_device, f.c_str())) == NULL) { - loggers::get_instance().warning("pcap_layer::pcap_layer: Failed to open save file %s", f.c_str()); - } - } - } // else, nothing to do - } else { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to open PCAP file %s", error_buffer); - } - } - - // Setup filter - std::string filter = ""; - it = _params.find(params::mac_src); - if (it == _params.end()) { // Not found - loggers::get_instance().error("pcap_layer::pcap_layer: mac_src parameter not found, cannot continue"); - } else { - // Reject ITS messages sent by this component - filter = "not ether src " + _params[params::mac_src]; - // Accept ITS broadcasted to this componenet - filter += " and (ether dst " + _params[params::mac_src]; - // Accept ITS broadcasted messages - it = _params.find(params::mac_bc); - if ((it != _params.end()) && !it->second.empty()) { - filter += " or ether dst " + it->second + ")"; - } else { - filter += " or ether dst ffffffffffff) "; - } - // Add user defined filter - it = _params.find(params::filter); - if ((it != _params.end()) && !it->second.empty()) { - filter += _params["filter"]; - } // else nothing to do - } - // Log final PCAP filter - loggers::get_instance().user("pcap_layer::pcap_layer: Filter: %s", filter.c_str()); - if (!filter.empty()) { - struct bpf_program f = {0}; - if (pcap_compile(_device, &f, filter.c_str(), 1, PCAP_NETMASK_UNKNOWN) != 0) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to compile PCAP filter"); - } - if (pcap_setfilter(_device, &f) != 0) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to set PCAP filter"); - } - pcap_freecode(&f); - } - - // Pass the device file handler to the polling procedure - if (_pcap_h != -1) { // Live capture - Handler_Add_Fd_Read(_pcap_h); - } else { // Offline capture or cygwin - // Create a pipe - if (pipe2(_fd, O_NONBLOCK) == -1) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to create a pipe: %s", ::strerror(errno)); - } - if(online){ - _pcap_h = _fd[0]; - } - // Pass the pipe handler to the polling procedure - loggers::get_instance().log("pcap_layer::pcap_layer: Call handler with descriptor %d", _fd[0]); - Handler_Add_Fd_Read(_fd[0]); - // Create the offline reader thread - _thread = new std::thread(&pcap_layer::run, (void *)this); - if (_thread == NULL) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to start offline thread"); - } - // Start it to dispatch packet to a pipe - while (_running == FALSE) { - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - } - // Thread was started - loggers::get_instance().log("<<< pcap_layer::pcap_layer"); - } -} // End of ctor - -pcap_layer::~pcap_layer() { - loggers::get_instance().log(">>> pcap_layer::~pcap_layer"); - - if (_device != NULL) { - if (_thread != NULL) { - _running = FALSE; - // Wait for the working thread to terminate - _thread->join(); - loggers::get_instance().log("pcap_layer::~pcap_layer: Thread were stops"); - // Cleanup - delete _thread; - close(_fd[0]); - close(_fd[1]); - } - if (_sent_file != NULL) { - pcap_dump_close(_sent_file); - } - pcap_close(_device); - } -} // End of dtor - -void* pcap_layer::run(void* p_this) { - pcap_layer& p = *static_cast(p_this); - return p.thread(); -} - -void* pcap_layer::thread() { - loggers::get_instance().log(">>> pcap_layer::run"); - - // Wait a little bit before to start sending packet - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - params::const_iterator it = _params.find("frame_offset"); - if ((it != _params.cend()) && (it->second.compare("0") != 0)) { - // TODO Try t use PCAP filter to start directly to the correct frame offset - /*try { - unsigned int offset = std::stoul(str_dec, &s); - // Skip frames - struct pcap_pkthdr *pkt_header; - const u_char *pkt_data; - int result = pcap_next_ex(_device, &pkt_header, &pkt_data); - if (result == 1) { // Succeed - } - } - catch (invalid_argument& i) { - } - catch (out_of_range& o) { - }*/ - } - // Let's go - _running = TRUE; - while (_running) { // Loop while _running flag is up - if (_resume.try_lock() == TRUE) { // Previous packet was consumed, lock for the next one - write(_fd[1], "\n", 1); // Any character will do the job - } else { // not ready yet - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - } - - loggers::get_instance().log("<<< pcap_layer::run"); - return NULL; -} - -void pcap_layer::send_data(OCTETSTRING& data, params& params) { - loggers::get_instance().log_msg(">>> pcap_layer::send_data: ", data); - - if (_pcap_h != -1) { // Check if offline mode is used - if (pcap_sendpacket(_device, static_cast(data), data.lengthof()) == -1) { - loggers::get_instance().error("pcap_layer::send_data: Failed to send packet: %s", pcap_geterr(_device)); - } - } else if (_sent_file != NULL) { - struct pcap_pkthdr hdr; - std::chrono::system_clock::time_point now = std::chrono::system_clock::now(); - std::chrono::milliseconds ms = std::chrono::duration_cast(now.time_since_epoch()); - hdr.ts.tv_sec = ms.count() / 1000; - hdr.ts.tv_usec = (ms.count() % 1000) * 1000; - hdr.caplen = data.lengthof(); - hdr.len = hdr.caplen; - pcap_dump((u_char *)_sent_file, &hdr, static_cast(data)); - } else { - loggers::get_instance().log("pcap_layer::send_data: Offline mode, operation was skipped"); - } -} - -void pcap_layer::receive_data(OCTETSTRING& data, params& params) { - loggers::get_instance().log(">>> pcap_layer::receive_data: Received %d bytes", data.lengthof()); - loggers::get_instance().log_to_hexa("Packet dump", data); - - // Pass the packet to the upper layers - receive_to_all_layers(data, params); -} - -void pcap_layer::Handle_Fd_Event_Readable(int fd) { - //loggers::get_instance().log(">>> pcap_layer::Handle_Fd_Event_Readable: %d", fd); - - pcap_o_pkthdr *pkt_header; - const u_char *pkt_data; - int result = pcap_next_ex(_device, (struct pcap_pkthdr**)&pkt_header, &pkt_data); - if (result == 1) { // Succeed - if (pkt_header->caplen > 14) { // Reject too small packet - //loggers::get_instance().log("pcap_layer::Handle_Fd_Event_Readable: %ld - % ld - %d", pkt_header->ts.tv_sec, pkt_header->ts.tv_usec, pkt_header->len); - // Fill parameters from PCAP layer - params params; - params.insert(std::pair(params::timestamp, std::to_string(pkt_header->ts.tv_sec * 1000 + static_cast(pkt_header->ts.tv_usec / 1000)))); // Use milliseconds - // Process the packet at this layer - OCTETSTRING os(pkt_header->caplen, pkt_data); - //loggers::get_instance().log_to_hexa("pcap_layer::Handle_Fd_Event_Readable: ", os); - // TODO Case of caplen != len !!! - float duration; - loggers::get_instance().set_start_time(_time_key); - this->receive_data(os, params); // TODO Check execution time for decoding operation - loggers::get_instance().set_stop_time(_time_key, duration); - } - } // else, skip the packet - // Specific to offline mode - if (_fd[0] != -1) { // Check if offline mode is used - //loggers::get_instance().log("pcap_layer::Handle_Fd_Event_Readable: Read pipe"); - char c[2]; - read(_fd[0], &c, 1); - if (result == -2) { // End of file, therminate worker thread - _running = FALSE; - } - //loggers::get_instance().log("pcap_layer::Handle_Fd_Event_Readable: pcap_next_ex failed: result=%d", result); - _resume.unlock(); - } // else, nothing to do -} - -pcap_layer_factory pcap_layer_factory::_f; - -#endif // !CYGWIN diff --git a/ccsrc/Protocols/Pcap/pcap_layer.hh b/ccsrc/Protocols/Pcap/pcap_layer.hh deleted file mode 100644 index 151eab8..0000000 --- a/ccsrc/Protocols/Pcap/pcap_layer.hh +++ /dev/null @@ -1,5 +0,0 @@ -#if defined (__CYGWIN__) - #include "pcap_cygwin_layer.hh" -#else - #include "pcap_linux_layer.hh" -#endif diff --git a/ccsrc/Protocols/Pcap/pcap_layer_factory.hh b/ccsrc/Protocols/Pcap/pcap_layer_factory.hh deleted file mode 100644 index 0125e19..0000000 --- a/ccsrc/Protocols/Pcap/pcap_layer_factory.hh +++ /dev/null @@ -1,42 +0,0 @@ -/*! - * \file pcap_layer_factory.hh - * \brief Header file for Pcap layer factory. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include "layer_stack_builder.hh" - -#include "pcap_layer.hh" - -/*! - * \class pcap_layer_factory - * \brief This class provides a factory class to create an pcap_layer class instance - */ -class pcap_layer_factory : public layer_factory { - static pcap_layer_factory _f; //! Reference to the unique instance of this class -public: //! \publicsection - /*! - * \brief Default constructor - * Create a new instance of the udp_layer_factory class - * \remark The PCAP layer identifier is PCAP - */ - pcap_layer_factory() { - // register factory - layer_stack_builder::register_layer_factory("PCAP", this); - }; - /*! - * \fn layer* create_layer(const std::string & type, const std::string & param); - * \brief Create the layers stack based on the provided layers stack description - * \param[in] p_type The provided layers stack description - * \param[in] p_params Optional parameters - * \return 0 on success, -1 otherwise - * \inline - */ - inline virtual layer *create_layer(const std::string &p_type, const std::string &p_param) { return new pcap_layer(p_type, p_param); }; -}; // End of class pcap_layer_factory diff --git a/ccsrc/Protocols/Pcap/pcap_linux_layer.cc b/ccsrc/Protocols/Pcap/pcap_linux_layer.cc deleted file mode 100644 index fecb2b3..0000000 --- a/ccsrc/Protocols/Pcap/pcap_linux_layer.cc +++ /dev/null @@ -1,198 +0,0 @@ -#if !defined(__CYGWIN__) -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "pcap_layer_factory.hh" - -#include "loggers.hh" - -static const char *_hexDigits = "0123456789ABCDEF"; -static char * _bin2hex(char *hex, size_t hlen, const char *bin, size_t blen) { - const unsigned char *b, *e; - char * s; - - // sanity check - if (hlen >= 0 && hlen < blen * 2) - return NULL; - - b = (const unsigned char *)bin; - e = b + blen - 1; - s = hex + blen * 2; - if (s < hex + hlen) - *s = 0; - for (; b <= e; e--) { - *(--s) = _hexDigits[(*e) & 0xF]; - *(--s) = _hexDigits[(*e) >> 4]; - } - return hex + blen * 2; -} - -pcap_layer::pcap_layer(const std::string &p_type, const std::string ¶m) - : layer(p_type), PORT(p_type.c_str()), _params(), _device(NULL), _pcap_h(-1), _time_key("pcap_layer::Handle_Fd_Event_Readable") { - char error_buffer[PCAP_ERRBUF_SIZE]; - params::const_iterator it; - std::string nic; - - loggers::get_instance().log(">>> pcap_layer::pcap_layer: %s, %s", to_string().c_str(), param.c_str()); - // Setup parameters - params::convert(_params, param); - // Prepare capture processing - it = _params.find(params::nic); - if ((it == _params.end()) || it->second.empty()) { // Use online capture - loggers::get_instance().error("pcap_layer::pcap_layer: NIC name must be specified"); - return; - } - - nic = _params[params::nic]; - { - bpf_u_int32 net, mask; // ip address and subnet mask - if (pcap_lookupnet(nic.c_str(), &net, &mask, error_buffer) != 0) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to fetch newtork address for device %s", nic.c_str()); - } else { - loggers::get_instance().log("pcap_layer::pcap_layer: Device %s Network address: %d", nic.c_str(), net); - } - } - // Open the device in promiscuous mode - _device = pcap_open_live(nic.c_str(), 65536 /*64*1024*/, 1, 100, error_buffer); // TODO Replace hard coded values by pcap_layer:: - if (_device == NULL) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to open device %s", nic.c_str()); - return; - } // else, continue - // Set non-blocking flag for the polling procedure - if (pcap_setnonblock(_device, 1, error_buffer) != 0) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to set blocking mode: %s", error_buffer); - } - // Retrieve the device file handler - _pcap_h = pcap_get_selectable_fd(_device); - if (_pcap_h == -1) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to get device handler"); - } - - // Setup filter - std::string filter = ""; - std::string mac_src; - it = _params.find(params::mac_src); - if (it != _params.end()) { // Use online capture - mac_src = it->second; - } else { - // Detect MAC address of NIC - struct ifreq ifr; - memset(&ifr, 0, sizeof(ifr)); - nic.copy(ifr.ifr_name, sizeof(ifr.ifr_name)); - if (ioctl(_pcap_h, SIOCGIFHWADDR, &ifr) == -1) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to get device MAC address"); - } else { - char buf[13]; - *_bin2hex(buf, sizeof(buf), ifr.ifr_hwaddr.sa_data, 6) = 0; - mac_src = buf; - loggers::get_instance().user("pcap_layer::pcap_layer: local MAC is %s", mac_src.c_str()); - _params[params::mac_src] = mac_src; - } - } - - // Accept ITS broadcasted messages - std::string mac_bc; - it = _params.find(params::mac_bc); - if (it != _params.end() && !it->second.empty()) { - mac_bc = it->second; - } else { - mac_bc = "ffffffffffff"; - } - - if ((mac_bc == mac_src) || mac_src.empty()) { - filter = "ether dst " + mac_bc; - } else { - filter = "( ether dst " + mac_bc + " or ether dst " + mac_src + " )"; - } - - if (!mac_src.empty()) { - // Reject ITS messages sent by this component - filter += " and not ether src " + mac_src; - } - - // Add user defined filter - it = _params.find(params::filter); - if ((it != _params.end()) && !it->second.empty()) { - filter += std::string(" ") + it->second; - } - // Log final PCAP filter - loggers::get_instance().user("pcap_layer::pcap_layer: Filter: %s", filter.c_str()); - - { - struct bpf_program f = {0}; - if (pcap_compile(_device, &f, filter.c_str(), 1, PCAP_NETMASK_UNKNOWN) != 0) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to compile PCAP filter"); - } else { - if (pcap_setfilter(_device, &f) != 0) { - loggers::get_instance().error("pcap_layer::pcap_layer: Failed to set PCAP filter"); - } - } - pcap_freecode(&f); - } - - // Pass the device file handler to the polling procedure - Handler_Add_Fd_Read(_pcap_h); -} // End of ctor - -pcap_layer::~pcap_layer() { - loggers::get_instance().log(">>> pcap_layer::~pcap_layer"); - - if (_device != NULL) { - pcap_close(_device); - } -} // End of dtor - -void pcap_layer::send_data(OCTETSTRING &data, params ¶ms) { - loggers::get_instance().log_msg(">>> pcap_layer::send_data: ", data); - - if (pcap_sendpacket(_device, static_cast(data), data.lengthof()) == -1) { - loggers::get_instance().error("pcap_layer::send_data: Failed to send packet: %s", pcap_geterr(_device)); - } -} - -void pcap_layer::receive_data(OCTETSTRING &data, params ¶ms) { - loggers::get_instance().log(">>> pcap_layer::receive_data: Received %d bytes", data.lengthof()); - loggers::get_instance().log_to_hexa("Packet dump", data); - - // Pass the packet to the upper layers - receive_to_all_layers(data, params); -} - -void pcap_layer::Handle_Fd_Event_Readable(int fd) { - // loggers::get_instance().log(">>> pcap_layer::Handle_Fd_Event_Readable: %d", fd); - - pcap_pkthdr * pkt_header; - const u_char *pkt_data; - int result = pcap_next_ex(_device, &pkt_header, &pkt_data); - if (result == 1) { // Succeed - if (pkt_header->caplen > 14) { // Reject too small packet - loggers::get_instance().log("pcap_layer::Handle_Fd_Event_Readable: %ld - %ld - %ld - %d", pkt_header->ts.tv_sec, pkt_header->ts.tv_usec, - pkt_header->ts.tv_sec * 1000 + static_cast(pkt_header->ts.tv_usec / 1000), pkt_header->len); - // Fill parameters from PCAP layer - params params; - params.insert(std::pair( - params::timestamp, std::to_string(pkt_header->ts.tv_sec * 1000 + static_cast(pkt_header->ts.tv_usec / 1000)))); // Use milliseconds - // Process the packet at this layer - OCTETSTRING os(pkt_header->caplen, pkt_data); - // loggers::get_instance().log_to_hexa("pcap_layer::Handle_Fd_Event_Readable: ", os); - // TODO Case of caplen != len !!! - float duration; - loggers::get_instance().set_start_time(_time_key); - this->receive_data(os, params); // TODO Check execution time for decoding operation - loggers::get_instance().set_stop_time(_time_key, duration); - } - } // else, skip the packet -} - -pcap_layer_factory pcap_layer_factory::_f; - -#endif // !CYGWIN diff --git a/ccsrc/Protocols/Pcap/pcap_linux_layer.hh b/ccsrc/Protocols/Pcap/pcap_linux_layer.hh deleted file mode 100644 index 82efc4b..0000000 --- a/ccsrc/Protocols/Pcap/pcap_linux_layer.hh +++ /dev/null @@ -1,62 +0,0 @@ -/*! - * \file pcap_layer.hh - * \brief Header file for ITS Pcap port layer. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include - -#include "params.hh" -#include "t_layer.hh" - -class PORT; //! Forward declaration of TITAN class - -/*! - * \class pcap_layer - * \brief This class provides description of ITS PCAP port protocol layer - */ -class pcap_layer : public layer, public PORT { - params _params; //! Layer parameters - pcap_t * _device; //! Device handle - int _pcap_h; //! PCAP instance handle - pcap_dumper_t *_sent_file; //! Write file handle to save sent packet, used in file mode - std::string _time_key; //! \todo - -public: //! \publicsection - /*! - * \brief Specialised constructor - * Create a new instance of the pcap_layer class - * \param[in] p_type \todo - * \param[in] p_param \todo - */ - pcap_layer(const std::string &p_type, const std::string ¶m); - /*! - * \brief Default destructor - */ - virtual ~pcap_layer(); - - /*! - * \virtual - * \fn void send_data(OCTETSTRING& data, params& params); - * \brief Send bytes formated data to the lower layers - * \param[in] p_data The data to be sent - * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters - */ - virtual void send_data(OCTETSTRING &data, params ¶ms); - /*! - * \virtual - * \fn void receive_data(OCTETSTRING& data, params& params); - * \brief Receive bytes formated data from the lower layers - * \param[in] p_data The bytes formated data received - * \param[in] p_params Some lower layers parameters values when data was received - */ - virtual void receive_data(OCTETSTRING &data, params &info); - - void Handle_Fd_Event_Readable(int fd); -}; diff --git a/ccsrc/Protocols/Pcap/pcap_offline_layer.cc b/ccsrc/Protocols/Pcap/pcap_offline_layer.cc deleted file mode 100644 index d8afc3a..0000000 --- a/ccsrc/Protocols/Pcap/pcap_offline_layer.cc +++ /dev/null @@ -1,227 +0,0 @@ -#if defined(__CYGWIN__) -#define _GNU_SOURCE -#endif -#include -#include -#include -#include -#include - -#include - -#include "pcap_offline_layer_factory.hh" - -#include "loggers.hh" - -#include - -#ifdef __CYGWIN__ -typedef struct { - bpf_int32 tv_sec; /* seconds */ - bpf_int32 tv_usec; /* microseconds */ -} pcap_o_timeval; - -typedef struct pcap_o_pkthdr { - pcap_o_timeval ts; /* time stamp */ - bpf_u_int32 caplen; /* length of portion present */ - bpf_u_int32 len; /* length this packet (off wire) */ -} pcap_o_pkthdr; -#else -typedef struct pcap_pkthdr pcap_o_pkthdr; -typedef struct timeval pcap_o_timeval; -#endif - -pcap_offline_layer::pcap_offline_layer(const std::string &p_type, const std::string ¶m) - : layer(p_type), PORT(p_type.c_str()), _params(), _device(NULL), _running(FALSE), _time_key("pcap_offline_layer::Handle_Fd_Event_Readable") { - loggers::get_instance().log(">>> pcap_offline_layer::pcap_offline_layer: %s, %s", p_type.c_str(), param.c_str()); - params::convert(_params, param); - - _o_params.insert(std::pair(std::string("timestamp"), std::string())); - - char error_buffer[PCAP_ERRBUF_SIZE]; - params::const_iterator it; - - it = _params.find(std::string("realtime")); - _realtime = ((it != _params.end()) && !it->second.empty()); - - it = _params.find(std::string("loop")); - _loop = ((it != _params.end()) && !it->second.empty()); - - it = _params.find(std::string("file")); - if ((it != _params.end()) && !it->second.empty()) { - const std::string &file = it->second; - _device = pcap_open_offline(file.c_str(), error_buffer); - if (_device) { - - // Add user defined filter - it = _params.find(params::filter); - if ((it != _params.end()) && !it->second.empty()) { - const std::string &filter = it->second; - // Log final PCAP filter - loggers::get_instance().user("pcap_offline_layer::pcap_offline_layer: Filter: %s", filter.c_str()); - struct bpf_program f = {0}; - if (pcap_compile(_device, &f, filter.c_str(), 1, PCAP_NETMASK_UNKNOWN) != 0) { - loggers::get_instance().error("pcap_offline_layer::pcap_offline_layer: Failed to compile PCAP filter"); - } else { - if (pcap_setfilter(_device, &f) != 0) { - loggers::get_instance().error("pcap_offline_layer::pcap_offline_layer: Failed to set PCAP filter"); - } - } - pcap_freecode(&f); - } - - // create pipe and run thread - if (pipe2(_fd, O_NONBLOCK) == -1) { - loggers::get_instance().error("pcap_offline_layer::pcap_offline_layer: Failed to create a pipe: %s", ::strerror(errno)); - } - // Pass the pipe handler to the polling procedure - loggers::get_instance().log("pcap_offline_layer::pcap_offline_layer: Call handler with descriptor %d", _fd[0]); - Handler_Add_Fd_Read(_fd[0]); - // Create the offline reader thread - _thread = new std::thread(&pcap_offline_layer::run, (void *)this); - if (_thread == NULL) { - loggers::get_instance().error("pcap_offline_layer::pcap_offline_layer: Failed to start offline thread"); - } - while (_running == FALSE) { - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - } - // Thread was started - loggers::get_instance().log("<<< pcap_offline_layer::pcap_offline_layer"); - } - } -} // End of ctor - -pcap_offline_layer::~pcap_offline_layer() { - loggers::get_instance().log(">>> pcap_offline_layer::~pcap_offline_layer"); - - if (_device != NULL) { - if (_thread != NULL) { - _running = FALSE; - // Wait for the working thread to terminate - _thread->join(); - loggers::get_instance().log("pcap_offline_layer::~pcap_offline_layer: Thread were stops"); - // Cleanup - delete _thread; - close(_fd[0]); - close(_fd[1]); - } - pcap_close(_device); - } -} // End of dtor - -void *pcap_offline_layer::run(void *p_this) { - pcap_offline_layer &p = *static_cast(p_this); - return p.thread(); -} - -static long timeval_diff(const pcap_o_timeval &x, const pcap_o_timeval &y) { - pcap_o_timeval z = y; - /* Perform the carry for the later subtraction by updating y. */ - if (x.tv_usec < y.tv_usec) { - int nsec = (y.tv_usec - x.tv_usec) / 1000000 + 1; - z.tv_usec -= 1000000 * nsec; - z.tv_sec += nsec; - } - if (x.tv_usec - z.tv_usec > 1000000) { - int nsec = (x.tv_usec - z.tv_usec) / 1000000; - z.tv_usec += 1000000 * nsec; - z.tv_sec -= nsec; - } - - return (x.tv_sec - z.tv_sec) * 1000 + ((x.tv_usec - z.tv_usec) / 1000); -} - -void *pcap_offline_layer::thread() { - pcap_o_pkthdr *pkt_header; - pcap_o_pkthdr lh; - const u_char * pkt_data; - unsigned char pkt_count = 0; - - // loggers::get_instance().log(">>> pcap_offline_layer::run"); - - memset(&lh, 0, sizeof(lh)); - - _running = TRUE; - - int delay = 1000; - params::const_iterator it; - it = _params.find(std::string("delay")); - if (it != _params.cend()) { - delay = std::stoi(it->second); - } - - // wait a bit before sending first packet - std::this_thread::sleep_for(std::chrono::milliseconds(delay)); - - while (_running) { // Loop while _running flag is up - // get next frame - int result = pcap_next_ex(_device, (struct pcap_pkthdr **)&pkt_header, &pkt_data); - if (result == 2) { - if (_loop) { - - } else { - _running = FALSE; - return NULL; - } - } - if (_realtime) { - // wait for next packet timestamp - if (lh.ts.tv_sec | lh.ts.tv_usec) { - long diff = timeval_diff(pkt_header->ts, lh.ts); - if (diff > 0) { - loggers::get_instance().log("<<< pcap_offline_layer::run: Wait %d msec", diff); - std::this_thread::sleep_for(std::chrono::milliseconds(diff)); - loggers::get_instance().log("<<< pcap_offline_layer::run: Wait done"); - } - } - } - while (_running && !_resume.try_lock()) { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - lh = *pkt_header; -#if 0 - { - char buf[128]; - std::time_t t = pkt_header->ts.tv_sec; - std::tm * pt = std::localtime( &t ); - t = std::strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", pt); - std::sprintf(buf+t, ".%06ld", pkt_header->ts.tv_usec); - _o_params["timestamp"] = std::string(buf); - } -#else - _o_params["timestamp"] = std::to_string(pkt_header->ts.tv_usec); -#endif - _o_data = OCTETSTRING(pkt_header->len, pkt_data); - write(_fd[1], &pkt_count, 1); - pkt_count++; - } - - // loggers::get_instance().log("<<< pcap_offline_layer::run"); - return NULL; -} - -void pcap_offline_layer::send_data(OCTETSTRING &data, params ¶ms) { - loggers::get_instance().log("pcap_offline_layer::send_data: Offline mode, operation was skipped"); -} - -void pcap_offline_layer::receive_data(OCTETSTRING &data, params ¶ms) { - loggers::get_instance().log(">>> pcap_offline_layer::receive_data: Received %d bytes", data.lengthof()); - loggers::get_instance().log_to_hexa("Packet dump", data); - - // Pass the packet to the upper layers - receive_to_all_layers(data, params); -} - -void pcap_offline_layer::Handle_Fd_Event_Readable(int fd) { - // loggers::get_instance().log(">>> pcap_offline_layer::Handle_Fd_Event_Readable: %d", fd); - char c[2]; - float duration; - // Process the packet at this layer - loggers::get_instance().set_start_time(_time_key); - this->receive_data(_o_data, _o_params); - loggers::get_instance().set_stop_time(_time_key, duration); - read(_fd[0], &c, 1); - _resume.unlock(); -} - -pcap_offline_layer_factory pcap_offline_layer_factory::_f; diff --git a/ccsrc/Protocols/Pcap/pcap_offline_layer.hh b/ccsrc/Protocols/Pcap/pcap_offline_layer.hh deleted file mode 100644 index 0c1993e..0000000 --- a/ccsrc/Protocols/Pcap/pcap_offline_layer.hh +++ /dev/null @@ -1,80 +0,0 @@ -/*! - * \file pcap_offline_layer.hh - * \brief Header file for ITS Offline Pcap port layer. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include -#include - -#include "params.hh" -#include "t_layer.hh" - -#include - -class PORT; //! Forward declaration of TITAN class - -typedef struct pcap pcap_t; - -/*! - * \class pcap_layer - * \brief This class provides description of ITS PCAP port protocol layer - */ -class pcap_offline_layer : public layer, public PORT { - params _params; //! Layer parameters - pcap_t * _device; //! Device handle - std::thread *_thread; //! Thread handle, used to read PCAP file instead of NIC, used in file mode - std::mutex _resume; - bool _running; //! Set to true when the thread is running, used in file mode - bool _realtime; //! Set to true if realtime delay shall be added between packets - bool _loop; //! Set to true if playback shall be looped - int _fd[2]; //! pipe to signal to Titan - - params _o_params; - OCTETSTRING _o_data; - - std::string _time_key; - - static void *run(void *p_this); - -public: - void *thread(void); - -public: //! \publicsection - /*! - * \brief Specialised constructor - * Create a new instance of the pcap_layer class - * \param[in] p_type \todo - * \param[in] p_param \todo - */ - pcap_offline_layer(const std::string &p_type, const std::string ¶m); - /*! - * \brief Default destructor - */ - virtual ~pcap_offline_layer(); - - /*! - * \virtual - * \fn void send_data(OCTETSTRING& data, params& params); - * \brief Send bytes formated data to the lower layers - * \param[in] p_data The data to be sent - * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters - */ - virtual void send_data(OCTETSTRING &data, params ¶ms); - /*! - * \virtual - * \fn void receive_data(OCTETSTRING& data, params& params); - * \brief Receive bytes formated data from the lower layers - * \param[in] p_data The bytes formated data received - * \param[in] p_params Some lower layers parameters values when data was received - */ - virtual void receive_data(OCTETSTRING &data, params &info); - - void Handle_Fd_Event_Readable(int fd); -}; diff --git a/ccsrc/Protocols/Pcap/pcap_offline_layer_factory.hh b/ccsrc/Protocols/Pcap/pcap_offline_layer_factory.hh deleted file mode 100644 index 23cd1d0..0000000 --- a/ccsrc/Protocols/Pcap/pcap_offline_layer_factory.hh +++ /dev/null @@ -1,42 +0,0 @@ -/*! - * \file pcap_offline_layer_factory.hh - * \brief Header file for Pcap layer factory. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include "layer_stack_builder.hh" - -#include "pcap_offline_layer.hh" - -/*! - * \class pcap_offline_layer_factory - * \brief This class provides a factory class to create an pcap_offline_layer class instance - */ -class pcap_offline_layer_factory : public layer_factory { - static pcap_offline_layer_factory _f; //! Reference to the unique instance of this class -public: //! \publicsection - /*! - * \brief Default constructor - * Create a new instance of the udp_layer_factory class - * \remark The PCAP layer identifier is PCAP - */ - pcap_offline_layer_factory() { - // register factory - layer_stack_builder::register_layer_factory("PCAP_FILE", this); - }; - /*! - * \fn layer* create_layer(const std::string & type, const std::string & param); - * \brief Create the layers stack based on the provided layers stack description - * \param[in] p_type The provided layers stack description - * \param[in] p_params Optional parameters - * \return 0 on success, -1 otherwise - * \inline - */ - inline virtual layer *create_layer(const std::string &p_type, const std::string &p_param) { return new pcap_offline_layer(p_type, p_param); }; -}; // End of class pcap_offline_layer_factory diff --git a/ccsrc/Protocols/Pki/etsi_ts102941_trust_lists_ctl_format.cc b/ccsrc/Protocols/Pki/etsi_ts102941_trust_lists_ctl_format.cc index 1a9819e..f0c8804 100644 --- a/ccsrc/Protocols/Pki/etsi_ts102941_trust_lists_ctl_format.cc +++ b/ccsrc/Protocols/Pki/etsi_ts102941_trust_lists_ctl_format.cc @@ -16,7 +16,7 @@ int etsi_ts102941_trust_lists_ctl_format::encode(const EtsiTs102941TrustLists::C } int etsi_ts102941_trust_lists_ctl_format::decode(const OCTETSTRING &p_data, EtsiTs102941TrustLists::CtlFormat &p_ctl_format, - params *p_params) { + params_its *p_params) { loggers::get_instance().log_msg(">>> etsi_ts102941_trust_lists_ctl_format::decode: ", p_data); TTCN_EncDec::clear_error(); diff --git a/ccsrc/Protocols/Pki/etsi_ts102941_trust_lists_ctl_format.hh b/ccsrc/Protocols/Pki/etsi_ts102941_trust_lists_ctl_format.hh index bce246e..1f84d9c 100644 --- a/ccsrc/Protocols/Pki/etsi_ts102941_trust_lists_ctl_format.hh +++ b/ccsrc/Protocols/Pki/etsi_ts102941_trust_lists_ctl_format.hh @@ -1,7 +1,7 @@ #pragma once #include "codec.hh" -#include "params.hh" +#include "params_its.hh" #include "EtsiTs102941TrustLists.hh" @@ -11,5 +11,5 @@ public: virtual ~etsi_ts102941_trust_lists_ctl_format(){}; virtual int encode(const EtsiTs102941TrustLists::CtlFormat &p_ctl_format, OCTETSTRING &p_data); - virtual int decode(const OCTETSTRING &p_data, EtsiTs102941TrustLists::CtlFormat &p_ctl_format, params *p_params = NULL); + virtual int decode(const OCTETSTRING &p_data, EtsiTs102941TrustLists::CtlFormat &p_ctl_format, params_its *p_params = NULL); }; // End of class etsi_ts102941_trust_lists_ctl_format diff --git a/ccsrc/Protocols/Qualcomm/qualcomm_layer.cc b/ccsrc/Protocols/Qualcomm/qualcomm_layer.cc index b9f19b4..d0e50e8 100644 --- a/ccsrc/Protocols/Qualcomm/qualcomm_layer.cc +++ b/ccsrc/Protocols/Qualcomm/qualcomm_layer.cc @@ -22,7 +22,7 @@ qualcomm_layer::qualcomm_layer(const std::string &p_type, const std::string &par registration::get_instance().add_item(p_type, this); } -void qualcomm_layer::send_data(OCTETSTRING &data, params ¶ms) { +void qualcomm_layer::send_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> qualcomm_layer::send_data: ", data); OCTETSTRING buffer = int2oct(3, 1); // CV2X identifier @@ -32,7 +32,7 @@ void qualcomm_layer::send_data(OCTETSTRING &data, params ¶ms) { send_to_all_layers(buffer, params); } -void qualcomm_layer::receive_data(OCTETSTRING &data, params ¶ms) { +void qualcomm_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log(">>> qualcomm_layer::receive_data: Received %d bytes", data.lengthof()); loggers::get_instance().log_to_hexa("Packet dump", data); diff --git a/ccsrc/Protocols/Qualcomm/qualcomm_layer.hh b/ccsrc/Protocols/Qualcomm/qualcomm_layer.hh index f33d75c..326e9b7 100644 --- a/ccsrc/Protocols/Qualcomm/qualcomm_layer.hh +++ b/ccsrc/Protocols/Qualcomm/qualcomm_layer.hh @@ -10,7 +10,7 @@ */ #pragma once -#include "params.hh" +#include "params_its.hh" #include "t_layer.hh" #include "data_event_observer.hh" @@ -23,7 +23,7 @@ class OCTETSTRING; //! Forward declaration of TITAN class */ class qualcomm_layer : public layer, public data_event_observer { - params _params; //! Layer parameters + params_its _params; //! Layer parameters public: //! \publicsection @@ -40,8 +40,8 @@ public: */ virtual ~qualcomm_layer(){}; - virtual void send_data(OCTETSTRING &data, params ¶ms); - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void send_data(OCTETSTRING &data, params_its ¶ms); + virtual void receive_data(OCTETSTRING &data, params_its &info); inline void incoming_packet_observer_attach(data_event_notifier* p_observer) { _observers.push_back(p_observer); @@ -51,7 +51,8 @@ public: _observers.erase(std::remove(_observers.begin(), _observers.end(), p_observer), _observers.end()); }; - inline void incoming_packet_notify(OCTETSTRING &p_data, params &p_params) { + inline void incoming_packet_notify(OCTETSTRING &p_data, params_its + &p_params) { for (auto o : _observers) { o->update(p_data, p_params); } diff --git a/ccsrc/Protocols/Rtcmem/RtcmemCodec.cc b/ccsrc/Protocols/Rtcmem/RtcmemCodec.cc index 0f45e45..c2cf5f3 100644 --- a/ccsrc/Protocols/Rtcmem/RtcmemCodec.cc +++ b/ccsrc/Protocols/Rtcmem/RtcmemCodec.cc @@ -15,7 +15,7 @@ int RtcmemCodec::encode(const RTCMEM__PDU__Descriptions::RTCMEM &rtcmem, OCTETST return rc; } -int RtcmemCodec::decode(const OCTETSTRING &data, RTCMEM__PDU__Descriptions::RTCMEM &p_rtcmem, params *params) { +int RtcmemCodec::decode(const OCTETSTRING &data, RTCMEM__PDU__Descriptions::RTCMEM &p_rtcmem, params_its *params) { loggers::get_instance().log_msg(">>> RtcmemCodec::decode: ", data); int rc = asn_codec.decode(oct2bit(data), p_rtcmem); diff --git a/ccsrc/Protocols/Rtcmem/RtcmemCodec.hh b/ccsrc/Protocols/Rtcmem/RtcmemCodec.hh index f08bd11..c647e35 100644 --- a/ccsrc/Protocols/Rtcmem/RtcmemCodec.hh +++ b/ccsrc/Protocols/Rtcmem/RtcmemCodec.hh @@ -2,7 +2,7 @@ #define RTCMEMCODEC_H #include "codec.hh" -#include "params.hh" +#include "params_its.hh" #include "per_codec.hh" #include "LibItsRtcmem_TypesAndValues.hh" @@ -22,7 +22,7 @@ public: virtual ~RtcmemCodec(){}; virtual int encode(const RTCMEM__PDU__Descriptions::RTCMEM &srem, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, RTCMEM__PDU__Descriptions::RTCMEM &, params *params = NULL); + virtual int decode(const OCTETSTRING &data, RTCMEM__PDU__Descriptions::RTCMEM &, params_its *params = NULL); }; #endif diff --git a/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.cc b/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.cc index 0ccc009..b74b030 100644 --- a/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.cc +++ b/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.cc @@ -13,7 +13,7 @@ RtcmemLayer::RtcmemLayer(const std::string &p_type, const std::string ¶m) : t_layer(p_type), _params(), _rtcmem_codec() { loggers::get_instance().log(">>> RtcmemLayer::RtcmemLayer: %s, %s", to_string().c_str(), param.c_str()); // Setup parameters - params::convert(_params, param); + params_its::convert(_params, param); _params.insert(std::make_pair("its_aid", "128")); // ETSI TS 102 965 V1.2.1 (2015-06) _params.insert(std::make_pair("payload_type", "13")); // RTCME message id - See ETSI TS 103 301 @@ -22,7 +22,7 @@ RtcmemLayer::RtcmemLayer(const std::string &p_type, const std::string ¶m) registration::get_instance().add_item(p_type, this); } -void RtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::RtcmemReq &p, params ¶ms) { +void RtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::RtcmemReq &p, params_its ¶ms) { loggers::get_instance().log_msg(">>> RtcmemLayer::sendMsg: ", p); // Encode rtcmem PDU @@ -34,12 +34,12 @@ void RtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::RtcmemReq &p, para send_data(data, _params); } -void RtcmemLayer::send_data(OCTETSTRING &data, params ¶ms) { +void RtcmemLayer::send_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> RtcmemLayer::send_data: ", data); send_to_all_layers(data, params); } -void RtcmemLayer::receive_data(OCTETSTRING &data, params ¶ms) { +void RtcmemLayer::receive_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> RtcmemLayer::receive_data: ", data); // Decode the RTCMEM payload @@ -52,63 +52,63 @@ void RtcmemLayer::receive_data(OCTETSTRING &data, params ¶ms) { // Process lower layer data // recvTime - params::const_iterator it = params.find(params::timestamp); + params_its::const_iterator it = params.find(params_its::timestamp); if (it != params.cend()) { p.recvTime().set_long_long_val(std::stoll(it->second)); } else { p.recvTime().set_to_omit(); } // gnNextHeader - it = params.find(params::gn_next_header); + it = params.find(params_its::gn_next_header); if (it != params.cend()) { p.gnNextHeader() = std::stoi(it->second); } else { p.gnNextHeader().set_to_omit(); } // gnHeaderType - it = params.find(params::gn_header_type); + it = params.find(params_its::gn_header_type); if (it != params.cend()) { p.gnHeaderType() = std::stoi(it->second); } else { p.gnHeaderType().set_to_omit(); } // gnHeaderSubtype - it = params.find(params::gn_header_sub_type); + it = params.find(params_its::gn_header_sub_type); if (it != params.cend()) { p.gnHeaderSubtype() = std::stoi(it->second); } else { p.gnHeaderSubtype().set_to_omit(); } // gnLifetime - it = params.find(params::gn_lifetime); + it = params.find(params_its::gn_lifetime); if (it != params.cend()) { p.gnLifetime() = std::stoi(it->second); } else { p.gnLifetime().set_to_omit(); } // gnTrafficClass - it = params.find(params::gn_traffic_class); + it = params.find(params_its::gn_traffic_class); if (it != params.cend()) { p.gnTrafficClass() = std::stoi(it->second); } else { p.gnTrafficClass().set_to_omit(); } // btpDestinationPort - it = params.find(params::btp_destination_port); + it = params.find(params_its::btp_destination_port); if (it != params.cend()) { p.btpDestinationPort() = std::stoi(it->second); } else { p.btpDestinationPort().set_to_omit(); } // btpInfo - it = params.find(params::btp_info); + it = params.find(params_its::btp_info); if (it != params.cend()) { p.btpInfo() = std::stoi(it->second); } else { p.btpInfo().set_to_omit(); } // ssp - it = params.find(params::ssp); + it = params.find(params_its::ssp); if (it != params.cend()) { loggers::get_instance().log("RtcmemLayer::receive_data: ssp=%s", it->second.c_str()); p.ssp() = oct2bit(str2oct(CHARSTRING(it->second.c_str()))); @@ -116,7 +116,7 @@ void RtcmemLayer::receive_data(OCTETSTRING &data, params ¶ms) { p.ssp().set_to_omit(); } // its_aid - it = params.find(params::its_aid); + it = params.find(params_its::its_aid); if (it != params.cend()) { p.its__aid() = std::stoi(it->second); } else { diff --git a/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.hh b/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.hh index 87fc6bd..e48da06 100644 --- a/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.hh +++ b/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.hh @@ -20,7 +20,7 @@ namespace LibItsRtcmem__TestSystem { } // namespace LibItsRtcmem__TestSystem class RtcmemLayer : public t_layer { - params _params; + params_its _params; RtcmemCodec _rtcmem_codec; public: @@ -28,10 +28,10 @@ public: RtcmemLayer(const std::string &p_type, const std::string ¶m); virtual ~RtcmemLayer(){}; - void sendMsg(const LibItsRtcmem__TypesAndValues::RtcmemReq &, params ¶ms); + void sendMsg(const LibItsRtcmem__TypesAndValues::RtcmemReq &, params_its ¶ms); - virtual void send_data(OCTETSTRING &data, params ¶ms); - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void send_data(OCTETSTRING &data, params_its ¶ms); + virtual void receive_data(OCTETSTRING &data, params_its &info); int enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_base_types_public_keys.hh b/ccsrc/Protocols/Security/etsi_ts102941_base_types_public_keys.hh index 4719f18..d2d520b 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_base_types_public_keys.hh +++ b/ccsrc/Protocols/Security/etsi_ts102941_base_types_public_keys.hh @@ -1,13 +1,13 @@ #pragma once -#include "codec.hh" +#include "codec_gen.hh" #include "params.hh" #include "EtsiTs102941BaseTypes.hh" -class etsi_ts102941_base_types_public_keys : public codec { +class etsi_ts102941_base_types_public_keys : public codec_gen { public: - explicit etsi_ts102941_base_types_public_keys() : codec(){}; + explicit etsi_ts102941_base_types_public_keys() : codec_gen(){}; virtual ~etsi_ts102941_base_types_public_keys(){}; virtual int encode(const EtsiTs102941BaseTypes::PublicKeys &p_public_keys, OCTETSTRING &p_data); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_data_codec.hh b/ccsrc/Protocols/Security/etsi_ts102941_data_codec.hh index c2b31c6..029943d 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_data_codec.hh +++ b/ccsrc/Protocols/Security/etsi_ts102941_data_codec.hh @@ -1,13 +1,13 @@ #pragma once -#include "codec.hh" +#include "codec_gen.hh" #include "params.hh" #include "EtsiTs102941MessagesCa.hh" -class etsi_ts102941_data_codec : public codec { +class etsi_ts102941_data_codec : public codec_gen { public: - explicit etsi_ts102941_data_codec() : codec(){}; + explicit etsi_ts102941_data_codec() : codec_gen(){}; virtual ~etsi_ts102941_data_codec(){}; virtual int encode(const EtsiTs102941MessagesCa::EtsiTs102941Data &p_etsi_ts_10291_data, OCTETSTRING &p_data); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_data_content_codec.hh b/ccsrc/Protocols/Security/etsi_ts102941_data_content_codec.hh index db7005f..d3ee5bf 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_data_content_codec.hh +++ b/ccsrc/Protocols/Security/etsi_ts102941_data_content_codec.hh @@ -1,13 +1,13 @@ #pragma once -#include "codec.hh" +#include "codec_gen.hh" #include "params.hh" #include "EtsiTs102941MessagesCa.hh" -class etsi_ts102941_data_content_codec : public codec { +class etsi_ts102941_data_content_codec : public codec_gen { public: - explicit etsi_ts102941_data_content_codec() : codec(){}; + explicit etsi_ts102941_data_content_codec() : codec_gen(){}; virtual ~etsi_ts102941_data_content_codec(){}; virtual int encode(const EtsiTs102941MessagesCa::EtsiTs102941DataContent &p_etsi_ts_10291_data_content, OCTETSTRING &p_data); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_inner_request.hh b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_inner_request.hh index ae12a07..c6286f1 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_inner_request.hh +++ b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_inner_request.hh @@ -1,15 +1,15 @@ #pragma once -#include "codec.hh" +#include "codec_gen.hh" #include "params.hh" #include "EtsiTs102941TypesAuthorization.hh" class etsi_ts102941_types_authorization_inner_request - : public codec { + : public codec_gen { public: explicit etsi_ts102941_types_authorization_inner_request() - : codec(){}; + : codec_gen(){}; virtual ~etsi_ts102941_types_authorization_inner_request(){}; virtual int encode(const EtsiTs102941TypesAuthorization::InnerAtRequest &p_inner_request, OCTETSTRING &p_data); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_inner_response.hh b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_inner_response.hh index 2f0161f..de20830 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_inner_response.hh +++ b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_inner_response.hh @@ -1,15 +1,15 @@ #pragma once -#include "codec.hh" +#include "codec_gen.hh" #include "params.hh" #include "EtsiTs102941TypesAuthorization.hh" class etsi_ts102941_types_authorization_inner_response - : public codec { + : public codec_gen { public: explicit etsi_ts102941_types_authorization_inner_response() - : codec(){}; + : codec_gen(){}; virtual ~etsi_ts102941_types_authorization_inner_response(){}; virtual int encode(const EtsiTs102941TypesAuthorization::InnerAtResponse &p_inner_response, OCTETSTRING &p_data); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_shared_at_request.hh b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_shared_at_request.hh index 7e8dbad..526d951 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_shared_at_request.hh +++ b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_shared_at_request.hh @@ -1,15 +1,15 @@ #pragma once -#include "codec.hh" +#include "codec_gen.hh" #include "params.hh" #include "EtsiTs102941TypesAuthorization.hh" class etsi_ts102941_types_authorization_shared_at_request - : public codec { + : public codec_gen { public: explicit etsi_ts102941_types_authorization_shared_at_request() - : codec(){}; + : codec_gen(){}; virtual ~etsi_ts102941_types_authorization_shared_at_request(){}; virtual int encode(const EtsiTs102941TypesAuthorization::SharedAtRequest &p_shared_at_request, OCTETSTRING &p_data); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_request.hh b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_request.hh index 4f545d4..2fdf43c 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_request.hh +++ b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_request.hh @@ -1,15 +1,15 @@ #pragma once -#include "codec.hh" +#include "codec_gen.hh" #include "params.hh" #include "EtsiTs102941TypesAuthorizationValidation.hh" -class etsi_ts102941_types_authorization_validation_request : public codec { public: explicit etsi_ts102941_types_authorization_validation_request() - : codec(){}; virtual ~etsi_ts102941_types_authorization_validation_request(){}; diff --git a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_response.hh b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_response.hh index 27f387b..8208a2b 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_response.hh +++ b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_response.hh @@ -1,15 +1,15 @@ #pragma once -#include "codec.hh" +#include "codec_gen.hh" #include "params.hh" #include "EtsiTs102941TypesAuthorizationValidation.hh" -class etsi_ts102941_types_authorization_validation_response : public codec { public: explicit etsi_ts102941_types_authorization_validation_response() - : codec(){}; virtual ~etsi_ts102941_types_authorization_validation_response(){}; diff --git a/ccsrc/Protocols/Security/etsi_ts102941_types_enrolment_inner_request.hh b/ccsrc/Protocols/Security/etsi_ts102941_types_enrolment_inner_request.hh index 8fba3a6..aa082c2 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_types_enrolment_inner_request.hh +++ b/ccsrc/Protocols/Security/etsi_ts102941_types_enrolment_inner_request.hh @@ -1,13 +1,13 @@ #pragma once -#include "codec.hh" +#include "codec_gen.hh" #include "params.hh" #include "EtsiTs102941TypesEnrolment.hh" -class etsi_ts102941_types_enrolment_inner_request : public codec { +class etsi_ts102941_types_enrolment_inner_request : public codec_gen { public: - explicit etsi_ts102941_types_enrolment_inner_request() : codec(){}; + explicit etsi_ts102941_types_enrolment_inner_request() : codec_gen(){}; virtual ~etsi_ts102941_types_enrolment_inner_request(){}; virtual int encode(const EtsiTs102941TypesEnrolment::InnerEcRequest &p_inner_request, OCTETSTRING &p_data); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_types_enrolment_inner_response.hh b/ccsrc/Protocols/Security/etsi_ts102941_types_enrolment_inner_response.hh index b5e26b2..30403d0 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_types_enrolment_inner_response.hh +++ b/ccsrc/Protocols/Security/etsi_ts102941_types_enrolment_inner_response.hh @@ -1,13 +1,13 @@ #pragma once -#include "codec.hh" +#include "codec_gen.hh" #include "params.hh" #include "EtsiTs102941TypesEnrolment.hh" -class etsi_ts102941_types_enrolment_inner_response : public codec { +class etsi_ts102941_types_enrolment_inner_response : public codec_gen { public: - explicit etsi_ts102941_types_enrolment_inner_response() : codec(){}; + explicit etsi_ts102941_types_enrolment_inner_response() : codec_gen(){}; virtual ~etsi_ts102941_types_enrolment_inner_response(){}; virtual int encode(const EtsiTs102941TypesEnrolment::InnerEcResponse &p_inner_response, OCTETSTRING &p_data); diff --git a/ccsrc/Protocols/Security/etsi_ts103097_certificate_codec.hh b/ccsrc/Protocols/Security/etsi_ts103097_certificate_codec.hh index 707aa24..2721e49 100644 --- a/ccsrc/Protocols/Security/etsi_ts103097_certificate_codec.hh +++ b/ccsrc/Protocols/Security/etsi_ts103097_certificate_codec.hh @@ -1,7 +1,6 @@ #pragma once -#include "codec.hh" -//#include "oer_codec.hh" +#include "codec_gen.hh" #include "params.hh" #include "EtsiTs103097Module.hh" @@ -17,12 +16,12 @@ // virtual int decode (const BITSTRING& data, Ieee1609Dot2::CertificateBase&); // }; -class etsi_ts103097_certificate_codec : public codec { +class etsi_ts103097_certificate_codec : public codec_gen { // EtsiTs103097PDUCodec asn_codec; public: - // explicit etsi_ts103097_certificate_codec() : codec(), asn_codec() { }; - explicit etsi_ts103097_certificate_codec() : codec(){}; + // explicit etsi_ts103097_certificate_codec() : codec_gen(), asn_codec() { }; + explicit etsi_ts103097_certificate_codec() : codec_gen(){}; virtual ~etsi_ts103097_certificate_codec(){}; virtual int encode(const Ieee1609Dot2::CertificateBase &p_cert, OCTETSTRING &p_data); diff --git a/ccsrc/Protocols/Security/etsi_ts103097_data_codec.hh b/ccsrc/Protocols/Security/etsi_ts103097_data_codec.hh index f42e100..b3884d7 100644 --- a/ccsrc/Protocols/Security/etsi_ts103097_data_codec.hh +++ b/ccsrc/Protocols/Security/etsi_ts103097_data_codec.hh @@ -1,6 +1,6 @@ #pragma once -#include "codec.hh" +#include "codec_gen.hh" //#include "CodecOer.hh" #include "params.hh" @@ -17,12 +17,12 @@ // virtual int decode (const BITSTRING& data, Ieee1609Dot2::Ieee1609Dot2Data&); // }; -class etsi_ts103097_data_codec : public codec { +class etsi_ts103097_data_codec : public codec_gen { // EtsiTs103097PDUCodec asn_codec; public: - // explicit etsi_ts103097_data_codec() : codec(), asn_codec() { }; - explicit etsi_ts103097_data_codec() : codec(){}; + // explicit etsi_ts103097_data_codec() : codec_gen(), asn_codec() { }; + explicit etsi_ts103097_data_codec() : codec_gen(){}; virtual ~etsi_ts103097_data_codec(){}; virtual int encode(const Ieee1609Dot2::Ieee1609Dot2Data &p_ieee1609Dot2Data, OCTETSTRING &p_data); diff --git a/ccsrc/Protocols/Security/etsi_ts103097_tobesigned_certificate_codec.hh b/ccsrc/Protocols/Security/etsi_ts103097_tobesigned_certificate_codec.hh index 7d93849..2b4d322 100644 --- a/ccsrc/Protocols/Security/etsi_ts103097_tobesigned_certificate_codec.hh +++ b/ccsrc/Protocols/Security/etsi_ts103097_tobesigned_certificate_codec.hh @@ -1,6 +1,6 @@ #pragma once -#include "codec.hh" +#include "codec_gen.hh" //#include "CodecOer.hh" #include "params.hh" @@ -17,12 +17,12 @@ // virtual int decode (const BITSTRING& data, Ieee1609Dot2::ToBeSignedCertificate&); // }; -class etsi_ts103097_tobesigned_certificate_codec : public codec { +class etsi_ts103097_tobesigned_certificate_codec : public codec_gen { // EtsiTs103097PDUCodec asn_codec; public: - // explicit etsi_ts103097_tobesigned_certificate_codec() : codec(), asn_codec() { }; - explicit etsi_ts103097_tobesigned_certificate_codec() : codec(){}; + // explicit etsi_ts103097_tobesigned_certificate_codec() : codec_gen(), asn_codec() { }; + explicit etsi_ts103097_tobesigned_certificate_codec() : codec_gen(){}; virtual ~etsi_ts103097_tobesigned_certificate_codec(){}; virtual int encode(const Ieee1609Dot2::ToBeSignedCertificate &p_cert, OCTETSTRING &p_data); diff --git a/ccsrc/Protocols/Security/etsi_ts103097_tobesigned_data_codec.hh b/ccsrc/Protocols/Security/etsi_ts103097_tobesigned_data_codec.hh index 6e0b4a8..5ff7e77 100644 --- a/ccsrc/Protocols/Security/etsi_ts103097_tobesigned_data_codec.hh +++ b/ccsrc/Protocols/Security/etsi_ts103097_tobesigned_data_codec.hh @@ -1,6 +1,6 @@ #pragma once -#include "codec.hh" +#include "codec_gen.hh" //#include "CodecOer.hh" #include "params.hh" @@ -17,12 +17,12 @@ // virtual int decode (const BITSTRING& data, Ieee1609Dot2::ToBeSignedData&); // }; -class etsi_ts103097_tobesigned_data_codec : public codec { +class etsi_ts103097_tobesigned_data_codec : public codec_gen { // EtsiTs103097PDUCodec asn_codec; public: - // explicit etsi_ts103097_tobesigned_data_codec() : codec(), asn_codec() { }; - explicit etsi_ts103097_tobesigned_data_codec() : codec(){}; + // explicit etsi_ts103097_tobesigned_data_codec() : codec_gen(), asn_codec() { }; + explicit etsi_ts103097_tobesigned_data_codec() : codec_gen(){}; virtual ~etsi_ts103097_tobesigned_data_codec(){}; virtual int encode(const Ieee1609Dot2::ToBeSignedData &p_cert, OCTETSTRING &p_data); diff --git a/ccsrc/Protocols/Security/http_etsi_ieee1609dot2_codec.cc b/ccsrc/Protocols/Security/http_etsi_ieee1609dot2_codec.cc index 2f4f4bb..18b95c2 100644 --- a/ccsrc/Protocols/Security/http_etsi_ieee1609dot2_codec.cc +++ b/ccsrc/Protocols/Security/http_etsi_ieee1609dot2_codec.cc @@ -2,7 +2,7 @@ #include "http_etsi_ieee1609dot2_codec_factory.hh" -#include "LibItsHttp_MessageBodyTypes.hh" +#include "LibHttp_MessageBodyTypes.hh" #include "security_services.hh" diff --git a/ccsrc/Protocols/Security/http_etsi_ieee1609dot2_codec.hh b/ccsrc/Protocols/Security/http_etsi_ieee1609dot2_codec.hh index 0056288..f78b216 100644 --- a/ccsrc/Protocols/Security/http_etsi_ieee1609dot2_codec.hh +++ b/ccsrc/Protocols/Security/http_etsi_ieee1609dot2_codec.hh @@ -5,16 +5,16 @@ #include "params.hh" -namespace LibItsHttp__BinaryMessageBodyTypes { +namespace LibHttp__BinaryMessageBodyTypes { class BinaryBody; } -class http_etsi_ieee1609dot2_codec : public codec { +class http_etsi_ieee1609dot2_codec : public codec_gen { etsi_ts103097_data_codec _codec; etsi_ts103097_certificate_codec _codec_cert; public: - explicit http_etsi_ieee1609dot2_codec() : codec(), _codec(), _codec_cert(){}; + explicit http_etsi_ieee1609dot2_codec() : codec_gen(), _codec(), _codec_cert(){}; virtual ~http_etsi_ieee1609dot2_codec(){}; virtual int encode(const Ieee1609Dot2::Ieee1609Dot2Data &p_ieee_1609dot2_data, OCTETSTRING &p_data); diff --git a/ccsrc/Protocols/Security/http_etsi_ieee1609dot2_codec_factory.hh b/ccsrc/Protocols/Security/http_etsi_ieee1609dot2_codec_factory.hh index 4ef4804..06aa11f 100644 --- a/ccsrc/Protocols/Security/http_etsi_ieee1609dot2_codec_factory.hh +++ b/ccsrc/Protocols/Security/http_etsi_ieee1609dot2_codec_factory.hh @@ -40,5 +40,5 @@ public: //! \publicsection * \return 0 on success, -1 otherwise * \inline */ - inline virtual codec *create_codec() { return (codec *)new http_etsi_ieee1609dot2_codec(); }; + inline virtual codec_gen *create_codec() { return (codec_gen *)new http_etsi_ieee1609dot2_codec(); }; }; // End of class http_etsi_ieee1609dot2_codec_factory diff --git a/ccsrc/Protocols/Security/ieee_1609dot2_base_types_public_encryption_key.hh b/ccsrc/Protocols/Security/ieee_1609dot2_base_types_public_encryption_key.hh index ee1bd5a..3deb7ca 100644 --- a/ccsrc/Protocols/Security/ieee_1609dot2_base_types_public_encryption_key.hh +++ b/ccsrc/Protocols/Security/ieee_1609dot2_base_types_public_encryption_key.hh @@ -1,13 +1,13 @@ #pragma once -#include "codec.hh" +#include "codec_gen.hh" #include "params.hh" #include "Ieee1609Dot2BaseTypes.hh" -class ieee_1609dot2_base_types_public_encryption_key : public codec { +class ieee_1609dot2_base_types_public_encryption_key : public codec_gen { public: - explicit ieee_1609dot2_base_types_public_encryption_key() : codec(){}; + explicit ieee_1609dot2_base_types_public_encryption_key() : codec_gen(){}; virtual ~ieee_1609dot2_base_types_public_encryption_key(){}; virtual int encode(const Ieee1609Dot2BaseTypes::PublicEncryptionKey &p_public_encryption_key, OCTETSTRING &p_data); diff --git a/ccsrc/Protocols/Security/ieee_1609dot2_base_types_public_verification_key.hh b/ccsrc/Protocols/Security/ieee_1609dot2_base_types_public_verification_key.hh index 809c9ca..8fdad8a 100644 --- a/ccsrc/Protocols/Security/ieee_1609dot2_base_types_public_verification_key.hh +++ b/ccsrc/Protocols/Security/ieee_1609dot2_base_types_public_verification_key.hh @@ -1,15 +1,15 @@ #pragma once -#include "codec.hh" +#include "codec_gen.hh" #include "params.hh" #include "Ieee1609Dot2BaseTypes.hh" class ieee_1609dot2_base_types_public_verification_key - : public codec { + : public codec_gen { public: explicit ieee_1609dot2_base_types_public_verification_key() - : codec(){}; + : codec_gen(){}; virtual ~ieee_1609dot2_base_types_public_verification_key(){}; virtual int encode(const Ieee1609Dot2BaseTypes::PublicVerificationKey &p_public_verification_key, OCTETSTRING &p_data); diff --git a/ccsrc/Protocols/Security/security_services.cc b/ccsrc/Protocols/Security/security_services.cc index 4587edb..438493d 100644 --- a/ccsrc/Protocols/Security/security_services.cc +++ b/ccsrc/Protocols/Security/security_services.cc @@ -32,7 +32,7 @@ security_services::security_services() } // End of ctor -int security_services::setup(params &p_params) { // FIXME Rename this method +int security_services::setup(params_its &p_params) { // FIXME Rename this method loggers::get_instance().log(">>> security_services::setup"); _params = p_params; _params.log(); @@ -44,7 +44,7 @@ int security_services::setup(params &p_params) { // FIXME Rename this method // Build the certificate caching try { - _security_db.reset(new security_db(_params[params::sec_db_path])); + _security_db.reset(new security_db(_params[params_its::sec_db_path])); if (_security_db.get() == nullptr) { // Memory allocation issue loggers::get_instance().warning("security_services::setup: _security_db pointer is NULL"); return -1; @@ -57,11 +57,11 @@ int security_services::setup(params &p_params) { // FIXME Rename this method } // Initialise encryption mechanism - params::const_iterator it = _params.find(params::cypher); + params_its::const_iterator it = _params.find(params_its::cypher); if (it == _params.cend()) { _ec_keys_enc.reset(new security_ecc(ec_elliptic_curves::nist_p_256)); - _params.insert(std::pair(params::cypher, std::string("NISTP-256"))); - p_params.insert(std::pair(params::cypher, std::string("NISTP-256"))); + _params.insert(std::pair(params_its::cypher, std::string("NISTP-256"))); + p_params.insert(std::pair(params_its::cypher, std::string("NISTP-256"))); } else if (it->second.compare("NISTP-256")) { _ec_keys_enc.reset(new security_ecc(ec_elliptic_curves::nist_p_256)); } else if (it->second.compare("BP-256")) { @@ -94,7 +94,7 @@ int security_services::store_certificate(const CHARSTRING &p_cert_id, const OCTE int security_services::verify_and_extract_gn_payload(const OCTETSTRING &p_secured_gn_payload, const bool p_verify, Ieee1609Dot2::Ieee1609Dot2Data &p_ieee_1609dot2_data, OCTETSTRING &p_unsecured_gn_payload, - params &p_params) { + params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::verify_and_extract_gn_payload: ", p_secured_gn_payload); // Sanity checks @@ -119,7 +119,7 @@ int security_services::verify_and_extract_gn_payload(const OCTETSTRING &p_secure } // End of method verify_and_extract_gn_payload int security_services::process_ieee_1609_dot2_content(const Ieee1609Dot2::Ieee1609Dot2Content &p_ieee_1609_dot2_content, const bool p_verify, - OCTETSTRING &p_unsecured_payload, params &p_params) { + OCTETSTRING &p_unsecured_payload, params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::process_ieee_1609_dot2_content: ", p_ieee_1609_dot2_content); if (p_ieee_1609_dot2_content.ischosen(Ieee1609Dot2::Ieee1609Dot2Content::ALT_unsecuredData)) { // Unsecured packet, End of recursivity @@ -161,12 +161,12 @@ int security_services::process_ieee_1609_dot2_content(const Ieee1609Dot2::Ieee16 } // End of method process_ieee_1609_dot2_content int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::SignedData &p_signed_data, const bool p_verify, OCTETSTRING &p_unsecured_payload, - params &p_params) { + params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::process_ieee_1609_dot2_signed_data: ", p_signed_data); // Check the headerInfo content const Ieee1609Dot2::HeaderInfo &header_info = p_signed_data.tbsData().headerInfo(); - p_params[params::its_aid] = std::to_string(header_info.psid().get_long_long_val()); + p_params[params_its::its_aid] = std::to_string(header_info.psid().get_long_long_val()); if (!header_info.generationTime().is_present()) { loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: HeaderInfo::GenerationTime field is missing"); if (p_verify) { @@ -311,7 +311,7 @@ int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::Si if (s.is_present()) { const Ieee1609Dot2BaseTypes::ServiceSpecificPermissions &ssp = static_cast(s); loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_signed_data: Processing ssp ", ssp); - params::const_iterator it = p_params.find(std::to_string(psid_ssp.psid())); + params_its::const_iterator it = p_params.find(std::to_string(psid_ssp.psid())); if (it == p_params.cend()) { OCTETSTRING os; if (ssp.ischosen(Ieee1609Dot2BaseTypes::ServiceSpecificPermissions::ALT_opaque)) { @@ -319,7 +319,7 @@ int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::Si } else { os = ssp.bitmapSsp(); } - p_params[params::ssp] = std::string(static_cast(oct2str(os))); + p_params[params_its::ssp] = std::string(static_cast(oct2str(os))); } } } // End of 'for' statement @@ -367,7 +367,7 @@ int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::Si } // End of method process_ieee_1609_dot2_signed_data int security_services::process_ieee_1609_dot2_encrypted_data(const Ieee1609Dot2::EncryptedData &p_encrypted_data, const bool p_verify, - OCTETSTRING &p_unsecured_payload, params &p_params) { + OCTETSTRING &p_unsecured_payload, params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::process_ieee_1609_dot2_encrypted_data: ", p_encrypted_data); // 1. Retrieve the RecipientId @@ -418,10 +418,10 @@ int security_services::process_ieee_1609_dot2_encrypted_data(const Ieee1609Dot2: loggers::get_instance().warning("security_services::process_ieee_1609_dot2_encrypted_data: RecipientId does not match HashedId8 of the symmetric key"); return -1; } else { - if (_security_db.get()->get_private_enc_key(p_params[params::certificate], p_enc_key) == -1) { + if (_security_db.get()->get_private_enc_key(p_params[params_its::certificate], p_enc_key) == -1) { loggers::get_instance().warning( "security_services::process_ieee_1609_dot2_encrypted_data: Failed to retrieve private encryption key for certificate %s", - p_params[params::certificate].c_str()); + p_params[params_its::certificate].c_str()); return -1; } } @@ -469,7 +469,7 @@ int security_services::process_ieee_1609_dot2_encrypted_data(const Ieee1609Dot2: return 0; } // End of method process_ieee_1609_dot2_encrypted_data -int security_services::secure_gn_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_secured_gn_payload, params &p_params) { +int security_services::secure_gn_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_secured_gn_payload, params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::secure_gn_payload: ", p_unsecured_gn_payload); p_params.log(); @@ -480,7 +480,7 @@ int security_services::secure_gn_payload(const OCTETSTRING &p_unsecured_gn_paylo return -1; } - if (_params[params::encrypted_mode].compare("1") == 0) { + if (_params[params_its::encrypted_mode].compare("1") == 0) { if (encrypt_gn_payload(signed_payload, p_secured_gn_payload, p_params) != 0) { p_secured_gn_payload = signed_payload; loggers::get_instance().warning("security_services::secure_gn_payload: Failed to encrypt payload"); @@ -494,7 +494,7 @@ int security_services::secure_gn_payload(const OCTETSTRING &p_unsecured_gn_paylo return 0; } -int security_services::sign_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_signed_gn_payload, params &p_params) { +int security_services::sign_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_signed_gn_payload, params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::sign_payload: ", p_unsecured_gn_payload); // Set unsecured data @@ -503,7 +503,7 @@ int security_services::sign_payload(const OCTETSTRING &p_unsecured_gn_payload, O Ieee1609Dot2::Ieee1609Dot2Data unsecured_data(ProtocolVersion, unsecured_data_content); // Set hash algorithm Ieee1609Dot2BaseTypes::HashAlgorithm hashId(Ieee1609Dot2BaseTypes::HashAlgorithm::sha256); - if (p_params[params::hash].compare("SHA-384") == 0) { + if (p_params[params_its::hash].compare("SHA-384") == 0) { hashId = Ieee1609Dot2BaseTypes::HashAlgorithm::sha384; } // Set SignedDataPayload @@ -512,15 +512,15 @@ int security_services::sign_payload(const OCTETSTRING &p_unsecured_gn_payload, O payload.extDataHash().set_to_omit(); Ieee1609Dot2::HeaderInfo header_info; // Set secured field according to the payload! - header_info.psid() = converter::get_instance().string_to_int(p_params[params::its_aid]); + header_info.psid() = converter::get_instance().string_to_int(p_params[params_its::its_aid]); header_info.expiryTime().set_to_omit(); // Force certificate? boolean force_certificate = false; - params::const_iterator it = p_params.find(params::force_certificate); + params_its::const_iterator it = p_params.find(params_its::force_certificate); if (it != p_params.cend()) { force_certificate = true; } - if (p_params[params::its_aid].compare("37") == 0) { // Only used by AtsRSUSimulator to add location header + if (p_params[params_its::its_aid].compare("37") == 0) { // Only used by AtsRSUSimulator to add location header // Mandatory for DENM payload OPTIONAL location(Ieee1609Dot2BaseTypes::ThreeDLocation(_latitude, _longitude, _elevation)); header_info.generationLocation() = location; @@ -530,13 +530,13 @@ int security_services::sign_payload(const OCTETSTRING &p_unsecured_gn_payload, O } header_info.p2pcdLearningRequest().set_to_omit(); header_info.missingCrlIdentifier().set_to_omit(); - if (_params[params::encrypted_mode].compare("1") == 0) { + if (_params[params_its::encrypted_mode].compare("1") == 0) { // TODO Set the encrytion key. Not supported yet, need to clarify mechanism, see IEEE Std 1609.2-20XX Clause 6.3.9 HeaderInfo header_info.encryptionKey().set_to_omit(); } else { header_info.encryptionKey().set_to_omit(); } - it = p_params.find(params::payload_type); + it = p_params.find(params_its::payload_type); if (it != p_params.cend()) { loggers::get_instance().log("security_services::sign_payload: Payload type: %s", it->second.c_str()); if (it->second.compare("1") == 0) { // DENM @@ -593,7 +593,7 @@ int security_services::sign_payload(const OCTETSTRING &p_unsecured_gn_payload, O Ieee1609Dot2::SignerIdentifier signer; loggers::get_instance().log("security_services::sign_payload: us = %ld - _last_generation_time = %ld - us - _last_generation_time = %ld", us, _last_generation_time, us - _last_generation_time); - std::string certificate_id = p_params[params::certificate]; + std::string certificate_id = p_params[params_its::certificate]; loggers::get_instance().log("security_services::sign_payload: certificate_id = %s", certificate_id.c_str()); if (((unsigned int)(us - _last_generation_time) >= 1000000 * 0.95) || force_certificate) { // Need to add certificate every 1s loggers::get_instance().log("security_services::sign_payload: Need to add certificate"); @@ -634,7 +634,7 @@ int security_services::sign_payload(const OCTETSTRING &p_unsecured_gn_payload, O return 0; } -int security_services::encrypt_gn_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_enc_gn_payload, params &p_params) { +int security_services::encrypt_gn_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_enc_gn_payload, params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::encrypt_gn_payload: ", p_unsecured_gn_payload); // Sanity checks @@ -642,7 +642,7 @@ int security_services::encrypt_gn_payload(const OCTETSTRING &p_unsecured_gn_payl loggers::get_instance().warning("security_services::encrypt_gn_payload: Encryption not initialised"); return -1; } - params::const_iterator it = p_params.find(params::peer_certificate); + params_its::const_iterator it = p_params.find(params_its::peer_certificate); if (it == p_params.cend()) { loggers::get_instance().warning("security_services::encrypt_gn_payload: Encryption impossible without a peer_certificte indication in parameters"); return -1; @@ -707,9 +707,9 @@ int security_services::encrypt_gn_payload(const OCTETSTRING &p_unsecured_gn_payl // 8. Build the encryption data Ieee1609Dot2::EncryptedDataEncryptionKey enc_data_key; - if (_params[params::cypher].compare("NISTP-256") == 0) { + if (_params[params_its::cypher].compare("NISTP-256") == 0) { enc_data_key.eciesNistP256() = ecies_key; - } else if (_params[params::cypher].compare("BP-256") == 0) { + } else if (_params[params_its::cypher].compare("BP-256") == 0) { enc_data_key.eciesBrainpoolP256r1() = ecies_key; } loggers::get_instance().log_msg("security_services::encrypt_gn_payload: enc_data_key=", enc_data_key); @@ -739,7 +739,7 @@ int security_services::encrypt_gn_payload(const OCTETSTRING &p_unsecured_gn_payl return 0; } -int security_services::decrypt_gn_payload(const OCTETSTRING &p_enc_gn_payload, OCTETSTRING &p_unsecured_gn_payload, params &p_params) { +int security_services::decrypt_gn_payload(const OCTETSTRING &p_enc_gn_payload, OCTETSTRING &p_unsecured_gn_payload, params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::decrypt_gn_payload: ", p_enc_gn_payload); // Sanity checks @@ -773,7 +773,7 @@ int security_services::decrypt_gn_payload(const OCTETSTRING &p_enc_gn_payload, O /*int security_services::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_tbs_data, const Ieee1609Dot2BaseTypes::HashAlgorithm &p_hashAlgorithm, const OCTETSTRING &p_private_key, Ieee1609Dot2BaseTypes::Signature &p_signature, - params &p_params) { // TODO Refine function + params_its &p_params) { // TODO Refine function loggers::get_instance().log_msg(">>> security_services::sign_tbs_data: ", p_tbs_data); // Encode the ToBeSignedData @@ -800,10 +800,10 @@ int security_services::decrypt_gn_payload(const OCTETSTRING &p_enc_gn_payload, O loggers::get_instance().log_msg("security_services::sign_tbs_data: encoded hashed_data=", hashed_data); loggers::get_instance().log_msg("security_services::sign_tbs_data: encoded hashed_issuer=", hash_issuer); // Sign ToBeSignedData - loggers::get_instance().log("security_services::sign_tbs_data: encoded params::signature = '%s'", - p_params[params::signature].c_str()); // TODO this parameter is useless, use content of the certificate - loggers::get_instance().log("security_services::sign_tbs_data: encoded params::certificate = '%s'", p_params[params::certificate].c_str()); - if (p_params[params::signature].compare("NISTP-256") == 0) { + loggers::get_instance().log("security_services::sign_tbs_data: encoded params_its::signature = '%s'", + p_params[params_its::signature].c_str()); // TODO this parameter is useless, use content of the certificate + loggers::get_instance().log("security_services::sign_tbs_data: encoded params_its::certificate = '%s'", p_params[params_its::certificate].c_str()); + if (p_params[params_its::signature].compare("NISTP-256") == 0) { // Hash ( Hash (Data input) || Hash ("") ) OCTETSTRING os = hashed_data + hash_issuer; // Hash (Data input) || Hash (Signer identifier input) loggers::get_instance().log_msg("security_services::sign_tbs_data: hash: ", os); @@ -826,14 +826,14 @@ int security_services::decrypt_gn_payload(const OCTETSTRING &p_enc_gn_payload, O }*/ int security_services::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_tbs_data, const Ieee1609Dot2BaseTypes::HashAlgorithm &p_hashAlgorithm, - Ieee1609Dot2BaseTypes::Signature &p_signature, params &p_params) { + Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::sign_tbs_data: ", p_tbs_data); // Get certificate - loggers::get_instance().log("security_services::sign_tbs_data: encoded params::certificate = '%s'", p_params[params::certificate].c_str()); + loggers::get_instance().log("security_services::sign_tbs_data: encoded params_its::certificate = '%s'", p_params[params_its::certificate].c_str()); Ieee1609Dot2::CertificateBase decoded_certificate; // Set signature type - _security_db.get()->get_certificate(p_params[params::certificate], decoded_certificate); + _security_db.get()->get_certificate(p_params[params_its::certificate], decoded_certificate); std::string sig("NISTP-256"); if (decoded_certificate.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_verificationKey)) { if (decoded_certificate.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP384)) { @@ -845,13 +845,13 @@ int security_services::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_tbs_d } } loggers::get_instance().log("security_services::sign_tbs_data: sig = '%s'", sig.c_str()); - params::const_iterator it = p_params.find(params::signature); + params_its::const_iterator it = p_params.find(params_its::signature); if (it == p_params.cend()) { - p_params.insert(std::pair(params::signature, sig)); + p_params.insert(std::pair(params_its::signature, sig)); } else { - p_params[params::signature] = sig; + p_params[params_its::signature] = sig; } - loggers::get_instance().log("security_services::sign_tbs_data: encoded params::signature = '%s'", p_params[params::signature].c_str()); + loggers::get_instance().log("security_services::sign_tbs_data: encoded params_its::signature = '%s'", p_params[params_its::signature].c_str()); // Encode the ToBeSignedData etsi_ts103097_tobesigned_data_codec tbs_data_codec; @@ -872,16 +872,16 @@ int security_services::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_tbs_d loggers::get_instance().log_msg("security_services::sign_tbs_data: encoded hashed_data=", hashed_data); // Sign ToBeSignedData int result = -1; - loggers::get_instance().log("security_services::sign_tbs_data: encoded params::signature = '%s'", - p_params[params::signature].c_str()); // TODO this parameter is useless, use content of the certificate - loggers::get_instance().log("security_services::sign_tbs_data: encoded params::certificate = '%s'", p_params[params::certificate].c_str()); - if (p_params[params::signature].compare("NISTP-256") == 0) { + loggers::get_instance().log("security_services::sign_tbs_data: encoded params_its::signature = '%s'", + p_params[params_its::signature].c_str()); // TODO this parameter is useless, use content of the certificate + loggers::get_instance().log("security_services::sign_tbs_data: encoded params_its::certificate = '%s'", p_params[params_its::certificate].c_str()); + if (p_params[params_its::signature].compare("NISTP-256") == 0) { result = sign_ecdsa_nistp256(hashed_data, p_signature, p_params); - } else if (p_params[params::signature].compare("NISTP-384") == 0) { + } else if (p_params[params_its::signature].compare("NISTP-384") == 0) { result = sign_ecdsa_nistp384(hashed_data, p_signature, p_params); - } else if (p_params[params::signature].compare("BP-256") == 0) { + } else if (p_params[params_its::signature].compare("BP-256") == 0) { result = sign_ecdsa_brainpoolp256r1(hashed_data, p_signature, p_params); - } else if (p_params[params::signature].compare("BP-384") == 0) { + } else if (p_params[params_its::signature].compare("BP-384") == 0) { result = sign_ecdsa_brainpoolp384r1(hashed_data, p_signature, p_params); } else { loggers::get_instance().error("security_services::sign_tbs_data: Unsupported signature algorithm"); @@ -909,10 +909,10 @@ int security_services::hash_sha384(const OCTETSTRING &p_data, OCTETSTRING &p_has return hash.generate(p_data, p_hash_data); } -int security_services::sign_ecdsa_nistp256(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params &p_params) { +int security_services::sign_ecdsa_nistp256(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::sign_ecdsa_nistp256: ", p_hash); - std::string certificate_id = p_params[params::certificate]; + std::string certificate_id = p_params[params_its::certificate]; loggers::get_instance().log("security_services::sign_ecdsa_nistp256: encoded certificate_id = '%s'", certificate_id.c_str()); OCTETSTRING pkey; if (_security_db->get_private_key(certificate_id, pkey) != 0) { @@ -945,10 +945,10 @@ int security_services::sign_ecdsa_nistp256(const OCTETSTRING &p_hash, Ieee1609Do return 0; } -int security_services::sign_ecdsa_nistp384(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params &p_params) { +int security_services::sign_ecdsa_nistp384(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::sign_ecdsa_nistp384: ", p_hash); - std::string certificate_id = p_params[params::certificate]; + std::string certificate_id = p_params[params_its::certificate]; loggers::get_instance().log("security_services::sign_ecdsa_nistp384: encoded certificate_id = '%s'", certificate_id.c_str()); OCTETSTRING pkey; if (_security_db->get_private_key(certificate_id, pkey) != 0) { @@ -982,7 +982,7 @@ int security_services::sign_ecdsa_nistp384(const OCTETSTRING &p_hash, Ieee1609Do } int security_services::verify_sign_ecdsa_nistp256(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, - const std::string &p_certificate_id, params &p_params) { + const std::string &p_certificate_id, params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::verify_sign_ecdsa_nistp256:", p_hash); loggers::get_instance().log(">>> security_services::verify_sign_ecdsa_nistp256: %s", p_certificate_id.c_str()); @@ -1031,7 +1031,7 @@ int security_services::verify_sign_ecdsa_nistp256(const OCTETSTRING &p_hash, con } int security_services::verify_sign_ecdsa_nistp384(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, - const std::string &p_certificate_id, params &p_params) { + const std::string &p_certificate_id, params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::verify_sign_ecdsa_nistp384:", p_hash); loggers::get_instance().log(">>> security_services::verify_sign_ecdsa_nistp384: %s", p_certificate_id.c_str()); @@ -1079,10 +1079,10 @@ int security_services::verify_sign_ecdsa_nistp384(const OCTETSTRING &p_hash, con return -1; } -int security_services::sign_ecdsa_brainpoolp256r1(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params &p_params) { +int security_services::sign_ecdsa_brainpoolp256r1(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::sign_ecdsa_brainpoolp256r1: ", p_hash); - std::string certificate_id = p_params[params::certificate]; + std::string certificate_id = p_params[params_its::certificate]; loggers::get_instance().log("security_services::sign_ecdsa_brainpoolp256r1: encoded certificate_id = '%s'", certificate_id.c_str()); OCTETSTRING pkey; if (_security_db->get_private_key(certificate_id, pkey) != 0) { @@ -1116,7 +1116,7 @@ int security_services::sign_ecdsa_brainpoolp256r1(const OCTETSTRING &p_hash, Iee } int security_services::verify_sign_ecdsa_brainpoolp256r1(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, - const std::string &p_certificate_id, params &p_params) { + const std::string &p_certificate_id, params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::verify_sign_ecdsa_brainpoolp256r1:", p_hash); loggers::get_instance().log(">>> security_services::verify_sign_ecdsa_brainpoolp256r1: %s", p_certificate_id.c_str()); @@ -1164,10 +1164,10 @@ int security_services::verify_sign_ecdsa_brainpoolp256r1(const OCTETSTRING &p_ha return -1; } -int security_services::sign_ecdsa_brainpoolp384r1(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params &p_params) { +int security_services::sign_ecdsa_brainpoolp384r1(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::sign_ecdsa_brainpoolp384r1: ", p_hash); - std::string certificate_id = p_params[params::certificate]; + std::string certificate_id = p_params[params_its::certificate]; loggers::get_instance().log("security_services::sign_ecdsa_brainpoolp384r1: encoded certificate_id = '%s'", certificate_id.c_str()); OCTETSTRING pkey; if (_security_db->get_private_key(certificate_id, pkey) != 0) { @@ -1201,7 +1201,7 @@ int security_services::sign_ecdsa_brainpoolp384r1(const OCTETSTRING &p_hash, Iee } int security_services::verify_sign_ecdsa_brainpoolp384r1(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, - const std::string &p_certificate_id, params &p_params) { + const std::string &p_certificate_id, params_its &p_params) { loggers::get_instance().log_msg(">>> security_services::verify_sign_ecdsa_brainpoolp384r1:", p_hash); loggers::get_instance().log(">>> security_services::verify_sign_ecdsa_brainpoolp384r1: %s", p_certificate_id.c_str()); diff --git a/ccsrc/Protocols/Security/security_services.hh b/ccsrc/Protocols/Security/security_services.hh index a10262c..ad4bc3a 100644 --- a/ccsrc/Protocols/Security/security_services.hh +++ b/ccsrc/Protocols/Security/security_services.hh @@ -2,7 +2,7 @@ #include -#include "params.hh" +#include "params_its.hh" #include "security_db.hh" @@ -41,7 +41,7 @@ class security_services { */ static security_services *instance; - params _params; + params_its _params; bool _setup_done; std::unique_ptr _ec_keys_enc; std::unique_ptr _ec_keys_dec; @@ -94,7 +94,7 @@ public: /*! \publicsection */ * \return 0 on success, negative value otherwise */ int verify_and_extract_gn_payload(const OCTETSTRING &p_secured_gn_payload, const bool p_verify, Ieee1609Dot2::Ieee1609Dot2Data &p_ieee_1609dot2_data, - OCTETSTRING &p_unsecured_gn_payload, params &p_params); + OCTETSTRING &p_unsecured_gn_payload, params_its &p_params); /*! * \fn int secure_gn_payload(const OCTETSTRING& p_unsecured_gn_payload, OCTETSTRING& p_secured_gn_payload, params& p_params); * \brief Apply security to the provided unsecured payload @@ -103,9 +103,9 @@ public: /*! \publicsection */ * \param[in] p_params The Test System parameters * \return 0 on success, negative value otherwise */ - int secure_gn_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_secured_gn_payload, params &p_params); + int secure_gn_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_secured_gn_payload, params_its &p_params); - int setup(params &p_params); + int setup(params_its &p_params); int store_certificate(const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, const OCTETSTRING &p_public_key_x, const OCTETSTRING &p_public_key_y, const OCTETSTRING &p_public_comp_key, const INTEGER &p_public_comp_key_mode, @@ -136,7 +136,7 @@ public: /*! \publicsection */ * \param[in] p_params The Test System parameters * \return 0 on success, negative value otherwise */ - int sign_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_signed_gn_payload, params &p_params); + int sign_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_signed_gn_payload, params_its &p_params); /*! * \fn int encrypt_gn_payload(const OCTETSTRING& p_unsecured_gn_payload, OCTETSTRING& p_signed_gn_payload, params& p_params); * \brief Encrypt the payload according provided parameters @@ -145,12 +145,12 @@ public: /*! \publicsection */ * \param[in] p_params The Test System parameters * \return 0 on success, negative value otherwise */ - int encrypt_gn_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_enc_gn_payload, params &p_params); + int encrypt_gn_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_enc_gn_payload, params_its &p_params); - int decrypt_gn_payload(const OCTETSTRING &p_enc_gn_payload, OCTETSTRING &p_unsecured_gn_payload, params &p_params); + int decrypt_gn_payload(const OCTETSTRING &p_enc_gn_payload, OCTETSTRING &p_unsecured_gn_payload, params_its &p_params); // int sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_tbs_data, const Ieee1609Dot2BaseTypes::HashAlgorithm &p_hashAlgorithm, -// const OCTETSTRING &p_private_key, Ieee1609Dot2BaseTypes::Signature &p_signature, params &p_params); +// const OCTETSTRING &p_private_key, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params); const int get_protocol_version() const { return ProtocolVersion; }; @@ -164,28 +164,28 @@ private: * \return 0 on success, negative value otherwise */ int process_ieee_1609_dot2_content(const Ieee1609Dot2::Ieee1609Dot2Content &p_ieee_1609_dot2_content, const bool p_verify, OCTETSTRING &p_unsecured_payload, - params &p_params); + params_its &p_params); int process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::SignedData &p_signed_data, const bool p_verify, OCTETSTRING &p_unsecured_payload, - params &p_params); + params_its &p_params); int process_ieee_1609_dot2_encrypted_data(const Ieee1609Dot2::EncryptedData &p_encrypted_data, const bool p_verify, OCTETSTRING &p_unsecured_payload, - params &p_params); + params_its &p_params); int sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_tbs_data, const Ieee1609Dot2BaseTypes::HashAlgorithm &p_hashAlgorithm, - Ieee1609Dot2BaseTypes::Signature &p_signature, params &p_params); + Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params); int hash_sha256(const OCTETSTRING &p_data, OCTETSTRING &p_hash_data); int hash_sha384(const OCTETSTRING &p_data, OCTETSTRING &p_hash_data); - int sign_ecdsa_nistp256(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params &p_params); - int sign_ecdsa_nistp384(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params &p_params); - int sign_ecdsa_brainpoolp256r1(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params &p_params); - int sign_ecdsa_brainpoolp384r1(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params &p_params); + int sign_ecdsa_nistp256(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params); + int sign_ecdsa_nistp384(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params); + int sign_ecdsa_brainpoolp256r1(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params); + int sign_ecdsa_brainpoolp384r1(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params); int verify_sign_ecdsa_nistp256(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, const std::string &p_certificate_id, - params &p_params); + params_its &p_params); int verify_sign_ecdsa_nistp384(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, const std::string &p_certificate_id, - params &p_params); + params_its &p_params); int verify_sign_ecdsa_brainpoolp256r1(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, const std::string &p_certificate_id, - params &p_params); + params_its &p_params); int verify_sign_ecdsa_brainpoolp384r1(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, const std::string &p_certificate_id, - params &p_params); + params_its &p_params); int extract_verification_keys(const Ieee1609Dot2::CertificateBase &p_cert, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y, OCTETSTRING &p_public_comp_key, INTEGER &p_public_comp_key_mode); diff --git a/ccsrc/Protocols/SremSsem/SremCodec.cc b/ccsrc/Protocols/SremSsem/SremCodec.cc index ff9bf75..f2c4cb5 100644 --- a/ccsrc/Protocols/SremSsem/SremCodec.cc +++ b/ccsrc/Protocols/SremSsem/SremCodec.cc @@ -15,7 +15,7 @@ int SremCodec::encode(const SREM__PDU__Descriptions::SREM &srem, OCTETSTRING &da return rc; } -int SremCodec::decode(const OCTETSTRING &data, SREM__PDU__Descriptions::SREM &srem, params *params) { +int SremCodec::decode(const OCTETSTRING &data, SREM__PDU__Descriptions::SREM &srem, params_its *params) { loggers::get_instance().log_msg(">>> SremCodec::decode: ", data); int rc = asn_codec.decode(oct2bit(data), srem); diff --git a/ccsrc/Protocols/SremSsem/SremCodec.hh b/ccsrc/Protocols/SremSsem/SremCodec.hh index eeea861..7685942 100644 --- a/ccsrc/Protocols/SremSsem/SremCodec.hh +++ b/ccsrc/Protocols/SremSsem/SremCodec.hh @@ -2,7 +2,7 @@ #define SREMCODEC_H #include "codec.hh" -#include "params.hh" +#include "params_its.hh" #include "per_codec.hh" #include "LibItsSremSsem_TypesAndValues.hh" @@ -22,7 +22,7 @@ public: virtual ~SremCodec(){}; virtual int encode(const SREM__PDU__Descriptions::SREM &srem, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, SREM__PDU__Descriptions::SREM &, params *params = NULL); + virtual int decode(const OCTETSTRING &data, SREM__PDU__Descriptions::SREM &, params_its *params = NULL); }; #endif diff --git a/ccsrc/Protocols/SremSsem/SsemCodec.cc b/ccsrc/Protocols/SremSsem/SsemCodec.cc index d455961..091aa72 100644 --- a/ccsrc/Protocols/SremSsem/SsemCodec.cc +++ b/ccsrc/Protocols/SremSsem/SsemCodec.cc @@ -15,7 +15,7 @@ int SsemCodec::encode(const SSEM__PDU__Descriptions::SSEM &ssem, OCTETSTRING &da return rc; } -int SsemCodec::decode(const OCTETSTRING &data, SSEM__PDU__Descriptions::SSEM &ssem, params *params) { +int SsemCodec::decode(const OCTETSTRING &data, SSEM__PDU__Descriptions::SSEM &ssem, params_its *params) { loggers::get_instance().log_msg(">>> SsemCodec::decode: ", data); int rc = asn_codec.decode(oct2bit(data), ssem); diff --git a/ccsrc/Protocols/SremSsem/SsemCodec.hh b/ccsrc/Protocols/SremSsem/SsemCodec.hh index e7871ca..4a92df4 100644 --- a/ccsrc/Protocols/SremSsem/SsemCodec.hh +++ b/ccsrc/Protocols/SremSsem/SsemCodec.hh @@ -2,7 +2,7 @@ #define SSEMCODEC_H #include "codec.hh" -#include "params.hh" +#include "params_its.hh" #include "per_codec.hh" #include "LibItsSremSsem_TypesAndValues.hh" @@ -22,7 +22,7 @@ public: virtual ~SsemCodec(){}; virtual int encode(const SSEM__PDU__Descriptions::SSEM &ssem, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, SSEM__PDU__Descriptions::SSEM &, params *params = NULL); + virtual int decode(const OCTETSTRING &data, SSEM__PDU__Descriptions::SSEM &, params_its *params = NULL); }; #endif diff --git a/ccsrc/Protocols/SremSsem_layers/SremSsemLayer.cc b/ccsrc/Protocols/SremSsem_layers/SremSsemLayer.cc index da59fa4..ea17f7b 100644 --- a/ccsrc/Protocols/SremSsem_layers/SremSsemLayer.cc +++ b/ccsrc/Protocols/SremSsem_layers/SremSsemLayer.cc @@ -11,7 +11,7 @@ SremSsemLayer::SremSsemLayer(const std::string &p_type, const std::string ¶m : t_layer(p_type), _params(), _srem_codec(), _ssem_codec() { loggers::get_instance().log(">>> SremSsemLayer::SremSsemLayer: %s, %s", to_string().c_str(), param.c_str()); // Setup parameters - params::convert(_params, param); + params_its::convert(_params, param); _params.insert(std::make_pair("its_aid", "140")); // ETSI TS 102 965 V1.2.1 (2015-06) _params.insert(std::make_pair("payload_type", "2")); _params.insert(std::make_pair("dst_port", "2007")); @@ -21,7 +21,7 @@ SremSsemLayer::SremSsemLayer(const std::string &p_type, const std::string ¶m registration::get_instance().add_item(p_type, this); } -void SremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::SremReq &p, params ¶ms) { +void SremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::SremReq &p, params_its ¶ms) { loggers::get_instance().log_msg(">>> SremSsemLayer::sendMsg: ", p); // Encode srem PDU @@ -31,11 +31,11 @@ void SremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::SremReq &p, pa return; } - _params[params::btp_destination_port] = "2007"; + _params[params_its::btp_destination_port] = "2007"; send_data(data, _params); } -void SremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::SsemReq &p, params ¶ms) { +void SremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::SsemReq &p, params_its ¶ms) { loggers::get_instance().log_msg(">>> SremSsemLayer::sendMsg: ", p); // Encode ssem PDU @@ -44,17 +44,17 @@ void SremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::SsemReq &p, pa loggers::get_instance().warning("SremSsemLayer::sendMsg: Encoding failure"); return; } - _params[params::btp_destination_port] = "2008"; + _params[params_its::btp_destination_port] = "2008"; send_data(data, _params); } -void SremSsemLayer::send_data(OCTETSTRING &data, params ¶ms) { +void SremSsemLayer::send_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> SremSsemLayer::send_data: ", data); // params.log(); send_to_all_layers(data, params); } -void SremSsemLayer::receive_data(OCTETSTRING &data, params ¶ms) { +void SremSsemLayer::receive_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg(">>> SremSsemLayer::receive_data: ", data); // Sanity check @@ -68,63 +68,63 @@ void SremSsemLayer::receive_data(OCTETSTRING &data, params ¶ms) { } // else, continue // Process lower layer data // recvTime - params::const_iterator it = params.find(params::timestamp); + params_its::const_iterator it = params.find(params_its::timestamp); if (it != params.cend()) { p.recvTime().set_long_long_val(std::stoll(it->second)); } else { p.recvTime().set_to_omit(); } // gnNextHeader - it = params.find(params::gn_next_header); + it = params.find(params_its::gn_next_header); if (it != params.cend()) { p.gnNextHeader() = std::stoi(it->second); } else { p.gnNextHeader().set_to_omit(); } // gnHeaderType - it = params.find(params::gn_header_type); + it = params.find(params_its::gn_header_type); if (it != params.cend()) { p.gnHeaderType() = std::stoi(it->second); } else { p.gnHeaderType().set_to_omit(); } // gnHeaderSubtype - it = params.find(params::gn_header_sub_type); + it = params.find(params_its::gn_header_sub_type); if (it != params.cend()) { p.gnHeaderSubtype() = std::stoi(it->second); } else { p.gnHeaderSubtype().set_to_omit(); } // gnLifetime - it = params.find(params::gn_lifetime); + it = params.find(params_its::gn_lifetime); if (it != params.cend()) { p.gnLifetime() = std::stoi(it->second); } else { p.gnLifetime().set_to_omit(); } // gnTrafficClass - it = params.find(params::gn_traffic_class); + it = params.find(params_its::gn_traffic_class); if (it != params.cend()) { p.gnTrafficClass() = std::stoi(it->second); } else { p.gnTrafficClass().set_to_omit(); } // btpDestinationPort - it = params.find(params::btp_destination_port); + it = params.find(params_its::btp_destination_port); if (it != params.cend()) { p.btpDestinationPort() = std::stoi(it->second); } else { p.btpDestinationPort().set_to_omit(); } // btpInfo - it = params.find(params::btp_info); + it = params.find(params_its::btp_info); if (it != params.cend()) { p.btpInfo() = std::stoi(it->second); } else { p.btpInfo().set_to_omit(); } // ssp - it = params.find(params::ssp); + it = params.find(params_its::ssp); if (it != params.cend()) { loggers::get_instance().log("SremSsemayer::receive_data: ssp=%s", it->second.c_str()); p.ssp() = oct2bit(str2oct(CHARSTRING(it->second.c_str()))); @@ -132,7 +132,7 @@ void SremSsemLayer::receive_data(OCTETSTRING &data, params ¶ms) { p.ssp().set_to_omit(); } // its_aid - it = params.find(params::its_aid); + it = params.find(params_its::its_aid); if (it != params.cend()) { p.its__aid() = std::stoi(it->second); } else { @@ -150,63 +150,63 @@ void SremSsemLayer::receive_data(OCTETSTRING &data, params ¶ms) { return; } // else, continue // Process lower layer data - params::const_iterator it = params.find(params::timestamp); + params_its::const_iterator it = params.find(params_its::timestamp); if (it != params.cend()) { p.recvTime().set_long_long_val(std::stoll(it->second)); } else { p.recvTime().set_to_omit(); } // gnNextHeader - it = params.find(params::gn_next_header); + it = params.find(params_its::gn_next_header); if (it != params.cend()) { p.gnNextHeader() = std::stoi(it->second); } else { p.gnNextHeader().set_to_omit(); } // gnHeaderType - it = params.find(params::gn_header_type); + it = params.find(params_its::gn_header_type); if (it != params.cend()) { p.gnHeaderType() = std::stoi(it->second); } else { p.gnHeaderType().set_to_omit(); } // gnHeaderSubtype - it = params.find(params::gn_header_sub_type); + it = params.find(params_its::gn_header_sub_type); if (it != params.cend()) { p.gnHeaderSubtype() = std::stoi(it->second); } else { p.gnHeaderSubtype().set_to_omit(); } // gnLifetime - it = params.find(params::gn_lifetime); + it = params.find(params_its::gn_lifetime); if (it != params.cend()) { p.gnLifetime() = std::stoi(it->second); } else { p.gnLifetime().set_to_omit(); } // gnTrafficClass - it = params.find(params::gn_traffic_class); + it = params.find(params_its::gn_traffic_class); if (it != params.cend()) { p.gnTrafficClass() = std::stoi(it->second); } else { p.gnTrafficClass().set_to_omit(); } // btpDestinationPort - it = params.find(params::btp_destination_port); + it = params.find(params_its::btp_destination_port); if (it != params.cend()) { p.btpDestinationPort() = std::stoi(it->second); } else { p.btpDestinationPort().set_to_omit(); } // btpInfo - it = params.find(params::btp_info); + it = params.find(params_its::btp_info); if (it != params.cend()) { p.btpInfo() = std::stoi(it->second); } else { p.btpInfo().set_to_omit(); } // ssp - it = params.find(params::ssp); + it = params.find(params_its::ssp); if (it != params.cend()) { loggers::get_instance().log("SremSsemLayer::receive_data: ssp=%s", it->second.c_str()); p.ssp() = oct2bit(str2oct(CHARSTRING(it->second.c_str()))); @@ -214,7 +214,7 @@ void SremSsemLayer::receive_data(OCTETSTRING &data, params ¶ms) { p.ssp().set_to_omit(); } // its_aid - it = params.find(params::its_aid); + it = params.find(params_its::its_aid); if (it != params.cend()) { p.its__aid() = std::stoi(it->second); } else { diff --git a/ccsrc/Protocols/SremSsem_layers/SremSsemLayer.hh b/ccsrc/Protocols/SremSsem_layers/SremSsemLayer.hh index a323d1f..937403c 100644 --- a/ccsrc/Protocols/SremSsem_layers/SremSsemLayer.hh +++ b/ccsrc/Protocols/SremSsem_layers/SremSsemLayer.hh @@ -23,20 +23,20 @@ namespace LibItsSremSsem__TestSystem { } // namespace LibItsSremSsem__TestSystem class SremSsemLayer : public t_layer { - params _params; - SremCodec _srem_codec; - SsemCodec _ssem_codec; + params_its _params; + SremCodec _srem_codec; + SsemCodec _ssem_codec; public: SremSsemLayer() : t_layer(), _params(), _srem_codec(), _ssem_codec(){}; SremSsemLayer(const std::string &p_type, const std::string ¶m); virtual ~SremSsemLayer(){}; - void sendMsg(const LibItsSremSsem__TypesAndValues::SremReq &, params ¶ms); - void sendMsg(const LibItsSremSsem__TypesAndValues::SsemReq &, params ¶ms); + void sendMsg(const LibItsSremSsem__TypesAndValues::SremReq &, params_its& params); + void sendMsg(const LibItsSremSsem__TypesAndValues::SsemReq &, params_its& params); - virtual void send_data(OCTETSTRING &data, params ¶ms); - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void send_data(OCTETSTRING& p_data, params_its& params); + virtual void receive_data(OCTETSTRING& p_data, params_its& p_params); int enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security); diff --git a/ccsrc/Protocols/Tcp/module.mk b/ccsrc/Protocols/Tcp/module.mk deleted file mode 100644 index 44d6c56..0000000 --- a/ccsrc/Protocols/Tcp/module.mk +++ /dev/null @@ -1,3 +0,0 @@ -sources := tcp_layer.cc -includes := . - diff --git a/ccsrc/Protocols/Tcp/tcp_layer.cc b/ccsrc/Protocols/Tcp/tcp_layer.cc deleted file mode 100644 index 3d24493..0000000 --- a/ccsrc/Protocols/Tcp/tcp_layer.cc +++ /dev/null @@ -1,259 +0,0 @@ -#include -#include -#include -#include -#include - -#include "tcp_layer_factory.hh" - -#include "loggers.hh" - -tcp_layer::tcp_layer(const std::string & p_type, const std::string & param) : layer(p_type), SSL_Socket(), PORT(p_type.c_str()), _params(), _client_id{-1}, _time_key("tcp_layer::Handle_Fd_Event_Readable"), _reconnect_on_send{false} { - loggers::get_instance().log(">>> tcp_layer::tcp_layer (1): %s, %s", to_string().c_str(), param.c_str()); - // Setup parameters - params::convert(_params, param); - _params.log(); - - init(); } - -tcp_layer::tcp_layer(const std::string & p_type, const params & param) : layer(p_type), SSL_Socket(), PORT(p_type.c_str()), _params(), _client_id{-1}, _time_key("tcp_layer::Handle_Fd_Event_Readable"), _reconnect_on_send{false} { - loggers::get_instance().log(">>> tcp_layer::tcp_layer (2): %s", to_string().c_str()); - // Setup parameters - _params = param; - - init(); -} - -void tcp_layer::init() { - loggers::get_instance().log(">>> tcp_layer::init"); - - set_socket_debugging(false); - params::const_iterator it = _params.find(params::debug); - if (it == _params.cend()) { - _params.insert(std::pair(std::string("debug"), "0")); - } else if (it->second.compare("1") == 0) { - set_socket_debugging(true); - } - it = _params.find(std::string("tcp_fragmented")); - if (it == _params.cend()) { - _params.insert(std::pair(std::string("tcp_fragmented"), "0")); - } - bool server_mode = false; - it = _params.find(params::server_mode); - if (it != _params.cend()) { - server_mode = (1 == std::stoi(it->second)); - } else { - _params.insert(std::pair(std::string("server_mode"), "0")); - } - it = _params.find(params::server); - if (it == _params.cend()) { - _params.insert(std::pair(std::string("server"), "127.0.0.1")); // TODO Try using params::server instead of std::string("server") - } - if (!parameter_set(params::server.c_str(), _params[params::server].c_str())) { - loggers::get_instance().warning("tcp_layer::set_parameter: Unprocessed parameter: %s", params::server.c_str()); - } - bool ssl_mode = false; - it = _params.find(params::use_ssl); - if (it == _params.cend()) { - _params.insert(std::pair(std::string("use_ssl"), "0")); - } else if (it->second.compare("1") == 0) { - _params.insert(std::pair(std::string("use_ssl"), "1")); - ssl_mode = true; - } - set_ssl_use_ssl(ssl_mode); - it = _params.find(params::port); - if (it == _params.cend()) { - if (_params[params::use_ssl].compare("0") == 0) { // Use standard HTTP port - _params.insert(std::pair(std::string("port"), "80")); - } else { // Use standard HTTPS port - _params.insert(std::pair(std::string("port"), "443")); - } - } - if (!parameter_set(remote_port_name(), _params[params::port].c_str())) { - loggers::get_instance().warning("tcp_layer::set_parameter: Unprocessed parameter: %s", params::port.c_str()); - } - it = _params.find(params::local_port); - if (it == _params.cend()) { - if (_params[params::use_ssl].compare("0") == 0) { // Use standard HTTP local_port - _params.insert(std::pair(std::string("local_port"), "80")); - } else { // Use standard HTTPS local_port - _params.insert(std::pair(std::string("local_port"), "443")); - } - } - if (!parameter_set(local_port_name(), _params[params::local_port].c_str())) { - loggers::get_instance().warning("tcp_layer::set_parameter: Unprocessed parameter: %s", params::local_port.c_str()); - } - - parameter_set(use_connection_ASPs_name(), (!server_mode) ? "yes" : "no"); - loggers::get_instance().warning("tcp_layer::set_parameter: Limit to one simultanneous accepted connection (server_backlog == 1"); - parameter_set(server_backlog_name(), "1"); // Limit to one simultanneous accepted connection - loggers::get_instance().log("tcp_layer::init: server_mode=%x", server_mode); - set_server_mode(server_mode); - if (server_mode) { - parameter_set("serverPort", _params[params::local_port].c_str()); - } - if (ssl_mode) { // Add certificate bundle - // Check mutual authentication param - _params.insert(std::pair(std::string("mutual_tls"), "0")); - parameter_set(ssl_verifycertificate_name(), "no"); - it = _params.find(params::mutual_auth); - if (it == _params.cend()) { - if (_params[params::mutual_auth].compare("1") == 0) { // Use mutual authentication - parameter_set(ssl_verifycertificate_name(), "yes"); - _params.insert(std::pair(std::string("mutual_tls"), "1")); - } - } - // Set trusted CA file - it = _params.find(params::mutual_auth); - if (it == _params.cend()) { - parameter_set(ssl_trustedCAlist_file_name(), it->second.c_str()); - _params.insert(std::pair(std::string("mutual_tls"), it->second)); - } else { - parameter_set(ssl_trustedCAlist_file_name(), "/usr/share/ca-certificates/mozilla/Amazon_Root_CA_1.crt"); - } - // Set additional certificates - //parameter_set(ssl_private_key_file_name(), "../certificates/out/privates/e5e11abad8003766e4a7b721afb175a189b5f4cc7046af9b0d8eaebb86f28c40_server_dsa.key.pem"); - //parameter_set(ssl_certificate_file_name(), "../certificates/out/certs/e5e11abad8003766e4a7b721afb175a189b5f4cc7046af9b0d8eaebb86f28c40_server_dsa.cert.pem"); - } - set_ttcn_buffer_usercontrol(false); - set_handle_half_close(true); - - map_user(); - - parameter_set(client_TCP_reconnect_name(), "yes"); - - if (server_mode == 0) { - loggers::get_instance().log("tcp_layer::init: Establish connection: %s/%s", _params[params::server].c_str(), _params[params::port].c_str()); - open_client_connection(_params[params::server].c_str(), _params[params::port].c_str(), NULL, NULL); - } -} - -tcp_layer::~tcp_layer() { - loggers::get_instance().log(">>> tcp_layer::~tcp_layer: %d", _client_id); - if (_client_id != -1) { - remove_client(_client_id); - } - - unmap_user(); -} - -void tcp_layer::Handle_Fd_Event(int fd, boolean is_readable, boolean is_writable, boolean is_error) -{ - loggers::get_instance().log(">>> tcp_layer::Handle_Fd_Event: %d", fd); - Handle_Socket_Event(fd, is_readable, is_writable, is_error); - log_debug("<<< tcp_layer::Handle_Fd_Event"); -} - -void tcp_layer::Handle_Timeout(double time_since_last_call) -{ - loggers::get_instance().log(">>> tcp_layer::Handle_Timeout: %f", time_since_last_call); - Handle_Timeout_Event(time_since_last_call); - loggers::get_instance().log("<<< tcp_layer::Handle_Timeout"); -} - -void tcp_layer::send_data(OCTETSTRING& data, params& params) { - loggers::get_instance().log_msg(">>> tcp_layer::send_data: ", data); - - loggers::get_instance().log("tcp_layer::send_data: SSL mode: %x", get_ssl_use_ssl()); - loggers::get_instance().log("tcp_layer::send_data: server_mode: %s", _params[params::server_mode].c_str()); - loggers::get_instance().log("tcp_layer::send_data: peer_list_get_nr_of_peers: %d", peer_list_get_nr_of_peers()); - - if ((_params[params::server_mode].compare("0") == 0) && (peer_list_get_nr_of_peers() == 0)) { - // Reconnect (e.g. HTTP connection lost - loggers::get_instance().log("tcp_layer::send_data: Re-establish connection: %s/%s", _params[params::server].c_str(), _params[params::port].c_str()); - open_client_connection(_params[params::server].c_str(), _params[params::port].c_str(), NULL, NULL); - } - send_outgoing(static_cast(data), data.lengthof(), _client_id); -} - -void tcp_layer::receive_data(OCTETSTRING& data, params& params) { - loggers::get_instance().log_msg(">>> tcp_layer::receive_data: ", data); - - receive_to_all_layers(data, params); -} - -void tcp_layer::message_incoming(const unsigned char* message_buffer, int length, int client_id) { - loggers::get_instance().log(">>> tcp_layer::message_incoming"); - loggers::get_instance().log_to_hexa("tcp_layer::message_incoming: ", message_buffer, length); - - float duration; - loggers::get_instance().set_start_time(_time_key); - OCTETSTRING data(length, message_buffer); - params params; - params.insert(std::pair( - std::string("timestamp"), - std::to_string(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()))); - this->receive_data(data, params); // TODO Check execution time for decoding operation - loggers::get_instance().set_stop_time(_time_key, duration); -} - -void tcp_layer::client_connection_opened(int p_client_id) -{ - loggers::get_instance().log(">>> tcp_layer::client_connection_opened: %d", p_client_id); - _client_id = p_client_id; -} - -bool tcp_layer::add_user_data(int p_client_id) -{ - loggers::get_instance().log(">>> tcp_layer::add_user_data: %d", p_client_id); - if (_params[params::use_ssl].compare("0") == 0) { - loggers::get_instance().log("tcp_layer::add_user_data: Non secured mode"); - return Abstract_Socket::add_user_data(p_client_id); - } - loggers::get_instance().log("tcp_layer::add_user_data: SSL mode"); - return SSL_Socket::add_user_data(p_client_id); -} - -int tcp_layer::send_message_on_fd(int p_client_id, const unsigned char * message_buffer, int length_of_message) -{ - loggers::get_instance().log(">>> tcp_layer::send_message_on_fd: %d", p_client_id); - - if(get_user_data(p_client_id)) { - loggers::get_instance().log("tcp_layer::send_message_on_fd: SSL mode"); - return SSL_Socket::send_message_on_fd(p_client_id, message_buffer, length_of_message); - } - - loggers::get_instance().log("tcp_layer::send_message_on_fd: Non secured mode"); - return Abstract_Socket::send_message_on_fd(p_client_id, message_buffer, length_of_message); -} - -int tcp_layer::send_message_on_nonblocking_fd(int p_client_id, const unsigned char * message_buffer, int length_of_message) -{ - loggers::get_instance().log(">>> tcp_layer::send_message_on_nonblocking_fd: %d", p_client_id); - - if(get_user_data(p_client_id)) { - loggers::get_instance().log("tcp_layer::send_message_on_nonblocking_fd: SSL mode"); - return SSL_Socket::send_message_on_nonblocking_fd(p_client_id, message_buffer, length_of_message); - } - - loggers::get_instance().log("tcp_layer::send_message_on_nonblocking_fd: Non secured mode"); - return Abstract_Socket::send_message_on_nonblocking_fd(p_client_id, message_buffer, length_of_message); -} - -int tcp_layer::receive_message_on_fd(int p_client_id) -{ - loggers::get_instance().log(">>> tcp_layer::receive_message_on_fd: %d", p_client_id); - - if(get_user_data(p_client_id)) { - // INFO: it is assumed that only SSL_Socket assigns user data to each peer - loggers::get_instance().log("tcp_layer::receive_message_on_fd: SSL mode"); - return SSL_Socket::receive_message_on_fd(p_client_id); - } - - loggers::get_instance().log("tcp_layer::receive_message_on_fd: Non secured mode"); - if (_params[std::string("tcp_fragmented")].compare("1") == 0) { - sleep(5); // FIXME When HTTP paquet is fragmented into several TCP packets, a timer is required. This is a Q&D solution - } - return Abstract_Socket::receive_message_on_fd(p_client_id); -} - -void tcp_layer::peer_disconnected(int p_client_id) -{ - loggers::get_instance().log(">>> tcp_layer::peer_disconnected: %d", p_client_id); - - Abstract_Socket::peer_disconnected(p_client_id); - _client_id = -1; -} - -tcp_layer_factory tcp_layer_factory::_f; - diff --git a/ccsrc/Protocols/Tcp/tcp_layer.hh b/ccsrc/Protocols/Tcp/tcp_layer.hh deleted file mode 100644 index 3dbcba7..0000000 --- a/ccsrc/Protocols/Tcp/tcp_layer.hh +++ /dev/null @@ -1,108 +0,0 @@ -/*! - * \file tcp_layer.hh - * \brief Header file for ITS TCP socket based protocol port layer. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include "layer.hh" - -using namespace std; // Required for isnan() -#include "Abstract_Socket.hh" - -class PORT; //! Forward declaration of TITAN class - -/*! - * \class tcp_layer - * \brief This class provides description of ITS TCP port protocol layer - */ -class tcp_layer : public layer, public SSL_Socket, public PORT { - params _params; //! Layer parameters - int _client_id; //! Connection identifier - std::string _time_key; //! \todo - bool _reconnect_on_send; //! Set to true if connection shall be done when sending data. Otherwise, connection is established by the \see constructor - -public: //! \publicsection - //tcp_layer(): PORT("TCP") {}; - /*! - * \brief Specialised constructor - * Create a new instance of the tcp_layer class - * \param[in] p_type \todo - * \param[in] p_param \todo - */ - tcp_layer(const std::string &p_type, const std::string &p_param); - /*! - * \brief Specialised constructor - * Create a new instance of the tcp_layer class - * \param[in] p_type \todo - * \param[in] p_param \todo - */ - tcp_layer(const std::string &p_type, const params &p_param); - /*! - * \brief Default destructor - * \remark If \see _reconnect_on_send is set to false, the disconnection is done by the destructor - */ - virtual ~tcp_layer(); - - /*! - * \virtual - * \fn void send_data(OCTETSTRING& data, params& params); - * \brief Send bytes formated data to the lower layers - * \param[in] p_data The data to be sent - * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters - * \virtual - */ - virtual void send_data(OCTETSTRING &data, params ¶ms); - /*! - * \virtual - * \fn void receive_data(OCTETSTRING& data, params& params); - * \brief Receive bytes formated data from the lower layers - * \param[in] p_data The bytes formated data received - * \param[in] p_params Some lower layers parameters values when data was received - */ - virtual void receive_data(OCTETSTRING &data, params &info); - - /*! - * \virtual - * \fn void message_incoming(const unsigned char* message_buffer, int length, int client_id = -1); - * \brief Receive bytes formated data from the lower layers - * \param[in] p_buffer The bytes formated data received - * \param[in] p_length The number of bytes received - * \param[in] p_client_id The connection identifier.Default: -1 - */ - virtual void message_incoming(const unsigned char *p_buffer, int p_length, int p_client_id = -1); - -protected: //! \protectedsection - void init(); - - void Add_Fd_Read_Handler(int fd) { Handler_Add_Fd_Read(fd); }; - void Add_Fd_Write_Handler(int fd) { Handler_Add_Fd_Write(fd); }; - void Remove_Fd_Read_Handler(int fd) { Handler_Remove_Fd_Read(fd); }; - void Remove_Fd_Write_Handler(int fd) { Handler_Remove_Fd_Write(fd); }; - void Remove_Fd_All_Handlers(int fd) { Handler_Remove_Fd(fd); }; - void Handler_Uninstall() { Uninstall_Handler(); } - void Timer_Set_Handler(double call_interval, boolean is_timeout = TRUE, boolean call_anyway = TRUE, boolean is_periodic = TRUE) { - Handler_Set_Timer(call_interval, is_timeout, call_anyway, is_periodic); - }; - - const char *remote_address_name() { return params::server.c_str(); }; - const char *remote_port_name() { return params::port.c_str(); }; - const char *socket_debugging_name() { return params::debug.c_str(); }; - const char *ssl_use_ssl_name() { return params::use_ssl.c_str(); }; - - void client_connection_opened(int p_client_id); - bool add_user_data(int p_client_id); - int send_message_on_fd(int p_client_id, const unsigned char *message_buffer, int length_of_message); - int send_message_on_nonblocking_fd(int client_id, const unsigned char *message_buffer, int length_of_message); - int receive_message_on_fd(int p_client_id); - void peer_disconnected(int p_client_id); - -private: //! \privatesection - void Handle_Fd_Event(int fd, boolean is_readable, boolean is_writable, boolean is_error); - void Handle_Timeout(double time_since_last_call); -}; // End of class tcp_layer diff --git a/ccsrc/Protocols/Tcp/tcp_layer_factory.hh b/ccsrc/Protocols/Tcp/tcp_layer_factory.hh deleted file mode 100644 index 4fe2009..0000000 --- a/ccsrc/Protocols/Tcp/tcp_layer_factory.hh +++ /dev/null @@ -1,41 +0,0 @@ -/*! - * \file tcp_layer_factory.hh - * \brief Header file for ITS TCP socket based protocol layer factory. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include "layer_stack_builder.hh" - -#include "tcp_layer.hh" - -/*! - * \class tcp_layer_factory - * \brief This class provides a factory class to create an tcp_layer class instance - */ -class tcp_layer_factory : public layer_factory { - static tcp_layer_factory _f; //! Reference to the unique instance of this class -public: //! \publicsection - /*! - * \brief Default constructor - * Create a new instance of the tcp_layer class - * \remark The TCP socket based layer identifier is TCP - */ - tcp_layer_factory() { - // Register factory - layer_stack_builder::register_layer_factory("TCP", this); - }; - /*! - * \fn layer* create_layer(const std::string & type, const std::string & param); - * \brief Create the layers stack based on the provided layers stack description - * \param[in] p_type The provided layers stack description - * \param[in] p_params Optional parameters - * \return 0 on success, -1 otherwise - */ - inline virtual layer *create_layer(const std::string &p_type, const std::string &p_param) { return new tcp_layer(p_type, p_param); }; -}; // End of class tcp_layer_factory diff --git a/ccsrc/Protocols/UDP/module.mk b/ccsrc/Protocols/UDP/module.mk deleted file mode 100644 index d19e9d9..0000000 --- a/ccsrc/Protocols/UDP/module.mk +++ /dev/null @@ -1,4 +0,0 @@ -#sources := udp_layer.cc udp_pcap_layer.cc -sources := udp_layer.cc -includes := . - diff --git a/ccsrc/Protocols/UDP/udp_layer.cc b/ccsrc/Protocols/UDP/udp_layer.cc deleted file mode 100644 index 58ffd37..0000000 --- a/ccsrc/Protocols/UDP/udp_layer.cc +++ /dev/null @@ -1,196 +0,0 @@ -#include -#include -#include - -#include - -#include "loggers.hh" - -#include "udp_layer_factory.hh" - -#include -#include - -udp_layer::udp_layer(const std::string &p_type, const std::string ¶m) - : layer(p_type), PORT(p_type.c_str()), _params(), _saddr{0}, _daddr{0}, _reuse_incoming_source_adddress(false), _fd(-1), - _time_key("udp_layer::Handle_Fd_Event_Readable") { - loggers::get_instance().log(">>> udp_layer::udp_layer (1): %s, %s", to_string().c_str(), param.c_str()); - - // Setup parameters - params::convert(_params, param); - - init(); -} - -udp_layer::udp_layer(const std::string &p_type, const params ¶m) - : layer(p_type), PORT(p_type.c_str()), _params(), _saddr{0}, _daddr{0}, _reuse_incoming_source_adddress(false), _fd(-1), - _time_key("udp_layer::Handle_Fd_Event_Readable") { - loggers::get_instance().log(">>> udp_layer::udp_layer (2): %s", to_string().c_str()); - - // Setup parameters - _params = param; - - init(); -} - -void udp_layer::init() { - loggers::get_instance().log(">>> udp_layer::init"); - - params::const_iterator it = _params.find("src_ip"); - if (it == _params.cend()) { - _params.insert(std::pair(std::string("src_ip"), "127.0.0.1")); - } - it = _params.find("src_port"); - if (it == _params.cend()) { - _params.insert(std::pair(std::string("src_port"), "0")); // Dynamic binding requested - } - it = _params.find("dst_ip"); - if (it == _params.cend()) { - _params.insert(std::pair(std::string("dst_ip"), "127.0.0.1")); - } - it = _params.find("dst_port"); - if (it == _params.cend()) { - _params.insert(std::pair(std::string("dst_port"), "12345")); - } - it = _params.find("reuse_incoming_source_adddress"); - if (it != _params.cend()) { - _reuse_incoming_source_adddress = (boolean)(it->second.compare("1") == 0); - } - loggers::get_instance().log("udp_layer::init: _reuse_incoming_source_adddress: %d", _reuse_incoming_source_adddress); - - // Initialize the socket - _saddr.sin_family = AF_INET; - _saddr.sin_addr.s_addr = htonl(INADDR_ANY); - loggers::get_instance().log("udp_layer::init: Port to listen=%d", std::atoi(_params["src_port"].c_str())); - _saddr.sin_port = htons(std::atoi(_params["src_port"].c_str())); - // Create socket - _fd = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (_fd == -1) { - loggers::get_instance().error("udp_layer::init: Failed to create socket"); - } - loggers::get_instance().log("udp_layer::init: socket id: %d", _fd); - int reuse = 1; - if (::setsockopt(_fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) < 0) { - loggers::get_instance().warning("udp_layer::init: Failed to set SO_REUSEADDR"); - } - // Bind it - /*struct ifreq ifr; - memset(&ifr, 0, sizeof(ifr)); - snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "eth1"); - if (setsockopt(_fd, SOL_SOCKET, SO_BINDTODEVICE, (void *)&ifr.ifr_name, strlen(ifr.ifr_name)) < 0) { - close(); - loggers::get_instance().error("udp_layer::init: Failed to bind socket to %s", ifr.ifr_name); - } - loggers::get_instance().log("udp_layer::init: Bound to device %s", ifr.ifr_name);*/ - if (::bind(_fd, (struct sockaddr *)&_saddr, sizeof(_saddr)) < 0) { - close(); - loggers::get_instance().error("udp_layer::init: Failed to bind socket"); - } - loggers::get_instance().log("udp_layer::init: Bound on port %s", _params["src_port"].c_str()); - // Pass the device file handler to the polling procedure - Handler_Add_Fd_Read(_fd); - - _daddr.sin_family = AF_INET; - _daddr.sin_addr.s_addr = htonl(get_host_id(_params["dst_ip"])); - _daddr.sin_port = htons(std::atoi(_params["dst_port"].c_str())); -} - -udp_layer::~udp_layer() { - loggers::get_instance().log(">>> udp_layer::~udp_layer"); - - close(); -} - -void udp_layer::close() { - loggers::get_instance().log(">>> udp_layer::close: %d", _fd); - - if (_fd != -1) { - ::close(_fd); - _fd = -1; - } -} - -void udp_layer::send_data(OCTETSTRING &data, params ¶ms) { - loggers::get_instance().log(">>> udp_layer::send_data: %d", _fd); - loggers::get_instance().log_msg(">>> udp_layer::send_data: ", data); - - int result = ::sendto(_fd, (const char *)static_cast(data), data.lengthof(), 0, (struct sockaddr *)&_daddr, sizeof(_daddr)); - loggers::get_instance().log("udp_layer::send_data: #bytes sent: %d to %s:%d", result, ::inet_ntoa(_daddr.sin_addr), ntohs(_daddr.sin_port)); -} - -void udp_layer::receive_data(OCTETSTRING &data, params ¶ms) { - loggers::get_instance().log_msg(">>> udp_layer::receive_data: ", data); - - receive_to_all_layers(data, params); -} - -void udp_layer::Handle_Fd_Event_Readable(int fd) { - loggers::get_instance().log(">>> udp_layer::Handle_Fd_Event_Readable: %d", fd); - - unsigned char buffer[3072] = {0}; - struct sockaddr_in from = {0}; - socklen_t len = sizeof(struct sockaddr_in); // Length of sender's address - params params; - std::vector acc; - int result = ::recvfrom(fd, buffer, 3072, 0, (struct sockaddr *)&from, &len); - loggers::get_instance().log("udp_layer::Handle_Fd_Event_Readable: src_port = %s:%d, payload length = %d, errno = %d", ::inet_ntoa(from.sin_addr), - ntohs(from.sin_port), result, errno); - while ((result == 3072) && (errno == 0)) { - std::copy((unsigned char *)buffer, (unsigned char *)((unsigned char *)buffer + result), std::back_inserter(acc)); - result = ::recvfrom(fd, buffer, 3072, 0, (struct sockaddr *)&from, &len); - loggers::get_instance().log("udp_layer::Handle_Fd_Event_Readable: src_port = %s:%d, payload length = %d, errno = %d", ::inet_ntoa(from.sin_addr), - ntohs(from.sin_port), result, errno); - } // End of 'while' statement - if (errno < 0) { - loggers::get_instance().warning("udp_layer::Handle_Fd_Event_Readable: Failed to read data, discard them: errno=%d", errno); - return; - } else { - std::copy((unsigned char *)buffer, (unsigned char *)((unsigned char *)buffer + result), std::back_inserter(acc)); - if (_reuse_incoming_source_adddress) { // Reuse the incoming address/port for sending - memcpy((void *)&_daddr, (const void *)&from, sizeof(struct sockaddr_in)); - loggers::get_instance().log("udp_layer::Handle_Fd_Event_Readable: New _daddr: %s:%d", ::inet_ntoa(_daddr.sin_addr), ntohs(_daddr.sin_port)); - } - } - params.insert(std::pair( - std::string("timestamp"), - std::to_string(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()))); - - float duration; - loggers::get_instance().set_start_time(_time_key); - OCTETSTRING os(acc.size(), acc.data()); - receive_data(os, params); // TODO Check execution time for decoding operation - loggers::get_instance().set_stop_time(_time_key, duration); -} - -unsigned long udp_layer::get_host_id(const std::string &p_host_name) { - loggers::get_instance().log(">>> udp_layer::get_host_id"); - - if (p_host_name.empty()) { - loggers::get_instance().warning("udp_layer::get_host_id: Wrong parameter"); - return INADDR_ANY; - } - - unsigned long ip_addr = 0; - if (p_host_name.compare("255.255.255.255") == 0) { - loggers::get_instance().warning("udp_layer::get_host_id: Host ip is 255.255.255.255"); - ip_addr = 0xffffffff; - } else { - in_addr_t addr = ::inet_addr(p_host_name.c_str()); - if (addr != (in_addr_t)-1) { // host name in XX:XX:XX:XX form - ip_addr = addr; - } else { // host name in domain.com form - struct hostent *hptr; - if ((hptr = ::gethostbyname(p_host_name.c_str())) == 0) { - close(); - loggers::get_instance().error("udp_layer::get_host_id: Invalid host name: %s", p_host_name.c_str()); - } - ip_addr = *((unsigned long *)hptr->h_addr_list[0]); - } - } - - loggers::get_instance().log("udp_layer::get_host_id: Host name: %s, Host address: %u", p_host_name.c_str(), ip_addr); - - return htonl(ip_addr); -} - -udp_layer_factory udp_layer_factory::_f; diff --git a/ccsrc/Protocols/UDP/udp_layer.hh b/ccsrc/Protocols/UDP/udp_layer.hh deleted file mode 100644 index cfed5f5..0000000 --- a/ccsrc/Protocols/UDP/udp_layer.hh +++ /dev/null @@ -1,84 +0,0 @@ -/*! - * \file udp_layer.hh - * \brief Header file for ITS UDP/IP protocol layer definition. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include -#include -#include -#include - -#include "layer.hh" - -using namespace std; // Required for isnan() -#include "Abstract_Socket.hh" - -//class PORT; //! Forward declaration of TITAN class - -/*! - * \class udp_layer - * \brief This class provides description of ITS UDP/IP protocol layer - */ -class udp_layer : public layer, public PORT { - params _params; //! Layer parameters - struct sockaddr_in _saddr; //! Source socket address description - struct sockaddr_in _daddr; //! Destination socket address description - bool _reuse_incoming_source_adddress; - //! This flag must be set to true if the UpperTester/UDP layer must act as an IUT, not as a Test System. Default value: Test System - int _fd; // Socket file descriptor - std::string _time_key; //! \todo - -public: //! \publicsection - //udp_layer(): PORT("UDP") {}; - /*! - * \brief Specialised constructor - * Create a new instance of the udp_layer class - * \param[in] p_type \todo - * \param[in] p_param \todo - */ - udp_layer(const std::string &p_type, const std::string &p_param); - /*! - * \brief Specialised constructor - * Create a new instance of the udp_layer class - * \param[in] p_type \todo - * \param[in] p_param \todo - */ - udp_layer(const std::string &p_type, const params &p_param); - /*! - * \brief Default destructor - */ - virtual ~udp_layer(); - - /*! - * \virtual - * \fn void send_data(OCTETSTRING& data, params& params); - * \brief Send bytes formated data to the lower layers - * \param[in] p_data The data to be sent - * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters - */ - virtual void send_data(OCTETSTRING &data, params ¶ms); - /*! - * \virtual - * \fn void receive_data(OCTETSTRING& data, params& params); - * \brief Receive bytes formated data from the lower layers - * \param[in] p_data The bytes formated data received - * \param[in] p_params Some lower layers parameters values when data was received - */ - virtual void receive_data(OCTETSTRING &data, params &info); - - void Handle_Fd_Event_Readable(int fd); - -protected: - void init(); - -private: - unsigned long get_host_id(const std::string &p_host_name); - void close(); -}; // End of class udp_layer diff --git a/ccsrc/Protocols/UDP/udp_layer_factory.hh b/ccsrc/Protocols/UDP/udp_layer_factory.hh deleted file mode 100644 index d08c503..0000000 --- a/ccsrc/Protocols/UDP/udp_layer_factory.hh +++ /dev/null @@ -1,42 +0,0 @@ -/*! - * \file udp_layer_factory.hh - * \brief Header file for ITS UDP/IP protocol layer factory. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include "layer_stack_builder.hh" - -#include "udp_layer.hh" - -/*! - * \class udp_layer_factory - * \brief This class provides a factory class to create an udp_layer class instance - */ -class udp_layer_factory : public layer_factory { - static udp_layer_factory _f; //! Reference to the unique instance of this class -public: //! \publicsection - /*! - * \brief Default constructor - * Create a new instance of the udp_layer_factory class - * \remark The UDP/IP layer identifier is UDP - */ - udp_layer_factory() { - // register factory - layer_stack_builder::register_layer_factory("UDP", this); - }; - /*! - * \fn layer* create_layer(const std::string & type, const std::string & param); - * \brief Create the layers stack based on the provided layers stack description - * \param[in] p_type The provided layers stack description - * \param[in] p_params Optional parameters - * \return 0 on success, -1 otherwise - * \inline - */ - inline virtual layer *create_layer(const std::string &p_type, const std::string &p_param) { return new udp_layer(p_type, p_param); }; -}; // End of class udp_layer_factory diff --git a/ccsrc/Protocols/UpperTester/UpperTesterRtcmemCodec.cc b/ccsrc/Protocols/UpperTester/UpperTesterRtcmemCodec.cc index ed170b6..1e0b3ec 100644 --- a/ccsrc/Protocols/UpperTester/UpperTesterRtcmemCodec.cc +++ b/ccsrc/Protocols/UpperTester/UpperTesterRtcmemCodec.cc @@ -95,7 +95,7 @@ int UpperTesterRtcmemCodec::encode_(const Base_Type &type, const TTCN_Typedescri return 0; } -int UpperTesterRtcmemCodec::decode(const OCTETSTRING &data, Record_Type &msg, params *params) { +int UpperTesterRtcmemCodec::decode(const OCTETSTRING &data, Record_Type &msg, params_its *params) { TTCN_EncDec::clear_error(); TTCN_Buffer decoding_buffer(data); _params = params; @@ -107,7 +107,7 @@ int UpperTesterRtcmemCodec::decode(const OCTETSTRING &data, Record_Type &msg, pa return 0; } -std::unique_ptr UpperTesterRtcmemCodec::decode(const OCTETSTRING &data, params *params) { +std::unique_ptr UpperTesterRtcmemCodec::decode(const OCTETSTRING &data, params_its *params) { std::unique_ptr result; const unsigned char *ptr = static_cast(data); @@ -124,7 +124,7 @@ std::unique_ptr UpperTesterRtcmemCodec::decode(const OCTETSTRING &dat return result; } -int UpperTesterRtcmemCodec::decode(const OCTETSTRING &data, LibItsRtcmem__TypesAndValues::UtRtcmemResults &msg, params *params) { +int UpperTesterRtcmemCodec::decode(const OCTETSTRING &data, LibItsRtcmem__TypesAndValues::UtRtcmemResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> UpperTesterRtcmemCodec::decode: decoding_buffer=", data); const unsigned char *ptr = static_cast(data); @@ -144,7 +144,7 @@ int UpperTesterRtcmemCodec::decode(const OCTETSTRING &data, LibItsRtcmem__TypesA return 0; } -int UpperTesterRtcmemCodec::decode(const OCTETSTRING &data, LibItsRtcmem__TypesAndValues::UtRtcmemEventInd &msg, params *params) { +int UpperTesterRtcmemCodec::decode(const OCTETSTRING &data, LibItsRtcmem__TypesAndValues::UtRtcmemEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> UpperTesterRtcmemCodec::decode: decoding_buffer=", data); const unsigned char *ptr = static_cast(data) + 1; diff --git a/ccsrc/Protocols/UpperTester/UpperTesterRtcmemCodec.hh b/ccsrc/Protocols/UpperTester/UpperTesterRtcmemCodec.hh index 7dda869..97f10c9 100644 --- a/ccsrc/Protocols/UpperTester/UpperTesterRtcmemCodec.hh +++ b/ccsrc/Protocols/UpperTester/UpperTesterRtcmemCodec.hh @@ -36,11 +36,11 @@ public: virtual ~UpperTesterRtcmemCodec(){}; virtual int encode(const Record_Type &, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, Record_Type &, params *params = NULL); - std::unique_ptr decode(const OCTETSTRING &data, params *params = NULL); + virtual int decode(const OCTETSTRING &data, Record_Type &, params_its *params = NULL); + std::unique_ptr decode(const OCTETSTRING &data, params_its *params = NULL); private: - int decode(const OCTETSTRING &data, LibItsRtcmem__TypesAndValues::UtRtcmemResults &msg, params *params = NULL); - int decode(const OCTETSTRING &data, LibItsRtcmem__TypesAndValues::UtRtcmemEventInd &msg, params *params = NULL); + int decode(const OCTETSTRING &data, LibItsRtcmem__TypesAndValues::UtRtcmemResults &msg, params_its *params = NULL); + int decode(const OCTETSTRING &data, LibItsRtcmem__TypesAndValues::UtRtcmemEventInd &msg, params_its *params = NULL); }; #endif diff --git a/ccsrc/Protocols/UpperTester/UpperTesterRtcmemLayer.cc b/ccsrc/Protocols/UpperTester/UpperTesterRtcmemLayer.cc index 0240f1b..243a8e5 100644 --- a/ccsrc/Protocols/UpperTester/UpperTesterRtcmemLayer.cc +++ b/ccsrc/Protocols/UpperTester/UpperTesterRtcmemLayer.cc @@ -12,7 +12,7 @@ UpperTesterRtcmemLayer::UpperTesterRtcmemLayer(const std::string &p_type, const params::convert(_params, param); } -void UpperTesterRtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemInitialize &send_par, params &p_params) { +void UpperTesterRtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemInitialize &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> UpperTesterRtcmemLayer::sendMsg", send_par); // Encode UpperTester PDU @@ -22,7 +22,7 @@ void UpperTesterRtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcme send_data(data, p_params); } -void UpperTesterRtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemTrigger &send_par, params &p_params) { +void UpperTesterRtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemTrigger& send_par, params_its& p_params) { loggers::get_instance().log_msg(">>> UpperTesterRtcmemLayer::sendMsg", send_par); // Encode UpperTester PDU @@ -32,7 +32,7 @@ void UpperTesterRtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcme send_data(data, p_params); } -void UpperTesterRtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemUpdate &send_par, params &p_params) { +void UpperTesterRtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemUpdate& send_par, params_its& p_params) { loggers::get_instance().log_msg(">>> UpperTesterRtcmemLayer::sendMsg", send_par); // Encode UpperTester PDU @@ -42,7 +42,7 @@ void UpperTesterRtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcme send_data(data, p_params); } -void UpperTesterRtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemTermination &send_par, params &p_params) { +void UpperTesterRtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemTermination &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> UpperTesterRtcmemLayer::sendMsg", send_par); // Encode UpperTester PDU @@ -52,16 +52,16 @@ void UpperTesterRtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcme send_data(data, p_params); } -void UpperTesterRtcmemLayer::send_data(OCTETSTRING &data, params &p_params) { - loggers::get_instance().log_msg(">>> UpperTesterRtcmemLayer::send_data: ", data); +void UpperTesterRtcmemLayer::send_data(OCTETSTRING& p_data, params_its& p_params) { + loggers::get_instance().log_msg(">>> UpperTesterRtcmemLayer::send_data: ", p_data); // params.log(); - send_to_all_layers(data, p_params); + send_to_all_layers(p_data, p_params); } -void UpperTesterRtcmemLayer::receive_data(OCTETSTRING &data, params &p_params) { - loggers::get_instance().log_msg(">>> UpperTesterRtcmemLayer::receive_data: ", data); +void UpperTesterRtcmemLayer::receive_data(OCTETSTRING& p_data, params_its& p_params) { + loggers::get_instance().log_msg(">>> UpperTesterRtcmemLayer::receive_data: ", p_data); - std::unique_ptr r = _codec.decode(data); + std::unique_ptr r = _codec.decode(p_data); if (r.get() != nullptr) { // Pass it to the ports if any to_all_upper_ports(*r, p_params); diff --git a/ccsrc/Protocols/UpperTester/UpperTesterRtcmemLayer.hh b/ccsrc/Protocols/UpperTester/UpperTesterRtcmemLayer.hh index af7a89c..7eb6cb9 100644 --- a/ccsrc/Protocols/UpperTester/UpperTesterRtcmemLayer.hh +++ b/ccsrc/Protocols/UpperTester/UpperTesterRtcmemLayer.hh @@ -1,8 +1,8 @@ #ifndef UpperTesterRtcmem_LAYER_H #define UpperTesterRtcmem_LAYER_H -#include "UpperTesterRtcmemCodec.hh" #include "t_layer.hh" +#include "UpperTesterRtcmemCodec.hh" namespace LibItsRtcmem__TestSystem { class UpperTesterPort; @@ -16,7 +16,7 @@ namespace LibItsRtcmem__TypesAndValues { } // namespace LibItsRtcmem__TypesAndValues class UpperTesterRtcmemLayer : public t_layer { - params _params; + params_its _params; UpperTesterRtcmemCodec _codec; public: @@ -24,13 +24,13 @@ public: UpperTesterRtcmemLayer(const std::string &p_type, const std::string ¶m); virtual ~UpperTesterRtcmemLayer(){}; - void sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemInitialize &send_par, params &p_params); - void sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemTrigger &send_par, params &p_params); - void sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemUpdate &send_par, params &p_params); - void sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemTermination &send_par, params &p_params); + void sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemInitialize &send_par, params_its& p_params); + void sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemTrigger &send_par, params_its& p_params); + void sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemUpdate &send_par, params_its& p_params); + void sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemTermination &send_par, params_its& p_params); - virtual void send_data(OCTETSTRING &data, params &p_params); - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void send_data(OCTETSTRING& p_data, params_its& p_params); + virtual void receive_data(OCTETSTRING& p_data, params_its& p_params); }; #endif diff --git a/ccsrc/Protocols/UpperTester/UpperTesterSremSsemCodec.cc b/ccsrc/Protocols/UpperTester/UpperTesterSremSsemCodec.cc index 7fdfc50..a5593ad 100644 --- a/ccsrc/Protocols/UpperTester/UpperTesterSremSsemCodec.cc +++ b/ccsrc/Protocols/UpperTester/UpperTesterSremSsemCodec.cc @@ -79,7 +79,7 @@ int UpperTesterSremSsemCodec::encode_(const Base_Type &type, const TTCN_Typedesc return 0; } -int UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, Record_Type &msg, params *params) { +int UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, Record_Type &msg, params_its *params) { loggers::get_instance().log_msg(">>> UpperTesterSremSsemCodec::decode (1): data=", data); TTCN_EncDec::clear_error(); @@ -93,7 +93,7 @@ int UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, Record_Type &msg, return 0; } -std::unique_ptr UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, params *params) { +std::unique_ptr UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, params_its *params) { loggers::get_instance().log_to_hexa(">>> UpperTesterSremSsemCodec::decode (2): decoding_buffer=", data); std::unique_ptr result; @@ -116,7 +116,7 @@ std::unique_ptr UpperTesterSremSsemCodec::decode(const OCTETSTRING &d return result; } -int UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, LibItsSremSsem__TypesAndValues::UtSremResults &msg, params *params) { +int UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, LibItsSremSsem__TypesAndValues::UtSremResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> UpperTesterSremSsemCodec::decode (3): decoding_buffer=", data); const unsigned char *ptr = static_cast(data); @@ -140,7 +140,7 @@ int UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, LibItsSremSsem__Ty return 0; } -int UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, LibItsSremSsem__TypesAndValues::UtSremEventInd &msg, params *params) { +int UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, LibItsSremSsem__TypesAndValues::UtSremEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> UpperTesterSremSsemCodec::decode (4): decoding_buffer=", data); const unsigned char *ptr = static_cast(data) + 1; @@ -157,7 +157,7 @@ int UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, LibItsSremSsem__Ty return 0; } -int UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, LibItsSremSsem__TypesAndValues::UtSsemEventInd &msg, params *params) { +int UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, LibItsSremSsem__TypesAndValues::UtSsemEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> UpperTesterSremSsemCodec::decode (5): decoding_buffer=", data); const unsigned char *ptr = static_cast(data) + 1; diff --git a/ccsrc/Protocols/UpperTester/UpperTesterSremSsemCodec.hh b/ccsrc/Protocols/UpperTester/UpperTesterSremSsemCodec.hh index 74aa064..481f7bf 100644 --- a/ccsrc/Protocols/UpperTester/UpperTesterSremSsemCodec.hh +++ b/ccsrc/Protocols/UpperTester/UpperTesterSremSsemCodec.hh @@ -37,12 +37,12 @@ public: virtual ~UpperTesterSremSsemCodec(){}; virtual int encode(const Record_Type &, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, Record_Type &, params *params = NULL); - std::unique_ptr decode(const OCTETSTRING &data, params *params = NULL); + virtual int decode(const OCTETSTRING &data, Record_Type &, params_its *params = NULL); + std::unique_ptr decode(const OCTETSTRING &data, params_its *params = NULL); private: - int decode(const OCTETSTRING &data, LibItsSremSsem__TypesAndValues::UtSremResults &msg, params *params = NULL); - int decode(const OCTETSTRING &data, LibItsSremSsem__TypesAndValues::UtSremEventInd &msg, params *params = NULL); - int decode(const OCTETSTRING &data, LibItsSremSsem__TypesAndValues::UtSsemEventInd &msg, params *params = NULL); + int decode(const OCTETSTRING &data, LibItsSremSsem__TypesAndValues::UtSremResults &msg, params_its *params = NULL); + int decode(const OCTETSTRING &data, LibItsSremSsem__TypesAndValues::UtSremEventInd &msg, params_its *params = NULL); + int decode(const OCTETSTRING &data, LibItsSremSsem__TypesAndValues::UtSsemEventInd &msg, params_its *params = NULL); }; #endif diff --git a/ccsrc/Protocols/UpperTester/UpperTesterSremSsemLayer.cc b/ccsrc/Protocols/UpperTester/UpperTesterSremSsemLayer.cc index 3c096f3..c706188 100644 --- a/ccsrc/Protocols/UpperTester/UpperTesterSremSsemLayer.cc +++ b/ccsrc/Protocols/UpperTester/UpperTesterSremSsemLayer.cc @@ -5,14 +5,14 @@ #include "loggers.hh" -UpperTesterSremSsemLayer::UpperTesterSremSsemLayer(const std::string &p_type, const std::string ¶m) +UpperTesterSremSsemLayer::UpperTesterSremSsemLayer(const std::string &p_type, const std::string &p_param) : t_layer(p_type), _params(), _codec() { - loggers::get_instance().log(">>> UpperTesterSremSsemLayer::UpperTesterSremSsemLayer: %s, %s", to_string().c_str(), param.c_str()); + loggers::get_instance().log(">>> UpperTesterSremSsemLayer::UpperTesterSremSsemLayer: %s, %s", to_string().c_str(), p_param.c_str()); // Setup parameters - params::convert(_params, param); + params::convert(_params, p_param); } -void UpperTesterSremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtSremInitialize &send_par, params &p_params) { +void UpperTesterSremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtSremInitialize &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> UpperTesterSremSsemLayer::sendMsg", send_par); // Encode UpperTester PDU @@ -22,7 +22,7 @@ void UpperTesterSremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtS send_data(data, p_params); } -void UpperTesterSremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtSremTrigger &send_par, params &p_params) { +void UpperTesterSremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtSremTrigger &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> UpperTesterSremSsemLayer::sendMsg", send_par); // Encode UpperTester PDU @@ -32,7 +32,7 @@ void UpperTesterSremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtS send_data(data, p_params); } -void UpperTesterSremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtSremUpdate &send_par, params &p_params) { +void UpperTesterSremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtSremUpdate &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> UpperTesterSremSsemLayer::sendMsg", send_par); // Encode UpperTester PDU @@ -42,7 +42,7 @@ void UpperTesterSremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtS send_data(data, p_params); } -void UpperTesterSremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtSremCancelation &send_par, params &p_params) { +void UpperTesterSremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtSremCancelation &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> UpperTesterSremSsemLayer::sendMsg", send_par); // Encode UpperTester PDU @@ -52,13 +52,13 @@ void UpperTesterSremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtS send_data(data, p_params); } -void UpperTesterSremSsemLayer::send_data(OCTETSTRING &data, params &p_params) { +void UpperTesterSremSsemLayer::send_data(OCTETSTRING &data, params_its &p_params) { loggers::get_instance().log_msg(">>> UpperTesterSremSsemLayer::send_data: ", data); // params.log(); send_to_all_layers(data, p_params); } -void UpperTesterSremSsemLayer::receive_data(OCTETSTRING &data, params &p_params) { +void UpperTesterSremSsemLayer::receive_data(OCTETSTRING &data, params_its &p_params) { loggers::get_instance().log_msg(">>> UpperTesterSremSsemLayer::receive_data: ", data); std::unique_ptr r = _codec.decode(data); diff --git a/ccsrc/Protocols/UpperTester/UpperTesterSremSsemLayer.hh b/ccsrc/Protocols/UpperTester/UpperTesterSremSsemLayer.hh index 59e010c..9798c01 100644 --- a/ccsrc/Protocols/UpperTester/UpperTesterSremSsemLayer.hh +++ b/ccsrc/Protocols/UpperTester/UpperTesterSremSsemLayer.hh @@ -16,7 +16,7 @@ namespace LibItsSremSsem__TypesAndValues { } // namespace LibItsSremSsem__TypesAndValues class UpperTesterSremSsemLayer : public t_layer { - params _params; + params_its _params; UpperTesterSremSsemCodec _codec; public: @@ -24,13 +24,13 @@ public: UpperTesterSremSsemLayer(const std::string &p_type, const std::string ¶m); virtual ~UpperTesterSremSsemLayer(){}; - void sendMsg(const LibItsSremSsem__TypesAndValues::UtSremInitialize &send_par, params &p_params); - void sendMsg(const LibItsSremSsem__TypesAndValues::UtSremTrigger &send_par, params &p_params); - void sendMsg(const LibItsSremSsem__TypesAndValues::UtSremUpdate &send_par, params &p_params); - void sendMsg(const LibItsSremSsem__TypesAndValues::UtSremCancelation &send_par, params &p_params); + void sendMsg(const LibItsSremSsem__TypesAndValues::UtSremInitialize &send_par, params_its& p_params); + void sendMsg(const LibItsSremSsem__TypesAndValues::UtSremTrigger &send_par, params_its& p_params); + void sendMsg(const LibItsSremSsem__TypesAndValues::UtSremUpdate &send_par, params_its& p_params); + void sendMsg(const LibItsSremSsem__TypesAndValues::UtSremCancelation &send_par, params_its& p_params); - virtual void send_data(OCTETSTRING &data, params &p_params); - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void send_data(OCTETSTRING& p_data, params_its& p_params); + virtual void receive_data(OCTETSTRING& p_data, params_its& p_params); }; #endif diff --git a/ccsrc/Protocols/UpperTester/module.mk b/ccsrc/Protocols/UpperTester/module.mk index 95d8e83..c013e3f 100644 --- a/ccsrc/Protocols/UpperTester/module.mk +++ b/ccsrc/Protocols/UpperTester/module.mk @@ -43,4 +43,4 @@ endif includes := . -modules += ../UDP +modules += ../../../framework/ccsrc/Protocols/UDP diff --git a/ccsrc/Protocols/UpperTester/uppertester_cam_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_cam_codec.cc index 3c2ec69..e35cd9a 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cam_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_cam_codec.cc @@ -213,7 +213,7 @@ int uppertester_cam_codec::encode_(const Base_Type &type, const TTCN_Typedescrip return 0; } -int uppertester_cam_codec::decode(const OCTETSTRING &data, Record_Type &msg, params *params) { +int uppertester_cam_codec::decode(const OCTETSTRING &data, Record_Type &msg, params_its *params) { TTCN_EncDec::clear_error(); TTCN_Buffer decoding_buffer(data); _params = params; @@ -225,7 +225,7 @@ int uppertester_cam_codec::decode(const OCTETSTRING &data, Record_Type &msg, par return 0; } -std::unique_ptr uppertester_cam_codec::decode(const OCTETSTRING &data, params *params) { +std::unique_ptr uppertester_cam_codec::decode(const OCTETSTRING &data, params_its *params) { std::unique_ptr result; @@ -246,7 +246,7 @@ std::unique_ptr uppertester_cam_codec::decode(const OCTETSTRING &data return result; } -int uppertester_cam_codec::decode(const OCTETSTRING &data, LibItsCam__TypesAndValues::UtCamResults &msg, params *params) { +int uppertester_cam_codec::decode(const OCTETSTRING &data, LibItsCam__TypesAndValues::UtCamResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_cam_codec::decode: decoding_buffer=", data); const unsigned char *ptr = static_cast(data); @@ -268,7 +268,7 @@ int uppertester_cam_codec::decode(const OCTETSTRING &data, LibItsCam__TypesAndVa return 0; } -int uppertester_cam_codec::decode(const OCTETSTRING &data, LibItsCam__TypesAndValues::UtCamEventInd &msg, params *params) { +int uppertester_cam_codec::decode(const OCTETSTRING &data, LibItsCam__TypesAndValues::UtCamEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_cam_codec::decode (1): decoding_buffer=", data); const unsigned char *ptr = static_cast(data) + 1; diff --git a/ccsrc/Protocols/UpperTester/uppertester_cam_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_cam_codec.hh index ccb5051..fb0579a 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cam_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_cam_codec.hh @@ -57,10 +57,10 @@ public: virtual int encode(const Record_Type &, OCTETSTRING &data); int encode(const LibItsCam__TypesAndValues::UtCamTrigger &, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, Record_Type &, params *params = NULL); - std::unique_ptr decode(const OCTETSTRING &data, params *params = NULL); + virtual int decode(const OCTETSTRING &data, Record_Type &, params_its *params = NULL); + std::unique_ptr decode(const OCTETSTRING &data, params_its *params = NULL); private: - int decode(const OCTETSTRING &data, LibItsCam__TypesAndValues::UtCamResults &msg, params *params = NULL); - int decode(const OCTETSTRING &data, LibItsCam__TypesAndValues::UtCamEventInd &msg, params *params = NULL); + int decode(const OCTETSTRING &data, LibItsCam__TypesAndValues::UtCamResults &msg, params_its *params = NULL); + int decode(const OCTETSTRING &data, LibItsCam__TypesAndValues::UtCamEventInd &msg, params_its *params = NULL); }; // End of class uppertester_cam_codec diff --git a/ccsrc/Protocols/UpperTester/uppertester_cam_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_cam_layer.cc index 9bb509f..e158db6 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cam_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_cam_layer.cc @@ -16,7 +16,7 @@ uppertester_cam_layer::uppertester_cam_layer(const std::string &p_type, const st } } -void uppertester_cam_layer::sendMsg(const LibItsCam__TypesAndValues::UtCamInitialize &send_par, params &p_params) { +void uppertester_cam_layer::sendMsg(const LibItsCam__TypesAndValues::UtCamInitialize &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_cam_layer::sendMsg", send_par); if (_params[params::loopback].compare("1") == 0) { @@ -32,7 +32,7 @@ void uppertester_cam_layer::sendMsg(const LibItsCam__TypesAndValues::UtCamInitia } } -void uppertester_cam_layer::sendMsg(const LibItsCam__TypesAndValues::UtCamChangePosition &send_par, params &p_params) { +void uppertester_cam_layer::sendMsg(const LibItsCam__TypesAndValues::UtCamChangePosition &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_cam_layer::sendMsg", send_par); if (_params[params::loopback].compare("1") == 0) { @@ -48,7 +48,7 @@ void uppertester_cam_layer::sendMsg(const LibItsCam__TypesAndValues::UtCamChange } } -void uppertester_cam_layer::sendMsg(const LibItsCam__TypesAndValues::UtCamTrigger &send_par, params &p_params) { +void uppertester_cam_layer::sendMsg(const LibItsCam__TypesAndValues::UtCamTrigger &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_cam_layer::sendMsg", send_par); if (_params[params::loopback].compare("1") == 0) { @@ -64,13 +64,13 @@ void uppertester_cam_layer::sendMsg(const LibItsCam__TypesAndValues::UtCamTrigge } } -void uppertester_cam_layer::send_data(OCTETSTRING &data, params &p_params) { +void uppertester_cam_layer::send_data(OCTETSTRING &data, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_cam_layer::send_data: ", data); // params.log(); send_to_all_layers(data, p_params); } -void uppertester_cam_layer::receive_data(OCTETSTRING &data, params &p_params) { +void uppertester_cam_layer::receive_data(OCTETSTRING &data, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_cam_layer::receive_data: ", data); std::unique_ptr r = _codec.decode(data); diff --git a/ccsrc/Protocols/UpperTester/uppertester_cam_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_cam_layer.hh index 90ab4dd..67db69b 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cam_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_cam_layer.hh @@ -26,7 +26,7 @@ namespace LibItsCam__TypesAndValues { } // namespace LibItsCam__TypesAndValues class uppertester_cam_layer : public t_layer { - params _params; + params_its _params; uppertester_cam_codec _codec; public: @@ -34,10 +34,10 @@ public: uppertester_cam_layer(const std::string &p_type, const std::string ¶m); virtual ~uppertester_cam_layer(){}; - void sendMsg(const LibItsCam__TypesAndValues::UtCamInitialize &send_par, params &p_params); - void sendMsg(const LibItsCam__TypesAndValues::UtCamChangePosition &send_par, params &p_params); - void sendMsg(const LibItsCam__TypesAndValues::UtCamTrigger &send_par, params &p_params); + void sendMsg(const LibItsCam__TypesAndValues::UtCamInitialize &send_par, params_its& p_params); + void sendMsg(const LibItsCam__TypesAndValues::UtCamChangePosition &send_par, params_its& p_params); + void sendMsg(const LibItsCam__TypesAndValues::UtCamTrigger &send_par, params_its& p_params); - virtual void send_data(OCTETSTRING &data, params &p_params); - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void send_data(OCTETSTRING &data, params_its& p_params); + virtual void receive_data(OCTETSTRING &data, params_its& info); }; // End of class uppertester_cam_layer diff --git a/ccsrc/Protocols/UpperTester/uppertester_debug_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_debug_layer.cc index d858c1e..e0b4135 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_debug_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_debug_layer.cc @@ -15,13 +15,13 @@ uppertester_debug_layer::uppertester_debug_layer(const std::string &p_type, cons uppertester_debug_layer::~uppertester_debug_layer() { loggers::get_instance().log(">>> uppertester_debug_layer::~uppertester_debug_layer"); } -void uppertester_debug_layer::send_data(OCTETSTRING &p_data, params &p_params) { +void uppertester_debug_layer::send_data(OCTETSTRING &p_data, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_debug_layer::send_data: ", p_data); receive_data(p_data, p_params); } -void uppertester_debug_layer::receive_data(OCTETSTRING &p_data, params &p_params) { +void uppertester_debug_layer::receive_data(OCTETSTRING &p_data, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_debug_layer::receive_data: ", p_data); OCTETSTRING data; diff --git a/ccsrc/Protocols/UpperTester/uppertester_debug_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_debug_layer.hh index 6fa59f9..5913b29 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_debug_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_debug_layer.hh @@ -1,5 +1,5 @@ /*! - * \file uppertester_debug_layer.hh + * \File uppertester_debug_layer.hh * \brief Header file for ITS UPPERTESTER_DEBUG/IP protocol layer definition. * \author ETSI STF525 * \copyright ETSI Copyright Notification @@ -47,7 +47,7 @@ public: //! \publicsection * \param[in] p_data The data to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - virtual void send_data(OCTETSTRING &p_data, params &p_params); + virtual void send_data(OCTETSTRING &p_data, params_its& p_params); /*! * \virtual * \fn void receive_data(OCTETSTRING& data, params& params); @@ -55,6 +55,6 @@ public: //! \publicsection * \param[in] p_data The bytes formated data received * \param[in] p_params Some lower layers parameters values when data was received */ - virtual void receive_data(OCTETSTRING &p_data, params &p_params); + virtual void receive_data(OCTETSTRING &p_data, params_its& p_params); }; // End of class uppertester_debug_layer diff --git a/ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc index b69f908..3c3646f 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc @@ -207,7 +207,7 @@ int uppertester_denm_codec::encode_(const Base_Type &type, const TTCN_Typedescri return 0; } -int uppertester_denm_codec::decode(const OCTETSTRING &data, Record_Type &msg, params *params) { +int uppertester_denm_codec::decode(const OCTETSTRING &data, Record_Type &msg, params_its *params) { TTCN_EncDec::clear_error(); TTCN_Buffer decoding_buffer(data); _params = params; @@ -219,7 +219,7 @@ int uppertester_denm_codec::decode(const OCTETSTRING &data, Record_Type &msg, pa return 0; } -std::unique_ptr uppertester_denm_codec::decode(const OCTETSTRING &data, params *params) { +std::unique_ptr uppertester_denm_codec::decode(const OCTETSTRING &data, params_its *params) { std::unique_ptr result; @@ -237,7 +237,7 @@ std::unique_ptr uppertester_denm_codec::decode(const OCTETSTRING &dat return result; } -int uppertester_denm_codec::decode(const OCTETSTRING &data, LibItsDenm__TypesAndValues::UtDenmResults &msg, params *params) { +int uppertester_denm_codec::decode(const OCTETSTRING &data, LibItsDenm__TypesAndValues::UtDenmResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_denm_codec::decode: decoding_buffer=", data); const unsigned char *ptr = static_cast(data); @@ -282,7 +282,7 @@ int uppertester_denm_codec::decode(const OCTETSTRING &data, LibItsDenm__TypesAnd return 0; } -int uppertester_denm_codec::decode(const OCTETSTRING &data, LibItsDenm__TypesAndValues::UtDenmEventInd &msg, params *params) { +int uppertester_denm_codec::decode(const OCTETSTRING &data, LibItsDenm__TypesAndValues::UtDenmEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_denm_codec::decode (1): decoding_buffer=", data); const unsigned char *ptr = static_cast(data) + 1; diff --git a/ccsrc/Protocols/UpperTester/uppertester_denm_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_denm_codec.hh index 839504b..6f5015d 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_denm_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_denm_codec.hh @@ -48,10 +48,10 @@ public: virtual ~uppertester_denm_codec(){}; virtual int encode(const Record_Type &, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, Record_Type &, params *params = NULL); - std::unique_ptr decode(const OCTETSTRING &data, params *params = NULL); + virtual int decode(const OCTETSTRING &data, Record_Type &, params_its *params = NULL); + std::unique_ptr decode(const OCTETSTRING &data, params_its *params = NULL); private: - int decode(const OCTETSTRING &data, LibItsDenm__TypesAndValues::UtDenmResults &msg, params *params = NULL); - int decode(const OCTETSTRING &data, LibItsDenm__TypesAndValues::UtDenmEventInd &msg, params *params = NULL); + int decode(const OCTETSTRING &data, LibItsDenm__TypesAndValues::UtDenmResults &msg, params_its *params = NULL); + int decode(const OCTETSTRING &data, LibItsDenm__TypesAndValues::UtDenmEventInd &msg, params_its *params = NULL); }; // End of class uppertester_denm_codec diff --git a/ccsrc/Protocols/UpperTester/uppertester_denm_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_denm_layer.cc index 4611aa9..820eba5 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_denm_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_denm_layer.cc @@ -15,16 +15,16 @@ uppertester_denm_layer::uppertester_denm_layer(const std::string &p_type, const if (it == _params.cend()) { _params.insert(std::pair(params::loopback, "0")); } - it = _params.find(params::station_id); + it = _params.find(params_its::station_id); if (it == _params.cend()) { - _params.insert(std::pair(params::station_id, "12345")); + _params.insert(std::pair(params_its::station_id, "12345")); } } // End of ctor -void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmInitialize &send_par, params &p_params) { +void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmInitialize &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_denm_layer::sendMsg", send_par); - if (_params[params::loopback].compare("1") == 0) { + if (_params[params_its::loopback].compare("1") == 0) { LibItsDenm__TypesAndValues::UtDenmResults ut_denm_results; ut_denm_results.utDenmInitializeResult() = BOOLEAN(true); to_all_upper_ports(ut_denm_results, p_params); @@ -37,10 +37,10 @@ void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmIni } } -void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmChangePosition &send_par, params &p_params) { +void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmChangePosition &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_denm_layer::sendMsg", send_par); - if (_params[params::loopback].compare("1") == 0) { + if (_params[params_its::loopback].compare("1") == 0) { LibItsDenm__TypesAndValues::UtDenmResults ut_denm_results; ut_denm_results.utDenmChangePositionResult() = BOOLEAN(true); to_all_upper_ports(ut_denm_results, p_params); @@ -53,10 +53,10 @@ void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmCha } } -void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmChangePseudonym &send_par, params &p_params) { +void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmChangePseudonym &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_denm_layer::sendMsg", send_par); - if (_params[params::loopback].compare("1") == 0) { + if (_params[params_its::loopback].compare("1") == 0) { LibItsDenm__TypesAndValues::UtDenmResults ut_denm_results; ut_denm_results.utDenmChangePseudonymResult() = BOOLEAN(true); to_all_upper_ports(ut_denm_results, p_params); @@ -69,11 +69,11 @@ void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmCha } } -void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmTrigger &send_par, params &p_params) { +void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmTrigger &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_denm_layer::sendMsg", send_par); - if (_params[params::loopback].compare("1") == 0) { - LibItsDenm__TypesAndValues::UtDenmTriggerResult trigger_result(true, ITS__Container::ActionID(std::stoi(_params[params::station_id]), 1)); + if (_params[params_its::loopback].compare("1") == 0) { + LibItsDenm__TypesAndValues::UtDenmTriggerResult trigger_result(true, ITS__Container::ActionID(std::stoi(_params[params_its::station_id]), 1)); LibItsDenm__TypesAndValues::UtDenmResults ut_denm_results; ut_denm_results.utDenmTriggerResult() = trigger_result; to_all_upper_ports(ut_denm_results, p_params); @@ -86,11 +86,11 @@ void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmTri } } -void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmUpdate &send_par, params &p_params) { +void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmUpdate &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_denm_layer::sendMsg", send_par); - if (_params[params::loopback].compare("1") == 0) { - LibItsDenm__TypesAndValues::UtDenmUpdateResult update_result(true, ITS__Container::ActionID(std::stoi(_params[params::station_id]), 1)); + if (_params[params_its::loopback].compare("1") == 0) { + LibItsDenm__TypesAndValues::UtDenmUpdateResult update_result(true, ITS__Container::ActionID(std::stoi(_params[params_its::station_id]), 1)); LibItsDenm__TypesAndValues::UtDenmResults ut_denm_results; ut_denm_results.utDenmUpdateResult() = update_result; to_all_upper_ports(ut_denm_results, p_params); @@ -103,10 +103,10 @@ void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmUpd } } -void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmTermination &send_par, params &p_params) { +void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmTermination &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_denm_layer::sendMsg", send_par); - if (_params[params::loopback].compare("1") == 0) { + if (_params[params_its::loopback].compare("1") == 0) { LibItsDenm__TypesAndValues::UtDenmResults ut_denm_results; ut_denm_results.utDenmTerminationResult() = BOOLEAN(true); to_all_upper_ports(ut_denm_results, p_params); @@ -119,16 +119,16 @@ void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmTer } } -void uppertester_denm_layer::send_data(OCTETSTRING &data, params &p_params) { - loggers::get_instance().log_msg(">>> uppertester_denm_layer::send_data: ", data); +void uppertester_denm_layer::send_data(OCTETSTRING& p_data, params_its& p_params) { + loggers::get_instance().log_msg(">>> uppertester_denm_layer::send_data: ", p_data); // params.log(); - send_to_all_layers(data, p_params); + send_to_all_layers(p_data, p_params); } -void uppertester_denm_layer::receive_data(OCTETSTRING &data, params &p_params) { - loggers::get_instance().log_msg(">>> uppertester_denm_layer::receive_data: ", data); +void uppertester_denm_layer::receive_data(OCTETSTRING& p_data, params_its &p_params) { + loggers::get_instance().log_msg(">>> uppertester_denm_layer::receive_data: ", p_data); - std::unique_ptr r = _codec.decode(data); + std::unique_ptr r = _codec.decode(p_data); if (r.get() != nullptr) { // Pass it to the ports if any to_all_upper_ports(*r, p_params); diff --git a/ccsrc/Protocols/UpperTester/uppertester_denm_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_denm_layer.hh index 94e927f..94464ed 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_denm_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_denm_layer.hh @@ -29,7 +29,7 @@ namespace LibItsDenm__TypesAndValues { } // namespace LibItsDenm__TypesAndValues class uppertester_denm_layer : public t_layer { - params _params; + params_its _params; uppertester_denm_codec _codec; public: @@ -37,13 +37,13 @@ public: uppertester_denm_layer(const std::string &p_type, const std::string ¶m); virtual ~uppertester_denm_layer(){}; - void sendMsg(const LibItsDenm__TypesAndValues::UtDenmInitialize &send_par, params &p_params); - void sendMsg(const LibItsDenm__TypesAndValues::UtDenmChangePosition &send_par, params &p_params); - void sendMsg(const LibItsDenm__TypesAndValues::UtDenmChangePseudonym &send_par, params &p_params); - void sendMsg(const LibItsDenm__TypesAndValues::UtDenmTrigger &send_par, params &p_params); - void sendMsg(const LibItsDenm__TypesAndValues::UtDenmUpdate &send_par, params &p_params); - void sendMsg(const LibItsDenm__TypesAndValues::UtDenmTermination &send_par, params &p_params); + void sendMsg(const LibItsDenm__TypesAndValues::UtDenmInitialize &send_par, params_its& p_params); + void sendMsg(const LibItsDenm__TypesAndValues::UtDenmChangePosition &send_par, params_its& p_params); + void sendMsg(const LibItsDenm__TypesAndValues::UtDenmChangePseudonym &send_par, params_its& p_params); + void sendMsg(const LibItsDenm__TypesAndValues::UtDenmTrigger &send_par, params_its& p_params); + void sendMsg(const LibItsDenm__TypesAndValues::UtDenmUpdate &send_par, params_its& p_params); + void sendMsg(const LibItsDenm__TypesAndValues::UtDenmTermination &send_par, params_its& p_params); - virtual void send_data(OCTETSTRING &data, params &p_params); - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void send_data(OCTETSTRING& p_data, params_its& p_params); + virtual void receive_data(OCTETSTRING& p_data, params_its& p_params); }; // End of class uppertester_denm_layer diff --git a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_codec.cc index 500330d..fc0d6fe 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_codec.cc @@ -119,7 +119,7 @@ int uppertester_geonetworking_codec::encode_(const Base_Type &type, const TTCN_T return 0; } -int uppertester_geonetworking_codec::decode(const OCTETSTRING &data, Record_Type &msg, params *params) { +int uppertester_geonetworking_codec::decode(const OCTETSTRING &data, Record_Type &msg, params_its *params) { loggers::get_instance().log_msg(">>> uppertester_geonetworking_codec::decode (1): ", data); TTCN_EncDec::clear_error(); @@ -133,7 +133,7 @@ int uppertester_geonetworking_codec::decode(const OCTETSTRING &data, Record_Type return 0; } -std::unique_ptr uppertester_geonetworking_codec::decode(const OCTETSTRING &data, params *params) { +std::unique_ptr uppertester_geonetworking_codec::decode(const OCTETSTRING &data, params_its *params) { loggers::get_instance().log_msg(">>> uppertester_geonetworking_codec::decode (2): ", data); std::unique_ptr result; @@ -155,7 +155,7 @@ std::unique_ptr uppertester_geonetworking_codec::decode(const OCTETST return result; } -int uppertester_geonetworking_codec::decode(const OCTETSTRING &data, LibItsGeoNetworking__TypesAndValues::UtGnResults &msg, params *params) { +int uppertester_geonetworking_codec::decode(const OCTETSTRING &data, LibItsGeoNetworking__TypesAndValues::UtGnResults &msg, params_its *params) { loggers::get_instance().log_msg(">>> uppertester_geonetworking_codec::decode (3): ", data); const unsigned char *ptr = static_cast(data); @@ -177,7 +177,7 @@ int uppertester_geonetworking_codec::decode(const OCTETSTRING &data, LibItsGeoNe return 0; } -int uppertester_geonetworking_codec::decode(const OCTETSTRING &data, LibItsGeoNetworking__TypesAndValues::UtGnEventInd &msg, params *params) { +int uppertester_geonetworking_codec::decode(const OCTETSTRING &data, LibItsGeoNetworking__TypesAndValues::UtGnEventInd &msg, params_its *params) { loggers::get_instance().log_msg(">>> uppertester_geonetworking_codec::decode (4): ", data); TTCN_EncDec::clear_error(); diff --git a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_codec.hh index 105b38d..1dda67e 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_codec.hh @@ -48,10 +48,10 @@ public: virtual int encode(const Record_Type &, OCTETSTRING &data); virtual int encode(const Base_Type &, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, Record_Type &, params *params = NULL); - virtual std::unique_ptr decode(const OCTETSTRING &data, params *params = NULL); + virtual int decode(const OCTETSTRING &data, Record_Type &, params_its *params = NULL); + virtual std::unique_ptr decode(const OCTETSTRING &data, params_its *params = NULL); private: - int decode(const OCTETSTRING &data, LibItsGeoNetworking__TypesAndValues::UtGnResults &msg, params *params = NULL); - int decode(const OCTETSTRING &data, LibItsGeoNetworking__TypesAndValues::UtGnEventInd &msg, params *params = NULL); + int decode(const OCTETSTRING &data, LibItsGeoNetworking__TypesAndValues::UtGnResults &msg, params_its *params = NULL); + int decode(const OCTETSTRING &data, LibItsGeoNetworking__TypesAndValues::UtGnEventInd &msg, params_its *params = NULL); }; // End of class uppertester_geonetworking_codec diff --git a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.cc index a4b069d..1e1093c 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.cc @@ -16,7 +16,7 @@ uppertester_geonetworking_layer::uppertester_geonetworking_layer(const std::stri } } -void uppertester_geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnInitialize &send_par, params &p_params) { +void uppertester_geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnInitialize &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_geonetworking_layer::sendMsg", send_par); if (_params[params::loopback].compare("1") == 0) { @@ -32,7 +32,7 @@ void uppertester_geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAn } } -void uppertester_geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnChangePosition &send_par, params &p_params) { +void uppertester_geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnChangePosition &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_geonetworking_layer::sendMsg", send_par); if (_params[params::loopback].compare("1") == 0) { @@ -48,7 +48,7 @@ void uppertester_geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAn } } -void uppertester_geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnTrigger &send_par, params &p_params) { +void uppertester_geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnTrigger &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_geonetworking_layer::sendMsg", send_par); if (_params[params::loopback].compare("1") == 0) { @@ -64,7 +64,7 @@ void uppertester_geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAn } } -void uppertester_geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::UtAutoInteropTrigger &send_par, params &p_params) { +void uppertester_geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::UtAutoInteropTrigger &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_geonetworking_layer::sendMsg", send_par); if (_params[params::loopback].compare("1") == 0) { @@ -80,13 +80,13 @@ void uppertester_geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAn } } -void uppertester_geonetworking_layer::send_data(OCTETSTRING &data, params &p_params) { +void uppertester_geonetworking_layer::send_data(OCTETSTRING &data, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_geonetworking_layer::send_data: ", data); // params.log(); send_to_all_layers(data, p_params); } -void uppertester_geonetworking_layer::receive_data(OCTETSTRING &data, params &p_params) { +void uppertester_geonetworking_layer::receive_data(OCTETSTRING &data, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_geonetworking_layer::receive_data: ", data); std::unique_ptr r = _codec.decode(data); if (r.get() != nullptr) { diff --git a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.hh index ff27544..ca7ed34 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.hh @@ -25,7 +25,7 @@ namespace LibItsGeoNetworking__TypesAndValues { } // namespace LibItsGeoNetworking__TypesAndValues class uppertester_geonetworking_layer : public t_layer { - params _params; + params_its _params; uppertester_geonetworking_codec _codec; public: @@ -33,11 +33,11 @@ public: uppertester_geonetworking_layer(const std::string &p_type, const std::string ¶m); virtual ~uppertester_geonetworking_layer(){}; - void sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnInitialize &send_par, params &p_params); - void sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnChangePosition &send_par, params &p_params); - void sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnTrigger &send_par, params &p_params); - void sendMsg(const LibItsGeoNetworking__TypesAndValues::UtAutoInteropTrigger &send_par, params &p_params); + void sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnInitialize &send_par, params_its& p_params); + void sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnChangePosition &send_par, params_its& p_params); + void sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnTrigger &send_par, params_its& p_params); + void sendMsg(const LibItsGeoNetworking__TypesAndValues::UtAutoInteropTrigger &send_par, params_its& p_params); - virtual void send_data(OCTETSTRING &data, params &p_params); - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void send_data(OCTETSTRING &data, params_its& p_params); + virtual void receive_data(OCTETSTRING &data, params_its& p_params); }; // End of class uppertester_geonetworking_layer diff --git a/ccsrc/Protocols/UpperTester/uppertester_ivim_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_ivim_codec.cc index 855f91b..ede8af8 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_ivim_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_ivim_codec.cc @@ -193,7 +193,7 @@ int uppertester_ivim_codec::encode_(const Base_Type &type, const TTCN_Typedescri return 0; } -int uppertester_ivim_codec::decode(const OCTETSTRING &data, Record_Type &msg, params *params) { +int uppertester_ivim_codec::decode(const OCTETSTRING &data, Record_Type &msg, params_its *params) { TTCN_EncDec::clear_error(); TTCN_Buffer decoding_buffer(data); _params = params; @@ -205,7 +205,7 @@ int uppertester_ivim_codec::decode(const OCTETSTRING &data, Record_Type &msg, pa return 0; } -std::unique_ptr uppertester_ivim_codec::decode(const OCTETSTRING &data, params *params) { +std::unique_ptr uppertester_ivim_codec::decode(const OCTETSTRING &data, params_its *params) { std::unique_ptr result; @@ -223,7 +223,7 @@ std::unique_ptr uppertester_ivim_codec::decode(const OCTETSTRING &dat return result; } -int uppertester_ivim_codec::decode(const OCTETSTRING &data, LibItsIvim__TypesAndValues::UtIvimResults &msg, params *params) { +int uppertester_ivim_codec::decode(const OCTETSTRING &data, LibItsIvim__TypesAndValues::UtIvimResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_ivim_codec::decode: decoding_buffer=", data); const unsigned char *ptr = static_cast(data); @@ -260,7 +260,7 @@ int uppertester_ivim_codec::decode(const OCTETSTRING &data, LibItsIvim__TypesAnd return 0; } -int uppertester_ivim_codec::decode(const OCTETSTRING &data, LibItsIvim__TypesAndValues::UtIvimEventInd &msg, params *params) { +int uppertester_ivim_codec::decode(const OCTETSTRING &data, LibItsIvim__TypesAndValues::UtIvimEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_ivim_codec::decode: decoding_buffer=", data); const unsigned char *ptr = static_cast(data) + 1; diff --git a/ccsrc/Protocols/UpperTester/uppertester_ivim_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_ivim_codec.hh index 76d579c..c97b370 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_ivim_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_ivim_codec.hh @@ -44,10 +44,10 @@ public: virtual ~uppertester_ivim_codec(){}; virtual int encode(const Record_Type &, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, Record_Type &, params *params = NULL); - std::unique_ptr decode(const OCTETSTRING &data, params *params = NULL); + virtual int decode(const OCTETSTRING &data, Record_Type &, params_its *params = NULL); + std::unique_ptr decode(const OCTETSTRING &data, params_its *params = NULL); private: - int decode(const OCTETSTRING &data, LibItsIvim__TypesAndValues::UtIvimResults &msg, params *params = NULL); - int decode(const OCTETSTRING &data, LibItsIvim__TypesAndValues::UtIvimEventInd &msg, params *params = NULL); + int decode(const OCTETSTRING &data, LibItsIvim__TypesAndValues::UtIvimResults &msg, params_its *params = NULL); + int decode(const OCTETSTRING &data, LibItsIvim__TypesAndValues::UtIvimEventInd &msg, params_its *params = NULL); }; // End of class uppertester_ivim_codec diff --git a/ccsrc/Protocols/UpperTester/uppertester_ivim_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_ivim_layer.cc index d5d7a39..db864df 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_ivim_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_ivim_layer.cc @@ -12,7 +12,7 @@ uppertester_ivim_layer::uppertester_ivim_layer(const std::string &p_type, const params::convert(_params, param); } -void uppertester_ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimInitialize &send_par, params &p_params) { +void uppertester_ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimInitialize &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_ivim_layer::sendMsg", send_par); // Encode UpperTester PDU @@ -22,7 +22,7 @@ void uppertester_ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimIni send_data(data, p_params); } -void uppertester_ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimTrigger &send_par, params &p_params) { +void uppertester_ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimTrigger &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_ivim_layer::sendMsg", send_par); // Encode UpperTester PDU @@ -32,7 +32,7 @@ void uppertester_ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimTri send_data(data, p_params); } -void uppertester_ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimUpdate &send_par, params &p_params) { +void uppertester_ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimUpdate &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_ivim_layer::sendMsg", send_par); // Encode UpperTester PDU @@ -42,7 +42,7 @@ void uppertester_ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimUpd send_data(data, p_params); } -void uppertester_ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimTermination &send_par, params &p_params) { +void uppertester_ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimTermination &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_ivim_layer::sendMsg", send_par); // Encode UpperTester PDU @@ -52,13 +52,13 @@ void uppertester_ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimTer send_data(data, p_params); } -void uppertester_ivim_layer::send_data(OCTETSTRING &data, params &p_params) { +void uppertester_ivim_layer::send_data(OCTETSTRING &data, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_ivim_layer::send_data: ", data); // params.log(); send_to_all_layers(data, p_params); } -void uppertester_ivim_layer::receive_data(OCTETSTRING &data, params &p_params) { +void uppertester_ivim_layer::receive_data(OCTETSTRING &data, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_ivim_layer::receive_data: ", data); std::unique_ptr r = _codec.decode(data); diff --git a/ccsrc/Protocols/UpperTester/uppertester_ivim_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_ivim_layer.hh index 8642d10..97aa96c 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_ivim_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_ivim_layer.hh @@ -25,7 +25,7 @@ namespace LibItsIvim__TypesAndValues { } // namespace LibItsIvim__TypesAndValues class uppertester_ivim_layer : public t_layer { - params _params; + params_its _params; uppertester_ivim_codec _codec; public: @@ -33,11 +33,11 @@ public: uppertester_ivim_layer(const std::string &p_type, const std::string ¶m); virtual ~uppertester_ivim_layer(){}; - void sendMsg(const LibItsIvim__TypesAndValues::UtIvimInitialize &send_par, params &p_params); - void sendMsg(const LibItsIvim__TypesAndValues::UtIvimTrigger &send_par, params &p_params); - void sendMsg(const LibItsIvim__TypesAndValues::UtIvimUpdate &send_par, params &p_params); - void sendMsg(const LibItsIvim__TypesAndValues::UtIvimTermination &send_par, params &p_params); + void sendMsg(const LibItsIvim__TypesAndValues::UtIvimInitialize &send_par, params_its& p_params); + void sendMsg(const LibItsIvim__TypesAndValues::UtIvimTrigger &send_par, params_its& p_params); + void sendMsg(const LibItsIvim__TypesAndValues::UtIvimUpdate &send_par, params_its& p_params); + void sendMsg(const LibItsIvim__TypesAndValues::UtIvimTermination &send_par, params_its& p_params); - virtual void send_data(OCTETSTRING &data, params &p_params); - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void send_data(OCTETSTRING &data, params_its& p_params); + virtual void receive_data(OCTETSTRING &data, params_its& info); }; // End of class uppertester_ivim_layer diff --git a/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_codec.cc index ea40677..d31780d 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_codec.cc @@ -113,7 +113,7 @@ int uppertester_mapem_spatem_codec::encode_(const Base_Type &type, const TTCN_Ty return 0; } -int uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, Record_Type &msg, params *params) { +int uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, Record_Type &msg, params_its *params) { TTCN_EncDec::clear_error(); TTCN_Buffer decoding_buffer(data); _params = params; @@ -125,7 +125,7 @@ int uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, Record_Type return 0; } -std::unique_ptr uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, params *params) { +std::unique_ptr uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, params_its *params) { std::unique_ptr result; @@ -147,7 +147,7 @@ std::unique_ptr uppertester_mapem_spatem_codec::decode(const OCTETSTR return result; } -int uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, LibItsMapemSpatem__TypesAndValues::UtMapemSpatemResults &msg, params *params) { +int uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, LibItsMapemSpatem__TypesAndValues::UtMapemSpatemResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_mapem_spatem_codec::decode: decoding_buffer=", data); const unsigned char *ptr = static_cast(data); @@ -163,7 +163,7 @@ int uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, LibItsMapemS return 0; } -int uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, LibItsMapemSpatem__TypesAndValues::UtMapemEventInd &msg, params *params) { +int uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, LibItsMapemSpatem__TypesAndValues::UtMapemEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_mapem_spatem_codec::decode: decoding_buffer=", data); const unsigned char *ptr = static_cast(data) + 1; @@ -180,7 +180,7 @@ int uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, LibItsMapemS return 0; } -int uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, LibItsMapemSpatem__TypesAndValues::UtSpatemEventInd &msg, params *params) { +int uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, LibItsMapemSpatem__TypesAndValues::UtSpatemEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_mapem_spatem_codec::decode: decoding_buffer=", data); const unsigned char *ptr = static_cast(data) + 1; diff --git a/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_codec.hh index 99d275a..6e59a04 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_codec.hh @@ -42,11 +42,11 @@ public: virtual ~uppertester_mapem_spatem_codec(){}; virtual int encode(const Record_Type &, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, Record_Type &, params *params = NULL); - std::unique_ptr decode(const OCTETSTRING &data, params *params = NULL); + virtual int decode(const OCTETSTRING &data, Record_Type &, params_its *params = NULL); + std::unique_ptr decode(const OCTETSTRING &data, params_its *params = NULL); private: - int decode(const OCTETSTRING &data, LibItsMapemSpatem__TypesAndValues::UtMapemSpatemResults &msg, params *params = NULL); - int decode(const OCTETSTRING &data, LibItsMapemSpatem__TypesAndValues::UtMapemEventInd &msg, params *params = NULL); - int decode(const OCTETSTRING &data, LibItsMapemSpatem__TypesAndValues::UtSpatemEventInd &msg, params *params = NULL); + int decode(const OCTETSTRING &data, LibItsMapemSpatem__TypesAndValues::UtMapemSpatemResults &msg, params_its *params = NULL); + int decode(const OCTETSTRING &data, LibItsMapemSpatem__TypesAndValues::UtMapemEventInd &msg, params_its *params = NULL); + int decode(const OCTETSTRING &data, LibItsMapemSpatem__TypesAndValues::UtSpatemEventInd &msg, params_its *params = NULL); }; // End of class uppertester_mapem_spatem_codec diff --git a/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_layer.cc index 3d41426..68580cb 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_layer.cc @@ -12,7 +12,7 @@ uppertester_mapem_spatem_layer::uppertester_mapem_spatem_layer(const std::string params::convert(_params, param); } -void uppertester_mapem_spatem_layer::sendMsg(const LibItsMapemSpatem__TypesAndValues::UtMapemSpatemInitialize &send_par, params &p_params) { +void uppertester_mapem_spatem_layer::sendMsg(const LibItsMapemSpatem__TypesAndValues::UtMapemSpatemInitialize &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_mapem_spatem_layer::sendMsg", send_par); // Encode UpperTester PDU @@ -22,7 +22,7 @@ void uppertester_mapem_spatem_layer::sendMsg(const LibItsMapemSpatem__TypesAndVa send_data(data, p_params); } -void uppertester_mapem_spatem_layer::sendMsg(const LibItsMapemSpatem__TypesAndValues::UtMapemSpatemTrigger &send_par, params &p_params) { +void uppertester_mapem_spatem_layer::sendMsg(const LibItsMapemSpatem__TypesAndValues::UtMapemSpatemTrigger &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_mapem_spatem_layer::sendMsg", send_par); // Encode UpperTester PDU @@ -32,16 +32,16 @@ void uppertester_mapem_spatem_layer::sendMsg(const LibItsMapemSpatem__TypesAndVa send_data(data, p_params); } -void uppertester_mapem_spatem_layer::send_data(OCTETSTRING &data, params &p_params) { - loggers::get_instance().log_msg(">>> uppertester_mapem_spatem_layer::send_data: ", data); +void uppertester_mapem_spatem_layer::send_data(OCTETSTRING& p_data, params_its &p_params) { + loggers::get_instance().log_msg(">>> uppertester_mapem_spatem_layer::send_data: ", p_data); // params.log(); - send_to_all_layers(data, p_params); + send_to_all_layers(p_data, p_params); } -void uppertester_mapem_spatem_layer::receive_data(OCTETSTRING &data, params &p_params) { - loggers::get_instance().log_msg(">>> uppertester_mapem_spatem_layer::receive_data: ", data); +void uppertester_mapem_spatem_layer::receive_data(OCTETSTRING& p_data, params_its &p_params) { + loggers::get_instance().log_msg(">>> uppertester_mapem_spatem_layer::receive_data: ", p_data); - std::unique_ptr r = _codec.decode(data); + std::unique_ptr r = _codec.decode(p_data); if (r.get() != nullptr) { // Pass it to the ports if any to_all_upper_ports(*r, p_params); diff --git a/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_layer.hh index e2b0cc7..b42ca3e 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_layer.hh @@ -24,7 +24,7 @@ namespace LibItsMapemSpatem__TypesAndValues { } // namespace LibItsMapemSpatem__TypesAndValues class uppertester_mapem_spatem_layer : public t_layer { - params _params; + params_its _params; uppertester_mapem_spatem_codec _codec; public: @@ -32,9 +32,9 @@ public: uppertester_mapem_spatem_layer(const std::string &p_type, const std::string ¶m); virtual ~uppertester_mapem_spatem_layer(){}; - void sendMsg(const LibItsMapemSpatem__TypesAndValues::UtMapemSpatemInitialize &send_par, params &p_params); - void sendMsg(const LibItsMapemSpatem__TypesAndValues::UtMapemSpatemTrigger &send_par, params &p_params); + void sendMsg(const LibItsMapemSpatem__TypesAndValues::UtMapemSpatemInitialize &send_par, params_its& p_params); + void sendMsg(const LibItsMapemSpatem__TypesAndValues::UtMapemSpatemTrigger &send_par, params_its& p_params); - virtual void send_data(OCTETSTRING &data, params &p_params); - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void send_data(OCTETSTRING& data, params_its& p_params); + virtual void receive_data(OCTETSTRING& p_data, params_its& p_params); }; // End of class uppertester_mapem_spatem_layer diff --git a/ccsrc/Protocols/UpperTester/uppertester_pki_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_pki_codec.cc index 408816e..dba1323 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_pki_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_pki_codec.cc @@ -112,7 +112,7 @@ int uppertester_pki_codec::encode_(const Base_Type &type, const TTCN_Typedescrip return 0; } -int uppertester_pki_codec::decode(const OCTETSTRING &data, Record_Type &msg, params *params) { +int uppertester_pki_codec::decode(const OCTETSTRING &data, Record_Type &msg, params_its *params) { TTCN_EncDec::clear_error(); TTCN_Buffer decoding_buffer(data); _params = params; @@ -124,7 +124,7 @@ int uppertester_pki_codec::decode(const OCTETSTRING &data, Record_Type &msg, par return 0; } -std::unique_ptr uppertester_pki_codec::decode(const OCTETSTRING &data, params *params) { +std::unique_ptr uppertester_pki_codec::decode(const OCTETSTRING &data, params_its *params) { std::unique_ptr result; diff --git a/ccsrc/Protocols/UpperTester/uppertester_pki_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_pki_codec.hh index 19ba0c8..f1bc1ad 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_pki_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_pki_codec.hh @@ -45,6 +45,6 @@ public: virtual int encode(const Record_Type &, OCTETSTRING &data); int encode(const LibItsPki__TypesAndValues::UtPkiTrigger &, OCTETSTRING &data); int encode(const LibItsPki__TypesAndValues::UtPkiTriggerInd &, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, Record_Type &, params *params = NULL); - std::unique_ptr decode(const OCTETSTRING &data, params *params = NULL); + virtual int decode(const OCTETSTRING &data, Record_Type &, params_its *params = NULL); + std::unique_ptr decode(const OCTETSTRING &data, params_its *params = NULL); }; // End of class uppertester_pki_codec diff --git a/ccsrc/Protocols/UpperTester/uppertester_pki_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_pki_layer.hh index 44edffd..88d169b 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_pki_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_pki_layer.hh @@ -33,10 +33,10 @@ public: uppertester_pki_layer(const std::string &p_type, const std::string ¶m); virtual ~uppertester_pki_layer(){}; - void sendMsg(const LibItsPki__TypesAndValues::UtPkiInitialize &send_par, params &p_params); - void sendMsg(const LibItsPki__TypesAndValues::UtPkiTrigger &send_par, params &p_params); - void sendMsg(const LibItsPki__TypesAndValues::UtPkiTriggerInd &send_par, params &p_params); + void sendMsg(const LibItsPki__TypesAndValues::UtPkiInitialize &send_par, params& p_params); + void sendMsg(const LibItsPki__TypesAndValues::UtPkiTrigger &send_par, params& p_params); + void sendMsg(const LibItsPki__TypesAndValues::UtPkiTriggerInd &send_par, params& p_params); - virtual void send_data(OCTETSTRING &data, params &p_params); - virtual void receive_data(OCTETSTRING &data, params &info); + virtual void send_data(OCTETSTRING &data, params& p_params); + virtual void receive_data(OCTETSTRING &data, params& params); }; // End of class uppertester_pki_layer diff --git a/ccsrc/Framework/include/codec.hh b/ccsrc/framework/include/codec.hh similarity index 86% rename from ccsrc/Framework/include/codec.hh rename to ccsrc/framework/include/codec.hh index 912293b..46ad324 100644 --- a/ccsrc/Framework/include/codec.hh +++ b/ccsrc/framework/include/codec.hh @@ -10,7 +10,7 @@ */ #pragma once -#include "params.hh" +#include "params_its.hh" class OCTETSTRING; //! Declare TITAN class class CHARSTRING; //! Declare TITAN class @@ -23,8 +23,8 @@ class BITSTRING; //! Declare TITAN class */ template class codec { protected: - params *_params; //! Reference to params stack - // \todo Use smart pointer std::unique_ptr + params_its *_params; //! Reference to params stack + // \todo Use smart pointer std::unique_ptr public: //! \publicsection /*! @@ -50,12 +50,12 @@ public: //! \publicsection */ virtual int encode(const TPDUEnc &p_message, OCTETSTRING &p_data) = 0; /*! - * \fn int decode(const OCTETSTRING& p_, TPDUDec& p_message, params* p_params = NULL); + * \fn int decode(const OCTETSTRING& p_, TPDUDec& p_message, params_its* p_params = NULL); * \brief Encode typed message into an octet string format * \param[in] p_data The message in its octet string * \param[out] p_message The decoded typed message * \return 0 on success, -1 otherwise * \pure */ - virtual int decode(const OCTETSTRING &p_, TPDUDec &p_message, params *p_params = NULL) = 0; + virtual int decode(const OCTETSTRING &p_, TPDUDec &p_message, params_its *p_params = NULL) = 0; }; // End of class codec diff --git a/ccsrc/Framework/include/data_event_notifier.hh b/ccsrc/framework/include/data_event_notifier.hh similarity index 65% rename from ccsrc/Framework/include/data_event_notifier.hh rename to ccsrc/framework/include/data_event_notifier.hh index 4389dfd..7883b8f 100644 --- a/ccsrc/Framework/include/data_event_notifier.hh +++ b/ccsrc/framework/include/data_event_notifier.hh @@ -1,11 +1,11 @@ #pragma once -#include "params.hh" +#include "params_its.hh" class OCTETSTRING; //! Forward declaration of TITAN class class data_event_notifier { public: virtual ~data_event_notifier() = default; - virtual void update(OCTETSTRING &p_data, params &p_params) {}; + virtual void update(OCTETSTRING &p_data, params_its &p_params) {}; }; // End of abstract class data_event_notifier diff --git a/ccsrc/Framework/include/data_event_observer.hh b/ccsrc/framework/include/data_event_observer.hh similarity index 93% rename from ccsrc/Framework/include/data_event_observer.hh rename to ccsrc/framework/include/data_event_observer.hh index 49fe19a..d33b66c 100644 --- a/ccsrc/Framework/include/data_event_observer.hh +++ b/ccsrc/framework/include/data_event_observer.hh @@ -15,5 +15,5 @@ public: virtual ~data_event_observer() { _observers.clear(); }; virtual void incoming_packet_observer_attach(data_event_notifier* p_observer) {}; virtual void incoming_packet_observer_detach(data_event_notifier* p_observer) {}; - virtual void incoming_packet_notify(OCTETSTRING &p_data, params &p_params) {}; + virtual void incoming_packet_notify(OCTETSTRING &p_data, params_its &p_params) {}; }; // End of abstract class data_event_observer diff --git a/ccsrc/Framework/include/params.hh b/ccsrc/framework/include/params_its.hh similarity index 61% rename from ccsrc/Framework/include/params.hh rename to ccsrc/framework/include/params_its.hh index 8d7ee3f..b96dd3f 100644 --- a/ccsrc/Framework/include/params.hh +++ b/ccsrc/framework/include/params_its.hh @@ -1,5 +1,5 @@ /*! - * \file params.hh + * \file params_its.hh * \brief Header file for the parameter dictionary. * \author ETSI STF525 * \copyright ETSI Copyright Notification @@ -14,25 +14,15 @@ #include #include +#include "params.hh" + /*! - * \class params + * \class params_its * \brief This class provides basic functionalities for an ITS dictionary - * \implements std::map */ -class params : public std::map { +class params_its : public params { public: //! \publicsection - // TODO Use static constexpr (see commsignia_layer.hh) - static const std::string& debug; //! Set to 1 to enable the debug mode - - static const std::string& loopback; - - static const std::string& mac_src; //! Source MAC address parameter name - static const std::string& mac_dst; //! Destination MAC address parameter name - static const std::string& mac_bc; //! Broadcast MAC address parameter name - static const std::string& eth_type; //! Ethernet type parameter name - static const std::string& filter; //! Additinal PCAP filter static const std::string& beaconing; //! Beaconing mode parameter name - static const std::string& timestamp; //! Packet reception timestamp static const std::string& station_type; static const std::string& country; static const std::string& type_of_address; @@ -49,7 +39,6 @@ public: //! \publicsection static const std::string& btp_destination_port; //! BTP DestinationPort parameter name static const std::string& btp_info; //! BTP Info parameter name - static const std::string& nic; //! Network Interface Card parameter name static const std::string& ll_address; //! Test system GeoNetworking LL-Address parameter name static const std::string& latitude; //! Test system Latitude parameter name static const std::string& longitude; //! Test system Longitude parameter name @@ -88,59 +77,15 @@ public: //! \publicsection static const std::string& mqtt_protocol; //! Uu interafce MQTT protocol name static const std::string& mqtt_client_id; //! Uu interafce MQTT client identity - static const std::string& server; //! HTTP server address (e.g. www.etsi.org) - static const std::string& port; //! HTTP server port. Default: 80 - static const std::string& use_ssl; //! Set to 1 to use SSL to communicate with the HTTP server. Default: false - static const std::string& mutual_auth; //! Set to 1 to use mutual authentication. Default: false - static const std::string& trusted_ca_list; //! List of trusted CA certificates - static const std::string& server_mode; //! Does the test sytem acting as a server. Default: 0 - static const std::string& local_port; //! Local listener port. Default: 80 - - static const std::string& method; //! HTTP method type. Default: POST - static const std::string& uri; //! HTTP URI value. Default: / - static const std::string& host; //! HTTP Host value. Default: 127.0.0.1 - static const std::string& content_type; //! HTTP Content-type value. Default: application/text - - static const std::string& codecs; //! List of codecs to use for HTTP application layers - /*! * \brief Default constructor - * Create a new instance of the params class - */ - params() : std::map(){}; - /*! - * \brief Copy constructor - * Clone an existing instance of a params object - * \param[in] p_params An existing instance of a params object + * Create a new instance of the params_its class */ - explicit params(const params &p_params) : std::map(p_params.begin(), p_params.end()){}; + params_its() : params() {}; /*! * \brief Default destructor */ - virtual ~params(){}; + virtual ~params_its(){}; - /*! - * \fn void log() const; - * \brief Provides a dump of the content of this instance - */ - void log() const; - /*! - * \fn void log() const; - * \brief Provides a dump of the content of this instance - */ - void log(); - /*! - * \fn void reset(); - * \brief Reset the content of this instance - */ - void reset(); - - /*! - * \static - * \fn void convert(params& p_param, const std::string p_parameters); - * \brief Create a new instance of a params object by converting a list of ITS parameters in string format (t1=v1,T2=(v0,v1v2)...) - * \return a new instance of a params object - */ - static void convert(params &p_param, const std::string p_parameters); -}; // End of class params +}; // End of class params_its diff --git a/ccsrc/framework/module.mk b/ccsrc/framework/module.mk new file mode 100644 index 0000000..2f19f52 --- /dev/null +++ b/ccsrc/framework/module.mk @@ -0,0 +1,2 @@ +sources := src/params_its.cc +includes += ./include diff --git a/ccsrc/framework/src/params_its.cc b/ccsrc/framework/src/params_its.cc new file mode 100644 index 0000000..4b066fb --- /dev/null +++ b/ccsrc/framework/src/params_its.cc @@ -0,0 +1,69 @@ +/*! + * \file param_sits.cc + * \brief Source file for the parameter dictionary. + * \author ETSI STF525 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ +#include +#include + +#include "loggers.hh" +#include "params_its.hh" + +const std::string& params_its::beaconing = std::string("beaconing"); +const std::string& params_its::station_type = std::string("station_type"); +const std::string& params_its::country = std::string("country"); +const std::string& params_its::type_of_address = std::string("type_of_address"); +const std::string& params_its::its_aid = std::string("its_aid"); +const std::string& params_its::ssp = std::string("ssp"); +const std::string& params_its::gn_payload = std::string("gn_payload"); +const std::string& params_its::gn_next_header = std::string("gnNextHeader"); +const std::string& params_its::gn_header_type = std::string("gnHeaderType"); +const std::string& params_its::gn_header_sub_type = std::string("gnHeaderSubtype"); +const std::string& params_its::gn_lifetime = std::string("gnLifetime"); +const std::string& params_its::gn_traffic_class = std::string("gnTrafficClass"); +const std::string& params_its::btp_type = std::string("btp_type"); +const std::string& params_its::btp_payload = std::string("btp_payload"); +const std::string& params_its::btp_destination_port = std::string("dst_port"); +const std::string& params_its::btp_info = std::string("btp_info"); + +const std::string& params_its::latitude = std::string("latitude"); +const std::string& params_its::longitude = std::string("longitude"); +const std::string& params_its::ll_address = std::string("ll_address"); +const std::string& params_its::expiry = std::string("expiry"); + +const std::string& params_its::station_id = std::string("station_id"); + +const std::string& params_its::device_mode = std::string("device_mode"); +const std::string& params_its::secured_mode = std::string("secured_mode"); +const std::string& params_its::encrypted_mode = std::string("encrypted_mode"); +const std::string& params_its::enable_security_checks = std::string("enable_security_checks"); +const std::string& params_its::force_certificate = std::string("force_certificate"); +const std::string& params_its::certificate = std::string("certificate"); +const std::string& params_its::peer_certificate = std::string("peer_certificate"); +const std::string& params_its::sec_db_path = std::string("sec_db_path"); +const std::string& params_its::hash = std::string("hash"); +const std::string& params_its::signature = std::string("signature"); +const std::string& params_its::cypher = std::string("cypher"); +const std::string& params_its::distanceA = std::string("distanceA"); +const std::string& params_its::distanceB = std::string("distanceB"); +const std::string& params_its::angle = std::string("angle"); + +const std::string& params_its::payload_type = std::string("payload_type"); + +const std::string& params_its::next_header = std::string("next_header"); +const std::string& params_its::header_type = std::string("header_type"); +const std::string& params_its::header_sub_type = std::string("header_sub_type"); + +const std::string& params_its::interface_id = std::string("interface_id"); + +const std::string& params_its::uu_protocol = std::string("uu_protocol"); +const std::string& params_its::uu_transport = std::string("uu_transport"); +const std::string& params_its::pc5_layer = std::string("pc5_layer"); +const std::string& params_its::mqtt_topics = std::string("mqtt_topics"); +const std::string& params_its::mqtt_protocol = std::string("mqtt_protocol"); +const std::string& params_its::mqtt_client_id = std::string("mqtt_client_id"); diff --git a/ccsrc/loggers/loggers.cc b/ccsrc/loggers/loggers.cc deleted file mode 100644 index be5285a..0000000 --- a/ccsrc/loggers/loggers.cc +++ /dev/null @@ -1,4 +0,0 @@ -#include "loggers.hh" - -std::unique_ptr loggers::_instance = static_cast>(new loggers); - diff --git a/ccsrc/loggers/loggers.hh b/ccsrc/loggers/loggers.hh deleted file mode 100644 index 36f7344..0000000 --- a/ccsrc/loggers/loggers.hh +++ /dev/null @@ -1,273 +0,0 @@ -/*! - * \file loogers.hh - * \brief Header file for the logger framework. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include -#include -#include -#include -#include - -/** -class Base_Type; -class OCTETSTRING; -class TTCN_Buffer; -class TTCN_Logger; -enum TTCN_Logger::Severity; -extern void TTCN_error(const char *err_msg, ...) __attribute__ ((__format__ (__printf__, 1, 2), __noreturn__)); -extern void TTCN_error_begin(const char *err_msg, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -extern void TTCN_error_end() __attribute__ ((__noreturn__)); -void TTCN_warning(const char *warning_msg, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -extern void TTCN_warning_begin(const char *warning_msg, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -extern void TTCN_warning_end(); -**/ - -using namespace std; // Required for isnan() -#include - -/*! - * \class loggers - * \brief This class provides basic functionalities for an ITS dictionary - * \implements Singleton pattern - * \todo Remove reference to TTCN3.hh - */ -class loggers { -private: //! \privatesection - static std::unique_ptr _instance; //! Smart pointer to the unique instance of the logger framework - std::map - _times; //! Timer used to measure execution time between calls to methods \loggers::set_start_time and \loggers::set_stop_time - - /*! - * \brief Default constructor - * Create a new instance of the loggers class - * \private - */ - explicit loggers() : _times(){}; - - inline void log_time_exec(const char *p_fmt, ...); - -public: //! \publicsection - /*! - * \brief Default destructor - */ - virtual ~loggers(){}; - - /*! - * \fn static loggers& get_instance(); - * \brief Accessor for the unique instance of the logger framework - * \inline - */ - static inline loggers &get_instance() { return *_instance.get(); }; - - /*! - * \fn void log_to_hexa(const char *p_prompt, const TTCN_Buffer& buffer); - * \brief Hexa dump of the \see TTCN_Buffer buffer - * \param[in] p_prompt Label of the log to be produced - * \param[in] buffer The TTCN_Buffer buffer to dump - * \inline - */ - inline void log_to_hexa(const char *p_prompt, const TTCN_Buffer &buffer); - /*! - * \fn void log_to_hexa(const char *p_prompt, const OCTETSTRING& msg); - * \brief Hexa dump of the \see OCTETSTRING buffer - * \param[in] p_prompt Label of the log to be produced - * \param[in] msg The OCTETSTRING buffer to dump - * \inline - */ - inline void log_to_hexa(const char *p_prompt, const OCTETSTRING &msg); - /*! - * \fn void log_to_hexa(const char *p_prompt, const unsigned char* msg, const size_t msg_size); - * \brief Hexa dump of the provided buffer - * \param[in] p_prompt Label of the log to be produced - * \param[in] msg The buffer to dump - * \inline - */ - inline void log_to_hexa(const char *p_prompt, const unsigned char *msg, const size_t msg_size); - /*! - * \fn void log_msg(const char *p_prompt, const Base_Type& p_type); - * \brief Debug log of TITAN data structures - * \param[in] p_prompt Label of the log to be produced - * \param[in] msg The TITAN data structure to log - * \inline - */ - inline void log_msg(const char *p_prompt, const Base_Type &p_type); - /*! - * \fn void log(const char *p_fmt, ...); - * \brief Debug message based on printf-compliant formatting message - * \param[in] p_fmt The printf-compliant format of the message to log - * \param[in] ... The arguments - * \inline - */ - inline void log(const char *p_fmt, ...); - - /*! - * \fn void user_msg(const char *p_prompt, const Base_Type& p_type); - * \brief User message of TITAN data structures - * \param[in] p_prompt Label of the log to be produced - * \param[in] msg The TITAN data structure to log - * \inline - */ - inline void user_msg(const char *p_prompt, const Base_Type &p_type); - /*! - * \fn void user(const char *p_fmt, ...); - * \brief User message based on printf-compliant formatting message - * \param[in] p_fmt The printf-compliant format of the message to log - * \param[in] ... The arguments - * \inline - */ - inline void user(const char *p_fmt, ...); - - /*! - * \fn void user_msg(const char *p_prompt, const Base_Type& p_type); - * \brief Warning message of TITAN data structures - * \param[in] p_prompt Label of the log to be produced - * \param[in] msg The TITAN data structure to log - * \inline - */ - inline void warning_msg(const char *p_prompt, const Base_Type &p_type); - /*! - * \fn void user(const char *p_fmt, ...); - * \brief Warning message based on printf-compliant formatting message - * \param[in] p_fmt The printf-compliant format of the message to log - * \param[in] ... The arguments - * \inline - */ - inline void warning(const char *p_fmt, ...); - - /*! - * \fn void user(const char *p_fmt, ...); - * \brief Error message based on printf-compliant formatting message - * \param[in] p_fmt The printf-compliant format of the message to log - * \param[in] ... The arguments - * \inline - */ - inline void error(const char *p_fmt, ...); - - /*! - * \fn void set_start_time(std::string& p_time_key); - * \brief Start execution time measurement - * \param[in] p_time_key A timer identifier (any string) - * \inline - */ - inline void set_start_time(std::string &p_time_key); - /*! - * \fn void set_stop_time(std::string& p_time_key, float& p_time); - * \brief Stop execution time measurement - * \param[in] p_time_key The timer identifier provided while calling \see loggers::set_start_time method - * \param[out] p_time The execution time measured in milliseconds - * \inline - */ - inline void set_stop_time(std::string &p_time_key, float &p_time); -}; // End of class loggers - -void loggers::log_to_hexa(const char *p_prompt, const TTCN_Buffer &buffer) { - TTCN_Logger::begin_event(TTCN_Logger::DEBUG_UNQUALIFIED); - TTCN_Logger::log_event_str(p_prompt); - buffer.log(); - TTCN_Logger::end_event(); -} - -void loggers::log_to_hexa(const char *p_prompt, const OCTETSTRING &msg) { - TTCN_Logger::begin_event(TTCN_Logger::DEBUG_UNQUALIFIED); - TTCN_Logger::log_event_str(p_prompt); - TTCN_Logger::log_event("Size: %d,\nMsg: ", msg.lengthof()); - - for (int i = 0; i < msg.lengthof(); i++) { - TTCN_Logger::log_event(" %02x", ((const unsigned char *)msg)[i]); - } - TTCN_Logger::log_event("\n"); - TTCN_Logger::end_event(); -} - -void loggers::log_to_hexa(const char *p_prompt, const unsigned char *msg, const size_t msg_size) { - TTCN_Logger::begin_event(TTCN_Logger::DEBUG_UNQUALIFIED); - TTCN_Logger::log_event_str(p_prompt); - for (size_t i = 0; i < msg_size; i++) { - TTCN_Logger::log_event(" %02x", *(msg + i)); - } - TTCN_Logger::log_event("\n"); - TTCN_Logger::end_event(); -} - -void loggers::log_msg(const char *p_prompt, const Base_Type &p_type) { - TTCN_Logger::begin_event(TTCN_Logger::DEBUG_UNQUALIFIED); - TTCN_Logger::log_event_str(p_prompt); - p_type.log(); - TTCN_Logger::end_event(); -} - -void loggers::log(const char *p_fmt, ...) { - TTCN_Logger::begin_event(TTCN_Logger::DEBUG_UNQUALIFIED); - va_list args; - va_start(args, p_fmt); - TTCN_Logger::log_event_va_list(p_fmt, args); - va_end(args); - TTCN_Logger::end_event(); -} - -void loggers::user_msg(const char *p_prompt, const Base_Type &p_type) { - TTCN_Logger::begin_event(TTCN_Logger::USER_UNQUALIFIED); - TTCN_Logger::log_event_str(p_prompt); - p_type.log(); - TTCN_Logger::end_event(); -} - -void loggers::user(const char *p_fmt, ...) { - TTCN_Logger::begin_event(TTCN_Logger::USER_UNQUALIFIED); - va_list args; - va_start(args, p_fmt); - TTCN_Logger::log_event_va_list(p_fmt, args); - va_end(args); - TTCN_Logger::end_event(); -} - -void loggers::warning(const char *p_fmt, ...) { - TTCN_Logger::begin_event(TTCN_Logger::WARNING_UNQUALIFIED); - va_list args; - va_start(args, p_fmt); - TTCN_Logger::log_event_va_list(p_fmt, args); - va_end(args); - TTCN_Logger::end_event(); -} - -void loggers::warning_msg(const char *p_prompt, const Base_Type &p_type) { - TTCN_Logger::begin_event(TTCN_Logger::WARNING_UNQUALIFIED); - TTCN_Logger::log_event_str(p_prompt); - p_type.log(); - TTCN_Logger::end_event(); -} - -void loggers::error(const char *p_fmt, ...) { - va_list args; - va_start(args, p_fmt); - TTCN_error(p_fmt, args); - va_end(args); -} - -void loggers::set_start_time(std::string &p_time_key) { _times[p_time_key] = std::clock(); } - -void loggers::set_stop_time(std::string &p_time_key, float &p_time) { - std::map::iterator it = _times.find(p_time_key); - if (it != loggers::_times.end()) { - p_time = (std::clock() - _times[p_time_key]) * 1000.0 / CLOCKS_PER_SEC; // in milliseconds - _times.erase(it); - loggers::get_instance().log_time_exec("%s: Execution duration: %f ms", p_time_key.c_str(), p_time); - } -} - -void loggers::log_time_exec(const char *p_fmt, ...) { - TTCN_Logger::begin_event(TTCN_Logger::EXECUTOR_RUNTIME); - va_list args; - va_start(args, p_fmt); - TTCN_Logger::log_event_va_list(p_fmt, args); - va_end(args); - TTCN_Logger::end_event(); -} diff --git a/ccsrc/loggers/module.mk b/ccsrc/loggers/module.mk deleted file mode 100644 index 36b4b2c..0000000 --- a/ccsrc/loggers/module.mk +++ /dev/null @@ -1,3 +0,0 @@ -sources := loggers.cc -includes := . - diff --git a/data/certificates/profiles/CERT_IUT_A_RCA.xml b/data/certificates/profiles/CERT_IUT_A_RCA.xml index b8865e7..2a27460 100644 --- a/data/certificates/profiles/CERT_IUT_A_RCA.xml +++ b/data/certificates/profiles/CERT_IUT_A_RCA.xml @@ -22,16 +22,17 @@ - - - - - - - + 01 C0/FF 3F + + + + + + + - - 01 FE/FF 01 + + 01 3E/FF C1 01 diff --git a/etc/AtsPki/AtsPki_Atos.cfg_ b/etc/AtsPki/AtsPki_Atos.cfg_ index 3611b3c..671ae27 100644 --- a/etc/AtsPki/AtsPki_Atos.cfg_ +++ b/etc/AtsPki/AtsPki_Atos.cfg_ @@ -18,8 +18,8 @@ LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" # Use this certificate if the RSU simulator act as IUT LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_IUT_A_AT" -LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" -LibItsHttp_Pics.PICS_HEADER_CTL_CONTENT_TYPE := "application/x-its-crl" +LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" +LibHttp_Pics.PICS_HEADER_CTL_CONTENT_TYPE := "application/x-its-crl" LibItsPki_Pics.PICS_MULTIPLE_END_POINT := true LibItsPki_Pics.PICS_HEADER_HOST_EC := "0.atos-ea.l0.c-its-pki.eu" diff --git a/etc/AtsPki/AtsPki_Autocrypt.cfg_ b/etc/AtsPki/AtsPki_Autocrypt.cfg_ index 5755d41..630de23 100644 --- a/etc/AtsPki/AtsPki_Autocrypt.cfg_ +++ b/etc/AtsPki/AtsPki_Autocrypt.cfg_ @@ -9,7 +9,7 @@ LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "../data/certificates" # Configuration sub-directory to access certificate stored in files LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" -LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" +LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" LibItsPki_Pics.PICS_MULTIPLE_END_POINT := true LibItsPki_Pics.PICS_HEADER_HOST_EC := "ea.etsi.autocrypt.io:9100" diff --git a/etc/AtsPki/AtsPki_Commsignia.cfg_ b/etc/AtsPki/AtsPki_Commsignia.cfg_ index 118a47c..9df6b3f 100644 --- a/etc/AtsPki/AtsPki_Commsignia.cfg_ +++ b/etc/AtsPki/AtsPki_Commsignia.cfg_ @@ -22,8 +22,8 @@ LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "/home/vagrant/tmp" LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" #LibItsSecurity_Pics.PICS_SEC_FIXED_KEYS := true # Seed -LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" -LibItsHttp_Pics.PICS_HEADER_HOST := "10.8.0.2" +LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" +LibHttp_Pics.PICS_HEADER_HOST := "10.8.0.2" LibItsPki_Pics.PICS_HTTP_POST_URI_EC := "/ea/enrolment" LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/aa/authorization" diff --git a/etc/AtsPki/AtsPki_Ctag.cfg_ b/etc/AtsPki/AtsPki_Ctag.cfg_ index 8df2dfb..b6bcc92 100644 --- a/etc/AtsPki/AtsPki_Ctag.cfg_ +++ b/etc/AtsPki/AtsPki_Ctag.cfg_ @@ -12,8 +12,8 @@ LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" # Use this certificate if the RSU simulator act as IUT LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_IUT_A_AT" -LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" -LibItsHttp_Pics.PICS_HEADER_CTL_CONTENT_TYPE := "application/x-its-crl" +LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" +LibHttp_Pics.PICS_HEADER_CTL_CONTENT_TYPE := "application/x-its-crl" LibItsPki_Pics.PICS_MULTIPLE_END_POINT := true LibItsPki_Pics.PICS_HEADER_HOST_EC := "pki-spain-test.siscoga4cad.com:33080" diff --git a/etc/AtsPki/AtsPki_Etas.cfg_ b/etc/AtsPki/AtsPki_Etas.cfg_ index be2fa0b..5bfc8b7 100644 --- a/etc/AtsPki/AtsPki_Etas.cfg_ +++ b/etc/AtsPki/AtsPki_Etas.cfg_ @@ -6,7 +6,7 @@ LibCommon_Sync.PX_TSYNC_TIME_LIMIT := 40.0 LibCommon_Sync.PX_TSHUT_DOWN_TIME_LIMIT := 40.0 LibCommon_Time.PX_TDONE := 40.0 -LibCommon_Time.PX_TWAIT := 40.0 +LibCommon_Time.PX_TWAIT := 60.0 # Enable Security support LibItsGeoNetworking_Pics.PICS_GN_SECURITY := true @@ -18,11 +18,11 @@ LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" # Use this certificate if the RSU simulator act as IUT LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_IUT_A_AT" -LibItsHttp_Pics.PICS_HEADER_CTL_CONTENT_TYPE := "application/x-its-crl" -LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" +LibHttp_Pics.PICS_HEADER_CTL_CONTENT_TYPE := "application/x-its-crl" +LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" LibItsPki_Pics.PICS_MULTIPLE_END_POINT := false -LibItsHttp_Pics.PICS_HEADER_HOST := "eta01s.staging.cycurv2x.com" +LibHttp_Pics.PICS_HEADER_HOST := "eta01s.staging.cycurv2x.com" LibItsPki_Pics.PICS_HTTP_POST_URI_EC := "/ea/enrolment" LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/aa/authorization" @@ -59,6 +59,11 @@ LibItsPki_Pics.PICS_EC_SUBJECT_ATTRIBUT_REGION := false # requestedSubjectAttrib # Required for SECPKI_AA_AUTH_RCV_02_BV #LibItsPki_Pics.PICS_SECPKI_REENROLMENT := false # Check in logs the pattern '==> EC ' to find the required information for re-enrolment +# URI to request CTL +LibItsPki_Pics.PICS_DC_ENDPOINT := "http://yanngarcia.ddns.net/dc" +LibItsPki_Pics.PICS_AA_ENDPOINT := "http://yanngarcia.ddns.net/aa" +LibItsPki_Pics.PICS_EA_ENDPOINT := "http://yanngarcia.ddns.net/ea" + #LibItsPki_Pixits.PX_INCLUDE_ENCRYPTION_KEYS := false # No encryption key in Authorization request #LibItsPki_Pixits.PX_VE_ALG := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p384_r1 diff --git a/etc/AtsPki/AtsPki_Microsec.cfg_ b/etc/AtsPki/AtsPki_Microsec.cfg_ index b51c5f2..d4bcf7e 100644 --- a/etc/AtsPki/AtsPki_Microsec.cfg_ +++ b/etc/AtsPki/AtsPki_Microsec.cfg_ @@ -9,10 +9,10 @@ LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "../data/certificates" # Configuration sub-directory to access certificate stored in files LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" -LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" +LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" LibItsPki_Pics.PICS_MULTIPLE_END_POINT := false -LibItsHttp_Pics.PICS_HEADER_HOST := "v2x-pki-test.microsec.com" +LibHttp_Pics.PICS_HEADER_HOST := "v2x-pki-test.microsec.com" LibItsPki_Pics.PICS_HEADER_HOST_CA := "v2x-pki-test.microsec.com" LibItsPki_Pics.PICS_HEADER_HOST_TLM := "v2x-pki-test.microsec.com" diff --git a/etc/AtsPki/AtsPki_Simu.cfg_ b/etc/AtsPki/AtsPki_Simu.cfg_ index 72febb3..7fe3098 100644 --- a/etc/AtsPki/AtsPki_Simu.cfg_ +++ b/etc/AtsPki/AtsPki_Simu.cfg_ @@ -21,10 +21,10 @@ LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" # Use this certificate if the RSU simulator act as IUT LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_IUT_A_AT" -LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" -LibItsHttp_Pics.PICS_HEADER_CTL_CONTENT_TYPE := "application/x-its-crl" +LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" +LibHttp_Pics.PICS_HEADER_CTL_CONTENT_TYPE := "application/x-its-crl" -LibItsHttp_Pics.PICS_HEADER_HOST := "192.168.1.43" +LibHttp_Pics.PICS_HEADER_HOST := "192.168.1.43" LibItsPki_Pics.PICS_HTTP_POST_URI_EC := "/ea/enrolment" LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/aa/authorization" diff --git a/etc/AtsSecurity/AtsSecurity.cfg b/etc/AtsSecurity/AtsSecurity.cfg index d1572cd..220ecba 100644 --- a/etc/AtsSecurity/AtsSecurity.cfg +++ b/etc/AtsSecurity/AtsSecurity.cfg @@ -3,18 +3,18 @@ # This section shall contain the values of all parameters that are defined in your TTCN-3 modules. # The GeoNetworking address of the IUT. -#LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { -# typeOfAddress := e_initial, -# stationType := e_unknown, -# reserved := 0, -# mid := '000000000000'O -#} LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { - typeOfAddress := e_manual, - stationType := e_roadSideUnit, - reserved := 49, - mid := '001C6B0D0201'O + typeOfAddress := e_initial, + stationType := e_unknown, + reserved := 0, + mid := '000000000000'O } +#LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { +# typeOfAddress := e_manual, +# stationType := e_roadSideUnit, +# reserved := 49, +# mid := '001C6B0D0201'O +#} LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB LibItsBtp_Pixits.PX_DESTINATION_PORT := 2001 LibItsBtp_Pixits.PX_DESTINATION_PORT_INFO := 2001 -- GitLab From c5f1a21c4a250130064df621f86a79a80cc63d55 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 23 Sep 2022 09:01:38 +0200 Subject: [PATCH 022/178] Add titan-test-system-framework - Compilation will failed --- .gitmodules | 4 ++++ titan-test-system-framework | 1 + 2 files changed, 5 insertions(+) create mode 160000 titan-test-system-framework diff --git a/.gitmodules b/.gitmodules index ef8f3cb..c7e1567 100644 --- a/.gitmodules +++ b/.gitmodules @@ -40,3 +40,7 @@ [submodule "ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module"] path = ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module url = https://github.com/eclipse/titan.TestPorts.Common_Components.Abstract_Socket.git +[submodule "titan-test-system-framework"] + path = titan-test-system-framework + url = https://labs.etsi.org/rep/cti-tools/titan-test-system-framework.git + branch = devel diff --git a/titan-test-system-framework b/titan-test-system-framework new file mode 160000 index 0000000..13e13a5 --- /dev/null +++ b/titan-test-system-framework @@ -0,0 +1 @@ +Subproject commit 13e13a5759ad795a8726bdcdad30232d454fafd2 -- GitLab From a7d6a25c1a75077a1d8d663f67cf472c8c73af10 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 29 Sep 2022 13:21:07 +0200 Subject: [PATCH 023/178] Finalyze support if titan-test-system-framework --- LICENSE | 2 +- ccsrc/EncDec/module.mk | 4 +- .../Ports/LibIts_ports/Http_ports/HttpPort.cc | 8 +- ccsrc/Protocols/Http/http_codec_its.cc | 80 +++++++++++++++++++ ccsrc/Protocols/Http/http_codec_its.hh | 16 ++++ ccsrc/Protocols/Http/module.mk | 3 + ccsrc/Protocols/UpperTester/module.mk | 2 +- titan-test-system-framework | 2 +- ttcn/patch_lib_http/module.mk | 3 + .../ttcn/LibHttp_BinaryMessageBodyTypes.ttcn | 35 ++++++++ .../ttcn/LibHttp_BinaryTemplates.ttcn | 62 ++++++++++++++ .../docker/home/etc/init.d/40-ttf011.sh | 8 +- virtualization/vagrant/provisioner.bash | 8 +- 13 files changed, 223 insertions(+), 10 deletions(-) create mode 100644 ccsrc/Protocols/Http/http_codec_its.cc create mode 100644 ccsrc/Protocols/Http/http_codec_its.hh create mode 100644 ccsrc/Protocols/Http/module.mk create mode 100644 ttcn/patch_lib_http/module.mk create mode 100644 ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn create mode 100644 ttcn/patch_lib_http/ttcn/LibHttp_BinaryTemplates.ttcn diff --git a/LICENSE b/LICENSE index c7a6ba0..7cae155 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2019 ETSI +Copyright 2019-2022 ETSI Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/ccsrc/EncDec/module.mk b/ccsrc/EncDec/module.mk index e99d90e..578e439 100644 --- a/ccsrc/EncDec/module.mk +++ b/ccsrc/EncDec/module.mk @@ -25,7 +25,6 @@ sources += \ LibItsBtp_Encdec.cc \ LibItsCam_Encdec.cc \ LibItsDenm_Encdec.cc \ - LibHttp_Encdec.cc \ LibItsMapemSpatem_Encdec.cc \ LibItsSremSsem_Encdec.cc \ LibItsRtcmem_Encdec.cc \ @@ -54,6 +53,5 @@ ifeq (AtsPki, $(ATS)) sources += \ LibItsBtp_Encdec.cc \ LibItsPki_Encdec.cc \ - LibItsCam_Encdec.cc \ - LibHttp_Encdec.cc + LibItsCam_Encdec.cc endif diff --git a/ccsrc/Ports/LibIts_ports/Http_ports/HttpPort.cc b/ccsrc/Ports/LibIts_ports/Http_ports/HttpPort.cc index 0696d26..8537544 100644 --- a/ccsrc/Ports/LibIts_ports/Http_ports/HttpPort.cc +++ b/ccsrc/Ports/LibIts_ports/Http_ports/HttpPort.cc @@ -1,5 +1,7 @@ #include "HttpPort.hh" #include "http_layer_factory.hh" +#include "http_layer.hh" +#include "http_codec_its.hh" #include "loggers.hh" #include "LibHttp_TypesAndValues.hh" @@ -47,11 +49,13 @@ namespace LibHttp__TestSystem { params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless // Create layer _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); - if (static_cast(_layer) == nullptr) { + if (static_cast(_layer) == nullptr) { loggers::get_instance().error("HttpPort::user_map: Invalid stack configuration: %s", it->second.c_str()); } + if (!static_cast(_layer)->set_codec(new http_codec_its())) { + loggers::get_instance().error("HttpPort::user_map: Null codec"); + } static_cast(_layer)->add_upper_port(this); - } else { loggers::get_instance().error("HttpPort::user_map: No layers defined in configuration file"); } diff --git a/ccsrc/Protocols/Http/http_codec_its.cc b/ccsrc/Protocols/Http/http_codec_its.cc new file mode 100644 index 0000000..fc477a2 --- /dev/null +++ b/ccsrc/Protocols/Http/http_codec_its.cc @@ -0,0 +1,80 @@ +#include "http_codec_its.hh" + +#include "loggers.hh" + +#include "http_etsi_ieee1609dot2_codec.hh" + +bool http_codec_its::encode_body_binary(const LibHttp__BinaryMessageBodyTypes::BinaryBody &p_binary_body, OCTETSTRING &p_encoding_buffer, const std::string &p_content_type) { + loggers::get_instance().log(">>> http_codec_its::encode_body_binary"); + + std::map>>::const_iterator it; + bool processed = false; + if (p_content_type.find("x-its") != std::string::npos) { + loggers::get_instance().log("http_codec_its::encode_body_binary: Find x-its"); + it = _codecs.find("http_its"); // TODO Use params + if (it != _codecs.cend()) { + loggers::get_instance().log("http_codec_its::encode_body_binary: Call '%s'", it->first.c_str()); + if (p_binary_body.ischosen(LibHttp__BinaryMessageBodyTypes::BinaryBody::ALT_ieee1609dot2__data)) { + _codecs["http_its"]->encode((Record_Type &)p_binary_body.ieee1609dot2__data(), p_encoding_buffer); // TODO Use params + processed = true; + } else if (p_binary_body.ischosen(LibHttp__BinaryMessageBodyTypes::BinaryBody::ALT_ieee1609dot2__certificate)) { + _codecs["http_its"]->encode((Record_Type &)p_binary_body.ieee1609dot2__certificate(), p_encoding_buffer); // TODO Use params + processed = true; + } else { + loggers::get_instance().warning("http_codec_its::encode_body_binary: Unsupported variant"); + } + } + } // TODO Add new HTTP message codec here + if (!processed) { + loggers::get_instance().warning("http_codec_its::encode_body_binary: Unsupported HTTP codec, use raw field as default"); + p_encoding_buffer = OCTETSTRING(0, nullptr); + } + + return true; +} + +bool http_codec_its::decode_body_binary(const OCTETSTRING &p_data, LibHttp__BinaryMessageBodyTypes::BinaryBody &p_binary_body, const std::string &p_content_type, params* p_params) { + loggers::get_instance().log(">>> http_codec_its::decode_body_binary"); + + std::map>>::const_iterator it; + bool processed = false; + // TODO To be refined adding a string identifier to check which codec to use. E.g. held_code.id() returns "xmlns=\"urn:ietf:params:xml:ns:geopriv:held\">" + if ((p_content_type.find("x-its") != std::string::npos) || (p_content_type.find("application/octet-stream") != std::string::npos)) { + loggers::get_instance().log("http_codec_its::decode_body_binary: Find 'x-its'"); + it = _codecs.cbegin(); //_codecs.find("http_its"); + if (it != _codecs.cend()) { + /*** + FIXME: + This code generate a codedump, I don't undertsand the reason. + The same code works file for Ng112 HELD & LOST codec. Ununderstandable!!!! + ==> Use a patch + if (_codecs["http_its"].get() != nullptr) { + loggers::get_instance().log("http_codec_its::decode_body_binary: Call 'http_etsi_ieee1609dot2_codec'"); + if (_codecs["http_its"]->decode(p_data, (Record_Type&)binary_body) == 0) { + processed = true; + } + }*/ + loggers::get_instance().log("http_codec_its::decode_body_binary: Call '%s'", it->first.c_str()); + http_etsi_ieee1609dot2_codec *codec = new http_etsi_ieee1609dot2_codec(); + if (p_data[0].get_octet() != 0x80) { + if (codec->decode(p_data, p_binary_body.ieee1609dot2__data()) == 0) { + processed = true; + } + } else { + if (codec->decode(p_data, p_binary_body.ieee1609dot2__certificate()) == 0) { + processed = true; + } + } + delete codec; + } + if (!processed) { + loggers::get_instance().warning("http_codec_its::decode_body_binary: Unsupported HTTP codec, use raw field as default"); + p_binary_body.raw() = p_data; + } + } else { + loggers::get_instance().warning("http_codec_its::decode_body_binary: Unsupported HTTP codec, use raw field as default"); + p_binary_body.raw() = p_data; + } + + return true; +} diff --git a/ccsrc/Protocols/Http/http_codec_its.hh b/ccsrc/Protocols/Http/http_codec_its.hh new file mode 100644 index 0000000..e9cb631 --- /dev/null +++ b/ccsrc/Protocols/Http/http_codec_its.hh @@ -0,0 +1,16 @@ +#pragma once + +#include "http_codec.hh" + +#include "LibHttp_MessageBodyTypes.hh" + +class http_codec_its : public http_codec { + +public: + explicit http_codec_its() : http_codec() {}; + virtual ~http_codec_its(){}; + +protected: //! \protectedsection + bool encode_body_binary(const LibHttp__BinaryMessageBodyTypes::BinaryBody &p_binary_body, OCTETSTRING &p_encoding_buffer, const std::string &p_content_type); + bool decode_body_binary(const OCTETSTRING &p_data, LibHttp__BinaryMessageBodyTypes::BinaryBody &p_binary_body, const std::string &p_content_type, params* p_params); +}; \ No newline at end of file diff --git a/ccsrc/Protocols/Http/module.mk b/ccsrc/Protocols/Http/module.mk new file mode 100644 index 0000000..9b5d32c --- /dev/null +++ b/ccsrc/Protocols/Http/module.mk @@ -0,0 +1,3 @@ +sources := http_codec_its.cc +includes := . + diff --git a/ccsrc/Protocols/UpperTester/module.mk b/ccsrc/Protocols/UpperTester/module.mk index c013e3f..c8ea294 100644 --- a/ccsrc/Protocols/UpperTester/module.mk +++ b/ccsrc/Protocols/UpperTester/module.mk @@ -43,4 +43,4 @@ endif includes := . -modules += ../../../framework/ccsrc/Protocols/UDP +modules += ../../../titan-test-system-framework/ccsrc/Protocols/UDP diff --git a/titan-test-system-framework b/titan-test-system-framework index 13e13a5..efce1fb 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit 13e13a5759ad795a8726bdcdad30232d454fafd2 +Subproject commit efce1fbd81bf78207a428d1e0ab4c1d436bfa469 diff --git a/ttcn/patch_lib_http/module.mk b/ttcn/patch_lib_http/module.mk new file mode 100644 index 0000000..a2200f4 --- /dev/null +++ b/ttcn/patch_lib_http/module.mk @@ -0,0 +1,3 @@ +sources := \ + ttcn/LibHttp_BinaryMessageBodyTypes.ttcn \ + ttcn/LibHttp_BinaryTemplates.ttcn \ diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn new file mode 100644 index 0000000..ff2492a --- /dev/null +++ b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn @@ -0,0 +1,35 @@ +/** + * @author ETSI / STF545 + * @version $URL$ + * $ID:$ + * @desc This module provides the custom binary types for ITS HTTP based protocols. + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + */ +module LibHttp_BinaryMessageBodyTypes { + + /** + * This file volontary contains a trivial declaration of the type BinaryBodu. + * In accordance with your TTCN-3 module LibHttp_XMLTypes, you have to change the BinaryBody typing. + */ + // TODO Add here your custom binary import + // LibIts + import from Ieee1609Dot2BaseTypes language "ASN.1:1997" all; + import from Ieee1609Dot2 language "ASN.1:1997" all; + import from EtsiTs102941BaseTypes language "ASN.1:1997" all; + import from EtsiTs102941TypesEnrolment language "ASN.1:1997" all; + import from EtsiTs102941MessagesCa language "ASN.1:1997" all; + import from EtsiTs103097Module language "ASN.1:1997" all; + + type union BinaryBody { + // TODO Add here your custom variants + Ieee1609Dot2Data ieee1609dot2_data, + Certificate ieee1609dot2_certificate, + octetstring raw + } with { + variant "" + } + +} // End of LibHttp_BinaryMessageBodyTypes diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_BinaryTemplates.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryTemplates.ttcn new file mode 100644 index 0000000..5319d23 --- /dev/null +++ b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryTemplates.ttcn @@ -0,0 +1,62 @@ +/** + * @author ETSI / STF545 + * @version $URL$ + * $ID:$ + * @desc This module provides the custom templates for ITS HTTP based protocols. + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + */ +module LibHttp_BinaryTemplates { + + // LibHttp + import from LibHttp_BinaryMessageBodyTypes all; + + // TODO Add here your custom binary import + // LibIts + import from Ieee1609Dot2BaseTypes language "ASN.1:1997" all; + import from Ieee1609Dot2 language "ASN.1:1997" all; + import from EtsiTs102941BaseTypes language "ASN.1:1997" all; + import from EtsiTs102941TypesEnrolment language "ASN.1:1997" all; + import from EtsiTs102941MessagesCa language "ASN.1:1997" all; + import from EtsiTs103097Module language "ASN.1:1997" all; + + template (value) BinaryBody m_binary_body_raw( + in template (value) octetstring p_raw + ) := { + raw := p_raw + } // End of template m_binary_body_raw + + template (present) BinaryBody mw_binary_body_raw( + template (present) octetstring p_raw := ? + ) := { + raw := p_raw + } // End of template mw_binary_body_raw + + // TODO Add here your custom binary template + template (value) BinaryBody m_binary_body_ieee1609dot2_data( + in template (value) Ieee1609Dot2Data p_ieee1609dot2_data + ) := { + ieee1609dot2_data := p_ieee1609dot2_data + } // End of template m_binary_body_ieee1609dot2_data + + template (present) BinaryBody mw_binary_body_ieee1609dot2_data( + template (present) Ieee1609Dot2Data p_ieee1609dot2_data := ? + ) := { + ieee1609dot2_data := p_ieee1609dot2_data + } // End of template mw_binary_body_ieee1609dot2_data + + template (value) BinaryBody m_binary_body_ieee1609dot2_certificate( + in template (value) CertificateBase p_ieee1609dot2_certificate + ) := { + ieee1609dot2_certificate := p_ieee1609dot2_certificate + } // End of template m_binary_body_ieee1609dot2_certificate + + template (present) BinaryBody mw_binary_body_ieee1609dot2_certificate( + template (present) CertificateBase p_ieee1609dot2_certificate := ? + ) := { + ieee1609dot2_certificate := p_ieee1609dot2_certificate + } // End of template mw_binary_body_ieee1609dot2_certificate + +} // End of module LibHttp_BinaryTemplates diff --git a/virtualization/docker/home/etc/init.d/40-ttf011.sh b/virtualization/docker/home/etc/init.d/40-ttf011.sh index f7ac5fb..f8639c4 100755 --- a/virtualization/docker/home/etc/init.d/40-ttf011.sh +++ b/virtualization/docker/home/etc/init.d/40-ttf011.sh @@ -30,8 +30,14 @@ do fi cd - done +cd ${HOME}/dev/TS.ITS/titan-test-system-framework +git checkout devel +cd ./ttcn/LibHttp +ln -sf module_its.mk module.mk cd ${HOME}/dev/TS.ITS/ttcn/LibIts -git checkout TS.ITS +git checkout devel + +echo -e "*****************************\n* Setup environment\n*****************************\n" cd ${HOME}/dev/TS.ITS/scripts chmod 775 *.bash devenv.bash.* cd ${HOME} diff --git a/virtualization/vagrant/provisioner.bash b/virtualization/vagrant/provisioner.bash index 9dee974..91c4747 100755 --- a/virtualization/vagrant/provisioner.bash +++ b/virtualization/vagrant/provisioner.bash @@ -68,6 +68,7 @@ then exit -1 fi +# Checkout TS.ITS sources cd /home/vagrant/dev git clone --recurse-submodules --single-branch https://forge.etsi.org/rep/ITS/TS.ITS.git TS.ITS cd ./TS.ITS @@ -93,9 +94,14 @@ do fi cd - done +cd /home/vagrant/dev/TS.ITS/titan-test-system-framework +git checkout devel +cd ./ttcn/LibHttp +ln -sf module_its.mk module.mk cd /home/vagrant/dev/TS.ITS/ttcn/LibIts -git checkout TS.ITS +git checkout devel +# Setup environment cd /home/vagrant/dev/TS.ITS/scripts chmod 775 *.bash devenv.bash.* ./update_user_name.sh -- GitLab From e0bda73525f09c55f05c280c28d42dbad8239471 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Mon, 3 Oct 2022 12:23:19 +0200 Subject: [PATCH 024/178] Bug fixed in Layers --- ccsrc/Protocols/BTP/btp_layer.cc | 32 +++++++++++-------- ccsrc/Protocols/BTP/btp_layer.hh | 6 ++-- ccsrc/Protocols/CAM_layers/cam_layer.cc | 8 +++-- ccsrc/Protocols/CAM_layers/cam_layer.hh | 4 +-- ccsrc/Protocols/DENM_layers/denm_layer.cc | 8 +++-- ccsrc/Protocols/DENM_layers/denm_layer.hh | 4 +-- .../GeoNetworking/geonetworking_layer.cc | 12 ++++--- .../GeoNetworking/geonetworking_layer.hh | 6 ++-- .../UpperTester/UpperTesterRtcmemLayer.cc | 4 +-- .../UpperTester/UpperTesterRtcmemLayer.hh | 4 +-- .../UpperTester/UpperTesterSremSsemLayer.cc | 4 +-- .../UpperTester/UpperTesterSremSsemLayer.hh | 4 +-- .../UpperTester/uppertester_cam_layer.cc | 4 +-- .../UpperTester/uppertester_cam_layer.hh | 4 +-- .../UpperTester/uppertester_debug_layer.cc | 4 +-- .../UpperTester/uppertester_debug_layer.hh | 4 +-- .../UpperTester/uppertester_denm_layer.cc | 4 +-- .../UpperTester/uppertester_denm_layer.hh | 4 +-- .../uppertester_geonetworking_layer.cc | 4 +-- .../uppertester_geonetworking_layer.hh | 4 +-- .../UpperTester/uppertester_ivim_layer.cc | 4 +-- .../uppertester_mapem_spatem_layer.cc | 4 +-- .../uppertester_mapem_spatem_layer.hh | 4 +-- etc/AtsSecurity/AtsSecurity.cfg | 24 +++++++------- titan-test-system-framework | 2 +- ttcn/AtsCAM | 2 +- ttcn/AtsDENM | 2 +- ttcn/AtsGeoNetworking | 2 +- ttcn/AtsIPv6OverGeoNetworking | 2 +- ttcn/AtsIS | 2 +- ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- ttcn/LibIts | 2 +- 33 files changed, 97 insertions(+), 85 deletions(-) diff --git a/ccsrc/Protocols/BTP/btp_layer.cc b/ccsrc/Protocols/BTP/btp_layer.cc index 58000b9..50b0228 100644 --- a/ccsrc/Protocols/BTP/btp_layer.cc +++ b/ccsrc/Protocols/BTP/btp_layer.cc @@ -31,20 +31,22 @@ btp_layer::btp_layer(const std::string &p_type, const std::string ¶m) } } -void btp_layer::sendMsg(const LibItsBtp__TypesAndValues::BtpReq &p, params_its ¶ms) { +void btp_layer::sendMsg(const LibItsBtp__TypesAndValues::BtpReq &p, params &p_params) { loggers::get_instance().log(">>> btp_layer::sendMsg"); // params.log(); // Encode BTP PDU OCTETSTRING data; _codec.encode(p.msgOut(), data); - send_data(data, params); + send_data(data, p_params); } -void btp_layer::send_data(OCTETSTRING &data, params_its ¶ms) { +void btp_layer::send_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> btp_layer::send_data: ", data); - params.log(); // TODO To be removed - _params.log(); // TODO To be removed + //p_params.log(); // TODO To be removed + //_params.log(); // TODO To be removed + + params_its ¶ms = static_cast(p_params); if (_device_mode) { LibItsBtp__TypesAndValues::BtpHeader header; @@ -79,32 +81,34 @@ void btp_layer::send_data(OCTETSTRING &data, params_its ¶ms) { send_to_all_layers(data, params); } -void btp_layer::receive_data(OCTETSTRING &data, params_its &p_params) { +void btp_layer::receive_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> btp_layer::receive_data: ", data); //p_params.log(); + // Decode the payload + params_its ¶ms = static_cast(p_params); LibItsBtp__TypesAndValues::BtpInd p; loggers::get_instance().log("btp_layer::receive_data: Looking for %s", params_its::gn_next_header.c_str()); - params_its::const_iterator it = p_params.find(params_its::gn_next_header); - if (it != p_params.cend()) { + params_its::const_iterator it = params.find(params_its::gn_next_header); + if (it != params.cend()) { loggers::get_instance().log("btp_layer::receive_data: Call set_btp_type with %s/%d", it->second.c_str(), (it->second.compare("2") == 0) ? btp_codec::btpB : btp_codec::btpA); _codec.set_btp_type((it->second.compare("2") == 0) ? btp_codec::btpB : btp_codec::btpA); } - _codec.decode(data, p.msgIn(), &p_params); + _codec.decode(data, p.msgIn(), ¶ms); // Pass the BTP raw payload to the upper layers if any - it = p_params.find(params_its::btp_payload); - if (it != p_params.cend()) { + it = params.find(params_its::btp_payload); + if (it != params.cend()) { loggers::get_instance().log("btp_layer::receive_data: btp_payload=%s", it->second.c_str()); OCTETSTRING os(str2oct(CHARSTRING(it->second.c_str()))); - receive_to_all_layers(os, p_params); + receive_to_all_layers(os, params); } else { loggers::get_instance().warning("btp_layer::receive_data: No payload to pass to upper layers"); } // Pass it to the ports if any - // p_params.log(); - to_all_upper_ports(p, static_cast(p_params)); + // params.log(); + to_all_upper_ports(p, p_params); } btp_layer_factory btp_layer_factory::_f; diff --git a/ccsrc/Protocols/BTP/btp_layer.hh b/ccsrc/Protocols/BTP/btp_layer.hh index de1426e..1d31dae 100644 --- a/ccsrc/Protocols/BTP/btp_layer.hh +++ b/ccsrc/Protocols/BTP/btp_layer.hh @@ -48,7 +48,7 @@ public: //! \publicsection * \param[in] p_btp_req The BTP message to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - void sendMsg(const LibItsBtp__TypesAndValues::BtpReq &p_btp_req, params_its &p_param); + void sendMsg(const LibItsBtp__TypesAndValues::BtpReq &p_btp_req, params &p_params); /*! * \virtual @@ -57,7 +57,7 @@ public: //! \publicsection * \param[in] p_data The data to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - virtual void send_data(OCTETSTRING &data, params_its ¶ms); + virtual void send_data(OCTETSTRING &data, params& p_params); /*! * \virtual * \fn void receive_data(OCTETSTRING& data, params& params); @@ -65,5 +65,5 @@ public: //! \publicsection * \param[in] p_data The bytes formated data received * \param[in] p_params Some lower layers parameters values when data was received */ - virtual void receive_data(OCTETSTRING &data, params_its &info); + virtual void receive_data(OCTETSTRING &data, params& p_params); }; // End of class btp_layer diff --git a/ccsrc/Protocols/CAM_layers/cam_layer.cc b/ccsrc/Protocols/CAM_layers/cam_layer.cc index 32f77d3..c0c1cf2 100644 --- a/ccsrc/Protocols/CAM_layers/cam_layer.cc +++ b/ccsrc/Protocols/CAM_layers/cam_layer.cc @@ -34,13 +34,13 @@ void cam_layer::sendMsg(const LibItsCam__TypesAndValues::CamReq &p, params_its & send_data(data, _params); } -void cam_layer::send_data(OCTETSTRING &data, params_its ¶ms) { +void cam_layer::send_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> cam_layer::send_data: ", data); - send_to_all_layers(data, params); + send_to_all_layers(data, p_params); } -void cam_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { +void cam_layer::receive_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> cam_layer::receive_data: ", data); // Sanity check @@ -51,6 +51,8 @@ void cam_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { } // Decode the payload + params_its ¶ms = static_cast(p_params); + LibItsCam__TypesAndValues::CamInd p; _codec.decode(data, p.msgIn()); if (!p.msgIn().is_bound()) { diff --git a/ccsrc/Protocols/CAM_layers/cam_layer.hh b/ccsrc/Protocols/CAM_layers/cam_layer.hh index 1f94911..97e5461 100644 --- a/ccsrc/Protocols/CAM_layers/cam_layer.hh +++ b/ccsrc/Protocols/CAM_layers/cam_layer.hh @@ -59,7 +59,7 @@ public: //! \publicsection * \param[in] p_data The data to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - virtual void send_data(OCTETSTRING &data, params_its ¶ms); + virtual void send_data(OCTETSTRING &data, params ¶ms); /*! * \virtual * \fn void receive_data(OCTETSTRING& data, params& params); @@ -67,7 +67,7 @@ public: //! \publicsection * \param[in] p_data The bytes formated data received * \param[in] p_params Some lower layers parameters values when data was received */ - virtual void receive_data(OCTETSTRING &data, params_its &info); + virtual void receive_data(OCTETSTRING &data, params &info); int enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security); diff --git a/ccsrc/Protocols/DENM_layers/denm_layer.cc b/ccsrc/Protocols/DENM_layers/denm_layer.cc index 535f0ed..b77aab2 100644 --- a/ccsrc/Protocols/DENM_layers/denm_layer.cc +++ b/ccsrc/Protocols/DENM_layers/denm_layer.cc @@ -32,13 +32,13 @@ void denm_layer::sendMsg(const LibItsDenm__TypesAndValues::DenmReq &p, params_it send_data(data, _params); } -void denm_layer::send_data(OCTETSTRING &data, params_its ¶ms) { +void denm_layer::send_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> denm_layer::send_data: ", data); // params.log(); - send_to_all_layers(data, params); + send_to_all_layers(data, p_params); } -void denm_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { +void denm_layer::receive_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> denm_layer::receive_data: ", data); // Sanity check @@ -49,6 +49,8 @@ void denm_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { } // Decode the payload + params_its ¶ms = static_cast(p_params); + LibItsDenm__TypesAndValues::DenmInd p; _codec.decode(data, p.msgIn()); if (!p.msgIn().is_bound()) { diff --git a/ccsrc/Protocols/DENM_layers/denm_layer.hh b/ccsrc/Protocols/DENM_layers/denm_layer.hh index d5a095c..46f1a1e 100644 --- a/ccsrc/Protocols/DENM_layers/denm_layer.hh +++ b/ccsrc/Protocols/DENM_layers/denm_layer.hh @@ -59,7 +59,7 @@ public: //! \publicsection * \param[in] p_data The data to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - virtual void send_data(OCTETSTRING &data, params_its ¶ms); + virtual void send_data(OCTETSTRING &data, params ¶ms); /*! * \virtual * \fn void receive_data(OCTETSTRING& data, params& params); @@ -67,7 +67,7 @@ public: //! \publicsection * \param[in] p_data The bytes formated data received * \param[in] p_params Some lower layers parameters values when data was received */ - virtual void receive_data(OCTETSTRING &data, params_its &info); + virtual void receive_data(OCTETSTRING &data, params &info); int enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security); diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc index 5692eb5..eab4c85 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc @@ -166,7 +166,7 @@ void geonetworking_layer::init(const std::string &p_type, const std::string &p_p base_time::get_instance().set_leap_delay_us(4 * 1000000); // TODO Set it as parameter } // End of init_params -void geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingReq &p, params_its &p_params) { +void geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingReq &p, params &p_params) { loggers::get_instance().log(">>> geonetworking_layer::sendMsg"); params_its param(_params); @@ -195,9 +195,11 @@ void geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::Geo send_data(data, param); } -void geonetworking_layer::send_data(OCTETSTRING &data, params_its ¶ms) { +void geonetworking_layer::send_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> geonetworking_layer::send_data: ", data); - params.log(); + p_params.log(); + + params_its ¶ms = static_cast(p_params); if (_device_mode) { // Need to build a GN packet params[params_its::certificate] = _params[params_its::certificate]; @@ -226,9 +228,11 @@ const TTCN_RAWdescriptor_t _intx_raw_ = {RAW_INTX, SG_NO, ORDER_MSB, TOP_BIT_INHERITED, 0, 0, 0, 8, 0, NULL, -1, CharCoding::UNKNOWN}; const TTCN_Typedescriptor_t _intx_descr_ = {"IntX", NULL, &_intx_raw_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE}; -void geonetworking_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { +void geonetworking_layer::receive_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> geonetworking_layer::receive_data: ", data); + params_its ¶ms = static_cast(p_params); + // Check security mode Ieee1609Dot2::Ieee1609Dot2Data ieee_1609dot2_data; LibItsGeoNetworking__TypesAndValues::BasicHeader basic_header; diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh index 07d6bd8..b9f195d 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh @@ -150,7 +150,7 @@ public: * \param[in] p_gn_req The GeoNetworking message to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - void sendMsg(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingReq &p_gn_req, params_its &p_param); + void sendMsg(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingReq &p_gn_req, params &p_param); /*! * \virtual @@ -159,7 +159,7 @@ public: * \param[in] p_data The data to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - virtual void send_data(OCTETSTRING &data, params_its ¶ms); + virtual void send_data(OCTETSTRING &data, params &p_param); /*! * \virtual * \fn void receive_data(OCTETSTRING& data, params_its& params); @@ -167,7 +167,7 @@ public: * \param[in] p_data The bytes formated data received * \param[in] p_params Some lower layers parameters values when data was received */ - virtual void receive_data(OCTETSTRING &data, params_its &info); + virtual void receive_data(OCTETSTRING &data, params &p_param); /*! * \virtual diff --git a/ccsrc/Protocols/UpperTester/UpperTesterRtcmemLayer.cc b/ccsrc/Protocols/UpperTester/UpperTesterRtcmemLayer.cc index 243a8e5..95653c4 100644 --- a/ccsrc/Protocols/UpperTester/UpperTesterRtcmemLayer.cc +++ b/ccsrc/Protocols/UpperTester/UpperTesterRtcmemLayer.cc @@ -52,13 +52,13 @@ void UpperTesterRtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcme send_data(data, p_params); } -void UpperTesterRtcmemLayer::send_data(OCTETSTRING& p_data, params_its& p_params) { +void UpperTesterRtcmemLayer::send_data(OCTETSTRING& p_data, params& p_params) { loggers::get_instance().log_msg(">>> UpperTesterRtcmemLayer::send_data: ", p_data); // params.log(); send_to_all_layers(p_data, p_params); } -void UpperTesterRtcmemLayer::receive_data(OCTETSTRING& p_data, params_its& p_params) { +void UpperTesterRtcmemLayer::receive_data(OCTETSTRING& p_data, params& p_params) { loggers::get_instance().log_msg(">>> UpperTesterRtcmemLayer::receive_data: ", p_data); std::unique_ptr r = _codec.decode(p_data); diff --git a/ccsrc/Protocols/UpperTester/UpperTesterRtcmemLayer.hh b/ccsrc/Protocols/UpperTester/UpperTesterRtcmemLayer.hh index 7eb6cb9..fc81ad2 100644 --- a/ccsrc/Protocols/UpperTester/UpperTesterRtcmemLayer.hh +++ b/ccsrc/Protocols/UpperTester/UpperTesterRtcmemLayer.hh @@ -29,8 +29,8 @@ public: void sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemUpdate &send_par, params_its& p_params); void sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemTermination &send_par, params_its& p_params); - virtual void send_data(OCTETSTRING& p_data, params_its& p_params); - virtual void receive_data(OCTETSTRING& p_data, params_its& p_params); + virtual void send_data(OCTETSTRING& p_data, params& p_params); + virtual void receive_data(OCTETSTRING& p_data, params& p_params); }; #endif diff --git a/ccsrc/Protocols/UpperTester/UpperTesterSremSsemLayer.cc b/ccsrc/Protocols/UpperTester/UpperTesterSremSsemLayer.cc index c706188..76b8de6 100644 --- a/ccsrc/Protocols/UpperTester/UpperTesterSremSsemLayer.cc +++ b/ccsrc/Protocols/UpperTester/UpperTesterSremSsemLayer.cc @@ -52,13 +52,13 @@ void UpperTesterSremSsemLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtS send_data(data, p_params); } -void UpperTesterSremSsemLayer::send_data(OCTETSTRING &data, params_its &p_params) { +void UpperTesterSremSsemLayer::send_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> UpperTesterSremSsemLayer::send_data: ", data); // params.log(); send_to_all_layers(data, p_params); } -void UpperTesterSremSsemLayer::receive_data(OCTETSTRING &data, params_its &p_params) { +void UpperTesterSremSsemLayer::receive_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> UpperTesterSremSsemLayer::receive_data: ", data); std::unique_ptr r = _codec.decode(data); diff --git a/ccsrc/Protocols/UpperTester/UpperTesterSremSsemLayer.hh b/ccsrc/Protocols/UpperTester/UpperTesterSremSsemLayer.hh index 9798c01..d7a2ef5 100644 --- a/ccsrc/Protocols/UpperTester/UpperTesterSremSsemLayer.hh +++ b/ccsrc/Protocols/UpperTester/UpperTesterSremSsemLayer.hh @@ -29,8 +29,8 @@ public: void sendMsg(const LibItsSremSsem__TypesAndValues::UtSremUpdate &send_par, params_its& p_params); void sendMsg(const LibItsSremSsem__TypesAndValues::UtSremCancelation &send_par, params_its& p_params); - virtual void send_data(OCTETSTRING& p_data, params_its& p_params); - virtual void receive_data(OCTETSTRING& p_data, params_its& p_params); + virtual void send_data(OCTETSTRING& p_data, params& p_params); + virtual void receive_data(OCTETSTRING& p_data, params& p_params); }; #endif diff --git a/ccsrc/Protocols/UpperTester/uppertester_cam_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_cam_layer.cc index e158db6..090a2a9 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cam_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_cam_layer.cc @@ -64,13 +64,13 @@ void uppertester_cam_layer::sendMsg(const LibItsCam__TypesAndValues::UtCamTrigge } } -void uppertester_cam_layer::send_data(OCTETSTRING &data, params_its &p_params) { +void uppertester_cam_layer::send_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> uppertester_cam_layer::send_data: ", data); // params.log(); send_to_all_layers(data, p_params); } -void uppertester_cam_layer::receive_data(OCTETSTRING &data, params_its &p_params) { +void uppertester_cam_layer::receive_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> uppertester_cam_layer::receive_data: ", data); std::unique_ptr r = _codec.decode(data); diff --git a/ccsrc/Protocols/UpperTester/uppertester_cam_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_cam_layer.hh index 67db69b..5c55c77 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cam_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_cam_layer.hh @@ -38,6 +38,6 @@ public: void sendMsg(const LibItsCam__TypesAndValues::UtCamChangePosition &send_par, params_its& p_params); void sendMsg(const LibItsCam__TypesAndValues::UtCamTrigger &send_par, params_its& p_params); - virtual void send_data(OCTETSTRING &data, params_its& p_params); - virtual void receive_data(OCTETSTRING &data, params_its& info); + virtual void send_data(OCTETSTRING &data, params& p_params); + virtual void receive_data(OCTETSTRING &data, params& p_params); }; // End of class uppertester_cam_layer diff --git a/ccsrc/Protocols/UpperTester/uppertester_debug_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_debug_layer.cc index e0b4135..d858c1e 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_debug_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_debug_layer.cc @@ -15,13 +15,13 @@ uppertester_debug_layer::uppertester_debug_layer(const std::string &p_type, cons uppertester_debug_layer::~uppertester_debug_layer() { loggers::get_instance().log(">>> uppertester_debug_layer::~uppertester_debug_layer"); } -void uppertester_debug_layer::send_data(OCTETSTRING &p_data, params_its &p_params) { +void uppertester_debug_layer::send_data(OCTETSTRING &p_data, params &p_params) { loggers::get_instance().log_msg(">>> uppertester_debug_layer::send_data: ", p_data); receive_data(p_data, p_params); } -void uppertester_debug_layer::receive_data(OCTETSTRING &p_data, params_its &p_params) { +void uppertester_debug_layer::receive_data(OCTETSTRING &p_data, params &p_params) { loggers::get_instance().log_msg(">>> uppertester_debug_layer::receive_data: ", p_data); OCTETSTRING data; diff --git a/ccsrc/Protocols/UpperTester/uppertester_debug_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_debug_layer.hh index 5913b29..4ede5b9 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_debug_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_debug_layer.hh @@ -47,7 +47,7 @@ public: //! \publicsection * \param[in] p_data The data to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - virtual void send_data(OCTETSTRING &p_data, params_its& p_params); + virtual void send_data(OCTETSTRING &p_data, params& p_params); /*! * \virtual * \fn void receive_data(OCTETSTRING& data, params& params); @@ -55,6 +55,6 @@ public: //! \publicsection * \param[in] p_data The bytes formated data received * \param[in] p_params Some lower layers parameters values when data was received */ - virtual void receive_data(OCTETSTRING &p_data, params_its& p_params); + virtual void receive_data(OCTETSTRING &p_data, params& p_params); }; // End of class uppertester_debug_layer diff --git a/ccsrc/Protocols/UpperTester/uppertester_denm_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_denm_layer.cc index 820eba5..c66e67c 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_denm_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_denm_layer.cc @@ -119,13 +119,13 @@ void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmTer } } -void uppertester_denm_layer::send_data(OCTETSTRING& p_data, params_its& p_params) { +void uppertester_denm_layer::send_data(OCTETSTRING& p_data, params& p_params) { loggers::get_instance().log_msg(">>> uppertester_denm_layer::send_data: ", p_data); // params.log(); send_to_all_layers(p_data, p_params); } -void uppertester_denm_layer::receive_data(OCTETSTRING& p_data, params_its &p_params) { +void uppertester_denm_layer::receive_data(OCTETSTRING& p_data, params &p_params) { loggers::get_instance().log_msg(">>> uppertester_denm_layer::receive_data: ", p_data); std::unique_ptr r = _codec.decode(p_data); diff --git a/ccsrc/Protocols/UpperTester/uppertester_denm_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_denm_layer.hh index 94464ed..86fbec9 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_denm_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_denm_layer.hh @@ -44,6 +44,6 @@ public: void sendMsg(const LibItsDenm__TypesAndValues::UtDenmUpdate &send_par, params_its& p_params); void sendMsg(const LibItsDenm__TypesAndValues::UtDenmTermination &send_par, params_its& p_params); - virtual void send_data(OCTETSTRING& p_data, params_its& p_params); - virtual void receive_data(OCTETSTRING& p_data, params_its& p_params); + virtual void send_data(OCTETSTRING& p_data, params& p_params); + virtual void receive_data(OCTETSTRING& p_data, params& p_params); }; // End of class uppertester_denm_layer diff --git a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.cc index 1e1093c..8e839a1 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.cc @@ -80,13 +80,13 @@ void uppertester_geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAn } } -void uppertester_geonetworking_layer::send_data(OCTETSTRING &data, params_its &p_params) { +void uppertester_geonetworking_layer::send_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> uppertester_geonetworking_layer::send_data: ", data); // params.log(); send_to_all_layers(data, p_params); } -void uppertester_geonetworking_layer::receive_data(OCTETSTRING &data, params_its &p_params) { +void uppertester_geonetworking_layer::receive_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> uppertester_geonetworking_layer::receive_data: ", data); std::unique_ptr r = _codec.decode(data); if (r.get() != nullptr) { diff --git a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.hh index ca7ed34..0ba44fb 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.hh @@ -38,6 +38,6 @@ public: void sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnTrigger &send_par, params_its& p_params); void sendMsg(const LibItsGeoNetworking__TypesAndValues::UtAutoInteropTrigger &send_par, params_its& p_params); - virtual void send_data(OCTETSTRING &data, params_its& p_params); - virtual void receive_data(OCTETSTRING &data, params_its& p_params); + virtual void send_data(OCTETSTRING &data, params& p_params); + virtual void receive_data(OCTETSTRING &data, params& p_params); }; // End of class uppertester_geonetworking_layer diff --git a/ccsrc/Protocols/UpperTester/uppertester_ivim_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_ivim_layer.cc index db864df..1af03aa 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_ivim_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_ivim_layer.cc @@ -52,13 +52,13 @@ void uppertester_ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimTer send_data(data, p_params); } -void uppertester_ivim_layer::send_data(OCTETSTRING &data, params_its &p_params) { +void uppertester_ivim_layer::send_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> uppertester_ivim_layer::send_data: ", data); // params.log(); send_to_all_layers(data, p_params); } -void uppertester_ivim_layer::receive_data(OCTETSTRING &data, params_its &p_params) { +void uppertester_ivim_layer::receive_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> uppertester_ivim_layer::receive_data: ", data); std::unique_ptr r = _codec.decode(data); diff --git a/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_layer.cc index 68580cb..61b36e5 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_layer.cc @@ -32,13 +32,13 @@ void uppertester_mapem_spatem_layer::sendMsg(const LibItsMapemSpatem__TypesAndVa send_data(data, p_params); } -void uppertester_mapem_spatem_layer::send_data(OCTETSTRING& p_data, params_its &p_params) { +void uppertester_mapem_spatem_layer::send_data(OCTETSTRING& p_data, params &p_params) { loggers::get_instance().log_msg(">>> uppertester_mapem_spatem_layer::send_data: ", p_data); // params.log(); send_to_all_layers(p_data, p_params); } -void uppertester_mapem_spatem_layer::receive_data(OCTETSTRING& p_data, params_its &p_params) { +void uppertester_mapem_spatem_layer::receive_data(OCTETSTRING& p_data, params &p_params) { loggers::get_instance().log_msg(">>> uppertester_mapem_spatem_layer::receive_data: ", p_data); std::unique_ptr r = _codec.decode(p_data); diff --git a/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_layer.hh index b42ca3e..0595882 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_layer.hh @@ -35,6 +35,6 @@ public: void sendMsg(const LibItsMapemSpatem__TypesAndValues::UtMapemSpatemInitialize &send_par, params_its& p_params); void sendMsg(const LibItsMapemSpatem__TypesAndValues::UtMapemSpatemTrigger &send_par, params_its& p_params); - virtual void send_data(OCTETSTRING& data, params_its& p_params); - virtual void receive_data(OCTETSTRING& p_data, params_its& p_params); + virtual void send_data(OCTETSTRING& data, params& p_params); + virtual void receive_data(OCTETSTRING& p_data, params& p_params); }; // End of class uppertester_mapem_spatem_layer diff --git a/etc/AtsSecurity/AtsSecurity.cfg b/etc/AtsSecurity/AtsSecurity.cfg index 220ecba..a3eb0a4 100644 --- a/etc/AtsSecurity/AtsSecurity.cfg +++ b/etc/AtsSecurity/AtsSecurity.cfg @@ -3,18 +3,18 @@ # This section shall contain the values of all parameters that are defined in your TTCN-3 modules. # The GeoNetworking address of the IUT. -LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { - typeOfAddress := e_initial, - stationType := e_unknown, - reserved := 0, - mid := '000000000000'O -} #LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { -# typeOfAddress := e_manual, -# stationType := e_roadSideUnit, -# reserved := 49, -# mid := '001C6B0D0201'O +# typeOfAddress := e_initial, +# stationType := e_unknown, +# reserved := 0, +# mid := '000000000000'O #} +LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { + typeOfAddress := e_manual, + stationType := e_roadSideUnit, + reserved := 49, + mid := '001C6B0D0201'O +} LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB LibItsBtp_Pixits.PX_DESTINATION_PORT := 2001 LibItsBtp_Pixits.PX_DESTINATION_PORT_INFO := 2001 @@ -147,7 +147,7 @@ system.camUtPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_po # ------------------------- CAM --------------------------- # Check that IUT sends the secured CAM using SignedData container. -#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_01_BV +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 @@ -187,7 +187,7 @@ system.camUtPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_po # 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 +#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. diff --git a/titan-test-system-framework b/titan-test-system-framework index efce1fb..24f9b4e 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit efce1fbd81bf78207a428d1e0ab4c1d436bfa469 +Subproject commit 24f9b4e18ff2d41b9349fa8c1e23cbc9905eb551 diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 4fcb322..61c3743 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 4fcb322a3f486cf77559290eac59a4cd709f1363 +Subproject commit 61c37436e45c22873ae3d512982db262d8274c89 diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index bd47e3e..f0f7b1b 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit bd47e3e45bf3787d8ec3d1e5554c6952d5f86ba7 +Subproject commit f0f7b1b479e1bc01bc58cfcd86af9831c26ddefb diff --git a/ttcn/AtsGeoNetworking b/ttcn/AtsGeoNetworking index 348db38..a3d39a7 160000 --- a/ttcn/AtsGeoNetworking +++ b/ttcn/AtsGeoNetworking @@ -1 +1 @@ -Subproject commit 348db38fb54e9554b3ac4fbb982fe0ed1bff17c1 +Subproject commit a3d39a719245239aaf91c23c8da57464ab59dd53 diff --git a/ttcn/AtsIPv6OverGeoNetworking b/ttcn/AtsIPv6OverGeoNetworking index d809854..49aec24 160000 --- a/ttcn/AtsIPv6OverGeoNetworking +++ b/ttcn/AtsIPv6OverGeoNetworking @@ -1 +1 @@ -Subproject commit d809854002df6eb2ebb5cb120a51e11ee6277c25 +Subproject commit 49aec246ebefa8eb74b0a06566c47288c94e71d6 diff --git a/ttcn/AtsIS b/ttcn/AtsIS index 8110f6c..f788e19 160000 --- a/ttcn/AtsIS +++ b/ttcn/AtsIS @@ -1 +1 @@ -Subproject commit 8110f6c72909313ab017fe72f7fa23130f77f3be +Subproject commit f788e19d36b042b4471b0de38f9993b6d44f2250 diff --git a/ttcn/AtsPki b/ttcn/AtsPki index ba3b34d..0400d1a 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit ba3b34d02b0307ee7419053eb79f13dae07cf530 +Subproject commit 0400d1acd33cb610211826772f4100706237d0cf diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 7dc348f..121c65e 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 7dc348f631c1ce89adf120fb2925fe5810463305 +Subproject commit 121c65e29e4d636921dd6e2bf5b853aee90d7d2f diff --git a/ttcn/LibIts b/ttcn/LibIts index d431152..f68487c 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit d4311521a528842673b0b0c0404cfe38649f16ed +Subproject commit f68487c477dd1f174cafd5a2f4e2bfc205ba8cfb -- GitLab From f5888f0236d6f02df916b6b43e638ffda5000437 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Tue, 4 Oct 2022 08:30:07 +0200 Subject: [PATCH 025/178] Re-organize ccsrc/Protocols/BTP; Bug fixed in Layers --- ccsrc/Protocols/BTP/btp_layer.cc | 114 ------------------ ccsrc/Protocols/BTP/btp_layer.hh | 69 ----------- ccsrc/Protocols/BTP/btp_layer_factory.hh | 41 ------- ccsrc/Protocols/BTP/module.mk | 4 +- .../UpperTester/uppertester_ivim_layer.hh | 4 +- 5 files changed, 4 insertions(+), 228 deletions(-) delete mode 100644 ccsrc/Protocols/BTP/btp_layer.cc delete mode 100644 ccsrc/Protocols/BTP/btp_layer.hh delete mode 100644 ccsrc/Protocols/BTP/btp_layer_factory.hh diff --git a/ccsrc/Protocols/BTP/btp_layer.cc b/ccsrc/Protocols/BTP/btp_layer.cc deleted file mode 100644 index 50b0228..0000000 --- a/ccsrc/Protocols/BTP/btp_layer.cc +++ /dev/null @@ -1,114 +0,0 @@ -#include "btp_types.hh" - -#include "btp_layer_factory.hh" - -#include "loggers.hh" - -#include "converter.hh" - -btp_layer::btp_layer(const std::string &p_type, const std::string ¶m) - : t_layer(p_type), _params(), _codec(), _device_mode{true} { - loggers::get_instance().log(">>> btp_layer::btp_layer: %s, %s", to_string().c_str(), param.c_str()); - // Setup parameters - params_its::convert(_params, param); - - // Sanity check - params_its::const_iterator it = _params.find(params_its::btp_type); - if (it == _params.cend()) { - _params[params_its::btp_type] = std::string("btpB"); - } - it = _params.find(params_its::btp_destination_port); - if (it == _params.cend()) { - _params[params_its::btp_destination_port] = std::to_string(2001); - } - it = _params.find(params_its::btp_info); - if (it == _params.cend()) { - _params[params_its::btp_info] = std::to_string(0); - } - it = _params.find(params_its::device_mode); - if (it != _params.cend()) { - _device_mode = (1 == converter::get_instance().string_to_int(it->second)); - } -} - -void btp_layer::sendMsg(const LibItsBtp__TypesAndValues::BtpReq &p, params &p_params) { - loggers::get_instance().log(">>> btp_layer::sendMsg"); - // params.log(); - - // Encode BTP PDU - OCTETSTRING data; - _codec.encode(p.msgOut(), data); - send_data(data, p_params); -} - -void btp_layer::send_data(OCTETSTRING &data, params &p_params) { - loggers::get_instance().log_msg(">>> btp_layer::send_data: ", data); - //p_params.log(); // TODO To be removed - //_params.log(); // TODO To be removed - - params_its ¶ms = static_cast(p_params); - - if (_device_mode) { - LibItsBtp__TypesAndValues::BtpHeader header; - std::string btp_type; - params_its::const_iterator it = params.find(params_its::next_header); - if (it != params.cend()) { - btp_type = it->second; - } else { - btp_type = _params[params_its::btp_type]; - } - loggers::get_instance().log("btp_layer::send_data: btp_type=%s", btp_type.c_str()); - int btp_destination_port = std::stoi(_params[params_its::btp_destination_port]); // Default value - it = params.find(params_its::btp_destination_port); - if (it != params.cend()) { - btp_destination_port = std::stoi(params[params_its::btp_destination_port]); // Overwritting default value - } - loggers::get_instance().log("btp_layer::send_data: btp_destination_port=%d", btp_destination_port); - if (btp_type.compare("btpA") == 0) { - header.btpAHeader() = LibItsBtp__TypesAndValues::BtpAHeader(btp_destination_port, std::stoi(_params[params_its::btp_info])); - } else { - header.btpBHeader() = LibItsBtp__TypesAndValues::BtpBHeader(btp_destination_port, std::stoi(_params[params_its::btp_info])); - } - LibItsBtp__TypesAndValues::BtpPacket p(header, data); - loggers::get_instance().log_msg("btp_layer::send_data: ", p); - - // Encode BTP PDU - OCTETSTRING os; - _codec.encode(p, os); - data = os; - } - - send_to_all_layers(data, params); -} - -void btp_layer::receive_data(OCTETSTRING &data, params &p_params) { - loggers::get_instance().log_msg(">>> btp_layer::receive_data: ", data); - //p_params.log(); - - // Decode the payload - params_its ¶ms = static_cast(p_params); - LibItsBtp__TypesAndValues::BtpInd p; - loggers::get_instance().log("btp_layer::receive_data: Looking for %s", params_its::gn_next_header.c_str()); - params_its::const_iterator it = params.find(params_its::gn_next_header); - if (it != params.cend()) { - loggers::get_instance().log("btp_layer::receive_data: Call set_btp_type with %s/%d", it->second.c_str(), - (it->second.compare("2") == 0) ? btp_codec::btpB : btp_codec::btpA); - _codec.set_btp_type((it->second.compare("2") == 0) ? btp_codec::btpB : btp_codec::btpA); - } - _codec.decode(data, p.msgIn(), ¶ms); - - // Pass the BTP raw payload to the upper layers if any - it = params.find(params_its::btp_payload); - if (it != params.cend()) { - loggers::get_instance().log("btp_layer::receive_data: btp_payload=%s", it->second.c_str()); - OCTETSTRING os(str2oct(CHARSTRING(it->second.c_str()))); - receive_to_all_layers(os, params); - } else { - loggers::get_instance().warning("btp_layer::receive_data: No payload to pass to upper layers"); - } - // Pass it to the ports if any - // params.log(); - to_all_upper_ports(p, p_params); -} - -btp_layer_factory btp_layer_factory::_f; diff --git a/ccsrc/Protocols/BTP/btp_layer.hh b/ccsrc/Protocols/BTP/btp_layer.hh deleted file mode 100644 index 1d31dae..0000000 --- a/ccsrc/Protocols/BTP/btp_layer.hh +++ /dev/null @@ -1,69 +0,0 @@ -/*! - * \file btp_layer.hh - * \brief Header file for ITS BTP protocol layer. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include "btp_codec.hh" -#include "t_layer.hh" - -namespace LibItsBtp__TestSystem { - class BtpPort; //! Forward declaration of TITAN class - class BtpReq; //! Forward declaration of TITAN class - class BtpInd; //! Forward declaration of TITAN class -} // namespace LibItsBtp__TestSystem - -/*! - * \class btp_layer - * \brief This class provides description of ITS BTP protocol layer - */ -class btp_layer : public t_layer { - params_its _params; //! Layer parameters - btp_codec _codec; //! BTP codec - bool _device_mode; //! Set to true if the BTP layer shall encapsulate the upper layer PDU -public: //! \publicsection - /*! - * \brief Default constructor - * Create a new instance of the btp_layer class - */ - explicit btp_layer() : t_layer(), _params(), _codec(), _device_mode{false} {}; - /*! - * \brief Specialised constructor - * Create a new instance of the btp_layer class - * \param[in] p_type \todo - * \param[in] p_param \todo - */ - btp_layer(const std::string &p_type, const std::string ¶m); - virtual ~btp_layer(){}; - - /*! - * \fn void sendMsg(const LibItsBtp__TestSystem::BtpReq& p_btp_req, params_its& p_param); - * \brief Send BTP message to the lower layers - * \param[in] p_btp_req The BTP message to be sent - * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters - */ - void sendMsg(const LibItsBtp__TypesAndValues::BtpReq &p_btp_req, params &p_params); - - /*! - * \virtual - * \fn void send_data(OCTETSTRING& data, params& params); - * \brief Send bytes formated data to the lower layers - * \param[in] p_data The data to be sent - * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters - */ - virtual void send_data(OCTETSTRING &data, params& p_params); - /*! - * \virtual - * \fn void receive_data(OCTETSTRING& data, params& params); - * \brief Receive bytes formated data from the lower layers - * \param[in] p_data The bytes formated data received - * \param[in] p_params Some lower layers parameters values when data was received - */ - virtual void receive_data(OCTETSTRING &data, params& p_params); -}; // End of class btp_layer diff --git a/ccsrc/Protocols/BTP/btp_layer_factory.hh b/ccsrc/Protocols/BTP/btp_layer_factory.hh deleted file mode 100644 index e2fa996..0000000 --- a/ccsrc/Protocols/BTP/btp_layer_factory.hh +++ /dev/null @@ -1,41 +0,0 @@ -/*! - * \file btp_layer_factory.hh - * \brief Header file for ITS BTP protocol layer factory. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include "layer_stack_builder.hh" - -#include "btp_layer.hh" - -/*! - * \class cam_layer_factory - * \brief This class provides a factory class to create a btp_layer class instance - */ -class btp_layer_factory : public layer_factory { - static btp_layer_factory _f; //! Reference to the unique instance of this class -public: //! \publicsection - /*! - * \brief Default constructor - * Create a new instance of the btp_layer_factory class - * \remark The BTP layer identifier is BTP - */ - btp_layer_factory() { - // Register factory - layer_stack_builder::register_layer_factory("BTP", this); - }; - /*! - * \fn layer* create_layer(const std::string & type, const std::string & param); - * \brief Create the layers stack based on the provided layers stack description - * \param[in] p_type The provided layers stack description - * \param[in] p_params Optional parameters - * \return 0 on success, -1 otherwise - */ - inline virtual layer *create_layer(const std::string &p_type, const std::string &p_param) { return new btp_layer(p_type, p_param); }; -}; // End of class btp_layer_factory diff --git a/ccsrc/Protocols/BTP/module.mk b/ccsrc/Protocols/BTP/module.mk index 5e45124..850a3b9 100644 --- a/ccsrc/Protocols/BTP/module.mk +++ b/ccsrc/Protocols/BTP/module.mk @@ -1,2 +1,2 @@ -sources := btp_codec.cc btp_layer.cc -includes := . \ No newline at end of file +sources := btp_codec.cc +includes := . diff --git a/ccsrc/Protocols/UpperTester/uppertester_ivim_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_ivim_layer.hh index 97aa96c..8525662 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_ivim_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_ivim_layer.hh @@ -38,6 +38,6 @@ public: void sendMsg(const LibItsIvim__TypesAndValues::UtIvimUpdate &send_par, params_its& p_params); void sendMsg(const LibItsIvim__TypesAndValues::UtIvimTermination &send_par, params_its& p_params); - virtual void send_data(OCTETSTRING &data, params_its& p_params); - virtual void receive_data(OCTETSTRING &data, params_its& info); + virtual void send_data(OCTETSTRING &data, params& p_params); + virtual void receive_data(OCTETSTRING &data, params& info); }; // End of class uppertester_ivim_layer -- GitLab From b65728086cf92d7e77baf030d6b459103340f98e Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Tue, 4 Oct 2022 15:23:13 +0200 Subject: [PATCH 026/178] Re-organize ccsrc/Protocols/BTP; Bug fixed in Layers --- ccsrc/Protocols/BTP_layers/btp_layer.cc | 114 ++++++++++++++++++ ccsrc/Protocols/BTP_layers/btp_layer.hh | 69 +++++++++++ .../Protocols/BTP_layers/btp_layer_factory.hh | 41 +++++++ ccsrc/Protocols/BTP_layers/module.mk | 2 + etc/AtsCAM/AtsCAM.cfg | 4 +- scripts/build_titan.bash | 3 + titan-test-system-framework | 2 +- .../docker/home/etc/init.d/10-titan.sh | 3 + 8 files changed, 235 insertions(+), 3 deletions(-) create mode 100644 ccsrc/Protocols/BTP_layers/btp_layer.cc create mode 100644 ccsrc/Protocols/BTP_layers/btp_layer.hh create mode 100644 ccsrc/Protocols/BTP_layers/btp_layer_factory.hh create mode 100644 ccsrc/Protocols/BTP_layers/module.mk diff --git a/ccsrc/Protocols/BTP_layers/btp_layer.cc b/ccsrc/Protocols/BTP_layers/btp_layer.cc new file mode 100644 index 0000000..50b0228 --- /dev/null +++ b/ccsrc/Protocols/BTP_layers/btp_layer.cc @@ -0,0 +1,114 @@ +#include "btp_types.hh" + +#include "btp_layer_factory.hh" + +#include "loggers.hh" + +#include "converter.hh" + +btp_layer::btp_layer(const std::string &p_type, const std::string ¶m) + : t_layer(p_type), _params(), _codec(), _device_mode{true} { + loggers::get_instance().log(">>> btp_layer::btp_layer: %s, %s", to_string().c_str(), param.c_str()); + // Setup parameters + params_its::convert(_params, param); + + // Sanity check + params_its::const_iterator it = _params.find(params_its::btp_type); + if (it == _params.cend()) { + _params[params_its::btp_type] = std::string("btpB"); + } + it = _params.find(params_its::btp_destination_port); + if (it == _params.cend()) { + _params[params_its::btp_destination_port] = std::to_string(2001); + } + it = _params.find(params_its::btp_info); + if (it == _params.cend()) { + _params[params_its::btp_info] = std::to_string(0); + } + it = _params.find(params_its::device_mode); + if (it != _params.cend()) { + _device_mode = (1 == converter::get_instance().string_to_int(it->second)); + } +} + +void btp_layer::sendMsg(const LibItsBtp__TypesAndValues::BtpReq &p, params &p_params) { + loggers::get_instance().log(">>> btp_layer::sendMsg"); + // params.log(); + + // Encode BTP PDU + OCTETSTRING data; + _codec.encode(p.msgOut(), data); + send_data(data, p_params); +} + +void btp_layer::send_data(OCTETSTRING &data, params &p_params) { + loggers::get_instance().log_msg(">>> btp_layer::send_data: ", data); + //p_params.log(); // TODO To be removed + //_params.log(); // TODO To be removed + + params_its ¶ms = static_cast(p_params); + + if (_device_mode) { + LibItsBtp__TypesAndValues::BtpHeader header; + std::string btp_type; + params_its::const_iterator it = params.find(params_its::next_header); + if (it != params.cend()) { + btp_type = it->second; + } else { + btp_type = _params[params_its::btp_type]; + } + loggers::get_instance().log("btp_layer::send_data: btp_type=%s", btp_type.c_str()); + int btp_destination_port = std::stoi(_params[params_its::btp_destination_port]); // Default value + it = params.find(params_its::btp_destination_port); + if (it != params.cend()) { + btp_destination_port = std::stoi(params[params_its::btp_destination_port]); // Overwritting default value + } + loggers::get_instance().log("btp_layer::send_data: btp_destination_port=%d", btp_destination_port); + if (btp_type.compare("btpA") == 0) { + header.btpAHeader() = LibItsBtp__TypesAndValues::BtpAHeader(btp_destination_port, std::stoi(_params[params_its::btp_info])); + } else { + header.btpBHeader() = LibItsBtp__TypesAndValues::BtpBHeader(btp_destination_port, std::stoi(_params[params_its::btp_info])); + } + LibItsBtp__TypesAndValues::BtpPacket p(header, data); + loggers::get_instance().log_msg("btp_layer::send_data: ", p); + + // Encode BTP PDU + OCTETSTRING os; + _codec.encode(p, os); + data = os; + } + + send_to_all_layers(data, params); +} + +void btp_layer::receive_data(OCTETSTRING &data, params &p_params) { + loggers::get_instance().log_msg(">>> btp_layer::receive_data: ", data); + //p_params.log(); + + // Decode the payload + params_its ¶ms = static_cast(p_params); + LibItsBtp__TypesAndValues::BtpInd p; + loggers::get_instance().log("btp_layer::receive_data: Looking for %s", params_its::gn_next_header.c_str()); + params_its::const_iterator it = params.find(params_its::gn_next_header); + if (it != params.cend()) { + loggers::get_instance().log("btp_layer::receive_data: Call set_btp_type with %s/%d", it->second.c_str(), + (it->second.compare("2") == 0) ? btp_codec::btpB : btp_codec::btpA); + _codec.set_btp_type((it->second.compare("2") == 0) ? btp_codec::btpB : btp_codec::btpA); + } + _codec.decode(data, p.msgIn(), ¶ms); + + // Pass the BTP raw payload to the upper layers if any + it = params.find(params_its::btp_payload); + if (it != params.cend()) { + loggers::get_instance().log("btp_layer::receive_data: btp_payload=%s", it->second.c_str()); + OCTETSTRING os(str2oct(CHARSTRING(it->second.c_str()))); + receive_to_all_layers(os, params); + } else { + loggers::get_instance().warning("btp_layer::receive_data: No payload to pass to upper layers"); + } + // Pass it to the ports if any + // params.log(); + to_all_upper_ports(p, p_params); +} + +btp_layer_factory btp_layer_factory::_f; diff --git a/ccsrc/Protocols/BTP_layers/btp_layer.hh b/ccsrc/Protocols/BTP_layers/btp_layer.hh new file mode 100644 index 0000000..1d31dae --- /dev/null +++ b/ccsrc/Protocols/BTP_layers/btp_layer.hh @@ -0,0 +1,69 @@ +/*! + * \file btp_layer.hh + * \brief Header file for ITS BTP protocol layer. + * \author ETSI STF525 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ +#pragma once + +#include "btp_codec.hh" +#include "t_layer.hh" + +namespace LibItsBtp__TestSystem { + class BtpPort; //! Forward declaration of TITAN class + class BtpReq; //! Forward declaration of TITAN class + class BtpInd; //! Forward declaration of TITAN class +} // namespace LibItsBtp__TestSystem + +/*! + * \class btp_layer + * \brief This class provides description of ITS BTP protocol layer + */ +class btp_layer : public t_layer { + params_its _params; //! Layer parameters + btp_codec _codec; //! BTP codec + bool _device_mode; //! Set to true if the BTP layer shall encapsulate the upper layer PDU +public: //! \publicsection + /*! + * \brief Default constructor + * Create a new instance of the btp_layer class + */ + explicit btp_layer() : t_layer(), _params(), _codec(), _device_mode{false} {}; + /*! + * \brief Specialised constructor + * Create a new instance of the btp_layer class + * \param[in] p_type \todo + * \param[in] p_param \todo + */ + btp_layer(const std::string &p_type, const std::string ¶m); + virtual ~btp_layer(){}; + + /*! + * \fn void sendMsg(const LibItsBtp__TestSystem::BtpReq& p_btp_req, params_its& p_param); + * \brief Send BTP message to the lower layers + * \param[in] p_btp_req The BTP message to be sent + * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters + */ + void sendMsg(const LibItsBtp__TypesAndValues::BtpReq &p_btp_req, params &p_params); + + /*! + * \virtual + * \fn void send_data(OCTETSTRING& data, params& params); + * \brief Send bytes formated data to the lower layers + * \param[in] p_data The data to be sent + * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters + */ + virtual void send_data(OCTETSTRING &data, params& p_params); + /*! + * \virtual + * \fn void receive_data(OCTETSTRING& data, params& params); + * \brief Receive bytes formated data from the lower layers + * \param[in] p_data The bytes formated data received + * \param[in] p_params Some lower layers parameters values when data was received + */ + virtual void receive_data(OCTETSTRING &data, params& p_params); +}; // End of class btp_layer diff --git a/ccsrc/Protocols/BTP_layers/btp_layer_factory.hh b/ccsrc/Protocols/BTP_layers/btp_layer_factory.hh new file mode 100644 index 0000000..e2fa996 --- /dev/null +++ b/ccsrc/Protocols/BTP_layers/btp_layer_factory.hh @@ -0,0 +1,41 @@ +/*! + * \file btp_layer_factory.hh + * \brief Header file for ITS BTP protocol layer factory. + * \author ETSI STF525 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ +#pragma once + +#include "layer_stack_builder.hh" + +#include "btp_layer.hh" + +/*! + * \class cam_layer_factory + * \brief This class provides a factory class to create a btp_layer class instance + */ +class btp_layer_factory : public layer_factory { + static btp_layer_factory _f; //! Reference to the unique instance of this class +public: //! \publicsection + /*! + * \brief Default constructor + * Create a new instance of the btp_layer_factory class + * \remark The BTP layer identifier is BTP + */ + btp_layer_factory() { + // Register factory + layer_stack_builder::register_layer_factory("BTP", this); + }; + /*! + * \fn layer* create_layer(const std::string & type, const std::string & param); + * \brief Create the layers stack based on the provided layers stack description + * \param[in] p_type The provided layers stack description + * \param[in] p_params Optional parameters + * \return 0 on success, -1 otherwise + */ + inline virtual layer *create_layer(const std::string &p_type, const std::string &p_param) { return new btp_layer(p_type, p_param); }; +}; // End of class btp_layer_factory diff --git a/ccsrc/Protocols/BTP_layers/module.mk b/ccsrc/Protocols/BTP_layers/module.mk new file mode 100644 index 0000000..d74bc75 --- /dev/null +++ b/ccsrc/Protocols/BTP_layers/module.mk @@ -0,0 +1,2 @@ +sources := btp_layer.cc +includes := . \ No newline at end of file diff --git a/etc/AtsCAM/AtsCAM.cfg b/etc/AtsCAM/AtsCAM.cfg index 61f266c..e816b26 100644 --- a/etc/AtsCAM/AtsCAM.cfg +++ b/etc/AtsCAM/AtsCAM.cfg @@ -108,8 +108,8 @@ system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port= #system.utPort.params := "UT_CAM/UDP(dst_ip=172.16.35.1)" [EXECUTE] -ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 -#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 +ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_05 diff --git a/scripts/build_titan.bash b/scripts/build_titan.bash index d2c0734..1c255a9 100755 --- a/scripts/build_titan.bash +++ b/scripts/build_titan.bash @@ -84,6 +84,9 @@ DEBUG:=no GEN_PDF:=no EOF +# To prevent link error /usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command lineema +sed --in-place 's/LINUX_LIBS := -lxml2/LINUX_LIBS := -lxml2 -lpthread/g' ./core/Makefile + echo "Starting build..." make clean if [ "${OSTYPE}" == "cygwin" ] diff --git a/titan-test-system-framework b/titan-test-system-framework index 24f9b4e..3ed2fe8 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit 24f9b4e18ff2d41b9349fa8c1e23cbc9905eb551 +Subproject commit 3ed2fe8a69be8562c2f9d8f5b1afb8ba91d5776a diff --git a/virtualization/docker/home/etc/init.d/10-titan.sh b/virtualization/docker/home/etc/init.d/10-titan.sh index 840bf28..c7d2c4c 100755 --- a/virtualization/docker/home/etc/init.d/10-titan.sh +++ b/virtualization/docker/home/etc/init.d/10-titan.sh @@ -27,6 +27,9 @@ GEN_PDF=no JDKDIR=$JAVA_HOME EOF +# To prevent link error /usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command lineema +sed --in-place 's/LINUX_LIBS := -lxml2/LINUX_LIBS := -lxml2 -lpthread/g' ./core/Makefile + make && make install || exit 1 # To be compiant with build_ttcn3.bash -- GitLab From 07d417a05d0efbea601920d94f99f632cf13b3ae Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 7 Oct 2022 10:04:49 +0200 Subject: [PATCH 027/178] Create templates for AtsMBR (TTF T024) --- .gitmodules | 4 ++++ ttcn/AtsMBR | 1 + 2 files changed, 5 insertions(+) create mode 160000 ttcn/AtsMBR diff --git a/.gitmodules b/.gitmodules index c7e1567..9c50fae 100644 --- a/.gitmodules +++ b/.gitmodules @@ -44,3 +44,7 @@ path = titan-test-system-framework url = https://labs.etsi.org/rep/cti-tools/titan-test-system-framework.git branch = devel +[submodule "ttcn/AtsMBR"] + path = ttcn/AtsMBR + url = https://forge.etsi.org/rep/ITS/ttcn/mbr_ts_103759.git + branch = devel diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR new file mode 160000 index 0000000..0a0a077 --- /dev/null +++ b/ttcn/AtsMBR @@ -0,0 +1 @@ +Subproject commit 0a0a0774bcb1247faba390b38ab0dc719bcacc5e -- GitLab From 50a1276ddd359bc17936a14b1bbcb40807ad8033 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 7 Oct 2022 14:50:09 +0200 Subject: [PATCH 028/178] Update run files --- scripts/run_all.bash | 5 ++++- scripts/run_mtc.bash | 1 - titan-test-system-framework | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/run_all.bash b/scripts/run_all.bash index fd921d1..f5fe449 100755 --- a/scripts/run_all.bash +++ b/scripts/run_all.bash @@ -49,7 +49,10 @@ do done sleep 1 - mv ../logs/$ATS/merged.log ../logs/$ATS/merged.`date +'%Y%m%d%S'`.log + if [ -f ../logs/$ATS/merged_formated.log ] + then + mv ../logs/$ATS/merged_formated.log ../logs/$ATS/merged.`date +'%Y%m%d%S'`.log + fi done exit 0 diff --git a/scripts/run_mtc.bash b/scripts/run_mtc.bash index 0559a9e..e225512 100755 --- a/scripts/run_mtc.bash +++ b/scripts/run_mtc.bash @@ -42,7 +42,6 @@ if [ "${TITAN_LOG_DIR}" != "" ] then ttcn3_logmerge -o ${TITAN_LOG_DIR}/merged.log ${LOG_FILES} ttcn3_logformat -o ${TITAN_LOG_DIR}/merged_formated.log ${TITAN_LOG_DIR}/merged.log - mv ${TITAN_LOG_DIR}/merged_formated.log ${TITAN_LOG_DIR}/merged.log echo "log files were merged into ${TITAN_LOG_DIR}/merged.log" fi diff --git a/titan-test-system-framework b/titan-test-system-framework index 3ed2fe8..a49d8da 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit 3ed2fe8a69be8562c2f9d8f5b1afb8ba91d5776a +Subproject commit a49d8daee3e5df27198a1902a7c630a84351e427 -- GitLab From de4685052c25c1263cbde9b77e66eea49dee2499 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Wed, 19 Oct 2022 11:18:05 +0200 Subject: [PATCH 029/178] asn1/Makefile for AtsMBR --- asn1/Makefile | 10 ++++++++-- ttcn/AtsCAM | 2 +- ttcn/AtsMBR | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/asn1/Makefile b/asn1/Makefile index e2f9880..f05bf62 100644 --- a/asn1/Makefile +++ b/asn1/Makefile @@ -48,7 +48,13 @@ ASN_FILES = AtsCAM/lib/asn1/CAM_PDU_Descriptions.asn \ AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1LaMaInterface.asn \ AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1LaRaInterface.asn \ AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1MaRaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1Protocol.asn + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1Protocol.asn \ + AtsMBR/lib/asn1/EtsiTs103759.asn \ + AtsMBR/lib/asn1/EtsiTs103759AsrAppAgnostic.asn \ + AtsMBR/lib/asn1/EtsiTs103759AsrCam.asn \ + AtsMBR/lib/asn1/EtsiTs103759AsrDenm.asn \ + AtsMBR/lib/asn1/EtsiTs103759CommonObservations.asn \ + AtsMBR/lib/asn1/SaeJ3287AsrBsm.asn # ../build/asn1/ISO_TS_19091/ISO-TS-19091-addgrp-C-2018-patched.asn \ # ../build/asn1/ISO_TS_19091/AddGrpC.asn \ @@ -67,7 +73,7 @@ ASN_FILES = AtsCAM/lib/asn1/CAM_PDU_Descriptions.asn \ # AtsPki/lib/asn1/EtsiTs102941TypesLinkCertificate.asn \ # PDUs -PDU = CAM DENM MAPEM SPATEM SREM SSEM IVIM RTCMEM EtsiTs103097Data EtsiTs103097Certificate +PDU = CAM DENM MAPEM SPATEM SREM SSEM IVIM RTCMEM EtsiTs103097Data EtsiTs103097Certificate EtsiTs103759Data #EtsiTs102941Data #patches diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 61c3743..92d2aa3 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 61c37436e45c22873ae3d512982db262d8274c89 +Subproject commit 92d2aa36b5705254387cb88bd73679d823096459 diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index 0a0a077..bd54aa1 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit 0a0a0774bcb1247faba390b38ab0dc719bcacc5e +Subproject commit bd54aa11b85570821fa57ecaee2cb9d7223d21fb -- GitLab From 3b41edb8b4e739f494c03e430f651d832b33056c Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 4 Nov 2022 16:04:30 +0100 Subject: [PATCH 030/178] Add test purposes squeletons --- Makefile | 2 +- asn1/Makefile | 1 + titan-test-system-framework | 2 +- ttcn/AtsMBR | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1c72c69..93f616b 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ $$(foreach I, $$(includes), $$(eval all_includes += $$(if $$(filter /%, $$(I)), $$(foreach M, $$(modules), $$(eval $$(call IncludeModule, $$(if $$(filter /%, $$(M)), $$(TOPDIR)/$$(M), $(1)/$$(M))))) endef -all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src $(TOPDIR)/ccsrc/Framework /usr/include/jsoncpp +all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src /usr/include/jsoncpp defines += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS) AS_USE_SSL libs += $(TTCN3_DIR)/lib/libttcn3-rt2-parallel.a -lstdc++fs diff --git a/asn1/Makefile b/asn1/Makefile index f05bf62..898efd1 100644 --- a/asn1/Makefile +++ b/asn1/Makefile @@ -53,6 +53,7 @@ ASN_FILES = AtsCAM/lib/asn1/CAM_PDU_Descriptions.asn \ AtsMBR/lib/asn1/EtsiTs103759AsrAppAgnostic.asn \ AtsMBR/lib/asn1/EtsiTs103759AsrCam.asn \ AtsMBR/lib/asn1/EtsiTs103759AsrDenm.asn \ + AtsMBR/lib/asn1/EtsiTs103759BaseTypes.asn \ AtsMBR/lib/asn1/EtsiTs103759CommonObservations.asn \ AtsMBR/lib/asn1/SaeJ3287AsrBsm.asn diff --git a/titan-test-system-framework b/titan-test-system-framework index a49d8da..a24f374 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit a49d8daee3e5df27198a1902a7c630a84351e427 +Subproject commit a24f37489fd2fb50bfcd3a35b3e8e094a9c2bf6a diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index bd54aa1..2fa2cb3 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit bd54aa11b85570821fa57ecaee2cb9d7223d21fb +Subproject commit 2fa2cb3e54c00b68682cf178c44b78abb95ffafa -- GitLab From 7b78eeb9aa69be6fa30b19cc3d4ffcd90e719669 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Mon, 28 Nov 2022 15:35:51 +0100 Subject: [PATCH 031/178] Update asn.1 Makefile --- asn1/Makefile | 109 ++++++++++++++++++++++++++++---------------------- 1 file changed, 62 insertions(+), 47 deletions(-) diff --git a/asn1/Makefile b/asn1/Makefile index 898efd1..77cba37 100644 --- a/asn1/Makefile +++ b/asn1/Makefile @@ -8,54 +8,69 @@ # The name of the library ASN_LIBRARY = libItsAsn.a # ASN.1 files to be included in the library -ASN_FILES = AtsCAM/lib/asn1/CAM_PDU_Descriptions.asn \ - AtsCAM/lib/asn1/cdd/ITS_Container.asn \ - AtsDENM/lib/asn1/DENM_PDU_Descriptions.asn \ - AtsSecurity/lib/asn1/EtsiTs103097ExtensionModule.asn \ - AtsSecurity/lib/asn1/EtsiTs103097Module.asn \ - AtsSecurity/lib/asn1/ieee1609dot2/Ieee1609Dot2.asn \ - AtsSecurity/lib/asn1/ieee1609dot2/Ieee1609Dot2BaseTypes.asn\ - AtsIS/lib/asn1/IVIM_PDU_Descriptions.asn \ - AtsIS/lib/asn1/MAPEM_PDU_Descriptions.asn \ - AtsIS/lib/asn1/RTCMEM_PDU_Descriptions.asn \ - AtsIS/lib/asn1/SPATEM_PDU_Descriptions.asn \ - AtsIS/lib/asn1/SREM_PDU_Descriptions.asn \ - AtsIS/lib/asn1/SSEM_PDU_Descriptions.asn \ - AtsIS/lib/asn1/iso-patched/EfcDsrcApplication.asn \ - AtsIS/lib/asn1/iso-patched/EfcDsrcGeneric.asn \ +ASN_FILES = AtsCAM/lib/asn1/CAM_PDU_Descriptions.asn \ + AtsCAM/lib/asn1/cdd/ITS_Container.asn \ + AtsDENM/lib/asn1/DENM_PDU_Descriptions.asn \ + AtsSecurity/lib/asn1/EtsiTs103097ExtensionModule.asn \ + AtsSecurity/lib/asn1/EtsiTs103097Module.asn \ + AtsSecurity/lib/asn1/ieee1609dot2/Ieee1609Dot2.asn \ + AtsSecurity/lib/asn1/ieee1609dot2/Ieee1609Dot2BaseTypes.asn \ + AtsIS/lib/asn1/IVIM_PDU_Descriptions.asn \ + AtsIS/lib/asn1/MAPEM_PDU_Descriptions.asn \ + AtsIS/lib/asn1/RTCMEM_PDU_Descriptions.asn \ + AtsIS/lib/asn1/SPATEM_PDU_Descriptions.asn \ + AtsIS/lib/asn1/SREM_PDU_Descriptions.asn \ + AtsIS/lib/asn1/SSEM_PDU_Descriptions.asn \ + AtsIS/lib/asn1/iso-patched/EfcDsrcApplication.asn \ + AtsIS/lib/asn1/iso-patched/EfcDsrcGeneric.asn \ AtsIS/lib/asn1/iso-patched/ElectronicRegistrationIdentificationVehicleDataModule.asn \ - AtsIS/lib/asn1/iso-patched/GDD.asn \ - AtsIS/lib/asn1/iso-patched/DSRC.asn \ - AtsIS/lib/asn1/iso-patched/DSRC_noCircular.asn \ - AtsIS/lib/asn1/iso-patched/REGION.asn \ - AtsIS/lib/asn1/iso-patched/AddGrpC.asn \ - AtsIS/lib/asn1/iso-patched/AddGrpC_noCircular.asn \ - ../build/asn1/ISO_TS_14816/AVIAEINumberingAndDataStructures.asn \ - ../build/asn1/ISO_TS_17419/CITSapplMgmtIDs.asn \ - ../build/asn1/ISO_TS_19321/IVI.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Crl.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2CrlBaseTypes.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaEeInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaLaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaMaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaRaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1Acpc.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1CamRaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1CertManagement.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1EcaEeInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1EeMaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1EeRaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1LaMaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1LaRaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1MaRaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1Protocol.asn \ - AtsMBR/lib/asn1/EtsiTs103759.asn \ - AtsMBR/lib/asn1/EtsiTs103759AsrAppAgnostic.asn \ - AtsMBR/lib/asn1/EtsiTs103759AsrCam.asn \ - AtsMBR/lib/asn1/EtsiTs103759AsrDenm.asn \ - AtsMBR/lib/asn1/EtsiTs103759BaseTypes.asn \ - AtsMBR/lib/asn1/EtsiTs103759CommonObservations.asn \ - AtsMBR/lib/asn1/SaeJ3287AsrBsm.asn + AtsIS/lib/asn1/iso-patched/GDD.asn \ + AtsIS/lib/asn1/iso-patched/DSRC.asn \ + AtsIS/lib/asn1/iso-patched/DSRC_noCircular.asn \ + AtsIS/lib/asn1/iso-patched/REGION.asn \ + AtsIS/lib/asn1/iso-patched/AddGrpC.asn \ + AtsIS/lib/asn1/iso-patched/AddGrpC_noCircular.asn \ + ../build/asn1/ISO_TS_14816/AVIAEINumberingAndDataStructures.asn \ + ../build/asn1/ISO_TS_17419/CITSapplMgmtIDs.asn \ + ../build/asn1/ISO_TS_19321/IVI.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Crl.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2CrlBaseTypes.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaEeInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaLaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaMaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaRaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1Acpc.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1CamRaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1CertManagement.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1EcaEeInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1EeMaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1EeRaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1LaMaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1LaRaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1MaRaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1Protocol.asn \ + AtsMBR/lib/asn1/EtsiTs103759.asn \ + AtsMBR/lib/asn1/EtsiTs103759BaseTypes.asn \ + AtsMBR/lib/asn1/EtsiTs103759AsrAppAgnostic.asn \ + AtsMBR/lib/asn1/EtsiTs103759AsrCam.asn \ + AtsMBR/lib/asn1/EtsiTs103759AsrDenm.asn \ + AtsMBR/lib/asn1/EtsiTs103759CommonObservations.asn \ + AtsMBR/lib/asn1/SaeJ3287AsrBsm.asn \ + AtsMBR/lib/asn1/ieee1609.2/Ieee1609Dot2BaseTypes.asn \ + AtsMBR/lib/asn1/ieee1609.2/Ieee1609Dot2.asn \ + AtsMBR/lib/asn1/ieee1609.2/Ieee1609Dot2CrlBaseTypes.asn \ + AtsMBR/lib/asn1/ieee1609.2/Ieee1609Dot2Crl.asn \ + +# AtsMBR/lib/asn1/sec_ts103097/EtsiTs103097ExtensionModule.asn \ +# AtsMBR/lib/asn1/sec_ts103097/EtsiTs103097Module.asn \ + + +# AtsMBR/lib/asn1/sec_ts103097/ieee1609dot2/Ieee1609Dot2BaseTypes.asn \ +# AtsMBR/lib/asn1/sec_ts103097/ieee1609dot2/Ieee1609Dot2.asn \ +# AtsMBR/lib/asn1/sec_ts103097/ieee1609dot2/Ieee1609Dot2BaseTypes.asn \ +# AtsMBR/lib/asn1/sec_ts103097/ieee1609dot2/Ieee1609Dot2Crl.asn \ +# AtsMBR/lib/asn1/sec_ts103097/ieee1609dot2/Ieee1609Dot2CrlBaseTypes.asn + # ../build/asn1/ISO_TS_19091/ISO-TS-19091-addgrp-C-2018-patched.asn \ # ../build/asn1/ISO_TS_19091/AddGrpC.asn \ -- GitLab From 97007f2a28963520d40359e656e1a7ae177efa47 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 1 Dec 2022 09:10:15 +0100 Subject: [PATCH 032/178] Update asn1/Makefile --- Makefile | 6 +- .../GeoNetworking/geonetworking_layer.cc | 1884 +++++++++-------- scripts/devenv.bash.debian | 8 +- scripts/devenv.bash.ubuntu | 42 +- ttcn/AtsMBR | 2 +- 5 files changed, 973 insertions(+), 969 deletions(-) diff --git a/Makefile b/Makefile index 93f616b..5aa4b06 100644 --- a/Makefile +++ b/Makefile @@ -118,14 +118,14 @@ $(outdir) $(bindir): mkdir -p $@ $(bindir)/$(ATS)$(EXE): $(outdir)/../asn1/libItsAsn.a $(gen_objects) $(cc_objects) - g++ -g -O0 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(outdir)/../asn1/libItsAsn.a $(libs) + g++ -g -O0 -std=c++17 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(outdir)/../asn1/libItsAsn.a $(libs) $(gen_objects) :%.o :%.cc - g++ -g -O0 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< + g++ -g -O0 -std=c++17 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< $(cc_objects) : $(outdir)/%.o : %.cc mkdir -p $(dir $@) - g++ -g -O0 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< + g++ -g -O0 -std=c++17 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< #$(gen_sources): # $(TTCN3_DIR)/bin/compiler -n -e -L -R -U none -o $(outdir) $(tt_sources) diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc index eab4c85..a502b75 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc @@ -1,940 +1,944 @@ -#include -#include -#include -#include - -#include "geonetworking_types.hh" - -#include "geonetworking_layer_factory.hh" - -#include "loggers.hh" - -#include "security_services.hh" - -#include "base_time.hh" - -#include "registration.hh" - -#include "converter.hh" - -using namespace LibItsGeoNetworking__TypesAndValues; - -geonetworking_layer::geonetworking_layer(const std::string &p_type, const std::string &p_param) - : t_layer(p_type), _params(), _codec(), _beacon(nullptr), _gbc_packet(nullptr), _shb_packet(nullptr), - _tsb_packet(nullptr), _uni_packet(nullptr), _ls_reply(nullptr), _location_table(), - _pass_beacon_table(), _device_mode{false}, _secured_mode{false}, _encrypted_mode{false}, _enable_security_checks{false}, - _sendData(), _timerid{0}, _sev{0}, _its{0}, _freq_nanosecs(0), _mask{0}, _sa{0}, _sequence_number{0}, _latitude{0}, _longitude{0}, _force_certificate{false} { - loggers::get_instance().log(">>> geonetworking_layer::geonetworking_layer: %s, %s", to_string().c_str(), p_param.c_str()); - - init(p_type, p_param); -} // End of constructor - -geonetworking_layer::~geonetworking_layer() { - loggers::get_instance().log(">>> geonetworking_layer::~geonetworking_layer"); - - if (_timerid != 0) { - timer_delete(_timerid); - } - if (_beacon != nullptr) { - delete _beacon; - } - if (_gbc_packet != nullptr) { - delete _gbc_packet; - } - if (_shb_packet != nullptr) { - delete _shb_packet; - } - if (_tsb_packet != nullptr) { - delete _tsb_packet; - } - if (_uni_packet != nullptr) { - delete _uni_packet; - } - if (_ls_reply != nullptr) { - delete _ls_reply; - } -} // End of destructor - -void geonetworking_layer::init(const std::string &p_type, const std::string &p_param) { - loggers::get_instance().log(">>> geonetworking_layer::init: %s, %s", to_string().c_str(), p_param.c_str()); - - // Setup parameters - params_its::convert(_params, p_param); - // Sanity checks - params_its::const_iterator it = _params.find(params_its::latitude); - if (it != _params.cend()) { - _latitude = converter::get_instance().string_to_int(it->second); - } - it = _params.find(params_its::longitude); - if (it != _params.cend()) { - _longitude = converter::get_instance().string_to_int(it->second); - } - OCTETSTRING ll_address; - it = _params.find(params_its::ll_address); - if (it != _params.cend()) { - ll_address = str2oct(CHARSTRING(it->second.c_str())); - } - INTEGER distanceA = 1000; // 1km - it = _params.find(params_its::distanceA); - if (it != _params.cend()) { - distanceA = converter::get_instance().string_to_int(it->second); - } - INTEGER distanceB = 1000; // 1Km - it = _params.find(params_its::distanceB); - if (it != _params.cend()) { - distanceB = converter::get_instance().string_to_int(it->second); - } - INTEGER angle = 0; - it = _params.find(params_its::angle); - if (it != _params.cend()) { - angle = converter::get_instance().string_to_int(it->second); - } - INTEGER station_type = 5; // passangerCar - it = _params.find(params_its::station_type); - if (it != _params.cend()) { - station_type = converter::get_instance().string_to_int(it->second); - } - INTEGER country = 0; - it = _params.find(params_its::country); - if (it != _params.cend()) { - country = converter::get_instance().string_to_int(it->second); - } - INTEGER type_of_address = 1; // Manual - it = _params.find(params_its::type_of_address); - if (it != _params.cend()) { - type_of_address = converter::get_instance().string_to_int(it->second); - } - - it = _params.find(params_its::device_mode); - if (it != _params.cend()) { - _device_mode = (1 == converter::get_instance().string_to_int(it->second)); - } - it = _params.find(params_its::secured_mode); - if (it != _params.cend()) { - _secured_mode = (1 == converter::get_instance().string_to_int(it->second)); - } else { - _params.insert(std::pair(params_its::secured_mode, "0")); - } - it = _params.find(params_its::encrypted_mode); - if (it != _params.cend()) { - _encrypted_mode = (1 == converter::get_instance().string_to_int(it->second)); - } else { - _params.insert(std::pair(params_its::encrypted_mode, "0")); - } - it = _params.find(params_its::enable_security_checks); - if (it != _params.cend()) { - _enable_security_checks = (1 == converter::get_instance().string_to_int(it->second)); - } - - // Add broadcast address if needed - it = _params.find(params_its::its_aid); - if (it == _params.cend()) { - _params.insert(std::pair(params_its::its_aid, "141")); - } - it = _params.find(params_its::mac_bc); - if (it == _params.cend()) { - _params.insert(std::pair(params_its::its_aid, "FFFFFFFFFFFF")); - } - - // Set up default security parameters value - if (_secured_mode || _encrypted_mode) { - loggers::get_instance().log("geonetworking_layer::init: Setup secured mode"); - setup_secured_mode(); - } - - // Automatic beaconing mode - fill_beacon(ll_address, station_type, country, type_of_address); - params_its::const_iterator i = _params.find(params_its::beaconing); - if ((i != _params.cend()) && (i->second.compare("1") == 0)) { // Immediate beaconing was requested - // Prepare beaconing operation - start_beaconing(); - } - - // Fill packet templates - fill_gbc_packet(ll_address, _latitude, _longitude, distanceA, distanceB, - angle); // TODO Check if GeoBroadcastArea lat/lon are identical to lat/lon of the Test System - fill_shb_packet(ll_address); - fill_tsb_packet(ll_address); - fill_uni_packet(ll_address); - fill_ls_reply(ll_address); - - // Register this object for AdapterControlPort - loggers::get_instance().log("geonetworking_layer::init: Register %s/%p", p_type.c_str(), this); - registration::get_instance().add_item(p_type, this); - - // Add 4 leap seconds to convert to TAI (as Feb 2019) - base_time::get_instance().set_leap_delay_us(4 * 1000000); // TODO Set it as parameter -} // End of init_params - -void geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingReq &p, params &p_params) { - loggers::get_instance().log(">>> geonetworking_layer::sendMsg"); - - params_its param(_params); - // Encode GeoNetworking PDU - OCTETSTRING data; - _codec.encode(p.msgOut(), data); - params_its::const_iterator it = param.find(params_its::its_aid); - if (it != param.cend()) { - int aid = std::stoi(param[params_its::its_aid]); - loggers::get_instance().log("geonetworking_layer::sendMsg: aid=%d/%d", aid, (int)p.its__aid()); - if (aid != (int)p.its__aid()) { - param[params_its::its_aid] = std::to_string((int)p.its__aid()); - loggers::get_instance().log("geonetworking_layer::sendMsg: New aid=%s", param[params_its::its_aid].c_str()); - } - } else{ - param.insert(std::pair(params_its::its_aid, std::to_string((int)p.its__aid()))); - } - if (_force_certificate == true) { // Force certificate instead of hashed_id in next message - _force_certificate = false; - param.insert(std::pair(params_its::force_certificate, std::string("1"))); - } - loggers::get_instance().log("geonetworking_layer::sendMsg: _params"); - _params.log(); - loggers::get_instance().log("geonetworking_layer::sendMsg: params"); - param.log(); - send_data(data, param); -} - -void geonetworking_layer::send_data(OCTETSTRING &data, params &p_params) { - loggers::get_instance().log_msg(">>> geonetworking_layer::send_data: ", data); - p_params.log(); - - params_its ¶ms = static_cast(p_params); - - if (_device_mode) { // Need to build a GN packet - params[params_its::certificate] = _params[params_its::certificate]; - params[params_its::hash] = _params[params_its::hash]; // TODO Should be removed - if (build_geonetworking_pdu(data, params) != 0) { - return; - } - } - if (_secured_mode) { // Add Security support - if (build_secured_pdu(data, params) != 0) { - return; - } - } - - // TODO To be removed - while (_sendData.try_lock() == FALSE) { - // not ready yet - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } // End of 'while' statement - send_to_all_layers(data, params); - _sendData.unlock(); - loggers::get_instance().log("<<< geonetworking_layer::send_data"); -} - -const TTCN_RAWdescriptor_t _intx_raw_ = {RAW_INTX, SG_NO, ORDER_MSB, ORDER_MSB, ORDER_LSB, ORDER_MSB, EXT_BIT_NO, ORDER_LSB, ORDER_LSB, - TOP_BIT_INHERITED, 0, 0, 0, 8, 0, NULL, -1, CharCoding::UNKNOWN}; -const TTCN_Typedescriptor_t _intx_descr_ = {"IntX", NULL, &_intx_raw_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE}; - -void geonetworking_layer::receive_data(OCTETSTRING &data, params &p_params) { - loggers::get_instance().log_msg(">>> geonetworking_layer::receive_data: ", data); - - params_its ¶ms = static_cast(p_params); - - // Check security mode - Ieee1609Dot2::Ieee1609Dot2Data ieee_1609dot2_data; - LibItsGeoNetworking__TypesAndValues::BasicHeader basic_header; - decode_basic_header(data, basic_header); - if ((int)basic_header.nextHeader() == 2) { // Verify and extract the GeoNetworking Secured Packet as specified in ETSI EN 302 636-4-1 V1.3.1 (2017-08) - // Clause 9.6.1 Composition of the Basic Header - unsigned int basic_header_len = 4; // FIXME How to retrive the BasicHeader length basic_header.get_descriptor()->raw->fieldlength / 8; - loggers::get_instance().log("geonetworking_layer::receive_data: basic_header_len = %d", basic_header_len); - // Verify and extract the GeoNetworking Secured Packet as specified in ETSI EN 302 636-4-1 V1.3.1 (2017-08) Clause 9.4 GeoNetworking Secured Packet - OCTETSTRING unsecured_gn_payload; - OCTETSTRING secured_data = OCTETSTRING(data.lengthof() - basic_header_len, static_cast(data) + basic_header_len); - /////////////////// - // FIXME Check what to do with this! - if (*static_cast(secured_data) != 0x03) { - loggers::get_instance().warning("geonetworking_layer::receive_data: Security error, wrong protocol number, discard it anyway"); - if (_enable_security_checks) { - return; - } - return; - } else { - if (security_services::get_instance().verify_and_extract_gn_payload(secured_data, _enable_security_checks, ieee_1609dot2_data, unsecured_gn_payload, - params) != 0) { - loggers::get_instance().warning("geonetworking_layer::receive_data: Security error"); - if (_enable_security_checks) { - return; - } - } - } - // Update data - loggers::get_instance().log_msg("geonetworking_layer::receive_data: Unsecured payload: ", unsecured_gn_payload); - data = OCTETSTRING(basic_header_len, static_cast(data)) + unsecured_gn_payload; - } - - // Decode the payload - loggers::get_instance().log_msg("geonetworking_layer::receive_data: Geonetworking payload to decode: ", data); - LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd ind; - _codec.decode(data, ind.msgIn(), ¶ms); - if (ind.msgIn().is_bound()) { - // Update optional securedMsg field if required - if (ieee_1609dot2_data.is_bound()) { - ind.msgIn().gnPacket().securedMsg() = OPTIONAL(ieee_1609dot2_data); - } // else, nothing to do - // Update context - const LibItsGeoNetworking__TypesAndValues::LongPosVector * sopv = nullptr; - const LibItsGeoNetworking__TypesAndValues::GnNonSecuredPacket &p = ind.msgIn().gnPacket().packet(); - const LibItsGeoNetworking__TypesAndValues::HeaderTST & htst = p.commonHeader().headerTST(); - if (p.extendedHeader().ispresent()) { // Update location table - const LibItsGeoNetworking__TypesAndValues::ExtendedHeader &ex = p.extendedHeader(); - if (htst.ischosen(LibItsGeoNetworking__TypesAndValues::HeaderTST::ALT_beaconHdr)) { // Receive a beacon - sopv = &ex.beaconHeader().srcPosVector(); - } else if (htst.ischosen(LibItsGeoNetworking__TypesAndValues::HeaderTST::ALT_tsbHdr)) { // Receive a topologicallyScopeBroadcast - if (ex.ischosen(LibItsGeoNetworking__TypesAndValues::ExtendedHeader::ALT_tsbHeader)) { - sopv = &ex.tsbHeader().srcPosVector(); - } else { - sopv = &ex.shbHeader().srcPosVector(); - } - } else if (htst.ischosen(LibItsGeoNetworking__TypesAndValues::HeaderTST::ALT_geoBroadcastHdr)) { - sopv = &ex.geoBroadcastHeader().srcPosVector(); - } else if (htst.ischosen(LibItsGeoNetworking__TypesAndValues::HeaderTST::ALT_lsHdr)) { // Receive a location service - if (ex.ischosen(LibItsGeoNetworking__TypesAndValues::ExtendedHeader::ALT_lsRequestHeader)) { // Receive a LocationService/LsRequest - sopv = &ex.lsRequestHeader().srcPosVector(); - // TODO Send LsReply if we are not in context of GN ATS in case of non GN test suite - if (_device_mode) { - // Update _ls_reply - ExtendedHeader *eh = static_cast(_ls_reply->gnPacket().packet().extendedHeader().get_opt_value()); - if (eh != nullptr) { - // Update sequence number - eh->lsReplyHeader().seqNumber() = _sequence_number++; - // Update destination - eh->lsReplyHeader().dstPosVector().gnAddr() = sopv->gnAddr(); - eh->lsReplyHeader().dstPosVector().latitude() = sopv->latitude(); - eh->lsReplyHeader().dstPosVector().longitude() = sopv->longitude(); - // Update timestamp - eh->lsReplyHeader().srcPosVector().timestamp__().set_long_long_val(base_time::get_instance().get_its_current_time_mod_ms()); - eh->lsReplyHeader().dstPosVector().timestamp__() = eh->lsReplyHeader().srcPosVector().timestamp__(); - - loggers::get_instance().log_msg("geonetworking_layer::receive_data: ", *_ls_reply); - - // send it - // Encode GeoNetworking PDU - OCTETSTRING os; - _codec.encode(*_ls_reply, os); - // Apply signature - if (_secured_mode) { - if (build_secured_pdu(data, _params) != 0) { - return; - } - } - // Send it - // TODO To be removed - while (_sendData.try_lock() == FALSE) { - // not ready yet - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } // End of 'while' statement - send_to_all_layers(os, params); - _sendData.unlock(); - } else { - loggers::get_instance().error("geonetworking_layer::send_data: Wrong cast"); - return; - } - } - } else { - sopv = &ex.lsReplyHeader().srcPosVector(); - } - } else if (htst.ischosen(LibItsGeoNetworking__TypesAndValues::HeaderTST::ALT_geoAnycastHdr)) { // Receive a GeoAnycast - sopv = &ex.geoAnycastHeader().srcPosVector(); - } else if (htst.ischosen(LibItsGeoNetworking__TypesAndValues::HeaderTST::ALT_geoUnicastHdr)) { - sopv = &ex.geoUnicastHeader().srcPosVector(); - } // else, nothing to do - loggers::get_instance().log("geonetworking_layer::receive_data: sopv is bound: %d", sopv->is_bound()); - if (sopv->is_bound()) { - const LibItsGeoNetworking__TypesAndValues::LongPosVector &lpv = *sopv; - if (_location_table.add_entry(lpv) == 1) { - // Force to send new certificate to anticipate certificate distribution process with the new ITS-S - _force_certificate = true; - } - } - } - - // By default incoming beacons are filtered by the test adapter - if (htst.ischosen(LibItsGeoNetworking__TypesAndValues::HeaderTST::ALT_beaconHdr)) { - loggers::get_instance().log_msg("geonetworking_layer::receive_data: Pass beaconing filtering: ", sopv->gnAddr().mid()); - if (_pass_beacon_table.empty()) { // Discard beacon - loggers::get_instance().log("geonetworking_layer::receive_data: Pass beaconing table empty, discard it"); - return; - } else { // Check beacon filter for StartPassBeaconing/Stop - if (!_pass_beacon_table.has_entry(sopv->gnAddr().mid())) { // Discard beacon - loggers::get_instance().log_msg("geonetworking_layer::receive_data: Not in pass beaconing table, discard it", *sopv); - return; - } // else, continue - } - } // else, continue - } else { - // Inavlid GeoNetworking payload, discard it - loggers::get_instance().warning("geonetworking_layer::receive_data: Failed to decode payload, discard it"); - return; - } - - // Add lower layers parameters - // 1. Destination MAC address - params_its::const_iterator it = params.find(params_its::mac_dst); - if (it != params.cend()) { - loggers::get_instance().log("geonetworking_layer::receive_data: dst=%s", it->second.c_str()); - ind.macDestinationAddress() = str2oct(CHARSTRING(it->second.c_str())); - } else { - ind.macDestinationAddress() = str2oct(CHARSTRING(_params["mac_bc"].c_str())); - } - // 2. ssp - it = params.find(params_its::ssp); - if (it != params.cend()) { - loggers::get_instance().log("geonetworking_layer::receive_data: ssp=%s", it->second.c_str()); - ind.ssp() = oct2bit(str2oct(CHARSTRING(it->second.c_str()))); - } else { - ind.ssp().set_to_omit(); - } - // 3. its_aid - it = params.find(params_its::its_aid); - if (it != params.cend()) { - loggers::get_instance().log("geonetworking_layer::receive_data: its_aid=%s", it->second.c_str()); - ind.its__aid() = std::stoi(it->second.c_str()); - } else { - ind.its__aid().set_to_omit(); - } - - // Pass the GeoNetworking raw payload to the upper layers if any - it = params.find(params_its::gn_payload); - if (it != params.cend()) { - loggers::get_instance().log("geonetworking_layer::receive_data: gn_payload=%s", it->second.c_str()); - OCTETSTRING os(str2oct(CHARSTRING(it->second.c_str()))); - receive_to_all_layers(os, params); - } else { - loggers::get_instance().warning("geonetworking_layer::receive_data: No payload to pass to upper layers"); - } - - // Pass it to the ports - to_all_upper_ports(ind, params); -} - -OCTETSTRING geonetworking_layer::trigger_ac_event(OCTETSTRING &data, params_its ¶ms) { - loggers::get_instance().log_to_hexa(">>> geonetworking_layer::trigger_ac_event: ", data); - - return int2oct(0, 2); -} // End of trigger_ac_event method - -void geonetworking_layer::start_beaconing() { - loggers::get_instance().log(">>> geonetworking_layer::start_beaconing"); - // loggers::get_instance().log_msg("geonetworking_layer::start_beaconing: _beacon=", *_beacon); - - // Establish handler for timer signal - loggers::get_instance().log("geonetworking_layer::start_beaconing: Establishing handler for signal %d\n", _signal_id); - _sa.sa_flags = SA_SIGINFO; - _sa.sa_sigaction = timer_irq_sigalrm_handler; - sigemptyset(&_sa.sa_mask); - if (sigaction(_signal_id, &_sa, nullptr) == -1) { - loggers::get_instance().error("geonetworking_layer::start_beaconing: Sigaction failure: %d", errno); - } - // Block timer signal temporarily - loggers::get_instance().log("geonetworking_layer::start_beaconing: Blocking signal %d\n", _signal_id); - sigemptyset(&_mask); - sigaddset(&_mask, _signal_id); - if (sigprocmask(SIG_SETMASK, &_mask, nullptr) == -1) { - loggers::get_instance().error("geonetworking_layer::start_beaconing: Sigprocmask failure: %d", errno); - } - // Create the timer - _sev.sigev_notify = SIGEV_SIGNAL; - _sev.sigev_signo = _signal_id; // Use signal alarm - _sev.sigev_value.sival_ptr = this; // The geonetworking_layer object address - if (timer_create(CLOCK_REALTIME, &_sev, &_timerid) == -1) { - loggers::get_instance().error("geonetworking_layer::start_beaconing: Timer failure: %d", errno); - } - loggers::get_instance().log("geonetworking_layer::start_beaconing: timer ID is 0x%x\n", (long)_timerid); - // Start the timer - unsigned int expiry = 1000; // Default expiry time 1000ms - params_its::const_iterator i = _params.find("expiry"); - if (i != _params.cend()) { - expiry = static_cast(std::strtoul(i->second.c_str(), nullptr, 10)); - } - _freq_nanosecs = expiry * 1000000; - _its.it_value.tv_sec = _freq_nanosecs / 1000000000; - _its.it_value.tv_nsec = _freq_nanosecs % 1000000000; - _its.it_interval.tv_sec = _its.it_value.tv_sec; - _its.it_interval.tv_nsec = _its.it_value.tv_nsec; - if (timer_settime(_timerid, 0, &_its, nullptr) == -1) { - loggers::get_instance().error("geonetworking_layer::start_beaconing: Sigprocmask failure: %d", errno); - } - // Unlock the timer signal, so that timer notification can be delivered - loggers::get_instance().log("geonetworking_layer::start_beaconing: Unblocking signal %d\n", _signal_id); - if (sigprocmask(SIG_UNBLOCK, &_mask, nullptr) == -1) { - loggers::get_instance().error("geonetworking_layer::start_beaconing: Sigprocmask failure: %d", errno); - } -} // End of start_beaconing method - -void geonetworking_layer::start_beaconing(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu &p_beacon) { - loggers::get_instance().log_msg(">>> geonetworking_layer::start_beaconing", p_beacon); - - // Initialize the beacon - if (_beacon != nullptr) { - delete _beacon; - } - _beacon = new LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu(p_beacon); - - start_beaconing(); // TODO Refined adding a boolean return code -} // End of start_beaconing method - -void geonetworking_layer::stop_beaconing() { - loggers::get_instance().log(">>> geonetworking_layer::stop_beaconing"); - - // Block timer signal temporarily - loggers::get_instance().log("geonetworking_layer::stop_beaconing: Blocking signal %d\n", _signal_id); - sigemptyset(&_mask); - sigaddset(&_mask, _signal_id); - if (sigprocmask(SIG_SETMASK, &_mask, nullptr) == -1) { - loggers::get_instance().error("geonetworking_layer::stop_beaconing: Sigprocmask failure: %d", errno); - } - timer_delete(_timerid); - _timerid = 0; -} // End of stop_beaconing method - -void geonetworking_layer::send_beacon() { - loggers::get_instance().log(">>> geonetworking_layer::send_beacon"); - - ExtendedHeader *eh = static_cast(_beacon->gnPacket().packet().extendedHeader().get_opt_value()); - if (eh == nullptr) { - loggers::get_instance().error("geonetworking_layer::send_beacon: Wrong cast"); - } - // Update timestamp - eh->beaconHeader().srcPosVector().timestamp__().set_long_long_val((unsigned int)base_time::get_instance().get_its_current_time_mod_ms()); - // loggers::get_instance().log_msg("geonetworking_layer::send_beacon: ", *_beacon); - // Encode message using TITAN because of payload in omited - TTCN_Buffer encoding_buffer; - _beacon->encode(*(_beacon->get_descriptor()), encoding_buffer, TTCN_EncDec::CT_RAW); - OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); - params_its params(_params); - if (_secured_mode) { // Apply Security - if (build_secured_pdu(data, params) != 0) { - return; - } - } - // Send it - // TODO To be removed - while (_sendData.try_lock() == FALSE) { - // not ready yet - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } // End of 'while' statement - send_to_all_layers(data, params); - _sendData.unlock(); - - // loggers::get_instance().log("<<< geonetworking_layer::send_beacon"); -} // End of send_beacon method - -void geonetworking_layer::start_pass_beaconing(const LibItsGeoNetworking__TypesAndValues::BeaconHeader &p_beacon) { - loggers::get_instance().log_msg(">>> geonetworking_layer::start_pass_beaconing", p_beacon); - - const LibItsGeoNetworking__TypesAndValues::LongPosVector &lpv = p_beacon.srcPosVector(); - if (!_pass_beacon_table.has_entry(lpv.gnAddr().mid())) { - _pass_beacon_table.add_entry(lpv); - } // TODO Refined adding a boolean return code -} // End of start_pass_beaconing method - -void geonetworking_layer::stop_pass_beaconing() { - loggers::get_instance().log(">>> geonetworking_layer::stop_pass_beaconing"); - - _pass_beacon_table.reset(); -} // End of stop_pass_beaconing method - -int geonetworking_layer::enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security) { - loggers::get_instance().log(">>> geonetworking_layer::enable_secured_mode: '%s' - %x", p_certificate_id.c_str(), p_enforce_security); - - loggers::get_instance().log("geonetworking_layer::enable_secured_mode: _secured_mode = %x", _secured_mode); - if (!_secured_mode) { - loggers::get_instance().log("geonetworking_layer::enable_secured_mode: Setup secured mode"); - _secured_mode = true; - setup_secured_mode(); - } - _enable_security_checks = p_enforce_security; - params_its::const_iterator it = _params.find(params_its::certificate); - if (it == _params.cend()) { - _params.insert(std::pair(params_its::certificate, p_certificate_id)); - } else { - _params[params_its::certificate] = p_certificate_id; - } - - loggers::get_instance().log("geonetworking_layer::enable_secured_mode: Certificate to be used: '%s'", _params[params_its::certificate].c_str()); - - return 0; -} - -int geonetworking_layer::disable_secured_mode() { - loggers::get_instance().log(">>> geonetworking_layer::disable_secured_mode"); - _secured_mode = false; - _enable_security_checks = false; - return 0; -} - -const LongPosVector *geonetworking_layer::get_lpv(const GN__Address &p_gn_address) { - loggers::get_instance().log_msg(">>> geonetworking_layer::get_lpv", p_gn_address); - - const LongPosVector *lpv = nullptr; - if (_location_table.has_entry(p_gn_address.mid())) { - lpv = _location_table.get_entry(p_gn_address.mid()); - } - return lpv; -} // End of get_lpv - -const LibItsGeoNetworking__TypesAndValues::BasicHeader geonetworking_layer::fill_basic_header() const { - return LibItsGeoNetworking__TypesAndValues::BasicHeader(1, // GeoNetworking version - BasicNextHeader(BasicNextHeader::e__commonHeader), 0, Lifetime(4, LtBase(LtBase::e__50ms)), 1); -} - -void geonetworking_layer::fill_beacon(const OCTETSTRING &p_ll_address, const INTEGER p_station_type, const INTEGER p_country, const INTEGER type_of_address) { - _beacon = new GeoNetworkingPdu(); - HeaderTST h; - h.beaconHdr() = BeaconHeaderType(HeaderType(HeaderType::e__beacon), 0); - ExtendedHeader eh; - eh.beaconHeader() = - BeaconHeader(LongPosVector(GN__Address(TypeOfAddress((TypeOfAddress)type_of_address), StationType((StationType)p_station_type), p_country, p_ll_address), 0, - _latitude, _longitude, int2bit(0, 1), 0, 0)); - _beacon->basicHeader() = fill_basic_header(); - _beacon->gnPacket().packet() = - GnNonSecuredPacket(CommonHeader(NextHeader(NextHeader::e__any), 0, h, - TrafficClass(SCF(SCF::e__scfEnabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), int2bit(0, 8), 0, 1, 0), - OPTIONAL(eh), OPTIONAL()); - _beacon->gnPacket().packet().payload().set_to_omit(); - _beacon->gnPacket().securedMsg().set_to_omit(); - // loggers::get_instance().log_msg("geonetworking_layer::fill_beacon: beacon value: ", *_beacon); -} // End of fill_beacon method - -void geonetworking_layer::fill_gbc_packet(const OCTETSTRING &p_ll_address, const INTEGER &p_geoAreaPosLatitude, const INTEGER &p_geoAreaPosLongitude, - const INTEGER &p_distanceA, const INTEGER &p_distanceB, const INTEGER &p_angle) { - _gbc_packet = new GeoNetworkingPdu(); - HeaderTST h; - h.geoBroadcastHdr() = - GeoBroadcastHeaderType(HeaderType(HeaderType::e__geoBroadcast), HeaderSubTypeGeoBroadcast(HeaderSubTypeGeoBroadcast::e__geoBroadcastElip)); - ExtendedHeader eh; - eh.geoBroadcastHeader() = GeoAnycastHeader( // GeoBradcastHeader is identical as GeoAnycastHeader - 0, 0, - LongPosVector(GN__Address(TypeOfAddress(TypeOfAddress::e__manual), // TODO Use params - StationType(StationType::e__passengerCar), // TODO Use params - 33, p_ll_address), - 0, _latitude, _longitude, int2bit(1, 1), // PAI - 0, 0), - p_geoAreaPosLatitude, p_geoAreaPosLongitude, p_distanceA, p_distanceB, p_angle, 0); - _gbc_packet->basicHeader() = fill_basic_header(); - _gbc_packet->gnPacket().packet() = GnNonSecuredPacket( - CommonHeader(NextHeader(NextHeader::e__btpA), 0, h, TrafficClass(SCF(SCF::e__scfDisabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), - int2bit(128, 8), // Mobile stationnary flag set - 0, 5, 0), - OPTIONAL(eh), OPTIONAL()); - _gbc_packet->gnPacket().packet().payload().set_to_omit(); - _gbc_packet->gnPacket().securedMsg().set_to_omit(); - // loggers::get_instance().log_msg("geonetworking_layer::fill_gbc_packet: packet value: ", *_gbc_packet); -} // End of fill_gbc_packet method - -void geonetworking_layer::fill_shb_packet(const OCTETSTRING &p_ll_address) { - _shb_packet = new GeoNetworkingPdu(); - HeaderTST h; - h.tsbHdr() = TsbHeaderType(HeaderType(HeaderType::e__topologicallyScopedBroadcast), HeaderSubTypeTSB(HeaderSubTypeTSB::e__singleHop)); - ExtendedHeader eh; - eh.shbHeader() = SHBHeader(LongPosVector(GN__Address(TypeOfAddress(TypeOfAddress::e__manual), // TODO Use params - StationType(StationType::e__passengerCar), // TODO Use params - 33, p_ll_address), - 0, _latitude, _longitude, int2bit(1, 1), // PAI - 0, 0), - 0); - _shb_packet->basicHeader() = fill_basic_header(); - _shb_packet->gnPacket().packet() = GnNonSecuredPacket( - CommonHeader(NextHeader(NextHeader::e__btpA), 0, h, TrafficClass(SCF(SCF::e__scfDisabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), - int2bit(128, 8), // Mobile stationnary flag set - 0, 1, 0), - OPTIONAL(eh), OPTIONAL()); - _shb_packet->gnPacket().packet().payload().set_to_omit(); - _shb_packet->gnPacket().securedMsg().set_to_omit(); - // loggers::get_instance().log_msg("geonetworking_layer::fill_shb_packet: packet value: ", *_shb_packet); -} // End of fill_shb_packet method - -void geonetworking_layer::fill_tsb_packet(const OCTETSTRING &p_ll_address, const int p_hop_number, const int p_max_hop_limit) { - _tsb_packet = new GeoNetworkingPdu(); - HeaderTST h; - h.tsbHdr() = TsbHeaderType(HeaderType(HeaderType::e__topologicallyScopedBroadcast), HeaderSubTypeTSB(HeaderSubTypeTSB::e__multiHop)); - ExtendedHeader eh; - eh.tsbHeader() = TSBHeader(0, 0, - LongPosVector(GN__Address(TypeOfAddress(TypeOfAddress::e__manual), // TODO Use params - StationType(StationType::e__passengerCar), // TODO Use params - 33, p_ll_address), - 0, _latitude, _longitude, int2bit(1, 1), // PAI - 0, 0)); - _tsb_packet->basicHeader() = fill_basic_header(); - _tsb_packet->gnPacket().packet() = GnNonSecuredPacket( - CommonHeader(NextHeader(NextHeader::e__btpA), 0, h, TrafficClass(SCF(SCF::e__scfDisabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), - int2bit(128, 8), // Mobile stationnary flag set - 0, p_max_hop_limit, 0), - OPTIONAL(eh), OPTIONAL()); - _tsb_packet->gnPacket().packet().payload().set_to_omit(); - _tsb_packet->gnPacket().securedMsg().set_to_omit(); - // loggers::get_instance().log_msg("geonetworking_layer::fill_tsb_packet: packet value: ", *_tsb_packet); -} // End of fill_tsb_packet method - -void geonetworking_layer::fill_uni_packet(const OCTETSTRING &p_ll_address, const int p_hop_number, const int p_max_hop_limit) { - _uni_packet = new GeoNetworkingPdu(); - HeaderTST h; - h.geoUnicastHdr() = GeoUnicastHeaderType(HeaderType(HeaderType::e__geoUnicast), 0); - ExtendedHeader eh; - eh.geoUnicastHeader() = GeoUnicastHeader(0, 0, - LongPosVector(GN__Address(TypeOfAddress(TypeOfAddress::e__manual), // TODO Use params - StationType(StationType::e__passengerCar), // TODO Use params - 33, p_ll_address), - 0, _latitude, _longitude, int2bit(1, 1), // PAI - 0, 0), - ShortPosVector(GN__Address(TypeOfAddress(TypeOfAddress::e__manual), // TODO Use params - StationType(StationType::e__passengerCar), // TODO Use params - 33, p_ll_address), - 0, _latitude + 100, _longitude + 100)); - _uni_packet->basicHeader() = fill_basic_header(); - _uni_packet->gnPacket().packet() = GnNonSecuredPacket( - CommonHeader(NextHeader(NextHeader::e__btpA), 0, h, TrafficClass(SCF(SCF::e__scfDisabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), - int2bit(128, 8), // Mobile stationnary flag set - 0, p_max_hop_limit, 0), - OPTIONAL(eh), OPTIONAL()); - _uni_packet->gnPacket().packet().payload().set_to_omit(); - _uni_packet->gnPacket().securedMsg().set_to_omit(); - // loggers::get_instance().log_msg("geonetworking_layer::fill_uni_packet: packet value: ", *_uni_packet); -} // End of fill_uni_packet method - -void geonetworking_layer::fill_ls_reply(const OCTETSTRING &p_ll_address) { - _ls_reply = new GeoNetworkingPdu(); - HeaderTST h; - h.lsHdr() = LsHeaderType(HeaderType(HeaderType::e__locationService), HeaderSubTypeLs(HeaderSubTypeLs::e__lsReply)); - ExtendedHeader eh; - eh.lsReplyHeader() = LSReplyHeader(0, 0, - LongPosVector(GN__Address(TypeOfAddress(TypeOfAddress::e__manual), // TODO Use params - StationType(StationType::e__passengerCar), // TODO Use params - 33, p_ll_address), - 0, _latitude, _longitude, int2bit(1, 1), // PAI - 0, 0), - ShortPosVector(GN__Address(TypeOfAddress(TypeOfAddress::e__manual), // TODO Use params - StationType(StationType::e__passengerCar), // TODO Use params - 33, p_ll_address), - 0, _latitude, _longitude)); - _ls_reply->basicHeader() = fill_basic_header(); - _ls_reply->gnPacket().packet() = GnNonSecuredPacket(CommonHeader(NextHeader(NextHeader::e__any), 0, h, - TrafficClass(SCF(SCF::e__scfDisabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), - int2bit(128, 8), // Mobile stationnary flag set - 0, 5, 0), - OPTIONAL(eh), OPTIONAL()); - _ls_reply->gnPacket().packet().payload().set_to_omit(); - _ls_reply->gnPacket().securedMsg().set_to_omit(); - // loggers::get_instance().log_msg("geonetworking_layer::fill_ls_reply: packet value: ", *_ls_reply); -} // End of fill_ls_reply method - -void geonetworking_layer::timer_irq_sigalrm_handler(int p_signal, siginfo_t *p_signal_info, void *p_uc) { - // loggers::get_instance().log(">>> geonetworking_layer::timer_irq_sigalrm_handler: Caught signal %d", p_signal); - - static_cast(p_signal_info->si_value.sival_ptr)->send_beacon(); -} // End of method timer_irq_sigalrm_handler - -int geonetworking_layer::build_geonetworking_pdu(OCTETSTRING &data, params_its ¶ms) { - loggers::get_instance().log(">>> geonetworking_layer::build_geonetworking_pdu"); - // params.log(); - - std::string next_header; - params_its::const_iterator it = params.find(params_its::next_header); - if (it != params.cend()) { - next_header = it->second.c_str(); - } - std::string header_type; - it = params.find(params_its::header_type); - if (it != params.cend()) { - header_type = it->second.c_str(); - } - std::string header_sub_type; - it = params.find(params_its::header_sub_type); - if (it != params.cend()) { - header_sub_type = it->second.c_str(); - } - loggers::get_instance().log("geonetworking_layer::build_geonetworking_pdu: %s, %s, %s", next_header.c_str(), header_type.c_str(), header_sub_type.c_str()); - - if (header_type.compare("tsb") == 0) { - if (header_sub_type.compare("sh") == 0) { // Use SHB - ExtendedHeader *eh = static_cast(_shb_packet->gnPacket().packet().extendedHeader().get_opt_value()); - if (eh == nullptr) { - loggers::get_instance().error("geonetworking_layer::build_geonetworking_pdu: Wrong cast"); - return -1; - } - // Update NextHeader - it = params.find(params_its::next_header); - if (next_header.compare("btpB") == 0) { - _shb_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpB; - } else { // Default btp is btpA - _shb_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpA; - } - // Update payload - _shb_packet->gnPacket().packet().commonHeader().plLength() = data.lengthof(); - _shb_packet->gnPacket().packet().payload() = OPTIONAL(data); - // Update timestamp - eh->shbHeader().srcPosVector().timestamp__().set_long_long_val(static_cast(base_time::get_instance().get_its_current_time_mod_ms())); - - loggers::get_instance().log_msg("geonetworking_layer::build_geonetworking_pdu: shb: ", *_shb_packet); - // Encode GeoNetworking PDU - OCTETSTRING os; - _codec.encode(*_shb_packet, os); - data = os; - } else { // Use TSB - ExtendedHeader *eh = static_cast(_tsb_packet->gnPacket().packet().extendedHeader().get_opt_value()); - if (eh == nullptr) { - loggers::get_instance().error("geonetworking_layer::build_geonetworking_pdu: Wrong cast"); - return -1; - } - // Update sequence number - eh->tsbHeader().seqNumber() = _sequence_number++; - // Update NextHeader - it = params.find(params_its::next_header); - if (next_header.compare("btpB") == 0) { - _tsb_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpB; - } else { // Default btp is btpA - _tsb_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpA; - } - // Update payload - _tsb_packet->gnPacket().packet().commonHeader().plLength() = data.lengthof(); - _tsb_packet->gnPacket().packet().payload() = OPTIONAL(data); - // Update timestamp - eh->tsbHeader().srcPosVector().timestamp__().set_long_long_val(static_cast(base_time::get_instance().get_its_current_time_mod_ms())); - - loggers::get_instance().log_msg("geonetworking_layer::build_geonetworking_pdu: tsb: ", *_tsb_packet); - // Encode GeoNetworking PDU - OCTETSTRING os; - _codec.encode(*_tsb_packet, os); - data = os; - } - } else if (header_type.compare("uni") == 0) { - ExtendedHeader *eh = static_cast(_uni_packet->gnPacket().packet().extendedHeader().get_opt_value()); - if (eh == nullptr) { - loggers::get_instance().error("geonetworking_layer::build_geonetworking_pdu: Wrong cast"); - return -1; - } - // Update NextHeader - it = params.find(params_its::next_header); - if (next_header.compare("btpB") == 0) { - _uni_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpB; - } else { // Default btp is btpA - _uni_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpA; - } - // Update sequence number - eh->geoUnicastHeader().seqNumber() = _sequence_number++; - // Update payload - _uni_packet->gnPacket().packet().commonHeader().plLength() = data.lengthof(); - _uni_packet->gnPacket().packet().payload() = OPTIONAL(data); - // Update timestamp - eh->geoUnicastHeader().srcPosVector().timestamp__().set_long_long_val(static_cast(base_time::get_instance().get_its_current_time_mod_ms())); - - loggers::get_instance().log_msg("geonetworking_layer::build_geonetworking_pdu: uni: ", *_uni_packet); - - // Encode GeoNetworking PDU - OCTETSTRING os; - _codec.encode(*_uni_packet, os); - data = os; - } else { // TODO To be continued - // Default: Use GBC - ExtendedHeader *eh = static_cast(_gbc_packet->gnPacket().packet().extendedHeader().get_opt_value()); - if (eh == nullptr) { - loggers::get_instance().error("geonetworking_layer::build_geonetworking_pdu: Wrong cast"); - return -1; - } - // Update NextHeader - it = params.find(params_its::next_header); - if (next_header.compare("btpB") == 0) { - _gbc_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpB; - } else { // Default btp is btpA - _gbc_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpA; - } - // Update sequence number - eh->geoBroadcastHeader().seqNumber() = _sequence_number++; - // Update payload - _gbc_packet->gnPacket().packet().commonHeader().plLength() = data.lengthof(); - _gbc_packet->gnPacket().packet().payload() = OPTIONAL(data); - // Update timestamp - eh->geoBroadcastHeader().srcPosVector().timestamp__().set_long_long_val(static_cast(base_time::get_instance().get_its_current_time_mod_ms())); - - loggers::get_instance().log_msg("geonetworking_layer::build_geonetworking_pdu: gbc: ", *_gbc_packet); - - // Encode GeoNetworking PDU - OCTETSTRING os; - _codec.encode(*_gbc_packet, os); - data = os; - } - - return 0; -} - -int geonetworking_layer::build_secured_pdu(OCTETSTRING &data, params_its ¶ms) { - loggers::get_instance().log_msg(">>> geonetworking_layer::build_secured_pdu: ", data); - // params.log(); - - LibItsGeoNetworking__TypesAndValues::BasicHeader basic_header; - decode_basic_header(data, basic_header); - if (basic_header.nextHeader() == BasicNextHeader::e__securedPacket) { // Already secured (ATS Security test suite/f_sendSecuredGn/Cam/Denm TTCN-3 functions - // Leave data unchanged - loggers::get_instance().log_msg("<<< geonetworking_layer::build_secured_pdu: Leave data unchanged: ", data); - return 0; - } - // Update security mode - unsigned int basic_header_len = 4; // FIXME How to retrieve the BasicHeader length basic_header.get_descriptor()->raw->fieldlength / 8; - loggers::get_instance().log("geonetworking_layer::build_secured_pdu: basic_header_len = %d", basic_header_len); - basic_header.nextHeader() = BasicNextHeader::e__securedPacket; - OCTETSTRING unsecured_gn_payload = OCTETSTRING(data.lengthof() - basic_header_len, static_cast(data) + basic_header_len); - OCTETSTRING secured_gn_payload; - if (security_services::get_instance().secure_gn_payload(unsecured_gn_payload, secured_gn_payload, params) != 0) { - loggers::get_instance().warning("geonetworking_layer::build_secured_pdu: failed to build secured pdu"); - return -1; - } - - // Encode the basic header - // loggers::get_instance().log_msg("geonetworking_layer::build_secured_pdu: New basic_header = ", basic_header); - RAW_enc_tr_pos rp; - rp.level = 0; - rp.pos = NULL; - RAW_enc_tree enc_tree(FALSE, NULL, &rp, 1, basic_header.get_descriptor()->raw); - basic_header.RAW_encode(*basic_header.get_descriptor(), enc_tree); - TTCN_Buffer encoding_buffer; - enc_tree.put_to_buf(encoding_buffer); - // Copy result - data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()) + secured_gn_payload; - loggers::get_instance().log_msg("geonetworking_layer::build_secured_pdu: Secured pdu = ", data); - - return 0; -} - -int geonetworking_layer::decode_basic_header(const OCTETSTRING &p_data, LibItsGeoNetworking__TypesAndValues::BasicHeader &p_basic_header) { - // loggers::get_instance().log_msg(">>> geonetworking_layer::decode_basic_header: ", p_data); - - // Update security mode - OCTETSTRING bh = - OCTETSTRING(4, static_cast(p_data)); // Extract the basic header as specified in ETSI EN 302 636-4-1 V1.3.1 (2017-08) Clause 9.6 - // loggers::get_instance().log_msg("geonetworking_layer::decode_basic_header: bh: ", bh); - TTCN_Buffer decoding_buffer(bh); - p_basic_header.RAW_decode(*p_basic_header.get_descriptor(), decoding_buffer, decoding_buffer.get_len() * 8, raw_order_t::ORDER_MSB); - // loggers::get_instance().log_msg("geonetworking_layer::decode_basic_header: ", p_basic_header); - - return 0; -} - -int geonetworking_layer::setup_secured_mode() { - loggers::get_instance().log(">>> geonetworking_layer::setup_secured_mode"); - - loggers::get_instance().log("geonetworking_layer::setup_secured_mode: GN Layer address = %p", this); - - params_its::const_iterator it = _params.find(params_its::certificate); - if (it == _params.cend()) { - _params.insert(std::pair(std::string("certificate"), "CERT_TS_A_AT")); - } - it = _params.find(params_its::sec_db_path); - if (it == _params.cend()) { - _params.insert(std::pair(std::string("sec_db_path"), "")); - } - it = _params.find(params_its::hash); - if (it == _params.cend()) { - _params.insert(std::pair(std::string("hash"), "SHA-256")); - } - // Set up security services even if secured_mode is set to 0. Later, we can receive an AcEnableSecurity request, the sertificate caching will be ready to go - security_services::get_instance().setup(_params); - security_services::get_instance().set_position(_latitude, _longitude); - - return 0; -} - -geonetworking_layer_factory geonetworking_layer_factory::_f; +#include +#include +#include +#include + +#include "geonetworking_types.hh" + +#include "geonetworking_layer_factory.hh" + +#include "loggers.hh" + +#include "security_services.hh" + +#include "base_time.hh" + +#include "registration.hh" + +#include "converter.hh" + +using namespace LibItsGeoNetworking__TypesAndValues; + +geonetworking_layer::geonetworking_layer(const std::string &p_type, const std::string &p_param) + : t_layer(p_type), _params(), _codec(), _beacon(nullptr), _gbc_packet(nullptr), _shb_packet(nullptr), + _tsb_packet(nullptr), _uni_packet(nullptr), _ls_reply(nullptr), _location_table(), + _pass_beacon_table(), _device_mode{false}, _secured_mode{false}, _encrypted_mode{false}, _enable_security_checks{false}, + _sendData(), _timerid{0}, _sev{0}, _its{0}, _freq_nanosecs(0), _mask{0}, _sa{0}, _sequence_number{0}, _latitude{0}, _longitude{0}, _force_certificate{false} { + loggers::get_instance().log(">>> geonetworking_layer::geonetworking_layer: %s, %s", to_string().c_str(), p_param.c_str()); + + init(p_type, p_param); +} // End of constructor + +geonetworking_layer::~geonetworking_layer() { + loggers::get_instance().log(">>> geonetworking_layer::~geonetworking_layer"); + + if (_timerid != 0) { + timer_delete(_timerid); + } + if (_beacon != nullptr) { + delete _beacon; + } + if (_gbc_packet != nullptr) { + delete _gbc_packet; + } + if (_shb_packet != nullptr) { + delete _shb_packet; + } + if (_tsb_packet != nullptr) { + delete _tsb_packet; + } + if (_uni_packet != nullptr) { + delete _uni_packet; + } + if (_ls_reply != nullptr) { + delete _ls_reply; + } +} // End of destructor + +void geonetworking_layer::init(const std::string &p_type, const std::string &p_param) { + loggers::get_instance().log(">>> geonetworking_layer::init: %s, %s", to_string().c_str(), p_param.c_str()); + + // Setup parameters + params_its::convert(_params, p_param); + // Sanity checks + params_its::const_iterator it = _params.find(params_its::latitude); + if (it != _params.cend()) { + _latitude = converter::get_instance().string_to_int(it->second); + } + it = _params.find(params_its::longitude); + if (it != _params.cend()) { + _longitude = converter::get_instance().string_to_int(it->second); + } + OCTETSTRING ll_address; + it = _params.find(params_its::ll_address); + if (it != _params.cend()) { + ll_address = str2oct(CHARSTRING(it->second.c_str())); + } + INTEGER distanceA = 1000; // 1km + it = _params.find(params_its::distanceA); + if (it != _params.cend()) { + distanceA = converter::get_instance().string_to_int(it->second); + } + INTEGER distanceB = 1000; // 1Km + it = _params.find(params_its::distanceB); + if (it != _params.cend()) { + distanceB = converter::get_instance().string_to_int(it->second); + } + INTEGER angle = 0; + it = _params.find(params_its::angle); + if (it != _params.cend()) { + angle = converter::get_instance().string_to_int(it->second); + } + INTEGER station_type = 5; // passangerCar + it = _params.find(params_its::station_type); + if (it != _params.cend()) { + station_type = converter::get_instance().string_to_int(it->second); + } + INTEGER country = 0; + it = _params.find(params_its::country); + if (it != _params.cend()) { + country = converter::get_instance().string_to_int(it->second); + } + INTEGER type_of_address = 1; // Manual + it = _params.find(params_its::type_of_address); + if (it != _params.cend()) { + type_of_address = converter::get_instance().string_to_int(it->second); + } + + it = _params.find(params_its::device_mode); + if (it != _params.cend()) { + _device_mode = (1 == converter::get_instance().string_to_int(it->second)); + } + it = _params.find(params_its::secured_mode); + if (it != _params.cend()) { + _secured_mode = (1 == converter::get_instance().string_to_int(it->second)); + } else { + _params.insert(std::pair(params_its::secured_mode, "0")); + } + it = _params.find(params_its::encrypted_mode); + if (it != _params.cend()) { + _encrypted_mode = (1 == converter::get_instance().string_to_int(it->second)); + } else { + _params.insert(std::pair(params_its::encrypted_mode, "0")); + } + it = _params.find(params_its::enable_security_checks); + if (it != _params.cend()) { + _enable_security_checks = (1 == converter::get_instance().string_to_int(it->second)); + } + + // Add broadcast address if needed + it = _params.find(params_its::its_aid); + if (it == _params.cend()) { + _params.insert(std::pair(params_its::its_aid, "141")); + } + it = _params.find(params_its::mac_bc); + if (it == _params.cend()) { + _params.insert(std::pair(params_its::its_aid, "FFFFFFFFFFFF")); + } + + // Set up default security parameters value + if (_secured_mode || _encrypted_mode) { + loggers::get_instance().log("geonetworking_layer::init: Setup secured mode"); + setup_secured_mode(); + } + + // Automatic beaconing mode + fill_beacon(ll_address, station_type, country, type_of_address); + params_its::const_iterator i = _params.find(params_its::beaconing); + if ((i != _params.cend()) && (i->second.compare("1") == 0)) { // Immediate beaconing was requested + // Prepare beaconing operation + start_beaconing(); + } + + // Fill packet templates + fill_gbc_packet(ll_address, _latitude, _longitude, distanceA, distanceB, + angle); // TODO Check if GeoBroadcastArea lat/lon are identical to lat/lon of the Test System + fill_shb_packet(ll_address); + fill_tsb_packet(ll_address); + fill_uni_packet(ll_address); + fill_ls_reply(ll_address); + + // Register this object for AdapterControlPort + loggers::get_instance().log("geonetworking_layer::init: Register %s/%p", p_type.c_str(), this); + registration::get_instance().add_item(p_type, this); + + // Add 4 leap seconds to convert to TAI (as Feb 2019) + base_time::get_instance().set_leap_delay_us(4 * 1000000); // TODO Set it as parameter +} // End of init_params + +void geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingReq &p, params &p_params) { + loggers::get_instance().log(">>> geonetworking_layer::sendMsg"); + + params_its param(_params); + // Encode GeoNetworking PDU + OCTETSTRING data; + _codec.encode(p.msgOut(), data); + params_its::const_iterator it = param.find(params_its::its_aid); + if (it != param.cend()) { + int aid = std::stoi(param[params_its::its_aid]); + loggers::get_instance().log("geonetworking_layer::sendMsg: aid=%d/%d", aid, (int)p.its__aid()); + if (aid != (int)p.its__aid()) { + param[params_its::its_aid] = std::to_string((int)p.its__aid()); + loggers::get_instance().log("geonetworking_layer::sendMsg: New aid=%s", param[params_its::its_aid].c_str()); + } + } else{ + param.insert(std::pair(params_its::its_aid, std::to_string((int)p.its__aid()))); + } + if (_force_certificate == true) { // Force certificate instead of hashed_id in next message + _force_certificate = false; + param.insert(std::pair(params_its::force_certificate, std::string("1"))); + } + loggers::get_instance().log("geonetworking_layer::sendMsg: _params"); + _params.log(); + loggers::get_instance().log("geonetworking_layer::sendMsg: params"); + param.log(); + send_data(data, param); +} + +void geonetworking_layer::send_data(OCTETSTRING &data, params &p_params) { + loggers::get_instance().log_msg(">>> geonetworking_layer::send_data: ", data); + p_params.log(); + + params_its ¶ms = static_cast(p_params); + + if (_device_mode) { // Need to build a GN packet + params[params_its::certificate] = _params[params_its::certificate]; + params[params_its::hash] = _params[params_its::hash]; // TODO Should be removed + if (build_geonetworking_pdu(data, params) != 0) { + return; + } + } + if (_secured_mode) { // Add Security support + if (build_secured_pdu(data, params) != 0) { + return; + } + } + + // TODO To be removed + while (_sendData.try_lock() == FALSE) { + // not ready yet + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } // End of 'while' statement + send_to_all_layers(data, params); + _sendData.unlock(); + loggers::get_instance().log("<<< geonetworking_layer::send_data"); +} + +const TTCN_RAWdescriptor_t _intx_raw_ = {RAW_INTX, SG_NO, ORDER_MSB, ORDER_MSB, ORDER_LSB, ORDER_MSB, EXT_BIT_NO, ORDER_LSB, ORDER_LSB, + TOP_BIT_INHERITED, 0, 0, 0, 8, 0, NULL, -1, CharCoding::UNKNOWN}; +const TTCN_Typedescriptor_t _intx_descr_ = {"IntX", NULL, &_intx_raw_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE}; + +void geonetworking_layer::receive_data(OCTETSTRING &data, params &p_params) { + loggers::get_instance().log_msg(">>> geonetworking_layer::receive_data: ", data); + + params_its ¶ms = static_cast(p_params); + + // Check security mode + Ieee1609Dot2::Ieee1609Dot2Data ieee_1609dot2_data; + LibItsGeoNetworking__TypesAndValues::BasicHeader basic_header; + decode_basic_header(data, basic_header); + if ((int)basic_header.nextHeader() == 2) { // Verify and extract the GeoNetworking Secured Packet as specified in ETSI EN 302 636-4-1 V1.3.1 (2017-08) + // Clause 9.6.1 Composition of the Basic Header + unsigned int basic_header_len = 4; // FIXME How to retrive the BasicHeader length basic_header.get_descriptor()->raw->fieldlength / 8; + loggers::get_instance().log("geonetworking_layer::receive_data: basic_header_len = %d", basic_header_len); + // Verify and extract the GeoNetworking Secured Packet as specified in ETSI EN 302 636-4-1 V1.3.1 (2017-08) Clause 9.4 GeoNetworking Secured Packet + OCTETSTRING unsecured_gn_payload; + OCTETSTRING secured_data = OCTETSTRING(data.lengthof() - basic_header_len, static_cast(data) + basic_header_len); + /////////////////// + // FIXME Check what to do with this! + if (*static_cast(secured_data) != 0x03) { + loggers::get_instance().warning("geonetworking_layer::receive_data: Security error, wrong protocol number, discard it anyway"); + if (_enable_security_checks) { + return; + } + return; + } else { + if (security_services::get_instance().verify_and_extract_gn_payload(secured_data, _enable_security_checks, ieee_1609dot2_data, unsecured_gn_payload, + params) != 0) { + loggers::get_instance().warning("geonetworking_layer::receive_data: Security error"); + if (_enable_security_checks) { + return; + } + } + } + // Update data + loggers::get_instance().log_msg("geonetworking_layer::receive_data: Unsecured payload: ", unsecured_gn_payload); + data = OCTETSTRING(basic_header_len, static_cast(data)) + unsecured_gn_payload; + } + + // Decode the payload + loggers::get_instance().log_msg("geonetworking_layer::receive_data: Geonetworking payload to decode: ", data); + LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd ind; + _codec.decode(data, ind.msgIn(), ¶ms); + if (ind.msgIn().is_bound()) { + // Update optional securedMsg field if required + if (ieee_1609dot2_data.is_bound()) { + ind.msgIn().gnPacket().securedMsg() = OPTIONAL(ieee_1609dot2_data); + } // else, nothing to do + // Update context + const LibItsGeoNetworking__TypesAndValues::LongPosVector * sopv = nullptr; + const LibItsGeoNetworking__TypesAndValues::GnNonSecuredPacket &p = ind.msgIn().gnPacket().packet(); + const LibItsGeoNetworking__TypesAndValues::HeaderTST & htst = p.commonHeader().headerTST(); + if (p.extendedHeader().ispresent()) { // Update location table + const LibItsGeoNetworking__TypesAndValues::ExtendedHeader &ex = p.extendedHeader(); + if (htst.ischosen(LibItsGeoNetworking__TypesAndValues::HeaderTST::ALT_beaconHdr)) { // Receive a beacon + sopv = &ex.beaconHeader().srcPosVector(); + } else if (htst.ischosen(LibItsGeoNetworking__TypesAndValues::HeaderTST::ALT_tsbHdr)) { // Receive a topologicallyScopeBroadcast + if (ex.ischosen(LibItsGeoNetworking__TypesAndValues::ExtendedHeader::ALT_tsbHeader)) { + sopv = &ex.tsbHeader().srcPosVector(); + } else { + sopv = &ex.shbHeader().srcPosVector(); + } + } else if (htst.ischosen(LibItsGeoNetworking__TypesAndValues::HeaderTST::ALT_geoBroadcastHdr)) { + sopv = &ex.geoBroadcastHeader().srcPosVector(); + } else if (htst.ischosen(LibItsGeoNetworking__TypesAndValues::HeaderTST::ALT_lsHdr)) { // Receive a location service + if (ex.ischosen(LibItsGeoNetworking__TypesAndValues::ExtendedHeader::ALT_lsRequestHeader)) { // Receive a LocationService/LsRequest + sopv = &ex.lsRequestHeader().srcPosVector(); + // TODO Send LsReply if we are not in context of GN ATS in case of non GN test suite + if (_device_mode) { + // Update _ls_reply + ExtendedHeader *eh = static_cast(_ls_reply->gnPacket().packet().extendedHeader().get_opt_value()); + if (eh != nullptr) { + // Update sequence number + eh->lsReplyHeader().seqNumber() = _sequence_number++; + // Update destination + eh->lsReplyHeader().dstPosVector().gnAddr() = sopv->gnAddr(); + eh->lsReplyHeader().dstPosVector().latitude() = sopv->latitude(); + eh->lsReplyHeader().dstPosVector().longitude() = sopv->longitude(); + // Update timestamp + eh->lsReplyHeader().srcPosVector().timestamp__().set_long_long_val(base_time::get_instance().get_its_current_time_mod_ms()); + eh->lsReplyHeader().dstPosVector().timestamp__() = eh->lsReplyHeader().srcPosVector().timestamp__(); + + loggers::get_instance().log_msg("geonetworking_layer::receive_data: ", *_ls_reply); + + // send it + // Encode GeoNetworking PDU + OCTETSTRING os; + _codec.encode(*_ls_reply, os); + // Apply signature + if (_secured_mode) { + if (build_secured_pdu(data, _params) != 0) { + return; + } + } + // Send it + // TODO To be removed + while (_sendData.try_lock() == FALSE) { + // not ready yet + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } // End of 'while' statement + send_to_all_layers(os, params); + _sendData.unlock(); + } else { + loggers::get_instance().error("geonetworking_layer::send_data: Wrong cast"); + return; + } + } + } else { + sopv = &ex.lsReplyHeader().srcPosVector(); + } + } else if (htst.ischosen(LibItsGeoNetworking__TypesAndValues::HeaderTST::ALT_geoAnycastHdr)) { // Receive a GeoAnycast + sopv = &ex.geoAnycastHeader().srcPosVector(); + } else if (htst.ischosen(LibItsGeoNetworking__TypesAndValues::HeaderTST::ALT_geoUnicastHdr)) { + sopv = &ex.geoUnicastHeader().srcPosVector(); + } // else, nothing to do + loggers::get_instance().log("geonetworking_layer::receive_data: sopv is bound: %d", sopv->is_bound()); + if (sopv->is_bound()) { + const LibItsGeoNetworking__TypesAndValues::LongPosVector &lpv = *sopv; + if (_location_table.add_entry(lpv) == 1) { + // Force to send new certificate to anticipate certificate distribution process with the new ITS-S + _force_certificate = true; + } + } + } + + if (_device_mode == 0) { // By default incoming beacons are filtered by the test adapter + if (htst.ischosen(LibItsGeoNetworking__TypesAndValues::HeaderTST::ALT_beaconHdr)) { + loggers::get_instance().log_msg("geonetworking_layer::receive_data: Pass beaconing filtering: ", sopv->gnAddr().mid()); + if (_pass_beacon_table.empty()) { // Discard beacon + loggers::get_instance().log("geonetworking_layer::receive_data: Pass beaconing table empty, discard it"); + return; + } else { // Check beacon filter for StartPassBeaconing/Stop + if (!_pass_beacon_table.has_entry(sopv->gnAddr().mid())) { // Discard beacon + loggers::get_instance().log_msg("geonetworking_layer::receive_data: Not in pass beaconing table, discard it", *sopv); + return; + } // else, continue + } + } // else, continue + } else { // Manage Forwarding + // Checks + + } + } else { + // Inavlid GeoNetworking payload, discard it + loggers::get_instance().warning("geonetworking_layer::receive_data: Failed to decode payload, discard it"); + return; + } + + // Add lower layers parameters + // 1. Destination MAC address + params_its::const_iterator it = params.find(params_its::mac_dst); + if (it != params.cend()) { + loggers::get_instance().log("geonetworking_layer::receive_data: dst=%s", it->second.c_str()); + ind.macDestinationAddress() = str2oct(CHARSTRING(it->second.c_str())); + } else { + ind.macDestinationAddress() = str2oct(CHARSTRING(_params["mac_bc"].c_str())); + } + // 2. ssp + it = params.find(params_its::ssp); + if (it != params.cend()) { + loggers::get_instance().log("geonetworking_layer::receive_data: ssp=%s", it->second.c_str()); + ind.ssp() = oct2bit(str2oct(CHARSTRING(it->second.c_str()))); + } else { + ind.ssp().set_to_omit(); + } + // 3. its_aid + it = params.find(params_its::its_aid); + if (it != params.cend()) { + loggers::get_instance().log("geonetworking_layer::receive_data: its_aid=%s", it->second.c_str()); + ind.its__aid() = std::stoi(it->second.c_str()); + } else { + ind.its__aid().set_to_omit(); + } + + // Pass the GeoNetworking raw payload to the upper layers if any + it = params.find(params_its::gn_payload); + if (it != params.cend()) { + loggers::get_instance().log("geonetworking_layer::receive_data: gn_payload=%s", it->second.c_str()); + OCTETSTRING os(str2oct(CHARSTRING(it->second.c_str()))); + receive_to_all_layers(os, params); + } else { + loggers::get_instance().warning("geonetworking_layer::receive_data: No payload to pass to upper layers"); + } + + // Pass it to the ports + to_all_upper_ports(ind, params); +} + +OCTETSTRING geonetworking_layer::trigger_ac_event(OCTETSTRING &data, params_its ¶ms) { + loggers::get_instance().log_to_hexa(">>> geonetworking_layer::trigger_ac_event: ", data); + + return int2oct(0, 2); +} // End of trigger_ac_event method + +void geonetworking_layer::start_beaconing() { + loggers::get_instance().log(">>> geonetworking_layer::start_beaconing"); + // loggers::get_instance().log_msg("geonetworking_layer::start_beaconing: _beacon=", *_beacon); + + // Establish handler for timer signal + loggers::get_instance().log("geonetworking_layer::start_beaconing: Establishing handler for signal %d\n", _signal_id); + _sa.sa_flags = SA_SIGINFO; + _sa.sa_sigaction = timer_irq_sigalrm_handler; + sigemptyset(&_sa.sa_mask); + if (sigaction(_signal_id, &_sa, nullptr) == -1) { + loggers::get_instance().error("geonetworking_layer::start_beaconing: Sigaction failure: %d", errno); + } + // Block timer signal temporarily + loggers::get_instance().log("geonetworking_layer::start_beaconing: Blocking signal %d\n", _signal_id); + sigemptyset(&_mask); + sigaddset(&_mask, _signal_id); + if (sigprocmask(SIG_SETMASK, &_mask, nullptr) == -1) { + loggers::get_instance().error("geonetworking_layer::start_beaconing: Sigprocmask failure: %d", errno); + } + // Create the timer + _sev.sigev_notify = SIGEV_SIGNAL; + _sev.sigev_signo = _signal_id; // Use signal alarm + _sev.sigev_value.sival_ptr = this; // The geonetworking_layer object address + if (timer_create(CLOCK_REALTIME, &_sev, &_timerid) == -1) { + loggers::get_instance().error("geonetworking_layer::start_beaconing: Timer failure: %d", errno); + } + loggers::get_instance().log("geonetworking_layer::start_beaconing: timer ID is 0x%x\n", (long)_timerid); + // Start the timer + unsigned int expiry = 1000; // Default expiry time 1000ms + params_its::const_iterator i = _params.find("expiry"); + if (i != _params.cend()) { + expiry = static_cast(std::strtoul(i->second.c_str(), nullptr, 10)); + } + _freq_nanosecs = expiry * 1000000; + _its.it_value.tv_sec = _freq_nanosecs / 1000000000; + _its.it_value.tv_nsec = _freq_nanosecs % 1000000000; + _its.it_interval.tv_sec = _its.it_value.tv_sec; + _its.it_interval.tv_nsec = _its.it_value.tv_nsec; + if (timer_settime(_timerid, 0, &_its, nullptr) == -1) { + loggers::get_instance().error("geonetworking_layer::start_beaconing: Sigprocmask failure: %d", errno); + } + // Unlock the timer signal, so that timer notification can be delivered + loggers::get_instance().log("geonetworking_layer::start_beaconing: Unblocking signal %d\n", _signal_id); + if (sigprocmask(SIG_UNBLOCK, &_mask, nullptr) == -1) { + loggers::get_instance().error("geonetworking_layer::start_beaconing: Sigprocmask failure: %d", errno); + } +} // End of start_beaconing method + +void geonetworking_layer::start_beaconing(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu &p_beacon) { + loggers::get_instance().log_msg(">>> geonetworking_layer::start_beaconing", p_beacon); + + // Initialize the beacon + if (_beacon != nullptr) { + delete _beacon; + } + _beacon = new LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu(p_beacon); + + start_beaconing(); // TODO Refined adding a boolean return code +} // End of start_beaconing method + +void geonetworking_layer::stop_beaconing() { + loggers::get_instance().log(">>> geonetworking_layer::stop_beaconing"); + + // Block timer signal temporarily + loggers::get_instance().log("geonetworking_layer::stop_beaconing: Blocking signal %d\n", _signal_id); + sigemptyset(&_mask); + sigaddset(&_mask, _signal_id); + if (sigprocmask(SIG_SETMASK, &_mask, nullptr) == -1) { + loggers::get_instance().error("geonetworking_layer::stop_beaconing: Sigprocmask failure: %d", errno); + } + timer_delete(_timerid); + _timerid = 0; +} // End of stop_beaconing method + +void geonetworking_layer::send_beacon() { + loggers::get_instance().log(">>> geonetworking_layer::send_beacon"); + + ExtendedHeader *eh = static_cast(_beacon->gnPacket().packet().extendedHeader().get_opt_value()); + if (eh == nullptr) { + loggers::get_instance().error("geonetworking_layer::send_beacon: Wrong cast"); + } + // Update timestamp + eh->beaconHeader().srcPosVector().timestamp__().set_long_long_val((unsigned int)base_time::get_instance().get_its_current_time_mod_ms()); + // loggers::get_instance().log_msg("geonetworking_layer::send_beacon: ", *_beacon); + // Encode message using TITAN because of payload in omited + TTCN_Buffer encoding_buffer; + _beacon->encode(*(_beacon->get_descriptor()), encoding_buffer, TTCN_EncDec::CT_RAW); + OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); + params_its params(_params); + if (_secured_mode) { // Apply Security + if (build_secured_pdu(data, params) != 0) { + return; + } + } + // Send it + // TODO To be removed + while (_sendData.try_lock() == FALSE) { + // not ready yet + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } // End of 'while' statement + send_to_all_layers(data, params); + _sendData.unlock(); + + // loggers::get_instance().log("<<< geonetworking_layer::send_beacon"); +} // End of send_beacon method + +void geonetworking_layer::start_pass_beaconing(const LibItsGeoNetworking__TypesAndValues::BeaconHeader &p_beacon) { + loggers::get_instance().log_msg(">>> geonetworking_layer::start_pass_beaconing", p_beacon); + + const LibItsGeoNetworking__TypesAndValues::LongPosVector &lpv = p_beacon.srcPosVector(); + if (!_pass_beacon_table.has_entry(lpv.gnAddr().mid())) { + _pass_beacon_table.add_entry(lpv); + } // TODO Refined adding a boolean return code +} // End of start_pass_beaconing method + +void geonetworking_layer::stop_pass_beaconing() { + loggers::get_instance().log(">>> geonetworking_layer::stop_pass_beaconing"); + + _pass_beacon_table.reset(); +} // End of stop_pass_beaconing method + +int geonetworking_layer::enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security) { + loggers::get_instance().log(">>> geonetworking_layer::enable_secured_mode: '%s' - %x", p_certificate_id.c_str(), p_enforce_security); + + loggers::get_instance().log("geonetworking_layer::enable_secured_mode: _secured_mode = %x", _secured_mode); + if (!_secured_mode) { + loggers::get_instance().log("geonetworking_layer::enable_secured_mode: Setup secured mode"); + _secured_mode = true; + setup_secured_mode(); + } + _enable_security_checks = p_enforce_security; + params_its::const_iterator it = _params.find(params_its::certificate); + if (it == _params.cend()) { + _params.insert(std::pair(params_its::certificate, p_certificate_id)); + } else { + _params[params_its::certificate] = p_certificate_id; + } + + loggers::get_instance().log("geonetworking_layer::enable_secured_mode: Certificate to be used: '%s'", _params[params_its::certificate].c_str()); + + return 0; +} + +int geonetworking_layer::disable_secured_mode() { + loggers::get_instance().log(">>> geonetworking_layer::disable_secured_mode"); + _secured_mode = false; + _enable_security_checks = false; + return 0; +} + +const LongPosVector *geonetworking_layer::get_lpv(const GN__Address &p_gn_address) { + loggers::get_instance().log_msg(">>> geonetworking_layer::get_lpv", p_gn_address); + + const LongPosVector *lpv = nullptr; + if (_location_table.has_entry(p_gn_address.mid())) { + lpv = _location_table.get_entry(p_gn_address.mid()); + } + return lpv; +} // End of get_lpv + +const LibItsGeoNetworking__TypesAndValues::BasicHeader geonetworking_layer::fill_basic_header() const { + return LibItsGeoNetworking__TypesAndValues::BasicHeader(1, // GeoNetworking version + BasicNextHeader(BasicNextHeader::e__commonHeader), 0, Lifetime(4, LtBase(LtBase::e__50ms)), 1); +} + +void geonetworking_layer::fill_beacon(const OCTETSTRING &p_ll_address, const INTEGER p_station_type, const INTEGER p_country, const INTEGER type_of_address) { + _beacon = new GeoNetworkingPdu(); + HeaderTST h; + h.beaconHdr() = BeaconHeaderType(HeaderType(HeaderType::e__beacon), 0); + ExtendedHeader eh; + eh.beaconHeader() = + BeaconHeader(LongPosVector(GN__Address(TypeOfAddress((TypeOfAddress)type_of_address), StationType((StationType)p_station_type), p_country, p_ll_address), 0, + _latitude, _longitude, int2bit(0, 1), 0, 0)); + _beacon->basicHeader() = fill_basic_header(); + _beacon->gnPacket().packet() = + GnNonSecuredPacket(CommonHeader(NextHeader(NextHeader::e__any), 0, h, + TrafficClass(SCF(SCF::e__scfEnabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), int2bit(0, 8), 0, 1, 0), + OPTIONAL(eh), OPTIONAL()); + _beacon->gnPacket().packet().payload().set_to_omit(); + _beacon->gnPacket().securedMsg().set_to_omit(); + // loggers::get_instance().log_msg("geonetworking_layer::fill_beacon: beacon value: ", *_beacon); +} // End of fill_beacon method + +void geonetworking_layer::fill_gbc_packet(const OCTETSTRING &p_ll_address, const INTEGER &p_geoAreaPosLatitude, const INTEGER &p_geoAreaPosLongitude, + const INTEGER &p_distanceA, const INTEGER &p_distanceB, const INTEGER &p_angle) { + _gbc_packet = new GeoNetworkingPdu(); + HeaderTST h; + h.geoBroadcastHdr() = + GeoBroadcastHeaderType(HeaderType(HeaderType::e__geoBroadcast), HeaderSubTypeGeoBroadcast(HeaderSubTypeGeoBroadcast::e__geoBroadcastElip)); + ExtendedHeader eh; + eh.geoBroadcastHeader() = GeoAnycastHeader( // GeoBradcastHeader is identical as GeoAnycastHeader + 0, 0, + LongPosVector(GN__Address(TypeOfAddress(TypeOfAddress::e__manual), // TODO Use params + StationType(StationType::e__passengerCar), // TODO Use params + 33, p_ll_address), + 0, _latitude, _longitude, int2bit(1, 1), // PAI + 0, 0), + p_geoAreaPosLatitude, p_geoAreaPosLongitude, p_distanceA, p_distanceB, p_angle, 0); + _gbc_packet->basicHeader() = fill_basic_header(); + _gbc_packet->gnPacket().packet() = GnNonSecuredPacket( + CommonHeader(NextHeader(NextHeader::e__btpA), 0, h, TrafficClass(SCF(SCF::e__scfDisabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), + int2bit(128, 8), // Mobile stationnary flag set + 0, 5, 0), + OPTIONAL(eh), OPTIONAL()); + _gbc_packet->gnPacket().packet().payload().set_to_omit(); + _gbc_packet->gnPacket().securedMsg().set_to_omit(); + // loggers::get_instance().log_msg("geonetworking_layer::fill_gbc_packet: packet value: ", *_gbc_packet); +} // End of fill_gbc_packet method + +void geonetworking_layer::fill_shb_packet(const OCTETSTRING &p_ll_address) { + _shb_packet = new GeoNetworkingPdu(); + HeaderTST h; + h.tsbHdr() = TsbHeaderType(HeaderType(HeaderType::e__topologicallyScopedBroadcast), HeaderSubTypeTSB(HeaderSubTypeTSB::e__singleHop)); + ExtendedHeader eh; + eh.shbHeader() = SHBHeader(LongPosVector(GN__Address(TypeOfAddress(TypeOfAddress::e__manual), // TODO Use params + StationType(StationType::e__passengerCar), // TODO Use params + 33, p_ll_address), + 0, _latitude, _longitude, int2bit(1, 1), // PAI + 0, 0), + 0); + _shb_packet->basicHeader() = fill_basic_header(); + _shb_packet->gnPacket().packet() = GnNonSecuredPacket( + CommonHeader(NextHeader(NextHeader::e__btpA), 0, h, TrafficClass(SCF(SCF::e__scfDisabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), + int2bit(128, 8), // Mobile stationnary flag set + 0, 1, 0), + OPTIONAL(eh), OPTIONAL()); + _shb_packet->gnPacket().packet().payload().set_to_omit(); + _shb_packet->gnPacket().securedMsg().set_to_omit(); + // loggers::get_instance().log_msg("geonetworking_layer::fill_shb_packet: packet value: ", *_shb_packet); +} // End of fill_shb_packet method + +void geonetworking_layer::fill_tsb_packet(const OCTETSTRING &p_ll_address, const int p_hop_number, const int p_max_hop_limit) { + _tsb_packet = new GeoNetworkingPdu(); + HeaderTST h; + h.tsbHdr() = TsbHeaderType(HeaderType(HeaderType::e__topologicallyScopedBroadcast), HeaderSubTypeTSB(HeaderSubTypeTSB::e__multiHop)); + ExtendedHeader eh; + eh.tsbHeader() = TSBHeader(0, 0, + LongPosVector(GN__Address(TypeOfAddress(TypeOfAddress::e__manual), // TODO Use params + StationType(StationType::e__passengerCar), // TODO Use params + 33, p_ll_address), + 0, _latitude, _longitude, int2bit(1, 1), // PAI + 0, 0)); + _tsb_packet->basicHeader() = fill_basic_header(); + _tsb_packet->gnPacket().packet() = GnNonSecuredPacket( + CommonHeader(NextHeader(NextHeader::e__btpA), 0, h, TrafficClass(SCF(SCF::e__scfDisabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), + int2bit(128, 8), // Mobile stationnary flag set + 0, p_max_hop_limit, 0), + OPTIONAL(eh), OPTIONAL()); + _tsb_packet->gnPacket().packet().payload().set_to_omit(); + _tsb_packet->gnPacket().securedMsg().set_to_omit(); + // loggers::get_instance().log_msg("geonetworking_layer::fill_tsb_packet: packet value: ", *_tsb_packet); +} // End of fill_tsb_packet method + +void geonetworking_layer::fill_uni_packet(const OCTETSTRING &p_ll_address, const int p_hop_number, const int p_max_hop_limit) { + _uni_packet = new GeoNetworkingPdu(); + HeaderTST h; + h.geoUnicastHdr() = GeoUnicastHeaderType(HeaderType(HeaderType::e__geoUnicast), 0); + ExtendedHeader eh; + eh.geoUnicastHeader() = GeoUnicastHeader(0, 0, + LongPosVector(GN__Address(TypeOfAddress(TypeOfAddress::e__manual), // TODO Use params + StationType(StationType::e__passengerCar), // TODO Use params + 33, p_ll_address), + 0, _latitude, _longitude, int2bit(1, 1), // PAI + 0, 0), + ShortPosVector(GN__Address(TypeOfAddress(TypeOfAddress::e__manual), // TODO Use params + StationType(StationType::e__passengerCar), // TODO Use params + 33, p_ll_address), + 0, _latitude + 100, _longitude + 100)); + _uni_packet->basicHeader() = fill_basic_header(); + _uni_packet->gnPacket().packet() = GnNonSecuredPacket( + CommonHeader(NextHeader(NextHeader::e__btpA), 0, h, TrafficClass(SCF(SCF::e__scfDisabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), + int2bit(128, 8), // Mobile stationnary flag set + 0, p_max_hop_limit, 0), + OPTIONAL(eh), OPTIONAL()); + _uni_packet->gnPacket().packet().payload().set_to_omit(); + _uni_packet->gnPacket().securedMsg().set_to_omit(); + // loggers::get_instance().log_msg("geonetworking_layer::fill_uni_packet: packet value: ", *_uni_packet); +} // End of fill_uni_packet method + +void geonetworking_layer::fill_ls_reply(const OCTETSTRING &p_ll_address) { + _ls_reply = new GeoNetworkingPdu(); + HeaderTST h; + h.lsHdr() = LsHeaderType(HeaderType(HeaderType::e__locationService), HeaderSubTypeLs(HeaderSubTypeLs::e__lsReply)); + ExtendedHeader eh; + eh.lsReplyHeader() = LSReplyHeader(0, 0, + LongPosVector(GN__Address(TypeOfAddress(TypeOfAddress::e__manual), // TODO Use params + StationType(StationType::e__passengerCar), // TODO Use params + 33, p_ll_address), + 0, _latitude, _longitude, int2bit(1, 1), // PAI + 0, 0), + ShortPosVector(GN__Address(TypeOfAddress(TypeOfAddress::e__manual), // TODO Use params + StationType(StationType::e__passengerCar), // TODO Use params + 33, p_ll_address), + 0, _latitude, _longitude)); + _ls_reply->basicHeader() = fill_basic_header(); + _ls_reply->gnPacket().packet() = GnNonSecuredPacket(CommonHeader(NextHeader(NextHeader::e__any), 0, h, + TrafficClass(SCF(SCF::e__scfDisabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), + int2bit(128, 8), // Mobile stationnary flag set + 0, 5, 0), + OPTIONAL(eh), OPTIONAL()); + _ls_reply->gnPacket().packet().payload().set_to_omit(); + _ls_reply->gnPacket().securedMsg().set_to_omit(); + // loggers::get_instance().log_msg("geonetworking_layer::fill_ls_reply: packet value: ", *_ls_reply); +} // End of fill_ls_reply method + +void geonetworking_layer::timer_irq_sigalrm_handler(int p_signal, siginfo_t *p_signal_info, void *p_uc) { + // loggers::get_instance().log(">>> geonetworking_layer::timer_irq_sigalrm_handler: Caught signal %d", p_signal); + + static_cast(p_signal_info->si_value.sival_ptr)->send_beacon(); +} // End of method timer_irq_sigalrm_handler + +int geonetworking_layer::build_geonetworking_pdu(OCTETSTRING &data, params_its ¶ms) { + loggers::get_instance().log(">>> geonetworking_layer::build_geonetworking_pdu"); + // params.log(); + + std::string next_header; + params_its::const_iterator it = params.find(params_its::next_header); + if (it != params.cend()) { + next_header = it->second.c_str(); + } + std::string header_type; + it = params.find(params_its::header_type); + if (it != params.cend()) { + header_type = it->second.c_str(); + } + std::string header_sub_type; + it = params.find(params_its::header_sub_type); + if (it != params.cend()) { + header_sub_type = it->second.c_str(); + } + loggers::get_instance().log("geonetworking_layer::build_geonetworking_pdu: %s, %s, %s", next_header.c_str(), header_type.c_str(), header_sub_type.c_str()); + + if (header_type.compare("tsb") == 0) { + if (header_sub_type.compare("sh") == 0) { // Use SHB + ExtendedHeader *eh = static_cast(_shb_packet->gnPacket().packet().extendedHeader().get_opt_value()); + if (eh == nullptr) { + loggers::get_instance().error("geonetworking_layer::build_geonetworking_pdu: Wrong cast"); + return -1; + } + // Update NextHeader + it = params.find(params_its::next_header); + if (next_header.compare("btpB") == 0) { + _shb_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpB; + } else { // Default btp is btpA + _shb_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpA; + } + // Update payload + _shb_packet->gnPacket().packet().commonHeader().plLength() = data.lengthof(); + _shb_packet->gnPacket().packet().payload() = OPTIONAL(data); + // Update timestamp + eh->shbHeader().srcPosVector().timestamp__().set_long_long_val(static_cast(base_time::get_instance().get_its_current_time_mod_ms())); + + loggers::get_instance().log_msg("geonetworking_layer::build_geonetworking_pdu: shb: ", *_shb_packet); + // Encode GeoNetworking PDU + OCTETSTRING os; + _codec.encode(*_shb_packet, os); + data = os; + } else { // Use TSB + ExtendedHeader *eh = static_cast(_tsb_packet->gnPacket().packet().extendedHeader().get_opt_value()); + if (eh == nullptr) { + loggers::get_instance().error("geonetworking_layer::build_geonetworking_pdu: Wrong cast"); + return -1; + } + // Update sequence number + eh->tsbHeader().seqNumber() = _sequence_number++; + // Update NextHeader + it = params.find(params_its::next_header); + if (next_header.compare("btpB") == 0) { + _tsb_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpB; + } else { // Default btp is btpA + _tsb_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpA; + } + // Update payload + _tsb_packet->gnPacket().packet().commonHeader().plLength() = data.lengthof(); + _tsb_packet->gnPacket().packet().payload() = OPTIONAL(data); + // Update timestamp + eh->tsbHeader().srcPosVector().timestamp__().set_long_long_val(static_cast(base_time::get_instance().get_its_current_time_mod_ms())); + + loggers::get_instance().log_msg("geonetworking_layer::build_geonetworking_pdu: tsb: ", *_tsb_packet); + // Encode GeoNetworking PDU + OCTETSTRING os; + _codec.encode(*_tsb_packet, os); + data = os; + } + } else if (header_type.compare("uni") == 0) { + ExtendedHeader *eh = static_cast(_uni_packet->gnPacket().packet().extendedHeader().get_opt_value()); + if (eh == nullptr) { + loggers::get_instance().error("geonetworking_layer::build_geonetworking_pdu: Wrong cast"); + return -1; + } + // Update NextHeader + it = params.find(params_its::next_header); + if (next_header.compare("btpB") == 0) { + _uni_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpB; + } else { // Default btp is btpA + _uni_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpA; + } + // Update sequence number + eh->geoUnicastHeader().seqNumber() = _sequence_number++; + // Update payload + _uni_packet->gnPacket().packet().commonHeader().plLength() = data.lengthof(); + _uni_packet->gnPacket().packet().payload() = OPTIONAL(data); + // Update timestamp + eh->geoUnicastHeader().srcPosVector().timestamp__().set_long_long_val(static_cast(base_time::get_instance().get_its_current_time_mod_ms())); + + loggers::get_instance().log_msg("geonetworking_layer::build_geonetworking_pdu: uni: ", *_uni_packet); + + // Encode GeoNetworking PDU + OCTETSTRING os; + _codec.encode(*_uni_packet, os); + data = os; + } else { // TODO To be continued + // Default: Use GBC + ExtendedHeader *eh = static_cast(_gbc_packet->gnPacket().packet().extendedHeader().get_opt_value()); + if (eh == nullptr) { + loggers::get_instance().error("geonetworking_layer::build_geonetworking_pdu: Wrong cast"); + return -1; + } + // Update NextHeader + it = params.find(params_its::next_header); + if (next_header.compare("btpB") == 0) { + _gbc_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpB; + } else { // Default btp is btpA + _gbc_packet->gnPacket().packet().commonHeader().nextHeader() = NextHeader::e__btpA; + } + // Update sequence number + eh->geoBroadcastHeader().seqNumber() = _sequence_number++; + // Update payload + _gbc_packet->gnPacket().packet().commonHeader().plLength() = data.lengthof(); + _gbc_packet->gnPacket().packet().payload() = OPTIONAL(data); + // Update timestamp + eh->geoBroadcastHeader().srcPosVector().timestamp__().set_long_long_val(static_cast(base_time::get_instance().get_its_current_time_mod_ms())); + + loggers::get_instance().log_msg("geonetworking_layer::build_geonetworking_pdu: gbc: ", *_gbc_packet); + + // Encode GeoNetworking PDU + OCTETSTRING os; + _codec.encode(*_gbc_packet, os); + data = os; + } + + return 0; +} + +int geonetworking_layer::build_secured_pdu(OCTETSTRING &data, params_its ¶ms) { + loggers::get_instance().log_msg(">>> geonetworking_layer::build_secured_pdu: ", data); + // params.log(); + + LibItsGeoNetworking__TypesAndValues::BasicHeader basic_header; + decode_basic_header(data, basic_header); + if (basic_header.nextHeader() == BasicNextHeader::e__securedPacket) { // Already secured (ATS Security test suite/f_sendSecuredGn/Cam/Denm TTCN-3 functions + // Leave data unchanged + loggers::get_instance().log_msg("<<< geonetworking_layer::build_secured_pdu: Leave data unchanged: ", data); + return 0; + } + // Update security mode + unsigned int basic_header_len = 4; // FIXME How to retrieve the BasicHeader length basic_header.get_descriptor()->raw->fieldlength / 8; + loggers::get_instance().log("geonetworking_layer::build_secured_pdu: basic_header_len = %d", basic_header_len); + basic_header.nextHeader() = BasicNextHeader::e__securedPacket; + OCTETSTRING unsecured_gn_payload = OCTETSTRING(data.lengthof() - basic_header_len, static_cast(data) + basic_header_len); + OCTETSTRING secured_gn_payload; + if (security_services::get_instance().secure_gn_payload(unsecured_gn_payload, secured_gn_payload, params) != 0) { + loggers::get_instance().warning("geonetworking_layer::build_secured_pdu: failed to build secured pdu"); + return -1; + } + + // Encode the basic header + // loggers::get_instance().log_msg("geonetworking_layer::build_secured_pdu: New basic_header = ", basic_header); + RAW_enc_tr_pos rp; + rp.level = 0; + rp.pos = NULL; + RAW_enc_tree enc_tree(FALSE, NULL, &rp, 1, basic_header.get_descriptor()->raw); + basic_header.RAW_encode(*basic_header.get_descriptor(), enc_tree); + TTCN_Buffer encoding_buffer; + enc_tree.put_to_buf(encoding_buffer); + // Copy result + data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()) + secured_gn_payload; + loggers::get_instance().log_msg("geonetworking_layer::build_secured_pdu: Secured pdu = ", data); + + return 0; +} + +int geonetworking_layer::decode_basic_header(const OCTETSTRING &p_data, LibItsGeoNetworking__TypesAndValues::BasicHeader &p_basic_header) { + // loggers::get_instance().log_msg(">>> geonetworking_layer::decode_basic_header: ", p_data); + + // Update security mode + OCTETSTRING bh = + OCTETSTRING(4, static_cast(p_data)); // Extract the basic header as specified in ETSI EN 302 636-4-1 V1.3.1 (2017-08) Clause 9.6 + // loggers::get_instance().log_msg("geonetworking_layer::decode_basic_header: bh: ", bh); + TTCN_Buffer decoding_buffer(bh); + p_basic_header.RAW_decode(*p_basic_header.get_descriptor(), decoding_buffer, decoding_buffer.get_len() * 8, raw_order_t::ORDER_MSB); + // loggers::get_instance().log_msg("geonetworking_layer::decode_basic_header: ", p_basic_header); + + return 0; +} + +int geonetworking_layer::setup_secured_mode() { + loggers::get_instance().log(">>> geonetworking_layer::setup_secured_mode"); + + loggers::get_instance().log("geonetworking_layer::setup_secured_mode: GN Layer address = %p", this); + + params_its::const_iterator it = _params.find(params_its::certificate); + if (it == _params.cend()) { + _params.insert(std::pair(std::string("certificate"), "CERT_TS_A_AT")); + } + it = _params.find(params_its::sec_db_path); + if (it == _params.cend()) { + _params.insert(std::pair(std::string("sec_db_path"), "")); + } + it = _params.find(params_its::hash); + if (it == _params.cend()) { + _params.insert(std::pair(std::string("hash"), "SHA-256")); + } + // Set up security services even if secured_mode is set to 0. Later, we can receive an AcEnableSecurity request, the sertificate caching will be ready to go + security_services::get_instance().setup(_params); + security_services::get_instance().set_position(_latitude, _longitude); + + return 0; +} + +geonetworking_layer_factory geonetworking_layer_factory::_f; diff --git a/scripts/devenv.bash.debian b/scripts/devenv.bash.debian index c6a9aaa..3954023 100755 --- a/scripts/devenv.bash.debian +++ b/scripts/devenv.bash.debian @@ -57,11 +57,13 @@ then export TTCN3_LICENSE_FILE=${TTCN3_DIR}/etc/license/license.dat export PATH_DEV_TTCN=${HOME}/dev/ttcn3 # ITS support - export PATH_DEV_ITS=${HOME}/dev/etsi_its + export PATH_DEV_ITS=${HOME}/dev/TS.ITS # Emergency Communication support - export PATH_DEV_EMCOM=${HOME}/dev/etsi_emcom + export PATH_DEV_EMCOM=${HOME}/dev/NG112 # Mobile-Edge Computing support - export PATH_DEV_MEC=${HOME}/dev/etsi_mec + export PATH_DEV_MEC=${HOME}/dev/gs032p3-ttcn-test-suite + # CDM/CISE support + export PATH_DEV_MEC=${HOME}/dev/cise # Validation folder export VALIDATION_DIR=${HOME} fi diff --git a/scripts/devenv.bash.ubuntu b/scripts/devenv.bash.ubuntu index c6a9aaa..254cc37 100755 --- a/scripts/devenv.bash.ubuntu +++ b/scripts/devenv.bash.ubuntu @@ -2,12 +2,14 @@ # Turn on debug mode #set -vx -#set -e + +set -e # Colors and Prompt #export PS1="\w\$ " #export PS1="\D{%Y-%m-%d %H:%M:%S} \w\n\$ " +export TERM=xterm export EDITOR=emacs set -o emacs @@ -26,24 +28,24 @@ export HOME_INC=${HOME}/include export PATH=${HOME_BIN}:${PATH} # Update LD_LIBRARY_PATH environment variable -if [ -z "${LD_LIBRARY_PATH}" ] +if [ "${LD_LIBRARY_PATH}" == "" ] then - export LD_LIBRARY_PATH=${HOME_LIB}:/usr/local/lib:${HOME}/dev/etsi_its/lib + export LD_LIBRARY_PATH=${HOME_LIB}:/usr/local/lib else - export LD_LIBRARY_PATH=${HOME_LIB}:/usr/local/lib:${HOME}/dev/etsi_its/lib:${LD_LIBRARY_PATH} + export LD_LIBRARY_PATH=${HOME_LIB}:/usr/local/lib:${LD_LIBRARY_PATH} fi # Add JAVA support -#export JAVA_VERSION=1.8.0_92 -#export JAVA_JDK=jdk${JAVA_VERSION} -#if [ -d "${HOME_FRAMEWORKS}/${JAVA_JDK}" ] -#then -# export JAVA_HOME=${HOME_FRAMEWORKS}/${JAVA_JDK}/bin -#else -# unset JAVA_VERSION -# unset JAVA_JDK -#fi +export JAVA_VERSION=1.8.0_92 +export JAVA_JDK=jdk${JAVA_VERSION} +if [ -d "${HOME_FRAMEWORKS}/${JAVA_JDK}" ] +then + export JAVA_HOME=${HOME_FRAMEWORKS}/${JAVA_JDK}/bin +else + unset JAVA_VERSION + unset JAVA_JDK +fi # Add TITAN support export TOP=${HOME_FRAMEWORKS}/titan/titan.core @@ -57,19 +59,15 @@ then export TTCN3_LICENSE_FILE=${TTCN3_DIR}/etc/license/license.dat export PATH_DEV_TTCN=${HOME}/dev/ttcn3 # ITS support - export PATH_DEV_ITS=${HOME}/dev/etsi_its + export PATH_DEV_ITS=${HOME}/dev/TS.ITS # Emergency Communication support - export PATH_DEV_EMCOM=${HOME}/dev/etsi_emcom + export PATH_DEV_EMCOM=${HOME}/dev/NG112 # Mobile-Edge Computing support - export PATH_DEV_MEC=${HOME}/dev/etsi_mec + export PATH_DEV_MEC=${HOME}/dev/gs032p3-ttcn-test-suite + # CDM/CISE support + export PATH_DEV_MEC=${HOME}/dev/cise # Validation folder export VALIDATION_DIR=${HOME} fi export BROWSER=netsurf - -export OPENSSL_DIR=/usr/local - -export LSAN_OPTIONS=verbosity=1:log_threads=1 - - diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index 2fa2cb3..52a990b 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit 2fa2cb3e54c00b68682cf178c44b78abb95ffafa +Subproject commit 52a990bcf0047375129ffc75d67714fed77645a1 -- GitLab From a91a39d0041673424558adc52353569c326c25c6 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 16 Dec 2022 08:24:43 +0100 Subject: [PATCH 033/178] Update asn1/Makefile file --- asn1/Makefile | 28 +--------------------------- titan-test-system-framework | 2 +- ttcn/AtsBTP | 2 +- ttcn/AtsCAM | 2 +- ttcn/AtsDENM | 2 +- ttcn/AtsGeoNetworking | 2 +- ttcn/AtsIPv6OverGeoNetworking | 2 +- ttcn/AtsIS | 2 +- ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- 10 files changed, 10 insertions(+), 36 deletions(-) diff --git a/asn1/Makefile b/asn1/Makefile index 77cba37..fcf574f 100644 --- a/asn1/Makefile +++ b/asn1/Makefile @@ -49,7 +49,7 @@ ASN_FILES = AtsCAM/lib/asn1/CAM_PDU_Descriptions.asn AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1LaRaInterface.asn \ AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1MaRaInterface.asn \ AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1Protocol.asn \ - AtsMBR/lib/asn1/EtsiTs103759.asn \ + AtsMBR/lib/asn1/EtsiTs103759Core.asn \ AtsMBR/lib/asn1/EtsiTs103759BaseTypes.asn \ AtsMBR/lib/asn1/EtsiTs103759AsrAppAgnostic.asn \ AtsMBR/lib/asn1/EtsiTs103759AsrCam.asn \ @@ -61,32 +61,6 @@ ASN_FILES = AtsCAM/lib/asn1/CAM_PDU_Descriptions.asn AtsMBR/lib/asn1/ieee1609.2/Ieee1609Dot2CrlBaseTypes.asn \ AtsMBR/lib/asn1/ieee1609.2/Ieee1609Dot2Crl.asn \ -# AtsMBR/lib/asn1/sec_ts103097/EtsiTs103097ExtensionModule.asn \ -# AtsMBR/lib/asn1/sec_ts103097/EtsiTs103097Module.asn \ - - -# AtsMBR/lib/asn1/sec_ts103097/ieee1609dot2/Ieee1609Dot2BaseTypes.asn \ -# AtsMBR/lib/asn1/sec_ts103097/ieee1609dot2/Ieee1609Dot2.asn \ -# AtsMBR/lib/asn1/sec_ts103097/ieee1609dot2/Ieee1609Dot2BaseTypes.asn \ -# AtsMBR/lib/asn1/sec_ts103097/ieee1609dot2/Ieee1609Dot2Crl.asn \ -# AtsMBR/lib/asn1/sec_ts103097/ieee1609dot2/Ieee1609Dot2CrlBaseTypes.asn - - -# ../build/asn1/ISO_TS_19091/ISO-TS-19091-addgrp-C-2018-patched.asn \ -# ../build/asn1/ISO_TS_19091/AddGrpC.asn \ -# ../build/asn1/ISO_TS_19091/AddGrpC_noCircular.asn \ -# ../build/asn1/ISO_TS_19091/DSRC.asn \ -# ../build/asn1/ISO_TS_19091/DSRC_REGION_noCircular.asn \ -# ../build/asn1/ISO_TS_19091/REGION.asn \ - -# AtsPki/lib/asn1/EtsiTs102941BaseTypes.asn \ -# AtsPki/lib/asn1/EtsiTs102941MessagesCa.asn \ -# AtsPki/lib/asn1/EtsiTs102941TrustLists.asn \ -# AtsPki/lib/asn1/EtsiTs102941TypesAuthorization.asn \ -# AtsPki/lib/asn1/EtsiTs102941TypesAuthorizationValidation.asn \ -# AtsPki/lib/asn1/EtsiTs102941TypesCaManagement.asn \ -# AtsPki/lib/asn1/EtsiTs102941TypesEnrolment.asn \ -# AtsPki/lib/asn1/EtsiTs102941TypesLinkCertificate.asn \ # PDUs PDU = CAM DENM MAPEM SPATEM SREM SSEM IVIM RTCMEM EtsiTs103097Data EtsiTs103097Certificate EtsiTs103759Data diff --git a/titan-test-system-framework b/titan-test-system-framework index a24f374..07e483b 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit a24f37489fd2fb50bfcd3a35b3e8e094a9c2bf6a +Subproject commit 07e483b6f5f83ea55de07fe84eaa924c7f401724 diff --git a/ttcn/AtsBTP b/ttcn/AtsBTP index 0a29c30..f12044d 160000 --- a/ttcn/AtsBTP +++ b/ttcn/AtsBTP @@ -1 +1 @@ -Subproject commit 0a29c3037d0554893bc23de26cb792f94376acfe +Subproject commit f12044dd31da635d3f886364dee894972ceb2ca5 diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 92d2aa3..601c6de 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 92d2aa36b5705254387cb88bd73679d823096459 +Subproject commit 601c6de4b529cfcced4abc07a1dbb0b52d4855f8 diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index f0f7b1b..a1063e1 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit f0f7b1b479e1bc01bc58cfcd86af9831c26ddefb +Subproject commit a1063e187bfaf714640580430a13cfa387f8d0ca diff --git a/ttcn/AtsGeoNetworking b/ttcn/AtsGeoNetworking index a3d39a7..a54b3ec 160000 --- a/ttcn/AtsGeoNetworking +++ b/ttcn/AtsGeoNetworking @@ -1 +1 @@ -Subproject commit a3d39a719245239aaf91c23c8da57464ab59dd53 +Subproject commit a54b3ec55786329066a95b83c1acb7150d1c51b1 diff --git a/ttcn/AtsIPv6OverGeoNetworking b/ttcn/AtsIPv6OverGeoNetworking index 49aec24..3c55ae5 160000 --- a/ttcn/AtsIPv6OverGeoNetworking +++ b/ttcn/AtsIPv6OverGeoNetworking @@ -1 +1 @@ -Subproject commit 49aec246ebefa8eb74b0a06566c47288c94e71d6 +Subproject commit 3c55ae5c802fc2d6ae258ce08a95c23bbc010b68 diff --git a/ttcn/AtsIS b/ttcn/AtsIS index f788e19..d8778ea 160000 --- a/ttcn/AtsIS +++ b/ttcn/AtsIS @@ -1 +1 @@ -Subproject commit f788e19d36b042b4471b0de38f9993b6d44f2250 +Subproject commit d8778ea72e7fd8d37146c6f8e84604aef4d77729 diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 0400d1a..c0f5631 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 0400d1acd33cb610211826772f4100706237d0cf +Subproject commit c0f56315e834b3634d5ab080b166669ee6df7a49 diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 121c65e..e421c83 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 121c65e29e4d636921dd6e2bf5b853aee90d7d2f +Subproject commit e421c8353068d4407c350b356785692d26ca99c4 -- GitLab From 99fd0a2d659bda2e051f02e5b43aa6b91701da14 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Wed, 25 Jan 2023 15:31:13 +0100 Subject: [PATCH 034/178] add ASN files in asn1c config --- asn1/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/asn1/Makefile b/asn1/Makefile index e2f9880..0d4c4fd 100644 --- a/asn1/Makefile +++ b/asn1/Makefile @@ -15,6 +15,8 @@ ASN_FILES = AtsCAM/lib/asn1/CAM_PDU_Descriptions.asn \ AtsSecurity/lib/asn1/EtsiTs103097Module.asn \ AtsSecurity/lib/asn1/ieee1609dot2/Ieee1609Dot2.asn \ AtsSecurity/lib/asn1/ieee1609dot2/Ieee1609Dot2BaseTypes.asn\ + AtsSecurity/lib/asn1/ieee1609dot2/Ieee1609Dot2Crl.asn \ + AtsSecurity/lib/asn1/ieee1609dot2/Ieee1609Dot2CrlBaseTypes.asn \ AtsIS/lib/asn1/IVIM_PDU_Descriptions.asn \ AtsIS/lib/asn1/MAPEM_PDU_Descriptions.asn \ AtsIS/lib/asn1/RTCMEM_PDU_Descriptions.asn \ -- GitLab From 6b5823d34241e5054c4dcac8a7bade08b83e0b91 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Wed, 25 Jan 2023 20:20:12 +0100 Subject: [PATCH 035/178] synch devel branch with recent changes in ASN.1 files --- asn1/Makefile | 61 ++++++++++++++++++------------------- config.mk | 10 +++--- titan-test-system-framework | 2 +- ttcn/AtsCAM | 2 +- ttcn/AtsMBR | 2 +- ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- 7 files changed, 40 insertions(+), 41 deletions(-) diff --git a/asn1/Makefile b/asn1/Makefile index 0d4bd07..9468fe1 100644 --- a/asn1/Makefile +++ b/asn1/Makefile @@ -8,13 +8,37 @@ # The name of the library ASN_LIBRARY = libItsAsn.a # ASN.1 files to be included in the library -ASN_FILES = AtsCAM/lib/asn1/CAM_PDU_Descriptions.asn \ - AtsCAM/lib/asn1/cdd/ITS_Container.asn \ - AtsDENM/lib/asn1/DENM_PDU_Descriptions.asn \ +ASN_FILES = \ + AtsMBR/lib/asn1/EtsiTs103759AsrAppAgnostic.asn \ + AtsMBR/lib/asn1/EtsiTs103759AsrCam.asn \ + AtsMBR/lib/asn1/EtsiTs103759AsrDenm.asn \ + AtsMBR/lib/asn1/EtsiTs103759BaseTypes.asn \ + AtsMBR/lib/asn1/EtsiTs103759CommonObservations.asn \ + AtsMBR/lib/asn1/EtsiTs103759Core.asn \ + AtsMBR/lib/asn1/SaeJ3287AsrBsm.asn \ AtsSecurity/lib/asn1/EtsiTs103097ExtensionModule.asn \ AtsSecurity/lib/asn1/EtsiTs103097Module.asn \ - AtsSecurity/lib/asn1/ieee1609dot2/Ieee1609Dot2.asn \ - AtsSecurity/lib/asn1/ieee1609dot2/Ieee1609Dot2BaseTypes.asn \ + AtsSecurity/lib/asn1/ieee1609dot2/IEEE1609dot2BaseTypes.asn \ + AtsSecurity/lib/asn1/ieee1609dot2/IEEE1609dot2.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/ieee1609dot2/Ieee1609Dot2Crl.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/ieee1609dot2/Ieee1609Dot2CrlBaseTypes.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaEeInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaLaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaMaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaRaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1Acpc.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1CamRaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1CertManagement.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1EcaEeInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1EeMaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1EeRaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1LaMaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1LaRaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1MaRaInterface.asn \ + AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1Protocol.asn \ + AtsCAM/lib/asn1/CAM_PDU_Descriptions.asn \ + AtsCAM/lib/asn1/cdd/ITS_Container.asn \ + AtsDENM/lib/asn1/DENM_PDU_Descriptions.asn \ AtsIS/lib/asn1/IVIM_PDU_Descriptions.asn \ AtsIS/lib/asn1/MAPEM_PDU_Descriptions.asn \ AtsIS/lib/asn1/RTCMEM_PDU_Descriptions.asn \ @@ -33,33 +57,6 @@ ASN_FILES = AtsCAM/lib/asn1/CAM_PDU_Descriptions.asn ../build/asn1/ISO_TS_14816/AVIAEINumberingAndDataStructures.asn \ ../build/asn1/ISO_TS_17419/CITSapplMgmtIDs.asn \ ../build/asn1/ISO_TS_19321/IVI.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Crl.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2CrlBaseTypes.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaEeInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaLaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaMaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaRaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1Acpc.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1CamRaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1CertManagement.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1EcaEeInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1EeMaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1EeRaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1LaMaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1LaRaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1MaRaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1Protocol.asn \ - AtsMBR/lib/asn1/EtsiTs103759Core.asn \ - AtsMBR/lib/asn1/EtsiTs103759BaseTypes.asn \ - AtsMBR/lib/asn1/EtsiTs103759AsrAppAgnostic.asn \ - AtsMBR/lib/asn1/EtsiTs103759AsrCam.asn \ - AtsMBR/lib/asn1/EtsiTs103759AsrDenm.asn \ - AtsMBR/lib/asn1/EtsiTs103759CommonObservations.asn \ - AtsMBR/lib/asn1/SaeJ3287AsrBsm.asn \ - AtsMBR/lib/asn1/ieee1609.2/Ieee1609Dot2BaseTypes.asn \ - AtsMBR/lib/asn1/ieee1609.2/Ieee1609Dot2.asn \ - AtsMBR/lib/asn1/ieee1609.2/Ieee1609Dot2CrlBaseTypes.asn \ - AtsMBR/lib/asn1/ieee1609.2/Ieee1609Dot2Crl.asn \ # PDUs diff --git a/config.mk b/config.mk index c6a59a3..78c3fd9 100644 --- a/config.mk +++ b/config.mk @@ -1,7 +1,9 @@ -TTCN3_DIR := $(HOME)/frameworks/titan/titan.core/Install -ASN1C_PATH := $(HOME)/frameworks/asn1c.denis -#WPCAP_DLL_PATH := /cygdrive/c/windows/system32/npcap/wpcap.dll -#NPCAP_INCLUDE := /cygdrive/c/PROGRA~1/Npcap/sdk/include +#TTCN3_DIR := $(HOME)/frameworks/titan/titan.core/Install +#ASN1C_PATH := $(HOME)/frameworks/asn1c.denis +TTCN3_DIR := /cygdrive/c/Tools/titan +ASN1C_PATH := ../../../asn1c-fillabs +WPCAP_DLL_PATH := /cygdrive/c/windows/system32/npcap/wpcap.dll +NPCAP_INCLUDE := /cygdrive/c/PROGRA~1/Npcap/sdk/include #T3Q_PATH=./tools/t3q-v2.0.0b30 #T3Q_CONFIG=t3q.cfg #T3D_PATH=./tools/t3d-v2.0.0b30 diff --git a/titan-test-system-framework b/titan-test-system-framework index 07e483b..b3e32ae 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit 07e483b6f5f83ea55de07fe84eaa924c7f401724 +Subproject commit b3e32ae45e559819ba3eab8ba748a03ff6fdd284 diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 601c6de..84fbaff 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 601c6de4b529cfcced4abc07a1dbb0b52d4855f8 +Subproject commit 84fbaff028a63884f5db2074d0ace729be39265f diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index 52a990b..b9a8374 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit 52a990bcf0047375129ffc75d67714fed77645a1 +Subproject commit b9a8374ae0a4022cd5c785955ac333a02868fa8a diff --git a/ttcn/AtsPki b/ttcn/AtsPki index c0f5631..5a1cb5c 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit c0f56315e834b3634d5ab080b166669ee6df7a49 +Subproject commit 5a1cb5cc64713596dd5f928b5b3bc2516efee7cd diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index e421c83..18e0dd3 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit e421c8353068d4407c350b356785692d26ca99c4 +Subproject commit 18e0dd306a118552abae5e567dc5da0a780e25d1 -- GitLab From 9f4ef9ee61ced4b575d38887e647c29de0fb9ce5 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 26 Jan 2023 09:05:02 +0100 Subject: [PATCH 036/178] Fix file name issues in asn1/Makefile --- asn1/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/asn1/Makefile b/asn1/Makefile index 9468fe1..fc3ab8b 100644 --- a/asn1/Makefile +++ b/asn1/Makefile @@ -18,8 +18,8 @@ ASN_FILES = \ AtsMBR/lib/asn1/SaeJ3287AsrBsm.asn \ AtsSecurity/lib/asn1/EtsiTs103097ExtensionModule.asn \ AtsSecurity/lib/asn1/EtsiTs103097Module.asn \ - AtsSecurity/lib/asn1/ieee1609dot2/IEEE1609dot2BaseTypes.asn \ - AtsSecurity/lib/asn1/ieee1609dot2/IEEE1609dot2.asn \ + AtsSecurity/lib/asn1/ieee1609dot2/Ieee1609Dot2BaseTypes.asn \ + AtsSecurity/lib/asn1/ieee1609dot2/Ieee1609Dot2.asn \ AtsPki/lib/asn1/ieee_1609.2.1/ieee1609dot2/Ieee1609Dot2Crl.asn \ AtsPki/lib/asn1/ieee_1609.2.1/ieee1609dot2/Ieee1609Dot2CrlBaseTypes.asn \ AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaEeInterface.asn \ -- GitLab From ce3fe62d49e67e46849fc90afab002810626f529 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Thu, 26 Jan 2023 19:02:32 +0100 Subject: [PATCH 037/178] construct asn1 file list dynamically. Check presense. --- Makefile | 34 ++- asn1/Makefile | 209 ------------------ asn1/PsidGroupPermissions.c.diff | 35 --- .../{asn1_recode_per.cc => asn1_recoder.cc} | 20 +- .../{asn1_recode_per.hh => asn1_recoder.hh} | 4 +- ccsrc/Asn1c/module.mk | 2 +- ccsrc/Asn1c/oer_codec.hh | 42 ++++ ccsrc/Asn1c/per_codec.hh | 80 +++++++ ccsrc/Externals/LibItsSecurity_externals.cc | 2 + libasn1.mk | 119 ++++++++++ ttcn/AtsCAM | 2 +- ttcn/AtsDENM | 2 +- ttcn/AtsIS | 2 +- ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- 15 files changed, 290 insertions(+), 267 deletions(-) delete mode 100644 asn1/Makefile delete mode 100644 asn1/PsidGroupPermissions.c.diff rename ccsrc/Asn1c/{asn1_recode_per.cc => asn1_recoder.cc} (60%) rename ccsrc/Asn1c/{asn1_recode_per.hh => asn1_recoder.hh} (88%) create mode 100755 ccsrc/Asn1c/oer_codec.hh create mode 100755 ccsrc/Asn1c/per_codec.hh create mode 100755 libasn1.mk diff --git a/Makefile b/Makefile index 5aa4b06..8a8343b 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,14 @@ ifeq (,$(TTCN3_DIR)) $(error TTCN3_DIR shall be defined in config.mk) endif +ifeq (,$(ASN1C)) + ifneq (,$(ASN1C_PATH)) + ASN1C := $(ASN1C_PATH)/asn1c/.libs/asn1c -S $(ASN1C_PATH)/skeletons + else + ASN1C := asn1c + endif +endif + export ASN1C_PATH first: all @@ -26,8 +34,8 @@ $$(foreach I, $$(includes), $$(eval all_includes += $$(if $$(filter /%, $$(I)), $$(foreach M, $$(modules), $$(eval $$(call IncludeModule, $$(if $$(filter /%, $$(M)), $$(TOPDIR)/$$(M), $(1)/$$(M))))) endef -all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src /usr/include/jsoncpp -defines += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS) AS_USE_SSL +all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src /usr/include/jsoncpp /usr/include/libxml2 +defines += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS) AS_USE_SSL _GNU_SOURCE libs += $(TTCN3_DIR)/lib/libttcn3-rt2-parallel.a -lstdc++fs ifeq (Windows_NT,$(OS)) @@ -49,7 +57,8 @@ $(eval $(call IncludeModule, $(TOPDIR)/ttcn/$(ATS))) outdir := $(TOPDIR)/build/$(ATS) bindir := $(TOPDIR)/bin -sources := $(sort $(all_sources)) +#sources := $(sort $(all_sources)) +sources := $(all_sources) includes := $(outdir) $(outdir)/.. $(outdir)/../asn1 $(all_includes) $(NPCAP_INCLUDE) ifeq (Windows_NT,$(OS)) @@ -114,11 +123,11 @@ t3d: all @echo -e "TTCN-3 doc generation done..." @echo -e "Output file is located here: $(outdir)/t3d.out" -$(outdir) $(bindir): +$(outdir) $(outdir)/asn1 $(bindir): mkdir -p $@ -$(bindir)/$(ATS)$(EXE): $(outdir)/../asn1/libItsAsn.a $(gen_objects) $(cc_objects) - g++ -g -O0 -std=c++17 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(outdir)/../asn1/libItsAsn.a $(libs) +$(bindir)/$(ATS)$(EXE): $(outdir)/asn1/libItsAsn.a $(gen_objects) $(cc_objects) + g++ -g -O0 -std=c++17 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(outdir)/asn1/libItsAsn.a $(libs) $(gen_objects) :%.o :%.cc g++ -g -O0 -std=c++17 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< @@ -139,9 +148,16 @@ $(outdir)/.generate: Makefile $(tt_sources) $(bindir)/libItsAsn.so: $(outdir)/asn1/libItsAsn.so cp -f $< $@ -$(outdir)/../asn1/libItsAsn.a: FORCE - mkdir -p $(outdir)/../asn1 - $(MAKE) -C $(outdir)/../asn1 -f ../../asn1/Makefile +$(outdir)/asn1/libItsAsn.a: $(asn_sources) $(asn1_sources) libasn1.mk Makefile + mkdir -p $(outdir)/asn1 + echo TOP_DIR := ../../.. >$(outdir)/asn1/Makefile + echo ASN_PDU := $(pdu) >>$(outdir)/asn1/Makefile + echo ASN_FILES := \\ >>$(outdir)/asn1/Makefile + for n in $(asn_sources) $(asn1_sources); do echo " $$n \\"; done >>$(outdir)/asn1/Makefile + echo >>$(outdir)/asn1/Makefile + cat libasn1.mk >>$(outdir)/asn1/Makefile + $(MAKE) -C $(outdir)/asn1 + touch $@ $(foreach S, $(ttcn_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn, %.cc, $(S))): $(S))) $(foreach S, $(ttcn3_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn3, %.cc, $(S))): $(S))) diff --git a/asn1/Makefile b/asn1/Makefile deleted file mode 100644 index 9468fe1..0000000 --- a/asn1/Makefile +++ /dev/null @@ -1,209 +0,0 @@ -########################################################## -# This Makefile is to build the ASN1 library to be used -# for external codec in Titan -# This Makefile is expected that asn1c compiler is -# installed in the PATHs -########################################################## - -# The name of the library -ASN_LIBRARY = libItsAsn.a -# ASN.1 files to be included in the library -ASN_FILES = \ - AtsMBR/lib/asn1/EtsiTs103759AsrAppAgnostic.asn \ - AtsMBR/lib/asn1/EtsiTs103759AsrCam.asn \ - AtsMBR/lib/asn1/EtsiTs103759AsrDenm.asn \ - AtsMBR/lib/asn1/EtsiTs103759BaseTypes.asn \ - AtsMBR/lib/asn1/EtsiTs103759CommonObservations.asn \ - AtsMBR/lib/asn1/EtsiTs103759Core.asn \ - AtsMBR/lib/asn1/SaeJ3287AsrBsm.asn \ - AtsSecurity/lib/asn1/EtsiTs103097ExtensionModule.asn \ - AtsSecurity/lib/asn1/EtsiTs103097Module.asn \ - AtsSecurity/lib/asn1/ieee1609dot2/IEEE1609dot2BaseTypes.asn \ - AtsSecurity/lib/asn1/ieee1609dot2/IEEE1609dot2.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/ieee1609dot2/Ieee1609Dot2Crl.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/ieee1609dot2/Ieee1609Dot2CrlBaseTypes.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaEeInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaLaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaMaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1AcaRaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1Acpc.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1CamRaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1CertManagement.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1EcaEeInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1EeMaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1EeRaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1LaMaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1LaRaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1MaRaInterface.asn \ - AtsPki/lib/asn1/ieee_1609.2.1/Ieee1609Dot2Dot1Protocol.asn \ - AtsCAM/lib/asn1/CAM_PDU_Descriptions.asn \ - AtsCAM/lib/asn1/cdd/ITS_Container.asn \ - AtsDENM/lib/asn1/DENM_PDU_Descriptions.asn \ - AtsIS/lib/asn1/IVIM_PDU_Descriptions.asn \ - AtsIS/lib/asn1/MAPEM_PDU_Descriptions.asn \ - AtsIS/lib/asn1/RTCMEM_PDU_Descriptions.asn \ - AtsIS/lib/asn1/SPATEM_PDU_Descriptions.asn \ - AtsIS/lib/asn1/SREM_PDU_Descriptions.asn \ - AtsIS/lib/asn1/SSEM_PDU_Descriptions.asn \ - AtsIS/lib/asn1/iso-patched/EfcDsrcApplication.asn \ - AtsIS/lib/asn1/iso-patched/EfcDsrcGeneric.asn \ - AtsIS/lib/asn1/iso-patched/ElectronicRegistrationIdentificationVehicleDataModule.asn \ - AtsIS/lib/asn1/iso-patched/GDD.asn \ - AtsIS/lib/asn1/iso-patched/DSRC.asn \ - AtsIS/lib/asn1/iso-patched/DSRC_noCircular.asn \ - AtsIS/lib/asn1/iso-patched/REGION.asn \ - AtsIS/lib/asn1/iso-patched/AddGrpC.asn \ - AtsIS/lib/asn1/iso-patched/AddGrpC_noCircular.asn \ - ../build/asn1/ISO_TS_14816/AVIAEINumberingAndDataStructures.asn \ - ../build/asn1/ISO_TS_17419/CITSapplMgmtIDs.asn \ - ../build/asn1/ISO_TS_19321/IVI.asn \ - - -# PDUs -PDU = CAM DENM MAPEM SPATEM SREM SSEM IVIM RTCMEM EtsiTs103097Data EtsiTs103097Certificate EtsiTs103759Data -#EtsiTs102941Data - -#patches -#PATCHES = PsidGroupPermissions.c.diff - -ASN1C:=asn1c -#Override ASN1C instalation path -#ASN1C_PATH = - -ifneq (, $(ASN1C_PATH)) -# OS=$(shell uname) - ifneq (Windows_NT,$(OS)) - ASN1C:=$(ASN1C_PATH)/asn1c/asn1c -S $(ASN1C_PATH)/skeletons - else - ASN1C:=$(ASN1C_PATH)/asn1c/asn1c.exe -S $(ASN1C_PATH)/skeletons - endif -endif - -ifeq (,$(ASN_DIR)) -########################################################## -# Build path for the library -BIN_DIR := . -SCRIPT_DIR := $(dir $(lastword $(MAKEFILE_LIST))) -ASN_DIR := $(dir $(SCRIPT_DIR))../ttcn - -.PHONY: FORCE - -all: $(BIN_DIR)/$(ASN_LIBRARY) -clean: - rm -rf $(BIN_DIR) - -$(BIN_DIR)/$(ASN_LIBRARY): $(BIN_DIR)/Makefile - make -C $(BIN_DIR) all - -$(BIN_DIR): - mkdir -p $@ - -$(BIN_DIR)/Makefile: $(BIN_DIR) $(SCRIPT_DIR)/Makefile - echo SCRIPT_DIR=$(SCRIPT_DIR) > $@ - echo ASN_DIR=$(ASN_DIR) >>$@ - cat $(SCRIPT_DIR)/Makefile >>$@ - -########################################################## -else -########################################################## -# This part is executed within the BIN_DIR directory to -# override variables from the Makefile.am.libasncodec -# generated by asn1c -LIB_MAKEFILE=Makefile.am.libasncodec -include $(LIB_MAKEFILE) -OBJS = ${ASN_MODULE_SRCS:.c=.o} -CONVERTER=converter -ASN_CONVERTER_SOURCES := \ - converter-example.c\ - pdu_collection.c -CONVERTER_OBJS=${ASN_CONVERTER_SOURCES:.c=.o} -CFLAGS += $(ASN_MODULE_CFLAGS) -DPDU=CAM -DASN_PDU_COLLECTION -fPIC -I. -CC = gcc -std=c99 -GEN_EXAMPLE=-no-gen-example -ifeq (yes,$(DEBUG)) - CFLAGS += -g -O0 -DASN_EMIT_DEBUG=1 -endif - -all: Makefile $(ASN_LIBRARY) - -$(LIB_MAKEFILE): $(addprefix $(ASN_DIR)/, $(ASN_FILES)) - $(ASN1C) $(GEN_EXAMPLE) $(addprefix -pdu=,$(PDU)) -fcompound-names $^ - -for n in $(PATCHES); do git apply "$(SCRIPT_DIR)/$$n"; done - -$(CONVERTER): $(ASN_LIBRARY) $(CONVERTER_OBJS) - $(CC) $(CFLAGS) -o $@ $(CONVERTER_OBJS) $(ASN_LIBRARY) $(LIBS) - -$(ASN_LIBRARY): ${ASN_MODULE_SRCS:.c=.o} - ar rcs $@ $^ -# $(CC) $(CFLAGS) -o $@ $^ -shared $(LDFLAGS) $(LIBS) - -.SUFFIXES: -.SUFFIXES: .c .o - -.c.o: - $(CC) $(CFLAGS) -o $@ -c $< - -clean: - rm -f $(CONVERTER) $(ASN_LIBRARY) - rm -f $(OBJS) $(CONVERTER_OBJS) - -regen: clear-asn1c $(LIB_MAKEFILE) -clear-asn1c: - rm -f $(LIB_MAKEFILE) - -Makefile: $(SCRIPT_DIR)/Makefile - echo SCRIPT_DIR=$(SCRIPT_DIR) > $@ - echo ASN_DIR=$(ASN_DIR) >>$@ - cat $< >>$@ -########################################################## - -$(ASN_DIR)/../build/asn1/ISO_TS_14816/AVIAEINumberingAndDataStructures.asn: - mkdir -p "$(dir $@)" - curl 'https://standards.iso.org/iso/14816/ISO14816%20ASN.1%20repository/ISO14816_AVIAEINumberingAndDataStructures.asn' | \ - sed -e 's/IssuerIdentifier/AVIAEIIssuerIdentifier/g' > "$@" - -#../build/asn1/ISO_TS_14906/EfcDsrcApplication.asn: -# mkdir -p "$(dir $@)" -# curl -o "$@" 'https://standards.iso.org/iso/14906/ed-3/en/ISO14906(2018)EfcDsrcApplicationv6.asn' - -#../build/asn1/ISO_TS_14906/EfcDsrcGeneric.asn: -# mkdir -p "$(dir $@) -# curl -o "$@" 'https://standards.iso.org/iso/14906/ed-3/en/ISO14906(2018)EfcDsrcGenericv7.asn' - -$(ASN_DIR)/../build/asn1/ISO_TS_17419/CITSapplMgmtIDs.asn: - mkdir -p "$(dir $@)" - curl -o "$@" 'https://standards.iso.org/iso/ts/17419/TS%2017419%20ASN.1%20repository/TS17419_2014_CITSapplMgmtIDs.asn' - -$(ASN_DIR)/../build/asn1/ISO_TS_19091/ISO-TS-19091-addgrp-C-2018-patched.asn: - mkdir -p "$(dir $@)" - curl 'https://standards.iso.org/iso/ts/19091/ed-2/en/ISO-TS-19091-addgrp-C-2018.asn' | \ - sed -e 's/\bHeadingConfidence\b/HeadingConfidenceDSRC/g' \ - -e 's/\bSpeedConfidence\b/SpeedConfidenceDSRC/g' \ - -e 's/\bHeading\b/HeadingDSRC/g' > "$@" - -$(ASN_DIR)/../build/asn1/ISO_TS_17419/CITSdataDictionary1.asn: - mkdir -p "$(dir $@)" - curl -o "$@" 'https://standards.iso.org/iso/17419/ed-1/en/17419.1.asn' - -$(ASN_DIR)/../build/asn1/ISO_TS_17419/CITSdataDictionary2.asn: - mkdir -p "$(dir $@)" - curl -o "$@" 'https://standards.iso.org/iso/17419/ed-1/en/17419.2.asn' - -#../build/asn1/ISO_TS_19091/AddGrpC.asn: -#../build/asn1/ISO_TS_19091/AddGrpC_noCircular.asn: -#../build/asn1/ISO_TS_19091/DSRC.asn: -#../build/asn1/ISO_TS_19091/DSRC_REGION_noCircular.asn -#../build/asn1/ISO_TS_19091/REGION.asn - -$(ASN_DIR)/../build/asn1/ISO_TS_19321/IVI.asn: - mkdir -p "$(dir $@)" - curl 'https://standards.iso.org/iso/ts/19321/ed-2/en/ISO19321IVIv2.asn' | \ - sed -e 's/\bCITSdataDictionary1\b/CITSapplMgmtIDs/g' \ - -e 's/,\s*\.\.\.\s*,\s*[0-9]\+/,.../g' \ - > "$@" - -#$(ASN_DIR)/../build/asn1/ISO_TS_24534-3/ElectronicRegistrationIdentificationVehicleDataModule.asn: -# mkdir -p "$(dir $@)" -# curl -o "$@" 'https://standards.iso.org/iso/24534/-3/ISO%2024534-3%20ASN.1%20repository/ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule_ForBallot.asn' - -endif diff --git a/asn1/PsidGroupPermissions.c.diff b/asn1/PsidGroupPermissions.c.diff deleted file mode 100644 index c684a0a..0000000 --- a/asn1/PsidGroupPermissions.c.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- 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" - }, - }; diff --git a/ccsrc/Asn1c/asn1_recode_per.cc b/ccsrc/Asn1c/asn1_recoder.cc similarity index 60% rename from ccsrc/Asn1c/asn1_recode_per.cc rename to ccsrc/Asn1c/asn1_recoder.cc index 5259e44..5aa2e8e 100644 --- a/ccsrc/Asn1c/asn1_recode_per.cc +++ b/ccsrc/Asn1c/asn1_recoder.cc @@ -1,6 +1,6 @@ #include -#include "asn1_recode_per.hh" +#include "asn1_recoder.hh" #include @@ -12,7 +12,7 @@ static int asn1c_collect_encoded_data(const void *buffer, size_t size, void *app } } -int asn1_recode_per::recode(const asn_TYPE_descriptor_s &td, int from, int to, TTCN_Buffer &buf) { +int asn1_recoder::recode(const asn_TYPE_descriptor_s &td, int from, int to, TTCN_Buffer &buf) { int rc = -1; void * ptr = NULL; asn_dec_rval_t rc_d; @@ -30,16 +30,22 @@ int asn1_recode_per::recode(const asn_TYPE_descriptor_s &td, int from, int to, T return rc; } -int asn1_recode_per::ber2per(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf) { return recode(td, (int)ATS_BER, (int)ATS_UNALIGNED_CANONICAL_PER, buf); } +int asn1_recoder::ber2per(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf) +{ + return recode(td, (int)ATS_BER, (int)ATS_UNALIGNED_CANONICAL_PER, buf); +} -int asn1_recode_per::per2ber(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf) { return recode(td, (int)ATS_UNALIGNED_BASIC_PER, (int)ATS_DER, buf); } +int asn1_recoder::per2ber(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf) +{ + return recode(td, (int)ATS_UNALIGNED_BASIC_PER, (int)ATS_DER, buf); +} -/*int asn1_recode_oer::ber2oer(const asn_TYPE_descriptor_s & td, TTCN_Buffer & buf) +int asn1_recoder::ber2oer(const asn_TYPE_descriptor_s & td, TTCN_Buffer & buf) { return recode(td, (int)ATS_XER, (int)ATS_CANONICAL_OER, buf); } -int asn1_recode_oer::oer2ber(const asn_TYPE_descriptor_s & td, TTCN_Buffer & buf) +int asn1_recoder::oer2ber(const asn_TYPE_descriptor_s & td, TTCN_Buffer & buf) { return recodeOer(td, (int)ATS_BASIC_OER, (int)ATS_XER, buf); - }*/ +} diff --git a/ccsrc/Asn1c/asn1_recode_per.hh b/ccsrc/Asn1c/asn1_recoder.hh similarity index 88% rename from ccsrc/Asn1c/asn1_recode_per.hh rename to ccsrc/Asn1c/asn1_recoder.hh index b5ac275..7592e23 100644 --- a/ccsrc/Asn1c/asn1_recode_per.hh +++ b/ccsrc/Asn1c/asn1_recoder.hh @@ -19,9 +19,11 @@ class TTCN_Typedescriptor_t; //! Forward declaration of TITAN class struct asn_TYPE_descriptor_s; //! Forward declaration of asn1c class -class asn1_recode_per { +class asn1_recoder { protected: int ber2per(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf); int per2ber(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf); + int ber2oer(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf); + int oer2ber(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf); int recode(const asn_TYPE_descriptor_s &td, int from, int to, TTCN_Buffer &buf); }; // End of class asn1_recode_per diff --git a/ccsrc/Asn1c/module.mk b/ccsrc/Asn1c/module.mk index 055195f..226091a 100644 --- a/ccsrc/Asn1c/module.mk +++ b/ccsrc/Asn1c/module.mk @@ -1,3 +1,3 @@ -sources := asn1_recode_per.cc +sources := asn1_recoder.cc includes := . diff --git a/ccsrc/Asn1c/oer_codec.hh b/ccsrc/Asn1c/oer_codec.hh new file mode 100755 index 0000000..24c14d9 --- /dev/null +++ b/ccsrc/Asn1c/oer_codec.hh @@ -0,0 +1,42 @@ +#pragma once + +#include "params.hh" +#include "asn1_recoder.hh" + +class OCTETSTRING; +class CHARSTRING; +class BITSTRING; + +struct asn_TYPE_descriptor_s; + +template class oer_codec : public asn1_recoder +{ +public: + virtual int encode(const TPDU& msg, BITSTRING& bits) = 0; + virtual int decode(const BITSTRING& bits, TPDU& msg) = 0; + +protected: + inline int _decode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const BITSTRING& p_data, TPDU& msg) { + TTCN_Buffer buf(bit2oct(p_data)); + TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); + int rc = oer2xer (td, buf); + if (rc > 0) { + msg.decode(ttcn, buf, TTCN_EncDec::CT_BER, BER_ACCEPT_ALL); + rc = buf.get_len(); + } + return rc; + } + inline int _encode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const TPDU& msg, BITSTRING& p_data) { + int rc = -1; + TTCN_Buffer buf; + TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); + msg.encode(ttcn, buf, TTCN_EncDec::CT_BER, BER_ENCODE_DER); + if (buf.get_len() > 0) { + rc = xer2oer (td, buf); + if (rc > 0) { + p_data = oct2bit(OCTETSTRING(buf.get_len(), buf.get_data())); + } + } + return rc; + } +}; diff --git a/ccsrc/Asn1c/per_codec.hh b/ccsrc/Asn1c/per_codec.hh new file mode 100755 index 0000000..0ffc5e1 --- /dev/null +++ b/ccsrc/Asn1c/per_codec.hh @@ -0,0 +1,80 @@ +/*! + * \file per_codec.hh + * \brief Header file for TITAN message to ASN.1 PER message codec. + * \author ETSI STF525 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ +#pragma once + +#include "params.hh" +#include "asn1_recoder.hh" + +class BITSTRING; //! Forward declaration of TITAN class +class TTCN_Typedescriptor_t; //! Forward declaration of TITAN class + +struct asn_TYPE_descriptor_s; //! Declare asn1c class + +/*! + * \class per_codec + * \brief This class provides the interface for all ASN.1 PER codecs. + * \remark This class uses asn1c external tool + */ +template +class per_codec : public asn1_recoder +{ +public: //! \publicsection + /*! + * \fn int encode(const TPDU& p_message, BITSTRING& p_bitstring); + * \brief Encode TITAN message into ASN.1 PER message + * \param[in] p_message The PDU message to encode + * \param[out] p_bitstring The encoded PDU message in bit string format + * \pure + */ + virtual int encode(const TPDU& p_message, BITSTRING& p_bitstring) = 0; + /*! + * \fn int decode(const BITSTRING& p_bitstring, TPDU& p_message); + * \brief Decode ASN.1 PER message into TITAN message + * \param[in] p_bitstring The network message in bit string format to decode + * \param[out] p_message The PDU message + * \pure + */ + virtual int decode(const BITSTRING& p_bitstring, TPDU& p_message) = 0; + +protected: //! \protectedsection + int _decode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const BITSTRING& p_data, TPDU& msg); + int _encode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const TPDU& msg, BITSTRING& p_data); +}; // End of class per_codec + +#include + +template +int per_codec::_decode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const BITSTRING& p_data, TPDU& msg) { + TTCN_Buffer buf(bit2oct(p_data)); + TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); + int rc = per2ber (td, buf); + if (rc > 0) { + msg.decode(ttcn, buf, TTCN_EncDec::CT_BER, BER_ACCEPT_ALL); + rc = buf.get_len(); + } + return rc; +} + +template +int per_codec::_encode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const TPDU& msg, BITSTRING& p_data) { + int rc = -1; + TTCN_Buffer buf; + TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); + msg.encode(ttcn, buf, TTCN_EncDec::CT_BER, BER_ENCODE_DER); + if (buf.get_len() > 0) { + rc = ber2per (td, buf); + if (rc > 0) { + p_data = oct2bit(OCTETSTRING(buf.get_len(), buf.get_data())); + } + } + return rc; +} + diff --git a/ccsrc/Externals/LibItsSecurity_externals.cc b/ccsrc/Externals/LibItsSecurity_externals.cc index 36d0f67..a5129fa 100644 --- a/ccsrc/Externals/LibItsSecurity_externals.cc +++ b/ccsrc/Externals/LibItsSecurity_externals.cc @@ -28,6 +28,8 @@ #include "loggers.hh" +#include "params_its.hh" + namespace LibItsSecurity__Functions { static std::unique_ptr g(new geospacial); diff --git a/libasn1.mk b/libasn1.mk new file mode 100755 index 0000000..a1fcd5a --- /dev/null +++ b/libasn1.mk @@ -0,0 +1,119 @@ +########################################################## +# This Makefile is to build the ASN1 library to be used +# for external codec in Titan +# This Makefile is expected that asn1c compiler is +# installed in the PATHs +########################################################## + +# The name of the library +ASN_LIBRARY = libItsAsn.a + +ifeq (,$(sort $(ASN_FILES))) + $(error ASN_FILES should be specified ) +endif + +#Override ASN1C instalation path +ifneq (, $(ASN1C_PATH)) + ASN1C:=$(ASN1C_PATH)/asn1c/asn1c -S $(ASN1C_PATH)/skeletons +else + ASN1C:=asn1c +endif + +LIB_MAKEFILE=Makefile.am.libasncodec +include $(LIB_MAKEFILE) +OBJS = ${ASN_MODULE_SRCS:.c=.o} +CONVERTER=converter +ASN_CONVERTER_SOURCES := \ + converter-example.c\ + pdu_collection.c +CONVERTER_OBJS=${ASN_CONVERTER_SOURCES:.c=.o} +ifneq ($(strip $(ASN_PDU)),$(firstword $(ASN_PDU))) + HAS_PDU_COLLECTION := -DASN_PDU_COLLECTION +endif + +CFLAGS += $(ASN_MODULE_CFLAGS) -DPDU=$(firstword $(ASN_PDU)) $(HAS_PDU_COLLECTION) -fPIC -I. +CC = gcc -std=c99 +GEN_EXAMPLE=-no-gen-example +ifeq (yes,$(DEBUG)) + CFLAGS += -g -O0 -DASN_EMIT_DEBUG=1 +endif +ASN_SRC_FILES := $(addprefix $(TOP_DIR)/, $(ASN_FILES)) + +all: $(ASN_LIBRARY) + +$(LIB_MAKEFILE): $(ASN_SRC_FILES) Makefile + $(ASN1C) $(GEN_EXAMPLE) $(addprefix -pdu=,$(pdu)) -fcompound-names $(ASN_SRC_FILES) +# -for n in $(PATCHES); do git apply "$(SCRIPT_DIR)/$$n"; done + +$(CONVERTER): $(ASN_LIBRARY) $(CONVERTER_OBJS) + $(CC) $(CFLAGS) -o $@ $(CONVERTER_OBJS) $(ASN_LIBRARY) $(LIBS) + +$(ASN_LIBRARY): ${ASN_MODULE_SRCS:.c=.o} + ar rcs $@ $^ +# $(CC) $(CFLAGS) -o $@ $^ -shared $(LDFLAGS) $(LIBS) + +.SUFFIXES: +.SUFFIXES: .c .o + +.c.o: + $(CC) $(CFLAGS) -o $@ -c $< + +clean: + rm -f $(CONVERTER) $(ASN_LIBRARY) + rm -f $(OBJS) $(CONVERTER_OBJS) + +regen: clear-asn1c $(LIB_MAKEFILE) +clear-asn1c: + rm -f $(LIB_MAKEFILE) + +########################################################## + +$(TOP_DIR)/build/asn1/ISO_TS_14816/AVIAEINumberingAndDataStructures.asn: + mkdir -p "$(dir $@)" + curl 'https://standards.iso.org/iso/14816/ISO14816%20ASN.1%20repository/ISO14816_AVIAEINumberingAndDataStructures.asn' | \ + sed -e 's/IssuerIdentifier/AVIAEIIssuerIdentifier/g' > "$@" + +#$(TOP_DIR)/build/asn1/ISO_TS_14906/EfcDsrcApplication.asn: +# mkdir -p "$(dir $@)" +# curl -o "$@" 'https://standards.iso.org/iso/14906/ed-3/en/ISO14906(2018)EfcDsrcApplicationv6.asn' + +#$(TOP_DIR)/build/asn1/ISO_TS_14906/EfcDsrcGeneric.asn: +# mkdir -p "$(dir $@) +# curl -o "$@" 'https://standards.iso.org/iso/14906/ed-3/en/ISO14906(2018)EfcDsrcGenericv7.asn' + +$(TOP_DIR)/build/asn1/ISO_TS_17419/CITSapplMgmtIDs.asn: + mkdir -p "$(dir $@)" + curl -o "$@" 'https://standards.iso.org/iso/ts/17419/TS%2017419%20ASN.1%20repository/TS17419_2014_CITSapplMgmtIDs.asn' + +$(TOP_DIR)/build/asn1/ISO_TS_19091/ISO-TS-19091-addgrp-C-2018-patched.asn: + mkdir -p "$(dir $@)" + curl 'https://standards.iso.org/iso/ts/19091/ed-2/en/ISO-TS-19091-addgrp-C-2018.asn' | \ + sed -e 's/\bHeadingConfidence\b/HeadingConfidenceDSRC/g' \ + -e 's/\bSpeedConfidence\b/SpeedConfidenceDSRC/g' \ + -e 's/\bHeading\b/HeadingDSRC/g' > "$@" + +$(TOP_DIR)/build/asn1/ISO_TS_17419/CITSdataDictionary1.asn: + mkdir -p "$(dir $@)" + curl -o "$@" 'https://standards.iso.org/iso/17419/ed-1/en/17419.1.asn' + +$(TOP_DIR)/build/asn1/ISO_TS_17419/CITSdataDictionary2.asn: + mkdir -p "$(dir $@)" + curl -o "$@" 'https://standards.iso.org/iso/17419/ed-1/en/17419.2.asn' + +#$(TOP_DIR)/build/asn1/ISO_TS_19091/AddGrpC.asn: +#$(TOP_DIR)/build/asn1/ISO_TS_19091/AddGrpC_noCircular.asn: +#$(TOP_DIR)/build/asn1/ISO_TS_19091/DSRC.asn: +#$(TOP_DIR)/build/asn1/ISO_TS_19091/DSRC_REGION_noCircular.asn +#$(TOP_DIR)/build/asn1/ISO_TS_19091/REGION.asn + +$(TOP_DIR)/build/asn1/ISO_TS_19321/IVI.asn: + mkdir -p "$(dir $@)" + curl 'https://standards.iso.org/iso/ts/19321/ed-2/en/ISO19321IVIv2.asn' | \ + sed -e 's/\bCITSdataDictionary1\b/CITSapplMgmtIDs/g' \ + -e 's/,\s*\.\.\.\s*,\s*[0-9]\+/,.../g' \ + > "$@" + +#$(TOP_DIR)/build/asn1/ISO_TS_24534-3/ElectronicRegistrationIdentificationVehicleDataModule.asn: +# mkdir -p "$(dir $@)" +# curl -o "$@" 'https://standards.iso.org/iso/24534/-3/ISO%2024534-3%20ASN.1%20repository/ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule_ForBallot.asn' + diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 84fbaff..09a580c 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 84fbaff028a63884f5db2074d0ace729be39265f +Subproject commit 09a580c684fa107074e8741545dd00bdb00dbeba diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index a1063e1..be800d1 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit a1063e187bfaf714640580430a13cfa387f8d0ca +Subproject commit be800d1c57a04057ce30860a616d2ed54852ee1b diff --git a/ttcn/AtsIS b/ttcn/AtsIS index d8778ea..09adecf 160000 --- a/ttcn/AtsIS +++ b/ttcn/AtsIS @@ -1 +1 @@ -Subproject commit d8778ea72e7fd8d37146c6f8e84604aef4d77729 +Subproject commit 09adecf68209c12c080b0457b41ef361c26a723d diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 5a1cb5c..57bdf02 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 5a1cb5cc64713596dd5f928b5b3bc2516efee7cd +Subproject commit 57bdf0211e8e70b717d8b23d2ab06f9c55f72041 diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 18e0dd3..4755dd8 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 18e0dd306a118552abae5e567dc5da0a780e25d1 +Subproject commit 4755dd8c2aec84d2601c138a44a27a4ccd9dec47 -- GitLab From fa12caed9418e8815057f4db17de265b89fdecdf Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Thu, 26 Jan 2023 19:13:21 +0100 Subject: [PATCH 038/178] fix file attributes --- ccsrc/Asn1c/oer_codec.hh | 0 ccsrc/Asn1c/per_codec.hh | 0 libasn1.mk | 0 ttcn/AtsBTP | 2 +- ttcn/AtsCAM | 2 +- ttcn/AtsDENM | 2 +- 6 files changed, 3 insertions(+), 3 deletions(-) mode change 100755 => 100644 ccsrc/Asn1c/oer_codec.hh mode change 100755 => 100644 ccsrc/Asn1c/per_codec.hh mode change 100755 => 100644 libasn1.mk diff --git a/ccsrc/Asn1c/oer_codec.hh b/ccsrc/Asn1c/oer_codec.hh old mode 100755 new mode 100644 diff --git a/ccsrc/Asn1c/per_codec.hh b/ccsrc/Asn1c/per_codec.hh old mode 100755 new mode 100644 diff --git a/libasn1.mk b/libasn1.mk old mode 100755 new mode 100644 diff --git a/ttcn/AtsBTP b/ttcn/AtsBTP index f12044d..e1c90f2 160000 --- a/ttcn/AtsBTP +++ b/ttcn/AtsBTP @@ -1 +1 @@ -Subproject commit f12044dd31da635d3f886364dee894972ceb2ca5 +Subproject commit e1c90f29e9b2fcdbb79f064f90ba5f34710b8a2c diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 09a580c..f7be84b 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 09a580c684fa107074e8741545dd00bdb00dbeba +Subproject commit f7be84b8706fffe621cdb0871effef3fc19d0a67 diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index be800d1..29b249a 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit be800d1c57a04057ce30860a616d2ed54852ee1b +Subproject commit 29b249a105b3546c352a845653b78bcecfd8a999 -- GitLab From 2e8564285b3db3d642efe789fef2b5dadc6815eb Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Tue, 14 Feb 2023 10:50:40 +0100 Subject: [PATCH 039/178] Bug fixed in http_codec_its --- ccsrc/Protocols/Http/http_codec_its.cc | 2 +- ccsrc/Protocols/Http/http_codec_its.hh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ccsrc/Protocols/Http/http_codec_its.cc b/ccsrc/Protocols/Http/http_codec_its.cc index fc477a2..0b23cb9 100644 --- a/ccsrc/Protocols/Http/http_codec_its.cc +++ b/ccsrc/Protocols/Http/http_codec_its.cc @@ -33,7 +33,7 @@ bool http_codec_its::encode_body_binary(const LibHttp__BinaryMessageBodyTypes::B return true; } -bool http_codec_its::decode_body_binary(const OCTETSTRING &p_data, LibHttp__BinaryMessageBodyTypes::BinaryBody &p_binary_body, const std::string &p_content_type, params* p_params) { +bool http_codec_its::decode_body_binary(const OCTETSTRING &p_data, LibHttp__BinaryMessageBodyTypes::BinaryBody &p_binary_body, const std::string &p_content_type) { loggers::get_instance().log(">>> http_codec_its::decode_body_binary"); std::map>>::const_iterator it; diff --git a/ccsrc/Protocols/Http/http_codec_its.hh b/ccsrc/Protocols/Http/http_codec_its.hh index e9cb631..931d17c 100644 --- a/ccsrc/Protocols/Http/http_codec_its.hh +++ b/ccsrc/Protocols/Http/http_codec_its.hh @@ -12,5 +12,5 @@ public: protected: //! \protectedsection bool encode_body_binary(const LibHttp__BinaryMessageBodyTypes::BinaryBody &p_binary_body, OCTETSTRING &p_encoding_buffer, const std::string &p_content_type); - bool decode_body_binary(const OCTETSTRING &p_data, LibHttp__BinaryMessageBodyTypes::BinaryBody &p_binary_body, const std::string &p_content_type, params* p_params); + bool decode_body_binary(const OCTETSTRING &p_data, LibHttp__BinaryMessageBodyTypes::BinaryBody &p_binary_body, const std::string &p_content_type); }; \ No newline at end of file -- GitLab From 9ac73e2884c3db7b974dc359f9caa193b96382b4 Mon Sep 17 00:00:00 2001 From: Yann Garcia Date: Mon, 20 Feb 2023 14:31:27 +0000 Subject: [PATCH 040/178] Create release2 branch (devel2) in LibIts --- .gitmodules | 84 ++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/.gitmodules b/.gitmodules index 9c50fae..3aa4088 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,45 +1,45 @@ -[submodule "ttcn/LibCommon"] - path = ttcn/LibCommon - url = https://forge.etsi.org/rep/LIBS/LibCommon.git -[submodule "ttcn/LibIts"] - path = ttcn/LibIts - url = https://forge.etsi.org/rep/LIBS/LibIts.git - branch = devel -[submodule "ttcn/AtsCAM"] - path = ttcn/AtsCAM - url = https://forge.etsi.org/rep/ITS/ttcn/ats_cam_ts102868-3.git - branch = devel -[submodule "ttcn/AtsDENM"] - path = ttcn/AtsDENM - url = https://forge.etsi.org/rep/ITS/ttcn/ats_denm_ts102869-3.git - branch = devel -[submodule "ttcn/AtsGeoNetworking"] - path = ttcn/AtsGeoNetworking - url = https://forge.etsi.org/rep/ITS/ttcn/ats_gn_ts102871-3.git - branch = devel -[submodule "ttcn/AtsBTP"] - path = ttcn/AtsBTP - url = https://forge.etsi.org/rep/ITS/ttcn/ats_btp_ts102870-3.git - branch = devel -[submodule "ttcn/AtsIPv6OverGeoNetworking"] - path = ttcn/AtsIPv6OverGeoNetworking - url = https://forge.etsi.org/rep/ITS/ttcn/ats_gnipv6_ts102859-3.git - branch = devel -[submodule "ttcn/AtsPki"] - path = ttcn/AtsPki - url = https://forge.etsi.org/rep/ITS/ttcn/ats_pki_ts103525-3.git - branch = devel -[submodule "ttcn/AtsIS"] - path = ttcn/AtsIS - url = https://forge.etsi.org/rep/ITS/ttcn/ats_ts103191-3.git - branch = devel -[submodule "ttcn/AtsSecurity"] - path = ttcn/AtsSecurity - url = https://forge.etsi.org/rep/ITS/ttcn/ats_sec_ts103096-3.git - branch = devel -[submodule "ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module"] - path = ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module - url = https://github.com/eclipse/titan.TestPorts.Common_Components.Abstract_Socket.git +[submodule "ttcn/LibCommon"] + path = ttcn/LibCommon + url = https://forge.etsi.org/rep/LIBS/LibCommon.git +[submodule "ttcn/LibIts"] + path = ttcn/LibIts + url = https://forge.etsi.org/rep/LIBS/LibIts.git + branch = devel2 +[submodule "ttcn/AtsCAM"] + path = ttcn/AtsCAM + url = https://forge.etsi.org/rep/ITS/ttcn/ats_cam_ts102868-3.git + branch = devel +[submodule "ttcn/AtsDENM"] + path = ttcn/AtsDENM + url = https://forge.etsi.org/rep/ITS/ttcn/ats_denm_ts102869-3.git + branch = devel +[submodule "ttcn/AtsGeoNetworking"] + path = ttcn/AtsGeoNetworking + url = https://forge.etsi.org/rep/ITS/ttcn/ats_gn_ts102871-3.git + branch = devel +[submodule "ttcn/AtsBTP"] + path = ttcn/AtsBTP + url = https://forge.etsi.org/rep/ITS/ttcn/ats_btp_ts102870-3.git + branch = devel +[submodule "ttcn/AtsIPv6OverGeoNetworking"] + path = ttcn/AtsIPv6OverGeoNetworking + url = https://forge.etsi.org/rep/ITS/ttcn/ats_gnipv6_ts102859-3.git + branch = devel +[submodule "ttcn/AtsPki"] + path = ttcn/AtsPki + url = https://forge.etsi.org/rep/ITS/ttcn/ats_pki_ts103525-3.git + branch = devel +[submodule "ttcn/AtsIS"] + path = ttcn/AtsIS + url = https://forge.etsi.org/rep/ITS/ttcn/ats_ts103191-3.git + branch = devel +[submodule "ttcn/AtsSecurity"] + path = ttcn/AtsSecurity + url = https://forge.etsi.org/rep/ITS/ttcn/ats_sec_ts103096-3.git + branch = devel +[submodule "ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module"] + path = ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module + url = https://github.com/eclipse/titan.TestPorts.Common_Components.Abstract_Socket.git [submodule "titan-test-system-framework"] path = titan-test-system-framework url = https://labs.etsi.org/rep/cti-tools/titan-test-system-framework.git -- GitLab From 5fd90c311b028fdb29f9c2789db020f6b98e8ef2 Mon Sep 17 00:00:00 2001 From: Yann Garcia Date: Mon, 20 Feb 2023 14:33:33 +0000 Subject: [PATCH 041/178] Create release2 branch (devel2) in AtsCAM --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 3aa4088..9be091e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,7 +8,7 @@ [submodule "ttcn/AtsCAM"] path = ttcn/AtsCAM url = https://forge.etsi.org/rep/ITS/ttcn/ats_cam_ts102868-3.git - branch = devel + branch = devel2 [submodule "ttcn/AtsDENM"] path = ttcn/AtsDENM url = https://forge.etsi.org/rep/ITS/ttcn/ats_denm_ts102869-3.git -- GitLab From fddaf0a1e4de7b22af7a4797e7f3526f1df854bc Mon Sep 17 00:00:00 2001 From: Yann Garcia Date: Tue, 21 Feb 2023 12:28:14 +0000 Subject: [PATCH 042/178] Create release2 branch (devel2) in AtsDENM --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 9be091e..c58f39f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,7 +12,7 @@ [submodule "ttcn/AtsDENM"] path = ttcn/AtsDENM url = https://forge.etsi.org/rep/ITS/ttcn/ats_denm_ts102869-3.git - branch = devel + branch = devel2 [submodule "ttcn/AtsGeoNetworking"] path = ttcn/AtsGeoNetworking url = https://forge.etsi.org/rep/ITS/ttcn/ats_gn_ts102871-3.git -- GitLab From d3e9061232911c2a390320a4951ecb00bbd64186 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Tue, 21 Feb 2023 13:36:34 +0100 Subject: [PATCH 043/178] Build AtsCAM Release.2 --- Makefile | 14 +- ccsrc/Asn1c/asn1_recoder.cc | 4 +- ccsrc/Externals/LibItsSecurity_externals.cc | 26 +- .../GeoNetworking/geonetworking_layer.cc | 10 +- ccsrc/Protocols/Security/hmac.cc | 54 -- ccsrc/Protocols/Security/hmac.hh | 69 --- .../Security/http_etsi_ieee1609dot2_codec.cc | 2 +- ccsrc/Protocols/Security/module.mk | 13 +- ...y_services.cc => security_services_its.cc} | 544 +++++++++--------- ...y_services.hh => security_services_its.hh} | 16 +- ccsrc/Protocols/Security/sha256.cc | 39 -- ccsrc/Protocols/Security/sha256.hh | 66 --- ccsrc/Protocols/Security/sha384.cc | 49 -- ccsrc/Protocols/Security/sha384.hh | 60 -- config.mk | 21 +- libasn1.mk | 238 ++++---- titan-test-system-framework | 2 +- ttcn/AtsCAM | 2 +- ttcn/AtsDENM | 2 +- ttcn/AtsMBR | 2 +- ttcn/AtsPki | 2 +- ttcn/LibCommon | 2 +- ttcn/LibIts | 2 +- 23 files changed, 453 insertions(+), 786 deletions(-) delete mode 100644 ccsrc/Protocols/Security/hmac.cc delete mode 100644 ccsrc/Protocols/Security/hmac.hh rename ccsrc/Protocols/Security/{security_services.cc => security_services_its.cc} (64%) rename ccsrc/Protocols/Security/{security_services.hh => security_services_its.hh} (95%) delete mode 100644 ccsrc/Protocols/Security/sha256.cc delete mode 100644 ccsrc/Protocols/Security/sha256.hh delete mode 100644 ccsrc/Protocols/Security/sha384.cc delete mode 100644 ccsrc/Protocols/Security/sha384.hh diff --git a/Makefile b/Makefile index 8a8343b..884c1bf 100644 --- a/Makefile +++ b/Makefile @@ -29,9 +29,9 @@ undefine sources undefine modules undefine includes include $(1)/module.mk -$$(foreach S, $$(sources), $$(eval all_sources += $$(if $$(filter /%, $$(S)), $$(TOPDIR)/$$(S), $(1)/$$(S)))) -$$(foreach I, $$(includes), $$(eval all_includes += $$(if $$(filter /%, $$(I)), $$(TOPDIR)/$$(I), $(1)/$$(I)))) -$$(foreach M, $$(modules), $$(eval $$(call IncludeModule, $$(if $$(filter /%, $$(M)), $$(TOPDIR)/$$(M), $(1)/$$(M))))) +$$(foreach S, $$(sources), $$(eval all_sources += $$(if $$(filter /%, $$(S)), $$(TOPDIR)$$(S), $(1)/$$(S)))) +$$(foreach I, $$(includes), $$(eval all_includes += $$(if $$(filter /%, $$(I)), $$(TOPDIR)$$(I), $(1)/$$(I)))) +$$(foreach M, $$(modules), $$(eval $$(call IncludeModule, $$(if $$(filter /%, $$(M)), $$(TOPDIR)$$(M), $(1)/$$(M))))) endef all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src /usr/include/jsoncpp /usr/include/libxml2 @@ -57,9 +57,8 @@ $(eval $(call IncludeModule, $(TOPDIR)/ttcn/$(ATS))) outdir := $(TOPDIR)/build/$(ATS) bindir := $(TOPDIR)/bin -#sources := $(sort $(all_sources)) sources := $(all_sources) -includes := $(outdir) $(outdir)/.. $(outdir)/../asn1 $(all_includes) $(NPCAP_INCLUDE) +includes := $(outdir) $(outdir)/.. $(outdir)/asn1 $(all_includes) $(NPCAP_INCLUDE) ifeq (Windows_NT,$(OS)) EXE=.exe @@ -142,7 +141,7 @@ $(cc_objects) : $(outdir)/%.o : %.cc $(gen_sources): $(outdir)/.generate $(outdir)/.generate: Makefile $(tt_sources) - $(TTCN3_DIR)/bin/compiler -w -d -e -f -g -l -L -R -U none -x -X -o $(outdir) $(tt_sources) + $(TTCN3_DIR)/bin/compiler $(TTCN3_COMPILER_OPTIONS) -o $(outdir) $(tt_sources) touch $@ $(bindir)/libItsAsn.so: $(outdir)/asn1/libItsAsn.so @@ -163,3 +162,6 @@ $(foreach S, $(ttcn_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn, %.cc $(foreach S, $(ttcn3_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn3, %.cc, $(S))): $(S))) $(foreach S, $(asn_sources), $(eval $(outdir)/$(notdir $(patsubst %.asn, %.cc, $(S))): $(S))) $(foreach S, $(asn1_sources), $(eval $(outdir)/$(notdir $(patsubst %.asn1, %.cc, $(S))): $(S))) + +$(asn_sources) $(asn1_sources): + diff --git a/ccsrc/Asn1c/asn1_recoder.cc b/ccsrc/Asn1c/asn1_recoder.cc index 5aa2e8e..ea532a9 100644 --- a/ccsrc/Asn1c/asn1_recoder.cc +++ b/ccsrc/Asn1c/asn1_recoder.cc @@ -42,10 +42,10 @@ int asn1_recoder::per2ber(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf) int asn1_recoder::ber2oer(const asn_TYPE_descriptor_s & td, TTCN_Buffer & buf) { - return recode(td, (int)ATS_XER, (int)ATS_CANONICAL_OER, buf); + return recode(td, (int)ATS_BER, (int)ATS_CANONICAL_OER, buf); } int asn1_recoder::oer2ber(const asn_TYPE_descriptor_s & td, TTCN_Buffer & buf) { - return recodeOer(td, (int)ATS_BASIC_OER, (int)ATS_XER, buf); + return recode(td, (int)ATS_BASIC_OER, (int)ATS_BER, buf); } diff --git a/ccsrc/Externals/LibItsSecurity_externals.cc b/ccsrc/Externals/LibItsSecurity_externals.cc index a5129fa..8e4cddf 100644 --- a/ccsrc/Externals/LibItsSecurity_externals.cc +++ b/ccsrc/Externals/LibItsSecurity_externals.cc @@ -19,7 +19,7 @@ #include "security_ecc.hh" -#include "security_services.hh" +#include "security_services_its.hh" #include "geospacial.hh" @@ -34,7 +34,7 @@ namespace LibItsSecurity__Functions { static std::unique_ptr g(new geospacial); - // FIXME Unify code with security_services + // FIXME Unify code with security_services_its /** * \fn OCTETSTRING fx_hashWithSha256(const OCTETSTRING& p__toBeHashedData); @@ -1373,7 +1373,7 @@ namespace LibItsSecurity__Functions { } params_its params; params.insert(std::pair(std::string("sec_db_path"), str)); - if (security_services::get_instance().setup(params) == -1) { + if (security_services_its::get_instance().setup(params) == -1) { return FALSE; } @@ -1393,12 +1393,12 @@ namespace LibItsSecurity__Functions { const OCTETSTRING private_enc_key = p__private__enc__key.valueof(); const OCTETSTRING public_enc_key_x = p__public__enc__key__x.valueof(); const OCTETSTRING public_enc_key_y = p__public__enc__key__y.valueof(); - result = security_services::get_instance().store_certificate( + result = security_services_its::get_instance().store_certificate( p__cert__id, p__cert, p__private__key, p__public__key__x, p__public__key__y, p__public__key__compressed, p__public__key__compressed__mode, p__hash, p__hash__256, p__hashid8, p__issuer, p__private__enc__key.valueof(), p__public__enc__key__x.valueof(), p__public__enc__key__y.valueof(), p__public__enc__compressed__key.valueof(), p__public__enc__key__compressed__mode.valueof()); } else { - result = security_services::get_instance().store_certificate( + result = security_services_its::get_instance().store_certificate( p__cert__id, p__cert, p__private__key, p__public__key__x, p__public__key__y, p__public__key__compressed, p__public__key__compressed__mode, p__hash, p__hash__256, p__hashid8, p__issuer, OCTETSTRING(0, nullptr), OCTETSTRING(0, nullptr), OCTETSTRING(0, nullptr), OCTETSTRING(0, nullptr), INTEGER(-1)); } @@ -1421,7 +1421,7 @@ namespace LibItsSecurity__Functions { BOOLEAN fx__readCertificate(const CHARSTRING &p__certificateId, OCTETSTRING &p__certificate) { loggers::get_instance().log(">>> fx__readCertificate: '%s'", static_cast(p__certificateId)); - if (security_services::get_instance().read_certificate(p__certificateId, p__certificate) == -1) { + if (security_services_its::get_instance().read_certificate(p__certificateId, p__certificate) == -1) { return FALSE; } @@ -1431,7 +1431,7 @@ namespace LibItsSecurity__Functions { BOOLEAN fx__readCertificateFromDigest(const OCTETSTRING &p__digest, CHARSTRING &p__certificateId) { loggers::get_instance().log_msg(">>> fx__readCertificateFromDigest: ", p__digest); - if (security_services::get_instance().read_certificate_from_digest(p__digest, p__certificateId) == -1) { + if (security_services_its::get_instance().read_certificate_from_digest(p__digest, p__certificateId) == -1) { return FALSE; } loggers::get_instance().log_msg("fx__readCertificateFromDigest: ", p__certificateId); @@ -1442,7 +1442,7 @@ namespace LibItsSecurity__Functions { BOOLEAN fx__readCertificateFromHashedId3(const OCTETSTRING &p__digest, CHARSTRING &p__certificateId) { loggers::get_instance().log_msg(">>> fx__readCertificateFromHashedId3: ", p__digest); - if (security_services::get_instance().read_certificate_from_hashed_id3(p__digest, p__certificateId) == -1) { + if (security_services_its::get_instance().read_certificate_from_hashed_id3(p__digest, p__certificateId) == -1) { return FALSE; } loggers::get_instance().log_msg("fx__readCertificateFromHashedId3: ", p__certificateId); @@ -1459,7 +1459,7 @@ namespace LibItsSecurity__Functions { BOOLEAN fx__readCertificateDigest(const CHARSTRING &p__certificateId, OCTETSTRING &p__digest) { loggers::get_instance().log(">>> fx__readCertificateDigest: '%s'", static_cast(p__certificateId)); - if (security_services::get_instance().read_certificate_digest(p__certificateId, p__digest) == -1) { + if (security_services_its::get_instance().read_certificate_digest(p__certificateId, p__digest) == -1) { return FALSE; } @@ -1475,7 +1475,7 @@ namespace LibItsSecurity__Functions { BOOLEAN fx__readCertificateHash(const CHARSTRING &p__certificateId, OCTETSTRING &p__hash) { loggers::get_instance().log(">>> fx__readCertificateHash: '%s'", static_cast(p__certificateId)); - if (security_services::get_instance().read_certificate_hash(p__certificateId, p__hash) == -1) { + if (security_services_its::get_instance().read_certificate_hash(p__certificateId, p__hash) == -1) { return FALSE; } @@ -1491,7 +1491,7 @@ namespace LibItsSecurity__Functions { BOOLEAN fx__readCertificateHash256(const CHARSTRING &p__certificateId, OCTETSTRING &p__hash) { loggers::get_instance().log(">>> fx__readCertificateHash256: '%s'", static_cast(p__certificateId)); - if (security_services::get_instance().read_certificate_hash_sha_256(p__certificateId, p__hash) == -1) { + if (security_services_its::get_instance().read_certificate_hash_sha_256(p__certificateId, p__hash) == -1) { return FALSE; } @@ -1507,7 +1507,7 @@ namespace LibItsSecurity__Functions { BOOLEAN fx__readSigningKey(const CHARSTRING &p__certificateId, OCTETSTRING &p__signingPrivateKey) { loggers::get_instance().log(">>> fx__readSigningKey: '%s'", static_cast(p__certificateId)); - if (security_services::get_instance().read_private_key(p__certificateId, p__signingPrivateKey) == -1) { + if (security_services_its::get_instance().read_private_key(p__certificateId, p__signingPrivateKey) == -1) { return FALSE; } @@ -1524,7 +1524,7 @@ namespace LibItsSecurity__Functions { BOOLEAN fx__readEncryptingKey(const CHARSTRING &p__certificateId, OCTETSTRING &p__encryptingPrivateKey) { loggers::get_instance().log(">>> fx__readSigningKey: '%s'", static_cast(p__certificateId)); - if (security_services::get_instance().read_private_enc_key(p__certificateId, p__encryptingPrivateKey) == -1) { + if (security_services_its::get_instance().read_private_enc_key(p__certificateId, p__encryptingPrivateKey) == -1) { return FALSE; } diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc index a502b75..1519692 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc @@ -9,7 +9,7 @@ #include "loggers.hh" -#include "security_services.hh" +#include "security_services_its.hh" #include "base_time.hh" @@ -253,7 +253,7 @@ void geonetworking_layer::receive_data(OCTETSTRING &data, params &p_params) { } return; } else { - if (security_services::get_instance().verify_and_extract_gn_payload(secured_data, _enable_security_checks, ieee_1609dot2_data, unsecured_gn_payload, + if (security_services_its::get_instance().verify_and_extract_gn_payload(secured_data, _enable_security_checks, ieee_1609dot2_data, unsecured_gn_payload, params) != 0) { loggers::get_instance().warning("geonetworking_layer::receive_data: Security error"); if (_enable_security_checks) { @@ -882,7 +882,7 @@ int geonetworking_layer::build_secured_pdu(OCTETSTRING &data, params_its ¶ms basic_header.nextHeader() = BasicNextHeader::e__securedPacket; OCTETSTRING unsecured_gn_payload = OCTETSTRING(data.lengthof() - basic_header_len, static_cast(data) + basic_header_len); OCTETSTRING secured_gn_payload; - if (security_services::get_instance().secure_gn_payload(unsecured_gn_payload, secured_gn_payload, params) != 0) { + if (security_services_its::get_instance().secure_gn_payload(unsecured_gn_payload, secured_gn_payload, params) != 0) { loggers::get_instance().warning("geonetworking_layer::build_secured_pdu: failed to build secured pdu"); return -1; } @@ -935,8 +935,8 @@ int geonetworking_layer::setup_secured_mode() { _params.insert(std::pair(std::string("hash"), "SHA-256")); } // Set up security services even if secured_mode is set to 0. Later, we can receive an AcEnableSecurity request, the sertificate caching will be ready to go - security_services::get_instance().setup(_params); - security_services::get_instance().set_position(_latitude, _longitude); + security_services_its::get_instance().setup(_params); + security_services_its::get_instance().set_position(_latitude, _longitude); return 0; } diff --git a/ccsrc/Protocols/Security/hmac.cc b/ccsrc/Protocols/Security/hmac.cc deleted file mode 100644 index 0ff7520..0000000 --- a/ccsrc/Protocols/Security/hmac.cc +++ /dev/null @@ -1,54 +0,0 @@ -/*! - * \file hmac.cc - * \brief Source file for HMAC helper methods. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#include - -#include "hmac.hh" - -#include "loggers.hh" - -int hmac::generate(const OCTETSTRING p_buffer, const OCTETSTRING p_secret_key, OCTETSTRING &p_hmac) { - // Sanity check - if (p_buffer.lengthof() == 0) { - return -1; - } - - return generate(static_cast(p_buffer), p_buffer.lengthof(), static_cast(p_secret_key), p_secret_key.lengthof(), - p_hmac); -} - -int hmac::generate(const unsigned char *p_buffer, const size_t p_buffer_length, const unsigned char *p_secret_key, const size_t p_secret_key_length, - OCTETSTRING &p_hmac) { - // Sanity check - if ((p_buffer == nullptr) || (p_secret_key == nullptr)) { - return -1; - } - ::HMAC_CTX_reset(_ctx); - - p_hmac = int2oct(0, EVP_MAX_MD_SIZE); - if (_hash_algorithms == hash_algorithms::sha_256) { - ::HMAC_Init_ex(_ctx, (const void *)p_secret_key, (long unsigned int)p_secret_key_length, EVP_sha256(), NULL); - } else if (_hash_algorithms == hash_algorithms::sha_384) { - ::HMAC_Init_ex(_ctx, (const void *)p_secret_key, (long unsigned int)p_secret_key_length, EVP_sha384(), NULL); - } else { // TODO To be continued - return -1; - } - // Compute the hash value - ::HMAC_Update(_ctx, p_buffer, p_buffer_length); - unsigned int length = p_hmac.lengthof(); - ::HMAC_Final(_ctx, (unsigned char *)static_cast(p_hmac), &length); - loggers::get_instance().log_to_hexa("hmac::generate: ", (unsigned char *)static_cast(p_hmac), length); - // Resize the hmac - if (_hash_algorithms == hash_algorithms::sha_256) { - p_hmac = OCTETSTRING(16, static_cast(p_hmac)); - } // FIXME Check length for the other hash algorithm - - return 0; -} diff --git a/ccsrc/Protocols/Security/hmac.hh b/ccsrc/Protocols/Security/hmac.hh deleted file mode 100644 index 9ae7215..0000000 --- a/ccsrc/Protocols/Security/hmac.hh +++ /dev/null @@ -1,69 +0,0 @@ -/*! - * \file hmac.hh - * \brief Header file for HMAC helper methods. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include - -#include - -class OCTETSTRING; //! TITAN forward declaration - -/*! - * \enum Supported hash algorithms - */ -enum class hash_algorithms : unsigned char { - sha_256, /*!< HMAC with SHA-256 */ - sha_384 /*!< HMAC with SHA-384 */ -}; // End of class hash_algorithms - -/*! - * \class hmac - * \brief This class provides description of HMAC helper methods - */ -class hmac { - HMAC_CTX * _ctx; //! HMAC context - hash_algorithms _hash_algorithms; //! HMAC hash algorithm to use -public: - /*! - * \brief Default constructor - * Create a new instance of the hmac class - * \param[in] p_hash_algorithms The hash algorithm to be used to compute the HMAC. Default: sha_256 - */ - hmac(const hash_algorithms p_hash_algorithms = hash_algorithms::sha_256) : _ctx{::HMAC_CTX_new()}, _hash_algorithms(p_hash_algorithms){}; - /*! - * \brief Default destructor - */ - virtual ~hmac() { - if (_ctx != nullptr) { - ::HMAC_CTX_free(_ctx); - }; - }; - - /*! - * \fn int generate(const OCTETSTRING p_buffer, const OCTETSTRING p_secret_key, OCTETSTRING& p_hmac); - * \brief Generate the HMAC of data using a secret key - * \Param[in] p_buffer The data tobe hashed - * \param[in] p_secret_key The secret key to be used to generate the HMAC - * \param[out] p_hmac The HMAC value based of the provided data - * \return 0 on success, -1 otherwise - */ - int generate(const OCTETSTRING p_buffer, const OCTETSTRING p_secret_key, OCTETSTRING &p_hmac); // TODO Use reference & - - /*! - * \fn int generate(const unsigned char* p_buffer, const size_t p_buffer_length, const unsigned char* p_secret_key, const size_t p_secret_key_length, - * OCTETSTRING& p_hmac); \brief Generate the HMAC of data using a secret key \param[in] p_buffer The data to be hashed \param[in] p_buffer_length The size of - * the data \param[in] p_secret_key The secret key to be used to generate the HMAC \param[in] p_secret_key_length The size of the secret key \param[out] - * p_hmac The HMAC value based of the provided data \return 0 on success, -1 otherwise - */ - int generate(const unsigned char *p_buffer, const size_t p_buffer_length, const unsigned char *p_secret_key, const size_t p_secret_key_length, - OCTETSTRING &p_hmac); - -}; // End of class hmac diff --git a/ccsrc/Protocols/Security/http_etsi_ieee1609dot2_codec.cc b/ccsrc/Protocols/Security/http_etsi_ieee1609dot2_codec.cc index 18b95c2..63ed151 100644 --- a/ccsrc/Protocols/Security/http_etsi_ieee1609dot2_codec.cc +++ b/ccsrc/Protocols/Security/http_etsi_ieee1609dot2_codec.cc @@ -4,7 +4,7 @@ #include "LibHttp_MessageBodyTypes.hh" -#include "security_services.hh" +#include "security_services_its.hh" #include "loggers.hh" diff --git a/ccsrc/Protocols/Security/module.mk b/ccsrc/Protocols/Security/module.mk index d1565ff..762c892 100644 --- a/ccsrc/Protocols/Security/module.mk +++ b/ccsrc/Protocols/Security/module.mk @@ -3,16 +3,18 @@ sources := certificates_loader.cc \ etsi_ts103097_data_codec.cc \ etsi_ts103097_tobesigned_certificate_codec.cc \ etsi_ts103097_tobesigned_data_codec.cc \ - hmac.cc \ ieee_1609dot2_base_types_public_encryption_key.cc \ ieee_1609dot2_base_types_public_verification_key.cc \ security_cache.cc \ security_db.cc \ security_db_record.cc \ security_ecc.cc \ - security_services.cc \ - sha256.cc \ - sha384.cc \ + security_services_its.cc \ + ../../../titan-test-system-framework/ccsrc/security/src/sha1.cc \ + ../../../titan-test-system-framework/ccsrc/security/src/sha256.cc \ + ../../../titan-test-system-framework/ccsrc/security/src/sha384.cc \ + ../../../titan-test-system-framework/ccsrc/security/src/hmac.cc \ + ifeq (AtsPki, $(ATS)) sources += http_etsi_ieee1609dot2_codec.cc \ @@ -44,4 +46,5 @@ sources += http_etsi_ieee1609dot2_codec.cc \ endif -includes := . +includes := . ../../../titan-test-system-framework/ccsrc/security/include + diff --git a/ccsrc/Protocols/Security/security_services.cc b/ccsrc/Protocols/Security/security_services_its.cc similarity index 64% rename from ccsrc/Protocols/Security/security_services.cc rename to ccsrc/Protocols/Security/security_services_its.cc index 438493d..1a6c651 100644 --- a/ccsrc/Protocols/Security/security_services.cc +++ b/ccsrc/Protocols/Security/security_services_its.cc @@ -2,7 +2,7 @@ #include -#include "security_services.hh" +#include "security_services_its.hh" using namespace std; // Required for isnan() #include "etsi_ts103097_certificate_codec.hh" @@ -21,24 +21,24 @@ using namespace std; // Required for isnan() #include "converter.hh" -security_services *security_services::instance = nullptr; +security_services_its *security_services_its::instance = nullptr; -security_services::security_services() +security_services_its::security_services_its() : _setup_done{false}, _ec_keys_enc(nullptr), _security_cache(new security_cache), _security_db(nullptr), _last_generation_time(0), _unknown_certificate(0, nullptr), _requested_certificate(), _latitude(0), _longitude(0), _elevation(0), _geospacial() { - loggers::get_instance().log(">>> security_services::security_services"); + loggers::get_instance().log(">>> security_services_its::security_services_its"); //_geospacial.load_countries_map("/home/yann/dev/TTF0002_Its/ne-countries-50m.json"); // FIXME Use parameter } // End of ctor -int security_services::setup(params_its &p_params) { // FIXME Rename this method - loggers::get_instance().log(">>> security_services::setup"); +int security_services_its::setup(params_its &p_params) { // FIXME Rename this method + loggers::get_instance().log(">>> security_services_its::setup"); _params = p_params; _params.log(); if (_setup_done) { - loggers::get_instance().warning("security_services::setup: Already done"); + loggers::get_instance().warning("security_services_its::setup: Already done"); return 0; } @@ -46,12 +46,12 @@ int security_services::setup(params_its &p_params) { // FIXME Rename this method try { _security_db.reset(new security_db(_params[params_its::sec_db_path])); if (_security_db.get() == nullptr) { // Memory allocation issue - loggers::get_instance().warning("security_services::setup: _security_db pointer is NULL"); + loggers::get_instance().warning("security_services_its::setup: _security_db pointer is NULL"); return -1; } _setup_done = true; } catch (...) { - loggers::get_instance().error("security_services::setup: Filesystem access error, terminate test suite on TTCN-3 error. Please check user name and paths " + loggers::get_instance().error("security_services_its::setup: Filesystem access error, terminate test suite on TTCN-3 error. Please check user name and paths " "in the test suite configuration file."); return -1; } @@ -67,24 +67,24 @@ int security_services::setup(params_its &p_params) { // FIXME Rename this method } else if (it->second.compare("BP-256")) { _ec_keys_enc.reset(new security_ecc(ec_elliptic_curves::brainpool_p_256_r1)); } else { - loggers::get_instance().warning("security_services::setup: Failed to encode ToBeSignedData"); + loggers::get_instance().warning("security_services_its::setup: Failed to encode ToBeSignedData"); return -1; } return 0; } -int security_services::store_certificate(const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, +int security_services_its::store_certificate(const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, const OCTETSTRING &p_public_key_x, const OCTETSTRING &p_public_key_y, const OCTETSTRING &p_public_comp_key, const INTEGER &p_public_comp_key_mode, const OCTETSTRING &p_hash, const OCTETSTRING &p_hash_sha_256, const OCTETSTRING &p_hashid8, const OCTETSTRING &p_issuer, const OCTETSTRING &p_private_enc_key, const OCTETSTRING &p_public_enc_key_x, const OCTETSTRING &p_public_enc_key_y, const OCTETSTRING &p_public_enc_compressed_key, const INTEGER &p_public_enc_key_compressed_mode) { - loggers::get_instance().log_msg(">>> security_services::store_certificate: ", p_cert_id); + loggers::get_instance().log_msg(">>> security_services_its::store_certificate: ", p_cert_id); // Sanity checks if (_security_db.get() == nullptr) { // Setup not called - loggers::get_instance().warning("security_services::store_certificate: Not initialised"); + loggers::get_instance().warning("security_services_its::store_certificate: Not initialised"); return -1; } return _security_db.get()->store_certificate(p_cert_id, p_cert, p_private_key, p_public_key_x, p_public_key_y, p_public_comp_key, p_public_comp_key_mode, @@ -92,10 +92,10 @@ int security_services::store_certificate(const CHARSTRING &p_cert_id, const OCTE p_public_enc_compressed_key, p_public_enc_key_compressed_mode); } -int security_services::verify_and_extract_gn_payload(const OCTETSTRING &p_secured_gn_payload, const bool p_verify, +int security_services_its::verify_and_extract_gn_payload(const OCTETSTRING &p_secured_gn_payload, const bool p_verify, Ieee1609Dot2::Ieee1609Dot2Data &p_ieee_1609dot2_data, OCTETSTRING &p_unsecured_gn_payload, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::verify_and_extract_gn_payload: ", p_secured_gn_payload); + loggers::get_instance().log_msg(">>> security_services_its::verify_and_extract_gn_payload: ", p_secured_gn_payload); // Sanity checks if (p_secured_gn_payload.lengthof() == 0) { @@ -107,20 +107,20 @@ int security_services::verify_and_extract_gn_payload(const OCTETSTRING &p_secure codec.decode(p_secured_gn_payload, p_ieee_1609dot2_data, &p_params); // Sanity checks if (!p_ieee_1609dot2_data.is_bound()) { - loggers::get_instance().warning("security_services::verify_and_extract_gn_payload: Unbound value, discard it"); + loggers::get_instance().warning("security_services_its::verify_and_extract_gn_payload: Unbound value, discard it"); return -1; } - if (p_verify && ((unsigned int)(int)p_ieee_1609dot2_data.protocolVersion() != security_services::ProtocolVersion)) { - loggers::get_instance().warning("security_services::verify_and_extract_gn_payload: Wrong version protocol, discard it"); + if (p_verify && ((unsigned int)(int)p_ieee_1609dot2_data.protocolVersion() != security_services_its::ProtocolVersion)) { + loggers::get_instance().warning("security_services_its::verify_and_extract_gn_payload: Wrong version protocol, discard it"); return -1; } return process_ieee_1609_dot2_content(p_ieee_1609dot2_data.content(), p_verify, p_unsecured_gn_payload, p_params); } // End of method verify_and_extract_gn_payload -int security_services::process_ieee_1609_dot2_content(const Ieee1609Dot2::Ieee1609Dot2Content &p_ieee_1609_dot2_content, const bool p_verify, +int security_services_its::process_ieee_1609_dot2_content(const Ieee1609Dot2::Ieee1609Dot2Content &p_ieee_1609_dot2_content, const bool p_verify, OCTETSTRING &p_unsecured_payload, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::process_ieee_1609_dot2_content: ", p_ieee_1609_dot2_content); + loggers::get_instance().log_msg(">>> security_services_its::process_ieee_1609_dot2_content: ", p_ieee_1609_dot2_content); if (p_ieee_1609_dot2_content.ischosen(Ieee1609Dot2::Ieee1609Dot2Content::ALT_unsecuredData)) { // Unsecured packet, End of recursivity p_unsecured_payload = p_ieee_1609_dot2_content.unsecuredData(); @@ -137,7 +137,7 @@ int security_services::process_ieee_1609_dot2_content(const Ieee1609Dot2::Ieee16 if (process_ieee_1609_dot2_encrypted_data(encrypted_data, p_verify, signed_payload, p_params) != 0) { return -1; } - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_content: Decrypted payload: ", signed_payload); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_content: Decrypted payload: ", signed_payload); Ieee1609Dot2::Ieee1609Dot2Data ieee_1609dot2_data; // TODO Check if it could be reused if (verify_and_extract_gn_payload(signed_payload, p_verify, ieee_1609dot2_data, p_unsecured_payload, p_params) != 0) { if (p_verify) { @@ -146,29 +146,29 @@ int security_services::process_ieee_1609_dot2_content(const Ieee1609Dot2::Ieee16 } } else if (p_ieee_1609_dot2_content.ischosen(Ieee1609Dot2::Ieee1609Dot2Content::ALT_signedCertificateRequest)) { // Reset certificate timer - loggers::get_instance().log("security_services::process_ieee_1609_dot2_content: Set Certificate re-transmission flag and reset timer"); + loggers::get_instance().log("security_services_its::process_ieee_1609_dot2_content: Set Certificate re-transmission flag and reset timer"); _last_generation_time = 0; return 0; } else { // Shall never be reached - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_content: Undefined IEEE 1609.2 Content, discard it"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_content: Undefined IEEE 1609.2 Content, discard it"); if (p_verify) { return -1; } } - loggers::get_instance().log_msg("<<< security_services::process_ieee_1609_dot2_content: ", p_unsecured_payload); + loggers::get_instance().log_msg("<<< security_services_its::process_ieee_1609_dot2_content: ", p_unsecured_payload); return 0; } // End of method process_ieee_1609_dot2_content -int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::SignedData &p_signed_data, const bool p_verify, OCTETSTRING &p_unsecured_payload, +int security_services_its::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::SignedData &p_signed_data, const bool p_verify, OCTETSTRING &p_unsecured_payload, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::process_ieee_1609_dot2_signed_data: ", p_signed_data); + loggers::get_instance().log_msg(">>> security_services_its::process_ieee_1609_dot2_signed_data: ", p_signed_data); // Check the headerInfo content const Ieee1609Dot2::HeaderInfo &header_info = p_signed_data.tbsData().headerInfo(); p_params[params_its::its_aid] = std::to_string(header_info.psid().get_long_long_val()); if (!header_info.generationTime().is_present()) { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: HeaderInfo::GenerationTime field is missing"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: HeaderInfo::GenerationTime field is missing"); if (p_verify) { return -1; } @@ -177,10 +177,10 @@ int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::Si unsigned long long gt = ((INTEGER &)(*v.get_opt_value())).get_long_long_val(); // Get current time timestamp unsigned long long us = base_time::get_instance().get_its_current_time_us(); // in microsecond - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: generation time check %ld / %ld, delta = %f", gt, us, + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: generation time check %ld / %ld, delta = %f", gt, us, abs((double)gt - (double)us)); if (abs((double)gt - (double)us) >= 5000000.0) { // TODO Use a params for generation_time_epsilon, 5s differences - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: Invalid generation time, discard it"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: Invalid generation time, discard it"); if (p_verify) { return -1; } @@ -189,30 +189,30 @@ int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::Si // Check p2pcdLearningRequest keys if present if (header_info.p2pcdLearningRequest().is_present()) { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: p2pcdLearningRequest not supported yet"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: p2pcdLearningRequest not supported yet"); // TODO Not supported by C-ITS Protocol } // Check missingCrlIdentifier keys if present if (header_info.missingCrlIdentifier().is_present()) { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: missingCrlIdentifier not supported yet"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: missingCrlIdentifier not supported yet"); // TODO Not supported by C-ITS Protocol } // Check encryption keys if present if (header_info.encryptionKey().is_present()) { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: encryptionKey not supported yet"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: encryptionKey not supported yet"); // TODO Not supported by C-ITS Protocol } // Check request certificate if (header_info.inlineP2pcdRequest().is_present()) { - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_signed_data: inlineP2pcdRequest: ", header_info.inlineP2pcdRequest()); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_signed_data: inlineP2pcdRequest: ", header_info.inlineP2pcdRequest()); const Ieee1609Dot2BaseTypes::SequenceOfHashedId3 &s = static_cast(*header_info.inlineP2pcdRequest().get_opt_value()); _requested_certificate.clear(); for (int i = 0; i < s.lengthof(); i++) { - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_signed_data: Add requested certificate= ", s[i]); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_signed_data: Add requested certificate= ", s[i]); _requested_certificate.push_back(s[i]); } // End of 'for' statement } @@ -220,8 +220,8 @@ int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::Si // Check requested certificate if (header_info.requestedCertificate().is_present()) { Ieee1609Dot2::CertificateBase requested_cert = header_info.requestedCertificate(); - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: ", requested_cert); - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: requestedCertificate not supported yet"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: ", requested_cert); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: requestedCertificate not supported yet"); // TODO Not supported by C-ITS Protocol } @@ -230,27 +230,27 @@ int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::Si // Check protocol version const OPTIONAL &v = dynamic_cast &>(p_signed_data.tbsData().payload().data()); - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_signed_data: SignedDataPayload.data=", v); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_signed_data: SignedDataPayload.data=", v); const Ieee1609Dot2::Ieee1609Dot2Data &ieee_1609dot2_data = static_cast(*v.get_opt_value()); - if (p_verify && ((unsigned int)(int)ieee_1609dot2_data.protocolVersion() != security_services::ProtocolVersion)) { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: Wrong version protocol, discard it"); + if (p_verify && ((unsigned int)(int)ieee_1609dot2_data.protocolVersion() != security_services_its::ProtocolVersion)) { + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: Wrong version protocol, discard it"); if (p_verify) { return -1; } } if (process_ieee_1609_dot2_content(ieee_1609dot2_data.content(), p_verify, p_unsecured_payload, p_params) != 0) { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: Failed to process SignedData, discard it"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: Failed to process SignedData, discard it"); if (p_verify) { return -1; } } } else if (p_signed_data.tbsData().payload().extDataHash().is_present()) { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: Unsupported extDataHash, discard it"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: Unsupported extDataHash, discard it"); if (p_verify) { return -1; } } else { // Shall not be reached - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: Unsupported SignedDataPayload, discard it"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: Unsupported SignedDataPayload, discard it"); return -1; } @@ -259,10 +259,10 @@ int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::Si OCTETSTRING os; tbs_data_codec.encode(p_signed_data.tbsData(), os); if (os.lengthof() == 0) { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: Failed to encode ToBeSignedData"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: Failed to encode ToBeSignedData"); return -1; } - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_signed_data: encoded tbs_data=", os); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_signed_data: encoded tbs_data=", os); // Calculate the hash according to the hashId OCTETSTRING hashed_data; if (p_signed_data.hashId() == Ieee1609Dot2BaseTypes::HashAlgorithm::sha256) { @@ -270,14 +270,14 @@ int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::Si } else { hash_sha384(os, hashed_data); } - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_signed_data: hashed_data=", hashed_data); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_signed_data: hashed_data=", hashed_data); // Retrieve certificate identifier - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_signed_data: signer=", p_signed_data.signer()); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_signed_data: signer=", p_signed_data.signer()); std::string certificate_id; int result = -1; if (p_signed_data.signer().ischosen(Ieee1609Dot2::SignerIdentifier::ALT_digest)) { // Retrieve the certificate identifier from digest - loggers::get_instance().log("security_services::process_ieee_1609_dot2_signed_data: Retrieve the certificate identifier from digest"); + loggers::get_instance().log("security_services_its::process_ieee_1609_dot2_signed_data: Retrieve the certificate identifier from digest"); result = _security_db.get()->get_certificate_id(p_signed_data.signer().digest(), certificate_id); if (result == -1) { // Check in the cache @@ -285,11 +285,11 @@ int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::Si // Unknown certificate, request it const OCTETSTRING &os = p_signed_data.signer().digest(); _unknown_certificate = OCTETSTRING(3, static_cast(os) + os.lengthof() - 3); - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: Unknown certificate, request it"); - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_signed_data: HashedId3: ", _unknown_certificate); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: Unknown certificate, request it"); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_signed_data: HashedId3: ", _unknown_certificate); } // Reset certificate timer - loggers::get_instance().log("security_services::process_ieee_1609_dot2_signed_data: Set Certificate re-transmission flag and reset timer"); + loggers::get_instance().log("security_services_its::process_ieee_1609_dot2_signed_data: Set Certificate re-transmission flag and reset timer"); _last_generation_time = 0; return -1; @@ -303,14 +303,14 @@ int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::Si OPTIONAL &v = cert.toBeSigned().appPermissions(); if (v.is_present()) { Ieee1609Dot2BaseTypes::SequenceOfPsidSsp psid_ssps = static_cast(*v.get_opt_value()); - loggers::get_instance().log("security_services::process_ieee_1609_dot2_signed_data: psid_ssps size: %d", psid_ssps.lengthof()); + loggers::get_instance().log("security_services_its::process_ieee_1609_dot2_signed_data: psid_ssps size: %d", psid_ssps.lengthof()); for (int i = 0; i < psid_ssps.lengthof(); i++) { const Ieee1609Dot2BaseTypes::PsidSsp &psid_ssp = psid_ssps[i]; - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_signed_data: Processing psid_ssp ", psid_ssp); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_signed_data: Processing psid_ssp ", psid_ssp); const OPTIONAL &s = psid_ssp.ssp(); if (s.is_present()) { const Ieee1609Dot2BaseTypes::ServiceSpecificPermissions &ssp = static_cast(s); - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_signed_data: Processing ssp ", ssp); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_signed_data: Processing ssp ", ssp); params_its::const_iterator it = p_params.find(std::to_string(psid_ssp.psid())); if (it == p_params.cend()) { OCTETSTRING os; @@ -327,25 +327,25 @@ int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::Si std::string certificate_id; if (extract_and_store_certificate(cert, certificate_id) != 0) { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: Failed to store certificate"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: Failed to store certificate"); if (p_verify) { return -1; } } - loggers::get_instance().log("security_services::process_ieee_1609_dot2_signed_data: certificate_id: '%s'", certificate_id.c_str()); + loggers::get_instance().log("security_services_its::process_ieee_1609_dot2_signed_data: certificate_id: '%s'", certificate_id.c_str()); certificate_ids.push_back(certificate_id); - loggers::get_instance().log("security_services::process_ieee_1609_dot2_signed_data: certificate_ids size: %d", certificate_ids.size()); + loggers::get_instance().log("security_services_its::process_ieee_1609_dot2_signed_data: certificate_ids size: %d", certificate_ids.size()); } // End of 'for' statement certificate_id = certificate_ids[0]; - loggers::get_instance().log("security_services::process_ieee_1609_dot2_signed_data: After extract_and_store_certificate, certificate_id: '%s'", + loggers::get_instance().log("security_services_its::process_ieee_1609_dot2_signed_data: After extract_and_store_certificate, certificate_id: '%s'", certificate_id.c_str()); } else { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: Unsupported SignerIdentifier"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: Unsupported SignerIdentifier"); return -1; } - loggers::get_instance().log("security_services::process_ieee_1609_dot2_signed_data: certificate id = '%s'", certificate_id.c_str()); + loggers::get_instance().log("security_services_its::process_ieee_1609_dot2_signed_data: certificate id = '%s'", certificate_id.c_str()); // Verify the signature of the ToBeSignedData - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_signed_data: signature=", p_signed_data.signature__()); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_signed_data: signature=", p_signed_data.signature__()); result = -1; if (p_signed_data.signature__().ischosen(Ieee1609Dot2BaseTypes::Signature::ALT_ecdsaNistP256Signature)) { result = verify_sign_ecdsa_nistp256(hashed_data, p_signed_data.signature__(), certificate_id, p_params); @@ -355,20 +355,20 @@ int security_services::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2::Si result = verify_sign_ecdsa_brainpoolp384r1(hashed_data, p_signed_data.signature__(), certificate_id, p_params); } else { // TODO - loggers::get_instance().error("security_services::process_ieee_1609_dot2_signed_data: TODO"); + loggers::get_instance().error("security_services_its::process_ieee_1609_dot2_signed_data: TODO"); } if (result != 0) { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: Failed to verify signature"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: Failed to verify signature"); return -1; } - loggers::get_instance().log_msg("<<< security_services::process_ieee_1609_dot2_signed_data: ", p_unsecured_payload); + loggers::get_instance().log_msg("<<< security_services_its::process_ieee_1609_dot2_signed_data: ", p_unsecured_payload); return 0; } // End of method process_ieee_1609_dot2_signed_data -int security_services::process_ieee_1609_dot2_encrypted_data(const Ieee1609Dot2::EncryptedData &p_encrypted_data, const bool p_verify, +int security_services_its::process_ieee_1609_dot2_encrypted_data(const Ieee1609Dot2::EncryptedData &p_encrypted_data, const bool p_verify, OCTETSTRING &p_unsecured_payload, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::process_ieee_1609_dot2_encrypted_data: ", p_encrypted_data); + loggers::get_instance().log_msg(">>> security_services_its::process_ieee_1609_dot2_encrypted_data: ", p_encrypted_data); // 1. Retrieve the RecipientId const Ieee1609Dot2::RecipientInfo & r = p_encrypted_data.recipients()[0]; // TODO Add multiple support of recipients @@ -381,7 +381,7 @@ int security_services::process_ieee_1609_dot2_encrypted_data(const Ieee1609Dot2: } else if (r.certRecipInfo().encKey().ischosen(Ieee1609Dot2::EncryptedDataEncryptionKey::ALT_eciesBrainpoolP256r1)) { ecies = &r.certRecipInfo().encKey().eciesBrainpoolP256r1(); } else { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_encrypted_data: Unsupported encryption algorithm"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_encrypted_data: Unsupported encryption algorithm"); return -1; } } else if (r.ischosen(Ieee1609Dot2::RecipientInfo::ALT_signedDataRecipInfo)) { @@ -391,43 +391,43 @@ int security_services::process_ieee_1609_dot2_encrypted_data(const Ieee1609Dot2: } else if (r.signedDataRecipInfo().encKey().ischosen(Ieee1609Dot2::EncryptedDataEncryptionKey::ALT_eciesBrainpoolP256r1)) { ecies = &r.signedDataRecipInfo().encKey().eciesBrainpoolP256r1(); } else { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_encrypted_data: Unsupported encryption algorithm"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_encrypted_data: Unsupported encryption algorithm"); return -1; } } else { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_encrypted_data: Unsupported RecipientInfo variant"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_encrypted_data: Unsupported RecipientInfo variant"); return -1; } if (!p_encrypted_data.ciphertext().ischosen(Ieee1609Dot2::SymmetricCiphertext::ALT_aes128ccm)) { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_encrypted_data: Unsupported AES 128 algorithm"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_encrypted_data: Unsupported AES 128 algorithm"); return -1; } - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_encrypted_data: RecipientId= ", *recipient_id); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_encrypted_data: RecipientId= ", *recipient_id); // 2. Retrieve the certificate if present std::string certificate_id; OCTETSTRING p_enc_key; // The private encryption key if (_security_db.get()->get_certificate_id(*recipient_id, certificate_id) == -1) { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_encrypted_data: Unknown certificate"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_encrypted_data: Unknown certificate"); // Check if RecipientId is the hashed_id8 of the symetric AES keys - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_encrypted_data: AES Symmetric Keys= ", ecies->c()); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_encrypted_data: AES Symmetric Keys= ", ecies->c()); OCTETSTRING hashed_data; hash_sha256(ecies->c(), hashed_data); - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_encrypted_data: Hash (AES Symmetric Keys)= ", hashed_data); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_encrypted_data: Hash (AES Symmetric Keys)= ", hashed_data); if (substr(hashed_data, hashed_data.lengthof() - 8, 8) != *recipient_id) { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_encrypted_data: RecipientId does not match HashedId8 of the symmetric key"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_encrypted_data: RecipientId does not match HashedId8 of the symmetric key"); return -1; } else { if (_security_db.get()->get_private_enc_key(p_params[params_its::certificate], p_enc_key) == -1) { loggers::get_instance().warning( - "security_services::process_ieee_1609_dot2_encrypted_data: Failed to retrieve private encryption key for certificate %s", + "security_services_its::process_ieee_1609_dot2_encrypted_data: Failed to retrieve private encryption key for certificate %s", p_params[params_its::certificate].c_str()); return -1; } } } else { if (_security_db.get()->get_private_enc_key(certificate_id, p_enc_key) == -1) { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_encrypted_data: Failed to retrieve private encryption key"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_encrypted_data: Failed to retrieve private encryption key"); return -1; } } @@ -447,55 +447,55 @@ int security_services::process_ieee_1609_dot2_encrypted_data(const Ieee1609Dot2: result = ec.generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), ecies->c(), p_encrypted_data.ciphertext().aes128ccm().nonce(), ecies->t(), OCTETSTRING(0, nullptr)); } else { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_encrypted_data: Failed to decode Decrypt Ieee1609Dot2Data-Encrypted"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_encrypted_data: Failed to decode Decrypt Ieee1609Dot2Data-Encrypted"); return -1; } if (result == -1) { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_encrypted_data: Failed to generate shared secret"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_encrypted_data: Failed to generate shared secret"); return -1; } // 4. Decrypt the message OCTETSTRING enc_message(p_encrypted_data.ciphertext().aes128ccm().ccmCiphertext().lengthof() - ec.tag().lengthof(), static_cast(p_encrypted_data.ciphertext().aes128ccm().ccmCiphertext())); - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_encrypted_data: enc_message: ", enc_message); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_encrypted_data: enc_message: ", enc_message); OCTETSTRING tag(ec.tag().lengthof(), enc_message.lengthof() + static_cast(p_encrypted_data.ciphertext().aes128ccm().ccmCiphertext())); - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_encrypted_data: tag: ", tag); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_encrypted_data: tag: ", tag); if (ec.decrypt(tag, enc_message, p_unsecured_payload) == -1) { - loggers::get_instance().warning("security_services::process_ieee_1609_dot2_encrypted_data: Failed to generate shared secret"); + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_encrypted_data: Failed to generate shared secret"); return -1; } - loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_encrypted_data: ", p_unsecured_payload); + loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_encrypted_data: ", p_unsecured_payload); return 0; } // End of method process_ieee_1609_dot2_encrypted_data -int security_services::secure_gn_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_secured_gn_payload, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::secure_gn_payload: ", p_unsecured_gn_payload); +int security_services_its::secure_gn_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_secured_gn_payload, params_its &p_params) { + loggers::get_instance().log_msg(">>> security_services_its::secure_gn_payload: ", p_unsecured_gn_payload); p_params.log(); OCTETSTRING signed_payload; if (sign_payload(p_unsecured_gn_payload, signed_payload, p_params) != 0) { p_secured_gn_payload = p_unsecured_gn_payload; - loggers::get_instance().warning("security_services::secure_gn_payload: Failed to signed payload"); + loggers::get_instance().warning("security_services_its::secure_gn_payload: Failed to signed payload"); return -1; } if (_params[params_its::encrypted_mode].compare("1") == 0) { if (encrypt_gn_payload(signed_payload, p_secured_gn_payload, p_params) != 0) { p_secured_gn_payload = signed_payload; - loggers::get_instance().warning("security_services::secure_gn_payload: Failed to encrypt payload"); + loggers::get_instance().warning("security_services_its::secure_gn_payload: Failed to encrypt payload"); return -1; } } else { // No encryption required - loggers::get_instance().log("security_services::secure_gn_payload: Encryption mode not set"); + loggers::get_instance().log("security_services_its::secure_gn_payload: Encryption mode not set"); p_secured_gn_payload = signed_payload; } return 0; } -int security_services::sign_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_signed_gn_payload, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::sign_payload: ", p_unsecured_gn_payload); +int security_services_its::sign_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_signed_gn_payload, params_its &p_params) { + loggers::get_instance().log_msg(">>> security_services_its::sign_payload: ", p_unsecured_gn_payload); // Set unsecured data Ieee1609Dot2::Ieee1609Dot2Content unsecured_data_content; @@ -524,7 +524,7 @@ int security_services::sign_payload(const OCTETSTRING &p_unsecured_gn_payload, O // Mandatory for DENM payload OPTIONAL location(Ieee1609Dot2BaseTypes::ThreeDLocation(_latitude, _longitude, _elevation)); header_info.generationLocation() = location; - loggers::get_instance().log_msg("security_services::sign_payload: generationLocation: ", header_info.generationLocation()); + loggers::get_instance().log_msg("security_services_its::sign_payload: generationLocation: ", header_info.generationLocation()); } else { header_info.generationLocation().set_to_omit(); } @@ -538,27 +538,27 @@ int security_services::sign_payload(const OCTETSTRING &p_unsecured_gn_payload, O } it = p_params.find(params_its::payload_type); if (it != p_params.cend()) { - loggers::get_instance().log("security_services::sign_payload: Payload type: %s", it->second.c_str()); + loggers::get_instance().log("security_services_its::sign_payload: Payload type: %s", it->second.c_str()); if (it->second.compare("1") == 0) { // DENM OPTIONAL location(Ieee1609Dot2BaseTypes::ThreeDLocation(_latitude, _longitude, _elevation)); - loggers::get_instance().log_msg("security_services::sign_payload: generationLocation: ", location); + loggers::get_instance().log_msg("security_services_its::sign_payload: generationLocation: ", location); header_info.generationLocation() = location; - loggers::get_instance().log_msg("security_services::sign_payload: generationLocation: ", header_info.generationLocation()); + loggers::get_instance().log_msg("security_services_its::sign_payload: generationLocation: ", header_info.generationLocation()); } else if (it->second.compare("2") == 0) { // CAM // Noting to do } else { // Noting to do } } else { // Process it as a GeoNetworking payload - loggers::get_instance().log("security_services::sign_payload: Payload type not set"); + loggers::get_instance().log("security_services_its::sign_payload: Payload type not set"); // Noting to do } unsigned long long us = base_time::get_instance().get_its_current_time_us(); - loggers::get_instance().log("security_services::sign_payload: HeaderInfo timestamp: %ld", us); + loggers::get_instance().log("security_services_its::sign_payload: HeaderInfo timestamp: %ld", us); INTEGER i; i.set_long_long_val(us); header_info.generationTime() = OPTIONAL(i); - loggers::get_instance().log("security_services::sign_payload: Final HeaderInfo timestamp: %ld", us); + loggers::get_instance().log("security_services_its::sign_payload: Final HeaderInfo timestamp: %ld", us); // Check if a certificate shall be requested if (_unknown_certificate.lengthof() == 3) { // HashedId3 of a requested certificate Ieee1609Dot2BaseTypes::SequenceOfHashedId3 s; @@ -583,93 +583,93 @@ int security_services::sign_payload(const OCTETSTRING &p_unsecured_gn_payload, O Ieee1609Dot2::ToBeSignedData tbs_data; tbs_data.payload() = payload; tbs_data.headerInfo() = header_info; - loggers::get_instance().log_msg("security_services::sign_payload: tbs_data=", tbs_data); + loggers::get_instance().log_msg("security_services_its::sign_payload: tbs_data=", tbs_data); // Sign the ToBeSignedData data structure Ieee1609Dot2BaseTypes::Signature signature; if (sign_tbs_data(tbs_data, hashId, signature, p_params) != 0) { - loggers::get_instance().warning("security_services::sign_payload: Failed to secure payload"); + loggers::get_instance().warning("security_services_its::sign_payload: Failed to secure payload"); return -1; } Ieee1609Dot2::SignerIdentifier signer; - loggers::get_instance().log("security_services::sign_payload: us = %ld - _last_generation_time = %ld - us - _last_generation_time = %ld", us, + loggers::get_instance().log("security_services_its::sign_payload: us = %ld - _last_generation_time = %ld - us - _last_generation_time = %ld", us, _last_generation_time, us - _last_generation_time); std::string certificate_id = p_params[params_its::certificate]; - loggers::get_instance().log("security_services::sign_payload: certificate_id = %s", certificate_id.c_str()); + loggers::get_instance().log("security_services_its::sign_payload: certificate_id = %s", certificate_id.c_str()); if (((unsigned int)(us - _last_generation_time) >= 1000000 * 0.95) || force_certificate) { // Need to add certificate every 1s - loggers::get_instance().log("security_services::sign_payload: Need to add certificate"); + loggers::get_instance().log("security_services_its::sign_payload: Need to add certificate"); Ieee1609Dot2::CertificateBase cert; if (_security_db->get_certificate(certificate_id, cert) != 0) { - loggers::get_instance().warning("security_services:sign_payload: Failed to secure payload"); + loggers::get_instance().warning("security_services_its:sign_payload: Failed to secure payload"); return -1; } - loggers::get_instance().log_msg("security_services::sign_payload: cert= ", cert); + loggers::get_instance().log_msg("security_services_its::sign_payload: cert= ", cert); Ieee1609Dot2::SequenceOfCertificate sequenceOfCertificate; sequenceOfCertificate[0] = cert; signer.certificate() = sequenceOfCertificate; // Reset send certificate timer _last_generation_time = us; - loggers::get_instance().log("security_services::sign_payload: Reset send certificate timer, signer= ", signer); + loggers::get_instance().log("security_services_its::sign_payload: Reset send certificate timer, signer= ", signer); } else { - loggers::get_instance().log("security_services::sign_payload: Add digest"); + loggers::get_instance().log("security_services_its::sign_payload: Add digest"); OCTETSTRING digest; if (_security_db->get_hashed_id(certificate_id, digest) != 0) { - loggers::get_instance().warning("security_services::sign_payload: Failed to secure payload"); + loggers::get_instance().warning("security_services_its::sign_payload: Failed to secure payload"); return -1; } signer.digest() = digest; } Ieee1609Dot2::SignedData signed_data(hashId, tbs_data, signer, signature); - loggers::get_instance().log_msg("security_services::sign_payload: signed_data=", signed_data); + loggers::get_instance().log_msg("security_services_its::sign_payload: signed_data=", signed_data); Ieee1609Dot2::Ieee1609Dot2Content ieee_dot2_content; ieee_dot2_content.signedData() = signed_data; - Ieee1609Dot2::Ieee1609Dot2Data ieee_1609dot2_data(security_services::ProtocolVersion, ieee_dot2_content); - loggers::get_instance().log_msg("security_services::sign_payload: ieee_1609dot2_data=", ieee_1609dot2_data); + Ieee1609Dot2::Ieee1609Dot2Data ieee_1609dot2_data(security_services_its::ProtocolVersion, ieee_dot2_content); + loggers::get_instance().log_msg("security_services_its::sign_payload: ieee_1609dot2_data=", ieee_1609dot2_data); etsi_ts103097_data_codec codec; codec.encode(ieee_1609dot2_data, p_signed_gn_payload); if (!p_signed_gn_payload.is_bound()) { - loggers::get_instance().warning("security_services::sign_payload: Failed to encode Ieee1609Dot2Data"); + loggers::get_instance().warning("security_services_its::sign_payload: Failed to encode Ieee1609Dot2Data"); return -1; } return 0; } -int security_services::encrypt_gn_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_enc_gn_payload, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::encrypt_gn_payload: ", p_unsecured_gn_payload); +int security_services_its::encrypt_gn_payload(const OCTETSTRING &p_unsecured_gn_payload, OCTETSTRING &p_enc_gn_payload, params_its &p_params) { + loggers::get_instance().log_msg(">>> security_services_its::encrypt_gn_payload: ", p_unsecured_gn_payload); // Sanity checks if (_ec_keys_enc.get() == nullptr) { - loggers::get_instance().warning("security_services::encrypt_gn_payload: Encryption not initialised"); + loggers::get_instance().warning("security_services_its::encrypt_gn_payload: Encryption not initialised"); return -1; } params_its::const_iterator it = p_params.find(params_its::peer_certificate); if (it == p_params.cend()) { - loggers::get_instance().warning("security_services::encrypt_gn_payload: Encryption impossible without a peer_certificte indication in parameters"); + loggers::get_instance().warning("security_services_its::encrypt_gn_payload: Encryption impossible without a peer_certificte indication in parameters"); return -1; } std::string certificate_id = it->second; - loggers::get_instance().log("security_services::encrypt_gn_payload: Peer CertificateId=%s", certificate_id.c_str()); + loggers::get_instance().log("security_services_its::encrypt_gn_payload: Peer CertificateId=%s", certificate_id.c_str()); // 1. Retrieve recipient's public keys OCTETSTRING r_public_key_x; OCTETSTRING r_public_key_y; if (_security_db.get()->get_public_enc_keys(certificate_id, r_public_key_x, r_public_key_y) == -1) { - loggers::get_instance().warning("security_services::encrypt_gn_payload: Failed to retrieve recipient's public keys"); + loggers::get_instance().warning("security_services_its::encrypt_gn_payload: Failed to retrieve recipient's public keys"); // TODO Setup request certificate mechanism return -1; } - loggers::get_instance().log_msg("security_services::encrypt_gn_payload: r_public_key_x=", r_public_key_x); - loggers::get_instance().log_msg("security_services::encrypt_gn_payload: r_public_key_y=", r_public_key_y); + loggers::get_instance().log_msg("security_services_its::encrypt_gn_payload: r_public_key_x=", r_public_key_x); + loggers::get_instance().log_msg("security_services_its::encrypt_gn_payload: r_public_key_y=", r_public_key_y); // 2. Generate new Private/Public ephemeral keys if (_ec_keys_enc.get()->generate() == -1) { - loggers::get_instance().warning("security_services::encrypt_gn_payload: Failed to generate ephemeral keys"); + loggers::get_instance().warning("security_services_its::encrypt_gn_payload: Failed to generate ephemeral keys"); return -1; } // 3. Generate and derive shared secret if (_ec_keys_enc.get()->generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, r_public_key_x, r_public_key_y, OCTETSTRING(0, nullptr)) == -1) { - loggers::get_instance().warning("security_services::encrypt_gn_payload: Failed to generate and derive secret key"); + loggers::get_instance().warning("security_services_its::encrypt_gn_payload: Failed to generate and derive secret key"); return -1; } @@ -684,7 +684,7 @@ int security_services::encrypt_gn_payload(const OCTETSTRING &p_unsecured_gn_payl eccP256CurvePoint.uncompressedP256().y() = _ec_keys_enc.get()->public_key_y(); } Ieee1609Dot2BaseTypes::EciesP256EncryptedKey ecies_key(eccP256CurvePoint, _ec_keys_enc.get()->encrypted_symmetric_key(), _ec_keys_enc.get()->tag()); - loggers::get_instance().log_msg("security_services::encrypt_gn_payload: ecies_key=", ecies_key); + loggers::get_instance().log_msg("security_services_its::encrypt_gn_payload: ecies_key=", ecies_key); // 5. AES-128 encryption of the data OCTETSTRING enc_message; @@ -699,7 +699,7 @@ int security_services::encrypt_gn_payload(const OCTETSTRING &p_unsecured_gn_payl // 6. Build SymmetricCiphertext Ieee1609Dot2::SymmetricCiphertext cipher_text; cipher_text.aes128ccm() = aes_128_ccm; - loggers::get_instance().log_msg("security_services::encrypt_gn_payload: aes_128_ccm=", cipher_text); + loggers::get_instance().log_msg("security_services_its::encrypt_gn_payload: aes_128_ccm=", cipher_text); // 7. Build the recipient_id OCTETSTRING recipient_id; @@ -712,7 +712,7 @@ int security_services::encrypt_gn_payload(const OCTETSTRING &p_unsecured_gn_payl } else if (_params[params_its::cypher].compare("BP-256") == 0) { enc_data_key.eciesBrainpoolP256r1() = ecies_key; } - loggers::get_instance().log_msg("security_services::encrypt_gn_payload: enc_data_key=", enc_data_key); + loggers::get_instance().log_msg("security_services_its::encrypt_gn_payload: enc_data_key=", enc_data_key); // 9. Finalise the encryption Ieee1609Dot2::PKRecipientInfo cert_recipient_info(recipient_id, enc_data_key); @@ -721,30 +721,30 @@ int security_services::encrypt_gn_payload(const OCTETSTRING &p_unsecured_gn_payl Ieee1609Dot2::SequenceOfRecipientInfo recipients; recipients[0] = recipient_info; Ieee1609Dot2::EncryptedData encrypted_data(recipients, cipher_text); - loggers::get_instance().log_msg("security_services::encrypt_gn_payload: encrypted_data=", encrypted_data); + loggers::get_instance().log_msg("security_services_its::encrypt_gn_payload: encrypted_data=", encrypted_data); // 10. Encode it Ieee1609Dot2::Ieee1609Dot2Content ieee_dot2_content; ieee_dot2_content.encryptedData() = encrypted_data; - Ieee1609Dot2::Ieee1609Dot2Data ieee_1609dot2_data(security_services::ProtocolVersion, ieee_dot2_content); - loggers::get_instance().log_msg("security_services::encrypt_gn_payload: ieee_1609dot2_data=", ieee_1609dot2_data); + Ieee1609Dot2::Ieee1609Dot2Data ieee_1609dot2_data(security_services_its::ProtocolVersion, ieee_dot2_content); + loggers::get_instance().log_msg("security_services_its::encrypt_gn_payload: ieee_1609dot2_data=", ieee_1609dot2_data); etsi_ts103097_data_codec codec; codec.encode(ieee_1609dot2_data, p_enc_gn_payload); if (!p_enc_gn_payload.is_bound()) { - loggers::get_instance().warning("security_services::encrypt_gn_payload: Failed to encode Ieee1609Dot2Data"); + loggers::get_instance().warning("security_services_its::encrypt_gn_payload: Failed to encode Ieee1609Dot2Data"); return -1; } - loggers::get_instance().log_msg("security_services::encrypt_gn_payload: Encoded ieee_1609dot2_data=", p_enc_gn_payload); + loggers::get_instance().log_msg("security_services_its::encrypt_gn_payload: Encoded ieee_1609dot2_data=", p_enc_gn_payload); return 0; } -int security_services::decrypt_gn_payload(const OCTETSTRING &p_enc_gn_payload, OCTETSTRING &p_unsecured_gn_payload, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::decrypt_gn_payload: ", p_enc_gn_payload); +int security_services_its::decrypt_gn_payload(const OCTETSTRING &p_enc_gn_payload, OCTETSTRING &p_unsecured_gn_payload, params_its &p_params) { + loggers::get_instance().log_msg(">>> security_services_its::decrypt_gn_payload: ", p_enc_gn_payload); // Sanity checks if (_ec_keys_enc.get() == nullptr) { - loggers::get_instance().warning("security_services::decrypt_gn_payload: Encryption not initialised"); + loggers::get_instance().warning("security_services_its::decrypt_gn_payload: Encryption not initialised"); return -1; } @@ -753,38 +753,38 @@ int security_services::decrypt_gn_payload(const OCTETSTRING &p_enc_gn_payload, O etsi_ts103097_data_codec codec; codec.decode(p_enc_gn_payload, ieee_1609dot2_data); if (!ieee_1609dot2_data.is_bound()) { - loggers::get_instance().warning("security_services::decrypt_gn_payload: Failed to decode Ieee1609Dot2Data-Encrypted"); + loggers::get_instance().warning("security_services_its::decrypt_gn_payload: Failed to decode Ieee1609Dot2Data-Encrypted"); return -1; } - loggers::get_instance().log_msg("security_services::decrypt_gn_payload: Ieee1609Dot2Data-Encrypted=", ieee_1609dot2_data); + loggers::get_instance().log_msg("security_services_its::decrypt_gn_payload: Ieee1609Dot2Data-Encrypted=", ieee_1609dot2_data); if (!ieee_1609dot2_data.content().ischosen(Ieee1609Dot2::Ieee1609Dot2Content::ALT_encryptedData)) { - loggers::get_instance().warning("security_services::decrypt_gn_payload: Failed to decode Decrypt Ieee1609Dot2Data-Encrypted"); + loggers::get_instance().warning("security_services_its::decrypt_gn_payload: Failed to decode Decrypt Ieee1609Dot2Data-Encrypted"); return -1; } if (process_ieee_1609_dot2_encrypted_data(ieee_1609dot2_data.content().encryptedData(), true, p_unsecured_gn_payload, p_params) == -1) { - loggers::get_instance().warning("security_services::decrypt_gn_payload: Failed to decode Decrypt Ieee1609Dot2Data-Encrypted"); + loggers::get_instance().warning("security_services_its::decrypt_gn_payload: Failed to decode Decrypt Ieee1609Dot2Data-Encrypted"); return -1; } - loggers::get_instance().log_msg("security_services::decrypt_gn_payload: Encoded ieee_1609dot2_data=", p_unsecured_gn_payload); + loggers::get_instance().log_msg("security_services_its::decrypt_gn_payload: Encoded ieee_1609dot2_data=", p_unsecured_gn_payload); return 0; } -/*int security_services::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_tbs_data, const Ieee1609Dot2BaseTypes::HashAlgorithm &p_hashAlgorithm, +/*int security_services_its::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_tbs_data, const Ieee1609Dot2BaseTypes::HashAlgorithm &p_hashAlgorithm, const OCTETSTRING &p_private_key, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params) { // TODO Refine function - loggers::get_instance().log_msg(">>> security_services::sign_tbs_data: ", p_tbs_data); + loggers::get_instance().log_msg(">>> security_services_its::sign_tbs_data: ", p_tbs_data); // Encode the ToBeSignedData etsi_ts103097_tobesigned_data_codec tbs_data_codec; OCTETSTRING os; tbs_data_codec.encode(p_tbs_data, os); if (os.lengthof() == 0) { - loggers::get_instance().warning("security_services::sign_tbs_data: Failed to encode ToBeSignedData"); + loggers::get_instance().warning("security_services_its::sign_tbs_data: Failed to encode ToBeSignedData"); return -1; } - loggers::get_instance().log_msg("security_services::sign_tbs_data: encoded tbs_data=", os); + loggers::get_instance().log_msg("security_services_its::sign_tbs_data: encoded tbs_data=", os); // Hash ToBeSignedData OCTETSTRING hashed_data; OCTETSTRING hash_issuer; @@ -797,40 +797,40 @@ int security_services::decrypt_gn_payload(const OCTETSTRING &p_enc_gn_payload, O hash.generate(os, hashed_data); hash_issuer = hash.get_sha384_empty_string(); } - loggers::get_instance().log_msg("security_services::sign_tbs_data: encoded hashed_data=", hashed_data); - loggers::get_instance().log_msg("security_services::sign_tbs_data: encoded hashed_issuer=", hash_issuer); + loggers::get_instance().log_msg("security_services_its::sign_tbs_data: encoded hashed_data=", hashed_data); + loggers::get_instance().log_msg("security_services_its::sign_tbs_data: encoded hashed_issuer=", hash_issuer); // Sign ToBeSignedData - loggers::get_instance().log("security_services::sign_tbs_data: encoded params_its::signature = '%s'", + loggers::get_instance().log("security_services_its::sign_tbs_data: encoded params_its::signature = '%s'", p_params[params_its::signature].c_str()); // TODO this parameter is useless, use content of the certificate - loggers::get_instance().log("security_services::sign_tbs_data: encoded params_its::certificate = '%s'", p_params[params_its::certificate].c_str()); + loggers::get_instance().log("security_services_its::sign_tbs_data: encoded params_its::certificate = '%s'", p_params[params_its::certificate].c_str()); if (p_params[params_its::signature].compare("NISTP-256") == 0) { // Hash ( Hash (Data input) || Hash ("") ) OCTETSTRING os = hashed_data + hash_issuer; // Hash (Data input) || Hash (Signer identifier input) - loggers::get_instance().log_msg("security_services::sign_tbs_data: hash: ", os); + loggers::get_instance().log_msg("security_services_its::sign_tbs_data: hash: ", os); OCTETSTRING hashed_data; hash_sha256(os, hashed_data); // Hash ( Hash (Data input) || Hash (Signer identifier input) ) security_ecc k(ec_elliptic_curves::nist_p_256, p_private_key); OCTETSTRING r_sig; OCTETSTRING s_sig; if (k.sign(hashed_data, r_sig, s_sig) != 0) { - loggers::get_instance().warning("security_services::sign_tbs_data: Failed to sign payload"); + loggers::get_instance().warning("security_services_its::sign_tbs_data: Failed to sign payload"); return -1; } Ieee1609Dot2BaseTypes::EccP256CurvePoint ep; ep.x__only() = r_sig; p_signature.ecdsaNistP256Signature() = Ieee1609Dot2BaseTypes::EcdsaP256Signature(ep, s_sig); - loggers::get_instance().log_msg("security_services::sign_tbs_data: signature=", p_signature); + loggers::get_instance().log_msg("security_services_its::sign_tbs_data: signature=", p_signature); } // TODO To be done return 0; }*/ -int security_services::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_tbs_data, const Ieee1609Dot2BaseTypes::HashAlgorithm &p_hashAlgorithm, +int security_services_its::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_tbs_data, const Ieee1609Dot2BaseTypes::HashAlgorithm &p_hashAlgorithm, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::sign_tbs_data: ", p_tbs_data); + loggers::get_instance().log_msg(">>> security_services_its::sign_tbs_data: ", p_tbs_data); // Get certificate - loggers::get_instance().log("security_services::sign_tbs_data: encoded params_its::certificate = '%s'", p_params[params_its::certificate].c_str()); + loggers::get_instance().log("security_services_its::sign_tbs_data: encoded params_its::certificate = '%s'", p_params[params_its::certificate].c_str()); Ieee1609Dot2::CertificateBase decoded_certificate; // Set signature type _security_db.get()->get_certificate(p_params[params_its::certificate], decoded_certificate); @@ -844,24 +844,24 @@ int security_services::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_tbs_d sig.assign("BP-384"); } } - loggers::get_instance().log("security_services::sign_tbs_data: sig = '%s'", sig.c_str()); + loggers::get_instance().log("security_services_its::sign_tbs_data: sig = '%s'", sig.c_str()); params_its::const_iterator it = p_params.find(params_its::signature); if (it == p_params.cend()) { p_params.insert(std::pair(params_its::signature, sig)); } else { p_params[params_its::signature] = sig; } - loggers::get_instance().log("security_services::sign_tbs_data: encoded params_its::signature = '%s'", p_params[params_its::signature].c_str()); + loggers::get_instance().log("security_services_its::sign_tbs_data: encoded params_its::signature = '%s'", p_params[params_its::signature].c_str()); // Encode the ToBeSignedData etsi_ts103097_tobesigned_data_codec tbs_data_codec; OCTETSTRING os; tbs_data_codec.encode(p_tbs_data, os); if (os.lengthof() == 0) { - loggers::get_instance().warning("security_services::sign_tbs_data: Failed to encode ToBeSignedData"); + loggers::get_instance().warning("security_services_its::sign_tbs_data: Failed to encode ToBeSignedData"); return -1; } - loggers::get_instance().log_msg("security_services::sign_tbs_data: encoded tbs_data=", os); + loggers::get_instance().log_msg("security_services_its::sign_tbs_data: encoded tbs_data=", os); // Hash ToBeSignedData OCTETSTRING hashed_data; if (p_hashAlgorithm == Ieee1609Dot2BaseTypes::HashAlgorithm::sha256) { @@ -869,12 +869,12 @@ int security_services::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_tbs_d } else { hash_sha384(os, hashed_data); } - loggers::get_instance().log_msg("security_services::sign_tbs_data: encoded hashed_data=", hashed_data); + loggers::get_instance().log_msg("security_services_its::sign_tbs_data: encoded hashed_data=", hashed_data); // Sign ToBeSignedData int result = -1; - loggers::get_instance().log("security_services::sign_tbs_data: encoded params_its::signature = '%s'", + loggers::get_instance().log("security_services_its::sign_tbs_data: encoded params_its::signature = '%s'", p_params[params_its::signature].c_str()); // TODO this parameter is useless, use content of the certificate - loggers::get_instance().log("security_services::sign_tbs_data: encoded params_its::certificate = '%s'", p_params[params_its::certificate].c_str()); + loggers::get_instance().log("security_services_its::sign_tbs_data: encoded params_its::certificate = '%s'", p_params[params_its::certificate].c_str()); if (p_params[params_its::signature].compare("NISTP-256") == 0) { result = sign_ecdsa_nistp256(hashed_data, p_signature, p_params); } else if (p_params[params_its::signature].compare("NISTP-384") == 0) { @@ -884,128 +884,128 @@ int security_services::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_tbs_d } else if (p_params[params_its::signature].compare("BP-384") == 0) { result = sign_ecdsa_brainpoolp384r1(hashed_data, p_signature, p_params); } else { - loggers::get_instance().error("security_services::sign_tbs_data: Unsupported signature algorithm"); + loggers::get_instance().error("security_services_its::sign_tbs_data: Unsupported signature algorithm"); result = -1; } if (result != 0) { - loggers::get_instance().warning("security_services::sign_tbs_data: Failed to sign payload"); + loggers::get_instance().warning("security_services_its::sign_tbs_data: Failed to sign payload"); return -1; } return 0; } -int security_services::hash_sha256(const OCTETSTRING &p_data, OCTETSTRING &p_hash_data) { - loggers::get_instance().log_msg(">>> security_services::hash_sha256: ", p_data); +int security_services_its::hash_sha256(const OCTETSTRING &p_data, OCTETSTRING &p_hash_data) { + loggers::get_instance().log_msg(">>> security_services_its::hash_sha256: ", p_data); sha256 hash; return hash.generate(p_data, p_hash_data); } -int security_services::hash_sha384(const OCTETSTRING &p_data, OCTETSTRING &p_hash_data) { - loggers::get_instance().log_msg(">>> security_services::hash_sha384: ", p_data); +int security_services_its::hash_sha384(const OCTETSTRING &p_data, OCTETSTRING &p_hash_data) { + loggers::get_instance().log_msg(">>> security_services_its::hash_sha384: ", p_data); sha384 hash; return hash.generate(p_data, p_hash_data); } -int security_services::sign_ecdsa_nistp256(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::sign_ecdsa_nistp256: ", p_hash); +int security_services_its::sign_ecdsa_nistp256(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params) { + loggers::get_instance().log_msg(">>> security_services_its::sign_ecdsa_nistp256: ", p_hash); std::string certificate_id = p_params[params_its::certificate]; - loggers::get_instance().log("security_services::sign_ecdsa_nistp256: encoded certificate_id = '%s'", certificate_id.c_str()); + loggers::get_instance().log("security_services_its::sign_ecdsa_nistp256: encoded certificate_id = '%s'", certificate_id.c_str()); OCTETSTRING pkey; if (_security_db->get_private_key(certificate_id, pkey) != 0) { - loggers::get_instance().warning("security_services::sign_ecdsa_nistp256: Failed to get private key"); + loggers::get_instance().warning("security_services_its::sign_ecdsa_nistp256: Failed to get private key"); return -1; } // Hash ( Hash (Data input) || Hash (Signer identifier input) ) OCTETSTRING hash_cert; if (_security_db->get_hash(certificate_id, hash_cert) != 0) { - loggers::get_instance().warning("security_services::sign_ecdsa_nistp256: Failed to get whole hash certificate"); + loggers::get_instance().warning("security_services_its::sign_ecdsa_nistp256: Failed to get whole hash certificate"); return -1; } - loggers::get_instance().log_msg("security_services::sign_ecdsa_nistp256: hash_issuer: ", hash_cert); + loggers::get_instance().log_msg("security_services_its::sign_ecdsa_nistp256: hash_issuer: ", hash_cert); OCTETSTRING os = p_hash + hash_cert; // Hash (Data input) || Hash (Signer identifier input) - loggers::get_instance().log_msg("security_services::sign_ecdsa_nistp256: hash: ", os); + loggers::get_instance().log_msg("security_services_its::sign_ecdsa_nistp256: hash: ", os); OCTETSTRING hashed_data; hash_sha256(os, hashed_data); // Hash ( Hash (Data input) || Hash (Signer identifier input) ) security_ecc k(ec_elliptic_curves::nist_p_256, pkey); OCTETSTRING r_sig; OCTETSTRING s_sig; if (k.sign(hashed_data, r_sig, s_sig) != 0) { - loggers::get_instance().warning("security_services::sign_ecdsa_nistp256: Failed to sign payload"); + loggers::get_instance().warning("security_services_its::sign_ecdsa_nistp256: Failed to sign payload"); return -1; } Ieee1609Dot2BaseTypes::EccP256CurvePoint ep; ep.x__only() = r_sig; p_signature.ecdsaNistP256Signature() = Ieee1609Dot2BaseTypes::EcdsaP256Signature(ep, s_sig); - loggers::get_instance().log_msg("security_services::sign_ecdsa_nistp256: signature=", p_signature); + loggers::get_instance().log_msg("security_services_its::sign_ecdsa_nistp256: signature=", p_signature); return 0; } -int security_services::sign_ecdsa_nistp384(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::sign_ecdsa_nistp384: ", p_hash); +int security_services_its::sign_ecdsa_nistp384(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params) { + loggers::get_instance().log_msg(">>> security_services_its::sign_ecdsa_nistp384: ", p_hash); std::string certificate_id = p_params[params_its::certificate]; - loggers::get_instance().log("security_services::sign_ecdsa_nistp384: encoded certificate_id = '%s'", certificate_id.c_str()); + loggers::get_instance().log("security_services_its::sign_ecdsa_nistp384: encoded certificate_id = '%s'", certificate_id.c_str()); OCTETSTRING pkey; if (_security_db->get_private_key(certificate_id, pkey) != 0) { - loggers::get_instance().warning("security_services::sign_ecdsa_nistp384: Failed to get private key"); + loggers::get_instance().warning("security_services_its::sign_ecdsa_nistp384: Failed to get private key"); return -1; } // Hash ( Hash (Data input) || Hash (Signer identifier input) ) OCTETSTRING hash_cert; if (_security_db->get_hash(certificate_id, hash_cert) != 0) { - loggers::get_instance().warning("security_services::sign_ecdsa_nistp384: Failed to get whole hash certificate"); + loggers::get_instance().warning("security_services_its::sign_ecdsa_nistp384: Failed to get whole hash certificate"); return -1; } - loggers::get_instance().log_msg("security_services::sign_ecdsa_nistp384: hash_issuer: ", hash_cert); + loggers::get_instance().log_msg("security_services_its::sign_ecdsa_nistp384: hash_issuer: ", hash_cert); OCTETSTRING os = p_hash + hash_cert; // Hash (Data input) || Hash (Signer identifier input) - loggers::get_instance().log_msg("security_services::sign_ecdsa_nistp384: hash: ", os); + loggers::get_instance().log_msg("security_services_its::sign_ecdsa_nistp384: hash: ", os); OCTETSTRING hashed_data; hash_sha384(os, hashed_data); // Hash ( Hash (Data input) || Hash (Signer identifier input) ) security_ecc k(ec_elliptic_curves::nist_p_384, pkey); OCTETSTRING r_sig; OCTETSTRING s_sig; if (k.sign(hashed_data, r_sig, s_sig) != 0) { - loggers::get_instance().warning("security_services::sign_ecdsa_nistp384: Failed to sign payload"); + loggers::get_instance().warning("security_services_its::sign_ecdsa_nistp384: Failed to sign payload"); return -1; } Ieee1609Dot2BaseTypes::EccP384CurvePoint ep; ep.x__only() = r_sig; p_signature.ecdsaNistP384Signature() = Ieee1609Dot2BaseTypes::EcdsaP384Signature(ep, s_sig); - loggers::get_instance().log_msg("security_services::sign_ecdsa_nistp384: signature=", p_signature); + loggers::get_instance().log_msg("security_services_its::sign_ecdsa_nistp384: signature=", p_signature); return 0; } -int security_services::verify_sign_ecdsa_nistp256(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, +int security_services_its::verify_sign_ecdsa_nistp256(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, const std::string &p_certificate_id, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::verify_sign_ecdsa_nistp256:", p_hash); - loggers::get_instance().log(">>> security_services::verify_sign_ecdsa_nistp256: %s", p_certificate_id.c_str()); + loggers::get_instance().log_msg(">>> security_services_its::verify_sign_ecdsa_nistp256:", p_hash); + loggers::get_instance().log(">>> security_services_its::verify_sign_ecdsa_nistp256: %s", p_certificate_id.c_str()); OCTETSTRING public_key_x; OCTETSTRING public_key_y; if (_security_db->get_public_keys(p_certificate_id, public_key_x, public_key_y) != 0) { - loggers::get_instance().warning("security_services::verify_sign_ecdsa_nistp256 (%s): Failed to get public keys", p_certificate_id.c_str()); + loggers::get_instance().warning("security_services_its::verify_sign_ecdsa_nistp256 (%s): Failed to get public keys", p_certificate_id.c_str()); return -1; } // Generate the hash to be verified: Hash ( Hash (Data input) || Hash (Signer identifier input) ) OCTETSTRING issuer; // Hash (Signer identifier input) if (_security_db->get_hash(p_certificate_id, issuer) != 0) { - loggers::get_instance().warning("security_services::verify_sign_ecdsa_nistp256 (%s): Failed to get hash of the issuer certificate", + loggers::get_instance().warning("security_services_its::verify_sign_ecdsa_nistp256 (%s): Failed to get hash of the issuer certificate", p_certificate_id.c_str()); return -1; } - loggers::get_instance().log_msg("security_services::verify_sign_ecdsa_nistp256: hash_issuer: ", issuer); + loggers::get_instance().log_msg("security_services_its::verify_sign_ecdsa_nistp256: hash_issuer: ", issuer); OCTETSTRING hash_data = p_hash + issuer; // Hash (Data input) || Hash (Signer identifier input) - loggers::get_instance().log_msg("security_services::verify_sign_ecdsa_nistp256: hash: ", hash_data); + loggers::get_instance().log_msg("security_services_its::verify_sign_ecdsa_nistp256: hash: ", hash_data); OCTETSTRING hash_to_be_verified; hash_sha256(hash_data, hash_to_be_verified); // Hash ( Hash (Data input) || Hash (Signer identifier input) ) - loggers::get_instance().log_msg("security_services::verify_sign_ecdsa_nistp256: hash_to_be_verified: ", hash_to_be_verified); + loggers::get_instance().log_msg("security_services_its::verify_sign_ecdsa_nistp256: hash_to_be_verified: ", hash_to_be_verified); // Build the signature OCTETSTRING signature; @@ -1019,7 +1019,7 @@ int security_services::verify_sign_ecdsa_nistp256(const OCTETSTRING &p_hash, con signature = p_signature.ecdsaNistP256Signature().rSig().uncompressedP256().x() + p_signature.ecdsaNistP256Signature().rSig().uncompressedP256().y() + p_signature.ecdsaNistP256Signature().sSig(); } else { - loggers::get_instance().warning("security_services::verify_sign_ecdsa_nistp256 (%s): Invalid curve point", p_certificate_id.c_str()); + loggers::get_instance().warning("security_services_its::verify_sign_ecdsa_nistp256 (%s): Invalid curve point", p_certificate_id.c_str()); return -1; } security_ecc k(ec_elliptic_curves::nist_p_256, public_key_x, public_key_y); @@ -1030,31 +1030,31 @@ int security_services::verify_sign_ecdsa_nistp256(const OCTETSTRING &p_hash, con return -1; } -int security_services::verify_sign_ecdsa_nistp384(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, +int security_services_its::verify_sign_ecdsa_nistp384(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, const std::string &p_certificate_id, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::verify_sign_ecdsa_nistp384:", p_hash); - loggers::get_instance().log(">>> security_services::verify_sign_ecdsa_nistp384: %s", p_certificate_id.c_str()); + loggers::get_instance().log_msg(">>> security_services_its::verify_sign_ecdsa_nistp384:", p_hash); + loggers::get_instance().log(">>> security_services_its::verify_sign_ecdsa_nistp384: %s", p_certificate_id.c_str()); OCTETSTRING public_key_x; OCTETSTRING public_key_y; if (_security_db->get_public_keys(p_certificate_id, public_key_x, public_key_y) != 0) { - loggers::get_instance().warning("security_services::verify_sign_ecdsa_nistp384 (%s): Failed to get public keys", p_certificate_id.c_str()); + loggers::get_instance().warning("security_services_its::verify_sign_ecdsa_nistp384 (%s): Failed to get public keys", p_certificate_id.c_str()); return -1; } // Generate the hash to be verified: Hash ( Hash (Data input) || Hash (Signer identifier input) ) OCTETSTRING issuer; // Hash (Signer identifier input) if (_security_db->get_hash(p_certificate_id, issuer) != 0) { - loggers::get_instance().warning("security_services::verify_sign_ecdsa_nistp384 (%s): Failed to get hash of the issuer certificate", + loggers::get_instance().warning("security_services_its::verify_sign_ecdsa_nistp384 (%s): Failed to get hash of the issuer certificate", p_certificate_id.c_str()); return -1; } - loggers::get_instance().log_msg("security_services::verify_sign_ecdsa_nistp384: hash_issuer: ", issuer); + loggers::get_instance().log_msg("security_services_its::verify_sign_ecdsa_nistp384: hash_issuer: ", issuer); OCTETSTRING hash_data = p_hash + issuer; // Hash (Data input) || Hash (Signer identifier input) - loggers::get_instance().log_msg("security_services::verify_sign_ecdsa_nistp384: hash: ", hash_data); + loggers::get_instance().log_msg("security_services_its::verify_sign_ecdsa_nistp384: hash: ", hash_data); OCTETSTRING hash_to_be_verified; hash_sha384(hash_data, hash_to_be_verified); // Hash ( Hash (Data input) || Hash (Signer identifier input) ) - loggers::get_instance().log_msg("security_services::verify_sign_ecdsa_nistp384: hash_to_be_verified: ", hash_to_be_verified); + loggers::get_instance().log_msg("security_services_its::verify_sign_ecdsa_nistp384: hash_to_be_verified: ", hash_to_be_verified); // Build the signature OCTETSTRING signature; @@ -1068,7 +1068,7 @@ int security_services::verify_sign_ecdsa_nistp384(const OCTETSTRING &p_hash, con signature = p_signature.ecdsaNistP384Signature().rSig().uncompressedP384().x() + p_signature.ecdsaNistP384Signature().rSig().uncompressedP384().y() + p_signature.ecdsaNistP384Signature().sSig(); } else { - loggers::get_instance().warning("security_services::verify_sign_ecdsa_nistp384 (%s): Invalid curve point", p_certificate_id.c_str()); + loggers::get_instance().warning("security_services_its::verify_sign_ecdsa_nistp384 (%s): Invalid curve point", p_certificate_id.c_str()); return -1; } security_ecc k(ec_elliptic_curves::nist_p_384, public_key_x, public_key_y); @@ -1079,67 +1079,67 @@ int security_services::verify_sign_ecdsa_nistp384(const OCTETSTRING &p_hash, con return -1; } -int security_services::sign_ecdsa_brainpoolp256r1(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::sign_ecdsa_brainpoolp256r1: ", p_hash); +int security_services_its::sign_ecdsa_brainpoolp256r1(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params) { + loggers::get_instance().log_msg(">>> security_services_its::sign_ecdsa_brainpoolp256r1: ", p_hash); std::string certificate_id = p_params[params_its::certificate]; - loggers::get_instance().log("security_services::sign_ecdsa_brainpoolp256r1: encoded certificate_id = '%s'", certificate_id.c_str()); + loggers::get_instance().log("security_services_its::sign_ecdsa_brainpoolp256r1: encoded certificate_id = '%s'", certificate_id.c_str()); OCTETSTRING pkey; if (_security_db->get_private_key(certificate_id, pkey) != 0) { - loggers::get_instance().warning("security_services::sign_ecdsa_brainpoolp256r1: Failed to get private key"); + loggers::get_instance().warning("security_services_its::sign_ecdsa_brainpoolp256r1: Failed to get private key"); return -1; } // Hash ( Hash (Data input) || Hash (Signer identifier input) ) OCTETSTRING hash_cert; if (_security_db->get_hash(certificate_id, hash_cert) != 0) { - loggers::get_instance().warning("security_services::sign_ecdsa_brainpoolp256r1: Failed to get whole hash certificate"); + loggers::get_instance().warning("security_services_its::sign_ecdsa_brainpoolp256r1: Failed to get whole hash certificate"); return -1; } - loggers::get_instance().log_msg("security_services::sign_ecdsa_brainpoolp256r1: hash_issuer: ", hash_cert); + loggers::get_instance().log_msg("security_services_its::sign_ecdsa_brainpoolp256r1: hash_issuer: ", hash_cert); OCTETSTRING os = p_hash + hash_cert; // Hash (Data input) || Hash (Signer identifier input) - loggers::get_instance().log_msg("security_services::sign_ecdsa_brainpoolp256r1: hash: ", os); + loggers::get_instance().log_msg("security_services_its::sign_ecdsa_brainpoolp256r1: hash: ", os); OCTETSTRING hashed_data; hash_sha256(os, hashed_data); // Hash ( Hash (Data input) || Hash (Signer identifier input) ) security_ecc k(ec_elliptic_curves::brainpool_p_256_r1, pkey); OCTETSTRING r_sig; OCTETSTRING s_sig; if (k.sign(hashed_data, r_sig, s_sig) != 0) { - loggers::get_instance().warning("security_services::sign_ecdsa_brainpoolp256r1: Failed to sign payload"); + loggers::get_instance().warning("security_services_its::sign_ecdsa_brainpoolp256r1: Failed to sign payload"); return -1; } Ieee1609Dot2BaseTypes::EccP256CurvePoint ep; ep.x__only() = r_sig; p_signature.ecdsaBrainpoolP256r1Signature() = Ieee1609Dot2BaseTypes::EcdsaP256Signature(ep, s_sig); - loggers::get_instance().log_msg("security_services::sign_ecdsa_brainpoolp256r1: signature=", p_signature); + loggers::get_instance().log_msg("security_services_its::sign_ecdsa_brainpoolp256r1: signature=", p_signature); return 0; } -int security_services::verify_sign_ecdsa_brainpoolp256r1(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, +int security_services_its::verify_sign_ecdsa_brainpoolp256r1(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, const std::string &p_certificate_id, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::verify_sign_ecdsa_brainpoolp256r1:", p_hash); - loggers::get_instance().log(">>> security_services::verify_sign_ecdsa_brainpoolp256r1: %s", p_certificate_id.c_str()); + loggers::get_instance().log_msg(">>> security_services_its::verify_sign_ecdsa_brainpoolp256r1:", p_hash); + loggers::get_instance().log(">>> security_services_its::verify_sign_ecdsa_brainpoolp256r1: %s", p_certificate_id.c_str()); OCTETSTRING public_key_x; OCTETSTRING public_key_y; if (_security_db->get_public_keys(p_certificate_id, public_key_x, public_key_y) != 0) { - loggers::get_instance().warning("security_services::verify_sign_ecdsa_brainpoolp256r1 (%s): Failed to get public keys", p_certificate_id.c_str()); + loggers::get_instance().warning("security_services_its::verify_sign_ecdsa_brainpoolp256r1 (%s): Failed to get public keys", p_certificate_id.c_str()); return -1; } // Generate the hash to be verified: Hash ( Hash (Data input) || Hash (Signer identifier input) ) OCTETSTRING issuer; // Hash (Signer identifier input) if (_security_db->get_hash(p_certificate_id, issuer) != 0) { - loggers::get_instance().warning("security_services::verify_sign_ecdsa_brainpoolp256r1 (%s): Failed to get hash of the issuer certificate", + loggers::get_instance().warning("security_services_its::verify_sign_ecdsa_brainpoolp256r1 (%s): Failed to get hash of the issuer certificate", p_certificate_id.c_str()); return -1; } - loggers::get_instance().log_msg("security_services::verify_sign_ecdsa_brainpoolp256r1: hash_issuer: ", issuer); + loggers::get_instance().log_msg("security_services_its::verify_sign_ecdsa_brainpoolp256r1: hash_issuer: ", issuer); OCTETSTRING hash_data = p_hash + issuer; // Hash (Data input) || Hash (Signer identifier input) - loggers::get_instance().log_msg("security_services::verify_sign_ecdsa_brainpoolp256r1: hash: ", hash_data); + loggers::get_instance().log_msg("security_services_its::verify_sign_ecdsa_brainpoolp256r1: hash: ", hash_data); OCTETSTRING hash_to_be_verified; hash_sha256(hash_data, hash_to_be_verified); // Hash ( Hash (Data input) || Hash (Signer identifier input) ) - loggers::get_instance().log_msg("security_services::verify_sign_ecdsa_brainpoolp256r1: hash_to_be_verified: ", hash_to_be_verified); + loggers::get_instance().log_msg("security_services_its::verify_sign_ecdsa_brainpoolp256r1: hash_to_be_verified: ", hash_to_be_verified); // Build the signature OCTETSTRING signature; @@ -1153,7 +1153,7 @@ int security_services::verify_sign_ecdsa_brainpoolp256r1(const OCTETSTRING &p_ha signature = p_signature.ecdsaBrainpoolP256r1Signature().rSig().uncompressedP256().x() + p_signature.ecdsaBrainpoolP256r1Signature().rSig().uncompressedP256().y() + p_signature.ecdsaBrainpoolP256r1Signature().sSig(); } else { - loggers::get_instance().warning("security_services::verify_sign_ecdsa_brainpoolp256r1 (%s): Invalid curve point", p_certificate_id.c_str()); + loggers::get_instance().warning("security_services_its::verify_sign_ecdsa_brainpoolp256r1 (%s): Invalid curve point", p_certificate_id.c_str()); return -1; } security_ecc k(ec_elliptic_curves::brainpool_p_256_r1, public_key_x, public_key_y); @@ -1164,67 +1164,67 @@ int security_services::verify_sign_ecdsa_brainpoolp256r1(const OCTETSTRING &p_ha return -1; } -int security_services::sign_ecdsa_brainpoolp384r1(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::sign_ecdsa_brainpoolp384r1: ", p_hash); +int security_services_its::sign_ecdsa_brainpoolp384r1(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params) { + loggers::get_instance().log_msg(">>> security_services_its::sign_ecdsa_brainpoolp384r1: ", p_hash); std::string certificate_id = p_params[params_its::certificate]; - loggers::get_instance().log("security_services::sign_ecdsa_brainpoolp384r1: encoded certificate_id = '%s'", certificate_id.c_str()); + loggers::get_instance().log("security_services_its::sign_ecdsa_brainpoolp384r1: encoded certificate_id = '%s'", certificate_id.c_str()); OCTETSTRING pkey; if (_security_db->get_private_key(certificate_id, pkey) != 0) { - loggers::get_instance().warning("security_services::sign_ecdsa_brainpoolp384r1: Failed to get private key"); + loggers::get_instance().warning("security_services_its::sign_ecdsa_brainpoolp384r1: Failed to get private key"); return -1; } // Hash ( Hash (Data input) || Hash (Signer identifier input) ) OCTETSTRING hash_cert; if (_security_db->get_hash(certificate_id, hash_cert) != 0) { - loggers::get_instance().warning("security_services::sign_ecdsa_brainpoolp384r1: Failed to get whole hash certificate"); + loggers::get_instance().warning("security_services_its::sign_ecdsa_brainpoolp384r1: Failed to get whole hash certificate"); return -1; } - loggers::get_instance().log_msg("security_services::sign_ecdsa_brainpoolp384r1: hash_issuer: ", hash_cert); + loggers::get_instance().log_msg("security_services_its::sign_ecdsa_brainpoolp384r1: hash_issuer: ", hash_cert); OCTETSTRING os = p_hash + hash_cert; // Hash (Data input) || Hash (Signer identifier input) - loggers::get_instance().log_msg("security_services::sign_ecdsa_brainpoolp384r1: hash: ", os); + loggers::get_instance().log_msg("security_services_its::sign_ecdsa_brainpoolp384r1: hash: ", os); OCTETSTRING hashed_data; hash_sha384(os, hashed_data); // Hash ( Hash (Data input) || Hash (Signer identifier input) ) security_ecc k(ec_elliptic_curves::brainpool_p_384_r1, pkey); OCTETSTRING r_sig; OCTETSTRING s_sig; if (k.sign(hashed_data, r_sig, s_sig) != 0) { - loggers::get_instance().warning("security_services::sign_ecdsa_brainpoolp384r1: Failed to sign payload"); + loggers::get_instance().warning("security_services_its::sign_ecdsa_brainpoolp384r1: Failed to sign payload"); return -1; } Ieee1609Dot2BaseTypes::EccP384CurvePoint ep; ep.x__only() = r_sig; p_signature.ecdsaBrainpoolP384r1Signature() = Ieee1609Dot2BaseTypes::EcdsaP384Signature(ep, s_sig); - loggers::get_instance().log_msg("security_services::sign_ecdsa_brainpoolp384r1: signature=", p_signature); + loggers::get_instance().log_msg("security_services_its::sign_ecdsa_brainpoolp384r1: signature=", p_signature); return 0; } -int security_services::verify_sign_ecdsa_brainpoolp384r1(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, +int security_services_its::verify_sign_ecdsa_brainpoolp384r1(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, const std::string &p_certificate_id, params_its &p_params) { - loggers::get_instance().log_msg(">>> security_services::verify_sign_ecdsa_brainpoolp384r1:", p_hash); - loggers::get_instance().log(">>> security_services::verify_sign_ecdsa_brainpoolp384r1: %s", p_certificate_id.c_str()); + loggers::get_instance().log_msg(">>> security_services_its::verify_sign_ecdsa_brainpoolp384r1:", p_hash); + loggers::get_instance().log(">>> security_services_its::verify_sign_ecdsa_brainpoolp384r1: %s", p_certificate_id.c_str()); OCTETSTRING public_key_x; OCTETSTRING public_key_y; if (_security_db->get_public_keys(p_certificate_id, public_key_x, public_key_y) != 0) { - loggers::get_instance().warning("security_services::verify_sign_ecdsa_brainpoolp384r1 (%s): Failed to get public keys", p_certificate_id.c_str()); + loggers::get_instance().warning("security_services_its::verify_sign_ecdsa_brainpoolp384r1 (%s): Failed to get public keys", p_certificate_id.c_str()); return -1; } // Generate the hash to be verified: Hash ( Hash (Data input) || Hash (Signer identifier input) ) OCTETSTRING issuer; // Hash (Signer identifier input) if (_security_db->get_hash(p_certificate_id, issuer) != 0) { - loggers::get_instance().warning("security_services::verify_sign_ecdsa_brainpoolp384r1 (%s): Failed to get hash of the issuer certificate", + loggers::get_instance().warning("security_services_its::verify_sign_ecdsa_brainpoolp384r1 (%s): Failed to get hash of the issuer certificate", p_certificate_id.c_str()); return -1; } - loggers::get_instance().log_msg("security_services::verify_sign_ecdsa_brainpoolp384r1: hash_issuer: ", issuer); + loggers::get_instance().log_msg("security_services_its::verify_sign_ecdsa_brainpoolp384r1: hash_issuer: ", issuer); OCTETSTRING hash_data = p_hash + issuer; // Hash (Data input) || Hash (Signer identifier input) - loggers::get_instance().log_msg("security_services::verify_sign_ecdsa_brainpoolp384r1: hash: ", hash_data); + loggers::get_instance().log_msg("security_services_its::verify_sign_ecdsa_brainpoolp384r1: hash: ", hash_data); OCTETSTRING hash_to_be_verified; hash_sha384(hash_data, hash_to_be_verified); // Hash ( Hash (Data input) || Hash (Signer identifier input) ) - loggers::get_instance().log_msg("security_services::verify_sign_ecdsa_brainpoolp384r1: hash_to_be_verified: ", hash_to_be_verified); + loggers::get_instance().log_msg("security_services_its::verify_sign_ecdsa_brainpoolp384r1: hash_to_be_verified: ", hash_to_be_verified); // Build the signature OCTETSTRING signature; @@ -1238,7 +1238,7 @@ int security_services::verify_sign_ecdsa_brainpoolp384r1(const OCTETSTRING &p_ha signature = p_signature.ecdsaBrainpoolP384r1Signature().rSig().uncompressedP384().x() + p_signature.ecdsaBrainpoolP384r1Signature().rSig().uncompressedP384().y() + p_signature.ecdsaBrainpoolP384r1Signature().sSig(); } else { - loggers::get_instance().warning("security_services::verify_sign_ecdsa_brainpoolp384r1 (%s): Invalid curve point", p_certificate_id.c_str()); + loggers::get_instance().warning("security_services_its::verify_sign_ecdsa_brainpoolp384r1 (%s): Invalid curve point", p_certificate_id.c_str()); return -1; } security_ecc k(ec_elliptic_curves::brainpool_p_384_r1, public_key_x, public_key_y); @@ -1249,9 +1249,9 @@ int security_services::verify_sign_ecdsa_brainpoolp384r1(const OCTETSTRING &p_ha return -1; } -int security_services::extract_verification_keys(const Ieee1609Dot2::CertificateBase &p_cert, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y, +int security_services_its::extract_verification_keys(const Ieee1609Dot2::CertificateBase &p_cert, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y, OCTETSTRING &p_public_comp_key, INTEGER &p_public_comp_key_mode) { - loggers::get_instance().log("security_services::extract_verification_keys"); + loggers::get_instance().log("security_services_its::extract_verification_keys"); if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP256)) { if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().ischosen(Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__0)) { @@ -1276,7 +1276,7 @@ int security_services::extract_verification_keys(const Ieee1609Dot2::Certificate p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().uncompressedP256().x(); p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().uncompressedP256().y(); } else { - loggers::get_instance().error("security_services::extract_verification_keys: Unsupported ecdsaNistP256 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().get_selection()); + loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported ecdsaNistP256 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().get_selection()); return -1; } } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP256r1)) { @@ -1299,7 +1299,7 @@ int security_services::extract_verification_keys(const Ieee1609Dot2::Certificate p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().uncompressedP256().x(); p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().uncompressedP256().y(); } else { - loggers::get_instance().error("security_services::extract_verification_keys: Unsupported ecdsaBrainpoolP256r1 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().get_selection()); + loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported ecdsaBrainpoolP256r1 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().get_selection()); return -1; } } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP384r1)) { @@ -1322,7 +1322,7 @@ int security_services::extract_verification_keys(const Ieee1609Dot2::Certificate p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().uncompressedP384().x(); p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().uncompressedP384().y(); } else { - loggers::get_instance().error("security_services::extract_verification_keys: Unsupported ecdsaBrainpoolP384r1 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().get_selection()); + loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported ecdsaBrainpoolP384r1 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().get_selection()); return -1; } } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP384)) { @@ -1345,20 +1345,20 @@ int security_services::extract_verification_keys(const Ieee1609Dot2::Certificate p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().uncompressedP384().x(); p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().uncompressedP384().y(); } else { - loggers::get_instance().error("security_services::extract_verification_keys: Unsupported ecdsaNistP384 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().get_selection()); + loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported ecdsaNistP384 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().get_selection()); return -1; } } else { - loggers::get_instance().error("security_services::extract_verification_keys: Unsupported VerificationKey curve %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().get_selection()); + loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported VerificationKey curve %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().get_selection()); return -1; } return 0; } -int security_services::extract_encryption_keys(const Ieee1609Dot2::CertificateBase &p_cert, OCTETSTRING &p_public_enc_key_x, OCTETSTRING &p_public_enc_key_y, +int security_services_its::extract_encryption_keys(const Ieee1609Dot2::CertificateBase &p_cert, OCTETSTRING &p_public_enc_key_x, OCTETSTRING &p_public_enc_key_y, OCTETSTRING &p_public_enc_comp_key, INTEGER &p_public_enc_comp_key_mode) { - loggers::get_instance().log("security_services::extract_encryption_keys"); + loggers::get_instance().log("security_services_its::extract_encryption_keys"); if (p_cert.toBeSigned().encryptionKey().ispresent()) { const Ieee1609Dot2BaseTypes::PublicEncryptionKey &p = static_cast(p_cert.toBeSigned().encryptionKey()); @@ -1379,7 +1379,7 @@ int security_services::extract_encryption_keys(const Ieee1609Dot2::CertificateBa p_public_enc_key_x = p.publicKey().eciesNistP256().uncompressedP256().x(); p_public_enc_key_y = p.publicKey().eciesNistP256().uncompressedP256().y(); } else { - loggers::get_instance().error("security_services::extract_encryption_keys: Unsupported EncryptionKey"); + loggers::get_instance().error("security_services_its::extract_encryption_keys: Unsupported EncryptionKey"); return -1; } } else if (p.publicKey().ischosen(Ieee1609Dot2BaseTypes::BasePublicEncryptionKey::ALT_eciesBrainpoolP256r1)) { @@ -1399,15 +1399,15 @@ int security_services::extract_encryption_keys(const Ieee1609Dot2::CertificateBa p_public_enc_key_x = p.publicKey().eciesBrainpoolP256r1().uncompressedP256().x(); p_public_enc_key_y = p.publicKey().eciesBrainpoolP256r1().uncompressedP256().y(); } else { - loggers::get_instance().error("security_services::extract_encryption_keys: Unsupported EncryptionKey"); + loggers::get_instance().error("security_services_its::extract_encryption_keys: Unsupported EncryptionKey"); return -1; } } else { - loggers::get_instance().error("security_services::extract_encryption_keys: Unsupported EncryptionKey"); + loggers::get_instance().error("security_services_its::extract_encryption_keys: Unsupported EncryptionKey"); return -1; } } else { - loggers::get_instance().warning("security_services::extract_encryption_keys: EncryptionKey omitted"); + loggers::get_instance().warning("security_services_its::extract_encryption_keys: EncryptionKey omitted"); p_public_enc_key_x = OCTETSTRING(0, nullptr); p_public_enc_key_y = OCTETSTRING(0, nullptr); p_public_enc_comp_key = OCTETSTRING(0, nullptr); @@ -1417,33 +1417,33 @@ int security_services::extract_encryption_keys(const Ieee1609Dot2::CertificateBa return 0; } // End of method extract_encryption_keys -int security_services::extract_and_store_certificate(const Ieee1609Dot2::CertificateBase &p_certificate, std::string &p_certificate_id) { - loggers::get_instance().log_msg(">>> security_services::extract_and_store_certificate: ", p_certificate); +int security_services_its::extract_and_store_certificate(const Ieee1609Dot2::CertificateBase &p_certificate, std::string &p_certificate_id) { + loggers::get_instance().log_msg(">>> security_services_its::extract_and_store_certificate: ", p_certificate); // Encode certificate etsi_ts103097_certificate_codec codec; OCTETSTRING enc_cert; codec.encode(p_certificate, enc_cert); if (enc_cert.lengthof() == 0) { - loggers::get_instance().warning("security_services::extract_and_store_certificate: Failed to encode certificate"); + loggers::get_instance().warning("security_services_its::extract_and_store_certificate: Failed to encode certificate"); return -1; } - loggers::get_instance().log_msg("security_services::extract_and_store_certificate: Encoded certificate=", enc_cert); + loggers::get_instance().log_msg("security_services_its::extract_and_store_certificate: Encoded certificate=", enc_cert); OCTETSTRING hash_cert_sha_256; hash_sha256(enc_cert, hash_cert_sha_256); - loggers::get_instance().log_msg("security_services::extract_and_store_certificate: hash_cert_sha_256= ", hash_cert_sha_256); + loggers::get_instance().log_msg("security_services_its::extract_and_store_certificate: hash_cert_sha_256= ", hash_cert_sha_256); int result = -1; if (p_certificate.issuer().ischosen(Ieee1609Dot2::IssuerIdentifier::ALT_sha256AndDigest)) { // Calculate the hash according to the hashId OCTETSTRING hash_cert(hash_cert_sha_256); - loggers::get_instance().log_msg("security_services::extract_and_store_certificate: hash_cert= ", hash_cert); + loggers::get_instance().log_msg("security_services_its::extract_and_store_certificate: hash_cert= ", hash_cert); const OCTETSTRING hashed_id8 = substr(hash_cert, hash_cert.lengthof() - 8, 8); // Retrieve the certificate identifier from digest - loggers::get_instance().log_msg("security_services::extract_and_store_certificate: Retrieve the certificate identifier from digest: ", hashed_id8); + loggers::get_instance().log_msg("security_services_its::extract_and_store_certificate: Retrieve the certificate identifier from digest: ", hashed_id8); result = _security_db.get()->get_certificate_id(hashed_id8, p_certificate_id); if (result == -1) { // Not found in current DB if (_security_cache.get()->get_certificate_id(hashed_id8, p_certificate_id) == -1) { // Not found in TS cache - loggers::get_instance().log_msg("security_services::extract_and_store_certificate: Store new certificate in cache: ", p_certificate); + loggers::get_instance().log_msg("security_services_its::extract_and_store_certificate: Store new certificate in cache: ", p_certificate); // const std::vector v(static_cast(hashed_id8), static_cast(hashed_id8) + // hashed_id8.lengthof()); p_certificate_id = converter::get_instance().bytes_to_hexa(v); p_certificate_id = std::string(static_cast(hex2str(oct2hex(hashed_id8)))); @@ -1451,14 +1451,14 @@ int security_services::extract_and_store_certificate(const Ieee1609Dot2::Certifi OCTETSTRING public_key_x, public_key_y, public_comp_key; INTEGER public_comp_key_mode; if (extract_verification_keys(p_certificate, public_key_x, public_key_y, public_comp_key, public_comp_key_mode) == -1) { - loggers::get_instance().error("security_services::extract_and_store_certificate: Unsupported EncryptionKey"); + loggers::get_instance().error("security_services_its::extract_and_store_certificate: Unsupported EncryptionKey"); return -1; } // Add encryption keys OCTETSTRING public_enc_key_x, public_enc_key_y, public_enc_comp_key; INTEGER public_enc_comp_key_mode; if (extract_encryption_keys(p_certificate, public_enc_key_x, public_enc_key_y, public_enc_comp_key, public_enc_comp_key_mode) == -1) { - loggers::get_instance().error("security_services::extract_and_store_certificate: Unsupported EncryptionKey"); + loggers::get_instance().error("security_services_its::extract_and_store_certificate: Unsupported EncryptionKey"); return -1; } // And store it into the cache @@ -1472,14 +1472,14 @@ int security_services::extract_and_store_certificate(const Ieee1609Dot2::Certifi // Calculate the hash according to the hashId OCTETSTRING hash_cert; hash_sha384(enc_cert, hash_cert); - loggers::get_instance().log_msg("security_services::extract_and_store_certificate: hash_cert= ", hash_cert); + loggers::get_instance().log_msg("security_services_its::extract_and_store_certificate: hash_cert= ", hash_cert); const OCTETSTRING hashed_id8 = substr(hash_cert, hash_cert.lengthof() - 8, 8); // Retrieve the certificate identifier from digest - loggers::get_instance().log("security_services::extract_and_store_certificate: Retrieve the certificate identifier from digest"); + loggers::get_instance().log("security_services_its::extract_and_store_certificate: Retrieve the certificate identifier from digest"); result = _security_db.get()->get_certificate_id(hashed_id8, p_certificate_id); if (result == -1) { if (_security_cache.get()->get_certificate_id(hashed_id8, p_certificate_id) == -1) { - loggers::get_instance().log_msg("security_services::extract_and_store_certificate: Store new certificate in cache: ", p_certificate); + loggers::get_instance().log_msg("security_services_its::extract_and_store_certificate: Store new certificate in cache: ", p_certificate); // const std::vector v(static_cast(hashed_id8), static_cast(hashed_id8) + // hashed_id8.lengthof()); p_certificate_id = converter::get_instance().bytes_to_hexa(v); p_certificate_id = std::string(static_cast(hex2str(oct2hex(hashed_id8)))); @@ -1487,14 +1487,14 @@ int security_services::extract_and_store_certificate(const Ieee1609Dot2::Certifi OCTETSTRING public_key_x, public_key_y, public_comp_key; INTEGER public_comp_key_mode; if (extract_verification_keys(p_certificate, public_key_x, public_key_y, public_comp_key, public_comp_key_mode) == -1) { - loggers::get_instance().error("security_services::extract_and_store_certificate: Unsupported EncryptionKey"); + loggers::get_instance().error("security_services_its::extract_and_store_certificate: Unsupported EncryptionKey"); return -1; } // Add encryption keys OCTETSTRING public_enc_key_x, public_enc_key_y, public_enc_comp_key; INTEGER public_enc_comp_key_mode; if (extract_encryption_keys(p_certificate, public_enc_key_x, public_enc_key_y, public_enc_comp_key, public_enc_comp_key_mode) == -1) { - loggers::get_instance().error("security_services::extract_and_store_certificate: Unsupported EncryptionKey"); + loggers::get_instance().error("security_services_its::extract_and_store_certificate: Unsupported EncryptionKey"); return -1; } // And store it into the cache @@ -1505,30 +1505,30 @@ int security_services::extract_and_store_certificate(const Ieee1609Dot2::Certifi } } } else { - loggers::get_instance().error("security_services::extract_and_store_certificate: Unsupported issuer"); + loggers::get_instance().error("security_services_its::extract_and_store_certificate: Unsupported issuer"); return -1; } return 0; } // End of method extract_and_store_certificate -int security_services::read_certificate(const CHARSTRING &p_certificate_id, OCTETSTRING &p_certificate) const { +int security_services_its::read_certificate(const CHARSTRING &p_certificate_id, OCTETSTRING &p_certificate) const { return _security_db.get()->get_certificate(std::string(static_cast(p_certificate_id)), p_certificate); } -int security_services::read_certificate_digest(const CHARSTRING &p_certificate_id, OCTETSTRING &p_digest) const { +int security_services_its::read_certificate_digest(const CHARSTRING &p_certificate_id, OCTETSTRING &p_digest) const { return _security_db.get()->get_hashed_id(std::string(static_cast(p_certificate_id)), p_digest); } -int security_services::read_certificate_hash(const CHARSTRING &p_certificate_id, OCTETSTRING &p_hash) const { +int security_services_its::read_certificate_hash(const CHARSTRING &p_certificate_id, OCTETSTRING &p_hash) const { return _security_db.get()->get_hash(std::string(static_cast(p_certificate_id)), p_hash); } -int security_services::read_certificate_hash_sha_256(const CHARSTRING &p_certificate_id, OCTETSTRING &p_hash) const { +int security_services_its::read_certificate_hash_sha_256(const CHARSTRING &p_certificate_id, OCTETSTRING &p_hash) const { return _security_db.get()->get_hash_sha_256(std::string(static_cast(p_certificate_id)), p_hash); } -int security_services::read_certificate_from_digest(const OCTETSTRING &p_digest, CHARSTRING &p_certificate_id) const { +int security_services_its::read_certificate_from_digest(const OCTETSTRING &p_digest, CHARSTRING &p_certificate_id) const { std::string certificate_id; if (_security_db.get()->get_certificate_id(p_digest, certificate_id) != -1) { p_certificate_id = CHARSTRING(certificate_id.c_str()); @@ -1537,7 +1537,7 @@ int security_services::read_certificate_from_digest(const OCTETSTRING &p_digest, return -1; } -int security_services::read_certificate_from_hashed_id3(const OCTETSTRING &p_digest, CHARSTRING &p_certificate_id) const { +int security_services_its::read_certificate_from_hashed_id3(const OCTETSTRING &p_digest, CHARSTRING &p_certificate_id) const { std::string certificate_id; if (_security_db.get()->get_certificate_hashed_id3(p_digest, certificate_id) != -1) { p_certificate_id = CHARSTRING(certificate_id.c_str()); @@ -1546,10 +1546,10 @@ int security_services::read_certificate_from_hashed_id3(const OCTETSTRING &p_dig return -1; } -int security_services::read_private_key(const CHARSTRING &p_certificate_id, OCTETSTRING &p_private_key) const { +int security_services_its::read_private_key(const CHARSTRING &p_certificate_id, OCTETSTRING &p_private_key) const { return _security_db.get()->get_private_key(std::string(static_cast(p_certificate_id)), p_private_key); } -int security_services::read_private_enc_key(const CHARSTRING &p_certificate_id, OCTETSTRING &p_private_enc_key) const { +int security_services_its::read_private_enc_key(const CHARSTRING &p_certificate_id, OCTETSTRING &p_private_enc_key) const { return _security_db.get()->get_private_enc_key(std::string(static_cast(p_certificate_id)), p_private_enc_key); } diff --git a/ccsrc/Protocols/Security/security_services.hh b/ccsrc/Protocols/Security/security_services_its.hh similarity index 95% rename from ccsrc/Protocols/Security/security_services.hh rename to ccsrc/Protocols/Security/security_services_its.hh index ad4bc3a..45e2476 100644 --- a/ccsrc/Protocols/Security/security_services.hh +++ b/ccsrc/Protocols/Security/security_services_its.hh @@ -28,18 +28,18 @@ namespace Ieee1609Dot2 { } // namespace Ieee1609Dot2 /*! - * \class security_services + * \class security_services_its * \brief This class provides security services for all layers as specified in TSI TS 102 723-8 and ETSI TS 103 097 * \remark Singleton pattern */ -class security_services { +class security_services_its { static constexpr unsigned int ProtocolVersion = 3; /*! * \brief Unique static object reference of this class */ - static security_services *instance; + static security_services_its *instance; params_its _params; bool _setup_done; @@ -58,11 +58,11 @@ class security_services { /*! * \brief Default private ctor */ - security_services(); + security_services_its(); /*! * \brief Default private dtor */ - ~security_services() { + ~security_services_its() { _ec_keys_enc.reset(nullptr); _security_db.reset(nullptr); _security_cache.reset(nullptr); @@ -76,9 +76,9 @@ public: /*! \publicsection */ /*! * \brief Public accessor to the single object reference */ - inline static security_services &get_instance() { + inline static security_services_its &get_instance() { if (instance == NULL) - instance = new security_services(); + instance = new security_services_its(); return *instance; }; @@ -192,4 +192,4 @@ private: int extract_encryption_keys(const Ieee1609Dot2::CertificateBase &p_cert, OCTETSTRING &p_public_enc_key_x, OCTETSTRING &p_public_enc_key_y, OCTETSTRING &p_public_enc_comp_key, INTEGER &p_public_enc_comp_key_mode); int extract_and_store_certificate(const Ieee1609Dot2::CertificateBase &p_certificate, std::string &p_certificate_id); -}; // End of class security_services +}; // End of class security_services_its diff --git a/ccsrc/Protocols/Security/sha256.cc b/ccsrc/Protocols/Security/sha256.cc deleted file mode 100644 index dc8c7f5..0000000 --- a/ccsrc/Protocols/Security/sha256.cc +++ /dev/null @@ -1,39 +0,0 @@ -/*! - * \file sha256.cc - * \brief Source file for SHA-256 helper methods. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#include - -#include "sha256.hh" - -int sha256::generate(const OCTETSTRING& p_buffer, OCTETSTRING& p_hash) { - // Sanity check - if (p_buffer.lengthof() == 0) { - p_hash = get_sha256_empty_string(); - return 0; - } - - return generate(static_cast(p_buffer), p_buffer.lengthof(), p_hash); -} - -int sha256::generate(const unsigned char* p_buffer, const size_t p_length, OCTETSTRING& p_hash) { - // Sanity check - if ((p_buffer == nullptr) || (p_length == 0)) { - p_hash = get_sha256_empty_string(); - return 0; - } - - // Resize data buffer - p_hash = int2oct(0, SHA256_DIGEST_LENGTH); - // Compute the hash value - ::SHA256_Init(&_ctx); - ::SHA256_Update(&_ctx, p_buffer, p_length); - ::SHA256_Final((unsigned char*)static_cast(p_hash), &_ctx); - return 0; -}; diff --git a/ccsrc/Protocols/Security/sha256.hh b/ccsrc/Protocols/Security/sha256.hh deleted file mode 100644 index 0de9a88..0000000 --- a/ccsrc/Protocols/Security/sha256.hh +++ /dev/null @@ -1,66 +0,0 @@ -/*! - * \file sha256.hh - * \brief Header file for SHA-256 helper methods. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include -#include - -class OCTETSTRING; //! TITAN forward declaration - -/*! - * \class sha256 - * \brief This class provides description of SHA-256 helper methods - */ -class sha256 { - SHA256_CTX _ctx; //! SHA context -public: - /*! - * \brief Default constructor - * Create a new instance of the sha256 class - */ - explicit sha256() : _ctx{} {}; - /*! - * \brief Default destructor - */ - virtual ~sha256(){}; - - /*! - * \fn int generate(const OCTETSTRING& p_buffer, OCTETSTRING& p_hash); - * \brief Receive bytes formated data from the lower layers - * \param[in] p_buffer The data used to generate the SHA-256 hash - * \param[out] p_hash The SHA-256 hash value based of the provided data - * \return 0 on success, -1 otherwise - */ - int generate(const OCTETSTRING &p_buffer, OCTETSTRING &p_hash); - - /*! - * \fn int generate(const unsigned char* p_buffer, OCTETSTRING& p_hash); - * \brief Receive bytes formated data from the lower layers - * \param[in] p_buffer The data used to generate the SHA-256 hash - * \param[in] The length of the data buffer - * \param[out] p_hash The SHA-256 hash value based of the provided data - * \return 0 on success, -1 otherwise - */ - int generate(const unsigned char *p_buffer, const size_t p_length, OCTETSTRING &p_hash); - - /*! - * \fn const OCTETSTRING get_sha256_empty_string() const; - * \brief Return the SHA-256 of an empty string - * \return The SHA-256 of an empty string - */ - inline const OCTETSTRING get_sha256_empty_string() const { - static unsigned char sha256_empty_string[] = { - 0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, - 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}; //! SHA-256 of an empty string - return OCTETSTRING(32, sha256_empty_string); - }; - -}; // End of class sha256 diff --git a/ccsrc/Protocols/Security/sha384.cc b/ccsrc/Protocols/Security/sha384.cc deleted file mode 100644 index 2852051..0000000 --- a/ccsrc/Protocols/Security/sha384.cc +++ /dev/null @@ -1,49 +0,0 @@ -/*! - * \file sha384.cc - * \brief Sorce file for SHA-384 helper methods. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#include - -#include - -#include "sha384.hh" - -int sha384::generate(const OCTETSTRING &p_buffer, OCTETSTRING &p_hash) { - // Sanity check - if (p_buffer.lengthof() == 0) { - p_hash = get_sha384_empty_string(); - return 0; - } - - return generate(static_cast(p_buffer), p_buffer.lengthof(), p_hash); -} - -int sha384::generate(const unsigned char *p_buffer, const size_t p_length, OCTETSTRING &p_hash) { - // Sanity check - if ((p_buffer == nullptr) || (p_length == 0)) { - p_hash = get_sha384_empty_string(); - return 0; - } - - // Resize data buffer - p_hash = int2oct(0, SHA384_DIGEST_LENGTH); - // Compute the hash value - ::SHA384_Init(&_ctx); - ::SHA384_Update(&_ctx, p_buffer, p_length); - ::SHA384_Final((unsigned char *)static_cast(p_hash), &_ctx); - return 0; -} - -const OCTETSTRING sha384::get_sha384_empty_string() const { - static unsigned char - sha384_empty_string[] = {0x38, 0xb0, 0x60, 0xa7, 0x51, 0xac, 0x96, 0x38, 0x4c, 0xd9, 0x32, 0x7e, 0xb1, 0xb1, 0xe3, 0x6a, - 0x21, 0xfd, 0xb7, 0x11, 0x14, 0xbe, 0x07, 0x43, 0x4c, 0x0c, 0xc7, 0xbf, 0x63, 0xf6, 0xe1, 0xda, - 0x27, 0x4e, 0xde, 0xbf, 0xe7, 0x6f, 0x65, 0xfb, 0xd5, 0x1a, 0xd2, 0xf1, 0x48, 0x98, 0xb9, 0x5b}; //! SHA-384 of an empty string - return OCTETSTRING(48, sha384_empty_string); -} diff --git a/ccsrc/Protocols/Security/sha384.hh b/ccsrc/Protocols/Security/sha384.hh deleted file mode 100644 index 525763c..0000000 --- a/ccsrc/Protocols/Security/sha384.hh +++ /dev/null @@ -1,60 +0,0 @@ -/*! - * \file sha384.hh - * \brief Header file for SHA-384 helper methods. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include -#include - -class OCTETSTRING; //! TITAN forward declaration - -/*! - * \class sha384 - * \brief This class provides description of SHA-384 helper methods - */ -class sha384 { - SHA512_CTX _ctx; //! SHA context -public: //! \publicsection - /*! - * \brief Default constructor - * Create a new instance of the sha384 class - */ - explicit sha384() : _ctx{} {}; - /*! - * \brief Default destructor - */ - virtual ~sha384(){}; - - /*! - * \fn int generate(const OCTETSTRING& p_buffer, OCTETSTRING& p_hash); - * \brief Receive bytes formated data from the lower layers - * \param[in] p_buffer The data used to generate the SHA-384 hash - * \param[out] p_hash The SHA-384 hash value based of the provided data - * \return 0 on success, -1 otherwise - */ - int generate(const OCTETSTRING &p_buffer, OCTETSTRING &p_hash); - - /*! - * \fn int generate(const OCTETSTRING p_buffer, OCTETSTRING& p_hash); - * \brief Receive bytes formated data from the lower layers - * \param[in] p_buffer The data used to generate the SHA-384 hash - * \param[in] The length of the data buffer - * \param[out] p_hash The SHA-384 hash value based of the provided data - * \return 0 on success, -1 otherwise - */ - int generate(const unsigned char *p_buffer, const size_t p_length, OCTETSTRING &p_hash); - - /*! - * \fn const OCTETSTRING get_sha384_empty_string() const; - * \brief Return the SHA-384 of an empty string - * \return The SHA-384 of an empty string - */ - const OCTETSTRING get_sha384_empty_string() const; -}; // End of class sha384 diff --git a/config.mk b/config.mk index 78c3fd9..8ec21eb 100644 --- a/config.mk +++ b/config.mk @@ -1,11 +1,10 @@ -#TTCN3_DIR := $(HOME)/frameworks/titan/titan.core/Install -#ASN1C_PATH := $(HOME)/frameworks/asn1c.denis -TTCN3_DIR := /cygdrive/c/Tools/titan -ASN1C_PATH := ../../../asn1c-fillabs -WPCAP_DLL_PATH := /cygdrive/c/windows/system32/npcap/wpcap.dll -NPCAP_INCLUDE := /cygdrive/c/PROGRA~1/Npcap/sdk/include -#T3Q_PATH=./tools/t3q-v2.0.0b30 -#T3Q_CONFIG=t3q.cfg -#T3D_PATH=./tools/t3d-v2.0.0b30 -#T3D_CONFIG=t3d.cfg -#ITS_CONTAINER=../../../AtsDENM/lib/asn1/cdd/ITS_Container.asn +TTCN3_COMPILER_OPTIONS := -d -e -f -g -l -L -R -U none -x -X +TTCN3_DIR := $(HOME)/frameworks/titan/titan.core/Install +ASN1C_PATH := $(HOME)/frameworks/asn1c.denis +#WPCAP_DLL_PATH := /cygdrive/c/windows/system32/npcap/wpcap.dll +#NPCAP_INCLUDE := /cygdrive/c/PROGRA~1/Npcap/sdk/include +#T3Q_PATH=./tools/t3q-v2.0.0b30 +#T3Q_CONFIG=t3q.cfg +#T3D_PATH=./tools/t3d-v2.0.0b30 +#T3D_CONFIG=t3d.cfg +#ITS_CONTAINER=../../../AtsDENM/lib/asn1/cdd/ITS_Container.asn diff --git a/libasn1.mk b/libasn1.mk index a1fcd5a..11fcdb8 100644 --- a/libasn1.mk +++ b/libasn1.mk @@ -1,119 +1,119 @@ -########################################################## -# This Makefile is to build the ASN1 library to be used -# for external codec in Titan -# This Makefile is expected that asn1c compiler is -# installed in the PATHs -########################################################## - -# The name of the library -ASN_LIBRARY = libItsAsn.a - -ifeq (,$(sort $(ASN_FILES))) - $(error ASN_FILES should be specified ) -endif - -#Override ASN1C instalation path -ifneq (, $(ASN1C_PATH)) - ASN1C:=$(ASN1C_PATH)/asn1c/asn1c -S $(ASN1C_PATH)/skeletons -else - ASN1C:=asn1c -endif - -LIB_MAKEFILE=Makefile.am.libasncodec -include $(LIB_MAKEFILE) -OBJS = ${ASN_MODULE_SRCS:.c=.o} -CONVERTER=converter -ASN_CONVERTER_SOURCES := \ - converter-example.c\ - pdu_collection.c -CONVERTER_OBJS=${ASN_CONVERTER_SOURCES:.c=.o} -ifneq ($(strip $(ASN_PDU)),$(firstword $(ASN_PDU))) - HAS_PDU_COLLECTION := -DASN_PDU_COLLECTION -endif - -CFLAGS += $(ASN_MODULE_CFLAGS) -DPDU=$(firstword $(ASN_PDU)) $(HAS_PDU_COLLECTION) -fPIC -I. -CC = gcc -std=c99 -GEN_EXAMPLE=-no-gen-example -ifeq (yes,$(DEBUG)) - CFLAGS += -g -O0 -DASN_EMIT_DEBUG=1 -endif -ASN_SRC_FILES := $(addprefix $(TOP_DIR)/, $(ASN_FILES)) - -all: $(ASN_LIBRARY) - -$(LIB_MAKEFILE): $(ASN_SRC_FILES) Makefile - $(ASN1C) $(GEN_EXAMPLE) $(addprefix -pdu=,$(pdu)) -fcompound-names $(ASN_SRC_FILES) -# -for n in $(PATCHES); do git apply "$(SCRIPT_DIR)/$$n"; done - -$(CONVERTER): $(ASN_LIBRARY) $(CONVERTER_OBJS) - $(CC) $(CFLAGS) -o $@ $(CONVERTER_OBJS) $(ASN_LIBRARY) $(LIBS) - -$(ASN_LIBRARY): ${ASN_MODULE_SRCS:.c=.o} - ar rcs $@ $^ -# $(CC) $(CFLAGS) -o $@ $^ -shared $(LDFLAGS) $(LIBS) - -.SUFFIXES: -.SUFFIXES: .c .o - -.c.o: - $(CC) $(CFLAGS) -o $@ -c $< - -clean: - rm -f $(CONVERTER) $(ASN_LIBRARY) - rm -f $(OBJS) $(CONVERTER_OBJS) - -regen: clear-asn1c $(LIB_MAKEFILE) -clear-asn1c: - rm -f $(LIB_MAKEFILE) - -########################################################## - -$(TOP_DIR)/build/asn1/ISO_TS_14816/AVIAEINumberingAndDataStructures.asn: - mkdir -p "$(dir $@)" - curl 'https://standards.iso.org/iso/14816/ISO14816%20ASN.1%20repository/ISO14816_AVIAEINumberingAndDataStructures.asn' | \ - sed -e 's/IssuerIdentifier/AVIAEIIssuerIdentifier/g' > "$@" - -#$(TOP_DIR)/build/asn1/ISO_TS_14906/EfcDsrcApplication.asn: -# mkdir -p "$(dir $@)" -# curl -o "$@" 'https://standards.iso.org/iso/14906/ed-3/en/ISO14906(2018)EfcDsrcApplicationv6.asn' - -#$(TOP_DIR)/build/asn1/ISO_TS_14906/EfcDsrcGeneric.asn: -# mkdir -p "$(dir $@) -# curl -o "$@" 'https://standards.iso.org/iso/14906/ed-3/en/ISO14906(2018)EfcDsrcGenericv7.asn' - -$(TOP_DIR)/build/asn1/ISO_TS_17419/CITSapplMgmtIDs.asn: - mkdir -p "$(dir $@)" - curl -o "$@" 'https://standards.iso.org/iso/ts/17419/TS%2017419%20ASN.1%20repository/TS17419_2014_CITSapplMgmtIDs.asn' - -$(TOP_DIR)/build/asn1/ISO_TS_19091/ISO-TS-19091-addgrp-C-2018-patched.asn: - mkdir -p "$(dir $@)" - curl 'https://standards.iso.org/iso/ts/19091/ed-2/en/ISO-TS-19091-addgrp-C-2018.asn' | \ - sed -e 's/\bHeadingConfidence\b/HeadingConfidenceDSRC/g' \ - -e 's/\bSpeedConfidence\b/SpeedConfidenceDSRC/g' \ - -e 's/\bHeading\b/HeadingDSRC/g' > "$@" - -$(TOP_DIR)/build/asn1/ISO_TS_17419/CITSdataDictionary1.asn: - mkdir -p "$(dir $@)" - curl -o "$@" 'https://standards.iso.org/iso/17419/ed-1/en/17419.1.asn' - -$(TOP_DIR)/build/asn1/ISO_TS_17419/CITSdataDictionary2.asn: - mkdir -p "$(dir $@)" - curl -o "$@" 'https://standards.iso.org/iso/17419/ed-1/en/17419.2.asn' - -#$(TOP_DIR)/build/asn1/ISO_TS_19091/AddGrpC.asn: -#$(TOP_DIR)/build/asn1/ISO_TS_19091/AddGrpC_noCircular.asn: -#$(TOP_DIR)/build/asn1/ISO_TS_19091/DSRC.asn: -#$(TOP_DIR)/build/asn1/ISO_TS_19091/DSRC_REGION_noCircular.asn -#$(TOP_DIR)/build/asn1/ISO_TS_19091/REGION.asn - -$(TOP_DIR)/build/asn1/ISO_TS_19321/IVI.asn: - mkdir -p "$(dir $@)" - curl 'https://standards.iso.org/iso/ts/19321/ed-2/en/ISO19321IVIv2.asn' | \ - sed -e 's/\bCITSdataDictionary1\b/CITSapplMgmtIDs/g' \ - -e 's/,\s*\.\.\.\s*,\s*[0-9]\+/,.../g' \ - > "$@" - -#$(TOP_DIR)/build/asn1/ISO_TS_24534-3/ElectronicRegistrationIdentificationVehicleDataModule.asn: -# mkdir -p "$(dir $@)" -# curl -o "$@" 'https://standards.iso.org/iso/24534/-3/ISO%2024534-3%20ASN.1%20repository/ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule_ForBallot.asn' - +########################################################## +# This Makefile is to build the ASN1 library to be used +# for external codec in Titan +# This Makefile is expected that asn1c compiler is +# installed in the PATHs +########################################################## + +# The name of the library +ASN_LIBRARY = libItsAsn.a + +ifeq (,$(sort $(ASN_FILES))) + $(error ASN_FILES should be specified ) +endif + +#Override ASN1C instalation path +ifneq (, $(ASN1C_PATH)) + ASN1C:=$(ASN1C_PATH)/asn1c/asn1c -S $(ASN1C_PATH)/skeletons +else + ASN1C:=asn1c +endif + +LIB_MAKEFILE=Makefile.am.libasncodec +include $(LIB_MAKEFILE) +OBJS = ${ASN_MODULE_SRCS:.c=.o} +CONVERTER=converter +ASN_CONVERTER_SOURCES := \ + converter-example.c\ + pdu_collection.c +CONVERTER_OBJS=${ASN_CONVERTER_SOURCES:.c=.o} +ifneq ($(strip $(ASN_PDU)),$(firstword $(ASN_PDU))) + HAS_PDU_COLLECTION := -DASN_PDU_COLLECTION +endif + +CFLAGS += $(ASN_MODULE_CFLAGS) -DPDU=$(firstword $(ASN_PDU)) $(HAS_PDU_COLLECTION) -fPIC -I. +CC = gcc -std=c99 +ASN1C_OPTIONS += -no-gen-example -fcompound-names -no-gen-XER -no-gen-JER -no-gen-APER -no-gen-print -no-gen-random-fill +ifeq (yes,$(DEBUG)) + CFLAGS += -g -O0 -DASN_EMIT_DEBUG=1 +endif +ASN_SRC_FILES := $(addprefix $(TOP_DIR)/, $(ASN_FILES)) + +all: $(ASN_LIBRARY) + +$(LIB_MAKEFILE): $(ASN_SRC_FILES) Makefile + $(ASN1C) $(ASN1C_OPTIONS) $(addprefix -pdu=,$(pdu)) $(ASN_SRC_FILES) +# -for n in $(PATCHES); do git apply "$(SCRIPT_DIR)/$$n"; done + +$(CONVERTER): $(ASN_LIBRARY) $(CONVERTER_OBJS) + $(CC) $(CFLAGS) -o $@ $(CONVERTER_OBJS) $(ASN_LIBRARY) $(LIBS) + +$(ASN_LIBRARY): ${ASN_MODULE_SRCS:.c=.o} + ar rcs $@ $^ +# $(CC) $(CFLAGS) -o $@ $^ -shared $(LDFLAGS) $(LIBS) + +.SUFFIXES: +.SUFFIXES: .c .o + +.c.o: + $(CC) $(CFLAGS) -o $@ -c $< + +clean: + rm -f $(CONVERTER) $(ASN_LIBRARY) + rm -f $(OBJS) $(CONVERTER_OBJS) + +regen: clear-asn1c $(LIB_MAKEFILE) +clear-asn1c: + rm -f $(LIB_MAKEFILE) + +########################################################## + +$(TOP_DIR)/./build/asn1/ISO_TS_14816/AVIAEINumberingAndDataStructures.asn: + mkdir -p "$(dir $@)" + curl 'https://standards.iso.org/iso/14816/ISO14816%20ASN.1%20repository/ISO14816_AVIAEINumberingAndDataStructures.asn' | \ + sed -e 's/IssuerIdentifier/AVIAEIIssuerIdentifier/g' > "$@" + +#$(TOP_DIR)/./build/asn1/ISO_TS_14906/EfcDsrcApplication.asn: +# mkdir -p "$(dir $@)" +# curl -o "$@" 'https://standards.iso.org/iso/14906/ed-3/en/ISO14906(2018)EfcDsrcApplicationv6.asn' + +#$(TOP_DIR)/./build/asn1/ISO_TS_14906/EfcDsrcGeneric.asn: +# mkdir -p "$(dir $@) +# curl -o "$@" 'https://standards.iso.org/iso/14906/ed-3/en/ISO14906(2018)EfcDsrcGenericv7.asn' + +$(TOP_DIR)/./build/asn1/ISO_TS_17419/CITSapplMgmtIDs.asn: + mkdir -p "$(dir $@)" + curl -o "$@" 'https://standards.iso.org/iso/ts/17419/TS%2017419%20ASN.1%20repository/TS17419_2014_CITSapplMgmtIDs.asn' + +$(TOP_DIR)/./build/asn1/ISO_TS_19091/ISO-TS-19091-addgrp-C-2018-patched.asn: + mkdir -p "$(dir $@)" + curl 'https://standards.iso.org/iso/ts/19091/ed-2/en/ISO-TS-19091-addgrp-C-2018.asn' | \ + sed -e 's/\bHeadingConfidence\b/HeadingConfidenceDSRC/g' \ + -e 's/\bSpeedConfidence\b/SpeedConfidenceDSRC/g' \ + -e 's/\bHeading\b/HeadingDSRC/g' > "$@" + +$(TOP_DIR)/./build/asn1/ISO_TS_17419/CITSdataDictionary1.asn: + mkdir -p "$(dir $@)" + curl -o "$@" 'https://standards.iso.org/iso/17419/ed-1/en/17419.1.asn' + +$(TOP_DIR)/./build/asn1/ISO_TS_17419/CITSdataDictionary2.asn: + mkdir -p "$(dir $@)" + curl -o "$@" 'https://standards.iso.org/iso/17419/ed-1/en/17419.2.asn' + +#$(TOP_DIR)/./build/asn1/ISO_TS_19091/AddGrpC.asn: +#$(TOP_DIR)/./build/asn1/ISO_TS_19091/AddGrpC_noCircular.asn: +#$(TOP_DIR)/./build/asn1/ISO_TS_19091/DSRC.asn: +#$(TOP_DIR)/./build/asn1/ISO_TS_19091/DSRC_REGION_noCircular.asn +#$(TOP_DIR)/./build/asn1/ISO_TS_19091/REGION.asn + +$(TOP_DIR)/./build/asn1/ISO_TS_19321/IVI.asn: + mkdir -p "$(dir $@)" + curl 'https://standards.iso.org/iso/ts/19321/ed-2/en/ISO19321IVIv2.asn' | \ + sed -e 's/\bCITSdataDictionary1\b/CITSapplMgmtIDs/g' \ + -e 's/,\s*\.\.\.\s*,\s*[0-9]\+/,.../g' \ + > "$@" + +#$(TOP_DIR)/build/asn1/ISO_TS_24534-3/ElectronicRegistrationIdentificationVehicleDataModule.asn: +# mkdir -p "$(dir $@)" +# curl -o "$@" 'https://standards.iso.org/iso/24534/-3/ISO%2024534-3%20ASN.1%20repository/ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule_ForBallot.asn' + diff --git a/titan-test-system-framework b/titan-test-system-framework index b3e32ae..be17c52 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit b3e32ae45e559819ba3eab8ba748a03ff6fdd284 +Subproject commit be17c52ee932ef40c9295b9bef56715d991769b0 diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index f7be84b..955697e 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit f7be84b8706fffe621cdb0871effef3fc19d0a67 +Subproject commit 955697e66a1a6bb6020e3b2ee1cb858450d5d881 diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index 29b249a..62ed972 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit 29b249a105b3546c352a845653b78bcecfd8a999 +Subproject commit 62ed9722368b83a5cd709b61d04748599ff3b9f7 diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index b9a8374..d2893d2 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit b9a8374ae0a4022cd5c785955ac333a02868fa8a +Subproject commit d2893d2b57add5bea68a7ebaaf302437a507bca0 diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 57bdf02..20c9a83 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 57bdf0211e8e70b717d8b23d2ab06f9c55f72041 +Subproject commit 20c9a837b036ac852e3a2036c087d7213d9cbf96 diff --git a/ttcn/LibCommon b/ttcn/LibCommon index fa2b5c7..21bad7c 160000 --- a/ttcn/LibCommon +++ b/ttcn/LibCommon @@ -1 +1 @@ -Subproject commit fa2b5c7d9d2a170e4d876d82ed5e865d925837a7 +Subproject commit 21bad7c51917d19bebdff5b36983e22922421976 diff --git a/ttcn/LibIts b/ttcn/LibIts index f68487c..ef9c9be 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit f68487c477dd1f174cafd5a2f4e2bfc205ba8cfb +Subproject commit ef9c9be29ee12d8fd9418d6abba66044579764c6 -- GitLab From 6234163abc9e76247b7f15d9102782f254759efb Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Tue, 21 Feb 2023 13:43:22 +0100 Subject: [PATCH 044/178] Build AtsCAM Release.2 --- ccsrc/Protocols/Security/module.mk | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ccsrc/Protocols/Security/module.mk b/ccsrc/Protocols/Security/module.mk index 762c892..b77da2c 100644 --- a/ccsrc/Protocols/Security/module.mk +++ b/ccsrc/Protocols/Security/module.mk @@ -10,10 +10,6 @@ sources := certificates_loader.cc \ security_db_record.cc \ security_ecc.cc \ security_services_its.cc \ - ../../../titan-test-system-framework/ccsrc/security/src/sha1.cc \ - ../../../titan-test-system-framework/ccsrc/security/src/sha256.cc \ - ../../../titan-test-system-framework/ccsrc/security/src/sha384.cc \ - ../../../titan-test-system-framework/ccsrc/security/src/hmac.cc \ ifeq (AtsPki, $(ATS)) -- GitLab From 9d610acb39567c628b5cffe8dfc5b90a530af5a9 Mon Sep 17 00:00:00 2001 From: Yann Garcia Date: Tue, 21 Feb 2023 13:16:28 +0000 Subject: [PATCH 045/178] Create release2 branch (devel2) in AtsGeoNetworking --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index c58f39f..5569648 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,7 +16,7 @@ [submodule "ttcn/AtsGeoNetworking"] path = ttcn/AtsGeoNetworking url = https://forge.etsi.org/rep/ITS/ttcn/ats_gn_ts102871-3.git - branch = devel + branch = devel2 [submodule "ttcn/AtsBTP"] path = ttcn/AtsBTP url = https://forge.etsi.org/rep/ITS/ttcn/ats_btp_ts102870-3.git -- GitLab From c20247d6cf0a86c8e258151795f1da823e581f7e Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Tue, 21 Feb 2023 14:19:35 +0100 Subject: [PATCH 046/178] Build AtsDENM Release.2 --- .../ConfigRsuSimulatorLayer.cc | 8 ++++---- .../UpperTester/uppertester_denm_codec.cc | 6 +++--- .../UpperTester/uppertester_denm_layer.cc | 4 ++-- ccsrc/framework/include/params_its.hh | 2 +- etc/AtsDENM/AtsDENM.cfg | 18 +++++++++--------- titan-test-system-framework | 2 +- ttcn/AtsCAM | 2 +- ttcn/AtsDENM | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc index 9f411ab..baa95bc 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc @@ -117,7 +117,7 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmRe encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmTriggerResult)); const LibItsDenm__TypesAndValues::UtDenmTriggerResult &r = send_par.utDenmTriggerResult(); encoding_buffer.put_c((unsigned char)static_cast(r.result())); - OCTETSTRING os = int2oct(r.actionId().originatingStationID(), 4); + OCTETSTRING os = int2oct(r.actionId().originatingStationId(), 4); encoding_buffer.put_s(os.lengthof(), static_cast(os)); os = int2oct(r.actionId().sequenceNumber(), 2); encoding_buffer.put_s(os.lengthof(), static_cast(os)); @@ -125,7 +125,7 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmRe encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmUpdateResult)); const LibItsDenm__TypesAndValues::UtDenmUpdateResult &r = send_par.utDenmUpdateResult(); encoding_buffer.put_c((unsigned char)static_cast(r.result())); - OCTETSTRING os = int2oct(r.actionId().originatingStationID(), 4); + OCTETSTRING os = int2oct(r.actionId().originatingStationId(), 4); encoding_buffer.put_s(os.lengthof(), static_cast(os)); os = int2oct(r.actionId().sequenceNumber(), 2); encoding_buffer.put_s(os.lengthof(), static_cast(os)); @@ -668,7 +668,7 @@ int ConfigRsuSimulatorLayer::process_ut_denm_update(const OCTETSTRING &data, par loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_denm_update: flag=%02x", flag); LibItsDenm__TypesAndValues::UtDenmUpdate update; // See ETSI TR 103 099 Cause C.4.1 GenerateDenmEvent // Statuion ID - update.actionId().originatingStationID() = oct2int(OCTETSTRING(4, p)); + update.actionId().originatingStationId() = oct2int(OCTETSTRING(4, p)); p += 4; // SequenceNumber update.actionId().sequenceNumber() = oct2int(OCTETSTRING(2, p)); @@ -754,7 +754,7 @@ int ConfigRsuSimulatorLayer::process_ut_denm_termination(const OCTETSTRING &data unsigned char msg_id = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_denm_termination: msg_id=%02x", msg_id); LibItsDenm__TypesAndValues::UtDenmTermination termination; - termination.actionId().originatingStationID() = oct2int(OCTETSTRING(4, p)); + termination.actionId().originatingStationId() = oct2int(OCTETSTRING(4, p)); p += 4; termination.actionId().sequenceNumber() = oct2int(OCTETSTRING(2, p)); diff --git a/ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc index 3c3646f..8869130 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc @@ -178,7 +178,7 @@ int uppertester_denm_codec::encode_(const Base_Type &type, const TTCN_Typedescri const OPTIONAL &o = dynamic_cast &>(type); const INTEGER & i = static_cast(*o.get_opt_value()); encoding_buffer.put_string(int2oct(i, 2)); - } else if (s.rfind(".originatingStationID") != string::npos) { + } else if (s.rfind(".originatingStationId") != string::npos) { const INTEGER &i = static_cast(type); loggers::get_instance().log_msg("uppertester_denm_codec::encode_: i=", i); encoding_buffer.put_string(int2oct(i, 4)); @@ -256,7 +256,7 @@ int uppertester_denm_codec::decode(const OCTETSTRING &data, LibItsDenm__TypesAnd ptr += 1; OCTETSTRING os(4, ptr); ptr += 4; - r.actionId().originatingStationID() = oct2int(os); + r.actionId().originatingStationId() = oct2int(os); os = OCTETSTRING(2, ptr); r.actionId().sequenceNumber() = oct2int(os); msg.utDenmTriggerResult() = r; @@ -267,7 +267,7 @@ int uppertester_denm_codec::decode(const OCTETSTRING &data, LibItsDenm__TypesAnd ptr += 1; OCTETSTRING os(4, ptr); ptr += 4; - r.actionId().originatingStationID() = oct2int(os); + r.actionId().originatingStationId() = oct2int(os); os = OCTETSTRING(2, ptr); r.actionId().sequenceNumber() = oct2int(os); msg.utDenmUpdateResult() = r; diff --git a/ccsrc/Protocols/UpperTester/uppertester_denm_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_denm_layer.cc index c66e67c..128e5cb 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_denm_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_denm_layer.cc @@ -73,7 +73,7 @@ void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmTri loggers::get_instance().log_msg(">>> uppertester_denm_layer::sendMsg", send_par); if (_params[params_its::loopback].compare("1") == 0) { - LibItsDenm__TypesAndValues::UtDenmTriggerResult trigger_result(true, ITS__Container::ActionID(std::stoi(_params[params_its::station_id]), 1)); + LibItsDenm__TypesAndValues::UtDenmTriggerResult trigger_result(true, ETSI__ITS__CDD::ActionId(std::stoi(_params[params_its::station_id]), 1)); LibItsDenm__TypesAndValues::UtDenmResults ut_denm_results; ut_denm_results.utDenmTriggerResult() = trigger_result; to_all_upper_ports(ut_denm_results, p_params); @@ -90,7 +90,7 @@ void uppertester_denm_layer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmUpd loggers::get_instance().log_msg(">>> uppertester_denm_layer::sendMsg", send_par); if (_params[params_its::loopback].compare("1") == 0) { - LibItsDenm__TypesAndValues::UtDenmUpdateResult update_result(true, ITS__Container::ActionID(std::stoi(_params[params_its::station_id]), 1)); + LibItsDenm__TypesAndValues::UtDenmUpdateResult update_result(true, ETSI__ITS__CDD::ActionId(std::stoi(_params[params_its::station_id]), 1)); LibItsDenm__TypesAndValues::UtDenmResults ut_denm_results; ut_denm_results.utDenmUpdateResult() = update_result; to_all_upper_ports(ut_denm_results, p_params); diff --git a/ccsrc/framework/include/params_its.hh b/ccsrc/framework/include/params_its.hh index b96dd3f..1c63929 100644 --- a/ccsrc/framework/include/params_its.hh +++ b/ccsrc/framework/include/params_its.hh @@ -44,7 +44,7 @@ public: //! \publicsection static const std::string& longitude; //! Test system Longitude parameter name static const std::string& expiry; //! Test system GeoNetworking Lifetime parameter name (in ms) - static const std::string& station_id; //! To indicate to the peer ITS_Container::stationID + static const std::string& station_id; //! To indicate to the peer ETSI-ITS-CDD::StationIs static const std::string& device_mode; //! To indicate to the lower layer to act as a standalone device static const std::string& secured_mode; //! To indicate to the lower layer to apply signature on message exchanges as defined in IEEE 1609.2& ETSI TS 102 965 diff --git a/etc/AtsDENM/AtsDENM.cfg b/etc/AtsDENM/AtsDENM.cfg index db45356..6cfabd6 100644 --- a/etc/AtsDENM/AtsDENM.cfg +++ b/etc/AtsDENM/AtsDENM.cfg @@ -97,9 +97,9 @@ ItsDenm_TestCases.TC_DEN_MSGF_BV_01 #ItsDenm_TestCases.TC_DEN_MSGF_BV_02 # Check that DEN Basic Service generates a new DENM on reception of a valid AppDENM_Trigger request #ItsDenm_TestCases.TC_DEN_EVGN_BV_01 -# Check that a new ActionID value is assigned for each newly generated DENM +# Check that a new ActionId value is assigned for each newly generated DENM #ItsDenm_TestCases.TC_DEN_EVGN_BV_02 -# Check that a newly created ActionID contains the StationID of the originating ITS-S that detected the event +# Check that a newly created ActionId contains the StationID of the originating ITS-S that detected the event #ItsDenm_TestCases.TC_DEN_EVGN_BV_03 # Check that Cause and subcause values included in DENM as provided by application #ItsDenm_TestCases.TC_DEN_EVGN_BV_04 @@ -161,19 +161,19 @@ ItsDenm_TestCases.TC_DEN_MSGF_BV_01 #ItsDenm_TestCases.TC_DEN_SSP_BV_01_01 # Check that IUT does not send a DENM if it is not permitted by signing certificate #ItsDenm_TestCases.TC_DEN_SSP_BV_01_02 -# Check that receiving ITS-S transmits DENM to application if it concerns an unknown ActionID and if it is not a termination DENM +# Check that receiving ITS-S transmits DENM to application if it concerns an unknown ActionId and if it is not a termination DENM #ItsDenm_TestCases.TC_DEN_MSRV_BV_01 -#Check that receiving ITS-S transmits DENM to application if it concerns a known ActionID and referenceTime is greater than highest value received for this ActionID +#Check that receiving ITS-S transmits DENM to application if it concerns a known ActionId and referenceTime is greater than highest value received for this ActionId #ItsDenm_TestCases.TC_DEN_MSRV_BV_02 -# Check that receiving ITS-S discards termination DENM if it concerns an unknown ActionID (own actionID) +# Check that receiving ITS-S discards termination DENM if it concerns an unknown ActionId (own actionID) #ItsDenm_TestCases.TC_DEN_MSRV_BO_03 -# Check that receiving ITS-S discards termination DENM if it concerns an unknown ActionID (other actionID) +# Check that receiving ITS-S discards termination DENM if it concerns an unknown ActionId (other actionID) #ItsDenm_TestCases.TC_DEN_MSRV_BO_04 -# Check that receiving ITS-S discards DENM if referenceTime is lower than highest value received for this ActionID +# Check that receiving ITS-S discards DENM if referenceTime is lower than highest value received for this ActionId #ItsDenm_TestCases.TC_DEN_MSRV_BO_05 -# Check that receiving ITS-S discards DENM if detectionTime is smaller than highest value received for this ActionID +# Check that receiving ITS-S discards DENM if detectionTime is smaller than highest value received for this ActionId #ItsDenm_TestCases.TC_DEN_MSRV_BO_06 -# Check that receiving ITS-S transmits DENM to application if it concerns a known ActionID and referenceTime is equal to highest received value and detectionTime is more recent +# Check that receiving ITS-S transmits DENM to application if it concerns a known ActionId and referenceTime is equal to highest received value and detectionTime is more recent #ItsDenm_TestCases.TC_DEN_MSRV_BV_07 # Check that receiving ITS-S discards DENM for new event if SSP value of the signing certificate is not consistent with the causeCode #ItsDenm_TestCases.TC_DEN_MSRV_BO_08_01 diff --git a/titan-test-system-framework b/titan-test-system-framework index be17c52..fce4d88 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit be17c52ee932ef40c9295b9bef56715d991769b0 +Subproject commit fce4d880afefa0c32a033eba6e4a7e28c4a075b1 diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 955697e..de160d2 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 955697e66a1a6bb6020e3b2ee1cb858450d5d881 +Subproject commit de160d2d8c76ed51cd3326e1e50ad5514ca96375 diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index 62ed972..e7cec1b 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit 62ed9722368b83a5cd709b61d04748599ff3b9f7 +Subproject commit e7cec1b9450433925e21f586d92ba67a9eba9bec -- GitLab From 6ece43b884c8249cd7b2669512b2ab9fd2ab030d Mon Sep 17 00:00:00 2001 From: Yann Garcia Date: Tue, 21 Feb 2023 13:25:42 +0000 Subject: [PATCH 047/178] Create release2 branch (devel2) in AtsIS --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 5569648..3378d21 100644 --- a/.gitmodules +++ b/.gitmodules @@ -32,7 +32,7 @@ [submodule "ttcn/AtsIS"] path = ttcn/AtsIS url = https://forge.etsi.org/rep/ITS/ttcn/ats_ts103191-3.git - branch = devel + branch = devel2 [submodule "ttcn/AtsSecurity"] path = ttcn/AtsSecurity url = https://forge.etsi.org/rep/ITS/ttcn/ats_sec_ts103096-3.git -- GitLab From a5998a72a5cef31ab53c6e4309528c9a748997c3 Mon Sep 17 00:00:00 2001 From: Yann Garcia Date: Tue, 21 Feb 2023 15:13:45 +0000 Subject: [PATCH 048/178] Create release2 branch (devel2) for AtsPki and AtsSecurity --- .gitmodules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 3378d21..97795cf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -28,7 +28,7 @@ [submodule "ttcn/AtsPki"] path = ttcn/AtsPki url = https://forge.etsi.org/rep/ITS/ttcn/ats_pki_ts103525-3.git - branch = devel + branch = devel2 [submodule "ttcn/AtsIS"] path = ttcn/AtsIS url = https://forge.etsi.org/rep/ITS/ttcn/ats_ts103191-3.git @@ -36,7 +36,7 @@ [submodule "ttcn/AtsSecurity"] path = ttcn/AtsSecurity url = https://forge.etsi.org/rep/ITS/ttcn/ats_sec_ts103096-3.git - branch = devel + branch = devel2 [submodule "ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module"] path = ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module url = https://github.com/eclipse/titan.TestPorts.Common_Components.Abstract_Socket.git -- GitLab From d29fa8cc2b0d71815b5e22a5f8ac5e91b0ed4822 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Tue, 21 Feb 2023 16:16:05 +0100 Subject: [PATCH 049/178] Build AtsIS Release.2 --- libasn1.mk | 3 +++ ttcn/AtsIS | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libasn1.mk b/libasn1.mk index 11fcdb8..32b2300 100644 --- a/libasn1.mk +++ b/libasn1.mk @@ -111,6 +111,9 @@ $(TOP_DIR)/./build/asn1/ISO_TS_19321/IVI.asn: curl 'https://standards.iso.org/iso/ts/19321/ed-2/en/ISO19321IVIv2.asn' | \ sed -e 's/\bCITSdataDictionary1\b/CITSapplMgmtIDs/g' \ -e 's/,\s*\.\.\.\s*,\s*[0-9]\+/,.../g' \ + -e 's/ITS-Container/ETSI-ITS-CDD/g' \ + -e 's/ts (102894)/102894/g' \ + -e 's/version (2)/major-version-3 (3) minor-version-1 (1)/g' \ > "$@" #$(TOP_DIR)/build/asn1/ISO_TS_24534-3/ElectronicRegistrationIdentificationVehicleDataModule.asn: diff --git a/ttcn/AtsIS b/ttcn/AtsIS index 09adecf..267159f 160000 --- a/ttcn/AtsIS +++ b/ttcn/AtsIS @@ -1 +1 @@ -Subproject commit 09adecf68209c12c080b0457b41ef361c26a723d +Subproject commit 267159f3a7427c70e56632b041ef7fc794d122ae -- GitLab From f36f63e923bc20bdd5e8e49259105f00c73c9de2 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Tue, 21 Feb 2023 20:24:21 +0100 Subject: [PATCH 050/178] Build AtsSecurity Release.2 --- ccsrc/Protocols/Security/security_services_its.cc | 2 +- ttcn/AtsIS | 2 +- ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- ttcn/LibIts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ccsrc/Protocols/Security/security_services_its.cc b/ccsrc/Protocols/Security/security_services_its.cc index 1a6c651..b8c3ab3 100644 --- a/ccsrc/Protocols/Security/security_services_its.cc +++ b/ccsrc/Protocols/Security/security_services_its.cc @@ -695,7 +695,7 @@ int security_services_its::encrypt_gn_payload(const OCTETSTRING &p_unsecured_gn_ } OCTETSTRING nonce = _ec_keys_enc.get()->nonce(); OCTETSTRING tag = _ec_keys_enc.get()->tag(); - Ieee1609Dot2::AesCcmCiphertext aes_128_ccm(nonce, enc_message + tag); // Add tag at the end of the ciphered text + Ieee1609Dot2::One28BitCcmCiphertext aes_128_ccm(nonce, enc_message + tag); // Add tag at the end of the ciphered text // 6. Build SymmetricCiphertext Ieee1609Dot2::SymmetricCiphertext cipher_text; cipher_text.aes128ccm() = aes_128_ccm; diff --git a/ttcn/AtsIS b/ttcn/AtsIS index 267159f..d745e1b 160000 --- a/ttcn/AtsIS +++ b/ttcn/AtsIS @@ -1 +1 @@ -Subproject commit 267159f3a7427c70e56632b041ef7fc794d122ae +Subproject commit d745e1b4f9e010bbc12d9fffc060380b4abec9ff diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 20c9a83..7989a53 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 20c9a837b036ac852e3a2036c087d7213d9cbf96 +Subproject commit 7989a53a5542a10f3def57fff423bdda9027df1c diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 4755dd8..c90e6ab 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 4755dd8c2aec84d2601c138a44a27a4ccd9dec47 +Subproject commit c90e6abd1445a1a59e77be0fef03e3a5642ff013 diff --git a/ttcn/LibIts b/ttcn/LibIts index ef9c9be..aaa999c 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit ef9c9be29ee12d8fd9418d6abba66044579764c6 +Subproject commit aaa999c5b6542e16fa11fe5fafe082a1e076b456 -- GitLab From 9967efb6099c71a541c89bceb121f5c70f7e8b61 Mon Sep 17 00:00:00 2001 From: Yann Garcia Date: Tue, 21 Feb 2023 19:35:49 +0000 Subject: [PATCH 051/178] Create devel2 branch for AtsMBR --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 97795cf..1f64343 100644 --- a/.gitmodules +++ b/.gitmodules @@ -47,4 +47,4 @@ [submodule "ttcn/AtsMBR"] path = ttcn/AtsMBR url = https://forge.etsi.org/rep/ITS/ttcn/mbr_ts_103759.git - branch = devel + branch = devel2 -- GitLab From f4e58675e2dba1d92fb6eb03554224439079695a Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Wed, 22 Feb 2023 09:10:12 +0100 Subject: [PATCH 052/178] Update Virtualization with Release2 + README files --- .jenkins.sh | 2 +- README.md | 2 +- ttcn/AtsGeoNetworking | 2 +- ttcn/AtsMBR | 2 +- .../module | 2 +- virtualization/docker-dev/Dockerfile | 25 ++++++ .../Dockerfile.stfubuntu | 0 virtualization/docker-dev/README.md | 66 ++++++++++++++++ .../{docker => docker-dev}/build.sh | 4 +- .../home/etc/init.d/10-titan.sh | 0 .../home/etc/init.d/30-asn1c.sh | 0 .../docker-dev/home/etc/init.d/40-ttf024.sh | 65 ++++++++++++++++ .../home/etc/init.d/45-certgen.sh | 0 .../home/etc/init.d/50-ats.sh | 0 .../home/etc/init.d/60-doxygen.sh | 0 .../home/etc/titan_repos.txt | 0 virtualization/{docker => docker-dev}/run.sh | 2 +- virtualization/docker/Dockerfile | 77 +++++++++++++------ virtualization/docker/README.md | 70 +++++++++++------ virtualization/docker/docker-entrypoint.sh | 58 ++++++++++++++ virtualization/docker/docker-run.sh | 14 ++++ .../docker/home/etc/init.d/40-ttf011.sh | 49 ------------ virtualization/vagrant/provisioner.bash | 24 +++++- 23 files changed, 355 insertions(+), 109 deletions(-) create mode 100644 virtualization/docker-dev/Dockerfile rename virtualization/{docker => docker-dev}/Dockerfile.stfubuntu (100%) create mode 100644 virtualization/docker-dev/README.md rename virtualization/{docker => docker-dev}/build.sh (72%) rename virtualization/{docker => docker-dev}/home/etc/init.d/10-titan.sh (100%) rename virtualization/{docker => docker-dev}/home/etc/init.d/30-asn1c.sh (100%) create mode 100755 virtualization/docker-dev/home/etc/init.d/40-ttf024.sh rename virtualization/{docker => docker-dev}/home/etc/init.d/45-certgen.sh (100%) rename virtualization/{docker => docker-dev}/home/etc/init.d/50-ats.sh (100%) rename virtualization/{docker => docker-dev}/home/etc/init.d/60-doxygen.sh (100%) rename virtualization/{docker => docker-dev}/home/etc/titan_repos.txt (100%) rename virtualization/{docker => docker-dev}/run.sh (82%) create mode 100755 virtualization/docker/docker-entrypoint.sh create mode 100755 virtualization/docker/docker-run.sh delete mode 100755 virtualization/docker/home/etc/init.d/40-ttf011.sh diff --git a/.jenkins.sh b/.jenkins.sh index ee78b86..ead945d 100755 --- a/.jenkins.sh +++ b/.jenkins.sh @@ -24,7 +24,7 @@ fi if [ "$1" == "--remove" ] then - docker rmi --force etsiforge/etsi-its-ts:latest + docker rmi --force etsiforge/etsi-its-ts-r2:latest fi cd $run_dir diff --git a/README.md b/README.md index 7a55521..e56c1cb 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## General Information -This repositories contains the test specifications and test adapter code for ETSI ITS protocols testing. +This repositories contains the test specifications and test adapter code for ETSI ITS protocols testing, Release 2. ETSI ITS protocols project supports: - ETSI EN 302 637-2: "Intelligent Transport Systems (ITS); Vehicular Communications; Basic Set of Applications; Part 2: Specification of Cooperative Awareness Basic Service" - ETSI EN 102 637-3: "Intelligent Transport Systems (ITS); Vehicular Communications; Basic Set of Applications; Part 3: Specifications of Decentralized Environmental Notification Basic Service" diff --git a/ttcn/AtsGeoNetworking b/ttcn/AtsGeoNetworking index a54b3ec..81241d1 160000 --- a/ttcn/AtsGeoNetworking +++ b/ttcn/AtsGeoNetworking @@ -1 +1 @@ -Subproject commit a54b3ec55786329066a95b83c1acb7150d1c51b1 +Subproject commit 81241d1ecc39905b334f095ee3f063c6d1ecf94e diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index d2893d2..5f65c51 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit d2893d2b57add5bea68a7ebaaf302437a507bca0 +Subproject commit 5f65c519abc2ece32919371562378b83260a89ef diff --git a/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module b/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module index affc1fa..732c993 160000 --- a/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module +++ b/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module @@ -1 +1 @@ -Subproject commit affc1fa4e6497ff138b79a958caa79532fba6857 +Subproject commit 732c9934d2c87966b5ab9ba4e6886f353d5e4ace diff --git a/virtualization/docker-dev/Dockerfile b/virtualization/docker-dev/Dockerfile new file mode 100644 index 0000000..69a8282 --- /dev/null +++ b/virtualization/docker-dev/Dockerfile @@ -0,0 +1,25 @@ +FROM stfubuntu:20.04 + +LABEL ETSI ITS +LABEL description="TS.ITS Docker Image" + +ENV TERM=linux \ + HOME=/home/etsi \ + HOSTNAME=docker-titan-TS.ITS + +COPY home /home/etsi + +RUN cd /home/etsi \ + && chown -R etsi:etsi . \ + && ls ./etc/init.d/*.sh | while read S; do chmod 0750 "$S" || exit 1; done + +USER etsi + +RUN cd ${HOME} \ + && export PATH=$HOME/bin:$PATH \ + && ls ${HOME}/etc/init.d/*.sh | while read S; do /bin/bash -c "$S" || exit 1; done \ + && rm -fr ${HOME}/etc + +CMD ["/bin/bash"] + +# That's all Floks diff --git a/virtualization/docker/Dockerfile.stfubuntu b/virtualization/docker-dev/Dockerfile.stfubuntu similarity index 100% rename from virtualization/docker/Dockerfile.stfubuntu rename to virtualization/docker-dev/Dockerfile.stfubuntu diff --git a/virtualization/docker-dev/README.md b/virtualization/docker-dev/README.md new file mode 100644 index 0000000..388edf6 --- /dev/null +++ b/virtualization/docker-dev/README.md @@ -0,0 +1,66 @@ +# HOWTO build docker images + +## General imformation + +Pre-requisites on your host machine: + +- Install [Docker](https://docs.docker.com/install/) + +#### From Windows host: + +- Install [Virtualbox](https://www.virtualbox.org/manual/ch01.html) +- Install any X Server. For example [VcXsrv](https://sourceforge.net/projects/vcxsrv/) + +#### From Mac host: + +- Install [Virtualbox](https://www.virtualbox.org/manual/ch01.html) +- Install [XQuartz](https://www.xquartz.org) + +#### From Linux host: + +- No other requirements + +## Build docker image + +For Windows host, rename ```build.cmd.a``` and ```run.cmd.a``` to ```build.cmd``` and ```run.cmd``` respectivelly. + +Special scrips ```build.sh``` (or ```build.cmd```) can be executed to automatically build all necessary images. + +There are several build stages: + +1. Build STF Ubuntu 18.04 image +2. Install Titan from Github +3. Install Eclipse and Titan Eclipse plugin into ~/frameworks/titan +4. Install asn1c into ~/frameworks/asn1c +5. Checkout TS.ITS sources from ETSI svn repository using default credentials +6. Build ASN.1 recoder library +7. Build certificate generation tool + +## Import and build ITS project + +### Run Docker image + +#### From Windows host: + +1. Authorize Docker container to interact with the XServer: +Go to the X Server installation directory and add the Docker container ip address to the file ```X0.hosts```: +``` +localhost +inet6:localhost +192.168.99.100 +``` + +Execute ```run.cmd``` or launch a command line window and run the command + +```docker run -it --net=host -e DISPLAY=192.168.99.1:0 etsiforge/etsi-its-ts-r2``` + +NOTE: Modify the IP address in the command for the address of 'VirtualBox Hot-Only Network'. + +#### From Linux host: + +Execute ```run.sh``` or launch a command line window and run the command + +```sh +docker run -it --net=host -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix etsiforge/etsi-its-ts-r2 +``` + diff --git a/virtualization/docker/build.sh b/virtualization/docker-dev/build.sh similarity index 72% rename from virtualization/docker/build.sh rename to virtualization/docker-dev/build.sh index 122590f..c480087 100755 --- a/virtualization/docker/build.sh +++ b/virtualization/docker-dev/build.sh @@ -16,10 +16,10 @@ if [ -z `docker images -q stfubuntu` ]; then docker build --no-cache --tag stfubuntu:20.04 -f Dockerfile.stfubuntu --force-rm . || exit 1 fi -docker build --no-cache --tag etsiforge/etsi-its-ts --force-rm . || ( echo "Docker build failed: $?"; exit 1 ) +docker build --no-cache --tag etsiforge/-r2 --force-rm . || ( echo "Docker build failed: $?"; exit 1 ) docker images -docker inspect etsiforge/etsi-its-ts:latest || ( echo "Docker inspect failed: $?"; exit 1 ) +docker inspect etsiforge/etsi-its-ts-r2:latest || ( echo "Docker inspect failed: $?"; exit 1 ) # That's all Floks exit 0 diff --git a/virtualization/docker/home/etc/init.d/10-titan.sh b/virtualization/docker-dev/home/etc/init.d/10-titan.sh similarity index 100% rename from virtualization/docker/home/etc/init.d/10-titan.sh rename to virtualization/docker-dev/home/etc/init.d/10-titan.sh diff --git a/virtualization/docker/home/etc/init.d/30-asn1c.sh b/virtualization/docker-dev/home/etc/init.d/30-asn1c.sh similarity index 100% rename from virtualization/docker/home/etc/init.d/30-asn1c.sh rename to virtualization/docker-dev/home/etc/init.d/30-asn1c.sh diff --git a/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh b/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh new file mode 100755 index 0000000..48ae46c --- /dev/null +++ b/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +#set -e +set -vx + +echo -e "*****************************\n* Checkout TS.ITS sources\n*****************************\n" +cd ${HOME}/dev || exit 1 + +git clone --recurse-submodules --single-branch --branch ttf_t024 https://forge.etsi.org/rep/ITS/TS.ITS.git TS.ITS +cd ./TS.ITS +for i in `find ./ttcn -type d -name "Ats*"` +do + cd $i + git checkout devel2 + cd - +done +for i in `find ./ttcn/Ats* -type d -name "asn1"` +do + cd $i + git checkout testing2 + if [ -f ETSI-ITS-CDD.asn ] + then + ln -sf ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn + elif [ -f IVIM-PDU-Descriptions.asn ] + then + ln -sf IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn + ln -sf MAPEM-PDU-Descriptions.asn MAPEM_PDU_Descriptions.asn + ln -sf RTCMEM-PDU-Descriptions.asn RTCMEM_PDU_Descriptions.asn + ln -sf SPATEM-PDU-Descriptions.asn SPATEM_PDU_Descriptions.asn + ln -sf SREM-PDU-Descriptions.asn SREM_PDU_Descriptions.asn + ln -sf SSEM-PDU-Descriptions.asn SSEM_PDU_Descriptions.asn + ln -sf iso-patched/'ISO14906(2018)EfcDsrcApplicationv6-patched.asn' iso-patched/EfcDsrcApplication.asn + ln -sf iso-patched/'ISO14906(2018)EfcDsrcGenericv7-patched.asn' iso-patched/EfcDsrcGeneric.asn + ln -sf iso-patched/ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn iso-patched/ElectronicRegistrationIdentificationVehicleDataModule.asn + ln -sf iso-patched/ISO14823-missing.asn iso-patched/GDD.asn + fi + SUB_DIRS=`find . -type d` + if [ "SUB_DIRS" != "" ] + then + for j in $SUB_DIRS + do + cd $j + git checkout testing2 + cd - + done + fi + cd - +done +cd ${HOME}/dev/TS.ITS/titan-test-system-framework +git checkout devel +cd ./ttcn/LibHttp +ln -sf module_its.mk module.mk +cd ${HOME}/dev/TS.ITS/ttcn/LibIts +git checkout devel2 + +echo -e "*****************************\n* Setup environment\n*****************************\n" +cd ${HOME}/dev/TS.ITS/scripts +chmod 775 *.bash devenv.bash.* +cd ${HOME} +ln -sf ${HOME}/dev/TS.ITS/scripts/devenv.bash.ubuntu ${HOME}/devenv.bash +ls -ltr ${HOME} + +cd ${HOME} + +exit 0 diff --git a/virtualization/docker/home/etc/init.d/45-certgen.sh b/virtualization/docker-dev/home/etc/init.d/45-certgen.sh similarity index 100% rename from virtualization/docker/home/etc/init.d/45-certgen.sh rename to virtualization/docker-dev/home/etc/init.d/45-certgen.sh diff --git a/virtualization/docker/home/etc/init.d/50-ats.sh b/virtualization/docker-dev/home/etc/init.d/50-ats.sh similarity index 100% rename from virtualization/docker/home/etc/init.d/50-ats.sh rename to virtualization/docker-dev/home/etc/init.d/50-ats.sh diff --git a/virtualization/docker/home/etc/init.d/60-doxygen.sh b/virtualization/docker-dev/home/etc/init.d/60-doxygen.sh similarity index 100% rename from virtualization/docker/home/etc/init.d/60-doxygen.sh rename to virtualization/docker-dev/home/etc/init.d/60-doxygen.sh diff --git a/virtualization/docker/home/etc/titan_repos.txt b/virtualization/docker-dev/home/etc/titan_repos.txt similarity index 100% rename from virtualization/docker/home/etc/titan_repos.txt rename to virtualization/docker-dev/home/etc/titan_repos.txt diff --git a/virtualization/docker/run.sh b/virtualization/docker-dev/run.sh similarity index 82% rename from virtualization/docker/run.sh rename to virtualization/docker-dev/run.sh index b4cb2df..c223af1 100755 --- a/virtualization/docker/run.sh +++ b/virtualization/docker-dev/run.sh @@ -5,7 +5,7 @@ #set -e set -vx -docker run --interactive --tty --rm --publish 2222:22 --env DISPLAY=$DISPLAY --volume /tmp/.X11-unix:/tmp/.X11-unix --cap-add=NET_RAW --cap-add=NET_ADMIN etsiforge/etsi-its-ts:latest +docker run --interactive --tty --rm --publish 2222:22 --env DISPLAY=$DISPLAY --volume /tmp/.X11-unix:/tmp/.X11-unix --cap-add=NET_RAW --cap-add=NET_ADMIN etsiforge/etsi-its-ts-r2:latest # That's all Floks exit 0 diff --git a/virtualization/docker/Dockerfile b/virtualization/docker/Dockerfile index 69a8282..5a464e6 100644 --- a/virtualization/docker/Dockerfile +++ b/virtualization/docker/Dockerfile @@ -1,25 +1,56 @@ -FROM stfubuntu:20.04 - -LABEL ETSI ITS -LABEL description="TS.ITS Docker Image" - -ENV TERM=linux \ - HOME=/home/etsi \ - HOSTNAME=docker-titan-TS.ITS - -COPY home /home/etsi - -RUN cd /home/etsi \ - && chown -R etsi:etsi . \ - && ls ./etc/init.d/*.sh | while read S; do chmod 0750 "$S" || exit 1; done - +FROM alpine:latest + +# Install dependencies +RUN apk update && \ + apk add --no-cache autoconf automake sudo make git g++ diffutils expect openssl-dev libxml2-dev libxml2-utils libxslt-dev libtool ncurses-dev jsoncpp-dev readline-dev flex bison perl libexecinfo-dev bash libedit libedit-dev lksctp-tools lksctp-tools-dev libpcap-dev + +# Create user and sudouser +RUN \ + addgroup -g 1000 etsi && \ + adduser -S -D -u 1000 -G etsi -h /home/etsi -s /bin/bash etsi && \ + echo "etsi:etsi" | chpasswd && \ + echo "etsi ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers || exit 1 USER etsi -RUN cd ${HOME} \ - && export PATH=$HOME/bin:$PATH \ - && ls ${HOME}/etc/init.d/*.sh | while read S; do /bin/bash -c "$S" || exit 1; done \ - && rm -fr ${HOME}/etc - -CMD ["/bin/bash"] - -# That's all Floks +# Setup Hosts file at the boot time +RUN \ + echo 'sudo sh -c "cp /etc/hosts /etc/append && (echo \"127.0.1.1 $HOSTNAME\"; cat /etc/append) > /etc/hosts"' >> /home/etsi/.bashrc \ + echo 'sh' >> /home/etsi/.bashrc || exit 1 + +# Install asn1.c and Titan +WORKDIR /home/etsi +RUN \ + mkdir -p frameworks dev tmp \ + && cd frameworks \ + && git clone --branch=vlm_test https://github.com/fillabs/asn1c.git ./asn1c \ + && cd ./asn1c \ + && autoreconf -iv && ./configure --prefix=${HOME} && make install \ + && cd - \ + && git clone https://github.com/eclipse/titan.core.git || exit 1 +WORKDIR /home/etsi/frameworks/titan.core/ + +# Setup ENV variables +ENV TTCN3_DIR=/home/etsi/frameworks/titan.core/Install +ENV PATH=$TTCN3_DIR/bin:$PATH \ + LD_LIBRARY_PATH=$TTCN3_DIR/lib:$LD_LIBRARY_PATH + +# Set flags +RUN \ + echo "ALPINE_LINUX=yes" > Makefile.personal && \ + echo "TTCN3_DIR=$TTCN3_DIR" >> Makefile.personal && \ + echo "JNI=no" >> Makefile.personal && \ + echo "GUI=no" >> Makefile.personal && \ + echo "DEBUG=no" >> Makefile.personal || exit 1 + +# Build Titan +RUN \ + sed --in-place 's/LINUX_LIBS := -lxml2/LINUX_LIBS := -lxml2 -lpthread/g' ./core/Makefile && \ + make install && make clean || exit 1 + +WORKDIR /home/etsi/dev + +EXPOSE 80/tcp 443/tcp 12340-12349/udp + +ENTRYPOINT ["/home/yann/dev/cise/virtualization/docker/docker-entrypoint.sh"] + +CMD ["help"] \ No newline at end of file diff --git a/virtualization/docker/README.md b/virtualization/docker/README.md index 7e6b794..16cd5e7 100644 --- a/virtualization/docker/README.md +++ b/virtualization/docker/README.md @@ -22,45 +22,65 @@ Pre-requisites on your host machine: ## Build docker image -For Windows host, rename ```build.cmd.a``` and ```run.cmd.a``` to ```build.cmd``` and ```run.cmd``` respectivelly. +In this configuration, TITAN compiler is located on a Docker image and the sources and the outputs are located on the host. -Special scrips ```build.sh``` (or ```build.cmd```) can be executed to automatically build all necessary images. +Pre-requisites on your host machine: +- Install Docker -There are several build stages: +Procedure on the host machine: +- Open a Terminal +- Clone the ETSI ITS Test System -1. Build STF Ubuntu 18.04 image -2. Install Titan from Github -3. Install Eclipse and Titan Eclipse plugin into ~/frameworks/titan -4. Install asn1c into ~/frameworks/asn1c -5. Checkout TS.ITS sources from ETSI svn repository using default credentials -6. Build ASN.1 recoder library -7. Build certificate generation tool +```sh +$ git clone --recurse-submodules --single-branch https://forge.etsi.org/gitlab/ITS/TS.ITS.git +cd ${HOME}/dev/TS.ITS/titan-test-system-framework +git checkout devel +cd ./ttcn/LibHttp +ln -sf module_its.mk module.mk +cd ${HOME}/dev/TS.ITS/ttcn/LibIts +git checkout devel +``` -## Import and build ITS project +- From the ETSI ITS Test System root directory, build the Docker image executing the following commands: -### Run Docker image +```sh +$ cd ./virtualization/docker +$ docker build --no-cache --tag alpine-its -f Dockerfile --force-rm . +$ docker images +``` -#### From Windows host: +To build the ITS Test Suite, execute the following command: -1. Authorize Docker container to interact with the XServer: -Go to the X Server installation directory and add the Docker container ip address to the file ```X0.hosts```: -``` -localhost -inet6:localhost -192.168.99.100 +```sh +$ ./docker-run.sh build ``` -Execute ```run.cmd``` or launch a command line window and run the command +Possble other options are 'clean' to remove all the build outputs or 'rebuild' to force a build of the Test Suite after a 'clean'. -```docker run -it --net=host -e DISPLAY=192.168.99.1:0 etsiforge/etsi-its-ts``` +To retrieve the list of the available test cases, execute the following command: -NOTE: Modify the IP address in the command for the address of 'VirtualBox Hot-Only Network'. +```sh +$ ./docker-run.sh list +``` -#### From Linux host: +Before to execute the ITS Test Suite, prepare, edit and update the configuration file (e.g. CAM Test Suite): + +```sh +$ ln -sf ../../etc/AtsCam/AtsCAM_xxx.cf_ ../../etc/AtsCam/AtsCAN.cfg +$ vi ../../etc/AtsCAM/AtsCAM.cfg # To update it +``` -Execute ```run.sh``` or launch a command line window and run the command +To execute the ITS Test Suite, execute the following command: ```sh -docker run -it --net=host -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix etsiforge/etsi-its-ts +$ ./docker-run.sh run ``` +Notes: +- The ITS Test System is listening on port 442 +- Updating the file etc/AtsCAM.cfg is about: +. Selecting the test(s) to be executed +. Updating value of PICs and PIXITs +. Updating HTTP port setting + + diff --git a/virtualization/docker/docker-entrypoint.sh b/virtualization/docker/docker-entrypoint.sh new file mode 100755 index 0000000..3fa9d56 --- /dev/null +++ b/virtualization/docker/docker-entrypoint.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +set -euo pipefail + +usage() { + echo "No command specified. Available commands:" + for i in $(echo $commands | sed "s/,/ /g") + do + echo " $i" + done +} + +commands="help,build CAM,clean CAM,list CAM,modulepar CAM,rebuild CAM,run CAM,version" + +if [ $# == 0 ]; then + usage + exit 1 +fi + +if [ $# == 2 ]; then + if [ "$2" != "" ]; then + export ATS=Ats$2 + cli="${GEN_DIR}/bin/$ATS" + echo "cli: $cli" + fi +fi + + +case "$1" in + build) + cd ${GEN_DIR} && make + ;; + clean) + cd ${GEN_DIR} && make clean + ;; + list) + ${cli} -l + ;; + modulepar) + ${cli} -p + ;; + rebuild) + cd ${GEN_DIR} && rm -fr ./bin ./build ; make + ;; + run) + cd ${GEN_DIR}/scripts && ./run_all.bash + ;; + version) + compiler -v + ;; + *) + usage + exit 1 + ;; +esac + +unset ATS +exit 0 \ No newline at end of file diff --git a/virtualization/docker/docker-run.sh b/virtualization/docker/docker-run.sh new file mode 100755 index 0000000..32ff918 --- /dev/null +++ b/virtualization/docker/docker-run.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -exo pipefail + +cd "$(dirname ${BASH_SOURCE})" + +docker run --rm -it \ + -w /home/yann/dev/TS.ITS \ + -e GEN_DIR=/home/yann/dev/TS.ITS \ + -u "$(id -u):$(id -g)" \ + -v "${PWD}/../..:/home/yann/dev/TS.ITS" \ + --entrypoint /home/yann/dev/TS.ITS/virtualization/docker/docker-entrypoint.sh \ + alpine-its:latest "$@" +# -p 0.0.0.0:80:80 \ +# -p 0.0.0.0:443:443 \ diff --git a/virtualization/docker/home/etc/init.d/40-ttf011.sh b/virtualization/docker/home/etc/init.d/40-ttf011.sh deleted file mode 100755 index f8639c4..0000000 --- a/virtualization/docker/home/etc/init.d/40-ttf011.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -#set -e -set -vx - -echo -e "*****************************\n* Checkout TS.ITS sources\n*****************************\n" -cd ${HOME}/dev || exit 1 - -git clone --recurse-submodules --single-branch https://forge.etsi.org/rep/ITS/TS.ITS.git TS.ITS -cd ./TS.ITS -for i in `find ./ttcn -type d -name "Ats*"` -do - cd $i - git checkout devel - cd - -done -for i in `find ./ttcn/Ats* -type d -name "asn1"` -do - cd $i - git checkout testing - SUB_DIRS=`find . -type d` - if [ "SUB_DIRS" != "" ] - then - for j in $SUB_DIRS - do - cd $j - git checkout testing - cd - - done - fi - cd - -done -cd ${HOME}/dev/TS.ITS/titan-test-system-framework -git checkout devel -cd ./ttcn/LibHttp -ln -sf module_its.mk module.mk -cd ${HOME}/dev/TS.ITS/ttcn/LibIts -git checkout devel - -echo -e "*****************************\n* Setup environment\n*****************************\n" -cd ${HOME}/dev/TS.ITS/scripts -chmod 775 *.bash devenv.bash.* -cd ${HOME} -ln -sf ${HOME}/dev/TS.ITS/scripts/devenv.bash.ubuntu ${HOME}/devenv.bash -ls -ltr ${HOME} - -cd ${HOME} - -exit 0 diff --git a/virtualization/vagrant/provisioner.bash b/virtualization/vagrant/provisioner.bash index 91c4747..e9cd2c2 100755 --- a/virtualization/vagrant/provisioner.bash +++ b/virtualization/vagrant/provisioner.bash @@ -70,25 +70,41 @@ fi # Checkout TS.ITS sources cd /home/vagrant/dev -git clone --recurse-submodules --single-branch https://forge.etsi.org/rep/ITS/TS.ITS.git TS.ITS +git clone --recurse-submodules --single-branch --branch ttf_t024 https://forge.etsi.org/rep/ITS/TS.ITS.git TS.ITS cd ./TS.ITS for i in `find ./ttcn -type d -name "Ats*"` do cd $i - git checkout devel + git checkout devel2 cd - done for i in `find ./ttcn/Ats* -type d -name "asn1"` do cd $i - git checkout testing + git checkout testing2 + if [ -f ETSI-ITS-CDD.asn ] + then + ln -sf ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn + elif [ -f IVIM-PDU-Descriptions.asn ] + then + ln -sf IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn + ln -sf MAPEM-PDU-Descriptions.asn MAPEM_PDU_Descriptions.asn + ln -sf RTCMEM-PDU-Descriptions.asn RTCMEM_PDU_Descriptions.asn + ln -sf SPATEM-PDU-Descriptions.asn SPATEM_PDU_Descriptions.asn + ln -sf SREM-PDU-Descriptions.asn SREM_PDU_Descriptions.asn + ln -sf SSEM-PDU-Descriptions.asn SSEM_PDU_Descriptions.asn + ln -sf iso-patched/'ISO14906(2018)EfcDsrcApplicationv6-patched.asn' iso-patched/EfcDsrcApplication.asn + ln -sf iso-patched/'ISO14906(2018)EfcDsrcGenericv7-patched.asn' iso-patched/EfcDsrcGeneric.asn + ln -sf iso-patched/ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn iso-patched/ElectronicRegistrationIdentificationVehicleDataModule.asn + ln -sf iso-patched/ISO14823-missing.asn iso-patched/GDD.asn + fi SUB_DIRS=`find . -type d` if [ "SUB_DIRS" != "" ] then for j in $SUB_DIRS do cd $j - git checkout testing + git checkout testing2 cd - done fi -- GitLab From 0dad412cdd19918b0a6398ffa3a61199d0db9b03 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 24 Feb 2023 07:57:35 +0100 Subject: [PATCH 053/178] Reorganize patch_lib_common_titan --- README.md | 30 +- ttcn/patch_lib_common_titan/module.mk | 9 + .../ttcn/LibCommon_BasicTypesAndValues.ttcn | 247 +++ .../ttcn/LibCommon_DataStrings.ttcn | 168 ++ .../ttcn/LibCommon_Sync.ttcn | 1359 +++++++++++++++++ .../docker-dev/home/etc/init.d/40-ttf024.sh | 4 + 6 files changed, 1804 insertions(+), 13 deletions(-) create mode 100644 ttcn/patch_lib_common_titan/module.mk create mode 100644 ttcn/patch_lib_common_titan/ttcn/LibCommon_BasicTypesAndValues.ttcn create mode 100644 ttcn/patch_lib_common_titan/ttcn/LibCommon_DataStrings.ttcn create mode 100644 ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn diff --git a/README.md b/README.md index e56c1cb..29bc9fb 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ https://forge.etsi.org/etsi-software-license ## STFs The following STFs were or are currently involved in the evolutions of the ETSI ITS protocols project: -- STF 405, STF 422, STF 424, STF 455, STF 462, STF 481, STF 484, STF 507, STF 517, STF 525, STF 538, STF 545, STF 594, TTF T002, TTF T011 +- STF 405, STF 422, STF 424, STF 455, STF 462, STF 481, STF 484, STF 507, STF 517, STF 525, STF 538, STF 545, STF 594, TTF T002, TTF T011, TTF T024 ## Installation @@ -209,10 +209,14 @@ Procedure: - Clone the ETSI ITS protocols project into $HOME/dev folder ```sh -$ git clone --recurse-submodules --single-branch https://forge.etsi.org/gitlab/ITS/TS.ITS.git ./TTF011_Its +$ git clone --recurse-submodules --single-branch https://forge.etsi.org/gitlab/ITS/TS.ITS.git +$ cd ${HOME}/dev/TS.ITS/ +$ cp ./ttcn/patch_lib_common/module.mk ./ttcn/LibCommon/ +$ cp ./ttcn/patch_lib_common/ttcn/* ./ttcn/LibCommon/ttcn + ``` -- Update your default environment with the content of the script $HOME/dev/TTF011_Its/scripts/devenv.bash.ubuntu +- Update your default environment with the content of the script $HOME/dev/TS.ITS/scripts/devenv.bash.ubuntu - Switch to the next clause (Usage) @@ -230,7 +234,7 @@ These two files are used create the ETSI ITS project workspace on Eclipse TITAN. NOTE: When the Eclipse TITAN workspace is created, you have to build manually the librairy 'libasn1c.so' following the commands below: ```sh -$ cd /TTF011_Its +$ cd /TS.ITS $ mkdir -p ./bin/asn1 $ cd ./bin/asn1 $ make CC=gcc -f ../../asn1/Makefile @@ -250,7 +254,7 @@ Pre-requisites: - Your are logged as 'etsi' or 'vagrant' user - Procedure using TITAN command line (only): - Open several SSH session (PuTTY...) - - Change to the directory ~/dev/TTF011_Its/ + - Change to the directory ~/dev/TS.ITS/ - Modify the file config.mk according to your system: - On Linux, comment all the lines using the '#' character - On Windows, update the path accordingly @@ -269,7 +273,7 @@ $ make - To run the test suitem, execute the following command: ```sh -$ cd ~/dev/TTF011_Its/scripts +$ cd ~/dev/TS.ITS/scripts $ ../run_all.bash ... ``` @@ -303,21 +307,21 @@ $ make ### Generate the certificates -After applying the previous clause, change to the folder '~/dev/TTF011_Its/data/certificates' and execute 'make' command: +After applying the previous clause, change to the folder '~/dev/TS.ITS/data/certificates' and execute 'make' command: ``` -$ cd ~/dev/TTF011_Its/data/certificates +$ cd ~/dev/TS.ITS/data/certificates $ make ``` -The certificates will be located in the folder '~/dev/TTF011_Its/data/certificates/certificates'. +The certificates will be located in the folder '~/dev/TS.ITS/data/certificates/certificates'. To use this newly generated certificates, you shall update two parameters located in the TTCN-3 file LibItsSecurity_Pixits. These are: -- LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH, which is the path the certificates folder (e.g. LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "/home//dev/TTF011_Its/data/certificates") +- LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH, which is the path the certificates folder (e.g. LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "/home//dev/TS.ITS/data/certificates") - LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME, which is the name of the certificates folder (e.g. LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates") ### Modify or create new certificates -The folder '~/dev/TTF011_Its/data/profiles' contains an XML file for each certificate to be generated. +The folder '~/dev/TS.ITS/data/profiles' contains an XML file for each certificate to be generated. This XML file describes the certificate content (e.g. CERT_IUT_A_RCA.xml describes the root certificate for all CERT_IUT_A certificates). By modifying these files, you can change create new certificate with different geographical area, different validity periods or different SSPs. @@ -338,7 +342,7 @@ In this cases, the following parameters shall be modified to match the ITS devic In addition, the Test System shall be configured to support the security modifying the following settings as described below: - device_mode=1 - secured_mode=1 -- sec_db_path=/home//dev/TTF011_Its/data/certificates/certificates +- sec_db_path=/home//dev/TS.ITS/data/certificates/certificates ### ITS Protocol Test suites for Transport layer @@ -351,7 +355,7 @@ In this cases, the following parameters shall be modified to match the ITS devic In addition, the Test System shall be configured to support the security modifying the following settings as described below: - device_mode=1 - secured_mode=1 -- sec_db_path=/home//dev/TTF011_Its/data/certificates/certificates +- sec_db_path=/home//dev/TS.ITS/data/certificates/certificates ### ITS Protocol Test suites for Security diff --git a/ttcn/patch_lib_common_titan/module.mk b/ttcn/patch_lib_common_titan/module.mk new file mode 100644 index 0000000..3b3b660 --- /dev/null +++ b/ttcn/patch_lib_common_titan/module.mk @@ -0,0 +1,9 @@ +sources := \ + ttcn/LibCommon_AbstractData.ttcn \ + ttcn/LibCommon_BasicTypesAndValues.ttcn \ + ttcn/LibCommon_DataStrings.ttcn \ + ttcn/LibCommon_Sync.ttcn \ + ttcn/LibCommon_TextStrings.ttcn \ + ttcn/LibCommon_Time.ttcn \ + ttcn/LibCommon_VerdictControl.ttcn + diff --git a/ttcn/patch_lib_common_titan/ttcn/LibCommon_BasicTypesAndValues.ttcn b/ttcn/patch_lib_common_titan/ttcn/LibCommon_BasicTypesAndValues.ttcn new file mode 100644 index 0000000..9b5477d --- /dev/null +++ b/ttcn/patch_lib_common_titan/ttcn/LibCommon_BasicTypesAndValues.ttcn @@ -0,0 +1,247 @@ +/** + * @author ETSI + * @version $URL$ + * $Id$ + * @desc A collection of basic type and value definitions which may be + * useful in the implementation of any TTCN-3 test suite.

+ * @remark End users should be aware that any changes made to the in + * definitions this module may be overwritten in future releases. + * End users are encouraged to contact the distributers of this + * module regarding their modifications or additions so that future + * updates will include your changes. + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * + */ + module LibCommon_BasicTypesAndValues { + + /** + * @remark Number in subtype name always indicates encoding length + * in _bits_ + */ + group unsignedIntegerDefintions { + + const integer c_uInt1Max := 1; + const integer c_uInt2Max := 3; + const integer c_uInt3Max := 7; + const integer c_uInt4Max := 15; + const integer c_uInt5Max := 31; + const integer c_uInt6Max := 63; + const integer c_uInt7Max := 127; + const integer c_uInt8Max := 255; + const integer c_uInt9Max := 511; + const integer c_uInt10Max := 1023; + const integer c_uInt11Max := 2047; + const integer c_uInt12Max := 4095; + const integer c_uInt13Max := 8191; + const integer c_uInt14Max := 16383; + const integer c_uInt15Max := 32767; + const integer c_uInt16Max := 65535; + const integer c_uInt17Max := 131071; + const integer c_uInt18Max := 262143; + const integer c_uInt19Max := 524287; + const integer c_uInt20Max := 1048575; + const integer c_uInt21Max := 2097151; + const integer c_uInt22Max := 4194303; + const integer c_uInt23Max := 8388607; + const integer c_uInt24Max := 16777215; + const integer c_uInt25Max := 33554431; + const integer c_uInt26Max := 67108863; + const integer c_uInt27Max := 134217727; + const integer c_uInt28Max := 268435456; + const integer c_uInt29Max := 536870911; + const integer c_uInt30Max := 1073741823; + const integer c_uInt31Max := 2147483647; + const integer c_uInt32Max := 4294967295; + const integer c_uInt36Max := 68719476735; + const integer c_uInt48Max := 281474976710655; + const integer c_uInt52Max := 4503599627370495; + const integer c_uInt64Max := 18446744073709551615; + + type integer UInt (0 .. infinity); + type integer UInt1 (0 .. c_uInt1Max) with {variant "unsigned 1 bit"}; + type integer UInt2 (0 .. c_uInt2Max) with {variant "unsigned 2 bit"}; + type integer UInt3 (0 .. c_uInt3Max) with {variant "unsigned 3 bit"}; + type integer UInt4 (0 .. c_uInt4Max) with {variant "unsigned 4 bit"}; + type integer UInt5 (0 .. c_uInt5Max) with {variant "unsigned 5 bit"}; + type integer UInt6 (0 .. c_uInt6Max) with {variant "unsigned 6 bit"}; + type integer UInt7 (0 .. c_uInt7Max) with {variant "unsigned 7 bit"}; + type integer UInt8 (0 .. c_uInt8Max) with {variant "unsigned 8 bit"}; + type integer UInt9 (0 .. c_uInt9Max) with {variant "unsigned 9 bit"}; + type integer UInt10 (0 .. c_uInt10Max) with {variant "unsigned 10 bit"}; + type integer UInt11 (0 .. c_uInt11Max) with {variant "unsigned 11 bit"}; + type integer UInt12 (0 .. c_uInt12Max) with {variant "unsigned 12 bit"}; + type integer UInt13 (0 .. c_uInt13Max) with {variant "unsigned 13 bit"}; + type integer UInt14 (0 .. c_uInt14Max) with {variant "unsigned 14 bit"}; + type integer UInt15 (0 .. c_uInt15Max) with {variant "unsigned 15 bit"}; + type integer UInt16 (0 .. c_uInt16Max) with {variant "unsigned 16 bit"}; + type integer UInt17 (0 .. c_uInt17Max) with {variant "unsigned 17 bit"}; + type integer UInt18 (0 .. c_uInt18Max) with {variant "unsigned 18 bit"}; + type integer UInt19 (0 .. c_uInt19Max) with {variant "unsigned 19 bit"}; + type integer UInt20 (0 .. c_uInt20Max) with {variant "unsigned 20 bit"}; + type integer UInt21 (0 .. c_uInt21Max) with {variant "unsigned 21 bit"}; + type integer UInt22 (0 .. c_uInt22Max) with {variant "unsigned 22 bit"}; + type integer UInt23 (0 .. c_uInt23Max) with {variant "unsigned 23 bit"}; + type integer UInt24 (0 .. c_uInt24Max) with {variant "unsigned 24 bit"}; + type integer UInt25 (0 .. c_uInt25Max) with {variant "unsigned 25 bit"}; + type integer UInt26 (0 .. c_uInt26Max) with {variant "unsigned 26 bit"}; + type integer UInt27 (0 .. c_uInt27Max) with {variant "unsigned 27 bit"}; + type integer UInt28 (0 .. c_uInt28Max) with {variant "unsigned 28 bit"}; + type integer UInt29 (0 .. c_uInt29Max) with {variant "unsigned 29 bit"}; + type integer UInt30 (0 .. c_uInt30Max) with {variant "unsigned 30 bit"}; + type integer UInt31 (0 .. c_uInt31Max) with {variant "unsigned 31 bit"}; + type integer UInt32 (0 .. c_uInt32Max) with {variant "unsigned 32 bit"}; + type integer UInt36 (0 .. c_uInt36Max) with {variant "unsigned 36 bit"}; + type integer UInt48 (0 .. c_uInt48Max) with {variant "unsigned 48 bit"}; + type integer UInt52 (0 .. c_uInt52Max) with {variant "unsigned 52 bit"}; + type integer UInt64 (0 .. c_uInt64Max) with {variant "unsigned 64 bit"}; + + } // end group unsignedIntegerDefintions + + /** + * @remark Number in subtype name always indicates encoding length + * in _bits_ + */ + group signedIntegerDefintions { + + const integer c_int1Min := -1; + const integer c_int1Max := 0; + const integer c_int2Min := -2; + const integer c_int2Max := 1; + const integer c_int3Min := -4; + const integer c_int3Max := 3; + const integer c_int4Min := -8; + const integer c_int4Max := 7; + const integer c_int5Min := -16; + const integer c_int5Max := 15; + const integer c_int6Min := -32; + const integer c_int6Max := 31; + const integer c_int7Min := -64; + const integer c_int7Max := 63; + const integer c_int8Min := -128; + const integer c_int8Max := 127; + const integer c_int9Min := -256; + const integer c_int9Max := 255; + const integer c_int10Min := -512; + const integer c_int10Max := 511; + const integer c_int11Min := -1024; + const integer c_int11Max := 1023; + const integer c_int12Min := -2048; + const integer c_int12Max := 2047; + const integer c_int13Min := -4096; + const integer c_int13Max := 4095; + const integer c_int14Min := -8192; + const integer c_int14Max := 8191; + const integer c_int15Min := -16384; + const integer c_int15Max := 16383; + const integer c_int16Min := -32768; + const integer c_int16Max := 32767; + const integer c_int17Min := -65536; + const integer c_int17Max := 65535; + const integer c_int18Min := -131072; + const integer c_int18Max := 131071; + const integer c_int19Min := -262144; + const integer c_int19Max := 262143; + const integer c_int20Min := -524288; + const integer c_int20Max := 524287; + const integer c_int21Min := -1048576; + const integer c_int21Max := 1048575; + const integer c_int22Min := -2097152; + const integer c_int22Max := 2097151; + const integer c_int23Min := -4194304; + const integer c_int23Max := 4194303; + const integer c_int24Min := -8388608; + const integer c_int24Max := 8388607; + const integer c_int25Min := -16777216; + const integer c_int25Max := 16777215; + const integer c_int26Min := -33554432; + const integer c_int26Max := 33554431; + const integer c_int27Min := -67108864; + const integer c_int27Max := 67108863; + const integer c_int28Min := -134217728; + const integer c_int28Max := 134217727; + const integer c_int29Min := -268435456; + const integer c_int29Max := 268435456; + const integer c_int30Min := -536870912; + const integer c_int30Max := 536870911; + const integer c_int31Min := -1073741824; + const integer c_int31Max := 1073741823; + const integer c_int32Min := -2147483648; + const integer c_int32Max := 2147483647; + + type integer Int; + type integer Int1 (c_int1Min .. c_int1Max) with { variant "1 bit"}; + type integer Int2 (c_int2Min .. c_int2Max) with { variant "2 bit"}; + type integer Int3 (c_int3Min .. c_int3Max) with { variant "3 bit"}; + type integer Int4 (c_int4Min .. c_int4Max) with { variant "4 bit"}; + type integer Int5 (c_int5Min .. c_int5Max) with { variant "5 bit"}; + type integer Int6 (c_int6Min .. c_int6Max) with { variant "6 bit"}; + type integer Int7 (c_int7Min .. c_int7Max) with { variant "7 bit"}; + type integer Int8 (c_int8Min .. c_int8Max) with { variant "8 bit"}; + type integer Int9 (c_int9Min .. c_int9Max) with { variant "9 bit"}; + type integer Int10 (c_int10Min .. c_int10Max) with { variant "10 bit"}; + type integer Int11 (c_int11Min .. c_int11Max) with { variant "11 bit"}; + type integer Int12 (c_int12Min .. c_int12Max) with { variant "12 bit"}; + type integer Int13 (c_int13Min .. c_int13Max) with { variant "13 bit"}; + type integer Int14 (c_int14Min .. c_int14Max) with { variant "14 bit"}; + type integer Int15 (c_int15Min .. c_int15Max) with { variant "15 bit"}; + type integer Int16 (c_int16Min .. c_int16Max) with { variant "16 bit"}; + type integer Int17 (c_int17Min .. c_int17Max) with { variant "17 bit"}; + type integer Int18 (c_int18Min .. c_int18Max) with { variant "18 bit"}; + type integer Int19 (c_int19Min .. c_int19Max) with { variant "19 bit"}; + type integer Int20 (c_int20Min .. c_int20Max) with { variant "20 bit"}; + type integer Int21 (c_int21Min .. c_int21Max) with { variant "21 bit"}; + type integer Int22 (c_int22Min .. c_int22Max) with { variant "22 bit"}; + type integer Int23 (c_int23Min .. c_int23Max) with { variant "23 bit"}; + type integer Int24 (c_int24Min .. c_int24Max) with { variant "24 bit"}; + type integer Int25 (c_int25Min .. c_int25Max) with { variant "25 bit"}; + type integer Int26 (c_int26Min .. c_int26Max) with { variant "26 bit"}; + type integer Int27 (c_int27Min .. c_int27Max) with { variant "27 bit"}; + type integer Int28 (c_int28Min .. c_int28Max) with { variant "28 bit"}; + type integer Int29 (c_int29Min .. c_int29Max) with { variant "29 bit"}; + type integer Int30 (c_int30Min .. c_int30Max) with { variant "30 bit"}; + type integer Int31 (c_int31Min .. c_int31Max) with { variant "31 bit"}; + type integer Int32 (c_int32Min .. c_int32Max) with { variant "32 bit"}; + + } // end group signedIntegerDefintions + + group zeroedIntegers { + + const UInt1 c_uInt1Zero := 0; + const UInt2 c_uInt2Zero := 0; + const UInt3 c_uInt3Zero := 0; + const UInt4 c_uInt4Zero := 0; + const UInt5 c_uInt5Zero := 0; + const UInt6 c_uInt6Zero := 0; + const UInt7 c_uInt7Zero := 0; + const UInt8 c_uInt8Zero := 0; + const UInt10 c_uInt10Zero := 0; + const UInt12 c_uInt12Zero := 0; + const UInt14 c_uInt14Zero := 0; + const UInt16 c_uInt16Zero := 0; + const UInt24 c_uInt24Zero := 0; + const UInt32 c_uInt32Zero := 0; + const UInt48 c_uInt48Zero := 0; + + }//end group zeroedInt + + /** + * @remark Number in subtype name always indicates encoding length + * in _bits_ + */ + group booleanDefintions { + + type boolean Bool1 with { variant "1 bit" }; + type boolean Bool2 with { variant "2 bit" }; + type boolean Bool3 with { variant "3 bit" }; + type boolean Bool4 with { variant "4 bit" }; + type boolean Bool5 with { variant "5 bit" }; + type boolean Bool6 with { variant "6 bit" }; + type boolean Bool7 with { variant "7 bit" }; + type boolean Bool8 with { variant "8 bit" }; + + } // end group booleanDefintions + +} // end module LibCommon_BasicTypesAndValues diff --git a/ttcn/patch_lib_common_titan/ttcn/LibCommon_DataStrings.ttcn b/ttcn/patch_lib_common_titan/ttcn/LibCommon_DataStrings.ttcn new file mode 100644 index 0000000..9bfbe61 --- /dev/null +++ b/ttcn/patch_lib_common_titan/ttcn/LibCommon_DataStrings.ttcn @@ -0,0 +1,168 @@ +/** + * + * @author ETSI + * @version $URL$ + * $Id$ + * @desc A collection of data string type and value definitions which + * may be useful in the implementation of any TTCN-3 test + * suite. "Data string" refers to TTCN-3 hexstring, octetstring + * and bitstring types. + * @remark End users should be aware that any changes made to the in + * definitions this module may be overwritten in future releases. + * End users are encouraged to contact the distributers of this + * module regarding their modifications or additions so that future + * updates will include your changes. + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * + */ + module LibCommon_DataStrings { + + /** + * @remark Number in name indicates string length in number of + * _bits_ + */ + group bitStringSubTypes { + + type bitstring Bit1 length(1) with {encode "length(1)"}; + type bitstring Bit2 length(2) with {encode "length(2)"}; + type bitstring Bit3 length(3) with {encode "length(3)"}; + type bitstring Bit4 length(4) with {encode "length(4)"}; + type bitstring Bit5 length(5) with {encode "length(5)"}; + type bitstring Bit6 length(6) with {encode "length(6)"}; + type bitstring Bit7 length(7) with {encode "length(7)"}; + type bitstring Bit8 length(8) with {encode "length(8)"}; + type bitstring Bit9 length(9) with {encode "length(9)"}; + type bitstring Bit10 length(10) with {encode "length(10)"}; + type bitstring Bit11 length(11) with {encode "length(11)"}; + type bitstring Bit12 length(12) with {encode "length(12)"}; + type bitstring Bit13 length(13) with {encode "length(13)"}; + type bitstring Bit14 length(14) with {encode "length(14)"}; + type bitstring Bit15 length(15) with {encode "length(15)"}; + type bitstring Bit16 length(16) with {encode "length(16)"}; + type bitstring Bit17 length(17) with {encode "length(17)"}; + type bitstring Bit18 length(18) with {encode "length(18)"}; + type bitstring Bit19 length(19) with {encode "length(19)"}; + type bitstring Bit20 length(20) with {encode "length(20)"}; + type bitstring Bit21 length(21) with {encode "length(21)"}; + type bitstring Bit22 length(22) with {encode "length(22)"}; + type bitstring Bit23 length(23) with {encode "length(23)"}; + type bitstring Bit24 length(24) with {encode "length(24)"}; + type bitstring Bit25 length(25) with {encode "length(25)"}; + type bitstring Bit26 length(26) with {encode "length(26)"}; + type bitstring Bit27 length(27) with {encode "length(27)"}; + type bitstring Bit28 length(28) with {encode "length(28)"}; + type bitstring Bit29 length(29) with {encode "length(29)"}; + type bitstring Bit30 length(30) with {encode "length(30)"}; + type bitstring Bit31 length(31) with {encode "length(31)"}; + type bitstring Bit32 length(32) with {encode "length(32)"}; + type bitstring Bit40 length(40) with {encode "length(40)"}; + + type bitstring Bit48 length(48) with {encode "length(48)"}; + type bitstring Bit64 length(64) with {encode "length(64)"}; + type bitstring Bit72 length(72) with {encode "length(72)"}; + type bitstring Bit128 length(128) with {encode "length(128)"}; + type bitstring Bit144 length(144) with {encode "length(144)"}; + type bitstring Bit256 length(256) with {encode "length(256)"}; + + } // end group bitStringSubTypes + + group zeroedBits { + + const Bit1 c_1ZeroBit := int2bit(0,1); + const Bit2 c_2ZeroBits := int2bit(0,2); + const Bit4 c_4ZeroBits := int2bit(0,4); + const Bit5 c_5ZeroBits := int2bit(0,5); + const Bit6 c_6ZeroBits := int2bit(0,6); + const Bit8 c_8ZeroBits := int2bit(0,8); + const Bit14 c_14ZeroBits := int2bit(0,14); + const Bit64 c_64ZeroBits := int2bit(0,64); + + }//end group zeroedBits + + /** + * @remark Number in name indicates string length in number of + * _octets_ + */ + group octetStringSubTypes { + + type octetstring Oct1 length(1) with {encode "length(1)"}; + type octetstring Oct2 length(2) with {encode "length(2)"}; + type octetstring Oct3 length(3) with {encode "length(3)"}; + type octetstring Oct4 length(4) with {encode "length(4)"}; + type octetstring Oct5 length(5) with {encode "length(5)"}; + type octetstring Oct6 length(6) with {encode "length(6)"}; + type octetstring Oct7 length(7) with {encode "length(7)"}; + type octetstring Oct8 length(8) with {encode "length(8)"}; + type octetstring Oct9 length(9) with {encode "length(9)"}; + type octetstring Oct10 length(10) with {encode "length(10)"}; + type octetstring Oct11 length(11) with {encode "length(11)"}; + type octetstring Oct12 length(12) with {encode "length(12)"}; + type octetstring Oct13 length(13) with {encode "length(13)"}; + type octetstring Oct14 length(14) with {encode "length(14)"}; + type octetstring Oct15 length(15) with {encode "length(15)"}; + type octetstring Oct16 length(16) with {encode "length(16)"}; + + type octetstring Oct20 length(20) with {encode "length(20)"}; + type octetstring Oct32 length(32) with {encode "length(32)"}; + type octetstring Oct48 length(48) with {encode "length(48)"}; + type octetstring Oct64 length(64) with {encode "length(64)"}; + type octetstring Oct80 length(80) with {encode "length(80)"}; + type octetstring Oct96 length(96) with {encode "length(96)"}; + type octetstring Oct128 length(128) with {encode "length(128)"}; + type octetstring Oct160 length(160) with {encode "length(160)"}; + type octetstring Oct320 length(320) with {encode "length(320)"}; + type octetstring Oct640 length(640) with {encode "length(640)"}; + type octetstring Oct1280 length(1280) with {encode "length(1280)"}; + type octetstring Oct1380 length(1380) with {encode "length(1380)"}; + + type octetstring Oct0to3 length(0..3) with {encode "length(0..3)"}; + type octetstring Oct0to8 length(0..16) with {encode "length(0..8)"}; + type octetstring Oct0to12 length(0..12) with {encode "length(0..12)"}; + type octetstring Oct0to16 length(0..16) with {encode "length(0..16)"}; + type octetstring Oct0to31 length(0..31) with {encode "length(0..31)"}; + type octetstring Oct0to20 length(0..20) with {encode "length(0..20)"}; + type octetstring Oct0to30 length(0..20) with {encode "length(0..30)"}; + type octetstring Oct0to127 length(0..127) with {encode "length(0..127)"}; + type octetstring Oct0to255 length(0..255) with {encode "length(0..255)"}; + + type octetstring Oct1to15 length(1..15) with {encode "length(1..15)"}; + type octetstring Oct1to31 length(1..31) with {encode "length(1..31)"}; + type octetstring Oct1to128 length(1..128) with {encode "length(1..128)"}; + type octetstring Oct1to254 length(1..254) with {encode "length(1..254)"}; + type octetstring Oct1to255 length(1..255) with {encode "length(1..255)"}; + + type octetstring Oct4to16 length(4..16) with {encode "length(4..16)"}; + type octetstring Oct6to15 length(6..15) with {encode "length(6..15)"}; + + } // end group octetStringSubTypes + + group zeroedBytes { + const Oct1 c_1ZeroByte := int2oct(0,1); + const Oct2 c_2ZeroBytes := int2oct(0,2); + const Oct4 c_4ZeroBytes := int2oct(0,4); + const Oct6 c_6ZeroBytes := int2oct(0,6); + const Oct8 c_8ZeroBytes := int2oct(0,8); + const Oct9 c_9ZeroBytes := int2oct(0,9); + const Oct12 c_12ZeroBytes := int2oct(0,12); + const Oct16 c_16ZeroBytes := int2oct(0,16); + const Oct20 c_20ZeroBytes := int2oct(0,20); + + const Oct80 c_80ZeroBytes := int2oct(0,80); + const Oct160 c_160ZeroBytes := int2oct(0,160); + const Oct320 c_320ZeroBytes := int2oct(0,320); + const Oct640 c_640ZeroBytes := int2oct(0,640); + const Oct1280 c_1280ZeroBytes := int2oct(0,1280); + const Oct1380 c_1380ZeroBytes := int2oct(0,1380); + const octetstring c_256ZeroBytes := int2oct(0,256); + const octetstring c_1KZeroBytes := int2oct(0,1024); + const octetstring c_4KZeroBytes := int2oct(0,4096); + const octetstring c_16KZeroBytes := int2oct(0,16384); + const octetstring c_64KZeroBytes := int2oct(0,65536); + const octetstring c_128KZeroBytes := int2oct(0,131072); + + }//end group zeroedBytes + +} // end module LibCommon_DataStrings diff --git a/ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn b/ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn new file mode 100644 index 0000000..5b2ae66 --- /dev/null +++ b/ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn @@ -0,0 +1,1359 @@ +/** + * @author ETSI + * @version $URL$ + * $Id$ + * @desc This module implements _one_ generic synchronization mechanism + * for TTCN-3 test cases with one or more test components. + * Key concept is here that one test component acts as a + * synchronization server which listens and triggers one or more + * synchronization clients. It is recomended to use the MTC always as + * the synchronization server but in theory also a PTC can act as such + * a server.

+ * This synchronization is used by calling a function on + * the server test component to wait for a desired amount of clients + * to notify the server that they have reached a specific synchronization + * point. Each client test component must call another + * function to perform this notification.

+ * In the event that a client is not able to reach a synchronization + * point the server sends out a signal to all clients to abort the + * test case. This signal is a STOP message which can be caught by + * a test component default which in turn can then run a proper + * shut down behavior based on the current state of the test + * component.

+ * Note that this synchronization mechanism can also be used + * in a special mode called "self synchronization" when a test case + * only has one test component. Here, the test component in essence + * acts as a server and client at the same time. The main benefit of + * using self synchoronization is that the same shutdown mechanisms + * can also be reused fomr the multi component test cases.

+ * This module contains a lot of TTCN-3 definitions. It has been + * structured into tree main groups to help the user to identify + * quickly relevant TTCN-3 definitions. For rookie users of this + * module basicUserRelevantDefinitions should offer all the needed + * definitions. Advanced users can consider use of definitions in + * advancedUserRelevantDefinitions. Finally, internalDefinitions + * are definitions which are required for the module to work + * properly but do not need to be used in your code. Remember that + * the main motiviation of this sychronization module is to offer + * are _simple_ user interface. Practice has shown that when writing + * actual test component behavior _only a handful_ of functions + * usually wind up being used! Also check the synchronization examples + * module for example uses of this synchronization mechanism.

+ * The invocation of the sync functions is also closely tied + * to the verdict control functions which should also be reviewed + * prior to using this module.

+ * This module has been derived from EtsiCommon_Synchronization + * which was created in ETSIs STF256/276. It has been kept + * intentionally separate to avoid conflicts with future ETSI + * test suite releases. + * @see LibCommon_Sync.basicUserRelevantDefinitions + * @see LibCommon_Sync.advancedUserRelevantDefinitions + * @remark End users should be aware that any changes made to the in + * definitions this module may be overwritten in future releases. + * End users are encouraged to contact the distributers of this + * module regarding their modifications or additions so that future + * updates will include your changes. + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * + */ +module LibCommon_Sync { + + //Common + import from LibCommon_BasicTypesAndValues { type UInt } ; + import from LibCommon_AbstractData all; + import from LibCommon_VerdictControl all; + + group basicUserRelevantDefinitions { + + group importantSyncTypeDefinitions { + + group compTypeRelated { + + /** + * @desc This type is used to be the base of any synchronization + * behavior which is to be executed on a sync server + * component. The test component which acts as a + * sync server in a test case must NOT directly use + * this component type in its runs on clause! + * Note that server synchronization functions may be + * invoked by a test component as long as its + * component type is type compatible to this component + * type definition! + */ + type component BaseSyncComp { + port SyncPort syncPort; + timer tc_sync := PX_TSYNC_TIME_LIMIT; + } + + /** + * @desc This type is used to define any synchronization + * behavior which is to be executed on a sync server + * component. The test component which acts as a + * sync server in a test case may - but does + * not have to - directly use this component type its + * runs on clause. + * Note that server synchronization functions may be + * invoked by a test component as long as its + * component type is type compatible to this component + * type definition! + */ + type component ServerSyncComp extends BaseSyncComp { + timer tc_shutDown := PX_TSHUT_DOWN_TIME_LIMIT; + } + + /** + * @desc This type is used to define any synchronization + * behavior which is to be executed on a sync client + * component. The test component(s) which act as a + * sync client in a test case may - but do not have + * to - directly use this component type their runs + * on clause. + * Note that server synchronization functions may be + * invoked by a test component as long as its + * component type is type compatible to this component + * type definition! + */ + type component ClientSyncComp extends BaseSyncComp { + var StringStack v_stateStack:= c_initStringStack; + var TestcaseStep vc_testcaseStep := e_preamble; + } + + /** + * @desc This type is used to define any synchronization + * behavior which is relevant to non-concurrent test + * cases. + * Note that self synchronization functions may be + * invoked by a test component as long as its + * component type is type compatible to this component + * type definition! + * Note also that this type is type compatible to the + * ClientSyncComp type so that shutdown altsteps from + * concurrent test cases can also be reused in single + * component test cases! + * @see LibCommon_Sync.ClientSyncComp + */ + type component SelfSyncComp extends ClientSyncComp { + port SyncPort syncSendPort; + } + + /** + * @desc This port type must be imported into test suites + * when defining test component types which are + * type compatible to a synchronization component + * type + * @see LibCommon_Sync.SelfSyncComp + * @see LibCommon_Sync.ServerSyncComp + * @see LibCommon_Sync.ClientSyncComp + */ + type port SyncPort message { + inout SyncCmd + } with { + extension "internal" + } + + + /** + * @desc Describes in which step of execution is the testcase + */ + type enumerated TestcaseStep { + e_preamble, + e_testBody, + e_postamble + } + + } // end compTypeRelated + + group standardSyncPointNames { + const charstring c_prDone := "preambleDone"; + const charstring c_poDone := "postambleDone"; + const charstring c_tbDone := "testBodyDone"; + const charstring c_initDone := "initDone"; + } + + } // end group importantSyncTypeDefinitions + + group syncCompTestConfiguration { + + /** + * @desc Calls self connect function if invoking + * component is the MTC or otherwise connects the client + * the server. This function allows to implement preambles + * in a way that they can be used by test components + * in both non-concurrent as well as concurrent test + * cases! + * @remark This function should _not_ be called if the MTC + * acts as a client (and not a server) in a concurrent + * test case. In this case f_connect4ClientSync + * should be used instead. + * @see LibCommon_Sync.f_connect4SelfSync + * @see LibCommon_Sync.f_connect4ClientSync + */ + function f_connect4SelfOrClientSync() + runs on SelfSyncComp { + if ( self == mtc ) { + f_connect4SelfSync(); + } else { + f_connect4ClientSync(); + } + } + + /** + * @desc Calls self connect function if the invoking + * component is the MTC or otherwise disconnects the client + * from the server. This function allows to implement + * postambles in a way that they can be used in both + * non-concurrent as well as concurrent test cases. + * @remark This function should _not_ be called if the MTC + * acts as a client (and not a server) in a concurrent + * test case. In this case f_disconnect4ClientSync + * should be used instead. + * @see LibCommon_Sync.f_disconnect4SelfSync + * @see LibCommon_Sync.f_disconnect4ClientSync + */ + function f_disconnect4SelfOrClientSync() + runs on SelfSyncComp { + if ( self == mtc ) { + f_disconnect4SelfSync(); + } else { + f_disconnect4ClientSync(); + } + } + + } // end group syncCompTestConfiguration + + group syncFunctions { + + /** + * @desc Implements synchronization of 2 clients from server side + * on one or more synchronization points. + * If problem occurs, then server sends STOP to all clients. + * Waits for PX_TSYNC_TIME_LIMIT to let clients + * finish executing their behavior until this + * synchronization point. After passing all synchronization + * points successfuly the server waits for all clients + * to stop. + * See f_serverSyncClientsTimed for overwriting this + * the timing constraint! + * This function sets the server component verdict. + * @remark The use of this function requires prior connection of + * the server sync ports! + * @see LibCommon_Sync.f_connect4SelfOrClientSync + * @see LibCommon_Sync.PX_TSYNC_TIME_LIMIT + * @see LibCommon_Sync.f_serverSyncClientsTimed + * @see LibCommon_Sync.f_serverWaitForAllClientsToStop + * @param p_syncPointIds list of synchronization point name/ids + */ + function f_serverSync2ClientsAndStop( in SyncPointList p_syncPointIds ) + runs on ServerSyncComp { + f_serverSyncNClientsAndStop(2, p_syncPointIds); + } + + /** + * @desc Implements synchronization of 3 clients from server side + * on one or more synchronization points. + * If problem occurs, then server sends STOP to all clients. + * Waits for PX_TSYNC_TIME_LIMIT to let clients + * finish executing their behavior until this + * synchronization point. After passing all synchronization + * points successfuly the server waits for all clients + * to stop. + * See f_serverSyncClientsTimed for overwriting this + * the timing constraint! + * This function sets the server component verdict. + * @remark The use of this function requires prior connection of + * the server sync ports! + * @see LibCommon_Sync.f_connect4SelfOrClientSync + * @see LibCommon_Sync.PX_TSYNC_TIME_LIMIT + * @see LibCommon_Sync.f_serverSyncClientsTimed + * @see LibCommon_Sync.f_serverWaitForAllClientsToStop + * @param p_syncPointIds list of synchronization point name/ids + */ + function f_serverSync3ClientsAndStop( in SyncPointList p_syncPointIds ) + runs on ServerSyncComp { + f_serverSyncNClientsAndStop(3, p_syncPointIds); + } + + /** + * @desc Implements synchronization of 4 clients from server side + * on one or more synchronization points. + * If problem occurs, then server sends STOP to all clients. + * Waits for PX_TSYNC_TIME_LIMIT to let clients + * finish executing their behavior until this + * synchronization point. After passing all synchronization + * points successfuly the server waits for all clients + * to stop. + * See f_serverSyncClientsTimed for overwriting this + * the timing constraint! + * This function sets the server component verdict. + * @remark The use of this function requires prior connection of + * the server sync ports! + * @see LibCommon_Sync.f_connect4SelfOrClientSync + * @see LibCommon_Sync.PX_TSYNC_TIME_LIMIT + * @see LibCommon_Sync.f_serverSyncClientsTimed + * @see LibCommon_Sync.f_serverWaitForAllClientsToStop + * @param p_syncPointIds list of synchronization point name/ids + */ + function f_serverSync4ClientsAndStop( in SyncPointList p_syncPointIds ) + runs on ServerSyncComp { + f_serverSyncNClientsAndStop(4, p_syncPointIds); + } + + /** + * @desc Implements synchronization of N clients from server side + * on one or more synchronization points. + * If problem occurs, then server sends STOP to all clients. + * Waits for PX_TSYNC_TIME_LIMIT to let clients + * finish executing their behavior until this + * synchronization point. After passing all synchronization + * points successfuly the server waits for all clients + * to stop. + * See f_serverSyncClientsTimed for overwriting this + * the timing constraint! + * This function sets the server component verdict. + * @remark The use of this function requires prior connection of + * the server sync ports! + * @see LibCommon_Sync.f_connect4SelfOrClientSync + * @see LibCommon_Sync.PX_TSYNC_TIME_LIMIT + * @see LibCommon_Sync.f_serverSyncClientsTimed + * @see LibCommon_Sync.f_serverWaitForAllClientsToStop + * @param p_numClients number of synchronization clients + * @param p_syncPointIds list of synchronization point name/ids + */ + function f_serverSyncNClientsAndStop ( + in UInt p_numClients, + in SyncPointList p_syncPointIds ) + runs on ServerSyncComp { + var integer i, v_noOfSyncIds := sizeof(p_syncPointIds); + for ( i := 0; i < v_noOfSyncIds; i := i+1 ) { + f_serverSyncClientsTimed ( + p_numClients, + valueof(p_syncPointIds[i]), + PX_TSYNC_TIME_LIMIT ); + } + f_serverWaitForAllClientsToStop(); + } + + /** + * @desc Implements synchronization of 2 clients and 1 UT from server side + * on one or more synchronization points. + * If problem occurs, then server sends STOP to all clients. + * Waits for PX_TSYNC_TIME_LIMIT to let clients + * finish executing their behavior until this + * synchronization point. After passing all synchronization + * points successfuly the server waits for all clients + * to stop. + * See f_serverSyncClientsTimed for overwriting this + * the timing constraint! + * This function sets the server component verdict. + * @remark The use of this function requires prior connection of + * the server sync ports! + * @see LibCommon_Sync.f_connect4SelfOrClientSync + * @see LibCommon_Sync.PX_TSYNC_TIME_LIMIT + * @see LibCommon_Sync.f_serverSyncClientsTimed + * @see LibCommon_Sync.f_serverWaitForAllClientsToStop + * @param p_syncPointIds list of synchronization point name/ids + */ + function f_serverSync2ClientsUtAndStop( in SyncPointList p_syncPointIds ) + runs on ServerSyncComp { + var integer i, v_noOfSyncIds := sizeof(p_syncPointIds); + for ( i := 0; i < v_noOfSyncIds; i := i+1 ) { + f_serverSyncClientsTimed(3,valueof(p_syncPointIds[i]), PX_TSYNC_TIME_LIMIT); + } + f_serverWaitForAllClientsToStop(); + } + + /** + * @desc Calls either self synchronization function if + * invoking component is the MTC, otherwise + * calls client synchronization. After that it + * sets the verdict based on the specified return code. + * This function allows to implement TTCN-3 functions + * in a way that they can be used in both non-concurrent + * as well as concurrent test cases. + * @remark This function should _not_ be called if the MTC + * acts as a client (and not a server) in a concurrent + * test case. In this case f_clientSyncAndVerdict + * should be used instead. + * @param p_syncPoint Synchronization point name/id + * @param p_ret Current behavior execution status + * @see LibCommon_Sync.f_clientSyncAndVerdict + * @see LibCommon_VerdictControl.f_setVerdict + */ + function f_selfOrClientSyncAndVerdict( in charstring p_syncPoint, + in FncRetCode p_ret) + runs on SelfSyncComp { + if ( self == mtc ) { + // then assume we are running non-conurrent test case + f_selfSyncAndVerdict(p_syncPoint, p_ret); + } else { + f_clientSyncAndVerdict(p_syncPoint, p_ret); + } + } + + /** + * @desc Calls either self synchronization function if + * invoking component is the MTC, otherwise + * calls client synchronization. After that it + * sets a preamble specific verdict based on the + * specified return code. + * This function allows to implement TTCN-3 functions + * in a way that they can be used in both non-concurrent + * as well as concurrent test cases. + * @remark This function should _not_ be called if the MTC + * acts as a client (and not a server) in a concurrent + * test case. In this case f_clientSyncAndVerdictPreamble + * should be used instead. + * @param p_syncPoint Synchronization point name/id + * @param p_ret Current behavior execution status + * @see LibCommon_Sync.f_clientSyncAndVerdict + * @see LibCommon_VerdictControl.f_setVerdictPreamble + */ + function f_selfOrClientSyncAndVerdictPreamble( in charstring p_syncPoint, + in FncRetCode p_ret) + runs on SelfSyncComp { + if ( self == mtc ) { + // then assume we are running non-conurrent test case + f_selfSyncAndVerdictPreamble(p_syncPoint, p_ret); + } else { + f_clientSyncAndVerdictPreamble(p_syncPoint, p_ret); + } + } + + /** + * @desc Calls either self synchronization function if + * invoking component is the MTC, otherwise + * calls client synchronization. After that it + * sets a preamble specific verdict based on the + * specified return code. + * This function allows to implement TTCN-3 functions + * in a way that they can be used in both non-concurrent + * as well as concurrent test cases. + * @remark This function should _not_ be called if the MTC + * acts as a client (and not a server) in a concurrent + * test case. In this case f_clientSyncAndVerdictTestBody + * should be used instead. + * @param p_syncPoint Synchronization point name/id + * @param p_ret Current behavior execution status + * @see LibCommon_Sync.f_clientSyncAndVerdict + * @see LibCommon_VerdictControl.f_setVerdictPreamble + */ + function f_selfOrClientSyncAndVerdictTestBody( in charstring p_syncPoint, + in FncRetCode p_ret) + runs on SelfSyncComp { + if ( self == mtc ) { + // then assume we are running non-conurrent test case + f_selfSyncAndVerdictTestBody(p_syncPoint, p_ret); + } else { + f_clientSyncAndVerdictTestBody(p_syncPoint, p_ret); + } + } + + /** + * @desc Function kept for backward compatibility + * @see f_selfOrClientSyncAndVerdictPreamble + * + */ + function f_selfOrClientSyncAndVerdictPR( in charstring p_syncPoint, + in FncRetCode p_ret) + runs on SelfSyncComp { + f_selfOrClientSyncAndVerdictPreamble(p_syncPoint, p_ret); + } + + } // end group syncFunctions + + group syncCompStateHandling { + + /** + * + * @desc This function updates the state (stack) of a + * sync client or self sync component. This stack is + * key in the shutdown handling of test components. + * It adds the new state name to the top of the + * sync component stack of states. + * The state will only be added in case of a current + * execution status of e_success. + * @param p_newSyncCompState Name of state which was attempted to be reached. + * @param p_ret Current behavior execution status + * @remark If the state of component changes this function must be + * _at least_ called from your test suite prior to f_selfSync + * or f_clientSync which is the only definite place for the + * shutdown default invocation! + * @see LibCommon_Sync.a_dummyShutDown + * @see LibCommon_Sync.f_selfSync + * @see LibCommon_Sync.f_clientSync + */ + function f_addSyncCompState(in charstring p_newSyncCompState, + in FncRetCode p_ret) + runs on ClientSyncComp { + if ( p_ret == e_success ) { + if ( f_isItemOnStringStack(v_stateStack,p_newSyncCompState) ) { + log("**** f_addSyncCompState: WARNING: Attempt to add state which is already on sync state stack! No additition done.****"); + } else { + f_pushStringStack(v_stateStack,p_newSyncCompState); + } + } + } // end function f_addSyncCompState + + /** + * + * @desc This function returns the top state on the sync + * state stack of a sync client or self sync + * component and removes it from the stack + * This function cna be used, e.g., in a while + * statement within a postamble or shutdown + * implementation + * @param p_state State on top of the state stack. + * @return false if state stack is empty, true otherwise + * @see LibCommon_Sync.a_dummyShutDown + */ + function f_getTopSyncCompState( out charstring p_state ) + runs on ClientSyncComp + return boolean { + if ( not f_peekStringStackTop(v_stateStack,p_state) ) { + p_state := "IDLE"; + return false; + } + f_popStringStack(v_stateStack); + return true; + } // end function f_getTopSyncCompState + + /* + * @desc This function removes the last state on the state stack + * of a sync client or self sync component. + * This stack is key in the shutdown handling of test + * components. + * @see LibCommon_Sync.a_dummyShutDown + */ + function f_popSyncCompState() + runs on ClientSyncComp { + f_popStringStack(v_stateStack); + } // end function f_popSyncCompState + + /** + * + * @desc This function returns the top state on the sync state + * stack of a sync client or self sync component. It + * does not remove it from the stack + * This stack is key in the shutdown handling of test + * components. + * @param p_state State on top of the state stack. + * @return false if state stack is empty, true otherwise + * @see LibCommon_Sync.a_dummyShutDown + */ + function f_peekTopSyncCompState(out charstring p_state) + runs on ClientSyncComp + return boolean { + return f_peekStringStackTop(v_stateStack,p_state); + } // end function f_peekTopSyncCompState + + /** + * @desc This function checks if the sync state stack + * of a sync client or self sync component is empty. + * This stack is key in the shutdown handling of test + * components. + * @see LibCommon_Sync.a_dummyShutDown + */ + function f_isSyncCompStateStackEmpty() + runs on ClientSyncComp + return boolean { + return f_isStringStackEmpty(v_stateStack); + } // end function f_isSyncCompStateStackEmpty + + } // end group syncCompStateHandling + + group shutDownAltsteps { + + /** + * @desc This is an example of a shutdown altstep which can be + * used as a "template" for a interface specific shutdown + * altstep or possily as a first temporary solution in + * test case development.

+ * This altstep shall be activated as a default as the + * first statement in each test case function which drives + * an interface, i.e., in MTC behavior of single component + * and in each client behavior of multi component test + * cases.
+ * The required behavior from this altstep is to:

+ * 1) expect the STOP either via the test component + * syncPort

+ * 2) upon its arrival it should shut down the SUT + * gracefully based on the current component state

+ * The current component state should have been + * previously kept uptodate from a test suite via the + * f_addSyncCompState function. This default will then be + * (automatically) invoked either from within f_selfSync + * or f_clientSync.
+ * Note that shutdown defaults can be written as + * _interface specific_ - they do not need to be test case + * or test component specific! See another example of a + * shutdown altstep in the sync module. + * @see LibCommon_Sync.f_addSyncCompState + * @see LibCommon_Sync.f_selfSync + * @see LibCommon_Sync.f_clientSync + * @see LibCommon_SyncExamples.a_exampleShutDown + * @remark Your application specific shutdown altstep + * implementation(s) should _not_ be defined in this + * module but as part of your test suite or application specific + * modules. + */ + altstep a_dummyShutDown() + runs on SelfSyncComp { + [] syncPort.receive(m_syncServerStop){ + var charstring v_state := ""; + tc_sync.stop; + log("**** a_dummyShutDown: Test component received STOP signal from sync server - going to IDLE state ****"); + while ( f_getTopSyncCompState(v_state) ) { + if ( v_state == "x" ) { + // then do something + } else if ( v_state == "y" ) { + // then do something else + } + } // end while + f_disconnect4SelfOrClientSync(); + // unmap/disconnect more if needed + log("**** a_dummyShutDown: -> Test component stopping itself now! ****") ; + stop ; + } + } // end altstep a_dummyShutDown + + /** + * @desc Shutdown alstep in case the sync server is requesting shutdown. + * + * @remark User shall stop the component + */ + altstep a_shutdown() + runs on ClientSyncComp { + [] syncPort.receive(m_syncServerStop){ + tc_sync.stop ; + log("**** a_shutdown: Test component received STOP signal from MTC **** "); + } + } + + } // end group shutDownAltsteps + + } // end group basicUserRelevantDefinitions + + group advancedUserRelevantDefinitions { + + group serverRelated { + + /** + * @desc Implements synchronization of "n" clients from server + * side. If a problem occurs, then server sends STOP to + * all clients. Waits for PX_TSYNC_TIME_LIMIT to let + * clients finish executing their behavior until this + * synchronization point. See f_serverSyncClientsTimed for + * overwriting this later timing constraint! + * This function sets the server component verdict. + * @remark The use of this function requires prior connection of + * the server sync port! + * @see LibCommon_Sync.f_connect4SelfOrClientSync + * @see LibCommon_Sync.PX_TSYNC_TIME_LIMIT + * @see LibCommon_Sync.f_serverSyncClientsTimed + * @param p_noOfClients number of clients to be synchronized + * @param p_syncId synchronization point name/id + */ + function f_serverSyncClients( in UInt p_noOfClients, in charstring p_syncId ) + runs on ServerSyncComp { + f_serverSyncClientsTimed(p_noOfClients,p_syncId, PX_TSYNC_TIME_LIMIT); + } + + /** + * @desc Implements synchronization of "n" clients from server + * side including intermediate synchronization. + * If a problem occurs, then server sends STOP to + * all clients. Waits for PX_TSYNC_TIME_LIMIT to let + * clients finish executing their behavior until this + * synchronization point. See f_serverSyncClientsTimed for + * overwriting this later timing constraint! + * This function sets the server component verdict. + * @remark The use of this function requires prior connection of + * the server sync port! + * @see LibCommon_Sync.f_connect4SelfOrClientSync + * @see LibCommon_Sync.PX_TSYNC_TIME_LIMIT + * @see LibCommon_Sync.f_serverSyncClientsTimed + * @param p_noOfClients number of clients to be synchronized + * @param p_syncId synchronization point name/id + */ + function f_serverSyncClientsIntermediateSync( in UInt p_noOfClients, in charstring p_syncId, in UInt p_NoOfClientIntermediate, in template (present) charstring p_syncIdIntermediate ) + runs on ServerSyncComp { + f_serverSyncClientsTimedIntermediateSync(p_noOfClients,p_syncId, p_NoOfClientIntermediate, p_syncIdIntermediate, PX_TSYNC_TIME_LIMIT); + } + + /** + * @desc Handles synchronization of clients from server side. + * If problem occurs, then server sends STOP to all clients. + * This function sets the server verdict. + * @remark The use of this function requires prior connection of + * the server sync ports! + * @param p_NoOfClients number of clients to be synchronized + * @param p_syncId synchronization point name/id + * @param p_execTimeLimit time limit given to all clients to finish the execution + * of their behavior up to this synchronization point + * @see LibCommon_Sync.f_connect4SelfOrClientSync + */ + function f_serverSyncClientsTimed(in UInt p_NoOfClients, + in charstring p_syncId, + float p_execTimeLimit ) + runs on ServerSyncComp { + f_serverSyncClientsTimedIntermediateSync(p_NoOfClients, p_syncId, 0, ?, p_execTimeLimit ) + } // end function f_serverSyncClientsTimed + + /** @desc Handles synchronization of clients from server side including + * intermediate synchronization. + * If problem occurs, then server sends STOP to all clients. + * This function sets the server verdict. + * @remark The use of this function requires prior connection of + * the server sync ports! + * @param p_NoOfClients number of clients to be synchronized + * @param p_syncId synchronization point name/id + * @param p_execTimeLimit time limit given to all clients to finish the execution + * of their behavior up to this synchronization point + * @see LibCommon_Sync.f_connect4SelfOrClientSync + * @return execution status + */ + function f_serverSyncClientsTimedIntermediateSync( in UInt p_NoOfClients, + in charstring p_syncId, in UInt p_NoOfClientIntermediate, in template (present) charstring p_syncIdIntermediate, + float p_execTimeLimit ) + runs on ServerSyncComp { + + var integer v_noOfRecvdSyncMsgs := 0, v_noOfRecvdSyncMsgsIntermediate := 0; + var boolean v_stopClients := false; + var ClientSyncCompList v_clientRefs := {}, v_clientRefsIntermediate := {}; + var ClientSyncComp v_clientRef; + + if ( p_syncId == c_prDone ) { + log("**** f_serverSyncClientsTimed: Sync server now starting PREAMBLE synchronization ... ****") ; + } else if ( p_syncId == c_tbDone ) { + log("**** f_serverSyncClientsTimed: Sync server now starting TEST BODY synchronization ... ****") ; + } else if ( p_syncId == c_initDone ) { + log("**** f_serverSyncClientsTimed: Sync server now starting UPPER TESTER synchronization ... ****") ; + } else { + log("**** f_serverSyncClientsTimed: Sync server now starting handling of next synchronization point ... ****") ; + } + tc_sync.start(p_execTimeLimit) ; + alt{ + [v_noOfRecvdSyncMsgsIntermediate != p_NoOfClientIntermediate] syncPort.receive(m_syncClientReady(p_syncIdIntermediate)) -> sender v_clientRef { + if(not f_isPresentInArray(v_clientRef, v_clientRefsIntermediate)) { + v_clientRefsIntermediate[v_noOfRecvdSyncMsgsIntermediate] := v_clientRef; + v_noOfRecvdSyncMsgsIntermediate := v_noOfRecvdSyncMsgsIntermediate + 1; + if (v_noOfRecvdSyncMsgsIntermediate == p_NoOfClientIntermediate) { + f_serverSendToAllClients(v_clientRefsIntermediate, m_syncServerReady(p_syncIdIntermediate)); + } + } + repeat; + } + [] syncPort.receive(m_syncClientReady(p_syncId)) -> sender v_clientRef { + if(not f_isPresentInArray(v_clientRef, v_clientRefs)) { + v_clientRefs[v_noOfRecvdSyncMsgs] := v_clientRef; + v_noOfRecvdSyncMsgs := v_noOfRecvdSyncMsgs + 1; + } + if ( v_noOfRecvdSyncMsgs != p_NoOfClients ) { repeat; } + } + [] syncPort.receive(m_syncClientStop) -> sender v_clientRef { + log("**** f_serverSyncClientsTimed: Sync server received STOP signal from a client - server will wait for all clients to reach their next synchronization point and then stop them! ****") ; + v_stopClients := true; + if(not f_isPresentInArray(v_clientRef, v_clientRefs)) { + v_clientRefs[v_noOfRecvdSyncMsgs] := v_clientRef; + v_noOfRecvdSyncMsgs := v_noOfRecvdSyncMsgs + 1; + } + if ( v_noOfRecvdSyncMsgs != p_NoOfClients ) { repeat; } + + } + [] syncPort.receive(m_syncClientReady(?)) -> sender v_clientRef { + log("**** f_serverSyncClientsTimed: Sync server received client sync message with incorrect synchronization point id which is currently not handled - server will stop all clients! ****") ; + v_stopClients := true; + if(not f_isPresentInArray(v_clientRef, v_clientRefs)) { + v_clientRefs[v_noOfRecvdSyncMsgs] := v_clientRef; + } + } + [] syncPort.receive(SyncCmd :? ) { + log("**** f_serverSyncClientsTimed: Sync server received (invalid) sync message from other sync server - server will stop all clients! ****") ; + v_stopClients := true; } + [] any port.receive { + // leave it to be ok to receive anything else + // in case that the user has added any non-sync ports to + // his/her server component type definition! + repeat; + } + [] tc_sync.timeout{ + log("**** f_serverSyncClientsTimed: A client is not responding within specified time limit - sync server is sending stop to all clients! ****"); + v_stopClients := true; } + } //end alt + if (v_noOfRecvdSyncMsgsIntermediate != p_NoOfClientIntermediate) { + v_stopClients := true; + } + tc_sync.stop ; + if ( v_stopClients ) { + setverdict(inconc); + // then send out STOP sync msg + f_serverSendToAllClients(v_clientRefs, m_syncServerStop); + f_serverWaitForAllClientsToShutDown(); // function will never return! + } else { + setverdict(pass); + // then send out READY sync msg + f_serverSendToAllClients(v_clientRefs, m_syncServerReady(p_syncId)); + if ( p_syncId == c_prDone ) { + log("**** f_serverSyncClientsTimed: Sync server successfully passed PREAMBLE synchronization point. ****") ; + } else if ( p_syncId == c_tbDone ) { + log("**** f_serverSyncClientsTimed: Sync server successfully passed TEST BODY synchronization point. ****") ; + } else { + log("**** f_serverSyncClientsTimed: Sync server successfully passed synchronization point. ****") ; + } + } + } // end function f_serverSyncClientsTimedIntermediateSync + + /** + * @desc This function is intended only for use on the sync + * server component in concurrent TTCN-3 test cases. + * It waits for all components to finish execution within + * the PX_TSYNC_TIME_LIMIT. If a timeout occurs + * the server will stop all clients. + * This function sets the server component verdict. + */ + function f_serverWaitForAllClientsToStop() + runs on ServerSyncComp { + tc_sync.start; + alt { + [] all component.done { + tc_sync.stop; + log("**** f_serverWaitForAllClientsToStop: All sync clients have finished their execution. Sync server now terminating test case. ****") ; + } + [] tc_sync.timeout { + log("**** f_serverWaitForAllClientsToStop: Not all sync clients have finshed execution within the sync time limit. Sync server will stop test case! ****") ; + stop; + } + } // end alt + setverdict(pass); + } // end function f_serverWaitForAllClientsToStop + + } // end group serverRelated + + group clientRelated { + + /** + * @desc This function creates the connection needed to + * execute client synchronization functions + * @see LibCommon_Sync.f_clientSync + * @see LibCommon_Sync.f_clientSendStop + */ + function f_connect4ClientSync() + runs on ClientSyncComp { + connect(self:syncPort, mtc:syncPort); + }// end function f_connect4ClientSync + + /** + * @desc This function removes the connection needed + * to execute client synchronization functions + * @see LibCommon_Sync.f_clientSync + * @see LibCommon_Sync.f_clientSendStop + */ + function f_disconnect4ClientSync() + runs on ClientSyncComp { + disconnect(self:syncPort, mtc:syncPort); + }// end function f_disconnect4ClientSync + + /** + * @desc This function combines client verdict setting with its + * synchronization for use,e.g, after or within a + * test body implementation. + * Note that such premables can _not_ be reused in non- + * concurrent test cases. This can be achieved by using + * the f_selfOrClientSyncAndVerdict function instead. + * This function sets the client component verdict. + * @param p_syncId Synchronization point name/id + * @param p_ret Current behavior execution status + * @remark The use of this function requires prior connection + * of the client sync port! + * @see LibCommon_Sync.f_connect4ClientSync + * @see LibCommon_Sync.f_connect4SelfOrClientSync + * @see LibCommon_VerdictControl.f_setVerdict + * @see LibCommon_Sync.f_selfOrClientSyncAndVerdict + */ + function f_clientSyncAndVerdict(in charstring p_syncId, + in FncRetCode p_ret) + runs on ClientSyncComp { + if(vc_testcaseStep == e_preamble) { + f_clientSyncAndVerdictPreamble(p_syncId, p_ret); + } else if(vc_testcaseStep == e_testBody) { + f_clientSyncAndVerdictTestBody(p_syncId, p_ret); + } + else { + f_clientSyncAndVerdictPostamble(p_syncId, p_ret); + } + } + + /** + * @desc This function combines client verdict setting with its + * synchronization for use after or within a preamble + * implementation. + * Note that such preambles can _not_ be reused in non- + * concurrent test cases. + * This function sets the client component verdict. + * @remark The use of this function requires prior connection + * of the client sync port! + * @see LibCommon_Sync.f_connect4ClientSync + * @see LibCommon_Sync.f_connect4SelfOrClientSync + * @see LibCommon_VerdictControl.f_setVerdictPreamble + * @param p_syncId Synchronization point name/id + * @param p_ret Current behavior execution status + */ + function f_clientSyncAndVerdictPreamble(in charstring p_syncId , + FncRetCode p_ret) + runs on ClientSyncComp { + f_setVerdictPreamble(p_ret); + f_clientSync(p_syncId,p_ret); + vc_testcaseStep := e_testBody; + } + + /** + * @desc This function combines client verdict setting with its + * synchronization for use,e.g, after or within a + * test body implementation. + * Note that such premables can _not_ be reused in non- + * concurrent test cases. This can be achieved by using + * the f_selfOrClientSyncAndVerdict function instead. + * This function sets the client component verdict. + * @param p_syncId Synchronization point name/id + * @param p_ret Current behavior execution status + * @remark The use of this function requires prior connection + * of the client sync port! + * @see LibCommon_Sync.f_connect4ClientSync + * @see LibCommon_Sync.f_connect4SelfOrClientSync + * @see LibCommon_VerdictControl.f_setVerdict + * @see LibCommon_Sync.f_selfOrClientSyncAndVerdict + */ + function f_clientSyncAndVerdictTestBody(in charstring p_syncId, + in FncRetCode p_ret) + runs on ClientSyncComp { + f_setVerdict(p_ret); + f_clientSync(p_syncId,p_ret); + vc_testcaseStep := e_postamble; + } + + /** + * @desc This function combines client verdict setting with its + * synchronization for use after or within a + * postamble implementation. + * Note that such prostambles can _not_ be reused in non- + * concurrent test cases. + * This function sets the client component verdict. + * @remark The use of this function requires prior connection + * of the client sync port! + * @see LibCommon_Sync.f_connect4ClientSync + * @see LibCommon_Sync.f_connect4SelfOrClientSync + * @see LibCommon_VerdictControl.f_setVerdictPostamble + * @param p_syncId Synchronization point name/id + * @param p_ret Current behavior execution status + */ + function f_clientSyncAndVerdictPostamble(in charstring p_syncId , + in FncRetCode p_ret) + runs on ClientSyncComp { + f_setVerdictPostamble(p_ret); + f_clientSync(p_syncId,p_ret); + } + + /** + * @desc This function handles synchronization of a sync client + * with the server. In case of successful execution it sends + * a READY message to the server and waits the READY back. + * The time used for waiting is defined by PX_TSYNC_TIME_LIMIT. + * In case of a non successful execution status it + * sends a STOP message to the server. + * In both cases the receipt of a STOP message or no + * response from the server it will trigger the shutdown + * default (if activated). + * This function will set only the client verdict to INCONC + * (and stop its execution) if no STOP response is received + * from the server within the PX_TSYNC_TIME_LIMIT + * or if no shutdown default is activated. In all other + * cases the client verdict is NOT set. + * @param p_syncId Synchronization point name/id + * @param p_ret Current behavior execution status + * @remark The use of this function requires prior connection + * of the client sync port! + * @see LibCommon_Sync.f_connect4ClientSync + * @see LibCommon_Sync.f_connect4SelfOrClientSync + * @see LibCommon_Sync.PX_TSYNC_TIME_LIMIT + * @see LibCommon_Sync.a_dummyShutDown + * @see LibCommon_Sync.f_clientSendStop + * @return Updated execution status + */ + function f_clientSync( in charstring p_syncId , + in FncRetCode p_ret ) + runs on ClientSyncComp + return FncRetCode{ + + if (p_ret == e_success){ + syncPort.send(m_syncClientReady(p_syncId)); + tc_sync.start; + alt{ + [] syncPort.receive(m_syncServerReady(p_syncId)){ + tc_sync.stop ; } + [] tc_sync.timeout{ + log("**** f_clientSync: Sync client did not receive message from sync server within the specified time limit - sync client will ask sync server to stop test case! ****") ; + f_clientSendStop(); } // function will not return! + } //end alt + } //end if + else { + log("**** f_clientSync: Execution status indicates that execution of test component behavior was not successful - sync client will ask sync server to stop test case! ****") ; + f_clientSendStop(); // function will not return! + } + if ( p_syncId == c_prDone ) { + log("**** f_clientSync: Sync client successfully passed PREAMBLE synchronization point. ****") ; + } else if ( p_syncId == c_tbDone ) { + log("**** f_clientSync: Sync client successfully passed TEST BODY synchronization point. ****") ; + } else { + log("**** f_clientSync: Sync client successfully passed synchronization point. ****") ; + } + return e_success ; + + } // end function f_clientSync + + /** + * @desc This function can be used to request the shutdown a + * multi component test case _prior_ to reaching a + * synchronization point. It sends a STOP message to + * the sync server and awaits then the STOP from the server + * which will trigger the shutdown default (if activated). + * This function will set the server verdict to INCONC (and + * stop the test case) if no shutdown default is activated. + * This function will set only the client verdict to INCONC + * (and stop its execution) if no STOP response is received + * from the server within the PX_TSYNC_TIME_LIMIT + * or if no shutdown default is activated. In all other + * cases the client verdict is NOT set. + * @remark The use of this function requires prior connection + * of the client sync port! + * @see LibCommon_Sync.f_connect4ClientSync + * @see LibCommon_Sync.f_connect4SelfOrClientSync + * @see LibCommon_Sync.PX_TSYNC_TIME_LIMIT + * @see LibCommon_Sync.a_dummyShutDown + */ + function f_clientSendStop() + runs on ClientSyncComp { + log("**** f_clientSendStop: Sync client requesting from server to stop test case (including itself). ****") ; + syncPort.send(m_syncClientStop) ; + tc_sync.start; + alt{ + [] tc_sync.timeout{ + log("**** f_clientSendStop: Stopping sync client without shutdown - either no shutdown default active or no stop received from server. ****") ; + setverdict(inconc); + stop ; + } + }//end alt + tc_sync.stop; + stop; // stop here if shutdown default does not stop + } + + } // end group clientRelated + + } // end group advancedUserRelevantDefinitions + + group otherSyncModuleDefinitions { + + group syncModuleparams { + /** + * + * @desc Default time limit for a sync client to reach a + * synchronization point + */ + modulepar float PX_TSYNC_TIME_LIMIT := 120.0; + + /* + * @desc Default time limit for a sync client to finish + * its execution of the shutdown default + */ + modulepar float PX_TSHUT_DOWN_TIME_LIMIT := 120.0; + } + + group otherSyncTypes { + + type record of charstring SyncPointList; + + type record of ClientSyncComp ClientSyncCompList; + + } // end group otherSyncTypes + + group otherSelfSyncRelatedDefinitions { + + /** + * @desc This function creates the connection needed to + * execute self sync functions + * @see LibCommon_Sync.f_selfSync + * @see LibCommon_Sync.f_selfSyncStop + */ + function f_connect4SelfSync() + runs on SelfSyncComp { + connect(self:syncSendPort, self:syncPort); + }// end function f_connect4SelfSync + + /** + * @desc This function removes the connection needed + * to execute self sync functions + * @see LibCommon_Sync.f_selfSync + * @see LibCommon_Sync.f_selfSyncStop + */ + function f_disconnect4SelfSync() + runs on SelfSyncComp { + disconnect(self:syncSendPort, self:syncPort); + }// end function f_disconnect4SelfSync + + /** + * @desc This function combines MTC verdict setting with self + * synchronization for use in the preamble / test body / postamble + * @param p_syncId Synchronization point name/id + * @param p_ret Current behavior execution status + * @see LibCommon_VerdictControl.f_setVerdict + * @see LibCommon_Sync.f_selfSync + * @see LibCommon_Sync.a_dummyShutDown + */ + function f_selfSyncAndVerdict( in charstring p_syncId, + in FncRetCode p_ret ) + runs on SelfSyncComp { + if(vc_testcaseStep == e_preamble) { + f_selfSyncAndVerdictPreamble(p_syncId, p_ret); + } else if(vc_testcaseStep == e_testBody) { + f_selfSyncAndVerdictTestBody(p_syncId, p_ret); + } + else { + f_selfSyncAndVerdictPostamble(p_syncId, p_ret); + } + } + + /** + * @desc This function combines MTC verdict setting with self + * synchronization for use after the preamble. + * @param p_syncId Synchronization point name/id + * @param p_ret Current behavior execution status + * @see LibCommon_VerdictControl.f_setVerdictPreamble + * @see LibCommon_Sync.f_selfSync + */ + function f_selfSyncAndVerdictPreamble( in charstring p_syncId, + in FncRetCode p_ret ) + runs on SelfSyncComp { + f_setVerdictPreOrPostamble(p_ret); + f_selfSync(p_syncId,p_ret); + vc_testcaseStep := e_testBody; + } + + /** + * @desc This function combines MTC verdict setting with self + * synchronization for use after the test body. + * @param p_syncId Synchronization point name/id + * @param p_ret Current behavior execution status + * @see LibCommon_VerdictControl.f_setVerdict + * @see LibCommon_Sync.f_selfSync + */ + function f_selfSyncAndVerdictTestBody( in charstring p_syncId, + in FncRetCode p_ret ) + runs on SelfSyncComp { + f_setVerdict(p_ret); + f_selfSync(p_syncId,p_ret); + vc_testcaseStep := e_postamble; + } + + /** + * @desc This function combines MTC verdict setting with self + * synchronization for use after the postamble. + * @param p_syncId Synchronization point name/id + * @param p_ret Current behavior execution status + * @see LibCommon_VerdictControl.f_setVerdictPostamble + * @see LibCommon_Sync.f_selfSync + */ + function f_selfSyncAndVerdictPostamble( in charstring p_syncId , + in FncRetCode p_ret ) + runs on SelfSyncComp { + f_setVerdictPreOrPostamble(p_ret); + f_selfSync(p_syncId,p_ret); + } + + /** + * @desc This function synchronizes a MTC with itself. In case + * of a non successful execution status it sends a STOP + * message to itself and invokes that way the + * shutdown default (if activated). + * This function will set the server verdict to INCONC (and + * stop the test case) if no shutdown default is activated. + * Otherwise no verdict is set. + * @remark Sync ports should be connected prior to the invocation + * of this function! + * @param p_syncId Synchronization point name/id + * @param p_ret Current behavior execution status + * @return Updated execution status + * @see LibCommon_Sync.f_connect4SelfSync + * @see LibCommon_Sync.a_dummyShutDown + */ + function f_selfSync( in charstring p_syncId , + in FncRetCode p_ret ) + runs on SelfSyncComp + return FncRetCode{ + if (p_ret != e_success){ + f_selfSyncStop() ; // function will not return! + } + if ( p_syncId == c_prDone ) { + log("**** f_selfSync: Successfully passed PREAMBLE synchronization point. ****") ; + } else if ( p_syncId == c_tbDone ) { + log("**** f_selfSync: Successfully passed TEST BODY synchronization point. ****") ; + } else { + log("**** f_selfSync: Successfully passed synchronization point. ****") ; + } + return e_success ; + }// end function f_selfSync + + /** + * @desc This function can be used to shut down a test case _prior_ + * to reaching a synchronization point. it sends a STOP + * message to itself and invokes that way the + * shutdown default (if activated). + * This function will set the server verdict to INCONC (and + * stop the test case) if no shutdown default is activated. + * Otherwise no verdict is set. + * @remark Sync ports should be connected prior to the invocation + * of this function! + * @see LibCommon_Sync.f_connect4SelfSync + */ + function f_selfSyncStop() + runs on SelfSyncComp { + + log("**** f_selfSyncStop: MTC requests to stop test case (itself). ****") ; + syncSendPort.send(m_syncServerStop) ; // this MUST be _server_ for the default to catch! + tc_sync.start(PX_TSYNC_TIME_LIMIT); + alt{ + [] tc_sync.timeout{ + log("**** f_selfSyncStop: Stopping MTC without shutdown - either no shutdown default active or missing syncPort connection ****") ; + setverdict(inconc); + stop ; + } + }//end alt + tc_sync.stop; + stop; // if shutdown default is not activated or if it does not stop + } // end function f_selfSyncStop + + } // end group otherSelfSyncRelatedDefinitions + + /** + * + * @desc The sychronization protocol is conceptually based on + * named synchronization. Each synchronization point + * has it own specific synchronization message. This + * makes each synchronization unique, and allows, e.g., to + * ensure that a server synchronizes only clients which have + * reached the same synchronization point. + */ + group syncProtocolDefinition { + + type union SyncCmd { + ClientReady clientReady, + ServerReady serverReady, + ClientStop clientStop, + ServerStop serverStop + } + + type record ClientReady { + charstring syncPointId + } + + type record ServerReady { + charstring syncPointId + } + + type record ClientStop {} + + type record ServerStop {} + + } // end group syncProtocolDefinition + + group syncMessages { + template SyncCmd m_syncClientReady( template (present) charstring p_syncId ) := { + clientReady := { p_syncId } + } + + template SyncCmd m_syncServerReady( template (present) charstring p_syncId ) := { + serverReady := { p_syncId } + } + + template SyncCmd m_syncClientStop := { + clientStop := {} + } + + template SyncCmd m_syncServerStop := { + serverStop := {} + } + + } // end group syncMessages + + group otherSyncFunctions { + + /** + * @desc Makes server send a sync message to all known clients + * @param p_clientRefs List of client references to which the message is to be send + * @param p_syncCmd The actual synchronization message to be sent out + */ + function f_serverSendToAllClients( in ClientSyncCompList p_clientRefs, + in template (value) SyncCmd p_syncCmd) + runs on ServerSyncComp { + var integer i:=0; + for (i:=0; i< sizeof(p_clientRefs); i:=i+1 ){ + syncPort.send(p_syncCmd) to valueof(p_clientRefs[i]); + } + } // end function f_serverSendToAllClients + + /** + * @desc This function is intended only for use on server in concurrent + * TTCN-3 test cases. It waits for all components to shut down + * within the PX_TSHUT_DOWN_TIME_LIMIT. If a timeout occurs + * it aborts the test case (no matter how far clients got with their + * shutdown). + * This function sets the server verdict. + */ + function f_serverWaitForAllClientsToShutDown() + runs on ServerSyncComp { + + tc_shutDown.start(PX_TSHUT_DOWN_TIME_LIMIT); + alt { + [] syncPort.receive { + // clients may still try to send some sync message + } + [] all component.done { + tc_shutDown.stop; + log("**** f_serverWaitForAllClientsToShutDown: All components have properly shut down. Sync server will now terminate the test case. ****") ; + } + [] tc_shutDown.timeout { + log("**** f_serverWaitForAllClientsToShutDown: Not all clients have properly shutdown within the shut down time limit. Sync server will now terminate test case! ****") ; + } + } // end alt + // cover case that shut down default is NOT activated + setverdict(inconc); + //mtc.stop; + syncPort.send(m_syncServerStop) to self; // this MUST be _server_ for the default to catch! + tc_sync.start(PX_TSYNC_TIME_LIMIT); + alt{ + [] tc_sync.timeout{ + log("**** f_selfSyncStop: Stopping MTC without shutdown - either no shutdown default active or missing syncPort connection ****") ; + setverdict(inconc); + stop ; + } + }//end alt + tc_sync.stop; + stop; // if shutdown default is not activated or if it does not stop + } // end function f_serverWaitForAllClientsToShutDown + + function f_isPresentInArray(in ClientSyncComp p_clientRef, in ClientSyncCompList p_clientRefs) + return boolean { + var integer i; + for(i:=0; i < sizeof(p_clientRefs); i:=i+1) { + if(p_clientRefs[i] == p_clientRef) { + return true; + } + } + return false; + } + } // end group otherSyncFunctions + + } // end group otherSyncDefinitions + +} // end module LibCommon_Sync diff --git a/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh b/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh index 48ae46c..7586da8 100755 --- a/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh +++ b/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh @@ -53,6 +53,10 @@ ln -sf module_its.mk module.mk cd ${HOME}/dev/TS.ITS/ttcn/LibIts git checkout devel2 +cd ${HOME}/dev/TS.ITS/ +cp ./ttcn/patch_lib_common/module.mk ./ttcn/LibCommon/ +cp ./ttcn/patch_lib_common/ttcn/* ./ttcn/LibCommon/ttcn + echo -e "*****************************\n* Setup environment\n*****************************\n" cd ${HOME}/dev/TS.ITS/scripts chmod 775 *.bash devenv.bash.* -- GitLab From 856557d688db9dd2e2064266691be93f6234bab9 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 16 Mar 2023 17:48:36 +0100 Subject: [PATCH 054/178] First build of AtsMBR --- Makefile | 334 +++++++++--------- ccsrc/EncDec/LibItsMbr_Encdec.cc | 6 + ccsrc/EncDec/module.mk | 7 + ccsrc/Externals/LibItsMbr_externals.cc | 18 + ccsrc/Externals/module.mk | 5 +- .../MBR_ports/AdapterControlPort_Mbr.cc | 88 +++++ .../MBR_ports/AdapterControlPort_Mbr.hh | 38 ++ .../MBR_ports/UpperTesterMbrPort.cc | 103 ++++++ .../MBR_ports/UpperTesterMbrPort.hh | 47 +++ ccsrc/Ports/LibIts_ports/MBR_ports/module.mk | 2 + ccsrc/Ports/LibIts_ports/UpperTesterPort.hh | 15 + ccsrc/Protocols/Security/module.mk | 5 + ccsrc/Protocols/UpperTester/module.mk | 5 + .../UpperTester/uppertester_mbr_codec.cc | 147 ++++++++ .../UpperTester/uppertester_mbr_codec.hh | 48 +++ .../UpperTester/uppertester_mbr_layer.cc | 83 +++++ .../UpperTester/uppertester_mbr_layer.hh | 42 +++ .../uppertester_mbr_layer_factory.hh | 26 ++ titan-test-system-framework | 2 +- ttcn/AtsMBR | 2 +- ttcn/AtsPki | 2 +- .../ttcn/LibHttp_BinaryMessageBodyTypes.ttcn | 4 - .../ttcn/LibHttp_BinaryTemplates.ttcn | 4 - 23 files changed, 854 insertions(+), 179 deletions(-) create mode 100644 ccsrc/EncDec/LibItsMbr_Encdec.cc create mode 100644 ccsrc/Externals/LibItsMbr_externals.cc create mode 100644 ccsrc/Ports/LibIts_ports/MBR_ports/AdapterControlPort_Mbr.cc create mode 100644 ccsrc/Ports/LibIts_ports/MBR_ports/AdapterControlPort_Mbr.hh create mode 100644 ccsrc/Ports/LibIts_ports/MBR_ports/UpperTesterMbrPort.cc create mode 100644 ccsrc/Ports/LibIts_ports/MBR_ports/UpperTesterMbrPort.hh create mode 100644 ccsrc/Ports/LibIts_ports/MBR_ports/module.mk create mode 100644 ccsrc/Protocols/UpperTester/uppertester_mbr_codec.cc create mode 100644 ccsrc/Protocols/UpperTester/uppertester_mbr_codec.hh create mode 100644 ccsrc/Protocols/UpperTester/uppertester_mbr_layer.cc create mode 100644 ccsrc/Protocols/UpperTester/uppertester_mbr_layer.hh create mode 100644 ccsrc/Protocols/UpperTester/uppertester_mbr_layer_factory.hh diff --git a/Makefile b/Makefile index 884c1bf..c02b0a2 100644 --- a/Makefile +++ b/Makefile @@ -1,167 +1,167 @@ --include config.mk - -ifeq (,$(ATS)) - $(error ATS shall be defined) -endif - -ifeq (,$(TOPDIR)) - TOPDIR := . -endif - -ifeq (,$(TTCN3_DIR)) - $(error TTCN3_DIR shall be defined in config.mk) -endif - -ifeq (,$(ASN1C)) - ifneq (,$(ASN1C_PATH)) - ASN1C := $(ASN1C_PATH)/asn1c/.libs/asn1c -S $(ASN1C_PATH)/skeletons - else - ASN1C := asn1c - endif -endif - -export ASN1C_PATH - -first: all - -define IncludeModule -undefine sources -undefine modules -undefine includes -include $(1)/module.mk -$$(foreach S, $$(sources), $$(eval all_sources += $$(if $$(filter /%, $$(S)), $$(TOPDIR)$$(S), $(1)/$$(S)))) -$$(foreach I, $$(includes), $$(eval all_includes += $$(if $$(filter /%, $$(I)), $$(TOPDIR)$$(I), $(1)/$$(I)))) -$$(foreach M, $$(modules), $$(eval $$(call IncludeModule, $$(if $$(filter /%, $$(M)), $$(TOPDIR)$$(M), $(1)/$$(M))))) -endef - -all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src /usr/include/jsoncpp /usr/include/libxml2 -defines += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS) AS_USE_SSL _GNU_SOURCE -libs += $(TTCN3_DIR)/lib/libttcn3-rt2-parallel.a -lstdc++fs - -ifeq (Windows_NT,$(OS)) -# Silence linker warnings. -LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc -defines += WIN32 -libs += $(patsubst %, -L%/lib, $(OPENSSL_DIR)) -all_includes += $(addsuffix /include, $(OPENSSL_DIR)) -libs += $(WPCAP_DLL_PATH) -else -defines += LINUX -libs += -lpcap -lrt -lpthread -endif - -libs += -lssl -lcrypto -lxml2 -ljsoncpp - -$(eval $(call IncludeModule, $(TOPDIR)/ttcn/$(ATS))) - -outdir := $(TOPDIR)/build/$(ATS) -bindir := $(TOPDIR)/bin - -sources := $(all_sources) -includes := $(outdir) $(outdir)/.. $(outdir)/asn1 $(all_includes) $(NPCAP_INCLUDE) - -ifeq (Windows_NT,$(OS)) - EXE=.exe -endif - -ttcn_sources := $(filter %.ttcn , $(sources)) -ttcn3_sources := $(filter %.ttcn3, $(sources)) -asn_sources := $(filter %.asn, $(sources)) -asn1_sources := $(filter %.asn1, $(sources)) - -tt_sources := $(ttcn_sources) $(ttcn3_sources) $(asn_sources) $(asn1_sources) -cc_sources := $(filter %.cc, $(sources)) - -gen_ttcn_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn, %.cc, $(ttcn_sources)))) -gen_ttcn_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn, %.hh, $(ttcn_sources)))) -gen_ttcn3_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn3, %.cc, $(ttcn3_sources)))) -gen_ttcn3_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn3, %.hh, $(ttcn3_sources)))) -gen_asn_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn, %.cc, $(asn_sources)))) -gen_asn_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn, %.hh, $(asn_sources)))) -gen_asn1_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn1, %.cc, $(asn1_sources)))) -gen_asn1_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn1, %.hh, $(asn1_sources)))) - -gen_sources := $(gen_ttcn_sources) $(gen_ttcn3_sources) $(gen_asn_sources) $(gen_asn1_sources) -gen_headers := $(gen_ttcn_headers) $(gen_ttcn3_headers) $(gen_asn_headers) $(gen_asn1_headers) - -gen_objects := $(patsubst %.cc, %.o, $(gen_sources)) -cc_objects := $(patsubst %.cc, $(outdir)/%.o, $(cc_sources)) - -.PHONY: all FORCE echo - -all: $(bindir) $(outdir) $(bindir)/$(ATS)$(EXE) - -echo_sources: - @echo -e "$(addsuffix \n,$(all_sources))" - -echo: echo_sources - @echo -e "sources:\n $(addsuffix \n, $(sources))" - @echo -e "gen_sources:\n $(addsuffix \n, $(gen_sources))" - @echo -e "gen_objects:\n $(addsuffix \n, $(gen_objects))" - @echo -e "cc_objects:\n $(addsuffix \n, $(cc_objects))" - @echo -e "includes:\n $(addsuffix \n, $(includes))" - @echo -e "defines: $(addsuffix \n, $(defines))" - -clean: - rm -f $(outdir)/$(ATS)$(EXE) $(gen_objects) $(gen_sources) $(gen_headers) $(cc_objects) $(outdir)/.generate $(outdir)/../libItsAsn.so -# rm -f $(outdir)/asn1/*.so $(outdir)/asn1/*.o $(outdir)/asn1/*.c $(outdir)/asn1/*.h $(outdir)/asn1/Makefile.am.libasncodec - -regen: force_regen $(outdir)/.generate -force_regen: - rm -f $(outdir)/.generate - -t3q: all - @echo -e "Code checking in progress..." - @java -Xmx3g -Xss512m -jar $(T3Q_PATH)/t3q.jar --config $(T3Q_PATH)/$(T3Q_CONFIG) $(tt_sources) > $(outdir)/t3q.out 2>&1 ; cd - - @echo -e "Code checking in done..." - @echo -e "Output file is located here: $(outdir)/t3q.out" - -t3d: all - @echo -e "TTCN-3 doc generation in progress..." - @java -Xmx3g -Xss512m -jar $(T3D_PATH)/t3d.jar --config $(T3D_PATH)/$(T3D_CONFIG) $(tt_sources) > $(outdir)/t3d.out 2>&1 ; cd - - @echo -e "TTCN-3 doc generation done..." - @echo -e "Output file is located here: $(outdir)/t3d.out" - -$(outdir) $(outdir)/asn1 $(bindir): - mkdir -p $@ - -$(bindir)/$(ATS)$(EXE): $(outdir)/asn1/libItsAsn.a $(gen_objects) $(cc_objects) - g++ -g -O0 -std=c++17 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(outdir)/asn1/libItsAsn.a $(libs) - -$(gen_objects) :%.o :%.cc - g++ -g -O0 -std=c++17 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< - -$(cc_objects) : $(outdir)/%.o : %.cc - mkdir -p $(dir $@) - g++ -g -O0 -std=c++17 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< - -#$(gen_sources): -# $(TTCN3_DIR)/bin/compiler -n -e -L -R -U none -o $(outdir) $(tt_sources) - -$(gen_sources): $(outdir)/.generate - -$(outdir)/.generate: Makefile $(tt_sources) - $(TTCN3_DIR)/bin/compiler $(TTCN3_COMPILER_OPTIONS) -o $(outdir) $(tt_sources) - touch $@ - -$(bindir)/libItsAsn.so: $(outdir)/asn1/libItsAsn.so - cp -f $< $@ - -$(outdir)/asn1/libItsAsn.a: $(asn_sources) $(asn1_sources) libasn1.mk Makefile - mkdir -p $(outdir)/asn1 - echo TOP_DIR := ../../.. >$(outdir)/asn1/Makefile - echo ASN_PDU := $(pdu) >>$(outdir)/asn1/Makefile - echo ASN_FILES := \\ >>$(outdir)/asn1/Makefile - for n in $(asn_sources) $(asn1_sources); do echo " $$n \\"; done >>$(outdir)/asn1/Makefile - echo >>$(outdir)/asn1/Makefile - cat libasn1.mk >>$(outdir)/asn1/Makefile - $(MAKE) -C $(outdir)/asn1 - touch $@ - -$(foreach S, $(ttcn_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn, %.cc, $(S))): $(S))) -$(foreach S, $(ttcn3_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn3, %.cc, $(S))): $(S))) -$(foreach S, $(asn_sources), $(eval $(outdir)/$(notdir $(patsubst %.asn, %.cc, $(S))): $(S))) -$(foreach S, $(asn1_sources), $(eval $(outdir)/$(notdir $(patsubst %.asn1, %.cc, $(S))): $(S))) - -$(asn_sources) $(asn1_sources): - +-include config.mk + +ifeq (,$(ATS)) + $(error ATS shall be defined) +endif + +ifeq (,$(TOPDIR)) + TOPDIR := . +endif + +ifeq (,$(TTCN3_DIR)) + $(error TTCN3_DIR shall be defined in config.mk) +endif + +ifeq (,$(ASN1C)) + ifneq (,$(ASN1C_PATH)) + ASN1C := $(ASN1C_PATH)/asn1c/.libs/asn1c -S $(ASN1C_PATH)/skeletons + else + ASN1C := asn1c + endif +endif + +export ASN1C_PATH + +first: all + +define IncludeModule +undefine sources +undefine modules +undefine includes +include $(1)/module.mk +$$(foreach S, $$(sources), $$(eval all_sources += $$(if $$(filter /%, $$(S)), $$(TOPDIR)$$(S), $(1)/$$(S)))) +$$(foreach I, $$(includes), $$(eval all_includes += $$(if $$(filter /%, $$(I)), $$(TOPDIR)$$(I), $(1)/$$(I)))) +$$(foreach M, $$(modules), $$(eval $$(call IncludeModule, $$(if $$(filter /%, $$(M)), $$(TOPDIR)$$(M), $(1)/$$(M))))) +endef + +all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src /usr/include/jsoncpp /usr/include/libxml2 +defines += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS) AS_USE_SSL _GNU_SOURCE +libs += $(TTCN3_DIR)/lib/libttcn3-rt2-parallel.a -lstdc++fs + +ifeq (Windows_NT,$(OS)) +# Silence linker warnings. +LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc +defines += WIN32 +libs += $(patsubst %, -L%/lib, $(OPENSSL_DIR)) +all_includes += $(addsuffix /include, $(OPENSSL_DIR)) +libs += $(WPCAP_DLL_PATH) +else +defines += LINUX +libs += -lpcap -lrt -lpthread +endif + +libs += -lssl -lcrypto -lxml2 -ljsoncpp + +$(eval $(call IncludeModule, $(TOPDIR)/ttcn/$(ATS))) + +outdir := $(TOPDIR)/build/$(ATS) +bindir := $(TOPDIR)/bin + +sources := $(all_sources) +includes := $(outdir) $(outdir)/.. $(outdir)/asn1 $(all_includes) $(NPCAP_INCLUDE) + +ifeq (Windows_NT,$(OS)) + EXE=.exe +endif + +ttcn_sources := $(filter %.ttcn , $(sources)) +ttcn3_sources := $(filter %.ttcn3, $(sources)) +asn_sources := $(filter %.asn, $(sources)) +asn1_sources := $(filter %.asn1, $(sources)) + +tt_sources := $(ttcn_sources) $(ttcn3_sources) $(asn_sources) $(asn1_sources) +cc_sources := $(filter %.cc, $(sources)) + +gen_ttcn_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn, %.cc, $(ttcn_sources)))) +gen_ttcn_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn, %.hh, $(ttcn_sources)))) +gen_ttcn3_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn3, %.cc, $(ttcn3_sources)))) +gen_ttcn3_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn3, %.hh, $(ttcn3_sources)))) +gen_asn_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn, %.cc, $(asn_sources)))) +gen_asn_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn, %.hh, $(asn_sources)))) +gen_asn1_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn1, %.cc, $(asn1_sources)))) +gen_asn1_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn1, %.hh, $(asn1_sources)))) + +gen_sources := $(gen_ttcn_sources) $(gen_ttcn3_sources) $(gen_asn_sources) $(gen_asn1_sources) +gen_headers := $(gen_ttcn_headers) $(gen_ttcn3_headers) $(gen_asn_headers) $(gen_asn1_headers) + +gen_objects := $(patsubst %.cc, %.o, $(gen_sources)) +cc_objects := $(patsubst %.cc, $(outdir)/%.o, $(cc_sources)) + +.PHONY: all FORCE echo + +all: $(bindir) $(outdir) $(bindir)/$(ATS)$(EXE) + +echo_sources: + @echo -e "$(addsuffix \n,$(all_sources))" + +echo: echo_sources + @echo -e "sources:\n $(addsuffix \n, $(sources))" + @echo -e "gen_sources:\n $(addsuffix \n, $(gen_sources))" + @echo -e "gen_objects:\n $(addsuffix \n, $(gen_objects))" + @echo -e "cc_objects:\n $(addsuffix \n, $(cc_objects))" + @echo -e "includes:\n $(addsuffix \n, $(includes))" + @echo -e "defines: $(addsuffix \n, $(defines))" + +clean: + rm -f $(outdir)/$(ATS)$(EXE) $(gen_objects) $(gen_sources) $(gen_headers) $(cc_objects) $(outdir)/.generate $(outdir)/../libItsAsn.so +# rm -f $(outdir)/asn1/*.so $(outdir)/asn1/*.o $(outdir)/asn1/*.c $(outdir)/asn1/*.h $(outdir)/asn1/Makefile.am.libasncodec + +regen: force_regen $(outdir)/.generate +force_regen: + rm -f $(outdir)/.generate + +t3q: all + @echo -e "Code checking in progress..." + @java -Xmx3g -Xss512m -jar $(T3Q_PATH)/t3q.jar --config $(T3Q_PATH)/$(T3Q_CONFIG) $(tt_sources) > $(outdir)/t3q.out 2>&1 ; cd - + @echo -e "Code checking in done..." + @echo -e "Output file is located here: $(outdir)/t3q.out" + +t3d: all + @echo -e "TTCN-3 doc generation in progress..." + @java -Xmx3g -Xss512m -jar $(T3D_PATH)/t3d.jar --config $(T3D_PATH)/$(T3D_CONFIG) $(tt_sources) > $(outdir)/t3d.out 2>&1 ; cd - + @echo -e "TTCN-3 doc generation done..." + @echo -e "Output file is located here: $(outdir)/t3d.out" + +$(outdir) $(outdir)/asn1 $(bindir): + mkdir -p $@ + +$(bindir)/$(ATS)$(EXE): $(outdir)/asn1/libItsAsn.a $(gen_objects) $(cc_objects) + g++ -g -O0 -std=c++17 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(outdir)/asn1/libItsAsn.a $(libs) + +$(gen_objects) :%.o :%.cc + g++ -g -O0 -std=c++17 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< + +$(cc_objects) : $(outdir)/%.o : %.cc + mkdir -p $(dir $@) + g++ -g -O0 -std=c++17 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< + +#$(gen_sources): +# $(TTCN3_DIR)/bin/compiler -n -e -L -R -U none -o $(outdir) $(tt_sources) + +$(gen_sources): $(outdir)/.generate + +$(outdir)/.generate: Makefile $(tt_sources) + $(TTCN3_DIR)/bin/compiler $(TTCN3_COMPILER_OPTIONS) -o $(outdir) $(tt_sources) + touch $@ + +$(bindir)/libItsAsn.so: $(outdir)/asn1/libItsAsn.so + cp -f $< $@ + +$(outdir)/asn1/libItsAsn.a: $(asn_sources) $(asn1_sources) libasn1.mk Makefile + mkdir -p $(outdir)/asn1 + echo TOP_DIR := ../../.. >$(outdir)/asn1/Makefile + echo ASN_PDU := $(pdu) >>$(outdir)/asn1/Makefile + echo ASN_FILES := \\ >>$(outdir)/asn1/Makefile + for n in $(asn_sources) $(asn1_sources); do echo " $$n \\"; done >>$(outdir)/asn1/Makefile + echo >>$(outdir)/asn1/Makefile + cat libasn1.mk >>$(outdir)/asn1/Makefile + $(MAKE) -C $(outdir)/asn1 + touch $@ + +$(foreach S, $(ttcn_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn, %.cc, $(S))): $(S))) +$(foreach S, $(ttcn3_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn3, %.cc, $(S))): $(S))) +$(foreach S, $(asn_sources), $(eval $(outdir)/$(notdir $(patsubst %.asn, %.cc, $(S))): $(S))) +$(foreach S, $(asn1_sources), $(eval $(outdir)/$(notdir $(patsubst %.asn1, %.cc, $(S))): $(S))) + +$(asn_sources) $(asn1_sources): + diff --git a/ccsrc/EncDec/LibItsMbr_Encdec.cc b/ccsrc/EncDec/LibItsMbr_Encdec.cc new file mode 100644 index 0000000..0f92761 --- /dev/null +++ b/ccsrc/EncDec/LibItsMbr_Encdec.cc @@ -0,0 +1,6 @@ +#include "loggers.hh" + +namespace LibItsMbr__EncdecDeclarations { + + +} // End of namespace LibItsMbr__EncdecDeclarations diff --git a/ccsrc/EncDec/module.mk b/ccsrc/EncDec/module.mk index 578e439..fa6f04a 100644 --- a/ccsrc/EncDec/module.mk +++ b/ccsrc/EncDec/module.mk @@ -55,3 +55,10 @@ sources += \ LibItsPki_Encdec.cc \ LibItsCam_Encdec.cc endif + +ifeq (AtsMBR, $(ATS)) +sources += \ + LibItsBtp_Encdec.cc \ + LibItsMbr_Encdec.cc \ + LibItsCam_Encdec.cc +endif diff --git a/ccsrc/Externals/LibItsMbr_externals.cc b/ccsrc/Externals/LibItsMbr_externals.cc new file mode 100644 index 0000000..3e114b4 --- /dev/null +++ b/ccsrc/Externals/LibItsMbr_externals.cc @@ -0,0 +1,18 @@ +/*! + * \file LibItsMbr_externals.cc + * \brief Source file for PKI externl functions. + * \author ETSI STF594 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ + +//#include "LibItsMbr_Functions.hh" + +#include "loggers.hh" + +namespace LibItsMbr__Functions { + +} // End of namespace LibItsMbr__Functions diff --git a/ccsrc/Externals/module.mk b/ccsrc/Externals/module.mk index 8dab377..4f64a36 100644 --- a/ccsrc/Externals/module.mk +++ b/ccsrc/Externals/module.mk @@ -4,7 +4,6 @@ sources := LibItsCommon_externals.cc \ includes := ../geospacial - ifeq (AtsCAM, $(ATS)) sources += LibItsSecurity_externals.cc endif @@ -25,6 +24,10 @@ ifeq (AtsPki, $(ATS)) sources += LibItsPki_externals.cc LibItsSecurity_externals.cc endif +ifeq (AtsMBR, $(ATS)) +sources += LibItsMbr_externals.cc LibItsSecurity_externals.cc +endif + ifeq (AtsGeoNetworking, $(ATS)) sources += LibItsSecurity_externals.cc endif diff --git a/ccsrc/Ports/LibIts_ports/MBR_ports/AdapterControlPort_Mbr.cc b/ccsrc/Ports/LibIts_ports/MBR_ports/AdapterControlPort_Mbr.cc new file mode 100644 index 0000000..6cf40ce --- /dev/null +++ b/ccsrc/Ports/LibIts_ports/MBR_ports/AdapterControlPort_Mbr.cc @@ -0,0 +1,88 @@ +#include + +#include "loggers.hh" +#include "registration.hh" + +#include "AdapterControlPort_Mbr.hh" +//============================================================================= +namespace LibItsMbr__TestSystem { + + AdapterControlPort::AdapterControlPort(const char *par_port_name) : AdapterControlPort_BASE(par_port_name)/*, _params()*/ { + loggers::get_instance().log("AdapterControlPort::AdapterControlPort"); + } + + AdapterControlPort::~AdapterControlPort() {} + + void AdapterControlPort::set_parameter(const char *parameter_name, const char *parameter_value) { + loggers::get_instance().log("AdapterControlPort::set_parameter: %s=%s", parameter_name, parameter_value); + } + + /*void AdapterControlPort::Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error) {}*/ + + void AdapterControlPort::Handle_Fd_Event_Error(int /*fd*/) {} + + void AdapterControlPort::Handle_Fd_Event_Writable(int /*fd*/) {} + + void AdapterControlPort::Handle_Fd_Event_Readable(int /*fd*/) {} + + /*void AdapterControlPort::Handle_Timeout(double time_since_last_call) {}*/ + + void AdapterControlPort::user_map(const char *system_port) { loggers::get_instance().log(">>> AdapterControlPort::user_map: %s", system_port); } + + void AdapterControlPort::user_unmap(const char *system_port) { loggers::get_instance().log(">>> AdapterControlPort::user_unmap: %s", system_port); } + + void AdapterControlPort::user_start() {} + + void AdapterControlPort::user_stop() {} + + void AdapterControlPort::outgoing_send(const LibItsMbr__TypesAndValues::AcMbrPrimitive &send_par) {/* + loggers::get_instance().log_msg(">>> AdapterControlPort::outgoing_send: ", send_par); + + // Register this object for AdapterControlPort + geonetworking_layer *p = registration::get_instance().get_item(std::string("GN")); + if (p != NULL) { + loggers::get_instance().log("AdapterControlPort::outgoing_send: Got GN layer %p", p); + LibItsGeoNetworking__TypesAndValues::AcGnResponse response; + response.failure() = LibItsGeoNetworking__TypesAndValues::AcGnResponseFailure(BOOLEAN(false)); + if (send_par.ischosen(LibItsGeoNetworking__TypesAndValues::AcGnPrimitive::ALT_startBeaconing)) { + loggers::get_instance().log("AdapterControlPort::outgoing_send: Start beaconing"); + p->start_beaconing(send_par.startBeaconing().beaconPacket()); + // No response + return; + } else if (send_par.ischosen(LibItsGeoNetworking__TypesAndValues::AcGnPrimitive::ALT_stopBeaconing)) { + loggers::get_instance().log("AdapterControlPort::outgoing_send: Stop beaconing"); + p->stop_beaconing(); + // No response + return; + } else if (send_par.ischosen(LibItsGeoNetworking__TypesAndValues::AcGnPrimitive::ALT_getLongPosVector)) { + loggers::get_instance().log("AdapterControlPort::outgoing_send: Get LongPosVector"); + const LibItsGeoNetworking__TypesAndValues::LongPosVector *lpv = p->get_lpv(send_par.getLongPosVector().gnAddress()); + loggers::get_instance().log("AdapterControlPort::outgoing_send: Return value: %p", lpv); + if (lpv == nullptr) { + response.failure() = LibItsGeoNetworking__TypesAndValues::AcGnResponseFailure(BOOLEAN(true)); + } else { + response.getLongPosVector() = *lpv; + } + } else if (send_par.ischosen(LibItsGeoNetworking__TypesAndValues::AcGnPrimitive::ALT_startPassBeaconing)) { + loggers::get_instance().log("AdapterControlPort::outgoing_send: Start pass beaconing"); + p->start_pass_beaconing(send_par.startPassBeaconing().beaconHeader()); + // No response + return; + } else if (send_par.ischosen(LibItsGeoNetworking__TypesAndValues::AcGnPrimitive::ALT_stopPassBeaconing)) { + loggers::get_instance().log("AdapterControlPort::outgoing_send: Stop pass beaconing"); + p->stop_pass_beaconing(); + // No response + return; + } else { + response.failure() = LibItsGeoNetworking__TypesAndValues::AcGnResponseFailure(BOOLEAN(true)); + } + // Send response + loggers::get_instance().log_msg("AdapterControlPort::outgoing_send: Send response: ", response); + incoming_message(response); + } else { + loggers::get_instance().error("AdapterControlPort::outgoing_send: %s not registered", "geoNetworkingPort"); + }*/ + } + +} // namespace LibItsMbr__TestSystem diff --git a/ccsrc/Ports/LibIts_ports/MBR_ports/AdapterControlPort_Mbr.hh b/ccsrc/Ports/LibIts_ports/MBR_ports/AdapterControlPort_Mbr.hh new file mode 100644 index 0000000..fadf4b9 --- /dev/null +++ b/ccsrc/Ports/LibIts_ports/MBR_ports/AdapterControlPort_Mbr.hh @@ -0,0 +1,38 @@ +//============================================================================= +#ifndef AdapterControlPort_Mbr_HH +#define AdapterControlPort_Mbr_HH + +#include "LibItsMbr_TestSystem.hh" + +//#include "params.hh" + +namespace LibItsMbr__TestSystem { + + class AdapterControlPort : public AdapterControlPort_BASE { +// params _params; + + public: + AdapterControlPort(const char *par_port_name = NULL); + ~AdapterControlPort(); + + void set_parameter(const char *parameter_name, const char *parameter_value); + + private: + /* void Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error); */ + void Handle_Fd_Event_Error(int fd); + void Handle_Fd_Event_Writable(int fd); + void Handle_Fd_Event_Readable(int fd); + /* void Handle_Timeout(double time_since_last_call); */ + protected: + void user_map(const char *system_port); + void user_unmap(const char *system_port); + + void user_start(); + void user_stop(); + + void outgoing_send(const LibItsMbr__TypesAndValues::AcMbrPrimitive &send_par); + }; + +} // namespace LibItsMbr__TestSystem +#endif diff --git a/ccsrc/Ports/LibIts_ports/MBR_ports/UpperTesterMbrPort.cc b/ccsrc/Ports/LibIts_ports/MBR_ports/UpperTesterMbrPort.cc new file mode 100644 index 0000000..9ae6f02 --- /dev/null +++ b/ccsrc/Ports/LibIts_ports/MBR_ports/UpperTesterMbrPort.cc @@ -0,0 +1,103 @@ +#include + +#include "UpperTesterMbrPort.hh" + +#include "loggers.hh" + +#include "uppertester_mbr_layer.hh" +#include "uppertester_mbr_layer_factory.hh" + +//============================================================================= +namespace LibItsMbr__TestSystem { + + UpperTesterMbrPort::UpperTesterMbrPort(const char *par_port_name) + : UpperTesterMbrPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(NULL), _time_key("UpperTesterMbrPort_Mbr::outgoing_send") { + loggers::get_instance().log("UpperTesterMbrPort_Mbr::UpperTesterMbrPort_Mbr"); + } + + UpperTesterMbrPort::~UpperTesterMbrPort() { + if (_layer != NULL) { + delete _layer; + } + } + + void UpperTesterMbrPort::set_parameter(const char *parameter_name, const char *parameter_value) { + loggers::get_instance().log("UpperTesterMbrPort_Mbr::set_parameter: %s=%s", parameter_name, parameter_value); + _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value))); + _cfg_params.log(); + } + + /*void UpperTesterMbrPort::Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error) {}*/ + + void UpperTesterMbrPort::Handle_Fd_Event_Error(int /*fd*/) {} + + void UpperTesterMbrPort::Handle_Fd_Event_Writable(int /*fd*/) {} + + void UpperTesterMbrPort::Handle_Fd_Event_Readable(int /*fd*/) {} + + /*void UpperTesterMbrPort::Handle_Timeout(double time_since_last_call) {}*/ + + void UpperTesterMbrPort::user_map(const char *system_port) { + loggers::get_instance().log(">>> UpperTesterMbrPort_Mbr::user_map: %s", system_port); + // Build layer stack + params_its::iterator it = _cfg_params.find(std::string("params")); + if (it != _cfg_params.end()) { + loggers::get_instance().log("UpperTesterMbrPort_Mbr::user_map: %s", it->second.c_str()); + _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); + if (static_cast(_layer) == NULL) { + loggers::get_instance().error("UpperTesterMbrPort_Mbr::user_map: Invalid stack configuration: %s", it->second.c_str()); + } + static_cast(_layer)->add_upper_port(this); + } else { + loggers::get_instance().error("UpperTesterMbrPort_Mbr::user_map: No layers defined in configuration file"); + } + } + + void UpperTesterMbrPort::user_unmap(const char *system_port) { + loggers::get_instance().log(">>> UpperTesterMbrPort_Mbr::user_unmap: %s", system_port); + if (_layer != NULL) { + delete _layer; + _layer = NULL; + } + } + + void UpperTesterMbrPort::user_start() {} + + void UpperTesterMbrPort::user_stop() {} + + void UpperTesterMbrPort::outgoing_send(const LibItsMbr__TypesAndValues::UtMbrInitialize &send_par) { + loggers::get_instance().log_msg(">>> UppertesterPort::outgoing_send: ", send_par); + + float duration; + loggers::get_instance().set_start_time(_time_key); + static_cast(_layer)->sendMsg(send_par, _layer_params); + loggers::get_instance().set_stop_time(_time_key, duration); + } + + void UpperTesterMbrPort::outgoing_send(const LibItsMbr__TypesAndValues::UtMbrTrigger &send_par) { + loggers::get_instance().log_msg(">>> UppertesterPort::outgoing_send: ", send_par); + + float duration; + loggers::get_instance().set_start_time(_time_key); + static_cast(_layer)->sendMsg(send_par, _layer_params); + loggers::get_instance().set_stop_time(_time_key, duration); + } + + void UpperTesterMbrPort::receiveMsg(const Base_Type &p_ind, const params &p_params) { + loggers::get_instance().log_msg(">>> UpperTesterMbrPort_Mbr::receive_msg: ", p_ind); + // Sanity check + if (!p_ind.is_bound()) { + return; + } + + if (std::string(p_ind.get_descriptor()->name).compare("@LibItsMbr_TypesAndValues.UtMbrResults") == 0) { // TODO To be refined + incoming_message(static_cast(p_ind)); + } else if (std::string(p_ind.get_descriptor()->name).compare("@LibItsMbr_TypesAndValues.UtMbrEventInd") == 0) { // TODO To be refined + incoming_message(static_cast(p_ind)); + } else { + loggers::get_instance().warning("UpperTesterMbrPort_Mbr::receive_msg: Message not processed: %s", p_ind.get_descriptor()->name); + } + } + +} // namespace LibItsMbr__TestSystem diff --git a/ccsrc/Ports/LibIts_ports/MBR_ports/UpperTesterMbrPort.hh b/ccsrc/Ports/LibIts_ports/MBR_ports/UpperTesterMbrPort.hh new file mode 100644 index 0000000..c1e1dc7 --- /dev/null +++ b/ccsrc/Ports/LibIts_ports/MBR_ports/UpperTesterMbrPort.hh @@ -0,0 +1,47 @@ +#ifndef UpperTesterMbrPort_HH +#define UpperTesterMbrPort_HH + +//============================================================================= +#include "LibItsMbr_TestSystem.hh" + +#include "layer.hh" +#include "params.hh" + +namespace LibItsMbr__TestSystem { + + class UpperTesterMbrPort : public UpperTesterMbrPort_BASE { + params _cfg_params; + params _layer_params; + layer * _layer; + std::string _time_key; + + public: + UpperTesterMbrPort(const char *par_port_name = NULL); + ~UpperTesterMbrPort(); + + void set_parameter(const char *parameter_name, const char *parameter_value); + + void receiveMsg(const Base_Type &, const params &); + + private: + /* void Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error); */ + void Handle_Fd_Event_Error(int fd); + void Handle_Fd_Event_Writable(int fd); + void Handle_Fd_Event_Readable(int fd); + /* void Handle_Timeout(double time_since_last_call); */ + protected: + void user_map(const char *system_port); + void user_unmap(const char *system_port); + + void user_start(); + void user_stop(); + + void outgoing_send(const LibItsMbr__TypesAndValues::UtMbrInitialize &send_par); + + void outgoing_send(const LibItsMbr__TypesAndValues::UtMbrTrigger &send_par); + + }; + +} // namespace LibItsMbr__TestSystem +#endif diff --git a/ccsrc/Ports/LibIts_ports/MBR_ports/module.mk b/ccsrc/Ports/LibIts_ports/MBR_ports/module.mk new file mode 100644 index 0000000..26c1077 --- /dev/null +++ b/ccsrc/Ports/LibIts_ports/MBR_ports/module.mk @@ -0,0 +1,2 @@ +sources := UpperTesterMbrPort.cc +includes := . diff --git a/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh b/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh index 96e4762..82e0da2 100644 --- a/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh +++ b/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh @@ -40,6 +40,14 @@ #endif #endif +#ifdef AtsMBR +#include "BTP_ports/UpperTesterPort_BTP.hh" +#include "GN_ports/UpperTesterPort_GN.hh" +#ifndef LibItsGeoNetworking__TestSystem_HH +#include "MBR_ports/UpperTesterMbrPort.hh" +#endif +#endif + #ifdef AtsIS #include "BTP_ports/UpperTesterPort_BTP.hh" #include "GN_ports/UpperTesterPort_GN.hh" @@ -101,6 +109,13 @@ #include "UpperTesterPort_GN.hh" #endif +#ifdef AtsMBR +#include "UpperTesterPort_BTP.hh" +#include "UpperTesterPort_CAM.hh" +#include "UpperTesterPort_DENM.hh" +#include "UpperTesterPort_GN.hh" +#endif + #ifdef AtsIS #include "UpperTesterPort_BTP.hh" #include "UpperTesterPort_GN.hh" diff --git a/ccsrc/Protocols/Security/module.mk b/ccsrc/Protocols/Security/module.mk index b77da2c..35c24c1 100644 --- a/ccsrc/Protocols/Security/module.mk +++ b/ccsrc/Protocols/Security/module.mk @@ -27,6 +27,11 @@ sources += http_etsi_ieee1609dot2_codec.cc \ endif +ifeq (AtsMBR, $(ATS)) +sources += http_etsi_ieee1609dot2_codec.cc \ + +endif + ifeq (AtsRSUsSimulator, $(ATS)) sources += http_etsi_ieee1609dot2_codec.cc \ etsi_ts102941_base_types_public_keys.cc \ diff --git a/ccsrc/Protocols/UpperTester/module.mk b/ccsrc/Protocols/UpperTester/module.mk index c8ea294..027b1ef 100644 --- a/ccsrc/Protocols/UpperTester/module.mk +++ b/ccsrc/Protocols/UpperTester/module.mk @@ -23,6 +23,10 @@ ifeq (AtsPki, $(ATS)) sources += uppertester_pki_codec.cc uppertester_pki_layer.cc uppertester_cam_codec.cc endif +ifeq (AtsMBR, $(ATS)) +sources += uppertester_mbr_codec.cc uppertester_mbr_layer.cc uppertester_cam_codec.cc +endif + ifeq (AtsSecurity, $(ATS)) sources += uppertester_cam_codec.cc uppertester_cam_layer.cc \ uppertester_denm_codec.cc uppertester_denm_layer.cc \ @@ -37,6 +41,7 @@ sources += uppertester_cam_codec.cc uppertester_cam_layer.cc \ uppertester_mapem_spatem_codec.cc uppertester_mapem_spatem_layer.cc \ UpperTesterRtcmemCodec.cc UpperTesterRtcmemLayer.cc \ uppertester_pki_codec.cc uppertester_pki_layer.cc \ + uppertester_mbr_codec.cc uppertester_mbr_layer.cc \ endif diff --git a/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.cc new file mode 100644 index 0000000..2d6065b --- /dev/null +++ b/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.cc @@ -0,0 +1,147 @@ +#include +//#include + +#include "loggers.hh" +#include "uppertester_mbr_codec.hh" + +#include "LibItsMbr_TestSystem.hh" +#include "LibItsMbr_TypesAndValues.hh" + +//#include "pki_codec.hh" + +template class OPTIONAL; +class TTCN_EncDec; + +unsigned char uppertester_mbr_codec::c_utMbrInitialize = 0x00; +unsigned char uppertester_mbr_codec::c_utMbrInitializeResult = 0x01; +unsigned char uppertester_mbr_codec::c_utMbrTriggerResult = 0xF2; +unsigned char uppertester_mbr_codec::c_utMbrEventInd = 0xF3; + +int uppertester_mbr_codec::encode(const Record_Type &msg, OCTETSTRING &data) { + loggers::get_instance().log_msg(">>> uppertester_mbr_codec::encode (1): ", (const Record_Type &)msg); + + TTCN_EncDec::clear_error(); + TTCN_Buffer encoding_buffer; + if (std::string(msg.get_descriptor()->name).compare("@LibItsMbr_TypesAndValues.UtMbrInitialize") == 0) { + encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrInitialize)); + } else { // Error + data = OCTETSTRING(0, nullptr); + loggers::get_instance().warning("<<< uppertester_mbr_codec::encode: Failed to encode UT message"); + return -1; + } + encode_(msg, *msg.get_descriptor(), encoding_buffer); + data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); + loggers::get_instance().log_msg("<<< uppertester_mbr_codec::encode: data=", data); + return 0; +} + +int uppertester_mbr_codec::encode(const LibItsMbr__TypesAndValues::UtMbrTrigger &msg, OCTETSTRING &data) { + loggers::get_instance().log_msg(">>> uppertester_mbr_codec::encode (2): ", (const Record_Type &)msg); + + TTCN_EncDec::clear_error(); + TTCN_Buffer encoding_buffer; + // const Record_Type *type; + const LibItsMbr__TypesAndValues::UtMbrTrigger &u = static_cast(msg); + if (u.ischosen(LibItsMbr__TypesAndValues::UtMbrTrigger::ALT_idMbObs)) { + /*encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrTriggerEnrolmentRequest)); + encoding_buffer.put_c(static_cast(u.triggerEnrolmentRequest().cannonicalId().lengthof())); // Length of the string + encoding_buffer.put_string(u.triggerEnrolmentRequest().cannonicalId()); + encoding_buffer.put_os(u.triggerEnrolmentRequest().encAlgorithm()); // One byte + encoding_buffer.put_os(u.triggerEnrolmentRequest().privateKey()); // 32 bytes + encoding_buffer.put_os(u.triggerEnrolmentRequest().compressedPublickey()); //33 bytes + */ + } else { // Error + data = OCTETSTRING(0, nullptr); + loggers::get_instance().warning("<<< uppertester_mbr_codec::encode: Failed to encode UT message"); + return -1; + } + // encode_(*type, *type->get_descriptor(), encoding_buffer); + data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); + loggers::get_instance().log_msg("<<< uppertester_mbr_codec::encode: data=", data); + return 0; +} + +int uppertester_mbr_codec::encode(const LibItsMbr__TypesAndValues::UtMbrEventInd &msg, OCTETSTRING &data) { + loggers::get_instance().log_msg(">>> uppertester_mbr_codec::encode (3): ", (const Record_Type &)msg); + + TTCN_EncDec::clear_error(); + TTCN_Buffer encoding_buffer; + // const Record_Type *type; + encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrEventInd)); + loggers::get_instance().error("uppertester_mbr_codec::encode: To be implemented"); +// encoding_buffer.put_c(static_cast(msg.state())); + data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); + loggers::get_instance().log_msg("<<< uppertester_mbr_codec::encode: data=", data); + return 0; +} + +int uppertester_mbr_codec::encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer) { + loggers::get_instance().log(">>> uppertester_mbr_codec::encode_: processing %s/%s/%p", type.get_descriptor()->name, field_descriptor.name, + dynamic_cast(&type)); + loggers::get_instance().log_msg(">>> uppertester_mbr_codec::encode_: ", type); + + if (dynamic_cast(&type) != NULL) { + const Record_Type &r = (const Record_Type &)type; + loggers::get_instance().log("uppertester_mbr_codec::encode_: processing Record_Type %s", r.get_descriptor()->name); + for (int i = 0; i < r.get_count(); i++) { + loggers::get_instance().log("uppertester_mbr_codec::encode_: processing %s/%s/%s - %d (1 ==> use dynamic_cast) - %d", r.fld_name(i), + r.fld_descr(i)->name, r.get_at(i)->get_descriptor()->name, r.get_at(i)->is_optional(), r.get_at(i)->is_present()); + if (r.get_at(i)->is_present()) { + if (encode_(*r.get_at(i), *r.fld_descr(i), encoding_buffer) == -1) { + loggers::get_instance().warning("uppertester_mbr_codec::encode_: -1 result code returned"); + return -1; + } + } else if (std::string(r.fld_name(i)).compare("alacarte") == 0) { + // Add empty field length + loggers::get_instance().log("uppertester_mbr_codec::encode_: alacarte is missing, add 0x00"); + encoding_buffer.put_c(0x00); + } + } // End of 'for' statement + } else { + std::string s(field_descriptor.name); + loggers::get_instance().log("uppertester_mbr_codec::encode_: field to process %s", s.c_str()); + + loggers::get_instance().log("uppertester_mbr_codec::encode_ (else): processing type %s/%s", type.get_descriptor()->name, field_descriptor.name); + type.encode(field_descriptor, encoding_buffer, TTCN_EncDec::CT_RAW); + } + + loggers::get_instance().log_to_hexa("<<>> uppertester_mbr_codec::decode: decoding_buffer=", decoding_buffer); + // decode_(msg, *msg.get_descriptor(), decoding_buffer); + + loggers::get_instance().log_msg("<<< uppertester_mbr_codec::decode: ", (const Record_Type &)msg); + return 0; +} + +std::unique_ptr uppertester_mbr_codec::decode(const OCTETSTRING &data, params_its *params) { + + std::unique_ptr result; + + const unsigned char * ptr = static_cast(data); + if (*ptr == uppertester_mbr_codec::c_utMbrInitializeResult) { + LibItsMbr__TypesAndValues::UtMbrResults msg; + msg.utMbrInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); + result.reset((Base_Type *)msg.clone()); + } else if (*ptr == uppertester_mbr_codec::c_utMbrTriggerResult) { + LibItsMbr__TypesAndValues::UtMbrResults msg; + msg.utMbrTriggerResult() = BOOLEAN(*(ptr + 1) == 0x01); + result.reset((Base_Type *)msg.clone()); + } else if (*ptr == uppertester_mbr_codec::c_utMbrEventInd) { + LibItsMbr__TypesAndValues::UtMbrEventInd msg; + loggers::get_instance().error("uppertester_mbr_codec::decode: To be implemented"); +// msg.state() = INTEGER(static_cast(*(ptr + 1))); + result.reset((Base_Type *)msg.clone()); + } else { + result.reset(nullptr); + } + + return result; +} diff --git a/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.hh new file mode 100644 index 0000000..c260a30 --- /dev/null +++ b/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.hh @@ -0,0 +1,48 @@ +/*! + * \file uppertester_mbr_codec.hh + * \brief Header file for ITS UpperTester PKI codec definition. + * \author ETSI TTF T027 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ +#pragma once + +#include + +#include "codec.hh" +#include "params.hh" + +class Base_Type; +class Record_Type; +class TTCN_Typedescriptor_t; +class TTCN_Buffer; + +namespace LibItsMbr__TypesAndValues { + class UtMbrTrigger; + class UtMbrResults; + class UtMbrEventInd; +} // namespace LibItsMbr__TypesAndValues + +class uppertester_mbr_codec : public codec { +public: + static unsigned char c_utMbrInitialize; + static unsigned char c_utMbrInitializeResult; + static unsigned char c_utMbrTriggerResult; + static unsigned char c_utMbrEventInd; + +private: + int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); + +public: + uppertester_mbr_codec() : codec(){}; + virtual ~uppertester_mbr_codec(){}; + + virtual int encode(const Record_Type &, OCTETSTRING &data); + int encode(const LibItsMbr__TypesAndValues::UtMbrTrigger &, OCTETSTRING &data); + int encode(const LibItsMbr__TypesAndValues::UtMbrEventInd &, OCTETSTRING &data); + virtual int decode(const OCTETSTRING &data, Record_Type &, params_its *params = NULL); + std::unique_ptr decode(const OCTETSTRING &data, params_its *params = NULL); +}; // End of class uppertester_mbr_codec diff --git a/ccsrc/Protocols/UpperTester/uppertester_mbr_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_mbr_layer.cc new file mode 100644 index 0000000..1a90041 --- /dev/null +++ b/ccsrc/Protocols/UpperTester/uppertester_mbr_layer.cc @@ -0,0 +1,83 @@ +#include "uppertester_mbr_layer_factory.hh" + +#include "LibItsMbr_TestSystem.hh" +#include "LibItsMbr_TypesAndValues.hh" + +#include "loggers.hh" + +uppertester_mbr_layer::uppertester_mbr_layer(const std::string &p_type, const std::string ¶m) + : t_layer(p_type), _params(), _codec() { + loggers::get_instance().log(">>> uppertester_mbr_layer::uppertester_mbr_layer: %s, %s", to_string().c_str(), param.c_str()); + // Setup parameters + params::convert(_params, param); + params::const_iterator it = _params.find(params::loopback); + if (it == _params.cend()) { + _params.insert(std::pair(params::loopback, "0")); + } +} + +void uppertester_mbr_layer::sendMsg(const LibItsMbr__TypesAndValues::UtMbrInitialize &send_par, params &p_params) { + loggers::get_instance().log_msg(">>> uppertester_mbr_layer::sendMsg", send_par); + + if (_params[params::loopback].compare("1") == 0) { + LibItsMbr__TypesAndValues::UtMbrResults ut_mbr_results; + ut_mbr_results.utMbrInitializeResult() = BOOLEAN(true); + to_all_upper_ports(ut_mbr_results, p_params); + } else { + // Encode UpperTester PDU + OCTETSTRING data; + _codec.encode((const Record_Type &)send_par, data); + // Update parameters + send_data(data, p_params); + } +} + +void uppertester_mbr_layer::sendMsg(const LibItsMbr__TypesAndValues::UtMbrTrigger &send_par, params &p_params) { + loggers::get_instance().log_msg(">>> uppertester_mbr_layer::sendMsg", send_par); + + if (_params[params::loopback].compare("1") == 0) { + LibItsMbr__TypesAndValues::UtMbrResults ut_mbr_results; + ut_mbr_results.utMbrTriggerResult() = BOOLEAN(true); + to_all_upper_ports(ut_mbr_results, p_params); + } else { + // Encode UpperTester PDU + OCTETSTRING data; + _codec.encode(send_par, data); + // Update parameters + send_data(data, p_params); + } +} + +void uppertester_mbr_layer::sendMsg(const LibItsMbr__TypesAndValues::UtMbrEventInd &send_par, params &p_params) { + loggers::get_instance().log_msg(">>> uppertester_mbr_layer::sendMsg", send_par); + + if (_params[params::loopback].compare("1") == 0) { + LibItsMbr__TypesAndValues::UtMbrResults ut_mbr_results; + ut_mbr_results.utMbrTriggerResult() = BOOLEAN(true); + to_all_upper_ports(ut_mbr_results, p_params); + } else { + // Encode UpperTester PDU + OCTETSTRING data; + _codec.encode(send_par, data); + // Update parameters + send_data(data, p_params); + } +} + +void uppertester_mbr_layer::send_data(OCTETSTRING &data, params &p_params) { + loggers::get_instance().log_msg(">>> uppertester_mbr_layer::send_data: ", data); + // params.log(); + send_to_all_layers(data, p_params); +} + +void uppertester_mbr_layer::receive_data(OCTETSTRING &data, params &p_params) { + loggers::get_instance().log_msg(">>> uppertester_mbr_layer::receive_data: ", data); + + std::unique_ptr r = _codec.decode(data); + if (r.get() != nullptr) { + // Pass it to the ports if any + to_all_upper_ports(*r, p_params); + } +} + +uppertester_mbr_layer_factory uppertester_mbr_layer_factory::_f; diff --git a/ccsrc/Protocols/UpperTester/uppertester_mbr_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_mbr_layer.hh new file mode 100644 index 0000000..ac2b6f2 --- /dev/null +++ b/ccsrc/Protocols/UpperTester/uppertester_mbr_layer.hh @@ -0,0 +1,42 @@ +/*! + * \file uppertester_mbr_layer.hh + * \brief Header file for ITS UpperTester PKI protocol layer definition. + * \author ETSI TTF T027 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ +#pragma once + +#include + +#include "t_layer.hh" +#include "uppertester_mbr_codec.hh" + +namespace LibItsMbr__TestSystem { + class UpperTesterMbrPort; +} + +namespace LibItsMbr__TypesAndValues { + class UtMbrInitialize; + class UtMbrTrigger; +} // namespace LibItsMbr__TypesAndValues + +class uppertester_mbr_layer : public t_layer { + params _params; + uppertester_mbr_codec _codec; + +public: + uppertester_mbr_layer() : t_layer(), _params(), _codec(){}; + uppertester_mbr_layer(const std::string &p_type, const std::string ¶m); + virtual ~uppertester_mbr_layer(){}; + + void sendMsg(const LibItsMbr__TypesAndValues::UtMbrInitialize &send_par, params& p_params); + void sendMsg(const LibItsMbr__TypesAndValues::UtMbrTrigger &send_par, params& p_params); + void sendMsg(const LibItsMbr__TypesAndValues::UtMbrEventInd &send_par, params& p_params); + + virtual void send_data(OCTETSTRING &data, params& p_params); + virtual void receive_data(OCTETSTRING &data, params& params); +}; // End of class uppertester_mbr_layer diff --git a/ccsrc/Protocols/UpperTester/uppertester_mbr_layer_factory.hh b/ccsrc/Protocols/UpperTester/uppertester_mbr_layer_factory.hh new file mode 100644 index 0000000..9d6bde8 --- /dev/null +++ b/ccsrc/Protocols/UpperTester/uppertester_mbr_layer_factory.hh @@ -0,0 +1,26 @@ +/*! + * \file uppertester_mbr_layer_factory.hh + * \brief Header file for ITS PKI Upper Tester protocol layer factory. + * \author ETSI TTF T027 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ +#pragma once + +#include "layer_stack_builder.hh" + +#include "uppertester_mbr_layer.hh" + +class uppertester_mbr_layer_factory : public layer_factory { + static uppertester_mbr_layer_factory _f; + +public: + uppertester_mbr_layer_factory() { + // Register factory + layer_stack_builder::register_layer_factory("UT_PKI", this); + }; + inline virtual layer *create_layer(const std::string &p_type, const std::string &p_param) { return new uppertester_mbr_layer(p_type, p_param); }; +}; // End of class uppertester_mbr_layer_factory diff --git a/titan-test-system-framework b/titan-test-system-framework index fce4d88..17d8e3d 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit fce4d880afefa0c32a033eba6e4a7e28c4a075b1 +Subproject commit 17d8e3d765d51642dd171fa474a10e0613264ac1 diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index 5f65c51..ef603ae 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit 5f65c519abc2ece32919371562378b83260a89ef +Subproject commit ef603ae2343ae0aab454786bf892674db94aa38f diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 7989a53..a4bcc0a 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 7989a53a5542a10f3def57fff423bdda9027df1c +Subproject commit a4bcc0abd20689584d5917348c6e9b83fec29c82 diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn index ff2492a..b116c27 100644 --- a/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn +++ b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn @@ -18,10 +18,6 @@ module LibHttp_BinaryMessageBodyTypes { // LibIts import from Ieee1609Dot2BaseTypes language "ASN.1:1997" all; import from Ieee1609Dot2 language "ASN.1:1997" all; - import from EtsiTs102941BaseTypes language "ASN.1:1997" all; - import from EtsiTs102941TypesEnrolment language "ASN.1:1997" all; - import from EtsiTs102941MessagesCa language "ASN.1:1997" all; - import from EtsiTs103097Module language "ASN.1:1997" all; type union BinaryBody { // TODO Add here your custom variants diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_BinaryTemplates.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryTemplates.ttcn index 5319d23..6edfea2 100644 --- a/ttcn/patch_lib_http/ttcn/LibHttp_BinaryTemplates.ttcn +++ b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryTemplates.ttcn @@ -17,10 +17,6 @@ module LibHttp_BinaryTemplates { // LibIts import from Ieee1609Dot2BaseTypes language "ASN.1:1997" all; import from Ieee1609Dot2 language "ASN.1:1997" all; - import from EtsiTs102941BaseTypes language "ASN.1:1997" all; - import from EtsiTs102941TypesEnrolment language "ASN.1:1997" all; - import from EtsiTs102941MessagesCa language "ASN.1:1997" all; - import from EtsiTs103097Module language "ASN.1:1997" all; template (value) BinaryBody m_binary_body_raw( in template (value) octetstring p_raw -- GitLab From 492e26e95ce7d2e6a310e0586cf875c2b1839fd8 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 17 Mar 2023 09:35:37 +0100 Subject: [PATCH 055/178] First build of AtsMBR --- .../ConfigRsuSimulatorLayer.cc | 65 ++++++++++++++++++- .../ConfigRsuSimulatorLayer.hh | 3 + .../ConfigRsuSimulatorPort.cc | 38 +++++++++++ .../ConfigRsuSimulatorPort.hh | 4 ++ ccsrc/Protocols/Mbr/module.mk | 2 + .../UpperTester/uppertester_mbr_codec.cc | 12 +--- .../UpperTester/uppertester_mbr_codec.hh | 1 + ttcn/AtsMBR | 2 +- 8 files changed, 115 insertions(+), 12 deletions(-) create mode 100644 ccsrc/Protocols/Mbr/module.mk diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc index baa95bc..ee3b5d4 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc @@ -185,6 +185,36 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsPki__TypesAndValues::UtPkiTrig send_data(os, params); } +void ConfigRsuSimulatorLayer::sendMsg(const LibItsMbr__TypesAndValues::UtMbrResults &send_par, params ¶ms) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); + + TTCN_Buffer encoding_buffer; + if (send_par.ischosen(LibItsMbr__TypesAndValues::UtMbrResults::ALT_utMbrInitializeResult)) { + encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrInitializeResult)); + encoding_buffer.put_c((unsigned char)static_cast(send_par.utMbrInitializeResult())); + } else if (send_par.ischosen(LibItsMbr__TypesAndValues::UtMbrResults::ALT_utMbrTriggerResult)) { + encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrTriggerResult)); + encoding_buffer.put_c((unsigned char)static_cast(send_par.utMbrTriggerResult())); + } else { + loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtMbrResults variant"); + return; + } + + OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data()); + send_data(os, params); +} + +void ConfigRsuSimulatorLayer::sendMsg(const LibItsMbr__TypesAndValues::UtMbrEventInd &send_par, params ¶ms) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); + + TTCN_Buffer encoding_buffer; + encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrEventInd)); + encoding_buffer.put_c(static_cast(send_par.state())); + + OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data()); + send_data(os, params); +} + void ConfigRsuSimulatorLayer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimResults &send_par, params ¶ms) { loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); @@ -423,6 +453,8 @@ void ConfigRsuSimulatorLayer::receive_data(OCTETSTRING &data, params ¶ms) { } else if ((id == uppertester_pki_codec::c_utPkiTriggerEnrolmentRequest) || (id == uppertester_pki_codec::c_utPkiTriggerAuthorizationRequest)) { // Receive an UtPkiTrigger process_ut_pki_trigger(data, params); + } else if (id == uppertester_mbr_codec::c_utMbrTriggerIdMbObs) { // Receive an UtMbrTrigger + process_ut_mbr_trigger(data, params); } else { loggers::get_instance().warning("ConfigRsuSimulatorLayer::receive_data: Unsupported tag %02x", id); } @@ -854,9 +886,9 @@ int ConfigRsuSimulatorLayer::process_ut_pki_trigger(const OCTETSTRING &data, par if (_params[std::string("ut")].compare("pki") == 0) { unsigned char msg_id = *static_cast(data); - loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger: msg_id=%02x", msg_id); + loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_mbr_trigger: msg_id=%02x", msg_id); OCTETSTRING payload(data.lengthof() - 1, 1 + static_cast(data)); - loggers::get_instance().log_msg("ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger: payload:", payload); + loggers::get_instance().log_msg("ConfigRsuSimulatorLayer::process_ut_mbr_trigger: payload:", payload); TTCN_EncDec::clear_error(); TTCN_Buffer decoding_buffer(payload); @@ -889,6 +921,35 @@ int ConfigRsuSimulatorLayer::process_ut_pki_trigger(const OCTETSTRING &data, par return 0; } +int ConfigRsuSimulatorLayer::process_ut_mbr_trigger(const OCTETSTRING &data, params ¶ms) { + loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::process_ut_mbr_trigger"); + + params::const_iterator it = _params.find("ut"); + if (it == _params.cend()) { + loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_mbr_trigger: CF layer's ut parameter is missing"); + return -1; + } + + if (_params[std::string("ut")].compare("mbr") == 0) { + unsigned char msg_id = *static_cast(data); + loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_mbr_trigger: msg_id=%02x", msg_id); + + LibItsMbr__TypesAndValues::UtMbrTrigger p; + loggers::get_instance().error("ConfigRsuSimulatorLayer::process_ut_mbr_trigger: To be implemented"); + if (msg_id == uppertester_mbr_codec::c_utMbrTriggerIdMbObs) { + p.idMbObs() = OCTETSTRING(1, 1 + static_cast(data)); + } + + // Pass it to the ports if any + to_all_upper_ports(p, params); + } else { + loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_mbr_trigger: Unsupported protocol"); + return -1; + } + + return 0; +} + int ConfigRsuSimulatorLayer::process_ut_mapem_spatem_trigger(const OCTETSTRING &data, params ¶ms) { loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::process_ut_mapem_spatem_trigger", data); diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh index 7e0b7c2..ad0cc55 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh @@ -45,6 +45,8 @@ public: void sendMsg(const LibItsDenm__TypesAndValues::UtDenmEventInd &send_par, params ¶ms); void sendMsg(const LibItsPki__TypesAndValues::UtPkiResults &send_par, params ¶ms); void sendMsg(const LibItsPki__TypesAndValues::UtPkiTriggerInd &send_par, params ¶ms); + void sendMsg(const LibItsMbr__TypesAndValues::UtMbrResults &send_par, params ¶ms); + void sendMsg(const LibItsMbr__TypesAndValues::UtMbrEventInd &send_par, params ¶ms); void sendMsg(const LibItsIvim__TypesAndValues::UtIvimResults &send_par, params ¶ms); void sendMsg(const LibItsIvim__TypesAndValues::UtIvimEventInd &send_par, params ¶ms); void sendMsg(const LibItsMapemSpatem__TypesAndValues::UtMapemSpatemResults &send_par, params ¶ms); @@ -70,6 +72,7 @@ private: int process_ut_denm_termination(const OCTETSTRING &data, params ¶ms); int process_ut_geonetworking_trigger(const OCTETSTRING &data, params ¶ms); int process_ut_pki_trigger(const OCTETSTRING &data, params ¶ms); + int process_ut_mbr_trigger(const OCTETSTRING &data, params ¶ms); int process_ut_ivim_trigger(const OCTETSTRING &data, params ¶ms); int process_ut_ivim_update(const OCTETSTRING &data, params ¶ms); int process_ut_ivim_termination(const OCTETSTRING &data, params ¶ms); diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.cc b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.cc index 7975ba6..bb6972a 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.cc +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.cc @@ -153,6 +153,24 @@ namespace ItsRSUsSimulator__TestSystem { loggers::get_instance().set_stop_time(_time_key, duration); } + void ConfigRsuSimulatorPort::outgoing_send(const LibItsMbr__TypesAndValues::UtMbrResults &send_par) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::outgoing_send: payload=", send_par); + + float duration; + loggers::get_instance().set_start_time(_time_key); + static_cast(_layer)->sendMsg(send_par, _layer_params); + loggers::get_instance().set_stop_time(_time_key, duration); + } + + void ConfigRsuSimulatorPort::outgoing_send(const LibItsMbr__TypesAndValues::UtMbrEventInd &send_par) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::outgoing_send: payload=", send_par); + + float duration; + loggers::get_instance().set_start_time(_time_key); + static_cast(_layer)->sendMsg(send_par, _layer_params); + loggers::get_instance().set_stop_time(_time_key, duration); + } + void ConfigRsuSimulatorPort::outgoing_send(const LibItsIvim__TypesAndValues::UtIvimResults &send_par) { loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::outgoing_send: payload=", send_par); @@ -353,6 +371,26 @@ namespace ItsRSUsSimulator__TestSystem { incoming_message(p_ind); } + void ConfigRsuSimulatorPort::receiveMsg(const LibItsMbr__TypesAndValues::UtMbrInitialize &p_ind, const params &p_params) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind); + // Sanity check + if (!p_ind.is_bound()) { + return; + } + + incoming_message(p_ind); + } + + void ConfigRsuSimulatorPort::receiveMsg(const LibItsMbr__TypesAndValues::UtMbrTrigger &p_ind, const params &p_params) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind); + // Sanity check + if (!p_ind.is_bound()) { + return; + } + + incoming_message(p_ind); + } + void ConfigRsuSimulatorPort::receiveMsg(const LibItsIvim__TypesAndValues::UtIvimInitialize &p_ind, const params &p_params) { loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind); // Sanity check diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.hh b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.hh index cb55ea3..30801d7 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.hh +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.hh @@ -29,6 +29,8 @@ namespace ItsRSUsSimulator__TestSystem { void receiveMsg(const LibItsDenm__TypesAndValues::UtDenmTermination &p_ind, const params &p_params); void receiveMsg(const LibItsPki__TypesAndValues::UtPkiInitialize &p_ind, const params &p_params); void receiveMsg(const LibItsPki__TypesAndValues::UtPkiTrigger &p_ind, const params &p_params); + void receiveMsg(const LibItsMbr__TypesAndValues::UtMbrInitialize &p_ind, const params &p_params); + void receiveMsg(const LibItsMbr__TypesAndValues::UtMbrTrigger &p_ind, const params &p_params); void receiveMsg(const LibItsIvim__TypesAndValues::UtIvimInitialize &p_ind, const params &p_params); void receiveMsg(const LibItsIvim__TypesAndValues::UtIvimTrigger &p_ind, const params &p_params); void receiveMsg(const LibItsIvim__TypesAndValues::UtIvimUpdate &p_ind, const params &p_params); @@ -82,6 +84,8 @@ namespace ItsRSUsSimulator__TestSystem { void outgoing_send(const LibItsDenm__TypesAndValues::UtDenmEventInd &send_par); void outgoing_send(const LibItsPki__TypesAndValues::UtPkiResults &send_par); void outgoing_send(const LibItsPki__TypesAndValues::UtPkiTriggerInd &send_par); + void outgoing_send(const LibItsMbr__TypesAndValues::UtMbrResults &send_par); + void outgoing_send(const LibItsMbr__TypesAndValues::UtMbrEventInd &send_par); void outgoing_send(const LibItsIvim__TypesAndValues::UtIvimResults &send_par); void outgoing_send(const LibItsIvim__TypesAndValues::UtIvimEventInd &send_par); void outgoing_send(const LibItsMapemSpatem__TypesAndValues::UtMapemSpatemResults &send_par); diff --git a/ccsrc/Protocols/Mbr/module.mk b/ccsrc/Protocols/Mbr/module.mk new file mode 100644 index 0000000..3b406cf --- /dev/null +++ b/ccsrc/Protocols/Mbr/module.mk @@ -0,0 +1,2 @@ +sources := +includes := . diff --git a/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.cc index 2d6065b..8a0caca 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.cc @@ -14,8 +14,8 @@ class TTCN_EncDec; unsigned char uppertester_mbr_codec::c_utMbrInitialize = 0x00; unsigned char uppertester_mbr_codec::c_utMbrInitializeResult = 0x01; -unsigned char uppertester_mbr_codec::c_utMbrTriggerResult = 0xF2; -unsigned char uppertester_mbr_codec::c_utMbrEventInd = 0xF3; +unsigned char uppertester_mbr_codec::c_utMbrEventInd = 0xF3; +unsigned char uppertester_mbr_codec::c_utMbrTriggerIdMbObs = 0xF4; int uppertester_mbr_codec::encode(const Record_Type &msg, OCTETSTRING &data) { loggers::get_instance().log_msg(">>> uppertester_mbr_codec::encode (1): ", (const Record_Type &)msg); @@ -43,13 +43,7 @@ int uppertester_mbr_codec::encode(const LibItsMbr__TypesAndValues::UtMbrTrigger // const Record_Type *type; const LibItsMbr__TypesAndValues::UtMbrTrigger &u = static_cast(msg); if (u.ischosen(LibItsMbr__TypesAndValues::UtMbrTrigger::ALT_idMbObs)) { - /*encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrTriggerEnrolmentRequest)); - encoding_buffer.put_c(static_cast(u.triggerEnrolmentRequest().cannonicalId().lengthof())); // Length of the string - encoding_buffer.put_string(u.triggerEnrolmentRequest().cannonicalId()); - encoding_buffer.put_os(u.triggerEnrolmentRequest().encAlgorithm()); // One byte - encoding_buffer.put_os(u.triggerEnrolmentRequest().privateKey()); // 32 bytes - encoding_buffer.put_os(u.triggerEnrolmentRequest().compressedPublickey()); //33 bytes - */ + encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrTriggerIdMbObs)); } else { // Error data = OCTETSTRING(0, nullptr); loggers::get_instance().warning("<<< uppertester_mbr_codec::encode: Failed to encode UT message"); diff --git a/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.hh index c260a30..4b9f512 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.hh @@ -32,6 +32,7 @@ public: static unsigned char c_utMbrInitializeResult; static unsigned char c_utMbrTriggerResult; static unsigned char c_utMbrEventInd; + static unsigned char c_utMbrTriggerIdMbObs; private: int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index ef603ae..b527836 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit ef603ae2343ae0aab454786bf892674db94aa38f +Subproject commit b5278366575d385fb36d9924aa59f3275a2e99b3 -- GitLab From a3dc17bad5269255b6f19d31df3864cab5a086da Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 23 Mar 2023 09:58:47 +0100 Subject: [PATCH 056/178] Add support forAtsMBR --- ccsrc/EncDec/LibItsMbr_Encdec.cc | 40 +++++++++++++++++++ .../ConfigRsuSimulatorLayer.cc | 4 +- .../Protocols/Mbr/etsi_ts103759_data_codec.cc | 28 +++++++++++++ .../Protocols/Mbr/etsi_ts103759_data_codec.hh | 15 +++++++ ccsrc/Protocols/Mbr/module.mk | 2 +- .../UpperTester/uppertester_mbr_codec.cc | 17 +++----- .../UpperTester/uppertester_mbr_codec.hh | 2 +- titan-test-system-framework | 2 +- ttcn/AtsMBR | 2 +- ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- .../ttcn/LibHttp_BinaryMessageBodyTypes.ttcn | 3 +- .../ttcn/LibHttp_BinaryTemplates.ttcn | 3 +- 13 files changed, 102 insertions(+), 20 deletions(-) create mode 100644 ccsrc/Protocols/Mbr/etsi_ts103759_data_codec.cc create mode 100644 ccsrc/Protocols/Mbr/etsi_ts103759_data_codec.hh diff --git a/ccsrc/EncDec/LibItsMbr_Encdec.cc b/ccsrc/EncDec/LibItsMbr_Encdec.cc index 0f92761..add5df5 100644 --- a/ccsrc/EncDec/LibItsMbr_Encdec.cc +++ b/ccsrc/EncDec/LibItsMbr_Encdec.cc @@ -1,6 +1,46 @@ +#include "LibItsMbr_EncdecDeclarations.hh" + +#include "etsi_ts103759_data_codec.hh" + #include "loggers.hh" namespace LibItsMbr__EncdecDeclarations { + /*BITSTRING fx__enc__CAM(const CAM__PDU__Descriptions::CAM &p_cam) { + cam_pdu_codec asn_codec; + BITSTRING b; + int rc = asn_codec.encode(p_cam, b); + if (rc) { + return b; + } + return int2bit(0, 1); + }*/ + + BITSTRING fx__enc__EtsiTs103759Data(const EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_102941_data) { + loggers::get_instance().log_msg(">>> fx__enc__EtsiTs103759Data: ", p_etsi_ts_102941_data); + + etsi_ts103759_data_codec codec; + OCTETSTRING os; + if (codec.encode(p_etsi_ts_102941_data, os) == -1) { + loggers::get_instance().warning("fx__enc__EtsiTs103759Data: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__EtsiTs103759Data(BITSTRING &b, EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_102941_data) { + loggers::get_instance().log_msg(">>> fx__dec__EtsiTs103759Data: ", b); + + etsi_ts103759_data_codec codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_etsi_ts_102941_data) == -1) { + loggers::get_instance().warning("fx__dec__EtsiTs103759Data: -1 result code was returned"); + return -1; + } + + return 0; + } + } // End of namespace LibItsMbr__EncdecDeclarations diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc index ee3b5d4..b6534a2 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc @@ -11,6 +11,8 @@ #include "uppertester_cam_codec.hh" #include "uppertester_denm_codec.hh" #include "uppertester_geonetworking_codec.hh" +#include "uppertester_pki_codec.hh" +#include "uppertester_mbr_codec.hh" #include "uppertester_ivim_codec.hh" #include "uppertester_mapem_spatem_codec.hh" @@ -937,7 +939,7 @@ int ConfigRsuSimulatorLayer::process_ut_mbr_trigger(const OCTETSTRING &data, par LibItsMbr__TypesAndValues::UtMbrTrigger p; loggers::get_instance().error("ConfigRsuSimulatorLayer::process_ut_mbr_trigger: To be implemented"); if (msg_id == uppertester_mbr_codec::c_utMbrTriggerIdMbObs) { - p.idMbObs() = OCTETSTRING(1, 1 + static_cast(data)); + p.idMbObs() = INTEGER(1, 1 + static_cast(data)); } // Pass it to the ports if any diff --git a/ccsrc/Protocols/Mbr/etsi_ts103759_data_codec.cc b/ccsrc/Protocols/Mbr/etsi_ts103759_data_codec.cc new file mode 100644 index 0000000..8e07e9d --- /dev/null +++ b/ccsrc/Protocols/Mbr/etsi_ts103759_data_codec.cc @@ -0,0 +1,28 @@ +#include "etsi_ts103759_data_codec.hh" + +#include "loggers.hh" + +int etsi_ts103759_data_codec::encode(const EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_103759_data, OCTETSTRING &p_data) { + loggers::get_instance().log(">>> etsi_ts103759_data_codec::encode: %s", p_etsi_ts_103759_data.get_descriptor()->name); + + BITSTRING b; + TTCN_EncDec::clear_error(); + TTCN_Buffer buffer; + p_etsi_ts_103759_data.encode(*p_etsi_ts_103759_data.get_descriptor(), buffer, TTCN_EncDec::CT_OER); + p_data = OCTETSTRING(buffer.get_len(), buffer.get_data()); + loggers::get_instance().log_msg("etsi_ts103759_data_codec::encode: ", p_data); + + return 0; +} + +int etsi_ts103759_data_codec::decode(const OCTETSTRING &p_data, EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_103759_data, params *p_params) { + loggers::get_instance().log_msg(">>> etsi_ts103759_data_codec::decode: ", p_data); + + TTCN_EncDec::clear_error(); + TTCN_Buffer decoding_buffer(p_data); + // _params = params; + p_etsi_ts_103759_data.decode(*p_etsi_ts_103759_data.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_OER); + + loggers::get_instance().log_msg("<<< etsi_ts103759_data_codec::decode: ", (const Base_Type &)p_etsi_ts_103759_data); + return 0; +} diff --git a/ccsrc/Protocols/Mbr/etsi_ts103759_data_codec.hh b/ccsrc/Protocols/Mbr/etsi_ts103759_data_codec.hh new file mode 100644 index 0000000..25ef141 --- /dev/null +++ b/ccsrc/Protocols/Mbr/etsi_ts103759_data_codec.hh @@ -0,0 +1,15 @@ +#pragma once + +#include "codec_gen.hh" +#include "params.hh" + +#include "EtsiTs103759Core.hh" + +class etsi_ts103759_data_codec : public codec_gen { +public: + explicit etsi_ts103759_data_codec() : codec_gen(){}; + virtual ~etsi_ts103759_data_codec(){}; + + virtual int encode(const EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_10291_data, OCTETSTRING &p_data); + virtual int decode(const OCTETSTRING &p_data, EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_10291_data, params *p_params = NULL); +}; // End of class etsi_ts103759_data_codec diff --git a/ccsrc/Protocols/Mbr/module.mk b/ccsrc/Protocols/Mbr/module.mk index 3b406cf..2af1ece 100644 --- a/ccsrc/Protocols/Mbr/module.mk +++ b/ccsrc/Protocols/Mbr/module.mk @@ -1,2 +1,2 @@ -sources := +sources := etsi_ts103759_data_codec.cc includes := . diff --git a/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.cc index 8a0caca..0ee0858 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.cc @@ -14,8 +14,9 @@ class TTCN_EncDec; unsigned char uppertester_mbr_codec::c_utMbrInitialize = 0x00; unsigned char uppertester_mbr_codec::c_utMbrInitializeResult = 0x01; -unsigned char uppertester_mbr_codec::c_utMbrEventInd = 0xF3; -unsigned char uppertester_mbr_codec::c_utMbrTriggerIdMbObs = 0xF4; +unsigned char uppertester_mbr_codec::c_utMbrTrigger = 0xF0; +unsigned char uppertester_mbr_codec::c_utMbrTriggerResult = 0xF1; +unsigned char uppertester_mbr_codec::c_utMbrEventInd = 0xF2; int uppertester_mbr_codec::encode(const Record_Type &msg, OCTETSTRING &data) { loggers::get_instance().log_msg(">>> uppertester_mbr_codec::encode (1): ", (const Record_Type &)msg); @@ -41,15 +42,9 @@ int uppertester_mbr_codec::encode(const LibItsMbr__TypesAndValues::UtMbrTrigger TTCN_EncDec::clear_error(); TTCN_Buffer encoding_buffer; // const Record_Type *type; - const LibItsMbr__TypesAndValues::UtMbrTrigger &u = static_cast(msg); - if (u.ischosen(LibItsMbr__TypesAndValues::UtMbrTrigger::ALT_idMbObs)) { - encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrTriggerIdMbObs)); - } else { // Error - data = OCTETSTRING(0, nullptr); - loggers::get_instance().warning("<<< uppertester_mbr_codec::encode: Failed to encode UT message"); - return -1; - } - // encode_(*type, *type->get_descriptor(), encoding_buffer); + encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrTrigger)); + encoding_buffer.put_c(static_cast(msg.targetId())); + encoding_buffer.put_c(static_cast(msg.cause())); data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); loggers::get_instance().log_msg("<<< uppertester_mbr_codec::encode: data=", data); return 0; diff --git a/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.hh index 4b9f512..4876df9 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.hh @@ -32,7 +32,7 @@ public: static unsigned char c_utMbrInitializeResult; static unsigned char c_utMbrTriggerResult; static unsigned char c_utMbrEventInd; - static unsigned char c_utMbrTriggerIdMbObs; + static unsigned char c_utMbrTrigger; private: int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); diff --git a/titan-test-system-framework b/titan-test-system-framework index 17d8e3d..102e3b2 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit 17d8e3d765d51642dd171fa474a10e0613264ac1 +Subproject commit 102e3b20c0d69ce260b02e1de3a446d0cba970e0 diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index b527836..8f7cdd7 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit b5278366575d385fb36d9924aa59f3275a2e99b3 +Subproject commit 8f7cdd71ec482fc25fd538895fb400a3eda8f7bd diff --git a/ttcn/AtsPki b/ttcn/AtsPki index a4bcc0a..0aafb7a 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit a4bcc0abd20689584d5917348c6e9b83fec29c82 +Subproject commit 0aafb7a32535665fa73d9d2c5d4259ae45afdada diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index c90e6ab..e589e93 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit c90e6abd1445a1a59e77be0fef03e3a5642ff013 +Subproject commit e589e93f52f5ca14756967b7438a9f85812919ef diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn index b116c27..3c4b3c1 100644 --- a/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn +++ b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn @@ -25,7 +25,8 @@ module LibHttp_BinaryMessageBodyTypes { Certificate ieee1609dot2_certificate, octetstring raw } with { - variant "" + variant ""; + encode "RAW" } } // End of LibHttp_BinaryMessageBodyTypes diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_BinaryTemplates.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryTemplates.ttcn index 6edfea2..c8de0ac 100644 --- a/ttcn/patch_lib_http/ttcn/LibHttp_BinaryTemplates.ttcn +++ b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryTemplates.ttcn @@ -17,6 +17,7 @@ module LibHttp_BinaryTemplates { // LibIts import from Ieee1609Dot2BaseTypes language "ASN.1:1997" all; import from Ieee1609Dot2 language "ASN.1:1997" all; + import from EtsiTs103097Module language "ASN.1:1997" all; template (value) BinaryBody m_binary_body_raw( in template (value) octetstring p_raw @@ -42,7 +43,7 @@ module LibHttp_BinaryTemplates { ) := { ieee1609dot2_data := p_ieee1609dot2_data } // End of template mw_binary_body_ieee1609dot2_data - + template (value) BinaryBody m_binary_body_ieee1609dot2_certificate( in template (value) CertificateBase p_ieee1609dot2_certificate ) := { -- GitLab From 5238c7d988d842539c068e31091a544102694af8 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 23 Mar 2023 12:15:08 +0100 Subject: [PATCH 057/178] Fix issues after rebuilding all ATSs --- ccsrc/EncDec/module.mk | 3 ++- .../RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc | 9 +++++---- .../RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh | 1 + ttcn/LibIts | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ccsrc/EncDec/module.mk b/ccsrc/EncDec/module.mk index fa6f04a..18f4be8 100644 --- a/ccsrc/EncDec/module.mk +++ b/ccsrc/EncDec/module.mk @@ -29,7 +29,8 @@ sources += \ LibItsSremSsem_Encdec.cc \ LibItsRtcmem_Encdec.cc \ LibItsIvim_Encdec.cc \ - LibItsPki_Encdec.cc + LibItsPki_Encdec.cc \ + LibItsMbr_Encdec.cc endif diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc index b6534a2..127076b 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc @@ -211,7 +211,7 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsMbr__TypesAndValues::UtMbrEven TTCN_Buffer encoding_buffer; encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrEventInd)); - encoding_buffer.put_c(static_cast(send_par.state())); + loggers::get_instance().error("ConfigRsuSimulatorLayer::sendMsg: UtMbrEventInd no supported yet"); OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data()); send_data(os, params); @@ -455,7 +455,7 @@ void ConfigRsuSimulatorLayer::receive_data(OCTETSTRING &data, params ¶ms) { } else if ((id == uppertester_pki_codec::c_utPkiTriggerEnrolmentRequest) || (id == uppertester_pki_codec::c_utPkiTriggerAuthorizationRequest)) { // Receive an UtPkiTrigger process_ut_pki_trigger(data, params); - } else if (id == uppertester_mbr_codec::c_utMbrTriggerIdMbObs) { // Receive an UtMbrTrigger + } else if (id == uppertester_mbr_codec::c_utMbrTrigger) { // Receive an UtMbrTrigger process_ut_mbr_trigger(data, params); } else { loggers::get_instance().warning("ConfigRsuSimulatorLayer::receive_data: Unsupported tag %02x", id); @@ -938,8 +938,9 @@ int ConfigRsuSimulatorLayer::process_ut_mbr_trigger(const OCTETSTRING &data, par LibItsMbr__TypesAndValues::UtMbrTrigger p; loggers::get_instance().error("ConfigRsuSimulatorLayer::process_ut_mbr_trigger: To be implemented"); - if (msg_id == uppertester_mbr_codec::c_utMbrTriggerIdMbObs) { - p.idMbObs() = INTEGER(1, 1 + static_cast(data)); + if (msg_id == uppertester_mbr_codec::c_utMbrTrigger) { + p.targetId() = oct2int(OCTETSTRING(1, 1 + static_cast(data))); + p.cause() = oct2int(OCTETSTRING(1, 2 + static_cast(data))); } // Pass it to the ports if any diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh index ad0cc55..7750af1 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh @@ -20,6 +20,7 @@ #include "uppertester_ivim_codec.hh" #include "uppertester_mapem_spatem_codec.hh" #include "uppertester_pki_codec.hh" +#include "uppertester_mbr_codec.hh" namespace ItsRSUsSimulator__TestSystem { class ConfigRsuSimulatorPort; diff --git a/ttcn/LibIts b/ttcn/LibIts index aaa999c..a3ed6ae 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit aaa999c5b6542e16fa11fe5fafe082a1e076b456 +Subproject commit a3ed6aea39d93cfb2a1794946650e7c1fae992bf -- GitLab From 191c64045dd0a1f15656f0976045cadde9a0e77c Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 24 Mar 2023 07:09:08 +0100 Subject: [PATCH 058/178] Update module.mk --- titan-test-system-framework | 2 +- ttcn/AtsBTP | 2 +- ttcn/AtsCAM | 2 +- ttcn/AtsDENM | 2 +- ttcn/AtsGeoNetworking | 2 +- ttcn/AtsIPv6OverGeoNetworking | 2 +- ttcn/AtsIS | 2 +- ttcn/AtsMBR | 2 +- ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- ttcn/LibIts | 2 +- virtualization/docker-dev/Dockerfile | 4 ++-- virtualization/docker-dev/Dockerfile.stfubuntu | 2 +- virtualization/docker-dev/build.sh | 4 ++-- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/titan-test-system-framework b/titan-test-system-framework index 102e3b2..0a28ff3 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit 102e3b20c0d69ce260b02e1de3a446d0cba970e0 +Subproject commit 0a28ff34d9ca15d6ed481dad98485210e4d6e179 diff --git a/ttcn/AtsBTP b/ttcn/AtsBTP index e1c90f2..7fdc910 160000 --- a/ttcn/AtsBTP +++ b/ttcn/AtsBTP @@ -1 +1 @@ -Subproject commit e1c90f29e9b2fcdbb79f064f90ba5f34710b8a2c +Subproject commit 7fdc910a442b8cf6a134754845da0def5a7b258c diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index de160d2..76f1ea7 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit de160d2d8c76ed51cd3326e1e50ad5514ca96375 +Subproject commit 76f1ea77ad27467cc39300c8599f1c0d37c0be76 diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index e7cec1b..6f6e1f0 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit e7cec1b9450433925e21f586d92ba67a9eba9bec +Subproject commit 6f6e1f09705a881f16b5689c46666202b7800214 diff --git a/ttcn/AtsGeoNetworking b/ttcn/AtsGeoNetworking index 81241d1..d3e6b26 160000 --- a/ttcn/AtsGeoNetworking +++ b/ttcn/AtsGeoNetworking @@ -1 +1 @@ -Subproject commit 81241d1ecc39905b334f095ee3f063c6d1ecf94e +Subproject commit d3e6b2662c996a8971256c926385d1ca1f9eb0a0 diff --git a/ttcn/AtsIPv6OverGeoNetworking b/ttcn/AtsIPv6OverGeoNetworking index 3c55ae5..3e3e90c 160000 --- a/ttcn/AtsIPv6OverGeoNetworking +++ b/ttcn/AtsIPv6OverGeoNetworking @@ -1 +1 @@ -Subproject commit 3c55ae5c802fc2d6ae258ce08a95c23bbc010b68 +Subproject commit 3e3e90ce7c54d4b3ab1e2551778d8d52aade506c diff --git a/ttcn/AtsIS b/ttcn/AtsIS index d745e1b..4a3ccd7 160000 --- a/ttcn/AtsIS +++ b/ttcn/AtsIS @@ -1 +1 @@ -Subproject commit d745e1b4f9e010bbc12d9fffc060380b4abec9ff +Subproject commit 4a3ccd7075a263116a3bed5a2450d63830dcf35a diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index 8f7cdd7..f9908ac 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit 8f7cdd71ec482fc25fd538895fb400a3eda8f7bd +Subproject commit f9908ac693ba16f8f99ae01580a3cc7e67433d1c diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 0aafb7a..3e69ac0 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 0aafb7a32535665fa73d9d2c5d4259ae45afdada +Subproject commit 3e69ac00b8d8db8ebe0d8ea67bd29a1e1aba8c6f diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index e589e93..066ee6d 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit e589e93f52f5ca14756967b7438a9f85812919ef +Subproject commit 066ee6d75f63c6bf7287004d3195bbf1847c96f3 diff --git a/ttcn/LibIts b/ttcn/LibIts index a3ed6ae..30d2ee5 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit a3ed6aea39d93cfb2a1794946650e7c1fae992bf +Subproject commit 30d2ee5e2279e2c455427e97c57014101ff160ae diff --git a/virtualization/docker-dev/Dockerfile b/virtualization/docker-dev/Dockerfile index 69a8282..97536f6 100644 --- a/virtualization/docker-dev/Dockerfile +++ b/virtualization/docker-dev/Dockerfile @@ -1,11 +1,11 @@ -FROM stfubuntu:20.04 +FROM stfubuntu:22.04 LABEL ETSI ITS LABEL description="TS.ITS Docker Image" ENV TERM=linux \ HOME=/home/etsi \ - HOSTNAME=docker-titan-TS.ITS + HOSTNAME=docker-titan-TS.ITS-r2 COPY home /home/etsi diff --git a/virtualization/docker-dev/Dockerfile.stfubuntu b/virtualization/docker-dev/Dockerfile.stfubuntu index 9fa6645..2805900 100644 --- a/virtualization/docker-dev/Dockerfile.stfubuntu +++ b/virtualization/docker-dev/Dockerfile.stfubuntu @@ -1,4 +1,4 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 LABEL ETSI CTI LABEL description="STF Docker Ubuntu image" diff --git a/virtualization/docker-dev/build.sh b/virtualization/docker-dev/build.sh index c480087..178690f 100755 --- a/virtualization/docker-dev/build.sh +++ b/virtualization/docker-dev/build.sh @@ -13,10 +13,10 @@ if [ "$1" == "--force-stfubuntu" ]; then fi # Check and build stfubuntu image if [ -z `docker images -q stfubuntu` ]; then - docker build --no-cache --tag stfubuntu:20.04 -f Dockerfile.stfubuntu --force-rm . || exit 1 + docker build --no-cache --tag stfubuntu:22.04 -f Dockerfile.stfubuntu --force-rm . || exit 1 fi -docker build --no-cache --tag etsiforge/-r2 --force-rm . || ( echo "Docker build failed: $?"; exit 1 ) +docker build --no-cache --tag etsiforge-r2 --force-rm . || ( echo "Docker build failed: $?"; exit 1 ) docker images docker inspect etsiforge/etsi-its-ts-r2:latest || ( echo "Docker inspect failed: $?"; exit 1 ) -- GitLab From eeb4de98f07f39b8fa0030959dc89f46a725770d Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 24 Mar 2023 07:11:08 +0100 Subject: [PATCH 059/178] Update patch_lib_common_titan --- .../ttcn/LibCommon_AbstractData.ttcn | 137 ++++++++++++++++++ .../ttcn/LibCommon_Sync.ttcn | 2 +- 2 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 ttcn/patch_lib_common_titan/ttcn/LibCommon_AbstractData.ttcn diff --git a/ttcn/patch_lib_common_titan/ttcn/LibCommon_AbstractData.ttcn b/ttcn/patch_lib_common_titan/ttcn/LibCommon_AbstractData.ttcn new file mode 100644 index 0000000..8ae5f85 --- /dev/null +++ b/ttcn/patch_lib_common_titan/ttcn/LibCommon_AbstractData.ttcn @@ -0,0 +1,137 @@ +/** + * @author ETSI + * @version $URL$ + * $Id$ + * @desc A collection of functions for abstract data types which may be + * useful in the implementation of any TTCN-3 test suite. + * @remark End users should be aware that any changes made to the in + * definitions this module may be overwritten in future releases. + * End users are encouraged to contact the distributers of this + * module regarding their modifications or additions so that future + * updates will include your changes. + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * + */ + module LibCommon_AbstractData { + + import from LibCommon_BasicTypesAndValues all; + + group stringStack { + + type record StringStack { + UInt stackSize, + StringItems stringItems + } + + type record of charstring StringItems; + + /** + * @desc Constant which can be used to initialize a + * string stack. A string stack can be intialized by + * assigning this value in the variable declariation. + * An alternative is to call the initlialization function. + * @see LibCommon_AbstractData.f_initStringStack + * @remark Note that an initlialized stack stack is not + * necessarily the same as an empty string stack. + * An empty tring stack as 0 zero elements but may + * have a non empty list of (empty) items. + */ + const StringStack c_initStringStack := { 0, {} } + + /** + * @desc The invocation of this function will initialize + * a string stack to an empty string stack. + * An alternative is to initlialize a stack using a + * constant value. + * @see LibCommon_AbstractData.c_initStringStack + * @param p_stack String stack to be initialized. + */ + function f_initStringStack ( inout StringStack p_stack ) { + p_stack := c_initStringStack + } + + /** + * @desc This function checks if a string stack is empty. + * @param p_stack String stack to be checked. + * @return true if empty, false if not empty + */ + function f_isStringStackEmpty ( inout StringStack p_stack ) + return boolean { + if ( p_stack.stackSize == 0 ) {return true} + else {return false} + } + + /** + * @desc This function checks if a given string is on the + * string stack. + * @param p_stack String stack where the string item + * is to be looked for. + * @param p_item String to be checked for. + * @return true if found, false if not found + */ + function f_isItemOnStringStack ( inout StringStack p_stack, + in charstring p_item ) + return boolean { + var integer i; + for (i := 0; i < p_stack.stackSize; i := i+1 ) { + if ( p_stack.stringItems[i] == p_item ) { + return true; + } + } + return false; + } + + /** + * @desc This function checks if a given string is on the + * string stack. + * @param p_stack String stack where the string item + * is to be looked for. + * @param p_item String item on top of the stack. + * @return false if stack is empty, true otherwise + */ + function f_peekStringStackTop ( inout StringStack p_stack, + out charstring p_item) + return boolean { + if (p_stack.stackSize == 0) { + p_item := "f_peekTopStringStack: String stack is empty!"; + return false; + } + p_item := valueof(p_stack.stringItems[p_stack.stackSize-1]); + return true; + } + + + /** + * @desc This function puts a string to the top of a + * string stack. + * @param p_stack String stack to which the string item + * is to be added. + * @param p_item String to be added. + */ + function f_pushStringStack ( inout StringStack p_stack, + in charstring p_item ) { + p_stack.stringItems[p_stack.stackSize] := p_item; + p_stack.stackSize := p_stack.stackSize + 1; + } + + /** + * @desc This function removes the string from the top of a + * string stack. If the stack is empty nothing is done + * @param p_stack String stack from which the top string item + * is to be removed. + */ + function f_popStringStack ( inout StringStack p_stack ) { + if ( p_stack.stackSize > 0 ) { + p_stack.stackSize := p_stack.stackSize-1; + // "delete" top stack item to be safe + // Note: due to record of index the "old top" is size-1! + p_stack.stringItems[p_stack.stackSize] := ""; + } + } + + } // end group stringStack + +} // end module LibCommon_AbstractData diff --git a/ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn b/ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn index 5b2ae66..39d9659 100644 --- a/ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn +++ b/ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn @@ -62,7 +62,7 @@ module LibCommon_Sync { //Common - import from LibCommon_BasicTypesAndValues { type UInt } ; + import from LibCommon_BasicTypesAndValues all; import from LibCommon_AbstractData all; import from LibCommon_VerdictControl all; -- GitLab From 0f2ff186eee4464913d3cf9e366d3b0cc203be19 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 24 Mar 2023 09:00:27 +0100 Subject: [PATCH 060/178] Enhance docker process --- .jenkins.sh | 2 +- virtualization/docker-dev/Dockerfile | 2 +- virtualization/docker-dev/Dockerfile.stfubuntu | 2 +- virtualization/docker-dev/home/etc/init.d/30-asn1c.sh | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.jenkins.sh b/.jenkins.sh index ead945d..954f778 100755 --- a/.jenkins.sh +++ b/.jenkins.sh @@ -10,7 +10,7 @@ cd $(dirname $0) run_dir=`pwd` # Docker version 2 -cd ./virtualization/docker +cd ./virtualization/docker-dev ./build.sh #--force-stfubuntu ret_code=`echo $?` diff --git a/virtualization/docker-dev/Dockerfile b/virtualization/docker-dev/Dockerfile index 97536f6..28dc2b3 100644 --- a/virtualization/docker-dev/Dockerfile +++ b/virtualization/docker-dev/Dockerfile @@ -1,4 +1,4 @@ -FROM stfubuntu:22.04 +FROM stfubuntu:20.04 LABEL ETSI ITS LABEL description="TS.ITS Docker Image" diff --git a/virtualization/docker-dev/Dockerfile.stfubuntu b/virtualization/docker-dev/Dockerfile.stfubuntu index 2805900..9fa6645 100644 --- a/virtualization/docker-dev/Dockerfile.stfubuntu +++ b/virtualization/docker-dev/Dockerfile.stfubuntu @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:20.04 LABEL ETSI CTI LABEL description="STF Docker Ubuntu image" diff --git a/virtualization/docker-dev/home/etc/init.d/30-asn1c.sh b/virtualization/docker-dev/home/etc/init.d/30-asn1c.sh index fae38d4..43527e7 100755 --- a/virtualization/docker-dev/home/etc/init.d/30-asn1c.sh +++ b/virtualization/docker-dev/home/etc/init.d/30-asn1c.sh @@ -7,6 +7,7 @@ echo -e "*****************************\n* Install asn1c\n*********************** cd ${HOME}/frameworks || exit 1 git clone https://github.com/fillabs/asn1c.git ./asn1c || exit 1 cd ./asn1c +sed --in-place 's/AC_CHECK_INCLUDES_DEFAULT/#AC_CHECK_INCLUDES_DEFAULT/g' ./configure.ac autoreconf -iv && ./configure --prefix=${HOME} && make install || exit 1 cd ${HOME} -- GitLab From f1a275edcc42274cd5a30d50a0cc6cdd6113501b Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 24 Mar 2023 09:52:51 +0100 Subject: [PATCH 061/178] Enhance docker process --- ttcn/AtsBTP | 2 +- .../docker-dev/home/etc/init.d/40-ttf024.sh | 36 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/ttcn/AtsBTP b/ttcn/AtsBTP index 7fdc910..e1c90f2 160000 --- a/ttcn/AtsBTP +++ b/ttcn/AtsBTP @@ -1 +1 @@ -Subproject commit 7fdc910a442b8cf6a134754845da0def5a7b258c +Subproject commit e1c90f29e9b2fcdbb79f064f90ba5f34710b8a2c diff --git a/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh b/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh index 7586da8..4930909 100755 --- a/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh +++ b/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh @@ -6,8 +6,8 @@ set -vx echo -e "*****************************\n* Checkout TS.ITS sources\n*****************************\n" cd ${HOME}/dev || exit 1 -git clone --recurse-submodules --single-branch --branch ttf_t024 https://forge.etsi.org/rep/ITS/TS.ITS.git TS.ITS -cd ./TS.ITS +git clone --recurse-submodules --single-branch --branch ttf_t024 https://forge.etsi.org/rep/ITS/TS.ITS.git TS.ITS || exit 1 +cd ./TS.ITS || exit 1 for i in `find ./ttcn -type d -name "Ats*"` do cd $i @@ -18,22 +18,22 @@ for i in `find ./ttcn/Ats* -type d -name "asn1"` do cd $i git checkout testing2 - if [ -f ETSI-ITS-CDD.asn ] - then - ln -sf ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn - elif [ -f IVIM-PDU-Descriptions.asn ] - then - ln -sf IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn - ln -sf MAPEM-PDU-Descriptions.asn MAPEM_PDU_Descriptions.asn - ln -sf RTCMEM-PDU-Descriptions.asn RTCMEM_PDU_Descriptions.asn - ln -sf SPATEM-PDU-Descriptions.asn SPATEM_PDU_Descriptions.asn - ln -sf SREM-PDU-Descriptions.asn SREM_PDU_Descriptions.asn - ln -sf SSEM-PDU-Descriptions.asn SSEM_PDU_Descriptions.asn - ln -sf iso-patched/'ISO14906(2018)EfcDsrcApplicationv6-patched.asn' iso-patched/EfcDsrcApplication.asn - ln -sf iso-patched/'ISO14906(2018)EfcDsrcGenericv7-patched.asn' iso-patched/EfcDsrcGeneric.asn - ln -sf iso-patched/ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn iso-patched/ElectronicRegistrationIdentificationVehicleDataModule.asn - ln -sf iso-patched/ISO14823-missing.asn iso-patched/GDD.asn - fi +# if [ -f ETSI-ITS-CDD.asn ] +# then +# ln -sf ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn || exit 1 +# elif [ -f IVIM-PDU-Descriptions.asn ] +# then +# ln -sf IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn || exit 1 +# ln -sf MAPEM-PDU-Descriptions.asn MAPEM_PDU_Descriptions.asn || exit 1 +# ln -sf RTCMEM-PDU-Descriptions.asn RTCMEM_PDU_Descriptions.asn || exit 1 +# ln -sf SPATEM-PDU-Descriptions.asn SPATEM_PDU_Descriptions.asn || exit 1 +# ln -sf SREM-PDU-Descriptions.asn SREM_PDU_Descriptions.asn || exit 1 +# ln -sf SSEM-PDU-Descriptions.asn SSEM_PDU_Descriptions.asn || exit 1 +# ln -sf iso-patched/'ISO14906(2018)EfcDsrcApplicationv6-patched.asn' iso-patched/EfcDsrcApplication.asn || exit 1 +# ln -sf iso-patched/'ISO14906(2018)EfcDsrcGenericv7-patched.asn' iso-patched/EfcDsrcGeneric.asn || exit 1 +# ln -sf iso-patched/ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn iso-patched/ElectronicRegistrationIdentificationVehicleDataModule.asn || exit 1 +# ln -sf iso-patched/ISO14823-missing.asn iso-patched/GDD.asn || exit 1 +# fi SUB_DIRS=`find . -type d` if [ "SUB_DIRS" != "" ] then -- GitLab From 6c00ac9eaf94f91ba6a56f4e5f697032c2230041 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Wed, 29 Mar 2023 10:04:07 +0200 Subject: [PATCH 062/178] Enhance LEAP delay --- .../GeoNetworking/geonetworking_layer.cc | 11 ++++++--- .../GeoNetworking/geonetworking_layer.hh | 1 + ccsrc/framework/include/params_its.hh | 2 ++ ccsrc/framework/src/params_its.cc | 24 ++++++++++--------- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc index 1519692..8feeff4 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc @@ -23,7 +23,8 @@ geonetworking_layer::geonetworking_layer(const std::string &p_type, const std::s : t_layer(p_type), _params(), _codec(), _beacon(nullptr), _gbc_packet(nullptr), _shb_packet(nullptr), _tsb_packet(nullptr), _uni_packet(nullptr), _ls_reply(nullptr), _location_table(), _pass_beacon_table(), _device_mode{false}, _secured_mode{false}, _encrypted_mode{false}, _enable_security_checks{false}, - _sendData(), _timerid{0}, _sev{0}, _its{0}, _freq_nanosecs(0), _mask{0}, _sa{0}, _sequence_number{0}, _latitude{0}, _longitude{0}, _force_certificate{false} { + _sendData(), _timerid{0}, _sev{0}, _its{0}, _freq_nanosecs(0), _mask{0}, _sa{0}, _sequence_number{0}, _latitude{0}, _longitude{0}, _force_certificate{false}, + _leap_delay_us(4000/*Add 4 leap seconds to convert to TAI (as Feb 2019)*/) { loggers::get_instance().log(">>> geonetworking_layer::geonetworking_layer: %s, %s", to_string().c_str(), p_param.c_str()); init(p_type, p_param); @@ -135,6 +136,10 @@ void geonetworking_layer::init(const std::string &p_type, const std::string &p_p if (it == _params.cend()) { _params.insert(std::pair(params_its::its_aid, "FFFFFFFFFFFF")); } + it = _params.find(params_its::leap_delay_us); + if (it != _params.cend()) { + _leap_delay_us = converter::get_instance().string_to_int(it->second); + } // Set up default security parameters value if (_secured_mode || _encrypted_mode) { @@ -162,8 +167,8 @@ void geonetworking_layer::init(const std::string &p_type, const std::string &p_p loggers::get_instance().log("geonetworking_layer::init: Register %s/%p", p_type.c_str(), this); registration::get_instance().add_item(p_type, this); - // Add 4 leap seconds to convert to TAI (as Feb 2019) - base_time::get_instance().set_leap_delay_us(4 * 1000000); // TODO Set it as parameter + // Add leap seconds to convert to TAI + base_time::get_instance().set_leap_delay_us(_leap_delay_us); } // End of init_params void geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingReq &p, params &p_params) { diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh index b9f195d..8856940 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh @@ -72,6 +72,7 @@ class geonetworking_layer : public t_layer Date: Tue, 4 Apr 2023 07:30:37 +0200 Subject: [PATCH 063/178] Enhance virtualization/docker procedure --- ccsrc/Protocols/Security/security_services_its.cc | 2 +- virtualization/docker/Dockerfile | 2 +- virtualization/docker/docker-run.sh | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ccsrc/Protocols/Security/security_services_its.cc b/ccsrc/Protocols/Security/security_services_its.cc index b8c3ab3..dfd193e 100644 --- a/ccsrc/Protocols/Security/security_services_its.cc +++ b/ccsrc/Protocols/Security/security_services_its.cc @@ -28,7 +28,7 @@ security_services_its::security_services_its() _unknown_certificate(0, nullptr), _requested_certificate(), _latitude(0), _longitude(0), _elevation(0), _geospacial() { loggers::get_instance().log(">>> security_services_its::security_services_its"); - //_geospacial.load_countries_map("/home/yann/dev/TTF0002_Its/ne-countries-50m.json"); // FIXME Use parameter + //_geospacial.load_countries_map("$HOME/dev/TS.ITS/ne-countries-50m.json"); // FIXME Use parameter } // End of ctor diff --git a/virtualization/docker/Dockerfile b/virtualization/docker/Dockerfile index 5a464e6..04cc0bc 100644 --- a/virtualization/docker/Dockerfile +++ b/virtualization/docker/Dockerfile @@ -51,6 +51,6 @@ WORKDIR /home/etsi/dev EXPOSE 80/tcp 443/tcp 12340-12349/udp -ENTRYPOINT ["/home/yann/dev/cise/virtualization/docker/docker-entrypoint.sh"] +ENTRYPOINT ["/home/etsi/dev/cise/virtualization/docker/docker-entrypoint.sh"] CMD ["help"] \ No newline at end of file diff --git a/virtualization/docker/docker-run.sh b/virtualization/docker/docker-run.sh index 32ff918..50a34f1 100755 --- a/virtualization/docker/docker-run.sh +++ b/virtualization/docker/docker-run.sh @@ -4,11 +4,11 @@ set -exo pipefail cd "$(dirname ${BASH_SOURCE})" docker run --rm -it \ - -w /home/yann/dev/TS.ITS \ - -e GEN_DIR=/home/yann/dev/TS.ITS \ + -w $HOME/dev/TS.ITS \ + -e GEN_DIR=$HOME/dev/TS.ITS \ -u "$(id -u):$(id -g)" \ - -v "${PWD}/../..:/home/yann/dev/TS.ITS" \ - --entrypoint /home/yann/dev/TS.ITS/virtualization/docker/docker-entrypoint.sh \ + -v "${PWD}/../..:$HOME/dev/TS.ITS" \ + --entrypoint $HOME/dev/TS.ITS/virtualization/docker/docker-entrypoint.sh \ alpine-its:latest "$@" # -p 0.0.0.0:80:80 \ # -p 0.0.0.0:443:443 \ -- GitLab From 9571cc0b9fe7829f4ea163fd96b5526cad3019fb Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 7 Apr 2023 09:26:14 +0200 Subject: [PATCH 064/178] Bug fixed in ccsrc/Protocols/Security/certificates_loader.cc; Update AtsMBR upper tester codec --- ccsrc/Protocols/Security/certificates_loader.cc | 2 +- ccsrc/Protocols/Security/security_cache.cc | 1 + ccsrc/Protocols/UpperTester/uppertester_mbr_layer_factory.hh | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ccsrc/Protocols/Security/certificates_loader.cc b/ccsrc/Protocols/Security/certificates_loader.cc index 4ee8fe3..60c5b80 100644 --- a/ccsrc/Protocols/Security/certificates_loader.cc +++ b/ccsrc/Protocols/Security/certificates_loader.cc @@ -151,7 +151,7 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const etsi_ts103097_certificate_codec codec; Ieee1609Dot2::CertificateBase decoded_certificate; codec.decode(certificate, decoded_certificate); - if (!decoded_certificate.is_value()) { + if (!decoded_certificate.is_bound()) { loggers::get_instance().warning("certificates_loader::build_certificates_cache: Failed to decode certificate for '%s'", key.c_str()); return -1; } else { diff --git a/ccsrc/Protocols/Security/security_cache.cc b/ccsrc/Protocols/Security/security_cache.cc index e1b631b..9b8c3fa 100644 --- a/ccsrc/Protocols/Security/security_cache.cc +++ b/ccsrc/Protocols/Security/security_cache.cc @@ -201,6 +201,7 @@ int security_cache::get_hashed_id(const std::string &p_certificate_id, OCTETSTRI p_hashed_id = it->second; + loggers::get_instance().log_msg("<<< security_cache::get_hashed_id: ", p_hashed_id); return 0; } diff --git a/ccsrc/Protocols/UpperTester/uppertester_mbr_layer_factory.hh b/ccsrc/Protocols/UpperTester/uppertester_mbr_layer_factory.hh index 9d6bde8..637220b 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_mbr_layer_factory.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_mbr_layer_factory.hh @@ -20,7 +20,7 @@ class uppertester_mbr_layer_factory : public layer_factory { public: uppertester_mbr_layer_factory() { // Register factory - layer_stack_builder::register_layer_factory("UT_PKI", this); + layer_stack_builder::register_layer_factory("UT_MBR", this); }; inline virtual layer *create_layer(const std::string &p_type, const std::string &p_param) { return new uppertester_mbr_layer(p_type, p_param); }; }; // End of class uppertester_mbr_layer_factory -- GitLab From ea2b0a1ece7a0dc91cac03dd26ebbf915fda1f06 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 7 Apr 2023 09:48:13 +0200 Subject: [PATCH 065/178] Finalyze first AtsMBR test case --- etc/AtsMBR/AtsMBR.cfg | 149 ++++++++++++++++++ titan-test-system-framework | 2 +- ttcn/AtsMBR | 2 +- .../docker-dev/home/etc/init.d/50-ats.sh | 2 +- 4 files changed, 152 insertions(+), 3 deletions(-) create mode 100644 etc/AtsMBR/AtsMBR.cfg diff --git a/etc/AtsMBR/AtsMBR.cfg b/etc/AtsMBR/AtsMBR.cfg new file mode 100644 index 0000000..623a0d8 --- /dev/null +++ b/etc/AtsMBR/AtsMBR.cfg @@ -0,0 +1,149 @@ + +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# The GeoNetworking address of the IUT. +#LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { +# typeOfAddress := e_initial, +# stationType := e_unknown, +# reserved := 0, +# mid := '000000000000'O +#} +LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { + typeOfAddress := e_manual, + stationType := e_roadSideUnit, + reserved := 49, + mid := '001C6B0D0201'O +} +LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB +LibItsBtp_Pixits.PX_DESTINATION_PORT := 2001 +LibItsBtp_Pixits.PX_DESTINATION_PORT_INFO := 2001 + +# The certificate identifier the TA shall use in case of secured IUT +#LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_IUT_A_AT" + +# 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 := "../data/certificates" +# Configuration sub-directory to access certificate stored in files +LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" +# The certficate the IUT should use (cf. UtInitialize) +LibItsSecurity_Pixits.PX_IUT_DEFAULT_CERTIFICATE := "CERT_IUT_A_B_AT" #"CERT_IUT_A_AT" +# The certficate the TS should use to generate an ITS message +LibItsSecurity_Pixits.PX_AT_CERTIFICATE := "CERT_TS_B_AT" # Possible values: CERT_TS_C_AT, CERT_TS_D_AT, or CERT_TS_E_AT + +#LibItsSecurity_Pics.PICS_SEC_SHA256 := false +#LibItsSecurity_Pics.PICS_SEC_SHA384 := true + +[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). + +LogFile := "../logs/AtsSecurity/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | TIMEROP +#ConsoleMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | TIMEROP +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +# CAM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# header_sub_type : sh (single hop) +# DENM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# BTP Layer +# type : btpA|btpB +# destination port: dst_port +# source port : src_port +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# GN Layer +# ll_address : GeoNetworking address of the Test System +# latitude : latitude of the Test System +# longitude : longitude of the Test System +# beaconing : Set to 1 if GnLayer shall start beaconing +# Beaconning timer expiry: expiry (ms) +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# secured_mode : Set to 1 if message exchanges shall be signed +# encrypted_mode : Set to 1 if message exchanges shall be encrypted +# NOTE: For signed & encrypted message exchanges, both secured_mode and encrypted_mode shall be set to 1 +# sec_db_path : Path to the certificates and keys storage location +# hash : Hash algorithm to be used when secured mode is set +# Authorized values are SHA-256 or SHA-384 +# Default: SHA-256 +# cypher : Cyphering algorithm to be used when secured mode is set +# Authorized values are NISTP-256, BP-256 and BP-384 +# Default: NISTP-256 +# Ethernet layer +# mac_src :Source MAC address +# mac_bc :Broadcast address +# eth_type : Ethernet type +# Commsignia layer +# mac_src : Device MAC address, used to discard packets +# To indicate no filering, use the value 000000000000 +# mac_bc : Broadcast address +# eth_type : Ethernet type, used to discard packets +# target_host : Device address +# target_port : Device port +# source_port : Test System port +# interface_id: Interface id, used to discard packets +# tx_power : TX power (dB) +# UDP layer (IP/UDP based on Pcap) +# dst_ip : destination IPv4 address (aa.bb.cc.dd) +# dst_port: destination port +# src_ip : source IPv4 address (aa.bb.cc.dd) +# src_port: source port +# Pcap layer +# mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System +# filter : Pcap filter (compliant with tcpdump syntax) +# Online mode: +# nic: Local NIC +# If set, online mode is used +# Offline mode (nic is present but not set): +# file : File to read +# frame_offset: Frame offset, used to skip packets with frame number < frame_offset +# time_offset : Time offset, used to skip packets with time offset < time_offset +# save_mode : 1 to save sent packet, 0 otherwise + +# Single GeoNetworking component port +# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf +# its_aid=36: CAM +# its_aid=37: DENM +# its_aid=137: SPAT +# its_aid=138: MAP +# its_aid=139: IVIM +# its_aid=140: SREM/SSEM +# its_aid=141: GeoMet +# its_aid=128: RTCMEM + +# Cygwin +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,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,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,its_aid=36)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlp0s20f3,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,its_aid=36)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.43,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.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" # Use with TC_SEC_ITSS_RCV_MSG_ test cases + +[EXECUTE] + +# Check that +ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS1_CAM_001 + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/titan-test-system-framework b/titan-test-system-framework index 0a28ff3..c4d93f6 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit 0a28ff34d9ca15d6ed481dad98485210e4d6e179 +Subproject commit c4d93f6e22d71386d5a5949ba1bd447e728ea060 diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index f9908ac..98d9168 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit f9908ac693ba16f8f99ae01580a3cc7e67433d1c +Subproject commit 98d916828ee948ecefbd9230f30c469ca9c4dffa diff --git a/virtualization/docker-dev/home/etc/init.d/50-ats.sh b/virtualization/docker-dev/home/etc/init.d/50-ats.sh index 4a014f1..4bc6614 100755 --- a/virtualization/docker-dev/home/etc/init.d/50-ats.sh +++ b/virtualization/docker-dev/home/etc/init.d/50-ats.sh @@ -11,7 +11,7 @@ cd ${HOME}/dev/TS.ITS/scripts || exit 1 echo -e "*****************************\n* Build test suites\n*****************************\n" cd ${HOME}/dev/TS.ITS -ATS_LIST="AtsCAM AtsDENM AtsGeoNetworking AtsPki AtsSecurity AtsIS" +ATS_LIST="AtsCAM AtsDENM AtsGeoNetworking AtsIS AtsPki AtsSecurity AtsMBR" for i in ${ATS_LIST} do export ATS=$i -- GitLab From 29d672090f0889438c5d52694b5b2f2c11f98a33 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Tue, 11 Apr 2023 10:18:20 +0200 Subject: [PATCH 066/178] Validate fir MBR test case (step 1) --- .../RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc | 6 +++++- etc/AtsMBR/AtsMBR.cfg | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc index 127076b..0cf0778 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc @@ -511,6 +511,11 @@ int ConfigRsuSimulatorLayer::process_utinitialize_data(const OCTETSTRING &data, LibItsRtcmem__TypesAndValues::UtRtcmemInitialize p(hashedId); // Pass it to the ports if any to_all_upper_ports(p, params); + } else if (_params[std::string("ut")].compare("mbr") == 0) { + OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); + LibItsMbr__TypesAndValues::UtMbrInitialize p(hashedId); + // Pass it to the ports if any + to_all_upper_ports(p, params); } else { loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_utinitialize_data: Unsupported protocol"); return -1; @@ -937,7 +942,6 @@ int ConfigRsuSimulatorLayer::process_ut_mbr_trigger(const OCTETSTRING &data, par loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_mbr_trigger: msg_id=%02x", msg_id); LibItsMbr__TypesAndValues::UtMbrTrigger p; - loggers::get_instance().error("ConfigRsuSimulatorLayer::process_ut_mbr_trigger: To be implemented"); if (msg_id == uppertester_mbr_codec::c_utMbrTrigger) { p.targetId() = oct2int(OCTETSTRING(1, 1 + static_cast(data))); p.cause() = oct2int(OCTETSTRING(1, 2 + static_cast(data))); diff --git a/etc/AtsMBR/AtsMBR.cfg b/etc/AtsMBR/AtsMBR.cfg index 623a0d8..d104a65 100644 --- a/etc/AtsMBR/AtsMBR.cfg +++ b/etc/AtsMBR/AtsMBR.cfg @@ -40,7 +40,7 @@ LibItsSecurity_Pixits.PX_AT_CERTIFICATE := "CERT_TS_B_AT" # Possible values: CER # 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). -LogFile := "../logs/AtsSecurity/%e.%h-%r.%s" +LogFile := "../logs/AtsMBR/%e.%h-%r.%s" FileMask := LOG_ALL | USER | DEBUG | MATCHING ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING #FileMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | TIMEROP @@ -134,7 +134,7 @@ system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=43551050 system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.43)" -system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" # Use with TC_SEC_ITSS_RCV_MSG_ test cases +system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" [EXECUTE] -- GitLab From 9e13ad93d7f0746ce15005743b3b073daddb5ee9 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 14 Apr 2023 15:06:44 +0200 Subject: [PATCH 067/178] Validate first AtsMBR test case --- .../GeoNetworking/decoding_context.cc | 24 ++++++++++++++ .../GeoNetworking/decoding_context.hh | 32 ++++++++----------- .../GeoNetworking/encoding_context.cc | 23 +++++++++++++ .../GeoNetworking/encoding_context.hh | 28 +++++++--------- .../GeoNetworking/geonetworking_codec.cc | 18 +++++------ .../GeoNetworking/geonetworking_layer.cc | 2 +- ccsrc/Protocols/GeoNetworking/module.mk | 2 +- ccsrc/Protocols/Security/security_ecc.hh | 2 +- .../Security/security_services_its.cc | 1 + etc/AtsMBR/AtsMBR.cfg | 6 ++-- etc/AtsSecurity/AtsSecurity.cfg | 24 +++++++++++--- ttcn/AtsMBR | 2 +- .../docker-dev/home/etc/init.d/45-certgen.sh | 6 ++-- virtualization/vagrant/provisioner.bash | 6 ++-- 14 files changed, 114 insertions(+), 62 deletions(-) create mode 100644 ccsrc/Protocols/GeoNetworking/decoding_context.cc create mode 100644 ccsrc/Protocols/GeoNetworking/encoding_context.cc diff --git a/ccsrc/Protocols/GeoNetworking/decoding_context.cc b/ccsrc/Protocols/GeoNetworking/decoding_context.cc new file mode 100644 index 0000000..5752698 --- /dev/null +++ b/ccsrc/Protocols/GeoNetworking/decoding_context.cc @@ -0,0 +1,24 @@ +#pragma once + +#include "decoding_context.hh" + +void decoding_context::reset() { + _next_header = 0xff; + _header_type = 0xff; + _header_sub_type = 0xff; + _lifetime = 0; + _length = -1; +} + +unsigned char decoding_context::get_next_header() { return _next_header; }; +void decoding_context::set_next_header(const unsigned char p_next_header) { _next_header = p_next_header; }; +unsigned char decoding_context::get_header_type() { return _header_type; }; +void decoding_context::set_header_type(const unsigned char p_header_type) { _header_type = p_header_type; }; +unsigned char decoding_context::get_header_sub_type() { return _header_sub_type; }; +void decoding_context::set_header_sub_type(const unsigned char p_header_sub_type) { _header_sub_type = p_header_sub_type; }; +unsigned char decoding_context::get_traffic_class() { return _traffic_class; }; +void decoding_context::set_traffic_class(const unsigned char p_traffic_class) { _traffic_class = p_traffic_class; }; +unsigned int decoding_context::get_lifetime() { return _lifetime; }; +void decoding_context::set_lifetime(const unsigned int p_lifetime) { _lifetime = p_lifetime; }; +unsigned int decoding_context::get_length() { return _length; }; +void decoding_context::set_length(const unsigned int p_length) { _length = p_length; }; diff --git a/ccsrc/Protocols/GeoNetworking/decoding_context.hh b/ccsrc/Protocols/GeoNetworking/decoding_context.hh index d5c26ad..93a0aed 100644 --- a/ccsrc/Protocols/GeoNetworking/decoding_context.hh +++ b/ccsrc/Protocols/GeoNetworking/decoding_context.hh @@ -13,25 +13,19 @@ class decoding_context { public: explicit decoding_context() { reset(); }; ~decoding_context(){}; - inline void reset() { - _next_header = 0xff; - _header_type = 0xff; - _header_sub_type = 0xff; - _lifetime = 0; - _length = -1; - }; + void reset(); public: - inline unsigned char get_next_header() { return _next_header; }; - inline void set_next_header(const unsigned char p_next_header) { _next_header = p_next_header; }; - inline unsigned char get_header_type() { return _header_type; }; - inline void set_header_type(const unsigned char p_header_type) { _header_type = p_header_type; }; - inline unsigned char get_header_sub_type() { return _header_sub_type; }; - inline void set_header_sub_type(const unsigned char p_header_sub_type) { _header_sub_type = p_header_sub_type; }; - inline unsigned char get_traffic_class() { return _traffic_class; }; - inline void set_traffic_class(const unsigned char p_traffic_class) { _traffic_class = p_traffic_class; }; - inline unsigned int get_lifetime() { return _lifetime; }; - inline void set_lifetime(const unsigned int p_lifetime) { _lifetime = p_lifetime; }; - inline unsigned int get_length() { return _length; }; - inline void set_length(const unsigned int p_length) { _length = p_length; }; + unsigned char get_next_header(); + void set_next_header(const unsigned char p_next_header); + unsigned char get_header_type(); + void set_header_type(const unsigned char p_header_type); + unsigned char get_header_sub_type(); + void set_header_sub_type(const unsigned char p_header_sub_type); + unsigned char get_traffic_class(); + void set_traffic_class(const unsigned char p_traffic_class); + unsigned int get_lifetime(); + void set_lifetime(const unsigned int p_lifetime); + unsigned int get_length(); + void set_length(const unsigned int p_length); }; // End of class decoding_context diff --git a/ccsrc/Protocols/GeoNetworking/encoding_context.cc b/ccsrc/Protocols/GeoNetworking/encoding_context.cc new file mode 100644 index 0000000..6a9edd3 --- /dev/null +++ b/ccsrc/Protocols/GeoNetworking/encoding_context.cc @@ -0,0 +1,23 @@ +#pragma once + +#include "encoding_context.hh" + + +void encoding_context::reset() { + _basic_header = 0xff; + _next_header = 0xff; + _header_type = 0xff; + _length_position = -1; + _length = -1; +} + +unsigned char encoding_context::get_basic_header() { return _basic_header; }; +void encoding_context::set_basic_header(const unsigned char p_basic_header) { _basic_header = p_basic_header; }; +unsigned char encoding_context::get_next_header() { return _next_header; }; +void encoding_context::set_next_header(const unsigned char p_next_header) { _next_header = p_next_header; }; +unsigned char encoding_context::get_header_type() { return _header_type; }; +void encoding_context::set_header_type(const unsigned char p_header_type) { _header_type = p_header_type; }; +unsigned int encoding_context::get_length_position() { return _length_position; }; +void encoding_context::set_length_position(const unsigned int p_length_position) { _length_position = p_length_position; }; +unsigned int encoding_context::get_length() { return _length; }; +void encoding_context::set_length(const unsigned int p_length) { _length = p_length; }; diff --git a/ccsrc/Protocols/GeoNetworking/encoding_context.hh b/ccsrc/Protocols/GeoNetworking/encoding_context.hh index 74ace5c..0a0de32 100644 --- a/ccsrc/Protocols/GeoNetworking/encoding_context.hh +++ b/ccsrc/Protocols/GeoNetworking/encoding_context.hh @@ -11,23 +11,17 @@ class encoding_context { public: explicit encoding_context() { reset(); } - inline void reset() { - _basic_header = 0xff; - _next_header = 0xff; - _header_type = 0xff; - _length_position = -1; - _length = -1; - } + void reset(); public: - inline unsigned char get_basic_header() { return _basic_header; }; - inline void set_basic_header(const unsigned char p_basic_header) { _basic_header = p_basic_header; }; - inline unsigned char get_next_header() { return _next_header; }; - inline void set_next_header(const unsigned char p_next_header) { _next_header = p_next_header; }; - inline unsigned char get_header_type() { return _header_type; }; - inline void set_header_type(const unsigned char p_header_type) { _header_type = p_header_type; }; - inline unsigned int get_length_position() { return _length_position; }; - inline void set_length_position(const unsigned int p_length_position) { _length_position = p_length_position; }; - inline unsigned int get_length() { return _length; }; - inline void set_length(const unsigned int p_length) { _length = p_length; }; + unsigned char get_basic_header(); + void set_basic_header(const unsigned char p_basic_header); + unsigned char get_next_header(); + void set_next_header(const unsigned char p_next_header); + unsigned char get_header_type(); + void set_header_type(const unsigned char p_header_type); + unsigned int get_length_position(); + void set_length_position(const unsigned int p_length_position); + unsigned int get_length(); + void set_length(const unsigned int p_length); }; // End of class encoding_context diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_codec.cc b/ccsrc/Protocols/GeoNetworking/geonetworking_codec.cc index be8b6b8..408f905 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_codec.cc +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_codec.cc @@ -23,17 +23,17 @@ int geonetworking_codec::encode(const LibItsGeoNetworking__TypesAndValues::GeoNe data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); // Overwrite the payload length if (_ec.get_length() != (unsigned int)-1) { - loggers::get_instance().log("geonetworking_codec::encode: length=%d - plLength_position = %d - plLength = %d", data.lengthof(), _ec.get_length_position(), + loggers::get_instance().log("geonetworking_codec::encode (1): length=%d - plLength_position = %d - plLength = %d", data.lengthof(), _ec.get_length_position(), _ec.get_length()); unsigned char b[] = {(unsigned char)((_ec.get_length() & 0x0000FF00) >> 8), (unsigned char)_ec.get_length()}; OCTETSTRING rpl(sizeof(b), b); loggers::get_instance().log_msg("geonetworking_codec::encode: rpl=", rpl); data = replace(data, _ec.get_length_position(), rpl.lengthof(), rpl); - loggers::get_instance().log_msg("geonetworking_codec::encode: after replace: ", data); + loggers::get_instance().log_msg("geonetworking_codec::encode (1): after replace: ", data); } - loggers::get_instance().log_msg("geonetworking_codec::encode: After encoding: ", data); + loggers::get_instance().log_msg("geonetworking_codec::encode (1): After encoding: ", data); - loggers::get_instance().log("<<< geonetworking_codec::encode"); + loggers::get_instance().log("<<< geonetworking_codec::encode (1)"); return 0; } @@ -46,17 +46,17 @@ int geonetworking_codec::encode(const LibItsGeoNetworking__TypesAndValues::GnNon data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); // Overwrite the payload length if (_ec.get_length() != (unsigned int)-1) { - loggers::get_instance().log("geonetworking_codec::encode: length=%d - plLength_position = %d - plLength = %d", data.lengthof(), _ec.get_length_position(), + loggers::get_instance().log("geonetworking_codec::encode (2): length=%d - plLength_position = %d - plLength = %d", data.lengthof(), _ec.get_length_position(), _ec.get_length()); unsigned char b[] = {(unsigned char)((_ec.get_length() & 0x0000FF00) >> 8), (unsigned char)_ec.get_length()}; OCTETSTRING rpl(sizeof(b), b); - loggers::get_instance().log_msg("geonetworking_codec::encode: rpl=", rpl); + loggers::get_instance().log_msg("geonetworking_codec::encode (2): rpl=", rpl); data = replace(data, _ec.get_length_position(), rpl.lengthof(), rpl); - loggers::get_instance().log_msg("geonetworking_codec::encode: after replace: ", data); + loggers::get_instance().log_msg("geonetworking_codec::encode (2): after replace: ", data); } - loggers::get_instance().log_msg("geonetworking_codec::encode: After encoding: ", data); + loggers::get_instance().log_msg("geonetworking_codec::encode (2): After encoding: ", data); - loggers::get_instance().log("<<< geonetworking_codec::encode"); + loggers::get_instance().log("<<< geonetworking_codec::encode (2)"); return 0; } diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc index 8feeff4..e8451ee 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc @@ -202,7 +202,7 @@ void geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::Geo void geonetworking_layer::send_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> geonetworking_layer::send_data: ", data); - p_params.log(); + //p_params.log(); params_its ¶ms = static_cast(p_params); diff --git a/ccsrc/Protocols/GeoNetworking/module.mk b/ccsrc/Protocols/GeoNetworking/module.mk index b9c72ec..1800c1f 100644 --- a/ccsrc/Protocols/GeoNetworking/module.mk +++ b/ccsrc/Protocols/GeoNetworking/module.mk @@ -1,3 +1,3 @@ -sources := geonetworking_codec.cc geonetworking_layer.cc location_table.cc +sources := geonetworking_codec.cc geonetworking_layer.cc location_table.cc encoding_context.cc decoding_context.cc includes := . diff --git a/ccsrc/Protocols/Security/security_ecc.hh b/ccsrc/Protocols/Security/security_ecc.hh index 91d7bbb..1cbb9cf 100644 --- a/ccsrc/Protocols/Security/security_ecc.hh +++ b/ccsrc/Protocols/Security/security_ecc.hh @@ -36,7 +36,7 @@ enum class ecc_compressed_mode : unsigned char { }; // End of class ecc_compressed_mode /*! - * \enum Supported encryption algorithem + * \enum Supported encryption algorithm */ enum class encryption_algotithm : unsigned char { // TODO Renamed into ecc_encryption_algotithm aes_128_ccm, diff --git a/ccsrc/Protocols/Security/security_services_its.cc b/ccsrc/Protocols/Security/security_services_its.cc index dfd193e..62bedc7 100644 --- a/ccsrc/Protocols/Security/security_services_its.cc +++ b/ccsrc/Protocols/Security/security_services_its.cc @@ -510,6 +510,7 @@ int security_services_its::sign_payload(const OCTETSTRING &p_unsecured_gn_payloa Ieee1609Dot2::SignedDataPayload payload; payload.data() = unsecured_data; payload.extDataHash().set_to_omit(); + payload.omitted().set_to_omit(); Ieee1609Dot2::HeaderInfo header_info; // Set secured field according to the payload! header_info.psid() = converter::get_instance().string_to_int(p_params[params_its::its_aid]); diff --git a/etc/AtsMBR/AtsMBR.cfg b/etc/AtsMBR/AtsMBR.cfg index d104a65..f3d76c3 100644 --- a/etc/AtsMBR/AtsMBR.cfg +++ b/etc/AtsMBR/AtsMBR.cfg @@ -29,13 +29,15 @@ LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "../data/certificates" # Configuration sub-directory to access certificate stored in files LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" # The certficate the IUT should use (cf. UtInitialize) -LibItsSecurity_Pixits.PX_IUT_DEFAULT_CERTIFICATE := "CERT_IUT_A_B_AT" #"CERT_IUT_A_AT" +#LibItsSecurity_Pixits.PX_IUT_DEFAULT_CERTIFICATE := "CERT_IUT_A_AT" # The certficate the TS should use to generate an ITS message -LibItsSecurity_Pixits.PX_AT_CERTIFICATE := "CERT_TS_B_AT" # Possible values: CERT_TS_C_AT, CERT_TS_D_AT, or CERT_TS_E_AT +#LibItsSecurity_Pixits.PX_AT_CERTIFICATE := "CERT_TS_B_AT" # Possible values: CERT_TS_C_AT, CERT_TS_D_AT, or CERT_TS_E_AT #LibItsSecurity_Pics.PICS_SEC_SHA256 := false #LibItsSecurity_Pics.PICS_SEC_SHA384 := true +LibItsMbr_Pics.PICS_IUT_MA_CERTIFICATE_ID := "CERT_TS_A_AA" + [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). diff --git a/etc/AtsSecurity/AtsSecurity.cfg b/etc/AtsSecurity/AtsSecurity.cfg index a3eb0a4..61ad421 100644 --- a/etc/AtsSecurity/AtsSecurity.cfg +++ b/etc/AtsSecurity/AtsSecurity.cfg @@ -19,8 +19,9 @@ LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB LibItsBtp_Pixits.PX_DESTINATION_PORT := 2001 LibItsBtp_Pixits.PX_DESTINATION_PORT_INFO := 2001 -# The certificate identifier the TA shall use in case of secured IUT -#LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_IUT_A_AT" +#LibItsSecurity_Pics.PICS_SEC_NIST_P256 := false +#LibItsSecurity_Pics.PICS_SEC_BRAINPOOL_P256R1 := false; +#LibItsSecurity_Pics.PICS_SEC_BRAINPOOL_P384R1 := false; # Enable Security support LibItsGeoNetworking_Pics.PICS_GN_SECURITY := true @@ -33,8 +34,12 @@ LibItsSecurity_Pixits.PX_IUT_DEFAULT_CERTIFICATE := "CERT_IUT_A_B_AT" #"CERT_IUT # The certficate the TS should use to generate an ITS message LibItsSecurity_Pixits.PX_AT_CERTIFICATE := "CERT_TS_B_AT" # Possible values: CERT_TS_C_AT, CERT_TS_D_AT, or CERT_TS_E_AT +# The certificate identifier the TA shall use in case of secured IUT +#LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_IUT_A_AT" + #LibItsSecurity_Pics.PICS_SEC_SHA256 := false #LibItsSecurity_Pics.PICS_SEC_SHA384 := true + [LOGGING] # In this section you can specify the name of the log file and the classes of events @@ -147,7 +152,7 @@ system.camUtPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_po # ------------------------- CAM --------------------------- # Check that IUT sends the secured CAM using SignedData container. -ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_01_BV +#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 @@ -162,7 +167,16 @@ ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_01_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 +# PICS_SEC_NIST_P256 +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_05_A_BV +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_05_AN_BV +# PICS_SEC_BRAINPOOL_P256R1 +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_05_B_BV +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_05_BN_BV +# PICS_SEC_BRAINPOOL_P384R1 +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_05_C_BV +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_05_CN_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. @@ -174,7 +188,7 @@ ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_01_BV # Check that IUT sends the secured CAM containing the signing certificate when the IUT received CAM from an unknown ITS-S. # When there is a new ITS-S detected, the OBU send immediaty its signing certificate to anticipate any certificate distribution -#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_08_BV +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 diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index 98d9168..ef12130 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit 98d916828ee948ecefbd9230f30c469ca9c4dffa +Subproject commit ef121307e707871c775d5e7858ff882c338fb2c7 diff --git a/virtualization/docker-dev/home/etc/init.d/45-certgen.sh b/virtualization/docker-dev/home/etc/init.d/45-certgen.sh index 9c8b61f..273c18c 100755 --- a/virtualization/docker-dev/home/etc/init.d/45-certgen.sh +++ b/virtualization/docker-dev/home/etc/init.d/45-certgen.sh @@ -6,10 +6,10 @@ set -vx echo -e "*****************************\n* Build ETSI ITS certificate generation tools \n*****************************\n" cd ${HOME}/dev || exit 1 -git clone --recurse-submodules https://forge.etsi.org/rep/ITS/itscertgen.git ./itscertgen +git clone --recurse-submodules --branch release2 https://forge.etsi.org/rep/ITS/itscertgen.git ./itscertgen cd ./itscertgen -cd cshared && make && cd - -cd certgen/ && make && cd - +sed --in-place 's/\-fillabs2//g' ./certgen/asncodec/Makefile +make && cd - || exit 1 echo -e "*****************************\n* Generate ETSI ITS certificates \n*****************************\n" cd ${HOME}/dev/TS.ITS/data/certificates diff --git a/virtualization/vagrant/provisioner.bash b/virtualization/vagrant/provisioner.bash index e9cd2c2..67dbf48 100755 --- a/virtualization/vagrant/provisioner.bash +++ b/virtualization/vagrant/provisioner.bash @@ -190,10 +190,10 @@ cd ${HOME}/dev/TS.ITS/scripts # Build ETSI ITS certificate generation tools cd /home/vagrant/dev -git clone --recurse-submodules https://forge.etsi.org/rep/ITS/itscertgen.git ./itscertgen +git clone --recurse-submodules --branch release2 https://forge.etsi.org/rep/ITS/itscertgen.git ./itscertgen cd ./itscertgen -cd cshared && make && cd - -cd certgen/ && make && cd - +sed --in-place 's/\-fillabs2//g' ./certgen/asncodec/Makefile +make && cd - # Generate ETSI ITS certificates cd /home/vagrant/dev/TS.ITS/data/certificates CERTGEN=${HOME}/dev/itscertgen make -- GitLab From 45d1b12f68296226ca8c63ab59e8bc4db5536c2f Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 14 Apr 2023 15:15:28 +0200 Subject: [PATCH 068/178] Validate first AtsMBR test case --- ccsrc/EncDec/LibItsMbr_Encdec.cc | 10 +++++----- ttcn/AtsMBR | 2 +- ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ccsrc/EncDec/LibItsMbr_Encdec.cc b/ccsrc/EncDec/LibItsMbr_Encdec.cc index add5df5..c152aeb 100644 --- a/ccsrc/EncDec/LibItsMbr_Encdec.cc +++ b/ccsrc/EncDec/LibItsMbr_Encdec.cc @@ -16,12 +16,12 @@ namespace LibItsMbr__EncdecDeclarations { return int2bit(0, 1); }*/ - BITSTRING fx__enc__EtsiTs103759Data(const EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_102941_data) { - loggers::get_instance().log_msg(">>> fx__enc__EtsiTs103759Data: ", p_etsi_ts_102941_data); + BITSTRING fx__enc__EtsiTs103759Data(const EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_103759_data) { + loggers::get_instance().log_msg(">>> fx__enc__EtsiTs103759Data: ", p_etsi_ts_103759_data); etsi_ts103759_data_codec codec; OCTETSTRING os; - if (codec.encode(p_etsi_ts_102941_data, os) == -1) { + if (codec.encode(p_etsi_ts_103759_data, os) == -1) { loggers::get_instance().warning("fx__enc__EtsiTs103759Data: -1 result code was returned"); return int2bit(0, 1); } @@ -29,12 +29,12 @@ namespace LibItsMbr__EncdecDeclarations { return oct2bit(os); } - INTEGER fx__dec__EtsiTs103759Data(BITSTRING &b, EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_102941_data) { + INTEGER fx__dec__EtsiTs103759Data(BITSTRING &b, EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_103759_data) { loggers::get_instance().log_msg(">>> fx__dec__EtsiTs103759Data: ", b); etsi_ts103759_data_codec codec; OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_etsi_ts_102941_data) == -1) { + if (codec.decode(is, p_etsi_ts_103759_data) == -1) { loggers::get_instance().warning("fx__dec__EtsiTs103759Data: -1 result code was returned"); return -1; } diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index ef12130..4fa811c 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit ef121307e707871c775d5e7858ff882c338fb2c7 +Subproject commit 4fa811c19b847d355ccb18adf13fac22055c29d7 diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 3e69ac0..9b604d8 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 3e69ac00b8d8db8ebe0d8ea67bd29a1e1aba8c6f +Subproject commit 9b604d87ee204a3aee977d4cd845f229ca260ebc diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 066ee6d..45d4ea5 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 066ee6d75f63c6bf7287004d3195bbf1847c96f3 +Subproject commit 45d4ea503914c0ab94cc7eb6b2c2d7577828289b -- GitLab From 621995689fceccf11b4a85fd995c1ff436eb69f9 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Tue, 2 May 2023 14:25:54 +0200 Subject: [PATCH 069/178] Support of implicit certificates step1: Public key reconstruction --- ccsrc/EncDec/LibItsMbr_Encdec.cc | 10 - ccsrc/Externals/AtsRSUsSimulator_externals.cc | 19 + ccsrc/Externals/LibItsPki_externals.cc | 36 +- ccsrc/Externals/LibItsSecurity_externals.cc | 3893 ++++++++++------- .../Protocols/Mbr/etsi_ts103759_data_codec.cc | 1 - .../etsi_ts102941_trust_lists_ctl_format.cc | 1 - .../Protocols/Security/certificates_loader.cc | 364 +- .../Protocols/Security/certificates_loader.hh | 19 +- .../etsi_ts102941_base_types_public_keys.cc | 1 - .../Security/etsi_ts102941_data_codec.cc | 1 - .../etsi_ts102941_data_content_codec.cc | 1 - ...02941_types_authorization_inner_request.cc | 1 - ...2941_types_authorization_inner_response.cc | 1 - ...1_types_authorization_shared_at_request.cc | 1 - ..._types_authorization_validation_request.cc | 1 - ...types_authorization_validation_response.cc | 1 - ..._ts102941_types_enrolment_inner_request.cc | 1 - ...ts102941_types_enrolment_inner_response.cc | 1 - .../etsi_ts103097_certificate_codec.cc | 1 - .../Security/etsi_ts103097_data_codec.cc | 1 - ...i_ts103097_tobesigned_certificate_codec.cc | 1 - .../etsi_ts103097_tobesigned_data_codec.cc | 1 - ...09dot2_base_types_public_encryption_key.cc | 1 - ...dot2_base_types_public_verification_key.cc | 1 - ccsrc/Protocols/Security/security_cache.cc | 67 +- ccsrc/Protocols/Security/security_cache.hh | 8 - ccsrc/Protocols/Security/security_db.cc | 2 +- ccsrc/Protocols/Security/security_ecc.cc | 259 +- ccsrc/Protocols/Security/security_ecc.hh | 68 +- .../Security/security_services_its.cc | 336 +- .../Security/security_services_its.hh | 6 + ccsrc/framework/include/params_its.hh | 4 +- data/certificates/Makefile | 22 +- data/certificates/profiles/CERT_IUT_A_AT.xml | 2 +- .../profiles/CERT_IUT_A_AT_IMP.xml | 35 + .../profiles/CERT_TS_A_AT_IMP.xml | 35 + .../profiles/CERT_TS_A_AT_IMP_BO.xml | 36 + etc/AtsPki/AtsPki_Atos.cfg_ | 10 +- etc/AtsPki/AtsPki_Autocrypt.cfg_ | 10 +- etc/AtsPki/AtsPki_Ctag.cfg_ | 10 +- etc/AtsPki/AtsPki_Etas.cfg_ | 10 +- etc/AtsPki/AtsPki_Microsec.cfg_ | 10 +- etc/AtsPki/AtsPki_Simu.cfg_ | 10 +- etc/AtsSecurity/AtsSecurity.cfg | 12 +- ttcn/AtsDENM | 2 +- 45 files changed, 3299 insertions(+), 2014 deletions(-) create mode 100644 data/certificates/profiles/CERT_IUT_A_AT_IMP.xml create mode 100644 data/certificates/profiles/CERT_TS_A_AT_IMP.xml create mode 100644 data/certificates/profiles/CERT_TS_A_AT_IMP_BO.xml diff --git a/ccsrc/EncDec/LibItsMbr_Encdec.cc b/ccsrc/EncDec/LibItsMbr_Encdec.cc index c152aeb..084f3e0 100644 --- a/ccsrc/EncDec/LibItsMbr_Encdec.cc +++ b/ccsrc/EncDec/LibItsMbr_Encdec.cc @@ -6,16 +6,6 @@ namespace LibItsMbr__EncdecDeclarations { - /*BITSTRING fx__enc__CAM(const CAM__PDU__Descriptions::CAM &p_cam) { - cam_pdu_codec asn_codec; - BITSTRING b; - int rc = asn_codec.encode(p_cam, b); - if (rc) { - return b; - } - return int2bit(0, 1); - }*/ - BITSTRING fx__enc__EtsiTs103759Data(const EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_103759_data) { loggers::get_instance().log_msg(">>> fx__enc__EtsiTs103759Data: ", p_etsi_ts_103759_data); diff --git a/ccsrc/Externals/AtsRSUsSimulator_externals.cc b/ccsrc/Externals/AtsRSUsSimulator_externals.cc index 67006b7..e4272fe 100644 --- a/ccsrc/Externals/AtsRSUsSimulator_externals.cc +++ b/ccsrc/Externals/AtsRSUsSimulator_externals.cc @@ -1,5 +1,8 @@ #include "ItsRSUsSimulator_Functions.hh" +#include "loggers.hh" +#include "geospacial.hh" + namespace ItsRSUsSimulator__Functions { void fx__computePositionFromRotation(const INTEGER &p__refLatitude, const INTEGER &p__refLongitude, const INTEGER &p__cenLatitude, const INTEGER &p__cenLongitude, const INTEGER &p__rotation, INTEGER &p__latitude, INTEGER &p__longitude) { @@ -8,4 +11,20 @@ namespace ItsRSUsSimulator__Functions { p__longitude = p__cenLongitude; } + void fx__computeIncPosition(const INTEGER &p__refLatitude, const INTEGER &p__refLongitude, const FLOAT& p__dx, const FLOAT& p__dy, INTEGER &p__new__latitude, INTEGER &p__new__longitude) { + // Assume that As long as p__dx and p__dy are small compared to the radius of the earth and reference position is not too close to the pole + // http://www.edwilliams.org/avform147.htm#Intro + loggers::get_instance().log_msg(">>> fx__computeIncPosition: p__refLatitude=", p__refLatitude); + loggers::get_instance().log_msg(">>> fx__computeIncPosition: p__refLongitude=", p__refLongitude); + + //loggers::get_instance().log("fx__computeIncPosition: lat='%f'", static_cast(p__refLatitude) + (p__dy / R) * (180 / PI)); + //loggers::get_instance().log("fx__computeIncPosition: long='%f'", static_cast(p__refLongitude) + (p__dx / R) * (180 / PI) / cos(static_cast(p__refLatitude) * PI / 180)); + p__new__latitude = p__refLatitude + 1;//static_cast(static_cast(p__refLatitude) + (p__dy / R) * (180 / PI)); + p__new__longitude = p__refLongitude + 1;//static_cast(static_cast(p__refLongitude) + (p__dx / R) * (180 / PI) / cos(static_cast(p__refLatitude) * PI / 180)); + + loggers::get_instance().log_msg("<<< fx__computeIncPosition: p__refLatitude=", p__new__latitude); + loggers::get_instance().log_msg("<<< fx__computeIncPosition: p__refLongitude=", p__new__longitude); + + } + } // namespace ItsRSUsSimulator__Functions diff --git a/ccsrc/Externals/LibItsPki_externals.cc b/ccsrc/Externals/LibItsPki_externals.cc index 91aa822..bfa9bb8 100644 --- a/ccsrc/Externals/LibItsPki_externals.cc +++ b/ccsrc/Externals/LibItsPki_externals.cc @@ -1,18 +1,18 @@ -/*! - * \file LibItsPki_externals.cc - * \brief Source file for PKI externl functions. - * \author ETSI STF594 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ - -#include "LibItsPki_Functions.hh" - -#include "loggers.hh" - -namespace LibItsPki__Functions { - -} // End of namespace LibItsPki__Functions +/*! + * \file LibItsPki_externals.cc + * \brief Source file for PKI externl functions. + * \author ETSI STF594 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ + +#include "LibItsPki_Functions.hh" + +#include "loggers.hh" + +namespace LibItsPki__Functions { + +} // End of namespace LibItsPki__Functions diff --git a/ccsrc/Externals/LibItsSecurity_externals.cc b/ccsrc/Externals/LibItsSecurity_externals.cc index 8e4cddf..5201f36 100644 --- a/ccsrc/Externals/LibItsSecurity_externals.cc +++ b/ccsrc/Externals/LibItsSecurity_externals.cc @@ -1,1668 +1,2225 @@ -/*! - * \file LibItsSecurity_externals.cc - * \brief Source file for Security externl functions. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#include - -#include "LibItsCommon_Functions.hh" -#include "LibItsSecurity_Functions.hh" - -#include "hmac.hh" -#include "sha256.hh" -#include "sha384.hh" - -#include "security_ecc.hh" - -#include "security_services_its.hh" - -#include "geospacial.hh" - -#include -#include - -#include "loggers.hh" - -#include "params_its.hh" - -namespace LibItsSecurity__Functions { - - static std::unique_ptr g(new geospacial); - - // FIXME Unify code with security_services_its - - /** - * \fn OCTETSTRING fx_hashWithSha256(const OCTETSTRING& p__toBeHashedData); - * \brief Produces a 256-bit (32-bytes) hash value - * \param[in] p__toBeHashedData The data to be used to calculate the hash value - * \return The hash value - */ - OCTETSTRING fx__hashWithSha256(const OCTETSTRING &p__toBeHashedData) { - loggers::get_instance().log_msg(">>> fx__hashWithSha256: p__toBeHashedData= ", p__toBeHashedData); - - sha256 hash; - OCTETSTRING hashData; - hash.generate(p__toBeHashedData, hashData); - loggers::get_instance().log_msg("fx__hashWithSha256: hashData= ", hashData); - return hashData; - } // End of function fx__hashWithSha256 - - /** - * \fn OCTETSTRING fx_hashWithSha384(const OCTETSTRING& p__toBeHashedData); - * \brief Produces a 384-bit (48-bytes) hash value - * \param[in] p__toBeHashedData Data to be used to calculate the hash value - * \return The hash value - */ - OCTETSTRING fx__hashWithSha384(const OCTETSTRING &p__toBeHashedData) { - sha384 hash; - OCTETSTRING hashData; - hash.generate(p__toBeHashedData, hashData); - loggers::get_instance().log_msg("fx__hashWithSha384: hashData= ", hashData); - return hashData; - } // End of function fx__hashWithSha384 - - /** - * \fn OCTETSTRING fx__signWithEcdsaNistp256WithSha256(const OCTETSTRING& p__toBeSignedSecuredMessage, const OCTETSTRING& p__privateKey); - * \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature based on standard IEEE 1609.2 - * \param[in] p__toBeSignedSecuredMessage The data to be signed - * \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate - * \param[in] p__privateKey The private key - * \return The signature value - */ - OCTETSTRING fx__signWithEcdsaNistp256WithSha256(const OCTETSTRING &p__toBeSignedSecuredMessage, const OCTETSTRING &p__certificateIssuer, - const OCTETSTRING &p__privateKey) { - loggers::get_instance().log_msg(">>> fx__signWithEcdsaNistp256WithSha256: data=", p__toBeSignedSecuredMessage); - loggers::get_instance().log_msg(">>> fx__signWithEcdsaNistp256WithSha256: issuer=", p__certificateIssuer); - loggers::get_instance().log_msg(">>> fx__signWithEcdsaNistp256WithSha256: private key=", p__privateKey); - - // Sanity checks - if ((p__certificateIssuer.lengthof() != 32) || (p__privateKey.lengthof() != 32)) { - loggers::get_instance().log("fx__signWithEcdsaNistp256WithSha256: Wrong parameters"); - return OCTETSTRING(0, nullptr); - } - - // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) - sha256 hash; - OCTETSTRING hashData1; // Hash (Data input) - hash.generate(p__toBeSignedSecuredMessage, hashData1); - OCTETSTRING hashData2; // Hash (Signer identifier input) - if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) - hashData2 = p__certificateIssuer; - } else { - hashData2 = hash.get_sha256_empty_string(); // Hash of empty string - } - loggers::get_instance().log_msg("fx__signWithEcdsaNistp256WithSha256: Hash (Data input)=", hashData1); - loggers::get_instance().log_msg("fx__signWithEcdsaNistp256WithSha256: Hash (Signer identifier input)=", hashData2); - hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) - loggers::get_instance().log_msg("fx__signWithEcdsaNistp256WithSha256: Hash (Data input) || Hash (Signer identifier input)=", hashData1); - OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) - hash.generate(hashData1, hashData); - loggers::get_instance().log_msg("fx__signWithEcdsaNistp256WithSha256: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); - // Calculate the signature - security_ecc k(ec_elliptic_curves::nist_p_256, p__privateKey); - OCTETSTRING r_sig; - OCTETSTRING s_sig; - if (k.sign(hashData, r_sig, s_sig) == 0) { - OCTETSTRING os = r_sig + s_sig; - loggers::get_instance().log_msg("r_sig= ", r_sig); - loggers::get_instance().log_msg("s_sig= ", s_sig); - loggers::get_instance().log_msg("sig= ", os); - return os; - } - - return OCTETSTRING(0, nullptr); - } - - /** - * \fn OCTETSTRING fx__signWithEcdsaNistp256WithSha256(const OCTETSTRING& p__toBeSignedSecuredMessage, const OCTETSTRING& p__privateKey); - * \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature based on raw data - * \param[in] p__toBeSignedSecuredMessage The data to be signed - * \param[in] p__privateKey The private key - * \return The signature value - */ - OCTETSTRING fx__test__signWithEcdsaNistp256WithSha256(const OCTETSTRING &p__toBeSignedSecuredMessage, const OCTETSTRING &p__privateKey) { - loggers::get_instance().log_msg(">>> fx__test__signWithEcdsaNistp256WithSha256: data=", p__toBeSignedSecuredMessage); - loggers::get_instance().log_msg(">>> fx__test__signWithEcdsaNistp256WithSha256: private key=", p__privateKey); - - // Sanity checks - if (p__privateKey.lengthof() != 32) { - loggers::get_instance().log("fx__test__signWithEcdsaNistp256WithSha256: Wrong parameters"); - return OCTETSTRING(0, nullptr); - } - - // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) - sha256 hash; - OCTETSTRING hashData1; // Hash (Data input) - hash.generate(p__toBeSignedSecuredMessage, hashData1); - loggers::get_instance().log_msg("fx__test__signWithEcdsaNistp256WithSha256: Hash (Data input)=", hashData1); - // Calculate the signature - security_ecc k(ec_elliptic_curves::nist_p_256, p__privateKey); - OCTETSTRING r_sig; - OCTETSTRING s_sig; - if (k.sign(hashData1, r_sig, s_sig) == 0) { - OCTETSTRING os = r_sig + s_sig; - loggers::get_instance().log_msg("r_sig= ", r_sig); - loggers::get_instance().log_msg("s_sig= ", s_sig); - loggers::get_instance().log_msg("sig= ", os); - return os; - } - - return OCTETSTRING(0, nullptr); - } - - /** - * \fn OCTETSTRING fx__signWithEcdsaBrainpoolp256r1WithSha256(const OCTETSTRING& p__toBeSignedSecuredMessage, const OCTETSTRING& p__privateKey); - * \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature based on standard IEEE 1609.2 - * \param[in] p__toBeSignedSecuredMessage The data to be signed - * \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate - * \param[in] p__privateKey The private key - * \return The signature value - */ - OCTETSTRING fx__signWithEcdsaBrainpoolp256r1WithSha256(const OCTETSTRING &p__toBeSignedSecuredMessage, const OCTETSTRING &p__certificateIssuer, - const OCTETSTRING &p__privateKey) { - loggers::get_instance().log_msg(">>> fx__signWithEcdsaBrainpoolp256r1WithSha256: data=", p__toBeSignedSecuredMessage); - loggers::get_instance().log_msg(">>> fx__signWithEcdsaBrainpoolp256r1WithSha256: issuer=", p__certificateIssuer); - loggers::get_instance().log_msg(">>> fx__signWithEcdsaBrainpoolp256r1WithSha256: private key=", p__privateKey); - - // Sanity checks - if ((p__certificateIssuer.lengthof() != 32) || (p__privateKey.lengthof() != 32)) { - loggers::get_instance().log("fx__signWithEcdsaBrainpoolp256r1WithSha256: Wrong parameters"); - return OCTETSTRING(0, nullptr); - } - - // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) - sha256 hash; - OCTETSTRING hashData1; // Hash (Data input) - hash.generate(p__toBeSignedSecuredMessage, hashData1); - OCTETSTRING hashData2; // Hash (Signer identifier input) - if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) - hashData2 = p__certificateIssuer; - } else { - hashData2 = hash.get_sha256_empty_string(); // Hash of empty string - } - loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp256r1WithSha256: Hash (Data input)=", hashData1); - loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp256r1WithSha256: Hash (Signer identifier input)=", hashData2); - hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) - OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) - hash.generate(hashData1, hashData); - loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp256r1WithSha256: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); - // Calculate the signature - security_ecc k(ec_elliptic_curves::brainpool_p_256_r1, p__privateKey); - OCTETSTRING r_sig; - OCTETSTRING s_sig; - if (k.sign(hashData, r_sig, s_sig) == 0) { - OCTETSTRING os = r_sig + s_sig; - loggers::get_instance().log_msg("r_sig= ", r_sig); - loggers::get_instance().log_msg("s_sig= ", s_sig); - loggers::get_instance().log_msg("sig= ", os); - return os; - } - - return OCTETSTRING(0, nullptr); - } - - /** - * \fn OCTETSTRING fx__signWithEcdsaBrainpoolp384r1WithSha384(const OCTETSTRING& p__toBeSignedSecuredMessage, const OCTETSTRING& p__privateKey); - * \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature based on standard IEEE 1609.2 - * \param[in] p__toBeSignedSecuredMessage The data to be signed - * \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate - * \param[in] p__privateKey The private key - * \return The signature value - */ - OCTETSTRING fx__signWithEcdsaBrainpoolp384r1WithSha384(const OCTETSTRING &p__toBeSignedSecuredMessage, const OCTETSTRING &p__certificateIssuer, - const OCTETSTRING &p__privateKey) { - loggers::get_instance().log_msg(">>> fx__signWithEcdsaBrainpoolp384r1WithSha384: data=", p__toBeSignedSecuredMessage); - loggers::get_instance().log_msg(">>> fx__signWithEcdsaBrainpoolp384r1WithSha384: issuer=", p__certificateIssuer); - loggers::get_instance().log_msg(">>> fx__signWithEcdsaBrainpoolp384r1WithSha384: private key=", p__privateKey); - - // Sanity checks - if ((p__certificateIssuer.lengthof() != 48) || (p__privateKey.lengthof() != 48)) { - loggers::get_instance().log("fx__signWithEcdsaBrainpoolp384r1WithSha384: Wrong parameters"); - return OCTETSTRING(0, nullptr); - } - - // Calculate the SHA384 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) - sha384 hash; - OCTETSTRING hashData1; // Hash (Data input) - hash.generate(p__toBeSignedSecuredMessage, hashData1); - OCTETSTRING hashData2; // Hash (Signer identifier input) - if (p__certificateIssuer != int2oct(0, 48)) { // || Hash (Signer identifier input) - hashData2 = p__certificateIssuer; - } else { - hashData2 = hash.get_sha384_empty_string(); // Hash of empty string - } - loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp384r1WithSha384: Hash (Data input)=", hashData1); - loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp384r1WithSha384: Hash (Signer identifier input)=", hashData2); - hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) - OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) - hash.generate(hashData1, hashData); - loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp384r1WithSha384: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); - // Calculate the signature - security_ecc k(ec_elliptic_curves::brainpool_p_384_r1, p__privateKey); - OCTETSTRING r_sig; - OCTETSTRING s_sig; - if (k.sign(hashData, r_sig, s_sig) == 0) { - OCTETSTRING os = r_sig + s_sig; - loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp384r1WithSha384: r_sig= ", r_sig); - loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp384r1WithSha384: s_sig= ", s_sig); - loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp384r1WithSha384: sig= ", os); - return os; - } - - return OCTETSTRING(0, nullptr); - } - - /** - * \fn OCTETSTRING fx__signWithEcdsaNistp384WithSha384(const OCTETSTRING& p__toBeSignedSecuredMessage, const OCTETSTRING& p__privateKey); - * \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature based on standard IEEE 1609.2 - * \param[in] p__toBeSignedSecuredMessage The data to be signed - * \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate - * \param[in] p__privateKey The private key - * \return The signature value - */ - OCTETSTRING fx__signWithEcdsaNistp384WithSha384(const OCTETSTRING &p__toBeSignedSecuredMessage, const OCTETSTRING &p__certificateIssuer, - const OCTETSTRING &p__privateKey) { - loggers::get_instance().log_msg(">>> fx__signWithEcdsaNistp384WithSha384: data=", p__toBeSignedSecuredMessage); - loggers::get_instance().log_msg(">>> fx__signWithEcdsaNistp384WithSha384: issuer=", p__certificateIssuer); - loggers::get_instance().log_msg(">>> fx__signWithEcdsaNistp384WithSha384: private key=", p__privateKey); - - // Sanity checks - if ((p__certificateIssuer.lengthof() != 48) || (p__privateKey.lengthof() != 48)) { - loggers::get_instance().log("fx__signWithEcdsaNistp384WithSha384: Wrong parameters"); - return OCTETSTRING(0, nullptr); - } - - // Calculate the SHA384 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) - sha384 hash; - OCTETSTRING hashData1; // Hash (Data input) - hash.generate(p__toBeSignedSecuredMessage, hashData1); - OCTETSTRING hashData2; // Hash (Signer identifier input) - if (p__certificateIssuer != int2oct(0, 48)) { // || Hash (Signer identifier input) - hashData2 = p__certificateIssuer; - } else { - hashData2 = hash.get_sha384_empty_string(); // Hash of empty string - } - loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: Hash (Data input)=", hashData1); - loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: Hash (Signer identifier input)=", hashData2); - hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) - OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) - hash.generate(hashData1, hashData); - loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); - // Calculate the signature - security_ecc k(ec_elliptic_curves::nist_p_384, p__privateKey); - OCTETSTRING r_sig; - OCTETSTRING s_sig; - if (k.sign(hashData, r_sig, s_sig) == 0) { - OCTETSTRING os = r_sig + s_sig; - loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: r_sig= ", r_sig); - loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: s_sig= ", s_sig); - loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: sig= ", os); - return os; - } - - return OCTETSTRING(0, nullptr); - } - - /** - * \fn BOOLEAN fx__verifyWithEcdsaNistp256WithSha256(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& - * p__ecdsaNistp256PublicKeyCompressed); \brief Verify the signature of the specified data based on standard IEEE 1609.2 \param[in] p__toBeVerifiedData The - * data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate \param[in] - * p__signature The signature \param[in] p__ecdsaNistp256PublicKeyCompressed The compressed public key (x coordinate only) \return true on success, false - * otherwise - */ - BOOLEAN fx__verifyWithEcdsaNistp256WithSha256(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, - const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaNistp256PublicKeyCompressed, - const INTEGER &p__compressedMode) { - // Sanity checks - if ((p__certificateIssuer.lengthof() != 32) || (p__signature.lengthof() != 64) || (p__ecdsaNistp256PublicKeyCompressed.lengthof() != 32)) { - loggers::get_instance().log("fx__verifyWithEcdsaNistp256WithSha256: Wrong parameters"); - return FALSE; - } - - // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) - sha256 hash; - OCTETSTRING hashData1; // Hash (Data input) - hash.generate(p__toBeVerifiedData, hashData1); - OCTETSTRING hashData2; // Hash (Signer identifier input) - if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) - hashData2 = p__certificateIssuer; - } else { - hashData2 = hash.get_sha256_empty_string(); // Hash of empty string - } - loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp256WithSha256: Hash (Data input)=", hashData1); - loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp256WithSha256: Hash (Signer identifier input)=", hashData2); - hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) - OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) - hash.generate(hashData1, hashData); - loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp256WithSha256: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); - // Check the signature - security_ecc k(ec_elliptic_curves::nist_p_256, p__ecdsaNistp256PublicKeyCompressed, - (p__compressedMode == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); - if (k.sign_verif(hashData, p__signature) == 0) { - return TRUE; - } - - return FALSE; - } - - /** - * \fn BOOLEAN fx__verifyWithEcdsaNistp256WithSha256(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__ecdsaNistp256PublicKeyCompressed); - * \brief Verify the signature of the specified data based on raw data - * \param[in] p__toBeVerifiedData The data to be verified - * \param[in] p__signature The signature - * \param[in] p__ecdsaNistp256PublicKeyCompressed The compressed public key (x coordinate only) - * \return true on success, false otherwise - */ - BOOLEAN fx__test__verifyWithEcdsaNistp256WithSha256(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__signature, - const OCTETSTRING &p__ecdsaNistp256PublicKeyCompressed, const INTEGER &p__compressedMode) { - // Sanity checks - if ((p__signature.lengthof() != 64) || (p__ecdsaNistp256PublicKeyCompressed.lengthof() != 32)) { - loggers::get_instance().log("fx__test__verifyWithEcdsaNistp256WithSha256: Wrong parameters"); - return FALSE; - } - - // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) - sha256 hash; - OCTETSTRING hashData1; // Hash (Data input) - hash.generate(p__toBeVerifiedData, hashData1); - loggers::get_instance().log_msg("fx__test__verifyWithEcdsaNistp256WithSha256: Hash (Data input)=", hashData1); - // Check the signature - security_ecc k(ec_elliptic_curves::nist_p_256, p__ecdsaNistp256PublicKeyCompressed, - (p__compressedMode == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); - if (k.sign_verif(hashData1, p__signature) == 0) { - return TRUE; - } - - return FALSE; - } - - /** - * \fn BOOLEAN fx__verifyWithEcdsaNistp256WithSha256_1(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& - * p__ecdsaNistp256PublicKeyX, const OCTETSTRING& p__ecdsaNistp256PublicKeyY); \brief Verify the signature of the specified data based on standard IEEE 1609.2 - * \param[in] p__toBeVerifiedData The data to be verified - * \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate - * \param[in] p__signature The signature - * \param[in] p__ecdsaNistp256PublicKeyX The public key (x coordinate) - * \param[in] p__ecdsaNistp256PublicKeyY The public key (y coordinate) - * \return true on success, false otherwise - */ - BOOLEAN fx__verifyWithEcdsaNistp256WithSha256__1(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, - const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaNistp256PublicKeyX, - const OCTETSTRING &p__ecdsaNistp256PublicKeyY) { - // Sanity checks - if ((p__certificateIssuer.lengthof() != 32) || (p__signature.lengthof() != 64) || (p__ecdsaNistp256PublicKeyX.lengthof() != 32) || - (p__ecdsaNistp256PublicKeyY.lengthof() != 32)) { - loggers::get_instance().log("fx__verifyWithEcdsaNistp256WithSha256__1: Wrong parameters"); - return FALSE; - } - - // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) - sha256 hash; - OCTETSTRING hashData1; // Hash (Data input) - hash.generate(p__toBeVerifiedData, hashData1); - OCTETSTRING hashData2; // Hash (Signer identifier input) - if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) - hashData2 = p__certificateIssuer; - } else { - hashData2 = hash.get_sha256_empty_string(); // Hash of empty string - } - loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp256WithSha256__1: Hash (Data input)=", hashData1); - loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp256WithSha256__1: Hash (Signer identifier input)=", hashData2); - hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) - OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) - hash.generate(hashData1, hashData); - loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp256WithSha256__1: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); - // Check the signature - security_ecc k(ec_elliptic_curves::nist_p_256, p__ecdsaNistp256PublicKeyX, p__ecdsaNistp256PublicKeyY); - // security_ecc k(ec_elliptic_curves::nist_p_256); - if (k.sign_verif(hashData, p__signature) == 0) { - return TRUE; - } - - return FALSE; - } - - /** - * \fn BOOLEAN fx__verifyWithEcdsaBrainpoolp256r1WithSha256(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& - * p__ecdsaBrainpoolp256PublicKeyCompressed); \brief Verify the signature of the specified data based on standard IEEE 1609.2 \param[in] p__toBeVerifiedData - * The data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate \param[in] - * p__signature The signature \param[in] p__ecdsaBrainpoolp256PublicKeyCompressed The compressed public key (x coordinate only) \return true on success, false - * otherwise - */ - BOOLEAN fx__verifyWithEcdsaBrainpoolp256r1WithSha256(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, - const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaBrainpoolp256PublicKeyCompressed, - const INTEGER &p__compressedMode) { - // Sanity checks - if ((p__certificateIssuer.lengthof() != 32) || (p__signature.lengthof() != 64) || (p__ecdsaBrainpoolp256PublicKeyCompressed.lengthof() != 32)) { - loggers::get_instance().log("fx__verifyWithEcdsaBrainpoolp256r1WithSha256: Wrong parameters"); - return FALSE; - } - - // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) - sha256 hash; - OCTETSTRING hashData1; // Hash (Data input) - hash.generate(p__toBeVerifiedData, hashData1); - OCTETSTRING hashData2; // Hash (Signer identifier input) - if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) - hashData2 = p__certificateIssuer; - } else { - hashData2 = hash.get_sha256_empty_string(); // Hash of empty string - } - loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp256r1WithSha256: Hash (Data input)=", hashData1); - loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp256r1WithSha256: Hash (Signer identifier input)=", hashData2); - hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) - OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) - hash.generate(hashData1, hashData); - loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp256r1WithSha256: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); - // Check the signature - security_ecc k(ec_elliptic_curves::brainpool_p_256_r1, p__ecdsaBrainpoolp256PublicKeyCompressed, - (p__compressedMode == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); - if (k.sign_verif(hashData, p__signature) == 0) { - return TRUE; - } - - return FALSE; - } - - /** - * \fn BOOLEAN fx__verifyWithEcdsaBrainpoolp256r1WithSha256_1(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& - * p__ecdsaBrainpoolp256PublicKeyX, const OCTETSTRING& p__ecdsaBrainpoolp256PublicKeyY); \brief Verify the signature of the specified data based on standard - * IEEE 1609.2 \param[in] p__toBeVerifiedData The data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in - * case of self signed certificate \param[in] p__signature The signature \param[in] p__ecdsaBrainpoolp256PublicKeyX The public key (x coordinate) \param[in] - * p__ecdsaBrainpoolp256PublicKeyY The public key (y coordinate) \return true on success, false otherwise - */ - BOOLEAN fx__verifyWithEcdsaBrainpoolp256r1WithSha256__1(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, - const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaBrainpoolp256PublicKeyX, - const OCTETSTRING &p__ecdsaBrainpoolp256PublicKeyY) { - // Sanity checks - if ((p__certificateIssuer.lengthof() != 32) || (p__signature.lengthof() != 64) || (p__ecdsaBrainpoolp256PublicKeyX.lengthof() != 32) || - (p__ecdsaBrainpoolp256PublicKeyY.lengthof() != 32)) { - loggers::get_instance().log("fx__verifyWithEcdsaBrainpoolp256r1WithSha256__1: Wrong parameters"); - return FALSE; - } - - // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) - sha256 hash; - OCTETSTRING hashData1; // Hash (Data input) - hash.generate(p__toBeVerifiedData, hashData1); - OCTETSTRING hashData2; // Hash (Signer identifier input) - if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) - hashData2 = p__certificateIssuer; - } else { - hashData2 = hash.get_sha256_empty_string(); // Hash of empty string - } - loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp256r1WithSha256__1: Hash (Data input)=", hashData1); - loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp256r1WithSha256__1: Hash (Signer identifier input)=", hashData2); - hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) - OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) - hash.generate(hashData1, hashData); - loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp256r1WithSha256__1: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); - // Check the signature - security_ecc k(ec_elliptic_curves::brainpool_p_256_r1, p__ecdsaBrainpoolp256PublicKeyX, p__ecdsaBrainpoolp256PublicKeyY); - if (k.sign_verif(hashData, p__signature) == 0) { - return TRUE; - } - - return FALSE; - } - - /** - * \fn BOOLEAN fx__verifyWithEcdsaBrainpoolp384r1WithSha384(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& - * p__ecdsaBrainpoolp384PublicKeyCompressed); \brief Verify the signature of the specified data based on standard IEEE 1609.2 \param[in] p__toBeVerifiedData - * The data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate \param[in] - * p__signature The signature \param[in] p__ecdsaBrainpoolp384PublicKeyCompressed The compressed public key (x coordinate only) \return true on success, false - * otherwise - */ - BOOLEAN fx__verifyWithEcdsaBrainpoolp384r1WithSha384(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, - const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaBrainpoolp384PublicKeyCompressed, - const INTEGER &p__compressedMode) { - // Sanity checks - if ((p__certificateIssuer.lengthof() != 48) || (p__signature.lengthof() != 96) || (p__ecdsaBrainpoolp384PublicKeyCompressed.lengthof() != 48)) { - loggers::get_instance().log("fx__verifyWithEcdsaBrainpoolp384r1WithSha384: Wrong parameters"); - return FALSE; - } - - // Calculate the SHA384 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) - sha384 hash; - OCTETSTRING hashData1; // Hash (Data input) - hash.generate(p__toBeVerifiedData, hashData1); - OCTETSTRING hashData2; // Hash (Signer identifier input) - if (p__certificateIssuer != int2oct(0, 48)) { // || Hash (Signer identifier input) - hashData2 = p__certificateIssuer; - } else { - hashData2 = hash.get_sha384_empty_string(); // Hash of empty string - } - loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp384r1WithSha384: Hash (Data input)=", hashData1); - loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp384r1WithSha384: Hash (Signer identifier input)=", hashData2); - hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) - OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) - hash.generate(hashData1, hashData); - loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp384r1WithSha384: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); - // Check the signature - security_ecc k(ec_elliptic_curves::brainpool_p_384_r1, p__ecdsaBrainpoolp384PublicKeyCompressed, - (p__compressedMode == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); - if (k.sign_verif(hashData, p__signature) == 0) { - return TRUE; - } - - return FALSE; - } - - /** - * \fn BOOLEAN fx__verifyWithEcdsaBrainpoolp384r1WithSha384_1(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& - * p__ecdsaBrainpoolp384PublicKeyX, const OCTETSTRING& p__ecdsaBrainpoolp384PublicKeyY); \brief Verify the signature of the specified data based on standard - * IEEE 1609.2 \param[in] p__toBeVerifiedData The data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in - * case of self signed certificate \param[in] p__signature The signature \param[in] p__ecdsaBrainpoolp384PublicKeyX The public key (x coordinate) \param[in] - * p__ecdsaBrainpoolp384PublicKeyY The public key (y coordinate) \return true on success, false otherwise - */ - BOOLEAN fx__verifyWithEcdsaBrainpoolp384r1WithSha384__1(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, - const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaBrainpoolp384PublicKeyX, - const OCTETSTRING &p__ecdsaBrainpoolp384PublicKeyY) { - // Sanity checks - if ((p__certificateIssuer.lengthof() != 48) || (p__signature.lengthof() != 96) || (p__ecdsaBrainpoolp384PublicKeyX.lengthof() != 48) || - (p__ecdsaBrainpoolp384PublicKeyY.lengthof() != 48)) { - loggers::get_instance().log("fx__verifyWithEcdsaBrainpoolp384r1WithSha384__1: Wrong parameters"); - return FALSE; - } - - // Calculate the SHA384 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) - sha384 hash; - OCTETSTRING hashData1; // Hash (Data input) - hash.generate(p__toBeVerifiedData, hashData1); - OCTETSTRING hashData2; // Hash (Signer identifier input) - if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) - hashData2 = p__certificateIssuer; - } else { - hashData2 = hash.get_sha384_empty_string(); // Hash of empty string - } - loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp384r1WithSha384: Hash (Data input)=", hashData1); - loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp384r1WithSha384: Hash (Signer identifier input)=", hashData2); - hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) - OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) - hash.generate(hashData1, hashData); - loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp384r1WithSha384: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); - // Check the signature - security_ecc k(ec_elliptic_curves::brainpool_p_384_r1, p__ecdsaBrainpoolp384PublicKeyX, p__ecdsaBrainpoolp384PublicKeyY); - if (k.sign_verif(hashData, p__signature) == 0) { - return TRUE; - } - - return FALSE; - } - - /** - * \fn BOOLEAN fx__verifyWithEcdsaNistp384WithSha384(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& - * p__ecdsaBrainpoolp384PublicKeyCompressed); \brief Verify the signature of the specified data based on standard IEEE 1609.2 \param[in] p__toBeVerifiedData - * The data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate \param[in] - * p__signature The signature \param[in] p__ecdsaBrainpoolp384PublicKeyCompressed The compressed public key (x coordinate only) \return true on success, false - * otherwise - */ - BOOLEAN fx__verifyWithEcdsaNistp384WithSha384(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, - const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaNistp384PublicKeyCompressed, - const INTEGER &p__compressedMode) { - // Sanity checks - if ((p__certificateIssuer.lengthof() != 48) || (p__signature.lengthof() != 96) || (p__ecdsaNistp384PublicKeyCompressed.lengthof() != 48)) { - loggers::get_instance().log("fx__verifyWithEcdsaNistp384WithSha384: Wrong parameters"); - return FALSE; - } - - // Calculate the SHA384 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) - sha384 hash; - OCTETSTRING hashData1; // Hash (Data input) - hash.generate(p__toBeVerifiedData, hashData1); - OCTETSTRING hashData2; // Hash (Signer identifier input) - if (p__certificateIssuer != int2oct(0, 48)) { // || Hash (Signer identifier input) - hashData2 = p__certificateIssuer; - } else { - hashData2 = hash.get_sha384_empty_string(); // Hash of empty string - } - loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384: Hash (Data input)=", hashData1); - loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384: Hash (Signer identifier input)=", hashData2); - hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) - OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) - hash.generate(hashData1, hashData); - loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); - // Check the signature - security_ecc k(ec_elliptic_curves::nist_p_384, p__ecdsaNistp384PublicKeyCompressed, - (p__compressedMode == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); - if (k.sign_verif(hashData, p__signature) == 0) { - return TRUE; - } - - return FALSE; - } - - /** - * \fn BOOLEAN fx__verifyWithEcdsaBrainpoolp384r1WithSha384_1(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& - * p__ecdsaBrainpoolp384PublicKeyX, const OCTETSTRING& p__ecdsaBrainpoolp384PublicKeyY); \brief Verify the signature of the specified data based on standard - * IEEE 1609.2 \param[in] p__toBeVerifiedData The data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in - * case of self signed certificate \param[in] p__signature The signature \param[in] p__ecdsaBrainpoolp384PublicKeyX The public key (x coordinate) \param[in] - * p__ecdsaBrainpoolp384PublicKeyY The public key (y coordinate) \return true on success, false otherwise - */ - BOOLEAN fx__verifyWithEcdsaNistp384WithSha384__1(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, - const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaNistp384PublicKeyX, - const OCTETSTRING &p__ecdsaNistp384PublicKeyY) { - // Sanity checks - if ((p__certificateIssuer.lengthof() != 48) || (p__signature.lengthof() != 96) || (p__ecdsaNistp384PublicKeyX.lengthof() != 48) || - (p__ecdsaNistp384PublicKeyY.lengthof() != 48)) { - loggers::get_instance().log("fx__verifyWithEcdsaNistp384WithSha384__1: Wrong parameters"); - return FALSE; - } - - // Calculate the SHA384 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) - sha384 hash; - OCTETSTRING hashData1; // Hash (Data input) - hash.generate(p__toBeVerifiedData, hashData1); - OCTETSTRING hashData2; // Hash (Signer identifier input) - if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) - hashData2 = p__certificateIssuer; - } else { - hashData2 = hash.get_sha384_empty_string(); // Hash of empty string - } - loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384__1: Hash (Data input)=", hashData1); - loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384__1: Hash (Signer identifier input)=", hashData2); - hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) - OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) - hash.generate(hashData1, hashData); - loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384__1: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); - // Check the signature - security_ecc k(ec_elliptic_curves::nist_p_384, p__ecdsaNistp384PublicKeyX, p__ecdsaNistp384PublicKeyY); - if (k.sign_verif(hashData, p__signature) == 0) { - return TRUE; - } - - return FALSE; - } - - /** - * \fn OCTETSTRING fx__hmac__sha256(const OCTETSTRING& p__k, const OCTETSTRING& p__m); - * \brief Generate a HMAC-SHA256 value based on the provided secret key - * \param[in] p__k The secret key used for the HMAC calculation - * \param[in] p__m The message - * \return The HMAC value resized to 16-byte - */ - OCTETSTRING fx__hmac__sha256(const OCTETSTRING &p__k, const OCTETSTRING &p__m) { - loggers::get_instance().log_msg(">>> fx__hmac__sha256: p__k=", p__k); - loggers::get_instance().log_msg(">>> fx__hmac__sha256: p__m=", p__m); - - hmac h(hash_algorithms::sha_256); // TODO Use ec_encryption_algorithm - OCTETSTRING t; - if (h.generate(p__m, p__k, t) == -1) { - loggers::get_instance().warning("fx__hmac__sha256: Failed to generate HMAC"); - return OCTETSTRING(0, nullptr); - } - - loggers::get_instance().log_msg("<<< fx__hmac__sha256: HMAC: ", t); - return t; - } - - /** - * \fn OCTETSTRING fx__encrypt__aes__128__ccm__test(const OCTETSTRING& p__k, const OCTETSTRING& p__n, const OCTETSTRING& p__pt); - * \brief Encrypt the message using AES 128 CCM algorithm - * \param[in] p__k The symmetric encryption key - * \param[in] p__n The initial vector, nonce vector - * \param[in] p__pt The message to encrypt - * \return The encrypted message concatenated to the AES 128 CCM tag - */ - OCTETSTRING fx__encrypt__aes__128__ccm__test(const OCTETSTRING &p__k, const OCTETSTRING &p__n, const OCTETSTRING &p__pt) { - loggers::get_instance().log(">>> fx__encrypt__aes__128__ccm__test"); - - security_ecc ec(ec_elliptic_curves::nist_p_256); - OCTETSTRING enc_message; - if (ec.encrypt(encryption_algotithm::aes_128_ccm, p__k, p__n, p__pt, enc_message) == -1) { - loggers::get_instance().warning("fx__encrypt__aes__128__ccm__test: Failed to encrypt message"); - return OCTETSTRING(0, nullptr); - } - OCTETSTRING os(enc_message + ec.tag()); - loggers::get_instance().log_msg("fx__encrypt__aes__128__ccm__test: encrypted message: ", os); - - return os; - } - - /** - * \fn OCTETSTRING fx__encrypt__aes__128__gcm__test(const OCTETSTRING& p__k, const OCTETSTRING& p__n, const OCTETSTRING& p__pt); - * \brief Encrypt the message using AES 128 GCM algorithm - * \param[in] p__k The symmetric encryption key - * \param[in] p__n The initial vector, nonce vector - * \param[in] p__pt The message to encrypt - * \return The encrypted message concatenated to the AES 128 CCM tag - */ - OCTETSTRING fx__encrypt__aes__128__gcm__test(const OCTETSTRING &p__k, const OCTETSTRING &p__n, const OCTETSTRING &p__pt) { - loggers::get_instance().log(">>> fx__encrypt__aes__128__gcm__test"); - - security_ecc ec(ec_elliptic_curves::nist_p_256); - OCTETSTRING enc_message; - if (ec.encrypt(encryption_algotithm::aes_128_gcm, p__k, p__n, p__pt, enc_message) == -1) { - loggers::get_instance().warning("fx__encrypt__aes__128__gcm__test: Failed to encrypt message"); - return OCTETSTRING(0, nullptr); - } - OCTETSTRING os(enc_message + ec.tag()); - loggers::get_instance().log_msg("fx__encrypt__aes__128__gcm__test: encrypted message: ", os); - - return os; - } - - /** - * \fn OCTETSTRING fx__decrypt__aes__128__ccm__test(const OCTETSTRING& p__k, const OCTETSTRING& p__n, const OCTETSTRING& p__ct); - * \brief Encrypt the message using AES 128 CCM algorithm - * \param[in] p__k The symmetric encryption key - * \param[in] p__n The initial vector, nonce vector - * \param[in] p__ct The encrypted message concatenated to the AES 128 CCM tag - * \return The original message - */ - OCTETSTRING fx__decrypt__aes__128__ccm__test(const OCTETSTRING &p__k, const OCTETSTRING &p__n, const OCTETSTRING &p__ct) { - loggers::get_instance().log_msg(">>> fx__decrypt__aes__128__ccm__test: p__k: ", p__k); - loggers::get_instance().log_msg(">>> fx__decrypt__aes__128__ccm__test: p__n: ", p__n); - loggers::get_instance().log_msg(">>> fx__decrypt__aes__128__ccm__test: p__ct: ", p__ct); - - security_ecc ec(ec_elliptic_curves::nist_p_256); - // Extract the tag - OCTETSTRING tag(16, p__ct.lengthof() - 16 + static_cast(p__ct)); - loggers::get_instance().log_msg("fx__decrypt__aes__128__ccm__test: tag: ", tag); - // Remove the tag from the end of the encrypted message - OCTETSTRING ct(p__ct.lengthof() - 16, static_cast(p__ct)); - loggers::get_instance().log_msg("fx__decrypt__aes__128__ccm__test: ct: ", ct); - - OCTETSTRING message; - if (ec.decrypt(encryption_algotithm::aes_128_ccm, p__k, p__n, tag, ct, message) == -1) { - loggers::get_instance().warning("fx__decrypt__aes__128__ccm__test: Failed to decrypt message"); - return OCTETSTRING(0, nullptr); - } - loggers::get_instance().log_to_hexa("fx__decrypt__aes__128__ccm__test: decrypted message: ", message); - - return message; - } - - /** - * \fn OCTETSTRING fx__encryptWithEciesNistp256WithSha256(const OCTETSTRING& p__toBeEncryptedSecuredMessage, const OCTETSTRING& p__recipientsPublicKeyX, const - * OCTETSTRING& p__recipientsPublicKeyY, OCTETSTRING& p__publicEphemeralKeyX, OCTETSTRING& p__publicEphemeralKeyY, OCTETSTRING& p__encrypted__sym__key, - * OCTETSTRING& p__authentication__vector, OCTETSTRING& p__nonce); \brief Encrypt the message using ECIES algorithm to encrypt AES 128 CCM symmetric key, as - * defined in IEEE Std 1609.2-2017 \param[in] p__toBeEncryptedSecuredMessage The message to be encrypted \param[in] p__recipientsPublicKeyCompressed The - * Recipient's compressed public key \param[in] p__compressedMode The compressed mode, 0 if the latest bit of Y-coordinate is 0, 1 otherwise \param[out] - * p__publicEphemeralKeyCompressed The public ephemeral compressed key \param[out] p__ephemeralCompressedMode The compressed mode, 0 if the latest bit of - * Y-coordinate is 0, 1 otherwise \param[out] p__encrypted__sym__key The encrypted AES 128 symmetric key \param[out] p__authentication__vector The tag of the - * encrypted AES 128 symmetric key \param[out] p__nonce The nonce vector \return The original message \see IEEE Std 1609.2-2017 Clause 5.3.5 Public key - * encryption algorithms: ECIES \see https://www.nominet.uk/researchblog/how-elliptic-curve-cryptography-encryption-works/ \see - * http://digital.csic.es/bitstream/10261/32671/1/V2-I2-P7-13.pdf - */ - // TODO Use common function for both fx__encryptWithEciesxxx and fx__decryptWithEciesxxx function - OCTETSTRING fx__encryptWithEciesNistp256WithSha256(const OCTETSTRING &p__toBeEncryptedSecuredMessage, const OCTETSTRING &p__recipientsPublicKeyCompressed, - const INTEGER &p__compressedMode, const OCTETSTRING &p__salt, OCTETSTRING &p__publicEphemeralKeyCompressed, - INTEGER &p__ephemeralCompressedMode, OCTETSTRING &p__aes__sym__key, OCTETSTRING &p__encrypted__sym__key, - OCTETSTRING &p__authentication__vector, OCTETSTRING &p__nonce) { - loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: p__toBeEncryptedSecuredMessage: ", p__toBeEncryptedSecuredMessage); - loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: p__recipientsPublicKeyCompressed: ", p__recipientsPublicKeyCompressed); - loggers::get_instance().log(">>> fx__encryptWithEciesNistp256WithSha256: p__compressedMode: %d", static_cast(p__compressedMode)); - loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: p__salt: ", p__salt); - - // 1. Generate new Private/Public Ephemeral key - std::unique_ptr ec; - ec.reset(new security_ecc(ec_elliptic_curves::nist_p_256)); - if (ec->generate() == -1) { - loggers::get_instance().warning("fx__encryptWithEciesNistp256WithSha256: Failed to generate ephemeral keys"); - return OCTETSTRING(0, nullptr); - } - // 2. Generate and derive shared secret based on recipient's private keys - security_ecc ec_comp(ec_elliptic_curves::nist_p_256, p__recipientsPublicKeyCompressed, - (static_cast(p__compressedMode) == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); - if (ec->generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__salt) == -1) { - loggers::get_instance().warning("fx__encryptWithEciesNistp256WithSha256: Failed to generate and derive secret key"); - return OCTETSTRING(0, nullptr); - } - - // Set the AES symmetric key - loggers::get_instance().log_msg("fx__encryptWithEciesNistp256WithSha256: AES symmetric key: ", ec->symmetric_encryption_key()); - p__aes__sym__key = ec->symmetric_encryption_key(); - loggers::get_instance().log_msg("fx__encryptWithEciesNistp256WithSha256: p__aes__sym__key: ", p__aes__sym__key); - // Set the encrypted symmetric key - loggers::get_instance().log_msg("fx__encryptWithEciesNistp256WithSha256: Encrypted symmetric key: ", ec->encrypted_symmetric_key()); - p__encrypted__sym__key = ec->encrypted_symmetric_key(); - loggers::get_instance().log_msg("fx__encryptWithEciesNistp256WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key); - // Set the tag of the symmetric key encryption - p__authentication__vector = ec->tag(); - loggers::get_instance().log_msg("fx__encryptWithEciesNistp256WithSha256: p__authentication__vector: ", p__authentication__vector); - // Set ephemeral public keys - p__publicEphemeralKeyCompressed = ec->public_key_compressed(); - loggers::get_instance().log_msg("fx__encryptWithEciesNistp256WithSha256: Ephemeral public compressed key: ", p__publicEphemeralKeyCompressed); - p__ephemeralCompressedMode = (ec->public_key_compressed_mode() == ecc_compressed_mode::compressed_y_0) ? 0 : 1; - loggers::get_instance().log("fx__encryptWithEciesNistp256WithSha256: Ephemeral public compressed mode: %d: ", (int)p__ephemeralCompressedMode); - // 3. Retrieve AES 128 parameters - p__nonce = ec->nonce(); - loggers::get_instance().log_msg("fx__encryptWithEciesNistp256WithSha256: p__nonce: ", p__nonce); - // 4. Encrypt the data using AES-128 CCM - OCTETSTRING enc_message; - if (ec->encrypt(encryption_algotithm::aes_128_ccm, ec->symmetric_encryption_key(), ec->nonce(), p__toBeEncryptedSecuredMessage, enc_message) == -1) { - loggers::get_instance().warning("fx__encryptWithEciesNistp256WithSha256: Failed to encrypt message"); - return OCTETSTRING(0, nullptr); - } - enc_message += ec->tag(); - loggers::get_instance().log_to_hexa("fx__encryptWithEciesNistp256WithSha256: enc message||Tag: ", enc_message); - - return enc_message; - } - - /** - * @desc Test function for ECIES NIST P-256 Encryption with SHA-256 - * @remark For the purpose of testing, the content of p__toBeEncryptedSecuredMessage is the AES 128 symmetric key to be encrypted - */ - OCTETSTRING fx__test__encryptWithEciesNistp256WithSha256(const OCTETSTRING &p__toBeEncryptedSecuredMessage, const OCTETSTRING &p__privateEphemeralKey, - const OCTETSTRING &p__recipientPublicKeyX, const OCTETSTRING &p__recipientPublicKeyY, - const OCTETSTRING &p__salt, OCTETSTRING &p__publicEphemeralKeyX, OCTETSTRING &p__publicEphemeralKeyY, - OCTETSTRING &p__aes__sym__key, OCTETSTRING &p__encrypted__sym__key, - OCTETSTRING &p__authentication__vector, OCTETSTRING &p__nonce) { - - // 1. Generate new ephemeral Private/Public keys - security_ecc ec(ec_elliptic_curves::nist_p_256, p__privateEphemeralKey); - p__publicEphemeralKeyX = ec.public_key_x(); - p__publicEphemeralKeyY = ec.public_key_y(); - loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: Vx=", p__publicEphemeralKeyX); - loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: Vy=", p__publicEphemeralKeyY); - - // 2. Generate and derive shared secret - security_ecc ec_comp(ec_elliptic_curves::nist_p_256, p__recipientPublicKeyX, p__recipientPublicKeyY); - ec.symmetric_encryption_key(p__toBeEncryptedSecuredMessage); - loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: ", ec.encrypted_symmetric_key()); - if (ec.generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__salt) == -1) { - loggers::get_instance().warning("fx__test__encryptWithEciesNistp256WithSha256: Failed to generate and derive secret key"); - return OCTETSTRING(0, nullptr); - } - - // Set the AES symmetric key - loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: AES symmetric key: ", ec.symmetric_encryption_key()); - p__aes__sym__key = ec.symmetric_encryption_key(); - loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: p__aes__sym__key: ", p__aes__sym__key); - // Set the encrypted symmetric key - loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: Encrypted symmetric key: ", ec.encrypted_symmetric_key()); - p__encrypted__sym__key = ec.encrypted_symmetric_key(); - loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key); - // Set the tag of the symmetric key encryption - p__authentication__vector = ec.tag(); - loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: p__authentication__vector: ", p__authentication__vector); - // 3. Retrieve AES 128 parameters - p__nonce = ec.nonce(); - loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: p__nonce: ", p__nonce); - // 4. Encrypt the data using AES-128 CCM - OCTETSTRING enc_message; - if (ec.encrypt(encryption_algotithm::aes_128_ccm, ec.symmetric_encryption_key(), ec.nonce(), p__toBeEncryptedSecuredMessage, enc_message) == -1) { - loggers::get_instance().warning("fx__test__encryptWithEciesNistp256WithSha256: Failed to encrypt message"); - return OCTETSTRING(0, nullptr); - } - enc_message += ec.tag(); - loggers::get_instance().log_to_hexa("fx__test__encryptWithEciesNistp256WithSha256: enc message||Tag: ", enc_message); - - return enc_message; - } - - /** - * \fn OCTETSTRING fx__decryptWithEciesNistp256WithSha256(const OCTETSTRING& p__encryptedSecuredMessage, const OCTETSTRING& p__privateEncKey, const - * OCTETSTRING& p__publicEphemeralKeyX, const OCTETSTRING& p__publicEphemeralKeyY, const OCTETSTRING& p__encrypted__sym__key, const OCTETSTRING& - * p__authentication__vector, const OCTETSTRING& p__nonce); \brief Decrypt the message using ECIES algorithm to decrypt AES 128 CCM symmetric key, as defined - * in IEEE Std 1609.2-2017 \param[in] p__encryptedSecuredMessage The encrypted message \param[in] p__privateEncKey The private encryption key \param[in] - * p__publicEphemeralKeyCompressed The public ephemeral compressed key \param[in] p__ephemeralCompressedMode The compressed mode, 0 if the latest bit of - * Y-coordinate is 0, 1 otherwise \param[in] p__encrypted__sym__key The encrypted AES 128 symmetric key \param[in] p__authentication__vector The tag of the - * encrypted AES 128 symmetric key \param[in] p__nonce The nonce vector \return The original message \see IEEE Std 1609.2-2017 Clause 5.3.5 Public key - * encryption algorithms: ECIES \see https://www.nominet.uk/researchblog/how-elliptic-curve-cryptography-encryption-works/ \see - * http://digital.csic.es/bitstream/10261/32671/1/V2-I2-P7-13.pdf - */ - // TODO Use common function for both fx__encryptWithEciesxxx and fx__decryptWithEciesxxx function - OCTETSTRING fx__decryptWithEciesNistp256WithSha256(const OCTETSTRING &p__encryptedSecuredMessage, const OCTETSTRING &p__privateEncKey, - const OCTETSTRING &p__publicEphemeralKeyCompressed, const INTEGER &p__ephemeralCompressedMode, - const OCTETSTRING &p__encrypted__sym__key, const OCTETSTRING &p__authentication__vector, - const OCTETSTRING &p__nonce, const OCTETSTRING &p__salt, OCTETSTRING &p__aes__sym__enc__key) { - loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__toBeEncryptedSecuredMessage: ", p__encryptedSecuredMessage); - loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__privateEncKey: ", p__privateEncKey); - loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__publicEphemeralKeyCompressed: ", p__publicEphemeralKeyCompressed); - loggers::get_instance().log(">>> fx__decryptWithEciesNistp256WithSha256: p__ephemeralCompressedMode: %d", static_cast(p__ephemeralCompressedMode)); - loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__nonce: ", p__nonce); - loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__authentication__vector: ", p__authentication__vector); - loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key); - loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__salt", p__salt); - - // 1. Create security_ecc instance based on recipient's private key - security_ecc ec(ec_elliptic_curves::nist_p_256, p__privateEncKey); - security_ecc ec_comp(ec_elliptic_curves::nist_p_256, p__publicEphemeralKeyCompressed, - (static_cast(p__ephemeralCompressedMode) == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); - - // 2. Generate the shared secret value based on public ephemeral keys will be required - if (ec.generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__encrypted__sym__key, - p__nonce, p__authentication__vector, p__salt) == -1) { - loggers::get_instance().warning("fx__decryptWithEciesNistp256WithSha256: Failed to generate shared secret"); - return OCTETSTRING(0, nullptr); - } - - // Decrypt the message - OCTETSTRING enc_message(p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof(), - static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message - loggers::get_instance().log_msg("fx__decryptWithEciesNistp256WithSha256: enc_message: ", enc_message); // Extract the ctag value - OCTETSTRING tag(ec.tag().lengthof(), - static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); - loggers::get_instance().log_msg("fx__decryptWithEciesNistp256WithSha256: tag: ", tag); - OCTETSTRING message; - if (ec.decrypt(tag, enc_message, message) == -1) { - loggers::get_instance().warning("fx__decryptWithEciesNistp256WithSha256: Failed to generate shared secret"); - return OCTETSTRING(0, nullptr); - } - loggers::get_instance().log_msg("fx__decryptWithEciesNistp256WithSha256: dec message: ", message); - p__aes__sym__enc__key = ec.symmetric_encryption_key(); - loggers::get_instance().log_msg("fx__decryptWithEciesNistp256WithSha256: AES 128 encryption key: ", p__aes__sym__enc__key); - - return message; - } - - OCTETSTRING fx__encryptWithEciesBrainpoolp256r1WithSha256(const OCTETSTRING &p__toBeEncryptedSecuredMessage, - const OCTETSTRING &p__recipientsPublicKeyCompressed, const INTEGER &p__compressedMode, - const OCTETSTRING &p__salt, OCTETSTRING &p__publicEphemeralKeyCompressed, - INTEGER &p__ephemeralCompressedMode, OCTETSTRING &p__aes__sym__key, - OCTETSTRING &p__encrypted__sym__key, OCTETSTRING &p__authentication__vector, - OCTETSTRING &p__nonce) { - loggers::get_instance().log_msg(">>> fx__encryptWithEciesBrainpoolp256r1WithSha256: p__toBeEncryptedSecuredMessage: ", p__toBeEncryptedSecuredMessage); - loggers::get_instance().log_msg(">>> fx__encryptWithEciesBrainpoolp256r1WithSha256: p__recipientsPublicKeyCompressed: ", p__recipientsPublicKeyCompressed); - loggers::get_instance().log(">>> fx__encryptWithEciesBrainpoolp256r1WithSha256: p__compressedMode: %d", static_cast(p__compressedMode)); - loggers::get_instance().log_msg(">>> fx__encryptWithEciesBrainpoolp256r1WithSha256: p__salt: ", p__salt); - - // 1. Generate new Private/Public Ephemeral key - std::unique_ptr ec; - ec.reset(new security_ecc(ec_elliptic_curves::brainpool_p_256_r1)); - if (ec->generate() == -1) { - loggers::get_instance().warning("fx__encryptWithEciesBrainpoolp256r1WithSha256: Failed to generate ephemeral keys"); - return OCTETSTRING(0, nullptr); - } - // 2. Generate and derive shared secret based on recipient's private keys - security_ecc ec_comp(ec_elliptic_curves::brainpool_p_256_r1, p__recipientsPublicKeyCompressed, - (static_cast(p__compressedMode) == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); - if (ec->generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__salt) == -1) { - loggers::get_instance().warning("fx__encryptWithEciesBrainpoolp256r1WithSha256: Failed to generate and derive secret key"); - return OCTETSTRING(0, nullptr); - } - - // Set the AES symmetric key - loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256r1WithSha256: AES symmetric key: ", ec->symmetric_encryption_key()); - p__aes__sym__key = ec->symmetric_encryption_key(); - loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256r1WithSha256: p__aes__sym__key: ", p__aes__sym__key); - // Set the encrypted symmetric key - loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256r1WithSha256: Encrypted symmetric key: ", ec->encrypted_symmetric_key()); - p__encrypted__sym__key = ec->encrypted_symmetric_key(); - loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256r1WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key); - // Set the tag of the symmetric key encryption - p__authentication__vector = ec->tag(); - loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256r1WithSha256: p__authentication__vector: ", p__authentication__vector); - // Set ephemeral public keys - p__publicEphemeralKeyCompressed = ec->public_key_compressed(); - loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256r1WithSha256: Ephemeral public compressed key: ", p__publicEphemeralKeyCompressed); - p__ephemeralCompressedMode = (ec->public_key_compressed_mode() == ecc_compressed_mode::compressed_y_0) ? 0 : 1; - loggers::get_instance().log("fx__encryptWithEciesBrainpoolp256r1WithSha256: Ephemeral public compressed mode: %d: ", (int)p__ephemeralCompressedMode); - // 3. Retrieve AES 128 parameters - p__nonce = ec->nonce(); - loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256r1WithSha256: p__nonce: ", p__nonce); - // 4. Encrypt the data using AES-128 CCM - OCTETSTRING enc_message; - if (ec->encrypt(encryption_algotithm::aes_128_ccm, ec->symmetric_encryption_key(), ec->nonce(), p__toBeEncryptedSecuredMessage, enc_message) == -1) { - loggers::get_instance().warning("fx__encryptWithEciesBrainpoolp256r1WithSha256: Failed to encrypt message"); - return OCTETSTRING(0, nullptr); - } - enc_message += ec->tag(); - loggers::get_instance().log_to_hexa("fx__encryptWithEciesBrainpoolp256r1WithSha256: enc message||Tag: ", enc_message); - - return enc_message; - } - - /** - * @desc Test function for ECIES BRAINPOOL P-256r1 Encryption with SHA-256 - * @remark For the purpose of testing, the content of p__toBeEncryptedSecuredMessage is the AES 128 symmetric key to be encrypted - */ - OCTETSTRING fx__test__encryptWithEciesBrainpoolp256r1WithSha256(const OCTETSTRING &p__toBeEncryptedSecuredMessage, const OCTETSTRING &p__privateEphemeralKey, - const OCTETSTRING &p__recipientPublicKeyX, const OCTETSTRING &p__recipientPublicKeyY, - const OCTETSTRING &p__salt, OCTETSTRING &p__publicEphemeralKeyX, - OCTETSTRING &p__publicEphemeralKeyY, OCTETSTRING &p__aes__sym__key, - OCTETSTRING &p__encrypted__sym__key, OCTETSTRING &p__authentication__vector, - OCTETSTRING &p__nonce) { - - // 1. Generate new ephemeral Private/Public keys - security_ecc ec(ec_elliptic_curves::brainpool_p_256_r1, p__privateEphemeralKey); - p__publicEphemeralKeyX = ec.public_key_x(); - p__publicEphemeralKeyY = ec.public_key_y(); - loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: Vx=", p__publicEphemeralKeyX); - loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: Vy=", p__publicEphemeralKeyY); - - // 2. Generate and derive shared secret - security_ecc ec_comp(ec_elliptic_curves::brainpool_p_256_r1, p__recipientPublicKeyX, p__recipientPublicKeyY); - ec.symmetric_encryption_key(p__toBeEncryptedSecuredMessage); - loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: ", ec.encrypted_symmetric_key()); - if (ec.generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__salt) == -1) { - loggers::get_instance().warning("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: Failed to generate and derive secret key"); - return OCTETSTRING(0, nullptr); - } - - // Set the AES symmetric key - loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: AES symmetric key: ", ec.symmetric_encryption_key()); - p__aes__sym__key = ec.symmetric_encryption_key(); - loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: p__aes__sym__key: ", p__aes__sym__key); - // Set the encrypted symmetric key - loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: Encrypted symmetric key: ", ec.encrypted_symmetric_key()); - p__encrypted__sym__key = ec.encrypted_symmetric_key(); - loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key); - // Set the tag of the symmetric key encryption - p__authentication__vector = ec.tag(); - loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: p__authentication__vector: ", p__authentication__vector); - // 3. Retrieve AES 128 parameters - p__nonce = ec.nonce(); - loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: p__nonce: ", p__nonce); - // 4. Encrypt the data using AES-128 CCM - OCTETSTRING enc_message; - if (ec.encrypt(encryption_algotithm::aes_128_ccm, ec.symmetric_encryption_key(), ec.nonce(), p__toBeEncryptedSecuredMessage, enc_message) == -1) { - loggers::get_instance().warning("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: Failed to encrypt message"); - return OCTETSTRING(0, nullptr); - } - enc_message += ec.tag(); - loggers::get_instance().log_to_hexa("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: enc message||Tag: ", enc_message); - - return enc_message; - } - - OCTETSTRING fx__decryptWithEciesBrainpoolp256r1WithSha256(const OCTETSTRING &p__encryptedSecuredMessage, const OCTETSTRING &p__privateEncKey, - const OCTETSTRING &p__publicEphemeralKeyCompressed, const INTEGER &p__ephemeralCompressedMode, - const OCTETSTRING &p__encrypted__sym__key, const OCTETSTRING &p__authentication__vector, - const OCTETSTRING &p__nonce, const OCTETSTRING &p__salt, OCTETSTRING &p__aes__sym__enc__key) { - loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__toBeEncryptedSecuredMessage: ", p__encryptedSecuredMessage); - loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__privateEncKey: ", p__privateEncKey); - loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__publicEphemeralKeyCompressed: ", p__publicEphemeralKeyCompressed); - loggers::get_instance().log(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__ephemeralCompressedMode: %d", - static_cast(p__ephemeralCompressedMode)); - loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__nonce: ", p__nonce); - loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__authentication__vector: ", p__authentication__vector); - loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key); - loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__salt", p__salt); - - // 1. Create security_ecc instance based on public ephemeral keys - security_ecc ec(ec_elliptic_curves::brainpool_p_256_r1, p__privateEncKey); - security_ecc ec_comp(ec_elliptic_curves::brainpool_p_256_r1, p__publicEphemeralKeyCompressed, - (static_cast(p__ephemeralCompressedMode) == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); - - // 2. Generate the shared secret value based on public ephemeral keys will be required - if (ec.generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__encrypted__sym__key, - p__nonce, p__authentication__vector, OCTETSTRING(0, nullptr)) == -1) { - loggers::get_instance().warning("fx__decryptWithEciesBrainpoolp256r1WithSha256: Failed to generate shared secret"); - return OCTETSTRING(0, nullptr); - } - - // Decrypt the message - OCTETSTRING enc_message(p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof(), - static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message - loggers::get_instance().log_msg("fx__decryptWithEciesBrainpoolp256r1WithSha256: enc_message: ", enc_message); // Extract the ctag value - OCTETSTRING tag(ec.tag().lengthof(), - static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); - loggers::get_instance().log_msg("fx__decryptWithEciesBrainpoolp256r1WithSha256: tag: ", tag); - OCTETSTRING message; - if (ec.decrypt(tag, enc_message, message) == -1) { - loggers::get_instance().warning("fx__decryptWithEciesBrainpoolp256r1WithSha256: Failed to generate shared secret"); - return OCTETSTRING(0, nullptr); - } - loggers::get_instance().log_msg("fx__decryptWithEciesBrainpoolp256r1WithSha256: dec message: ", message); - p__aes__sym__enc__key = ec.symmetric_encryption_key(); - loggers::get_instance().log_msg("fx__decryptWithEciesBrainpoolp256r1WithSha256: AES 128 encryption key: ", p__aes__sym__enc__key); - - return message; - } - - /** - * \brief Produce a new public/private key pair based on Elliptic Curve Digital Signature Algorithm (ECDSA) algorithm. - * This function should not be used by the ATS - * \param p_privateKey The new private key value - * \param p_publicKeyX The new public key value (x coordinate) - * \param p_publicKeyX The new public key value (y coordinate) - * \return true on success, false otherwise - fx_generateKeyPair_nistp256(out octetstring p_privateKey, out octetstring p_publicKeyX, out octetstring p_publicKeyY) return boolean; - */ - BOOLEAN fx__generateKeyPair__nistp256(OCTETSTRING &p__privateKey, OCTETSTRING &p__publicKeyX, OCTETSTRING &p__publicKeyY, OCTETSTRING &p__publicKeyCompressed, - INTEGER &p__compressedMode) { - security_ecc k(ec_elliptic_curves::nist_p_256); - if (k.generate() != 0) { - p__privateKey = OCTETSTRING(0, nullptr); - p__publicKeyX = OCTETSTRING(0, nullptr); - p__publicKeyY = OCTETSTRING(0, nullptr); - p__publicKeyCompressed = OCTETSTRING(0, nullptr); - return FALSE; - } - // Sanity checks - if (k.private_key().lengthof() != 32) { - loggers::get_instance().error("fx__generateKeyPair__nistp256: Invalid private key size"); - return FALSE; - } - if (k.public_key_x().lengthof() != 32) { - loggers::get_instance().error("fx__generateKeyPair__nistp256: Invalid public key X-coordonate size"); - return FALSE; - } - if (k.public_key_y().lengthof() != 32) { - loggers::get_instance().error("fx__generateKeyPair__nistp256: Invalid public key Y-coordonate size"); - return FALSE; - } - if (k.public_key_compressed().lengthof() != 32) { - loggers::get_instance().error("fx__generateKeyPair__nistp256: Invalid public compressed key size"); - return FALSE; - } - p__privateKey = k.private_key(); - p__publicKeyX = k.public_key_x(); - p__publicKeyY = k.public_key_y(); - p__publicKeyCompressed = k.public_key_compressed(); - p__compressedMode = INTEGER((int)k.public_key_compressed_mode()); - - return TRUE; - } - - /** - * \brief Produce a new public/private key pair based on Elliptic Curve Digital Signature Algorithm (ECDSA) algorithm. - * This function should not be used by the ATS - * \param p_privateKey The new private key value - * \param p_publicKeyX The new public key value (x coordinate) - * \param p_publicKeyX The new public key value (y coordinate) - * \return true on success, false otherwise - fx_generateKeyPair_nistp256(out octetstring p_privateKey, out octetstring p_publicKeyX, out octetstring p_publicKeyY) return boolean; - */ - BOOLEAN fx__generateKeyPair__brainpoolp256r1(OCTETSTRING &p__privateKey, OCTETSTRING &p__publicKeyX, OCTETSTRING &p__publicKeyY, - OCTETSTRING &p__publicKeyCompressed, INTEGER &p__compressedMode) { - security_ecc k(ec_elliptic_curves::brainpool_p_256_r1); - if (k.generate() != 0) { - p__privateKey = OCTETSTRING(0, nullptr); - p__publicKeyX = OCTETSTRING(0, nullptr); - p__publicKeyY = OCTETSTRING(0, nullptr); - p__publicKeyCompressed = OCTETSTRING(0, nullptr); - return FALSE; - } - - // Sanity checks - if (k.private_key().lengthof() != 32) { - loggers::get_instance().error("fx__generateKeyPair__brainpoolp256r1: Invalid private key size"); - return FALSE; - } - if (k.public_key_x().lengthof() != 32) { - loggers::get_instance().error("fx__generateKeyPair__brainpoolp256r1: Invalid public key X-coordonate size"); - return FALSE; - } - if (k.public_key_y().lengthof() != 32) { - loggers::get_instance().error("fx__generateKeyPair__brainpoolp256r1: Invalid public key Y-coordonate size"); - return FALSE; - } - if (k.public_key_compressed().lengthof() != 32) { - loggers::get_instance().error("fx__generateKeyPair__brainpoolp256r1: Invalid public compressed key size"); - return FALSE; - } - p__privateKey = k.private_key(); - p__publicKeyX = k.public_key_x(); - p__publicKeyY = k.public_key_y(); - p__publicKeyCompressed = k.public_key_compressed(); - p__compressedMode = INTEGER((int)k.public_key_compressed_mode()); - - return TRUE; - } - - /** - * \brief Produce a new public/private key pair based on Elliptic Curve Digital Signature Algorithm (ECDSA) algorithm. - * This function should not be used by the ATS - * \param p_privateKey The new private key value - * \param p_publicKeyX The new public key value (x coordinate) - * \param p_publicKeyX The new public key value (y coordinate) - * \return true on success, false otherwise - fx_generateKeyPair_nistp256(out octetstring p_privateKey, out octetstring p_publicKeyX, out octetstring p_publicKeyY) return boolean; - */ - BOOLEAN fx__generateKeyPair__brainpoolp384r1(OCTETSTRING &p__privateKey, OCTETSTRING &p__publicKeyX, OCTETSTRING &p__publicKeyY, - OCTETSTRING &p__publicKeyCompressed, INTEGER &p__compressedMode) { - security_ecc k(ec_elliptic_curves::brainpool_p_384_r1); - if (k.generate() != 0) { - p__privateKey = OCTETSTRING(0, nullptr); - p__publicKeyX = OCTETSTRING(0, nullptr); - p__publicKeyY = OCTETSTRING(0, nullptr); - p__publicKeyCompressed = OCTETSTRING(0, nullptr); - return FALSE; - } - - // Sanity checks - if (k.private_key().lengthof() != 48) { - loggers::get_instance().error("fx__generateKeyPair__brainpoolp384r1: Invalid private key size"); - return FALSE; - } - if (k.public_key_x().lengthof() != 48) { - loggers::get_instance().error("fx__generateKeyPair__brainpoolp384r1: Invalid public key X-coordonate size"); - return FALSE; - } - if (k.public_key_y().lengthof() != 48) { - loggers::get_instance().error("fx__generateKeyPair__brainpoolp384r1: Invalid public key Y-coordonate size"); - return FALSE; - } - if (k.public_key_compressed().lengthof() != 48) { - loggers::get_instance().error("fx__generateKeyPair__brainpoolp384r1: Invalid public compressed key size"); - return FALSE; - } - p__privateKey = k.private_key(); - p__publicKeyX = k.public_key_x(); - p__publicKeyY = k.public_key_y(); - p__publicKeyCompressed = k.public_key_compressed(); - p__compressedMode = INTEGER((int)k.public_key_compressed_mode()); - - return TRUE; - } - - BOOLEAN fx__get__uncompressed__key__nistp256(const OCTETSTRING &p__privateKey, const OCTETSTRING &p__publicKeyCompressed, const INTEGER &p__compressedMode, - OCTETSTRING &p__publicKeyY) { - security_ecc k(ec_elliptic_curves::nist_p_256, p__privateKey); - - // Sanity checks - if (k.private_key().lengthof() != 32) { - loggers::get_instance().error("fx__get__uncompressed__key__nistp256: Invalid private key size"); - return FALSE; - } - if (k.public_key_x().lengthof() != 32) { - loggers::get_instance().error("fx__get__uncompressed__key__nistp256: Invalid public key X-coordonate size"); - return FALSE; - } - if (k.public_key_y().lengthof() != 32) { - loggers::get_instance().error("fx__get__uncompressed__key__nistp256: Invalid public key Y-coordonate size"); - return FALSE; - } - if (k.public_key_compressed().lengthof() != 32) { - loggers::get_instance().error("fx__get__uncompressed__key__nistp256: Invalid public compressed key size"); - return FALSE; - } - // if (p__compressedMode != INTEGER((int)k.public_key_compressed_mode())) { - // loggers::get_instance().error("fx__get__uncompressed__key__nistp256: Invalid public compressed mode"); - // return FALSE; - // } - // if (p__publicKeyCompressed != k.public_key_compressed()) { - // loggers::get_instance().error("fx__get__uncompressed__key__nistp256: Invalid public compressed key value"); - // return FALSE; - // } - - p__publicKeyY = k.public_key_y(); - - return TRUE; - } - - BOOLEAN fx__get__uncompressed__key__brainpoolp256r1(const OCTETSTRING &p__privateKey, const OCTETSTRING &p__publicKeyCompressed, - const INTEGER &p__compressedMode, OCTETSTRING &p__publicKeyY) { - security_ecc k(ec_elliptic_curves::brainpool_p_256_r1, p__privateKey); - - // Sanity checks - if (k.private_key().lengthof() != 32) { - loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp256r1: Invalid private key size"); - return FALSE; - } - if (k.public_key_x().lengthof() != 32) { - loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp256r1: Invalid public key X-coordonate size"); - return FALSE; - } - if (k.public_key_y().lengthof() != 32) { - loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp256r1: Invalid public key Y-coordonate size"); - return FALSE; - } - if (k.public_key_compressed().lengthof() != 32) { - loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp256r1: Invalid public compressed key size"); - return FALSE; - } - // if (p__compressedMode != INTEGER((int)k.public_key_compressed_mode())) { - // loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp256r1: Invalid public compressed mode"); - // return FALSE; - // } - // if (p__publicKeyCompressed != k.public_key_compressed()) { - // loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp256r1: Invalid public compressed key value"); - // return FALSE; - // } - - p__publicKeyY = k.public_key_y(); - - return TRUE; - } - - BOOLEAN fx__get__uncompressed__key__brainpoolp384r1(const OCTETSTRING &p__privateKey, const OCTETSTRING &p__publicKeyCompressed, - const INTEGER &p__compressedMode, OCTETSTRING &p__publicKeyY) { - security_ecc k(ec_elliptic_curves::brainpool_p_384_r1, p__privateKey); - - // Sanity checks - if (k.private_key().lengthof() != 48) { - loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp384r1: Invalid private key size"); - return FALSE; - } - if (k.public_key_x().lengthof() != 48) { - loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp384r1: Invalid public key X-coordonate size"); - return FALSE; - } - if (k.public_key_y().lengthof() != 48) { - loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp384r1: Invalid public key Y-coordonate size"); - return FALSE; - } - if (k.public_key_compressed().lengthof() != 48) { - loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp384r1: Invalid public compressed key size"); - return FALSE; - } - // if (p__compressedMode != INTEGER((int)k.public_key_compressed_mode())) { - // loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp384r1: Invalid public compressed mode"); - // return FALSE; - // } - // if (p__publicKeyCompressed != k.public_key_compressed()) { - // loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp384r1: Invalid public compressed key value"); - // return FALSE; - // } - - p__publicKeyY = k.public_key_y(); - - return TRUE; - } - - // group encryption - - // group certificatesLoader - - /** - * \brief Load in memory cache the certificates available in the specified directory - * \param p_rootDirectory Root directory to access to the certificates identified by the certificate ID - * \param p_configId A configuration identifier - * @remark This method SHALL be call before any usage of certificates - * \return true on success, false otherwise - fx_loadCertificates(in charstring p_rootDirectory, in charstring p_configId) return boolean; - */ - BOOLEAN fx__loadCertificates(const CHARSTRING &p__rootDirectory, const CHARSTRING &p__configId) { - loggers::get_instance().log(">>> fx__loadCertificates: '%s', '%s'", static_cast(p__rootDirectory), static_cast(p__configId)); - - std::string str(static_cast(p__rootDirectory)); - if (p__configId.lengthof() != 0) { - str += "/"; - str += std::string(static_cast(p__configId)); - } - params_its params; - params.insert(std::pair(std::string("sec_db_path"), str)); - if (security_services_its::get_instance().setup(params) == -1) { - return FALSE; - } - - return TRUE; - } - - BOOLEAN fx__store__certificate(const CHARSTRING &p__cert__id, const OCTETSTRING &p__cert, const OCTETSTRING &p__private__key, - const OCTETSTRING &p__public__key__x, const OCTETSTRING &p__public__key__y, const OCTETSTRING &p__public__key__compressed, - const INTEGER &p__public__key__compressed__mode, const OCTETSTRING &p__hash, const OCTETSTRING &p__hash__256, - const OCTETSTRING &p__hashid8, const OCTETSTRING &p__issuer, const OCTETSTRING_template &p__private__enc__key, - const OCTETSTRING_template &p__public__enc__key__x, const OCTETSTRING_template &p__public__enc__key__y, - const OCTETSTRING_template &p__public__enc__compressed__key, const INTEGER_template &p__public__enc__key__compressed__mode) { - loggers::get_instance().log(">>> fx__store__certificate: '%s'", static_cast(p__cert__id)); - - int result; - if (!p__private__enc__key.is_omit()) { - const OCTETSTRING private_enc_key = p__private__enc__key.valueof(); - const OCTETSTRING public_enc_key_x = p__public__enc__key__x.valueof(); - const OCTETSTRING public_enc_key_y = p__public__enc__key__y.valueof(); - result = security_services_its::get_instance().store_certificate( - p__cert__id, p__cert, p__private__key, p__public__key__x, p__public__key__y, p__public__key__compressed, p__public__key__compressed__mode, p__hash, - p__hash__256, p__hashid8, p__issuer, p__private__enc__key.valueof(), p__public__enc__key__x.valueof(), p__public__enc__key__y.valueof(), - p__public__enc__compressed__key.valueof(), p__public__enc__key__compressed__mode.valueof()); - } else { - result = security_services_its::get_instance().store_certificate( - p__cert__id, p__cert, p__private__key, p__public__key__x, p__public__key__y, p__public__key__compressed, p__public__key__compressed__mode, p__hash, - p__hash__256, p__hashid8, p__issuer, OCTETSTRING(0, nullptr), OCTETSTRING(0, nullptr), OCTETSTRING(0, nullptr), OCTETSTRING(0, nullptr), INTEGER(-1)); - } - - return (result == 0); - } - - /** - * \brief Unload from memory cache the certificates - * \return true on success, false otherwise - */ - BOOLEAN fx__unloadCertificates() { return TRUE; } - - /** - * \brief Read the specified certificate - * \param p_certificate_id the certificate identifier - * \param p_certificate the expected certificate - * \return true on success, false otherwise - */ - BOOLEAN fx__readCertificate(const CHARSTRING &p__certificateId, OCTETSTRING &p__certificate) { - loggers::get_instance().log(">>> fx__readCertificate: '%s'", static_cast(p__certificateId)); - - if (security_services_its::get_instance().read_certificate(p__certificateId, p__certificate) == -1) { - return FALSE; - } - - return TRUE; - } - - BOOLEAN fx__readCertificateFromDigest(const OCTETSTRING &p__digest, CHARSTRING &p__certificateId) { - loggers::get_instance().log_msg(">>> fx__readCertificateFromDigest: ", p__digest); - - if (security_services_its::get_instance().read_certificate_from_digest(p__digest, p__certificateId) == -1) { - return FALSE; - } - loggers::get_instance().log_msg("fx__readCertificateFromDigest: ", p__certificateId); - - return TRUE; - } - - BOOLEAN fx__readCertificateFromHashedId3(const OCTETSTRING &p__digest, CHARSTRING &p__certificateId) { - loggers::get_instance().log_msg(">>> fx__readCertificateFromHashedId3: ", p__digest); - - if (security_services_its::get_instance().read_certificate_from_hashed_id3(p__digest, p__certificateId) == -1) { - return FALSE; - } - loggers::get_instance().log_msg("fx__readCertificateFromHashedId3: ", p__certificateId); - - return TRUE; - } - - /** - * \brief Read the specified certificate digest - * \param p_certificate_id the certificate identifier - * \param p_digest the expected certificate - * \return true on success, false otherwise - */ - BOOLEAN fx__readCertificateDigest(const CHARSTRING &p__certificateId, OCTETSTRING &p__digest) { - loggers::get_instance().log(">>> fx__readCertificateDigest: '%s'", static_cast(p__certificateId)); - - if (security_services_its::get_instance().read_certificate_digest(p__certificateId, p__digest) == -1) { - return FALSE; - } - - return TRUE; - } - - /** - * \brief Read the whole-hash of the certificate - * \param p_certificate_id the certificate identifier - * \param p_hash the expected certificate - * \return true on success, false otherwise - */ - BOOLEAN fx__readCertificateHash(const CHARSTRING &p__certificateId, OCTETSTRING &p__hash) { - loggers::get_instance().log(">>> fx__readCertificateHash: '%s'", static_cast(p__certificateId)); - - if (security_services_its::get_instance().read_certificate_hash(p__certificateId, p__hash) == -1) { - return FALSE; - } - - return TRUE; - } - - /** - * \brief Read the whole-hash of the certificate using SHA 256 - * \param p_certificate_id the certificate identifier - * \param p_hash the expected certificate - * \return true on success, false otherwise - */ - BOOLEAN fx__readCertificateHash256(const CHARSTRING &p__certificateId, OCTETSTRING &p__hash) { - loggers::get_instance().log(">>> fx__readCertificateHash256: '%s'", static_cast(p__certificateId)); - - if (security_services_its::get_instance().read_certificate_hash_sha_256(p__certificateId, p__hash) == -1) { - return FALSE; - } - - return TRUE; - } - - /** - * \brief Read the private keys for the specified certificate - * \param p_certificate_id the keys identifier - * \param p_signingPrivateKey the signing private key - * \return true on success, false otherwise - */ - BOOLEAN fx__readSigningKey(const CHARSTRING &p__certificateId, OCTETSTRING &p__signingPrivateKey) { - loggers::get_instance().log(">>> fx__readSigningKey: '%s'", static_cast(p__certificateId)); - - if (security_services_its::get_instance().read_private_key(p__certificateId, p__signingPrivateKey) == -1) { - return FALSE; - } - - return TRUE; - } - - /** - * \brief Read the private keys for the specified certificate - * \param p_keysId the keys identifier - * \param p_encryptPrivateKey the encrypt private key - * \return true on success, false otherwise - fx_readEncryptingKey(in charstring p_keysId, out Oct32 p_encryptingPrivateKey) return boolean; - */ - BOOLEAN fx__readEncryptingKey(const CHARSTRING &p__certificateId, OCTETSTRING &p__encryptingPrivateKey) { - loggers::get_instance().log(">>> fx__readSigningKey: '%s'", static_cast(p__certificateId)); - - if (security_services_its::get_instance().read_private_enc_key(p__certificateId, p__encryptingPrivateKey) == -1) { - return FALSE; - } - - return TRUE; - } - - // group geospacial - - /* * \brief 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 - fx_isValidPolygonalRegion(in PolygonalRegion p_region) return boolean; - */ - BOOLEAN fx__isValidPolygonalRegion(const Ieee1609Dot2BaseTypes::PolygonalRegion &p__region) { return TRUE; } - - /* * \brief Check if a polygonal region 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 - fx_isPolygonalRegionInside(in PolygonalRegion p_parent, in PolygonalRegion p_region) return boolean; - */ - BOOLEAN fx__isPolygonalRegionInside(const Ieee1609Dot2BaseTypes::PolygonalRegion &p__parent, const Ieee1609Dot2BaseTypes::PolygonalRegion &p__region) { - return TRUE; - } - - /* * \brief 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 - fx_isLocationInsideCircularRegion(in CircularRegion p_region, in ThreeDLocation p_location) return boolean; - */ - BOOLEAN fx__isLocationInsideCircularRegion(const Ieee1609Dot2BaseTypes::CircularRegion &p__region, const Ieee1609Dot2BaseTypes::ThreeDLocation &p__location) { - return TRUE; - } - - /* * \brief 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 - fx_isLocationInsideRectangularRegion(in SequenceOfRectangularRegion p_region, in ThreeDLocation p_location) return boolean; - */ - BOOLEAN fx__isLocationInsideRectangularRegion(const Ieee1609Dot2BaseTypes::SequenceOfRectangularRegion &p__region, - const Ieee1609Dot2BaseTypes::ThreeDLocation & p__location) { - return TRUE; - } - - /* * \brief 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 - fx_isLocationInsidePolygonalRegion(in PolygonalRegion p_region, in ThreeDLocation p_location) return boolean; - */ - BOOLEAN fx__isLocationInsidePolygonalRegion(const Ieee1609Dot2BaseTypes::PolygonalRegion &p__region, - const Ieee1609Dot2BaseTypes::ThreeDLocation & p__location) { - return TRUE; - } - - /* * \brief 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 - fx_isLocationInsideIdentifiedRegion(in IdentifiedRegion p_region, in ThreeDLocation p_location) return boolean; - */ - BOOLEAN fx__isLocationInsideIdentifiedRegion(const Ieee1609Dot2BaseTypes::IdentifiedRegion &p__region, - const Ieee1609Dot2BaseTypes::ThreeDLocation & p__location) { - return TRUE; - } - - /* * \brief 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 - fx_isLocationInsideOtherRegion(in octetstring p_region, in ThreeDLocation p_location) return boolean; - */ - BOOLEAN fx__isLocationInsideOtherRegion(const OCTETSTRING &p_region, const Ieee1609Dot2BaseTypes::ThreeDLocation &p_location) { return TRUE; } - - /** - * \brief Check that p_circular_region_1 circular region is included into p_circular_region_2 circular region - * \param p_circular_region_1 Circular region 1 - * \param p_circular_region_2 Circular region 2 - * \return true on success, false otherwise - fx_areCirclesInside(in CircularRegion p_circular_region_1, in CircularRegion p_circular_region_2) return boolean; - */ - BOOLEAN fx__areCirclesInside(const Ieee1609Dot2BaseTypes::CircularRegion &p_circular_region_1, - const Ieee1609Dot2BaseTypes::CircularRegion &p_circular_region_2) { - // Compute distance between the 2 radius - FLOAT d = LibItsCommon__Functions::fx__computeDistance(p_circular_region_1.center().latitude(), p_circular_region_1.center().longitude(), - p_circular_region_2.center().latitude(), p_circular_region_2.center().longitude()); - if ((float)abs(p_circular_region_1.radius() - p_circular_region_2.radius()) > (float)d) { - return FALSE; - } - return TRUE; - } - - /* * \brief Check that p_rectanglar_region_1 rectangular region is included into p_rectanglar_region_2 rectangular region - * \param p_rectanglar_region_1 Rectangular region 1 - * \param p_rectanglar_region_2 Rectangular region 2 - * \return true on success, false otherwise - fx_areRectanglesInside(in SequenceOfRectangularRegion p_rectanglar_region_1, in SequenceOfRectangularRegion p_rectanglar_region_2) return boolean; - */ - BOOLEAN fx__areRectanglesInside(const Ieee1609Dot2BaseTypes::SequenceOfRectangularRegion &p_rectanglar_region_1, - const Ieee1609Dot2BaseTypes::SequenceOfRectangularRegion &p_rectanglar_region_2) { - - return TRUE; - } - - /* * \brief Check that p_polygonal_region_1 polygonal region is included into p_polygonal_region_2 polygonal region - * \param p_polygonal_region_1 Polygonal region 1 - * \param p_polygonal_region_2 Polygonal region 2 - * \return true on success, false otherwise - fx_arePolygonsInside(in PolygonalRegion p_polygonal_region_1, in PolygonalRegion p_polygonal_region_2) return boolean; - */ - BOOLEAN fx__arePolygonsInside(const Ieee1609Dot2BaseTypes::PolygonalRegion &p_polygonal_region_1, - const Ieee1609Dot2BaseTypes::PolygonalRegion &p_polygonal_region_2) { - return TRUE; - } - - /** - * \brief Convert a spacial coordinate from DMS to DMS - * \param p_degrees The degrees (D) - * \param p_minutes The minutes (M) - * \param p_seconds The seconds (S) - * \param p_latlon The latitude/longitude: (N|S|E|W) - * \return The decimal coordinate on success, 0.0, otherwise - * @verdict Unchanged - fx_dms2dd(in Int p_degrees, in Int p_minutes, in float p_seconds, in Oct1 p_latlon) return float; - */ - FLOAT fx__dms2dd(const INTEGER &p__degrees, const INTEGER &p__minutes, const FLOAT &p__seconds, const OCTETSTRING &p__latlon) { return 0.0; } - - FLOAT fx__int2ddlat(const INTEGER &p__latitude) { return (float)((float)p__latitude / 10000000.0); } - - FLOAT fx__int2ddlon(const INTEGER &p__longitude) { return (float)((float)p__longitude / 1000000.0); } - -} // namespace LibItsSecurity__Functions +/*! + * \file LibItsSecurity_externals.cc + * \brief Source file for Security externl functions. + * \author ETSI STF525 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ +#include + +#include "LibItsCommon_Functions.hh" +#include "LibItsSecurity_Functions.hh" + +#include "hmac.hh" +#include "sha256.hh" +#include "sha384.hh" +//#include "sm3.hh" + +#include "security_ecc.hh" + +#include "security_services_its.hh" + +#include "geospacial.hh" + +#include +#include + +#include "loggers.hh" + +#include "params_its.hh" + +namespace LibItsSecurity__Functions { + + static unsigned char sm3_empty_string[32] = { 0x1A,0xB2,0x1D,0x83,0x55,0xCF,0xA1,0x7F,0x8E,0x61,0x19,0x48,0x31,0xE8,0x1A,0x8F,0x22,0xBE,0xC8,0xC7,0x28,0xFE,0xFB,0x74,0x7E,0xD0,0x35,0xEB,0x50,0x82,0xAA,0x2B }; + + static std::unique_ptr g(new geospacial); + + // FIXME Unify code with security_services_its + + /** + * \fn OCTETSTRING fx_hashWithSha256(const OCTETSTRING& p__toBeHashedData); + * \brief Produces a 256-bit (32-bytes) hash value + * \param[in] p__toBeHashedData The data to be used to calculate the hash value + * \return The hash value + */ + OCTETSTRING fx__hashWithSha256(const OCTETSTRING &p__toBeHashedData) { + loggers::get_instance().log_msg(">>> fx__hashWithSha256: p__toBeHashedData= ", p__toBeHashedData); + + sha256 hash; + OCTETSTRING hashData; + hash.generate(p__toBeHashedData, hashData); + loggers::get_instance().log_msg("fx__hashWithSha256: hashData= ", hashData); + return hashData; + } // End of function fx__hashWithSha256 + + /** + * \fn OCTETSTRING fx_hashWithSha384(const OCTETSTRING& p__toBeHashedData); + * \brief Produces a 384-bit (48-bytes) hash value + * \param[in] p__toBeHashedData Data to be used to calculate the hash value + * \return The hash value + */ + OCTETSTRING fx__hashWithSha384(const OCTETSTRING &p__toBeHashedData) { + sha384 hash; + OCTETSTRING hashData; + hash.generate(p__toBeHashedData, hashData); + loggers::get_instance().log_msg("fx__hashWithSha384: hashData= ", hashData); + return hashData; + } // End of function fx__hashWithSha384 + + /** + * \fn OCTETSTRING fx__signWithEcdsaNistp256WithSha256(const OCTETSTRING& p__toBeSignedSecuredMessage, const OCTETSTRING& p__privateKey); + * \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature based on standard IEEE 1609.2 + * \param[in] p__toBeSignedSecuredMessage The data to be signed + * \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate + * \param[in] p__privateKey The private key + * \return The signature value + */ + OCTETSTRING fx__signWithEcdsaNistp256WithSha256(const OCTETSTRING &p__toBeSignedSecuredMessage, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__privateKey) { + loggers::get_instance().log_msg(">>> fx__signWithEcdsaNistp256WithSha256: data=", p__toBeSignedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__signWithEcdsaNistp256WithSha256: issuer=", p__certificateIssuer); + loggers::get_instance().log_msg(">>> fx__signWithEcdsaNistp256WithSha256: private key=", p__privateKey); + + // Sanity checks + if ((p__certificateIssuer.lengthof() != 32) || (p__privateKey.lengthof() != 32)) { + loggers::get_instance().log("fx__signWithEcdsaNistp256WithSha256: Wrong parameters"); + return OCTETSTRING(0, nullptr); + } + + // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha256 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeSignedSecuredMessage, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha256_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__signWithEcdsaNistp256WithSha256: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__signWithEcdsaNistp256WithSha256: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + loggers::get_instance().log_msg("fx__signWithEcdsaNistp256WithSha256: Hash (Data input) || Hash (Signer identifier input)=", hashData1); + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__signWithEcdsaNistp256WithSha256: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Calculate the signature + security_ecc k(ec_elliptic_curves::nist_p_256, p__privateKey); + OCTETSTRING r_sig; + OCTETSTRING s_sig; + if (k.sign(hashData, r_sig, s_sig) == 0) { + OCTETSTRING os = r_sig + s_sig; + loggers::get_instance().log_msg("r_sig= ", r_sig); + loggers::get_instance().log_msg("s_sig= ", s_sig); + loggers::get_instance().log_msg("sig= ", os); + return os; + } + + return OCTETSTRING(0, nullptr); + } + + /** + * \fn OCTETSTRING fx__signWithEcdsaNistp256WithSha256(const OCTETSTRING& p__toBeSignedSecuredMessage, const OCTETSTRING& p__privateKey); + * \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature based on raw data + * \param[in] p__toBeSignedSecuredMessage The data to be signed + * \param[in] p__privateKey The private key + * \return The signature value + */ + OCTETSTRING fx__test__signWithEcdsaNistp256WithSha256(const OCTETSTRING &p__toBeSignedSecuredMessage, const OCTETSTRING &p__privateKey) { + loggers::get_instance().log_msg(">>> fx__test__signWithEcdsaNistp256WithSha256: data=", p__toBeSignedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__test__signWithEcdsaNistp256WithSha256: private key=", p__privateKey); + + // Sanity checks + if (p__privateKey.lengthof() != 32) { + loggers::get_instance().log("fx__test__signWithEcdsaNistp256WithSha256: Wrong parameters"); + return OCTETSTRING(0, nullptr); + } + + // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha256 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeSignedSecuredMessage, hashData1); + loggers::get_instance().log_msg("fx__test__signWithEcdsaNistp256WithSha256: Hash (Data input)=", hashData1); + // Calculate the signature + security_ecc k(ec_elliptic_curves::nist_p_256, p__privateKey); + OCTETSTRING r_sig; + OCTETSTRING s_sig; + if (k.sign(hashData1, r_sig, s_sig) == 0) { + OCTETSTRING os = r_sig + s_sig; + loggers::get_instance().log_msg("r_sig= ", r_sig); + loggers::get_instance().log_msg("s_sig= ", s_sig); + loggers::get_instance().log_msg("sig= ", os); + return os; + } + + return OCTETSTRING(0, nullptr); + } + + /** + * \fn OCTETSTRING fx__signWithEcdsaSm2WithSm3(const OCTETSTRING& p__toBeSignedSecuredMessage, const OCTETSTRING& p__privateKey); + * \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature based on standard IEEE 1609.2 + * \param[in] p__toBeSignedSecuredMessage The data to be signed + * \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate + * \param[in] p__privateKey The private key + * \return The signature value + */ + OCTETSTRING fx__signWithEcdsaSm2WithSm3(const OCTETSTRING &p__toBeSignedSecuredMessage, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__privateKey) { + loggers::get_instance().log_msg(">>> fx__signWithEcdsaSm2WithSm3: data=", p__toBeSignedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__signWithEcdsaSm2WithSm3: issuer=", p__certificateIssuer); + loggers::get_instance().log_msg(">>> fx__signWithEcdsaSm2WithSm3: private key=", p__privateKey); + + // Sanity checks + if ((p__certificateIssuer.lengthof() != 32) || (p__privateKey.lengthof() != 32)) { + loggers::get_instance().log("fx__signWithEcdsaSm2WithSm3: Wrong parameters"); + return OCTETSTRING(0, nullptr); + } + + // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha256 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeSignedSecuredMessage, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha256_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__signWithEcdsaSm2WithSm3: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__signWithEcdsaSm2WithSm3: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + loggers::get_instance().log_msg("fx__signWithEcdsaSm2WithSm3: Hash (Data input) || Hash (Signer identifier input)=", hashData1); + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__signWithEcdsaSm2WithSm3: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + + // Setup INTLa and IDa - IEEE 1609.2 Clause 5.3.1.3 SM + OCTETSTRING entl_a; // IEEE 1609.2 Clause 5.3.1.3 SM2 + OCTETSTRING id_a; // IEEE 1609.2 Clause 5.3.1.3 SM2 + if (p__certificateIssuer != int2oct(0, 32)) { + entl_a = int2oct(16, 2); // IEEE 1609.2 Clause 5.3.1.3 SM2 + id_a = p__certificateIssuer; + } else { + entl_a = int2oct(128, 2); // IEEE 1609.2 Clause 5.3.1.3 SM2 + id_a = OCTETSTRING(32, sm3_empty_string); // Sm3 hash of empty string + } + // Calculate the signature + security_ecc k(ec_elliptic_curves::sm2_p_256, p__privateKey); + OCTETSTRING r_sig; + OCTETSTRING s_sig; + if (k.sign(hashData1, entl_a, id_a, r_sig, s_sig) == 0) { + OCTETSTRING os = r_sig + s_sig; + loggers::get_instance().log_msg("r_sig= ", r_sig); + loggers::get_instance().log_msg("s_sig= ", s_sig); + loggers::get_instance().log_msg("sig= ", os); + return os; + } + + return OCTETSTRING(0, nullptr); +} + + /** + * \fn OCTETSTRING fx__signWithEcdsaBrainpoolp256r1WithSha256(const OCTETSTRING& p__toBeSignedSecuredMessage, const OCTETSTRING& p__privateKey); + * \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature based on standard IEEE 1609.2 + * \param[in] p__toBeSignedSecuredMessage The data to be signed + * \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate + * \param[in] p__privateKey The private key + * \return The signature value + */ + OCTETSTRING fx__signWithEcdsaBrainpoolp256r1WithSha256(const OCTETSTRING &p__toBeSignedSecuredMessage, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__privateKey) { + loggers::get_instance().log_msg(">>> fx__signWithEcdsaBrainpoolp256r1WithSha256: data=", p__toBeSignedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__signWithEcdsaBrainpoolp256r1WithSha256: issuer=", p__certificateIssuer); + loggers::get_instance().log_msg(">>> fx__signWithEcdsaBrainpoolp256r1WithSha256: private key=", p__privateKey); + + // Sanity checks + if ((p__certificateIssuer.lengthof() != 32) || (p__privateKey.lengthof() != 32)) { + loggers::get_instance().log("fx__signWithEcdsaBrainpoolp256r1WithSha256: Wrong parameters"); + return OCTETSTRING(0, nullptr); + } + + // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha256 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeSignedSecuredMessage, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha256_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp256r1WithSha256: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp256r1WithSha256: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp256r1WithSha256: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Calculate the signature + security_ecc k(ec_elliptic_curves::brainpool_p_256_r1, p__privateKey); + OCTETSTRING r_sig; + OCTETSTRING s_sig; + if (k.sign(hashData, r_sig, s_sig) == 0) { + OCTETSTRING os = r_sig + s_sig; + loggers::get_instance().log_msg("r_sig= ", r_sig); + loggers::get_instance().log_msg("s_sig= ", s_sig); + loggers::get_instance().log_msg("sig= ", os); + return os; + } + + return OCTETSTRING(0, nullptr); + } + + /** + * \fn OCTETSTRING fx__signWithEcdsaBrainpoolp384r1WithSha384(const OCTETSTRING& p__toBeSignedSecuredMessage, const OCTETSTRING& p__privateKey); + * \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature based on standard IEEE 1609.2 + * \param[in] p__toBeSignedSecuredMessage The data to be signed + * \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate + * \param[in] p__privateKey The private key + * \return The signature value + */ + OCTETSTRING fx__signWithEcdsaBrainpoolp384r1WithSha384(const OCTETSTRING &p__toBeSignedSecuredMessage, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__privateKey) { + loggers::get_instance().log_msg(">>> fx__signWithEcdsaBrainpoolp384r1WithSha384: data=", p__toBeSignedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__signWithEcdsaBrainpoolp384r1WithSha384: issuer=", p__certificateIssuer); + loggers::get_instance().log_msg(">>> fx__signWithEcdsaBrainpoolp384r1WithSha384: private key=", p__privateKey); + + // Sanity checks + if ((p__certificateIssuer.lengthof() != 48) || (p__privateKey.lengthof() != 48)) { + loggers::get_instance().log("fx__signWithEcdsaBrainpoolp384r1WithSha384: Wrong parameters"); + return OCTETSTRING(0, nullptr); + } + + // Calculate the SHA384 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha384 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeSignedSecuredMessage, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 48)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha384_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp384r1WithSha384: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp384r1WithSha384: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp384r1WithSha384: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Calculate the signature + security_ecc k(ec_elliptic_curves::brainpool_p_384_r1, p__privateKey); + OCTETSTRING r_sig; + OCTETSTRING s_sig; + if (k.sign(hashData, r_sig, s_sig) == 0) { + OCTETSTRING os = r_sig + s_sig; + loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp384r1WithSha384: r_sig= ", r_sig); + loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp384r1WithSha384: s_sig= ", s_sig); + loggers::get_instance().log_msg("fx__signWithEcdsaBrainpoolp384r1WithSha384: sig= ", os); + return os; + } + + return OCTETSTRING(0, nullptr); + } + + /** + * \fn OCTETSTRING fx__signWithEcdsaNistp384WithSha384(const OCTETSTRING& p__toBeSignedSecuredMessage, const OCTETSTRING& p__privateKey); + * \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature based on standard IEEE 1609.2 + * \param[in] p__toBeSignedSecuredMessage The data to be signed + * \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate + * \param[in] p__privateKey The private key + * \return The signature value + */ + OCTETSTRING fx__signWithEcdsaNistp384WithSha384(const OCTETSTRING &p__toBeSignedSecuredMessage, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__privateKey) { + loggers::get_instance().log_msg(">>> fx__signWithEcdsaNistp384WithSha384: data=", p__toBeSignedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__signWithEcdsaNistp384WithSha384: issuer=", p__certificateIssuer); + loggers::get_instance().log_msg(">>> fx__signWithEcdsaNistp384WithSha384: private key=", p__privateKey); + + // Sanity checks + if ((p__certificateIssuer.lengthof() != 48) || (p__privateKey.lengthof() != 48)) { + loggers::get_instance().log("fx__signWithEcdsaNistp384WithSha384: Wrong parameters"); + return OCTETSTRING(0, nullptr); + } + + // Calculate the SHA384 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha384 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeSignedSecuredMessage, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 48)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha384_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Calculate the signature + security_ecc k(ec_elliptic_curves::nist_p_384, p__privateKey); + OCTETSTRING r_sig; + OCTETSTRING s_sig; + if (k.sign(hashData, r_sig, s_sig) == 0) { + OCTETSTRING os = r_sig + s_sig; + loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: r_sig= ", r_sig); + loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: s_sig= ", s_sig); + loggers::get_instance().log_msg("fx__signWithEcdsaNistp384WithSha384: sig= ", os); + return os; + } + + return OCTETSTRING(0, nullptr); + } + + /** + * \fn BOOLEAN fx__verifyWithEcdsaNistp256WithSha256(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& + * p__ecdsaNistp256PublicKeyCompressed); \brief Verify the signature of the specified data based on standard IEEE 1609.2 \param[in] p__toBeVerifiedData The + * data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate \param[in] + * p__signature The signature \param[in] p__ecdsaNistp256PublicKeyCompressed The compressed public key (x coordinate only) \return true on success, false + * otherwise + */ + BOOLEAN fx__verifyWithEcdsaNistp256WithSha256(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaNistp256PublicKeyCompressed, + const INTEGER &p__compressedMode) { + // Sanity checks + if ((p__certificateIssuer.lengthof() != 32) || (p__signature.lengthof() != 64) || (p__ecdsaNistp256PublicKeyCompressed.lengthof() != 32)) { + loggers::get_instance().log("fx__verifyWithEcdsaNistp256WithSha256: Wrong parameters"); + return FALSE; + } + + // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha256 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeVerifiedData, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha256_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp256WithSha256: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp256WithSha256: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp256WithSha256: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Check the signature + security_ecc k(ec_elliptic_curves::nist_p_256, p__ecdsaNistp256PublicKeyCompressed, + (p__compressedMode == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); + if (k.sign_verif(hashData, p__signature) == 0) { + return TRUE; + } + + return FALSE; + } + + /** + * \fn BOOLEAN fx__verifyWithEcdsaNistp256WithSha256(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__ecdsaNistp256PublicKeyCompressed); + * \brief Verify the signature of the specified data based on raw data + * \param[in] p__toBeVerifiedData The data to be verified + * \param[in] p__signature The signature + * \param[in] p__ecdsaNistp256PublicKeyCompressed The compressed public key (x coordinate only) + * \return true on success, false otherwise + */ + BOOLEAN fx__test__verifyWithEcdsaNistp256WithSha256(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__signature, + const OCTETSTRING &p__ecdsaNistp256PublicKeyCompressed, const INTEGER &p__compressedMode) { + // Sanity checks + if ((p__signature.lengthof() != 64) || (p__ecdsaNistp256PublicKeyCompressed.lengthof() != 32)) { + loggers::get_instance().log("fx__test__verifyWithEcdsaNistp256WithSha256: Wrong parameters"); + return FALSE; + } + + // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha256 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeVerifiedData, hashData1); + loggers::get_instance().log_msg("fx__test__verifyWithEcdsaNistp256WithSha256: Hash (Data input)=", hashData1); + // Check the signature + security_ecc k(ec_elliptic_curves::nist_p_256, p__ecdsaNistp256PublicKeyCompressed, + (p__compressedMode == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); + if (k.sign_verif(hashData1, p__signature) == 0) { + return TRUE; + } + + return FALSE; + } + + /** + * \fn BOOLEAN fx__verifyWithEcdsaNistp256WithSha256_1(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& + * p__ecdsaNistp256PublicKeyX, const OCTETSTRING& p__ecdsaNistp256PublicKeyY); \brief Verify the signature of the specified data based on standard IEEE 1609.2 + * \param[in] p__toBeVerifiedData The data to be verified + * \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate + * \param[in] p__signature The signature + * \param[in] p__ecdsaNistp256PublicKeyX The public key (x coordinate) + * \param[in] p__ecdsaNistp256PublicKeyY The public key (y coordinate) + * \return true on success, false otherwise + */ + BOOLEAN fx__verifyWithEcdsaNistp256WithSha256__1(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaNistp256PublicKeyX, + const OCTETSTRING &p__ecdsaNistp256PublicKeyY) { + // Sanity checks + if ((p__certificateIssuer.lengthof() != 32) || (p__signature.lengthof() != 64) || (p__ecdsaNistp256PublicKeyX.lengthof() != 32) || + (p__ecdsaNistp256PublicKeyY.lengthof() != 32)) { + loggers::get_instance().log("fx__verifyWithEcdsaNistp256WithSha256__1: Wrong parameters"); + return FALSE; + } + + // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha256 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeVerifiedData, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha256_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp256WithSha256__1: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp256WithSha256__1: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp256WithSha256__1: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Check the signature + security_ecc k(ec_elliptic_curves::nist_p_256, p__ecdsaNistp256PublicKeyX, p__ecdsaNistp256PublicKeyY); + // security_ecc k(ec_elliptic_curves::nist_p_256); + if (k.sign_verif(hashData, p__signature) == 0) { + return TRUE; + } + + return FALSE; + } + + /** + * \fn BOOLEAN fx__verifyWithEcdsaSm2WithSm3(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& + * p__ecdsaSm2p256PublicKeyCompressed); \brief Verify the signature of the specified data based on standard IEEE 1609.2 \param[in] p__toBeVerifiedData The + * data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate \param[in] + * p__signature The signature \param[in] p__ecdsaSm2p256PublicKeyCompressed The compressed public key (x coordinate only) \return true on success, false + * otherwise + */ + BOOLEAN fx__verifyWithEcdsaSm2WithSm3(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaSm2p256PublicKeyCompressed, + const INTEGER &p__compressedMode) { + // Sanity checks + if ((p__certificateIssuer.lengthof() != 32) || (p__signature.lengthof() != 64) || (p__ecdsaSm2p256PublicKeyCompressed.lengthof() != 32)) { + loggers::get_instance().log("fx__verifyWithEcdsaSm2WithSm3: Wrong parameters"); + return FALSE; + } + + // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha256 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeVerifiedData, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha256_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__verifyWithEcdsaSm2WithSm3: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__verifyWithEcdsaSm2WithSm3: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__verifyWithEcdsaSm2WithSm3: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Check the signature + security_ecc k(ec_elliptic_curves::sm2_p_256, p__ecdsaSm2p256PublicKeyCompressed, + (p__compressedMode == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); + if (k.sign_verif(hashData, p__signature) == 0) { + return TRUE; + } + + return FALSE; + } + + /** + * \fn BOOLEAN fx__verifyWithEcdsaSm2WithSm3_1(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& + * p__ecdsaSm2p256PublicKeyX, const OCTETSTRING& p__ecdsaSm2p256PublicKeyY); \brief Verify the signature of the specified data based on standard IEEE 1609.2 + * \param[in] p__toBeVerifiedData The data to be verified + * \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate + * \param[in] p__signature The signature + * \param[in] p__ecdsaSm2p256PublicKeyX The public key (x coordinate) + * \param[in] p__ecdsaSm2p256PublicKeyY The public key (y coordinate) + * \return true on success, false otherwise + */ + BOOLEAN fx__verifyWithEcdsaSm2WithSm3__1(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaSm2p256PublicKeyX, + const OCTETSTRING &p__ecdsaSm2p256PublicKeyY) { + // Sanity checks + if ((p__certificateIssuer.lengthof() != 32) || (p__signature.lengthof() != 64) || (p__ecdsaSm2p256PublicKeyX.lengthof() != 32) || + (p__ecdsaSm2p256PublicKeyY.lengthof() != 32)) { + loggers::get_instance().log("fx__verifyWithEcdsaSm2WithSm3__1: Wrong parameters"); + return FALSE; + } + + // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha256 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeVerifiedData, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha256_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__verifyWithEcdsaSm2WithSm3__1: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__verifyWithEcdsaSm2WithSm3__1: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__verifyWithEcdsaSm2WithSm3__1: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Check the signature + security_ecc k(ec_elliptic_curves::sm2_p_256, p__ecdsaSm2p256PublicKeyX, p__ecdsaSm2p256PublicKeyY); + // security_ecc k(ec_elliptic_curves::sm2_p_256); + if (k.sign_verif(hashData, p__signature) == 0) { + return TRUE; + } + + return FALSE; + } + + /** + * \fn BOOLEAN fx__verifyWithEcdsaBrainpoolp256r1WithSha256(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& + * p__ecdsaBrainpoolp256PublicKeyCompressed); \brief Verify the signature of the specified data based on standard IEEE 1609.2 \param[in] p__toBeVerifiedData + * The data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate \param[in] + * p__signature The signature \param[in] p__ecdsaBrainpoolp256PublicKeyCompressed The compressed public key (x coordinate only) \return true on success, false + * otherwise + */ + BOOLEAN fx__verifyWithEcdsaBrainpoolp256r1WithSha256(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaBrainpoolp256PublicKeyCompressed, + const INTEGER &p__compressedMode) { + // Sanity checks + if ((p__certificateIssuer.lengthof() != 32) || (p__signature.lengthof() != 64) || (p__ecdsaBrainpoolp256PublicKeyCompressed.lengthof() != 32)) { + loggers::get_instance().log("fx__verifyWithEcdsaBrainpoolp256r1WithSha256: Wrong parameters"); + return FALSE; + } + + // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha256 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeVerifiedData, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha256_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp256r1WithSha256: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp256r1WithSha256: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp256r1WithSha256: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Check the signature + security_ecc k(ec_elliptic_curves::brainpool_p_256_r1, p__ecdsaBrainpoolp256PublicKeyCompressed, + (p__compressedMode == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); + if (k.sign_verif(hashData, p__signature) == 0) { + return TRUE; + } + + return FALSE; + } + + /** + * \fn BOOLEAN fx__verifyWithEcdsaBrainpoolp256r1WithSha256_1(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& + * p__ecdsaBrainpoolp256PublicKeyX, const OCTETSTRING& p__ecdsaBrainpoolp256PublicKeyY); \brief Verify the signature of the specified data based on standard + * IEEE 1609.2 \param[in] p__toBeVerifiedData The data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in + * case of self signed certificate \param[in] p__signature The signature \param[in] p__ecdsaBrainpoolp256PublicKeyX The public key (x coordinate) \param[in] + * p__ecdsaBrainpoolp256PublicKeyY The public key (y coordinate) \return true on success, false otherwise + */ + BOOLEAN fx__verifyWithEcdsaBrainpoolp256r1WithSha256__1(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaBrainpoolp256PublicKeyX, + const OCTETSTRING &p__ecdsaBrainpoolp256PublicKeyY) { + // Sanity checks + if ((p__certificateIssuer.lengthof() != 32) || (p__signature.lengthof() != 64) || (p__ecdsaBrainpoolp256PublicKeyX.lengthof() != 32) || + (p__ecdsaBrainpoolp256PublicKeyY.lengthof() != 32)) { + loggers::get_instance().log("fx__verifyWithEcdsaBrainpoolp256r1WithSha256__1: Wrong parameters"); + return FALSE; + } + + // Calculate the SHA256 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha256 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeVerifiedData, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha256_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp256r1WithSha256__1: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp256r1WithSha256__1: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp256r1WithSha256__1: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Check the signature + security_ecc k(ec_elliptic_curves::brainpool_p_256_r1, p__ecdsaBrainpoolp256PublicKeyX, p__ecdsaBrainpoolp256PublicKeyY); + if (k.sign_verif(hashData, p__signature) == 0) { + return TRUE; + } + + return FALSE; + } + + /** + * \fn BOOLEAN fx__verifyWithEcdsaBrainpoolp384r1WithSha384(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& + * p__ecdsaBrainpoolp384PublicKeyCompressed); \brief Verify the signature of the specified data based on standard IEEE 1609.2 \param[in] p__toBeVerifiedData + * The data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate \param[in] + * p__signature The signature \param[in] p__ecdsaBrainpoolp384PublicKeyCompressed The compressed public key (x coordinate only) \return true on success, false + * otherwise + */ + BOOLEAN fx__verifyWithEcdsaBrainpoolp384r1WithSha384(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaBrainpoolp384PublicKeyCompressed, + const INTEGER &p__compressedMode) { + // Sanity checks + if ((p__certificateIssuer.lengthof() != 48) || (p__signature.lengthof() != 96) || (p__ecdsaBrainpoolp384PublicKeyCompressed.lengthof() != 48)) { + loggers::get_instance().log("fx__verifyWithEcdsaBrainpoolp384r1WithSha384: Wrong parameters"); + return FALSE; + } + + // Calculate the SHA384 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha384 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeVerifiedData, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 48)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha384_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp384r1WithSha384: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp384r1WithSha384: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp384r1WithSha384: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Check the signature + security_ecc k(ec_elliptic_curves::brainpool_p_384_r1, p__ecdsaBrainpoolp384PublicKeyCompressed, + (p__compressedMode == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); + if (k.sign_verif(hashData, p__signature) == 0) { + return TRUE; + } + + return FALSE; + } + + /** + * \fn BOOLEAN fx__verifyWithEcdsaBrainpoolp384r1WithSha384_1(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& + * p__ecdsaBrainpoolp384PublicKeyX, const OCTETSTRING& p__ecdsaBrainpoolp384PublicKeyY); \brief Verify the signature of the specified data based on standard + * IEEE 1609.2 \param[in] p__toBeVerifiedData The data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in + * case of self signed certificate \param[in] p__signature The signature \param[in] p__ecdsaBrainpoolp384PublicKeyX The public key (x coordinate) \param[in] + * p__ecdsaBrainpoolp384PublicKeyY The public key (y coordinate) \return true on success, false otherwise + */ + BOOLEAN fx__verifyWithEcdsaBrainpoolp384r1WithSha384__1(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaBrainpoolp384PublicKeyX, + const OCTETSTRING &p__ecdsaBrainpoolp384PublicKeyY) { + // Sanity checks + if ((p__certificateIssuer.lengthof() != 48) || (p__signature.lengthof() != 96) || (p__ecdsaBrainpoolp384PublicKeyX.lengthof() != 48) || + (p__ecdsaBrainpoolp384PublicKeyY.lengthof() != 48)) { + loggers::get_instance().log("fx__verifyWithEcdsaBrainpoolp384r1WithSha384__1: Wrong parameters"); + return FALSE; + } + + // Calculate the SHA384 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha384 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeVerifiedData, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha384_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp384r1WithSha384: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp384r1WithSha384: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__verifyWithEcdsaBrainpoolp384r1WithSha384: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Check the signature + security_ecc k(ec_elliptic_curves::brainpool_p_384_r1, p__ecdsaBrainpoolp384PublicKeyX, p__ecdsaBrainpoolp384PublicKeyY); + if (k.sign_verif(hashData, p__signature) == 0) { + return TRUE; + } + + return FALSE; + } + + /** + * \fn BOOLEAN fx__verifyWithEcdsaNistp384WithSha384(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& + * p__ecdsaBrainpoolp384PublicKeyCompressed); \brief Verify the signature of the specified data based on standard IEEE 1609.2 \param[in] p__toBeVerifiedData + * The data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate \param[in] + * p__signature The signature \param[in] p__ecdsaBrainpoolp384PublicKeyCompressed The compressed public key (x coordinate only) \return true on success, false + * otherwise + */ + BOOLEAN fx__verifyWithEcdsaNistp384WithSha384(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaNistp384PublicKeyCompressed, + const INTEGER &p__compressedMode) { + // Sanity checks + if ((p__certificateIssuer.lengthof() != 48) || (p__signature.lengthof() != 96) || (p__ecdsaNistp384PublicKeyCompressed.lengthof() != 48)) { + loggers::get_instance().log("fx__verifyWithEcdsaNistp384WithSha384: Wrong parameters"); + return FALSE; + } + + // Calculate the SHA384 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha384 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeVerifiedData, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 48)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha384_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Check the signature + security_ecc k(ec_elliptic_curves::nist_p_384, p__ecdsaNistp384PublicKeyCompressed, + (p__compressedMode == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); + if (k.sign_verif(hashData, p__signature) == 0) { + return TRUE; + } + + return FALSE; + } + + /** + * \fn BOOLEAN fx__verifyWithEcdsaBrainpoolp384r1WithSha384_1(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& + * p__ecdsaBrainpoolp384PublicKeyX, const OCTETSTRING& p__ecdsaBrainpoolp384PublicKeyY); \brief Verify the signature of the specified data based on standard + * IEEE 1609.2 \param[in] p__toBeVerifiedData The data to be verified \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in + * case of self signed certificate \param[in] p__signature The signature \param[in] p__ecdsaBrainpoolp384PublicKeyX The public key (x coordinate) \param[in] + * p__ecdsaBrainpoolp384PublicKeyY The public key (y coordinate) \return true on success, false otherwise + */ + BOOLEAN fx__verifyWithEcdsaNistp384WithSha384__1(const OCTETSTRING &p__toBeVerifiedData, const OCTETSTRING &p__certificateIssuer, + const OCTETSTRING &p__signature, const OCTETSTRING &p__ecdsaNistp384PublicKeyX, + const OCTETSTRING &p__ecdsaNistp384PublicKeyY) { + // Sanity checks + if ((p__certificateIssuer.lengthof() != 48) || (p__signature.lengthof() != 96) || (p__ecdsaNistp384PublicKeyX.lengthof() != 48) || + (p__ecdsaNistp384PublicKeyY.lengthof() != 48)) { + loggers::get_instance().log("fx__verifyWithEcdsaNistp384WithSha384__1: Wrong parameters"); + return FALSE; + } + + // Calculate the SHA384 of the hashed data for signing: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + sha384 hash; + OCTETSTRING hashData1; // Hash (Data input) + hash.generate(p__toBeVerifiedData, hashData1); + OCTETSTRING hashData2; // Hash (Signer identifier input) + if (p__certificateIssuer != int2oct(0, 32)) { // || Hash (Signer identifier input) + hashData2 = p__certificateIssuer; + } else { + hashData2 = hash.get_sha384_empty_string(); // Hash of empty string + } + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384__1: Hash (Data input)=", hashData1); + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384__1: Hash (Signer identifier input)=", hashData2); + hashData1 += hashData2; // Hash (Data input) || Hash (Signer identifier input) + OCTETSTRING hashData; // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + hash.generate(hashData1, hashData); + loggers::get_instance().log_msg("fx__verifyWithEcdsaNistp384WithSha384__1: Hash ( Hash (Data input) || Hash (Signer identifier input) )=", hashData); + // Check the signature + security_ecc k(ec_elliptic_curves::nist_p_384, p__ecdsaNistp384PublicKeyX, p__ecdsaNistp384PublicKeyY); + if (k.sign_verif(hashData, p__signature) == 0) { + return TRUE; + } + + return FALSE; + } + + /** + * \fn OCTETSTRING fx__hmac__sha256(const OCTETSTRING& p__k, const OCTETSTRING& p__m); + * \brief Generate a HMAC-SHA256 value based on the provided secret key + * \param[in] p__k The secret key used for the HMAC calculation + * \param[in] p__m The message + * \return The HMAC value resized to 16-byte + */ + OCTETSTRING fx__hmac__sha256(const OCTETSTRING &p__k, const OCTETSTRING &p__m) { + loggers::get_instance().log_msg(">>> fx__hmac__sha256: p__k=", p__k); + loggers::get_instance().log_msg(">>> fx__hmac__sha256: p__m=", p__m); + + hmac h(hash_algorithms::sha_256); // TODO Use ec_encryption_algorithm + OCTETSTRING t; + if (h.generate(p__m, p__k, t) == -1) { + loggers::get_instance().warning("fx__hmac__sha256: Failed to generate HMAC"); + return OCTETSTRING(0, nullptr); + } + + loggers::get_instance().log_msg("<<< fx__hmac__sha256: HMAC: ", t); + return t; + } + + /** + * \fn OCTETSTRING fx__encrypt__aes__128__ccm__test(const OCTETSTRING& p__k, const OCTETSTRING& p__n, const OCTETSTRING& p__pt); + * \brief Encrypt the message using AES 128 CCM algorithm + * \param[in] p__k The symmetric encryption key + * \param[in] p__n The initial vector, nonce vector + * \param[in] p__pt The message to encrypt + * \return The encrypted message concatenated to the AES 128 CCM tag + */ + OCTETSTRING fx__encrypt__aes__128__ccm__test(const OCTETSTRING &p__k, const OCTETSTRING &p__n, const OCTETSTRING &p__pt) { + loggers::get_instance().log(">>> fx__encrypt__aes__128__ccm__test"); + + security_ecc ec(ec_elliptic_curves::nist_p_256); + OCTETSTRING enc_message; + if (ec.encrypt(encryption_algotithm::aes_128_ccm, p__k, p__n, p__pt, enc_message) == -1) { + loggers::get_instance().warning("fx__encrypt__aes__128__ccm__test: Failed to encrypt message"); + return OCTETSTRING(0, nullptr); + } + OCTETSTRING os(enc_message + ec.tag()); + loggers::get_instance().log_msg("fx__encrypt__aes__128__ccm__test: encrypted message: ", os); + + return os; + } + + /** + * \fn OCTETSTRING fx__encrypt__aes__128__gcm__test(const OCTETSTRING& p__k, const OCTETSTRING& p__n, const OCTETSTRING& p__pt); + * \brief Encrypt the message using AES 128 GCM algorithm + * \param[in] p__k The symmetric encryption key + * \param[in] p__n The initial vector, nonce vector + * \param[in] p__pt The message to encrypt + * \return The encrypted message concatenated to the AES 128 CCM tag + */ + OCTETSTRING fx__encrypt__aes__128__gcm__test(const OCTETSTRING &p__k, const OCTETSTRING &p__n, const OCTETSTRING &p__pt) { + loggers::get_instance().log(">>> fx__encrypt__aes__128__gcm__test"); + + security_ecc ec(ec_elliptic_curves::nist_p_256); + OCTETSTRING enc_message; + if (ec.encrypt(encryption_algotithm::aes_128_gcm, p__k, p__n, p__pt, enc_message) == -1) { + loggers::get_instance().warning("fx__encrypt__aes__128__gcm__test: Failed to encrypt message"); + return OCTETSTRING(0, nullptr); + } + OCTETSTRING os(enc_message + ec.tag()); + loggers::get_instance().log_msg("fx__encrypt__aes__128__gcm__test: encrypted message: ", os); + + return os; + } + + /** + * \fn OCTETSTRING fx__decrypt__aes__128__ccm__test(const OCTETSTRING& p__k, const OCTETSTRING& p__n, const OCTETSTRING& p__ct); + * \brief Encrypt the message using AES 128 CCM algorithm + * \param[in] p__k The symmetric encryption key + * \param[in] p__n The initial vector, nonce vector + * \param[in] p__ct The encrypted message concatenated to the AES 128 CCM tag + * \return The original message + */ + OCTETSTRING fx__decrypt__aes__128__ccm__test(const OCTETSTRING &p__k, const OCTETSTRING &p__n, const OCTETSTRING &p__ct) { + loggers::get_instance().log_msg(">>> fx__decrypt__aes__128__ccm__test: p__k: ", p__k); + loggers::get_instance().log_msg(">>> fx__decrypt__aes__128__ccm__test: p__n: ", p__n); + loggers::get_instance().log_msg(">>> fx__decrypt__aes__128__ccm__test: p__ct: ", p__ct); + + security_ecc ec(ec_elliptic_curves::nist_p_256); + // Extract the tag + OCTETSTRING tag(16, p__ct.lengthof() - 16 + static_cast(p__ct)); + loggers::get_instance().log_msg("fx__decrypt__aes__128__ccm__test: tag: ", tag); + // Remove the tag from the end of the encrypted message + OCTETSTRING ct(p__ct.lengthof() - 16, static_cast(p__ct)); + loggers::get_instance().log_msg("fx__decrypt__aes__128__ccm__test: ct: ", ct); + + OCTETSTRING message; + if (ec.decrypt(encryption_algotithm::aes_128_ccm, p__k, p__n, tag, ct, message) == -1) { + loggers::get_instance().warning("fx__decrypt__aes__128__ccm__test: Failed to decrypt message"); + return OCTETSTRING(0, nullptr); + } + loggers::get_instance().log_to_hexa("fx__decrypt__aes__128__ccm__test: decrypted message: ", message); + + return message; + } + + /** + * \fn OCTETSTRING fx__encryptWithEciesNistp256WithSha256(const OCTETSTRING& p__toBeEncryptedSecuredMessage, const OCTETSTRING& p__recipientsPublicKeyX, const + * OCTETSTRING& p__recipientsPublicKeyY, OCTETSTRING& p__publicEphemeralKeyX, OCTETSTRING& p__publicEphemeralKeyY, OCTETSTRING& p__encrypted__sym__key, + * OCTETSTRING& p__authentication__vector, OCTETSTRING& p__nonce); \brief Encrypt the message using ECIES algorithm to encrypt AES 128 CCM symmetric key, as + * defined in IEEE Std 1609.2-2017 \param[in] p__toBeEncryptedSecuredMessage The message to be encrypted \param[in] p__recipientsPublicKeyCompressed The + * Recipient's compressed public key \param[in] p__compressedMode The compressed mode, 0 if the latest bit of Y-coordinate is 0, 1 otherwise \param[out] + * p__publicEphemeralKeyCompressed The public ephemeral compressed key \param[out] p__ephemeralCompressedMode The compressed mode, 0 if the latest bit of + * Y-coordinate is 0, 1 otherwise \param[out] p__encrypted__sym__key The encrypted AES 128 symmetric key \param[out] p__authentication__vector The tag of the + * encrypted AES 128 symmetric key \param[out] p__nonce The nonce vector \return The original message \see IEEE Std 1609.2-2017 Clause 5.3.5 Public key + * encryption algorithms: ECIES \see https://www.nominet.uk/researchblog/how-elliptic-curve-cryptography-encryption-works/ \see + * http://digital.csic.es/bitstream/10261/32671/1/V2-I2-P7-13.pdf + */ + // TODO Use common function for both fx__encryptWithEciesxxx and fx__decryptWithEciesxxx function + OCTETSTRING fx__encryptWithEciesNistp256WithSha256(const OCTETSTRING &p__toBeEncryptedSecuredMessage, const OCTETSTRING &p__recipientsPublicKeyCompressed, + const INTEGER &p__compressedMode, const OCTETSTRING &p__salt, OCTETSTRING &p__publicEphemeralKeyCompressed, + INTEGER &p__ephemeralCompressedMode, OCTETSTRING &p__aes__sym__key, OCTETSTRING &p__encrypted__sym__key, + OCTETSTRING &p__authentication__vector, OCTETSTRING &p__nonce) { + loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: p__toBeEncryptedSecuredMessage: ", p__toBeEncryptedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: p__recipientsPublicKeyCompressed: ", p__recipientsPublicKeyCompressed); + loggers::get_instance().log(">>> fx__encryptWithEciesNistp256WithSha256: p__compressedMode: %d", static_cast(p__compressedMode)); + loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: p__salt: ", p__salt); + + // 1. Generate new Private/Public Ephemeral key + std::unique_ptr ec; + ec.reset(new security_ecc(ec_elliptic_curves::nist_p_256)); + if (ec->generate() == -1) { + loggers::get_instance().warning("fx__encryptWithEciesNistp256WithSha256: Failed to generate ephemeral keys"); + return OCTETSTRING(0, nullptr); + } + // 2. Generate and derive shared secret based on recipient's private keys + security_ecc ec_comp(ec_elliptic_curves::nist_p_256, p__recipientsPublicKeyCompressed, + (static_cast(p__compressedMode) == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); + if (ec->generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__salt) == -1) { + loggers::get_instance().warning("fx__encryptWithEciesNistp256WithSha256: Failed to generate and derive secret key"); + return OCTETSTRING(0, nullptr); + } + + // Set the AES symmetric key + loggers::get_instance().log_msg("fx__encryptWithEciesNistp256WithSha256: AES symmetric key: ", ec->symmetric_encryption_key()); + p__aes__sym__key = ec->symmetric_encryption_key(); + loggers::get_instance().log_msg("fx__encryptWithEciesNistp256WithSha256: p__aes__sym__key: ", p__aes__sym__key); + // Set the encrypted symmetric key + loggers::get_instance().log_msg("fx__encryptWithEciesNistp256WithSha256: Encrypted symmetric key: ", ec->encrypted_symmetric_key()); + p__encrypted__sym__key = ec->encrypted_symmetric_key(); + loggers::get_instance().log_msg("fx__encryptWithEciesNistp256WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key); + // Set the tag of the symmetric key encryption + p__authentication__vector = ec->tag(); + loggers::get_instance().log_msg("fx__encryptWithEciesNistp256WithSha256: p__authentication__vector: ", p__authentication__vector); + // Set ephemeral public keys + p__publicEphemeralKeyCompressed = ec->public_key_compressed(); + loggers::get_instance().log_msg("fx__encryptWithEciesNistp256WithSha256: Ephemeral public compressed key: ", p__publicEphemeralKeyCompressed); + p__ephemeralCompressedMode = (ec->public_key_compressed_mode() == ecc_compressed_mode::compressed_y_0) ? 0 : 1; + loggers::get_instance().log("fx__encryptWithEciesNistp256WithSha256: Ephemeral public compressed mode: %d: ", (int)p__ephemeralCompressedMode); + // 3. Retrieve AES 128 parameters + p__nonce = ec->nonce(); + loggers::get_instance().log_msg("fx__encryptWithEciesNistp256WithSha256: p__nonce: ", p__nonce); + // 4. Encrypt the data using AES-128 CCM + OCTETSTRING enc_message; + if (ec->encrypt(encryption_algotithm::aes_128_ccm, ec->symmetric_encryption_key(), ec->nonce(), p__toBeEncryptedSecuredMessage, enc_message) == -1) { + loggers::get_instance().warning("fx__encryptWithEciesNistp256WithSha256: Failed to encrypt message"); + return OCTETSTRING(0, nullptr); + } + enc_message += ec->tag(); + loggers::get_instance().log_to_hexa("fx__encryptWithEciesNistp256WithSha256: enc message||Tag: ", enc_message); + + return enc_message; + } + + /** + * @desc Test function for ECIES NIST P-256 Encryption with SHA-256 + * @remark For the purpose of testing, the content of p__toBeEncryptedSecuredMessage is the AES 128 symmetric key to be encrypted + */ + OCTETSTRING fx__test__encryptWithEciesNistp256WithSha256(const OCTETSTRING &p__toBeEncryptedSecuredMessage, const OCTETSTRING &p__privateEphemeralKey, + const OCTETSTRING &p__recipientPublicKeyX, const OCTETSTRING &p__recipientPublicKeyY, + const OCTETSTRING &p__salt, OCTETSTRING &p__publicEphemeralKeyX, OCTETSTRING &p__publicEphemeralKeyY, + OCTETSTRING &p__aes__sym__key, OCTETSTRING &p__encrypted__sym__key, + OCTETSTRING &p__authentication__vector, OCTETSTRING &p__nonce) { + + // 1. Generate new ephemeral Private/Public keys + security_ecc ec(ec_elliptic_curves::nist_p_256, p__privateEphemeralKey); + p__publicEphemeralKeyX = ec.public_key_x(); + p__publicEphemeralKeyY = ec.public_key_y(); + loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: Vx=", p__publicEphemeralKeyX); + loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: Vy=", p__publicEphemeralKeyY); + + // 2. Generate and derive shared secret + security_ecc ec_comp(ec_elliptic_curves::nist_p_256, p__recipientPublicKeyX, p__recipientPublicKeyY); + ec.symmetric_encryption_key(p__toBeEncryptedSecuredMessage); + loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: ", ec.encrypted_symmetric_key()); + if (ec.generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__salt) == -1) { + loggers::get_instance().warning("fx__test__encryptWithEciesNistp256WithSha256: Failed to generate and derive secret key"); + return OCTETSTRING(0, nullptr); + } + + // Set the AES symmetric key + loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: AES symmetric key: ", ec.symmetric_encryption_key()); + p__aes__sym__key = ec.symmetric_encryption_key(); + loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: p__aes__sym__key: ", p__aes__sym__key); + // Set the encrypted symmetric key + loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: Encrypted symmetric key: ", ec.encrypted_symmetric_key()); + p__encrypted__sym__key = ec.encrypted_symmetric_key(); + loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key); + // Set the tag of the symmetric key encryption + p__authentication__vector = ec.tag(); + loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: p__authentication__vector: ", p__authentication__vector); + // 3. Retrieve AES 128 parameters + p__nonce = ec.nonce(); + loggers::get_instance().log_msg("fx__test__encryptWithEciesNistp256WithSha256: p__nonce: ", p__nonce); + // 4. Encrypt the data using AES-128 CCM + OCTETSTRING enc_message; + if (ec.encrypt(encryption_algotithm::aes_128_ccm, ec.symmetric_encryption_key(), ec.nonce(), p__toBeEncryptedSecuredMessage, enc_message) == -1) { + loggers::get_instance().warning("fx__test__encryptWithEciesNistp256WithSha256: Failed to encrypt message"); + return OCTETSTRING(0, nullptr); + } + enc_message += ec.tag(); + loggers::get_instance().log_to_hexa("fx__test__encryptWithEciesNistp256WithSha256: enc message||Tag: ", enc_message); + + return enc_message; + } + + /** + * \fn OCTETSTRING fx__decryptWithEciesNistp256WithSha256(const OCTETSTRING& p__encryptedSecuredMessage, const OCTETSTRING& p__privateEncKey, const + * OCTETSTRING& p__publicEphemeralKeyX, const OCTETSTRING& p__publicEphemeralKeyY, const OCTETSTRING& p__encrypted__sym__key, const OCTETSTRING& + * p__authentication__vector, const OCTETSTRING& p__nonce); \brief Decrypt the message using ECIES algorithm to decrypt AES 128 CCM symmetric key, as defined + * in IEEE Std 1609.2-2017 \param[in] p__encryptedSecuredMessage The encrypted message \param[in] p__privateEncKey The private encryption key \param[in] + * p__publicEphemeralKeyCompressed The public ephemeral compressed key \param[in] p__ephemeralCompressedMode The compressed mode, 0 if the latest bit of + * Y-coordinate is 0, 1 otherwise \param[in] p__encrypted__sym__key The encrypted AES 128 symmetric key \param[in] p__authentication__vector The tag of the + * encrypted AES 128 symmetric key \param[in] p__nonce The nonce vector \return The original message \see IEEE Std 1609.2-2017 Clause 5.3.5 Public key + * encryption algorithms: ECIES \see https://www.nominet.uk/researchblog/how-elliptic-curve-cryptography-encryption-works/ \see + * http://digital.csic.es/bitstream/10261/32671/1/V2-I2-P7-13.pdf + */ + // TODO Use common function for both fx__encryptWithEciesxxx and fx__decryptWithEciesxxx function + OCTETSTRING fx__decryptWithEciesNistp256WithSha256(const OCTETSTRING &p__encryptedSecuredMessage, const OCTETSTRING &p__privateEncKey, + const OCTETSTRING &p__publicEphemeralKeyCompressed, const INTEGER &p__ephemeralCompressedMode, + const OCTETSTRING &p__encrypted__sym__key, const OCTETSTRING &p__authentication__vector, + const OCTETSTRING &p__nonce, const OCTETSTRING &p__salt, OCTETSTRING &p__aes__sym__enc__key) { + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__toBeEncryptedSecuredMessage: ", p__encryptedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__privateEncKey: ", p__privateEncKey); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__publicEphemeralKeyCompressed: ", p__publicEphemeralKeyCompressed); + loggers::get_instance().log(">>> fx__decryptWithEciesNistp256WithSha256: p__ephemeralCompressedMode: %d", static_cast(p__ephemeralCompressedMode)); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__nonce: ", p__nonce); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__authentication__vector: ", p__authentication__vector); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__salt", p__salt); + + // 1. Create security_ecc instance based on recipient's private key + security_ecc ec(ec_elliptic_curves::nist_p_256, p__privateEncKey); + security_ecc ec_comp(ec_elliptic_curves::nist_p_256, p__publicEphemeralKeyCompressed, + (static_cast(p__ephemeralCompressedMode) == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); + + // 2. Generate the shared secret value based on public ephemeral keys will be required + if (ec.generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__encrypted__sym__key, + p__nonce, p__authentication__vector, p__salt) == -1) { + loggers::get_instance().warning("fx__decryptWithEciesNistp256WithSha256: Failed to generate shared secret"); + return OCTETSTRING(0, nullptr); + } + + // Decrypt the message + OCTETSTRING enc_message(p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof(), + static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message + loggers::get_instance().log_msg("fx__decryptWithEciesNistp256WithSha256: enc_message: ", enc_message); // Extract the ctag value + OCTETSTRING tag(ec.tag().lengthof(), + static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); + loggers::get_instance().log_msg("fx__decryptWithEciesNistp256WithSha256: tag: ", tag); + OCTETSTRING message; + if (ec.decrypt(tag, enc_message, message) == -1) { + loggers::get_instance().warning("fx__decryptWithEciesNistp256WithSha256: Failed to generate shared secret"); + return OCTETSTRING(0, nullptr); + } + loggers::get_instance().log_msg("fx__decryptWithEciesNistp256WithSha256: dec message: ", message); + p__aes__sym__enc__key = ec.symmetric_encryption_key(); + loggers::get_instance().log_msg("fx__decryptWithEciesNistp256WithSha256: AES 128 encryption key: ", p__aes__sym__enc__key); + + return message; + } + + + + + + + + + + + + + + + + + + + + + + + + + + /** + * \fn OCTETSTRING fx__encryptWithEciesSm2p256WithSha256(const OCTETSTRING& p__toBeEncryptedSecuredMessage, const OCTETSTRING& p__recipientsPublicKeyX, const + * OCTETSTRING& p__recipientsPublicKeyY, OCTETSTRING& p__publicEphemeralKeyX, OCTETSTRING& p__publicEphemeralKeyY, OCTETSTRING& p__encrypted__sym__key, + * OCTETSTRING& p__authentication__vector, OCTETSTRING& p__nonce); \brief Encrypt the message using ECIES algorithm to encrypt AES 128 CCM symmetric key, as + * defined in IEEE Std 1609.2-2017 \param[in] p__toBeEncryptedSecuredMessage The message to be encrypted \param[in] p__recipientsPublicKeyCompressed The + * Recipient's compressed public key \param[in] p__compressedMode The compressed mode, 0 if the latest bit of Y-coordinate is 0, 1 otherwise \param[out] + * p__publicEphemeralKeyCompressed The public ephemeral compressed key \param[out] p__ephemeralCompressedMode The compressed mode, 0 if the latest bit of + * Y-coordinate is 0, 1 otherwise \param[out] p__encrypted__sym__key The encrypted AES 128 symmetric key \param[out] p__authentication__vector The tag of the + * encrypted AES 128 symmetric key \param[out] p__nonce The nonce vector \return The original message \see IEEE Std 1609.2-2017 Clause 5.3.5 Public key + * encryption algorithms: ECIES \see https://www.nominet.uk/researchblog/how-elliptic-curve-cryptography-encryption-works/ \see + * http://digital.csic.es/bitstream/10261/32671/1/V2-I2-P7-13.pdf + */ + // TODO Use common function for both fx__encryptWithEciesxxx and fx__decryptWithEciesxxx function + OCTETSTRING fx__encryptWithEciesSm2p256WithSha256(const OCTETSTRING &p__toBeEncryptedSecuredMessage, const OCTETSTRING &p__recipientsPublicKeyCompressed, + const INTEGER &p__compressedMode, const OCTETSTRING &p__salt, OCTETSTRING &p__publicEphemeralKeyCompressed, + INTEGER &p__ephemeralCompressedMode, OCTETSTRING &p__aes__sym__key, OCTETSTRING &p__encrypted__sym__key, + OCTETSTRING &p__authentication__vector, OCTETSTRING &p__nonce) { + loggers::get_instance().log_msg(">>> fx__encryptWithEciesSm2p256WithSha256: p__toBeEncryptedSecuredMessage: ", p__toBeEncryptedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__encryptWithEciesSm2p256WithSha256: p__recipientsPublicKeyCompressed: ", p__recipientsPublicKeyCompressed); + loggers::get_instance().log(">>> fx__encryptWithEciesSm2p256WithSha256: p__compressedMode: %d", static_cast(p__compressedMode)); + loggers::get_instance().log_msg(">>> fx__encryptWithEciesSm2p256WithSha256: p__salt: ", p__salt); + + // 1. Generate new Private/Public Ephemeral key + std::unique_ptr ec; + ec.reset(new security_ecc(ec_elliptic_curves::sm2_p_256)); + if (ec->generate() == -1) { + loggers::get_instance().warning("fx__encryptWithEciesSm2p256WithSha256: Failed to generate ephemeral keys"); + return OCTETSTRING(0, nullptr); + } + // 2. Generate and derive shared secret based on recipient's private keys + security_ecc ec_comp(ec_elliptic_curves::sm2_p_256, p__recipientsPublicKeyCompressed, + (static_cast(p__compressedMode) == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); + if (ec->generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__salt) == -1) { + loggers::get_instance().warning("fx__encryptWithEciesSm2p256WithSha256: Failed to generate and derive secret key"); + return OCTETSTRING(0, nullptr); + } + + // Set the AES symmetric key + loggers::get_instance().log_msg("fx__encryptWithEciesSm2p256WithSha256: AES symmetric key: ", ec->symmetric_encryption_key()); + p__aes__sym__key = ec->symmetric_encryption_key(); + loggers::get_instance().log_msg("fx__encryptWithEciesSm2p256WithSha256: p__aes__sym__key: ", p__aes__sym__key); + // Set the encrypted symmetric key + loggers::get_instance().log_msg("fx__encryptWithEciesSm2p256WithSha256: Encrypted symmetric key: ", ec->encrypted_symmetric_key()); + p__encrypted__sym__key = ec->encrypted_symmetric_key(); + loggers::get_instance().log_msg("fx__encryptWithEciesSm2p256WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key); + // Set the tag of the symmetric key encryption + p__authentication__vector = ec->tag(); + loggers::get_instance().log_msg("fx__encryptWithEciesSm2p256WithSha256: p__authentication__vector: ", p__authentication__vector); + // Set ephemeral public keys + p__publicEphemeralKeyCompressed = ec->public_key_compressed(); + loggers::get_instance().log_msg("fx__encryptWithEciesSm2p256WithSha256: Ephemeral public compressed key: ", p__publicEphemeralKeyCompressed); + p__ephemeralCompressedMode = (ec->public_key_compressed_mode() == ecc_compressed_mode::compressed_y_0) ? 0 : 1; + loggers::get_instance().log("fx__encryptWithEciesSm2p256WithSha256: Ephemeral public compressed mode: %d: ", (int)p__ephemeralCompressedMode); + // 3. Retrieve AES 128 parameters + p__nonce = ec->nonce(); + loggers::get_instance().log_msg("fx__encryptWithEciesSm2p256WithSha256: p__nonce: ", p__nonce); + // 4. Encrypt the data using AES-128 CCM + OCTETSTRING enc_message; + if (ec->encrypt(encryption_algotithm::aes_128_ccm, ec->symmetric_encryption_key(), ec->nonce(), p__toBeEncryptedSecuredMessage, enc_message) == -1) { + loggers::get_instance().warning("fx__encryptWithEciesSm2p256WithSha256: Failed to encrypt message"); + return OCTETSTRING(0, nullptr); + } + enc_message += ec->tag(); + loggers::get_instance().log_to_hexa("fx__encryptWithEciesSm2p256WithSha256: enc message||Tag: ", enc_message); + + return enc_message; + } + + /** + * @desc Test function for ECIES NIST P-256 Encryption with SHA-256 + * @remark For the purpose of testing, the content of p__toBeEncryptedSecuredMessage is the AES 128 symmetric key to be encrypted + */ + OCTETSTRING fx__test__encryptWithEciesSm2p256WithSha256(const OCTETSTRING &p__toBeEncryptedSecuredMessage, const OCTETSTRING &p__privateEphemeralKey, + const OCTETSTRING &p__recipientPublicKeyX, const OCTETSTRING &p__recipientPublicKeyY, + const OCTETSTRING &p__salt, OCTETSTRING &p__publicEphemeralKeyX, OCTETSTRING &p__publicEphemeralKeyY, + OCTETSTRING &p__aes__sym__key, OCTETSTRING &p__encrypted__sym__key, + OCTETSTRING &p__authentication__vector, OCTETSTRING &p__nonce) { + + // 1. Generate new ephemeral Private/Public keys + security_ecc ec(ec_elliptic_curves::sm2_p_256, p__privateEphemeralKey); + p__publicEphemeralKeyX = ec.public_key_x(); + p__publicEphemeralKeyY = ec.public_key_y(); + loggers::get_instance().log_msg("fx__test__encryptWithEciesSm2p256WithSha256: Vx=", p__publicEphemeralKeyX); + loggers::get_instance().log_msg("fx__test__encryptWithEciesSm2p256WithSha256: Vy=", p__publicEphemeralKeyY); + + // 2. Generate and derive shared secret + security_ecc ec_comp(ec_elliptic_curves::sm2_p_256, p__recipientPublicKeyX, p__recipientPublicKeyY); + ec.symmetric_encryption_key(p__toBeEncryptedSecuredMessage); + loggers::get_instance().log_msg("fx__test__encryptWithEciesSm2p256WithSha256: ", ec.encrypted_symmetric_key()); + if (ec.generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__salt) == -1) { + loggers::get_instance().warning("fx__test__encryptWithEciesSm2p256WithSha256: Failed to generate and derive secret key"); + return OCTETSTRING(0, nullptr); + } + + // Set the AES symmetric key + loggers::get_instance().log_msg("fx__test__encryptWithEciesSm2p256WithSha256: AES symmetric key: ", ec.symmetric_encryption_key()); + p__aes__sym__key = ec.symmetric_encryption_key(); + loggers::get_instance().log_msg("fx__test__encryptWithEciesSm2p256WithSha256: p__aes__sym__key: ", p__aes__sym__key); + // Set the encrypted symmetric key + loggers::get_instance().log_msg("fx__test__encryptWithEciesSm2p256WithSha256: Encrypted symmetric key: ", ec.encrypted_symmetric_key()); + p__encrypted__sym__key = ec.encrypted_symmetric_key(); + loggers::get_instance().log_msg("fx__test__encryptWithEciesSm2p256WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key); + // Set the tag of the symmetric key encryption + p__authentication__vector = ec.tag(); + loggers::get_instance().log_msg("fx__test__encryptWithEciesSm2p256WithSha256: p__authentication__vector: ", p__authentication__vector); + // 3. Retrieve AES 128 parameters + p__nonce = ec.nonce(); + loggers::get_instance().log_msg("fx__test__encryptWithEciesSm2p256WithSha256: p__nonce: ", p__nonce); + // 4. Encrypt the data using AES-128 CCM + OCTETSTRING enc_message; + if (ec.encrypt(encryption_algotithm::aes_128_ccm, ec.symmetric_encryption_key(), ec.nonce(), p__toBeEncryptedSecuredMessage, enc_message) == -1) { + loggers::get_instance().warning("fx__test__encryptWithEciesSm2p256WithSha256: Failed to encrypt message"); + return OCTETSTRING(0, nullptr); + } + enc_message += ec.tag(); + loggers::get_instance().log_to_hexa("fx__test__encryptWithEciesSm2p256WithSha256: enc message||Tag: ", enc_message); + + return enc_message; + } + + /** + * \fn OCTETSTRING fx__decryptWithEciesSm2p256WithSha256(const OCTETSTRING& p__encryptedSecuredMessage, const OCTETSTRING& p__privateEncKey, const + * OCTETSTRING& p__publicEphemeralKeyX, const OCTETSTRING& p__publicEphemeralKeyY, const OCTETSTRING& p__encrypted__sym__key, const OCTETSTRING& + * p__authentication__vector, const OCTETSTRING& p__nonce); \brief Decrypt the message using ECIES algorithm to decrypt AES 128 CCM symmetric key, as defined + * in IEEE Std 1609.2-2017 \param[in] p__encryptedSecuredMessage The encrypted message \param[in] p__privateEncKey The private encryption key \param[in] + * p__publicEphemeralKeyCompressed The public ephemeral compressed key \param[in] p__ephemeralCompressedMode The compressed mode, 0 if the latest bit of + * Y-coordinate is 0, 1 otherwise \param[in] p__encrypted__sym__key The encrypted AES 128 symmetric key \param[in] p__authentication__vector The tag of the + * encrypted AES 128 symmetric key \param[in] p__nonce The nonce vector \return The original message \see IEEE Std 1609.2-2017 Clause 5.3.5 Public key + * encryption algorithms: ECIES \see https://www.nominet.uk/researchblog/how-elliptic-curve-cryptography-encryption-works/ \see + * http://digital.csic.es/bitstream/10261/32671/1/V2-I2-P7-13.pdf + */ + // TODO Use common function for both fx__encryptWithEciesxxx and fx__decryptWithEciesxxx function + OCTETSTRING fx__decryptWithEciesSm2p256WithSha256(const OCTETSTRING &p__encryptedSecuredMessage, const OCTETSTRING &p__privateEncKey, + const OCTETSTRING &p__publicEphemeralKeyCompressed, const INTEGER &p__ephemeralCompressedMode, + const OCTETSTRING &p__encrypted__sym__key, const OCTETSTRING &p__authentication__vector, + const OCTETSTRING &p__nonce, const OCTETSTRING &p__salt, OCTETSTRING &p__aes__sym__enc__key) { + loggers::get_instance().log_msg(">>> fx__decryptWithEciesSm2p256WithSha256: p__toBeEncryptedSecuredMessage: ", p__encryptedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesSm2p256WithSha256: p__privateEncKey: ", p__privateEncKey); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesSm2p256WithSha256: p__publicEphemeralKeyCompressed: ", p__publicEphemeralKeyCompressed); + loggers::get_instance().log(">>> fx__decryptWithEciesSm2p256WithSha256: p__ephemeralCompressedMode: %d", static_cast(p__ephemeralCompressedMode)); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesSm2p256WithSha256: p__nonce: ", p__nonce); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesSm2p256WithSha256: p__authentication__vector: ", p__authentication__vector); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesSm2p256WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesSm2p256WithSha256: p__salt", p__salt); + + // 1. Create security_ecc instance based on recipient's private key + security_ecc ec(ec_elliptic_curves::sm2_p_256, p__privateEncKey); + security_ecc ec_comp(ec_elliptic_curves::sm2_p_256, p__publicEphemeralKeyCompressed, + (static_cast(p__ephemeralCompressedMode) == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); + + // 2. Generate the shared secret value based on public ephemeral keys will be required + if (ec.generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__encrypted__sym__key, + p__nonce, p__authentication__vector, p__salt) == -1) { + loggers::get_instance().warning("fx__decryptWithEciesSm2p256WithSha256: Failed to generate shared secret"); + return OCTETSTRING(0, nullptr); + } + + // Decrypt the message + OCTETSTRING enc_message(p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof(), + static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message + loggers::get_instance().log_msg("fx__decryptWithEciesSm2p256WithSha256: enc_message: ", enc_message); // Extract the ctag value + OCTETSTRING tag(ec.tag().lengthof(), + static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); + loggers::get_instance().log_msg("fx__decryptWithEciesSm2p256WithSha256: tag: ", tag); + OCTETSTRING message; + if (ec.decrypt(tag, enc_message, message) == -1) { + loggers::get_instance().warning("fx__decryptWithEciesSm2p256WithSha256: Failed to generate shared secret"); + return OCTETSTRING(0, nullptr); + } + loggers::get_instance().log_msg("fx__decryptWithEciesSm2p256WithSha256: dec message: ", message); + p__aes__sym__enc__key = ec.symmetric_encryption_key(); + loggers::get_instance().log_msg("fx__decryptWithEciesSm2p256WithSha256: AES 128 encryption key: ", p__aes__sym__enc__key); + + return message; + } + + + + + + + + + + + + + + + + + + + + + + OCTETSTRING fx__encryptWithEciesBrainpoolp256r1WithSha256(const OCTETSTRING &p__toBeEncryptedSecuredMessage, + const OCTETSTRING &p__recipientsPublicKeyCompressed, const INTEGER &p__compressedMode, + const OCTETSTRING &p__salt, OCTETSTRING &p__publicEphemeralKeyCompressed, + INTEGER &p__ephemeralCompressedMode, OCTETSTRING &p__aes__sym__key, + OCTETSTRING &p__encrypted__sym__key, OCTETSTRING &p__authentication__vector, + OCTETSTRING &p__nonce) { + loggers::get_instance().log_msg(">>> fx__encryptWithEciesBrainpoolp256r1WithSha256: p__toBeEncryptedSecuredMessage: ", p__toBeEncryptedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__encryptWithEciesBrainpoolp256r1WithSha256: p__recipientsPublicKeyCompressed: ", p__recipientsPublicKeyCompressed); + loggers::get_instance().log(">>> fx__encryptWithEciesBrainpoolp256r1WithSha256: p__compressedMode: %d", static_cast(p__compressedMode)); + loggers::get_instance().log_msg(">>> fx__encryptWithEciesBrainpoolp256r1WithSha256: p__salt: ", p__salt); + + // 1. Generate new Private/Public Ephemeral key + std::unique_ptr ec; + ec.reset(new security_ecc(ec_elliptic_curves::brainpool_p_256_r1)); + if (ec->generate() == -1) { + loggers::get_instance().warning("fx__encryptWithEciesBrainpoolp256r1WithSha256: Failed to generate ephemeral keys"); + return OCTETSTRING(0, nullptr); + } + // 2. Generate and derive shared secret based on recipient's private keys + security_ecc ec_comp(ec_elliptic_curves::brainpool_p_256_r1, p__recipientsPublicKeyCompressed, + (static_cast(p__compressedMode) == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); + if (ec->generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__salt) == -1) { + loggers::get_instance().warning("fx__encryptWithEciesBrainpoolp256r1WithSha256: Failed to generate and derive secret key"); + return OCTETSTRING(0, nullptr); + } + + // Set the AES symmetric key + loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256r1WithSha256: AES symmetric key: ", ec->symmetric_encryption_key()); + p__aes__sym__key = ec->symmetric_encryption_key(); + loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256r1WithSha256: p__aes__sym__key: ", p__aes__sym__key); + // Set the encrypted symmetric key + loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256r1WithSha256: Encrypted symmetric key: ", ec->encrypted_symmetric_key()); + p__encrypted__sym__key = ec->encrypted_symmetric_key(); + loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256r1WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key); + // Set the tag of the symmetric key encryption + p__authentication__vector = ec->tag(); + loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256r1WithSha256: p__authentication__vector: ", p__authentication__vector); + // Set ephemeral public keys + p__publicEphemeralKeyCompressed = ec->public_key_compressed(); + loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256r1WithSha256: Ephemeral public compressed key: ", p__publicEphemeralKeyCompressed); + p__ephemeralCompressedMode = (ec->public_key_compressed_mode() == ecc_compressed_mode::compressed_y_0) ? 0 : 1; + loggers::get_instance().log("fx__encryptWithEciesBrainpoolp256r1WithSha256: Ephemeral public compressed mode: %d: ", (int)p__ephemeralCompressedMode); + // 3. Retrieve AES 128 parameters + p__nonce = ec->nonce(); + loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256r1WithSha256: p__nonce: ", p__nonce); + // 4. Encrypt the data using AES-128 CCM + OCTETSTRING enc_message; + if (ec->encrypt(encryption_algotithm::aes_128_ccm, ec->symmetric_encryption_key(), ec->nonce(), p__toBeEncryptedSecuredMessage, enc_message) == -1) { + loggers::get_instance().warning("fx__encryptWithEciesBrainpoolp256r1WithSha256: Failed to encrypt message"); + return OCTETSTRING(0, nullptr); + } + enc_message += ec->tag(); + loggers::get_instance().log_to_hexa("fx__encryptWithEciesBrainpoolp256r1WithSha256: enc message||Tag: ", enc_message); + + return enc_message; + } + + /** + * @desc Test function for ECIES BRAINPOOL P-256r1 Encryption with SHA-256 + * @remark For the purpose of testing, the content of p__toBeEncryptedSecuredMessage is the AES 128 symmetric key to be encrypted + */ + OCTETSTRING fx__test__encryptWithEciesBrainpoolp256r1WithSha256(const OCTETSTRING &p__toBeEncryptedSecuredMessage, const OCTETSTRING &p__privateEphemeralKey, + const OCTETSTRING &p__recipientPublicKeyX, const OCTETSTRING &p__recipientPublicKeyY, + const OCTETSTRING &p__salt, OCTETSTRING &p__publicEphemeralKeyX, + OCTETSTRING &p__publicEphemeralKeyY, OCTETSTRING &p__aes__sym__key, + OCTETSTRING &p__encrypted__sym__key, OCTETSTRING &p__authentication__vector, + OCTETSTRING &p__nonce) { + + // 1. Generate new ephemeral Private/Public keys + security_ecc ec(ec_elliptic_curves::brainpool_p_256_r1, p__privateEphemeralKey); + p__publicEphemeralKeyX = ec.public_key_x(); + p__publicEphemeralKeyY = ec.public_key_y(); + loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: Vx=", p__publicEphemeralKeyX); + loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: Vy=", p__publicEphemeralKeyY); + + // 2. Generate and derive shared secret + security_ecc ec_comp(ec_elliptic_curves::brainpool_p_256_r1, p__recipientPublicKeyX, p__recipientPublicKeyY); + ec.symmetric_encryption_key(p__toBeEncryptedSecuredMessage); + loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: ", ec.encrypted_symmetric_key()); + if (ec.generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__salt) == -1) { + loggers::get_instance().warning("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: Failed to generate and derive secret key"); + return OCTETSTRING(0, nullptr); + } + + // Set the AES symmetric key + loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: AES symmetric key: ", ec.symmetric_encryption_key()); + p__aes__sym__key = ec.symmetric_encryption_key(); + loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: p__aes__sym__key: ", p__aes__sym__key); + // Set the encrypted symmetric key + loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: Encrypted symmetric key: ", ec.encrypted_symmetric_key()); + p__encrypted__sym__key = ec.encrypted_symmetric_key(); + loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key); + // Set the tag of the symmetric key encryption + p__authentication__vector = ec.tag(); + loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: p__authentication__vector: ", p__authentication__vector); + // 3. Retrieve AES 128 parameters + p__nonce = ec.nonce(); + loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: p__nonce: ", p__nonce); + // 4. Encrypt the data using AES-128 CCM + OCTETSTRING enc_message; + if (ec.encrypt(encryption_algotithm::aes_128_ccm, ec.symmetric_encryption_key(), ec.nonce(), p__toBeEncryptedSecuredMessage, enc_message) == -1) { + loggers::get_instance().warning("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: Failed to encrypt message"); + return OCTETSTRING(0, nullptr); + } + enc_message += ec.tag(); + loggers::get_instance().log_to_hexa("fx__test__encryptWithEciesBrainpoolp256r1WithSha256: enc message||Tag: ", enc_message); + + return enc_message; + } + + OCTETSTRING fx__decryptWithEciesBrainpoolp256r1WithSha256(const OCTETSTRING &p__encryptedSecuredMessage, const OCTETSTRING &p__privateEncKey, + const OCTETSTRING &p__publicEphemeralKeyCompressed, const INTEGER &p__ephemeralCompressedMode, + const OCTETSTRING &p__encrypted__sym__key, const OCTETSTRING &p__authentication__vector, + const OCTETSTRING &p__nonce, const OCTETSTRING &p__salt, OCTETSTRING &p__aes__sym__enc__key) { + loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__toBeEncryptedSecuredMessage: ", p__encryptedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__privateEncKey: ", p__privateEncKey); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__publicEphemeralKeyCompressed: ", p__publicEphemeralKeyCompressed); + loggers::get_instance().log(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__ephemeralCompressedMode: %d", + static_cast(p__ephemeralCompressedMode)); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__nonce: ", p__nonce); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__authentication__vector: ", p__authentication__vector); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__salt", p__salt); + + // 1. Create security_ecc instance based on public ephemeral keys + security_ecc ec(ec_elliptic_curves::brainpool_p_256_r1, p__privateEncKey); + security_ecc ec_comp(ec_elliptic_curves::brainpool_p_256_r1, p__publicEphemeralKeyCompressed, + (static_cast(p__ephemeralCompressedMode) == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); + + // 2. Generate the shared secret value based on public ephemeral keys will be required + if (ec.generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__encrypted__sym__key, + p__nonce, p__authentication__vector, OCTETSTRING(0, nullptr)) == -1) { + loggers::get_instance().warning("fx__decryptWithEciesBrainpoolp256r1WithSha256: Failed to generate shared secret"); + return OCTETSTRING(0, nullptr); + } + + // Decrypt the message + OCTETSTRING enc_message(p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof(), + static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message + loggers::get_instance().log_msg("fx__decryptWithEciesBrainpoolp256r1WithSha256: enc_message: ", enc_message); // Extract the ctag value + OCTETSTRING tag(ec.tag().lengthof(), + static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); + loggers::get_instance().log_msg("fx__decryptWithEciesBrainpoolp256r1WithSha256: tag: ", tag); + OCTETSTRING message; + if (ec.decrypt(tag, enc_message, message) == -1) { + loggers::get_instance().warning("fx__decryptWithEciesBrainpoolp256r1WithSha256: Failed to generate shared secret"); + return OCTETSTRING(0, nullptr); + } + loggers::get_instance().log_msg("fx__decryptWithEciesBrainpoolp256r1WithSha256: dec message: ", message); + p__aes__sym__enc__key = ec.symmetric_encryption_key(); + loggers::get_instance().log_msg("fx__decryptWithEciesBrainpoolp256r1WithSha256: AES 128 encryption key: ", p__aes__sym__enc__key); + + return message; + } + + /** + * \brief Produce a new public/private key pair based on Elliptic Curve Digital Signature Algorithm (ECDSA) algorithm. + * This function should not be used by the ATS + * \param p_privateKey The new private key value + * \param p_publicKeyX The new public key value (x coordinate) + * \param p_publicKeyX The new public key value (y coordinate) + * \return true on success, false otherwise + fx_generateKeyPair_nistp256(out octetstring p_privateKey, out octetstring p_publicKeyX, out octetstring p_publicKeyY) return boolean; + */ + BOOLEAN fx__generateKeyPair__nistp256(OCTETSTRING &p__privateKey, OCTETSTRING &p__publicKeyX, OCTETSTRING &p__publicKeyY, OCTETSTRING &p__publicKeyCompressed, + INTEGER &p__compressedMode) { + security_ecc k(ec_elliptic_curves::nist_p_256); + if (k.generate() != 0) { + p__privateKey = OCTETSTRING(0, nullptr); + p__publicKeyX = OCTETSTRING(0, nullptr); + p__publicKeyY = OCTETSTRING(0, nullptr); + p__publicKeyCompressed = OCTETSTRING(0, nullptr); + return FALSE; + } + // Sanity checks + if (k.private_key().lengthof() != 32) { + loggers::get_instance().error("fx__generateKeyPair__nistp256: Invalid private key size"); + return FALSE; + } + if (k.public_key_x().lengthof() != 32) { + loggers::get_instance().error("fx__generateKeyPair__nistp256: Invalid public key X-coordonate size"); + return FALSE; + } + if (k.public_key_y().lengthof() != 32) { + loggers::get_instance().error("fx__generateKeyPair__nistp256: Invalid public key Y-coordonate size"); + return FALSE; + } + if (k.public_key_compressed().lengthof() != 32) { + loggers::get_instance().error("fx__generateKeyPair__nistp256: Invalid public compressed key size"); + return FALSE; + } + p__privateKey = k.private_key(); + p__publicKeyX = k.public_key_x(); + p__publicKeyY = k.public_key_y(); + p__publicKeyCompressed = k.public_key_compressed(); + p__compressedMode = INTEGER((int)k.public_key_compressed_mode()); + + return TRUE; + } + + /** + * \brief Produce a new public/private key pair based on Elliptic Curve Digital Signature Algorithm (ECDSA) algorithm. + * This function should not be used by the ATS + * \param p_privateKey The new private key value + * \param p_publicKeyX The new public key value (x coordinate) + * \param p_publicKeyX The new public key value (y coordinate) + * \return true on success, false otherwise + fx_generateKeyPair_nistp384(out octetstring p_privateKey, out octetstring p_publicKeyX, out octetstring p_publicKeyY) return boolean; + */ + BOOLEAN fx__generateKeyPair__nistp384(OCTETSTRING &p__privateKey, OCTETSTRING &p__publicKeyX, OCTETSTRING &p__publicKeyY, OCTETSTRING &p__publicKeyCompressed, + INTEGER &p__compressedMode) { + security_ecc k(ec_elliptic_curves::nist_p_384); + if (k.generate() != 0) { + p__privateKey = OCTETSTRING(0, nullptr); + p__publicKeyX = OCTETSTRING(0, nullptr); + p__publicKeyY = OCTETSTRING(0, nullptr); + p__publicKeyCompressed = OCTETSTRING(0, nullptr); + return FALSE; + } + // Sanity checks + if (k.private_key().lengthof() != 32) { + loggers::get_instance().error("fx__generateKeyPair__nistp384: Invalid private key size"); + return FALSE; + } + if (k.public_key_x().lengthof() != 32) { + loggers::get_instance().error("fx__generateKeyPair__nistp384: Invalid public key X-coordonate size"); + return FALSE; + } + if (k.public_key_y().lengthof() != 32) { + loggers::get_instance().error("fx__generateKeyPair__nistp384: Invalid public key Y-coordonate size"); + return FALSE; + } + if (k.public_key_compressed().lengthof() != 32) { + loggers::get_instance().error("fx__generateKeyPair__nistp384: Invalid public compressed key size"); + return FALSE; + } + p__privateKey = k.private_key(); + p__publicKeyX = k.public_key_x(); + p__publicKeyY = k.public_key_y(); + p__publicKeyCompressed = k.public_key_compressed(); + p__compressedMode = INTEGER((int)k.public_key_compressed_mode()); + + return TRUE; + } + + /** + * \brief Produce a new public/private key pair based on Elliptic Curve Digital Signature Algorithm (ECDSA) algorithm. + * This function should not be used by the ATS + * \param p_privateKey The new private key value + * \param p_publicKeyX The new public key value (x coordinate) + * \param p_publicKeyX The new public key value (y coordinate) + * \return true on success, false otherwise + fx_generateKeyPair_sm2p256(out octetstring p_privateKey, out octetstring p_publicKeyX, out octetstring p_publicKeyY) return boolean; + */ + BOOLEAN fx__generateKeyPair__sm2p256(OCTETSTRING &p__privateKey, OCTETSTRING &p__publicKeyX, OCTETSTRING &p__publicKeyY, OCTETSTRING &p__publicKeyCompressed, + INTEGER &p__compressedMode) { + security_ecc k(ec_elliptic_curves::sm2_p_256); + if (k.generate() != 0) { + p__privateKey = OCTETSTRING(0, nullptr); + p__publicKeyX = OCTETSTRING(0, nullptr); + p__publicKeyY = OCTETSTRING(0, nullptr); + p__publicKeyCompressed = OCTETSTRING(0, nullptr); + return FALSE; + } + // Sanity checks + if (k.private_key().lengthof() != 32) { + loggers::get_instance().error("fx__generateKeyPair__sm2p256: Invalid private key size"); + return FALSE; + } + if (k.public_key_x().lengthof() != 32) { + loggers::get_instance().error("fx__generateKeyPair__sm2p256: Invalid public key X-coordonate size"); + return FALSE; + } + if (k.public_key_y().lengthof() != 32) { + loggers::get_instance().error("fx__generateKeyPair__sm2p256: Invalid public key Y-coordonate size"); + return FALSE; + } + if (k.public_key_compressed().lengthof() != 32) { + loggers::get_instance().error("fx__generateKeyPair__sm2p256: Invalid public compressed key size"); + return FALSE; + } + p__privateKey = k.private_key(); + p__publicKeyX = k.public_key_x(); + p__publicKeyY = k.public_key_y(); + p__publicKeyCompressed = k.public_key_compressed(); + p__compressedMode = INTEGER((int)k.public_key_compressed_mode()); + + return TRUE; + } + + /** + * \brief Produce a new public/private key pair based on Elliptic Curve Digital Signature Algorithm (ECDSA) algorithm. + * This function should not be used by the ATS + * \param p_privateKey The new private key value + * \param p_publicKeyX The new public key value (x coordinate) + * \param p_publicKeyX The new public key value (y coordinate) + * \return true on success, false otherwise + fx_generateKeyPair_nistp256(out octetstring p_privateKey, out octetstring p_publicKeyX, out octetstring p_publicKeyY) return boolean; + */ + BOOLEAN fx__generateKeyPair__brainpoolp256r1(OCTETSTRING &p__privateKey, OCTETSTRING &p__publicKeyX, OCTETSTRING &p__publicKeyY, + OCTETSTRING &p__publicKeyCompressed, INTEGER &p__compressedMode) { + security_ecc k(ec_elliptic_curves::brainpool_p_256_r1); + if (k.generate() != 0) { + p__privateKey = OCTETSTRING(0, nullptr); + p__publicKeyX = OCTETSTRING(0, nullptr); + p__publicKeyY = OCTETSTRING(0, nullptr); + p__publicKeyCompressed = OCTETSTRING(0, nullptr); + return FALSE; + } + + // Sanity checks + if (k.private_key().lengthof() != 32) { + loggers::get_instance().error("fx__generateKeyPair__brainpoolp256r1: Invalid private key size"); + return FALSE; + } + if (k.public_key_x().lengthof() != 32) { + loggers::get_instance().error("fx__generateKeyPair__brainpoolp256r1: Invalid public key X-coordonate size"); + return FALSE; + } + if (k.public_key_y().lengthof() != 32) { + loggers::get_instance().error("fx__generateKeyPair__brainpoolp256r1: Invalid public key Y-coordonate size"); + return FALSE; + } + if (k.public_key_compressed().lengthof() != 32) { + loggers::get_instance().error("fx__generateKeyPair__brainpoolp256r1: Invalid public compressed key size"); + return FALSE; + } + p__privateKey = k.private_key(); + p__publicKeyX = k.public_key_x(); + p__publicKeyY = k.public_key_y(); + p__publicKeyCompressed = k.public_key_compressed(); + p__compressedMode = INTEGER((int)k.public_key_compressed_mode()); + + return TRUE; + } + + /** + * \brief Produce a new public/private key pair based on Elliptic Curve Digital Signature Algorithm (ECDSA) algorithm. + * This function should not be used by the ATS + * \param p_privateKey The new private key value + * \param p_publicKeyX The new public key value (x coordinate) + * \param p_publicKeyX The new public key value (y coordinate) + * \return true on success, false otherwise + fx_generateKeyPair_nistp256(out octetstring p_privateKey, out octetstring p_publicKeyX, out octetstring p_publicKeyY) return boolean; + */ + BOOLEAN fx__generateKeyPair__brainpoolp384r1(OCTETSTRING &p__privateKey, OCTETSTRING &p__publicKeyX, OCTETSTRING &p__publicKeyY, + OCTETSTRING &p__publicKeyCompressed, INTEGER &p__compressedMode) { + security_ecc k(ec_elliptic_curves::brainpool_p_384_r1); + if (k.generate() != 0) { + p__privateKey = OCTETSTRING(0, nullptr); + p__publicKeyX = OCTETSTRING(0, nullptr); + p__publicKeyY = OCTETSTRING(0, nullptr); + p__publicKeyCompressed = OCTETSTRING(0, nullptr); + return FALSE; + } + + // Sanity checks + if (k.private_key().lengthof() != 48) { + loggers::get_instance().error("fx__generateKeyPair__brainpoolp384r1: Invalid private key size"); + return FALSE; + } + if (k.public_key_x().lengthof() != 48) { + loggers::get_instance().error("fx__generateKeyPair__brainpoolp384r1: Invalid public key X-coordonate size"); + return FALSE; + } + if (k.public_key_y().lengthof() != 48) { + loggers::get_instance().error("fx__generateKeyPair__brainpoolp384r1: Invalid public key Y-coordonate size"); + return FALSE; + } + if (k.public_key_compressed().lengthof() != 48) { + loggers::get_instance().error("fx__generateKeyPair__brainpoolp384r1: Invalid public compressed key size"); + return FALSE; + } + p__privateKey = k.private_key(); + p__publicKeyX = k.public_key_x(); + p__publicKeyY = k.public_key_y(); + p__publicKeyCompressed = k.public_key_compressed(); + p__compressedMode = INTEGER((int)k.public_key_compressed_mode()); + + return TRUE; + } + + BOOLEAN fx__get__uncompressed__key__nistp256(const OCTETSTRING &p__privateKey, const OCTETSTRING &p__publicKeyCompressed, const INTEGER &p__compressedMode, + OCTETSTRING &p__publicKeyY) { + security_ecc k(ec_elliptic_curves::nist_p_256, p__privateKey); + + // Sanity checks + if (k.private_key().lengthof() != 32) { + loggers::get_instance().error("fx__get__uncompressed__key__nistp256: Invalid private key size"); + return FALSE; + } + if (k.public_key_x().lengthof() != 32) { + loggers::get_instance().error("fx__get__uncompressed__key__nistp256: Invalid public key X-coordonate size"); + return FALSE; + } + if (k.public_key_y().lengthof() != 32) { + loggers::get_instance().error("fx__get__uncompressed__key__nistp256: Invalid public key Y-coordonate size"); + return FALSE; + } + if (k.public_key_compressed().lengthof() != 32) { + loggers::get_instance().error("fx__get__uncompressed__key__nistp256: Invalid public compressed key size"); + return FALSE; + } + // if (p__compressedMode != INTEGER((int)k.public_key_compressed_mode())) { + // loggers::get_instance().error("fx__get__uncompressed__key__nistp256: Invalid public compressed mode"); + // return FALSE; + // } + // if (p__publicKeyCompressed != k.public_key_compressed()) { + // loggers::get_instance().error("fx__get__uncompressed__key__nistp256: Invalid public compressed key value"); + // return FALSE; + // } + + p__publicKeyY = k.public_key_y(); + + return TRUE; + } + + BOOLEAN fx__get__uncompressed__key__brainpoolp256r1(const OCTETSTRING &p__privateKey, const OCTETSTRING &p__publicKeyCompressed, + const INTEGER &p__compressedMode, OCTETSTRING &p__publicKeyY) { + security_ecc k(ec_elliptic_curves::brainpool_p_256_r1, p__privateKey); + + // Sanity checks + if (k.private_key().lengthof() != 32) { + loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp256r1: Invalid private key size"); + return FALSE; + } + if (k.public_key_x().lengthof() != 32) { + loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp256r1: Invalid public key X-coordonate size"); + return FALSE; + } + if (k.public_key_y().lengthof() != 32) { + loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp256r1: Invalid public key Y-coordonate size"); + return FALSE; + } + if (k.public_key_compressed().lengthof() != 32) { + loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp256r1: Invalid public compressed key size"); + return FALSE; + } + // if (p__compressedMode != INTEGER((int)k.public_key_compressed_mode())) { + // loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp256r1: Invalid public compressed mode"); + // return FALSE; + // } + // if (p__publicKeyCompressed != k.public_key_compressed()) { + // loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp256r1: Invalid public compressed key value"); + // return FALSE; + // } + + p__publicKeyY = k.public_key_y(); + + return TRUE; + } + + BOOLEAN fx__get__uncompressed__key__brainpoolp384r1(const OCTETSTRING &p__privateKey, const OCTETSTRING &p__publicKeyCompressed, + const INTEGER &p__compressedMode, OCTETSTRING &p__publicKeyY) { + security_ecc k(ec_elliptic_curves::brainpool_p_384_r1, p__privateKey); + + // Sanity checks + if (k.private_key().lengthof() != 48) { + loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp384r1: Invalid private key size"); + return FALSE; + } + if (k.public_key_x().lengthof() != 48) { + loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp384r1: Invalid public key X-coordonate size"); + return FALSE; + } + if (k.public_key_y().lengthof() != 48) { + loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp384r1: Invalid public key Y-coordonate size"); + return FALSE; + } + if (k.public_key_compressed().lengthof() != 48) { + loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp384r1: Invalid public compressed key size"); + return FALSE; + } + // if (p__compressedMode != INTEGER((int)k.public_key_compressed_mode())) { + // loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp384r1: Invalid public compressed mode"); + // return FALSE; + // } + // if (p__publicKeyCompressed != k.public_key_compressed()) { + // loggers::get_instance().error("fx__get__uncompressed__key__brainpoolp384r1: Invalid public compressed key value"); + // return FALSE; + // } + + p__publicKeyY = k.public_key_y(); + + return TRUE; + } + + BOOLEAN fx__get__uncompressed__key__nistp384(const OCTETSTRING &p__privateKey, const OCTETSTRING &p__publicKeyCompressed, + const INTEGER &p__compressedMode, OCTETSTRING &p__publicKeyY) { + security_ecc k(ec_elliptic_curves::brainpool_p_384_r1, p__privateKey); + + // Sanity checks + if (k.private_key().lengthof() != 48) { + loggers::get_instance().error("fx__get__uncompressed__key__nistp384: Invalid private key size"); + return FALSE; + } + if (k.public_key_x().lengthof() != 48) { + loggers::get_instance().error("fx__get__uncompressed__key__nistp384: Invalid public key X-coordonate size"); + return FALSE; + } + if (k.public_key_y().lengthof() != 48) { + loggers::get_instance().error("fx__get__uncompressed__key__nistp384: Invalid public key Y-coordonate size"); + return FALSE; + } + if (k.public_key_compressed().lengthof() != 48) { + loggers::get_instance().error("fx__get__uncompressed__key__nistp384: Invalid public compressed key size"); + return FALSE; + } + // if (p__compressedMode != INTEGER((int)k.public_key_compressed_mode())) { + // loggers::get_instance().error("fx__get__uncompressed__key__nistp384: Invalid public compressed mode"); + // return FALSE; + // } + // if (p__publicKeyCompressed != k.public_key_compressed()) { + // loggers::get_instance().error("fx__get__uncompressed__key__nistp384: Invalid public compressed key value"); + // return FALSE; + // } + + p__publicKeyY = k.public_key_y(); + + return TRUE; + } + + // group encryption + + // group certificatesLoader + + /** + * \brief Load in memory cache the certificates available in the specified directory + * \param p_rootDirectory Root directory to access to the certificates identified by the certificate ID + * \param p_configId A configuration identifier + * @remark This method SHALL be call before any usage of certificates + * \return true on success, false otherwise + fx_loadCertificates(in charstring p_rootDirectory, in charstring p_configId) return boolean; + */ + BOOLEAN fx__loadCertificates(const CHARSTRING &p__rootDirectory, const CHARSTRING &p__configId) { + loggers::get_instance().log(">>> fx__loadCertificates: '%s', '%s'", static_cast(p__rootDirectory), static_cast(p__configId)); + + std::string str(static_cast(p__rootDirectory)); + if (p__configId.lengthof() != 0) { + str += "/"; + str += std::string(static_cast(p__configId)); + } + params_its params; + params.insert(std::pair(std::string("sec_db_path"), str)); + if (security_services_its::get_instance().setup(params) == -1) { + return FALSE; + } + + return TRUE; + } + + BOOLEAN fx__store__certificate(const CHARSTRING &p__cert__id, const OCTETSTRING &p__cert, const OCTETSTRING &p__private__key, + const OCTETSTRING &p__public__key__x, const OCTETSTRING &p__public__key__y, const OCTETSTRING &p__public__key__compressed, + const INTEGER &p__public__key__compressed__mode, const OCTETSTRING &p__hash, const OCTETSTRING &p__hash__256, + const OCTETSTRING &p__hashid8, const OCTETSTRING &p__issuer, const OCTETSTRING_template &p__private__enc__key, + const OCTETSTRING_template &p__public__enc__key__x, const OCTETSTRING_template &p__public__enc__key__y, + const OCTETSTRING_template &p__public__enc__compressed__key, const INTEGER_template &p__public__enc__key__compressed__mode) { + loggers::get_instance().log(">>> fx__store__certificate: '%s'", static_cast(p__cert__id)); + + int result; + if (!p__private__enc__key.is_omit()) { + const OCTETSTRING private_enc_key = p__private__enc__key.valueof(); + const OCTETSTRING public_enc_key_x = p__public__enc__key__x.valueof(); + const OCTETSTRING public_enc_key_y = p__public__enc__key__y.valueof(); + result = security_services_its::get_instance().store_certificate( + p__cert__id, p__cert, p__private__key, p__public__key__x, p__public__key__y, p__public__key__compressed, p__public__key__compressed__mode, p__hash, + p__hash__256, p__hashid8, p__issuer, p__private__enc__key.valueof(), p__public__enc__key__x.valueof(), p__public__enc__key__y.valueof(), + p__public__enc__compressed__key.valueof(), p__public__enc__key__compressed__mode.valueof()); + } else { + result = security_services_its::get_instance().store_certificate( + p__cert__id, p__cert, p__private__key, p__public__key__x, p__public__key__y, p__public__key__compressed, p__public__key__compressed__mode, p__hash, + p__hash__256, p__hashid8, p__issuer, OCTETSTRING(0, nullptr), OCTETSTRING(0, nullptr), OCTETSTRING(0, nullptr), OCTETSTRING(0, nullptr), INTEGER(-1)); + } + + return (result == 0); + } + + /** + * \brief Unload from memory cache the certificates + * \return true on success, false otherwise + */ + BOOLEAN fx__unloadCertificates() { return TRUE; } + + /** + * \brief Read the specified certificate + * \param p_certificate_id the certificate identifier + * \param p_certificate the expected certificate + * \return true on success, false otherwise + */ + BOOLEAN fx__readCertificate(const CHARSTRING &p__certificateId, OCTETSTRING &p__certificate) { + loggers::get_instance().log(">>> fx__readCertificate: '%s'", static_cast(p__certificateId)); + + if (security_services_its::get_instance().read_certificate(p__certificateId, p__certificate) == -1) { + return FALSE; + } + + return TRUE; + } + + BOOLEAN fx__readCertificateFromDigest(const OCTETSTRING &p__digest, CHARSTRING &p__certificateId) { + loggers::get_instance().log_msg(">>> fx__readCertificateFromDigest: ", p__digest); + + if (security_services_its::get_instance().read_certificate_from_digest(p__digest, p__certificateId) == -1) { + return FALSE; + } + loggers::get_instance().log_msg("fx__readCertificateFromDigest: ", p__certificateId); + + return TRUE; + } + + BOOLEAN fx__readCertificateFromHashedId3(const OCTETSTRING &p__digest, CHARSTRING &p__certificateId) { + loggers::get_instance().log_msg(">>> fx__readCertificateFromHashedId3: ", p__digest); + + if (security_services_its::get_instance().read_certificate_from_hashed_id3(p__digest, p__certificateId) == -1) { + return FALSE; + } + loggers::get_instance().log_msg("fx__readCertificateFromHashedId3: ", p__certificateId); + + return TRUE; + } + + /** + * \brief Read the specified certificate digest + * \param p_certificate_id the certificate identifier + * \param p_digest the expected certificate + * \return true on success, false otherwise + */ + BOOLEAN fx__readCertificateDigest(const CHARSTRING &p__certificateId, OCTETSTRING &p__digest) { + loggers::get_instance().log(">>> fx__readCertificateDigest: '%s'", static_cast(p__certificateId)); + + if (security_services_its::get_instance().read_certificate_digest(p__certificateId, p__digest) == -1) { + return FALSE; + } + + return TRUE; + } + + /** + * \brief Read the whole-hash of the certificate + * \param p_certificate_id the certificate identifier + * \param p_hash the expected certificate + * \return true on success, false otherwise + */ + BOOLEAN fx__readCertificateHash(const CHARSTRING &p__certificateId, OCTETSTRING &p__hash) { + loggers::get_instance().log(">>> fx__readCertificateHash: '%s'", static_cast(p__certificateId)); + + if (security_services_its::get_instance().read_certificate_hash(p__certificateId, p__hash) == -1) { + return FALSE; + } + + return TRUE; + } + + /** + * \brief Read the whole-hash of the certificate using SHA 256 + * \param p_certificate_id the certificate identifier + * \param p_hash the expected certificate + * \return true on success, false otherwise + */ + BOOLEAN fx__readCertificateHash256(const CHARSTRING &p__certificateId, OCTETSTRING &p__hash) { + loggers::get_instance().log(">>> fx__readCertificateHash256: '%s'", static_cast(p__certificateId)); + + if (security_services_its::get_instance().read_certificate_hash_sha_256(p__certificateId, p__hash) == -1) { + return FALSE; + } + + return TRUE; + } + + /** + * \brief Read the private keys for the specified certificate + * \param p_certificate_id the keys identifier + * \param p_signingPrivateKey the signing private key + * \return true on success, false otherwise + */ + BOOLEAN fx__readSigningKey(const CHARSTRING &p__certificateId, OCTETSTRING &p__signingPrivateKey) { + loggers::get_instance().log(">>> fx__readSigningKey: '%s'", static_cast(p__certificateId)); + + if (security_services_its::get_instance().read_private_key(p__certificateId, p__signingPrivateKey) == -1) { + return FALSE; + } + + return TRUE; + } + + /** + * \brief Read the private keys for the specified certificate + * \param p_keysId the keys identifier + * \param p_encryptPrivateKey the encrypt private key + * \return true on success, false otherwise + fx_readEncryptingKey(in charstring p_keysId, out Oct32 p_encryptingPrivateKey) return boolean; + */ + BOOLEAN fx__readEncryptingKey(const CHARSTRING &p__certificateId, OCTETSTRING &p__encryptingPrivateKey) { + loggers::get_instance().log(">>> fx__readSigningKey: '%s'", static_cast(p__certificateId)); + + if (security_services_its::get_instance().read_private_enc_key(p__certificateId, p__encryptingPrivateKey) == -1) { + return FALSE; + } + + return TRUE; + } + + BOOLEAN fx__reconstructPublicKeyNistP256( + const OCTETSTRING &p__cert__to__be__signed, + const OCTETSTRING &p__issuer, + const OCTETSTRING &p__reconstruct__public__key__compressed, + const INTEGER &p__compressedMode, + OCTETSTRING &p__public__key__x, + OCTETSTRING &p__public__key__y, + OCTETSTRING &p__public__key__compressed, + INTEGER &p__public__key__compressed_mode + ) { + loggers::get_instance().log_msg(">>> fx__reconstruct__public__key: p__cert__to__be__signed: ", p__cert__to__be__signed); + loggers::get_instance().log_msg(">>> fx__reconstruct__public__key: p__issuer: ", p__issuer); + loggers::get_instance().log_msg(">>> fx__reconstruct__public__key: p__reconstruct__public__key__compressed: ", p__reconstruct__public__key__compressed); + loggers::get_instance().log_msg(">>> fx__reconstruct__public__key: p__compressedMode: ", p__compressedMode); + + CHARSTRING certificate_id; + if (security_services_its::get_instance().read_certificate_from_digest(p__issuer, certificate_id) == -1) { + return FALSE; + } + OCTETSTRING public_key_x, public_key_y; + if (security_services_its::get_instance().read_public_keys(certificate_id, public_key_x, public_key_y) == -1) { + return FALSE; + } + // Create reconstruction key + security_ecc ecc(ec_elliptic_curves::nist_p_256, p__reconstruct__public__key__compressed, (p__compressedMode == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); + if (ecc.reconstruct_public_keys(p__cert__to__be__signed, public_key_x, public_key_y, p__public__key__x, p__public__key__y, p__public__key__compressed, p__public__key__compressed_mode) == -1) { + return FALSE; + } + + return TRUE; + } + + BOOLEAN fx__reconstructPublicKeyNistP256__test( + const OCTETSTRING &p__cert__to__be__signed, + const OCTETSTRING &p__issuer__public__key__x, + const OCTETSTRING &p__issuer__public__key__y, + const OCTETSTRING &p__reconstruct__public__key__compressed, + const INTEGER &p__compressedMode, + OCTETSTRING &p__public__key__x, + OCTETSTRING &p__public__key__y, + OCTETSTRING &p__public__key__compressed, + INTEGER &p__public__key__compressed_mode + ) { + loggers::get_instance().log_msg(">>> fx__reconstructPublicKeyNistP256__test: p__cert__to__be__signed: ", p__cert__to__be__signed); + loggers::get_instance().log_msg(">>> fx__reconstructPublicKeyNistP256__test: p__issuer__public__key__x: ", p__issuer__public__key__x); + loggers::get_instance().log_msg(">>> fx__reconstructPublicKeyNistP256__test: p__issuer__public__key__y: ", p__issuer__public__key__y); + loggers::get_instance().log_msg(">>> fx__reconstructPublicKeyNistP256__test: p__reconstruct__public__key__compressed: ", p__reconstruct__public__key__compressed); + loggers::get_instance().log_msg(">>> fx__reconstructPublicKeyNistP256__test: p__compressedMode: ", p__compressedMode); + + // Create reconstruction key + security_ecc ecc(ec_elliptic_curves::nist_p_256, p__reconstruct__public__key__compressed, (p__compressedMode == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); + if (ecc.reconstruct_public_keys(p__cert__to__be__signed, p__issuer__public__key__x, p__issuer__public__key__y, p__public__key__x, p__public__key__y, p__public__key__compressed, p__public__key__compressed_mode) == -1) { + return FALSE; + } + + return TRUE; + } + + // group geospacial + + /* * \brief 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 + fx_isValidPolygonalRegion(in PolygonalRegion p_region) return boolean; + */ + BOOLEAN fx__isValidPolygonalRegion(const Ieee1609Dot2BaseTypes::PolygonalRegion &p__region) { return TRUE; } + + /* * \brief Check if a polygonal region 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 + fx_isPolygonalRegionInside(in PolygonalRegion p_parent, in PolygonalRegion p_region) return boolean; + */ + BOOLEAN fx__isPolygonalRegionInside(const Ieee1609Dot2BaseTypes::PolygonalRegion &p__parent, const Ieee1609Dot2BaseTypes::PolygonalRegion &p__region) { + return TRUE; + } + + /* * \brief 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 + fx_isLocationInsideCircularRegion(in CircularRegion p_region, in ThreeDLocation p_location) return boolean; + */ + BOOLEAN fx__isLocationInsideCircularRegion(const Ieee1609Dot2BaseTypes::CircularRegion &p__region, const Ieee1609Dot2BaseTypes::ThreeDLocation &p__location) { + return TRUE; + } + + /* * \brief 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 + fx_isLocationInsideRectangularRegion(in SequenceOfRectangularRegion p_region, in ThreeDLocation p_location) return boolean; + */ + BOOLEAN fx__isLocationInsideRectangularRegion(const Ieee1609Dot2BaseTypes::SequenceOfRectangularRegion &p__region, + const Ieee1609Dot2BaseTypes::ThreeDLocation & p__location) { + return TRUE; + } + + /* * \brief 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 + fx_isLocationInsidePolygonalRegion(in PolygonalRegion p_region, in ThreeDLocation p_location) return boolean; + */ + BOOLEAN fx__isLocationInsidePolygonalRegion(const Ieee1609Dot2BaseTypes::PolygonalRegion &p__region, + const Ieee1609Dot2BaseTypes::ThreeDLocation & p__location) { + return TRUE; + } + + /* * \brief 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 + fx_isLocationInsideIdentifiedRegion(in IdentifiedRegion p_region, in ThreeDLocation p_location) return boolean; + */ + BOOLEAN fx__isLocationInsideIdentifiedRegion(const Ieee1609Dot2BaseTypes::IdentifiedRegion &p__region, + const Ieee1609Dot2BaseTypes::ThreeDLocation & p__location) { + return TRUE; + } + + /* * \brief 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 + fx_isLocationInsideOtherRegion(in octetstring p_region, in ThreeDLocation p_location) return boolean; + */ + BOOLEAN fx__isLocationInsideOtherRegion(const OCTETSTRING &p_region, const Ieee1609Dot2BaseTypes::ThreeDLocation &p_location) { return TRUE; } + + /** + * \brief Check that p_circular_region_1 circular region is included into p_circular_region_2 circular region + * \param p_circular_region_1 Circular region 1 + * \param p_circular_region_2 Circular region 2 + * \return true on success, false otherwise + fx_areCirclesInside(in CircularRegion p_circular_region_1, in CircularRegion p_circular_region_2) return boolean; + */ + BOOLEAN fx__areCirclesInside(const Ieee1609Dot2BaseTypes::CircularRegion &p_circular_region_1, + const Ieee1609Dot2BaseTypes::CircularRegion &p_circular_region_2) { + // Compute distance between the 2 radius + FLOAT d = LibItsCommon__Functions::fx__computeDistance(p_circular_region_1.center().latitude(), p_circular_region_1.center().longitude(), + p_circular_region_2.center().latitude(), p_circular_region_2.center().longitude()); + if ((float)abs(p_circular_region_1.radius() - p_circular_region_2.radius()) > (float)d) { + return FALSE; + } + return TRUE; + } + + /* * \brief Check that p_rectanglar_region_1 rectangular region is included into p_rectanglar_region_2 rectangular region + * \param p_rectanglar_region_1 Rectangular region 1 + * \param p_rectanglar_region_2 Rectangular region 2 + * \return true on success, false otherwise + fx_areRectanglesInside(in SequenceOfRectangularRegion p_rectanglar_region_1, in SequenceOfRectangularRegion p_rectanglar_region_2) return boolean; + */ + BOOLEAN fx__areRectanglesInside(const Ieee1609Dot2BaseTypes::SequenceOfRectangularRegion &p_rectanglar_region_1, + const Ieee1609Dot2BaseTypes::SequenceOfRectangularRegion &p_rectanglar_region_2) { + + return TRUE; + } + + /* * \brief Check that p_polygonal_region_1 polygonal region is included into p_polygonal_region_2 polygonal region + * \param p_polygonal_region_1 Polygonal region 1 + * \param p_polygonal_region_2 Polygonal region 2 + * \return true on success, false otherwise + fx_arePolygonsInside(in PolygonalRegion p_polygonal_region_1, in PolygonalRegion p_polygonal_region_2) return boolean; + */ + BOOLEAN fx__arePolygonsInside(const Ieee1609Dot2BaseTypes::PolygonalRegion &p_polygonal_region_1, + const Ieee1609Dot2BaseTypes::PolygonalRegion &p_polygonal_region_2) { + return TRUE; + } + + /** + * \brief Convert a spacial coordinate from DMS to DMS + * \param p_degrees The degrees (D) + * \param p_minutes The minutes (M) + * \param p_seconds The seconds (S) + * \param p_latlon The latitude/longitude: (N|S|E|W) + * \return The decimal coordinate on success, 0.0, otherwise + * @verdict Unchanged + fx_dms2dd(in Int p_degrees, in Int p_minutes, in float p_seconds, in Oct1 p_latlon) return float; + */ + FLOAT fx__dms2dd(const INTEGER &p__degrees, const INTEGER &p__minutes, const FLOAT &p__seconds, const OCTETSTRING &p__latlon) { return 0.0; } + + FLOAT fx__int2ddlat(const INTEGER &p__latitude) { return (float)((float)p__latitude / 10000000.0); } + + FLOAT fx__int2ddlon(const INTEGER &p__longitude) { return (float)((float)p__longitude / 1000000.0); } + +} // namespace LibItsSecurity__Functions diff --git a/ccsrc/Protocols/Mbr/etsi_ts103759_data_codec.cc b/ccsrc/Protocols/Mbr/etsi_ts103759_data_codec.cc index 8e07e9d..51c8c8f 100644 --- a/ccsrc/Protocols/Mbr/etsi_ts103759_data_codec.cc +++ b/ccsrc/Protocols/Mbr/etsi_ts103759_data_codec.cc @@ -5,7 +5,6 @@ int etsi_ts103759_data_codec::encode(const EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_103759_data, OCTETSTRING &p_data) { loggers::get_instance().log(">>> etsi_ts103759_data_codec::encode: %s", p_etsi_ts_103759_data.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_etsi_ts_103759_data.encode(*p_etsi_ts_103759_data.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Pki/etsi_ts102941_trust_lists_ctl_format.cc b/ccsrc/Protocols/Pki/etsi_ts102941_trust_lists_ctl_format.cc index f0c8804..49a7bb6 100644 --- a/ccsrc/Protocols/Pki/etsi_ts102941_trust_lists_ctl_format.cc +++ b/ccsrc/Protocols/Pki/etsi_ts102941_trust_lists_ctl_format.cc @@ -5,7 +5,6 @@ int etsi_ts102941_trust_lists_ctl_format::encode(const EtsiTs102941TrustLists::CtlFormat &p_ctl_format, OCTETSTRING &p_data) { loggers::get_instance().log(">>> etsi_ts102941_trust_lists_ctl_format::encode: %s", p_ctl_format.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_ctl_format.encode(*p_ctl_format.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/certificates_loader.cc b/ccsrc/Protocols/Security/certificates_loader.cc index 60c5b80..34ba086 100644 --- a/ccsrc/Protocols/Security/certificates_loader.cc +++ b/ccsrc/Protocols/Security/certificates_loader.cc @@ -6,6 +6,7 @@ #include "certificates_loader.hh" #include "etsi_ts103097_certificate_codec.hh" +#include "etsi_ts103097_tobesigned_certificate_codec.hh" #include "sha256.hh" #include "sha384.hh" @@ -14,11 +15,31 @@ #include "loggers.hh" +bool security_cache_comp::operator()(const OCTETSTRING &p_lhs, const OCTETSTRING &p_rhs) const { + // loggers::get_instance().log_msg(">>> security_cache_comp::operator(): p_lhs= ", p_lhs); + // loggers::get_instance().log_msg(">>> security_cache_comp::operator(): p_rhs= ", p_rhs); + unsigned char *first1 = (unsigned char *)static_cast(p_lhs); + unsigned char *first2 = (unsigned char *)static_cast(p_rhs); + unsigned char *last1 = p_lhs.lengthof() + (unsigned char *)static_cast(p_lhs); + unsigned char *last2 = p_rhs.lengthof() + (unsigned char *)static_cast(p_rhs); + + while (first1 != last1) { + if ((first2 == last2) || (*first2 < *first1)) { + return false; + } else if (*first1 < *first2) { + return true; + } + ++first1; + ++first2; + } // End of 'while' statement + return (first2 != last2); +} + certificates_loader *certificates_loader::instance = nullptr; certificates_loader::certificates_loader() : _certificateExt{".oer"}, _privateKeyExt{".vkey"}, _privateEncKeyExt{".ekey"}, - _full_path(), _is_cache_initialized{false}, _directory_filter{".svn", "._.DS_Store", ".DS_Store"} { + _full_path(), _is_cache_initialized{false}, _directory_filter{".svn", "._.DS_Store", ".DS_Store"}, _hashed_id8s() { // loggers::get_instance().log(">>> certificates_loader::certificates_loader"); } // End of ctor @@ -53,7 +74,7 @@ int certificates_loader::build_path(const std::string &p_root_directory) { return 0; } // End of method build_path -int certificates_loader::build_certificates_index(std::map &p_certificates_idx, std::map &p_hashed_id8s) { +int certificates_loader::build_certificates_index(std::map &p_certificates_idx) { loggers::get_instance().log(">>> certificates_loader::build_certificates_index"); // Sanity check @@ -83,7 +104,7 @@ int certificates_loader::build_certificates_index(std::map(h, certificate)); + _hashed_id8s.insert(std::pair(h, certificate)); } // End of 'while' statement is.close(); @@ -92,6 +113,10 @@ int certificates_loader::build_certificates_index(std::map& certificates_loader::get_hashed_id8s() { + return _hashed_id8s; +} + int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const std::string p_certificate_name, std::map> & p_certificates) { loggers::get_instance().log_msg(">>> certificates_loader::load_certificate", p_hashed_id8); loggers::get_instance().log(">>> certificates_loader::load_certificate: %s", p_certificate_name.c_str()); @@ -111,15 +136,15 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const // Load private key file OCTETSTRING private_key; p = p.replace_extension(_privateKeyExt); - // loggers::get_instance().log("certificates_loader::build_certificates_cache: Caching private keys '%s'", p.string().c_str()); + // loggers::get_instance().log("certificates_loader::load_certificate: Caching private keys '%s'", p.string().c_str()); is.open(p, ios::in | ios::binary); if (!is.is_open()) { - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Failed to open Private key"); + loggers::get_instance().warning("certificates_loader::load_certificate: Failed to open Private key"); private_key = OCTETSTRING(0, nullptr); } else { int size = std::experimental::filesystem::file_size(p); if ((size != 32) && (size != 48)) { - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Private key size is incorrect for '%s'", key.c_str()); + loggers::get_instance().warning("certificates_loader::load_certificate: Private key size is incorrect for '%s'", key.c_str()); return -1; } private_key = int2oct(0, size); @@ -130,15 +155,15 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const // Load private encryption key file if present OCTETSTRING private_enc_key; p = p.replace_extension(_privateEncKeyExt); - // loggers::get_instance().log("certificates_loader::build_certificates_cache: Caching private encryption key '%s'", p.string().c_str()); + // loggers::get_instance().log("certificates_loader::load_certificate: Caching private encryption key '%s'", p.string().c_str()); is.open(p, ios::in | ios::binary); if (!is.is_open()) { - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Failed to open Private encryption key file"); + loggers::get_instance().warning("certificates_loader::load_certificate: Failed to open Private encryption key file"); private_enc_key = OCTETSTRING(0, nullptr); } else { int size = std::experimental::filesystem::file_size(p); - if (size != 32) { // IEEE Std 1609.2 2017: NistP256 or BrainpoolP256r1 - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Private encryption key size is incorrect for '%s'", key.c_str()); + if (size != 32) { // IEEE Std 1609.2 2017: NistP256 or BrainpoolP256r1 or Sm2P256 + loggers::get_instance().warning("certificates_loader::load_certificate: Private encryption key size is incorrect for '%s'", key.c_str()); return -1; } private_enc_key = int2oct(0, size); @@ -146,42 +171,22 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const is.close(); } + // Whole-certificate hash using SHA-256 + OCTETSTRING hash_sha_256; + sha256 sha; + sha.generate(certificate, hash_sha_256); + loggers::get_instance().log_msg("certificates_loader::load_certificate: Whole-certificate SHA-256 hash for encryption: ", hash_sha_256); + std::pair>::iterator, bool> result; // Build DB record etsi_ts103097_certificate_codec codec; Ieee1609Dot2::CertificateBase decoded_certificate; codec.decode(certificate, decoded_certificate); if (!decoded_certificate.is_bound()) { - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Failed to decode certificate for '%s'", key.c_str()); + loggers::get_instance().warning("certificates_loader::load_certificate: Failed to decode certificate for '%s'", key.c_str()); return -1; } else { - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Decoded certificate: ", decoded_certificate); - // Prepare all fields - if (!decoded_certificate.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_verificationKey)) { - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Wrong VerificationKeyIndicator variant for '%s'", key.c_str()); - return -1; - } - OCTETSTRING public_key_x; - OCTETSTRING public_key_y; - OCTETSTRING public_comp_key; // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) - Ieee1609Dot2BaseTypes::PublicVerificationKey &b = decoded_certificate.toBeSigned().verifyKeyIndicator().verificationKey(); - if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP256)) { - Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaNistP256(); - fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, public_comp_key, public_key_x, public_key_y); - } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP384)) { - Ieee1609Dot2BaseTypes::EccP384CurvePoint &p = b.ecdsaNistP384(); - fill_public_key_vectors(ec_elliptic_curves::nist_p_384, p, public_comp_key, public_key_x, public_key_y); - } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP256r1)) { - Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaBrainpoolP256r1(); - fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, public_comp_key, public_key_x, public_key_y); - } else { // ALT_ecdsaBrainpoolP384r1 - Ieee1609Dot2BaseTypes::EccP384CurvePoint &p = b.ecdsaBrainpoolP384r1(); - fill_public_key_vectors(ec_elliptic_curves::brainpool_p_384_r1, p, public_comp_key, public_key_x, public_key_y); - } - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_key_x: ", public_key_x); - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_key_y: ", public_key_y); - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_comp_key: ", public_comp_key); - + // Extract common part of the certificate OCTETSTRING public_enc_key_x; OCTETSTRING public_enc_key_y; OCTETSTRING public_enc_comp_key; @@ -195,41 +200,20 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const } else if (b.ischosen(Ieee1609Dot2BaseTypes::BasePublicEncryptionKey::ALT_eciesBrainpoolP256r1)) { Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = v.publicKey().eciesBrainpoolP256r1(); fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, public_enc_comp_key, public_enc_key_x, public_enc_key_y); + } else if (b.ischosen(Ieee1609Dot2BaseTypes::BasePublicEncryptionKey::ALT_ecencSm2)) { + Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = v.publicKey().ecencSm2(); + fill_public_key_vectors(ec_elliptic_curves::sm2_p_256, p, public_enc_comp_key, public_enc_key_x, public_enc_key_y); } - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_enc_key_x: ", public_enc_key_x); - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_enc_key_y: ", public_enc_key_y); - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: public_enc_comp_key: ", public_enc_comp_key); + // loggers::get_instance().log_msg("certificates_loader::load_certificate: public_enc_key_x: ", public_enc_key_x); + // loggers::get_instance().log_msg("certificates_loader::load_certificate: public_enc_key_y: ", public_enc_key_y); + // loggers::get_instance().log_msg("certificates_loader::load_certificate: public_enc_comp_key: ", public_enc_comp_key); } else { public_enc_key_x = OCTETSTRING(0, nullptr); public_enc_key_y = OCTETSTRING(0, nullptr); public_enc_comp_key = OCTETSTRING(0, nullptr); } - OCTETSTRING hash_sha_256; // Whole-certificate hash using SHA-256 - sha256 sha; - sha.generate(certificate, hash_sha_256); - loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Whole-certificate SHA-256 hash for encryption: ", hash_sha_256); - - OCTETSTRING hash; // Whole-certificate hash - OCTETSTRING hashed_id; // Whole-certificate hashedid-8 OCTETSTRING issuer; // Certificate issuer - if (public_key_x.lengthof() == 32) { // See IEEE Std 1609.2a-2017 Clause 6.4.3 CertificateBase - hash = hash_sha_256; - loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Whole-certificate SHA-256 hash: ", hash); - hashed_id = OCTETSTRING(8, static_cast(hash) + hash.lengthof() - 8); - } else if (public_key_x.lengthof() == 48) { - sha384 sha; - sha.generate(certificate, hash); - loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Whole-certificate SHA-384 hash: ", hash); - hashed_id = OCTETSTRING(8, static_cast(hash) + hash.lengthof() - 8); - } else { - hash = OCTETSTRING(0, nullptr); - hash_sha_256 = OCTETSTRING(0, nullptr); - hashed_id = int2oct(0, 8); - } - loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: hash: ", hash); - loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: hashed_id: ", hashed_id); - if (decoded_certificate.issuer().ischosen(Ieee1609Dot2::IssuerIdentifier::ALT_sha256AndDigest)) { issuer = decoded_certificate.issuer().sha256AndDigest(); } else if (decoded_certificate.issuer().ischosen(Ieee1609Dot2::IssuerIdentifier::ALT_sha384AndDigest)) { @@ -239,43 +223,241 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const if (decoded_certificate.issuer().self__() == Ieee1609Dot2BaseTypes::HashAlgorithm::sha256) { sha256 sha; sha.generate(certificate, h); - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Whole-certificate SHA-256 hash: ", hash); + // loggers::get_instance().log_msg("certificates_loader::load_certificate: Whole-certificate SHA-256 hash: ", hash); } else { sha384 sha; sha.generate(certificate, h); - // loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Whole-certificate SHA-384 hash: ", hash); + // loggers::get_instance().log_msg("certificates_loader::load_certificate: Whole-certificate SHA-384 hash: ", hash); } issuer = OCTETSTRING(8, static_cast(h) + h.lengthof() - 8); } else { issuer = int2oct(0, 8); } - loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: issuer: ", issuer); - - // Create new record - security_db_record *p = new security_db_record( - key, - certificate, // Certificate - decoded_certificate, - issuer, // Hashed ID fo the issuer - hash, hash_sha_256, - hashed_id, // Hashed ID - private_key, // Private key - public_key_x, // public keys X-coordinate - public_key_y, // public keys Y-coordinate - public_comp_key, // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) - private_enc_key, // Private encryption key - public_enc_key_x, // Public encryption key X-coordinate - public_enc_key_y, // Public encryption key Y-coordinate - public_enc_comp_key // Public compressed encryption key - ); - result = p_certificates.insert(std::pair>(key, std::unique_ptr(p))); - if (result.second == false) { - loggers::get_instance().warning("certificates_loader::build_certificates_cache: Failed to insert new record '%s'", key.c_str()); - delete p; - return -1; + loggers::get_instance().log_msg("certificates_loader::load_certificate: issuer: ", issuer); + + if (decoded_certificate.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_verificationKey)) { + // loggers::get_instance().log_msg("certificates_loader::load_certificate: Decoded certificate: ", decoded_certificate); + OCTETSTRING public_key_x; + OCTETSTRING public_key_y; + OCTETSTRING public_comp_key; // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) + Ieee1609Dot2BaseTypes::PublicVerificationKey &b = decoded_certificate.toBeSigned().verifyKeyIndicator().verificationKey(); + if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP256)) { + Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaNistP256(); + fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, public_comp_key, public_key_x, public_key_y); + } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP384)) { + Ieee1609Dot2BaseTypes::EccP384CurvePoint &p = b.ecdsaNistP384(); + fill_public_key_vectors(ec_elliptic_curves::nist_p_384, p, public_comp_key, public_key_x, public_key_y); + } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP256r1)) { + Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaBrainpoolP256r1(); + fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, public_comp_key, public_key_x, public_key_y); + } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP384r1)) { + Ieee1609Dot2BaseTypes::EccP384CurvePoint &p = b.ecdsaBrainpoolP384r1(); + fill_public_key_vectors(ec_elliptic_curves::brainpool_p_384_r1, p, public_comp_key, public_key_x, public_key_y); + } else { // ALT_ecsigSm2 + Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecsigSm2(); + fill_public_key_vectors(ec_elliptic_curves::sm2_p_256, p, public_comp_key, public_key_x, public_key_y); + } + // loggers::get_instance().log_msg("certificates_loader::load_certificate: public_key_x: ", public_key_x); + // loggers::get_instance().log_msg("certificates_loader::load_certificate: public_key_y: ", public_key_y); + // loggers::get_instance().log_msg("certificates_loader::load_certificate: public_comp_key: ", public_comp_key); + + OCTETSTRING hash; // Whole-certificate hash + OCTETSTRING hashed_id; // Whole-certificate hashedid-8 + if (public_key_x.lengthof() == 32) { // See IEEE Std 1609.2a-2017 Clause 6.4.3 CertificateBase + hash = hash_sha_256; + loggers::get_instance().log_msg("certificates_loader::load_certificate: Whole-certificate SHA-256 hash: ", hash); + hashed_id = OCTETSTRING(8, static_cast(hash) + hash.lengthof() - 8); + } else if (public_key_x.lengthof() == 48) { + sha384 sha; + sha.generate(certificate, hash); + loggers::get_instance().log_msg("certificates_loader::load_certificate: Whole-certificate SHA-384 hash: ", hash); + hashed_id = OCTETSTRING(8, static_cast(hash) + hash.lengthof() - 8); + } else { + hash = OCTETSTRING(0, nullptr); + hash_sha_256 = OCTETSTRING(0, nullptr); + hashed_id = int2oct(0, 8); + } + loggers::get_instance().log_msg("certificates_loader::load_certificate: hash: ", hash); + loggers::get_instance().log_msg("certificates_loader::load_certificate: hashed_id: ", hashed_id); + + + + + loggers::get_instance().log("certificates_loader::load_certificate: ######## key: '%s'", key.c_str()); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## certificate: ", certificate); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## decoded_certificate: ", decoded_certificate); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## issuer: ", issuer); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## hash: ", hash); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## hash_sha_256: ", hash_sha_256); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## hashed_id: ", hashed_id); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## private_key: ", private_key); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_key_x: ", public_key_x); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_key_y: ", public_key_y); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_comp_key: ", public_comp_key); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## private_enc_key: ", private_enc_key); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_enc_key_x: ", public_enc_key_x); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_enc_key_y: ", public_enc_key_y); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_enc_comp_key: ", public_enc_comp_key); + + + + + // Create new record + security_db_record *r = new security_db_record( + key, // Certificate name. Index key + certificate, // Certificate + decoded_certificate, + issuer, // Hashed ID fo the issuer + hash, // Hash of the certificate + hash_sha_256, // Whole-certificate SHA256 + hashed_id, // Hashed ID + private_key, // Private key + public_key_x, // public keys X-coordinate + public_key_y, // public keys Y-coordinate + public_comp_key, // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) + private_enc_key, // Private encryption key + public_enc_key_x, // Public encryption key X-coordinate + public_enc_key_y, // Public encryption key Y-coordinate + public_enc_comp_key // Public compressed encryption key + ); + result = p_certificates.insert(std::pair>(key, std::unique_ptr(r))); + if (result.second == false) { + loggers::get_instance().warning("certificates_loader::load_certificate: Failed to insert new record '%s'", key.c_str()); + delete r; + return -1; + } + } else if (decoded_certificate.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_reconstructionValue)) { + // Load certificate issuer + std::map::const_iterator it = _hashed_id8s.find(issuer); + if (it == _hashed_id8s.cend()) { + loggers::get_instance().warning("certificates_loader::load_certificate: Cannot find issuer of implicit certificate"); + return -1; + } + std::map> m; + if (load_certificate(issuer, it->second, m) == -1) { + loggers::get_instance().warning("certificates_loader::load_certificate: Cannot load implicit certificate issuer"); + return -1; + } + // The signing algorithm is provided by the issuer certificate + if (!m.cbegin()->second->decoded_certificate().toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_verificationKey)) { + loggers::get_instance().warning("certificates_loader::load_certificate: Inconsistent certificate issuer: Wrong VerificationKeyIndicator"); + return -1; + } + loggers::get_instance().log_msg("certificates_loader::load_certificate: Implicit certificate issuer: ", m.cbegin()->second->decoded_certificate()); + // Retrieve the issuer signing key + const Ieee1609Dot2BaseTypes::PublicVerificationKey &b = m.cbegin()->second->decoded_certificate().toBeSigned().verifyKeyIndicator().verificationKey(); + ec_elliptic_curves algo; + OCTETSTRING issuer_sign_key_x; + OCTETSTRING issuer_sign_key_y; + OCTETSTRING issuer_sign_key_comp_key; // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) + if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP256)) { + const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaNistP256(); + fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, issuer_sign_key_comp_key, issuer_sign_key_x, issuer_sign_key_y); + algo = ec_elliptic_curves::nist_p_256; + } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP256r1)) { + const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaBrainpoolP256r1(); + fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, issuer_sign_key_comp_key, issuer_sign_key_x, issuer_sign_key_y); + algo = ec_elliptic_curves::brainpool_p_256_r1; + } else { + loggers::get_instance().warning("certificates_loader::load_certificate: Incosistent certificate issuer: Wrong PublicVerificationKey"); + return -1; + } + // Retrieve the reconstruction key key + const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = decoded_certificate.toBeSigned().verifyKeyIndicator().reconstructionValue(); + OCTETSTRING rv_key_x; + OCTETSTRING rv_key_y; + OCTETSTRING rv_comp_key; // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) + fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, rv_comp_key, rv_key_x, rv_key_y); + // Compute the hash od the toBeSigned + OCTETSTRING tbs; + etsi_ts103097_tobesigned_certificate_codec codec; + codec.encode(decoded_certificate.toBeSigned(), tbs); + if (!tbs.is_bound()) { + loggers::get_instance().warning("certificates_loader::load_certificate: Failed to encode toBeSigned"); + return -1; + } + loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Implicit encoded toBeSigned: ", tbs); + OCTETSTRING hash_tbs; + sha256 sha; + sha.generate(tbs, hash_tbs); + loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Implicit hash(toBeSignedCertificate): ", hash_tbs); + loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Implicit issuer hash: ", m.cbegin()->second->hash_sha_256()); + OCTETSTRING input = hash_tbs + m.cbegin()->second->hash_sha_256(); + loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: input: ", input); + // Reconstruction of the public key. + security_ecc r_key(algo, rv_key_x, rv_key_y); // Reconstruction key + OCTETSTRING public_key_x; // public keys X-coordinate + OCTETSTRING public_key_y; // public keys Y-coordinate + OCTETSTRING public_comp_key; // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) + INTEGER public_comp_key_mode; // public compressed key mode (02 or 03) + if (r_key.reconstruct_public_keys(input, static_cast(issuer_sign_key_x), static_cast(issuer_sign_key_y), public_key_x, public_key_y, public_comp_key, public_comp_key_mode) == -1) { + loggers::get_instance().warning("certificates_loader::load_certificate: Failed to encode toBeSigned"); + return -1; + } + loggers::get_instance().log_msg("certificates_loader::load_certificate: public_key_x: ", public_key_x); + loggers::get_instance().log_msg("certificates_loader::load_certificate: public_key_y: ", public_key_y); + loggers::get_instance().log_msg("certificates_loader::load_certificate: public_comp_key: ", public_comp_key); + loggers::get_instance().log("certificates_loader::load_certificate: public_comp_key_mode: '%d': ", public_comp_key_mode); + + OCTETSTRING hash = hash_sha_256; // Whole-certificate hash + OCTETSTRING hashed_id; // Whole-certificate hashedid-8 + hashed_id = OCTETSTRING(8, static_cast(hash) + hash.lengthof() - 8); + loggers::get_instance().log_msg("certificates_loader::load_certificate: hash: ", hash); + loggers::get_instance().log_msg("certificates_loader::load_certificate: hashed_id: ", hashed_id); + + + + + loggers::get_instance().log("certificates_loader::load_certificate: ######## key: '%s'", key.c_str()); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## certificate: ", certificate); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## decoded_certificate: ", decoded_certificate); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## issuer: ", issuer); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## hash: ", hash); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## hash_sha_256: ", hash_sha_256); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## hashed_id: ", hashed_id); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## private_key: ", private_key); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_key_x: ", public_key_x); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_key_y: ", public_key_y); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_comp_key: ", public_comp_key); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## private_enc_key: ", private_enc_key); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_enc_key_x: ", public_enc_key_x); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_enc_key_y: ", public_enc_key_y); + loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_enc_comp_key: ", public_enc_comp_key); + + + + + + // Create new record + security_db_record *r = new security_db_record( + key, // Certificate name. Index key + certificate, // Certificate + decoded_certificate, + issuer, // Hashed ID fo the issuer + hash, // Hash of the certificate + hash_sha_256, // Whole-certificate SHA256 + hashed_id, // Hashed ID + private_key, // Private key + public_key_x, // public keys X-coordinate + public_key_y, // public keys Y-coordinate + public_comp_key, // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) + private_enc_key, // Private encryption key + public_enc_key_x, // Public encryption key X-coordinate + public_enc_key_y, // Public encryption key Y-coordinate + public_enc_comp_key // Public compressed encryption key + ); + result = p_certificates.insert(std::pair>(key, std::unique_ptr(r))); + if (result.second == false) { + loggers::get_instance().warning("certificates_loader::load_certificate: Failed to insert new record '%s'", key.c_str()); + delete r; + return -1; + } + } else { + loggers::get_instance().error("certificates_loader::build_certificates_cache: Unsupported verifyKeyIndicator variant"); } } + loggers::get_instance().log("<<< certificates_loader::build_certificates_cache: 0"); return 0; } diff --git a/ccsrc/Protocols/Security/certificates_loader.hh b/ccsrc/Protocols/Security/certificates_loader.hh index 20e5364..eb8f9f4 100644 --- a/ccsrc/Protocols/Security/certificates_loader.hh +++ b/ccsrc/Protocols/Security/certificates_loader.hh @@ -18,7 +18,7 @@ #include -#include "security_cache.hh" +// #include "security_cache.hh" #include "security_db_record.hh" #include "security_ecc.hh" @@ -27,6 +27,10 @@ namespace Ieee1609Dot2BaseTypes { class EccP384CurvePoint; //! Declare TITAN class } // namespace Ieee1609Dot2BaseTypes +struct security_cache_comp { + bool operator()(const OCTETSTRING &p_lhs, const OCTETSTRING &p_rhs) const; +}; + /*! * \class certificates_loader * \brief This class provides mechanism to load the certificates from the filesystem according the struecture defined in ETSI TS 103 099 @@ -40,6 +44,8 @@ class certificates_loader { bool _is_cache_initialized; //! Set to true when certificates are successfully loaded from file system std::set _directory_filter; //! Directory filter (for local development purposes only) static certificates_loader * instance; //! Unique static object reference of this class + std::map _hashed_id8s; + //! List of the certificates indexed by the HashedId8 /*! * \brief Default private ctor @@ -49,6 +55,7 @@ class certificates_loader { * \brief Default private dtor */ ~certificates_loader() { + _hashed_id8s.clear(); if (instance != NULL) { delete instance; instance = NULL; @@ -73,13 +80,13 @@ public: /*! \publicsection */ */ int build_path(const std::string &p_root_directory); /*! - * \fn int build_certificates_index(std::map &p_certificates_idx, std::map &p_hashed_id8s); + * \fn int build_certificates_index(std::map &p_certificates_idx); * \brief Store in memory the index of the certitifcates as a tuple {HashedId8, Certificate Name} * \param[in] p_certificates_idx Memory stored index, key is the certificate name * \param[in] p_hashed_id8s Memory stored index, key is the HashedId8 * \return 0 on success, -1 otherwise */ - int build_certificates_index(std::map &p_certificates_idx, std::map &p_hashed_id8s); + int build_certificates_index(std::map &p_certificates_idx); /*! * \fn int load_certificate(const OCTETSTRING& p_hashed_id8, const std::string p_certificate_name, std::map> & p_certificates); * \brief Store in memory the specified certificate @@ -96,6 +103,12 @@ public: /*! \publicsection */ * \return 0 on success, -1 otherwise */ int save_certificate(const security_db_record &p_certificate); + /*! + * \fn std::map& get_hashed_id8s() const; + * \brief Retrive the index of certificates name by whole hash certificate value + * \return The reference to the index + */ + std::map& get_hashed_id8s(); private: /*! \privatesection */ /*! diff --git a/ccsrc/Protocols/Security/etsi_ts102941_base_types_public_keys.cc b/ccsrc/Protocols/Security/etsi_ts102941_base_types_public_keys.cc index 4ffd841..52820f6 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_base_types_public_keys.cc +++ b/ccsrc/Protocols/Security/etsi_ts102941_base_types_public_keys.cc @@ -5,7 +5,6 @@ int etsi_ts102941_base_types_public_keys::encode(const EtsiTs102941BaseTypes::PublicKeys &p_public_keys, OCTETSTRING &p_data) { loggers::get_instance().log(">>> etsi_ts102941_base_types_public_keys::encode: %s", p_public_keys.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_public_keys.encode(*p_public_keys.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_data_codec.cc b/ccsrc/Protocols/Security/etsi_ts102941_data_codec.cc index 68e461b..e111fce 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_data_codec.cc +++ b/ccsrc/Protocols/Security/etsi_ts102941_data_codec.cc @@ -5,7 +5,6 @@ int etsi_ts102941_data_codec::encode(const EtsiTs102941MessagesCa::EtsiTs102941Data &p_etsi_ts_102941_data, OCTETSTRING &p_data) { loggers::get_instance().log(">>> etsi_ts102941_data_codec::encode: %s", p_etsi_ts_102941_data.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_etsi_ts_102941_data.encode(*p_etsi_ts_102941_data.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_data_content_codec.cc b/ccsrc/Protocols/Security/etsi_ts102941_data_content_codec.cc index 877c693..8d3d89c 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_data_content_codec.cc +++ b/ccsrc/Protocols/Security/etsi_ts102941_data_content_codec.cc @@ -5,7 +5,6 @@ int etsi_ts102941_data_content_codec::encode(const EtsiTs102941MessagesCa::EtsiTs102941DataContent &p_etsi_ts_10291_data_content, OCTETSTRING &p_data) { loggers::get_instance().log(">>> etsi_ts102941_data_content_codec::encode: %s", p_etsi_ts_10291_data_content.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_etsi_ts_10291_data_content.encode(*p_etsi_ts_10291_data_content.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_inner_request.cc b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_inner_request.cc index 5fa3aa9..c4d9491 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_inner_request.cc +++ b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_inner_request.cc @@ -5,7 +5,6 @@ int etsi_ts102941_types_authorization_inner_request::encode(const EtsiTs102941TypesAuthorization::InnerAtRequest &p_inner_request, OCTETSTRING &p_data) { loggers::get_instance().log(">>> etsi_ts102941_types_authorization_inner_request::encode: %s", p_inner_request.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_inner_request.encode(*p_inner_request.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_inner_response.cc b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_inner_response.cc index 09fbc86..fc49f04 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_inner_response.cc +++ b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_inner_response.cc @@ -5,7 +5,6 @@ int etsi_ts102941_types_authorization_inner_response::encode(const EtsiTs102941TypesAuthorization::InnerAtResponse &p_inner_response, OCTETSTRING &p_data) { loggers::get_instance().log(">>> etsi_ts102941_types_authorization_inner_response::encode: %s", p_inner_response.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_inner_response.encode(*p_inner_response.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_shared_at_request.cc b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_shared_at_request.cc index 1370a75..e8496f5 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_shared_at_request.cc +++ b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_shared_at_request.cc @@ -6,7 +6,6 @@ int etsi_ts102941_types_authorization_shared_at_request::encode(const EtsiTs1029 OCTETSTRING & p_data) { loggers::get_instance().log(">>> etsi_ts102941_types_authorization_shared_at_request::encode: %s", p_shared_at_request.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_shared_at_request.encode(*p_shared_at_request.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_request.cc b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_request.cc index accd048..7653416 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_request.cc +++ b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_request.cc @@ -7,7 +7,6 @@ int etsi_ts102941_types_authorization_validation_request::encode( loggers::get_instance().log(">>> etsi_ts102941_types_authorization_validation_request::encode: %s", p_authorization_validation_request.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_authorization_validation_request.encode(*p_authorization_validation_request.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_response.cc b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_response.cc index 168d4d6..1253a9c 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_response.cc +++ b/ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_response.cc @@ -7,7 +7,6 @@ int etsi_ts102941_types_authorization_validation_response::encode( loggers::get_instance().log(">>> etsi_ts102941_types_authorization_validation_response::encode: %s", p_authorization_validation_response.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_authorization_validation_response.encode(*p_authorization_validation_response.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_types_enrolment_inner_request.cc b/ccsrc/Protocols/Security/etsi_ts102941_types_enrolment_inner_request.cc index a741399..30b0c32 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_types_enrolment_inner_request.cc +++ b/ccsrc/Protocols/Security/etsi_ts102941_types_enrolment_inner_request.cc @@ -5,7 +5,6 @@ int etsi_ts102941_types_enrolment_inner_request::encode(const EtsiTs102941TypesEnrolment::InnerEcRequest &p_inner_request, OCTETSTRING &p_data) { loggers::get_instance().log(">>> etsi_ts102941_types_enrolment_inner_request::encode: %s", p_inner_request.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_inner_request.encode(*p_inner_request.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/etsi_ts102941_types_enrolment_inner_response.cc b/ccsrc/Protocols/Security/etsi_ts102941_types_enrolment_inner_response.cc index 99a1a44..589e781 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_types_enrolment_inner_response.cc +++ b/ccsrc/Protocols/Security/etsi_ts102941_types_enrolment_inner_response.cc @@ -5,7 +5,6 @@ int etsi_ts102941_types_enrolment_inner_response::encode(const EtsiTs102941TypesEnrolment::InnerEcResponse &p_inner_response, OCTETSTRING &p_data) { loggers::get_instance().log(">>> etsi_ts102941_types_enrolment_inner_response::encode: %s", p_inner_response.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_inner_response.encode(*p_inner_response.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/etsi_ts103097_certificate_codec.cc b/ccsrc/Protocols/Security/etsi_ts103097_certificate_codec.cc index 5fc427b..14c9ff0 100644 --- a/ccsrc/Protocols/Security/etsi_ts103097_certificate_codec.cc +++ b/ccsrc/Protocols/Security/etsi_ts103097_certificate_codec.cc @@ -9,7 +9,6 @@ int etsi_ts103097_certificate_codec::encode(const Ieee1609Dot2::CertificateBase &p_cert, OCTETSTRING &p_data) { loggers::get_instance().log(">>> etsi_ts103097_certificate_codec::encode: %s", p_cert.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_cert.encode(*p_cert.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/etsi_ts103097_data_codec.cc b/ccsrc/Protocols/Security/etsi_ts103097_data_codec.cc index 18e045d..6fe07e0 100644 --- a/ccsrc/Protocols/Security/etsi_ts103097_data_codec.cc +++ b/ccsrc/Protocols/Security/etsi_ts103097_data_codec.cc @@ -9,7 +9,6 @@ int etsi_ts103097_data_codec::encode(const Ieee1609Dot2::Ieee1609Dot2Data &p_ieee1609Dot2Data, OCTETSTRING &p_data) { loggers::get_instance().log(">>> etsi_ts103097_data_codec::encode: %s", p_ieee1609Dot2Data.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_ieee1609Dot2Data.encode(*p_ieee1609Dot2Data.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/etsi_ts103097_tobesigned_certificate_codec.cc b/ccsrc/Protocols/Security/etsi_ts103097_tobesigned_certificate_codec.cc index ab032fb..eee9014 100644 --- a/ccsrc/Protocols/Security/etsi_ts103097_tobesigned_certificate_codec.cc +++ b/ccsrc/Protocols/Security/etsi_ts103097_tobesigned_certificate_codec.cc @@ -9,7 +9,6 @@ int etsi_ts103097_tobesigned_certificate_codec::encode(const Ieee1609Dot2::ToBeSignedCertificate &p_cert, OCTETSTRING &data) { loggers::get_instance().log(">>> etsi_ts103097_tobesigned_certificate_codec::encode: %s", p_cert.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_cert.encode(*p_cert.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/etsi_ts103097_tobesigned_data_codec.cc b/ccsrc/Protocols/Security/etsi_ts103097_tobesigned_data_codec.cc index de882c8..6e3d0a2 100644 --- a/ccsrc/Protocols/Security/etsi_ts103097_tobesigned_data_codec.cc +++ b/ccsrc/Protocols/Security/etsi_ts103097_tobesigned_data_codec.cc @@ -9,7 +9,6 @@ int etsi_ts103097_tobesigned_data_codec::encode(const Ieee1609Dot2::ToBeSignedData &p_cert, OCTETSTRING &data) { loggers::get_instance().log(">>> etsi_ts103097_tobesigned_data_codec::encode: %s", p_cert.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_cert.encode(*p_cert.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/ieee_1609dot2_base_types_public_encryption_key.cc b/ccsrc/Protocols/Security/ieee_1609dot2_base_types_public_encryption_key.cc index 5732b4f..e5056fc 100644 --- a/ccsrc/Protocols/Security/ieee_1609dot2_base_types_public_encryption_key.cc +++ b/ccsrc/Protocols/Security/ieee_1609dot2_base_types_public_encryption_key.cc @@ -5,7 +5,6 @@ int ieee_1609dot2_base_types_public_encryption_key::encode(const Ieee1609Dot2BaseTypes::PublicEncryptionKey &p_public_encryption_key, OCTETSTRING &p_data) { loggers::get_instance().log(">>> ieee_1609dot2_base_types_public_encryption_key::encode: %s", p_public_encryption_key.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_public_encryption_key.encode(*p_public_encryption_key.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/ieee_1609dot2_base_types_public_verification_key.cc b/ccsrc/Protocols/Security/ieee_1609dot2_base_types_public_verification_key.cc index 421245d..dd10c83 100644 --- a/ccsrc/Protocols/Security/ieee_1609dot2_base_types_public_verification_key.cc +++ b/ccsrc/Protocols/Security/ieee_1609dot2_base_types_public_verification_key.cc @@ -6,7 +6,6 @@ int ieee_1609dot2_base_types_public_verification_key::encode(const Ieee1609Dot2B OCTETSTRING & p_data) { loggers::get_instance().log(">>> ieee_1609dot2_base_types_public_verification_key::encode: %s", p_public_verification_key.get_descriptor()->name); - BITSTRING b; TTCN_EncDec::clear_error(); TTCN_Buffer buffer; p_public_verification_key.encode(*p_public_verification_key.get_descriptor(), buffer, TTCN_EncDec::CT_OER); diff --git a/ccsrc/Protocols/Security/security_cache.cc b/ccsrc/Protocols/Security/security_cache.cc index 9b8c3fa..97c3935 100644 --- a/ccsrc/Protocols/Security/security_cache.cc +++ b/ccsrc/Protocols/Security/security_cache.cc @@ -23,27 +23,7 @@ using namespace std; // Required for isnan() #include "loggers.hh" -bool security_cache_comp::operator()(const OCTETSTRING &p_lhs, const OCTETSTRING &p_rhs) const { - // loggers::get_instance().log_msg(">>> security_cache_comp::operator(): p_lhs= ", p_lhs); - // loggers::get_instance().log_msg(">>> security_cache_comp::operator(): p_rhs= ", p_rhs); - unsigned char *first1 = (unsigned char *)static_cast(p_lhs); - unsigned char *first2 = (unsigned char *)static_cast(p_rhs); - unsigned char *last1 = p_lhs.lengthof() + (unsigned char *)static_cast(p_lhs); - unsigned char *last2 = p_rhs.lengthof() + (unsigned char *)static_cast(p_rhs); - - while (first1 != last1) { - if ((first2 == last2) || (*first2 < *first1)) { - return false; - } else if (*first1 < *first2) { - return true; - } - ++first1; - ++first2; - } // End of 'while' statement - return (first2 != last2); -} - -security_cache::security_cache() : _certificates_idx(), _certificates(), _hashed_id8s() { loggers::get_instance().log(">>> security_cache::security_cache"); } // End of ctor +security_cache::security_cache() : _certificates_idx(), _certificates() { loggers::get_instance().log(">>> security_cache::security_cache"); } // End of ctor security_cache::~security_cache() { loggers::get_instance().log(">>> security_cache::~security_cache"); @@ -54,7 +34,6 @@ int security_cache::clear() { loggers::get_instance().log(">>> security_cache::clear"); _certificates.clear(); // Smart pointers will do the job _certificates_idx.clear(); - _hashed_id8s.clear(); return 0; } // End of clear method @@ -78,6 +57,7 @@ int security_cache::load_certificate(const std::string &p_certificate_id, const it = _certificates.find(p_certificate_id); } } + loggers::get_instance().log_msg("security_cache::load_certificate: Loaded certificate: ", it->second.get()->decoded_certificate()); *p_record = it->second.get(); @@ -88,8 +68,9 @@ int security_cache::get_certificate_id(const OCTETSTRING &p_hashed_id8, std::str loggers::get_instance().log_msg(">>> security_cache::get_certificate_id: ", p_hashed_id8); // Get the certificate id from the hashedid8 - std::map::const_iterator it = _hashed_id8s.find(p_hashed_id8); - if (it == _hashed_id8s.cend()) { + std::map& hashed_id8s = certificates_loader::get_instance().get_hashed_id8s(); + std::map::const_iterator it = hashed_id8s.find(p_hashed_id8); + if (it == hashed_id8s.cend()) { loggers::get_instance().warning("security_cache::get_certificate_id: record not found in index"); p_certificate_id = ""; return -1; @@ -122,6 +103,8 @@ int security_cache::get_certificate(const std::string &p_certificate_id, Ieee160 loggers::get_instance().warning("security_cache::get_private_key: Failed to load certificate"); return -1; } + loggers::get_instance().log("security_cache::get_certificate (1): Certificate loaded"); + loggers::get_instance().log_msg("security_cache::get_certificate (1): Certificate loaded: ", record->decoded_certificate()); p_certificate = record->decoded_certificate(); @@ -131,21 +114,15 @@ int security_cache::get_certificate(const std::string &p_certificate_id, Ieee160 int security_cache::get_certificate(const OCTETSTRING &p_hashed_id3, Ieee1609Dot2::CertificateBase &p_certificate) { loggers::get_instance().log_msg(">>> security_cache::get_certificate (2): ", p_hashed_id3); - std::map::const_iterator s; - for (s = _hashed_id8s.cbegin(); s != _hashed_id8s.cend(); ++s) { - if ((p_hashed_id3[2] == (s->first)[(s->first).lengthof() - 1]) && (p_hashed_id3[1] == (s->first)[(s->first).lengthof() - 2]) && - (p_hashed_id3[0] == (s->first)[(s->first).lengthof() - 3])) { - break; - } - } // End of 'for' statement - if (s == _hashed_id8s.cend()) { + std::string certificate_id; + if (get_certificate_hashed_id3(p_hashed_id3, certificate_id) == -1) { loggers::get_instance().warning("security_cache::get_certificate (2): hashedId3 does not match"); return -1; } const security_db_record* record; - if (load_certificate(s->second, &record) == -1) { - loggers::get_instance().warning("security_cache::get_private_key: Failed to load certificate"); + if (load_certificate(certificate_id, &record) == -1) { + loggers::get_instance().warning("security_cache::get_certificate (2): Failed to load certificate"); return -1; } @@ -157,14 +134,15 @@ int security_cache::get_certificate(const OCTETSTRING &p_hashed_id3, Ieee1609Dot int security_cache::get_certificate_hashed_id3(const OCTETSTRING &p_hashed_id3, std::string &p_certificate_id) const { loggers::get_instance().log_msg(">>> security_cache::get_certificate_hashed_id3: ", p_hashed_id3); + std::map& hashed_id8s = certificates_loader::get_instance().get_hashed_id8s(); std::map::const_iterator s; - for (s = _hashed_id8s.cbegin(); s != _hashed_id8s.cend(); ++s) { + for (s = hashed_id8s.cbegin(); s != hashed_id8s.cend(); ++s) { if ((p_hashed_id3[2] == (s->first)[(s->first).lengthof() - 1]) && (p_hashed_id3[1] == (s->first)[(s->first).lengthof() - 2]) && (p_hashed_id3[0] == (s->first)[(s->first).lengthof() - 3])) { break; } } // End of 'for' statement - if (s == _hashed_id8s.cend()) { + if (s == hashed_id8s.cend()) { loggers::get_instance().warning("security_cache::get_certificate_hashed_id3: hashedId3 does not match"); p_certificate_id = ""; return -1; @@ -399,10 +377,11 @@ int security_cache::store_certificate(const CHARSTRING &p_cert_id, const OCTETST _certificates.insert(std::pair>(key, std::unique_ptr(p))); - std::map::const_iterator h = _hashed_id8s.find(hashed_id8); - if (h != _hashed_id8s.cend()) { - loggers::get_instance().log_msg("security_cache::store_certificate: Replace entry in _hashed_id8s: ", h->first); - _hashed_id8s.erase(h); + std::map& hashed_id8s = certificates_loader::get_instance().get_hashed_id8s(); + std::map::const_iterator h = hashed_id8s.find(hashed_id8); + if (h != hashed_id8s.cend()) { + loggers::get_instance().log_msg("security_cache::store_certificate: Replace entry in hashed_id8s: ", h->first); + hashed_id8s.erase(h); } std::map::const_iterator k = _certificates_idx.find(h->second); if (k != _certificates_idx.cend()) { @@ -411,7 +390,7 @@ int security_cache::store_certificate(const CHARSTRING &p_cert_id, const OCTETST } loggers::get_instance().log_msg("security_cache::store_certificate: Add entry ", hashed_id8); loggers::get_instance().log("security_cache::store_certificate: Add entry for key %s", key.c_str()); - _hashed_id8s.insert(std::pair(hashed_id8, key)); + hashed_id8s.insert(std::pair(hashed_id8, key)); _certificates_idx.insert(std::pair(key, hashed_id8)); return 0; @@ -437,9 +416,9 @@ void security_cache::dump() const { loggers::get_instance().log_msg("security_cache::dump: public_enc_key_y = ", p->public_enc_key_y()); loggers::get_instance().log_msg("security_cache::dump: public_enc_comp_key = ", p->public_enc_comp_key()); } // End of 'for' statement - // for (std::map::const_iterator it = _hashed_id8s.cbegin(); it != _hashed_id8s.cend(); ++it) { - loggers::get_instance().log("security_cache::dump: Hashedid8 table length: %d", _hashed_id8s.size()); - for (std::map::const_iterator it = _hashed_id8s.cbegin(); it != _hashed_id8s.cend(); ++it) { + std::map& hashed_id8s = certificates_loader::get_instance().get_hashed_id8s(); + loggers::get_instance().log("security_cache::dump: Hashedid8 table length: %d", hashed_id8s.size()); + for (std::map::const_iterator it = hashed_id8s.cbegin(); it != hashed_id8s.cend(); ++it) { loggers::get_instance().log_msg("security_cache::dump: Hashedid8 key = ", it->first); loggers::get_instance().log("security_cache::dump: Hashedid8 idx ==> %s", it->second.c_str()); } // End of 'for' statement diff --git a/ccsrc/Protocols/Security/security_cache.hh b/ccsrc/Protocols/Security/security_cache.hh index 6aed014..ff3ed5c 100644 --- a/ccsrc/Protocols/Security/security_cache.hh +++ b/ccsrc/Protocols/Security/security_cache.hh @@ -22,10 +22,6 @@ class OCTETSTRING; //! TITAN forward declaration class INTEGER; //! TITAN forward declaration class CHARSTRING; //! TITAN forward declaration -struct security_cache_comp { - bool operator()(const OCTETSTRING &p_lhs, const OCTETSTRING &p_rhs) const; -}; - /*! * \class security_cache * \brief This class provides security record description for in memory security database. In memory mens there is no disk load/save mechanism @@ -36,12 +32,8 @@ class security_cache { protected: /*! \protectedsection */ // TODO Enforce with const security_cache_record, and const std::string std::map _certificates_idx; //! List of the certificates indexed by the certificate identifier - std::map _hashed_id8s; //! List of the certificates indexed by the HashedId8 std::map> _certificates; //! List of the certificates indexed by the certificate identifier - // FIXME In _certificates: relace key by hashed_id8s: std::map> _certificates; - - public: /*! \publicsection */ /*! * \brief Default ctor diff --git a/ccsrc/Protocols/Security/security_db.cc b/ccsrc/Protocols/Security/security_db.cc index f61c1dd..009c087 100644 --- a/ccsrc/Protocols/Security/security_db.cc +++ b/ccsrc/Protocols/Security/security_db.cc @@ -30,7 +30,7 @@ int security_db::initialize_cache(const std::string &p_db_path) { } // TODO Build the maps of couple {HasehedId8, Certificate} - if (certificates_loader::get_instance().build_certificates_index(_certificates_idx, _hashed_id8s) == -1) { + if (certificates_loader::get_instance().build_certificates_index(_certificates_idx) == -1) { loggers::get_instance().log(">>> security_db::initialize_cache: certificates_loader::build_certificates_index method failed"); return -1; } diff --git a/ccsrc/Protocols/Security/security_ecc.cc b/ccsrc/Protocols/Security/security_ecc.cc index 0c27b9e..d8330a6 100644 --- a/ccsrc/Protocols/Security/security_ecc.cc +++ b/ccsrc/Protocols/Security/security_ecc.cc @@ -48,7 +48,7 @@ security_ecc::security_ecc(const ec_elliptic_curves p_elliptic_curve, const OCTE loggers::get_instance().log(">>> security_ecc::security_ecc (1): %d", static_cast(p_elliptic_curve)); // Sanity checks - if ((_elliptic_curve == ec_elliptic_curves::nist_p_256) || (_elliptic_curve == ec_elliptic_curves::brainpool_p_256_r1)) { + if ((_elliptic_curve == ec_elliptic_curves::nist_p_256) || (_elliptic_curve == ec_elliptic_curves::brainpool_p_256_r1) || (_elliptic_curve == ec_elliptic_curves::sm2_p_256)) { if (p_private_key.lengthof() != 32) { loggers::get_instance().error("security_ecc::security_ecc (1): Invalid public keys size"); } @@ -67,7 +67,7 @@ security_ecc::security_ecc(const ec_elliptic_curves p_elliptic_curve, const OCTE // Build private key BIGNUM *p = ::BN_new(); ::BN_bin2bn(static_cast(_pri_key), _pri_key.lengthof(), p); - // Build public keys + // Build public keys: Q=d*G, d is the priviate key (prime value) and G is the elliptic curve base point EC_POINT *ec_point = ::EC_POINT_new(_ec_group); ::EC_POINT_mul(_ec_group, ec_point, p, nullptr, nullptr, _bn_ctx); // Set private key @@ -135,7 +135,7 @@ security_ecc::security_ecc(const ec_elliptic_curves p_elliptic_curve, const OCTE loggers::get_instance().log(">>> security_ecc::security_ecc (2): %d", static_cast(p_elliptic_curve)); // Sanity checks - if ((_elliptic_curve == ec_elliptic_curves::nist_p_256) || (_elliptic_curve == ec_elliptic_curves::brainpool_p_256_r1)) { + if ((_elliptic_curve == ec_elliptic_curves::nist_p_256) || (_elliptic_curve == ec_elliptic_curves::brainpool_p_256_r1) || (_elliptic_curve == ec_elliptic_curves::sm2_p_256)) { if ((p_public_key_x.lengthof() != 32) || (p_public_key_y.lengthof() != 32)) { loggers::get_instance().error("security_ecc::security_ecc (2): Invalid public keys size"); } @@ -211,7 +211,7 @@ security_ecc::security_ecc(const ec_elliptic_curves p_elliptic_curve, const OCTE loggers::get_instance().log(">>> security_ecc::security_ecc (3): %d", static_cast(p_elliptic_curve)); // Sanity checks - if ((_elliptic_curve == ec_elliptic_curves::nist_p_256) || (_elliptic_curve == ec_elliptic_curves::brainpool_p_256_r1)) { + if ((_elliptic_curve == ec_elliptic_curves::nist_p_256) || (_elliptic_curve == ec_elliptic_curves::brainpool_p_256_r1) || (_elliptic_curve == ec_elliptic_curves::sm2_p_256)) { if (p_public_key_compressed.lengthof() != 32) { loggers::get_instance().error("security_ecc::security_ecc (3): Invalid public keys size"); } @@ -239,6 +239,8 @@ security_ecc::security_ecc(const ec_elliptic_curves p_elliptic_curve, const OCTE // No break; case ec_elliptic_curves::brainpool_p_256_r1: // No break; + case ec_elliptic_curves::sm2_p_256: + // No break; case ec_elliptic_curves::brainpool_p_384_r1: result = ::EC_POINT_set_compressed_coordinates_GFp( _ec_group, ec_point, compressed_key, (p_compressed_mode == ecc_compressed_mode::compressed_y_1) ? 1 : 0, _bn_ctx); // Use primary elliptic curve @@ -270,7 +272,7 @@ security_ecc::security_ecc(const ec_elliptic_curves p_elliptic_curve, const OCTE ::BN_bn2bin(xy, (unsigned char *)static_cast(v)); ::BN_clear_free(xy); xy = nullptr; - if ((v.lengthof() % 2) != 0) { // TODO Check alse xy[0] == 0x04 + if ((v.lengthof() % 2) != 0) { // TODO Check also xy[0] == 0x04 // Remove first byte loggers::get_instance().log_msg("security_ecc::security_ecc (3): Complete xy=", v); v = OCTETSTRING(v.lengthof() - 1, 1 + static_cast(v)); @@ -294,6 +296,7 @@ security_ecc::~security_ecc() { ::EC_KEY_free(_ec_key); } if (_bn_ctx != nullptr) { + ::BN_CTX_end(_bn_ctx); ::BN_CTX_free(_bn_ctx); } @@ -306,7 +309,6 @@ int security_ecc::generate() { // Sanity check if (!::EC_KEY_generate_key(_ec_key)) { // Generate the private and public keys loggers::get_instance().error("security_ecc::generate: Failed to generate private/public keys"); - return -1; } BIGNUM * x = ::BN_new(); @@ -317,12 +319,14 @@ int security_ecc::generate() { switch (_elliptic_curve) { case ec_elliptic_curves::nist_p_256: // Use primary // No break; - case ec_elliptic_curves::nist_p_384: - // No break; case ec_elliptic_curves::brainpool_p_256_r1: + // No break; + case ec_elliptic_curves::sm2_p_256: size = 32; result = ::EC_POINT_get_affine_coordinates_GFp(_ec_group, ec_point, x, y, _bn_ctx); // Use primer on elliptic curve break; + case ec_elliptic_curves::nist_p_384: + // No break; case ec_elliptic_curves::brainpool_p_384_r1: size = 48; result = ::EC_POINT_get_affine_coordinates_GFp(_ec_group, ec_point, x, y, _bn_ctx); // Use primer on elliptic curve @@ -350,6 +354,7 @@ int security_ecc::generate() { int len = ::EC_POINT_point2oct(_ec_group, ec_point, POINT_CONVERSION_COMPRESSED, nullptr, 0, _bn_ctx); if (len == 0) { loggers::get_instance().warning("security_ecc::generate: Failed to generate x_coordinate compressed key"); + return -1; } _pub_key_compressed = int2oct(0, len); if (::EC_POINT_point2oct(_ec_group, ec_point, POINT_CONVERSION_COMPRESSED, (unsigned char *)static_cast(_pub_key_compressed), len, @@ -414,6 +419,8 @@ int security_ecc::generate_and_derive_ephemeral_key(const encryption_algotithm p case ec_elliptic_curves::nist_p_256: // Use the ANSI X9.62 Prime 256v1 curve // No break; case ec_elliptic_curves::brainpool_p_256_r1: + // No break; + case ec_elliptic_curves::sm2_p_256: k_enc = 16; k_mac = 32; break; @@ -537,6 +544,8 @@ int security_ecc::generate_and_derive_ephemeral_key(const encryption_algotithm p case ec_elliptic_curves::nist_p_256: // Use the ANSI X9.62 Prime 256v1 curve // No break; case ec_elliptic_curves::brainpool_p_256_r1: + // No break; + case ec_elliptic_curves::sm2_p_256: k_enc = 16; k_mac = 32; break; @@ -855,6 +864,68 @@ int security_ecc::sign(const OCTETSTRING &p_data, OCTETSTRING &p_r_sig, OCTETSTR return 0; } +int security_ecc::sign(const OCTETSTRING &p_data, const OCTETSTRING &p_entl_a, const OCTETSTRING &p_id, OCTETSTRING &p_r_sig, OCTETSTRING &p_s_sig) { + loggers::get_instance().log(">>> security_ecc::sign"); + loggers::get_instance().log_msg(">>> security_ecc::sign: p_data: ", p_data); + loggers::get_instance().log_msg(">>> security_ecc::sign: p_entl_a: ", p_entl_a); + loggers::get_instance().log_msg(">>> security_ecc::sign: p_id: ", p_id); + + // Sanity checks + if (_pri_key.lengthof() == 0) { // No private key + return -1; + } else if (p_data.lengthof() == 0) { + return -1; + } else if (p_entl_a.lengthof() == 0) { + return -1; + } else if (p_id.lengthof() == 0) { + return -1; + } + + // Build the message to sign - See P1609.2/D13, October 2022 Clause 5.3.1.3 SM2 + OCTETSTRING za = p_entl_a + p_id + OCTETSTRING(32, _a) + OCTETSTRING(32, _b) + OCTETSTRING(32, _xG) + OCTETSTRING(32, _yG) + _pub_key_x + _pub_key_y; + loggers::get_instance().log_msg("security_ecc::sign: za=", za); + // Compute H256(ZA) + OCTETSTRING h_za; + sha256 hash; + hash.generate(za, h_za); + loggers::get_instance().log_msg("security_ecc::sign: h_za=", h_za); + // Compute ZA||M + OCTETSTRING message_to_signed = h_za + p_data; + loggers::get_instance().log_msg("security_ecc::sign: message_to_signed=", message_to_signed); + // Compute digest based on Sm3 + OCTETSTRING digest; + if (compute_digest_sm3(message_to_signed, p_entl_a, p_id, digest) == -1) { + loggers::get_instance().log("security_ecc::sign: Failed to compute digest based on Sm3"); + return -1; + } + loggers::get_instance().log_msg("security_ecc::sign: Sm3 digest=", digest); + // Compute the signature + // FIXME Check returned values and cleanuo on error + EC_KEY* private_key; + ::EC_KEY_oct2priv(private_key, static_cast(_pri_key), _pri_key.lengthof()); + 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); + EVP_MD_CTX* ctx = ::EVP_MD_CTX_new(); + ::EVP_MD_CTX_init(ctx); + ::EVP_SignInit_ex(ctx, ::EVP_sm3(), NULL); + ::EVP_SignUpdate(ctx, static_cast(digest), digest.lengthof()); + unsigned char signature[64] = { 0x00 }; + unsigned int signature_len = 64; + ::EVP_SignFinal(ctx, signature, &signature_len, private_evp_key); + + ::EVP_PKEY_free(private_evp_key); + ::EVP_MD_CTX_free(ctx); + ::EC_KEY_free(private_key); + + p_r_sig = OCTETSTRING(signature_len / 2, signature); + loggers::get_instance().log_msg("security_ecc::sign: r=", p_r_sig); + p_s_sig = OCTETSTRING(signature_len / 2, signature + signature_len / 2); + loggers::get_instance().log_msg("security_ecc::sign: s=", p_s_sig); + + return 0; +} + int security_ecc::sign_verif(const OCTETSTRING &p_data, const OCTETSTRING &p_signature) { loggers::get_instance().log(">>> security_ecc::sign_verif"); loggers::get_instance().log_msg(">>> security_ecc::sign_verify: p_data: ", p_data); @@ -878,6 +949,118 @@ int security_ecc::sign_verif(const OCTETSTRING &p_data, const OCTETSTRING &p_sig loggers::get_instance().log("security_ecc::sign_verif: %s", (result == 1) ? "succeed" : "failed"); return (result == 1) ? 0 : -1; } + +int security_ecc::sign_verif(const OCTETSTRING &p_data, const OCTETSTRING &p_entl_a, const OCTETSTRING &p_id, const OCTETSTRING &p_signature) { + loggers::get_instance().log(">>> security_ecc::sign_verif"); + loggers::get_instance().log_msg(">>> security_ecc::sign_verify: p_data: ", p_data); + + // Sanity checks + if (p_data.lengthof() == 0) { + return -1; + } + + // Build the signature + BIGNUM *r = ::BN_bin2bn(static_cast(p_signature), p_signature.lengthof() / 2, nullptr); + loggers::get_instance().log_to_hexa("security_ecc::sign_verify: r=", static_cast(p_signature), p_signature.lengthof() / 2); + BIGNUM *s = ::BN_bin2bn(static_cast(p_signature) + p_signature.lengthof() / 2, p_signature.lengthof() / 2, nullptr); + loggers::get_instance().log_to_hexa("security_ecc::sign_verify: s=", static_cast(p_signature) + p_signature.lengthof() / 2, + p_signature.lengthof() / 2); + + //loggers::get_instance().log("security_ecc::sign_verif: %s", (result == 1) ? "succeed" : "failed"); + //return (result == 1) ? 0 : -1; + return -1; +} + +int security_ecc::reconstruct_public_keys(const OCTETSTRING &p_cert_to_be_signed, const OCTETSTRING &p_issuer_public_key_x,const OCTETSTRING &p_issuer_public_key_y, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y, OCTETSTRING &p_public_key_compressed, INTEGER &p_public_key_compressed_mode) { + loggers::get_instance().log_msg(">>> security_ecc::reconstruct_public_keys: p_cert_to_be_signed: ", p_cert_to_be_signed); + + // Sanity checks + if ((p_issuer_public_key_x.lengthof() != 32) || (p_issuer_public_key_y.lengthof() != 32)) { + loggers::get_instance().error("security_ecc::reconstruct_public_keys: Invalid CA public keys size"); + } + + int fsize = (::EC_GROUP_get_degree(_ec_group) + 7) / 8; + loggers::get_instance().log("security_ecc::reconstruct_public_keys: fsize='%d'", fsize); + if (fsize != p_issuer_public_key_x.lengthof()) { + loggers::get_instance().warning("security_ecc::reconstruct_public_keys: key size mismatch"); + return -1; + } + bn_print("security_ecc::reconstruct_public_keys: order=", ::EC_GROUP_get0_order(_ec_group)); + bn_print("security_ecc::reconstruct_public_keys: order=", ::EC_GROUP_get0_cofactor(_ec_group)); + + BIGNUM* H = ::BN_CTX_get(_bn_ctx); + OCTETSTRING input = p_cert_to_be_signed + ((_pub_key_compressed_mode == ecc_compressed_mode::compressed_y_0) ? int2oct(2, 1) : int2oct(3, 1)) + _pub_key_compressed; + sha256 sha; + OCTETSTRING hash_input; + sha.generate(input, hash_input); + loggers::get_instance().log_msg("security_ecc::reconstruct_public_keys: hash_input=", hash_input); + ::BN_bin2bn(static_cast(hash_input), fsize, H); + bn_print("security_ecc::reconstruct_public_keys: H(1)=", H); + ::BN_rshift1(H, H); // h: leftmost floor(log_2 n) bits of p_cert_to_be_signed + bn_print("security_ecc::reconstruct_public_keys: H(2)=", H); + + // Build QCA + EC_POINT* QCA = ::EC_POINT_new(_ec_group); + bin_to_ec_point(p_issuer_public_key_x, p_issuer_public_key_y, &QCA); + ec_point_print("security_ecc::reconstruct_public_keys: QCA:", QCA); + + // Public key reconstruction + // PU == _ec_key + ec_point_print("security_ecc::reconstruct_public_keys: PU:", ::EC_KEY_get0_public_key(_ec_key)); + + // QU = h*PU + QCA + EC_POINT* QU = ::EC_POINT_new(_ec_group); + ::EC_POINT_mul(_ec_group, QU, NULL, ::EC_KEY_get0_public_key(_ec_key), H, _bn_ctx); + ec_point_print("security_ecc::reconstruct_public_keys: QU (1):", QU); + ::EC_POINT_add(_ec_group, QU, QU, QCA, _bn_ctx); + ec_point_print("security_ecc::reconstruct_public_keys: QU (2):", QU); + + // Set compressed public key + BIGNUM *xy = ::BN_new(); + ::EC_POINT_point2bn(_ec_group, QU, POINT_CONVERSION_COMPRESSED, xy, _bn_ctx); + loggers::get_instance().log("security_ecc::reconstruct_public_keys: compressed xy length: %d", BN_num_bytes(xy)); + if (BN_num_bytes(xy) == 0) { + ::BN_clear_free(xy); + loggers::get_instance().error("security_ecc::reconstruct_public_keys: Failed to generate compressed xy coordinates, check algorithms"); + } + OCTETSTRING v = int2oct(0, BN_num_bytes(xy)); + ::BN_bn2bin(xy, (unsigned char *)static_cast(v)); + p_public_key_compressed = OCTETSTRING(v.lengthof() - 1, static_cast(v) + 1); + p_public_key_compressed_mode = (*static_cast(v) == 0x02) ? 0 : 1; + // Set public keys + ::EC_POINT_point2bn(_ec_group, QU, POINT_CONVERSION_UNCOMPRESSED, xy, _bn_ctx); + if (BN_num_bytes(xy) == 0) { + ::BN_clear_free(xy); + loggers::get_instance().error("security_ecc::reconstruct_public_keys: Failed to generate xy coordinates, check algorithms"); + } + loggers::get_instance().log("security_ecc::reconstruct_public_keys: xy length: %d", BN_num_bytes(xy)); + // Generate X, Y coordinates + v = int2oct(0, BN_num_bytes(xy)); + ::BN_bn2bin(xy, (unsigned char *)static_cast(v)); + ::BN_clear_free(xy); + xy = nullptr; + if ((v.lengthof() % 2) != 0) { // TODO Check also xy[0] == 0x04 + // Remove first byte + loggers::get_instance().log_msg("security_ecc::reconstruct_public_keys: Complete xy=", v); + v = OCTETSTRING(v.lengthof() - 1, 1 + static_cast(v)); + } + loggers::get_instance().log_msg("security_ecc::reconstruct_public_keys: xy=", v); + const int l = v.lengthof() / 2; + p_public_key_x = OCTETSTRING(l, static_cast(v)); + p_public_key_y = OCTETSTRING(l, l + static_cast(v)); + + ::BN_clear_free(H); + ::BN_clear_free(xy); + ::EC_POINT_free(QU); + + loggers::get_instance().log_msg("security_ecc::reconstruct_public_keys: p_public_key_x=", p_public_key_x); + loggers::get_instance().log_msg("security_ecc::reconstruct_public_keys: p_public_key_y=", p_public_key_y); + loggers::get_instance().log_msg("security_ecc::reconstruct_public_keys: p_public_key_compressed=", p_public_key_compressed); + loggers::get_instance().log_msg("security_ecc::reconstruct_public_keys: p_public_key_compressed_mode=", p_public_key_compressed_mode); + + return 0; +} + const int security_ecc::init() { loggers::get_instance().log(">>> security_ecc::init: %d", static_cast(_elliptic_curve)); @@ -899,6 +1082,9 @@ const int security_ecc::init() { case ec_elliptic_curves::brainpool_p_384_r1: result = ::OBJ_txt2nid("brainpoolP384r1"); break; + case ec_elliptic_curves::sm2_p_256: + result = ::OBJ_txt2nid("sm2"); + break; default: loggers::get_instance().error("security_ecc::init: Unsupported EC elliptic_curve"); } // End of 'switch' statement @@ -915,6 +1101,7 @@ const int security_ecc::init() { ::EC_KEY_set_asn1_flag(_ec_key, OPENSSL_EC_NAMED_CURVE); // Used to save and retrieve keys _ec_group = ::EC_KEY_get0_group(_ec_key); // Get pointer to the EC_GROUP _bn_ctx = ::BN_CTX_new(); + ::BN_CTX_start(_bn_ctx); loggers::get_instance().log("<<< security_ecc::init: 0"); return 0; @@ -963,6 +1150,23 @@ int security_ecc::public_key_to_bin(OCTETSTRING &p_bin_key) { // ec_key_public_k return 0; } +void security_ecc::ec_point_print(const std::string& p_label, const EC_POINT *p_key) { + BIGNUM * x = ::BN_new(); + BIGNUM * y = ::BN_new(); + ::EC_POINT_get_affine_coordinates(_ec_group, p_key, x, y, NULL); + char* sx = ::BN_bn2hex(x); + char* sy = ::BN_bn2hex(y); + loggers::get_instance().log("%sx=%s\ny=%s\n", p_label.c_str(), sx, sy); + free(sx); free(sy); + ::BN_free(x); ::BN_free(y); +} + +void security_ecc::bn_print(const std::string& p_label, const BIGNUM* p_num) { + char* s = ::BN_bn2hex(p_num); + loggers::get_instance().log("%s:%s", p_label.c_str(), s); + free(s); +} + int security_ecc::kdf2(const OCTETSTRING &p_secret_key, const OCTETSTRING &p_salt, const unsigned char p_hash_algorithm, const int p_key_length, OCTETSTRING &p_digest) { loggers::get_instance().log(">>> security_ecc::kdf2"); @@ -1008,3 +1212,42 @@ int security_ecc::kdf2_sha256(const OCTETSTRING &p_secret_key, const OCTETSTRING loggers::get_instance().log_msg("<<< security_ecc::kdf2_sha256: p_secret_key: ", p_digest); return 0; } + +int security_ecc::compute_digest_sm3(const OCTETSTRING &p_data, const OCTETSTRING &p_entl_a, const OCTETSTRING &p_id, OCTETSTRING &p_digest) { + loggers::get_instance().log(">>> security_ecc::compute_digest_sm3"); + loggers::get_instance().log_msg(">>> security_ecc::compute_digest_sm3: ", _pub_key_x); + loggers::get_instance().log_msg(">>> security_ecc::compute_digest_sm3: ", _pub_key_y); + + EVP_MD_CTX* ctx = ::EVP_MD_CTX_new(); + if (ctx == nullptr) { + loggers::get_instance().warning("ecurity_ecc::compute_digest_sm3: Failed to create context"); + return -1; + } + ::EVP_DigestInit_ex(ctx, ::EVP_sm3(), NULL); + ::EVP_DigestUpdate(ctx, static_cast(p_entl_a), p_entl_a.lengthof()); + ::EVP_DigestUpdate(ctx, static_cast(p_id), p_id.lengthof()); + ::EVP_DigestUpdate(ctx, _a, sizeof(_a)); + ::EVP_DigestUpdate(ctx, _b, sizeof(_b)); + ::EVP_DigestUpdate(ctx, _xG, sizeof(_xG)); + ::EVP_DigestUpdate(ctx, _yG, sizeof(_yG)); + ::EVP_DigestUpdate(ctx, static_cast(_pub_key_x), _pub_key_x.lengthof()); + ::EVP_DigestUpdate(ctx, static_cast(_pub_key_y), _pub_key_y.lengthof()); + unsigned char digest[32] = { 0x00 }; + ::EVP_DigestFinal_ex(ctx, digest, NULL); + ::EVP_MD_CTX_free(ctx); + + if ((ctx = ::EVP_MD_CTX_new()) == nullptr) { + loggers::get_instance().warning("ecurity_ecc::compute_digest_sm3: Failed to create context"); + return -1; + } + ::EVP_DigestInit_ex(ctx, ::EVP_sm3(), NULL); + ::EVP_DigestUpdate(ctx, digest, sizeof(digest)); + ::EVP_DigestUpdate(ctx, static_cast(p_data), p_data.lengthof()); + ::EVP_DigestFinal_ex(ctx, digest, NULL); + ::EVP_MD_CTX_free(ctx); + + p_digest = OCTETSTRING(sizeof(digest), static_cast(digest)); + + loggers::get_instance().log_msg("<<< security_ecc::compute_digest_sm3: p_secret_key: ", p_digest); + return 0; +} diff --git a/ccsrc/Protocols/Security/security_ecc.hh b/ccsrc/Protocols/Security/security_ecc.hh index 1cbb9cf..0d56fae 100644 --- a/ccsrc/Protocols/Security/security_ecc.hh +++ b/ccsrc/Protocols/Security/security_ecc.hh @@ -24,7 +24,8 @@ enum class ec_elliptic_curves : unsigned char { // TODO Renamed into ecc_ellipti nist_p_256, /*!< NIST P-256, P-256, primve256v1 */ nist_p_384, /*!< NIST P-384, P-384, secp384r1 */ brainpool_p_256_r1, /*!< Brainpool P256r1 */ - brainpool_p_384_r1 /*!< Brainpool P384r1 */ + brainpool_p_384_r1, /*!< Brainpool P384r1 */ + sm2_p_256 /*!< Chinese SM2 */ }; // End of class ecc_elliptic_curves /*! @@ -50,6 +51,16 @@ enum class encryption_algotithm : unsigned char { // TODO Renamed into ecc_encry * \brief This class implements the generation of a key pair private/public */ class security_ecc { + // FIXME Concatenate _a + _b + _xG + _yG for optimization + const unsigned char _a[32] = { 0x78, 0x79, 0x68, 0xB4, 0xFA, 0x32, 0xC3, 0xFD, 0x24, 0x17, 0x84, 0x2E, 0x73, 0xBB, 0xFE, 0xFF, 0x2F, 0x3C, 0x84, 0x8B, 0x68, 0x31, 0xD7, 0xE0, 0xEC, 0x65, 0x22, 0x8B, 0x39, 0x37, 0xE4, 0x98 }; + /*!< Elliptic curve equation parameters (a) - P1609.2/D13, October 2022 Clause 5.3.1.3 SM2 */ + const unsigned char _b[32] = { 0x63, 0xE4, 0xC6, 0xD3, 0xB2, 0x3B, 0x0C, 0x84, 0x9C, 0xF8, 0x42, 0x41, 0x48, 0x4B, 0xFE, 0x48, 0xF6, 0x1D, 0x59, 0xA5, 0xB1, 0x6B, 0xA0, 0x6E, 0x6E, 0x12, 0xD1, 0xDA, 0x27, 0xC5, 0x24, 0x9A }; + /*!< Elliptic curve equation parameters (b) - P1609.2/D13, October 2022 Clause 5.3.1.3 SM2 */ + const unsigned char _xG[32] = { 0x42, 0x1D, 0xEB, 0xD6, 0x1B, 0x62, 0xEA, 0xB6, 0x74, 0x64, 0x34, 0xEB, 0xC3, 0xCC, 0x31, 0x5E, 0x32, 0x22, 0x0B, 0x3B, 0xAD, 0xD5, 0x0B, 0xDC, 0x4C, 0x4E, 0x6C, 0x14, 0x7F, 0xED, 0xD4, 0x3D }; + /*!< x coordinate of the generating point. - P1609.2/D13, October 2022 Clause 5.3.1.3 SM2 */ + const unsigned char _yG[32] = { 0x06, 0x80, 0x51, 0x2B, 0xCB, 0xB4, 0x2C, 0x07, 0xD4, 0x73, 0x49, 0xD2, 0x15, 0x3B, 0x70, 0xC4, 0xE5, 0xD7, 0xFD, 0xFC, 0xBF, 0xA3, 0x6E, 0xA1, 0xA8, 0x58, 0x41, 0xB9, 0xE4, 0x6E, 0x09, 0xA2 }; + /*!< y coordinate of the generating point. - P1609.2/D13, October 2022 Clause 5.3.1.3 SM2 */ + ec_elliptic_curves _elliptic_curve; /*!< Selected elleptic curve */ encryption_algotithm _encryption_algotithm; /*!< Selected encryption algotithm */ EC_KEY * _ec_key; /*!< EC_KEY reference */ @@ -117,6 +128,17 @@ public: //! \publicsection * \return 0 on success, -1 otherwise */ int sign(const OCTETSTRING &p_data, OCTETSTRING &p_r_sig, OCTETSTRING &p_s_sig); + /*! + * \fn int sign(const OCTETSTRING& p_data, OCTETSTRING& p_r_sig, OCTETSTRING& p_s_sig); + * \brief Signed the data using ECDSA algorithm + * \param[in] p_data The data to be signed + * \param[in] p_entl_a + * \param[in] p_id + * \param[out] p_r_sig Part of the signature + * \param[out] p_s_sig Part of the signature + * \return 0 on success, -1 otherwise + */ + int sign(const OCTETSTRING &p_data, const OCTETSTRING &p_entl_a, const OCTETSTRING &p_id, OCTETSTRING &p_r_sig, OCTETSTRING &p_s_sig); /*! * \fn int sign_verif(const OCTETSTRING& p_data, const OCTETSTRING& p_signature); * \brief Verifiy an ECDSA signature @@ -125,6 +147,16 @@ public: //! \publicsection * \return 0 on success, -1 otherwise */ int sign_verif(const OCTETSTRING &p_data, const OCTETSTRING &p_signature); + /*! + * \fn int sign_verif(const OCTETSTRING& p_data, const OCTETSTRING& p_signature); + * \brief Verifiy an ECDSA signature + * \param[in] p_data The signed data + * \param[in] p_entl_a + * \param[in] p_id + * \param[in] p_signature The signature part, based on r_sig part and s_sig part + * \return 0 on success, -1 otherwise + */ + int sign_verif(const OCTETSTRING &p_data, const OCTETSTRING &p_entl_a, const OCTETSTRING &p_id, const OCTETSTRING &p_signature); /*! * \fn int generate_and_derive_ephemeral_key(const encryption_algotithm p_enc_algorithm, const OCTETSTRING& p_recipients_public_key_x, const OCTETSTRING& @@ -177,17 +209,27 @@ public: //! \publicsection OCTETSTRING &p_enc_message); /*! * \fn int decrypt(const encryption_algotithm p_enc_algorithm, const OCTETSTRING& p_key, const OCTETSTRING& p_nonce, const OCTETSTRING& p_tag, const - * OCTETSTRING& p_enc_message, OCTETSTRING& p_message); \brief Decryption using the specified parameters. \param[in] p_enc_algorithm The algorithm to use for - * the decryption \param[in] p_nonce The algorithm to use for the encryption \param[in] p_tag The algorithm to use for the encryption \param[in] p_enc_message - * The message to be decrypted \param[out] p_message The decrypted message \remark To get the generated symmetric encryption key, uses \see - * symmetric_encryption_key method \remark To get the generated nonce vector, uses \see nonce method \remark To get the generated tag, uses \see tag method + * OCTETSTRING& p_enc_message, OCTETSTRING& p_message); + * \brief Decryption using the specified parameters. + * \param[in] p_enc_algorithm The algorithm to use for + * the decryption + * \param[in] p_nonce The algorithm to use for the encryption + * \param[in] p_tag The algorithm to use for the encryption + * \param[in] p_enc_message + * The message to be decrypted \param[out] p_message The decrypted message + * \remark To get the generated symmetric encryption key, uses + * \see symmetric_encryption_key method \remark To get the generated nonce vector, uses + * \see nonce method \remark To get the generated tag, uses + * \see tag method * \return 0 on success, -1 otherwise */ int decrypt(const encryption_algotithm p_enc_algorithm, const OCTETSTRING &p_symmetric_key, const OCTETSTRING &p_nonce, const OCTETSTRING &p_tag, const OCTETSTRING &p_enc_message, OCTETSTRING &p_message); /*! * \fn int decrypt(const encryption_algotithm p_enc_algorithm, const OCTETSTRING& p_key, const OCTETSTRING& p_nonce, const OCTETSTRING& p_tag, const - * OCTETSTRING& p_enc_message, OCTETSTRING& p_message); \brief Decryption using default parameters. \param[in] p_tag The algorithm to use for the encryption + * OCTETSTRING& p_enc_message, OCTETSTRING& p_message); + * \brief Decryption using default parameters. + * \param[in] p_tag The algorithm to use for the encryption * \param[in] p_enc_message The message to be decrypted * \param[out] p_message The decrypted message * \remark To get the generated symmetric encryption key, uses \see symmetric_encryption_key method @@ -196,6 +238,13 @@ public: //! \publicsection * \return 0 on success, -1 otherwise */ int decrypt(const OCTETSTRING &p_tag, const OCTETSTRING &p_enc_message, OCTETSTRING &p_message); + /*! + * \fn int reconstruct_public_keys(const OCTETSTRING &p_cert_to_be_signed, const OCTETSTRING &p_issuer_public_key_x, const OCTETSTRING &p_issuer_public_key_y, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y, OCTETSTRING &p_public_key_compressed, INTEGER &p_public_key_compressed_mode); + * \brief Reconstruct the public keys of an implicit certificate. + * \remark The instance of security_ecc shall contain the reconstruction key + * \return 0 on success, -1 otherwise + */ + int reconstruct_public_keys(const OCTETSTRING &p_cert_to_be_signed, const OCTETSTRING &p_issuer_public_key_x,const OCTETSTRING &p_issuer_public_key_y, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y, OCTETSTRING &p_public_key_compressed, INTEGER &p_public_key_compressed_mode); inline const OCTETSTRING & private_key() const { return _pri_key; }; inline const OCTETSTRING & public_key_x() const { return _pub_key_x; }; @@ -237,6 +286,13 @@ private: //! \privatesection */ int public_key_to_bin(OCTETSTRING &p_bin_key); + void ec_point_print(const std::string& p_label, const EC_POINT *p_key); + + void bn_print(const std::string& p_label, const BIGNUM* p_num); + int kdf2(const OCTETSTRING &p_secret_key, const OCTETSTRING &p_salt, const unsigned char p_hash_algorithm, const int p_key_length, OCTETSTRING &p_digest); int kdf2_sha256(const OCTETSTRING &p_secret_key, const OCTETSTRING &p_salt, const int p_key_length, OCTETSTRING &p_digest); + + int compute_digest_sm3(const OCTETSTRING &p_data, const OCTETSTRING &p_entl_a, const OCTETSTRING &p_id, OCTETSTRING &p_digest); + }; // End of class security_ecc diff --git a/ccsrc/Protocols/Security/security_services_its.cc b/ccsrc/Protocols/Security/security_services_its.cc index 62bedc7..8c708dd 100644 --- a/ccsrc/Protocols/Security/security_services_its.cc +++ b/ccsrc/Protocols/Security/security_services_its.cc @@ -66,6 +66,8 @@ int security_services_its::setup(params_its &p_params) { // FIXME Rename this me _ec_keys_enc.reset(new security_ecc(ec_elliptic_curves::nist_p_256)); } else if (it->second.compare("BP-256")) { _ec_keys_enc.reset(new security_ecc(ec_elliptic_curves::brainpool_p_256_r1)); + } else if (it->second.compare("SM2P-256")) { + _ec_keys_enc.reset(new security_ecc(ec_elliptic_curves::sm2_p_256)); } else { loggers::get_instance().warning("security_services_its::setup: Failed to encode ToBeSignedData"); return -1; @@ -349,10 +351,14 @@ int security_services_its::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2 result = -1; if (p_signed_data.signature__().ischosen(Ieee1609Dot2BaseTypes::Signature::ALT_ecdsaNistP256Signature)) { result = verify_sign_ecdsa_nistp256(hashed_data, p_signed_data.signature__(), certificate_id, p_params); + } else if (p_signed_data.signature__().ischosen(Ieee1609Dot2BaseTypes::Signature::ALT_ecdsaNistP384Signature)) { + result = verify_sign_ecdsa_nistp384(hashed_data, p_signed_data.signature__(), certificate_id, p_params); } else if (p_signed_data.signature__().ischosen(Ieee1609Dot2BaseTypes::Signature::ALT_ecdsaBrainpoolP256r1Signature)) { result = verify_sign_ecdsa_brainpoolp256r1(hashed_data, p_signed_data.signature__(), certificate_id, p_params); } else if (p_signed_data.signature__().ischosen(Ieee1609Dot2BaseTypes::Signature::ALT_ecdsaBrainpoolP384r1Signature)) { result = verify_sign_ecdsa_brainpoolp384r1(hashed_data, p_signed_data.signature__(), certificate_id, p_params); + } else if (p_signed_data.signature__().ischosen(Ieee1609Dot2BaseTypes::Signature::ALT_sm2Signature)) { + result = verify_sign_ecdsa_sm2p256(hashed_data, p_signed_data.signature__(), certificate_id, p_params); } else { // TODO loggers::get_instance().error("security_services_its::process_ieee_1609_dot2_signed_data: TODO"); @@ -380,6 +386,8 @@ int security_services_its::process_ieee_1609_dot2_encrypted_data(const Ieee1609D ecies = &r.certRecipInfo().encKey().eciesNistP256(); } else if (r.certRecipInfo().encKey().ischosen(Ieee1609Dot2::EncryptedDataEncryptionKey::ALT_eciesBrainpoolP256r1)) { ecies = &r.certRecipInfo().encKey().eciesBrainpoolP256r1(); + // } else if (r.certRecipInfo().encKey().ischosen(Ieee1609Dot2::EncryptedDataEncryptionKey::ALT_ecencSm2256)) { // FIXME FSCOM + // ecies = &r.certRecipInfo().encKey().ecencSm2256(); } else { loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_encrypted_data: Unsupported encryption algorithm"); return -1; @@ -390,6 +398,9 @@ int security_services_its::process_ieee_1609_dot2_encrypted_data(const Ieee1609D ecies = &r.signedDataRecipInfo().encKey().eciesNistP256(); } else if (r.signedDataRecipInfo().encKey().ischosen(Ieee1609Dot2::EncryptedDataEncryptionKey::ALT_eciesBrainpoolP256r1)) { ecies = &r.signedDataRecipInfo().encKey().eciesBrainpoolP256r1(); + // } else if (r.signedDataRecipInfo().encKey().ischosen(Ieee1609Dot2::EncryptedDataEncryptionKey::ALT_ecencSm2256)) { // FIXME FSCOM + // Ieee1609Dot2BaseTypes::EcencP256EncryptedKey& e = r.signedDataRecipInfo().encKey().ecencSm2256(); + // ecies. = &r.signedDataRecipInfo().encKey().ecencSm2256(); } else { loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_encrypted_data: Unsupported encryption algorithm"); return -1; @@ -712,6 +723,8 @@ int security_services_its::encrypt_gn_payload(const OCTETSTRING &p_unsecured_gn_ enc_data_key.eciesNistP256() = ecies_key; } else if (_params[params_its::cypher].compare("BP-256") == 0) { enc_data_key.eciesBrainpoolP256r1() = ecies_key; + // } else if (_params[params_its::cypher].compare("SM2P-256") == 0) { // FIXME FSCOM + // enc_data_key.ecencSm2256() = ecies_key; } loggers::get_instance().log_msg("security_services_its::encrypt_gn_payload: enc_data_key=", enc_data_key); @@ -835,6 +848,7 @@ int security_services_its::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_t Ieee1609Dot2::CertificateBase decoded_certificate; // Set signature type _security_db.get()->get_certificate(p_params[params_its::certificate], decoded_certificate); + loggers::get_instance().log_msg("security_services_its::sign_tbs_data: Got certificate", decoded_certificate); std::string sig("NISTP-256"); if (decoded_certificate.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_verificationKey)) { if (decoded_certificate.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP384)) { @@ -843,6 +857,8 @@ int security_services_its::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_t sig.assign("BP-256"); } else if (decoded_certificate.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP384r1)) { sig.assign("BP-384"); + } else if (decoded_certificate.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecsigSm2)) { + sig.assign("SM2P-256"); } } loggers::get_instance().log("security_services_its::sign_tbs_data: sig = '%s'", sig.c_str()); @@ -884,6 +900,8 @@ int security_services_its::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_t result = sign_ecdsa_brainpoolp256r1(hashed_data, p_signature, p_params); } else if (p_params[params_its::signature].compare("BP-384") == 0) { result = sign_ecdsa_brainpoolp384r1(hashed_data, p_signature, p_params); + } else if (p_params[params_its::signature].compare("SM2P-256") == 0) { + result = sign_ecdsa_sm2p256(hashed_data, p_signature, p_params); } else { loggers::get_instance().error("security_services_its::sign_tbs_data: Unsupported signature algorithm"); result = -1; @@ -1250,110 +1268,214 @@ int security_services_its::verify_sign_ecdsa_brainpoolp384r1(const OCTETSTRING & return -1; } +int security_services_its::sign_ecdsa_sm2p256(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params) { + loggers::get_instance().log_msg(">>> security_services_its::sign_ecdsa_sm2p256: ", p_hash); + loggers::get_instance().error("security_services_its::sign_ecdsa_sm2p256: To be done"); // FIXME FSCOM + + // std::string certificate_id = p_params[params_its::certificate]; + // loggers::get_instance().log("security_services_its::sign_ecdsa_sm2p256: encoded certificate_id = '%s'", certificate_id.c_str()); + // OCTETSTRING pkey; + // if (_security_db->get_private_key(certificate_id, pkey) != 0) { + // loggers::get_instance().warning("security_services_its::sign_ecdsa_sm2p256: Failed to get private key"); + // return -1; + // } + // // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + // OCTETSTRING hash_cert; + // if (_security_db->get_hash(certificate_id, hash_cert) != 0) { + // loggers::get_instance().warning("security_services_its::sign_ecdsa_sm2p256: Failed to get whole hash certificate"); + // return -1; + // } + // loggers::get_instance().log_msg("security_services_its::sign_ecdsa_sm2p256: hash_issuer: ", hash_cert); + // OCTETSTRING os = p_hash + hash_cert; // Hash (Data input) || Hash (Signer identifier input) + // loggers::get_instance().log_msg("security_services_its::sign_ecdsa_sm2p256: hash: ", os); + // OCTETSTRING hashed_data; + // hash_sha256(os, hashed_data); // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + // security_ecc k(ec_elliptic_curves::sm2_p_256, pkey); + // OCTETSTRING r_sig; + // OCTETSTRING s_sig; + // if (k.sign(hashed_data, r_sig, s_sig) != 0) { + // loggers::get_instance().warning("security_services_its::sign_ecdsa_sm2p256: Failed to sign payload"); + // return -1; + // } + // Ieee1609Dot2BaseTypes::EccP256CurvePoint ep; + // ep.x__only() = r_sig; + // p_signature.ecdsaSm2P256Signature() = Ieee1609Dot2BaseTypes::EcdsaP256Signature(ep, s_sig); + // loggers::get_instance().log_msg("security_services_its::sign_ecdsa_sm2p256: signature=", p_signature); + + return 0; +} + +int security_services_its::verify_sign_ecdsa_sm2p256(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, + const std::string &p_certificate_id, params_its &p_params) { + loggers::get_instance().log_msg(">>> security_services_its::verify_sign_ecdsa_sm2p256:", p_hash); + loggers::get_instance().log(">>> security_services_its::verify_sign_ecdsa_sm2p256: %s", p_certificate_id.c_str()); + + OCTETSTRING public_key_x; + OCTETSTRING public_key_y; + if (_security_db->get_public_keys(p_certificate_id, public_key_x, public_key_y) != 0) { + loggers::get_instance().warning("security_services_its::verify_sign_ecdsa_sm2p256 (%s): Failed to get public keys", p_certificate_id.c_str()); + return -1; + } + + // Generate the hash to be verified: Hash ( Hash (Data input) || Hash (Signer identifier input) ) + OCTETSTRING issuer; // Hash (Signer identifier input) + if (_security_db->get_hash(p_certificate_id, issuer) != 0) { + loggers::get_instance().warning("security_services_its::verify_sign_ecdsa_sm2p256 (%s): Failed to get hash of the issuer certificate", + p_certificate_id.c_str()); + return -1; + } + loggers::get_instance().log_msg("security_services_its::verify_sign_ecdsa_sm2p256: hash_issuer: ", issuer); + OCTETSTRING hash_data = p_hash + issuer; // Hash (Data input) || Hash (Signer identifier input) + loggers::get_instance().log_msg("security_services_its::verify_sign_ecdsa_sm2p256: hash: ", hash_data); + OCTETSTRING hash_to_be_verified; + hash_sha256(hash_data, hash_to_be_verified); // Hash ( Hash (Data input) || Hash (Signer identifier input) ) + loggers::get_instance().log_msg("security_services_its::verify_sign_ecdsa_sm2p256: hash_to_be_verified: ", hash_to_be_verified); + + // Build the signature + OCTETSTRING signature = p_signature.sm2Signature().rSig() + p_signature.sm2Signature().sSig(); + security_ecc k(ec_elliptic_curves::sm2_p_256, public_key_x, public_key_y); + if (k.sign_verif(hash_to_be_verified, signature) == 0) { + return 0; + } + + return -1; +} + int security_services_its::extract_verification_keys(const Ieee1609Dot2::CertificateBase &p_cert, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y, OCTETSTRING &p_public_comp_key, INTEGER &p_public_comp_key_mode) { loggers::get_instance().log("security_services_its::extract_verification_keys"); - if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP256)) { - if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().ischosen(Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__0)) { - p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().compressed__y__0(); - security_ecc ecc(ec_elliptic_curves::nist_p_256, p_public_comp_key, ecc_compressed_mode::compressed_y_0); - p_public_key_x = ecc.public_key_x(); - p_public_key_y = ecc.public_key_y(); - p_public_comp_key_mode = INTEGER(0); - } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().ischosen( - Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__1)) { - p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().compressed__y__1(); - security_ecc ecc(ec_elliptic_curves::nist_p_256, p_public_comp_key, ecc_compressed_mode::compressed_y_1); - p_public_key_x = ecc.public_key_x(); - p_public_key_y = ecc.public_key_y(); - p_public_comp_key_mode = INTEGER(1); - } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().ischosen( - Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_uncompressedP256)) { - security_ecc ecc(ec_elliptic_curves::nist_p_256, p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().uncompressedP256().x(), - p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().uncompressedP256().y()); - p_public_comp_key = ecc.public_key_compressed(); - p_public_comp_key_mode = INTEGER((int)ecc.public_key_compressed_mode()); - p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().uncompressedP256().x(); - p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().uncompressedP256().y(); - } else { - loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported ecdsaNistP256 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().get_selection()); - return -1; - } - } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP256r1)) { - if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().ischosen( - Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__0)) { - p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().compressed__y__0(); - security_ecc ecc(ec_elliptic_curves::brainpool_p_256_r1, p_public_comp_key, ecc_compressed_mode::compressed_y_0); - p_public_key_x = ecc.public_key_x(); - p_public_key_y = ecc.public_key_y(); - p_public_comp_key_mode = INTEGER(0); - } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().ischosen( - Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__1)) { - p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().compressed__y__1(); - security_ecc ecc(ec_elliptic_curves::brainpool_p_256_r1, p_public_comp_key, ecc_compressed_mode::compressed_y_1); - p_public_key_x = ecc.public_key_x(); - p_public_key_y = ecc.public_key_y(); - p_public_comp_key_mode = INTEGER(1); - } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().ischosen( - Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_uncompressedP256)) { - p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().uncompressedP256().x(); - p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().uncompressedP256().y(); - } else { - loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported ecdsaBrainpoolP256r1 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().get_selection()); - return -1; - } - } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP384r1)) { - if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().ischosen( - Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__0)) { - p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().compressed__y__0(); - security_ecc ecc(ec_elliptic_curves::brainpool_p_384_r1, p_public_comp_key, ecc_compressed_mode::compressed_y_0); - p_public_key_x = ecc.public_key_x(); - p_public_key_y = ecc.public_key_y(); - p_public_comp_key_mode = INTEGER(0); - } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().ischosen( - Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__1)) { - p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().compressed__y__1(); - security_ecc ecc(ec_elliptic_curves::brainpool_p_384_r1, p_public_comp_key, ecc_compressed_mode::compressed_y_1); - p_public_key_x = ecc.public_key_x(); - p_public_key_y = ecc.public_key_y(); - p_public_comp_key_mode = INTEGER(1); - } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().ischosen( - Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_uncompressedP384)) { - p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().uncompressedP384().x(); - p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().uncompressedP384().y(); - } else { - loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported ecdsaBrainpoolP384r1 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().get_selection()); - return -1; - } - } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP384)) { - if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().ischosen( - Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__0)) { - p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().compressed__y__0(); - security_ecc ecc(ec_elliptic_curves::nist_p_384, p_public_comp_key, ecc_compressed_mode::compressed_y_0); - p_public_key_x = ecc.public_key_x(); - p_public_key_y = ecc.public_key_y(); - p_public_comp_key_mode = INTEGER(0); - } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().ischosen( - Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__1)) { - p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().compressed__y__1(); - security_ecc ecc(ec_elliptic_curves::nist_p_384, p_public_comp_key, ecc_compressed_mode::compressed_y_1); - p_public_key_x = ecc.public_key_x(); - p_public_key_y = ecc.public_key_y(); - p_public_comp_key_mode = INTEGER(1); - } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().ischosen( - Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_uncompressedP384)) { - p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().uncompressedP384().x(); - p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().uncompressedP384().y(); + if (p_cert.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_verificationKey)) { // Explicit certificate + if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP256)) { + if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().ischosen(Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__0)) { + p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().compressed__y__0(); + security_ecc ecc(ec_elliptic_curves::nist_p_256, p_public_comp_key, ecc_compressed_mode::compressed_y_0); + p_public_key_x = ecc.public_key_x(); + p_public_key_y = ecc.public_key_y(); + p_public_comp_key_mode = INTEGER(0); + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().ischosen( + Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__1)) { + p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().compressed__y__1(); + security_ecc ecc(ec_elliptic_curves::nist_p_256, p_public_comp_key, ecc_compressed_mode::compressed_y_1); + p_public_key_x = ecc.public_key_x(); + p_public_key_y = ecc.public_key_y(); + p_public_comp_key_mode = INTEGER(1); + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().ischosen( + Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_uncompressedP256)) { + security_ecc ecc(ec_elliptic_curves::nist_p_256, p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().uncompressedP256().x(), + p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().uncompressedP256().y()); + p_public_comp_key = ecc.public_key_compressed(); + p_public_comp_key_mode = INTEGER((int)ecc.public_key_compressed_mode()); + p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().uncompressedP256().x(); + p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().uncompressedP256().y(); + } else { + loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported ecdsaNistP256 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().get_selection()); + return -1; + } + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP256r1)) { + if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().ischosen( + Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__0)) { + p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().compressed__y__0(); + security_ecc ecc(ec_elliptic_curves::brainpool_p_256_r1, p_public_comp_key, ecc_compressed_mode::compressed_y_0); + p_public_key_x = ecc.public_key_x(); + p_public_key_y = ecc.public_key_y(); + p_public_comp_key_mode = INTEGER(0); + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().ischosen( + Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__1)) { + p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().compressed__y__1(); + security_ecc ecc(ec_elliptic_curves::brainpool_p_256_r1, p_public_comp_key, ecc_compressed_mode::compressed_y_1); + p_public_key_x = ecc.public_key_x(); + p_public_key_y = ecc.public_key_y(); + p_public_comp_key_mode = INTEGER(1); + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().ischosen( + Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_uncompressedP256)) { + p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().uncompressedP256().x(); + p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().uncompressedP256().y(); + } else { + loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported ecdsaBrainpoolP256r1 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().get_selection()); + return -1; + } + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP384r1)) { + if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().ischosen( + Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__0)) { + p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().compressed__y__0(); + security_ecc ecc(ec_elliptic_curves::brainpool_p_384_r1, p_public_comp_key, ecc_compressed_mode::compressed_y_0); + p_public_key_x = ecc.public_key_x(); + p_public_key_y = ecc.public_key_y(); + p_public_comp_key_mode = INTEGER(0); + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().ischosen( + Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__1)) { + p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().compressed__y__1(); + security_ecc ecc(ec_elliptic_curves::brainpool_p_384_r1, p_public_comp_key, ecc_compressed_mode::compressed_y_1); + p_public_key_x = ecc.public_key_x(); + p_public_key_y = ecc.public_key_y(); + p_public_comp_key_mode = INTEGER(1); + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().ischosen( + Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_uncompressedP384)) { + p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().uncompressedP384().x(); + p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().uncompressedP384().y(); + } else { + loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported ecdsaBrainpoolP384r1 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().get_selection()); + return -1; + } + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP384)) { + if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().ischosen( + Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__0)) { + p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().compressed__y__0(); + security_ecc ecc(ec_elliptic_curves::nist_p_384, p_public_comp_key, ecc_compressed_mode::compressed_y_0); + p_public_key_x = ecc.public_key_x(); + p_public_key_y = ecc.public_key_y(); + p_public_comp_key_mode = INTEGER(0); + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().ischosen( + Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__1)) { + p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().compressed__y__1(); + security_ecc ecc(ec_elliptic_curves::nist_p_384, p_public_comp_key, ecc_compressed_mode::compressed_y_1); + p_public_key_x = ecc.public_key_x(); + p_public_key_y = ecc.public_key_y(); + p_public_comp_key_mode = INTEGER(1); + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().ischosen( + Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_uncompressedP384)) { + p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().uncompressedP384().x(); + p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().uncompressedP384().y(); + } else { + loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported ecdsaNistP384 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().get_selection()); + return -1; + } + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecsigSm2)) { + if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecsigSm2().ischosen( + Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__0)) { + p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecsigSm2().compressed__y__0(); + security_ecc ecc(ec_elliptic_curves::sm2_p_256, p_public_comp_key, ecc_compressed_mode::compressed_y_0); + p_public_key_x = ecc.public_key_x(); + p_public_key_y = ecc.public_key_y(); + p_public_comp_key_mode = INTEGER(0); + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecsigSm2().ischosen( + Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__1)) { + p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecsigSm2().compressed__y__1(); + security_ecc ecc(ec_elliptic_curves::sm2_p_256, p_public_comp_key, ecc_compressed_mode::compressed_y_1); + p_public_key_x = ecc.public_key_x(); + p_public_key_y = ecc.public_key_y(); + p_public_comp_key_mode = INTEGER(1); + } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecsigSm2().ischosen( + Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_uncompressedP256)) { + p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecsigSm2().uncompressedP256().x(); + p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecsigSm2().uncompressedP256().y(); + } else { + loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported ecsigSm2 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecsigSm2().get_selection()); + return -1; + } } else { - loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported ecdsaNistP384 VerificationKey point type %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().get_selection()); + loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported VerificationKey curve %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().get_selection()); return -1; } + } else if (p_cert.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_reconstructionValue)) { // Implicit certificate + // FIXME FSCOM + // Rebuild signing keys + loggers::get_instance().error("security_services_its::extract_verification_keys: Implicit certificate not supported yet"); } else { - loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported VerificationKey curve %d", p_cert.toBeSigned().verifyKeyIndicator().verificationKey().get_selection()); - return -1; - } + loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported variant"); + } return 0; } @@ -1403,6 +1525,26 @@ int security_services_its::extract_encryption_keys(const Ieee1609Dot2::Certifica loggers::get_instance().error("security_services_its::extract_encryption_keys: Unsupported EncryptionKey"); return -1; } + // } else if (p.publicKey().ischosen(Ieee1609Dot2BaseTypes::BasePublicEncryptionKey::ALT_ecencSm2256)) { // FIXME FSCOM + // if (p.publicKey().ecencSm2().ischosen(Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__0)) { + // p_public_enc_comp_key = p.publicKey().ecencSm2().compressed__y__0(); + // security_ecc ecc(ec_elliptic_curves::sm2_p_256, p_public_enc_comp_key, ecc_compressed_mode::compressed_y_0); + // p_public_enc_key_x = ecc.public_key_x(); + // p_public_enc_key_y = ecc.public_key_y(); + // p_public_enc_comp_key_mode = INTEGER(0); + // } else if (p.publicKey().ecencSm2().ischosen(Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__1)) { + // p_public_enc_comp_key = p.publicKey().ecencSm2().compressed__y__1(); + // security_ecc ecc(ec_elliptic_curves::sm2_p_256, p_public_enc_comp_key, ecc_compressed_mode::compressed_y_1); + // p_public_enc_key_x = ecc.public_key_x(); + // p_public_enc_key_y = ecc.public_key_y(); + // p_public_enc_comp_key_mode = INTEGER(1); + // } else if (p.publicKey().ecencSm2().ischosen(Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_uncompressedP256)) { + // p_public_enc_key_x = p.publicKey().ecencSm2().uncompressedP256().x(); + // p_public_enc_key_y = p.publicKey().ecencSm2().uncompressedP256().y(); + // } else { + // loggers::get_instance().error("security_services_its::extract_encryption_keys: Unsupported EncryptionKey"); + // return -1; + // } } else { loggers::get_instance().error("security_services_its::extract_encryption_keys: Unsupported EncryptionKey"); return -1; @@ -1551,6 +1693,10 @@ int security_services_its::read_private_key(const CHARSTRING &p_certificate_id, return _security_db.get()->get_private_key(std::string(static_cast(p_certificate_id)), p_private_key); } +int security_services_its::read_public_keys(const CHARSTRING &p_certificate_id, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y) const { + return _security_db.get()->get_public_keys(std::string(static_cast(p_certificate_id)), p_public_key_x, p_public_key_y); +} + int security_services_its::read_private_enc_key(const CHARSTRING &p_certificate_id, OCTETSTRING &p_private_enc_key) const { return _security_db.get()->get_private_enc_key(std::string(static_cast(p_certificate_id)), p_private_enc_key); } diff --git a/ccsrc/Protocols/Security/security_services_its.hh b/ccsrc/Protocols/Security/security_services_its.hh index 45e2476..601d234 100644 --- a/ccsrc/Protocols/Security/security_services_its.hh +++ b/ccsrc/Protocols/Security/security_services_its.hh @@ -25,6 +25,8 @@ namespace Ieee1609Dot2 { class SignedData; //! TITAN forward declaration class EncryptedData; //! TITAN forward declaration class SignerIdentifier; //! TITAN forward declaration + class VerificationKeyIndicator; + //! TITAN forward declaration } // namespace Ieee1609Dot2 /*! @@ -126,6 +128,7 @@ public: /*! \publicsection */ int read_certificate_from_digest(const OCTETSTRING &p_digest, CHARSTRING &p_certificate_id) const; int read_certificate_from_hashed_id3(const OCTETSTRING &p_digest, CHARSTRING &p_certificate_id) const; int read_private_key(const CHARSTRING &p_certificate_id, OCTETSTRING &p_private_key) const; + int read_public_keys(const CHARSTRING &p_certificate_id, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y) const; int read_private_enc_key(const CHARSTRING &p_certificate_id, OCTETSTRING &p_private_enc_key) const; /*! @@ -178,6 +181,7 @@ private: int sign_ecdsa_nistp384(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params); int sign_ecdsa_brainpoolp256r1(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params); int sign_ecdsa_brainpoolp384r1(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params); + int sign_ecdsa_sm2p256(const OCTETSTRING &p_hash, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params); int verify_sign_ecdsa_nistp256(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, const std::string &p_certificate_id, params_its &p_params); int verify_sign_ecdsa_nistp384(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, const std::string &p_certificate_id, @@ -186,6 +190,8 @@ private: params_its &p_params); int verify_sign_ecdsa_brainpoolp384r1(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, const std::string &p_certificate_id, params_its &p_params); + int verify_sign_ecdsa_sm2p256(const OCTETSTRING &p_hash, const Ieee1609Dot2BaseTypes::Signature &p_signature, const std::string &p_certificate_id, + params_its &p_params); int extract_verification_keys(const Ieee1609Dot2::CertificateBase &p_cert, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y, OCTETSTRING &p_public_comp_key, INTEGER &p_public_comp_key_mode); diff --git a/ccsrc/framework/include/params_its.hh b/ccsrc/framework/include/params_its.hh index 53d215c..58f18f1 100644 --- a/ccsrc/framework/include/params_its.hh +++ b/ccsrc/framework/include/params_its.hh @@ -56,8 +56,8 @@ public: //! \publicsection static const std::string& certificate; //! The certificate identifier the Test System shall use. E.g. CERT_TS_A static const std::string& peer_certificate; //! The peer certificate identifier the Test System shall use for encryption. E.g. CERT_TS_A static const std::string& hash; //! The digest algorithm the Test System shall use, authorised values are SHA-256 or SHA-384. Default: SHA-256 - static const std::string& signature; //! The signature algorithm the Test System shall use, authorised values are NISTP-256, BP-256 and BP-384. Default: NISTP-256 - static const std::string& cypher; //! The encryption algorithm the Test System shall use, authorised values are NISTP-256 and BP-256. Default: NISTP-256 + static const std::string& signature; //! The signature algorithm the Test System shall use, authorised values are NISTP-256, BP-256, BP-384 and SM2P-256. Default: NISTP-256 + static const std::string& cypher; //! The encryption algorithm the Test System shall use, authorised values are NISTP-256, BP-256 and SM2P-256. Default: NISTP-256 static const std::string& distanceA; //! Test system GeoNetworking DistanceA parameter name static const std::string& distanceB; //! Test system GeoNetworking DistanceB parameter name static const std::string& angle; //! Test system GeoNetworking Angle parameter name diff --git a/data/certificates/Makefile b/data/certificates/Makefile index 2681cd1..1983449 100644 --- a/data/certificates/Makefile +++ b/data/certificates/Makefile @@ -54,11 +54,15 @@ certs_iut_at = $(filter $(outdir)/CERT_IUT_%_AT.oer, $(certificates_oer)) vkeys_iut_at = $(patsubst %.oer, %.vkey, $(certs_iut_at)) ekeys_iut_at = $(patsubst %.oer, %.ekey, $(certs_iut_at)) +certs_iut_at_imp = $(filter $(outdir)/CERT_IUT_%_AT_IMP.oer, $(certificates_oer)) +vkeys_iut_at_imp = $(patsubst %.oer, %.vkey, $(certs_iut_at_imp)) +ekeys_iut_at_imp = $(patsubst %.oer, %.ekey, $(certs_iut_at_imp)) + certs_iut := $(filter $(outdir)/CERT_IUT_%_RCA.oer, $(certificates_oer)) certs_iut += $(filter $(outdir)/CERT_IUT_%_AA.oer, $(certificates_oer)) -certs_iut += $(certs_iut_at) +certs_iut += $(certs_iut_at) $(certs_iut_at_imp) -iut_files = $(patsubst $(outdir)/%, $(iutdir)/%, $(certs_iut) $(vkeys_iut_at) $(ekeys_iut_at)) +iut_files = $(patsubst $(outdir)/%, $(iutdir)/%, $(certs_iut) $(vkeys_iut_at) $(ekeys_iut_at) $(vkeys_iut_at_imp) $(ekeys_iut_at_imp)) install: $(iutdir) $(iut_files) $(iutdir)/index.lst @@ -68,14 +72,14 @@ $(iut_files): $(iutdir)/%: $(outdir)/% $(iutdir)/index.lst: $(certs_iut) $(asn1certidx) -o $@ $^ -$(vkeys_iut_at) $(ekeys_iut_at): +$(vkeys_iut_at) $(ekeys_iut_at) $(vkeys_iut_at_imp) $(ekeys_iut_at_imp): -IUT_TC23 = CERT_IUT_C1_AT.oer CERT_IUT_C1_AT.vkey CERT_IUT_C1_AT.ekey CERT_IUT_CC_AA.oer CERT_IUT_C_RCA.oer CERT_TS_A_AT.oer CERT_IUT_A_AA.oer -IUT_TC24 = CERT_IUT_C2_AT.oer CERT_IUT_C2_AT.vkey CERT_IUT_C2_AT.ekey CERT_IUT_C2_AA.oer CERT_IUT_C_RCA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_IUT_A_AA.oer -IUT_TC25 = CERT_IUT_A1_AT.oer CERT_IUT_A1_AT.vkey CERT_IUT_A1_AT.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer -IUT_TC26 = CERT_IUT_A2_AT.oer CERT_IUT_A2_AT.vkey CERT_IUT_A2_AT.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer -IUT_TC27 = CERT_IUT_A3_AT.oer CERT_IUT_A3_AT.vkey CERT_IUT_A3_AT.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer -IUT_TC28 = CERT_IUT_A_AT_A8.oer CERT_IUT_A_AT_A8.vkey CERT_IUT_A_AT_A8.ekey CERT_IUT_A_AA_A8.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_IUT_A_AA.oer +IUT_TC23 = CERT_IUT_C1_AT.oer CERT_IUT_C1_AT.vkey CERT_IUT_C1_AT.ekey CERT_IUT_CC_AA.oer CERT_IUT_C_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer CERT_IUT_A_AA.oer +IUT_TC24 = CERT_IUT_C2_AT.oer CERT_IUT_C2_AT.vkey CERT_IUT_C2_AT.ekey CERT_IUT_C2_AA.oer CERT_IUT_C_RCA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer CERT_IUT_A_AA.oer +IUT_TC25 = CERT_IUT_A1_AT.oer CERT_IUT_A1_AT.vkey CERT_IUT_A1_AT.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer +IUT_TC26 = CERT_IUT_A2_AT.oer CERT_IUT_A2_AT.vkey CERT_IUT_A2_AT.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer +IUT_TC27 = CERT_IUT_A3_AT.oer CERT_IUT_A3_AT.vkey CERT_IUT_A3_AT.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer +IUT_TC28 = CERT_IUT_A_AT_A8.oer CERT_IUT_A_AT_A8.vkey CERT_IUT_A_AT_A8.ekey CERT_IUT_A_AA_A8.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer CERT_IUT_A_AA.oer IUT_TCS = TC23 TC24 TC25 TC26 TC27 TC28 diff --git a/data/certificates/profiles/CERT_IUT_A_AT.xml b/data/certificates/profiles/CERT_IUT_A_AT.xml index 1c9a403..2f6613c 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml b/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml new file mode 100644 index 0000000..85f865b --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml @@ -0,0 +1,35 @@ + + +3 + + + + + + + + + + + +> + + + + + + + + +01 FF FC  +01 FF FF FF  +   + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_A_AT_IMP.xml b/data/certificates/profiles/CERT_TS_A_AT_IMP.xml new file mode 100644 index 0000000..85f865b --- /dev/null +++ b/data/certificates/profiles/CERT_TS_A_AT_IMP.xml @@ -0,0 +1,35 @@ + + +3 + + + + + + + + + + + +> + + + + + + + + +01 FF FC  +01 FF FF FF  +   + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_A_AT_IMP_BO.xml b/data/certificates/profiles/CERT_TS_A_AT_IMP_BO.xml new file mode 100644 index 0000000..e620143 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_A_AT_IMP_BO.xml @@ -0,0 +1,36 @@ + + +3 + + + + + + + + + + + +> + + + + + + + + +01 FF FC  +01 FF FF FF  +   + + + + + + + + + + diff --git a/etc/AtsPki/AtsPki_Atos.cfg_ b/etc/AtsPki/AtsPki_Atos.cfg_ index 671ae27..b53626e 100644 --- a/etc/AtsPki/AtsPki_Atos.cfg_ +++ b/etc/AtsPki/AtsPki_Atos.cfg_ @@ -70,11 +70,11 @@ LibItsPki_Pics.PICS_EA_ENDPOINT := "http://yanngarcia.ddns.net/ea" #LibItsPki_Pixits.PX_INCLUDE_ENCRYPTION_KEYS := false # No encryption key in Authorization request -#LibItsPki_Pixits.PX_VE_ALG := e_brainpool_p256_r1 # e_nist_p256, e_brainpool_p256_r1 or e_brainpool_p384_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_EC := e_brainpool_p256_r1 # e_nist_p256, e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256, e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256, e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_AT := e_brainpool_p256_r1 # e_nist_p256, e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_VE_ALG := e_brainpool_p256_r1 # e_nist_p256, e_nist_p384, e_sm2_p256, e_brainpool_p256_r1 or e_brainpool_p384_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_EC := e_brainpool_p256_r1 # e_nist_p256, e_brainpool_p256_r1, e_sm2_p256 +#LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256, e_brainpool_p256_r1, e_sm2_p256 +#LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256, e_brainpool_p256_r1, e_sm2_p256 +#LibItsPki_Pixits.PX_EC_ALG_FOR_AT := e_brainpool_p256_r1 # e_nist_p256, e_brainpool_p256_r1, e_sm2_p256 LibItsSecurity_Pics.PICS_SEC_CIRCULAR_REGION := false LibItsSecurity_Pics.PICS_SEC_RECTANGULAR_REGION := true diff --git a/etc/AtsPki/AtsPki_Autocrypt.cfg_ b/etc/AtsPki/AtsPki_Autocrypt.cfg_ index 630de23..67bbcef 100644 --- a/etc/AtsPki/AtsPki_Autocrypt.cfg_ +++ b/etc/AtsPki/AtsPki_Autocrypt.cfg_ @@ -57,12 +57,12 @@ LibItsPki_Pics.PICS_HTTP_POST_URI_DC := "/ctl" #LibItsPki_Pixits.PX_INCLUDE_ENCRYPTION_KEYS := false # No encryption key in Authorization request -#LibItsPki_Pixits.PX_VE_ALG := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p384_r1 +#LibItsPki_Pixits.PX_VE_ALG := e_brainpool_p256_r1 # e_nist_p256, e_nist_p384, e_sm2_p256 or e_brainpool_p384_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_EC := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_AT := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_EC := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_AT := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 LibItsSecurity_Pics.PICS_SEC_CIRCULAR_REGION := false LibItsSecurity_Pics.PICS_SEC_RECTANGULAR_REGION := true diff --git a/etc/AtsPki/AtsPki_Ctag.cfg_ b/etc/AtsPki/AtsPki_Ctag.cfg_ index b6bcc92..8105a3f 100644 --- a/etc/AtsPki/AtsPki_Ctag.cfg_ +++ b/etc/AtsPki/AtsPki_Ctag.cfg_ @@ -58,12 +58,12 @@ LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3 #LibItsPki_Pixits.PX_INCLUDE_ENCRYPTION_KEYS := false # No encryption key in Authorization request -#LibItsPki_Pixits.PX_VE_ALG := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p384_r1 +#LibItsPki_Pixits.PX_VE_ALG := e_brainpool_p256_r1 # e_nist_p256, e_nist_p384, e_sm2_p256 or e_brainpool_p384_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_EC := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_AT := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_EC := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_AT := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 LibItsSecurity_Pics.PICS_SEC_CIRCULAR_REGION := false LibItsSecurity_Pics.PICS_SEC_RECTANGULAR_REGION := true diff --git a/etc/AtsPki/AtsPki_Etas.cfg_ b/etc/AtsPki/AtsPki_Etas.cfg_ index 5bfc8b7..5f4b93a 100644 --- a/etc/AtsPki/AtsPki_Etas.cfg_ +++ b/etc/AtsPki/AtsPki_Etas.cfg_ @@ -66,12 +66,12 @@ LibItsPki_Pics.PICS_EA_ENDPOINT := "http://yanngarcia.ddns.net/ea" #LibItsPki_Pixits.PX_INCLUDE_ENCRYPTION_KEYS := false # No encryption key in Authorization request -#LibItsPki_Pixits.PX_VE_ALG := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p384_r1 +#LibItsPki_Pixits.PX_VE_ALG := e_brainpool_p256_r1 # e_nist_p256, e_nist_p384, e_sm2_p256 or e_brainpool_p384_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_EC := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_AT := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_EC := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_AT := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 LibItsSecurity_Pics.PICS_SEC_CIRCULAR_REGION := false LibItsSecurity_Pics.PICS_SEC_RECTANGULAR_REGION := false diff --git a/etc/AtsPki/AtsPki_Microsec.cfg_ b/etc/AtsPki/AtsPki_Microsec.cfg_ index d4bcf7e..bfda4f8 100644 --- a/etc/AtsPki/AtsPki_Microsec.cfg_ +++ b/etc/AtsPki/AtsPki_Microsec.cfg_ @@ -52,12 +52,12 @@ LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3 #LibItsPki_Pixits.PX_INCLUDE_ENCRYPTION_KEYS := false # No encryption key in Authorization request -#LibItsPki_Pixits.PX_VE_ALG := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p384_r1 +#LibItsPki_Pixits.PX_VE_ALG := e_brainpool_p256_r1 # e_nist_p256, e_nist_p384, e_sm2_p256 or e_brainpool_p384_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_EC := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_AT := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_EC := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_AT := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 LibItsSecurity_Pics.PICS_SEC_CIRCULAR_REGION := false LibItsSecurity_Pics.PICS_SEC_RECTANGULAR_REGION := true diff --git a/etc/AtsPki/AtsPki_Simu.cfg_ b/etc/AtsPki/AtsPki_Simu.cfg_ index 7fe3098..6a984ce 100644 --- a/etc/AtsPki/AtsPki_Simu.cfg_ +++ b/etc/AtsPki/AtsPki_Simu.cfg_ @@ -61,11 +61,11 @@ LibItsPki_Pics.PICS_SECPKI_REENROLMENT := true #LibItsPki_Pixits.PX_INCLUDE_ENCRYPTION_KEYS := false # No encryption key in Authorization request #LibItsPki_Pixits.PICS_PKI_AUTH_POP := false # Do not use Signed for PoP in Authorization requet -#LibItsPki_Pixits.PX_VE_ALG := e_brainpool_p256_r1 # e_nist_p256, e_brainpool_p256_r1 or e_brainpool_p384_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_EC := e_brainpool_p256_r1 # e_nist_p256, e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256, e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256, e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_AT := e_brainpool_p256_r1 # e_nist_p256, e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_VE_ALG := e_brainpool_p256_r1 # e_nist_p256, e_nist_p384, e_sm2_p256, e_brainpool_p256_r1 or e_brainpool_p384_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_EC := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256, e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256, e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256, e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_AT := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256, e_brainpool_p256_r1 LibItsSecurity_Pics.PICS_SEC_CIRCULAR_REGION := false LibItsSecurity_Pics.PICS_SEC_RECTANGULAR_REGION := true diff --git a/etc/AtsSecurity/AtsSecurity.cfg b/etc/AtsSecurity/AtsSecurity.cfg index 61ad421..494d7b1 100644 --- a/etc/AtsSecurity/AtsSecurity.cfg +++ b/etc/AtsSecurity/AtsSecurity.cfg @@ -150,6 +150,16 @@ system.camUtPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_po #Check that ITS-S sends a Ieee1609Dot2Data containing protocol version set to 3 #ItsSecurity_TestCases.TC_SEC_ITSS_SND_MSG_01_BV +# --------------------- IMPILICT CERT --------------------- +# Check that IUT supports usage of implicit certificate for signing message +ItsSecurity_TestCases.TC_SEC_ITSS_RCV_IMPLICIT_CERT_01_BV + +# Check that IUT accepts a valid secured CAM message signed with implicit certificate +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BV + +# Check that IUT discards a valid secured CAM message signed with implicit certificate containing signature +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BO + # ------------------------- CAM --------------------------- # Check that IUT sends the secured CAM using SignedData container. #ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_01_BV @@ -188,7 +198,7 @@ system.camUtPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_po # Check that IUT sends the secured CAM containing the signing certificate when the IUT received CAM from an unknown ITS-S. # When there is a new ITS-S detected, the OBU send immediaty its signing certificate to anticipate any certificate distribution -ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_08_BV +#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 diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index 6f6e1f0..1800c76 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit 6f6e1f09705a881f16b5689c46666202b7800214 +Subproject commit 1800c762a7dbc5b6edbd8442b1e196035ff29bbc -- GitLab From 4456ec71c5130958d82209a661650134ade45c53 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Wed, 3 May 2023 10:37:34 +0200 Subject: [PATCH 070/178] Support of implicit certificates step2: Sending message signed by implicit certificate --- .clang-format | 2 +- ccsrc/Externals/LibItsSecurity_externals.cc | 6 +- .../Protocols/Security/certificates_loader.cc | 79 ++++++------------- ccsrc/Protocols/Security/security_cache.cc | 56 +++++++++++-- ccsrc/Protocols/Security/security_cache.hh | 10 ++- ccsrc/Protocols/Security/security_db.cc | 4 +- ccsrc/Protocols/Security/security_db.hh | 4 +- .../Protocols/Security/security_db_record.cc | 8 +- .../Protocols/Security/security_db_record.hh | 10 ++- ccsrc/Protocols/Security/security_ecc.cc | 45 ++++------- .../Security/security_services_its.cc | 32 ++++++-- .../Security/security_services_its.hh | 4 +- scripts/run_all.bash | 17 +++- scripts/run_ptcs.bash | 10 ++- titan-test-system-framework | 2 +- 15 files changed, 165 insertions(+), 124 deletions(-) diff --git a/.clang-format b/.clang-format index ec54747..f81879c 100644 --- a/.clang-format +++ b/.clang-format @@ -44,7 +44,7 @@ BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: BeforeColon BreakAfterJavaFieldAnnotations: false BreakStringLiterals: true -ColumnLimit: 160 +ColumnLimit: 180 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: false diff --git a/ccsrc/Externals/LibItsSecurity_externals.cc b/ccsrc/Externals/LibItsSecurity_externals.cc index 5201f36..10bc42e 100644 --- a/ccsrc/Externals/LibItsSecurity_externals.cc +++ b/ccsrc/Externals/LibItsSecurity_externals.cc @@ -1879,7 +1879,7 @@ namespace LibItsSecurity__Functions { return TRUE; } - BOOLEAN fx__store__certificate(const CHARSTRING &p__cert__id, const OCTETSTRING &p__cert, const OCTETSTRING &p__private__key, + BOOLEAN fx__store__certificate(const INTEGER& p__signing__algorithm, const CHARSTRING &p__cert__id, const OCTETSTRING &p__cert, const OCTETSTRING &p__private__key, const OCTETSTRING &p__public__key__x, const OCTETSTRING &p__public__key__y, const OCTETSTRING &p__public__key__compressed, const INTEGER &p__public__key__compressed__mode, const OCTETSTRING &p__hash, const OCTETSTRING &p__hash__256, const OCTETSTRING &p__hashid8, const OCTETSTRING &p__issuer, const OCTETSTRING_template &p__private__enc__key, @@ -1893,12 +1893,12 @@ namespace LibItsSecurity__Functions { const OCTETSTRING public_enc_key_x = p__public__enc__key__x.valueof(); const OCTETSTRING public_enc_key_y = p__public__enc__key__y.valueof(); result = security_services_its::get_instance().store_certificate( - p__cert__id, p__cert, p__private__key, p__public__key__x, p__public__key__y, p__public__key__compressed, p__public__key__compressed__mode, p__hash, + static_cast(static_cast(p__signing__algorithm)), p__cert__id, p__cert, p__private__key, p__public__key__x, p__public__key__y, p__public__key__compressed, p__public__key__compressed__mode, p__hash, p__hash__256, p__hashid8, p__issuer, p__private__enc__key.valueof(), p__public__enc__key__x.valueof(), p__public__enc__key__y.valueof(), p__public__enc__compressed__key.valueof(), p__public__enc__key__compressed__mode.valueof()); } else { result = security_services_its::get_instance().store_certificate( - p__cert__id, p__cert, p__private__key, p__public__key__x, p__public__key__y, p__public__key__compressed, p__public__key__compressed__mode, p__hash, + static_cast(static_cast(p__signing__algorithm)), p__cert__id, p__cert, p__private__key, p__public__key__x, p__public__key__y, p__public__key__compressed, p__public__key__compressed__mode, p__hash, p__hash__256, p__hashid8, p__issuer, OCTETSTRING(0, nullptr), OCTETSTRING(0, nullptr), OCTETSTRING(0, nullptr), OCTETSTRING(0, nullptr), INTEGER(-1)); } diff --git a/ccsrc/Protocols/Security/certificates_loader.cc b/ccsrc/Protocols/Security/certificates_loader.cc index 34ba086..2e3bd3b 100644 --- a/ccsrc/Protocols/Security/certificates_loader.cc +++ b/ccsrc/Protocols/Security/certificates_loader.cc @@ -119,7 +119,7 @@ std::map& certificates_load int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const std::string p_certificate_name, std::map> & p_certificates) { loggers::get_instance().log_msg(">>> certificates_loader::load_certificate", p_hashed_id8); - loggers::get_instance().log(">>> certificates_loader::load_certificate: %s", p_certificate_name.c_str()); + loggers::get_instance().log(">>> certificates_loader::load_certificate: '%s'", p_certificate_name.c_str()); std::experimental::filesystem::path p = _full_path.string() + "/" + p_certificate_name + _certificateExt; const std::string& key = p.stem(); @@ -132,6 +132,7 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const OCTETSTRING certificate = int2oct(0, std::experimental::filesystem::file_size(p)); is.read((char *)static_cast(certificate), certificate.lengthof()); is.close(); + loggers::get_instance().log_msg("certificates_loader::load_certificate: certificate: ", certificate); // Load private key file OCTETSTRING private_key; @@ -237,26 +238,33 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const if (decoded_certificate.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_verificationKey)) { // loggers::get_instance().log_msg("certificates_loader::load_certificate: Decoded certificate: ", decoded_certificate); + ec_elliptic_curves algorithm; OCTETSTRING public_key_x; OCTETSTRING public_key_y; OCTETSTRING public_comp_key; // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) Ieee1609Dot2BaseTypes::PublicVerificationKey &b = decoded_certificate.toBeSigned().verifyKeyIndicator().verificationKey(); if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP256)) { + algorithm = ec_elliptic_curves::nist_p_256; Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaNistP256(); fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, public_comp_key, public_key_x, public_key_y); } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP384)) { - Ieee1609Dot2BaseTypes::EccP384CurvePoint &p = b.ecdsaNistP384(); - fill_public_key_vectors(ec_elliptic_curves::nist_p_384, p, public_comp_key, public_key_x, public_key_y); + algorithm = ec_elliptic_curves::nist_p_384; + Ieee1609Dot2BaseTypes::EccP384CurvePoint &p = b.ecdsaNistP384(); + fill_public_key_vectors(ec_elliptic_curves::nist_p_384, p, public_comp_key, public_key_x, public_key_y); } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP256r1)) { + algorithm = ec_elliptic_curves::brainpool_p_256_r1; Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaBrainpoolP256r1(); fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, public_comp_key, public_key_x, public_key_y); } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP384r1)) { + algorithm = ec_elliptic_curves::brainpool_p_384_r1; Ieee1609Dot2BaseTypes::EccP384CurvePoint &p = b.ecdsaBrainpoolP384r1(); fill_public_key_vectors(ec_elliptic_curves::brainpool_p_384_r1, p, public_comp_key, public_key_x, public_key_y); } else { // ALT_ecsigSm2 + algorithm = ec_elliptic_curves::sm2_p_256; Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecsigSm2(); fill_public_key_vectors(ec_elliptic_curves::sm2_p_256, p, public_comp_key, public_key_x, public_key_y); } + // loggers::get_instance().log("certificates_loader::load_certificate: algorithm: %d", algorithm); // loggers::get_instance().log_msg("certificates_loader::load_certificate: public_key_x: ", public_key_x); // loggers::get_instance().log_msg("certificates_loader::load_certificate: public_key_y: ", public_key_y); // loggers::get_instance().log_msg("certificates_loader::load_certificate: public_comp_key: ", public_comp_key); @@ -280,30 +288,9 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const loggers::get_instance().log_msg("certificates_loader::load_certificate: hash: ", hash); loggers::get_instance().log_msg("certificates_loader::load_certificate: hashed_id: ", hashed_id); - - - - loggers::get_instance().log("certificates_loader::load_certificate: ######## key: '%s'", key.c_str()); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## certificate: ", certificate); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## decoded_certificate: ", decoded_certificate); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## issuer: ", issuer); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## hash: ", hash); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## hash_sha_256: ", hash_sha_256); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## hashed_id: ", hashed_id); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## private_key: ", private_key); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_key_x: ", public_key_x); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_key_y: ", public_key_y); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_comp_key: ", public_comp_key); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## private_enc_key: ", private_enc_key); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_enc_key_x: ", public_enc_key_x); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_enc_key_y: ", public_enc_key_y); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_enc_comp_key: ", public_enc_comp_key); - - - - // Create new record security_db_record *r = new security_db_record( + algorithm, // Signing algorithm key, // Certificate name. Index key certificate, // Certificate decoded_certificate, @@ -346,18 +333,18 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const loggers::get_instance().log_msg("certificates_loader::load_certificate: Implicit certificate issuer: ", m.cbegin()->second->decoded_certificate()); // Retrieve the issuer signing key const Ieee1609Dot2BaseTypes::PublicVerificationKey &b = m.cbegin()->second->decoded_certificate().toBeSigned().verifyKeyIndicator().verificationKey(); - ec_elliptic_curves algo; + ec_elliptic_curves algorithm; OCTETSTRING issuer_sign_key_x; OCTETSTRING issuer_sign_key_y; OCTETSTRING issuer_sign_key_comp_key; // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP256)) { const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaNistP256(); fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, issuer_sign_key_comp_key, issuer_sign_key_x, issuer_sign_key_y); - algo = ec_elliptic_curves::nist_p_256; + algorithm = ec_elliptic_curves::nist_p_256; } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP256r1)) { const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaBrainpoolP256r1(); fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, issuer_sign_key_comp_key, issuer_sign_key_x, issuer_sign_key_y); - algo = ec_elliptic_curves::brainpool_p_256_r1; + algorithm = ec_elliptic_curves::brainpool_p_256_r1; } else { loggers::get_instance().warning("certificates_loader::load_certificate: Incosistent certificate issuer: Wrong PublicVerificationKey"); return -1; @@ -385,19 +372,21 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const OCTETSTRING input = hash_tbs + m.cbegin()->second->hash_sha_256(); loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: input: ", input); // Reconstruction of the public key. - security_ecc r_key(algo, rv_key_x, rv_key_y); // Reconstruction key OCTETSTRING public_key_x; // public keys X-coordinate OCTETSTRING public_key_y; // public keys Y-coordinate OCTETSTRING public_comp_key; // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) INTEGER public_comp_key_mode; // public compressed key mode (02 or 03) - if (r_key.reconstruct_public_keys(input, static_cast(issuer_sign_key_x), static_cast(issuer_sign_key_y), public_key_x, public_key_y, public_comp_key, public_comp_key_mode) == -1) { - loggers::get_instance().warning("certificates_loader::load_certificate: Failed to encode toBeSigned"); - return -1; + { + security_ecc r_key(algorithm, rv_key_x, rv_key_y); // Reconstruction key + if (r_key.reconstruct_public_keys(input, static_cast(issuer_sign_key_x), static_cast(issuer_sign_key_y), public_key_x, public_key_y, public_comp_key, public_comp_key_mode) == -1) { + loggers::get_instance().warning("certificates_loader::load_certificate: Failed to encode toBeSigned"); + return -1; + } } loggers::get_instance().log_msg("certificates_loader::load_certificate: public_key_x: ", public_key_x); loggers::get_instance().log_msg("certificates_loader::load_certificate: public_key_y: ", public_key_y); loggers::get_instance().log_msg("certificates_loader::load_certificate: public_comp_key: ", public_comp_key); - loggers::get_instance().log("certificates_loader::load_certificate: public_comp_key_mode: '%d': ", public_comp_key_mode); + loggers::get_instance().log_msg("certificates_loader::load_certificate: public_comp_key_mode: ", public_comp_key_mode); OCTETSTRING hash = hash_sha_256; // Whole-certificate hash OCTETSTRING hashed_id; // Whole-certificate hashedid-8 @@ -405,31 +394,9 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const loggers::get_instance().log_msg("certificates_loader::load_certificate: hash: ", hash); loggers::get_instance().log_msg("certificates_loader::load_certificate: hashed_id: ", hashed_id); - - - - loggers::get_instance().log("certificates_loader::load_certificate: ######## key: '%s'", key.c_str()); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## certificate: ", certificate); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## decoded_certificate: ", decoded_certificate); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## issuer: ", issuer); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## hash: ", hash); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## hash_sha_256: ", hash_sha_256); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## hashed_id: ", hashed_id); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## private_key: ", private_key); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_key_x: ", public_key_x); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_key_y: ", public_key_y); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_comp_key: ", public_comp_key); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## private_enc_key: ", private_enc_key); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_enc_key_x: ", public_enc_key_x); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_enc_key_y: ", public_enc_key_y); - loggers::get_instance().log_msg("certificates_loader::load_certificate: ######## public_enc_comp_key: ", public_enc_comp_key); - - - - - // Create new record security_db_record *r = new security_db_record( + algorithm, // Signing algorithm key, // Certificate name. Index key certificate, // Certificate decoded_certificate, diff --git a/ccsrc/Protocols/Security/security_cache.cc b/ccsrc/Protocols/Security/security_cache.cc index 97c3935..647dd46 100644 --- a/ccsrc/Protocols/Security/security_cache.cc +++ b/ccsrc/Protocols/Security/security_cache.cc @@ -54,10 +54,13 @@ int security_cache::load_certificate(const std::string &p_certificate_id, const loggers::get_instance().warning("security_cache::load_certificate: Failed to load certificate"); return -1; } else { - it = _certificates.find(p_certificate_id); + //it = _certificates.find(p_certificate_id); + *p_record = _certificates[p_certificate_id].get(); + loggers::get_instance().log("security_cache::load_certificate: Added '%s'", (*p_record)->certificate_id().c_str()); + + return 0; } } - loggers::get_instance().log_msg("security_cache::load_certificate: Loaded certificate: ", it->second.get()->decoded_certificate()); *p_record = it->second.get(); @@ -100,12 +103,36 @@ int security_cache::get_certificate(const std::string &p_certificate_id, Ieee160 const security_db_record* record; if (load_certificate(p_certificate_id, &record) == -1) { - loggers::get_instance().warning("security_cache::get_private_key: Failed to load certificate"); + loggers::get_instance().warning("security_cache::get_certificate (1): Failed to load certificate"); return -1; } - loggers::get_instance().log("security_cache::get_certificate (1): Certificate loaded"); - loggers::get_instance().log_msg("security_cache::get_certificate (1): Certificate loaded: ", record->decoded_certificate()); + + + + + loggers::get_instance().log("security_cache::get_certificate (1): ######## algorithm: '%d'", record->signing_algorithm()); + loggers::get_instance().log("security_cache::get_certificate (1): ######## key: '%s'", record->certificate_id().c_str()); + loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## certificate: ", record->certificate()); + loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## decoded_certificate: ", record->decoded_certificate()); + loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## issuer: ", record->issuer()); + loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## hash: ", record->hash()); + // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## hash_sha_256: ", hash_sha_256); + // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## hashed_id: ", hashed_id); + // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## private_key: ", private_key); + // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## public_key_x: ", public_key_x); + // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## public_key_y: ", public_key_y); + // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## public_comp_key: ", public_comp_key); + // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## private_enc_key: ", private_enc_key); + // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## public_enc_key_x: ", public_enc_key_x); + // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## public_enc_key_y: ", public_enc_key_y); + // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## public_enc_comp_key: ", public_enc_comp_key); + + + + + //loggers::get_instance().log("<<< security_cache::get_certificate (1): Added '%s'", record->certificate_id().c_str()); + //loggers::get_instance().log_msg("security_cache::get_certificate (1): ", record->decoded_certificate()); p_certificate = record->decoded_certificate(); return 0; @@ -153,6 +180,20 @@ int security_cache::get_certificate_hashed_id3(const OCTETSTRING &p_hashed_id3, return 0; } +int security_cache::get_signing_algorithm(const std::string &p_certificate_id, ec_elliptic_curves* p_signing_algorithm) { + loggers::get_instance().log(">>> security_cache::get_signing_algorithm: '%s'", p_certificate_id.c_str()); + + const security_db_record* record; + if (load_certificate(p_certificate_id, &record) == -1) { + loggers::get_instance().warning("security_cache::get_signing_algorithm: Failed to load certificate"); + return -1; + } + + *p_signing_algorithm = record->signing_algorithm(); + + return 0; +} + int security_cache::get_issuer(const std::string &p_certificate_id, OCTETSTRING &p_hashed_id_issuer) { loggers::get_instance().log(">>> security_cache::get_issuer: '%s'", p_certificate_id.c_str()); @@ -310,7 +351,7 @@ bool security_cache::fill_vector(OCTETSTRING &p_vector, const OCTETSTRING &p_org return false; } -int security_cache::store_certificate(const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, +int security_cache::store_certificate(const ec_elliptic_curves p_signing_algorithm, const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, const OCTETSTRING &p_public_key_x, const OCTETSTRING &p_public_key_y, const OCTETSTRING &p_public_compressed_key, const INTEGER &p_public_compressed_key_mode, const OCTETSTRING &p_hash, const OCTETSTRING &p_hash_sha_256, const OCTETSTRING &p_hashed_id8, const OCTETSTRING &p_issuer, const OCTETSTRING &p_private_enc_key, @@ -351,7 +392,8 @@ int security_cache::store_certificate(const CHARSTRING &p_cert_id, const OCTETST etsi_ts103097_certificate_codec codec; codec.decode(p_cert, decoded_certificate); loggers::get_instance().log_msg("security_cache::store_certificate: Decoded certificate: ", decoded_certificate); - security_db_record *p = new security_db_record(key, // Certificate id + security_db_record *p = new security_db_record(p_signing_algorithm, // Signing algorithm + key, // Certificate id cert, // Certificate decoded_certificate, issuer, // Hashed ID for the issuer diff --git a/ccsrc/Protocols/Security/security_cache.hh b/ccsrc/Protocols/Security/security_cache.hh index ff3ed5c..69a99d3 100644 --- a/ccsrc/Protocols/Security/security_cache.hh +++ b/ccsrc/Protocols/Security/security_cache.hh @@ -84,6 +84,14 @@ public: /*! \publicsection */ * \return 0 on success, -1 otherwise */ int get_certificate_hashed_id3(const OCTETSTRING &p_hashed_id3, std::string &p_certificate_id) const; + /*! + * \fn int get_signing_algorithm(const std::string &p_certificate_id, ec_elliptic_curves* p_signing_algorithm); + * \brief Retrive the signing algorithm of the specified certificate (in case of Implicit certificate) + * \param[in] p_certificate_id The certificate name + * \param[out] p_hashed_id_issuer The HashedId8 of the isseur certificate + * \return 0 on success, -1 otherwise + */ + int get_signing_algorithm(const std::string &p_certificate_id, ec_elliptic_curves* p_signing_algorithm); /*! * \fn int get_issuer(const std::string &p_certificate_id, OCTETSTRING &p_hashed_id_issuer); * \brief Retrive the issuer of the specified certificate @@ -169,7 +177,7 @@ public: /*! \publicsection */ */ int get_public_enc_comp_key(const std::string &p_certificate_id, OCTETSTRING &p_public_enc_comp_key, INTEGER &p_enc_comp_mode); - virtual int store_certificate(const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, const OCTETSTRING &p_public_key_x, + virtual int store_certificate(const ec_elliptic_curves p_signing_algorithm, const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, const OCTETSTRING &p_public_key_x, const OCTETSTRING &p_public_key_y, const OCTETSTRING &p_public_compressed_key, const INTEGER &p_public_compressed_key_mode, const OCTETSTRING &p_hash, const OCTETSTRING &p_hash_sha_256, const OCTETSTRING &p_hashid8, const OCTETSTRING &p_issuer, const OCTETSTRING &p_private_enc_key, const OCTETSTRING &p_public_enc_key_x, const OCTETSTRING &p_public_enc_key_y, diff --git a/ccsrc/Protocols/Security/security_db.cc b/ccsrc/Protocols/Security/security_db.cc index 009c087..8dae159 100644 --- a/ccsrc/Protocols/Security/security_db.cc +++ b/ccsrc/Protocols/Security/security_db.cc @@ -38,14 +38,14 @@ int security_db::initialize_cache(const std::string &p_db_path) { return 0; } -int security_db::store_certificate(const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, const OCTETSTRING &p_public_key_x, +int security_db::store_certificate(const ec_elliptic_curves p_signing_algorithm, const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, const OCTETSTRING &p_public_key_x, const OCTETSTRING &p_public_key_y, const OCTETSTRING &p_public_compressed_key, const INTEGER &p_public_compressed_key_mode, const OCTETSTRING &p_hash, const OCTETSTRING &p_hash_sha_256, const OCTETSTRING &p_hashed_id8, const OCTETSTRING &p_issuer, const OCTETSTRING &p_private_enc_key, const OCTETSTRING &p_public_enc_key_x, const OCTETSTRING &p_public_enc_key_y, const OCTETSTRING &p_public_enc_compressd_key, const INTEGER &p_public_enc_compressed_key_mode) { loggers::get_instance().log_msg(">>> security_db::store_certificate: ", p_cert_id); - if (security_cache::store_certificate(p_cert_id, p_cert, p_private_key, p_public_key_x, p_public_key_y, p_public_compressed_key, p_public_compressed_key_mode, + if (security_cache::store_certificate(p_signing_algorithm, p_cert_id, p_cert, p_private_key, p_public_key_x, p_public_key_y, p_public_compressed_key, p_public_compressed_key_mode, p_hash, p_hash_sha_256, p_hashed_id8, p_issuer, p_private_enc_key, p_public_enc_key_x, p_public_enc_key_y, p_public_enc_compressd_key, p_public_enc_compressed_key_mode) != 0) { return -1; diff --git a/ccsrc/Protocols/Security/security_db.hh b/ccsrc/Protocols/Security/security_db.hh index dd21a21..ad757df 100644 --- a/ccsrc/Protocols/Security/security_db.hh +++ b/ccsrc/Protocols/Security/security_db.hh @@ -33,13 +33,13 @@ public: /*! \publicsection */ ~security_db(); /*! - * \fn int store_certificate(const CHARSTRING& p_cert_id, const OCTETSTRING& p_cert, const OCTETSTRING& p_private_key, const OCTETSTRING& p_public_key_x, + * \fn int store_certificate(const ec_elliptic_curves p_signing_algorithm, const CHARSTRING& p_cert_id, const OCTETSTRING& p_cert, const OCTETSTRING& p_private_key, const OCTETSTRING& p_public_key_x, * const OCTETSTRING& p_public_key_y, const OCTETSTRING& p_public_compressed_key, const INTEGER& p_public_compressed_key_mode, const OCTETSTRING& p_hashid8, * const OCTETSTRING& p_issuer, const OCTETSTRING& p_private_enc_key, const OCTETSTRING& p_public_enc_key_x, const OCTETSTRING& p_public_enc_key_y, const * OCTETSTRING& p_public_enc_compressed_key, const INTEGER& p_public_enc_compressed_key_mode); \brief Store a new certificate \param[in] p_cert_id The * certificate identifier \return 0 on success, -1 otherwise */ - int store_certificate(const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, const OCTETSTRING &p_public_key_x, + int store_certificate(const ec_elliptic_curves p_signing_algorithm, const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, const OCTETSTRING &p_public_key_x, const OCTETSTRING &p_public_key_y, const OCTETSTRING &p_public_compressed_key, const INTEGER &p_public_compressed_key_mode, const OCTETSTRING &p_hash, const OCTETSTRING &p_hash_sha_256, const OCTETSTRING &p_hashid8, const OCTETSTRING &p_issuer, const OCTETSTRING &p_private_enc_key, const OCTETSTRING &p_public_enc_key_x, const OCTETSTRING &p_public_enc_key_y, diff --git a/ccsrc/Protocols/Security/security_db_record.cc b/ccsrc/Protocols/Security/security_db_record.cc index 3760651..a724634 100644 --- a/ccsrc/Protocols/Security/security_db_record.cc +++ b/ccsrc/Protocols/Security/security_db_record.cc @@ -14,21 +14,21 @@ #include "sha256.hh" #include "sha384.hh" -security_db_record::security_db_record(const std::string &p_certificate_id, const OCTETSTRING &p_certificate, +security_db_record::security_db_record(const ec_elliptic_curves p_algorithm, const std::string &p_certificate_id, const OCTETSTRING &p_certificate, const Ieee1609Dot2::CertificateBase &p_decoded_certificate, const OCTETSTRING &p_hashed_id_issuer, const OCTETSTRING &p_hash, const OCTETSTRING &p_hash_sha_256, const OCTETSTRING &p_hashed_id, const OCTETSTRING &p_pr_key, const OCTETSTRING &p_pu_key_x, const OCTETSTRING &p_pu_key_y, const OCTETSTRING &p_pu_comp_key, const OCTETSTRING &p_pr_enc_key, const OCTETSTRING &p_pu_enc_key_x, const OCTETSTRING &p_pu_enc_key_y, const OCTETSTRING &p_pu_enc_comp_key, const bool p_to_be_saved) - : _algorithm{ec_elliptic_curves::nist_p_256}, _certificate_id(p_certificate_id), _certificate(p_certificate), _hashed_id_issuer(p_hashed_id_issuer), + : _algorithm{p_algorithm}, _certificate_id(p_certificate_id), _certificate(p_certificate), _hashed_id_issuer(p_hashed_id_issuer), _hash(p_hash), _hash_sha_256(p_hash_sha_256), _hashed_id(p_hashed_id), _pr_key(p_pr_key), _pu_key_x(p_pu_key_x), _pu_key_y(p_pu_key_y), _pu_comp_key(p_pu_comp_key), _pr_enc_key(p_pr_enc_key), _pu_enc_key_x(p_pu_enc_key_x), _pu_enc_key_y(p_pu_enc_key_y), _pu_enc_comp_key(p_pu_enc_comp_key), - _to_be_saved(p_to_be_saved), _decoded_certificate(static_cast(p_decoded_certificate.clone())) {} + _to_be_saved(p_to_be_saved), _decoded_certificate(static_cast(p_decoded_certificate.clone())) {} security_db_record::~security_db_record() { if (_decoded_certificate != nullptr) { delete _decoded_certificate; } -}; +} const Ieee1609Dot2::CertificateBase &security_db_record::decoded_certificate() const { return *_decoded_certificate; } diff --git a/ccsrc/Protocols/Security/security_db_record.hh b/ccsrc/Protocols/Security/security_db_record.hh index 94fb412..f510f95 100644 --- a/ccsrc/Protocols/Security/security_db_record.hh +++ b/ccsrc/Protocols/Security/security_db_record.hh @@ -71,7 +71,7 @@ public: /*! \publicsection */ * \param[in] p_pu_enc_comp_key_y The public compressed coordinate encryption key * \param[in] p_to_be_saved Set to true to save on disk this certificate.Default: true */ - security_db_record(const std::string &p_certificate_id, const OCTETSTRING &p_certificate, const Ieee1609Dot2::CertificateBase &p_decoded_certificate, + security_db_record(const ec_elliptic_curves p_algorithm, const std::string &p_certificate_id, const OCTETSTRING &p_certificate, const Ieee1609Dot2::CertificateBase &p_decoded_certificate, const OCTETSTRING &p_hashed_id_issuer, const OCTETSTRING &p_hash, const OCTETSTRING &p_hash_sha_256, const OCTETSTRING &p_hashed_id, const OCTETSTRING &p_pr_key, const OCTETSTRING &p_pu_key_x, const OCTETSTRING &p_pu_key_y, const OCTETSTRING &p_pu_comp_key, const OCTETSTRING &p_pr_enc_key, const OCTETSTRING &p_pu_enc_key_x, const OCTETSTRING &p_pu_enc_key_y, @@ -89,6 +89,14 @@ public: /*! \publicsection */ */ const Ieee1609Dot2::CertificateBase &decoded_certificate() const; + /*! + * \inline + * \fn const ec_elliptic_curves signing_algorithm() const; + * \brief Retrieve the signing algotrithm + * \return The signing algotrithm + */ + inline const ec_elliptic_curves signing_algorithm() const { return _algorithm; }; + /*! * \inline * \fn const std::string& certificate_id() const; diff --git a/ccsrc/Protocols/Security/security_ecc.cc b/ccsrc/Protocols/Security/security_ecc.cc index d8330a6..289e9fa 100644 --- a/ccsrc/Protocols/Security/security_ecc.cc +++ b/ccsrc/Protocols/Security/security_ecc.cc @@ -294,13 +294,13 @@ security_ecc::~security_ecc() { if (_ec_key != nullptr) { ::EC_KEY_free(_ec_key); + _ec_key = nullptr; } - if (_bn_ctx != nullptr) { + if (_bn_ctx != nullptr) {\ ::BN_CTX_end(_bn_ctx); ::BN_CTX_free(_bn_ctx); + _bn_ctx = nullptr; } - - loggers::get_instance().log("<<< security_ecc::~security_ecc"); } // End of Destructor int security_ecc::generate() { @@ -988,32 +988,32 @@ int security_ecc::reconstruct_public_keys(const OCTETSTRING &p_cert_to_be_signed bn_print("security_ecc::reconstruct_public_keys: order=", ::EC_GROUP_get0_order(_ec_group)); bn_print("security_ecc::reconstruct_public_keys: order=", ::EC_GROUP_get0_cofactor(_ec_group)); - BIGNUM* H = ::BN_CTX_get(_bn_ctx); + BIGNUM* H = ::BN_new(); OCTETSTRING input = p_cert_to_be_signed + ((_pub_key_compressed_mode == ecc_compressed_mode::compressed_y_0) ? int2oct(2, 1) : int2oct(3, 1)) + _pub_key_compressed; sha256 sha; OCTETSTRING hash_input; sha.generate(input, hash_input); loggers::get_instance().log_msg("security_ecc::reconstruct_public_keys: hash_input=", hash_input); ::BN_bin2bn(static_cast(hash_input), fsize, H); - bn_print("security_ecc::reconstruct_public_keys: H(1)=", H); + //bn_print("security_ecc::reconstruct_public_keys: H(1)=", H); ::BN_rshift1(H, H); // h: leftmost floor(log_2 n) bits of p_cert_to_be_signed - bn_print("security_ecc::reconstruct_public_keys: H(2)=", H); + //bn_print("security_ecc::reconstruct_public_keys: H(2)=", H); // Build QCA EC_POINT* QCA = ::EC_POINT_new(_ec_group); bin_to_ec_point(p_issuer_public_key_x, p_issuer_public_key_y, &QCA); - ec_point_print("security_ecc::reconstruct_public_keys: QCA:", QCA); + //ec_point_print("security_ecc::reconstruct_public_keys: QCA:", QCA); // Public key reconstruction // PU == _ec_key - ec_point_print("security_ecc::reconstruct_public_keys: PU:", ::EC_KEY_get0_public_key(_ec_key)); + //ec_point_print("security_ecc::reconstruct_public_keys: PU:", ::EC_KEY_get0_public_key(_ec_key)); // QU = h*PU + QCA EC_POINT* QU = ::EC_POINT_new(_ec_group); ::EC_POINT_mul(_ec_group, QU, NULL, ::EC_KEY_get0_public_key(_ec_key), H, _bn_ctx); - ec_point_print("security_ecc::reconstruct_public_keys: QU (1):", QU); + //ec_point_print("security_ecc::reconstruct_public_keys: QU (1):", QU); ::EC_POINT_add(_ec_group, QU, QU, QCA, _bn_ctx); - ec_point_print("security_ecc::reconstruct_public_keys: QU (2):", QU); + //ec_point_print("security_ecc::reconstruct_public_keys: QU (2):", QU); // Set compressed public key BIGNUM *xy = ::BN_new(); @@ -1037,8 +1037,6 @@ int security_ecc::reconstruct_public_keys(const OCTETSTRING &p_cert_to_be_signed // Generate X, Y coordinates v = int2oct(0, BN_num_bytes(xy)); ::BN_bn2bin(xy, (unsigned char *)static_cast(v)); - ::BN_clear_free(xy); - xy = nullptr; if ((v.lengthof() % 2) != 0) { // TODO Check also xy[0] == 0x04 // Remove first byte loggers::get_instance().log_msg("security_ecc::reconstruct_public_keys: Complete xy=", v); @@ -1052,6 +1050,7 @@ int security_ecc::reconstruct_public_keys(const OCTETSTRING &p_cert_to_be_signed ::BN_clear_free(H); ::BN_clear_free(xy); ::EC_POINT_free(QU); + ::EC_POINT_free(QCA); loggers::get_instance().log_msg("security_ecc::reconstruct_public_keys: p_public_key_x=", p_public_key_x); loggers::get_instance().log_msg("security_ecc::reconstruct_public_keys: p_public_key_y=", p_public_key_y); @@ -1103,7 +1102,7 @@ const int security_ecc::init() { _bn_ctx = ::BN_CTX_new(); ::BN_CTX_start(_bn_ctx); - loggers::get_instance().log("<<< security_ecc::init: 0"); + //loggers::get_instance().log("<<< security_ecc::init: 0"); return 0; } // End of init @@ -1120,28 +1119,14 @@ int security_ecc::bin_to_ec_point(const OCTETSTRING &p_public_key_x, const OCTET ::EC_POINT_bn2point(_ec_group, pubk_bn, *p_ec_point, _bn_ctx); ::BN_clear_free(pubk_bn); - // BIO *bio_out = nullptr; /* stdout */ - // bio_out = BIO_new_fp(stdout, BIO_NOCLOSE); - // BIGNUM *x = BN_new(); - // BIGNUM *y = BN_new(); - - // if (EC_POINT_get_affine_coordinates_GFp(_ec_group, *p_ec_point, x, y, nullptr)) { - // BN_print_fp(stdout, x); - // putc('\n', stdout); - // BN_print_fp(stdout, y); - // putc('\n', stdout); - // } - // BN_free(x); BN_free(y); - return 0; } int security_ecc::public_key_to_bin(OCTETSTRING &p_bin_key) { // ec_key_public_key_to_bin - const EC_GROUP *ec_group = EC_KEY_get0_group(_ec_key); - const EC_POINT *pub = EC_KEY_get0_public_key(_ec_key); - BIGNUM *pub_bn = BN_new(); + const EC_POINT *pub = ::EC_KEY_get0_public_key(_ec_key); + BIGNUM *pub_bn = ::BN_new(); - ::EC_POINT_point2bn(ec_group, pub, POINT_CONVERSION_UNCOMPRESSED, pub_bn, _bn_ctx); + ::EC_POINT_point2bn(_ec_group, pub, POINT_CONVERSION_UNCOMPRESSED, pub_bn, _bn_ctx); p_bin_key = int2oct(0, BN_num_bytes(pub_bn)); ::BN_bn2bin(pub_bn, (unsigned char *)static_cast(p_bin_key)); diff --git a/ccsrc/Protocols/Security/security_services_its.cc b/ccsrc/Protocols/Security/security_services_its.cc index 8c708dd..c0308bd 100644 --- a/ccsrc/Protocols/Security/security_services_its.cc +++ b/ccsrc/Protocols/Security/security_services_its.cc @@ -76,7 +76,7 @@ int security_services_its::setup(params_its &p_params) { // FIXME Rename this me return 0; } -int security_services_its::store_certificate(const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, +int security_services_its::store_certificate(const ec_elliptic_curves p_signing_algorithm, const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, const OCTETSTRING &p_public_key_x, const OCTETSTRING &p_public_key_y, const OCTETSTRING &p_public_comp_key, const INTEGER &p_public_comp_key_mode, const OCTETSTRING &p_hash, const OCTETSTRING &p_hash_sha_256, const OCTETSTRING &p_hashid8, const OCTETSTRING &p_issuer, const OCTETSTRING &p_private_enc_key, @@ -89,7 +89,7 @@ int security_services_its::store_certificate(const CHARSTRING &p_cert_id, const loggers::get_instance().warning("security_services_its::store_certificate: Not initialised"); return -1; } - return _security_db.get()->store_certificate(p_cert_id, p_cert, p_private_key, p_public_key_x, p_public_key_y, p_public_comp_key, p_public_comp_key_mode, + return _security_db.get()->store_certificate(p_signing_algorithm, p_cert_id, p_cert, p_private_key, p_public_key_x, p_public_key_y, p_public_comp_key, p_public_comp_key_mode, p_hash, p_hash_sha_256, p_hashid8, p_issuer, p_private_enc_key, p_public_enc_key_x, p_public_enc_key_y, p_public_enc_compressed_key, p_public_enc_key_compressed_mode); } @@ -848,7 +848,7 @@ int security_services_its::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_t Ieee1609Dot2::CertificateBase decoded_certificate; // Set signature type _security_db.get()->get_certificate(p_params[params_its::certificate], decoded_certificate); - loggers::get_instance().log_msg("security_services_its::sign_tbs_data: Got certificate", decoded_certificate); + loggers::get_instance().log_msg("security_services_its::sign_tbs_data: Got certificate: ", decoded_certificate); std::string sig("NISTP-256"); if (decoded_certificate.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_verificationKey)) { if (decoded_certificate.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP384)) { @@ -860,6 +860,15 @@ int security_services_its::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_t } else if (decoded_certificate.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecsigSm2)) { sig.assign("SM2P-256"); } + } else if (decoded_certificate.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_reconstructionValue)) { + ec_elliptic_curves signing_algorithm; + if (_security_db.get()->get_signing_algorithm(p_params[params_its::certificate], &signing_algorithm) == -1) { + loggers::get_instance().warning("security_services_its::sign_tbs_data: Failed to retrieve signing algorithm (Implicit certificate)"); + return -1; + } + if (signing_algorithm == ec_elliptic_curves::brainpool_p_256_r1) { + sig.assign("BP-256"); + } // Default: NISTP-256 } loggers::get_instance().log("security_services_its::sign_tbs_data: sig = '%s'", sig.c_str()); params_its::const_iterator it = p_params.find(params_its::signature); @@ -1342,11 +1351,12 @@ int security_services_its::verify_sign_ecdsa_sm2p256(const OCTETSTRING &p_hash, } int security_services_its::extract_verification_keys(const Ieee1609Dot2::CertificateBase &p_cert, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y, - OCTETSTRING &p_public_comp_key, INTEGER &p_public_comp_key_mode) { + OCTETSTRING &p_public_comp_key, INTEGER &p_public_comp_key_mode, ec_elliptic_curves* p_signing_algorithm) { loggers::get_instance().log("security_services_its::extract_verification_keys"); if (p_cert.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_verificationKey)) { // Explicit certificate if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP256)) { + *p_signing_algorithm = ec_elliptic_curves::nist_p_256; if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().ischosen(Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__0)) { p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().compressed__y__0(); security_ecc ecc(ec_elliptic_curves::nist_p_256, p_public_comp_key, ecc_compressed_mode::compressed_y_0); @@ -1373,6 +1383,7 @@ int security_services_its::extract_verification_keys(const Ieee1609Dot2::Certifi return -1; } } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP256r1)) { + *p_signing_algorithm = ec_elliptic_curves::brainpool_p_256_r1; if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().ischosen( Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__0)) { p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP256r1().compressed__y__0(); @@ -1396,6 +1407,7 @@ int security_services_its::extract_verification_keys(const Ieee1609Dot2::Certifi return -1; } } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP384r1)) { + *p_signing_algorithm = ec_elliptic_curves::brainpool_p_384_r1; if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().ischosen( Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__0)) { p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaBrainpoolP384r1().compressed__y__0(); @@ -1419,6 +1431,7 @@ int security_services_its::extract_verification_keys(const Ieee1609Dot2::Certifi return -1; } } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP384)) { + *p_signing_algorithm = ec_elliptic_curves::nist_p_384; if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().ischosen( Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__0)) { p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP384().compressed__y__0(); @@ -1442,6 +1455,7 @@ int security_services_its::extract_verification_keys(const Ieee1609Dot2::Certifi return -1; } } else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecsigSm2)) { + *p_signing_algorithm = ec_elliptic_curves::sm2_p_256; if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecsigSm2().ischosen( Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__0)) { p_public_comp_key = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecsigSm2().compressed__y__0(); @@ -1593,7 +1607,8 @@ int security_services_its::extract_and_store_certificate(const Ieee1609Dot2::Cer // Add it into the cache OCTETSTRING public_key_x, public_key_y, public_comp_key; INTEGER public_comp_key_mode; - if (extract_verification_keys(p_certificate, public_key_x, public_key_y, public_comp_key, public_comp_key_mode) == -1) { + ec_elliptic_curves signing_algorithm; + if (extract_verification_keys(p_certificate, public_key_x, public_key_y, public_comp_key, public_comp_key_mode, &signing_algorithm) == -1) { loggers::get_instance().error("security_services_its::extract_and_store_certificate: Unsupported EncryptionKey"); return -1; } @@ -1605,7 +1620,7 @@ int security_services_its::extract_and_store_certificate(const Ieee1609Dot2::Cer return -1; } // And store it into the cache - _security_cache.get()->store_certificate(CHARSTRING(p_certificate_id.c_str()), enc_cert, int2oct(0, 32), // No way to get the private key here + _security_cache.get()->store_certificate(signing_algorithm, CHARSTRING(p_certificate_id.c_str()), enc_cert, int2oct(0, 32), // No way to get the private key here public_key_x, public_key_y, public_comp_key, public_comp_key_mode, hash_cert, hash_cert_sha_256, hashed_id8, p_certificate.issuer().sha256AndDigest(), OCTETSTRING(0, nullptr), // Encryption private not used public_enc_key_x, public_enc_key_y, public_enc_comp_key, public_enc_comp_key_mode); @@ -1629,7 +1644,8 @@ int security_services_its::extract_and_store_certificate(const Ieee1609Dot2::Cer // Add it into the cache OCTETSTRING public_key_x, public_key_y, public_comp_key; INTEGER public_comp_key_mode; - if (extract_verification_keys(p_certificate, public_key_x, public_key_y, public_comp_key, public_comp_key_mode) == -1) { + ec_elliptic_curves signing_algorithm; + if (extract_verification_keys(p_certificate, public_key_x, public_key_y, public_comp_key, public_comp_key_mode, &signing_algorithm) == -1) { loggers::get_instance().error("security_services_its::extract_and_store_certificate: Unsupported EncryptionKey"); return -1; } @@ -1641,7 +1657,7 @@ int security_services_its::extract_and_store_certificate(const Ieee1609Dot2::Cer return -1; } // And store it into the cache - _security_cache.get()->store_certificate(CHARSTRING(p_certificate_id.c_str()), enc_cert, int2oct(0, 48), // No way to get the private key here + _security_cache.get()->store_certificate(signing_algorithm, CHARSTRING(p_certificate_id.c_str()), enc_cert, int2oct(0, 48), // No way to get the private key here public_key_x, public_key_y, public_comp_key, public_comp_key_mode, hash_cert, hash_cert_sha_256, hashed_id8, p_certificate.issuer().sha384AndDigest(), OCTETSTRING(0, nullptr), // Encryption private not used public_enc_key_x, public_enc_key_y, public_enc_comp_key, public_enc_comp_key_mode); diff --git a/ccsrc/Protocols/Security/security_services_its.hh b/ccsrc/Protocols/Security/security_services_its.hh index 601d234..52b806d 100644 --- a/ccsrc/Protocols/Security/security_services_its.hh +++ b/ccsrc/Protocols/Security/security_services_its.hh @@ -109,7 +109,7 @@ public: /*! \publicsection */ int setup(params_its &p_params); - int store_certificate(const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, const OCTETSTRING &p_public_key_x, + int store_certificate(const ec_elliptic_curves p_signing_algorithm, const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, const OCTETSTRING &p_public_key_x, const OCTETSTRING &p_public_key_y, const OCTETSTRING &p_public_comp_key, const INTEGER &p_public_comp_key_mode, const OCTETSTRING &p_hash, const OCTETSTRING &p_hash_sha_256, const OCTETSTRING &p_hashid8, const OCTETSTRING &p_issuer, const OCTETSTRING &p_private_enc_key, const OCTETSTRING &p_public_enc_key_x, const OCTETSTRING &p_public_enc_key_y, @@ -194,7 +194,7 @@ private: params_its &p_params); int extract_verification_keys(const Ieee1609Dot2::CertificateBase &p_cert, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y, - OCTETSTRING &p_public_comp_key, INTEGER &p_public_comp_key_mode); + OCTETSTRING &p_public_comp_key, INTEGER &p_public_comp_key_mode, ec_elliptic_curves* p_signing_algorithm); int extract_encryption_keys(const Ieee1609Dot2::CertificateBase &p_cert, OCTETSTRING &p_public_enc_key_x, OCTETSTRING &p_public_enc_key_y, OCTETSTRING &p_public_enc_comp_key, INTEGER &p_public_enc_comp_key_mode); int extract_and_store_certificate(const Ieee1609Dot2::CertificateBase &p_certificate, std::string &p_certificate_id); diff --git a/scripts/run_all.bash b/scripts/run_all.bash index f5fe449..288d5b7 100755 --- a/scripts/run_all.bash +++ b/scripts/run_all.bash @@ -10,17 +10,26 @@ then exit 1 fi -if ! [[ $1 =~ "^[0-9]+$" ]] +VLGD="" +if [[ $1 =~ ^[0-9]+$ ]] then COUNTER=$1 else COUNTER=1 + if [ "$1" == "valgrind" ] + then + VLGD=valgrind + fi fi if [ $COUNTER == 0 ] then - COUNTER=1 - cd .. && make && cd - + COUNTER=1 + cd .. && make && cd - + if [ "$2" == "valgrind" ] + then + VLGD=valgrind + fi fi CURPWD=`pwd` @@ -39,7 +48,7 @@ rm ../logs/$ATS/*.log for i in $(seq 1 1 $COUNTER) do ./run_mtc.bash & - ./run_ptcs.bash + ./run_ptcs.bash $VLGD dup=$(ps -ef | grep "$0" | grep -v grep | wc -l) while [ ${dup} -eq 3 ] diff --git a/scripts/run_ptcs.bash b/scripts/run_ptcs.bash index 1c097d4..be02710 100755 --- a/scripts/run_ptcs.bash +++ b/scripts/run_ptcs.bash @@ -4,6 +4,12 @@ clear +VLGD="" +if [ "$1" == "valgrind" ] +then + VLGD="valgrind --leak-check=full --show-leak-kinds=all -v" +fi + if [ -z $ATS ] then echo "ATS shall be defined" @@ -28,9 +34,9 @@ fi if [ "$ATS" == "AtsRSUsSimulator" ] then - sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH ../bin/$ATS 127.0.0.1 12001 + sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH $VLGD ../bin/$ATS 127.0.0.1 12001 else - sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH ../bin/$ATS 127.0.0.1 12000 + sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH $VLGD ../bin/$ATS 127.0.0.1 12000 fi cd ${CURPWD} diff --git a/titan-test-system-framework b/titan-test-system-framework index c4d93f6..a0803fb 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit c4d93f6e22d71386d5a5949ba1bd447e728ea060 +Subproject commit a0803fb1089eb6b1add7c00c57f4f1e77eb5cfca -- GitLab From 7008b93925659052eb2675856565126325a33603 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Wed, 3 May 2023 16:08:46 +0200 Subject: [PATCH 071/178] Support of implicit certificates step2: Sending message signed by implicit certificate --- ccsrc/Externals/LibItsSecurity_externals.cc | 26 ----------------- .../Protocols/Security/certificates_loader.cc | 12 ++++---- ccsrc/Protocols/Security/security_cache.cc | 28 ------------------- ccsrc/Protocols/Security/security_ecc.cc | 24 ++++++++-------- etc/AtsSecurity/AtsSecurity.cfg | 2 +- 5 files changed, 19 insertions(+), 73 deletions(-) diff --git a/ccsrc/Externals/LibItsSecurity_externals.cc b/ccsrc/Externals/LibItsSecurity_externals.cc index 10bc42e..921f65a 100644 --- a/ccsrc/Externals/LibItsSecurity_externals.cc +++ b/ccsrc/Externals/LibItsSecurity_externals.cc @@ -2062,32 +2062,6 @@ namespace LibItsSecurity__Functions { return TRUE; } - BOOLEAN fx__reconstructPublicKeyNistP256__test( - const OCTETSTRING &p__cert__to__be__signed, - const OCTETSTRING &p__issuer__public__key__x, - const OCTETSTRING &p__issuer__public__key__y, - const OCTETSTRING &p__reconstruct__public__key__compressed, - const INTEGER &p__compressedMode, - OCTETSTRING &p__public__key__x, - OCTETSTRING &p__public__key__y, - OCTETSTRING &p__public__key__compressed, - INTEGER &p__public__key__compressed_mode - ) { - loggers::get_instance().log_msg(">>> fx__reconstructPublicKeyNistP256__test: p__cert__to__be__signed: ", p__cert__to__be__signed); - loggers::get_instance().log_msg(">>> fx__reconstructPublicKeyNistP256__test: p__issuer__public__key__x: ", p__issuer__public__key__x); - loggers::get_instance().log_msg(">>> fx__reconstructPublicKeyNistP256__test: p__issuer__public__key__y: ", p__issuer__public__key__y); - loggers::get_instance().log_msg(">>> fx__reconstructPublicKeyNistP256__test: p__reconstruct__public__key__compressed: ", p__reconstruct__public__key__compressed); - loggers::get_instance().log_msg(">>> fx__reconstructPublicKeyNistP256__test: p__compressedMode: ", p__compressedMode); - - // Create reconstruction key - security_ecc ecc(ec_elliptic_curves::nist_p_256, p__reconstruct__public__key__compressed, (p__compressedMode == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); - if (ecc.reconstruct_public_keys(p__cert__to__be__signed, p__issuer__public__key__x, p__issuer__public__key__y, p__public__key__x, p__public__key__y, p__public__key__compressed, p__public__key__compressed_mode) == -1) { - return FALSE; - } - - return TRUE; - } - // group geospacial /* * \brief Check that given polygon doesn't have neither self-intersections nor holes. diff --git a/ccsrc/Protocols/Security/certificates_loader.cc b/ccsrc/Protocols/Security/certificates_loader.cc index 2e3bd3b..af60f43 100644 --- a/ccsrc/Protocols/Security/certificates_loader.cc +++ b/ccsrc/Protocols/Security/certificates_loader.cc @@ -371,17 +371,17 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Implicit issuer hash: ", m.cbegin()->second->hash_sha_256()); OCTETSTRING input = hash_tbs + m.cbegin()->second->hash_sha_256(); loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: input: ", input); + sha.generate(input, hash_tbs); + loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: joint hash: ", hash_tbs); // Reconstruction of the public key. OCTETSTRING public_key_x; // public keys X-coordinate OCTETSTRING public_key_y; // public keys Y-coordinate OCTETSTRING public_comp_key; // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) INTEGER public_comp_key_mode; // public compressed key mode (02 or 03) - { - security_ecc r_key(algorithm, rv_key_x, rv_key_y); // Reconstruction key - if (r_key.reconstruct_public_keys(input, static_cast(issuer_sign_key_x), static_cast(issuer_sign_key_y), public_key_x, public_key_y, public_comp_key, public_comp_key_mode) == -1) { - loggers::get_instance().warning("certificates_loader::load_certificate: Failed to encode toBeSigned"); - return -1; - } + security_ecc r_key(algorithm, rv_key_x, rv_key_y); // Reconstruction key + if (r_key.reconstruct_public_keys(hash_tbs, static_cast(issuer_sign_key_x), static_cast(issuer_sign_key_y), public_key_x, public_key_y, public_comp_key, public_comp_key_mode) == -1) { + loggers::get_instance().warning("certificates_loader::load_certificate: Failed to encode toBeSigned"); + return -1; } loggers::get_instance().log_msg("certificates_loader::load_certificate: public_key_x: ", public_key_x); loggers::get_instance().log_msg("certificates_loader::load_certificate: public_key_y: ", public_key_y); diff --git a/ccsrc/Protocols/Security/security_cache.cc b/ccsrc/Protocols/Security/security_cache.cc index 647dd46..28ea966 100644 --- a/ccsrc/Protocols/Security/security_cache.cc +++ b/ccsrc/Protocols/Security/security_cache.cc @@ -54,9 +54,7 @@ int security_cache::load_certificate(const std::string &p_certificate_id, const loggers::get_instance().warning("security_cache::load_certificate: Failed to load certificate"); return -1; } else { - //it = _certificates.find(p_certificate_id); *p_record = _certificates[p_certificate_id].get(); - loggers::get_instance().log("security_cache::load_certificate: Added '%s'", (*p_record)->certificate_id().c_str()); return 0; } @@ -107,32 +105,6 @@ int security_cache::get_certificate(const std::string &p_certificate_id, Ieee160 return -1; } - - - - - loggers::get_instance().log("security_cache::get_certificate (1): ######## algorithm: '%d'", record->signing_algorithm()); - loggers::get_instance().log("security_cache::get_certificate (1): ######## key: '%s'", record->certificate_id().c_str()); - loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## certificate: ", record->certificate()); - loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## decoded_certificate: ", record->decoded_certificate()); - loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## issuer: ", record->issuer()); - loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## hash: ", record->hash()); - // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## hash_sha_256: ", hash_sha_256); - // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## hashed_id: ", hashed_id); - // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## private_key: ", private_key); - // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## public_key_x: ", public_key_x); - // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## public_key_y: ", public_key_y); - // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## public_comp_key: ", public_comp_key); - // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## private_enc_key: ", private_enc_key); - // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## public_enc_key_x: ", public_enc_key_x); - // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## public_enc_key_y: ", public_enc_key_y); - // loggers::get_instance().log_msg("security_cache::get_certificate (1): ######## public_enc_comp_key: ", public_enc_comp_key); - - - - - //loggers::get_instance().log("<<< security_cache::get_certificate (1): Added '%s'", record->certificate_id().c_str()); - //loggers::get_instance().log_msg("security_cache::get_certificate (1): ", record->decoded_certificate()); p_certificate = record->decoded_certificate(); return 0; diff --git a/ccsrc/Protocols/Security/security_ecc.cc b/ccsrc/Protocols/Security/security_ecc.cc index 289e9fa..0c1cbf4 100644 --- a/ccsrc/Protocols/Security/security_ecc.cc +++ b/ccsrc/Protocols/Security/security_ecc.cc @@ -841,6 +841,7 @@ int security_ecc::sign(const OCTETSTRING &p_data, OCTETSTRING &p_r_sig, OCTETSTR return -1; } loggers::get_instance().log("security_ecc::sign: succeed"); + loggers::get_instance().log_msg("security_ecc::sign: signing private key: ", _pri_key); if (::ECDSA_do_verify(static_cast(p_data), p_data.lengthof(), signature, _ec_key) != 1) { loggers::get_instance().warning("security_ecc::sign: Signature not verified"); @@ -927,8 +928,8 @@ int security_ecc::sign(const OCTETSTRING &p_data, const OCTETSTRING &p_entl_a, c } int security_ecc::sign_verif(const OCTETSTRING &p_data, const OCTETSTRING &p_signature) { - loggers::get_instance().log(">>> security_ecc::sign_verif"); loggers::get_instance().log_msg(">>> security_ecc::sign_verify: p_data: ", p_data); + loggers::get_instance().log_msg(">>> security_ecc::sign_verify: p_signature: ", p_signature); // Sanity checks if (p_data.lengthof() == 0) { @@ -951,8 +952,8 @@ int security_ecc::sign_verif(const OCTETSTRING &p_data, const OCTETSTRING &p_sig } int security_ecc::sign_verif(const OCTETSTRING &p_data, const OCTETSTRING &p_entl_a, const OCTETSTRING &p_id, const OCTETSTRING &p_signature) { - loggers::get_instance().log(">>> security_ecc::sign_verif"); - loggers::get_instance().log_msg(">>> security_ecc::sign_verify: p_data: ", p_data); + loggers::get_instance().log_msg(">>> security_ecc::sign_verify (1): p_data: ", p_data); + loggers::get_instance().log_msg(">>> security_ecc::sign_verify (1): p_signature: ", p_signature); // Sanity checks if (p_data.lengthof() == 0) { @@ -961,11 +962,11 @@ int security_ecc::sign_verif(const OCTETSTRING &p_data, const OCTETSTRING &p_ent // Build the signature BIGNUM *r = ::BN_bin2bn(static_cast(p_signature), p_signature.lengthof() / 2, nullptr); - loggers::get_instance().log_to_hexa("security_ecc::sign_verify: r=", static_cast(p_signature), p_signature.lengthof() / 2); + loggers::get_instance().log_to_hexa("security_ecc::sign_verify (1): r=", static_cast(p_signature), p_signature.lengthof() / 2); BIGNUM *s = ::BN_bin2bn(static_cast(p_signature) + p_signature.lengthof() / 2, p_signature.lengthof() / 2, nullptr); - loggers::get_instance().log_to_hexa("security_ecc::sign_verify: s=", static_cast(p_signature) + p_signature.lengthof() / 2, + loggers::get_instance().log_to_hexa("security_ecc::sign_verify (1): s=", static_cast(p_signature) + p_signature.lengthof() / 2, p_signature.lengthof() / 2); - + // FIXME FSCOM //loggers::get_instance().log("security_ecc::sign_verif: %s", (result == 1) ? "succeed" : "failed"); //return (result == 1) ? 0 : -1; return -1; @@ -984,17 +985,16 @@ int security_ecc::reconstruct_public_keys(const OCTETSTRING &p_cert_to_be_signed if (fsize != p_issuer_public_key_x.lengthof()) { loggers::get_instance().warning("security_ecc::reconstruct_public_keys: key size mismatch"); return -1; + } + if (fsize != p_cert_to_be_signed.lengthof()) { + loggers::get_instance().warning("security_ecc::reconstruct_public_keys: input hash size mismatch"); + return -1; } bn_print("security_ecc::reconstruct_public_keys: order=", ::EC_GROUP_get0_order(_ec_group)); bn_print("security_ecc::reconstruct_public_keys: order=", ::EC_GROUP_get0_cofactor(_ec_group)); BIGNUM* H = ::BN_new(); - OCTETSTRING input = p_cert_to_be_signed + ((_pub_key_compressed_mode == ecc_compressed_mode::compressed_y_0) ? int2oct(2, 1) : int2oct(3, 1)) + _pub_key_compressed; - sha256 sha; - OCTETSTRING hash_input; - sha.generate(input, hash_input); - loggers::get_instance().log_msg("security_ecc::reconstruct_public_keys: hash_input=", hash_input); - ::BN_bin2bn(static_cast(hash_input), fsize, H); + ::BN_bin2bn(static_cast(p_cert_to_be_signed), fsize, H); //bn_print("security_ecc::reconstruct_public_keys: H(1)=", H); ::BN_rshift1(H, H); // h: leftmost floor(log_2 n) bits of p_cert_to_be_signed //bn_print("security_ecc::reconstruct_public_keys: H(2)=", H); diff --git a/etc/AtsSecurity/AtsSecurity.cfg b/etc/AtsSecurity/AtsSecurity.cfg index 494d7b1..4f2c6fa 100644 --- a/etc/AtsSecurity/AtsSecurity.cfg +++ b/etc/AtsSecurity/AtsSecurity.cfg @@ -152,7 +152,7 @@ system.camUtPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_po # --------------------- IMPILICT CERT --------------------- # Check that IUT supports usage of implicit certificate for signing message -ItsSecurity_TestCases.TC_SEC_ITSS_RCV_IMPLICIT_CERT_01_BV +ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BV # Check that IUT accepts a valid secured CAM message signed with implicit certificate #ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BV -- GitLab From 35a1b4bb91f544318bcf8cda61bf6950f020e7b1 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 4 May 2023 08:50:24 +0200 Subject: [PATCH 072/178] Support of implicit certificates step3: Receiving message signed by implicit certificate --- ccsrc/Externals/LibItsSecurity_externals.cc | 32 +++++++++++++++++ .../Security/security_services_its.cc | 7 ++-- .../profiles/CERT_TS_F3_AT_IMP.xml | 35 +++++++++++++++++++ etc/AtsSecurity/AtsSecurity.cfg | 7 ++-- 4 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 data/certificates/profiles/CERT_TS_F3_AT_IMP.xml diff --git a/ccsrc/Externals/LibItsSecurity_externals.cc b/ccsrc/Externals/LibItsSecurity_externals.cc index 921f65a..e714750 100644 --- a/ccsrc/Externals/LibItsSecurity_externals.cc +++ b/ccsrc/Externals/LibItsSecurity_externals.cc @@ -2062,6 +2062,38 @@ namespace LibItsSecurity__Functions { return TRUE; } + BOOLEAN fx__reconstructPublicKeyBrainpoolP256r1( + const OCTETSTRING &p__cert__to__be__signed, + const OCTETSTRING &p__issuer, + const OCTETSTRING &p__reconstruct__public__key__compressed, + const INTEGER &p__compressedMode, + OCTETSTRING &p__public__key__x, + OCTETSTRING &p__public__key__y, + OCTETSTRING &p__public__key__compressed, + INTEGER &p__public__key__compressed_mode + ) { + loggers::get_instance().log_msg(">>> fx_reconstructPublicKeyBrainpoolP256r1: p__cert__to__be__signed: ", p__cert__to__be__signed); + loggers::get_instance().log_msg(">>> fx_reconstructPublicKeyBrainpoolP256r1: p__issuer: ", p__issuer); + loggers::get_instance().log_msg(">>> fx_reconstructPublicKeyBrainpoolP256r1: p__reconstruct__public__key__compressed: ", p__reconstruct__public__key__compressed); + loggers::get_instance().log_msg(">>> fx_reconstructPublicKeyBrainpoolP256r1: p__compressedMode: ", p__compressedMode); + + CHARSTRING certificate_id; + if (security_services_its::get_instance().read_certificate_from_digest(p__issuer, certificate_id) == -1) { + return FALSE; + } + OCTETSTRING public_key_x, public_key_y; + if (security_services_its::get_instance().read_public_keys(certificate_id, public_key_x, public_key_y) == -1) { + return FALSE; + } + // Create reconstruction key + security_ecc ecc(ec_elliptic_curves::brainpool_p_256_r1, p__reconstruct__public__key__compressed, (p__compressedMode == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); + if (ecc.reconstruct_public_keys(p__cert__to__be__signed, public_key_x, public_key_y, p__public__key__x, p__public__key__y, p__public__key__compressed, p__public__key__compressed_mode) == -1) { + return FALSE; + } + + return TRUE; + } + // group geospacial /* * \brief Check that given polygon doesn't have neither self-intersections nor holes. diff --git a/ccsrc/Protocols/Security/security_services_its.cc b/ccsrc/Protocols/Security/security_services_its.cc index c0308bd..a622f54 100644 --- a/ccsrc/Protocols/Security/security_services_its.cc +++ b/ccsrc/Protocols/Security/security_services_its.cc @@ -179,9 +179,9 @@ int security_services_its::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2 unsigned long long gt = ((INTEGER &)(*v.get_opt_value())).get_long_long_val(); // Get current time timestamp unsigned long long us = base_time::get_instance().get_its_current_time_us(); // in microsecond - loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: generation time check %ld / %ld, delta = %f", gt, us, - abs((double)gt - (double)us)); - if (abs((double)gt - (double)us) >= 5000000.0) { // TODO Use a params for generation_time_epsilon, 5s differences + loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: generation time check %ld / %ld, delta = %f, comp = %x", gt, us, + abs((double)gt - (double)us), (abs((double)gt - (double)us) >= 60000000.0)); + if (abs((double)gt - (double)us) >= 30000000.0) { // TODO Use a params for generation_time_epsilon, 30s differences loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: Invalid generation time, discard it"); if (p_verify) { return -1; @@ -532,6 +532,7 @@ int security_services_its::sign_payload(const OCTETSTRING &p_unsecured_gn_payloa if (it != p_params.cend()) { force_certificate = true; } + loggers::get_instance().log("security_services_its::sign_payload: force_certificate='%d", force_certificate); if (p_params[params_its::its_aid].compare("37") == 0) { // Only used by AtsRSUSimulator to add location header // Mandatory for DENM payload OPTIONAL location(Ieee1609Dot2BaseTypes::ThreeDLocation(_latitude, _longitude, _elevation)); diff --git a/data/certificates/profiles/CERT_TS_F3_AT_IMP.xml b/data/certificates/profiles/CERT_TS_F3_AT_IMP.xml new file mode 100644 index 0000000..037d019 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_F3_AT_IMP.xml @@ -0,0 +1,35 @@ + + 3 + + + + + + + + + + + + > + + + + + + + + + 01 FF FC + 01 FF FF FF + + + + + + + + + + + diff --git a/etc/AtsSecurity/AtsSecurity.cfg b/etc/AtsSecurity/AtsSecurity.cfg index 4f2c6fa..5a0a765 100644 --- a/etc/AtsSecurity/AtsSecurity.cfg +++ b/etc/AtsSecurity/AtsSecurity.cfg @@ -152,10 +152,13 @@ system.camUtPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_po # --------------------- IMPILICT CERT --------------------- # Check that IUT supports usage of implicit certificate for signing message +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BV + +# Check that IUT accepts a valid secured CAM message signed with a known implicit certificate ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BV -# Check that IUT accepts a valid secured CAM message signed with implicit certificate -#ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BV +# Check that IUT accepts a valid secured CAM message signed with an unknown implicit certificate +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_02_BV # Check that IUT discards a valid secured CAM message signed with implicit certificate containing signature #ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BO -- GitLab From 11d7abeff4a4e5850b5b308c18d320ea5ffa1d7a Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 4 May 2023 15:52:42 +0200 Subject: [PATCH 073/178] Support of implicit certificates step3: Receiving message signed by implicit certificate --- .../GeoNetworking/decoding_context.cc | 2 -- .../GeoNetworking/encoding_context.cc | 2 -- .../Security/security_services_its.cc | 4 +-- .../profiles/CERT_TS_F_AT_IMP.xml | 36 +++++++++++++++++++ etc/AtsSecurity/AtsSecurity.cfg | 11 +++--- ttcn/AtsSecurity | 2 +- 6 files changed, 43 insertions(+), 14 deletions(-) create mode 100644 data/certificates/profiles/CERT_TS_F_AT_IMP.xml diff --git a/ccsrc/Protocols/GeoNetworking/decoding_context.cc b/ccsrc/Protocols/GeoNetworking/decoding_context.cc index 5752698..12cf7c7 100644 --- a/ccsrc/Protocols/GeoNetworking/decoding_context.cc +++ b/ccsrc/Protocols/GeoNetworking/decoding_context.cc @@ -1,5 +1,3 @@ -#pragma once - #include "decoding_context.hh" void decoding_context::reset() { diff --git a/ccsrc/Protocols/GeoNetworking/encoding_context.cc b/ccsrc/Protocols/GeoNetworking/encoding_context.cc index 6a9edd3..6745ad2 100644 --- a/ccsrc/Protocols/GeoNetworking/encoding_context.cc +++ b/ccsrc/Protocols/GeoNetworking/encoding_context.cc @@ -1,5 +1,3 @@ -#pragma once - #include "encoding_context.hh" diff --git a/ccsrc/Protocols/Security/security_services_its.cc b/ccsrc/Protocols/Security/security_services_its.cc index a622f54..5de3428 100644 --- a/ccsrc/Protocols/Security/security_services_its.cc +++ b/ccsrc/Protocols/Security/security_services_its.cc @@ -180,7 +180,7 @@ int security_services_its::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2 // Get current time timestamp unsigned long long us = base_time::get_instance().get_its_current_time_us(); // in microsecond loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: generation time check %ld / %ld, delta = %f, comp = %x", gt, us, - abs((double)gt - (double)us), (abs((double)gt - (double)us) >= 60000000.0)); + abs((double)gt - (double)us), (abs((double)gt - (double)us) >= 30000000.0)); if (abs((double)gt - (double)us) >= 30000000.0) { // TODO Use a params for generation_time_epsilon, 30s differences loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: Invalid generation time, discard it"); if (p_verify) { @@ -1353,7 +1353,7 @@ int security_services_its::verify_sign_ecdsa_sm2p256(const OCTETSTRING &p_hash, int security_services_its::extract_verification_keys(const Ieee1609Dot2::CertificateBase &p_cert, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y, OCTETSTRING &p_public_comp_key, INTEGER &p_public_comp_key_mode, ec_elliptic_curves* p_signing_algorithm) { - loggers::get_instance().log("security_services_its::extract_verification_keys"); + loggers::get_instance().log_msg(">>> security_services_its::extract_verification_keys: ", p_cert); if (p_cert.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_verificationKey)) { // Explicit certificate if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP256)) { diff --git a/data/certificates/profiles/CERT_TS_F_AT_IMP.xml b/data/certificates/profiles/CERT_TS_F_AT_IMP.xml new file mode 100644 index 0000000..f9b4b8c --- /dev/null +++ b/data/certificates/profiles/CERT_TS_F_AT_IMP.xml @@ -0,0 +1,36 @@ + + + 3 + + + + + + + + + + + + > + + + + + + + + + 01 FF FC + 01 FF FF FF + + + + + + + + + + + diff --git a/etc/AtsSecurity/AtsSecurity.cfg b/etc/AtsSecurity/AtsSecurity.cfg index 5a0a765..8879c14 100644 --- a/etc/AtsSecurity/AtsSecurity.cfg +++ b/etc/AtsSecurity/AtsSecurity.cfg @@ -34,9 +34,6 @@ LibItsSecurity_Pixits.PX_IUT_DEFAULT_CERTIFICATE := "CERT_IUT_A_B_AT" #"CERT_IUT # The certficate the TS should use to generate an ITS message LibItsSecurity_Pixits.PX_AT_CERTIFICATE := "CERT_TS_B_AT" # Possible values: CERT_TS_C_AT, CERT_TS_D_AT, or CERT_TS_E_AT -# The certificate identifier the TA shall use in case of secured IUT -#LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_IUT_A_AT" - #LibItsSecurity_Pics.PICS_SEC_SHA256 := false #LibItsSecurity_Pics.PICS_SEC_SHA384 := true @@ -137,7 +134,7 @@ system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=43551050 # 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,its_aid=36)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.43,src_port=4041,dst_port=9091)" -system.utPort.params := "UT_GN/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" # Use with TC_SEC_ITSS_RCV_MSG_ test cases +system.utPort.params := "UT_GN/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" # Use with TC_SEC_ITSS_RCV_MSG_ and TC_SEC_ITSS_RCV_IMPLICIT_CERT_ test cases #system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" #system.utPort.params := "UT_CAM/DEBUG" #system.camUtPort.params := "UT_CAM/DEBUG" @@ -155,13 +152,13 @@ system.camUtPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_po #ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BV # Check that IUT accepts a valid secured CAM message signed with a known implicit certificate -ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BV +#ItsSecurity_TestCases.TC_SEC_ITSS_RCV_IMPLICIT_CERT_01_BV # Check that IUT accepts a valid secured CAM message signed with an unknown implicit certificate -#ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_02_BV +ItsSecurity_TestCases.TC_SEC_ITSS_RCV_IMPLICIT_CERT_02_BV # Check that IUT discards a valid secured CAM message signed with implicit certificate containing signature -#ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BO +#ItsSecurity_TestCases.TC_SEC_ITSS_RCV_IMPLICIT_CERT_01_BO # ------------------------- CAM --------------------------- # Check that IUT sends the secured CAM using SignedData container. diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 45d4ea5..b6a1fb3 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 45d4ea503914c0ab94cc7eb6b2c2d7577828289b +Subproject commit b6a1fb3c0c159623b8dc3f55e231e0a1d3e3e498 -- GitLab From f6e5ffa5a716adb3098530744996d75a5ababd29 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 5 May 2023 14:13:48 +0200 Subject: [PATCH 074/178] Support of implicit certificates step3: Receiving message signed by implicit certificate --- .../Protocols/Security/certificates_loader.cc | 74 ++-------- .../Protocols/Security/certificates_loader.hh | 12 -- .../Security/security_services_its.cc | 134 +++++++++++++++++- .../Security/security_services_its.hh | 19 ++- etc/AtsSecurity/AtsSecurity.cfg | 12 +- ttcn/AtsSecurity | 2 +- 6 files changed, 169 insertions(+), 84 deletions(-) diff --git a/ccsrc/Protocols/Security/certificates_loader.cc b/ccsrc/Protocols/Security/certificates_loader.cc index af60f43..340cec2 100644 --- a/ccsrc/Protocols/Security/certificates_loader.cc +++ b/ccsrc/Protocols/Security/certificates_loader.cc @@ -8,6 +8,8 @@ #include "etsi_ts103097_certificate_codec.hh" #include "etsi_ts103097_tobesigned_certificate_codec.hh" +#include "security_services_its.hh" + #include "sha256.hh" #include "sha384.hh" @@ -197,13 +199,13 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const Ieee1609Dot2BaseTypes::BasePublicEncryptionKey &b = v.publicKey(); if (b.ischosen(Ieee1609Dot2BaseTypes::BasePublicEncryptionKey::ALT_eciesNistP256)) { Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = v.publicKey().eciesNistP256(); - fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, public_enc_comp_key, public_enc_key_x, public_enc_key_y); + security_services_its::fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, public_enc_comp_key, public_enc_key_x, public_enc_key_y); } else if (b.ischosen(Ieee1609Dot2BaseTypes::BasePublicEncryptionKey::ALT_eciesBrainpoolP256r1)) { Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = v.publicKey().eciesBrainpoolP256r1(); - fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, public_enc_comp_key, public_enc_key_x, public_enc_key_y); + security_services_its::fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, public_enc_comp_key, public_enc_key_x, public_enc_key_y); } else if (b.ischosen(Ieee1609Dot2BaseTypes::BasePublicEncryptionKey::ALT_ecencSm2)) { Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = v.publicKey().ecencSm2(); - fill_public_key_vectors(ec_elliptic_curves::sm2_p_256, p, public_enc_comp_key, public_enc_key_x, public_enc_key_y); + security_services_its::fill_public_key_vectors(ec_elliptic_curves::sm2_p_256, p, public_enc_comp_key, public_enc_key_x, public_enc_key_y); } // loggers::get_instance().log_msg("certificates_loader::load_certificate: public_enc_key_x: ", public_enc_key_x); // loggers::get_instance().log_msg("certificates_loader::load_certificate: public_enc_key_y: ", public_enc_key_y); @@ -246,23 +248,23 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP256)) { algorithm = ec_elliptic_curves::nist_p_256; Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaNistP256(); - fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, public_comp_key, public_key_x, public_key_y); + security_services_its::fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, public_comp_key, public_key_x, public_key_y); } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP384)) { algorithm = ec_elliptic_curves::nist_p_384; Ieee1609Dot2BaseTypes::EccP384CurvePoint &p = b.ecdsaNistP384(); - fill_public_key_vectors(ec_elliptic_curves::nist_p_384, p, public_comp_key, public_key_x, public_key_y); + security_services_its::fill_public_key_vectors(ec_elliptic_curves::nist_p_384, p, public_comp_key, public_key_x, public_key_y); } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP256r1)) { algorithm = ec_elliptic_curves::brainpool_p_256_r1; Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaBrainpoolP256r1(); - fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, public_comp_key, public_key_x, public_key_y); + security_services_its::fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, public_comp_key, public_key_x, public_key_y); } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP384r1)) { algorithm = ec_elliptic_curves::brainpool_p_384_r1; Ieee1609Dot2BaseTypes::EccP384CurvePoint &p = b.ecdsaBrainpoolP384r1(); - fill_public_key_vectors(ec_elliptic_curves::brainpool_p_384_r1, p, public_comp_key, public_key_x, public_key_y); + security_services_its::fill_public_key_vectors(ec_elliptic_curves::brainpool_p_384_r1, p, public_comp_key, public_key_x, public_key_y); } else { // ALT_ecsigSm2 algorithm = ec_elliptic_curves::sm2_p_256; Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecsigSm2(); - fill_public_key_vectors(ec_elliptic_curves::sm2_p_256, p, public_comp_key, public_key_x, public_key_y); + security_services_its::fill_public_key_vectors(ec_elliptic_curves::sm2_p_256, p, public_comp_key, public_key_x, public_key_y); } // loggers::get_instance().log("certificates_loader::load_certificate: algorithm: %d", algorithm); // loggers::get_instance().log_msg("certificates_loader::load_certificate: public_key_x: ", public_key_x); @@ -339,11 +341,11 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const OCTETSTRING issuer_sign_key_comp_key; // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP256)) { const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaNistP256(); - fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, issuer_sign_key_comp_key, issuer_sign_key_x, issuer_sign_key_y); + security_services_its::fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, issuer_sign_key_comp_key, issuer_sign_key_x, issuer_sign_key_y); algorithm = ec_elliptic_curves::nist_p_256; } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP256r1)) { const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaBrainpoolP256r1(); - fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, issuer_sign_key_comp_key, issuer_sign_key_x, issuer_sign_key_y); + security_services_its::fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, issuer_sign_key_comp_key, issuer_sign_key_x, issuer_sign_key_y); algorithm = ec_elliptic_curves::brainpool_p_256_r1; } else { loggers::get_instance().warning("certificates_loader::load_certificate: Incosistent certificate issuer: Wrong PublicVerificationKey"); @@ -354,7 +356,7 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const OCTETSTRING rv_key_x; OCTETSTRING rv_key_y; OCTETSTRING rv_comp_key; // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) - fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, rv_comp_key, rv_key_x, rv_key_y); + security_services_its::fill_public_key_vectors(algorithm, p, rv_comp_key, rv_key_x, rv_key_y); // Compute the hash od the toBeSigned OCTETSTRING tbs; etsi_ts103097_tobesigned_certificate_codec codec; @@ -381,7 +383,7 @@ int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const security_ecc r_key(algorithm, rv_key_x, rv_key_y); // Reconstruction key if (r_key.reconstruct_public_keys(hash_tbs, static_cast(issuer_sign_key_x), static_cast(issuer_sign_key_y), public_key_x, public_key_y, public_comp_key, public_comp_key_mode) == -1) { loggers::get_instance().warning("certificates_loader::load_certificate: Failed to encode toBeSigned"); - return -1; + return -1; } loggers::get_instance().log_msg("certificates_loader::load_certificate: public_key_x: ", public_key_x); loggers::get_instance().log_msg("certificates_loader::load_certificate: public_key_y: ", public_key_y); @@ -481,51 +483,3 @@ int certificates_loader::save_certificate(const security_db_record &p_certificat return 0; } // End of method save_certificate -void certificates_loader::fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p_ecc_point, - OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y) { - loggers::get_instance().log_msg(">>> certificates_loader::fill_public_key_vectors: ", p_ecc_point); - - if (p_ecc_point.ischosen(Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__0)) { - p_public_comp_key = int2oct(2, 1) + p_ecc_point.compressed__y__0(); - security_ecc ecc(p_elliptic_curve, p_ecc_point.compressed__y__0(), ecc_compressed_mode::compressed_y_0); - p_public_key_x = ecc.public_key_x(); - p_public_key_y = ecc.public_key_y(); - } else if (p_ecc_point.ischosen(Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__1)) { - p_public_comp_key = int2oct(3, 1) + p_ecc_point.compressed__y__1(); - security_ecc ecc(p_elliptic_curve, p_ecc_point.compressed__y__1(), ecc_compressed_mode::compressed_y_1); - p_public_key_x = ecc.public_key_x(); - p_public_key_y = ecc.public_key_y(); - } else if (p_ecc_point.ischosen(Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_uncompressedP256)) { - p_public_key_x = p_ecc_point.uncompressedP256().x(); - p_public_key_y = p_ecc_point.uncompressedP256().y(); - p_public_comp_key = int2oct(0, 33); - } else { - p_public_key_x = int2oct(0, 32); - p_public_key_y = int2oct(0, 32); - p_public_comp_key = int2oct(0, 33); - } -} -void certificates_loader::fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP384CurvePoint &p_ecc_point, - OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y) { - // loggers::get_instance().log_msg(">>> certificates_loader::fill_public_key_vectors: ", p_ecc_point); - - if (p_ecc_point.ischosen(Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__0)) { - p_public_comp_key = int2oct(2, 1) + p_ecc_point.compressed__y__0(); - security_ecc ecc(p_elliptic_curve, p_ecc_point.compressed__y__0(), ecc_compressed_mode::compressed_y_0); - p_public_key_x = ecc.public_key_x(); - p_public_key_y = ecc.public_key_y(); - } else if (p_ecc_point.ischosen(Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__1)) { - p_public_comp_key = int2oct(3, 1) + p_ecc_point.compressed__y__1(); - security_ecc ecc(p_elliptic_curve, p_ecc_point.compressed__y__1(), ecc_compressed_mode::compressed_y_1); - p_public_key_x = ecc.public_key_x(); - p_public_key_y = ecc.public_key_y(); - } else if (p_ecc_point.ischosen(Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_uncompressedP384)) { - p_public_key_x = p_ecc_point.uncompressedP384().x(); - p_public_key_y = p_ecc_point.uncompressedP384().y(); - p_public_comp_key = int2oct(0, 49); - } else { - p_public_key_x = int2oct(0, 48); - p_public_key_y = int2oct(0, 48); - p_public_comp_key = int2oct(0, 49); - } -} diff --git a/ccsrc/Protocols/Security/certificates_loader.hh b/ccsrc/Protocols/Security/certificates_loader.hh index eb8f9f4..6879f44 100644 --- a/ccsrc/Protocols/Security/certificates_loader.hh +++ b/ccsrc/Protocols/Security/certificates_loader.hh @@ -111,16 +111,4 @@ public: /*! \publicsection */ std::map& get_hashed_id8s(); private: /*! \privatesection */ - /*! - * \fn int fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p_ecc_point, OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y); - * \brief Initialize public key vectors, based on 256 bits curve - */ - void fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p_ecc_point, - OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y); - /*! - * \fn int fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p_ecc_point, OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y); - * \brief Initialize public key vectors, based on 384 bits curve - */ - void fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP384CurvePoint &p_ecc_point, - OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y); }; // End of class certificates_loader diff --git a/ccsrc/Protocols/Security/security_services_its.cc b/ccsrc/Protocols/Security/security_services_its.cc index 5de3428..a20d20d 100644 --- a/ccsrc/Protocols/Security/security_services_its.cc +++ b/ccsrc/Protocols/Security/security_services_its.cc @@ -8,6 +8,7 @@ using namespace std; // Required for isnan() #include "etsi_ts103097_certificate_codec.hh" #include "etsi_ts103097_data_codec.hh" #include "etsi_ts103097_tobesigned_data_codec.hh" +#include "etsi_ts103097_tobesigned_certificate_codec.hh" #include "security_ecc.hh" #include "sha256.hh" @@ -1484,12 +1485,89 @@ int security_services_its::extract_verification_keys(const Ieee1609Dot2::Certifi return -1; } } else if (p_cert.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_reconstructionValue)) { // Implicit certificate - // FIXME FSCOM + // Sanity checks + if (p_cert.signature__().ispresent()) { + loggers::get_instance().error("security_services_its::extract_verification_keys: Inconsistent implicit certificate, discard message"); + return -1; + } // Rebuild signing keys - loggers::get_instance().error("security_services_its::extract_verification_keys: Implicit certificate not supported yet"); + // 1. Load certificate issuer + std::string certificate_issuer_id; + if (_security_db.get()->get_certificate_id(p_cert.issuer().sha256AndDigest(), certificate_issuer_id) == -1) { + // Request for the issuer and discard this message + _unknown_certificate = OCTETSTRING(3, static_cast(p_cert.issuer().sha256AndDigest()) + p_cert.issuer().sha256AndDigest().lengthof() - 3); + loggers::get_instance().error("security_services_its::extract_verification_keys: Implicit certificate issuer is unknown"); + return -1; + } + Ieee1609Dot2::CertificateBase certificate_issuer; + if (_security_db.get()->get_certificate(certificate_issuer_id, certificate_issuer) == -1) { + // Request for the issuer and discard this message + _unknown_certificate = OCTETSTRING(3, static_cast(p_cert.issuer().sha256AndDigest()) + p_cert.issuer().sha256AndDigest().lengthof() - 3); + loggers::get_instance().warning("security_services_its::extract_verification_keys: Cannot load implicit certificate issuer"); + return -1; + } + // 2. The signing algorithm is provided by the issuer certificate + if (!certificate_issuer.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_verificationKey)) { + loggers::get_instance().warning("security_services_its::extract_verification_keys: Inconsistent certificate issuer: Wrong VerificationKeyIndicator, discard message"); + return -1; + } + loggers::get_instance().log_msg("security_services_its::extract_verification_keys: Implicit certificate issuer: ", certificate_issuer); + // 3. Retrieve the issuer signing key + const Ieee1609Dot2BaseTypes::PublicVerificationKey &b = certificate_issuer.toBeSigned().verifyKeyIndicator().verificationKey(); + OCTETSTRING issuer_sign_key_x; + OCTETSTRING issuer_sign_key_y; + OCTETSTRING issuer_sign_key_comp_key; // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) + if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP256)) { + const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaNistP256(); + security_services_its::fill_public_key_vectors(ec_elliptic_curves::nist_p_256, p, issuer_sign_key_comp_key, issuer_sign_key_x, issuer_sign_key_y); + *p_signing_algorithm = ec_elliptic_curves::nist_p_256; + } else if (b.ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaBrainpoolP256r1)) { + const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = b.ecdsaBrainpoolP256r1(); + security_services_its::fill_public_key_vectors(ec_elliptic_curves::brainpool_p_256_r1, p, issuer_sign_key_comp_key, issuer_sign_key_x, issuer_sign_key_y); + *p_signing_algorithm = ec_elliptic_curves::brainpool_p_256_r1; + } else { + loggers::get_instance().warning("security_services_its::extract_verification_keys: Incosistent certificate issuer: Wrong PublicVerificationKey, discard message"); + return -1; + } + // 4. Retrieve the reconstruction key key + const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p = p_cert.toBeSigned().verifyKeyIndicator().reconstructionValue(); + OCTETSTRING rv_key_x; + OCTETSTRING rv_key_y; + OCTETSTRING rv_comp_key; // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03) + security_services_its::fill_public_key_vectors(*p_signing_algorithm, p, rv_comp_key, rv_key_x, rv_key_y); + // Compute the hash of the toBeSigned + OCTETSTRING tbs; + etsi_ts103097_tobesigned_certificate_codec codec; + codec.encode(p_cert.toBeSigned(), tbs); + if (!tbs.is_bound()) { + loggers::get_instance().warning("security_services_its::extract_verification_keys: Failed to encode toBeSigned, discard message"); + return -1; + } + loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Implicit encoded toBeSigned: ", tbs); + OCTETSTRING hash_tbs; + sha256 sha; + sha.generate(tbs, hash_tbs); + loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Implicit hash(toBeSignedCertificate): ", hash_tbs); + OCTETSTRING hash_sha_256; + _security_db.get()->get_hash_sha_256(certificate_issuer_id, hash_sha_256); + loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: Implicit issuer hash: ", hash_sha_256); + OCTETSTRING input = hash_tbs + hash_sha_256; + loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: input: ", input); + sha.generate(input, hash_tbs); + loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: joint hash: ", hash_tbs); + // Reconstruction of the public key. + security_ecc r_key(*p_signing_algorithm, rv_key_x, rv_key_y); // Reconstruction key + if (r_key.reconstruct_public_keys(hash_tbs, static_cast(issuer_sign_key_x), static_cast(issuer_sign_key_y), p_public_key_x, p_public_key_y, p_public_comp_key, p_public_comp_key_mode) == -1) { + loggers::get_instance().warning("security_services_its::extract_verification_keys: Failed to encode toBeSigned, discard message"); + return -1; + } + loggers::get_instance().log("security_services_its::extract_verification_keys: *p_signing_algorithm: '%d'", *p_signing_algorithm); + loggers::get_instance().log_msg("security_services_its::extract_verification_keys: public_key_x: ", p_public_key_x); + loggers::get_instance().log_msg("security_services_its::extract_verification_keys: public_key_y: ", p_public_key_y); + loggers::get_instance().log_msg("security_services_its::extract_verification_keys: public_comp_key: ", p_public_comp_key); + loggers::get_instance().log_msg("security_services_its::extract_verification_keys: public_comp_key_mode: ", p_public_comp_key_mode); } else { loggers::get_instance().error("security_services_its::extract_verification_keys: Unsupported variant"); - } return 0; } @@ -1717,3 +1795,53 @@ int security_services_its::read_public_keys(const CHARSTRING &p_certificate_id, int security_services_its::read_private_enc_key(const CHARSTRING &p_certificate_id, OCTETSTRING &p_private_enc_key) const { return _security_db.get()->get_private_enc_key(std::string(static_cast(p_certificate_id)), p_private_enc_key); } + +void security_services_its::fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p_ecc_point, + OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y) { + loggers::get_instance().log_msg(">>> security_services_its::fill_public_key_vectors: ", p_ecc_point); + + if (p_ecc_point.ischosen(Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__0)) { + p_public_comp_key = int2oct(2, 1) + p_ecc_point.compressed__y__0(); + security_ecc ecc(p_elliptic_curve, p_ecc_point.compressed__y__0(), ecc_compressed_mode::compressed_y_0); + p_public_key_x = ecc.public_key_x(); + p_public_key_y = ecc.public_key_y(); + } else if (p_ecc_point.ischosen(Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_compressed__y__1)) { + p_public_comp_key = int2oct(3, 1) + p_ecc_point.compressed__y__1(); + security_ecc ecc(p_elliptic_curve, p_ecc_point.compressed__y__1(), ecc_compressed_mode::compressed_y_1); + p_public_key_x = ecc.public_key_x(); + p_public_key_y = ecc.public_key_y(); + } else if (p_ecc_point.ischosen(Ieee1609Dot2BaseTypes::EccP256CurvePoint::ALT_uncompressedP256)) { + p_public_key_x = p_ecc_point.uncompressedP256().x(); + p_public_key_y = p_ecc_point.uncompressedP256().y(); + p_public_comp_key = int2oct(0, 33); + } else { + p_public_key_x = int2oct(0, 32); + p_public_key_y = int2oct(0, 32); + p_public_comp_key = int2oct(0, 33); + } +} + +void security_services_its::fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP384CurvePoint &p_ecc_point, + OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y) { + // loggers::get_instance().log_msg(">>> security_services_its::fill_public_key_vectors: ", p_ecc_point); + + if (p_ecc_point.ischosen(Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__0)) { + p_public_comp_key = int2oct(2, 1) + p_ecc_point.compressed__y__0(); + security_ecc ecc(p_elliptic_curve, p_ecc_point.compressed__y__0(), ecc_compressed_mode::compressed_y_0); + p_public_key_x = ecc.public_key_x(); + p_public_key_y = ecc.public_key_y(); + } else if (p_ecc_point.ischosen(Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_compressed__y__1)) { + p_public_comp_key = int2oct(3, 1) + p_ecc_point.compressed__y__1(); + security_ecc ecc(p_elliptic_curve, p_ecc_point.compressed__y__1(), ecc_compressed_mode::compressed_y_1); + p_public_key_x = ecc.public_key_x(); + p_public_key_y = ecc.public_key_y(); + } else if (p_ecc_point.ischosen(Ieee1609Dot2BaseTypes::EccP384CurvePoint::ALT_uncompressedP384)) { + p_public_key_x = p_ecc_point.uncompressedP384().x(); + p_public_key_y = p_ecc_point.uncompressedP384().y(); + p_public_comp_key = int2oct(0, 49); + } else { + p_public_key_x = int2oct(0, 48); + p_public_key_y = int2oct(0, 48); + p_public_comp_key = int2oct(0, 49); + } +} diff --git a/ccsrc/Protocols/Security/security_services_its.hh b/ccsrc/Protocols/Security/security_services_its.hh index 52b806d..34d6a09 100644 --- a/ccsrc/Protocols/Security/security_services_its.hh +++ b/ccsrc/Protocols/Security/security_services_its.hh @@ -14,8 +14,10 @@ class OCTETSTRING; //! TITAN forward declaration class CHARSTRING; //! TITAN forward declaration namespace Ieee1609Dot2BaseTypes { - class HashAlgorithm; //! TITAN forward declaration - class Signature; //! TITAN forward declaration + class EccP256CurvePoint; //! TITAN forward declaration + class EccP384CurvePoint; //! TITAN forward declaration + class HashAlgorithm; //! TITAN forward declaration + class Signature; //! TITAN forward declaration } // namespace Ieee1609Dot2BaseTypes namespace Ieee1609Dot2 { @@ -157,6 +159,19 @@ public: /*! \publicsection */ const int get_protocol_version() const { return ProtocolVersion; }; + /*! + * \fn int fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p_ecc_point, OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y); + * \brief Initialize public key vectors, based on 256 bits curve + */ + static void fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p_ecc_point, + OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y); + /*! + * \fn int fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p_ecc_point, OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y); + * \brief Initialize public key vectors, based on 384 bits curve + */ + static void fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP384CurvePoint &p_ecc_point, + OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y); + private: /*! * \fn int process_ieee_1609_dot2_content(const Ieee1609Dot2::Ieee1609Dot2Content& p_ieee_1609_dot2_content, const bool p_verify, OCTETSTRING& diff --git a/etc/AtsSecurity/AtsSecurity.cfg b/etc/AtsSecurity/AtsSecurity.cfg index 8879c14..62e3192 100644 --- a/etc/AtsSecurity/AtsSecurity.cfg +++ b/etc/AtsSecurity/AtsSecurity.cfg @@ -43,10 +43,10 @@ LibItsSecurity_Pixits.PX_AT_CERTIFICATE := "CERT_TS_B_AT" # Possible values: CER # you want to log into the file or display on console (standard error). LogFile := "../logs/AtsSecurity/%e.%h-%r.%s" -FileMask := LOG_ALL | USER | DEBUG | MATCHING -ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING -#FileMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | TIMEROP -#ConsoleMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | TIMEROP +#FileMask := LOG_ALL | USER | DEBUG | MATCHING +#ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +FileMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | TIMEROP +ConsoleMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | TIMEROP LogSourceInfo := Stack LogEntityName:= Yes LogEventTypes:= Yes @@ -149,13 +149,13 @@ system.camUtPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_po # --------------------- IMPILICT CERT --------------------- # Check that IUT supports usage of implicit certificate for signing message -#ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BV +ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BV # Check that IUT accepts a valid secured CAM message signed with a known implicit certificate #ItsSecurity_TestCases.TC_SEC_ITSS_RCV_IMPLICIT_CERT_01_BV # Check that IUT accepts a valid secured CAM message signed with an unknown implicit certificate -ItsSecurity_TestCases.TC_SEC_ITSS_RCV_IMPLICIT_CERT_02_BV +#ItsSecurity_TestCases.TC_SEC_ITSS_RCV_IMPLICIT_CERT_02_BV # Check that IUT discards a valid secured CAM message signed with implicit certificate containing signature #ItsSecurity_TestCases.TC_SEC_ITSS_RCV_IMPLICIT_CERT_01_BO diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index b6a1fb3..4a00a06 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit b6a1fb3c0c159623b8dc3f55e231e0a1d3e3e498 +Subproject commit 4a00a0663f5a5dea10c8761f241e833132be743c -- GitLab From 90d14af579ec80255b765ae4daada56b6b8029f1 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 11 May 2023 13:48:09 +0200 Subject: [PATCH 075/178] Validate execution of the first AtsMBR test case --- data/certificates/Makefile | 8 ++++++-- etc/AtsMBR/AtsMBR.cfg | 2 +- titan-test-system-framework | 2 +- ttcn/AtsSecurity | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/data/certificates/Makefile b/data/certificates/Makefile index 1983449..74d1aa3 100644 --- a/data/certificates/Makefile +++ b/data/certificates/Makefile @@ -58,11 +58,15 @@ certs_iut_at_imp = $(filter $(outdir)/CERT_IUT_%_AT_IMP.oer, $(certificates_oer) vkeys_iut_at_imp = $(patsubst %.oer, %.vkey, $(certs_iut_at_imp)) ekeys_iut_at_imp = $(patsubst %.oer, %.ekey, $(certs_iut_at_imp)) +certs_iut_ma = $(filter $(outdir)/CERT_IUT_%_MA.oer, $(certificates_oer)) +vkeys_iut_ma = $(patsubst %.oer, %.vkey, $(certs_iut_ma)) +ekeys_iut_ma = $(patsubst %.oer, %.ekey, $(certs_iut_ma)) + certs_iut := $(filter $(outdir)/CERT_IUT_%_RCA.oer, $(certificates_oer)) certs_iut += $(filter $(outdir)/CERT_IUT_%_AA.oer, $(certificates_oer)) -certs_iut += $(certs_iut_at) $(certs_iut_at_imp) +certs_iut += $(certs_iut_at) $(certs_iut_at_imp) $(certs_iut_ma) -iut_files = $(patsubst $(outdir)/%, $(iutdir)/%, $(certs_iut) $(vkeys_iut_at) $(ekeys_iut_at) $(vkeys_iut_at_imp) $(ekeys_iut_at_imp)) +iut_files = $(patsubst $(outdir)/%, $(iutdir)/%, $(certs_iut) $(vkeys_iut_at) $(ekeys_iut_at) $(vkeys_iut_ma) $(ekeys_iut_ma) $(vkeys_iut_at_imp) $(ekeys_iut_at_imp)) install: $(iutdir) $(iut_files) $(iutdir)/index.lst diff --git a/etc/AtsMBR/AtsMBR.cfg b/etc/AtsMBR/AtsMBR.cfg index f3d76c3..5b9d991 100644 --- a/etc/AtsMBR/AtsMBR.cfg +++ b/etc/AtsMBR/AtsMBR.cfg @@ -36,7 +36,7 @@ LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" #LibItsSecurity_Pics.PICS_SEC_SHA256 := false #LibItsSecurity_Pics.PICS_SEC_SHA384 := true -LibItsMbr_Pics.PICS_IUT_MA_CERTIFICATE_ID := "CERT_TS_A_AA" +LibItsMbr_Pics.PICS_IUT_MA_CERTIFICATE_ID := "CERT_IUT_A_MA" [LOGGING] # In this section you can specify the name of the log file and the classes of events diff --git a/titan-test-system-framework b/titan-test-system-framework index a0803fb..163d1cf 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit a0803fb1089eb6b1add7c00c57f4f1e77eb5cfca +Subproject commit 163d1cfca22b18ceb1d7e24380f46f7fbaa53a97 diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 4a00a06..2666a89 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 4a00a0663f5a5dea10c8761f241e833132be743c +Subproject commit 2666a89c1687ee67c8f4e21ee95daeedb112d001 -- GitLab From b79ed7e91e8760118c6ecd1747b81c8202785094 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Mon, 15 May 2023 14:56:55 +0200 Subject: [PATCH 076/178] Validate execution of the second AtsMBR test case --- .../Protocols/Security/certificates_loader.cc | 25 +++++--- .../Protocols/Security/certificates_loader.hh | 32 +++++----- ccsrc/Protocols/Security/security_cache.cc | 42 ++++++-------- ccsrc/Protocols/Security/security_cache.hh | 1 - ccsrc/Protocols/Security/security_db.cc | 2 +- .../Security/security_services_its.cc | 58 ++++++++++++------- .../Security/security_services_its.hh | 2 + etc/AtsMBR/AtsMBR.cfg | 12 +++- titan-test-system-framework | 2 +- ttcn/AtsMBR | 2 +- 10 files changed, 105 insertions(+), 73 deletions(-) diff --git a/ccsrc/Protocols/Security/certificates_loader.cc b/ccsrc/Protocols/Security/certificates_loader.cc index 340cec2..2c261c5 100644 --- a/ccsrc/Protocols/Security/certificates_loader.cc +++ b/ccsrc/Protocols/Security/certificates_loader.cc @@ -41,7 +41,7 @@ certificates_loader *certificates_loader::instance = nullptr; certificates_loader::certificates_loader() : _certificateExt{".oer"}, _privateKeyExt{".vkey"}, _privateEncKeyExt{".ekey"}, - _full_path(), _is_cache_initialized{false}, _directory_filter{".svn", "._.DS_Store", ".DS_Store"}, _hashed_id8s() { + _full_path(), _is_cache_initialized{false}, _directory_filter{".svn", "._.DS_Store", ".DS_Store"}, _hashed_id8s(), _certificates_idx() { // loggers::get_instance().log(">>> certificates_loader::certificates_loader"); } // End of ctor @@ -76,7 +76,7 @@ int certificates_loader::build_path(const std::string &p_root_directory) { return 0; } // End of method build_path -int certificates_loader::build_certificates_index(std::map &p_certificates_idx) { +int certificates_loader::build_certificates_index() { // FIXME FSCOM Merge build_path and build_certificates_index methods in one loggers::get_instance().log(">>> certificates_loader::build_certificates_index"); // Sanity check @@ -101,12 +101,16 @@ int certificates_loader::build_certificates_index(std::map::iterator, bool> result = p_certificates_idx.insert(std::pair(certificate, h)); - if (result.second == false) { - loggers::get_instance().warning("certificates_loader::build_certificates_index: Failed to insert new record '%s'", certificate.c_str()); + std::pair::iterator, bool> r1 = _hashed_id8s.insert(std::pair(h, certificate)); + if (r1.second == false) { + loggers::get_instance().warning("certificates_loader::build_certificates_index (1): Failed to insert new record '%s'", certificate.c_str()); + continue; + } + std::pair::iterator, bool> r2 = _certificates_idx.insert(std::pair(certificate, h)); + if (r2.second == false) { + loggers::get_instance().warning("certificates_loader::build_certificates_index (2): Failed to insert new record '%s'", certificate.c_str()); continue; } - _hashed_id8s.insert(std::pair(h, certificate)); } // End of 'while' statement is.close(); @@ -119,8 +123,12 @@ std::map& certificates_load return _hashed_id8s; } +std::map& certificates_loader::get_certificates() { + return _certificates_idx; +} + int certificates_loader::load_certificate(const OCTETSTRING& p_hashed_id8, const std::string p_certificate_name, std::map> & p_certificates) { - loggers::get_instance().log_msg(">>> certificates_loader::load_certificate", p_hashed_id8); + loggers::get_instance().log_msg(">>> certificates_loader::load_certificate: ", p_hashed_id8); loggers::get_instance().log(">>> certificates_loader::load_certificate: '%s'", p_certificate_name.c_str()); std::experimental::filesystem::path p = _full_path.string() + "/" + p_certificate_name + _certificateExt; @@ -480,6 +488,9 @@ int certificates_loader::save_certificate(const security_db_record &p_certificat std::experimental::filesystem::perms::group_all | std::experimental::filesystem::perms::others_all); } + _hashed_id8s.insert(std::pair(p_certificate.hashed_id(), p_certificate.certificate_id())); + _certificates_idx.insert(std::pair(p_certificate.certificate_id(), p_certificate.hashed_id())); + return 0; } // End of method save_certificate diff --git a/ccsrc/Protocols/Security/certificates_loader.hh b/ccsrc/Protocols/Security/certificates_loader.hh index 6879f44..35b2603 100644 --- a/ccsrc/Protocols/Security/certificates_loader.hh +++ b/ccsrc/Protocols/Security/certificates_loader.hh @@ -37,15 +37,16 @@ struct security_cache_comp { * \remark Singleton pattern */ class certificates_loader { - std::string _certificateExt; //! COER encoding certificate extension. Default: .oer - std::string _privateKeyExt; //! Private signing key extension. Default: .vkey - std::string _privateEncKeyExt; //! Private cyphering key extension. Default: .ekey - std::experimental::filesystem::path _full_path; //! The full folder path to load certificates - bool _is_cache_initialized; //! Set to true when certificates are successfully loaded from file system - std::set _directory_filter; //! Directory filter (for local development purposes only) - static certificates_loader * instance; //! Unique static object reference of this class + std::string _certificateExt; //! COER encoding certificate extension. Default: .oer + std::string _privateKeyExt; //! Private signing key extension. Default: .vkey + std::string _privateEncKeyExt; //! Private cyphering key extension. Default: .ekey + std::experimental::filesystem::path _full_path; //! The full folder path to load certificates + bool _is_cache_initialized; //! Set to true when certificates are successfully loaded from file system + std::set _directory_filter; //! Directory filter (for local development purposes only) + static certificates_loader * instance; //! Unique static object reference of this class std::map _hashed_id8s; - //! List of the certificates indexed by the HashedId8 + //! List of the certificates indexed by the HashedId8 + std::map _certificates_idx; //! List of the certificates indexed by the certificate identifier /*! * \brief Default private ctor @@ -56,6 +57,7 @@ class certificates_loader { */ ~certificates_loader() { _hashed_id8s.clear(); + _certificates_idx.clear(); if (instance != NULL) { delete instance; instance = NULL; @@ -80,13 +82,11 @@ public: /*! \publicsection */ */ int build_path(const std::string &p_root_directory); /*! - * \fn int build_certificates_index(std::map &p_certificates_idx); + * \fn int build_certificates_index(); * \brief Store in memory the index of the certitifcates as a tuple {HashedId8, Certificate Name} - * \param[in] p_certificates_idx Memory stored index, key is the certificate name - * \param[in] p_hashed_id8s Memory stored index, key is the HashedId8 * \return 0 on success, -1 otherwise */ - int build_certificates_index(std::map &p_certificates_idx); + int build_certificates_index(); /*! * \fn int load_certificate(const OCTETSTRING& p_hashed_id8, const std::string p_certificate_name, std::map> & p_certificates); * \brief Store in memory the specified certificate @@ -105,10 +105,16 @@ public: /*! \publicsection */ int save_certificate(const security_db_record &p_certificate); /*! * \fn std::map& get_hashed_id8s() const; - * \brief Retrive the index of certificates name by whole hash certificate value + * \brief Retrieve the index of certificates name by HashedId8 value * \return The reference to the index */ std::map& get_hashed_id8s(); + /*! + * \fn std::map& get_certificate() const; + * \brief Retrieve the index of HashedId8 value by certificates name + * \return The HashedId8 of the certificate + */ + std::map& get_certificates(); private: /*! \privatesection */ }; // End of class certificates_loader diff --git a/ccsrc/Protocols/Security/security_cache.cc b/ccsrc/Protocols/Security/security_cache.cc index 28ea966..18fcf16 100644 --- a/ccsrc/Protocols/Security/security_cache.cc +++ b/ccsrc/Protocols/Security/security_cache.cc @@ -23,7 +23,7 @@ using namespace std; // Required for isnan() #include "loggers.hh" -security_cache::security_cache() : _certificates_idx(), _certificates() { loggers::get_instance().log(">>> security_cache::security_cache"); } // End of ctor +security_cache::security_cache() : _certificates() { loggers::get_instance().log(">>> security_cache::security_cache"); } // End of ctor security_cache::~security_cache() { loggers::get_instance().log(">>> security_cache::~security_cache"); @@ -33,7 +33,6 @@ security_cache::~security_cache() { int security_cache::clear() { loggers::get_instance().log(">>> security_cache::clear"); _certificates.clear(); // Smart pointers will do the job - _certificates_idx.clear(); return 0; } // End of clear method @@ -42,8 +41,9 @@ int security_cache::load_certificate(const std::string &p_certificate_id, const loggers::get_instance().log(">>> security_cache::load_certificate: '%s'", p_certificate_id.c_str()); // Sanity check - std::map::const_iterator s = _certificates_idx.find(p_certificate_id); - if (s == _certificates_idx.cend()) { + std::map& certificates = certificates_loader::get_instance().get_certificates(); + std::map::const_iterator s = certificates.find(p_certificate_id); + if (s == certificates.cend()) { loggers::get_instance().warning("security_cache::load_certificate: record not found"); return -1; } @@ -55,8 +55,7 @@ int security_cache::load_certificate(const std::string &p_certificate_id, const return -1; } else { *p_record = _certificates[p_certificate_id].get(); - - return 0; + return 0; } } @@ -183,8 +182,9 @@ int security_cache::get_issuer(const std::string &p_certificate_id, OCTETSTRING int security_cache::get_hashed_id(const std::string &p_certificate_id, OCTETSTRING &p_hashed_id) const { loggers::get_instance().log(">>> security_cache::get_hashed_id: '%s'", p_certificate_id.c_str()); - std::map::const_iterator it = _certificates_idx.find(p_certificate_id); - if (it == _certificates_idx.cend()) { + std::map& certificates = certificates_loader::get_instance().get_certificates(); + std::map::const_iterator it = certificates.find(p_certificate_id); + if (it == certificates.cend()) { loggers::get_instance().warning("security_cache::get_hashed_id: record not found"); p_hashed_id = OCTETSTRING(0, nullptr); return -1; @@ -382,31 +382,17 @@ int security_cache::store_certificate(const ec_elliptic_curves p_signing_algorit public_enc_comp_key // Public encryption compressed key, 33 or 49 bytes ); if (p == nullptr) { + loggers::get_instance().error("security_cache::store_certificate: Failed to allocate memory"); return -1; } + certificates_loader::get_instance().save_certificate(*p); + std::map>::const_iterator i = _certificates.find(key); if (i != _certificates.cend()) { _certificates.erase(i); } - _certificates.insert(std::pair>(key, std::unique_ptr(p))); - std::map& hashed_id8s = certificates_loader::get_instance().get_hashed_id8s(); - std::map::const_iterator h = hashed_id8s.find(hashed_id8); - if (h != hashed_id8s.cend()) { - loggers::get_instance().log_msg("security_cache::store_certificate: Replace entry in hashed_id8s: ", h->first); - hashed_id8s.erase(h); - } - std::map::const_iterator k = _certificates_idx.find(h->second); - if (k != _certificates_idx.cend()) { - loggers::get_instance().log("security_cache::store_certificate: Replace entry in _certificates_idx: %s", k->first.c_str()); - _certificates_idx.erase(k); - } - loggers::get_instance().log_msg("security_cache::store_certificate: Add entry ", hashed_id8); - loggers::get_instance().log("security_cache::store_certificate: Add entry for key %s", key.c_str()); - hashed_id8s.insert(std::pair(hashed_id8, key)); - _certificates_idx.insert(std::pair(key, hashed_id8)); - return 0; } @@ -436,4 +422,10 @@ void security_cache::dump() const { loggers::get_instance().log_msg("security_cache::dump: Hashedid8 key = ", it->first); loggers::get_instance().log("security_cache::dump: Hashedid8 idx ==> %s", it->second.c_str()); } // End of 'for' statement + std::map& certificates = certificates_loader::get_instance().get_certificates(); + loggers::get_instance().log("security_cache::dump: certificates table length: %d", certificates.size()); + for (std::map::const_iterator it = certificates.cbegin(); it != certificates.cend(); ++it) { + loggers::get_instance().log("security_cache::dump: certificates idx ==> %s", it->first.c_str()); + loggers::get_instance().log_msg("security_cache::dump: certificates key = ", it->second); + } // End of 'for' statement } // End of method dump diff --git a/ccsrc/Protocols/Security/security_cache.hh b/ccsrc/Protocols/Security/security_cache.hh index 69a99d3..3adc299 100644 --- a/ccsrc/Protocols/Security/security_cache.hh +++ b/ccsrc/Protocols/Security/security_cache.hh @@ -31,7 +31,6 @@ class security_cache { protected: /*! \protectedsection */ // TODO Enforce with const security_cache_record, and const std::string - std::map _certificates_idx; //! List of the certificates indexed by the certificate identifier std::map> _certificates; //! List of the certificates indexed by the certificate identifier public: /*! \publicsection */ diff --git a/ccsrc/Protocols/Security/security_db.cc b/ccsrc/Protocols/Security/security_db.cc index 8dae159..c696519 100644 --- a/ccsrc/Protocols/Security/security_db.cc +++ b/ccsrc/Protocols/Security/security_db.cc @@ -30,7 +30,7 @@ int security_db::initialize_cache(const std::string &p_db_path) { } // TODO Build the maps of couple {HasehedId8, Certificate} - if (certificates_loader::get_instance().build_certificates_index(_certificates_idx) == -1) { + if (certificates_loader::get_instance().build_certificates_index() == -1) { loggers::get_instance().log(">>> security_db::initialize_cache: certificates_loader::build_certificates_index method failed"); return -1; } diff --git a/ccsrc/Protocols/Security/security_services_its.cc b/ccsrc/Protocols/Security/security_services_its.cc index a20d20d..1d7041e 100644 --- a/ccsrc/Protocols/Security/security_services_its.cc +++ b/ccsrc/Protocols/Security/security_services_its.cc @@ -280,7 +280,6 @@ int security_services_its::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2 int result = -1; if (p_signed_data.signer().ischosen(Ieee1609Dot2::SignerIdentifier::ALT_digest)) { // Retrieve the certificate identifier from digest - loggers::get_instance().log("security_services_its::process_ieee_1609_dot2_signed_data: Retrieve the certificate identifier from digest"); result = _security_db.get()->get_certificate_id(p_signed_data.signer().digest(), certificate_id); if (result == -1) { // Check in the cache @@ -296,6 +295,15 @@ int security_services_its::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2 _last_generation_time = 0; return -1; + } else { + Ieee1609Dot2::CertificateBase certificate; + _security_cache.get()->get_certificate(certificate_id, certificate); + // Retrieve ssps + OPTIONAL &v = certificate.toBeSigned().appPermissions(); + if (v.is_present()) { + Ieee1609Dot2BaseTypes::SequenceOfPsidSsp psid_ssps = static_cast(*v.get_opt_value()); + retrieve_ssps(psid_ssps, p_params); + } } } else if (p_signed_data.signer().ischosen(Ieee1609Dot2::SignerIdentifier::ALT_certificate) && (p_signed_data.signer().certificate().size_of() != 0)) { // Extract the certificates @@ -306,26 +314,7 @@ int security_services_its::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2 OPTIONAL &v = cert.toBeSigned().appPermissions(); if (v.is_present()) { Ieee1609Dot2BaseTypes::SequenceOfPsidSsp psid_ssps = static_cast(*v.get_opt_value()); - loggers::get_instance().log("security_services_its::process_ieee_1609_dot2_signed_data: psid_ssps size: %d", psid_ssps.lengthof()); - for (int i = 0; i < psid_ssps.lengthof(); i++) { - const Ieee1609Dot2BaseTypes::PsidSsp &psid_ssp = psid_ssps[i]; - loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_signed_data: Processing psid_ssp ", psid_ssp); - const OPTIONAL &s = psid_ssp.ssp(); - if (s.is_present()) { - const Ieee1609Dot2BaseTypes::ServiceSpecificPermissions &ssp = static_cast(s); - loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_signed_data: Processing ssp ", ssp); - params_its::const_iterator it = p_params.find(std::to_string(psid_ssp.psid())); - if (it == p_params.cend()) { - OCTETSTRING os; - if (ssp.ischosen(Ieee1609Dot2BaseTypes::ServiceSpecificPermissions::ALT_opaque)) { - os = ssp.opaque(); - } else { - os = ssp.bitmapSsp(); - } - p_params[params_its::ssp] = std::string(static_cast(oct2str(os))); - } - } - } // End of 'for' statement + retrieve_ssps(psid_ssps, p_params); } std::string certificate_id; @@ -347,6 +336,7 @@ int security_services_its::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2 return -1; } loggers::get_instance().log("security_services_its::process_ieee_1609_dot2_signed_data: certificate id = '%s'", certificate_id.c_str()); + // Verify the signature of the ToBeSignedData loggers::get_instance().log_msg("security_services_its::process_ieee_1609_dot2_signed_data: signature=", p_signed_data.signature__()); result = -1; @@ -373,6 +363,32 @@ int security_services_its::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2 return 0; } // End of method process_ieee_1609_dot2_signed_data +int security_services_its::retrieve_ssps(const Ieee1609Dot2BaseTypes::SequenceOfPsidSsp& p_psid_ssps, params_its &p_params) { + loggers::get_instance().log_msg(">>> security_services_its::retrieve_ssps: ", p_psid_ssps); + loggers::get_instance().log(">>> security_services_its::retrieve_ssps: psid_ssps size: %d", p_psid_ssps.lengthof()); + for (int i = 0; i < p_psid_ssps.lengthof(); i++) { + const Ieee1609Dot2BaseTypes::PsidSsp &psid_ssp = p_psid_ssps[i]; + loggers::get_instance().log_msg("security_services_its::retrieve_ssps: Processing psid_ssp ", psid_ssp); + const OPTIONAL &s = psid_ssp.ssp(); + if (s.is_present()) { + const Ieee1609Dot2BaseTypes::ServiceSpecificPermissions &ssp = static_cast(s); + loggers::get_instance().log_msg("security_services_its::retrieve_ssps: Processing ssp ", ssp); + params_its::const_iterator it = p_params.find(std::to_string(psid_ssp.psid())); + if (it == p_params.cend()) { + OCTETSTRING os; + if (ssp.ischosen(Ieee1609Dot2BaseTypes::ServiceSpecificPermissions::ALT_opaque)) { + os = ssp.opaque(); + } else { + os = ssp.bitmapSsp(); + } + p_params[params_its::ssp] = std::string(static_cast(oct2str(os))); + } + } + } // End of 'for' statement + + return 0; +} // End of method retrieve_ssps + int security_services_its::process_ieee_1609_dot2_encrypted_data(const Ieee1609Dot2::EncryptedData &p_encrypted_data, const bool p_verify, OCTETSTRING &p_unsecured_payload, params_its &p_params) { loggers::get_instance().log_msg(">>> security_services_its::process_ieee_1609_dot2_encrypted_data: ", p_encrypted_data); diff --git a/ccsrc/Protocols/Security/security_services_its.hh b/ccsrc/Protocols/Security/security_services_its.hh index 34d6a09..f458fe0 100644 --- a/ccsrc/Protocols/Security/security_services_its.hh +++ b/ccsrc/Protocols/Security/security_services_its.hh @@ -18,6 +18,7 @@ namespace Ieee1609Dot2BaseTypes { class EccP384CurvePoint; //! TITAN forward declaration class HashAlgorithm; //! TITAN forward declaration class Signature; //! TITAN forward declaration + class SequenceOfPsidSsp; //! TITAN forward declaration } // namespace Ieee1609Dot2BaseTypes namespace Ieee1609Dot2 { @@ -187,6 +188,7 @@ private: params_its &p_params); int process_ieee_1609_dot2_encrypted_data(const Ieee1609Dot2::EncryptedData &p_encrypted_data, const bool p_verify, OCTETSTRING &p_unsecured_payload, params_its &p_params); + int retrieve_ssps(const Ieee1609Dot2BaseTypes::SequenceOfPsidSsp& p_psid_ssps, params_its &p_params); int sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_tbs_data, const Ieee1609Dot2BaseTypes::HashAlgorithm &p_hashAlgorithm, Ieee1609Dot2BaseTypes::Signature &p_signature, params_its &p_params); diff --git a/etc/AtsMBR/AtsMBR.cfg b/etc/AtsMBR/AtsMBR.cfg index 5b9d991..f7f0253 100644 --- a/etc/AtsMBR/AtsMBR.cfg +++ b/etc/AtsMBR/AtsMBR.cfg @@ -20,7 +20,7 @@ LibItsBtp_Pixits.PX_DESTINATION_PORT := 2001 LibItsBtp_Pixits.PX_DESTINATION_PORT_INFO := 2001 # The certificate identifier the TA shall use in case of secured IUT -#LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_IUT_A_AT" +#LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_TS_A_AT" # Enable Security support LibItsGeoNetworking_Pics.PICS_GN_SECURITY := true @@ -140,8 +140,14 @@ system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.43,dst_port=12345,src_po [EXECUTE] -# Check that -ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS1_CAM_001 +# Check that the IUT generates an encrypted MBR message +#ItsMbr_TestCases.TC_MRS_ITSS_SEC_BV_001 + +# 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_001 + +# 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 +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS1_CAM_001 [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/titan-test-system-framework b/titan-test-system-framework index 163d1cf..2645a52 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit 163d1cfca22b18ceb1d7e24380f46f7fbaa53a97 +Subproject commit 2645a5245082506a64acc58e7c2c7ac5c5bc4c3a diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index 4fa811c..9bcf30d 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit 4fa811c19b847d355ccb18adf13fac22055c29d7 +Subproject commit 9bcf30d5b9747c99441c84c5ed01e351e49b7205 -- GitLab From cf8b5bcfea82407a47d9d4975600e5b63dd26e54 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Mon, 15 May 2023 16:29:04 +0200 Subject: [PATCH 077/178] Bug foxed in docker/Dokerfile --- titan-test-system-framework | 2 +- virtualization/docker/Dockerfile | 2 +- virtualization/docker/docker-entrypoint.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/titan-test-system-framework b/titan-test-system-framework index 2645a52..ffbcefb 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit 2645a5245082506a64acc58e7c2c7ac5c5bc4c3a +Subproject commit ffbcefb5dbe4bc24623f5738c8a64153c8f3599d diff --git a/virtualization/docker/Dockerfile b/virtualization/docker/Dockerfile index 04cc0bc..0dd0178 100644 --- a/virtualization/docker/Dockerfile +++ b/virtualization/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:latest +FROM alpine:3.16 # Install dependencies RUN apk update && \ diff --git a/virtualization/docker/docker-entrypoint.sh b/virtualization/docker/docker-entrypoint.sh index 3fa9d56..d2416dc 100755 --- a/virtualization/docker/docker-entrypoint.sh +++ b/virtualization/docker/docker-entrypoint.sh @@ -10,7 +10,7 @@ usage() { done } -commands="help,build CAM,clean CAM,list CAM,modulepar CAM,rebuild CAM,run CAM,version" +commands="help,build,clean,list,modulepar,rebuild,run,version" if [ $# == 0 ]; then usage @@ -55,4 +55,4 @@ case "$1" in esac unset ATS -exit 0 \ No newline at end of file +exit 0 -- GitLab From 828ab3c788242d2b282d16f03b496c5d688dce0b Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Mon, 15 May 2023 16:38:53 +0200 Subject: [PATCH 078/178] Bug foxed in docker/Dokerfile --- virtualization/docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virtualization/docker/Dockerfile b/virtualization/docker/Dockerfile index 0dd0178..f5692db 100644 --- a/virtualization/docker/Dockerfile +++ b/virtualization/docker/Dockerfile @@ -22,7 +22,7 @@ WORKDIR /home/etsi RUN \ mkdir -p frameworks dev tmp \ && cd frameworks \ - && git clone --branch=vlm_test https://github.com/fillabs/asn1c.git ./asn1c \ + && git clone --branch=vlm_test https://github.com/fillabs/asn1c.git ./asn1c.denis \ && cd ./asn1c \ && autoreconf -iv && ./configure --prefix=${HOME} && make install \ && cd - \ -- GitLab From 79feabf27f1b48d9806f9ec55ac7aebf1c3c84cf Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Tue, 16 May 2023 11:41:24 +0200 Subject: [PATCH 079/178] Bug fixed in docker/Dockerfile; Add script to switch in ITS Conformance testing Release 1; Add flag to force secured beaconing --- .../GeoNetworking/geonetworking_layer.cc | 12 +++-- .../GeoNetworking/geonetworking_layer.hh | 11 ++-- ccsrc/framework/include/params_its.hh | 2 + ccsrc/framework/src/params_its.cc | 1 + etc/AtsMBR/AtsMBR.cfg | 11 ++-- switch_its_r1.sh | 54 +++++++++++++++++++ ttcn/AtsMBR | 2 +- ttcn/AtsPki | 2 +- virtualization/docker/Dockerfile | 11 ++-- 9 files changed, 84 insertions(+), 22 deletions(-) create mode 100755 switch_its_r1.sh diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc index e8451ee..350879a 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc @@ -22,7 +22,7 @@ using namespace LibItsGeoNetworking__TypesAndValues; geonetworking_layer::geonetworking_layer(const std::string &p_type, const std::string &p_param) : t_layer(p_type), _params(), _codec(), _beacon(nullptr), _gbc_packet(nullptr), _shb_packet(nullptr), _tsb_packet(nullptr), _uni_packet(nullptr), _ls_reply(nullptr), _location_table(), - _pass_beacon_table(), _device_mode{false}, _secured_mode{false}, _encrypted_mode{false}, _enable_security_checks{false}, + _pass_beacon_table(), _device_mode{false}, _secured_mode{false}, _beacon_secured_mode{false}, _encrypted_mode{false}, _enable_security_checks{false}, _sendData(), _timerid{0}, _sev{0}, _its{0}, _freq_nanosecs(0), _mask{0}, _sa{0}, _sequence_number{0}, _latitude{0}, _longitude{0}, _force_certificate{false}, _leap_delay_us(4000/*Add 4 leap seconds to convert to TAI (as Feb 2019)*/) { loggers::get_instance().log(">>> geonetworking_layer::geonetworking_layer: %s, %s", to_string().c_str(), p_param.c_str()); @@ -116,6 +116,12 @@ void geonetworking_layer::init(const std::string &p_type, const std::string &p_p } else { _params.insert(std::pair(params_its::secured_mode, "0")); } + it = _params.find(params_its::beacon_secured_mode); + if (it != _params.cend()) { + _beacon_secured_mode = (1 == converter::get_instance().string_to_int(it->second)); + } else { + _params.insert(std::pair(params_its::beacon_secured_mode, "0")); + } it = _params.find(params_its::encrypted_mode); if (it != _params.cend()) { _encrypted_mode = (1 == converter::get_instance().string_to_int(it->second)); @@ -142,7 +148,7 @@ void geonetworking_layer::init(const std::string &p_type, const std::string &p_p } // Set up default security parameters value - if (_secured_mode || _encrypted_mode) { + if (_secured_mode || _encrypted_mode || _beacon_secured_mode) { loggers::get_instance().log("geonetworking_layer::init: Setup secured mode"); setup_secured_mode(); } @@ -515,7 +521,7 @@ void geonetworking_layer::send_beacon() { _beacon->encode(*(_beacon->get_descriptor()), encoding_buffer, TTCN_EncDec::CT_RAW); OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); params_its params(_params); - if (_secured_mode) { // Apply Security + if (_secured_mode || _beacon_secured_mode) { // Apply Security if (build_secured_pdu(data, params) != 0) { return; } diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh index 8856940..68d9365 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh @@ -54,11 +54,12 @@ class geonetworking_layer : public t_layer Date: Tue, 16 May 2023 12:14:08 +0200 Subject: [PATCH 080/178] Add script to switch in ITS Conformance testing Release 2 --- switch_its_r2.sh | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ ttcn/AtsMBR | 2 +- 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100755 switch_its_r2.sh diff --git a/switch_its_r2.sh b/switch_its_r2.sh new file mode 100755 index 0000000..2c7d087 --- /dev/null +++ b/switch_its_r2.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +#set -e +set -vx + +BASE_PATH=`pwd` + +git checkout ttf_t024 +git submodule update --init --recursive --remote + +cd $BASE_PATH/ttcn +git checkout devel + +for i in `find $BASE_PATH/ttcn -type d -name "Ats*"` +do + cd $i + git checkout devel2 +done +for i in `find $BASE_PATH/ttcn/Ats* -type d -name "asn1"` +do + cd $i + git checkout testing2 + if [ -f ETSI-ITS-CDD.asn ] + then + ln -sf ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn + elif [ -f IVIM-PDU-Descriptions.asn ] + then + ln -sf IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn + ln -sf MAPEM-PDU-Descriptions.asn MAPEM_PDU_Descriptions.asn + ln -sf RTCMEM-PDU-Descriptions.asn RTCMEM_PDU_Descriptions.asn + ln -sf SPATEM-PDU-Descriptions.asn SPATEM_PDU_Descriptions.asn + ln -sf SREM-PDU-Descriptions.asn SREM_PDU_Descriptions.asn + ln -sf SSEM-PDU-Descriptions.asn SSEM_PDU_Descriptions.asn + ln -sf iso-patched/'ISO14906(2018)EfcDsrcApplicationv6-patched.asn' iso-patched/EfcDsrcApplication.asn + ln -sf iso-patched/'ISO14906(2018)EfcDsrcGenericv7-patched.asn' iso-patched/EfcDsrcGeneric.asn + ln -sf iso-patched/ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn iso-patched/ElectronicRegistrationIdentificationVehicleDataModule.asn + ln -sf iso-patched/ISO14823-missing.asn iso-patched/GDD.asn + fi + SUB_DIRS=`find . -type d` + if [ "SUB_DIRS" != "" ] + then + for j in $SUB_DIRS + do + cd $j + git checkout testing2 + cd - + done + fi +done + +cd $BASE_PATH +git checkout ttf_t024 + +if [ ! -f ./titan-test-system-framework ] +then + git clone --recurse-submodules --single-branch --branch devel https://labs.etsi.org/rep/cti-tools/titan-test-system-framework.git + cd ./titan-test-system-framework +else + cd ./titan-test-system-framework + git checkout devel +fi +cd ./ttcn/LibHttp +ln -sf module_its.mk module.mk + +cd $BASE_PATH/ttcn/LibIts +git checkout devel2 + +cd $BASE_PATH +cp ./ttcn/patch_lib_common_titan/module.mk ./ttcn/LibCommon/ +cp ./ttcn/patch_lib_common_titan/ttcn/* ./ttcn/LibCommon/ttcn + + +exit 0 diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index 4d31ca6..fdc5adb 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit 4d31ca6919e16a4f84a14c0344df93be71d03e54 +Subproject commit fdc5adbbaaa08e5b583eb90cb66aff370f9310bd -- GitLab From dfc2f80a2955641b27076fee31a6737eacbfa4b6 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Tue, 16 May 2023 12:16:27 +0200 Subject: [PATCH 081/178] Bug fixed in script to switch in ITS Conformance testing Release 2 --- switch_its_r2.sh | 6 ------ ttcn/LibIts | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/switch_its_r2.sh b/switch_its_r2.sh index 2c7d087..fd9f5d6 100755 --- a/switch_its_r2.sh +++ b/switch_its_r2.sh @@ -8,9 +8,6 @@ BASE_PATH=`pwd` git checkout ttf_t024 git submodule update --init --recursive --remote -cd $BASE_PATH/ttcn -git checkout devel - for i in `find $BASE_PATH/ttcn -type d -name "Ats*"` do cd $i @@ -48,9 +45,6 @@ do fi done -cd $BASE_PATH -git checkout ttf_t024 - if [ ! -f ./titan-test-system-framework ] then git clone --recurse-submodules --single-branch --branch devel https://labs.etsi.org/rep/cti-tools/titan-test-system-framework.git diff --git a/ttcn/LibIts b/ttcn/LibIts index 30d2ee5..286ea65 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit 30d2ee5e2279e2c455427e97c57014101ff160ae +Subproject commit 286ea65132a54908e5c8447d3842dcca5808d17c -- GitLab From 06e2d3eb3e3c29507a76f19b2286fe703b7be38d Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Wed, 24 May 2023 08:33:28 +0200 Subject: [PATCH 082/178] Add certificate profile for MA --- data/certificates/profiles/CERT_IUT_A_MA.xml | 44 ++++++++++++++++++++ virtualization/docker/docker-entrypoint.sh | 11 ++++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 data/certificates/profiles/CERT_IUT_A_MA.xml diff --git a/data/certificates/profiles/CERT_IUT_A_MA.xml b/data/certificates/profiles/CERT_IUT_A_MA.xml new file mode 100644 index 0000000..0415f67 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_MA.xml @@ -0,0 +1,44 @@ + + + 3 + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + 01 32 + + + + + + + + + + diff --git a/virtualization/docker/docker-entrypoint.sh b/virtualization/docker/docker-entrypoint.sh index d2416dc..9864438 100755 --- a/virtualization/docker/docker-entrypoint.sh +++ b/virtualization/docker/docker-entrypoint.sh @@ -10,7 +10,7 @@ usage() { done } -commands="help,build,clean,list,modulepar,rebuild,run,version" +commands="help,build,clean,ip,list,modulepar,ping,rebuild,build-run,run,version" if [ $# == 0 ]; then usage @@ -33,15 +33,24 @@ case "$1" in clean) cd ${GEN_DIR} && make clean ;; + ip) + ip address + ;; list) ${cli} -l ;; modulepar) ${cli} -p ;; + ping) + sudo ping $2 + ;; rebuild) cd ${GEN_DIR} && rm -fr ./bin ./build ; make ;; + build-run) + d ${GEN_DIR}/scripts && ./run_all.bash 0 + ;; run) cd ${GEN_DIR}/scripts && ./run_all.bash ;; -- GitLab From f75d4ac935ef9092bd4d249d7fb3bbdb1cbc2b99 Mon Sep 17 00:00:00 2001 From: garciay Date: Wed, 24 May 2023 08:59:36 +0200 Subject: [PATCH 083/178] Bug fixed in switch_its_r2.sh --- switch_its_r2.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/switch_its_r2.sh b/switch_its_r2.sh index fd9f5d6..09843e5 100755 --- a/switch_its_r2.sh +++ b/switch_its_r2.sh @@ -45,6 +45,7 @@ do fi done +cd $BASE_PATH if [ ! -f ./titan-test-system-framework ] then git clone --recurse-submodules --single-branch --branch devel https://labs.etsi.org/rep/cti-tools/titan-test-system-framework.git -- GitLab From 8331082437971743e653794e86e42c5417e75d3d Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 25 May 2023 07:48:59 +0200 Subject: [PATCH 084/178] Enhance usage() function in docker-entrypoint.sh --- ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc | 2 +- virtualization/docker/docker-entrypoint.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc index 350879a..9595a80 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc @@ -237,7 +237,7 @@ void geonetworking_layer::send_data(OCTETSTRING &data, params &p_params) { const TTCN_RAWdescriptor_t _intx_raw_ = {RAW_INTX, SG_NO, ORDER_MSB, ORDER_MSB, ORDER_LSB, ORDER_MSB, EXT_BIT_NO, ORDER_LSB, ORDER_LSB, TOP_BIT_INHERITED, 0, 0, 0, 8, 0, NULL, -1, CharCoding::UNKNOWN}; -const TTCN_Typedescriptor_t _intx_descr_ = {"IntX", NULL, &_intx_raw_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE}; +const TTCN_Typedescriptor_t _intx_descr_ = {"IntX", NULL, &_intx_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE}; void geonetworking_layer::receive_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> geonetworking_layer::receive_data: ", data); diff --git a/virtualization/docker/docker-entrypoint.sh b/virtualization/docker/docker-entrypoint.sh index 9864438..cc91317 100755 --- a/virtualization/docker/docker-entrypoint.sh +++ b/virtualization/docker/docker-entrypoint.sh @@ -8,6 +8,8 @@ usage() { do echo " $i" done + echo "For build,clean,list,modulepar,rebuild,build-run and run, ATS identifier need to be specified (e.g. CAM, DENM, Security, Pki, MBR...)" + echo "e.g. docker-run.sh build Security # To build the AtsSecurity test suite" } commands="help,build,clean,ip,list,modulepar,ping,rebuild,build-run,run,version" -- GitLab From dd1b6ac50f31ca46ec07f74ed4a3e7bc6321afd5 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 25 May 2023 10:09:11 +0200 Subject: [PATCH 085/178] Reorganize code due to new version of TITAN. No backward compatibility --- README.md | 23 +- ccsrc/EncDec/LibItsBtp_Encdec.cc | 240 +++--- ccsrc/EncDec/LibItsCam_Encdec.cc | 506 ++++++------ ccsrc/EncDec/LibItsDenm_Encdec.cc | 536 ++++++------- ccsrc/EncDec/LibItsEvcsn_Encdec.cc | 74 +- ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc | 536 ++++++------- .../LibItsIpv6OverGeoNetworking_Encdec.cc | 40 +- ccsrc/EncDec/LibItsIvim_Encdec.cc | 22 - ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc | 45 -- ccsrc/EncDec/LibItsMbr_Encdec.cc | 72 +- ccsrc/EncDec/LibItsPki_Encdec.cc | 755 +++++++++--------- ccsrc/EncDec/LibItsRtcmem_Encdec.cc | 22 - ccsrc/EncDec/LibItsSecurity_Encdec.cc | 177 +--- ccsrc/EncDec/LibItsSremSsem_Encdec.cc | 44 - ccsrc/EncDec/module.mk | 6 +- config.mk | 2 +- 16 files changed, 1415 insertions(+), 1685 deletions(-) diff --git a/README.md b/README.md index 29bc9fb..474a847 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,12 @@ ETSI ITS protocols project supports: - EN 302 636-4-1: "Intelligent Transport Systems (ITS); Vehicular Communications; GeoNetworking; Part 4: Geographical addressing and forwarding for point-to-point and point-to-multipoint communications; Sub-part 1: Media-Independent Functionality" In addition, it also support ITS Security as define by: -- ETSI TS 103 940: "Intelligent Transport Systems (ITS); Security; Security Architecture and Management". -- ETSI TS 103 097: "Intelligent Transport Systems (ITS); Security; Security header and certificate formats". - ETSI TS 102 941: "Intelligent Transport Systems (ITS); Security; Trust and Privacy Management technical specification" -- IEEE Std 1609.2™-2016: "IEEE Standard for Wireless Access in Vehicular Environments –Security Services for Applications and Management Messages" -- IEEE Std 1609.2a™-2017: "Standard for Wireless Access In Vehicular Environments – Security Services for Applications and Management Messages Amendment 1". +- ETSI TS 103 097: "Intelligent Transport Systems (ITS); Security; Security header and certificate formats". +- ETSI TS 103 940: "Intelligent Transport Systems (ITS); Security; Security Architecture and Management". +- ETSI TS 103 759: "Intelligent Transport Systems (ITS); Security; isbehaviour Reporting service; Release 2" +- P1609.2™/D13: "Draft Standard for Wireless Access in Vehicular Environments – Security Services for Application and Management Messages" +- P1609.2.1™/D7: "Draft Standard for Wireless Access in Vehicular Environments (WAVE) – Certificate Management Interfaces for End Entities" Contact information Email at cti_support at etsi dot org @@ -26,7 +27,7 @@ Unless specified otherwise, the content of this repository and the files contain See the attached LICENSE file or visit https://forge.etsi.org/etsi-software-license -## STFs +## STFs / TTFs The following STFs were or are currently involved in the evolutions of the ETSI ITS protocols project: - STF 405, STF 422, STF 424, STF 455, STF 462, STF 481, STF 484, STF 507, STF 517, STF 525, STF 538, STF 545, STF 594, TTF T002, TTF T011, TTF T024 @@ -63,7 +64,7 @@ Vagrant requires a virtual machine. You can use either VirtualBox or WMware. Docker does not need a virtual machine, so it is the more efficant way. -#### Using Vagrant +### Using Vagrant Pre-requisites on your host machine: - Install [Virtualbox](https://www.virtualbox.org/manual/ch01.html) @@ -141,7 +142,7 @@ $ ./virtualization/docker/run-container.sh - Switch to the next clause (Usage) -#### From scratch +### From scratch Pre-requisites: - Install Virtualbox @@ -220,17 +221,17 @@ $ cp ./ttcn/patch_lib_common/ttcn/* ./ttcn/LibCommon/ttcn - Switch to the next clause (Usage) -#### Using Eclipse TITAN +### Using Eclipse TITAN When cloning the ETSI ITS project, you can find two specific files: -- TTF011.tpd -- TTF011_Linux.tpd +- TS.ITS.tpd +- TS.ITS_Linux.tpd These two files are used create the ETSI ITS project workspace on Eclipse TITAN. To do it, please follow the steps below: - Start eclipse using a new workspace, (e.g. with the name workspace_titan) - Select the menu option File/import - In the Dialog box,select TITAN/Project from .tpd file -- Select the correct TTF011.tpd file and follow the instructions +- Select the correct TS.ITS.tpd file and follow the instructions NOTE: When the Eclipse TITAN workspace is created, you have to build manually the librairy 'libasn1c.so' following the commands below: ```sh diff --git a/ccsrc/EncDec/LibItsBtp_Encdec.cc b/ccsrc/EncDec/LibItsBtp_Encdec.cc index 89822c0..2b2b499 100644 --- a/ccsrc/EncDec/LibItsBtp_Encdec.cc +++ b/ccsrc/EncDec/LibItsBtp_Encdec.cc @@ -1,120 +1,120 @@ -#include "LibItsBtp_EncdecDeclarations.hh" - -#include "btp_codec.hh" -#include "loggers.hh" - -namespace LibItsBtp__EncdecDeclarations { - - /**************************************************** - * @desc External function to encode a BtpReq type - * @param value to encode - * @return encoded value - ****************************************************/ - BITSTRING fx__enc__BtpReq(LibItsBtp__TypesAndValues::BtpReq const &p_btpReq) { - loggers::get_instance().log_msg(">>> fx__enc__BtpReq: ", p_btpReq); - - btp_codec codec; - OCTETSTRING os; - if (codec.encode(p_btpReq.msgOut(), os) == -1) { - loggers::get_instance().warning("fx__enc__BtpReq: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - /**************************************************** - * @desc External function to decode a BtpReq type - * @param value to encode - * @return encoded value - ****************************************************/ - - INTEGER fx__dec__BtpReq(BITSTRING &b, LibItsBtp__TypesAndValues::BtpReq &p) { - loggers::get_instance().log(">>> fx__dec__BtpReq"); - btp_codec codec; - LibItsBtp__TypesAndValues::BtpPacket pdu; - OCTETSTRING is = bit2oct(b); - - if (codec.decode(is, pdu) == -1) { - loggers::get_instance().warning("fx__dec__BtpReq: -1 result code was returned"); - return -1; - } - p.msgOut() = pdu; - - return 0; - } - - /**************************************************** - * @desc External function to encode a BtpInd type - * @param value to encode - * @return encoded value - ****************************************************/ - BITSTRING fx__enc__BtpInd(LibItsBtp__TypesAndValues::BtpInd const &p_btpInd) { - loggers::get_instance().log_msg(">>> fx__enc__BtpInd: ", p_btpInd); - - btp_codec codec; - OCTETSTRING os; - if (codec.encode(p_btpInd.msgIn(), os) == -1) { - loggers::get_instance().warning("fx__enc__BtpInd: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - /**************************************************** - * @desc External function to decode a BtpInd type - * @param value to encode - * @return encoded value - ****************************************************/ - - INTEGER fx__dec__BtpInd(BITSTRING &b, LibItsBtp__TypesAndValues::BtpInd &p_btpInd) { - loggers::get_instance().log(">>> fx__dec__BtpInd"); - btp_codec codec; - LibItsBtp__TypesAndValues::BtpPacket pdu; - OCTETSTRING is = bit2oct(b); - - // Calculate the size of the lower layers information - if (codec.decode(is, pdu) == -1) { - loggers::get_instance().warning("fx__dec__BtpInd: -1 result code was returned"); - return -1; - } - p_btpInd.msgIn() = pdu; - - loggers::get_instance().log_msg("<<< fx__dec__BtpInd: ", p_btpInd); - return 0; - } - - /**************************************************** - * @desc External function to encode a BtpPacket type - * @param value to encode - * @return encoded value - ****************************************************/ - BITSTRING fx__enc__BtpPacket(LibItsBtp__TypesAndValues::BtpPacket const &p_btpPacket) { - loggers::get_instance().log_msg(">>> fx__enc__BtpPacket: ", p_btpPacket); - - btp_codec codec; - OCTETSTRING os; - codec.encode(p_btpPacket, os); - return oct2bit(os); - } - - /**************************************************** - * @desc External function to decode a BtpPacket type - * @param value to encode - * @return encoded value - ****************************************************/ - - INTEGER fx__dec__BtpPacket(BITSTRING &b, LibItsBtp__TypesAndValues::BtpPacket &p_btpPacket) { - loggers::get_instance().log(">>> fx__dec__BtpPacket"); - btp_codec codec; - OCTETSTRING is = bit2oct(b); - - if (codec.decode(is, p_btpPacket) == -1) { - loggers::get_instance().warning("fx__dec__BtpPacket: -1 result code was returned"); - return -1; - } - return 0; - } - -} // namespace LibItsBtp__EncdecDeclarations +#include "LibItsBtp_EncdecDeclarations.hh" + +#include "btp_codec.hh" +#include "loggers.hh" + +namespace LibItsBtp__EncdecDeclarations { + + /**************************************************** + * @desc External function to encode a BtpReq type + * @param value to encode + * @return encoded value + ****************************************************/ + BITSTRING fx__enc__BtpReq(LibItsBtp__TypesAndValues::BtpReq const &p_btpReq) { + loggers::get_instance().log_msg(">>> fx__enc__BtpReq: ", p_btpReq); + + btp_codec codec; + OCTETSTRING os; + if (codec.encode(p_btpReq.msgOut(), os) == -1) { + loggers::get_instance().warning("fx__enc__BtpReq: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + /**************************************************** + * @desc External function to decode a BtpReq type + * @param value to encode + * @return encoded value + ****************************************************/ + + INTEGER fx__dec__BtpReq(BITSTRING &b, LibItsBtp__TypesAndValues::BtpReq &p) { + loggers::get_instance().log(">>> fx__dec__BtpReq"); + btp_codec codec; + LibItsBtp__TypesAndValues::BtpPacket pdu; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(is, pdu) == -1) { + loggers::get_instance().warning("fx__dec__BtpReq: -1 result code was returned"); + return -1; + } + p.msgOut() = pdu; + + return 0; + } + + /**************************************************** + * @desc External function to encode a BtpInd type + * @param value to encode + * @return encoded value + ****************************************************/ + BITSTRING fx__enc__BtpInd(LibItsBtp__TypesAndValues::BtpInd const &p_btpInd) { + loggers::get_instance().log_msg(">>> fx__enc__BtpInd: ", p_btpInd); + + btp_codec codec; + OCTETSTRING os; + if (codec.encode(p_btpInd.msgIn(), os) == -1) { + loggers::get_instance().warning("fx__enc__BtpInd: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + /**************************************************** + * @desc External function to decode a BtpInd type + * @param value to encode + * @return encoded value + ****************************************************/ + + INTEGER fx__dec__BtpInd(BITSTRING &b, LibItsBtp__TypesAndValues::BtpInd &p_btpInd) { + loggers::get_instance().log(">>> fx__dec__BtpInd"); + btp_codec codec; + LibItsBtp__TypesAndValues::BtpPacket pdu; + OCTETSTRING is = bit2oct(b); + + // Calculate the size of the lower layers information + if (codec.decode(is, pdu) == -1) { + loggers::get_instance().warning("fx__dec__BtpInd: -1 result code was returned"); + return -1; + } + p_btpInd.msgIn() = pdu; + + loggers::get_instance().log_msg("<<< fx__dec__BtpInd: ", p_btpInd); + return 0; + } + + /**************************************************** + * @desc External function to encode a BtpPacket type + * @param value to encode + * @return encoded value + ****************************************************/ + BITSTRING fx__enc__BtpPacket(LibItsBtp__TypesAndValues::BtpPacket const &p_btpPacket) { + loggers::get_instance().log_msg(">>> fx__enc__BtpPacket: ", p_btpPacket); + + btp_codec codec; + OCTETSTRING os; + codec.encode(p_btpPacket, os); + return oct2bit(os); + } + + /**************************************************** + * @desc External function to decode a BtpPacket type + * @param value to encode + * @return encoded value + ****************************************************/ + + INTEGER fx__dec__BtpPacket(BITSTRING &b, LibItsBtp__TypesAndValues::BtpPacket &p_btpPacket) { + loggers::get_instance().log(">>> fx__dec__BtpPacket"); + btp_codec codec; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(is, p_btpPacket) == -1) { + loggers::get_instance().warning("fx__dec__BtpPacket: -1 result code was returned"); + return -1; + } + return 0; + } + +} // namespace LibItsBtp__EncdecDeclarations diff --git a/ccsrc/EncDec/LibItsCam_Encdec.cc b/ccsrc/EncDec/LibItsCam_Encdec.cc index 26ed278..9aeba6e 100644 --- a/ccsrc/EncDec/LibItsCam_Encdec.cc +++ b/ccsrc/EncDec/LibItsCam_Encdec.cc @@ -1,253 +1,253 @@ -#include - -#include "LibItsCam_EncdecDeclarations.hh" - -#include "cam_codec.hh" -#include "loggers.hh" -#include "uppertester_cam_codec.hh" - -namespace LibItsCam__EncdecDeclarations { - /**************************************************** - * @desc External function to encode a CamReq type - * @param value to encode - * @return encoded value - ****************************************************/ - BITSTRING fx__enc__CamReq(const LibItsCam__TypesAndValues::CamReq &p_camReq) { - loggers::get_instance().log_msg(">>> fx__enc__CamReq: ", p_camReq); - - cam_codec codec; - OCTETSTRING os; - if (codec.encode(p_camReq.msgOut(), os) == -1) { - loggers::get_instance().warning("fx__enc__CamReq: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - /**************************************************** - * @desc External function to decode a CamReq type - * @param value to encode - * @return encoded value - ****************************************************/ - INTEGER fx__dec__CamReq(BITSTRING &b, LibItsCam__TypesAndValues::CamReq &p) { - loggers::get_instance().log(">>> fx__dec__CamReq"); - - cam_codec codec; - CAM__PDU__Descriptions::CAM cam; - OCTETSTRING is = bit2oct(b); - - if (codec.decode(is, cam) == -1) { - loggers::get_instance().warning("fx__dec__CamReq: -1 result code was returned"); - return -1; - } - p.msgOut() = cam; - - return 0; - } - - INTEGER fx__dec__CamInd(BITSTRING &b, LibItsCam__TypesAndValues::CamInd &p_camInd) { - loggers::get_instance().log(">>> fx__dec__CamInd"); - - cam_codec codec; - CAM__PDU__Descriptions::CAM cam; - OCTETSTRING is = bit2oct(b); - - // Calculate the size of the lower layers information - int s = (LibItsCam__TypesAndValues::CamInd_gnNextHeader_raw_.fieldlength + LibItsCam__TypesAndValues::CamInd_gnHeaderType_raw_.fieldlength + - LibItsCam__TypesAndValues::CamInd_gnHeaderSubtype_raw_.fieldlength + LibItsCam__TypesAndValues::CamInd_gnLifetime_raw_.fieldlength + - LibItsCam__TypesAndValues::CamInd_gnTrafficClass_raw_.fieldlength + LibItsCam__TypesAndValues::CamInd_btpDestinationPort_raw_.fieldlength + - LibItsCam__TypesAndValues::CamInd_btpInfo_raw_.fieldlength + LibItsCam__TypesAndValues::CamInd_ssp_raw_.fieldlength + - LibItsCam__TypesAndValues::CamInd_its__aid_raw_.fieldlength) / - 8; - // Decode CA message - if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), cam) == -1) { - loggers::get_instance().warning("fx__dec__CamInd: -1 result code was returned"); - return -1; - } - p_camInd.msgIn() = cam; - // Decode lower layer data - TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); - // gnNextHeader - if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnNextHeader_raw_.fieldlength / 8)) { - p_camInd.gnNextHeader().set_to_omit(); - } else { - OCTETSTRING os; - os.decode(LibItsCam__TypesAndValues::CamInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_camInd.gnNextHeader() = oct2int(os); - } - loggers::get_instance().log_msg("fx__dec__CAM: gnNextHeader=", p_camInd.gnNextHeader()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); - // gnHeaderType - if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnHeaderType_raw_.fieldlength / 8)) { - p_camInd.gnHeaderType().set_to_omit(); - } else { - OCTETSTRING os; - os.decode(LibItsCam__TypesAndValues::CamInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_camInd.gnHeaderType() = oct2int(os); - } - loggers::get_instance().log_msg("fx__dec__CAM: gnHeaderType=", p_camInd.gnHeaderType()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); - // gnHeaderSubtype - if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnHeaderSubtype_raw_.fieldlength / 8)) { - p_camInd.gnHeaderSubtype().set_to_omit(); - } else { - OCTETSTRING os; - os.decode(LibItsCam__TypesAndValues::CamInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_camInd.gnHeaderSubtype() = oct2int(os); - } - loggers::get_instance().log_msg("fx__dec__CAM: gnHeaderSubtype=", p_camInd.gnHeaderSubtype()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); - // gnLifetime - if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnLifetime_raw_.fieldlength / 8)) { - p_camInd.gnLifetime().set_to_omit(); - } else { - INTEGER i; - i.decode(LibItsCam__TypesAndValues::CamInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_camInd.gnLifetime() = i; - } - loggers::get_instance().log_msg("fx__dec__CAM: gnLifetime=", p_camInd.gnLifetime()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); - // gnTrafficClass - if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnTrafficClass_raw_.fieldlength / 8)) { - p_camInd.gnTrafficClass().set_to_omit(); - } else { - OCTETSTRING os; - os.decode(LibItsCam__TypesAndValues::CamInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_camInd.gnTrafficClass() = oct2int(os); - } - loggers::get_instance().log_msg("fx__dec__CAM: gnTrafficClass=", p_camInd.gnTrafficClass()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); - // btpDestinationPort - if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_btpDestinationPort_raw_.fieldlength / 8)) { - p_camInd.btpDestinationPort().set_to_omit(); - } else { - INTEGER i; - i.decode(LibItsCam__TypesAndValues::CamInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_camInd.btpDestinationPort() = i; - } - loggers::get_instance().log_msg("fx__dec__CAM: btpDestinationPort=", p_camInd.btpDestinationPort()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); - // btpInfo - if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_btpInfo_raw_.fieldlength / 8)) { - p_camInd.btpInfo().set_to_omit(); - } else { - INTEGER i; - i.decode(LibItsCam__TypesAndValues::CamInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_camInd.btpInfo() = i; - } - loggers::get_instance().log_msg("fx__dec__CAM: btpInfo=", p_camInd.btpInfo()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); - // ssp - if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_ssp_raw_.fieldlength / 8)) { - p_camInd.ssp().set_to_omit(); - } else { - BITSTRING bs; - bs.decode(LibItsCam__TypesAndValues::CamInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_camInd.ssp() = bs; - } - loggers::get_instance().log_msg("fx__dec__CAM: ssp=", p_camInd.ssp()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); - // its__aid - if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_its__aid_raw_.fieldlength / 8)) { - p_camInd.its__aid().set_to_omit(); - } else { - INTEGER i; - i.decode(LibItsCam__TypesAndValues::CamInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_camInd.its__aid() = i; - } - loggers::get_instance().log_msg("fx__dec__CAM: its_aid=", p_camInd.its__aid()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); - - return 0; - } - - BITSTRING fx__enc__CAM(const CAM__PDU__Descriptions::CAM &p_cam) { - loggers::get_instance().log_msg(">>> fx__enc__CAM: ", p_cam); - - cam_codec codec; - OCTETSTRING os; - codec.encode(p_cam, os); - return oct2bit(os); - } - - INTEGER fx__dec__CAM(BITSTRING &b, CAM__PDU__Descriptions::CAM &p) { - loggers::get_instance().log(">>> fx__dec__CAM"); - cam_codec codec; - OCTETSTRING is = bit2oct(b); - - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { - loggers::get_instance().warning("fx__dec__CAM: -1 result code was returned"); - return -1; - } - - return 0; - } - - BITSTRING fx__enc__UtCamInitialize(const LibItsCam__TypesAndValues::UtCamInitialize &p_utCamInitialize) { - loggers::get_instance().log_msg(">>> fx__enc__UtCamInitialize: ", p_utCamInitialize); - - uppertester_cam_codec codec; - OCTETSTRING os; - codec.encode(p_utCamInitialize, os); - return oct2bit(os); - } - - BITSTRING fx__enc__UtCamChangePosition(const LibItsCam__TypesAndValues::UtCamChangePosition &p_utCamChangePosition) { - loggers::get_instance().log_msg(">>> fx__enc__UtCamChangePosition: ", p_utCamChangePosition); - - uppertester_cam_codec codec; - OCTETSTRING os; - codec.encode(p_utCamChangePosition, os); - return oct2bit(os); - } - - BITSTRING fx__enc__UtCamTrigger(const LibItsCam__TypesAndValues::UtCamTrigger &p_utCamTrigger) { - loggers::get_instance().log_msg(">>> fx__enc__UtCamTrigger: ", p_utCamTrigger); - - uppertester_cam_codec codec; - OCTETSTRING os; - codec.encode(p_utCamTrigger, os); - return oct2bit(os); - } - - /**************************************************** - * @desc External function to decode a UtCamResults type - * @param value to encode - * @return encoded value - ****************************************************/ - INTEGER fx__dec__UtCamResults(BITSTRING &b, LibItsCam__TypesAndValues::UtCamResults &p) { - loggers::get_instance().log(">>> fx__dec__UtCamResults"); - - uppertester_cam_codec codec; - OCTETSTRING is = bit2oct(b); - std::unique_ptr ptr = codec.decode(is); - if (ptr == nullptr) { - loggers::get_instance().warning("fx__dec__UtCamResults: -1 result code was returned"); - return -1; - } - p = static_cast(*ptr); - return 0; - } - - /**************************************************** - * @desc External function to decode a UtCamEventInd type - * @param value to encode - * @return encoded value - ****************************************************/ - INTEGER fx__dec__UtCamEventInd(BITSTRING &b, LibItsCam__TypesAndValues::UtCamEventInd &p) { - loggers::get_instance().log(">>> fx__dec__UtCamEventInd"); - - uppertester_cam_codec codec; - OCTETSTRING is = bit2oct(b); - std::unique_ptr ptr = codec.decode(is); - if (ptr == nullptr) { - loggers::get_instance().warning("fx__dec__UtCamEventInd: -1 result code was returned"); - return -1; - } - p = static_cast(*ptr); - return 0; - } - -} // namespace LibItsCam__EncdecDeclarations +#include + +#include "LibItsCam_EncdecDeclarations.hh" + +#include "cam_codec.hh" +#include "loggers.hh" +#include "uppertester_cam_codec.hh" + +namespace LibItsCam__EncdecDeclarations { + /**************************************************** + * @desc External function to encode a CamReq type + * @param value to encode + * @return encoded value + ****************************************************/ + BITSTRING fx__enc__CamReq(const LibItsCam__TypesAndValues::CamReq &p_camReq) { + loggers::get_instance().log_msg(">>> fx__enc__CamReq: ", p_camReq); + + cam_codec codec; + OCTETSTRING os; + if (codec.encode(p_camReq.msgOut(), os) == -1) { + loggers::get_instance().warning("fx__enc__CamReq: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + /**************************************************** + * @desc External function to decode a CamReq type + * @param value to encode + * @return encoded value + ****************************************************/ + INTEGER fx__dec__CamReq(BITSTRING &b, LibItsCam__TypesAndValues::CamReq &p) { + loggers::get_instance().log(">>> fx__dec__CamReq"); + + cam_codec codec; + CAM__PDU__Descriptions::CAM cam; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(is, cam) == -1) { + loggers::get_instance().warning("fx__dec__CamReq: -1 result code was returned"); + return -1; + } + p.msgOut() = cam; + + return 0; + } + + INTEGER fx__dec__CamInd(BITSTRING &b, LibItsCam__TypesAndValues::CamInd &p_camInd) { + loggers::get_instance().log(">>> fx__dec__CamInd"); + + cam_codec codec; + CAM__PDU__Descriptions::CAM cam; + OCTETSTRING is = bit2oct(b); + + // Calculate the size of the lower layers information + int s = (LibItsCam__TypesAndValues::CamInd_gnNextHeader_raw_.fieldlength + LibItsCam__TypesAndValues::CamInd_gnHeaderType_raw_.fieldlength + + LibItsCam__TypesAndValues::CamInd_gnHeaderSubtype_raw_.fieldlength + LibItsCam__TypesAndValues::CamInd_gnLifetime_raw_.fieldlength + + LibItsCam__TypesAndValues::CamInd_gnTrafficClass_raw_.fieldlength + LibItsCam__TypesAndValues::CamInd_btpDestinationPort_raw_.fieldlength + + LibItsCam__TypesAndValues::CamInd_btpInfo_raw_.fieldlength + LibItsCam__TypesAndValues::CamInd_ssp_raw_.fieldlength + + LibItsCam__TypesAndValues::CamInd_its__aid_raw_.fieldlength) / + 8; + // Decode CA message + if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), cam) == -1) { + loggers::get_instance().warning("fx__dec__CamInd: -1 result code was returned"); + return -1; + } + p_camInd.msgIn() = cam; + // Decode lower layer data + TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + // gnNextHeader + if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnNextHeader_raw_.fieldlength / 8)) { + p_camInd.gnNextHeader().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsCam__TypesAndValues::CamInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_camInd.gnNextHeader() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__CAM: gnNextHeader=", p_camInd.gnNextHeader()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + // gnHeaderType + if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnHeaderType_raw_.fieldlength / 8)) { + p_camInd.gnHeaderType().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsCam__TypesAndValues::CamInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_camInd.gnHeaderType() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__CAM: gnHeaderType=", p_camInd.gnHeaderType()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + // gnHeaderSubtype + if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnHeaderSubtype_raw_.fieldlength / 8)) { + p_camInd.gnHeaderSubtype().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsCam__TypesAndValues::CamInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_camInd.gnHeaderSubtype() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__CAM: gnHeaderSubtype=", p_camInd.gnHeaderSubtype()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + // gnLifetime + if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnLifetime_raw_.fieldlength / 8)) { + p_camInd.gnLifetime().set_to_omit(); + } else { + INTEGER i; + i.decode(LibItsCam__TypesAndValues::CamInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_camInd.gnLifetime() = i; + } + loggers::get_instance().log_msg("fx__dec__CAM: gnLifetime=", p_camInd.gnLifetime()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + // gnTrafficClass + if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnTrafficClass_raw_.fieldlength / 8)) { + p_camInd.gnTrafficClass().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsCam__TypesAndValues::CamInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_camInd.gnTrafficClass() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__CAM: gnTrafficClass=", p_camInd.gnTrafficClass()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + // btpDestinationPort + if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_btpDestinationPort_raw_.fieldlength / 8)) { + p_camInd.btpDestinationPort().set_to_omit(); + } else { + INTEGER i; + i.decode(LibItsCam__TypesAndValues::CamInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_camInd.btpDestinationPort() = i; + } + loggers::get_instance().log_msg("fx__dec__CAM: btpDestinationPort=", p_camInd.btpDestinationPort()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + // btpInfo + if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_btpInfo_raw_.fieldlength / 8)) { + p_camInd.btpInfo().set_to_omit(); + } else { + INTEGER i; + i.decode(LibItsCam__TypesAndValues::CamInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_camInd.btpInfo() = i; + } + loggers::get_instance().log_msg("fx__dec__CAM: btpInfo=", p_camInd.btpInfo()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + // ssp + if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_ssp_raw_.fieldlength / 8)) { + p_camInd.ssp().set_to_omit(); + } else { + BITSTRING bs; + bs.decode(LibItsCam__TypesAndValues::CamInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_camInd.ssp() = bs; + } + loggers::get_instance().log_msg("fx__dec__CAM: ssp=", p_camInd.ssp()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + // its__aid + if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_its__aid_raw_.fieldlength / 8)) { + p_camInd.its__aid().set_to_omit(); + } else { + INTEGER i; + i.decode(LibItsCam__TypesAndValues::CamInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_camInd.its__aid() = i; + } + loggers::get_instance().log_msg("fx__dec__CAM: its_aid=", p_camInd.its__aid()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + + return 0; + } + + // BITSTRING fx__enc__CAM(const CAM__PDU__Descriptions::CAM &p_cam) { + // loggers::get_instance().log_msg(">>> fx__enc__CAM: ", p_cam); + + // cam_codec codec; + // OCTETSTRING os; + // codec.encode(p_cam, os); + // return oct2bit(os); + // } + + // INTEGER fx__dec__CAM(BITSTRING &b, CAM__PDU__Descriptions::CAM &p) { + // loggers::get_instance().log(">>> fx__dec__CAM"); + // cam_codec codec; + // OCTETSTRING is = bit2oct(b); + + // if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + // loggers::get_instance().warning("fx__dec__CAM: -1 result code was returned"); + // return -1; + // } + + // return 0; + // } + + BITSTRING fx__enc__UtCamInitialize(const LibItsCam__TypesAndValues::UtCamInitialize &p_utCamInitialize) { + loggers::get_instance().log_msg(">>> fx__enc__UtCamInitialize: ", p_utCamInitialize); + + uppertester_cam_codec codec; + OCTETSTRING os; + codec.encode(p_utCamInitialize, os); + return oct2bit(os); + } + + BITSTRING fx__enc__UtCamChangePosition(const LibItsCam__TypesAndValues::UtCamChangePosition &p_utCamChangePosition) { + loggers::get_instance().log_msg(">>> fx__enc__UtCamChangePosition: ", p_utCamChangePosition); + + uppertester_cam_codec codec; + OCTETSTRING os; + codec.encode(p_utCamChangePosition, os); + return oct2bit(os); + } + + BITSTRING fx__enc__UtCamTrigger(const LibItsCam__TypesAndValues::UtCamTrigger &p_utCamTrigger) { + loggers::get_instance().log_msg(">>> fx__enc__UtCamTrigger: ", p_utCamTrigger); + + uppertester_cam_codec codec; + OCTETSTRING os; + codec.encode(p_utCamTrigger, os); + return oct2bit(os); + } + + /**************************************************** + * @desc External function to decode a UtCamResults type + * @param value to encode + * @return encoded value + ****************************************************/ + INTEGER fx__dec__UtCamResults(BITSTRING &b, LibItsCam__TypesAndValues::UtCamResults &p) { + loggers::get_instance().log(">>> fx__dec__UtCamResults"); + + uppertester_cam_codec codec; + OCTETSTRING is = bit2oct(b); + std::unique_ptr ptr = codec.decode(is); + if (ptr == nullptr) { + loggers::get_instance().warning("fx__dec__UtCamResults: -1 result code was returned"); + return -1; + } + p = static_cast(*ptr); + return 0; + } + + /**************************************************** + * @desc External function to decode a UtCamEventInd type + * @param value to encode + * @return encoded value + ****************************************************/ + INTEGER fx__dec__UtCamEventInd(BITSTRING &b, LibItsCam__TypesAndValues::UtCamEventInd &p) { + loggers::get_instance().log(">>> fx__dec__UtCamEventInd"); + + uppertester_cam_codec codec; + OCTETSTRING is = bit2oct(b); + std::unique_ptr ptr = codec.decode(is); + if (ptr == nullptr) { + loggers::get_instance().warning("fx__dec__UtCamEventInd: -1 result code was returned"); + return -1; + } + p = static_cast(*ptr); + return 0; + } + +} // namespace LibItsCam__EncdecDeclarations diff --git a/ccsrc/EncDec/LibItsDenm_Encdec.cc b/ccsrc/EncDec/LibItsDenm_Encdec.cc index 1997c5d..bcf4f7a 100644 --- a/ccsrc/EncDec/LibItsDenm_Encdec.cc +++ b/ccsrc/EncDec/LibItsDenm_Encdec.cc @@ -1,279 +1,257 @@ -#include - -#include "LibItsDenm_EncdecDeclarations.hh" - -#include "denm_codec.hh" -#include "loggers.hh" -#include "uppertester_denm_codec.hh" - -namespace LibItsDenm__EncdecDeclarations { - /**************************************************** - * @desc External function to encode a DenmReq type - * @param value to encode - * @return encoded value - ****************************************************/ - BITSTRING fx__enc__DenmReq(const LibItsDenm__TypesAndValues::DenmReq &p_denmReq) { - loggers::get_instance().log_msg(">>> fx__enc__DenmReq: ", p_denmReq); - - denm_codec codec; - OCTETSTRING os; - if (codec.encode(p_denmReq.msgOut(), os) == -1) { - loggers::get_instance().warning("fx__enc__DenmReq: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - /**************************************************** - * @desc External function to decode a DenmReq type - * @param value to encode - * @return encoded value - ****************************************************/ - INTEGER fx__dec__DenmReq(BITSTRING &b, LibItsDenm__TypesAndValues::DenmReq &p) { - loggers::get_instance().log(">>> fx__dec__DenmReq"); - - denm_codec codec; - DENM__PDU__Descriptions::DENM denm; - OCTETSTRING is = bit2oct(b); - - if (codec.decode(is, denm) == -1) { - loggers::get_instance().warning("fx__dec__DenmReq: -1 result code was returned"); - return -1; - } - p.msgOut() = denm; - - return 0; - } - - INTEGER fx__dec__DenmInd(BITSTRING &b, LibItsDenm__TypesAndValues::DenmInd &p_denmInd) { - loggers::get_instance().log(">>> fx__dec__DenmInd"); - - denm_codec codec; - DENM__PDU__Descriptions::DENM denm; - OCTETSTRING is = bit2oct(b); - - int s = (LibItsDenm__TypesAndValues::DenmInd_gnNextHeader_raw_.fieldlength + LibItsDenm__TypesAndValues::DenmInd_gnHeaderType_raw_.fieldlength + - LibItsDenm__TypesAndValues::DenmInd_gnHeaderSubtype_raw_.fieldlength + LibItsDenm__TypesAndValues::DenmInd_gnLifetime_raw_.fieldlength + - LibItsDenm__TypesAndValues::DenmInd_gnTrafficClass_raw_.fieldlength + LibItsDenm__TypesAndValues::DenmInd_btpDestinationPort_raw_.fieldlength + - LibItsDenm__TypesAndValues::DenmInd_btpInfo_raw_.fieldlength + LibItsDenm__TypesAndValues::DenmInd_ssp_raw_.fieldlength + - LibItsDenm__TypesAndValues::DenmInd_its__aid_raw_.fieldlength) / - 8; - // Decode DEN message - if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), denm) == -1) { - loggers::get_instance().warning("fx__dec__DenmInd: -1 result code was returned"); - return -1; - } - p_denmInd.msgIn() = denm; - // Decode lower layer data - TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); - // gnNextHeader - if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnNextHeader_raw_.fieldlength / 8)) { - p_denmInd.gnNextHeader().set_to_omit(); - } else { - OCTETSTRING os; - os.decode(LibItsDenm__TypesAndValues::DenmInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_denmInd.gnNextHeader() = oct2int(os); - } - loggers::get_instance().log_msg("fx__dec__DENM: gnNextHeader=", p_denmInd.gnNextHeader()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); - // gnHeaderType - if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnHeaderType_raw_.fieldlength / 8)) { - p_denmInd.gnHeaderType().set_to_omit(); - } else { - OCTETSTRING os; - os.decode(LibItsDenm__TypesAndValues::DenmInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_denmInd.gnHeaderType() = oct2int(os); - } - loggers::get_instance().log_msg("fx__dec__DENM: gnHeaderType=", p_denmInd.gnHeaderType()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); - // gnHeaderSubtype - if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnHeaderSubtype_raw_.fieldlength / 8)) { - p_denmInd.gnHeaderSubtype().set_to_omit(); - } else { - OCTETSTRING os; - os.decode(LibItsDenm__TypesAndValues::DenmInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_denmInd.gnHeaderSubtype() = oct2int(os); - } - loggers::get_instance().log_msg("fx__dec__DENM: gnHeaderSubType=", p_denmInd.gnHeaderSubtype()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); - // gnLifetime - if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnLifetime_raw_.fieldlength / 8)) { - p_denmInd.gnLifetime().set_to_omit(); - } else { - OCTETSTRING os; - os.decode(LibItsDenm__TypesAndValues::DenmInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_denmInd.gnLifetime() = oct2int(os); - } - loggers::get_instance().log_msg("fx__dec__DENM: gnLifetime=", p_denmInd.gnLifetime()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); - // gnTrafficClass - if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnTrafficClass_raw_.fieldlength / 8)) { - p_denmInd.gnTrafficClass().set_to_omit(); - } else { - OCTETSTRING os; - os.decode(LibItsDenm__TypesAndValues::DenmInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_denmInd.gnTrafficClass() = oct2int(os); - } - loggers::get_instance().log_msg("fx__dec__DENM: gnTrafficClass=", p_denmInd.gnTrafficClass()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); - // btpDestinationPort - if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_btpDestinationPort_raw_.fieldlength / 8)) { - p_denmInd.btpDestinationPort().set_to_omit(); - } else { - OCTETSTRING os; - os.decode(LibItsDenm__TypesAndValues::DenmInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_denmInd.btpDestinationPort() = oct2int(os); - } - loggers::get_instance().log_msg("fx__dec__DENM: btpDestinationPort=", p_denmInd.btpDestinationPort()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); - // btpInfo - if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_btpInfo_raw_.fieldlength / 8)) { - p_denmInd.btpInfo().set_to_omit(); - } else { - OCTETSTRING os; - os.decode(LibItsDenm__TypesAndValues::DenmInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_denmInd.btpInfo() = oct2int(os); - } - loggers::get_instance().log_msg("fx__dec__DENM: btpInfo=", p_denmInd.btpInfo()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); - // ssp - if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_ssp_raw_.fieldlength / 8)) { - p_denmInd.ssp().set_to_omit(); - } else { - BITSTRING bs; - bs.decode(LibItsDenm__TypesAndValues::DenmInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_denmInd.ssp() = bs; - } - loggers::get_instance().log_msg("fx__dec__DENM: ssp=", p_denmInd.ssp()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); - // its__aid - if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_its__aid_raw_.fieldlength / 8)) { - p_denmInd.its__aid().set_to_omit(); - } else { - OCTETSTRING os; - os.decode(LibItsDenm__TypesAndValues::DenmInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); - p_denmInd.its__aid() = oct2int(os); - } - loggers::get_instance().log_msg("fx__dec__DENM: its_aid=", p_denmInd.its__aid()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); - - return 0; - } - - BITSTRING fx__enc__DENM(const DENM__PDU__Descriptions::DENM &p_denm) { - loggers::get_instance().log_msg(">>> fx__enc__DENM: ", p_denm); - - denm_codec codec; - OCTETSTRING os; - codec.encode(p_denm, os); - return oct2bit(os); - } - - INTEGER fx__dec__DENM(BITSTRING &b, DENM__PDU__Descriptions::DENM &p) { - loggers::get_instance().log(">>> fx__dec__DENM"); - denm_codec codec; - OCTETSTRING is = bit2oct(b); - - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { - loggers::get_instance().warning("fx__dec__DENM: -1 result code was returned"); - return -1; - } - - return 0; - } - - BITSTRING fx__enc__UtDenmInitialize(const LibItsDenm__TypesAndValues::UtDenmInitialize &p_utDenmInitialize) { - loggers::get_instance().log_msg(">>> fx__enc__UtDenmInitialize: ", p_utDenmInitialize); - - uppertester_denm_codec codec; - OCTETSTRING os; - codec.encode(p_utDenmInitialize, os); - return oct2bit(os); - } - - BITSTRING fx__enc__UtDenmChangePosition(const LibItsDenm__TypesAndValues::UtDenmChangePosition &p_utDenmChangePosition) { - loggers::get_instance().log_msg(">>> fx__enc__UtDenmChangePosition: ", p_utDenmChangePosition); - - uppertester_denm_codec codec; - OCTETSTRING os; - codec.encode(p_utDenmChangePosition, os); - return oct2bit(os); - } - - BITSTRING fx__enc__UtDenmChangePseudonym(const LibItsDenm__TypesAndValues::UtDenmChangePseudonym &p_utDenmChangePseudonym) { - loggers::get_instance().log_msg(">>> fx__enc__UtDenmChangePseudonym: ", p_utDenmChangePseudonym); - - uppertester_denm_codec codec; - OCTETSTRING os; - codec.encode((const Record_Type &)p_utDenmChangePseudonym, os); - return oct2bit(os); - } - - BITSTRING fx__enc__UtDenmTrigger(const LibItsDenm__TypesAndValues::UtDenmTrigger &p_utDenmTrigger) { - loggers::get_instance().log_msg(">>> fx__enc__UtDenmTrigger: ", p_utDenmTrigger); - - uppertester_denm_codec codec; - OCTETSTRING os; - codec.encode(p_utDenmTrigger, os); - return oct2bit(os); - } - - BITSTRING fx__enc__UtDenmUpdate(const LibItsDenm__TypesAndValues::UtDenmUpdate &p_utDenmUpdate) { - loggers::get_instance().log_msg(">>> fx__enc__UtDenmUpdate: ", p_utDenmUpdate); - - uppertester_denm_codec codec; - OCTETSTRING os; - codec.encode(p_utDenmUpdate, os); - return oct2bit(os); - } - - BITSTRING fx__enc__UtDenmTermination(const LibItsDenm__TypesAndValues::UtDenmTermination &p_utDenmTermination) { - loggers::get_instance().log_msg(">>> fx__enc__UtDenmTermination: ", p_utDenmTermination); - - uppertester_denm_codec codec; - OCTETSTRING os; - codec.encode(p_utDenmTermination, os); - return oct2bit(os); - } - - /**************************************************** - * @desc External function to decode a UtDenmResults type - * @param value to encode - * @return encoded value - ****************************************************/ - INTEGER fx__dec__UtDenmResults(BITSTRING &b, LibItsDenm__TypesAndValues::UtDenmResults &p) { - loggers::get_instance().log(">>> fx__dec__UtDenmResults"); - - uppertester_denm_codec codec; - OCTETSTRING is = bit2oct(b); - std::unique_ptr ptr = codec.decode(is); - if (ptr == nullptr) { - loggers::get_instance().warning("fx__dec__UtDenmResults: -1 result code was returned"); - return -1; - } - p = static_cast(*ptr); - return 0; - } - - /**************************************************** - * @desc External function to decode a UtDenmEventInd type - * @param value to encode - * @return encoded value - ****************************************************/ - INTEGER fx__dec__UtDenmEventInd(BITSTRING &b, LibItsDenm__TypesAndValues::UtDenmEventInd &p) { - loggers::get_instance().log(">>> fx__dec__UtDenmEventInd"); - - uppertester_denm_codec codec; - OCTETSTRING is = bit2oct(b); - std::unique_ptr ptr = codec.decode(is); - if (ptr == nullptr) { - loggers::get_instance().warning("fx__dec__UtDenmEventInd: -1 result code was returned"); - return -1; - } - p = static_cast(*ptr); - return 0; - } - -} // namespace LibItsDenm__EncdecDeclarations +#include + +#include "LibItsDenm_EncdecDeclarations.hh" + +#include "denm_codec.hh" +#include "loggers.hh" +#include "uppertester_denm_codec.hh" + +namespace LibItsDenm__EncdecDeclarations { + /**************************************************** + * @desc External function to encode a DenmReq type + * @param value to encode + * @return encoded value + ****************************************************/ + BITSTRING fx__enc__DenmReq(const LibItsDenm__TypesAndValues::DenmReq &p_denmReq) { + loggers::get_instance().log_msg(">>> fx__enc__DenmReq: ", p_denmReq); + + denm_codec codec; + OCTETSTRING os; + if (codec.encode(p_denmReq.msgOut(), os) == -1) { + loggers::get_instance().warning("fx__enc__DenmReq: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + /**************************************************** + * @desc External function to decode a DenmReq type + * @param value to encode + * @return encoded value + ****************************************************/ + INTEGER fx__dec__DenmReq(BITSTRING &b, LibItsDenm__TypesAndValues::DenmReq &p) { + loggers::get_instance().log(">>> fx__dec__DenmReq"); + + denm_codec codec; + DENM__PDU__Descriptions::DENM denm; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(is, denm) == -1) { + loggers::get_instance().warning("fx__dec__DenmReq: -1 result code was returned"); + return -1; + } + p.msgOut() = denm; + + return 0; + } + + INTEGER fx__dec__DenmInd(BITSTRING &b, LibItsDenm__TypesAndValues::DenmInd &p_denmInd) { + loggers::get_instance().log(">>> fx__dec__DenmInd"); + + denm_codec codec; + DENM__PDU__Descriptions::DENM denm; + OCTETSTRING is = bit2oct(b); + + int s = (LibItsDenm__TypesAndValues::DenmInd_gnNextHeader_raw_.fieldlength + LibItsDenm__TypesAndValues::DenmInd_gnHeaderType_raw_.fieldlength + + LibItsDenm__TypesAndValues::DenmInd_gnHeaderSubtype_raw_.fieldlength + LibItsDenm__TypesAndValues::DenmInd_gnLifetime_raw_.fieldlength + + LibItsDenm__TypesAndValues::DenmInd_gnTrafficClass_raw_.fieldlength + LibItsDenm__TypesAndValues::DenmInd_btpDestinationPort_raw_.fieldlength + + LibItsDenm__TypesAndValues::DenmInd_btpInfo_raw_.fieldlength + LibItsDenm__TypesAndValues::DenmInd_ssp_raw_.fieldlength + + LibItsDenm__TypesAndValues::DenmInd_its__aid_raw_.fieldlength) / + 8; + // Decode DEN message + if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), denm) == -1) { + loggers::get_instance().warning("fx__dec__DenmInd: -1 result code was returned"); + return -1; + } + p_denmInd.msgIn() = denm; + // Decode lower layer data + TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + // gnNextHeader + if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnNextHeader_raw_.fieldlength / 8)) { + p_denmInd.gnNextHeader().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsDenm__TypesAndValues::DenmInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_denmInd.gnNextHeader() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__DENM: gnNextHeader=", p_denmInd.gnNextHeader()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + // gnHeaderType + if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnHeaderType_raw_.fieldlength / 8)) { + p_denmInd.gnHeaderType().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsDenm__TypesAndValues::DenmInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_denmInd.gnHeaderType() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__DENM: gnHeaderType=", p_denmInd.gnHeaderType()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + // gnHeaderSubtype + if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnHeaderSubtype_raw_.fieldlength / 8)) { + p_denmInd.gnHeaderSubtype().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsDenm__TypesAndValues::DenmInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_denmInd.gnHeaderSubtype() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__DENM: gnHeaderSubType=", p_denmInd.gnHeaderSubtype()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + // gnLifetime + if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnLifetime_raw_.fieldlength / 8)) { + p_denmInd.gnLifetime().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsDenm__TypesAndValues::DenmInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_denmInd.gnLifetime() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__DENM: gnLifetime=", p_denmInd.gnLifetime()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + // gnTrafficClass + if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnTrafficClass_raw_.fieldlength / 8)) { + p_denmInd.gnTrafficClass().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsDenm__TypesAndValues::DenmInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_denmInd.gnTrafficClass() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__DENM: gnTrafficClass=", p_denmInd.gnTrafficClass()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + // btpDestinationPort + if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_btpDestinationPort_raw_.fieldlength / 8)) { + p_denmInd.btpDestinationPort().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsDenm__TypesAndValues::DenmInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_denmInd.btpDestinationPort() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__DENM: btpDestinationPort=", p_denmInd.btpDestinationPort()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + // btpInfo + if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_btpInfo_raw_.fieldlength / 8)) { + p_denmInd.btpInfo().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsDenm__TypesAndValues::DenmInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_denmInd.btpInfo() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__DENM: btpInfo=", p_denmInd.btpInfo()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + // ssp + if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_ssp_raw_.fieldlength / 8)) { + p_denmInd.ssp().set_to_omit(); + } else { + BITSTRING bs; + bs.decode(LibItsDenm__TypesAndValues::DenmInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_denmInd.ssp() = bs; + } + loggers::get_instance().log_msg("fx__dec__DENM: ssp=", p_denmInd.ssp()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + // its__aid + if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_its__aid_raw_.fieldlength / 8)) { + p_denmInd.its__aid().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsDenm__TypesAndValues::DenmInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_denmInd.its__aid() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__DENM: its_aid=", p_denmInd.its__aid()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + + return 0; + } + + BITSTRING fx__enc__UtDenmInitialize(const LibItsDenm__TypesAndValues::UtDenmInitialize &p_utDenmInitialize) { + loggers::get_instance().log_msg(">>> fx__enc__UtDenmInitialize: ", p_utDenmInitialize); + + uppertester_denm_codec codec; + OCTETSTRING os; + codec.encode(p_utDenmInitialize, os); + return oct2bit(os); + } + + BITSTRING fx__enc__UtDenmChangePosition(const LibItsDenm__TypesAndValues::UtDenmChangePosition &p_utDenmChangePosition) { + loggers::get_instance().log_msg(">>> fx__enc__UtDenmChangePosition: ", p_utDenmChangePosition); + + uppertester_denm_codec codec; + OCTETSTRING os; + codec.encode(p_utDenmChangePosition, os); + return oct2bit(os); + } + + BITSTRING fx__enc__UtDenmChangePseudonym(const LibItsDenm__TypesAndValues::UtDenmChangePseudonym &p_utDenmChangePseudonym) { + loggers::get_instance().log_msg(">>> fx__enc__UtDenmChangePseudonym: ", p_utDenmChangePseudonym); + + uppertester_denm_codec codec; + OCTETSTRING os; + codec.encode((const Record_Type &)p_utDenmChangePseudonym, os); + return oct2bit(os); + } + + BITSTRING fx__enc__UtDenmTrigger(const LibItsDenm__TypesAndValues::UtDenmTrigger &p_utDenmTrigger) { + loggers::get_instance().log_msg(">>> fx__enc__UtDenmTrigger: ", p_utDenmTrigger); + + uppertester_denm_codec codec; + OCTETSTRING os; + codec.encode(p_utDenmTrigger, os); + return oct2bit(os); + } + + BITSTRING fx__enc__UtDenmUpdate(const LibItsDenm__TypesAndValues::UtDenmUpdate &p_utDenmUpdate) { + loggers::get_instance().log_msg(">>> fx__enc__UtDenmUpdate: ", p_utDenmUpdate); + + uppertester_denm_codec codec; + OCTETSTRING os; + codec.encode(p_utDenmUpdate, os); + return oct2bit(os); + } + + BITSTRING fx__enc__UtDenmTermination(const LibItsDenm__TypesAndValues::UtDenmTermination &p_utDenmTermination) { + loggers::get_instance().log_msg(">>> fx__enc__UtDenmTermination: ", p_utDenmTermination); + + uppertester_denm_codec codec; + OCTETSTRING os; + codec.encode(p_utDenmTermination, os); + return oct2bit(os); + } + + /**************************************************** + * @desc External function to decode a UtDenmResults type + * @param value to encode + * @return encoded value + ****************************************************/ + INTEGER fx__dec__UtDenmResults(BITSTRING &b, LibItsDenm__TypesAndValues::UtDenmResults &p) { + loggers::get_instance().log(">>> fx__dec__UtDenmResults"); + + uppertester_denm_codec codec; + OCTETSTRING is = bit2oct(b); + std::unique_ptr ptr = codec.decode(is); + if (ptr == nullptr) { + loggers::get_instance().warning("fx__dec__UtDenmResults: -1 result code was returned"); + return -1; + } + p = static_cast(*ptr); + return 0; + } + + /**************************************************** + * @desc External function to decode a UtDenmEventInd type + * @param value to encode + * @return encoded value + ****************************************************/ + INTEGER fx__dec__UtDenmEventInd(BITSTRING &b, LibItsDenm__TypesAndValues::UtDenmEventInd &p) { + loggers::get_instance().log(">>> fx__dec__UtDenmEventInd"); + + uppertester_denm_codec codec; + OCTETSTRING is = bit2oct(b); + std::unique_ptr ptr = codec.decode(is); + if (ptr == nullptr) { + loggers::get_instance().warning("fx__dec__UtDenmEventInd: -1 result code was returned"); + return -1; + } + p = static_cast(*ptr); + return 0; + } + +} // namespace LibItsDenm__EncdecDeclarations diff --git a/ccsrc/EncDec/LibItsEvcsn_Encdec.cc b/ccsrc/EncDec/LibItsEvcsn_Encdec.cc index 36930b8..cc4b045 100644 --- a/ccsrc/EncDec/LibItsEvcsn_Encdec.cc +++ b/ccsrc/EncDec/LibItsEvcsn_Encdec.cc @@ -1,37 +1,37 @@ -#include "LibItsEvcsn_EncdecDeclarations.hh" - -namespace LibItsEvcsn__EncdecDeclarations { - /**************************************************** - * @desc External function to encode a EvcsnReq type - * @param value to encode - * @return encoded value - ****************************************************/ - BITSTRING fx__enc__EvcsnReq(const LibItsEvcsn__TestSystem::EvcsnReq &p) { - // set error behavior - TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); - - TTCN_Buffer TTCN_buf; - TTCN_buf.clear(); - - // encode message in BER (CER variant, but can be any) - p.msgOut().encode(EVCSN__PDU__Descriptions::EvcsnPdu_descr_, TTCN_buf, TTCN_EncDec::CT_BER, BER_ENCODE_CER); - - OCTETSTRING encodedData(TTCN_buf.get_len(), TTCN_buf.get_data()); - - // insert BER2PER recoding here! - - return oct2bit(encodedData); - } - - /**************************************************** - * @desc External function to decode a DenmReq type - * @param value to encode - * @return encoded value - ****************************************************/ - /* TODO RGy function not implemented! (decvalue() not used by test suite @29-06-2016) - INTEGER fx__dec__EvcsnReq(BITSTRING& b, LibItsEvcsn__TestSystem::EvcsnReq& p) - { - return -1; - } - */ -} // namespace LibItsEvcsn__EncdecDeclarations +#include "LibItsEvcsn_EncdecDeclarations.hh" + +namespace LibItsEvcsn__EncdecDeclarations { + /**************************************************** + * @desc External function to encode a EvcsnReq type + * @param value to encode + * @return encoded value + ****************************************************/ + BITSTRING fx__enc__EvcsnReq(const LibItsEvcsn__TestSystem::EvcsnReq &p) { + // set error behavior + TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); + + TTCN_Buffer TTCN_buf; + TTCN_buf.clear(); + + // encode message in BER (CER variant, but can be any) + p.msgOut().encode(EVCSN__PDU__Descriptions::EvcsnPdu_descr_, TTCN_buf, TTCN_EncDec::CT_BER, BER_ENCODE_CER); + + OCTETSTRING encodedData(TTCN_buf.get_len(), TTCN_buf.get_data()); + + // insert BER2PER recoding here! + + return oct2bit(encodedData); + } + + /**************************************************** + * @desc External function to decode a DenmReq type + * @param value to encode + * @return encoded value + ****************************************************/ + /* TODO RGy function not implemented! (decvalue() not used by test suite @29-06-2016) + INTEGER fx__dec__EvcsnReq(BITSTRING& b, LibItsEvcsn__TestSystem::EvcsnReq& p) + { + return -1; + } + */ +} // namespace LibItsEvcsn__EncdecDeclarations diff --git a/ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc b/ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc index a15ee8a..322feac 100644 --- a/ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc +++ b/ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc @@ -1,268 +1,268 @@ -/*! - * \file LibItsGeoNetworking_EncdecDeclarations.cc - * \brief Implementation file for GeoNetworking 'encvalue'/'decvalue'. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#include "LibItsGeoNetworking_EncdecDeclarations.hh" - -#include "geonetworking_codec.hh" -#include "loggers.hh" -#include "uppertester_geonetworking_codec.hh" - -namespace LibItsGeoNetworking__EncdecDeclarations { - - /**************************************************** - * \brief External function to encode a GeoNetworkingReq type - * \param[in] p_geoNetworkingReq The value to encode - * \return encoded value - ****************************************************/ - BITSTRING fx__enc__GeoNetworkingReq(LibItsGeoNetworking__TypesAndValues::GeoNetworkingReq const &p_geoNetworkingReq) { - loggers::get_instance().log_msg(">>> fx__enc__GeoNetworkingReq: ", p_geoNetworkingReq); - - float duration; - std::string tag("fx__enc__GeoNetworkingReq"); - loggers::get_instance().set_start_time(tag); - geonetworking_codec codec; - OCTETSTRING os; - if (codec.encode(p_geoNetworkingReq.msgOut(), os) == -1) { - loggers::get_instance().warning("fx__enc__GeoNetworkingReq: -1 result code was returned"); - return int2bit(0, 1); - } - TTCN_Buffer encoding_buffer(os); - for (int i = 1; i < p_geoNetworkingReq.get_count(); i++) { - loggers::get_instance().log("fx__enc__GeoNetworkingReq: processing %s/%s/%s - %d - %d", p_geoNetworkingReq.fld_name(i), - p_geoNetworkingReq.fld_descr(i)->name, p_geoNetworkingReq.get_at(i)->get_descriptor()->name, - p_geoNetworkingReq.get_at(i)->is_optional(), p_geoNetworkingReq.get_at(i)->is_present()); - if (p_geoNetworkingReq.get_at(i)->is_optional() && p_geoNetworkingReq.get_at(i)->is_present()) { - p_geoNetworkingReq.get_at(i)->get_opt_value()->encode(*p_geoNetworkingReq.fld_descr(i), encoding_buffer, TTCN_EncDec::CT_RAW); - } else { - p_geoNetworkingReq.get_at(i)->encode(*p_geoNetworkingReq.fld_descr(i), encoding_buffer, TTCN_EncDec::CT_RAW); - } - } // End of 'for' statement - loggers::get_instance().set_stop_time(tag, duration); - - return oct2bit(OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())); - } // End of function fx__enc__GeoNetworkingReq - - /**************************************************** - * @desc External function to decode a GeoNetworkingReq type - * @param value to encode - * @return encoded value - ****************************************************/ - - INTEGER fx__dec__GeoNetworkingReq(BITSTRING &b, LibItsGeoNetworking__TypesAndValues::GeoNetworkingReq &p) { - loggers::get_instance().log(">>> fx__dec__GeoNetworkingReq"); - geonetworking_codec codec; - LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu pdu; - OCTETSTRING is = bit2oct(b); - - // Calculate the size of the lower layers information - unsigned int s = (LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd_macDestinationAddress_raw_.fieldlength + - LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd_its__aid_raw_.fieldlength) / - 8; - if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), pdu) == -1) { - loggers::get_instance().warning("fx__dec__GeoNetworkingReq: -1 result code was returned"); - return -1; - } - p.msgOut() = pdu; - TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); - loggers::get_instance().log_to_hexa("fx__dec__GeoNetworkingInd: Lower layer: ", decoding_buffer); - for (int i = 1; i < p.get_count(); i++) { - loggers::get_instance().log("fx__dec__GeoNetworkingReq: processing %s/%s/%s", p.fld_name(i), p.fld_descr(i)->name, p.get_at(i)->get_descriptor()->name); - p.get_at(i)->decode(*p.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); - } // End of 'for' statement - - return 0; - } - - /**************************************************** - * @desc External function to encode a GeoNetworkingInd type - * @param value to encode - * @return encoded value - ****************************************************/ - BITSTRING fx__enc__GeoNetworkingInd(LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd const &p_geoNetworkingInd) { - loggers::get_instance().log_msg(">>> fx__enc__GeoNetworkingInd: ", p_geoNetworkingInd); - - geonetworking_codec codec; - OCTETSTRING os; - if (codec.encode(p_geoNetworkingInd.msgIn(), os) == -1) { - loggers::get_instance().warning("fx__enc__GeoNetworkingInd: -1 result code was returned"); - return int2bit(0, 1); - } - TTCN_Buffer encoding_buffer(os); - for (int i = 1; i < p_geoNetworkingInd.get_count(); i++) { - loggers::get_instance().log("fx__enc__GeoNetworkingInd: processing %s/%s/%s - %d - %d", p_geoNetworkingInd.fld_name(i), - p_geoNetworkingInd.fld_descr(i)->name, p_geoNetworkingInd.get_at(i)->get_descriptor()->name, - p_geoNetworkingInd.get_at(i)->is_optional(), p_geoNetworkingInd.get_at(i)->is_present()); - if (p_geoNetworkingInd.get_at(i)->is_optional() && p_geoNetworkingInd.get_at(i)->is_present()) { - p_geoNetworkingInd.get_at(i)->get_opt_value()->encode(*p_geoNetworkingInd.fld_descr(i), encoding_buffer, TTCN_EncDec::CT_RAW); - } else { - p_geoNetworkingInd.get_at(i)->encode(*p_geoNetworkingInd.fld_descr(i), encoding_buffer, TTCN_EncDec::CT_RAW); - } - } // End of 'for' statement - - return oct2bit(OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())); - } - - /**************************************************** - * @desc External function to decode a GeoNetworkingInd type - * @param value to encode - * @return encoded value - ****************************************************/ - - INTEGER fx__dec__GeoNetworkingInd(BITSTRING &b, LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd &p_geoNetworkingInd) { - loggers::get_instance().log(">>> fx__dec__GeoNetworkingInd"); - - float duration; - std::string tag("fx__dec__GeoNetworkingInd"); - loggers::get_instance().set_start_time(tag); - - geonetworking_codec codec; - LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu pdu; - OCTETSTRING is = bit2oct(b); - - // Calculate the size of the lower layers information - unsigned int s = - (LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd_macDestinationAddress_raw_.fieldlength + - LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd_ssp_raw_.fieldlength + LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd_its__aid_raw_.fieldlength) / - 8; - if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), pdu) == -1) { - loggers::get_instance().warning("fx__dec__GeoNetworkingInd: -1 result code was returned"); - return -1; - } - p_geoNetworkingInd.msgIn() = pdu; - TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); - loggers::get_instance().log_to_hexa("fx__dec__GeoNetworkingInd: Lower layer: ", decoding_buffer); - for (int i = 1; i < p_geoNetworkingInd.get_count(); i++) { - loggers::get_instance().log("fx__dec__GeoNetworkingInd: processing %s/%s/%s - %d - %d", p_geoNetworkingInd.fld_name(i), - p_geoNetworkingInd.fld_descr(i)->name, p_geoNetworkingInd.get_at(i)->get_descriptor()->name, - p_geoNetworkingInd.get_at(i)->is_optional(), p_geoNetworkingInd.get_at(i)->is_present()); - if (p_geoNetworkingInd.get_at(i)->is_optional()) { - loggers::get_instance().log("fx__dec__GeoNetworkingInd: Bytes remaining: %d - field lenth: %d", decoding_buffer.get_len() - decoding_buffer.get_pos(), - p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8); - if (std::string(p_geoNetworkingInd.fld_name(i)).compare("ssp") == 0) { - if ((decoding_buffer.get_len() - decoding_buffer.get_pos()) >= (unsigned int)p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8) { - loggers::get_instance().log("fx__dec__GeoNetworkingInd: decoding %s", p_geoNetworkingInd.fld_descr(i)->name); - BITSTRING ssp; - ssp.decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); - loggers::get_instance().log_msg("fx__dec__GeoNetworkingInd: ssp=", ssp); - dynamic_cast &>(*p_geoNetworkingInd.get_at(i)) = OPTIONAL(ssp); - } else { - loggers::get_instance().log("fx__dec__GeoNetworkingInd: set %s to omit", p_geoNetworkingInd.fld_descr(i)->name); - dynamic_cast &>(*p_geoNetworkingInd.get_at(i)).set_to_omit(); - } - } else if (std::string(p_geoNetworkingInd.fld_name(i)).compare("its_aid") == 0) { - loggers::get_instance().log("fx__dec__GeoNetworkingInd: Bytes remaining: %d - its_aid lenth: %d", - decoding_buffer.get_len() - decoding_buffer.get_pos(), p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8); - if ((decoding_buffer.get_len() - decoding_buffer.get_pos()) >= (unsigned int)p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8) { - INTEGER its_aid; - its_aid.decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); - loggers::get_instance().log_msg("fx__dec__GeoNetworkingInd: its_aid=", its_aid); - dynamic_cast &>(*p_geoNetworkingInd.get_at(i)) = OPTIONAL(its_aid); - } else { - loggers::get_instance().log("fx__dec__GeoNetworkingInd: set %s to omit", p_geoNetworkingInd.fld_descr(i)->name); - dynamic_cast &>(*p_geoNetworkingInd.get_at(i)).set_to_omit(); - } - } else { - loggers::get_instance().log("fx__dec__GeoNetworkingInd(1): decoding %s", p_geoNetworkingInd.fld_descr(i)->name); - p_geoNetworkingInd.get_at(i)->decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); - } - } else { - loggers::get_instance().log("fx__dec__GeoNetworkingInd(2): decoding %s", p_geoNetworkingInd.fld_descr(i)->name); - p_geoNetworkingInd.get_at(i)->decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); - } - } // End of 'for' statement - loggers::get_instance().set_stop_time(tag, duration); - - loggers::get_instance().log_msg("<<< fx__dec__GeoNetworkingInd: ", p_geoNetworkingInd); - return 0; - } - - /**************************************************** - * @desc External function to encode a GeoNetworkingPdu type - * @param value to encode - * @return encoded value - ****************************************************/ - BITSTRING fx__enc__GeoNetworkingPdu(LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu const &p_geoNetworkingPdu) { - loggers::get_instance().log_msg(">>> fx__enc__GeoNetworkingPdu: ", p_geoNetworkingPdu); - - geonetworking_codec codec; - OCTETSTRING os; - codec.encode(p_geoNetworkingPdu, os); - return oct2bit(os); - } - - /**************************************************** - * @desc External function to decode a GeoNetworkingPdu type - * @param value to encode - * @return encoded value - ****************************************************/ - - INTEGER fx__dec__GeoNetworkingPdu(BITSTRING &b, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu &p) { - loggers::get_instance().log(">>> fx__dec__GeoNetworkingPdu"); - geonetworking_codec codec; - OCTETSTRING is = bit2oct(b); - - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { - loggers::get_instance().warning("fx__dec__GeoNetworkingPdu: -1 result code was returned"); - return -1; - } - - return 0; - } - - /**************************************************** - * @desc External function to encode a GnNonSecuredPacket type - * @param value to encode - * @return encoded value - ****************************************************/ - BITSTRING fx__enc__GnNonSecuredPacket(const LibItsGeoNetworking__TypesAndValues::GnNonSecuredPacket &p_gnNonSecuredPacket) { - loggers::get_instance().log_msg(">>> fx__enc__GnNonSecuredPacket: ", p_gnNonSecuredPacket); - - geonetworking_codec codec; - OCTETSTRING os; - codec.encode(p_gnNonSecuredPacket, os); - return oct2bit(os); - } - - /**************************************************** - * @desc External function to decode a GnNonSecuredPacket type - * @param value to encode - * @return encoded value - ****************************************************/ - - INTEGER fx__dec__GnNonSecuredPacket(BITSTRING &b, LibItsGeoNetworking__TypesAndValues::GnNonSecuredPacket &p) { return -1; } - - BITSTRING fx__enc__UtGnInitialize(const LibItsGeoNetworking__TypesAndValues::UtGnInitialize &p_utGnInitialize) { - loggers::get_instance().log_msg(">>> fx__enc__UtGnInitialize: ", p_utGnInitialize); - - uppertester_geonetworking_codec codec; - OCTETSTRING os; - codec.encode(p_utGnInitialize, os); - return oct2bit(os); - } - - BITSTRING fx__enc__UtGnChangePosition(const LibItsGeoNetworking__TypesAndValues::UtGnChangePosition &p_utGnChangePosition) { - loggers::get_instance().log_msg(">>> fx__enc__UtGnChangePosition: ", p_utGnChangePosition); - - uppertester_geonetworking_codec codec; - OCTETSTRING os; - codec.encode(p_utGnChangePosition, os); - return oct2bit(os); - } - - BITSTRING fx__enc__UtGnTrigger(const LibItsGeoNetworking__TypesAndValues::UtGnTrigger &p_utGnTrigger) { - loggers::get_instance().log_msg(">>> fx__enc__UtGnTrigger: ", p_utGnTrigger); - - uppertester_geonetworking_codec codec; - OCTETSTRING os; - codec.encode(p_utGnTrigger, os); - return oct2bit(os); - } - -} // namespace LibItsGeoNetworking__EncdecDeclarations +/*! + * \file LibItsGeoNetworking_EncdecDeclarations.cc + * \brief Implementation file for GeoNetworking 'encvalue'/'decvalue'. + * \author ETSI STF525 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ +#include "LibItsGeoNetworking_EncdecDeclarations.hh" + +#include "geonetworking_codec.hh" +#include "loggers.hh" +#include "uppertester_geonetworking_codec.hh" + +namespace LibItsGeoNetworking__EncdecDeclarations { + + /**************************************************** + * \brief External function to encode a GeoNetworkingReq type + * \param[in] p_geoNetworkingReq The value to encode + * \return encoded value + ****************************************************/ + BITSTRING fx__enc__GeoNetworkingReq(LibItsGeoNetworking__TypesAndValues::GeoNetworkingReq const &p_geoNetworkingReq) { + loggers::get_instance().log_msg(">>> fx__enc__GeoNetworkingReq: ", p_geoNetworkingReq); + + float duration; + std::string tag("fx__enc__GeoNetworkingReq"); + loggers::get_instance().set_start_time(tag); + geonetworking_codec codec; + OCTETSTRING os; + if (codec.encode(p_geoNetworkingReq.msgOut(), os) == -1) { + loggers::get_instance().warning("fx__enc__GeoNetworkingReq: -1 result code was returned"); + return int2bit(0, 1); + } + TTCN_Buffer encoding_buffer(os); + for (int i = 1; i < p_geoNetworkingReq.get_count(); i++) { + loggers::get_instance().log("fx__enc__GeoNetworkingReq: processing %s/%s/%s - %d - %d", p_geoNetworkingReq.fld_name(i), + p_geoNetworkingReq.fld_descr(i)->name, p_geoNetworkingReq.get_at(i)->get_descriptor()->name, + p_geoNetworkingReq.get_at(i)->is_optional(), p_geoNetworkingReq.get_at(i)->is_present()); + if (p_geoNetworkingReq.get_at(i)->is_optional() && p_geoNetworkingReq.get_at(i)->is_present()) { + p_geoNetworkingReq.get_at(i)->get_opt_value()->encode(*p_geoNetworkingReq.fld_descr(i), encoding_buffer, TTCN_EncDec::CT_RAW); + } else { + p_geoNetworkingReq.get_at(i)->encode(*p_geoNetworkingReq.fld_descr(i), encoding_buffer, TTCN_EncDec::CT_RAW); + } + } // End of 'for' statement + loggers::get_instance().set_stop_time(tag, duration); + + return oct2bit(OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())); + } // End of function fx__enc__GeoNetworkingReq + + /**************************************************** + * @desc External function to decode a GeoNetworkingReq type + * @param value to encode + * @return encoded value + ****************************************************/ + + INTEGER fx__dec__GeoNetworkingReq(BITSTRING &b, LibItsGeoNetworking__TypesAndValues::GeoNetworkingReq &p) { + loggers::get_instance().log(">>> fx__dec__GeoNetworkingReq"); + geonetworking_codec codec; + LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu pdu; + OCTETSTRING is = bit2oct(b); + + // Calculate the size of the lower layers information + unsigned int s = (LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd_macDestinationAddress_raw_.fieldlength + + LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd_its__aid_raw_.fieldlength) / + 8; + if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), pdu) == -1) { + loggers::get_instance().warning("fx__dec__GeoNetworkingReq: -1 result code was returned"); + return -1; + } + p.msgOut() = pdu; + TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); + loggers::get_instance().log_to_hexa("fx__dec__GeoNetworkingInd: Lower layer: ", decoding_buffer); + for (int i = 1; i < p.get_count(); i++) { + loggers::get_instance().log("fx__dec__GeoNetworkingReq: processing %s/%s/%s", p.fld_name(i), p.fld_descr(i)->name, p.get_at(i)->get_descriptor()->name); + p.get_at(i)->decode(*p.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); + } // End of 'for' statement + + return 0; + } + + /**************************************************** + * @desc External function to encode a GeoNetworkingInd type + * @param value to encode + * @return encoded value + ****************************************************/ + BITSTRING fx__enc__GeoNetworkingInd(LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd const &p_geoNetworkingInd) { + loggers::get_instance().log_msg(">>> fx__enc__GeoNetworkingInd: ", p_geoNetworkingInd); + + geonetworking_codec codec; + OCTETSTRING os; + if (codec.encode(p_geoNetworkingInd.msgIn(), os) == -1) { + loggers::get_instance().warning("fx__enc__GeoNetworkingInd: -1 result code was returned"); + return int2bit(0, 1); + } + TTCN_Buffer encoding_buffer(os); + for (int i = 1; i < p_geoNetworkingInd.get_count(); i++) { + loggers::get_instance().log("fx__enc__GeoNetworkingInd: processing %s/%s/%s - %d - %d", p_geoNetworkingInd.fld_name(i), + p_geoNetworkingInd.fld_descr(i)->name, p_geoNetworkingInd.get_at(i)->get_descriptor()->name, + p_geoNetworkingInd.get_at(i)->is_optional(), p_geoNetworkingInd.get_at(i)->is_present()); + if (p_geoNetworkingInd.get_at(i)->is_optional() && p_geoNetworkingInd.get_at(i)->is_present()) { + p_geoNetworkingInd.get_at(i)->get_opt_value()->encode(*p_geoNetworkingInd.fld_descr(i), encoding_buffer, TTCN_EncDec::CT_RAW); + } else { + p_geoNetworkingInd.get_at(i)->encode(*p_geoNetworkingInd.fld_descr(i), encoding_buffer, TTCN_EncDec::CT_RAW); + } + } // End of 'for' statement + + return oct2bit(OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())); + } + + /**************************************************** + * @desc External function to decode a GeoNetworkingInd type + * @param value to encode + * @return encoded value + ****************************************************/ + + INTEGER fx__dec__GeoNetworkingInd(BITSTRING &b, LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd &p_geoNetworkingInd) { + loggers::get_instance().log(">>> fx__dec__GeoNetworkingInd"); + + float duration; + std::string tag("fx__dec__GeoNetworkingInd"); + loggers::get_instance().set_start_time(tag); + + geonetworking_codec codec; + LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu pdu; + OCTETSTRING is = bit2oct(b); + + // Calculate the size of the lower layers information + unsigned int s = + (LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd_macDestinationAddress_raw_.fieldlength + + LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd_ssp_raw_.fieldlength + LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd_its__aid_raw_.fieldlength) / + 8; + if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), pdu) == -1) { + loggers::get_instance().warning("fx__dec__GeoNetworkingInd: -1 result code was returned"); + return -1; + } + p_geoNetworkingInd.msgIn() = pdu; + TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); + loggers::get_instance().log_to_hexa("fx__dec__GeoNetworkingInd: Lower layer: ", decoding_buffer); + for (int i = 1; i < p_geoNetworkingInd.get_count(); i++) { + loggers::get_instance().log("fx__dec__GeoNetworkingInd: processing %s/%s/%s - %d - %d", p_geoNetworkingInd.fld_name(i), + p_geoNetworkingInd.fld_descr(i)->name, p_geoNetworkingInd.get_at(i)->get_descriptor()->name, + p_geoNetworkingInd.get_at(i)->is_optional(), p_geoNetworkingInd.get_at(i)->is_present()); + if (p_geoNetworkingInd.get_at(i)->is_optional()) { + loggers::get_instance().log("fx__dec__GeoNetworkingInd: Bytes remaining: %d - field lenth: %d", decoding_buffer.get_len() - decoding_buffer.get_pos(), + p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8); + if (std::string(p_geoNetworkingInd.fld_name(i)).compare("ssp") == 0) { + if ((decoding_buffer.get_len() - decoding_buffer.get_pos()) >= (unsigned int)p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8) { + loggers::get_instance().log("fx__dec__GeoNetworkingInd: decoding %s", p_geoNetworkingInd.fld_descr(i)->name); + BITSTRING ssp; + ssp.decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); + loggers::get_instance().log_msg("fx__dec__GeoNetworkingInd: ssp=", ssp); + dynamic_cast &>(*p_geoNetworkingInd.get_at(i)) = OPTIONAL(ssp); + } else { + loggers::get_instance().log("fx__dec__GeoNetworkingInd: set %s to omit", p_geoNetworkingInd.fld_descr(i)->name); + dynamic_cast &>(*p_geoNetworkingInd.get_at(i)).set_to_omit(); + } + } else if (std::string(p_geoNetworkingInd.fld_name(i)).compare("its_aid") == 0) { + loggers::get_instance().log("fx__dec__GeoNetworkingInd: Bytes remaining: %d - its_aid lenth: %d", + decoding_buffer.get_len() - decoding_buffer.get_pos(), p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8); + if ((decoding_buffer.get_len() - decoding_buffer.get_pos()) >= (unsigned int)p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8) { + INTEGER its_aid; + its_aid.decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); + loggers::get_instance().log_msg("fx__dec__GeoNetworkingInd: its_aid=", its_aid); + dynamic_cast &>(*p_geoNetworkingInd.get_at(i)) = OPTIONAL(its_aid); + } else { + loggers::get_instance().log("fx__dec__GeoNetworkingInd: set %s to omit", p_geoNetworkingInd.fld_descr(i)->name); + dynamic_cast &>(*p_geoNetworkingInd.get_at(i)).set_to_omit(); + } + } else { + loggers::get_instance().log("fx__dec__GeoNetworkingInd(1): decoding %s", p_geoNetworkingInd.fld_descr(i)->name); + p_geoNetworkingInd.get_at(i)->decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); + } + } else { + loggers::get_instance().log("fx__dec__GeoNetworkingInd(2): decoding %s", p_geoNetworkingInd.fld_descr(i)->name); + p_geoNetworkingInd.get_at(i)->decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); + } + } // End of 'for' statement + loggers::get_instance().set_stop_time(tag, duration); + + loggers::get_instance().log_msg("<<< fx__dec__GeoNetworkingInd: ", p_geoNetworkingInd); + return 0; + } + + /**************************************************** + * @desc External function to encode a GeoNetworkingPdu type + * @param value to encode + * @return encoded value + ****************************************************/ + BITSTRING fx__enc__GeoNetworkingPdu(LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu const &p_geoNetworkingPdu) { + loggers::get_instance().log_msg(">>> fx__enc__GeoNetworkingPdu: ", p_geoNetworkingPdu); + + geonetworking_codec codec; + OCTETSTRING os; + codec.encode(p_geoNetworkingPdu, os); + return oct2bit(os); + } + + /**************************************************** + * @desc External function to decode a GeoNetworkingPdu type + * @param value to encode + * @return encoded value + ****************************************************/ + + INTEGER fx__dec__GeoNetworkingPdu(BITSTRING &b, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu &p) { + loggers::get_instance().log(">>> fx__dec__GeoNetworkingPdu"); + geonetworking_codec codec; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + loggers::get_instance().warning("fx__dec__GeoNetworkingPdu: -1 result code was returned"); + return -1; + } + + return 0; + } + + /**************************************************** + * @desc External function to encode a GnNonSecuredPacket type + * @param value to encode + * @return encoded value + ****************************************************/ + BITSTRING fx__enc__GnNonSecuredPacket(const LibItsGeoNetworking__TypesAndValues::GnNonSecuredPacket &p_gnNonSecuredPacket) { + loggers::get_instance().log_msg(">>> fx__enc__GnNonSecuredPacket: ", p_gnNonSecuredPacket); + + geonetworking_codec codec; + OCTETSTRING os; + codec.encode(p_gnNonSecuredPacket, os); + return oct2bit(os); + } + + /**************************************************** + * @desc External function to decode a GnNonSecuredPacket type + * @param value to encode + * @return encoded value + ****************************************************/ + + INTEGER fx__dec__GnNonSecuredPacket(BITSTRING &b, LibItsGeoNetworking__TypesAndValues::GnNonSecuredPacket &p) { return -1; } + + BITSTRING fx__enc__UtGnInitialize(const LibItsGeoNetworking__TypesAndValues::UtGnInitialize &p_utGnInitialize) { + loggers::get_instance().log_msg(">>> fx__enc__UtGnInitialize: ", p_utGnInitialize); + + uppertester_geonetworking_codec codec; + OCTETSTRING os; + codec.encode(p_utGnInitialize, os); + return oct2bit(os); + } + + BITSTRING fx__enc__UtGnChangePosition(const LibItsGeoNetworking__TypesAndValues::UtGnChangePosition &p_utGnChangePosition) { + loggers::get_instance().log_msg(">>> fx__enc__UtGnChangePosition: ", p_utGnChangePosition); + + uppertester_geonetworking_codec codec; + OCTETSTRING os; + codec.encode(p_utGnChangePosition, os); + return oct2bit(os); + } + + BITSTRING fx__enc__UtGnTrigger(const LibItsGeoNetworking__TypesAndValues::UtGnTrigger &p_utGnTrigger) { + loggers::get_instance().log_msg(">>> fx__enc__UtGnTrigger: ", p_utGnTrigger); + + uppertester_geonetworking_codec codec; + OCTETSTRING os; + codec.encode(p_utGnTrigger, os); + return oct2bit(os); + } + +} // namespace LibItsGeoNetworking__EncdecDeclarations diff --git a/ccsrc/EncDec/LibItsIpv6OverGeoNetworking_Encdec.cc b/ccsrc/EncDec/LibItsIpv6OverGeoNetworking_Encdec.cc index 63728d1..4b172ba 100644 --- a/ccsrc/EncDec/LibItsIpv6OverGeoNetworking_Encdec.cc +++ b/ccsrc/EncDec/LibItsIpv6OverGeoNetworking_Encdec.cc @@ -1,20 +1,20 @@ -#include "LibItsIpv6OverGeoNetworking_EncdecDeclarations.hh" - -namespace LibItsIpv6OverGeoNetworking__EncdecDeclarations { - - /**************************************************** - * @desc External function to encode a Ipv6Packet type - * @param value to encode - * @return encoded value - ****************************************************/ - BITSTRING fx__enc__Ipv6Packet(const LibItsIpv6OverGeoNetworking__TypesAndValues::Ipv6Packet &p) { return int2bit(0, 8); } - - /**************************************************** - * @desc External function to decode a Ipv6Packet type - * @param value to encode - * @return encoded value - ****************************************************/ - - INTEGER fx__dec__Ipv6Packet(BITSTRING &b, LibItsIpv6OverGeoNetworking__TypesAndValues::Ipv6Packet &p) { return -1; } - -} // namespace LibItsIpv6OverGeoNetworking__EncdecDeclarations +#include "LibItsIpv6OverGeoNetworking_EncdecDeclarations.hh" + +namespace LibItsIpv6OverGeoNetworking__EncdecDeclarations { + + /**************************************************** + * @desc External function to encode a Ipv6Packet type + * @param value to encode + * @return encoded value + ****************************************************/ + BITSTRING fx__enc__Ipv6Packet(const LibItsIpv6OverGeoNetworking__TypesAndValues::Ipv6Packet &p) { return int2bit(0, 8); } + + /**************************************************** + * @desc External function to decode a Ipv6Packet type + * @param value to encode + * @return encoded value + ****************************************************/ + + INTEGER fx__dec__Ipv6Packet(BITSTRING &b, LibItsIpv6OverGeoNetworking__TypesAndValues::Ipv6Packet &p) { return -1; } + +} // namespace LibItsIpv6OverGeoNetworking__EncdecDeclarations diff --git a/ccsrc/EncDec/LibItsIvim_Encdec.cc b/ccsrc/EncDec/LibItsIvim_Encdec.cc index 35c8572..7648d2c 100644 --- a/ccsrc/EncDec/LibItsIvim_Encdec.cc +++ b/ccsrc/EncDec/LibItsIvim_Encdec.cc @@ -163,28 +163,6 @@ namespace LibItsIvim__EncdecDeclarations { return 0; } - BITSTRING fx__enc__IVIM(const IVIM__PDU__Descriptions::IVIM &p_ivim) { - loggers::get_instance().log_msg(">>> fx__enc__IVIM: ", p_ivim); - - ivim_codec codec; - OCTETSTRING os; - codec.encode(p_ivim, os); - return oct2bit(os); - } - - INTEGER fx__dec__IVIM(BITSTRING &b, IVIM__PDU__Descriptions::IVIM &p) { - loggers::get_instance().log(">>> fx__dec__IVIM"); - ivim_codec codec; - OCTETSTRING is = bit2oct(b); - - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { - loggers::get_instance().warning("fx__dec__IVIM: -1 result code was returned"); - return -1; - } - - return 0; - } - BITSTRING fx__enc__UtIvimInitialize(const LibItsIvim__TypesAndValues::UtIvimInitialize &p_utIvimInitialize) { loggers::get_instance().log_msg(">>> fx__enc__UtIvimInitialize: ", p_utIvimInitialize); diff --git a/ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc b/ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc index 737ab2d..3307136 100644 --- a/ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc +++ b/ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc @@ -164,28 +164,6 @@ namespace LibItsMapemSpatem__EncdecDeclarations { return 0; } - BITSTRING fx__enc__MAPEM(const MAPEM__PDU__Descriptions::MAPEM &p_mapem) { - loggers::get_instance().log_msg(">>> fx__enc__Mapem: ", p_mapem); - - mapem_codec codec; - OCTETSTRING os; - codec.encode(p_mapem, os); - return oct2bit(os); - } - - INTEGER fx__dec__MAPEM(BITSTRING &b, MAPEM__PDU__Descriptions::MAPEM &p) { - loggers::get_instance().log(">>> fx__dec__Mapem"); - mapem_codec codec; - OCTETSTRING is = bit2oct(b); - - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { - loggers::get_instance().warning("fx__dec__Mapem: -1 result code was returned"); - return -1; - } - - return 0; - } - /**************************************************** * @desc External function to encode a SpatemReq type * @param value to encode @@ -342,29 +320,6 @@ namespace LibItsMapemSpatem__EncdecDeclarations { return 0; } - BITSTRING fx__enc__SPATEM(const SPATEM__PDU__Descriptions::SPATEM &p_spatem) { - loggers::get_instance().log_msg(">>> fx__enc__Spatem: ", p_spatem); - - spatem_codec codec; - OCTETSTRING os; - codec.encode(p_spatem, os); - return oct2bit(os); - } - - INTEGER fx__dec__SPATEM(BITSTRING &b, SPATEM__PDU__Descriptions::SPATEM &p_spatem) { - loggers::get_instance().log(">>> fx__dec__Spatem"); - - spatem_codec codec; - OCTETSTRING is = bit2oct(b); - - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p_spatem) == -1) { - loggers::get_instance().warning("fx__dec__Spatem: -1 result code was returned"); - return -1; - } - - return 0; - } - BITSTRING fx__enc__UtMapemSpatemInitialize(const LibItsMapemSpatem__TypesAndValues::UtMapemSpatemInitialize &p_utMapemSpatemInitialize) { loggers::get_instance().log_msg(">>> fx__enc__UtMapemSpatemInitialize: ", p_utMapemSpatemInitialize); diff --git a/ccsrc/EncDec/LibItsMbr_Encdec.cc b/ccsrc/EncDec/LibItsMbr_Encdec.cc index 084f3e0..e986538 100644 --- a/ccsrc/EncDec/LibItsMbr_Encdec.cc +++ b/ccsrc/EncDec/LibItsMbr_Encdec.cc @@ -1,36 +1,36 @@ -#include "LibItsMbr_EncdecDeclarations.hh" - -#include "etsi_ts103759_data_codec.hh" - -#include "loggers.hh" - -namespace LibItsMbr__EncdecDeclarations { - - BITSTRING fx__enc__EtsiTs103759Data(const EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_103759_data) { - loggers::get_instance().log_msg(">>> fx__enc__EtsiTs103759Data: ", p_etsi_ts_103759_data); - - etsi_ts103759_data_codec codec; - OCTETSTRING os; - if (codec.encode(p_etsi_ts_103759_data, os) == -1) { - loggers::get_instance().warning("fx__enc__EtsiTs103759Data: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__EtsiTs103759Data(BITSTRING &b, EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_103759_data) { - loggers::get_instance().log_msg(">>> fx__dec__EtsiTs103759Data: ", b); - - etsi_ts103759_data_codec codec; - OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_etsi_ts_103759_data) == -1) { - loggers::get_instance().warning("fx__dec__EtsiTs103759Data: -1 result code was returned"); - return -1; - } - - return 0; - } - - -} // End of namespace LibItsMbr__EncdecDeclarations +// #include "LibItsMbr_EncdecDeclarations.hh" + +// #include "etsi_ts103759_data_codec.hh" + +// #include "loggers.hh" + +// namespace LibItsMbr__EncdecDeclarations { + +// BITSTRING fx__enc__EtsiTs103759Data(const EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_103759_data) { +// loggers::get_instance().log_msg(">>> fx__enc__EtsiTs103759Data: ", p_etsi_ts_103759_data); + +// etsi_ts103759_data_codec codec; +// OCTETSTRING os; +// if (codec.encode(p_etsi_ts_103759_data, os) == -1) { +// loggers::get_instance().warning("fx__enc__EtsiTs103759Data: -1 result code was returned"); +// return int2bit(0, 1); +// } + +// return oct2bit(os); +// } + +// INTEGER fx__dec__EtsiTs103759Data(BITSTRING &b, EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_103759_data) { +// loggers::get_instance().log_msg(">>> fx__dec__EtsiTs103759Data: ", b); + +// etsi_ts103759_data_codec codec; +// OCTETSTRING is = bit2oct(b); +// if (codec.decode(is, p_etsi_ts_103759_data) == -1) { +// loggers::get_instance().warning("fx__dec__EtsiTs103759Data: -1 result code was returned"); +// return -1; +// } + +// return 0; +// } + + +// } // End of namespace LibItsMbr__EncdecDeclarations diff --git a/ccsrc/EncDec/LibItsPki_Encdec.cc b/ccsrc/EncDec/LibItsPki_Encdec.cc index 90391c8..7ccda75 100644 --- a/ccsrc/EncDec/LibItsPki_Encdec.cc +++ b/ccsrc/EncDec/LibItsPki_Encdec.cc @@ -1,384 +1,371 @@ -#include "LibItsPki_EncdecDeclarations.hh" - -#include "etsi_ts102941_base_types_public_keys.hh" -#include "etsi_ts102941_data_codec.hh" -#include "etsi_ts102941_data_content_codec.hh" -#include "etsi_ts102941_types_authorization_inner_request.hh" -#include "etsi_ts102941_types_authorization_inner_response.hh" -#include "etsi_ts102941_types_authorization_shared_at_request.hh" -#include "etsi_ts102941_types_authorization_validation_request.hh" -#include "etsi_ts102941_types_authorization_validation_response.hh" -#include "etsi_ts102941_types_enrolment_inner_request.hh" -#include "etsi_ts102941_types_enrolment_inner_response.hh" -#include "ieee_1609dot2_base_types_public_encryption_key.hh" -#include "ieee_1609dot2_base_types_public_verification_key.hh" - -#include "etsi_ts102941_trust_lists_ctl_format.hh" - -#include "loggers.hh" - -//#include "cam_pdu_codec.hh" -//#include "codec.hh" - -namespace LibItsPki__EncdecDeclarations { - - /*BITSTRING fx__enc__CAM(const CAM__PDU__Descriptions::CAM &p_cam) { - cam_pdu_codec asn_codec; - BITSTRING b; - int rc = asn_codec.encode(p_cam, b); - if (rc) { - return b; - } - return int2bit(0, 1); - }*/ - - BITSTRING fx__enc__EtsiTs102941Data(const EtsiTs102941MessagesCa::EtsiTs102941Data &p_etsi_ts_102941_data) { - loggers::get_instance().log_msg(">>> fx__enc__EtsiTs102941Data: ", p_etsi_ts_102941_data); - - etsi_ts102941_data_codec codec; - OCTETSTRING os; - if (codec.encode(p_etsi_ts_102941_data, os) == -1) { - loggers::get_instance().warning("fx__enc__EtsiTs102941Data: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__EtsiTs102941Data(BITSTRING &b, EtsiTs102941MessagesCa::EtsiTs102941Data &p_etsi_ts_102941_data) { - loggers::get_instance().log_msg(">>> fx__dec__EtsiTs102941Data: ", b); - - etsi_ts102941_data_codec codec; - OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_etsi_ts_102941_data) == -1) { - loggers::get_instance().warning("fx__dec__EtsiTs102941Data: -1 result code was returned"); - return -1; - } - - return 0; - } - - BITSTRING fx__enc__EtsiTs102941DataContent(const EtsiTs102941MessagesCa::EtsiTs102941DataContent &p_etsi_ts_102941_data_content) { - loggers::get_instance().log_msg(">>> fx__enc__EtsiTs102941DataContent: ", p_etsi_ts_102941_data_content); - - etsi_ts102941_data_content_codec codec; - OCTETSTRING os; - if (codec.encode(p_etsi_ts_102941_data_content, os) == -1) { - loggers::get_instance().warning("fx__enc__EtsiTs102941DataContent: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__EtsiTs102941DataContent(BITSTRING &b, EtsiTs102941MessagesCa::EtsiTs102941DataContent &p_etsi_ts_102941_data_content) { - loggers::get_instance().log_msg(">>> fx__dec__EtsiTs102941DataContent: ", b); - - etsi_ts102941_data_content_codec codec; - OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_etsi_ts_102941_data_content) == -1) { - loggers::get_instance().warning("fx__dec__EtsiTs102941DataContent: -1 result code was returned"); - return -1; - } - - return 0; - } - - BITSTRING fx__enc__InnerEcRequest(const EtsiTs102941TypesEnrolment::InnerEcRequest &p_inner_request) { - loggers::get_instance().log_msg(">>> fx_enc_InnerEcRequest: ", p_inner_request); - - etsi_ts102941_types_enrolment_inner_request codec; - OCTETSTRING os; - if (codec.encode(p_inner_request, os) == -1) { - loggers::get_instance().warning("fx_enc_InnerEcRequest: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__InnerEcRequest(BITSTRING &b, EtsiTs102941TypesEnrolment::InnerEcRequest &p_inner_request) { - loggers::get_instance().log_msg(">>> fx__dec__InnerEcRequest: ", b); - - etsi_ts102941_types_enrolment_inner_request codec; - OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_inner_request) == -1) { - loggers::get_instance().warning("fx__dec__InnerEcRequest: -1 result code was returned"); - return -1; - } - - loggers::get_instance().log_msg("<<< fx__dec__InnerEcRequest: ", p_inner_request); - return 0; - } - - BITSTRING fx__enc__InnerEcResponse(const EtsiTs102941TypesEnrolment::InnerEcResponse &p_inner_response) { - loggers::get_instance().log_msg(">>> fx__enc__InnerEcResponse: ", p_inner_response); - - etsi_ts102941_types_enrolment_inner_response codec; - OCTETSTRING os; - if (codec.encode(p_inner_response, os) == -1) { - loggers::get_instance().warning("fx__enc__InnerEcResponse: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__InnerEcResponse(BITSTRING &b, EtsiTs102941TypesEnrolment::InnerEcResponse &p_inner_response) { - loggers::get_instance().log_msg(">>> fx__dec__InnerEcResponse: ", b); - - etsi_ts102941_types_enrolment_inner_response codec; - OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_inner_response) == -1) { - loggers::get_instance().warning("fx__dec__InnerEcResponse: -1 result code was returned"); - return -1; - } - - loggers::get_instance().log_msg("<<< fx__dec__InnerEcResponse: ", p_inner_response); - return 0; - } - - BITSTRING fx__enc__InnerAtRequest(const EtsiTs102941TypesAuthorization::InnerAtRequest &p_inner_request) { - loggers::get_instance().log_msg(">>> fx_enc_InnerAtRequest: ", p_inner_request); - - etsi_ts102941_types_authorization_inner_request codec; - OCTETSTRING os; - if (codec.encode(p_inner_request, os) == -1) { - loggers::get_instance().warning("fx_enc_InnerAtRequest: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__InnerAtRequest(BITSTRING &b, EtsiTs102941TypesAuthorization::InnerAtRequest &p_inner_request) { - loggers::get_instance().log_msg(">>> fx__dec__InnerAtRequest: ", b); - - etsi_ts102941_types_authorization_inner_request codec; - OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_inner_request) == -1) { - loggers::get_instance().warning("fx__dec__InnerAtRequest: -1 result code was returned"); - return -1; - } - - loggers::get_instance().log_msg("<<< fx__dec__InnerAtRequest: ", p_inner_request); - return 0; - } - - BITSTRING fx__enc__InnerAtResponse(const EtsiTs102941TypesAuthorization::InnerAtResponse &p_inner_response) { - loggers::get_instance().log_msg(">>> fx__enc__InnerAtResponse: ", p_inner_response); - - etsi_ts102941_types_authorization_inner_response codec; - OCTETSTRING os; - if (codec.encode(p_inner_response, os) == -1) { - loggers::get_instance().warning("fx__enc__InnerAtResponse: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__InnerAtResponse(BITSTRING &b, EtsiTs102941TypesAuthorization::InnerAtResponse &p_inner_response) { - loggers::get_instance().log_msg(">>> fx__dec__InnerAtResponse: ", b); - - etsi_ts102941_types_authorization_inner_response codec; - OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_inner_response) == -1) { - loggers::get_instance().warning("fx__dec__InnerAtResponse: -1 result code was returned"); - return -1; - } - - loggers::get_instance().log_msg("<<< fx__dec__InnerAtResponse: ", p_inner_response); - return 0; - } - - BITSTRING fx__enc__SharedAtRequest(EtsiTs102941TypesAuthorization::SharedAtRequest const &p_shared_at) { - loggers::get_instance().log_msg(">>> fx__enc__SharedAtRequest: ", p_shared_at); - - etsi_ts102941_types_authorization_shared_at_request codec; - OCTETSTRING os; - if (codec.encode(p_shared_at, os) == -1) { - loggers::get_instance().warning("fx__enc__SharedAtRequest: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__SharedAtRequest(BITSTRING &b, EtsiTs102941TypesAuthorization::SharedAtRequest &p_shared_at) { - loggers::get_instance().log_msg(">>> fx__dec__SharedAtRequest: ", b); - - etsi_ts102941_types_authorization_shared_at_request codec; - OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_shared_at) == -1) { - loggers::get_instance().warning("fx__dec__SharedAtRequest: -1 result code was returned"); - return -1; - } - - loggers::get_instance().log_msg("<<< fx__dec__SharedAtRequest: ", p_shared_at); - return 0; - } - - BITSTRING fx__enc__AuthorizationValidationRequest(EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationRequest const &p_shared_at) { - loggers::get_instance().log_msg(">>> fx__enc__AuthorizationValidationRequest: ", p_shared_at); - - etsi_ts102941_types_authorization_validation_request codec; - OCTETSTRING os; - if (codec.encode(p_shared_at, os) == -1) { - loggers::get_instance().warning("fx__enc__AuthorizationValidationRequest: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__AuthorizationValidationRequest(BITSTRING &b, EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationRequest &p_shared_at) { - loggers::get_instance().log_msg(">>> fx__dec__AuthorizationValidationRequest: ", b); - - etsi_ts102941_types_authorization_validation_request codec; - OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_shared_at) == -1) { - loggers::get_instance().warning("fx__dec__AuthorizationValidationRequest: -1 result code was returned"); - return -1; - } - - loggers::get_instance().log_msg("<<< fx__dec__AuthorizationValidationRequest: ", p_shared_at); - return 0; - } - - BITSTRING fx__enc__AuthorizationValidationResponse(EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationResponse const &p_shared_at) { - loggers::get_instance().log_msg(">>> fx__enc__AuthorizationValidationResponse: ", p_shared_at); - - etsi_ts102941_types_authorization_validation_response codec; - OCTETSTRING os; - if (codec.encode(p_shared_at, os) == -1) { - loggers::get_instance().warning("fx__enc__AuthorizationValidationResponse: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__AuthorizationValidationResponse(BITSTRING &b, EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationResponse &p_shared_at) { - loggers::get_instance().log_msg(">>> fx__dec__AuthorizationValidationResponse: ", b); - - etsi_ts102941_types_authorization_validation_response codec; - OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_shared_at) == -1) { - loggers::get_instance().warning("fx__dec__AuthorizationValidationResponse: -1 result code was returned"); - return -1; - } - - loggers::get_instance().log_msg("<<< fx__dec__AuthorizationValidationResponse: ", p_shared_at); - return 0; - } - - BITSTRING fx__enc__PublicKeys(EtsiTs102941BaseTypes::PublicKeys const &p_public_keys) { - loggers::get_instance().log_msg(">>> fx__enc__PublicKeys: ", p_public_keys); - - etsi_ts102941_base_types_public_keys codec; - OCTETSTRING os; - if (codec.encode(p_public_keys, os) == -1) { - loggers::get_instance().warning("fx__enc__PublicKeys: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__PublicKeys(BITSTRING &b, EtsiTs102941BaseTypes::PublicKeys &p_public_keys) { - loggers::get_instance().log_msg(">>> fx__dec__PublicKeys: ", b); - - etsi_ts102941_base_types_public_keys codec; - OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_public_keys) == -1) { - loggers::get_instance().warning("fx__dec__PublicKeys: -1 result code was returned"); - return -1; - } - - loggers::get_instance().log_msg("<<< fx__dec__PublicKeys: ", p_public_keys); - return 0; - } - - BITSTRING fx__enc__PublicVerificationKey(Ieee1609Dot2BaseTypes::PublicVerificationKey const &p_public_verification_key) { - loggers::get_instance().log_msg(">>> fx__enc__PublicVerificationKey: ", p_public_verification_key); - - ieee_1609dot2_base_types_public_verification_key codec; - OCTETSTRING os; - if (codec.encode(p_public_verification_key, os) == -1) { - loggers::get_instance().warning("fx__enc__PublicVerificationKey: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__PublicVerificationKey(BITSTRING &b, Ieee1609Dot2BaseTypes::PublicVerificationKey &p_public_verification_key) { - loggers::get_instance().log_msg(">>> fx__dec__PublicVerificationKey: ", b); - - ieee_1609dot2_base_types_public_verification_key codec; - OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_public_verification_key) == -1) { - loggers::get_instance().warning("fx__dec__PublicVerificationKey: -1 result code was returned"); - return -1; - } - - loggers::get_instance().log_msg("<<< fx__dec__PublicVerificationKey: ", p_public_verification_key); - return 0; - } - - BITSTRING fx__enc__PublicEncryptionKey(Ieee1609Dot2BaseTypes::PublicEncryptionKey const &p_public_encryption_key) { - loggers::get_instance().log_msg(">>> fx__enc__PublicEncryptionKey: ", p_public_encryption_key); - - ieee_1609dot2_base_types_public_encryption_key codec; - OCTETSTRING os; - if (codec.encode(p_public_encryption_key, os) == -1) { - loggers::get_instance().warning("fx__enc__PublicEncryptionKey: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__PublicEncryptionKey(BITSTRING &b, Ieee1609Dot2BaseTypes::PublicEncryptionKey &p_public_encryption_key) { - loggers::get_instance().log_msg(">>> fx__dec__PublicEncryptionKey: ", b); - - ieee_1609dot2_base_types_public_encryption_key codec; - OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_public_encryption_key) == -1) { - loggers::get_instance().warning("fx__dec__PublicEncryptionKey: -1 result code was returned"); - return -1; - } - - loggers::get_instance().log_msg("<<< fx__dec__PublicEncryptionKey: ", p_public_encryption_key); - return 0; - } - - BITSTRING fx__enc__CtlFormat(EtsiTs102941TrustLists::CtlFormat const &p_ctl_format) { - loggers::get_instance().log_msg(">>> fx__enc__CtlFormat: ", p_ctl_format); - - etsi_ts102941_trust_lists_ctl_format codec; - OCTETSTRING os; - if (codec.encode(p_ctl_format, os) == -1) { - loggers::get_instance().warning("fx__enc__CtlFormat: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__CtlFormat(BITSTRING &b, EtsiTs102941TrustLists::CtlFormat &p_ctl_format) { - loggers::get_instance().log_msg(">>> fx__dec__CtlFormat: ", b); - - etsi_ts102941_trust_lists_ctl_format codec; - OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_ctl_format) == -1) { - loggers::get_instance().warning("fx__dec__CtlFormat: -1 result code was returned"); - return -1; - } - - loggers::get_instance().log_msg("<<< fx__dec__CtlFormat: ", p_ctl_format); - return 0; - } - -} // End of namespace LibItsPki__EncdecDeclarations +// #include "LibItsPki_EncdecDeclarations.hh" + +// #include "etsi_ts102941_base_types_public_keys.hh" +// #include "etsi_ts102941_data_codec.hh" +// #include "etsi_ts102941_data_content_codec.hh" +// #include "etsi_ts102941_types_authorization_inner_request.hh" +// #include "etsi_ts102941_types_authorization_inner_response.hh" +// #include "etsi_ts102941_types_authorization_shared_at_request.hh" +// #include "etsi_ts102941_types_authorization_validation_request.hh" +// #include "etsi_ts102941_types_authorization_validation_response.hh" +// #include "etsi_ts102941_types_enrolment_inner_request.hh" +// #include "etsi_ts102941_types_enrolment_inner_response.hh" +// #include "ieee_1609dot2_base_types_public_encryption_key.hh" +// #include "ieee_1609dot2_base_types_public_verification_key.hh" + +// #include "etsi_ts102941_trust_lists_ctl_format.hh" + +// #include "loggers.hh" + +// namespace LibItsPki__EncdecDeclarations { + +// BITSTRING fx__enc__EtsiTs102941Data(const EtsiTs102941MessagesCa::EtsiTs102941Data &p_etsi_ts_102941_data) { +// loggers::get_instance().log_msg(">>> fx__enc__EtsiTs102941Data: ", p_etsi_ts_102941_data); + +// etsi_ts102941_data_codec codec; +// OCTETSTRING os; +// if (codec.encode(p_etsi_ts_102941_data, os) == -1) { +// loggers::get_instance().warning("fx__enc__EtsiTs102941Data: -1 result code was returned"); +// return int2bit(0, 1); +// } + +// return oct2bit(os); +// } + +// INTEGER fx__dec__EtsiTs102941Data(BITSTRING &b, EtsiTs102941MessagesCa::EtsiTs102941Data &p_etsi_ts_102941_data) { +// loggers::get_instance().log_msg(">>> fx__dec__EtsiTs102941Data: ", b); + +// etsi_ts102941_data_codec codec; +// OCTETSTRING is = bit2oct(b); +// if (codec.decode(is, p_etsi_ts_102941_data) == -1) { +// loggers::get_instance().warning("fx__dec__EtsiTs102941Data: -1 result code was returned"); +// return -1; +// } + +// return 0; +// } + +// BITSTRING fx__enc__EtsiTs102941DataContent(const EtsiTs102941MessagesCa::EtsiTs102941DataContent &p_etsi_ts_102941_data_content) { +// loggers::get_instance().log_msg(">>> fx__enc__EtsiTs102941DataContent: ", p_etsi_ts_102941_data_content); + +// etsi_ts102941_data_content_codec codec; +// OCTETSTRING os; +// if (codec.encode(p_etsi_ts_102941_data_content, os) == -1) { +// loggers::get_instance().warning("fx__enc__EtsiTs102941DataContent: -1 result code was returned"); +// return int2bit(0, 1); +// } + +// return oct2bit(os); +// } + +// INTEGER fx__dec__EtsiTs102941DataContent(BITSTRING &b, EtsiTs102941MessagesCa::EtsiTs102941DataContent &p_etsi_ts_102941_data_content) { +// loggers::get_instance().log_msg(">>> fx__dec__EtsiTs102941DataContent: ", b); + +// etsi_ts102941_data_content_codec codec; +// OCTETSTRING is = bit2oct(b); +// if (codec.decode(is, p_etsi_ts_102941_data_content) == -1) { +// loggers::get_instance().warning("fx__dec__EtsiTs102941DataContent: -1 result code was returned"); +// return -1; +// } + +// return 0; +// } + +// BITSTRING fx__enc__InnerEcRequest(const EtsiTs102941TypesEnrolment::InnerEcRequest &p_inner_request) { +// loggers::get_instance().log_msg(">>> fx_enc_InnerEcRequest: ", p_inner_request); + +// etsi_ts102941_types_enrolment_inner_request codec; +// OCTETSTRING os; +// if (codec.encode(p_inner_request, os) == -1) { +// loggers::get_instance().warning("fx_enc_InnerEcRequest: -1 result code was returned"); +// return int2bit(0, 1); +// } + +// return oct2bit(os); +// } + +// INTEGER fx__dec__InnerEcRequest(BITSTRING &b, EtsiTs102941TypesEnrolment::InnerEcRequest &p_inner_request) { +// loggers::get_instance().log_msg(">>> fx__dec__InnerEcRequest: ", b); + +// etsi_ts102941_types_enrolment_inner_request codec; +// OCTETSTRING is = bit2oct(b); +// if (codec.decode(is, p_inner_request) == -1) { +// loggers::get_instance().warning("fx__dec__InnerEcRequest: -1 result code was returned"); +// return -1; +// } + +// loggers::get_instance().log_msg("<<< fx__dec__InnerEcRequest: ", p_inner_request); +// return 0; +// } + +// BITSTRING fx__enc__InnerEcResponse(const EtsiTs102941TypesEnrolment::InnerEcResponse &p_inner_response) { +// loggers::get_instance().log_msg(">>> fx__enc__InnerEcResponse: ", p_inner_response); + +// etsi_ts102941_types_enrolment_inner_response codec; +// OCTETSTRING os; +// if (codec.encode(p_inner_response, os) == -1) { +// loggers::get_instance().warning("fx__enc__InnerEcResponse: -1 result code was returned"); +// return int2bit(0, 1); +// } + +// return oct2bit(os); +// } + +// INTEGER fx__dec__InnerEcResponse(BITSTRING &b, EtsiTs102941TypesEnrolment::InnerEcResponse &p_inner_response) { +// loggers::get_instance().log_msg(">>> fx__dec__InnerEcResponse: ", b); + +// etsi_ts102941_types_enrolment_inner_response codec; +// OCTETSTRING is = bit2oct(b); +// if (codec.decode(is, p_inner_response) == -1) { +// loggers::get_instance().warning("fx__dec__InnerEcResponse: -1 result code was returned"); +// return -1; +// } + +// loggers::get_instance().log_msg("<<< fx__dec__InnerEcResponse: ", p_inner_response); +// return 0; +// } + +// BITSTRING fx__enc__InnerAtRequest(const EtsiTs102941TypesAuthorization::InnerAtRequest &p_inner_request) { +// loggers::get_instance().log_msg(">>> fx_enc_InnerAtRequest: ", p_inner_request); + +// etsi_ts102941_types_authorization_inner_request codec; +// OCTETSTRING os; +// if (codec.encode(p_inner_request, os) == -1) { +// loggers::get_instance().warning("fx_enc_InnerAtRequest: -1 result code was returned"); +// return int2bit(0, 1); +// } + +// return oct2bit(os); +// } + +// INTEGER fx__dec__InnerAtRequest(BITSTRING &b, EtsiTs102941TypesAuthorization::InnerAtRequest &p_inner_request) { +// loggers::get_instance().log_msg(">>> fx__dec__InnerAtRequest: ", b); + +// etsi_ts102941_types_authorization_inner_request codec; +// OCTETSTRING is = bit2oct(b); +// if (codec.decode(is, p_inner_request) == -1) { +// loggers::get_instance().warning("fx__dec__InnerAtRequest: -1 result code was returned"); +// return -1; +// } + +// loggers::get_instance().log_msg("<<< fx__dec__InnerAtRequest: ", p_inner_request); +// return 0; +// } + +// BITSTRING fx__enc__InnerAtResponse(const EtsiTs102941TypesAuthorization::InnerAtResponse &p_inner_response) { +// loggers::get_instance().log_msg(">>> fx__enc__InnerAtResponse: ", p_inner_response); + +// etsi_ts102941_types_authorization_inner_response codec; +// OCTETSTRING os; +// if (codec.encode(p_inner_response, os) == -1) { +// loggers::get_instance().warning("fx__enc__InnerAtResponse: -1 result code was returned"); +// return int2bit(0, 1); +// } + +// return oct2bit(os); +// } + +// INTEGER fx__dec__InnerAtResponse(BITSTRING &b, EtsiTs102941TypesAuthorization::InnerAtResponse &p_inner_response) { +// loggers::get_instance().log_msg(">>> fx__dec__InnerAtResponse: ", b); + +// etsi_ts102941_types_authorization_inner_response codec; +// OCTETSTRING is = bit2oct(b); +// if (codec.decode(is, p_inner_response) == -1) { +// loggers::get_instance().warning("fx__dec__InnerAtResponse: -1 result code was returned"); +// return -1; +// } + +// loggers::get_instance().log_msg("<<< fx__dec__InnerAtResponse: ", p_inner_response); +// return 0; +// } + +// BITSTRING fx__enc__SharedAtRequest(EtsiTs102941TypesAuthorization::SharedAtRequest const &p_shared_at) { +// loggers::get_instance().log_msg(">>> fx__enc__SharedAtRequest: ", p_shared_at); + +// etsi_ts102941_types_authorization_shared_at_request codec; +// OCTETSTRING os; +// if (codec.encode(p_shared_at, os) == -1) { +// loggers::get_instance().warning("fx__enc__SharedAtRequest: -1 result code was returned"); +// return int2bit(0, 1); +// } + +// return oct2bit(os); +// } + +// INTEGER fx__dec__SharedAtRequest(BITSTRING &b, EtsiTs102941TypesAuthorization::SharedAtRequest &p_shared_at) { +// loggers::get_instance().log_msg(">>> fx__dec__SharedAtRequest: ", b); + +// etsi_ts102941_types_authorization_shared_at_request codec; +// OCTETSTRING is = bit2oct(b); +// if (codec.decode(is, p_shared_at) == -1) { +// loggers::get_instance().warning("fx__dec__SharedAtRequest: -1 result code was returned"); +// return -1; +// } + +// loggers::get_instance().log_msg("<<< fx__dec__SharedAtRequest: ", p_shared_at); +// return 0; +// } + +// BITSTRING fx__enc__AuthorizationValidationRequest(EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationRequest const &p_shared_at) { +// loggers::get_instance().log_msg(">>> fx__enc__AuthorizationValidationRequest: ", p_shared_at); + +// etsi_ts102941_types_authorization_validation_request codec; +// OCTETSTRING os; +// if (codec.encode(p_shared_at, os) == -1) { +// loggers::get_instance().warning("fx__enc__AuthorizationValidationRequest: -1 result code was returned"); +// return int2bit(0, 1); +// } + +// return oct2bit(os); +// } + +// INTEGER fx__dec__AuthorizationValidationRequest(BITSTRING &b, EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationRequest &p_shared_at) { +// loggers::get_instance().log_msg(">>> fx__dec__AuthorizationValidationRequest: ", b); + +// etsi_ts102941_types_authorization_validation_request codec; +// OCTETSTRING is = bit2oct(b); +// if (codec.decode(is, p_shared_at) == -1) { +// loggers::get_instance().warning("fx__dec__AuthorizationValidationRequest: -1 result code was returned"); +// return -1; +// } + +// loggers::get_instance().log_msg("<<< fx__dec__AuthorizationValidationRequest: ", p_shared_at); +// return 0; +// } + +// BITSTRING fx__enc__AuthorizationValidationResponse(EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationResponse const &p_shared_at) { +// loggers::get_instance().log_msg(">>> fx__enc__AuthorizationValidationResponse: ", p_shared_at); + +// etsi_ts102941_types_authorization_validation_response codec; +// OCTETSTRING os; +// if (codec.encode(p_shared_at, os) == -1) { +// loggers::get_instance().warning("fx__enc__AuthorizationValidationResponse: -1 result code was returned"); +// return int2bit(0, 1); +// } + +// return oct2bit(os); +// } + +// INTEGER fx__dec__AuthorizationValidationResponse(BITSTRING &b, EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationResponse &p_shared_at) { +// loggers::get_instance().log_msg(">>> fx__dec__AuthorizationValidationResponse: ", b); + +// etsi_ts102941_types_authorization_validation_response codec; +// OCTETSTRING is = bit2oct(b); +// if (codec.decode(is, p_shared_at) == -1) { +// loggers::get_instance().warning("fx__dec__AuthorizationValidationResponse: -1 result code was returned"); +// return -1; +// } + +// loggers::get_instance().log_msg("<<< fx__dec__AuthorizationValidationResponse: ", p_shared_at); +// return 0; +// } + +// BITSTRING fx__enc__PublicKeys(EtsiTs102941BaseTypes::PublicKeys const &p_public_keys) { +// loggers::get_instance().log_msg(">>> fx__enc__PublicKeys: ", p_public_keys); + +// etsi_ts102941_base_types_public_keys codec; +// OCTETSTRING os; +// if (codec.encode(p_public_keys, os) == -1) { +// loggers::get_instance().warning("fx__enc__PublicKeys: -1 result code was returned"); +// return int2bit(0, 1); +// } + +// return oct2bit(os); +// } + +// INTEGER fx__dec__PublicKeys(BITSTRING &b, EtsiTs102941BaseTypes::PublicKeys &p_public_keys) { +// loggers::get_instance().log_msg(">>> fx__dec__PublicKeys: ", b); + +// etsi_ts102941_base_types_public_keys codec; +// OCTETSTRING is = bit2oct(b); +// if (codec.decode(is, p_public_keys) == -1) { +// loggers::get_instance().warning("fx__dec__PublicKeys: -1 result code was returned"); +// return -1; +// } + +// loggers::get_instance().log_msg("<<< fx__dec__PublicKeys: ", p_public_keys); +// return 0; +// } + +// BITSTRING fx__enc__PublicVerificationKey(Ieee1609Dot2BaseTypes::PublicVerificationKey const &p_public_verification_key) { +// loggers::get_instance().log_msg(">>> fx__enc__PublicVerificationKey: ", p_public_verification_key); + +// ieee_1609dot2_base_types_public_verification_key codec; +// OCTETSTRING os; +// if (codec.encode(p_public_verification_key, os) == -1) { +// loggers::get_instance().warning("fx__enc__PublicVerificationKey: -1 result code was returned"); +// return int2bit(0, 1); +// } + +// return oct2bit(os); +// } + +// INTEGER fx__dec__PublicVerificationKey(BITSTRING &b, Ieee1609Dot2BaseTypes::PublicVerificationKey &p_public_verification_key) { +// loggers::get_instance().log_msg(">>> fx__dec__PublicVerificationKey: ", b); + +// ieee_1609dot2_base_types_public_verification_key codec; +// OCTETSTRING is = bit2oct(b); +// if (codec.decode(is, p_public_verification_key) == -1) { +// loggers::get_instance().warning("fx__dec__PublicVerificationKey: -1 result code was returned"); +// return -1; +// } + +// loggers::get_instance().log_msg("<<< fx__dec__PublicVerificationKey: ", p_public_verification_key); +// return 0; +// } + +// BITSTRING fx__enc__PublicEncryptionKey(Ieee1609Dot2BaseTypes::PublicEncryptionKey const &p_public_encryption_key) { +// loggers::get_instance().log_msg(">>> fx__enc__PublicEncryptionKey: ", p_public_encryption_key); + +// ieee_1609dot2_base_types_public_encryption_key codec; +// OCTETSTRING os; +// if (codec.encode(p_public_encryption_key, os) == -1) { +// loggers::get_instance().warning("fx__enc__PublicEncryptionKey: -1 result code was returned"); +// return int2bit(0, 1); +// } + +// return oct2bit(os); +// } + +// INTEGER fx__dec__PublicEncryptionKey(BITSTRING &b, Ieee1609Dot2BaseTypes::PublicEncryptionKey &p_public_encryption_key) { +// loggers::get_instance().log_msg(">>> fx__dec__PublicEncryptionKey: ", b); + +// ieee_1609dot2_base_types_public_encryption_key codec; +// OCTETSTRING is = bit2oct(b); +// if (codec.decode(is, p_public_encryption_key) == -1) { +// loggers::get_instance().warning("fx__dec__PublicEncryptionKey: -1 result code was returned"); +// return -1; +// } + +// loggers::get_instance().log_msg("<<< fx__dec__PublicEncryptionKey: ", p_public_encryption_key); +// return 0; +// } + +// BITSTRING fx__enc__CtlFormat(EtsiTs102941TrustLists::CtlFormat const &p_ctl_format) { +// loggers::get_instance().log_msg(">>> fx__enc__CtlFormat: ", p_ctl_format); + +// etsi_ts102941_trust_lists_ctl_format codec; +// OCTETSTRING os; +// if (codec.encode(p_ctl_format, os) == -1) { +// loggers::get_instance().warning("fx__enc__CtlFormat: -1 result code was returned"); +// return int2bit(0, 1); +// } + +// return oct2bit(os); +// } + +// INTEGER fx__dec__CtlFormat(BITSTRING &b, EtsiTs102941TrustLists::CtlFormat &p_ctl_format) { +// loggers::get_instance().log_msg(">>> fx__dec__CtlFormat: ", b); + +// etsi_ts102941_trust_lists_ctl_format codec; +// OCTETSTRING is = bit2oct(b); +// if (codec.decode(is, p_ctl_format) == -1) { +// loggers::get_instance().warning("fx__dec__CtlFormat: -1 result code was returned"); +// return -1; +// } + +// loggers::get_instance().log_msg("<<< fx__dec__CtlFormat: ", p_ctl_format); +// return 0; +// } + +// } // End of namespace LibItsPki__EncdecDeclarations diff --git a/ccsrc/EncDec/LibItsRtcmem_Encdec.cc b/ccsrc/EncDec/LibItsRtcmem_Encdec.cc index d1c722f..fc9d47e 100644 --- a/ccsrc/EncDec/LibItsRtcmem_Encdec.cc +++ b/ccsrc/EncDec/LibItsRtcmem_Encdec.cc @@ -163,28 +163,6 @@ namespace LibItsRtcmem__EncdecDeclarations { return 0; } - BITSTRING fx__enc__RTCMEM(const RTCMEM__PDU__Descriptions::RTCMEM &p_rtcmem) { - loggers::get_instance().log_msg(">>> fx__enc__RTCMEM: ", p_rtcmem); - - RtcmemCodec codec; - OCTETSTRING os; - codec.encode(p_rtcmem, os); - return oct2bit(os); - } - - INTEGER fx__dec__RTCMEM(BITSTRING &b, RTCMEM__PDU__Descriptions::RTCMEM &p) { - loggers::get_instance().log(">>> fx__dec__RTCMEM"); - RtcmemCodec codec; - OCTETSTRING is = bit2oct(b); - - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { - loggers::get_instance().warning("fx__dec__RTCMEM: -1 result code was returned"); - return -1; - } - - return 0; - } - BITSTRING fx__enc__UtRtcmemInitialize(const LibItsRtcmem__TypesAndValues::UtRtcmemInitialize &p_utRtcmemInitialize) { loggers::get_instance().log_msg(">>> fx__enc__UtRtcmemInitialize: ", p_utRtcmemInitialize); diff --git a/ccsrc/EncDec/LibItsSecurity_Encdec.cc b/ccsrc/EncDec/LibItsSecurity_Encdec.cc index 703153d..ed483e3 100644 --- a/ccsrc/EncDec/LibItsSecurity_Encdec.cc +++ b/ccsrc/EncDec/LibItsSecurity_Encdec.cc @@ -1,138 +1,39 @@ -#include "LibItsSecurity_EncdecDeclarations.hh" - -#include "etsi_ts103097_certificate_codec.hh" -#include "etsi_ts103097_data_codec.hh" -#include "etsi_ts103097_tobesigned_certificate_codec.hh" -#include "etsi_ts103097_tobesigned_data_codec.hh" - -#include "loggers.hh" - -namespace LibItsSecurity__EncdecDeclarations { - - BITSTRING fx__enc__CertificateBase(Ieee1609Dot2::CertificateBase const &p_cert) { - loggers::get_instance().log_msg(">>> fx__enc__CertificateBase: ", p_cert); - - etsi_ts103097_certificate_codec codec; - OCTETSTRING os; - if (codec.encode(p_cert, os) == -1) { - loggers::get_instance().warning("fx__enc__CertificateBase: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__CertificateBase(BITSTRING &b, Ieee1609Dot2::CertificateBase &p_cert) { - loggers::get_instance().log_msg(">>> fx__dec__CertificateBase: ", b); - - etsi_ts103097_certificate_codec codec; - OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_cert) == -1) { - loggers::get_instance().warning("fx__dec__CertificateBase: -1 result code was returned"); - return -1; - } - - loggers::get_instance().log_msg("<<< fx__dec__CertificateBase: ", p_cert); - return 0; - } - - BITSTRING fx__enc__ToBeSignedCertificate(const Ieee1609Dot2::ToBeSignedCertificate &p_toBeSignedCertificate) { - loggers::get_instance().log_msg(">>> fx__enc__ToBeSignedCertificate: ", p_toBeSignedCertificate); - - etsi_ts103097_tobesigned_certificate_codec codec; - OCTETSTRING os; - if (codec.encode(p_toBeSignedCertificate, os) == -1) { - loggers::get_instance().warning("fx__enc__ToBeSignedCertificate: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - BITSTRING fx__enc__Ieee1609Dot2Data(const Ieee1609Dot2::Ieee1609Dot2Data &p__ieee1609Dot2Data) { - loggers::get_instance().log_msg(">>> fx__enc__Ieee1609Dot2Data: ", p__ieee1609Dot2Data); - - etsi_ts103097_data_codec codec; - OCTETSTRING os; - if (codec.encode(p__ieee1609Dot2Data, os) == -1) { - loggers::get_instance().warning("fx__enc__Ieee1609Dot2Data: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__Ieee1609Dot2Data(BITSTRING &p__data, Ieee1609Dot2::Ieee1609Dot2Data &p__ieee1609Dot2Data) { - loggers::get_instance().log_msg(">>> fx__dec__Ieee1609Dot2Data: ", p__data); - - etsi_ts103097_data_codec codec; - OCTETSTRING is = bit2oct(p__data); - if (codec.decode(is, p__ieee1609Dot2Data) == -1) { - loggers::get_instance().warning("fx__dec__Ieee1609Dot2Data: -1 result code was returned"); - return -1; - } - - loggers::get_instance().log_msg("<<< fx__dec__Ieee1609Dot2Data: ", p__ieee1609Dot2Data); - return 0; - } - - BITSTRING fx__enc__Ieee1609Dot2ToBeSignedData(const Ieee1609Dot2::ToBeSignedData &p__toBeSignedData) { - loggers::get_instance().log_msg(">>> fx__enc__Ieee1609Dot2ToBeSignedData: ", p__toBeSignedData); - - etsi_ts103097_tobesigned_data_codec codec; - OCTETSTRING os; - if (codec.encode(p__toBeSignedData, os) == -1) { - loggers::get_instance().warning("fx__enc__Ieee1609Dot2ToBeSignedData: -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - } - - INTEGER fx__dec__Ieee1609Dot2ToBeSignedData(BITSTRING &p__data, Ieee1609Dot2::ToBeSignedData &p__toBeSignedData) { - loggers::get_instance().log_msg(">>> fx__dec__Ieee1609Dot2ToBeSignedData: ", p__data); - - etsi_ts103097_tobesigned_data_codec codec; - OCTETSTRING is = bit2oct(p__data); - if (codec.decode(is, p__toBeSignedData) == -1) { - loggers::get_instance().warning("fx__dec__Ieee1609Dot2ToBeSignedData: -1 result code was returned"); - return -1; - } - - loggers::get_instance().log_msg("<<< fx__dec__Ieee1609Dot2ToBeSignedData: ", p__toBeSignedData); - return 0; - } - - BITSTRING fx__enc__SspCAM(const LibItsSecurity__TypesAndValues::SspCAM &p__ssp) { - loggers::get_instance().log_msg(">>> fx__enc__SspCAM: ", p__ssp); - - TTCN_Buffer encoding_buffer; - p__ssp.encode(*p__ssp.get_descriptor(), encoding_buffer, TTCN_EncDec::CT_RAW); - return oct2bit(OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())); - } - - INTEGER fx__dec__SspCAM(BITSTRING &p__data, LibItsSecurity__TypesAndValues::SspCAM &p__ssp) { - loggers::get_instance().log_msg(">>> fx__dec__SspCAM: ", p__data); - - TTCN_Buffer decoding_buffer(bit2oct(p__data)); - p__ssp.decode(*p__ssp.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW); - return 0; - } - - BITSTRING fx__enc__SspDENM(const LibItsSecurity__TypesAndValues::SspDENM &p__ssp) { - loggers::get_instance().log_msg(">>> fx__enc__SspDENM: ", p__ssp); - - TTCN_Buffer encoding_buffer; - p__ssp.encode(*p__ssp.get_descriptor(), encoding_buffer, TTCN_EncDec::CT_RAW); - return oct2bit(OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())); - } - - INTEGER fx__dec__SspDENM(BITSTRING &p__data, LibItsSecurity__TypesAndValues::SspDENM &p__ssp) { - loggers::get_instance().log_msg(">>> fx__dec__SspDENM: ", p__data); - - TTCN_Buffer decoding_buffer(bit2oct(p__data)); - p__ssp.decode(*p__ssp.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW); - return 0; - } - -} // namespace LibItsSecurity__EncdecDeclarations +#include "LibItsSecurity_EncdecDeclarations.hh" + +#include "loggers.hh" + +namespace LibItsSecurity__EncdecDeclarations { + + BITSTRING fx__enc__SspCAM(const LibItsSecurity__TypesAndValues::SspCAM &p__ssp) { + loggers::get_instance().log_msg(">>> fx__enc__SspCAM: ", p__ssp); + + TTCN_Buffer encoding_buffer; + p__ssp.encode(*p__ssp.get_descriptor(), encoding_buffer, TTCN_EncDec::CT_RAW); + return oct2bit(OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())); + } + + INTEGER fx__dec__SspCAM(BITSTRING &p__data, LibItsSecurity__TypesAndValues::SspCAM &p__ssp) { + loggers::get_instance().log_msg(">>> fx__dec__SspCAM: ", p__data); + + TTCN_Buffer decoding_buffer(bit2oct(p__data)); + p__ssp.decode(*p__ssp.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW); + return 0; + } + + BITSTRING fx__enc__SspDENM(const LibItsSecurity__TypesAndValues::SspDENM &p__ssp) { + loggers::get_instance().log_msg(">>> fx__enc__SspDENM: ", p__ssp); + + TTCN_Buffer encoding_buffer; + p__ssp.encode(*p__ssp.get_descriptor(), encoding_buffer, TTCN_EncDec::CT_RAW); + return oct2bit(OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())); + } + + INTEGER fx__dec__SspDENM(BITSTRING &p__data, LibItsSecurity__TypesAndValues::SspDENM &p__ssp) { + loggers::get_instance().log_msg(">>> fx__dec__SspDENM: ", p__data); + + TTCN_Buffer decoding_buffer(bit2oct(p__data)); + p__ssp.decode(*p__ssp.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW); + return 0; + } + +} // namespace LibItsSecurity__EncdecDeclarations diff --git a/ccsrc/EncDec/LibItsSremSsem_Encdec.cc b/ccsrc/EncDec/LibItsSremSsem_Encdec.cc index bfec6b0..eccaea1 100644 --- a/ccsrc/EncDec/LibItsSremSsem_Encdec.cc +++ b/ccsrc/EncDec/LibItsSremSsem_Encdec.cc @@ -187,28 +187,6 @@ namespace LibItsSremSsem__EncdecDeclarations { return 0; } - BITSTRING fx__enc__SREM(const SREM__PDU__Descriptions::SREM &p_srem) { - loggers::get_instance().log_msg(">>> fx__enc__SREM: ", p_srem); - - SremCodec codec; - OCTETSTRING os; - codec.encode(p_srem, os); - return oct2bit(os); - } - - INTEGER fx__dec__SREM(BITSTRING &b, SREM__PDU__Descriptions::SREM &p) { - loggers::get_instance().log(">>> fx__dec__SREM"); - SremCodec codec; - OCTETSTRING is = bit2oct(b); - - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { - loggers::get_instance().warning("fx__dec__Srem: -1 result code was returned"); - return -1; - } - - return 0; - } - /**************************************************** * @desc External function to encode a SsemReq type * @param value to encode @@ -388,28 +366,6 @@ namespace LibItsSremSsem__EncdecDeclarations { return 0; } - BITSTRING fx__enc__SSEM(const SSEM__PDU__Descriptions::SSEM &p_ssem) { - loggers::get_instance().log_msg(">>> fx__enc__SSEM: ", p_ssem); - - SsemCodec codec; - OCTETSTRING os; - codec.encode(p_ssem, os); - return oct2bit(os); - } - - INTEGER fx__dec__SSEM(BITSTRING &b, SSEM__PDU__Descriptions::SSEM &p_ssem) { - loggers::get_instance().log(">>> fx__dec__SSEM"); - SsemCodec codec; - OCTETSTRING is = bit2oct(b); - - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p_ssem) == -1) { - loggers::get_instance().warning("fx__dec__Ssem: -1 result code was returned"); - return -1; - } - - return 0; - } - BITSTRING fx__enc__UtSremInitialize(const LibItsSremSsem__TypesAndValues::UtSremInitialize &p_utSremInitialize) { loggers::get_instance().log_msg(">>> fx__enc__UtSremInitialize: ", p_utSremInitialize); diff --git a/ccsrc/EncDec/module.mk b/ccsrc/EncDec/module.mk index 18f4be8..5965f3c 100644 --- a/ccsrc/EncDec/module.mk +++ b/ccsrc/EncDec/module.mk @@ -28,9 +28,7 @@ sources += \ LibItsMapemSpatem_Encdec.cc \ LibItsSremSsem_Encdec.cc \ LibItsRtcmem_Encdec.cc \ - LibItsIvim_Encdec.cc \ - LibItsPki_Encdec.cc \ - LibItsMbr_Encdec.cc + LibItsIvim_Encdec.cc endif @@ -53,13 +51,11 @@ endif ifeq (AtsPki, $(ATS)) sources += \ LibItsBtp_Encdec.cc \ - LibItsPki_Encdec.cc \ LibItsCam_Encdec.cc endif ifeq (AtsMBR, $(ATS)) sources += \ LibItsBtp_Encdec.cc \ - LibItsMbr_Encdec.cc \ LibItsCam_Encdec.cc endif diff --git a/config.mk b/config.mk index 8ec21eb..2f77c63 100644 --- a/config.mk +++ b/config.mk @@ -1,4 +1,4 @@ -TTCN3_COMPILER_OPTIONS := -d -e -f -g -l -L -R -U none -x -X +TTCN3_COMPILER_OPTIONS := -d -e -f -g -j -l -L -R -U none -x -X TTCN3_DIR := $(HOME)/frameworks/titan/titan.core/Install ASN1C_PATH := $(HOME)/frameworks/asn1c.denis #WPCAP_DLL_PATH := /cygdrive/c/windows/system32/npcap/wpcap.dll -- GitLab From e992e3d4ff91b20689eb7604db90ad49d6273e52 Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 25 May 2023 10:11:08 +0200 Subject: [PATCH 086/178] Add curl install in Dockerfile; Disable JSON support for Test System --- titan-test-system-framework | 2 +- ttcn/AtsIPv6OverGeoNetworking | 2 +- .../module | 2 +- virtualization/docker/Dockerfile | 2 +- virtualization/docker/docker-run.sh | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/titan-test-system-framework b/titan-test-system-framework index ffbcefb..554d6b6 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit ffbcefb5dbe4bc24623f5738c8a64153c8f3599d +Subproject commit 554d6b6b3ce1e51d88267a3c946cd30caac97a55 diff --git a/ttcn/AtsIPv6OverGeoNetworking b/ttcn/AtsIPv6OverGeoNetworking index 3e3e90c..566cc49 160000 --- a/ttcn/AtsIPv6OverGeoNetworking +++ b/ttcn/AtsIPv6OverGeoNetworking @@ -1 +1 @@ -Subproject commit 3e3e90ce7c54d4b3ab1e2551778d8d52aade506c +Subproject commit 566cc49bf1b16aa64c26dea40268c8cd0c7acab6 diff --git a/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module b/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module index 732c993..affc1fa 160000 --- a/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module +++ b/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module @@ -1 +1 @@ -Subproject commit 732c9934d2c87966b5ab9ba4e6886f353d5e4ace +Subproject commit affc1fa4e6497ff138b79a958caa79532fba6857 diff --git a/virtualization/docker/Dockerfile b/virtualization/docker/Dockerfile index 9ffebef..edd7205 100644 --- a/virtualization/docker/Dockerfile +++ b/virtualization/docker/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:3.16 # Install dependencies RUN apk update && \ - apk add --no-cache autoconf automake sudo make git g++ diffutils expect openssl-dev libxml2-dev libxml2-utils libxslt-dev libtool ncurses-dev jsoncpp-dev readline-dev flex bison perl libexecinfo-dev bash libedit libedit-dev lksctp-tools lksctp-tools-dev libpcap-dev + apk add --no-cache autoconf automake sudo make git g++ diffutils expect openssl-dev libxml2-dev libxml2-utils libxslt-dev libtool ncurses-dev jsoncpp-dev readline-dev flex bison perl libexecinfo-dev bash libedit libedit-dev lksctp-tools lksctp-tools-dev libpcap-dev curl # Create user and sudouser RUN \ diff --git a/virtualization/docker/docker-run.sh b/virtualization/docker/docker-run.sh index 50a34f1..48ec51e 100755 --- a/virtualization/docker/docker-run.sh +++ b/virtualization/docker/docker-run.sh @@ -4,11 +4,11 @@ set -exo pipefail cd "$(dirname ${BASH_SOURCE})" docker run --rm -it \ - -w $HOME/dev/TS.ITS \ - -e GEN_DIR=$HOME/dev/TS.ITS \ + -w $HOME/dev/TS.ITS_r2 \ + -e GEN_DIR=$HOME/dev/TS.ITS_r2 \ -u "$(id -u):$(id -g)" \ - -v "${PWD}/../..:$HOME/dev/TS.ITS" \ - --entrypoint $HOME/dev/TS.ITS/virtualization/docker/docker-entrypoint.sh \ + -v "${PWD}/../..:$HOME/dev/TS.ITS_r2" \ + --entrypoint $HOME/dev/TS.ITS_r2/virtualization/docker/docker-entrypoint.sh \ alpine-its:latest "$@" # -p 0.0.0.0:80:80 \ # -p 0.0.0.0:443:443 \ -- GitLab From 82f3c286bef2330afd52698b636602cdbd0c8c9a Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 25 May 2023 11:30:18 +0200 Subject: [PATCH 087/178] Use Ubuntu 22.04 for dockerization --- virtualization/docker-dev/Dockerfile | 2 +- virtualization/docker-dev/Dockerfile.stfubuntu | 2 +- virtualization/docker/Dockerfile | 10 +++------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/virtualization/docker-dev/Dockerfile b/virtualization/docker-dev/Dockerfile index 28dc2b3..97536f6 100644 --- a/virtualization/docker-dev/Dockerfile +++ b/virtualization/docker-dev/Dockerfile @@ -1,4 +1,4 @@ -FROM stfubuntu:20.04 +FROM stfubuntu:22.04 LABEL ETSI ITS LABEL description="TS.ITS Docker Image" diff --git a/virtualization/docker-dev/Dockerfile.stfubuntu b/virtualization/docker-dev/Dockerfile.stfubuntu index 9fa6645..2805900 100644 --- a/virtualization/docker-dev/Dockerfile.stfubuntu +++ b/virtualization/docker-dev/Dockerfile.stfubuntu @@ -1,4 +1,4 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 LABEL ETSI CTI LABEL description="STF Docker Ubuntu image" diff --git a/virtualization/docker/Dockerfile b/virtualization/docker/Dockerfile index edd7205..0c2425c 100644 --- a/virtualization/docker/Dockerfile +++ b/virtualization/docker/Dockerfile @@ -35,23 +35,19 @@ ENV TTCN3_DIR=/home/etsi/frameworks/titan/titan.core/Install ENV PATH=$TTCN3_DIR/bin:$PATH \ LD_LIBRARY_PATH=$TTCN3_DIR/lib:$LD_LIBRARY_PATH -# Set flags +# Set flags & Build Titan RUN \ echo "ALPINE_LINUX=yes" > Makefile.personal && \ echo "TTCN3_DIR=$TTCN3_DIR" >> Makefile.personal && \ echo "JNI=no" >> Makefile.personal && \ echo "GUI=no" >> Makefile.personal && \ - echo "DEBUG=no" >> Makefile.personal || exit 1 - -# Build Titan -RUN \ - sed --in-place 's/LINUX_LIBS := -lxml2/LINUX_LIBS := -lxml2 -lpthread/g' ./core/Makefile && \ + echo "DEBUG=no" >> Makefile.personal || exit 1 && \ make install && make clean || exit 1 WORKDIR /home/etsi/dev EXPOSE 80/tcp 443/tcp 12340-12349/udp -ENTRYPOINT ["/home/etsi/dev/TS.ITS/virtualization/docker/docker-entrypoint.sh"] +ENTRYPOINT ["/home/etsi/dev/TS.ITS_r2/virtualization/docker/docker-entrypoint.sh"] CMD ["help"] -- GitLab From a5000c97c69bdffa6067f0e2bbf0c245cd0db711 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 25 May 2023 12:29:03 +0200 Subject: [PATCH 088/178] Bug fixes in docker-dev --- virtualization/docker-dev/home/etc/init.d/30-asn1c.sh | 2 ++ virtualization/docker-dev/home/etc/init.d/45-certgen.sh | 3 +++ 2 files changed, 5 insertions(+) diff --git a/virtualization/docker-dev/home/etc/init.d/30-asn1c.sh b/virtualization/docker-dev/home/etc/init.d/30-asn1c.sh index 43527e7..474b0fe 100755 --- a/virtualization/docker-dev/home/etc/init.d/30-asn1c.sh +++ b/virtualization/docker-dev/home/etc/init.d/30-asn1c.sh @@ -10,6 +10,8 @@ cd ./asn1c sed --in-place 's/AC_CHECK_INCLUDES_DEFAULT/#AC_CHECK_INCLUDES_DEFAULT/g' ./configure.ac autoreconf -iv && ./configure --prefix=${HOME} && make install || exit 1 +export ASN1CDIR=`pwd` + cd ${HOME} exit 0 diff --git a/virtualization/docker-dev/home/etc/init.d/45-certgen.sh b/virtualization/docker-dev/home/etc/init.d/45-certgen.sh index 273c18c..125225b 100755 --- a/virtualization/docker-dev/home/etc/init.d/45-certgen.sh +++ b/virtualization/docker-dev/home/etc/init.d/45-certgen.sh @@ -3,12 +3,15 @@ #set -e set -vx +echo $ASN1CDIR + echo -e "*****************************\n* Build ETSI ITS certificate generation tools \n*****************************\n" cd ${HOME}/dev || exit 1 git clone --recurse-submodules --branch release2 https://forge.etsi.org/rep/ITS/itscertgen.git ./itscertgen cd ./itscertgen sed --in-place 's/\-fillabs2//g' ./certgen/asncodec/Makefile +sed --in-place 's/\-fillabs2//g' ./certgen/asncodec/Makefile make && cd - || exit 1 echo -e "*****************************\n* Generate ETSI ITS certificates \n*****************************\n" -- GitLab From 290d8685a2ca43e0248b214b8308a870eb96b51f Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 25 May 2023 13:00:59 +0200 Subject: [PATCH 089/178] Bug fixes in docker-dev --- titan-test-system-framework | 2 +- ttcn/AtsIPv6OverGeoNetworking | 2 +- .../module | 2 +- .../docker-dev/home/etc/init.d/30-asn1c.sh | 2 - .../docker-dev/home/etc/init.d/40-ttf024.sh | 51 ++----------------- .../docker-dev/home/etc/init.d/45-certgen.sh | 3 +- 6 files changed, 7 insertions(+), 55 deletions(-) diff --git a/titan-test-system-framework b/titan-test-system-framework index 554d6b6..ffbcefb 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit 554d6b6b3ce1e51d88267a3c946cd30caac97a55 +Subproject commit ffbcefb5dbe4bc24623f5738c8a64153c8f3599d diff --git a/ttcn/AtsIPv6OverGeoNetworking b/ttcn/AtsIPv6OverGeoNetworking index 566cc49..3e3e90c 160000 --- a/ttcn/AtsIPv6OverGeoNetworking +++ b/ttcn/AtsIPv6OverGeoNetworking @@ -1 +1 @@ -Subproject commit 566cc49bf1b16aa64c26dea40268c8cd0c7acab6 +Subproject commit 3e3e90ce7c54d4b3ab1e2551778d8d52aade506c diff --git a/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module b/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module index affc1fa..732c993 160000 --- a/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module +++ b/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module @@ -1 +1 @@ -Subproject commit affc1fa4e6497ff138b79a958caa79532fba6857 +Subproject commit 732c9934d2c87966b5ab9ba4e6886f353d5e4ace diff --git a/virtualization/docker-dev/home/etc/init.d/30-asn1c.sh b/virtualization/docker-dev/home/etc/init.d/30-asn1c.sh index 474b0fe..43527e7 100755 --- a/virtualization/docker-dev/home/etc/init.d/30-asn1c.sh +++ b/virtualization/docker-dev/home/etc/init.d/30-asn1c.sh @@ -10,8 +10,6 @@ cd ./asn1c sed --in-place 's/AC_CHECK_INCLUDES_DEFAULT/#AC_CHECK_INCLUDES_DEFAULT/g' ./configure.ac autoreconf -iv && ./configure --prefix=${HOME} && make install || exit 1 -export ASN1CDIR=`pwd` - cd ${HOME} exit 0 diff --git a/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh b/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh index 4930909..9eac8c1 100755 --- a/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh +++ b/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh @@ -6,56 +6,11 @@ set -vx echo -e "*****************************\n* Checkout TS.ITS sources\n*****************************\n" cd ${HOME}/dev || exit 1 -git clone --recurse-submodules --single-branch --branch ttf_t024 https://forge.etsi.org/rep/ITS/TS.ITS.git TS.ITS || exit 1 +git clone --recurse-submodules https://forge.etsi.org/rep/ITS/TS.ITS.git TS.ITS || exit 1 cd ./TS.ITS || exit 1 -for i in `find ./ttcn -type d -name "Ats*"` -do - cd $i - git checkout devel2 - cd - -done -for i in `find ./ttcn/Ats* -type d -name "asn1"` -do - cd $i - git checkout testing2 -# if [ -f ETSI-ITS-CDD.asn ] -# then -# ln -sf ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn || exit 1 -# elif [ -f IVIM-PDU-Descriptions.asn ] -# then -# ln -sf IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn || exit 1 -# ln -sf MAPEM-PDU-Descriptions.asn MAPEM_PDU_Descriptions.asn || exit 1 -# ln -sf RTCMEM-PDU-Descriptions.asn RTCMEM_PDU_Descriptions.asn || exit 1 -# ln -sf SPATEM-PDU-Descriptions.asn SPATEM_PDU_Descriptions.asn || exit 1 -# ln -sf SREM-PDU-Descriptions.asn SREM_PDU_Descriptions.asn || exit 1 -# ln -sf SSEM-PDU-Descriptions.asn SSEM_PDU_Descriptions.asn || exit 1 -# ln -sf iso-patched/'ISO14906(2018)EfcDsrcApplicationv6-patched.asn' iso-patched/EfcDsrcApplication.asn || exit 1 -# ln -sf iso-patched/'ISO14906(2018)EfcDsrcGenericv7-patched.asn' iso-patched/EfcDsrcGeneric.asn || exit 1 -# ln -sf iso-patched/ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn iso-patched/ElectronicRegistrationIdentificationVehicleDataModule.asn || exit 1 -# ln -sf iso-patched/ISO14823-missing.asn iso-patched/GDD.asn || exit 1 -# fi - SUB_DIRS=`find . -type d` - if [ "SUB_DIRS" != "" ] - then - for j in $SUB_DIRS - do - cd $j - git checkout testing2 - cd - - done - fi - cd - -done -cd ${HOME}/dev/TS.ITS/titan-test-system-framework -git checkout devel -cd ./ttcn/LibHttp -ln -sf module_its.mk module.mk -cd ${HOME}/dev/TS.ITS/ttcn/LibIts -git checkout devel2 +git checkout ttf_t024 || exit 1 -cd ${HOME}/dev/TS.ITS/ -cp ./ttcn/patch_lib_common/module.mk ./ttcn/LibCommon/ -cp ./ttcn/patch_lib_common/ttcn/* ./ttcn/LibCommon/ttcn +./switch_its_r2.sh || exit 1 echo -e "*****************************\n* Setup environment\n*****************************\n" cd ${HOME}/dev/TS.ITS/scripts diff --git a/virtualization/docker-dev/home/etc/init.d/45-certgen.sh b/virtualization/docker-dev/home/etc/init.d/45-certgen.sh index 125225b..03c23ac 100755 --- a/virtualization/docker-dev/home/etc/init.d/45-certgen.sh +++ b/virtualization/docker-dev/home/etc/init.d/45-certgen.sh @@ -3,7 +3,7 @@ #set -e set -vx -echo $ASN1CDIR +export ASN1CDIR=/home/etsi/frameworks/asn1c echo -e "*****************************\n* Build ETSI ITS certificate generation tools \n*****************************\n" cd ${HOME}/dev || exit 1 @@ -11,7 +11,6 @@ cd ${HOME}/dev || exit 1 git clone --recurse-submodules --branch release2 https://forge.etsi.org/rep/ITS/itscertgen.git ./itscertgen cd ./itscertgen sed --in-place 's/\-fillabs2//g' ./certgen/asncodec/Makefile -sed --in-place 's/\-fillabs2//g' ./certgen/asncodec/Makefile make && cd - || exit 1 echo -e "*****************************\n* Generate ETSI ITS certificates \n*****************************\n" -- GitLab From 32594b680b2ab9b8bf9202c1008f3924b9088830 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 25 May 2023 14:50:25 +0200 Subject: [PATCH 090/178] Reorganize code due to new floag compiler -H in last version of TITAN. No backward compatibility --- ccsrc/EncDec/LibItsCam_Encdec.cc | 42 +- ccsrc/EncDec/LibItsDenm_Encdec.cc | 22 + ccsrc/EncDec/LibItsIvim_Encdec.cc | 22 + ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc | 45 ++ ccsrc/EncDec/LibItsMbr_Encdec.cc | 50 +- ccsrc/EncDec/LibItsPki_Encdec.cc | 742 +++++++++++------------ ccsrc/EncDec/LibItsRtcmem_Encdec.cc | 22 + ccsrc/EncDec/LibItsSecurity_Encdec.cc | 99 +++ ccsrc/EncDec/LibItsSremSsem_Encdec.cc | 44 ++ ccsrc/EncDec/module.mk | 6 +- config.mk | 2 +- etc/AtsCAM/AtsCAM.cfg | 2 +- 12 files changed, 678 insertions(+), 420 deletions(-) diff --git a/ccsrc/EncDec/LibItsCam_Encdec.cc b/ccsrc/EncDec/LibItsCam_Encdec.cc index 9aeba6e..caeaf62 100644 --- a/ccsrc/EncDec/LibItsCam_Encdec.cc +++ b/ccsrc/EncDec/LibItsCam_Encdec.cc @@ -163,27 +163,27 @@ namespace LibItsCam__EncdecDeclarations { return 0; } - // BITSTRING fx__enc__CAM(const CAM__PDU__Descriptions::CAM &p_cam) { - // loggers::get_instance().log_msg(">>> fx__enc__CAM: ", p_cam); - - // cam_codec codec; - // OCTETSTRING os; - // codec.encode(p_cam, os); - // return oct2bit(os); - // } - - // INTEGER fx__dec__CAM(BITSTRING &b, CAM__PDU__Descriptions::CAM &p) { - // loggers::get_instance().log(">>> fx__dec__CAM"); - // cam_codec codec; - // OCTETSTRING is = bit2oct(b); - - // if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { - // loggers::get_instance().warning("fx__dec__CAM: -1 result code was returned"); - // return -1; - // } - - // return 0; - // } + BITSTRING fx__enc__CAM(const CAM__PDU__Descriptions::CAM &p_cam) { + loggers::get_instance().log_msg(">>> fx__enc__CAM: ", p_cam); + + cam_codec codec; + OCTETSTRING os; + codec.encode(p_cam, os); + return oct2bit(os); + } + + INTEGER fx__dec__CAM(BITSTRING &b, CAM__PDU__Descriptions::CAM &p) { + loggers::get_instance().log(">>> fx__dec__CAM"); + cam_codec codec; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + loggers::get_instance().warning("fx__dec__CAM: -1 result code was returned"); + return -1; + } + + return 0; + } BITSTRING fx__enc__UtCamInitialize(const LibItsCam__TypesAndValues::UtCamInitialize &p_utCamInitialize) { loggers::get_instance().log_msg(">>> fx__enc__UtCamInitialize: ", p_utCamInitialize); diff --git a/ccsrc/EncDec/LibItsDenm_Encdec.cc b/ccsrc/EncDec/LibItsDenm_Encdec.cc index bcf4f7a..1c159ca 100644 --- a/ccsrc/EncDec/LibItsDenm_Encdec.cc +++ b/ccsrc/EncDec/LibItsDenm_Encdec.cc @@ -162,6 +162,28 @@ namespace LibItsDenm__EncdecDeclarations { return 0; } + BITSTRING fx__enc__DENM(const DENM__PDU__Descriptions::DENM &p_denm) { + loggers::get_instance().log_msg(">>> fx__enc__DENM: ", p_denm); + + denm_codec codec; + OCTETSTRING os; + codec.encode(p_denm, os); + return oct2bit(os); + } + + INTEGER fx__dec__DENM(BITSTRING &b, DENM__PDU__Descriptions::DENM &p) { + loggers::get_instance().log(">>> fx__dec__DENM"); + denm_codec codec; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + loggers::get_instance().warning("fx__dec__DENM: -1 result code was returned"); + return -1; + } + + return 0; + } + BITSTRING fx__enc__UtDenmInitialize(const LibItsDenm__TypesAndValues::UtDenmInitialize &p_utDenmInitialize) { loggers::get_instance().log_msg(">>> fx__enc__UtDenmInitialize: ", p_utDenmInitialize); diff --git a/ccsrc/EncDec/LibItsIvim_Encdec.cc b/ccsrc/EncDec/LibItsIvim_Encdec.cc index 7648d2c..35c8572 100644 --- a/ccsrc/EncDec/LibItsIvim_Encdec.cc +++ b/ccsrc/EncDec/LibItsIvim_Encdec.cc @@ -163,6 +163,28 @@ namespace LibItsIvim__EncdecDeclarations { return 0; } + BITSTRING fx__enc__IVIM(const IVIM__PDU__Descriptions::IVIM &p_ivim) { + loggers::get_instance().log_msg(">>> fx__enc__IVIM: ", p_ivim); + + ivim_codec codec; + OCTETSTRING os; + codec.encode(p_ivim, os); + return oct2bit(os); + } + + INTEGER fx__dec__IVIM(BITSTRING &b, IVIM__PDU__Descriptions::IVIM &p) { + loggers::get_instance().log(">>> fx__dec__IVIM"); + ivim_codec codec; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + loggers::get_instance().warning("fx__dec__IVIM: -1 result code was returned"); + return -1; + } + + return 0; + } + BITSTRING fx__enc__UtIvimInitialize(const LibItsIvim__TypesAndValues::UtIvimInitialize &p_utIvimInitialize) { loggers::get_instance().log_msg(">>> fx__enc__UtIvimInitialize: ", p_utIvimInitialize); diff --git a/ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc b/ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc index 3307136..737ab2d 100644 --- a/ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc +++ b/ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc @@ -164,6 +164,28 @@ namespace LibItsMapemSpatem__EncdecDeclarations { return 0; } + BITSTRING fx__enc__MAPEM(const MAPEM__PDU__Descriptions::MAPEM &p_mapem) { + loggers::get_instance().log_msg(">>> fx__enc__Mapem: ", p_mapem); + + mapem_codec codec; + OCTETSTRING os; + codec.encode(p_mapem, os); + return oct2bit(os); + } + + INTEGER fx__dec__MAPEM(BITSTRING &b, MAPEM__PDU__Descriptions::MAPEM &p) { + loggers::get_instance().log(">>> fx__dec__Mapem"); + mapem_codec codec; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + loggers::get_instance().warning("fx__dec__Mapem: -1 result code was returned"); + return -1; + } + + return 0; + } + /**************************************************** * @desc External function to encode a SpatemReq type * @param value to encode @@ -320,6 +342,29 @@ namespace LibItsMapemSpatem__EncdecDeclarations { return 0; } + BITSTRING fx__enc__SPATEM(const SPATEM__PDU__Descriptions::SPATEM &p_spatem) { + loggers::get_instance().log_msg(">>> fx__enc__Spatem: ", p_spatem); + + spatem_codec codec; + OCTETSTRING os; + codec.encode(p_spatem, os); + return oct2bit(os); + } + + INTEGER fx__dec__SPATEM(BITSTRING &b, SPATEM__PDU__Descriptions::SPATEM &p_spatem) { + loggers::get_instance().log(">>> fx__dec__Spatem"); + + spatem_codec codec; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p_spatem) == -1) { + loggers::get_instance().warning("fx__dec__Spatem: -1 result code was returned"); + return -1; + } + + return 0; + } + BITSTRING fx__enc__UtMapemSpatemInitialize(const LibItsMapemSpatem__TypesAndValues::UtMapemSpatemInitialize &p_utMapemSpatemInitialize) { loggers::get_instance().log_msg(">>> fx__enc__UtMapemSpatemInitialize: ", p_utMapemSpatemInitialize); diff --git a/ccsrc/EncDec/LibItsMbr_Encdec.cc b/ccsrc/EncDec/LibItsMbr_Encdec.cc index e986538..19dcd57 100644 --- a/ccsrc/EncDec/LibItsMbr_Encdec.cc +++ b/ccsrc/EncDec/LibItsMbr_Encdec.cc @@ -1,36 +1,36 @@ -// #include "LibItsMbr_EncdecDeclarations.hh" +#include "LibItsMbr_EncdecDeclarations.hh" -// #include "etsi_ts103759_data_codec.hh" +#include "etsi_ts103759_data_codec.hh" -// #include "loggers.hh" +#include "loggers.hh" -// namespace LibItsMbr__EncdecDeclarations { +namespace LibItsMbr__EncdecDeclarations { -// BITSTRING fx__enc__EtsiTs103759Data(const EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_103759_data) { -// loggers::get_instance().log_msg(">>> fx__enc__EtsiTs103759Data: ", p_etsi_ts_103759_data); + BITSTRING fx__enc__EtsiTs103759Data(const EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_103759_data) { + loggers::get_instance().log_msg(">>> fx__enc__EtsiTs103759Data: ", p_etsi_ts_103759_data); -// etsi_ts103759_data_codec codec; -// OCTETSTRING os; -// if (codec.encode(p_etsi_ts_103759_data, os) == -1) { -// loggers::get_instance().warning("fx__enc__EtsiTs103759Data: -1 result code was returned"); -// return int2bit(0, 1); -// } + etsi_ts103759_data_codec codec; + OCTETSTRING os; + if (codec.encode(p_etsi_ts_103759_data, os) == -1) { + loggers::get_instance().warning("fx__enc__EtsiTs103759Data: -1 result code was returned"); + return int2bit(0, 1); + } -// return oct2bit(os); -// } + return oct2bit(os); + } -// INTEGER fx__dec__EtsiTs103759Data(BITSTRING &b, EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_103759_data) { -// loggers::get_instance().log_msg(">>> fx__dec__EtsiTs103759Data: ", b); + INTEGER fx__dec__EtsiTs103759Data(BITSTRING &b, EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_103759_data) { + loggers::get_instance().log_msg(">>> fx__dec__EtsiTs103759Data: ", b); -// etsi_ts103759_data_codec codec; -// OCTETSTRING is = bit2oct(b); -// if (codec.decode(is, p_etsi_ts_103759_data) == -1) { -// loggers::get_instance().warning("fx__dec__EtsiTs103759Data: -1 result code was returned"); -// return -1; -// } + etsi_ts103759_data_codec codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_etsi_ts_103759_data) == -1) { + loggers::get_instance().warning("fx__dec__EtsiTs103759Data: -1 result code was returned"); + return -1; + } -// return 0; -// } + return 0; + } -// } // End of namespace LibItsMbr__EncdecDeclarations +} // End of namespace LibItsMbr__EncdecDeclarations diff --git a/ccsrc/EncDec/LibItsPki_Encdec.cc b/ccsrc/EncDec/LibItsPki_Encdec.cc index 7ccda75..f65adc4 100644 --- a/ccsrc/EncDec/LibItsPki_Encdec.cc +++ b/ccsrc/EncDec/LibItsPki_Encdec.cc @@ -1,371 +1,371 @@ -// #include "LibItsPki_EncdecDeclarations.hh" - -// #include "etsi_ts102941_base_types_public_keys.hh" -// #include "etsi_ts102941_data_codec.hh" -// #include "etsi_ts102941_data_content_codec.hh" -// #include "etsi_ts102941_types_authorization_inner_request.hh" -// #include "etsi_ts102941_types_authorization_inner_response.hh" -// #include "etsi_ts102941_types_authorization_shared_at_request.hh" -// #include "etsi_ts102941_types_authorization_validation_request.hh" -// #include "etsi_ts102941_types_authorization_validation_response.hh" -// #include "etsi_ts102941_types_enrolment_inner_request.hh" -// #include "etsi_ts102941_types_enrolment_inner_response.hh" -// #include "ieee_1609dot2_base_types_public_encryption_key.hh" -// #include "ieee_1609dot2_base_types_public_verification_key.hh" - -// #include "etsi_ts102941_trust_lists_ctl_format.hh" - -// #include "loggers.hh" - -// namespace LibItsPki__EncdecDeclarations { - -// BITSTRING fx__enc__EtsiTs102941Data(const EtsiTs102941MessagesCa::EtsiTs102941Data &p_etsi_ts_102941_data) { -// loggers::get_instance().log_msg(">>> fx__enc__EtsiTs102941Data: ", p_etsi_ts_102941_data); - -// etsi_ts102941_data_codec codec; -// OCTETSTRING os; -// if (codec.encode(p_etsi_ts_102941_data, os) == -1) { -// loggers::get_instance().warning("fx__enc__EtsiTs102941Data: -1 result code was returned"); -// return int2bit(0, 1); -// } - -// return oct2bit(os); -// } - -// INTEGER fx__dec__EtsiTs102941Data(BITSTRING &b, EtsiTs102941MessagesCa::EtsiTs102941Data &p_etsi_ts_102941_data) { -// loggers::get_instance().log_msg(">>> fx__dec__EtsiTs102941Data: ", b); - -// etsi_ts102941_data_codec codec; -// OCTETSTRING is = bit2oct(b); -// if (codec.decode(is, p_etsi_ts_102941_data) == -1) { -// loggers::get_instance().warning("fx__dec__EtsiTs102941Data: -1 result code was returned"); -// return -1; -// } - -// return 0; -// } - -// BITSTRING fx__enc__EtsiTs102941DataContent(const EtsiTs102941MessagesCa::EtsiTs102941DataContent &p_etsi_ts_102941_data_content) { -// loggers::get_instance().log_msg(">>> fx__enc__EtsiTs102941DataContent: ", p_etsi_ts_102941_data_content); - -// etsi_ts102941_data_content_codec codec; -// OCTETSTRING os; -// if (codec.encode(p_etsi_ts_102941_data_content, os) == -1) { -// loggers::get_instance().warning("fx__enc__EtsiTs102941DataContent: -1 result code was returned"); -// return int2bit(0, 1); -// } - -// return oct2bit(os); -// } - -// INTEGER fx__dec__EtsiTs102941DataContent(BITSTRING &b, EtsiTs102941MessagesCa::EtsiTs102941DataContent &p_etsi_ts_102941_data_content) { -// loggers::get_instance().log_msg(">>> fx__dec__EtsiTs102941DataContent: ", b); - -// etsi_ts102941_data_content_codec codec; -// OCTETSTRING is = bit2oct(b); -// if (codec.decode(is, p_etsi_ts_102941_data_content) == -1) { -// loggers::get_instance().warning("fx__dec__EtsiTs102941DataContent: -1 result code was returned"); -// return -1; -// } - -// return 0; -// } - -// BITSTRING fx__enc__InnerEcRequest(const EtsiTs102941TypesEnrolment::InnerEcRequest &p_inner_request) { -// loggers::get_instance().log_msg(">>> fx_enc_InnerEcRequest: ", p_inner_request); - -// etsi_ts102941_types_enrolment_inner_request codec; -// OCTETSTRING os; -// if (codec.encode(p_inner_request, os) == -1) { -// loggers::get_instance().warning("fx_enc_InnerEcRequest: -1 result code was returned"); -// return int2bit(0, 1); -// } - -// return oct2bit(os); -// } - -// INTEGER fx__dec__InnerEcRequest(BITSTRING &b, EtsiTs102941TypesEnrolment::InnerEcRequest &p_inner_request) { -// loggers::get_instance().log_msg(">>> fx__dec__InnerEcRequest: ", b); - -// etsi_ts102941_types_enrolment_inner_request codec; -// OCTETSTRING is = bit2oct(b); -// if (codec.decode(is, p_inner_request) == -1) { -// loggers::get_instance().warning("fx__dec__InnerEcRequest: -1 result code was returned"); -// return -1; -// } - -// loggers::get_instance().log_msg("<<< fx__dec__InnerEcRequest: ", p_inner_request); -// return 0; -// } - -// BITSTRING fx__enc__InnerEcResponse(const EtsiTs102941TypesEnrolment::InnerEcResponse &p_inner_response) { -// loggers::get_instance().log_msg(">>> fx__enc__InnerEcResponse: ", p_inner_response); - -// etsi_ts102941_types_enrolment_inner_response codec; -// OCTETSTRING os; -// if (codec.encode(p_inner_response, os) == -1) { -// loggers::get_instance().warning("fx__enc__InnerEcResponse: -1 result code was returned"); -// return int2bit(0, 1); -// } - -// return oct2bit(os); -// } - -// INTEGER fx__dec__InnerEcResponse(BITSTRING &b, EtsiTs102941TypesEnrolment::InnerEcResponse &p_inner_response) { -// loggers::get_instance().log_msg(">>> fx__dec__InnerEcResponse: ", b); - -// etsi_ts102941_types_enrolment_inner_response codec; -// OCTETSTRING is = bit2oct(b); -// if (codec.decode(is, p_inner_response) == -1) { -// loggers::get_instance().warning("fx__dec__InnerEcResponse: -1 result code was returned"); -// return -1; -// } - -// loggers::get_instance().log_msg("<<< fx__dec__InnerEcResponse: ", p_inner_response); -// return 0; -// } - -// BITSTRING fx__enc__InnerAtRequest(const EtsiTs102941TypesAuthorization::InnerAtRequest &p_inner_request) { -// loggers::get_instance().log_msg(">>> fx_enc_InnerAtRequest: ", p_inner_request); - -// etsi_ts102941_types_authorization_inner_request codec; -// OCTETSTRING os; -// if (codec.encode(p_inner_request, os) == -1) { -// loggers::get_instance().warning("fx_enc_InnerAtRequest: -1 result code was returned"); -// return int2bit(0, 1); -// } - -// return oct2bit(os); -// } - -// INTEGER fx__dec__InnerAtRequest(BITSTRING &b, EtsiTs102941TypesAuthorization::InnerAtRequest &p_inner_request) { -// loggers::get_instance().log_msg(">>> fx__dec__InnerAtRequest: ", b); - -// etsi_ts102941_types_authorization_inner_request codec; -// OCTETSTRING is = bit2oct(b); -// if (codec.decode(is, p_inner_request) == -1) { -// loggers::get_instance().warning("fx__dec__InnerAtRequest: -1 result code was returned"); -// return -1; -// } - -// loggers::get_instance().log_msg("<<< fx__dec__InnerAtRequest: ", p_inner_request); -// return 0; -// } - -// BITSTRING fx__enc__InnerAtResponse(const EtsiTs102941TypesAuthorization::InnerAtResponse &p_inner_response) { -// loggers::get_instance().log_msg(">>> fx__enc__InnerAtResponse: ", p_inner_response); - -// etsi_ts102941_types_authorization_inner_response codec; -// OCTETSTRING os; -// if (codec.encode(p_inner_response, os) == -1) { -// loggers::get_instance().warning("fx__enc__InnerAtResponse: -1 result code was returned"); -// return int2bit(0, 1); -// } - -// return oct2bit(os); -// } - -// INTEGER fx__dec__InnerAtResponse(BITSTRING &b, EtsiTs102941TypesAuthorization::InnerAtResponse &p_inner_response) { -// loggers::get_instance().log_msg(">>> fx__dec__InnerAtResponse: ", b); - -// etsi_ts102941_types_authorization_inner_response codec; -// OCTETSTRING is = bit2oct(b); -// if (codec.decode(is, p_inner_response) == -1) { -// loggers::get_instance().warning("fx__dec__InnerAtResponse: -1 result code was returned"); -// return -1; -// } - -// loggers::get_instance().log_msg("<<< fx__dec__InnerAtResponse: ", p_inner_response); -// return 0; -// } - -// BITSTRING fx__enc__SharedAtRequest(EtsiTs102941TypesAuthorization::SharedAtRequest const &p_shared_at) { -// loggers::get_instance().log_msg(">>> fx__enc__SharedAtRequest: ", p_shared_at); - -// etsi_ts102941_types_authorization_shared_at_request codec; -// OCTETSTRING os; -// if (codec.encode(p_shared_at, os) == -1) { -// loggers::get_instance().warning("fx__enc__SharedAtRequest: -1 result code was returned"); -// return int2bit(0, 1); -// } - -// return oct2bit(os); -// } - -// INTEGER fx__dec__SharedAtRequest(BITSTRING &b, EtsiTs102941TypesAuthorization::SharedAtRequest &p_shared_at) { -// loggers::get_instance().log_msg(">>> fx__dec__SharedAtRequest: ", b); - -// etsi_ts102941_types_authorization_shared_at_request codec; -// OCTETSTRING is = bit2oct(b); -// if (codec.decode(is, p_shared_at) == -1) { -// loggers::get_instance().warning("fx__dec__SharedAtRequest: -1 result code was returned"); -// return -1; -// } - -// loggers::get_instance().log_msg("<<< fx__dec__SharedAtRequest: ", p_shared_at); -// return 0; -// } - -// BITSTRING fx__enc__AuthorizationValidationRequest(EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationRequest const &p_shared_at) { -// loggers::get_instance().log_msg(">>> fx__enc__AuthorizationValidationRequest: ", p_shared_at); - -// etsi_ts102941_types_authorization_validation_request codec; -// OCTETSTRING os; -// if (codec.encode(p_shared_at, os) == -1) { -// loggers::get_instance().warning("fx__enc__AuthorizationValidationRequest: -1 result code was returned"); -// return int2bit(0, 1); -// } - -// return oct2bit(os); -// } - -// INTEGER fx__dec__AuthorizationValidationRequest(BITSTRING &b, EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationRequest &p_shared_at) { -// loggers::get_instance().log_msg(">>> fx__dec__AuthorizationValidationRequest: ", b); - -// etsi_ts102941_types_authorization_validation_request codec; -// OCTETSTRING is = bit2oct(b); -// if (codec.decode(is, p_shared_at) == -1) { -// loggers::get_instance().warning("fx__dec__AuthorizationValidationRequest: -1 result code was returned"); -// return -1; -// } - -// loggers::get_instance().log_msg("<<< fx__dec__AuthorizationValidationRequest: ", p_shared_at); -// return 0; -// } - -// BITSTRING fx__enc__AuthorizationValidationResponse(EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationResponse const &p_shared_at) { -// loggers::get_instance().log_msg(">>> fx__enc__AuthorizationValidationResponse: ", p_shared_at); - -// etsi_ts102941_types_authorization_validation_response codec; -// OCTETSTRING os; -// if (codec.encode(p_shared_at, os) == -1) { -// loggers::get_instance().warning("fx__enc__AuthorizationValidationResponse: -1 result code was returned"); -// return int2bit(0, 1); -// } - -// return oct2bit(os); -// } - -// INTEGER fx__dec__AuthorizationValidationResponse(BITSTRING &b, EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationResponse &p_shared_at) { -// loggers::get_instance().log_msg(">>> fx__dec__AuthorizationValidationResponse: ", b); - -// etsi_ts102941_types_authorization_validation_response codec; -// OCTETSTRING is = bit2oct(b); -// if (codec.decode(is, p_shared_at) == -1) { -// loggers::get_instance().warning("fx__dec__AuthorizationValidationResponse: -1 result code was returned"); -// return -1; -// } - -// loggers::get_instance().log_msg("<<< fx__dec__AuthorizationValidationResponse: ", p_shared_at); -// return 0; -// } - -// BITSTRING fx__enc__PublicKeys(EtsiTs102941BaseTypes::PublicKeys const &p_public_keys) { -// loggers::get_instance().log_msg(">>> fx__enc__PublicKeys: ", p_public_keys); - -// etsi_ts102941_base_types_public_keys codec; -// OCTETSTRING os; -// if (codec.encode(p_public_keys, os) == -1) { -// loggers::get_instance().warning("fx__enc__PublicKeys: -1 result code was returned"); -// return int2bit(0, 1); -// } - -// return oct2bit(os); -// } - -// INTEGER fx__dec__PublicKeys(BITSTRING &b, EtsiTs102941BaseTypes::PublicKeys &p_public_keys) { -// loggers::get_instance().log_msg(">>> fx__dec__PublicKeys: ", b); - -// etsi_ts102941_base_types_public_keys codec; -// OCTETSTRING is = bit2oct(b); -// if (codec.decode(is, p_public_keys) == -1) { -// loggers::get_instance().warning("fx__dec__PublicKeys: -1 result code was returned"); -// return -1; -// } - -// loggers::get_instance().log_msg("<<< fx__dec__PublicKeys: ", p_public_keys); -// return 0; -// } - -// BITSTRING fx__enc__PublicVerificationKey(Ieee1609Dot2BaseTypes::PublicVerificationKey const &p_public_verification_key) { -// loggers::get_instance().log_msg(">>> fx__enc__PublicVerificationKey: ", p_public_verification_key); - -// ieee_1609dot2_base_types_public_verification_key codec; -// OCTETSTRING os; -// if (codec.encode(p_public_verification_key, os) == -1) { -// loggers::get_instance().warning("fx__enc__PublicVerificationKey: -1 result code was returned"); -// return int2bit(0, 1); -// } - -// return oct2bit(os); -// } - -// INTEGER fx__dec__PublicVerificationKey(BITSTRING &b, Ieee1609Dot2BaseTypes::PublicVerificationKey &p_public_verification_key) { -// loggers::get_instance().log_msg(">>> fx__dec__PublicVerificationKey: ", b); - -// ieee_1609dot2_base_types_public_verification_key codec; -// OCTETSTRING is = bit2oct(b); -// if (codec.decode(is, p_public_verification_key) == -1) { -// loggers::get_instance().warning("fx__dec__PublicVerificationKey: -1 result code was returned"); -// return -1; -// } - -// loggers::get_instance().log_msg("<<< fx__dec__PublicVerificationKey: ", p_public_verification_key); -// return 0; -// } - -// BITSTRING fx__enc__PublicEncryptionKey(Ieee1609Dot2BaseTypes::PublicEncryptionKey const &p_public_encryption_key) { -// loggers::get_instance().log_msg(">>> fx__enc__PublicEncryptionKey: ", p_public_encryption_key); - -// ieee_1609dot2_base_types_public_encryption_key codec; -// OCTETSTRING os; -// if (codec.encode(p_public_encryption_key, os) == -1) { -// loggers::get_instance().warning("fx__enc__PublicEncryptionKey: -1 result code was returned"); -// return int2bit(0, 1); -// } - -// return oct2bit(os); -// } - -// INTEGER fx__dec__PublicEncryptionKey(BITSTRING &b, Ieee1609Dot2BaseTypes::PublicEncryptionKey &p_public_encryption_key) { -// loggers::get_instance().log_msg(">>> fx__dec__PublicEncryptionKey: ", b); - -// ieee_1609dot2_base_types_public_encryption_key codec; -// OCTETSTRING is = bit2oct(b); -// if (codec.decode(is, p_public_encryption_key) == -1) { -// loggers::get_instance().warning("fx__dec__PublicEncryptionKey: -1 result code was returned"); -// return -1; -// } - -// loggers::get_instance().log_msg("<<< fx__dec__PublicEncryptionKey: ", p_public_encryption_key); -// return 0; -// } - -// BITSTRING fx__enc__CtlFormat(EtsiTs102941TrustLists::CtlFormat const &p_ctl_format) { -// loggers::get_instance().log_msg(">>> fx__enc__CtlFormat: ", p_ctl_format); - -// etsi_ts102941_trust_lists_ctl_format codec; -// OCTETSTRING os; -// if (codec.encode(p_ctl_format, os) == -1) { -// loggers::get_instance().warning("fx__enc__CtlFormat: -1 result code was returned"); -// return int2bit(0, 1); -// } - -// return oct2bit(os); -// } - -// INTEGER fx__dec__CtlFormat(BITSTRING &b, EtsiTs102941TrustLists::CtlFormat &p_ctl_format) { -// loggers::get_instance().log_msg(">>> fx__dec__CtlFormat: ", b); - -// etsi_ts102941_trust_lists_ctl_format codec; -// OCTETSTRING is = bit2oct(b); -// if (codec.decode(is, p_ctl_format) == -1) { -// loggers::get_instance().warning("fx__dec__CtlFormat: -1 result code was returned"); -// return -1; -// } - -// loggers::get_instance().log_msg("<<< fx__dec__CtlFormat: ", p_ctl_format); -// return 0; -// } - -// } // End of namespace LibItsPki__EncdecDeclarations +#include "LibItsPki_EncdecDeclarations.hh" + +#include "etsi_ts102941_base_types_public_keys.hh" +#include "etsi_ts102941_data_codec.hh" +#include "etsi_ts102941_data_content_codec.hh" +#include "etsi_ts102941_types_authorization_inner_request.hh" +#include "etsi_ts102941_types_authorization_inner_response.hh" +#include "etsi_ts102941_types_authorization_shared_at_request.hh" +#include "etsi_ts102941_types_authorization_validation_request.hh" +#include "etsi_ts102941_types_authorization_validation_response.hh" +#include "etsi_ts102941_types_enrolment_inner_request.hh" +#include "etsi_ts102941_types_enrolment_inner_response.hh" +#include "ieee_1609dot2_base_types_public_encryption_key.hh" +#include "ieee_1609dot2_base_types_public_verification_key.hh" + +#include "etsi_ts102941_trust_lists_ctl_format.hh" + +#include "loggers.hh" + +namespace LibItsPki__EncdecDeclarations { + + BITSTRING fx__enc__EtsiTs102941Data(const EtsiTs102941MessagesCa::EtsiTs102941Data &p_etsi_ts_102941_data) { + loggers::get_instance().log_msg(">>> fx__enc__EtsiTs102941Data: ", p_etsi_ts_102941_data); + + etsi_ts102941_data_codec codec; + OCTETSTRING os; + if (codec.encode(p_etsi_ts_102941_data, os) == -1) { + loggers::get_instance().warning("fx__enc__EtsiTs102941Data: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__EtsiTs102941Data(BITSTRING &b, EtsiTs102941MessagesCa::EtsiTs102941Data &p_etsi_ts_102941_data) { + loggers::get_instance().log_msg(">>> fx__dec__EtsiTs102941Data: ", b); + + etsi_ts102941_data_codec codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_etsi_ts_102941_data) == -1) { + loggers::get_instance().warning("fx__dec__EtsiTs102941Data: -1 result code was returned"); + return -1; + } + + return 0; + } + + BITSTRING fx__enc__EtsiTs102941DataContent(const EtsiTs102941MessagesCa::EtsiTs102941DataContent &p_etsi_ts_102941_data_content) { + loggers::get_instance().log_msg(">>> fx__enc__EtsiTs102941DataContent: ", p_etsi_ts_102941_data_content); + + etsi_ts102941_data_content_codec codec; + OCTETSTRING os; + if (codec.encode(p_etsi_ts_102941_data_content, os) == -1) { + loggers::get_instance().warning("fx__enc__EtsiTs102941DataContent: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__EtsiTs102941DataContent(BITSTRING &b, EtsiTs102941MessagesCa::EtsiTs102941DataContent &p_etsi_ts_102941_data_content) { + loggers::get_instance().log_msg(">>> fx__dec__EtsiTs102941DataContent: ", b); + + etsi_ts102941_data_content_codec codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_etsi_ts_102941_data_content) == -1) { + loggers::get_instance().warning("fx__dec__EtsiTs102941DataContent: -1 result code was returned"); + return -1; + } + + return 0; + } + + BITSTRING fx__enc__InnerEcRequest(const EtsiTs102941TypesEnrolment::InnerEcRequest &p_inner_request) { + loggers::get_instance().log_msg(">>> fx_enc_InnerEcRequest: ", p_inner_request); + + etsi_ts102941_types_enrolment_inner_request codec; + OCTETSTRING os; + if (codec.encode(p_inner_request, os) == -1) { + loggers::get_instance().warning("fx_enc_InnerEcRequest: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__InnerEcRequest(BITSTRING &b, EtsiTs102941TypesEnrolment::InnerEcRequest &p_inner_request) { + loggers::get_instance().log_msg(">>> fx__dec__InnerEcRequest: ", b); + + etsi_ts102941_types_enrolment_inner_request codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_inner_request) == -1) { + loggers::get_instance().warning("fx__dec__InnerEcRequest: -1 result code was returned"); + return -1; + } + + loggers::get_instance().log_msg("<<< fx__dec__InnerEcRequest: ", p_inner_request); + return 0; + } + + BITSTRING fx__enc__InnerEcResponse(const EtsiTs102941TypesEnrolment::InnerEcResponse &p_inner_response) { + loggers::get_instance().log_msg(">>> fx__enc__InnerEcResponse: ", p_inner_response); + + etsi_ts102941_types_enrolment_inner_response codec; + OCTETSTRING os; + if (codec.encode(p_inner_response, os) == -1) { + loggers::get_instance().warning("fx__enc__InnerEcResponse: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__InnerEcResponse(BITSTRING &b, EtsiTs102941TypesEnrolment::InnerEcResponse &p_inner_response) { + loggers::get_instance().log_msg(">>> fx__dec__InnerEcResponse: ", b); + + etsi_ts102941_types_enrolment_inner_response codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_inner_response) == -1) { + loggers::get_instance().warning("fx__dec__InnerEcResponse: -1 result code was returned"); + return -1; + } + + loggers::get_instance().log_msg("<<< fx__dec__InnerEcResponse: ", p_inner_response); + return 0; + } + + BITSTRING fx__enc__InnerAtRequest(const EtsiTs102941TypesAuthorization::InnerAtRequest &p_inner_request) { + loggers::get_instance().log_msg(">>> fx_enc_InnerAtRequest: ", p_inner_request); + + etsi_ts102941_types_authorization_inner_request codec; + OCTETSTRING os; + if (codec.encode(p_inner_request, os) == -1) { + loggers::get_instance().warning("fx_enc_InnerAtRequest: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__InnerAtRequest(BITSTRING &b, EtsiTs102941TypesAuthorization::InnerAtRequest &p_inner_request) { + loggers::get_instance().log_msg(">>> fx__dec__InnerAtRequest: ", b); + + etsi_ts102941_types_authorization_inner_request codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_inner_request) == -1) { + loggers::get_instance().warning("fx__dec__InnerAtRequest: -1 result code was returned"); + return -1; + } + + loggers::get_instance().log_msg("<<< fx__dec__InnerAtRequest: ", p_inner_request); + return 0; + } + + BITSTRING fx__enc__InnerAtResponse(const EtsiTs102941TypesAuthorization::InnerAtResponse &p_inner_response) { + loggers::get_instance().log_msg(">>> fx__enc__InnerAtResponse: ", p_inner_response); + + etsi_ts102941_types_authorization_inner_response codec; + OCTETSTRING os; + if (codec.encode(p_inner_response, os) == -1) { + loggers::get_instance().warning("fx__enc__InnerAtResponse: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__InnerAtResponse(BITSTRING &b, EtsiTs102941TypesAuthorization::InnerAtResponse &p_inner_response) { + loggers::get_instance().log_msg(">>> fx__dec__InnerAtResponse: ", b); + + etsi_ts102941_types_authorization_inner_response codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_inner_response) == -1) { + loggers::get_instance().warning("fx__dec__InnerAtResponse: -1 result code was returned"); + return -1; + } + + loggers::get_instance().log_msg("<<< fx__dec__InnerAtResponse: ", p_inner_response); + return 0; + } + + BITSTRING fx__enc__SharedAtRequest(EtsiTs102941TypesAuthorization::SharedAtRequest const &p_shared_at) { + loggers::get_instance().log_msg(">>> fx__enc__SharedAtRequest: ", p_shared_at); + + etsi_ts102941_types_authorization_shared_at_request codec; + OCTETSTRING os; + if (codec.encode(p_shared_at, os) == -1) { + loggers::get_instance().warning("fx__enc__SharedAtRequest: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__SharedAtRequest(BITSTRING &b, EtsiTs102941TypesAuthorization::SharedAtRequest &p_shared_at) { + loggers::get_instance().log_msg(">>> fx__dec__SharedAtRequest: ", b); + + etsi_ts102941_types_authorization_shared_at_request codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_shared_at) == -1) { + loggers::get_instance().warning("fx__dec__SharedAtRequest: -1 result code was returned"); + return -1; + } + + loggers::get_instance().log_msg("<<< fx__dec__SharedAtRequest: ", p_shared_at); + return 0; + } + + BITSTRING fx__enc__AuthorizationValidationRequest(EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationRequest const &p_shared_at) { + loggers::get_instance().log_msg(">>> fx__enc__AuthorizationValidationRequest: ", p_shared_at); + + etsi_ts102941_types_authorization_validation_request codec; + OCTETSTRING os; + if (codec.encode(p_shared_at, os) == -1) { + loggers::get_instance().warning("fx__enc__AuthorizationValidationRequest: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__AuthorizationValidationRequest(BITSTRING &b, EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationRequest &p_shared_at) { + loggers::get_instance().log_msg(">>> fx__dec__AuthorizationValidationRequest: ", b); + + etsi_ts102941_types_authorization_validation_request codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_shared_at) == -1) { + loggers::get_instance().warning("fx__dec__AuthorizationValidationRequest: -1 result code was returned"); + return -1; + } + + loggers::get_instance().log_msg("<<< fx__dec__AuthorizationValidationRequest: ", p_shared_at); + return 0; + } + + BITSTRING fx__enc__AuthorizationValidationResponse(EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationResponse const &p_shared_at) { + loggers::get_instance().log_msg(">>> fx__enc__AuthorizationValidationResponse: ", p_shared_at); + + etsi_ts102941_types_authorization_validation_response codec; + OCTETSTRING os; + if (codec.encode(p_shared_at, os) == -1) { + loggers::get_instance().warning("fx__enc__AuthorizationValidationResponse: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__AuthorizationValidationResponse(BITSTRING &b, EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationResponse &p_shared_at) { + loggers::get_instance().log_msg(">>> fx__dec__AuthorizationValidationResponse: ", b); + + etsi_ts102941_types_authorization_validation_response codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_shared_at) == -1) { + loggers::get_instance().warning("fx__dec__AuthorizationValidationResponse: -1 result code was returned"); + return -1; + } + + loggers::get_instance().log_msg("<<< fx__dec__AuthorizationValidationResponse: ", p_shared_at); + return 0; + } + + BITSTRING fx__enc__PublicKeys(EtsiTs102941BaseTypes::PublicKeys const &p_public_keys) { + loggers::get_instance().log_msg(">>> fx__enc__PublicKeys: ", p_public_keys); + + etsi_ts102941_base_types_public_keys codec; + OCTETSTRING os; + if (codec.encode(p_public_keys, os) == -1) { + loggers::get_instance().warning("fx__enc__PublicKeys: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__PublicKeys(BITSTRING &b, EtsiTs102941BaseTypes::PublicKeys &p_public_keys) { + loggers::get_instance().log_msg(">>> fx__dec__PublicKeys: ", b); + + etsi_ts102941_base_types_public_keys codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_public_keys) == -1) { + loggers::get_instance().warning("fx__dec__PublicKeys: -1 result code was returned"); + return -1; + } + + loggers::get_instance().log_msg("<<< fx__dec__PublicKeys: ", p_public_keys); + return 0; + } + + BITSTRING fx__enc__PublicVerificationKey(Ieee1609Dot2BaseTypes::PublicVerificationKey const &p_public_verification_key) { + loggers::get_instance().log_msg(">>> fx__enc__PublicVerificationKey: ", p_public_verification_key); + + ieee_1609dot2_base_types_public_verification_key codec; + OCTETSTRING os; + if (codec.encode(p_public_verification_key, os) == -1) { + loggers::get_instance().warning("fx__enc__PublicVerificationKey: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__PublicVerificationKey(BITSTRING &b, Ieee1609Dot2BaseTypes::PublicVerificationKey &p_public_verification_key) { + loggers::get_instance().log_msg(">>> fx__dec__PublicVerificationKey: ", b); + + ieee_1609dot2_base_types_public_verification_key codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_public_verification_key) == -1) { + loggers::get_instance().warning("fx__dec__PublicVerificationKey: -1 result code was returned"); + return -1; + } + + loggers::get_instance().log_msg("<<< fx__dec__PublicVerificationKey: ", p_public_verification_key); + return 0; + } + + BITSTRING fx__enc__PublicEncryptionKey(Ieee1609Dot2BaseTypes::PublicEncryptionKey const &p_public_encryption_key) { + loggers::get_instance().log_msg(">>> fx__enc__PublicEncryptionKey: ", p_public_encryption_key); + + ieee_1609dot2_base_types_public_encryption_key codec; + OCTETSTRING os; + if (codec.encode(p_public_encryption_key, os) == -1) { + loggers::get_instance().warning("fx__enc__PublicEncryptionKey: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__PublicEncryptionKey(BITSTRING &b, Ieee1609Dot2BaseTypes::PublicEncryptionKey &p_public_encryption_key) { + loggers::get_instance().log_msg(">>> fx__dec__PublicEncryptionKey: ", b); + + ieee_1609dot2_base_types_public_encryption_key codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_public_encryption_key) == -1) { + loggers::get_instance().warning("fx__dec__PublicEncryptionKey: -1 result code was returned"); + return -1; + } + + loggers::get_instance().log_msg("<<< fx__dec__PublicEncryptionKey: ", p_public_encryption_key); + return 0; + } + + BITSTRING fx__enc__CtlFormat(EtsiTs102941TrustLists::CtlFormat const &p_ctl_format) { + loggers::get_instance().log_msg(">>> fx__enc__CtlFormat: ", p_ctl_format); + + etsi_ts102941_trust_lists_ctl_format codec; + OCTETSTRING os; + if (codec.encode(p_ctl_format, os) == -1) { + loggers::get_instance().warning("fx__enc__CtlFormat: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__CtlFormat(BITSTRING &b, EtsiTs102941TrustLists::CtlFormat &p_ctl_format) { + loggers::get_instance().log_msg(">>> fx__dec__CtlFormat: ", b); + + etsi_ts102941_trust_lists_ctl_format codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_ctl_format) == -1) { + loggers::get_instance().warning("fx__dec__CtlFormat: -1 result code was returned"); + return -1; + } + + loggers::get_instance().log_msg("<<< fx__dec__CtlFormat: ", p_ctl_format); + return 0; + } + +} // End of namespace LibItsPki__EncdecDeclarations diff --git a/ccsrc/EncDec/LibItsRtcmem_Encdec.cc b/ccsrc/EncDec/LibItsRtcmem_Encdec.cc index fc9d47e..d1c722f 100644 --- a/ccsrc/EncDec/LibItsRtcmem_Encdec.cc +++ b/ccsrc/EncDec/LibItsRtcmem_Encdec.cc @@ -163,6 +163,28 @@ namespace LibItsRtcmem__EncdecDeclarations { return 0; } + BITSTRING fx__enc__RTCMEM(const RTCMEM__PDU__Descriptions::RTCMEM &p_rtcmem) { + loggers::get_instance().log_msg(">>> fx__enc__RTCMEM: ", p_rtcmem); + + RtcmemCodec codec; + OCTETSTRING os; + codec.encode(p_rtcmem, os); + return oct2bit(os); + } + + INTEGER fx__dec__RTCMEM(BITSTRING &b, RTCMEM__PDU__Descriptions::RTCMEM &p) { + loggers::get_instance().log(">>> fx__dec__RTCMEM"); + RtcmemCodec codec; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + loggers::get_instance().warning("fx__dec__RTCMEM: -1 result code was returned"); + return -1; + } + + return 0; + } + BITSTRING fx__enc__UtRtcmemInitialize(const LibItsRtcmem__TypesAndValues::UtRtcmemInitialize &p_utRtcmemInitialize) { loggers::get_instance().log_msg(">>> fx__enc__UtRtcmemInitialize: ", p_utRtcmemInitialize); diff --git a/ccsrc/EncDec/LibItsSecurity_Encdec.cc b/ccsrc/EncDec/LibItsSecurity_Encdec.cc index ed483e3..ac6219d 100644 --- a/ccsrc/EncDec/LibItsSecurity_Encdec.cc +++ b/ccsrc/EncDec/LibItsSecurity_Encdec.cc @@ -1,9 +1,108 @@ #include "LibItsSecurity_EncdecDeclarations.hh" +#include "etsi_ts103097_certificate_codec.hh" +#include "etsi_ts103097_data_codec.hh" +#include "etsi_ts103097_tobesigned_certificate_codec.hh" +#include "etsi_ts103097_tobesigned_data_codec.hh" + #include "loggers.hh" namespace LibItsSecurity__EncdecDeclarations { + BITSTRING fx__enc__CertificateBase(Ieee1609Dot2::CertificateBase const &p_cert) { + loggers::get_instance().log_msg(">>> fx__enc__CertificateBase: ", p_cert); + + etsi_ts103097_certificate_codec codec; + OCTETSTRING os; + if (codec.encode(p_cert, os) == -1) { + loggers::get_instance().warning("fx__enc__CertificateBase: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__CertificateBase(BITSTRING &b, Ieee1609Dot2::CertificateBase &p_cert) { + loggers::get_instance().log_msg(">>> fx__dec__CertificateBase: ", b); + + etsi_ts103097_certificate_codec codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_cert) == -1) { + loggers::get_instance().warning("fx__dec__CertificateBase: -1 result code was returned"); + return -1; + } + + loggers::get_instance().log_msg("<<< fx__dec__CertificateBase: ", p_cert); + return 0; + } + + BITSTRING fx__enc__ToBeSignedCertificate(const Ieee1609Dot2::ToBeSignedCertificate &p_toBeSignedCertificate) { + loggers::get_instance().log_msg(">>> fx__enc__ToBeSignedCertificate: ", p_toBeSignedCertificate); + + etsi_ts103097_tobesigned_certificate_codec codec; + OCTETSTRING os; + if (codec.encode(p_toBeSignedCertificate, os) == -1) { + loggers::get_instance().warning("fx__enc__ToBeSignedCertificate: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + BITSTRING fx__enc__Ieee1609Dot2Data(const Ieee1609Dot2::Ieee1609Dot2Data &p__ieee1609Dot2Data) { + loggers::get_instance().log_msg(">>> fx__enc__Ieee1609Dot2Data: ", p__ieee1609Dot2Data); + + etsi_ts103097_data_codec codec; + OCTETSTRING os; + if (codec.encode(p__ieee1609Dot2Data, os) == -1) { + loggers::get_instance().warning("fx__enc__Ieee1609Dot2Data: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__Ieee1609Dot2Data(BITSTRING &p__data, Ieee1609Dot2::Ieee1609Dot2Data &p__ieee1609Dot2Data) { + loggers::get_instance().log_msg(">>> fx__dec__Ieee1609Dot2Data: ", p__data); + + etsi_ts103097_data_codec codec; + OCTETSTRING is = bit2oct(p__data); + if (codec.decode(is, p__ieee1609Dot2Data) == -1) { + loggers::get_instance().warning("fx__dec__Ieee1609Dot2Data: -1 result code was returned"); + return -1; + } + + loggers::get_instance().log_msg("<<< fx__dec__Ieee1609Dot2Data: ", p__ieee1609Dot2Data); + return 0; + } + + BITSTRING fx__enc__Ieee1609Dot2ToBeSignedData(const Ieee1609Dot2::ToBeSignedData &p__toBeSignedData) { + loggers::get_instance().log_msg(">>> fx__enc__Ieee1609Dot2ToBeSignedData: ", p__toBeSignedData); + + etsi_ts103097_tobesigned_data_codec codec; + OCTETSTRING os; + if (codec.encode(p__toBeSignedData, os) == -1) { + loggers::get_instance().warning("fx__enc__Ieee1609Dot2ToBeSignedData: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__Ieee1609Dot2ToBeSignedData(BITSTRING &p__data, Ieee1609Dot2::ToBeSignedData &p__toBeSignedData) { + loggers::get_instance().log_msg(">>> fx__dec__Ieee1609Dot2ToBeSignedData: ", p__data); + + etsi_ts103097_tobesigned_data_codec codec; + OCTETSTRING is = bit2oct(p__data); + if (codec.decode(is, p__toBeSignedData) == -1) { + loggers::get_instance().warning("fx__dec__Ieee1609Dot2ToBeSignedData: -1 result code was returned"); + return -1; + } + + loggers::get_instance().log_msg("<<< fx__dec__Ieee1609Dot2ToBeSignedData: ", p__toBeSignedData); + return 0; + } + BITSTRING fx__enc__SspCAM(const LibItsSecurity__TypesAndValues::SspCAM &p__ssp) { loggers::get_instance().log_msg(">>> fx__enc__SspCAM: ", p__ssp); diff --git a/ccsrc/EncDec/LibItsSremSsem_Encdec.cc b/ccsrc/EncDec/LibItsSremSsem_Encdec.cc index eccaea1..bfec6b0 100644 --- a/ccsrc/EncDec/LibItsSremSsem_Encdec.cc +++ b/ccsrc/EncDec/LibItsSremSsem_Encdec.cc @@ -187,6 +187,28 @@ namespace LibItsSremSsem__EncdecDeclarations { return 0; } + BITSTRING fx__enc__SREM(const SREM__PDU__Descriptions::SREM &p_srem) { + loggers::get_instance().log_msg(">>> fx__enc__SREM: ", p_srem); + + SremCodec codec; + OCTETSTRING os; + codec.encode(p_srem, os); + return oct2bit(os); + } + + INTEGER fx__dec__SREM(BITSTRING &b, SREM__PDU__Descriptions::SREM &p) { + loggers::get_instance().log(">>> fx__dec__SREM"); + SremCodec codec; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + loggers::get_instance().warning("fx__dec__Srem: -1 result code was returned"); + return -1; + } + + return 0; + } + /**************************************************** * @desc External function to encode a SsemReq type * @param value to encode @@ -366,6 +388,28 @@ namespace LibItsSremSsem__EncdecDeclarations { return 0; } + BITSTRING fx__enc__SSEM(const SSEM__PDU__Descriptions::SSEM &p_ssem) { + loggers::get_instance().log_msg(">>> fx__enc__SSEM: ", p_ssem); + + SsemCodec codec; + OCTETSTRING os; + codec.encode(p_ssem, os); + return oct2bit(os); + } + + INTEGER fx__dec__SSEM(BITSTRING &b, SSEM__PDU__Descriptions::SSEM &p_ssem) { + loggers::get_instance().log(">>> fx__dec__SSEM"); + SsemCodec codec; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p_ssem) == -1) { + loggers::get_instance().warning("fx__dec__Ssem: -1 result code was returned"); + return -1; + } + + return 0; + } + BITSTRING fx__enc__UtSremInitialize(const LibItsSremSsem__TypesAndValues::UtSremInitialize &p_utSremInitialize) { loggers::get_instance().log_msg(">>> fx__enc__UtSremInitialize: ", p_utSremInitialize); diff --git a/ccsrc/EncDec/module.mk b/ccsrc/EncDec/module.mk index 5965f3c..18f4be8 100644 --- a/ccsrc/EncDec/module.mk +++ b/ccsrc/EncDec/module.mk @@ -28,7 +28,9 @@ sources += \ LibItsMapemSpatem_Encdec.cc \ LibItsSremSsem_Encdec.cc \ LibItsRtcmem_Encdec.cc \ - LibItsIvim_Encdec.cc + LibItsIvim_Encdec.cc \ + LibItsPki_Encdec.cc \ + LibItsMbr_Encdec.cc endif @@ -51,11 +53,13 @@ endif ifeq (AtsPki, $(ATS)) sources += \ LibItsBtp_Encdec.cc \ + LibItsPki_Encdec.cc \ LibItsCam_Encdec.cc endif ifeq (AtsMBR, $(ATS)) sources += \ LibItsBtp_Encdec.cc \ + LibItsMbr_Encdec.cc \ LibItsCam_Encdec.cc endif diff --git a/config.mk b/config.mk index 2f77c63..b9dad9f 100644 --- a/config.mk +++ b/config.mk @@ -1,4 +1,4 @@ -TTCN3_COMPILER_OPTIONS := -d -e -f -g -j -l -L -R -U none -x -X +TTCN3_COMPILER_OPTIONS := -d -e -f -g -H -j -l -L -R -U none -x -X TTCN3_DIR := $(HOME)/frameworks/titan/titan.core/Install ASN1C_PATH := $(HOME)/frameworks/asn1c.denis #WPCAP_DLL_PATH := /cygdrive/c/windows/system32/npcap/wpcap.dll diff --git a/etc/AtsCAM/AtsCAM.cfg b/etc/AtsCAM/AtsCAM.cfg index e816b26..75f66ca 100644 --- a/etc/AtsCAM/AtsCAM.cfg +++ b/etc/AtsCAM/AtsCAM.cfg @@ -39,7 +39,7 @@ LogEventTypes:= Yes # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer -# ll_address : GeoNetworking address of the Test System +# ll_address : GeoNetworking address of the Test System for beaconing. To be align with CAM # latitude : Latitude of the Test System # longitude : Longitude of the Test System # beaconing : Set to 1 if GnLayer shall start beaconing -- GitLab From 485fd6c4bd8bcb81bb853a9dd5482b5a76548ece Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 25 May 2023 15:19:17 +0200 Subject: [PATCH 091/178] Add workaround to build docker image of TITAN --- titan-test-system-framework | 2 +- ttcn/AtsIPv6OverGeoNetworking | 2 +- .../module | 2 +- virtualization/docker/Dockerfile | 8 +++++++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/titan-test-system-framework b/titan-test-system-framework index ffbcefb..554d6b6 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit ffbcefb5dbe4bc24623f5738c8a64153c8f3599d +Subproject commit 554d6b6b3ce1e51d88267a3c946cd30caac97a55 diff --git a/ttcn/AtsIPv6OverGeoNetworking b/ttcn/AtsIPv6OverGeoNetworking index 3e3e90c..566cc49 160000 --- a/ttcn/AtsIPv6OverGeoNetworking +++ b/ttcn/AtsIPv6OverGeoNetworking @@ -1 +1 @@ -Subproject commit 3e3e90ce7c54d4b3ab1e2551778d8d52aade506c +Subproject commit 566cc49bf1b16aa64c26dea40268c8cd0c7acab6 diff --git a/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module b/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module index 732c993..affc1fa 160000 --- a/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module +++ b/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module @@ -1 +1 @@ -Subproject commit 732c9934d2c87966b5ab9ba4e6886f353d5e4ace +Subproject commit affc1fa4e6497ff138b79a958caa79532fba6857 diff --git a/virtualization/docker/Dockerfile b/virtualization/docker/Dockerfile index 0c2425c..57ae425 100644 --- a/virtualization/docker/Dockerfile +++ b/virtualization/docker/Dockerfile @@ -27,7 +27,8 @@ RUN \ && autoreconf -iv && ./configure --prefix=${HOME} && make install \ && cd - \ && mkdir -p titan && cd ./titan \ - && git clone https://github.com/eclipse/titan.core.git || exit 1 + && git clone https://gitlab.eclipse.org/eclipse/titan/titan.core.git || exit 1 + WORKDIR /home/etsi/frameworks/titan/titan.core/ # Setup ENV variables @@ -35,6 +36,11 @@ ENV TTCN3_DIR=/home/etsi/frameworks/titan/titan.core/Install ENV PATH=$TTCN3_DIR/bin:$PATH \ LD_LIBRARY_PATH=$TTCN3_DIR/lib:$LD_LIBRARY_PATH +# Workaround for issue in Settings.cc +RUN \ + sed --in-place '623s/NULL/false/' ./compiler2/Setting.cc \ + && sed --in-place '639s/NULL/false/' ./compiler2/Setting.cc || exit 1 + # Set flags & Build Titan RUN \ echo "ALPINE_LINUX=yes" > Makefile.personal && \ -- GitLab From fba2d7cda7f8911c2fead833994a6875a217e87d Mon Sep 17 00:00:00 2001 From: garciay Date: Fri, 26 May 2023 08:27:31 +0200 Subject: [PATCH 092/178] Add missing include header --- ccsrc/Protocols/Security/security_ecc.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ccsrc/Protocols/Security/security_ecc.hh b/ccsrc/Protocols/Security/security_ecc.hh index 0d56fae..3009b95 100644 --- a/ccsrc/Protocols/Security/security_ecc.hh +++ b/ccsrc/Protocols/Security/security_ecc.hh @@ -10,6 +10,8 @@ */ #pragma once +#include + #include #include #include -- GitLab From 2f4b901a3c38da434e1a4a21a2b2cb3c5543e7d6 Mon Sep 17 00:00:00 2001 From: garciay Date: Fri, 26 May 2023 09:12:05 +0200 Subject: [PATCH 093/178] Remove symbolic link due to difference of behaviour between Ubuntu 22.04 and previous Ubuntu versions --- switch_its_r2.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/switch_its_r2.sh b/switch_its_r2.sh index 09843e5..cf0c78c 100755 --- a/switch_its_r2.sh +++ b/switch_its_r2.sh @@ -19,19 +19,19 @@ do git checkout testing2 if [ -f ETSI-ITS-CDD.asn ] then - ln -sf ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn + ln -f ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn elif [ -f IVIM-PDU-Descriptions.asn ] then - ln -sf IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn - ln -sf MAPEM-PDU-Descriptions.asn MAPEM_PDU_Descriptions.asn - ln -sf RTCMEM-PDU-Descriptions.asn RTCMEM_PDU_Descriptions.asn - ln -sf SPATEM-PDU-Descriptions.asn SPATEM_PDU_Descriptions.asn - ln -sf SREM-PDU-Descriptions.asn SREM_PDU_Descriptions.asn - ln -sf SSEM-PDU-Descriptions.asn SSEM_PDU_Descriptions.asn - ln -sf iso-patched/'ISO14906(2018)EfcDsrcApplicationv6-patched.asn' iso-patched/EfcDsrcApplication.asn - ln -sf iso-patched/'ISO14906(2018)EfcDsrcGenericv7-patched.asn' iso-patched/EfcDsrcGeneric.asn - ln -sf iso-patched/ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn iso-patched/ElectronicRegistrationIdentificationVehicleDataModule.asn - ln -sf iso-patched/ISO14823-missing.asn iso-patched/GDD.asn + ln -f IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn + ln -f MAPEM-PDU-Descriptions.asn MAPEM_PDU_Descriptions.asn + ln -f RTCMEM-PDU-Descriptions.asn RTCMEM_PDU_Descriptions.asn + ln -f SPATEM-PDU-Descriptions.asn SPATEM_PDU_Descriptions.asn + ln -f SREM-PDU-Descriptions.asn SREM_PDU_Descriptions.asn + ln -f SSEM-PDU-Descriptions.asn SSEM_PDU_Descriptions.asn + ln -f iso-patched/'ISO14906(2018)EfcDsrcApplicationv6-patched.asn' iso-patched/EfcDsrcApplication.asn + ln -f iso-patched/'ISO14906(2018)EfcDsrcGenericv7-patched.asn' iso-patched/EfcDsrcGeneric.asn + ln -f iso-patched/ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn iso-patched/ElectronicRegistrationIdentificationVehicleDataModule.asn + ln -f iso-patched/ISO14823-missing.asn iso-patched/GDD.asn fi SUB_DIRS=`find . -type d` if [ "SUB_DIRS" != "" ] -- GitLab From d4ae87d6dea709c7c1484d31e46e8b1652398070 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 26 May 2023 09:27:01 +0200 Subject: [PATCH 094/178] Remove symbolic link due to difference of behaviour between Ubuntu 22.04 and previous Ubuntu versions --- switch_its_r2.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/switch_its_r2.sh b/switch_its_r2.sh index cf0c78c..f6e4724 100755 --- a/switch_its_r2.sh +++ b/switch_its_r2.sh @@ -19,19 +19,20 @@ do git checkout testing2 if [ -f ETSI-ITS-CDD.asn ] then - ln -f ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn + ln -sf ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn elif [ -f IVIM-PDU-Descriptions.asn ] then - ln -f IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn - ln -f MAPEM-PDU-Descriptions.asn MAPEM_PDU_Descriptions.asn - ln -f RTCMEM-PDU-Descriptions.asn RTCMEM_PDU_Descriptions.asn - ln -f SPATEM-PDU-Descriptions.asn SPATEM_PDU_Descriptions.asn - ln -f SREM-PDU-Descriptions.asn SREM_PDU_Descriptions.asn - ln -f SSEM-PDU-Descriptions.asn SSEM_PDU_Descriptions.asn - ln -f iso-patched/'ISO14906(2018)EfcDsrcApplicationv6-patched.asn' iso-patched/EfcDsrcApplication.asn - ln -f iso-patched/'ISO14906(2018)EfcDsrcGenericv7-patched.asn' iso-patched/EfcDsrcGeneric.asn - ln -f iso-patched/ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn iso-patched/ElectronicRegistrationIdentificationVehicleDataModule.asn - ln -f iso-patched/ISO14823-missing.asn iso-patched/GDD.asn + ln -sf IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn + ln -sf MAPEM-PDU-Descriptions.asn MAPEM_PDU_Descriptions.asn + ln -sf RTCMEM-PDU-Descriptions.asn RTCMEM_PDU_Descriptions.asn + ln -sf SPATEM-PDU-Descriptions.asn SPATEM_PDU_Descriptions.asn + ln -sf SREM-PDU-Descriptions.asn SREM_PDU_Descriptions.asn + ln -sf SSEM-PDU-Descriptions.asn SSEM_PDU_Descriptions.asn + cd ./iso-patched + ln -sf 'ISO14906(2018)EfcDsrcApplicationv6-patched.asn' EfcDsrcApplication.asn + ln -sf 'ISO14906(2018)EfcDsrcGenericv7-patched.asn' EfcDsrcGeneric.asn + ln -sf ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn ElectronicRegistrationIdentificationVehicleDataModule.asn + ln -sf ISO14823-missing.asn GDD.asn fi SUB_DIRS=`find . -type d` if [ "SUB_DIRS" != "" ] -- GitLab From c8923471ad29bf99cc87fa155231a65ceb999c00 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 26 May 2023 09:48:10 +0200 Subject: [PATCH 095/178] Bug fixed in script switch_its_r2.sh --- switch_its_r2.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/switch_its_r2.sh b/switch_its_r2.sh index f6e4724..ce1ad6e 100755 --- a/switch_its_r2.sh +++ b/switch_its_r2.sh @@ -33,6 +33,7 @@ do ln -sf 'ISO14906(2018)EfcDsrcGenericv7-patched.asn' EfcDsrcGeneric.asn ln -sf ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn ElectronicRegistrationIdentificationVehicleDataModule.asn ln -sf ISO14823-missing.asn GDD.asn + cd - fi SUB_DIRS=`find . -type d` if [ "SUB_DIRS" != "" ] -- GitLab From f56c56c79b28691b1928ddd30ea0a0cde4b4630a Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 6 Jun 2023 11:11:31 +0200 Subject: [PATCH 096/178] Review README file --- README.md | 248 ++++++++++++++++++++++++------------- scripts/devenv.bash.cygwin | 1 + scripts/devenv.bash.debian | 1 + scripts/devenv.bash.ubuntu | 4 +- ttcn/AtsMBR | 2 +- 5 files changed, 168 insertions(+), 88 deletions(-) diff --git a/README.md b/README.md index 474a847..0c87788 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # ETSI ITS protocols project -## General Information +## Introduction -This repositories contains the test specifications and test adapter code for ETSI ITS protocols testing, Release 2. +This repositories contains the test specifications and test adapter code for ETSI ITS protocols testing, Release 1. ETSI ITS protocols project supports: - ETSI EN 302 637-2: "Intelligent Transport Systems (ITS); Vehicular Communications; Basic Set of Applications; Part 2: Specification of Cooperative Awareness Basic Service" - ETSI EN 102 637-3: "Intelligent Transport Systems (ITS); Vehicular Communications; Basic Set of Applications; Part 3: Specifications of Decentralized Environmental Notification Basic Service" @@ -12,28 +12,28 @@ ETSI ITS protocols project supports: - EN 302 636-4-1: "Intelligent Transport Systems (ITS); Vehicular Communications; GeoNetworking; Part 4: Geographical addressing and forwarding for point-to-point and point-to-multipoint communications; Sub-part 1: Media-Independent Functionality" In addition, it also support ITS Security as define by: -- ETSI TS 102 941: "Intelligent Transport Systems (ITS); Security; Trust and Privacy Management technical specification" -- ETSI TS 103 097: "Intelligent Transport Systems (ITS); Security; Security header and certificate formats". - ETSI TS 103 940: "Intelligent Transport Systems (ITS); Security; Security Architecture and Management". -- ETSI TS 103 759: "Intelligent Transport Systems (ITS); Security; isbehaviour Reporting service; Release 2" -- P1609.2™/D13: "Draft Standard for Wireless Access in Vehicular Environments – Security Services for Application and Management Messages" -- P1609.2.1™/D7: "Draft Standard for Wireless Access in Vehicular Environments (WAVE) – Certificate Management Interfaces for End Entities" +- ETSI TS 103 097: "Intelligent Transport Systems (ITS); Security; Security header and certificate formats". +- ETSI TS 102 941: "Intelligent Transport Systems (ITS); Security; Trust and Privacy Management technical specification" +- IEEE Std 1609.2™-2016: "IEEE Standard for Wireless Access in Vehicular Environments –Security Services for Applications and Management Messages" +- IEEE Std 1609.2a™-2017: "Standard for Wireless Access In Vehicular Environments – Security Services for Applications and Management Messages Amendment 1". -Contact information -Email at cti_support at etsi dot org +## Contact information -License -Unless specified otherwise, the content of this repository and the files contained are released under the ETSI Software License. -See the attached LICENSE file or visit -https://forge.etsi.org/etsi-software-license +Email at `cti_support` at `etsi` dot `org`. -## STFs / TTFs +## License + +Unless specified otherwise, the content of this repository and the files contained are released under the BSD-3-Clause license. +See the attached LICENSE file or visit https://forge.etsi.org/legal-matters. + +## STFs/TTFs The following STFs were or are currently involved in the evolutions of the ETSI ITS protocols project: -- STF 405, STF 422, STF 424, STF 455, STF 462, STF 481, STF 484, STF 507, STF 517, STF 525, STF 538, STF 545, STF 594, TTF T002, TTF T011, TTF T024 +- STF 405, STF 422, STF 424, STF 455, STF 462, STF 481, STF 484, STF 507, STF 517, STF 525, STF 538, STF 545, STF 594, TTF T002, TTF T011 -## Installation +# Installation The ETSI ITS protocols project builds and tests regularly on the following platforms: @@ -42,7 +42,7 @@ The ETSI ITS protocols project builds and tests regularly on the following platf Note: The [OpenSSL](https://www.openssl.org) version >= 1.1.1 is also required. -### How to do it? +## How to do it? They are three different methods: - Using [Vagrant](https://www.vagrantup.com/) @@ -54,63 +54,99 @@ How to choose one of these methods is depending of your host system. NOTE: In all case, if you want to setup an continuous integration process (e.g. Jenkins), Docker is the best choice. -#### The host system is Windows +### The host system is Windows The both methods require a virtual machine. You can use either VirtualBox or WMware. In this case, the easiest way is to use Vagrant. -#### The host system is Linux +### The host system is Linux Vagrant requires a virtual machine. You can use either VirtualBox or WMware. Docker does not need a virtual machine, so it is the more efficant way. +The following clauses describes four ways to build and deploy the CISE Test System: +- [Using TITAN compiler on a Docker image](#using-titan-compiler-on-a-docker-image) +- [Using development Docker image](#using-development-docker-image) +- [Using Vagrant](#using-vagrant) +- [From scratch](#from-scratch) + -### Using Vagrant +## Using TITAN compiler on a Docker image + +In this configuration, TITAN compiler is located on a Docker image and the sources and the outputs are located on the host. Pre-requisites on your host machine: -- Install [Virtualbox](https://www.virtualbox.org/manual/ch01.html) -- Install [Vagrant](https://www.vagrantup.com/intro/getting-started/) -- Install Vagrant plugin vagrant-vbguest -- Credentials to access [ETSI forge](https://forge.etsi.org/gitlab/users/sign_in) - - Set the environment variable USERNAME to your ETSI EOL account user name - - Set the environment variable PASSWORD to your ETSI EOL account password +- Install Docker -Procedure: -- On your host machine, open a command line session (PuTTY, DOS window...) -- From the ETSI ITS protocols project, clone the Vagrant folder -- In the file Vagrantfile, modify the tag config.vm.provision replacing & strings by your ETSI credentials -- In the Vagrant folder (./virtualization/vagrant), execute the following commands: +Procedure on the host machine: +- Open a Terminal +- Clone the ETSI ITS Test System ```sh -$ vagrant up --provider virtualbox --provision -... +$ git clone --recurse-submodules https://forge.etsi.org/gitlab/ITS/TS.ITS.git ./TS.ITS_r1 ``` -NOTE The creation and the installations will take some time to achieve -- Stop vagrant virtual machine +- Select the branch you need: + + ITS Release 1 ```sh -$ vagrant halt -... +$ git checkout devel ``` -- Update the file 'Vagrantfile' to match with your networks configuration -- Re-start the vagrant virtual machine and log to to the machine + ITS Release 2 ```sh -$ vagrant up -... -$ vagrant ssh +$ git checkout ttf_t024 ``` -- Switch to the next clause (Usage) +- From the ETSI ITS Test System root directory, build the Docker image executing the following commands: + +```sh +$ cd ./virtualization/docker +$ docker build --no-cache --tag alpine-its -f Dockerfile --force-rm . +$ docker images +``` + +To build the ITS Test Suite, execute the following command: + +```sh +$ ./docker-run.sh build +``` + +Possble other options are 'clean' to remove all the build outputs or 'rebuild' to force a build of the Test Suite after a 'clean'. + +To retrieve the list of the available test cases, execute the following command: + +```sh +$ ./docker-run.sh list +``` + +Before to execute the ITS Test Suite, prepare, edit and update the configuration file (e.g. CAM Test Suite): + +```sh +$ ln -sf ../../etc/AtsCam/AtsCAM_xxx.cf_ ../../etc/AtsCam/AtsCAN.cfg +$ vi ../../etc/AtsCAM/AtsCAM.cfg # To update it +``` + +To execute the ITS Test Suite, execute the following command: + +```sh +$ ./docker-run.sh run +``` + +Notes: +- The ITS Test System is listening on port 442 +- Updating the file etc/AtsCAM.cfg is about: +. Selecting the test(s) to be executed +. Updating value of PICs and PIXITs +. Updating HTTP port setting -NOTE The user password is vagrant. +## Using development Docker image -### Using Docker +In this configuration, the TITAN compiler, the sources and the outputs are located on the Docker image. Pre-requisites on your host machine: -- Install Virtualbox (For Windows host only) - Install Docker Procedure for a Windows host machine: @@ -142,7 +178,50 @@ $ ./virtualization/docker/run-container.sh - Switch to the next clause (Usage) -### From scratch +## Using Vagrant + +Pre-requisites on your host machine: +- Install [Virtualbox](https://www.virtualbox.org/manual/ch01.html) +- Install [Vagrant](https://www.vagrantup.com/intro/getting-started/) +- Install Vagrant plugin vagrant-vbguest +- Credentials to access [ETSI forge](https://forge.etsi.org/gitlab/users/sign_in) + - Set the environment variable USERNAME to your ETSI EOL account user name + - Set the environment variable PASSWORD to your ETSI EOL account password + +Procedure: +- On your host machine, open a command line session (PuTTY, DOS window...) +- From the ETSI ITS protocols project, clone the Vagrant folder +- In the file Vagrantfile, modify the tag config.vm.provision replacing & strings by your ETSI credentials +- In the Vagrant folder (./virtualization/vagrant), execute the following commands: + +```sh +$ vagrant up --provider virtualbox --provision +... +``` + +NOTE The creation and the installations will take some time to achieve +- Stop vagrant virtual machine + +```sh +$ vagrant halt +... +``` + +- Update the file 'Vagrantfile' to match with your networks configuration +- Re-start the vagrant virtual machine and log to to the machine + +```sh +$ vagrant up +... +$ vagrant ssh +``` + +- Switch to the next clause (Usage) + +NOTE The user password is vagrant. + + +## From scratch Pre-requisites: - Install Virtualbox @@ -203,47 +282,45 @@ Procedure: - $HOME/dev - $HOME/lib - In $HOME/frameworks, build the following package: - - asn1c, according the procedure specified [here](https://github.com/vlm/asn1c.git) - - Eclipse IDE for C/C++ Developers, according the procedure specified [here](https://www.eclipse.org/cdt/) + - asn1c, according the procedure specified [here](https://github.com/fillabs/asn1c.git) - TITAN, according the procedure specified [here](https://github.com/eclipse/titan.core) - - Import the TITAN plugin into your Eclipse IDE, according the procedure specified [here](https://github.com/eclipse/titan.core) + - Clone the ETSI ITS protocols project into $HOME/dev folder ```sh -$ git clone --recurse-submodules --single-branch https://forge.etsi.org/gitlab/ITS/TS.ITS.git -$ cd ${HOME}/dev/TS.ITS/ -$ cp ./ttcn/patch_lib_common/module.mk ./ttcn/LibCommon/ -$ cp ./ttcn/patch_lib_common/ttcn/* ./ttcn/LibCommon/ttcn +$ git clone --recurse-submodules https://forge.etsi.org/gitlab/ITS/TS.ITS.git ./TS.ITS_r1 +``` + +- Select the branch you need: + + ITS Release 1 (this example) +```sh +$ git checkout devel ``` -- Update your default environment with the content of the script $HOME/dev/TS.ITS/scripts/devenv.bash.ubuntu -- Switch to the next clause (Usage) + ITS Release 2 +```sh +$ git checkout ttf_t024 +``` -### Using Eclipse TITAN +- Apply the configuration -When cloning the ETSI ITS project, you can find two specific files: -- TS.ITS.tpd -- TS.ITS_Linux.tpd +```sh +$ ./switch_its_r2.sh +``` -These two files are used create the ETSI ITS project workspace on Eclipse TITAN. To do it, please follow the steps below: -- Start eclipse using a new workspace, (e.g. with the name workspace_titan) -- Select the menu option File/import -- In the Dialog box,select TITAN/Project from .tpd file -- Select the correct TS.ITS.tpd file and follow the instructions +- Build a test suite (e.g. AtsCAM) -NOTE: When the Eclipse TITAN workspace is created, you have to build manually the librairy 'libasn1c.so' following the commands below: ```sh -$ cd /TS.ITS -$ mkdir -p ./bin/asn1 -$ cd ./bin/asn1 -$ make CC=gcc -f ../../asn1/Makefile -$ rm *.cc # To prevent TITAN to import these .cc source files into our project +$ export ATS=AtsCAM && make ``` +- Switch to the next clause (Usage) + -## Usage +# Usage This clause describes how to compile and execute an Abstract Test Suite. The procedures below illustrate how to run the CAM test suite. The same procedures will apply for any other ETSI ITS test suite. @@ -255,7 +332,7 @@ Pre-requisites: - Your are logged as 'etsi' or 'vagrant' user - Procedure using TITAN command line (only): - Open several SSH session (PuTTY...) - - Change to the directory ~/dev/TS.ITS/ + - Change to the directory ~/dev/TS.ITS_r1/ - Modify the file config.mk according to your system: - On Linux, comment all the lines using the '#' character - On Windows, update the path accordingly @@ -274,7 +351,7 @@ $ make - To run the test suitem, execute the following command: ```sh -$ cd ~/dev/TS.ITS/scripts +$ cd ~/dev/TS.ITS_r1/scripts $ ../run_all.bash ... ``` @@ -288,7 +365,7 @@ This tool is located [here](https://forge.etsi.org/rep/ITS/itscertgen.git). ```sh cd ~/dev -$ git clone --recurse-submodules --single-branch https://forge.etsi.org/rep/ITS/itscertgen.git itscertgen +$ git clone --recurse-submodules https://forge.etsi.org/rep/ITS/itscertgen.git cd itscertgen make ``` @@ -308,21 +385,22 @@ $ make ### Generate the certificates -After applying the previous clause, change to the folder '~/dev/TS.ITS/data/certificates' and execute 'make' command: +After applying the previous clause, change to the folder '~/dev/TS.ITS_r1/data/certificates' and execute 'make' command: ``` -$ cd ~/dev/TS.ITS/data/certificates -$ make +$ cd ~/dev/TS.ITS_r1/data/certificates +$ CERTGEN=~/dev/itscertgen/ make +$ CERTGEN=~/dev/itscertgen/ make install ``` -The certificates will be located in the folder '~/dev/TS.ITS/data/certificates/certificates'. +The certificates will be located in the folder '~/dev/TS.ITS_r1/data/certificates/certificates'. To use this newly generated certificates, you shall update two parameters located in the TTCN-3 file LibItsSecurity_Pixits. These are: -- LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH, which is the path the certificates folder (e.g. LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "/home//dev/TS.ITS/data/certificates") +- LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH, which is the path the certificates folder (e.g. LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "/home//dev/TS.ITS_r1/data/certificates") - LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME, which is the name of the certificates folder (e.g. LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates") ### Modify or create new certificates -The folder '~/dev/TS.ITS/data/profiles' contains an XML file for each certificate to be generated. +The folder '~/dev/TS.ITS_r1/data/profiles' contains an XML file for each certificate to be generated. This XML file describes the certificate content (e.g. CERT_IUT_A_RCA.xml describes the root certificate for all CERT_IUT_A certificates). By modifying these files, you can change create new certificate with different geographical area, different validity periods or different SSPs. @@ -343,7 +421,7 @@ In this cases, the following parameters shall be modified to match the ITS devic In addition, the Test System shall be configured to support the security modifying the following settings as described below: - device_mode=1 - secured_mode=1 -- sec_db_path=/home//dev/TS.ITS/data/certificates/certificates +- sec_db_path=/home//dev/TS.ITS_r1/data/certificates/certificates ### ITS Protocol Test suites for Transport layer @@ -356,7 +434,7 @@ In this cases, the following parameters shall be modified to match the ITS devic In addition, the Test System shall be configured to support the security modifying the following settings as described below: - device_mode=1 - secured_mode=1 -- sec_db_path=/home//dev/TS.ITS/data/certificates/certificates +- sec_db_path=/home//dev/TS.ITS_r1/data/certificates/certificates ### ITS Protocol Test suites for Security @@ -394,13 +472,13 @@ In addition, the Test System shall be configured to support the security modifyi - secured_mode=0 -## Wireshark with support of ETSI ITS Protocols +# Wireshark with support of ETSI ITS Protocols The official version of Wireshark, supporting ETSI ITS Protocols, is available [here](https://www.wireshark.org/download.html). Some sample capture files are available [here](https://wiki.wireshark.org/SampleCaptures). -## How to Report a Bug +# How to Report a Bug The ETSI ITS protocols project is under constant development, so it is possible that you will encounter a bug while using it. Please report bugs at cti_support at etsi dot org. diff --git a/scripts/devenv.bash.cygwin b/scripts/devenv.bash.cygwin index de1ecdd..ac6b7df 100755 --- a/scripts/devenv.bash.cygwin +++ b/scripts/devenv.bash.cygwin @@ -15,6 +15,7 @@ set -o emacs export HOME_FRAMEWORKS=${HOME}/frameworks export HOME_LIB=${HOME}/lib export HOME_BIN=${HOME}/bin +export HOME_BIN=${HOME}/include export HOME_ETC=${HOME}/etc export HOME_TMP=${HOME}/tmp export HOME_DOCS=${HOME}/docs diff --git a/scripts/devenv.bash.debian b/scripts/devenv.bash.debian index 3954023..1068c3d 100755 --- a/scripts/devenv.bash.debian +++ b/scripts/devenv.bash.debian @@ -15,6 +15,7 @@ set -o emacs export HOME_FRAMEWORKS=${HOME}/frameworks export HOME_LIB=${HOME}/lib export HOME_BIN=${HOME}/bin +export HOME_BIN=${HOME}/include export HOME_ETC=${HOME}/etc export HOME_TMP=${HOME}/tmp export HOME_DOCS=${HOME}/docs diff --git a/scripts/devenv.bash.ubuntu b/scripts/devenv.bash.ubuntu index 254cc37..91c6930 100755 --- a/scripts/devenv.bash.ubuntu +++ b/scripts/devenv.bash.ubuntu @@ -2,8 +2,7 @@ # Turn on debug mode #set -vx - -set -e +#set -e # Colors and Prompt #export PS1="\w\$ " @@ -17,6 +16,7 @@ set -o emacs export HOME_FRAMEWORKS=${HOME}/frameworks export HOME_LIB=${HOME}/lib export HOME_BIN=${HOME}/bin +export HOME_BIN=${HOME}/include export HOME_ETC=${HOME}/etc export HOME_TMP=${HOME}/tmp export HOME_DOCS=${HOME}/docs diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index fdc5adb..4c952bd 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit fdc5adbbaaa08e5b583eb90cb66aff370f9310bd +Subproject commit 4c952bd04cdbecdc17abe1f4001849f0247525b9 -- GitLab From 13ab8b8cd81a6762f2dc00e9d3b4871e2c976bdb Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 22 Jun 2023 09:54:59 +0200 Subject: [PATCH 097/178] Add new certificate profiles --- .../profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml | 40 ++++++++++++++++++ .../profiles/CERT_IUT_A_AT_NOCAM.xml | 35 ++++++++++++++++ .../CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml | 36 ++++++++++++++++ .../profiles/CERT_IUT_A_AT_PAST.xml | 36 ++++++++++++++++ etc/AtsMBR/AtsMBR.cfg | 41 ++++++++++++++++--- etc/AtsPki/AtsPki_Etas.cfg_ | 14 ++++++- ttcn/AtsCAM | 2 +- ttcn/AtsMBR | 2 +- ttcn/AtsSecurity | 2 +- 9 files changed, 199 insertions(+), 9 deletions(-) create mode 100644 data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_AT_PAST.xml diff --git a/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml b/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml new file mode 100644 index 0000000..55ed102 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml @@ -0,0 +1,40 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 01 FF FC + 01 FF FF FF + + + + + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml b/data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml new file mode 100644 index 0000000..90db044 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml @@ -0,0 +1,35 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 01 FF FF FF + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml b/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml new file mode 100644 index 0000000..9908e61 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml @@ -0,0 +1,36 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 01 FD FC + 01 FF FF FF + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml b/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml new file mode 100644 index 0000000..26c2c8e --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml @@ -0,0 +1,36 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 01 FF FC + 01 FF FF FF + + + + + + + + + + + diff --git a/etc/AtsMBR/AtsMBR.cfg b/etc/AtsMBR/AtsMBR.cfg index 71067dc..3c0873e 100644 --- a/etc/AtsMBR/AtsMBR.cfg +++ b/etc/AtsMBR/AtsMBR.cfg @@ -33,7 +33,8 @@ LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" #LibItsSecurity_Pics.PICS_SEC_SHA256 := false #LibItsSecurity_Pics.PICS_SEC_SHA384 := true -LibItsMbr_Pics.PICS_IUT_MA_CERTIFICATE_ID := "CERT_IUT_A_MA" +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" [LOGGING] # In this section you can specify the name of the log file and the classes of events @@ -138,13 +139,43 @@ system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.43,dst_port=12345,src_po [EXECUTE] # Check that the IUT generates an encrypted MBR message -#ItsMbr_TestCases.TC_MRS_ITSS_SEC_BV_001 +#ItsMbr_TestCases.TC_MRS_ITSS_SEC_BV_01 + +# Check that the IUT discards an encrypted MBR message when recipientId does not contain MA certificate +#ItsMbr_TestCases.TC_MRS_MA_SEC_BO_01 + +# Check that the IUT discards an encrypted MBR message done with a certificate with no MBS SSPs +#ItsMbr_TestCases.TC_MRS_MA_SEC_BO_02 + +# Check that the IUT generates a security HeaderInfo with missing fields observation on a CAM MR Message when requested (Class 1) - obs-Security-MessageIdIncWithHeaderInfo +#ItsMbr_TestCases.TC_MRS_ITSS_SEC_MESSAGES_CLASS1_CAM_BV_01 + +# Check that the IUT generates a inconsistent security profile observation (psid set to DENM) on a CAM MR Message when requested (Class 1) - obs-Security-HeaderIncWithSecurityProfile +#ItsMbr_TestCases.TC_MRS_ITSS_SEC_MESSAGES_CLASS1_CAM_BV_02 + +# Check that the IUT generates an inconsistent PSID observation (invalid PSID value) on a CAM MR Message when requested (Class 1) - obs-Security_HeaderPsidIncWithCertificate +#ItsMbr_TestCases.TC_MRS_ITSS_SEC_MESSAGES_CLASS1_CAM_BV_03 + +# Check that the IUT generates an invalid AppPermissions observation on a CAM MR Message when requested (Class 1) - obs-Security-MessageIncWithSsp +#ItsMbr_TestCases.TC_MRS_ITSS_SEC_MESSAGES_CLASS1_CAM_BV_04 + +# Check that the IUT generates an inconsistent certificate time observation on a CAM MR Message when requested (Class 1) - obs-Security-HeaderTimeOutsideCertificateValidity +#ItsMbr_TestCases.TC_MRS_ITSS_SEC_MESSAGES_CLASS1_CAM_BV_05 + +# Check that the IUT generates an inconsistent certificate location outside observation on a CAM MR Message when requested (Class 1) - obs-Security-MessageLocationOutsideCertificateValidity +#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_001 +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 + +# Check that the IUT generates an invalid speed value in reverse driving observation on a CAM in the MR message when requested (Class 1) - obs-Speed-ValueTooLarge-DriveDirectionReverse +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS1_CAM_BV_02 -# 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 -#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS1_CAM_001 +# 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 [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/etc/AtsPki/AtsPki_Etas.cfg_ b/etc/AtsPki/AtsPki_Etas.cfg_ index 5f4b93a..fb7dca4 100644 --- a/etc/AtsPki/AtsPki_Etas.cfg_ +++ b/etc/AtsPki/AtsPki_Etas.cfg_ @@ -279,7 +279,19 @@ system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TC # system.httpCaPort.params := TCP(debug=1,server_mode=1,server=192.168.1.43) # Await CTL request and provides "CERT_IUT_A_RCA", "CERT_TS_A_AA", "CERT_TS_A_EA" certificates # PKI platform simu -ItsPki_TestCases.TC_PKI_PLTF_RCV_BV_01 +#ItsPki_TestCases.TC_PKI_PLTF_RCV_BV_01 + +# Config: +# LibItsPki_Pics.PICS_SIMULATE_EA_ENTITY := false # CERT_TS_A_EA shall be trusted by the PKI +# LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := PKI EA cert +# LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" # CERT_TS_A_AA & CERT_IUT_A_RCA shall be trusted by the PKI +# LibItsPki_Pics.PICS_IUT_AA_CERTIFICATE_ID := PKI AA cert +# LibItsPki_Pics.PICS_TS_CA_CERTIFICATE_ID := PKI RCA cert +# system.httpPort.params := TCP(server=eta01s.staging.cycurv2x.com) + +# Check that the EA sends the butterfly authorization respond message after receiving of the butterfly authorization request +# Check that this message is signed with EA certificate +ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 76f1ea7..6724d19 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 76f1ea77ad27467cc39300c8599f1c0d37c0be76 +Subproject commit 6724d19df91a3c1410c497b7e504add9c366f344 diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index 4c952bd..9d4e824 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit 4c952bd04cdbecdc17abe1f4001849f0247525b9 +Subproject commit 9d4e824b388a9b7ec30690582b69560188ed582d diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 2666a89..99daa1d 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 2666a89c1687ee67c8f4e21ee95daeedb112d001 +Subproject commit 99daa1d668ac0cd9e584f1967c404d80cd1b68f3 -- GitLab From d068aff8185ff1cb13bc590c51ca681f481cdd97 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 22 Jun 2023 10:59:26 +0200 Subject: [PATCH 098/178] TTF T024: Compiler error fixed --- switch_its_r1.sh | 5 ++--- switch_its_r2.sh | 5 ++--- titan-test-system-framework | 2 +- ttcn/AtsCAM | 2 +- ttcn/AtsMBR | 2 +- ttcn/AtsSecurity | 2 +- ttcn/patch_lib_common_titan/module.mk | 8 ++++---- 7 files changed, 12 insertions(+), 14 deletions(-) diff --git a/switch_its_r1.sh b/switch_its_r1.sh index 716bc1b..b9be4b1 100755 --- a/switch_its_r1.sh +++ b/switch_its_r1.sh @@ -42,13 +42,12 @@ else git checkout devel fi cd ./ttcn/LibHttp -ln -sf module_its.mk module.mk +ln module_its.mk module.mk cd $BASE_PATH/ttcn/LibIts git checkout devel cd $BASE_PATH -cp ./ttcn/patch_lib_common_titan/module.mk ./ttcn/LibCommon/ -cp ./ttcn/patch_lib_common_titan/ttcn/* ./ttcn/LibCommon/ttcn +ln ./ttcn/patch_lib_common_titan/module.mk ./ttcn/LibCommon/ exit 0 diff --git a/switch_its_r2.sh b/switch_its_r2.sh index ce1ad6e..879a068 100755 --- a/switch_its_r2.sh +++ b/switch_its_r2.sh @@ -57,14 +57,13 @@ else git checkout devel fi cd ./ttcn/LibHttp -ln -sf module_its.mk module.mk +ln module_its.mk module.mk cd $BASE_PATH/ttcn/LibIts git checkout devel2 cd $BASE_PATH -cp ./ttcn/patch_lib_common_titan/module.mk ./ttcn/LibCommon/ -cp ./ttcn/patch_lib_common_titan/ttcn/* ./ttcn/LibCommon/ttcn +ln ./ttcn/patch_lib_common_titan/module.mk ./ttcn/LibCommon/\ exit 0 diff --git a/titan-test-system-framework b/titan-test-system-framework index 554d6b6..25b94ce 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit 554d6b6b3ce1e51d88267a3c946cd30caac97a55 +Subproject commit 25b94cec2e9370310eabe936d429f54eae02ffd1 diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 76f1ea7..6724d19 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 76f1ea77ad27467cc39300c8599f1c0d37c0be76 +Subproject commit 6724d19df91a3c1410c497b7e504add9c366f344 diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index 4c952bd..9d4e824 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit 4c952bd04cdbecdc17abe1f4001849f0247525b9 +Subproject commit 9d4e824b388a9b7ec30690582b69560188ed582d diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 2666a89..99daa1d 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 2666a89c1687ee67c8f4e21ee95daeedb112d001 +Subproject commit 99daa1d668ac0cd9e584f1967c404d80cd1b68f3 diff --git a/ttcn/patch_lib_common_titan/module.mk b/ttcn/patch_lib_common_titan/module.mk index 3b3b660..b4b7cd7 100644 --- a/ttcn/patch_lib_common_titan/module.mk +++ b/ttcn/patch_lib_common_titan/module.mk @@ -1,8 +1,8 @@ sources := \ - ttcn/LibCommon_AbstractData.ttcn \ - ttcn/LibCommon_BasicTypesAndValues.ttcn \ - ttcn/LibCommon_DataStrings.ttcn \ - ttcn/LibCommon_Sync.ttcn \ + ../patch_lib_common_titan/ttcn/LibCommon_AbstractData.ttcn \ + ../patch_lib_common_titan/ttcn/LibCommon_BasicTypesAndValues.ttcn \ + ../patch_lib_common_titan/ttcn/LibCommon_DataStrings.ttcn \ + ../patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn \ ttcn/LibCommon_TextStrings.ttcn \ ttcn/LibCommon_Time.ttcn \ ttcn/LibCommon_VerdictControl.ttcn -- GitLab From 3652fd9f030065ad99f2e085ccefac897471c318 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Mon, 26 Jun 2023 10:48:45 +0200 Subject: [PATCH 099/178] TTF T024: Compiler error fixed --- ttcn/AtsCAM | 2 +- ttcn/AtsMBR | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 6724d19..431b028 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 6724d19df91a3c1410c497b7e504add9c366f344 +Subproject commit 431b0284e7b2d7edc8b486b0ad823aceb90a44eb diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index 9d4e824..572ae5a 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit 9d4e824b388a9b7ec30690582b69560188ed582d +Subproject commit 572ae5a13a15bdb8c512e9ca936b8bc3c6986fc1 -- GitLab From 2938b64af481431fa48f87378189c22c42c0be4c Mon Sep 17 00:00:00 2001 From: garciay Date: Mon, 26 Jun 2023 11:34:40 +0200 Subject: [PATCH 100/178] Add class2 test cases --- etc/AtsMBR/AtsMBR.cfg | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/etc/AtsMBR/AtsMBR.cfg b/etc/AtsMBR/AtsMBR.cfg index 3c0873e..3dfe098 100644 --- a/etc/AtsMBR/AtsMBR.cfg +++ b/etc/AtsMBR/AtsMBR.cfg @@ -177,6 +177,33 @@ 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 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 + +# Check that the IUT generates an inconsistent position changed value (calculated speed based on the new position) in consecutive CAMs MR Message when requested (Class 2) - obs-Position-ChangeTooLarge +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_02 + +# Check that the IUT generates a MR message with an observation of an inconsistent acceleration change (regarding the vehicle type) in consecutive CAMs when requested (Class 2) - obs-LongAcc-ValueTooLarge +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_04 + +# Check that the IUT generates a MR message with an observation of an inconsistent CAM frequency greater than 10Hz(Class 2) - obs-Beacon-IntervalTooSmall +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_05 + +# Check that the IUT generates an invalid static changed value in consecutive CAMs MR Message when requested (Class 2) - obs-Static-Change: SpecialTransport +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_10_01 + +# Check that the IUT generates an invalid static changed value in consecutive CAMs MR Message when requested (Class 2) - obs-Static-Change: StationType +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_10_02 + +# Check that the IUT generates an invalid static changed value in consecutive CAMs MR Message when requested (Class 2) - obs-Static-Change: VehicleLength +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_10_03 + +# Check that the IUT generates an invalid static changed value in consecutive CAMs MR Message when requested (Class 2) - obs-Static-Change: VehicleRole +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_10_04 + +# Check that the IUT generates an invalid static changed value in consecutive CAMs MR Message when requested (Class 2) - obs-Static-Change: VehicleWidth +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_10_05 + [MAIN_CONTROLLER] # The options herein control the behavior of MC. KillTimer := 10.0 -- GitLab From 30fdeda392afc8fdcde338ce93cb4d01df1334f7 Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 18 Jul 2023 16:05:21 +0200 Subject: [PATCH 101/178] Change CharCoding::UNKNOWN by CharCoding::UNKNOWN_CHAR_CODING --- ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc | 2 +- virtualization/docker-dev/Dockerfile | 2 +- virtualization/docker-dev/Dockerfile.stfubuntu | 2 +- virtualization/docker-dev/build.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc index 9595a80..7fde61a 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc @@ -236,7 +236,7 @@ void geonetworking_layer::send_data(OCTETSTRING &data, params &p_params) { } const TTCN_RAWdescriptor_t _intx_raw_ = {RAW_INTX, SG_NO, ORDER_MSB, ORDER_MSB, ORDER_LSB, ORDER_MSB, EXT_BIT_NO, ORDER_LSB, ORDER_LSB, - TOP_BIT_INHERITED, 0, 0, 0, 8, 0, NULL, -1, CharCoding::UNKNOWN}; + TOP_BIT_INHERITED, 0, 0, 0, 8, 0, NULL, -1, CharCoding::UNKNOWN_CHAR_CODING}; const TTCN_Typedescriptor_t _intx_descr_ = {"IntX", NULL, &_intx_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE}; void geonetworking_layer::receive_data(OCTETSTRING &data, params &p_params) { diff --git a/virtualization/docker-dev/Dockerfile b/virtualization/docker-dev/Dockerfile index 97536f6..28dc2b3 100644 --- a/virtualization/docker-dev/Dockerfile +++ b/virtualization/docker-dev/Dockerfile @@ -1,4 +1,4 @@ -FROM stfubuntu:22.04 +FROM stfubuntu:20.04 LABEL ETSI ITS LABEL description="TS.ITS Docker Image" diff --git a/virtualization/docker-dev/Dockerfile.stfubuntu b/virtualization/docker-dev/Dockerfile.stfubuntu index 2805900..9fa6645 100644 --- a/virtualization/docker-dev/Dockerfile.stfubuntu +++ b/virtualization/docker-dev/Dockerfile.stfubuntu @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:20.04 LABEL ETSI CTI LABEL description="STF Docker Ubuntu image" diff --git a/virtualization/docker-dev/build.sh b/virtualization/docker-dev/build.sh index 178690f..25db389 100755 --- a/virtualization/docker-dev/build.sh +++ b/virtualization/docker-dev/build.sh @@ -13,7 +13,7 @@ if [ "$1" == "--force-stfubuntu" ]; then fi # Check and build stfubuntu image if [ -z `docker images -q stfubuntu` ]; then - docker build --no-cache --tag stfubuntu:22.04 -f Dockerfile.stfubuntu --force-rm . || exit 1 + docker build --no-cache --tag stfubuntu:20.04 -f Dockerfile.stfubuntu --force-rm . || exit 1 fi docker build --no-cache --tag etsiforge-r2 --force-rm . || ( echo "Docker build failed: $?"; exit 1 ) -- GitLab From cd3c1e1ed5e8cdd73db2a36e93925a3d1c4cad70 Mon Sep 17 00:00:00 2001 From: garciay Date: Wed, 26 Jul 2023 09:52:51 +0200 Subject: [PATCH 102/178] Validate ATsMBR class1 TCs --- .../Protocols/Mbr/etsi_ts103759_data_codec.cc | 22 +++++++++++++++ .../etsi_ts103097_certificate_codec.cc | 24 +++++++--------- .../Security/etsi_ts103097_data_codec.cc | 28 +++++++++---------- ccsrc/Protocols/Security/security_ecc.cc | 8 ++++++ etc/AtsMBR/AtsMBR.cfg | 21 ++++++++++---- ttcn/AtsMBR | 2 +- ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- ttcn/LibIts | 2 +- 9 files changed, 73 insertions(+), 38 deletions(-) diff --git a/ccsrc/Protocols/Mbr/etsi_ts103759_data_codec.cc b/ccsrc/Protocols/Mbr/etsi_ts103759_data_codec.cc index 51c8c8f..b2f91e4 100644 --- a/ccsrc/Protocols/Mbr/etsi_ts103759_data_codec.cc +++ b/ccsrc/Protocols/Mbr/etsi_ts103759_data_codec.cc @@ -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(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(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; } diff --git a/ccsrc/Protocols/Security/etsi_ts103097_certificate_codec.cc b/ccsrc/Protocols/Security/etsi_ts103097_certificate_codec.cc index 14c9ff0..cd507fe 100644 --- a/ccsrc/Protocols/Security/etsi_ts103097_certificate_codec.cc +++ b/ccsrc/Protocols/Security/etsi_ts103097_certificate_codec.cc @@ -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); -// } diff --git a/ccsrc/Protocols/Security/etsi_ts103097_data_codec.cc b/ccsrc/Protocols/Security/etsi_ts103097_data_codec.cc index 6fe07e0..d0c99f9 100644 --- a/ccsrc/Protocols/Security/etsi_ts103097_data_codec.cc +++ b/ccsrc/Protocols/Security/etsi_ts103097_data_codec.cc @@ -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); -// } diff --git a/ccsrc/Protocols/Security/security_ecc.cc b/ccsrc/Protocols/Security/security_ecc.cc index 0c1cbf4..1a58abf 100644 --- a/ccsrc/Protocols/Security/security_ecc.cc +++ b/ccsrc/Protocols/Security/security_ecc.cc @@ -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(_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); diff --git a/etc/AtsMBR/AtsMBR.cfg b/etc/AtsMBR/AtsMBR.cfg index 3dfe098..33f30b9 100644 --- a/etc/AtsMBR/AtsMBR.cfg +++ b/etc/AtsMBR/AtsMBR.cfg @@ -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 diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index 572ae5a..b36425a 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit 572ae5a13a15bdb8c512e9ca936b8bc3c6986fc1 +Subproject commit b36425a0c5f5cf597ce364777827b55c13bf81db diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 765dffb..4bca0b4 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 765dffb362899a0b54dd589d99476f391bd487ee +Subproject commit 4bca0b4997fcf1b6811fc715206e7406f3875212 diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 99daa1d..110f8bb 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 99daa1d668ac0cd9e584f1967c404d80cd1b68f3 +Subproject commit 110f8bb0b13637a495edead21b83c63d7d0ffcfd diff --git a/ttcn/LibIts b/ttcn/LibIts index 286ea65..c71138f 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit 286ea65132a54908e5c8447d3842dcca5808d17c +Subproject commit c71138f03957bdb31de10b249f2442fe26d77a1b -- GitLab From c2034dcd15e3cb9afb0fb40aedf2995c9e6dc236 Mon Sep 17 00:00:00 2001 From: garciay Date: Fri, 28 Jul 2023 10:18:29 +0200 Subject: [PATCH 103/178] Add note for ATsPki/ITS-S --- etc/AtsPki/AtsPki.cfg | 2 +- etc/AtsPki/AtsPki_Atos.cfg_ | 1 + etc/AtsPki/AtsPki_Autocrypt.cfg_ | 1 + etc/AtsPki/AtsPki_Commsignia.cfg_ | 1 + etc/AtsPki/AtsPki_Ctag.cfg_ | 1 + etc/AtsPki/AtsPki_Etas.cfg_ | 1 + etc/AtsPki/AtsPki_Microsec.cfg_ | 26 ++++++++++++++++++++------ etc/AtsPki/AtsPki_Simu.cfg_ | 1 + ttcn/AtsPki | 2 +- ttcn/LibIts | 2 +- 10 files changed, 29 insertions(+), 9 deletions(-) diff --git a/etc/AtsPki/AtsPki.cfg b/etc/AtsPki/AtsPki.cfg index 68e18b6..be66d6f 120000 --- a/etc/AtsPki/AtsPki.cfg +++ b/etc/AtsPki/AtsPki.cfg @@ -1 +1 @@ -AtsPki_Etas.cfg_ \ No newline at end of file +AtsPki_Microsec.cfg_ \ No newline at end of file diff --git a/etc/AtsPki/AtsPki_Atos.cfg_ b/etc/AtsPki/AtsPki_Atos.cfg_ index b53626e..93ddd1b 100644 --- a/etc/AtsPki/AtsPki_Atos.cfg_ +++ b/etc/AtsPki/AtsPki_Atos.cfg_ @@ -47,6 +47,7 @@ LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D30 #LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3033'O # Brainpool-P384 r1 # Technical keys +# NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) # Private key #FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34 # Public key diff --git a/etc/AtsPki/AtsPki_Autocrypt.cfg_ b/etc/AtsPki/AtsPki_Autocrypt.cfg_ index 67bbcef..6c8e831 100644 --- a/etc/AtsPki/AtsPki_Autocrypt.cfg_ +++ b/etc/AtsPki/AtsPki_Autocrypt.cfg_ @@ -36,6 +36,7 @@ LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D30 #LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3033'O # Brainpool-P384 r1 # Technical keys +# NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) # Private key #FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34 # Public key diff --git a/etc/AtsPki/AtsPki_Commsignia.cfg_ b/etc/AtsPki/AtsPki_Commsignia.cfg_ index 9df6b3f..dd9b73a 100644 --- a/etc/AtsPki/AtsPki_Commsignia.cfg_ +++ b/etc/AtsPki/AtsPki_Commsignia.cfg_ @@ -32,6 +32,7 @@ LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/aa/authorization" LibItsPki_Pics.PICS_IUT_ITS_S_ROLE := true LibItsPki_Pics.PICS_SECPKI_ENROLMENT := true +# NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) LibItsPki_Pics.PICS_ITS_S_SIGN_NITSP256_PRIVATE_KEY := '5C25F97607DFC62972A147FAD8B7A7C939569F0F95ECD4C641724A68B51836E5'O; LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '02834642E2E9B2EA1E6417D9D9ED1BA0BB84450781809AED15CB4BCB55DDCFD77B'O; LibItsPki_Pics.PICS_ITS_S_ENC_NITSP256_PRIVATE_KEY := 'EDEBEADCAA9514CD4B30256126FB7DF958B911C6EB58CCF702983C3DCD3DECBD'O; diff --git a/etc/AtsPki/AtsPki_Ctag.cfg_ b/etc/AtsPki/AtsPki_Ctag.cfg_ index 8105a3f..3d4138c 100644 --- a/etc/AtsPki/AtsPki_Ctag.cfg_ +++ b/etc/AtsPki/AtsPki_Ctag.cfg_ @@ -40,6 +40,7 @@ LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D30 #LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3033'O # Brainpool-P384 r1 # Technical keys +# NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) # Private key #FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34 # Public key diff --git a/etc/AtsPki/AtsPki_Etas.cfg_ b/etc/AtsPki/AtsPki_Etas.cfg_ index fb7dca4..7e21c6a 100644 --- a/etc/AtsPki/AtsPki_Etas.cfg_ +++ b/etc/AtsPki/AtsPki_Etas.cfg_ @@ -43,6 +43,7 @@ LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492d5465737453797374656d2d'O #LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492d5465737453797374656d5f'O # Brainpool-P384 r1 # Technical keys +# NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) # Private key #FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34 # Public key diff --git a/etc/AtsPki/AtsPki_Microsec.cfg_ b/etc/AtsPki/AtsPki_Microsec.cfg_ index bfda4f8..0b0a817 100644 --- a/etc/AtsPki/AtsPki_Microsec.cfg_ +++ b/etc/AtsPki/AtsPki_Microsec.cfg_ @@ -12,7 +12,7 @@ LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" LibItsPki_Pics.PICS_MULTIPLE_END_POINT := false -LibHttp_Pics.PICS_HEADER_HOST := "v2x-pki-test.microsec.com" +LibHttp_Pics.PICS_HEADER_HOST := "v2x-pki-test.microsec.com" LibItsPki_Pics.PICS_HEADER_HOST_CA := "v2x-pki-test.microsec.com" LibItsPki_Pics.PICS_HEADER_HOST_TLM := "v2x-pki-test.microsec.com" @@ -24,16 +24,17 @@ LibItsPki_Pics.PICS_HTTP_GET_URI_CRL := "/v2x_rootca_nistp256/getcrl/B65E3B LibItsPki_Pics.PICS_HTTP_GET_URI_TLM := "/v2x_rootca_brainpoolp256r1" #LibItsPki_Pics.PICS_SIMULATE_EA_ENTITY := true # CERT_TS_A_EA shall be trusted by the PKI -LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := "MICROSEC_EA_77C0DE13A375774D" # Use CERT_TS_A_EA when the TS simulate the EA (TC_SECPKI_AA_AUTHVAL_01_BV) with PICS_SIMULATE_EA_ENTITY set +LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := "0_MicrosecTest-EA-2021_L0" # Use CERT_TS_A_EA when the TS simulate the EA (TC_SECPKI_AA_AUTHVAL_01_BV) with PICS_SIMULATE_EA_ENTITY set LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" # CERT_TS_A_AA & CERT_IUT_A_RCA shall be trusted by the PKI -LibItsPki_Pics.PICS_IUT_AA_CERTIFICATE_ID := "MICROSEC_AA_43166B9022583C61" -LibItsPki_Pics.PICS_TS_CA_CERTIFICATE_ID := "MICROSEC_RCA_B65E3B8FBBEC3910" +LibItsPki_Pics.PICS_IUT_AA_CERTIFICATE_ID := "0_MicrosecTest-AA-2021_L0" +LibItsPki_Pics.PICS_TS_CA_CERTIFICATE_ID := "MicrosecNistP256RootCA" LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3031'O # Nist-P256 #LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3032'O # Brainpool-P256 r1 #LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3033'O # Brainpool-P384 r1 # Technical keys +# NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) # Private key #FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34 # Public key @@ -95,7 +96,7 @@ system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/ # system.httpAtVPort.params := TCP(server=0.atos-ea.l0.c-its-pki.eu) # The EnrolmentResponse message shall be sent by the EA to the ITS-S across the interface at reference point S3 in response to a received EnrolmentRequest message -ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_01_BV +#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_01_BV # Check that EA doesn't accept Enrolment rekeying request when enrolment is not permitted by signing certificate (not containing an item of type PsidSsp) #ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_02_BI_01 @@ -124,7 +125,7 @@ ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_01_BV #ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_13_BI # The EnrolmentResponse message shall be encrypted using an ETSI TS 103 097 approved algorithm and the encryption shall be done with the same AES key as the one used by the ITS-S requestor for the encryption of the EnrolmentRequest message. -#ItsPki_TestCases.TC_SECPKI_EA_ENR_01_BV +ItsPki_TestCases.TC_SECPKI_EA_ENR_01_BV # The EnrolmentResponse message shall be encrypted using an ETSI TS 103 097 approved algorithm and the encryption shall be done with the same AES key as the one used by the ITS-S requestor for the encryption of the EnrolmentRequest message. #ItsPki_TestCases.TC_SECPKI_EA_ENR_02_BV # The outermost structure is an EtsiTs103097Data-Encrypted structure containing the component recipients containing one instance of RecipientInfo of choice pskRecipInfo, which contains the HashedId8 of the symmetric key used by the ITS-S to encrypt the EnrolmentRequest message to which the response is built and containing the component ciphertext, once decrypted, contains an EtsiTs103097Data-Signed structure @@ -153,6 +154,19 @@ ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_01_BV # Check that EA doesn't accept Authorization Validation Request when SharedAtRequest is signed with certificate without appropriate permissions #ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_RCV_02_BI +# +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV +# +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_02_BV +# +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_03_BV +# +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_04_BV +# +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_05_BV +# +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV + # The EtsiTs103097Data-Encrypted is build with the component recipients containing one instance of RecipientInfo of choice pskRecipInfo, which contains the HashedId8 of the symmetric key used by the ITS-S to encrypt the AuthorizationRequest message to which the response is built and the component ciphertext containing the encrypted representation of the EtsiTs103097Data-Signed. The encryption uses a ETSI TS 103 097 [3] approved algorithm #ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_01_BV # To read an authorization validation response, the AA shall receive an EtsiTs103097Data-Encrypted structure, containing a EtsiTs103097Data-Signed structure, containing a EtsiTs102941Data structure, containing an AuthorizationValidationResponse structure diff --git a/etc/AtsPki/AtsPki_Simu.cfg_ b/etc/AtsPki/AtsPki_Simu.cfg_ index 6a984ce..90f646a 100644 --- a/etc/AtsPki/AtsPki_Simu.cfg_ +++ b/etc/AtsPki/AtsPki_Simu.cfg_ @@ -41,6 +41,7 @@ LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D546573745379 #LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3033'O # Brainpool-P384 r1 # Technical keys +# NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) # Private key #FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34 # Public key diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 4bca0b4..9490350 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 4bca0b4997fcf1b6811fc715206e7406f3875212 +Subproject commit 9490350e9ef178c265ebc834faa1b9450a6f40e3 diff --git a/ttcn/LibIts b/ttcn/LibIts index c71138f..4b1d1fa 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit c71138f03957bdb31de10b249f2442fe26d77a1b +Subproject commit 4b1d1fa7f56c6b76cd6d3f303179b7805be3d6b9 -- GitLab From 821ccef55c878cbc3e9000b4cb47a89f050ce576 Mon Sep 17 00:00:00 2001 From: garciay Date: Mon, 21 Aug 2023 13:21:59 +0200 Subject: [PATCH 104/178] Implement TC_MRS_ITSS_MULTIPLE_MESSAGES_CAM_01 --- etc/AtsMBR/AtsMBR.cfg | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/etc/AtsMBR/AtsMBR.cfg b/etc/AtsMBR/AtsMBR.cfg index 33f30b9..d192e9f 100644 --- a/etc/AtsMBR/AtsMBR.cfg +++ b/etc/AtsMBR/AtsMBR.cfg @@ -7,7 +7,7 @@ # typeOfAddress := e_initial, # stationType := e_unknown, # reserved := 0, -# mid := '000000000000'O +# mid := '4C5E0C14D2EA'O #} LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { typeOfAddress := e_manual, @@ -36,6 +36,8 @@ 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_Pics.PICS_IUT_SEND_GROUPED_MBRS := false + LibItsMbr_Pixits.PX_REPEAT_CONSISTENT_MESSAGE := 3 LibItsMbr_Pixits.PX_REPEAT_INCONSISTENT_MESSAGE := 1 @@ -138,7 +140,10 @@ system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=43551050 # 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.39,src_port=4041,dst_port=9091)" +# For all test where IUT is not MA, uncomment this port system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.39)" +# For TC_MRS_MA_SEC_BO_01 & TC_MRS_MA_SEC_BO_01 Use this port and comment the one above +#system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=192.168.1.39,port=18000)" system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.39,dst_port=12345,src_port=12346)" @@ -148,6 +153,7 @@ system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.39,dst_port=12345,src_po #ItsMbr_TestCases.TC_MRS_ITSS_SEC_BV_01 # Check that the IUT discards an encrypted MBR message when recipientId does not contain MA certificate +# Set local_port to 18000 for AtsRSUsSimulator #ItsMbr_TestCases.TC_MRS_MA_SEC_BO_01 # Check that the IUT discards an encrypted MBR message done with a certificate with no MBS SSPs @@ -184,7 +190,7 @@ system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.39,dst_port=12345,src_po #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 +#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 @@ -213,6 +219,9 @@ ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS1_CAM_BV_04 # Check that the IUT generates an invalid static changed value in consecutive CAMs MR Message when requested (Class 2) - obs-Static-Change: VehicleWidth #ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_10_05 +# Check that the IUT generates a single MR message containing observations on receiving CAM messages with different class 1 inconsistencies +ItsMbr_TestCases.TC_MRS_ITSS_MULTIPLE_MESSAGES_CAM_01 + [MAIN_CONTROLLER] # The options herein control the behavior of MC. KillTimer := 10.0 -- GitLab From 232f04f58f234916f55be38903b6a87ebf16217c Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 22 Aug 2023 11:45:32 +0200 Subject: [PATCH 105/178] Implement TC_MRS_ITSS_MULTIPLE_MESSAGES_CAM_02 --- etc/AtsMBR/AtsMBR.cfg | 5 ++++- ttcn/AtsMBR | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/etc/AtsMBR/AtsMBR.cfg b/etc/AtsMBR/AtsMBR.cfg index d192e9f..1fd4253 100644 --- a/etc/AtsMBR/AtsMBR.cfg +++ b/etc/AtsMBR/AtsMBR.cfg @@ -220,7 +220,10 @@ system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.39,dst_port=12345,src_po #ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_10_05 # Check that the IUT generates a single MR message containing observations on receiving CAM messages with different class 1 inconsistencies -ItsMbr_TestCases.TC_MRS_ITSS_MULTIPLE_MESSAGES_CAM_01 +#ItsMbr_TestCases.TC_MRS_ITSS_MULTIPLE_MESSAGES_CAM_01 + +# 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_MULTIPLE_MESSAGES_CAM_02 [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index b36425a..20a3d2a 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit b36425a0c5f5cf597ce364777827b55c13bf81db +Subproject commit 20a3d2a15442df8bfa7f4bb9480fc05a13b15e81 -- GitLab From 002769056f3d662d995a277e369152cc28a8320b Mon Sep 17 00:00:00 2001 From: garciay Date: Fri, 25 Aug 2023 17:28:42 +0200 Subject: [PATCH 106/178] Add support of BFK as defined in P1609.2.1/D7, January 2022 Clause 9.3.4.1.1 General --- ccsrc/Externals/LibItsSecurity_externals.cc | 54 +++ ccsrc/Protocols/Security/security_ecc.cc | 345 +++++++++++++++++- ccsrc/Protocols/Security/security_ecc.hh | 38 +- .../Security/security_services_its.cc | 82 ++++- .../Security/security_services_its.hh | 26 +- etc/AtsPki/AtsPki_Microsec.cfg_ | 16 +- ttcn/AtsMBR | 2 +- 7 files changed, 546 insertions(+), 17 deletions(-) diff --git a/ccsrc/Externals/LibItsSecurity_externals.cc b/ccsrc/Externals/LibItsSecurity_externals.cc index e714750..8098152 100644 --- a/ccsrc/Externals/LibItsSecurity_externals.cc +++ b/ccsrc/Externals/LibItsSecurity_externals.cc @@ -2228,4 +2228,58 @@ namespace LibItsSecurity__Functions { FLOAT fx__int2ddlon(const INTEGER &p__longitude) { return (float)((float)p__longitude / 1000000.0); } + BOOLEAN fx__generate__bkf__signing__expension__keys(const INTEGER& p__i, const INTEGER& p__j, const BOOLEAN& p_debug, OCTETSTRING& p__expension__key) { + loggers::get_instance().log_msg(">>> fx__generate__bkf__signing__expension__keys: p__i: ", p__i); + loggers::get_instance().log_msg(">>> fx__generate__bkf__signing__expension__keys: p__j: ", p__j); + + if (security_services_its::get_instance().generate_bkf_signing_expension_keys(p__i, p__j, p_debug, p__expension__key) == -1) { + return FALSE; + } + loggers::get_instance().log_msg("<<< fx__generate__bkf__signing__expension__keys: p__expension__key: ", p__expension__key); + return TRUE; + } + + BOOLEAN fx__generate__bkf__enc__expension__keys(const INTEGER& p__i, const INTEGER& p__j, const BOOLEAN& p_debug, OCTETSTRING& p__expension__key) { + loggers::get_instance().log_msg(">>> fx__generate__bkf__enc__expension__keys: p__i: ", p__i); + loggers::get_instance().log_msg(">>> fx__generate__bkf__enc__expension__keys: p__j: ", p__j); + + if (security_services_its::get_instance().generate_bkf_enc_expension_keys(p__i, p__j, p_debug, p__expension__key) == -1) { + return FALSE; + } + loggers::get_instance().log_msg("<<< fx__generate__bkf__enc__expension__keys: p__expension__key: ", p__expension__key); + return TRUE; + } + + BOOLEAN fx__bfk__expend__private__key(const OCTETSTRING& p__expansion__key, const OCTETSTRING& p__private__key, OCTETSTRING& p__expended__private__key) { + loggers::get_instance().log_msg(">>> fx__bfk__expend__private__key: p__expansion__key: ", p__expansion__key); + loggers::get_instance().log_msg(">>> fx__bfk__expend__private__key: p__private__key: ", p__private__key); + + if (security_services_its::get_instance().bfk_expend_private_key(p__expansion__key, p__private__key, p__expended__private__key) == -1) { + return FALSE; + } + loggers::get_instance().log_msg("<<< fx__bfk__expend__private__key: p__expended__private__key: ", p__expended__private__key); + return TRUE; + } + + BOOLEAN fx__bfk__expend__public__key(const OCTETSTRING& p__expansion__key, const OCTETSTRING& p__compressed__public__key, const INTEGER& p__compressed__mode, OCTETSTRING& p__expended__compressed__public__key, INTEGER& p__expended__compressed__mode) { + loggers::get_instance().log_msg(">>> fx__bfk__expend__public__key: p__expansion__key: ", p__expansion__key); + loggers::get_instance().log_msg(">>> fx__bfk__expend__public__key: p__compressed__public__key: ", p__compressed__public__key); + loggers::get_instance().log_msg(">>> fx__bfk__expend__public__key: p__compressed__mode: ", p__compressed__mode); + + if (security_services_its::get_instance().bfk_expend_public_key(p__expansion__key, p__compressed__public__key, p__compressed__mode, p__expended__compressed__public__key, p__expended__compressed__mode) == -1) { + return FALSE; + } + loggers::get_instance().log_msg("<<< fx__bfk__expend__public__key: p__expended__compressed__public__key: ", p__expended__compressed__public__key); + loggers::get_instance().log_msg("<<< fx__bfk__expend__public__key: p__expended__compressed__mode: ", p__expended__compressed__mode); + return TRUE; + } + + BOOLEAN fx__bfk__verify__expended__keys(const OCTETSTRING& p__expended__private__key, const OCTETSTRING& p__expended__compressed__public__key, const INTEGER& p__expended__compressed__mode) { + loggers::get_instance().log_msg(">>> fx__bfk__verify__expended__keys: p__expended__private__key: ", p__expended__private__key); + loggers::get_instance().log_msg(">>> fx__bfk__verify__expended__keys: p__expended__compressed__public__key: ", p__expended__compressed__public__key); + loggers::get_instance().log_msg(">>> fx__bfk__verify__expended__keys: p__expended__compressed__mode: ", p__expended__compressed__mode); + + return security_services_its::get_instance().bfk_verify_expended_keys(p__expended__private__key, p__expended__compressed__public__key, p__expended__compressed__mode); + } + } // namespace LibItsSecurity__Functions diff --git a/ccsrc/Protocols/Security/security_ecc.cc b/ccsrc/Protocols/Security/security_ecc.cc index 1a58abf..f7ce65d 100644 --- a/ccsrc/Protocols/Security/security_ecc.cc +++ b/ccsrc/Protocols/Security/security_ecc.cc @@ -30,7 +30,7 @@ #endif security_ecc::security_ecc(const ec_elliptic_curves p_elliptic_curve) - : _elliptic_curve(p_elliptic_curve), _encryption_algotithm(encryption_algotithm::aes_128_ccm), _ec_key(nullptr), _ec_group(nullptr), _bn_ctx(nullptr), + : _elliptic_curve(p_elliptic_curve), _encryption_algotithm(encryption_algotithm::aes_128_ccm), _ec_key(nullptr), _ec_group(nullptr), _ec_group_order(nullptr), _bn_ctx(nullptr), _pri_key(), _pub_key_x(), _pub_key_y(), _pub_key_compressed(), _pub_key_compressed_mode{ecc_compressed_mode::compressed_y_0}, _secret_key(), _enc_key_x(), _enc_key_y(), _sym_key(), _nonce(), _tag() { loggers::get_instance().log(">>> security_ecc::security_ecc: %d", static_cast(p_elliptic_curve)); @@ -42,7 +42,7 @@ security_ecc::security_ecc(const ec_elliptic_curves p_elliptic_curve) } // End of constructor security_ecc::security_ecc(const ec_elliptic_curves p_elliptic_curve, const OCTETSTRING &p_private_key) - : _elliptic_curve(p_elliptic_curve), _encryption_algotithm(encryption_algotithm::aes_128_ccm), _ec_key(nullptr), _ec_group(nullptr), _bn_ctx(nullptr), + : _elliptic_curve(p_elliptic_curve), _encryption_algotithm(encryption_algotithm::aes_128_ccm), _ec_key(nullptr), _ec_group(nullptr), _ec_group_order(nullptr), _bn_ctx(nullptr), _pri_key(p_private_key), _pub_key_x(), _pub_key_y(), _pub_key_compressed(), _pub_key_compressed_mode{ecc_compressed_mode::compressed_y_0}, _secret_key(), _enc_key_x(), _enc_key_y(), _sym_key(), _nonce(), _tag() { loggers::get_instance().log(">>> security_ecc::security_ecc (1): %d", static_cast(p_elliptic_curve)); @@ -129,7 +129,7 @@ security_ecc::security_ecc(const ec_elliptic_curves p_elliptic_curve, const OCTE } // End of constructor security_ecc::security_ecc(const ec_elliptic_curves p_elliptic_curve, const OCTETSTRING &p_public_key_x, const OCTETSTRING &p_public_key_y) - : _elliptic_curve(p_elliptic_curve), _encryption_algotithm(encryption_algotithm::aes_128_ccm), _ec_key(nullptr), _ec_group(nullptr), _bn_ctx(nullptr), + : _elliptic_curve(p_elliptic_curve), _encryption_algotithm(encryption_algotithm::aes_128_ccm), _ec_key(nullptr), _ec_group(nullptr), _ec_group_order(nullptr), _bn_ctx(nullptr), _pri_key(), _pub_key_x(p_public_key_x), _pub_key_y(p_public_key_y), _pub_key_compressed(), _pub_key_compressed_mode{ecc_compressed_mode::compressed_y_0}, _secret_key(), _enc_key_x(), _enc_key_y(), _sym_key(), _nonce(), _tag() { loggers::get_instance().log(">>> security_ecc::security_ecc (2): %d", static_cast(p_elliptic_curve)); @@ -205,7 +205,7 @@ security_ecc::security_ecc(const ec_elliptic_curves p_elliptic_curve, const OCTE } // End of constructor security_ecc::security_ecc(const ec_elliptic_curves p_elliptic_curve, const OCTETSTRING &p_public_key_compressed, const ecc_compressed_mode p_compressed_mode) - : _elliptic_curve(p_elliptic_curve), _encryption_algotithm(encryption_algotithm::aes_128_ccm), _ec_key(nullptr), _ec_group(nullptr), _bn_ctx(nullptr), + : _elliptic_curve(p_elliptic_curve), _encryption_algotithm(encryption_algotithm::aes_128_ccm), _ec_key(nullptr), _ec_group(nullptr), _ec_group_order(nullptr), _bn_ctx(nullptr), _pri_key(), _pub_key_x(), _pub_key_y(), _pub_key_compressed(p_public_key_compressed), _pub_key_compressed_mode{p_compressed_mode}, _secret_key(), _enc_key_x(), _enc_key_y(), _sym_key(), _nonce(), _tag() { loggers::get_instance().log(">>> security_ecc::security_ecc (3): %d", static_cast(p_elliptic_curve)); @@ -296,11 +296,15 @@ security_ecc::~security_ecc() { ::EC_KEY_free(_ec_key); _ec_key = nullptr; } - if (_bn_ctx != nullptr) {\ + if (_bn_ctx != nullptr) { ::BN_CTX_end(_bn_ctx); ::BN_CTX_free(_bn_ctx); _bn_ctx = nullptr; } + if (_ec_group_order != nullptr) { + ::BN_free(_ec_group_order); + _ec_group_order = nullptr; + } } // End of Destructor int security_ecc::generate() { @@ -1099,7 +1103,6 @@ const int security_ecc::init() { loggers::get_instance().warning("security_ecc::init: Unaible to set EC elliptic_curve"); return -1; } - loggers::get_instance().log("security_ecc::init: Nid=%d", result); _ec_key = ::EC_KEY_new_by_curve_name(result); // Set the elliptic curve if (_ec_key == nullptr) { @@ -1109,6 +1112,12 @@ const int security_ecc::init() { _ec_group = ::EC_KEY_get0_group(_ec_key); // Get pointer to the EC_GROUP _bn_ctx = ::BN_CTX_new(); ::BN_CTX_start(_bn_ctx); + _ec_group_order = BN_new(); + if (::EC_GROUP_get_order(_ec_group, _ec_group_order, _bn_ctx) != 1) { + loggers::get_instance().warning("security_ecc::init: Unaible to set EC elliptic_curve"); + return -1; + } + bn_print("security_ecc::init: _ec_group_order=", _ec_group_order); //loggers::get_instance().log("<<< security_ecc::init: 0"); return 0; @@ -1138,7 +1147,7 @@ int security_ecc::public_key_to_bin(OCTETSTRING &p_bin_key) { // ec_key_public_k p_bin_key = int2oct(0, BN_num_bytes(pub_bn)); ::BN_bn2bin(pub_bn, (unsigned char *)static_cast(p_bin_key)); - ::BN_clear_free(pub_bn); + ::BN_free(pub_bn); return 0; } @@ -1244,3 +1253,325 @@ int security_ecc::compute_digest_sm3(const OCTETSTRING &p_data, const OCTETSTRIN loggers::get_instance().log_msg("<<< security_ecc::compute_digest_sm3: p_secret_key: ", p_digest); return 0; } + +int security_ecc::generate_bkf_signing_expension_keys(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key) { + loggers::get_instance().log_msg(">>> security_ecc::generate_bkf_signing_expension_keys: ", p_i); + loggers::get_instance().log_msg(">>> security_ecc::generate_bkf_signing_expension_keys: ", p_j); + + size_t aes_len; + if (p_enc_algorithm == encryption_algotithm::aes_128_ecb) { + aes_len = 16; + } else { + loggers::get_instance().warning("security_ecc::generate_bkf_signing_expension_keys: Wrong algorithm: %d", p_enc_algorithm); + return -1; + } + + // Calculate kS = 0^32 || i || j || 0^32 + BIGNUM* x_cert = BN_new(); // kS = (i * 4294967296 + j) * 4294967296; + BN_zero(x_cert); + int res = ::BN_add_word(x_cert, p_i); + res = ::BN_mul_word(x_cert, 4294967296); + res = ::BN_add_word(x_cert, p_j); + res = ::BN_mul_word(x_cert, 4294967296); + unsigned char kS[aes_len]; + ::BN_bn2binpad(x_cert, kS, aes_len); + loggers::get_instance().log_to_hexa("security_ecc::generate_bkf_signing_expension_keys: kS: ", kS, aes_len); + + unsigned char* random_signing_aes_enc_key = (unsigned char*)OPENSSL_malloc(aes_len); + if (p_debug == true) { + const unsigned char random_signing_aes_enc_key_test[aes_len] = { 0x12, 0x1D, 0x14, 0x21, 0x67, 0x15, 0xE1, 0x1D, 0x2D, 0x37, 0x87, 0x43, 0x4A, 0x67, 0x3B, 0x1B }; // FIXME Random + memcpy((void*)random_signing_aes_enc_key, (const void*)random_signing_aes_enc_key_test, aes_len); + } else { + if (::RAND_bytes(random_signing_aes_enc_key, sizeof(random_signing_aes_enc_key)) == -1) { + OPENSSL_free(random_signing_aes_enc_key); + loggers::get_instance().error("security_ecc::generate_bkf_signing_expension_keys: RAND_bytes failure"); + return -1; + } + } + loggers::get_instance().log_to_hexa("security_ecc::generate_bkf_signing_expension_keys: random_signing_aes_enc_key: ", random_signing_aes_enc_key, aes_len); + + unsigned char* bin_signing_expension_key; + res = bkf_expension_function( + p_enc_algorithm, + random_signing_aes_enc_key, + kS, // P1609.2.1/D7, January 2022 Clause 9.3.3 Caterpillar key pair generation - kS + aes_len, + &bin_signing_expension_key + ); + if (res == -1) { + OPENSSL_free(random_signing_aes_enc_key); + loggers::get_instance().error("security_ecc::generate_bkf_signing_expension_keys: bkf_expension_function failure"); + return -1; + } + p_expension_key = OCTETSTRING(res, bin_signing_expension_key); + OPENSSL_free(random_signing_aes_enc_key); + OPENSSL_free(bin_signing_expension_key); + + loggers::get_instance().log_msg("<<< security_ecc::generate_bkf_signing_expension_keys: p_expension_key: ", p_expension_key); + return 0; +} + +int security_ecc::generate_bkf_enc_expension_keys(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key) { + loggers::get_instance().log_msg(">>> security_ecc::generate_bkf_enc_expension_keys: ", p_i); + loggers::get_instance().log_msg(">>> security_ecc::generate_bkf_enc_expension_keys: ", p_j); + + size_t aes_len; + if (p_enc_algorithm == encryption_algotithm::aes_128_ecb) { + aes_len = 16; + } else { + loggers::get_instance().warning("security_ecc::generate_bkf_enc_expension_keys: Wrong algorithm: %d", p_enc_algorithm); + return -1; + } + + // Calculate kE = (1^32 || i || j || 0^32) + BIGNUM* x_enc = BN_new(); // kE = (((4294967296 - 1) * 4294967296 + i) * 4294967296 + j) * 4294967296; + BN_zero(x_enc); + int res = ::BN_add_word(x_enc, 4294967296 - 1); + res = ::BN_mul_word(x_enc, 4294967296); + res = ::BN_add_word(x_enc, p_i); + res = ::BN_mul_word(x_enc, 4294967296); + res = ::BN_add_word(x_enc, p_j); + res = ::BN_mul_word(x_enc, 4294967296); + unsigned char kE[16]; + ::BN_bn2binpad(x_enc, kE, 16); + loggers::get_instance().log_to_hexa("security_ecc::generate_bkf_enc_expension_keys: kE: ", kE, 16); + + unsigned char* random_encryption_aes_enc_key = (unsigned char*)OPENSSL_malloc(aes_len); + if (p_debug == true) { + const unsigned char random_encryption_aes_enc_key_test[aes_len] = { 0x6B, 0x71, 0xA7, 0xEB, 0x57, 0x55, 0xF1, 0x6E, 0x89, 0x98, 0x1D, 0x21, 0x89, 0xA6, 0xDA, 0xEA }; // FIXME Random + memcpy((void*)random_encryption_aes_enc_key, (const void*)random_encryption_aes_enc_key_test, aes_len); + } else { + if (::RAND_bytes(random_encryption_aes_enc_key, sizeof(random_encryption_aes_enc_key)) == -1) { + OPENSSL_free(random_encryption_aes_enc_key); + loggers::get_instance().error("security_ecc::generate_bkf_enc_expension_keys: RAND_bytes failure"); + return -1; + } + } + loggers::get_instance().log_to_hexa("security_ecc::generate_bkf_enc_expension_keys: random_encryption_aes_enc_key: ", random_encryption_aes_enc_key, aes_len); + + unsigned char* bin_enc_expension_key; + res = bkf_expension_function( + p_enc_algorithm, + random_encryption_aes_enc_key, + kE, // P1609.2.1/D7, January 2022 Clause 9.3.3 Caterpillar key pair generation - kS + aes_len, + &bin_enc_expension_key + ); + if (res == -1) { + OPENSSL_free(random_encryption_aes_enc_key); + loggers::get_instance().error("security_ecc::generate_bkf_enc_expension_keys: bkf_expension_function failure"); + return -1; + } + p_expension_key = OCTETSTRING(res, bin_enc_expension_key); + OPENSSL_free(random_encryption_aes_enc_key); + OPENSSL_free(bin_enc_expension_key); + + loggers::get_instance().log_msg("<<< security_ecc::generate_bkf_enc_expension_keys: p_expension_key: ", p_expension_key); + return 0; +} + +int security_ecc::bfk_expend_private_key(const OCTETSTRING& p_expansion_key, const OCTETSTRING& p_private_key, OCTETSTRING& p_expended_private_key) { + loggers::get_instance().log_msg(">>> security_ecc::bfk_expend_private_key: p_expansion_key: ", p_expansion_key); + loggers::get_instance().log_msg(">>> security_ecc::bfk_expend_private_key: p_private_key: ", p_private_key); + + BIGNUM* expansion_key = BN_new(); + ::BN_bin2bn(static_cast(p_expansion_key), p_expansion_key.lengthof(), expansion_key); + bn_print("security_ecc::bfk_expend_private_key: expansion_key= ", expansion_key); + BIGNUM* private_key = BN_new(); + ::BN_bin2bn(static_cast(p_private_key), p_private_key.lengthof(), private_key); + bn_print("security_ecc::bfk_expend_private_key: private_key= ", private_key); + + BIGNUM* a_exp = BN_new(); + int res = BN_add(a_exp, private_key, expansion_key); // P1609.2.1/D7, January 2022 Clause 9.3.4.1.1 General + // bi, j = a + ft(kt, i, j) or qi, j = p + ft(kt, i, j) + loggers::get_instance().log("security_ecc::bfk_expend_private_key: res=%d", res); + bn_print("security_ecc::bfk_expend_private_key: a_exp= ", a_exp); + res = BN_mod(a_exp, a_exp, _ec_group_order, _bn_ctx); + bn_print("security_ecc::bfk_expend_private_key: a_exp mod l= ", a_exp); + unsigned char* buf = (unsigned char*)OPENSSL_malloc(BN_num_bytes(a_exp)); + res = ::BN_bn2binpad(a_exp, buf, BN_num_bytes(a_exp)); + p_expended_private_key = OCTETSTRING(BN_num_bytes(a_exp), buf); + loggers::get_instance().log_msg("security_ecc::bfk_expend_private_key: p_expended_private_key: ", p_expended_private_key); + + OPENSSL_free(buf); + ::BN_free(expansion_key); + ::BN_free(private_key); + ::BN_free(a_exp); + return 0; +} + +int security_ecc::bfk_expend_public_key(const OCTETSTRING& p_expansion_key, const OCTETSTRING& p_compressed_public_key, const INTEGER& p_compressed_mode, OCTETSTRING& p_expended_compressed_publi_key, INTEGER& p_expended_compressed_mode) { + loggers::get_instance().log_msg(">>> security_ecc::bfk_expend_public_key: p_expansion_key: ", p_expansion_key); + loggers::get_instance().log_msg(">>> security_ecc::bfk_expend_public_key: p_compressed_public_key: ", p_compressed_public_key); + loggers::get_instance().log_msg(">>> security_ecc::bfk_expend_public_key: p_compressed_mode: ", p_compressed_mode); + + // P1609.2.1/D7, January 2022 Clause 9.3.4.2.1 General + // Bi, j = A + ft(kt, i, j) × G or Qi, j = P + ft(kt, i, j) × G, B = signing_expension_key * G + + // Convert compressed key into uncompressed key + // TODO Create a function uncompressed to copmpressed ec_point + // TODO Create a function ec_point to compressed bin and to uncompressed bin + EC_POINT* A; + compressed_key_to_ec_point(p_compressed_public_key, p_compressed_mode, &A); + // { + // BIGNUM* compressed_key = ::BN_new(); + // ::BN_bin2bn(static_cast(p_compressed_public_key), p_compressed_public_key.lengthof(), compressed_key); + // int result = ::EC_POINT_set_compressed_coordinates_GFp(_ec_group, A, compressed_key, (p_compressed_mode == static_cast(ecc_compressed_mode::compressed_y_1)) ? 1 : 0, _bn_ctx); // Use primary elliptic curve + // ::BN_free(compressed_key); + // // Set public keys + // BIGNUM *xy = ::BN_new(); + // ::EC_POINT_point2bn(_ec_group, A, POINT_CONVERSION_UNCOMPRESSED, xy, _bn_ctx); + // if (BN_num_bytes(xy) == 0) { + // ::BN_free(xy); + // loggers::get_instance().error("security_ecc::bfk_expend_public_key: Failed to generate xy coordinates, check algorithms"); + // return -1; + // } + // loggers::get_instance().log("security_ecc::bfk_expend_public_key: xy length: %d", BN_num_bytes(xy)); + // bn_print("security_ecc::bfk_expend_public_key: xy: ", xy); + // ::BN_free(xy); + // } + ec_point_print("A: ", A); + + BIGNUM* expansion_key = ::BN_new(); + ::BN_bin2bn(static_cast(p_expansion_key), p_expansion_key.lengthof(), expansion_key); + EC_POINT* B = ::EC_POINT_new(_ec_group); + int res = ::EC_POINT_mul(_ec_group, B, expansion_key, NULL, NULL, _bn_ctx); + // A + f_k(x_cert)*G_P256 mod l + EC_POINT* A_exp = EC_POINT_new(_ec_group); + res = ::EC_POINT_add(_ec_group, A_exp, A, B, _bn_ctx); + ec_point_print("A_exp: ", A_exp); + + // Convert EC_POINT into compressed mode + OCTETSTRING os; + { + const EC_POINT *pub = ::EC_KEY_get0_public_key(_ec_key); + BIGNUM *bn_A_exp = ::BN_new(); + ::EC_POINT_point2bn(_ec_group, A_exp, POINT_CONVERSION_COMPRESSED, bn_A_exp, _bn_ctx); + bn_print("security_ecc::bfk_expend_public_key: ", bn_A_exp); + os = int2oct(0, BN_num_bytes(bn_A_exp)); + ::BN_bn2bin(bn_A_exp, (unsigned char *)static_cast(os)); + ::BN_free(bn_A_exp); + } + p_expended_compressed_mode = (static_cast(os[0].get_octet()) == 0x02) ? 0 : 1; + p_expended_compressed_publi_key = OCTETSTRING(os.lengthof() - 1, static_cast(os) + 1); + loggers::get_instance().log_msg("security_ecc::generate_bkf_enc_expension_keys: p_expended_compressed_publi_key: ", p_expended_compressed_publi_key); + loggers::get_instance().log_msg("security_ecc::generate_bkf_enc_expension_keys: p_expended_compressed_mode: ", p_expended_compressed_mode); + + + ::BN_free(expansion_key); + ::EC_POINT_free(A_exp); + ::EC_POINT_free(A); + ::EC_POINT_free(B); + + return 0; +} + +boolean security_ecc::bfk_verify_expended_keys(const OCTETSTRING& p_private_key, const OCTETSTRING& p_compressed_public_key, const INTEGER& p_compressed_mode) { + loggers::get_instance().log_msg(">>> bfk_verify_expended_keys: p_private_key: ", p_private_key); + loggers::get_instance().log_msg(">>> bfk_verify_expended_keys: p_compressed_public_key: ", p_compressed_public_key); + loggers::get_instance().log_msg(">>> bfk_verify_expended_keys: p_compressed_mode: ", p_compressed_mode); + + BIGNUM* a_exp = BN_new(); + ::BN_bin2bn((unsigned char *)static_cast(p_private_key), p_private_key.lengthof(), a_exp); + EC_POINT* A_exp; + compressed_key_to_ec_point(p_compressed_public_key, p_compressed_mode, &A_exp); + + EC_POINT* pubkey_verif = ::EC_POINT_new(_ec_group); + int res = ::EC_POINT_mul(_ec_group, pubkey_verif, a_exp, NULL, NULL, _bn_ctx); + res = EC_POINT_cmp(_ec_group, pubkey_verif, A_exp, _bn_ctx); + loggers::get_instance().log("bfk_verify_expended_keys: res=%d", res); + + ::BN_free(a_exp); + ::EC_POINT_free(A_exp); + ::EC_POINT_free(pubkey_verif); + + return res; +} + +int security_ecc::compressed_key_to_ec_point(const OCTETSTRING& p_compressed_public_key, const INTEGER& p_compressed_mode, EC_POINT** p_ec_point) { + *p_ec_point = ::EC_POINT_new(_ec_group); + + BIGNUM* compressed_key = ::BN_new(); + ::BN_bin2bn(static_cast(p_compressed_public_key), p_compressed_public_key.lengthof(), compressed_key); + int result = ::EC_POINT_set_compressed_coordinates_GFp(_ec_group, *p_ec_point, compressed_key, (p_compressed_mode == static_cast(ecc_compressed_mode::compressed_y_1)) ? 1 : 0, _bn_ctx); // Use primary elliptic curve + ::BN_free(compressed_key); + // Set public keys + BIGNUM *xy = ::BN_new(); + ::EC_POINT_point2bn(_ec_group, *p_ec_point, POINT_CONVERSION_UNCOMPRESSED, xy, _bn_ctx); + if (BN_num_bytes(xy) == 0) { + ::BN_free(xy); + loggers::get_instance().error("security_ecc::bfk_expend_public_key: Failed to generate xy coordinates, check algorithms"); + return -1; + } + loggers::get_instance().log("security_ecc::bfk_expend_public_key: xy length: %d", BN_num_bytes(xy)); + bn_print("security_ecc::bfk_expend_public_key: xy: ", xy); + ::BN_free(xy); + + return 0; +} + +int security_ecc::bkf_expension_function(const encryption_algotithm p_enc_algorithm, const unsigned char* p_random_signing_aes_enc_key, const unsigned char* p_expension_key, const size_t p_key_len, unsigned char** p_bin_result) { + loggers::get_instance().log(">>> security_ecc::bkf_expension_function"); + + const EVP_CIPHER* type; + if (p_enc_algorithm == encryption_algotithm::aes_128_ecb) { // See crypto/objects/obj_dat.h, ln_objs array + type = ::EVP_aes_128_ecb(); + // Sanity check + if (p_key_len != 16) { + return -1; + } + } else { + return -1; + } + EVP_CIPHER_CTX* bfk_ctx = ::EVP_CIPHER_CTX_new(); + int res = ::EVP_EncryptInit_ex(bfk_ctx, type, NULL, p_random_signing_aes_enc_key, NULL); + BIGNUM *xpi = ::BN_new(); + ::BN_bin2bn(p_expension_key, p_key_len, xpi); + BIGNUM *aes_xpi = ::BN_new(); + unsigned char* bin_xpi = (unsigned char*)OPENSSL_malloc(p_key_len); + int bin_aes_xpi_len = 0; + unsigned char* bin_aes_xpi = (unsigned char*)OPENSSL_malloc(p_key_len); + unsigned char* bin_blk = (unsigned char*)OPENSSL_malloc(3 * p_key_len); + size_t bin_result_idx = 0; + for (int i = 1; i < 4; i++) { // 3 times the block + loggers::get_instance().log("security_ecc::bkf_expension_function: x+%d: Input to AES block %d encryption (128 bits):", i , i); + // Calculate xpi + 1 + ::BN_add_word(xpi, 1); + bn_print("security_ecc::bkf_expension_function: xpi=", xpi); + res = ::BN_bn2binpad(xpi, bin_xpi, p_key_len); + loggers::get_instance().log_to_hexa("security_ecc::bkf_expension_function: xpi+x: ", bin_xpi, p_key_len); + // Calculate AES(k, xpi+i) + loggers::get_instance().log("security_ecc::bkf_expension_function: AES_k(x+%d): Output of AES block %d encryption (128 bits):", i , i); + res = ::EVP_EncryptUpdate(bfk_ctx, bin_aes_xpi, &bin_aes_xpi_len, bin_xpi, p_key_len); + loggers::get_instance().log_to_hexa("security_ecc::bkf_expension_function: bin_aes_xpi: ", bin_aes_xpi, bin_aes_xpi_len); + // Calculate the XOR between blocks - P1609.2.1/D7, January 2022 Clause 9.3.3.1.3 Expansion process paragraph c + for (int j = 0; j < p_key_len; j++) { + bin_blk[bin_result_idx++] = bin_aes_xpi[j] ^ bin_xpi[j]; + } // End of 'for' statement + } // End of 'for' statement + + // Final result - P1609.2.1/D7, January 2022 Clause 9.3.3.1.3 Expansion process paragraph d + BIGNUM* blk = ::BN_new(); + ::BN_bin2bn(bin_blk, 3 * p_key_len, blk); + + loggers::get_instance().log_to_hexa("security_ecc::bkf_expension_function: bin_blk: ", bin_blk, 3 * p_key_len); + + BIGNUM* result = ::BN_new(); + BN_mod(result, blk, _ec_group_order, _bn_ctx); + loggers::get_instance().log("security_ecc::bkf_expension_function: BN_num_bytes: %d", BN_num_bytes(result)); + *p_bin_result = (unsigned char*)OPENSSL_malloc(BN_num_bytes(result)); + res = ::BN_bn2binpad(result, *p_bin_result, BN_num_bytes(result)); + loggers::get_instance().log("security_ecc::bkf_expension_function: res: %d", res); + loggers::get_instance().log_to_hexa("security_ecc::bkf_expension_function: p_bin_result: ", *p_bin_result, BN_num_bytes(result)); + + OPENSSL_free(bin_blk); + OPENSSL_free(bin_xpi); + OPENSSL_free(bin_aes_xpi); + ::BN_free(result); + ::BN_free(blk); + ::BN_free(aes_xpi); + ::BN_free(xpi); + ::EVP_CIPHER_CTX_free(bfk_ctx); + + return 32; +} \ No newline at end of file diff --git a/ccsrc/Protocols/Security/security_ecc.hh b/ccsrc/Protocols/Security/security_ecc.hh index 3009b95..f1e4b91 100644 --- a/ccsrc/Protocols/Security/security_ecc.hh +++ b/ccsrc/Protocols/Security/security_ecc.hh @@ -45,7 +45,8 @@ enum class encryption_algotithm : unsigned char { // TODO Renamed into ecc_encry aes_128_ccm, aes_256_ccm, aes_128_gcm, - aes_256_gcm + aes_256_gcm, + aes_128_ecb }; // End of class ecc_encryption_algotithm /*! @@ -67,6 +68,7 @@ class security_ecc { encryption_algotithm _encryption_algotithm; /*!< Selected encryption algotithm */ EC_KEY * _ec_key; /*!< EC_KEY reference */ const EC_GROUP * _ec_group; /*!< EC_GROUP reference */ + BIGNUM* _ec_group_order; /*!< EC_GROUP order */ BN_CTX * _bn_ctx; /*!< Pre-alocated memory used to increase OpenSSL processing */ OCTETSTRING _pri_key; /*!< Private key storage */ OCTETSTRING _pub_key_x; /*!< Public key X-coordinate storage */ @@ -246,7 +248,25 @@ public: //! \publicsection * \remark The instance of security_ecc shall contain the reconstruction key * \return 0 on success, -1 otherwise */ - int reconstruct_public_keys(const OCTETSTRING &p_cert_to_be_signed, const OCTETSTRING &p_issuer_public_key_x,const OCTETSTRING &p_issuer_public_key_y, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y, OCTETSTRING &p_public_key_compressed, INTEGER &p_public_key_compressed_mode); + int reconstruct_public_keys(const OCTETSTRING &p_cert_to_be_signed, const OCTETSTRING &p_issuer_public_key_x, const OCTETSTRING &p_issuer_public_key_y, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y, OCTETSTRING &p_public_key_compressed, INTEGER &p_public_key_compressed_mode); + + /*! + * \fn integer generate_bkf_signing_expension_keys(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); + * \brief Produce a BKF expension key for signing as defined in P1609.2.1/D7 Clause 9.3.3.1 Butterfly expansion functions + */ + int generate_bkf_signing_expension_keys(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); + + /*! + * \fn integer generate_bkf_enc_expension_keys(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); + * \brief Produce a BKF expension key for encryption as defined in P1609.2.1/D7 Clause 9.3.3.1 Butterfly expansion functions + */ + int generate_bkf_enc_expension_keys(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); + + int bfk_expend_private_key(const OCTETSTRING& p_expansion_key, const OCTETSTRING& p_private_key, OCTETSTRING& p_expended_private_key); + + int bfk_expend_public_key(const OCTETSTRING& p_expansion_key, const OCTETSTRING& p_compressed_public_key, const INTEGER& p_compressed_mode, OCTETSTRING& p_expended_compressed_publi_key, INTEGER& p_expended_compressed_mode); + + boolean bfk_verify_expended_keys(const OCTETSTRING& p_private_key, const OCTETSTRING& p_compressed_public_key, const INTEGER& p_compressed_mode); inline const OCTETSTRING & private_key() const { return _pri_key; }; inline const OCTETSTRING & public_key_x() const { return _pub_key_x; }; @@ -297,4 +317,18 @@ private: //! \privatesection int compute_digest_sm3(const OCTETSTRING &p_data, const OCTETSTRING &p_entl_a, const OCTETSTRING &p_id, OCTETSTRING &p_digest); + /*! + * \fn integer bkf_expension_function(const encryption_algotithm p_enc_algorithm, const unsigned char* p_random_signing_aes_enc_key, const unsigned char* p_expension_key, const size_t p_key_len, unsigned char** p_bin_result); + * \brief Produce a BKF expension key for either signing or encryption as defined in P1609.2.1/D7 Clause 9.3.3.1 Butterfly expansion functions + * \param[in] p_enc_algorithm An encryption algorithm Symm + * \param[in] p_random_signing_aes_enc_key A symmetric encryption algorithm Symm + * \param[in] p_expension_key A 128 bit key, denoted as kS + * \param[in] p_key_len The encryption key length + * \param[out] p_bin_result The 256 bit integer + * \return The length in bytes of the expension key on success, -1 otherwise + */ + int bkf_expension_function(const encryption_algotithm p_enc_algorithm, const unsigned char* p_random_signing_aes_enc_key, const unsigned char* p_expension_key, const size_t p_key_len, unsigned char** p_bin_result); + + int compressed_key_to_ec_point(const OCTETSTRING& p_compressed_public_key, const INTEGER& p_compressed_mode, EC_POINT** p_ec_point); + }; // End of class security_ecc diff --git a/ccsrc/Protocols/Security/security_services_its.cc b/ccsrc/Protocols/Security/security_services_its.cc index 1d7041e..d9f1021 100644 --- a/ccsrc/Protocols/Security/security_services_its.cc +++ b/ccsrc/Protocols/Security/security_services_its.cc @@ -25,7 +25,7 @@ using namespace std; // Required for isnan() security_services_its *security_services_its::instance = nullptr; security_services_its::security_services_its() - : _setup_done{false}, _ec_keys_enc(nullptr), _security_cache(new security_cache), _security_db(nullptr), _last_generation_time(0), + : _setup_done{false}, _ec_keys_enc(nullptr), _bkf_expension_keys(nullptr), _security_cache(new security_cache), _security_db(nullptr), _last_generation_time(0), _unknown_certificate(0, nullptr), _requested_certificate(), _latitude(0), _longitude(0), _elevation(0), _geospacial() { loggers::get_instance().log(">>> security_services_its::security_services_its"); @@ -74,6 +74,8 @@ int security_services_its::setup(params_its &p_params) { // FIXME Rename this me return -1; } + _bkf_expension_keys.reset(new security_ecc(ec_elliptic_curves::nist_p_256)); // FIXME To be ehance if aniother algorithm shall be supported + return 0; } @@ -941,6 +943,84 @@ int security_services_its::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_t return 0; } +int security_services_its::generate_bkf_signing_expension_keys(const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key) { + loggers::get_instance().log_msg(">>> security_services_its::generate_bkf_signing_expension_keys: ", p_i); + loggers::get_instance().log_msg(">>> security_services_its::generate_bkf_signing_expension_keys: ", p_j); + + // Sanity checks + if (_bkf_expension_keys.get() == nullptr) { + loggers::get_instance().warning("security_services_its::generate_bkf_signing_expension_keys: Encryption not initialised"); + return -1; + } + int ret_code = _bkf_expension_keys.get()->generate_bkf_signing_expension_keys(encryption_algotithm::aes_128_ecb, p_i, p_j, p_debug, p_expension_key); + loggers::get_instance().log_msg("security_services_its::generate_bkf_signing_expension_keys: p_expension_key=", p_expension_key); + + return ret_code; +} + +int security_services_its::generate_bkf_enc_expension_keys(const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key) { + loggers::get_instance().log_msg(">>> security_services_its::generate_bkf_enc_expension_keys: ", p_i); + loggers::get_instance().log_msg(">>> security_services_its::generate_bkf_enc_expension_keys: ", p_j); + + // Sanity checks + if (_bkf_expension_keys.get() == nullptr) { + loggers::get_instance().warning("security_services_its::generate_bkf_enc_expension_keys: Encryption not initialised"); + return -1; + } + int ret_code = _bkf_expension_keys.get()->generate_bkf_enc_expension_keys(encryption_algotithm::aes_128_ecb, p_i, p_j, p_debug, p_expension_key); + loggers::get_instance().log_msg("security_services_its::generate_bkf_enc_expension_keys: p_expension_key=", p_expension_key); + + return ret_code; +} + +int security_services_its::bfk_expend_private_key(const OCTETSTRING& p__expansion__key, const OCTETSTRING& p__private__key, OCTETSTRING& p__expended__private__key) { + loggers::get_instance().log_msg(">>> bfk_expend_private_key: p__expansion__key: ", p__expansion__key); + loggers::get_instance().log_msg(">>> bfk_expend_private_key: p__private__key: ", p__private__key); + + // Sanity checks + if (_bkf_expension_keys.get() == nullptr) { + loggers::get_instance().warning("security_services_its::bfk_expend_private_key: Encryption not initialised"); + return -1; + } + int ret_code = _bkf_expension_keys.get()->bfk_expend_private_key(p__expansion__key, p__private__key, p__expended__private__key); + loggers::get_instance().log_msg("security_services_its::bfk_expend_private_key: p__expended__private__key=", p__expended__private__key); + + return ret_code; +} + +int security_services_its::bfk_expend_public_key(const OCTETSTRING& p__expansion__key, const OCTETSTRING& p__compressed__public__key, const INTEGER& p__compressed__mode, OCTETSTRING& p__expended__compressed__public__key, INTEGER& p__expended__compressed__mode) { + loggers::get_instance().log_msg(">>>security_services_its:: bfk_expend_public_key: p__expansion__key: ", p__expansion__key); + loggers::get_instance().log_msg(">>> security_services_its::bfk_expend_public_key: p__compressed__public__key: ", p__compressed__public__key); + loggers::get_instance().log_msg(">>> security_services_its::bfk_expend_public_key: p__compressed__mode: ", p__compressed__mode); + + // Sanity checks + if (_bkf_expension_keys.get() == nullptr) { + loggers::get_instance().warning("security_services_its::bfk_expend_public_key::bfk_expend_private_key: Encryption not initialised"); + return -1; + } + int ret_code = _bkf_expension_keys.get()->bfk_expend_public_key(p__expansion__key, p__compressed__public__key, p__compressed__mode, p__expended__compressed__public__key, p__expended__compressed__mode); + loggers::get_instance().log_msg("security_services_its::bfk_expend_public_key::bfk_expend_private_key: p__expended__compressed__public__key=", p__expended__compressed__public__key); + loggers::get_instance().log_msg("security_services_its::bfk_expend_public_key::bfk_expend_private_key: p__expended__compressed__mode=", p__expended__compressed__mode); + + return ret_code; +} + +boolean security_services_its::bfk_verify_expended_keys(const OCTETSTRING& p__expended__private__key, const OCTETSTRING& p__expended__compressed__public__key, const INTEGER& p__expended__compressed__mode) { + loggers::get_instance().log_msg(">>> security_services_its::bfk_verify_expended_keys: p__expended__private__key: ", p__expended__private__key); + loggers::get_instance().log_msg(">>> security_services_its::bfk_verify_expended_keys: p__expended__compressed__public__key: ", p__expended__compressed__public__key); + loggers::get_instance().log_msg(">>> security_services_its::bfk_verify_expended_keys: p__expended__compressed__mode: ", p__expended__compressed__mode); + + // Sanity checks + if (_bkf_expension_keys.get() == nullptr) { + loggers::get_instance().warning("bfk_verify_expended_keys::bfk_expend_private_key: Encryption not initialised"); + return -1; + } + boolean ret_code = _bkf_expension_keys.get()->bfk_verify_expended_keys(p__expended__private__key, p__expended__compressed__public__key, p__expended__compressed__mode); + loggers::get_instance().log("security_services_its::bfk_verify_expended_keys::bfk_expend_private_key: ret_code=%d", ret_code); + + return ret_code; +} + int security_services_its::hash_sha256(const OCTETSTRING &p_data, OCTETSTRING &p_hash_data) { loggers::get_instance().log_msg(">>> security_services_its::hash_sha256: ", p_data); diff --git a/ccsrc/Protocols/Security/security_services_its.hh b/ccsrc/Protocols/Security/security_services_its.hh index f458fe0..4c1e371 100644 --- a/ccsrc/Protocols/Security/security_services_its.hh +++ b/ccsrc/Protocols/Security/security_services_its.hh @@ -49,7 +49,8 @@ class security_services_its { params_its _params; bool _setup_done; std::unique_ptr _ec_keys_enc; - std::unique_ptr _ec_keys_dec; +// std::unique_ptr _ec_keys_dec; + std::unique_ptr _bkf_expension_keys; std::unique_ptr _security_cache; std::unique_ptr _security_db; unsigned long long _last_generation_time; @@ -69,6 +70,7 @@ class security_services_its { */ ~security_services_its() { _ec_keys_enc.reset(nullptr); + _bkf_expension_keys.reset(nullptr); _security_db.reset(nullptr); _security_cache.reset(nullptr); if (instance != NULL) { @@ -160,6 +162,28 @@ public: /*! \publicsection */ const int get_protocol_version() const { return ProtocolVersion; }; + /*! + * \fn integer generate_bkf_signing_expension_keys(const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); + * \brief Produce a BKF expension key for either signing or encryption as defined in P1609.2.1/D7 Clause 9.3.3.1 Butterfly expansion functions + * \param[in] p_i iINT value in the range 0 < iINT + * \param[in] p_j jINT value in the range jINT < 232– 1. + * \param[in] p_debug Set to true if test vectors should be used. For debugging purposes only + * \param[out] p_bin_result The 256 bit integer + */ + int generate_bkf_signing_expension_keys(const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); + + /*! + * \fn integer generate_bkf_enc_expension_keys(const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); + * \brief Produce a BKF expension key for either signing or encryption as defined in P1609.2.1/D7 Clause 9.3.3.1 Butterfly expansion functions + */ + int generate_bkf_enc_expension_keys(const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); + + int bfk_expend_private_key(const OCTETSTRING& p__expansion__key, const OCTETSTRING& p__private__key, OCTETSTRING& p__expended__private__key); + + int bfk_expend_public_key(const OCTETSTRING& p__expansion__key, const OCTETSTRING& p__compressed__public__key, const INTEGER& p__compressed__mode, OCTETSTRING& p__expended__compressed__public__key, INTEGER& p__expended__compressed__mode); + + boolean bfk_verify_expended_keys(const OCTETSTRING& p__expended__private__key, const OCTETSTRING& p__expended__compressed__public__key, const INTEGER& p__expended__compressed__mode); + /*! * \fn int fill_public_key_vectors(const ec_elliptic_curves p_elliptic_curve, const Ieee1609Dot2BaseTypes::EccP256CurvePoint &p_ecc_point, OCTETSTRING &p_public_comp_key, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y); * \brief Initialize public key vectors, based on 256 bits curve diff --git a/etc/AtsPki/AtsPki_Microsec.cfg_ b/etc/AtsPki/AtsPki_Microsec.cfg_ index 0b0a817..2c0d646 100644 --- a/etc/AtsPki/AtsPki_Microsec.cfg_ +++ b/etc/AtsPki/AtsPki_Microsec.cfg_ @@ -9,6 +9,8 @@ LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "../data/certificates" # Configuration sub-directory to access certificate stored in files LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" +LibItsSecurity_Pixits.PX_BFK_TEST_VECTORS := true + LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" LibItsPki_Pics.PICS_MULTIPLE_END_POINT := false @@ -60,8 +62,11 @@ LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3 #LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 #LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 -LibItsSecurity_Pics.PICS_SEC_CIRCULAR_REGION := false -LibItsSecurity_Pics.PICS_SEC_RECTANGULAR_REGION := true +LibItsSecurity_Pics.PICS_SEC_CIRCULAR_REGION := false +LibItsSecurity_Pics.PICS_SEC_RECTANGULAR_REGION := true +LibItsSecurity_Pics.PICS_SECPKI_ORIGINAL_BFK_KEY := true +LibItsSecurity_Pics.PICS_SECPKI_UNIFIED_BFK_KEY := false +LibItsSecurity_Pics.PICS_SECPKI_COMPACT_UNIFIED_BFK_KEY := false [LOGGING] # In this section you can specify the name of the log file and the classes of events @@ -125,7 +130,7 @@ system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/ #ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_13_BI # The EnrolmentResponse message shall be encrypted using an ETSI TS 103 097 approved algorithm and the encryption shall be done with the same AES key as the one used by the ITS-S requestor for the encryption of the EnrolmentRequest message. -ItsPki_TestCases.TC_SECPKI_EA_ENR_01_BV +#ItsPki_TestCases.TC_SECPKI_EA_ENR_01_BV # The EnrolmentResponse message shall be encrypted using an ETSI TS 103 097 approved algorithm and the encryption shall be done with the same AES key as the one used by the ITS-S requestor for the encryption of the EnrolmentRequest message. #ItsPki_TestCases.TC_SECPKI_EA_ENR_02_BV # The outermost structure is an EtsiTs103097Data-Encrypted structure containing the component recipients containing one instance of RecipientInfo of choice pskRecipInfo, which contains the HashedId8 of the symmetric key used by the ITS-S to encrypt the EnrolmentRequest message to which the response is built and containing the component ciphertext, once decrypted, contains an EtsiTs103097Data-Signed structure @@ -154,8 +159,9 @@ ItsPki_TestCases.TC_SECPKI_EA_ENR_01_BV # Check that EA doesn't accept Authorization Validation Request when SharedAtRequest is signed with certificate without appropriate permissions #ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_RCV_02_BI -# -#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV +# Check that the EA sends the butterfly authorization respond message after receiving of the butterfly authorization request +# Check that this message is signed with EA certificate +ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV # #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_02_BV # diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index 20a3d2a..ed6b273 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit 20a3d2a15442df8bfa7f4bb9480fc05a13b15e81 +Subproject commit ed6b27353f8865f3491c0198b54ed7b6f4da8390 -- GitLab From 9b48588fe95fd0cdb07581b9ac719818c15fa8aa Mon Sep 17 00:00:00 2001 From: garciay Date: Fri, 25 Aug 2023 22:05:12 +0200 Subject: [PATCH 107/178] Enhance BFK support --- ccsrc/Protocols/Security/security_ecc.cc | 210 +++++++++++------------ ccsrc/Protocols/Security/security_ecc.hh | 35 ++-- ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- 4 files changed, 117 insertions(+), 132 deletions(-) diff --git a/ccsrc/Protocols/Security/security_ecc.cc b/ccsrc/Protocols/Security/security_ecc.cc index f7ce65d..0b871f4 100644 --- a/ccsrc/Protocols/Security/security_ecc.cc +++ b/ccsrc/Protocols/Security/security_ecc.cc @@ -1123,52 +1123,6 @@ const int security_ecc::init() { return 0; } // End of init -int security_ecc::bin_to_ec_point(const OCTETSTRING &p_public_key_x, const OCTETSTRING &p_public_key_y, - EC_POINT **p_ec_point) { // ec_key_public_key_bin_to_point - BIGNUM *pubk_bn; - - OCTETSTRING v = int2oct(4, 1); - v += p_public_key_x; - v += p_public_key_y; - - pubk_bn = ::BN_bin2bn(static_cast(v), v.lengthof(), nullptr); - *p_ec_point = ::EC_POINT_new(_ec_group); - ::EC_POINT_bn2point(_ec_group, pubk_bn, *p_ec_point, _bn_ctx); - ::BN_clear_free(pubk_bn); - - return 0; -} - -int security_ecc::public_key_to_bin(OCTETSTRING &p_bin_key) { // ec_key_public_key_to_bin - const EC_POINT *pub = ::EC_KEY_get0_public_key(_ec_key); - BIGNUM *pub_bn = ::BN_new(); - - ::EC_POINT_point2bn(_ec_group, pub, POINT_CONVERSION_UNCOMPRESSED, pub_bn, _bn_ctx); - p_bin_key = int2oct(0, BN_num_bytes(pub_bn)); - ::BN_bn2bin(pub_bn, (unsigned char *)static_cast(p_bin_key)); - - ::BN_free(pub_bn); - - return 0; -} - -void security_ecc::ec_point_print(const std::string& p_label, const EC_POINT *p_key) { - BIGNUM * x = ::BN_new(); - BIGNUM * y = ::BN_new(); - ::EC_POINT_get_affine_coordinates(_ec_group, p_key, x, y, NULL); - char* sx = ::BN_bn2hex(x); - char* sy = ::BN_bn2hex(y); - loggers::get_instance().log("%sx=%s\ny=%s\n", p_label.c_str(), sx, sy); - free(sx); free(sy); - ::BN_free(x); ::BN_free(y); -} - -void security_ecc::bn_print(const std::string& p_label, const BIGNUM* p_num) { - char* s = ::BN_bn2hex(p_num); - loggers::get_instance().log("%s:%s", p_label.c_str(), s); - free(s); -} - int security_ecc::kdf2(const OCTETSTRING &p_secret_key, const OCTETSTRING &p_salt, const unsigned char p_hash_algorithm, const int p_key_length, OCTETSTRING &p_digest) { loggers::get_instance().log(">>> security_ecc::kdf2"); @@ -1400,64 +1354,31 @@ int security_ecc::bfk_expend_private_key(const OCTETSTRING& p_expansion_key, con return 0; } -int security_ecc::bfk_expend_public_key(const OCTETSTRING& p_expansion_key, const OCTETSTRING& p_compressed_public_key, const INTEGER& p_compressed_mode, OCTETSTRING& p_expended_compressed_publi_key, INTEGER& p_expended_compressed_mode) { +int security_ecc::bfk_expend_public_key(const OCTETSTRING& p_expansion_key, const OCTETSTRING& p_compressed_public_key, const INTEGER& p_compressed_mode, OCTETSTRING& p_expended_compressed_public_key, INTEGER& p_expended_compressed_mode) { loggers::get_instance().log_msg(">>> security_ecc::bfk_expend_public_key: p_expansion_key: ", p_expansion_key); loggers::get_instance().log_msg(">>> security_ecc::bfk_expend_public_key: p_compressed_public_key: ", p_compressed_public_key); loggers::get_instance().log_msg(">>> security_ecc::bfk_expend_public_key: p_compressed_mode: ", p_compressed_mode); // P1609.2.1/D7, January 2022 Clause 9.3.4.2.1 General // Bi, j = A + ft(kt, i, j) × G or Qi, j = P + ft(kt, i, j) × G, B = signing_expension_key * G - - // Convert compressed key into uncompressed key - // TODO Create a function uncompressed to copmpressed ec_point - // TODO Create a function ec_point to compressed bin and to uncompressed bin - EC_POINT* A; - compressed_key_to_ec_point(p_compressed_public_key, p_compressed_mode, &A); - // { - // BIGNUM* compressed_key = ::BN_new(); - // ::BN_bin2bn(static_cast(p_compressed_public_key), p_compressed_public_key.lengthof(), compressed_key); - // int result = ::EC_POINT_set_compressed_coordinates_GFp(_ec_group, A, compressed_key, (p_compressed_mode == static_cast(ecc_compressed_mode::compressed_y_1)) ? 1 : 0, _bn_ctx); // Use primary elliptic curve - // ::BN_free(compressed_key); - // // Set public keys - // BIGNUM *xy = ::BN_new(); - // ::EC_POINT_point2bn(_ec_group, A, POINT_CONVERSION_UNCOMPRESSED, xy, _bn_ctx); - // if (BN_num_bytes(xy) == 0) { - // ::BN_free(xy); - // loggers::get_instance().error("security_ecc::bfk_expend_public_key: Failed to generate xy coordinates, check algorithms"); - // return -1; - // } - // loggers::get_instance().log("security_ecc::bfk_expend_public_key: xy length: %d", BN_num_bytes(xy)); - // bn_print("security_ecc::bfk_expend_public_key: xy: ", xy); - // ::BN_free(xy); - // } + EC_POINT* A; // Public key as defined in P1609.2.1/D7, January 2022 Clause 9.3.4.2.1 General + int res = compressed_key_to_ec_point(p_compressed_public_key, p_compressed_mode, &A); ec_point_print("A: ", A); BIGNUM* expansion_key = ::BN_new(); ::BN_bin2bn(static_cast(p_expansion_key), p_expansion_key.lengthof(), expansion_key); EC_POINT* B = ::EC_POINT_new(_ec_group); - int res = ::EC_POINT_mul(_ec_group, B, expansion_key, NULL, NULL, _bn_ctx); + res = ::EC_POINT_mul(_ec_group, B, expansion_key, NULL, NULL, _bn_ctx); // A + f_k(x_cert)*G_P256 mod l - EC_POINT* A_exp = EC_POINT_new(_ec_group); + EC_POINT* A_exp = EC_POINT_new(_ec_group); // Expanded public key as defined in P1609.2.1/D7, January 2022 Clause 9.3.4.2.1 General res = ::EC_POINT_add(_ec_group, A_exp, A, B, _bn_ctx); ec_point_print("A_exp: ", A_exp); // Convert EC_POINT into compressed mode - OCTETSTRING os; - { - const EC_POINT *pub = ::EC_KEY_get0_public_key(_ec_key); - BIGNUM *bn_A_exp = ::BN_new(); - ::EC_POINT_point2bn(_ec_group, A_exp, POINT_CONVERSION_COMPRESSED, bn_A_exp, _bn_ctx); - bn_print("security_ecc::bfk_expend_public_key: ", bn_A_exp); - os = int2oct(0, BN_num_bytes(bn_A_exp)); - ::BN_bn2bin(bn_A_exp, (unsigned char *)static_cast(os)); - ::BN_free(bn_A_exp); - } - p_expended_compressed_mode = (static_cast(os[0].get_octet()) == 0x02) ? 0 : 1; - p_expended_compressed_publi_key = OCTETSTRING(os.lengthof() - 1, static_cast(os) + 1); - loggers::get_instance().log_msg("security_ecc::generate_bkf_enc_expension_keys: p_expended_compressed_publi_key: ", p_expended_compressed_publi_key); + res = ec_point_to_compressed_key(A_exp, p_expended_compressed_public_key, p_expended_compressed_mode); + loggers::get_instance().log_msg("security_ecc::generate_bkf_enc_expension_keys: p_expended_compressed_public_key: ", p_expended_compressed_public_key); loggers::get_instance().log_msg("security_ecc::generate_bkf_enc_expension_keys: p_expended_compressed_mode: ", p_expended_compressed_mode); - ::BN_free(expansion_key); ::EC_POINT_free(A_exp); ::EC_POINT_free(A); @@ -1467,9 +1388,9 @@ int security_ecc::bfk_expend_public_key(const OCTETSTRING& p_expansion_key, cons } boolean security_ecc::bfk_verify_expended_keys(const OCTETSTRING& p_private_key, const OCTETSTRING& p_compressed_public_key, const INTEGER& p_compressed_mode) { - loggers::get_instance().log_msg(">>> bfk_verify_expended_keys: p_private_key: ", p_private_key); - loggers::get_instance().log_msg(">>> bfk_verify_expended_keys: p_compressed_public_key: ", p_compressed_public_key); - loggers::get_instance().log_msg(">>> bfk_verify_expended_keys: p_compressed_mode: ", p_compressed_mode); + loggers::get_instance().log_msg(">>> security_ecc::bfk_verify_expended_keys: p_private_key: ", p_private_key); + loggers::get_instance().log_msg(">>> security_ecc::bfk_verify_expended_keys: p_compressed_public_key: ", p_compressed_public_key); + loggers::get_instance().log_msg(">>> security_ecc::bfk_verify_expended_keys: p_compressed_mode: ", p_compressed_mode); BIGNUM* a_exp = BN_new(); ::BN_bin2bn((unsigned char *)static_cast(p_private_key), p_private_key.lengthof(), a_exp); @@ -1488,28 +1409,6 @@ boolean security_ecc::bfk_verify_expended_keys(const OCTETSTRING& p_private_key, return res; } -int security_ecc::compressed_key_to_ec_point(const OCTETSTRING& p_compressed_public_key, const INTEGER& p_compressed_mode, EC_POINT** p_ec_point) { - *p_ec_point = ::EC_POINT_new(_ec_group); - - BIGNUM* compressed_key = ::BN_new(); - ::BN_bin2bn(static_cast(p_compressed_public_key), p_compressed_public_key.lengthof(), compressed_key); - int result = ::EC_POINT_set_compressed_coordinates_GFp(_ec_group, *p_ec_point, compressed_key, (p_compressed_mode == static_cast(ecc_compressed_mode::compressed_y_1)) ? 1 : 0, _bn_ctx); // Use primary elliptic curve - ::BN_free(compressed_key); - // Set public keys - BIGNUM *xy = ::BN_new(); - ::EC_POINT_point2bn(_ec_group, *p_ec_point, POINT_CONVERSION_UNCOMPRESSED, xy, _bn_ctx); - if (BN_num_bytes(xy) == 0) { - ::BN_free(xy); - loggers::get_instance().error("security_ecc::bfk_expend_public_key: Failed to generate xy coordinates, check algorithms"); - return -1; - } - loggers::get_instance().log("security_ecc::bfk_expend_public_key: xy length: %d", BN_num_bytes(xy)); - bn_print("security_ecc::bfk_expend_public_key: xy: ", xy); - ::BN_free(xy); - - return 0; -} - int security_ecc::bkf_expension_function(const encryption_algotithm p_enc_algorithm, const unsigned char* p_random_signing_aes_enc_key, const unsigned char* p_expension_key, const size_t p_key_len, unsigned char** p_bin_result) { loggers::get_instance().log(">>> security_ecc::bkf_expension_function"); @@ -1574,4 +1473,91 @@ int security_ecc::bkf_expension_function(const encryption_algotithm p_enc_algori ::EVP_CIPHER_CTX_free(bfk_ctx); return 32; -} \ No newline at end of file +} + +int security_ecc::ec_point_to_compressed_key(const EC_POINT* p_ec_point, OCTETSTRING& p_compressed_public_key, INTEGER& p_compressed_mode) { + loggers::get_instance().log(">>> security_ecc::ec_point_to_compressed_key: p_private_key"); + ec_point_print("security_ecc::ec_point_to_compressed_key: p_ec_point: ", p_ec_point); + + const EC_POINT *pub = ::EC_KEY_get0_public_key(_ec_key); + BIGNUM *bn_compressed_key = ::BN_new(); + ::EC_POINT_point2bn(_ec_group, p_ec_point, POINT_CONVERSION_COMPRESSED, bn_compressed_key, _bn_ctx); + bn_print("security_ecc::ec_point_to_compressed_key: bn_compressed_key: ", bn_compressed_key); + OCTETSTRING os = int2oct(0, BN_num_bytes(bn_compressed_key)); + ::BN_bn2bin(bn_compressed_key, (unsigned char *)static_cast(os)); + ::BN_free(bn_compressed_key); + p_compressed_mode = (static_cast(os[0].get_octet()) == 0x02) ? 0 : 1; + p_compressed_public_key = OCTETSTRING(os.lengthof() - 1, static_cast(os) + 1); + loggers::get_instance().log_msg("security_ecc::ec_point_to_compressed_key: p_compressed_public_key: ", p_compressed_public_key); + loggers::get_instance().log_msg("security_ecc::ec_point_to_compressed_key: p_compressed_mode: ", p_compressed_mode); + + return 0; +} + +int security_ecc::compressed_key_to_ec_point(const OCTETSTRING& p_compressed_public_key, const INTEGER& p_compressed_mode, EC_POINT** p_ec_point) { + *p_ec_point = ::EC_POINT_new(_ec_group); + + BIGNUM* compressed_key = ::BN_new(); + ::BN_bin2bn(static_cast(p_compressed_public_key), p_compressed_public_key.lengthof(), compressed_key); + int result = ::EC_POINT_set_compressed_coordinates_GFp(_ec_group, *p_ec_point, compressed_key, (p_compressed_mode == static_cast(ecc_compressed_mode::compressed_y_1)) ? 1 : 0, _bn_ctx); // Use primary elliptic curve + ::BN_free(compressed_key); + // Set public keys + BIGNUM *xy = ::BN_new(); + ::EC_POINT_point2bn(_ec_group, *p_ec_point, POINT_CONVERSION_UNCOMPRESSED, xy, _bn_ctx); + if (BN_num_bytes(xy) == 0) { + ::BN_free(xy); + loggers::get_instance().error("security_ecc::bfk_expend_public_key: Failed to generate xy coordinates, check algorithms"); + return -1; + } + loggers::get_instance().log("security_ecc::bfk_expend_public_key: xy length: %d", BN_num_bytes(xy)); + bn_print("security_ecc::bfk_expend_public_key: xy: ", xy); + ::BN_free(xy); + + return 0; +} + +int security_ecc::bin_to_ec_point(const OCTETSTRING &p_public_key_x, const OCTETSTRING &p_public_key_y, + EC_POINT **p_ec_point) { // ec_key_public_key_bin_to_point + BIGNUM *pubk_bn; + + OCTETSTRING v = int2oct(4, 1); + v += p_public_key_x; + v += p_public_key_y; + + pubk_bn = ::BN_bin2bn(static_cast(v), v.lengthof(), nullptr); + *p_ec_point = ::EC_POINT_new(_ec_group); + ::EC_POINT_bn2point(_ec_group, pubk_bn, *p_ec_point, _bn_ctx); + ::BN_clear_free(pubk_bn); + + return 0; +} + +int security_ecc::public_key_to_bin(OCTETSTRING &p_bin_key) { // ec_key_public_key_to_bin + const EC_POINT *pub = ::EC_KEY_get0_public_key(_ec_key); + BIGNUM *pub_bn = ::BN_new(); + + ::EC_POINT_point2bn(_ec_group, pub, POINT_CONVERSION_UNCOMPRESSED, pub_bn, _bn_ctx); + p_bin_key = int2oct(0, BN_num_bytes(pub_bn)); + ::BN_bn2bin(pub_bn, (unsigned char *)static_cast(p_bin_key)); + + ::BN_free(pub_bn); + + return 0; +} + +void security_ecc::ec_point_print(const std::string& p_label, const EC_POINT *p_key) { + BIGNUM * x = ::BN_new(); + BIGNUM * y = ::BN_new(); + ::EC_POINT_get_affine_coordinates(_ec_group, p_key, x, y, NULL); + char* sx = ::BN_bn2hex(x); + char* sy = ::BN_bn2hex(y); + loggers::get_instance().log("%sx=%s\ny=%s\n", p_label.c_str(), sx, sy); + free(sx); free(sy); + ::BN_free(x); ::BN_free(y); +} + +void security_ecc::bn_print(const std::string& p_label, const BIGNUM* p_num) { + char* s = ::BN_bn2hex(p_num); + loggers::get_instance().log("%s:%s", p_label.c_str(), s); + free(s); +} diff --git a/ccsrc/Protocols/Security/security_ecc.hh b/ccsrc/Protocols/Security/security_ecc.hh index f1e4b91..825984b 100644 --- a/ccsrc/Protocols/Security/security_ecc.hh +++ b/ccsrc/Protocols/Security/security_ecc.hh @@ -264,7 +264,7 @@ public: //! \publicsection int bfk_expend_private_key(const OCTETSTRING& p_expansion_key, const OCTETSTRING& p_private_key, OCTETSTRING& p_expended_private_key); - int bfk_expend_public_key(const OCTETSTRING& p_expansion_key, const OCTETSTRING& p_compressed_public_key, const INTEGER& p_compressed_mode, OCTETSTRING& p_expended_compressed_publi_key, INTEGER& p_expended_compressed_mode); + int bfk_expend_public_key(const OCTETSTRING& p_expansion_key, const OCTETSTRING& p_compressed_public_key, const INTEGER& p_compressed_mode, OCTETSTRING& p_expended_compressed_public_key, INTEGER& p_expended_compressed_mode); boolean bfk_verify_expended_keys(const OCTETSTRING& p_private_key, const OCTETSTRING& p_compressed_public_key, const INTEGER& p_compressed_mode); @@ -295,23 +295,6 @@ private: //! \privatesection * \return 0 on success, -1 otherwise */ const int init(); - /*! - * \fn int bin_to_ec_point(const OCTETSTRING& p_public_key_x, const OCTETSTRING& p_public_key_y, EC_POINT** p_ec_point); - * \brief Convert a big number object into a public key - * \return 0 on success, -1 otherwise - */ - int bin_to_ec_point(const OCTETSTRING &p_public_key_x, const OCTETSTRING &p_public_key_y, EC_POINT **p_ec_point); - /*! - * \fn int public_key_to_bin(OCTETSTRING& p_bin_key); - * \brief Convert a public key into a big number object - * \return 0 on success, -1 otherwise - */ - int public_key_to_bin(OCTETSTRING &p_bin_key); - - void ec_point_print(const std::string& p_label, const EC_POINT *p_key); - - void bn_print(const std::string& p_label, const BIGNUM* p_num); - int kdf2(const OCTETSTRING &p_secret_key, const OCTETSTRING &p_salt, const unsigned char p_hash_algorithm, const int p_key_length, OCTETSTRING &p_digest); int kdf2_sha256(const OCTETSTRING &p_secret_key, const OCTETSTRING &p_salt, const int p_key_length, OCTETSTRING &p_digest); @@ -329,6 +312,22 @@ private: //! \privatesection */ int bkf_expension_function(const encryption_algotithm p_enc_algorithm, const unsigned char* p_random_signing_aes_enc_key, const unsigned char* p_expension_key, const size_t p_key_len, unsigned char** p_bin_result); + /*! + * \fn int bin_to_ec_point(const OCTETSTRING& p_public_key_x, const OCTETSTRING& p_public_key_y, EC_POINT** p_ec_point); + * \brief Convert a big number object into a public key + * \return 0 on success, -1 otherwise + */ + int bin_to_ec_point(const OCTETSTRING &p_public_key_x, const OCTETSTRING &p_public_key_y, EC_POINT **p_ec_point); int compressed_key_to_ec_point(const OCTETSTRING& p_compressed_public_key, const INTEGER& p_compressed_mode, EC_POINT** p_ec_point); + int ec_point_to_compressed_key(const EC_POINT* p_ec_point, OCTETSTRING& p_compressed_public_key, INTEGER& p_compressed_mode); + void ec_point_print(const std::string& p_label, const EC_POINT *p_key); + /*! + * \fn int public_key_to_bin(OCTETSTRING& p_bin_key); + * \brief Convert a public key into a big number object + * \return 0 on success, -1 otherwise + */ + int public_key_to_bin(OCTETSTRING &p_bin_key); + + void bn_print(const std::string& p_label, const BIGNUM* p_num); }; // End of class security_ecc diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 9490350..f6566fc 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 9490350e9ef178c265ebc834faa1b9450a6f40e3 +Subproject commit f6566fcbe3322e533dfa28ccd6e451603f151dae diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 110f8bb..f6bc976 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 110f8bb0b13637a495edead21b83c63d7d0ffcfd +Subproject commit f6bc9761e95a3ded6434cf1a7382fa7d5fbd2d9c -- GitLab From 05c07ab5ae8346edacfb4e23a6b1b15f8c5c8c76 Mon Sep 17 00:00:00 2001 From: garciay Date: Fri, 8 Sep 2023 11:53:24 +0200 Subject: [PATCH 108/178] Validate TC_SECPKI_EA_BFK_AUTH_01_BV --- ccsrc/EncDec/LibItsPki_Encdec.cc | 28 ++ ccsrc/Externals/LibItsSecurity_externals.cc | 40 ++- .../Security/etsi_ts102941_data_codec.cc | 19 ++ ccsrc/Protocols/Security/module.mk | 1 + ccsrc/Protocols/Security/security_ecc.cc | 165 ++++++---- ccsrc/Protocols/Security/security_ecc.hh | 10 +- .../Security/security_services_its.cc | 54 ++- .../Security/security_services_its.hh | 12 +- data/certificates/Makefile | 4 +- etc/AtsPki/AtsPki.cfg | 308 +++++++++++++++++- etc/AtsPki/AtsPki_Microsec.cfg_ | 29 +- etc/AtsPki/AtsPki_Simu.cfg_ | 51 ++- ttcn/AtsPki | 2 +- 13 files changed, 602 insertions(+), 121 deletions(-) mode change 120000 => 100644 etc/AtsPki/AtsPki.cfg diff --git a/ccsrc/EncDec/LibItsPki_Encdec.cc b/ccsrc/EncDec/LibItsPki_Encdec.cc index f65adc4..9a66599 100644 --- a/ccsrc/EncDec/LibItsPki_Encdec.cc +++ b/ccsrc/EncDec/LibItsPki_Encdec.cc @@ -12,6 +12,7 @@ #include "etsi_ts102941_types_enrolment_inner_response.hh" #include "ieee_1609dot2_base_types_public_encryption_key.hh" #include "ieee_1609dot2_base_types_public_verification_key.hh" +#include "etsi_ts102941_types_ra_ee_cert_info.hh" #include "etsi_ts102941_trust_lists_ctl_format.hh" @@ -260,6 +261,33 @@ namespace LibItsPki__EncdecDeclarations { return 0; } + BITSTRING fx__enc__RaEeCertInfo(Ieee1609Dot2Dot1EeRaInterface::RaEeCertInfo const &p_ra_ee_cert_info) { + loggers::get_instance().log_msg(">>> fx__enc__RaEeCertInfo: ", p_ra_ee_cert_info); + + etsi_ts102941_types_ra_ee_cert_info codec; + OCTETSTRING os; + if (codec.encode(p_ra_ee_cert_info, os) == -1) { + loggers::get_instance().warning("fx__enc__RaEeCertInfo: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + INTEGER fx__dec__RaEeCertInfo(BITSTRING &b, Ieee1609Dot2Dot1EeRaInterface::RaEeCertInfo &p_ra_ee_cert_info) { + loggers::get_instance().log_msg(">>> fx__dec__RaEeCertInfo: ", b); + + etsi_ts102941_types_ra_ee_cert_info codec; + OCTETSTRING is = bit2oct(b); + if (codec.decode(is, p_ra_ee_cert_info) == -1) { + loggers::get_instance().warning("fx__dec__RaEeCertInfo: -1 result code was returned"); + return -1; + } + + loggers::get_instance().log_msg("<<< fx__dec__RaEeCertInfo: ", p_ra_ee_cert_info); + return 0; + } + BITSTRING fx__enc__PublicKeys(EtsiTs102941BaseTypes::PublicKeys const &p_public_keys) { loggers::get_instance().log_msg(">>> fx__enc__PublicKeys: ", p_public_keys); diff --git a/ccsrc/Externals/LibItsSecurity_externals.cc b/ccsrc/Externals/LibItsSecurity_externals.cc index 8098152..a73ba63 100644 --- a/ccsrc/Externals/LibItsSecurity_externals.cc +++ b/ccsrc/Externals/LibItsSecurity_externals.cc @@ -2228,25 +2228,45 @@ namespace LibItsSecurity__Functions { FLOAT fx__int2ddlon(const INTEGER &p__longitude) { return (float)((float)p__longitude / 1000000.0); } - BOOLEAN fx__generate__bkf__signing__expension__keys(const INTEGER& p__i, const INTEGER& p__j, const BOOLEAN& p_debug, OCTETSTRING& p__expension__key) { - loggers::get_instance().log_msg(">>> fx__generate__bkf__signing__expension__keys: p__i: ", p__i); - loggers::get_instance().log_msg(">>> fx__generate__bkf__signing__expension__keys: p__j: ", p__j); + BOOLEAN fx__generate__bkf__signing__key__expension(const INTEGER& p__i, const INTEGER& p__j, const BOOLEAN& p_debug, OCTETSTRING& p__kS) { + loggers::get_instance().log_msg(">>> fx__generate__bkf__signing__key__expension: p__i: ", p__i); + loggers::get_instance().log_msg(">>> fx__generate__bkf__signing__key__expension: p__j: ", p__j); - if (security_services_its::get_instance().generate_bkf_signing_expension_keys(p__i, p__j, p_debug, p__expension__key) == -1) { + if (security_services_its::get_instance().generate_bkf_signing_key_expension(p__i, p__j, p_debug, p__kS) == -1) { return FALSE; } - loggers::get_instance().log_msg("<<< fx__generate__bkf__signing__expension__keys: p__expension__key: ", p__expension__key); + loggers::get_instance().log_msg("<<< fx__generate__bkf__signing__key__expension: p__kS: ", p__kS); return TRUE; } - BOOLEAN fx__generate__bkf__enc__expension__keys(const INTEGER& p__i, const INTEGER& p__j, const BOOLEAN& p_debug, OCTETSTRING& p__expension__key) { - loggers::get_instance().log_msg(">>> fx__generate__bkf__enc__expension__keys: p__i: ", p__i); - loggers::get_instance().log_msg(">>> fx__generate__bkf__enc__expension__keys: p__j: ", p__j); + BOOLEAN fx__create__bkf__signing__expension__keys(const OCTETSTRING& p__kS, const BOOLEAN& p_debug, OCTETSTRING& p__expension__key) { + loggers::get_instance().log_msg(">>> fx__create__bkf__signing__expension__keys: p__i: ", p__kS); - if (security_services_its::get_instance().generate_bkf_enc_expension_keys(p__i, p__j, p_debug, p__expension__key) == -1) { + if (security_services_its::get_instance().create_bkf_signing_expension_keys(p__kS, p_debug, p__expension__key) == -1) { return FALSE; } - loggers::get_instance().log_msg("<<< fx__generate__bkf__enc__expension__keys: p__expension__key: ", p__expension__key); + loggers::get_instance().log_msg("<<< fx__create__bkf__signing__expension__keys: p__expension__key: ", p__expension__key); + return TRUE; + } + + BOOLEAN fx__generate__bkf__enc__key__expension(const INTEGER& p__i, const INTEGER& p__j, const BOOLEAN& p_debug, OCTETSTRING& p__kE) { + loggers::get_instance().log_msg(">>> fx__generate__bkf__enc__key__expension: p__i: ", p__i); + loggers::get_instance().log_msg(">>> fx__generate__bkf__enc__key__expension: p__j: ", p__j); + + if (security_services_its::get_instance().generate_bkf_enc_key_expension(p__i, p__j, p_debug, p__kE) == -1) { + return FALSE; + } + loggers::get_instance().log_msg("<<< fx__generate__bkf__enc__key__expension: p__kE: ", p__kE); + return TRUE; + } + + BOOLEAN fx__create__bkf__enc__expension__keys(const OCTETSTRING& p__kE, const BOOLEAN& p_debug, OCTETSTRING& p__expension__key) { + loggers::get_instance().log_msg(">>> fx__create__bkf__enc__expension__keys: p__i: ", p__kE); + + if (security_services_its::get_instance().create_bkf_enc_expension_keys(p__kE, p_debug, p__expension__key) == -1) { + return FALSE; + } + loggers::get_instance().log_msg("<<< fx__create__bkf__enc__expension__keys: p__expension__key: ", p__expension__key); return TRUE; } diff --git a/ccsrc/Protocols/Security/etsi_ts102941_data_codec.cc b/ccsrc/Protocols/Security/etsi_ts102941_data_codec.cc index e111fce..e2bf550 100644 --- a/ccsrc/Protocols/Security/etsi_ts102941_data_codec.cc +++ b/ccsrc/Protocols/Security/etsi_ts102941_data_codec.cc @@ -22,6 +22,25 @@ int etsi_ts102941_data_codec::decode(const OCTETSTRING &p_data, EtsiTs102941Mess // _params = params; p_etsi_ts_102941_data.decode(*p_etsi_ts_102941_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 + */ + if (p_etsi_ts_102941_data.content().ischosen(EtsiTs102941MessagesCa::EtsiTs102941DataContent::ALT_enrolmentResponse)) { + if (p_etsi_ts_102941_data.content().enrolmentResponse().certificate().ispresent()) { + Ieee1609Dot2::CertificateBase* cert = static_cast(p_etsi_ts_102941_data.content().enrolmentResponse().certificate().get_opt_value()); + cert->toBeSigned().appExtensions().set_to_omit(); + cert->toBeSigned().certIssueExtensions().set_to_omit(); + cert->toBeSigned().certRequestExtension().set_to_omit(); + } + } else if (p_etsi_ts_102941_data.content().ischosen(EtsiTs102941MessagesCa::EtsiTs102941DataContent::ALT_butterflyAuthorizationRequest)) { + p_etsi_ts_102941_data.content().butterflyAuthorizationRequest().tbsCert().appExtensions().set_to_omit(); + p_etsi_ts_102941_data.content().butterflyAuthorizationRequest().tbsCert().certIssueExtensions().set_to_omit(); + p_etsi_ts_102941_data.content().butterflyAuthorizationRequest().tbsCert().certRequestExtension().set_to_omit(); + } + /** + * + */ + loggers::get_instance().log_msg("<<< etsi_ts102941_data_codec::decode: ", (const Base_Type &)p_etsi_ts_102941_data); return 0; } diff --git a/ccsrc/Protocols/Security/module.mk b/ccsrc/Protocols/Security/module.mk index 35c24c1..73fa5c9 100644 --- a/ccsrc/Protocols/Security/module.mk +++ b/ccsrc/Protocols/Security/module.mk @@ -22,6 +22,7 @@ sources += http_etsi_ieee1609dot2_codec.cc \ etsi_ts102941_types_authorization_shared_at_request.cc \ etsi_ts102941_types_authorization_validation_request.cc \ etsi_ts102941_types_authorization_validation_response.cc \ + etsi_ts102941_types_ra_ee_cert_info.cc \ etsi_ts102941_types_enrolment_inner_request.cc \ etsi_ts102941_types_enrolment_inner_response.cc \ diff --git a/ccsrc/Protocols/Security/security_ecc.cc b/ccsrc/Protocols/Security/security_ecc.cc index 0b871f4..4ff8cfe 100644 --- a/ccsrc/Protocols/Security/security_ecc.cc +++ b/ccsrc/Protocols/Security/security_ecc.cc @@ -1208,119 +1208,162 @@ int security_ecc::compute_digest_sm3(const OCTETSTRING &p_data, const OCTETSTRIN return 0; } -int security_ecc::generate_bkf_signing_expension_keys(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key) { - loggers::get_instance().log_msg(">>> security_ecc::generate_bkf_signing_expension_keys: ", p_i); - loggers::get_instance().log_msg(">>> security_ecc::generate_bkf_signing_expension_keys: ", p_j); +int security_ecc::generate_bkf_signing_key_expension(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_kS) { + loggers::get_instance().log(">>> security_ecc::generate_bkf_signing_key_expension: p_enc_algorithm=%d", p_enc_algorithm); + loggers::get_instance().log_msg(">>> security_ecc::generate_bkf_signing_key_expension: p_i=", p_i); + loggers::get_instance().log_msg(">>> security_ecc::generate_bkf_signing_key_expension: p_j=", p_j); - size_t aes_len; + size_t aes_key_len; if (p_enc_algorithm == encryption_algotithm::aes_128_ecb) { - aes_len = 16; + aes_key_len = 16; } else { - loggers::get_instance().warning("security_ecc::generate_bkf_signing_expension_keys: Wrong algorithm: %d", p_enc_algorithm); + loggers::get_instance().warning("security_ecc::generate_bkf_signing_key_expension: Wrong algorithm: %d", p_enc_algorithm); return -1; } + loggers::get_instance().log("security_ecc::generate_bkf_signing_key_expension: aes_key_len=%ld", aes_key_len); + + // Calculate p_kS = 0^32 || i || j || 0^32 + BIGNUM* x_cert = BN_new(); + ::BN_zero_ex(x_cert); + ::BN_add_word(x_cert, p_i.get_long_long_val()); // p_kS = (i * 4294967296 + j) * 4294967296; + ::BN_mul_word(x_cert, 4294967296); + ::BN_add_word(x_cert, p_j.get_long_long_val()); + ::BN_mul_word(x_cert, 4294967296); + unsigned char kS[aes_key_len]; + ::BN_bn2binpad(x_cert, kS, aes_key_len); + loggers::get_instance().log_to_hexa("security_ecc::generate_bkf_signing_key_expension: kS: ", kS, aes_key_len); + p_kS = OCTETSTRING(aes_key_len, kS); + + ::BN_free(x_cert); + + loggers::get_instance().log_msg("<<< security_ecc::generate_bkf_signing_key_expension: p_kS: ", p_kS); + return 0; +} + +int security_ecc::create_bkf_signing_expension_keys(const encryption_algotithm p_enc_algorithm, const OCTETSTRING& p_kS, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key) { + loggers::get_instance().log(">>> security_ecc::create_bkf_signing_expension_keys: p_enc_algorithm=%d", p_enc_algorithm); + loggers::get_instance().log_msg(">>> security_ecc::create_bkf_signing_expension_keys: p_kS=", p_kS); + + size_t aes_key_len; + if (p_enc_algorithm == encryption_algotithm::aes_128_ecb) { + aes_key_len = 16; + } else { + loggers::get_instance().warning("security_ecc::create_bkf_signing_expension_keys: Wrong algorithm: %d", p_enc_algorithm); + return -1; + } + loggers::get_instance().log("security_ecc::create_bkf_signing_expension_keys: aes_key_len=%ld", aes_key_len); - // Calculate kS = 0^32 || i || j || 0^32 - BIGNUM* x_cert = BN_new(); // kS = (i * 4294967296 + j) * 4294967296; - BN_zero(x_cert); - int res = ::BN_add_word(x_cert, p_i); - res = ::BN_mul_word(x_cert, 4294967296); - res = ::BN_add_word(x_cert, p_j); - res = ::BN_mul_word(x_cert, 4294967296); - unsigned char kS[aes_len]; - ::BN_bn2binpad(x_cert, kS, aes_len); - loggers::get_instance().log_to_hexa("security_ecc::generate_bkf_signing_expension_keys: kS: ", kS, aes_len); - - unsigned char* random_signing_aes_enc_key = (unsigned char*)OPENSSL_malloc(aes_len); + unsigned char* random_signing_aes_enc_key = (unsigned char*)OPENSSL_malloc(aes_key_len); if (p_debug == true) { - const unsigned char random_signing_aes_enc_key_test[aes_len] = { 0x12, 0x1D, 0x14, 0x21, 0x67, 0x15, 0xE1, 0x1D, 0x2D, 0x37, 0x87, 0x43, 0x4A, 0x67, 0x3B, 0x1B }; // FIXME Random - memcpy((void*)random_signing_aes_enc_key, (const void*)random_signing_aes_enc_key_test, aes_len); + const unsigned char random_signing_aes_enc_key_test[aes_key_len] = { 0x12, 0x1D, 0x14, 0x21, 0x67, 0x15, 0xE1, 0x1D, 0x2D, 0x37, 0x87, 0x43, 0x4A, 0x67, 0x3B, 0x1B }; // FIXME Random + memcpy((void*)random_signing_aes_enc_key, (const void*)random_signing_aes_enc_key_test, aes_key_len); } else { if (::RAND_bytes(random_signing_aes_enc_key, sizeof(random_signing_aes_enc_key)) == -1) { OPENSSL_free(random_signing_aes_enc_key); - loggers::get_instance().error("security_ecc::generate_bkf_signing_expension_keys: RAND_bytes failure"); + loggers::get_instance().error("security_ecc::create_bkf_signing_expension_keys: RAND_bytes failure"); return -1; } } - loggers::get_instance().log_to_hexa("security_ecc::generate_bkf_signing_expension_keys: random_signing_aes_enc_key: ", random_signing_aes_enc_key, aes_len); + loggers::get_instance().log_to_hexa("security_ecc::create_bkf_signing_expension_keys: random_signing_aes_enc_key: ", random_signing_aes_enc_key, aes_key_len); unsigned char* bin_signing_expension_key; - res = bkf_expension_function( - p_enc_algorithm, - random_signing_aes_enc_key, - kS, // P1609.2.1/D7, January 2022 Clause 9.3.3 Caterpillar key pair generation - kS - aes_len, - &bin_signing_expension_key - ); + int res = bkf_expension_function( + p_enc_algorithm, + random_signing_aes_enc_key, + static_cast(p_kS), // P1609.2.1/D7, January 2022 Clause 9.3.3 Caterpillar key pair generation - p_kS + aes_key_len, + &bin_signing_expension_key + ); if (res == -1) { OPENSSL_free(random_signing_aes_enc_key); - loggers::get_instance().error("security_ecc::generate_bkf_signing_expension_keys: bkf_expension_function failure"); + loggers::get_instance().error("security_ecc::create_bkf_signing_expension_keys: bkf_expension_function failure"); return -1; } p_expension_key = OCTETSTRING(res, bin_signing_expension_key); OPENSSL_free(random_signing_aes_enc_key); OPENSSL_free(bin_signing_expension_key); - loggers::get_instance().log_msg("<<< security_ecc::generate_bkf_signing_expension_keys: p_expension_key: ", p_expension_key); + loggers::get_instance().log_msg("<<< security_ecc::create_bkf_signing_expension_keys: p_expension_key: ", p_expension_key); return 0; } -int security_ecc::generate_bkf_enc_expension_keys(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key) { - loggers::get_instance().log_msg(">>> security_ecc::generate_bkf_enc_expension_keys: ", p_i); - loggers::get_instance().log_msg(">>> security_ecc::generate_bkf_enc_expension_keys: ", p_j); +int security_ecc::generate_bkf_enc_key_expension(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_kE) { + loggers::get_instance().log_msg(">>> security_ecc::generate_bkf_enc_key_expension: ", p_i); + loggers::get_instance().log_msg(">>> security_ecc::generate_bkf_enc_key_expension: ", p_j); - size_t aes_len; + size_t aes_key_len; if (p_enc_algorithm == encryption_algotithm::aes_128_ecb) { - aes_len = 16; + aes_key_len = 16; } else { - loggers::get_instance().warning("security_ecc::generate_bkf_enc_expension_keys: Wrong algorithm: %d", p_enc_algorithm); + loggers::get_instance().warning("security_ecc::generate_bkf_enc_key_expension: Wrong algorithm: %d", p_enc_algorithm); return -1; } + loggers::get_instance().log("security_ecc::generate_bkf_enc_key_expension: aes_key_len=%d", aes_key_len); - // Calculate kE = (1^32 || i || j || 0^32) - BIGNUM* x_enc = BN_new(); // kE = (((4294967296 - 1) * 4294967296 + i) * 4294967296 + j) * 4294967296; + // Calculate p_kE = (1^32 || i || j || 0^32) + BIGNUM* x_enc = BN_new(); // p_kE = (((4294967296 - 1) * 4294967296 + i) * 4294967296 + j) * 4294967296; BN_zero(x_enc); - int res = ::BN_add_word(x_enc, 4294967296 - 1); - res = ::BN_mul_word(x_enc, 4294967296); - res = ::BN_add_word(x_enc, p_i); - res = ::BN_mul_word(x_enc, 4294967296); - res = ::BN_add_word(x_enc, p_j); - res = ::BN_mul_word(x_enc, 4294967296); + ::BN_add_word(x_enc, 4294967296 - 1); + ::BN_mul_word(x_enc, 4294967296); + ::BN_add_word(x_enc, p_i.get_long_long_val()); + ::BN_mul_word(x_enc, 4294967296); + ::BN_add_word(x_enc, p_j.get_long_long_val()); + ::BN_mul_word(x_enc, 4294967296); unsigned char kE[16]; - ::BN_bn2binpad(x_enc, kE, 16); - loggers::get_instance().log_to_hexa("security_ecc::generate_bkf_enc_expension_keys: kE: ", kE, 16); + ::BN_bn2binpad(x_enc, kE, aes_key_len); + loggers::get_instance().log_to_hexa("security_ecc::generate_bkf_enc_key_expension: kE: ", kE, aes_key_len); + p_kE = OCTETSTRING(aes_key_len, kE); + + ::BN_free(x_enc); + + loggers::get_instance().log_msg("<<< security_ecc::generate_bkf_enc_key_expension: p_kE: ", p_kE); + return 0; +} + +int security_ecc::create_bkf_enc_expension_keys(const encryption_algotithm p_enc_algorithm, const OCTETSTRING& p_kE, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key) { + loggers::get_instance().log(">>> security_ecc::create_bkf_enc_expension_keys: p_enc_algorithm=%d", p_enc_algorithm); + loggers::get_instance().log_msg(">>> security_ecc::create_bkf_enc_expension_keys: p_kE=", p_kE); + + size_t aes_key_len; + if (p_enc_algorithm == encryption_algotithm::aes_128_ecb) { + aes_key_len = 16; + } else { + loggers::get_instance().warning("security_ecc::create_bkf_enc_expension_keys: Wrong algorithm: %d", p_enc_algorithm); + return -1; + } + loggers::get_instance().log("security_ecc::create_bkf_enc_expension_keys: aes_key_len=%d", aes_key_len); - unsigned char* random_encryption_aes_enc_key = (unsigned char*)OPENSSL_malloc(aes_len); + unsigned char* random_encryption_aes_enc_key = (unsigned char*)OPENSSL_malloc(aes_key_len); if (p_debug == true) { - const unsigned char random_encryption_aes_enc_key_test[aes_len] = { 0x6B, 0x71, 0xA7, 0xEB, 0x57, 0x55, 0xF1, 0x6E, 0x89, 0x98, 0x1D, 0x21, 0x89, 0xA6, 0xDA, 0xEA }; // FIXME Random - memcpy((void*)random_encryption_aes_enc_key, (const void*)random_encryption_aes_enc_key_test, aes_len); + const unsigned char random_encryption_aes_enc_key_test[aes_key_len] = { 0x6B, 0x71, 0xA7, 0xEB, 0x57, 0x55, 0xF1, 0x6E, 0x89, 0x98, 0x1D, 0x21, 0x89, 0xA6, 0xDA, 0xEA }; // FIXME Random + memcpy((void*)random_encryption_aes_enc_key, (const void*)random_encryption_aes_enc_key_test, aes_key_len); } else { if (::RAND_bytes(random_encryption_aes_enc_key, sizeof(random_encryption_aes_enc_key)) == -1) { OPENSSL_free(random_encryption_aes_enc_key); - loggers::get_instance().error("security_ecc::generate_bkf_enc_expension_keys: RAND_bytes failure"); + loggers::get_instance().error("security_ecc::create_bkf_enc_expension_keys: RAND_bytes failure"); return -1; } } - loggers::get_instance().log_to_hexa("security_ecc::generate_bkf_enc_expension_keys: random_encryption_aes_enc_key: ", random_encryption_aes_enc_key, aes_len); + loggers::get_instance().log_to_hexa("security_ecc::create_bkf_enc_expension_keys: random_encryption_aes_enc_key: ", random_encryption_aes_enc_key, aes_key_len); unsigned char* bin_enc_expension_key; - res = bkf_expension_function( - p_enc_algorithm, - random_encryption_aes_enc_key, - kE, // P1609.2.1/D7, January 2022 Clause 9.3.3 Caterpillar key pair generation - kS - aes_len, - &bin_enc_expension_key - ); + int res = bkf_expension_function( + p_enc_algorithm, + random_encryption_aes_enc_key, + static_cast(p_kE), // P1609.2.1/D7, January 2022 Clause 9.3.3 Caterpillar key pair generation - p_kE + aes_key_len, + &bin_enc_expension_key + ); if (res == -1) { OPENSSL_free(random_encryption_aes_enc_key); - loggers::get_instance().error("security_ecc::generate_bkf_enc_expension_keys: bkf_expension_function failure"); + loggers::get_instance().error("security_ecc::create_bkf_enc_expension_keys: bkf_expension_function failure"); return -1; } p_expension_key = OCTETSTRING(res, bin_enc_expension_key); OPENSSL_free(random_encryption_aes_enc_key); OPENSSL_free(bin_enc_expension_key); - loggers::get_instance().log_msg("<<< security_ecc::generate_bkf_enc_expension_keys: p_expension_key: ", p_expension_key); + loggers::get_instance().log_msg("<<< security_ecc::create_bkf_enc_expension_keys: p_expension_key: ", p_expension_key); return 0; } diff --git a/ccsrc/Protocols/Security/security_ecc.hh b/ccsrc/Protocols/Security/security_ecc.hh index 825984b..c3c0887 100644 --- a/ccsrc/Protocols/Security/security_ecc.hh +++ b/ccsrc/Protocols/Security/security_ecc.hh @@ -251,16 +251,18 @@ public: //! \publicsection int reconstruct_public_keys(const OCTETSTRING &p_cert_to_be_signed, const OCTETSTRING &p_issuer_public_key_x, const OCTETSTRING &p_issuer_public_key_y, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y, OCTETSTRING &p_public_key_compressed, INTEGER &p_public_key_compressed_mode); /*! - * \fn integer generate_bkf_signing_expension_keys(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); + * \fn integer generate_bkf_signing_key_expension(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_kS); * \brief Produce a BKF expension key for signing as defined in P1609.2.1/D7 Clause 9.3.3.1 Butterfly expansion functions */ - int generate_bkf_signing_expension_keys(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); + int generate_bkf_signing_key_expension(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_kS); + int create_bkf_signing_expension_keys(const encryption_algotithm p_enc_algorithm, const OCTETSTRING& p_kS, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); /*! - * \fn integer generate_bkf_enc_expension_keys(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); + * \fn integer generate_bkf_enc_key_expension(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_kE); * \brief Produce a BKF expension key for encryption as defined in P1609.2.1/D7 Clause 9.3.3.1 Butterfly expansion functions */ - int generate_bkf_enc_expension_keys(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); + int generate_bkf_enc_key_expension(const encryption_algotithm p_enc_algorithm, const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_kE); + int create_bkf_enc_expension_keys(const encryption_algotithm p_enc_algorithm, const OCTETSTRING& p_kS, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); int bfk_expend_private_key(const OCTETSTRING& p_expansion_key, const OCTETSTRING& p_private_key, OCTETSTRING& p_expended_private_key); diff --git a/ccsrc/Protocols/Security/security_services_its.cc b/ccsrc/Protocols/Security/security_services_its.cc index d9f1021..c220a38 100644 --- a/ccsrc/Protocols/Security/security_services_its.cc +++ b/ccsrc/Protocols/Security/security_services_its.cc @@ -943,32 +943,60 @@ int security_services_its::sign_tbs_data(const Ieee1609Dot2::ToBeSignedData &p_t return 0; } -int security_services_its::generate_bkf_signing_expension_keys(const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key) { - loggers::get_instance().log_msg(">>> security_services_its::generate_bkf_signing_expension_keys: ", p_i); - loggers::get_instance().log_msg(">>> security_services_its::generate_bkf_signing_expension_keys: ", p_j); +int security_services_its::generate_bkf_signing_key_expension(const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_kS) { + loggers::get_instance().log_msg(">>> security_services_its::generate_bkf_signing_key_expension: ", p_i); + loggers::get_instance().log_msg(">>> security_services_its::generate_bkf_signing_key_expension: ", p_j); // Sanity checks if (_bkf_expension_keys.get() == nullptr) { - loggers::get_instance().warning("security_services_its::generate_bkf_signing_expension_keys: Encryption not initialised"); + loggers::get_instance().warning("security_services_its::generate_bkf_signing_key_expension: Encryption not initialised"); return -1; } - int ret_code = _bkf_expension_keys.get()->generate_bkf_signing_expension_keys(encryption_algotithm::aes_128_ecb, p_i, p_j, p_debug, p_expension_key); - loggers::get_instance().log_msg("security_services_its::generate_bkf_signing_expension_keys: p_expension_key=", p_expension_key); + int ret_code = _bkf_expension_keys.get()->generate_bkf_signing_key_expension(encryption_algotithm::aes_128_ecb, p_i, p_j, p_debug, p_kS); + loggers::get_instance().log_msg("security_services_its::generate_bkf_signing_key_expension: p_kS=", p_kS); return ret_code; } -int security_services_its::generate_bkf_enc_expension_keys(const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key) { - loggers::get_instance().log_msg(">>> security_services_its::generate_bkf_enc_expension_keys: ", p_i); - loggers::get_instance().log_msg(">>> security_services_its::generate_bkf_enc_expension_keys: ", p_j); +int security_services_its::create_bkf_signing_expension_keys(const OCTETSTRING& p_kS, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key) { + loggers::get_instance().log_msg(">>> security_services_its::create_bkf_signing_expension_keys: ", p_kS); // Sanity checks if (_bkf_expension_keys.get() == nullptr) { - loggers::get_instance().warning("security_services_its::generate_bkf_enc_expension_keys: Encryption not initialised"); + loggers::get_instance().warning("security_services_its::create_bkf_signing_expension_keys: Encryption not initialised"); return -1; } - int ret_code = _bkf_expension_keys.get()->generate_bkf_enc_expension_keys(encryption_algotithm::aes_128_ecb, p_i, p_j, p_debug, p_expension_key); - loggers::get_instance().log_msg("security_services_its::generate_bkf_enc_expension_keys: p_expension_key=", p_expension_key); + int ret_code = _bkf_expension_keys.get()->create_bkf_signing_expension_keys(encryption_algotithm::aes_128_ecb, p_kS, p_debug, p_expension_key); + loggers::get_instance().log_msg("security_services_its::create_bkf_signing_expension_keys: p_expension_key=", p_expension_key); + + return ret_code; +} + +int security_services_its::generate_bkf_enc_key_expension(const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_kE) { + loggers::get_instance().log_msg(">>> security_services_its::generate_bkf_enc_key_expension: ", p_i); + loggers::get_instance().log_msg(">>> security_services_its::generate_bkf_enc_key_expension: ", p_j); + + // Sanity checks + if (_bkf_expension_keys.get() == nullptr) { + loggers::get_instance().warning("security_services_its::generate_bkf_enc_key_expension: Encryption not initialised"); + return -1; + } + int ret_code = _bkf_expension_keys.get()->generate_bkf_enc_key_expension(encryption_algotithm::aes_128_ecb, p_i, p_j, p_debug, p_kE); + loggers::get_instance().log_msg("security_services_its::generate_bkf_enc_key_expension: p_kE=", p_kE); + + return ret_code; +} + +int security_services_its::create_bkf_enc_expension_keys(const OCTETSTRING& p_kE, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key) { + loggers::get_instance().log_msg(">>> security_services_its::create_bkf_enc_expension_keys: ", p_kE); + + // Sanity checks + if (_bkf_expension_keys.get() == nullptr) { + loggers::get_instance().warning("security_services_its::create_bkf_enc_expension_keys: Encryption not initialised"); + return -1; + } + int ret_code = _bkf_expension_keys.get()->create_bkf_enc_expension_keys(encryption_algotithm::aes_128_ecb, p_kE, p_debug, p_expension_key); + loggers::get_instance().log_msg("security_services_its::create_bkf_enc_expension_keys: p_expension_key=", p_expension_key); return ret_code; } @@ -1016,7 +1044,7 @@ boolean security_services_its::bfk_verify_expended_keys(const OCTETSTRING& p__ex return -1; } boolean ret_code = _bkf_expension_keys.get()->bfk_verify_expended_keys(p__expended__private__key, p__expended__compressed__public__key, p__expended__compressed__mode); - loggers::get_instance().log("security_services_its::bfk_verify_expended_keys::bfk_expend_private_key: ret_code=%d", ret_code); + loggers::get_instance().log("security_services_its::bfk_verify_expended_keys::bfk_expend_private_key: Key expension verificattion: %s", (ret_code == 0) ? "succeeded" : "failed"); return ret_code; } diff --git a/ccsrc/Protocols/Security/security_services_its.hh b/ccsrc/Protocols/Security/security_services_its.hh index 4c1e371..01b17ed 100644 --- a/ccsrc/Protocols/Security/security_services_its.hh +++ b/ccsrc/Protocols/Security/security_services_its.hh @@ -168,15 +168,13 @@ public: /*! \publicsection */ * \param[in] p_i iINT value in the range 0 < iINT * \param[in] p_j jINT value in the range jINT < 232– 1. * \param[in] p_debug Set to true if test vectors should be used. For debugging purposes only - * \param[out] p_bin_result The 256 bit integer + * \param[out] p_kS The 256 bit integer */ - int generate_bkf_signing_expension_keys(const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); + int generate_bkf_signing_key_expension(const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_kS); + int create_bkf_signing_expension_keys(const OCTETSTRING& p_kS, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); - /*! - * \fn integer generate_bkf_enc_expension_keys(const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); - * \brief Produce a BKF expension key for either signing or encryption as defined in P1609.2.1/D7 Clause 9.3.3.1 Butterfly expansion functions - */ - int generate_bkf_enc_expension_keys(const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); + int generate_bkf_enc_key_expension(const INTEGER& p_i, const INTEGER& p_j, const BOOLEAN& p_debug, OCTETSTRING& p_kE); + int create_bkf_enc_expension_keys(const OCTETSTRING& p_kE, const BOOLEAN& p_debug, OCTETSTRING& p_expension_key); int bfk_expend_private_key(const OCTETSTRING& p__expansion__key, const OCTETSTRING& p__private__key, OCTETSTRING& p__expended__private__key); diff --git a/data/certificates/Makefile b/data/certificates/Makefile index 74d1aa3..ce0f16f 100644 --- a/data/certificates/Makefile +++ b/data/certificates/Makefile @@ -64,7 +64,9 @@ ekeys_iut_ma = $(patsubst %.oer, %.ekey, $(certs_iut_ma)) certs_iut := $(filter $(outdir)/CERT_IUT_%_RCA.oer, $(certificates_oer)) certs_iut += $(filter $(outdir)/CERT_IUT_%_AA.oer, $(certificates_oer)) -certs_iut += $(certs_iut_at) $(certs_iut_at_imp) $(certs_iut_ma) +certs_iut += $(filter $(outdir)/CERT_TS_%_EA.oer, $(certificates_oer)) +certs_iut += $(filter $(outdir)/CERT_TS_%_AA.oer, $(certificates_oer)) +certs_iut += $(certs_iut_at) $(certs_iut_at_imp) $(certs_iut_ea) $(certs_iut_ma) iut_files = $(patsubst $(outdir)/%, $(iutdir)/%, $(certs_iut) $(vkeys_iut_at) $(ekeys_iut_at) $(vkeys_iut_ma) $(ekeys_iut_ma) $(vkeys_iut_at_imp) $(ekeys_iut_at_imp)) diff --git a/etc/AtsPki/AtsPki.cfg b/etc/AtsPki/AtsPki.cfg deleted file mode 120000 index be66d6f..0000000 --- a/etc/AtsPki/AtsPki.cfg +++ /dev/null @@ -1 +0,0 @@ -AtsPki_Microsec.cfg_ \ No newline at end of file diff --git a/etc/AtsPki/AtsPki.cfg b/etc/AtsPki/AtsPki.cfg new file mode 100644 index 0000000..997064d --- /dev/null +++ b/etc/AtsPki/AtsPki.cfg @@ -0,0 +1,307 @@ + +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# 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 := "../data/certificates" +# Configuration sub-directory to access certificate stored in files +LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" + +LibItsSecurity_Pixits.PX_BFK_TEST_VECTORS := false + +LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" + +LibItsPki_Pics.PICS_MULTIPLE_END_POINT := false +LibHttp_Pics.PICS_HEADER_HOST := "v2x-pki-test.microsec.com" +LibItsPki_Pics.PICS_HEADER_HOST_CA := "v2x-pki-test.microsec.com" +LibItsPki_Pics.PICS_HEADER_HOST_TLM := "v2x-pki-test.microsec.com" + +LibItsPki_Pics.PICS_HTTP_POST_URI_EC := "/v2x_ea_nistp256/ecRequest" +LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/v2x_aa_nistp256/atRequest" +LibItsPki_Pics.PICS_HTTP_POST_URI_ATV := "/v2x_ea_nistp256/authValRequest" +LibItsPki_Pics.PICS_HTTP_GET_URI_CTL := "/v2x_rootca_nistp256/getctl/B65E3B8FBBEC3910" +LibItsPki_Pics.PICS_HTTP_GET_URI_CRL := "/v2x_rootca_nistp256/getcrl/B65E3B8FBBEC3910" +LibItsPki_Pics.PICS_HTTP_GET_URI_TLM := "/v2x_rootca_brainpoolp256r1" +LibItsPki_Pics.PICS_HTTP_POST_URI_BFK_AUTH := "/v2x_ea_nistp256/butterflyAuthorization" +LibItsPki_Pics.PICS_HTTP_POST_URI_BFK_AT_DOWNLOAD := "/v2x_ea_nistp256/butterflyDownload" + +#LibItsPki_Pics.PICS_SIMULATE_EA_ENTITY := true # CERT_TS_A_EA shall be trusted by the PKI +LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := "0_MicrosecTest-EA-2021_L0" # Use CERT_TS_A_EA when the TS simulate the EA (TC_SECPKI_AA_AUTHVAL_01_BV) with PICS_SIMULATE_EA_ENTITY set +LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" # CERT_TS_A_AA & CERT_IUT_A_RCA shall be trusted by the PKI +LibItsPki_Pics.PICS_IUT_AA_CERTIFICATE_ID := "0_MicrosecTest-AA-2021_L0" +LibItsPki_Pics.PICS_TS_CA_CERTIFICATE_ID := "MicrosecNistP256RootCA" + +LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3031'O # Nist-P256 +#LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3032'O # Brainpool-P256 r1 +#LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3033'O # Brainpool-P384 r1 + +# Technical keys +# NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) +# Private key +#FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34 +# Public key +#048038F5490CD5A58FF5465D3B577EE830047336AC5DAC07036B798AAECAE7273FD91C4F60995494EA949E64EE0E3D768DBDEB8AFC345627211E3FC4DD8FD39EE5 +LibItsPki_Pics.PICS_ITS_S_SIGN_NITSP256_PRIVATE_KEY := 'FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34'O; +LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3b577ee830047336ac5dac07036b798aaecae7273f'O; + +# Set to true if the IUT support CertificateId shall be set to the choice name, false if it shall be omitted +#LibItsPki_Pics.PICS_EC_SUBJECT_ATTRIBUT_ID := false # requestedSubjectAttributes.id is omitted +# Set to true if the IUT support geographical region +#LibItsPki_Pics.PICS_EC_SUBJECT_ATTRIBUT_REGION := false # requestedSubjectAttributes.region is omitted + +#LibItsPki_Pics.PICS_PKI_AUTH_POP := false # Do not use Signed for PoP in Authorization requet + # Required for SECPKI_AA_AUTH_RCV_02_BV +#LibItsPki_Pics.PICS_SECPKI_REENROLMENT := false # Check in logs the pattern '==> EC ' to find the required information for re-enrolment + +#LibItsPki_Pixits.PX_INCLUDE_ENCRYPTION_KEYS := false # No encryption key in Authorization request + +#LibItsPki_Pixits.PX_VE_ALG := e_brainpool_p256_r1 # e_nist_p256, e_nist_p384, e_sm2_p256 or e_brainpool_p384_r1 + +#LibItsPki_Pixits.PX_EC_ALG_FOR_EC := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_AT := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 +#LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 + +# Certificate areas tests +LibItsSecurity_Pics.PICS_SEC_CIRCULAR_REGION := false +LibItsSecurity_Pics.PICS_SEC_RECTANGULAR_REGION := true + +# BFK +LibItsSecurity_Pics.PICS_SEC_BFK_AUTH := true +LibItsSecurity_Pics.PICS_SECPKI_ORIGINAL_BFK_KEY := true +LibItsSecurity_Pics.PICS_SECPKI_UNIFIED_BFK_KEY := false +LibItsSecurity_Pics.PICS_SECPKI_COMPACT_UNIFIED_BFK_KEY := false + +[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). + +LogFile := "../logs/AtsPki/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# Single HTTP component port +system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=v2x-pki-test.microsec.com)" + +#system.httpAtVPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=yanngarcia.ddns.net)" # HTTP component ports specific to TC_SECPKI_AA_AUTHVAL_xx + +system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=v2x-pki-test.microsec.com)" +#system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.43)"system.httpTlmPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=v2x-pki-test.microsec.com)" + +[EXECUTE] +# Config: +# LibItsPki_Pics.PICS_SIMULATE_EA_ENTITY := false # CERT_TS_A_EA shall be trusted by the PKI +# LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := PKI EA cert +# LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" # CERT_TS_A_AA & CERT_IUT_A_RCA shall be trusted by the PKI +# LibItsPki_Pics.PICS_IUT_AA_CERTIFICATE_ID := PKI AA cert +# LibItsPki_Pics.PICS_TS_CA_CERTIFICATE_ID := PKI RCA cert +# system.httpAtVPort.params := TCP(server=0.atos-ea.l0.c-its-pki.eu) + +# The EnrolmentResponse message shall be sent by the EA to the ITS-S across the interface at reference point S3 in response to a received EnrolmentRequest message +#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_01_BV + +# Check that EA doesn't accept Enrolment rekeying request when enrolment is not permitted by signing certificate (not containing an item of type PsidSsp) +#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_02_BI_01 +# Check that EA doesn't accept Enrolment rekeying request when enrolment is not permitted by signing certificate (containing opaque[0] (version) indicating other value than 1) +#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_02_BI_02 +# Check that EA doesn't accept Enrolment rekeying request when enrolment is not permitted by signing certificate (containing opaque[1] (value) indicating "Enrolment Request" (bit 1) set to 0) +#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_02_BI_03 + +# Enroll an ITS-Station, but with a canonical-ID, that is not registered. +#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_05_BI +# Enroll the ITS-Station, but the CSR re-quests more permissions than the issuer allows, i.e. request for security management SSP bit which is not set in the EA SSP +#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_06_BI +# Enroll the ITS-Station, but the CSR requests a AID permission that the issuer does not allow, i.e. request for CAM AID +#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_07_BI +# Enroll the ITS-Station, but the expiring date of the CSR is before the start date of the EA +#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_08_BI +# Enroll the ITS-Station, but the start date of the CSR is before the start date of the EA +#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_09_BI +# Enroll the ITS-Station, but the expiring date of the CSR is after the expiring date of the EA +#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_10_BI +# Enroll the ITS-Station, but the start date of the CSR is after the expiring date of the EA +#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_11_BI +# Enroll the ITS-Station, but the lifetime of the EC would be grater than allowed (considering values in C-ITS CP) +#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_12_BI +# Enroll the ITS-Station, but the inner PoP signature in the CSR, created with the EC private key, can not be verified with the provided public key +#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_13_BI + +# The EnrolmentResponse message shall be encrypted using an ETSI TS 103 097 approved algorithm and the encryption shall be done with the same AES key as the one used by the ITS-S requestor for the encryption of the EnrolmentRequest message. +#ItsPki_TestCases.TC_SECPKI_EA_ENR_01_BV +# The EnrolmentResponse message shall be encrypted using an ETSI TS 103 097 approved algorithm and the encryption shall be done with the same AES key as the one used by the ITS-S requestor for the encryption of the EnrolmentRequest message. +#ItsPki_TestCases.TC_SECPKI_EA_ENR_02_BV +# The outermost structure is an EtsiTs103097Data-Encrypted structure containing the component recipients containing one instance of RecipientInfo of choice pskRecipInfo, which contains the HashedId8 of the symmetric key used by the ITS-S to encrypt the EnrolmentRequest message to which the response is built and containing the component ciphertext, once decrypted, contains an EtsiTs103097Data-Signed structure +#ItsPki_TestCases.TC_SECPKI_EA_ENR_03_BV +# If the ITS-S has been able to decrypt the content, this expected EtsiTs103097Data-Signed structure shall contain hashId, tbsData, signer and signature. The hashId shall indicate the hash algorithm to be used as specified in ETSI TS 103 097, the signer shall be declared as a digest, containing the HashedId8 of the EA certificate and the signature over tbsData shall be computed using the EA private key corresponding to its publicVerificationKey found in the referenced EA certificate +#ItsPki_TestCases.TC_SECPKI_EA_ENR_04_BV +# Within the headerInfo of the tbsData, the psid shall be set to secured certificate request as assigned in ETSI TS 102 965 and the generationTime shall be present +#ItsPki_TestCases.TC_SECPKI_EA_ENR_05_BV +# Within the headerInfo of the tbsData, aside from psid and generationTime, all other components of the component tbsData.headerInfo not used and absent +#ItsPki_TestCases.TC_SECPKI_EA_ENR_06_BV +# The EtsiTS102941Data shall contain the version set to v1 (integer value set to 1) and the content set to InnerECResponse +#ItsPki_TestCases.TC_SECPKI_EA_ENR_07_BV +# The InnerECResponse shall contain the requestHash, which is the left-most 16 octets of the SHA256 digest of the EtsiTs103097Data - Signed structure received in the request and a responseCode indicating the result of the request +#ItsPki_TestCases.TC_SECPKI_EA_ENR_08_BV +# If the responseCode is 0, the InnerECResponse shall also contain an (enrolment) certificate +#ItsPki_TestCases.TC_SECPKI_EA_ENR_09_BV +# If the responseCode is different than 0, the InnerECResponse shall not contain a certificate +#ItsPki_TestCases.TC_SECPKI_EA_ENR_10_BV +# Check that signing of Enrolment response message is permitted by the EA certificate +#ItsPki_TestCases.TC_SECPKI_EA_ENR_11_BV +# Check that generated EC certificate contains only allowed permissions +#ItsPki_TestCases.TC_SECPKI_EA_ENR_12_BV + +# The AuthorizationValidationResponse message shall be sent by the EA to the AA across the interface at reference point S4 in response to a received AuthorizationValidationRequest message +#ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_RCV_01_BV +# Check that EA doesn't accept Authorization Validation Request when SharedAtRequest is signed with certificate without appropriate permissions +#ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_RCV_02_BI + +# Config +# LibItsSecurity_Pics.PICS_SEC_BFK_AUTH := true +# LibItsSecurity_Pics.PICS_SECPKI_ORIGINAL_BFK_KEY := true +# Check that the EA sends the butterfly authorization respond message after receiving of the butterfly authorization request +# Check that this message is signed with EA certificate +ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV +# Check that the butterfly authorization respond message, sent by EA, contains all necessary fields +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_02_BV +# +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_03_BV +# +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_04_BV +# +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_05_BV +# +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV + +# The EtsiTs103097Data-Encrypted is build with the component recipients containing one instance of RecipientInfo of choice pskRecipInfo, which contains the HashedId8 of the symmetric key used by the ITS-S to encrypt the AuthorizationRequest message to which the response is built and the component ciphertext containing the encrypted representation of the EtsiTs103097Data-Signed. The encryption uses a ETSI TS 103 097 [3] approved algorithm +#ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_01_BV +# To read an authorization validation response, the AA shall receive an EtsiTs103097Data-Encrypted structure, containing a EtsiTs103097Data-Signed structure, containing a EtsiTs102941Data structure, containing an AuthorizationValidationResponse structure +#ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_02_BV +# The AuthorizationValidationResponse structure contains the requestHash being the left-most 16 octets of the SHA256 digest of the EtsiTs103097Data-Signed structure received in the AuthorizationValidationRequest and a responseCode +#ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_03_BV +# If the responseCode is 0, the AuthorizationValidationResponse structure contains the component confirmedSubjectAttributes with the attributes the EA wishes to confirm, except for certIssuePermissions which is not allowed to be present +#ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_04_BV +# If the responseCode is different than 0, the AuthorizationValidationResponse structure does not contain the component confirmedSubjectAttributes +#ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_05_BV +# The component version of the EtsiTs102941Data structure is set to v1 (integer value set to 1) +#ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_06_BV + +# Config: +# LibItsPki_Pics.PICS_SIMULATE_EA_ENTITY := true # CERT_TS_A_EA shall be trusted by the PKI +# LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := CERT_TS_A_EA +# LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" # CERT_TS_A_AA & CERT_IUT_A_RCA shall be trusted by the PKI +# LibItsPki_Pics.PICS_IUT_AA_CERTIFICATE_ID := PKI AA cert +# LibItsPki_Pics.PICS_TS_CA_CERTIFICATE_ID := PKI RCA cert +# system.httpAtVPort.params := TCP(server=server=192.168.1.43) + +# Check that the EA/AA is able to decrypt the AuthorizationRequest message using the encryption private key corresponding to the recipient certificate... +#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_01_BV +# Check that the AA is able to decrypt the AuthorizationRequest message using the encryption private key corresponding to the recipient certificate... +#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_02_BV +# Check that the AA skips the AuthorizationRequest message if it is not addressed to this AA +#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_03_BI +# Check that the AA skips the AuthorizationRequest message if it unable to decrypt the encKey +#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_04_BI +# Check that the AA skips the AuthorizationRequest message if it unable to decrypt the encKey +#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_05_BI +# Check that the AA rejects the AuthorizationRequest message if it unable to verify the POP signature +#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_06_BI +# Check that the AA rejects the AuthorizationRequest message if it unable to verify the integrity of the request using hmacKey +#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_07_BI +# Send a correctly encoded AT request, but the ITS-Station is not enrolled at the EA +#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_08_BI +# Send an AT request, but the inner signer (valid EC) is not issued by the EA which is known / trusted by the AA. The AA trusts only EAs listet on the RCA-CTL +#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_09_BI +# Send an AT request, but the generation time of the CSR is in the past +#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_10_BI +# Send an AT request, but the generation time of the CSR is in the future +#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_11_BI +# Send an AT request, but the expiry date of the CSR is before the start date of the EC +#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_12_BI +# Send an AT request, but the start date of the CSR is before the start date of the EC +#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_13_BI +# Send an AT request, but the expiry date of the CSR is after the expiry date of the EC +#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_14_BI +# Send an AT request, but the start date of the CSR is after the expiring date of the EC +#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_15_BI +# Send an AT request, but the expiry date of the CSR is after now + maximum pre-loading period (considering values in C-ITS CP) +#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_16_BI + +# Check that the AA sends AuthorizationValidationRequest after receiving of the AuthorizationRequest +#ItsPki_TestCases.TC_SECPKI_AA_AUTHVAL_01_BV + +# Config: +# system.httpCaPort.params := TCP(debug=1,server=v2x-pki-test.microsec.com +# Check that the RootCA generates the Full CTL when new EA is about to be added to the Root CTL +#ItsPki_TestCases.TC_RCA_CTLGEN_01_BV +# Check that the RootCA generates the CRL signed with appropriate certificate. +#ItsPki_TestCases.TC_RCA_CRLGEN_01_BV +# Check that the TLM generates the ECTL when new RootCA is about to be added +#ItsPki_TestCases.TC_TLM_ECTLGEN_01_BV + +# Check that the issuing certificate has version 3 +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_01_BV +# Check that the issuing certificate has type explicit +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_02_BV_01 +# Check that the CA, been authorized using explicit certificate, is able to issue an implicit certificate +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_02_BV_02 +# Check that the CA, been authorized using explicit certificate, is able to issue an implicit certificate +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_02_BV_03 +# Check that the CA, been authorized using implicit certificate, does not issue an explicit certificate +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_02_BO_01 +# Check that CA issues certificate conformed to ETSI TS 103 097 [1], clause 6 +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_03_BV +# Check that the certificate issuer of certificates is referenced using digest. Check that right digest field is used to reference to the certificate +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_04_BV +# Check that the CA is able to issue the certificate with the well-formed circular region validity restriction +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_05_BV +# Check that the CA is able to issue the certificate with the well-formed rectangular region validity restriction +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_06_BV +# Check that the CA is able to issue the certificate with the well-formed polygonal region validity restriction +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_07_BV +# Check that the CA is able to issue the certificate with identified region validity restriction contains values that correspond to numeric country codes as defined by United Nations Statistics Division [5] +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_08_BV +# Check that the identified region validity restriction of the subordinate certificate is included in the identified region validity restriction of the issuing certificate +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_09_BV +# Check that the certificate signature contains ECC point of type set to either compressed_lsb_y_0, compressed_lsb_y_1 or x_coordinate_only +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_10_BV +# Check that the certificate verification key contains ECC point of type set to either compressed_lsb_y_0, compressed_lsb_y_1 or uncompressed +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_11_BV +# Check that the certificate encryption key contains ECC point of type set to either compressed_lsb_y_0, compressed_lsb_y_1 or uncompressed +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_12_BV +# Check the explicit certificate signature +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_13_BV_01 +# Check the explicit certificate signature +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_13_BV_02 +# Check that all PSID entries of the appPermissions component of the certificate are unique +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_14_BV +# Check that all PSID entries of the appPermissions component of the certificate are also contained in the certIssuePermissions component in the issuing certificate +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_15_BV +# Check that all PSID entries of the certIssuePermissions component of the certificate are unique +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_16_BV +# Check that SSP field in each entry of the appPermissions component of the AT certificate is equal to or a subset of the SSP Range in the corresponding issuing entry +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_17_BV +# Check that the validityPeriod of the subordinate certificate is inside the validityPeriod of the issuing certificate +#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_18_BV + +# Config: +# system.httpCaPort.params := TCP(debug=1,server_mode=1,server=192.168.1.43) +# Await CTL request and provides "CERT_IUT_A_RCA", "CERT_TS_A_AA", "CERT_TS_A_EA" certificates +#ItsPki_TestCases.TC_RCA_CTLGEN_xx_BV # + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 + diff --git a/etc/AtsPki/AtsPki_Microsec.cfg_ b/etc/AtsPki/AtsPki_Microsec.cfg_ index 2c0d646..997064d 100644 --- a/etc/AtsPki/AtsPki_Microsec.cfg_ +++ b/etc/AtsPki/AtsPki_Microsec.cfg_ @@ -9,7 +9,7 @@ LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "../data/certificates" # Configuration sub-directory to access certificate stored in files LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" -LibItsSecurity_Pixits.PX_BFK_TEST_VECTORS := true +LibItsSecurity_Pixits.PX_BFK_TEST_VECTORS := false LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" @@ -18,12 +18,14 @@ LibHttp_Pics.PICS_HEADER_HOST := "v2x-pki-test.microsec.com" LibItsPki_Pics.PICS_HEADER_HOST_CA := "v2x-pki-test.microsec.com" LibItsPki_Pics.PICS_HEADER_HOST_TLM := "v2x-pki-test.microsec.com" -LibItsPki_Pics.PICS_HTTP_POST_URI_EC := "/v2x_ea_nistp256/ecRequest" -LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/v2x_aa_nistp256/atRequest" -LibItsPki_Pics.PICS_HTTP_POST_URI_ATV := "/v2x_ea_nistp256/authValRequest" -LibItsPki_Pics.PICS_HTTP_GET_URI_CTL := "/v2x_rootca_nistp256/getctl/B65E3B8FBBEC3910" -LibItsPki_Pics.PICS_HTTP_GET_URI_CRL := "/v2x_rootca_nistp256/getcrl/B65E3B8FBBEC3910" -LibItsPki_Pics.PICS_HTTP_GET_URI_TLM := "/v2x_rootca_brainpoolp256r1" +LibItsPki_Pics.PICS_HTTP_POST_URI_EC := "/v2x_ea_nistp256/ecRequest" +LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/v2x_aa_nistp256/atRequest" +LibItsPki_Pics.PICS_HTTP_POST_URI_ATV := "/v2x_ea_nistp256/authValRequest" +LibItsPki_Pics.PICS_HTTP_GET_URI_CTL := "/v2x_rootca_nistp256/getctl/B65E3B8FBBEC3910" +LibItsPki_Pics.PICS_HTTP_GET_URI_CRL := "/v2x_rootca_nistp256/getcrl/B65E3B8FBBEC3910" +LibItsPki_Pics.PICS_HTTP_GET_URI_TLM := "/v2x_rootca_brainpoolp256r1" +LibItsPki_Pics.PICS_HTTP_POST_URI_BFK_AUTH := "/v2x_ea_nistp256/butterflyAuthorization" +LibItsPki_Pics.PICS_HTTP_POST_URI_BFK_AT_DOWNLOAD := "/v2x_ea_nistp256/butterflyDownload" #LibItsPki_Pics.PICS_SIMULATE_EA_ENTITY := true # CERT_TS_A_EA shall be trusted by the PKI LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := "0_MicrosecTest-EA-2021_L0" # Use CERT_TS_A_EA when the TS simulate the EA (TC_SECPKI_AA_AUTHVAL_01_BV) with PICS_SIMULATE_EA_ENTITY set @@ -62,8 +64,12 @@ LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3 #LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 #LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 -LibItsSecurity_Pics.PICS_SEC_CIRCULAR_REGION := false -LibItsSecurity_Pics.PICS_SEC_RECTANGULAR_REGION := true +# Certificate areas tests +LibItsSecurity_Pics.PICS_SEC_CIRCULAR_REGION := false +LibItsSecurity_Pics.PICS_SEC_RECTANGULAR_REGION := true + +# BFK +LibItsSecurity_Pics.PICS_SEC_BFK_AUTH := true LibItsSecurity_Pics.PICS_SECPKI_ORIGINAL_BFK_KEY := true LibItsSecurity_Pics.PICS_SECPKI_UNIFIED_BFK_KEY := false LibItsSecurity_Pics.PICS_SECPKI_COMPACT_UNIFIED_BFK_KEY := false @@ -159,10 +165,13 @@ system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/ # Check that EA doesn't accept Authorization Validation Request when SharedAtRequest is signed with certificate without appropriate permissions #ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_RCV_02_BI +# Config +# LibItsSecurity_Pics.PICS_SEC_BFK_AUTH := true +# LibItsSecurity_Pics.PICS_SECPKI_ORIGINAL_BFK_KEY := true # Check that the EA sends the butterfly authorization respond message after receiving of the butterfly authorization request # Check that this message is signed with EA certificate ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV -# +# Check that the butterfly authorization respond message, sent by EA, contains all necessary fields #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_02_BV # #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_03_BV diff --git a/etc/AtsPki/AtsPki_Simu.cfg_ b/etc/AtsPki/AtsPki_Simu.cfg_ index 90f646a..9f5685e 100644 --- a/etc/AtsPki/AtsPki_Simu.cfg_ +++ b/etc/AtsPki/AtsPki_Simu.cfg_ @@ -18,6 +18,8 @@ LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "../data/certificates" # Configuration sub-directory to access certificate stored in files LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" +LibItsSecurity_Pixits.PX_BFK_TEST_VECTORS := false + # Use this certificate if the RSU simulator act as IUT LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_IUT_A_AT" @@ -26,12 +28,14 @@ LibHttp_Pics.PICS_HEADER_CTL_CONTENT_TYPE := "application/x-its-crl" LibHttp_Pics.PICS_HEADER_HOST := "192.168.1.43" -LibItsPki_Pics.PICS_HTTP_POST_URI_EC := "/ea/enrolment" -LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/aa/authorization" - +LibItsPki_Pics.PICS_HTTP_POST_URI_EC := "/ea/enrolment" +LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/aa/authorization" +LibItsPki_Pics.PICS_HTTP_POST_URI_BFK_AUTH := "/butterflyAuthorization" +LibItsPki_Pics.PICS_HTTP_POST_URI_BFK_AT_DOWNLOAD := "/butterflyDownload" -LibItsPki_Pics.PICS_IUT_ITS_S_ROLE := true -LibItsPki_Pics.PICS_SECPKI_ENROLMENT := true +LibItsPki_Pics.PICS_IUT_ITS_S_ROLE := true +LibItsPki_Pics.PICS_SECPKI_ENROLMENT := true +LibItsPki_Pics.PICS_SECPKI_ENROLLMENT_X509 := false LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := "CERT_TS_A_EA" LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" @@ -54,23 +58,29 @@ LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3 # Set to true if the IUT support geographical region #LibItsPki_Pics.PICS_EC_SUBJECT_ATTRIBUT_REGION := false # requestedSubjectAttributes.region is omitted -# Re-enrollment keys -LibItsPki_Pics.PICS_SECPKI_REENROLMENT := true - -#ItsPki_Pixits.PX_TRIGGER_EC_BEFORE_AT := false; +#LibItsPki_Pics.PICS_PKI_AUTH_POP := false # Do not use Signed for PoP in Authorization requet + # Required for SECPKI_AA_AUTH_RCV_02_BV +#LibItsPki_Pics.PICS_SECPKI_REENROLMENT := false # Check in logs the pattern '==> EC ' to find the required information for re-enrolment #LibItsPki_Pixits.PX_INCLUDE_ENCRYPTION_KEYS := false # No encryption key in Authorization request -#LibItsPki_Pixits.PICS_PKI_AUTH_POP := false # Do not use Signed for PoP in Authorization requet #LibItsPki_Pixits.PX_VE_ALG := e_brainpool_p256_r1 # e_nist_p256, e_nist_p384, e_sm2_p256, e_brainpool_p256_r1 or e_brainpool_p384_r1 + #LibItsPki_Pixits.PX_EC_ALG_FOR_EC := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256, e_brainpool_p256_r1 #LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256, e_brainpool_p256_r1 #LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256, e_brainpool_p256_r1 #LibItsPki_Pixits.PX_EC_ALG_FOR_AT := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256, e_brainpool_p256_r1 +# Certificate areas tests LibItsSecurity_Pics.PICS_SEC_CIRCULAR_REGION := false LibItsSecurity_Pics.PICS_SEC_RECTANGULAR_REGION := true +# BFK +LibItsSecurity_Pics.PICS_SEC_BFK_AUTH := true +LibItsSecurity_Pics.PICS_SECPKI_ORIGINAL_BFK_KEY := true +LibItsSecurity_Pics.PICS_SECPKI_UNIFIED_BFK_KEY := false +LibItsSecurity_Pics.PICS_SECPKI_COMPACT_UNIFIED_BFK_KEY := false + [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). @@ -157,13 +167,13 @@ LogEventTypes:= Yes # Single GeoNetworking component port # its_aid = 36 CAM # its_aid = 37 DENM -system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=1,its_aid=36)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlp0s20f3,filter=and ether proto 0x8947)" +system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=1,its_aid=36)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlo1,filter=and ether proto 0x8947)" # Single HTTP component port -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)" # GeoNetworking UpperTester port based on UDP -system.utPort.params := "UT_PKI/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346,reuse_incoming_source_adddress=1)" +system.utPort.params := "UT_PKI/UDP(dst_ip=192.168.1.39,dst_port=12345,src_port=12346,reuse_incoming_source_adddress=1)" [EXECUTE] @@ -213,6 +223,21 @@ system.utPort.params := "UT_PKI/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port= #ItsPki_TestCases.TC_SECPKI_ITSS_AUTH_REP_03_BV # Check that IUT stops sending the Authorization Request message if maximum number of retry has been reached #ItsPki_TestCases.TC_SECPKI_ITSS_AUTH_REP_04_BV + +# Check that the ITS-S send the EtsiTs103097Data to the Enrollment Authority (EA) to request a batch of authorization tickets +# Check that this message is encrypted and addressed to a single recipient +ItsPki_TestCases.TC_SECPKI_ITSS_BFK_AUTH_01_BV +# Check that the ButterflyAuthorizationRequestMessage is signed using the EC certificate +#ItsPki_TestCases.TC_SECPKI_ITSS_BFK_AUTH_02_BV +# Check that the ButterflyAuthorizationRequestMessage is signed using the X.509 EC certificate +# Not supported +# Check that the ButterflyAuthorizationRequestMessage contains all required elements +#ItsPki_TestCases.TC_SECPKI_ITSS_BFK_AUTH_03_BV +# Check that the ButterflyAuthorizationRequestMessage contains newlly generated caterpillar public key +#ItsPki_TestCases.TC_SECPKI_ITSS_BFK_AUTH_04_BV +# Check that IUT downloads the AT certificates batch after receiving of positive ButterflyAuthorizationResponse message +#ItsPki_TestCases.TC_SECPKI_ITSS_BFK_CERTDNL_01_BV + # Check that the IUT trust the new RCA from the received ECTL #ItsPki_TestCases.TC_SECPKI_ITSS_CTL_01_BV diff --git a/ttcn/AtsPki b/ttcn/AtsPki index f6566fc..86f32f0 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit f6566fcbe3322e533dfa28ccd6e451603f151dae +Subproject commit 86f32f09ff0cb336c96e2dd4a43b310d7dfdba39 -- GitLab From aef8993b0e62989fcfbd78524bde04c000b792ce Mon Sep 17 00:00:00 2001 From: garciay Date: Fri, 8 Sep 2023 11:58:41 +0200 Subject: [PATCH 109/178] Remove codec for RaEeCertInfo --- ccsrc/EncDec/LibItsPki_Encdec.cc | 44 +++++++++++++++--------------- ccsrc/Protocols/Security/module.mk | 1 - etc/AtsPki/AtsPki.cfg | 4 +-- etc/AtsPki/AtsPki_Microsec.cfg_ | 4 +-- ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- 6 files changed, 28 insertions(+), 29 deletions(-) diff --git a/ccsrc/EncDec/LibItsPki_Encdec.cc b/ccsrc/EncDec/LibItsPki_Encdec.cc index 9a66599..cc38031 100644 --- a/ccsrc/EncDec/LibItsPki_Encdec.cc +++ b/ccsrc/EncDec/LibItsPki_Encdec.cc @@ -12,7 +12,7 @@ #include "etsi_ts102941_types_enrolment_inner_response.hh" #include "ieee_1609dot2_base_types_public_encryption_key.hh" #include "ieee_1609dot2_base_types_public_verification_key.hh" -#include "etsi_ts102941_types_ra_ee_cert_info.hh" +//#include "etsi_ts102941_types_ra_ee_cert_info.hh" #include "etsi_ts102941_trust_lists_ctl_format.hh" @@ -261,32 +261,32 @@ namespace LibItsPki__EncdecDeclarations { return 0; } - BITSTRING fx__enc__RaEeCertInfo(Ieee1609Dot2Dot1EeRaInterface::RaEeCertInfo const &p_ra_ee_cert_info) { - loggers::get_instance().log_msg(">>> fx__enc__RaEeCertInfo: ", p_ra_ee_cert_info); + // BITSTRING fx__enc__RaEeCertInfo(Ieee1609Dot2Dot1EeRaInterface::RaEeCertInfo const &p_ra_ee_cert_info) { + // loggers::get_instance().log_msg(">>> fx__enc__RaEeCertInfo: ", p_ra_ee_cert_info); - etsi_ts102941_types_ra_ee_cert_info codec; - OCTETSTRING os; - if (codec.encode(p_ra_ee_cert_info, os) == -1) { - loggers::get_instance().warning("fx__enc__RaEeCertInfo: -1 result code was returned"); - return int2bit(0, 1); - } + // etsi_ts102941_types_ra_ee_cert_info codec; + // OCTETSTRING os; + // if (codec.encode(p_ra_ee_cert_info, os) == -1) { + // loggers::get_instance().warning("fx__enc__RaEeCertInfo: -1 result code was returned"); + // return int2bit(0, 1); + // } - return oct2bit(os); - } + // return oct2bit(os); + // } - INTEGER fx__dec__RaEeCertInfo(BITSTRING &b, Ieee1609Dot2Dot1EeRaInterface::RaEeCertInfo &p_ra_ee_cert_info) { - loggers::get_instance().log_msg(">>> fx__dec__RaEeCertInfo: ", b); + // INTEGER fx__dec__RaEeCertInfo(BITSTRING &b, Ieee1609Dot2Dot1EeRaInterface::RaEeCertInfo &p_ra_ee_cert_info) { + // loggers::get_instance().log_msg(">>> fx__dec__RaEeCertInfo: ", b); - etsi_ts102941_types_ra_ee_cert_info codec; - OCTETSTRING is = bit2oct(b); - if (codec.decode(is, p_ra_ee_cert_info) == -1) { - loggers::get_instance().warning("fx__dec__RaEeCertInfo: -1 result code was returned"); - return -1; - } + // etsi_ts102941_types_ra_ee_cert_info codec; + // OCTETSTRING is = bit2oct(b); + // if (codec.decode(is, p_ra_ee_cert_info) == -1) { + // loggers::get_instance().warning("fx__dec__RaEeCertInfo: -1 result code was returned"); + // return -1; + // } - loggers::get_instance().log_msg("<<< fx__dec__RaEeCertInfo: ", p_ra_ee_cert_info); - return 0; - } + // loggers::get_instance().log_msg("<<< fx__dec__RaEeCertInfo: ", p_ra_ee_cert_info); + // return 0; + // } BITSTRING fx__enc__PublicKeys(EtsiTs102941BaseTypes::PublicKeys const &p_public_keys) { loggers::get_instance().log_msg(">>> fx__enc__PublicKeys: ", p_public_keys); diff --git a/ccsrc/Protocols/Security/module.mk b/ccsrc/Protocols/Security/module.mk index 73fa5c9..35c24c1 100644 --- a/ccsrc/Protocols/Security/module.mk +++ b/ccsrc/Protocols/Security/module.mk @@ -22,7 +22,6 @@ sources += http_etsi_ieee1609dot2_codec.cc \ etsi_ts102941_types_authorization_shared_at_request.cc \ etsi_ts102941_types_authorization_validation_request.cc \ etsi_ts102941_types_authorization_validation_response.cc \ - etsi_ts102941_types_ra_ee_cert_info.cc \ etsi_ts102941_types_enrolment_inner_request.cc \ etsi_ts102941_types_enrolment_inner_response.cc \ diff --git a/etc/AtsPki/AtsPki.cfg b/etc/AtsPki/AtsPki.cfg index 997064d..6df5e43 100644 --- a/etc/AtsPki/AtsPki.cfg +++ b/etc/AtsPki/AtsPki.cfg @@ -170,9 +170,9 @@ system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/ # LibItsSecurity_Pics.PICS_SECPKI_ORIGINAL_BFK_KEY := true # Check that the EA sends the butterfly authorization respond message after receiving of the butterfly authorization request # Check that this message is signed with EA certificate -ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV # Check that the butterfly authorization respond message, sent by EA, contains all necessary fields -#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_02_BV +ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_02_BV # #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_03_BV # diff --git a/etc/AtsPki/AtsPki_Microsec.cfg_ b/etc/AtsPki/AtsPki_Microsec.cfg_ index 997064d..6df5e43 100644 --- a/etc/AtsPki/AtsPki_Microsec.cfg_ +++ b/etc/AtsPki/AtsPki_Microsec.cfg_ @@ -170,9 +170,9 @@ system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/ # LibItsSecurity_Pics.PICS_SECPKI_ORIGINAL_BFK_KEY := true # Check that the EA sends the butterfly authorization respond message after receiving of the butterfly authorization request # Check that this message is signed with EA certificate -ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV # Check that the butterfly authorization respond message, sent by EA, contains all necessary fields -#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_02_BV +ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_02_BV # #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_03_BV # diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 86f32f0..4250b3b 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 86f32f09ff0cb336c96e2dd4a43b310d7dfdba39 +Subproject commit 4250b3b4a85ff424bf55c998d330aa1df2ff7b28 diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index f6bc976..f958cd9 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit f6bc9761e95a3ded6434cf1a7382fa7d5fbd2d9c +Subproject commit f958cd9517897d535602a8049516f58a58ce9f3b -- GitLab From 8a0a9b908de86c45b69c9bfc9935d3395f0e37b5 Mon Sep 17 00:00:00 2001 From: garciay Date: Mon, 25 Sep 2023 08:22:08 +0200 Subject: [PATCH 110/178] Add clause references for ITS-S part in AtsPki --- etc/AtsPki/AtsPki.cfg | 14 ++++++++------ etc/AtsPki/AtsPki_Microsec.cfg_ | 14 ++++++++------ ttcn/AtsPki | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/etc/AtsPki/AtsPki.cfg b/etc/AtsPki/AtsPki.cfg index 6df5e43..761a8e5 100644 --- a/etc/AtsPki/AtsPki.cfg +++ b/etc/AtsPki/AtsPki.cfg @@ -172,15 +172,17 @@ system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/ # Check that this message is signed with EA certificate #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV # Check that the butterfly authorization respond message, sent by EA, contains all necessary fields -ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_02_BV -# +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_02_BV +# Check that the EA sends butterfly certificate request message after receiving of the butterfly authorization request +# Check that this message is encrypted for the AA +# Check that this message is signed with the EA certificate #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_03_BV -# +# Check that the butterfly certificate request message sent by EA to AA contains all required elements #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_04_BV -# +# Check that the butterfly certificate request message contains expanded cocoon key #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_05_BV -# -#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV +# Check that the butterfly certificate request message sent by EA to AA contains all required elements +ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV # The EtsiTs103097Data-Encrypted is build with the component recipients containing one instance of RecipientInfo of choice pskRecipInfo, which contains the HashedId8 of the symmetric key used by the ITS-S to encrypt the AuthorizationRequest message to which the response is built and the component ciphertext containing the encrypted representation of the EtsiTs103097Data-Signed. The encryption uses a ETSI TS 103 097 [3] approved algorithm #ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_01_BV diff --git a/etc/AtsPki/AtsPki_Microsec.cfg_ b/etc/AtsPki/AtsPki_Microsec.cfg_ index 6df5e43..761a8e5 100644 --- a/etc/AtsPki/AtsPki_Microsec.cfg_ +++ b/etc/AtsPki/AtsPki_Microsec.cfg_ @@ -172,15 +172,17 @@ system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/ # Check that this message is signed with EA certificate #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV # Check that the butterfly authorization respond message, sent by EA, contains all necessary fields -ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_02_BV -# +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_02_BV +# Check that the EA sends butterfly certificate request message after receiving of the butterfly authorization request +# Check that this message is encrypted for the AA +# Check that this message is signed with the EA certificate #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_03_BV -# +# Check that the butterfly certificate request message sent by EA to AA contains all required elements #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_04_BV -# +# Check that the butterfly certificate request message contains expanded cocoon key #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_05_BV -# -#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV +# Check that the butterfly certificate request message sent by EA to AA contains all required elements +ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV # The EtsiTs103097Data-Encrypted is build with the component recipients containing one instance of RecipientInfo of choice pskRecipInfo, which contains the HashedId8 of the symmetric key used by the ITS-S to encrypt the AuthorizationRequest message to which the response is built and the component ciphertext containing the encrypted representation of the EtsiTs103097Data-Signed. The encryption uses a ETSI TS 103 097 [3] approved algorithm #ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_01_BV diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 4250b3b..0002988 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 4250b3b4a85ff424bf55c998d330aa1df2ff7b28 +Subproject commit 0002988efce40d881a643305c6b8725f668a7e57 -- GitLab From 0b2536fa549814a88ee7137852ebd5a0220e9491 Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 26 Sep 2023 15:51:46 +0200 Subject: [PATCH 111/178] Change URL for titan.TestPorts.Common_Components.Abstract_Socket submodule --- .gitmodules | 2 +- titan-test-system-framework | 2 +- ttcn/AtsPki | 2 +- .../titan.TestPorts.Common_Components.Abstract_Socket/module | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitmodules b/.gitmodules index 1f64343..08c7ef1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -39,7 +39,7 @@ branch = devel2 [submodule "ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module"] path = ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module - url = https://github.com/eclipse/titan.TestPorts.Common_Components.Abstract_Socket.git + url = https://gitlab.eclipse.org/eclipse/titan/titan.TestPorts.Common_Components.Abstract_Socket [submodule "titan-test-system-framework"] path = titan-test-system-framework url = https://labs.etsi.org/rep/cti-tools/titan-test-system-framework.git diff --git a/titan-test-system-framework b/titan-test-system-framework index 25b94ce..e27aaa8 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit 25b94cec2e9370310eabe936d429f54eae02ffd1 +Subproject commit e27aaa847f49a1e459f427abc3620ef7a40223ca diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 0002988..facdaff 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 0002988efce40d881a643305c6b8725f668a7e57 +Subproject commit facdaff61bf3d3876f2accf45fef50d3ccf0ea4b diff --git a/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module b/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module index affc1fa..f6b2d2b 160000 --- a/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module +++ b/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module @@ -1 +1 @@ -Subproject commit affc1fa4e6497ff138b79a958caa79532fba6857 +Subproject commit f6b2d2ba3f486dea778e108ce60e02a3fcae9ff8 -- GitLab From 8b0349e10b34f611bd176811dc2b940b0f738d56 Mon Sep 17 00:00:00 2001 From: garciay Date: Mon, 2 Oct 2023 09:34:06 +0200 Subject: [PATCH 112/178] Bug fixed in TC_MRS_ITSS_MESSAGES_CLASS1_CAM_BV_01 --- etc/AtsMBR/AtsMBR.cfg | 4 +- etc/AtsPki/AtsPki.cfg | 310 +----------------------------------- etc/AtsPki/AtsPki_Simu.cfg_ | 4 +- ttcn/AtsMBR | 2 +- 4 files changed, 6 insertions(+), 314 deletions(-) mode change 100644 => 120000 etc/AtsPki/AtsPki.cfg diff --git a/etc/AtsMBR/AtsMBR.cfg b/etc/AtsMBR/AtsMBR.cfg index 1fd4253..05ebbd0 100644 --- a/etc/AtsMBR/AtsMBR.cfg +++ b/etc/AtsMBR/AtsMBR.cfg @@ -181,7 +181,7 @@ system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.39,dst_port=12345,src_po #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 +ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS1_CAM_BV_01 # Check that the IUT generates an invalid speed value in reverse driving observation on a CAM in the MR message when requested (Class 1) - obs-Speed-ValueTooLarge-DriveDirectionReverse #ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS1_CAM_BV_02 @@ -223,7 +223,7 @@ system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.39,dst_port=12345,src_po #ItsMbr_TestCases.TC_MRS_ITSS_MULTIPLE_MESSAGES_CAM_01 # 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_MULTIPLE_MESSAGES_CAM_02 +#ItsMbr_TestCases.TC_MRS_ITSS_MULTIPLE_MESSAGES_CAM_02 [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/etc/AtsPki/AtsPki.cfg b/etc/AtsPki/AtsPki.cfg deleted file mode 100644 index 761a8e5..0000000 --- a/etc/AtsPki/AtsPki.cfg +++ /dev/null @@ -1,309 +0,0 @@ - -[MODULE_PARAMETERS] -# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. - -# 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 := "../data/certificates" -# Configuration sub-directory to access certificate stored in files -LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" - -LibItsSecurity_Pixits.PX_BFK_TEST_VECTORS := false - -LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" - -LibItsPki_Pics.PICS_MULTIPLE_END_POINT := false -LibHttp_Pics.PICS_HEADER_HOST := "v2x-pki-test.microsec.com" -LibItsPki_Pics.PICS_HEADER_HOST_CA := "v2x-pki-test.microsec.com" -LibItsPki_Pics.PICS_HEADER_HOST_TLM := "v2x-pki-test.microsec.com" - -LibItsPki_Pics.PICS_HTTP_POST_URI_EC := "/v2x_ea_nistp256/ecRequest" -LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/v2x_aa_nistp256/atRequest" -LibItsPki_Pics.PICS_HTTP_POST_URI_ATV := "/v2x_ea_nistp256/authValRequest" -LibItsPki_Pics.PICS_HTTP_GET_URI_CTL := "/v2x_rootca_nistp256/getctl/B65E3B8FBBEC3910" -LibItsPki_Pics.PICS_HTTP_GET_URI_CRL := "/v2x_rootca_nistp256/getcrl/B65E3B8FBBEC3910" -LibItsPki_Pics.PICS_HTTP_GET_URI_TLM := "/v2x_rootca_brainpoolp256r1" -LibItsPki_Pics.PICS_HTTP_POST_URI_BFK_AUTH := "/v2x_ea_nistp256/butterflyAuthorization" -LibItsPki_Pics.PICS_HTTP_POST_URI_BFK_AT_DOWNLOAD := "/v2x_ea_nistp256/butterflyDownload" - -#LibItsPki_Pics.PICS_SIMULATE_EA_ENTITY := true # CERT_TS_A_EA shall be trusted by the PKI -LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := "0_MicrosecTest-EA-2021_L0" # Use CERT_TS_A_EA when the TS simulate the EA (TC_SECPKI_AA_AUTHVAL_01_BV) with PICS_SIMULATE_EA_ENTITY set -LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" # CERT_TS_A_AA & CERT_IUT_A_RCA shall be trusted by the PKI -LibItsPki_Pics.PICS_IUT_AA_CERTIFICATE_ID := "0_MicrosecTest-AA-2021_L0" -LibItsPki_Pics.PICS_TS_CA_CERTIFICATE_ID := "MicrosecNistP256RootCA" - -LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3031'O # Nist-P256 -#LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3032'O # Brainpool-P256 r1 -#LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3033'O # Brainpool-P384 r1 - -# Technical keys -# NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) -# Private key -#FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34 -# Public key -#048038F5490CD5A58FF5465D3B577EE830047336AC5DAC07036B798AAECAE7273FD91C4F60995494EA949E64EE0E3D768DBDEB8AFC345627211E3FC4DD8FD39EE5 -LibItsPki_Pics.PICS_ITS_S_SIGN_NITSP256_PRIVATE_KEY := 'FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34'O; -LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3b577ee830047336ac5dac07036b798aaecae7273f'O; - -# Set to true if the IUT support CertificateId shall be set to the choice name, false if it shall be omitted -#LibItsPki_Pics.PICS_EC_SUBJECT_ATTRIBUT_ID := false # requestedSubjectAttributes.id is omitted -# Set to true if the IUT support geographical region -#LibItsPki_Pics.PICS_EC_SUBJECT_ATTRIBUT_REGION := false # requestedSubjectAttributes.region is omitted - -#LibItsPki_Pics.PICS_PKI_AUTH_POP := false # Do not use Signed for PoP in Authorization requet - # Required for SECPKI_AA_AUTH_RCV_02_BV -#LibItsPki_Pics.PICS_SECPKI_REENROLMENT := false # Check in logs the pattern '==> EC ' to find the required information for re-enrolment - -#LibItsPki_Pixits.PX_INCLUDE_ENCRYPTION_KEYS := false # No encryption key in Authorization request - -#LibItsPki_Pixits.PX_VE_ALG := e_brainpool_p256_r1 # e_nist_p256, e_nist_p384, e_sm2_p256 or e_brainpool_p384_r1 - -#LibItsPki_Pixits.PX_EC_ALG_FOR_EC := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_AT := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 -#LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 - -# Certificate areas tests -LibItsSecurity_Pics.PICS_SEC_CIRCULAR_REGION := false -LibItsSecurity_Pics.PICS_SEC_RECTANGULAR_REGION := true - -# BFK -LibItsSecurity_Pics.PICS_SEC_BFK_AUTH := true -LibItsSecurity_Pics.PICS_SECPKI_ORIGINAL_BFK_KEY := true -LibItsSecurity_Pics.PICS_SECPKI_UNIFIED_BFK_KEY := false -LibItsSecurity_Pics.PICS_SECPKI_COMPACT_UNIFIED_BFK_KEY := false - -[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). - -LogFile := "../logs/AtsPki/%e.%h-%r.%s" -FileMask := LOG_ALL | USER | DEBUG | MATCHING -ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING -#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP -#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP -LogSourceInfo := Stack -LogEntityName:= Yes -LogEventTypes:= Yes -#TimeStampFormat := DateTime - -[TESTPORT_PARAMETERS] -# Single HTTP component port -system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=v2x-pki-test.microsec.com)" - -#system.httpAtVPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=yanngarcia.ddns.net)" # HTTP component ports specific to TC_SECPKI_AA_AUTHVAL_xx - -system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=v2x-pki-test.microsec.com)" -#system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.43)"system.httpTlmPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=v2x-pki-test.microsec.com)" - -[EXECUTE] -# Config: -# LibItsPki_Pics.PICS_SIMULATE_EA_ENTITY := false # CERT_TS_A_EA shall be trusted by the PKI -# LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := PKI EA cert -# LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" # CERT_TS_A_AA & CERT_IUT_A_RCA shall be trusted by the PKI -# LibItsPki_Pics.PICS_IUT_AA_CERTIFICATE_ID := PKI AA cert -# LibItsPki_Pics.PICS_TS_CA_CERTIFICATE_ID := PKI RCA cert -# system.httpAtVPort.params := TCP(server=0.atos-ea.l0.c-its-pki.eu) - -# The EnrolmentResponse message shall be sent by the EA to the ITS-S across the interface at reference point S3 in response to a received EnrolmentRequest message -#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_01_BV - -# Check that EA doesn't accept Enrolment rekeying request when enrolment is not permitted by signing certificate (not containing an item of type PsidSsp) -#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_02_BI_01 -# Check that EA doesn't accept Enrolment rekeying request when enrolment is not permitted by signing certificate (containing opaque[0] (version) indicating other value than 1) -#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_02_BI_02 -# Check that EA doesn't accept Enrolment rekeying request when enrolment is not permitted by signing certificate (containing opaque[1] (value) indicating "Enrolment Request" (bit 1) set to 0) -#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_02_BI_03 - -# Enroll an ITS-Station, but with a canonical-ID, that is not registered. -#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_05_BI -# Enroll the ITS-Station, but the CSR re-quests more permissions than the issuer allows, i.e. request for security management SSP bit which is not set in the EA SSP -#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_06_BI -# Enroll the ITS-Station, but the CSR requests a AID permission that the issuer does not allow, i.e. request for CAM AID -#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_07_BI -# Enroll the ITS-Station, but the expiring date of the CSR is before the start date of the EA -#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_08_BI -# Enroll the ITS-Station, but the start date of the CSR is before the start date of the EA -#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_09_BI -# Enroll the ITS-Station, but the expiring date of the CSR is after the expiring date of the EA -#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_10_BI -# Enroll the ITS-Station, but the start date of the CSR is after the expiring date of the EA -#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_11_BI -# Enroll the ITS-Station, but the lifetime of the EC would be grater than allowed (considering values in C-ITS CP) -#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_12_BI -# Enroll the ITS-Station, but the inner PoP signature in the CSR, created with the EC private key, can not be verified with the provided public key -#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_13_BI - -# The EnrolmentResponse message shall be encrypted using an ETSI TS 103 097 approved algorithm and the encryption shall be done with the same AES key as the one used by the ITS-S requestor for the encryption of the EnrolmentRequest message. -#ItsPki_TestCases.TC_SECPKI_EA_ENR_01_BV -# The EnrolmentResponse message shall be encrypted using an ETSI TS 103 097 approved algorithm and the encryption shall be done with the same AES key as the one used by the ITS-S requestor for the encryption of the EnrolmentRequest message. -#ItsPki_TestCases.TC_SECPKI_EA_ENR_02_BV -# The outermost structure is an EtsiTs103097Data-Encrypted structure containing the component recipients containing one instance of RecipientInfo of choice pskRecipInfo, which contains the HashedId8 of the symmetric key used by the ITS-S to encrypt the EnrolmentRequest message to which the response is built and containing the component ciphertext, once decrypted, contains an EtsiTs103097Data-Signed structure -#ItsPki_TestCases.TC_SECPKI_EA_ENR_03_BV -# If the ITS-S has been able to decrypt the content, this expected EtsiTs103097Data-Signed structure shall contain hashId, tbsData, signer and signature. The hashId shall indicate the hash algorithm to be used as specified in ETSI TS 103 097, the signer shall be declared as a digest, containing the HashedId8 of the EA certificate and the signature over tbsData shall be computed using the EA private key corresponding to its publicVerificationKey found in the referenced EA certificate -#ItsPki_TestCases.TC_SECPKI_EA_ENR_04_BV -# Within the headerInfo of the tbsData, the psid shall be set to secured certificate request as assigned in ETSI TS 102 965 and the generationTime shall be present -#ItsPki_TestCases.TC_SECPKI_EA_ENR_05_BV -# Within the headerInfo of the tbsData, aside from psid and generationTime, all other components of the component tbsData.headerInfo not used and absent -#ItsPki_TestCases.TC_SECPKI_EA_ENR_06_BV -# The EtsiTS102941Data shall contain the version set to v1 (integer value set to 1) and the content set to InnerECResponse -#ItsPki_TestCases.TC_SECPKI_EA_ENR_07_BV -# The InnerECResponse shall contain the requestHash, which is the left-most 16 octets of the SHA256 digest of the EtsiTs103097Data - Signed structure received in the request and a responseCode indicating the result of the request -#ItsPki_TestCases.TC_SECPKI_EA_ENR_08_BV -# If the responseCode is 0, the InnerECResponse shall also contain an (enrolment) certificate -#ItsPki_TestCases.TC_SECPKI_EA_ENR_09_BV -# If the responseCode is different than 0, the InnerECResponse shall not contain a certificate -#ItsPki_TestCases.TC_SECPKI_EA_ENR_10_BV -# Check that signing of Enrolment response message is permitted by the EA certificate -#ItsPki_TestCases.TC_SECPKI_EA_ENR_11_BV -# Check that generated EC certificate contains only allowed permissions -#ItsPki_TestCases.TC_SECPKI_EA_ENR_12_BV - -# The AuthorizationValidationResponse message shall be sent by the EA to the AA across the interface at reference point S4 in response to a received AuthorizationValidationRequest message -#ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_RCV_01_BV -# Check that EA doesn't accept Authorization Validation Request when SharedAtRequest is signed with certificate without appropriate permissions -#ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_RCV_02_BI - -# Config -# LibItsSecurity_Pics.PICS_SEC_BFK_AUTH := true -# LibItsSecurity_Pics.PICS_SECPKI_ORIGINAL_BFK_KEY := true -# Check that the EA sends the butterfly authorization respond message after receiving of the butterfly authorization request -# Check that this message is signed with EA certificate -#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV -# Check that the butterfly authorization respond message, sent by EA, contains all necessary fields -#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_02_BV -# Check that the EA sends butterfly certificate request message after receiving of the butterfly authorization request -# Check that this message is encrypted for the AA -# Check that this message is signed with the EA certificate -#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_03_BV -# Check that the butterfly certificate request message sent by EA to AA contains all required elements -#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_04_BV -# Check that the butterfly certificate request message contains expanded cocoon key -#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_05_BV -# Check that the butterfly certificate request message sent by EA to AA contains all required elements -ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV - -# The EtsiTs103097Data-Encrypted is build with the component recipients containing one instance of RecipientInfo of choice pskRecipInfo, which contains the HashedId8 of the symmetric key used by the ITS-S to encrypt the AuthorizationRequest message to which the response is built and the component ciphertext containing the encrypted representation of the EtsiTs103097Data-Signed. The encryption uses a ETSI TS 103 097 [3] approved algorithm -#ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_01_BV -# To read an authorization validation response, the AA shall receive an EtsiTs103097Data-Encrypted structure, containing a EtsiTs103097Data-Signed structure, containing a EtsiTs102941Data structure, containing an AuthorizationValidationResponse structure -#ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_02_BV -# The AuthorizationValidationResponse structure contains the requestHash being the left-most 16 octets of the SHA256 digest of the EtsiTs103097Data-Signed structure received in the AuthorizationValidationRequest and a responseCode -#ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_03_BV -# If the responseCode is 0, the AuthorizationValidationResponse structure contains the component confirmedSubjectAttributes with the attributes the EA wishes to confirm, except for certIssuePermissions which is not allowed to be present -#ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_04_BV -# If the responseCode is different than 0, the AuthorizationValidationResponse structure does not contain the component confirmedSubjectAttributes -#ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_05_BV -# The component version of the EtsiTs102941Data structure is set to v1 (integer value set to 1) -#ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_06_BV - -# Config: -# LibItsPki_Pics.PICS_SIMULATE_EA_ENTITY := true # CERT_TS_A_EA shall be trusted by the PKI -# LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := CERT_TS_A_EA -# LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" # CERT_TS_A_AA & CERT_IUT_A_RCA shall be trusted by the PKI -# LibItsPki_Pics.PICS_IUT_AA_CERTIFICATE_ID := PKI AA cert -# LibItsPki_Pics.PICS_TS_CA_CERTIFICATE_ID := PKI RCA cert -# system.httpAtVPort.params := TCP(server=server=192.168.1.43) - -# Check that the EA/AA is able to decrypt the AuthorizationRequest message using the encryption private key corresponding to the recipient certificate... -#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_01_BV -# Check that the AA is able to decrypt the AuthorizationRequest message using the encryption private key corresponding to the recipient certificate... -#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_02_BV -# Check that the AA skips the AuthorizationRequest message if it is not addressed to this AA -#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_03_BI -# Check that the AA skips the AuthorizationRequest message if it unable to decrypt the encKey -#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_04_BI -# Check that the AA skips the AuthorizationRequest message if it unable to decrypt the encKey -#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_05_BI -# Check that the AA rejects the AuthorizationRequest message if it unable to verify the POP signature -#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_06_BI -# Check that the AA rejects the AuthorizationRequest message if it unable to verify the integrity of the request using hmacKey -#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_07_BI -# Send a correctly encoded AT request, but the ITS-Station is not enrolled at the EA -#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_08_BI -# Send an AT request, but the inner signer (valid EC) is not issued by the EA which is known / trusted by the AA. The AA trusts only EAs listet on the RCA-CTL -#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_09_BI -# Send an AT request, but the generation time of the CSR is in the past -#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_10_BI -# Send an AT request, but the generation time of the CSR is in the future -#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_11_BI -# Send an AT request, but the expiry date of the CSR is before the start date of the EC -#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_12_BI -# Send an AT request, but the start date of the CSR is before the start date of the EC -#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_13_BI -# Send an AT request, but the expiry date of the CSR is after the expiry date of the EC -#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_14_BI -# Send an AT request, but the start date of the CSR is after the expiring date of the EC -#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_15_BI -# Send an AT request, but the expiry date of the CSR is after now + maximum pre-loading period (considering values in C-ITS CP) -#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_16_BI - -# Check that the AA sends AuthorizationValidationRequest after receiving of the AuthorizationRequest -#ItsPki_TestCases.TC_SECPKI_AA_AUTHVAL_01_BV - -# Config: -# system.httpCaPort.params := TCP(debug=1,server=v2x-pki-test.microsec.com -# Check that the RootCA generates the Full CTL when new EA is about to be added to the Root CTL -#ItsPki_TestCases.TC_RCA_CTLGEN_01_BV -# Check that the RootCA generates the CRL signed with appropriate certificate. -#ItsPki_TestCases.TC_RCA_CRLGEN_01_BV -# Check that the TLM generates the ECTL when new RootCA is about to be added -#ItsPki_TestCases.TC_TLM_ECTLGEN_01_BV - -# Check that the issuing certificate has version 3 -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_01_BV -# Check that the issuing certificate has type explicit -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_02_BV_01 -# Check that the CA, been authorized using explicit certificate, is able to issue an implicit certificate -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_02_BV_02 -# Check that the CA, been authorized using explicit certificate, is able to issue an implicit certificate -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_02_BV_03 -# Check that the CA, been authorized using implicit certificate, does not issue an explicit certificate -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_02_BO_01 -# Check that CA issues certificate conformed to ETSI TS 103 097 [1], clause 6 -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_03_BV -# Check that the certificate issuer of certificates is referenced using digest. Check that right digest field is used to reference to the certificate -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_04_BV -# Check that the CA is able to issue the certificate with the well-formed circular region validity restriction -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_05_BV -# Check that the CA is able to issue the certificate with the well-formed rectangular region validity restriction -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_06_BV -# Check that the CA is able to issue the certificate with the well-formed polygonal region validity restriction -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_07_BV -# Check that the CA is able to issue the certificate with identified region validity restriction contains values that correspond to numeric country codes as defined by United Nations Statistics Division [5] -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_08_BV -# Check that the identified region validity restriction of the subordinate certificate is included in the identified region validity restriction of the issuing certificate -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_09_BV -# Check that the certificate signature contains ECC point of type set to either compressed_lsb_y_0, compressed_lsb_y_1 or x_coordinate_only -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_10_BV -# Check that the certificate verification key contains ECC point of type set to either compressed_lsb_y_0, compressed_lsb_y_1 or uncompressed -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_11_BV -# Check that the certificate encryption key contains ECC point of type set to either compressed_lsb_y_0, compressed_lsb_y_1 or uncompressed -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_12_BV -# Check the explicit certificate signature -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_13_BV_01 -# Check the explicit certificate signature -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_13_BV_02 -# Check that all PSID entries of the appPermissions component of the certificate are unique -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_14_BV -# Check that all PSID entries of the appPermissions component of the certificate are also contained in the certIssuePermissions component in the issuing certificate -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_15_BV -# Check that all PSID entries of the certIssuePermissions component of the certificate are unique -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_16_BV -# Check that SSP field in each entry of the appPermissions component of the AT certificate is equal to or a subset of the SSP Range in the corresponding issuing entry -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_17_BV -# Check that the validityPeriod of the subordinate certificate is inside the validityPeriod of the issuing certificate -#ItsPki_TestCases.TC_SECPKI_CA_CERTGEN_18_BV - -# Config: -# system.httpCaPort.params := TCP(debug=1,server_mode=1,server=192.168.1.43) -# Await CTL request and provides "CERT_IUT_A_RCA", "CERT_TS_A_AA", "CERT_TS_A_EA" certificates -#ItsPki_TestCases.TC_RCA_CTLGEN_xx_BV # - -[MAIN_CONTROLLER] -# The options herein control the behavior of MC. -KillTimer := 10.0 -LocalAddress := 127.0.0.1 -TCPPort := 12000 -NumHCs := 1 - diff --git a/etc/AtsPki/AtsPki.cfg b/etc/AtsPki/AtsPki.cfg new file mode 120000 index 0000000..be66d6f --- /dev/null +++ b/etc/AtsPki/AtsPki.cfg @@ -0,0 +1 @@ +AtsPki_Microsec.cfg_ \ No newline at end of file diff --git a/etc/AtsPki/AtsPki_Simu.cfg_ b/etc/AtsPki/AtsPki_Simu.cfg_ index 9f5685e..f2d88f8 100644 --- a/etc/AtsPki/AtsPki_Simu.cfg_ +++ b/etc/AtsPki/AtsPki_Simu.cfg_ @@ -206,7 +206,7 @@ system.utPort.params := "UT_PKI/UDP(dst_ip=192.168.1.39,dst_port=12345,src_port= # The IUT is capable of parsing and handling of positive EnrolmentResponse messages containing the requested EC. In case of a successful enrolment, the IUT switches to the state 'enrolled' #ItsPki_TestCases.TC_SECPKI_ITSS_ENR_RECV_02_BV # Check that the ITS-S send the Authorization HttpRequest message to the Authorization Authority (AA) to request an authorization ticket -#ItsPki_TestCases.TC_SECPKI_ITSS_AUTH_01_BV +ItsPki_TestCases.TC_SECPKI_ITSS_AUTH_01_BV # Check that the AuthorizationRequest message is encrypted and sent to only one Authorization Authority #ItsPki_TestCases.TC_SECPKI_ITSS_AUTH_02_BV # Check that the AuthorizationRequest message is encrypted using the encryptionKey found in the AA certificate referenced in recipientId @@ -226,7 +226,7 @@ system.utPort.params := "UT_PKI/UDP(dst_ip=192.168.1.39,dst_port=12345,src_port= # Check that the ITS-S send the EtsiTs103097Data to the Enrollment Authority (EA) to request a batch of authorization tickets # Check that this message is encrypted and addressed to a single recipient -ItsPki_TestCases.TC_SECPKI_ITSS_BFK_AUTH_01_BV +#ItsPki_TestCases.TC_SECPKI_ITSS_BFK_AUTH_01_BV # Check that the ButterflyAuthorizationRequestMessage is signed using the EC certificate #ItsPki_TestCases.TC_SECPKI_ITSS_BFK_AUTH_02_BV # Check that the ButterflyAuthorizationRequestMessage is signed using the X.509 EC certificate diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index ed6b273..5e5e5a7 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit ed6b27353f8865f3491c0198b54ed7b6f4da8390 +Subproject commit 5e5e5a7ea2a98c1c266e98b65fd0328c479c384e -- GitLab From 44b7441b70f040f45e313e3c58cfaf5733fae038 Mon Sep 17 00:00:00 2001 From: garciay Date: Mon, 4 Dec 2023 07:47:32 +0100 Subject: [PATCH 113/178] Enhance virtualization/docker scripts --- etc/AtsPki/AtsPki_Microsec.cfg_ | 26 ++++++++++++++-------- ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- virtualization/docker/Dockerfile | 5 ----- virtualization/docker/docker-entrypoint.sh | 3 +++ virtualization/docker/docker-run.sh | 14 ++++++++---- 6 files changed, 32 insertions(+), 20 deletions(-) diff --git a/etc/AtsPki/AtsPki_Microsec.cfg_ b/etc/AtsPki/AtsPki_Microsec.cfg_ index 761a8e5..78805c0 100644 --- a/etc/AtsPki/AtsPki_Microsec.cfg_ +++ b/etc/AtsPki/AtsPki_Microsec.cfg_ @@ -64,12 +64,19 @@ LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3 #LibItsPki_Pixits.PX_EC_ALG_FOR_EC_SIGN := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 #LibItsPki_Pixits.PX_EC_ALG_FOR_ATV := e_brainpool_p256_r1 # e_nist_p256, e_sm2_p256 or e_brainpool_p256_r1 +# Certificate duration in seconds +LibItsPki_Pixits.PX_GENERATED_CERTIFICATE_DURATION := 7*24*3600 # One week duration, in seconds + +# ITS-S message's SSPs +LibItsPki_Pixits.PX_INNER_EC_CERTFICATE_BITMAP_SSP_CAM := '01FFFC'O +LibItsPki_Pixits.PX_INNER_EC_CERTFICATE_BITMAP_SSP_DENM := '01FFFFFF'O + # Certificate areas tests LibItsSecurity_Pics.PICS_SEC_CIRCULAR_REGION := false LibItsSecurity_Pics.PICS_SEC_RECTANGULAR_REGION := true # BFK -LibItsSecurity_Pics.PICS_SEC_BFK_AUTH := true +LibItsSecurity_Pics.PICS_SEC_BFK_AUTH := false LibItsSecurity_Pics.PICS_SECPKI_ORIGINAL_BFK_KEY := true LibItsSecurity_Pics.PICS_SECPKI_UNIFIED_BFK_KEY := false LibItsSecurity_Pics.PICS_SECPKI_COMPACT_UNIFIED_BFK_KEY := false @@ -79,10 +86,10 @@ LibItsSecurity_Pics.PICS_SECPKI_COMPACT_UNIFIED_BFK_KEY := false # you want to log into the file or display on console (standard error). LogFile := "../logs/AtsPki/%e.%h-%r.%s" -FileMask := LOG_ALL | USER | DEBUG | MATCHING -ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING -#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP -#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +#FileMask := LOG_ALL | USER | DEBUG | MATCHING +#ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TIMEROP | TESTCASE +ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TIMEROP | TESTCASE LogSourceInfo := Stack LogEntityName:= Yes LogEventTypes:= Yes @@ -99,6 +106,7 @@ system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/ [EXECUTE] # Config: +# LibItsSecurity_Pics.PICS_SEC_BFK_AUTH := false # LibItsPki_Pics.PICS_SIMULATE_EA_ENTITY := false # CERT_TS_A_EA shall be trusted by the PKI # LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := PKI EA cert # LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" # CERT_TS_A_AA & CERT_IUT_A_RCA shall be trusted by the PKI @@ -166,11 +174,11 @@ system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/ #ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_RCV_02_BI # Config -# LibItsSecurity_Pics.PICS_SEC_BFK_AUTH := true -# LibItsSecurity_Pics.PICS_SECPKI_ORIGINAL_BFK_KEY := true +# LibItsSecurity_Pics.PICS_SEC_BFK_AUTH := true +# LibItsSecurity_Pics.PICS_SECPKI_ORIGINAL_BFK_KEY := true # Check that the EA sends the butterfly authorization respond message after receiving of the butterfly authorization request # Check that this message is signed with EA certificate -#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV +ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV # Check that the butterfly authorization respond message, sent by EA, contains all necessary fields #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_02_BV # Check that the EA sends butterfly certificate request message after receiving of the butterfly authorization request @@ -182,7 +190,7 @@ system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/ # Check that the butterfly certificate request message contains expanded cocoon key #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_05_BV # Check that the butterfly certificate request message sent by EA to AA contains all required elements -ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV # The EtsiTs103097Data-Encrypted is build with the component recipients containing one instance of RecipientInfo of choice pskRecipInfo, which contains the HashedId8 of the symmetric key used by the ITS-S to encrypt the AuthorizationRequest message to which the response is built and the component ciphertext containing the encrypted representation of the EtsiTs103097Data-Signed. The encryption uses a ETSI TS 103 097 [3] approved algorithm #ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_01_BV diff --git a/ttcn/AtsPki b/ttcn/AtsPki index facdaff..c148ec0 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit facdaff61bf3d3876f2accf45fef50d3ccf0ea4b +Subproject commit c148ec0980f14bc36a74b80aa6cfc83ff8b8d817 diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index f958cd9..dd305e7 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit f958cd9517897d535602a8049516f58a58ce9f3b +Subproject commit dd305e715a9dbc79a465dd8990010e56a18c602d diff --git a/virtualization/docker/Dockerfile b/virtualization/docker/Dockerfile index 57ae425..1c12d7c 100644 --- a/virtualization/docker/Dockerfile +++ b/virtualization/docker/Dockerfile @@ -36,11 +36,6 @@ ENV TTCN3_DIR=/home/etsi/frameworks/titan/titan.core/Install ENV PATH=$TTCN3_DIR/bin:$PATH \ LD_LIBRARY_PATH=$TTCN3_DIR/lib:$LD_LIBRARY_PATH -# Workaround for issue in Settings.cc -RUN \ - sed --in-place '623s/NULL/false/' ./compiler2/Setting.cc \ - && sed --in-place '639s/NULL/false/' ./compiler2/Setting.cc || exit 1 - # Set flags & Build Titan RUN \ echo "ALPINE_LINUX=yes" > Makefile.personal && \ diff --git a/virtualization/docker/docker-entrypoint.sh b/virtualization/docker/docker-entrypoint.sh index cc91317..b240b1b 100755 --- a/virtualization/docker/docker-entrypoint.sh +++ b/virtualization/docker/docker-entrypoint.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -euo pipefail +set +vx usage() { echo "No command specified. Available commands:" @@ -12,6 +13,8 @@ usage() { echo "e.g. docker-run.sh build Security # To build the AtsSecurity test suite" } +cli="${GEN_DIR}/bin/TS.ITS_r2" + commands="help,build,clean,ip,list,modulepar,ping,rebuild,build-run,run,version" if [ $# == 0 ]; then diff --git a/virtualization/docker/docker-run.sh b/virtualization/docker/docker-run.sh index 48ec51e..9a85ea6 100755 --- a/virtualization/docker/docker-run.sh +++ b/virtualization/docker/docker-run.sh @@ -3,12 +3,18 @@ set -exo pipefail cd "$(dirname ${BASH_SOURCE})" +PRJ=TS.ITS_r2 docker run --rm -it \ - -w $HOME/dev/TS.ITS_r2 \ - -e GEN_DIR=$HOME/dev/TS.ITS_r2 \ + -w $HOME/dev/$PRJ \ + -e GEN_DIR=$HOME/dev/$PRJ \ + -e ATS=$ATS \ -u "$(id -u):$(id -g)" \ - -v "${PWD}/../..:$HOME/dev/TS.ITS_r2" \ - --entrypoint $HOME/dev/TS.ITS_r2/virtualization/docker/docker-entrypoint.sh \ + -v "${PWD}/../..:$HOME/dev/$PRJ" \ + --mount type=bind,source=$HOME/var,target=/home/etsi/var,readonly \ + --entrypoint $HOME/dev/$PRJ/virtualization/docker/docker-entrypoint.sh \ alpine-its:latest "$@" + +# -p 0.0.0.0:30181:30181 \ +# -p 0.0.0.0:8000-8900:8000-8900 \ # -p 0.0.0.0:80:80 \ # -p 0.0.0.0:443:443 \ -- GitLab From 65591f7c52987065bcf6b41296086221dd06a5cf Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 12 Dec 2023 17:29:18 +0100 Subject: [PATCH 114/178] Add support of unzip BFK AT download --- Makefile | 4 +- ccsrc/Protocols/Http/http_codec_its.cc | 25 ++-- .../http_etsi_ieee1609dot2dot1_codec.cc | 112 ++++++++++++++++++ .../http_etsi_ieee1609dot2dot1_codec.hh | 23 ++++ ccsrc/Protocols/Security/module.mk | 1 + etc/AtsPki/AtsPki_Microsec.cfg_ | 14 +-- titan-test-system-framework | 2 +- .../ttcn/LibHttp_BinaryMessageBodyTypes.ttcn | 21 ++++ .../ttcn/LibHttp_BinaryTemplates.ttcn | 25 ++++ 9 files changed, 209 insertions(+), 18 deletions(-) create mode 100644 ccsrc/Protocols/Security/http_etsi_ieee1609dot2dot1_codec.cc create mode 100644 ccsrc/Protocols/Security/http_etsi_ieee1609dot2dot1_codec.hh diff --git a/Makefile b/Makefile index c02b0a2..30ac136 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ $$(foreach I, $$(includes), $$(eval all_includes += $$(if $$(filter /%, $$(I)), $$(foreach M, $$(modules), $$(eval $$(call IncludeModule, $$(if $$(filter /%, $$(M)), $$(TOPDIR)$$(M), $(1)/$$(M))))) endef -all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src /usr/include/jsoncpp /usr/include/libxml2 +all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src /usr/include/jsoncpp /usr/include/libxml2 /usr/include/libzip defines += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS) AS_USE_SSL _GNU_SOURCE libs += $(TTCN3_DIR)/lib/libttcn3-rt2-parallel.a -lstdc++fs @@ -50,7 +50,7 @@ defines += LINUX libs += -lpcap -lrt -lpthread endif -libs += -lssl -lcrypto -lxml2 -ljsoncpp +libs += -lssl -lcrypto -lxml2 -ljsoncpp -lzip $(eval $(call IncludeModule, $(TOPDIR)/ttcn/$(ATS))) diff --git a/ccsrc/Protocols/Http/http_codec_its.cc b/ccsrc/Protocols/Http/http_codec_its.cc index 0b23cb9..82b9caa 100644 --- a/ccsrc/Protocols/Http/http_codec_its.cc +++ b/ccsrc/Protocols/Http/http_codec_its.cc @@ -3,6 +3,7 @@ #include "loggers.hh" #include "http_etsi_ieee1609dot2_codec.hh" +#include "http_etsi_ieee1609dot2dot1_codec.hh" bool http_codec_its::encode_body_binary(const LibHttp__BinaryMessageBodyTypes::BinaryBody &p_binary_body, OCTETSTRING &p_encoding_buffer, const std::string &p_content_type) { loggers::get_instance().log(">>> http_codec_its::encode_body_binary"); @@ -54,18 +55,25 @@ bool http_codec_its::decode_body_binary(const OCTETSTRING &p_data, LibHttp__Bina processed = true; } }*/ - loggers::get_instance().log("http_codec_its::decode_body_binary: Call '%s'", it->first.c_str()); - http_etsi_ieee1609dot2_codec *codec = new http_etsi_ieee1609dot2_codec(); - if (p_data[0].get_octet() != 0x80) { - if (codec->decode(p_data, p_binary_body.ieee1609dot2__data()) == 0) { - processed = true; + if ((p_data[0].get_octet() != 0x50) || (p_data[1].get_octet() != 0x4B) || (p_data[2].get_octet() != 0x03) || (p_data[3].get_octet() != 0x04)) { // Not a Zip file header http_etsi_ieee1609dot2_codec *codec = new http_etsi_ieee1609dot2_codec(); + loggers::get_instance().log("http_codec_its::decode_body_binary: Call '%s'", it->first.c_str()); + http_etsi_ieee1609dot2_codec *codec = new http_etsi_ieee1609dot2_codec(); + if (p_data[0].get_octet() != 0x80) { + if (codec->decode(p_data, p_binary_body.ieee1609dot2__data()) == 0) { + processed = true; + } + } else { + if (codec->decode(p_data, p_binary_body.ieee1609dot2__certificate()) == 0) { + processed = true; + } } + delete codec; } else { - if (codec->decode(p_data, p_binary_body.ieee1609dot2__certificate()) == 0) { - processed = true; + http_etsi_ieee1609dot2dot1_codec codec; + if (codec.decode(p_data, p_binary_body.bfk__zip__file()) == 0) { + processed = true; } } - delete codec; } if (!processed) { loggers::get_instance().warning("http_codec_its::decode_body_binary: Unsupported HTTP codec, use raw field as default"); @@ -76,5 +84,6 @@ bool http_codec_its::decode_body_binary(const OCTETSTRING &p_data, LibHttp__Bina p_binary_body.raw() = p_data; } + loggers::get_instance().log_msg("<<< http_codec_its::decode_body_binary: p_binary_body=", p_binary_body); return true; } diff --git a/ccsrc/Protocols/Security/http_etsi_ieee1609dot2dot1_codec.cc b/ccsrc/Protocols/Security/http_etsi_ieee1609dot2dot1_codec.cc new file mode 100644 index 0000000..b6e81b0 --- /dev/null +++ b/ccsrc/Protocols/Security/http_etsi_ieee1609dot2dot1_codec.cc @@ -0,0 +1,112 @@ +#include + +#include "http_etsi_ieee1609dot2dot1_codec.hh" + +#include "LibHttp_BinaryMessageBodyTypes.hh" + +#include "loggers.hh" + +int http_etsi_ieee1609dot2dot1_codec::decode(const OCTETSTRING &p_data, LibHttp__BinaryMessageBodyTypes::BfkZipFile &p_bfk_zip_file, params *p_params) { + loggers::get_instance().log(">>> http_etsi_ieee1609dot2dot1_codec::decode: Butterfly AT download response corresponding to a ZIP file: Version: %02x.%02x", p_data[4].get_octet(), p_data[5].get_octet()); + loggers::get_instance().log(">>> http_etsi_ieee1609dot2dot1_codec::decode: Butterfly AT download response corresponding to a ZIP file: Compression method: %02x.%02x", p_data[8].get_octet(), p_data[9].get_octet()); + // Unzip header file + p_bfk_zip_file.identifier() = substr(p_data, 0, 4); + p_bfk_zip_file.version() = substr(p_data, 4, 2); + p_bfk_zip_file.flags() = substr(p_data, 6, 2); + p_bfk_zip_file.compression() = substr(p_data, 8, 2); + p_bfk_zip_file.content().raw() = substr(p_data, 10, p_data.lengthof() - 10 - 1); + + zip_error_t error; + zip_source_t *src = nullptr; + zip_stat_t zst; + zip_t *za = nullptr; + int ret_code = -1; + LibHttp__BinaryMessageBodyTypes::BfkZipFileContent_signed__messages signed_messages; + ::zip_error_init(&error); + if ((src = ::zip_source_buffer_create(static_cast(p_data), p_data.lengthof(), 1, &error)) == nullptr) { + loggers::get_instance().error("http_etsi_ieee1609dot2dot1_codec::decode: ::zip_source_buffer_create failure: %s", ::zip_error_strerror(&error)); + ::zip_error_fini(&error); + return -1; + } + if (::zip_source_stat(src, &zst) < 0) { + loggers::get_instance().error("http_etsi_ieee1609dot2dot1_codec::decode: ::zip_source_stat failure: %s\n", ::zip_error_strerror(::zip_source_error(src))); + goto decode_cleanup; + } + loggers::get_instance().log("http_etsi_ieee1609dot2dot1_codec::decode: zst.valid: %08x", zst.valid); + loggers::get_instance().log("http_etsi_ieee1609dot2dot1_codec::decode: zst.valid: %p", zst.name); + loggers::get_instance().log("http_etsi_ieee1609dot2dot1_codec::decode: zst.size: %ld", zst.size); + loggers::get_instance().log("http_etsi_ieee1609dot2dot1_codec: decode: mtime: %u", (unsigned int)zst.mtime); + loggers::get_instance().log("http_etsi_ieee1609dot2dot1_codec::decode: zst.comp_size: %ld", zst.comp_size); + loggers::get_instance().log("http_etsi_ieee1609dot2dot1_codec::decode: zst.crc: %04x", zst.crc); + loggers::get_instance().log("http_etsi_ieee1609dot2dot1_codec::decode: zst.encryption_method: %02x", zst.encryption_method); + + if (::zip_source_open(src) < 0) { + loggers::get_instance().error("http_etsi_ieee1609dot2dot1_codec::decode: ::zip_source_open failure: %s", ::zip_error_strerror(::zip_source_error(src))); + goto decode_cleanup; + } + + if ((za = ::zip_open_from_source(src, 0, &error)) == NULL) { + loggers::get_instance().error("http_etsi_ieee1609dot2dot1_codec::decode: Can't open zip from source: %s\n", ::zip_error_strerror(&error)); + goto decode_cleanup; + } + ::zip_error_fini(&error); + + loggers::get_instance().log("http_etsi_ieee1609dot2dot1_codec:: Number of entries: %d", ::zip_get_num_entries(za, 0)); + signed_messages.set_size(::zip_get_num_entries(za, 0)); + for (int i = 0; i < ::zip_get_num_entries(za, 0); i++) { + loggers::get_instance().log("http_etsi_ieee1609dot2dot1_codec::decode: Processing entry #%d", i); + struct zip_stat sb; + if (::zip_stat_index(za, i, 0, &sb) == 0) { + loggers::get_instance().log("http_etsi_ieee1609dot2dot1_codec::decode:=================="); + loggers::get_instance().log("http_etsi_ieee1609dot2dot1_codec::decode: Name: [%s], ", sb.name); + loggers::get_instance().log("http_etsi_ieee1609dot2dot1_codec::decode: Size: [%llu], ", sb.size); + loggers::get_instance().log("http_etsi_ieee1609dot2dot1_codec::decode: mtime: [%u]", (unsigned int)sb.mtime); + struct zip_file *zf = ::zip_fopen_index(za, i, 0); + if (zf == nullptr) { + loggers::get_instance().error("http_etsi_ieee1609dot2dot1_codec::decode: ::zip_fopen_index failure"); + goto decode_cleanup; + } + unsigned char* buffer = (unsigned char*)new unsigned char*[sb.size]; + size_t len = ::zip_fread(zf, buffer, sb.size); + if (len < 0) { + loggers::get_instance().error("http_etsi_ieee1609dot2dot1_codec::decode: ::zip_fread failure"); + delete [] buffer; + ::zip_fclose(zf); + goto decode_cleanup; + } + OCTETSTRING os; + loggers::get_instance().log_to_hexa("http_etsi_ieee1609dot2dot1_codec::decode: content:", buffer, sb.size); + if (*buffer == 0x81) { // Remove 0x81 + os = OCTETSTRING(sb.size - 1, buffer + 1); + } else { + os = OCTETSTRING(sb.size, buffer); + } + loggers::get_instance().log_to_hexa("http_etsi_ieee1609dot2dot1_codec::decode: content:", os); + Ieee1609Dot2::Ieee1609Dot2Data ieee1609Dot2Data; + if (_codec.decode(os, ieee1609Dot2Data, p_params) == -1) { + loggers::get_instance().error("http_etsi_ieee1609dot2dot1_codec::decode: Failed to decode ieee1609Dot2Data"); + delete [] buffer; + ::zip_fclose(zf); + goto decode_cleanup; + } + signed_messages[i] = ieee1609Dot2Data; + delete [] buffer; + ::zip_fclose(zf); + } + } // End of 'for' statement + loggers::get_instance().log_msg("http_etsi_ieee1609dot2dot1_codec::decode: After loop: signed_messages=", signed_messages); + //::zip_source_keep(src); + // Close the archive + //::zip_close(za); + // Close the source + p_bfk_zip_file.content().signed__messages() = signed_messages; + ret_code = 0; // Everythig goes well +decode_cleanup: + + ::zip_source_close(src); + //::zip_source_free(src); + + loggers::get_instance().log_msg("http_etsi_ieee1609dot2dot1_codec::decode: p_bfk_zip_file=", p_bfk_zip_file); + loggers::get_instance().log("<<< http_etsi_ieee1609dot2dot1_codec::decode: %d", ret_code); + return ret_code; +} diff --git a/ccsrc/Protocols/Security/http_etsi_ieee1609dot2dot1_codec.hh b/ccsrc/Protocols/Security/http_etsi_ieee1609dot2dot1_codec.hh new file mode 100644 index 0000000..1a3e008 --- /dev/null +++ b/ccsrc/Protocols/Security/http_etsi_ieee1609dot2dot1_codec.hh @@ -0,0 +1,23 @@ +#pragma once + +#include "codec_gen.hh" +#include "params.hh" + +#include "etsi_ts103097_data_codec.hh" + +#include "params.hh" + +namespace LibHttp__BinaryMessageBodyTypes { + class BfkZipFile; +} + +class http_etsi_ieee1609dot2dot1_codec : public codec_gen { + etsi_ts103097_data_codec _codec; + +public: + explicit http_etsi_ieee1609dot2dot1_codec() : codec_gen(), _codec() {}; + virtual ~http_etsi_ieee1609dot2dot1_codec(){}; + + virtual int encode(const LibHttp__BinaryMessageBodyTypes::BfkZipFile &p_bfk_zip_file, OCTETSTRING &p_data) { return -1; }; + virtual int decode(const OCTETSTRING &p_data, LibHttp__BinaryMessageBodyTypes::BfkZipFile &p_bfk_zip_file, params *p_params = NULL); +}; diff --git a/ccsrc/Protocols/Security/module.mk b/ccsrc/Protocols/Security/module.mk index 35c24c1..794e56d 100644 --- a/ccsrc/Protocols/Security/module.mk +++ b/ccsrc/Protocols/Security/module.mk @@ -24,6 +24,7 @@ sources += http_etsi_ieee1609dot2_codec.cc \ etsi_ts102941_types_authorization_validation_response.cc \ etsi_ts102941_types_enrolment_inner_request.cc \ etsi_ts102941_types_enrolment_inner_response.cc \ + http_etsi_ieee1609dot2dot1_codec.cc \ endif diff --git a/etc/AtsPki/AtsPki_Microsec.cfg_ b/etc/AtsPki/AtsPki_Microsec.cfg_ index 78805c0..25e411b 100644 --- a/etc/AtsPki/AtsPki_Microsec.cfg_ +++ b/etc/AtsPki/AtsPki_Microsec.cfg_ @@ -76,7 +76,7 @@ LibItsSecurity_Pics.PICS_SEC_CIRCULAR_REGION := false LibItsSecurity_Pics.PICS_SEC_RECTANGULAR_REGION := true # BFK -LibItsSecurity_Pics.PICS_SEC_BFK_AUTH := false +LibItsSecurity_Pics.PICS_SEC_BFK_AUTH := true LibItsSecurity_Pics.PICS_SECPKI_ORIGINAL_BFK_KEY := true LibItsSecurity_Pics.PICS_SECPKI_UNIFIED_BFK_KEY := false LibItsSecurity_Pics.PICS_SECPKI_COMPACT_UNIFIED_BFK_KEY := false @@ -86,10 +86,10 @@ LibItsSecurity_Pics.PICS_SECPKI_COMPACT_UNIFIED_BFK_KEY := false # you want to log into the file or display on console (standard error). LogFile := "../logs/AtsPki/%e.%h-%r.%s" -#FileMask := LOG_ALL | USER | DEBUG | MATCHING -#ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING -FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TIMEROP | TESTCASE -ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TIMEROP | TESTCASE +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TIMEROP | TESTCASE +#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TIMEROP | TESTCASE LogSourceInfo := Stack LogEntityName:= Yes LogEventTypes:= Yes @@ -178,7 +178,7 @@ system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/ # LibItsSecurity_Pics.PICS_SECPKI_ORIGINAL_BFK_KEY := true # Check that the EA sends the butterfly authorization respond message after receiving of the butterfly authorization request # Check that this message is signed with EA certificate -ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV # Check that the butterfly authorization respond message, sent by EA, contains all necessary fields #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_02_BV # Check that the EA sends butterfly certificate request message after receiving of the butterfly authorization request @@ -190,7 +190,7 @@ ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_01_BV # Check that the butterfly certificate request message contains expanded cocoon key #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_05_BV # Check that the butterfly certificate request message sent by EA to AA contains all required elements -#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV +ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV # The EtsiTs103097Data-Encrypted is build with the component recipients containing one instance of RecipientInfo of choice pskRecipInfo, which contains the HashedId8 of the symmetric key used by the ITS-S to encrypt the AuthorizationRequest message to which the response is built and the component ciphertext containing the encrypted representation of the EtsiTs103097Data-Signed. The encryption uses a ETSI TS 103 097 [3] approved algorithm #ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_01_BV diff --git a/titan-test-system-framework b/titan-test-system-framework index e27aaa8..eb652d4 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit e27aaa847f49a1e459f427abc3620ef7a40223ca +Subproject commit eb652d4fbd09a333332d4e2fb28aede6543d456b diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn index 3c4b3c1..366ba08 100644 --- a/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn +++ b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn @@ -15,14 +15,35 @@ module LibHttp_BinaryMessageBodyTypes { * In accordance with your TTCN-3 module LibHttp_XMLTypes, you have to change the BinaryBody typing. */ // TODO Add here your custom binary import + // LibCommon + import from LibCommon_DataStrings all; + // LibIts import from Ieee1609Dot2BaseTypes language "ASN.1:1997" all; import from Ieee1609Dot2 language "ASN.1:1997" all; + import from EtsiTs103097Module language "ASN.1:1997" all; + type union BfkZipFileContent { + record of Ieee1609Dot2Data signed_messages, + octetstring raw + } with { + variant ""; + encode "RAW" + } + + type record BfkZipFile { + Oct4 identifier ('504B0304'O), // The signature of the local file header + Oct2 version, + Oct2 flags, + Oct2 compression, + BfkZipFileContent content + } + type union BinaryBody { // TODO Add here your custom variants Ieee1609Dot2Data ieee1609dot2_data, Certificate ieee1609dot2_certificate, + BfkZipFile bfk_zip_file, octetstring raw } with { variant ""; diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_BinaryTemplates.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryTemplates.ttcn index c8de0ac..b960ef3 100644 --- a/ttcn/patch_lib_http/ttcn/LibHttp_BinaryTemplates.ttcn +++ b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryTemplates.ttcn @@ -10,6 +10,10 @@ */ module LibHttp_BinaryTemplates { + // LibCommon + import from LibCommon_BasicTypesAndValues all; + import from LibCommon_DataStrings all; + // LibHttp import from LibHttp_BinaryMessageBodyTypes all; @@ -30,6 +34,12 @@ module LibHttp_BinaryTemplates { ) := { raw := p_raw } // End of template mw_binary_body_raw + + template (present) BinaryBody mw_http_message_body_binary_bfk_zip( + template (present) BfkZipFile p_bfk_zip_file := ? + ) := { + bfk_zip_file := p_bfk_zip_file + } // End of template mw_http_message_body_binary_bfk_zip // TODO Add here your custom binary template template (value) BinaryBody m_binary_body_ieee1609dot2_data( @@ -56,4 +66,19 @@ module LibHttp_BinaryTemplates { ieee1609dot2_certificate := p_ieee1609dot2_certificate } // End of template mw_binary_body_ieee1609dot2_certificate + template (present) BfkZipFile mw_http_message_body_binary_bfk_zip_signed_messages( + template (present) Oct4 p_identifier := '504B0304'O, + template (present) Oct2 p_version := ?, + template (present) Oct2 p_flags := ?, + template (present) Oct2 p_compression := ?, + template (present) BfkZipFileContent.signed_messages p_signed_messages := ? + ) := { + identifier := p_identifier, + version := p_version, + flags := p_flags, + compression := p_compression, + content := { signed_messages := p_signed_messages } + } // End of template mw_http_message_body_binary_bfk_zip + + } // End of module LibHttp_BinaryTemplates -- GitLab From 314e759206fcba67be7e64150c22738cf1d73aac Mon Sep 17 00:00:00 2001 From: garciay Date: Wed, 13 Dec 2023 14:06:08 +0100 Subject: [PATCH 115/178] Add support of splitted ATSs (e,g, make ATS=ATsPki.Itss or make ATS=AtsPki.Pki) --- Makefile | 12 ++++++++---- etc/AtsPki/AtsPki_Commsignia.cfg_ | 6 +++--- ttcn/AtsPki | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 30ac136..a5e60fe 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,10 @@ ifeq (,$(ATS)) $(error ATS shall be defined) +else + y := $(subst ., ,$(ATS)) + ATS := $(word 1, $(y)) + SUB_ATS := $(word 2, $(y)) endif ifeq (,$(TOPDIR)) @@ -35,7 +39,7 @@ $$(foreach M, $$(modules), $$(eval $$(call IncludeModule, $$(if $$(filter /%, $ endef all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src /usr/include/jsoncpp /usr/include/libxml2 /usr/include/libzip -defines += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS) AS_USE_SSL _GNU_SOURCE +defines += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS) $(SUB_ATS) AS_USE_SSL _GNU_SOURCE libs += $(TTCN3_DIR)/lib/libttcn3-rt2-parallel.a -lstdc++fs ifeq (Windows_NT,$(OS)) @@ -89,7 +93,7 @@ cc_objects := $(patsubst %.cc, $(outdir)/%.o, $(cc_sources)) .PHONY: all FORCE echo -all: $(bindir) $(outdir) $(bindir)/$(ATS)$(EXE) +all: $(bindir) $(outdir) $(bindir)/$(ATS)$(SUB_ATS)$(EXE) echo_sources: @echo -e "$(addsuffix \n,$(all_sources))" @@ -103,7 +107,7 @@ echo: echo_sources @echo -e "defines: $(addsuffix \n, $(defines))" clean: - rm -f $(outdir)/$(ATS)$(EXE) $(gen_objects) $(gen_sources) $(gen_headers) $(cc_objects) $(outdir)/.generate $(outdir)/../libItsAsn.so + rm -f $(outdir)/$(ATS)$(SUB_ATS)$(EXE) $(gen_objects) $(gen_sources) $(gen_headers) $(cc_objects) $(outdir)/.generate $(outdir)/../libItsAsn.so # rm -f $(outdir)/asn1/*.so $(outdir)/asn1/*.o $(outdir)/asn1/*.c $(outdir)/asn1/*.h $(outdir)/asn1/Makefile.am.libasncodec regen: force_regen $(outdir)/.generate @@ -125,7 +129,7 @@ t3d: all $(outdir) $(outdir)/asn1 $(bindir): mkdir -p $@ -$(bindir)/$(ATS)$(EXE): $(outdir)/asn1/libItsAsn.a $(gen_objects) $(cc_objects) +$(bindir)/$(ATS)$(SUB_ATS)$(EXE): $(outdir)/asn1/libItsAsn.a $(gen_objects) $(cc_objects) g++ -g -O0 -std=c++17 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(outdir)/asn1/libItsAsn.a $(libs) $(gen_objects) :%.o :%.cc diff --git a/etc/AtsPki/AtsPki_Commsignia.cfg_ b/etc/AtsPki/AtsPki_Commsignia.cfg_ index dd9b73a..11f810f 100644 --- a/etc/AtsPki/AtsPki_Commsignia.cfg_ +++ b/etc/AtsPki/AtsPki_Commsignia.cfg_ @@ -156,9 +156,9 @@ ItsPki_TestCases.TC_SECPKI_ITSS_ENR_01_BV # If the enrolment request of the IUT is an initial enrolment request, the itsId (contained in the InnerECRequest) shall be set to the canonical identifier, the signer (contained in the outer EtsiTs1030971Data-Signed) shall be set to self and the outer signature shall be computed using the canonical private key. #ItsPki_TestCases.TC_SECPKI_ITSS_ENR_02_BV # In presence of a valid EC, the enrolment request of the IUT is a rekeying enrolment request with the itsId (contained in the InnerECRequest) and the SignerIdentifier (contained in the outer EtsiTs1030971Data-Signed) both declared as digest containing the HashedId8 of the EC and the outer signature computed using the current valid EC private key corresponding to the verification public key. -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_03_BV -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_06_BV -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_07_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_03_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_06_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_07_BV [MAIN_CONTROLLER] diff --git a/ttcn/AtsPki b/ttcn/AtsPki index c148ec0..4dee868 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit c148ec0980f14bc36a74b80aa6cfc83ff8b8d817 +Subproject commit 4dee8682b2427295ecc99ff2de9113df1d98a7b6 -- GitLab From cd1348708d71a48c92cb4a13fe4bf2bd7122d8b8 Mon Sep 17 00:00:00 2001 From: garciay Date: Wed, 13 Dec 2023 14:47:09 +0100 Subject: [PATCH 116/178] Update missing files in ccsrc/Protocols/Security/module.mk --- ccsrc/Protocols/Security/module.mk | 1 + ttcn/AtsPki | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ccsrc/Protocols/Security/module.mk b/ccsrc/Protocols/Security/module.mk index 794e56d..75a47e2 100644 --- a/ccsrc/Protocols/Security/module.mk +++ b/ccsrc/Protocols/Security/module.mk @@ -45,6 +45,7 @@ sources += http_etsi_ieee1609dot2_codec.cc \ etsi_ts102941_types_authorization_validation_response.cc \ etsi_ts102941_types_enrolment_inner_request.cc \ etsi_ts102941_types_enrolment_inner_response.cc \ + http_etsi_ieee1609dot2dot1_codec.cc \ endif diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 4dee868..893832d 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 4dee8682b2427295ecc99ff2de9113df1d98a7b6 +Subproject commit 893832dda9f9ed77f3e7f3b3ad29f02ca7638cc6 -- GitLab From 3625e5813bb7b047ae854304f692a9cb78f1af1b Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Wed, 13 Dec 2023 15:54:29 +0100 Subject: [PATCH 117/178] fix override command line ATS variable --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a5e60fe..ef5a562 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,8 @@ ifeq (,$(ATS)) $(error ATS shall be defined) else y := $(subst ., ,$(ATS)) - ATS := $(word 1, $(y)) - SUB_ATS := $(word 2, $(y)) + override ATS := $(word 1, $(y)) + override SUB_ATS := $(word 2, $(y)) endif ifeq (,$(TOPDIR)) -- GitLab From 7e7a7ff3abff6c7529cc9b203804194ebd83363f Mon Sep 17 00:00:00 2001 From: garciay Date: Sun, 17 Dec 2023 14:52:35 +0100 Subject: [PATCH 118/178] Bug fixed in switch scripts --- switch_its_r1.sh | 2 +- switch_its_r2.sh | 2 +- ttcn/AtsPki | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/switch_its_r1.sh b/switch_its_r1.sh index b9be4b1..edaa775 100755 --- a/switch_its_r1.sh +++ b/switch_its_r1.sh @@ -33,7 +33,7 @@ do done cd $BASE_PATH -if [ ! -f ./titan-test-system-framework ] +if [ ! -d ./titan-test-system-framework ] then git clone --recurse-submodules --single-branch --branch devel https://labs.etsi.org/rep/cti-tools/titan-test-system-framework.git cd ./titan-test-system-framework diff --git a/switch_its_r2.sh b/switch_its_r2.sh index 879a068..4a7c63c 100755 --- a/switch_its_r2.sh +++ b/switch_its_r2.sh @@ -48,7 +48,7 @@ do done cd $BASE_PATH -if [ ! -f ./titan-test-system-framework ] +if [ ! -d ./titan-test-system-framework ] then git clone --recurse-submodules --single-branch --branch devel https://labs.etsi.org/rep/cti-tools/titan-test-system-framework.git cd ./titan-test-system-framework diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 893832d..3643851 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 893832dda9f9ed77f3e7f3b3ad29f02ca7638cc6 +Subproject commit 364385100d798b855e7572c09a98ab8e91b4afd0 -- GitLab From 747ad2370e3ca925d5725cf6fbe9020fdb345d98 Mon Sep 17 00:00:00 2001 From: garciay Date: Fri, 9 Feb 2024 13:44:46 +0100 Subject: [PATCH 119/178] Enhance TC_SECPKI_EA_BFK_AUTH_06_BV --- ccsrc/Protocols/Security/module.mk | 1 + etc/AtsCAM/AtsCAM.cfg | 42 +++++++++++--------------- etc/AtsCAM/AtsCAM_Yogoko.cf_ | 8 ++--- etc/AtsMBR/AtsMBR.cfg | 10 +++---- etc/AtsPki/AtsPki_Simu.cfg_ | 48 +++++++++++++++++++----------- 5 files changed, 58 insertions(+), 51 deletions(-) diff --git a/ccsrc/Protocols/Security/module.mk b/ccsrc/Protocols/Security/module.mk index 75a47e2..12a5cde 100644 --- a/ccsrc/Protocols/Security/module.mk +++ b/ccsrc/Protocols/Security/module.mk @@ -30,6 +30,7 @@ endif ifeq (AtsMBR, $(ATS)) sources += http_etsi_ieee1609dot2_codec.cc \ + http_etsi_ieee1609dot2dot1_codec.cc \ endif diff --git a/etc/AtsCAM/AtsCAM.cfg b/etc/AtsCAM/AtsCAM.cfg index 75f66ca..57b169f 100644 --- a/etc/AtsCAM/AtsCAM.cfg +++ b/etc/AtsCAM/AtsCAM.cfg @@ -13,11 +13,12 @@ LibItsCam_Pics.PICS_IS_IUT_SECURED := true [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). + LogFile := "../logs/AtsCAM/%e.%h-%r.%s" FileMask := LOG_ALL | USER | DEBUG | MATCHING ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING -#FileMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | TIMEROP | VERDICTOP -#ConsoleMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | TIMEROP | VERDICTOP +#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP LogSourceInfo := Stack LogEntityName:= Yes LogEventTypes:= Yes @@ -39,7 +40,7 @@ LogEventTypes:= Yes # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer -# ll_address : GeoNetworking address of the Test System for beaconing. To be align with CAM +# ll_address : GeoNetworking address of the Test System # latitude : Latitude of the Test System # longitude : Longitude of the Test System # beaconing : Set to 1 if GnLayer shall start beaconing @@ -52,8 +53,11 @@ LogEventTypes:= Yes # hash : Hash algorithm to be used when secured mode is set # Authorized values are SHA-256 or SHA-384 # Default: SHA-256 +# signature : Signature algorithm to be used when secured mode is set +# Authorized values are NISTP-256, NISTP-384, BP-256 and BP-384 +# Default: NISTP-256 # cypher : Cyphering algorithm to be used when secured mode is set -# Authorized values are NISTP-256 and BP-256 +# Authorized values are NISTP-256, BP-256 and BP-384 # Default: NISTP-256 # Ethernet layer # mac_src :Source MAC address @@ -88,28 +92,21 @@ LogEventTypes:= Yes # save_mode : Set to 1 to save sent packet, 0 otherwise # Cygwin -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,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.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp2s0,filter=and ether proto 0x8947)" # Linux over UDP -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.43,src_port=4041,dst_port=9091)" - -# PC5 + UU/Raw -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=515340240,longitude=139274330,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates_iut)/LTE(mac_src=8c554ac1eee1,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.43,dst_port=4041,src_port=9091)" -# PC5 + Uu/MQTT -# Raw UDP -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=udp,debug=1,server=192.168.1.39,port=1883)" -# MQTT over TCP -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=192.168.1.39,port=1883)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=9091)" +system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=tun0,filter=and ether proto 0x8947)" # CAM UpperTester port based on UDP -system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" +#system.utPort.params := "UT_CAM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12346)" #system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.146.26)" -#system.utPort.params := "UT_CAM/UDP(dst_ip=172.16.35.1)" +system.utPort.params := "UT_CAM/UDP(dst_ip=10.8.0.6)" [EXECUTE] -#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 -ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 +ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_05 @@ -155,13 +152,8 @@ ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_06 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_07 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_08 -#ItsCam_TestCases.TC_CAM_MSP_BV_01 -#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_01 -#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_02 -#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_03 -#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_01 #ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 -#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_03 +#ItsCam_TestCases.TC_CAM_MSP_BV_01 [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/etc/AtsCAM/AtsCAM_Yogoko.cf_ b/etc/AtsCAM/AtsCAM_Yogoko.cf_ index 3ac3868..57b169f 100644 --- a/etc/AtsCAM/AtsCAM_Yogoko.cf_ +++ b/etc/AtsCAM/AtsCAM_Yogoko.cf_ @@ -97,18 +97,18 @@ LogEventTypes:= Yes #system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp2s0,filter=and ether proto 0x8947)" # Linux over UDP #system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=9091)" -system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=tap0,filter=and ether proto 0x8947)" +system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=tun0,filter=and ether proto 0x8947)" # CAM UpperTester port based on UDP #system.utPort.params := "UT_CAM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12346)" #system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.146.26)" -system.utPort.params := "UT_CAM/UDP(dst_ip=172.16.35.1)" +system.utPort.params := "UT_CAM/UDP(dst_ip=10.8.0.6)" [EXECUTE] -#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 +ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 -ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_05 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_01 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_02 diff --git a/etc/AtsMBR/AtsMBR.cfg b/etc/AtsMBR/AtsMBR.cfg index 05ebbd0..99c2569 100644 --- a/etc/AtsMBR/AtsMBR.cfg +++ b/etc/AtsMBR/AtsMBR.cfg @@ -135,22 +135,22 @@ 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=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.39,src_port=4041,dst_port=9091)" # For all test where IUT is not MA, uncomment this port -system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.39)" +#system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.39)" +system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=10.8.0.1)" # For TC_MRS_MA_SEC_BO_01 & TC_MRS_MA_SEC_BO_01 Use this port and comment the one above #system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=192.168.1.39,port=18000)" -system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.39,dst_port=12345,src_port=12346)" +#system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.39,dst_port=12345,src_port=12346)" +system.utMbrPort.params := "UT_MBR/UDP(dst_ip=10.8.0.2,dst_port=12345,src_port=12346)" [EXECUTE] # Check that the IUT generates an encrypted MBR message -#ItsMbr_TestCases.TC_MRS_ITSS_SEC_BV_01 # Check that the IUT discards an encrypted MBR message when recipientId does not contain MA certificate # Set local_port to 18000 for AtsRSUsSimulator @@ -181,7 +181,7 @@ system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.39,dst_port=12345,src_po #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 +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS1_CAM_BV_01 # Check that the IUT generates an invalid speed value in reverse driving observation on a CAM in the MR message when requested (Class 1) - obs-Speed-ValueTooLarge-DriveDirectionReverse #ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS1_CAM_BV_02 diff --git a/etc/AtsPki/AtsPki_Simu.cfg_ b/etc/AtsPki/AtsPki_Simu.cfg_ index f2d88f8..1861195 100644 --- a/etc/AtsPki/AtsPki_Simu.cfg_ +++ b/etc/AtsPki/AtsPki_Simu.cfg_ @@ -11,13 +11,20 @@ LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB +LibItsBtp_Pixits.PX_DESTINATION_PORT := 2001 +LibItsBtp_Pixits.PX_DESTINATION_PORT_INFO := 2001 + # Enable Security support LibItsGeoNetworking_Pics.PICS_GN_SECURITY := true +LibItsGeoNetworking_Pixits.PX_NEIGHBOUR_DISCOVERY_DELAY := 2.0 + # Root path to access certificate stored in files, identified by certficate ID LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "../data/certificates" + # Configuration sub-directory to access certificate stored in files LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" +#LibItsSecurity_Pics.PICS_SEC_FIXED_KEYS := true # Seed LibItsSecurity_Pixits.PX_BFK_TEST_VECTORS := false # Use this certificate if the RSU simulator act as IUT @@ -26,7 +33,7 @@ LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_IUT_A_AT" LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" LibHttp_Pics.PICS_HEADER_CTL_CONTENT_TYPE := "application/x-its-crl" -LibHttp_Pics.PICS_HEADER_HOST := "192.168.1.43" +LibHttp_Pics.PICS_HEADER_HOST := "192.168.1.21" LibItsPki_Pics.PICS_HTTP_POST_URI_EC := "/ea/enrolment" LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/aa/authorization" @@ -37,13 +44,6 @@ LibItsPki_Pics.PICS_IUT_ITS_S_ROLE := true LibItsPki_Pics.PICS_SECPKI_ENROLMENT := true LibItsPki_Pics.PICS_SECPKI_ENROLLMENT_X509 := false -LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := "CERT_TS_A_EA" -LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" - -LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3031'O # Nist-P256 -#LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3032'O # Brainpool-P256 r1 -#LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3033'O # Brainpool-P384 r1 - # Technical keys # NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) # Private key @@ -52,15 +52,35 @@ LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D546573745379 #048038F5490CD5A58FF5465D3B577EE830047336AC5DAC07036B798AAECAE7273FD91C4F60995494EA949E64EE0E3D768DBDEB8AFC345627211E3FC4DD8FD39EE5 LibItsPki_Pics.PICS_ITS_S_SIGN_NITSP256_PRIVATE_KEY := 'FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34'O; LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3b577ee830047336ac5dac07036b798aaecae7273f'O; +#LibItsPki_Pics.PICS_ITS_S_ENC_NITSP256_PRIVATE_KEY := 'EDEBEADCAA9514CD4B30256126FB7DF958B911C6EB58CCF702983C3DCD3DECBD'O; +#LibItsPki_Pics.PICS_ITS_S_ENC_NISTP256_PUBLIC_KEY := '023A4ADDCDD5EE66DAB2116B0C3AB47CCEDAE92CD9ACE98A84B10EB63A9DCA798C'O; +#LibItsPki_Pics.PICS_ITS_S_ENC_BRAINPOOLP256r1_PRIVATE_KEY := '9F155D40B6C920BA45D8027093C8ADADAF3AA6F9F71F0CC0F8279FF0146A8A48'O; +#LibItsPki_Pics.PICS_ITS_S_ENC_BRAINPOOLP256r1_PUBLIC_KEY := '038602F468BD334EA4D2BA416295E204D58BD1F42C85FB9BE57237C74544F6A69A'O; +#LibItsPki_Pics.PICS_ITS_S_SIGN_BRAINPOOLP256r1_PRIVATE_KEY := '6D585B716D06F75EC2B8A8ADEBFCE6ED35B0640C2AFBFF25FE48FC81A6732D4F'O; +#LibItsPki_Pics.PICS_ITS_S_SIGN_BRAINPOOLP256r1_PUBLIC_KEY := '02A92BA3B770B040B8D958D5BD2CC9B537212D6963F50EA3E4784FEFA5D0454C12'O; +#LibItsPki_Pics.PICS_ITS_S_ENC_BRAINPOOLP384r1_PRIVATE_KEY := '6B4B4392511B252C904801466F5DA0A7F28E038E6656800CBB0CDCB3D32F862CA4D59CBDC1A19E98E9191582AF1DB3D7'O; +#LibItsPki_Pics.PICS_ITS_S_SIGN_BRAINPOOLP384r1_PRIVATE_KEY := '3CD977195A579787C84D5900F4CB6341E0C3D2750B140C5380E6F03CE3FBA0022F7541DEABDCED4790D313ED8F56ACA8'O; +#LibItsPki_Pics.PICS_ITS_S_SIGN_BRAINPOOLP384r1_PUBLIC_KEY := '0243FF5C96984C2C3F5FD5C5F6551C90F5FAEE1E5E8301763E4AF1E9D627F3474E554B82EE98EC4B49808DFF61B35F8313'O; + +LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3031'O # Nist-P256 +#LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3032'O # Brainpool-P256 r1 +#LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3033'O # Brainpool-P384 r1 + +LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := "CERT_TS_A_EA" +LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" # Set to true if the IUT support CertificateId shall be set to the choice name, false if it shall be omitted #LibItsPki_Pics.PICS_EC_SUBJECT_ATTRIBUT_ID := false # requestedSubjectAttributes.id is omitted # Set to true if the IUT support geographical region #LibItsPki_Pics.PICS_EC_SUBJECT_ATTRIBUT_REGION := false # requestedSubjectAttributes.region is omitted -#LibItsPki_Pics.PICS_PKI_AUTH_POP := false # Do not use Signed for PoP in Authorization requet - # Required for SECPKI_AA_AUTH_RCV_02_BV -#LibItsPki_Pics.PICS_SECPKI_REENROLMENT := false # Check in logs the pattern '==> EC ' to find the required information for re-enrolment +ItsPki_Pixits.PX_TRIGGER_EC_BEFORE_AT := false; + +ItsPki_Pixits.PX_CERT_EXPIRATION_DELAY := 15.0 + +#LibItsPki_Pics.PICS_PKI_AUTH_POP := false # Do not use Signed for PoP in Authorization requet + # Required for SECPKI_AA_AUTH_RCV_02_BV +#LibItsPki_Pics.PICS_SECPKI_REENROLMENT := true # Check in logs the pattern '==> EC ' to find the required information for re-enrolment #LibItsPki_Pixits.PX_INCLUDE_ENCRYPTION_KEYS := false # No encryption key in Authorization request @@ -75,12 +95,6 @@ LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3 LibItsSecurity_Pics.PICS_SEC_CIRCULAR_REGION := false LibItsSecurity_Pics.PICS_SEC_RECTANGULAR_REGION := true -# BFK -LibItsSecurity_Pics.PICS_SEC_BFK_AUTH := true -LibItsSecurity_Pics.PICS_SECPKI_ORIGINAL_BFK_KEY := true -LibItsSecurity_Pics.PICS_SECPKI_UNIFIED_BFK_KEY := false -LibItsSecurity_Pics.PICS_SECPKI_COMPACT_UNIFIED_BFK_KEY := false - [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). -- GitLab From f4efe9cf7afc0039690d04b74dcadf009554a194 Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 15 Feb 2024 09:08:20 +0100 Subject: [PATCH 120/178] Add decrypt functions with uncompressed public key --- ccsrc/EncDec/LibItsCam_Encdec.cc | 10 +++ ccsrc/EncDec/LibItsDenm_Encdec.cc | 10 +++ ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc | 11 +++ ccsrc/EncDec/LibItsMbr_Encdec.cc | 5 ++ ccsrc/EncDec/LibItsPki_Encdec.cc | 65 ++++++++++++++++ ccsrc/EncDec/LibItsSecurity_Encdec.cc | 20 +++++ ccsrc/Externals/LibItsSecurity_externals.cc | 86 +++++++++++++++++++++ etc/AtsPki/AtsPki_Microsec.cfg_ | 8 +- ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- 10 files changed, 216 insertions(+), 3 deletions(-) diff --git a/ccsrc/EncDec/LibItsCam_Encdec.cc b/ccsrc/EncDec/LibItsCam_Encdec.cc index caeaf62..d0ee791 100644 --- a/ccsrc/EncDec/LibItsCam_Encdec.cc +++ b/ccsrc/EncDec/LibItsCam_Encdec.cc @@ -33,6 +33,11 @@ namespace LibItsCam__EncdecDeclarations { INTEGER fx__dec__CamReq(BITSTRING &b, LibItsCam__TypesAndValues::CamReq &p) { loggers::get_instance().log(">>> fx__dec__CamReq"); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + cam_codec codec; CAM__PDU__Descriptions::CAM cam; OCTETSTRING is = bit2oct(b); @@ -49,6 +54,11 @@ namespace LibItsCam__EncdecDeclarations { INTEGER fx__dec__CamInd(BITSTRING &b, LibItsCam__TypesAndValues::CamInd &p_camInd) { loggers::get_instance().log(">>> fx__dec__CamInd"); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + cam_codec codec; CAM__PDU__Descriptions::CAM cam; OCTETSTRING is = bit2oct(b); diff --git a/ccsrc/EncDec/LibItsDenm_Encdec.cc b/ccsrc/EncDec/LibItsDenm_Encdec.cc index 1c159ca..2fa70b9 100644 --- a/ccsrc/EncDec/LibItsDenm_Encdec.cc +++ b/ccsrc/EncDec/LibItsDenm_Encdec.cc @@ -33,6 +33,11 @@ namespace LibItsDenm__EncdecDeclarations { INTEGER fx__dec__DenmReq(BITSTRING &b, LibItsDenm__TypesAndValues::DenmReq &p) { loggers::get_instance().log(">>> fx__dec__DenmReq"); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + denm_codec codec; DENM__PDU__Descriptions::DENM denm; OCTETSTRING is = bit2oct(b); @@ -49,6 +54,11 @@ namespace LibItsDenm__EncdecDeclarations { INTEGER fx__dec__DenmInd(BITSTRING &b, LibItsDenm__TypesAndValues::DenmInd &p_denmInd) { loggers::get_instance().log(">>> fx__dec__DenmInd"); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + denm_codec codec; DENM__PDU__Descriptions::DENM denm; OCTETSTRING is = bit2oct(b); diff --git a/ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc b/ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc index 322feac..47d9403 100644 --- a/ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc +++ b/ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc @@ -57,6 +57,12 @@ namespace LibItsGeoNetworking__EncdecDeclarations { INTEGER fx__dec__GeoNetworkingReq(BITSTRING &b, LibItsGeoNetworking__TypesAndValues::GeoNetworkingReq &p) { loggers::get_instance().log(">>> fx__dec__GeoNetworkingReq"); + + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + geonetworking_codec codec; LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu pdu; OCTETSTRING is = bit2oct(b); @@ -118,6 +124,11 @@ namespace LibItsGeoNetworking__EncdecDeclarations { INTEGER fx__dec__GeoNetworkingInd(BITSTRING &b, LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd &p_geoNetworkingInd) { loggers::get_instance().log(">>> fx__dec__GeoNetworkingInd"); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + float duration; std::string tag("fx__dec__GeoNetworkingInd"); loggers::get_instance().set_start_time(tag); diff --git a/ccsrc/EncDec/LibItsMbr_Encdec.cc b/ccsrc/EncDec/LibItsMbr_Encdec.cc index 19dcd57..8e4de1c 100644 --- a/ccsrc/EncDec/LibItsMbr_Encdec.cc +++ b/ccsrc/EncDec/LibItsMbr_Encdec.cc @@ -22,6 +22,11 @@ namespace LibItsMbr__EncdecDeclarations { INTEGER fx__dec__EtsiTs103759Data(BITSTRING &b, EtsiTs103759Core::EtsiTs103759Data &p_etsi_ts_103759_data) { loggers::get_instance().log_msg(">>> fx__dec__EtsiTs103759Data: ", b); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + etsi_ts103759_data_codec codec; OCTETSTRING is = bit2oct(b); if (codec.decode(is, p_etsi_ts_103759_data) == -1) { diff --git a/ccsrc/EncDec/LibItsPki_Encdec.cc b/ccsrc/EncDec/LibItsPki_Encdec.cc index cc38031..7117846 100644 --- a/ccsrc/EncDec/LibItsPki_Encdec.cc +++ b/ccsrc/EncDec/LibItsPki_Encdec.cc @@ -36,6 +36,11 @@ namespace LibItsPki__EncdecDeclarations { INTEGER fx__dec__EtsiTs102941Data(BITSTRING &b, EtsiTs102941MessagesCa::EtsiTs102941Data &p_etsi_ts_102941_data) { loggers::get_instance().log_msg(">>> fx__dec__EtsiTs102941Data: ", b); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + etsi_ts102941_data_codec codec; OCTETSTRING is = bit2oct(b); if (codec.decode(is, p_etsi_ts_102941_data) == -1) { @@ -62,6 +67,11 @@ namespace LibItsPki__EncdecDeclarations { INTEGER fx__dec__EtsiTs102941DataContent(BITSTRING &b, EtsiTs102941MessagesCa::EtsiTs102941DataContent &p_etsi_ts_102941_data_content) { loggers::get_instance().log_msg(">>> fx__dec__EtsiTs102941DataContent: ", b); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + etsi_ts102941_data_content_codec codec; OCTETSTRING is = bit2oct(b); if (codec.decode(is, p_etsi_ts_102941_data_content) == -1) { @@ -88,6 +98,11 @@ namespace LibItsPki__EncdecDeclarations { INTEGER fx__dec__InnerEcRequest(BITSTRING &b, EtsiTs102941TypesEnrolment::InnerEcRequest &p_inner_request) { loggers::get_instance().log_msg(">>> fx__dec__InnerEcRequest: ", b); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + etsi_ts102941_types_enrolment_inner_request codec; OCTETSTRING is = bit2oct(b); if (codec.decode(is, p_inner_request) == -1) { @@ -115,6 +130,11 @@ namespace LibItsPki__EncdecDeclarations { INTEGER fx__dec__InnerEcResponse(BITSTRING &b, EtsiTs102941TypesEnrolment::InnerEcResponse &p_inner_response) { loggers::get_instance().log_msg(">>> fx__dec__InnerEcResponse: ", b); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + etsi_ts102941_types_enrolment_inner_response codec; OCTETSTRING is = bit2oct(b); if (codec.decode(is, p_inner_response) == -1) { @@ -142,6 +162,11 @@ namespace LibItsPki__EncdecDeclarations { INTEGER fx__dec__InnerAtRequest(BITSTRING &b, EtsiTs102941TypesAuthorization::InnerAtRequest &p_inner_request) { loggers::get_instance().log_msg(">>> fx__dec__InnerAtRequest: ", b); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + etsi_ts102941_types_authorization_inner_request codec; OCTETSTRING is = bit2oct(b); if (codec.decode(is, p_inner_request) == -1) { @@ -169,6 +194,11 @@ namespace LibItsPki__EncdecDeclarations { INTEGER fx__dec__InnerAtResponse(BITSTRING &b, EtsiTs102941TypesAuthorization::InnerAtResponse &p_inner_response) { loggers::get_instance().log_msg(">>> fx__dec__InnerAtResponse: ", b); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + etsi_ts102941_types_authorization_inner_response codec; OCTETSTRING is = bit2oct(b); if (codec.decode(is, p_inner_response) == -1) { @@ -196,6 +226,11 @@ namespace LibItsPki__EncdecDeclarations { INTEGER fx__dec__SharedAtRequest(BITSTRING &b, EtsiTs102941TypesAuthorization::SharedAtRequest &p_shared_at) { loggers::get_instance().log_msg(">>> fx__dec__SharedAtRequest: ", b); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + etsi_ts102941_types_authorization_shared_at_request codec; OCTETSTRING is = bit2oct(b); if (codec.decode(is, p_shared_at) == -1) { @@ -223,6 +258,11 @@ namespace LibItsPki__EncdecDeclarations { INTEGER fx__dec__AuthorizationValidationRequest(BITSTRING &b, EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationRequest &p_shared_at) { loggers::get_instance().log_msg(">>> fx__dec__AuthorizationValidationRequest: ", b); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + etsi_ts102941_types_authorization_validation_request codec; OCTETSTRING is = bit2oct(b); if (codec.decode(is, p_shared_at) == -1) { @@ -250,6 +290,11 @@ namespace LibItsPki__EncdecDeclarations { INTEGER fx__dec__AuthorizationValidationResponse(BITSTRING &b, EtsiTs102941TypesAuthorizationValidation::AuthorizationValidationResponse &p_shared_at) { loggers::get_instance().log_msg(">>> fx__dec__AuthorizationValidationResponse: ", b); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + etsi_ts102941_types_authorization_validation_response codec; OCTETSTRING is = bit2oct(b); if (codec.decode(is, p_shared_at) == -1) { @@ -304,6 +349,11 @@ namespace LibItsPki__EncdecDeclarations { INTEGER fx__dec__PublicKeys(BITSTRING &b, EtsiTs102941BaseTypes::PublicKeys &p_public_keys) { loggers::get_instance().log_msg(">>> fx__dec__PublicKeys: ", b); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + etsi_ts102941_base_types_public_keys codec; OCTETSTRING is = bit2oct(b); if (codec.decode(is, p_public_keys) == -1) { @@ -331,6 +381,11 @@ namespace LibItsPki__EncdecDeclarations { INTEGER fx__dec__PublicVerificationKey(BITSTRING &b, Ieee1609Dot2BaseTypes::PublicVerificationKey &p_public_verification_key) { loggers::get_instance().log_msg(">>> fx__dec__PublicVerificationKey: ", b); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + ieee_1609dot2_base_types_public_verification_key codec; OCTETSTRING is = bit2oct(b); if (codec.decode(is, p_public_verification_key) == -1) { @@ -358,6 +413,11 @@ namespace LibItsPki__EncdecDeclarations { INTEGER fx__dec__PublicEncryptionKey(BITSTRING &b, Ieee1609Dot2BaseTypes::PublicEncryptionKey &p_public_encryption_key) { loggers::get_instance().log_msg(">>> fx__dec__PublicEncryptionKey: ", b); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + ieee_1609dot2_base_types_public_encryption_key codec; OCTETSTRING is = bit2oct(b); if (codec.decode(is, p_public_encryption_key) == -1) { @@ -385,6 +445,11 @@ namespace LibItsPki__EncdecDeclarations { INTEGER fx__dec__CtlFormat(BITSTRING &b, EtsiTs102941TrustLists::CtlFormat &p_ctl_format) { loggers::get_instance().log_msg(">>> fx__dec__CtlFormat: ", b); + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + etsi_ts102941_trust_lists_ctl_format codec; OCTETSTRING is = bit2oct(b); if (codec.decode(is, p_ctl_format) == -1) { diff --git a/ccsrc/EncDec/LibItsSecurity_Encdec.cc b/ccsrc/EncDec/LibItsSecurity_Encdec.cc index ac6219d..4097ff3 100644 --- a/ccsrc/EncDec/LibItsSecurity_Encdec.cc +++ b/ccsrc/EncDec/LibItsSecurity_Encdec.cc @@ -65,6 +65,11 @@ namespace LibItsSecurity__EncdecDeclarations { INTEGER fx__dec__Ieee1609Dot2Data(BITSTRING &p__data, Ieee1609Dot2::Ieee1609Dot2Data &p__ieee1609Dot2Data) { loggers::get_instance().log_msg(">>> fx__dec__Ieee1609Dot2Data: ", p__data); + // Sanity check + if (p__data.lengthof() == 0) { + return -1; + } + etsi_ts103097_data_codec codec; OCTETSTRING is = bit2oct(p__data); if (codec.decode(is, p__ieee1609Dot2Data) == -1) { @@ -92,6 +97,11 @@ namespace LibItsSecurity__EncdecDeclarations { INTEGER fx__dec__Ieee1609Dot2ToBeSignedData(BITSTRING &p__data, Ieee1609Dot2::ToBeSignedData &p__toBeSignedData) { loggers::get_instance().log_msg(">>> fx__dec__Ieee1609Dot2ToBeSignedData: ", p__data); + // Sanity check + if (p__data.lengthof() == 0) { + return -1; + } + etsi_ts103097_tobesigned_data_codec codec; OCTETSTRING is = bit2oct(p__data); if (codec.decode(is, p__toBeSignedData) == -1) { @@ -114,6 +124,11 @@ namespace LibItsSecurity__EncdecDeclarations { INTEGER fx__dec__SspCAM(BITSTRING &p__data, LibItsSecurity__TypesAndValues::SspCAM &p__ssp) { loggers::get_instance().log_msg(">>> fx__dec__SspCAM: ", p__data); + // Sanity check + if (p__data.lengthof() == 0) { + return -1; + } + TTCN_Buffer decoding_buffer(bit2oct(p__data)); p__ssp.decode(*p__ssp.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW); return 0; @@ -130,6 +145,11 @@ namespace LibItsSecurity__EncdecDeclarations { INTEGER fx__dec__SspDENM(BITSTRING &p__data, LibItsSecurity__TypesAndValues::SspDENM &p__ssp) { loggers::get_instance().log_msg(">>> fx__dec__SspDENM: ", p__data); + // Sanity check + if (p__data.lengthof() == 0) { + return -1; + } + TTCN_Buffer decoding_buffer(bit2oct(p__data)); p__ssp.decode(*p__ssp.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW); return 0; diff --git a/ccsrc/Externals/LibItsSecurity_externals.cc b/ccsrc/Externals/LibItsSecurity_externals.cc index a73ba63..1b5debe 100644 --- a/ccsrc/Externals/LibItsSecurity_externals.cc +++ b/ccsrc/Externals/LibItsSecurity_externals.cc @@ -1108,6 +1108,49 @@ namespace LibItsSecurity__Functions { return message; } + OCTETSTRING fx__decryptWithEciesNistp256WithSha256__1(const OCTETSTRING &p__encryptedSecuredMessage, const OCTETSTRING &p__privateEncKey, + const OCTETSTRING &p__publicEphemeralKeyX, const OCTETSTRING &p__publicEphemeralKeyY, + const OCTETSTRING &p__encrypted__sym__key, const OCTETSTRING &p__authentication__vector, + const OCTETSTRING &p__nonce, const OCTETSTRING &p__salt, OCTETSTRING &p__aes__sym__enc__key) { + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256__1: p__toBeEncryptedSecuredMessage: ", p__encryptedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256__1: p__privateEncKey: ", p__privateEncKey); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256__1: p__publicEphemeralKeyX: ", p__publicEphemeralKeyX); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256__1: p__publicEphemeralKeyY: ", p__publicEphemeralKeyY); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256__1: p__nonce: ", p__nonce); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256__1: p__authentication__vector: ", p__authentication__vector); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256__1: p__encrypted__sym__key: ", p__encrypted__sym__key); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256__1: p__salt", p__salt); + + // 1. Create security_ecc instance based on recipient's private key + security_ecc ec(ec_elliptic_curves::nist_p_256, p__privateEncKey); + security_ecc ec_comp(ec_elliptic_curves::nist_p_256, p__publicEphemeralKeyX, p__publicEphemeralKeyY); + + // 2. Generate the shared secret value based on public ephemeral keys will be required + if (ec.generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__encrypted__sym__key, + p__nonce, p__authentication__vector, p__salt) == -1) { + loggers::get_instance().warning("fx__decryptWithEciesNistp256WithSha256__1: Failed to generate shared secret"); + return OCTETSTRING(0, nullptr); + } + + // Decrypt the message + OCTETSTRING enc_message(p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof(), + static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message + loggers::get_instance().log_msg("fx__decryptWithEciesNistp256WithSha256__1: enc_message: ", enc_message); // Extract the ctag value + OCTETSTRING tag(ec.tag().lengthof(), + static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); + loggers::get_instance().log_msg("fx__decryptWithEciesNistp256WithSha256__1: tag: ", tag); + OCTETSTRING message; + if (ec.decrypt(tag, enc_message, message) == -1) { + loggers::get_instance().warning("fx__decryptWithEciesNistp256WithSha256__1: Failed to generate shared secret"); + return OCTETSTRING(0, nullptr); + } + loggers::get_instance().log_msg("fx__decryptWithEciesNistp256WithSha256__1: dec message: ", message); + p__aes__sym__enc__key = ec.symmetric_encryption_key(); + loggers::get_instance().log_msg("fx__decryptWithEciesNistp256WithSha256__1: AES 128 encryption key: ", p__aes__sym__enc__key); + + return message; + } + @@ -1483,6 +1526,49 @@ namespace LibItsSecurity__Functions { return message; } + OCTETSTRING fx__decryptWithEciesBrainpoolp256r1WithSha256__1(const OCTETSTRING &p__encryptedSecuredMessage, const OCTETSTRING &p__privateEncKey, + const OCTETSTRING &p__publicEphemeralKeyX, const OCTETSTRING &p__publicEphemeralKeyY, + const OCTETSTRING &p__encrypted__sym__key, const OCTETSTRING &p__authentication__vector, + const OCTETSTRING &p__nonce, const OCTETSTRING &p__salt, OCTETSTRING &p__aes__sym__enc__key) { + loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256__1: p__toBeEncryptedSecuredMessage: ", p__encryptedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256__1: p__privateEncKey: ", p__privateEncKey); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256__1: p__publicEphemeralKeyX: ", p__publicEphemeralKeyX); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256__1: p__publicEphemeralKeyY: ", p__publicEphemeralKeyY); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256__1: p__nonce: ", p__nonce); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256__1: p__authentication__vector: ", p__authentication__vector); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256__1: p__encrypted__sym__key: ", p__encrypted__sym__key); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256__1: p__salt", p__salt); + + // 1. Create security_ecc instance based on public ephemeral keys + security_ecc ec(ec_elliptic_curves::brainpool_p_256_r1, p__privateEncKey); + security_ecc ec_comp(ec_elliptic_curves::brainpool_p_256_r1, p__publicEphemeralKeyX, p__publicEphemeralKeyY); + + // 2. Generate the shared secret value based on public ephemeral keys will be required + if (ec.generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__encrypted__sym__key, + p__nonce, p__authentication__vector, OCTETSTRING(0, nullptr)) == -1) { + loggers::get_instance().warning("fx__decryptWithEciesBrainpoolp256r1WithSha256__1: Failed to generate shared secret"); + return OCTETSTRING(0, nullptr); + } + + // Decrypt the message + OCTETSTRING enc_message(p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof(), + static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message + loggers::get_instance().log_msg("fx__decryptWithEciesBrainpoolp256r1WithSha256__1: enc_message: ", enc_message); // Extract the ctag value + OCTETSTRING tag(ec.tag().lengthof(), + static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); + loggers::get_instance().log_msg("fx__decryptWithEciesBrainpoolp256r1WithSha256__1: tag: ", tag); + OCTETSTRING message; + if (ec.decrypt(tag, enc_message, message) == -1) { + loggers::get_instance().warning("fx__decryptWithEciesBrainpoolp256r1WithSha256__1: Failed to generate shared secret"); + return OCTETSTRING(0, nullptr); + } + loggers::get_instance().log_msg("fx__decryptWithEciesBrainpoolp256r1WithSha256__1: dec message: ", message); + p__aes__sym__enc__key = ec.symmetric_encryption_key(); + loggers::get_instance().log_msg("fx__decryptWithEciesBrainpoolp256r1WithSha256__1: AES 128 encryption key: ", p__aes__sym__enc__key); + + return message; + } + /** * \brief Produce a new public/private key pair based on Elliptic Curve Digital Signature Algorithm (ECDSA) algorithm. * This function should not be used by the ATS diff --git a/etc/AtsPki/AtsPki_Microsec.cfg_ b/etc/AtsPki/AtsPki_Microsec.cfg_ index 25e411b..037735f 100644 --- a/etc/AtsPki/AtsPki_Microsec.cfg_ +++ b/etc/AtsPki/AtsPki_Microsec.cfg_ @@ -190,7 +190,13 @@ system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/ # Check that the butterfly certificate request message contains expanded cocoon key #ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_05_BV # Check that the butterfly certificate request message sent by EA to AA contains all required elements -ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV +# Check that the butterfly certificate request message sent by EA to AA contains - Check signatures +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV_01 +# Check that the butterfly certificate request message sent by EA to AA contains - Check encryption +ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV_02 +# Check that the butterfly certificate request message sent by EA to AA contains - Verify AT certificate +#ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV_03 # The EtsiTs103097Data-Encrypted is build with the component recipients containing one instance of RecipientInfo of choice pskRecipInfo, which contains the HashedId8 of the symmetric key used by the ITS-S to encrypt the AuthorizationRequest message to which the response is built and the component ciphertext containing the encrypted representation of the EtsiTs103097Data-Signed. The encryption uses a ETSI TS 103 097 [3] approved algorithm #ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_01_BV diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 3643851..1939df8 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 364385100d798b855e7572c09a98ab8e91b4afd0 +Subproject commit 1939df824bb1880f920231524d5cc35c9470b62b diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index dd305e7..f14617d 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit dd305e715a9dbc79a465dd8990010e56a18c602d +Subproject commit f14617db8925bd088a4e657cf0850ce9066bfa04 -- GitLab From 10e129e02c9ec6ee61635d3c81c5ff8df20cc985 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Sat, 30 Mar 2024 17:39:34 +0100 Subject: [PATCH 121/178] (*) use BN_bn2binpad to avoid size errors --- ccsrc/Protocols/Security/security_ecc.cc | 27 ++++++++++++------------ 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/ccsrc/Protocols/Security/security_ecc.cc b/ccsrc/Protocols/Security/security_ecc.cc index 4ff8cfe..44cfa05 100644 --- a/ccsrc/Protocols/Security/security_ecc.cc +++ b/ccsrc/Protocols/Security/security_ecc.cc @@ -48,6 +48,7 @@ security_ecc::security_ecc(const ec_elliptic_curves p_elliptic_curve, const OCTE loggers::get_instance().log(">>> security_ecc::security_ecc (1): %d", static_cast(p_elliptic_curve)); // Sanity checks + int fsize; if ((_elliptic_curve == ec_elliptic_curves::nist_p_256) || (_elliptic_curve == ec_elliptic_curves::brainpool_p_256_r1) || (_elliptic_curve == ec_elliptic_curves::sm2_p_256)) { if (p_private_key.lengthof() != 32) { loggers::get_instance().error("security_ecc::security_ecc (1): Invalid public keys size"); @@ -88,13 +89,8 @@ security_ecc::security_ecc(const ec_elliptic_curves p_elliptic_curve, const OCTE loggers::get_instance().error("security_ecc::security_ecc (1): Failed to generate xy coordinates, check algorithms"); } loggers::get_instance().log("security_ecc::security_ecc (1): xy length: %d", BN_num_bytes(xy)); - OCTETSTRING v = int2oct(0, BN_num_bytes(xy)); - ::BN_bn2bin(xy, (unsigned char *)static_cast(v)); - if ((v.lengthof() % 2) != 0) { - // Remove first byte - loggers::get_instance().log_msg("security_ecc::security_ecc (1): Complete xy=", v); - v = OCTETSTRING(v.lengthof() - 1, 1 + static_cast(v)); - } + OCTETSTRING v = int2oct(0, _pri_key.lengthof()); + ::BN_bn2binpad(xy, (unsigned char *)static_cast(v), _pri_key.lengthof()); ::BN_clear_free(xy); xy = nullptr; @@ -832,6 +828,13 @@ int security_ecc::sign(const OCTETSTRING &p_data, OCTETSTRING &p_r_sig, OCTETSTR loggers::get_instance().log_msg(">>> security_ecc::sign: p_data: ", p_data); // Sanity checks + const EC_GROUP * g = ::EC_KEY_get0_group(_ec_key); + if(g == nullptr) { + loggers::get_instance().warning("security_ecc::sign: Uninitialized key"); + return -1; + } + int fsize = (EC_GROUP_get_degree(g) + 7) / 8; + if (_pri_key.lengthof() == 0) { // No private key return -1; } @@ -855,13 +858,11 @@ int security_ecc::sign(const OCTETSTRING &p_data, OCTETSTRING &p_r_sig, OCTETSTR const BIGNUM *r = nullptr; const BIGNUM *s = nullptr; ::ECDSA_SIG_get0(signature, &r, &s); - loggers::get_instance().log("security_ecc::sign: r size: %d", BN_num_bytes(r)); - p_r_sig = int2oct(0, BN_num_bytes(r)); - ::BN_bn2bin(r, (unsigned char *)static_cast(p_r_sig)); + p_r_sig = int2oct(0, fsize); + ::BN_bn2binpad(r, (unsigned char *)static_cast(p_r_sig), fsize); loggers::get_instance().log_msg("security_ecc::sign: r=", p_r_sig); - loggers::get_instance().log("security_ecc::sign: s size: %d", BN_num_bytes(s)); - p_s_sig = int2oct(0, BN_num_bytes(s)); - ::BN_bn2bin(s, (unsigned char *)static_cast(p_s_sig)); + p_s_sig = int2oct(0, fsize); + ::BN_bn2binpad(s, (unsigned char *)static_cast(p_s_sig), fsize); loggers::get_instance().log_msg("security_ecc::sign: s=", p_s_sig); ::ECDSA_SIG_free(signature); -- GitLab From fa3d89697f0fd1f5d158ce5acf894f1f7e475ae9 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Sat, 30 Mar 2024 17:45:15 +0100 Subject: [PATCH 122/178] (*) support for postamble in Makefile (*) sync with recent changes in LibCommon and framework (*) add base time in certificate generation --- .gitignore | 2 ++ Makefile | 17 ++++++++++------- data/certificates/Makefile | 3 ++- titan-test-system-framework | 2 +- ttcn/LibCommon | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index b026989..3441e67 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ config.mk data/certificates/* !data/certificates/profiles !data/certificates/Makefile +package.yml +.gitignore diff --git a/Makefile b/Makefile index ef5a562..c4af7f9 100644 --- a/Makefile +++ b/Makefile @@ -56,10 +56,10 @@ endif libs += -lssl -lcrypto -lxml2 -ljsoncpp -lzip -$(eval $(call IncludeModule, $(TOPDIR)/ttcn/$(ATS))) - -outdir := $(TOPDIR)/build/$(ATS) bindir := $(TOPDIR)/bin +outdir := $(TOPDIR)/build/$(ATS) + +$(eval $(call IncludeModule, $(TOPDIR)/ttcn/$(ATS))) sources := $(all_sources) includes := $(outdir) $(outdir)/.. $(outdir)/asn1 $(all_includes) $(NPCAP_INCLUDE) @@ -91,9 +91,11 @@ gen_headers := $(gen_ttcn_headers) $(gen_ttcn3_headers) $(gen_asn_headers) $(gen gen_objects := $(patsubst %.cc, %.o, $(gen_sources)) cc_objects := $(patsubst %.cc, $(outdir)/%.o, $(cc_sources)) -.PHONY: all FORCE echo +outbin = $(bindir)/$(ATS)$(SUB_ATS)$(EXE) + +.PHONY: all FORCE echo postamble -all: $(bindir) $(outdir) $(bindir)/$(ATS)$(SUB_ATS)$(EXE) +all: $(bindir) $(outdir) $(outbin) postamble echo_sources: @echo -e "$(addsuffix \n,$(all_sources))" @@ -107,7 +109,7 @@ echo: echo_sources @echo -e "defines: $(addsuffix \n, $(defines))" clean: - rm -f $(outdir)/$(ATS)$(SUB_ATS)$(EXE) $(gen_objects) $(gen_sources) $(gen_headers) $(cc_objects) $(outdir)/.generate $(outdir)/../libItsAsn.so + rm -f $(outbin) $(gen_objects) $(gen_sources) $(gen_headers) $(cc_objects) $(outdir)/.generate $(outdir)/../libItsAsn.so # rm -f $(outdir)/asn1/*.so $(outdir)/asn1/*.o $(outdir)/asn1/*.c $(outdir)/asn1/*.h $(outdir)/asn1/Makefile.am.libasncodec regen: force_regen $(outdir)/.generate @@ -129,7 +131,7 @@ t3d: all $(outdir) $(outdir)/asn1 $(bindir): mkdir -p $@ -$(bindir)/$(ATS)$(SUB_ATS)$(EXE): $(outdir)/asn1/libItsAsn.a $(gen_objects) $(cc_objects) +$(outbin): $(outdir)/asn1/libItsAsn.a $(gen_objects) $(cc_objects) g++ -g -O0 -std=c++17 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(outdir)/asn1/libItsAsn.a $(libs) $(gen_objects) :%.o :%.cc @@ -169,3 +171,4 @@ $(foreach S, $(asn1_sources), $(eval $(outdir)/$(notdir $(patsubst %.asn1, %.cc $(asn_sources) $(asn1_sources): +postamble: diff --git a/data/certificates/Makefile b/data/certificates/Makefile index ce0f16f..36d75dd 100644 --- a/data/certificates/Makefile +++ b/data/certificates/Makefile @@ -17,6 +17,7 @@ depdir=temp keydir=certificates iutdir=iut +base_time := $(shell date +%Y-01-01) asn1certgen=$(CERTGEN)/build/$(ARCH)/certgen asn1certidx=$(CERTGEN)/build/$(ARCH)/certidx -n @@ -36,7 +37,7 @@ clean: rm -f $(certificates_oer) $(certificates_xer) $(certificates_xer): $(xerdir)/%.xer : $(in)/%.xml - xsltproc $(xsl_cvt) $< | xmllint --format -o $@ - + xsltproc --param base-time "'$(base_time)'" $(xsl_cvt) $< | xmllint --format -o $@ - $(outdir)/index.lst: $(certificates_oer) $(asn1certidx) -o $@ $^ diff --git a/titan-test-system-framework b/titan-test-system-framework index eb652d4..e27aaa8 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit eb652d4fbd09a333332d4e2fb28aede6543d456b +Subproject commit e27aaa847f49a1e459f427abc3620ef7a40223ca diff --git a/ttcn/LibCommon b/ttcn/LibCommon index 21bad7c..149e7d5 160000 --- a/ttcn/LibCommon +++ b/ttcn/LibCommon @@ -1 +1 @@ -Subproject commit 21bad7c51917d19bebdff5b36983e22922421976 +Subproject commit 149e7d5cc1fc2252f2100f25bb06c72245529143 -- GitLab From 3dca0b0115f9e5c33b42ccc5d73d45842d307c96 Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 2 Apr 2024 14:29:02 +0200 Subject: [PATCH 123/178] Merge ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn with cygwin branch --- .../ttcn/LibCommon_Sync.ttcn | 69 ++++++++++--------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn b/ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn index 39d9659..eb11aef 100644 --- a/ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn +++ b/ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn @@ -148,8 +148,8 @@ module LibCommon_Sync { * @see LibCommon_Sync.ServerSyncComp * @see LibCommon_Sync.ClientSyncComp */ - type port SyncPort message { - inout SyncCmd + type port SyncPort message { + inout SyncCmd } with { extension "internal" } @@ -163,7 +163,7 @@ module LibCommon_Sync { e_testBody, e_postamble } - + } // end compTypeRelated group standardSyncPointNames { @@ -322,7 +322,7 @@ module LibCommon_Sync { * @param p_numClients number of synchronization clients * @param p_syncPointIds list of synchronization point name/ids */ - function f_serverSyncNClientsAndStop ( + function f_serverSyncNClientsAndStop ( in UInt p_numClients, in SyncPointList p_syncPointIds ) runs on ServerSyncComp { @@ -421,7 +421,7 @@ module LibCommon_Sync { f_clientSyncAndVerdictPreamble(p_syncPoint, p_ret); } } - + /** * @desc Calls either self synchronization function if * invoking component is the MTC, otherwise @@ -450,11 +450,11 @@ module LibCommon_Sync { f_clientSyncAndVerdictTestBody(p_syncPoint, p_ret); } } - + /** * @desc Function kept for backward compatibility * @see f_selfOrClientSyncAndVerdictPreamble - * + * */ function f_selfOrClientSyncAndVerdictPR( in charstring p_syncPoint, in FncRetCode p_ret) @@ -618,18 +618,18 @@ module LibCommon_Sync { stop ; } } // end altstep a_dummyShutDown - + /** - * @desc Shutdown alstep in case the sync server is requesting shutdown. - * - * @remark User shall stop the component + * @desc Shutdown alstep in case the sync server is requesting shutdown. + * + * @remark User shall stop the component */ - altstep a_shutdown() - runs on ClientSyncComp { + altstep a_shutdown() + runs on BaseSyncComp { [] syncPort.receive(m_syncServerStop){ tc_sync.stop ; log("**** a_shutdown: Test component received STOP signal from MTC **** "); - } + } } } // end group shutDownAltsteps @@ -663,7 +663,7 @@ module LibCommon_Sync { /** * @desc Implements synchronization of "n" clients from server - * side including intermediate synchronization. + * side including intermediate synchronization. * If a problem occurs, then server sends STOP to * all clients. Waits for PX_TSYNC_TIME_LIMIT to let * clients finish executing their behavior until this @@ -682,7 +682,7 @@ module LibCommon_Sync { runs on ServerSyncComp { f_serverSyncClientsTimedIntermediateSync(p_noOfClients,p_syncId, p_NoOfClientIntermediate, p_syncIdIntermediate, PX_TSYNC_TIME_LIMIT); } - + /** * @desc Handles synchronization of clients from server side. * If problem occurs, then server sends STOP to all clients. @@ -732,7 +732,7 @@ module LibCommon_Sync { } else if ( p_syncId == c_initDone ) { log("**** f_serverSyncClientsTimed: Sync server now starting UPPER TESTER synchronization ... ****") ; } else { - log("**** f_serverSyncClientsTimed: Sync server now starting handling of next synchronization point ... ****") ; + log("**** f_serverSyncClientsTimed: Sync server now starting handling of " & p_syncId & " synchronization point ... ****") ; } tc_sync.start(p_execTimeLimit) ; alt{ @@ -747,6 +747,7 @@ module LibCommon_Sync { repeat; } [] syncPort.receive(m_syncClientReady(p_syncId)) -> sender v_clientRef { + log("**** f_serverSyncClientsTimed: Sync server received READY signal from a client - server will wait for all clients to reach this synchronization point ****"); if(not f_isPresentInArray(v_clientRef, v_clientRefs)) { v_clientRefs[v_noOfRecvdSyncMsgs] := v_clientRef; v_noOfRecvdSyncMsgs := v_noOfRecvdSyncMsgs + 1; @@ -767,7 +768,7 @@ module LibCommon_Sync { log("**** f_serverSyncClientsTimed: Sync server received client sync message with incorrect synchronization point id which is currently not handled - server will stop all clients! ****") ; v_stopClients := true; if(not f_isPresentInArray(v_clientRef, v_clientRefs)) { - v_clientRefs[v_noOfRecvdSyncMsgs] := v_clientRef; + v_clientRefs[v_noOfRecvdSyncMsgs] := v_clientRef; } } [] syncPort.receive(SyncCmd :? ) { @@ -1139,7 +1140,7 @@ module LibCommon_Sync { f_selfSync(p_syncId,p_ret); vc_testcaseStep := e_testBody; } - + /** * @desc This function combines MTC verdict setting with self * synchronization for use after the test body. @@ -1317,29 +1318,29 @@ module LibCommon_Sync { alt { [] syncPort.receive { // clients may still try to send some sync message - } + } [] all component.done { tc_shutDown.stop; log("**** f_serverWaitForAllClientsToShutDown: All components have properly shut down. Sync server will now terminate the test case. ****") ; - } + } [] tc_shutDown.timeout { log("**** f_serverWaitForAllClientsToShutDown: Not all clients have properly shutdown within the shut down time limit. Sync server will now terminate test case! ****") ; - } + } } // end alt // cover case that shut down default is NOT activated setverdict(inconc); - //mtc.stop; - syncPort.send(m_syncServerStop) to self; // this MUST be _server_ for the default to catch! - tc_sync.start(PX_TSYNC_TIME_LIMIT); - alt{ - [] tc_sync.timeout{ - log("**** f_selfSyncStop: Stopping MTC without shutdown - either no shutdown default active or missing syncPort connection ****") ; - setverdict(inconc); - stop ; - } - }//end alt - tc_sync.stop; - stop; // if shutdown default is not activated or if it does not stop + //mtc.stop; + syncPort.send(m_syncServerStop) to self; // this MUST be _server_ for the default to catch! + tc_sync.start(PX_TSYNC_TIME_LIMIT); + alt{ + [] tc_sync.timeout{ + log("**** f_selfSyncStop: Stopping MTC without shutdown - either no shutdown default active or missing syncPort connection ****") ; + setverdict(inconc); + stop ; + } + }//end alt + tc_sync.stop; + stop; // if shutdown default is not activated or if it does not stop } // end function f_serverWaitForAllClientsToShutDown function f_isPresentInArray(in ClientSyncComp p_clientRef, in ClientSyncCompList p_clientRefs) -- GitLab From 0d24dbff5e239be83e34bca613122a9f221896b5 Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 2 Apr 2024 14:31:04 +0200 Subject: [PATCH 124/178] Remove AtsPki.cfg, shall be a soft link to xx.xfg_ --- etc/AtsPki/AtsPki.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/AtsPki/AtsPki.cfg b/etc/AtsPki/AtsPki.cfg index be66d6f..8a97a4d 120000 --- a/etc/AtsPki/AtsPki.cfg +++ b/etc/AtsPki/AtsPki.cfg @@ -1 +1 @@ -AtsPki_Microsec.cfg_ \ No newline at end of file +AtsPki_Simu.cfg_ \ No newline at end of file -- GitLab From ddcd3ef78b237078024f09314bbe40caace88df7 Mon Sep 17 00:00:00 2001 From: garciay Date: Wed, 24 Apr 2024 16:32:02 +0200 Subject: [PATCH 125/178] Enhance BfkZipEntries data structure; Update configuration files --- ccsrc/Externals/LibItsSecurity_externals.cc | 8 +- .../http_etsi_ieee1609dot2dot1_codec.cc | 5 +- .../http_etsi_ieee1609dot2dot1_codec.hh | 1 + etc/AtsCAM/AtsCAM_Simulator.cfg_ | 171 +++++++++++++ etc/AtsMBR/AtsMBR_Simu.cfg_ | 233 ++++++++++++++++++ etc/AtsPki/AtsPki.cfg | 2 +- etc/AtsPki/AtsPki_Microsec.cfg_ | 38 +-- etc/AtsPki/AtsPki_Simu.cfg_ | 61 +++-- titan-test-system-framework | 2 +- ttcn/LibCommon | 2 +- .../ttcn/LibHttp_BinaryMessageBodyTypes.ttcn | 10 +- 11 files changed, 476 insertions(+), 57 deletions(-) create mode 100644 etc/AtsCAM/AtsCAM_Simulator.cfg_ create mode 100644 etc/AtsMBR/AtsMBR_Simu.cfg_ diff --git a/ccsrc/Externals/LibItsSecurity_externals.cc b/ccsrc/Externals/LibItsSecurity_externals.cc index 1b5debe..71d8ae2 100644 --- a/ccsrc/Externals/LibItsSecurity_externals.cc +++ b/ccsrc/Externals/LibItsSecurity_externals.cc @@ -1068,7 +1068,7 @@ namespace LibItsSecurity__Functions { const OCTETSTRING &p__publicEphemeralKeyCompressed, const INTEGER &p__ephemeralCompressedMode, const OCTETSTRING &p__encrypted__sym__key, const OCTETSTRING &p__authentication__vector, const OCTETSTRING &p__nonce, const OCTETSTRING &p__salt, OCTETSTRING &p__aes__sym__enc__key) { - loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__toBeEncryptedSecuredMessage: ", p__encryptedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__encryptedSecuredMessage: ", p__encryptedSecuredMessage); loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__privateEncKey: ", p__privateEncKey); loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256: p__publicEphemeralKeyCompressed: ", p__publicEphemeralKeyCompressed); loggers::get_instance().log(">>> fx__decryptWithEciesNistp256WithSha256: p__ephemeralCompressedMode: %d", static_cast(p__ephemeralCompressedMode)); @@ -1112,7 +1112,7 @@ namespace LibItsSecurity__Functions { const OCTETSTRING &p__publicEphemeralKeyX, const OCTETSTRING &p__publicEphemeralKeyY, const OCTETSTRING &p__encrypted__sym__key, const OCTETSTRING &p__authentication__vector, const OCTETSTRING &p__nonce, const OCTETSTRING &p__salt, OCTETSTRING &p__aes__sym__enc__key) { - loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256__1: p__toBeEncryptedSecuredMessage: ", p__encryptedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256__1: p__encryptedSecuredMessage: ", p__encryptedSecuredMessage); loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256__1: p__privateEncKey: ", p__privateEncKey); loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256__1: p__publicEphemeralKeyX: ", p__publicEphemeralKeyX); loggers::get_instance().log_msg(">>> fx__decryptWithEciesNistp256WithSha256__1: p__publicEphemeralKeyY: ", p__publicEphemeralKeyY); @@ -1311,7 +1311,7 @@ namespace LibItsSecurity__Functions { const OCTETSTRING &p__publicEphemeralKeyCompressed, const INTEGER &p__ephemeralCompressedMode, const OCTETSTRING &p__encrypted__sym__key, const OCTETSTRING &p__authentication__vector, const OCTETSTRING &p__nonce, const OCTETSTRING &p__salt, OCTETSTRING &p__aes__sym__enc__key) { - loggers::get_instance().log_msg(">>> fx__decryptWithEciesSm2p256WithSha256: p__toBeEncryptedSecuredMessage: ", p__encryptedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesSm2p256WithSha256: p__encryptedSecuredMessage: ", p__encryptedSecuredMessage); loggers::get_instance().log_msg(">>> fx__decryptWithEciesSm2p256WithSha256: p__privateEncKey: ", p__privateEncKey); loggers::get_instance().log_msg(">>> fx__decryptWithEciesSm2p256WithSha256: p__publicEphemeralKeyCompressed: ", p__publicEphemeralKeyCompressed); loggers::get_instance().log(">>> fx__decryptWithEciesSm2p256WithSha256: p__ephemeralCompressedMode: %d", static_cast(p__ephemeralCompressedMode)); @@ -1485,7 +1485,7 @@ namespace LibItsSecurity__Functions { const OCTETSTRING &p__publicEphemeralKeyCompressed, const INTEGER &p__ephemeralCompressedMode, const OCTETSTRING &p__encrypted__sym__key, const OCTETSTRING &p__authentication__vector, const OCTETSTRING &p__nonce, const OCTETSTRING &p__salt, OCTETSTRING &p__aes__sym__enc__key) { - loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__toBeEncryptedSecuredMessage: ", p__encryptedSecuredMessage); + loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__encryptedSecuredMessage: ", p__encryptedSecuredMessage); loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__privateEncKey: ", p__privateEncKey); loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__publicEphemeralKeyCompressed: ", p__publicEphemeralKeyCompressed); loggers::get_instance().log(">>> fx__decryptWithEciesBrainpoolp256r1WithSha256: p__ephemeralCompressedMode: %d", diff --git a/ccsrc/Protocols/Security/http_etsi_ieee1609dot2dot1_codec.cc b/ccsrc/Protocols/Security/http_etsi_ieee1609dot2dot1_codec.cc index b6e81b0..46328bc 100644 --- a/ccsrc/Protocols/Security/http_etsi_ieee1609dot2dot1_codec.cc +++ b/ccsrc/Protocols/Security/http_etsi_ieee1609dot2dot1_codec.cc @@ -21,7 +21,7 @@ int http_etsi_ieee1609dot2dot1_codec::decode(const OCTETSTRING &p_data, LibHttp_ zip_stat_t zst; zip_t *za = nullptr; int ret_code = -1; - LibHttp__BinaryMessageBodyTypes::BfkZipFileContent_signed__messages signed_messages; + LibHttp__BinaryMessageBodyTypes::BfkZipEntries signed_messages; ::zip_error_init(&error); if ((src = ::zip_source_buffer_create(static_cast(p_data), p_data.lengthof(), 1, &error)) == nullptr) { loggers::get_instance().error("http_etsi_ieee1609dot2dot1_codec::decode: ::zip_source_buffer_create failure: %s", ::zip_error_strerror(&error)); @@ -89,7 +89,8 @@ int http_etsi_ieee1609dot2dot1_codec::decode(const OCTETSTRING &p_data, LibHttp_ ::zip_fclose(zf); goto decode_cleanup; } - signed_messages[i] = ieee1609Dot2Data; + signed_messages[i].name() = sb.name; + signed_messages[i].signed__message() = ieee1609Dot2Data; delete [] buffer; ::zip_fclose(zf); } diff --git a/ccsrc/Protocols/Security/http_etsi_ieee1609dot2dot1_codec.hh b/ccsrc/Protocols/Security/http_etsi_ieee1609dot2dot1_codec.hh index 1a3e008..79d936c 100644 --- a/ccsrc/Protocols/Security/http_etsi_ieee1609dot2dot1_codec.hh +++ b/ccsrc/Protocols/Security/http_etsi_ieee1609dot2dot1_codec.hh @@ -9,6 +9,7 @@ namespace LibHttp__BinaryMessageBodyTypes { class BfkZipFile; + class BfkZipEntries; } class http_etsi_ieee1609dot2dot1_codec : public codec_gen { diff --git a/etc/AtsCAM/AtsCAM_Simulator.cfg_ b/etc/AtsCAM/AtsCAM_Simulator.cfg_ new file mode 100644 index 0000000..75f66ca --- /dev/null +++ b/etc/AtsCAM/AtsCAM_Simulator.cfg_ @@ -0,0 +1,171 @@ + +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# IUT Station ID +LibItsCommon_Pixits.PX_IUT_STATION_ID := 2533729309 + +LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB + +LibItsCam_Pics.PICS_DANGEROUSGOODS := true +LibItsCam_Pics.PICS_IS_IUT_SECURED := true + +[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). +LogFile := "../logs/AtsCAM/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | TIMEROP | VERDICTOP +#ConsoleMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | TIMEROP | VERDICTOP +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +# CAM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# header_sub_type : sh (single hop) +# DENM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# BTP Layer +# type : btpA|btpB +# destination port: dst_port +# source port : src_port +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# GN Layer +# ll_address : GeoNetworking address of the Test System for beaconing. To be align with CAM +# latitude : Latitude of the Test System +# longitude : Longitude of the Test System +# beaconing : Set to 1 if GnLayer shall start beaconing +# expiry : Beaconing timer expiry (ms) +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# secured_mode : Set to 1 if message exchanges shall be signed +# encrypted_mode : Set to 1 if message exchanges shall be encrypted +# NOTE: For signed & encrypted message exchanges, both secured_mode and encrypted_mode shall be set to 1 +# sec_db_path : Path to the certificates and keys storage location +# hash : Hash algorithm to be used when secured mode is set +# Authorized values are SHA-256 or SHA-384 +# Default: SHA-256 +# cypher : Cyphering algorithm to be used when secured mode is set +# Authorized values are NISTP-256 and BP-256 +# Default: NISTP-256 +# Ethernet layer +# mac_src :Source MAC address +# mac_bc :Broadcast address +# eth_type : Ethernet type +# Commsignia layer +# mac_src : IUT MAC address, used to discard packets +# To indicate no filering, use the value 000000000000 +# mac_bc : Broadcast address +# eth_type : Ethernet type, used to discard packets +# target_host : Device address +# target_port : Device port +# source_port : Test System port +# interface_id: Interface id, used to discard packets +# tx_power : TX power (dB) +# xport_mode : G5 or LTE-V2X +# UDP layer (IP/UDP based on Pcap) +# dst_ip : Destination IPv4 address (aa.bb.cc.dd) +# dst_port: Destination port +# src_ip : Source IPv4 address (aa.bb.cc.dd) +# src_port: Source port +# Pcap layer +# mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System +# filter : Pcap filter (compliant with tcpdump syntax) +# Online mode: +# nic: Local NIC +# If set, online mode is used +# Offline mode (nic is present but not set): +# file : File to read +# frame_offset: Frame offset, used to skip packets with frame number < frame_offset +# time_offset : Time offset, used to skip packets with time offset < time_offset +# save_mode : Set to 1 to save sent packet, 0 otherwise + +# Cygwin +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947)" +# Linux over UDP +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.43,src_port=4041,dst_port=9091)" + +# PC5 + UU/Raw +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=515340240,longitude=139274330,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates_iut)/LTE(mac_src=8c554ac1eee1,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.43,dst_port=4041,src_port=9091)" +# PC5 + Uu/MQTT +# Raw UDP +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=udp,debug=1,server=192.168.1.39,port=1883)" +# MQTT over TCP +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=192.168.1.39,port=1883)" + +# CAM UpperTester port based on UDP +system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" +#system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.146.26)" +#system.utPort.params := "UT_CAM/UDP(dst_ip=172.16.35.1)" + +[EXECUTE] +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 +ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_05 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_01 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_02 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_03 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_04 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_05 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_06 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_07 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_08 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_09 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_10 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_11 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_12 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_13 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_14 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_15 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_16 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_17 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_18 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_19 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_20 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_21 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_22 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_23 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_24 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_25 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_26 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_27 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_28 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_29 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_30 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_31 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_32 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_33 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_34 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_35 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_02 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_03 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_04 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_05 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_06 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_07 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_08 +#ItsCam_TestCases.TC_CAM_MSP_BV_01 +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_01 +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_02 +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_03 +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_01 +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_03 + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/etc/AtsMBR/AtsMBR_Simu.cfg_ b/etc/AtsMBR/AtsMBR_Simu.cfg_ new file mode 100644 index 0000000..3b7f910 --- /dev/null +++ b/etc/AtsMBR/AtsMBR_Simu.cfg_ @@ -0,0 +1,233 @@ + +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# The GeoNetworking address of the IUT. +#LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { +# typeOfAddress := e_initial, +# stationType := e_unknown, +# reserved := 0, +# mid := '4C5E0C14D2EA'O +#} +LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { + typeOfAddress := e_manual, + stationType := e_roadSideUnit, + reserved := 49, + mid := '001C6B0D0201'O +} +LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB +LibItsBtp_Pixits.PX_DESTINATION_PORT := 2001 +LibItsBtp_Pixits.PX_DESTINATION_PORT_INFO := 2001 + +# 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 := "../data/certificates" +# Configuration sub-directory to access certificate stored in files +LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" +# The certficate the IUT should use (cf. UtInitialize) +#LibItsSecurity_Pixits.PX_IUT_DEFAULT_CERTIFICATE := "CERT_IUT_A_AT" +# The certficate the TS should use to generate an ITS message +#LibItsSecurity_Pixits.PX_AT_CERTIFICATE := "CERT_TS_B_AT" # Possible values: CERT_TS_C_AT, CERT_TS_D_AT, or CERT_TS_E_AT + +#LibItsSecurity_Pics.PICS_SEC_SHA256 := false +#LibItsSecurity_Pics.PICS_SEC_SHA384 := true + +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_Pics.PICS_IUT_SEND_GROUPED_MBRS := false + +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). + +LogFile := "../logs/AtsMBR/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | TIMEROP +#ConsoleMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | TIMEROP +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +# CAM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# header_sub_type : sh (single hop) +# DENM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# BTP Layer +# type : btpA|btpB +# destination port: dst_port +# source port : src_port +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# GN Layer +# ll_address : GeoNetworking address of the Test System +# latitude : latitude of the Test System +# longitude : longitude of the Test System +# beaconing : Set to 1 if GnLayer shall start beaconing +# Beaconning timer expiry: expiry (ms) +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# secured_mode : Set to 1 if message exchanges shall be signed +# encrypted_mode : Set to 1 if message exchanges shall be encrypted +# NOTE: For signed & encrypted message exchanges, both secured_mode and encrypted_mode shall be set to 1 +# sec_db_path : Path to the certificates and keys storage location +# hash : Hash algorithm to be used when secured mode is set +# Authorized values are SHA-256 or SHA-384 +# Default: SHA-256 +# cypher : Cyphering algorithm to be used when secured mode is set +# Authorized values are NISTP-256, BP-256 and BP-384 +# Default: NISTP-256 +# Ethernet layer +# mac_src :Source MAC address +# mac_bc :Broadcast address +# eth_type : Ethernet type +# Commsignia layer +# mac_src : Device MAC address, used to discard packets +# To indicate no filering, use the value 000000000000 +# mac_bc : Broadcast address +# eth_type : Ethernet type, used to discard packets +# target_host : Device address +# target_port : Device port +# source_port : Test System port +# interface_id: Interface id, used to discard packets +# tx_power : TX power (dB) +# UDP layer (IP/UDP based on Pcap) +# dst_ip : destination IPv4 address (aa.bb.cc.dd) +# dst_port: destination port +# src_ip : source IPv4 address (aa.bb.cc.dd) +# src_port: source port +# Pcap layer +# mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System +# filter : Pcap filter (compliant with tcpdump syntax) +# Online mode: +# nic: Local NIC +# If set, online mode is used +# Offline mode (nic is present but not set): +# file : File to read +# frame_offset: Frame offset, used to skip packets with frame number < frame_offset +# time_offset : Time offset, used to skip packets with time offset < time_offset +# save_mode : 1 to save sent packet, 0 otherwise + +# Single GeoNetworking component port +# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf +# its_aid=36: CAM +# its_aid=37: DENM +# its_aid=137: SPAT +# its_aid=138: MAP +# its_aid=139: IVIM +# its_aid=140: SREM/SSEM +# its_aid=141: GeoMet +# its_aid=128: RTCMEM + +# 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=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.21,src_port=4041,dst_port=9091)" + +# For all test where IUT is not MA, uncomment this port +system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.21)" +# For TC_MRS_MA_SEC_BO_01 & TC_MRS_MA_SEC_BO_01 Use this port and comment the one above +#system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=192.168.1.21,port=18000)" + +system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.21,dst_port=12345,src_port=12346)" + +[EXECUTE] + +# Check that the IUT generates an encrypted MBR message +#ItsMbr_TestCases.TC_MRS_ITSS_SEC_BV_01 + +# Check that the IUT discards an encrypted MBR message when recipientId does not contain MA certificate +# Set local_port to 18000 for AtsRSUsSimulator +#ItsMbr_TestCases.TC_MRS_MA_SEC_BO_01 + +# Check that the IUT discards an encrypted MBR message done with a certificate with no MBS SSPs +#ItsMbr_TestCases.TC_MRS_MA_SEC_BO_02 + +# Check that the IUT generates a security HeaderInfo with missing fields observation on a CAM MR Message when requested (Class 1) - obs-Security-MessageIdIncWithHeaderInfo +#ItsMbr_TestCases.TC_MRS_ITSS_SEC_MESSAGES_CLASS1_CAM_BV_01 + +# Check that the IUT generates a inconsistent security profile observation (psid set to DENM) on a CAM MR Message when requested (Class 1) - obs-Security-HeaderIncWithSecurityProfile +#ItsMbr_TestCases.TC_MRS_ITSS_SEC_MESSAGES_CLASS1_CAM_BV_02 + +# Check that the IUT generates an inconsistent PSID observation (invalid PSID value) on a CAM MR Message when requested (Class 1) - obs-Security_HeaderPsidIncWithCertificate +#ItsMbr_TestCases.TC_MRS_ITSS_SEC_MESSAGES_CLASS1_CAM_BV_03 + +# Check that the IUT generates an invalid AppPermissions observation on a CAM MR Message when requested (Class 1) - obs-Security-MessageIncWithSsp +#ItsMbr_TestCases.TC_MRS_ITSS_SEC_MESSAGES_CLASS1_CAM_BV_04 + +# Check that the IUT generates an inconsistent certificate time observation on a CAM MR Message when requested (Class 1) - obs-Security-HeaderTimeOutsideCertificateValidity +#ItsMbr_TestCases.TC_MRS_ITSS_SEC_MESSAGES_CLASS1_CAM_BV_05 + +# Check that the IUT generates an inconsistent certificate location outside observation on a CAM MR Message when requested (Class 1) - obs-Security-MessageLocationOutsideCertificateValidity +#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 + +# 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 + +# Check that the IUT generates an invalid speed value in reverse driving observation on a CAM in the MR message when requested (Class 1) - obs-Speed-ValueTooLarge-DriveDirectionReverse +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS1_CAM_BV_02 + +# 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 + +# Check that the IUT generates an inconsistent position changed value (calculated speed based on the new position) in consecutive CAMs MR Message when requested (Class 2) - obs-Position-ChangeTooLarge +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_02 + +# Check that the IUT generates a MR message with an observation of an inconsistent acceleration change (regarding the vehicle type) in consecutive CAMs when requested (Class 2) - obs-LongAcc-ValueTooLarge +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_04 + +# Check that the IUT generates a MR message with an observation of an inconsistent CAM frequency greater than 10Hz(Class 2) - obs-Beacon-IntervalTooSmall +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_05 + +# Check that the IUT generates an invalid static changed value in consecutive CAMs MR Message when requested (Class 2) - obs-Static-Change: SpecialTransport +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_10_01 + +# Check that the IUT generates an invalid static changed value in consecutive CAMs MR Message when requested (Class 2) - obs-Static-Change: StationType +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_10_02 + +# Check that the IUT generates an invalid static changed value in consecutive CAMs MR Message when requested (Class 2) - obs-Static-Change: VehicleLength +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_10_03 + +# Check that the IUT generates an invalid static changed value in consecutive CAMs MR Message when requested (Class 2) - obs-Static-Change: VehicleRole +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_10_04 + +# Check that the IUT generates an invalid static changed value in consecutive CAMs MR Message when requested (Class 2) - obs-Static-Change: VehicleWidth +#ItsMbr_TestCases.TC_MRS_ITSS_MESSAGES_CLASS2_CAM_BV_10_05 + +# Check that the IUT generates a single MR message containing observations on receiving CAM messages with different class 1 inconsistencies +#ItsMbr_TestCases.TC_MRS_ITSS_MULTIPLE_MESSAGES_CAM_01 + +# 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_MULTIPLE_MESSAGES_CAM_02 + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/etc/AtsPki/AtsPki.cfg b/etc/AtsPki/AtsPki.cfg index 8a97a4d..be66d6f 120000 --- a/etc/AtsPki/AtsPki.cfg +++ b/etc/AtsPki/AtsPki.cfg @@ -1 +1 @@ -AtsPki_Simu.cfg_ \ No newline at end of file +AtsPki_Microsec.cfg_ \ No newline at end of file diff --git a/etc/AtsPki/AtsPki_Microsec.cfg_ b/etc/AtsPki/AtsPki_Microsec.cfg_ index 037735f..4ac508b 100644 --- a/etc/AtsPki/AtsPki_Microsec.cfg_ +++ b/etc/AtsPki/AtsPki_Microsec.cfg_ @@ -14,18 +14,18 @@ LibItsSecurity_Pixits.PX_BFK_TEST_VECTORS := false LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" LibItsPki_Pics.PICS_MULTIPLE_END_POINT := false -LibHttp_Pics.PICS_HEADER_HOST := "v2x-pki-test.microsec.com" -LibItsPki_Pics.PICS_HEADER_HOST_CA := "v2x-pki-test.microsec.com" -LibItsPki_Pics.PICS_HEADER_HOST_TLM := "v2x-pki-test.microsec.com" - -LibItsPki_Pics.PICS_HTTP_POST_URI_EC := "/v2x_ea_nistp256/ecRequest" -LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/v2x_aa_nistp256/atRequest" -LibItsPki_Pics.PICS_HTTP_POST_URI_ATV := "/v2x_ea_nistp256/authValRequest" -LibItsPki_Pics.PICS_HTTP_GET_URI_CTL := "/v2x_rootca_nistp256/getctl/B65E3B8FBBEC3910" -LibItsPki_Pics.PICS_HTTP_GET_URI_CRL := "/v2x_rootca_nistp256/getcrl/B65E3B8FBBEC3910" +LibHttp_Pics.PICS_HEADER_HOST := "microsec-sandbox-ea.v2x-pki.com" +LibItsPki_Pics.PICS_HEADER_HOST_CA := "microsec-sandbox-ea.v2x-pki.com" +LibItsPki_Pics.PICS_HEADER_HOST_TLM := "microsec-sandbox-ea.v2x-pki.com" + +LibItsPki_Pics.PICS_HTTP_POST_URI_EC := "/ecRequest" +LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/atRequest" +LibItsPki_Pics.PICS_HTTP_POST_URI_ATV := "/authValRequest" +LibItsPki_Pics.PICS_HTTP_GET_URI_CTL := "/getctl/B65E3B8FBBEC3910" +LibItsPki_Pics.PICS_HTTP_GET_URI_CRL := "/getcrl/B65E3B8FBBEC3910" LibItsPki_Pics.PICS_HTTP_GET_URI_TLM := "/v2x_rootca_brainpoolp256r1" -LibItsPki_Pics.PICS_HTTP_POST_URI_BFK_AUTH := "/v2x_ea_nistp256/butterflyAuthorization" -LibItsPki_Pics.PICS_HTTP_POST_URI_BFK_AT_DOWNLOAD := "/v2x_ea_nistp256/butterflyDownload" +LibItsPki_Pics.PICS_HTTP_POST_URI_BFK_AUTH := "/butterflyAuthorization" +LibItsPki_Pics.PICS_HTTP_POST_URI_BFK_AT_DOWNLOAD := "/butterflyDownload" #LibItsPki_Pics.PICS_SIMULATE_EA_ENTITY := true # CERT_TS_A_EA shall be trusted by the PKI LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := "0_MicrosecTest-EA-2021_L0" # Use CERT_TS_A_EA when the TS simulate the EA (TC_SECPKI_AA_AUTHVAL_01_BV) with PICS_SIMULATE_EA_ENTITY set @@ -33,9 +33,9 @@ LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" # CERT_TS_A_AA & CER LibItsPki_Pics.PICS_IUT_AA_CERTIFICATE_ID := "0_MicrosecTest-AA-2021_L0" LibItsPki_Pics.PICS_TS_CA_CERTIFICATE_ID := "MicrosecNistP256RootCA" -LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3031'O # Nist-P256 -#LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3032'O # Brainpool-P256 r1 -#LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3033'O # Brainpool-P384 r1 +LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '4554534946525465737453797374656d3031'O # Nist-P256 - ETSIFRTestSystem01 +#LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '4554534946525465737453797374656d3032'O # Brainpool-P256 r1 - ETSIFRTestSystem02 +#LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '4554534946525465737453797374656d3033'O # Brainpool-P384 r1 - ETSIFRTestSystem03 # Technical keys # NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) @@ -49,7 +49,7 @@ LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3 # Set to true if the IUT support CertificateId shall be set to the choice name, false if it shall be omitted #LibItsPki_Pics.PICS_EC_SUBJECT_ATTRIBUT_ID := false # requestedSubjectAttributes.id is omitted # Set to true if the IUT support geographical region -#LibItsPki_Pics.PICS_EC_SUBJECT_ATTRIBUT_REGION := false # requestedSubjectAttributes.region is omitted +LibItsPki_Pics.PICS_EC_SUBJECT_ATTRIBUT_REGION := false # requestedSubjectAttributes.region is omitted due to a bug in Microse (email from 24 Apr 2024, 09:30) #LibItsPki_Pics.PICS_PKI_AUTH_POP := false # Do not use Signed for PoP in Authorization requet # Required for SECPKI_AA_AUTH_RCV_02_BV @@ -97,12 +97,12 @@ LogEventTypes:= Yes [TESTPORT_PARAMETERS] # Single HTTP component port -system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=v2x-pki-test.microsec.com)" +system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=microsec-sandbox-ea.v2x-pki.com)" #system.httpAtVPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=yanngarcia.ddns.net)" # HTTP component ports specific to TC_SECPKI_AA_AUTHVAL_xx -system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=v2x-pki-test.microsec.com)" -#system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.43)"system.httpTlmPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=v2x-pki-test.microsec.com)" +system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=microsec-sandbox-ea.v2x-pki.com)" +#system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.43)"system.httpTlmPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=microsec-sandbox-ea.v2x-pki.com)" [EXECUTE] # Config: @@ -256,7 +256,7 @@ ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV_02 #ItsPki_TestCases.TC_SECPKI_AA_AUTHVAL_01_BV # Config: -# system.httpCaPort.params := TCP(debug=1,server=v2x-pki-test.microsec.com +# system.httpCaPort.params := TCP(debug=1,server=microsec-sandbox-ea.v2x-pki.com # Check that the RootCA generates the Full CTL when new EA is about to be added to the Root CTL #ItsPki_TestCases.TC_RCA_CTLGEN_01_BV # Check that the RootCA generates the CRL signed with appropriate certificate. diff --git a/etc/AtsPki/AtsPki_Simu.cfg_ b/etc/AtsPki/AtsPki_Simu.cfg_ index 1861195..e32d274 100644 --- a/etc/AtsPki/AtsPki_Simu.cfg_ +++ b/etc/AtsPki/AtsPki_Simu.cfg_ @@ -1,5 +1,7 @@ [MODULE_PARAMETERS] # This section shall contain the values of all parameters that are defined in your TTCN-3 modules. +LibCommon_Time.PX_TAC := 10.0 +LibCommon_Time.PX_TNOAC := 2.0 # The GeoNetworking address of the IUT. LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { @@ -74,13 +76,13 @@ LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" # Set to true if the IUT support geographical region #LibItsPki_Pics.PICS_EC_SUBJECT_ATTRIBUT_REGION := false # requestedSubjectAttributes.region is omitted -ItsPki_Pixits.PX_TRIGGER_EC_BEFORE_AT := false; +ItsPki_Pixits.PX_TRIGGER_EC_BEFORE_AT := true; ItsPki_Pixits.PX_CERT_EXPIRATION_DELAY := 15.0 #LibItsPki_Pics.PICS_PKI_AUTH_POP := false # Do not use Signed for PoP in Authorization requet # Required for SECPKI_AA_AUTH_RCV_02_BV -#LibItsPki_Pics.PICS_SECPKI_REENROLMENT := true # Check in logs the pattern '==> EC ' to find the required information for re-enrolment +LibItsPki_Pics.PICS_SECPKI_REENROLMENT := true # Check in logs the pattern '==> EC ' to find the required information for re-enrolment #LibItsPki_Pixits.PX_INCLUDE_ENCRYPTION_KEYS := false # No encryption key in Authorization request @@ -184,59 +186,64 @@ LogEventTypes:= Yes system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=1,its_aid=36)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlo1,filter=and ether proto 0x8947)" # Single HTTP component port -system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.39)" +system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.21)" # GeoNetworking UpperTester port based on UDP -system.utPort.params := "UT_PKI/UDP(dst_ip=192.168.1.39,dst_port=12345,src_port=12346,reuse_incoming_source_adddress=1)" +system.utPort.params := "UT_PKI/UDP(dst_ip=192.168.1.21,dst_port=12345,src_port=12346,reuse_incoming_source_adddress=1)" [EXECUTE] +#ItsPkiItss_TestControl.control # Check that IUT sends an enrolment request when triggered. -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_01_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_01_BV # If the enrolment request of the IUT is an initial enrolment request, the itsId (contained in the InnerECRequest) shall be set to the canonical identifier, the signer (contained in the outer EtsiTs1030971Data-Signed) shall be set to self and the outer signature shall be computed using the canonical private key. -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_02_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_02_BV # In presence of a valid EC, the enrolment request of the IUT is a rekeying enrolment request with the itsId (contained in the InnerECRequest) and the SignerIdentifier (contained in the outer EtsiTs1030971Data-Signed) both declared as digest containing the HashedId8 of the EC and the outer signature computed using the current valid EC private key corresponding to the verification public key. -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_03_BV +ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_03_BV # If the EC is revoked, the IUT returns to the state 'initialized'. -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_04_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_04_BV # If the EC expires, the IUT returns to the state 'initialized' -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_05_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_05_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_05_BV_1 #For each enrolment request, the ITS-S shall generate a new verification key pair corresponding to an approved signature algorithm as specified in TS 103 097 -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_06_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_06_BV_1 +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_06_BV_1 # Within the InnerECRequest, the requestedSubjectAttributes shall not contain a certIssuePermissions field -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_07_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_07_BV # In the headerInfo of the tbsData of the InnerECRequestSignedForPOP all other components of the component tbsdata.headerInfo except generationTime and psid are not used and absent. The psid shall be set to "secured certificate request" as assigned in ETSI TS 102 965 and the generationTime shall be present -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_08_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_08_BV_1 +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_08_BV_2 # In the headerInfo of the tbsData of the outer EtsiTs102941Data-Signed all other components of the component tbsdata.headerInfo except generationTime and psid are not used and absent. The psid shall be set to "secured certificate request" as assigned in ETSI TS 102 965 and the generationTime shall be present -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_09_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_09_BV_1 +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_09_BV_2 # The EtsiTs103097Data-Encrypted containing the correctly encrypted ciphertext and a recipients component containing one instance of RecipientInfo of choice certRecipInfo containing the hashedId8 of the EA certificate in recipientId and the encrypted data encryption key in encKey. The data encryption key is encrypted using the public key found in the EA certificate referenced in the recipientId -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_10_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_10_BV # In the inner signed data structure (InnerECRequestSignedForPOP), the signature is computed on InnerECRequest with the private key corresponding to the new verificationKey to prove possession of the generated verification key pair -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_11_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_11_BV # Check that signing of Enrolment HttpRequest message is permitted by the EC certificate -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_12_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_12_BV # If an enrolment request fails, the IUT returns to the state 'initialized -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_RECV_01_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_RECV_01_BV # The IUT is capable of parsing and handling of positive EnrolmentResponse messages containing the requested EC. In case of a successful enrolment, the IUT switches to the state 'enrolled' -#ItsPki_TestCases.TC_SECPKI_ITSS_ENR_RECV_02_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_ENR_RECV_02_BV # Check that the ITS-S send the Authorization HttpRequest message to the Authorization Authority (AA) to request an authorization ticket -ItsPki_TestCases.TC_SECPKI_ITSS_AUTH_01_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_AUTH_01_BV # Check that the AuthorizationRequest message is encrypted and sent to only one Authorization Authority -#ItsPki_TestCases.TC_SECPKI_ITSS_AUTH_02_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_AUTH_02_BV # Check that the AuthorizationRequest message is encrypted using the encryptionKey found in the AA certificate referenced in recipientId -#ItsPki_TestCases.TC_SECPKI_ITSS_AUTH_03_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_AUTH_03_BV # Check that the AuthorizationRequest message is never reused the same encryption key and nonce -#ItsPki_TestCases.TC_SECPKI_ITSS_AUTH_04_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_AUTH_04_BV # Check that the Authozation request protocol version is set to 1 -#ItsPki_TestCases.TC_SECPKI_ITSS_AUTH_05_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_AUTH_05_BV # Check that IUT repeats an authorization request when response has not been received -#ItsPki_TestCases.TC_SECPKI_ITSS_AUTH_REP_01_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_AUTH_REP_01_BV # Check that IUT uses the same message to perform authorization retry -#ItsPki_TestCases.TC_SECPKI_ITSS_AUTH_REP_02_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_AUTH_REP_02_BV # Check that IUT stops sending the Authorization Request message if Authorization Response message has been received -#ItsPki_TestCases.TC_SECPKI_ITSS_AUTH_REP_03_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_AUTH_REP_03_BV # Check that IUT stops sending the Authorization Request message if maximum number of retry has been reached -#ItsPki_TestCases.TC_SECPKI_ITSS_AUTH_REP_04_BV +#ItsPkiItss_TestCases.TC_SECPKI_ITSS_AUTH_REP_04_BV # Check that the ITS-S send the EtsiTs103097Data to the Enrollment Authority (EA) to request a batch of authorization tickets # Check that this message is encrypted and addressed to a single recipient diff --git a/titan-test-system-framework b/titan-test-system-framework index e27aaa8..6959b8b 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit e27aaa847f49a1e459f427abc3620ef7a40223ca +Subproject commit 6959b8be419f3755de6f888e24bfdc8de07383a7 diff --git a/ttcn/LibCommon b/ttcn/LibCommon index 149e7d5..21bad7c 160000 --- a/ttcn/LibCommon +++ b/ttcn/LibCommon @@ -1 +1 @@ -Subproject commit 149e7d5cc1fc2252f2100f25bb06c72245529143 +Subproject commit 21bad7c51917d19bebdff5b36983e22922421976 diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn index 366ba08..a133bb3 100644 --- a/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn +++ b/ttcn/patch_lib_http/ttcn/LibHttp_BinaryMessageBodyTypes.ttcn @@ -23,9 +23,15 @@ module LibHttp_BinaryMessageBodyTypes { import from Ieee1609Dot2 language "ASN.1:1997" all; import from EtsiTs103097Module language "ASN.1:1997" all; + type record BfkZipEntry { + charstring name, + Ieee1609Dot2Data signed_message + } + type record of BfkZipEntry BfkZipEntries; + type union BfkZipFileContent { - record of Ieee1609Dot2Data signed_messages, - octetstring raw + BfkZipEntries signed_messages, + octetstring raw } with { variant ""; encode "RAW" -- GitLab From 6f2a9d27ae728d40f79c0acd8e40463930105d3a Mon Sep 17 00:00:00 2001 From: garciay Date: Fri, 14 Jun 2024 08:43:22 +0200 Subject: [PATCH 126/178] Update ATS submodules --- .gitmodules | 14 ++--- TS.ITS_TTF_T036.code-workspace | 104 +++++++++++++++++++++++++++++++++ switch_its_r2.sh | 44 ++++++++------ titan-test-system-framework | 2 +- ttcn/AtsCAM | 2 +- ttcn/AtsDENM | 2 +- ttcn/AtsIS | 2 +- ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- 9 files changed, 142 insertions(+), 32 deletions(-) create mode 100644 TS.ITS_TTF_T036.code-workspace diff --git a/.gitmodules b/.gitmodules index 08c7ef1..10d7455 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,19 +8,19 @@ [submodule "ttcn/AtsCAM"] path = ttcn/AtsCAM url = https://forge.etsi.org/rep/ITS/ttcn/ats_cam_ts102868-3.git - branch = devel2 + branch = TTF_T036 [submodule "ttcn/AtsDENM"] path = ttcn/AtsDENM url = https://forge.etsi.org/rep/ITS/ttcn/ats_denm_ts102869-3.git - branch = devel2 + branch = TTF_T036 [submodule "ttcn/AtsGeoNetworking"] path = ttcn/AtsGeoNetworking url = https://forge.etsi.org/rep/ITS/ttcn/ats_gn_ts102871-3.git - branch = devel2 + branch = TTF_T036 [submodule "ttcn/AtsBTP"] path = ttcn/AtsBTP url = https://forge.etsi.org/rep/ITS/ttcn/ats_btp_ts102870-3.git - branch = devel + branch = TTF_T036 [submodule "ttcn/AtsIPv6OverGeoNetworking"] path = ttcn/AtsIPv6OverGeoNetworking url = https://forge.etsi.org/rep/ITS/ttcn/ats_gnipv6_ts102859-3.git @@ -28,15 +28,15 @@ [submodule "ttcn/AtsPki"] path = ttcn/AtsPki url = https://forge.etsi.org/rep/ITS/ttcn/ats_pki_ts103525-3.git - branch = devel2 + branch = TTF_T036 [submodule "ttcn/AtsIS"] path = ttcn/AtsIS url = https://forge.etsi.org/rep/ITS/ttcn/ats_ts103191-3.git - branch = devel2 + branch = TTF_T036 [submodule "ttcn/AtsSecurity"] path = ttcn/AtsSecurity url = https://forge.etsi.org/rep/ITS/ttcn/ats_sec_ts103096-3.git - branch = devel2 + branch = TTF_T036 [submodule "ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module"] path = ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module url = https://gitlab.eclipse.org/eclipse/titan/titan.TestPorts.Common_Components.Abstract_Socket diff --git a/TS.ITS_TTF_T036.code-workspace b/TS.ITS_TTF_T036.code-workspace new file mode 100644 index 0000000..a4ad12b --- /dev/null +++ b/TS.ITS_TTF_T036.code-workspace @@ -0,0 +1,104 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "../itsreadjs" + }, + { + "path": "../EtsiTs103759js" + }, + { + "path": "../itscertgen-r2" + }, + { + "path": "../../tmp/crypto-test-vectors" + }, + { + "path": "../../frameworks/openssl" + }, + { + "path": "../../frameworks/titan/titan.core" + }, + { + "path": "../../frameworks/fsmsggen" + } + ], + "settings": { + "files.associations": { + "array": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "cctype": "cpp", + "chrono": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "condition_variable": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "map": "cpp", + "unordered_map": "cpp", + "vector": "cpp", + "exception": "cpp", + "fstream": "cpp", + "functional": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "memory": "cpp", + "mutex": "cpp", + "new": "cpp", + "optional": "cpp", + "ostream": "cpp", + "ratio": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "thread": "cpp", + "type_traits": "cpp", + "tuple": "cpp", + "typeinfo": "cpp", + "utility": "cpp", + "atomic": "cpp", + "bitset": "cpp", + "codecvt": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstring": "cpp", + "algorithm": "cpp", + "filesystem": "cpp", + "iterator": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "random": "cpp", + "regex": "cpp", + "set": "cpp", + "shared_mutex": "cpp", + "cinttypes": "cpp", + "*.inc": "c", + "provider.h": "c", + "sizes.h": "c", + "compare": "cpp", + "complex": "cpp", + "concepts": "cpp", + "list": "cpp", + "numbers": "cpp", + "semaphore": "cpp", + "stop_token": "cpp", + "hash_map": "cpp" + }, + "java.compile.nullAnalysis.mode": "automatic" + } +} \ No newline at end of file diff --git a/switch_its_r2.sh b/switch_its_r2.sh index 4a7c63c..168d2dd 100755 --- a/switch_its_r2.sh +++ b/switch_its_r2.sh @@ -1,38 +1,45 @@ #!/bin/bash -#set -e +#set -e # git checkout wil raise error when branch does not exist set -vx BASE_PATH=`pwd` -git checkout ttf_t024 +git checkout TTF_T036 git submodule update --init --recursive --remote for i in `find $BASE_PATH/ttcn -type d -name "Ats*"` do cd $i - git checkout devel2 + git checkout TTF_T036 done + for i in `find $BASE_PATH/ttcn/Ats* -type d -name "asn1"` do cd $i - git checkout testing2 + git checkout TTF_T036 if [ -f ETSI-ITS-CDD.asn ] then - ln -sf ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn + ln ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn + elif [ -f CAM-PDU-Descriptions.asn ] + then + ln CAM-PDU-Descriptions.asn CAM_PDU_Descriptions.asn + elif [ -f DENM-PDU-Description.asn ] + then + ln DENM-PDU-Description.asn DENM_PDU_Description.asn elif [ -f IVIM-PDU-Descriptions.asn ] then - ln -sf IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn - ln -sf MAPEM-PDU-Descriptions.asn MAPEM_PDU_Descriptions.asn - ln -sf RTCMEM-PDU-Descriptions.asn RTCMEM_PDU_Descriptions.asn - ln -sf SPATEM-PDU-Descriptions.asn SPATEM_PDU_Descriptions.asn - ln -sf SREM-PDU-Descriptions.asn SREM_PDU_Descriptions.asn - ln -sf SSEM-PDU-Descriptions.asn SSEM_PDU_Descriptions.asn - cd ./iso-patched - ln -sf 'ISO14906(2018)EfcDsrcApplicationv6-patched.asn' EfcDsrcApplication.asn - ln -sf 'ISO14906(2018)EfcDsrcGenericv7-patched.asn' EfcDsrcGeneric.asn - ln -sf ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn ElectronicRegistrationIdentificationVehicleDataModule.asn - ln -sf ISO14823-missing.asn GDD.asn + ln IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn + ln MAPEM-PDU-Descriptions.asn MAPEM_PDU_Descriptions.asn + ln RTCMEM-PDU-Descriptions.asn RTCMEM_PDU_Descriptions.asn + ln SPATEM-PDU-Descriptions.asn SPATEM_PDU_Descriptions.asn + ln SREM-PDU-Descriptions.asn SREM_PDU_Descriptions.asn + ln SSEM-PDU-Descriptions.asn SSEM_PDU_Descriptions.asn + #cd ./iso-patched + #ln 'ISO14906(2018)EfcDsrcApplicationv6-patched.asn' EfcDsrcApplication.asn + #ln 'ISO14906(2018)EfcDsrcGenericv7-patched.asn' EfcDsrcGeneric.asn + #ln ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn ElectronicRegistrationIdentificationVehicleDataModule.asn + #ln ISO14823-missing.asn GDD.asn cd - fi SUB_DIRS=`find . -type d` @@ -41,7 +48,7 @@ do for j in $SUB_DIRS do cd $j - git checkout testing2 + git checkout release2 cd - done fi @@ -63,7 +70,6 @@ cd $BASE_PATH/ttcn/LibIts git checkout devel2 cd $BASE_PATH -ln ./ttcn/patch_lib_common_titan/module.mk ./ttcn/LibCommon/\ - +ln ./ttcn/patch_lib_common_titan/module.mk ./ttcn/LibCommon/module.mk exit 0 diff --git a/titan-test-system-framework b/titan-test-system-framework index 6959b8b..c579f7c 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit 6959b8be419f3755de6f888e24bfdc8de07383a7 +Subproject commit c579f7c7175b34426e8392e1edd3885c4b9cd185 diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 431b028..3ca9b8c 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 431b0284e7b2d7edc8b486b0ad823aceb90a44eb +Subproject commit 3ca9b8c3f25ea9a0d025e25098eacbe4560cb7b3 diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index 1800c76..8587c41 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit 1800c762a7dbc5b6edbd8442b1e196035ff29bbc +Subproject commit 8587c41526560c3a4d9986986dc217ad3464a9c1 diff --git a/ttcn/AtsIS b/ttcn/AtsIS index 4a3ccd7..cb49fba 160000 --- a/ttcn/AtsIS +++ b/ttcn/AtsIS @@ -1 +1 @@ -Subproject commit 4a3ccd7075a263116a3bed5a2450d63830dcf35a +Subproject commit cb49fba11f3bfcda41223d46fdd263bee39364f1 diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 1939df8..8f1f30c 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 1939df824bb1880f920231524d5cc35c9470b62b +Subproject commit 8f1f30c6312ead921621f56edfafd0a5f2ee0819 diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index f14617d..e386ee0 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit f14617db8925bd088a4e657cf0850ce9066bfa04 +Subproject commit e386ee07a443b12755961acff2353f3581fce93d -- GitLab From 0e3f0a6bf2b860153a6edcb55974b6c9623b4afb Mon Sep 17 00:00:00 2001 From: garciay Date: Fri, 14 Jun 2024 10:00:52 +0200 Subject: [PATCH 127/178] Rebuild AtsCAM full Release 2 --- switch_its_r2.sh | 15 ++++++++++----- ttcn/AtsCAM | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/switch_its_r2.sh b/switch_its_r2.sh index 168d2dd..88e0630 100755 --- a/switch_its_r2.sh +++ b/switch_its_r2.sh @@ -3,21 +3,22 @@ #set -e # git checkout wil raise error when branch does not exist set -vx +BRANCH=TTF_T036 BASE_PATH=`pwd` -git checkout TTF_T036 -git submodule update --init --recursive --remote +#git checkout $BRANCH +#git submodule update --init --recursive --remote for i in `find $BASE_PATH/ttcn -type d -name "Ats*"` do cd $i - git checkout TTF_T036 + git checkout $BRANCH done for i in `find $BASE_PATH/ttcn/Ats* -type d -name "asn1"` do cd $i - git checkout TTF_T036 + git checkout $BRANCH if [ -f ETSI-ITS-CDD.asn ] then ln ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn @@ -48,7 +49,11 @@ do for j in $SUB_DIRS do cd $j - git checkout release2 + git checkout $BRANCH + if [ -f ETSI-ITS-CDD.asn ] + then + ln ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn + fi cd - done fi diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 3ca9b8c..ce4a954 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 3ca9b8c3f25ea9a0d025e25098eacbe4560cb7b3 +Subproject commit ce4a954b18ab02336f295f19fc5e4a95b6c72eca -- GitLab From 9eea2694eae1a6d559e8f7e8d0ffe22364ef815f Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 18 Jun 2024 08:16:52 +0200 Subject: [PATCH 128/178] Rebuild AtsDENM full Release 2 --- ccsrc/Ports/LibIts_ports/module.mk | 2 +- ccsrc/Protocols/BTP/btp_types.hh | 4 ++-- ccsrc/Protocols/BTP_layers/btp_layer.hh | 4 ++-- ccsrc/Protocols/BTP_layers/btp_layer_factory.hh | 4 ++-- ccsrc/Protocols/CAM/cam_types.hh | 4 ++-- ccsrc/Protocols/CAM_layers/cam_layer.hh | 4 ++-- ccsrc/Protocols/CAM_layers/cam_layer_factory.hh | 4 ++-- ccsrc/Protocols/DENM/denm_types.hh | 4 ++-- ccsrc/Protocols/DENM_layers/denm_layer.hh | 4 ++-- ccsrc/Protocols/DENM_layers/denm_layer_factory.hh | 4 ++-- ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh | 4 ++-- .../GeoNetworking/geonetworking_layer_factory.hh | 4 ++-- ccsrc/Protocols/GeoNetworking/geonetworking_types.hh | 4 ++-- ccsrc/Protocols/GeoNetworking/location_table.hh | 4 ++-- ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc | 8 ++++---- switch_its_r2.sh | 6 +++--- 16 files changed, 34 insertions(+), 34 deletions(-) diff --git a/ccsrc/Ports/LibIts_ports/module.mk b/ccsrc/Ports/LibIts_ports/module.mk index bff5c86..9cc7785 100644 --- a/ccsrc/Ports/LibIts_ports/module.mk +++ b/ccsrc/Ports/LibIts_ports/module.mk @@ -1 +1 @@ -includes := . \ No newline at end of file +includes := . \ No newline at end of file diff --git a/ccsrc/Protocols/BTP/btp_types.hh b/ccsrc/Protocols/BTP/btp_types.hh index 59097c6..46269ad 100644 --- a/ccsrc/Protocols/BTP/btp_types.hh +++ b/ccsrc/Protocols/BTP/btp_types.hh @@ -1,12 +1,12 @@ /*! * \file btp_types.hh * \brief Header file for TITAN BTP types. - * \author ETSI STF525 + * \author ETSI STF525 // TTF T036 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. - * \version 0.1 + * \version ETSI EN 302 636-5-1 V2.2.1 */ #pragma once diff --git a/ccsrc/Protocols/BTP_layers/btp_layer.hh b/ccsrc/Protocols/BTP_layers/btp_layer.hh index 1d31dae..51aa078 100644 --- a/ccsrc/Protocols/BTP_layers/btp_layer.hh +++ b/ccsrc/Protocols/BTP_layers/btp_layer.hh @@ -1,12 +1,12 @@ /*! * \file btp_layer.hh * \brief Header file for ITS BTP protocol layer. - * \author ETSI STF525 + * \author ETSI STF525 / TTF T036 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. - * \version 0.1 + * \version ETSI EN 302 636-5-1 V2.2.1 */ #pragma once diff --git a/ccsrc/Protocols/BTP_layers/btp_layer_factory.hh b/ccsrc/Protocols/BTP_layers/btp_layer_factory.hh index e2fa996..57931a0 100644 --- a/ccsrc/Protocols/BTP_layers/btp_layer_factory.hh +++ b/ccsrc/Protocols/BTP_layers/btp_layer_factory.hh @@ -1,12 +1,12 @@ /*! * \file btp_layer_factory.hh * \brief Header file for ITS BTP protocol layer factory. - * \author ETSI STF525 + * \author ETSI STF525 / TTF T036 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. - * \version 0.1 + * \version ETSI EN 302 636-5-1 V2.2.1 */ #pragma once diff --git a/ccsrc/Protocols/CAM/cam_types.hh b/ccsrc/Protocols/CAM/cam_types.hh index b561fac..7403845 100644 --- a/ccsrc/Protocols/CAM/cam_types.hh +++ b/ccsrc/Protocols/CAM/cam_types.hh @@ -1,12 +1,12 @@ /*! * \file cam_types.hh * \brief Header file for TITAN CAM types. - * \author ETSI STF525 + * \author ETSI STF525 / TTF T036 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. - * \version 0.1 + * \version ETSI TS 103 900 v2.1.1 */ #pragma once diff --git a/ccsrc/Protocols/CAM_layers/cam_layer.hh b/ccsrc/Protocols/CAM_layers/cam_layer.hh index 97e5461..6261aa7 100644 --- a/ccsrc/Protocols/CAM_layers/cam_layer.hh +++ b/ccsrc/Protocols/CAM_layers/cam_layer.hh @@ -1,12 +1,12 @@ /*! * \file cam_layer.hh * \brief Header file for ITS CAM protocol layer. - * \author ETSI STF525 + * \author ETSI STF525 / TTF T036 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. - * \version 0.1 + * \version ETSI TS 103 900 v2.1.1 */ #pragma once diff --git a/ccsrc/Protocols/CAM_layers/cam_layer_factory.hh b/ccsrc/Protocols/CAM_layers/cam_layer_factory.hh index 07b7862..e8ca7ad 100644 --- a/ccsrc/Protocols/CAM_layers/cam_layer_factory.hh +++ b/ccsrc/Protocols/CAM_layers/cam_layer_factory.hh @@ -1,12 +1,12 @@ /*! * \file cam_layer_factory.hh * \brief Header file for ITS CAM protocol layer factory. - * \author ETSI STF525 + * \author ETSI STF525 / TTF T036 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. - * \version 0.1 + * \version ETSI TS 103 900 v2.1.1 */ #pragma once diff --git a/ccsrc/Protocols/DENM/denm_types.hh b/ccsrc/Protocols/DENM/denm_types.hh index 3db592e..a98781b 100644 --- a/ccsrc/Protocols/DENM/denm_types.hh +++ b/ccsrc/Protocols/DENM/denm_types.hh @@ -1,12 +1,12 @@ /*! * \file denm_types.hh * \brief Header file for TITAN DENM types. - * \author ETSI STF525 + * \author ETSI STF525 / TTF T036 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. - * \version 0.1 + * \version ETSI TS 103 831 v2.1.1 */ #pragma once diff --git a/ccsrc/Protocols/DENM_layers/denm_layer.hh b/ccsrc/Protocols/DENM_layers/denm_layer.hh index 46f1a1e..6390fa4 100644 --- a/ccsrc/Protocols/DENM_layers/denm_layer.hh +++ b/ccsrc/Protocols/DENM_layers/denm_layer.hh @@ -1,12 +1,12 @@ /*! * \file denm_layer.hh * \brief Header file for ITS DENM protocol layer. - * \author ETSI STF525 + * \author ETSI STF525 / TTF T036 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. - * \version 0.1 + * \version ETSI TS 103 831 v2.1.1 */ #pragma once diff --git a/ccsrc/Protocols/DENM_layers/denm_layer_factory.hh b/ccsrc/Protocols/DENM_layers/denm_layer_factory.hh index e60b981..ba4d5d6 100644 --- a/ccsrc/Protocols/DENM_layers/denm_layer_factory.hh +++ b/ccsrc/Protocols/DENM_layers/denm_layer_factory.hh @@ -1,12 +1,12 @@ /*! * \file denm_layer_factory.hh * \brief Header file for ITS DENM protocol layer factory. - * \author ETSI STF525 + * \author ETSI STF525 / TTF T036 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. - * \version 0.1 + * \version ETSI TS 103 831 v2.1.1 */ #pragma once diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh index 68d9365..56eb368 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.hh @@ -1,12 +1,12 @@ /*! * \file geonetworking_layer.hh * \brief Header file for ITS GeoNetworking protocol layer. - * \author ETSI STF525 + * \author ETSI STF525 / TTF T036 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. - * \version 0.1 + * \version ETSI TS 103 836-4-1 V2.1.1 */ #pragma once diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer_factory.hh b/ccsrc/Protocols/GeoNetworking/geonetworking_layer_factory.hh index 7a79acb..cdb3298 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer_factory.hh +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer_factory.hh @@ -1,12 +1,12 @@ /*! * \file geonetworking_layer_factory.hh * \brief Header file for ITS GeoNetworking protocol layer factory. - * \author ETSI STF525 + * \author ETSI STF525 / TTF T039 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. - * \version 0.1 + * \version ETSI TS 103 836-4-1 V2.1.1 */ #pragma once diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_types.hh b/ccsrc/Protocols/GeoNetworking/geonetworking_types.hh index 406cfe3..6f234f4 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_types.hh +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_types.hh @@ -1,12 +1,12 @@ /*! * \file geonetworking_types.hh * \brief Header file for TITAN GeoNetworking types. - * \author ETSI STF525 + * \author ETSI STF525 / TTF T036 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. - * \version 0.1 + * \version ETSI TS 103 836-4-1 V2.1.1 */ #pragma once diff --git a/ccsrc/Protocols/GeoNetworking/location_table.hh b/ccsrc/Protocols/GeoNetworking/location_table.hh index aa038eb..ce58dc8 100644 --- a/ccsrc/Protocols/GeoNetworking/location_table.hh +++ b/ccsrc/Protocols/GeoNetworking/location_table.hh @@ -1,12 +1,12 @@ /*! * \file location_table.hh * \brief Header file for GeoNetworking location table definition. - * \author ETSI STF525 + * \author ETSI STF525 / TTF T036 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. - * \version 0.1 + * \version ETSI TS 103 836-4-1 V2.1.1 */ #pragma once diff --git a/ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc index 8869130..986eef6 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc @@ -45,10 +45,10 @@ int uppertester_denm_codec::encode(const Record_Type &msg, OCTETSTRING &data) { if (r.validityDuration().is_present()) { // V flags |= 0x80; } - if (r.repetitionDuration().is_present()) { // R + if (r.awarenessDistance().is_present()) { // R flags |= 0x40; } - if (r.relevanceTrafficDirection().is_present()) { // T + if (r.trafficDirection().is_present()) { // T flags |= 0x10; } if (r.transmissionInterval().is_present()) { // K @@ -71,10 +71,10 @@ int uppertester_denm_codec::encode(const Record_Type &msg, OCTETSTRING &data) { if (r.situation().is_present()) { // S flags |= 0x40; } - if (r.relevanceDistance().is_present()) { // D + if (r.awarenessDistance().is_present()) { // D flags |= 0x20; } - if (r.relevanceTrafficDirection().is_present()) { // T + if (r.trafficDirection().is_present()) { // T flags |= 0x10; } // TODO Check TTCN-3 code, it's missing diff --git a/switch_its_r2.sh b/switch_its_r2.sh index 88e0630..00ccb9d 100755 --- a/switch_its_r2.sh +++ b/switch_its_r2.sh @@ -25,9 +25,9 @@ do elif [ -f CAM-PDU-Descriptions.asn ] then ln CAM-PDU-Descriptions.asn CAM_PDU_Descriptions.asn - elif [ -f DENM-PDU-Description.asn ] + elif [ -f DENM-PDU-Descriptions.asn ] then - ln DENM-PDU-Description.asn DENM_PDU_Description.asn + ln DENM-PDU-Descriptions.asn DENM_PDU_Descriptions.asn elif [ -f IVIM-PDU-Descriptions.asn ] then ln IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn @@ -52,7 +52,7 @@ do git checkout $BRANCH if [ -f ETSI-ITS-CDD.asn ] then - ln ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn + ln ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn fi cd - done -- GitLab From bc197d4d2a9112845dbfca3a4d1511d7375d10bc Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 18 Jun 2024 08:21:26 +0200 Subject: [PATCH 129/178] Add ttcn/AtsCPS and ttcn/AtsVRU submodules --- .gitmodules | 8 ++++++++ ttcn/AtsCPS | 1 + ttcn/AtsVRU | 1 + 3 files changed, 10 insertions(+) create mode 160000 ttcn/AtsCPS create mode 160000 ttcn/AtsVRU diff --git a/.gitmodules b/.gitmodules index 10d7455..761312b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -48,3 +48,11 @@ path = ttcn/AtsMBR url = https://forge.etsi.org/rep/ITS/ttcn/mbr_ts_103759.git branch = devel2 +[submodule "ttcn/AtsVRU"] + path = ttcn/AtsVRU + url = https://forge.etsi.org/rep/ITS/ttcn/vru-ts-104-018-3.git + branch = TTF_T036 +[submodule "ttcn/AtsCPS"] + path = ttcn/AtsCPS + url = https://forge.etsi.org/rep/ITS/ttcn/cps-ts-104-019-3.git + branch = TTF_T036 diff --git a/ttcn/AtsCPS b/ttcn/AtsCPS new file mode 160000 index 0000000..2ca30f6 --- /dev/null +++ b/ttcn/AtsCPS @@ -0,0 +1 @@ +Subproject commit 2ca30f6c9fe5afa04eeed7042a4c55c593f7bca4 diff --git a/ttcn/AtsVRU b/ttcn/AtsVRU new file mode 160000 index 0000000..01e4c03 --- /dev/null +++ b/ttcn/AtsVRU @@ -0,0 +1 @@ +Subproject commit 01e4c037b2365683df9c0a96a5db145dc92eaa1f -- GitLab From ecb0b608d6ae1ec3184dba66c164f6f714d03eb8 Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 18 Jun 2024 09:07:28 +0200 Subject: [PATCH 130/178] Add CPS test system components --- ccsrc/EncDec/LibItsCps_Encdec.cc | 0 ccsrc/EncDec/module.mk | 6 ++++++ .../LibIts_ports/CPS_ports/AdapterControlPort_CPS.cc | 0 .../LibIts_ports/CPS_ports/AdapterControlPort_CPS.hh | 0 ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.cc | 0 ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.hh | 0 .../LibIts_ports/CPS_ports/UpperTesterPort_CPS.cc | 0 .../LibIts_ports/CPS_ports/UpperTesterPort_CPS.hh | 0 ccsrc/Ports/LibIts_ports/CPS_ports/module.mk | 3 +++ ccsrc/Ports/LibIts_ports/UpperTesterPort.hh | 12 ++++++++++++ ccsrc/Protocols/CPS/cps_codec.cc | 0 ccsrc/Protocols/CPS/cps_codec.hh | 0 ccsrc/Protocols/CPS/cps_pdu_codec.cc | 0 ccsrc/Protocols/CPS/cps_pdu_codec.hh | 0 ccsrc/Protocols/CPS/cps_types.hh | 0 ccsrc/Protocols/CPS/module.mk | 2 ++ ccsrc/Protocols/CPS_layers/cps_layer.cc | 0 ccsrc/Protocols/CPS_layers/cps_layer.hh | 0 ccsrc/Protocols/CPS_layers/cps_layer_factory.hh | 0 ccsrc/Protocols/CPS_layers/module.mk | 2 ++ switch_its_r2.sh | 7 +++++++ ttcn/AtsCAM | 2 +- ttcn/AtsCPS | 2 +- ttcn/AtsDENM | 2 +- 24 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 ccsrc/EncDec/LibItsCps_Encdec.cc create mode 100644 ccsrc/Ports/LibIts_ports/CPS_ports/AdapterControlPort_CPS.cc create mode 100644 ccsrc/Ports/LibIts_ports/CPS_ports/AdapterControlPort_CPS.hh create mode 100644 ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.cc create mode 100644 ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.hh create mode 100644 ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.cc create mode 100644 ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.hh create mode 100644 ccsrc/Ports/LibIts_ports/CPS_ports/module.mk create mode 100644 ccsrc/Protocols/CPS/cps_codec.cc create mode 100644 ccsrc/Protocols/CPS/cps_codec.hh create mode 100644 ccsrc/Protocols/CPS/cps_pdu_codec.cc create mode 100644 ccsrc/Protocols/CPS/cps_pdu_codec.hh create mode 100644 ccsrc/Protocols/CPS/cps_types.hh create mode 100644 ccsrc/Protocols/CPS/module.mk create mode 100644 ccsrc/Protocols/CPS_layers/cps_layer.cc create mode 100644 ccsrc/Protocols/CPS_layers/cps_layer.hh create mode 100644 ccsrc/Protocols/CPS_layers/cps_layer_factory.hh create mode 100644 ccsrc/Protocols/CPS_layers/module.mk diff --git a/ccsrc/EncDec/LibItsCps_Encdec.cc b/ccsrc/EncDec/LibItsCps_Encdec.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/EncDec/module.mk b/ccsrc/EncDec/module.mk index 18f4be8..4d3fb6b 100644 --- a/ccsrc/EncDec/module.mk +++ b/ccsrc/EncDec/module.mk @@ -63,3 +63,9 @@ sources += \ LibItsMbr_Encdec.cc \ LibItsCam_Encdec.cc endif + +ifeq (AtsCPS, $(ATS)) +sources += LibItsCps_Encdec.cc \ + LibItsBtp_Encdec.cc +endif + diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/AdapterControlPort_CPS.cc b/ccsrc/Ports/LibIts_ports/CPS_ports/AdapterControlPort_CPS.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/AdapterControlPort_CPS.hh b/ccsrc/Ports/LibIts_ports/CPS_ports/AdapterControlPort_CPS.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.cc b/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.hh b/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.cc b/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.hh b/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/module.mk b/ccsrc/Ports/LibIts_ports/CPS_ports/module.mk new file mode 100644 index 0000000..aab1deb --- /dev/null +++ b/ccsrc/Ports/LibIts_ports/CPS_ports/module.mk @@ -0,0 +1,3 @@ +sources := AdapterControlPort_CAM.cc CamPort.cc UpperTesterPort_CAM.cc +includes := . + diff --git a/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh b/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh index 82e0da2..f5d28ee 100644 --- a/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh +++ b/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh @@ -61,6 +61,12 @@ #include "GN_ports/UpperTesterPort_GN.hh" #endif +#ifdef AtsCPS +#include "BTP_ports/UpperTesterPort_BTP.hh" +#include "CAM_ports/UpperTesterPort_CPS.hh" +#include "GN_ports/UpperTesterPort_GN.hh" +#endif + #ifdef AtsRSUsSimulator // This is not an Abstract Test Suit, but an helper tool to simulate basic RSU/OBU functionalities #include "BTP_ports/UpperTesterPort_BTP.hh" #include "CAM_ports/UpperTesterPort_CAM.hh" @@ -140,6 +146,12 @@ #include "UpperTesterPort_SremSsem.hh" #endif +#ifdef AtsCPS +#include "UpperTesterPort_BTP.hh" +#include "UpperTesterPort_CPS.hh" +#include "UpperTesterPort_GN.hh" +#endif + #endif //_NO_SOFTLINKS_ #endif diff --git a/ccsrc/Protocols/CPS/cps_codec.cc b/ccsrc/Protocols/CPS/cps_codec.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/CPS/cps_codec.hh b/ccsrc/Protocols/CPS/cps_codec.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/CPS/cps_pdu_codec.cc b/ccsrc/Protocols/CPS/cps_pdu_codec.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/CPS/cps_pdu_codec.hh b/ccsrc/Protocols/CPS/cps_pdu_codec.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/CPS/cps_types.hh b/ccsrc/Protocols/CPS/cps_types.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/CPS/module.mk b/ccsrc/Protocols/CPS/module.mk new file mode 100644 index 0000000..4109227 --- /dev/null +++ b/ccsrc/Protocols/CPS/module.mk @@ -0,0 +1,2 @@ +sources := cps_codec.cc cps_pdu_codec.cc +includes := . diff --git a/ccsrc/Protocols/CPS_layers/cps_layer.cc b/ccsrc/Protocols/CPS_layers/cps_layer.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/CPS_layers/cps_layer.hh b/ccsrc/Protocols/CPS_layers/cps_layer.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/CPS_layers/cps_layer_factory.hh b/ccsrc/Protocols/CPS_layers/cps_layer_factory.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/CPS_layers/module.mk b/ccsrc/Protocols/CPS_layers/module.mk new file mode 100644 index 0000000..d9b97b7 --- /dev/null +++ b/ccsrc/Protocols/CPS_layers/module.mk @@ -0,0 +1,2 @@ +sources := cam_layer.cc +includes := . ../CAM ../GeoNetworking diff --git a/switch_its_r2.sh b/switch_its_r2.sh index 00ccb9d..7bc12be 100755 --- a/switch_its_r2.sh +++ b/switch_its_r2.sh @@ -28,6 +28,13 @@ do elif [ -f DENM-PDU-Descriptions.asn ] then ln DENM-PDU-Descriptions.asn DENM_PDU_Descriptions.asn + elif [ -f CPM-PDU-Descriptions.asn ] + then + ln CPM-PDU-Descriptions.asn CPM_PDU_Descriptions.asn + ln CPM-OriginatingStationContainers.asn CPM_OriginatingStationContainers.asn + ln CPM-PerceivedObjectContainer.asn CPM_PerceivedObjectContainer.asn + ln CPM-PerceptionRegionContainer.asn CPM_PerceptionRegionContainer.asn + ln CPM-SensorInformationContainer.asn CPM_SensorInformationContainer.asn elif [ -f IVIM-PDU-Descriptions.asn ] then ln IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index ce4a954..1615d38 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit ce4a954b18ab02336f295f19fc5e4a95b6c72eca +Subproject commit 1615d38e830f8b33d3abcbec83f8c038ac0f65c4 diff --git a/ttcn/AtsCPS b/ttcn/AtsCPS index 2ca30f6..81ff743 160000 --- a/ttcn/AtsCPS +++ b/ttcn/AtsCPS @@ -1 +1 @@ -Subproject commit 2ca30f6c9fe5afa04eeed7042a4c55c593f7bca4 +Subproject commit 81ff743ba0eddd0220aa12f59d269a792817a58e diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index 8587c41..3099a2d 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit 8587c41526560c3a4d9986986dc217ad3464a9c1 +Subproject commit 3099a2ddaf47a2731e9bd3accaf9223fa57ddd4d -- GitLab From be7ff287d6a2f265dd38d800f26b6569499f1c2a Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 18 Jun 2024 09:12:04 +0200 Subject: [PATCH 131/178] Reorganize scripts for installation --- switch_its_r2.sh => install.sh | 0 switch_its_r1.sh | 53 ---------------------------------- 2 files changed, 53 deletions(-) rename switch_its_r2.sh => install.sh (100%) delete mode 100755 switch_its_r1.sh diff --git a/switch_its_r2.sh b/install.sh similarity index 100% rename from switch_its_r2.sh rename to install.sh diff --git a/switch_its_r1.sh b/switch_its_r1.sh deleted file mode 100755 index edaa775..0000000 --- a/switch_its_r1.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -#set -e -set -vx - -BASE_PATH=`pwd` - -git checkout devel -git submodule update --init --recursive --remote - -cd $BASE_PATH/ttcn -git checkout devel - -for i in `find $BASE_PATH/ttcn -type d -name "Ats*"` -do - cd $i - git checkout devel -done -for i in `find $BASE_PATH/ttcn/Ats* -type d -name "asn1"` -do - cd $i - git checkout testing - SUB_DIRS=`find . -type d` - if [ "SUB_DIRS" != "" ] - then - for j in $SUB_DIRS - do - cd $j - git checkout testing - cd - - done - fi -done - -cd $BASE_PATH -if [ ! -d ./titan-test-system-framework ] -then - git clone --recurse-submodules --single-branch --branch devel https://labs.etsi.org/rep/cti-tools/titan-test-system-framework.git - cd ./titan-test-system-framework -else - cd ./titan-test-system-framework - git checkout devel -fi -cd ./ttcn/LibHttp -ln module_its.mk module.mk - -cd $BASE_PATH/ttcn/LibIts -git checkout devel - -cd $BASE_PATH -ln ./ttcn/patch_lib_common_titan/module.mk ./ttcn/LibCommon/ - -exit 0 -- GitLab From 185c99820b11141666feceeef0cfd288c955b9c2 Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 18 Jun 2024 10:23:26 +0200 Subject: [PATCH 132/178] Bug fixed in install.sh --- install.sh | 12 ++++++------ ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/install.sh b/install.sh index 7bc12be..ebfd23b 100755 --- a/install.sh +++ b/install.sh @@ -28,13 +28,13 @@ do elif [ -f DENM-PDU-Descriptions.asn ] then ln DENM-PDU-Descriptions.asn DENM_PDU_Descriptions.asn - elif [ -f CPM-PDU-Descriptions.asn ] + elif [ -f asn/CPM-PDU-Descriptions.asn ] then - ln CPM-PDU-Descriptions.asn CPM_PDU_Descriptions.asn - ln CPM-OriginatingStationContainers.asn CPM_OriginatingStationContainers.asn - ln CPM-PerceivedObjectContainer.asn CPM_PerceivedObjectContainer.asn - ln CPM-PerceptionRegionContainer.asn CPM_PerceptionRegionContainer.asn - ln CPM-SensorInformationContainer.asn CPM_SensorInformationContainer.asn + ln asn/CPM-PDU-Descriptions.asn asn/CPM_PDU_Descriptions.asn + ln asn/CPM-OriginatingStationContainers.asn asn/CPM_OriginatingStationContainers.asn + ln asn/CPM-PerceivedObjectContainer.asn asn/CPM_PerceivedObjectContainer.asn + ln asn/CPM-PerceptionRegionContainer.asn asn/CPM_PerceptionRegionContainer.asn + ln asn/CPM-SensorInformationContainer.asn asn/CPM_SensorInformationContainer.asn elif [ -f IVIM-PDU-Descriptions.asn ] then ln IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 8f1f30c..67550ac 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 8f1f30c6312ead921621f56edfafd0a5f2ee0819 +Subproject commit 67550aca15f062eebac99922714720f470b34f4b diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index e386ee0..408505b 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit e386ee07a443b12755961acff2353f3581fce93d +Subproject commit 408505b87182ffc12710caba7c77e822de60b002 -- GitLab From 3e72b588c4e60ccbc40111e2acbd8cd144e843dd Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 18 Jun 2024 10:57:31 +0200 Subject: [PATCH 133/178] Build AtsCPS --- ccsrc/Ports/LibIts_ports/CPS_ports/module.mk | 2 +- ccsrc/Ports/LibIts_ports/UpperTesterPort.hh | 2 +- ccsrc/Protocols/CPS_layers/module.mk | 4 ++-- ttcn/AtsCPS | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/module.mk b/ccsrc/Ports/LibIts_ports/CPS_ports/module.mk index aab1deb..e5a9e28 100644 --- a/ccsrc/Ports/LibIts_ports/CPS_ports/module.mk +++ b/ccsrc/Ports/LibIts_ports/CPS_ports/module.mk @@ -1,3 +1,3 @@ -sources := AdapterControlPort_CAM.cc CamPort.cc UpperTesterPort_CAM.cc +sources := AdapterControlPort_CPS.cc CpsPort.cc UpperTesterPort_CPS.cc includes := . diff --git a/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh b/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh index f5d28ee..bc6bdbf 100644 --- a/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh +++ b/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh @@ -63,7 +63,7 @@ #ifdef AtsCPS #include "BTP_ports/UpperTesterPort_BTP.hh" -#include "CAM_ports/UpperTesterPort_CPS.hh" +#include "CPS_ports/UpperTesterPort_CPS.hh" #include "GN_ports/UpperTesterPort_GN.hh" #endif diff --git a/ccsrc/Protocols/CPS_layers/module.mk b/ccsrc/Protocols/CPS_layers/module.mk index d9b97b7..a9360b9 100644 --- a/ccsrc/Protocols/CPS_layers/module.mk +++ b/ccsrc/Protocols/CPS_layers/module.mk @@ -1,2 +1,2 @@ -sources := cam_layer.cc -includes := . ../CAM ../GeoNetworking +sources := cps_layer.cc +includes := . ../CPS ../GeoNetworking diff --git a/ttcn/AtsCPS b/ttcn/AtsCPS index 81ff743..5b05801 160000 --- a/ttcn/AtsCPS +++ b/ttcn/AtsCPS @@ -1 +1 @@ -Subproject commit 81ff743ba0eddd0220aa12f59d269a792817a58e +Subproject commit 5b05801736ab1b9f7293a3f454b62ec1a7580b43 -- GitLab From b628dd926b198ba95ecb26db71bc1f4077d5e454 Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 18 Jun 2024 11:02:18 +0200 Subject: [PATCH 134/178] Add UpperTester for AtsCPS --- ccsrc/Externals/module.mk | 4 ++++ ccsrc/Protocols/UpperTester/module.mk | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ccsrc/Externals/module.mk b/ccsrc/Externals/module.mk index 4f64a36..fee1e2a 100644 --- a/ccsrc/Externals/module.mk +++ b/ccsrc/Externals/module.mk @@ -28,6 +28,10 @@ ifeq (AtsMBR, $(ATS)) sources += LibItsMbr_externals.cc LibItsSecurity_externals.cc endif +ifeq (AtsCPS, $(ATS)) +sources += LibItsSecurity_externals.cc +endif + ifeq (AtsGeoNetworking, $(ATS)) sources += LibItsSecurity_externals.cc endif diff --git a/ccsrc/Protocols/UpperTester/module.mk b/ccsrc/Protocols/UpperTester/module.mk index 027b1ef..50e9305 100644 --- a/ccsrc/Protocols/UpperTester/module.mk +++ b/ccsrc/Protocols/UpperTester/module.mk @@ -33,6 +33,10 @@ sources += uppertester_cam_codec.cc uppertester_cam_layer.cc \ endif +ifeq (AtsCPS, $(ATS)) +sources += uppertester_cps_codec.cc uppertester_cps_layer.cc +endif + ifeq (AtsRSUsSimulator, $(ATS)) sources += uppertester_cam_codec.cc uppertester_cam_layer.cc \ uppertester_denm_codec.cc uppertester_denm_layer.cc \ -- GitLab From a0324127f7932d9990f7a574c9e188fc8c42510d Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 18 Jun 2024 11:02:18 +0200 Subject: [PATCH 135/178] Add UpperTester for AtsCPS --- ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc | 0 ccsrc/Protocols/UpperTester/uppertester_cps_codec.hh | 0 ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc | 0 ccsrc/Protocols/UpperTester/uppertester_cps_layer.hh | 0 ccsrc/Protocols/UpperTester/uppertester_cps_layer_factory.hh | 0 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc create mode 100644 ccsrc/Protocols/UpperTester/uppertester_cps_codec.hh create mode 100644 ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc create mode 100644 ccsrc/Protocols/UpperTester/uppertester_cps_layer.hh create mode 100644 ccsrc/Protocols/UpperTester/uppertester_cps_layer_factory.hh diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_cps_codec.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_cps_layer.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_layer_factory.hh b/ccsrc/Protocols/UpperTester/uppertester_cps_layer_factory.hh new file mode 100644 index 0000000..e69de29 -- GitLab From 0ef389a75477b48c9c2aba79d4056f5496d59e28 Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 18 Jun 2024 13:58:29 +0200 Subject: [PATCH 136/178] Add AtsVRU Test System components --- ccsrc/EncDec/LibItsVru_Encdec.cc | 0 ccsrc/EncDec/module.mk | 5 +++++ ccsrc/Externals/module.mk | 4 ++++ ccsrc/Ports/LibIts_ports/AdapterControlPort.hh | 12 ++++++++++++ ccsrc/Ports/LibIts_ports/UpperTesterPort.hh | 12 ++++++++++++ .../LibIts_ports/VRU_ports/AdapterControlPort_VRU.cc | 0 .../LibIts_ports/VRU_ports/AdapterControlPort_VRU.hh | 0 .../LibIts_ports/VRU_ports/UpperTesterPort_VRU.cc | 0 .../LibIts_ports/VRU_ports/UpperTesterPort_VRU.hh | 0 ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.cc | 0 ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.hh | 0 ccsrc/Ports/LibIts_ports/VRU_ports/module.mk | 3 +++ ccsrc/Protocols/UpperTester/module.mk | 4 ++++ ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc | 0 ccsrc/Protocols/UpperTester/uppertester_vru_codec.hh | 0 ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc | 0 ccsrc/Protocols/UpperTester/uppertester_vru_layer.hh | 0 .../UpperTester/uppertester_vru_layer_factory.hh | 0 ccsrc/Protocols/VRU/module.mk | 2 ++ ccsrc/Protocols/VRU/vru_codec.cc | 0 ccsrc/Protocols/VRU/vru_codec.hh | 0 ccsrc/Protocols/VRU/vru_pdu_codec.cc | 0 ccsrc/Protocols/VRU/vru_pdu_codec.hh | 0 ccsrc/Protocols/VRU/vru_types.hh | 0 ccsrc/Protocols/VRU_layers/module.mk | 2 ++ ccsrc/Protocols/VRU_layers/vru_layer.cc | 0 ccsrc/Protocols/VRU_layers/vru_layer.hh | 0 ccsrc/Protocols/VRU_layers/vru_layer_factory.hh | 0 ttcn/AtsVRU | 2 +- 29 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 ccsrc/EncDec/LibItsVru_Encdec.cc create mode 100644 ccsrc/Ports/LibIts_ports/VRU_ports/AdapterControlPort_VRU.cc create mode 100644 ccsrc/Ports/LibIts_ports/VRU_ports/AdapterControlPort_VRU.hh create mode 100644 ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.cc create mode 100644 ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.hh create mode 100644 ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.cc create mode 100644 ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.hh create mode 100644 ccsrc/Ports/LibIts_ports/VRU_ports/module.mk create mode 100644 ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc create mode 100644 ccsrc/Protocols/UpperTester/uppertester_vru_codec.hh create mode 100644 ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc create mode 100644 ccsrc/Protocols/UpperTester/uppertester_vru_layer.hh create mode 100644 ccsrc/Protocols/UpperTester/uppertester_vru_layer_factory.hh create mode 100644 ccsrc/Protocols/VRU/module.mk create mode 100644 ccsrc/Protocols/VRU/vru_codec.cc create mode 100644 ccsrc/Protocols/VRU/vru_codec.hh create mode 100644 ccsrc/Protocols/VRU/vru_pdu_codec.cc create mode 100644 ccsrc/Protocols/VRU/vru_pdu_codec.hh create mode 100644 ccsrc/Protocols/VRU/vru_types.hh create mode 100644 ccsrc/Protocols/VRU_layers/module.mk create mode 100644 ccsrc/Protocols/VRU_layers/vru_layer.cc create mode 100644 ccsrc/Protocols/VRU_layers/vru_layer.hh create mode 100644 ccsrc/Protocols/VRU_layers/vru_layer_factory.hh diff --git a/ccsrc/EncDec/LibItsVru_Encdec.cc b/ccsrc/EncDec/LibItsVru_Encdec.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/EncDec/module.mk b/ccsrc/EncDec/module.mk index 4d3fb6b..f1f2013 100644 --- a/ccsrc/EncDec/module.mk +++ b/ccsrc/EncDec/module.mk @@ -69,3 +69,8 @@ sources += LibItsCps_Encdec.cc \ LibItsBtp_Encdec.cc endif +ifeq (AtsVRU, $(ATS)) +sources += LibItsVru_Encdec.cc \ + LibItsBtp_Encdec.cc +endif + diff --git a/ccsrc/Externals/module.mk b/ccsrc/Externals/module.mk index fee1e2a..b52c914 100644 --- a/ccsrc/Externals/module.mk +++ b/ccsrc/Externals/module.mk @@ -32,6 +32,10 @@ ifeq (AtsCPS, $(ATS)) sources += LibItsSecurity_externals.cc endif +ifeq (AtsVRU, $(ATS)) +sources += LibItsSecurity_externals.cc +endif + ifeq (AtsGeoNetworking, $(ATS)) sources += LibItsSecurity_externals.cc endif diff --git a/ccsrc/Ports/LibIts_ports/AdapterControlPort.hh b/ccsrc/Ports/LibIts_ports/AdapterControlPort.hh index e7d7ab1..1a02880 100644 --- a/ccsrc/Ports/LibIts_ports/AdapterControlPort.hh +++ b/ccsrc/Ports/LibIts_ports/AdapterControlPort.hh @@ -28,6 +28,12 @@ #ifdef LibItsV2G__TestSystem_HH #include "V2G_ports/AdapterControlPort_V2G.hh" #endif +#ifdef LibItsVru__TestSystem_HH +#include "VRU_ports/AdapterControlPort_VRU.hh" +#endif +#ifdef LibItsCps__TestSystem_HH +#include "CPS_ports/AdapterControlPort_CPS.hh" +#endif //#ifdef LibItsPki__TestSystem_HH //#include "Pki_ports/AdapterControlPort_Pki.hh" //#endif @@ -55,6 +61,12 @@ #ifdef LibItsGeoNetworking__TestSystem_HH #include "AdapterControlPort_GN.hh" #endif +#ifdef LibItsCru__TestSystem_HH +#include "AdapterControlPort_VRU.hh" +#endif +#ifdef LibItsCps__TestSystem_HH +#include "AdapterControlPort_CPS.hh" +#endif /* #include "AdapterControlPort_Evcsn.partH" #include "AdapterControlPort_IVIM.partH" diff --git a/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh b/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh index bc6bdbf..2e454cc 100644 --- a/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh +++ b/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh @@ -67,6 +67,12 @@ #include "GN_ports/UpperTesterPort_GN.hh" #endif +#ifdef AtsVRU +#include "BTP_ports/UpperTesterPort_BTP.hh" +#include "VRU_ports/UpperTesterPort_VRU.hh" +#include "GN_ports/UpperTesterPort_GN.hh" +#endif + #ifdef AtsRSUsSimulator // This is not an Abstract Test Suit, but an helper tool to simulate basic RSU/OBU functionalities #include "BTP_ports/UpperTesterPort_BTP.hh" #include "CAM_ports/UpperTesterPort_CAM.hh" @@ -152,6 +158,12 @@ #include "UpperTesterPort_GN.hh" #endif +#ifdef AtsVRU +#include "UpperTesterPort_BTP.hh" +#include "UpperTesterPort_VRU.hh" +#include "UpperTesterPort_GN.hh" +#endif + #endif //_NO_SOFTLINKS_ #endif diff --git a/ccsrc/Ports/LibIts_ports/VRU_ports/AdapterControlPort_VRU.cc b/ccsrc/Ports/LibIts_ports/VRU_ports/AdapterControlPort_VRU.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Ports/LibIts_ports/VRU_ports/AdapterControlPort_VRU.hh b/ccsrc/Ports/LibIts_ports/VRU_ports/AdapterControlPort_VRU.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.cc b/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.hh b/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.cc b/ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.hh b/ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Ports/LibIts_ports/VRU_ports/module.mk b/ccsrc/Ports/LibIts_ports/VRU_ports/module.mk new file mode 100644 index 0000000..e3fa6f1 --- /dev/null +++ b/ccsrc/Ports/LibIts_ports/VRU_ports/module.mk @@ -0,0 +1,3 @@ +sources := AdapterControlPort_VRU.cc VruPort.cc UpperTesterPort_VRU.cc +includes := . + diff --git a/ccsrc/Protocols/UpperTester/module.mk b/ccsrc/Protocols/UpperTester/module.mk index 50e9305..514e08d 100644 --- a/ccsrc/Protocols/UpperTester/module.mk +++ b/ccsrc/Protocols/UpperTester/module.mk @@ -37,6 +37,10 @@ ifeq (AtsCPS, $(ATS)) sources += uppertester_cps_codec.cc uppertester_cps_layer.cc endif +ifeq (AtsVRU, $(ATS)) +sources += uppertester_vru_codec.cc uppertester_vru_layer.cc +endif + ifeq (AtsRSUsSimulator, $(ATS)) sources += uppertester_cam_codec.cc uppertester_cam_layer.cc \ uppertester_denm_codec.cc uppertester_denm_layer.cc \ diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_vru_codec.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_vru_layer.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_layer_factory.hh b/ccsrc/Protocols/UpperTester/uppertester_vru_layer_factory.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/VRU/module.mk b/ccsrc/Protocols/VRU/module.mk new file mode 100644 index 0000000..44b83fc --- /dev/null +++ b/ccsrc/Protocols/VRU/module.mk @@ -0,0 +1,2 @@ +sources := vru_codec.cc vru_pdu_codec.cc +includes := . diff --git a/ccsrc/Protocols/VRU/vru_codec.cc b/ccsrc/Protocols/VRU/vru_codec.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/VRU/vru_codec.hh b/ccsrc/Protocols/VRU/vru_codec.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/VRU/vru_pdu_codec.cc b/ccsrc/Protocols/VRU/vru_pdu_codec.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/VRU/vru_pdu_codec.hh b/ccsrc/Protocols/VRU/vru_pdu_codec.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/VRU/vru_types.hh b/ccsrc/Protocols/VRU/vru_types.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/VRU_layers/module.mk b/ccsrc/Protocols/VRU_layers/module.mk new file mode 100644 index 0000000..839617a --- /dev/null +++ b/ccsrc/Protocols/VRU_layers/module.mk @@ -0,0 +1,2 @@ +sources := vru_layer.cc +includes := . ../VRU ../GeoNetworking diff --git a/ccsrc/Protocols/VRU_layers/vru_layer.cc b/ccsrc/Protocols/VRU_layers/vru_layer.cc new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/VRU_layers/vru_layer.hh b/ccsrc/Protocols/VRU_layers/vru_layer.hh new file mode 100644 index 0000000..e69de29 diff --git a/ccsrc/Protocols/VRU_layers/vru_layer_factory.hh b/ccsrc/Protocols/VRU_layers/vru_layer_factory.hh new file mode 100644 index 0000000..e69de29 diff --git a/ttcn/AtsVRU b/ttcn/AtsVRU index 01e4c03..2b9675d 160000 --- a/ttcn/AtsVRU +++ b/ttcn/AtsVRU @@ -1 +1 @@ -Subproject commit 01e4c037b2365683df9c0a96a5db145dc92eaa1f +Subproject commit 2b9675deb52e4eefb9858364fef66bf95cda4976 -- GitLab From db9cb871ae073bdcd3b71605e3f34ccedf84eeb6 Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 18 Jun 2024 14:04:03 +0200 Subject: [PATCH 137/178] Update install.sh --- install.sh | 4 ++++ ttcn/AtsVRU | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index ebfd23b..7d7850f 100755 --- a/install.sh +++ b/install.sh @@ -28,6 +28,10 @@ do elif [ -f DENM-PDU-Descriptions.asn ] then ln DENM-PDU-Descriptions.asn DENM_PDU_Descriptions.asn + elif [ -f VAM-PDU-Descriptions.asn ] + then + ln VAM-PDU-Descriptions.asn VAM_PDU_Descriptions.asn + ln motorcyclist-special-container.asn motorcyclist_special_container.asn elif [ -f asn/CPM-PDU-Descriptions.asn ] then ln asn/CPM-PDU-Descriptions.asn asn/CPM_PDU_Descriptions.asn diff --git a/ttcn/AtsVRU b/ttcn/AtsVRU index 2b9675d..151fa8d 160000 --- a/ttcn/AtsVRU +++ b/ttcn/AtsVRU @@ -1 +1 @@ -Subproject commit 2b9675deb52e4eefb9858364fef66bf95cda4976 +Subproject commit 151fa8d5962a2b3164a79ba52e7745212c201293 -- GitLab From 72fa9050e849dc857ad89a74510c30ca5637c185 Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 20 Jun 2024 11:22:56 +0200 Subject: [PATCH 138/178] Add basics Test Ssytem functionalities for AtsCPS --- ccsrc/EncDec/LibItsCam_Encdec.cc | 38 +-- ccsrc/EncDec/LibItsCps_Encdec.cc | 226 ++++++++++++++++++ ccsrc/EncDec/LibItsDenm_Encdec.cc | 38 +-- ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc | 2 +- ccsrc/EncDec/LibItsIvim_Encdec.cc | 38 +-- ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc | 44 ++-- ccsrc/EncDec/LibItsRtcmem_Encdec.cc | 38 +-- .../CPS_ports/AdapterControlPort_CPS.cc | 70 ++++++ .../CPS_ports/AdapterControlPort_CPS.hh | 36 +++ ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.cc | 90 +++++++ ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.hh | 53 ++++ .../CPS_ports/UpperTesterPort_CPS.cc | 90 +++++++ .../CPS_ports/UpperTesterPort_CPS.hh | 43 ++++ ccsrc/Protocols/CAM/cam_codec.hh | 2 +- ccsrc/Protocols/CAM_layers/cam_layer.cc | 2 +- ccsrc/Protocols/CPS/cps_codec.cc | 27 +++ ccsrc/Protocols/CPS/cps_codec.hh | 23 ++ ccsrc/Protocols/CPS/cps_pdu_codec.cc | 16 ++ ccsrc/Protocols/CPS/cps_pdu_codec.hh | 19 ++ ccsrc/Protocols/CPS/cps_types.hh | 14 ++ ccsrc/Protocols/CPS_layers/cps_layer.cc | 164 +++++++++++++ ccsrc/Protocols/CPS_layers/cps_layer.hh | 76 ++++++ .../Protocols/CPS_layers/cps_layer_factory.hh | 41 ++++ ccsrc/Protocols/DENM_layers/denm_layer.cc | 2 +- ccsrc/Protocols/IVIM_layers/ivim_layer.cc | 2 +- .../MapemSpatem_layers/mapem_spatem_layer.cc | 2 +- ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.cc | 2 +- .../SremSsem_layers/SremSsemLayer.cc | 2 +- .../UpperTester/uppertester_cps_codec.cc | 190 +++++++++++++++ .../UpperTester/uppertester_cps_codec.hh | 50 ++++ .../UpperTester/uppertester_cps_layer.cc | 51 ++++ .../UpperTester/uppertester_cps_layer.hh | 39 +++ .../uppertester_cps_layer_factory.hh | 26 ++ etc/AtsCPS/AtsCPS_Simulator.cfg_ | 118 +++++++++ install.sh | 2 +- ttcn/AtsCPS | 2 +- 36 files changed, 1570 insertions(+), 108 deletions(-) create mode 100644 etc/AtsCPS/AtsCPS_Simulator.cfg_ diff --git a/ccsrc/EncDec/LibItsCam_Encdec.cc b/ccsrc/EncDec/LibItsCam_Encdec.cc index d0ee791..7b1bebc 100644 --- a/ccsrc/EncDec/LibItsCam_Encdec.cc +++ b/ccsrc/EncDec/LibItsCam_Encdec.cc @@ -78,7 +78,7 @@ namespace LibItsCam__EncdecDeclarations { p_camInd.msgIn() = cam; // Decode lower layer data TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnNextHeader_raw_.fieldlength / 8)) { p_camInd.gnNextHeader().set_to_omit(); @@ -87,8 +87,8 @@ namespace LibItsCam__EncdecDeclarations { os.decode(LibItsCam__TypesAndValues::CamInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnNextHeader() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__CAM: gnNextHeader=", p_camInd.gnNextHeader()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CamInd: gnNextHeader=", p_camInd.gnNextHeader()); + loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); // gnHeaderType if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnHeaderType_raw_.fieldlength / 8)) { p_camInd.gnHeaderType().set_to_omit(); @@ -97,8 +97,8 @@ namespace LibItsCam__EncdecDeclarations { os.decode(LibItsCam__TypesAndValues::CamInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnHeaderType() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__CAM: gnHeaderType=", p_camInd.gnHeaderType()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CamInd: gnHeaderType=", p_camInd.gnHeaderType()); + loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); // gnHeaderSubtype if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnHeaderSubtype_raw_.fieldlength / 8)) { p_camInd.gnHeaderSubtype().set_to_omit(); @@ -107,8 +107,8 @@ namespace LibItsCam__EncdecDeclarations { os.decode(LibItsCam__TypesAndValues::CamInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnHeaderSubtype() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__CAM: gnHeaderSubtype=", p_camInd.gnHeaderSubtype()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CamInd: gnHeaderSubtype=", p_camInd.gnHeaderSubtype()); + loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); // gnLifetime if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnLifetime_raw_.fieldlength / 8)) { p_camInd.gnLifetime().set_to_omit(); @@ -117,8 +117,8 @@ namespace LibItsCam__EncdecDeclarations { i.decode(LibItsCam__TypesAndValues::CamInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnLifetime() = i; } - loggers::get_instance().log_msg("fx__dec__CAM: gnLifetime=", p_camInd.gnLifetime()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CamInd: gnLifetime=", p_camInd.gnLifetime()); + loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); // gnTrafficClass if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnTrafficClass_raw_.fieldlength / 8)) { p_camInd.gnTrafficClass().set_to_omit(); @@ -127,8 +127,8 @@ namespace LibItsCam__EncdecDeclarations { os.decode(LibItsCam__TypesAndValues::CamInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnTrafficClass() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__CAM: gnTrafficClass=", p_camInd.gnTrafficClass()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CamInd: gnTrafficClass=", p_camInd.gnTrafficClass()); + loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); // btpDestinationPort if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_btpDestinationPort_raw_.fieldlength / 8)) { p_camInd.btpDestinationPort().set_to_omit(); @@ -137,8 +137,8 @@ namespace LibItsCam__EncdecDeclarations { i.decode(LibItsCam__TypesAndValues::CamInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.btpDestinationPort() = i; } - loggers::get_instance().log_msg("fx__dec__CAM: btpDestinationPort=", p_camInd.btpDestinationPort()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CamInd: btpDestinationPort=", p_camInd.btpDestinationPort()); + loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); // btpInfo if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_btpInfo_raw_.fieldlength / 8)) { p_camInd.btpInfo().set_to_omit(); @@ -147,8 +147,8 @@ namespace LibItsCam__EncdecDeclarations { i.decode(LibItsCam__TypesAndValues::CamInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.btpInfo() = i; } - loggers::get_instance().log_msg("fx__dec__CAM: btpInfo=", p_camInd.btpInfo()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CamInd: btpInfo=", p_camInd.btpInfo()); + loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); // ssp if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_ssp_raw_.fieldlength / 8)) { p_camInd.ssp().set_to_omit(); @@ -157,8 +157,8 @@ namespace LibItsCam__EncdecDeclarations { bs.decode(LibItsCam__TypesAndValues::CamInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.ssp() = bs; } - loggers::get_instance().log_msg("fx__dec__CAM: ssp=", p_camInd.ssp()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CamInd: ssp=", p_camInd.ssp()); + loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); // its__aid if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_its__aid_raw_.fieldlength / 8)) { p_camInd.its__aid().set_to_omit(); @@ -167,8 +167,8 @@ namespace LibItsCam__EncdecDeclarations { i.decode(LibItsCam__TypesAndValues::CamInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.its__aid() = i; } - loggers::get_instance().log_msg("fx__dec__CAM: its_aid=", p_camInd.its__aid()); - loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CamInd: its_aid=", p_camInd.its__aid()); + loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); return 0; } diff --git a/ccsrc/EncDec/LibItsCps_Encdec.cc b/ccsrc/EncDec/LibItsCps_Encdec.cc index e69de29..acdf871 100644 --- a/ccsrc/EncDec/LibItsCps_Encdec.cc +++ b/ccsrc/EncDec/LibItsCps_Encdec.cc @@ -0,0 +1,226 @@ +#include + +#include "LibItsCps_EncdecDeclarations.hh" + +#include "cps_codec.hh" +#include "loggers.hh" +#include "uppertester_cps_codec.hh" + +namespace LibItsCps__EncdecDeclarations { + /**************************************************** + * @desc External function to encode a CpsReq type + * @param value to encode + * @return encoded value + ****************************************************/ + BITSTRING fx__enc__CpsReq(const LibItsCps__TypesAndValues::CpsReq &p_cpsReq) { + loggers::get_instance().log_msg(">>> fx__enc__CpsReq: ", p_cpsReq); + + cps_codec codec; + OCTETSTRING os; + if (codec.encode(p_cpsReq.msgOut(), os) == -1) { + loggers::get_instance().warning("fx__enc__CpsReq: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + /**************************************************** + * @desc External function to decode a CpsReq type + * @param value to encode + * @return encoded value + ****************************************************/ + INTEGER fx__dec__CpsReq(BITSTRING &b, LibItsCps__TypesAndValues::CpsReq &p) { + loggers::get_instance().log(">>> fx__dec__CpsReq"); + + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + + cps_codec codec; + CPM__PDU__Descriptions::CollectivePerceptionMessage cps; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(is, cps) == -1) { + loggers::get_instance().warning("fx__dec__CpsReq: -1 result code was returned"); + return -1; + } + p.msgOut() = cps; + + return 0; + } + + INTEGER fx__dec__CpsInd(BITSTRING &b, LibItsCps__TypesAndValues::CpsInd &p_cpsInd) { + loggers::get_instance().log(">>> fx__dec__CpsInd"); + + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + + cps_codec codec; + CPM__PDU__Descriptions::CollectivePerceptionMessage cps; + OCTETSTRING is = bit2oct(b); + + // Calculate the size of the lower layers information + int s = (LibItsCps__TypesAndValues::CpsInd_gnNextHeader_raw_.fieldlength + LibItsCps__TypesAndValues::CpsInd_gnHeaderType_raw_.fieldlength + + LibItsCps__TypesAndValues::CpsInd_gnHeaderSubtype_raw_.fieldlength + LibItsCps__TypesAndValues::CpsInd_gnLifetime_raw_.fieldlength + + LibItsCps__TypesAndValues::CpsInd_gnTrafficClass_raw_.fieldlength + LibItsCps__TypesAndValues::CpsInd_btpDestinationPort_raw_.fieldlength + + LibItsCps__TypesAndValues::CpsInd_btpInfo_raw_.fieldlength + LibItsCps__TypesAndValues::CpsInd_ssp_raw_.fieldlength + + LibItsCps__TypesAndValues::CpsInd_its__aid_raw_.fieldlength) / + 8; + // Decode CA message + if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), cps) == -1) { + loggers::get_instance().warning("fx__dec__CpsInd: -1 result code was returned"); + return -1; + } + p_cpsInd.msgIn() = cps; + // Decode lower layer data + TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); + loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); + // gnNextHeader + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_gnNextHeader_raw_.fieldlength / 8)) { + p_cpsInd.gnNextHeader().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsCps__TypesAndValues::CpsInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_cpsInd.gnNextHeader() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__CpsInd: gnNextHeader=", p_cpsInd.gnNextHeader()); + loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); + // gnHeaderType + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_gnHeaderType_raw_.fieldlength / 8)) { + p_cpsInd.gnHeaderType().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsCps__TypesAndValues::CpsInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_cpsInd.gnHeaderType() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__CpsInd: gnHeaderType=", p_cpsInd.gnHeaderType()); + loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); + // gnHeaderSubtype + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_gnHeaderSubtype_raw_.fieldlength / 8)) { + p_cpsInd.gnHeaderSubtype().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsCps__TypesAndValues::CpsInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_cpsInd.gnHeaderSubtype() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__CpsInd: gnHeaderSubtype=", p_cpsInd.gnHeaderSubtype()); + loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); + // gnLifetime + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_gnLifetime_raw_.fieldlength / 8)) { + p_cpsInd.gnLifetime().set_to_omit(); + } else { + INTEGER i; + i.decode(LibItsCps__TypesAndValues::CpsInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_cpsInd.gnLifetime() = i; + } + loggers::get_instance().log_msg("fx__dec__CpsInd: gnLifetime=", p_cpsInd.gnLifetime()); + loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); + // gnTrafficClass + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_gnTrafficClass_raw_.fieldlength / 8)) { + p_cpsInd.gnTrafficClass().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsCps__TypesAndValues::CpsInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_cpsInd.gnTrafficClass() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__CpsInd: gnTrafficClass=", p_cpsInd.gnTrafficClass()); + loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); + // btpDestinationPort + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_btpDestinationPort_raw_.fieldlength / 8)) { + p_cpsInd.btpDestinationPort().set_to_omit(); + } else { + INTEGER i; + i.decode(LibItsCps__TypesAndValues::CpsInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_cpsInd.btpDestinationPort() = i; + } + loggers::get_instance().log_msg("fx__dec__CpsInd: btpDestinationPort=", p_cpsInd.btpDestinationPort()); + loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); + // btpInfo + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_btpInfo_raw_.fieldlength / 8)) { + p_cpsInd.btpInfo().set_to_omit(); + } else { + INTEGER i; + i.decode(LibItsCps__TypesAndValues::CpsInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_cpsInd.btpInfo() = i; + } + loggers::get_instance().log_msg("fx__dec__CpsInd: btpInfo=", p_cpsInd.btpInfo()); + loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); + // ssp + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_ssp_raw_.fieldlength / 8)) { + p_cpsInd.ssp().set_to_omit(); + } else { + BITSTRING bs; + bs.decode(LibItsCps__TypesAndValues::CpsInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_cpsInd.ssp() = bs; + } + loggers::get_instance().log_msg("fx__dec__CpsInd: ssp=", p_cpsInd.ssp()); + loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); + // its__aid + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_its__aid_raw_.fieldlength / 8)) { + p_cpsInd.its__aid().set_to_omit(); + } else { + INTEGER i; + i.decode(LibItsCps__TypesAndValues::CpsInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_cpsInd.its__aid() = i; + } + loggers::get_instance().log_msg("fx__dec__CpsInd: its_aid=", p_cpsInd.its__aid()); + loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); + + return 0; + } + + BITSTRING fx__enc__CPM(const CPM__PDU__Descriptions::CollectivePerceptionMessage &p_cps) { + loggers::get_instance().log_msg(">>> fx__enc__CPM: ", p_cps); + + cps_codec codec; + OCTETSTRING os; + codec.encode(p_cps, os); + return oct2bit(os); + } + + INTEGER fx__dec__CPM(BITSTRING &b, CPM__PDU__Descriptions::CollectivePerceptionMessage &p) { + loggers::get_instance().log(">>> fx__dec__CPM"); + cps_codec codec; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + loggers::get_instance().warning("fx__dec__CPM: -1 result code was returned"); + return -1; + } + + return 0; + } + + BITSTRING fx__enc__UtCpsInitialize(const LibItsCps__TypesAndValues::UtCpsInitialize &p_utCpsInitialize) { + loggers::get_instance().log_msg(">>> fx__enc__UtCpsInitialize: ", p_utCpsInitialize); + + uppertester_cps_codec codec; + OCTETSTRING os; + codec.encode(p_utCpsInitialize, os); + return oct2bit(os); + } + + /**************************************************** + * @desc External function to decode a UtCpsEventInd type + * @param value to encode + * @return encoded value + ****************************************************/ + INTEGER fx__dec__UtCpsEventInd(BITSTRING &b, LibItsCps__TypesAndValues::UtCpsEventInd &p) { + loggers::get_instance().log(">>> fx__dec__UtCpsEventInd"); + + uppertester_cps_codec codec; + OCTETSTRING is = bit2oct(b); + std::unique_ptr ptr = codec.decode(is); + if (ptr == nullptr) { + loggers::get_instance().warning("fx__dec__UtCpsEventInd: -1 result code was returned"); + return -1; + } + p = static_cast(*ptr); + return 0; + } + +} // namespace LibItsCps__EncdecDeclarations diff --git a/ccsrc/EncDec/LibItsDenm_Encdec.cc b/ccsrc/EncDec/LibItsDenm_Encdec.cc index 2fa70b9..283da7f 100644 --- a/ccsrc/EncDec/LibItsDenm_Encdec.cc +++ b/ccsrc/EncDec/LibItsDenm_Encdec.cc @@ -77,7 +77,7 @@ namespace LibItsDenm__EncdecDeclarations { p_denmInd.msgIn() = denm; // Decode lower layer data TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnNextHeader_raw_.fieldlength / 8)) { p_denmInd.gnNextHeader().set_to_omit(); @@ -86,8 +86,8 @@ namespace LibItsDenm__EncdecDeclarations { os.decode(LibItsDenm__TypesAndValues::DenmInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnNextHeader() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__DENM: gnNextHeader=", p_denmInd.gnNextHeader()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DenmInd: gnNextHeader=", p_denmInd.gnNextHeader()); + loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); // gnHeaderType if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnHeaderType_raw_.fieldlength / 8)) { p_denmInd.gnHeaderType().set_to_omit(); @@ -96,8 +96,8 @@ namespace LibItsDenm__EncdecDeclarations { os.decode(LibItsDenm__TypesAndValues::DenmInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnHeaderType() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__DENM: gnHeaderType=", p_denmInd.gnHeaderType()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DenmInd: gnHeaderType=", p_denmInd.gnHeaderType()); + loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); // gnHeaderSubtype if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnHeaderSubtype_raw_.fieldlength / 8)) { p_denmInd.gnHeaderSubtype().set_to_omit(); @@ -106,8 +106,8 @@ namespace LibItsDenm__EncdecDeclarations { os.decode(LibItsDenm__TypesAndValues::DenmInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnHeaderSubtype() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__DENM: gnHeaderSubType=", p_denmInd.gnHeaderSubtype()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DenmInd: gnHeaderSubType=", p_denmInd.gnHeaderSubtype()); + loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); // gnLifetime if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnLifetime_raw_.fieldlength / 8)) { p_denmInd.gnLifetime().set_to_omit(); @@ -116,8 +116,8 @@ namespace LibItsDenm__EncdecDeclarations { os.decode(LibItsDenm__TypesAndValues::DenmInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnLifetime() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__DENM: gnLifetime=", p_denmInd.gnLifetime()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DenmInd: gnLifetime=", p_denmInd.gnLifetime()); + loggers::get_instance().log_to_hexa("fx__dfx__dec__DenmIndec__DENM: ", decoding_buffer); // gnTrafficClass if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnTrafficClass_raw_.fieldlength / 8)) { p_denmInd.gnTrafficClass().set_to_omit(); @@ -126,8 +126,8 @@ namespace LibItsDenm__EncdecDeclarations { os.decode(LibItsDenm__TypesAndValues::DenmInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnTrafficClass() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__DENM: gnTrafficClass=", p_denmInd.gnTrafficClass()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DenmInd: gnTrafficClass=", p_denmInd.gnTrafficClass()); + loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); // btpDestinationPort if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_btpDestinationPort_raw_.fieldlength / 8)) { p_denmInd.btpDestinationPort().set_to_omit(); @@ -136,8 +136,8 @@ namespace LibItsDenm__EncdecDeclarations { os.decode(LibItsDenm__TypesAndValues::DenmInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.btpDestinationPort() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__DENM: btpDestinationPort=", p_denmInd.btpDestinationPort()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DenmInd: btpDestinationPort=", p_denmInd.btpDestinationPort()); + loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); // btpInfo if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_btpInfo_raw_.fieldlength / 8)) { p_denmInd.btpInfo().set_to_omit(); @@ -146,8 +146,8 @@ namespace LibItsDenm__EncdecDeclarations { os.decode(LibItsDenm__TypesAndValues::DenmInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.btpInfo() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__DENM: btpInfo=", p_denmInd.btpInfo()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DenmInd: btpInfo=", p_denmInd.btpInfo()); + loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); // ssp if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_ssp_raw_.fieldlength / 8)) { p_denmInd.ssp().set_to_omit(); @@ -156,8 +156,8 @@ namespace LibItsDenm__EncdecDeclarations { bs.decode(LibItsDenm__TypesAndValues::DenmInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.ssp() = bs; } - loggers::get_instance().log_msg("fx__dec__DENM: ssp=", p_denmInd.ssp()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DenmInd: ssp=", p_denmInd.ssp()); + loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); // its__aid if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_its__aid_raw_.fieldlength / 8)) { p_denmInd.its__aid().set_to_omit(); @@ -166,8 +166,8 @@ namespace LibItsDenm__EncdecDeclarations { os.decode(LibItsDenm__TypesAndValues::DenmInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.its__aid() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__DENM: its_aid=", p_denmInd.its__aid()); - loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DenmInd: its_aid=", p_denmInd.its__aid()); + loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); return 0; } diff --git a/ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc b/ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc index 47d9403..cf1e5a1 100644 --- a/ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc +++ b/ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc @@ -77,7 +77,7 @@ namespace LibItsGeoNetworking__EncdecDeclarations { } p.msgOut() = pdu; TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); - loggers::get_instance().log_to_hexa("fx__dec__GeoNetworkingInd: Lower layer: ", decoding_buffer); + loggers::get_instance().log_to_hexa("fx__dec__GeoNetworkingReq: Lower layer: ", decoding_buffer); for (int i = 1; i < p.get_count(); i++) { loggers::get_instance().log("fx__dec__GeoNetworkingReq: processing %s/%s/%s", p.fld_name(i), p.fld_descr(i)->name, p.get_at(i)->get_descriptor()->name); p.get_at(i)->decode(*p.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); diff --git a/ccsrc/EncDec/LibItsIvim_Encdec.cc b/ccsrc/EncDec/LibItsIvim_Encdec.cc index 35c8572..40c6a59 100644 --- a/ccsrc/EncDec/LibItsIvim_Encdec.cc +++ b/ccsrc/EncDec/LibItsIvim_Encdec.cc @@ -68,7 +68,7 @@ namespace LibItsIvim__EncdecDeclarations { p_ivimInd.msgIn() = ivim; // Decode lower layer data TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); - loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); + loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_gnNextHeader_raw_.fieldlength / 8)) { p_ivimInd.gnNextHeader().set_to_omit(); @@ -77,8 +77,8 @@ namespace LibItsIvim__EncdecDeclarations { os.decode(LibItsIvim__TypesAndValues::IvimInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.gnNextHeader() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__IVIM: gnNextHeader=", p_ivimInd.gnNextHeader()); - loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IvimInd: gnNextHeader=", p_ivimInd.gnNextHeader()); + loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); // gnHeaderType if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_gnHeaderType_raw_.fieldlength / 8)) { p_ivimInd.gnHeaderType().set_to_omit(); @@ -87,8 +87,8 @@ namespace LibItsIvim__EncdecDeclarations { os.decode(LibItsIvim__TypesAndValues::IvimInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.gnHeaderType() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__IVIM: gnHeaderType=", p_ivimInd.gnHeaderType()); - loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IvimInd: gnHeaderType=", p_ivimInd.gnHeaderType()); + loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); // gnHeaderSubtype if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_gnHeaderSubtype_raw_.fieldlength / 8)) { p_ivimInd.gnHeaderSubtype().set_to_omit(); @@ -97,8 +97,8 @@ namespace LibItsIvim__EncdecDeclarations { os.decode(LibItsIvim__TypesAndValues::IvimInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.gnHeaderSubtype() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__IVIM: gnHeaderSubtype=", p_ivimInd.gnHeaderSubtype()); - loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IvimInd: gnHeaderSubtype=", p_ivimInd.gnHeaderSubtype()); + loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); // gnLifetime if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_gnLifetime_raw_.fieldlength / 8)) { p_ivimInd.gnLifetime().set_to_omit(); @@ -107,8 +107,8 @@ namespace LibItsIvim__EncdecDeclarations { i.decode(LibItsIvim__TypesAndValues::IvimInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.gnLifetime() = i; } - loggers::get_instance().log_msg("fx__dec__IVIM: gnLifetime=", p_ivimInd.gnLifetime()); - loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IvimInd: gnLifetime=", p_ivimInd.gnLifetime()); + loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); // gnTrafficClass if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_gnTrafficClass_raw_.fieldlength / 8)) { p_ivimInd.gnTrafficClass().set_to_omit(); @@ -117,8 +117,8 @@ namespace LibItsIvim__EncdecDeclarations { os.decode(LibItsIvim__TypesAndValues::IvimInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.gnTrafficClass() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__IVIM: gnTrafficClass=", p_ivimInd.gnTrafficClass()); - loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IvimInd: gnTrafficClass=", p_ivimInd.gnTrafficClass()); + loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); // btpDestinationPort if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_btpDestinationPort_raw_.fieldlength / 8)) { p_ivimInd.btpDestinationPort().set_to_omit(); @@ -127,8 +127,8 @@ namespace LibItsIvim__EncdecDeclarations { i.decode(LibItsIvim__TypesAndValues::IvimInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.btpDestinationPort() = i; } - loggers::get_instance().log_msg("fx__dec__IVIM: btpDestinationPort=", p_ivimInd.btpDestinationPort()); - loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IvimInd: btpDestinationPort=", p_ivimInd.btpDestinationPort()); + loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); // btpInfo if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_btpInfo_raw_.fieldlength / 8)) { p_ivimInd.btpInfo().set_to_omit(); @@ -137,8 +137,8 @@ namespace LibItsIvim__EncdecDeclarations { i.decode(LibItsIvim__TypesAndValues::IvimInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.btpInfo() = i; } - loggers::get_instance().log_msg("fx__dec__IVIM: btpInfo=", p_ivimInd.btpInfo()); - loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IvimInd: btpInfo=", p_ivimInd.btpInfo()); + loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); // ssp if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_ssp_raw_.fieldlength / 8)) { p_ivimInd.ssp().set_to_omit(); @@ -147,8 +147,8 @@ namespace LibItsIvim__EncdecDeclarations { bs.decode(LibItsIvim__TypesAndValues::IvimInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.ssp() = bs; } - loggers::get_instance().log_msg("fx__dec__IVIM: ssp=", p_ivimInd.ssp()); - loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IvimInd: ssp=", p_ivimInd.ssp()); + loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); // its__aid if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_its__aid_raw_.fieldlength / 8)) { p_ivimInd.its__aid().set_to_omit(); @@ -157,8 +157,8 @@ namespace LibItsIvim__EncdecDeclarations { i.decode(LibItsIvim__TypesAndValues::IvimInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.its__aid() = i; } - loggers::get_instance().log_msg("fx__dec__IVIM: its_aid=", p_ivimInd.its__aid()); - loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IvimInd: its_aid=", p_ivimInd.its__aid()); + loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); return 0; } diff --git a/ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc b/ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc index 737ab2d..d8ab407 100644 --- a/ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc +++ b/ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc @@ -47,8 +47,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { return 0; } - INTEGER fx__dec__MapemInd(BITSTRING &b, LibItsMapemSpatem__TypesAndValues::MapemInd &p_mapemInd) { - loggers::get_instance().log(">>> fx__dec__MapemInd"); + INTEGER fx__dec__MapemIndInd(BITSTRING &b, LibItsMapemSpatem__TypesAndValues::MapemInd &p_mapemInd) { + loggers::get_instance().log(">>> fx__dec__MapemIndInd"); mapem_codec codec; MAPEM__PDU__Descriptions::MAPEM mapem; @@ -63,13 +63,13 @@ namespace LibItsMapemSpatem__EncdecDeclarations { 8; // Decode CA message if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), mapem) == -1) { - loggers::get_instance().warning("fx__dec__MapemInd: -1 result code was returned"); + loggers::get_instance().warning("fx__dec__MapemIndInd: -1 result code was returned"); return -1; } p_mapemInd.msgIn() = mapem; // Decode lower layer data TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); - loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); + loggers::get_instance().log_to_hexa("fx__dec__MapemIndInd: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_gnNextHeader_raw_.fieldlength / 8)) { p_mapemInd.gnNextHeader().set_to_omit(); @@ -78,8 +78,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { os.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.gnNextHeader() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__MapemInd: gnNextHeader=", p_mapemInd.gnNextHeader()); - loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__MapemIndInd: gnNextHeader=", p_mapemInd.gnNextHeader()); + loggers::get_instance().log_to_hexa("fx__dec__MapemIndInd: ", decoding_buffer); // gnHeaderType if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_gnHeaderType_raw_.fieldlength / 8)) { p_mapemInd.gnHeaderType().set_to_omit(); @@ -88,8 +88,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { os.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.gnHeaderType() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__Mapem: gnHeaderType=", p_mapemInd.gnHeaderType()); - loggers::get_instance().log_to_hexa("fx__dec__Mapem: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__MapemInd: gnHeaderType=", p_mapemInd.gnHeaderType()); + loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); // gnHeaderSubtype if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_gnHeaderSubtype_raw_.fieldlength / 8)) { p_mapemInd.gnHeaderSubtype().set_to_omit(); @@ -98,8 +98,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { os.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.gnHeaderSubtype() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__Mapem: gnHeaderSubtype=", p_mapemInd.gnHeaderSubtype()); - loggers::get_instance().log_to_hexa("fx__dec__Mapem: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__MapemInd: gnHeaderSubtype=", p_mapemInd.gnHeaderSubtype()); + loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); // gnLifetime if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_gnLifetime_raw_.fieldlength / 8)) { p_mapemInd.gnLifetime().set_to_omit(); @@ -108,8 +108,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { i.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.gnLifetime() = i; } - loggers::get_instance().log_msg("fx__dec__Mapem: gnLifetime=", p_mapemInd.gnLifetime()); - loggers::get_instance().log_to_hexa("fx__dec__Mapem: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__MapemInd: gnLifetime=", p_mapemInd.gnLifetime()); + loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); // gnTrafficClass if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_gnTrafficClass_raw_.fieldlength / 8)) { p_mapemInd.gnTrafficClass().set_to_omit(); @@ -118,8 +118,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { os.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.gnTrafficClass() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__Mapem: gnTrafficClass=", p_mapemInd.gnTrafficClass()); - loggers::get_instance().log_to_hexa("fx__dec__Mapem: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__MapemInd: gnTrafficClass=", p_mapemInd.gnTrafficClass()); + loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); // btpDestinationPort if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_btpDestinationPort_raw_.fieldlength / 8)) { p_mapemInd.btpDestinationPort().set_to_omit(); @@ -128,8 +128,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { i.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.btpDestinationPort() = i; } - loggers::get_instance().log_msg("fx__dec__Mapem: btpDestinationPort=", p_mapemInd.btpDestinationPort()); - loggers::get_instance().log_to_hexa("fx__dec__Mapem: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__MapemInd: btpDestinationPort=", p_mapemInd.btpDestinationPort()); + loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); // btpInfo if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_btpInfo_raw_.fieldlength / 8)) { p_mapemInd.btpInfo().set_to_omit(); @@ -138,8 +138,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { i.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.btpInfo() = i; } - loggers::get_instance().log_msg("fx__dec__Mapem: btpInfo=", p_mapemInd.btpInfo()); - loggers::get_instance().log_to_hexa("fx__dec__Mapem: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__MapemInd: btpInfo=", p_mapemInd.btpInfo()); + loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); // ssp if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_ssp_raw_.fieldlength / 8)) { p_mapemInd.ssp().set_to_omit(); @@ -148,8 +148,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { bs.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.ssp() = bs; } - loggers::get_instance().log_msg("fx__dec__Mapem: ssp=", p_mapemInd.ssp()); - loggers::get_instance().log_to_hexa("fx__dec__Mapem: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__MapemInd: ssp=", p_mapemInd.ssp()); + loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); // its__aid if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_its__aid_raw_.fieldlength / 8)) { p_mapemInd.its__aid().set_to_omit(); @@ -158,8 +158,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { i.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.its__aid() = i; } - loggers::get_instance().log_msg("fx__dec__Mapem: its_aid=", p_mapemInd.its__aid()); - loggers::get_instance().log_to_hexa("fx__dec__Mapem: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__MapemInd: its_aid=", p_mapemInd.its__aid()); + loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); return 0; } diff --git a/ccsrc/EncDec/LibItsRtcmem_Encdec.cc b/ccsrc/EncDec/LibItsRtcmem_Encdec.cc index d1c722f..d91c21e 100644 --- a/ccsrc/EncDec/LibItsRtcmem_Encdec.cc +++ b/ccsrc/EncDec/LibItsRtcmem_Encdec.cc @@ -68,7 +68,7 @@ namespace LibItsRtcmem__EncdecDeclarations { p_rtcmemInd.msgIn() = rtcmem; // Decode lower layer data TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); - loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); + loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_gnNextHeader_raw_.fieldlength / 8)) { p_rtcmemInd.gnNextHeader().set_to_omit(); @@ -77,8 +77,8 @@ namespace LibItsRtcmem__EncdecDeclarations { os.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.gnNextHeader() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__RTCMEM: gnNextHeader=", p_rtcmemInd.gnNextHeader()); - loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RtcmemInd: gnNextHeader=", p_rtcmemInd.gnNextHeader()); + loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); // gnHeaderType if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_gnHeaderType_raw_.fieldlength / 8)) { p_rtcmemInd.gnHeaderType().set_to_omit(); @@ -87,8 +87,8 @@ namespace LibItsRtcmem__EncdecDeclarations { os.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.gnHeaderType() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__RTCMEM: gnHeaderType=", p_rtcmemInd.gnHeaderType()); - loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RtcmemInd: gnHeaderType=", p_rtcmemInd.gnHeaderType()); + loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); // gnHeaderSubtype if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_gnHeaderSubtype_raw_.fieldlength / 8)) { p_rtcmemInd.gnHeaderSubtype().set_to_omit(); @@ -97,8 +97,8 @@ namespace LibItsRtcmem__EncdecDeclarations { os.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.gnHeaderSubtype() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__RTCMEM: gnHeaderSubtype=", p_rtcmemInd.gnHeaderSubtype()); - loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RtcmemInd: gnHeaderSubtype=", p_rtcmemInd.gnHeaderSubtype()); + loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); // gnLifetime if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_gnLifetime_raw_.fieldlength / 8)) { p_rtcmemInd.gnLifetime().set_to_omit(); @@ -107,8 +107,8 @@ namespace LibItsRtcmem__EncdecDeclarations { i.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.gnLifetime() = i; } - loggers::get_instance().log_msg("fx__dec__RTCMEM: gnLifetime=", p_rtcmemInd.gnLifetime()); - loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RtcmemInd: gnLifetime=", p_rtcmemInd.gnLifetime()); + loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); // gnTrafficClass if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_gnTrafficClass_raw_.fieldlength / 8)) { p_rtcmemInd.gnTrafficClass().set_to_omit(); @@ -117,8 +117,8 @@ namespace LibItsRtcmem__EncdecDeclarations { os.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.gnTrafficClass() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__RTCMEM: gnTrafficClass=", p_rtcmemInd.gnTrafficClass()); - loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RtcmemInd: gnTrafficClass=", p_rtcmemInd.gnTrafficClass()); + loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); // btpDestinationPort if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_btpDestinationPort_raw_.fieldlength / 8)) { p_rtcmemInd.btpDestinationPort().set_to_omit(); @@ -127,8 +127,8 @@ namespace LibItsRtcmem__EncdecDeclarations { i.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.btpDestinationPort() = i; } - loggers::get_instance().log_msg("fx__dec__RTCMEM: btpDestinationPort=", p_rtcmemInd.btpDestinationPort()); - loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RtcmemInd: btpDestinationPort=", p_rtcmemInd.btpDestinationPort()); + loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); // btpInfo if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_btpInfo_raw_.fieldlength / 8)) { p_rtcmemInd.btpInfo().set_to_omit(); @@ -137,8 +137,8 @@ namespace LibItsRtcmem__EncdecDeclarations { i.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.btpInfo() = i; } - loggers::get_instance().log_msg("fx__dec__RTCMEM: btpInfo=", p_rtcmemInd.btpInfo()); - loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RtcmemInd: btpInfo=", p_rtcmemInd.btpInfo()); + loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); // ssp if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_ssp_raw_.fieldlength / 8)) { p_rtcmemInd.ssp().set_to_omit(); @@ -147,8 +147,8 @@ namespace LibItsRtcmem__EncdecDeclarations { bs.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.ssp() = bs; } - loggers::get_instance().log_msg("fx__dec__RTCMEM: ssp=", p_rtcmemInd.ssp()); - loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RtcmemInd: ssp=", p_rtcmemInd.ssp()); + loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); // its__aid if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_its__aid_raw_.fieldlength / 8)) { p_rtcmemInd.its__aid().set_to_omit(); @@ -157,8 +157,8 @@ namespace LibItsRtcmem__EncdecDeclarations { i.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.its__aid() = i; } - loggers::get_instance().log_msg("fx__dec__RTCMEM: its_aid=", p_rtcmemInd.its__aid()); - loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RtcmemInd: its_aid=", p_rtcmemInd.its__aid()); + loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); return 0; } diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/AdapterControlPort_CPS.cc b/ccsrc/Ports/LibIts_ports/CPS_ports/AdapterControlPort_CPS.cc index e69de29..cd78a5e 100644 --- a/ccsrc/Ports/LibIts_ports/CPS_ports/AdapterControlPort_CPS.cc +++ b/ccsrc/Ports/LibIts_ports/CPS_ports/AdapterControlPort_CPS.cc @@ -0,0 +1,70 @@ +#include + +#include "loggers.hh" +#include "registration.hh" + +#include "AdapterControlPort_CPS.hh" +#include "cps_layer.hh" + +//============================================================================= +namespace LibItsCps__TestSystem { + + AdapterControlPort::AdapterControlPort(const char *par_port_name) : AdapterControlPort_BASE(par_port_name) {} + + AdapterControlPort::~AdapterControlPort() {} + + void AdapterControlPort::set_parameter(const char * /*parameter_name*/, const char * /*parameter_value*/) {} + + /*void AdapterControlPort::Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error) {}*/ + + void AdapterControlPort::Handle_Fd_Event_Error(int /*fd*/) {} + + void AdapterControlPort::Handle_Fd_Event_Writable(int /*fd*/) {} + + void AdapterControlPort::Handle_Fd_Event_Readable(int /*fd*/) {} + + /*void AdapterControlPort::Handle_Timeout(double time_since_last_call) {}*/ + + void AdapterControlPort::user_map(const char * /*system_port*/) {} + + void AdapterControlPort::user_unmap(const char * /*system_port*/) {} + + void AdapterControlPort::user_start() {} + + void AdapterControlPort::user_stop() {} + + void AdapterControlPort::outgoing_send(const LibItsCommon__TypesAndValues::AcGnssPrimitive & /*send_par*/) {} + + void AdapterControlPort::outgoing_send(const LibItsCommon__TypesAndValues::AcSecPrimitive &send_par) { + loggers::get_instance().log_msg(">>> AdapterControlPort::outgoing_send: ", send_par); + + // Register this object for AdapterControlPort + cps_layer *p = registration::get_instance().get_item(std::string("CPS")); + if (p != NULL) { + loggers::get_instance().log("AdapterControlPort::outgoing_send: Got CPS layer %p", p); + LibItsCommon__TypesAndValues::AdapterControlResults response; + response.acSecResponse() = BOOLEAN(true); + if (send_par.ischosen(LibItsCommon__TypesAndValues::AcSecPrimitive::ALT_acEnableSecurity)) { + loggers::get_instance().log("AdapterControlPort::outgoing_send: Enable secured mode"); + std::string str(static_cast(send_par.acEnableSecurity().certificateId())); + if (p->enable_secured_mode(str, send_par.acEnableSecurity().enforceSecurity()) == -1) { + response.acSecResponse() = BOOLEAN(false); + } + } else if (send_par.ischosen(LibItsCommon__TypesAndValues::AcSecPrimitive::ALT_acDisableSecurity)) { + loggers::get_instance().log("AdapterControlPort::outgoing_send: Disable secured mode"); + if (p->disable_secured_mode() == -1) { + response.acSecResponse() = BOOLEAN(false); + } + } else { + response.acSecResponse() = BOOLEAN(false); + } + // Send response + loggers::get_instance().log_msg("AdapterControlPort::outgoing_send: Send response: ", response); + incoming_message(response); + } else { + loggers::get_instance().error("AdapterControlPort::outgoing_send: CPS not registered"); + } + } + +} // namespace LibItsCps__TestSystem diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/AdapterControlPort_CPS.hh b/ccsrc/Ports/LibIts_ports/CPS_ports/AdapterControlPort_CPS.hh index e69de29..92d800f 100644 --- a/ccsrc/Ports/LibIts_ports/CPS_ports/AdapterControlPort_CPS.hh +++ b/ccsrc/Ports/LibIts_ports/CPS_ports/AdapterControlPort_CPS.hh @@ -0,0 +1,36 @@ +#ifndef AdapterControlPort_CPS_HH +#define AdapterControlPort_CPS_HH +//============================================================================= +#include "LibItsCps_TestSystem.hh" + +namespace LibItsCps__TestSystem { + + class AdapterControlPort : public AdapterControlPort_BASE { + public: + AdapterControlPort(const char *par_port_name = NULL); + ~AdapterControlPort(); + + void set_parameter(const char *parameter_name, const char *parameter_value); + + private: + /* void Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error); */ + void Handle_Fd_Event_Error(int fd); + void Handle_Fd_Event_Writable(int fd); + void Handle_Fd_Event_Readable(int fd); + /* void Handle_Timeout(double time_since_last_call); */ + protected: + void user_map(const char *system_port); + void user_unmap(const char *system_port); + + void user_start(); + void user_stop(); + + void outgoing_send(const LibItsCommon__TypesAndValues::AcGnssPrimitive &send_par); + + void outgoing_send(const LibItsCommon__TypesAndValues::AcSecPrimitive &send_par); + }; + +} // namespace LibItsCps__TestSystem + +#endif diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.cc b/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.cc index e69de29..9f9204c 100644 --- a/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.cc +++ b/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.cc @@ -0,0 +1,90 @@ +// This Test Port skeleton source file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/5 R3A +// for U-ERICSSON\ethgry (ethgry@HU00078339) on Fri Aug 14 16:32:05 2015 + +// Copyright Ericsson Telecom AB 2000-2014 + +// You may modify this file. Complete the body of empty functions and +// add your member functions here. + +#include "CpsPort.hh" +#include "cps_layer_factory.hh" +#include "loggers.hh" + +namespace LibItsCps__TestSystem { + + CpsPort::CpsPort(const char *par_port_name) + : CpsPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(NULL), _time_key("CpsPort::outgoing_send") {} + + CpsPort::~CpsPort() { + if (_layer != NULL) { + delete _layer; + } + } + + void CpsPort::set_parameter(const char *parameter_name, const char *parameter_value) { + loggers::get_instance().log("CpsPort::set_parameter: %s=%s", parameter_name, parameter_value); + _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value))); + } + + /*void CpsPort::Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error) {}*/ + + void CpsPort::Handle_Fd_Event_Error(int /*fd*/) {} + + void CpsPort::Handle_Fd_Event_Writable(int /*fd*/) {} + + void CpsPort::Handle_Fd_Event_Readable(int /*fd*/) {} + + /*void CpsPort::Handle_Timeout(double time_since_last_call) {}*/ + + void CpsPort::user_map(const char *system_port) { + loggers::get_instance().log(">>> CpsPort::user_map: %s", system_port); + // Build layer stack + params_its::iterator it = _cfg_params.find(std::string("params")); + if (it != _cfg_params.end()) { + loggers::get_instance().log("CpsPort::user_map: %s", it->second.c_str()); + // Setup parameters + params_its::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless + // Create layer + _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); + if (static_cast(_layer) == NULL) { + loggers::get_instance().error("CpsPort::user_map: Invalid stack configuration: %s", it->second.c_str()); + } + static_cast(_layer)->add_upper_port(this); + } else { + loggers::get_instance().error("CpsPort::user_map: No layers defined in configuration file"); + } + } + + void CpsPort::user_unmap(const char *system_port) { + loggers::get_instance().log(">>> CpsPort::user_unmap: %s", system_port); + if (_layer != NULL) { + delete _layer; + _layer = NULL; + } + } + + void CpsPort::user_start() {} + + void CpsPort::user_stop() {} + + void CpsPort::outgoing_send(const LibItsCps__TypesAndValues::CpsReq &send_par) { + loggers::get_instance().log_msg(">>> CpsPort::outgoing_send: payload=", send_par); + + float duration; + loggers::get_instance().set_start_time(_time_key); + params_its params; + static_cast(_layer)->sendMsg(send_par, params); + loggers::get_instance().set_stop_time(_time_key, duration); + } + + void CpsPort::receiveMsg(const LibItsCps__TypesAndValues::CpsInd &p_ind, const params& p_params) { + //loggers::get_instance().log_msg(">>> CpsPort::receive_msg: ", p_ind); + const params_its& p = static_cast(p_params); + loggers::get_instance().log(">>> CpsPort::receive_msg: %s", p.station_id.c_str()); + + incoming_message(p_ind); + } + +} // namespace LibItsCps__TestSystem diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.hh b/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.hh index e69de29..bd95056 100644 --- a/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.hh +++ b/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.hh @@ -0,0 +1,53 @@ +// This Test Port skeleton header file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/5 R3A +// for U-ERICSSON\ethgry (ethgry@HU00078339) on Fri Aug 14 16:32:05 2015 + +// Copyright Ericsson Telecom AB 2000-2014 + +// You may modify this file. Add your attributes and prototypes of your +// member functions here. + +#ifndef CpsPort_HH +#define CpsPort_HH + +#include "LibItsCps_TestSystem.hh" + +#include "layer.hh" +#include "params_its.hh" + +namespace LibItsCps__TestSystem { + + class CpsPort : public CpsPort_BASE { + params_its _cfg_params; + params_its _layer_params; + layer * _layer; + std::string _time_key; + + public: + CpsPort(const char *par_port_name = NULL); + ~CpsPort(); + + void set_parameter(const char *parameter_name, const char *parameter_value); + + void receiveMsg(const LibItsCps__TypesAndValues::CpsInd&, const params&); + + private: + /* void Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error); */ + void Handle_Fd_Event_Error(int fd); + void Handle_Fd_Event_Writable(int fd); + void Handle_Fd_Event_Readable(int fd); + /* void Handle_Timeout(double time_since_last_call); */ + protected: + void user_map(const char *system_port); + void user_unmap(const char *system_port); + + void user_start(); + void user_stop(); + + void outgoing_send(const LibItsCps__TypesAndValues::CpsReq &send_par); + }; + +} // namespace LibItsCps__TestSystem + +#endif diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.cc b/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.cc index e69de29..830ad4b 100644 --- a/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.cc +++ b/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.cc @@ -0,0 +1,90 @@ +#include "uppertester_cps_layer_factory.hh" + +#include "UpperTesterPort_CPS.hh" +#include "loggers.hh" + +//============================================================================= +namespace LibItsCps__TestSystem { + + UpperTesterPort::UpperTesterPort(const char *par_port_name) + : UpperTesterPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(NULL), _time_key("UpperTesterPort_Cps::outgoing_send") { + loggers::get_instance().log("UpperTesterPort_Cps::UpperTesterPort_Cps"); + } + + UpperTesterPort::~UpperTesterPort() { + if (_layer != NULL) { + delete _layer; + } + } + + void UpperTesterPort::set_parameter(const char *parameter_name, const char *parameter_value) { + loggers::get_instance().log("UpperTesterPort_Cps::set_parameter: %s=%s", parameter_name, parameter_value); + _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value))); + _cfg_params.log(); + } + + /*void UpperTesterPort::Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error) {}*/ + + void UpperTesterPort::Handle_Fd_Event_Error(int /*fd*/) {} + + void UpperTesterPort::Handle_Fd_Event_Writable(int /*fd*/) {} + + void UpperTesterPort::Handle_Fd_Event_Readable(int /*fd*/) {} + + /*void UpperTesterPort::Handle_Timeout(double time_since_last_call) {}*/ + + void UpperTesterPort::user_map(const char *system_port) { + loggers::get_instance().log(">>> UpperTesterPort_Cps::user_map: %s", system_port); + // Build layer stack + params_its::iterator it = _cfg_params.find(std::string("params")); + if (it != _cfg_params.end()) { + loggers::get_instance().log("UpperTesterPort_Cps::user_map: %s", it->second.c_str()); + _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); + if (static_cast(_layer) == NULL) { + loggers::get_instance().error("UpperTesterPort_Cps::user_map: Invalid stack configuration: %s", it->second.c_str()); + } + static_cast(_layer)->add_upper_port(this); + } else { + loggers::get_instance().error("UpperTesterPort_Cps::user_map: No layers defined in configuration file"); + } + } + + void UpperTesterPort::user_unmap(const char *system_port) { + loggers::get_instance().log(">>> UpperTesterPort_Cps::user_unmap: %s", system_port); + if (_layer != NULL) { + delete _layer; + _layer = NULL; + } + } + + void UpperTesterPort::user_start() {} + + void UpperTesterPort::user_stop() {} + + void UpperTesterPort::outgoing_send(const LibItsCps__TypesAndValues::UtCpsInitialize &send_par) { + loggers::get_instance().log_msg(">>> UppertesterPort_Cps::outgoing_send: ", send_par); + + float duration; + loggers::get_instance().set_start_time(_time_key); + static_cast(_layer)->sendMsg(send_par, _layer_params); + loggers::get_instance().set_stop_time(_time_key, duration); + } + + void UpperTesterPort::receiveMsg(const Base_Type &p_ind, const params &p_params) { + loggers::get_instance().log_msg(">>> UpperTesterPort_Cps::receive_msg: ", p_ind); + // Sanity check + if (!p_ind.is_bound()) { + return; + } + + if (std::string(p_ind.get_descriptor()->name).compare("@LibItsCps_TypesAndValues.UtCpsResults") == 0) { // TODO To be refined + incoming_message(static_cast(p_ind)); + } else if (std::string(p_ind.get_descriptor()->name).compare("@LibItsCps_TypesAndValues.UtCpsEventInd") == 0) { + incoming_message(static_cast(p_ind)); + } else { + loggers::get_instance().warning("UpperTesterPort_Cps::receive_msg: Message not processed: %s", p_ind.get_descriptor()->name); + } + } + +} // namespace LibItsCps__TestSystem diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.hh b/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.hh index e69de29..3d1a42c 100644 --- a/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.hh +++ b/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.hh @@ -0,0 +1,43 @@ +#ifndef UpperTesterPort_CPS_HH +#define UpperTesterPort_CPS_HH + +#include "layer.hh" +#include "params_its.hh" + +//============================================================================= +#include "LibItsCps_TestSystem.hh" +namespace LibItsCps__TestSystem { + + class UpperTesterPort : public UpperTesterPort_BASE { + params_its _cfg_params; + params_its _layer_params; + layer * _layer; + std::string _time_key; + + public: + UpperTesterPort(const char *par_port_name = NULL); + ~UpperTesterPort(); + + void set_parameter(const char *parameter_name, const char *parameter_value); + + void receiveMsg(const Base_Type &, const params &); + + private: + /* void Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error); */ + void Handle_Fd_Event_Error(int fd); + void Handle_Fd_Event_Writable(int fd); + void Handle_Fd_Event_Readable(int fd); + /* void Handle_Timeout(double time_since_last_call); */ + protected: + void user_map(const char *system_port); + void user_unmap(const char *system_port); + + void user_start(); + void user_stop(); + + void outgoing_send(const LibItsCps__TypesAndValues::UtCpsInitialize &send_par); + }; + +} // namespace LibItsCps__TestSystem +#endif diff --git a/ccsrc/Protocols/CAM/cam_codec.hh b/ccsrc/Protocols/CAM/cam_codec.hh index cea9846..ec0ed67 100644 --- a/ccsrc/Protocols/CAM/cam_codec.hh +++ b/ccsrc/Protocols/CAM/cam_codec.hh @@ -19,5 +19,5 @@ public: virtual ~cam_codec(){}; virtual int encode(const CAM__PDU__Descriptions::CAM &cam, OCTETSTRING &data); - virtual int decode(const OCTETSTRING &data, CAM__PDU__Descriptions::CAM &, params_its *params = NULL); + virtual int decode(const OCTETSTRING &data, CAM__PDU__Descriptions::CAM &cam, params_its *params = NULL); }; diff --git a/ccsrc/Protocols/CAM_layers/cam_layer.cc b/ccsrc/Protocols/CAM_layers/cam_layer.cc index c0c1cf2..b59466c 100644 --- a/ccsrc/Protocols/CAM_layers/cam_layer.cc +++ b/ccsrc/Protocols/CAM_layers/cam_layer.cc @@ -13,7 +13,7 @@ cam_layer::cam_layer(const std::string &p_type, const std::string ¶m) : t_la loggers::get_instance().log(">>> cam_layer::cam_layer: %s, %s", to_string().c_str(), param.c_str()); // Setup parameters params::convert(_params, param); - _params.insert(std::make_pair("its_aid", "36")); // ETSI TS 102 965 V1.2.1 (2015-06) + _params.insert(std::make_pair("its_aid", "36")); // ETSI TS 102 965 V2.1.1 (2021-11) _params.insert(std::make_pair("payload_type", "2")); // CA message id - See ETSI TS 102 894 // Register this object for AdapterControlPort diff --git a/ccsrc/Protocols/CPS/cps_codec.cc b/ccsrc/Protocols/CPS/cps_codec.cc index e69de29..7735fef 100644 --- a/ccsrc/Protocols/CPS/cps_codec.cc +++ b/ccsrc/Protocols/CPS/cps_codec.cc @@ -0,0 +1,27 @@ +#include "cps_codec.hh" +#include "LibItsCps_TypesAndValues.hh" +#include "asn1/asn_application.h" // from asn1c +#include "loggers.hh" + +int cps_codec::encode(const CPM__PDU__Descriptions::CollectivePerceptionMessage &cps, OCTETSTRING &data) { + loggers::get_instance().log(">>> cps_codec::encode"); + + BITSTRING b; + int rc = asn_codec.encode(cps, b); + if (rc) { + data = bit2oct(b); + loggers::get_instance().log_msg("cps_codec::encode: ", data); + } + return rc; +} + +int cps_codec::decode(const OCTETSTRING &data, CPM__PDU__Descriptions::CollectivePerceptionMessage &cps, params_its *params) { + loggers::get_instance().log_msg(">>> cps_codec::decode: ", data); + + int rc = asn_codec.decode(oct2bit(data), cps); + loggers::get_instance().log("cps_codec::decode: ASN.1 codec returned %d", rc); + // if (rc) { + // loggers::get_instance().log_msg("cps_codec::decode: ", static_cast(cps)); + // } + return rc; +} diff --git a/ccsrc/Protocols/CPS/cps_codec.hh b/ccsrc/Protocols/CPS/cps_codec.hh index e69de29..9d3706a 100644 --- a/ccsrc/Protocols/CPS/cps_codec.hh +++ b/ccsrc/Protocols/CPS/cps_codec.hh @@ -0,0 +1,23 @@ +#pragma once + +#include "cps_pdu_codec.hh" +#include "codec.hh" +#include "params_its.hh" + +class BITSTRING; //! Forward declaration of TITAN class +class OCTETSTRING; //! Forward declaration of TITAN class + +namespace CPS__PDU__Descriptions { //! Forward declaration of asn1c CPS class + class CollectivePerceptionMessage; +} + +class cps_codec : public codec { + cps_pdu_codec asn_codec; + +public: + explicit cps_codec() : codec(), asn_codec(){}; + virtual ~cps_codec(){}; + + virtual int encode(const CPM__PDU__Descriptions::CollectivePerceptionMessage &cps, OCTETSTRING &data); + virtual int decode(const OCTETSTRING &data, CPM__PDU__Descriptions::CollectivePerceptionMessage &cps, params_its *params = NULL); +}; diff --git a/ccsrc/Protocols/CPS/cps_pdu_codec.cc b/ccsrc/Protocols/CPS/cps_pdu_codec.cc index e69de29..07d7c01 100644 --- a/ccsrc/Protocols/CPS/cps_pdu_codec.cc +++ b/ccsrc/Protocols/CPS/cps_pdu_codec.cc @@ -0,0 +1,16 @@ +#include "cps_pdu_codec.hh" +#include "LibItsCps_TypesAndValues.hh" +#include "asn1/asn_application.h" // from asn1c +#include "loggers.hh" + +extern "C" { +extern asn_TYPE_descriptor_t asn_DEF_CollectivePerceptionMessage; +} + +int cps_pdu_codec::encode(const CPM__PDU__Descriptions::CollectivePerceptionMessage &p_cps, BITSTRING &p_data) { + return _encode(CPM__PDU__Descriptions::CollectivePerceptionMessage_descr_, asn_DEF_CollectivePerceptionMessage, p_cps, p_data); +} + +int cps_pdu_codec::decode(const BITSTRING &p_data, CPM__PDU__Descriptions::CollectivePerceptionMessage &p_cps) { + return _decode(CPM__PDU__Descriptions::CollectivePerceptionMessage_descr_, asn_DEF_CollectivePerceptionMessage, p_data, p_cps); +} diff --git a/ccsrc/Protocols/CPS/cps_pdu_codec.hh b/ccsrc/Protocols/CPS/cps_pdu_codec.hh index e69de29..fd8ba93 100644 --- a/ccsrc/Protocols/CPS/cps_pdu_codec.hh +++ b/ccsrc/Protocols/CPS/cps_pdu_codec.hh @@ -0,0 +1,19 @@ +#pragma once + +#include "codec.hh" +#include "params.hh" +#include "per_codec.hh" + +class BITSTRING; //! Forward declaration of TITAN class +class OCTETSTRING; //! Forward declaration of TITAN class + +namespace CPM__PDU__Descriptions { //! Forward declaration of asn1c CPS class + class CollectivePerceptionMessage; +} + +class cps_pdu_codec : public per_codec { +public: + explicit cps_pdu_codec(){}; + virtual int encode(const CPM__PDU__Descriptions::CollectivePerceptionMessage &cps, BITSTRING &data); + virtual int decode(const BITSTRING &data, CPM__PDU__Descriptions::CollectivePerceptionMessage &); +}; diff --git a/ccsrc/Protocols/CPS/cps_types.hh b/ccsrc/Protocols/CPS/cps_types.hh index e69de29..0ffdfe0 100644 --- a/ccsrc/Protocols/CPS/cps_types.hh +++ b/ccsrc/Protocols/CPS/cps_types.hh @@ -0,0 +1,14 @@ +/*! + * \file cps_types.hh + * \brief Header file for TITAN CPS types. + * \author ETSI STF525 / TTF T036 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version ETSI TS 103 324 V2.1.1 + */ +#pragma once + +using namespace std; // Required for isnan() +#include "LibItsCps_TypesAndValues.hh" diff --git a/ccsrc/Protocols/CPS_layers/cps_layer.cc b/ccsrc/Protocols/CPS_layers/cps_layer.cc index e69de29..377e503 100644 --- a/ccsrc/Protocols/CPS_layers/cps_layer.cc +++ b/ccsrc/Protocols/CPS_layers/cps_layer.cc @@ -0,0 +1,164 @@ +#include "cps_types.hh" + +#include "LibItsCps_TestSystem.hh" + +#include "cps_layer_factory.hh" +#include "geonetworking_layer_factory.hh" + +#include "registration.hh" + +#include "loggers.hh" + +cps_layer::cps_layer(const std::string &p_type, const std::string ¶m) : t_layer(p_type), _params(), _codec() { + loggers::get_instance().log(">>> cps_layer::cps_layer: %s, %s", to_string().c_str(), param.c_str()); + // Setup parameters + params::convert(_params, param); + _params.insert(std::make_pair("its_aid", "36")); // ETSI TS 102 965 V2.1.1 (2021-11) + _params.insert(std::make_pair("payload_type", "2")); // CA message id - See ETSI TS 102 894 + + // Register this object for AdapterControlPort + loggers::get_instance().log("cps_layer::cps_layer: Register %s/%p", p_type.c_str(), this); + registration::get_instance().add_item(p_type, this); +} + +void cps_layer::sendMsg(const LibItsCps__TypesAndValues::CpsReq &p, params_its ¶ms) { + loggers::get_instance().log_msg(">>> cps_layer::sendMsg: ", p); + + // Encode CPS PDU + OCTETSTRING data; + if (_codec.encode(p.msgOut(), data) == -1) { + loggers::get_instance().warning("cps_layer::sendMsg: Encoding failure"); + return; + } + + send_data(data, _params); +} + +void cps_layer::send_data(OCTETSTRING &data, params &p_params) { + loggers::get_instance().log_msg(">>> cps_layer::send_data: ", data); + + send_to_all_layers(data, p_params); +} + +void cps_layer::receive_data(OCTETSTRING &data, params &p_params) { + loggers::get_instance().log_msg(">>> cps_layer::receive_data: ", data); + + // Sanity check + if (*(static_cast(data) + 1) != 0x02) { // Check that received packet has CA message id - See ETSI TS 102 894 + // Not a CPS message, discard it + loggers::get_instance().warning("cps_layer::receive_data: Wrong message id: 0x%02x", *(static_cast(data) + 1)); + return; + } + + // Decode the payload + params_its ¶ms = static_cast(p_params); + + LibItsCps__TypesAndValues::CpsInd p; + _codec.decode(data, p.msgIn()); + if (!p.msgIn().is_bound()) { + // Discard it + return; + } // else, continue + + // Process lower layer data + // recvTime + params_its::const_iterator it = params.find(params_its::timestamp); + if (it != params.cend()) { + p.recvTime().set_long_long_val(std::stoll(it->second)); + } else { + p.recvTime().set_to_omit(); + } + // gnNextHeader + it = params.find(params_its::gn_next_header); + if (it != params.cend()) { + p.gnNextHeader() = std::stoi(it->second); + } else { + p.gnNextHeader().set_to_omit(); + } + // gnHeaderType + it = params.find(params_its::gn_header_type); + if (it != params.cend()) { + p.gnHeaderType() = std::stoi(it->second); + } else { + p.gnHeaderType().set_to_omit(); + } + // gnHeaderSubtype + it = params.find(params_its::gn_header_sub_type); + if (it != params.cend()) { + p.gnHeaderSubtype() = std::stoi(it->second); + } else { + p.gnHeaderSubtype().set_to_omit(); + } + // gnLifetime + it = params.find(params_its::gn_lifetime); + if (it != params.cend()) { + p.gnLifetime() = std::stoi(it->second); + } else { + p.gnLifetime().set_to_omit(); + } + // gnTrafficClass + it = params.find(params_its::gn_traffic_class); + if (it != params.cend()) { + p.gnTrafficClass() = std::stoi(it->second); + } else { + p.gnTrafficClass().set_to_omit(); + } + // btpDestinationPort + it = params.find(params_its::btp_destination_port); + if (it != params.cend()) { + p.btpDestinationPort() = std::stoi(it->second); + } else { + p.btpDestinationPort().set_to_omit(); + } + // btpInfo + it = params.find(params_its::btp_info); + if (it != params.cend()) { + p.btpInfo() = std::stoi(it->second); + } else { + p.btpInfo().set_to_omit(); + } + // ssp + it = params.find(params_its::ssp); + if (it != params.cend()) { + loggers::get_instance().log("cps_layer::receive_data: ssp=%s", it->second.c_str()); + p.ssp() = oct2bit(str2oct(CHARSTRING(it->second.c_str()))); + } else { + p.ssp().set_to_omit(); + } + // its_aid + it = params.find(params_its::its_aid); + if (it != params.cend()) { + p.its__aid() = std::stoi(it->second); + } else { + p.its__aid().set_to_omit(); + } + + // Pass it to the ports if any + to_all_upper_ports(p, params); +} + +int cps_layer::enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security) { + loggers::get_instance().log(">>> cps_layer::enable_secured_mode: '%s' - %x", p_certificate_id.c_str(), p_enforce_security); + + geonetworking_layer *p = registration::get_instance().get_item(std::string("GN")); + if (p == NULL) { + return -1; + } + + loggers::get_instance().log("cps_layer::enable_secured_mode: Got GN layer %p", p); + return p->enable_secured_mode(p_certificate_id, p_enforce_security); +} + +int cps_layer::disable_secured_mode() { + loggers::get_instance().log(">>> cps_layer::disable_secured_mode"); + + geonetworking_layer *p = registration::get_instance().get_item(std::string("GN")); + if (p == NULL) { + return -1; + } + + loggers::get_instance().log("cps_layer::disable_secured_mode: Got GN layer %p", p); + return p->disable_secured_mode(); +} + +cps_layer_factory cps_layer_factory::_f; diff --git a/ccsrc/Protocols/CPS_layers/cps_layer.hh b/ccsrc/Protocols/CPS_layers/cps_layer.hh index e69de29..9e57068 100644 --- a/ccsrc/Protocols/CPS_layers/cps_layer.hh +++ b/ccsrc/Protocols/CPS_layers/cps_layer.hh @@ -0,0 +1,76 @@ +/*! + * \file cps_layer.hh + * \brief Header file for ITS CPS protocol layer. + * \author ETSI STF525 / TTF T036 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version ETSI TS 103 324 V2.1.1 + */ +#pragma once + +#include "cps_codec.hh" +#include "t_layer.hh" + +namespace LibItsCps__TestSystem { + class CpsPort; //! Forward declaration of TITAN class + class CpsReq; //! Forward declaration of TITAN class + class CpsInd; //! Forward declaration of TITAN class +} // namespace LibItsCps__TestSystem + +/*! + * \class cps_layer + * \brief This class provides description of ITS CPS protocol layer + */ +class cps_layer : public t_layer { + params_its _params; //! Layer parameters + cps_codec _codec; //! CPS codec +public: //! \publicsection + /*! + * \brief Default constructor + * Create a new instance of the cps_layer class + */ + explicit cps_layer() : t_layer(), _params(), _codec(){}; + /*! + * \brief Specialised constructor + * Create a new instance of the cps_layer class + * \param[in] p_type \todo + * \param[in] p_param \todo + */ + cps_layer(const std::string &p_type, const std::string ¶m); + /*! + * \brief Default destructor + */ + virtual ~cps_layer(){}; + + /*! + * \fn void sendMsg(const LibItsCps__TestSystem::CpsReq& p_cps_req, params& p_params); + * \brief Send CA message to the lower layers + * \param[in] p_cps_req The CA message to be sent + * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters + */ + void sendMsg(const LibItsCps__TypesAndValues::CpsReq &p_cps_req, params_its &p_params); + + /*! + * \virtual + * \fn void send_data(OCTETSTRING& data, params& params); + * \brief Send bytes formated data to the lower layers + * \param[in] p_data The data to be sent + * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters + */ + virtual void send_data(OCTETSTRING &data, params ¶ms); + /*! + * \virtual + * \fn void receive_data(OCTETSTRING& data, params& params); + * \brief Receive bytes formated data from the lower layers + * \param[in] p_data The bytes formated data received + * \param[in] p_params Some lower layers parameters values when data was received + */ + virtual void receive_data(OCTETSTRING &data, params &info); + + int enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security); + + int disable_secured_mode(); + +}; // End of class cps_layer diff --git a/ccsrc/Protocols/CPS_layers/cps_layer_factory.hh b/ccsrc/Protocols/CPS_layers/cps_layer_factory.hh index e69de29..cc4c9a3 100644 --- a/ccsrc/Protocols/CPS_layers/cps_layer_factory.hh +++ b/ccsrc/Protocols/CPS_layers/cps_layer_factory.hh @@ -0,0 +1,41 @@ +/*! + * \file cps_layer_factory.hh + * \brief Header file for ITS CAM protocol layer factory. + * \author ETSI STF525 / TTF T036 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version ETSI TS 103 324 V2.1.1 + */ +#pragma once + +#include "layer_stack_builder.hh" + +#include "cps_layer.hh" + +/*! + * \class cps_layer_factory + * \brief This class provides a factory class to create a cps_layer class instance + */ +class cps_layer_factory : public layer_factory { + static cps_layer_factory _f; //! Reference to the unique instance of this class +public: //! \publicsection + /*! + * \brief Default constructor + * Create a new instance of the cps_layer_factory class + * \remark The CAM layer identifier is CAM + */ + cps_layer_factory() { + // Register factory + layer_stack_builder::register_layer_factory("CPS", this); + }; + /*! + * \fn layer* create_layer(const std::string & type, const std::string & param); + * \brief Create the layers stack based on the provided layers stack description + * \param[in] p_type The provided layers stack description + * \param[in] p_params Optional parameters + * \return 0 on success, -1 otherwise + */ + inline virtual layer *create_layer(const std::string &p_type, const std::string &p_param) { return new cps_layer(p_type, p_param); }; +}; // End of class cps_layer_factory diff --git a/ccsrc/Protocols/DENM_layers/denm_layer.cc b/ccsrc/Protocols/DENM_layers/denm_layer.cc index b77aab2..9737f63 100644 --- a/ccsrc/Protocols/DENM_layers/denm_layer.cc +++ b/ccsrc/Protocols/DENM_layers/denm_layer.cc @@ -11,7 +11,7 @@ denm_layer::denm_layer(const std::string &p_type, const std::string ¶m) : t_ loggers::get_instance().log(">>> denm_layer::denm_layer: %s, %s", to_string().c_str(), param.c_str()); // Setup parameters params::convert(_params, param); - _params.insert(std::make_pair("its_aid", "37")); // ETSI TS 102 965 V1.2.1 (2015-06) + _params.insert(std::make_pair("its_aid", "37")); // ETSI TS 102 965 V2.1.1 (2021-11) _params.insert(std::make_pair("payload_type", "1")); // DE message id - See ETSI TS 102 894 // Register this object for AdapterControlPort diff --git a/ccsrc/Protocols/IVIM_layers/ivim_layer.cc b/ccsrc/Protocols/IVIM_layers/ivim_layer.cc index f186773..77f9cf2 100644 --- a/ccsrc/Protocols/IVIM_layers/ivim_layer.cc +++ b/ccsrc/Protocols/IVIM_layers/ivim_layer.cc @@ -13,7 +13,7 @@ ivim_layer::ivim_layer(const std::string &p_type, const std::string ¶m) : t_ loggers::get_instance().log(">>> ivim_layer::ivim_layer: %s, %s", to_string().c_str(), param.c_str()); // Setup parameters params_its::convert(_params, param); - _params.insert(std::make_pair("its_aid", "139")); // ETSI TS 102 965 V1.2.1 (2015-06) + _params.insert(std::make_pair("its_aid", "139")); // ETSI TS 102 965 V2.1.1 (2021-11) _params.insert(std::make_pair("payload_type", "6")); // IVI message id - See ETSI TS 103 301 // Register this object for AdapterControlPort diff --git a/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.cc b/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.cc index 8cfcf40..a5bf9df 100644 --- a/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.cc +++ b/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.cc @@ -12,7 +12,7 @@ mapem_spatem_layer::mapem_spatem_layer(const std::string &p_type, const std::str loggers::get_instance().log(">>> mapem_spatem_layer::mapem_spatem_layer: %s, %s", to_string().c_str(), param.c_str()); // Setup parameters params_its::convert(_params, param); - _params.insert(std::make_pair("its_aid", "138")); // ETSI TS 102 965 V1.2.1 (2015-06) + _params.insert(std::make_pair("its_aid", "138")); // ETSI TS 102 965 V2.1.1 (2021-11) _params.insert(std::make_pair("payload_type", "2")); // MAPE message id - See ETSI TS 102 894 // Register this object for AdapterControlPort diff --git a/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.cc b/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.cc index b74b030..1b7e1dc 100644 --- a/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.cc +++ b/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.cc @@ -14,7 +14,7 @@ RtcmemLayer::RtcmemLayer(const std::string &p_type, const std::string ¶m) loggers::get_instance().log(">>> RtcmemLayer::RtcmemLayer: %s, %s", to_string().c_str(), param.c_str()); // Setup parameters params_its::convert(_params, param); - _params.insert(std::make_pair("its_aid", "128")); // ETSI TS 102 965 V1.2.1 (2015-06) + _params.insert(std::make_pair("its_aid", "128")); // ETSI TS 102 965 V2.1.1 (2021-11) _params.insert(std::make_pair("payload_type", "13")); // RTCME message id - See ETSI TS 103 301 // Register this object for AdapterControlPort diff --git a/ccsrc/Protocols/SremSsem_layers/SremSsemLayer.cc b/ccsrc/Protocols/SremSsem_layers/SremSsemLayer.cc index ea17f7b..8a93acf 100644 --- a/ccsrc/Protocols/SremSsem_layers/SremSsemLayer.cc +++ b/ccsrc/Protocols/SremSsem_layers/SremSsemLayer.cc @@ -12,7 +12,7 @@ SremSsemLayer::SremSsemLayer(const std::string &p_type, const std::string ¶m loggers::get_instance().log(">>> SremSsemLayer::SremSsemLayer: %s, %s", to_string().c_str(), param.c_str()); // Setup parameters params_its::convert(_params, param); - _params.insert(std::make_pair("its_aid", "140")); // ETSI TS 102 965 V1.2.1 (2015-06) + _params.insert(std::make_pair("its_aid", "140")); // ETSI TS 102 965 V2.1.1 (2021-11) _params.insert(std::make_pair("payload_type", "2")); _params.insert(std::make_pair("dst_port", "2007")); diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc index e69de29..f072a0b 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc @@ -0,0 +1,190 @@ +#include +//#include + +#include "loggers.hh" +#include "uppertester_cps_codec.hh" + +#include "LibItsCps_TypesAndValues.hh" + +#include "cps_codec.hh" + +template class OPTIONAL; +class TTCN_EncDec; + +unsigned char uppertester_cps_codec::c_utCpsInitialize = 0x00; +unsigned char uppertester_cps_codec::c_utCpsInitializeResult = 0x01; +unsigned char uppertester_cps_codec::c_utCpsEventInd = 0x23; + +int uppertester_cps_codec::encode(const Record_Type &msg, OCTETSTRING &data) { + loggers::get_instance().log_msg(">>> uppertester_cps_codec::encode: ", (const Record_Type &)msg); + + TTCN_EncDec::clear_error(); + TTCN_Buffer encoding_buffer; + if (std::string(msg.get_descriptor()->name).compare("@LibItsCps_TypesAndValues.UtCpsInitialize") == 0) { + encoding_buffer.put_c(static_cast(uppertester_cps_codec::c_utCpsInitialize)); + } else { // Error + data = OCTETSTRING(0, nullptr); + loggers::get_instance().warning("<<< uppertester_cps_codec::encode: Failed to encode UT message"); + return -1; + } + encode_(msg, *msg.get_descriptor(), encoding_buffer); + data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); + loggers::get_instance().log_msg("<<< uppertester_cps_codec::encode: data=", data); + return 0; +} + +int uppertester_cps_codec::encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer) { + loggers::get_instance().log(">>> uppertester_cps_codec::encode_: processing %s/%s/%p", type.get_descriptor()->name, field_descriptor.name, + dynamic_cast(&type)); + loggers::get_instance().log_msg(">>> uppertester_cps_codec::encode_: ", type); + + if (dynamic_cast(&type) != NULL) { + const Record_Type &r = (const Record_Type &)type; + loggers::get_instance().log("uppertester_cps_codec::encode_: processing Record_Type %s", r.get_descriptor()->name); + for (int i = 0; i < r.get_count(); i++) { + loggers::get_instance().log("uppertester_cps_codec::encode_: processing %s/%s/%s - %d (1 ==> use dynamic_cast) - %d", r.fld_name(i), + r.fld_descr(i)->name, r.get_at(i)->get_descriptor()->name, r.get_at(i)->is_optional(), r.get_at(i)->is_present()); + if (r.get_at(i)->is_present()) { + if (encode_(*r.get_at(i), *r.fld_descr(i), encoding_buffer) == -1) { + loggers::get_instance().warning("uppertester_cps_codec::encode_: -1 result code returned"); + return -1; + } + } else if (std::string(r.fld_name(i)).compare("alacarte") == 0) { + // Add empty field length + loggers::get_instance().log("uppertester_cps_codec::encode_: alacarte is missing, add 0x00"); + encoding_buffer.put_c(0x00); + } + } // End of 'for' statement + } else { + std::string s(field_descriptor.name); + loggers::get_instance().log("uppertester_cps_codec::encode_: field to process %s", s.c_str()); + if ((s.rfind(".shape") != string::npos) || (s.rfind(".relevanceDistance") != string::npos) || (s.rfind(".relevanceTrafficDirection") != string::npos)) { + encoding_buffer.put_c((unsigned char)static_cast(type).as_int()); + } else if (s.rfind(".payload") != string::npos) { + const OCTETSTRING & os = static_cast(type); + const unsigned char s[] = {(unsigned char)((os.lengthof() & 0x0000FF00) >> 8), (unsigned char)os.lengthof()}; + encoding_buffer.put_s(2, s); + if (os.lengthof() != 0) { + encoding_buffer.put_string(os); + } + } else if (s.rfind(".detectionTime") != string::npos) { + unsigned long long llu = static_cast(type).get_long_long_val(); + loggers::get_instance().log("uppertester_cps_codec::encode_ : detectionTime=%llu", llu); + std::vector v; + for (int i = 0; i < 6; i++) { + v.insert(v.begin(), static_cast(llu)); + llu >>= 8; + } // End of 'for' statement + OCTETSTRING os(v.size(), v.data()); + loggers::get_instance().log_msg("uppertester_cps_codec::encode_: timeDetection=", os); + encoding_buffer.put_string(os); + } else if ((s.rfind(".validityDuration") != string::npos) || (s.rfind(".repetitionDuration") != string::npos)) { + if (type.is_present()) { + const OPTIONAL &o = dynamic_cast &>(type); + const INTEGER & i = static_cast(*o.get_opt_value()); + loggers::get_instance().log_msg("uppertester_cps_codec::encode_: i=", i); + encoding_buffer.put_string(int2oct(i, 3)); + } + } else if ((s.rfind(".informationQuality") != string::npos) || (s.rfind(".causeCode") != string::npos) || (s.rfind(".subCauseCode") != string::npos)) { + const INTEGER &i = static_cast(type); + encoding_buffer.put_string(int2oct(i, 1)); + } else if ((s.rfind(".linkedCause") != string::npos) || (s.rfind(".eventHistory") != string::npos)) { + // Skip them + } else if ((s.rfind(".transmissionInterval") != string::npos) || (s.rfind(".repetitionInterval") != string::npos)) { + if (type.is_present()) { + const OPTIONAL &o = dynamic_cast &>(type); + const INTEGER & i = static_cast(*o.get_opt_value()); + encoding_buffer.put_string(int2oct(i, 2)); + } + } else if (s.rfind(".originatingStationID") != string::npos) { + const INTEGER &i = static_cast(type); + encoding_buffer.put_string(int2oct(i, 4)); + } else if (s.rfind(".sequenceNumber") != string::npos) { + const INTEGER &i = static_cast(type); + encoding_buffer.put_string(int2oct(i, 2)); + } else if (s.rfind(".AlacarteContainer") != string::npos) { + const OPTIONAL &o = dynamic_cast &>(type); + const OCTETSTRING & os = static_cast(*o.get_opt_value()); + encoding_buffer.put_string(int2oct(os.lengthof(), 2)); + encoding_buffer.put_string(os); + } else { + loggers::get_instance().log("uppertester_cps_codec::encode_ (else): processing type %s/%s", type.get_descriptor()->name, field_descriptor.name); + type.encode(field_descriptor, encoding_buffer, TTCN_EncDec::CT_RAW); + } + } + + loggers::get_instance().log_to_hexa("<<>> uppertester_cps_codec::decode: decoding_buffer=", decoding_buffer); + // decode_(msg, *msg.get_descriptor(), decoding_buffer); + + loggers::get_instance().log_msg("<<< uppertester_cps_codec::decode: ", (const Record_Type &)msg); + return 0; +} + +std::unique_ptr uppertester_cps_codec::decode(const OCTETSTRING &data, params_its *params) { + + std::unique_ptr result; + + const unsigned char *ptr = static_cast(data); + if (*ptr != uppertester_cps_codec::c_utCpsEventInd) { + LibItsCps__TypesAndValues::UtCpsResults res; + if (decode(data, res, params) == 0) { + result.reset((Base_Type *)res.clone()); + } else { + result.reset(nullptr); + } + } else { + LibItsCps__TypesAndValues::UtCpsEventInd ind; + decode(data, ind, params); + result.reset((Base_Type *)ind.clone()); + } + + return result; +} + +int uppertester_cps_codec::decode(const OCTETSTRING &data, LibItsCps__TypesAndValues::UtCpsResults &msg, params_its *params) { + loggers::get_instance().log_to_hexa(">>> uppertester_cps_codec::decode: decoding_buffer=", data); + + const unsigned char *ptr = static_cast(data); + if (*ptr == uppertester_cps_codec::c_utCpsInitializeResult) { + msg.utCpsInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); + } else if (*ptr == 0x24) { // TODO Use a constant for "Peer does not support is "Peer does not support the command" + // Peer does not support the command + msg.utCpsInitializeResult() = 0x00; + } else { + loggers::get_instance().warning("uppertester_cps_codec::decode: Unsupported result"); + return -1; + } + + loggers::get_instance().log_msg("<<< uppertester_cps_codec::decode", msg); + return 0; +} + +int uppertester_cps_codec::decode(const OCTETSTRING &data, LibItsCps__TypesAndValues::UtCpsEventInd &msg, params_its *params) { + loggers::get_instance().log_to_hexa(">>> uppertester_cps_codec::decode (1): decoding_buffer=", data); + + const unsigned char *ptr = static_cast(data) + 1; + OCTETSTRING os(2, ptr); + const unsigned int length = (const unsigned int)((*ptr << 8 & 0xff00) | *(ptr + 1)); + ptr += 2; + loggers::get_instance().log("uppertester_cps_codec::decode (1): CPS message length=%d", length); + if (data.lengthof() - 3 != (const int)length) { + loggers::get_instance().warning("uppertester_cps_codec::decode (1) (4): Wrong payload length: %d", length); + return -1; + } + os = OCTETSTRING(length, ptr); + loggers::get_instance().log_to_hexa("uppertester_cps_codec::decode (1): CPS message=", os); + cps_codec codec; + codec.decode(os, msg.cpsMsg(), params); + + loggers::get_instance().log_msg("<<< uppertester_cps_codec::decode (1)", msg); + return 0; +} diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_cps_codec.hh index e69de29..57b1660 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cps_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_cps_codec.hh @@ -0,0 +1,50 @@ +/*! + * \file uppertester_cps_codec.hh + * \brief Header file for ITS UpperTester CAM codec definition. + * \author ETSI STF525 / TTF T036 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ +#pragma once + +#include + +#include "codec.hh" +#include "params.hh" + +class Base_Type; +class Record_Type; +class TTCN_Typedescriptor_t; +class TTCN_Buffer; + +namespace LibItsCps__TypesAndValues { + class UtCpsTrigger; + class UtCpsResults; + class UtCpsEventInd; +} // namespace LibItsCps__TypesAndValues + +class uppertester_cps_codec : public codec { +public: + static unsigned char c_utCpsInitialize; + static unsigned char c_utCpsInitializeResult; + static unsigned char c_utCpsEventInd; + +private: + int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); + +public: + uppertester_cps_codec() : codec(){}; + virtual ~uppertester_cps_codec(){}; + + virtual int encode(const Record_Type &, OCTETSTRING &data); + //int encode(const LibItsCps__TypesAndValues::UtCpsTrigger &, OCTETSTRING &data); + virtual int decode(const OCTETSTRING &data, Record_Type &, params_its *params = NULL); + std::unique_ptr decode(const OCTETSTRING &data, params_its *params = NULL); + +private: + int decode(const OCTETSTRING &data, LibItsCps__TypesAndValues::UtCpsResults &msg, params_its *params = NULL); + int decode(const OCTETSTRING &data, LibItsCps__TypesAndValues::UtCpsEventInd &msg, params_its *params = NULL); +}; // End of class uppertester_cps_codec diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc index e69de29..115c964 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc @@ -0,0 +1,51 @@ +#include "uppertester_cps_layer_factory.hh" + +#include "LibItsCps_TestSystem.hh" +#include "LibItsCps_TypesAndValues.hh" + +#include "loggers.hh" + +uppertester_cps_layer::uppertester_cps_layer(const std::string &p_type, const std::string ¶m) + : t_layer(p_type), _params(), _codec() { + loggers::get_instance().log(">>> uppertester_cps_layer::uppertester_cps_layer: %s, %s", to_string().c_str(), param.c_str()); + // Setup parameters + params::convert(_params, param); + params::const_iterator it = _params.find(params::loopback); + if (it == _params.cend()) { + _params.insert(std::pair(params::loopback, "0")); + } +} + +void uppertester_cps_layer::sendMsg(const LibItsCps__TypesAndValues::UtCpsInitialize &send_par, params_its &p_params) { + loggers::get_instance().log_msg(">>> uppertester_cps_layer::sendMsg", send_par); + + if (_params[params::loopback].compare("1") == 0) { + LibItsCps__TypesAndValues::UtCpsResults ut_cps_results; + ut_cps_results.utCpsInitializeResult() = BOOLEAN(true); + to_all_upper_ports(ut_cps_results, p_params); + } else { + // Encode UpperTester PDU + OCTETSTRING data; + _codec.encode((const Record_Type &)send_par, data); + // Update parameters + send_data(data, p_params); + } +} + +void uppertester_cps_layer::send_data(OCTETSTRING &data, params &p_params) { + loggers::get_instance().log_msg(">>> uppertester_cps_layer::send_data: ", data); + // params.log(); + send_to_all_layers(data, p_params); +} + +void uppertester_cps_layer::receive_data(OCTETSTRING &data, params &p_params) { + loggers::get_instance().log_msg(">>> uppertester_cps_layer::receive_data: ", data); + + std::unique_ptr r = _codec.decode(data); + if (r.get() != nullptr) { + // Pass it to the ports if any + to_all_upper_ports(*r, p_params); + } +} + +uppertester_cps_layer_factory uppertester_cps_layer_factory::_f; diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_cps_layer.hh index e69de29..afcb837 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cps_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_cps_layer.hh @@ -0,0 +1,39 @@ +/*! + * \file uppertester_cps_layer.hh + * \brief Header file for ITS UpperTester CAM protocol layer definition. + * \author ETSI STF525 / TTF T036 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ +#pragma once + +#include + +#include "t_layer.hh" +#include "uppertester_cps_codec.hh" + +namespace LibItsCps__TestSystem { + class UpperTesterPort; +} + +namespace LibItsCps__TypesAndValues { + class UtCpsInitialize; +} // namespace LibItsCps__TypesAndValues + +class uppertester_cps_layer : public t_layer { + params_its _params; + uppertester_cps_codec _codec; + +public: + uppertester_cps_layer() : t_layer(), _params(), _codec(){}; + uppertester_cps_layer(const std::string &p_type, const std::string ¶m); + virtual ~uppertester_cps_layer(){}; + + void sendMsg(const LibItsCps__TypesAndValues::UtCpsInitialize &send_par, params_its& p_params); + + virtual void send_data(OCTETSTRING &data, params& p_params); + virtual void receive_data(OCTETSTRING &data, params& p_params); +}; // End of class uppertester_cps_layer diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_layer_factory.hh b/ccsrc/Protocols/UpperTester/uppertester_cps_layer_factory.hh index e69de29..16f0f9d 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cps_layer_factory.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_cps_layer_factory.hh @@ -0,0 +1,26 @@ +/*! + * \file uppertester_cps_layer_factory.hh + * \brief Header file for ITS CAM Upper Tester protocol layer factory. + * \author ETSI STF525 / TTF T036 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ +#pragma once + +#include "layer_stack_builder.hh" + +#include "uppertester_cps_layer.hh" + +class uppertester_cps_layer_factory : public layer_factory { + static uppertester_cps_layer_factory _f; + +public: + uppertester_cps_layer_factory() { + // Register factory + layer_stack_builder::register_layer_factory("UT_CPS", this); + }; + inline virtual layer *create_layer(const std::string &p_type, const std::string &p_param) { return new uppertester_cps_layer(p_type, p_param); }; +}; // End of class uppertester_cps_layer_factory diff --git a/etc/AtsCPS/AtsCPS_Simulator.cfg_ b/etc/AtsCPS/AtsCPS_Simulator.cfg_ new file mode 100644 index 0000000..5d54776 --- /dev/null +++ b/etc/AtsCPS/AtsCPS_Simulator.cfg_ @@ -0,0 +1,118 @@ + +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# IUT Station ID +LibItsCommon_Pixits.PX_IUT_STATION_ID := 2533729309 + +LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB + +LibItsCps_Pics.PICS_DANGEROUSGOODS := true +LibItsCps_Pics.PICS_IS_IUT_SECURED := true + +[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). +LogFile := "../logs/AtsCPS/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | TIMEROP | VERDICTOP +#ConsoleMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | TIMEROP | VERDICTOP +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +# CPS Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# header_sub_type : sh (single hop) +# DENM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# BTP Layer +# type : btpA|btpB +# destination port: dst_port +# source port : src_port +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# GN Layer +# ll_address : GeoNetworking address of the Test System for beaconing. To be align with CPS +# latitude : Latitude of the Test System +# longitude : Longitude of the Test System +# beaconing : Set to 1 if GnLayer shall start beaconing +# expiry : Beaconing timer expiry (ms) +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# secured_mode : Set to 1 if message exchanges shall be signed +# encrypted_mode : Set to 1 if message exchanges shall be encrypted +# NOTE: For signed & encrypted message exchanges, both secured_mode and encrypted_mode shall be set to 1 +# sec_db_path : Path to the certificates and keys storage location +# hash : Hash algorithm to be used when secured mode is set +# Authorized values are SHA-256 or SHA-384 +# Default: SHA-256 +# cypher : Cyphering algorithm to be used when secured mode is set +# Authorized values are NISTP-256 and BP-256 +# Default: NISTP-256 +# Ethernet layer +# mac_src :Source MAC address +# mac_bc :Broadcast address +# eth_type : Ethernet type +# Commsignia layer +# mac_src : IUT MAC address, used to discard packets +# To indicate no filering, use the value 000000000000 +# mac_bc : Broadcast address +# eth_type : Ethernet type, used to discard packets +# target_host : Device address +# target_port : Device port +# source_port : Test System port +# interface_id: Interface id, used to discard packets +# tx_power : TX power (dB) +# xport_mode : G5 or LTE-V2X +# UDP layer (IP/UDP based on Pcap) +# dst_ip : Destination IPv4 address (aa.bb.cc.dd) +# dst_port: Destination port +# src_ip : Source IPv4 address (aa.bb.cc.dd) +# src_port: Source port +# Pcap layer +# mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System +# filter : Pcap filter (compliant with tcpdump syntax) +# Online mode: +# nic: Local NIC +# If set, online mode is used +# Offline mode (nic is present but not set): +# file : File to read +# frame_offset: Frame offset, used to skip packets with frame number < frame_offset +# time_offset : Time offset, used to skip packets with time offset < time_offset +# save_mode : Set to 1 to save sent packet, 0 otherwise + +# Cygwin +#system.cpmPort.params := "CPS(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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.cpmPort.params := "CPS(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947)" +# Linux over UDP +#system.cpmPort.params := "CPS(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.43,src_port=4041,dst_port=9091)" + +# PC5 + UU/Raw +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=515340240,longitude=139274330,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates_iut)/LTE(mac_src=8c554ac1eee1,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.43,dst_port=4041,src_port=9091)" +# PC5 + Uu/MQTT +# Raw UDP +#system.cpmPort.params := "CPS(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=udp,debug=1,server=192.168.1.39,port=1883)" +# MQTT over TCP +#system.cpmPort.params := "CPS(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=192.168.1.39,port=1883)" + +# CPS UpperTester port based on UDP +system.utPort.params := "UT_CPS/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" +#system.utPort.params := "UT_CPS/UDP(dst_ip=192.168.146.26)" +#system.utPort.params := "UT_CPS/UDP(dst_ip=172.16.35.1)" + +[EXECUTE] + + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/install.sh b/install.sh index 7d7850f..3083db7 100755 --- a/install.sh +++ b/install.sh @@ -52,7 +52,7 @@ do #ln 'ISO14906(2018)EfcDsrcGenericv7-patched.asn' EfcDsrcGeneric.asn #ln ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn ElectronicRegistrationIdentificationVehicleDataModule.asn #ln ISO14823-missing.asn GDD.asn - cd - + #cd - fi SUB_DIRS=`find . -type d` if [ "SUB_DIRS" != "" ] diff --git a/ttcn/AtsCPS b/ttcn/AtsCPS index 5b05801..86797be 160000 --- a/ttcn/AtsCPS +++ b/ttcn/AtsCPS @@ -1 +1 @@ -Subproject commit 5b05801736ab1b9f7293a3f454b62ec1a7580b43 +Subproject commit 86797beb7d7ff45f926ac0b591557fddd1539155 -- GitLab From 44676d2745ae3b8eaa6001674d1e20252b427c94 Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 20 Jun 2024 11:26:29 +0200 Subject: [PATCH 139/178] Add logs folder --- logs/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 logs/README.md diff --git a/logs/README.md b/logs/README.md new file mode 100644 index 0000000..e69de29 -- GitLab From dee2bc3d8efc969f4a0349e355690be8a5b3d245 Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 20 Jun 2024 14:17:40 +0200 Subject: [PATCH 140/178] AtsCPS code review --- ccsrc/EncDec/LibItsCps_Encdec.cc | 56 +++++++++---------- ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.cc | 4 +- ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.hh | 4 +- ccsrc/Protocols/CPS/cps_codec.hh | 2 +- ccsrc/Protocols/CPS_layers/cps_layer.cc | 8 +-- ccsrc/Protocols/CPS_layers/cps_layer.hh | 8 +-- .../Protocols/CPS_layers/cps_layer_factory.hh | 2 +- .../UpperTester/uppertester_cps_layer.hh | 2 +- .../uppertester_cps_layer_factory.hh | 2 +- etc/AtsCPS/AtsCPS_Simulator.cfg_ | 8 ++- 10 files changed, 51 insertions(+), 45 deletions(-) diff --git a/ccsrc/EncDec/LibItsCps_Encdec.cc b/ccsrc/EncDec/LibItsCps_Encdec.cc index acdf871..99d8689 100644 --- a/ccsrc/EncDec/LibItsCps_Encdec.cc +++ b/ccsrc/EncDec/LibItsCps_Encdec.cc @@ -8,11 +8,11 @@ namespace LibItsCps__EncdecDeclarations { /**************************************************** - * @desc External function to encode a CpsReq type + * @desc External function to encode a CpmReq type * @param value to encode * @return encoded value ****************************************************/ - BITSTRING fx__enc__CpsReq(const LibItsCps__TypesAndValues::CpsReq &p_cpsReq) { + BITSTRING fx__enc__CpsReq(const LibItsCps__TypesAndValues::CpmReq &p_cpsReq) { loggers::get_instance().log_msg(">>> fx__enc__CpsReq: ", p_cpsReq); cps_codec codec; @@ -26,11 +26,11 @@ namespace LibItsCps__EncdecDeclarations { } /**************************************************** - * @desc External function to decode a CpsReq type + * @desc External function to decode a CpmReq type * @param value to encode * @return encoded value ****************************************************/ - INTEGER fx__dec__CpsReq(BITSTRING &b, LibItsCps__TypesAndValues::CpsReq &p) { + INTEGER fx__dec__CpsReq(BITSTRING &b, LibItsCps__TypesAndValues::CpmReq &p) { loggers::get_instance().log(">>> fx__dec__CpsReq"); // Sanity check @@ -51,7 +51,7 @@ namespace LibItsCps__EncdecDeclarations { return 0; } - INTEGER fx__dec__CpsInd(BITSTRING &b, LibItsCps__TypesAndValues::CpsInd &p_cpsInd) { + INTEGER fx__dec__CpsInd(BITSTRING &b, LibItsCps__TypesAndValues::CpmInd &p_cpsInd) { loggers::get_instance().log(">>> fx__dec__CpsInd"); // Sanity check @@ -64,11 +64,11 @@ namespace LibItsCps__EncdecDeclarations { OCTETSTRING is = bit2oct(b); // Calculate the size of the lower layers information - int s = (LibItsCps__TypesAndValues::CpsInd_gnNextHeader_raw_.fieldlength + LibItsCps__TypesAndValues::CpsInd_gnHeaderType_raw_.fieldlength + - LibItsCps__TypesAndValues::CpsInd_gnHeaderSubtype_raw_.fieldlength + LibItsCps__TypesAndValues::CpsInd_gnLifetime_raw_.fieldlength + - LibItsCps__TypesAndValues::CpsInd_gnTrafficClass_raw_.fieldlength + LibItsCps__TypesAndValues::CpsInd_btpDestinationPort_raw_.fieldlength + - LibItsCps__TypesAndValues::CpsInd_btpInfo_raw_.fieldlength + LibItsCps__TypesAndValues::CpsInd_ssp_raw_.fieldlength + - LibItsCps__TypesAndValues::CpsInd_its__aid_raw_.fieldlength) / + int s = (LibItsCps__TypesAndValues::CpmInd_gnNextHeader_raw_.fieldlength + LibItsCps__TypesAndValues::CpmInd_gnHeaderType_raw_.fieldlength + + LibItsCps__TypesAndValues::CpmInd_gnHeaderSubtype_raw_.fieldlength + LibItsCps__TypesAndValues::CpmInd_gnLifetime_raw_.fieldlength + + LibItsCps__TypesAndValues::CpmInd_gnTrafficClass_raw_.fieldlength + LibItsCps__TypesAndValues::CpmInd_btpDestinationPort_raw_.fieldlength + + LibItsCps__TypesAndValues::CpmInd_btpInfo_raw_.fieldlength + LibItsCps__TypesAndValues::CpmInd_ssp_raw_.fieldlength + + LibItsCps__TypesAndValues::CpmInd_its__aid_raw_.fieldlength) / 8; // Decode CA message if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), cps) == -1) { @@ -80,91 +80,91 @@ namespace LibItsCps__EncdecDeclarations { TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); // gnNextHeader - if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_gnNextHeader_raw_.fieldlength / 8)) { + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpmInd_gnNextHeader_raw_.fieldlength / 8)) { p_cpsInd.gnNextHeader().set_to_omit(); } else { OCTETSTRING os; - os.decode(LibItsCps__TypesAndValues::CpsInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + os.decode(LibItsCps__TypesAndValues::CpmInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_cpsInd.gnNextHeader() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__CpsInd: gnNextHeader=", p_cpsInd.gnNextHeader()); loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); // gnHeaderType - if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_gnHeaderType_raw_.fieldlength / 8)) { + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpmInd_gnHeaderType_raw_.fieldlength / 8)) { p_cpsInd.gnHeaderType().set_to_omit(); } else { OCTETSTRING os; - os.decode(LibItsCps__TypesAndValues::CpsInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + os.decode(LibItsCps__TypesAndValues::CpmInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_cpsInd.gnHeaderType() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__CpsInd: gnHeaderType=", p_cpsInd.gnHeaderType()); loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); // gnHeaderSubtype - if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_gnHeaderSubtype_raw_.fieldlength / 8)) { + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpmInd_gnHeaderSubtype_raw_.fieldlength / 8)) { p_cpsInd.gnHeaderSubtype().set_to_omit(); } else { OCTETSTRING os; - os.decode(LibItsCps__TypesAndValues::CpsInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + os.decode(LibItsCps__TypesAndValues::CpmInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_cpsInd.gnHeaderSubtype() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__CpsInd: gnHeaderSubtype=", p_cpsInd.gnHeaderSubtype()); loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); // gnLifetime - if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_gnLifetime_raw_.fieldlength / 8)) { + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpmInd_gnLifetime_raw_.fieldlength / 8)) { p_cpsInd.gnLifetime().set_to_omit(); } else { INTEGER i; - i.decode(LibItsCps__TypesAndValues::CpsInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + i.decode(LibItsCps__TypesAndValues::CpmInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_cpsInd.gnLifetime() = i; } loggers::get_instance().log_msg("fx__dec__CpsInd: gnLifetime=", p_cpsInd.gnLifetime()); loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); // gnTrafficClass - if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_gnTrafficClass_raw_.fieldlength / 8)) { + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpmInd_gnTrafficClass_raw_.fieldlength / 8)) { p_cpsInd.gnTrafficClass().set_to_omit(); } else { OCTETSTRING os; - os.decode(LibItsCps__TypesAndValues::CpsInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + os.decode(LibItsCps__TypesAndValues::CpmInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_cpsInd.gnTrafficClass() = oct2int(os); } loggers::get_instance().log_msg("fx__dec__CpsInd: gnTrafficClass=", p_cpsInd.gnTrafficClass()); loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); // btpDestinationPort - if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_btpDestinationPort_raw_.fieldlength / 8)) { + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpmInd_btpDestinationPort_raw_.fieldlength / 8)) { p_cpsInd.btpDestinationPort().set_to_omit(); } else { INTEGER i; - i.decode(LibItsCps__TypesAndValues::CpsInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + i.decode(LibItsCps__TypesAndValues::CpmInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_cpsInd.btpDestinationPort() = i; } loggers::get_instance().log_msg("fx__dec__CpsInd: btpDestinationPort=", p_cpsInd.btpDestinationPort()); loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); // btpInfo - if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_btpInfo_raw_.fieldlength / 8)) { + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpmInd_btpInfo_raw_.fieldlength / 8)) { p_cpsInd.btpInfo().set_to_omit(); } else { INTEGER i; - i.decode(LibItsCps__TypesAndValues::CpsInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + i.decode(LibItsCps__TypesAndValues::CpmInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_cpsInd.btpInfo() = i; } loggers::get_instance().log_msg("fx__dec__CpsInd: btpInfo=", p_cpsInd.btpInfo()); loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); // ssp - if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_ssp_raw_.fieldlength / 8)) { + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpmInd_ssp_raw_.fieldlength / 8)) { p_cpsInd.ssp().set_to_omit(); } else { BITSTRING bs; - bs.decode(LibItsCps__TypesAndValues::CpsInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + bs.decode(LibItsCps__TypesAndValues::CpmInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_cpsInd.ssp() = bs; } loggers::get_instance().log_msg("fx__dec__CpsInd: ssp=", p_cpsInd.ssp()); loggers::get_instance().log_to_hexa("fx__dec__CpsInd: ", decoding_buffer); // its__aid - if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpsInd_its__aid_raw_.fieldlength / 8)) { + if (decoding_buffer.get_read_len() < static_cast(LibItsCps__TypesAndValues::CpmInd_its__aid_raw_.fieldlength / 8)) { p_cpsInd.its__aid().set_to_omit(); } else { INTEGER i; - i.decode(LibItsCps__TypesAndValues::CpsInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + i.decode(LibItsCps__TypesAndValues::CpmInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_cpsInd.its__aid() = i; } loggers::get_instance().log_msg("fx__dec__CpsInd: its_aid=", p_cpsInd.its__aid()); diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.cc b/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.cc index 9f9204c..62454e1 100644 --- a/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.cc +++ b/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.cc @@ -69,7 +69,7 @@ namespace LibItsCps__TestSystem { void CpsPort::user_stop() {} - void CpsPort::outgoing_send(const LibItsCps__TypesAndValues::CpsReq &send_par) { + void CpsPort::outgoing_send(const LibItsCps__TypesAndValues::CpmReq &send_par) { loggers::get_instance().log_msg(">>> CpsPort::outgoing_send: payload=", send_par); float duration; @@ -79,7 +79,7 @@ namespace LibItsCps__TestSystem { loggers::get_instance().set_stop_time(_time_key, duration); } - void CpsPort::receiveMsg(const LibItsCps__TypesAndValues::CpsInd &p_ind, const params& p_params) { + void CpsPort::receiveMsg(const LibItsCps__TypesAndValues::CpmInd &p_ind, const params& p_params) { //loggers::get_instance().log_msg(">>> CpsPort::receive_msg: ", p_ind); const params_its& p = static_cast(p_params); loggers::get_instance().log(">>> CpsPort::receive_msg: %s", p.station_id.c_str()); diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.hh b/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.hh index bd95056..00d520b 100644 --- a/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.hh +++ b/ccsrc/Ports/LibIts_ports/CPS_ports/CpsPort.hh @@ -29,7 +29,7 @@ namespace LibItsCps__TestSystem { void set_parameter(const char *parameter_name, const char *parameter_value); - void receiveMsg(const LibItsCps__TypesAndValues::CpsInd&, const params&); + void receiveMsg(const LibItsCps__TypesAndValues::CpmInd&, const params&); private: /* void Handle_Fd_Event(int fd, boolean is_readable, @@ -45,7 +45,7 @@ namespace LibItsCps__TestSystem { void user_start(); void user_stop(); - void outgoing_send(const LibItsCps__TypesAndValues::CpsReq &send_par); + void outgoing_send(const LibItsCps__TypesAndValues::CpmReq &send_par); }; } // namespace LibItsCps__TestSystem diff --git a/ccsrc/Protocols/CPS/cps_codec.hh b/ccsrc/Protocols/CPS/cps_codec.hh index 9d3706a..4504e9e 100644 --- a/ccsrc/Protocols/CPS/cps_codec.hh +++ b/ccsrc/Protocols/CPS/cps_codec.hh @@ -7,7 +7,7 @@ class BITSTRING; //! Forward declaration of TITAN class class OCTETSTRING; //! Forward declaration of TITAN class -namespace CPS__PDU__Descriptions { //! Forward declaration of asn1c CPS class +namespace CPM__PDU__Descriptions { //! Forward declaration of asn1c CPS class class CollectivePerceptionMessage; } diff --git a/ccsrc/Protocols/CPS_layers/cps_layer.cc b/ccsrc/Protocols/CPS_layers/cps_layer.cc index 377e503..07030cb 100644 --- a/ccsrc/Protocols/CPS_layers/cps_layer.cc +++ b/ccsrc/Protocols/CPS_layers/cps_layer.cc @@ -13,15 +13,15 @@ cps_layer::cps_layer(const std::string &p_type, const std::string ¶m) : t_la loggers::get_instance().log(">>> cps_layer::cps_layer: %s, %s", to_string().c_str(), param.c_str()); // Setup parameters params::convert(_params, param); - _params.insert(std::make_pair("its_aid", "36")); // ETSI TS 102 965 V2.1.1 (2021-11) - _params.insert(std::make_pair("payload_type", "2")); // CA message id - See ETSI TS 102 894 + _params.insert(std::make_pair("its_aid", "639")); // ETSI TS 102 965 V2.1.1 (2021-11) + _params.insert(std::make_pair("payload_type", "2")); // CP message id - See ETSI TS 102 894 // Register this object for AdapterControlPort loggers::get_instance().log("cps_layer::cps_layer: Register %s/%p", p_type.c_str(), this); registration::get_instance().add_item(p_type, this); } -void cps_layer::sendMsg(const LibItsCps__TypesAndValues::CpsReq &p, params_its ¶ms) { +void cps_layer::sendMsg(const LibItsCps__TypesAndValues::CpmReq &p, params_its ¶ms) { loggers::get_instance().log_msg(">>> cps_layer::sendMsg: ", p); // Encode CPS PDU @@ -53,7 +53,7 @@ void cps_layer::receive_data(OCTETSTRING &data, params &p_params) { // Decode the payload params_its ¶ms = static_cast(p_params); - LibItsCps__TypesAndValues::CpsInd p; + LibItsCps__TypesAndValues::CpmInd p; _codec.decode(data, p.msgIn()); if (!p.msgIn().is_bound()) { // Discard it diff --git a/ccsrc/Protocols/CPS_layers/cps_layer.hh b/ccsrc/Protocols/CPS_layers/cps_layer.hh index 9e57068..ba8dfe5 100644 --- a/ccsrc/Protocols/CPS_layers/cps_layer.hh +++ b/ccsrc/Protocols/CPS_layers/cps_layer.hh @@ -15,8 +15,8 @@ namespace LibItsCps__TestSystem { class CpsPort; //! Forward declaration of TITAN class - class CpsReq; //! Forward declaration of TITAN class - class CpsInd; //! Forward declaration of TITAN class + class CpmReq; //! Forward declaration of TITAN class + class CpmInd; //! Forward declaration of TITAN class } // namespace LibItsCps__TestSystem /*! @@ -45,12 +45,12 @@ public: //! \publicsection virtual ~cps_layer(){}; /*! - * \fn void sendMsg(const LibItsCps__TestSystem::CpsReq& p_cps_req, params& p_params); + * \fn void sendMsg(const LibItsCps__TestSystem::CpmReq& p_cps_req, params& p_params); * \brief Send CA message to the lower layers * \param[in] p_cps_req The CA message to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - void sendMsg(const LibItsCps__TypesAndValues::CpsReq &p_cps_req, params_its &p_params); + void sendMsg(const LibItsCps__TypesAndValues::CpmReq &p_cps_req, params_its &p_params); /*! * \virtual diff --git a/ccsrc/Protocols/CPS_layers/cps_layer_factory.hh b/ccsrc/Protocols/CPS_layers/cps_layer_factory.hh index cc4c9a3..cc881f0 100644 --- a/ccsrc/Protocols/CPS_layers/cps_layer_factory.hh +++ b/ccsrc/Protocols/CPS_layers/cps_layer_factory.hh @@ -1,6 +1,6 @@ /*! * \file cps_layer_factory.hh - * \brief Header file for ITS CAM protocol layer factory. + * \brief Header file for ITS CPS protocol layer factory. * \author ETSI STF525 / TTF T036 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_cps_layer.hh index afcb837..5119565 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cps_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_cps_layer.hh @@ -1,6 +1,6 @@ /*! * \file uppertester_cps_layer.hh - * \brief Header file for ITS UpperTester CAM protocol layer definition. + * \brief Header file for ITS UpperTester CPS protocol layer definition. * \author ETSI STF525 / TTF T036 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_layer_factory.hh b/ccsrc/Protocols/UpperTester/uppertester_cps_layer_factory.hh index 16f0f9d..58dd39b 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cps_layer_factory.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_cps_layer_factory.hh @@ -1,6 +1,6 @@ /*! * \file uppertester_cps_layer_factory.hh - * \brief Header file for ITS CAM Upper Tester protocol layer factory. + * \brief Header file for ITS CPS Upper Tester protocol layer factory. * \author ETSI STF525 / TTF T036 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. diff --git a/etc/AtsCPS/AtsCPS_Simulator.cfg_ b/etc/AtsCPS/AtsCPS_Simulator.cfg_ index 5d54776..ec92ef9 100644 --- a/etc/AtsCPS/AtsCPS_Simulator.cfg_ +++ b/etc/AtsCPS/AtsCPS_Simulator.cfg_ @@ -7,7 +7,6 @@ LibItsCommon_Pixits.PX_IUT_STATION_ID := 2533729309 LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB -LibItsCps_Pics.PICS_DANGEROUSGOODS := true LibItsCps_Pics.PICS_IS_IUT_SECURED := true [LOGGING] @@ -108,7 +107,14 @@ system.utPort.params := "UT_CPS/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port= #system.utPort.params := "UT_CPS/UDP(dst_ip=172.16.35.1)" [EXECUTE] +#ItsCps_TestControl.control +# +ItsCps_TestCases.TC_CPS_MSD_PAR_BV_01 +# +#ItsCps_TestCases.TC_CPS_MSD_PAR_BV_02 +# +#ItsCps_TestCases.TC_CPS_MSD_PAR_BV_03 [MAIN_CONTROLLER] # The options herein control the behavior of MC. -- GitLab From 8ebec8de0f94aa37ff31cecfca3b05d84fa67ab9 Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 20 Jun 2024 14:42:31 +0200 Subject: [PATCH 141/178] Add basics Test System functionalities for AtsVRU --- ccsrc/EncDec/LibItsVru_Encdec.cc | 226 ++++++++++++++++++ .../VRU_ports/AdapterControlPort_VRU.cc | 70 ++++++ .../VRU_ports/AdapterControlPort_VRU.hh | 36 +++ .../VRU_ports/UpperTesterPort_VRU.cc | 90 +++++++ .../VRU_ports/UpperTesterPort_VRU.hh | 43 ++++ ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.cc | 90 +++++++ ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.hh | 53 ++++ .../UpperTester/uppertester_vru_codec.cc | 190 +++++++++++++++ .../UpperTester/uppertester_vru_codec.hh | 50 ++++ .../UpperTester/uppertester_vru_layer.cc | 51 ++++ .../UpperTester/uppertester_vru_layer.hh | 39 +++ .../uppertester_vru_layer_factory.hh | 26 ++ ccsrc/Protocols/VRU/vru_codec.cc | 27 +++ ccsrc/Protocols/VRU/vru_codec.hh | 23 ++ ccsrc/Protocols/VRU/vru_pdu_codec.cc | 16 ++ ccsrc/Protocols/VRU/vru_pdu_codec.hh | 19 ++ ccsrc/Protocols/VRU/vru_types.hh | 14 ++ ccsrc/Protocols/VRU_layers/vru_layer.cc | 164 +++++++++++++ ccsrc/Protocols/VRU_layers/vru_layer.hh | 76 ++++++ .../Protocols/VRU_layers/vru_layer_factory.hh | 41 ++++ etc/AtsVRU/AtsVRU_Simulator.cfg_ | 124 ++++++++++ 21 files changed, 1468 insertions(+) create mode 100644 etc/AtsVRU/AtsVRU_Simulator.cfg_ diff --git a/ccsrc/EncDec/LibItsVru_Encdec.cc b/ccsrc/EncDec/LibItsVru_Encdec.cc index e69de29..4bb1d85 100644 --- a/ccsrc/EncDec/LibItsVru_Encdec.cc +++ b/ccsrc/EncDec/LibItsVru_Encdec.cc @@ -0,0 +1,226 @@ +#include + +#include "LibItsVru_EncdecDeclarations.hh" + +#include "vru_codec.hh" +#include "loggers.hh" +#include "uppertester_vru_codec.hh" + +namespace LibItsVru__EncdecDeclarations { + /**************************************************** + * @desc External function to encode a VamReq type + * @param value to encode + * @return encoded value + ****************************************************/ + BITSTRING fx__enc__VruReq(const LibItsVru__TypesAndValues::VamReq &p_vruReq) { + loggers::get_instance().log_msg(">>> fx__enc__VruReq: ", p_vruReq); + + vru_codec codec; + OCTETSTRING os; + if (codec.encode(p_vruReq.msgOut(), os) == -1) { + loggers::get_instance().warning("fx__enc__VruReq: -1 result code was returned"); + return int2bit(0, 1); + } + + return oct2bit(os); + } + + /**************************************************** + * @desc External function to decode a VamReq type + * @param value to encode + * @return encoded value + ****************************************************/ + INTEGER fx__dec__VruReq(BITSTRING &b, LibItsVru__TypesAndValues::VamReq &p) { + loggers::get_instance().log(">>> fx__dec__VruReq"); + + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + + vru_codec codec; + VAM__PDU__Descriptions::VAM vru; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(is, vru) == -1) { + loggers::get_instance().warning("fx__dec__VruReq: -1 result code was returned"); + return -1; + } + p.msgOut() = vru; + + return 0; + } + + INTEGER fx__dec__VruInd(BITSTRING &b, LibItsVru__TypesAndValues::VamInd &p_vruInd) { + loggers::get_instance().log(">>> fx__dec__VruInd"); + + // Sanity check + if (b.lengthof() == 0) { + return -1; + } + + vru_codec codec; + VAM__PDU__Descriptions::VAM vru; + OCTETSTRING is = bit2oct(b); + + // Calculate the size of the lower layers information + int s = (LibItsVru__TypesAndValues::VamInd_gnNextHeader_raw_.fieldlength + LibItsVru__TypesAndValues::VamInd_gnHeaderType_raw_.fieldlength + + LibItsVru__TypesAndValues::VamInd_gnHeaderSubtype_raw_.fieldlength + LibItsVru__TypesAndValues::VamInd_gnLifetime_raw_.fieldlength + + LibItsVru__TypesAndValues::VamInd_gnTrafficClass_raw_.fieldlength + LibItsVru__TypesAndValues::VamInd_btpDestinationPort_raw_.fieldlength + + LibItsVru__TypesAndValues::VamInd_btpInfo_raw_.fieldlength + LibItsVru__TypesAndValues::VamInd_ssp_raw_.fieldlength + + LibItsVru__TypesAndValues::VamInd_its__aid_raw_.fieldlength) / + 8; + // Decode CA message + if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), vru) == -1) { + loggers::get_instance().warning("fx__dec__VruInd: -1 result code was returned"); + return -1; + } + p_vruInd.msgIn() = vru; + // Decode lower layer data + TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); + loggers::get_instance().log_to_hexa("fx__dec__VruInd: ", decoding_buffer); + // gnNextHeader + if (decoding_buffer.get_read_len() < static_cast(LibItsVru__TypesAndValues::VamInd_gnNextHeader_raw_.fieldlength / 8)) { + p_vruInd.gnNextHeader().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsVru__TypesAndValues::VamInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_vruInd.gnNextHeader() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__VruInd: gnNextHeader=", p_vruInd.gnNextHeader()); + loggers::get_instance().log_to_hexa("fx__dec__VruInd: ", decoding_buffer); + // gnHeaderType + if (decoding_buffer.get_read_len() < static_cast(LibItsVru__TypesAndValues::VamInd_gnHeaderType_raw_.fieldlength / 8)) { + p_vruInd.gnHeaderType().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsVru__TypesAndValues::VamInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_vruInd.gnHeaderType() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__VruInd: gnHeaderType=", p_vruInd.gnHeaderType()); + loggers::get_instance().log_to_hexa("fx__dec__VruInd: ", decoding_buffer); + // gnHeaderSubtype + if (decoding_buffer.get_read_len() < static_cast(LibItsVru__TypesAndValues::VamInd_gnHeaderSubtype_raw_.fieldlength / 8)) { + p_vruInd.gnHeaderSubtype().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsVru__TypesAndValues::VamInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_vruInd.gnHeaderSubtype() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__VruInd: gnHeaderSubtype=", p_vruInd.gnHeaderSubtype()); + loggers::get_instance().log_to_hexa("fx__dec__VruInd: ", decoding_buffer); + // gnLifetime + if (decoding_buffer.get_read_len() < static_cast(LibItsVru__TypesAndValues::VamInd_gnLifetime_raw_.fieldlength / 8)) { + p_vruInd.gnLifetime().set_to_omit(); + } else { + INTEGER i; + i.decode(LibItsVru__TypesAndValues::VamInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_vruInd.gnLifetime() = i; + } + loggers::get_instance().log_msg("fx__dec__VruInd: gnLifetime=", p_vruInd.gnLifetime()); + loggers::get_instance().log_to_hexa("fx__dec__VruInd: ", decoding_buffer); + // gnTrafficClass + if (decoding_buffer.get_read_len() < static_cast(LibItsVru__TypesAndValues::VamInd_gnTrafficClass_raw_.fieldlength / 8)) { + p_vruInd.gnTrafficClass().set_to_omit(); + } else { + OCTETSTRING os; + os.decode(LibItsVru__TypesAndValues::VamInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_vruInd.gnTrafficClass() = oct2int(os); + } + loggers::get_instance().log_msg("fx__dec__VruInd: gnTrafficClass=", p_vruInd.gnTrafficClass()); + loggers::get_instance().log_to_hexa("fx__dec__VruInd: ", decoding_buffer); + // btpDestinationPort + if (decoding_buffer.get_read_len() < static_cast(LibItsVru__TypesAndValues::VamInd_btpDestinationPort_raw_.fieldlength / 8)) { + p_vruInd.btpDestinationPort().set_to_omit(); + } else { + INTEGER i; + i.decode(LibItsVru__TypesAndValues::VamInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_vruInd.btpDestinationPort() = i; + } + loggers::get_instance().log_msg("fx__dec__VruInd: btpDestinationPort=", p_vruInd.btpDestinationPort()); + loggers::get_instance().log_to_hexa("fx__dec__VruInd: ", decoding_buffer); + // btpInfo + if (decoding_buffer.get_read_len() < static_cast(LibItsVru__TypesAndValues::VamInd_btpInfo_raw_.fieldlength / 8)) { + p_vruInd.btpInfo().set_to_omit(); + } else { + INTEGER i; + i.decode(LibItsVru__TypesAndValues::VamInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_vruInd.btpInfo() = i; + } + loggers::get_instance().log_msg("fx__dec__VruInd: btpInfo=", p_vruInd.btpInfo()); + loggers::get_instance().log_to_hexa("fx__dec__VruInd: ", decoding_buffer); + // ssp + if (decoding_buffer.get_read_len() < static_cast(LibItsVru__TypesAndValues::VamInd_ssp_raw_.fieldlength / 8)) { + p_vruInd.ssp().set_to_omit(); + } else { + BITSTRING bs; + bs.decode(LibItsVru__TypesAndValues::VamInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_vruInd.ssp() = bs; + } + loggers::get_instance().log_msg("fx__dec__VruInd: ssp=", p_vruInd.ssp()); + loggers::get_instance().log_to_hexa("fx__dec__VruInd: ", decoding_buffer); + // its__aid + if (decoding_buffer.get_read_len() < static_cast(LibItsVru__TypesAndValues::VamInd_its__aid_raw_.fieldlength / 8)) { + p_vruInd.its__aid().set_to_omit(); + } else { + INTEGER i; + i.decode(LibItsVru__TypesAndValues::VamInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); + p_vruInd.its__aid() = i; + } + loggers::get_instance().log_msg("fx__dec__VruInd: its_aid=", p_vruInd.its__aid()); + loggers::get_instance().log_to_hexa("fx__dec__VruInd: ", decoding_buffer); + + return 0; + } + + BITSTRING fx__enc__VAM(const VAM__PDU__Descriptions::VAM &p_vru) { + loggers::get_instance().log_msg(">>> fx__enc__VAM: ", p_vru); + + vru_codec codec; + OCTETSTRING os; + codec.encode(p_vru, os); + return oct2bit(os); + } + + INTEGER fx__dec__VAM(BITSTRING &b, VAM__PDU__Descriptions::VAM &p) { + loggers::get_instance().log(">>> fx__dec__VAM"); + vru_codec codec; + OCTETSTRING is = bit2oct(b); + + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + loggers::get_instance().warning("fx__dec__VAM: -1 result code was returned"); + return -1; + } + + return 0; + } + + BITSTRING fx__enc__UtVruInitialize(const LibItsVru__TypesAndValues::UtVruInitialize &p_utVruInitialize) { + loggers::get_instance().log_msg(">>> fx__enc__UtVruInitialize: ", p_utVruInitialize); + + uppertester_vru_codec codec; + OCTETSTRING os; + codec.encode(p_utVruInitialize, os); + return oct2bit(os); + } + + /**************************************************** + * @desc External function to decode a UtVruEventInd type + * @param value to encode + * @return encoded value + ****************************************************/ + INTEGER fx__dec__UtVruEventInd(BITSTRING &b, LibItsVru__TypesAndValues::UtVruEventInd &p) { + loggers::get_instance().log(">>> fx__dec__UtVruEventInd"); + + uppertester_vru_codec codec; + OCTETSTRING is = bit2oct(b); + std::unique_ptr ptr = codec.decode(is); + if (ptr == nullptr) { + loggers::get_instance().warning("fx__dec__UtVruEventInd: -1 result code was returned"); + return -1; + } + p = static_cast(*ptr); + return 0; + } + +} // namespace LibItsVru__EncdecDeclarations diff --git a/ccsrc/Ports/LibIts_ports/VRU_ports/AdapterControlPort_VRU.cc b/ccsrc/Ports/LibIts_ports/VRU_ports/AdapterControlPort_VRU.cc index e69de29..051af27 100644 --- a/ccsrc/Ports/LibIts_ports/VRU_ports/AdapterControlPort_VRU.cc +++ b/ccsrc/Ports/LibIts_ports/VRU_ports/AdapterControlPort_VRU.cc @@ -0,0 +1,70 @@ +#include + +#include "loggers.hh" +#include "registration.hh" + +#include "AdapterControlPort_VRU.hh" +#include "vru_layer.hh" + +//============================================================================= +namespace LibItsVru__TestSystem { + + AdapterControlPort::AdapterControlPort(const char *par_port_name) : AdapterControlPort_BASE(par_port_name) {} + + AdapterControlPort::~AdapterControlPort() {} + + void AdapterControlPort::set_parameter(const char * /*parameter_name*/, const char * /*parameter_value*/) {} + + /*void AdapterControlPort::Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error) {}*/ + + void AdapterControlPort::Handle_Fd_Event_Error(int /*fd*/) {} + + void AdapterControlPort::Handle_Fd_Event_Writable(int /*fd*/) {} + + void AdapterControlPort::Handle_Fd_Event_Readable(int /*fd*/) {} + + /*void AdapterControlPort::Handle_Timeout(double time_since_last_call) {}*/ + + void AdapterControlPort::user_map(const char * /*system_port*/) {} + + void AdapterControlPort::user_unmap(const char * /*system_port*/) {} + + void AdapterControlPort::user_start() {} + + void AdapterControlPort::user_stop() {} + + void AdapterControlPort::outgoing_send(const LibItsCommon__TypesAndValues::AcGnssPrimitive & /*send_par*/) {} + + void AdapterControlPort::outgoing_send(const LibItsCommon__TypesAndValues::AcSecPrimitive &send_par) { + loggers::get_instance().log_msg(">>> AdapterControlPort::outgoing_send: ", send_par); + + // Register this object for AdapterControlPort + vru_layer *p = registration::get_instance().get_item(std::string("VRU")); + if (p != NULL) { + loggers::get_instance().log("AdapterControlPort::outgoing_send: Got VRU layer %p", p); + LibItsCommon__TypesAndValues::AdapterControlResults response; + response.acSecResponse() = BOOLEAN(true); + if (send_par.ischosen(LibItsCommon__TypesAndValues::AcSecPrimitive::ALT_acEnableSecurity)) { + loggers::get_instance().log("AdapterControlPort::outgoing_send: Enable secured mode"); + std::string str(static_cast(send_par.acEnableSecurity().certificateId())); + if (p->enable_secured_mode(str, send_par.acEnableSecurity().enforceSecurity()) == -1) { + response.acSecResponse() = BOOLEAN(false); + } + } else if (send_par.ischosen(LibItsCommon__TypesAndValues::AcSecPrimitive::ALT_acDisableSecurity)) { + loggers::get_instance().log("AdapterControlPort::outgoing_send: Disable secured mode"); + if (p->disable_secured_mode() == -1) { + response.acSecResponse() = BOOLEAN(false); + } + } else { + response.acSecResponse() = BOOLEAN(false); + } + // Send response + loggers::get_instance().log_msg("AdapterControlPort::outgoing_send: Send response: ", response); + incoming_message(response); + } else { + loggers::get_instance().error("AdapterControlPort::outgoing_send: VRU not registered"); + } + } + +} // namespace LibItsVru__TestSystem diff --git a/ccsrc/Ports/LibIts_ports/VRU_ports/AdapterControlPort_VRU.hh b/ccsrc/Ports/LibIts_ports/VRU_ports/AdapterControlPort_VRU.hh index e69de29..df57413 100644 --- a/ccsrc/Ports/LibIts_ports/VRU_ports/AdapterControlPort_VRU.hh +++ b/ccsrc/Ports/LibIts_ports/VRU_ports/AdapterControlPort_VRU.hh @@ -0,0 +1,36 @@ +#ifndef AdapterControlPort_VRU_HH +#define AdapterControlPort_VRU_HH +//============================================================================= +#include "LibItsVru_TestSystem.hh" + +namespace LibItsVru__TestSystem { + + class AdapterControlPort : public AdapterControlPort_BASE { + public: + AdapterControlPort(const char *par_port_name = NULL); + ~AdapterControlPort(); + + void set_parameter(const char *parameter_name, const char *parameter_value); + + private: + /* void Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error); */ + void Handle_Fd_Event_Error(int fd); + void Handle_Fd_Event_Writable(int fd); + void Handle_Fd_Event_Readable(int fd); + /* void Handle_Timeout(double time_since_last_call); */ + protected: + void user_map(const char *system_port); + void user_unmap(const char *system_port); + + void user_start(); + void user_stop(); + + void outgoing_send(const LibItsCommon__TypesAndValues::AcGnssPrimitive &send_par); + + void outgoing_send(const LibItsCommon__TypesAndValues::AcSecPrimitive &send_par); + }; + +} // namespace LibItsVru__TestSystem + +#endif diff --git a/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.cc b/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.cc index e69de29..ef55da4 100644 --- a/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.cc +++ b/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.cc @@ -0,0 +1,90 @@ +#include "uppertester_vru_layer_factory.hh" + +#include "UpperTesterPort_VRU.hh" +#include "loggers.hh" + +//============================================================================= +namespace LibItsVru__TestSystem { + + UpperTesterPort::UpperTesterPort(const char *par_port_name) + : UpperTesterPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(NULL), _time_key("UpperTesterPort_Vru::outgoing_send") { + loggers::get_instance().log("UpperTesterPort_Vru::UpperTesterPort_Vru"); + } + + UpperTesterPort::~UpperTesterPort() { + if (_layer != NULL) { + delete _layer; + } + } + + void UpperTesterPort::set_parameter(const char *parameter_name, const char *parameter_value) { + loggers::get_instance().log("UpperTesterPort_Vru::set_parameter: %s=%s", parameter_name, parameter_value); + _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value))); + _cfg_params.log(); + } + + /*void UpperTesterPort::Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error) {}*/ + + void UpperTesterPort::Handle_Fd_Event_Error(int /*fd*/) {} + + void UpperTesterPort::Handle_Fd_Event_Writable(int /*fd*/) {} + + void UpperTesterPort::Handle_Fd_Event_Readable(int /*fd*/) {} + + /*void UpperTesterPort::Handle_Timeout(double time_since_last_call) {}*/ + + void UpperTesterPort::user_map(const char *system_port) { + loggers::get_instance().log(">>> UpperTesterPort_Vru::user_map: %s", system_port); + // Build layer stack + params_its::iterator it = _cfg_params.find(std::string("params")); + if (it != _cfg_params.end()) { + loggers::get_instance().log("UpperTesterPort_Vru::user_map: %s", it->second.c_str()); + _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); + if (static_cast(_layer) == NULL) { + loggers::get_instance().error("UpperTesterPort_Vru::user_map: Invalid stack configuration: %s", it->second.c_str()); + } + static_cast(_layer)->add_upper_port(this); + } else { + loggers::get_instance().error("UpperTesterPort_Vru::user_map: No layers defined in configuration file"); + } + } + + void UpperTesterPort::user_unmap(const char *system_port) { + loggers::get_instance().log(">>> UpperTesterPort_Vru::user_unmap: %s", system_port); + if (_layer != NULL) { + delete _layer; + _layer = NULL; + } + } + + void UpperTesterPort::user_start() {} + + void UpperTesterPort::user_stop() {} + + void UpperTesterPort::outgoing_send(const LibItsVru__TypesAndValues::UtVruInitialize &send_par) { + loggers::get_instance().log_msg(">>> UppertesterPort_Vru::outgoing_send: ", send_par); + + float duration; + loggers::get_instance().set_start_time(_time_key); + static_cast(_layer)->sendMsg(send_par, _layer_params); + loggers::get_instance().set_stop_time(_time_key, duration); + } + + void UpperTesterPort::receiveMsg(const Base_Type &p_ind, const params &p_params) { + loggers::get_instance().log_msg(">>> UpperTesterPort_Vru::receive_msg: ", p_ind); + // Sanity check + if (!p_ind.is_bound()) { + return; + } + + if (std::string(p_ind.get_descriptor()->name).compare("@LibItsVru_TypesAndValues.UtVruResults") == 0) { // TODO To be refined + incoming_message(static_cast(p_ind)); + } else if (std::string(p_ind.get_descriptor()->name).compare("@LibItsVru_TypesAndValues.UtVruEventInd") == 0) { + incoming_message(static_cast(p_ind)); + } else { + loggers::get_instance().warning("UpperTesterPort_Vru::receive_msg: Message not processed: %s", p_ind.get_descriptor()->name); + } + } + +} // namespace LibItsVru__TestSystem diff --git a/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.hh b/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.hh index e69de29..96cbbf1 100644 --- a/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.hh +++ b/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.hh @@ -0,0 +1,43 @@ +#ifndef UpperTesterPort_VRU_HH +#define UpperTesterPort_VRU_HH + +#include "layer.hh" +#include "params_its.hh" + +//============================================================================= +#include "LibItsVru_TestSystem.hh" +namespace LibItsVru__TestSystem { + + class UpperTesterPort : public UpperTesterPort_BASE { + params_its _cfg_params; + params_its _layer_params; + layer * _layer; + std::string _time_key; + + public: + UpperTesterPort(const char *par_port_name = NULL); + ~UpperTesterPort(); + + void set_parameter(const char *parameter_name, const char *parameter_value); + + void receiveMsg(const Base_Type &, const params &); + + private: + /* void Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error); */ + void Handle_Fd_Event_Error(int fd); + void Handle_Fd_Event_Writable(int fd); + void Handle_Fd_Event_Readable(int fd); + /* void Handle_Timeout(double time_since_last_call); */ + protected: + void user_map(const char *system_port); + void user_unmap(const char *system_port); + + void user_start(); + void user_stop(); + + void outgoing_send(const LibItsVru__TypesAndValues::UtVruInitialize &send_par); + }; + +} // namespace LibItsVru__TestSystem +#endif diff --git a/ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.cc b/ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.cc index e69de29..71343dc 100644 --- a/ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.cc +++ b/ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.cc @@ -0,0 +1,90 @@ +// This Test Port skeleton source file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/5 R3A +// for U-ERICSSON\ethgry (ethgry@HU00078339) on Fri Aug 14 16:32:05 2015 + +// Copyright Ericsson Telecom AB 2000-2014 + +// You may modify this file. Complete the body of empty functions and +// add your member functions here. + +#include "VruPort.hh" +#include "vru_layer_factory.hh" +#include "loggers.hh" + +namespace LibItsVru__TestSystem { + + VruPort::VruPort(const char *par_port_name) + : VruPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(NULL), _time_key("VruPort::outgoing_send") {} + + VruPort::~VruPort() { + if (_layer != NULL) { + delete _layer; + } + } + + void VruPort::set_parameter(const char *parameter_name, const char *parameter_value) { + loggers::get_instance().log("VruPort::set_parameter: %s=%s", parameter_name, parameter_value); + _cfg_params.insert(std::pair(std::string(parameter_name), std::string(parameter_value))); + } + + /*void VruPort::Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error) {}*/ + + void VruPort::Handle_Fd_Event_Error(int /*fd*/) {} + + void VruPort::Handle_Fd_Event_Writable(int /*fd*/) {} + + void VruPort::Handle_Fd_Event_Readable(int /*fd*/) {} + + /*void VruPort::Handle_Timeout(double time_since_last_call) {}*/ + + void VruPort::user_map(const char *system_port) { + loggers::get_instance().log(">>> VruPort::user_map: %s", system_port); + // Build layer stack + params_its::iterator it = _cfg_params.find(std::string("params")); + if (it != _cfg_params.end()) { + loggers::get_instance().log("VruPort::user_map: %s", it->second.c_str()); + // Setup parameters + params_its::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless + // Create layer + _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str()); + if (static_cast(_layer) == NULL) { + loggers::get_instance().error("VruPort::user_map: Invalid stack configuration: %s", it->second.c_str()); + } + static_cast(_layer)->add_upper_port(this); + } else { + loggers::get_instance().error("VruPort::user_map: No layers defined in configuration file"); + } + } + + void VruPort::user_unmap(const char *system_port) { + loggers::get_instance().log(">>> VruPort::user_unmap: %s", system_port); + if (_layer != NULL) { + delete _layer; + _layer = NULL; + } + } + + void VruPort::user_start() {} + + void VruPort::user_stop() {} + + void VruPort::outgoing_send(const LibItsVru__TypesAndValues::VamReq &send_par) { + loggers::get_instance().log_msg(">>> VruPort::outgoing_send: payload=", send_par); + + float duration; + loggers::get_instance().set_start_time(_time_key); + params_its params; + static_cast(_layer)->sendMsg(send_par, params); + loggers::get_instance().set_stop_time(_time_key, duration); + } + + void VruPort::receiveMsg(const LibItsVru__TypesAndValues::VamInd &p_ind, const params& p_params) { + //loggers::get_instance().log_msg(">>> VruPort::receive_msg: ", p_ind); + const params_its& p = static_cast(p_params); + loggers::get_instance().log(">>> VruPort::receive_msg: %s", p.station_id.c_str()); + + incoming_message(p_ind); + } + +} // namespace LibItsVru__TestSystem diff --git a/ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.hh b/ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.hh index e69de29..1ef3d74 100644 --- a/ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.hh +++ b/ccsrc/Ports/LibIts_ports/VRU_ports/VruPort.hh @@ -0,0 +1,53 @@ +// This Test Port skeleton header file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/5 R3A +// for U-ERICSSON\ethgry (ethgry@HU00078339) on Fri Aug 14 16:32:05 2015 + +// Copyright Ericsson Telecom AB 2000-2014 + +// You may modify this file. Add your attributes and prototypes of your +// member functions here. + +#ifndef VruPort_HH +#define VruPort_HH + +#include "LibItsVru_TestSystem.hh" + +#include "layer.hh" +#include "params_its.hh" + +namespace LibItsVru__TestSystem { + + class VruPort : public VruPort_BASE { + params_its _cfg_params; + params_its _layer_params; + layer * _layer; + std::string _time_key; + + public: + VruPort(const char *par_port_name = NULL); + ~VruPort(); + + void set_parameter(const char *parameter_name, const char *parameter_value); + + void receiveMsg(const LibItsVru__TypesAndValues::VamInd&, const params&); + + private: + /* void Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error); */ + void Handle_Fd_Event_Error(int fd); + void Handle_Fd_Event_Writable(int fd); + void Handle_Fd_Event_Readable(int fd); + /* void Handle_Timeout(double time_since_last_call); */ + protected: + void user_map(const char *system_port); + void user_unmap(const char *system_port); + + void user_start(); + void user_stop(); + + void outgoing_send(const LibItsVru__TypesAndValues::VamReq &send_par); + }; + +} // namespace LibItsVru__TestSystem + +#endif diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc index e69de29..653715f 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc @@ -0,0 +1,190 @@ +#include +//#include + +#include "loggers.hh" +#include "uppertester_vru_codec.hh" + +#include "LibItsVru_TypesAndValues.hh" + +#include "vru_codec.hh" + +template class OPTIONAL; +class TTCN_EncDec; + +unsigned char uppertester_vru_codec::c_utVruInitialize = 0x00; +unsigned char uppertester_vru_codec::c_utVruInitializeResult = 0x01; +unsigned char uppertester_vru_codec::c_utVruEventInd = 0x23; + +int uppertester_vru_codec::encode(const Record_Type &msg, OCTETSTRING &data) { + loggers::get_instance().log_msg(">>> uppertester_vru_codec::encode: ", (const Record_Type &)msg); + + TTCN_EncDec::clear_error(); + TTCN_Buffer encoding_buffer; + if (std::string(msg.get_descriptor()->name).compare("@LibItsVru_TypesAndValues.UtVruInitialize") == 0) { + encoding_buffer.put_c(static_cast(uppertester_vru_codec::c_utVruInitialize)); + } else { // Error + data = OCTETSTRING(0, nullptr); + loggers::get_instance().warning("<<< uppertester_vru_codec::encode: Failed to encode UT message"); + return -1; + } + encode_(msg, *msg.get_descriptor(), encoding_buffer); + data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); + loggers::get_instance().log_msg("<<< uppertester_vru_codec::encode: data=", data); + return 0; +} + +int uppertester_vru_codec::encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer) { + loggers::get_instance().log(">>> uppertester_vru_codec::encode_: processing %s/%s/%p", type.get_descriptor()->name, field_descriptor.name, + dynamic_cast(&type)); + loggers::get_instance().log_msg(">>> uppertester_vru_codec::encode_: ", type); + + if (dynamic_cast(&type) != NULL) { + const Record_Type &r = (const Record_Type &)type; + loggers::get_instance().log("uppertester_vru_codec::encode_: processing Record_Type %s", r.get_descriptor()->name); + for (int i = 0; i < r.get_count(); i++) { + loggers::get_instance().log("uppertester_vru_codec::encode_: processing %s/%s/%s - %d (1 ==> use dynamic_cast) - %d", r.fld_name(i), + r.fld_descr(i)->name, r.get_at(i)->get_descriptor()->name, r.get_at(i)->is_optional(), r.get_at(i)->is_present()); + if (r.get_at(i)->is_present()) { + if (encode_(*r.get_at(i), *r.fld_descr(i), encoding_buffer) == -1) { + loggers::get_instance().warning("uppertester_vru_codec::encode_: -1 result code returned"); + return -1; + } + } else if (std::string(r.fld_name(i)).compare("alacarte") == 0) { + // Add empty field length + loggers::get_instance().log("uppertester_vru_codec::encode_: alacarte is missing, add 0x00"); + encoding_buffer.put_c(0x00); + } + } // End of 'for' statement + } else { + std::string s(field_descriptor.name); + loggers::get_instance().log("uppertester_vru_codec::encode_: field to process %s", s.c_str()); + if ((s.rfind(".shape") != string::npos) || (s.rfind(".relevanceDistance") != string::npos) || (s.rfind(".relevanceTrafficDirection") != string::npos)) { + encoding_buffer.put_c((unsigned char)static_cast(type).as_int()); + } else if (s.rfind(".payload") != string::npos) { + const OCTETSTRING & os = static_cast(type); + const unsigned char s[] = {(unsigned char)((os.lengthof() & 0x0000FF00) >> 8), (unsigned char)os.lengthof()}; + encoding_buffer.put_s(2, s); + if (os.lengthof() != 0) { + encoding_buffer.put_string(os); + } + } else if (s.rfind(".detectionTime") != string::npos) { + unsigned long long llu = static_cast(type).get_long_long_val(); + loggers::get_instance().log("uppertester_vru_codec::encode_ : detectionTime=%llu", llu); + std::vector v; + for (int i = 0; i < 6; i++) { + v.insert(v.begin(), static_cast(llu)); + llu >>= 8; + } // End of 'for' statement + OCTETSTRING os(v.size(), v.data()); + loggers::get_instance().log_msg("uppertester_vru_codec::encode_: timeDetection=", os); + encoding_buffer.put_string(os); + } else if ((s.rfind(".validityDuration") != string::npos) || (s.rfind(".repetitionDuration") != string::npos)) { + if (type.is_present()) { + const OPTIONAL &o = dynamic_cast &>(type); + const INTEGER & i = static_cast(*o.get_opt_value()); + loggers::get_instance().log_msg("uppertester_vru_codec::encode_: i=", i); + encoding_buffer.put_string(int2oct(i, 3)); + } + } else if ((s.rfind(".informationQuality") != string::npos) || (s.rfind(".causeCode") != string::npos) || (s.rfind(".subCauseCode") != string::npos)) { + const INTEGER &i = static_cast(type); + encoding_buffer.put_string(int2oct(i, 1)); + } else if ((s.rfind(".linkedCause") != string::npos) || (s.rfind(".eventHistory") != string::npos)) { + // Skip them + } else if ((s.rfind(".transmissionInterval") != string::npos) || (s.rfind(".repetitionInterval") != string::npos)) { + if (type.is_present()) { + const OPTIONAL &o = dynamic_cast &>(type); + const INTEGER & i = static_cast(*o.get_opt_value()); + encoding_buffer.put_string(int2oct(i, 2)); + } + } else if (s.rfind(".originatingStationID") != string::npos) { + const INTEGER &i = static_cast(type); + encoding_buffer.put_string(int2oct(i, 4)); + } else if (s.rfind(".sequenceNumber") != string::npos) { + const INTEGER &i = static_cast(type); + encoding_buffer.put_string(int2oct(i, 2)); + } else if (s.rfind(".AlacarteContainer") != string::npos) { + const OPTIONAL &o = dynamic_cast &>(type); + const OCTETSTRING & os = static_cast(*o.get_opt_value()); + encoding_buffer.put_string(int2oct(os.lengthof(), 2)); + encoding_buffer.put_string(os); + } else { + loggers::get_instance().log("uppertester_vru_codec::encode_ (else): processing type %s/%s", type.get_descriptor()->name, field_descriptor.name); + type.encode(field_descriptor, encoding_buffer, TTCN_EncDec::CT_RAW); + } + } + + loggers::get_instance().log_to_hexa("<<>> uppertester_vru_codec::decode: decoding_buffer=", decoding_buffer); + // decode_(msg, *msg.get_descriptor(), decoding_buffer); + + loggers::get_instance().log_msg("<<< uppertester_vru_codec::decode: ", (const Record_Type &)msg); + return 0; +} + +std::unique_ptr uppertester_vru_codec::decode(const OCTETSTRING &data, params_its *params) { + + std::unique_ptr result; + + const unsigned char *ptr = static_cast(data); + if (*ptr != uppertester_vru_codec::c_utVruEventInd) { + LibItsVru__TypesAndValues::UtVruResults res; + if (decode(data, res, params) == 0) { + result.reset((Base_Type *)res.clone()); + } else { + result.reset(nullptr); + } + } else { + LibItsVru__TypesAndValues::UtVruEventInd ind; + decode(data, ind, params); + result.reset((Base_Type *)ind.clone()); + } + + return result; +} + +int uppertester_vru_codec::decode(const OCTETSTRING &data, LibItsVru__TypesAndValues::UtVruResults &msg, params_its *params) { + loggers::get_instance().log_to_hexa(">>> uppertester_vru_codec::decode: decoding_buffer=", data); + + const unsigned char *ptr = static_cast(data); + if (*ptr == uppertester_vru_codec::c_utVruInitializeResult) { + msg.utVruInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); + } else if (*ptr == 0x24) { // TODO Use a constant for "Peer does not support is "Peer does not support the command" + // Peer does not support the command + msg.utVruInitializeResult() = 0x00; + } else { + loggers::get_instance().warning("uppertester_vru_codec::decode: Unsupported result"); + return -1; + } + + loggers::get_instance().log_msg("<<< uppertester_vru_codec::decode", msg); + return 0; +} + +int uppertester_vru_codec::decode(const OCTETSTRING &data, LibItsVru__TypesAndValues::UtVruEventInd &msg, params_its *params) { + loggers::get_instance().log_to_hexa(">>> uppertester_vru_codec::decode (1): decoding_buffer=", data); + + const unsigned char *ptr = static_cast(data) + 1; + OCTETSTRING os(2, ptr); + const unsigned int length = (const unsigned int)((*ptr << 8 & 0xff00) | *(ptr + 1)); + ptr += 2; + loggers::get_instance().log("uppertester_vru_codec::decode (1): CPS message length=%d", length); + if (data.lengthof() - 3 != (const int)length) { + loggers::get_instance().warning("uppertester_vru_codec::decode (1) (4): Wrong payload length: %d", length); + return -1; + } + os = OCTETSTRING(length, ptr); + loggers::get_instance().log_to_hexa("uppertester_vru_codec::decode (1): CPS message=", os); + vru_codec codec; + codec.decode(os, msg.vamMsg(), params); + + loggers::get_instance().log_msg("<<< uppertester_vru_codec::decode (1)", msg); + return 0; +} diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_vru_codec.hh index e69de29..78b5c72 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_vru_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_vru_codec.hh @@ -0,0 +1,50 @@ +/*! + * \file uppertester_vru_codec.hh + * \brief Header file for ITS UpperTester CAM codec definition. + * \author ETSI STF525 / TTF T036 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ +#pragma once + +#include + +#include "codec.hh" +#include "params.hh" + +class Base_Type; +class Record_Type; +class TTCN_Typedescriptor_t; +class TTCN_Buffer; + +namespace LibItsVru__TypesAndValues { + class UtVruTrigger; + class UtVruResults; + class UtVruEventInd; +} // namespace LibItsVru__TypesAndValues + +class uppertester_vru_codec : public codec { +public: + static unsigned char c_utVruInitialize; + static unsigned char c_utVruInitializeResult; + static unsigned char c_utVruEventInd; + +private: + int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); + +public: + uppertester_vru_codec() : codec(){}; + virtual ~uppertester_vru_codec(){}; + + virtual int encode(const Record_Type &, OCTETSTRING &data); + //int encode(const LibItsVru__TypesAndValues::UtVruTrigger &, OCTETSTRING &data); + virtual int decode(const OCTETSTRING &data, Record_Type &, params_its *params = NULL); + std::unique_ptr decode(const OCTETSTRING &data, params_its *params = NULL); + +private: + int decode(const OCTETSTRING &data, LibItsVru__TypesAndValues::UtVruResults &msg, params_its *params = NULL); + int decode(const OCTETSTRING &data, LibItsVru__TypesAndValues::UtVruEventInd &msg, params_its *params = NULL); +}; // End of class uppertester_vru_codec diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc index e69de29..8e7289d 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc @@ -0,0 +1,51 @@ +#include "uppertester_vru_layer_factory.hh" + +#include "LibItsVru_TestSystem.hh" +#include "LibItsVru_TypesAndValues.hh" + +#include "loggers.hh" + +uppertester_vru_layer::uppertester_vru_layer(const std::string &p_type, const std::string ¶m) + : t_layer(p_type), _params(), _codec() { + loggers::get_instance().log(">>> uppertester_vru_layer::uppertester_vru_layer: %s, %s", to_string().c_str(), param.c_str()); + // Setup parameters + params::convert(_params, param); + params::const_iterator it = _params.find(params::loopback); + if (it == _params.cend()) { + _params.insert(std::pair(params::loopback, "0")); + } +} + +void uppertester_vru_layer::sendMsg(const LibItsVru__TypesAndValues::UtVruInitialize &send_par, params_its &p_params) { + loggers::get_instance().log_msg(">>> uppertester_vru_layer::sendMsg", send_par); + + if (_params[params::loopback].compare("1") == 0) { + LibItsVru__TypesAndValues::UtVruResults ut_vru_results; + ut_vru_results.utVruInitializeResult() = BOOLEAN(true); + to_all_upper_ports(ut_vru_results, p_params); + } else { + // Encode UpperTester PDU + OCTETSTRING data; + _codec.encode((const Record_Type &)send_par, data); + // Update parameters + send_data(data, p_params); + } +} + +void uppertester_vru_layer::send_data(OCTETSTRING &data, params &p_params) { + loggers::get_instance().log_msg(">>> uppertester_vru_layer::send_data: ", data); + // params.log(); + send_to_all_layers(data, p_params); +} + +void uppertester_vru_layer::receive_data(OCTETSTRING &data, params &p_params) { + loggers::get_instance().log_msg(">>> uppertester_vru_layer::receive_data: ", data); + + std::unique_ptr r = _codec.decode(data); + if (r.get() != nullptr) { + // Pass it to the ports if any + to_all_upper_ports(*r, p_params); + } +} + +uppertester_vru_layer_factory uppertester_vru_layer_factory::_f; diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_vru_layer.hh index e69de29..2981914 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_vru_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_vru_layer.hh @@ -0,0 +1,39 @@ +/*! + * \file uppertester_vru_layer.hh + * \brief Header file for ITS UpperTester VRU protocol layer definition. + * \author ETSI STF525 / TTF T036 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ +#pragma once + +#include + +#include "t_layer.hh" +#include "uppertester_vru_codec.hh" + +namespace LibItsVru__TestSystem { + class UpperTesterPort; +} + +namespace LibItsVru__TypesAndValues { + class UtVruInitialize; +} // namespace LibItsVru__TypesAndValues + +class uppertester_vru_layer : public t_layer { + params_its _params; + uppertester_vru_codec _codec; + +public: + uppertester_vru_layer() : t_layer(), _params(), _codec(){}; + uppertester_vru_layer(const std::string &p_type, const std::string ¶m); + virtual ~uppertester_vru_layer(){}; + + void sendMsg(const LibItsVru__TypesAndValues::UtVruInitialize &send_par, params_its& p_params); + + virtual void send_data(OCTETSTRING &data, params& p_params); + virtual void receive_data(OCTETSTRING &data, params& p_params); +}; // End of class uppertester_vru_layer diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_layer_factory.hh b/ccsrc/Protocols/UpperTester/uppertester_vru_layer_factory.hh index e69de29..d0b98f8 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_vru_layer_factory.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_vru_layer_factory.hh @@ -0,0 +1,26 @@ +/*! + * \file uppertester_vru_layer_factory.hh + * \brief Header file for ITS VRU Upper Tester protocol layer factory. + * \author ETSI STF525 / TTF T036 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ +#pragma once + +#include "layer_stack_builder.hh" + +#include "uppertester_vru_layer.hh" + +class uppertester_vru_layer_factory : public layer_factory { + static uppertester_vru_layer_factory _f; + +public: + uppertester_vru_layer_factory() { + // Register factory + layer_stack_builder::register_layer_factory("UT_VRU", this); + }; + inline virtual layer *create_layer(const std::string &p_type, const std::string &p_param) { return new uppertester_vru_layer(p_type, p_param); }; +}; // End of class uppertester_vru_layer_factory diff --git a/ccsrc/Protocols/VRU/vru_codec.cc b/ccsrc/Protocols/VRU/vru_codec.cc index e69de29..05f6da7 100644 --- a/ccsrc/Protocols/VRU/vru_codec.cc +++ b/ccsrc/Protocols/VRU/vru_codec.cc @@ -0,0 +1,27 @@ +#include "vru_codec.hh" +#include "LibItsVru_TypesAndValues.hh" +#include "asn1/asn_application.h" // from asn1c +#include "loggers.hh" + +int vru_codec::encode(const VAM__PDU__Descriptions::VAM &vru, OCTETSTRING &data) { + loggers::get_instance().log(">>> vru_codec::encode"); + + BITSTRING b; + int rc = asn_codec.encode(vru, b); + if (rc) { + data = bit2oct(b); + loggers::get_instance().log_msg("vru_codec::encode: ", data); + } + return rc; +} + +int vru_codec::decode(const OCTETSTRING &data, VAM__PDU__Descriptions::VAM &vru, params_its *params) { + loggers::get_instance().log_msg(">>> vru_codec::decode: ", data); + + int rc = asn_codec.decode(oct2bit(data), vru); + loggers::get_instance().log("vru_codec::decode: ASN.1 codec returned %d", rc); + // if (rc) { + // loggers::get_instance().log_msg("vru_codec::decode: ", static_cast(vru)); + // } + return rc; +} diff --git a/ccsrc/Protocols/VRU/vru_codec.hh b/ccsrc/Protocols/VRU/vru_codec.hh index e69de29..75272bd 100644 --- a/ccsrc/Protocols/VRU/vru_codec.hh +++ b/ccsrc/Protocols/VRU/vru_codec.hh @@ -0,0 +1,23 @@ +#pragma once + +#include "vru_pdu_codec.hh" +#include "codec.hh" +#include "params_its.hh" + +class BITSTRING; //! Forward declaration of TITAN class +class OCTETSTRING; //! Forward declaration of TITAN class + +namespace VAM__PDU__Descriptions { //! Forward declaration of asn1c VRU class + class VAM; +} + +class vru_codec : public codec { + vru_pdu_codec asn_codec; + +public: + explicit vru_codec() : codec(), asn_codec(){}; + virtual ~vru_codec(){}; + + virtual int encode(const VAM__PDU__Descriptions::VAM &vru, OCTETSTRING &data); + virtual int decode(const OCTETSTRING &data, VAM__PDU__Descriptions::VAM &vru, params_its *params = NULL); +}; diff --git a/ccsrc/Protocols/VRU/vru_pdu_codec.cc b/ccsrc/Protocols/VRU/vru_pdu_codec.cc index e69de29..60f2bbd 100644 --- a/ccsrc/Protocols/VRU/vru_pdu_codec.cc +++ b/ccsrc/Protocols/VRU/vru_pdu_codec.cc @@ -0,0 +1,16 @@ +#include "vru_pdu_codec.hh" +#include "LibItsVru_TypesAndValues.hh" +#include "asn1/asn_application.h" // from asn1c +#include "loggers.hh" + +extern "C" { +extern asn_TYPE_descriptor_t asn_DEF_VAM; +} + +int vru_pdu_codec::encode(const VAM__PDU__Descriptions::VAM &p_vru, BITSTRING &p_data) { + return _encode(VAM__PDU__Descriptions::VAM_descr_, asn_DEF_VAM, p_vru, p_data); +} + +int vru_pdu_codec::decode(const BITSTRING &p_data, VAM__PDU__Descriptions::VAM &p_vru) { + return _decode(VAM__PDU__Descriptions::VAM_descr_, asn_DEF_VAM, p_data, p_vru); +} diff --git a/ccsrc/Protocols/VRU/vru_pdu_codec.hh b/ccsrc/Protocols/VRU/vru_pdu_codec.hh index e69de29..1781f15 100644 --- a/ccsrc/Protocols/VRU/vru_pdu_codec.hh +++ b/ccsrc/Protocols/VRU/vru_pdu_codec.hh @@ -0,0 +1,19 @@ +#pragma once + +#include "codec.hh" +#include "params.hh" +#include "per_codec.hh" + +class BITSTRING; //! Forward declaration of TITAN class +class OCTETSTRING; //! Forward declaration of TITAN class + +namespace VAM__PDU__Descriptions { //! Forward declaration of asn1c VRU class + class VAM; +} + +class vru_pdu_codec : public per_codec { +public: + explicit vru_pdu_codec(){}; + virtual int encode(const VAM__PDU__Descriptions::VAM &vru, BITSTRING &data); + virtual int decode(const BITSTRING &data, VAM__PDU__Descriptions::VAM &); +}; diff --git a/ccsrc/Protocols/VRU/vru_types.hh b/ccsrc/Protocols/VRU/vru_types.hh index e69de29..4d6aa02 100644 --- a/ccsrc/Protocols/VRU/vru_types.hh +++ b/ccsrc/Protocols/VRU/vru_types.hh @@ -0,0 +1,14 @@ +/*! + * \file vru_types.hh + * \brief Header file for TITAN VRU types. + * \author ETSI STF525 / TTF T036 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version ETSI TS 103 300-3 V2.1.1 + */ +#pragma once + +using namespace std; // Required for isnan() +#include "LibItsVru_TypesAndValues.hh" diff --git a/ccsrc/Protocols/VRU_layers/vru_layer.cc b/ccsrc/Protocols/VRU_layers/vru_layer.cc index e69de29..68b4df9 100644 --- a/ccsrc/Protocols/VRU_layers/vru_layer.cc +++ b/ccsrc/Protocols/VRU_layers/vru_layer.cc @@ -0,0 +1,164 @@ +#include "vru_types.hh" + +#include "LibItsVru_TestSystem.hh" + +#include "vru_layer_factory.hh" +#include "geonetworking_layer_factory.hh" + +#include "registration.hh" + +#include "loggers.hh" + +vru_layer::vru_layer(const std::string &p_type, const std::string ¶m) : t_layer(p_type), _params(), _codec() { + loggers::get_instance().log(">>> vru_layer::vru_layer: %s, %s", to_string().c_str(), param.c_str()); + // Setup parameters + params::convert(_params, param); + _params.insert(std::make_pair("its_aid", "638")); // ETSI TS 102 965 V2.1.1 (2021-11) + _params.insert(std::make_pair("payload_type", "2")); // VA message id - See ETSI TS 102 894 + + // Register this object for AdapterControlPort + loggers::get_instance().log("vru_layer::vru_layer: Register %s/%p", p_type.c_str(), this); + registration::get_instance().add_item(p_type, this); +} + +void vru_layer::sendMsg(const LibItsVru__TypesAndValues::VamReq &p, params_its ¶ms) { + loggers::get_instance().log_msg(">>> vru_layer::sendMsg: ", p); + + // Encode VRU PDU + OCTETSTRING data; + if (_codec.encode(p.msgOut(), data) == -1) { + loggers::get_instance().warning("vru_layer::sendMsg: Encoding failure"); + return; + } + + send_data(data, _params); +} + +void vru_layer::send_data(OCTETSTRING &data, params &p_params) { + loggers::get_instance().log_msg(">>> vru_layer::send_data: ", data); + + send_to_all_layers(data, p_params); +} + +void vru_layer::receive_data(OCTETSTRING &data, params &p_params) { + loggers::get_instance().log_msg(">>> vru_layer::receive_data: ", data); + + // Sanity check + if (*(static_cast(data) + 1) != 0x02) { // Check that received packet has CA message id - See ETSI TS 102 894 + // Not a VRU message, discard it + loggers::get_instance().warning("vru_layer::receive_data: Wrong message id: 0x%02x", *(static_cast(data) + 1)); + return; + } + + // Decode the payload + params_its ¶ms = static_cast(p_params); + + LibItsVru__TypesAndValues::VamInd p; + _codec.decode(data, p.msgIn()); + if (!p.msgIn().is_bound()) { + // Discard it + return; + } // else, continue + + // Process lower layer data + // recvTime + params_its::const_iterator it = params.find(params_its::timestamp); + if (it != params.cend()) { + p.recvTime().set_long_long_val(std::stoll(it->second)); + } else { + p.recvTime().set_to_omit(); + } + // gnNextHeader + it = params.find(params_its::gn_next_header); + if (it != params.cend()) { + p.gnNextHeader() = std::stoi(it->second); + } else { + p.gnNextHeader().set_to_omit(); + } + // gnHeaderType + it = params.find(params_its::gn_header_type); + if (it != params.cend()) { + p.gnHeaderType() = std::stoi(it->second); + } else { + p.gnHeaderType().set_to_omit(); + } + // gnHeaderSubtype + it = params.find(params_its::gn_header_sub_type); + if (it != params.cend()) { + p.gnHeaderSubtype() = std::stoi(it->second); + } else { + p.gnHeaderSubtype().set_to_omit(); + } + // gnLifetime + it = params.find(params_its::gn_lifetime); + if (it != params.cend()) { + p.gnLifetime() = std::stoi(it->second); + } else { + p.gnLifetime().set_to_omit(); + } + // gnTrafficClass + it = params.find(params_its::gn_traffic_class); + if (it != params.cend()) { + p.gnTrafficClass() = std::stoi(it->second); + } else { + p.gnTrafficClass().set_to_omit(); + } + // btpDestinationPort + it = params.find(params_its::btp_destination_port); + if (it != params.cend()) { + p.btpDestinationPort() = std::stoi(it->second); + } else { + p.btpDestinationPort().set_to_omit(); + } + // btpInfo + it = params.find(params_its::btp_info); + if (it != params.cend()) { + p.btpInfo() = std::stoi(it->second); + } else { + p.btpInfo().set_to_omit(); + } + // ssp + it = params.find(params_its::ssp); + if (it != params.cend()) { + loggers::get_instance().log("vru_layer::receive_data: ssp=%s", it->second.c_str()); + p.ssp() = oct2bit(str2oct(CHARSTRING(it->second.c_str()))); + } else { + p.ssp().set_to_omit(); + } + // its_aid + it = params.find(params_its::its_aid); + if (it != params.cend()) { + p.its__aid() = std::stoi(it->second); + } else { + p.its__aid().set_to_omit(); + } + + // Pass it to the ports if any + to_all_upper_ports(p, params); +} + +int vru_layer::enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security) { + loggers::get_instance().log(">>> vru_layer::enable_secured_mode: '%s' - %x", p_certificate_id.c_str(), p_enforce_security); + + geonetworking_layer *p = registration::get_instance().get_item(std::string("GN")); + if (p == NULL) { + return -1; + } + + loggers::get_instance().log("vru_layer::enable_secured_mode: Got GN layer %p", p); + return p->enable_secured_mode(p_certificate_id, p_enforce_security); +} + +int vru_layer::disable_secured_mode() { + loggers::get_instance().log(">>> vru_layer::disable_secured_mode"); + + geonetworking_layer *p = registration::get_instance().get_item(std::string("GN")); + if (p == NULL) { + return -1; + } + + loggers::get_instance().log("vru_layer::disable_secured_mode: Got GN layer %p", p); + return p->disable_secured_mode(); +} + +vru_layer_factory vru_layer_factory::_f; diff --git a/ccsrc/Protocols/VRU_layers/vru_layer.hh b/ccsrc/Protocols/VRU_layers/vru_layer.hh index e69de29..b4fde09 100644 --- a/ccsrc/Protocols/VRU_layers/vru_layer.hh +++ b/ccsrc/Protocols/VRU_layers/vru_layer.hh @@ -0,0 +1,76 @@ +/*! + * \file vru_layer.hh + * \brief Header file for ITS VRU protocol layer. + * \author ETSI STF525 / TTF T036 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version ETSI TS 103 300-3 V2.1.1 + */ +#pragma once + +#include "vru_codec.hh" +#include "t_layer.hh" + +namespace LibItsVru__TestSystem { + class VruPort; //! Forward declaration of TITAN class + class VamReq; //! Forward declaration of TITAN class + class VamInd; //! Forward declaration of TITAN class +} // namespace LibItsVru__TestSystem + +/*! + * \class vru_layer + * \brief This class provides description of ITS VRU protocol layer + */ +class vru_layer : public t_layer { + params_its _params; //! Layer parameters + vru_codec _codec; //! VRU codec +public: //! \publicsection + /*! + * \brief Default constructor + * Create a new instance of the vru_layer class + */ + explicit vru_layer() : t_layer(), _params(), _codec(){}; + /*! + * \brief Specialised constructor + * Create a new instance of the vru_layer class + * \param[in] p_type \todo + * \param[in] p_param \todo + */ + vru_layer(const std::string &p_type, const std::string ¶m); + /*! + * \brief Default destructor + */ + virtual ~vru_layer(){}; + + /*! + * \fn void sendMsg(const LibItsVru__TestSystem::VamReq& p_vru_req, params& p_params); + * \brief Send CA message to the lower layers + * \param[in] p_vru_req The CA message to be sent + * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters + */ + void sendMsg(const LibItsVru__TypesAndValues::VamReq &p_vru_req, params_its &p_params); + + /*! + * \virtual + * \fn void send_data(OCTETSTRING& data, params& params); + * \brief Send bytes formated data to the lower layers + * \param[in] p_data The data to be sent + * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters + */ + virtual void send_data(OCTETSTRING &data, params ¶ms); + /*! + * \virtual + * \fn void receive_data(OCTETSTRING& data, params& params); + * \brief Receive bytes formated data from the lower layers + * \param[in] p_data The bytes formated data received + * \param[in] p_params Some lower layers parameters values when data was received + */ + virtual void receive_data(OCTETSTRING &data, params &info); + + int enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security); + + int disable_secured_mode(); + +}; // End of class vru_layer diff --git a/ccsrc/Protocols/VRU_layers/vru_layer_factory.hh b/ccsrc/Protocols/VRU_layers/vru_layer_factory.hh index e69de29..53e980a 100644 --- a/ccsrc/Protocols/VRU_layers/vru_layer_factory.hh +++ b/ccsrc/Protocols/VRU_layers/vru_layer_factory.hh @@ -0,0 +1,41 @@ +/*! + * \file vru_layer_factory.hh + * \brief Header file for ITS VRU protocol layer factory. + * \author ETSI STF525 / TTF T036 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version ETSI TS 103 300-3 V2.1.1 + */ +#pragma once + +#include "layer_stack_builder.hh" + +#include "vru_layer.hh" + +/*! + * \class vru_layer_factory + * \brief This class provides a factory class to create a vru_layer class instance + */ +class vru_layer_factory : public layer_factory { + static vru_layer_factory _f; //! Reference to the unique instance of this class +public: //! \publicsection + /*! + * \brief Default constructor + * Create a new instance of the vru_layer_factory class + * \remark The CAM layer identifier is CAM + */ + vru_layer_factory() { + // Register factory + layer_stack_builder::register_layer_factory("VRU", this); + }; + /*! + * \fn layer* create_layer(const std::string & type, const std::string & param); + * \brief Create the layers stack based on the provided layers stack description + * \param[in] p_type The provided layers stack description + * \param[in] p_params Optional parameters + * \return 0 on success, -1 otherwise + */ + inline virtual layer *create_layer(const std::string &p_type, const std::string &p_param) { return new vru_layer(p_type, p_param); }; +}; // End of class vru_layer_factory diff --git a/etc/AtsVRU/AtsVRU_Simulator.cfg_ b/etc/AtsVRU/AtsVRU_Simulator.cfg_ new file mode 100644 index 0000000..47be1ad --- /dev/null +++ b/etc/AtsVRU/AtsVRU_Simulator.cfg_ @@ -0,0 +1,124 @@ + +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# IUT Station ID +LibItsCommon_Pixits.PX_IUT_STATION_ID := 2533729309 + +LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB + +LibItsVru_Pics.PICS_IS_IUT_SECURED := true + +[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). +LogFile := "../logs/AtsVRU/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | TIMEROP | VERDICTOP +#ConsoleMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | TIMEROP | VERDICTOP +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +# VRU Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# header_sub_type : sh (single hop) +# DENM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# BTP Layer +# type : btpA|btpB +# destination port: dst_port +# source port : src_port +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# GN Layer +# ll_address : GeoNetworking address of the Test System for beaconing. To be align with VRU +# latitude : Latitude of the Test System +# longitude : Longitude of the Test System +# beaconing : Set to 1 if GnLayer shall start beaconing +# expiry : Beaconing timer expiry (ms) +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# secured_mode : Set to 1 if message exchanges shall be signed +# encrypted_mode : Set to 1 if message exchanges shall be encrypted +# NOTE: For signed & encrypted message exchanges, both secured_mode and encrypted_mode shall be set to 1 +# sec_db_path : Path to the certificates and keys storage location +# hash : Hash algorithm to be used when secured mode is set +# Authorized values are SHA-256 or SHA-384 +# Default: SHA-256 +# cypher : Cyphering algorithm to be used when secured mode is set +# Authorized values are NISTP-256 and BP-256 +# Default: NISTP-256 +# Ethernet layer +# mac_src :Source MAC address +# mac_bc :Broadcast address +# eth_type : Ethernet type +# Commsignia layer +# mac_src : IUT MAC address, used to discard packets +# To indicate no filering, use the value 000000000000 +# mac_bc : Broadcast address +# eth_type : Ethernet type, used to discard packets +# target_host : Device address +# target_port : Device port +# source_port : Test System port +# interface_id: Interface id, used to discard packets +# tx_power : TX power (dB) +# xport_mode : G5 or LTE-V2X +# UDP layer (IP/UDP based on Pcap) +# dst_ip : Destination IPv4 address (aa.bb.cc.dd) +# dst_port: Destination port +# src_ip : Source IPv4 address (aa.bb.cc.dd) +# src_port: Source port +# Pcap layer +# mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System +# filter : Pcap filter (compliant with tcpdump syntax) +# Online mode: +# nic: Local NIC +# If set, online mode is used +# Offline mode (nic is present but not set): +# file : File to read +# frame_offset: Frame offset, used to skip packets with frame number < frame_offset +# time_offset : Time offset, used to skip packets with time offset < time_offset +# save_mode : Set to 1 to save sent packet, 0 otherwise + +# Cygwin +#system.vruPort.params := "VRU(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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.vruPort.params := "VRU(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947)" +# Linux over UDP +#system.vruPort.params := "VRU(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.43,src_port=4041,dst_port=9091)" + +# PC5 + UU/Raw +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=515340240,longitude=139274330,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates_iut)/LTE(mac_src=8c554ac1eee1,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.43,dst_port=4041,src_port=9091)" +# PC5 + Uu/MQTT +# Raw UDP +#system.vruPort.params := "VRU(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=udp,debug=1,server=192.168.1.39,port=1883)" +# MQTT over TCP +#system.vruPort.params := "VRU(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=192.168.1.39,port=1883)" + +# VRU UpperTester port based on UDP +system.utPort.params := "UT_VRU/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" +#system.utPort.params := "UT_VRU/UDP(dst_ip=192.168.146.26)" +#system.utPort.params := "UT_VRU/UDP(dst_ip=172.16.35.1)" + +[EXECUTE] +#ItsCps_TestControl.control + +# +ItsCps_TestCases.TC_VRU_MSD_PAR_BV_01 +# +#ItsCps_TestCases.TC_VRU_MSD_PAR_BV_02 +# +#ItsCps_TestCases.TC_VRU_MSD_PAR_BV_03 + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 -- GitLab From cd501fe12b49b556efe1b3de04690aa222ef3569 Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 20 Jun 2024 14:52:49 +0200 Subject: [PATCH 142/178] Review AtsVRU config file --- etc/AtsVRU/AtsVRU_Simulator.cfg_ | 8 ++++---- ttcn/AtsVRU | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/AtsVRU/AtsVRU_Simulator.cfg_ b/etc/AtsVRU/AtsVRU_Simulator.cfg_ index 47be1ad..c3dd89a 100644 --- a/etc/AtsVRU/AtsVRU_Simulator.cfg_ +++ b/etc/AtsVRU/AtsVRU_Simulator.cfg_ @@ -107,14 +107,14 @@ system.utPort.params := "UT_VRU/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port= #system.utPort.params := "UT_VRU/UDP(dst_ip=172.16.35.1)" [EXECUTE] -#ItsCps_TestControl.control +#ItsVru_TestControl.control # -ItsCps_TestCases.TC_VRU_MSD_PAR_BV_01 +ItsVru_TestCases.TC_VRU_MSD_PAR_BV_01 # -#ItsCps_TestCases.TC_VRU_MSD_PAR_BV_02 +#ItsVru_TestCases.TC_VRU_MSD_PAR_BV_02 # -#ItsCps_TestCases.TC_VRU_MSD_PAR_BV_03 +#ItsVru_TestCases.TC_VRU_MSD_PAR_BV_03 [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/ttcn/AtsVRU b/ttcn/AtsVRU index 151fa8d..9c9a94a 160000 --- a/ttcn/AtsVRU +++ b/ttcn/AtsVRU @@ -1 +1 @@ -Subproject commit 151fa8d5962a2b3164a79ba52e7745212c201293 +Subproject commit 9c9a94a354bdf000fbd4e81608c54d5f3a00b414 -- GitLab From c2fcf765ff48b5116b7819782c71bece3966d863 Mon Sep 17 00:00:00 2001 From: garciay Date: Fri, 21 Jun 2024 07:12:21 +0200 Subject: [PATCH 143/178] Review README.md files, Bug fixed in virtualization/docker --- README.md | 42 ++++++++++------------------- ttcn/AtsBTP | 2 +- virtualization/docker/Dockerfile | 2 +- virtualization/docker/docker-run.sh | 2 +- 4 files changed, 17 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 0c87788..d7d588a 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ See the attached LICENSE file or visit https://forge.etsi.org/legal-matters. ## STFs/TTFs The following STFs were or are currently involved in the evolutions of the ETSI ITS protocols project: -- STF 405, STF 422, STF 424, STF 455, STF 462, STF 481, STF 484, STF 507, STF 517, STF 525, STF 538, STF 545, STF 594, TTF T002, TTF T011 +- STF 405, STF 422, STF 424, STF 455, STF 462, STF 481, STF 484, STF 507, STF 517, STF 525, STF 538, STF 545, STF 594, TTF T002, TTF T011, TTF T024, TTF T025 # Installation @@ -82,7 +82,7 @@ Procedure on the host machine: - Clone the ETSI ITS Test System ```sh -$ git clone --recurse-submodules https://forge.etsi.org/gitlab/ITS/TS.ITS.git ./TS.ITS_r1 +$ git clone --recurse-submodules https://forge.etsi.org/gitlab/ITS/TS.ITS.git ./TS.ITS ``` - Select the branch you need: @@ -288,27 +288,13 @@ Procedure: - Clone the ETSI ITS protocols project into $HOME/dev folder ```sh -$ git clone --recurse-submodules https://forge.etsi.org/gitlab/ITS/TS.ITS.git ./TS.ITS_r1 +$ git clone --recurse-submodules --branch=TTF_T036 https://forge.etsi.org/gitlab/ITS/TS.ITS.git TS.ITS.TTF_T036 ``` -- Select the branch you need: - - ITS Release 1 (this example) - -```sh -$ git checkout devel -``` - - ITS Release 2 - -```sh -$ git checkout ttf_t024 -``` - -- Apply the configuration +- Execute the script install.sh ```sh -$ ./switch_its_r2.sh +$ ./install.sh ``` - Build a test suite (e.g. AtsCAM) @@ -332,7 +318,7 @@ Pre-requisites: - Your are logged as 'etsi' or 'vagrant' user - Procedure using TITAN command line (only): - Open several SSH session (PuTTY...) - - Change to the directory ~/dev/TS.ITS_r1/ + - Change to the directory ~/dev/TS.ITS.TTF_T036/ - Modify the file config.mk according to your system: - On Linux, comment all the lines using the '#' character - On Windows, update the path accordingly @@ -351,7 +337,7 @@ $ make - To run the test suitem, execute the following command: ```sh -$ cd ~/dev/TS.ITS_r1/scripts +$ cd ~/dev/TS.ITS.TTF_T036/scripts $ ../run_all.bash ... ``` @@ -385,22 +371,22 @@ $ make ### Generate the certificates -After applying the previous clause, change to the folder '~/dev/TS.ITS_r1/data/certificates' and execute 'make' command: +After applying the previous clause, change to the folder '~/dev/TS.ITS.TTF_T036/data/certificates' and execute 'make' command: ``` -$ cd ~/dev/TS.ITS_r1/data/certificates +$ cd ~/dev/TS.ITS.TTF_T036/data/certificates $ CERTGEN=~/dev/itscertgen/ make $ CERTGEN=~/dev/itscertgen/ make install ``` -The certificates will be located in the folder '~/dev/TS.ITS_r1/data/certificates/certificates'. +The certificates will be located in the folder '~/dev/TS.ITS.TTF_T036/data/certificates/certificates'. To use this newly generated certificates, you shall update two parameters located in the TTCN-3 file LibItsSecurity_Pixits. These are: -- LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH, which is the path the certificates folder (e.g. LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "/home//dev/TS.ITS_r1/data/certificates") +- LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH, which is the path the certificates folder (e.g. LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "/home//dev/TS.ITS.TTF_T036/data/certificates") - LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME, which is the name of the certificates folder (e.g. LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates") ### Modify or create new certificates -The folder '~/dev/TS.ITS_r1/data/profiles' contains an XML file for each certificate to be generated. +The folder '~/dev/TS.ITS.TTF_T036/data/profiles' contains an XML file for each certificate to be generated. This XML file describes the certificate content (e.g. CERT_IUT_A_RCA.xml describes the root certificate for all CERT_IUT_A certificates). By modifying these files, you can change create new certificate with different geographical area, different validity periods or different SSPs. @@ -421,7 +407,7 @@ In this cases, the following parameters shall be modified to match the ITS devic In addition, the Test System shall be configured to support the security modifying the following settings as described below: - device_mode=1 - secured_mode=1 -- sec_db_path=/home//dev/TS.ITS_r1/data/certificates/certificates +- sec_db_path=/home//dev/TS.ITS.TTF_T036/data/certificates/certificates ### ITS Protocol Test suites for Transport layer @@ -434,7 +420,7 @@ In this cases, the following parameters shall be modified to match the ITS devic In addition, the Test System shall be configured to support the security modifying the following settings as described below: - device_mode=1 - secured_mode=1 -- sec_db_path=/home//dev/TS.ITS_r1/data/certificates/certificates +- sec_db_path=/home//dev/TS.ITS.TTF_T036/data/certificates/certificates ### ITS Protocol Test suites for Security diff --git a/ttcn/AtsBTP b/ttcn/AtsBTP index e1c90f2..10d783e 160000 --- a/ttcn/AtsBTP +++ b/ttcn/AtsBTP @@ -1 +1 @@ -Subproject commit e1c90f29e9b2fcdbb79f064f90ba5f34710b8a2c +Subproject commit 10d783e6916df22cab65c67a68982be6888d19e5 diff --git a/virtualization/docker/Dockerfile b/virtualization/docker/Dockerfile index 1c12d7c..7fa6d24 100644 --- a/virtualization/docker/Dockerfile +++ b/virtualization/docker/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:3.16 # Install dependencies RUN apk update && \ - apk add --no-cache autoconf automake sudo make git g++ diffutils expect openssl-dev libxml2-dev libxml2-utils libxslt-dev libtool ncurses-dev jsoncpp-dev readline-dev flex bison perl libexecinfo-dev bash libedit libedit-dev lksctp-tools lksctp-tools-dev libpcap-dev curl + apk add --no-cache autoconf automake sudo make git g++ diffutils expect openssl-dev libxml2-dev libxml2-utils libxslt-dev libtool ncurses-dev jsoncpp-dev readline-dev flex bison perl libexecinfo-dev bash libedit libedit-dev lksctp-tools lksctp-tools-dev libpcap-dev zlib-dev curl # Create user and sudouser RUN \ diff --git a/virtualization/docker/docker-run.sh b/virtualization/docker/docker-run.sh index 9a85ea6..03121d6 100755 --- a/virtualization/docker/docker-run.sh +++ b/virtualization/docker/docker-run.sh @@ -3,7 +3,7 @@ set -exo pipefail cd "$(dirname ${BASH_SOURCE})" -PRJ=TS.ITS_r2 +PRJ=TS.ITS.TTF_T036 docker run --rm -it \ -w $HOME/dev/$PRJ \ -e GEN_DIR=$HOME/dev/$PRJ \ -- GitLab From a70b3f16e7f63dd349616c140189de0b4e9f0da1 Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 25 Jun 2024 09:37:22 +0200 Subject: [PATCH 144/178] Compile AtsIS --- install.sh | 4 +++- libasn1.mk | 20 +++++++++++--------- ttcn/AtsIS | 2 +- ttcn/LibIts | 2 +- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index 3083db7..1093ed4 100755 --- a/install.sh +++ b/install.sh @@ -47,12 +47,14 @@ do ln SPATEM-PDU-Descriptions.asn SPATEM_PDU_Descriptions.asn ln SREM-PDU-Descriptions.asn SREM_PDU_Descriptions.asn ln SSEM-PDU-Descriptions.asn SSEM_PDU_Descriptions.asn + ln DSRC-addgrp-C.asn DSRC_addgrp_C.asn + ln DSRC-region.asn DSRC_region.asn #cd ./iso-patched #ln 'ISO14906(2018)EfcDsrcApplicationv6-patched.asn' EfcDsrcApplication.asn #ln 'ISO14906(2018)EfcDsrcGenericv7-patched.asn' EfcDsrcGeneric.asn #ln ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn ElectronicRegistrationIdentificationVehicleDataModule.asn #ln ISO14823-missing.asn GDD.asn - #cd - + cd - fi SUB_DIRS=`find . -type d` if [ "SUB_DIRS" != "" ] diff --git a/libasn1.mk b/libasn1.mk index 32b2300..d9a82d8 100644 --- a/libasn1.mk +++ b/libasn1.mk @@ -81,6 +81,10 @@ $(TOP_DIR)/./build/asn1/ISO_TS_14816/AVIAEINumberingAndDataStructures.asn: # mkdir -p "$(dir $@) # curl -o "$@" 'https://standards.iso.org/iso/14906/ed-3/en/ISO14906(2018)EfcDsrcGenericv7.asn' +#$(TOP_DIR)/./build/asn1/ISO_TS_ISO17573_3/EfcDataDictionary.asn: +# mkdir -p "$(dir $@) +# curl -o "$@" 'https://standards.iso.org/iso/17573/-3/ed-1/en/ISO17573-3(2023)EfcDataDictionaryV1.3.asn' + $(TOP_DIR)/./build/asn1/ISO_TS_17419/CITSapplMgmtIDs.asn: mkdir -p "$(dir $@)" curl -o "$@" 'https://standards.iso.org/iso/ts/17419/TS%2017419%20ASN.1%20repository/TS17419_2014_CITSapplMgmtIDs.asn' @@ -106,15 +110,13 @@ $(TOP_DIR)/./build/asn1/ISO_TS_17419/CITSdataDictionary2.asn: #$(TOP_DIR)/./build/asn1/ISO_TS_19091/DSRC_REGION_noCircular.asn #$(TOP_DIR)/./build/asn1/ISO_TS_19091/REGION.asn -$(TOP_DIR)/./build/asn1/ISO_TS_19321/IVI.asn: - mkdir -p "$(dir $@)" - curl 'https://standards.iso.org/iso/ts/19321/ed-2/en/ISO19321IVIv2.asn' | \ - sed -e 's/\bCITSdataDictionary1\b/CITSapplMgmtIDs/g' \ - -e 's/,\s*\.\.\.\s*,\s*[0-9]\+/,.../g' \ - -e 's/ITS-Container/ETSI-ITS-CDD/g' \ - -e 's/ts (102894)/102894/g' \ - -e 's/version (2)/major-version-3 (3) minor-version-1 (1)/g' \ - > "$@" +#$(TOP_DIR)/./build/asn1/ISO_TS_19321/IVI.asn: +# mkdir -p "$(dir $@)" +# curl -o "$@" 'https://standards.iso.org/iso/ts/19321/ed-3/en/ISO_CD%20TS%2019321%20ed.3%20-%20id.82956%20Approval%20ISO19321IVIv3.1.asn' + +#$(TOP_DIR)/./build/asn1/ISO_TS_19321/IVI-IS.asn: +# mkdir -p "$(dir $@)" +# curl -o "$@" 'https://standards.iso.org/iso/ts/19321/ed-3/en/ISO_CD%20TS%2019321%20ed.3%20-%20id.82956%20Approval%20ISO19321IVI-IS.asn' #$(TOP_DIR)/build/asn1/ISO_TS_24534-3/ElectronicRegistrationIdentificationVehicleDataModule.asn: # mkdir -p "$(dir $@)" diff --git a/ttcn/AtsIS b/ttcn/AtsIS index cb49fba..1d0c986 160000 --- a/ttcn/AtsIS +++ b/ttcn/AtsIS @@ -1 +1 @@ -Subproject commit cb49fba11f3bfcda41223d46fdd263bee39364f1 +Subproject commit 1d0c9866e493deb47e132729bb9dc378d6498022 diff --git a/ttcn/LibIts b/ttcn/LibIts index 4b1d1fa..97cc32e 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit 4b1d1fa7f56c6b76cd6d3f303179b7805be3d6b9 +Subproject commit 97cc32e6a921bc89d16212e8ce308b103fd26808 -- GitLab From 234e562eac682ef5de56f3cb4e8e0aa56142c64a Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 25 Jun 2024 16:06:14 +0200 Subject: [PATCH 145/178] Compile AtsIS with TITAN: file name shall be identical to ASN.1 module name --- install.sh | 8 -------- libasn1.mk | 6 ------ ttcn/AtsCPS | 2 +- ttcn/AtsIS | 2 +- ttcn/LibIts | 2 +- 5 files changed, 3 insertions(+), 17 deletions(-) diff --git a/install.sh b/install.sh index 1093ed4..b48a596 100755 --- a/install.sh +++ b/install.sh @@ -47,14 +47,6 @@ do ln SPATEM-PDU-Descriptions.asn SPATEM_PDU_Descriptions.asn ln SREM-PDU-Descriptions.asn SREM_PDU_Descriptions.asn ln SSEM-PDU-Descriptions.asn SSEM_PDU_Descriptions.asn - ln DSRC-addgrp-C.asn DSRC_addgrp_C.asn - ln DSRC-region.asn DSRC_region.asn - #cd ./iso-patched - #ln 'ISO14906(2018)EfcDsrcApplicationv6-patched.asn' EfcDsrcApplication.asn - #ln 'ISO14906(2018)EfcDsrcGenericv7-patched.asn' EfcDsrcGeneric.asn - #ln ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn ElectronicRegistrationIdentificationVehicleDataModule.asn - #ln ISO14823-missing.asn GDD.asn - cd - fi SUB_DIRS=`find . -type d` if [ "SUB_DIRS" != "" ] diff --git a/libasn1.mk b/libasn1.mk index d9a82d8..2543709 100644 --- a/libasn1.mk +++ b/libasn1.mk @@ -104,12 +104,6 @@ $(TOP_DIR)/./build/asn1/ISO_TS_17419/CITSdataDictionary2.asn: mkdir -p "$(dir $@)" curl -o "$@" 'https://standards.iso.org/iso/17419/ed-1/en/17419.2.asn' -#$(TOP_DIR)/./build/asn1/ISO_TS_19091/AddGrpC.asn: -#$(TOP_DIR)/./build/asn1/ISO_TS_19091/AddGrpC_noCircular.asn: -#$(TOP_DIR)/./build/asn1/ISO_TS_19091/DSRC.asn: -#$(TOP_DIR)/./build/asn1/ISO_TS_19091/DSRC_REGION_noCircular.asn -#$(TOP_DIR)/./build/asn1/ISO_TS_19091/REGION.asn - #$(TOP_DIR)/./build/asn1/ISO_TS_19321/IVI.asn: # mkdir -p "$(dir $@)" # curl -o "$@" 'https://standards.iso.org/iso/ts/19321/ed-3/en/ISO_CD%20TS%2019321%20ed.3%20-%20id.82956%20Approval%20ISO19321IVIv3.1.asn' diff --git a/ttcn/AtsCPS b/ttcn/AtsCPS index 86797be..f905e19 160000 --- a/ttcn/AtsCPS +++ b/ttcn/AtsCPS @@ -1 +1 @@ -Subproject commit 86797beb7d7ff45f926ac0b591557fddd1539155 +Subproject commit f905e193fd7990dae8bb679b451c510774ffe0c1 diff --git a/ttcn/AtsIS b/ttcn/AtsIS index 1d0c986..2ff738e 160000 --- a/ttcn/AtsIS +++ b/ttcn/AtsIS @@ -1 +1 @@ -Subproject commit 1d0c9866e493deb47e132729bb9dc378d6498022 +Subproject commit 2ff738e8663c455f89efbd8c43b417ca00460c61 diff --git a/ttcn/LibIts b/ttcn/LibIts index 97cc32e..64e9a23 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit 97cc32e6a921bc89d16212e8ce308b103fd26808 +Subproject commit 64e9a233028508c57cafb85ecbc5d26ff44da1ee -- GitLab From e53ad219d7f0b0e628b2476913e7095fbecb6bf8 Mon Sep 17 00:00:00 2001 From: garciay Date: Wed, 26 Jun 2024 11:12:05 +0200 Subject: [PATCH 146/178] Rebuild AtsRSUsSimulator for full ITS release 2 --- .../ConfigRsuSimulatorLayer.cc | 110 ++++++++++++++---- .../ConfigRsuSimulatorLayer.hh | 5 + 2 files changed, 93 insertions(+), 22 deletions(-) diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc index 0cf0778..dde8fcd 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc @@ -649,15 +649,20 @@ int ConfigRsuSimulatorLayer::process_ut_denm_trigger(const OCTETSTRING &data, pa } p += 3; // Situation - trigger.situation().informationQuality() = oct2int(OCTETSTRING(1, p++)); - trigger.situation().eventType().causeCode() = oct2int(OCTETSTRING(1, p++)); - trigger.situation().eventType().subCauseCode() = oct2int(OCTETSTRING(1, p++)); + trigger.situation().informationQuality() = oct2int(OCTETSTRING(1, p++)); + ETSI__ITS__CDD::CauseCodeChoice causeCodeChoice; + int cause = oct2int(OCTETSTRING(1, p++)); + set_cause_code_choice(cause, causeCodeChoice); // FIXME Check result + trigger.situation().eventType().ccAndScc() = causeCodeChoice; + int subCause = oct2int(OCTETSTRING(1, p++)); trigger.situation().linkedCause().set_to_omit(); - trigger.situation().eventHistory().set_to_omit(); + trigger.situation().eventZone().set_to_omit(); + trigger.situation().linkedDenms().set_to_omit(); + trigger.situation().eventEnd().set_to_omit(); // RelevanceDistance - trigger.relevanceDistance() = oct2int(OCTETSTRING(1, p++)); + trigger.awarenessDistance() = oct2int(OCTETSTRING(1, p++)); // RelevanceTrafficDirection - trigger.relevanceTrafficDirection() = oct2int(OCTETSTRING(1, p++)); + trigger.trafficDirection() = oct2int(OCTETSTRING(1, p++)); if ((flag & 0x04) == 0x04) { trigger.transmissionInterval() = OPTIONAL(oct2int(OCTETSTRING(2, p))); } else { @@ -725,27 +730,32 @@ int ConfigRsuSimulatorLayer::process_ut_denm_update(const OCTETSTRING &data, par if ((flag & 0x40) == 0x40) { DENM__PDU__Descriptions::SituationContainer &s = static_cast(*update.get_opt_value()); s.informationQuality() = oct2int(OCTETSTRING(1, p++)); - s.eventType().causeCode() = oct2int(OCTETSTRING(1, p++)); - s.eventType().subCauseCode() = oct2int(OCTETSTRING(1, p++)); + ETSI__ITS__CDD::CauseCodeChoice causeCodeChoice; + int cause = oct2int(OCTETSTRING(1, p++)); + set_cause_code_choice(cause, causeCodeChoice); // FIXME Check result + s.eventType().ccAndScc() = causeCodeChoice; + int subCause = oct2int(OCTETSTRING(1, p++)); s.linkedCause().set_to_omit(); - s.eventHistory().set_to_omit(); + s.eventZone().set_to_omit(); + s.linkedDenms().set_to_omit(); + s.eventEnd().set_to_omit(); update.situation() = OPTIONAL(s); } else { update.situation().set_to_omit(); } // Location update.location().set_to_omit(); - // RelevanceDistance + // AwarenessDistance if ((flag & 0x20) == 0x20) { - update.relevanceDistance() = oct2int(OCTETSTRING(1, p++)); + update.awarenessDistance() = oct2int(OCTETSTRING(1, p++)); } else { - update.relevanceDistance().set_to_omit(); + update.awarenessDistance().set_to_omit(); } - // RelevanceTrafficDirection + // TrafficDirection if ((flag & 0x10) == 0x10) { - update.relevanceTrafficDirection() = oct2int(OCTETSTRING(1, p++)); + update.trafficDirection() = oct2int(OCTETSTRING(1, p++)); } else { - update.relevanceTrafficDirection().set_to_omit(); + update.trafficDirection().set_to_omit(); } if ((flag & 0x08) == 0x08) { update.transmissionInterval() = OPTIONAL(oct2int(OCTETSTRING(2, p))); @@ -1101,12 +1111,9 @@ int ConfigRsuSimulatorLayer::process_ut_ivim_trigger(const OCTETSTRING &data, pa trigger.driverAwarenesZoneIds().set_to_omit(); p += 1; } - if ((flag & 0x0080) == 0x0080) { + if ((flag & 0x0080) == 0x0080) { // Assume length in one byte length CITSapplMgmtIDs::VarLengthNumber v; v.content() = oct2int(OCTETSTRING(1, p)); - trigger.itsRrid() = OPTIONAL(v); - } else { - trigger.itsRrid().set_to_omit(); } p += 1; if ((flag & 0x0040) == 0x0040) { @@ -1331,9 +1338,9 @@ int ConfigRsuSimulatorLayer::process_ut_rtcmem_trigger(const OCTETSTRING &data, // Decode msgCnt trigger.msgCnt() = *p++; // Decode rev - trigger.rev() = DSRC::RTCM__Revision(static_cast(*p++)); + trigger.rev() = ETSI__ITS__DSRC::RTCM__Revision(static_cast(*p++)); // Decode msgs - DSRC::RTCMmessageList msgs; + ETSI__ITS__DSRC::RTCMmessageList msgs; unsigned char num_items = *p++; // Number of items msgs.set_size(num_items); for (unsigned char i = 0; i < num_items; i++) { @@ -1391,7 +1398,7 @@ int ConfigRsuSimulatorLayer::process_ut_rtcmem_update(const OCTETSTRING &data, p loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_rtcmem_update: flag=%02x", flag); LibItsRtcmem__TypesAndValues::UtRtcmemUpdate update; // See ETSI TR 103 099 Cause C.10.2 GenerateRtcmemUpdate // Decode msgs - DSRC::RTCMmessageList msgs; + ETSI__ITS__DSRC::RTCMmessageList msgs; p += 1; // Skip COER flag unsigned char num_items = *p++; // Number of items msgs.set_size(num_items); @@ -1457,4 +1464,63 @@ int ConfigRsuSimulatorLayer::process_ut_rtcmem_termination(const OCTETSTRING &da return 0; } +int ConfigRsuSimulatorLayer::set_cause_code_choice(const int p_cause, ETSI__ITS__CDD::CauseCodeChoice& p_causeCodeChoice) { + loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::set_cause_code_choice: %d", p_cause); + + switch (p_cause) { + case ETSI__ITS__CDD::CauseCodeChoice::ALT_trafficCondition1: + p_causeCodeChoice.trafficCondition1() = ETSI__ITS__CDD::CauseCodeChoice::ALT_trafficCondition1; + break; + case ETSI__ITS__CDD::CauseCodeChoice::ALT_accident2: + p_causeCodeChoice.accident2() = ETSI__ITS__CDD::CauseCodeChoice::ALT_trafficCondition1; + break; + case ETSI__ITS__CDD::CauseCodeChoice::ALT_roadworks3: + p_causeCodeChoice.roadworks3() = ETSI__ITS__CDD::CauseCodeChoice::ALT_roadworks3; + break; + case ETSI__ITS__CDD::CauseCodeChoice::ALT_impassability5: + p_causeCodeChoice.impassability5() = ETSI__ITS__CDD::CauseCodeChoice::ALT_trafficCondition1; + break; + case ETSI__ITS__CDD::CauseCodeChoice::ALT_adverseWeatherCondition__Adhesion6: + p_causeCodeChoice.adverseWeatherCondition__Adhesion6() = ETSI__ITS__CDD::CauseCodeChoice::ALT_adverseWeatherCondition__Adhesion6; + break; + case ETSI__ITS__CDD::CauseCodeChoice::ALT_aquaplaning7: + p_causeCodeChoice.aquaplaning7() = ETSI__ITS__CDD::CauseCodeChoice::ALT_aquaplaning7; + break; + case ETSI__ITS__CDD::CauseCodeChoice::ALT_hazardousLocation__SurfaceCondition9: + p_causeCodeChoice.hazardousLocation__SurfaceCondition9() = ETSI__ITS__CDD::CauseCodeChoice::ALT_hazardousLocation__SurfaceCondition9; + break; + case ETSI__ITS__CDD::CauseCodeChoice::ALT_hazardousLocation__ObstacleOnTheRoad10: + p_causeCodeChoice.hazardousLocation__ObstacleOnTheRoad10() = ETSI__ITS__CDD::CauseCodeChoice::ALT_hazardousLocation__ObstacleOnTheRoad10; + break; + case ETSI__ITS__CDD::CauseCodeChoice::ALT_hazardousLocation__AnimalOnTheRoad11: + p_causeCodeChoice.hazardousLocation__AnimalOnTheRoad11() = ETSI__ITS__CDD::CauseCodeChoice::ALT_hazardousLocation__AnimalOnTheRoad11; + break; + case ETSI__ITS__CDD::CauseCodeChoice::ALT_humanPresenceOnTheRoad12: + p_causeCodeChoice.humanPresenceOnTheRoad12() = ETSI__ITS__CDD::CauseCodeChoice::ALT_humanPresenceOnTheRoad12; + break; + //ALT_rescueAndRecoveryWorkInProgress15 = 16, ALT_reserved16 = 17, ALT_adverseWeatherCondition__ExtremeWeatherCondition17 = 18, ALT_adverseWeatherCondition__Visibility18 = 19, ALT_adverseWeatherCondition__Precipitation19 = 20, ALT_violence20 = 21, ALT_reserved21 = 22, ALT_reserved22 = 23, ALT_reserved23 = 24, ALT_reserved24 = 25, ALT_reserved25 = 26, ALT_slowVehicle26 = 27, ALT_dangerousEndOfQueue27 = 28, ALT_publicTransportVehicleApproaching28 = 29, ALT_reserved29 = 30, ALT_reserved30 = 31, ALT_reserved31 = 32, ALT_reserved32 = 33, ALT_reserved33 = 34, ALT_reserved34 = 35, ALT_reserved35 = 36, ALT_reserved36 = 37, ALT_reserved37 = 38, ALT_reserved38 = 39, ALT_reserved39 = 40, ALT_reserved40 = 41, ALT_reserved41 = 42, ALT_reserved42 = 43, ALT_reserved43 = 44, ALT_reserved44 = 45, ALT_reserved45 = 46, ALT_reserved46 = 47, ALT_reserved47 = 48, ALT_reserved48 = 49, ALT_reserved49 = 50, ALT_reserved50 = 51, ALT_reserved51 = 52, ALT_reserved52 = 53, ALT_reserved53 = 54, ALT_reserved54 = 55, ALT_reserved55 = 56, ALT_reserved56 = 57, ALT_reserved57 = 58, ALT_reserved58 = 59, ALT_reserved59 = 60, ALT_reserved60 = 61, ALT_reserved61 = 62, ALT_reserved62 = 63, ALT_reserved63 = 64, ALT_reserved64 = 65, ALT_reserved65 = 66, ALT_reserved66 = 67, ALT_reserved67 = 68, ALT_reserved68 = 69, ALT_reserved69 = 70, ALT_reserved70 = 71, ALT_reserved71 = 72, ALT_reserved72 = 73, ALT_reserved73 = 74, ALT_reserved74 = 75, ALT_reserved75 = 76, ALT_reserved76 = 77, ALT_reserved77 = 78, ALT_reserved78 = 79, ALT_reserved79 = 80, ALT_reserved80 = 81, ALT_reserved81 = 82, ALT_reserved82 = 83, ALT_reserved83 = 84, ALT_reserved84 = 85, ALT_reserved85 = 86, ALT_reserved86 = 87, ALT_reserved87 = 88, ALT_reserved88 = 89, ALT_reserved89 = 90, ALT_reserved90 = 91, ALT_vehicleBreakdown91 = 92, ALT_postCrash92 = 93, ALT_humanProblem93 = 94, ALT_stationaryVehicle94 = 95, ALT_emergencyVehicleApproaching95 = 96, ALT_hazardousLocation__DangerousCurve96 = 97, ALT_collisionRisk97 = 98, ALT_signalViolation98 = 99, ALT_dangerousSituation99 = 100, ALT_railwayLevelCrossing100 = 101, ALT_reserved101 = 102, ALT_reserved102 = 103, ALT_reserved103 = 104, ALT_reserved104 = 105, ALT_reserved105 = 106, ALT_reserved106 = 107, ALT_reserved107 = 108, ALT_reserved108 = 109, ALT_reserved109 = 110, ALT_reserved110 = 111, ALT_reserved111 = 112, ALT_reserved112 = 113, ALT_reserved113 = 114, ALT_reserved114 = 115, ALT_reserved115 = 116, ALT_reserved116 = 117, ALT_reserved117 = 118, ALT_reserved118 = 119, ALT_reserved119 = 120, ALT_reserved120 = 121, ALT_reserved121 = 122, ALT_reserved122 = 123, ALT_reserved123 = 124, ALT_reserved124 = 125, ALT_reserved125 = 126, ALT_reserved126 = 127, ALT_reserved127 = 128, ALT_reserved128 = 129 + case ETSI__ITS__CDD::CauseCodeChoice::ALT_wrongWayDriving14: + p_causeCodeChoice.wrongWayDriving14() = ETSI__ITS__CDD::CauseCodeChoice::ALT_wrongWayDriving14; + break; + case ETSI__ITS__CDD::CauseCodeChoice::ALT_rescueAndRecoveryWorkInProgress15: + p_causeCodeChoice.rescueAndRecoveryWorkInProgress15() = ETSI__ITS__CDD::CauseCodeChoice::ALT_rescueAndRecoveryWorkInProgress15; + break; + + + + + + + + + + default: + loggers::get_instance().error("ConfigRsuSimulatorLayer::set_cause_code_choice: Unsupported cause: %d", p_cause); + return -1; + } // End of 'switch' statement + + loggers::get_instance().log_msg("<<< ConfigRsuSimulatorLayer::set_cause_code_choice: ", p_causeCodeChoice); + return 0; +} + ConfigRsuSimulatorLayerFactory ConfigRsuSimulatorLayerFactory::_f; diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh index 7750af1..22fa798 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh @@ -27,6 +27,10 @@ namespace ItsRSUsSimulator__TestSystem { class CfInitialize; } // namespace ItsRSUsSimulator__TestSystem +namespace ETSI__ITS__CDD { + class CauseCodeChoice; +} // namespace ETSI__ITS__CDD + class ConfigRsuSimulatorLayer : public t_layer { params _params; ConfigRsuSimulatorCodec _codec; @@ -84,4 +88,5 @@ private: int process_ut_rtcmem_trigger(const OCTETSTRING &data, params ¶ms); int process_ut_rtcmem_update(const OCTETSTRING &data, params ¶ms); int process_ut_rtcmem_termination(const OCTETSTRING &data, params ¶ms); + int set_cause_code_choice(const int p_cause, ETSI__ITS__CDD::CauseCodeChoice& p_causeCodeChoice); }; // End of class ConfigRsuSimulatorLayer -- GitLab From 4fbeacc3bcd749ce3ee90284893badf750c4a2be Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 27 Jun 2024 10:27:06 +0200 Subject: [PATCH 147/178] Add SSP version 2 in part of certificate profiles; Update copyright; Update AtsCAM confoguration files --- LICENSE | 2 +- README.md | 33 +++++---- data/certificates/profiles/CERT_IUT_A1_AT.xml | 2 + data/certificates/profiles/CERT_IUT_A2_AT.xml | 2 + data/certificates/profiles/CERT_IUT_A3_AT.xml | 1 + data/certificates/profiles/CERT_IUT_A4_AT.xml | 1 + data/certificates/profiles/CERT_IUT_A_AA.xml | 1 + .../profiles/CERT_IUT_A_AA_A8.xml | 1 + .../profiles/CERT_IUT_A_AC_AT.xml | 2 + data/certificates/profiles/CERT_IUT_A_AT.xml | 2 + .../profiles/CERT_IUT_A_AT_A8.xml | 1 + .../profiles/CERT_IUT_A_AT_IMP.xml | 2 + .../profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml | 2 + .../profiles/CERT_IUT_A_AT_NOCAM.xml | 1 + .../CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml | 2 + .../profiles/CERT_IUT_A_AT_PAST.xml | 2 + .../profiles/CERT_IUT_A_B33_AT.xml | 2 + .../profiles/CERT_IUT_A_B3_AA.xml | 1 + .../profiles/CERT_IUT_A_B3_AT.xml | 2 + .../profiles/CERT_IUT_A_B3_N_AT.xml | 2 + .../certificates/profiles/CERT_IUT_A_B_AA.xml | 1 + .../certificates/profiles/CERT_IUT_A_B_AT.xml | 2 + .../profiles/CERT_IUT_A_B_N_AT.xml | 2 + .../profiles/CERT_IUT_A_C3_AT.xml | 2 + .../profiles/CERT_IUT_A_CC_AT.xml | 2 + data/certificates/profiles/CERT_IUT_A_MA.xml | 1 + .../certificates/profiles/CERT_IUT_A_N_AA.xml | 1 + .../certificates/profiles/CERT_IUT_A_N_AT.xml | 2 + data/certificates/profiles/CERT_IUT_A_RCA.xml | 1 + data/certificates/profiles/CERT_IUT_B_AT.xml | 2 + data/certificates/profiles/CERT_IUT_C1_AT.xml | 2 + data/certificates/profiles/CERT_IUT_C2_AA.xml | 1 + data/certificates/profiles/CERT_IUT_C2_AT.xml | 2 + .../profiles/CERT_IUT_CAM_BO_02_AT.xml | 1 + .../profiles/CERT_IUT_CAM_BO_03_AT.xml | 1 + data/certificates/profiles/CERT_IUT_CC_AA.xml | 1 + data/certificates/profiles/CERT_IUT_C_AT.xml | 2 + .../certificates/profiles/CERT_IUT_C_AT_8.xml | 2 + data/certificates/profiles/CERT_IUT_C_RCA.xml | 1 + .../profiles/CERT_IUT_DENM_BO_01_AT.xml | 2 + .../profiles/CERT_IUT_DENM_BO_02_AT.xml | 2 + data/certificates/profiles/CERT_IUT_D_AA.xml | 1 + data/certificates/profiles/CERT_IUT_D_AT.xml | 2 + data/certificates/profiles/CERT_IUT_E_AT.xml | 2 + .../certificates/profiles/CERT_IUT_E_AT_8.xml | 2 + data/certificates/profiles/CERT_TS_A_AA.xml | 1 + data/certificates/profiles/CERT_TS_A_AT.xml | 2 + data/certificates/profiles/CERT_TS_B_AT.xml | 2 + etc/AtsCAM/AtsCAM.cfg | 54 ++++++++++---- etc/AtsCAM/AtsCAM_Savary.cfg_ | 24 ++++++- etc/AtsCAM/AtsCAM_Simulator.cfg_ | 34 ++++++--- etc/AtsCAM/AtsCAM_Yogoko.cf_ | 23 +++++- etc/AtsCAM/AtsCAM_pcap.cfg_ | 71 ++++++++++++++++++- etc/AtsCPS/AtsCPS_Simulator.cfg_ | 12 ++-- etc/AtsDENM/AtsDENM.cfg | 2 +- etc/AtsGeoNetworking/AtsGeoNetworking.cfg | 10 +-- etc/AtsPki/AtsPki_Simu.cfg_ | 2 +- etc/AtsVRU/AtsVRU_Simulator.cfg_ | 12 ++-- ttcn/AtsDENM | 2 +- ttcn/AtsPki | 2 +- 60 files changed, 294 insertions(+), 63 deletions(-) diff --git a/LICENSE b/LICENSE index 7cae155..064741a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2019-2022 ETSI +Copyright 2019-2024 ETSI Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index d7d588a..b0e92e0 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,16 @@ This repositories contains the test specifications and test adapter code for ETSI ITS protocols testing, Release 1. ETSI ITS protocols project supports: -- ETSI EN 302 637-2: "Intelligent Transport Systems (ITS); Vehicular Communications; Basic Set of Applications; Part 2: Specification of Cooperative Awareness Basic Service" -- ETSI EN 102 637-3: "Intelligent Transport Systems (ITS); Vehicular Communications; Basic Set of Applications; Part 3: Specifications of Decentralized Environmental Notification Basic Service" -- ETSI TS 103 301: "Intelligent Transport Systems (ITS); Vehicular Communications; Basic Set of Applications; Facilities layer protocols and communication requirements for infrastructure services" -- EN 302 636-5-1: "Intelligent Transport Systems (ITS); Vehicular Communications; GeoNetworking; Part 5: Transport Protocols; Sub-part 1: Basic Transport Protocol" -- EN 302 636-4-1: "Intelligent Transport Systems (ITS); Vehicular Communications; GeoNetworking; Part 4: Geographical addressing and forwarding for point-to-point and point-to-multipoint communications; Sub-part 1: Media-Independent Functionality" +- ETSI TS 103 900 v2.1.1: "Intelligent Transport Systems (ITS); Vehicular Communications; Basic Set of Applications; Part 2: Specification of Cooperative Awareness Basic Service" +- ETSI TS 103 831 v2.1.1: "Intelligent Transport Systems (ITS); Vehicular Communications; Basic Set of Applications; Part 3: Specifications of Decentralized Environmental Notification Basic Service" +- ETSI TS 103 301 v2.1.1: "Intelligent Transport Systems (ITS); Vehicular Communications; Basic Set of Applications; Facilities layer protocols and communication requirements for infrastructure services" +- EN 302 636-5-1 V2.2.1: "Intelligent Transport Systems (ITS); Vehicular Communications; GeoNetworking; Part 5: Transport Protocols; Sub-part 1: Basic Transport Protocol" +- ETSI TS 103 836-4-1 v2.1.1: "Intelligent Transport Systems (ITS); Vehicular Communications; GeoNetworking; Part 4: Geographical addressing and forwarding for point-to-point and point-to-multipoint communications; Sub-part 1: Media-Independent Functionality" In addition, it also support ITS Security as define by: -- ETSI TS 103 940: "Intelligent Transport Systems (ITS); Security; Security Architecture and Management". -- ETSI TS 103 097: "Intelligent Transport Systems (ITS); Security; Security header and certificate formats". -- ETSI TS 102 941: "Intelligent Transport Systems (ITS); Security; Trust and Privacy Management technical specification" +- ETSI TS 103 940 v2.1.1: "Intelligent Transport Systems (ITS); Security; Security Architecture and Management". +- ETSI TS 103 097 v2.1.1: "Intelligent Transport Systems (ITS); Security; Security header and certificate formats". +- ETSI TS 102 941 v2.1.1: "Intelligent Transport Systems (ITS); Security; Trust and Privacy Management technical specification" - IEEE Std 1609.2™-2016: "IEEE Standard for Wireless Access in Vehicular Environments –Security Services for Applications and Management Messages" - IEEE Std 1609.2a™-2017: "Standard for Wireless Access In Vehicular Environments – Security Services for Applications and Management Messages Amendment 1". @@ -351,12 +351,17 @@ This tool is located [here](https://forge.etsi.org/rep/ITS/itscertgen.git). ```sh cd ~/dev -$ git clone --recurse-submodules https://forge.etsi.org/rep/ITS/itscertgen.git +$ git clone --recurse-submodules --branch=release2 https://forge.etsi.org/rep/ITS/itscertgen.git itscertgen-r2 cd itscertgen make ``` -Note: These certificates can not be used in a true architectures, there are present only for testing and/or debug purposes. +Note: +- These certificates can not be used in a true architectures, there are present only for testing and/or debug purposes. +- Before to generate certificates, you have to update the file asn1certgen.xslt with the current year (e.g. 20XX -> 2024): +```xml + +``` ### Build the tool 'itscertgen' to generate new certificates bundle @@ -364,7 +369,7 @@ Note: These certificates can not be used in a true architectures, there are pres To build the tool, run the 'make': ```sh -$ cd ~/dev/itscertgen +$ cd ~/dev/itscertgen-r2 $ make ``` @@ -374,10 +379,10 @@ $ make After applying the previous clause, change to the folder '~/dev/TS.ITS.TTF_T036/data/certificates' and execute 'make' command: ``` $ cd ~/dev/TS.ITS.TTF_T036/data/certificates -$ CERTGEN=~/dev/itscertgen/ make -$ CERTGEN=~/dev/itscertgen/ make install +$ CERTGEN=~/dev/itscertgen-r2/ make +$ CERTGEN=~/dev/itscertgen-r2/ make install ``` -The certificates will be located in the folder '~/dev/TS.ITS.TTF_T036/data/certificates/certificates'. +The certificates will be located in the folder '~/dev/TS.ITS.TTF_T036/data/certificates/certificates and ~/dev/TS.ITS.TTF_T036/data/certificates/iut'. To use this newly generated certificates, you shall update two parameters located in the TTCN-3 file LibItsSecurity_Pixits. These are: - LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH, which is the path the certificates folder (e.g. LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "/home//dev/TS.ITS.TTF_T036/data/certificates") diff --git a/data/certificates/profiles/CERT_IUT_A1_AT.xml b/data/certificates/profiles/CERT_IUT_A1_AT.xml index f73179d..ab5eef6 100644 --- a/data/certificates/profiles/CERT_IUT_A1_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A1_AT.xml @@ -22,6 +22,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A2_AT.xml b/data/certificates/profiles/CERT_IUT_A2_AT.xml index 434f9e9..40c3e55 100644 --- a/data/certificates/profiles/CERT_IUT_A2_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A2_AT.xml @@ -22,6 +22,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A3_AT.xml b/data/certificates/profiles/CERT_IUT_A3_AT.xml index 415ecba..e24745f 100644 --- a/data/certificates/profiles/CERT_IUT_A3_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A3_AT.xml @@ -22,6 +22,7 @@ 01 FF FF FF + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A4_AT.xml b/data/certificates/profiles/CERT_IUT_A4_AT.xml index 7bdd092..fd9f478 100644 --- a/data/certificates/profiles/CERT_IUT_A4_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A4_AT.xml @@ -21,6 +21,7 @@ 01 FF FC + 02 FF FC diff --git a/data/certificates/profiles/CERT_IUT_A_AA.xml b/data/certificates/profiles/CERT_IUT_A_AA.xml index 43f2171..66abff5 100644 --- a/data/certificates/profiles/CERT_IUT_A_AA.xml +++ b/data/certificates/profiles/CERT_IUT_A_AA.xml @@ -32,6 +32,7 @@
01 32 + 02 32 diff --git a/data/certificates/profiles/CERT_IUT_A_AA_A8.xml b/data/certificates/profiles/CERT_IUT_A_AA_A8.xml index b6c1ccc..368521f 100644 --- a/data/certificates/profiles/CERT_IUT_A_AA_A8.xml +++ b/data/certificates/profiles/CERT_IUT_A_AA_A8.xml @@ -32,6 +32,7 @@
01 32 + 02 32 diff --git a/data/certificates/profiles/CERT_IUT_A_AC_AT.xml b/data/certificates/profiles/CERT_IUT_A_AC_AT.xml index 808cee1..d4e48d2 100644 --- a/data/certificates/profiles/CERT_IUT_A_AC_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_AC_AT.xml @@ -23,6 +23,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A_AT.xml b/data/certificates/profiles/CERT_IUT_A_AT.xml index 2f6613c..e215c05 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT.xml @@ -23,6 +23,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 03 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A_AT_A8.xml b/data/certificates/profiles/CERT_IUT_A_AT_A8.xml index 9e14f2d..e43c373 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_A8.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_A8.xml @@ -29,6 +29,7 @@ 00 00 01 FF FC + 02 FF FC
diff --git a/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml b/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml index 85f865b..8cfcba0 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml @@ -23,6 +23,8 @@ 01 FF FC  01 FF FF FF  +02 FF FC  +02 FF FF FF    diff --git a/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml b/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml index 55ed102..347553b 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml @@ -23,6 +23,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml b/data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml index 90db044..2c1419d 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml @@ -22,6 +22,7 @@ 01 FF FF FF + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml b/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml index 9908e61..bc9da8f 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml @@ -23,6 +23,8 @@ 01 FD FC 01 FF FF FF + 02 FD FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml b/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml index 26c2c8e..999f613 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml @@ -23,6 +23,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A_B33_AT.xml b/data/certificates/profiles/CERT_IUT_A_B33_AT.xml index ff8744e..6ee3aa7 100644 --- a/data/certificates/profiles/CERT_IUT_A_B33_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B33_AT.xml @@ -22,6 +22,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A_B3_AA.xml b/data/certificates/profiles/CERT_IUT_A_B3_AA.xml index d7b1fb1..f8a7035 100644 --- a/data/certificates/profiles/CERT_IUT_A_B3_AA.xml +++ b/data/certificates/profiles/CERT_IUT_A_B3_AA.xml @@ -32,6 +32,7 @@
01 32 + 02 32 diff --git a/data/certificates/profiles/CERT_IUT_A_B3_AT.xml b/data/certificates/profiles/CERT_IUT_A_B3_AT.xml index 9ae80b9..3768843 100644 --- a/data/certificates/profiles/CERT_IUT_A_B3_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B3_AT.xml @@ -22,6 +22,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml b/data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml index 02e04ec..e1354c3 100644 --- a/data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml @@ -22,6 +22,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A_B_AA.xml b/data/certificates/profiles/CERT_IUT_A_B_AA.xml index dc731e7..71b0402 100644 --- a/data/certificates/profiles/CERT_IUT_A_B_AA.xml +++ b/data/certificates/profiles/CERT_IUT_A_B_AA.xml @@ -32,6 +32,7 @@
01 32 + 02 32 diff --git a/data/certificates/profiles/CERT_IUT_A_B_AT.xml b/data/certificates/profiles/CERT_IUT_A_B_AT.xml index 11cdd6d..8546e23 100644 --- a/data/certificates/profiles/CERT_IUT_A_B_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B_AT.xml @@ -22,6 +22,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A_B_N_AT.xml b/data/certificates/profiles/CERT_IUT_A_B_N_AT.xml index ab21ef5..639f933 100644 --- a/data/certificates/profiles/CERT_IUT_A_B_N_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B_N_AT.xml @@ -22,6 +22,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A_C3_AT.xml b/data/certificates/profiles/CERT_IUT_A_C3_AT.xml index 4bdb475..2c4db6f 100644 --- a/data/certificates/profiles/CERT_IUT_A_C3_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_C3_AT.xml @@ -23,6 +23,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A_CC_AT.xml b/data/certificates/profiles/CERT_IUT_A_CC_AT.xml index 50800e9..557bd96 100644 --- a/data/certificates/profiles/CERT_IUT_A_CC_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_CC_AT.xml @@ -23,6 +23,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A_MA.xml b/data/certificates/profiles/CERT_IUT_A_MA.xml index 0415f67..b46c25d 100644 --- a/data/certificates/profiles/CERT_IUT_A_MA.xml +++ b/data/certificates/profiles/CERT_IUT_A_MA.xml @@ -32,6 +32,7 @@
01 32 + 02 32 diff --git a/data/certificates/profiles/CERT_IUT_A_N_AA.xml b/data/certificates/profiles/CERT_IUT_A_N_AA.xml index 2728718..6f20408 100644 --- a/data/certificates/profiles/CERT_IUT_A_N_AA.xml +++ b/data/certificates/profiles/CERT_IUT_A_N_AA.xml @@ -32,6 +32,7 @@
01 32 + 02 32 diff --git a/data/certificates/profiles/CERT_IUT_A_N_AT.xml b/data/certificates/profiles/CERT_IUT_A_N_AT.xml index d98b2f2..32fae05 100644 --- a/data/certificates/profiles/CERT_IUT_A_N_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_N_AT.xml @@ -23,6 +23,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_A_RCA.xml b/data/certificates/profiles/CERT_IUT_A_RCA.xml index 2a27460..1b4fa48 100644 --- a/data/certificates/profiles/CERT_IUT_A_RCA.xml +++ b/data/certificates/profiles/CERT_IUT_A_RCA.xml @@ -33,6 +33,7 @@
01 3E/FF C1 + 02 3E/FF C1 01 diff --git a/data/certificates/profiles/CERT_IUT_B_AT.xml b/data/certificates/profiles/CERT_IUT_B_AT.xml index 6da3e65..98213f2 100644 --- a/data/certificates/profiles/CERT_IUT_B_AT.xml +++ b/data/certificates/profiles/CERT_IUT_B_AT.xml @@ -22,6 +22,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_C1_AT.xml b/data/certificates/profiles/CERT_IUT_C1_AT.xml index 05061fa..5a68e95 100644 --- a/data/certificates/profiles/CERT_IUT_C1_AT.xml +++ b/data/certificates/profiles/CERT_IUT_C1_AT.xml @@ -22,6 +22,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_C2_AA.xml b/data/certificates/profiles/CERT_IUT_C2_AA.xml index 5a08a55..7f02fa9 100644 --- a/data/certificates/profiles/CERT_IUT_C2_AA.xml +++ b/data/certificates/profiles/CERT_IUT_C2_AA.xml @@ -31,6 +31,7 @@ 01 32 + 02 32 diff --git a/data/certificates/profiles/CERT_IUT_C2_AT.xml b/data/certificates/profiles/CERT_IUT_C2_AT.xml index 875e120..7f0cd81 100644 --- a/data/certificates/profiles/CERT_IUT_C2_AT.xml +++ b/data/certificates/profiles/CERT_IUT_C2_AT.xml @@ -22,6 +22,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_02_AT.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_02_AT.xml index 3c2f9bc..be6551e 100644 --- a/data/certificates/profiles/CERT_IUT_CAM_BO_02_AT.xml +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_02_AT.xml @@ -18,6 +18,7 @@ 01 BF FC + 02 BF FC diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_03_AT.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_03_AT.xml index 7e6926f..f8620d5 100644 --- a/data/certificates/profiles/CERT_IUT_CAM_BO_03_AT.xml +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_03_AT.xml @@ -18,6 +18,7 @@ 01 DF FC + 02 DF FC diff --git a/data/certificates/profiles/CERT_IUT_CC_AA.xml b/data/certificates/profiles/CERT_IUT_CC_AA.xml index e2751a7..e18bf10 100644 --- a/data/certificates/profiles/CERT_IUT_CC_AA.xml +++ b/data/certificates/profiles/CERT_IUT_CC_AA.xml @@ -31,6 +31,7 @@ 01 32 + 02 32 diff --git a/data/certificates/profiles/CERT_IUT_C_AT.xml b/data/certificates/profiles/CERT_IUT_C_AT.xml index 25dd4b8..77728b5 100644 --- a/data/certificates/profiles/CERT_IUT_C_AT.xml +++ b/data/certificates/profiles/CERT_IUT_C_AT.xml @@ -22,6 +22,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_C_AT_8.xml b/data/certificates/profiles/CERT_IUT_C_AT_8.xml index b8ac71f..e2bdfbd 100644 --- a/data/certificates/profiles/CERT_IUT_C_AT_8.xml +++ b/data/certificates/profiles/CERT_IUT_C_AT_8.xml @@ -22,6 +22,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_C_RCA.xml b/data/certificates/profiles/CERT_IUT_C_RCA.xml index e3c2c73..ec5225f 100644 --- a/data/certificates/profiles/CERT_IUT_C_RCA.xml +++ b/data/certificates/profiles/CERT_IUT_C_RCA.xml @@ -31,6 +31,7 @@ 01 FE/FF 01 + 02 FE/FF 01 01 diff --git a/data/certificates/profiles/CERT_IUT_DENM_BO_01_AT.xml b/data/certificates/profiles/CERT_IUT_DENM_BO_01_AT.xml index c36a7ad..df905d4 100644 --- a/data/certificates/profiles/CERT_IUT_DENM_BO_01_AT.xml +++ b/data/certificates/profiles/CERT_IUT_DENM_BO_01_AT.xml @@ -19,6 +19,8 @@ 01 FF FC 01 7F FF FF + 02 FF FC + 02 7F FF FF diff --git a/data/certificates/profiles/CERT_IUT_DENM_BO_02_AT.xml b/data/certificates/profiles/CERT_IUT_DENM_BO_02_AT.xml index 1aeeca0..5392ed7 100644 --- a/data/certificates/profiles/CERT_IUT_DENM_BO_02_AT.xml +++ b/data/certificates/profiles/CERT_IUT_DENM_BO_02_AT.xml @@ -19,6 +19,8 @@ 01 FF FC 01 BF FF FF + 02 FF FC + 02 BF FF FF diff --git a/data/certificates/profiles/CERT_IUT_D_AA.xml b/data/certificates/profiles/CERT_IUT_D_AA.xml index 53e19cd..0ffb4de 100644 --- a/data/certificates/profiles/CERT_IUT_D_AA.xml +++ b/data/certificates/profiles/CERT_IUT_D_AA.xml @@ -31,6 +31,7 @@ 01 32 + 02 32 diff --git a/data/certificates/profiles/CERT_IUT_D_AT.xml b/data/certificates/profiles/CERT_IUT_D_AT.xml index 4d3197e..4bb48a3 100644 --- a/data/certificates/profiles/CERT_IUT_D_AT.xml +++ b/data/certificates/profiles/CERT_IUT_D_AT.xml @@ -22,6 +22,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_E_AT.xml b/data/certificates/profiles/CERT_IUT_E_AT.xml index 5414ca0..e30ab70 100644 --- a/data/certificates/profiles/CERT_IUT_E_AT.xml +++ b/data/certificates/profiles/CERT_IUT_E_AT.xml @@ -22,6 +22,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_IUT_E_AT_8.xml b/data/certificates/profiles/CERT_IUT_E_AT_8.xml index 5e359d2..4736e71 100644 --- a/data/certificates/profiles/CERT_IUT_E_AT_8.xml +++ b/data/certificates/profiles/CERT_IUT_E_AT_8.xml @@ -22,6 +22,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_TS_A_AA.xml b/data/certificates/profiles/CERT_TS_A_AA.xml index 43f2171..66abff5 100644 --- a/data/certificates/profiles/CERT_TS_A_AA.xml +++ b/data/certificates/profiles/CERT_TS_A_AA.xml @@ -32,6 +32,7 @@ 01 32 + 02 32 diff --git a/data/certificates/profiles/CERT_TS_A_AT.xml b/data/certificates/profiles/CERT_TS_A_AT.xml index 1c9a403..1d86185 100644 --- a/data/certificates/profiles/CERT_TS_A_AT.xml +++ b/data/certificates/profiles/CERT_TS_A_AT.xml @@ -23,6 +23,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/data/certificates/profiles/CERT_TS_B_AT.xml b/data/certificates/profiles/CERT_TS_B_AT.xml index 5a470de..c310c03 100644 --- a/data/certificates/profiles/CERT_TS_B_AT.xml +++ b/data/certificates/profiles/CERT_TS_B_AT.xml @@ -23,6 +23,8 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF diff --git a/etc/AtsCAM/AtsCAM.cfg b/etc/AtsCAM/AtsCAM.cfg index 57b169f..5870d5a 100644 --- a/etc/AtsCAM/AtsCAM.cfg +++ b/etc/AtsCAM/AtsCAM.cfg @@ -13,12 +13,11 @@ LibItsCam_Pics.PICS_IS_IUT_SECURED := true [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). - LogFile := "../logs/AtsCAM/%e.%h-%r.%s" FileMask := LOG_ALL | USER | DEBUG | MATCHING ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING -#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP -#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +#FileMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | TIMEROP | VERDICTOP +#ConsoleMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | TIMEROP | VERDICTOP LogSourceInfo := Stack LogEntityName:= Yes LogEventTypes:= Yes @@ -40,7 +39,7 @@ LogEventTypes:= Yes # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer -# ll_address : GeoNetworking address of the Test System +# ll_address : GeoNetworking address of the Test System for beaconing. To be align with CAM # latitude : Latitude of the Test System # longitude : Longitude of the Test System # beaconing : Set to 1 if GnLayer shall start beaconing @@ -53,11 +52,8 @@ LogEventTypes:= Yes # hash : Hash algorithm to be used when secured mode is set # Authorized values are SHA-256 or SHA-384 # Default: SHA-256 -# signature : Signature algorithm to be used when secured mode is set -# Authorized values are NISTP-256, NISTP-384, BP-256 and BP-384 -# Default: NISTP-256 # cypher : Cyphering algorithm to be used when secured mode is set -# Authorized values are NISTP-256, BP-256 and BP-384 +# Authorized values are NISTP-256 and BP-256 # Default: NISTP-256 # Ethernet layer # mac_src :Source MAC address @@ -92,25 +88,41 @@ LogEventTypes:= Yes # save_mode : Set to 1 to save sent packet, 0 otherwise # Cygwin -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,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)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp2s0,filter=and ether proto 0x8947)" +system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlo1,filter=and ether proto 0x8947)" # Linux over UDP -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=9091)" -system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=tun0,filter=and ether proto 0x8947)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.21,src_port=4041,dst_port=9091)" + +# PC5 + UU/Raw +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470519,longitude=-455595023,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates_iut)/LTE(mac_src=8c554ac1eee1,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.21,dst_port=4041,src_port=9091)" +# PC5 + Uu/MQTT +# Raw UDP +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=udp,debug=1,server=192.168.1.39,port=1883)" +# MQTT over TCP +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=192.168.1.39,port=1883)" # CAM UpperTester port based on UDP -#system.utPort.params := "UT_CAM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12346)" +system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.1.21,dst_port=12345,src_port=12346)" #system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.146.26)" -system.utPort.params := "UT_CAM/UDP(dst_ip=10.8.0.6)" +#system.utPort.params := "UT_CAM/UDP(dst_ip=172.16.35.1)" [EXECUTE] +#ItsCam_TestControl.control + +# Check that protocolVersion is set to 2 and messageID is set to 2 ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 +# Check that LF container is included in 1st CAM since CA basic service activation #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 +# Check that LF container is included if time elapsed since the generation of the last CAM with the low frequency container generation is equal or larger than 500 ms #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 +# Check that specialVehicle container is included in 1st CAM since CA basic service activation #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 +# Check that specialVehicle container is included if time elapsed since the generation of the last CAM with the special vehicle container generation is equal or larger than 500 ms #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_05 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_01 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_02 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_03 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_04 @@ -152,8 +164,20 @@ ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_06 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_07 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_08 -#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 +# Check that content of received CAM is transmitted to applications and other facilities #ItsCam_TestCases.TC_CAM_MSP_BV_01 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_01 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_02 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_03 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_01 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_03 [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/etc/AtsCAM/AtsCAM_Savary.cfg_ b/etc/AtsCAM/AtsCAM_Savary.cfg_ index 225c7bb..fa7288f 100644 --- a/etc/AtsCAM/AtsCAM_Savary.cfg_ +++ b/etc/AtsCAM/AtsCAM_Savary.cfg_ @@ -99,12 +99,21 @@ system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=s system.utPort.params := "UT_CAM/DEBUG" [EXECUTE] +#ItsCam_TestControl.control + +# Check that protocolVersion is set to 2 and messageID is set to 2 ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 +# Check that LF container is included in 1st CAM since CA basic service activation #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 +# Check that LF container is included if time elapsed since the generation of the last CAM with the low frequency container generation is equal or larger than 500 ms #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 +# Check that specialVehicle container is included in 1st CAM since CA basic service activation #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 +# Check that specialVehicle container is included if time elapsed since the generation of the last CAM with the special vehicle container generation is equal or larger than 500 ms #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_05 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_01 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_02 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_03 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_04 @@ -146,8 +155,21 @@ ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_06 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_07 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_08 -#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 +# Check that content of received CAM is transmitted to applications and other facilities #ItsCam_TestCases.TC_CAM_MSP_BV_01 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_01 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_02 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_03 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_01 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_03 + [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/etc/AtsCAM/AtsCAM_Simulator.cfg_ b/etc/AtsCAM/AtsCAM_Simulator.cfg_ index 75f66ca..5870d5a 100644 --- a/etc/AtsCAM/AtsCAM_Simulator.cfg_ +++ b/etc/AtsCAM/AtsCAM_Simulator.cfg_ @@ -88,32 +88,41 @@ LogEventTypes:= Yes # save_mode : Set to 1 to save sent packet, 0 otherwise # Cygwin -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlo1,filter=and ether proto 0x8947)" # Linux over UDP -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.43,src_port=4041,dst_port=9091)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.21,src_port=4041,dst_port=9091)" # PC5 + UU/Raw -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=515340240,longitude=139274330,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates_iut)/LTE(mac_src=8c554ac1eee1,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.43,dst_port=4041,src_port=9091)" +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470519,longitude=-455595023,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates_iut)/LTE(mac_src=8c554ac1eee1,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.21,dst_port=4041,src_port=9091)" # PC5 + Uu/MQTT # Raw UDP -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=udp,debug=1,server=192.168.1.39,port=1883)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=udp,debug=1,server=192.168.1.39,port=1883)" # MQTT over TCP -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=192.168.1.39,port=1883)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=192.168.1.39,port=1883)" # CAM UpperTester port based on UDP -system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" +system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.1.21,dst_port=12345,src_port=12346)" #system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.146.26)" #system.utPort.params := "UT_CAM/UDP(dst_ip=172.16.35.1)" [EXECUTE] -#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 -ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 +#ItsCam_TestControl.control + +# Check that protocolVersion is set to 2 and messageID is set to 2 +ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 +# Check that LF container is included in 1st CAM since CA basic service activation +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 +# Check that LF container is included if time elapsed since the generation of the last CAM with the low frequency container generation is equal or larger than 500 ms #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 +# Check that specialVehicle container is included in 1st CAM since CA basic service activation #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 +# Check that specialVehicle container is included if time elapsed since the generation of the last CAM with the special vehicle container generation is equal or larger than 500 ms #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_05 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_01 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_02 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_03 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_04 @@ -155,12 +164,19 @@ ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_06 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_07 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_08 +# Check that content of received CAM is transmitted to applications and other facilities #ItsCam_TestCases.TC_CAM_MSP_BV_01 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers #ItsCam_TestCases.TC_CAM_MSP_SSP_BV_01 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers #ItsCam_TestCases.TC_CAM_MSP_SSP_BV_02 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers #ItsCam_TestCases.TC_CAM_MSP_SSP_BV_03 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate #ItsCam_TestCases.TC_CAM_MSD_SSP_BO_01 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate #ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate #ItsCam_TestCases.TC_CAM_MSD_SSP_BO_03 [MAIN_CONTROLLER] diff --git a/etc/AtsCAM/AtsCAM_Yogoko.cf_ b/etc/AtsCAM/AtsCAM_Yogoko.cf_ index 57b169f..e107c34 100644 --- a/etc/AtsCAM/AtsCAM_Yogoko.cf_ +++ b/etc/AtsCAM/AtsCAM_Yogoko.cf_ @@ -105,12 +105,21 @@ system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=s system.utPort.params := "UT_CAM/UDP(dst_ip=10.8.0.6)" [EXECUTE] +#ItsCam_TestControl.control + +# Check that protocolVersion is set to 2 and messageID is set to 2 ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 +# Check that LF container is included in 1st CAM since CA basic service activation #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 +# Check that LF container is included if time elapsed since the generation of the last CAM with the low frequency container generation is equal or larger than 500 ms #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 +# Check that specialVehicle container is included in 1st CAM since CA basic service activation #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 +# Check that specialVehicle container is included if time elapsed since the generation of the last CAM with the special vehicle container generation is equal or larger than 500 ms #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_05 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_01 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_02 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_03 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_04 @@ -152,8 +161,20 @@ ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_06 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_07 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_08 -#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 +# Check that content of received CAM is transmitted to applications and other facilities #ItsCam_TestCases.TC_CAM_MSP_BV_01 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_01 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_02 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_03 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_01 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_03 [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/etc/AtsCAM/AtsCAM_pcap.cfg_ b/etc/AtsCAM/AtsCAM_pcap.cfg_ index 0affccf..9e6945d 100644 --- a/etc/AtsCAM/AtsCAM_pcap.cfg_ +++ b/etc/AtsCAM/AtsCAM_pcap.cfg_ @@ -116,8 +116,77 @@ system.utPort.params := "UT_CAM(loopback=1)" #system.utPort.params := "UT_CAM(loopback=0)/UDP(dst_ip=172.28.1.208,dst_port=12345,src_ip=172.28.0.123,src_port=12345)/ETH(mac_src=1002b522d4f4,mac_dst=08002794290a,eth_type=0800)/PCAP(mac_src=1002b522d4f4,nic=A9142677-63D9-4DAC-93C9-F80C75DABE66,filter=and udp port 12345)" [EXECUTE] +#ItsCam_TestControl.control + +# Check that protocolVersion is set to 2 and messageID is set to 2 ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 -ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 +# Check that LF container is included in 1st CAM since CA basic service activation +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 +# Check that LF container is included if time elapsed since the generation of the last CAM with the low frequency container generation is equal or larger than 500 ms +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 +# Check that specialVehicle container is included in 1st CAM since CA basic service activation +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 +# Check that specialVehicle container is included if time elapsed since the generation of the last CAM with the special vehicle container generation is equal or larger than 500 ms +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_05 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_01 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_02 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_03 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_04 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_05 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_06 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_07 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_08 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_09 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_10 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_11 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_12 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_13 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_14 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_15 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_16 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_17 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_18 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_19 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_20 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_21 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_22 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_23 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_24 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_25 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_26 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_27 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_28 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_29 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_30 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_31 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_32 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_33 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_34 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_35 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_02 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_03 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_04 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_05 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_06 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_07 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_08 +# Check that content of received CAM is transmitted to applications and other facilities +#ItsCam_TestCases.TC_CAM_MSP_BV_01 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_01 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_02 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_03 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_01 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_03 + [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/etc/AtsCPS/AtsCPS_Simulator.cfg_ b/etc/AtsCPS/AtsCPS_Simulator.cfg_ index ec92ef9..15b208d 100644 --- a/etc/AtsCPS/AtsCPS_Simulator.cfg_ +++ b/etc/AtsCPS/AtsCPS_Simulator.cfg_ @@ -87,19 +87,19 @@ LogEventTypes:= Yes # save_mode : Set to 1 to save sent packet, 0 otherwise # Cygwin -#system.cpmPort.params := "CPS(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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)" +#system.cpmPort.params := "CPS(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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.cpmPort.params := "CPS(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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.cpmPort.params := "CPS(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947)" # Linux over UDP -#system.cpmPort.params := "CPS(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.43,src_port=4041,dst_port=9091)" +#system.cpmPort.params := "CPS(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.43,src_port=4041,dst_port=9091)" # PC5 + UU/Raw -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=515340240,longitude=139274330,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates_iut)/LTE(mac_src=8c554ac1eee1,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.43,dst_port=4041,src_port=9091)" +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470519,longitude=-455595023,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates_iut)/LTE(mac_src=8c554ac1eee1,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.43,dst_port=4041,src_port=9091)" # PC5 + Uu/MQTT # Raw UDP -#system.cpmPort.params := "CPS(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=udp,debug=1,server=192.168.1.39,port=1883)" +#system.cpmPort.params := "CPS(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=udp,debug=1,server=192.168.1.39,port=1883)" # MQTT over TCP -#system.cpmPort.params := "CPS(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=192.168.1.39,port=1883)" +#system.cpmPort.params := "CPS(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=192.168.1.39,port=1883)" # CPS UpperTester port based on UDP system.utPort.params := "UT_CPS/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" diff --git a/etc/AtsDENM/AtsDENM.cfg b/etc/AtsDENM/AtsDENM.cfg index 6cfabd6..15d4f34 100644 --- a/etc/AtsDENM/AtsDENM.cfg +++ b/etc/AtsDENM/AtsDENM.cfg @@ -85,7 +85,7 @@ LogEventTypes:= Yes # time_offset : Time offset, used to skip packets with time offset < time_offset # save_mode : Set to 1 to save sent packet, 0 otherwise -system.denmPort.params := "DENM(next_header=btpB,header_type=tsb)/BTP(dst_port=2002)/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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.denmPort.params := "DENM(next_header=btpB,header_type=tsb)/BTP(dst_port=2002)/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947)" # DENM UpperTester port based on UDP system.utPort.params := "UT_DENM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" diff --git a/etc/AtsGeoNetworking/AtsGeoNetworking.cfg b/etc/AtsGeoNetworking/AtsGeoNetworking.cfg index 5b1c158..86538d7 100644 --- a/etc/AtsGeoNetworking/AtsGeoNetworking.cfg +++ b/etc/AtsGeoNetworking/AtsGeoNetworking.cfg @@ -95,13 +95,13 @@ LogEventTypes:= Yes # save_mode : Set to 1 to save sent packet, 0 otherwise # Single GeoNetworking component port -mtc.geoNetworkingPort.params := "GN(ll_address=00000000000B,latitude=515340240,longitude=139274330)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlp0s20f3,filter=and ether proto 0x8947)" +mtc.geoNetworkingPort.params := "GN(ll_address=00000000000B,latitude=367470519,longitude=-455595023)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlp0s20f3,filter=and ether proto 0x8947)" # Multiple GeoNetworking component portN -NodeA.geoNetworkingPort.params := "GN(ll_address=00000000000A,latitude=515340240,longitude=139274330)/ETH(mac_src=080027500f9a)/PCAP(mac_src=080027500f9a,nic=wlp0s20f3,filter=and ether proto 0x8947)" -NodeB.geoNetworkingPort.params := "GN(ll_address=00000000000B,latitude=515340240,longitude=139274330)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlp0s20f3,filter=and ether proto 0x8947)" -NodeC.geoNetworkingPort.params := "GN(ll_address=00000000000C,latitude=515340240,longitude=139274330)/ETH(mac_src=080027500f9c)/PCAP(mac_src=080027500f9c,nic=wlp0s20f3,filter=and ether proto 0x8947)" -NodeD.geoNetworkingPort.params := "GN(ll_address=00000000000D,latitude=515340240,longitude=139274330)/ETH(mac_src=080027500f9d)/PCAP(mac_src=080027500f9d,nic=wlp0s20f3,filter=and ether proto 0x8947 and not ether src 8c554ac1eee1)" +NodeA.geoNetworkingPort.params := "GN(ll_address=00000000000A,latitude=367470519,longitude=-455595023)/ETH(mac_src=080027500f9a)/PCAP(mac_src=080027500f9a,nic=wlp0s20f3,filter=and ether proto 0x8947)" +NodeB.geoNetworkingPort.params := "GN(ll_address=00000000000B,latitude=367470519,longitude=-455595023)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlp0s20f3,filter=and ether proto 0x8947)" +NodeC.geoNetworkingPort.params := "GN(ll_address=00000000000C,latitude=367470519,longitude=-455595023)/ETH(mac_src=080027500f9c)/PCAP(mac_src=080027500f9c,nic=wlp0s20f3,filter=and ether proto 0x8947)" +NodeD.geoNetworkingPort.params := "GN(ll_address=00000000000D,latitude=367470519,longitude=-455595023)/ETH(mac_src=080027500f9d)/PCAP(mac_src=080027500f9d,nic=wlp0s20f3,filter=and ether proto 0x8947 and not ether src 8c554ac1eee1)" # UpperTester port based on UDP #system.utPort.params := "UT_GN/UDP(dst_ip=192.168.2.2)" diff --git a/etc/AtsPki/AtsPki_Simu.cfg_ b/etc/AtsPki/AtsPki_Simu.cfg_ index e32d274..8ed3d3c 100644 --- a/etc/AtsPki/AtsPki_Simu.cfg_ +++ b/etc/AtsPki/AtsPki_Simu.cfg_ @@ -183,7 +183,7 @@ LogEventTypes:= Yes # Single GeoNetworking component port # its_aid = 36 CAM # its_aid = 37 DENM -system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=1,its_aid=36)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlo1,filter=and ether proto 0x8947)" +system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=1,its_aid=36)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlo1,filter=and ether proto 0x8947)" # Single HTTP component port system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.21)" diff --git a/etc/AtsVRU/AtsVRU_Simulator.cfg_ b/etc/AtsVRU/AtsVRU_Simulator.cfg_ index c3dd89a..2e496a2 100644 --- a/etc/AtsVRU/AtsVRU_Simulator.cfg_ +++ b/etc/AtsVRU/AtsVRU_Simulator.cfg_ @@ -87,19 +87,19 @@ LogEventTypes:= Yes # save_mode : Set to 1 to save sent packet, 0 otherwise # Cygwin -#system.vruPort.params := "VRU(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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)" +#system.vruPort.params := "VRU(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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.vruPort.params := "VRU(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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.vruPort.params := "VRU(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947)" # Linux over UDP -#system.vruPort.params := "VRU(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.43,src_port=4041,dst_port=9091)" +#system.vruPort.params := "VRU(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.43,src_port=4041,dst_port=9091)" # PC5 + UU/Raw -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=515340240,longitude=139274330,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates_iut)/LTE(mac_src=8c554ac1eee1,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.43,dst_port=4041,src_port=9091)" +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470519,longitude=-455595023,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates_iut)/LTE(mac_src=8c554ac1eee1,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.43,dst_port=4041,src_port=9091)" # PC5 + Uu/MQTT # Raw UDP -#system.vruPort.params := "VRU(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=udp,debug=1,server=192.168.1.39,port=1883)" +#system.vruPort.params := "VRU(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=udp,debug=1,server=192.168.1.39,port=1883)" # MQTT over TCP -#system.vruPort.params := "VRU(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=515340240,longitude=139274330,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=192.168.1.39,port=1883)" +#system.vruPort.params := "VRU(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=192.168.1.39,port=1883)" # VRU UpperTester port based on UDP system.utPort.params := "UT_VRU/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index 3099a2d..aee17a6 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit 3099a2ddaf47a2731e9bd3accaf9223fa57ddd4d +Subproject commit aee17a6df6cfff5ba8cc2aecad667756ff77b8d7 diff --git a/ttcn/AtsPki b/ttcn/AtsPki index 67550ac..fa5ad23 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit 67550aca15f062eebac99922714720f470b34f4b +Subproject commit fa5ad235351c7f305c68e1cd62b511d74aca45dc -- GitLab From ea86463b908ebe7a85e25e458e0d8d9f4a57f045 Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 27 Jun 2024 14:02:04 +0200 Subject: [PATCH 148/178] Bug fixed in ccsrc/Ports/LibIts_ports/UpperTesterPort.hh --- ccsrc/Ports/LibIts_ports/UpperTesterPort.hh | 4 ++++ titan-test-system-framework | 2 +- ttcn/AtsBTP | 2 +- ttcn/AtsCAM | 2 +- ttcn/AtsCPS | 2 +- ttcn/AtsDENM | 2 +- ttcn/AtsGeoNetworking | 2 +- ttcn/AtsIS | 2 +- ttcn/AtsMBR | 2 +- ttcn/AtsSecurity | 2 +- ttcn/AtsVRU | 2 +- ttcn/LibIts | 2 +- 12 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh b/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh index 2e454cc..240b512 100644 --- a/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh +++ b/ccsrc/Ports/LibIts_ports/UpperTesterPort.hh @@ -82,6 +82,8 @@ #include "MapemSpatem_ports/UpperTesterPort_MapemSpatem.hh" #include "Rtcmem_ports/UpperTesterPort_Rtcmem.hh" #include "SremSsem_ports/UpperTesterPort_SremSsem.hh" +#include "CPS_ports/UpperTesterPort_CPS.hh" +#include "VRU_ports/UpperTesterPort_VRU.hh" #endif #else //_NO_SOFTLINKS_ @@ -150,6 +152,8 @@ #include "UpperTesterPort_MapemSpatem.hh" #include "UpperTesterPort_Rtcmem.hh" #include "UpperTesterPort_SremSsem.hh" +#include "UpperTesterPort_CPS.hh" +#include "UpperTesterPort_VRU.hh" #endif #ifdef AtsCPS diff --git a/titan-test-system-framework b/titan-test-system-framework index c579f7c..9d95325 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit c579f7c7175b34426e8392e1edd3885c4b9cd185 +Subproject commit 9d95325ebf75eacf7f015da564c2576afcfb6d44 diff --git a/ttcn/AtsBTP b/ttcn/AtsBTP index 10d783e..3576386 160000 --- a/ttcn/AtsBTP +++ b/ttcn/AtsBTP @@ -1 +1 @@ -Subproject commit 10d783e6916df22cab65c67a68982be6888d19e5 +Subproject commit 3576386312f9dff1afcccc8f96247876ab9a0865 diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 1615d38..2cd9d00 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 1615d38e830f8b33d3abcbec83f8c038ac0f65c4 +Subproject commit 2cd9d00d66d4701c22c642ea9ac2777b0e13c400 diff --git a/ttcn/AtsCPS b/ttcn/AtsCPS index f905e19..40fe6ea 160000 --- a/ttcn/AtsCPS +++ b/ttcn/AtsCPS @@ -1 +1 @@ -Subproject commit f905e193fd7990dae8bb679b451c510774ffe0c1 +Subproject commit 40fe6ea23a51ecdb019fbe94a216d025f5198a5b diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index aee17a6..f651103 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit aee17a6df6cfff5ba8cc2aecad667756ff77b8d7 +Subproject commit f651103b1769ae3c9548274e222c0da474825eaa diff --git a/ttcn/AtsGeoNetworking b/ttcn/AtsGeoNetworking index d3e6b26..e4bcaa7 160000 --- a/ttcn/AtsGeoNetworking +++ b/ttcn/AtsGeoNetworking @@ -1 +1 @@ -Subproject commit d3e6b2662c996a8971256c926385d1ca1f9eb0a0 +Subproject commit e4bcaa7d6cfd9f15372f2888c714e838cc77a0cd diff --git a/ttcn/AtsIS b/ttcn/AtsIS index 2ff738e..9779a56 160000 --- a/ttcn/AtsIS +++ b/ttcn/AtsIS @@ -1 +1 @@ -Subproject commit 2ff738e8663c455f89efbd8c43b417ca00460c61 +Subproject commit 9779a569f65e0005e1f2250d105d3e6f34ad3eb1 diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index 5e5e5a7..e8cc223 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit 5e5e5a7ea2a98c1c266e98b65fd0328c479c384e +Subproject commit e8cc22303304975e6c3b8361f2e2208dd3dcea64 diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 408505b..a549039 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 408505b87182ffc12710caba7c77e822de60b002 +Subproject commit a5490397adf1352a9df09233814e360568a2830c diff --git a/ttcn/AtsVRU b/ttcn/AtsVRU index 9c9a94a..04534f9 160000 --- a/ttcn/AtsVRU +++ b/ttcn/AtsVRU @@ -1 +1 @@ -Subproject commit 9c9a94a354bdf000fbd4e81608c54d5f3a00b414 +Subproject commit 04534f9e2b43ff46766307669bebb146d8152178 diff --git a/ttcn/LibIts b/ttcn/LibIts index 64e9a23..e19730e 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit 64e9a233028508c57cafb85ecbc5d26ff44da1ee +Subproject commit e19730e58b6f639fc22bd0b26287b40281c0c33d -- GitLab From 434c3025d5e0985e51fb7528dd42eb7780eacd60 Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 27 Jun 2024 14:02:04 +0200 Subject: [PATCH 149/178] Bug fixed in ccsrc/Ports/LibIts_ports/UpperTesterPort.hh --- ccsrc/EncDec/module.mk | 2 ++ ccsrc/Protocols/UpperTester/module.mk | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ccsrc/EncDec/module.mk b/ccsrc/EncDec/module.mk index f1f2013..0fee814 100644 --- a/ccsrc/EncDec/module.mk +++ b/ccsrc/EncDec/module.mk @@ -28,6 +28,8 @@ sources += \ LibItsMapemSpatem_Encdec.cc \ LibItsSremSsem_Encdec.cc \ LibItsRtcmem_Encdec.cc \ + LibItsCps_Encdec.cc \ + LibItsVru_Encdec.cc \ LibItsIvim_Encdec.cc \ LibItsPki_Encdec.cc \ LibItsMbr_Encdec.cc diff --git a/ccsrc/Protocols/UpperTester/module.mk b/ccsrc/Protocols/UpperTester/module.mk index 514e08d..f08af4d 100644 --- a/ccsrc/Protocols/UpperTester/module.mk +++ b/ccsrc/Protocols/UpperTester/module.mk @@ -48,6 +48,8 @@ sources += uppertester_cam_codec.cc uppertester_cam_layer.cc \ UpperTesterSremSsemCodec.cc UpperTesterSremSsemLayer.cc \ uppertester_mapem_spatem_codec.cc uppertester_mapem_spatem_layer.cc \ UpperTesterRtcmemCodec.cc UpperTesterRtcmemLayer.cc \ + uppertester_cps_codec.cc uppertester_cps_layer.cc \ + uppertester_vru_codec.cc uppertester_vru_layer.cc \ uppertester_pki_codec.cc uppertester_pki_layer.cc \ uppertester_mbr_codec.cc uppertester_mbr_layer.cc \ -- GitLab From adec5b132627f2c15df65ff215fbc18c09b175ea Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 27 Jun 2024 14:02:04 +0200 Subject: [PATCH 150/178] Bug fixed in ccsrc/Ports/LibIts_ports/UpperTesterPort.hh --- ccsrc/EncDec/LibItsCps_Encdec.cc | 14 ++-- ccsrc/EncDec/LibItsVru_Encdec.cc | 14 ++-- .../CPS_ports/UpperTesterPort_CPS.cc | 10 +-- .../CPS_ports/UpperTesterPort_CPS.hh | 2 +- .../ConfigRsuSimulatorLayer.cc | 64 +++++++++++++++++++ .../ConfigRsuSimulatorLayer.hh | 6 ++ .../ConfigRsuSimulatorPort.cc | 60 +++++++++++++++++ .../ConfigRsuSimulatorPort.hh | 6 ++ .../VRU_ports/UpperTesterPort_VRU.cc | 10 +-- .../VRU_ports/UpperTesterPort_VRU.hh | 2 +- .../UpperTester/uppertester_cps_codec.cc | 24 +++---- .../UpperTester/uppertester_cps_codec.hh | 18 +++--- .../UpperTester/uppertester_cps_layer.cc | 4 +- .../UpperTester/uppertester_cps_layer.hh | 4 +- .../UpperTester/uppertester_vru_codec.cc | 22 +++---- .../UpperTester/uppertester_vru_codec.hh | 18 +++--- .../UpperTester/uppertester_vru_layer.cc | 4 +- .../UpperTester/uppertester_vru_layer.hh | 4 +- 18 files changed, 211 insertions(+), 75 deletions(-) diff --git a/ccsrc/EncDec/LibItsCps_Encdec.cc b/ccsrc/EncDec/LibItsCps_Encdec.cc index 99d8689..ebaaa75 100644 --- a/ccsrc/EncDec/LibItsCps_Encdec.cc +++ b/ccsrc/EncDec/LibItsCps_Encdec.cc @@ -195,8 +195,8 @@ namespace LibItsCps__EncdecDeclarations { return 0; } - BITSTRING fx__enc__UtCpsInitialize(const LibItsCps__TypesAndValues::UtCpsInitialize &p_utCpsInitialize) { - loggers::get_instance().log_msg(">>> fx__enc__UtCpsInitialize: ", p_utCpsInitialize); + BITSTRING fx__enc__UtCpmInitialize(const LibItsCps__TypesAndValues::UtCpmInitialize &p_utCpsInitialize) { + loggers::get_instance().log_msg(">>> fx__enc__UtCpmInitialize: ", p_utCpsInitialize); uppertester_cps_codec codec; OCTETSTRING os; @@ -205,21 +205,21 @@ namespace LibItsCps__EncdecDeclarations { } /**************************************************** - * @desc External function to decode a UtCpsEventInd type + * @desc External function to decode a UtCpmEventInd type * @param value to encode * @return encoded value ****************************************************/ - INTEGER fx__dec__UtCpsEventInd(BITSTRING &b, LibItsCps__TypesAndValues::UtCpsEventInd &p) { - loggers::get_instance().log(">>> fx__dec__UtCpsEventInd"); + INTEGER fx__dec__UtCpmEventInd(BITSTRING &b, LibItsCps__TypesAndValues::UtCpmEventInd &p) { + loggers::get_instance().log(">>> fx__dec__UtCpmEventInd"); uppertester_cps_codec codec; OCTETSTRING is = bit2oct(b); std::unique_ptr ptr = codec.decode(is); if (ptr == nullptr) { - loggers::get_instance().warning("fx__dec__UtCpsEventInd: -1 result code was returned"); + loggers::get_instance().warning("fx__dec__UtCpmEventInd: -1 result code was returned"); return -1; } - p = static_cast(*ptr); + p = static_cast(*ptr); return 0; } diff --git a/ccsrc/EncDec/LibItsVru_Encdec.cc b/ccsrc/EncDec/LibItsVru_Encdec.cc index 4bb1d85..e907b12 100644 --- a/ccsrc/EncDec/LibItsVru_Encdec.cc +++ b/ccsrc/EncDec/LibItsVru_Encdec.cc @@ -195,8 +195,8 @@ namespace LibItsVru__EncdecDeclarations { return 0; } - BITSTRING fx__enc__UtVruInitialize(const LibItsVru__TypesAndValues::UtVruInitialize &p_utVruInitialize) { - loggers::get_instance().log_msg(">>> fx__enc__UtVruInitialize: ", p_utVruInitialize); + BITSTRING fx__enc__UtVamInitialize(const LibItsVru__TypesAndValues::UtVamInitialize &p_utVruInitialize) { + loggers::get_instance().log_msg(">>> fx__enc__UtVamInitialize: ", p_utVruInitialize); uppertester_vru_codec codec; OCTETSTRING os; @@ -205,21 +205,21 @@ namespace LibItsVru__EncdecDeclarations { } /**************************************************** - * @desc External function to decode a UtVruEventInd type + * @desc External function to decode a UtVamEventInd type * @param value to encode * @return encoded value ****************************************************/ - INTEGER fx__dec__UtVruEventInd(BITSTRING &b, LibItsVru__TypesAndValues::UtVruEventInd &p) { - loggers::get_instance().log(">>> fx__dec__UtVruEventInd"); + INTEGER fx__dec__UtVamEventInd(BITSTRING &b, LibItsVru__TypesAndValues::UtVamEventInd &p) { + loggers::get_instance().log(">>> fx__dec__UtVamEventInd"); uppertester_vru_codec codec; OCTETSTRING is = bit2oct(b); std::unique_ptr ptr = codec.decode(is); if (ptr == nullptr) { - loggers::get_instance().warning("fx__dec__UtVruEventInd: -1 result code was returned"); + loggers::get_instance().warning("fx__dec__UtVamEventInd: -1 result code was returned"); return -1; } - p = static_cast(*ptr); + p = static_cast(*ptr); return 0; } diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.cc b/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.cc index 830ad4b..698a824 100644 --- a/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.cc +++ b/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.cc @@ -62,7 +62,7 @@ namespace LibItsCps__TestSystem { void UpperTesterPort::user_stop() {} - void UpperTesterPort::outgoing_send(const LibItsCps__TypesAndValues::UtCpsInitialize &send_par) { + void UpperTesterPort::outgoing_send(const LibItsCps__TypesAndValues::UtCpmInitialize &send_par) { loggers::get_instance().log_msg(">>> UppertesterPort_Cps::outgoing_send: ", send_par); float duration; @@ -78,10 +78,10 @@ namespace LibItsCps__TestSystem { return; } - if (std::string(p_ind.get_descriptor()->name).compare("@LibItsCps_TypesAndValues.UtCpsResults") == 0) { // TODO To be refined - incoming_message(static_cast(p_ind)); - } else if (std::string(p_ind.get_descriptor()->name).compare("@LibItsCps_TypesAndValues.UtCpsEventInd") == 0) { - incoming_message(static_cast(p_ind)); + if (std::string(p_ind.get_descriptor()->name).compare("@LibItsCps_TypesAndValues.UtCpmResults") == 0) { // TODO To be refined + incoming_message(static_cast(p_ind)); + } else if (std::string(p_ind.get_descriptor()->name).compare("@LibItsCps_TypesAndValues.UtCpmEventInd") == 0) { + incoming_message(static_cast(p_ind)); } else { loggers::get_instance().warning("UpperTesterPort_Cps::receive_msg: Message not processed: %s", p_ind.get_descriptor()->name); } diff --git a/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.hh b/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.hh index 3d1a42c..c26276a 100644 --- a/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.hh +++ b/ccsrc/Ports/LibIts_ports/CPS_ports/UpperTesterPort_CPS.hh @@ -36,7 +36,7 @@ namespace LibItsCps__TestSystem { void user_start(); void user_stop(); - void outgoing_send(const LibItsCps__TypesAndValues::UtCpsInitialize &send_par); + void outgoing_send(const LibItsCps__TypesAndValues::UtCpmInitialize &send_par); }; } // namespace LibItsCps__TestSystem diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc index dde8fcd..1a993ea 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc @@ -15,6 +15,8 @@ #include "uppertester_mbr_codec.hh" #include "uppertester_ivim_codec.hh" #include "uppertester_mapem_spatem_codec.hh" +#include "uppertester_cps_codec.hh" +#include "uppertester_vru_codec.hh" #include "LibItsCam_EncdecDeclarations.hh" #include "LibItsDenm_EncdecDeclarations.hh" @@ -22,6 +24,8 @@ #include "LibItsMapemSpatem_EncdecDeclarations.hh" #include "LibItsRtcmem_EncdecDeclarations.hh" #include "LibItsSremSsem_EncdecDeclarations.hh" +#include "LibItsCps_EncdecDeclarations.hh" +#include "LibItsVru_EncdecDeclarations.hh" ConfigRsuSimulatorLayer::ConfigRsuSimulatorLayer(const std::string &p_type, const std::string ¶m) : t_layer(p_type), _params(), _codec(), _codec_cam() { @@ -403,6 +407,66 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcm send_data(data, _params); } +void ConfigRsuSimulatorLayer::sendMsg(const LibItsCps__TypesAndValues::UtCpmResults &send_par, params ¶ms) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); + + TTCN_Buffer encoding_buffer; + if (send_par.ischosen(LibItsCps__TypesAndValues::UtCpmResults::ALT_utCpmInitializeResult)) { + encoding_buffer.put_c(static_cast(uppertester_cps_codec::c_utCpmInitializeResult)); + encoding_buffer.put_c((unsigned char)static_cast(send_par.utCpmInitializeResult())); + } else { + loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtCpmResults variant"); + return; + } + + OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data()); + send_data(os, params); +} + +void ConfigRsuSimulatorLayer::sendMsg(const LibItsCps__TypesAndValues::UtCpmEventInd &send_par, params ¶ms) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); + + TTCN_Buffer encoding_buffer; + encoding_buffer.put_c(static_cast(uppertester_cps_codec::c_utCpmEventInd)); + BITSTRING bs = LibItsCps__EncdecDeclarations::fx__enc__CPM(send_par.cpmMsg()); + OCTETSTRING os = bit2oct(bs); + OCTETSTRING l = int2oct(os.lengthof(), 2); + encoding_buffer.put_s(l.lengthof(), static_cast(l)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); + OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); + send_data(data, _params); +} + +void ConfigRsuSimulatorLayer::sendMsg(const LibItsVru__TypesAndValues::UtVamResults &send_par, params ¶ms) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); + + TTCN_Buffer encoding_buffer; + if (send_par.ischosen(LibItsVru__TypesAndValues::UtVamResults::ALT_utVamInitializeResult)) { + encoding_buffer.put_c(static_cast(uppertester_vru_codec::c_utVamInitializeResult)); + encoding_buffer.put_c((unsigned char)static_cast(send_par.utVamInitializeResult())); + } else { + loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtVamResults variant"); + return; + } + + OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data()); + send_data(os, params); +} + +void ConfigRsuSimulatorLayer::sendMsg(const LibItsVru__TypesAndValues::UtVamEventInd &send_par, params ¶ms) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); + + TTCN_Buffer encoding_buffer; + encoding_buffer.put_c(static_cast(uppertester_vru_codec::c_utVamEventInd)); + BITSTRING bs = LibItsVru__EncdecDeclarations::fx__enc__VAM(send_par.vamMsg()); + OCTETSTRING os = bit2oct(bs); + OCTETSTRING l = int2oct(os.lengthof(), 2); + encoding_buffer.put_s(l.lengthof(), static_cast(l)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); + OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); + send_data(data, _params); +} + void ConfigRsuSimulatorLayer::send_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::send_data: ", data); diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh index 22fa798..2d9e2ae 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh @@ -19,6 +19,8 @@ #include "uppertester_geonetworking_codec.hh" #include "uppertester_ivim_codec.hh" #include "uppertester_mapem_spatem_codec.hh" +#include "uppertester_cps_codec.hh" +#include "uppertester_vru_codec.hh" #include "uppertester_pki_codec.hh" #include "uppertester_mbr_codec.hh" @@ -62,6 +64,10 @@ public: void sendMsg(const LibItsSremSsem__TypesAndValues::UtSsemEventInd &send_par, params ¶ms); void sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemResults &send_par, params ¶ms); void sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemEventInd &send_par, params ¶ms); + void sendMsg(const LibItsCps__TypesAndValues::UtCpmResults &send_par, params ¶ms); + void sendMsg(const LibItsCps__TypesAndValues::UtCpmEventInd &send_par, params ¶ms); + void sendMsg(const LibItsVru__TypesAndValues::UtVamResults &send_par, params ¶ms); + void sendMsg(const LibItsVru__TypesAndValues::UtVamEventInd &send_par, params ¶ms); virtual void send_data(OCTETSTRING &data, params ¶ms); virtual void receive_data(OCTETSTRING &data, params ¶ms); diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.cc b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.cc index bb6972a..82aeb1a 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.cc +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.cc @@ -261,6 +261,46 @@ namespace ItsRSUsSimulator__TestSystem { loggers::get_instance().set_stop_time(_time_key, duration); } + + + + + void ConfigRsuSimulatorPort::outgoing_send(const LibItsCps__TypesAndValues::UtCpmResults &send_par) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::outgoing_send: payload=", send_par); + + float duration; + loggers::get_instance().set_start_time(_time_key); + static_cast(_layer)->sendMsg(send_par, _layer_params); + loggers::get_instance().set_stop_time(_time_key, duration); + } + + void ConfigRsuSimulatorPort::outgoing_send(const LibItsCps__TypesAndValues::UtCpmEventInd &send_par) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::outgoing_send: payload=", send_par); + + float duration; + loggers::get_instance().set_start_time(_time_key); + static_cast(_layer)->sendMsg(send_par, _layer_params); + loggers::get_instance().set_stop_time(_time_key, duration); + } + + void ConfigRsuSimulatorPort::outgoing_send(const LibItsVru__TypesAndValues::UtVamResults &send_par) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::outgoing_send: payload=", send_par); + + float duration; + loggers::get_instance().set_start_time(_time_key); + static_cast(_layer)->sendMsg(send_par, _layer_params); + loggers::get_instance().set_stop_time(_time_key, duration); + } + + void ConfigRsuSimulatorPort::outgoing_send(const LibItsVru__TypesAndValues::UtVamEventInd &send_par) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::outgoing_send: payload=", send_par); + + float duration; + loggers::get_instance().set_start_time(_time_key); + static_cast(_layer)->sendMsg(send_par, _layer_params); + loggers::get_instance().set_stop_time(_time_key, duration); + } + void ConfigRsuSimulatorPort::receiveMsg(const BOOLEAN &p_ind, const params &p_params) { loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind); // Sanity check @@ -531,4 +571,24 @@ namespace ItsRSUsSimulator__TestSystem { incoming_message(p_ind); } + void ConfigRsuSimulatorPort::receiveMsg(const LibItsCps__TypesAndValues::UtCpmInitialize &p_ind, const params &p_params) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind); + // Sanity check + if (!p_ind.is_bound()) { + return; + } + + incoming_message(p_ind); + } + + void ConfigRsuSimulatorPort::receiveMsg(const LibItsVru__TypesAndValues::UtVamInitialize &p_ind, const params &p_params) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind); + // Sanity check + if (!p_ind.is_bound()) { + return; + } + + incoming_message(p_ind); + } + } // namespace ItsRSUsSimulator__TestSystem diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.hh b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.hh index 30801d7..ff6ef83 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.hh +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.hh @@ -45,6 +45,8 @@ namespace ItsRSUsSimulator__TestSystem { void receiveMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemTrigger &p_ind, const params &p_params); void receiveMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemUpdate &p_ind, const params &p_params); void receiveMsg(const LibItsRtcmem__TypesAndValues::UtRtcmemTermination &p_ind, const params &p_params); + void receiveMsg(const LibItsCps__TypesAndValues::UtCpmInitialize &p_ind, const params &p_params); + void receiveMsg(const LibItsVru__TypesAndValues::UtVamInitialize &p_ind, const params &p_params); /*void send(const CfInitialize& send_par, const COMPONENT& destination_component); void send(const CfInitialize& send_par); @@ -96,6 +98,10 @@ namespace ItsRSUsSimulator__TestSystem { void outgoing_send(const LibItsSremSsem__TypesAndValues::UtSsemEventInd &send_par); void outgoing_send(const LibItsRtcmem__TypesAndValues::UtRtcmemResults &send_par); void outgoing_send(const LibItsRtcmem__TypesAndValues::UtRtcmemEventInd &send_par); + void outgoing_send(const LibItsCps__TypesAndValues::UtCpmResults &send_par); + void outgoing_send(const LibItsCps__TypesAndValues::UtCpmEventInd &send_par); + void outgoing_send(const LibItsVru__TypesAndValues::UtVamResults &send_par); + void outgoing_send(const LibItsVru__TypesAndValues::UtVamEventInd &send_par); }; // End of class ConfigRsuSimulatorPort } // namespace ItsRSUsSimulator__TestSystem diff --git a/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.cc b/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.cc index ef55da4..74f19da 100644 --- a/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.cc +++ b/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.cc @@ -62,7 +62,7 @@ namespace LibItsVru__TestSystem { void UpperTesterPort::user_stop() {} - void UpperTesterPort::outgoing_send(const LibItsVru__TypesAndValues::UtVruInitialize &send_par) { + void UpperTesterPort::outgoing_send(const LibItsVru__TypesAndValues::UtVamInitialize &send_par) { loggers::get_instance().log_msg(">>> UppertesterPort_Vru::outgoing_send: ", send_par); float duration; @@ -78,10 +78,10 @@ namespace LibItsVru__TestSystem { return; } - if (std::string(p_ind.get_descriptor()->name).compare("@LibItsVru_TypesAndValues.UtVruResults") == 0) { // TODO To be refined - incoming_message(static_cast(p_ind)); - } else if (std::string(p_ind.get_descriptor()->name).compare("@LibItsVru_TypesAndValues.UtVruEventInd") == 0) { - incoming_message(static_cast(p_ind)); + if (std::string(p_ind.get_descriptor()->name).compare("@LibItsVru_TypesAndValues.UtVamResults") == 0) { // TODO To be refined + incoming_message(static_cast(p_ind)); + } else if (std::string(p_ind.get_descriptor()->name).compare("@LibItsVru_TypesAndValues.UtVamEventInd") == 0) { + incoming_message(static_cast(p_ind)); } else { loggers::get_instance().warning("UpperTesterPort_Vru::receive_msg: Message not processed: %s", p_ind.get_descriptor()->name); } diff --git a/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.hh b/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.hh index 96cbbf1..b03f67f 100644 --- a/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.hh +++ b/ccsrc/Ports/LibIts_ports/VRU_ports/UpperTesterPort_VRU.hh @@ -36,7 +36,7 @@ namespace LibItsVru__TestSystem { void user_start(); void user_stop(); - void outgoing_send(const LibItsVru__TypesAndValues::UtVruInitialize &send_par); + void outgoing_send(const LibItsVru__TypesAndValues::UtVamInitialize &send_par); }; } // namespace LibItsVru__TestSystem diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc index f072a0b..ac619de 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc @@ -11,17 +11,17 @@ template class OPTIONAL; class TTCN_EncDec; -unsigned char uppertester_cps_codec::c_utCpsInitialize = 0x00; -unsigned char uppertester_cps_codec::c_utCpsInitializeResult = 0x01; -unsigned char uppertester_cps_codec::c_utCpsEventInd = 0x23; +unsigned char uppertester_cps_codec::c_utCpmInitialize = 0x00; +unsigned char uppertester_cps_codec::c_utCpmInitializeResult = 0x01; +unsigned char uppertester_cps_codec::c_utCpmEventInd = 0x23; int uppertester_cps_codec::encode(const Record_Type &msg, OCTETSTRING &data) { loggers::get_instance().log_msg(">>> uppertester_cps_codec::encode: ", (const Record_Type &)msg); TTCN_EncDec::clear_error(); TTCN_Buffer encoding_buffer; - if (std::string(msg.get_descriptor()->name).compare("@LibItsCps_TypesAndValues.UtCpsInitialize") == 0) { - encoding_buffer.put_c(static_cast(uppertester_cps_codec::c_utCpsInitialize)); + if (std::string(msg.get_descriptor()->name).compare("@LibItsCps_TypesAndValues.UtCpmInitialize") == 0) { + encoding_buffer.put_c(static_cast(uppertester_cps_codec::c_utCpmInitialize)); } else { // Error data = OCTETSTRING(0, nullptr); loggers::get_instance().warning("<<< uppertester_cps_codec::encode: Failed to encode UT message"); @@ -134,15 +134,15 @@ std::unique_ptr uppertester_cps_codec::decode(const OCTETSTRING &data std::unique_ptr result; const unsigned char *ptr = static_cast(data); - if (*ptr != uppertester_cps_codec::c_utCpsEventInd) { - LibItsCps__TypesAndValues::UtCpsResults res; + if (*ptr != uppertester_cps_codec::c_utCpmEventInd) { + LibItsCps__TypesAndValues::UtCpmResults res; if (decode(data, res, params) == 0) { result.reset((Base_Type *)res.clone()); } else { result.reset(nullptr); } } else { - LibItsCps__TypesAndValues::UtCpsEventInd ind; + LibItsCps__TypesAndValues::UtCpmEventInd ind; decode(data, ind, params); result.reset((Base_Type *)ind.clone()); } @@ -150,11 +150,11 @@ std::unique_ptr uppertester_cps_codec::decode(const OCTETSTRING &data return result; } -int uppertester_cps_codec::decode(const OCTETSTRING &data, LibItsCps__TypesAndValues::UtCpsResults &msg, params_its *params) { +int uppertester_cps_codec::decode(const OCTETSTRING &data, LibItsCps__TypesAndValues::UtCpmResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_cps_codec::decode: decoding_buffer=", data); const unsigned char *ptr = static_cast(data); - if (*ptr == uppertester_cps_codec::c_utCpsInitializeResult) { + if (*ptr == uppertester_cps_codec::c_utCpmInitializeResult) { msg.utCpsInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); } else if (*ptr == 0x24) { // TODO Use a constant for "Peer does not support is "Peer does not support the command" // Peer does not support the command @@ -168,7 +168,7 @@ int uppertester_cps_codec::decode(const OCTETSTRING &data, LibItsCps__TypesAndVa return 0; } -int uppertester_cps_codec::decode(const OCTETSTRING &data, LibItsCps__TypesAndValues::UtCpsEventInd &msg, params_its *params) { +int uppertester_cps_codec::decode(const OCTETSTRING &data, LibItsCps__TypesAndValues::UtCpmEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_cps_codec::decode (1): decoding_buffer=", data); const unsigned char *ptr = static_cast(data) + 1; @@ -183,7 +183,7 @@ int uppertester_cps_codec::decode(const OCTETSTRING &data, LibItsCps__TypesAndVa os = OCTETSTRING(length, ptr); loggers::get_instance().log_to_hexa("uppertester_cps_codec::decode (1): CPS message=", os); cps_codec codec; - codec.decode(os, msg.cpsMsg(), params); + codec.decode(os, msg.cpmMsg(), params); loggers::get_instance().log_msg("<<< uppertester_cps_codec::decode (1)", msg); return 0; diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_cps_codec.hh index 57b1660..26905e7 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cps_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_cps_codec.hh @@ -21,16 +21,16 @@ class TTCN_Typedescriptor_t; class TTCN_Buffer; namespace LibItsCps__TypesAndValues { - class UtCpsTrigger; - class UtCpsResults; - class UtCpsEventInd; + class UtCpmTrigger; + class UtCpmResults; + class UtCpmEventInd; } // namespace LibItsCps__TypesAndValues class uppertester_cps_codec : public codec { public: - static unsigned char c_utCpsInitialize; - static unsigned char c_utCpsInitializeResult; - static unsigned char c_utCpsEventInd; + static unsigned char c_utCpmInitialize; + static unsigned char c_utCpmInitializeResult; + static unsigned char c_utCpmEventInd; private: int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); @@ -40,11 +40,11 @@ public: virtual ~uppertester_cps_codec(){}; virtual int encode(const Record_Type &, OCTETSTRING &data); - //int encode(const LibItsCps__TypesAndValues::UtCpsTrigger &, OCTETSTRING &data); + //int encode(const LibItsCps__TypesAndValues::UtCpmTrigger &, OCTETSTRING &data); virtual int decode(const OCTETSTRING &data, Record_Type &, params_its *params = NULL); std::unique_ptr decode(const OCTETSTRING &data, params_its *params = NULL); private: - int decode(const OCTETSTRING &data, LibItsCps__TypesAndValues::UtCpsResults &msg, params_its *params = NULL); - int decode(const OCTETSTRING &data, LibItsCps__TypesAndValues::UtCpsEventInd &msg, params_its *params = NULL); + int decode(const OCTETSTRING &data, LibItsCps__TypesAndValues::UtCpmResults &msg, params_its *params = NULL); + int decode(const OCTETSTRING &data, LibItsCps__TypesAndValues::UtCpmEventInd &msg, params_its *params = NULL); }; // End of class uppertester_cps_codec diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc index 115c964..c41ca38 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc @@ -16,11 +16,11 @@ uppertester_cps_layer::uppertester_cps_layer(const std::string &p_type, const st } } -void uppertester_cps_layer::sendMsg(const LibItsCps__TypesAndValues::UtCpsInitialize &send_par, params_its &p_params) { +void uppertester_cps_layer::sendMsg(const LibItsCps__TypesAndValues::UtCpmInitialize &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_cps_layer::sendMsg", send_par); if (_params[params::loopback].compare("1") == 0) { - LibItsCps__TypesAndValues::UtCpsResults ut_cps_results; + LibItsCps__TypesAndValues::UtCpmResults ut_cps_results; ut_cps_results.utCpsInitializeResult() = BOOLEAN(true); to_all_upper_ports(ut_cps_results, p_params); } else { diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_cps_layer.hh index 5119565..bca600d 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cps_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_cps_layer.hh @@ -20,7 +20,7 @@ namespace LibItsCps__TestSystem { } namespace LibItsCps__TypesAndValues { - class UtCpsInitialize; + class UtCpmInitialize; } // namespace LibItsCps__TypesAndValues class uppertester_cps_layer : public t_layer { @@ -32,7 +32,7 @@ public: uppertester_cps_layer(const std::string &p_type, const std::string ¶m); virtual ~uppertester_cps_layer(){}; - void sendMsg(const LibItsCps__TypesAndValues::UtCpsInitialize &send_par, params_its& p_params); + void sendMsg(const LibItsCps__TypesAndValues::UtCpmInitialize &send_par, params_its& p_params); virtual void send_data(OCTETSTRING &data, params& p_params); virtual void receive_data(OCTETSTRING &data, params& p_params); diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc index 653715f..bae9bd8 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc @@ -11,17 +11,17 @@ template class OPTIONAL; class TTCN_EncDec; -unsigned char uppertester_vru_codec::c_utVruInitialize = 0x00; -unsigned char uppertester_vru_codec::c_utVruInitializeResult = 0x01; -unsigned char uppertester_vru_codec::c_utVruEventInd = 0x23; +unsigned char uppertester_vru_codec::c_utVamInitialize = 0x00; +unsigned char uppertester_vru_codec::c_utVamInitializeResult = 0x01; +unsigned char uppertester_vru_codec::c_utVamEventInd = 0x23; int uppertester_vru_codec::encode(const Record_Type &msg, OCTETSTRING &data) { loggers::get_instance().log_msg(">>> uppertester_vru_codec::encode: ", (const Record_Type &)msg); TTCN_EncDec::clear_error(); TTCN_Buffer encoding_buffer; - if (std::string(msg.get_descriptor()->name).compare("@LibItsVru_TypesAndValues.UtVruInitialize") == 0) { - encoding_buffer.put_c(static_cast(uppertester_vru_codec::c_utVruInitialize)); + if (std::string(msg.get_descriptor()->name).compare("@LibItsVru_TypesAndValues.UtVamInitialize") == 0) { + encoding_buffer.put_c(static_cast(uppertester_vru_codec::c_utVamInitialize)); } else { // Error data = OCTETSTRING(0, nullptr); loggers::get_instance().warning("<<< uppertester_vru_codec::encode: Failed to encode UT message"); @@ -134,15 +134,15 @@ std::unique_ptr uppertester_vru_codec::decode(const OCTETSTRING &data std::unique_ptr result; const unsigned char *ptr = static_cast(data); - if (*ptr != uppertester_vru_codec::c_utVruEventInd) { - LibItsVru__TypesAndValues::UtVruResults res; + if (*ptr != uppertester_vru_codec::c_utVamEventInd) { + LibItsVru__TypesAndValues::UtVamResults res; if (decode(data, res, params) == 0) { result.reset((Base_Type *)res.clone()); } else { result.reset(nullptr); } } else { - LibItsVru__TypesAndValues::UtVruEventInd ind; + LibItsVru__TypesAndValues::UtVamEventInd ind; decode(data, ind, params); result.reset((Base_Type *)ind.clone()); } @@ -150,11 +150,11 @@ std::unique_ptr uppertester_vru_codec::decode(const OCTETSTRING &data return result; } -int uppertester_vru_codec::decode(const OCTETSTRING &data, LibItsVru__TypesAndValues::UtVruResults &msg, params_its *params) { +int uppertester_vru_codec::decode(const OCTETSTRING &data, LibItsVru__TypesAndValues::UtVamResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_vru_codec::decode: decoding_buffer=", data); const unsigned char *ptr = static_cast(data); - if (*ptr == uppertester_vru_codec::c_utVruInitializeResult) { + if (*ptr == uppertester_vru_codec::c_utVamInitializeResult) { msg.utVruInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); } else if (*ptr == 0x24) { // TODO Use a constant for "Peer does not support is "Peer does not support the command" // Peer does not support the command @@ -168,7 +168,7 @@ int uppertester_vru_codec::decode(const OCTETSTRING &data, LibItsVru__TypesAndVa return 0; } -int uppertester_vru_codec::decode(const OCTETSTRING &data, LibItsVru__TypesAndValues::UtVruEventInd &msg, params_its *params) { +int uppertester_vru_codec::decode(const OCTETSTRING &data, LibItsVru__TypesAndValues::UtVamEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_vru_codec::decode (1): decoding_buffer=", data); const unsigned char *ptr = static_cast(data) + 1; diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_vru_codec.hh index 78b5c72..c7e699a 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_vru_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_vru_codec.hh @@ -21,16 +21,16 @@ class TTCN_Typedescriptor_t; class TTCN_Buffer; namespace LibItsVru__TypesAndValues { - class UtVruTrigger; - class UtVruResults; - class UtVruEventInd; + class UtVamTrigger; + class UtVamResults; + class UtVamEventInd; } // namespace LibItsVru__TypesAndValues class uppertester_vru_codec : public codec { public: - static unsigned char c_utVruInitialize; - static unsigned char c_utVruInitializeResult; - static unsigned char c_utVruEventInd; + static unsigned char c_utVamInitialize; + static unsigned char c_utVamInitializeResult; + static unsigned char c_utVamEventInd; private: int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); @@ -40,11 +40,11 @@ public: virtual ~uppertester_vru_codec(){}; virtual int encode(const Record_Type &, OCTETSTRING &data); - //int encode(const LibItsVru__TypesAndValues::UtVruTrigger &, OCTETSTRING &data); + //int encode(const LibItsVru__TypesAndValues::UtVamTrigger &, OCTETSTRING &data); virtual int decode(const OCTETSTRING &data, Record_Type &, params_its *params = NULL); std::unique_ptr decode(const OCTETSTRING &data, params_its *params = NULL); private: - int decode(const OCTETSTRING &data, LibItsVru__TypesAndValues::UtVruResults &msg, params_its *params = NULL); - int decode(const OCTETSTRING &data, LibItsVru__TypesAndValues::UtVruEventInd &msg, params_its *params = NULL); + int decode(const OCTETSTRING &data, LibItsVru__TypesAndValues::UtVamResults &msg, params_its *params = NULL); + int decode(const OCTETSTRING &data, LibItsVru__TypesAndValues::UtVamEventInd &msg, params_its *params = NULL); }; // End of class uppertester_vru_codec diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc index 8e7289d..de0d987 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc @@ -16,11 +16,11 @@ uppertester_vru_layer::uppertester_vru_layer(const std::string &p_type, const st } } -void uppertester_vru_layer::sendMsg(const LibItsVru__TypesAndValues::UtVruInitialize &send_par, params_its &p_params) { +void uppertester_vru_layer::sendMsg(const LibItsVru__TypesAndValues::UtVamInitialize &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_vru_layer::sendMsg", send_par); if (_params[params::loopback].compare("1") == 0) { - LibItsVru__TypesAndValues::UtVruResults ut_vru_results; + LibItsVru__TypesAndValues::UtVamResults ut_vru_results; ut_vru_results.utVruInitializeResult() = BOOLEAN(true); to_all_upper_ports(ut_vru_results, p_params); } else { diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_vru_layer.hh index 2981914..a2ff3e1 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_vru_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_vru_layer.hh @@ -20,7 +20,7 @@ namespace LibItsVru__TestSystem { } namespace LibItsVru__TypesAndValues { - class UtVruInitialize; + class UtVamInitialize; } // namespace LibItsVru__TypesAndValues class uppertester_vru_layer : public t_layer { @@ -32,7 +32,7 @@ public: uppertester_vru_layer(const std::string &p_type, const std::string ¶m); virtual ~uppertester_vru_layer(){}; - void sendMsg(const LibItsVru__TypesAndValues::UtVruInitialize &send_par, params_its& p_params); + void sendMsg(const LibItsVru__TypesAndValues::UtVamInitialize &send_par, params_its& p_params); virtual void send_data(OCTETSTRING &data, params& p_params); virtual void receive_data(OCTETSTRING &data, params& p_params); -- GitLab From fda63c59f8fc22dadd948ba93afb03006d575611 Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 27 Jun 2024 14:02:04 +0200 Subject: [PATCH 151/178] Bug fixed in ccsrc/Ports/LibIts_ports/UpperTesterPort.hh --- ccsrc/EncDec/LibItsCps_Encdec.cc | 7 ++++++- ccsrc/EncDec/LibItsVru_Encdec.cc | 6 +++--- ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc | 4 ++-- ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc | 3 ++- ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc | 8 ++++++-- ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc | 3 ++- ttcn/AtsCPS | 2 +- ttcn/AtsVRU | 2 +- virtualization/docker-dev/build.sh | 2 +- .../home/etc/init.d/{40-ttf024.sh => 40-ttf036.sh} | 6 ++---- virtualization/docker-dev/home/etc/init.d/50-ats.sh | 2 +- virtualization/docker/Dockerfile | 2 +- virtualization/docker/README.md | 2 +- 13 files changed, 29 insertions(+), 20 deletions(-) rename virtualization/docker-dev/home/etc/init.d/{40-ttf024.sh => 40-ttf036.sh} (74%) diff --git a/ccsrc/EncDec/LibItsCps_Encdec.cc b/ccsrc/EncDec/LibItsCps_Encdec.cc index ebaaa75..edf571c 100644 --- a/ccsrc/EncDec/LibItsCps_Encdec.cc +++ b/ccsrc/EncDec/LibItsCps_Encdec.cc @@ -195,12 +195,17 @@ namespace LibItsCps__EncdecDeclarations { return 0; } +<<<<<<< HEAD BITSTRING fx__enc__UtCpmInitialize(const LibItsCps__TypesAndValues::UtCpmInitialize &p_utCpsInitialize) { loggers::get_instance().log_msg(">>> fx__enc__UtCpmInitialize: ", p_utCpsInitialize); +======= + BITSTRING fx__enc__UtCpmInitialize(const LibItsCps__TypesAndValues::UtCpmInitialize &p_utCpmInitialize) { + loggers::get_instance().log_msg(">>> fx__enc__UtCpmInitialize: ", p_utCpmInitialize); +>>>>>>> a676b01 (Bug fixed in ccsrc/Ports/LibIts_ports/UpperTesterPort.hh) uppertester_cps_codec codec; OCTETSTRING os; - codec.encode(p_utCpsInitialize, os); + codec.encode(p_utCpmInitialize, os); return oct2bit(os); } diff --git a/ccsrc/EncDec/LibItsVru_Encdec.cc b/ccsrc/EncDec/LibItsVru_Encdec.cc index e907b12..6582aa2 100644 --- a/ccsrc/EncDec/LibItsVru_Encdec.cc +++ b/ccsrc/EncDec/LibItsVru_Encdec.cc @@ -195,12 +195,12 @@ namespace LibItsVru__EncdecDeclarations { return 0; } - BITSTRING fx__enc__UtVamInitialize(const LibItsVru__TypesAndValues::UtVamInitialize &p_utVruInitialize) { - loggers::get_instance().log_msg(">>> fx__enc__UtVamInitialize: ", p_utVruInitialize); + BITSTRING fx__enc__UtVamInitialize(const LibItsVru__TypesAndValues::UtVamInitialize &p_utVamInitialize) { + loggers::get_instance().log_msg(">>> fx__enc__UtVamInitialize: ", p_utVamInitialize); uppertester_vru_codec codec; OCTETSTRING os; - codec.encode(p_utVruInitialize, os); + codec.encode(p_utVamInitialize, os); return oct2bit(os); } diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc index ac619de..cc1f540 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc @@ -155,10 +155,10 @@ int uppertester_cps_codec::decode(const OCTETSTRING &data, LibItsCps__TypesAndVa const unsigned char *ptr = static_cast(data); if (*ptr == uppertester_cps_codec::c_utCpmInitializeResult) { - msg.utCpsInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); + msg.utCpmInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); } else if (*ptr == 0x24) { // TODO Use a constant for "Peer does not support is "Peer does not support the command" // Peer does not support the command - msg.utCpsInitializeResult() = 0x00; + msg.utCpmInitializeResult() = 0x00; } else { loggers::get_instance().warning("uppertester_cps_codec::decode: Unsupported result"); return -1; diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc index c41ca38..fa130e6 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc @@ -16,12 +16,13 @@ uppertester_cps_layer::uppertester_cps_layer(const std::string &p_type, const st } } +void uppertester_cps_layer::sendMsg(const LibItsCps__TypesAndValues::UtCpmInitialize &send_par, params_its &p_params) { void uppertester_cps_layer::sendMsg(const LibItsCps__TypesAndValues::UtCpmInitialize &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_cps_layer::sendMsg", send_par); if (_params[params::loopback].compare("1") == 0) { LibItsCps__TypesAndValues::UtCpmResults ut_cps_results; - ut_cps_results.utCpsInitializeResult() = BOOLEAN(true); + ut_cps_results.utCpmInitializeResult() = BOOLEAN(true); to_all_upper_ports(ut_cps_results, p_params); } else { // Encode UpperTester PDU diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc index bae9bd8..a88a3fd 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc @@ -11,6 +11,9 @@ template class OPTIONAL; class TTCN_EncDec; +unsigned char uppertester_vru_codec::c_utVamInitialize = 0x00; +unsigned char uppertester_vru_codec::c_utVamInitializeResult = 0x01; +unsigned char uppertester_vru_codec::c_utVamEventInd = 0x23; unsigned char uppertester_vru_codec::c_utVamInitialize = 0x00; unsigned char uppertester_vru_codec::c_utVamInitializeResult = 0x01; unsigned char uppertester_vru_codec::c_utVamEventInd = 0x23; @@ -150,15 +153,16 @@ std::unique_ptr uppertester_vru_codec::decode(const OCTETSTRING &data return result; } +int uppertester_vru_codec::decode(const OCTETSTRING &data, LibItsVru__TypesAndValues::UtVamResults &msg, params_its *params) { int uppertester_vru_codec::decode(const OCTETSTRING &data, LibItsVru__TypesAndValues::UtVamResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_vru_codec::decode: decoding_buffer=", data); const unsigned char *ptr = static_cast(data); if (*ptr == uppertester_vru_codec::c_utVamInitializeResult) { - msg.utVruInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); + msg.utVamInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); } else if (*ptr == 0x24) { // TODO Use a constant for "Peer does not support is "Peer does not support the command" // Peer does not support the command - msg.utVruInitializeResult() = 0x00; + msg.utVamInitializeResult() = 0x00; } else { loggers::get_instance().warning("uppertester_vru_codec::decode: Unsupported result"); return -1; diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc index de0d987..0bfd4f5 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc @@ -16,12 +16,13 @@ uppertester_vru_layer::uppertester_vru_layer(const std::string &p_type, const st } } +void uppertester_vru_layer::sendMsg(const LibItsVru__TypesAndValues::UtVamInitialize &send_par, params_its &p_params) { void uppertester_vru_layer::sendMsg(const LibItsVru__TypesAndValues::UtVamInitialize &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_vru_layer::sendMsg", send_par); if (_params[params::loopback].compare("1") == 0) { LibItsVru__TypesAndValues::UtVamResults ut_vru_results; - ut_vru_results.utVruInitializeResult() = BOOLEAN(true); + ut_vru_results.utVamInitializeResult() = BOOLEAN(true); to_all_upper_ports(ut_vru_results, p_params); } else { // Encode UpperTester PDU diff --git a/ttcn/AtsCPS b/ttcn/AtsCPS index 40fe6ea..6bb83e6 160000 --- a/ttcn/AtsCPS +++ b/ttcn/AtsCPS @@ -1 +1 @@ -Subproject commit 40fe6ea23a51ecdb019fbe94a216d025f5198a5b +Subproject commit 6bb83e613233d67713937ec3109c0e8eb1c9dbfe diff --git a/ttcn/AtsVRU b/ttcn/AtsVRU index 04534f9..521d0e6 160000 --- a/ttcn/AtsVRU +++ b/ttcn/AtsVRU @@ -1 +1 @@ -Subproject commit 04534f9e2b43ff46766307669bebb146d8152178 +Subproject commit 521d0e647ef7e098961485017ca06f8cb37095ab diff --git a/virtualization/docker-dev/build.sh b/virtualization/docker-dev/build.sh index 25db389..d813769 100755 --- a/virtualization/docker-dev/build.sh +++ b/virtualization/docker-dev/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright ETSI 2020-2021 +# Copyright ETSI 2020-2024 # See: https://forge.etsi.org/etsi-forge-copyright-statement.txt set -e diff --git a/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh b/virtualization/docker-dev/home/etc/init.d/40-ttf036.sh similarity index 74% rename from virtualization/docker-dev/home/etc/init.d/40-ttf024.sh rename to virtualization/docker-dev/home/etc/init.d/40-ttf036.sh index 9eac8c1..f2b3a0d 100755 --- a/virtualization/docker-dev/home/etc/init.d/40-ttf024.sh +++ b/virtualization/docker-dev/home/etc/init.d/40-ttf036.sh @@ -6,11 +6,9 @@ set -vx echo -e "*****************************\n* Checkout TS.ITS sources\n*****************************\n" cd ${HOME}/dev || exit 1 -git clone --recurse-submodules https://forge.etsi.org/rep/ITS/TS.ITS.git TS.ITS || exit 1 +git clone --recurse-submodules --branch=TTF_T036 https://forge.etsi.org/rep/ITS/TS.ITS.git || exit 1 cd ./TS.ITS || exit 1 -git checkout ttf_t024 || exit 1 - -./switch_its_r2.sh || exit 1 +./install.sh || exit 1 echo -e "*****************************\n* Setup environment\n*****************************\n" cd ${HOME}/dev/TS.ITS/scripts diff --git a/virtualization/docker-dev/home/etc/init.d/50-ats.sh b/virtualization/docker-dev/home/etc/init.d/50-ats.sh index 4bc6614..5911fe8 100755 --- a/virtualization/docker-dev/home/etc/init.d/50-ats.sh +++ b/virtualization/docker-dev/home/etc/init.d/50-ats.sh @@ -11,7 +11,7 @@ cd ${HOME}/dev/TS.ITS/scripts || exit 1 echo -e "*****************************\n* Build test suites\n*****************************\n" cd ${HOME}/dev/TS.ITS -ATS_LIST="AtsCAM AtsDENM AtsGeoNetworking AtsIS AtsPki AtsSecurity AtsMBR" +ATS_LIST="AtsCAM AtsDENM AtsCPS AtsVRU AtsIS AtsBTP AtsGeoNetworking AtsPki AtsSecurity AtsMBR" for i in ${ATS_LIST} do export ATS=$i diff --git a/virtualization/docker/Dockerfile b/virtualization/docker/Dockerfile index 7fa6d24..ee5edee 100644 --- a/virtualization/docker/Dockerfile +++ b/virtualization/docker/Dockerfile @@ -49,6 +49,6 @@ WORKDIR /home/etsi/dev EXPOSE 80/tcp 443/tcp 12340-12349/udp -ENTRYPOINT ["/home/etsi/dev/TS.ITS_r2/virtualization/docker/docker-entrypoint.sh"] +ENTRYPOINT ["/home/etsi/dev/TS.ITS/virtualization/docker/docker-entrypoint.sh"] CMD ["help"] diff --git a/virtualization/docker/README.md b/virtualization/docker/README.md index 16cd5e7..7aca762 100644 --- a/virtualization/docker/README.md +++ b/virtualization/docker/README.md @@ -32,7 +32,7 @@ Procedure on the host machine: - Clone the ETSI ITS Test System ```sh -$ git clone --recurse-submodules --single-branch https://forge.etsi.org/gitlab/ITS/TS.ITS.git +$ git clone --recurse-submodules --branch=TTF_T036 https://forge.etsi.org/gitlab/ITS/TS.ITS.git cd ${HOME}/dev/TS.ITS/titan-test-system-framework git checkout devel cd ./ttcn/LibHttp -- GitLab From 44a8a880f21ee7bf9aa52755f4c822ad93ecc3db Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 27 Jun 2024 19:47:05 +0200 Subject: [PATCH 152/178] Resolve merge conflicts --- ccsrc/EncDec/LibItsCps_Encdec.cc | 5 ----- ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc | 1 - ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc | 4 ---- ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc | 1 - virtualization/docker-dev/run.sh | 2 +- 5 files changed, 1 insertion(+), 12 deletions(-) diff --git a/ccsrc/EncDec/LibItsCps_Encdec.cc b/ccsrc/EncDec/LibItsCps_Encdec.cc index edf571c..3ff1d3a 100644 --- a/ccsrc/EncDec/LibItsCps_Encdec.cc +++ b/ccsrc/EncDec/LibItsCps_Encdec.cc @@ -195,13 +195,8 @@ namespace LibItsCps__EncdecDeclarations { return 0; } -<<<<<<< HEAD - BITSTRING fx__enc__UtCpmInitialize(const LibItsCps__TypesAndValues::UtCpmInitialize &p_utCpsInitialize) { - loggers::get_instance().log_msg(">>> fx__enc__UtCpmInitialize: ", p_utCpsInitialize); -======= BITSTRING fx__enc__UtCpmInitialize(const LibItsCps__TypesAndValues::UtCpmInitialize &p_utCpmInitialize) { loggers::get_instance().log_msg(">>> fx__enc__UtCpmInitialize: ", p_utCpmInitialize); ->>>>>>> a676b01 (Bug fixed in ccsrc/Ports/LibIts_ports/UpperTesterPort.hh) uppertester_cps_codec codec; OCTETSTRING os; diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc index fa130e6..3fc8eb9 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_cps_layer.cc @@ -16,7 +16,6 @@ uppertester_cps_layer::uppertester_cps_layer(const std::string &p_type, const st } } -void uppertester_cps_layer::sendMsg(const LibItsCps__TypesAndValues::UtCpmInitialize &send_par, params_its &p_params) { void uppertester_cps_layer::sendMsg(const LibItsCps__TypesAndValues::UtCpmInitialize &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_cps_layer::sendMsg", send_par); diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc index a88a3fd..159f22d 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_vru_codec.cc @@ -11,9 +11,6 @@ template class OPTIONAL; class TTCN_EncDec; -unsigned char uppertester_vru_codec::c_utVamInitialize = 0x00; -unsigned char uppertester_vru_codec::c_utVamInitializeResult = 0x01; -unsigned char uppertester_vru_codec::c_utVamEventInd = 0x23; unsigned char uppertester_vru_codec::c_utVamInitialize = 0x00; unsigned char uppertester_vru_codec::c_utVamInitializeResult = 0x01; unsigned char uppertester_vru_codec::c_utVamEventInd = 0x23; @@ -153,7 +150,6 @@ std::unique_ptr uppertester_vru_codec::decode(const OCTETSTRING &data return result; } -int uppertester_vru_codec::decode(const OCTETSTRING &data, LibItsVru__TypesAndValues::UtVamResults &msg, params_its *params) { int uppertester_vru_codec::decode(const OCTETSTRING &data, LibItsVru__TypesAndValues::UtVamResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_vru_codec::decode: decoding_buffer=", data); diff --git a/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc index 0bfd4f5..0dabfd9 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_vru_layer.cc @@ -16,7 +16,6 @@ uppertester_vru_layer::uppertester_vru_layer(const std::string &p_type, const st } } -void uppertester_vru_layer::sendMsg(const LibItsVru__TypesAndValues::UtVamInitialize &send_par, params_its &p_params) { void uppertester_vru_layer::sendMsg(const LibItsVru__TypesAndValues::UtVamInitialize &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_vru_layer::sendMsg", send_par); diff --git a/virtualization/docker-dev/run.sh b/virtualization/docker-dev/run.sh index c223af1..6e14106 100755 --- a/virtualization/docker-dev/run.sh +++ b/virtualization/docker-dev/run.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright ETSI 2018-2020 +# Copyright ETSI 2018-2024 # See: https://forge.etsi.org/etsi-forge-copyright-statement.txt #set -e -- GitLab From 1496adea978afe0458e8041a4414487fa46b80dc Mon Sep 17 00:00:00 2001 From: garciay Date: Fri, 28 Jun 2024 06:53:48 +0200 Subject: [PATCH 153/178] Review docker --- virtualization/docker/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virtualization/docker/docker-entrypoint.sh b/virtualization/docker/docker-entrypoint.sh index b240b1b..c8e1e12 100755 --- a/virtualization/docker/docker-entrypoint.sh +++ b/virtualization/docker/docker-entrypoint.sh @@ -13,7 +13,7 @@ usage() { echo "e.g. docker-run.sh build Security # To build the AtsSecurity test suite" } -cli="${GEN_DIR}/bin/TS.ITS_r2" +cli="${GEN_DIR}/bin/TS.ITS" commands="help,build,clean,ip,list,modulepar,ping,rebuild,build-run,run,version" -- GitLab From d74ee8c300c1b7283b330080e032c6308f037cb1 Mon Sep 17 00:00:00 2001 From: garciay Date: Fri, 12 Jul 2024 11:49:31 +0200 Subject: [PATCH 154/178] Update certificate to add VAM/CPM --- data/certificates/profiles/CERT_IUT_A1_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_A2_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_AA.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_AC_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_AT.xml | 4 +++- data/certificates/profiles/CERT_IUT_A_AT_IMP.xml | 4 +++- data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_AT_PAST.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_B33_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_B3_AA.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_B3_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_B_AA.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_B_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_B_N_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_C3_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_CC_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_MA.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_N_AA.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_N_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_A_RCA.xml | 2 ++ data/certificates/profiles/CERT_IUT_B_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_C1_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_C2_AA.xml | 2 ++ data/certificates/profiles/CERT_IUT_C2_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_C3_AA.xml | 2 ++ data/certificates/profiles/CERT_IUT_CA_AA.xml | 2 ++ data/certificates/profiles/CERT_IUT_CC_AA.xml | 2 ++ data/certificates/profiles/CERT_IUT_C_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_C_AT_8.xml | 2 ++ data/certificates/profiles/CERT_IUT_C_RCA.xml | 2 ++ data/certificates/profiles/CERT_IUT_D_AA.xml | 2 ++ data/certificates/profiles/CERT_IUT_D_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_E_AT.xml | 2 ++ data/certificates/profiles/CERT_IUT_E_AT_8.xml | 2 ++ .../certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_01.xml | 2 ++ .../certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_02.xml | 2 ++ .../certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_03.xml | 2 ++ data/certificates/profiles/CERT_TS_A_AA.xml | 2 ++ data/certificates/profiles/CERT_TS_A_AA_B.xml | 2 ++ data/certificates/profiles/CERT_TS_A_AT.xml | 2 ++ data/certificates/profiles/CERT_TS_A_AT_IMP.xml | 4 ++++ data/certificates/profiles/CERT_TS_A_EA.xml | 2 ++ .../profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_01.xml | 2 ++ .../profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_02.xml | 2 ++ .../profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_03.xml | 2 ++ data/certificates/profiles/CERT_TS_B_AT.xml | 2 ++ data/certificates/profiles/CERT_TS_F3_AT.xml | 2 ++ data/certificates/profiles/CERT_TS_FA3_AA.xml | 2 ++ data/certificates/profiles/CERT_TS_FA3_AT.xml | 2 ++ data/certificates/profiles/CERT_TS_FA_AA.xml | 2 ++ data/certificates/profiles/CERT_TS_FA_AT.xml | 2 ++ data/certificates/profiles/CERT_TS_F_AT.xml | 2 ++ data/certificates/profiles/CERT_TS_F_AT_IMP.xml | 4 ++++ 54 files changed, 114 insertions(+), 2 deletions(-) diff --git a/data/certificates/profiles/CERT_IUT_A1_AT.xml b/data/certificates/profiles/CERT_IUT_A1_AT.xml index ab5eef6..a3b71c6 100644 --- a/data/certificates/profiles/CERT_IUT_A1_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A1_AT.xml @@ -24,6 +24,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_A2_AT.xml b/data/certificates/profiles/CERT_IUT_A2_AT.xml index 40c3e55..dfa9e12 100644 --- a/data/certificates/profiles/CERT_IUT_A2_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A2_AT.xml @@ -24,6 +24,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_A_AA.xml b/data/certificates/profiles/CERT_IUT_A_AA.xml index 66abff5..cf69f00 100644 --- a/data/certificates/profiles/CERT_IUT_A_AA.xml +++ b/data/certificates/profiles/CERT_IUT_A_AA.xml @@ -28,6 +28,8 @@ + + diff --git a/data/certificates/profiles/CERT_IUT_A_AC_AT.xml b/data/certificates/profiles/CERT_IUT_A_AC_AT.xml index d4e48d2..e85e32a 100644 --- a/data/certificates/profiles/CERT_IUT_A_AC_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_AC_AT.xml @@ -25,6 +25,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_A_AT.xml b/data/certificates/profiles/CERT_IUT_A_AT.xml index e215c05..260a5c3 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT.xml @@ -24,7 +24,9 @@ 01 FF FC 01 FF FF FF 02 FF FC - 03 FF FF FF + 02 FF FF FF FE + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml b/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml index 8cfcba0..56a3dd1 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml @@ -1,4 +1,4 @@ - + 3 @@ -25,6 +25,8 @@ 01 FF FF FF  02 FF FC  02 FF FF FF  + 01 + 01   diff --git a/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml b/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml index 347553b..a99eae0 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml @@ -25,6 +25,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml b/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml index 999f613..8cb828c 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml @@ -25,6 +25,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B33_AT.xml b/data/certificates/profiles/CERT_IUT_A_B33_AT.xml index 6ee3aa7..d7ceff3 100644 --- a/data/certificates/profiles/CERT_IUT_A_B33_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B33_AT.xml @@ -24,6 +24,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B3_AA.xml b/data/certificates/profiles/CERT_IUT_A_B3_AA.xml index f8a7035..6ff767a 100644 --- a/data/certificates/profiles/CERT_IUT_A_B3_AA.xml +++ b/data/certificates/profiles/CERT_IUT_A_B3_AA.xml @@ -28,6 +28,8 @@ + + diff --git a/data/certificates/profiles/CERT_IUT_A_B3_AT.xml b/data/certificates/profiles/CERT_IUT_A_B3_AT.xml index 3768843..27d148c 100644 --- a/data/certificates/profiles/CERT_IUT_A_B3_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B3_AT.xml @@ -24,6 +24,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml b/data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml index e1354c3..bba0d34 100644 --- a/data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml @@ -24,6 +24,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B_AA.xml b/data/certificates/profiles/CERT_IUT_A_B_AA.xml index 71b0402..5031e34 100644 --- a/data/certificates/profiles/CERT_IUT_A_B_AA.xml +++ b/data/certificates/profiles/CERT_IUT_A_B_AA.xml @@ -28,6 +28,8 @@ + + diff --git a/data/certificates/profiles/CERT_IUT_A_B_AT.xml b/data/certificates/profiles/CERT_IUT_A_B_AT.xml index 8546e23..12b141f 100644 --- a/data/certificates/profiles/CERT_IUT_A_B_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B_AT.xml @@ -24,6 +24,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B_N_AT.xml b/data/certificates/profiles/CERT_IUT_A_B_N_AT.xml index 639f933..fdda272 100644 --- a/data/certificates/profiles/CERT_IUT_A_B_N_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B_N_AT.xml @@ -24,6 +24,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_A_C3_AT.xml b/data/certificates/profiles/CERT_IUT_A_C3_AT.xml index 2c4db6f..f585d7d 100644 --- a/data/certificates/profiles/CERT_IUT_A_C3_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_C3_AT.xml @@ -25,6 +25,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_A_CC_AT.xml b/data/certificates/profiles/CERT_IUT_A_CC_AT.xml index 557bd96..0cf5e85 100644 --- a/data/certificates/profiles/CERT_IUT_A_CC_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_CC_AT.xml @@ -25,6 +25,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_A_MA.xml b/data/certificates/profiles/CERT_IUT_A_MA.xml index b46c25d..f37c955 100644 --- a/data/certificates/profiles/CERT_IUT_A_MA.xml +++ b/data/certificates/profiles/CERT_IUT_A_MA.xml @@ -28,6 +28,8 @@ + + diff --git a/data/certificates/profiles/CERT_IUT_A_N_AA.xml b/data/certificates/profiles/CERT_IUT_A_N_AA.xml index 6f20408..55eafa3 100644 --- a/data/certificates/profiles/CERT_IUT_A_N_AA.xml +++ b/data/certificates/profiles/CERT_IUT_A_N_AA.xml @@ -28,6 +28,8 @@ + + diff --git a/data/certificates/profiles/CERT_IUT_A_N_AT.xml b/data/certificates/profiles/CERT_IUT_A_N_AT.xml index 32fae05..9631377 100644 --- a/data/certificates/profiles/CERT_IUT_A_N_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_N_AT.xml @@ -25,6 +25,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_A_RCA.xml b/data/certificates/profiles/CERT_IUT_A_RCA.xml index 1b4fa48..8c47027 100644 --- a/data/certificates/profiles/CERT_IUT_A_RCA.xml +++ b/data/certificates/profiles/CERT_IUT_A_RCA.xml @@ -21,6 +21,8 @@ + + 01 C0/FF 3F diff --git a/data/certificates/profiles/CERT_IUT_B_AT.xml b/data/certificates/profiles/CERT_IUT_B_AT.xml index 98213f2..9f35ed2 100644 --- a/data/certificates/profiles/CERT_IUT_B_AT.xml +++ b/data/certificates/profiles/CERT_IUT_B_AT.xml @@ -24,6 +24,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_C1_AT.xml b/data/certificates/profiles/CERT_IUT_C1_AT.xml index 5a68e95..3ff5134 100644 --- a/data/certificates/profiles/CERT_IUT_C1_AT.xml +++ b/data/certificates/profiles/CERT_IUT_C1_AT.xml @@ -24,6 +24,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_C2_AA.xml b/data/certificates/profiles/CERT_IUT_C2_AA.xml index 7f02fa9..5de7c65 100644 --- a/data/certificates/profiles/CERT_IUT_C2_AA.xml +++ b/data/certificates/profiles/CERT_IUT_C2_AA.xml @@ -27,6 +27,8 @@ + + diff --git a/data/certificates/profiles/CERT_IUT_C2_AT.xml b/data/certificates/profiles/CERT_IUT_C2_AT.xml index 7f0cd81..6b6395b 100644 --- a/data/certificates/profiles/CERT_IUT_C2_AT.xml +++ b/data/certificates/profiles/CERT_IUT_C2_AT.xml @@ -24,6 +24,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_C3_AA.xml b/data/certificates/profiles/CERT_IUT_C3_AA.xml index 750a2a5..225a4c9 100644 --- a/data/certificates/profiles/CERT_IUT_C3_AA.xml +++ b/data/certificates/profiles/CERT_IUT_C3_AA.xml @@ -27,6 +27,8 @@ + + diff --git a/data/certificates/profiles/CERT_IUT_CA_AA.xml b/data/certificates/profiles/CERT_IUT_CA_AA.xml index 6c3dc71..c61b3d9 100644 --- a/data/certificates/profiles/CERT_IUT_CA_AA.xml +++ b/data/certificates/profiles/CERT_IUT_CA_AA.xml @@ -27,6 +27,8 @@ + + diff --git a/data/certificates/profiles/CERT_IUT_CC_AA.xml b/data/certificates/profiles/CERT_IUT_CC_AA.xml index e18bf10..470e7f3 100644 --- a/data/certificates/profiles/CERT_IUT_CC_AA.xml +++ b/data/certificates/profiles/CERT_IUT_CC_AA.xml @@ -27,6 +27,8 @@ + + diff --git a/data/certificates/profiles/CERT_IUT_C_AT.xml b/data/certificates/profiles/CERT_IUT_C_AT.xml index 77728b5..e3ef3e2 100644 --- a/data/certificates/profiles/CERT_IUT_C_AT.xml +++ b/data/certificates/profiles/CERT_IUT_C_AT.xml @@ -24,6 +24,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_C_AT_8.xml b/data/certificates/profiles/CERT_IUT_C_AT_8.xml index e2bdfbd..4d65b01 100644 --- a/data/certificates/profiles/CERT_IUT_C_AT_8.xml +++ b/data/certificates/profiles/CERT_IUT_C_AT_8.xml @@ -24,6 +24,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_C_RCA.xml b/data/certificates/profiles/CERT_IUT_C_RCA.xml index ec5225f..655ba4f 100644 --- a/data/certificates/profiles/CERT_IUT_C_RCA.xml +++ b/data/certificates/profiles/CERT_IUT_C_RCA.xml @@ -27,6 +27,8 @@ + + diff --git a/data/certificates/profiles/CERT_IUT_D_AA.xml b/data/certificates/profiles/CERT_IUT_D_AA.xml index 0ffb4de..eedcee3 100644 --- a/data/certificates/profiles/CERT_IUT_D_AA.xml +++ b/data/certificates/profiles/CERT_IUT_D_AA.xml @@ -27,6 +27,8 @@ + + diff --git a/data/certificates/profiles/CERT_IUT_D_AT.xml b/data/certificates/profiles/CERT_IUT_D_AT.xml index 4bb48a3..8202c33 100644 --- a/data/certificates/profiles/CERT_IUT_D_AT.xml +++ b/data/certificates/profiles/CERT_IUT_D_AT.xml @@ -24,6 +24,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_E_AT.xml b/data/certificates/profiles/CERT_IUT_E_AT.xml index e30ab70..a8f4c52 100644 --- a/data/certificates/profiles/CERT_IUT_E_AT.xml +++ b/data/certificates/profiles/CERT_IUT_E_AT.xml @@ -24,6 +24,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_IUT_E_AT_8.xml b/data/certificates/profiles/CERT_IUT_E_AT_8.xml index 4736e71..fbc2c44 100644 --- a/data/certificates/profiles/CERT_IUT_E_AT_8.xml +++ b/data/certificates/profiles/CERT_IUT_E_AT_8.xml @@ -24,6 +24,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_01.xml b/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_01.xml index aab488b..022fa06 100644 --- a/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_01.xml +++ b/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_01.xml @@ -28,6 +28,8 @@ + + diff --git a/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_02.xml b/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_02.xml index 857c07c..7a1b898 100644 --- a/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_02.xml +++ b/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_02.xml @@ -28,6 +28,8 @@ + + diff --git a/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_03.xml b/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_03.xml index 5aeacc4..de74fc7 100644 --- a/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_03.xml +++ b/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_03.xml @@ -28,6 +28,8 @@ + + diff --git a/data/certificates/profiles/CERT_TS_A_AA.xml b/data/certificates/profiles/CERT_TS_A_AA.xml index 66abff5..cf69f00 100644 --- a/data/certificates/profiles/CERT_TS_A_AA.xml +++ b/data/certificates/profiles/CERT_TS_A_AA.xml @@ -28,6 +28,8 @@ + + diff --git a/data/certificates/profiles/CERT_TS_A_AA_B.xml b/data/certificates/profiles/CERT_TS_A_AA_B.xml index dc731e7..0b48383 100644 --- a/data/certificates/profiles/CERT_TS_A_AA_B.xml +++ b/data/certificates/profiles/CERT_TS_A_AA_B.xml @@ -28,6 +28,8 @@ + + diff --git a/data/certificates/profiles/CERT_TS_A_AT.xml b/data/certificates/profiles/CERT_TS_A_AT.xml index 1d86185..d755465 100644 --- a/data/certificates/profiles/CERT_TS_A_AT.xml +++ b/data/certificates/profiles/CERT_TS_A_AT.xml @@ -25,6 +25,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_TS_A_AT_IMP.xml b/data/certificates/profiles/CERT_TS_A_AT_IMP.xml index 85f865b..e05a2a3 100644 --- a/data/certificates/profiles/CERT_TS_A_AT_IMP.xml +++ b/data/certificates/profiles/CERT_TS_A_AT_IMP.xml @@ -23,6 +23,10 @@ 01 FF FC  01 FF FF FF  +02 FF FC  +02 FF FF FF  +01 +01   diff --git a/data/certificates/profiles/CERT_TS_A_EA.xml b/data/certificates/profiles/CERT_TS_A_EA.xml index a284655..a2c548b 100644 --- a/data/certificates/profiles/CERT_TS_A_EA.xml +++ b/data/certificates/profiles/CERT_TS_A_EA.xml @@ -28,6 +28,8 @@ + + diff --git a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_01.xml b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_01.xml index 7e215b5..1ede01a 100644 --- a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_01.xml +++ b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_01.xml @@ -28,6 +28,8 @@ + + diff --git a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_02.xml b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_02.xml index 612b69a..f448e3d 100644 --- a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_02.xml +++ b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_02.xml @@ -28,6 +28,8 @@ + + diff --git a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_03.xml b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_03.xml index 78e89b7..9aa51fd 100644 --- a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_03.xml +++ b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_03.xml @@ -28,6 +28,8 @@ + + diff --git a/data/certificates/profiles/CERT_TS_B_AT.xml b/data/certificates/profiles/CERT_TS_B_AT.xml index c310c03..ad11ffb 100644 --- a/data/certificates/profiles/CERT_TS_B_AT.xml +++ b/data/certificates/profiles/CERT_TS_B_AT.xml @@ -25,6 +25,8 @@ 01 FF FF FF 02 FF FC 02 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_TS_F3_AT.xml b/data/certificates/profiles/CERT_TS_F3_AT.xml index 9ae80b9..8d38a4b 100644 --- a/data/certificates/profiles/CERT_TS_F3_AT.xml +++ b/data/certificates/profiles/CERT_TS_F3_AT.xml @@ -22,6 +22,8 @@ 01 FF FC 01 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_TS_FA3_AA.xml b/data/certificates/profiles/CERT_TS_FA3_AA.xml index deb8ec6..a6e9791 100644 --- a/data/certificates/profiles/CERT_TS_FA3_AA.xml +++ b/data/certificates/profiles/CERT_TS_FA3_AA.xml @@ -28,6 +28,8 @@ + + diff --git a/data/certificates/profiles/CERT_TS_FA3_AT.xml b/data/certificates/profiles/CERT_TS_FA3_AT.xml index 8253bbd..4a1d270 100644 --- a/data/certificates/profiles/CERT_TS_FA3_AT.xml +++ b/data/certificates/profiles/CERT_TS_FA3_AT.xml @@ -23,6 +23,8 @@ 01 FF FC 01 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_TS_FA_AA.xml b/data/certificates/profiles/CERT_TS_FA_AA.xml index cb1e4a6..c6c3d68 100644 --- a/data/certificates/profiles/CERT_TS_FA_AA.xml +++ b/data/certificates/profiles/CERT_TS_FA_AA.xml @@ -28,6 +28,8 @@ + + diff --git a/data/certificates/profiles/CERT_TS_FA_AT.xml b/data/certificates/profiles/CERT_TS_FA_AT.xml index 1019947..9b3d2ce 100644 --- a/data/certificates/profiles/CERT_TS_FA_AT.xml +++ b/data/certificates/profiles/CERT_TS_FA_AT.xml @@ -23,6 +23,8 @@ 01 FF FC 01 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_TS_F_AT.xml b/data/certificates/profiles/CERT_TS_F_AT.xml index 1659a94..6b3a0de 100644 --- a/data/certificates/profiles/CERT_TS_F_AT.xml +++ b/data/certificates/profiles/CERT_TS_F_AT.xml @@ -23,6 +23,8 @@ 01 FF FC 01 FF FF FF + 01 + 01 diff --git a/data/certificates/profiles/CERT_TS_F_AT_IMP.xml b/data/certificates/profiles/CERT_TS_F_AT_IMP.xml index f9b4b8c..f464cd0 100644 --- a/data/certificates/profiles/CERT_TS_F_AT_IMP.xml +++ b/data/certificates/profiles/CERT_TS_F_AT_IMP.xml @@ -23,6 +23,10 @@ 01 FF FC 01 FF FF FF + 02 FF FC + 02 FF FF FF + 01 + 01 -- GitLab From 8abb9d9fc91fd48fa9e8e6c9b351cff3cee084bd Mon Sep 17 00:00:00 2001 From: garciay Date: Fri, 12 Jul 2024 13:34:00 +0200 Subject: [PATCH 155/178] Update SSP for DENMv2. SSP for CAMv2 are unchanged --- data/certificates/profiles/CERT_IUT_A1_AT.xml | 2 +- data/certificates/profiles/CERT_IUT_A2_AT.xml | 2 +- data/certificates/profiles/CERT_IUT_A3_AT.xml | 2 +- data/certificates/profiles/CERT_IUT_A_AC_AT.xml | 2 +- data/certificates/profiles/CERT_IUT_A_AT_IMP.xml | 2 +- data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml | 2 +- data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml | 2 +- .../profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml | 2 +- data/certificates/profiles/CERT_IUT_A_AT_PAST.xml | 2 +- data/certificates/profiles/CERT_IUT_A_B33_AT.xml | 2 +- data/certificates/profiles/CERT_IUT_A_B3_AT.xml | 2 +- data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml | 2 +- data/certificates/profiles/CERT_IUT_A_B_AT.xml | 2 +- data/certificates/profiles/CERT_IUT_A_B_N_AT.xml | 2 +- data/certificates/profiles/CERT_IUT_A_C3_AT.xml | 2 +- data/certificates/profiles/CERT_IUT_A_CC_AT.xml | 2 +- data/certificates/profiles/CERT_IUT_A_N_AT.xml | 2 +- data/certificates/profiles/CERT_IUT_B_AT.xml | 2 +- data/certificates/profiles/CERT_IUT_C1_AT.xml | 2 +- data/certificates/profiles/CERT_IUT_C2_AT.xml | 2 +- data/certificates/profiles/CERT_TS_A_AT.xml | 2 +- data/certificates/profiles/CERT_TS_A_AT_IMP.xml | 2 +- data/certificates/profiles/CERT_TS_B_AT.xml | 2 +- data/certificates/profiles/CERT_TS_F_AT_IMP.xml | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/data/certificates/profiles/CERT_IUT_A1_AT.xml b/data/certificates/profiles/CERT_IUT_A1_AT.xml index a3b71c6..ec87672 100644 --- a/data/certificates/profiles/CERT_IUT_A1_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A1_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A2_AT.xml b/data/certificates/profiles/CERT_IUT_A2_AT.xml index dfa9e12..0c4408e 100644 --- a/data/certificates/profiles/CERT_IUT_A2_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A2_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A3_AT.xml b/data/certificates/profiles/CERT_IUT_A3_AT.xml index e24745f..e9d5f27 100644 --- a/data/certificates/profiles/CERT_IUT_A3_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A3_AT.xml @@ -22,7 +22,7 @@ 01 FF FF FF - 02 FF FF FF + 02 FF FF FF FE diff --git a/data/certificates/profiles/CERT_IUT_A_AC_AT.xml b/data/certificates/profiles/CERT_IUT_A_AC_AT.xml index e85e32a..2f164e4 100644 --- a/data/certificates/profiles/CERT_IUT_A_AC_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_AC_AT.xml @@ -24,7 +24,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml b/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml index 56a3dd1..2027e60 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml @@ -24,7 +24,7 @@ 01 FF FC  01 FF FF FF  02 FF FC  -02 FF FF FF  +02 FF FF FF FE  01 01   diff --git a/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml b/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml index a99eae0..463b766 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml @@ -24,7 +24,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml b/data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml index 2c1419d..aa02b8f 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml @@ -22,7 +22,7 @@ 01 FF FF FF - 02 FF FF FF + 02 FF FF FF FE diff --git a/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml b/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml index bc9da8f..bc96045 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml @@ -24,7 +24,7 @@ 01 FD FC 01 FF FF FF 02 FD FC - 02 FF FF FF + 02 FF FF FF FE diff --git a/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml b/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml index 8cb828c..4b03f3d 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml @@ -24,7 +24,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B33_AT.xml b/data/certificates/profiles/CERT_IUT_A_B33_AT.xml index d7ceff3..8a126ec 100644 --- a/data/certificates/profiles/CERT_IUT_A_B33_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B33_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B3_AT.xml b/data/certificates/profiles/CERT_IUT_A_B3_AT.xml index 27d148c..aec7433 100644 --- a/data/certificates/profiles/CERT_IUT_A_B3_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B3_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml b/data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml index bba0d34..36408b7 100644 --- a/data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B_AT.xml b/data/certificates/profiles/CERT_IUT_A_B_AT.xml index 12b141f..cbd8f40 100644 --- a/data/certificates/profiles/CERT_IUT_A_B_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B_N_AT.xml b/data/certificates/profiles/CERT_IUT_A_B_N_AT.xml index fdda272..b4fcd72 100644 --- a/data/certificates/profiles/CERT_IUT_A_B_N_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B_N_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_C3_AT.xml b/data/certificates/profiles/CERT_IUT_A_C3_AT.xml index f585d7d..6eba0da 100644 --- a/data/certificates/profiles/CERT_IUT_A_C3_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_C3_AT.xml @@ -24,7 +24,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_CC_AT.xml b/data/certificates/profiles/CERT_IUT_A_CC_AT.xml index 0cf5e85..3ed76e5 100644 --- a/data/certificates/profiles/CERT_IUT_A_CC_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_CC_AT.xml @@ -24,7 +24,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_N_AT.xml b/data/certificates/profiles/CERT_IUT_A_N_AT.xml index 9631377..0e35ed5 100644 --- a/data/certificates/profiles/CERT_IUT_A_N_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_N_AT.xml @@ -24,7 +24,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_B_AT.xml b/data/certificates/profiles/CERT_IUT_B_AT.xml index 9f35ed2..90627d2 100644 --- a/data/certificates/profiles/CERT_IUT_B_AT.xml +++ b/data/certificates/profiles/CERT_IUT_B_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_C1_AT.xml b/data/certificates/profiles/CERT_IUT_C1_AT.xml index 3ff5134..266e231 100644 --- a/data/certificates/profiles/CERT_IUT_C1_AT.xml +++ b/data/certificates/profiles/CERT_IUT_C1_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_C2_AT.xml b/data/certificates/profiles/CERT_IUT_C2_AT.xml index 6b6395b..fbd8394 100644 --- a/data/certificates/profiles/CERT_IUT_C2_AT.xml +++ b/data/certificates/profiles/CERT_IUT_C2_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_TS_A_AT.xml b/data/certificates/profiles/CERT_TS_A_AT.xml index d755465..f4e45a4 100644 --- a/data/certificates/profiles/CERT_TS_A_AT.xml +++ b/data/certificates/profiles/CERT_TS_A_AT.xml @@ -24,7 +24,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_TS_A_AT_IMP.xml b/data/certificates/profiles/CERT_TS_A_AT_IMP.xml index e05a2a3..e483d51 100644 --- a/data/certificates/profiles/CERT_TS_A_AT_IMP.xml +++ b/data/certificates/profiles/CERT_TS_A_AT_IMP.xml @@ -24,7 +24,7 @@ 01 FF FC  01 FF FF FF  02 FF FC  -02 FF FF FF  +02 FF FF FF FE  01 01   diff --git a/data/certificates/profiles/CERT_TS_B_AT.xml b/data/certificates/profiles/CERT_TS_B_AT.xml index ad11ffb..e7259c4 100644 --- a/data/certificates/profiles/CERT_TS_B_AT.xml +++ b/data/certificates/profiles/CERT_TS_B_AT.xml @@ -24,7 +24,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_TS_F_AT_IMP.xml b/data/certificates/profiles/CERT_TS_F_AT_IMP.xml index f464cd0..7a08289 100644 --- a/data/certificates/profiles/CERT_TS_F_AT_IMP.xml +++ b/data/certificates/profiles/CERT_TS_F_AT_IMP.xml @@ -24,7 +24,7 @@ 01 FF FC 01 FF FF FF 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 -- GitLab From 285983392300f6f19d7027c56dd33377c818f63e Mon Sep 17 00:00:00 2001 From: garciay Date: Mon, 19 Aug 2024 08:23:17 +0200 Subject: [PATCH 156/178] Add v2 AT certificates; Update certificates profiles --- data/certificates/Makefile | 16 ++--- data/certificates/profiles/CERT_IUT_A1_AT.xml | 6 +- .../profiles/CERT_IUT_A1_ATv2.xml | 37 +++++++++++ data/certificates/profiles/CERT_IUT_A2_AT.xml | 6 +- .../profiles/CERT_IUT_A2_ATv2.xml | 37 +++++++++++ data/certificates/profiles/CERT_IUT_A3_AT.xml | 3 +- .../profiles/CERT_IUT_A3_ATv2.xml | 35 +++++++++++ data/certificates/profiles/CERT_IUT_A4_AT.xml | 3 +- .../profiles/CERT_IUT_A4_ATv2.xml | 35 +++++++++++ data/certificates/profiles/CERT_IUT_A_AA.xml | 14 ++--- .../profiles/CERT_IUT_A_AA_A8.xml | 5 +- .../profiles/CERT_IUT_A_AC_AT.xml | 6 +- .../profiles/CERT_IUT_A_AC_ATv2.xml | 38 ++++++++++++ data/certificates/profiles/CERT_IUT_A_AT.xml | 4 -- .../profiles/CERT_IUT_A_AT_A8.xml | 3 +- .../profiles/CERT_IUT_A_AT_A8v2.xml | 41 +++++++++++++ .../profiles/CERT_IUT_A_AT_IMP.xml | 6 +- .../profiles/CERT_IUT_A_AT_IMPv2.xml | 37 +++++++++++ .../profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml | 4 -- .../profiles/CERT_IUT_A_AT_LOC_OUTSIDEv2.xml | 42 +++++++++++++ .../profiles/CERT_IUT_A_AT_NOCAM.xml | 1 - .../profiles/CERT_IUT_A_AT_NOCAMv2.xml | 35 +++++++++++ .../CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml | 2 - ...CERT_IUT_A_AT_NO_EMERGENCY_CONTAINERv2.xml | 36 +++++++++++ .../profiles/CERT_IUT_A_AT_PAST.xml | 4 -- .../profiles/CERT_IUT_A_AT_PASTv2.xml | 38 ++++++++++++ .../certificates/profiles/CERT_IUT_A_ATv2.xml | 38 ++++++++++++ .../profiles/CERT_IUT_A_B33_AT.xml | 6 +- .../profiles/CERT_IUT_A_B33_ATv2.xml | 37 +++++++++++ .../profiles/CERT_IUT_A_B3_AA.xml | 14 ++--- .../profiles/CERT_IUT_A_B3_AT.xml | 6 +- .../profiles/CERT_IUT_A_B3_ATv2.xml | 37 +++++++++++ .../profiles/CERT_IUT_A_B3_N_AT.xml | 6 +- .../profiles/CERT_IUT_A_B3_N_ATv2.xml | 37 +++++++++++ .../certificates/profiles/CERT_IUT_A_B_AA.xml | 14 ++--- .../certificates/profiles/CERT_IUT_A_B_AT.xml | 4 -- .../profiles/CERT_IUT_A_B_ATv2.xml | 37 +++++++++++ .../profiles/CERT_IUT_A_B_N_AT.xml | 4 -- .../profiles/CERT_IUT_A_B_N_ATv2.xml | 37 +++++++++++ .../profiles/CERT_IUT_A_C3_AT.xml | 6 +- .../profiles/CERT_IUT_A_C3_ATv2.xml | 38 ++++++++++++ .../profiles/CERT_IUT_A_CC_AT.xml | 6 +- .../profiles/CERT_IUT_A_CC_ATv2.xml | 38 ++++++++++++ data/certificates/profiles/CERT_IUT_A_MA.xml | 3 +- .../certificates/profiles/CERT_IUT_A_N_AA.xml | 14 ++--- .../certificates/profiles/CERT_IUT_A_N_AT.xml | 6 +- .../profiles/CERT_IUT_A_N_ATv2.xml | 38 ++++++++++++ data/certificates/profiles/CERT_IUT_A_RCA.xml | 18 +++--- data/certificates/profiles/CERT_IUT_B_AT.xml | 6 +- .../certificates/profiles/CERT_IUT_B_ATv2.xml | 37 +++++++++++ data/certificates/profiles/CERT_IUT_C1_AT.xml | 6 +- .../profiles/CERT_IUT_C1_ATv2.xml | 40 ++++++++++++ data/certificates/profiles/CERT_IUT_C2_AA.xml | 14 ++--- data/certificates/profiles/CERT_IUT_C2_AT.xml | 6 +- .../profiles/CERT_IUT_C2_ATv2.xml | 37 +++++++++++ data/certificates/profiles/CERT_IUT_C3_AA.xml | 17 +++--- .../certificates/profiles/CERT_IUT_CA1_AT.xml | 2 +- .../profiles/CERT_IUT_CA1_ATv2.xml | 37 +++++++++++ .../certificates/profiles/CERT_IUT_CA2_AT.xml | 2 +- .../profiles/CERT_IUT_CA2_ATv2.xml | 37 +++++++++++ .../certificates/profiles/CERT_IUT_CA3_AT.xml | 2 +- .../profiles/CERT_IUT_CAM_BO_02_AT.xml | 1 - .../profiles/CERT_IUT_CAM_BO_02_ATv2.xml | 30 +++++++++ .../profiles/CERT_IUT_CAM_BO_03_AT.xml | 1 - .../profiles/CERT_IUT_CAM_BO_03_ATv2.xml | 30 +++++++++ data/certificates/profiles/CERT_IUT_CA_AA.xml | 4 +- data/certificates/profiles/CERT_IUT_CC_AA.xml | 14 ++--- data/certificates/profiles/CERT_IUT_C_AT.xml | 6 +- .../certificates/profiles/CERT_IUT_C_AT_8.xml | 6 +- .../profiles/CERT_IUT_C_AT_8v2.xml | 61 +++++++++++++++++++ .../certificates/profiles/CERT_IUT_C_ATv2.xml | 40 ++++++++++++ data/certificates/profiles/CERT_IUT_C_RCA.xml | 14 ++--- .../profiles/CERT_IUT_DENM_BO_01_AT.xml | 2 - .../profiles/CERT_IUT_DENM_BO_01_ATv2.xml | 31 ++++++++++ .../profiles/CERT_IUT_DENM_BO_02_AT.xml | 2 - .../profiles/CERT_IUT_DENM_BO_02_ATv2.xml | 31 ++++++++++ data/certificates/profiles/CERT_IUT_D_AA.xml | 14 ++--- data/certificates/profiles/CERT_IUT_D_AT.xml | 6 +- .../certificates/profiles/CERT_IUT_D_AT_8.xml | 2 +- .../profiles/CERT_IUT_D_AT_8v2.xml | 46 ++++++++++++++ .../certificates/profiles/CERT_IUT_D_ATv2.xml | 42 +++++++++++++ data/certificates/profiles/CERT_IUT_E_AT.xml | 6 +- .../certificates/profiles/CERT_IUT_E_AT_8.xml | 6 +- .../profiles/CERT_IUT_E_AT_8v2.xml | 44 +++++++++++++ .../certificates/profiles/CERT_IUT_E_ATv2.xml | 37 +++++++++++ .../profiles/CERT_IUT_IVI_SSP_1_AT.xml | 2 +- .../CERT_IUT_IVI_SSP_ISO14823_1_AT.xml | 2 +- .../CERT_IUT_IVI_SSP_ISO14823_2_AT.xml | 2 +- .../CERT_IUT_IVI_SSP_ISO14823_3_AT.xml | 2 +- .../CERT_IUT_IVI_SSP_ISO14823_4_AT.xml | 2 +- .../CERT_IUT_IVI_SSP_ISO14823_5_AT.xml | 2 +- .../CERT_IUT_IVI_SSP_ISO14823_6_AT.xml | 2 +- .../profiles/CERT_IUT_IVI_SSP_LC_AT.xml | 2 +- .../profiles/CERT_IUT_IVI_SSP_LS_AT.xml | 2 +- .../profiles/CERT_IUT_IVI_SSP_NEG_AT.xml | 2 +- .../profiles/CERT_IUT_IVI_SSP_NONE_AT.xml | 2 +- .../profiles/CERT_IUT_IVI_SSP_RCC_AT.xml | 2 +- .../profiles/CERT_IUT_IVI_SSP_SAEJ2540_AT.xml | 2 +- .../profiles/CERT_IUT_IVI_SSP_TC_AT.xml | 2 +- .../CERT_IUT_IVI_SSP_VIENNACONV_AT.xml | 2 +- .../profiles/CERT_IUT_MAP_SSP_1_AT.xml | 2 +- .../profiles/CERT_IUT_MAP_SSP_2_AT.xml | 2 +- .../profiles/CERT_IUT_MAP_SSP_NONE_AT.xml | 2 +- .../profiles/CERT_IUT_RTCM_SSP_NONE_AT.xml | 2 +- .../profiles/CERT_IUT_SPAT_SSP_ALL_AT.xml | 2 +- .../profiles/CERT_IUT_SPAT_SSP_NONE_AT.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_01.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_02.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_03.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_04.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_05.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_06.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_07.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_08.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_09.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_10.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_11.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_12.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_13.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_14.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_15.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_16.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_17.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_18.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_NONE_AT.xml | 2 +- .../profiles/CERT_IUT_SRM_SSP_REQ_NONE_AT.xml | 2 +- .../profiles/CERT_IUT_SSM_SSP_AT.xml | 2 +- .../CERT_TS_AA_AUTHVAL_RCV_02_BI_01.xml | 2 +- .../CERT_TS_AA_AUTHVAL_RCV_02_BI_02.xml | 2 +- .../CERT_TS_AA_AUTHVAL_RCV_02_BI_03.xml | 2 +- data/certificates/profiles/CERT_TS_A_AA.xml | 14 ++--- data/certificates/profiles/CERT_TS_A_AA_B.xml | 15 ++--- data/certificates/profiles/CERT_TS_A_AT.xml | 6 +- .../profiles/CERT_TS_A_AT_IMP.xml | 6 +- .../profiles/CERT_TS_A_AT_IMP_BO.xml | 2 +- .../profiles/CERT_TS_A_AT_IMP_BOv2.xml | 38 ++++++++++++ .../profiles/CERT_TS_A_AT_IMPv2.xml | 37 +++++++++++ data/certificates/profiles/CERT_TS_A_ATv2.xml | 38 ++++++++++++ data/certificates/profiles/CERT_TS_A_EA.xml | 2 +- .../CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_01.xml | 2 +- .../CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_02.xml | 2 +- .../CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_03.xml | 2 +- data/certificates/profiles/CERT_TS_A_EC.xml | 2 +- data/certificates/profiles/CERT_TS_B1_AT.xml | 2 +- data/certificates/profiles/CERT_TS_B_AT.xml | 6 +- data/certificates/profiles/CERT_TS_B_ATv2.xml | 38 ++++++++++++ .../profiles/CERT_TS_CAM_BO_02_ATv2.xml | 31 ++++++++++ .../profiles/CERT_TS_CAM_BO_03_ATv2.xml | 30 +++++++++ .../profiles/CERT_TS_DENM_BO_01_ATv2.xml | 28 +++++++++ .../profiles/CERT_TS_DENM_BO_02_ATv2.xml | 28 +++++++++ .../profiles/CERT_TS_EC_ENR_RCV_02_BI_01.xml | 2 +- .../profiles/CERT_TS_EC_ENR_RCV_02_BI_02.xml | 2 +- .../profiles/CERT_TS_EC_ENR_RCV_02_BI_03.xml | 2 +- data/certificates/profiles/CERT_TS_F3_AT.xml | 4 +- .../profiles/CERT_TS_F3_AT_IMP.xml | 2 +- .../profiles/CERT_TS_F3_AT_IMPv2.xml | 37 +++++++++++ .../certificates/profiles/CERT_TS_F3_ATv2.xml | 37 +++++++++++ data/certificates/profiles/CERT_TS_FA3_AA.xml | 15 ++--- data/certificates/profiles/CERT_TS_FA3_AT.xml | 4 +- .../profiles/CERT_TS_FA3_ATv2.xml | 38 ++++++++++++ data/certificates/profiles/CERT_TS_FA_AA.xml | 15 ++--- data/certificates/profiles/CERT_TS_FA_AT.xml | 4 +- .../certificates/profiles/CERT_TS_FA_ATv2.xml | 38 ++++++++++++ data/certificates/profiles/CERT_TS_F_AT.xml | 4 +- .../profiles/CERT_TS_F_AT_IMP.xml | 6 +- .../profiles/CERT_TS_F_AT_IMPv2.xml | 38 ++++++++++++ data/certificates/profiles/CERT_TS_F_ATv2.xml | 38 ++++++++++++ 167 files changed, 2030 insertions(+), 332 deletions(-) create mode 100644 data/certificates/profiles/CERT_IUT_A1_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A2_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A3_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A4_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_AC_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_AT_A8v2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_AT_IMPv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDEv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_AT_NOCAMv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINERv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_AT_PASTv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_B33_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_B3_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_B3_N_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_B_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_B_N_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_C3_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_CC_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_A_N_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_B_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_C1_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_C2_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_CA1_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_CA2_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_CAM_BO_02_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_CAM_BO_03_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_C_AT_8v2.xml create mode 100644 data/certificates/profiles/CERT_IUT_C_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_DENM_BO_01_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_DENM_BO_02_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_D_AT_8v2.xml create mode 100644 data/certificates/profiles/CERT_IUT_D_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_E_AT_8v2.xml create mode 100644 data/certificates/profiles/CERT_IUT_E_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml create mode 100644 data/certificates/profiles/CERT_TS_A_AT_IMPv2.xml create mode 100644 data/certificates/profiles/CERT_TS_A_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_B_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_CAM_BO_02_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_CAM_BO_03_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_02_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml create mode 100644 data/certificates/profiles/CERT_TS_F3_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_FA3_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_FA_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_F_AT_IMPv2.xml create mode 100644 data/certificates/profiles/CERT_TS_F_ATv2.xml diff --git a/data/certificates/Makefile b/data/certificates/Makefile index 36d75dd..6cb2cc8 100644 --- a/data/certificates/Makefile +++ b/data/certificates/Makefile @@ -52,10 +52,12 @@ $(deps): $(depdir)/%.dep : $(in)/%.xml $(certificates_xer) : $(xsl_cvt) certs_iut_at = $(filter $(outdir)/CERT_IUT_%_AT.oer, $(certificates_oer)) +certs_iut_at += $(filter $(outdir)/CERT_IUT_%_ATv2.oer, $(certificates_oer)) vkeys_iut_at = $(patsubst %.oer, %.vkey, $(certs_iut_at)) ekeys_iut_at = $(patsubst %.oer, %.ekey, $(certs_iut_at)) -certs_iut_at_imp = $(filter $(outdir)/CERT_IUT_%_AT_IMP.oer, $(certificates_oer)) +certs_iut_at_imp = $(filter $(outdir)/CERT_IUT_%_AT_IMP%.oer, $(certificates_oer)) +certs_iut_at_imp += $(filter $(outdir)/CERT_IUT_%_AT_IMPv2.oer, $(certificates_oer)) vkeys_iut_at_imp = $(patsubst %.oer, %.vkey, $(certs_iut_at_imp)) ekeys_iut_at_imp = $(patsubst %.oer, %.ekey, $(certs_iut_at_imp)) @@ -81,12 +83,12 @@ $(iutdir)/index.lst: $(certs_iut) $(vkeys_iut_at) $(ekeys_iut_at) $(vkeys_iut_at_imp) $(ekeys_iut_at_imp): -IUT_TC23 = CERT_IUT_C1_AT.oer CERT_IUT_C1_AT.vkey CERT_IUT_C1_AT.ekey CERT_IUT_CC_AA.oer CERT_IUT_C_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer CERT_IUT_A_AA.oer -IUT_TC24 = CERT_IUT_C2_AT.oer CERT_IUT_C2_AT.vkey CERT_IUT_C2_AT.ekey CERT_IUT_C2_AA.oer CERT_IUT_C_RCA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer CERT_IUT_A_AA.oer -IUT_TC25 = CERT_IUT_A1_AT.oer CERT_IUT_A1_AT.vkey CERT_IUT_A1_AT.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer -IUT_TC26 = CERT_IUT_A2_AT.oer CERT_IUT_A2_AT.vkey CERT_IUT_A2_AT.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer -IUT_TC27 = CERT_IUT_A3_AT.oer CERT_IUT_A3_AT.vkey CERT_IUT_A3_AT.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer -IUT_TC28 = CERT_IUT_A_AT_A8.oer CERT_IUT_A_AT_A8.vkey CERT_IUT_A_AT_A8.ekey CERT_IUT_A_AA_A8.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer CERT_IUT_A_AA.oer +IUT_TC23 = CERT_IUT_C1_AT.oer CERT_IUT_C1_AT.vkey CERT_IUT_C1_AT.ekey CERT_IUT_C1_ATv2.oer CERT_IUT_C1_ATv2.vkey CERT_IUT_C1_ATv2.ekey CERT_IUT_CC_AA.oer CERT_IUT_C_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer CERT_TS_A_ATv2.oer CERT_TS_A_AT_IMPv2.oer CERT_IUT_A_AA.oer +IUT_TC24 = CERT_IUT_C2_AT.oer CERT_IUT_C2_AT.vkey CERT_IUT_C2_AT.ekey CERT_IUT_C2_ATv2.oer CERT_IUT_C2_ATv2.vkey CERT_IUT_C2_ATv2.ekey CERT_IUT_C2_AA.oer CERT_IUT_C_RCA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer CERT_TS_A_ATv2.oer CERT_TS_A_ATv2_IMP.oer CERT_IUT_A_AA.oer +IUT_TC25 = CERT_IUT_A1_AT.oer CERT_IUT_A1_AT.vkey CERT_IUT_A1_AT.ekey CERT_IUT_A1_ATv2.oer CERT_IUT_A1_ATv2.vkey CERT_IUT_A1_ATv2.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer CERT_TS_A_ATv2.oer CERT_TS_A_AT_IMPv2.oer +IUT_TC26 = CERT_IUT_A2_AT.oer CERT_IUT_A2_AT.vkey CERT_IUT_A2_AT.ekey CERT_IUT_A2_ATv2.oer CERT_IUT_A2_ATv2.vkey CERT_IUT_A2_ATv2.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer CERT_TS_A_ATv2.oer CERT_TS_A_AT_IMPv2.oer +IUT_TC27 = CERT_IUT_A3_AT.oer CERT_IUT_A3_AT.vkey CERT_IUT_A3_AT.ekey CERT_IUT_A3_ATv2.oer CERT_IUT_A3_ATv2.vkey CERT_IUT_A3_ATv2.ekey CERT_IUT_A_AA.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer CERT_TS_A_ATv2.oer CERT_TS_A_AT_IMPv2.oer +IUT_TC28 = CERT_IUT_A_AT_A8.oer CERT_IUT_A_AT_A8.vkey CERT_IUT_A_AT_A8.ekey CERT_IUT_A_AT_A8v2.oer CERT_IUT_A_AT_A8v2.vkey CERT_IUT_A_AT_A8v2.ekey CERT_IUT_A_AA_A8.oer CERT_IUT_A_RCA.oer CERT_TS_A_AT.oer CERT_TS_A_AT_IMP.oer CERT_TS_A_ATv2.oer CERT_TS_A_AT_IMPv2.oer CERT_IUT_A_AA.oer IUT_TCS = TC23 TC24 TC25 TC26 TC27 TC28 diff --git a/data/certificates/profiles/CERT_IUT_A1_AT.xml b/data/certificates/profiles/CERT_IUT_A1_AT.xml index ec87672..127f6bb 100644 --- a/data/certificates/profiles/CERT_IUT_A1_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A1_AT.xml @@ -11,7 +11,7 @@ - > + @@ -22,10 +22,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_A1_ATv2.xml b/data/certificates/profiles/CERT_IUT_A1_ATv2.xml new file mode 100644 index 0000000..bfcb96e --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A1_ATv2.xml @@ -0,0 +1,37 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A2_AT.xml b/data/certificates/profiles/CERT_IUT_A2_AT.xml index 0c4408e..dbd7fa0 100644 --- a/data/certificates/profiles/CERT_IUT_A2_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A2_AT.xml @@ -11,7 +11,7 @@ - > + @@ -22,10 +22,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_A2_ATv2.xml b/data/certificates/profiles/CERT_IUT_A2_ATv2.xml new file mode 100644 index 0000000..ea5085f --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A2_ATv2.xml @@ -0,0 +1,37 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A3_AT.xml b/data/certificates/profiles/CERT_IUT_A3_AT.xml index e9d5f27..e649069 100644 --- a/data/certificates/profiles/CERT_IUT_A3_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A3_AT.xml @@ -11,7 +11,7 @@ - > + @@ -22,7 +22,6 @@ 01 FF FF FF - 02 FF FF FF FE diff --git a/data/certificates/profiles/CERT_IUT_A3_ATv2.xml b/data/certificates/profiles/CERT_IUT_A3_ATv2.xml new file mode 100644 index 0000000..2ac26d2 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A3_ATv2.xml @@ -0,0 +1,35 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + + 02 FF FF FF FE + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A4_AT.xml b/data/certificates/profiles/CERT_IUT_A4_AT.xml index fd9f478..e80c494 100644 --- a/data/certificates/profiles/CERT_IUT_A4_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A4_AT.xml @@ -11,7 +11,7 @@ - > + @@ -21,7 +21,6 @@ 01 FF FC - 02 FF FC diff --git a/data/certificates/profiles/CERT_IUT_A4_ATv2.xml b/data/certificates/profiles/CERT_IUT_A4_ATv2.xml new file mode 100644 index 0000000..48dc5a5 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A4_ATv2.xml @@ -0,0 +1,35 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_AA.xml b/data/certificates/profiles/CERT_IUT_A_AA.xml index cf69f00..f82309d 100644 --- a/data/certificates/profiles/CERT_IUT_A_AA.xml +++ b/data/certificates/profiles/CERT_IUT_A_AA.xml @@ -12,7 +12,7 @@ - > + @@ -23,17 +23,17 @@ - - - - - + 01 D0/FF 1F + 01 C0/FF 3F + 01 FF FF FF FF F8/FF 00 00 00 00 07 + 02 FF FF FF/FF 00 00 01 + 01/FF + 01/FF - 01 32 02 32 diff --git a/data/certificates/profiles/CERT_IUT_A_AA_A8.xml b/data/certificates/profiles/CERT_IUT_A_AA_A8.xml index 368521f..141786d 100644 --- a/data/certificates/profiles/CERT_IUT_A_AA_A8.xml +++ b/data/certificates/profiles/CERT_IUT_A_AA_A8.xml @@ -12,7 +12,7 @@ - > + @@ -29,9 +29,10 @@ + + - 01 32 02 32 diff --git a/data/certificates/profiles/CERT_IUT_A_AC_AT.xml b/data/certificates/profiles/CERT_IUT_A_AC_AT.xml index 2f164e4..4a9c724 100644 --- a/data/certificates/profiles/CERT_IUT_A_AC_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_AC_AT.xml @@ -12,7 +12,7 @@ - > + @@ -23,10 +23,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_A_AC_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_AC_ATv2.xml new file mode 100644 index 0000000..b04bf37 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_AC_ATv2.xml @@ -0,0 +1,38 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_AT.xml b/data/certificates/profiles/CERT_IUT_A_AT.xml index 260a5c3..2f6613c 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT.xml @@ -23,10 +23,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_A_AT_A8.xml b/data/certificates/profiles/CERT_IUT_A_AT_A8.xml index e43c373..bacb4f6 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_A8.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_A8.xml @@ -12,7 +12,7 @@ - > + @@ -29,7 +29,6 @@ 00 00 01 FF FC - 02 FF FC diff --git a/data/certificates/profiles/CERT_IUT_A_AT_A8v2.xml b/data/certificates/profiles/CERT_IUT_A_AT_A8v2.xml new file mode 100644 index 0000000..2f9666b --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_AT_A8v2.xml @@ -0,0 +1,41 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 00 + 00 + 00 + 00 + 00 + 00 + 00 + 02 FF FC + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml b/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml index 2027e60..cec52ff 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_IMP.xml @@ -12,7 +12,7 @@ -> + @@ -23,10 +23,6 @@ 01 FF FC  01 FF FF FF  -02 FF FC  -02 FF FF FF FE  - 01 - 01   diff --git a/data/certificates/profiles/CERT_IUT_A_AT_IMPv2.xml b/data/certificates/profiles/CERT_IUT_A_AT_IMPv2.xml new file mode 100644 index 0000000..83d251c --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_AT_IMPv2.xml @@ -0,0 +1,37 @@ + + +3 + + + + + + + + + + + + + + + + + + + + +02 FF FC  +02 FF FF FF FE  + 01 + 01 +   + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml b/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml index 463b766..55ed102 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDE.xml @@ -23,10 +23,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDEv2.xml b/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDEv2.xml new file mode 100644 index 0000000..8eb31f5 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDEv2.xml @@ -0,0 +1,42 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml b/data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml index aa02b8f..90db044 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_NOCAM.xml @@ -22,7 +22,6 @@ 01 FF FF FF - 02 FF FF FF FE diff --git a/data/certificates/profiles/CERT_IUT_A_AT_NOCAMv2.xml b/data/certificates/profiles/CERT_IUT_A_AT_NOCAMv2.xml new file mode 100644 index 0000000..93a0eea --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_AT_NOCAMv2.xml @@ -0,0 +1,35 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FF FF FE + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml b/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml index bc96045..9908e61 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINER.xml @@ -23,8 +23,6 @@ 01 FD FC 01 FF FF FF - 02 FD FC - 02 FF FF FF FE diff --git a/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINERv2.xml b/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINERv2.xml new file mode 100644 index 0000000..2e8263b --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINERv2.xml @@ -0,0 +1,36 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FD FC + 02 FF FF FF FE + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml b/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml index 4b03f3d..26c2c8e 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_PAST.xml @@ -23,10 +23,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_A_AT_PASTv2.xml b/data/certificates/profiles/CERT_IUT_A_AT_PASTv2.xml new file mode 100644 index 0000000..2db25d8 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_AT_PASTv2.xml @@ -0,0 +1,38 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_ATv2.xml new file mode 100644 index 0000000..72f5684 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_ATv2.xml @@ -0,0 +1,38 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_B33_AT.xml b/data/certificates/profiles/CERT_IUT_A_B33_AT.xml index 8a126ec..fbd9d9a 100644 --- a/data/certificates/profiles/CERT_IUT_A_B33_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B33_AT.xml @@ -11,7 +11,7 @@ - > + @@ -22,10 +22,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B33_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_B33_ATv2.xml new file mode 100644 index 0000000..dc3a3a5 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_B33_ATv2.xml @@ -0,0 +1,37 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_B3_AA.xml b/data/certificates/profiles/CERT_IUT_A_B3_AA.xml index 6ff767a..72b3d14 100644 --- a/data/certificates/profiles/CERT_IUT_A_B3_AA.xml +++ b/data/certificates/profiles/CERT_IUT_A_B3_AA.xml @@ -12,7 +12,7 @@ - > + @@ -23,17 +23,17 @@ - - - - - + 01 D0/FF 1F + 01 C0/FF 3F + 01 FF FF FF FF F8/FF 00 00 00 00 07 + 02 FF FF FF/FF 00 00 01 + 01/FF + 01/FF - 01 32 02 32 diff --git a/data/certificates/profiles/CERT_IUT_A_B3_AT.xml b/data/certificates/profiles/CERT_IUT_A_B3_AT.xml index aec7433..713862a 100644 --- a/data/certificates/profiles/CERT_IUT_A_B3_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B3_AT.xml @@ -11,7 +11,7 @@ - > + @@ -22,10 +22,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B3_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_B3_ATv2.xml new file mode 100644 index 0000000..076305f --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_B3_ATv2.xml @@ -0,0 +1,37 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml b/data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml index 36408b7..4ff8b15 100644 --- a/data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B3_N_AT.xml @@ -11,7 +11,7 @@ - > + @@ -22,10 +22,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B3_N_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_B3_N_ATv2.xml new file mode 100644 index 0000000..22e6f90 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_B3_N_ATv2.xml @@ -0,0 +1,37 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_B_AA.xml b/data/certificates/profiles/CERT_IUT_A_B_AA.xml index 5031e34..f46697a 100644 --- a/data/certificates/profiles/CERT_IUT_A_B_AA.xml +++ b/data/certificates/profiles/CERT_IUT_A_B_AA.xml @@ -12,7 +12,7 @@ - > + @@ -23,17 +23,17 @@ - - - - - + 01 D0/FF 1F + 01 C0/FF 3F + 01 FF FF FF FF F8/FF 00 00 00 00 07 + 02 FF FF FF/FF 00 00 01 + 01/FF + 01/FF - 01 32 02 32 diff --git a/data/certificates/profiles/CERT_IUT_A_B_AT.xml b/data/certificates/profiles/CERT_IUT_A_B_AT.xml index cbd8f40..11cdd6d 100644 --- a/data/certificates/profiles/CERT_IUT_A_B_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B_AT.xml @@ -22,10 +22,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_B_ATv2.xml new file mode 100644 index 0000000..e68caff --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_B_ATv2.xml @@ -0,0 +1,37 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_B_N_AT.xml b/data/certificates/profiles/CERT_IUT_A_B_N_AT.xml index b4fcd72..ab21ef5 100644 --- a/data/certificates/profiles/CERT_IUT_A_B_N_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_B_N_AT.xml @@ -22,10 +22,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B_N_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_B_N_ATv2.xml new file mode 100644 index 0000000..cdee710 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_B_N_ATv2.xml @@ -0,0 +1,37 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_C3_AT.xml b/data/certificates/profiles/CERT_IUT_A_C3_AT.xml index 6eba0da..beda5b1 100644 --- a/data/certificates/profiles/CERT_IUT_A_C3_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_C3_AT.xml @@ -12,7 +12,7 @@ - > + @@ -23,10 +23,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_A_C3_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_C3_ATv2.xml new file mode 100644 index 0000000..14800d0 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_C3_ATv2.xml @@ -0,0 +1,38 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_CC_AT.xml b/data/certificates/profiles/CERT_IUT_A_CC_AT.xml index 3ed76e5..fd3c9e6 100644 --- a/data/certificates/profiles/CERT_IUT_A_CC_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_CC_AT.xml @@ -12,7 +12,7 @@ - > + @@ -23,10 +23,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_A_CC_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_CC_ATv2.xml new file mode 100644 index 0000000..f541783 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_CC_ATv2.xml @@ -0,0 +1,38 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_MA.xml b/data/certificates/profiles/CERT_IUT_A_MA.xml index f37c955..c79e51a 100644 --- a/data/certificates/profiles/CERT_IUT_A_MA.xml +++ b/data/certificates/profiles/CERT_IUT_A_MA.xml @@ -12,7 +12,7 @@ - > + @@ -33,7 +33,6 @@ - 01 32 02 32 diff --git a/data/certificates/profiles/CERT_IUT_A_N_AA.xml b/data/certificates/profiles/CERT_IUT_A_N_AA.xml index 55eafa3..4532107 100644 --- a/data/certificates/profiles/CERT_IUT_A_N_AA.xml +++ b/data/certificates/profiles/CERT_IUT_A_N_AA.xml @@ -12,7 +12,7 @@ - > + @@ -23,17 +23,17 @@ - - - - - + 01 D0/FF 1F + 01 C0/FF 3F + 01 FF FF FF FF F8/FF 00 00 00 00 07 + 02 FF FF FF/FF 00 00 01 + 01/FF + 01/FF - 01 32 02 32 diff --git a/data/certificates/profiles/CERT_IUT_A_N_AT.xml b/data/certificates/profiles/CERT_IUT_A_N_AT.xml index 0e35ed5..a8a9723 100644 --- a/data/certificates/profiles/CERT_IUT_A_N_AT.xml +++ b/data/certificates/profiles/CERT_IUT_A_N_AT.xml @@ -12,7 +12,7 @@ - > + @@ -23,10 +23,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_A_N_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_N_ATv2.xml new file mode 100644 index 0000000..da8d59b --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_A_N_ATv2.xml @@ -0,0 +1,38 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_A_RCA.xml b/data/certificates/profiles/CERT_IUT_A_RCA.xml index 8c47027..46115c3 100644 --- a/data/certificates/profiles/CERT_IUT_A_RCA.xml +++ b/data/certificates/profiles/CERT_IUT_A_RCA.xml @@ -1,7 +1,7 @@ 3 - + @@ -16,15 +16,16 @@ - - - - - + 01 D0/FF 1F + 01 C0/FF 3F + 01 FF FF FF FF F8/FF 00 00 00 00 07 + 02 FF FF FF/FF 00 00 01 + 01/FF + 01/FF + - - 01 C0/FF 3F + 02 C0/FF 3F @@ -34,7 +35,6 @@ - 01 3E/FF C1 02 3E/FF C1 diff --git a/data/certificates/profiles/CERT_IUT_B_AT.xml b/data/certificates/profiles/CERT_IUT_B_AT.xml index 90627d2..6fe37c1 100644 --- a/data/certificates/profiles/CERT_IUT_B_AT.xml +++ b/data/certificates/profiles/CERT_IUT_B_AT.xml @@ -11,7 +11,7 @@ - > + @@ -22,10 +22,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_B_ATv2.xml b/data/certificates/profiles/CERT_IUT_B_ATv2.xml new file mode 100644 index 0000000..2da6442 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_B_ATv2.xml @@ -0,0 +1,37 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_C1_AT.xml b/data/certificates/profiles/CERT_IUT_C1_AT.xml index 266e231..9a2c37e 100644 --- a/data/certificates/profiles/CERT_IUT_C1_AT.xml +++ b/data/certificates/profiles/CERT_IUT_C1_AT.xml @@ -11,7 +11,7 @@ - > + @@ -22,10 +22,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_C1_ATv2.xml b/data/certificates/profiles/CERT_IUT_C1_ATv2.xml new file mode 100644 index 0000000..f8355ab --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_C1_ATv2.xml @@ -0,0 +1,40 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_C2_AA.xml b/data/certificates/profiles/CERT_IUT_C2_AA.xml index 5de7c65..31b3c55 100644 --- a/data/certificates/profiles/CERT_IUT_C2_AA.xml +++ b/data/certificates/profiles/CERT_IUT_C2_AA.xml @@ -11,7 +11,7 @@ - > + @@ -22,17 +22,17 @@ - - - - - + 01 D0/FF 1F + 01 C0/FF 3F + 01 FF FF FF FF F8/FF 00 00 00 00 07 + 02 FF FF FF/FF 00 00 01 + 01/FF + 01/FF - 01 32 02 32 diff --git a/data/certificates/profiles/CERT_IUT_C2_AT.xml b/data/certificates/profiles/CERT_IUT_C2_AT.xml index fbd8394..724c2f8 100644 --- a/data/certificates/profiles/CERT_IUT_C2_AT.xml +++ b/data/certificates/profiles/CERT_IUT_C2_AT.xml @@ -11,7 +11,7 @@ - > + @@ -22,10 +22,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_C2_ATv2.xml b/data/certificates/profiles/CERT_IUT_C2_ATv2.xml new file mode 100644 index 0000000..64fc4ae --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_C2_ATv2.xml @@ -0,0 +1,37 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_C3_AA.xml b/data/certificates/profiles/CERT_IUT_C3_AA.xml index 225a4c9..177e8e9 100644 --- a/data/certificates/profiles/CERT_IUT_C3_AA.xml +++ b/data/certificates/profiles/CERT_IUT_C3_AA.xml @@ -11,7 +11,7 @@ - > + @@ -22,17 +22,16 @@ - - - - - - - + 01 D0/FF 1F + 01 C0/FF 3F + 01 FF FF FF FF F8/FF 00 00 00 00 07 + 02 FF FF FF/FF 00 00 01 + 01/FF + 01/FF - 01 32 + 02 32 diff --git a/data/certificates/profiles/CERT_IUT_CA1_AT.xml b/data/certificates/profiles/CERT_IUT_CA1_AT.xml index d101484..aab01d8 100644 --- a/data/certificates/profiles/CERT_IUT_CA1_AT.xml +++ b/data/certificates/profiles/CERT_IUT_CA1_AT.xml @@ -11,7 +11,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_CA1_ATv2.xml b/data/certificates/profiles/CERT_IUT_CA1_ATv2.xml new file mode 100644 index 0000000..24e4e74 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_CA1_ATv2.xml @@ -0,0 +1,37 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_CA2_AT.xml b/data/certificates/profiles/CERT_IUT_CA2_AT.xml index d03f1c1..8aaeaff 100644 --- a/data/certificates/profiles/CERT_IUT_CA2_AT.xml +++ b/data/certificates/profiles/CERT_IUT_CA2_AT.xml @@ -11,7 +11,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_CA2_ATv2.xml b/data/certificates/profiles/CERT_IUT_CA2_ATv2.xml new file mode 100644 index 0000000..c8c030a --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_CA2_ATv2.xml @@ -0,0 +1,37 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_CA3_AT.xml b/data/certificates/profiles/CERT_IUT_CA3_AT.xml index f582c2a..075bd26 100644 --- a/data/certificates/profiles/CERT_IUT_CA3_AT.xml +++ b/data/certificates/profiles/CERT_IUT_CA3_AT.xml @@ -11,7 +11,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_02_AT.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_02_AT.xml index be6551e..3c2f9bc 100644 --- a/data/certificates/profiles/CERT_IUT_CAM_BO_02_AT.xml +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_02_AT.xml @@ -18,7 +18,6 @@ 01 BF FC - 02 BF FC diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_02_ATv2.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_02_ATv2.xml new file mode 100644 index 0000000..6b8eb7f --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_02_ATv2.xml @@ -0,0 +1,30 @@ + + + 2 + + + + + + + + + + + + + + + 02 BF FC + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_03_AT.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_03_AT.xml index f8620d5..7e6926f 100644 --- a/data/certificates/profiles/CERT_IUT_CAM_BO_03_AT.xml +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_03_AT.xml @@ -18,7 +18,6 @@ 01 DF FC - 02 DF FC diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_03_ATv2.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_03_ATv2.xml new file mode 100644 index 0000000..61f8f3a --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_03_ATv2.xml @@ -0,0 +1,30 @@ + + + 2 + + + + + + + + + + + + + + + 02 DF FC + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_CA_AA.xml b/data/certificates/profiles/CERT_IUT_CA_AA.xml index c61b3d9..0dea0fa 100644 --- a/data/certificates/profiles/CERT_IUT_CA_AA.xml +++ b/data/certificates/profiles/CERT_IUT_CA_AA.xml @@ -11,7 +11,7 @@ - > + @@ -32,7 +32,7 @@ - 01 32 + 02 32 diff --git a/data/certificates/profiles/CERT_IUT_CC_AA.xml b/data/certificates/profiles/CERT_IUT_CC_AA.xml index 470e7f3..a9e1889 100644 --- a/data/certificates/profiles/CERT_IUT_CC_AA.xml +++ b/data/certificates/profiles/CERT_IUT_CC_AA.xml @@ -11,7 +11,7 @@ - > + @@ -22,17 +22,17 @@ - - - - - + 01 D0/FF 1F + 01 C0/FF 3F + 01 FF FF FF FF F8/FF 00 00 00 00 07 + 02 FF FF FF/FF 00 00 01 + 01/FF + 01/FF - 01 32 02 32 diff --git a/data/certificates/profiles/CERT_IUT_C_AT.xml b/data/certificates/profiles/CERT_IUT_C_AT.xml index e3ef3e2..f7180f2 100644 --- a/data/certificates/profiles/CERT_IUT_C_AT.xml +++ b/data/certificates/profiles/CERT_IUT_C_AT.xml @@ -11,7 +11,7 @@ - > + @@ -22,10 +22,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_C_AT_8.xml b/data/certificates/profiles/CERT_IUT_C_AT_8.xml index 4d65b01..fbc7b6b 100644 --- a/data/certificates/profiles/CERT_IUT_C_AT_8.xml +++ b/data/certificates/profiles/CERT_IUT_C_AT_8.xml @@ -11,7 +11,7 @@ - > + @@ -22,10 +22,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_C_AT_8v2.xml b/data/certificates/profiles/CERT_IUT_C_AT_8v2.xml new file mode 100644 index 0000000..6eb10b8 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_C_AT_8v2.xml @@ -0,0 +1,61 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF + 01 + 01 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_C_ATv2.xml b/data/certificates/profiles/CERT_IUT_C_ATv2.xml new file mode 100644 index 0000000..469efa2 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_C_ATv2.xml @@ -0,0 +1,40 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF + 01 + 01 + + + + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_C_RCA.xml b/data/certificates/profiles/CERT_IUT_C_RCA.xml index 655ba4f..8c8bc54 100644 --- a/data/certificates/profiles/CERT_IUT_C_RCA.xml +++ b/data/certificates/profiles/CERT_IUT_C_RCA.xml @@ -11,7 +11,7 @@ - > + @@ -22,11 +22,12 @@ - - - - - + 01 D0/FF 1F + 01 C0/FF 3F + 01 FF FF FF FF F8/FF 00 00 00 00 07 + 02 FF FF FF/FF 00 00 01 + 01/FF + 01/FF @@ -36,7 +37,6 @@ 02 FE/FF 01 - 01 01 38 diff --git a/data/certificates/profiles/CERT_IUT_DENM_BO_01_AT.xml b/data/certificates/profiles/CERT_IUT_DENM_BO_01_AT.xml index df905d4..c36a7ad 100644 --- a/data/certificates/profiles/CERT_IUT_DENM_BO_01_AT.xml +++ b/data/certificates/profiles/CERT_IUT_DENM_BO_01_AT.xml @@ -19,8 +19,6 @@ 01 FF FC 01 7F FF FF - 02 FF FC - 02 7F FF FF diff --git a/data/certificates/profiles/CERT_IUT_DENM_BO_01_ATv2.xml b/data/certificates/profiles/CERT_IUT_DENM_BO_01_ATv2.xml new file mode 100644 index 0000000..c025d63 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_DENM_BO_01_ATv2.xml @@ -0,0 +1,31 @@ + + + 2 + + + + + + + + + + + + + + + 02 FF FC + 02 7F FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_DENM_BO_02_AT.xml b/data/certificates/profiles/CERT_IUT_DENM_BO_02_AT.xml index 5392ed7..1aeeca0 100644 --- a/data/certificates/profiles/CERT_IUT_DENM_BO_02_AT.xml +++ b/data/certificates/profiles/CERT_IUT_DENM_BO_02_AT.xml @@ -19,8 +19,6 @@ 01 FF FC 01 BF FF FF - 02 FF FC - 02 BF FF FF diff --git a/data/certificates/profiles/CERT_IUT_DENM_BO_02_ATv2.xml b/data/certificates/profiles/CERT_IUT_DENM_BO_02_ATv2.xml new file mode 100644 index 0000000..7a5f46a --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_DENM_BO_02_ATv2.xml @@ -0,0 +1,31 @@ + + + 2 + + + + + + + + + + + + + + + 02 FF FC + 02 BF FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_D_AA.xml b/data/certificates/profiles/CERT_IUT_D_AA.xml index eedcee3..0a0870d 100644 --- a/data/certificates/profiles/CERT_IUT_D_AA.xml +++ b/data/certificates/profiles/CERT_IUT_D_AA.xml @@ -11,7 +11,7 @@ - > + @@ -22,17 +22,17 @@ - - - - - + 01 D0/FF 1F + 01 C0/FF 3F + 01 FF FF FF FF F8/FF 00 00 00 00 07 + 02 FF FF FF/FF 00 00 01 + 01/FF + 01/FF - 01 32 02 32 diff --git a/data/certificates/profiles/CERT_IUT_D_AT.xml b/data/certificates/profiles/CERT_IUT_D_AT.xml index 8202c33..ee33e10 100644 --- a/data/certificates/profiles/CERT_IUT_D_AT.xml +++ b/data/certificates/profiles/CERT_IUT_D_AT.xml @@ -11,7 +11,7 @@ - > + @@ -22,10 +22,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_D_AT_8.xml b/data/certificates/profiles/CERT_IUT_D_AT_8.xml index 7e9856c..2f5a271 100644 --- a/data/certificates/profiles/CERT_IUT_D_AT_8.xml +++ b/data/certificates/profiles/CERT_IUT_D_AT_8.xml @@ -11,7 +11,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_D_AT_8v2.xml b/data/certificates/profiles/CERT_IUT_D_AT_8v2.xml new file mode 100644 index 0000000..bd9282f --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_D_AT_8v2.xml @@ -0,0 +1,46 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF + 01 + 01 + + + + + + + + + + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_D_ATv2.xml b/data/certificates/profiles/CERT_IUT_D_ATv2.xml new file mode 100644 index 0000000..bebc197 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_D_ATv2.xml @@ -0,0 +1,42 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF + 01 + 01 + + + + + + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_E_AT.xml b/data/certificates/profiles/CERT_IUT_E_AT.xml index a8f4c52..8511f34 100644 --- a/data/certificates/profiles/CERT_IUT_E_AT.xml +++ b/data/certificates/profiles/CERT_IUT_E_AT.xml @@ -11,7 +11,7 @@ - > + @@ -22,10 +22,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_E_AT_8.xml b/data/certificates/profiles/CERT_IUT_E_AT_8.xml index fbc2c44..79f3154 100644 --- a/data/certificates/profiles/CERT_IUT_E_AT_8.xml +++ b/data/certificates/profiles/CERT_IUT_E_AT_8.xml @@ -11,7 +11,7 @@ - > + @@ -22,10 +22,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF - 01 - 01 diff --git a/data/certificates/profiles/CERT_IUT_E_AT_8v2.xml b/data/certificates/profiles/CERT_IUT_E_AT_8v2.xml new file mode 100644 index 0000000..db679e5 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_E_AT_8v2.xml @@ -0,0 +1,44 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF + 01 + 01 + + + + + + + + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_E_ATv2.xml b/data/certificates/profiles/CERT_IUT_E_ATv2.xml new file mode 100644 index 0000000..8d3429d --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_E_ATv2.xml @@ -0,0 +1,37 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_1_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_1_AT.xml index cf3912e..bf46698 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_1_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_1_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_1_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_1_AT.xml index 333e2d8..5c224f2 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_1_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_1_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_2_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_2_AT.xml index bfd45b8..31aa0ca 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_2_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_2_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_3_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_3_AT.xml index 52bf3fc..ca091e1 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_3_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_3_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_4_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_4_AT.xml index 4b0d416..8fd7582 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_4_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_4_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_5_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_5_AT.xml index 8b014ae..057a1c1 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_5_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_5_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_6_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_6_AT.xml index 13c2e96..c00f113 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_6_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_6_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_LC_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_LC_AT.xml index d793be4..0548572 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_LC_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_LC_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_LS_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_LS_AT.xml index 9fa5f53..c7e4def 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_LS_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_LS_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_NEG_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_NEG_AT.xml index c0de519..7c1e0ca 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_NEG_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_NEG_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_NONE_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_NONE_AT.xml index cf3912e..bf46698 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_NONE_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_NONE_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_RCC_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_RCC_AT.xml index 669512b..37a4e41 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_RCC_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_RCC_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_SAEJ2540_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_SAEJ2540_AT.xml index b9eac3e..9fd2213 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_SAEJ2540_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_SAEJ2540_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_TC_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_TC_AT.xml index c8805fb..73a7f7b 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_TC_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_TC_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_VIENNACONV_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_VIENNACONV_AT.xml index 9dc287f..ce23dd9 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_VIENNACONV_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_VIENNACONV_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_MAP_SSP_1_AT.xml b/data/certificates/profiles/CERT_IUT_MAP_SSP_1_AT.xml index 51e9dfd..b83bdf8 100644 --- a/data/certificates/profiles/CERT_IUT_MAP_SSP_1_AT.xml +++ b/data/certificates/profiles/CERT_IUT_MAP_SSP_1_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_MAP_SSP_2_AT.xml b/data/certificates/profiles/CERT_IUT_MAP_SSP_2_AT.xml index dda3d6c..5e0575d 100644 --- a/data/certificates/profiles/CERT_IUT_MAP_SSP_2_AT.xml +++ b/data/certificates/profiles/CERT_IUT_MAP_SSP_2_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_MAP_SSP_NONE_AT.xml b/data/certificates/profiles/CERT_IUT_MAP_SSP_NONE_AT.xml index 88d62a1..3db263f 100644 --- a/data/certificates/profiles/CERT_IUT_MAP_SSP_NONE_AT.xml +++ b/data/certificates/profiles/CERT_IUT_MAP_SSP_NONE_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_RTCM_SSP_NONE_AT.xml b/data/certificates/profiles/CERT_IUT_RTCM_SSP_NONE_AT.xml index 1808c8d..aa5e84d 100644 --- a/data/certificates/profiles/CERT_IUT_RTCM_SSP_NONE_AT.xml +++ b/data/certificates/profiles/CERT_IUT_RTCM_SSP_NONE_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SPAT_SSP_ALL_AT.xml b/data/certificates/profiles/CERT_IUT_SPAT_SSP_ALL_AT.xml index b2d843e..5c546ad 100644 --- a/data/certificates/profiles/CERT_IUT_SPAT_SSP_ALL_AT.xml +++ b/data/certificates/profiles/CERT_IUT_SPAT_SSP_ALL_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SPAT_SSP_NONE_AT.xml b/data/certificates/profiles/CERT_IUT_SPAT_SSP_NONE_AT.xml index b0bde6e..5acaa9d 100644 --- a/data/certificates/profiles/CERT_IUT_SPAT_SSP_NONE_AT.xml +++ b/data/certificates/profiles/CERT_IUT_SPAT_SSP_NONE_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_01.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_01.xml index 5385270..e7fd935 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_01.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_01.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_02.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_02.xml index fe4b50d..0a1ced2 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_02.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_02.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_03.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_03.xml index b610319..581a129 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_03.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_03.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_04.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_04.xml index a781aa2..02db778 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_04.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_04.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_05.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_05.xml index 4bdf925..00f7faa 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_05.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_05.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_06.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_06.xml index 5de810d..697d75c 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_06.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_06.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_07.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_07.xml index 188166d..b66d880 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_07.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_07.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_08.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_08.xml index 2f95775..880a8c5 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_08.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_08.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_09.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_09.xml index ce93d6c..dc1e27d 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_09.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_09.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_10.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_10.xml index 83b721c..0fbda07 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_10.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_10.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_11.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_11.xml index 7f413be..c7a5be3 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_11.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_11.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_12.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_12.xml index dfa74c6..69ec404 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_12.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_12.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_13.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_13.xml index 4f8a44c..6add8f1 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_13.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_13.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_14.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_14.xml index caf753f..65d89b8 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_14.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_14.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_15.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_15.xml index 50e4fb2..e1f8232 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_15.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_15.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_16.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_16.xml index 870f52d..02d037e 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_16.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_16.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_17.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_17.xml index 10f2f2c..c13b60c 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_17.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_17.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_18.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_18.xml index dd94886..cb0f543 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_18.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_18.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_NONE_AT.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_NONE_AT.xml index a26291f..9081ce4 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_NONE_AT.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_NONE_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SRM_SSP_REQ_NONE_AT.xml b/data/certificates/profiles/CERT_IUT_SRM_SSP_REQ_NONE_AT.xml index 167ae06..a9e52c5 100644 --- a/data/certificates/profiles/CERT_IUT_SRM_SSP_REQ_NONE_AT.xml +++ b/data/certificates/profiles/CERT_IUT_SRM_SSP_REQ_NONE_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_IUT_SSM_SSP_AT.xml b/data/certificates/profiles/CERT_IUT_SSM_SSP_AT.xml index d95facf..3069c13 100644 --- a/data/certificates/profiles/CERT_IUT_SSM_SSP_AT.xml +++ b/data/certificates/profiles/CERT_IUT_SSM_SSP_AT.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_01.xml b/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_01.xml index 022fa06..87ce2fe 100644 --- a/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_01.xml +++ b/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_01.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_02.xml b/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_02.xml index 7a1b898..9907250 100644 --- a/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_02.xml +++ b/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_02.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_03.xml b/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_03.xml index de74fc7..e8f8aeb 100644 --- a/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_03.xml +++ b/data/certificates/profiles/CERT_TS_AA_AUTHVAL_RCV_02_BI_03.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_TS_A_AA.xml b/data/certificates/profiles/CERT_TS_A_AA.xml index cf69f00..f82309d 100644 --- a/data/certificates/profiles/CERT_TS_A_AA.xml +++ b/data/certificates/profiles/CERT_TS_A_AA.xml @@ -12,7 +12,7 @@ - > + @@ -23,17 +23,17 @@ - - - - - + 01 D0/FF 1F + 01 C0/FF 3F + 01 FF FF FF FF F8/FF 00 00 00 00 07 + 02 FF FF FF/FF 00 00 01 + 01/FF + 01/FF - 01 32 02 32 diff --git a/data/certificates/profiles/CERT_TS_A_AA_B.xml b/data/certificates/profiles/CERT_TS_A_AA_B.xml index 0b48383..f46697a 100644 --- a/data/certificates/profiles/CERT_TS_A_AA_B.xml +++ b/data/certificates/profiles/CERT_TS_A_AA_B.xml @@ -12,7 +12,7 @@ - > + @@ -23,17 +23,18 @@ - - - - - + 01 D0/FF 1F + 01 C0/FF 3F + 01 FF FF FF FF F8/FF 00 00 00 00 07 + 02 FF FF FF/FF 00 00 01 + 01/FF + 01/FF - 01 32 + 02 32 diff --git a/data/certificates/profiles/CERT_TS_A_AT.xml b/data/certificates/profiles/CERT_TS_A_AT.xml index f4e45a4..2f6613c 100644 --- a/data/certificates/profiles/CERT_TS_A_AT.xml +++ b/data/certificates/profiles/CERT_TS_A_AT.xml @@ -12,7 +12,7 @@ - > + @@ -23,10 +23,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_TS_A_AT_IMP.xml b/data/certificates/profiles/CERT_TS_A_AT_IMP.xml index e483d51..75d9550 100644 --- a/data/certificates/profiles/CERT_TS_A_AT_IMP.xml +++ b/data/certificates/profiles/CERT_TS_A_AT_IMP.xml @@ -12,7 +12,7 @@ -> + @@ -23,10 +23,6 @@ 01 FF FC  01 FF FF FF  -02 FF FC  -02 FF FF FF FE  -01 -01   diff --git a/data/certificates/profiles/CERT_TS_A_AT_IMP_BO.xml b/data/certificates/profiles/CERT_TS_A_AT_IMP_BO.xml index e620143..7db5d5b 100644 --- a/data/certificates/profiles/CERT_TS_A_AT_IMP_BO.xml +++ b/data/certificates/profiles/CERT_TS_A_AT_IMP_BO.xml @@ -12,7 +12,7 @@ -> + diff --git a/data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml b/data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml new file mode 100644 index 0000000..7c3ebed --- /dev/null +++ b/data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml @@ -0,0 +1,38 @@ + + +3 + + + + + + + + + + + + + + + + + + + + +02 FF FC  +02 FF FF FF  + 01 + 01 +   + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_A_AT_IMPv2.xml b/data/certificates/profiles/CERT_TS_A_AT_IMPv2.xml new file mode 100644 index 0000000..12c16af --- /dev/null +++ b/data/certificates/profiles/CERT_TS_A_AT_IMPv2.xml @@ -0,0 +1,37 @@ + + +3 + + + + + + + + + + + + + + + + + + + + +02 FF FC  +02 FF FF FF FE  +01 +01 +   + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_A_ATv2.xml b/data/certificates/profiles/CERT_TS_A_ATv2.xml new file mode 100644 index 0000000..72f5684 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_A_ATv2.xml @@ -0,0 +1,38 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_A_EA.xml b/data/certificates/profiles/CERT_TS_A_EA.xml index a2c548b..b28ee60 100644 --- a/data/certificates/profiles/CERT_TS_A_EA.xml +++ b/data/certificates/profiles/CERT_TS_A_EA.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_01.xml b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_01.xml index 1ede01a..3556ec1 100644 --- a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_01.xml +++ b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_01.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_02.xml b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_02.xml index f448e3d..6103c47 100644 --- a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_02.xml +++ b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_02.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_03.xml b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_03.xml index 9aa51fd..58bd2dc 100644 --- a/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_03.xml +++ b/data/certificates/profiles/CERT_TS_A_EA_AA_AUTHVAL_RCV_02_BI_03.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_TS_A_EC.xml b/data/certificates/profiles/CERT_TS_A_EC.xml index 884430a..9bf1b01 100644 --- a/data/certificates/profiles/CERT_TS_A_EC.xml +++ b/data/certificates/profiles/CERT_TS_A_EC.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_TS_B1_AT.xml b/data/certificates/profiles/CERT_TS_B1_AT.xml index f65e53f..b2492c0 100644 --- a/data/certificates/profiles/CERT_TS_B1_AT.xml +++ b/data/certificates/profiles/CERT_TS_B1_AT.xml @@ -11,7 +11,7 @@ - > + diff --git a/data/certificates/profiles/CERT_TS_B_AT.xml b/data/certificates/profiles/CERT_TS_B_AT.xml index e7259c4..cfd3c77 100644 --- a/data/certificates/profiles/CERT_TS_B_AT.xml +++ b/data/certificates/profiles/CERT_TS_B_AT.xml @@ -12,7 +12,7 @@ - > + @@ -23,10 +23,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_TS_B_ATv2.xml b/data/certificates/profiles/CERT_TS_B_ATv2.xml new file mode 100644 index 0000000..7ce815a --- /dev/null +++ b/data/certificates/profiles/CERT_TS_B_ATv2.xml @@ -0,0 +1,38 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_CAM_BO_02_ATv2.xml b/data/certificates/profiles/CERT_TS_CAM_BO_02_ATv2.xml new file mode 100644 index 0000000..97aaac2 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_CAM_BO_02_ATv2.xml @@ -0,0 +1,31 @@ + + + + 2 + + + + + + + + + + + + + + + 02 BF FC + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_CAM_BO_03_ATv2.xml b/data/certificates/profiles/CERT_TS_CAM_BO_03_ATv2.xml new file mode 100644 index 0000000..076d15c --- /dev/null +++ b/data/certificates/profiles/CERT_TS_CAM_BO_03_ATv2.xml @@ -0,0 +1,30 @@ + + + 2 + + + + + + + + + + + + + + + 02 DF FC + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml new file mode 100644 index 0000000..0937beb --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FC + 02 7F FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_02_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_02_ATv2.xml new file mode 100644 index 0000000..ab5c506 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_02_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FC + 02 BF FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_EC_ENR_RCV_02_BI_01.xml b/data/certificates/profiles/CERT_TS_EC_ENR_RCV_02_BI_01.xml index 8edf160..b301b38 100644 --- a/data/certificates/profiles/CERT_TS_EC_ENR_RCV_02_BI_01.xml +++ b/data/certificates/profiles/CERT_TS_EC_ENR_RCV_02_BI_01.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_TS_EC_ENR_RCV_02_BI_02.xml b/data/certificates/profiles/CERT_TS_EC_ENR_RCV_02_BI_02.xml index 90004ec..1aa66fb 100644 --- a/data/certificates/profiles/CERT_TS_EC_ENR_RCV_02_BI_02.xml +++ b/data/certificates/profiles/CERT_TS_EC_ENR_RCV_02_BI_02.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_TS_EC_ENR_RCV_02_BI_03.xml b/data/certificates/profiles/CERT_TS_EC_ENR_RCV_02_BI_03.xml index c95f71e..9f8e8b6 100644 --- a/data/certificates/profiles/CERT_TS_EC_ENR_RCV_02_BI_03.xml +++ b/data/certificates/profiles/CERT_TS_EC_ENR_RCV_02_BI_03.xml @@ -12,7 +12,7 @@ - > + diff --git a/data/certificates/profiles/CERT_TS_F3_AT.xml b/data/certificates/profiles/CERT_TS_F3_AT.xml index 8d38a4b..713862a 100644 --- a/data/certificates/profiles/CERT_TS_F3_AT.xml +++ b/data/certificates/profiles/CERT_TS_F3_AT.xml @@ -11,7 +11,7 @@ - > + @@ -22,8 +22,6 @@ 01 FF FC 01 FF FF FF - 01 - 01 diff --git a/data/certificates/profiles/CERT_TS_F3_AT_IMP.xml b/data/certificates/profiles/CERT_TS_F3_AT_IMP.xml index 037d019..71fff8c 100644 --- a/data/certificates/profiles/CERT_TS_F3_AT_IMP.xml +++ b/data/certificates/profiles/CERT_TS_F3_AT_IMP.xml @@ -11,7 +11,7 @@ - > + diff --git a/data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml b/data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml new file mode 100644 index 0000000..31578ae --- /dev/null +++ b/data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml @@ -0,0 +1,37 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_F3_ATv2.xml b/data/certificates/profiles/CERT_TS_F3_ATv2.xml new file mode 100644 index 0000000..24468a6 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_F3_ATv2.xml @@ -0,0 +1,37 @@ + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_FA3_AA.xml b/data/certificates/profiles/CERT_TS_FA3_AA.xml index a6e9791..99d7ce8 100644 --- a/data/certificates/profiles/CERT_TS_FA3_AA.xml +++ b/data/certificates/profiles/CERT_TS_FA3_AA.xml @@ -12,7 +12,7 @@ - > + @@ -23,17 +23,18 @@ - - - - - + 01 D0/FF 1F + 01 C0/FF 3F + 01 FF FF FF FF F8/FF 00 00 00 00 07 + 02 FF FF FF/FF 00 00 01 + 01/FF + 01/FF - 01 32 + 02 32 diff --git a/data/certificates/profiles/CERT_TS_FA3_AT.xml b/data/certificates/profiles/CERT_TS_FA3_AT.xml index 4a1d270..6b8f638 100644 --- a/data/certificates/profiles/CERT_TS_FA3_AT.xml +++ b/data/certificates/profiles/CERT_TS_FA3_AT.xml @@ -12,7 +12,7 @@ - > + @@ -23,8 +23,6 @@ 01 FF FC 01 FF FF FF - 01 - 01 diff --git a/data/certificates/profiles/CERT_TS_FA3_ATv2.xml b/data/certificates/profiles/CERT_TS_FA3_ATv2.xml new file mode 100644 index 0000000..34c6d56 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_FA3_ATv2.xml @@ -0,0 +1,38 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_FA_AA.xml b/data/certificates/profiles/CERT_TS_FA_AA.xml index c6c3d68..9c13816 100644 --- a/data/certificates/profiles/CERT_TS_FA_AA.xml +++ b/data/certificates/profiles/CERT_TS_FA_AA.xml @@ -12,7 +12,7 @@ - > + @@ -23,17 +23,18 @@ - - - - - + 01 D0/FF 1F + 01 C0/FF 3F + 01 FF FF FF FF F8/FF 00 00 00 00 07 + 02 FF FF FF/FF 00 00 01 + 01/FF + 01/FF - 01 32 + 02 32 diff --git a/data/certificates/profiles/CERT_TS_FA_AT.xml b/data/certificates/profiles/CERT_TS_FA_AT.xml index 9b3d2ce..8d0d67c 100644 --- a/data/certificates/profiles/CERT_TS_FA_AT.xml +++ b/data/certificates/profiles/CERT_TS_FA_AT.xml @@ -12,7 +12,7 @@ - > + @@ -23,8 +23,6 @@ 01 FF FC 01 FF FF FF - 01 - 01 diff --git a/data/certificates/profiles/CERT_TS_FA_ATv2.xml b/data/certificates/profiles/CERT_TS_FA_ATv2.xml new file mode 100644 index 0000000..ed8bd09 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_FA_ATv2.xml @@ -0,0 +1,38 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_F_AT.xml b/data/certificates/profiles/CERT_TS_F_AT.xml index 6b3a0de..29def4e 100644 --- a/data/certificates/profiles/CERT_TS_F_AT.xml +++ b/data/certificates/profiles/CERT_TS_F_AT.xml @@ -12,7 +12,7 @@ - > + @@ -23,8 +23,6 @@ 01 FF FC 01 FF FF FF - 01 - 01 diff --git a/data/certificates/profiles/CERT_TS_F_AT_IMP.xml b/data/certificates/profiles/CERT_TS_F_AT_IMP.xml index 7a08289..36302d5 100644 --- a/data/certificates/profiles/CERT_TS_F_AT_IMP.xml +++ b/data/certificates/profiles/CERT_TS_F_AT_IMP.xml @@ -12,7 +12,7 @@ - > + @@ -23,10 +23,6 @@ 01 FF FC 01 FF FF FF - 02 FF FC - 02 FF FF FF FE - 01 - 01 diff --git a/data/certificates/profiles/CERT_TS_F_AT_IMPv2.xml b/data/certificates/profiles/CERT_TS_F_AT_IMPv2.xml new file mode 100644 index 0000000..016a065 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_F_AT_IMPv2.xml @@ -0,0 +1,38 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF FE + 01 + 01 + + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_F_ATv2.xml b/data/certificates/profiles/CERT_TS_F_ATv2.xml new file mode 100644 index 0000000..acd9065 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_F_ATv2.xml @@ -0,0 +1,38 @@ + + + 3 + + + + + + + + + + + + + + + + + + + + + 02 FF FC + 02 FF FF FF + 01 + 01 + + + + + + + + + + + -- GitLab From 2981ce8a6c61f758c8962fc02fbde982cc74d220 Mon Sep 17 00:00:00 2001 From: garciay Date: Wed, 21 Aug 2024 09:12:28 +0200 Subject: [PATCH 157/178] Add its-ais in cfg file; Validate PC#5/Uu/MQTT interfaces; Bug fixed in AtIS layers --- TS.ITS_TTF_T036.code-workspace | 10 ++- .../Protocols/Commsignia/commsignia_layer.cc | 4 +- .../Protocols/Commsignia/commsignia_layer.hh | 4 +- ccsrc/Protocols/IVIM_layers/ivim_layer.cc | 4 +- ccsrc/Protocols/IVIM_layers/ivim_layer.hh | 4 +- ccsrc/Protocols/LTE/lte_layer.cc | 12 ++- ccsrc/Protocols/LTE/lte_layer.hh | 4 +- ccsrc/Protocols/LTE/uu_amqp.cc | 89 ++++++++++++++++++- ccsrc/Protocols/LTE/uu_amqp.hh | 17 +++- ccsrc/Protocols/LTE/uu_mqtt.cc | 52 +++++------ ccsrc/Protocols/LTE/uu_mqtt.hh | 14 +-- ccsrc/Protocols/LTE/uu_raw.cc | 8 +- ccsrc/Protocols/LTE/uu_raw.hh | 4 +- .../MapemSpatem_layers/mapem_spatem_layer.cc | 4 +- .../MapemSpatem_layers/mapem_spatem_layer.hh | 4 +- ccsrc/Protocols/Qualcomm/qualcomm_layer.cc | 8 +- ccsrc/Protocols/Qualcomm/qualcomm_layer.hh | 4 +- ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.cc | 4 +- ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.hh | 4 +- ccsrc/framework/include/params_its.hh | 3 + ccsrc/framework/src/params_its.cc | 3 + etc/AtsCAM/AtsCAM.cfg | 13 +++ etc/AtsCAM/AtsCAM_Savary.cfg_ | 13 +++ etc/AtsCAM/AtsCAM_Simulator.cfg_ | 13 +++ etc/AtsCAM/AtsCAM_Yogoko.cf_ | 13 +++ etc/AtsCAM/AtsCAM_pcap.cfg_ | 13 +++ etc/AtsCPS/AtsCPS_Simulator.cfg_ | 13 +++ etc/AtsIS/AtsIS_IVIM.cf_ | 13 +++ etc/AtsIS/AtsIS_Mapem.cf_ | 13 +++ etc/AtsIS/AtsIS_Spatem.cf_ | 13 +++ etc/AtsMBR/AtsMBR.cfg | 2 + etc/AtsMBR/AtsMBR_Simu.cfg_ | 2 + etc/AtsPki/AtsPki_Commsignia.cfg_ | 14 ++- etc/AtsPki/AtsPki_Simu.cfg_ | 14 ++- etc/AtsSecurity/AtsSecurity.cfg | 2 + etc/AtsSecurity/AtsSecurity_codha.cf_ | 15 +++- etc/AtsVRU/AtsVRU_Simulator.cfg_ | 13 +++ ttcn/AtsCAM | 2 +- ttcn/AtsCPS | 2 +- ttcn/AtsDENM | 2 +- ttcn/AtsIS | 2 +- ttcn/AtsMBR | 2 +- ttcn/AtsVRU | 2 +- ttcn/LibIts | 2 +- 44 files changed, 363 insertions(+), 90 deletions(-) diff --git a/TS.ITS_TTF_T036.code-workspace b/TS.ITS_TTF_T036.code-workspace index a4ad12b..8bf6c76 100644 --- a/TS.ITS_TTF_T036.code-workspace +++ b/TS.ITS_TTF_T036.code-workspace @@ -9,9 +9,6 @@ { "path": "../EtsiTs103759js" }, - { - "path": "../itscertgen-r2" - }, { "path": "../../tmp/crypto-test-vectors" }, @@ -23,6 +20,9 @@ }, { "path": "../../frameworks/fsmsggen" + }, + { + "path": "../itscertgen" } ], "settings": { @@ -97,7 +97,9 @@ "numbers": "cpp", "semaphore": "cpp", "stop_token": "cpp", - "hash_map": "cpp" + "hash_map": "cpp", + "mqtt.h": "c", + "gps.h": "c" }, "java.compile.nullAnalysis.mode": "automatic" } diff --git a/ccsrc/Protocols/Commsignia/commsignia_layer.cc b/ccsrc/Protocols/Commsignia/commsignia_layer.cc index dd36b98..702d2b5 100644 --- a/ccsrc/Protocols/Commsignia/commsignia_layer.cc +++ b/ccsrc/Protocols/Commsignia/commsignia_layer.cc @@ -52,7 +52,7 @@ commsignia_layer::commsignia_layer(const std::string &p_type, const std::string //_params.log(); } -void commsignia_layer::send_data(OCTETSTRING &data, params_its ¶ms) { +void commsignia_layer::send_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log_msg(">>> commsignia_layer::send_data: ", data); OCTETSTRING buffer = OCTETSTRING(0, nullptr); @@ -109,7 +109,7 @@ void commsignia_layer::send_data(OCTETSTRING &data, params_its ¶ms) { send_to_all_layers(buffer, params); } -void commsignia_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { +void commsignia_layer::receive_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log_msg(">>> commsignia_layer::receive_data: ", data); const unsigned char *p = static_cast(data); diff --git a/ccsrc/Protocols/Commsignia/commsignia_layer.hh b/ccsrc/Protocols/Commsignia/commsignia_layer.hh index 75e5e1b..30403e6 100644 --- a/ccsrc/Protocols/Commsignia/commsignia_layer.hh +++ b/ccsrc/Protocols/Commsignia/commsignia_layer.hh @@ -131,6 +131,6 @@ public: */ virtual ~commsignia_layer(){}; - virtual void send_data(OCTETSTRING &data, params_its ¶ms); - virtual void receive_data(OCTETSTRING &data, params_its &info); + virtual void send_data(OCTETSTRING &data, params ¶ms); + virtual void receive_data(OCTETSTRING &data, params &info); }; // End of class commsignia_layer diff --git a/ccsrc/Protocols/IVIM_layers/ivim_layer.cc b/ccsrc/Protocols/IVIM_layers/ivim_layer.cc index 77f9cf2..cfd0dc3 100644 --- a/ccsrc/Protocols/IVIM_layers/ivim_layer.cc +++ b/ccsrc/Protocols/IVIM_layers/ivim_layer.cc @@ -45,13 +45,13 @@ void ivim_layer::sendMsg(const LibItsIvim__TypesAndValues::IvimInd &p, params_it send_data(data, _params); } -void ivim_layer::send_data(OCTETSTRING &data, params_its ¶ms) { +void ivim_layer::send_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log_msg(">>> ivim_layer::send_data: ", data); // params.log(); send_to_all_layers(data, params); } -void ivim_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { +void ivim_layer::receive_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log_msg(">>> ivim_layer::receive_data: ", data); params.log(); diff --git a/ccsrc/Protocols/IVIM_layers/ivim_layer.hh b/ccsrc/Protocols/IVIM_layers/ivim_layer.hh index b5c8ed4..1760eeb 100644 --- a/ccsrc/Protocols/IVIM_layers/ivim_layer.hh +++ b/ccsrc/Protocols/IVIM_layers/ivim_layer.hh @@ -31,8 +31,8 @@ public: void sendMsg(const LibItsIvim__TypesAndValues::IvimReq &, params_its ¶ms); void sendMsg(const LibItsIvim__TypesAndValues::IvimInd &, params_its ¶ms); - virtual void send_data(OCTETSTRING &data, params_its ¶ms); - virtual void receive_data(OCTETSTRING &data, params_its &info); + virtual void send_data(OCTETSTRING &data, params ¶ms); + virtual void receive_data(OCTETSTRING &data, params &info); int enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security); diff --git a/ccsrc/Protocols/LTE/lte_layer.cc b/ccsrc/Protocols/LTE/lte_layer.cc index 5492967..1508de8 100644 --- a/ccsrc/Protocols/LTE/lte_layer.cc +++ b/ccsrc/Protocols/LTE/lte_layer.cc @@ -10,7 +10,7 @@ lte_layer::lte_layer(const std::string &p_type, const std::string ¶ms) : _uu_transport("udp"), _uu_protocol(""), _pc5_layer_id(""), _uu_layer{0}, _pc5_layer{0}, _pc5{0}, _time_key("lte_layer::Handle_Fd_Event_Readable") { - loggers::get_instance().log(">>> lte_layer::lte_layer: %s, %s", to_string().c_str(), params.c_str()); + loggers::get_instance().log(">>> lte_layer::lte_layer: %s, %s, %p", to_string().c_str(), params.c_str(), this); params::convert(_params, params); @@ -49,6 +49,9 @@ lte_layer::lte_layer(const std::string &p_type, const std::string ¶ms) loggers::get_instance().log("lte_layer::lte_layer: PC5 layers string: '%s'", s.c_str()); _pc5_layer = layer_stack_builder::get_instance()->create_layer_stack(s.c_str()); loggers::get_instance().log("lte_layer::lte_layer: _pc5_layer= %p", _pc5_layer); + if (static_cast(_pc5_layer) == NULL) { + loggers::get_instance().error("lte_layer::lte_layer: Invalid stack configuration: %s", s.c_str()); + } _pc5 = registration::get_instance().get_item(_pc5_layer_id); if (_pc5 == NULL) { loggers::get_instance().error("lte_layer::lte_layer: Failed to get %s layer", _pc5_layer_id.c_str()); @@ -80,7 +83,7 @@ void lte_layer::close() { } } -void lte_layer::send_data(OCTETSTRING &data, params_its ¶ms) { +void lte_layer::send_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log_msg(">>> lte_layer::send_data: ", data); params::const_iterator it = params.find(std::string("its_aid")); @@ -93,15 +96,18 @@ void lte_layer::send_data(OCTETSTRING &data, params_its ¶ms) { */ loggers::get_instance().log("lte_layer::send_data: %s", it->second.c_str()); if (it == params.cend()) { + loggers::get_instance().log("lte_layer::send_data: 1111111111111111111111111111111"); _uu_layer->send_data(data, params); } else if ((it->second.compare("36") == 0) || (it->second.compare("141") == 0)) { // CAM and Beacons over PC#5 + loggers::get_instance().log("lte_layer::send_data: 2222222222222222222222222222222"); _pc5_layer->send_data(data, params); } else { + loggers::get_instance().log("lte_layer::send_data: 3333333333333333333333333333333"); _uu_layer->send_data(data, params); } } -void lte_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { +void lte_layer::receive_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log_msg(">>> lte_layer::receive_data: ", data); receive_to_all_layers(data, params); diff --git a/ccsrc/Protocols/LTE/lte_layer.hh b/ccsrc/Protocols/LTE/lte_layer.hh index 4713bb2..572652f 100644 --- a/ccsrc/Protocols/LTE/lte_layer.hh +++ b/ccsrc/Protocols/LTE/lte_layer.hh @@ -49,7 +49,7 @@ class lte_layer : public layer, public data_event_notifier { * \param[in] p_data The data to be sent * \param[in] p_params Some parameters to overwrite default value of the lower layers parameters */ - virtual void send_data(OCTETSTRING &data, params_its ¶ms); + virtual void send_data(OCTETSTRING &data, params ¶ms); /*! * \virtual * \fn void receive_data(OCTETSTRING& data, params& params); @@ -57,7 +57,7 @@ class lte_layer : public layer, public data_event_notifier { * \param[in] p_data The bytes formated data received * \param[in] p_params Some lower layers parameters values when data was received */ - virtual void receive_data(OCTETSTRING &data, params_its &info); + virtual void receive_data(OCTETSTRING &data, params &info); virtual void update(OCTETSTRING &p_data, params_its &p_params); diff --git a/ccsrc/Protocols/LTE/uu_amqp.cc b/ccsrc/Protocols/LTE/uu_amqp.cc index 50b8fd9..e74c654 100644 --- a/ccsrc/Protocols/LTE/uu_amqp.cc +++ b/ccsrc/Protocols/LTE/uu_amqp.cc @@ -1,3 +1,5 @@ +#include + #include "loggers.hh" #include "uu_amqp.hh" @@ -5,9 +7,11 @@ #include "lte_udp_layer.hh" #include "lte_tcp_layer.hh" +#include "base_time.hh" + #include "data_event_observer.hh" -uu_amqp::uu_amqp(): _uu_transport("udp") { +uu_amqp::uu_amqp(): _uu_transport("udp"), _protocol_name("AMQP"), _state{amqp_idle} { loggers::get_instance().log(">>> uu_amqp::uu_amqp"); } @@ -29,8 +33,14 @@ void uu_amqp::close() { int uu_amqp::setup(const params_its ¶ms) { loggers::get_instance().log(">>> uu_amqp::setup"); + // Extract protocol name + params::const_iterator it = params.find(params_its::amqp_protocol); + if (it != params.cend()) { + _protocol_name.assign(it->second); + } + // Transport layer to the broker - params_its::const_iterator it = params.find(params_its::uu_transport); + it = params.find(params_its::uu_transport); if (it != params.cend()) { if (it->second.compare("tcp") == 0) { loggers::get_instance().log("uu_amqp::setup: Create TCP layer"); @@ -48,6 +58,7 @@ int uu_amqp::setup(const params_its ¶ms) { ((lte_udp_layer*)_layer)->incoming_packet_observer_attach(this); } loggers::get_instance().log("uu_amqp::setup: _layer %p", _layer); + send_connect_command(); return 0; } @@ -55,19 +66,60 @@ int uu_amqp::setup(const params_its ¶ms) { int uu_amqp::shutdown() { loggers::get_instance().log(">>> uu_amqp::shutdown"); + if (_state != amqp_idle) { + loggers::get_instance().log("uu_amqp::shutdown: Send Disconnect command"); + send_disconnect_command(); + _state = amqp_idle; + } // Don't delete transport layer return 0; } -void uu_amqp::send_data(OCTETSTRING &data, params_its ¶ms) { +void uu_amqp::send_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log(">>> uu_amqp::send_data"); _layer->send_data(data, params); } -void uu_amqp::receive_data(OCTETSTRING &p_data, params_its &p_params) { +void uu_amqp::receive_data(OCTETSTRING &p_data, params &p_params) { loggers::get_instance().log(">>> uu_amqp::receive_data"); + // Sanity check + if (p_data.lengthof() < 8) { + // Malformed packet + loggers::get_instance().log("uu_amqp::receive_data: Malformed packet"); + return; + } + // Check magic word AMQP + if ((p_data[0].get_octet() != 'A') || (p_data[1].get_octet() != 'M') || (p_data[2].get_octet() != 'Q') || (p_data[3].get_octet() != 'P')) { + // Wrong magic work, discard message + loggers::get_instance().log("uu_amqp::receive_data: Wrong magic work, discard message"); + return; + } + + // Check version + if ((p_data[4].get_octet() != 0x00) || (p_data[5].get_octet() != 0x01) || (p_data[6].get_octet() != 0x00) || (p_data[7].get_octet() != 0x00)) { // AMQP 1.0 + // Unsupported version + loggers::get_instance().log("uu_amqp::receive_data: Unsupported version"); + return; + } + + // Extract length + int payload_length = p_data[8].get_octet() << 24 & p_data[9].get_octet() << 16 & p_data[10].get_octet() << 8 & p_data[11].get_octet(); + loggers::get_instance().log("uu_amqp::receive_data: payload_length=%d", payload_length); + + + switch (_state) { + case amqp_error: + loggers::get_instance().log("uu_amqp::receive_data: Error state, looping..."); + break; + default: + // Nothing to do + break; + } // End of 'switch'statement + + + return; } void uu_amqp::update(OCTETSTRING &p_data, params_its &p_params) { @@ -75,3 +127,32 @@ void uu_amqp::update(OCTETSTRING &p_data, params_its &p_params) { receive_data(p_data, p_params); } + +void uu_amqp::send_connect_command() { + loggers::get_instance().log(">>> uu_amqp::send_connect_command: %d", _state); + + if (_state != amqp_idle) { + loggers::get_instance().error("uu_amqp::send_connect_command: Wrong state"); + return; + } + + TTCN_Buffer data; + + params_its param; + OCTETSTRING os = OCTETSTRING(data.get_len(), data.get_data()); + loggers::get_instance().log_msg("uu_amqp::send_connect_command: ", os); + _state = amqp_await_connect_ack; + _layer->send_data(os, param); +} + +void uu_amqp::send_disconnect_command() { + loggers::get_instance().log(">>> uu_amqp::send_disconnect_command: %d", _state); + + if (_state == amqp_idle) { + loggers::get_instance().error("uu_amqp::send_disconnect_command: Wrong state"); + return; + } + + _state = amqp_idle; +} + diff --git a/ccsrc/Protocols/LTE/uu_amqp.hh b/ccsrc/Protocols/LTE/uu_amqp.hh index 3f98138..d02eea8 100644 --- a/ccsrc/Protocols/LTE/uu_amqp.hh +++ b/ccsrc/Protocols/LTE/uu_amqp.hh @@ -4,9 +4,20 @@ #include "data_event_notifier.hh" +typedef enum AmqpState: unsigned char { + amqp_idle, + amqp_await_connect_ack, + amqp_await_subscribe_ack, + amqp_publishing, + amqp_error +} AmqpState; + + class uu_amqp: public uu_interface, public data_event_notifier { protected: std::string _uu_transport; + std::string _protocol_name; + AmqpState _state; public: uu_amqp(); @@ -15,8 +26,8 @@ public: int setup(const params_its ¶ms); int shutdown(); - void send_data(OCTETSTRING &data, params_its ¶ms); - void receive_data(OCTETSTRING &p_data, params_its &p_params); + void send_data(OCTETSTRING &data, params ¶ms); + void receive_data(OCTETSTRING &p_data, params &p_params); void update(OCTETSTRING &p_data, params_its &p_params); @@ -35,5 +46,7 @@ public: }; private: + void send_connect_command(); + void send_disconnect_command(); void close(); }; // End of class uu_amqp diff --git a/ccsrc/Protocols/LTE/uu_mqtt.cc b/ccsrc/Protocols/LTE/uu_mqtt.cc index 329f670..8bbd53a 100644 --- a/ccsrc/Protocols/LTE/uu_mqtt.cc +++ b/ccsrc/Protocols/LTE/uu_mqtt.cc @@ -11,7 +11,7 @@ MessageId uu_mqtt::message_id_counter = 0; -uu_mqtt::uu_mqtt() : _uu_transport("udp"), _protocol_name("MQTT"), _client_id("EtsiTS"), _state{idle}, _subscribed_topics(), _topics() { +uu_mqtt::uu_mqtt() : _uu_transport("udp"), _protocol_name("MQTT"), _client_id("EtsiTS"), _state{mqtt_idle}, _subscribed_topics(), _topics() { loggers::get_instance().log(">>> uu_mqtt::uu_mqtt"); } @@ -121,50 +121,50 @@ int uu_mqtt::setup(const params_its ¶ms) { int uu_mqtt::shutdown() { loggers::get_instance().log(">>> uu_mqtt::shutdown"); - if (_state != idle) { + if (_state != mqtt_idle) { loggers::get_instance().log("uu_mqtt::shutdown: Send Disconnect command"); send_disconnect_command(); - _state = idle; + _state = mqtt_idle; } // Don't delete transport layer return 0; } -void uu_mqtt::send_data(OCTETSTRING &data, params_its ¶ms) { +void uu_mqtt::send_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log(">>> uu_mqtt::send_data"); - send_publish_command(data, params); + send_publish_command(data, static_cast(params)); } -void uu_mqtt::receive_data(OCTETSTRING &p_data, params_its &p_params) { +void uu_mqtt::receive_data(OCTETSTRING &p_data, params &p_params) { loggers::get_instance().log(">>> uu_mqtt::receive_data: %d", _state); switch (_state) { - case await_connect_ack: - if (recv_connect_ack(p_data, p_params) == -1) { - _state = error; + case mqtt_await_connect_ack: + if (recv_connect_ack(p_data, static_cast(p_params)) == -1) { + _state = mqtt_error; } else { - _state = await_subscribe_ack; + _state = mqtt_await_subscribe_ack; loggers::get_instance().log("uu_mqtt::receive_data: Send Subscribe command"); send_first_subscribe_command(); loggers::get_instance().log("uu_mqtt::receive_data: Await subscribeAck"); } break; - case await_subscribe_ack: - recv_subscribe_ack(p_data, p_params); + case mqtt_await_subscribe_ack: + recv_subscribe_ack(p_data, static_cast(p_params)); send_next_subscribe_command(); loggers::get_instance().log("uu_mqtt::receive_data: Send subscribe, state=%d", _state); break; - case publishing: { + case mqtt_publishing: { OCTETSTRING os; - if (recv_publish(p_data, p_params, os) == 1) { + if (recv_publish(p_data, static_cast(p_params), os) == 1) { // Forward to notifier - incoming_packet_notify(os, p_params); + incoming_packet_notify(os, static_cast(p_params)); } } break; - case error: + case mqtt_error: loggers::get_instance().log("uu_mqtt::receive_data: Error state, looping..."); break; default: @@ -176,13 +176,13 @@ void uu_mqtt::receive_data(OCTETSTRING &p_data, params_its &p_params) { void uu_mqtt::update(OCTETSTRING &p_data, params_its &p_params) { loggers::get_instance().log_msg(">>> uu_mqtt::update: ", p_data); - receive_data(p_data, p_params); + receive_data(p_data, static_cast(p_params)); } void uu_mqtt::send_connect_command() { loggers::get_instance().log(">>> uu_mqtt::send_connect_command: %d", _state); - if (_state != idle) { + if (_state != mqtt_idle) { loggers::get_instance().error("uu_mqtt::send_connect_command: Wrong state"); return; } @@ -203,14 +203,14 @@ void uu_mqtt::send_connect_command() { params_its param; OCTETSTRING os = OCTETSTRING(data.get_len(), data.get_data()); loggers::get_instance().log_msg("uu_mqtt::send_connect_command: ", os); - _state = await_connect_ack; + _state = mqtt_await_connect_ack; _layer->send_data(os, param); } void uu_mqtt::send_first_subscribe_command() { loggers::get_instance().log(">>> uu_mqtt::send_first_subscribe_command: %d", _state); - if (_state != await_subscribe_ack) { + if (_state != mqtt_await_subscribe_ack) { loggers::get_instance().warning("uu_mqtt::send_first_subscribe_command: wrong state: %d", _state); return; } @@ -223,15 +223,15 @@ void uu_mqtt::send_first_subscribe_command() { void uu_mqtt::send_next_subscribe_command() { loggers::get_instance().log(">>> uu_mqtt::send_next_subscribe_command: %d", _state); - if (_state != await_subscribe_ack) { + if (_state != mqtt_await_subscribe_ack) { loggers::get_instance().warning("uu_mqtt::send_next_subscribe_command: wrong state: %d", _state); return; } _subscribed_topics_it++; if (_subscribed_topics_it == _subscribed_topics.end()) { - loggers::get_instance().log("uu_mqtt::send_next_subscribe_command: No more entries, new state: %d", publishing); - _state = publishing; + loggers::get_instance().log("uu_mqtt::send_next_subscribe_command: No more entries, new state: %d", mqtt_publishing); + _state = mqtt_publishing; return; } @@ -262,7 +262,7 @@ void uu_mqtt::send_subscribe_command() { void uu_mqtt::send_publish_command(const OCTETSTRING &p_data, const params_its &p_params) { loggers::get_instance().log(">>> uu_mqtt::send_publish_command: %d", _state); - if (_state != publishing) { + if (_state != mqtt_publishing) { loggers::get_instance().warning("uu_mqtt::send_publish_command: wrong state: %d", _state); return; } @@ -299,12 +299,12 @@ void uu_mqtt::send_publish_command(const OCTETSTRING &p_data, const params_its & void uu_mqtt::send_disconnect_command() { loggers::get_instance().log(">>> uu_mqtt::send_disconnect_command: %d", _state); - if (_state == idle) { + if (_state == mqtt_idle) { loggers::get_instance().error("uu_mqtt::send_disconnect_command: Wrong state"); return; } - _state = idle; + _state = mqtt_idle; } int uu_mqtt::recv_connect_ack(OCTETSTRING &p_data, params_its &p_params) { diff --git a/ccsrc/Protocols/LTE/uu_mqtt.hh b/ccsrc/Protocols/LTE/uu_mqtt.hh index e31245d..22a9dc6 100644 --- a/ccsrc/Protocols/LTE/uu_mqtt.hh +++ b/ccsrc/Protocols/LTE/uu_mqtt.hh @@ -7,11 +7,11 @@ #include "data_event_notifier.hh" typedef enum MqttState: unsigned char { - idle, - await_connect_ack, - await_subscribe_ack, - publishing, - error + mqtt_idle, + mqtt_await_connect_ack, + mqtt_await_subscribe_ack, + mqtt_publishing, + mqtt_error } MqttState; typedef unsigned short MessageId; @@ -35,8 +35,8 @@ public: int setup(const params_its ¶ms); int shutdown(); - void send_data(OCTETSTRING &data, params_its ¶ms); - void receive_data(OCTETSTRING &p_data, params_its &p_params); + void send_data(OCTETSTRING &data, params ¶ms); + void receive_data(OCTETSTRING &p_data, params &p_params); void update(OCTETSTRING &p_data, params_its &p_params); diff --git a/ccsrc/Protocols/LTE/uu_raw.cc b/ccsrc/Protocols/LTE/uu_raw.cc index 137c009..bb3817a 100644 --- a/ccsrc/Protocols/LTE/uu_raw.cc +++ b/ccsrc/Protocols/LTE/uu_raw.cc @@ -58,19 +58,19 @@ int uu_raw::shutdown() { return 0; } -void uu_raw::send_data(OCTETSTRING &data, params_its ¶ms) { +void uu_raw::send_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log(">>> uu_raw::send_data"); _layer->send_data(data, params); } -void uu_raw::receive_data(OCTETSTRING &p_data, params_its &p_params) { +void uu_raw::receive_data(OCTETSTRING &p_data, params &p_params) { loggers::get_instance().log(">>> uu_raw::receive_data"); - incoming_packet_notify(p_data, p_params); + incoming_packet_notify(p_data, static_cast(p_params)); } void uu_raw::update(OCTETSTRING &p_data, params_its &p_params) { loggers::get_instance().log_msg(">>> uu_raw::update: ", p_data); - receive_data(p_data, p_params); + receive_data(p_data, static_cast(p_params)); } diff --git a/ccsrc/Protocols/LTE/uu_raw.hh b/ccsrc/Protocols/LTE/uu_raw.hh index 4dfa9f0..a1401e2 100644 --- a/ccsrc/Protocols/LTE/uu_raw.hh +++ b/ccsrc/Protocols/LTE/uu_raw.hh @@ -15,8 +15,8 @@ public: int setup(const params_its ¶ms); int shutdown(); - void send_data(OCTETSTRING &data, params_its ¶ms); - void receive_data(OCTETSTRING &p_data, params_its &p_params); + void send_data(OCTETSTRING &data, params ¶ms); + void receive_data(OCTETSTRING &p_data, params &p_params); void update(OCTETSTRING &p_data, params_its &p_params); diff --git a/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.cc b/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.cc index a5bf9df..734a266 100644 --- a/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.cc +++ b/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.cc @@ -45,13 +45,13 @@ void mapem_spatem_layer::sendMsg(const LibItsMapemSpatem__TypesAndValues::Spatem send_data(data, _params); } -void mapem_spatem_layer::send_data(OCTETSTRING &data, params_its ¶ms) { +void mapem_spatem_layer::send_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log_msg(">>> mapem_spatem_layer::send_data: ", data); // params.log(); send_to_all_layers(data, params); } -void mapem_spatem_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { +void mapem_spatem_layer::receive_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log_msg(">>> mapem_spatem_layer::receive_data: ", data); // Sanity check diff --git a/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.hh b/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.hh index b0a5b68..37b7843 100644 --- a/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.hh +++ b/ccsrc/Protocols/MapemSpatem_layers/mapem_spatem_layer.hh @@ -35,8 +35,8 @@ public: void sendMsg(const LibItsMapemSpatem__TypesAndValues::MapemReq &, params_its ¶ms); void sendMsg(const LibItsMapemSpatem__TypesAndValues::SpatemReq &, params_its ¶ms); - virtual void send_data(OCTETSTRING &data, params_its ¶ms); - virtual void receive_data(OCTETSTRING &data, params_its &info); + virtual void send_data(OCTETSTRING &data, params ¶ms); + virtual void receive_data(OCTETSTRING &data, params &info); int enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security); diff --git a/ccsrc/Protocols/Qualcomm/qualcomm_layer.cc b/ccsrc/Protocols/Qualcomm/qualcomm_layer.cc index d0e50e8..b8434fa 100644 --- a/ccsrc/Protocols/Qualcomm/qualcomm_layer.cc +++ b/ccsrc/Protocols/Qualcomm/qualcomm_layer.cc @@ -22,7 +22,7 @@ qualcomm_layer::qualcomm_layer(const std::string &p_type, const std::string &par registration::get_instance().add_item(p_type, this); } -void qualcomm_layer::send_data(OCTETSTRING &data, params_its ¶ms) { +void qualcomm_layer::send_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log_msg(">>> qualcomm_layer::send_data: ", data); OCTETSTRING buffer = int2oct(3, 1); // CV2X identifier @@ -32,7 +32,7 @@ void qualcomm_layer::send_data(OCTETSTRING &data, params_its ¶ms) { send_to_all_layers(buffer, params); } -void qualcomm_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { +void qualcomm_layer::receive_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log(">>> qualcomm_layer::receive_data: Received %d bytes", data.lengthof()); loggers::get_instance().log_to_hexa("Packet dump", data); @@ -41,10 +41,10 @@ void qualcomm_layer::receive_data(OCTETSTRING &data, params_its ¶ms) { loggers::get_instance().log_msg("qualcomm_layer::receive_data: payload for upper layer:", data); if (_observers.size() != 0) { - incoming_packet_notify(data, params); + incoming_packet_notify(data, static_cast(params)); } else { // Pass the packet to the upper layers - receive_to_all_layers(data, params); + receive_to_all_layers(data, static_cast(params)); } } diff --git a/ccsrc/Protocols/Qualcomm/qualcomm_layer.hh b/ccsrc/Protocols/Qualcomm/qualcomm_layer.hh index 326e9b7..866e91c 100644 --- a/ccsrc/Protocols/Qualcomm/qualcomm_layer.hh +++ b/ccsrc/Protocols/Qualcomm/qualcomm_layer.hh @@ -40,8 +40,8 @@ public: */ virtual ~qualcomm_layer(){}; - virtual void send_data(OCTETSTRING &data, params_its ¶ms); - virtual void receive_data(OCTETSTRING &data, params_its &info); + virtual void send_data(OCTETSTRING &data, params ¶ms); + virtual void receive_data(OCTETSTRING &data, params &info); inline void incoming_packet_observer_attach(data_event_notifier* p_observer) { _observers.push_back(p_observer); diff --git a/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.cc b/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.cc index 1b7e1dc..6f6e494 100644 --- a/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.cc +++ b/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.cc @@ -34,12 +34,12 @@ void RtcmemLayer::sendMsg(const LibItsRtcmem__TypesAndValues::RtcmemReq &p, para send_data(data, _params); } -void RtcmemLayer::send_data(OCTETSTRING &data, params_its ¶ms) { +void RtcmemLayer::send_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log_msg(">>> RtcmemLayer::send_data: ", data); send_to_all_layers(data, params); } -void RtcmemLayer::receive_data(OCTETSTRING &data, params_its ¶ms) { +void RtcmemLayer::receive_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log_msg(">>> RtcmemLayer::receive_data: ", data); // Decode the RTCMEM payload diff --git a/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.hh b/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.hh index e48da06..791be4b 100644 --- a/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.hh +++ b/ccsrc/Protocols/Rtcmem_layers/RtcmemLayer.hh @@ -30,8 +30,8 @@ public: void sendMsg(const LibItsRtcmem__TypesAndValues::RtcmemReq &, params_its ¶ms); - virtual void send_data(OCTETSTRING &data, params_its ¶ms); - virtual void receive_data(OCTETSTRING &data, params_its &info); + virtual void send_data(OCTETSTRING &data, params ¶ms); + virtual void receive_data(OCTETSTRING &data, params &info); int enable_secured_mode(const std::string &p_certificate_id, const boolean p_enforce_security); diff --git a/ccsrc/framework/include/params_its.hh b/ccsrc/framework/include/params_its.hh index 9dc0db3..4ea1c6d 100644 --- a/ccsrc/framework/include/params_its.hh +++ b/ccsrc/framework/include/params_its.hh @@ -78,6 +78,9 @@ public: //! \publicsection static const std::string& mqtt_topics; //! Uu interafce MQTT topics static const std::string& mqtt_protocol; //! Uu interafce MQTT protocol name static const std::string& mqtt_client_id; //! Uu interafce MQTT client identity + static const std::string& amqp_protocol; //! Uu interafce AMQP protocol name + static const std::string& amqp_vhost; //! Uu interafce AMQP vhost identifier + static const std::string& amqp_queue_id; //! Uu interafce AMQP queue identifier static const std::string& leap_delay_us; //! Leap seconds to convert to TAI. Default: 4us diff --git a/ccsrc/framework/src/params_its.cc b/ccsrc/framework/src/params_its.cc index a9d533a..2112c67 100644 --- a/ccsrc/framework/src/params_its.cc +++ b/ccsrc/framework/src/params_its.cc @@ -68,5 +68,8 @@ const std::string& params_its::pc5_layer = std::string("pc5_layer") const std::string& params_its::mqtt_topics = std::string("mqtt_topics"); const std::string& params_its::mqtt_protocol = std::string("mqtt_protocol"); const std::string& params_its::mqtt_client_id = std::string("mqtt_client_id"); +const std::string& params_its::amqp_protocol = std::string("amqp_protocol"); +const std::string& params_its::amqp_vhost = std::string("amqp_vhost"); +const std::string& params_its::amqp_queue_id = std::string("amqp_queue_id"); const std::string& params_its::leap_delay_us = std::string("leap_delay_us"); diff --git a/etc/AtsCAM/AtsCAM.cfg b/etc/AtsCAM/AtsCAM.cfg index 5870d5a..6219f21 100644 --- a/etc/AtsCAM/AtsCAM.cfg +++ b/etc/AtsCAM/AtsCAM.cfg @@ -87,6 +87,19 @@ LogEventTypes:= Yes # time_offset : Time offset, used to skip packets with time offset < time_offset # save_mode : Set to 1 to save sent packet, 0 otherwise +# Single GeoNetworking component port +# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf +# its_aid=36: CAM +# its_aid=37: DENM +# its_aid=39: VAM +# its_aid=137: SPAT +# its_aid=138: MAP +# its_aid=139: IVIM +# its_aid=140: SREM/SSEM +# its_aid=141: GeoMet +# its_aid=128: RTCMEM +# its_aid=639: CPS + # Cygwin #system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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 diff --git a/etc/AtsCAM/AtsCAM_Savary.cfg_ b/etc/AtsCAM/AtsCAM_Savary.cfg_ index fa7288f..211798e 100644 --- a/etc/AtsCAM/AtsCAM_Savary.cfg_ +++ b/etc/AtsCAM/AtsCAM_Savary.cfg_ @@ -91,6 +91,19 @@ LogEventTypes:= Yes # time_offset : Time offset, used to skip packets with time offset < time_offset # save_mode : Set to 1 to save sent packet, 0 otherwise +# Single GeoNetworking component port +# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf +# its_aid=36: CAM +# its_aid=37: DENM +# its_aid=39: VAM +# its_aid=137: SPAT +# its_aid=138: MAP +# its_aid=139: IVIM +# its_aid=140: SREM/SSEM +# its_aid=141: GeoMet +# its_aid=128: RTCMEM +# its_aid=639: CPS + #system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=4e685195ff0a)/PCAP(mac_src=ce550426c7e4,nic=tap0,filter=and ether proto 0x8947)" system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=f8cab8083918)/PCAP(mac_src=f8cab8083918,nic=eno1,filter=and ether proto 0x8947)" diff --git a/etc/AtsCAM/AtsCAM_Simulator.cfg_ b/etc/AtsCAM/AtsCAM_Simulator.cfg_ index 5870d5a..6219f21 100644 --- a/etc/AtsCAM/AtsCAM_Simulator.cfg_ +++ b/etc/AtsCAM/AtsCAM_Simulator.cfg_ @@ -87,6 +87,19 @@ LogEventTypes:= Yes # time_offset : Time offset, used to skip packets with time offset < time_offset # save_mode : Set to 1 to save sent packet, 0 otherwise +# Single GeoNetworking component port +# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf +# its_aid=36: CAM +# its_aid=37: DENM +# its_aid=39: VAM +# its_aid=137: SPAT +# its_aid=138: MAP +# its_aid=139: IVIM +# its_aid=140: SREM/SSEM +# its_aid=141: GeoMet +# its_aid=128: RTCMEM +# its_aid=639: CPS + # Cygwin #system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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 diff --git a/etc/AtsCAM/AtsCAM_Yogoko.cf_ b/etc/AtsCAM/AtsCAM_Yogoko.cf_ index e107c34..d8d7414 100644 --- a/etc/AtsCAM/AtsCAM_Yogoko.cf_ +++ b/etc/AtsCAM/AtsCAM_Yogoko.cf_ @@ -91,6 +91,19 @@ LogEventTypes:= Yes # time_offset : Time offset, used to skip packets with time offset < time_offset # save_mode : Set to 1 to save sent packet, 0 otherwise +# Single GeoNetworking component port +# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf +# its_aid=36: CAM +# its_aid=37: DENM +# its_aid=39: VAM +# its_aid=137: SPAT +# its_aid=138: MAP +# its_aid=139: IVIM +# its_aid=140: SREM/SSEM +# its_aid=141: GeoMet +# its_aid=128: RTCMEM +# its_aid=639: CPS + # Cygwin #system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,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 diff --git a/etc/AtsCAM/AtsCAM_pcap.cfg_ b/etc/AtsCAM/AtsCAM_pcap.cfg_ index 9e6945d..e203f7d 100644 --- a/etc/AtsCAM/AtsCAM_pcap.cfg_ +++ b/etc/AtsCAM/AtsCAM_pcap.cfg_ @@ -96,6 +96,19 @@ LogEventTypes:= Yes # save_mode : Set to 1 to save sent packet, 0 otherwise # +# Single GeoNetworking component port +# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf +# its_aid=36: CAM +# its_aid=37: DENM +# its_aid=39: VAM +# its_aid=137: SPAT +# its_aid=138: MAP +# its_aid=139: IVIM +# its_aid=140: SREM/SSEM +# its_aid=141: GeoMet +# its_aid=128: RTCMEM +# its_aid=639: CPS + # Non secured IUT (LAN USB) system.camPort.params := " CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/ diff --git a/etc/AtsCPS/AtsCPS_Simulator.cfg_ b/etc/AtsCPS/AtsCPS_Simulator.cfg_ index 15b208d..27ec4bc 100644 --- a/etc/AtsCPS/AtsCPS_Simulator.cfg_ +++ b/etc/AtsCPS/AtsCPS_Simulator.cfg_ @@ -86,6 +86,19 @@ LogEventTypes:= Yes # time_offset : Time offset, used to skip packets with time offset < time_offset # save_mode : Set to 1 to save sent packet, 0 otherwise +# Single GeoNetworking component port +# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf +# its_aid=36: CAM +# its_aid=37: DENM +# its_aid=39: VAM +# its_aid=137: SPAT +# its_aid=138: MAP +# its_aid=139: IVIM +# its_aid=140: SREM/SSEM +# its_aid=141: GeoMet +# its_aid=128: RTCMEM +# its_aid=639: CPS + # Cygwin #system.cpmPort.params := "CPS(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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 diff --git a/etc/AtsIS/AtsIS_IVIM.cf_ b/etc/AtsIS/AtsIS_IVIM.cf_ index 741acdf..e36a80d 100644 --- a/etc/AtsIS/AtsIS_IVIM.cf_ +++ b/etc/AtsIS/AtsIS_IVIM.cf_ @@ -94,6 +94,19 @@ LogEventTypes:= Yes # time_offset : Time offset, used to skip packets with time offset < time_offset # save_mode : 1 to save sent packet, 0 otherwise +# Single GeoNetworking component port +# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf +# its_aid=36: CAM +# its_aid=37: DENM +# its_aid=39: VAM +# its_aid=137: SPAT +# its_aid=138: MAP +# its_aid=139: IVIM +# its_aid=140: SREM/SSEM +# its_aid=141: GeoMet +# its_aid=128: RTCMEM +# its_aid=639: CPS + #Cygwin #system.ivimPort.params := "IVIM(next_header=btpB,header_type=uni)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=/home/yanng/tmp/certificates)/ETH(mac_src=e2b7b30429eb)/PCAP(mac_src=e2b7b30429eb,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" # Linux diff --git a/etc/AtsIS/AtsIS_Mapem.cf_ b/etc/AtsIS/AtsIS_Mapem.cf_ index 67a4065..c260891 100644 --- a/etc/AtsIS/AtsIS_Mapem.cf_ +++ b/etc/AtsIS/AtsIS_Mapem.cf_ @@ -84,6 +84,19 @@ LogEventTypes:= Yes # time_offset : Time offset, used to skip packets with time offset < time_offset # save_mode : 1 to save sent packet, 0 otherwise +# Single GeoNetworking component port +# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf +# its_aid=36: CAM +# its_aid=37: DENM +# its_aid=39: VAM +# its_aid=137: SPAT +# its_aid=138: MAP +# its_aid=139: IVIM +# its_aid=140: SREM/SSEM +# its_aid=141: GeoMet +# its_aid=128: RTCMEM +# its_aid=639: CPS + #Cygwin #system.mapemSpatemPort.params := "MAPEM(next_header=btpB,header_type=uni)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=/home/yanng/tmp/certificates)/ETH(mac_src=e2b7b30429eb)/PCAP(mac_src=e2b7b30429eb,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" # Linux diff --git a/etc/AtsIS/AtsIS_Spatem.cf_ b/etc/AtsIS/AtsIS_Spatem.cf_ index b5d062f..70395dc 100644 --- a/etc/AtsIS/AtsIS_Spatem.cf_ +++ b/etc/AtsIS/AtsIS_Spatem.cf_ @@ -83,6 +83,19 @@ LogEventTypes:= Yes # time_offset : Time offset, used to skip packets with time offset < time_offset # save_mode : 1 to save sent packet, 0 otherwise +# Single GeoNetworking component port +# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf +# its_aid=36: CAM +# its_aid=37: DENM +# its_aid=39: VAM +# its_aid=137: SPAT +# its_aid=138: MAP +# its_aid=139: IVIM +# its_aid=140: SREM/SSEM +# its_aid=141: GeoMet +# its_aid=128: RTCMEM +# its_aid=639: CPS + #Cygwin #system.mapemSpatemPort.params := "SPATEM(next_header=btpB,header_type=uni)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=/home/yanng/tmp/certificates)/ETH(mac_src=e2b7b30429eb)/PCAP(mac_src=e2b7b30429eb,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" # Linux diff --git a/etc/AtsMBR/AtsMBR.cfg b/etc/AtsMBR/AtsMBR.cfg index 99c2569..a39b88e 100644 --- a/etc/AtsMBR/AtsMBR.cfg +++ b/etc/AtsMBR/AtsMBR.cfg @@ -125,12 +125,14 @@ LogEventTypes:= Yes # https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf # its_aid=36: CAM # its_aid=37: DENM +# its_aid=39: VAM # its_aid=137: SPAT # its_aid=138: MAP # its_aid=139: IVIM # its_aid=140: SREM/SSEM # its_aid=141: GeoMet # its_aid=128: RTCMEM +# its_aid=639: CPS # 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)" diff --git a/etc/AtsMBR/AtsMBR_Simu.cfg_ b/etc/AtsMBR/AtsMBR_Simu.cfg_ index 3b7f910..667f011 100644 --- a/etc/AtsMBR/AtsMBR_Simu.cfg_ +++ b/etc/AtsMBR/AtsMBR_Simu.cfg_ @@ -125,12 +125,14 @@ LogEventTypes:= Yes # https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf # its_aid=36: CAM # its_aid=37: DENM +# its_aid=39: VAM # its_aid=137: SPAT # its_aid=138: MAP # its_aid=139: IVIM # its_aid=140: SREM/SSEM # its_aid=141: GeoMet # its_aid=128: RTCMEM +# its_aid=639: CPS # 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)" diff --git a/etc/AtsPki/AtsPki_Commsignia.cfg_ b/etc/AtsPki/AtsPki_Commsignia.cfg_ index 11f810f..3de3c63 100644 --- a/etc/AtsPki/AtsPki_Commsignia.cfg_ +++ b/etc/AtsPki/AtsPki_Commsignia.cfg_ @@ -139,8 +139,18 @@ LogEventTypes:= Yes # save_mode : 1 to save sent packet, 0 otherwise # Single GeoNetworking component port -# its_aid = 36 CAM -# its_aid = 37 DENM +# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf +# its_aid=36: CAM +# its_aid=37: DENM +# its_aid=39: VAM +# its_aid=137: SPAT +# its_aid=138: MAP +# its_aid=139: IVIM +# its_aid=140: SREM/SSEM +# its_aid=141: GeoMet +# its_aid=128: RTCMEM +# its_aid=639: CPS + system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=1,its_aid=36,certificate=CERT_TS_A_AT,sec_db_path=/home/vagrant/tmp/certificates)/COMMSIGNIA(mac_src=000000000011,use_vpn=1,target_host=10.8.0.1)/UDP(dst_ip=10.8.0.1,src_port=7943,dst_port=7943)" # Single HTTP component port diff --git a/etc/AtsPki/AtsPki_Simu.cfg_ b/etc/AtsPki/AtsPki_Simu.cfg_ index 8ed3d3c..6c86618 100644 --- a/etc/AtsPki/AtsPki_Simu.cfg_ +++ b/etc/AtsPki/AtsPki_Simu.cfg_ @@ -181,8 +181,18 @@ LogEventTypes:= Yes # save_mode : 1 to save sent packet, 0 otherwise # Single GeoNetworking component port -# its_aid = 36 CAM -# its_aid = 37 DENM +# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf +# its_aid=36: CAM +# its_aid=37: DENM +# its_aid=39: VAM +# its_aid=137: SPAT +# its_aid=138: MAP +# its_aid=139: IVIM +# its_aid=140: SREM/SSEM +# its_aid=141: GeoMet +# its_aid=128: RTCMEM +# its_aid=639: CPS + system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=1,its_aid=36)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlo1,filter=and ether proto 0x8947)" # Single HTTP component port diff --git a/etc/AtsSecurity/AtsSecurity.cfg b/etc/AtsSecurity/AtsSecurity.cfg index 62e3192..5e1cd61 100644 --- a/etc/AtsSecurity/AtsSecurity.cfg +++ b/etc/AtsSecurity/AtsSecurity.cfg @@ -119,12 +119,14 @@ LogEventTypes:= Yes # https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf # its_aid=36: CAM # its_aid=37: DENM +# its_aid=39: VAM # its_aid=137: SPAT # its_aid=138: MAP # its_aid=139: IVIM # its_aid=140: SREM/SSEM # its_aid=141: GeoMet # its_aid=128: RTCMEM +# its_aid=639: CPS # Cygwin #system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,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)" diff --git a/etc/AtsSecurity/AtsSecurity_codha.cf_ b/etc/AtsSecurity/AtsSecurity_codha.cf_ index 9d77df2..7fc2f1c 100644 --- a/etc/AtsSecurity/AtsSecurity_codha.cf_ +++ b/etc/AtsSecurity/AtsSecurity_codha.cf_ @@ -110,9 +110,18 @@ LogEventTypes:= Yes # save_mode : 1 to save sent packet, 0 otherwise # Single GeoNetworking component port -# its_aid = 36 CAM -# its_aid = 37 DENM -# its_aid = 141 GeonNet mgnt +# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf +# its_aid=36: CAM +# its_aid=37: DENM +# its_aid=39: VAM +# its_aid=137: SPAT +# its_aid=138: MAP +# its_aid=139: IVIM +# its_aid=140: SREM/SSEM +# its_aid=141: GeoMet +# its_aid=128: RTCMEM +# its_aid=639: CPS + system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,its_aid=36)/ETH(mac_src=080027d5428a)/PCAP(mac_src=080027d5428a,nic=eth2,filter=and ether proto 0x8947)" #system.utPort.params := "UT_GN/UDP(dst_ip=10.100.60.27)" diff --git a/etc/AtsVRU/AtsVRU_Simulator.cfg_ b/etc/AtsVRU/AtsVRU_Simulator.cfg_ index 2e496a2..5197dd9 100644 --- a/etc/AtsVRU/AtsVRU_Simulator.cfg_ +++ b/etc/AtsVRU/AtsVRU_Simulator.cfg_ @@ -86,6 +86,19 @@ LogEventTypes:= Yes # time_offset : Time offset, used to skip packets with time offset < time_offset # save_mode : Set to 1 to save sent packet, 0 otherwise +# Single GeoNetworking component port +# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf +# its_aid=36: CAM +# its_aid=37: DENM +# its_aid=39: VAM +# its_aid=137: SPAT +# its_aid=138: MAP +# its_aid=139: IVIM +# its_aid=140: SREM/SSEM +# its_aid=141: GeoMet +# its_aid=128: RTCMEM +# its_aid=639: CPS + # Cygwin #system.vruPort.params := "VRU(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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 diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 2cd9d00..72af849 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 2cd9d00d66d4701c22c642ea9ac2777b0e13c400 +Subproject commit 72af849cc49c989fcb6f88dddfdeb75684ad02ed diff --git a/ttcn/AtsCPS b/ttcn/AtsCPS index 6bb83e6..ce6120e 160000 --- a/ttcn/AtsCPS +++ b/ttcn/AtsCPS @@ -1 +1 @@ -Subproject commit 6bb83e613233d67713937ec3109c0e8eb1c9dbfe +Subproject commit ce6120ec2ad1e6be306924f6a790d902a6b9f38a diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index f651103..ef09e0f 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit f651103b1769ae3c9548274e222c0da474825eaa +Subproject commit ef09e0f3f2f773dc0c63c44da4436773106ec2bd diff --git a/ttcn/AtsIS b/ttcn/AtsIS index 9779a56..95ed727 160000 --- a/ttcn/AtsIS +++ b/ttcn/AtsIS @@ -1 +1 @@ -Subproject commit 9779a569f65e0005e1f2250d105d3e6f34ad3eb1 +Subproject commit 95ed727c7cc6f32b15e94f6f3d9f6f669f041acd diff --git a/ttcn/AtsMBR b/ttcn/AtsMBR index e8cc223..fc16ba2 160000 --- a/ttcn/AtsMBR +++ b/ttcn/AtsMBR @@ -1 +1 @@ -Subproject commit e8cc22303304975e6c3b8361f2e2208dd3dcea64 +Subproject commit fc16ba2278f8bcad4dfad9afcb1b79485c368225 diff --git a/ttcn/AtsVRU b/ttcn/AtsVRU index 521d0e6..fd1aabe 160000 --- a/ttcn/AtsVRU +++ b/ttcn/AtsVRU @@ -1 +1 @@ -Subproject commit 521d0e647ef7e098961485017ca06f8cb37095ab +Subproject commit fd1aabe32f0d8d6bb47855880466db4deb53b132 diff --git a/ttcn/LibIts b/ttcn/LibIts index e19730e..a89b8a5 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit e19730e58b6f639fc22bd0b26287b40281c0c33d +Subproject commit a89b8a5da712f10c505a5aec57a00abff63c9434 -- GitLab From 364ffe641a8b82e3308e4f20193b08127f493f62 Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 27 Aug 2024 08:26:02 +0200 Subject: [PATCH 158/178] Add missing cfg files; Editorial changes in cfg files --- docs/o2.cfg | 2 +- etc/AtsCAM/AtsCAM.cfg | 4 +- etc/AtsCAM/AtsCAM_Savary.cfg_ | 2 +- etc/AtsCAM/AtsCAM_Simulator.cfg_ | 4 +- etc/AtsCAM/AtsCAM_Yogoko.cf_ | 2 +- etc/AtsCAM/AtsCAM_nfiniity.cfg_ | 167 +++++++++++++++++++ etc/AtsCAM/AtsCAM_pcap.cfg_ | 2 +- etc/AtsCPS/AtsCPS_Simulator.cfg_ | 10 +- etc/AtsDENM/AtsDENM.cfg | 2 +- etc/AtsGeoNetworking/AtsGeoNetworking.cfg | 4 +- etc/AtsIS/AtsIS_IVIM.cf_ | 30 ++-- etc/AtsIS/AtsIS_Mapem.cf_ | 10 +- etc/AtsIS/AtsIS_Rtcmem.cf_ | 132 +++++++++++++++ etc/AtsIS/AtsIS_Spatem.cf_ | 18 +- etc/AtsIS/AtsIS_SxEM.cf_ | 191 ++++++++++++++++++++++ etc/AtsMBR/AtsMBR.cfg | 4 +- etc/AtsMBR/AtsMBR_Simu.cfg_ | 4 +- etc/AtsPki/AtsPki_Atos.cfg_ | 2 +- etc/AtsPki/AtsPki_Autocrypt.cfg_ | 4 +- etc/AtsPki/AtsPki_Commsignia.cfg_ | 2 +- etc/AtsPki/AtsPki_Ctag.cfg_ | 2 +- etc/AtsPki/AtsPki_Etas.cfg_ | 2 +- etc/AtsPki/AtsPki_Microsec.cfg_ | 4 +- etc/AtsPki/AtsPki_Simu.cfg_ | 4 +- etc/AtsSecurity/AtsSecurity.cfg | 58 +++---- etc/AtsSecurity/AtsSecurity_codha.cf_ | 68 ++++---- etc/AtsVRU/AtsVRU_Simulator.cfg_ | 10 +- 27 files changed, 617 insertions(+), 127 deletions(-) create mode 100644 etc/AtsCAM/AtsCAM_nfiniity.cfg_ create mode 100644 etc/AtsIS/AtsIS_Rtcmem.cf_ create mode 100644 etc/AtsIS/AtsIS_SxEM.cf_ diff --git a/docs/o2.cfg b/docs/o2.cfg index 22c648e..fb9ad6b 100644 --- a/docs/o2.cfg +++ b/docs/o2.cfg @@ -745,7 +745,7 @@ INPUT_FILTER = # info on how filters are used. If FILTER_PATTERNS is empty or if # non of the patterns match the file name, INPUT_FILTER is applied. -FILTER_PATTERNS = +FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source diff --git a/etc/AtsCAM/AtsCAM.cfg b/etc/AtsCAM/AtsCAM.cfg index 6219f21..0579b15 100644 --- a/etc/AtsCAM/AtsCAM.cfg +++ b/etc/AtsCAM/AtsCAM.cfg @@ -39,7 +39,7 @@ LogEventTypes:= Yes # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer -# ll_address : GeoNetworking address of the Test System for beaconing. To be align with CAM +# ll_address : GeoNetworking address of the Test System for beaconing. To be align with CAM # latitude : Latitude of the Test System # longitude : Longitude of the Test System # beaconing : Set to 1 if GnLayer shall start beaconing @@ -77,7 +77,7 @@ LogEventTypes:= Yes # src_port: Source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used diff --git a/etc/AtsCAM/AtsCAM_Savary.cfg_ b/etc/AtsCAM/AtsCAM_Savary.cfg_ index 211798e..74f4321 100644 --- a/etc/AtsCAM/AtsCAM_Savary.cfg_ +++ b/etc/AtsCAM/AtsCAM_Savary.cfg_ @@ -81,7 +81,7 @@ LogEventTypes:= Yes # src_port: Source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used diff --git a/etc/AtsCAM/AtsCAM_Simulator.cfg_ b/etc/AtsCAM/AtsCAM_Simulator.cfg_ index 6219f21..0579b15 100644 --- a/etc/AtsCAM/AtsCAM_Simulator.cfg_ +++ b/etc/AtsCAM/AtsCAM_Simulator.cfg_ @@ -39,7 +39,7 @@ LogEventTypes:= Yes # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer -# ll_address : GeoNetworking address of the Test System for beaconing. To be align with CAM +# ll_address : GeoNetworking address of the Test System for beaconing. To be align with CAM # latitude : Latitude of the Test System # longitude : Longitude of the Test System # beaconing : Set to 1 if GnLayer shall start beaconing @@ -77,7 +77,7 @@ LogEventTypes:= Yes # src_port: Source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used diff --git a/etc/AtsCAM/AtsCAM_Yogoko.cf_ b/etc/AtsCAM/AtsCAM_Yogoko.cf_ index d8d7414..5261362 100644 --- a/etc/AtsCAM/AtsCAM_Yogoko.cf_ +++ b/etc/AtsCAM/AtsCAM_Yogoko.cf_ @@ -81,7 +81,7 @@ LogEventTypes:= Yes # src_port: Source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used diff --git a/etc/AtsCAM/AtsCAM_nfiniity.cfg_ b/etc/AtsCAM/AtsCAM_nfiniity.cfg_ new file mode 100644 index 0000000..efd1953 --- /dev/null +++ b/etc/AtsCAM/AtsCAM_nfiniity.cfg_ @@ -0,0 +1,167 @@ + +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# IUT Station ID +LibItsCommon_Pixits.PX_IUT_STATION_ID := 2533729309 + +LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB + +LibItsCam_Pics.PICS_DANGEROUSGOODS := true +LibItsCam_Pics.PICS_IS_IUT_SECURED := true + +# Instruct the Test System to use this certificate. Comment to use the default one (CERT_IUT_A_AT) +#LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_TS_F3_AT" # brainpool384 + +[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). + +LogFile := "../logs/AtsCAM/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +# CAM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# header_sub_type : sh (single hop) +# DENM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# BTP Layer +# type : btpA|btpB +# destination port: dst_port +# source port : src_port +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# GN Layer +# ll_address : GeoNetworking address of the Test System +# latitude : Latitude of the Test System +# longitude : Longitude of the Test System +# beaconing : Set to 1 if GnLayer shall start beaconing +# expiry : Beaconing timer expiry (ms) +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# secured_mode : Set to 1 if message exchanges shall be signed +# encrypted_mode : Set to 1 if message exchanges shall be encrypted +# NOTE: For signed & encrypted message exchanges, both secured_mode and encrypted_mode shall be set to 1 +# sec_db_path : Path to the certificates and keys storage location +# hash : Hash algorithm to be used when secured mode is set +# Authorized values are SHA-256 or SHA-384 +# Default: SHA-256 +# signature : Signature algorithm to be used when secured mode is set +# Authorized values are NISTP-256, NISTP-384, BP-256 and BP-384 +# Default: NISTP-256 +# cypher : Cyphering algorithm to be used when secured mode is set +# Authorized values are NISTP-256, BP-256 and BP-384 +# Default: NISTP-256 +# Ethernet layer +# mac_src :Source MAC address +# mac_bc :Broadcast address +# eth_type : Ethernet type +# Commsignia layer +# mac_src : IUT MAC address, used to discard packets +# To indicate no filering, use the value 000000000000 +# mac_bc : Broadcast address +# eth_type : Ethernet type, used to discard packets +# target_host : Device address +# target_port : Device port +# source_port : Test System port +# interface_id: Interface id, used to discard packets +# tx_power : TX power (dB) +# xport_mode : G5 or LTE-V2X +# UDP layer (IP/UDP based on Pcap) +# dst_ip : Destination IPv4 address (aa.bb.cc.dd) +# dst_port: Destination port +# src_ip : Source IPv4 address (aa.bb.cc.dd) +# src_port: Source port +# Pcap layer +# mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System +# filter : Pcap filter (compliant with tcpdump syntax) +# Online mode: +# nic: Local NIC +# If set, online mode is used +# Offline mode (nic is present but not set): +# file : File to read +# frame_offset: Frame offset, used to skip packets with frame number < frame_offset +# time_offset : Time offset, used to skip packets with time offset < time_offset +# save_mode : Set to 1 to save sent packet, 0 otherwise + +# Cygwin +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,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.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlo1,filter=and ether proto 0x8947)" +# Linux over OpenVPN +system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=tun0,filter=and ether proto 0x8947)" +# Linux over UDP +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=9091)" +# Linux over LTE/MQTT +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=dc536045af7e,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee2,mqtt_topics=obu,uu_transport=tcp,debug=1,server=127.0.0.1,port=1883)" + +# CAM UpperTester port based on UDP +#system.utPort.params := "UT_CAM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12346,reuse_incoming_source_adddress=1)" +system.utPort.params := "UT_CAM/UDP(dst_ip=10.8.0.6,reuse_incoming_source_adddress=1)" + +[EXECUTE] +ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_05 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_01 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_02 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_03 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_04 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_05 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_06 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_07 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_08 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_09 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_10 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_11 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_12 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_13 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_14 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_15 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_16 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_17 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_18 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_19 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_20 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_21 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_22 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_23 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_24 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_25 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_26 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_27 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_28 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_29 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_30 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_31 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_32 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_33 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_34 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_35 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_02 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_03 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_04 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_05 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_06 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_07 +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_08 +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 +#ItsCam_TestCases.TC_CAM_MSP_BV_01 + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/etc/AtsCAM/AtsCAM_pcap.cfg_ b/etc/AtsCAM/AtsCAM_pcap.cfg_ index e203f7d..2daa017 100644 --- a/etc/AtsCAM/AtsCAM_pcap.cfg_ +++ b/etc/AtsCAM/AtsCAM_pcap.cfg_ @@ -85,7 +85,7 @@ LogEventTypes:= Yes # src_port: Source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used diff --git a/etc/AtsCPS/AtsCPS_Simulator.cfg_ b/etc/AtsCPS/AtsCPS_Simulator.cfg_ index 27ec4bc..6377daa 100644 --- a/etc/AtsCPS/AtsCPS_Simulator.cfg_ +++ b/etc/AtsCPS/AtsCPS_Simulator.cfg_ @@ -38,7 +38,7 @@ LogEventTypes:= Yes # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer -# ll_address : GeoNetworking address of the Test System for beaconing. To be align with CPS +# ll_address : GeoNetworking address of the Test System for beaconing. To be align with CPS # latitude : Latitude of the Test System # longitude : Longitude of the Test System # beaconing : Set to 1 if GnLayer shall start beaconing @@ -76,7 +76,7 @@ LogEventTypes:= Yes # src_port: Source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used @@ -122,11 +122,11 @@ system.utPort.params := "UT_CPS/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port= [EXECUTE] #ItsCps_TestControl.control -# +# ItsCps_TestCases.TC_CPS_MSD_PAR_BV_01 -# +# #ItsCps_TestCases.TC_CPS_MSD_PAR_BV_02 -# +# #ItsCps_TestCases.TC_CPS_MSD_PAR_BV_03 [MAIN_CONTROLLER] diff --git a/etc/AtsDENM/AtsDENM.cfg b/etc/AtsDENM/AtsDENM.cfg index 15d4f34..aaf33a7 100644 --- a/etc/AtsDENM/AtsDENM.cfg +++ b/etc/AtsDENM/AtsDENM.cfg @@ -75,7 +75,7 @@ LogEventTypes:= Yes # src_port: Source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used diff --git a/etc/AtsGeoNetworking/AtsGeoNetworking.cfg b/etc/AtsGeoNetworking/AtsGeoNetworking.cfg index 86538d7..bd8ca7e 100644 --- a/etc/AtsGeoNetworking/AtsGeoNetworking.cfg +++ b/etc/AtsGeoNetworking/AtsGeoNetworking.cfg @@ -84,7 +84,7 @@ LogEventTypes:= Yes # src_port: Source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used @@ -101,7 +101,7 @@ mtc.geoNetworkingPort.params := "GN(ll_address=00000000000B,latitude=367470519,l NodeA.geoNetworkingPort.params := "GN(ll_address=00000000000A,latitude=367470519,longitude=-455595023)/ETH(mac_src=080027500f9a)/PCAP(mac_src=080027500f9a,nic=wlp0s20f3,filter=and ether proto 0x8947)" NodeB.geoNetworkingPort.params := "GN(ll_address=00000000000B,latitude=367470519,longitude=-455595023)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlp0s20f3,filter=and ether proto 0x8947)" NodeC.geoNetworkingPort.params := "GN(ll_address=00000000000C,latitude=367470519,longitude=-455595023)/ETH(mac_src=080027500f9c)/PCAP(mac_src=080027500f9c,nic=wlp0s20f3,filter=and ether proto 0x8947)" -NodeD.geoNetworkingPort.params := "GN(ll_address=00000000000D,latitude=367470519,longitude=-455595023)/ETH(mac_src=080027500f9d)/PCAP(mac_src=080027500f9d,nic=wlp0s20f3,filter=and ether proto 0x8947 and not ether src 8c554ac1eee1)" +NodeD.geoNetworkingPort.params := "GN(ll_address=00000000000D,latitude=367470519,longitude=-455595023)/ETH(mac_src=080027500f9d)/PCAP(mac_src=080027500f9d,nic=wlp0s20f3,filter=and ether proto 0x8947 and not ether src 8c554ac1eee1)" # UpperTester port based on UDP #system.utPort.params := "UT_GN/UDP(dst_ip=192.168.2.2)" diff --git a/etc/AtsIS/AtsIS_IVIM.cf_ b/etc/AtsIS/AtsIS_IVIM.cf_ index e36a80d..2bf25b7 100644 --- a/etc/AtsIS/AtsIS_IVIM.cf_ +++ b/etc/AtsIS/AtsIS_IVIM.cf_ @@ -84,7 +84,7 @@ LogEventTypes:= Yes # src_port: source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used @@ -133,7 +133,7 @@ system.utPort.params := "UT_IVIM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12 #ItsIvim_TestCases.TC_IS_IVI_GEN_LOC_BV_04 # Check that If the zone definition applies to the entire carriageway (all lanes), the #ItsIvim_TestCases.TC_IS_IVI_GEN_LOC_BV_05 -# Check that IUT includes, for each zone, one or more of the following optional components to define the zone: +# Check that IUT includes, for each zone, one or more of the following optional components to define the zone: #ItsIvim_TestCases.TC_IS_IVI_GEN_LOC_BV_06 # Check that management container contains a country code according to ISO 3166-1. Numbers shall be assigned on national basis. #ItsIvim_TestCases.TC_IS_IVI_GEN_MANC_BV_01 @@ -159,27 +159,27 @@ system.utPort.params := "UT_IVIM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12 #ItsIvim_TestCases.TC_IS_IVI_GEN_EVUP_BV_04 # Check that the iviIdentificationNumber remains unchanged IVIM is updated #ItsIvim_TestCases.TC_IS_IVI_GEN_EVUP_BV_05 -# The IUT shall, at minimum, include the identifier(s) of a Relevance Zone in the component +# The IUT shall, at minimum, include the identifier(s) of a Relevance Zone in the component #ItsIvim_TestCases.TC_IS_IVI_GEN_GENAPP_BV_01 -# Check that all zone IDs in the General Application Container references existing items in +# Check that all zone IDs in the General Application Container references existing items in #ItsIvim_TestCases.TC_IS_IVI_GEN_GENAPP_BV_02 -# The IUT shall include the component direction to describe the direction of relevance +# The IUT shall include the component direction to describe the direction of relevance #ItsIvim_TestCases.TC_IS_IVI_GEN_GENAPP_BV_03 # The IUT shall include at least one element in the roadSignCodes container. #ItsIvim_TestCases.TC_IS_IVI_GEN_GENAPP_BV_04 -# Check that all layoutID of the General Application Containers references existing layouts +# Check that all layoutID of the General Application Containers references existing layouts #ItsIvim_TestCases.TC_IS_IVI_GEN_GENAPP_BV_05 # Check that all zone IDs in the Road Configuration Container references existing items in the Location Container of the same IVIM Structure. #ItsIvim_TestCases.TC_IS_IVI_GEN_RCC_BV_01 # Check that all Parts that relate to the same Location Container are included in the same Road Configuration Container. #ItsIvim_TestCases.TC_IS_IVI_GEN_RCC_BV_02 -# Check that Road Configuration Container contains description of all present lanes. +# Check that Road Configuration Container contains description of all present lanes. #ItsIvim_TestCases.TC_IS_IVI_GEN_RCC_BV_03 # Check that all zone IDs in the Text Container references existing items in the Location Container of the same IVIM Structure. #ItsIvim_TestCases.TC_IS_IVI_GEN_TEXT_BV_01 -# The sending ITS-S shall include the component direction to describe the direction of +# The sending ITS-S shall include the component direction to describe the direction of #ItsIvim_TestCases.TC_IS_IVI_GEN_TEXT_BV_02 -# The IUT can include either the component text and/or the component data. The IUT can repeat +# The IUT can include either the component text and/or the component data. The IUT can repeat #ItsIvim_TestCases.TC_IS_IVI_GEN_TEXT_BV_03 # Check that all layoutID of the Text Containers references existing layouts in the Layout Containers of the same IVIM Structure. #ItsIvim_TestCases.TC_IS_IVI_GEN_TEXT_BV_04 @@ -197,7 +197,7 @@ system.utPort.params := "UT_IVIM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12 #ItsIvim_TestCases.TC_IS_IVI_GEN_EVTR_BV_02 # Check that the IUT terminates IVM generation on cancellation request. ItsIvim_TestCases.TC_IS_IVI_GEN_EVTR_BV_03 -# Check that the IUT terminates IVM generation on negation request +# Check that the IUT terminates IVM generation on negation request #ItsIvim_TestCases.TC_IS_IVI_GEN_EVTR_BV_04 # Check that IVIM uses BTP_B packet #ItsIvim_TestCases.TC_IS_IVI_GEN_COM_BV_01 @@ -207,11 +207,11 @@ ItsIvim_TestCases.TC_IS_IVI_GEN_EVTR_BV_03 #ItsIvim_TestCases.TC_IS_IVI_GEN_SEC_BV_01 # Check that IVI service uses certificate containing valid ITS AID to sign IVIM. #ItsIvim_TestCases.TC_IS_IVI_GEN_SEC_BV_02 -# Check that IVI service uses certificate containing valid Service Specific Permissions of type BitmapSsp +# Check that IVI service uses certificate containing valid Service Specific Permissions of type BitmapSsp #ItsIvim_TestCases.TC_IS_IVI_GEN_SSP_BV_01 -# Check that IVI service sends an IVIM containing different road signs schema when it is permitted by the signing certificate +# Check that IVI service sends an IVIM containing different road signs schema when it is permitted by the signing certificate #ItsIvim_TestCases.TC_IS_IVI_GEN_SSP_BV_02 -# Check that IVI service sends an IVIM containing ISO/TS 14823 road signs codes of different service categories +# Check that IVI service sends an IVIM containing ISO/TS 14823 road signs codes of different service categories #ItsIvim_TestCases.TC_IS_IVI_GEN_SSP_BV_03 # Check that IVI service sends an IVIM containing lane status when it is permitted by the signing certificate. #ItsIvim_TestCases.TC_IS_IVI_GEN_SSP_BV_04 @@ -225,7 +225,7 @@ ItsIvim_TestCases.TC_IS_IVI_GEN_EVTR_BV_03 #ItsIvim_TestCases.TC_IS_IVI_GEN_SSP_BO_02 # Check that IVI service doesn’t send an IVIM containing ISO/TS 14823 road signs codes of different service categories when it is not permitted by the signing certificate. #ItsIvim_TestCases.TC_IS_IVI_GEN_SSP_BO_03 -# Check that IVI service doesn’t send an IVIM containing lane status when it is not permitted by the signing certificate +# Check that IVI service doesn’t send an IVIM containing lane status when it is not permitted by the signing certificate #ItsIvim_TestCases.TC_IS_IVI_GEN_SSP_BO_04 # Check that IVI service doesn’t send an IVIM containing different containers when it is not permitted by the signing certificate. #ItsIvim_TestCases.TC_IS_IVI_GEN_SSP_BO_05 @@ -261,7 +261,7 @@ ItsIvim_TestCases.TC_IS_IVI_GEN_EVTR_BV_03 #ItsIvim_TestCases.TC_IS_IVI_RCV_SSP_BO_01 # Check that the IUT skips a received IVIM message with service provider identifier not permitted by the signing certificate. #ItsIvim_TestCases.TC_IS_IVI_RCV_SSP_BO_02 -# Check that IVI service skips a received IVIM containing different road signs schema when it is not permitted by the signing certificate +# Check that IVI service skips a received IVIM containing different road signs schema when it is not permitted by the signing certificate #ItsIvim_TestCases.TC_IS_IVI_RCV_SSP_BO_03 # Check that IVI service skips a received IVIM containing ISO/TS 14823 road signs codes of different service categories when it is not permitted by the signing certificate. #ItsIvim_TestCases.TC_IS_IVI_RCV_SSP_BO_04 diff --git a/etc/AtsIS/AtsIS_Mapem.cf_ b/etc/AtsIS/AtsIS_Mapem.cf_ index c260891..71c44e5 100644 --- a/etc/AtsIS/AtsIS_Mapem.cf_ +++ b/etc/AtsIS/AtsIS_Mapem.cf_ @@ -74,7 +74,7 @@ LogEventTypes:= Yes # src_port: source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used @@ -155,15 +155,15 @@ ItsMapem_TestCases.TC_IS_RLT_GEN_MSGF_BV_02 #ItsMapem_TestCases.TC_IS_RLT_EVGN_BV_02 # Check that RLT Service transmits non-fragmented MAPEM without the Layer ID. #ItsMapem_TestCases.TC_IS_RLT_GEN_FRAG_BV_01 -# Check that RLT Service transmits fragmented MAPEM when the message size exceeds the allowed message length +# Check that RLT Service transmits fragmented MAPEM when the message size exceeds the allowed message length #ItsMapem_TestCases.TC_IS_RLT_GEN_FRAG_BV_02 # Check that the RLT Service transmits continuously both MAPEM and SPATEM. #ItsMapem_TestCases.TC_IS_RLT_GEN_COM_BV_01 # Check that the destination port for MAPEM is set to 2003 #ItsMapem_TestCases.TC_IS_RLT_GEN_COM_BV_03 -# Check that MAPEM uses BTP_B packet -# Check that the destination port for MAPEM is set to 2003 +# Check that MAPEM uses BTP_B packet +# Check that the destination port for MAPEM is set to 2003 #ItsMapem_TestCases.TC_IS_RLT_GEN_COM_BV_04 # Check that TLM service encapsulates MAPEM in a GBC with the HeaderType field set to the value of 4 #ItsMapem_TestCases.TC_IS_RLT_GEN_COM_BV_05 @@ -191,7 +191,7 @@ ItsMapem_TestCases.TC_IS_RLT_GEN_MSGF_BV_02 # Check that the IUT skips the MAPEM signed with certificate without permissions to sign MAPEM. #ItsMapem_TestCases.TC_IS_RLT_RCV_SEC_BO_02 # Check that the IUT skips the MAPEM containing intersections signed with certificate without service specific permissions (SSP) to sign such a MAPEM -#ItsMapem_TestCases.TC_IS_RLT_RCV_SEC_BO_03 +#ItsMapem_TestCases.TC_IS_RLT_RCV_SEC_BO_03 # Check that the IUT skips the MAPEM containing roadSegments signed with certificate #ItsMapem_TestCases.TC_IS_RLT_RCV_SEC_BO_04 diff --git a/etc/AtsIS/AtsIS_Rtcmem.cf_ b/etc/AtsIS/AtsIS_Rtcmem.cf_ new file mode 100644 index 0000000..624de26 --- /dev/null +++ b/etc/AtsIS/AtsIS_Rtcmem.cf_ @@ -0,0 +1,132 @@ + +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# IUT Station ID +LibItsCommon_Pixits.PX_IUT_STATION_ID := 2533729309 + +LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB + +[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). + +LogFile := "../logs/AtsIS/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +#ConsoleMask := ERROR | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +# SPATEM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc|uni +# header_sub_type : sh (single hop) +# SPATEM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# BTP Layer +# type : btpA|btpB +# destination port: dst_port +# source port : src_port +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# GN Layer +# ll_address : GeoNetworking address of the Test System +# latitude : latitude of the Test System +# longitude : longitude of the Test System +# beaconing : Set to 1 if GnLayer shall start beaconing +# Beaconning timer expiry: expiry (ms) +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# secured_mode : Set to 1 if message exchanges shall be signed +# encrypted_mode : Set to 1 if message exchanges shall be encrypted +# NOTE: For signed & encrypted message exchanges, both secured_mode and encrypted_mode shall be set to 1 +# secure_db_path : Path to the certificates and keys storage location +# hash : Hash algorithm to be used when secured mode is set +# Authorized values are SHA-256 or SHA-384 +# Default: SHA-256 +# cypher : Cyphering algorithm to be used when secured mode is set +# Authorized values are NISTP-256 and BP-256 +# Default: NISTP-256 +# Ethernet layer +# mac_src :Source MAC address +# mac_bc :Broadcast address +# eth_type : Ethernet type +# Commsignia layer +# mac_src : Device MAC address, used to discard packets +# To indicate no filering, use the value 000000000000 +# mac_bc : Broadcast address +# eth_type : Ethernet type, used to discard packets +# target_host : Device address +# target_port : Device port +# source_port : Test System port +# interface_id: Interface id, used to discard packets +# tx_power : TX power (dB) +# UDP layer (IP/UDP based on Pcap) +# dst_ip : destination IPv4 address (aa.bb.cc.dd) +# dst_port: destination port +# src_ip : source IPv4 address (aa.bb.cc.dd) +# src_port: source port +# Pcap layer +# mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System +# filter : Pcap filter (compliant with tcpdump syntax) +# Online mode: +# nic: Local NIC +# If set, online mode is used +# Offline mode (nic is present but not set): +# file : File to read +# frame_offset: Frame offset, used to skip packets with frame number < frame_offset +# time_offset : Time offset, used to skip packets with time offset < time_offset +# save_mode : 1 to save sent packet, 0 otherwise + +#Cygwin +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=uni)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=/home/yanng/tmp/certificates)/ETH(mac_src=e2b7b30429eb)/PCAP(mac_src=e2b7b30429eb,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" +# Linux +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/PCAP(mac_src=dc536045af7f,nic=wlp2s0,filter=and ether proto 0x8947)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp0s20f3,filter=and ether proto 0x8947)" +# Linux over UDP +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=50544)" +# Linux over LTE/MQTT +system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=dc536045af7e,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee2,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=127.0.0.1,port=1883)" + +# SPATEM UpperTester port based on UDP +system.utPort.params := "UT_MAPEMSPATEM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12346)" +#system.utPort.params := "UT_MAPEMSPATEM/UDP(dst_ip=192.168.146.26,dst_port=44100,src_port=12345)" +#system.utPort.params := "UT_MAPEMSPATEM/UDP(dst_ip=172.16.35.1)" + +[EXECUTE] + +#ItsRtcmem_TestControl.control + +# Check that protocolVersion is set to 1 and messageID is set to 13 +ItsRtcmem_TestCases.TC_IS_GPC_GEN_MSGF_BV_01 +# Check that GPC Service generates a new RTCMEM on reception of a valid AppRTCMEM_Start request +ItsRtcmem_TestCases.TC_IS_GPC_GEN_EVGN_BV_01 +# Check that GPC Service terminates on reception of a valid AppRTCMEM _Stop request +ItsRtcmem_TestCases.TC_IS_GPC_GEN_EVGN_BV_02 +# Check that RTCMEM uses BTP_B packet +ItsRtcmem_TestCases.TC_IS_GPC_GEN_COM_BV_02 +# Check that GPC service encapsulates RTCMEM in a GBC with the HeaderType field set to the value of 4 +ItsRtcmem_TestCases.TC_IS_GPC_GEN_COM_BV_03 +# Check that GPC service uses certificate containing valid ITS AID to sign RTCMEM messages +ItsRtcmem_TestCases.TC_IS_GPC_GEN_SEC_BV_01 +# Check that GPC service uses generic security profile to sign RTCMEM message and does not include additional security header elements +ItsRtcmem_TestCases.TC_IS_GPC_GEN_SEC_BV_02 +# Check that GPC service uses certificate containing valid Service Specific Permissions to sign RTCMEM messages and the SSP version is set to 1 +ItsRtcmem_TestCases.TC_IS_GPC_GEN_SSP_BV_01 +# Check that the IUT accepts the RTCMEM message permitted by the signing certificate +ItsRtcmem_TestCases.TC_IS_GPC_RCV_SSP_BV_01 +# Check that the IUT skips the RTCMEM message not permitted by the signing certificate +ItsRtcmem_TestCases.TC_IS_GPC_RCV_SSP_BO_02 +# Check that the IUT can successfully process all mandatory fields of RTCMEM received +ItsRtcmem_TestCases.TC_IS_GPC_RCV_MSGF_BV_01 + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/etc/AtsIS/AtsIS_Spatem.cf_ b/etc/AtsIS/AtsIS_Spatem.cf_ index 70395dc..1216cd8 100644 --- a/etc/AtsIS/AtsIS_Spatem.cf_ +++ b/etc/AtsIS/AtsIS_Spatem.cf_ @@ -73,7 +73,7 @@ LogEventTypes:= Yes # src_port: source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used @@ -122,9 +122,9 @@ ItsSpatem_TestCases.TC_IS_TLM_xxx_BV_01 # An IUT shall include a timestamp as part of the signal phase and timing message broadcast. #ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_04 # An IUT shall include signalGroupe for each intersection if this signalGroup is defined in the intersection configuration of the roadway geometric information (MAP) -# For each vehicular manoeuvre at a signalized intersection, an IUT shall include the current movement state. +# For each vehicular manoeuvre at a signalized intersection, an IUT shall include the current movement state. #ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_06 -# For each pedestrian manoeuvre at a signalized intersection, an IUT shall include the current movement state. +# For each pedestrian manoeuvre at a signalized intersection, an IUT shall include the current movement state. #ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_07 # For each active manoeuvre an IUT shall include the earliest time point when the manoeuvre state is predicted to change #ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_08 @@ -161,19 +161,19 @@ ItsSpatem_TestCases.TC_IS_TLM_xxx_BV_01 #ItsSpatem_TestCases.TC_IS_TLM_GEN_COMM_BV_03 # Check that TLM service uses certificate containing valid ITS AID to sign SPATEM messages. #ItsSpatem_TestCases.TC_IS_TLM_GEN_SEC_BV_01 -# Check that TLM service uses generic security profile to sign SPATEM message and does not include additional security header elements +# Check that TLM service uses generic security profile to sign SPATEM message and does not include additional security header elements #ItsSpatem_TestCases.TC_IS_TLM_GEN_SEC_BV_02 -# Check that TLM service uses certificate containing valid Service Specific Permissions of type BitmapSsp to sign SPATEM messages and the SSP version is set to 1 +# Check that TLM service uses certificate containing valid Service Specific Permissions of type BitmapSsp to sign SPATEM messages and the SSP version is set to 1 #ItsSpatem_TestCases.TC_IS_TLM_GEN_SSP_BV_01 -# Check that TLM service sends a SPAT message containing IntersectionState without prioritization and manoeuvre assist information when it is permitted by the signing certificate +# Check that TLM service sends a SPAT message containing IntersectionState without prioritization and manoeuvre assist information when it is permitted by the signing certificate #ItsSpatem_TestCases.TC_IS_TLM_GEN_SSP_BV_02 -# Check that TLM service does not send a SPAT message containing IntersectionState if it is not permitted by the certificate +# Check that TLM service does not send a SPAT message containing IntersectionState if it is not permitted by the certificate #ItsSpatem_TestCases.TC_IS_TLM_GEN_SSP_BO_03 # Check that TLM service sends a SPAT message containing public transport prioritization response when it is permitted by the signing certificate . #ItsSpatem_TestCases.TC_IS_TLM_GEN_SSP_BV_04 # Check that TLM service does not send a SPAT message containing IntersectionState if it is not permitted by the certificate. #ItsSpatem_TestCases.TC_IS_TLM_GEN_SSP_BO_05 -# Check that TLM service sends a SPAT message containing Intersection maneuver assisting information when it is permitted by the signing certificate +# Check that TLM service sends a SPAT message containing Intersection maneuver assisting information when it is permitted by the signing certificate #ItsSpatem_TestCases.TC_IS_TLM_GEN_SSP_BV_06 # Check that TLM service sends a SPAT message containing movement state maneuver assisting information when it is permitted by the signing certificate. #ItsSpatem_TestCases.TC_IS_TLM_GEN_SSP_BV_07 @@ -201,7 +201,7 @@ ItsSpatem_TestCases.TC_IS_TLM_xxx_BV_01 #ItsSpatem_TestCases.TC_IS_TLM_RCV_SSP_BO_04 # Check that the IUT accepts the SPATEM message containing IntersectionState with manoeuvre assist information permitted by the signing certificate. #ItsSpatem_TestCases.TC_IS_TLM_RCV_SSP_BV_05 -# Check that the IUT skips the SPATEM message containing IntersectionState with manoeuvre assist information permitted by the signing certificate +# Check that the IUT skips the SPATEM message containing IntersectionState with manoeuvre assist information permitted by the signing certificate #ItsSpatem_TestCases.TC_IS_TLM_RCV_SSP_BO_06 diff --git a/etc/AtsIS/AtsIS_SxEM.cf_ b/etc/AtsIS/AtsIS_SxEM.cf_ new file mode 100644 index 0000000..4896c7d --- /dev/null +++ b/etc/AtsIS/AtsIS_SxEM.cf_ @@ -0,0 +1,191 @@ + +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# IUT Station ID +LibItsCommon_Pixits.PX_IUT_STATION_ID := 2533729309 + +LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB + +[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). + +LogFile := "../logs/AtsIS/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +#ConsoleMask := ERROR | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +# SPATEM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc|uni +# header_sub_type : sh (single hop) +# SPATEM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# BTP Layer +# type : btpA|btpB +# destination port: dst_port +# source port : src_port +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# GN Layer +# ll_address : GeoNetworking address of the Test System +# latitude : latitude of the Test System +# longitude : longitude of the Test System +# beaconing : Set to 1 if GnLayer shall start beaconing +# Beaconning timer expiry: expiry (ms) +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# secured_mode : Set to 1 if message exchanges shall be signed +# encrypted_mode : Set to 1 if message exchanges shall be encrypted +# NOTE: For signed & encrypted message exchanges, both secured_mode and encrypted_mode shall be set to 1 +# secure_db_path : Path to the certificates and keys storage location +# hash : Hash algorithm to be used when secured mode is set +# Authorized values are SHA-256 or SHA-384 +# Default: SHA-256 +# cypher : Cyphering algorithm to be used when secured mode is set +# Authorized values are NISTP-256 and BP-256 +# Default: NISTP-256 +# Ethernet layer +# mac_src :Source MAC address +# mac_bc :Broadcast address +# eth_type : Ethernet type +# Commsignia layer +# mac_src : Device MAC address, used to discard packets +# To indicate no filering, use the value 000000000000 +# mac_bc : Broadcast address +# eth_type : Ethernet type, used to discard packets +# target_host : Device address +# target_port : Device port +# source_port : Test System port +# interface_id: Interface id, used to discard packets +# tx_power : TX power (dB) +# UDP layer (IP/UDP based on Pcap) +# dst_ip : destination IPv4 address (aa.bb.cc.dd) +# dst_port: destination port +# src_ip : source IPv4 address (aa.bb.cc.dd) +# src_port: source port +# Pcap layer +# mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System +# filter : Pcap filter (compliant with tcpdump syntax) +# Online mode: +# nic: Local NIC +# If set, online mode is used +# Offline mode (nic is present but not set): +# file : File to read +# frame_offset: Frame offset, used to skip packets with frame number < frame_offset +# time_offset : Time offset, used to skip packets with time offset < time_offset +# save_mode : 1 to save sent packet, 0 otherwise + +#Cygwin +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=uni)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=/home/yanng/tmp/certificates)/ETH(mac_src=e2b7b30429eb)/PCAP(mac_src=e2b7b30429eb,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" +# Linux +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/PCAP(mac_src=dc536045af7f,nic=wlp2s0,filter=and ether proto 0x8947)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp0s20f3,filter=and ether proto 0x8947)" +# Linux over UDP +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=50544)" +# Linux over LTE/MQTT +system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=dc536045af7e,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee2,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=127.0.0.1,port=1883)" + +# SPATEM UpperTester port based on UDP +system.utPort.params := "UT_MAPEMSPATEM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12346)" +#system.utPort.params := "UT_MAPEMSPATEM/UDP(dst_ip=192.168.146.26,dst_port=44100,src_port=12345)" +#system.utPort.params := "UT_MAPEMSPATEM/UDP(dst_ip=172.16.35.1)" + +[EXECUTE] + +#ItsSremSsem_TestControl.control + +# SREM + +# Check that protocolVersion is set to 1 and messageID is set to 9 +ItsSrem_TestCases.TC_IS_TLCR_GEN_MSGF_BV_01 +# Check that IVI Service generates a new SREM on reception of a valid AppSREM_Trigger request +ItsSrem_TestCases.TC_IS_TLCR_GEN_EVGN_BV_01 +# Check that the IUT generates SREM containing requestor information +ItsSrem_TestCases.TC_IS_TLCR_GEN_EVGN_BV_02 +# Check that the IUT generates SREM containing public transport information +ItsSrem_TestCases.TC_IS_TLCR_GEN_EVGN_BV_03 +# Check that the IUT generates SREM containing timing information +ItsSrem_TestCases.TC_IS_TLCR_GEN_EVGN_BV_04 +# Check that the IUT identifies SREM with a unique request identifier +ItsSrem_TestCases.TC_IS_TLCR_GEN_EVGN_BV_05 +# Check that the IUT increments the sequenceNumber when a SREM update is generated +ItsSrem_TestCases.TC_IS_TLCR_GEN_EVUP_BV_01 +# Check that the IUT increments the sequenceNumber when a SREM update is generated +ItsSrem_TestCases.TC_IS_TLCR_GEN_CANC_BV_01 +# Check that SREM uses BTP_B packet +# Check that the destination port for IVIM is set to 2007 +ItsSrem_TestCases.TC_IS_TLCR_GEN_COM_BV_01 +# Check that TLM service encapsulates SREM in a GBC with the HeaderType field set to the value of 4 +ItsSrem_TestCases.TC_IS_TLCR_GEN_COM_BV_02 +# Check that TLC service uses certificate containing valid ITS AID to sign SREM messages +ItsSrem_TestCases.TC_IS_TLCR_GEN_SEC_BV_01 +# Check that TLC service uses certificate containing valid Service Specific Permissions of type BitmapSsp to sign SREM messages and the SSP version is set to 2 +ItsSrem_TestCases.TC_IS_TLCR_GEN_SSP_BV_01 +# Check that TLC service uses certificate containing valid Service Specific Permissions to sign SRM requests +ItsSrem_TestCases.TC_IS_TLCR_GEN_SSP_BV_02 +# Check that TLC service uses certificate containing valid SSP permissions to sign SREM messages from different role ITS-S +ItsSrem_TestCases.TC_IS_TLCR_GEN_SSP_BV_02_X +# Check that the IUT skips the SREM message containing request without additional information not permitted by the signing certificate +ItsSrem_TestCases.TC_IS_TLCR_GEN_SEC_BO_03 +# Check that TLC service does not send SREM with priority request without possession of the certificate with prioritized SREM signing permissions +ItsSrem_TestCases.TC_IS_TLCR_GEN_SEC_BO_04 +# Check that TLC service transmits the request with the valid rate +ItsSrem_TestCases.TC_IS_TLCR_GEN_RATE_TI_01 +# Check that the IUT can successfully process all mandatory fields of SREM received (TLC-S) +ItsSrem_TestCases.TC_IS_TLCR_RCV_MSGF_BV_01 +# Check that the secured IUT accepts the SREM message without requests and without specific requestor role +ItsSrem_TestCases.TC_IS_TLCR_RCV_SSP_BV_01 +# Check that the secured IUT skips the SREM message without requests and without specific requestor role if signing certificate does not allow it +ItsSrem_TestCases.TC_IS_TLCR_RCV_SSP_BO_01 +# Check that the secured IUT skips the SREM message with request and without specific requestor role if it is not allowed by the signing certificate +ItsSrem_TestCases.TC_IS_TLCR_RCV_SSP_BO_02 + + +# SSEM +# Check that the IUT can generate the SSEM as a response to the received SREM +ItsSsem_TestCases.TC_IS_TLCS_RCV_MSGF_BV_01 +# Check that protocolVersion is set to 1 and messageID is set to 10 (TLC-S) +ItsSsem_TestCases.TC_IS_TLCS_GEN_MSGF_BV_02 +# Check that the IUT generates the SSEM containing SREM identifiers +ItsSsem_TestCases.TC_IS_TLCS_GEN_MSGF_BV_03 +# Check that SSEM uses BTP_B packet +# Check that the destination port for IVIM is set to 2008 +ItsSsem_TestCases.TC_IS_TLCS_GEN_COM_BV_01 +# Check that TLM service encapsulates SSEM in a GBC with the HeaderType field set to the value of 4 +ItsSsem_TestCases.TC_IS_TLCS_GEN_COM_BV_02 +# Check that the IUT increments the sequenceNumber when a SSEM update is generated +ItsSsem_TestCases.TC_IS_TLCS_GEN_EVUP_BV_01 +# Check that the IUT does not increments the sequenceNumber when a SSEM is not repeated without changes +ItsSsem_TestCases.TC_IS_TLCS_GEN_EVUP_BV_02 +# Check that TLC service uses certificate containing valid ITS AID to sign SSEM messages +ItsSsem_TestCases.TC_IS_TLCS_GEN_SEC_BV_01 +# Check that TLC service uses certificate containing valid Service Specific Permissions of type BitmapSsp to sign SSEM messages and the SSP version is set to 2 +ItsSsem_TestCases.TC_IS_TLCS_GEN_SSP_BV_01 +# Check that TLM service can process signal preferential treatment requests within the maximum response time +ItsSsem_TestCases.TC_IS_TLCS_GEN_RATE_TI_01 +# Check that TLM service broadcast the signal status message in response to a signal request message with the valid rate +ItsSsem_TestCases.TC_IS_TLCS_GEN_RATE_TI_02 +# Check that TLM service broadcast the signal status message in response to a signal request message until the requestor leaves the intersection +ItsSsem_TestCases.TC_IS_TLCS_GEN_REP_01 +# Check that TLM service stops to broadcast the signal status message in response to a signal request message when the requestor left the intersection +ItsSsem_TestCases.TC_IS_TLCS_GEN_REP_02 +# Check that the IUT can successfully process all mandatory fields of SSEM received (ITS-S) +ItsSsem_TestCases.TC_IS_TLCS_RCV_MSGF_BV_04 +# Check that the IUT accepts the SSEM message permitted by the signing certificate +ItsSsem_TestCases.TC_IS_TLCS_RCV_SSP_BV_05 +# Check that the IUT discards the SSEM message not permitted by the signing certificate +ItsSsem_TestCases.TC_IS_TLCS_RCV_SSP_SO_05 + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/etc/AtsMBR/AtsMBR.cfg b/etc/AtsMBR/AtsMBR.cfg index a39b88e..66d1e01 100644 --- a/etc/AtsMBR/AtsMBR.cfg +++ b/etc/AtsMBR/AtsMBR.cfg @@ -111,7 +111,7 @@ LogEventTypes:= Yes # src_port: source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used @@ -182,7 +182,7 @@ system.utMbrPort.params := "UT_MBR/UDP(dst_ip=10.8.0.2,dst_port=12345,src_port=1 # 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 -# 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) +# 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 # Check that the IUT generates an invalid speed value in reverse driving observation on a CAM in the MR message when requested (Class 1) - obs-Speed-ValueTooLarge-DriveDirectionReverse diff --git a/etc/AtsMBR/AtsMBR_Simu.cfg_ b/etc/AtsMBR/AtsMBR_Simu.cfg_ index 667f011..21f0f5e 100644 --- a/etc/AtsMBR/AtsMBR_Simu.cfg_ +++ b/etc/AtsMBR/AtsMBR_Simu.cfg_ @@ -111,7 +111,7 @@ LogEventTypes:= Yes # src_port: source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used @@ -182,7 +182,7 @@ system.utMbrPort.params := "UT_MBR/UDP(dst_ip=192.168.1.21,dst_port=12345,src_po # 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 -# 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) +# 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 # Check that the IUT generates an invalid speed value in reverse driving observation on a CAM in the MR message when requested (Class 1) - obs-Speed-ValueTooLarge-DriveDirectionReverse diff --git a/etc/AtsPki/AtsPki_Atos.cfg_ b/etc/AtsPki/AtsPki_Atos.cfg_ index 93ddd1b..fda6ded 100644 --- a/etc/AtsPki/AtsPki_Atos.cfg_ +++ b/etc/AtsPki/AtsPki_Atos.cfg_ @@ -50,7 +50,7 @@ LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D30 # NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) # Private key #FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34 -# Public key +# Public key #048038F5490CD5A58FF5465D3B577EE830047336AC5DAC07036B798AAECAE7273FD91C4F60995494EA949E64EE0E3D768DBDEB8AFC345627211E3FC4DD8FD39EE5 LibItsPki_Pics.PICS_ITS_S_SIGN_NITSP256_PRIVATE_KEY := 'FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34'O; LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3b577ee830047336ac5dac07036b798aaecae7273f'O; diff --git a/etc/AtsPki/AtsPki_Autocrypt.cfg_ b/etc/AtsPki/AtsPki_Autocrypt.cfg_ index 6c8e831..4237815 100644 --- a/etc/AtsPki/AtsPki_Autocrypt.cfg_ +++ b/etc/AtsPki/AtsPki_Autocrypt.cfg_ @@ -39,7 +39,7 @@ LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D30 # NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) # Private key #FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34 -# Public key +# Public key #048038F5490CD5A58FF5465D3B577EE830047336AC5DAC07036B798AAECAE7273FD91C4F60995494EA949E64EE0E3D768DBDEB8AFC345627211E3FC4DD8FD39EE5 LibItsPki_Pics.PICS_ITS_S_SIGN_NITSP256_PRIVATE_KEY := 'FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34'O; LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3b577ee830047336ac5dac07036b798aaecae7273f'O; @@ -227,7 +227,7 @@ ItsPki_TestCases.TC_SECPKI_EA_AUTHVAL_RCV_01_BV # Config: # system.httpCaPort.params := TCP(debug=1,server_mode=1,server=10.200.60.6) # Await CTL request and provides "CERT_IUT_A_RCA", "CERT_TS_A_AA", "CERT_TS_A_EA" certificates -#ItsPki_TestCases.TC_RCA_CTLGEN_xx_BV # +#ItsPki_TestCases.TC_RCA_CTLGEN_xx_BV # # Check that the issuing certificate has version 3 diff --git a/etc/AtsPki/AtsPki_Commsignia.cfg_ b/etc/AtsPki/AtsPki_Commsignia.cfg_ index 3de3c63..88f29cc 100644 --- a/etc/AtsPki/AtsPki_Commsignia.cfg_ +++ b/etc/AtsPki/AtsPki_Commsignia.cfg_ @@ -128,7 +128,7 @@ LogEventTypes:= Yes # src_port: source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used diff --git a/etc/AtsPki/AtsPki_Ctag.cfg_ b/etc/AtsPki/AtsPki_Ctag.cfg_ index 3d4138c..7c26aac 100644 --- a/etc/AtsPki/AtsPki_Ctag.cfg_ +++ b/etc/AtsPki/AtsPki_Ctag.cfg_ @@ -43,7 +43,7 @@ LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D30 # NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) # Private key #FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34 -# Public key +# Public key #048038F5490CD5A58FF5465D3B577EE830047336AC5DAC07036B798AAECAE7273FD91C4F60995494EA949E64EE0E3D768DBDEB8AFC345627211E3FC4DD8FD39EE5 LibItsPki_Pics.PICS_ITS_S_SIGN_NITSP256_PRIVATE_KEY := 'FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34'O; LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3b577ee830047336ac5dac07036b798aaecae7273f'O; diff --git a/etc/AtsPki/AtsPki_Etas.cfg_ b/etc/AtsPki/AtsPki_Etas.cfg_ index 7e21c6a..7b8bc63 100644 --- a/etc/AtsPki/AtsPki_Etas.cfg_ +++ b/etc/AtsPki/AtsPki_Etas.cfg_ @@ -46,7 +46,7 @@ LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492d5465737453797374656d2d'O # NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) # Private key #FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34 -# Public key +# Public key # 04278aafdf017b60c8244e56c2458350510444a22a92c6d0484e865eceaf4ba723134fddd6b527b784e6f7ca15f8b9f6a06b57d8074083628a25b9a36075cb24c8 LibItsPki_Pics.PICS_ITS_S_SIGN_NITSP256_PRIVATE_KEY := '5dca486322033315e1791ee2a61d3717082aef9cc7e27e29b76fe9c722824f98'O; LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '02278aafdf017b60c8244e56c2458350510444a22a92c6d0484e865eceaf4ba723'O; diff --git a/etc/AtsPki/AtsPki_Microsec.cfg_ b/etc/AtsPki/AtsPki_Microsec.cfg_ index 4ac508b..b68994b 100644 --- a/etc/AtsPki/AtsPki_Microsec.cfg_ +++ b/etc/AtsPki/AtsPki_Microsec.cfg_ @@ -41,7 +41,7 @@ LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '4554534946525465737453797374656d30 # NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) # Private key #FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34 -# Public key +# Public key #048038F5490CD5A58FF5465D3B577EE830047336AC5DAC07036B798AAECAE7273FD91C4F60995494EA949E64EE0E3D768DBDEB8AFC345627211E3FC4DD8FD39EE5 LibItsPki_Pics.PICS_ITS_S_SIGN_NITSP256_PRIVATE_KEY := 'FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34'O; LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3b577ee830047336ac5dac07036b798aaecae7273f'O; @@ -312,7 +312,7 @@ ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV_02 # Config: # system.httpCaPort.params := TCP(debug=1,server_mode=1,server=192.168.1.43) # Await CTL request and provides "CERT_IUT_A_RCA", "CERT_TS_A_AA", "CERT_TS_A_EA" certificates -#ItsPki_TestCases.TC_RCA_CTLGEN_xx_BV # +#ItsPki_TestCases.TC_RCA_CTLGEN_xx_BV # [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/etc/AtsPki/AtsPki_Simu.cfg_ b/etc/AtsPki/AtsPki_Simu.cfg_ index 6c86618..5d125ef 100644 --- a/etc/AtsPki/AtsPki_Simu.cfg_ +++ b/etc/AtsPki/AtsPki_Simu.cfg_ @@ -50,7 +50,7 @@ LibItsPki_Pics.PICS_SECPKI_ENROLLMENT_X509 := false # NOTE: In case of OBU is the IUT, PICS_ITS_S_SIGN_xxx_PUBLIC_KEY is shared with the IUT (process of registration) # Private key #FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34 -# Public key +# Public key #048038F5490CD5A58FF5465D3B577EE830047336AC5DAC07036B798AAECAE7273FD91C4F60995494EA949E64EE0E3D768DBDEB8AFC345627211E3FC4DD8FD39EE5 LibItsPki_Pics.PICS_ITS_S_SIGN_NITSP256_PRIVATE_KEY := 'FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34'O; LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3b577ee830047336ac5dac07036b798aaecae7273f'O; @@ -170,7 +170,7 @@ LogEventTypes:= Yes # src_port: source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used diff --git a/etc/AtsSecurity/AtsSecurity.cfg b/etc/AtsSecurity/AtsSecurity.cfg index 5e1cd61..7f94adb 100644 --- a/etc/AtsSecurity/AtsSecurity.cfg +++ b/etc/AtsSecurity/AtsSecurity.cfg @@ -36,7 +36,7 @@ LibItsSecurity_Pixits.PX_AT_CERTIFICATE := "CERT_TS_B_AT" # Possible values: CER #LibItsSecurity_Pics.PICS_SEC_SHA256 := false #LibItsSecurity_Pics.PICS_SEC_SHA384 := true - + [LOGGING] # In this section you can specify the name of the log file and the classes of events @@ -105,7 +105,7 @@ LogEventTypes:= Yes # src_port: source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used @@ -169,7 +169,7 @@ ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_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 +# 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 @@ -190,11 +190,11 @@ ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BV #ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_05_CN_BV -# Check that IUT sends the secured CAM containing the signing certificate when over the time of one +# 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 +# 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 @@ -205,79 +205,79 @@ ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_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 +# 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. +# 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. +# 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 +# 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 +# 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 +# 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 +# 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 +# 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 +# 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 +# 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, +# 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 +# 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 +# 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 +# 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. +# 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 +# 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 @@ -285,15 +285,15 @@ ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BV #ItsSecurity_Pics.PICS_CERTFICATE_ID_VARIANT := "CERT_IUT_A1_AT" #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. +# Check that IUT doesn't send secured CAMs if all AT certificates installed on the IUT have the starting time in the future. #ItsSecurity_Pics.PICS_CERTFICATE_ID_VARIANT := "CERT_IUT_A2_AT" #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. +# Check that IUT doesn't send secured CAMs if IUT doesn't possess an AT certificate allowing sending CAM by its appPermissions. #ItsSecurity_Pics.PICS_CERTFICATE_ID_VARIANT := "CERT_IUT_A3_AT" #ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_27_BV -#--------------------------------------- DENM ------------------------------------------ +#--------------------------------------- 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 diff --git a/etc/AtsSecurity/AtsSecurity_codha.cf_ b/etc/AtsSecurity/AtsSecurity_codha.cf_ index 7fc2f1c..6085012 100644 --- a/etc/AtsSecurity/AtsSecurity_codha.cf_ +++ b/etc/AtsSecurity/AtsSecurity_codha.cf_ @@ -99,7 +99,7 @@ LogEventTypes:= Yes # src_port: source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used @@ -146,7 +146,7 @@ system.camUtPort.params := "UT_CAM/UDP(dst_ip=10.100.60.136)" # 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 +# 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 @@ -158,11 +158,11 @@ system.camUtPort.params := "UT_CAM/UDP(dst_ip=10.100.60.136)" # 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 +# 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 +# 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 @@ -172,79 +172,79 @@ system.camUtPort.params := "UT_CAM/UDP(dst_ip=10.100.60.136)" # 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 +# 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. +# 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. +# 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 +# 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 +# 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 +# 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 +# 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 +# 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 +# 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 +# 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, +# 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 +# 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 +# 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 +# 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. +# 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 +# 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 @@ -252,15 +252,15 @@ ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_23_BV #ItsSecurity_Pics.PICS_CERTFICATE_ID_VARIANT := "CERT_IUT_A1_AT" #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. +# Check that IUT doesn't send secured CAMs if all AT certificates installed on the IUT have the starting time in the future. #ItsSecurity_Pics.PICS_CERTFICATE_ID_VARIANT := "CERT_IUT_A2_AT" #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. +# Check that IUT doesn't send secured CAMs if IUT doesn't possess an AT certificate allowing sending CAM by its appPermissions. #ItsSecurity_Pics.PICS_CERTFICATE_ID_VARIANT := "CERT_IUT_A3_AT" #ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_27_BV -#--------------------------------------- DENM ------------------------------------------ +#--------------------------------------- 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 @@ -279,8 +279,8 @@ ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_23_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 ------------------------------------------ + +#--------------------------------------- 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 @@ -289,9 +289,9 @@ ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_23_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 - -#--------------------------------------- CERTIFICATE TESTING ------------------------------------------ -#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_01_BV + +#--------------------------------------- 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 @@ -313,7 +313,7 @@ ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_23_BV #ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_20_BV #ItsSecurity_TestCases.TC_SEC_ITSS_SND_CERT_21_BV -#--------------------------------------- Internal tests (to be removed) ------------------------------------------ +#--------------------------------------- Internal tests (to be removed) ------------------------------------------ #ItsSecurity_TestCases.TC_TEST_1 [MAIN_CONTROLLER] diff --git a/etc/AtsVRU/AtsVRU_Simulator.cfg_ b/etc/AtsVRU/AtsVRU_Simulator.cfg_ index 5197dd9..eea34b3 100644 --- a/etc/AtsVRU/AtsVRU_Simulator.cfg_ +++ b/etc/AtsVRU/AtsVRU_Simulator.cfg_ @@ -38,7 +38,7 @@ LogEventTypes:= Yes # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer -# ll_address : GeoNetworking address of the Test System for beaconing. To be align with VRU +# ll_address : GeoNetworking address of the Test System for beaconing. To be align with VRU # latitude : Latitude of the Test System # longitude : Longitude of the Test System # beaconing : Set to 1 if GnLayer shall start beaconing @@ -76,7 +76,7 @@ LogEventTypes:= Yes # src_port: Source port # Pcap layer # mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) +# filter : Pcap filter (compliant with tcpdump syntax) # Online mode: # nic: Local NIC # If set, online mode is used @@ -122,11 +122,11 @@ system.utPort.params := "UT_VRU/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port= [EXECUTE] #ItsVru_TestControl.control -# +# ItsVru_TestCases.TC_VRU_MSD_PAR_BV_01 -# +# #ItsVru_TestCases.TC_VRU_MSD_PAR_BV_02 -# +# #ItsVru_TestCases.TC_VRU_MSD_PAR_BV_03 [MAIN_CONTROLLER] -- GitLab From dd9738e46ad36e71372dc25931bf2c8987afd69b Mon Sep 17 00:00:00 2001 From: garciay Date: Wed, 18 Sep 2024 14:37:23 +0200 Subject: [PATCH 159/178] Bug fixed in BTP layer; Report fix/enhancement fron CV2X#4 plugtest --- TS.ITS_TTF_T036.code-workspace | 6 - ccsrc/Protocols/BTP_layers/btp_layer.cc | 6 +- data/certificates/profiles/CERT_IUT_A_AA.xml | 2 +- .../profiles/CERT_IUT_A_B3_AA.xml | 2 +- .../certificates/profiles/CERT_IUT_A_B_AA.xml | 2 +- .../certificates/profiles/CERT_IUT_A_N_AA.xml | 2 +- data/certificates/profiles/CERT_IUT_A_RCA.xml | 2 +- data/certificates/profiles/CERT_IUT_C2_AA.xml | 2 +- data/certificates/profiles/CERT_IUT_C3_AA.xml | 2 +- data/certificates/profiles/CERT_IUT_CC_AA.xml | 2 +- data/certificates/profiles/CERT_IUT_C_RCA.xml | 2 +- data/certificates/profiles/CERT_IUT_D_AA.xml | 2 +- .../profiles/CERT_IUT_IVI_SSP_1_AT.xml | 4 +- .../CERT_IUT_IVI_SSP_ISO14823_1_AT.xml | 4 +- .../CERT_IUT_IVI_SSP_ISO14823_2_AT.xml | 4 +- .../CERT_IUT_IVI_SSP_ISO14823_3_AT.xml | 4 +- .../CERT_IUT_IVI_SSP_ISO14823_4_AT.xml | 4 +- .../CERT_IUT_IVI_SSP_ISO14823_5_AT.xml | 4 +- .../CERT_IUT_IVI_SSP_ISO14823_6_AT.xml | 4 +- .../profiles/CERT_IUT_IVI_SSP_LC_AT.xml | 4 +- .../profiles/CERT_IUT_IVI_SSP_LS_AT.xml | 4 +- .../profiles/CERT_IUT_IVI_SSP_NEG_AT.xml | 2 +- .../profiles/CERT_IUT_IVI_SSP_NONE_AT.xml | 2 +- .../profiles/CERT_IUT_IVI_SSP_RCC_AT.xml | 2 +- .../profiles/CERT_IUT_IVI_SSP_SAEJ2540_AT.xml | 2 +- .../profiles/CERT_IUT_IVI_SSP_TC_AT.xml | 2 +- .../CERT_IUT_IVI_SSP_VIENNACONV_AT.xml | 2 +- .../profiles/CERT_IUT_MAP_SSP_1_AT.xml | 2 +- .../profiles/CERT_IUT_MAP_SSP_2_AT.xml | 2 +- .../profiles/CERT_IUT_SPAT_SSP_NONE_AT.xml | 2 +- data/certificates/profiles/CERT_TS_A_AA.xml | 2 +- data/certificates/profiles/CERT_TS_A_AA_B.xml | 2 +- data/certificates/profiles/CERT_TS_B1_AT.xml | 2 +- data/certificates/profiles/CERT_TS_FA3_AA.xml | 2 +- data/certificates/profiles/CERT_TS_FA_AA.xml | 2 +- etc/AtsCAM/AtsCAM.cfg | 44 +-- etc/AtsCAM/AtsCAM_Codha.cf_ | 244 ++++++++++++++++ etc/AtsCAM/AtsCAM_Savary.cfg_ | 42 +-- etc/AtsCAM/AtsCAM_Simulator.cfg_ | 44 +-- etc/AtsCAM/AtsCAM_nfiniity.cfg_ | 94 +++++- etc/AtsCAM/AtsCAM_pcap.cfg_ | 92 +----- etc/AtsDENM/AtsDENM_Simulator.cf_ | 214 ++++++++++++++ etc/AtsDENM/AtsDENM_codha.cf_ | 219 ++++++++++++++ etc/AtsDENM/AtsDENM_infiniity.cf_ | 217 ++++++++++++++ etc/AtsGeoNetworking/AtsGeoNetworking.cfg | 12 +- etc/AtsIS/AtsIS_IVIM.cf_ | 29 +- etc/AtsIS/AtsIS_Mapem.cf_ | 31 +- etc/AtsIS/AtsIS_Rtcmem.cf_ | 11 +- etc/AtsIS/AtsIS_Spatem.cf_ | 35 +-- etc/AtsIS/AtsIS_SxEM.cf_ | 11 +- etc/AtsMBR/AtsMBR_Simu.cfg_ | 12 +- etc/AtsPki/AtsPki_Microsec.cfg_ | 2 +- etc/AtsPki/AtsPki_Simu.cfg_ | 18 +- etc/AtsRSUsSimulator/AtsRSUSimulator.cfg | 272 ++++++++++++++++++ etc/AtsSecurity/AtsSecurity_codha.cf_ | 130 +++++---- 55 files changed, 1450 insertions(+), 419 deletions(-) create mode 100644 etc/AtsCAM/AtsCAM_Codha.cf_ create mode 100644 etc/AtsDENM/AtsDENM_Simulator.cf_ create mode 100644 etc/AtsDENM/AtsDENM_codha.cf_ create mode 100644 etc/AtsDENM/AtsDENM_infiniity.cf_ create mode 100644 etc/AtsRSUsSimulator/AtsRSUSimulator.cfg diff --git a/TS.ITS_TTF_T036.code-workspace b/TS.ITS_TTF_T036.code-workspace index 8bf6c76..295f8ef 100644 --- a/TS.ITS_TTF_T036.code-workspace +++ b/TS.ITS_TTF_T036.code-workspace @@ -3,12 +3,6 @@ { "path": "." }, - { - "path": "../itsreadjs" - }, - { - "path": "../EtsiTs103759js" - }, { "path": "../../tmp/crypto-test-vectors" }, diff --git a/ccsrc/Protocols/BTP_layers/btp_layer.cc b/ccsrc/Protocols/BTP_layers/btp_layer.cc index 50b0228..182039a 100644 --- a/ccsrc/Protocols/BTP_layers/btp_layer.cc +++ b/ccsrc/Protocols/BTP_layers/btp_layer.cc @@ -85,7 +85,11 @@ void btp_layer::receive_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> btp_layer::receive_data: ", data); //p_params.log(); - // Decode the payload + if (data.lengthof() == 0) { + loggers::get_instance().warning("btp_layer::receive_data: No payload"); + return; + } + // Decode the payload params_its ¶ms = static_cast(p_params); LibItsBtp__TypesAndValues::BtpInd p; loggers::get_instance().log("btp_layer::receive_data: Looking for %s", params_its::gn_next_header.c_str()); diff --git a/data/certificates/profiles/CERT_IUT_A_AA.xml b/data/certificates/profiles/CERT_IUT_A_AA.xml index f82309d..5cf4262 100644 --- a/data/certificates/profiles/CERT_IUT_A_AA.xml +++ b/data/certificates/profiles/CERT_IUT_A_AA.xml @@ -23,7 +23,7 @@ - 01 D0/FF 1F + 01 C0/FF 3F 01 FF FF FF FF F8/FF 00 00 00 00 07 02 FF FF FF/FF 00 00 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B3_AA.xml b/data/certificates/profiles/CERT_IUT_A_B3_AA.xml index 72b3d14..de2cd65 100644 --- a/data/certificates/profiles/CERT_IUT_A_B3_AA.xml +++ b/data/certificates/profiles/CERT_IUT_A_B3_AA.xml @@ -23,7 +23,7 @@ - 01 D0/FF 1F + 01 C0/FF 3F 01 FF FF FF FF F8/FF 00 00 00 00 07 02 FF FF FF/FF 00 00 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B_AA.xml b/data/certificates/profiles/CERT_IUT_A_B_AA.xml index f46697a..1cf6824 100644 --- a/data/certificates/profiles/CERT_IUT_A_B_AA.xml +++ b/data/certificates/profiles/CERT_IUT_A_B_AA.xml @@ -23,7 +23,7 @@ - 01 D0/FF 1F + 01 C0/FF 3F 01 FF FF FF FF F8/FF 00 00 00 00 07 02 FF FF FF/FF 00 00 01 diff --git a/data/certificates/profiles/CERT_IUT_A_N_AA.xml b/data/certificates/profiles/CERT_IUT_A_N_AA.xml index 4532107..429c86d 100644 --- a/data/certificates/profiles/CERT_IUT_A_N_AA.xml +++ b/data/certificates/profiles/CERT_IUT_A_N_AA.xml @@ -23,7 +23,7 @@ - 01 D0/FF 1F + 01 C0/FF 3F 01 FF FF FF FF F8/FF 00 00 00 00 07 02 FF FF FF/FF 00 00 01 diff --git a/data/certificates/profiles/CERT_IUT_A_RCA.xml b/data/certificates/profiles/CERT_IUT_A_RCA.xml index 46115c3..6188eae 100644 --- a/data/certificates/profiles/CERT_IUT_A_RCA.xml +++ b/data/certificates/profiles/CERT_IUT_A_RCA.xml @@ -16,7 +16,7 @@ - 01 D0/FF 1F + 01 C0/FF 3F 01 FF FF FF FF F8/FF 00 00 00 00 07 02 FF FF FF/FF 00 00 01 diff --git a/data/certificates/profiles/CERT_IUT_C2_AA.xml b/data/certificates/profiles/CERT_IUT_C2_AA.xml index 31b3c55..415b036 100644 --- a/data/certificates/profiles/CERT_IUT_C2_AA.xml +++ b/data/certificates/profiles/CERT_IUT_C2_AA.xml @@ -22,7 +22,7 @@ - 01 D0/FF 1F + 01 C0/FF 3F 01 FF FF FF FF F8/FF 00 00 00 00 07 02 FF FF FF/FF 00 00 01 diff --git a/data/certificates/profiles/CERT_IUT_C3_AA.xml b/data/certificates/profiles/CERT_IUT_C3_AA.xml index 177e8e9..6880c7f 100644 --- a/data/certificates/profiles/CERT_IUT_C3_AA.xml +++ b/data/certificates/profiles/CERT_IUT_C3_AA.xml @@ -22,7 +22,7 @@ - 01 D0/FF 1F + 01 C0/FF 3F 01 FF FF FF FF F8/FF 00 00 00 00 07 02 FF FF FF/FF 00 00 01 diff --git a/data/certificates/profiles/CERT_IUT_CC_AA.xml b/data/certificates/profiles/CERT_IUT_CC_AA.xml index a9e1889..6d4c538 100644 --- a/data/certificates/profiles/CERT_IUT_CC_AA.xml +++ b/data/certificates/profiles/CERT_IUT_CC_AA.xml @@ -22,7 +22,7 @@ - 01 D0/FF 1F + 01 C0/FF 3F 01 FF FF FF FF F8/FF 00 00 00 00 07 02 FF FF FF/FF 00 00 01 diff --git a/data/certificates/profiles/CERT_IUT_C_RCA.xml b/data/certificates/profiles/CERT_IUT_C_RCA.xml index 8c8bc54..228c5de 100644 --- a/data/certificates/profiles/CERT_IUT_C_RCA.xml +++ b/data/certificates/profiles/CERT_IUT_C_RCA.xml @@ -22,7 +22,7 @@ - 01 D0/FF 1F + 01 C0/FF 3F 01 FF FF FF FF F8/FF 00 00 00 00 07 02 FF FF FF/FF 00 00 01 diff --git a/data/certificates/profiles/CERT_IUT_D_AA.xml b/data/certificates/profiles/CERT_IUT_D_AA.xml index 0a0870d..b246fe6 100644 --- a/data/certificates/profiles/CERT_IUT_D_AA.xml +++ b/data/certificates/profiles/CERT_IUT_D_AA.xml @@ -22,7 +22,7 @@ - 01 D0/FF 1F + 01 C0/FF 3F 01 FF FF FF FF F8/FF 00 00 00 00 07 02 FF FF FF/FF 00 00 01 diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_1_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_1_AT.xml index bf46698..54b5cb4 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_1_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_1_AT.xml @@ -22,8 +22,8 @@ 01 FF FC - 01 00 - 01 00 00 00 00 00 00 + 01 C0 + 01 FF FF FF 7F F8 diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_1_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_1_AT.xml index 5c224f2..686aeed 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_1_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_1_AT.xml @@ -22,8 +22,8 @@ 01 FF FC - 01 00 - 01 00 00 00 00 40 00 + 01 C0 + 01 FF FF FF 40 F8 diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_2_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_2_AT.xml index 31aa0ca..9d53809 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_2_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_2_AT.xml @@ -22,8 +22,8 @@ 01 FF FC - 01 00 - 01 00 00 00 00 20 00 + 01 C0 + 01 FF FF FF 20 F8 diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_3_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_3_AT.xml index ca091e1..b2e9a3c 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_3_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_3_AT.xml @@ -22,8 +22,8 @@ 01 FF FC - 01 00 - 01 00 00 00 00 10 00 + 01 C0 + 01 FF FF FF 10 F8 diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_4_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_4_AT.xml index 8fd7582..1d75aaf 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_4_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_4_AT.xml @@ -22,8 +22,8 @@ 01 FF FC - 01 00 - 01 00 00 00 00 08 00 + 01 C0 + 01 FF FF FF 08 F8 diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_5_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_5_AT.xml index 057a1c1..2d6f635 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_5_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_5_AT.xml @@ -22,8 +22,8 @@ 01 FF FC - 01 00 - 01 00 00 00 00 04 00 + 01 C0 + 01 FF FF FF 04 F8 diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_6_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_6_AT.xml index c00f113..f113bb5 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_6_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_ISO14823_6_AT.xml @@ -22,8 +22,8 @@ 01 FF FC - 01 00 - 01 00 00 00 00 02 00 + 01 C0 + 01 FF FF FF 02 F8 diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_LC_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_LC_AT.xml index 0548572..0c0701e 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_LC_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_LC_AT.xml @@ -22,8 +22,8 @@ 01 FF FC - 01 00 - 01 00 00 00 00 FF 10 + 01 C0 + 01 FF FF FF FF 10 diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_LS_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_LS_AT.xml index c7e4def..2763d82 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_LS_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_LS_AT.xml @@ -22,8 +22,8 @@ 01 FF FC - 01 00 - 01 00 00 00 00 FF 80 + 01 C0 + 01 FF FF FF FF 80 diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_NEG_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_NEG_AT.xml index 7c1e0ca..2cd032d 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_NEG_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_NEG_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 00 - 01 00 00 00 00 FF 08 + 01 FF FF FF FF 08 diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_NONE_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_NONE_AT.xml index bf46698..f580a4b 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_NONE_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_NONE_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 00 - 01 00 00 00 00 00 00 + 01 FF FF FF 00 00 diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_RCC_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_RCC_AT.xml index 37a4e41..06427ad 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_RCC_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_RCC_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 00 - 01 00 00 00 00 FF 40 + 01 FF FF FF FF 40 diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_SAEJ2540_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_SAEJ2540_AT.xml index 9fd2213..d42e2b4 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_SAEJ2540_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_SAEJ2540_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 00 - 01 00 00 00 00 01 00 + 01 FF FF FF 01 F8 diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_TC_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_TC_AT.xml index 73a7f7b..dfa1ec5 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_TC_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_TC_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 00 - 01 00 00 00 00 FF 20 + 01 FF FF FF FF 20 diff --git a/data/certificates/profiles/CERT_IUT_IVI_SSP_VIENNACONV_AT.xml b/data/certificates/profiles/CERT_IUT_IVI_SSP_VIENNACONV_AT.xml index ce23dd9..4888c59 100644 --- a/data/certificates/profiles/CERT_IUT_IVI_SSP_VIENNACONV_AT.xml +++ b/data/certificates/profiles/CERT_IUT_IVI_SSP_VIENNACONV_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 00 - 01 00 00 00 00 80 00 + 01 FF FF FF 80 F8 diff --git a/data/certificates/profiles/CERT_IUT_MAP_SSP_1_AT.xml b/data/certificates/profiles/CERT_IUT_MAP_SSP_1_AT.xml index b83bdf8..5c546ad 100644 --- a/data/certificates/profiles/CERT_IUT_MAP_SSP_1_AT.xml +++ b/data/certificates/profiles/CERT_IUT_MAP_SSP_1_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 E0 - 01 80 + 01 C0 diff --git a/data/certificates/profiles/CERT_IUT_MAP_SSP_2_AT.xml b/data/certificates/profiles/CERT_IUT_MAP_SSP_2_AT.xml index 5e0575d..5c546ad 100644 --- a/data/certificates/profiles/CERT_IUT_MAP_SSP_2_AT.xml +++ b/data/certificates/profiles/CERT_IUT_MAP_SSP_2_AT.xml @@ -23,7 +23,7 @@ 01 FF FC 01 E0 - 01 40 + 01 C0 diff --git a/data/certificates/profiles/CERT_IUT_SPAT_SSP_NONE_AT.xml b/data/certificates/profiles/CERT_IUT_SPAT_SSP_NONE_AT.xml index 5acaa9d..5c546ad 100644 --- a/data/certificates/profiles/CERT_IUT_SPAT_SSP_NONE_AT.xml +++ b/data/certificates/profiles/CERT_IUT_SPAT_SSP_NONE_AT.xml @@ -22,7 +22,7 @@ 01 FF FC - 01 00 + 01 E0 01 C0 diff --git a/data/certificates/profiles/CERT_TS_A_AA.xml b/data/certificates/profiles/CERT_TS_A_AA.xml index f82309d..5cf4262 100644 --- a/data/certificates/profiles/CERT_TS_A_AA.xml +++ b/data/certificates/profiles/CERT_TS_A_AA.xml @@ -23,7 +23,7 @@ - 01 D0/FF 1F + 01 C0/FF 3F 01 FF FF FF FF F8/FF 00 00 00 00 07 02 FF FF FF/FF 00 00 01 diff --git a/data/certificates/profiles/CERT_TS_A_AA_B.xml b/data/certificates/profiles/CERT_TS_A_AA_B.xml index f46697a..1cf6824 100644 --- a/data/certificates/profiles/CERT_TS_A_AA_B.xml +++ b/data/certificates/profiles/CERT_TS_A_AA_B.xml @@ -23,7 +23,7 @@ - 01 D0/FF 1F + 01 C0/FF 3F 01 FF FF FF FF F8/FF 00 00 00 00 07 02 FF FF FF/FF 00 00 01 diff --git a/data/certificates/profiles/CERT_TS_B1_AT.xml b/data/certificates/profiles/CERT_TS_B1_AT.xml index b2492c0..9162905 100644 --- a/data/certificates/profiles/CERT_TS_B1_AT.xml +++ b/data/certificates/profiles/CERT_TS_B1_AT.xml @@ -4,7 +4,7 @@ - + diff --git a/data/certificates/profiles/CERT_TS_FA3_AA.xml b/data/certificates/profiles/CERT_TS_FA3_AA.xml index 99d7ce8..9c4f269 100644 --- a/data/certificates/profiles/CERT_TS_FA3_AA.xml +++ b/data/certificates/profiles/CERT_TS_FA3_AA.xml @@ -23,7 +23,7 @@ - 01 D0/FF 1F + 01 C0/FF 3F 01 FF FF FF FF F8/FF 00 00 00 00 07 02 FF FF FF/FF 00 00 01 diff --git a/data/certificates/profiles/CERT_TS_FA_AA.xml b/data/certificates/profiles/CERT_TS_FA_AA.xml index 9c13816..a567c32 100644 --- a/data/certificates/profiles/CERT_TS_FA_AA.xml +++ b/data/certificates/profiles/CERT_TS_FA_AA.xml @@ -23,7 +23,7 @@ - 01 D0/FF 1F + 01 C0/FF 3F 01 FF FF FF FF F8/FF 00 00 00 00 07 02 FF FF FF/FF 00 00 01 diff --git a/etc/AtsCAM/AtsCAM.cfg b/etc/AtsCAM/AtsCAM.cfg index 0579b15..c8bb2dd 100644 --- a/etc/AtsCAM/AtsCAM.cfg +++ b/etc/AtsCAM/AtsCAM.cfg @@ -37,7 +37,6 @@ LogEventTypes:= Yes # destination port: dst_port # source port : src_port # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer # ll_address : GeoNetworking address of the Test System for beaconing. To be align with CAM # latitude : Latitude of the Test System @@ -87,55 +86,33 @@ LogEventTypes:= Yes # time_offset : Time offset, used to skip packets with time offset < time_offset # save_mode : Set to 1 to save sent packet, 0 otherwise -# Single GeoNetworking component port -# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf -# its_aid=36: CAM -# its_aid=37: DENM -# its_aid=39: VAM -# its_aid=137: SPAT -# its_aid=138: MAP -# its_aid=139: IVIM -# its_aid=140: SREM/SSEM -# its_aid=141: GeoMet -# its_aid=128: RTCMEM -# its_aid=639: CPS - # Cygwin -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlo1,filter=and ether proto 0x8947)" # Linux over UDP -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.21,src_port=4041,dst_port=9091)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/UDP(dst_ip=192.168.1.43,src_port=4041,dst_port=9091)" # PC5 + UU/Raw -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470519,longitude=-455595023,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates_iut)/LTE(mac_src=8c554ac1eee1,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.21,dst_port=4041,src_port=9091)" +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates_iut)/LTE(mac_src=8c554ac1eee1,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.43,dst_port=4041,src_port=9091)" # PC5 + Uu/MQTT # Raw UDP -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=udp,debug=1,server=192.168.1.39,port=1883)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=udp,debug=1,server=192.168.1.39,port=1883)" # MQTT over TCP -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=192.168.1.39,port=1883)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=192.168.1.39,port=1883)" # CAM UpperTester port based on UDP -system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.1.21,dst_port=12345,src_port=12346)" +system.utPort.params := "UT_CAM/UDP(dst_ip=10.200.60.23,dst_port=12345,src_port=12346)" #system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.146.26)" #system.utPort.params := "UT_CAM/UDP(dst_ip=172.16.35.1)" [EXECUTE] -#ItsCam_TestControl.control - -# Check that protocolVersion is set to 2 and messageID is set to 2 ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 -# Check that LF container is included in 1st CAM since CA basic service activation #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 -# Check that LF container is included if time elapsed since the generation of the last CAM with the low frequency container generation is equal or larger than 500 ms #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 -# Check that specialVehicle container is included in 1st CAM since CA basic service activation #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 -# Check that specialVehicle container is included if time elapsed since the generation of the last CAM with the special vehicle container generation is equal or larger than 500 ms #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_05 -# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_01 -# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_02 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_03 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_04 @@ -177,19 +154,12 @@ ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_06 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_07 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_08 -# Check that content of received CAM is transmitted to applications and other facilities #ItsCam_TestCases.TC_CAM_MSP_BV_01 -# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers #ItsCam_TestCases.TC_CAM_MSP_SSP_BV_01 -# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers #ItsCam_TestCases.TC_CAM_MSP_SSP_BV_02 -# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers #ItsCam_TestCases.TC_CAM_MSP_SSP_BV_03 -# Check that the IUT does not send a CAM when its content is not permitted by signing certificate #ItsCam_TestCases.TC_CAM_MSD_SSP_BO_01 -# Check that the IUT does not send a CAM when its content is not permitted by signing certificate #ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 -# Check that the IUT does not send a CAM when its content is not permitted by signing certificate #ItsCam_TestCases.TC_CAM_MSD_SSP_BO_03 [MAIN_CONTROLLER] diff --git a/etc/AtsCAM/AtsCAM_Codha.cf_ b/etc/AtsCAM/AtsCAM_Codha.cf_ new file mode 100644 index 0000000..2366ab3 --- /dev/null +++ b/etc/AtsCAM/AtsCAM_Codha.cf_ @@ -0,0 +1,244 @@ + +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# IUT Station ID +LibItsCommon_Pixits.PX_IUT_STATION_ID := 2533729309 + +LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB + +LibItsCam_Pics.PICS_DANGEROUSGOODS := true +LibItsCam_Pics.PICS_IS_IUT_SECURED := true + +LibItsCam_Pics.PICS_PUBLICTRANS := true +LibItsCam_Pics.PICS_SPECIALTRANS := true +LibItsCam_Pics.PICS_DANGEROUSGOODS := true +LibItsCam_Pics.PICS_ROADWORKS := true +LibItsCam_Pics.PICS_RESCUE := true +LibItsCam_Pics.PICS_EMERGENCY := true +LibItsCam_Pics.PICS_SAFETY_CAR := true + +LibItsCam_Pics.PICS_IS_IUT_SECURED := false + +# Instruct the Test System to use this certificate. Comment to use the default one (CERT_IUT_A_AT) +#LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_TS_F3_AT" # brainpool384 + +[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). + +LogFile := "../logs/AtsCAM/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +# CAM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# header_sub_type : sh (single hop) +# DENM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# BTP Layer +# type : btpA|btpB +# destination port: dst_port +# source port : src_port +# GN Layer +# ll_address : GeoNetworking address of the Test System +# latitude : Latitude of the Test System +# longitude : Longitude of the Test System +# beaconing : Set to 1 if GnLayer shall start beaconing +# expiry : Beaconing timer expiry (ms) +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# secured_mode : Set to 1 if message exchanges shall be signed +# encrypted_mode : Set to 1 if message exchanges shall be encrypted +# NOTE: For signed & encrypted message exchanges, both secured_mode and encrypted_mode shall be set to 1 +# sec_db_path : Path to the certificates and keys storage location +# hash : Hash algorithm to be used when secured mode is set +# Authorized values are SHA-256 or SHA-384 +# Default: SHA-256 +# signature : Signature algorithm to be used when secured mode is set +# Authorized values are NISTP-256, NISTP-384, BP-256 and BP-384 +# Default: NISTP-256 +# cypher : Cyphering algorithm to be used when secured mode is set +# Authorized values are NISTP-256, BP-256 and BP-384 +# Default: NISTP-256 +# Ethernet layer +# mac_src :Source MAC address +# mac_bc :Broadcast address +# eth_type : Ethernet type +# Commsignia layer +# mac_src : IUT MAC address, used to discard packets +# To indicate no filering, use the value 000000000000 +# mac_bc : Broadcast address +# eth_type : Ethernet type, used to discard packets +# target_host : Device address +# target_port : Device port +# source_port : Test System port +# interface_id: Interface id, used to discard packets +# tx_power : TX power (dB) +# xport_mode : G5 or LTE-V2X +# UDP layer (IP/UDP based on Pcap) +# dst_ip : Destination IPv4 address (aa.bb.cc.dd) +# dst_port: Destination port +# src_ip : Source IPv4 address (aa.bb.cc.dd) +# src_port: Source port +# Pcap layer +# mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System +# filter : Pcap filter (compliant with tcpdump syntax) +# Online mode: +# nic: Local NIC +# If set, online mode is used +# Offline mode (nic is present but not set): +# file : File to read +# frame_offset: Frame offset, used to skip packets with frame number < frame_offset +# time_offset : Time offset, used to skip packets with time offset < time_offset +# save_mode : Set to 1 to save sent packet, 0 otherwise + +# Cygwin +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,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.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlo1,filter=and ether proto 0x8947)" +# Linux over OpenVPN +system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=0000d0e6740f)/PCAP(mac_src=0000d0e6740f,nic=tap0,filter=and ether proto 0x8947)" +# Linux over UDP +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=9091)" +# Linux over LTE/MQTT +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=dc536045af7e,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee2,mqtt_topics=obu,uu_transport=tcp,debug=1,server=127.0.0.1,port=1883)" + +# CAM UpperTester port based on UDP +#system.utPort.params := "UT_CAM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12346,reuse_incoming_source_adddress=1)" +system.utPort.params := "UT_CAM/UDP(dst_ip=10.8.0.48,dst_port=12345,reuse_incoming_source_adddress=1)" + +[EXECUTE] + +# Check that protocolVersion is set to 2 and messageID is set to 2 +ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 +# Check that LF container is included in 1st CAM since CA basic service activation +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 +# Check that LF container is included if time elapsed since the generation of the last CAM with the low frequency container generation is equal or larger than 500 ms +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 +# Check that specialVehicle container is included in 1st CAM since CA basic service activation +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 +# Check that specialVehicle container is included if time elapsed since the generation of the last CAM with the special vehicle container generation is equal or larger than 500 ms. +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_05 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_01 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_02 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_03 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_04 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_05 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_06 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_07 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_08 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_09 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_10 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_11 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_12 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_13 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_14 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_15 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_16 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_17 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_18 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_19 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_20 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_21 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_22 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_23 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_24 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_25 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_26 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_27 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_28 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_29 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_30 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_31 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_32 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_33 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_34 +# Check that latest value of in-vehicle data is included in CAM +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_35 +# Check that publicTransportContainer is included if vehicleRole is set to publicTransport(1) +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_02 +# Check that specialTransportContainer is included if vehicleRole is set to specialTransport(2) +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_03 +# Check that dangerousGoodsContainer is included if vehicleRole is set to dangerousGoods(3) +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_04 +# Check that roadWorksContainerBasic is included if vehicleRole is set to roadWork(4) +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_05 +# Check that rescueContainer is included if vehicleRole is set to rescue(5) +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_06 +# Check that emergencyContainer is included if vehicleRole is set to emergency(6) +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_07 +# Check that safetyCarContainer is included if vehicleRole is set to safetyCar(7) +#ItsCam_TestCases.TC_CAM_MSD_INA_BV_08 +# Check that CAM is encapsulated in BTP type B packet +#ItsCam_TestCases.TC_CAM_MSD_PAR_BV_01 +# not PICS_IS_IUT_SECURED?? +#ItsCam_TestCases.TC_CAM_MSD_PAR_BV_02 +# not PICS_IS_IUT_SECURED?? + +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_01 Not implemented???? + +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_03 + + +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_01 Not implemented???? +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers. +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_02 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers. +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_03 + +#ItsCam_TestCases.TC_CAM_MSP_BV_01 + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/etc/AtsCAM/AtsCAM_Savary.cfg_ b/etc/AtsCAM/AtsCAM_Savary.cfg_ index 74f4321..1aac2e2 100644 --- a/etc/AtsCAM/AtsCAM_Savary.cfg_ +++ b/etc/AtsCAM/AtsCAM_Savary.cfg_ @@ -38,7 +38,6 @@ LogEventTypes:= Yes # destination port: dst_port # source port : src_port # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer # ll_address : GeoNetworking address of the Test System # latitude : Latitude of the Test System @@ -91,42 +90,20 @@ LogEventTypes:= Yes # time_offset : Time offset, used to skip packets with time offset < time_offset # save_mode : Set to 1 to save sent packet, 0 otherwise -# Single GeoNetworking component port -# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf -# its_aid=36: CAM -# its_aid=37: DENM -# its_aid=39: VAM -# its_aid=137: SPAT -# its_aid=138: MAP -# its_aid=139: IVIM -# its_aid=140: SREM/SSEM -# its_aid=141: GeoMet -# its_aid=128: RTCMEM -# its_aid=639: CPS - -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=4e685195ff0a)/PCAP(mac_src=ce550426c7e4,nic=tap0,filter=and ether proto 0x8947)" -system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=f8cab8083918)/PCAP(mac_src=f8cab8083918,nic=eno1,filter=and ether proto 0x8947)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=4e685195ff0a)/PCAP(mac_src=ce550426c7e4,nic=tap0,filter=and ether proto 0x8947)" +system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=f8cab8083918)/PCAP(mac_src=f8cab8083918,nic=eno1,filter=and ether proto 0x8947)" # CAM UpperTester port based on UDP #system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.20.142,src_port=12345)" system.utPort.params := "UT_CAM/DEBUG" [EXECUTE] -#ItsCam_TestControl.control - -# Check that protocolVersion is set to 2 and messageID is set to 2 ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 -# Check that LF container is included in 1st CAM since CA basic service activation #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 -# Check that LF container is included if time elapsed since the generation of the last CAM with the low frequency container generation is equal or larger than 500 ms #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 -# Check that specialVehicle container is included in 1st CAM since CA basic service activation #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 -# Check that specialVehicle container is included if time elapsed since the generation of the last CAM with the special vehicle container generation is equal or larger than 500 ms #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_05 -# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_01 -# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_02 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_03 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_04 @@ -168,21 +145,8 @@ ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_06 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_07 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_08 -# Check that content of received CAM is transmitted to applications and other facilities -#ItsCam_TestCases.TC_CAM_MSP_BV_01 -# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers -#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_01 -# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers -#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_02 -# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers -#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_03 -# Check that the IUT does not send a CAM when its content is not permitted by signing certificate -#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_01 -# Check that the IUT does not send a CAM when its content is not permitted by signing certificate #ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 -# Check that the IUT does not send a CAM when its content is not permitted by signing certificate -#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_03 - +#ItsCam_TestCases.TC_CAM_MSP_BV_01 [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/etc/AtsCAM/AtsCAM_Simulator.cfg_ b/etc/AtsCAM/AtsCAM_Simulator.cfg_ index 0579b15..c8bb2dd 100644 --- a/etc/AtsCAM/AtsCAM_Simulator.cfg_ +++ b/etc/AtsCAM/AtsCAM_Simulator.cfg_ @@ -37,7 +37,6 @@ LogEventTypes:= Yes # destination port: dst_port # source port : src_port # device_mode : Set to 1 if the layer shall encapsulate upper layer PDU -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer # ll_address : GeoNetworking address of the Test System for beaconing. To be align with CAM # latitude : Latitude of the Test System @@ -87,55 +86,33 @@ LogEventTypes:= Yes # time_offset : Time offset, used to skip packets with time offset < time_offset # save_mode : Set to 1 to save sent packet, 0 otherwise -# Single GeoNetworking component port -# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf -# its_aid=36: CAM -# its_aid=37: DENM -# its_aid=39: VAM -# its_aid=137: SPAT -# its_aid=138: MAP -# its_aid=139: IVIM -# its_aid=140: SREM/SSEM -# its_aid=141: GeoMet -# its_aid=128: RTCMEM -# its_aid=639: CPS - # Cygwin -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,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.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlo1,filter=and ether proto 0x8947)" # Linux over UDP -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.21,src_port=4041,dst_port=9091)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/UDP(dst_ip=192.168.1.43,src_port=4041,dst_port=9091)" # PC5 + UU/Raw -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470519,longitude=-455595023,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates_iut)/LTE(mac_src=8c554ac1eee1,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.21,dst_port=4041,src_port=9091)" +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates_iut)/LTE(mac_src=8c554ac1eee1,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.43,dst_port=4041,src_port=9091)" # PC5 + Uu/MQTT # Raw UDP -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=udp,debug=1,server=192.168.1.39,port=1883)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=udp,debug=1,server=192.168.1.39,port=1883)" # MQTT over TCP -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=192.168.1.39,port=1883)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee0,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=192.168.1.39,port=1883)" # CAM UpperTester port based on UDP -system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.1.21,dst_port=12345,src_port=12346)" +system.utPort.params := "UT_CAM/UDP(dst_ip=10.200.60.23,dst_port=12345,src_port=12346)" #system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.146.26)" #system.utPort.params := "UT_CAM/UDP(dst_ip=172.16.35.1)" [EXECUTE] -#ItsCam_TestControl.control - -# Check that protocolVersion is set to 2 and messageID is set to 2 ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 -# Check that LF container is included in 1st CAM since CA basic service activation #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 -# Check that LF container is included if time elapsed since the generation of the last CAM with the low frequency container generation is equal or larger than 500 ms #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 -# Check that specialVehicle container is included in 1st CAM since CA basic service activation #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 -# Check that specialVehicle container is included if time elapsed since the generation of the last CAM with the special vehicle container generation is equal or larger than 500 ms #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_05 -# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_01 -# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_02 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_03 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_04 @@ -177,19 +154,12 @@ ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_06 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_07 #ItsCam_TestCases.TC_CAM_MSD_INA_BV_08 -# Check that content of received CAM is transmitted to applications and other facilities #ItsCam_TestCases.TC_CAM_MSP_BV_01 -# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers #ItsCam_TestCases.TC_CAM_MSP_SSP_BV_01 -# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers #ItsCam_TestCases.TC_CAM_MSP_SSP_BV_02 -# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers #ItsCam_TestCases.TC_CAM_MSP_SSP_BV_03 -# Check that the IUT does not send a CAM when its content is not permitted by signing certificate #ItsCam_TestCases.TC_CAM_MSD_SSP_BO_01 -# Check that the IUT does not send a CAM when its content is not permitted by signing certificate #ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 -# Check that the IUT does not send a CAM when its content is not permitted by signing certificate #ItsCam_TestCases.TC_CAM_MSD_SSP_BO_03 [MAIN_CONTROLLER] diff --git a/etc/AtsCAM/AtsCAM_nfiniity.cfg_ b/etc/AtsCAM/AtsCAM_nfiniity.cfg_ index efd1953..66d4a4e 100644 --- a/etc/AtsCAM/AtsCAM_nfiniity.cfg_ +++ b/etc/AtsCAM/AtsCAM_nfiniity.cfg_ @@ -10,6 +10,14 @@ LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB LibItsCam_Pics.PICS_DANGEROUSGOODS := true LibItsCam_Pics.PICS_IS_IUT_SECURED := true +LibItsCam_Pics.PICS_PUBLICTRANS := true +LibItsCam_Pics.PICS_SPECIALTRANS := true +LibItsCam_Pics.PICS_DANGEROUSGOODS := true +LibItsCam_Pics.PICS_ROADWORKS := true +LibItsCam_Pics.PICS_RESCUE := true +LibItsCam_Pics.PICS_EMERGENCY := true +LibItsCam_Pics.PICS_SAFETY_CAR := true + # Instruct the Test System to use this certificate. Comment to use the default one (CERT_IUT_A_AT) #LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_TS_F3_AT" # brainpool384 @@ -40,7 +48,6 @@ LogEventTypes:= Yes # type : btpA|btpB # destination port: dst_port # source port : src_port -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer # ll_address : GeoNetworking address of the Test System # latitude : Latitude of the Test System @@ -94,70 +101,139 @@ LogEventTypes:= Yes # save_mode : Set to 1 to save sent packet, 0 otherwise # Cygwin -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,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)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,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.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlo1,filter=and ether proto 0x8947)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlo1,filter=and ether proto 0x8947)" # Linux over OpenVPN -system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=tun0,filter=and ether proto 0x8947)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=0000d0e6740f)/PCAP(mac_src=0000d0e6740f,nic=tun0,filter=and ether proto 0x8947)" +system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,certificate=CERT_IUT_A_B_AT,sec_db_path=../data/certificates/certificates)/ETH(mac_src=0000e87eb1ff)/PCAP(mac_src=0000e87eb1ff,nic=tap0,filter=and ether proto 0x8947)" # Linux over UDP -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=9091)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=9091)" # Linux over LTE/MQTT -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=dc536045af7e,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee2,mqtt_topics=obu,uu_transport=tcp,debug=1,server=127.0.0.1,port=1883)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=dc536045af7e,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee2,mqtt_topics=obu,uu_transport=tcp,debug=1,server=127.0.0.1,port=1883)" # CAM UpperTester port based on UDP #system.utPort.params := "UT_CAM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12346,reuse_incoming_source_adddress=1)" -system.utPort.params := "UT_CAM/UDP(dst_ip=10.8.0.6,reuse_incoming_source_adddress=1)" +system.utPort.params := "UT_CAM/UDP(dst_ip=10.8.0.48,dst_port=42001,reuse_incoming_source_adddress=1)" [EXECUTE] -ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 + +# Check that protocolVersion is set to 2 and messageID is set to 2 +#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 +# Check that LF container is included in 1st CAM since CA basic service activation #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 +# Check that LF container is included if time elapsed since the generation of the last CAM with the low frequency container generation is equal or larger than 500 ms #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 +# Check that specialVehicle container is included in 1st CAM since CA basic service activation #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 +# Check that specialVehicle container is included if time elapsed since the generation of the last CAM with the special vehicle container generation is equal or larger than 500 ms. #ItsCam_TestCases.TC_CAM_MSD_FMT_BV_05 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_01 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_02 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_03 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_04 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_05 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_06 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_07 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_08 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_09 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_10 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_11 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_12 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_13 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_14 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_15 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_16 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_17 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_18 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_19 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_20 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_21 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_22 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_23 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_24 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_25 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_26 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_27 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_28 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_29 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_30 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_31 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_32 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_33 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_34 +# Check that latest value of in-vehicle data is included in CAM #ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_35 +# Check that publicTransportContainer is included if vehicleRole is set to publicTransport(1) #ItsCam_TestCases.TC_CAM_MSD_INA_BV_02 +# Check that specialTransportContainer is included if vehicleRole is set to specialTransport(2) #ItsCam_TestCases.TC_CAM_MSD_INA_BV_03 +# Check that dangerousGoodsContainer is included if vehicleRole is set to dangerousGoods(3) #ItsCam_TestCases.TC_CAM_MSD_INA_BV_04 +# Check that roadWorksContainerBasic is included if vehicleRole is set to roadWork(4) #ItsCam_TestCases.TC_CAM_MSD_INA_BV_05 +# Check that rescueContainer is included if vehicleRole is set to rescue(5) #ItsCam_TestCases.TC_CAM_MSD_INA_BV_06 +# Check that emergencyContainer is included if vehicleRole is set to emergency(6) #ItsCam_TestCases.TC_CAM_MSD_INA_BV_07 +# Check that safetyCarContainer is included if vehicleRole is set to safetyCar(7) #ItsCam_TestCases.TC_CAM_MSD_INA_BV_08 +# Check that CAM is encapsulated in BTP type B packet +#ItsCam_TestCases.TC_CAM_MSD_PAR_BV_01 +# not PICS_IS_IUT_SECURED?? +#ItsCam_TestCases.TC_CAM_MSD_PAR_BV_02 +# not PICS_IS_IUT_SECURED?? + +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_01 Not implemented???? + #ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 -#ItsCam_TestCases.TC_CAM_MSP_BV_01 +# Check that the IUT does not send a CAM when its content is not permitted by signing certificate +#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_03 + + +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_01 Not implemented???? +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers. +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_02 +# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers. +#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_03 + +ItsCam_TestCases.TC_CAM_MSP_BV_01 [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/etc/AtsCAM/AtsCAM_pcap.cfg_ b/etc/AtsCAM/AtsCAM_pcap.cfg_ index 2daa017..3a7ba71 100644 --- a/etc/AtsCAM/AtsCAM_pcap.cfg_ +++ b/etc/AtsCAM/AtsCAM_pcap.cfg_ @@ -42,8 +42,6 @@ LogEventTypes:= Yes # type : btpA|btpB # destination port: dst_port # source port : src_port -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer # ll_address : GeoNetworking address of the Test System # latitude : Latitude of the Test System @@ -96,31 +94,18 @@ LogEventTypes:= Yes # save_mode : Set to 1 to save sent packet, 0 otherwise # -# Single GeoNetworking component port -# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf -# its_aid=36: CAM -# its_aid=37: DENM -# its_aid=39: VAM -# its_aid=137: SPAT -# its_aid=138: MAP -# its_aid=139: IVIM -# its_aid=140: SREM/SSEM -# its_aid=141: GeoMet -# its_aid=128: RTCMEM -# its_aid=639: CPS - # Non secured IUT (LAN USB) system.camPort.params := " CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/ BTP(type=btpB,dst_port=2001,src_port=0,device_mode=1)/ - GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1)/ + GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1)/ ETH(mac_src=803f5d092bdc)/ PCAP_FILE(file=../testdata/test_9950_cam.pcap,realtime=yes)" # Non secured IUT-WIFI -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP(type=btpB,dst_port=2001,src_port=0,device_mode=1)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1)/ETH(mac_src=1002b522d4f4)/PCAP(mac_src=1002b522d4f4,nic=A9142677-63D9-4DAC-93C9-F80C75DABE66,filter=and ether proto 0x8947)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP(type=btpB,dst_port=2001,src_port=0,device_mode=1)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1)/ETH(mac_src=1002b522d4f4)/PCAP(mac_src=1002b522d4f4,nic=A9142677-63D9-4DAC-93C9-F80C75DABE66,filter=and ether proto 0x8947)" # Secured IUT -#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP(type=btpB,dst_port=2001,src_port=0,deviceMode=1)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,expiry=1000,deviceMode=1,secured_mode=1,certificate=CERT_IUT_F_AT,sec_db_path=/home/vagrant/tmp/test_01)/ETH(mac_src=080027D2B658,mac_bc=FFFFFFFFFFFF,eth_type=8947)/PCAP(mac_src=803F5D092BDC,nic=eth1,filter=and ether proto 0x8947)" +#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP(type=btpB,dst_port=2001,src_port=0,deviceMode=1)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,expiry=1000,deviceMode=1,secured_mode=1,certificate=CERT_IUT_F_AT,sec_db_path=/home/vagrant/tmp/test_01)/ETH(mac_src=080027D2B658,mac_bc=FFFFFFFFFFFF,eth_type=8947)/PCAP(mac_src=803F5D092BDC,nic=eth1,filter=and ether proto 0x8947)" # CAM UpperTester port based on UDP (LAN USB) system.utPort.params := "UT_CAM(loopback=1)" @@ -129,77 +114,8 @@ system.utPort.params := "UT_CAM(loopback=1)" #system.utPort.params := "UT_CAM(loopback=0)/UDP(dst_ip=172.28.1.208,dst_port=12345,src_ip=172.28.0.123,src_port=12345)/ETH(mac_src=1002b522d4f4,mac_dst=08002794290a,eth_type=0800)/PCAP(mac_src=1002b522d4f4,nic=A9142677-63D9-4DAC-93C9-F80C75DABE66,filter=and udp port 12345)" [EXECUTE] -#ItsCam_TestControl.control - -# Check that protocolVersion is set to 2 and messageID is set to 2 ItsCam_TestCases.TC_CAM_MSD_FMT_BV_01 -# Check that LF container is included in 1st CAM since CA basic service activation -#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 -# Check that LF container is included if time elapsed since the generation of the last CAM with the low frequency container generation is equal or larger than 500 ms -#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_03 -# Check that specialVehicle container is included in 1st CAM since CA basic service activation -#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_04 -# Check that specialVehicle container is included if time elapsed since the generation of the last CAM with the special vehicle container generation is equal or larger than 500 ms -#ItsCam_TestCases.TC_CAM_MSD_FMT_BV_05 -# Check that latest value of in-vehicle data is included in CAM -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_01 -# Check that latest value of in-vehicle data is included in CAM -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_02 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_03 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_04 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_05 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_06 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_07 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_08 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_09 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_10 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_11 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_12 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_13 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_14 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_15 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_16 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_17 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_18 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_19 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_20 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_21 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_22 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_23 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_24 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_25 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_26 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_27 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_28 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_29 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_30 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_31 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_32 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_33 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_34 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_01_35 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_02 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_03 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_04 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_05 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_06 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_07 -#ItsCam_TestCases.TC_CAM_MSD_INA_BV_08 -# Check that content of received CAM is transmitted to applications and other facilities -#ItsCam_TestCases.TC_CAM_MSP_BV_01 -# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers -#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_01 -# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers -#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_02 -# Check that IUT discards CAM if SSP value of the signing certificate is not consistent with the provided containers -#ItsCam_TestCases.TC_CAM_MSP_SSP_BV_03 -# Check that the IUT does not send a CAM when its content is not permitted by signing certificate -#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_01 -# Check that the IUT does not send a CAM when its content is not permitted by signing certificate -#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_02 -# Check that the IUT does not send a CAM when its content is not permitted by signing certificate -#ItsCam_TestCases.TC_CAM_MSD_SSP_BO_03 - +ItsCam_TestCases.TC_CAM_MSD_FMT_BV_02 [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/etc/AtsDENM/AtsDENM_Simulator.cf_ b/etc/AtsDENM/AtsDENM_Simulator.cf_ new file mode 100644 index 0000000..682a530 --- /dev/null +++ b/etc/AtsDENM/AtsDENM_Simulator.cf_ @@ -0,0 +1,214 @@ + +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# IUT Station ID +LibItsCommon_Pixits.PX_IUT_STATION_ID := 2533729309 + +LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB +LibItsDenm_Pics.PICS_IS_IUT_SECURED := true + +[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). + +LogFile := "../logs/AtsDENM/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +#ConsoleMask := ERROR | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +# CAM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# header_sub_type : sh (single hop) +# DENM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# BTP Layer +# type : btpA|btpB +# destination port: dst_port +# source port : src_port +# GN Layer +# ll_address : GeoNetworking address of the Test System +# latitude : Latitude of the Test System +# longitude : Longitude of the Test System +# beaconing : Set to 1 if GnLayer shall start beaconing +# expiry : Beaconing timer expiry (ms) +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# secured_mode : Set to 1 if message exchanges shall be signed +# encrypted_mode : Set to 1 if message exchanges shall be encrypted +# NOTE: For signed & encrypted message exchanges, both secured_mode and encrypted_mode shall be set to 1 +# sec_db_path : Path to the certificates and keys storage location +# hash : Hash algorithm to be used when secured mode is set +# Authorized values are SHA-256 or SHA-384 +# Default: SHA-256 +# cypher : Cyphering algorithm to be used when secured mode is set +# Authorized values are NISTP-256 and BP-256 +# Default: NISTP-256 +# Ethernet layer +# mac_src :Source MAC address +# mac_bc :Broadcast address +# eth_type : Ethernet type +# Commsignia layer +# mac_src : Device MAC address, used to discard packets +# To indicate no filering, use the value 000000000000 +# mac_bc : Broadcast address +# eth_type : Ethernet type, used to discard packets +# target_host : Device address +# target_port : Device port +# source_port : Test System port +# interface_id: Interface id, used to discard packets +# tx_power : TX power (dB) +# UDP layer (IP/UDP based on Pcap) +# dst_ip : Destination IPv4 address (aa.bb.cc.dd) +# dst_port: Destination port +# src_ip : Source IPv4 address (aa.bb.cc.dd) +# src_port: Source port +# Pcap layer +# mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System +# filter : Pcap filter (compliant with tcpdump syntax) +# Online mode: +# nic: Local NIC +# If set, online mode is used +# Offline mode (nic is present but not set): +# file : File to read +# frame_offset: Frame offset, used to skip packets with frame number < frame_offset +# time_offset : Time offset, used to skip packets with time offset < time_offset +# save_mode : Set to 1 to save sent packet, 0 otherwise + +system.denmPort.params := "DENM(next_header=btpB,header_type=tsb)/BTP(dst_port=2002)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947)" + +# DENM UpperTester port based on UDP +system.utPort.params := "UT_DENM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" + +[EXECUTE] +# Check that protocolVersion is set to 2 and messageID is set to 1 +ItsDenm_TestCases.TC_DEN_MSGF_BV_01 +# Check that sent DENM contains at least one 'trace' DE +#ItsDenm_TestCases.TC_DEN_MSGF_BV_02 +# Check that DEN Basic Service generates a new DENM on reception of a valid AppDENM_Trigger request +#ItsDenm_TestCases.TC_DEN_EVGN_BV_01 +# Check that a new ActionId value is assigned for each newly generated DENM +#ItsDenm_TestCases.TC_DEN_EVGN_BV_02 +# Check that a newly created ActionId contains the StationID of the originating ITS-S that detected the event +#ItsDenm_TestCases.TC_DEN_EVGN_BV_03 +# Check that Cause and subcause values included in DENM as provided by application +#ItsDenm_TestCases.TC_DEN_EVGN_BV_04 +# Check that referenceTime is set to the current time when generating a DENM for a new event +#ItsDenm_TestCases.TC_DEN_EVGN_BV_05 +# Check that sequenceNumber is set to a next unused value each time an event is detected +#ItsDenm_TestCases.TC_DEN_EVGN_BV_07 +# Check that actionID are generated using newly assigned stationID when a pseudonym change occurs +#ItsDenm_TestCases.TC_DEN_EVGN_BV_10 +# Check that DEN Basic Service generates an update DENM on reception of a valid AppDENM_update request +#ItsDenm_TestCases.TC_DEN_EVUP_BV_01 +# Check that the actionID is not changed by DENM update, as long as the stationID of the originating ITS-S remains unchanged +#ItsDenm_TestCases.TC_DEN_EVUP_BV_02 +# Check that referenceTime is set to the current time when generating a DENM for an updated eventCheck +#ItsDenm_TestCases.TC_DEN_EVUP_BV_03 +# Check that DEN Basic Service does not send any update DENM if actionID is not in originating ITS-S message table +#ItsDenm_TestCases.TC_DEN_EVUP_BO_04 +# Check that DEN Basic Service generates a cancellation DENM when application indicates the premature termination of an event for which it is the originator +#ItsDenm_TestCases.TC_DEN_EVTR_BV_01 +# Check that DEN Basic Service generates a negation DENM when application indicates the premature termination of an event for which it is not the originator +#ItsDenm_TestCases.TC_DEN_EVTR_BV_02 +# Check that referenceTime is set to the latest value received for this event in negation DENM +#ItsDenm_TestCases.TC_DEN_EVTR_BV_03 +# Check that situation container, location container and alacarte container are not present in a cancellation DENM +#ItsDenm_TestCases.TC_DEN_EVTR_BV_04 +# Check that situation container, location container and alacarte container are not present in a negation DENM +#ItsDenm_TestCases.TC_DEN_EVTR_BV_05 +# Check that DEN Basic Service does not send any termination DENM if actionID is not in originating ITS-S message table or receiving ITS-S message table (own stationID) +#ItsDenm_TestCases.TC_DEN_EVTR_BO_06 +# Check that DEN Basic Service does not send any termination DENM if actionID is not in originating ITS-S message table or receiving ITS-S message table (other stationID) +#ItsDenm_TestCases.TC_DEN_EVTR_BO_07 +# Check that referenceTime is set to the current time when generating a cancellation DENM +#ItsDenm_TestCases.TC_DEN_EVTR_BV_08 +# Check that DEN Basic Sercive repeats DENM transmission according to repetitionInterval parameter provided by application +#ItsDenm_TestCases.TC_DEN_EVRP_TI_01 +# Check that the repeated DENM is always the most up-to-date message +#ItsDenm_TestCases.TC_DEN_EVRP_BV_02 +# Check that DEN Basic Service stops retransmitting DENM after event’s validityDuration expiration +#ItsDenm_TestCases.TC_DEN_EVRP_BV_03 +# Check that DEN Basic Service stops retransmitting DENM after event’s repetitionDuration expiration +#ItsDenm_TestCases.TC_DEN_EVRP_BV_04 +# Check that DEN Basic Service does not repeat transmission of DENM if repetitionInterval is not provided by application +#ItsDenm_TestCases.TC_DEN_EVRP_BV_05 +# Check that DEN Basic Service does not repeat transmission of DENM if repetitionDuration is not provided by application +#ItsDenm_TestCases.TC_DEN_EVRP_BV_06 +# Check that existing actionID in originating ITS-S are updated when stationID is modified +#ItsDenm_TestCases.TC_DEN_EVRP_BV_08 +# Check that actionID is not modified in repetitions of DENM if stationID is not modified +#ItsDenm_TestCases.TC_DEN_EVRP_BV_09 +# Check that actionID is not modified in repetitions of DENM if stationID is not modified +#ItsDenm_TestCases.TC_DEN_EVRP_BV_10 +# Check that DEN Basic Service stops retransmitting DENM after event's validityDuration expiration, when validityDuration was not provided +#ItsDenm_TestCases.TC_DEN_EVRP_BV_11 +# Check that DENM is encapsulated in BTP type B packet +#ItsDenm_TestCases.TC_DEN_PAR_BV_01 +# Check that DENM is encapsulated in a GBC packet +#ItsDenm_TestCases.TC_DEN_PAR_BV_02 +# Check that IUT does not send a DENM if it is not permitted by signing certificate +#ItsDenm_TestCases.TC_DEN_SSP_BV_01_01 +# Check that IUT does not send a DENM if it is not permitted by signing certificate +#ItsDenm_TestCases.TC_DEN_SSP_BV_01_02 +# Check that receiving ITS-S transmits DENM to application if it concerns an unknown ActionId and if it is not a termination DENM +#ItsDenm_TestCases.TC_DEN_MSRV_BV_01 +#Check that receiving ITS-S transmits DENM to application if it concerns a known ActionId and referenceTime is greater than highest value received for this ActionId +#ItsDenm_TestCases.TC_DEN_MSRV_BV_02 +# Check that receiving ITS-S discards termination DENM if it concerns an unknown ActionId (own actionID) +#ItsDenm_TestCases.TC_DEN_MSRV_BO_03 +# Check that receiving ITS-S discards termination DENM if it concerns an unknown ActionId (other actionID) +#ItsDenm_TestCases.TC_DEN_MSRV_BO_04 +# Check that receiving ITS-S discards DENM if referenceTime is lower than highest value received for this ActionId +#ItsDenm_TestCases.TC_DEN_MSRV_BO_05 +# Check that receiving ITS-S discards DENM if detectionTime is smaller than highest value received for this ActionId +#ItsDenm_TestCases.TC_DEN_MSRV_BO_06 +# Check that receiving ITS-S transmits DENM to application if it concerns a known ActionId and referenceTime is equal to highest received value and detectionTime is more recent +#ItsDenm_TestCases.TC_DEN_MSRV_BV_07 +# Check that receiving ITS-S discards DENM for new event if SSP value of the signing certificate is not consistent with the causeCode +#ItsDenm_TestCases.TC_DEN_MSRV_BO_08_01 +# Check that receiving ITS-S discards DENM for new event if SSP value of the signing certificate is not consistent with the causeCode +#ItsDenm_TestCases.TC_DEN_MSRV_BO_08_02 +# Check that receiving ITS-S discards DENM for existing event if SSP value of the signing certificate is not consistent with the causeCode +#ItsDenm_TestCases.TC_DEN_MSRV_BO_09_01 +# Check that receiving ITS-S discards DENM for existing event if SSP value of the signing certificate is not consistent with the causeCode +#ItsDenm_TestCases.TC_DEN_MSRV_BO_09_02 +# Check that receiving ITS-S replies to requestResponseIndication +#ItsDenm_TestCases.TC_DEN_MSRV_BV_10 +# Check that forwarding ITS-S forwards DENM if no DENM with same ActionId has been received during forwarding delay +#ItsDenm_TestCases.TC_DEN_KAFW_BV_01 +# Check that forwarding ITS-S forwards DENM if no DENM with same ActionId and referenceTime greater or equal to the last received DENM has been received during forwarding delay +#ItsDenm_TestCases.TC_DEN_KAFW_BV_02 +# Check that forwarding delay is set to min(2*transmissionInterval + rnd(0, 150ms), validityDuration) +#ItsDenm_TestCases.TC_DEN_KAFW_TI_03 +# Check that Forwarding ITS-S replaces the ITS PDU header of forwarded DENMs +#ItsDenm_TestCases.TC_DEN_KAFW_BV_04 +# Check that forwarding ITS-S does not change actionID +#ItsDenm_TestCases.TC_DEN_KAFW_BV_05 +# Check that forwarding ITS-S does not change referenceTime +#ItsDenm_TestCases.TC_DEN_KAFW_BV_06 +# Check that forwarding ITS-S does not change termination +#ItsDenm_TestCases.TC_DEN_KAFW_BV_07 +# Check that Forwarding ITS-S does not modify management, situation, location and alacarte containers when forwarding a DENM +#ItsDenm_TestCases.TC_DEN_KAFW_BV_08 +# Check that forwarding ITS-S stops forwarding DENM after validity expiration +#ItsDenm_TestCases.TC_DEN_KAFW_BV_09 +# Check that forwarding ITS-S stops forwarding DENM if it is outside relevance area +#ItsDenm_TestCases.TC_DEN_KAFW_BV_10 +# Check that forwarding ITS-S does not forward DENM is transmissionInterval is not present +#ItsDenm_TestCases.TC_DEN_KAFW_BV_11 + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/etc/AtsDENM/AtsDENM_codha.cf_ b/etc/AtsDENM/AtsDENM_codha.cf_ new file mode 100644 index 0000000..6b3bf8a --- /dev/null +++ b/etc/AtsDENM/AtsDENM_codha.cf_ @@ -0,0 +1,219 @@ + +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# IUT Station ID +LibItsCommon_Pixits.PX_IUT_STATION_ID := 2533729309 + +LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB +LibItsDenm_Pics.PICS_IS_IUT_SECURED := true +LibItsDenm_Pics.PICS_DENM_NEGATION := true + + +[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). + +LogFile := "../logs/AtsDENM/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +#ConsoleMask := ERROR | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +# CAM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# header_sub_type : sh (single hop) +# DENM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# BTP Layer +# type : btpA|btpB +# destination port: dst_port +# source port : src_port +# GN Layer +# ll_address : GeoNetworking address of the Test System +# latitude : Latitude of the Test System +# longitude : Longitude of the Test System +# beaconing : Set to 1 if GnLayer shall start beaconing +# expiry : Beaconing timer expiry (ms) +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# secured_mode : Set to 1 if message exchanges shall be signed +# encrypted_mode : Set to 1 if message exchanges shall be encrypted +# NOTE: For signed & encrypted message exchanges, both secured_mode and encrypted_mode shall be set to 1 +# sec_db_path : Path to the certificates and keys storage location +# hash : Hash algorithm to be used when secured mode is set +# Authorized values are SHA-256 or SHA-384 +# Default: SHA-256 +# cypher : Cyphering algorithm to be used when secured mode is set +# Authorized values are NISTP-256 and BP-256 +# Default: NISTP-256 +# Ethernet layer +# mac_src :Source MAC address +# mac_bc :Broadcast address +# eth_type : Ethernet type +# Commsignia layer +# mac_src : Device MAC address, used to discard packets +# To indicate no filering, use the value 000000000000 +# mac_bc : Broadcast address +# eth_type : Ethernet type, used to discard packets +# target_host : Device address +# target_port : Device port +# source_port : Test System port +# interface_id: Interface id, used to discard packets +# tx_power : TX power (dB) +# UDP layer (IP/UDP based on Pcap) +# dst_ip : Destination IPv4 address (aa.bb.cc.dd) +# dst_port: Destination port +# src_ip : Source IPv4 address (aa.bb.cc.dd) +# src_port: Source port +# Pcap layer +# mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System +# filter : Pcap filter (compliant with tcpdump syntax) +# Online mode: +# nic: Local NIC +# If set, online mode is used +# Offline mode (nic is present but not set): +# file : File to read +# frame_offset: Frame offset, used to skip packets with frame number < frame_offset +# time_offset : Time offset, used to skip packets with time offset < time_offset +# save_mode : Set to 1 to save sent packet, 0 otherwise + +#system.denmPort.params := "DENM(next_header=btpB,header_type=tsb)/BTP(dst_port=2002)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947)" +# Linux over OpenVPN +system.denmPort.params := "DENM(next_header=btpB,header_type=tsb)/BTP(dst_port=2002)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,certificate=CERT_IUT_A_B_AT,sec_db_path=../data/certificates/certificates)/ETH(mac_src=0000e87eb1ff)/PCAP(mac_src=0000e87eb1ff,nic=tap0,filter=and ether proto 0x8947)" + +# DENM UpperTester port based on UDP +system.utPort.params := "UT_DENM/UDP(dst_ip=10.8.0.48,dst_port=12345,reuse_incoming_source_adddress=1)" + +[EXECUTE] + +# Check that protocolVersion is set to 2 and messageID is set to 1 +#ItsDenm_TestCases.TC_DEN_MSGF_BV_01 +# Check that sent DENM contains at least one 'trace' DE +#ItsDenm_TestCases.TC_DEN_MSGF_BV_02 +# Check that DEN Basic Service generates a new DENM on reception of a valid AppDENM_Trigger request +#ItsDenm_TestCases.TC_DEN_EVGN_BV_01 +# Check that a new ActionId value is assigned for each newly generated DENM +#ItsDenm_TestCases.TC_DEN_EVGN_BV_02 +# Check that a newly created ActionId contains the StationID of the originating ITS-S that detected the event +#ItsDenm_TestCases.TC_DEN_EVGN_BV_03 +# Check that Cause and subcause values included in DENM as provided by application +#ItsDenm_TestCases.TC_DEN_EVGN_BV_04 +# Check that referenceTime is set to the current time when generating a DENM for a new event +#ItsDenm_TestCases.TC_DEN_EVGN_BV_05 +# Check that sequenceNumber is set to a next unused value each time an event is detected +#ItsDenm_TestCases.TC_DEN_EVGN_BV_07 +# Check that actionID are generated using newly assigned stationID when a pseudonym change occurs +#ItsDenm_TestCases.TC_DEN_EVGN_BV_10 +# Check that DEN Basic Service generates an update DENM on reception of a valid AppDENM_update request +#ItsDenm_TestCases.TC_DEN_EVUP_BV_01 +# Check that the actionID is not changed by DENM update, as long as the stationID of the originating ITS-S remains unchanged +#ItsDenm_TestCases.TC_DEN_EVUP_BV_02 +# Check that referenceTime is set to the current time when generating a DENM for an updated eventCheck +#ItsDenm_TestCases.TC_DEN_EVUP_BV_03 +# Check that DEN Basic Service does not send any update DENM if actionID is not in originating ITS-S message table +#ItsDenm_TestCases.TC_DEN_EVUP_BO_04 +# Check that DEN Basic Service generates a cancellation DENM when application indicates the premature termination of an event for which it is the originator +#ItsDenm_TestCases.TC_DEN_EVTR_BV_01 +# Check that DEN Basic Service generates a negation DENM when application indicates the premature termination of an event for which it is not the originator +#ItsDenm_TestCases.TC_DEN_EVTR_BV_02 +# Check that referenceTime is set to the latest value received for this event in negation DENM +#ItsDenm_TestCases.TC_DEN_EVTR_BV_03 +# Check that situation container, location container and alacarte container are not present in a cancellation DENM +#ItsDenm_TestCases.TC_DEN_EVTR_BV_04 +# Check that situation container, location container and alacarte container are not present in a negation DENM +#ItsDenm_TestCases.TC_DEN_EVTR_BV_05 +# Check that DEN Basic Service does not send any termination DENM if actionID is not in originating ITS-S message table or receiving ITS-S message table (own stationID) +#ItsDenm_TestCases.TC_DEN_EVTR_BO_06 +# Check that DEN Basic Service does not send any termination DENM if actionID is not in originating ITS-S message table or receiving ITS-S message table (other stationID) +#ItsDenm_TestCases.TC_DEN_EVTR_BO_07 +# Check that referenceTime is set to the current time when generating a cancellation DENM +#ItsDenm_TestCases.TC_DEN_EVTR_BV_08 +# Check that DEN Basic Sercive repeats DENM transmission according to repetitionInterval parameter provided by application +#ItsDenm_TestCases.TC_DEN_EVRP_TI_01 +# Check that the repeated DENM is always the most up-to-date message +#ItsDenm_TestCases.TC_DEN_EVRP_BV_02 +# Check that DEN Basic Service stops retransmitting DENM after event’s validityDuration expiration +#ItsDenm_TestCases.TC_DEN_EVRP_BV_03 +# Check that DEN Basic Service stops retransmitting DENM after event’s repetitionDuration expiration +#ItsDenm_TestCases.TC_DEN_EVRP_BV_04 +# Check that DEN Basic Service does not repeat transmission of DENM if repetitionInterval is not provided by application +#ItsDenm_TestCases.TC_DEN_EVRP_BV_05 +# Check that DEN Basic Service does not repeat transmission of DENM if repetitionDuration is not provided by application +#ItsDenm_TestCases.TC_DEN_EVRP_BV_06 +# Check that existing actionID in originating ITS-S are updated when stationID is modified +#ItsDenm_TestCases.TC_DEN_EVRP_BV_08 +# Check that actionID is not modified in repetitions of DENM if stationID is not modified +#ItsDenm_TestCases.TC_DEN_EVRP_BV_09 +# Check that actionID is not modified in repetitions of DENM if stationID is not modified +#ItsDenm_TestCases.TC_DEN_EVRP_BV_10 +# Check that DEN Basic Service stops retransmitting DENM after event's validityDuration expiration, when validityDuration was not provided +#ItsDenm_TestCases.TC_DEN_EVRP_BV_11 +# Check that DENM is encapsulated in BTP type B packet +#ItsDenm_TestCases.TC_DEN_PAR_BV_01 +# Check that DENM is encapsulated in a GBC packet +#ItsDenm_TestCases.TC_DEN_PAR_BV_02 +# Check that IUT does not send a DENM if it is not permitted by signing certificate +#ItsDenm_TestCases.TC_DEN_SSP_BV_01_01 +# Check that IUT does not send a DENM if it is not permitted by signing certificate +#ItsDenm_TestCases.TC_DEN_SSP_BV_01_02 +# Check that receiving ITS-S transmits DENM to application if it concerns an unknown ActionId and if it is not a termination DENM +#ItsDenm_TestCases.TC_DEN_MSRV_BV_01 +#Check that receiving ITS-S transmits DENM to application if it concerns a known ActionId and referenceTime is greater than highest value received for this ActionId +#ItsDenm_TestCases.TC_DEN_MSRV_BV_02 +# Check that receiving ITS-S discards termination DENM if it concerns an unknown ActionId (own actionID) +#ItsDenm_TestCases.TC_DEN_MSRV_BO_03 +# Check that receiving ITS-S discards termination DENM if it concerns an unknown ActionId (other actionID) +ItsDenm_TestCases.TC_DEN_MSRV_BO_04 +# Check that receiving ITS-S discards DENM if referenceTime is lower than highest value received for this ActionId +#ItsDenm_TestCases.TC_DEN_MSRV_BO_05 +# Check that receiving ITS-S discards DENM if detectionTime is smaller than highest value received for this ActionId +#ItsDenm_TestCases.TC_DEN_MSRV_BO_06 +# Check that receiving ITS-S transmits DENM to application if it concerns a known ActionId and referenceTime is equal to highest received value and detectionTime is more recent +#ItsDenm_TestCases.TC_DEN_MSRV_BV_07 +# Check that receiving ITS-S discards DENM for new event if SSP value of the signing certificate is not consistent with the causeCode +#ItsDenm_TestCases.TC_DEN_MSRV_BO_08_01 +# Check that receiving ITS-S discards DENM for new event if SSP value of the signing certificate is not consistent with the causeCode +#ItsDenm_TestCases.TC_DEN_MSRV_BO_08_02 +# Check that receiving ITS-S discards DENM for existing event if SSP value of the signing certificate is not consistent with the causeCode +#ItsDenm_TestCases.TC_DEN_MSRV_BO_09_01 +# Check that receiving ITS-S discards DENM for existing event if SSP value of the signing certificate is not consistent with the causeCode +#ItsDenm_TestCases.TC_DEN_MSRV_BO_09_02 +# Check that receiving ITS-S replies to requestResponseIndication +#ItsDenm_TestCases.TC_DEN_MSRV_BV_10 +# Check that forwarding ITS-S forwards DENM if no DENM with same ActionId has been received during forwarding delay +#ItsDenm_TestCases.TC_DEN_KAFW_BV_01 +# Check that forwarding ITS-S forwards DENM if no DENM with same ActionId and referenceTime greater or equal to the last received DENM has been received during forwarding delay +#ItsDenm_TestCases.TC_DEN_KAFW_BV_02 +# Check that forwarding delay is set to min(2*transmissionInterval + rnd(0, 150ms), validityDuration) +#ItsDenm_TestCases.TC_DEN_KAFW_TI_03 +# Check that Forwarding ITS-S replaces the ITS PDU header of forwarded DENMs +#ItsDenm_TestCases.TC_DEN_KAFW_BV_04 +# Check that forwarding ITS-S does not change actionID +#ItsDenm_TestCases.TC_DEN_KAFW_BV_05 +# Check that forwarding ITS-S does not change referenceTime +#ItsDenm_TestCases.TC_DEN_KAFW_BV_06 +# Check that forwarding ITS-S does not change termination +#ItsDenm_TestCases.TC_DEN_KAFW_BV_07 +# Check that Forwarding ITS-S does not modify management, situation, location and alacarte containers when forwarding a DENM +#ItsDenm_TestCases.TC_DEN_KAFW_BV_08 +# Check that forwarding ITS-S stops forwarding DENM after validity expiration +#ItsDenm_TestCases.TC_DEN_KAFW_BV_09 +# Check that forwarding ITS-S stops forwarding DENM if it is outside relevance area +#ItsDenm_TestCases.TC_DEN_KAFW_BV_10 +# Check that forwarding ITS-S does not forward DENM is transmissionInterval is not present +#ItsDenm_TestCases.TC_DEN_KAFW_BV_11 + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/etc/AtsDENM/AtsDENM_infiniity.cf_ b/etc/AtsDENM/AtsDENM_infiniity.cf_ new file mode 100644 index 0000000..8ebb084 --- /dev/null +++ b/etc/AtsDENM/AtsDENM_infiniity.cf_ @@ -0,0 +1,217 @@ + +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# IUT Station ID +LibItsCommon_Pixits.PX_IUT_STATION_ID := 2533729309 + +LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB +LibItsDenm_Pics.PICS_IS_IUT_SECURED := true + +[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). + +LogFile := "../logs/AtsDENM/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +#ConsoleMask := ERROR | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +# CAM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# header_sub_type : sh (single hop) +# DENM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# BTP Layer +# type : btpA|btpB +# destination port: dst_port +# source port : src_port +# GN Layer +# ll_address : GeoNetworking address of the Test System +# latitude : Latitude of the Test System +# longitude : Longitude of the Test System +# beaconing : Set to 1 if GnLayer shall start beaconing +# expiry : Beaconing timer expiry (ms) +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# secured_mode : Set to 1 if message exchanges shall be signed +# encrypted_mode : Set to 1 if message exchanges shall be encrypted +# NOTE: For signed & encrypted message exchanges, both secured_mode and encrypted_mode shall be set to 1 +# sec_db_path : Path to the certificates and keys storage location +# hash : Hash algorithm to be used when secured mode is set +# Authorized values are SHA-256 or SHA-384 +# Default: SHA-256 +# cypher : Cyphering algorithm to be used when secured mode is set +# Authorized values are NISTP-256 and BP-256 +# Default: NISTP-256 +# Ethernet layer +# mac_src :Source MAC address +# mac_bc :Broadcast address +# eth_type : Ethernet type +# Commsignia layer +# mac_src : Device MAC address, used to discard packets +# To indicate no filering, use the value 000000000000 +# mac_bc : Broadcast address +# eth_type : Ethernet type, used to discard packets +# target_host : Device address +# target_port : Device port +# source_port : Test System port +# interface_id: Interface id, used to discard packets +# tx_power : TX power (dB) +# UDP layer (IP/UDP based on Pcap) +# dst_ip : Destination IPv4 address (aa.bb.cc.dd) +# dst_port: Destination port +# src_ip : Source IPv4 address (aa.bb.cc.dd) +# src_port: Source port +# Pcap layer +# mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System +# filter : Pcap filter (compliant with tcpdump syntax) +# Online mode: +# nic: Local NIC +# If set, online mode is used +# Offline mode (nic is present but not set): +# file : File to read +# frame_offset: Frame offset, used to skip packets with frame number < frame_offset +# time_offset : Time offset, used to skip packets with time offset < time_offset +# save_mode : Set to 1 to save sent packet, 0 otherwise + +#system.denmPort.params := "DENM(next_header=btpB,header_type=tsb)/BTP(dst_port=2002)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947)" +# Linux over OpenVPN +system.denmPort.params := "DENM(next_header=btpB,header_type=tsb)/BTP(dst_port=2002)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,certificate=CERT_IUT_A_B_AT,sec_db_path=../data/certificates/certificates)/ETH(mac_src=0000e87eb1ff)/PCAP(mac_src=0000e87eb1ff,nic=tap0,filter=and ether proto 0x8947)" + +# DENM UpperTester port based on UDP +system.utPort.params := "UT_DENM/UDP(dst_ip=10.8.0.48,dst_port=42001,reuse_incoming_source_adddress=1)" + +[EXECUTE] + +# Check that protocolVersion is set to 2 and messageID is set to 1 +#ItsDenm_TestCases.TC_DEN_MSGF_BV_01 +# Check that sent DENM contains at least one 'trace' DE +#ItsDenm_TestCases.TC_DEN_MSGF_BV_02 +# Check that DEN Basic Service generates a new DENM on reception of a valid AppDENM_Trigger request +#ItsDenm_TestCases.TC_DEN_EVGN_BV_01 +# Check that a new ActionId value is assigned for each newly generated DENM +#ItsDenm_TestCases.TC_DEN_EVGN_BV_02 +# Check that a newly created ActionId contains the StationID of the originating ITS-S that detected the event +#ItsDenm_TestCases.TC_DEN_EVGN_BV_03 +# Check that Cause and subcause values included in DENM as provided by application +#ItsDenm_TestCases.TC_DEN_EVGN_BV_04 +# Check that referenceTime is set to the current time when generating a DENM for a new event +#ItsDenm_TestCases.TC_DEN_EVGN_BV_05 +# Check that sequenceNumber is set to a next unused value each time an event is detected +ItsDenm_TestCases.TC_DEN_EVGN_BV_07 +# Check that actionID are generated using newly assigned stationID when a pseudonym change occurs +#ItsDenm_TestCases.TC_DEN_EVGN_BV_10 +# Check that DEN Basic Service generates an update DENM on reception of a valid AppDENM_update request +#ItsDenm_TestCases.TC_DEN_EVUP_BV_01 +# Check that the actionID is not changed by DENM update, as long as the stationID of the originating ITS-S remains unchanged +#ItsDenm_TestCases.TC_DEN_EVUP_BV_02 +# Check that referenceTime is set to the current time when generating a DENM for an updated eventCheck +#ItsDenm_TestCases.TC_DEN_EVUP_BV_03 +# Check that DEN Basic Service does not send any update DENM if actionID is not in originating ITS-S message table +#ItsDenm_TestCases.TC_DEN_EVUP_BO_04 +# Check that DEN Basic Service generates a cancellation DENM when application indicates the premature termination of an event for which it is the originator +#ItsDenm_TestCases.TC_DEN_EVTR_BV_01 +# Check that DEN Basic Service generates a negation DENM when application indicates the premature termination of an event for which it is not the originator +#ItsDenm_TestCases.TC_DEN_EVTR_BV_02 +# Check that referenceTime is set to the latest value received for this event in negation DENM +#ItsDenm_TestCases.TC_DEN_EVTR_BV_03 +# Check that situation container, location container and alacarte container are not present in a cancellation DENM +#ItsDenm_TestCases.TC_DEN_EVTR_BV_04 +# Check that situation container, location container and alacarte container are not present in a negation DENM +#ItsDenm_TestCases.TC_DEN_EVTR_BV_05 +# Check that DEN Basic Service does not send any termination DENM if actionID is not in originating ITS-S message table or receiving ITS-S message table (own stationID) +#ItsDenm_TestCases.TC_DEN_EVTR_BO_06 +# Check that DEN Basic Service does not send any termination DENM if actionID is not in originating ITS-S message table or receiving ITS-S message table (other stationID) +#ItsDenm_TestCases.TC_DEN_EVTR_BO_07 +# Check that referenceTime is set to the current time when generating a cancellation DENM +#ItsDenm_TestCases.TC_DEN_EVTR_BV_08 +# Check that DEN Basic Sercive repeats DENM transmission according to repetitionInterval parameter provided by application +#ItsDenm_TestCases.TC_DEN_EVRP_TI_01 +# Check that the repeated DENM is always the most up-to-date message +#ItsDenm_TestCases.TC_DEN_EVRP_BV_02 +# Check that DEN Basic Service stops retransmitting DENM after event’s validityDuration expiration +#ItsDenm_TestCases.TC_DEN_EVRP_BV_03 +# Check that DEN Basic Service stops retransmitting DENM after event’s repetitionDuration expiration +#ItsDenm_TestCases.TC_DEN_EVRP_BV_04 +# Check that DEN Basic Service does not repeat transmission of DENM if repetitionInterval is not provided by application +#ItsDenm_TestCases.TC_DEN_EVRP_BV_05 +# Check that DEN Basic Service does not repeat transmission of DENM if repetitionDuration is not provided by application +#ItsDenm_TestCases.TC_DEN_EVRP_BV_06 +# Check that existing actionID in originating ITS-S are updated when stationID is modified +#ItsDenm_TestCases.TC_DEN_EVRP_BV_08 +# Check that actionID is not modified in repetitions of DENM if stationID is not modified +#ItsDenm_TestCases.TC_DEN_EVRP_BV_09 +# Check that actionID is not modified in repetitions of DENM if stationID is not modified +#ItsDenm_TestCases.TC_DEN_EVRP_BV_10 +# Check that DEN Basic Service stops retransmitting DENM after event's validityDuration expiration, when validityDuration was not provided +#ItsDenm_TestCases.TC_DEN_EVRP_BV_11 +# Check that DENM is encapsulated in BTP type B packet +#ItsDenm_TestCases.TC_DEN_PAR_BV_01 +# Check that DENM is encapsulated in a GBC packet +#ItsDenm_TestCases.TC_DEN_PAR_BV_02 +# Check that IUT does not send a DENM if it is not permitted by signing certificate +#ItsDenm_TestCases.TC_DEN_SSP_BV_01_01 +# Check that IUT does not send a DENM if it is not permitted by signing certificate +#ItsDenm_TestCases.TC_DEN_SSP_BV_01_02 +# Check that receiving ITS-S transmits DENM to application if it concerns an unknown ActionId and if it is not a termination DENM +#ItsDenm_TestCases.TC_DEN_MSRV_BV_01 +#Check that receiving ITS-S transmits DENM to application if it concerns a known ActionId and referenceTime is greater than highest value received for this ActionId +#ItsDenm_TestCases.TC_DEN_MSRV_BV_02 +# Check that receiving ITS-S discards termination DENM if it concerns an unknown ActionId (own actionID) +#ItsDenm_TestCases.TC_DEN_MSRV_BO_03 +# Check that receiving ITS-S discards termination DENM if it concerns an unknown ActionId (other actionID) +#ItsDenm_TestCases.TC_DEN_MSRV_BO_04 +# Check that receiving ITS-S discards DENM if referenceTime is lower than highest value received for this ActionId +#ItsDenm_TestCases.TC_DEN_MSRV_BO_05 +# Check that receiving ITS-S discards DENM if detectionTime is smaller than highest value received for this ActionId +#ItsDenm_TestCases.TC_DEN_MSRV_BO_06 +# Check that receiving ITS-S transmits DENM to application if it concerns a known ActionId and referenceTime is equal to highest received value and detectionTime is more recent +#ItsDenm_TestCases.TC_DEN_MSRV_BV_07 +# Check that receiving ITS-S discards DENM for new event if SSP value of the signing certificate is not consistent with the causeCode +#ItsDenm_TestCases.TC_DEN_MSRV_BO_08_01 +# Check that receiving ITS-S discards DENM for new event if SSP value of the signing certificate is not consistent with the causeCode +#ItsDenm_TestCases.TC_DEN_MSRV_BO_08_02 +# Check that receiving ITS-S discards DENM for existing event if SSP value of the signing certificate is not consistent with the causeCode +#ItsDenm_TestCases.TC_DEN_MSRV_BO_09_01 +# Check that receiving ITS-S discards DENM for existing event if SSP value of the signing certificate is not consistent with the causeCode +#ItsDenm_TestCases.TC_DEN_MSRV_BO_09_02 +# Check that receiving ITS-S replies to requestResponseIndication +#ItsDenm_TestCases.TC_DEN_MSRV_BV_10 +# Check that forwarding ITS-S forwards DENM if no DENM with same ActionId has been received during forwarding delay +#ItsDenm_TestCases.TC_DEN_KAFW_BV_01 +# Check that forwarding ITS-S forwards DENM if no DENM with same ActionId and referenceTime greater or equal to the last received DENM has been received during forwarding delay +#ItsDenm_TestCases.TC_DEN_KAFW_BV_02 +# Check that forwarding delay is set to min(2*transmissionInterval + rnd(0, 150ms), validityDuration) +#ItsDenm_TestCases.TC_DEN_KAFW_TI_03 +# Check that Forwarding ITS-S replaces the ITS PDU header of forwarded DENMs +#ItsDenm_TestCases.TC_DEN_KAFW_BV_04 +# Check that forwarding ITS-S does not change actionID +#ItsDenm_TestCases.TC_DEN_KAFW_BV_05 +# Check that forwarding ITS-S does not change referenceTime +#ItsDenm_TestCases.TC_DEN_KAFW_BV_06 +# Check that forwarding ITS-S does not change termination +#ItsDenm_TestCases.TC_DEN_KAFW_BV_07 +# Check that Forwarding ITS-S does not modify management, situation, location and alacarte containers when forwarding a DENM +#ItsDenm_TestCases.TC_DEN_KAFW_BV_08 +# Check that forwarding ITS-S stops forwarding DENM after validity expiration +#ItsDenm_TestCases.TC_DEN_KAFW_BV_09 +# Check that forwarding ITS-S stops forwarding DENM if it is outside relevance area +#ItsDenm_TestCases.TC_DEN_KAFW_BV_10 +# Check that forwarding ITS-S does not forward DENM is transmissionInterval is not present +#ItsDenm_TestCases.TC_DEN_KAFW_BV_11 + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/etc/AtsGeoNetworking/AtsGeoNetworking.cfg b/etc/AtsGeoNetworking/AtsGeoNetworking.cfg index bd8ca7e..d461071 100644 --- a/etc/AtsGeoNetworking/AtsGeoNetworking.cfg +++ b/etc/AtsGeoNetworking/AtsGeoNetworking.cfg @@ -44,8 +44,6 @@ LogEventTypes:= Yes # type : btpA|btpB # destination port: dst_port # source port : src_port -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer # ll_address : GeoNetworking address of the Test System # latitude : Latitude of the Test System @@ -95,13 +93,13 @@ LogEventTypes:= Yes # save_mode : Set to 1 to save sent packet, 0 otherwise # Single GeoNetworking component port -mtc.geoNetworkingPort.params := "GN(ll_address=00000000000B,latitude=367470519,longitude=-455595023)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlp0s20f3,filter=and ether proto 0x8947)" +mtc.geoNetworkingPort.params := "GN(ll_address=00000000000B,latitude=515340240,longitude=139274330)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlp0s20f3,filter=and ether proto 0x8947)" # Multiple GeoNetworking component portN -NodeA.geoNetworkingPort.params := "GN(ll_address=00000000000A,latitude=367470519,longitude=-455595023)/ETH(mac_src=080027500f9a)/PCAP(mac_src=080027500f9a,nic=wlp0s20f3,filter=and ether proto 0x8947)" -NodeB.geoNetworkingPort.params := "GN(ll_address=00000000000B,latitude=367470519,longitude=-455595023)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlp0s20f3,filter=and ether proto 0x8947)" -NodeC.geoNetworkingPort.params := "GN(ll_address=00000000000C,latitude=367470519,longitude=-455595023)/ETH(mac_src=080027500f9c)/PCAP(mac_src=080027500f9c,nic=wlp0s20f3,filter=and ether proto 0x8947)" -NodeD.geoNetworkingPort.params := "GN(ll_address=00000000000D,latitude=367470519,longitude=-455595023)/ETH(mac_src=080027500f9d)/PCAP(mac_src=080027500f9d,nic=wlp0s20f3,filter=and ether proto 0x8947 and not ether src 8c554ac1eee1)" +NodeA.geoNetworkingPort.params := "GN(ll_address=00000000000A,latitude=515340240,longitude=139274330)/ETH(mac_src=080027500f9a)/PCAP(mac_src=080027500f9a,nic=wlp0s20f3,filter=and ether proto 0x8947)" +NodeB.geoNetworkingPort.params := "GN(ll_address=00000000000B,latitude=515340240,longitude=139274330)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlp0s20f3,filter=and ether proto 0x8947)" +NodeC.geoNetworkingPort.params := "GN(ll_address=00000000000C,latitude=515340240,longitude=139274330)/ETH(mac_src=080027500f9c)/PCAP(mac_src=080027500f9c,nic=wlp0s20f3,filter=and ether proto 0x8947)" +NodeD.geoNetworkingPort.params := "GN(ll_address=00000000000D,latitude=515340240,longitude=139274330)/ETH(mac_src=080027500f9d)/PCAP(mac_src=080027500f9d,nic=wlp0s20f3,filter=and ether proto 0x8947 and not ether src 8c554ac1eee1)" # UpperTester port based on UDP #system.utPort.params := "UT_GN/UDP(dst_ip=192.168.2.2)" diff --git a/etc/AtsIS/AtsIS_IVIM.cf_ b/etc/AtsIS/AtsIS_IVIM.cf_ index 2bf25b7..01ad52c 100644 --- a/etc/AtsIS/AtsIS_IVIM.cf_ +++ b/etc/AtsIS/AtsIS_IVIM.cf_ @@ -44,8 +44,6 @@ LogEventTypes:= Yes # type : btpA|btpB # destination port: dst_port # source port : src_port -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer # ll_address : GeoNetworking address of the Test System # latitude : latitude of the Test System @@ -94,26 +92,15 @@ LogEventTypes:= Yes # time_offset : Time offset, used to skip packets with time offset < time_offset # save_mode : 1 to save sent packet, 0 otherwise -# Single GeoNetworking component port -# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf -# its_aid=36: CAM -# its_aid=37: DENM -# its_aid=39: VAM -# its_aid=137: SPAT -# its_aid=138: MAP -# its_aid=139: IVIM -# its_aid=140: SREM/SSEM -# its_aid=141: GeoMet -# its_aid=128: RTCMEM -# its_aid=639: CPS - #Cygwin -#system.ivimPort.params := "IVIM(next_header=btpB,header_type=uni)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=/home/yanng/tmp/certificates)/ETH(mac_src=e2b7b30429eb)/PCAP(mac_src=e2b7b30429eb,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" +#system.ivimPort.params := "IVIM(next_header=btpB,header_type=uni)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=/home/yanng/tmp/certificates)/ETH(mac_src=e2b7b30429eb)/PCAP(mac_src=e2b7b30429eb,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" # Linux -#system.ivimPort.params := "IVIM(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/PCAP(mac_src=dc536045af7f,nic=wlp2s0,filter=and ether proto 0x8947)" -system.ivimPort.params := "IVIM(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp0s20f3,filter=and ether proto 0x8947)" +#system.ivimPort.params := "IVIM(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/PCAP(mac_src=dc536045af7f,nic=wlp2s0,filter=and ether proto 0x8947)" +#system.ivimPort.params := "IVIM(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp0s20f3,filter=and ether proto 0x8947)" # Linux over UDP -#system.ivimPort.params := "IVIM(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=50544)" +#system.ivimPort.params := "IVIM(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=50544)" +# Linux over LTE/MQTT +system.ivimPort.params := "IVIM(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=dc536045af7e,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee2,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=127.0.0.1,port=1883)" # IVIM UpperTester port based on UDP system.utPort.params := "UT_IVIM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12346)" @@ -124,7 +111,7 @@ system.utPort.params := "UT_IVIM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12 # Check that protocolVersion is set to 1 and messageID is set to 6 #ItsIvim_TestCases.TC_IS_IVI_GEN_MSGF_BV_01 # Check that all Application Containers references existing items in one or more Location Containers -#ItsIvim_TestCases.TC_IS_IVI_GEN_LOC_BV_01 +ItsIvim_TestCases.TC_IS_IVI_GEN_LOC_BV_01 # Check that application container information of the same type does not refer to overlapping RZs. #ItsIvim_TestCases.TC_IS_IVI_GEN_LOC_BV_02 # Check that all definitions of zones that are based on the same Reference Position, be it that they are connected or not interconnected, should be included in the same Geographic Location Container @@ -196,7 +183,7 @@ system.utPort.params := "UT_IVIM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12 # Check that the IUT terminates IVM genration on termination request #ItsIvim_TestCases.TC_IS_IVI_GEN_EVTR_BV_02 # Check that the IUT terminates IVM generation on cancellation request. -ItsIvim_TestCases.TC_IS_IVI_GEN_EVTR_BV_03 +#ItsIvim_TestCases.TC_IS_IVI_GEN_EVTR_BV_03 # Check that the IUT terminates IVM generation on negation request #ItsIvim_TestCases.TC_IS_IVI_GEN_EVTR_BV_04 # Check that IVIM uses BTP_B packet diff --git a/etc/AtsIS/AtsIS_Mapem.cf_ b/etc/AtsIS/AtsIS_Mapem.cf_ index 71c44e5..05de1b6 100644 --- a/etc/AtsIS/AtsIS_Mapem.cf_ +++ b/etc/AtsIS/AtsIS_Mapem.cf_ @@ -34,8 +34,6 @@ LogEventTypes:= Yes # type : btpA|btpB # destination port: dst_port # source port : src_port -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer # ll_address : GeoNetworking address of the Test System # latitude : latitude of the Test System @@ -84,40 +82,29 @@ LogEventTypes:= Yes # time_offset : Time offset, used to skip packets with time offset < time_offset # save_mode : 1 to save sent packet, 0 otherwise -# Single GeoNetworking component port -# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf -# its_aid=36: CAM -# its_aid=37: DENM -# its_aid=39: VAM -# its_aid=137: SPAT -# its_aid=138: MAP -# its_aid=139: IVIM -# its_aid=140: SREM/SSEM -# its_aid=141: GeoMet -# its_aid=128: RTCMEM -# its_aid=639: CPS - #Cygwin -#system.mapemSpatemPort.params := "MAPEM(next_header=btpB,header_type=uni)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=/home/yanng/tmp/certificates)/ETH(mac_src=e2b7b30429eb)/PCAP(mac_src=e2b7b30429eb,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=uni)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=/home/yanng/tmp/certificates)/ETH(mac_src=e2b7b30429eb)/PCAP(mac_src=e2b7b30429eb,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" # Linux # ETH -#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/PCAP(mac_src=dc536045af7f,nic=enx00e07cc91967,filter=and ether proto 0x8947)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/PCAP(mac_src=dc536045af7f,nic=enx00e07cc91967,filter=and ether proto 0x8947)" # WiFi -#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp0s20f3,filter=and ether proto 0x8947)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp0s20f3,filter=and ether proto 0x8947)" # Linux over UDP -system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/UDP(dst_ip=81.47.99.165,src_port=4041,dst_port=50544)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/UDP(dst_ip=81.47.99.165,src_port=4041,dst_port=50544)" +# Linux over LTE/MQTT +system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=dc536045af7e,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee2,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=127.0.0.1,port=1883)" # MAPEM UpperTester port based on UDP -system.utPort.params := "UT_MAPEMSPATEM/UDP(dst_ip=81.47.99.165)" #,dst_port=12346,src_port=12346)" +system.utPort.params := "UT_MAPEMSPATEM/UDP(dst_ip=127.0.0.1,src_port=12346,src_port=12346)" [EXECUTE] #ItsMapem_TestCases.TC_IS_RLT_xxx_BV_01 # Check that protocolVersion is set to 1 and messageID is set to 4 -#ItsMapem_TestCases.TC_IS_RLT_GEN_MSGF_BV_01 +ItsMapem_TestCases.TC_IS_RLT_GEN_MSGF_BV_01 # Check that the intersection information revision number is changed when the intersection configuration is changed. -ItsMapem_TestCases.TC_IS_RLT_GEN_MSGF_BV_02 +#ItsMapem_TestCases.TC_IS_RLT_GEN_MSGF_BV_02 # Check that the intersection information revision number is not changed when the intersection configuration is still the same. #ItsMapem_TestCases.TC_IS_RLT_GEN_MSGF_BV_03 # Check that RLT Service transmits MAPEM with the valid connection trajectories. diff --git a/etc/AtsIS/AtsIS_Rtcmem.cf_ b/etc/AtsIS/AtsIS_Rtcmem.cf_ index 624de26..8892c6e 100644 --- a/etc/AtsIS/AtsIS_Rtcmem.cf_ +++ b/etc/AtsIS/AtsIS_Rtcmem.cf_ @@ -33,7 +33,6 @@ LogEventTypes:= Yes # type : btpA|btpB # destination port: dst_port # source port : src_port -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer # ll_address : GeoNetworking address of the Test System # latitude : latitude of the Test System @@ -83,14 +82,14 @@ LogEventTypes:= Yes # save_mode : 1 to save sent packet, 0 otherwise #Cygwin -#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=uni)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=/home/yanng/tmp/certificates)/ETH(mac_src=e2b7b30429eb)/PCAP(mac_src=e2b7b30429eb,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=uni)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=/home/yanng/tmp/certificates)/ETH(mac_src=e2b7b30429eb)/PCAP(mac_src=e2b7b30429eb,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" # Linux -#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/PCAP(mac_src=dc536045af7f,nic=wlp2s0,filter=and ether proto 0x8947)" -#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp0s20f3,filter=and ether proto 0x8947)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/PCAP(mac_src=dc536045af7f,nic=wlp2s0,filter=and ether proto 0x8947)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp0s20f3,filter=and ether proto 0x8947)" # Linux over UDP -#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=50544)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=50544)" # Linux over LTE/MQTT -system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=dc536045af7e,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee2,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=127.0.0.1,port=1883)" +system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=dc536045af7e,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee2,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=127.0.0.1,port=1883)" # SPATEM UpperTester port based on UDP system.utPort.params := "UT_MAPEMSPATEM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12346)" diff --git a/etc/AtsIS/AtsIS_Spatem.cf_ b/etc/AtsIS/AtsIS_Spatem.cf_ index 1216cd8..aee48a5 100644 --- a/etc/AtsIS/AtsIS_Spatem.cf_ +++ b/etc/AtsIS/AtsIS_Spatem.cf_ @@ -33,8 +33,6 @@ LogEventTypes:= Yes # type : btpA|btpB # destination port: dst_port # source port : src_port -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer # ll_address : GeoNetworking address of the Test System # latitude : latitude of the Test System @@ -83,38 +81,27 @@ LogEventTypes:= Yes # time_offset : Time offset, used to skip packets with time offset < time_offset # save_mode : 1 to save sent packet, 0 otherwise -# Single GeoNetworking component port -# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf -# its_aid=36: CAM -# its_aid=37: DENM -# its_aid=39: VAM -# its_aid=137: SPAT -# its_aid=138: MAP -# its_aid=139: IVIM -# its_aid=140: SREM/SSEM -# its_aid=141: GeoMet -# its_aid=128: RTCMEM -# its_aid=639: CPS - #Cygwin -#system.mapemSpatemPort.params := "SPATEM(next_header=btpB,header_type=uni)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=/home/yanng/tmp/certificates)/ETH(mac_src=e2b7b30429eb)/PCAP(mac_src=e2b7b30429eb,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=uni)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=/home/yanng/tmp/certificates)/ETH(mac_src=e2b7b30429eb)/PCAP(mac_src=e2b7b30429eb,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" # Linux -#system.mapemSpatemPort.params := "SPATEM(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/PCAP(mac_src=dc536045af7f,nic=wlp2s0,filter=and ether proto 0x8947)" -system.mapemSpatemPort.params := "SPATEM(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp0s20f3,filter=and ether proto 0x8947)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/PCAP(mac_src=dc536045af7f,nic=wlp2s0,filter=and ether proto 0x8947)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp0s20f3,filter=and ether proto 0x8947)" # Linux over UDP -#system.mapemSpatemPort.params := "SPATEM(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=50544)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=50544)" +# Linux over LTE/MQTT +system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=dc536045af7e,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee2,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=127.0.0.1,port=1883)" # SPATEM UpperTester port based on UDP -system.utPort.params := "UT_SPATEM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12346)" -#system.utPort.params := "UT_SPATEM/UDP(dst_ip=192.168.146.26,dst_port=44100,src_port=12345)" -#system.utPort.params := "UT_SPATEM/UDP(dst_ip=172.16.35.1)" +system.utPort.params := "UT_MAPEMSPATEM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12346)" +#system.utPort.params := "UT_MAPEMSPATEM/UDP(dst_ip=192.168.146.26,dst_port=44100,src_port=12345)" +#system.utPort.params := "UT_MAPEMSPATEM/UDP(dst_ip=172.16.35.1)" [EXECUTE] -ItsSpatem_TestCases.TC_IS_TLM_xxx_BV_01 +#ItsSpatem_TestCases.TC_IS_TLM_xxx_BV_01 # Check that protocolVersion is set to 1 and messageID is set to 4 -#ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_01 +ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_01 # An IUT shall include the unique identifier for the intersection as part of the signal phase and timing message broadcast #ItsSpatem_TestCases.TC_IS_TLM_GEN_MSGF_BV_02 # Check that TLM service generates a SPAT message with the revision data element synchronized with the revision data element in the intersection configuration of the roadway geometric information (MAP) diff --git a/etc/AtsIS/AtsIS_SxEM.cf_ b/etc/AtsIS/AtsIS_SxEM.cf_ index 4896c7d..0d37ea4 100644 --- a/etc/AtsIS/AtsIS_SxEM.cf_ +++ b/etc/AtsIS/AtsIS_SxEM.cf_ @@ -33,7 +33,6 @@ LogEventTypes:= Yes # type : btpA|btpB # destination port: dst_port # source port : src_port -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer # ll_address : GeoNetworking address of the Test System # latitude : latitude of the Test System @@ -83,14 +82,14 @@ LogEventTypes:= Yes # save_mode : 1 to save sent packet, 0 otherwise #Cygwin -#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=uni)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=/home/yanng/tmp/certificates)/ETH(mac_src=e2b7b30429eb)/PCAP(mac_src=e2b7b30429eb,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=uni)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=/home/yanng/tmp/certificates)/ETH(mac_src=e2b7b30429eb)/PCAP(mac_src=e2b7b30429eb,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" # Linux -#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/PCAP(mac_src=dc536045af7f,nic=wlp2s0,filter=and ether proto 0x8947)" -#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp0s20f3,filter=and ether proto 0x8947)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/PCAP(mac_src=dc536045af7f,nic=wlp2s0,filter=and ether proto 0x8947)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7e)/PCAP(mac_src=dc536045af7e,nic=wlp0s20f3,filter=and ether proto 0x8947)" # Linux over UDP -#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=50544)" +#system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=0,sec_db_path=../data/certificates/certificates)/ETH(mac_src=dc536045af7f)/UDP(dst_ip=192.168.146.26,src_port=4041,dst_port=50544)" # Linux over LTE/MQTT -system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-455595024,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=dc536045af7e,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee2,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=127.0.0.1,port=1883)" +system.mapemSpatemPort.params := "MapemSpatem(next_header=btpB,header_type=gbc)/BTP(dst_port=2006)/GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,sec_db_path=../data/certificates/certificates)/LTE(mac_src=dc536045af7e,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee2,mqtt_topics=rsu,uu_transport=tcp,debug=1,server=127.0.0.1,port=1883)" # SPATEM UpperTester port based on UDP system.utPort.params := "UT_MAPEMSPATEM/UDP(dst_ip=127.0.0.1,dst_port=12345,src_port=12346)" diff --git a/etc/AtsMBR/AtsMBR_Simu.cfg_ b/etc/AtsMBR/AtsMBR_Simu.cfg_ index 21f0f5e..88b9e05 100644 --- a/etc/AtsMBR/AtsMBR_Simu.cfg_ +++ b/etc/AtsMBR/AtsMBR_Simu.cfg_ @@ -71,8 +71,6 @@ LogEventTypes:= Yes # type : btpA|btpB # destination port: dst_port # source port : src_port -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer # ll_address : GeoNetworking address of the Test System # latitude : latitude of the Test System @@ -125,22 +123,20 @@ LogEventTypes:= Yes # https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf # its_aid=36: CAM # its_aid=37: DENM -# its_aid=39: VAM # its_aid=137: SPAT # its_aid=138: MAP # its_aid=139: IVIM # its_aid=140: SREM/SSEM # its_aid=141: GeoMet # its_aid=128: RTCMEM -# its_aid=639: CPS # 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)" +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,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=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)" +system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,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=367470520,longitude=-45559502,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.21,src_port=4041,dst_port=9091)" +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,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.21,src_port=4041,dst_port=9091)" # For all test where IUT is not MA, uncomment this port system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.21)" diff --git a/etc/AtsPki/AtsPki_Microsec.cfg_ b/etc/AtsPki/AtsPki_Microsec.cfg_ index b68994b..2ebbeaf 100644 --- a/etc/AtsPki/AtsPki_Microsec.cfg_ +++ b/etc/AtsPki/AtsPki_Microsec.cfg_ @@ -312,7 +312,7 @@ ItsPki_TestCases.TC_SECPKI_EA_BFK_AUTH_06_BV_02 # Config: # system.httpCaPort.params := TCP(debug=1,server_mode=1,server=192.168.1.43) # Await CTL request and provides "CERT_IUT_A_RCA", "CERT_TS_A_AA", "CERT_TS_A_EA" certificates -#ItsPki_TestCases.TC_RCA_CTLGEN_xx_BV # +#ItsPki_TestCases.TC_RCA_CTLGEN_xx_BV [MAIN_CONTROLLER] # The options herein control the behavior of MC. diff --git a/etc/AtsPki/AtsPki_Simu.cfg_ b/etc/AtsPki/AtsPki_Simu.cfg_ index 5d125ef..579ed22 100644 --- a/etc/AtsPki/AtsPki_Simu.cfg_ +++ b/etc/AtsPki/AtsPki_Simu.cfg_ @@ -124,8 +124,6 @@ LogEventTypes:= Yes # type : btpA|btpB # destination port: dst_port # source port : src_port -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer # ll_address : GeoNetworking address of the Test System # latitude : latitude of the Test System @@ -181,19 +179,9 @@ LogEventTypes:= Yes # save_mode : 1 to save sent packet, 0 otherwise # Single GeoNetworking component port -# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf -# its_aid=36: CAM -# its_aid=37: DENM -# its_aid=39: VAM -# its_aid=137: SPAT -# its_aid=138: MAP -# its_aid=139: IVIM -# its_aid=140: SREM/SSEM -# its_aid=141: GeoMet -# its_aid=128: RTCMEM -# its_aid=639: CPS - -system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470519,longitude=-455595023,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=1,its_aid=36)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlo1,filter=and ether proto 0x8947)" +# its_aid = 36 CAM +# its_aid = 37 DENM +system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=1,its_aid=36)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=wlo1,filter=and ether proto 0x8947)" # Single HTTP component port system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.21)" diff --git a/etc/AtsRSUsSimulator/AtsRSUSimulator.cfg b/etc/AtsRSUsSimulator/AtsRSUSimulator.cfg new file mode 100644 index 0000000..8d189be --- /dev/null +++ b/etc/AtsRSUsSimulator/AtsRSUSimulator.cfg @@ -0,0 +1,272 @@ + +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. +LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { + typeOfAddress := e_manual, + stationType := e_unknown, + reserved := 0, + mid := '4C5E0C14D2EA'O #'4C5E0C14D2EA'O #'00000000000B'O +} + +# GeoNetwoking only, no facility layer, used for AtsGenNetworking and AtsSecurity with other profile +#LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_any +# With facility layer +LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB + +# Indicate which RSU to simulate +ItsRSUsSimulator_Pixits.PX_RSU_ID := 1; +# Indicate which Use Case to simulate +# UC1 (DENM only): PX_ETSI_USE_CASE_ID := 1 +# UC2 (RHW) PX_ETSI_USE_CASE_ID := 2 +# 1: CauseCodeType_humanPresenceOnTheRoad_ +# 2: CauseCodeType_adverseWeatherCondition_ExtremeWeatherCondition_ +# 3: CauseCodeType_trafficCondition_ +# 4: CauseCodeType_stationaryVehicle_ +# UC3 (TLM MAPEM/SPATEM): PX_ETSI_USE_CASE_ID := 3 +# UC5 (IVIM only): PX_ETSI_USE_CASE_ID := 5 +# UC6 (CAM only): PX_ETSI_USE_CASE_ID := 6 +# UC7 (CAM only): PX_ETSI_USE_CASE_ID := 7 +# UC8 (EVCSN only): PX_ETSI_USE_CASE_ID := 8 +# UC9 (CAM only): PX_ETSI_USE_CASE_ID := 9 +ItsRSUsSimulator_Pixits.PX_ETSI_USE_CASE_ID := 6 + +# Indicate which zone to simulate +ItsRSUsSimulator_Pixits.PX_ETSI_ZONE_ID := 1 + +ItsRSUsSimulator_Pixits.PX_DENM_PARAM_UC2 := 1; # ==> RHW + +ItsRSUsSimulator_Pixits.PX_ACTIVATE_CAM_BEACON_DETECTOR := false +ItsRSUsSimulator_Pixits.PX_MBR_ALTER_SPEED_CLASS1 := true +#ItsRSUsSimulator_Pixits.PX_MBR_ALTER_POSITION_CLASS1 := false +ItsRSUsSimulator_Pixits.PX_MBR_ALTER_POSITION_DX := 3000.0; +ItsRSUsSimulator_Pixits.PX_MBR_ALTER_POSITION_DY := 3000.0; + +ItsRSUsSimulator_Pics.PICS_GENERATE_BEACON := false # Change also its_aid in geoNetworking port setting +ItsRSUsSimulator_Pics.PICS_GENERATE_CAM := true # Change also its_aid in geoNetworking port setting +ItsRSUsSimulator_Pics.PICS_GENERATE_DENM := false # Change also its_aid in geoNetworking port setting +ItsRSUsSimulator_Pics.PICS_GENERATE_IVIM := false # Change also its_aid in geoNetworking port setting + # Use CERT_IUT_IVI_SSP_TC_AT +ItsRSUsSimulator_Pics.PICS_GENERATE_MAPEM := false # Change also its_aid in geoNetworking port setting +ItsRSUsSimulator_Pics.PICS_GENERATE_SPATEM := false # Change also its_aid in geoNetworking port setting +ItsRSUsSimulator_Pics.PICS_GENERATE_SREM := false # Change also its_aid in geoNetworking port setting +ItsRSUsSimulator_Pics.PICS_GENERATE_SSEM := false # Change also its_aid in geoNetworking port setting +ItsRSUsSimulator_Pics.PICS_GENERATE_RTCMEM := false # Change also its_aid in geoNetworking port setting + +# Set to true if the ATS is acting as a RSU, false for an OBU +ItsRSUsSimulator_Pics.PICS_ITS_S_ROLE := true +# Set to false to test ITS-S enrollment +ItsRSUsSimulator_Pics.PICS_ITS_IS_ENROLLED := true +# Support PKI functionalities, including ITS-S enrollment support +ItsRSUsSimulator_Pics.PICS_PKI_SUPPORT := false + +ItsRSUsSimulator_Pics.PICS_MBR_SUPPORT := false + +ItsRSUsSimulator_Pics.PICS_MBR_MA_SUPPORT := false + +ItsRSUsSimulator_Pics.PICS_BEACON_FREQUENCY := 1.0 +ItsRSUsSimulator_Pics.PICS_CAM_FREQUENCY := 1.0 +ItsRSUsSimulator_Pics.PICS_DENM_FREQUENCY := 1.0 + +ItsRSUsSimulator_Pics.PICS_SEND_BEACON_INDICATION := false +ItsRSUsSimulator_Pics.PICS_SEND_CAM_INDICATION := true +ItsRSUsSimulator_Pics.PICS_SEND_DENM_INDICATION := true +ItsRSUsSimulator_Pics.PICS_SEND_IVIM_INDICATION := true +ItsRSUsSimulator_Pics.PICS_SEND_MAPEM_INDICATION := true +ItsRSUsSimulator_Pics.PICS_SEND_SPATEM_INDICATION := true +ItsRSUsSimulator_Pics.PICS_SEND_SREM_INDICATION := true +ItsRSUsSimulator_Pics.PICS_SEND_SSEM_INDICATION := true +ItsRSUsSimulator_Pics.PICS_SEND_RTCMEM_INDICATION := true + +LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_IUT_A_B_AT" # AtsRSUsSimulator is acting as an OBU/RSU +# Enable Security support: force to false +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/yann/dev/TS.ITS_r2/data/certificates" #"../data/certificates" +# Configuration sub-directory to access certificate stored in files +LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "iut" +# Enrolment procedure +LibItsSecurity_Pixits.PX_USE_BFK_MODE := false + +LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" +LibHttp_Pics.PICS_HEADER_HOST := "192.168.1.21" + +LibItsPki_Pics.PICS_HTTP_POST_URI := "/ea/enrolment" +LibItsPki_Pics.PICS_MULTIPLE_END_POINT := false # One server port with multiple URI +LibItsPki_Pics.PICS_HTTP_POST_URI_EC := "/ea/enrolment" +LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/aa/authorization" +LibItsPki_Pics.PICS_HTTP_POST_URI_ATV := "/ea/authval" +LibItsPki_Pics.PICS_HTTP_POST_URI_BFK_AUTH := "/butterflyAuthorization" +LibItsPki_Pics.PICS_HTTP_POST_URI_BFK_AT_DOWNLOAD := "/butterflyDownload" + +LibItsPki_Pics.PICS_ITS_S_SIGN_NITSP256_PRIVATE_KEY := 'FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34'O +LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3b577ee830047336ac5dac07036b798aaecae7273f'O +#LibItsPki_Pics.PICS_ITS_S_ENC_NITSP256_PRIVATE_KEY := 'EDEBEADCAA9514CD4B30256126FB7DF958B911C6EB58CCF702983C3DCD3DECBD'O; +#LibItsPki_Pics.PICS_ITS_S_ENC_NISTP256_PUBLIC_KEY := '023A4ADDCDD5EE66DAB2116B0C3AB47CCEDAE92CD9ACE98A84B10EB63A9DCA798C'O; +#LibItsPki_Pics.PICS_ITS_S_ENC_BRAINPOOLP256r1_PRIVATE_KEY := '9F155D40B6C920BA45D8027093C8ADADAF3AA6F9F71F0CC0F8279FF0146A8A48'O; +#LibItsPki_Pics.PICS_ITS_S_ENC_BRAINPOOLP256r1_PUBLIC_KEY := '038602F468BD334EA4D2BA416295E204D58BD1F42C85FB9BE57237C74544F6A69A'O; +#LibItsPki_Pics.PICS_ITS_S_SIGN_BRAINPOOLP256r1_PRIVATE_KEY := '6D585B716D06F75EC2B8A8ADEBFCE6ED35B0640C2AFBFF25FE48FC81A6732D4F'O; +#LibItsPki_Pics.PICS_ITS_S_SIGN_BRAINPOOLP256r1_PUBLIC_KEY := '02A92BA3B770B040B8D958D5BD2CC9B537212D6963F50EA3E4784FEFA5D0454C12'O; +#LibItsPki_Pics.PICS_ITS_S_ENC_BRAINPOOLP384r1_PRIVATE_KEY := '6B4B4392511B252C904801466F5DA0A7F28E038E6656800CBB0CDCB3D32F862CA4D59CBDC1A19E98E9191582AF1DB3D7'O; +#LibItsPki_Pics.PICS_ITS_S_SIGN_BRAINPOOLP384r1_PRIVATE_KEY := '3CD977195A579787C84D5900F4CB6341E0C3D2750B140C5380E6F03CE3FBA0022F7541DEABDCED4790D313ED8F56ACA8'O; +#LibItsPki_Pics.PICS_ITS_S_SIGN_BRAINPOOLP384r1_PUBLIC_KEY := '0243FF5C96984C2C3F5FD5C5F6551C90F5FAEE1E5E8301763E4AF1E9D627F3474E554B82EE98EC4B49808DFF61B35F8313'O; +LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3031'O +LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := "CERT_TS_A_EA" +LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" + +LibItsPki_Pics.PICS_IUT_EA_CERTIFICATE_ID := "CERT_TS_A_EA" +LibItsPki_Pics.PICS_IUT_AA_CERTIFICATE_ID := "CERT_TS_A_AA" + +#LibItsPki_Pixits.PX_INCLUDE_ENCRYPTION_KEYS := false # No encryption key in Authorization request +#LibItsPki_Pixits.PICS_PKI_AUTH_POP := true # Do not use Signed for PoP in Authorization requet + +# Re-enrollment keys +LibItsPki_Pics.PICS_SECPKI_REENROLMENT := true # Check in logs the pattern '==> EC ' to find the required information for re-enrolment + +[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). +LogFile := "../logs/AtsRSUsSimulator/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | TIMEROP +#ConsoleMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | TIMEROP +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +# CAM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# header_sub_type : sh (single hop) +# DENM Layer +# next_header : btpA|btpB (overwrite BTP.type) +# header_type : tsb|gbc +# BTP Layer +# type : btpA|btpB +# destination port: dst_port +# source port : src_port +# GN Layer +# its_aid : ITS AID as defined by ETSI TS 102 965 V1.2.1. Default: 141 +# ll_address : GeoNetworking address of the Test System +# latitude : Latitude of the Test System +# longitude : Longitude of the Test System +# beaconing : Set to 1 if the Test System shall start beaconing +# expiry : Beaconning timer expiry (ms) +# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU +# secured_mode : Set to 1 if message exchanges shall be signed +# encrypted_mode : Set to 1 if message exchanges shall be encrypted +# NOTE: For signed & encrypted message exchanges, both secured_mode and encrypted_mode shall be set to 1 +# certificate : Certificate identifier the Test Adapter shall use +# sec_db_path : Path to the certificates and keys storage location +# hash : Hash algorithm to be used when secured mode is set +# Authorized values are SHA-256 or SHA-384 +# Default: SHA-256 +# cypher : Cyphering algorithm to be used when secured mode is set +# Authorized values are NISTP-256 and BP-256 +# Default: NISTP-256 +# Ethernet layer +# mac_src :Source MAC address +# mac_bc :Broadcast address +# eth_type : Ethernet type +# Commsignia layer +# mac_src : Device MAC address, used to discard packets +# To indicate no filering, use the value 000000000000 +# mac_bc : Broadcast address +# eth_type : Ethernet type, used to discard packets +# target_host : Device address +# target_port : Device port +# source_port : Test System port +# interface_id: Interface id, used to discard packets +# tx_power : TX power (dB) +# UDP layer (IP/UDP based on Pcap) +# dst_ip : Destination IPv4 address (aa.bb.cc.dd) +# dst_port: Destination port +# src_ip : Source IPv4 address (aa.bb.cc.dd) +# src_port: Source port +# Pcap layer +# mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System +# filter : Pcap filter (compliant with tcpdump syntax) +# Online mode: +# nic: Local NIC +# If set, online mode is used +# Offline mode (nic is present but not set): +# file : File to read +# frame_offset: Frame offset, used to skip packets with frame number < frame_offset +# time_offset : Time offset, used to skip packets with time offset < time_offset +# save_mode : Set to 1 to save sent packet, 0 otherwise + +# Single GeoNetworking component port +# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf +# its_aid=36: CAM +# its_aid=37: DENM +# its_aid=137: SPAT +# its_aid=138: MAP +# its_aid=139: IVIM +# its_aid=140: SREM/SSEM +# its_aid=141: GeoMet +# its_aid=128: RTCMEM + +# Cygwin +# Ethernet +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates)/ETH(mac_src=f8cab8083918)/PCAP(mac_src=f8cab8083918,nic=38D7FE44-E194-41E0-97BA-526014F5D9CE,filter=and ether proto 0x8947)" +# WiFi +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates)/ETH(mac_src=f8cab8083918)/UDP(dst_ip=192.168.8.249,dst_port=12340,src_port=12341)" +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates)/ETH(mac_src=f8cab8083918)/PCAP(mac_src=f8cab8083918,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" +# Linux +# Ethernet +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates)/ETH(mac_src=f8cab8083918)/PCAP(mac_src=f8cab8083918,nic=enx00e07cc91967,filter=and ether proto 0x8947)" +# Wifi +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_B_AT,sec_db_path=../data/certificates/iut)/ETH(mac_src=f8cab8083918)/PCAP(mac_src=f8cab8083918,nic=wlo1,filter=and ether proto 0x8947)" +# Linux over OpenVPN +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,certificate=CERT_IUT_A_B_AT,sec_db_path=../data/certificates/certificates)/ETH(mac_src=0000e87eb1ff)/PCAP(mac_src=0000e87eb1ff,nic=tap0,filter=and ether proto 0x8947)" +# USB <-> ETH +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/iut)/ETH(mac_src=8c554ac1eee1)/PCAP(mac_src=8c554ac1eee1,nic=enx00e07cc91967,filter=and ether proto 0x8947)" +# Linux over UDP +system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/iut)/UDP(dst_ip=172.17.0.2,src_port=9091,dst_port=4041)" +# Commsignia +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=37,secured_mode=1,encrypted_mode=0,certificate=CERT_IUT_A_AT,peer_certificate=CERT_TS_A_AT,sec_db_path=../data/certificates/certificates)/COMMSIGNIA(xport_mode=LTE-V2X,mac_src=080027F44E7D,interface_id=2,target_host=192.168.0.54)/UDP(dst_ip=192.168.0.54,src_port=9091,dst_port=7946)" +# Qualcom/UDP +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,distanceA=25,distanceB=25,its_aid=37,secured_mode=1,encrypted_mode=0,certificate=CERT_MICROSEC_AT_01,peer_certificate=CERT_TS_A_AT,sec_db_path=../data/certificates/certificates)/QUALCOMM/UDP(dst_ip=10.200.1.113,src_port=9091,dst_port=4041)" +# PC5 + UU/Raw +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/iut)/LTE(mac_src=8c554ac1eee1,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.21,dst_port=4041,src_port=9091)" +# PC5 + Uu/MQTT +# Raw UDP +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/iut)/LTE(mac_src=8c554ac1eee1,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee1,mqtt_topics=obu,uu_transport=udp,dst_ip=192.168.1.21,dst_port=1883,src_port=1883)" +# MQTT over TCP +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/iut)/LTE(mac_src=8c554ac1eee1,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee1,mqtt_topics=obu,uu_transport=tcp,debug=1,server=127.0.0.1,port=1883)" + +system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=192.168.1.21)" + +system.httpPort_ma.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.21,local_port=18000)" + +# Config port based on UDP +#system.cfPort.params := "CF(ut=gn)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)" +system.cfPort.params := "CF(ut=cam)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)" +#system.cfPort.params := "CF(ut=denm)/UDP(src_port=12345,reuse_incoming_source_adddress=1)" +#system.cfPort.params := "CF(ut=ivim)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)" +#system.cfPort.params := "CF(ut=mapemspatem)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)" +#system.cfPort.params := "CF(ut=sremssem)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)" +#system.cfPort.params := "CF(ut=rtcmem)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)" +#system.cfPort.params := "CF(ut=pki)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)" +#system.cfPort.params := "CF(ut=mbr)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)" + +[EXECUTE] +# Simulate OBU/RSU, OBU Enrolment & Misbehaviour Reporting service +ItsRSUsSimulator_TestCases.TC_RSUSIMU_BV_01 + +# Generate inconsistent CAM message for Misbehaviour Reporting Service Interrop. Testing/Plugtest - See ETSI TS 103 918 +#ItsRSUsSimulator_TestCases.TC_MBRSIMU_BV_01 + +# Simulate Misbehaviour Reporting Authority. RefS5 interface - See ETSI TS 103 759 +#ItsRSUsSimulator_TestCases.TC_MBR_MA_SIMU_BV_01 + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12001 +NumHCs := 1 + diff --git a/etc/AtsSecurity/AtsSecurity_codha.cf_ b/etc/AtsSecurity/AtsSecurity_codha.cf_ index 6085012..7a87578 100644 --- a/etc/AtsSecurity/AtsSecurity_codha.cf_ +++ b/etc/AtsSecurity/AtsSecurity_codha.cf_ @@ -4,10 +4,10 @@ # The GeoNetworking address of the IUT. LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { - typeOfAddress := e_initial, # e_manual(1) e_initial (0) - stationType := e_unknown, - stationCountryCode := 0, #33, - mid := '020000000000'O + typeOfAddress := e_manual, # e_manual(1) e_initial (0) + stationType := e_passengerCar, + reserved := 0, #33, + mid := '04E548000001'O } #LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { # typeOfAddress := e_initial, @@ -20,20 +20,29 @@ LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB LibItsBtp_Pixits.PX_DESTINATION_PORT := 2001 LibItsBtp_Pixits.PX_DESTINATION_PORT_INFO := 2001 +#LibItsSecurity_Pics.PICS_SEC_NIST_P256 := false +#LibItsSecurity_Pics.PICS_SEC_BRAINPOOL_P256R1 := false; +#LibItsSecurity_Pics.PICS_SEC_BRAINPOOL_P384R1 := false; + # 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/certificates" # Configuration sub-directory to access certificate stored in files LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "certificates" +# The certficate the IUT should use (cf. UtInitialize) +LibItsSecurity_Pixits.PX_IUT_DEFAULT_CERTIFICATE := "CERT_IUT_A_B_AT" #"CERT_IUT_A_AT" +# The certficate the TS should use to generate an ITS message +LibItsSecurity_Pixits.PX_AT_CERTIFICATE := "CERT_TS_B_AT" # Possible values: CERT_TS_C_AT, CERT_TS_D_AT, or CERT_TS_E_AT -#ItsSecurity_Pics.PICS_CERTFICATES_VAR := 6; +#LibItsSecurity_Pics.PICS_SEC_SHA256 := false +#LibItsSecurity_Pics.PICS_SEC_SHA384 := true [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). -LogFile := "../logs/%e.%h-%r.%s" +LogFile := "../logs/AtsSecurity/%e.%h-%r.%s" FileMask := LOG_ALL | USER | DEBUG | MATCHING ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING #FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP @@ -56,8 +65,6 @@ LogEventTypes:= Yes # type : btpA|btpB # destination port: dst_port # source port : src_port -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU # GN Layer # ll_address : GeoNetworking address of the Test System # latitude : latitude of the Test System @@ -113,35 +120,57 @@ LogEventTypes:= Yes # https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf # its_aid=36: CAM # its_aid=37: DENM -# its_aid=39: VAM # its_aid=137: SPAT # its_aid=138: MAP # its_aid=139: IVIM # its_aid=140: SREM/SSEM # its_aid=141: GeoMet # its_aid=128: RTCMEM -# its_aid=639: CPS - -system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,its_aid=36)/ETH(mac_src=080027d5428a)/PCAP(mac_src=080027d5428a,nic=eth2,filter=and ether proto 0x8947)" -#system.utPort.params := "UT_GN/UDP(dst_ip=10.100.60.27)" -system.utPort.params := "UT_CAM/UDP(dst_ip=10.100.60.136)" -#system.utPort.params := "UT_DENM/UDP(dst_ip=10.100.60.136)" +# Cygwin +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,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=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,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=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,its_aid=36)/ETH(mac_src=8c554ac1eee0)/PCAP(mac_src=8c554ac1eee0,nic=wlp0s20f3,filter=and ether proto 0x8947)" +# Linux over OpenVPN +system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0)/ETH(mac_src=0000d0e6740f)/PCAP(mac_src=0000d0e6740f,nic=tap0,filter=and ether proto 0x8947)" +# Linux over UDP +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,its_aid=36)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.43,src_port=4041,dst_port=9091)" + +# The UpperTester is dependening of the security profile used: +# 1. For CAM security profile, use UT_CAM +# 2. For DENM security profile, use UT_DENM +# 3. For Other messages security profile, use UT_GN +system.utPort.params := "UT_CAM/UDP(dst_ip=10.8.0.48,dst_port=12345,reuse_incoming_source_adddress=1)" # Use with TC_SEC_ITSS_RCV_MSG_ and TC_SEC_ITSS_RCV_IMPLICIT_CERT_ test cases +#system.utPort.params := "UT_DENM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" +#system.utPort.params := "UT_GN/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" +#system.utPort.params := "UT_CAM/DEBUG" +#system.camUtPort.params := "UT_CAM/DEBUG" + +# For CAM and DENM security profiles, corresponding port shall be uncomment +system.camUtPort.params := "UT_CAM/UDP(dst_ip=10.8.0.48,dst_port=12345,reuse_incoming_source_adddress=1)" +#system.denmUtPort.params := "UT_DENM/UDP(dst_ip=10.8.0.48,dst_port=12345,reuse_incoming_source_adddress=1)" -system.camUtPort.params := "UT_CAM/UDP(dst_ip=10.100.60.136)" -#system.denmUtPort.params := "UT_DENM/UDP(dst_ip=10.100.60.27)" [EXECUTE] -#ItsSecurity_TestCases.TC_SEC_ITSS_SND_GENMSG_01_BV -#ItsSecurity_TestCases.TC_SEC_ITSS_SND_GENMSG_02_BV +# --------------------- IMPILICT CERT --------------------- +# TODO Add PICS to prevent unsupport IMP cert +# Check that IUT supports usage of implicit certificate for signing message +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BV -#Check that ITS-S sends a Ieee1609Dot2Data containing protocol version set to 3 -#ItsSecurity_TestCases.TC_SEC_ITSS_SND_MSG_01_BV +# Check that IUT accepts a valid secured CAM message signed with a known implicit certificate +#ItsSecurity_TestCases.TC_SEC_ITSS_RCV_IMPLICIT_CERT_01_BV + +# Check that IUT accepts a valid secured CAM message signed with an unknown implicit certificate +#ItsSecurity_TestCases.TC_SEC_ITSS_RCV_IMPLICIT_CERT_02_BV + +# Check that IUT discards a valid secured CAM message signed with implicit certificate containing signature +#ItsSecurity_TestCases.TC_SEC_ITSS_RCV_IMPLICIT_CERT_01_BO # ------------------------- CAM --------------------------- # Check that IUT sends the secured CAM using SignedData container. -#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_01_BV +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 @@ -156,7 +185,16 @@ system.camUtPort.params := "UT_CAM/UDP(dst_ip=10.100.60.136)" # 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 +# PICS_SEC_NIST_P256 +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_05_A_BV +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_05_AN_BV +# PICS_SEC_BRAINPOOL_P256R1 +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_05_B_BV +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_05_BN_BV +# PICS_SEC_BRAINPOOL_P384R1 +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_05_C_BV +#ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_05_CN_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. @@ -167,6 +205,7 @@ system.camUtPort.params := "UT_CAM/UDP(dst_ip=10.100.60.136)" #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. +# When there is a new ITS-S detected, the OBU send immediaty its signing certificate to anticipate any certificate distribution #ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_08_BV # Check that IUT restarts the certificate sending timer when the certificate has been sent. @@ -242,7 +281,7 @@ system.camUtPort.params := "UT_CAM/UDP(dst_ip=10.100.60.136)" #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 +#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. @@ -290,31 +329,22 @@ ItsSecurity_TestCases.TC_SEC_ITSS_SND_CAM_23_BV #ItsSecurity_TestCases.TC_SEC_ITSS_SND_GENMSG_07_BV #ItsSecurity_TestCases.TC_SEC_ITSS_SND_GENMSG_08_BV -#--------------------------------------- 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 +# Check that IUT acepts a secured message containing protocol version set to a value 3 +#ItsSecurity_TestCases.TC_SEC_ITSS_RCV_MSG_01_BV +# Check that IUT discards a secured message containing protocol version set to a value less than 3 +#ItsSecurity_TestCases.TC_SEC_ITSS_RCV_MSG_01_BO +# Check that IUT discards a secured message containing protocol version set to a value greather than 3 +#ItsSecurity_TestCases.TC_SEC_ITSS_RCV_MSG_02_BO +# Check that IUT accepts a valid secured CAM message signed with certificate +#ItsSecurity_TestCases.TC_SEC_ITSS_RCV_CAM_01_BV +# Check that IUT accepts a valid secured CAM message signed with digest +#ItsSecurity_TestCases.TC_SEC_ITSS_RCV_CAM_02_BV +# Check that IUT accepts a valid secured CAM message signed with compressed signature +#ItsSecurity_TestCases.TC_SEC_ITSS_RCV_CAM_03_BV +# Check that IUT accepts a valid secured CAM message signed with certificate containing region restriction +#ItsSecurity_TestCases.TC_SEC_ITSS_RCV_CAM_04_BV_XX +# Check that IUT accepts a valid secured CAM message signed using the brainpoolP256r1 algorithm +#ItsSecurity_TestCases.TC_SEC_ITSS_RCV_CAM_05_BV [MAIN_CONTROLLER] # The options herein control the behavior of MC. -- GitLab From d1529ac3efc022a0070f68c34f890cf8af20d12c Mon Sep 17 00:00:00 2001 From: garciay Date: Wed, 18 Sep 2024 14:38:36 +0200 Subject: [PATCH 160/178] Remove useless files --- etc/AtsRSUsSimulator/AtsRSUSimulator.cfg | 272 ----------------------- 1 file changed, 272 deletions(-) delete mode 100644 etc/AtsRSUsSimulator/AtsRSUSimulator.cfg diff --git a/etc/AtsRSUsSimulator/AtsRSUSimulator.cfg b/etc/AtsRSUsSimulator/AtsRSUSimulator.cfg deleted file mode 100644 index 8d189be..0000000 --- a/etc/AtsRSUsSimulator/AtsRSUSimulator.cfg +++ /dev/null @@ -1,272 +0,0 @@ - -[MODULE_PARAMETERS] -# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. -LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := { - typeOfAddress := e_manual, - stationType := e_unknown, - reserved := 0, - mid := '4C5E0C14D2EA'O #'4C5E0C14D2EA'O #'00000000000B'O -} - -# GeoNetwoking only, no facility layer, used for AtsGenNetworking and AtsSecurity with other profile -#LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_any -# With facility layer -LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB - -# Indicate which RSU to simulate -ItsRSUsSimulator_Pixits.PX_RSU_ID := 1; -# Indicate which Use Case to simulate -# UC1 (DENM only): PX_ETSI_USE_CASE_ID := 1 -# UC2 (RHW) PX_ETSI_USE_CASE_ID := 2 -# 1: CauseCodeType_humanPresenceOnTheRoad_ -# 2: CauseCodeType_adverseWeatherCondition_ExtremeWeatherCondition_ -# 3: CauseCodeType_trafficCondition_ -# 4: CauseCodeType_stationaryVehicle_ -# UC3 (TLM MAPEM/SPATEM): PX_ETSI_USE_CASE_ID := 3 -# UC5 (IVIM only): PX_ETSI_USE_CASE_ID := 5 -# UC6 (CAM only): PX_ETSI_USE_CASE_ID := 6 -# UC7 (CAM only): PX_ETSI_USE_CASE_ID := 7 -# UC8 (EVCSN only): PX_ETSI_USE_CASE_ID := 8 -# UC9 (CAM only): PX_ETSI_USE_CASE_ID := 9 -ItsRSUsSimulator_Pixits.PX_ETSI_USE_CASE_ID := 6 - -# Indicate which zone to simulate -ItsRSUsSimulator_Pixits.PX_ETSI_ZONE_ID := 1 - -ItsRSUsSimulator_Pixits.PX_DENM_PARAM_UC2 := 1; # ==> RHW - -ItsRSUsSimulator_Pixits.PX_ACTIVATE_CAM_BEACON_DETECTOR := false -ItsRSUsSimulator_Pixits.PX_MBR_ALTER_SPEED_CLASS1 := true -#ItsRSUsSimulator_Pixits.PX_MBR_ALTER_POSITION_CLASS1 := false -ItsRSUsSimulator_Pixits.PX_MBR_ALTER_POSITION_DX := 3000.0; -ItsRSUsSimulator_Pixits.PX_MBR_ALTER_POSITION_DY := 3000.0; - -ItsRSUsSimulator_Pics.PICS_GENERATE_BEACON := false # Change also its_aid in geoNetworking port setting -ItsRSUsSimulator_Pics.PICS_GENERATE_CAM := true # Change also its_aid in geoNetworking port setting -ItsRSUsSimulator_Pics.PICS_GENERATE_DENM := false # Change also its_aid in geoNetworking port setting -ItsRSUsSimulator_Pics.PICS_GENERATE_IVIM := false # Change also its_aid in geoNetworking port setting - # Use CERT_IUT_IVI_SSP_TC_AT -ItsRSUsSimulator_Pics.PICS_GENERATE_MAPEM := false # Change also its_aid in geoNetworking port setting -ItsRSUsSimulator_Pics.PICS_GENERATE_SPATEM := false # Change also its_aid in geoNetworking port setting -ItsRSUsSimulator_Pics.PICS_GENERATE_SREM := false # Change also its_aid in geoNetworking port setting -ItsRSUsSimulator_Pics.PICS_GENERATE_SSEM := false # Change also its_aid in geoNetworking port setting -ItsRSUsSimulator_Pics.PICS_GENERATE_RTCMEM := false # Change also its_aid in geoNetworking port setting - -# Set to true if the ATS is acting as a RSU, false for an OBU -ItsRSUsSimulator_Pics.PICS_ITS_S_ROLE := true -# Set to false to test ITS-S enrollment -ItsRSUsSimulator_Pics.PICS_ITS_IS_ENROLLED := true -# Support PKI functionalities, including ITS-S enrollment support -ItsRSUsSimulator_Pics.PICS_PKI_SUPPORT := false - -ItsRSUsSimulator_Pics.PICS_MBR_SUPPORT := false - -ItsRSUsSimulator_Pics.PICS_MBR_MA_SUPPORT := false - -ItsRSUsSimulator_Pics.PICS_BEACON_FREQUENCY := 1.0 -ItsRSUsSimulator_Pics.PICS_CAM_FREQUENCY := 1.0 -ItsRSUsSimulator_Pics.PICS_DENM_FREQUENCY := 1.0 - -ItsRSUsSimulator_Pics.PICS_SEND_BEACON_INDICATION := false -ItsRSUsSimulator_Pics.PICS_SEND_CAM_INDICATION := true -ItsRSUsSimulator_Pics.PICS_SEND_DENM_INDICATION := true -ItsRSUsSimulator_Pics.PICS_SEND_IVIM_INDICATION := true -ItsRSUsSimulator_Pics.PICS_SEND_MAPEM_INDICATION := true -ItsRSUsSimulator_Pics.PICS_SEND_SPATEM_INDICATION := true -ItsRSUsSimulator_Pics.PICS_SEND_SREM_INDICATION := true -ItsRSUsSimulator_Pics.PICS_SEND_SSEM_INDICATION := true -ItsRSUsSimulator_Pics.PICS_SEND_RTCMEM_INDICATION := true - -LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_IUT_A_B_AT" # AtsRSUsSimulator is acting as an OBU/RSU -# Enable Security support: force to false -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/yann/dev/TS.ITS_r2/data/certificates" #"../data/certificates" -# Configuration sub-directory to access certificate stored in files -LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "iut" -# Enrolment procedure -LibItsSecurity_Pixits.PX_USE_BFK_MODE := false - -LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" -LibHttp_Pics.PICS_HEADER_HOST := "192.168.1.21" - -LibItsPki_Pics.PICS_HTTP_POST_URI := "/ea/enrolment" -LibItsPki_Pics.PICS_MULTIPLE_END_POINT := false # One server port with multiple URI -LibItsPki_Pics.PICS_HTTP_POST_URI_EC := "/ea/enrolment" -LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/aa/authorization" -LibItsPki_Pics.PICS_HTTP_POST_URI_ATV := "/ea/authval" -LibItsPki_Pics.PICS_HTTP_POST_URI_BFK_AUTH := "/butterflyAuthorization" -LibItsPki_Pics.PICS_HTTP_POST_URI_BFK_AT_DOWNLOAD := "/butterflyDownload" - -LibItsPki_Pics.PICS_ITS_S_SIGN_NITSP256_PRIVATE_KEY := 'FE95786F01D7E1666CCDFAB7BAEE9BF9B30BBEA15A838A58994E65E684A8BB34'O -LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '038038f5490cd5a58ff5465d3b577ee830047336ac5dac07036b798aaecae7273f'O -#LibItsPki_Pics.PICS_ITS_S_ENC_NITSP256_PRIVATE_KEY := 'EDEBEADCAA9514CD4B30256126FB7DF958B911C6EB58CCF702983C3DCD3DECBD'O; -#LibItsPki_Pics.PICS_ITS_S_ENC_NISTP256_PUBLIC_KEY := '023A4ADDCDD5EE66DAB2116B0C3AB47CCEDAE92CD9ACE98A84B10EB63A9DCA798C'O; -#LibItsPki_Pics.PICS_ITS_S_ENC_BRAINPOOLP256r1_PRIVATE_KEY := '9F155D40B6C920BA45D8027093C8ADADAF3AA6F9F71F0CC0F8279FF0146A8A48'O; -#LibItsPki_Pics.PICS_ITS_S_ENC_BRAINPOOLP256r1_PUBLIC_KEY := '038602F468BD334EA4D2BA416295E204D58BD1F42C85FB9BE57237C74544F6A69A'O; -#LibItsPki_Pics.PICS_ITS_S_SIGN_BRAINPOOLP256r1_PRIVATE_KEY := '6D585B716D06F75EC2B8A8ADEBFCE6ED35B0640C2AFBFF25FE48FC81A6732D4F'O; -#LibItsPki_Pics.PICS_ITS_S_SIGN_BRAINPOOLP256r1_PUBLIC_KEY := '02A92BA3B770B040B8D958D5BD2CC9B537212D6963F50EA3E4784FEFA5D0454C12'O; -#LibItsPki_Pics.PICS_ITS_S_ENC_BRAINPOOLP384r1_PRIVATE_KEY := '6B4B4392511B252C904801466F5DA0A7F28E038E6656800CBB0CDCB3D32F862CA4D59CBDC1A19E98E9191582AF1DB3D7'O; -#LibItsPki_Pics.PICS_ITS_S_SIGN_BRAINPOOLP384r1_PRIVATE_KEY := '3CD977195A579787C84D5900F4CB6341E0C3D2750B140C5380E6F03CE3FBA0022F7541DEABDCED4790D313ED8F56ACA8'O; -#LibItsPki_Pics.PICS_ITS_S_SIGN_BRAINPOOLP384r1_PUBLIC_KEY := '0243FF5C96984C2C3F5FD5C5F6551C90F5FAEE1E5E8301763E4AF1E9D627F3474E554B82EE98EC4B49808DFF61B35F8313'O; -LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D5465737453797374656D2D3031'O -LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := "CERT_TS_A_EA" -LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" - -LibItsPki_Pics.PICS_IUT_EA_CERTIFICATE_ID := "CERT_TS_A_EA" -LibItsPki_Pics.PICS_IUT_AA_CERTIFICATE_ID := "CERT_TS_A_AA" - -#LibItsPki_Pixits.PX_INCLUDE_ENCRYPTION_KEYS := false # No encryption key in Authorization request -#LibItsPki_Pixits.PICS_PKI_AUTH_POP := true # Do not use Signed for PoP in Authorization requet - -# Re-enrollment keys -LibItsPki_Pics.PICS_SECPKI_REENROLMENT := true # Check in logs the pattern '==> EC ' to find the required information for re-enrolment - -[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). -LogFile := "../logs/AtsRSUsSimulator/%e.%h-%r.%s" -FileMask := LOG_ALL | USER | DEBUG | MATCHING -ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING -#FileMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | TIMEROP -#ConsoleMask := ERROR | WARNING | USER | PORTEVENT | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | TIMEROP -LogSourceInfo := Stack -LogEntityName:= Yes -LogEventTypes:= Yes -#TimeStampFormat := DateTime - -[TESTPORT_PARAMETERS] -# In this section you can specify parameters that are passed to Test Ports. -# CAM Layer -# next_header : btpA|btpB (overwrite BTP.type) -# header_type : tsb|gbc -# header_sub_type : sh (single hop) -# DENM Layer -# next_header : btpA|btpB (overwrite BTP.type) -# header_type : tsb|gbc -# BTP Layer -# type : btpA|btpB -# destination port: dst_port -# source port : src_port -# GN Layer -# its_aid : ITS AID as defined by ETSI TS 102 965 V1.2.1. Default: 141 -# ll_address : GeoNetworking address of the Test System -# latitude : Latitude of the Test System -# longitude : Longitude of the Test System -# beaconing : Set to 1 if the Test System shall start beaconing -# expiry : Beaconning timer expiry (ms) -# device_mode : Set to 1 if the layer shall encapsulate upper layer PDU -# secured_mode : Set to 1 if message exchanges shall be signed -# encrypted_mode : Set to 1 if message exchanges shall be encrypted -# NOTE: For signed & encrypted message exchanges, both secured_mode and encrypted_mode shall be set to 1 -# certificate : Certificate identifier the Test Adapter shall use -# sec_db_path : Path to the certificates and keys storage location -# hash : Hash algorithm to be used when secured mode is set -# Authorized values are SHA-256 or SHA-384 -# Default: SHA-256 -# cypher : Cyphering algorithm to be used when secured mode is set -# Authorized values are NISTP-256 and BP-256 -# Default: NISTP-256 -# Ethernet layer -# mac_src :Source MAC address -# mac_bc :Broadcast address -# eth_type : Ethernet type -# Commsignia layer -# mac_src : Device MAC address, used to discard packets -# To indicate no filering, use the value 000000000000 -# mac_bc : Broadcast address -# eth_type : Ethernet type, used to discard packets -# target_host : Device address -# target_port : Device port -# source_port : Test System port -# interface_id: Interface id, used to discard packets -# tx_power : TX power (dB) -# UDP layer (IP/UDP based on Pcap) -# dst_ip : Destination IPv4 address (aa.bb.cc.dd) -# dst_port: Destination port -# src_ip : Source IPv4 address (aa.bb.cc.dd) -# src_port: Source port -# Pcap layer -# mac_src : Source MAC address, used to exclude from capture the acket sent by the Test System -# filter : Pcap filter (compliant with tcpdump syntax) -# Online mode: -# nic: Local NIC -# If set, online mode is used -# Offline mode (nic is present but not set): -# file : File to read -# frame_offset: Frame offset, used to skip packets with frame number < frame_offset -# time_offset : Time offset, used to skip packets with time offset < time_offset -# save_mode : Set to 1 to save sent packet, 0 otherwise - -# Single GeoNetworking component port -# https://standards.iso.org/iso/ts/17419/TS17419%20Assigned%20Numbers/TS17419_ITS-AID_AssignedNumbers.pdf -# its_aid=36: CAM -# its_aid=37: DENM -# its_aid=137: SPAT -# its_aid=138: MAP -# its_aid=139: IVIM -# its_aid=140: SREM/SSEM -# its_aid=141: GeoMet -# its_aid=128: RTCMEM - -# Cygwin -# Ethernet -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates)/ETH(mac_src=f8cab8083918)/PCAP(mac_src=f8cab8083918,nic=38D7FE44-E194-41E0-97BA-526014F5D9CE,filter=and ether proto 0x8947)" -# WiFi -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates)/ETH(mac_src=f8cab8083918)/UDP(dst_ip=192.168.8.249,dst_port=12340,src_port=12341)" -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates)/ETH(mac_src=f8cab8083918)/PCAP(mac_src=f8cab8083918,nic=CEBB111F-D749-4B40-8B4D-DBB060E90987,filter=and ether proto 0x8947)" -# Linux -# Ethernet -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/certificates)/ETH(mac_src=f8cab8083918)/PCAP(mac_src=f8cab8083918,nic=enx00e07cc91967,filter=and ether proto 0x8947)" -# Wifi -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_B_AT,sec_db_path=../data/certificates/iut)/ETH(mac_src=f8cab8083918)/PCAP(mac_src=f8cab8083918,nic=wlo1,filter=and ether proto 0x8947)" -# Linux over OpenVPN -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=367470520,longitude=-45559502,distanceA=1500,distanceB=1500,angle=0,device_mode=1,secured_mode=1,certificate=CERT_IUT_A_B_AT,sec_db_path=../data/certificates/certificates)/ETH(mac_src=0000e87eb1ff)/PCAP(mac_src=0000e87eb1ff,nic=tap0,filter=and ether proto 0x8947)" -# USB <-> ETH -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/iut)/ETH(mac_src=8c554ac1eee1)/PCAP(mac_src=8c554ac1eee1,nic=enx00e07cc91967,filter=and ether proto 0x8947)" -# Linux over UDP -system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/iut)/UDP(dst_ip=172.17.0.2,src_port=9091,dst_port=4041)" -# Commsignia -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=37,secured_mode=1,encrypted_mode=0,certificate=CERT_IUT_A_AT,peer_certificate=CERT_TS_A_AT,sec_db_path=../data/certificates/certificates)/COMMSIGNIA(xport_mode=LTE-V2X,mac_src=080027F44E7D,interface_id=2,target_host=192.168.0.54)/UDP(dst_ip=192.168.0.54,src_port=9091,dst_port=7946)" -# Qualcom/UDP -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,distanceA=25,distanceB=25,its_aid=37,secured_mode=1,encrypted_mode=0,certificate=CERT_MICROSEC_AT_01,peer_certificate=CERT_TS_A_AT,sec_db_path=../data/certificates/certificates)/QUALCOMM/UDP(dst_ip=10.200.1.113,src_port=9091,dst_port=4041)" -# PC5 + UU/Raw -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/iut)/LTE(mac_src=8c554ac1eee1,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=raw,uu_transport=udp,dst_ip=192.168.1.21,dst_port=4041,src_port=9091)" -# PC5 + Uu/MQTT -# Raw UDP -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/iut)/LTE(mac_src=8c554ac1eee1,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee1,mqtt_topics=obu,uu_transport=udp,dst_ip=192.168.1.21,dst_port=1883,src_port=1883)" -# MQTT over TCP -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=367470520,longitude=-45559502,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=../data/certificates/iut)/LTE(mac_src=8c554ac1eee1,nic=wlo1,filter=and ether proto 0x8947,pc5_layer=QUALCOMM,uu_protocol=mqtt,mqtt_client_id=8c554ac1eee1,mqtt_topics=obu,uu_transport=tcp,debug=1,server=127.0.0.1,port=1883)" - -system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=192.168.1.21)" - -system.httpPort_ma.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.21,local_port=18000)" - -# Config port based on UDP -#system.cfPort.params := "CF(ut=gn)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)" -system.cfPort.params := "CF(ut=cam)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)" -#system.cfPort.params := "CF(ut=denm)/UDP(src_port=12345,reuse_incoming_source_adddress=1)" -#system.cfPort.params := "CF(ut=ivim)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)" -#system.cfPort.params := "CF(ut=mapemspatem)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)" -#system.cfPort.params := "CF(ut=sremssem)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)" -#system.cfPort.params := "CF(ut=rtcmem)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)" -#system.cfPort.params := "CF(ut=pki)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)" -#system.cfPort.params := "CF(ut=mbr)/UDP(src_port=12345,dst_port=12346,reuse_incoming_source_adddress=1)" - -[EXECUTE] -# Simulate OBU/RSU, OBU Enrolment & Misbehaviour Reporting service -ItsRSUsSimulator_TestCases.TC_RSUSIMU_BV_01 - -# Generate inconsistent CAM message for Misbehaviour Reporting Service Interrop. Testing/Plugtest - See ETSI TS 103 918 -#ItsRSUsSimulator_TestCases.TC_MBRSIMU_BV_01 - -# Simulate Misbehaviour Reporting Authority. RefS5 interface - See ETSI TS 103 759 -#ItsRSUsSimulator_TestCases.TC_MBR_MA_SIMU_BV_01 - -[MAIN_CONTROLLER] -# The options herein control the behavior of MC. -KillTimer := 10.0 -LocalAddress := 127.0.0.1 -TCPPort := 12001 -NumHCs := 1 - -- GitLab From 0d9dc9dbd9322daad5c2f6b3e0247c1237100c64 Mon Sep 17 00:00:00 2001 From: garciay Date: Fri, 15 Nov 2024 16:17:19 +0100 Subject: [PATCH 161/178] Report issues from devel2 to TTF_T036 --- TS.ITS_TTF_T036.code-workspace | 11 +- ccsrc/EncDec/LibItsCam_Encdec.cc | 53 ++- ccsrc/EncDec/LibItsDenm_Encdec.cc | 44 +- ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc | 12 +- ccsrc/EncDec/LibItsIvim_Encdec.cc | 44 +- ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc | 56 +-- ccsrc/EncDec/LibItsRtcmem_Encdec.cc | 44 +- ccsrc/EncDec/LibItsSremSsem_Encdec.cc | 12 +- ccsrc/Externals/LibItsSecurity_externals.cc | 26 +- .../CAM_ports/UpperTesterPort_CAM.cc | 9 + .../CAM_ports/UpperTesterPort_CAM.hh | 2 + .../ConfigRsuSimulatorLayer.cc | 378 ++++++++++-------- .../ConfigRsuSimulatorLayer.hh | 2 + .../ConfigRsuSimulatorPort.cc | 20 + .../ConfigRsuSimulatorPort.hh | 2 + ccsrc/Protocols/CAM_layers/cam_layer.cc | 4 +- .../GeoNetworking/decoding_context.cc | 16 +- .../GeoNetworking/decoding_context.hh | 24 +- .../GeoNetworking/encoding_context.cc | 12 +- .../GeoNetworking/geonetworking_layer.cc | 12 +- ccsrc/Protocols/LTE/lte_layer.cc | 2 +- ccsrc/Protocols/LTE/uu_amqp.hh | 2 +- ccsrc/Protocols/LTE/uu_mqtt.cc | 72 ++-- ccsrc/Protocols/LTE/uu_mqtt.hh | 2 +- .../UpperTester/UpperTesterRtcmemCodec.cc | 38 +- .../UpperTester/UpperTesterRtcmemCodec.hh | 18 +- .../UpperTester/UpperTesterSremSsemCodec.cc | 36 +- .../UpperTester/UpperTesterSremSsemCodec.hh | 20 +- ccsrc/Protocols/UpperTester/module.mk | 2 +- .../UpperTester/uppertester_cam_codec.cc | 116 +++--- .../UpperTester/uppertester_cam_codec.hh | 40 +- .../UpperTester/uppertester_cam_layer.cc | 16 + .../UpperTester/uppertester_cam_layer.hh | 2 + .../UpperTester/uppertester_cps_codec.cc | 22 +- .../UpperTester/uppertester_cps_codec.hh | 6 +- .../UpperTester/uppertester_denm_codec.cc | 78 ++-- .../UpperTester/uppertester_denm_codec.hh | 26 +- .../uppertester_geonetworking_codec.cc | 48 +-- .../uppertester_geonetworking_codec.hh | 24 +- .../uppertester_geonetworking_layer.cc | 4 +- .../UpperTester/uppertester_ivim_codec.cc | 56 +-- .../UpperTester/uppertester_ivim_codec.hh | 18 +- .../uppertester_mapem_spatem_codec.cc | 42 +- .../uppertester_mapem_spatem_codec.hh | 12 +- .../UpperTester/uppertester_mbr_codec.cc | 24 +- .../UpperTester/uppertester_mbr_codec.hh | 10 +- .../UpperTester/uppertester_pki_codec.cc | 26 +- .../UpperTester/uppertester_pki_codec.hh | 12 +- etc/AtsCAM/AtsCAM_Yogoko.cf_ | 2 +- etc/AtsCPS/AtsCPS_Simulator.cfg_ | 2 +- etc/AtsMBR/AtsMBR.cfg | 2 +- etc/AtsMBR/AtsMBR_Simu.cfg_ | 2 +- etc/AtsPki/AtsPki_Commsignia.cfg_ | 2 +- etc/AtsSecurity/AtsSecurity.cfg | 2 +- etc/AtsSecurity/AtsSecurity_codha.cf_ | 2 +- etc/AtsVRU/AtsVRU_Simulator.cfg_ | 2 +- titan-test-system-framework | 2 +- ttcn/AtsCAM | 2 +- ttcn/AtsDENM | 2 +- ttcn/AtsGeoNetworking | 2 +- ttcn/AtsPki | 2 +- ttcn/AtsSecurity | 2 +- 62 files changed, 862 insertions(+), 723 deletions(-) diff --git a/TS.ITS_TTF_T036.code-workspace b/TS.ITS_TTF_T036.code-workspace index 295f8ef..70038a4 100644 --- a/TS.ITS_TTF_T036.code-workspace +++ b/TS.ITS_TTF_T036.code-workspace @@ -17,6 +17,12 @@ }, { "path": "../itscertgen" + }, + { + "path": "../../tmp/titan_etsi_its_per_issue" + }, + { + "path": "../../tmp/titan_5gngap_per_issue" } ], "settings": { @@ -93,7 +99,10 @@ "stop_token": "cpp", "hash_map": "cpp", "mqtt.h": "c", - "gps.h": "c" + "gps.h": "c", + "unistd.h": "c", + "msggen_mec.h": "c", + "system.h": "c" }, "java.compile.nullAnalysis.mode": "automatic" } diff --git a/ccsrc/EncDec/LibItsCam_Encdec.cc b/ccsrc/EncDec/LibItsCam_Encdec.cc index 7b1bebc..ef1d490 100644 --- a/ccsrc/EncDec/LibItsCam_Encdec.cc +++ b/ccsrc/EncDec/LibItsCam_Encdec.cc @@ -71,14 +71,14 @@ namespace LibItsCam__EncdecDeclarations { LibItsCam__TypesAndValues::CamInd_its__aid_raw_.fieldlength) / 8; // Decode CA message - if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), cam) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), cam) == -1) { loggers::get_instance().warning("fx__dec__CamInd: -1 result code was returned"); return -1; } p_camInd.msgIn() = cam; // Decode lower layer data - TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); - loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); + TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnNextHeader_raw_.fieldlength / 8)) { p_camInd.gnNextHeader().set_to_omit(); @@ -87,8 +87,8 @@ namespace LibItsCam__EncdecDeclarations { os.decode(LibItsCam__TypesAndValues::CamInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnNextHeader() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__CamInd: gnNextHeader=", p_camInd.gnNextHeader()); - loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CAM: gnNextHeader=", p_camInd.gnNextHeader()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // gnHeaderType if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnHeaderType_raw_.fieldlength / 8)) { p_camInd.gnHeaderType().set_to_omit(); @@ -97,8 +97,8 @@ namespace LibItsCam__EncdecDeclarations { os.decode(LibItsCam__TypesAndValues::CamInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnHeaderType() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__CamInd: gnHeaderType=", p_camInd.gnHeaderType()); - loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CAM: gnHeaderType=", p_camInd.gnHeaderType()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // gnHeaderSubtype if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnHeaderSubtype_raw_.fieldlength / 8)) { p_camInd.gnHeaderSubtype().set_to_omit(); @@ -107,8 +107,8 @@ namespace LibItsCam__EncdecDeclarations { os.decode(LibItsCam__TypesAndValues::CamInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnHeaderSubtype() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__CamInd: gnHeaderSubtype=", p_camInd.gnHeaderSubtype()); - loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CAM: gnHeaderSubtype=", p_camInd.gnHeaderSubtype()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // gnLifetime if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnLifetime_raw_.fieldlength / 8)) { p_camInd.gnLifetime().set_to_omit(); @@ -117,8 +117,8 @@ namespace LibItsCam__EncdecDeclarations { i.decode(LibItsCam__TypesAndValues::CamInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnLifetime() = i; } - loggers::get_instance().log_msg("fx__dec__CamInd: gnLifetime=", p_camInd.gnLifetime()); - loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CAM: gnLifetime=", p_camInd.gnLifetime()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // gnTrafficClass if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_gnTrafficClass_raw_.fieldlength / 8)) { p_camInd.gnTrafficClass().set_to_omit(); @@ -127,8 +127,8 @@ namespace LibItsCam__EncdecDeclarations { os.decode(LibItsCam__TypesAndValues::CamInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.gnTrafficClass() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__CamInd: gnTrafficClass=", p_camInd.gnTrafficClass()); - loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CAM: gnTrafficClass=", p_camInd.gnTrafficClass()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // btpDestinationPort if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_btpDestinationPort_raw_.fieldlength / 8)) { p_camInd.btpDestinationPort().set_to_omit(); @@ -137,8 +137,8 @@ namespace LibItsCam__EncdecDeclarations { i.decode(LibItsCam__TypesAndValues::CamInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.btpDestinationPort() = i; } - loggers::get_instance().log_msg("fx__dec__CamInd: btpDestinationPort=", p_camInd.btpDestinationPort()); - loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CAM: btpDestinationPort=", p_camInd.btpDestinationPort()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // btpInfo if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_btpInfo_raw_.fieldlength / 8)) { p_camInd.btpInfo().set_to_omit(); @@ -147,8 +147,8 @@ namespace LibItsCam__EncdecDeclarations { i.decode(LibItsCam__TypesAndValues::CamInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.btpInfo() = i; } - loggers::get_instance().log_msg("fx__dec__CamInd: btpInfo=", p_camInd.btpInfo()); - loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CAM: btpInfo=", p_camInd.btpInfo()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // ssp if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_ssp_raw_.fieldlength / 8)) { p_camInd.ssp().set_to_omit(); @@ -157,8 +157,8 @@ namespace LibItsCam__EncdecDeclarations { bs.decode(LibItsCam__TypesAndValues::CamInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.ssp() = bs; } - loggers::get_instance().log_msg("fx__dec__CamInd: ssp=", p_camInd.ssp()); - loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CAM: ssp=", p_camInd.ssp()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); // its__aid if (decoding_buffer.get_read_len() < static_cast(LibItsCam__TypesAndValues::CamInd_its__aid_raw_.fieldlength / 8)) { p_camInd.its__aid().set_to_omit(); @@ -167,8 +167,8 @@ namespace LibItsCam__EncdecDeclarations { i.decode(LibItsCam__TypesAndValues::CamInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_camInd.its__aid() = i; } - loggers::get_instance().log_msg("fx__dec__CamInd: its_aid=", p_camInd.its__aid()); - loggers::get_instance().log_to_hexa("fx__dec__CamInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__CAM: its_aid=", p_camInd.its__aid()); + loggers::get_instance().log_to_hexa("fx__dec__CAM: ", decoding_buffer); return 0; } @@ -187,7 +187,7 @@ namespace LibItsCam__EncdecDeclarations { cam_codec codec; OCTETSTRING is = bit2oct(b); - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { loggers::get_instance().warning("fx__dec__CAM: -1 result code was returned"); return -1; } @@ -222,6 +222,15 @@ namespace LibItsCam__EncdecDeclarations { return oct2bit(os); } + BITSTRING fx__enc__UtCamChangePseudonym(const LibItsCam__TypesAndValues::UtCamChangePseudonym &p_utCamChangePseudonym) { + loggers::get_instance().log_msg(">>> fx__enc__UtCamChangePseudonym: ", p_utCamChangePseudonym); + + uppertester_cam_codec codec; + OCTETSTRING os; + codec.encode(p_utCamChangePseudonym, os); + return oct2bit(os); + } + /**************************************************** * @desc External function to decode a UtCamResults type * @param value to encode diff --git a/ccsrc/EncDec/LibItsDenm_Encdec.cc b/ccsrc/EncDec/LibItsDenm_Encdec.cc index 283da7f..65b4245 100644 --- a/ccsrc/EncDec/LibItsDenm_Encdec.cc +++ b/ccsrc/EncDec/LibItsDenm_Encdec.cc @@ -70,14 +70,14 @@ namespace LibItsDenm__EncdecDeclarations { LibItsDenm__TypesAndValues::DenmInd_its__aid_raw_.fieldlength) / 8; // Decode DEN message - if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), denm) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), denm) == -1) { loggers::get_instance().warning("fx__dec__DenmInd: -1 result code was returned"); return -1; } p_denmInd.msgIn() = denm; // Decode lower layer data - TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); - loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); + TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnNextHeader_raw_.fieldlength / 8)) { p_denmInd.gnNextHeader().set_to_omit(); @@ -86,8 +86,8 @@ namespace LibItsDenm__EncdecDeclarations { os.decode(LibItsDenm__TypesAndValues::DenmInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnNextHeader() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__DenmInd: gnNextHeader=", p_denmInd.gnNextHeader()); - loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DENM: gnNextHeader=", p_denmInd.gnNextHeader()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // gnHeaderType if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnHeaderType_raw_.fieldlength / 8)) { p_denmInd.gnHeaderType().set_to_omit(); @@ -96,8 +96,8 @@ namespace LibItsDenm__EncdecDeclarations { os.decode(LibItsDenm__TypesAndValues::DenmInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnHeaderType() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__DenmInd: gnHeaderType=", p_denmInd.gnHeaderType()); - loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DENM: gnHeaderType=", p_denmInd.gnHeaderType()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // gnHeaderSubtype if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnHeaderSubtype_raw_.fieldlength / 8)) { p_denmInd.gnHeaderSubtype().set_to_omit(); @@ -106,8 +106,8 @@ namespace LibItsDenm__EncdecDeclarations { os.decode(LibItsDenm__TypesAndValues::DenmInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnHeaderSubtype() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__DenmInd: gnHeaderSubType=", p_denmInd.gnHeaderSubtype()); - loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DENM: gnHeaderSubType=", p_denmInd.gnHeaderSubtype()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // gnLifetime if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnLifetime_raw_.fieldlength / 8)) { p_denmInd.gnLifetime().set_to_omit(); @@ -116,8 +116,8 @@ namespace LibItsDenm__EncdecDeclarations { os.decode(LibItsDenm__TypesAndValues::DenmInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnLifetime() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__DenmInd: gnLifetime=", p_denmInd.gnLifetime()); - loggers::get_instance().log_to_hexa("fx__dfx__dec__DenmIndec__DENM: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DENM: gnLifetime=", p_denmInd.gnLifetime()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // gnTrafficClass if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_gnTrafficClass_raw_.fieldlength / 8)) { p_denmInd.gnTrafficClass().set_to_omit(); @@ -126,8 +126,8 @@ namespace LibItsDenm__EncdecDeclarations { os.decode(LibItsDenm__TypesAndValues::DenmInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.gnTrafficClass() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__DenmInd: gnTrafficClass=", p_denmInd.gnTrafficClass()); - loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DENM: gnTrafficClass=", p_denmInd.gnTrafficClass()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // btpDestinationPort if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_btpDestinationPort_raw_.fieldlength / 8)) { p_denmInd.btpDestinationPort().set_to_omit(); @@ -136,8 +136,8 @@ namespace LibItsDenm__EncdecDeclarations { os.decode(LibItsDenm__TypesAndValues::DenmInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.btpDestinationPort() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__DenmInd: btpDestinationPort=", p_denmInd.btpDestinationPort()); - loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DENM: btpDestinationPort=", p_denmInd.btpDestinationPort()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // btpInfo if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_btpInfo_raw_.fieldlength / 8)) { p_denmInd.btpInfo().set_to_omit(); @@ -146,8 +146,8 @@ namespace LibItsDenm__EncdecDeclarations { os.decode(LibItsDenm__TypesAndValues::DenmInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.btpInfo() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__DenmInd: btpInfo=", p_denmInd.btpInfo()); - loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DENM: btpInfo=", p_denmInd.btpInfo()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // ssp if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_ssp_raw_.fieldlength / 8)) { p_denmInd.ssp().set_to_omit(); @@ -156,8 +156,8 @@ namespace LibItsDenm__EncdecDeclarations { bs.decode(LibItsDenm__TypesAndValues::DenmInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.ssp() = bs; } - loggers::get_instance().log_msg("fx__dec__DenmInd: ssp=", p_denmInd.ssp()); - loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DENM: ssp=", p_denmInd.ssp()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); // its__aid if (decoding_buffer.get_read_len() < static_cast(LibItsDenm__TypesAndValues::DenmInd_its__aid_raw_.fieldlength / 8)) { p_denmInd.its__aid().set_to_omit(); @@ -166,8 +166,8 @@ namespace LibItsDenm__EncdecDeclarations { os.decode(LibItsDenm__TypesAndValues::DenmInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_denmInd.its__aid() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__DenmInd: its_aid=", p_denmInd.its__aid()); - loggers::get_instance().log_to_hexa("fx__dec__DenmInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__DENM: its_aid=", p_denmInd.its__aid()); + loggers::get_instance().log_to_hexa("fx__dec__DENM: ", decoding_buffer); return 0; } @@ -186,7 +186,7 @@ namespace LibItsDenm__EncdecDeclarations { denm_codec codec; OCTETSTRING is = bit2oct(b); - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { loggers::get_instance().warning("fx__dec__DENM: -1 result code was returned"); return -1; } diff --git a/ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc b/ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc index cf1e5a1..d33e1a6 100644 --- a/ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc +++ b/ccsrc/EncDec/LibItsGeoNetworking_Encdec.cc @@ -71,13 +71,13 @@ namespace LibItsGeoNetworking__EncdecDeclarations { unsigned int s = (LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd_macDestinationAddress_raw_.fieldlength + LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd_its__aid_raw_.fieldlength) / 8; - if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), pdu) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), pdu) == -1) { loggers::get_instance().warning("fx__dec__GeoNetworkingReq: -1 result code was returned"); return -1; } p.msgOut() = pdu; - TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); - loggers::get_instance().log_to_hexa("fx__dec__GeoNetworkingReq: Lower layer: ", decoding_buffer); + TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); + loggers::get_instance().log_to_hexa("fx__dec__GeoNetworkingInd: Lower layer: ", decoding_buffer); for (int i = 1; i < p.get_count(); i++) { loggers::get_instance().log("fx__dec__GeoNetworkingReq: processing %s/%s/%s", p.fld_name(i), p.fld_descr(i)->name, p.get_at(i)->get_descriptor()->name); p.get_at(i)->decode(*p.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW); @@ -142,12 +142,12 @@ namespace LibItsGeoNetworking__EncdecDeclarations { (LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd_macDestinationAddress_raw_.fieldlength + LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd_ssp_raw_.fieldlength + LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd_its__aid_raw_.fieldlength) / 8; - if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), pdu) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), pdu) == -1) { loggers::get_instance().warning("fx__dec__GeoNetworkingInd: -1 result code was returned"); return -1; } p_geoNetworkingInd.msgIn() = pdu; - TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); + TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); loggers::get_instance().log_to_hexa("fx__dec__GeoNetworkingInd: Lower layer: ", decoding_buffer); for (int i = 1; i < p_geoNetworkingInd.get_count(); i++) { loggers::get_instance().log("fx__dec__GeoNetworkingInd: processing %s/%s/%s - %d - %d", p_geoNetworkingInd.fld_name(i), @@ -219,7 +219,7 @@ namespace LibItsGeoNetworking__EncdecDeclarations { geonetworking_codec codec; OCTETSTRING is = bit2oct(b); - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { loggers::get_instance().warning("fx__dec__GeoNetworkingPdu: -1 result code was returned"); return -1; } diff --git a/ccsrc/EncDec/LibItsIvim_Encdec.cc b/ccsrc/EncDec/LibItsIvim_Encdec.cc index 40c6a59..d6615b3 100644 --- a/ccsrc/EncDec/LibItsIvim_Encdec.cc +++ b/ccsrc/EncDec/LibItsIvim_Encdec.cc @@ -61,14 +61,14 @@ namespace LibItsIvim__EncdecDeclarations { LibItsIvim__TypesAndValues::IvimInd_its__aid_raw_.fieldlength) / 8; // Decode CA message - if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), ivim) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), ivim) == -1) { loggers::get_instance().warning("fx__dec__IvimInd: -1 result code was returned"); return -1; } p_ivimInd.msgIn() = ivim; // Decode lower layer data - TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); - loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); + TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); + loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_gnNextHeader_raw_.fieldlength / 8)) { p_ivimInd.gnNextHeader().set_to_omit(); @@ -77,8 +77,8 @@ namespace LibItsIvim__EncdecDeclarations { os.decode(LibItsIvim__TypesAndValues::IvimInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.gnNextHeader() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__IvimInd: gnNextHeader=", p_ivimInd.gnNextHeader()); - loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IVIM: gnNextHeader=", p_ivimInd.gnNextHeader()); + loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); // gnHeaderType if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_gnHeaderType_raw_.fieldlength / 8)) { p_ivimInd.gnHeaderType().set_to_omit(); @@ -87,8 +87,8 @@ namespace LibItsIvim__EncdecDeclarations { os.decode(LibItsIvim__TypesAndValues::IvimInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.gnHeaderType() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__IvimInd: gnHeaderType=", p_ivimInd.gnHeaderType()); - loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IVIM: gnHeaderType=", p_ivimInd.gnHeaderType()); + loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); // gnHeaderSubtype if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_gnHeaderSubtype_raw_.fieldlength / 8)) { p_ivimInd.gnHeaderSubtype().set_to_omit(); @@ -97,8 +97,8 @@ namespace LibItsIvim__EncdecDeclarations { os.decode(LibItsIvim__TypesAndValues::IvimInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.gnHeaderSubtype() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__IvimInd: gnHeaderSubtype=", p_ivimInd.gnHeaderSubtype()); - loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IVIM: gnHeaderSubtype=", p_ivimInd.gnHeaderSubtype()); + loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); // gnLifetime if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_gnLifetime_raw_.fieldlength / 8)) { p_ivimInd.gnLifetime().set_to_omit(); @@ -107,8 +107,8 @@ namespace LibItsIvim__EncdecDeclarations { i.decode(LibItsIvim__TypesAndValues::IvimInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.gnLifetime() = i; } - loggers::get_instance().log_msg("fx__dec__IvimInd: gnLifetime=", p_ivimInd.gnLifetime()); - loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IVIM: gnLifetime=", p_ivimInd.gnLifetime()); + loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); // gnTrafficClass if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_gnTrafficClass_raw_.fieldlength / 8)) { p_ivimInd.gnTrafficClass().set_to_omit(); @@ -117,8 +117,8 @@ namespace LibItsIvim__EncdecDeclarations { os.decode(LibItsIvim__TypesAndValues::IvimInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.gnTrafficClass() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__IvimInd: gnTrafficClass=", p_ivimInd.gnTrafficClass()); - loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IVIM: gnTrafficClass=", p_ivimInd.gnTrafficClass()); + loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); // btpDestinationPort if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_btpDestinationPort_raw_.fieldlength / 8)) { p_ivimInd.btpDestinationPort().set_to_omit(); @@ -127,8 +127,8 @@ namespace LibItsIvim__EncdecDeclarations { i.decode(LibItsIvim__TypesAndValues::IvimInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.btpDestinationPort() = i; } - loggers::get_instance().log_msg("fx__dec__IvimInd: btpDestinationPort=", p_ivimInd.btpDestinationPort()); - loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IVIM: btpDestinationPort=", p_ivimInd.btpDestinationPort()); + loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); // btpInfo if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_btpInfo_raw_.fieldlength / 8)) { p_ivimInd.btpInfo().set_to_omit(); @@ -137,8 +137,8 @@ namespace LibItsIvim__EncdecDeclarations { i.decode(LibItsIvim__TypesAndValues::IvimInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.btpInfo() = i; } - loggers::get_instance().log_msg("fx__dec__IvimInd: btpInfo=", p_ivimInd.btpInfo()); - loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IVIM: btpInfo=", p_ivimInd.btpInfo()); + loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); // ssp if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_ssp_raw_.fieldlength / 8)) { p_ivimInd.ssp().set_to_omit(); @@ -147,8 +147,8 @@ namespace LibItsIvim__EncdecDeclarations { bs.decode(LibItsIvim__TypesAndValues::IvimInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.ssp() = bs; } - loggers::get_instance().log_msg("fx__dec__IvimInd: ssp=", p_ivimInd.ssp()); - loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IVIM: ssp=", p_ivimInd.ssp()); + loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); // its__aid if (decoding_buffer.get_read_len() < static_cast(LibItsIvim__TypesAndValues::IvimInd_its__aid_raw_.fieldlength / 8)) { p_ivimInd.its__aid().set_to_omit(); @@ -157,8 +157,8 @@ namespace LibItsIvim__EncdecDeclarations { i.decode(LibItsIvim__TypesAndValues::IvimInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_ivimInd.its__aid() = i; } - loggers::get_instance().log_msg("fx__dec__IvimInd: its_aid=", p_ivimInd.its__aid()); - loggers::get_instance().log_to_hexa("fx__dec__IvimInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__IVIM: its_aid=", p_ivimInd.its__aid()); + loggers::get_instance().log_to_hexa("fx__dec__IVIM: ", decoding_buffer); return 0; } @@ -177,7 +177,7 @@ namespace LibItsIvim__EncdecDeclarations { ivim_codec codec; OCTETSTRING is = bit2oct(b); - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { loggers::get_instance().warning("fx__dec__IVIM: -1 result code was returned"); return -1; } diff --git a/ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc b/ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc index d8ab407..5be3cfa 100644 --- a/ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc +++ b/ccsrc/EncDec/LibItsMapemSpatem_Encdec.cc @@ -47,8 +47,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { return 0; } - INTEGER fx__dec__MapemIndInd(BITSTRING &b, LibItsMapemSpatem__TypesAndValues::MapemInd &p_mapemInd) { - loggers::get_instance().log(">>> fx__dec__MapemIndInd"); + INTEGER fx__dec__MapemInd(BITSTRING &b, LibItsMapemSpatem__TypesAndValues::MapemInd &p_mapemInd) { + loggers::get_instance().log(">>> fx__dec__MapemInd"); mapem_codec codec; MAPEM__PDU__Descriptions::MAPEM mapem; @@ -62,14 +62,14 @@ namespace LibItsMapemSpatem__EncdecDeclarations { LibItsMapemSpatem__TypesAndValues::MapemInd_ssp_raw_.fieldlength + LibItsMapemSpatem__TypesAndValues::MapemInd_its__aid_raw_.fieldlength) / 8; // Decode CA message - if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), mapem) == -1) { - loggers::get_instance().warning("fx__dec__MapemIndInd: -1 result code was returned"); + if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), mapem) == -1) { + loggers::get_instance().warning("fx__dec__MapemInd: -1 result code was returned"); return -1; } p_mapemInd.msgIn() = mapem; // Decode lower layer data - TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); - loggers::get_instance().log_to_hexa("fx__dec__MapemIndInd: ", decoding_buffer); + TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); + loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_gnNextHeader_raw_.fieldlength / 8)) { p_mapemInd.gnNextHeader().set_to_omit(); @@ -78,8 +78,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { os.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.gnNextHeader() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__MapemIndInd: gnNextHeader=", p_mapemInd.gnNextHeader()); - loggers::get_instance().log_to_hexa("fx__dec__MapemIndInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__MapemInd: gnNextHeader=", p_mapemInd.gnNextHeader()); + loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); // gnHeaderType if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_gnHeaderType_raw_.fieldlength / 8)) { p_mapemInd.gnHeaderType().set_to_omit(); @@ -88,8 +88,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { os.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.gnHeaderType() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__MapemInd: gnHeaderType=", p_mapemInd.gnHeaderType()); - loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__Mapem: gnHeaderType=", p_mapemInd.gnHeaderType()); + loggers::get_instance().log_to_hexa("fx__dec__Mapem: ", decoding_buffer); // gnHeaderSubtype if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_gnHeaderSubtype_raw_.fieldlength / 8)) { p_mapemInd.gnHeaderSubtype().set_to_omit(); @@ -98,8 +98,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { os.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.gnHeaderSubtype() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__MapemInd: gnHeaderSubtype=", p_mapemInd.gnHeaderSubtype()); - loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__Mapem: gnHeaderSubtype=", p_mapemInd.gnHeaderSubtype()); + loggers::get_instance().log_to_hexa("fx__dec__Mapem: ", decoding_buffer); // gnLifetime if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_gnLifetime_raw_.fieldlength / 8)) { p_mapemInd.gnLifetime().set_to_omit(); @@ -108,8 +108,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { i.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.gnLifetime() = i; } - loggers::get_instance().log_msg("fx__dec__MapemInd: gnLifetime=", p_mapemInd.gnLifetime()); - loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__Mapem: gnLifetime=", p_mapemInd.gnLifetime()); + loggers::get_instance().log_to_hexa("fx__dec__Mapem: ", decoding_buffer); // gnTrafficClass if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_gnTrafficClass_raw_.fieldlength / 8)) { p_mapemInd.gnTrafficClass().set_to_omit(); @@ -118,8 +118,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { os.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.gnTrafficClass() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__MapemInd: gnTrafficClass=", p_mapemInd.gnTrafficClass()); - loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__Mapem: gnTrafficClass=", p_mapemInd.gnTrafficClass()); + loggers::get_instance().log_to_hexa("fx__dec__Mapem: ", decoding_buffer); // btpDestinationPort if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_btpDestinationPort_raw_.fieldlength / 8)) { p_mapemInd.btpDestinationPort().set_to_omit(); @@ -128,8 +128,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { i.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.btpDestinationPort() = i; } - loggers::get_instance().log_msg("fx__dec__MapemInd: btpDestinationPort=", p_mapemInd.btpDestinationPort()); - loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__Mapem: btpDestinationPort=", p_mapemInd.btpDestinationPort()); + loggers::get_instance().log_to_hexa("fx__dec__Mapem: ", decoding_buffer); // btpInfo if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_btpInfo_raw_.fieldlength / 8)) { p_mapemInd.btpInfo().set_to_omit(); @@ -138,8 +138,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { i.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.btpInfo() = i; } - loggers::get_instance().log_msg("fx__dec__MapemInd: btpInfo=", p_mapemInd.btpInfo()); - loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__Mapem: btpInfo=", p_mapemInd.btpInfo()); + loggers::get_instance().log_to_hexa("fx__dec__Mapem: ", decoding_buffer); // ssp if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_ssp_raw_.fieldlength / 8)) { p_mapemInd.ssp().set_to_omit(); @@ -148,8 +148,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { bs.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.ssp() = bs; } - loggers::get_instance().log_msg("fx__dec__MapemInd: ssp=", p_mapemInd.ssp()); - loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__Mapem: ssp=", p_mapemInd.ssp()); + loggers::get_instance().log_to_hexa("fx__dec__Mapem: ", decoding_buffer); // its__aid if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::MapemInd_its__aid_raw_.fieldlength / 8)) { p_mapemInd.its__aid().set_to_omit(); @@ -158,8 +158,8 @@ namespace LibItsMapemSpatem__EncdecDeclarations { i.decode(LibItsMapemSpatem__TypesAndValues::MapemInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_mapemInd.its__aid() = i; } - loggers::get_instance().log_msg("fx__dec__MapemInd: its_aid=", p_mapemInd.its__aid()); - loggers::get_instance().log_to_hexa("fx__dec__MapemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__Mapem: its_aid=", p_mapemInd.its__aid()); + loggers::get_instance().log_to_hexa("fx__dec__Mapem: ", decoding_buffer); return 0; } @@ -178,7 +178,7 @@ namespace LibItsMapemSpatem__EncdecDeclarations { mapem_codec codec; OCTETSTRING is = bit2oct(b); - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { loggers::get_instance().warning("fx__dec__Mapem: -1 result code was returned"); return -1; } @@ -240,13 +240,13 @@ namespace LibItsMapemSpatem__EncdecDeclarations { LibItsMapemSpatem__TypesAndValues::SpatemInd_ssp_raw_.fieldlength + LibItsMapemSpatem__TypesAndValues::SpatemInd_its__aid_raw_.fieldlength) / 8; // Decode CA message - if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), spatem) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), spatem) == -1) { loggers::get_instance().warning("fx__dec__SpatemSpatemInd: -1 result code was returned"); return -1; } p_mapemInd.msgIn() = spatem; // Decode lower layer data - TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); + TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); loggers::get_instance().log_to_hexa("fx__dec__SpatemInd: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast(LibItsMapemSpatem__TypesAndValues::SpatemInd_gnNextHeader_raw_.fieldlength / 8)) { @@ -357,7 +357,7 @@ namespace LibItsMapemSpatem__EncdecDeclarations { spatem_codec codec; OCTETSTRING is = bit2oct(b); - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p_spatem) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p_spatem) == -1) { loggers::get_instance().warning("fx__dec__Spatem: -1 result code was returned"); return -1; } diff --git a/ccsrc/EncDec/LibItsRtcmem_Encdec.cc b/ccsrc/EncDec/LibItsRtcmem_Encdec.cc index d91c21e..e2e700c 100644 --- a/ccsrc/EncDec/LibItsRtcmem_Encdec.cc +++ b/ccsrc/EncDec/LibItsRtcmem_Encdec.cc @@ -61,14 +61,14 @@ namespace LibItsRtcmem__EncdecDeclarations { LibItsRtcmem__TypesAndValues::RtcmemInd_its__aid_raw_.fieldlength) / 8; // Decode CA message - if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), rtcmem) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), rtcmem) == -1) { loggers::get_instance().warning("fx__dec__RtcmemInd: -1 result code was returned"); return -1; } p_rtcmemInd.msgIn() = rtcmem; // Decode lower layer data - TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); - loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); + TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); + loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_gnNextHeader_raw_.fieldlength / 8)) { p_rtcmemInd.gnNextHeader().set_to_omit(); @@ -77,8 +77,8 @@ namespace LibItsRtcmem__EncdecDeclarations { os.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_gnNextHeader_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.gnNextHeader() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__RtcmemInd: gnNextHeader=", p_rtcmemInd.gnNextHeader()); - loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RTCMEM: gnNextHeader=", p_rtcmemInd.gnNextHeader()); + loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); // gnHeaderType if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_gnHeaderType_raw_.fieldlength / 8)) { p_rtcmemInd.gnHeaderType().set_to_omit(); @@ -87,8 +87,8 @@ namespace LibItsRtcmem__EncdecDeclarations { os.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_gnHeaderType_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.gnHeaderType() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__RtcmemInd: gnHeaderType=", p_rtcmemInd.gnHeaderType()); - loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RTCMEM: gnHeaderType=", p_rtcmemInd.gnHeaderType()); + loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); // gnHeaderSubtype if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_gnHeaderSubtype_raw_.fieldlength / 8)) { p_rtcmemInd.gnHeaderSubtype().set_to_omit(); @@ -97,8 +97,8 @@ namespace LibItsRtcmem__EncdecDeclarations { os.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_gnHeaderSubtype_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.gnHeaderSubtype() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__RtcmemInd: gnHeaderSubtype=", p_rtcmemInd.gnHeaderSubtype()); - loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RTCMEM: gnHeaderSubtype=", p_rtcmemInd.gnHeaderSubtype()); + loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); // gnLifetime if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_gnLifetime_raw_.fieldlength / 8)) { p_rtcmemInd.gnLifetime().set_to_omit(); @@ -107,8 +107,8 @@ namespace LibItsRtcmem__EncdecDeclarations { i.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_gnLifetime_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.gnLifetime() = i; } - loggers::get_instance().log_msg("fx__dec__RtcmemInd: gnLifetime=", p_rtcmemInd.gnLifetime()); - loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RTCMEM: gnLifetime=", p_rtcmemInd.gnLifetime()); + loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); // gnTrafficClass if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_gnTrafficClass_raw_.fieldlength / 8)) { p_rtcmemInd.gnTrafficClass().set_to_omit(); @@ -117,8 +117,8 @@ namespace LibItsRtcmem__EncdecDeclarations { os.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_gnTrafficClass_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.gnTrafficClass() = oct2int(os); } - loggers::get_instance().log_msg("fx__dec__RtcmemInd: gnTrafficClass=", p_rtcmemInd.gnTrafficClass()); - loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RTCMEM: gnTrafficClass=", p_rtcmemInd.gnTrafficClass()); + loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); // btpDestinationPort if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_btpDestinationPort_raw_.fieldlength / 8)) { p_rtcmemInd.btpDestinationPort().set_to_omit(); @@ -127,8 +127,8 @@ namespace LibItsRtcmem__EncdecDeclarations { i.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_btpDestinationPort_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.btpDestinationPort() = i; } - loggers::get_instance().log_msg("fx__dec__RtcmemInd: btpDestinationPort=", p_rtcmemInd.btpDestinationPort()); - loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RTCMEM: btpDestinationPort=", p_rtcmemInd.btpDestinationPort()); + loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); // btpInfo if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_btpInfo_raw_.fieldlength / 8)) { p_rtcmemInd.btpInfo().set_to_omit(); @@ -137,8 +137,8 @@ namespace LibItsRtcmem__EncdecDeclarations { i.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_btpInfo_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.btpInfo() = i; } - loggers::get_instance().log_msg("fx__dec__RtcmemInd: btpInfo=", p_rtcmemInd.btpInfo()); - loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RTCMEM: btpInfo=", p_rtcmemInd.btpInfo()); + loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); // ssp if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_ssp_raw_.fieldlength / 8)) { p_rtcmemInd.ssp().set_to_omit(); @@ -147,8 +147,8 @@ namespace LibItsRtcmem__EncdecDeclarations { bs.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_ssp_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.ssp() = bs; } - loggers::get_instance().log_msg("fx__dec__RtcmemInd: ssp=", p_rtcmemInd.ssp()); - loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RTCMEM: ssp=", p_rtcmemInd.ssp()); + loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); // its__aid if (decoding_buffer.get_read_len() < static_cast(LibItsRtcmem__TypesAndValues::RtcmemInd_its__aid_raw_.fieldlength / 8)) { p_rtcmemInd.its__aid().set_to_omit(); @@ -157,8 +157,8 @@ namespace LibItsRtcmem__EncdecDeclarations { i.decode(LibItsRtcmem__TypesAndValues::RtcmemInd_its__aid_descr_, decoding_buffer, TTCN_EncDec::CT_RAW); p_rtcmemInd.its__aid() = i; } - loggers::get_instance().log_msg("fx__dec__RtcmemInd: its_aid=", p_rtcmemInd.its__aid()); - loggers::get_instance().log_to_hexa("fx__dec__RtcmemInd: ", decoding_buffer); + loggers::get_instance().log_msg("fx__dec__RTCMEM: its_aid=", p_rtcmemInd.its__aid()); + loggers::get_instance().log_to_hexa("fx__dec__RTCMEM: ", decoding_buffer); return 0; } @@ -177,7 +177,7 @@ namespace LibItsRtcmem__EncdecDeclarations { RtcmemCodec codec; OCTETSTRING is = bit2oct(b); - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { loggers::get_instance().warning("fx__dec__RTCMEM: -1 result code was returned"); return -1; } diff --git a/ccsrc/EncDec/LibItsSremSsem_Encdec.cc b/ccsrc/EncDec/LibItsSremSsem_Encdec.cc index bfec6b0..831bb7f 100644 --- a/ccsrc/EncDec/LibItsSremSsem_Encdec.cc +++ b/ccsrc/EncDec/LibItsSremSsem_Encdec.cc @@ -85,13 +85,13 @@ namespace LibItsSremSsem__EncdecDeclarations { LibItsSremSsem__TypesAndValues::SremInd_its__aid_raw_.fieldlength) / 8; // Decode CA message - if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), srem) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), srem) == -1) { loggers::get_instance().warning("fx__dec__SremInd: -1 result code was returned"); return -1; } p_sremInd.msgIn() = srem; // Decode lower layer data - TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); + TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); loggers::get_instance().log_to_hexa("fx__dec__SremInd: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast(LibItsSremSsem__TypesAndValues::SremInd_gnNextHeader_raw_.fieldlength / 8)) { @@ -201,7 +201,7 @@ namespace LibItsSremSsem__EncdecDeclarations { SremCodec codec; OCTETSTRING is = bit2oct(b); - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p) == -1) { loggers::get_instance().warning("fx__dec__Srem: -1 result code was returned"); return -1; } @@ -286,13 +286,13 @@ namespace LibItsSremSsem__EncdecDeclarations { LibItsSremSsem__TypesAndValues::SremInd_its__aid_raw_.fieldlength) / 8; // Decode CA message - if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), ssem) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast(is)), ssem) == -1) { loggers::get_instance().warning("fx__dec__SsemSsemInd: -1 result code was returned"); return -1; } p_ssemInd.msgIn() = ssem; // Decode lower layer data - TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); + TTCN_Buffer decoding_buffer(OCTETSTRING(s, static_cast(is) + is.lengthof() - s)); loggers::get_instance().log_to_hexa("fx__dec__SsemInd: ", decoding_buffer); // gnNextHeader if (decoding_buffer.get_read_len() < static_cast(LibItsSremSsem__TypesAndValues::SremInd_gnNextHeader_raw_.fieldlength / 8)) { @@ -402,7 +402,7 @@ namespace LibItsSremSsem__EncdecDeclarations { SsemCodec codec; OCTETSTRING is = bit2oct(b); - if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p_ssem) == -1) { + if (codec.decode(OCTETSTRING(is.lengthof(), static_cast(is)), p_ssem) == -1) { loggers::get_instance().warning("fx__dec__Ssem: -1 result code was returned"); return -1; } diff --git a/ccsrc/Externals/LibItsSecurity_externals.cc b/ccsrc/Externals/LibItsSecurity_externals.cc index 71d8ae2..daff400 100644 --- a/ccsrc/Externals/LibItsSecurity_externals.cc +++ b/ccsrc/Externals/LibItsSecurity_externals.cc @@ -33,7 +33,7 @@ namespace LibItsSecurity__Functions { - static unsigned char sm3_empty_string[32] = { 0x1A,0xB2,0x1D,0x83,0x55,0xCF,0xA1,0x7F,0x8E,0x61,0x19,0x48,0x31,0xE8,0x1A,0x8F,0x22,0xBE,0xC8,0xC7,0x28,0xFE,0xFB,0x74,0x7E,0xD0,0x35,0xEB,0x50,0x82,0xAA,0x2B }; + static uint8_t sm3_empty_string[32] = { 0x1A,0xB2,0x1D,0x83,0x55,0xCF,0xA1,0x7F,0x8E,0x61,0x19,0x48,0x31,0xE8,0x1A,0x8F,0x22,0xBE,0xC8,0xC7,0x28,0xFE,0xFB,0x74,0x7E,0xD0,0x35,0xEB,0x50,0x82,0xAA,0x2B }; static std::unique_ptr g(new geospacial); @@ -916,10 +916,10 @@ namespace LibItsSecurity__Functions { security_ecc ec(ec_elliptic_curves::nist_p_256); // Extract the tag - OCTETSTRING tag(16, p__ct.lengthof() - 16 + static_cast(p__ct)); + OCTETSTRING tag(16, p__ct.lengthof() - 16 + static_cast(p__ct)); loggers::get_instance().log_msg("fx__decrypt__aes__128__ccm__test: tag: ", tag); // Remove the tag from the end of the encrypted message - OCTETSTRING ct(p__ct.lengthof() - 16, static_cast(p__ct)); + OCTETSTRING ct(p__ct.lengthof() - 16, static_cast(p__ct)); loggers::get_instance().log_msg("fx__decrypt__aes__128__ccm__test: ct: ", ct); OCTETSTRING message; @@ -1091,10 +1091,10 @@ namespace LibItsSecurity__Functions { // Decrypt the message OCTETSTRING enc_message(p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof(), - static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message + static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message loggers::get_instance().log_msg("fx__decryptWithEciesNistp256WithSha256: enc_message: ", enc_message); // Extract the ctag value OCTETSTRING tag(ec.tag().lengthof(), - static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); + static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); loggers::get_instance().log_msg("fx__decryptWithEciesNistp256WithSha256: tag: ", tag); OCTETSTRING message; if (ec.decrypt(tag, enc_message, message) == -1) { @@ -1134,10 +1134,10 @@ namespace LibItsSecurity__Functions { // Decrypt the message OCTETSTRING enc_message(p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof(), - static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message + static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message loggers::get_instance().log_msg("fx__decryptWithEciesNistp256WithSha256__1: enc_message: ", enc_message); // Extract the ctag value OCTETSTRING tag(ec.tag().lengthof(), - static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); + static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); loggers::get_instance().log_msg("fx__decryptWithEciesNistp256WithSha256__1: tag: ", tag); OCTETSTRING message; if (ec.decrypt(tag, enc_message, message) == -1) { @@ -1334,10 +1334,10 @@ namespace LibItsSecurity__Functions { // Decrypt the message OCTETSTRING enc_message(p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof(), - static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message + static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message loggers::get_instance().log_msg("fx__decryptWithEciesSm2p256WithSha256: enc_message: ", enc_message); // Extract the ctag value OCTETSTRING tag(ec.tag().lengthof(), - static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); + static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); loggers::get_instance().log_msg("fx__decryptWithEciesSm2p256WithSha256: tag: ", tag); OCTETSTRING message; if (ec.decrypt(tag, enc_message, message) == -1) { @@ -1509,10 +1509,10 @@ namespace LibItsSecurity__Functions { // Decrypt the message OCTETSTRING enc_message(p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof(), - static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message + static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message loggers::get_instance().log_msg("fx__decryptWithEciesBrainpoolp256r1WithSha256: enc_message: ", enc_message); // Extract the ctag value OCTETSTRING tag(ec.tag().lengthof(), - static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); + static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); loggers::get_instance().log_msg("fx__decryptWithEciesBrainpoolp256r1WithSha256: tag: ", tag); OCTETSTRING message; if (ec.decrypt(tag, enc_message, message) == -1) { @@ -1552,10 +1552,10 @@ namespace LibItsSecurity__Functions { // Decrypt the message OCTETSTRING enc_message(p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof(), - static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message + static_cast(p__encryptedSecuredMessage)); // Extract the encrypted message loggers::get_instance().log_msg("fx__decryptWithEciesBrainpoolp256r1WithSha256__1: enc_message: ", enc_message); // Extract the ctag value OCTETSTRING tag(ec.tag().lengthof(), - static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); + static_cast(p__encryptedSecuredMessage) + p__encryptedSecuredMessage.lengthof() - ec.tag().lengthof()); loggers::get_instance().log_msg("fx__decryptWithEciesBrainpoolp256r1WithSha256__1: tag: ", tag); OCTETSTRING message; if (ec.decrypt(tag, enc_message, message) == -1) { diff --git a/ccsrc/Ports/LibIts_ports/CAM_ports/UpperTesterPort_CAM.cc b/ccsrc/Ports/LibIts_ports/CAM_ports/UpperTesterPort_CAM.cc index 3b2b77a..1dccfba 100644 --- a/ccsrc/Ports/LibIts_ports/CAM_ports/UpperTesterPort_CAM.cc +++ b/ccsrc/Ports/LibIts_ports/CAM_ports/UpperTesterPort_CAM.cc @@ -80,6 +80,15 @@ namespace LibItsCam__TestSystem { loggers::get_instance().set_stop_time(_time_key, duration); } + void UpperTesterPort::outgoing_send(const LibItsCam__TypesAndValues::UtCamChangePseudonym &send_par) { + loggers::get_instance().log_msg(">>> UppertesterPort::outgoing_send: ", send_par); + + float duration; + loggers::get_instance().set_start_time(_time_key); + static_cast(_layer)->sendMsg(send_par, _layer_params); + loggers::get_instance().set_stop_time(_time_key, duration); + } + void UpperTesterPort::outgoing_send(const LibItsCam__TypesAndValues::UtCamTrigger &send_par) { loggers::get_instance().log_msg(">>> UppertesterPort_Cam::outgoing_send: ", send_par); diff --git a/ccsrc/Ports/LibIts_ports/CAM_ports/UpperTesterPort_CAM.hh b/ccsrc/Ports/LibIts_ports/CAM_ports/UpperTesterPort_CAM.hh index e8cd585..aaee0bc 100644 --- a/ccsrc/Ports/LibIts_ports/CAM_ports/UpperTesterPort_CAM.hh +++ b/ccsrc/Ports/LibIts_ports/CAM_ports/UpperTesterPort_CAM.hh @@ -40,6 +40,8 @@ namespace LibItsCam__TestSystem { void outgoing_send(const LibItsCam__TypesAndValues::UtCamChangePosition &send_par); + void outgoing_send(const LibItsCam__TypesAndValues::UtCamChangePseudonym &send_par); + void outgoing_send(const LibItsCam__TypesAndValues::UtCamTrigger &send_par); void outgoing_send(const LibItsCam__TypesAndValues::UtActivatePositionTime &send_par); diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc index 1a993ea..448e0b3 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc @@ -52,11 +52,11 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsGeoNetworking__TypesAndValues: TTCN_Buffer encoding_buffer; if (send_par.ischosen(LibItsGeoNetworking__TypesAndValues::UtGnResults::ALT_utGnInitializeResult)) { - encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnInitializeResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utGnInitializeResult())); + encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnInitializeResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utGnInitializeResult())); } else if (send_par.ischosen(LibItsGeoNetworking__TypesAndValues::UtGnResults::ALT_utGnTriggerResult)) { - encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnTriggerResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utGnTriggerResult())); + encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnTriggerResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utGnTriggerResult())); } else { loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtGnResults variant"); return; @@ -71,10 +71,10 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsGeoNetworking__TypesAndValues: loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); TTCN_Buffer encoding_buffer; - encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnEventIndication)); + encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnEventIndication)); OCTETSTRING l = int2oct(send_par.rawPayload().lengthof(), 2); - encoding_buffer.put_s(l.lengthof(), static_cast(l)); - encoding_buffer.put_s(send_par.rawPayload().lengthof(), static_cast(send_par.rawPayload())); + encoding_buffer.put_s(l.lengthof(), static_cast(l)); + encoding_buffer.put_s(send_par.rawPayload().lengthof(), static_cast(send_par.rawPayload())); OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); send_data(data, _params); } @@ -84,11 +84,14 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsCam__TypesAndValues::UtCamResu TTCN_Buffer encoding_buffer; if (send_par.ischosen(LibItsCam__TypesAndValues::UtCamResults::ALT_utCamInitializeResult)) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamInitializeResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utCamInitializeResult())); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamInitializeResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utCamInitializeResult())); + } else if (send_par.ischosen(LibItsCam__TypesAndValues::UtCamResults::ALT_utCamChangePseudonymResult)) { + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamChangePseudonymResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utCamChangePseudonymResult())); } else if (send_par.ischosen(LibItsCam__TypesAndValues::UtCamResults::ALT_utCamTriggerResult)) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamTriggerResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utCamTriggerResult())); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamTriggerResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utCamTriggerResult())); } else { loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtCamResults variant"); return; @@ -102,12 +105,12 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsCam__TypesAndValues::UtCamEven loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); TTCN_Buffer encoding_buffer; - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamEventInd)); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamEventInd)); BITSTRING bs = LibItsCam__EncdecDeclarations::fx__enc__CAM(send_par.camMsg()); OCTETSTRING os = bit2oct(bs); OCTETSTRING l = int2oct(os.lengthof(), 2); - encoding_buffer.put_s(l.lengthof(), static_cast(l)); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(l.lengthof(), static_cast(l)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); send_data(data, _params); } @@ -117,27 +120,30 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmRe TTCN_Buffer encoding_buffer; if (send_par.ischosen(LibItsDenm__TypesAndValues::UtDenmResults::ALT_utDenmInitializeResult)) { - encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmInitializeResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utDenmInitializeResult())); + encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmInitializeResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utDenmInitializeResult())); } else if (send_par.ischosen(LibItsDenm__TypesAndValues::UtDenmResults::ALT_utDenmTriggerResult)) { - encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmTriggerResult)); + encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmTriggerResult)); const LibItsDenm__TypesAndValues::UtDenmTriggerResult &r = send_par.utDenmTriggerResult(); - encoding_buffer.put_c((unsigned char)static_cast(r.result())); + encoding_buffer.put_c((uint8_t)static_cast(r.result())); OCTETSTRING os = int2oct(r.actionId().originatingStationId(), 4); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); os = int2oct(r.actionId().sequenceNumber(), 2); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); } else if (send_par.ischosen(LibItsDenm__TypesAndValues::UtDenmResults::ALT_utDenmUpdateResult)) { - encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmUpdateResult)); + encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmUpdateResult)); const LibItsDenm__TypesAndValues::UtDenmUpdateResult &r = send_par.utDenmUpdateResult(); - encoding_buffer.put_c((unsigned char)static_cast(r.result())); + encoding_buffer.put_c((uint8_t)static_cast(r.result())); OCTETSTRING os = int2oct(r.actionId().originatingStationId(), 4); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); os = int2oct(r.actionId().sequenceNumber(), 2); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); } else if (send_par.ischosen(LibItsDenm__TypesAndValues::UtDenmResults::ALT_utDenmTerminationResult)) { - encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmTerminationResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utDenmTerminationResult())); + encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmTerminationResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utDenmTerminationResult())); + } else if (send_par.ischosen(LibItsDenm__TypesAndValues::UtDenmResults::ALT_utDenmChangePseudonymResult)) { + encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmChangePseudonymResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utDenmChangePseudonymResult())); } else { loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtDenmResults variant"); return; @@ -151,12 +157,12 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsDenm__TypesAndValues::UtDenmEv loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); TTCN_Buffer encoding_buffer; - encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmEventIndication)); + encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmEventIndication)); BITSTRING bs = LibItsDenm__EncdecDeclarations::fx__enc__DENM(send_par.denMsg()); OCTETSTRING os = bit2oct(bs); OCTETSTRING l = int2oct(os.lengthof(), 2); - encoding_buffer.put_s(l.lengthof(), static_cast(l)); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(l.lengthof(), static_cast(l)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); send_data(data, _params); } @@ -166,11 +172,11 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsPki__TypesAndValues::UtPkiResu TTCN_Buffer encoding_buffer; if (send_par.ischosen(LibItsPki__TypesAndValues::UtPkiResults::ALT_utPkiInitializeResult)) { - encoding_buffer.put_c(static_cast(uppertester_pki_codec::c_utPkiInitializeResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utPkiInitializeResult())); + encoding_buffer.put_c(static_cast(uppertester_pki_codec::c_utPkiInitializeResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utPkiInitializeResult())); } else if (send_par.ischosen(LibItsPki__TypesAndValues::UtPkiResults::ALT_utPkiTriggerResult)) { - encoding_buffer.put_c(static_cast(uppertester_pki_codec::c_utPkiTriggerResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utPkiTriggerResult())); + encoding_buffer.put_c(static_cast(uppertester_pki_codec::c_utPkiTriggerResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utPkiTriggerResult())); } else { loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtPkiResults variant"); return; @@ -184,8 +190,8 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsPki__TypesAndValues::UtPkiTrig loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); TTCN_Buffer encoding_buffer; - encoding_buffer.put_c(static_cast(uppertester_pki_codec::c_utPkiTriggerInd)); - encoding_buffer.put_c(static_cast(send_par.state())); + encoding_buffer.put_c(static_cast(uppertester_pki_codec::c_utPkiTriggerInd)); + encoding_buffer.put_c(static_cast(send_par.state())); OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data()); send_data(os, params); @@ -196,11 +202,11 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsMbr__TypesAndValues::UtMbrResu TTCN_Buffer encoding_buffer; if (send_par.ischosen(LibItsMbr__TypesAndValues::UtMbrResults::ALT_utMbrInitializeResult)) { - encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrInitializeResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utMbrInitializeResult())); + encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrInitializeResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utMbrInitializeResult())); } else if (send_par.ischosen(LibItsMbr__TypesAndValues::UtMbrResults::ALT_utMbrTriggerResult)) { - encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrTriggerResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utMbrTriggerResult())); + encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrTriggerResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utMbrTriggerResult())); } else { loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtMbrResults variant"); return; @@ -214,7 +220,7 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsMbr__TypesAndValues::UtMbrEven loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); TTCN_Buffer encoding_buffer; - encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrEventInd)); + encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrEventInd)); loggers::get_instance().error("ConfigRsuSimulatorLayer::sendMsg: UtMbrEventInd no supported yet"); OCTETSTRING os(encoding_buffer.get_len(), encoding_buffer.get_data()); @@ -226,25 +232,25 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimRe TTCN_Buffer encoding_buffer; if (send_par.ischosen(LibItsIvim__TypesAndValues::UtIvimResults::ALT_utIvimInitializeResult)) { - encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimInitializeResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utIvimInitializeResult())); + encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimInitializeResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utIvimInitializeResult())); } else if (send_par.ischosen(LibItsIvim__TypesAndValues::UtIvimResults::ALT_utIvimTriggerResult)) { - encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimTriggerResult)); + encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimTriggerResult)); const LibItsIvim__TypesAndValues::UtIvimTriggerResult &r = dynamic_cast(send_par.utIvimTriggerResult()); - encoding_buffer.put_c((unsigned char)static_cast(r.result())); + encoding_buffer.put_c((uint8_t)static_cast(r.result())); OCTETSTRING os = int2oct(r.iviIdentificationNumber(), 2); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); } else if (send_par.ischosen(LibItsIvim__TypesAndValues::UtIvimResults::ALT_utIvimUpdateResult)) { - encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimUpdateResult)); + encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimUpdateResult)); const LibItsIvim__TypesAndValues::UtIvimUpdateResult &r = dynamic_cast(send_par.utIvimUpdateResult()); - encoding_buffer.put_c((unsigned char)static_cast(r.result())); + encoding_buffer.put_c((uint8_t)static_cast(r.result())); OCTETSTRING os = int2oct(r.iviIdentificationNumber(), 2); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); } else if (send_par.ischosen(LibItsIvim__TypesAndValues::UtIvimResults::ALT_utIvimTerminationResult)) { - encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimTerminationResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utIvimTerminationResult())); + encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimTerminationResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utIvimTerminationResult())); } else { loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtIvimResults variant"); return; @@ -258,12 +264,12 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsIvim__TypesAndValues::UtIvimEv loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); TTCN_Buffer encoding_buffer; - encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimEventIndication)); + encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimEventIndication)); BITSTRING bs = LibItsIvim__EncdecDeclarations::fx__enc__IVIM(send_par.iviMsg()); OCTETSTRING os = bit2oct(bs); OCTETSTRING l = int2oct(os.lengthof(), 2); - encoding_buffer.put_s(l.lengthof(), static_cast(l)); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(l.lengthof(), static_cast(l)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); send_data(data, _params); } @@ -273,11 +279,11 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsMapemSpatem__TypesAndValues::U TTCN_Buffer encoding_buffer; if (send_par.ischosen(LibItsMapemSpatem__TypesAndValues::UtMapemSpatemResults::ALT_utMapemSpatemInitializeResult)) { - encoding_buffer.put_c(static_cast(uppertester_mapem_spatem_codec::c_utMapemSpatemInitializeResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utMapemSpatemInitializeResult())); + encoding_buffer.put_c(static_cast(uppertester_mapem_spatem_codec::c_utMapemSpatemInitializeResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utMapemSpatemInitializeResult())); } else if (send_par.ischosen(LibItsMapemSpatem__TypesAndValues::UtMapemSpatemResults::ALT_utMapemSpatemTriggerResult)) { - encoding_buffer.put_c(static_cast(uppertester_mapem_spatem_codec::c_utMapemSpatemTriggerResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utMapemSpatemTriggerResult())); + encoding_buffer.put_c(static_cast(uppertester_mapem_spatem_codec::c_utMapemSpatemTriggerResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utMapemSpatemTriggerResult())); } else { loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtMapemSpatemResults variant"); return; @@ -291,12 +297,12 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsMapemSpatem__TypesAndValues::U loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); TTCN_Buffer encoding_buffer; - encoding_buffer.put_c(static_cast(uppertester_mapem_spatem_codec::c_utMapemEventIndication)); + encoding_buffer.put_c(static_cast(uppertester_mapem_spatem_codec::c_utMapemEventIndication)); BITSTRING bs = LibItsMapemSpatem__EncdecDeclarations::fx__enc__MAPEM(send_par.mapeMsg()); OCTETSTRING os = bit2oct(bs); OCTETSTRING l = int2oct(os.lengthof(), 2); - encoding_buffer.put_s(l.lengthof(), static_cast(l)); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(l.lengthof(), static_cast(l)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); send_data(data, _params); } @@ -305,12 +311,12 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsMapemSpatem__TypesAndValues::U loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); TTCN_Buffer encoding_buffer; - encoding_buffer.put_c(static_cast(uppertester_mapem_spatem_codec::c_utSpatemEventIndication)); + encoding_buffer.put_c(static_cast(uppertester_mapem_spatem_codec::c_utSpatemEventIndication)); BITSTRING bs = LibItsMapemSpatem__EncdecDeclarations::fx__enc__SPATEM(send_par.spateMsg()); OCTETSTRING os = bit2oct(bs); OCTETSTRING l = int2oct(os.lengthof(), 2); - encoding_buffer.put_s(l.lengthof(), static_cast(l)); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(l.lengthof(), static_cast(l)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); send_data(data, _params); } @@ -320,17 +326,17 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtSr TTCN_Buffer encoding_buffer; if (send_par.ischosen(LibItsSremSsem__TypesAndValues::UtSremResults::ALT_utSremInitializeResult)) { - encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremInitializeResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utSremInitializeResult())); + encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremInitializeResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utSremInitializeResult())); } else if (send_par.ischosen(LibItsSremSsem__TypesAndValues::UtSremResults::ALT_utSremTriggerResult)) { - encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremTriggerResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utSremTriggerResult())); + encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremTriggerResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utSremTriggerResult())); } else if (send_par.ischosen(LibItsSremSsem__TypesAndValues::UtSremResults::ALT_utSremUpdateResult)) { - encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremUpdateResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utSremUpdateResult())); + encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremUpdateResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utSremUpdateResult())); } else if (send_par.ischosen(LibItsSremSsem__TypesAndValues::UtSremResults::ALT_utSremCancelationResult)) { - encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremCancelationResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utSremCancelationResult())); + encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremCancelationResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utSremCancelationResult())); } else { loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtSremResults variant"); return; @@ -344,12 +350,12 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtSr loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); TTCN_Buffer encoding_buffer; - encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremEventIndication)); + encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremEventIndication)); BITSTRING bs = LibItsSremSsem__EncdecDeclarations::fx__enc__SREM(send_par.sreMsg()); OCTETSTRING os = bit2oct(bs); OCTETSTRING l = int2oct(os.lengthof(), 2); - encoding_buffer.put_s(l.lengthof(), static_cast(l)); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(l.lengthof(), static_cast(l)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); send_data(data, _params); } @@ -358,12 +364,12 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsSremSsem__TypesAndValues::UtSs loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); TTCN_Buffer encoding_buffer; - encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSsemEventIndication)); + encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSsemEventIndication)); BITSTRING bs = LibItsSremSsem__EncdecDeclarations::fx__enc__SSEM(send_par.sseMsg()); OCTETSTRING os = bit2oct(bs); OCTETSTRING l = int2oct(os.lengthof(), 2); - encoding_buffer.put_s(l.lengthof(), static_cast(l)); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(l.lengthof(), static_cast(l)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); send_data(data, _params); } @@ -373,17 +379,17 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcm TTCN_Buffer encoding_buffer; if (send_par.ischosen(LibItsRtcmem__TypesAndValues::UtRtcmemResults::ALT_utRtcmemInitializeResult)) { - encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemInitializeResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utRtcmemInitializeResult())); + encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemInitializeResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utRtcmemInitializeResult())); } else if (send_par.ischosen(LibItsRtcmem__TypesAndValues::UtRtcmemResults::ALT_utRtcmemTriggerResult)) { - encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemTriggerResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utRtcmemTriggerResult())); + encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemTriggerResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utRtcmemTriggerResult())); } else if (send_par.ischosen(LibItsRtcmem__TypesAndValues::UtRtcmemResults::ALT_utRtcmemUpdateResult)) { - encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemUpdateResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utRtcmemUpdateResult())); + encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemUpdateResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utRtcmemUpdateResult())); } else if (send_par.ischosen(LibItsRtcmem__TypesAndValues::UtRtcmemResults::ALT_utRtcmemTerminationResult)) { - encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemTerminationResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utRtcmemTerminationResult())); + encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemTerminationResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utRtcmemTerminationResult())); } else { loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtRtcmemResults variant"); return; @@ -397,12 +403,12 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsRtcmem__TypesAndValues::UtRtcm loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); TTCN_Buffer encoding_buffer; - encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemEventIndication)); + encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemEventIndication)); BITSTRING bs = LibItsRtcmem__EncdecDeclarations::fx__enc__RTCMEM(send_par.rtcmemMsg()); OCTETSTRING os = bit2oct(bs); OCTETSTRING l = int2oct(os.lengthof(), 2); - encoding_buffer.put_s(l.lengthof(), static_cast(l)); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(l.lengthof(), static_cast(l)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); send_data(data, _params); } @@ -412,8 +418,8 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsCps__TypesAndValues::UtCpmResu TTCN_Buffer encoding_buffer; if (send_par.ischosen(LibItsCps__TypesAndValues::UtCpmResults::ALT_utCpmInitializeResult)) { - encoding_buffer.put_c(static_cast(uppertester_cps_codec::c_utCpmInitializeResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utCpmInitializeResult())); + encoding_buffer.put_c(static_cast(uppertester_cps_codec::c_utCpmInitializeResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utCpmInitializeResult())); } else { loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtCpmResults variant"); return; @@ -427,12 +433,12 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsCps__TypesAndValues::UtCpmEven loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); TTCN_Buffer encoding_buffer; - encoding_buffer.put_c(static_cast(uppertester_cps_codec::c_utCpmEventInd)); + encoding_buffer.put_c(static_cast(uppertester_cps_codec::c_utCpmEventInd)); BITSTRING bs = LibItsCps__EncdecDeclarations::fx__enc__CPM(send_par.cpmMsg()); OCTETSTRING os = bit2oct(bs); OCTETSTRING l = int2oct(os.lengthof(), 2); - encoding_buffer.put_s(l.lengthof(), static_cast(l)); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(l.lengthof(), static_cast(l)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); send_data(data, _params); } @@ -442,8 +448,8 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsVru__TypesAndValues::UtVamResu TTCN_Buffer encoding_buffer; if (send_par.ischosen(LibItsVru__TypesAndValues::UtVamResults::ALT_utVamInitializeResult)) { - encoding_buffer.put_c(static_cast(uppertester_vru_codec::c_utVamInitializeResult)); - encoding_buffer.put_c((unsigned char)static_cast(send_par.utVamInitializeResult())); + encoding_buffer.put_c(static_cast(uppertester_vru_codec::c_utVamInitializeResult)); + encoding_buffer.put_c((uint8_t)static_cast(send_par.utVamInitializeResult())); } else { loggers::get_instance().warning("ConfigRsuSimulatorLayer::sendMsg: Unsupported UtVamResults variant"); return; @@ -457,12 +463,12 @@ void ConfigRsuSimulatorLayer::sendMsg(const LibItsVru__TypesAndValues::UtVamEven loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::sendMsg: ", send_par); TTCN_Buffer encoding_buffer; - encoding_buffer.put_c(static_cast(uppertester_vru_codec::c_utVamEventInd)); + encoding_buffer.put_c(static_cast(uppertester_vru_codec::c_utVamEventInd)); BITSTRING bs = LibItsVru__EncdecDeclarations::fx__enc__VAM(send_par.vamMsg()); OCTETSTRING os = bit2oct(bs); OCTETSTRING l = int2oct(os.lengthof(), 2); - encoding_buffer.put_s(l.lengthof(), static_cast(l)); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(l.lengthof(), static_cast(l)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); OCTETSTRING data(encoding_buffer.get_len(), encoding_buffer.get_data()); send_data(data, _params); } @@ -476,7 +482,7 @@ void ConfigRsuSimulatorLayer::send_data(OCTETSTRING &data, params ¶ms) { void ConfigRsuSimulatorLayer::receive_data(OCTETSTRING &data, params ¶ms) { // FIXME To be moved into ConfigRsuSimulatorCodec loggers::get_instance().log_msg(">>> ConfigRsuSimulatorLayer::receive_data: ", data); - unsigned char id = *(static_cast(data)); + uint8_t id = *(static_cast(data)); if (id == 0x00) { // Receive an UtxxInitialise process_utinitialize_data(data, params); } else if (id == uppertester_cam_codec::c_utCamChangeCurvature) { @@ -487,12 +493,16 @@ void ConfigRsuSimulatorLayer::receive_data(OCTETSTRING &data, params ¶ms) { process_ut_cam_changeheading_data(data, params); } else if (id == uppertester_cam_codec::c_utCamSetVehicleRole) { process_ut_cam_setvehiclerole_data(data, params); + } else if (id == uppertester_cam_codec::c_utCamChangePseudonym) { + process_ut_cam_changepseudonym(data, params); } else if (id == uppertester_denm_codec::c_utDenmTrigger) { process_ut_denm_trigger(data, params); } else if (id == uppertester_denm_codec::c_utDenmUpdate) { process_ut_denm_update(data, params); } else if (id == uppertester_denm_codec::c_utDenmTermination) { process_ut_denm_termination(data, params); + } else if (id == uppertester_denm_codec::c_utDenmChangePseudonym) { + process_ut_denm_changepseudonym(data, params); } else if (id == uppertester_mapem_spatem_codec::c_utMapemSpatemTrigger) { process_ut_mapem_spatem_trigger(data, params); } else if (id == uppertester_ivim_codec::c_utIvimTrigger) { @@ -536,47 +546,47 @@ int ConfigRsuSimulatorLayer::process_utinitialize_data(const OCTETSTRING &data, } if (_params[std::string("ut")].compare("gn") == 0) { - OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); + OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); LibItsGeoNetworking__TypesAndValues::UtGnInitialize p(hashedId); // Pass it to the ports if any to_all_upper_ports(p, params); } else if (_params[std::string("ut")].compare("cam") == 0) { - OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); + OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); LibItsCam__TypesAndValues::UtCamInitialize p(hashedId); // Pass it to the ports if any to_all_upper_ports(p, params); } else if (_params[std::string("ut")].compare("denm") == 0) { - OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); + OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); LibItsDenm__TypesAndValues::UtDenmInitialize p(hashedId); // Pass it to the ports if any to_all_upper_ports(p, params); } else if (_params[std::string("ut")].compare("pki") == 0) { - OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); + OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); LibItsPki__TypesAndValues::UtPkiInitialize p(hashedId); // Pass it to the ports if any to_all_upper_ports(p, params); } else if (_params[std::string("ut")].compare("ivim") == 0) { - OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); + OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); LibItsIvim__TypesAndValues::UtIvimInitialize p(hashedId); // Pass it to the ports if any to_all_upper_ports(p, params); } else if (_params[std::string("ut")].compare("mapemspatem") == 0) { - OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); + OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); LibItsMapemSpatem__TypesAndValues::UtMapemSpatemInitialize p(hashedId); // Pass it to the ports if any to_all_upper_ports(p, params); } else if (_params[std::string("ut")].compare("sremssem") == 0) { - OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); + OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); LibItsSremSsem__TypesAndValues::UtSremInitialize p(hashedId); // Pass it to the ports if any to_all_upper_ports(p, params); } else if (_params[std::string("ut")].compare("rtcmem") == 0) { - OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); + OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); LibItsRtcmem__TypesAndValues::UtRtcmemInitialize p(hashedId); // Pass it to the ports if any to_all_upper_ports(p, params); } else if (_params[std::string("ut")].compare("mbr") == 0) { - OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); + OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); LibItsMbr__TypesAndValues::UtMbrInitialize p(hashedId); // Pass it to the ports if any to_all_upper_ports(p, params); @@ -588,6 +598,28 @@ int ConfigRsuSimulatorLayer::process_utinitialize_data(const OCTETSTRING &data, return 0; } +int ConfigRsuSimulatorLayer::process_ut_cam_changepseudonym(const OCTETSTRING &data, params ¶ms) { + loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::process_ut_cam_changepseudonym"); + + params::const_iterator it = _params.find("ut"); + if (it == _params.cend()) { + loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_cam_changepseudonym: CF layer's ut parameter is missing"); + return -1; + } + + if (_params[std::string("ut")].compare("cam") == 0) { + OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); + LibItsCam__TypesAndValues::UtCamChangePseudonym p(hashedId); + // Pass it to the ports if any + to_all_upper_ports(p, params); + } else { + loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_cam_changepseudonym: Unsupported protocol"); + return -1; + } + + return 0; +} + int ConfigRsuSimulatorLayer::process_ut_cam_changespeed_data(const OCTETSTRING &data, params ¶ms) { loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::process_ut_cam_changespeed_data"); @@ -598,7 +630,7 @@ int ConfigRsuSimulatorLayer::process_ut_cam_changespeed_data(const OCTETSTRING & } if (_params[std::string("ut")].compare("cam") == 0) { - OCTETSTRING speed(data.lengthof() - 1, 1 + static_cast(data)); + OCTETSTRING speed(data.lengthof() - 1, 1 + static_cast(data)); LibItsCam__TypesAndValues::UtCamTrigger p; p.changeSpeed() = oct2int(speed); // Pass it to the ports if any @@ -621,7 +653,7 @@ int ConfigRsuSimulatorLayer::process_ut_cam_changecurvature_data(const OCTETSTRI } if (_params[std::string("ut")].compare("cam") == 0) { - OCTETSTRING curvature(data.lengthof() - 1, 1 + static_cast(data)); + OCTETSTRING curvature(data.lengthof() - 1, 1 + static_cast(data)); LibItsCam__TypesAndValues::UtCamTrigger p; p.changeCurvature() = oct2int(curvature); // Pass it to the ports if any @@ -644,7 +676,7 @@ int ConfigRsuSimulatorLayer::process_ut_cam_changeheading_data(const OCTETSTRING } if (_params[std::string("ut")].compare("cam") == 0) { - OCTETSTRING heading(data.lengthof() - 1, 1 + static_cast(data)); + OCTETSTRING heading(data.lengthof() - 1, 1 + static_cast(data)); LibItsCam__TypesAndValues::UtCamTrigger p; p.changeHeading() = oct2int(heading); // Pass it to the ports if any @@ -667,7 +699,7 @@ int ConfigRsuSimulatorLayer::process_ut_cam_setvehiclerole_data(const OCTETSTRIN } if (_params[std::string("ut")].compare("cam") == 0) { - OCTETSTRING vehicle_role(data.lengthof() - 1, 1 + static_cast(data)); + OCTETSTRING vehicle_role(data.lengthof() - 1, 1 + static_cast(data)); LibItsCam__TypesAndValues::UtCamTrigger p; p.setVehicleRole() = oct2int(vehicle_role); // Pass it to the ports if any @@ -690,10 +722,10 @@ int ConfigRsuSimulatorLayer::process_ut_denm_trigger(const OCTETSTRING &data, pa } if (_params[std::string("ut")].compare("denm") == 0) { - unsigned char *p = (unsigned char *)static_cast(data); - unsigned char msg_id = *p++; + uint8_t *p = (uint8_t *)static_cast(data); + uint8_t msg_id = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_denm_trigger: msg_id=%02x", msg_id); - unsigned char flag = *p++; + uint8_t flag = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_denm_trigger: flag=%02x", flag); LibItsDenm__TypesAndValues::UtDenmTrigger trigger; // See ETSI TR 103 099 Cause C.4.1 GenerateDenmEvent // Decode detectionTime @@ -769,10 +801,10 @@ int ConfigRsuSimulatorLayer::process_ut_denm_update(const OCTETSTRING &data, par } if (_params[std::string("ut")].compare("denm") == 0) { - unsigned char *p = (unsigned char *)static_cast(data); - unsigned char msg_id = *p++; + uint8_t *p = (uint8_t *)static_cast(data); + uint8_t msg_id = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_denm_update: msg_id=%02x", msg_id); - unsigned char flag = *p++; + uint8_t flag = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_denm_update: flag=%02x", flag); LibItsDenm__TypesAndValues::UtDenmUpdate update; // See ETSI TR 103 099 Cause C.4.1 GenerateDenmEvent // Statuion ID @@ -863,8 +895,8 @@ int ConfigRsuSimulatorLayer::process_ut_denm_termination(const OCTETSTRING &data } if (_params[std::string("ut")].compare("denm") == 0) { - unsigned char *p = (unsigned char *)static_cast(data); - unsigned char msg_id = *p++; + uint8_t *p = (uint8_t *)static_cast(data); + uint8_t msg_id = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_denm_termination: msg_id=%02x", msg_id); LibItsDenm__TypesAndValues::UtDenmTermination termination; termination.actionId().originatingStationId() = oct2int(OCTETSTRING(4, p)); @@ -881,6 +913,28 @@ int ConfigRsuSimulatorLayer::process_ut_denm_termination(const OCTETSTRING &data return 0; } +int ConfigRsuSimulatorLayer::process_ut_denm_changepseudonym(const OCTETSTRING &data, params ¶ms) { + loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::process_ut_denm_changepseudonym"); + + params::const_iterator it = _params.find("ut"); + if (it == _params.cend()) { + loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_denm_changepseudonym: CF layer's ut parameter is missing"); + return -1; + } + + if (_params[std::string("ut")].compare("denm") == 0) { + OCTETSTRING hashedId(data.lengthof() - 1, 1 + static_cast(data)); + LibItsDenm__TypesAndValues::UtDenmChangePseudonym p(hashedId); + // Pass it to the ports if any + to_all_upper_ports(p, params); + } else { + loggers::get_instance().warning("ConfigRsuSimulatorLayer::process_ut_denm_changepseudonym: Unsupported protocol"); + return -1; + } + + return 0; +} + int ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger(const OCTETSTRING &data, params ¶ms) { loggers::get_instance().log(">>> ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger"); @@ -891,9 +945,9 @@ int ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger(const OCTETSTRING } if (_params[std::string("ut")].compare("gn") == 0) { - unsigned char msg_id = *static_cast(data); + uint8_t msg_id = *static_cast(data); loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger: msg_id=%02x", msg_id); - OCTETSTRING payload(data.lengthof() - 1, 1 + static_cast(data)); + OCTETSTRING payload(data.lengthof() - 1, 1 + static_cast(data)); loggers::get_instance().log_msg("ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger: payload:", payload); TTCN_EncDec::clear_error(); TTCN_Buffer decoding_buffer(payload); @@ -903,7 +957,7 @@ int ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger(const OCTETSTRING LibItsGeoNetworking__TypesAndValues::GenerateGeoUnicastMessage g; g.decode(*g.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW); if (g.payload().lengthof() > 2) { - g.payload() = OCTETSTRING(g.payload().lengthof() - 2, static_cast(g.payload())); + g.payload() = OCTETSTRING(g.payload().lengthof() - 2, static_cast(g.payload())); } else { g.payload() = OCTETSTRING(0, nullptr); } @@ -912,7 +966,7 @@ int ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger(const OCTETSTRING LibItsGeoNetworking__TypesAndValues::GenerateGeoBroadcastMessage g; g.decode(*g.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW); if (g.payload().lengthof() > 2) { - g.payload() = OCTETSTRING(g.payload().lengthof() - 2, static_cast(g.payload())); + g.payload() = OCTETSTRING(g.payload().lengthof() - 2, static_cast(g.payload())); } else { g.payload() = OCTETSTRING(0, nullptr); } @@ -921,7 +975,7 @@ int ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger(const OCTETSTRING LibItsGeoNetworking__TypesAndValues::GenerateGeoAnycastMessage g; g.decode(*g.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW); if (g.payload().lengthof() > 2) { - g.payload() = OCTETSTRING(g.payload().lengthof() - 2, static_cast(g.payload())); + g.payload() = OCTETSTRING(g.payload().lengthof() - 2, static_cast(g.payload())); } else { g.payload() = OCTETSTRING(0, nullptr); } @@ -930,7 +984,7 @@ int ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger(const OCTETSTRING LibItsGeoNetworking__TypesAndValues::GenerateSHBMessage g; g.decode(*g.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW); if (g.payload().lengthof() > 2) { - g.payload() = OCTETSTRING(g.payload().lengthof() - 2, static_cast(g.payload())); + g.payload() = OCTETSTRING(g.payload().lengthof() - 2, static_cast(g.payload())); } else { g.payload() = OCTETSTRING(0, nullptr); } @@ -939,7 +993,7 @@ int ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger(const OCTETSTRING LibItsGeoNetworking__TypesAndValues::GenerateTSBMessage g; g.decode(*g.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW); if (g.payload().lengthof() > 2) { - g.payload() = OCTETSTRING(g.payload().lengthof() - 2, static_cast(g.payload())); + g.payload() = OCTETSTRING(g.payload().lengthof() - 2, static_cast(g.payload())); } else { g.payload() = OCTETSTRING(0, nullptr); } @@ -966,9 +1020,9 @@ int ConfigRsuSimulatorLayer::process_ut_pki_trigger(const OCTETSTRING &data, par } if (_params[std::string("ut")].compare("pki") == 0) { - unsigned char msg_id = *static_cast(data); + uint8_t msg_id = *static_cast(data); loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_mbr_trigger: msg_id=%02x", msg_id); - OCTETSTRING payload(data.lengthof() - 1, 1 + static_cast(data)); + OCTETSTRING payload(data.lengthof() - 1, 1 + static_cast(data)); loggers::get_instance().log_msg("ConfigRsuSimulatorLayer::process_ut_mbr_trigger: payload:", payload); TTCN_EncDec::clear_error(); TTCN_Buffer decoding_buffer(payload); @@ -1012,13 +1066,13 @@ int ConfigRsuSimulatorLayer::process_ut_mbr_trigger(const OCTETSTRING &data, par } if (_params[std::string("ut")].compare("mbr") == 0) { - unsigned char msg_id = *static_cast(data); + uint8_t msg_id = *static_cast(data); loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_mbr_trigger: msg_id=%02x", msg_id); LibItsMbr__TypesAndValues::UtMbrTrigger p; if (msg_id == uppertester_mbr_codec::c_utMbrTrigger) { - p.targetId() = oct2int(OCTETSTRING(1, 1 + static_cast(data))); - p.cause() = oct2int(OCTETSTRING(1, 2 + static_cast(data))); + p.targetId() = oct2int(OCTETSTRING(1, 1 + static_cast(data))); + p.cause() = oct2int(OCTETSTRING(1, 2 + static_cast(data))); } // Pass it to the ports if any @@ -1041,10 +1095,10 @@ int ConfigRsuSimulatorLayer::process_ut_mapem_spatem_trigger(const OCTETSTRING & } if (_params[std::string("ut")].compare("mapemspatem") == 0) { - unsigned char *p = (unsigned char *)static_cast(data); - unsigned char msg_id = *p++; + uint8_t *p = (uint8_t *)static_cast(data); + uint8_t msg_id = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_mapem_spatem_trigger: msg_id=%02x", msg_id); - unsigned char flag = *p++; + uint8_t flag = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_mapem_spatem_trigger: flag=%02x", flag); LibItsMapemSpatem__TypesAndValues::UtMapemSpatemTrigger trigger; // See ETSI TR 103 099 Cause C.4.1 GenerateMapemSpatemEvent // Decode Event @@ -1093,8 +1147,8 @@ int ConfigRsuSimulatorLayer::process_ut_ivim_trigger(const OCTETSTRING &data, pa } if (_params[std::string("ut")].compare("ivim") == 0) { - unsigned char *p = (unsigned char *)static_cast(data); - unsigned char msg_id = *p++; + uint8_t *p = (uint8_t *)static_cast(data); + uint8_t msg_id = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_ivim_trigger: msg_id=%02x", msg_id); unsigned short flag = static_cast((*p++) << 8 | (*p++)); loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_ivim_trigger: flag=%02x", flag); @@ -1213,10 +1267,10 @@ int ConfigRsuSimulatorLayer::process_ut_ivim_update(const OCTETSTRING &data, par } if (_params[std::string("ut")].compare("ivim") == 0) { - unsigned char *p = (unsigned char *)static_cast(data); - unsigned char msg_id = *p++; + uint8_t *p = (uint8_t *)static_cast(data); + uint8_t msg_id = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_ivim_update: msg_id=%02x", msg_id); - unsigned char flag = *p++; + uint8_t flag = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_ivim_update: flag=%02x", flag); LibItsIvim__TypesAndValues::UtIvimUpdate update; // See ETSI TR 103 099 Cause C.4.1 GenerateIvimEvent // IviIdentificationNumber @@ -1278,8 +1332,8 @@ int ConfigRsuSimulatorLayer::process_ut_ivim_termination(const OCTETSTRING &data } if (_params[std::string("ut")].compare("ivim") == 0) { - unsigned char *p = (unsigned char *)static_cast(data); - unsigned char msg_id = *p++; + uint8_t *p = (uint8_t *)static_cast(data); + uint8_t msg_id = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_ivim_termination: msg_id=%02x", msg_id); LibItsIvim__TypesAndValues::UtIvimTermination termination; termination.iviIdentificationNumber() = oct2int(OCTETSTRING(2, p)); @@ -1304,8 +1358,8 @@ int ConfigRsuSimulatorLayer::process_ut_srem_trigger(const OCTETSTRING &data, pa } if (_params[std::string("ut")].compare("sremssem") == 0) { - unsigned char *p = (unsigned char *)static_cast(data); - unsigned char msg_id = *p++; + uint8_t *p = (uint8_t *)static_cast(data); + uint8_t msg_id = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_geonetworking_trigger: msg_id=%02x", msg_id); LibItsSremSsem__TypesAndValues::UtSremTrigger trigger; // See ETSI TR 103 099 // BasicVehicleRole @@ -1335,8 +1389,8 @@ int ConfigRsuSimulatorLayer::process_ut_srem_update(const OCTETSTRING &data, par } if (_params[std::string("ut")].compare("sremssem") == 0) { - unsigned char *p = (unsigned char *)static_cast(data); - unsigned char msg_id = *p++; + uint8_t *p = (uint8_t *)static_cast(data); + uint8_t msg_id = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_geonetworking_update: msg_id=%02x", msg_id); LibItsSremSsem__TypesAndValues::UtSremUpdate update; // See ETSI TR 103 099 // RequestID @@ -1366,8 +1420,8 @@ int ConfigRsuSimulatorLayer::process_ut_srem_termination(const OCTETSTRING &data } if (_params[std::string("ut")].compare("sremssem") == 0) { - unsigned char *p = (unsigned char *)static_cast(data); - unsigned char msg_id = *p++; + uint8_t *p = (uint8_t *)static_cast(data); + uint8_t msg_id = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_geonetworking_termination: msg_id=%02x", msg_id); LibItsSremSsem__TypesAndValues::UtSremCancelation termination; // See ETSI TR 103 099 // RequestID @@ -1393,10 +1447,10 @@ int ConfigRsuSimulatorLayer::process_ut_rtcmem_trigger(const OCTETSTRING &data, } if (_params[std::string("ut")].compare("rtcmem") == 0) { - unsigned char *p = (unsigned char *)static_cast(data); - unsigned char msg_id = *p++; + uint8_t *p = (uint8_t *)static_cast(data); + uint8_t msg_id = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_rtcmem_trigger: msg_id=%02x", msg_id); - unsigned char flag = *p++; + uint8_t flag = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_rtcmem_trigger: flag=%02x", flag); LibItsRtcmem__TypesAndValues::UtRtcmemTrigger trigger; // See ETSI TR 103 099 Cause C.10.1 GenerateRtcmemEvent // Decode msgCnt @@ -1405,10 +1459,10 @@ int ConfigRsuSimulatorLayer::process_ut_rtcmem_trigger(const OCTETSTRING &data, trigger.rev() = ETSI__ITS__DSRC::RTCM__Revision(static_cast(*p++)); // Decode msgs ETSI__ITS__DSRC::RTCMmessageList msgs; - unsigned char num_items = *p++; // Number of items + uint8_t num_items = *p++; // Number of items msgs.set_size(num_items); - for (unsigned char i = 0; i < num_items; i++) { - unsigned char len = *p++; // Length of the message + for (uint8_t i = 0; i < num_items; i++) { + uint8_t len = *p++; // Length of the message msgs[i] = OCTETSTRING(len, p); p += len; } // End of 'for' statement @@ -1455,19 +1509,19 @@ int ConfigRsuSimulatorLayer::process_ut_rtcmem_update(const OCTETSTRING &data, p } if (_params[std::string("ut")].compare("rtcmem") == 0) { - unsigned char *p = (unsigned char *)static_cast(data); - unsigned char msg_id = *p++; + uint8_t *p = (uint8_t *)static_cast(data); + uint8_t msg_id = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_rtcmem_update: msg_id=%02x", msg_id); - unsigned char flag = *p++; + uint8_t flag = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_rtcmem_update: flag=%02x", flag); LibItsRtcmem__TypesAndValues::UtRtcmemUpdate update; // See ETSI TR 103 099 Cause C.10.2 GenerateRtcmemUpdate // Decode msgs ETSI__ITS__DSRC::RTCMmessageList msgs; p += 1; // Skip COER flag - unsigned char num_items = *p++; // Number of items + uint8_t num_items = *p++; // Number of items msgs.set_size(num_items); - for (unsigned char i = 0; i < num_items; i++) { - unsigned char len = *p++; // Length of the message + for (uint8_t i = 0; i < num_items; i++) { + uint8_t len = *p++; // Length of the message msgs[i] = OCTETSTRING(len, p); p += len; } // End of 'for' statement @@ -1512,8 +1566,8 @@ int ConfigRsuSimulatorLayer::process_ut_rtcmem_termination(const OCTETSTRING &da } if (_params[std::string("ut")].compare("rtcmem") == 0) { - unsigned char *p = (unsigned char *)static_cast(data); - unsigned char msg_id = *p++; + uint8_t *p = (uint8_t *)static_cast(data); + uint8_t msg_id = *p++; loggers::get_instance().log("ConfigRsuSimulatorLayer::process_ut_rtcmem_termination: msg_id=%02x", msg_id); LibItsRtcmem__TypesAndValues::UtRtcmemTermination termination; termination.msgCnt() = static_cast(*p); diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh index 2d9e2ae..c167496 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.hh @@ -78,9 +78,11 @@ private: int process_ut_cam_changecurvature_data(const OCTETSTRING &data, params ¶ms); int process_ut_cam_changeheading_data(const OCTETSTRING &data, params ¶ms); int process_ut_cam_setvehiclerole_data(const OCTETSTRING &data, params ¶ms); + int process_ut_cam_changepseudonym(const OCTETSTRING &data, params ¶ms); int process_ut_denm_trigger(const OCTETSTRING &data, params ¶ms); int process_ut_denm_update(const OCTETSTRING &data, params ¶ms); int process_ut_denm_termination(const OCTETSTRING &data, params ¶ms); + int process_ut_denm_changepseudonym(const OCTETSTRING &data, params ¶ms); int process_ut_geonetworking_trigger(const OCTETSTRING &data, params ¶ms); int process_ut_pki_trigger(const OCTETSTRING &data, params ¶ms); int process_ut_mbr_trigger(const OCTETSTRING &data, params ¶ms); diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.cc b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.cc index 82aeb1a..5ed9886 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.cc +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.cc @@ -341,6 +341,16 @@ namespace ItsRSUsSimulator__TestSystem { incoming_message(p_ind); } + void ConfigRsuSimulatorPort::receiveMsg(const LibItsCam__TypesAndValues::UtCamChangePseudonym &p_ind, const params &p_params) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind); + // Sanity check + if (!p_ind.is_bound()) { + return; + } + + incoming_message(p_ind); + } + void ConfigRsuSimulatorPort::receiveMsg(const LibItsCam__TypesAndValues::UtCamTrigger &p_ind, const params &p_params) { loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind); // Sanity check @@ -391,6 +401,16 @@ namespace ItsRSUsSimulator__TestSystem { incoming_message(p_ind); } + void ConfigRsuSimulatorPort::receiveMsg(const LibItsDenm__TypesAndValues::UtDenmChangePseudonym &p_ind, const params &p_params) { + loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind); + // Sanity check + if (!p_ind.is_bound()) { + return; + } + + incoming_message(p_ind); + } + void ConfigRsuSimulatorPort::receiveMsg(const LibItsPki__TypesAndValues::UtPkiInitialize &p_ind, const params &p_params) { loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind); // Sanity check diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.hh b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.hh index ff6ef83..a7495b2 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.hh +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorPort.hh @@ -22,11 +22,13 @@ namespace ItsRSUsSimulator__TestSystem { void receiveMsg(const LibItsGeoNetworking__TypesAndValues::UtGnInitialize &p_ind, const params &p_params); void receiveMsg(const LibItsGeoNetworking__TypesAndValues::UtGnTrigger &p_ind, const params &p_params); void receiveMsg(const LibItsCam__TypesAndValues::UtCamInitialize &p_ind, const params &p_params); + void receiveMsg(const LibItsCam__TypesAndValues::UtCamChangePseudonym &p_ind, const params &p_params); void receiveMsg(const LibItsCam__TypesAndValues::UtCamTrigger &p_ind, const params &p_params); void receiveMsg(const LibItsDenm__TypesAndValues::UtDenmInitialize &p_ind, const params &p_params); void receiveMsg(const LibItsDenm__TypesAndValues::UtDenmTrigger &p_ind, const params &p_params); void receiveMsg(const LibItsDenm__TypesAndValues::UtDenmUpdate &p_ind, const params &p_params); void receiveMsg(const LibItsDenm__TypesAndValues::UtDenmTermination &p_ind, const params &p_params); + void receiveMsg(const LibItsDenm__TypesAndValues::UtDenmChangePseudonym &p_ind, const params &p_params); void receiveMsg(const LibItsPki__TypesAndValues::UtPkiInitialize &p_ind, const params &p_params); void receiveMsg(const LibItsPki__TypesAndValues::UtPkiTrigger &p_ind, const params &p_params); void receiveMsg(const LibItsMbr__TypesAndValues::UtMbrInitialize &p_ind, const params &p_params); diff --git a/ccsrc/Protocols/CAM_layers/cam_layer.cc b/ccsrc/Protocols/CAM_layers/cam_layer.cc index b59466c..8a64a99 100644 --- a/ccsrc/Protocols/CAM_layers/cam_layer.cc +++ b/ccsrc/Protocols/CAM_layers/cam_layer.cc @@ -44,9 +44,9 @@ void cam_layer::receive_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log_msg(">>> cam_layer::receive_data: ", data); // Sanity check - if (*(static_cast(data) + 1) != 0x02) { // Check that received packet has CA message id - See ETSI TS 102 894 + if (*(static_cast(data) + 1) != 0x02) { // Check that received packet has CA message id - See ETSI TS 102 894 // Not a CAM message, discard it - loggers::get_instance().warning("cam_layer::receive_data: Wrong message id: 0x%02x", *(static_cast(data) + 1)); + loggers::get_instance().warning("cam_layer::receive_data: Wrong message id: 0x%02x", *(static_cast(data) + 1)); return; } diff --git a/ccsrc/Protocols/GeoNetworking/decoding_context.cc b/ccsrc/Protocols/GeoNetworking/decoding_context.cc index 12cf7c7..b804a0f 100644 --- a/ccsrc/Protocols/GeoNetworking/decoding_context.cc +++ b/ccsrc/Protocols/GeoNetworking/decoding_context.cc @@ -8,14 +8,14 @@ void decoding_context::reset() { _length = -1; } -unsigned char decoding_context::get_next_header() { return _next_header; }; -void decoding_context::set_next_header(const unsigned char p_next_header) { _next_header = p_next_header; }; -unsigned char decoding_context::get_header_type() { return _header_type; }; -void decoding_context::set_header_type(const unsigned char p_header_type) { _header_type = p_header_type; }; -unsigned char decoding_context::get_header_sub_type() { return _header_sub_type; }; -void decoding_context::set_header_sub_type(const unsigned char p_header_sub_type) { _header_sub_type = p_header_sub_type; }; -unsigned char decoding_context::get_traffic_class() { return _traffic_class; }; -void decoding_context::set_traffic_class(const unsigned char p_traffic_class) { _traffic_class = p_traffic_class; }; +uint8_t decoding_context::get_next_header() { return _next_header; }; +void decoding_context::set_next_header(const uint8_t p_next_header) { _next_header = p_next_header; }; +uint8_t decoding_context::get_header_type() { return _header_type; }; +void decoding_context::set_header_type(const uint8_t p_header_type) { _header_type = p_header_type; }; +uint8_t decoding_context::get_header_sub_type() { return _header_sub_type; }; +void decoding_context::set_header_sub_type(const uint8_t p_header_sub_type) { _header_sub_type = p_header_sub_type; }; +uint8_t decoding_context::get_traffic_class() { return _traffic_class; }; +void decoding_context::set_traffic_class(const uint8_t p_traffic_class) { _traffic_class = p_traffic_class; }; unsigned int decoding_context::get_lifetime() { return _lifetime; }; void decoding_context::set_lifetime(const unsigned int p_lifetime) { _lifetime = p_lifetime; }; unsigned int decoding_context::get_length() { return _length; }; diff --git a/ccsrc/Protocols/GeoNetworking/decoding_context.hh b/ccsrc/Protocols/GeoNetworking/decoding_context.hh index 93a0aed..4065109 100644 --- a/ccsrc/Protocols/GeoNetworking/decoding_context.hh +++ b/ccsrc/Protocols/GeoNetworking/decoding_context.hh @@ -3,10 +3,10 @@ #include class decoding_context { - unsigned char _next_header; - unsigned char _header_type; - unsigned char _header_sub_type; - unsigned char _traffic_class; + uint8_t _next_header; + uint8_t _header_type; + uint8_t _header_sub_type; + uint8_t _traffic_class; unsigned int _lifetime; unsigned int _length; @@ -16,14 +16,14 @@ public: void reset(); public: - unsigned char get_next_header(); - void set_next_header(const unsigned char p_next_header); - unsigned char get_header_type(); - void set_header_type(const unsigned char p_header_type); - unsigned char get_header_sub_type(); - void set_header_sub_type(const unsigned char p_header_sub_type); - unsigned char get_traffic_class(); - void set_traffic_class(const unsigned char p_traffic_class); + uint8_t get_next_header(); + void set_next_header(const uint8_t p_next_header); + uint8_t get_header_type(); + void set_header_type(const uint8_t p_header_type); + uint8_t get_header_sub_type(); + void set_header_sub_type(const uint8_t p_header_sub_type); + uint8_t get_traffic_class(); + void set_traffic_class(const uint8_t p_traffic_class); unsigned int get_lifetime(); void set_lifetime(const unsigned int p_lifetime); unsigned int get_length(); diff --git a/ccsrc/Protocols/GeoNetworking/encoding_context.cc b/ccsrc/Protocols/GeoNetworking/encoding_context.cc index 6745ad2..50d8785 100644 --- a/ccsrc/Protocols/GeoNetworking/encoding_context.cc +++ b/ccsrc/Protocols/GeoNetworking/encoding_context.cc @@ -9,12 +9,12 @@ void encoding_context::reset() { _length = -1; } -unsigned char encoding_context::get_basic_header() { return _basic_header; }; -void encoding_context::set_basic_header(const unsigned char p_basic_header) { _basic_header = p_basic_header; }; -unsigned char encoding_context::get_next_header() { return _next_header; }; -void encoding_context::set_next_header(const unsigned char p_next_header) { _next_header = p_next_header; }; -unsigned char encoding_context::get_header_type() { return _header_type; }; -void encoding_context::set_header_type(const unsigned char p_header_type) { _header_type = p_header_type; }; +uint8_t encoding_context::get_basic_header() { return _basic_header; }; +void encoding_context::set_basic_header(const uint8_t p_basic_header) { _basic_header = p_basic_header; }; +uint8_t encoding_context::get_next_header() { return _next_header; }; +void encoding_context::set_next_header(const uint8_t p_next_header) { _next_header = p_next_header; }; +uint8_t encoding_context::get_header_type() { return _header_type; }; +void encoding_context::set_header_type(const uint8_t p_header_type) { _header_type = p_header_type; }; unsigned int encoding_context::get_length_position() { return _length_position; }; void encoding_context::set_length_position(const unsigned int p_length_position) { _length_position = p_length_position; }; unsigned int encoding_context::get_length() { return _length; }; diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc index 7fde61a..46ee5f8 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc @@ -24,7 +24,7 @@ geonetworking_layer::geonetworking_layer(const std::string &p_type, const std::s _tsb_packet(nullptr), _uni_packet(nullptr), _ls_reply(nullptr), _location_table(), _pass_beacon_table(), _device_mode{false}, _secured_mode{false}, _beacon_secured_mode{false}, _encrypted_mode{false}, _enable_security_checks{false}, _sendData(), _timerid{0}, _sev{0}, _its{0}, _freq_nanosecs(0), _mask{0}, _sa{0}, _sequence_number{0}, _latitude{0}, _longitude{0}, _force_certificate{false}, - _leap_delay_us(4000/*Add 4 leap seconds to convert to TAI (as Feb 2019)*/) { + _leap_delay_us(5000000/*Add 5 leap seconds (to ITS time) to convert to TAI (as Sept. 2024)*/) { loggers::get_instance().log(">>> geonetworking_layer::geonetworking_layer: %s, %s", to_string().c_str(), p_param.c_str()); init(p_type, p_param); @@ -254,10 +254,10 @@ void geonetworking_layer::receive_data(OCTETSTRING &data, params &p_params) { loggers::get_instance().log("geonetworking_layer::receive_data: basic_header_len = %d", basic_header_len); // Verify and extract the GeoNetworking Secured Packet as specified in ETSI EN 302 636-4-1 V1.3.1 (2017-08) Clause 9.4 GeoNetworking Secured Packet OCTETSTRING unsecured_gn_payload; - OCTETSTRING secured_data = OCTETSTRING(data.lengthof() - basic_header_len, static_cast(data) + basic_header_len); + OCTETSTRING secured_data = OCTETSTRING(data.lengthof() - basic_header_len, static_cast(data) + basic_header_len); /////////////////// // FIXME Check what to do with this! - if (*static_cast(secured_data) != 0x03) { + if (*static_cast(secured_data) != 0x03) { loggers::get_instance().warning("geonetworking_layer::receive_data: Security error, wrong protocol number, discard it anyway"); if (_enable_security_checks) { return; @@ -274,7 +274,7 @@ void geonetworking_layer::receive_data(OCTETSTRING &data, params &p_params) { } // Update data loggers::get_instance().log_msg("geonetworking_layer::receive_data: Unsecured payload: ", unsecured_gn_payload); - data = OCTETSTRING(basic_header_len, static_cast(data)) + unsecured_gn_payload; + data = OCTETSTRING(basic_header_len, static_cast(data)) + unsecured_gn_payload; } // Decode the payload @@ -891,7 +891,7 @@ int geonetworking_layer::build_secured_pdu(OCTETSTRING &data, params_its ¶ms unsigned int basic_header_len = 4; // FIXME How to retrieve the BasicHeader length basic_header.get_descriptor()->raw->fieldlength / 8; loggers::get_instance().log("geonetworking_layer::build_secured_pdu: basic_header_len = %d", basic_header_len); basic_header.nextHeader() = BasicNextHeader::e__securedPacket; - OCTETSTRING unsecured_gn_payload = OCTETSTRING(data.lengthof() - basic_header_len, static_cast(data) + basic_header_len); + OCTETSTRING unsecured_gn_payload = OCTETSTRING(data.lengthof() - basic_header_len, static_cast(data) + basic_header_len); OCTETSTRING secured_gn_payload; if (security_services_its::get_instance().secure_gn_payload(unsecured_gn_payload, secured_gn_payload, params) != 0) { loggers::get_instance().warning("geonetworking_layer::build_secured_pdu: failed to build secured pdu"); @@ -919,7 +919,7 @@ int geonetworking_layer::decode_basic_header(const OCTETSTRING &p_data, LibItsGe // Update security mode OCTETSTRING bh = - OCTETSTRING(4, static_cast(p_data)); // Extract the basic header as specified in ETSI EN 302 636-4-1 V1.3.1 (2017-08) Clause 9.6 + OCTETSTRING(4, static_cast(p_data)); // Extract the basic header as specified in ETSI EN 302 636-4-1 V1.3.1 (2017-08) Clause 9.6 // loggers::get_instance().log_msg("geonetworking_layer::decode_basic_header: bh: ", bh); TTCN_Buffer decoding_buffer(bh); p_basic_header.RAW_decode(*p_basic_header.get_descriptor(), decoding_buffer, decoding_buffer.get_len() * 8, raw_order_t::ORDER_MSB); diff --git a/ccsrc/Protocols/LTE/lte_layer.cc b/ccsrc/Protocols/LTE/lte_layer.cc index 1508de8..fda713e 100644 --- a/ccsrc/Protocols/LTE/lte_layer.cc +++ b/ccsrc/Protocols/LTE/lte_layer.cc @@ -91,7 +91,7 @@ void lte_layer::send_data(OCTETSTRING &data, params ¶ms) { its_aid=138: MAP its_aid=139: IVIM its_aid=140: SREM/SSEM - its_aid=141: GeoMet + its_aid=141: GeoNet its_aid=128: RTCMEM */ loggers::get_instance().log("lte_layer::send_data: %s", it->second.c_str()); diff --git a/ccsrc/Protocols/LTE/uu_amqp.hh b/ccsrc/Protocols/LTE/uu_amqp.hh index d02eea8..903a903 100644 --- a/ccsrc/Protocols/LTE/uu_amqp.hh +++ b/ccsrc/Protocols/LTE/uu_amqp.hh @@ -4,7 +4,7 @@ #include "data_event_notifier.hh" -typedef enum AmqpState: unsigned char { +typedef enum AmqpState: uint8_t { amqp_idle, amqp_await_connect_ack, amqp_await_subscribe_ack, diff --git a/ccsrc/Protocols/LTE/uu_mqtt.cc b/ccsrc/Protocols/LTE/uu_mqtt.cc index 8bbd53a..0ae1efb 100644 --- a/ccsrc/Protocols/LTE/uu_mqtt.cc +++ b/ccsrc/Protocols/LTE/uu_mqtt.cc @@ -49,42 +49,44 @@ int uu_mqtt::setup(const params_its ¶ms) { if (it != params.cend()) { if (it->second.compare("obu") == 0) { // Subscribe to /3gpp/v2x/obu published messages // OBUs publishes to RSUs topics - _subscribed_topics.insert(std::pair("141", "/3gpp/v2x/obu/beacon")); - _subscribed_topics.insert(std::pair("36", "/3gpp/v2x/obu/cam")); - _subscribed_topics.insert(std::pair("37", "/3gpp/v2x/obu/denm")); - _subscribed_topics.insert(std::pair("139", "/3gpp/v2x/obu/ivim")); - _subscribed_topics.insert(std::pair("138", "/3gpp/v2x/obu/mapem")); - _subscribed_topics.insert(std::pair("137", "/3gpp/v2x/obu/spatem")); - _subscribed_topics.insert(std::pair("140", "/3gpp/v2x/obu/sxem")); - _subscribed_topics.insert(std::pair("128", "/3gpp/v2x/obu/rtcmem")); + _subscribed_topics.insert(std::pair("141", "3gpp/v2x/obu/beacon")); + _subscribed_topics.insert(std::pair("36", "3gpp/v2x/obu/cam")); + _subscribed_topics.insert(std::pair("37", "3gpp/v2x/obu/denm")); + _subscribed_topics.insert(std::pair("39", "3gpp/v2x/obu/vam")); + _subscribed_topics.insert(std::pair("139", "3gpp/v2x/obu/ivim")); + _subscribed_topics.insert(std::pair("138", "3gpp/v2x/obu/mapem")); + _subscribed_topics.insert(std::pair("137", "3gpp/v2x/obu/spatem")); + _subscribed_topics.insert(std::pair("140", "3gpp/v2x/obu/sxem")); + _subscribed_topics.insert(std::pair("128", "3gpp/v2x/obu/rtcmem")); // RSU publishes on OBUs topics - _topics.insert(std::pair("141", "/3gpp/v2x/rsu/beacon")); - _topics.insert(std::pair("36", "/3gpp/v2x/rsu/cam")); - _topics.insert(std::pair("37", "/3gpp/v2x/rsu/denm")); - _topics.insert(std::pair("139", "/3gpp/v2x/rsu/ivim")); - _topics.insert(std::pair("138", "/3gpp/v2x/rsu/mapem")); - _topics.insert(std::pair("137", "/3gpp/v2x/rsu/spatem")); - _topics.insert(std::pair("140", "/3gpp/v2x/rsu/sxem")); - _topics.insert(std::pair("128", "/3gpp/v2x/rsu/rtcmem")); + _topics.insert(std::pair("141", "3gpp/v2x/rsu/beacon")); + _topics.insert(std::pair("36", "3gpp/v2x/rsu/cam")); + _topics.insert(std::pair("37", "3gpp/v2x/rsu/denm")); + _topics.insert(std::pair("39", "3gpp/v2x/rsu/vam")); + _topics.insert(std::pair("139", "3gpp/v2x/rsu/ivim")); + _topics.insert(std::pair("138", "3gpp/v2x/rsu/mapem")); + _topics.insert(std::pair("137", "3gpp/v2x/rsu/spatem")); + _topics.insert(std::pair("140", "3gpp/v2x/rsu/sxem")); + _topics.insert(std::pair("128", "3gpp/v2x/rsu/rtcmem")); } else { // Subscribe to /3gpp/v2x/rsu published messages // OBU subscribes to RSUs topics - _subscribed_topics.insert(std::pair("141", "/3gpp/v2x/rsu/beacon")); - _subscribed_topics.insert(std::pair("36", "/3gpp/v2x/rsu/cam")); - _subscribed_topics.insert(std::pair("37", "/3gpp/v2x/rsu/denm")); - _subscribed_topics.insert(std::pair("139", "/3gpp/v2x/rsu/ivim")); - _subscribed_topics.insert(std::pair("138", "/3gpp/v2x/rsu/mapem")); - _subscribed_topics.insert(std::pair("137", "/3gpp/v2x/rsu/spatem")); - _subscribed_topics.insert(std::pair("140", "/3gpp/v2x/rsu/sxem")); - _subscribed_topics.insert(std::pair("128", "/3gpp/v2x/rsu/rtcmem")); + _subscribed_topics.insert(std::pair("141", "3gpp/v2x/rsu/beacon")); + _subscribed_topics.insert(std::pair("36", "3gpp/v2x/rsu/cam")); + _subscribed_topics.insert(std::pair("37", "3gpp/v2x/rsu/denm")); + _subscribed_topics.insert(std::pair("139", "3gpp/v2x/rsu/ivim")); + _subscribed_topics.insert(std::pair("138", "3gpp/v2x/rsu/mapem")); + _subscribed_topics.insert(std::pair("137", "3gpp/v2x/rsu/spatem")); + _subscribed_topics.insert(std::pair("140", "3gpp/v2x/rsu/sxem")); + _subscribed_topics.insert(std::pair("128", "3gpp/v2x/rsu/rtcmem")); // RSU publishes on OBUs topics - _topics.insert(std::pair("141", "/3gpp/v2x/obu/beacon")); - _topics.insert(std::pair("36", "/3gpp/v2x/obu/cam")); - _topics.insert(std::pair("37", "/3gpp/v2x/obu/denm")); - _topics.insert(std::pair("139", "/3gpp/v2x/obu/ivim")); - _topics.insert(std::pair("138", "/3gpp/v2x/obu/mapem")); - _topics.insert(std::pair("137", "/3gpp/v2x/obu/spatem")); - _topics.insert(std::pair("140", "/3gpp/v2x/obu/sxem")); - _topics.insert(std::pair("128", "/3gpp/v2x/obu/rtcmem")); + _topics.insert(std::pair("141", "3gpp/v2x/obu/beacon")); + _topics.insert(std::pair("36", "3gpp/v2x/obu/cam")); + _topics.insert(std::pair("37", "3gpp/v2x/obu/denm")); + _topics.insert(std::pair("139", "3gpp/v2x/obu/ivim")); + _topics.insert(std::pair("138", "3gpp/v2x/obu/mapem")); + _topics.insert(std::pair("137", "3gpp/v2x/obu/spatem")); + _topics.insert(std::pair("140", "3gpp/v2x/obu/sxem")); + _topics.insert(std::pair("128", "3gpp/v2x/obu/rtcmem")); } } else { //topics=(3gpp/v2x/cam,3gpp/v2x/denm) @@ -370,7 +372,7 @@ int uu_mqtt::recv_publish(OCTETSTRING &p_data, params_its &p_params, OCTETSTRING l -= 2; loggers::get_instance().log("uu_mqtt::recv_publish: topic_len: %d - counter: %d - l: %d", topic_len, counter, l); // Extract Topic - std::string topic(static_cast(oct2char(OCTETSTRING(topic_len, counter + static_cast(p_data))))); + std::string topic(static_cast(oct2char(OCTETSTRING(topic_len, counter + static_cast(p_data))))); loggers::get_instance().log("uu_mqtt::recv_publish: topic: %s", topic.c_str()); counter += topic_len; l -= topic_len; @@ -381,7 +383,7 @@ int uu_mqtt::recv_publish(OCTETSTRING &p_data, params_its &p_params, OCTETSTRING counter += 2; l -= 2; // Extract message - p_message = OCTETSTRING(l, counter + static_cast(p_data)); + p_message = OCTETSTRING(l, counter + static_cast(p_data)); loggers::get_instance().log_msg("uu_mqtt::recv_publish: Received data: ", p_message); return 1; @@ -423,7 +425,7 @@ OCTETSTRING uu_mqtt::calculate_message_length(const int p_payload_len) { int uu_mqtt::extract_message_length(OCTETSTRING &p_data, unsigned int* p_counter) { loggers::get_instance().log(">>> uu_mqtt::extract_message_length"); - unsigned char c; + uint8_t c; int multiplier = 1; int len = 0; int value = 0; diff --git a/ccsrc/Protocols/LTE/uu_mqtt.hh b/ccsrc/Protocols/LTE/uu_mqtt.hh index 22a9dc6..6deb066 100644 --- a/ccsrc/Protocols/LTE/uu_mqtt.hh +++ b/ccsrc/Protocols/LTE/uu_mqtt.hh @@ -6,7 +6,7 @@ #include "data_event_notifier.hh" -typedef enum MqttState: unsigned char { +typedef enum MqttState: uint8_t { mqtt_idle, mqtt_await_connect_ack, mqtt_await_subscribe_ack, diff --git a/ccsrc/Protocols/UpperTester/UpperTesterRtcmemCodec.cc b/ccsrc/Protocols/UpperTester/UpperTesterRtcmemCodec.cc index 1e0b3ec..4e6c770 100644 --- a/ccsrc/Protocols/UpperTester/UpperTesterRtcmemCodec.cc +++ b/ccsrc/Protocols/UpperTester/UpperTesterRtcmemCodec.cc @@ -9,15 +9,15 @@ template class OPTIONAL; class TTCN_EncDec; -unsigned char UpperTesterRtcmemCodec::c_utRtcmemInitialize = 0x00; -unsigned char UpperTesterRtcmemCodec::c_utRtcmemInitializeResult = 0x01; -unsigned char UpperTesterRtcmemCodec::c_utRtcmemTrigger = 0xC0; -unsigned char UpperTesterRtcmemCodec::c_utRtcmemTriggerResult = 0xC1; -unsigned char UpperTesterRtcmemCodec::c_utRtcmemUpdate = 0xC2; -unsigned char UpperTesterRtcmemCodec::c_utRtcmemUpdateResult = 0xC3; -unsigned char UpperTesterRtcmemCodec::c_utRtcmemTermination = 0xC4; -unsigned char UpperTesterRtcmemCodec::c_utRtcmemTerminationResult = 0xC5; -unsigned char UpperTesterRtcmemCodec::c_utRtcmemEventIndication = 0xC6; +uint8_t UpperTesterRtcmemCodec::c_utRtcmemInitialize = 0x00; +uint8_t UpperTesterRtcmemCodec::c_utRtcmemInitializeResult = 0x01; +uint8_t UpperTesterRtcmemCodec::c_utRtcmemTrigger = 0xC0; +uint8_t UpperTesterRtcmemCodec::c_utRtcmemTriggerResult = 0xC1; +uint8_t UpperTesterRtcmemCodec::c_utRtcmemUpdate = 0xC2; +uint8_t UpperTesterRtcmemCodec::c_utRtcmemUpdateResult = 0xC3; +uint8_t UpperTesterRtcmemCodec::c_utRtcmemTermination = 0xC4; +uint8_t UpperTesterRtcmemCodec::c_utRtcmemTerminationResult = 0xC5; +uint8_t UpperTesterRtcmemCodec::c_utRtcmemEventIndication = 0xC6; int UpperTesterRtcmemCodec::encode(const Record_Type &msg, OCTETSTRING &data) { loggers::get_instance().log_msg(">>> UpperTesterRtcmemCodec::encode: ", (const Record_Type &)msg); @@ -26,11 +26,11 @@ int UpperTesterRtcmemCodec::encode(const Record_Type &msg, OCTETSTRING &data) { TTCN_EncDec::clear_error(); TTCN_Buffer encoding_buffer; if (std::string(msg.get_descriptor()->name).compare("@LibItsRtcmem_TypesAndValues.UtRtcmemInitialize") == 0) { - encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemInitialize)); + encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemInitialize)); } else if (std::string(msg.get_descriptor()->name).compare("@LibItsRtcmem_TypesAndValues.UtRtcmemTrigger") == 0) { - encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemTrigger)); + encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemTrigger)); const LibItsRtcmem__TypesAndValues::UtRtcmemTrigger &trigger = dynamic_cast(msg); - unsigned char flag = 0x00; + uint8_t flag = 0x00; if (trigger.timeStamp().is_present()) { flag |= 0x80; } @@ -42,9 +42,9 @@ int UpperTesterRtcmemCodec::encode(const Record_Type &msg, OCTETSTRING &data) { } encoding_buffer.put_c(flag); } else if (std::string(msg.get_descriptor()->name).compare("@LibItsRtcmem_TypesAndValues.UtRtcmemUpdate") == 0) { - encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemUpdate)); + encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemUpdate)); } else if (std::string(msg.get_descriptor()->name).compare("@LibItsRtcmem_TypesAndValues.UtRtcmemTermination") == 0) { - encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemTermination)); + encoding_buffer.put_c(static_cast(UpperTesterRtcmemCodec::c_utRtcmemTermination)); } else { // Error data = OCTETSTRING(0, nullptr); loggers::get_instance().log("<<< UpperTesterRtcmemCodec::encode: Return -1"); @@ -79,10 +79,10 @@ int UpperTesterRtcmemCodec::encode_(const Base_Type &type, const TTCN_Typedescri loggers::get_instance().log("UpperTesterRtcmemCodec::encode_: field to process %s", s.c_str()); if (s.compare("@LibItsRtcmem_TypesAndValues.UtRtcmemTrigger.msgs") == 0) { const PreGenRecordOf::PREGEN__RECORD__OF__OCTETSTRING &rov = dynamic_cast(type); - encoding_buffer.put_c(static_cast(rov.lengthof())); + encoding_buffer.put_c(static_cast(rov.lengthof())); for (int i = 0; i < rov.lengthof(); i++) { const OCTETSTRING &os = rov[i]; - encoding_buffer.put_c(static_cast(os.lengthof())); + encoding_buffer.put_c(static_cast(os.lengthof())); encoding_buffer.put_os(os); } // End of 'for' statement } else { @@ -110,7 +110,7 @@ int UpperTesterRtcmemCodec::decode(const OCTETSTRING &data, Record_Type &msg, pa std::unique_ptr UpperTesterRtcmemCodec::decode(const OCTETSTRING &data, params_its *params) { std::unique_ptr result; - const unsigned char *ptr = static_cast(data); + const uint8_t *ptr = static_cast(data); if (*ptr != UpperTesterRtcmemCodec::c_utRtcmemEventIndication) { LibItsRtcmem__TypesAndValues::UtRtcmemResults res; decode(data, res, params); @@ -127,7 +127,7 @@ std::unique_ptr UpperTesterRtcmemCodec::decode(const OCTETSTRING &dat int UpperTesterRtcmemCodec::decode(const OCTETSTRING &data, LibItsRtcmem__TypesAndValues::UtRtcmemResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> UpperTesterRtcmemCodec::decode: decoding_buffer=", data); - const unsigned char *ptr = static_cast(data); + const uint8_t *ptr = static_cast(data); if (*ptr == UpperTesterRtcmemCodec::c_utRtcmemInitializeResult) { msg.utRtcmemInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); } else if (*ptr == UpperTesterRtcmemCodec::c_utRtcmemTriggerResult) { @@ -147,7 +147,7 @@ int UpperTesterRtcmemCodec::decode(const OCTETSTRING &data, LibItsRtcmem__TypesA int UpperTesterRtcmemCodec::decode(const OCTETSTRING &data, LibItsRtcmem__TypesAndValues::UtRtcmemEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> UpperTesterRtcmemCodec::decode: decoding_buffer=", data); - const unsigned char *ptr = static_cast(data) + 1; + const uint8_t *ptr = static_cast(data) + 1; OCTETSTRING os(2, ptr); ptr += 2; unsigned int length = oct2int(os); diff --git a/ccsrc/Protocols/UpperTester/UpperTesterRtcmemCodec.hh b/ccsrc/Protocols/UpperTester/UpperTesterRtcmemCodec.hh index 97f10c9..c75e8bb 100644 --- a/ccsrc/Protocols/UpperTester/UpperTesterRtcmemCodec.hh +++ b/ccsrc/Protocols/UpperTester/UpperTesterRtcmemCodec.hh @@ -19,15 +19,15 @@ namespace LibItsRtcmem__TypesAndValues { class UpperTesterRtcmemCodec : public codec { public: - static unsigned char c_utRtcmemInitialize; - static unsigned char c_utRtcmemInitializeResult; - static unsigned char c_utRtcmemTrigger; - static unsigned char c_utRtcmemTriggerResult; - static unsigned char c_utRtcmemUpdate; - static unsigned char c_utRtcmemUpdateResult; - static unsigned char c_utRtcmemTermination; - static unsigned char c_utRtcmemTerminationResult; - static unsigned char c_utRtcmemEventIndication; + static uint8_t c_utRtcmemInitialize; + static uint8_t c_utRtcmemInitializeResult; + static uint8_t c_utRtcmemTrigger; + static uint8_t c_utRtcmemTriggerResult; + static uint8_t c_utRtcmemUpdate; + static uint8_t c_utRtcmemUpdateResult; + static uint8_t c_utRtcmemTermination; + static uint8_t c_utRtcmemTerminationResult; + static uint8_t c_utRtcmemEventIndication; int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); diff --git a/ccsrc/Protocols/UpperTester/UpperTesterSremSsemCodec.cc b/ccsrc/Protocols/UpperTester/UpperTesterSremSsemCodec.cc index a5593ad..6ab0024 100644 --- a/ccsrc/Protocols/UpperTester/UpperTesterSremSsemCodec.cc +++ b/ccsrc/Protocols/UpperTester/UpperTesterSremSsemCodec.cc @@ -13,16 +13,16 @@ template class OPTIONAL; class TTCN_EncDec; -unsigned char UpperTesterSremSsemCodec::c_utSremInitialize = 0x00; -unsigned char UpperTesterSremSsemCodec::c_utSremInitializeResult = 0x01; -unsigned char UpperTesterSremSsemCodec::c_utSremTrigger = 0xA0; -unsigned char UpperTesterSremSsemCodec::c_utSremTriggerResult = 0xA1; -unsigned char UpperTesterSremSsemCodec::c_utSremUpdate = 0xA2; -unsigned char UpperTesterSremSsemCodec::c_utSremUpdateResult = 0xA3; -unsigned char UpperTesterSremSsemCodec::c_utSremCancelation = 0xA4; -unsigned char UpperTesterSremSsemCodec::c_utSremCancelationResult = 0xA5; -unsigned char UpperTesterSremSsemCodec::c_utSremEventIndication = 0xA6; -unsigned char UpperTesterSremSsemCodec::c_utSsemEventIndication = 0xA7; +uint8_t UpperTesterSremSsemCodec::c_utSremInitialize = 0x00; +uint8_t UpperTesterSremSsemCodec::c_utSremInitializeResult = 0x01; +uint8_t UpperTesterSremSsemCodec::c_utSremTrigger = 0xA0; +uint8_t UpperTesterSremSsemCodec::c_utSremTriggerResult = 0xA1; +uint8_t UpperTesterSremSsemCodec::c_utSremUpdate = 0xA2; +uint8_t UpperTesterSremSsemCodec::c_utSremUpdateResult = 0xA3; +uint8_t UpperTesterSremSsemCodec::c_utSremCancelation = 0xA4; +uint8_t UpperTesterSremSsemCodec::c_utSremCancelationResult = 0xA5; +uint8_t UpperTesterSremSsemCodec::c_utSremEventIndication = 0xA6; +uint8_t UpperTesterSremSsemCodec::c_utSsemEventIndication = 0xA7; int UpperTesterSremSsemCodec::encode(const Record_Type &msg, OCTETSTRING &data) { loggers::get_instance().log_msg(">>> UpperTesterSremSsemCodec::encode: ", (const Record_Type &)msg); @@ -31,13 +31,13 @@ int UpperTesterSremSsemCodec::encode(const Record_Type &msg, OCTETSTRING &data) TTCN_EncDec::clear_error(); TTCN_Buffer encoding_buffer; if (std::string(msg.get_descriptor()->name).compare("@LibItsSremSsem_TypesAndValues.UtSremInitialize") == 0) { - encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremInitialize)); + encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremInitialize)); } else if (std::string(msg.get_descriptor()->name).compare("@LibItsSremSsem_TypesAndValues.UtSremTrigger") == 0) { - encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremTrigger)); + encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremTrigger)); } else if (std::string(msg.get_descriptor()->name).compare("@LibItsSremSsem_TypesAndValues.UtSremUpdate") == 0) { - encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremUpdate)); + encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremUpdate)); } else if (std::string(msg.get_descriptor()->name).compare("@LibItsSremSsem_TypesAndValues.UtSremCancelation") == 0) { - encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremCancelation)); + encoding_buffer.put_c(static_cast(UpperTesterSremSsemCodec::c_utSremCancelation)); } else { // Error data = OCTETSTRING(0, nullptr); loggers::get_instance().log("<<< UpperTesterSremSsemCodec::encode: Return -1"); @@ -98,7 +98,7 @@ std::unique_ptr UpperTesterSremSsemCodec::decode(const OCTETSTRING &d std::unique_ptr result; - const unsigned char *ptr = static_cast(data); + const uint8_t *ptr = static_cast(data); if (*ptr == UpperTesterSremSsemCodec::c_utSsemEventIndication) { LibItsSremSsem__TypesAndValues::UtSsemEventInd ind; decode(data, ind, params); @@ -119,7 +119,7 @@ std::unique_ptr UpperTesterSremSsemCodec::decode(const OCTETSTRING &d int UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, LibItsSremSsem__TypesAndValues::UtSremResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> UpperTesterSremSsemCodec::decode (3): decoding_buffer=", data); - const unsigned char *ptr = static_cast(data); + const uint8_t *ptr = static_cast(data); if (*ptr == UpperTesterSremSsemCodec::c_utSremInitializeResult) { msg.utSremInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); } else if (*ptr == UpperTesterSremSsemCodec::c_utSremTriggerResult) { @@ -143,7 +143,7 @@ int UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, LibItsSremSsem__Ty int UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, LibItsSremSsem__TypesAndValues::UtSremEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> UpperTesterSremSsemCodec::decode (4): decoding_buffer=", data); - const unsigned char *ptr = static_cast(data) + 1; + const uint8_t *ptr = static_cast(data) + 1; OCTETSTRING os(2, ptr); ptr += 2; unsigned int length = oct2int(os); @@ -160,7 +160,7 @@ int UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, LibItsSremSsem__Ty int UpperTesterSremSsemCodec::decode(const OCTETSTRING &data, LibItsSremSsem__TypesAndValues::UtSsemEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> UpperTesterSremSsemCodec::decode (5): decoding_buffer=", data); - const unsigned char *ptr = static_cast(data) + 1; + const uint8_t *ptr = static_cast(data) + 1; OCTETSTRING os(2, ptr); ptr += 2; unsigned int length = oct2int(os); diff --git a/ccsrc/Protocols/UpperTester/UpperTesterSremSsemCodec.hh b/ccsrc/Protocols/UpperTester/UpperTesterSremSsemCodec.hh index 481f7bf..fd0aa62 100644 --- a/ccsrc/Protocols/UpperTester/UpperTesterSremSsemCodec.hh +++ b/ccsrc/Protocols/UpperTester/UpperTesterSremSsemCodec.hh @@ -19,16 +19,16 @@ namespace LibItsSremSsem__TypesAndValues { class UpperTesterSremSsemCodec : public codec { public: - static unsigned char c_utSremInitialize; - static unsigned char c_utSremInitializeResult; - static unsigned char c_utSremTrigger; - static unsigned char c_utSremTriggerResult; - static unsigned char c_utSremUpdate; - static unsigned char c_utSremUpdateResult; - static unsigned char c_utSremCancelation; - static unsigned char c_utSremCancelationResult; - static unsigned char c_utSremEventIndication; - static unsigned char c_utSsemEventIndication; + static uint8_t c_utSremInitialize; + static uint8_t c_utSremInitializeResult; + static uint8_t c_utSremTrigger; + static uint8_t c_utSremTriggerResult; + static uint8_t c_utSremUpdate; + static uint8_t c_utSremUpdateResult; + static uint8_t c_utSremCancelation; + static uint8_t c_utSremCancelationResult; + static uint8_t c_utSremEventIndication; + static uint8_t c_utSsemEventIndication; int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); diff --git a/ccsrc/Protocols/UpperTester/module.mk b/ccsrc/Protocols/UpperTester/module.mk index f08af4d..8ea7e0e 100644 --- a/ccsrc/Protocols/UpperTester/module.mk +++ b/ccsrc/Protocols/UpperTester/module.mk @@ -1,5 +1,5 @@ #to be added globally -sources += uppertester_geonetworking_codec.cc uppertester_geonetworking_layer.cc +sources += uppertester_geonetworking_codec.cc uppertester_geonetworking_layer.cc uppertester_debug_layer.cc ifeq (AtsCAM, $(ATS)) sources += uppertester_cam_codec.cc uppertester_cam_layer.cc diff --git a/ccsrc/Protocols/UpperTester/uppertester_cam_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_cam_codec.cc index e35cd9a..f92a264 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cam_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_cam_codec.cc @@ -11,25 +11,27 @@ template class OPTIONAL; class TTCN_EncDec; -unsigned char uppertester_cam_codec::c_utCamInitialize = 0x00; -unsigned char uppertester_cam_codec::c_utCamInitializeResult = 0x01; -unsigned char uppertester_cam_codec::c_utCamChangePosition = 0x02; -unsigned char uppertester_cam_codec::c_utCamChangePositionResult = 0x03; -unsigned char uppertester_cam_codec::c_utCamChangeCurvature = 0x30; -unsigned char uppertester_cam_codec::c_utCamChangeSpeed = 0x31; -unsigned char uppertester_cam_codec::c_utCamSetAccelerationStatus = 0x32; -unsigned char uppertester_cam_codec::c_utCamSetExteriorLightsStatus = 0x33; -unsigned char uppertester_cam_codec::c_utCamChangeHeading = 0x34; -unsigned char uppertester_cam_codec::c_utCamSetDriveDirection = 0x35; -unsigned char uppertester_cam_codec::c_utCamChangeYawRate = 0x36; -unsigned char uppertester_cam_codec::c_utCamSetStationType = 0x39; -unsigned char uppertester_cam_codec::c_utCamSetVehicleRole = 0x3a; -unsigned char uppertester_cam_codec::c_utCamSetEmbarkationStatus = 0x3b; -unsigned char uppertester_cam_codec::c_utCamSetPtActivation = 0x3c; -unsigned char uppertester_cam_codec::c_utCamSetDangerousGoods = 0x3d; -unsigned char uppertester_cam_codec::c_utCamSetLightBarSirene = 0x3f; -unsigned char uppertester_cam_codec::c_utCamTriggerResult = 0x21; -unsigned char uppertester_cam_codec::c_utCamEventInd = 0x23; +uint8_t uppertester_cam_codec::c_utCamInitialize = 0x00; +uint8_t uppertester_cam_codec::c_utCamInitializeResult = 0x01; +uint8_t uppertester_cam_codec::c_utCamChangePosition = 0x02; +uint8_t uppertester_cam_codec::c_utCamChangePositionResult = 0x03; +uint8_t uppertester_cam_codec::c_utCamChangeCurvature = 0x30; +uint8_t uppertester_cam_codec::c_utCamChangeSpeed = 0x31; +uint8_t uppertester_cam_codec::c_utCamSetAccelerationStatus = 0x32; +uint8_t uppertester_cam_codec::c_utCamSetExteriorLightsStatus = 0x33; +uint8_t uppertester_cam_codec::c_utCamChangeHeading = 0x34; +uint8_t uppertester_cam_codec::c_utCamSetDriveDirection = 0x35; +uint8_t uppertester_cam_codec::c_utCamChangeYawRate = 0x36; +uint8_t uppertester_cam_codec::c_utCamSetStationType = 0x39; +uint8_t uppertester_cam_codec::c_utCamSetVehicleRole = 0x3a; +uint8_t uppertester_cam_codec::c_utCamSetEmbarkationStatus = 0x3b; +uint8_t uppertester_cam_codec::c_utCamSetPtActivation = 0x3c; +uint8_t uppertester_cam_codec::c_utCamSetDangerousGoods = 0x3d; +uint8_t uppertester_cam_codec::c_utCamSetLightBarSirene = 0x3f; +uint8_t uppertester_cam_codec::c_utCamChangePseudonym = 0x40; +uint8_t uppertester_cam_codec::c_utCamChangePseudonymResult = 0x41; +uint8_t uppertester_cam_codec::c_utCamTriggerResult = 0x21; +uint8_t uppertester_cam_codec::c_utCamEventInd = 0x23; int uppertester_cam_codec::encode(const Record_Type &msg, OCTETSTRING &data) { loggers::get_instance().log_msg(">>> uppertester_cam_codec::encode: ", (const Record_Type &)msg); @@ -37,9 +39,11 @@ int uppertester_cam_codec::encode(const Record_Type &msg, OCTETSTRING &data) { TTCN_EncDec::clear_error(); TTCN_Buffer encoding_buffer; if (std::string(msg.get_descriptor()->name).compare("@LibItsCam_TypesAndValues.UtCamInitialize") == 0) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamInitialize)); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamInitialize)); } else if (std::string(msg.get_descriptor()->name).compare("@LibItsCam_TypesAndValues.UtCamChangePosition") == 0) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamChangePosition)); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamChangePosition)); + } else if (std::string(msg.get_descriptor()->name).compare("@LibItsCam_TypesAndValues.UtCamChangePseudonym") == 0) { + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamChangePseudonym)); } else { // Error data = OCTETSTRING(0, nullptr); loggers::get_instance().warning("<<< uppertester_cam_codec::encode: Failed to encode UT message"); @@ -59,65 +63,65 @@ int uppertester_cam_codec::encode(const LibItsCam__TypesAndValues::UtCamTrigger // const Record_Type *type; const LibItsCam__TypesAndValues::UtCamTrigger &u = static_cast(msg); if (u.ischosen(LibItsCam__TypesAndValues::UtCamTrigger::ALT_changeCurvature)) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamChangeCurvature)); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamChangeCurvature)); encoding_buffer.put_string(int2oct(u.changeCurvature(), 2)); } else if (u.ischosen(LibItsCam__TypesAndValues::UtCamTrigger::ALT_changeSpeed)) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamChangeSpeed)); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamChangeSpeed)); encoding_buffer.put_string(int2oct(u.changeSpeed(), 2)); } else if (u.ischosen(LibItsCam__TypesAndValues::UtCamTrigger::ALT_setAccelerationControlStatus)) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetAccelerationStatus)); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetAccelerationStatus)); // Convert into ASN.1 encoded format - unsigned char c = *static_cast(u.setAccelerationControlStatus()); - unsigned char r = 0x00; + uint8_t c = *static_cast(u.setAccelerationControlStatus()); + uint8_t r = 0x00; for (int i = 0; i < 8; i++, c >>= 1) { // TODO Try to refine the reverse bit operation r = (r << 1) | (c & 0x01); } // End of 'for' statement encoding_buffer.put_c(r); - // encoding_buffer.put_c(*static_cast(u.setAccelerationControlStatus())); + // encoding_buffer.put_c(*static_cast(u.setAccelerationControlStatus())); } else if (u.ischosen(LibItsCam__TypesAndValues::UtCamTrigger::ALT_setExteriorLightsStatus)) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetExteriorLightsStatus)); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetExteriorLightsStatus)); // Convert into ASN.1 encoded format - unsigned char c = *static_cast(u.setExteriorLightsStatus()); - unsigned char r = 0x00; + uint8_t c = *static_cast(u.setExteriorLightsStatus()); + uint8_t r = 0x00; for (int i = 0; i < 8; i++, c >>= 1) { // TODO Try to refine the reverse bit operation r = (r << 1) | (c & 0x01); } // End of 'for' statement encoding_buffer.put_c(r); } else if (u.ischosen(LibItsCam__TypesAndValues::UtCamTrigger::ALT_changeHeading)) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamChangeHeading)); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamChangeHeading)); encoding_buffer.put_string(int2oct(u.changeHeading(), 2)); } else if (u.ischosen(LibItsCam__TypesAndValues::UtCamTrigger::ALT_setDriveDirection)) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetDriveDirection)); - encoding_buffer.put_c((unsigned char)static_cast(u.setDriveDirection()).as_int()); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetDriveDirection)); + encoding_buffer.put_c((uint8_t)static_cast(u.setDriveDirection()).as_int()); } else if (u.ischosen(LibItsCam__TypesAndValues::UtCamTrigger::ALT_changeYawRate)) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamChangeYawRate)); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamChangeYawRate)); const short i = u.changeYawRate(); - const unsigned char t[2] = {(unsigned char)((i & 0xff00) >> 8), (unsigned char)(i & 0x00ff)}; + const uint8_t t[2] = {(uint8_t)((i & 0xff00) >> 8), (uint8_t)(i & 0x00ff)}; OCTETSTRING os(2, t); encoding_buffer.put_string(os); } else if (u.ischosen(LibItsCam__TypesAndValues::UtCamTrigger::ALT_setStationType)) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetStationType)); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetStationType)); encoding_buffer.put_string(int2oct(u.setStationType(), 1)); } else if (u.ischosen(LibItsCam__TypesAndValues::UtCamTrigger::ALT_setVehicleRole)) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetVehicleRole)); - encoding_buffer.put_c((unsigned char)static_cast(u.setVehicleRole()).as_int()); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetVehicleRole)); + encoding_buffer.put_c((uint8_t)static_cast(u.setVehicleRole()).as_int()); } else if (u.ischosen(LibItsCam__TypesAndValues::UtCamTrigger::ALT_setEmbarkationStatus)) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetEmbarkationStatus)); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetEmbarkationStatus)); encoding_buffer.put_c((u.setEmbarkationStatus() == true) ? 0xff : 0x00); } else if (u.ischosen(LibItsCam__TypesAndValues::UtCamTrigger::ALT_setDangerousGoods)) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetDangerousGoods)); - encoding_buffer.put_c((unsigned char)static_cast(u.setDangerousGoods()).as_int()); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetDangerousGoods)); + encoding_buffer.put_c((uint8_t)static_cast(u.setDangerousGoods()).as_int()); } else if (u.ischosen(LibItsCam__TypesAndValues::UtCamTrigger::ALT_setPtActivation)) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetPtActivation)); - encoding_buffer.put_c(static_cast(u.setPtActivation().ptActivationType())); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetPtActivation)); + encoding_buffer.put_c(static_cast(u.setPtActivation().ptActivationType())); const OCTETSTRING &os = u.setPtActivation().ptActivationData(); - encoding_buffer.put_c(static_cast(os.lengthof())); + encoding_buffer.put_c(static_cast(os.lengthof())); encoding_buffer.put_string(os); } else if (u.ischosen(LibItsCam__TypesAndValues::UtCamTrigger::ALT_setLightBarSirene)) { - encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetLightBarSirene)); - loggers::get_instance().log("uppertester_cam_codec::encode: BarSirene=0x%02x - 0x%02x", *static_cast(u.setLightBarSirene()), - *static_cast(u.setLightBarSirene()) << 6); - encoding_buffer.put_c(*static_cast(u.setLightBarSirene()) << 6); + encoding_buffer.put_c(static_cast(uppertester_cam_codec::c_utCamSetLightBarSirene)); + loggers::get_instance().log("uppertester_cam_codec::encode: BarSirene=0x%02x - 0x%02x", *static_cast(u.setLightBarSirene()), + *static_cast(u.setLightBarSirene()) << 6); + encoding_buffer.put_c(*static_cast(u.setLightBarSirene()) << 6); } else { // Error data = OCTETSTRING(0, nullptr); loggers::get_instance().warning("<<< uppertester_cam_codec::encode: Failed to encode UT message"); @@ -155,10 +159,10 @@ int uppertester_cam_codec::encode_(const Base_Type &type, const TTCN_Typedescrip std::string s(field_descriptor.name); loggers::get_instance().log("uppertester_cam_codec::encode_: field to process %s", s.c_str()); if ((s.rfind(".shape") != string::npos) || (s.rfind(".relevanceDistance") != string::npos) || (s.rfind(".relevanceTrafficDirection") != string::npos)) { - encoding_buffer.put_c((unsigned char)static_cast(type).as_int()); + encoding_buffer.put_c((uint8_t)static_cast(type).as_int()); } else if (s.rfind(".payload") != string::npos) { const OCTETSTRING & os = static_cast(type); - const unsigned char s[] = {(unsigned char)((os.lengthof() & 0x0000FF00) >> 8), (unsigned char)os.lengthof()}; + const uint8_t s[] = {(uint8_t)((os.lengthof() & 0x0000FF00) >> 8), (uint8_t)os.lengthof()}; encoding_buffer.put_s(2, s); if (os.lengthof() != 0) { encoding_buffer.put_string(os); @@ -166,9 +170,9 @@ int uppertester_cam_codec::encode_(const Base_Type &type, const TTCN_Typedescrip } else if (s.rfind(".detectionTime") != string::npos) { unsigned long long llu = static_cast(type).get_long_long_val(); loggers::get_instance().log("uppertester_cam_codec::encode_ : detectionTime=%llu", llu); - std::vector v; + std::vector v; for (int i = 0; i < 6; i++) { - v.insert(v.begin(), static_cast(llu)); + v.insert(v.begin(), static_cast(llu)); llu >>= 8; } // End of 'for' statement OCTETSTRING os(v.size(), v.data()); @@ -229,7 +233,7 @@ std::unique_ptr uppertester_cam_codec::decode(const OCTETSTRING &data std::unique_ptr result; - const unsigned char *ptr = static_cast(data); + const uint8_t *ptr = static_cast(data); if (*ptr != uppertester_cam_codec::c_utCamEventInd) { LibItsCam__TypesAndValues::UtCamResults res; if (decode(data, res, params) == 0) { @@ -249,11 +253,13 @@ std::unique_ptr uppertester_cam_codec::decode(const OCTETSTRING &data int uppertester_cam_codec::decode(const OCTETSTRING &data, LibItsCam__TypesAndValues::UtCamResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_cam_codec::decode: decoding_buffer=", data); - const unsigned char *ptr = static_cast(data); + const uint8_t *ptr = static_cast(data); if (*ptr == uppertester_cam_codec::c_utCamInitializeResult) { msg.utCamInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); } else if (*ptr == uppertester_cam_codec::c_utCamChangePositionResult) { msg.utCamChangePositionResult() = BOOLEAN(*(ptr + 1) == 0x01); + } else if (*ptr == uppertester_cam_codec::c_utCamChangePseudonymResult) { + msg.utCamChangePseudonymResult() = BOOLEAN(*(ptr + 1) == 0x01); } else if (*ptr == uppertester_cam_codec::c_utCamTriggerResult) { msg.utCamTriggerResult() = BOOLEAN(*(ptr + 1) == 0x01); } else if (*ptr == 0x24) { // TODO Use a constant for "Peer does not support is "Peer does not support the command" @@ -271,7 +277,7 @@ int uppertester_cam_codec::decode(const OCTETSTRING &data, LibItsCam__TypesAndVa int uppertester_cam_codec::decode(const OCTETSTRING &data, LibItsCam__TypesAndValues::UtCamEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_cam_codec::decode (1): decoding_buffer=", data); - const unsigned char *ptr = static_cast(data) + 1; + const uint8_t *ptr = static_cast(data) + 1; OCTETSTRING os(2, ptr); const unsigned int length = (const unsigned int)((*ptr << 8 & 0xff00) | *(ptr + 1)); ptr += 2; diff --git a/ccsrc/Protocols/UpperTester/uppertester_cam_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_cam_codec.hh index fb0579a..4197b20 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cam_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_cam_codec.hh @@ -28,25 +28,27 @@ namespace LibItsCam__TypesAndValues { class uppertester_cam_codec : public codec { public: - static unsigned char c_utCamInitialize; - static unsigned char c_utCamInitializeResult; - static unsigned char c_utCamChangePosition; - static unsigned char c_utCamChangePositionResult; - static unsigned char c_utCamChangeCurvature; - static unsigned char c_utCamChangeSpeed; - static unsigned char c_utCamSetAccelerationStatus; - static unsigned char c_utCamSetExteriorLightsStatus; - static unsigned char c_utCamChangeHeading; - static unsigned char c_utCamSetDriveDirection; - static unsigned char c_utCamChangeYawRate; - static unsigned char c_utCamSetStationType; - static unsigned char c_utCamSetVehicleRole; - static unsigned char c_utCamSetEmbarkationStatus; - static unsigned char c_utCamSetPtActivation; - static unsigned char c_utCamSetDangerousGoods; - static unsigned char c_utCamSetLightBarSirene; - static unsigned char c_utCamTriggerResult; - static unsigned char c_utCamEventInd; + static uint8_t c_utCamInitialize; + static uint8_t c_utCamInitializeResult; + static uint8_t c_utCamChangePosition; + static uint8_t c_utCamChangePositionResult; + static uint8_t c_utCamChangePseudonym; + static uint8_t c_utCamChangePseudonymResult; + static uint8_t c_utCamChangeCurvature; + static uint8_t c_utCamChangeSpeed; + static uint8_t c_utCamSetAccelerationStatus; + static uint8_t c_utCamSetExteriorLightsStatus; + static uint8_t c_utCamChangeHeading; + static uint8_t c_utCamSetDriveDirection; + static uint8_t c_utCamChangeYawRate; + static uint8_t c_utCamSetStationType; + static uint8_t c_utCamSetVehicleRole; + static uint8_t c_utCamSetEmbarkationStatus; + static uint8_t c_utCamSetPtActivation; + static uint8_t c_utCamSetDangerousGoods; + static uint8_t c_utCamSetLightBarSirene; + static uint8_t c_utCamTriggerResult; + static uint8_t c_utCamEventInd; private: int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); diff --git a/ccsrc/Protocols/UpperTester/uppertester_cam_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_cam_layer.cc index 090a2a9..e74905b 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cam_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_cam_layer.cc @@ -48,6 +48,22 @@ void uppertester_cam_layer::sendMsg(const LibItsCam__TypesAndValues::UtCamChange } } +void uppertester_cam_layer::sendMsg(const LibItsCam__TypesAndValues::UtCamChangePseudonym &send_par, params_its &p_params) { + loggers::get_instance().log_msg(">>> uppertester_cam_layer::sendMsg", send_par); + + if (_params[params::loopback].compare("1") == 0) { + LibItsCam__TypesAndValues::UtCamResults ut_cam_results; + ut_cam_results.utCamChangePseudonymResult() = BOOLEAN(true); + to_all_upper_ports(ut_cam_results, p_params); + } else { + // Encode UpperTester PDU + OCTETSTRING data; + _codec.encode(static_cast(send_par), data); + // Update parameters + send_data(data, p_params); + } +} + void uppertester_cam_layer::sendMsg(const LibItsCam__TypesAndValues::UtCamTrigger &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_cam_layer::sendMsg", send_par); diff --git a/ccsrc/Protocols/UpperTester/uppertester_cam_layer.hh b/ccsrc/Protocols/UpperTester/uppertester_cam_layer.hh index 5c55c77..f76d5a4 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cam_layer.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_cam_layer.hh @@ -22,6 +22,7 @@ namespace LibItsCam__TestSystem { namespace LibItsCam__TypesAndValues { class UtCamInitialize; class UtCamChangePosition; + class UtCamChangePseudonym; class UtCamTrigger; } // namespace LibItsCam__TypesAndValues @@ -36,6 +37,7 @@ public: void sendMsg(const LibItsCam__TypesAndValues::UtCamInitialize &send_par, params_its& p_params); void sendMsg(const LibItsCam__TypesAndValues::UtCamChangePosition &send_par, params_its& p_params); + void sendMsg(const LibItsCam__TypesAndValues::UtCamChangePseudonym &send_par, params_its& p_params); void sendMsg(const LibItsCam__TypesAndValues::UtCamTrigger &send_par, params_its& p_params); virtual void send_data(OCTETSTRING &data, params& p_params); diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc index cc1f540..07bd3e5 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_cps_codec.cc @@ -11,9 +11,9 @@ template class OPTIONAL; class TTCN_EncDec; -unsigned char uppertester_cps_codec::c_utCpmInitialize = 0x00; -unsigned char uppertester_cps_codec::c_utCpmInitializeResult = 0x01; -unsigned char uppertester_cps_codec::c_utCpmEventInd = 0x23; +uint8_t uppertester_cps_codec::c_utCpmInitialize = 0x00; +uint8_t uppertester_cps_codec::c_utCpmInitializeResult = 0x01; +uint8_t uppertester_cps_codec::c_utCpmEventInd = 0x23; int uppertester_cps_codec::encode(const Record_Type &msg, OCTETSTRING &data) { loggers::get_instance().log_msg(">>> uppertester_cps_codec::encode: ", (const Record_Type &)msg); @@ -21,7 +21,7 @@ int uppertester_cps_codec::encode(const Record_Type &msg, OCTETSTRING &data) { TTCN_EncDec::clear_error(); TTCN_Buffer encoding_buffer; if (std::string(msg.get_descriptor()->name).compare("@LibItsCps_TypesAndValues.UtCpmInitialize") == 0) { - encoding_buffer.put_c(static_cast(uppertester_cps_codec::c_utCpmInitialize)); + encoding_buffer.put_c(static_cast(uppertester_cps_codec::c_utCpmInitialize)); } else { // Error data = OCTETSTRING(0, nullptr); loggers::get_instance().warning("<<< uppertester_cps_codec::encode: Failed to encode UT message"); @@ -59,10 +59,10 @@ int uppertester_cps_codec::encode_(const Base_Type &type, const TTCN_Typedescrip std::string s(field_descriptor.name); loggers::get_instance().log("uppertester_cps_codec::encode_: field to process %s", s.c_str()); if ((s.rfind(".shape") != string::npos) || (s.rfind(".relevanceDistance") != string::npos) || (s.rfind(".relevanceTrafficDirection") != string::npos)) { - encoding_buffer.put_c((unsigned char)static_cast(type).as_int()); + encoding_buffer.put_c((uint8_t)static_cast(type).as_int()); } else if (s.rfind(".payload") != string::npos) { const OCTETSTRING & os = static_cast(type); - const unsigned char s[] = {(unsigned char)((os.lengthof() & 0x0000FF00) >> 8), (unsigned char)os.lengthof()}; + const uint8_t s[] = {(uint8_t)((os.lengthof() & 0x0000FF00) >> 8), (uint8_t)os.lengthof()}; encoding_buffer.put_s(2, s); if (os.lengthof() != 0) { encoding_buffer.put_string(os); @@ -70,9 +70,9 @@ int uppertester_cps_codec::encode_(const Base_Type &type, const TTCN_Typedescrip } else if (s.rfind(".detectionTime") != string::npos) { unsigned long long llu = static_cast(type).get_long_long_val(); loggers::get_instance().log("uppertester_cps_codec::encode_ : detectionTime=%llu", llu); - std::vector v; + std::vector v; for (int i = 0; i < 6; i++) { - v.insert(v.begin(), static_cast(llu)); + v.insert(v.begin(), static_cast(llu)); llu >>= 8; } // End of 'for' statement OCTETSTRING os(v.size(), v.data()); @@ -133,7 +133,7 @@ std::unique_ptr uppertester_cps_codec::decode(const OCTETSTRING &data std::unique_ptr result; - const unsigned char *ptr = static_cast(data); + const uint8_t *ptr = static_cast(data); if (*ptr != uppertester_cps_codec::c_utCpmEventInd) { LibItsCps__TypesAndValues::UtCpmResults res; if (decode(data, res, params) == 0) { @@ -153,7 +153,7 @@ std::unique_ptr uppertester_cps_codec::decode(const OCTETSTRING &data int uppertester_cps_codec::decode(const OCTETSTRING &data, LibItsCps__TypesAndValues::UtCpmResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_cps_codec::decode: decoding_buffer=", data); - const unsigned char *ptr = static_cast(data); + const uint8_t *ptr = static_cast(data); if (*ptr == uppertester_cps_codec::c_utCpmInitializeResult) { msg.utCpmInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); } else if (*ptr == 0x24) { // TODO Use a constant for "Peer does not support is "Peer does not support the command" @@ -171,7 +171,7 @@ int uppertester_cps_codec::decode(const OCTETSTRING &data, LibItsCps__TypesAndVa int uppertester_cps_codec::decode(const OCTETSTRING &data, LibItsCps__TypesAndValues::UtCpmEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_cps_codec::decode (1): decoding_buffer=", data); - const unsigned char *ptr = static_cast(data) + 1; + const uint8_t *ptr = static_cast(data) + 1; OCTETSTRING os(2, ptr); const unsigned int length = (const unsigned int)((*ptr << 8 & 0xff00) | *(ptr + 1)); ptr += 2; diff --git a/ccsrc/Protocols/UpperTester/uppertester_cps_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_cps_codec.hh index 26905e7..9be9420 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_cps_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_cps_codec.hh @@ -28,9 +28,9 @@ namespace LibItsCps__TypesAndValues { class uppertester_cps_codec : public codec { public: - static unsigned char c_utCpmInitialize; - static unsigned char c_utCpmInitializeResult; - static unsigned char c_utCpmEventInd; + static uint8_t c_utCpmInitialize; + static uint8_t c_utCpmInitializeResult; + static uint8_t c_utCpmEventInd; private: int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); diff --git a/ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc index 986eef6..ed8bc24 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_denm_codec.cc @@ -12,19 +12,19 @@ template class OPTIONAL; class TTCN_EncDec; -unsigned char uppertester_denm_codec::c_utDenmInitialize = 0x00; -unsigned char uppertester_denm_codec::c_utDenmInitializeResult = 0x01; -unsigned char uppertester_denm_codec::c_utDenmChangePosition = 0x02; -unsigned char uppertester_denm_codec::c_utDenmChangePositionResult = 0x03; -unsigned char uppertester_denm_codec::c_utDenmChangePseudonym = 0x04; -unsigned char uppertester_denm_codec::c_utDenmChangePseudonymResult = 0x05; -unsigned char uppertester_denm_codec::c_utDenmTrigger = 0x10; -unsigned char uppertester_denm_codec::c_utDenmTriggerResult = 0x11; -unsigned char uppertester_denm_codec::c_utDenmUpdate = 0x12; -unsigned char uppertester_denm_codec::c_utDenmUpdateResult = 0x13; -unsigned char uppertester_denm_codec::c_utDenmTermination = 0x14; -unsigned char uppertester_denm_codec::c_utDenmTerminationResult = 0x15; -unsigned char uppertester_denm_codec::c_utDenmEventIndication = 0x17; +uint8_t uppertester_denm_codec::c_utDenmInitialize = 0x00; +uint8_t uppertester_denm_codec::c_utDenmInitializeResult = 0x01; +uint8_t uppertester_denm_codec::c_utDenmChangePosition = 0x02; +uint8_t uppertester_denm_codec::c_utDenmChangePositionResult = 0x03; +uint8_t uppertester_denm_codec::c_utDenmTrigger = 0x10; +uint8_t uppertester_denm_codec::c_utDenmTriggerResult = 0x11; +uint8_t uppertester_denm_codec::c_utDenmUpdate = 0x12; +uint8_t uppertester_denm_codec::c_utDenmUpdateResult = 0x13; +uint8_t uppertester_denm_codec::c_utDenmTermination = 0x14; +uint8_t uppertester_denm_codec::c_utDenmTerminationResult = 0x15; +uint8_t uppertester_denm_codec::c_utDenmEventIndication = 0x17; +uint8_t uppertester_denm_codec::c_utDenmChangePseudonym = 0x18; +uint8_t uppertester_denm_codec::c_utDenmChangePseudonymResult = 0x19; int uppertester_denm_codec::encode(const Record_Type &msg, OCTETSTRING &data) { loggers::get_instance().log_msg(">>> uppertester_denm_codec::encode: ", (const Record_Type &)msg); @@ -32,20 +32,20 @@ int uppertester_denm_codec::encode(const Record_Type &msg, OCTETSTRING &data) { TTCN_EncDec::clear_error(); TTCN_Buffer encoding_buffer; if (std::string(msg.get_descriptor()->name).compare("@LibItsDenm_TypesAndValues.UtDenmInitialize") == 0) { - encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmInitialize)); + encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmInitialize)); } else if (std::string(msg.get_descriptor()->name).compare("@LibItsDenm_TypesAndValues.UtDenmChangePosition") == 0) { - encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmChangePosition)); + encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmChangePosition)); } else if (std::string(msg.get_descriptor()->name).compare("@LibItsDenm_TypesAndValues.UtDenmChangePseudonym") == 0) { - encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmChangePseudonym)); + encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmChangePseudonym)); } else if (std::string(msg.get_descriptor()->name).compare("@LibItsDenm_TypesAndValues.UtDenmTrigger") == 0) { - encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmTrigger)); + encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmTrigger)); // See ETSI TR 103 099 V1.4.1 Clause C.4.1 GenerateDenmEvent - unsigned char flags = 0x00; + uint8_t flags = 0x00; const LibItsDenm__TypesAndValues::UtDenmTrigger &r = static_cast(msg); if (r.validityDuration().is_present()) { // V flags |= 0x80; } - if (r.awarenessDistance().is_present()) { // R + if (r.repetitionDuration().is_present()) { // R flags |= 0x40; } if (r.trafficDirection().is_present()) { // T @@ -61,9 +61,9 @@ int uppertester_denm_codec::encode(const Record_Type &msg, OCTETSTRING &data) { loggers::get_instance().log_to_hexa("uppertester_denm_codec::encode: flags=", encoding_buffer); // Continue with encoding } else if (std::string(msg.get_descriptor()->name).compare("@LibItsDenm_TypesAndValues.UtDenmUpdate") == 0) { - encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmUpdate)); + encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmUpdate)); // See ETSI TR 103 099 V1.3.21 (20152016-07) Clause C.4.1GenerateDenmEvent - unsigned char flags = 0x00; + uint8_t flags = 0x00; const LibItsDenm__TypesAndValues::UtDenmUpdate &r = static_cast(msg); if (r.validityDuration().is_present()) { // V flags |= 0x80; @@ -90,7 +90,7 @@ int uppertester_denm_codec::encode(const Record_Type &msg, OCTETSTRING &data) { encoding_buffer.put_c(flags); loggers::get_instance().log_to_hexa("uppertester_denm_codec::encode: flags=", encoding_buffer); } else if (std::string(msg.get_descriptor()->name).compare("@LibItsDenm_TypesAndValues.UtDenmTermination") == 0) { - encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmTermination)); + encoding_buffer.put_c(static_cast(uppertester_denm_codec::c_utDenmTermination)); } else { // Error data = OCTETSTRING(0, nullptr); loggers::get_instance().warning("<<< uppertester_denm_codec::encode: Failed to encode UT message"); @@ -122,16 +122,16 @@ int uppertester_denm_codec::encode_(const Base_Type &type, const TTCN_Typedescri std::string s(r.fld_descr(i)->name); if ((s.rfind(".validityDuration") != string::npos) || (s.rfind(".repetitionDuration") != string::npos) || (s.rfind(".situation") != string::npos)) { // Pad with three bytes - encoding_buffer.put_c((unsigned char)0x00); - encoding_buffer.put_c((unsigned char)0x00); - encoding_buffer.put_c((unsigned char)0x00); + encoding_buffer.put_c((uint8_t)0x00); + encoding_buffer.put_c((uint8_t)0x00); + encoding_buffer.put_c((uint8_t)0x00); } else if ((s.rfind(".transmissionInterval") != string::npos) || (s.rfind(".repetitionInterval") != string::npos)) { // Pad with two bytes - encoding_buffer.put_c((unsigned char)0x00); - encoding_buffer.put_c((unsigned char)0x00); - } else if ((s.rfind(".informationQuality") != string::npos) || (s.rfind(".relevanceTrafficDirection") != string::npos) || + encoding_buffer.put_c((uint8_t)0x00); + encoding_buffer.put_c((uint8_t)0x00); + } else if ((s.rfind(".informationQuality") != string::npos) || (s.rfind(".trafficDirection") != string::npos) || (s.rfind(".relevanceDistance") != string::npos) // Mandatory in DenmTrigger, optional in DenmUpdate ) { // Pad with one byte - encoding_buffer.put_c((unsigned char)0x00); + encoding_buffer.put_c((uint8_t)0x00); } else if (std::string(r.fld_name(i)).compare("alacarte") == 0) { // Add empty field length loggers::get_instance().log("uppertester_denm_codec::encode_: alacarte is missing, add 0x00"); @@ -142,11 +142,11 @@ int uppertester_denm_codec::encode_(const Base_Type &type, const TTCN_Typedescri } else { std::string s(field_descriptor.name); loggers::get_instance().log("uppertester_denm_codec::encode_: field to process %s", s.c_str()); - if ((s.rfind(".shape") != string::npos) || (s.rfind(".relevanceDistance") != string::npos) || (s.rfind(".relevanceTrafficDirection") != string::npos)) { - encoding_buffer.put_c((unsigned char)static_cast(type).as_int()); + if ((s.rfind(".shape") != string::npos) || (s.rfind(".relevanceDistance") != string::npos) || (s.rfind(".trafficDirection") != string::npos)) { + encoding_buffer.put_c((uint8_t)static_cast(type).as_int()); } else if (s.rfind(".payload") != string::npos) { const OCTETSTRING & os = static_cast(type); - const unsigned char s[] = {(unsigned char)((os.lengthof() & 0x0000FF00) >> 8), (unsigned char)os.lengthof()}; + const uint8_t s[] = {(uint8_t)((os.lengthof() & 0x0000FF00) >> 8), (uint8_t)os.lengthof()}; encoding_buffer.put_s(2, s); if (os.lengthof() != 0) { encoding_buffer.put_string(os); @@ -154,9 +154,9 @@ int uppertester_denm_codec::encode_(const Base_Type &type, const TTCN_Typedescri } else if (s.rfind(".detectionTime") != string::npos) { unsigned long long llu = static_cast(type).get_long_long_val(); loggers::get_instance().log("uppertester_denm_codec::encode_ : detectionTime=%llu", llu); - std::vector v; + std::vector v; for (int i = 0; i < 6; i++) { - v.insert(v.begin(), static_cast(llu)); + v.insert(v.begin(), static_cast(llu)); llu >>= 8; } // End of 'for' statement OCTETSTRING os(v.size(), v.data()); @@ -170,8 +170,8 @@ int uppertester_denm_codec::encode_(const Base_Type &type, const TTCN_Typedescri } else if ((s.rfind(".causeCode") != string::npos) || (s.rfind(".subCauseCode") != string::npos) || (s.rfind(".informationQuality") != string::npos) || (s.rfind(".relevanceDistance") != string::npos)) { const INTEGER &i = static_cast(type); - loggers::get_instance().log("uppertester_denm_codec::encode_: o=%02x", *static_cast(int2oct(i, 1))); - encoding_buffer.put_c(*static_cast(int2oct(i, 1))); + loggers::get_instance().log("uppertester_denm_codec::encode_: o=%02x", *static_cast(int2oct(i, 1))); + encoding_buffer.put_c(*static_cast(int2oct(i, 1))); } else if ((s.rfind(".linkedCause") != string::npos) || (s.rfind(".eventHistory") != string::npos)) { // Skip them } else if ((s.rfind(".transmissionInterval") != string::npos) || (s.rfind(".repetitionInterval") != string::npos)) { @@ -223,7 +223,7 @@ std::unique_ptr uppertester_denm_codec::decode(const OCTETSTRING &dat std::unique_ptr result; - const unsigned char *ptr = static_cast(data); + const uint8_t *ptr = static_cast(data); if (*ptr != uppertester_denm_codec::c_utDenmEventIndication) { LibItsDenm__TypesAndValues::UtDenmResults res; decode(data, res, params); @@ -240,7 +240,7 @@ std::unique_ptr uppertester_denm_codec::decode(const OCTETSTRING &dat int uppertester_denm_codec::decode(const OCTETSTRING &data, LibItsDenm__TypesAndValues::UtDenmResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_denm_codec::decode: decoding_buffer=", data); - const unsigned char *ptr = static_cast(data); + const uint8_t *ptr = static_cast(data); if (*ptr == uppertester_denm_codec::c_utDenmInitializeResult) { msg.utDenmInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); } else if (*ptr == uppertester_denm_codec::c_utDenmChangePositionResult) { @@ -285,7 +285,7 @@ int uppertester_denm_codec::decode(const OCTETSTRING &data, LibItsDenm__TypesAnd int uppertester_denm_codec::decode(const OCTETSTRING &data, LibItsDenm__TypesAndValues::UtDenmEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_denm_codec::decode (1): decoding_buffer=", data); - const unsigned char *ptr = static_cast(data) + 1; + const uint8_t *ptr = static_cast(data) + 1; OCTETSTRING os(2, ptr); ptr += 2; unsigned int length = oct2int(os); diff --git a/ccsrc/Protocols/UpperTester/uppertester_denm_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_denm_codec.hh index 6f5015d..6f29df7 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_denm_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_denm_codec.hh @@ -27,19 +27,19 @@ namespace LibItsDenm__TypesAndValues { class uppertester_denm_codec : public codec { public: - static unsigned char c_utDenmInitialize; - static unsigned char c_utDenmInitializeResult; - static unsigned char c_utDenmChangePosition; - static unsigned char c_utDenmChangePositionResult; - static unsigned char c_utDenmChangePseudonym; - static unsigned char c_utDenmChangePseudonymResult; - static unsigned char c_utDenmTrigger; - static unsigned char c_utDenmTriggerResult; - static unsigned char c_utDenmUpdate; - static unsigned char c_utDenmUpdateResult; - static unsigned char c_utDenmTermination; - static unsigned char c_utDenmTerminationResult; - static unsigned char c_utDenmEventIndication; + static uint8_t c_utDenmInitialize; + static uint8_t c_utDenmInitializeResult; + static uint8_t c_utDenmChangePosition; + static uint8_t c_utDenmChangePositionResult; + static uint8_t c_utDenmChangePseudonym; + static uint8_t c_utDenmChangePseudonymResult; + static uint8_t c_utDenmTrigger; + static uint8_t c_utDenmTriggerResult; + static uint8_t c_utDenmUpdate; + static uint8_t c_utDenmUpdateResult; + static uint8_t c_utDenmTermination; + static uint8_t c_utDenmTerminationResult; + static uint8_t c_utDenmEventIndication; int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); diff --git a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_codec.cc index fc0d6fe..488761f 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_codec.cc @@ -10,17 +10,19 @@ template class OPTIONAL; class TTCN_EncDec; -unsigned char uppertester_geonetworking_codec::c_utGnInitialize = 0x00; -unsigned char uppertester_geonetworking_codec::c_utGnInitializeResult = 0x01; -unsigned char uppertester_geonetworking_codec::c_utGnChangePosition = 0x02; -unsigned char uppertester_geonetworking_codec::c_utGnChangePositionResult = 0x03; -unsigned char uppertester_geonetworking_codec::c_utGnTriggerResult = 0x41; -unsigned char uppertester_geonetworking_codec::c_utGnTrigger_GeoUnicast = 0x50; -unsigned char uppertester_geonetworking_codec::c_utGnTrigger_GeoBroadcast = 0x51; -unsigned char uppertester_geonetworking_codec::c_utGnTrigger_GeoAnycast = 0x52; -unsigned char uppertester_geonetworking_codec::c_utGnTrigger_Shb = 0x53; -unsigned char uppertester_geonetworking_codec::c_utGnTrigger_Tsb = 0x54; -unsigned char uppertester_geonetworking_codec::c_utGnEventIndication = 0x55; +uint8_t uppertester_geonetworking_codec::c_utGnInitialize = 0x00; +uint8_t uppertester_geonetworking_codec::c_utGnInitializeResult = 0x01; +uint8_t uppertester_geonetworking_codec::c_utGnChangePosition = 0x02; +uint8_t uppertester_geonetworking_codec::c_utGnChangePositionResult = 0x03; +uint8_t uppertester_geonetworking_codec::c_utGnTriggerResult = 0x41; +uint8_t uppertester_geonetworking_codec::c_utGnTrigger_GeoUnicast = 0x50; +uint8_t uppertester_geonetworking_codec::c_utGnTrigger_GeoBroadcast = 0x51; +uint8_t uppertester_geonetworking_codec::c_utGnTrigger_GeoAnycast = 0x52; +uint8_t uppertester_geonetworking_codec::c_utGnTrigger_Shb = 0x53; +uint8_t uppertester_geonetworking_codec::c_utGnTrigger_Tsb = 0x54; +uint8_t uppertester_geonetworking_codec::c_utGnEventIndication = 0x55; +uint8_t uppertester_geonetworking_codec::c_utGnChangePseudonym = 0x56; +uint8_t uppertester_geonetworking_codec::c_utGnChangePseudonymResult = 0x57; int uppertester_geonetworking_codec::encode(const Record_Type &msg, OCTETSTRING &data) { loggers::get_instance().log_msg(">>> uppertester_geonetworking_codec::encode: ", (const Record_Type &)msg); @@ -28,9 +30,9 @@ int uppertester_geonetworking_codec::encode(const Record_Type &msg, OCTETSTRING TTCN_EncDec::clear_error(); TTCN_Buffer encoding_buffer; if (std::string(msg.get_descriptor()->name).compare("@LibItsGeoNetworking_TypesAndValues.UtGnInitialize") == 0) { - encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnInitialize)); + encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnInitialize)); } else if (std::string(msg.get_descriptor()->name).compare("@LibItsGeoNetworking_TypesAndValues.UtGnChangePosition") == 0) { - encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnChangePosition)); + encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnChangePosition)); } else { // Error data = OCTETSTRING(0, nullptr); return -1; @@ -53,19 +55,19 @@ int uppertester_geonetworking_codec::encode(const Base_Type &msg, OCTETSTRING &d const LibItsGeoNetworking__TypesAndValues::UtGnTrigger &t = static_cast(msg); loggers::get_instance().log("uppertester_geonetworking_codec::encode: After cast: %s", t.get_descriptor()->name); if (t.ischosen(LibItsGeoNetworking__TypesAndValues::UtGnTrigger::ALT_geoUnicast)) { - encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnTrigger_GeoUnicast)); + encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnTrigger_GeoUnicast)); type = (Base_Type *)&(t.geoUnicast()); } else if (t.ischosen(LibItsGeoNetworking__TypesAndValues::UtGnTrigger::ALT_geoBroadcast)) { - encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnTrigger_GeoBroadcast)); + encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnTrigger_GeoBroadcast)); type = (Base_Type *)&(t.geoBroadcast()); } else if (t.ischosen(LibItsGeoNetworking__TypesAndValues::UtGnTrigger::ALT_geoAnycast)) { - encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnTrigger_GeoAnycast)); + encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnTrigger_GeoAnycast)); type = (Base_Type *)&(t.geoAnycast()); } else if (t.ischosen(LibItsGeoNetworking__TypesAndValues::UtGnTrigger::ALT_shb)) { - encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnTrigger_Shb)); + encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnTrigger_Shb)); type = (Base_Type *)&(t.shb()); } else if (t.ischosen(LibItsGeoNetworking__TypesAndValues::UtGnTrigger::ALT_tsb)) { - encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnTrigger_Tsb)); + encoding_buffer.put_c(static_cast(uppertester_geonetworking_codec::c_utGnTrigger_Tsb)); type = (Base_Type *)&(t.tsb()); } // else, nothing to do } else { @@ -101,10 +103,10 @@ int uppertester_geonetworking_codec::encode_(const Base_Type &type, const TTCN_T } else { std::string s(field_descriptor.name); if (s.rfind(".shape") != string::npos) { - encoding_buffer.put_c((unsigned char)static_cast(type).as_int()); + encoding_buffer.put_c((uint8_t)static_cast(type).as_int()); } else if (s.rfind(".payload") != string::npos) { const OCTETSTRING & os = static_cast(type); - const unsigned char s[] = {(unsigned char)((os.lengthof() & 0x0000FF00) >> 8), (unsigned char)os.lengthof()}; + const uint8_t s[] = {(uint8_t)((os.lengthof() & 0x0000FF00) >> 8), (uint8_t)os.lengthof()}; encoding_buffer.put_s(2, s); if (os.lengthof() != 0) { encoding_buffer.put_string(os); @@ -138,7 +140,7 @@ std::unique_ptr uppertester_geonetworking_codec::decode(const OCTETST std::unique_ptr result; - const unsigned char *ptr = static_cast(data); + const uint8_t *ptr = static_cast(data); if ((*ptr == uppertester_geonetworking_codec::c_utGnInitializeResult) || (*ptr == uppertester_geonetworking_codec::c_utGnChangePositionResult) || (*ptr == uppertester_geonetworking_codec::c_utGnTriggerResult)) { LibItsGeoNetworking__TypesAndValues::UtGnResults res; @@ -158,7 +160,7 @@ std::unique_ptr uppertester_geonetworking_codec::decode(const OCTETST int uppertester_geonetworking_codec::decode(const OCTETSTRING &data, LibItsGeoNetworking__TypesAndValues::UtGnResults &msg, params_its *params) { loggers::get_instance().log_msg(">>> uppertester_geonetworking_codec::decode (3): ", data); - const unsigned char *ptr = static_cast(data); + const uint8_t *ptr = static_cast(data); if (*ptr == uppertester_geonetworking_codec::c_utGnInitializeResult) { msg.utGnInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); } else if (*ptr == uppertester_geonetworking_codec::c_utGnChangePositionResult) { @@ -190,7 +192,7 @@ int uppertester_geonetworking_codec::decode(const OCTETSTRING &data, LibItsGeoNe return -1; } - msg.rawPayload() = OCTETSTRING(length, 3 + static_cast(data)); + msg.rawPayload() = OCTETSTRING(length, 3 + static_cast(data)); loggers::get_instance().log_msg("<<< uppertester_geonetworking_codec::decode (4): ", msg); return 0; diff --git a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_codec.hh index 1dda67e..9481ba1 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_codec.hh @@ -27,17 +27,19 @@ namespace LibItsGeoNetworking__TypesAndValues { class uppertester_geonetworking_codec : public codec { public: - static unsigned char c_utGnInitialize; - static unsigned char c_utGnInitializeResult; - static unsigned char c_utGnChangePosition; - static unsigned char c_utGnChangePositionResult; - static unsigned char c_utGnTriggerResult; - static unsigned char c_utGnTrigger_GeoUnicast; - static unsigned char c_utGnTrigger_GeoBroadcast; - static unsigned char c_utGnTrigger_GeoAnycast; - static unsigned char c_utGnTrigger_Shb; - static unsigned char c_utGnTrigger_Tsb; - static unsigned char c_utGnEventIndication; + static uint8_t c_utGnInitialize; + static uint8_t c_utGnInitializeResult; + static uint8_t c_utGnChangePosition; + static uint8_t c_utGnChangePositionResult; + static uint8_t c_utGnChangePseudonym; + static uint8_t c_utGnChangePseudonymResult; + static uint8_t c_utGnTriggerResult; + static uint8_t c_utGnTrigger_GeoUnicast; + static uint8_t c_utGnTrigger_GeoBroadcast; + static uint8_t c_utGnTrigger_GeoAnycast; + static uint8_t c_utGnTrigger_Shb; + static uint8_t c_utGnTrigger_Tsb; + static uint8_t c_utGnEventIndication; private: int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); diff --git a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.cc b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.cc index 8e839a1..d3ff227 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_geonetworking_layer.cc @@ -35,14 +35,14 @@ void uppertester_geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAn void uppertester_geonetworking_layer::sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnChangePosition &send_par, params_its &p_params) { loggers::get_instance().log_msg(">>> uppertester_geonetworking_layer::sendMsg", send_par); - if (_params[params::loopback].compare("1") == 0) { + if (_params[params_its::loopback].compare("1") == 0) { LibItsGeoNetworking__TypesAndValues::UtGnResults ut_gn_results; ut_gn_results.utGnChangePositionResult() = BOOLEAN(true); to_all_upper_ports(ut_gn_results, p_params); } else { // Encode UpperTester PDU OCTETSTRING data; - _codec.encode(static_cast(send_par), data); + _codec.encode((const Record_Type &)send_par, data); // Update parameters send_data(data, p_params); } diff --git a/ccsrc/Protocols/UpperTester/uppertester_ivim_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_ivim_codec.cc index ede8af8..2129db5 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_ivim_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_ivim_codec.cc @@ -12,15 +12,15 @@ template class OPTIONAL; class TTCN_EncDec; -unsigned char uppertester_ivim_codec::c_utIvimInitialize = 0x00; -unsigned char uppertester_ivim_codec::c_utIvimInitializeResult = 0x01; -unsigned char uppertester_ivim_codec::c_utIvimTrigger = 0x80; -unsigned char uppertester_ivim_codec::c_utIvimTriggerResult = 0x81; -unsigned char uppertester_ivim_codec::c_utIvimUpdate = 0x82; -unsigned char uppertester_ivim_codec::c_utIvimUpdateResult = 0x83; -unsigned char uppertester_ivim_codec::c_utIvimTermination = 0x84; -unsigned char uppertester_ivim_codec::c_utIvimTerminationResult = 0x85; -unsigned char uppertester_ivim_codec::c_utIvimEventIndication = 0x86; +uint8_t uppertester_ivim_codec::c_utIvimInitialize = 0x00; +uint8_t uppertester_ivim_codec::c_utIvimInitializeResult = 0x01; +uint8_t uppertester_ivim_codec::c_utIvimTrigger = 0x80; +uint8_t uppertester_ivim_codec::c_utIvimTriggerResult = 0x81; +uint8_t uppertester_ivim_codec::c_utIvimUpdate = 0x82; +uint8_t uppertester_ivim_codec::c_utIvimUpdateResult = 0x83; +uint8_t uppertester_ivim_codec::c_utIvimTermination = 0x84; +uint8_t uppertester_ivim_codec::c_utIvimTerminationResult = 0x85; +uint8_t uppertester_ivim_codec::c_utIvimEventIndication = 0x86; int uppertester_ivim_codec::encode(const Record_Type &msg, OCTETSTRING &data) { loggers::get_instance().log_msg(">>> uppertester_ivim_codec::encode: ", (const Record_Type &)msg); @@ -28,9 +28,9 @@ int uppertester_ivim_codec::encode(const Record_Type &msg, OCTETSTRING &data) { TTCN_EncDec::clear_error(); TTCN_Buffer encoding_buffer; if (std::string(msg.get_descriptor()->name).compare("@LibItsIvim_TypesAndValues.UtIvimInitialize") == 0) { - encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimInitialize)); + encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimInitialize)); } else if (std::string(msg.get_descriptor()->name).compare("@LibItsIvim_TypesAndValues.UtIvimTrigger") == 0) { - encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimTrigger)); + encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimTrigger)); // See ETSI TR 103 099 V1.4.1 Clause C.9.1 GenerateIvimEvent unsigned short flags = 0x0000; const LibItsIvim__TypesAndValues::UtIvimTrigger &r = static_cast(msg); @@ -67,14 +67,14 @@ int uppertester_ivim_codec::encode(const Record_Type &msg, OCTETSTRING &data) { if (r.layoutId().is_present()) { // Y flags |= 0x0020; } - encoding_buffer.put_c(static_cast((flags >> 8) & 0xFF)); - encoding_buffer.put_c(static_cast(flags & 0x00FF)); + encoding_buffer.put_c(static_cast((flags >> 8) & 0xFF)); + encoding_buffer.put_c(static_cast(flags & 0x00FF)); loggers::get_instance().log_to_hexa("uppertester_ivim_codec::encode: flags=", encoding_buffer); // Continue with encoding } else if (std::string(msg.get_descriptor()->name).compare("@LibItsIvim_TypesAndValues.UtIvimUpdate") == 0) { - encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimUpdate)); + encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimUpdate)); // See ETSI TR 103 099 V1.4.1 Clause C.9.2 UpdateIvimEvent - unsigned char flags = 0x00; + uint8_t flags = 0x00; const LibItsIvim__TypesAndValues::UtIvimUpdate &r = static_cast(msg); if (r.validFrom().is_present()) { // V flags |= 0x80; @@ -93,7 +93,7 @@ int uppertester_ivim_codec::encode(const Record_Type &msg, OCTETSTRING &data) { // Continue with encoding } else if (std::string(msg.get_descriptor()->name).compare("@LibItsIvim_TypesAndValues.UtIvimTermination") == 0) { // See ETSI TR 103 099 V1.4.1 Clause C.9.3 TerminateIvimEvent - encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimTermination)); + encoding_buffer.put_c(static_cast(uppertester_ivim_codec::c_utIvimTermination)); } else { // Error data = OCTETSTRING(0, nullptr); loggers::get_instance().log("<<< uppertester_ivim_codec::encode: Return -1"); @@ -126,14 +126,14 @@ int uppertester_ivim_codec::encode_(const Base_Type &type, const TTCN_Typedescri loggers::get_instance().log("uppertester_ivim_codec::encode_: Padding for %s", field_descriptor.name); if ((s.rfind(".timeStamp") != string::npos) || (s.rfind(".validFrom") != string::npos) || (s.rfind(".validTo") != string::npos) || (s.rfind(".repetitionInterval") != string::npos)) { // Pad with six bytes - encoding_buffer.put_c((unsigned char)0x00); - encoding_buffer.put_c((unsigned char)0x00); - encoding_buffer.put_c((unsigned char)0x00); - encoding_buffer.put_c((unsigned char)0x00); - encoding_buffer.put_c((unsigned char)0x00); - encoding_buffer.put_c((unsigned char)0x00); + encoding_buffer.put_c((uint8_t)0x00); + encoding_buffer.put_c((uint8_t)0x00); + encoding_buffer.put_c((uint8_t)0x00); + encoding_buffer.put_c((uint8_t)0x00); + encoding_buffer.put_c((uint8_t)0x00); + encoding_buffer.put_c((uint8_t)0x00); } else { // Pad with one bytes - encoding_buffer.put_c((unsigned char)0x00); + encoding_buffer.put_c((uint8_t)0x00); } } } // End of 'for' statement @@ -157,7 +157,7 @@ int uppertester_ivim_codec::encode_(const Base_Type &type, const TTCN_Typedescri if (type.is_present()) { const OPTIONAL &o = dynamic_cast &>(type); const PreGenRecordOf::PREGEN__RECORD__OF__INTEGER &rov = dynamic_cast(*o.get_opt_value()); - encoding_buffer.put_c(static_cast(rov.lengthof())); + encoding_buffer.put_c(static_cast(rov.lengthof())); for (int i = 0; i < rov.lengthof(); i++) { const INTEGER &r = rov[i]; loggers::get_instance().log_msg("uppertester_ivim_codec::encode_: r=", r); @@ -168,7 +168,7 @@ int uppertester_ivim_codec::encode_(const Base_Type &type, const TTCN_Typedescri if (type.is_present()) { const OPTIONAL &o = dynamic_cast &>(type); const PreGenRecordOf::PREGEN__RECORD__OF__INTEGER &rov = dynamic_cast(*o.get_opt_value()); - encoding_buffer.put_c(static_cast(rov.lengthof())); + encoding_buffer.put_c(static_cast(rov.lengthof())); for (int i = 0; i < rov.lengthof(); i++) { const INTEGER &r = rov[i]; loggers::get_instance().log_msg("uppertester_ivim_codec::encode_: r=", r); @@ -209,7 +209,7 @@ std::unique_ptr uppertester_ivim_codec::decode(const OCTETSTRING &dat std::unique_ptr result; - const unsigned char *ptr = static_cast(data); + const uint8_t *ptr = static_cast(data); if (*ptr != uppertester_ivim_codec::c_utIvimEventIndication) { LibItsIvim__TypesAndValues::UtIvimResults res; decode(data, res, params); @@ -226,7 +226,7 @@ std::unique_ptr uppertester_ivim_codec::decode(const OCTETSTRING &dat int uppertester_ivim_codec::decode(const OCTETSTRING &data, LibItsIvim__TypesAndValues::UtIvimResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_ivim_codec::decode: decoding_buffer=", data); - const unsigned char *ptr = static_cast(data); + const uint8_t *ptr = static_cast(data); if (*ptr == uppertester_ivim_codec::c_utIvimInitializeResult) { msg.utIvimInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); } else if (*ptr == uppertester_ivim_codec::c_utIvimTerminationResult) { @@ -263,7 +263,7 @@ int uppertester_ivim_codec::decode(const OCTETSTRING &data, LibItsIvim__TypesAnd int uppertester_ivim_codec::decode(const OCTETSTRING &data, LibItsIvim__TypesAndValues::UtIvimEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_ivim_codec::decode: decoding_buffer=", data); - const unsigned char *ptr = static_cast(data) + 1; + const uint8_t *ptr = static_cast(data) + 1; OCTETSTRING os(2, ptr); ptr += 2; unsigned int length = oct2int(os); diff --git a/ccsrc/Protocols/UpperTester/uppertester_ivim_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_ivim_codec.hh index c97b370..7099b8f 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_ivim_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_ivim_codec.hh @@ -27,15 +27,15 @@ namespace LibItsIvim__TypesAndValues { class uppertester_ivim_codec : public codec { public: - static unsigned char c_utIvimInitialize; - static unsigned char c_utIvimInitializeResult; - static unsigned char c_utIvimTrigger; - static unsigned char c_utIvimTriggerResult; - static unsigned char c_utIvimUpdate; - static unsigned char c_utIvimUpdateResult; - static unsigned char c_utIvimTermination; - static unsigned char c_utIvimTerminationResult; - static unsigned char c_utIvimEventIndication; + static uint8_t c_utIvimInitialize; + static uint8_t c_utIvimInitializeResult; + static uint8_t c_utIvimTrigger; + static uint8_t c_utIvimTriggerResult; + static uint8_t c_utIvimUpdate; + static uint8_t c_utIvimUpdateResult; + static uint8_t c_utIvimTermination; + static uint8_t c_utIvimTerminationResult; + static uint8_t c_utIvimEventIndication; int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); diff --git a/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_codec.cc index d31780d..8c526f2 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_codec.cc @@ -13,12 +13,12 @@ template class OPTIONAL; class TTCN_EncDec; -unsigned char uppertester_mapem_spatem_codec::c_utMapemSpatemInitialize = 0x00; -unsigned char uppertester_mapem_spatem_codec::c_utMapemSpatemInitializeResult = 0x01; -unsigned char uppertester_mapem_spatem_codec::c_utMapemSpatemTrigger = 0x7A; -unsigned char uppertester_mapem_spatem_codec::c_utMapemSpatemTriggerResult = 0x7B; -unsigned char uppertester_mapem_spatem_codec::c_utMapemEventIndication = 0x7C; -unsigned char uppertester_mapem_spatem_codec::c_utSpatemEventIndication = 0x7D; +uint8_t uppertester_mapem_spatem_codec::c_utMapemSpatemInitialize = 0x00; +uint8_t uppertester_mapem_spatem_codec::c_utMapemSpatemInitializeResult = 0x01; +uint8_t uppertester_mapem_spatem_codec::c_utMapemSpatemTrigger = 0x7A; +uint8_t uppertester_mapem_spatem_codec::c_utMapemSpatemTriggerResult = 0x7B; +uint8_t uppertester_mapem_spatem_codec::c_utMapemEventIndication = 0x7C; +uint8_t uppertester_mapem_spatem_codec::c_utSpatemEventIndication = 0x7D; int uppertester_mapem_spatem_codec::encode(const Record_Type &msg, OCTETSTRING &data) { loggers::get_instance().log_msg(">>> uppertester_mapem_spatem_codec::encode: ", (const Record_Type &)msg); @@ -26,11 +26,11 @@ int uppertester_mapem_spatem_codec::encode(const Record_Type &msg, OCTETSTRING & TTCN_EncDec::clear_error(); TTCN_Buffer encoding_buffer; if (std::string(msg.get_descriptor()->name).compare("@LibItsMapemSpatem_TypesAndValues.UtMapemSpatemInitialize") == 0) { - encoding_buffer.put_c(static_cast(uppertester_mapem_spatem_codec::c_utMapemSpatemInitialize)); + encoding_buffer.put_c(static_cast(uppertester_mapem_spatem_codec::c_utMapemSpatemInitialize)); } else if (std::string(msg.get_descriptor()->name).compare("@LibItsMapemSpatem_TypesAndValues.UtMapemSpatemTrigger") == 0) { - encoding_buffer.put_c(static_cast(uppertester_mapem_spatem_codec::c_utMapemSpatemTrigger)); + encoding_buffer.put_c(static_cast(uppertester_mapem_spatem_codec::c_utMapemSpatemTrigger)); // See ETSI TR 103 099 V1.4.1 Clause C.9.1 GenerateMapemSpatemEvent - unsigned char flags = 0x00; + uint8_t flags = 0x00; const LibItsMapemSpatem__TypesAndValues::UtMapemSpatemTrigger &r = static_cast(msg); if (r.intersectionID().is_present()) { // F flags |= 0x80; @@ -71,12 +71,12 @@ int uppertester_mapem_spatem_codec::encode_(const Base_Type &type, const TTCN_Ty std::string s(r.fld_descr(i)->name); loggers::get_instance().log("uppertester_mapem_spatem_codec::encode_: Padding for %s", field_descriptor.name); if (s.rfind(".intersectionID") != string::npos) { // Pad with two bytes - encoding_buffer.put_c((unsigned char)0x00); - encoding_buffer.put_c((unsigned char)0x00); + encoding_buffer.put_c((uint8_t)0x00); + encoding_buffer.put_c((uint8_t)0x00); } else if (s.rfind(".regulatorySpeedLimit") != string::npos) { // Pad with three bytes - encoding_buffer.put_c((unsigned char)0x00); - encoding_buffer.put_c((unsigned char)0x00); - encoding_buffer.put_c((unsigned char)0x00); + encoding_buffer.put_c((uint8_t)0x00); + encoding_buffer.put_c((uint8_t)0x00); + encoding_buffer.put_c((uint8_t)0x00); } } } // End of 'for' statement @@ -90,7 +90,7 @@ int uppertester_mapem_spatem_codec::encode_(const Base_Type &type, const TTCN_Ty const INTEGER & iv = dynamic_cast(*o.get_opt_value()); loggers::get_instance().log_msg("uppertester_mapem_spatem_codec::encode_: iv=", iv); OCTETSTRING os = int2oct(iv, 2); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); } } else if (s.rfind(".regulatorySpeedLimit") == 0) { if (type.is_present()) { @@ -98,10 +98,10 @@ int uppertester_mapem_spatem_codec::encode_(const Base_Type &type, const TTCN_Ty dynamic_cast &>(type); const DSRC__noCircular::RegulatorySpeedLimit &rv = dynamic_cast(*o.get_opt_value()); const int t = rv.type__().as_int(); - encoding_buffer.put_c((unsigned char)t); + encoding_buffer.put_c((uint8_t)t); const int s = rv.speed(); OCTETSTRING os = int2oct(s, 2); - encoding_buffer.put_s(os.lengthof(), static_cast(os)); + encoding_buffer.put_s(os.lengthof(), static_cast(os)); } } else { loggers::get_instance().log("uppertester_mapem_spatem_codec::encode_ (else): processing type %s/%s", type.get_descriptor()->name, field_descriptor.name); @@ -129,7 +129,7 @@ std::unique_ptr uppertester_mapem_spatem_codec::decode(const OCTETSTR std::unique_ptr result; - const unsigned char *ptr = static_cast(data); + const uint8_t *ptr = static_cast(data); if ((*ptr != uppertester_mapem_spatem_codec::c_utMapemEventIndication) && (*ptr != uppertester_mapem_spatem_codec::c_utSpatemEventIndication)) { LibItsMapemSpatem__TypesAndValues::UtMapemSpatemResults res; decode(data, res, params); @@ -150,7 +150,7 @@ std::unique_ptr uppertester_mapem_spatem_codec::decode(const OCTETSTR int uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, LibItsMapemSpatem__TypesAndValues::UtMapemSpatemResults &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_mapem_spatem_codec::decode: decoding_buffer=", data); - const unsigned char *ptr = static_cast(data); + const uint8_t *ptr = static_cast(data); if (*ptr == uppertester_mapem_spatem_codec::c_utMapemSpatemInitializeResult) { msg.utMapemSpatemInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); } else if (*ptr == uppertester_mapem_spatem_codec::c_utMapemSpatemTriggerResult) { @@ -166,7 +166,7 @@ int uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, LibItsMapemS int uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, LibItsMapemSpatem__TypesAndValues::UtMapemEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_mapem_spatem_codec::decode: decoding_buffer=", data); - const unsigned char *ptr = static_cast(data) + 1; + const uint8_t *ptr = static_cast(data) + 1; OCTETSTRING os(2, ptr); ptr += 2; unsigned int length = oct2int(os); @@ -183,7 +183,7 @@ int uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, LibItsMapemS int uppertester_mapem_spatem_codec::decode(const OCTETSTRING &data, LibItsMapemSpatem__TypesAndValues::UtSpatemEventInd &msg, params_its *params) { loggers::get_instance().log_to_hexa(">>> uppertester_mapem_spatem_codec::decode: decoding_buffer=", data); - const unsigned char *ptr = static_cast(data) + 1; + const uint8_t *ptr = static_cast(data) + 1; OCTETSTRING os(2, ptr); ptr += 2; unsigned int length = oct2int(os); diff --git a/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_codec.hh index 6e59a04..3f64f3b 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_mapem_spatem_codec.hh @@ -28,12 +28,12 @@ namespace LibItsMapemSpatem__TypesAndValues { class uppertester_mapem_spatem_codec : public codec { public: - static unsigned char c_utMapemSpatemInitialize; - static unsigned char c_utMapemSpatemInitializeResult; - static unsigned char c_utMapemSpatemTrigger; - static unsigned char c_utMapemSpatemTriggerResult; - static unsigned char c_utMapemEventIndication; - static unsigned char c_utSpatemEventIndication; + static uint8_t c_utMapemSpatemInitialize; + static uint8_t c_utMapemSpatemInitializeResult; + static uint8_t c_utMapemSpatemTrigger; + static uint8_t c_utMapemSpatemTriggerResult; + static uint8_t c_utMapemEventIndication; + static uint8_t c_utSpatemEventIndication; int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); diff --git a/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.cc index 0ee0858..7641022 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.cc @@ -12,11 +12,11 @@ template class OPTIONAL; class TTCN_EncDec; -unsigned char uppertester_mbr_codec::c_utMbrInitialize = 0x00; -unsigned char uppertester_mbr_codec::c_utMbrInitializeResult = 0x01; -unsigned char uppertester_mbr_codec::c_utMbrTrigger = 0xF0; -unsigned char uppertester_mbr_codec::c_utMbrTriggerResult = 0xF1; -unsigned char uppertester_mbr_codec::c_utMbrEventInd = 0xF2; +uint8_t uppertester_mbr_codec::c_utMbrInitialize = 0x00; +uint8_t uppertester_mbr_codec::c_utMbrInitializeResult = 0x01; +uint8_t uppertester_mbr_codec::c_utMbrTrigger = 0xF0; +uint8_t uppertester_mbr_codec::c_utMbrTriggerResult = 0xF1; +uint8_t uppertester_mbr_codec::c_utMbrEventInd = 0xF2; int uppertester_mbr_codec::encode(const Record_Type &msg, OCTETSTRING &data) { loggers::get_instance().log_msg(">>> uppertester_mbr_codec::encode (1): ", (const Record_Type &)msg); @@ -24,7 +24,7 @@ int uppertester_mbr_codec::encode(const Record_Type &msg, OCTETSTRING &data) { TTCN_EncDec::clear_error(); TTCN_Buffer encoding_buffer; if (std::string(msg.get_descriptor()->name).compare("@LibItsMbr_TypesAndValues.UtMbrInitialize") == 0) { - encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrInitialize)); + encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrInitialize)); } else { // Error data = OCTETSTRING(0, nullptr); loggers::get_instance().warning("<<< uppertester_mbr_codec::encode: Failed to encode UT message"); @@ -42,9 +42,9 @@ int uppertester_mbr_codec::encode(const LibItsMbr__TypesAndValues::UtMbrTrigger TTCN_EncDec::clear_error(); TTCN_Buffer encoding_buffer; // const Record_Type *type; - encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrTrigger)); - encoding_buffer.put_c(static_cast(msg.targetId())); - encoding_buffer.put_c(static_cast(msg.cause())); + encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrTrigger)); + encoding_buffer.put_c(static_cast(msg.targetId())); + encoding_buffer.put_c(static_cast(msg.cause())); data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); loggers::get_instance().log_msg("<<< uppertester_mbr_codec::encode: data=", data); return 0; @@ -56,9 +56,9 @@ int uppertester_mbr_codec::encode(const LibItsMbr__TypesAndValues::UtMbrEventInd TTCN_EncDec::clear_error(); TTCN_Buffer encoding_buffer; // const Record_Type *type; - encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrEventInd)); + encoding_buffer.put_c(static_cast(uppertester_mbr_codec::c_utMbrEventInd)); loggers::get_instance().error("uppertester_mbr_codec::encode: To be implemented"); -// encoding_buffer.put_c(static_cast(msg.state())); +// encoding_buffer.put_c(static_cast(msg.state())); data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); loggers::get_instance().log_msg("<<< uppertester_mbr_codec::encode: data=", data); return 0; @@ -114,7 +114,7 @@ std::unique_ptr uppertester_mbr_codec::decode(const OCTETSTRING &data std::unique_ptr result; - const unsigned char * ptr = static_cast(data); + const uint8_t * ptr = static_cast(data); if (*ptr == uppertester_mbr_codec::c_utMbrInitializeResult) { LibItsMbr__TypesAndValues::UtMbrResults msg; msg.utMbrInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); diff --git a/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.hh index 4876df9..3d5c137 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_mbr_codec.hh @@ -28,11 +28,11 @@ namespace LibItsMbr__TypesAndValues { class uppertester_mbr_codec : public codec { public: - static unsigned char c_utMbrInitialize; - static unsigned char c_utMbrInitializeResult; - static unsigned char c_utMbrTriggerResult; - static unsigned char c_utMbrEventInd; - static unsigned char c_utMbrTrigger; + static uint8_t c_utMbrInitialize; + static uint8_t c_utMbrInitializeResult; + static uint8_t c_utMbrTriggerResult; + static uint8_t c_utMbrEventInd; + static uint8_t c_utMbrTrigger; private: int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); diff --git a/ccsrc/Protocols/UpperTester/uppertester_pki_codec.cc b/ccsrc/Protocols/UpperTester/uppertester_pki_codec.cc index dba1323..b8a1ee1 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_pki_codec.cc +++ b/ccsrc/Protocols/UpperTester/uppertester_pki_codec.cc @@ -12,12 +12,12 @@ template class OPTIONAL; class TTCN_EncDec; -unsigned char uppertester_pki_codec::c_utPkiInitialize = 0x00; -unsigned char uppertester_pki_codec::c_utPkiInitializeResult = 0x01; -unsigned char uppertester_pki_codec::c_utPkiTriggerEnrolmentRequest = 0xD0; -unsigned char uppertester_pki_codec::c_utPkiTriggerAuthorizationRequest = 0xD1; -unsigned char uppertester_pki_codec::c_utPkiTriggerResult = 0xD2; -unsigned char uppertester_pki_codec::c_utPkiTriggerInd = 0xD3; +uint8_t uppertester_pki_codec::c_utPkiInitialize = 0x00; +uint8_t uppertester_pki_codec::c_utPkiInitializeResult = 0x01; +uint8_t uppertester_pki_codec::c_utPkiTriggerEnrolmentRequest = 0xD0; +uint8_t uppertester_pki_codec::c_utPkiTriggerAuthorizationRequest = 0xD1; +uint8_t uppertester_pki_codec::c_utPkiTriggerResult = 0xD2; +uint8_t uppertester_pki_codec::c_utPkiTriggerInd = 0xD3; int uppertester_pki_codec::encode(const Record_Type &msg, OCTETSTRING &data) { loggers::get_instance().log_msg(">>> uppertester_pki_codec::encode (1): ", (const Record_Type &)msg); @@ -25,7 +25,7 @@ int uppertester_pki_codec::encode(const Record_Type &msg, OCTETSTRING &data) { TTCN_EncDec::clear_error(); TTCN_Buffer encoding_buffer; if (std::string(msg.get_descriptor()->name).compare("@LibItsPki_TypesAndValues.UtPkiInitialize") == 0) { - encoding_buffer.put_c(static_cast(uppertester_pki_codec::c_utPkiInitialize)); + encoding_buffer.put_c(static_cast(uppertester_pki_codec::c_utPkiInitialize)); } else { // Error data = OCTETSTRING(0, nullptr); loggers::get_instance().warning("<<< uppertester_pki_codec::encode: Failed to encode UT message"); @@ -45,15 +45,15 @@ int uppertester_pki_codec::encode(const LibItsPki__TypesAndValues::UtPkiTrigger // const Record_Type *type; const LibItsPki__TypesAndValues::UtPkiTrigger &u = static_cast(msg); if (u.ischosen(LibItsPki__TypesAndValues::UtPkiTrigger::ALT_triggerEnrolmentRequest)) { - encoding_buffer.put_c(static_cast(uppertester_pki_codec::c_utPkiTriggerEnrolmentRequest)); - /*encoding_buffer.put_c(static_cast(u.triggerEnrolmentRequest().cannonicalId().lengthof())); // Length of the string + encoding_buffer.put_c(static_cast(uppertester_pki_codec::c_utPkiTriggerEnrolmentRequest)); + /*encoding_buffer.put_c(static_cast(u.triggerEnrolmentRequest().cannonicalId().lengthof())); // Length of the string encoding_buffer.put_string(u.triggerEnrolmentRequest().cannonicalId()); encoding_buffer.put_os(u.triggerEnrolmentRequest().encAlgorithm()); // One byte encoding_buffer.put_os(u.triggerEnrolmentRequest().privateKey()); // 32 bytes encoding_buffer.put_os(u.triggerEnrolmentRequest().compressedPublickey()); //33 bytes */ } else if (u.ischosen(LibItsPki__TypesAndValues::UtPkiTrigger::ALT_triggerAuthorizationRequest)) { - encoding_buffer.put_c(static_cast(uppertester_pki_codec::c_utPkiTriggerAuthorizationRequest)); + encoding_buffer.put_c(static_cast(uppertester_pki_codec::c_utPkiTriggerAuthorizationRequest)); } else { // Error data = OCTETSTRING(0, nullptr); loggers::get_instance().warning("<<< uppertester_pki_codec::encode: Failed to encode UT message"); @@ -71,8 +71,8 @@ int uppertester_pki_codec::encode(const LibItsPki__TypesAndValues::UtPkiTriggerI TTCN_EncDec::clear_error(); TTCN_Buffer encoding_buffer; // const Record_Type *type; - encoding_buffer.put_c(static_cast(uppertester_pki_codec::c_utPkiTriggerInd)); - encoding_buffer.put_c(static_cast(msg.state())); + encoding_buffer.put_c(static_cast(uppertester_pki_codec::c_utPkiTriggerInd)); + encoding_buffer.put_c(static_cast(msg.state())); data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); loggers::get_instance().log_msg("<<< uppertester_pki_codec::encode: data=", data); return 0; @@ -128,7 +128,7 @@ std::unique_ptr uppertester_pki_codec::decode(const OCTETSTRING &data std::unique_ptr result; - const unsigned char * ptr = static_cast(data); + const uint8_t * ptr = static_cast(data); if (*ptr == uppertester_pki_codec::c_utPkiInitializeResult) { LibItsPki__TypesAndValues::UtPkiResults msg; msg.utPkiInitializeResult() = BOOLEAN(*(ptr + 1) == 0x01); diff --git a/ccsrc/Protocols/UpperTester/uppertester_pki_codec.hh b/ccsrc/Protocols/UpperTester/uppertester_pki_codec.hh index f1bc1ad..d039561 100644 --- a/ccsrc/Protocols/UpperTester/uppertester_pki_codec.hh +++ b/ccsrc/Protocols/UpperTester/uppertester_pki_codec.hh @@ -28,12 +28,12 @@ namespace LibItsPki__TypesAndValues { class uppertester_pki_codec : public codec { public: - static unsigned char c_utPkiInitialize; - static unsigned char c_utPkiInitializeResult; - static unsigned char c_utPkiTriggerResult; - static unsigned char c_utPkiTriggerEnrolmentRequest; - static unsigned char c_utPkiTriggerAuthorizationRequest; - static unsigned char c_utPkiTriggerInd; + static uint8_t c_utPkiInitialize; + static uint8_t c_utPkiInitializeResult; + static uint8_t c_utPkiTriggerResult; + static uint8_t c_utPkiTriggerEnrolmentRequest; + static uint8_t c_utPkiTriggerAuthorizationRequest; + static uint8_t c_utPkiTriggerInd; private: int encode_(const Base_Type &type, const TTCN_Typedescriptor_t &field_descriptor, TTCN_Buffer &encoding_buffer); diff --git a/etc/AtsCAM/AtsCAM_Yogoko.cf_ b/etc/AtsCAM/AtsCAM_Yogoko.cf_ index 5261362..5f00b86 100644 --- a/etc/AtsCAM/AtsCAM_Yogoko.cf_ +++ b/etc/AtsCAM/AtsCAM_Yogoko.cf_ @@ -100,7 +100,7 @@ LogEventTypes:= Yes # its_aid=138: MAP # its_aid=139: IVIM # its_aid=140: SREM/SSEM -# its_aid=141: GeoMet +# its_aid=141: GeoNet # its_aid=128: RTCMEM # its_aid=639: CPS diff --git a/etc/AtsCPS/AtsCPS_Simulator.cfg_ b/etc/AtsCPS/AtsCPS_Simulator.cfg_ index 6377daa..b6e3c30 100644 --- a/etc/AtsCPS/AtsCPS_Simulator.cfg_ +++ b/etc/AtsCPS/AtsCPS_Simulator.cfg_ @@ -95,7 +95,7 @@ LogEventTypes:= Yes # its_aid=138: MAP # its_aid=139: IVIM # its_aid=140: SREM/SSEM -# its_aid=141: GeoMet +# its_aid=141: GeoNet # its_aid=128: RTCMEM # its_aid=639: CPS diff --git a/etc/AtsMBR/AtsMBR.cfg b/etc/AtsMBR/AtsMBR.cfg index 66d1e01..d700ba0 100644 --- a/etc/AtsMBR/AtsMBR.cfg +++ b/etc/AtsMBR/AtsMBR.cfg @@ -130,7 +130,7 @@ LogEventTypes:= Yes # its_aid=138: MAP # its_aid=139: IVIM # its_aid=140: SREM/SSEM -# its_aid=141: GeoMet +# its_aid=141: GeoNet # its_aid=128: RTCMEM # its_aid=639: CPS diff --git a/etc/AtsMBR/AtsMBR_Simu.cfg_ b/etc/AtsMBR/AtsMBR_Simu.cfg_ index 88b9e05..fbf6f5a 100644 --- a/etc/AtsMBR/AtsMBR_Simu.cfg_ +++ b/etc/AtsMBR/AtsMBR_Simu.cfg_ @@ -127,7 +127,7 @@ LogEventTypes:= Yes # its_aid=138: MAP # its_aid=139: IVIM # its_aid=140: SREM/SSEM -# its_aid=141: GeoMet +# its_aid=141: GeoNet # its_aid=128: RTCMEM # Cygwin diff --git a/etc/AtsPki/AtsPki_Commsignia.cfg_ b/etc/AtsPki/AtsPki_Commsignia.cfg_ index 88f29cc..565fd17 100644 --- a/etc/AtsPki/AtsPki_Commsignia.cfg_ +++ b/etc/AtsPki/AtsPki_Commsignia.cfg_ @@ -147,7 +147,7 @@ LogEventTypes:= Yes # its_aid=138: MAP # its_aid=139: IVIM # its_aid=140: SREM/SSEM -# its_aid=141: GeoMet +# its_aid=141: GeoNet # its_aid=128: RTCMEM # its_aid=639: CPS diff --git a/etc/AtsSecurity/AtsSecurity.cfg b/etc/AtsSecurity/AtsSecurity.cfg index 7f94adb..a75f445 100644 --- a/etc/AtsSecurity/AtsSecurity.cfg +++ b/etc/AtsSecurity/AtsSecurity.cfg @@ -124,7 +124,7 @@ LogEventTypes:= Yes # its_aid=138: MAP # its_aid=139: IVIM # its_aid=140: SREM/SSEM -# its_aid=141: GeoMet +# its_aid=141: GeoNet # its_aid=128: RTCMEM # its_aid=639: CPS diff --git a/etc/AtsSecurity/AtsSecurity_codha.cf_ b/etc/AtsSecurity/AtsSecurity_codha.cf_ index 7a87578..325759d 100644 --- a/etc/AtsSecurity/AtsSecurity_codha.cf_ +++ b/etc/AtsSecurity/AtsSecurity_codha.cf_ @@ -124,7 +124,7 @@ LogEventTypes:= Yes # its_aid=138: MAP # its_aid=139: IVIM # its_aid=140: SREM/SSEM -# its_aid=141: GeoMet +# its_aid=141: GeoNet # its_aid=128: RTCMEM # Cygwin diff --git a/etc/AtsVRU/AtsVRU_Simulator.cfg_ b/etc/AtsVRU/AtsVRU_Simulator.cfg_ index eea34b3..09ab0b8 100644 --- a/etc/AtsVRU/AtsVRU_Simulator.cfg_ +++ b/etc/AtsVRU/AtsVRU_Simulator.cfg_ @@ -95,7 +95,7 @@ LogEventTypes:= Yes # its_aid=138: MAP # its_aid=139: IVIM # its_aid=140: SREM/SSEM -# its_aid=141: GeoMet +# its_aid=141: GeoNet # its_aid=128: RTCMEM # its_aid=639: CPS diff --git a/titan-test-system-framework b/titan-test-system-framework index 9d95325..ef63449 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit 9d95325ebf75eacf7f015da564c2576afcfb6d44 +Subproject commit ef6344980b87f3971363ad9b971f16dd43d8d0ba diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 72af849..078736a 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 72af849cc49c989fcb6f88dddfdeb75684ad02ed +Subproject commit 078736a9c6946220025f03c6ac11a69b06b72926 diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index ef09e0f..0aa44c7 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit ef09e0f3f2f773dc0c63c44da4436773106ec2bd +Subproject commit 0aa44c723578a181ee96c1cdc1663ca20a49d13c diff --git a/ttcn/AtsGeoNetworking b/ttcn/AtsGeoNetworking index e4bcaa7..dbe05aa 160000 --- a/ttcn/AtsGeoNetworking +++ b/ttcn/AtsGeoNetworking @@ -1 +1 @@ -Subproject commit e4bcaa7d6cfd9f15372f2888c714e838cc77a0cd +Subproject commit dbe05aa91c4b01c39bc544bafd6760d002a6327e diff --git a/ttcn/AtsPki b/ttcn/AtsPki index fa5ad23..6962655 160000 --- a/ttcn/AtsPki +++ b/ttcn/AtsPki @@ -1 +1 @@ -Subproject commit fa5ad235351c7f305c68e1cd62b511d74aca45dc +Subproject commit 6962655b6bd18c147cd73bc5fcdd3647a11132ac diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index a549039..d338f5d 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit a5490397adf1352a9df09233814e360568a2830c +Subproject commit d338f5d5200b45ed0f8c91327eb6b7f8379dd0d2 -- GitLab From c3953cdb693fcfa8991114fe4b187e57ce139dfa Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 26 Nov 2024 09:15:18 +0100 Subject: [PATCH 162/178] Update AtsCAM with CAMv2; Add missing certificate profiles; Uodate v2 certificate profiles for CAM --- TS.ITS_TTF_T036.code-workspace | 3 ++ .../profiles/CERT_IUT_A1_ATv2.xml | 2 +- .../profiles/CERT_IUT_A2_ATv2.xml | 2 +- .../profiles/CERT_IUT_A4_ATv2.xml | 2 +- .../profiles/CERT_IUT_A_AC_ATv2.xml | 2 +- .../profiles/CERT_IUT_A_AT_A8v2.xml | 2 +- .../profiles/CERT_IUT_A_AT_IMPv2.xml | 2 +- .../profiles/CERT_IUT_A_AT_LOC_OUTSIDEv2.xml | 2 +- ...CERT_IUT_A_AT_NO_EMERGENCY_CONTAINERv2.xml | 2 +- .../profiles/CERT_IUT_A_AT_PASTv2.xml | 2 +- .../certificates/profiles/CERT_IUT_A_ATv2.xml | 2 +- .../profiles/CERT_IUT_A_B33_ATv2.xml | 2 +- .../profiles/CERT_IUT_A_B3_ATv2.xml | 2 +- .../profiles/CERT_IUT_A_B3_N_ATv2.xml | 2 +- .../profiles/CERT_IUT_A_B_ATv2.xml | 2 +- .../profiles/CERT_IUT_A_B_N_ATv2.xml | 2 +- .../profiles/CERT_IUT_A_C3_ATv2.xml | 2 +- .../profiles/CERT_IUT_A_CC_ATv2.xml | 2 +- .../profiles/CERT_IUT_A_N_ATv2.xml | 2 +- .../certificates/profiles/CERT_IUT_B_ATv2.xml | 2 +- .../profiles/CERT_IUT_C1_ATv2.xml | 2 +- .../profiles/CERT_IUT_C2_ATv2.xml | 2 +- .../profiles/CERT_IUT_CA1_ATv2.xml | 2 +- .../profiles/CERT_IUT_CA2_ATv2.xml | 2 +- .../profiles/CERT_IUT_CAM_BO_02_ATv2.xml | 2 +- .../profiles/CERT_IUT_CAM_BO_03_ATv2.xml | 2 +- .../profiles/CERT_IUT_CAM_BO_04_AT.xml | 30 +++++++++++++++++++ .../profiles/CERT_IUT_CAM_BO_04_ATv2.xml | 30 +++++++++++++++++++ .../profiles/CERT_IUT_CAM_BO_05_AT.xml | 30 +++++++++++++++++++ .../profiles/CERT_IUT_CAM_BO_05_ATv2.xml | 30 +++++++++++++++++++ .../profiles/CERT_IUT_CAM_BO_06_AT.xml | 30 +++++++++++++++++++ .../profiles/CERT_IUT_CAM_BO_06_ATv2.xml | 30 +++++++++++++++++++ .../profiles/CERT_IUT_CAM_BO_07_AT.xml | 30 +++++++++++++++++++ .../profiles/CERT_IUT_CAM_BO_07_ATv2.xml | 30 +++++++++++++++++++ .../profiles/CERT_IUT_CAM_BO_08_AT.xml | 30 +++++++++++++++++++ .../profiles/CERT_IUT_CAM_BO_08_ATv2.xml | 30 +++++++++++++++++++ .../profiles/CERT_IUT_CAM_BO_15_ATv2.xml | 30 +++++++++++++++++++ .../profiles/CERT_IUT_CAM_BO_16_ATv2.xml | 30 +++++++++++++++++++ .../profiles/CERT_IUT_DENM_BO_01_ATv2.xml | 2 +- .../profiles/CERT_IUT_DENM_BO_02_ATv2.xml | 2 +- .../profiles/CERT_TS_A_AT_IMP_BOv2.xml | 2 +- .../profiles/CERT_TS_A_AT_IMPv2.xml | 2 +- data/certificates/profiles/CERT_TS_A_ATv2.xml | 2 +- data/certificates/profiles/CERT_TS_B_ATv2.xml | 2 +- .../profiles/CERT_TS_CAM_BO_02_ATv2.xml | 2 +- .../profiles/CERT_TS_CAM_BO_03_ATv2.xml | 2 +- .../profiles/CERT_TS_DENM_BO_01_ATv2.xml | 2 +- .../profiles/CERT_TS_DENM_BO_02_ATv2.xml | 2 +- .../profiles/CERT_TS_F3_AT_IMPv2.xml | 2 +- .../certificates/profiles/CERT_TS_F3_ATv2.xml | 2 +- .../profiles/CERT_TS_FA3_ATv2.xml | 2 +- .../certificates/profiles/CERT_TS_FA_ATv2.xml | 2 +- .../profiles/CERT_TS_F_AT_IMPv2.xml | 2 +- data/certificates/profiles/CERT_TS_F_ATv2.xml | 2 +- install.sh | 5 ++-- titan-test-system-framework | 2 +- ttcn/AtsCAM | 2 +- ttcn/AtsDENM | 2 +- ttcn/AtsSecurity | 2 +- 59 files changed, 411 insertions(+), 47 deletions(-) create mode 100644 data/certificates/profiles/CERT_IUT_CAM_BO_04_AT.xml create mode 100644 data/certificates/profiles/CERT_IUT_CAM_BO_04_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_CAM_BO_05_AT.xml create mode 100644 data/certificates/profiles/CERT_IUT_CAM_BO_05_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_CAM_BO_06_AT.xml create mode 100644 data/certificates/profiles/CERT_IUT_CAM_BO_06_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_CAM_BO_07_AT.xml create mode 100644 data/certificates/profiles/CERT_IUT_CAM_BO_07_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_CAM_BO_08_AT.xml create mode 100644 data/certificates/profiles/CERT_IUT_CAM_BO_08_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_CAM_BO_15_ATv2.xml create mode 100644 data/certificates/profiles/CERT_IUT_CAM_BO_16_ATv2.xml diff --git a/TS.ITS_TTF_T036.code-workspace b/TS.ITS_TTF_T036.code-workspace index 70038a4..bf4f238 100644 --- a/TS.ITS_TTF_T036.code-workspace +++ b/TS.ITS_TTF_T036.code-workspace @@ -23,6 +23,9 @@ }, { "path": "../../tmp/titan_5gngap_per_issue" + }, + { + "path": "../../tmp/test_cpp" } ], "settings": { diff --git a/data/certificates/profiles/CERT_IUT_A1_ATv2.xml b/data/certificates/profiles/CERT_IUT_A1_ATv2.xml index bfcb96e..22ef72d 100644 --- a/data/certificates/profiles/CERT_IUT_A1_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A1_ATv2.xml @@ -20,7 +20,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A2_ATv2.xml b/data/certificates/profiles/CERT_IUT_A2_ATv2.xml index ea5085f..24f3a6e 100644 --- a/data/certificates/profiles/CERT_IUT_A2_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A2_ATv2.xml @@ -20,7 +20,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A4_ATv2.xml b/data/certificates/profiles/CERT_IUT_A4_ATv2.xml index 48dc5a5..5aed727 100644 --- a/data/certificates/profiles/CERT_IUT_A4_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A4_ATv2.xml @@ -20,7 +20,7 @@ - 02 FF FC + 02 FF FF diff --git a/data/certificates/profiles/CERT_IUT_A_AC_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_AC_ATv2.xml index b04bf37..75893f8 100644 --- a/data/certificates/profiles/CERT_IUT_A_AC_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_AC_ATv2.xml @@ -21,7 +21,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_AT_A8v2.xml b/data/certificates/profiles/CERT_IUT_A_AT_A8v2.xml index 2f9666b..9b30573 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_A8v2.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_A8v2.xml @@ -28,7 +28,7 @@ 00 00 00 - 02 FF FC + 02 FF FF diff --git a/data/certificates/profiles/CERT_IUT_A_AT_IMPv2.xml b/data/certificates/profiles/CERT_IUT_A_AT_IMPv2.xml index 83d251c..5d447eb 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_IMPv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_IMPv2.xml @@ -21,7 +21,7 @@ -02 FF FC  +02 FF FF  02 FF FF FF FE  01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDEv2.xml b/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDEv2.xml index 8eb31f5..408cf25 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDEv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDEv2.xml @@ -21,7 +21,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINERv2.xml b/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINERv2.xml index 2e8263b..0f920e6 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINERv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINERv2.xml @@ -21,7 +21,7 @@ - 02 FD FC + 02 FD FF 02 FF FF FF FE diff --git a/data/certificates/profiles/CERT_IUT_A_AT_PASTv2.xml b/data/certificates/profiles/CERT_IUT_A_AT_PASTv2.xml index 2db25d8..711fd73 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_PASTv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_PASTv2.xml @@ -21,7 +21,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_ATv2.xml index 72f5684..ce0d120 100644 --- a/data/certificates/profiles/CERT_IUT_A_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_ATv2.xml @@ -21,7 +21,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B33_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_B33_ATv2.xml index dc3a3a5..a24b9e2 100644 --- a/data/certificates/profiles/CERT_IUT_A_B33_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_B33_ATv2.xml @@ -20,7 +20,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B3_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_B3_ATv2.xml index 076305f..d5f7ec4 100644 --- a/data/certificates/profiles/CERT_IUT_A_B3_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_B3_ATv2.xml @@ -20,7 +20,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B3_N_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_B3_N_ATv2.xml index 22e6f90..16e9318 100644 --- a/data/certificates/profiles/CERT_IUT_A_B3_N_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_B3_N_ATv2.xml @@ -20,7 +20,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_B_ATv2.xml index e68caff..1cda21b 100644 --- a/data/certificates/profiles/CERT_IUT_A_B_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_B_ATv2.xml @@ -20,7 +20,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B_N_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_B_N_ATv2.xml index cdee710..3def053 100644 --- a/data/certificates/profiles/CERT_IUT_A_B_N_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_B_N_ATv2.xml @@ -20,7 +20,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_C3_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_C3_ATv2.xml index 14800d0..8235c26 100644 --- a/data/certificates/profiles/CERT_IUT_A_C3_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_C3_ATv2.xml @@ -21,7 +21,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_CC_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_CC_ATv2.xml index f541783..893360d 100644 --- a/data/certificates/profiles/CERT_IUT_A_CC_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_CC_ATv2.xml @@ -21,7 +21,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_N_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_N_ATv2.xml index da8d59b..bab5969 100644 --- a/data/certificates/profiles/CERT_IUT_A_N_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_N_ATv2.xml @@ -21,7 +21,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_B_ATv2.xml b/data/certificates/profiles/CERT_IUT_B_ATv2.xml index 2da6442..e62c5fe 100644 --- a/data/certificates/profiles/CERT_IUT_B_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_B_ATv2.xml @@ -20,7 +20,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_C1_ATv2.xml b/data/certificates/profiles/CERT_IUT_C1_ATv2.xml index f8355ab..e4ed90d 100644 --- a/data/certificates/profiles/CERT_IUT_C1_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_C1_ATv2.xml @@ -20,7 +20,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_C2_ATv2.xml b/data/certificates/profiles/CERT_IUT_C2_ATv2.xml index 64fc4ae..3538224 100644 --- a/data/certificates/profiles/CERT_IUT_C2_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_C2_ATv2.xml @@ -20,7 +20,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_CA1_ATv2.xml b/data/certificates/profiles/CERT_IUT_CA1_ATv2.xml index 24e4e74..c83b1b9 100644 --- a/data/certificates/profiles/CERT_IUT_CA1_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_CA1_ATv2.xml @@ -20,7 +20,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF 01 01 diff --git a/data/certificates/profiles/CERT_IUT_CA2_ATv2.xml b/data/certificates/profiles/CERT_IUT_CA2_ATv2.xml index c8c030a..97d85e1 100644 --- a/data/certificates/profiles/CERT_IUT_CA2_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_CA2_ATv2.xml @@ -20,7 +20,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF 01 01 diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_02_ATv2.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_02_ATv2.xml index 6b8eb7f..c0be10f 100644 --- a/data/certificates/profiles/CERT_IUT_CAM_BO_02_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_02_ATv2.xml @@ -17,7 +17,7 @@ - 02 BF FC + 02 BF FF diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_03_ATv2.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_03_ATv2.xml index 61f8f3a..03e503c 100644 --- a/data/certificates/profiles/CERT_IUT_CAM_BO_03_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_03_ATv2.xml @@ -17,7 +17,7 @@ - 02 DF FC + 02 DF FF diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_04_AT.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_04_AT.xml new file mode 100644 index 0000000..fbc954e --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_04_AT.xml @@ -0,0 +1,30 @@ + + + 2 + + + + + + + + + + + + + + + 01 EF FC + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_04_ATv2.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_04_ATv2.xml new file mode 100644 index 0000000..4326107 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_04_ATv2.xml @@ -0,0 +1,30 @@ + + + 2 + + + + + + + + + + + + + + + 02 EF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_05_AT.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_05_AT.xml new file mode 100644 index 0000000..b8d12c8 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_05_AT.xml @@ -0,0 +1,30 @@ + + + 2 + + + + + + + + + + + + + + + 01 F7 FC + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_05_ATv2.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_05_ATv2.xml new file mode 100644 index 0000000..4428223 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_05_ATv2.xml @@ -0,0 +1,30 @@ + + + 2 + + + + + + + + + + + + + + + 02 F7 FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_06_AT.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_06_AT.xml new file mode 100644 index 0000000..79a82f0 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_06_AT.xml @@ -0,0 +1,30 @@ + + + 2 + + + + + + + + + + + + + + + 01 FF 7C + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_06_ATv2.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_06_ATv2.xml new file mode 100644 index 0000000..675cf42 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_06_ATv2.xml @@ -0,0 +1,30 @@ + + + 2 + + + + + + + + + + + + + + + 02 FF 7F + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_07_AT.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_07_AT.xml new file mode 100644 index 0000000..f9affee --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_07_AT.xml @@ -0,0 +1,30 @@ + + + 2 + + + + + + + + + + + + + + + 01 FF BC + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_07_ATv2.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_07_ATv2.xml new file mode 100644 index 0000000..e835be3 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_07_ATv2.xml @@ -0,0 +1,30 @@ + + + 2 + + + + + + + + + + + + + + + 02 FF BF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_08_AT.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_08_AT.xml new file mode 100644 index 0000000..eba5dd3 --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_08_AT.xml @@ -0,0 +1,30 @@ + + + 2 + + + + + + + + + + + + + + + 01 FF DC + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_08_ATv2.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_08_ATv2.xml new file mode 100644 index 0000000..f24bade --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_08_ATv2.xml @@ -0,0 +1,30 @@ + + + 2 + + + + + + + + + + + + + + + 02 FF DF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_15_ATv2.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_15_ATv2.xml new file mode 100644 index 0000000..05ad33f --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_15_ATv2.xml @@ -0,0 +1,30 @@ + + + 2 + + + + + + + + + + + + + + + 02 FF FD + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_CAM_BO_16_ATv2.xml b/data/certificates/profiles/CERT_IUT_CAM_BO_16_ATv2.xml new file mode 100644 index 0000000..f3efccf --- /dev/null +++ b/data/certificates/profiles/CERT_IUT_CAM_BO_16_ATv2.xml @@ -0,0 +1,30 @@ + + + 2 + + + + + + + + + + + + + + + 02 FF FE + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_IUT_DENM_BO_01_ATv2.xml b/data/certificates/profiles/CERT_IUT_DENM_BO_01_ATv2.xml index c025d63..2ce823b 100644 --- a/data/certificates/profiles/CERT_IUT_DENM_BO_01_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_DENM_BO_01_ATv2.xml @@ -17,7 +17,7 @@ - 02 FF FC + 02 FF FF 02 7F FF FF diff --git a/data/certificates/profiles/CERT_IUT_DENM_BO_02_ATv2.xml b/data/certificates/profiles/CERT_IUT_DENM_BO_02_ATv2.xml index 7a5f46a..a983122 100644 --- a/data/certificates/profiles/CERT_IUT_DENM_BO_02_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_DENM_BO_02_ATv2.xml @@ -17,7 +17,7 @@ - 02 FF FC + 02 FF FF 02 BF FF FF diff --git a/data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml b/data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml index 7c3ebed..9de0fbb 100644 --- a/data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml +++ b/data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml @@ -21,7 +21,7 @@ -02 FF FC  +02 FF FF  02 FF FF FF  01 01 diff --git a/data/certificates/profiles/CERT_TS_A_AT_IMPv2.xml b/data/certificates/profiles/CERT_TS_A_AT_IMPv2.xml index 12c16af..9453172 100644 --- a/data/certificates/profiles/CERT_TS_A_AT_IMPv2.xml +++ b/data/certificates/profiles/CERT_TS_A_AT_IMPv2.xml @@ -21,7 +21,7 @@ -02 FF FC  +02 FF FF  02 FF FF FF FE  01 01 diff --git a/data/certificates/profiles/CERT_TS_A_ATv2.xml b/data/certificates/profiles/CERT_TS_A_ATv2.xml index 72f5684..ce0d120 100644 --- a/data/certificates/profiles/CERT_TS_A_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_A_ATv2.xml @@ -21,7 +21,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_TS_B_ATv2.xml b/data/certificates/profiles/CERT_TS_B_ATv2.xml index 7ce815a..4e02d86 100644 --- a/data/certificates/profiles/CERT_TS_B_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_B_ATv2.xml @@ -21,7 +21,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_TS_CAM_BO_02_ATv2.xml b/data/certificates/profiles/CERT_TS_CAM_BO_02_ATv2.xml index 97aaac2..034a5b1 100644 --- a/data/certificates/profiles/CERT_TS_CAM_BO_02_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_CAM_BO_02_ATv2.xml @@ -18,7 +18,7 @@ - 02 BF FC + 02 BF FF diff --git a/data/certificates/profiles/CERT_TS_CAM_BO_03_ATv2.xml b/data/certificates/profiles/CERT_TS_CAM_BO_03_ATv2.xml index 076d15c..24507df 100644 --- a/data/certificates/profiles/CERT_TS_CAM_BO_03_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_CAM_BO_03_ATv2.xml @@ -17,7 +17,7 @@ - 02 DF FC + 02 DF FF diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml index 0937beb..7952d72 100644 --- a/data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml @@ -14,7 +14,7 @@ - 02 FF FC + 02 FF FF 02 7F FF FF diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_02_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_02_ATv2.xml index ab5c506..c08881d 100644 --- a/data/certificates/profiles/CERT_TS_DENM_BO_02_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_DENM_BO_02_ATv2.xml @@ -14,7 +14,7 @@ - 02 FF FC + 02 FF FF 02 BF FF FF diff --git a/data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml b/data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml index 31578ae..de759e4 100644 --- a/data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml +++ b/data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml @@ -20,7 +20,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF 01 01 diff --git a/data/certificates/profiles/CERT_TS_F3_ATv2.xml b/data/certificates/profiles/CERT_TS_F3_ATv2.xml index 24468a6..29a5280 100644 --- a/data/certificates/profiles/CERT_TS_F3_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_F3_ATv2.xml @@ -20,7 +20,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF 01 01 diff --git a/data/certificates/profiles/CERT_TS_FA3_ATv2.xml b/data/certificates/profiles/CERT_TS_FA3_ATv2.xml index 34c6d56..de12af3 100644 --- a/data/certificates/profiles/CERT_TS_FA3_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_FA3_ATv2.xml @@ -21,7 +21,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF 01 01 diff --git a/data/certificates/profiles/CERT_TS_FA_ATv2.xml b/data/certificates/profiles/CERT_TS_FA_ATv2.xml index ed8bd09..80e2049 100644 --- a/data/certificates/profiles/CERT_TS_FA_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_FA_ATv2.xml @@ -21,7 +21,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF 01 01 diff --git a/data/certificates/profiles/CERT_TS_F_AT_IMPv2.xml b/data/certificates/profiles/CERT_TS_F_AT_IMPv2.xml index 016a065..dead7d3 100644 --- a/data/certificates/profiles/CERT_TS_F_AT_IMPv2.xml +++ b/data/certificates/profiles/CERT_TS_F_AT_IMPv2.xml @@ -21,7 +21,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_TS_F_ATv2.xml b/data/certificates/profiles/CERT_TS_F_ATv2.xml index acd9065..84a481b 100644 --- a/data/certificates/profiles/CERT_TS_F_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_F_ATv2.xml @@ -21,7 +21,7 @@ - 02 FF FC + 02 FF FF 02 FF FF FF 01 01 diff --git a/install.sh b/install.sh index b48a596..e48bf24 100755 --- a/install.sh +++ b/install.sh @@ -4,6 +4,7 @@ set -vx BRANCH=TTF_T036 +ASN_BRANCH=release2 BASE_PATH=`pwd` #git checkout $BRANCH @@ -18,7 +19,7 @@ done for i in `find $BASE_PATH/ttcn/Ats* -type d -name "asn1"` do cd $i - git checkout $BRANCH + git checkout $ASN_BRANCH if [ -f ETSI-ITS-CDD.asn ] then ln ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn @@ -54,7 +55,7 @@ do for j in $SUB_DIRS do cd $j - git checkout $BRANCH + git checkout $ASN_BRANCH if [ -f ETSI-ITS-CDD.asn ] then ln ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn diff --git a/titan-test-system-framework b/titan-test-system-framework index ef63449..a8db2ae 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit ef6344980b87f3971363ad9b971f16dd43d8d0ba +Subproject commit a8db2aefc860cdfec0b76ae767f5c91fe7ec042f diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 078736a..9fc200b 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 078736a9c6946220025f03c6ac11a69b06b72926 +Subproject commit 9fc200bf38ca86a0c9f281411f905d44771ae3a9 diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index 0aa44c7..fa94e41 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit 0aa44c723578a181ee96c1cdc1663ca20a49d13c +Subproject commit fa94e415ce6d4185058ca36505b1211958fc18cf diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index d338f5d..2abcd22 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit d338f5d5200b45ed0f8c91327eb6b7f8379dd0d2 +Subproject commit 2abcd22f8d08f25d0b01ec2ad0dd7de6392380f2 -- GitLab From 21a2d2a3f1c8919b09910d1c0027e43150c8d0d0 Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 26 Nov 2024 10:17:02 +0100 Subject: [PATCH 163/178] Bug fixed in install.sh --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index e48bf24..5c103d0 100755 --- a/install.sh +++ b/install.sh @@ -4,7 +4,7 @@ set -vx BRANCH=TTF_T036 -ASN_BRANCH=release2 +ASN1_BRANCH=devel2 BASE_PATH=`pwd` #git checkout $BRANCH @@ -19,7 +19,7 @@ done for i in `find $BASE_PATH/ttcn/Ats* -type d -name "asn1"` do cd $i - git checkout $ASN_BRANCH + git checkout $ASN1_BRANCH if [ -f ETSI-ITS-CDD.asn ] then ln ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn -- GitLab From 627e144dab646ad262d1f7c85e32e85a9bc1f1f6 Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 26 Nov 2024 10:17:02 +0100 Subject: [PATCH 164/178] Bug fixed in install.sh --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index 5c103d0..9202826 100755 --- a/install.sh +++ b/install.sh @@ -22,6 +22,7 @@ do git checkout $ASN1_BRANCH if [ -f ETSI-ITS-CDD.asn ] then + git checkout $ASN1_BRANCH ln ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn elif [ -f CAM-PDU-Descriptions.asn ] then -- GitLab From 3e796686f23d38cb1d1bd0c3dd26696a53efc94c Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 26 Nov 2024 10:59:28 +0100 Subject: [PATCH 165/178] Use devel2 branch for all ASN.1 files --- install.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 9202826..5742aa7 100755 --- a/install.sh +++ b/install.sh @@ -13,16 +13,15 @@ BASE_PATH=`pwd` for i in `find $BASE_PATH/ttcn -type d -name "Ats*"` do cd $i - git checkout $BRANCH + git checkout --recurse-submodules $BRANCH done for i in `find $BASE_PATH/ttcn/Ats* -type d -name "asn1"` do cd $i - git checkout $ASN1_BRANCH + git checkout --recurse-submodules $ASN1_BRANCH if [ -f ETSI-ITS-CDD.asn ] then - git checkout $ASN1_BRANCH ln ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn elif [ -f CAM-PDU-Descriptions.asn ] then @@ -56,7 +55,7 @@ do for j in $SUB_DIRS do cd $j - git checkout $ASN_BRANCH + git checkout --recurse-submodules $ASN1_BRANCH if [ -f ETSI-ITS-CDD.asn ] then ln ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn -- GitLab From 481c9c36a43bc450343129b0623473b22fbf741d Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 28 Nov 2024 09:29:14 +0100 Subject: [PATCH 166/178] Add SSP TCs for DENMv2; Add new certificate profiles; Bug fixed in certificate profiles --- .../profiles/CERT_IUT_CA1_ATv2.xml | 2 +- .../profiles/CERT_IUT_CA2_ATv2.xml | 2 +- .../profiles/CERT_IUT_C_AT_8v2.xml | 2 +- .../certificates/profiles/CERT_IUT_C_ATv2.xml | 2 +- .../profiles/CERT_IUT_DENM_BO_01_ATv2.xml | 2 +- .../profiles/CERT_IUT_DENM_BO_02_ATv2.xml | 2 +- .../profiles/CERT_IUT_D_AT_8v2.xml | 2 +- .../certificates/profiles/CERT_IUT_D_ATv2.xml | 2 +- .../profiles/CERT_IUT_E_AT_8v2.xml | 2 +- .../certificates/profiles/CERT_IUT_E_ATv2.xml | 2 +- .../profiles/CERT_TS_A_AT_IMP_BOv2.xml | 6 ++-- .../profiles/CERT_TS_DENM_BO_01_ATv2.xml | 2 +- .../profiles/CERT_TS_DENM_BO_25_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_26_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_27_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_28_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_F3_AT_IMPv2.xml | 2 +- .../certificates/profiles/CERT_TS_F3_ATv2.xml | 2 +- .../profiles/CERT_TS_FA3_ATv2.xml | 2 +- .../certificates/profiles/CERT_TS_FA_ATv2.xml | 2 +- data/certificates/profiles/CERT_TS_F_ATv2.xml | 2 +- ttcn/AtsCAM | 2 +- ttcn/LibIts | 2 +- 23 files changed, 133 insertions(+), 21 deletions(-) create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_25_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_26_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_27_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_28_ATv2.xml diff --git a/data/certificates/profiles/CERT_IUT_CA1_ATv2.xml b/data/certificates/profiles/CERT_IUT_CA1_ATv2.xml index c83b1b9..02c3a63 100644 --- a/data/certificates/profiles/CERT_IUT_CA1_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_CA1_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_CA2_ATv2.xml b/data/certificates/profiles/CERT_IUT_CA2_ATv2.xml index 97d85e1..aeda1aa 100644 --- a/data/certificates/profiles/CERT_IUT_CA2_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_CA2_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_C_AT_8v2.xml b/data/certificates/profiles/CERT_IUT_C_AT_8v2.xml index 6eb10b8..2cf40b3 100644 --- a/data/certificates/profiles/CERT_IUT_C_AT_8v2.xml +++ b/data/certificates/profiles/CERT_IUT_C_AT_8v2.xml @@ -21,7 +21,7 @@ 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_C_ATv2.xml b/data/certificates/profiles/CERT_IUT_C_ATv2.xml index 469efa2..2ef792d 100644 --- a/data/certificates/profiles/CERT_IUT_C_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_C_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_DENM_BO_01_ATv2.xml b/data/certificates/profiles/CERT_IUT_DENM_BO_01_ATv2.xml index 2ce823b..10f9fe5 100644 --- a/data/certificates/profiles/CERT_IUT_DENM_BO_01_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_DENM_BO_01_ATv2.xml @@ -18,7 +18,7 @@ 02 FF FF - 02 7F FF FF + 02 7F FF FF FE diff --git a/data/certificates/profiles/CERT_IUT_DENM_BO_02_ATv2.xml b/data/certificates/profiles/CERT_IUT_DENM_BO_02_ATv2.xml index a983122..7ac356d 100644 --- a/data/certificates/profiles/CERT_IUT_DENM_BO_02_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_DENM_BO_02_ATv2.xml @@ -18,7 +18,7 @@ 02 FF FF - 02 BF FF FF + 02 BF FF FF FE diff --git a/data/certificates/profiles/CERT_IUT_D_AT_8v2.xml b/data/certificates/profiles/CERT_IUT_D_AT_8v2.xml index bd9282f..a4a7c30 100644 --- a/data/certificates/profiles/CERT_IUT_D_AT_8v2.xml +++ b/data/certificates/profiles/CERT_IUT_D_AT_8v2.xml @@ -21,7 +21,7 @@ 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_D_ATv2.xml b/data/certificates/profiles/CERT_IUT_D_ATv2.xml index bebc197..17af0f4 100644 --- a/data/certificates/profiles/CERT_IUT_D_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_D_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_E_AT_8v2.xml b/data/certificates/profiles/CERT_IUT_E_AT_8v2.xml index db679e5..82730cf 100644 --- a/data/certificates/profiles/CERT_IUT_E_AT_8v2.xml +++ b/data/certificates/profiles/CERT_IUT_E_AT_8v2.xml @@ -21,7 +21,7 @@ 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_IUT_E_ATv2.xml b/data/certificates/profiles/CERT_IUT_E_ATv2.xml index 8d3429d..65b91c4 100644 --- a/data/certificates/profiles/CERT_IUT_E_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_E_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FC - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml b/data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml index 9de0fbb..bb78ef8 100644 --- a/data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml +++ b/data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml @@ -22,9 +22,9 @@ 02 FF FF  -02 FF FF FF  - 01 - 01 +02 FF FF FF FE  +01 +01   diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml index 7952d72..3c92810 100644 --- a/data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml @@ -15,7 +15,7 @@ 02 FF FF - 02 7F FF FF + 02 7F FF FF FE diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_25_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_25_ATv2.xml new file mode 100644 index 0000000..dbf776a --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_25_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF FF 7F + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_26_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_26_ATv2.xml new file mode 100644 index 0000000..3d2dc2e --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_26_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF FF BF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_27_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_27_ATv2.xml new file mode 100644 index 0000000..a8881af --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_27_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF FF DF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_28_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_28_ATv2.xml new file mode 100644 index 0000000..61f08f2 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_28_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF FF EF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml b/data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml index de759e4..255eaa3 100644 --- a/data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml +++ b/data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_TS_F3_ATv2.xml b/data/certificates/profiles/CERT_TS_F3_ATv2.xml index 29a5280..d5f7ec4 100644 --- a/data/certificates/profiles/CERT_TS_F3_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_F3_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_TS_FA3_ATv2.xml b/data/certificates/profiles/CERT_TS_FA3_ATv2.xml index de12af3..0321783 100644 --- a/data/certificates/profiles/CERT_TS_FA3_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_FA3_ATv2.xml @@ -22,7 +22,7 @@ 02 FF FF - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_TS_FA_ATv2.xml b/data/certificates/profiles/CERT_TS_FA_ATv2.xml index 80e2049..bcd5407 100644 --- a/data/certificates/profiles/CERT_TS_FA_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_FA_ATv2.xml @@ -22,7 +22,7 @@ 02 FF FF - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/data/certificates/profiles/CERT_TS_F_ATv2.xml b/data/certificates/profiles/CERT_TS_F_ATv2.xml index 84a481b..d09bdf6 100644 --- a/data/certificates/profiles/CERT_TS_F_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_F_ATv2.xml @@ -22,7 +22,7 @@ 02 FF FF - 02 FF FF FF + 02 FF FF FF FE 01 01 diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 9fc200b..2e6d1a8 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 9fc200bf38ca86a0c9f281411f905d44771ae3a9 +Subproject commit 2e6d1a86b54ec3eb11fc5b7f6e70f80b06834a50 diff --git a/ttcn/LibIts b/ttcn/LibIts index a89b8a5..b3eea5a 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit a89b8a5da712f10c505a5aec57a00abff63c9434 +Subproject commit b3eea5a8796aec6391a8a9cf6db8825744526b3b -- GitLab From 8c23097053a7ad634ae8ee64b5d6247968f38b6b Mon Sep 17 00:00:00 2001 From: garciay Date: Mon, 2 Dec 2024 09:11:09 +0100 Subject: [PATCH 167/178] Enhance README.md file --- README.md | 7 +++++++ ttcn/AtsDENM | 2 +- ttcn/LibIts | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b0e92e0..36709eb 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,13 @@ $ git checkout devel $ git checkout ttf_t024 ``` +- Execute the installation script to setup the correct environment: + +```sh +$ cd ./TS.ITS +& ./install.sh +``` + - From the ETSI ITS Test System root directory, build the Docker image executing the following commands: ```sh diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index fa94e41..3c07554 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit fa94e415ce6d4185058ca36505b1211958fc18cf +Subproject commit 3c07554ea9b960e36dcc1e0a8efcb453f4301d9f diff --git a/ttcn/LibIts b/ttcn/LibIts index b3eea5a..e9c6c8a 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit b3eea5a8796aec6391a8a9cf6db8825744526b3b +Subproject commit e9c6c8a48c937bfdc685a67e9648cedc76b581ec -- GitLab From c06571214d86a1dbce7b95d77c3ad7f3c579a333 Mon Sep 17 00:00:00 2001 From: garciay Date: Mon, 2 Dec 2024 15:22:32 +0100 Subject: [PATCH 168/178] Bug fixed in DENM SSP bit flags --- data/certificates/profiles/CERT_IUT_A1_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_A2_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_A3_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_A_AC_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_A_AT_IMPv2.xml | 2 +- data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDEv2.xml | 2 +- data/certificates/profiles/CERT_IUT_A_AT_NOCAMv2.xml | 2 +- .../profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINERv2.xml | 2 +- data/certificates/profiles/CERT_IUT_A_AT_PASTv2.xml | 2 +- data/certificates/profiles/CERT_IUT_A_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_A_B33_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_A_B3_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_A_B3_N_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_A_B_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_A_B_N_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_A_C3_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_A_CC_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_A_N_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_B_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_C1_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_C2_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_CA1_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_CA2_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_C_AT_8v2.xml | 2 +- data/certificates/profiles/CERT_IUT_C_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_D_AT_8v2.xml | 2 +- data/certificates/profiles/CERT_IUT_D_ATv2.xml | 2 +- data/certificates/profiles/CERT_IUT_E_AT_8v2.xml | 2 +- data/certificates/profiles/CERT_IUT_E_ATv2.xml | 2 +- data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml | 2 +- data/certificates/profiles/CERT_TS_A_AT_IMPv2.xml | 2 +- data/certificates/profiles/CERT_TS_A_ATv2.xml | 2 +- data/certificates/profiles/CERT_TS_B_ATv2.xml | 2 +- data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml | 2 +- data/certificates/profiles/CERT_TS_DENM_BO_02_ATv2.xml | 2 +- data/certificates/profiles/CERT_TS_DENM_BO_25_ATv2.xml | 2 +- data/certificates/profiles/CERT_TS_DENM_BO_26_ATv2.xml | 2 +- data/certificates/profiles/CERT_TS_DENM_BO_27_ATv2.xml | 2 +- data/certificates/profiles/CERT_TS_DENM_BO_28_ATv2.xml | 2 +- data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml | 2 +- data/certificates/profiles/CERT_TS_F3_ATv2.xml | 2 +- data/certificates/profiles/CERT_TS_FA3_ATv2.xml | 2 +- data/certificates/profiles/CERT_TS_FA_ATv2.xml | 2 +- data/certificates/profiles/CERT_TS_F_AT_IMPv2.xml | 2 +- data/certificates/profiles/CERT_TS_F_ATv2.xml | 2 +- 45 files changed, 45 insertions(+), 45 deletions(-) diff --git a/data/certificates/profiles/CERT_IUT_A1_ATv2.xml b/data/certificates/profiles/CERT_IUT_A1_ATv2.xml index 22ef72d..c01a7ff 100644 --- a/data/certificates/profiles/CERT_IUT_A1_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A1_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A2_ATv2.xml b/data/certificates/profiles/CERT_IUT_A2_ATv2.xml index 24f3a6e..1b2ef06 100644 --- a/data/certificates/profiles/CERT_IUT_A2_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A2_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A3_ATv2.xml b/data/certificates/profiles/CERT_IUT_A3_ATv2.xml index 2ac26d2..3923029 100644 --- a/data/certificates/profiles/CERT_IUT_A3_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A3_ATv2.xml @@ -21,7 +21,7 @@ - 02 FF FF FF FE + 02 FF FF FF F0 diff --git a/data/certificates/profiles/CERT_IUT_A_AC_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_AC_ATv2.xml index 75893f8..687e244 100644 --- a/data/certificates/profiles/CERT_IUT_A_AC_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_AC_ATv2.xml @@ -22,7 +22,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_AT_IMPv2.xml b/data/certificates/profiles/CERT_IUT_A_AT_IMPv2.xml index 5d447eb..e3c6eb6 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_IMPv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_IMPv2.xml @@ -22,7 +22,7 @@ 02 FF FF  -02 FF FF FF FE  +02 FF FF FF F0   01 01   diff --git a/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDEv2.xml b/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDEv2.xml index 408cf25..705a193 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDEv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_LOC_OUTSIDEv2.xml @@ -22,7 +22,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_AT_NOCAMv2.xml b/data/certificates/profiles/CERT_IUT_A_AT_NOCAMv2.xml index 93a0eea..25058e1 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_NOCAMv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_NOCAMv2.xml @@ -21,7 +21,7 @@ - 02 FF FF FF FE + 02 FF FF FF F0 diff --git a/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINERv2.xml b/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINERv2.xml index 0f920e6..3c998cc 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINERv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_NO_EMERGENCY_CONTAINERv2.xml @@ -22,7 +22,7 @@ 02 FD FF - 02 FF FF FF FE + 02 FF FF FF F0 diff --git a/data/certificates/profiles/CERT_IUT_A_AT_PASTv2.xml b/data/certificates/profiles/CERT_IUT_A_AT_PASTv2.xml index 711fd73..2cc8741 100644 --- a/data/certificates/profiles/CERT_IUT_A_AT_PASTv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_AT_PASTv2.xml @@ -22,7 +22,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_ATv2.xml index ce0d120..8febef9 100644 --- a/data/certificates/profiles/CERT_IUT_A_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_ATv2.xml @@ -22,7 +22,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B33_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_B33_ATv2.xml index a24b9e2..1028a11 100644 --- a/data/certificates/profiles/CERT_IUT_A_B33_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_B33_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B3_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_B3_ATv2.xml index d5f7ec4..4abdd79 100644 --- a/data/certificates/profiles/CERT_IUT_A_B3_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_B3_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B3_N_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_B3_N_ATv2.xml index 16e9318..61495a1 100644 --- a/data/certificates/profiles/CERT_IUT_A_B3_N_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_B3_N_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_B_ATv2.xml index 1cda21b..2e6edd1 100644 --- a/data/certificates/profiles/CERT_IUT_A_B_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_B_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_B_N_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_B_N_ATv2.xml index 3def053..4854c2a 100644 --- a/data/certificates/profiles/CERT_IUT_A_B_N_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_B_N_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_C3_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_C3_ATv2.xml index 8235c26..c1cf54e 100644 --- a/data/certificates/profiles/CERT_IUT_A_C3_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_C3_ATv2.xml @@ -22,7 +22,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_CC_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_CC_ATv2.xml index 893360d..794ad9b 100644 --- a/data/certificates/profiles/CERT_IUT_A_CC_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_CC_ATv2.xml @@ -22,7 +22,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_A_N_ATv2.xml b/data/certificates/profiles/CERT_IUT_A_N_ATv2.xml index bab5969..09352a4 100644 --- a/data/certificates/profiles/CERT_IUT_A_N_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_A_N_ATv2.xml @@ -22,7 +22,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_B_ATv2.xml b/data/certificates/profiles/CERT_IUT_B_ATv2.xml index e62c5fe..075952c 100644 --- a/data/certificates/profiles/CERT_IUT_B_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_B_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_C1_ATv2.xml b/data/certificates/profiles/CERT_IUT_C1_ATv2.xml index e4ed90d..5673210 100644 --- a/data/certificates/profiles/CERT_IUT_C1_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_C1_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_C2_ATv2.xml b/data/certificates/profiles/CERT_IUT_C2_ATv2.xml index 3538224..af3ea1e 100644 --- a/data/certificates/profiles/CERT_IUT_C2_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_C2_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_CA1_ATv2.xml b/data/certificates/profiles/CERT_IUT_CA1_ATv2.xml index 02c3a63..62ff743 100644 --- a/data/certificates/profiles/CERT_IUT_CA1_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_CA1_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_CA2_ATv2.xml b/data/certificates/profiles/CERT_IUT_CA2_ATv2.xml index aeda1aa..95b8793 100644 --- a/data/certificates/profiles/CERT_IUT_CA2_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_CA2_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_C_AT_8v2.xml b/data/certificates/profiles/CERT_IUT_C_AT_8v2.xml index 2cf40b3..2cecf1a 100644 --- a/data/certificates/profiles/CERT_IUT_C_AT_8v2.xml +++ b/data/certificates/profiles/CERT_IUT_C_AT_8v2.xml @@ -21,7 +21,7 @@ 02 FF FC - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_C_ATv2.xml b/data/certificates/profiles/CERT_IUT_C_ATv2.xml index 2ef792d..21a88a0 100644 --- a/data/certificates/profiles/CERT_IUT_C_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_C_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FC - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_D_AT_8v2.xml b/data/certificates/profiles/CERT_IUT_D_AT_8v2.xml index a4a7c30..bdbd31d 100644 --- a/data/certificates/profiles/CERT_IUT_D_AT_8v2.xml +++ b/data/certificates/profiles/CERT_IUT_D_AT_8v2.xml @@ -21,7 +21,7 @@ 02 FF FC - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_D_ATv2.xml b/data/certificates/profiles/CERT_IUT_D_ATv2.xml index 17af0f4..0fbef46 100644 --- a/data/certificates/profiles/CERT_IUT_D_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_D_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FC - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_E_AT_8v2.xml b/data/certificates/profiles/CERT_IUT_E_AT_8v2.xml index 82730cf..41242c3 100644 --- a/data/certificates/profiles/CERT_IUT_E_AT_8v2.xml +++ b/data/certificates/profiles/CERT_IUT_E_AT_8v2.xml @@ -21,7 +21,7 @@ 02 FF FC - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_IUT_E_ATv2.xml b/data/certificates/profiles/CERT_IUT_E_ATv2.xml index 65b91c4..33c1c53 100644 --- a/data/certificates/profiles/CERT_IUT_E_ATv2.xml +++ b/data/certificates/profiles/CERT_IUT_E_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FC - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml b/data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml index bb78ef8..1d17944 100644 --- a/data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml +++ b/data/certificates/profiles/CERT_TS_A_AT_IMP_BOv2.xml @@ -22,7 +22,7 @@ 02 FF FF  -02 FF FF FF FE  +02 FF FF FF F0   01 01   diff --git a/data/certificates/profiles/CERT_TS_A_AT_IMPv2.xml b/data/certificates/profiles/CERT_TS_A_AT_IMPv2.xml index 9453172..a18d643 100644 --- a/data/certificates/profiles/CERT_TS_A_AT_IMPv2.xml +++ b/data/certificates/profiles/CERT_TS_A_AT_IMPv2.xml @@ -22,7 +22,7 @@ 02 FF FF  -02 FF FF FF FE  +02 FF FF FF F0   01 01   diff --git a/data/certificates/profiles/CERT_TS_A_ATv2.xml b/data/certificates/profiles/CERT_TS_A_ATv2.xml index ce0d120..8febef9 100644 --- a/data/certificates/profiles/CERT_TS_A_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_A_ATv2.xml @@ -22,7 +22,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_TS_B_ATv2.xml b/data/certificates/profiles/CERT_TS_B_ATv2.xml index 4e02d86..5a11f29 100644 --- a/data/certificates/profiles/CERT_TS_B_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_B_ATv2.xml @@ -22,7 +22,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml index 3c92810..99b6a04 100644 --- a/data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_DENM_BO_01_ATv2.xml @@ -15,7 +15,7 @@ 02 FF FF - 02 7F FF FF FE + 02 7F FF FF FF diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_02_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_02_ATv2.xml index c08881d..d64f454 100644 --- a/data/certificates/profiles/CERT_TS_DENM_BO_02_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_DENM_BO_02_ATv2.xml @@ -15,7 +15,7 @@ 02 FF FF - 02 BF FF FF + 02 BF FF FF FF diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_25_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_25_ATv2.xml index dbf776a..0b2c8dc 100644 --- a/data/certificates/profiles/CERT_TS_DENM_BO_25_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_DENM_BO_25_ATv2.xml @@ -15,7 +15,7 @@ 02 FF FF - 02 FF FF 7F + 02 FF FF FF 7F diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_26_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_26_ATv2.xml index 3d2dc2e..74e5351 100644 --- a/data/certificates/profiles/CERT_TS_DENM_BO_26_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_DENM_BO_26_ATv2.xml @@ -15,7 +15,7 @@ 02 FF FF - 02 FF FF BF + 02 FF FF FF BF diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_27_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_27_ATv2.xml index a8881af..e5754cc 100644 --- a/data/certificates/profiles/CERT_TS_DENM_BO_27_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_DENM_BO_27_ATv2.xml @@ -15,7 +15,7 @@ 02 FF FF - 02 FF FF DF + 02 FF FF FF DF diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_28_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_28_ATv2.xml index 61f08f2..109d50a 100644 --- a/data/certificates/profiles/CERT_TS_DENM_BO_28_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_DENM_BO_28_ATv2.xml @@ -15,7 +15,7 @@ 02 FF FF - 02 FF FF EF + 02 FF FF FF EF diff --git a/data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml b/data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml index 255eaa3..24da280 100644 --- a/data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml +++ b/data/certificates/profiles/CERT_TS_F3_AT_IMPv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_TS_F3_ATv2.xml b/data/certificates/profiles/CERT_TS_F3_ATv2.xml index d5f7ec4..4abdd79 100644 --- a/data/certificates/profiles/CERT_TS_F3_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_F3_ATv2.xml @@ -21,7 +21,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_TS_FA3_ATv2.xml b/data/certificates/profiles/CERT_TS_FA3_ATv2.xml index 0321783..cbd9f0c 100644 --- a/data/certificates/profiles/CERT_TS_FA3_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_FA3_ATv2.xml @@ -22,7 +22,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_TS_FA_ATv2.xml b/data/certificates/profiles/CERT_TS_FA_ATv2.xml index bcd5407..045e7bf 100644 --- a/data/certificates/profiles/CERT_TS_FA_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_FA_ATv2.xml @@ -22,7 +22,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_TS_F_AT_IMPv2.xml b/data/certificates/profiles/CERT_TS_F_AT_IMPv2.xml index dead7d3..e6deaf9 100644 --- a/data/certificates/profiles/CERT_TS_F_AT_IMPv2.xml +++ b/data/certificates/profiles/CERT_TS_F_AT_IMPv2.xml @@ -22,7 +22,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 diff --git a/data/certificates/profiles/CERT_TS_F_ATv2.xml b/data/certificates/profiles/CERT_TS_F_ATv2.xml index d09bdf6..520897d 100644 --- a/data/certificates/profiles/CERT_TS_F_ATv2.xml +++ b/data/certificates/profiles/CERT_TS_F_ATv2.xml @@ -22,7 +22,7 @@ 02 FF FF - 02 FF FF FF FE + 02 FF FF FF F0 01 01 -- GitLab From 44e48f5d40cac05e2eb4fcfa66556c0fe7eaf247 Mon Sep 17 00:00:00 2001 From: garciay Date: Wed, 4 Dec 2024 15:24:59 +0100 Subject: [PATCH 169/178] Bug fixed in virtualization/docker-dev/build.sh --- TS.ITS_TTF_T036.code-workspace | 6 +++++- virtualization/docker-dev/build.sh | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/TS.ITS_TTF_T036.code-workspace b/TS.ITS_TTF_T036.code-workspace index bf4f238..0130377 100644 --- a/TS.ITS_TTF_T036.code-workspace +++ b/TS.ITS_TTF_T036.code-workspace @@ -26,6 +26,9 @@ }, { "path": "../../tmp/test_cpp" + }, + { + "path": "../TS.ITS.pipeline-scripts" } ], "settings": { @@ -105,7 +108,8 @@ "gps.h": "c", "unistd.h": "c", "msggen_mec.h": "c", - "system.h": "c" + "system.h": "c", + "netfwd": "cpp" }, "java.compile.nullAnalysis.mode": "automatic" } diff --git a/virtualization/docker-dev/build.sh b/virtualization/docker-dev/build.sh index d813769..4a7c81b 100755 --- a/virtualization/docker-dev/build.sh +++ b/virtualization/docker-dev/build.sh @@ -16,7 +16,7 @@ if [ -z `docker images -q stfubuntu` ]; then docker build --no-cache --tag stfubuntu:20.04 -f Dockerfile.stfubuntu --force-rm . || exit 1 fi -docker build --no-cache --tag etsiforge-r2 --force-rm . || ( echo "Docker build failed: $?"; exit 1 ) +docker build --no-cache --tag etsiforge/etsi-its-ts-r2 --force-rm . || ( echo "Docker build failed: $?"; exit 1 ) docker images docker inspect etsiforge/etsi-its-ts-r2:latest || ( echo "Docker inspect failed: $?"; exit 1 ) -- GitLab From 6657845b57e1eb59f8cfbecddbd9e266e8c3830b Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 17 Dec 2024 13:41:37 +0100 Subject: [PATCH 170/178] Enhance README file --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 36709eb..794ef9f 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ See the attached LICENSE file or visit https://forge.etsi.org/legal-matters. ## STFs/TTFs The following STFs were or are currently involved in the evolutions of the ETSI ITS protocols project: -- STF 405, STF 422, STF 424, STF 455, STF 462, STF 481, STF 484, STF 507, STF 517, STF 525, STF 538, STF 545, STF 594, TTF T002, TTF T011, TTF T024, TTF T025 +- STF 405, STF 422, STF 424, STF 455, STF 462, STF 481, STF 484, STF 507, STF 517, STF 525, STF 538, STF 545, STF 594, TTF T002, TTF T011, TTF T024, TTF T025, TTF T030, TTF T036 # Installation @@ -96,7 +96,7 @@ $ git checkout devel ITS Release 2 ```sh -$ git checkout ttf_t024 +$ git checkout ttf_t036 ``` - Execute the installation script to setup the correct environment: -- GitLab From fef58771d72389e89f5026c63011378f93852e2d Mon Sep 17 00:00:00 2001 From: garciay Date: Wed, 18 Dec 2024 10:27:45 +0100 Subject: [PATCH 171/178] Test CI/CD pipeline for TS.ITS --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 794ef9f..eb19f9a 100644 --- a/README.md +++ b/README.md @@ -480,3 +480,4 @@ Some sample capture files are available [here](https://wiki.wireshark.org/Sample The ETSI ITS protocols project is under constant development, so it is possible that you will encounter a bug while using it. Please report bugs at cti_support at etsi dot org. + -- GitLab From 126d5cb456d47377a0537f25527ceab7795d379d Mon Sep 17 00:00:00 2001 From: ishaqm Date: Thu, 19 Dec 2024 10:40:15 +0000 Subject: [PATCH 172/178] Add certificate profiles for DENM --- .../profiles/CERT_TS_DENM_BO_03_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_03_ATv2 | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_04_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_04_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_05_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_05_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_06_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_06_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_07_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_07_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_08_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_08_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_09_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_09_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_10_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_10_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_11_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_11_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_12_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_12_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_13_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_13_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_14_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_14_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_15_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_15_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_16_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_16_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_17_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_17_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_18_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_18_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_19_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_19_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_20_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_20_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_21_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_21_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_22_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_22_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_23_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_23_ATv2.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_24_AT.xml | 28 +++++++++++++++++++ .../profiles/CERT_TS_DENM_BO_24_ATv2.xml | 28 +++++++++++++++++++ 44 files changed, 1232 insertions(+) create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_03_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_03_ATv2 create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_04_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_04_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_05_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_05_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_06_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_06_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_07_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_07_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_08_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_08_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_09_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_09_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_10_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_10_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_11_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_11_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_12_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_12_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_13_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_13_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_14_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_14_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_15_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_15_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_16_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_16_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_17_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_17_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_18_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_18_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_19_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_19_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_20_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_20_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_21_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_21_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_22_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_22_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_23_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_23_ATv2.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_24_AT.xml create mode 100644 data/certificates/profiles/CERT_TS_DENM_BO_24_ATv2.xml diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_03_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_03_AT.xml new file mode 100644 index 0000000..d362357 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_03_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 DF FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_03_ATv2 b/data/certificates/profiles/CERT_TS_DENM_BO_03_ATv2 new file mode 100644 index 0000000..8b908d9 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_03_ATv2 @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 DF FF FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_04_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_04_AT.xml new file mode 100644 index 0000000..9c1902c --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_04_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 EF FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_04_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_04_ATv2.xml new file mode 100644 index 0000000..ebb2683 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_04_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 EF FF FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_05_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_05_AT.xml new file mode 100644 index 0000000..1269fd1 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_05_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 F7 FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_05_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_05_ATv2.xml new file mode 100644 index 0000000..14ba9c8 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_05_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 F7 FF FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_06_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_06_AT.xml new file mode 100644 index 0000000..4c45d41 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_06_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FB FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_06_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_06_ATv2.xml new file mode 100644 index 0000000..c6402f8 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_06_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FB FF FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_07_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_07_AT.xml new file mode 100644 index 0000000..99833a0 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_07_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FD FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_07_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_07_ATv2.xml new file mode 100644 index 0000000..af44e93 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_07_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FD FF FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_08_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_08_AT.xml new file mode 100644 index 0000000..2d1f829 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_08_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FE FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_08_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_08_ATv2.xml new file mode 100644 index 0000000..b10d41f --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_08_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FE FF FF FF + + + + + + + + + + \ No newline at end of file diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_09_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_09_AT.xml new file mode 100644 index 0000000..f289f32 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_09_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FF 7F FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_09_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_09_ATv2.xml new file mode 100644 index 0000000..52d5bd8 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_09_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF 7F FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_10_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_10_AT.xml new file mode 100644 index 0000000..9d6b965 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_10_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FF BF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_10_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_10_ATv2.xml new file mode 100644 index 0000000..ba86ba6 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_10_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF BF FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_11_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_11_AT.xml new file mode 100644 index 0000000..d8d6274 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_11_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FF DF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_11_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_11_ATv2.xml new file mode 100644 index 0000000..6d8323c --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_11_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF DF FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_12_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_12_AT.xml new file mode 100644 index 0000000..08616e1 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_12_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FF EF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_12_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_12_ATv2.xml new file mode 100644 index 0000000..a2c3b77 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_12_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF EF FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_13_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_13_AT.xml new file mode 100644 index 0000000..9efed44 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_13_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FF F7 FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_13_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_13_ATv2.xml new file mode 100644 index 0000000..db77164 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_13_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF F7 FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_14_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_14_AT.xml new file mode 100644 index 0000000..2000a3e --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_14_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FF FB FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_14_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_14_ATv2.xml new file mode 100644 index 0000000..d911d27 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_14_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF FB FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_15_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_15_AT.xml new file mode 100644 index 0000000..5b6610c --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_15_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FF FD FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_15_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_15_ATv2.xml new file mode 100644 index 0000000..d721023 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_15_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF FD FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_16_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_16_AT.xml new file mode 100644 index 0000000..9adfb9f --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_16_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FF FE FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_16_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_16_ATv2.xml new file mode 100644 index 0000000..c1d92cb --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_16_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF FE FF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_17_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_17_AT.xml new file mode 100644 index 0000000..a6f9f4f --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_17_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FF FF 7F + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_17_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_17_ATv2.xml new file mode 100644 index 0000000..37af0ba --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_17_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF FF 7F FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_18_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_18_AT.xml new file mode 100644 index 0000000..6cdf89b --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_18_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FF FF BF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_18_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_18_ATv2.xml new file mode 100644 index 0000000..a8063ae --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_18_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF FF BF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_19_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_19_AT.xml new file mode 100644 index 0000000..b50076b --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_19_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FF FF DF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_19_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_19_ATv2.xml new file mode 100644 index 0000000..0207718 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_19_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF FF DF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_20_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_20_AT.xml new file mode 100644 index 0000000..c8217d6 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_20_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FF FF EF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_20_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_20_ATv2.xml new file mode 100644 index 0000000..423485d --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_20_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF FF EF FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_21_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_21_AT.xml new file mode 100644 index 0000000..3425340 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_21_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FF FF F7 + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_21_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_21_ATv2.xml new file mode 100644 index 0000000..34c7a0d --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_21_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF FF F7 FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_22_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_22_AT.xml new file mode 100644 index 0000000..4cf65dd --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_22_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FF FF FB + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_22_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_22_ATv2.xml new file mode 100644 index 0000000..618415a --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_22_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF FF FB FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_23_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_23_AT.xml new file mode 100644 index 0000000..9f91cb8 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_23_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FF FF FD + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_23_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_23_ATv2.xml new file mode 100644 index 0000000..a6179e7 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_23_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF FF FD FF + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_24_AT.xml b/data/certificates/profiles/CERT_TS_DENM_BO_24_AT.xml new file mode 100644 index 0000000..0092ab4 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_24_AT.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 01 FF FC + 01 FF FF FE + + + + + + + + + + diff --git a/data/certificates/profiles/CERT_TS_DENM_BO_24_ATv2.xml b/data/certificates/profiles/CERT_TS_DENM_BO_24_ATv2.xml new file mode 100644 index 0000000..a11a248 --- /dev/null +++ b/data/certificates/profiles/CERT_TS_DENM_BO_24_ATv2.xml @@ -0,0 +1,28 @@ + + 2 + + + + + + + + + + + + + + + 02 FF FF + 02 FF FF FE FF + + + + + + + + + + -- GitLab From a831b1f704706ea9266376d82d9d13736db059c4 Mon Sep 17 00:00:00 2001 From: garciay Date: Mon, 24 Feb 2025 15:59:20 +0100 Subject: [PATCH 173/178] Start AtsGeonetworking review for ITS rel.2 --- TS.ITS_TTF_T036.code-workspace | 116 ------------------ .../GeoNetworking/geonetworking_codec.cc | 2 +- .../GeoNetworking/geonetworking_layer.cc | 16 +-- ttcn/AtsDENM | 2 +- ttcn/AtsGeoNetworking | 2 +- 5 files changed, 12 insertions(+), 126 deletions(-) delete mode 100644 TS.ITS_TTF_T036.code-workspace diff --git a/TS.ITS_TTF_T036.code-workspace b/TS.ITS_TTF_T036.code-workspace deleted file mode 100644 index 0130377..0000000 --- a/TS.ITS_TTF_T036.code-workspace +++ /dev/null @@ -1,116 +0,0 @@ -{ - "folders": [ - { - "path": "." - }, - { - "path": "../../tmp/crypto-test-vectors" - }, - { - "path": "../../frameworks/openssl" - }, - { - "path": "../../frameworks/titan/titan.core" - }, - { - "path": "../../frameworks/fsmsggen" - }, - { - "path": "../itscertgen" - }, - { - "path": "../../tmp/titan_etsi_its_per_issue" - }, - { - "path": "../../tmp/titan_5gngap_per_issue" - }, - { - "path": "../../tmp/test_cpp" - }, - { - "path": "../TS.ITS.pipeline-scripts" - } - ], - "settings": { - "files.associations": { - "array": "cpp", - "bit": "cpp", - "*.tcc": "cpp", - "cctype": "cpp", - "chrono": "cpp", - "clocale": "cpp", - "cmath": "cpp", - "condition_variable": "cpp", - "cstdint": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "ctime": "cpp", - "cwchar": "cpp", - "cwctype": "cpp", - "deque": "cpp", - "map": "cpp", - "unordered_map": "cpp", - "vector": "cpp", - "exception": "cpp", - "fstream": "cpp", - "functional": "cpp", - "initializer_list": "cpp", - "iomanip": "cpp", - "iosfwd": "cpp", - "iostream": "cpp", - "istream": "cpp", - "limits": "cpp", - "memory": "cpp", - "mutex": "cpp", - "new": "cpp", - "optional": "cpp", - "ostream": "cpp", - "ratio": "cpp", - "sstream": "cpp", - "stdexcept": "cpp", - "streambuf": "cpp", - "string": "cpp", - "string_view": "cpp", - "system_error": "cpp", - "thread": "cpp", - "type_traits": "cpp", - "tuple": "cpp", - "typeinfo": "cpp", - "utility": "cpp", - "atomic": "cpp", - "bitset": "cpp", - "codecvt": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstring": "cpp", - "algorithm": "cpp", - "filesystem": "cpp", - "iterator": "cpp", - "memory_resource": "cpp", - "numeric": "cpp", - "random": "cpp", - "regex": "cpp", - "set": "cpp", - "shared_mutex": "cpp", - "cinttypes": "cpp", - "*.inc": "c", - "provider.h": "c", - "sizes.h": "c", - "compare": "cpp", - "complex": "cpp", - "concepts": "cpp", - "list": "cpp", - "numbers": "cpp", - "semaphore": "cpp", - "stop_token": "cpp", - "hash_map": "cpp", - "mqtt.h": "c", - "gps.h": "c", - "unistd.h": "c", - "msggen_mec.h": "c", - "system.h": "c", - "netfwd": "cpp" - }, - "java.compile.nullAnalysis.mode": "automatic" - } -} \ No newline at end of file diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_codec.cc b/ccsrc/Protocols/GeoNetworking/geonetworking_codec.cc index 408f905..ad81d7e 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_codec.cc +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_codec.cc @@ -207,7 +207,7 @@ int geonetworking_codec::decode_(Base_Type &type, const TTCN_Typedescriptor_t &f // std::to_string(_dc.get_lifetime()).c_str()); } else if (std::string(type.get_descriptor()->name).compare("@LibItsGeoNetworking_TypesAndValues.TrafficClass") == 0) { LibItsGeoNetworking__TypesAndValues::TrafficClass &t = static_cast(r); - _dc.set_traffic_class((t.scf().as_int() << 7) | (t.channelOffload() << 6) | (t.tcId() & 0x3f)); // ETSI EN 302 636-4-1 chapter 8.7.5 + _dc.set_traffic_class((t.scf().as_int() << 7) | (t.reserved() << 6) | (t.tcId() & 0x3f)); // ETSI EN 302 636-4-1 chapter 8.7.5 } } else if (std::string(type.get_descriptor()->name).compare("@Ieee1609Dot2.Ieee1609Dot2Data") == 0) { dynamic_cast &>(type).set_to_omit(); // TODO Add security support diff --git a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc index 46ee5f8..e633085 100644 --- a/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc +++ b/ccsrc/Protocols/GeoNetworking/geonetworking_layer.cc @@ -608,7 +608,7 @@ void geonetworking_layer::fill_beacon(const OCTETSTRING &p_ll_address, const INT _beacon->basicHeader() = fill_basic_header(); _beacon->gnPacket().packet() = GnNonSecuredPacket(CommonHeader(NextHeader(NextHeader::e__any), 0, h, - TrafficClass(SCF(SCF::e__scfEnabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), int2bit(0, 8), 0, 1, 0), + TrafficClass(SCF(SCF::e__scfEnabled), Reserved(Reserved::e__reserved), 0), int2bit(0, 8), 0, 1, 0), OPTIONAL(eh), OPTIONAL()); _beacon->gnPacket().packet().payload().set_to_omit(); _beacon->gnPacket().securedMsg().set_to_omit(); @@ -632,7 +632,7 @@ void geonetworking_layer::fill_gbc_packet(const OCTETSTRING &p_ll_address, const p_geoAreaPosLatitude, p_geoAreaPosLongitude, p_distanceA, p_distanceB, p_angle, 0); _gbc_packet->basicHeader() = fill_basic_header(); _gbc_packet->gnPacket().packet() = GnNonSecuredPacket( - CommonHeader(NextHeader(NextHeader::e__btpA), 0, h, TrafficClass(SCF(SCF::e__scfDisabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), + CommonHeader(NextHeader(NextHeader::e__btpA), 0, h, TrafficClass(SCF(SCF::e__scfDisabled), Reserved(Reserved::e__reserved), 0), int2bit(128, 8), // Mobile stationnary flag set 0, 5, 0), OPTIONAL(eh), OPTIONAL()); @@ -646,15 +646,17 @@ void geonetworking_layer::fill_shb_packet(const OCTETSTRING &p_ll_address) { HeaderTST h; h.tsbHdr() = TsbHeaderType(HeaderType(HeaderType::e__topologicallyScopedBroadcast), HeaderSubTypeTSB(HeaderSubTypeTSB::e__singleHop)); ExtendedHeader eh; + MediaDependantData mediaDependantData; + mediaDependantData.mccMco() = MccMco(int2oct(255, 1), int2oct(255, 1), int2bit(15, 4), int2bit(0, 4), int2oct(0, 1)); eh.shbHeader() = SHBHeader(LongPosVector(GN__Address(TypeOfAddress(TypeOfAddress::e__manual), // TODO Use params StationType(StationType::e__passengerCar), // TODO Use params 33, p_ll_address), 0, _latitude, _longitude, int2bit(1, 1), // PAI 0, 0), - 0); + mediaDependantData); _shb_packet->basicHeader() = fill_basic_header(); _shb_packet->gnPacket().packet() = GnNonSecuredPacket( - CommonHeader(NextHeader(NextHeader::e__btpA), 0, h, TrafficClass(SCF(SCF::e__scfDisabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), + CommonHeader(NextHeader(NextHeader::e__btpA), 0, h, TrafficClass(SCF(SCF::e__scfDisabled), Reserved(Reserved::e__reserved), 0), int2bit(128, 8), // Mobile stationnary flag set 0, 1, 0), OPTIONAL(eh), OPTIONAL()); @@ -676,7 +678,7 @@ void geonetworking_layer::fill_tsb_packet(const OCTETSTRING &p_ll_address, const 0, 0)); _tsb_packet->basicHeader() = fill_basic_header(); _tsb_packet->gnPacket().packet() = GnNonSecuredPacket( - CommonHeader(NextHeader(NextHeader::e__btpA), 0, h, TrafficClass(SCF(SCF::e__scfDisabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), + CommonHeader(NextHeader(NextHeader::e__btpA), 0, h, TrafficClass(SCF(SCF::e__scfDisabled), Reserved(Reserved::e__reserved), 0), int2bit(128, 8), // Mobile stationnary flag set 0, p_max_hop_limit, 0), OPTIONAL(eh), OPTIONAL()); @@ -702,7 +704,7 @@ void geonetworking_layer::fill_uni_packet(const OCTETSTRING &p_ll_address, const 0, _latitude + 100, _longitude + 100)); _uni_packet->basicHeader() = fill_basic_header(); _uni_packet->gnPacket().packet() = GnNonSecuredPacket( - CommonHeader(NextHeader(NextHeader::e__btpA), 0, h, TrafficClass(SCF(SCF::e__scfDisabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), + CommonHeader(NextHeader(NextHeader::e__btpA), 0, h, TrafficClass(SCF(SCF::e__scfDisabled), Reserved(Reserved::e__reserved), 0), int2bit(128, 8), // Mobile stationnary flag set 0, p_max_hop_limit, 0), OPTIONAL(eh), OPTIONAL()); @@ -728,7 +730,7 @@ void geonetworking_layer::fill_ls_reply(const OCTETSTRING &p_ll_address) { 0, _latitude, _longitude)); _ls_reply->basicHeader() = fill_basic_header(); _ls_reply->gnPacket().packet() = GnNonSecuredPacket(CommonHeader(NextHeader(NextHeader::e__any), 0, h, - TrafficClass(SCF(SCF::e__scfDisabled), ChannelOffload(ChannelOffload::e__choffDisabled), 0), + TrafficClass(SCF(SCF::e__scfDisabled), Reserved(Reserved::e__reserved), 0), int2bit(128, 8), // Mobile stationnary flag set 0, 5, 0), OPTIONAL(eh), OPTIONAL()); diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index 3c07554..e31048b 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit 3c07554ea9b960e36dcc1e0a8efcb453f4301d9f +Subproject commit e31048bf2eac75f61eae9dc566869b47c516c198 diff --git a/ttcn/AtsGeoNetworking b/ttcn/AtsGeoNetworking index dbe05aa..000ab66 160000 --- a/ttcn/AtsGeoNetworking +++ b/ttcn/AtsGeoNetworking @@ -1 +1 @@ -Subproject commit dbe05aa91c4b01c39bc544bafd6760d002a6327e +Subproject commit 000ab6671e903b6d8be7665546bcfbd74100eb90 -- GitLab From 0b63a5c90882f883d8cdf324dd3a586e1e45c2bd Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 25 Feb 2025 11:33:01 +0100 Subject: [PATCH 174/178] AtsGeonetworking reference for ITS rel.2 --- ttcn/AtsGeoNetworking | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ttcn/AtsGeoNetworking b/ttcn/AtsGeoNetworking index 000ab66..7b628ce 160000 --- a/ttcn/AtsGeoNetworking +++ b/ttcn/AtsGeoNetworking @@ -1 +1 @@ -Subproject commit 000ab6671e903b6d8be7665546bcfbd74100eb90 +Subproject commit 7b628ceeea1a6e23d24b48188a64547f0a345eaa -- GitLab From e3a7ba38b58cad34c419415b9af2f6bb09e3c13a Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 3 Apr 2025 10:11:37 +0200 Subject: [PATCH 175/178] Bug fixed in virtualization --- install.sh | 49 +++++++++++-------- .../docker-dev/Dockerfile.stfubuntu | 2 + .../docker-dev/home/etc/init.d/50-ats.sh | 3 +- virtualization/vagrant/provisioner.bash | 2 +- 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/install.sh b/install.sh index 5742aa7..dd14a18 100755 --- a/install.sh +++ b/install.sh @@ -4,7 +4,7 @@ set -vx BRANCH=TTF_T036 -ASN1_BRANCH=devel2 +ASN1_BRANCH=TTF_T036 BASE_PATH=`pwd` #git checkout $BRANCH @@ -13,7 +13,12 @@ BASE_PATH=`pwd` for i in `find $BASE_PATH/ttcn -type d -name "Ats*"` do cd $i - git checkout --recurse-submodules $BRANCH + if [ "$i" == "AtsGeoNetworking" ] + then + git checkout --recurse-submodules TTF_T042 + else + git checkout --recurse-submodules $BRANCH + fi done for i in `find $BASE_PATH/ttcn/Ats* -type d -name "asn1"` @@ -22,32 +27,34 @@ do git checkout --recurse-submodules $ASN1_BRANCH if [ -f ETSI-ITS-CDD.asn ] then - ln ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn + ln -sf ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn elif [ -f CAM-PDU-Descriptions.asn ] then - ln CAM-PDU-Descriptions.asn CAM_PDU_Descriptions.asn + ln -sf CAM-PDU-Descriptions.asn CAM_PDU_Descriptions.asn elif [ -f DENM-PDU-Descriptions.asn ] then - ln DENM-PDU-Descriptions.asn DENM_PDU_Descriptions.asn + ln -sf DENM-PDU-Descriptions.asn DENM_PDU_Descriptions.asn elif [ -f VAM-PDU-Descriptions.asn ] then - ln VAM-PDU-Descriptions.asn VAM_PDU_Descriptions.asn - ln motorcyclist-special-container.asn motorcyclist_special_container.asn + ln -sf VAM-PDU-Descriptions.asn VAM_PDU_Descriptions.asn + ln -sf motorcyclist-special-container.asn motorcyclist_special_container.asn elif [ -f asn/CPM-PDU-Descriptions.asn ] then - ln asn/CPM-PDU-Descriptions.asn asn/CPM_PDU_Descriptions.asn - ln asn/CPM-OriginatingStationContainers.asn asn/CPM_OriginatingStationContainers.asn - ln asn/CPM-PerceivedObjectContainer.asn asn/CPM_PerceivedObjectContainer.asn - ln asn/CPM-PerceptionRegionContainer.asn asn/CPM_PerceptionRegionContainer.asn - ln asn/CPM-SensorInformationContainer.asn asn/CPM_SensorInformationContainer.asn + cd asn + ln -sf CPM-PDU-Descriptions.asn CPM_PDU_Descriptions.asn + ln -sf CPM-OriginatingStationContainers.asn CPM_OriginatingStationContainers.asn + ln -sf CPM-PerceivedObjectContainer.asn CPM_PerceivedObjectContainer.asn + ln -sf CPM-PerceptionRegionContainer.asn CPM_PerceptionRegionContainer.asn + ln -sf CPM-SensorInformationContainer.asn CPM_SensorInformationContainer.asn + cd - elif [ -f IVIM-PDU-Descriptions.asn ] then - ln IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn - ln MAPEM-PDU-Descriptions.asn MAPEM_PDU_Descriptions.asn - ln RTCMEM-PDU-Descriptions.asn RTCMEM_PDU_Descriptions.asn - ln SPATEM-PDU-Descriptions.asn SPATEM_PDU_Descriptions.asn - ln SREM-PDU-Descriptions.asn SREM_PDU_Descriptions.asn - ln SSEM-PDU-Descriptions.asn SSEM_PDU_Descriptions.asn + ln -sf IVIM-PDU-Descriptions.asn IVIM_PDU_Descriptions.asn + ln -sf MAPEM-PDU-Descriptions.asn MAPEM_PDU_Descriptions.asn + ln -sf RTCMEM-PDU-Descriptions.asn RTCMEM_PDU_Descriptions.asn + ln -sf SPATEM-PDU-Descriptions.asn SPATEM_PDU_Descriptions.asn + ln -sf SREM-PDU-Descriptions.asn SREM_PDU_Descriptions.asn + ln -sf SSEM-PDU-Descriptions.asn SSEM_PDU_Descriptions.asn fi SUB_DIRS=`find . -type d` if [ "SUB_DIRS" != "" ] @@ -58,7 +65,7 @@ do git checkout --recurse-submodules $ASN1_BRANCH if [ -f ETSI-ITS-CDD.asn ] then - ln ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn + ln -sf ETSI-ITS-CDD.asn ETSI_ITS_CDD.asn fi cd - done @@ -75,11 +82,13 @@ else git checkout devel fi cd ./ttcn/LibHttp -ln module_its.mk module.mk +ln -sf module_its.mk module.mk cd $BASE_PATH/ttcn/LibIts git checkout devel2 +cd $BASE_PATH/ttcn/LibCommon +ln -sf ../patch_lib_common_titan/module.mk module.mk cd $BASE_PATH ln ./ttcn/patch_lib_common_titan/module.mk ./ttcn/LibCommon/module.mk diff --git a/virtualization/docker-dev/Dockerfile.stfubuntu b/virtualization/docker-dev/Dockerfile.stfubuntu index 9fa6645..89e6cdd 100644 --- a/virtualization/docker-dev/Dockerfile.stfubuntu +++ b/virtualization/docker-dev/Dockerfile.stfubuntu @@ -41,6 +41,7 @@ RUN echo "docker-STF-dev" > /etc/hostname \ libxml2-dev \ libxml2-utils \ libyaml-dev \ + libzip-dev \ lsof \ ntp \ openssh-server \ @@ -55,6 +56,7 @@ RUN echo "docker-STF-dev" > /etc/hostname \ texlive-latex-extra \ tzdata \ valgrind \ + unzip \ xutils-dev \ xsltproc \ && DEBIAN_FRONTEND=noninteractive apt-get autoremove --purge -y \ diff --git a/virtualization/docker-dev/home/etc/init.d/50-ats.sh b/virtualization/docker-dev/home/etc/init.d/50-ats.sh index 5911fe8..31aaa95 100755 --- a/virtualization/docker-dev/home/etc/init.d/50-ats.sh +++ b/virtualization/docker-dev/home/etc/init.d/50-ats.sh @@ -11,7 +11,8 @@ cd ${HOME}/dev/TS.ITS/scripts || exit 1 echo -e "*****************************\n* Build test suites\n*****************************\n" cd ${HOME}/dev/TS.ITS -ATS_LIST="AtsCAM AtsDENM AtsCPS AtsVRU AtsIS AtsBTP AtsGeoNetworking AtsPki AtsSecurity AtsMBR" +#ATS_LIST="AtsCAM AtsDENM AtsCPS AtsVRU AtsIS AtsBTP AtsGeoNetworking AtsPki AtsSecurity AtsMBR" +ATS_LIST="AtsCAM" for i in ${ATS_LIST} do export ATS=$i diff --git a/virtualization/vagrant/provisioner.bash b/virtualization/vagrant/provisioner.bash index 67dbf48..91c5d0f 100755 --- a/virtualization/vagrant/provisioner.bash +++ b/virtualization/vagrant/provisioner.bash @@ -8,7 +8,7 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get update sudo DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y sudo DEBIAN_FRONTEND=noninteractive apt-get install software-properties-common -y sudo DEBIAN_FRONTEND=noninteractive apt-get update -sudo DEBIAN_FRONTEND=noninteractive apt-get --allow-unauthenticated install emacs gcc-9 g++-9 git subversion lsof ntp gdb make cmake flex bison autoconf doxygen graphviz libtool libncurses5-dev expect libssl-dev libgcrypt-dev libxml2-dev libedit2 libedit-dev xutils-dev libjsoncpp-dev tcpdump libpcap-dev unzip sshpass kubuntu-desktop valgrind vim tzdata dos2unix xsltproc -y +sudo DEBIAN_FRONTEND=noninteractive apt-get --allow-unauthenticated install emacs gcc-9 g++-9 git subversion lsof ntp gdb make cmake flex bison autoconf doxygen graphviz libtool libncurses5-dev expect libssl-dev libgcrypt-dev libxml2-dev libzip-dev libedit2 libedit-dev xutils-dev libjsoncpp-dev tcpdump libpcap-dev unzip sshpass kubuntu-desktop valgrind vim tzdata dos2unix xsltproc -y #sudo DEBIAN_FRONTEND=noninteractive apt --fix-broken install -y sudo DEBIAN_FRONTEND=noninteractive apt-get autoremove --purge -y sudo DEBIAN_FRONTEND=noninteractive apt-get clean -- GitLab From 49344a5cfd432022a60f635f3e87e65867f75f21 Mon Sep 17 00:00:00 2001 From: garciay Date: Thu, 3 Apr 2025 10:21:06 +0200 Subject: [PATCH 176/178] Bug fixed in virtualization --- install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index dd14a18..b6a5bdc 100755 --- a/install.sh +++ b/install.sh @@ -13,7 +13,8 @@ BASE_PATH=`pwd` for i in `find $BASE_PATH/ttcn -type d -name "Ats*"` do cd $i - if [ "$i" == "AtsGeoNetworking" ] + BS=`basename $i` + if [ "$BS" == "AtsGeoNetworking" ] then git checkout --recurse-submodules TTF_T042 else -- GitLab From d84331c4d98d3a70fee32f711e81f1d8c47fe166 Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 2 Dec 2025 10:03:41 +0100 Subject: [PATCH 177/178] Editorial changes --- README.md | 2 +- ccsrc/Protocols/BTP/btp_types.hh | 2 +- ccsrc/Protocols/BTP_layers/btp_layer.hh | 2 +- ccsrc/Protocols/BTP_layers/btp_layer_factory.hh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index eb19f9a..5803b5c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ETSI ITS protocols project supports: - ETSI TS 103 900 v2.1.1: "Intelligent Transport Systems (ITS); Vehicular Communications; Basic Set of Applications; Part 2: Specification of Cooperative Awareness Basic Service" - ETSI TS 103 831 v2.1.1: "Intelligent Transport Systems (ITS); Vehicular Communications; Basic Set of Applications; Part 3: Specifications of Decentralized Environmental Notification Basic Service" - ETSI TS 103 301 v2.1.1: "Intelligent Transport Systems (ITS); Vehicular Communications; Basic Set of Applications; Facilities layer protocols and communication requirements for infrastructure services" -- EN 302 636-5-1 V2.2.1: "Intelligent Transport Systems (ITS); Vehicular Communications; GeoNetworking; Part 5: Transport Protocols; Sub-part 1: Basic Transport Protocol" +- EN 302 636-5-1 V1.4.1: "Intelligent Transport Systems (ITS); Vehicular Communications; GeoNetworking; Part 5: Transport Protocols; Sub-part 1: Basic Transport Protocol" - ETSI TS 103 836-4-1 v2.1.1: "Intelligent Transport Systems (ITS); Vehicular Communications; GeoNetworking; Part 4: Geographical addressing and forwarding for point-to-point and point-to-multipoint communications; Sub-part 1: Media-Independent Functionality" In addition, it also support ITS Security as define by: diff --git a/ccsrc/Protocols/BTP/btp_types.hh b/ccsrc/Protocols/BTP/btp_types.hh index 46269ad..a566645 100644 --- a/ccsrc/Protocols/BTP/btp_types.hh +++ b/ccsrc/Protocols/BTP/btp_types.hh @@ -6,7 +6,7 @@ * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. - * \version ETSI EN 302 636-5-1 V2.2.1 + * \version ETSI EN 302 636-5-1 V1.4.1 */ #pragma once diff --git a/ccsrc/Protocols/BTP_layers/btp_layer.hh b/ccsrc/Protocols/BTP_layers/btp_layer.hh index 51aa078..99f1888 100644 --- a/ccsrc/Protocols/BTP_layers/btp_layer.hh +++ b/ccsrc/Protocols/BTP_layers/btp_layer.hh @@ -6,7 +6,7 @@ * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. - * \version ETSI EN 302 636-5-1 V2.2.1 + * \version ETSI EN 302 636-5-1 V1.4.1 */ #pragma once diff --git a/ccsrc/Protocols/BTP_layers/btp_layer_factory.hh b/ccsrc/Protocols/BTP_layers/btp_layer_factory.hh index 57931a0..107a3c5 100644 --- a/ccsrc/Protocols/BTP_layers/btp_layer_factory.hh +++ b/ccsrc/Protocols/BTP_layers/btp_layer_factory.hh @@ -6,7 +6,7 @@ * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. - * \version ETSI EN 302 636-5-1 V2.2.1 + * \version ETSI EN 302 636-5-1 V1.4.1 */ #pragma once -- GitLab From 173a653c4c7783718766326dd78d5259ad14d4ad Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 2 Dec 2025 10:12:05 +0100 Subject: [PATCH 178/178] Add missing external functions --- TS.ITS.TTF_T042.code-workspace | 7 +++++ ccsrc/Externals/LibItsCommon_externals.cc | 36 +++++++++++++++++++++++ config.mk | 2 +- titan-test-system-framework | 2 +- ttcn/AtsCAM | 2 +- ttcn/AtsCPS | 2 +- ttcn/AtsDENM | 2 +- ttcn/AtsGeoNetworking | 2 +- ttcn/AtsIS | 2 +- ttcn/AtsSecurity | 2 +- ttcn/AtsVRU | 2 +- ttcn/LibIts | 2 +- 12 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 TS.ITS.TTF_T042.code-workspace diff --git a/TS.ITS.TTF_T042.code-workspace b/TS.ITS.TTF_T042.code-workspace new file mode 100644 index 0000000..362d7c2 --- /dev/null +++ b/TS.ITS.TTF_T042.code-workspace @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": "." + } + ] +} \ No newline at end of file diff --git a/ccsrc/Externals/LibItsCommon_externals.cc b/ccsrc/Externals/LibItsCommon_externals.cc index 2a2c16f..211a1fa 100644 --- a/ccsrc/Externals/LibItsCommon_externals.cc +++ b/ccsrc/Externals/LibItsCommon_externals.cc @@ -10,6 +10,8 @@ #define earthRadius 6378137.0L #define rbis = ((double)(earthRadius * M_PI / 180)) +#define epsilon ((double)0.000001) + namespace LibItsCommon__Functions { /** @@ -128,4 +130,38 @@ namespace LibItsCommon__Functions { */ FLOAT fx__computeRadiusFromCircularArea(const FLOAT &p__squareMeters) { return FLOAT(sqrt(p__squareMeters / M_PI)); } + // Verifiy 'euclidian distance (P1, P2) > minReferencePointPositonChangeThreshold' + BOOLEAN fx__verify__euclidian__distance(const INTEGER& p__p1__lat, const INTEGER& p__p1__lon, const INTEGER& p__p2__lat, const INTEGER& p__p2__lon, const FLOAT& p__threshold, const INTEGER& p__comparison) { + + double v = sqrt( + ( + (double)static_cast(p__p2__lat) * (double)static_cast(p__p2__lat) - (double)static_cast(p__p1__lat) * (double)static_cast(p__p1__lat) + ) + + ( + (double)static_cast(p__p2__lon) * (double)static_cast(p__p2__lon) - (double)static_cast(p__p1__lon) * (double)static_cast(p__p1__lon) + ) + ); + + if (p__comparison == 0) { + return abs(v - (double)static_cast(p__threshold)) < epsilon; + } else if (p__comparison == -1) { + return ((double)static_cast(p__threshold) - v) < -epsilon; + } else { + return ((double)static_cast(p__threshold) - v) > epsilon; + } + } + + BOOLEAN fx__verify__delta(const INTEGER& p__v1, const INTEGER& p__v2, const FLOAT& p__threshold, const INTEGER& p__comparison) { + + double v = (double)static_cast(p__v2) - (double)static_cast(p__v1); + + if (p__comparison == 0) { + return abs(v - (double)static_cast(p__threshold)) < epsilon; + } else if (p__comparison == -1) { + return ((double)static_cast(p__threshold) - v) < -epsilon; + } else { + return ((double)static_cast(p__threshold) - v) > epsilon; + } + } + } // namespace LibItsCommon__Functions diff --git a/config.mk b/config.mk index b9dad9f..c36c17b 100644 --- a/config.mk +++ b/config.mk @@ -1,6 +1,6 @@ TTCN3_COMPILER_OPTIONS := -d -e -f -g -H -j -l -L -R -U none -x -X TTCN3_DIR := $(HOME)/frameworks/titan/titan.core/Install -ASN1C_PATH := $(HOME)/frameworks/asn1c.denis +ASN1C_PATH := $(HOME)/frameworks/asn1c #WPCAP_DLL_PATH := /cygdrive/c/windows/system32/npcap/wpcap.dll #NPCAP_INCLUDE := /cygdrive/c/PROGRA~1/Npcap/sdk/include #T3Q_PATH=./tools/t3q-v2.0.0b30 diff --git a/titan-test-system-framework b/titan-test-system-framework index a8db2ae..ed00235 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit a8db2aefc860cdfec0b76ae767f5c91fe7ec042f +Subproject commit ed00235c4469eba2d33bbff9f96aaad8a641e84c diff --git a/ttcn/AtsCAM b/ttcn/AtsCAM index 2e6d1a8..3a49dda 160000 --- a/ttcn/AtsCAM +++ b/ttcn/AtsCAM @@ -1 +1 @@ -Subproject commit 2e6d1a86b54ec3eb11fc5b7f6e70f80b06834a50 +Subproject commit 3a49ddad6cc59694b4936d43dca49038325a01e7 diff --git a/ttcn/AtsCPS b/ttcn/AtsCPS index ce6120e..47c5614 160000 --- a/ttcn/AtsCPS +++ b/ttcn/AtsCPS @@ -1 +1 @@ -Subproject commit ce6120ec2ad1e6be306924f6a790d902a6b9f38a +Subproject commit 47c561413ca8de2a664309f5651d2a15bbb18001 diff --git a/ttcn/AtsDENM b/ttcn/AtsDENM index e31048b..440d05d 160000 --- a/ttcn/AtsDENM +++ b/ttcn/AtsDENM @@ -1 +1 @@ -Subproject commit e31048bf2eac75f61eae9dc566869b47c516c198 +Subproject commit 440d05dacb1151e77529ebba02c78fd6bb469e2b diff --git a/ttcn/AtsGeoNetworking b/ttcn/AtsGeoNetworking index 7b628ce..03f0a1a 160000 --- a/ttcn/AtsGeoNetworking +++ b/ttcn/AtsGeoNetworking @@ -1 +1 @@ -Subproject commit 7b628ceeea1a6e23d24b48188a64547f0a345eaa +Subproject commit 03f0a1a49641e9dd94bd47385919ca0f027bc353 diff --git a/ttcn/AtsIS b/ttcn/AtsIS index 95ed727..873d060 160000 --- a/ttcn/AtsIS +++ b/ttcn/AtsIS @@ -1 +1 @@ -Subproject commit 95ed727c7cc6f32b15e94f6f3d9f6f669f041acd +Subproject commit 873d0605293c11564f3f5186c3feb8341c8b951c diff --git a/ttcn/AtsSecurity b/ttcn/AtsSecurity index 2abcd22..060d338 160000 --- a/ttcn/AtsSecurity +++ b/ttcn/AtsSecurity @@ -1 +1 @@ -Subproject commit 2abcd22f8d08f25d0b01ec2ad0dd7de6392380f2 +Subproject commit 060d3384e88c6e61e828733dd57c23b260d9f24e diff --git a/ttcn/AtsVRU b/ttcn/AtsVRU index fd1aabe..ccf334f 160000 --- a/ttcn/AtsVRU +++ b/ttcn/AtsVRU @@ -1 +1 @@ -Subproject commit fd1aabe32f0d8d6bb47855880466db4deb53b132 +Subproject commit ccf334f7fae9212f6d7de7ba46d7d5cb9963b37b diff --git a/ttcn/LibIts b/ttcn/LibIts index e9c6c8a..106441a 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit e9c6c8a48c937bfdc685a67e9648cedc76b581ec +Subproject commit 106441a0202a522ad4f79830fbf64b18125707dd -- GitLab