RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 01-Jun-2010 16:55:13 Branch: HEAD Handle: 2010060114551002 Modified files: rpm CHANGES rpm/rpmio rpmbc.c rpmgc.c rpmnss.c rpmpgp.h rpmssl.c Log: - pgp: add methods for ElGamal signatures. Summary: Revision Changes Path 1.3375 +1 -0 rpm/CHANGES 2.22 +3 -29 rpm/rpmio/rpmbc.c 2.25 +9 -29 rpm/rpmio/rpmgc.c 1.31 +10 -49 rpm/rpmio/rpmnss.c 2.98 +73 -9 rpm/rpmio/rpmpgp.h 2.31 +9 -29 rpm/rpmio/rpmssl.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.3374 -r1.3375 CHANGES --- rpm/CHANGES 30 May 2010 08:19:32 -0000 1.3374 +++ rpm/CHANGES 1 Jun 2010 14:55:10 -0000 1.3375 @@ -1,4 +1,5 @@ 5.3.0 -> 5.4a1: + - jbj: pgp: add methods for ElGamal signatures. - jbj: hmac: fix: permit HMAC's to be clone'd (salt size was incorrect). - jbj: ssl: populate set/verify/sign/generate methods for ECDSA. - jbj: ecdsa: stub-in sign/generate methods for {ECDSA,RSA,DSA}. @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmbc.c ============================================================================ $ cvs diff -u -r2.21 -r2.22 rpmbc.c --- rpm/rpmio/rpmbc.c 27 May 2010 15:00:26 -0000 2.21 +++ rpm/rpmio/rpmbc.c 1 Jun 2010 14:55:11 -0000 2.22 @@ -178,7 +178,7 @@ } static -int rpmbcSetECDSA(/*...@only@*/ DIGEST_CTX ctx, /*...@unused@*/pgpDig dig, pgpDigParams sigp) +int rpmbcSetDUMMY(/*...@only@*/ DIGEST_CTX ctx, /*...@unused@*/pgpDig dig, pgpDigParams sigp) /*...@*/ { int rc = 1; /* XXX always fail. */ @@ -192,33 +192,6 @@ return rc; } -static -int rpmbcVerifyECDSA(/*...@unused@*/pgpDig dig) - /*...@*/ -{ - int rc = 0; /* XXX always fail. */ - - return rc; -} - -static -int rpmbcSignECDSA(/*...@unused@*/pgpDig dig) - /*...@*/ -{ - int rc = 0; /* XXX always fail. */ - - return rc; -} - -static -int rpmbcGenerateECDSA(/*...@unused@*/pgpDig dig) - /*...@*/ -{ - int rc = 0; /* XXX always fail. */ - - return rc; -} - /** */ static /*...@only@*/ @@ -392,7 +365,8 @@ struct pgpImplVecs_s rpmbcImplVecs = { rpmbcSetRSA, rpmbcVerifyRSA, rpmbcSignRSA, rpmbcGenerateRSA, rpmbcSetDSA, rpmbcVerifyDSA, rpmbcSignDSA, rpmbcGenerateDSA, - rpmbcSetECDSA, rpmbcVerifyECDSA, rpmbcSignECDSA, rpmbcGenerateECDSA, + rpmbcSetDUMMY, NULL, NULL, NULL, + rpmbcSetDUMMY, NULL, NULL, NULL, rpmbcMpiItem, rpmbcClean, rpmbcFree, rpmbcInit }; @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmgc.c ============================================================================ $ cvs diff -u -r2.24 -r2.25 rpmgc.c --- rpm/rpmio/rpmgc.c 30 May 2010 07:39:48 -0000 2.24 +++ rpm/rpmio/rpmgc.c 1 Jun 2010 14:55:11 -0000 2.25 @@ -167,24 +167,6 @@ } static -int rpmgcSignRSA(/*...@unused@*/pgpDig dig) - /*...@*/ -{ - int rc = 0; /* XXX always fail. */ - - return rc; -} - -static -int rpmgcGenerateRSA(/*...@unused@*/pgpDig dig) - /*...@*/ -{ - int rc = 0; /* XXX always fail. */ - - return rc; -} - -static int rpmgcSetDSA(/*...@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp) /*...@modifies dig @*/ { @@ -249,19 +231,16 @@ } static -int rpmgcSignDSA(/*...@unused@*/pgpDig dig) +int rpmgcSetELG(/*...@only@*/ DIGEST_CTX ctx, /*...@unused@*/pgpDig dig, pgpDigParams sigp) /*...@*/ { - int rc = 0; /* XXX always fail. */ + int rc = 1; /* XXX always fail. */ + int xx; - return rc; -} +assert(sigp->hash_algo == rpmDigestAlgo(ctx)); + xx = rpmDigestFinal(ctx, (void **)NULL, NULL, 0); -static -int rpmgcGenerateDSA(/*...@unused@*/pgpDig dig) - /*...@*/ -{ - int rc = 0; /* XXX always fail. */ + /* Compare leading 16 bits of digest for quick check. */ return rc; } @@ -588,8 +567,9 @@ } struct pgpImplVecs_s rpmgcImplVecs = { - rpmgcSetRSA, rpmgcVerifyRSA, rpmgcSignRSA, rpmgcGenerateRSA, - rpmgcSetDSA, rpmgcVerifyDSA, rpmgcSignDSA, rpmgcGenerateDSA, + rpmgcSetRSA, rpmgcVerifyRSA, NULL, NULL, + rpmgcSetDSA, rpmgcVerifyDSA, NULL, NULL, + rpmgcSetELG, NULL, NULL, NULL, rpmgcSetECDSA, rpmgcVerifyECDSA, rpmgcSignECDSA, rpmgcGenerateECDSA, rpmgcMpiItem, rpmgcClean, rpmgcFree, rpmgcInit @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmnss.c ============================================================================ $ cvs diff -u -r1.30 -r1.31 rpmnss.c --- rpm/rpmio/rpmnss.c 28 May 2010 21:48:58 -0000 1.30 +++ rpm/rpmio/rpmnss.c 1 Jun 2010 14:55:12 -0000 1.31 @@ -98,24 +98,6 @@ } static -int rpmnssSignRSA(/*...@unused@*/pgpDig dig) - /*...@*/ -{ - int rc = 0; /* XXX always fail. */ - - return rc; -} - -static -int rpmnssGenerateRSA(/*...@unused@*/pgpDig dig) - /*...@*/ -{ - int rc = 0; /* XXX always fail. */ - - return rc; -} - -static int rpmnssSetDSA(/*...@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp) /*...@modifies dig @*/ { @@ -149,23 +131,19 @@ } static -int rpmnssSignDSA(/*...@unused@*/pgpDig dig) +int rpmnssSetELG(/*...@only@*/ DIGEST_CTX ctx, /*...@unused@*/pgpDig dig, pgpDigParams sigp) /*...@*/ { - int rc = 0; /* XXX always fail. */ + int rc = 1; /* XXX always fail. */ + int xx; - return rc; -} +assert(sigp->hash_algo == rpmDigestAlgo(ctx)); + xx = rpmDigestFinal(ctx, (void **)NULL, NULL, 0); -static -int rpmnssGenerateDSA(/*...@unused@*/pgpDig dig) - /*...@*/ -{ - int rc = 0; /* XXX always fail. */ + /* Compare leading 16 bits of digest for quick check. */ return rc; } - static int rpmnssSetECDSA(/*...@only@*/ DIGEST_CTX ctx, /*...@unused@*/pgpDig dig, pgpDigParams sigp) /*...@*/ @@ -220,24 +198,6 @@ return (rc == SECSuccess); } -static -int rpmnssSignECDSA(/*...@unused@*/pgpDig dig) - /*...@*/ -{ - int rc = 0; /* XXX always fail. */ - - return rc; -} - -static -int rpmnssGenerateECDSA(/*...@unused@*/pgpDig dig) - /*...@*/ -{ - int rc = 0; /* XXX always fail. */ - - return rc; -} - /** * @return 0 on success */ @@ -542,9 +502,10 @@ } struct pgpImplVecs_s rpmnssImplVecs = { - rpmnssSetRSA, rpmnssVerifyRSA, rpmnssSignRSA, rpmnssGenerateRSA, - rpmnssSetDSA, rpmnssVerifyDSA, rpmnssSignDSA, rpmnssGenerateDSA, - rpmnssSetECDSA, rpmnssVerifyECDSA, rpmnssSignECDSA, rpmnssGenerateECDSA, + rpmnssSetRSA, rpmnssVerifyRSA, NULL, NULL, + rpmnssSetDSA, rpmnssVerifyDSA, NULL, NULL, + rpmnssSetELG, NULL, NULL, NULL, + rpmnssSetECDSA, rpmnssVerifyECDSA, NULL, NULL, rpmnssMpiItem, rpmnssClean, rpmnssFree, rpmnssInit }; @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmpgp.h ============================================================================ $ cvs diff -u -r2.97 -r2.98 rpmpgp.h --- rpm/rpmio/rpmpgp.h 31 May 2010 21:13:27 -0000 2.97 +++ rpm/rpmio/rpmpgp.h 1 Jun 2010 14:55:12 -0000 2.98 @@ -1701,6 +1701,10 @@ pgpImplVerify_t _pgpVerifyDSA; pgpImplSign_t _pgpSignDSA; pgpImplGenerate_t _pgpGenerateDSA; + pgpImplSet_t _pgpSetELG; + pgpImplVerify_t _pgpVerifyELG; + pgpImplSign_t _pgpSignELG; + pgpImplGenerate_t _pgpGenerateELG; pgpImplSet_t _pgpSetECDSA; pgpImplVerify_t _pgpVerifyECDSA; pgpImplSign_t _pgpSignECDSA; @@ -1732,7 +1736,9 @@ int pgpImplVerifyRSA(pgpDig dig) /*...@*/ { - return (*pgpImplVecs->_pgpVerifyRSA) (dig); + return (pgpImplVecs->_pgpVerifyRSA + ? (*pgpImplVecs->_pgpVerifyRSA) (dig) + : 0); } /** @@ -1741,7 +1747,9 @@ int pgpImplSignRSA(pgpDig dig) /*...@*/ { - return (*pgpImplVecs->_pgpSignRSA) (dig); + return (pgpImplVecs->_pgpSignRSA + ? (*pgpImplVecs->_pgpSignRSA) (dig) + : 0); } /** @@ -1750,7 +1758,9 @@ int pgpImplGenerateRSA(pgpDig dig) /*...@*/ { - return (*pgpImplVecs->_pgpGenerateRSA) (dig); + return (pgpImplVecs->_pgpGenerateRSA + ? (*pgpImplVecs->_pgpGenerateRSA) (dig) + : 0); } /** @@ -1768,7 +1778,9 @@ int pgpImplVerifyDSA(pgpDig dig) /*...@*/ { - return (*pgpImplVecs->_pgpVerifyDSA) (dig); + return (pgpImplVecs->_pgpVerifyDSA + ? (*pgpImplVecs->_pgpVerifyDSA) (dig) + : 0); } /** @@ -1777,7 +1789,9 @@ int pgpImplSignDSA(pgpDig dig) /*...@*/ { - return (*pgpImplVecs->_pgpSignDSA) (dig); + return (pgpImplVecs->_pgpSignDSA + ? (*pgpImplVecs->_pgpSignDSA) (dig) + : 0); } /** @@ -1786,7 +1800,51 @@ int pgpImplGenerateDSA(pgpDig dig) /*...@*/ { - return (*pgpImplVecs->_pgpGenerateDSA) (dig); + return (pgpImplVecs->_pgpGenerateDSA + ? (*pgpImplVecs->_pgpGenerateDSA) (dig) + : 0); +} + +/** + */ +/*...@unused@*/ static inline +int pgpImplSetELG(/*...@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp) + /*...@modifies ctx, dig @*/ +{ + return (*pgpImplVecs->_pgpSetELG) (ctx, dig, sigp); +} + +/** + */ +/*...@unused@*/ static inline +int pgpImplVerifyELG(pgpDig dig) + /*...@*/ +{ + return (pgpImplVecs->_pgpVerifyELG + ? (*pgpImplVecs->_pgpVerifyELG) (dig) + : 0); +} + +/** + */ +/*...@unused@*/ static inline +int pgpImplSignELG(pgpDig dig) + /*...@*/ +{ + return (pgpImplVecs->_pgpSignELG + ? (*pgpImplVecs->_pgpSignELG) (dig) + : 0); +} + +/** + */ +/*...@unused@*/ static inline +int pgpImplGenerateELG(pgpDig dig) + /*...@*/ +{ + return (pgpImplVecs->_pgpGenerateELG + ? (*pgpImplVecs->_pgpGenerateELG) (dig) + : 0); } /** @@ -1804,7 +1862,9 @@ int pgpImplVerifyECDSA(pgpDig dig) /*...@*/ { - return (*pgpImplVecs->_pgpVerifyECDSA) (dig); + return (pgpImplVecs->_pgpVerifyECDSA + ? (*pgpImplVecs->_pgpVerifyECDSA) (dig) + : 0); } /** @@ -1813,7 +1873,9 @@ int pgpImplSignECDSA(pgpDig dig) /*...@*/ { - return (*pgpImplVecs->_pgpSignECDSA) (dig); + return (pgpImplVecs->_pgpSignECDSA + ? (*pgpImplVecs->_pgpSignECDSA) (dig) + : 0); } /** @@ -1822,7 +1884,9 @@ int pgpImplGenerateECDSA(pgpDig dig) /*...@*/ { - return (*pgpImplVecs->_pgpGenerateECDSA) (dig); + return (pgpImplVecs->_pgpGenerateECDSA + ? (*pgpImplVecs->_pgpGenerateECDSA) (dig) + : 0); } /** @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmssl.c ============================================================================ $ cvs diff -u -r2.30 -r2.31 rpmssl.c --- rpm/rpmio/rpmssl.c 27 May 2010 15:30:26 -0000 2.30 +++ rpm/rpmio/rpmssl.c 1 Jun 2010 14:55:12 -0000 2.31 @@ -209,24 +209,6 @@ } static -int rpmsslSignRSA(/*...@unused@*/pgpDig dig) - /*...@*/ -{ - int rc = 0; /* XXX always fail. */ - - return rc; -} - -static -int rpmsslGenerateRSA(/*...@unused@*/pgpDig dig) - /*...@*/ -{ - int rc = 0; /* XXX always fail. */ - - return rc; -} - -static int rpmsslSetDSA(/*...@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp) /*...@modifies dig @*/ { @@ -257,19 +239,16 @@ } static -int rpmsslSignDSA(/*...@unused@*/pgpDig dig) +int rpmsslSetELG(/*...@only@*/ DIGEST_CTX ctx, /*...@unused@*/pgpDig dig, pgpDigParams sigp) /*...@*/ { - int rc = 0; /* XXX always fail. */ + int rc = 1; /* XXX always fail. */ + int xx; - return rc; -} +assert(sigp->hash_algo == rpmDigestAlgo(ctx)); + xx = rpmDigestFinal(ctx, (void **)NULL, NULL, 0); -static -int rpmsslGenerateDSA(/*...@unused@*/pgpDig dig) - /*...@*/ -{ - int rc = 0; /* XXX always fail. */ + /* Compare leading 16 bits of digest for quick check. */ return rc; } @@ -478,8 +457,9 @@ } struct pgpImplVecs_s rpmsslImplVecs = { - rpmsslSetRSA, rpmsslVerifyRSA, rpmsslSignRSA, rpmsslGenerateRSA, - rpmsslSetDSA, rpmsslVerifyDSA, rpmsslSignDSA, rpmsslGenerateDSA, + rpmsslSetRSA, rpmsslVerifyRSA, NULL, NULL, + rpmsslSetDSA, rpmsslVerifyDSA, NULL, NULL, + rpmsslSetELG, NULL, NULL, NULL, rpmsslSetECDSA, rpmsslVerifyECDSA, rpmsslSignECDSA, rpmsslGenerateECDSA, rpmsslMpiItem, rpmsslClean, rpmsslFree, rpmsslInit @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org