asn1rt: fix BER encoding of non-extensible SET
This commit is contained in:
parent
c931e76f5f
commit
f0f3e47392
|
@ -2521,27 +2521,28 @@ Specific attributes:
|
||||||
lval += comp_tlv.get_bl() >> 3
|
lval += comp_tlv.get_bl() >> 3
|
||||||
val_ids.remove(ident)
|
val_ids.remove(ident)
|
||||||
# encode extended component 1 by 1 in their definition order
|
# encode extended component 1 by 1 in their definition order
|
||||||
for ident in self._ext:
|
if self._ext:
|
||||||
if ident in self._val:
|
for ident in self._ext:
|
||||||
if ASN1CodecBER.ENC_DEF_CANON and self._val[ident] == self._cont[ident]._def:
|
if ident in self._val:
|
||||||
# the value provided equals the default one
|
if ASN1CodecBER.ENC_DEF_CANON and self._val[ident] == self._cont[ident]._def:
|
||||||
# hence will not be encoded
|
# the value provided equals the default one
|
||||||
if not self._SILENT:
|
# hence will not be encoded
|
||||||
asnlog('SET._encode_ber_cont_ws: %s.%s, removing value equal '\
|
if not self._SILENT:
|
||||||
'to the default one' % (self.fullname(), ident))
|
asnlog('SET._encode_ber_cont_ws: %s.%s, removing value equal '\
|
||||||
del self._val[ident]
|
'to the default one' % (self.fullname(), ident))
|
||||||
else:
|
del self._val[ident]
|
||||||
# component to be encoded
|
else:
|
||||||
Comp = self._cont[ident]
|
# component to be encoded
|
||||||
_par = Comp._parent
|
Comp = self._cont[ident]
|
||||||
Comp._parent = self
|
_par = Comp._parent
|
||||||
Comp._val = self._val[ident]
|
Comp._parent = self
|
||||||
comp_tlv = Comp._to_ber_ws()
|
Comp._val = self._val[ident]
|
||||||
TLV.append( comp_tlv )
|
comp_tlv = Comp._to_ber_ws()
|
||||||
Comp._parent = _par
|
TLV.append( comp_tlv )
|
||||||
if lval >= 0:
|
Comp._parent = _par
|
||||||
lval += comp_tlv.get_bl() >> 3
|
if lval >= 0:
|
||||||
val_ids.remove(ident)
|
lval += comp_tlv.get_bl() >> 3
|
||||||
|
val_ids.remove(ident)
|
||||||
#
|
#
|
||||||
if val_ids:
|
if val_ids:
|
||||||
# encode unknown extended components
|
# encode unknown extended components
|
||||||
|
@ -2584,27 +2585,28 @@ Specific attributes:
|
||||||
lval += sum([f[2] for f in comp_tlv]) >> 3
|
lval += sum([f[2] for f in comp_tlv]) >> 3
|
||||||
val_ids.remove(ident)
|
val_ids.remove(ident)
|
||||||
# encode extended component 1 by 1 in their definition order
|
# encode extended component 1 by 1 in their definition order
|
||||||
for ident in self._ext:
|
if self._ext:
|
||||||
if ident in self._val:
|
for ident in self._ext:
|
||||||
if ASN1CodecBER.ENC_DEF_CANON and self._val[ident] == self._cont[ident]._def:
|
if ident in self._val:
|
||||||
# the value provided equals the default one
|
if ASN1CodecBER.ENC_DEF_CANON and self._val[ident] == self._cont[ident]._def:
|
||||||
# hence will not be encoded
|
# the value provided equals the default one
|
||||||
if not self._SILENT:
|
# hence will not be encoded
|
||||||
asnlog('SET._encode_ber_cont: %s.%s, removing value equal '\
|
if not self._SILENT:
|
||||||
'to the default one' % (self.fullname(), ident))
|
asnlog('SET._encode_ber_cont: %s.%s, removing value equal '\
|
||||||
del self._val[ident]
|
'to the default one' % (self.fullname(), ident))
|
||||||
else:
|
del self._val[ident]
|
||||||
# component to be encoded
|
else:
|
||||||
Comp = self._cont[ident]
|
# component to be encoded
|
||||||
_par = Comp._parent
|
Comp = self._cont[ident]
|
||||||
Comp._parent = self
|
_par = Comp._parent
|
||||||
Comp._val = self._val[ident]
|
Comp._parent = self
|
||||||
comp_tlv = Comp._to_ber()
|
Comp._val = self._val[ident]
|
||||||
TLV.extend( comp_tlv )
|
comp_tlv = Comp._to_ber()
|
||||||
Comp._parent = _par
|
TLV.extend( comp_tlv )
|
||||||
if lval >= 0:
|
Comp._parent = _par
|
||||||
lval += sum([f[2] for f in comp_tlv]) >> 3
|
if lval >= 0:
|
||||||
val_ids.remove(ident)
|
lval += sum([f[2] for f in comp_tlv]) >> 3
|
||||||
|
val_ids.remove(ident)
|
||||||
#
|
#
|
||||||
if val_ids:
|
if val_ids:
|
||||||
# encode unknown extended components
|
# encode unknown extended components
|
||||||
|
|
Loading…
Reference in New Issue