IEEE 1609.2-2016 stub

This commit is contained in:
Lev Walkin 2017-08-07 17:47:50 -07:00
parent 8077f93861
commit d748bffbfc
6 changed files with 490 additions and 22 deletions

View File

@ -1,35 +1,40 @@
This directory contains a few examples.
1. The ./sample.source.PKIX1 directory contains the X.509 Certificate decoder,
as specified in rfc3280.txt. Just type `make` in there to compile.
1. The ./sample.source.PKIX1 directory contains the X.509 Certificate decoder,
as specified in rfc3280.txt. Just type `make` in there to compile.
2. The ./sample.source.MHEG5 directory contains the decoder for
ISO 13522 MHEG-5/ITU-T T.172 (Multimedia Hypermedia Experts Group,
Multimedia Presentations). Read the README file in that directory.
2. The ./sample.source.MHEG5 directory contains the decoder for
ISO 13522 MHEG-5/ITU-T T.172 (Multimedia Hypermedia Experts Group,
Multimedia Presentations). Read the README file in that directory.
3. The ./sample.source.MEGACO directory contains the decoder for
Media Gateway Control Protocol data units as specified in rfc3525.txt.
3. The ./sample.source.MEGACO directory contains the decoder for
Media Gateway Control Protocol data units as specified in rfc3525.txt.
4. The ./sample.source.LDAP3 directory contains the decoder for
Lightweight Directory Access Protocol version 3 PDU as specified in
rfc4211.txt.
4. The ./sample.source.LDAP3 directory contains the decoder for
Lightweight Directory Access Protocol version 3 PDU as specified in
rfc4211.txt.
5. The ./sample.source.RRC directory contains the 3GPP Radio Resource Control
decoder for RRC version 7.1.0. Just type `make` in there to compile.
5. The ./sample.source.RRC directory contains the 3GPP Radio Resource Control
decoder for RRC version 7.1.0. Just type `make` in there to compile.
6. The ./sample.source.LTE-RRC directory contains the 3GPP RRC
decoder for LTE RRC version 14.2.1. Read the README file in that directory.
6. The ./sample.source.LTE-RRC directory contains the 3GPP RRC
decoder for LTE RRC version 14.2.1. Read the README file in that directory.
7. The ./sample.source.TAP3 directory contains the GSM TAP3 decoder.
Before trying to compile, read the README file in that directory.
7. The ./sample.source.TAP3 directory contains the GSM TAP3 decoder.
Before trying to compile, read the README file in that directory.
8. The ./sample.source.ULP directory contains the Open Mobile Alliance
UserPlane Location Protocol decoder.
Before trying to compile, read the README file in that directory.
8. The ./sample.source.ULP directory contains the Open Mobile Alliance
UserPlane Location Protocol decoder.
Before trying to compile, read the README file in that directory.
9. The ./sample.source.J2735 directory contains the SAE J2735-201603 decoder.
Before trying to compile, read the README file in that directory.
9. The ./sample.source.J2735 directory contains the SAE J2735-201603 decoder.
Before trying to compile, read the README file in that directory.
WARNING WARNING WARNING: WORK IN PROGRESS. Not supposed to work yet.
10. The ./sample.source.1609.2 directory contains the IEEE 1609.2-2016 decoder.
Before trying to compile, read the README file in that directory.
WARNING WARNING WARNING: WORK IN PROGRESS. Not supposed to work yet.
The crfc2asn1.pl script can be used to extract ASN.1 data from RFC texts.
For instance, it is used to extract X.509, MEGACO, and LDAPv3 ASN.1 modules

View File

@ -45,7 +45,7 @@ test -n "$TITLE" && EXTRA_CPPFLAGS="-DASN_CONVERTER_TITLE=\"$TITLE\" ${EXTRA_CPP
set -x
cat Makefile.am.sample \
| sed -e "s/^CPPFLAGS += /CPPFLAGS += ${EXTRA_CPPFLAGS} /" \
| sed -e "s/^all: /all: ${ASN1PDU}.c /" \
| sed -e "s/^all: /all: maybe-wip-pause ${ASN1PDU}.c /" \
| sed -e "s/progname/${PROGNAME}/" \
> Makefile.$$
set +x
@ -127,6 +127,9 @@ set +x
echo ' ./${TARGET} -J0.001 -n 1000 -b $$b -iper -onull $$f || exit 8; \'
echo ' done; done; fi'
echo
echo "maybe-wip-pause:"
echo " @[ -f WIP ] && cat WIP && sleep 2"
echo
echo "distclean: clean"
echo ' rm -f $(ASN_MODULE_SOURCES)'
echo ' rm -f $(ASN_MODULE_HEADERS)'

View File

@ -0,0 +1,398 @@
ASN_MODULE_SOURCES= \
Uint3.c \
Uint8.c \
Uint16.c \
Uint32.c \
Uint64.c \
SequenceOfUint8.c \
SequenceOfUint16.c \
Opaque.c \
HashedId32.c \
HashedId10.c \
HashedId8.c \
HashedId4.c \
HashedId3.c \
Time32.c \
Time64.c \
ValidityPeriod.c \
Duration.c \
GeographicRegion.c \
CircularRegion.c \
RectangularRegion.c \
SequenceOfRectangularRegion.c \
PolygonalRegion.c \
TwoDLocation.c \
IdentifiedRegion.c \
SequenceOfIdentifiedRegion.c \
CountryOnly.c \
CountryAndRegions.c \
CountryAndSubregions.c \
RegionAndSubregions.c \
SequenceOfRegionAndSubregions.c \
ThreeDLocation.c \
Latitude.c \
Longitude.c \
Elevation.c \
NinetyDegreeInt.c \
KnownLatitude.c \
UnknownLatitude.c \
OneEightyDegreeInt.c \
KnownLongitude.c \
UnknownLongitude.c \
ElevInt.c \
Signature.c \
EcdsaP256Signature.c \
EccP256CurvePoint.c \
SymmAlgorithm.c \
HashAlgorithm.c \
EciesP256EncryptedKey.c \
EncryptionKey.c \
PublicEncryptionKey.c \
BasePublicEncryptionKey.c \
PublicVerificationKey.c \
SymmetricEncryptionKey.c \
PsidSsp.c \
SequenceOfPsidSsp.c \
Psid.c \
SequenceOfPsid.c \
ServiceSpecificPermissions.c \
PsidSspRange.c \
SequenceOfPsidSspRange.c \
SspRange.c \
SequenceOfOctetString.c \
SubjectAssurance.c \
CrlSeries.c \
IValue.c \
Hostname.c \
LinkageValue.c \
GroupLinkageValue.c \
LaId.c \
LinkageSeed.c \
SignedDataPayload.c \
Ieee1609Dot2Data.c \
Ieee1609Dot2Content.c \
SignedData.c \
SignerIdentifier.c \
ToBeSignedData.c \
HashedData.c \
HeaderInfo.c \
MissingCrlIdentifier.c \
Countersignature.c \
EncryptedData.c \
RecipientInfo.c \
SequenceOfRecipientInfo.c \
PreSharedKeyRecipientInfo.c \
SymmRecipientInfo.c \
PKRecipientInfo.c \
EncryptedDataEncryptionKey.c \
SymmetricCiphertext.c \
AesCcmCiphertext.c \
Certificate.c \
SequenceOfCertificate.c \
CertificateBase.c \
CertificateType.c \
ImplicitCertificate.c \
ExplicitCertificate.c \
IssuerIdentifier.c \
ToBeSignedCertificate.c \
CertificateId.c \
LinkageData.c \
EndEntityType.c \
PsidGroupPermissions.c \
SequenceOfPsidGroupPermissions.c \
SubjectPermissions.c \
VerificationKeyIndicator.c
ASN_MODULE_HEADERS= \
Uint3.h \
Uint8.h \
Uint16.h \
Uint32.h \
Uint64.h \
SequenceOfUint8.h \
SequenceOfUint16.h \
Opaque.h \
HashedId32.h \
HashedId10.h \
HashedId8.h \
HashedId4.h \
HashedId3.h \
Time32.h \
Time64.h \
ValidityPeriod.h \
Duration.h \
GeographicRegion.h \
CircularRegion.h \
RectangularRegion.h \
SequenceOfRectangularRegion.h \
PolygonalRegion.h \
TwoDLocation.h \
IdentifiedRegion.h \
SequenceOfIdentifiedRegion.h \
CountryOnly.h \
CountryAndRegions.h \
CountryAndSubregions.h \
RegionAndSubregions.h \
SequenceOfRegionAndSubregions.h \
ThreeDLocation.h \
Latitude.h \
Longitude.h \
Elevation.h \
NinetyDegreeInt.h \
KnownLatitude.h \
UnknownLatitude.h \
OneEightyDegreeInt.h \
KnownLongitude.h \
UnknownLongitude.h \
ElevInt.h \
Signature.h \
EcdsaP256Signature.h \
EccP256CurvePoint.h \
SymmAlgorithm.h \
HashAlgorithm.h \
EciesP256EncryptedKey.h \
EncryptionKey.h \
PublicEncryptionKey.h \
BasePublicEncryptionKey.h \
PublicVerificationKey.h \
SymmetricEncryptionKey.h \
PsidSsp.h \
SequenceOfPsidSsp.h \
Psid.h \
SequenceOfPsid.h \
ServiceSpecificPermissions.h \
PsidSspRange.h \
SequenceOfPsidSspRange.h \
SspRange.h \
SequenceOfOctetString.h \
SubjectAssurance.h \
CrlSeries.h \
IValue.h \
Hostname.h \
LinkageValue.h \
GroupLinkageValue.h \
LaId.h \
LinkageSeed.h \
SignedDataPayload.h \
Ieee1609Dot2Data.h \
Ieee1609Dot2Content.h \
SignedData.h \
SignerIdentifier.h \
ToBeSignedData.h \
HashedData.h \
HeaderInfo.h \
MissingCrlIdentifier.h \
Countersignature.h \
EncryptedData.h \
RecipientInfo.h \
SequenceOfRecipientInfo.h \
PreSharedKeyRecipientInfo.h \
SymmRecipientInfo.h \
PKRecipientInfo.h \
EncryptedDataEncryptionKey.h \
SymmetricCiphertext.h \
AesCcmCiphertext.h \
Certificate.h \
SequenceOfCertificate.h \
CertificateBase.h \
CertificateType.h \
ImplicitCertificate.h \
ExplicitCertificate.h \
IssuerIdentifier.h \
ToBeSignedCertificate.h \
CertificateId.h \
LinkageData.h \
EndEntityType.h \
PsidGroupPermissions.h \
SequenceOfPsidGroupPermissions.h \
SubjectPermissions.h \
VerificationKeyIndicator.h
ASN_MODULE_HEADERS+=UTF8String.h
ASN_MODULE_HEADERS+=BOOLEAN.h
ASN_MODULE_SOURCES+=BOOLEAN.c
ASN_MODULE_HEADERS+=INTEGER.h
ASN_MODULE_HEADERS+=NativeEnumerated.h
ASN_MODULE_SOURCES+=INTEGER.c
ASN_MODULE_HEADERS+=NULL.h
ASN_MODULE_SOURCES+=NULL.c
ASN_MODULE_SOURCES+=NativeEnumerated.c
ASN_MODULE_HEADERS+=NativeInteger.h
ASN_MODULE_SOURCES+=NativeInteger.c
ASN_MODULE_SOURCES+=UTF8String.c
ASN_MODULE_HEADERS+=asn_SEQUENCE_OF.h
ASN_MODULE_SOURCES+=asn_SEQUENCE_OF.c
ASN_MODULE_HEADERS+=asn_SET_OF.h
ASN_MODULE_SOURCES+=asn_SET_OF.c
ASN_MODULE_HEADERS+=constr_CHOICE.h
ASN_MODULE_SOURCES+=constr_CHOICE.c
ASN_MODULE_HEADERS+=constr_SEQUENCE.h
ASN_MODULE_SOURCES+=constr_SEQUENCE.c
ASN_MODULE_HEADERS+=constr_SEQUENCE_OF.h
ASN_MODULE_SOURCES+=constr_SEQUENCE_OF.c
ASN_MODULE_HEADERS+=constr_SET_OF.h
ASN_MODULE_SOURCES+=constr_SET_OF.c
ASN_MODULE_HEADERS+=asn_application.h
ASN_MODULE_HEADERS+=asn_system.h
ASN_MODULE_HEADERS+=asn_codecs.h
ASN_MODULE_HEADERS+=asn_internal.h
ASN_MODULE_HEADERS+=OCTET_STRING.h
ASN_MODULE_SOURCES+=OCTET_STRING.c
ASN_MODULE_HEADERS+=BIT_STRING.h
ASN_MODULE_SOURCES+=BIT_STRING.c
ASN_MODULE_SOURCES+=asn_codecs_prim.c
ASN_MODULE_HEADERS+=asn_codecs_prim.h
ASN_MODULE_HEADERS+=ber_tlv_length.h
ASN_MODULE_SOURCES+=ber_tlv_length.c
ASN_MODULE_HEADERS+=ber_tlv_tag.h
ASN_MODULE_SOURCES+=ber_tlv_tag.c
ASN_MODULE_HEADERS+=ber_decoder.h
ASN_MODULE_SOURCES+=ber_decoder.c
ASN_MODULE_HEADERS+=der_encoder.h
ASN_MODULE_SOURCES+=der_encoder.c
ASN_MODULE_HEADERS+=constr_TYPE.h
ASN_MODULE_SOURCES+=constr_TYPE.c
ASN_MODULE_HEADERS+=constraints.h
ASN_MODULE_SOURCES+=constraints.c
ASN_MODULE_HEADERS+=xer_support.h
ASN_MODULE_SOURCES+=xer_support.c
ASN_MODULE_HEADERS+=xer_decoder.h
ASN_MODULE_SOURCES+=xer_decoder.c
ASN_MODULE_HEADERS+=xer_encoder.h
ASN_MODULE_SOURCES+=xer_encoder.c
ASN_MODULE_HEADERS+=oer_decoder.h
ASN_MODULE_SOURCES+=oer_decoder.c
ASN_MODULE_HEADERS+=oer_encoder.h
ASN_MODULE_SOURCES+=oer_encoder.c
ASN_MODULE_HEADERS+=oer_support.h
ASN_MODULE_SOURCES+=oer_support.c
ASN_MODULE_HEADERS+=per_support.h
ASN_MODULE_SOURCES+=per_support.c
ASN_MODULE_HEADERS+=per_decoder.h
ASN_MODULE_SOURCES+=per_decoder.c
ASN_MODULE_HEADERS+=per_encoder.h
ASN_MODULE_SOURCES+=per_encoder.c
ASN_MODULE_HEADERS+=per_opentype.h
ASN_MODULE_SOURCES+=per_opentype.c
ASN_CONVERTER_SOURCES+=converter-sample.c
ASN_MODULE_SOURCES+=INTEGER_oer.c
ASN_MODULE_SOURCES+=OCTET_STRING_oer.c
ASN_MODULE_SOURCES+=NativeInteger_oer.c
ASN_MODULE_SOURCES+=constr_SEQUENCE_oer.c
ASN_CONVERTER_SOURCES+=pdu_collection.c
lib_LTLIBRARIES=libsomething.la
libsomething_la_SOURCES=$(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS)
# This file may be used as an input for make(3)
# Remove the lines below to convert it into a pure .am file
TARGET = 1609-2-dump
CPPFLAGS += -DASN_CONVERTER_TITLE="IEEE 1609.2-2016 decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE -DASN_DISABLE_PER_SUPPORT -DPDU=Certificate -DASN_PDU_COLLECTION -I.
OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o}
all: maybe-wip-pause Certificate.c $(TARGET)
$(TARGET): ${OBJS}
$(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) ${OBJS} $(LDFLAGS) $(LIBS)
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
clean:
rm -f $(TARGET)
rm -f $(OBJS)
regen: regenerate-from-asn1-source
regenerate-from-asn1-source:
../../asn1c/asn1c -S ../../skeletons -pdu=Certificate -pdu=auto -fcompound-names -gen-OER ../IEEE-1609.2-2016.asn1
Certificate.c: ../sample.makefile.regen ../IEEE-1609.2-2016.asn1
make regen-makefile
@touch Certificate.c
make
regen-makefile:
TITLE="IEEE 1609.2-2016 decoder" \
ASN1CMDOPTS="-pdu=auto -fcompound-names -gen-OER" \
ASN1MODULES="../IEEE-1609.2-2016.asn1" \
ASN1PDU=Certificate \
PROGNAME=1609-2-dump \
CPPFLAGS="" \
../sample.makefile.regen
check: ${TARGET} check-ber check-xer check-per
@echo ================
@echo All tests passed
@echo ================
check-ber:
@if test -f sample-Certificate-1.[db]er ; then \
for f in sample-Certificate-*.[db]er; do \
for b in 1 17 33 980 8192; do \
echo "Recoding $$f into XER and back ($$b)..."; \
./${TARGET} -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -b $$b -iber -onull $$f || exit 5; \
./${TARGET} -J0.001 -n 1000 -b $$b -iber -onull $$f || exit 6; \
done; done; fi
check-xer:
@if test -f sample-Certificate-1.xer ; then \
for f in sample-Certificate-*.xer; do \
for b in 1 17 33 980 8192; do \
echo "Recoding $$f into DER and back ($$b)..."; \
./${TARGET} -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
diff $$f ./.tmp.2.$$$$ || exit 4; \
rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -b $$b -ixer -onull $$f || exit 5; \
./${TARGET} -J0.001 -n 1000 -b $$b -ixer -onull $$f || exit 6; \
done; done; fi
check-per:
@if test -f sample-Certificate-1-nopad.per ; then \
for f in sample-Certificate-[1-9]-nopad.per; do \
for b in 1 17 33 980 8192; do \
echo "Recoding non-padded $$f into DER into XER and back ($$b)..."; \
./${TARGET} -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
./${TARGET} -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \
diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
rm -f ./.tmp.[123].$$$$; \
echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 6; \
./${TARGET} -J0.001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 7; \
done; done; fi
@if test -f sample-Certificate-1.per ; then \
for f in sample-*-[1-9].per; do \
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\1/"`; \
for b in 1 17 33 980 8192; do \
echo "Recoding $$f into DER into XER and back ($$b)..."; \
./${TARGET} -b $$b -p $$pdu -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \
./${TARGET} -b $$b -p $$pdu -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \
./${TARGET} -b $$b -p $$pdu -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \
diff $$f ./.tmp.1.$$$$ || exit 6; \
rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \
./${TARGET} -J0.0001 -n 1000 -b $$b -iper -onull $$f || exit 7; \
./${TARGET} -J0.001 -n 1000 -b $$b -iper -onull $$f || exit 8; \
done; done; fi
maybe-wip-pause:
@[ -f WIP ] && cat WIP && sleep 2
distclean: clean
rm -f $(ASN_MODULE_SOURCES)
rm -f $(ASN_MODULE_HEADERS)
rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS)
rm -f Makefile.am.sample

View File

@ -0,0 +1,46 @@
GENERAL INFORMATION
===================
The IEEE 1609.2-2016 "Wireless Access in Vehicular Environments --
Security Services for Applications and Management Messages" messages decoder.
Invoking `make` will compile the ASN.1 specifications from the
../IEEE-1609.2-2016.asn1 file.
THERE IS NO IEEE-1609.2-2016.asn1 FILE THERE YET!
OBTAINING THE IEEE 1609.2-2016 SPECIFICATION
============================================
Download the standard containing the ASN.1 module files from
https://standards.ieee.org/findstds/standard/1609.2-2016.html
You should extract the ASN.1 modules from there and save it
into a single ../IEEE-1609.2-2016.asn1 file. This file should start with
the following line
IEEE1609dot2BaseTypes {iso(1) identified-organization(3) ieee(111)
or
IEEE1609dot2 {iso(1) identified-organization(3) ieee(111)
(both of these modules should be present in the file; order is unimportant)
and end with the "END" token.
Be careful not to copy any non-ASN.1 preambles from that .DOC file.
After obtaining the IEEE-1609.2-2016.asn1, type `make` in the directory
containing this README file.
1609-2-dump USAGE
=================
The 1609-2-dump utility may be used to dump the contents of the
OER-encoded Certificate file:
./1609-2-dump 1609cert.oer # Print as XML (BASIC-XER)
The full list of recognized command line options may be obtained with
> ./1609-2-dump -h

View File

@ -0,0 +1,6 @@
This project is a work in progress and is not supposed to compile or work yet.
Any errors are known and will be fixed.
Sleeping a few seconds...

View File

@ -0,0 +1,10 @@
extern int opt_debug;
#define ASN_DEBUG(fmt, args...) do { \
if(opt_debug < 2) break; \
fprintf(stderr, fmt, ##args); \
fprintf(stderr, " (%s:%d)\n", \
__FILE__, __LINE__); \
} while(0)