Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
5dca3379
Unverified
Commit
5dca3379
authored
Sep 20, 2019
by
Mouse
Committed by
GitHub
Sep 20, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #57 from johvik/vlm_master
Incomplete: Various fixes
parents
fa28eea7
21e996b8
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
51 additions
and
19 deletions
+51
-19
skeletons/INTEGER.c
skeletons/INTEGER.c
+5
-2
skeletons/OCTET_STRING.c
skeletons/OCTET_STRING.c
+7
-4
skeletons/constr_CHOICE.c
skeletons/constr_CHOICE.c
+5
-2
skeletons/constr_SEQUENCE.c
skeletons/constr_SEQUENCE.c
+2
-2
skeletons/constr_SEQUENCE_OF.c
skeletons/constr_SEQUENCE_OF.c
+8
-2
skeletons/constr_SET_OF.c
skeletons/constr_SET_OF.c
+5
-2
skeletons/per_opentype.c
skeletons/per_opentype.c
+6
-1
skeletons/per_support.c
skeletons/per_support.c
+11
-3
skeletons/per_support.h
skeletons/per_support.h
+2
-1
No files found.
skeletons/INTEGER.c
View file @
5dca3379
...
...
@@ -1043,7 +1043,8 @@ INTEGER_encode_aper(const asn_TYPE_descriptor_t *td,
v
=
value
-
ct
->
lower_bound
;
/* #12 <= 8 -> alignment ? */
if
(
ct
->
range_bits
<
8
)
{
int
range
=
ct
->
upper_bound
-
ct
->
lower_bound
+
1
;
if
(
ct
->
range_bits
<
8
||
(
ct
->
range_bits
==
8
&&
range
<
256
))
{
if
(
per_put_few_bits
(
po
,
0x00
|
v
,
ct
->
range_bits
))
ASN__ENCODE_FAILED
;
}
else
if
(
ct
->
range_bits
==
8
)
{
...
...
@@ -1101,12 +1102,14 @@ INTEGER_encode_aper(const asn_TYPE_descriptor_t *td,
}
for
(
buf
=
st
->
buf
,
end
=
st
->
buf
+
st
->
size
;
buf
<
end
;)
{
ssize_t
mayEncode
=
aper_put_length
(
po
,
-
1
,
end
-
buf
);
int
need_eom
=
0
;
ssize_t
mayEncode
=
aper_put_length
(
po
,
-
1
,
end
-
buf
,
&
need_eom
);
if
(
mayEncode
<
0
)
ASN__ENCODE_FAILED
;
if
(
per_put_many_bits
(
po
,
buf
,
8
*
mayEncode
))
ASN__ENCODE_FAILED
;
buf
+=
mayEncode
;
if
(
need_eom
&&
aper_put_length
(
po
,
-
1
,
0
,
0
))
ASN__ENCODE_FAILED
;
}
ASN__ENCODED_OK
(
er
);
...
...
skeletons/OCTET_STRING.c
View file @
5dca3379
...
...
@@ -1953,10 +1953,10 @@ OCTET_STRING_encode_aper(const asn_TYPE_descriptor_t *td,
st
->
size
,
sizeinunits
-
csiz
->
lower_bound
,
csiz
->
effective_bits
);
if
(
csiz
->
effective_bits
>
0
)
{
ret
=
aper_put_length
(
po
,
csiz
->
upper_bound
-
csiz
->
lower_bound
+
1
,
sizeinunits
-
csiz
->
lower_bound
);
ret
=
aper_put_length
(
po
,
csiz
->
upper_bound
-
csiz
->
lower_bound
+
1
,
sizeinunits
-
csiz
->
lower_bound
,
0
);
if
(
ret
)
ASN__ENCODE_FAILED
;
}
if
(
(
st
->
size
>
2
)
||
(
csiz
->
upper_bound
>
2
))
{
/* X.691 #16 NOTE 1 */
if
(
csiz
->
effective_bits
>
0
||
(
st
->
size
>
2
)
||
(
csiz
->
upper_bound
>
(
2
*
8
/
unit_bits
)
))
{
/* X.691 #16 NOTE 1 */
if
(
aper_put_align
(
po
)
<
0
)
ASN__ENCODE_FAILED
;
}
...
...
@@ -1975,14 +1975,15 @@ OCTET_STRING_encode_aper(const asn_TYPE_descriptor_t *td,
ASN_DEBUG
(
"Encoding %lu bytes"
,
st
->
size
);
if
(
sizeinunits
==
0
)
{
if
(
aper_put_length
(
po
,
-
1
,
0
))
if
(
aper_put_length
(
po
,
-
1
,
0
,
0
))
ASN__ENCODE_FAILED
;
ASN__ENCODED_OK
(
er
);
}
buf
=
st
->
buf
;
while
(
sizeinunits
)
{
ssize_t
maySave
=
aper_put_length
(
po
,
-
1
,
sizeinunits
);
int
need_eom
=
0
;
ssize_t
maySave
=
aper_put_length
(
po
,
-
1
,
sizeinunits
,
&
need_eom
);
if
(
maySave
<
0
)
ASN__ENCODE_FAILED
;
...
...
@@ -2004,6 +2005,8 @@ OCTET_STRING_encode_aper(const asn_TYPE_descriptor_t *td,
buf
+=
maySave
>>
3
;
sizeinunits
-=
maySave
;
assert
(
!
(
maySave
&
0x07
)
||
!
sizeinunits
);
if
(
need_eom
&&
aper_put_length
(
po
,
-
1
,
0
,
0
))
ASN__ENCODE_FAILED
;
/* End of Message length */
}
ASN__ENCODED_OK
(
er
);
...
...
skeletons/constr_CHOICE.c
View file @
5dca3379
...
...
@@ -1164,10 +1164,13 @@ CHOICE_encode_aper(const asn_TYPE_descriptor_t *td,
memb_ptr
,
po
);
}
else
{
asn_enc_rval_t
rval
=
{
0
,
0
,
0
};
int
tmp_range_bits
=
(
int
)
(
ct
?
ct
->
range_bits
:
-
1
);
if
(
specs
->
ext_start
==
-
1
)
ASN__ENCODE_FAILED
;
if
(
aper_put_nsnnwn
(
po
,
tmp_range_bits
,
present
-
specs
->
ext_start
))
int
n
=
present
-
specs
->
ext_start
;
if
(
n
<=
63
)
{
if
(
n
<
0
)
ASN__ENCODE_FAILED
;
if
(
per_put_few_bits
(
po
,
n
,
7
))
ASN__ENCODE_FAILED
;
}
else
ASN__ENCODE_FAILED
;
if
(
aper_open_type_put
(
elm
->
type
,
elm
->
encoding_constraints
.
per_constraints
,
memb_ptr
,
po
))
...
...
skeletons/constr_SEQUENCE.c
View file @
5dca3379
...
...
@@ -1835,7 +1835,7 @@ SEQUENCE_encode_aper(const asn_TYPE_descriptor_t *td,
/* Eliminate default values */
if
(
present
&&
elm
->
default_value_cmp
&&
elm
->
default_value_cmp
(
memb_ptr2
)
==
0
)
&&
elm
->
default_value_cmp
(
*
memb_ptr2
)
==
0
)
present
=
0
;
ASN_DEBUG
(
"Element %s %s %s->%s is %s"
,
...
...
@@ -1881,7 +1881,7 @@ SEQUENCE_encode_aper(const asn_TYPE_descriptor_t *td,
}
/* Eliminate default values */
if
(
elm
->
default_value_cmp
&&
elm
->
default_value_cmp
(
memb_ptr2
)
==
0
)
if
(
elm
->
default_value_cmp
&&
elm
->
default_value_cmp
(
*
memb_ptr2
)
==
0
)
continue
;
ASN_DEBUG
(
"Encoding %s->%s"
,
td
->
name
,
elm
->
name
);
...
...
skeletons/constr_SEQUENCE_OF.c
View file @
5dca3379
...
...
@@ -269,17 +269,20 @@ SEQUENCE_OF_encode_aper(const asn_TYPE_descriptor_t *td,
ct->effective_bits))
ASN__ENCODE_FAILED;
*/
if
(
aper_put_length
(
po
,
ct
->
upper_bound
-
ct
->
lower_bound
+
1
,
list
->
count
-
ct
->
lower_bound
)
<
0
)
if
(
ct
->
lower_bound
==
ct
->
upper_bound
&&
ct
->
upper_bound
<
65536
)
{
/* No length determinant */
}
else
if
(
aper_put_length
(
po
,
ct
->
upper_bound
-
ct
->
lower_bound
+
1
,
list
->
count
-
ct
->
lower_bound
,
0
)
<
0
)
ASN__ENCODE_FAILED
;
}
for
(
seq
=
-
1
;
seq
<
list
->
count
;)
{
ssize_t
mayEncode
;
int
need_eom
=
0
;
if
(
seq
<
0
)
seq
=
0
;
if
(
ct
&&
ct
->
effective_bits
>=
0
)
{
mayEncode
=
list
->
count
;
}
else
{
mayEncode
=
aper_put_length
(
po
,
-
1
,
list
->
count
-
seq
);
mayEncode
=
aper_put_length
(
po
,
-
1
,
list
->
count
-
seq
,
&
need_eom
);
if
(
mayEncode
<
0
)
ASN__ENCODE_FAILED
;
}
...
...
@@ -291,6 +294,9 @@ SEQUENCE_OF_encode_aper(const asn_TYPE_descriptor_t *td,
if
(
er
.
encoded
==
-
1
)
ASN__ENCODE_FAILED
;
}
if
(
need_eom
&&
aper_put_length
(
po
,
-
1
,
0
,
0
))
ASN__ENCODE_FAILED
;
/* End of Message length */
}
ASN__ENCODED_OK
(
er
);
...
...
skeletons/constr_SET_OF.c
View file @
5dca3379
...
...
@@ -1157,7 +1157,7 @@ SET_OF_encode_aper(const asn_TYPE_descriptor_t *td,
ct->effective_bits))
ASN__ENCODE_FAILED;*/
if
(
aper_put_length
(
po
,
ct
->
upper_bound
-
ct
->
lower_bound
+
1
,
list
->
count
-
ct
->
lower_bound
)
<
0
)
{
if
(
aper_put_length
(
po
,
ct
->
upper_bound
-
ct
->
lower_bound
+
1
,
list
->
count
-
ct
->
lower_bound
,
0
)
<
0
)
{
ASN__ENCODE_FAILED
;
}
}
...
...
@@ -1170,11 +1170,12 @@ SET_OF_encode_aper(const asn_TYPE_descriptor_t *td,
for
(
seq
=
0
;
seq
<
list
->
count
;)
{
ssize_t
may_encode
;
int
need_eom
=
0
;
if
(
ct
&&
ct
->
effective_bits
>=
0
)
{
may_encode
=
list
->
count
;
}
else
{
may_encode
=
aper_put_length
(
po
,
-
1
,
list
->
count
-
seq
);
aper_put_length
(
po
,
-
1
,
list
->
count
-
seq
,
&
need_eom
);
if
(
may_encode
<
0
)
ASN__ENCODE_FAILED
;
}
...
...
@@ -1185,6 +1186,8 @@ SET_OF_encode_aper(const asn_TYPE_descriptor_t *td,
break
;
}
}
if
(
need_eom
&&
aper_put_length
(
po
,
-
1
,
0
,
0
))
ASN__ENCODE_FAILED
;
/* End of Message length */
}
SET_OF__encode_sorted_free
(
encoded_els
,
list
->
count
);
...
...
skeletons/per_opentype.c
View file @
5dca3379
...
...
@@ -487,11 +487,16 @@ aper_open_type_put(const asn_TYPE_descriptor_t *td,
if
(
size
<=
0
)
return
-
1
;
for
(
bptr
=
buf
,
toGo
=
size
;
toGo
;)
{
ssize_t
maySave
=
aper_put_length
(
po
,
-
1
,
toGo
);
int
need_eom
=
0
;
ssize_t
maySave
=
aper_put_length
(
po
,
-
1
,
toGo
,
&
need_eom
);
if
(
maySave
<
0
)
break
;
if
(
per_put_many_bits
(
po
,
bptr
,
maySave
*
8
))
break
;
bptr
=
(
char
*
)
bptr
+
maySave
;
toGo
-=
maySave
;
if
(
need_eom
&&
aper_put_length
(
po
,
-
1
,
0
,
0
))
{
FREEMEM
(
buf
);
return
-
1
;
}
}
FREEMEM
(
buf
);
...
...
skeletons/per_support.c
View file @
5dca3379
...
...
@@ -440,7 +440,11 @@ int aper_put_align(asn_per_outp_t *po) {
}
ssize_t
aper_put_length
(
asn_per_outp_t
*
po
,
int
range
,
size_t
length
)
{
aper_put_length
(
asn_per_outp_t
*
po
,
int
range
,
size_t
length
,
int
*
need_eom
)
{
int
dummy
=
0
;
if
(
!
need_eom
)
need_eom
=
&
dummy
;
*
need_eom
=
0
;
ASN_DEBUG
(
"APER put length %zu with range %d"
,
length
,
range
);
...
...
@@ -459,8 +463,12 @@ aper_put_length(asn_per_outp_t *po, int range, size_t length) {
return
per_put_few_bits
(
po
,
length
|
0x8000
,
16
)
?
-
1
:
(
ssize_t
)
length
;
*
need_eom
=
0
==
(
length
&
16383
);
length
>>=
14
;
if
(
length
>
4
)
length
=
4
;
if
(
length
>
4
)
{
*
need_eom
=
0
;
length
=
4
;
}
return
per_put_few_bits
(
po
,
0xC0
|
length
,
8
)
?
-
1
:
(
ssize_t
)(
length
<<
14
);
...
...
@@ -475,7 +483,7 @@ aper_put_nslength(asn_per_outp_t *po, size_t length) {
if
(
length
==
0
)
return
-
1
;
return
per_put_few_bits
(
po
,
length
-
1
,
7
)
?
-
1
:
0
;
}
else
{
if
(
aper_put_length
(
po
,
-
1
,
length
)
!=
(
ssize_t
)
length
)
{
if
(
aper_put_length
(
po
,
-
1
,
length
,
0
)
!=
(
ssize_t
)
length
)
{
/* This might happen in case of >16K extensions */
return
-
1
;
}
...
...
skeletons/per_support.h
View file @
5dca3379
...
...
@@ -101,7 +101,8 @@ int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int
ssize_t
uper_put_length
(
asn_per_outp_t
*
po
,
size_t
whole_length
,
int
*
opt_need_eom
);
ssize_t
aper_put_length
(
asn_per_outp_t
*
po
,
int
range
,
size_t
length
);
ssize_t
aper_put_length
(
asn_per_outp_t
*
po
,
int
range
,
size_t
length
,
int
*
opt_need_eom
);
/* Align the current bit position to octet bundary */
int
aper_put_align
(
asn_per_outp_t
*
po
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment