bugDistributed Privacy Guard - Bugs: bug #57135, dkg-verify fails to verify...

 
 

bug #57135: dkg-verify fails to verify signatures with leading zeros

Submitter:  Justus Winter <teythoon>
Submitted:  Mon 28 Oct 2019 04:45:53 PM UTC
   
 
Category:  LibTMCG Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  stamer
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 01 Nov 2019 10:22:30 AM UTC, comment #5: 

It is fixed :)

Justus Winter <teythoon>
Thu 31 Oct 2019 06:01:06 PM UTC, comment #4: 

The commit abb95b7f7c645e68f464aa22b04056320b6e397f on LibTMCG should fix this bug.

@teythoon Please, can you confirm that it is solved?

Heiko Stamer <stamer>
Group administrator
Thu 31 Oct 2019 04:21:56 PM UTC, comment #3: 

Oh. I missed that wired part of GnuPG's pkglue.c. I will fix the corresponding method in LibTMCG soon.

Heiko Stamer <stamer>
Group administrator
Mon 28 Oct 2019 09:17:48 PM UTC, comment #2: 

This is an artifact of OpenPGP's MPI encoding that mandates that leading zero bytes must be stripped off.  You need to pad it up to the required length before handing it to libgcrypt.  Leading zeros in OpenPGP are a nightmare ;)

Justus Winter <teythoon>
Mon 28 Oct 2019 08:40:36 PM UTC, comment #1: 

I guess the error code GPG_ERR_INV_LENGTH is raised by _gcry_ecc_eddsa_verify() from libgcrypt (cf. line 800). Does this bug shows up in GnuPG too?

Heiko Stamer <stamer>
Group administrator
Mon 28 Oct 2019 04:45:53 PM UTC, original submission:  

Reproducer/sample:


% echo huhu > msg ; while true ; do dkg-sign -y data/certificates/alice-secret.pgp -i msg > sig ; dkg-verify -i msg -s sig -k data/certificates/alice.pgp || break ; done
% dkg-verify --verbose -i msg -s sig -k data/certificates/alice.pgp
INFO: using LibTMCG version 1.4.0
INFO: sig type = 0x0 pkalgo = 22 hashalgo = 10 revocable = true exportable = true version = 4 creationtime = 1572280715 expirationtime = 0 keyexpirationtime = 0 revcode = 0 packet.size() = 118 hspd.size() = 39 issuer = f2 31 55 c 4f 47 e3 8e  issuerfpr = eb 85 bb 5f a3 3a 75 e1 5e 94 4e 63 f2 31 55 c 4f 47 e3 8e  keyflags =  revkeys.size() = 0 embeddedsigs.size() = 0 recipientfprs.size() = 0 attestedcerts.size() = 0 left = d3 96
ERROR: verification of signature failed (rc = 139, str = Invalid length)
INFO: Bad signature for input file "msg"
% sq verify --public-key-file data/certificates/alice.pgp --detached sig msg
Good signature from F231 550C 4F47 E38E
huhu
1 good signature.
% sq packet dump --hex sig
New CTB, 116 bytes: Signature Packet
    Version: 4
    Type: Binary
    Pk algo: EdDSA Edwards-curve Digital Signature Algorithm
    Hash algo: SHA512
    Hashed area:
      Signature creation time: 2019-10-28T16:38
      Issuer: F231 550C 4F47 E38E
      Issuer Fingerprint: EB85 BB5F A33A 75E1 5E94  4E63 F231 550C 4F47 E38E
    Hash prefix: D396
    Level: 0 (signature over data)

  00000000  c2                                                 CTB
  00000001     74                                              length
  00000002        04                                           version
  00000003           00                                        type
  00000004              16                                     pk_algo
  00000005                 0a                                  hash_algo
  00000006                    00 27                            hashed_area_len
  00000008                           05 02 5d b7 19 8b 09 10   hashed_area
  00000010  f2 31 55 0c 4f 47 e3 8e  16 21 04 eb 85 bb 5f a3
  00000020  3a 75 e1 5e 94 4e 63 f2  31 55 0c 4f 47 e3 8e
  0000002f                                                00   unhashed_area_len
  00000030  00
  00000031                                                     unhashed_area
  00000031     d3                                              hash_prefix1
  00000032        96                                           hash_prefix2
  00000033           00 fb                                     eddsa_signature_r_len
  00000035                 07 ad 04  d4 0e d0 f2 3f 78 2b d8   eddsa_signature_r
  00000040  ab 1d 85 7f e2 6a 9c 2b  3b 71 d2 2d 40 fb 5f 8d
  00000050  58 51 ab 1d ca
  00000055                 00 f8                               eddsa_signature_s_len
  00000057                       af  a4 06 43 12 57 29 f6 d1   eddsa_signature_s
  00000060  96 96 45 67 8a 2d 7f bd  aa 70 8c dc f3 6a 19 c5
  00000070  a0 29 1b d2 fa 0e

% cat sig
-----BEGIN PGP SIGNATURE-----

wnQEABYKACcFAl23GYsJEPIxVQxPR+OOFiEE64W7X6M6deFelE5j8jFVDE9H444A
ANOWAPsHrQTUDtDyP3gr2KsdhX/iapwrO3HSLUD7X41YUasdygD4r6QGQxJXKfbR
lpZFZ4otf72qcIzc82oZxaApG9L6Dg==
=WUuG
-----END PGP SIGNATURE-----


Justus Winter <teythoon>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by teythoon (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-11-01 stamer StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2019-10-31 stamer StatusIn Progress Ready For Test
        Assigned toNone stamer
    2019-10-31 stamer CategoryNone LibTMCG
        StatusNeed Info In Progress
    2019-10-28 stamer Item GroupNone Bug
        StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code