Commit a6399a11 authored by Denis Filatov's avatar Denis Filatov
Browse files

Merge branch 'devel' of https://forge.etsi.org/rep/ITS/TS.ITS

parents 267aba68 8c135c9a
Loading
Loading
Loading
Loading

.gitignore

100755 → 100644
+6 −3
Original line number Diff line number Diff line
build
build
bin
config.mk
data/certificates/*
!data/certificates/profiles
!data/certificates/Makefile
+0 −1
Original line number Diff line number Diff line
@@ -147,4 +147,3 @@ $(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)))
+33 −4
Original line number Diff line number Diff line
@@ -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 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)) {
@@ -1298,7 +1298,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 {
      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();
@@ -1316,11 +1322,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;
  }

+9 −9
Original line number Diff line number Diff line
#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
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
+88 −48
Original line number Diff line number Diff line
@@ -6,20 +6,25 @@ else
 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= ../../../itscertgen/build/msvc/x64/Debug/certgen.exe
  asn1certgen= $(CERTGEN)/build/msvc/x64/Debug/certgen.exe
else
  asn1certgen=../../../itscertgen/build/$(ARCH)-d/certgen
  asn1certgen=$(CERTGEN)/build/$(ARCH)-d/certgen
endif

xsl_cvt=../../../itscertgen/certgen/asn1certgen.xslt
xsl_dep=../../../itscertgen/certgen/prof2dep.xsl
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))
@@ -28,7 +33,7 @@ deps=$(patsubst $(in)/%.xml, $(depdir)/%.dep, $(profiles))

all: $(sort $(outdir) $(xerdir) $(depdir)) $(certificates_oer)

$(sort $(outdir) $(xerdir) $(depdir)):
$(sort $(outdir) $(xerdir) $(depdir) $(iutdir)):
	mkdir -p $@
clean:
	rm -f $(certificates_oer) $(certificates_xer)
@@ -45,4 +50,39 @@ $(deps): $(depdir)/%.dep : $(in)/%.xml

$(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):

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_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)
Loading