[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rpm-cvs
Subject:    [CVS] RPM: rpm/ CHANGES rpm/build/ build.c pack.c rpm/rpmio/ rpmbc.c
From:       "Jeff Johnson" <jbj () rpm5 ! org>
Date:       2010-06-25 18:39:44
Message-ID: 20100625183944.B1A487668C () rpm5 ! org
[Download RAW message or body]

  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   25-Jun-2010 20:39:44
  Branch: HEAD                             Handle: 2010062518394301

  Modified files:
    rpm                     CHANGES
    rpm/build               build.c pack.c
    rpm/rpmio               rpmbc.c

  Log:
    - pgp: fix: algo parameters to signature/pubkey with msbits().

  Summary:
    Revision    Changes     Path
    1.3400      +1  -0      rpm/CHANGES
    2.143       +8  -4      rpm/build/build.c
    2.321       +4  -2      rpm/build/pack.c
    2.34        +19 -21     rpm/rpmio/rpmbc.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.3399 -r1.3400 CHANGES
  --- rpm/CHANGES	23 Jun 2010 07:12:07 -0000	1.3399
  +++ rpm/CHANGES	25 Jun 2010 18:39:43 -0000	1.3400
  @@ -1,6 +1,7 @@
   5.3.2 -> 5.4a1:
   
   5.3.1 -> 5.3.2:
  +    - jbj: pgp: fix: algo parameters to signature/pubkey with msbits().
       - jbj: pgp: use the pubkey from header when installing.
       - jbj: pgp: retrieve pubkey from package header (if present).
       - jbj: pgp: add pgpArmorUnwrap to parse a pubkey from a buffer.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/build.c
  ============================================================================
  $ cvs diff -u -r2.142 -r2.143 build.c
  --- rpm/build/build.c	23 Jun 2010 04:03:57 -0000	2.142
  +++ rpm/build/build.c	25 Jun 2010 18:39:44 -0000	2.143
  @@ -358,22 +358,26 @@
       *be++ = (bt      );
       *be++ = pubp->pubkey_algo;
   
  -    bn = MP_WORDS_TO_BITS(bc->dsa_keypair.param.p.size);
  +    bn = mpbits(bc->dsa_keypair.param.p.size, bc->dsa_keypair.param.p.modl);
  +    bn += 7; bn &= ~7;
       *be++ = (bn >> 8);	*be++ = (bn     );
       xx = i2osp(be, bn/8, bc->dsa_keypair.param.p.modl, \
bc->dsa_keypair.param.p.size);  be += bn/8;
   
  -    bn = MP_WORDS_TO_BITS(bc->dsa_keypair.param.q.size);
  +    bn = mpbits(bc->dsa_keypair.param.q.size, bc->dsa_keypair.param.q.modl);
  +    bn += 7; bn &= ~7;
       *be++ = (bn >> 8);	*be++ = (bn     );
       xx = i2osp(be, bn/8, bc->dsa_keypair.param.q.modl, \
bc->dsa_keypair.param.q.size);  be += bn/8;
   
  -    bn = MP_WORDS_TO_BITS(bc->dsa_keypair.param.g.size);
  +    bn = mpbits(bc->dsa_keypair.param.g.size, bc->dsa_keypair.param.g.data);
  +    bn += 7; bn &= ~7;
       *be++ = (bn >> 8);	*be++ = (bn     );
       xx = i2osp(be, bn/8, bc->dsa_keypair.param.g.data, \
bc->dsa_keypair.param.g.size);  be += bn/8;
   
  -    bn = MP_WORDS_TO_BITS(bc->dsa_keypair.y.size);
  +    bn = mpbits(bc->dsa_keypair.y.size, bc->dsa_keypair.y.data);
  +    bn += 7; bn &= ~7;
       *be++ = (bn >> 8);	*be++ = (bn     );
       xx = i2osp(be, bn/8, bc->dsa_keypair.y.data, bc->dsa_keypair.y.size);
       be += bn/8;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/pack.c
  ============================================================================
  $ cvs diff -u -r2.320 -r2.321 pack.c
  --- rpm/build/pack.c	23 Jun 2010 04:03:57 -0000	2.320
  +++ rpm/build/pack.c	25 Jun 2010 18:39:44 -0000	2.321
  @@ -740,13 +740,15 @@
       *be++ = sigp->signhash16[0];	/* signhash16 */
       *be++ = sigp->signhash16[1];
   
  -    bn = MP_WORDS_TO_BITS(bc->r.size);
  +    bn = mpbits(bc->r.size, bc->r.data);
  +    bn += 7;	bn &= ~7;
       *be++ = (bn >> 8);
       *be++ = (bn     );
       xx = i2osp(be, bn/8, bc->r.data, bc->r.size);
       be += bn/8;
   
  -    bn = MP_WORDS_TO_BITS(bc->s.size);
  +    bn = mpbits(bc->s.size, bc->s.data);
  +    bn += 7;	bn &= ~7;
       *be++ = (bn >> 8);
       *be++ = (bn     );
       xx = i2osp(be, bn/8, bc->s.data, bc->s.size);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmbc.c
  ============================================================================
  $ cvs diff -u -r2.33 -r2.34 rpmbc.c
  --- rpm/rpmio/rpmbc.c	25 Jun 2010 16:18:28 -0000	2.33
  +++ rpm/rpmio/rpmbc.c	25 Jun 2010 18:39:44 -0000	2.34
  @@ -20,7 +20,7 @@
   /*@=redecl@*/
   
   /*@unchecked@*/
  -static int _rpmbc_debug = 1;
  +static int _rpmbc_debug;
   
   #define	SPEW(_t, _rc, _dig)	\
     { if ((_t) || _rpmbc_debug || _pgp_debug < 0) \
  @@ -66,6 +66,7 @@
       fprintf(stderr, "\t" _N ": "); mpfprintln(stderr, mpn->size, mpn->data); \
     }
   
  +#ifdef	UNUSED
   static void rpmbcDumpRSA(const char * msg, rpmbc bc)
   {
       if (msg) fprintf(stderr, "========== %s\n", msg);
  @@ -102,9 +103,7 @@
       _spewMPN("hm", bc->hm);
   
   }
  -
  -#undef	_spewMPB
  -#undef	_spewMPN
  +#endif	/* UNUSED */
   
   static
   int rpmbcSetRSA(/*@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
  @@ -116,7 +115,7 @@
       const char * prefix = rpmDigestASN1(ctx);
       const char * hexstr;
       char * tt;
  -    int rc;
  +    int rc = 1;		/* assume failure */
       int xx;
   pgpDigParams pubp = pgpGetPubkey(dig);
   dig->pubkey_algoN = _pgpPubkeyAlgo2Name(pubp->pubkey_algo);
  @@ -124,7 +123,7 @@
   
   assert(sigp->hash_algo == rpmDigestAlgo(ctx));
       if (prefix == NULL)
  -	return 1;
  +	goto exit;
   
       /*
        * The no. of bytes for hash + PKCS1 padding is needed.
  @@ -138,7 +137,7 @@
   	nbits = (unsigned) MP_WORDS_TO_BITS(bc->rsa_keypair.n.size);
       nb = (nbits + 7) >> 3;		/* XXX overkill */
       if (nb < 64/8 || nb > 65536/8)	/* XXX generous "sanity" check */
  -	return 1;
  +	goto exit;
   
   /* XXX FIXME: do PKCS1 padding in binary not hex */
   /* XXX FIXME: should this lazy free be done elsewhere? */
  @@ -169,6 +168,8 @@
   	s[1] = (rpmuint8_t) (nibble(str[2]) << 4) | nibble(str[3]);
   	rc = memcmp(s, t, sizeof(sigp->signhash16));
       }
  +
  +exit:
   SPEW(0, !rc, dig);
       return rc;
   }
  @@ -259,10 +260,6 @@
   		(bc->digestlen > 160/8 ? 160/8 : bc->digestlen));
       rc = memcmp(bc->digest, sigp->signhash16, sizeof(sigp->signhash16));
   
  -{ uint8_t * signhash16 = bc->digest;
  -fprintf(stderr, "\tgot %02X%02X expected %02X%02X\n", signhash16[0], \
                signhash16[1], sigp->signhash16[0], sigp->signhash16[1]);
  -}
  -
   SPEW(0, !rc, dig);
       return rc;
   }
  @@ -276,7 +273,6 @@
       int failures = 0;
       int xx;
   
  -rpmbcDumpDSA(__FUNCTION__, bc);
       xx = dsavrfy(&bc->dsa_keypair.param.p, &bc->dsa_keypair.param.q,
   		&bc->dsa_keypair.param.g, &bc->hm, &bc->dsa_keypair.y,
   		&bc->r, &bc->s);
  @@ -726,8 +722,6 @@
   fprintf(stderr, "*** %s %s\n", pre, t);
       (void) mpnsethex(mpn, t);
       t = _free(t);
  -if (_pgp_debug && _pgp_print)
  -fprintf(stderr, "\t %s ", pre), mpfprintln(stderr, mpn->size, mpn->data);
       return 0;
   }
   
  @@ -752,43 +746,47 @@
       case 10:		/* RSA m**d */
   	(void) mpnsethex(&bc->c, s = pgpMpiHex(p));
   if (_pgp_debug && _pgp_print)
  -fprintf(stderr, "\t %s ", pre),  mpfprintln(stderr, bc->c.size, bc->c.data);
  +_spewMPN(" c", bc->c);
   	break;
       case 20:		/* DSA r */
   	rc = pgpMpiSet(pre, 160, &bc->r, p, pend);
  +if (_pgp_debug && _pgp_print)
  +_spewMPN(" r", bc->r);
   	break;
       case 21:		/* DSA s */
   	rc = pgpMpiSet(pre, 160, &bc->s, p, pend);
  +if (_pgp_debug && _pgp_print)
  +_spewMPN(" s", bc->s);
   	break;
       case 30:		/* RSA n */
   	(void) mpbsethex(&bc->rsa_keypair.n, s = pgpMpiHex(p));
   if (_pgp_debug && _pgp_print)
  -fprintf(stderr, "\t %s ", pre),  mpfprintln(stderr, bc->rsa_keypair.n.size, \
bc->rsa_keypair.n.modl);  +_spewMPB(" n", bc->dsa_keypair.param.n);
   	break;
       case 31:		/* RSA e */
   	(void) mpnsethex(&bc->rsa_keypair.e, s = pgpMpiHex(p));
   if (_pgp_debug && _pgp_print)
  -fprintf(stderr, "\t %s ", pre),  mpfprintln(stderr, bc->rsa_keypair.e.size, \
bc->rsa_keypair.e.data);  +_spewMPN(" e", bc->rsa_keypair.e);
   	break;
       case 40:		/* DSA p */
   	(void) mpbsethex(&bc->dsa_keypair.param.p, s = pgpMpiHex(p));
   if (_pgp_debug && _pgp_print)
  -fprintf(stderr, "\t %s ", pre),  mpfprintln(stderr, bc->dsa_keypair.param.p.size, \
bc->dsa_keypair.param.p.modl);  +_spewMPB(" p", bc->dsa_keypair.param.p);
   	break;
       case 41:		/* DSA q */
   	(void) mpbsethex(&bc->dsa_keypair.param.q, s = pgpMpiHex(p));
   if (_pgp_debug && _pgp_print)
  -fprintf(stderr, "\t %s ", pre),  mpfprintln(stderr, bc->dsa_keypair.param.q.size, \
bc->dsa_keypair.param.q.modl);  +_spewMPB(" q", bc->dsa_keypair.param.q);
   	break;
       case 42:		/* DSA g */
   	(void) mpnsethex(&bc->dsa_keypair.param.g, s = pgpMpiHex(p));
   if (_pgp_debug && _pgp_print)
  -fprintf(stderr, "\t %s ", pre),  mpfprintln(stderr, bc->dsa_keypair.param.g.size, \
bc->dsa_keypair.param.g.data);  +_spewMPN(" g", bc->dsa_keypair.param.g);
   	break;
       case 43:		/* DSA y */
   	(void) mpnsethex(&bc->dsa_keypair.y, s = pgpMpiHex(p));
   if (_pgp_debug && _pgp_print)
  -fprintf(stderr, "\t %s ", pre),  mpfprintln(stderr, bc->dsa_keypair.y.size, \
bc->dsa_keypair.y.data);  +_spewMPN(" y", bc->dsa_keypair.y);
   	break;
       }
       s = _free(s);
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic