Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of Aligned PER and Information Object Class #115

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
49a9c25
add support for parsing class object set
Apr 15, 2016
70efeb2
asn1p_fix_enum if it is being referenced before resolved.
Apr 16, 2016
a1cbc4c
Parse Information Object successfully.
zhanglei002 Apr 17, 2016
8ea1fc2
port/merge Eurecom APER support from OPENAIRMME
AuthenticEshkinKot Aug 2, 2016
fe97dd4
aper: fixup after port
AuthenticEshkinKot Aug 3, 2016
77d7069
skeletons: Fix compiler warnings introduced by Eurecom aper patch
AuthenticEshkinKot Aug 3, 2016
ca34636
APER: Fix encoding of INTEGER with lower_bound != 0
AuthenticEshkinKot Aug 3, 2016
8407c2c
fix APER encoding of integer (backport from openairinterface)
AuthenticEshkinKot Aug 3, 2016
c40bdea
Fix a bug in asn1c PER code when skipping unknown extension
AuthenticEshkinKot Aug 3, 2016
893d625
prefixing of generated types using a ASN1C_PREFIX environment variable
AuthenticEshkinKot Aug 3, 2016
e6f1e70
aper fix for decoding constrained integer with lower boundary
AuthenticEshkinKot Aug 3, 2016
b2f3d87
Final fixes
AuthenticEshkinKot Aug 3, 2016
5da982f
Leak was fixed
AuthenticEshkinKot Jan 26, 2017
271171d
c99 for skeletons
AuthenticEshkinKot Jan 26, 2017
9cb9e92
compiler warnings in asn1c_out.h were fixed
AuthenticEshkinKot Jan 27, 2017
908cab5
some warnings were fixed
AuthenticEshkinKot Jan 31, 2017
15e455e
Larger constraints
AuthenticEshkinKot Feb 1, 2017
461f3fa
Check without duplication
AuthenticEshkinKot Feb 1, 2017
22d6864
spaces replaced by tabs
AuthenticEshkinKot Feb 2, 2017
6d06ae1
separate functions for APER and UPER
AuthenticEshkinKot Feb 2, 2017
0d6c911
tests were updated to fit new format
AuthenticEshkinKot Feb 2, 2017
f49ee68
work in 128-bit integer values while compiling
KrzysztofW Jun 9, 2020
0abceb4
aper: use correct function for APER decoder
KrzysztofW Jun 9, 2020
e9e3460
aper: deal with byte paddings
KrzysztofW Jun 9, 2020
d158c57
aper: fix invalid read
KrzysztofW Jun 9, 2020
a12c7fa
aper: workaround for undefined enumeration indexes
KrzysztofW Jun 9, 2020
d3dbe60
aper: fix alignment of octet strings of length less than 3 bytes
KrzysztofW Jun 9, 2020
36f60a2
Merge pull request #2 from KrzysztofW/aper_decoder_fixes
AuthenticEshkinKot Jun 10, 2020
af89519
Fixed some warnings
AuthenticEshkinKot Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion asn1c/tests/check-assembly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ abs_top_srcdir="${abs_top_srcdir:-$(pwd)/../../}"
abs_top_builddir="${abs_top_builddir:-$(pwd)/../../}"

if echo "$*" | grep -q -- -- ; then
TEST_DRIVER=$(echo "$*" | sed -e 's/ -- .*/--/g')
TEST_DRIVER=$(echo "$*" | sed -e 's/ -- .*/ -- /g')
source_full=$(echo "$*" | sed -e 's/.* //g')
else
TEST_DRIVER=""
Expand Down
2 changes: 1 addition & 1 deletion asn1c/tests/check-src/check-03.-fwide-types.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ check_xer(e_Enum2 eval, char *xer_string) {
asn_dec_rval_t rv;
char buf2[128];
Enum2_t *e = 0;
long val;
long long val;

rv = xer_decode(0, &asn_DEF_Enum2, (void **)&e,
xer_string, strlen(xer_string));
Expand Down
35 changes: 19 additions & 16 deletions asn1c/unber.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <OBJECT_IDENTIFIER.c>
#include <RELATIVE-OID.c>
#include <asn_codecs_prim.c>
#include <asn1p_integer.c>

#undef COPYRIGHT
#define COPYRIGHT "Copyright (c) 2004, 2005 Lev Walkin <[email protected]>\n"
Expand Down Expand Up @@ -163,10 +164,10 @@ typedef enum pd_code {
PD_EOF = 1,
} pd_code_e;
static pd_code_e process_deeper(const char *fname, FILE *fp,
asn1c_integer_t *offset, int level,
size_t *offset, int level,
ssize_t limit, ber_tlv_len_t *frame_size,
ber_tlv_len_t effective_size, int expect_eoc);
static void print_TL(int fin, asn1c_integer_t offset, int level, int constr,
static void print_TL(int fin, size_t offset, int level, int constr,
ssize_t tlen, ber_tlv_tag_t, ber_tlv_len_t,
ber_tlv_len_t effective_frame_size);
static int print_V(const char *fname, FILE *fp, ber_tlv_tag_t, ber_tlv_len_t);
Expand All @@ -178,7 +179,7 @@ static int
process(const char *fname) {
FILE *fp;
pd_code_e pdc;
asn1c_integer_t offset = 0; /* Stream decoding position */
size_t offset = 0; /* Stream decoding position */
ber_tlv_len_t frame_size = 0; /* Single frame size */

if(strcmp(fname, "-")) {
Expand All @@ -196,8 +197,7 @@ process(const char *fname) {
*/
for(; offset < skip_bytes; offset++) {
if(fgetc(fp) == -1) {
fprintf(stderr, "%s: input source (%" PRIdASN
" bytes) "
fprintf(stderr, "%s: input source (%zu bytes) "
"has less data than \"-s %d\" switch "
"wants to skip\n",
fname, offset, skip_bytes);
Expand All @@ -223,7 +223,7 @@ process(const char *fname) {
* Process the TLV recursively.
*/
static pd_code_e
process_deeper(const char *fname, FILE *fp, asn1c_integer_t *offset, int level,
process_deeper(const char *fname, FILE *fp, size_t *offset, int level,
ssize_t limit, ber_tlv_len_t *frame_size,
ber_tlv_len_t effective_size, int expect_eoc) {
unsigned char tagbuf[32];
Expand All @@ -244,8 +244,7 @@ process_deeper(const char *fname, FILE *fp, asn1c_integer_t *offset, int level,
if(limit >= 0 && tblen >= limit) {
fprintf(stderr,
"%s: Too long TL sequence (%ld >= %ld)"
" at %" PRIdASN
". "
" at %zu. "
"Broken or maliciously constructed file\n",
fname, (long)tblen, (long)limit, *offset);
return PD_FAILED;
Expand All @@ -257,7 +256,7 @@ process_deeper(const char *fname, FILE *fp, asn1c_integer_t *offset, int level,
if(limit > 0 || expect_eoc) {
fprintf(stderr,
"%s: Unexpected end of file (TL)"
" at %" PRIdASN "\n",
" at %zu\n",
fname, *offset);
return PD_FAILED;
} else {
Expand All @@ -275,7 +274,7 @@ process_deeper(const char *fname, FILE *fp, asn1c_integer_t *offset, int level,
case -1:
fprintf(stderr,
"%s: Fatal error decoding tag"
" at %" PRIdASN "+%ld\n",
" at %zu+%ld\n",
fname, *offset, (long)tblen);
return PD_FAILED;
case 0:
Expand All @@ -293,7 +292,7 @@ process_deeper(const char *fname, FILE *fp, asn1c_integer_t *offset, int level,
case -1:
fprintf(stderr,
"%s: Fatal error decoding value length"
" at %" PRIdASN "\n",
" at %zu\n",
fname, *offset + t_len);
return PD_FAILED;
case 0:
Expand Down Expand Up @@ -385,7 +384,7 @@ process_deeper(const char *fname, FILE *fp, asn1c_integer_t *offset, int level,
}

static void
print_TL(int fin, asn1c_integer_t offset, int level, int constr, ssize_t tlen,
print_TL(int fin, size_t offset, int level, int constr, ssize_t tlen,
ber_tlv_tag_t tlv_tag, ber_tlv_len_t tlv_len,
ber_tlv_len_t effective_size) {
if(fin && !constr) {
Expand All @@ -399,7 +398,7 @@ print_TL(int fin, asn1c_integer_t offset, int level, int constr, ssize_t tlen,
printf(constr ? ((tlv_len == -1) ? "I" : "C") : "P");

/* Print out the offset of this boundary, even if closing tag */
if(!minimalistic) printf(" O=\"%" PRIdASN "\"", offset);
if(!minimalistic) printf(" O=\"%zu\"", offset);

printf(" T=\"");
ber_tlv_tag_fwrite(tlv_tag, stdout);
Expand Down Expand Up @@ -572,7 +571,7 @@ print_V(const char *fname, FILE *fp, ber_tlv_tag_t tlv_tag,
switch(etype) {
case ASN_BASIC_INTEGER:
case ASN_BASIC_ENUMERATED:
printf("%" PRIdASN, collector);
printf("%s", asn1p_itoa(collector));
break;
case ASN_BASIC_OBJECT_IDENTIFIER:
if(vbuf) {
Expand All @@ -589,7 +588,7 @@ print_V(const char *fname, FILE *fp, ber_tlv_tag_t tlv_tag,
printf(" F>");
for(i = 0; i < arcno; i++) {
if(i) printf(".");
printf("%" PRIuASN, arcs[i]);
printf("%s", asn1p_itoa(arcs[i]));
}
FREEMEM(vbuf);
vbuf = 0;
Expand All @@ -610,7 +609,7 @@ print_V(const char *fname, FILE *fp, ber_tlv_tag_t tlv_tag,
printf(" F>");
for(i = 0; i < arcno; i++) {
if(i) printf(".");
printf("%" PRIuASN, arcs[i]);
printf("%s", asn1p_itoa(arcs[i]));
}
FREEMEM(vbuf);
vbuf = 0;
Expand Down Expand Up @@ -846,6 +845,10 @@ OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *cts,
return er;
}

asn_dec_rval_t OCTET_STRING_decode_aper(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *cts, void **sptr, asn_per_data_t *pd) { asn_dec_rval_t rv = { 0, 0 }; (void)ctx; (void)td; (void)cts; (void)sptr; (void)pd; return rv; }

asn_enc_rval_t OCTET_STRING_encode_aper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *cts, void *sptr, asn_per_outp_t *po) { asn_enc_rval_t er = { 0, 0, 0 }; (void)td; (void)cts; (void)sptr; (void)po; return er; }

size_t
xer_whitespace_span(const void *chunk_buf, size_t chunk_size) {
(void)chunk_buf;
Expand Down
6 changes: 4 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ AC_SUBST(TESTSUITE_CFLAGS)
dnl Skeletons should be very compatible with most of the compilers, hence
dnl very strict backward compatibility flags.
SKELETONS_CFLAGS="${ADD_CFLAGS} ${SKELETONS_CFLAGS}"
AX_CHECK_COMPILE_FLAG([-std=c89],
[SKELETONS_CFLAGS="$SKELETONS_CFLAGS -std=c89"])
AX_CHECK_COMPILE_FLAG([-std=c99],
[SKELETONS_CFLAGS="$SKELETONS_CFLAGS -std=c99"])
AX_CHECK_COMPILE_FLAG([-Wpedantic],
[SKELETONS_CFLAGS="$SKELETONS_CFLAGS -Wpedantic"])
AX_CHECK_COMPILE_FLAG([-Wno-duplicate-decl-specifier],
Expand All @@ -99,6 +99,8 @@ AC_C_BIGENDIAN
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_CHECK_TYPE([__int128],
[AC_DEFINE(HAVE_128_BIT_INT, 1, [Have 128-bit integer])])
AC_CHECK_TYPE(intmax_t, int64_t)

dnl Test if we should check features that depend on 64-bitness.
Expand Down
2 changes: 1 addition & 1 deletion examples/sample.source.RRC/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4825,7 +4825,7 @@ check-per:
done; done; fi
@if test -f sample-DL-DCCH-Message-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/"`; \
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*//"`; \
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; \
Expand Down
Loading