forked from open5gs/open5gs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ASN1C] Fixed asn1c library on 32bit (open5gs#2934)
APER encoding fails when using the asn_uint642INTEGER function on a 32-bit machine as shown below. ```C asn_uint642INTEGER(AMF_UE_NGAP_ID, 0xffffffff); ... aper_encode_to_buffer(...) ``` INTEGER APER encode/decode functions seem to be operating internally with long variables instead of intmax_t. That is probably the reason of the failure. @v0-e fixed this issues in the mouse07410/asn1c pull request. mouse07410/asn1c#176 mouse07410/asn1c#177
- Loading branch information
Showing
3,528 changed files
with
4,782 additions
and
4,373 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../debian |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ubuntu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/*- | ||
* Copyright (c) 2003, 2005, 2006 Lev Walkin <vlm@lionet.info>. | ||
* All rights reserved. | ||
* Redistribution and modifications are permitted subject to BSD license. | ||
*/ | ||
#include <asn_internal.h> | ||
#include <ENUMERATED.h> | ||
|
||
/* | ||
* ENUMERATED basic type description. | ||
*/ | ||
static const ber_tlv_tag_t asn_DEF_ENUMERATED_tags[] = { | ||
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) | ||
}; | ||
asn_TYPE_operation_t asn_OP_ENUMERATED = { | ||
ASN__PRIMITIVE_TYPE_free, | ||
#if !defined(ASN_DISABLE_PRINT_SUPPORT) | ||
INTEGER_print, /* Implemented in terms of INTEGER */ | ||
#else | ||
0, | ||
#endif /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||
INTEGER_compare, /* Implemented in terms of INTEGER */ | ||
INTEGER_copy, /* Implemented in terms of INTEGER */ | ||
#if !defined(ASN_DISABLE_BER_SUPPORT) | ||
ber_decode_primitive, | ||
INTEGER_encode_der, /* Implemented in terms of INTEGER */ | ||
#else | ||
0, | ||
0, | ||
#endif /* !defined(ASN_DISABLE_BER_SUPPORT) */ | ||
#if !defined(ASN_DISABLE_XER_SUPPORT) | ||
INTEGER_decode_xer, /* This is temporary! */ | ||
INTEGER_encode_xer, | ||
#else | ||
0, | ||
0, | ||
#endif /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||
#if !defined(ASN_DISABLE_JER_SUPPORT) | ||
ENUMERATED_decode_jer, | ||
INTEGER_encode_jer, | ||
#else | ||
0, | ||
0, | ||
#endif /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||
#if !defined(ASN_DISABLE_OER_SUPPORT) | ||
ENUMERATED_decode_oer, | ||
ENUMERATED_encode_oer, | ||
#else | ||
0, | ||
0, | ||
#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ | ||
#if !defined(ASN_DISABLE_UPER_SUPPORT) | ||
ENUMERATED_decode_uper, /* Unaligned PER decoder */ | ||
ENUMERATED_encode_uper, /* Unaligned PER encoder */ | ||
#else | ||
0, | ||
0, | ||
#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) */ | ||
#if !defined(ASN_DISABLE_APER_SUPPORT) | ||
ENUMERATED_decode_aper, /* Aligned PER decoder */ | ||
ENUMERATED_encode_aper, /* Aligned PER encoder */ | ||
#else | ||
0, | ||
0, | ||
#endif /* !defined(ASN_DISABLE_APER_SUPPORT) */ | ||
#if !defined(ASN_DISABLE_RFILL_SUPPORT) | ||
ENUMERATED_random_fill, | ||
#else | ||
0, | ||
#endif /* !defined(ASN_DISABLE_RFILL_SUPPORT) */ | ||
0 /* Use generic outmost tag fetcher */ | ||
}; | ||
asn_TYPE_descriptor_t asn_DEF_ENUMERATED = { | ||
"ENUMERATED", | ||
"ENUMERATED", | ||
&asn_OP_ENUMERATED, | ||
asn_DEF_ENUMERATED_tags, | ||
sizeof(asn_DEF_ENUMERATED_tags) / sizeof(asn_DEF_ENUMERATED_tags[0]), | ||
asn_DEF_ENUMERATED_tags, /* Same as above */ | ||
sizeof(asn_DEF_ENUMERATED_tags) / sizeof(asn_DEF_ENUMERATED_tags[0]), | ||
{ | ||
#if !defined(ASN_DISABLE_OER_SUPPORT) | ||
0, | ||
#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ | ||
#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) | ||
0, | ||
#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ | ||
asn_generic_no_constraint | ||
}, | ||
0, 0, /* No members */ | ||
0 /* No specifics */ | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/*- | ||
* Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved. | ||
* Redistribution and modifications are permitted subject to BSD license. | ||
*/ | ||
#ifndef _ENUMERATED_H_ | ||
#define _ENUMERATED_H_ | ||
|
||
#include <INTEGER.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef INTEGER_t ENUMERATED_t; /* Implemented via INTEGER */ | ||
|
||
extern asn_TYPE_descriptor_t asn_DEF_ENUMERATED; | ||
extern asn_TYPE_operation_t asn_OP_ENUMERATED; | ||
|
||
#define ENUMERATED_free ASN__PRIMITIVE_TYPE_free | ||
|
||
#if !defined(ASN_DISABLE_PRINT_SUPPORT) | ||
#define ENUMERATED_print INTEGER_print | ||
#endif /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||
|
||
#define ENUMERATED_compare INTEGER_compare | ||
#define ENUMERATED_copy INTEGER_copy | ||
|
||
#define ENUMERATED_constraint asn_generic_no_constraint | ||
|
||
#if !defined(ASN_DISABLE_BER_SUPPORT) | ||
#define ENUMERATED_decode_ber ber_decode_primitive | ||
#define ENUMERATED_encode_der INTEGER_encode_der | ||
#endif /* !defined(ASN_DISABLE_BER_SUPPORT) */ | ||
|
||
#if !defined(ASN_DISABLE_XER_SUPPORT) | ||
#define ENUMERATED_decode_xer INTEGER_decode_xer | ||
#define ENUMERATED_encode_xer INTEGER_encode_xer | ||
#endif /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||
|
||
#if !defined(ASN_DISABLE_JER_SUPPORT) | ||
jer_type_decoder_f ENUMERATED_decode_jer; | ||
#define ENUMERATED_encode_jer INTEGER_encode_jer | ||
#endif /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||
|
||
#if !defined(ASN_DISABLE_OER_SUPPORT) | ||
oer_type_decoder_f ENUMERATED_decode_oer; | ||
oer_type_encoder_f ENUMERATED_encode_oer; | ||
#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ | ||
|
||
#if !defined(ASN_DISABLE_UPER_SUPPORT) | ||
per_type_decoder_f ENUMERATED_decode_uper; | ||
per_type_encoder_f ENUMERATED_encode_uper; | ||
#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) */ | ||
#if !defined(ASN_DISABLE_APER_SUPPORT) | ||
per_type_decoder_f ENUMERATED_decode_aper; | ||
per_type_encoder_f ENUMERATED_encode_aper; | ||
#endif /* !defined(ASN_DISABLE_APER_SUPPORT) */ | ||
|
||
#if !defined(ASN_DISABLE_RFILL_SUPPORT) | ||
#define ENUMERATED_random_fill INTEGER_random_fill | ||
#endif /* !defined(ASN_DISABLE_RFILL_SUPPORT) */ | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* _ENUMERATED_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. | ||
* All rights reserved. | ||
* Redistribution and modifications are permitted subject to BSD license. | ||
*/ | ||
#include <asn_internal.h> | ||
#include <ENUMERATED.h> | ||
#include <NativeEnumerated.h> | ||
|
||
asn_dec_rval_t | ||
ENUMERATED_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, | ||
const asn_TYPE_descriptor_t *td, | ||
const asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { | ||
asn_dec_rval_t rval; | ||
ENUMERATED_t *st = (ENUMERATED_t *)*sptr; | ||
long value; | ||
void *vptr = &value; | ||
|
||
if(!st) { | ||
st = (ENUMERATED_t *)(*sptr = CALLOC(1, sizeof(*st))); | ||
if(!st) ASN__DECODE_FAILED; | ||
} | ||
|
||
rval = NativeEnumerated_decode_aper(opt_codec_ctx, td, constraints, | ||
(void **)&vptr, pd); | ||
if(rval.code == RC_OK) | ||
if(asn_long2INTEGER(st, value)) | ||
rval.code = RC_FAIL; | ||
return rval; | ||
} | ||
|
||
asn_enc_rval_t | ||
ENUMERATED_encode_aper(const asn_TYPE_descriptor_t *td, | ||
const asn_per_constraints_t *constraints, | ||
const void *sptr, asn_per_outp_t *po) { | ||
const ENUMERATED_t *st = (const ENUMERATED_t *)sptr; | ||
long value; | ||
|
||
if(asn_INTEGER2long(st, &value)) | ||
ASN__ENCODE_FAILED; | ||
|
||
return NativeEnumerated_encode_aper(td, constraints, &value, po); | ||
} |
Oops, something went wrong.