[gnutls-devel] libtasn1 | BIT STRING input to asn1_der_coding producing incorrect result (#47)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Mon Dec 4 09:18:12 CET 2023




Simon Josefsson commented: https://gitlab.com/gnutls/libtasn1/-/issues/47#note_1677316869

While I think the assignment file in the original report is incorrect, there may be some problem with BIT STRING encodings:

```
jas at kaka:~$ cat foo
MYEXAMPLE { }

DEFINITIONS IMPLICIT TAGS ::=

BEGIN

mySeq ::= SEQUENCE {
	myBit BIT STRING
}

END
jas at kaka:~$ cat bar
dp MYEXAMPLE.mySeq

myBit 01001100
jas at kaka:~$ asn1Coding foo bar
Parse: done.

var=dp, value=MYEXAMPLE.mySeq
var=myBit, value=01001100

name:NULL  type:SEQUENCE
  name:myBit  type:BIT_STR  value(8):30

Coding: SUCCESS

-----------------
Number of bytes=6
30 04 03 02 00 30 
-----------------

OutputFile=bar.out

Writing: done.
jas at kaka:~$ dumpasn1 bar.out 
  0   4: SEQUENCE {
  2   2:   BIT STRING
       :     '00001100'B
       :     Error: Spurious zero bits in bitstring.
       :   }

0 warnings, 1 error.
jas at kaka:~$ 
```

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/libtasn1/-/issues/47#note_1677316869
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20231204/3b3dac7f/attachment-0001.html>


More information about the Gnutls-devel mailing list