RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 29-Dec-2007 16:14:23 Branch: HEAD Handle: 2007122915142300 Modified files: rpm/lib genpgp.sh tpgp.c Log: - avoid RSA key id funkiness for now. - add options to change the crypto implementation. - compile in the plaintext value and file name. Summary: Revision Changes Path 2.5 +3 -0 rpm/lib/genpgp.sh 2.9 +22 -7 rpm/lib/tpgp.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/lib/genpgp.sh ============================================================================ $ cvs diff -u -r2.4 -r2.5 genpgp.sh --- rpm/lib/genpgp.sh 29 Dec 2007 02:49:32 -0000 2.4 +++ rpm/lib/genpgp.sh 29 Dec 2007 15:14:23 -0000 2.5 @@ -25,6 +25,9 @@ str="This is the plaintext" echo "This is the plaintext" > plaintext +echo "static const char * plaintext = \"$str\";" +echo "static const char * plaintextfn = \"plaintext\";" + $gpg --detach-sign -a -u DSApub --output - plaintext > DSA.sig $gpg --clearsign -u DSApub --output - plaintext > DSA.pem $gpg --export -a DSApub > DSA.pub @@ . patch -p0 <<'@@ .' Index: rpm/lib/tpgp.c ============================================================================ $ cvs diff -u -r2.8 -r2.9 tpgp.c --- rpm/lib/tpgp.c 29 Dec 2007 02:49:32 -0000 2.8 +++ rpm/lib/tpgp.c 29 Dec 2007 15:14:23 -0000 2.9 @@ -61,7 +61,7 @@ } _sigfn = _free(_sigfn); } else { - /* XXX FIXME: read clearsign'd file with appended signature. + /* XXX FIXME: read clearsign'd file with appended signature. */ } xx = pgpPrtPkts((uint8_t *)sigpkt, sigpktlen, dig, printing); if (xx) { @@ -196,22 +196,36 @@ int rc = 0; if (!strcmp("DSA", sigtype)) { - rc = rpmCheckPgpSignatureOnFile(ts, "plaintext", DSAsig, DSApub, NULL); - rc = rpmCheckPgpSignatureOnFile(ts, "plaintext", DSAsig, NULL, NULL); + rc = rpmCheckPgpSignatureOnFile(ts, plaintextfn, DSAsig, DSApub, NULL); + rc = rpmCheckPgpSignatureOnFile(ts, plaintextfn, DSAsig, NULL, NULL); } if (!strcmp("RSA", sigtype)) { - rc = rpmCheckPgpSignatureOnFile(ts, "plaintext", RSAsig, RSApub, NULL); - rc = rpmCheckPgpSignatureOnFile(ts, "plaintext", RSAsig, NULL, NULL); + rc = rpmCheckPgpSignatureOnFile(ts, plaintextfn, RSAsig, RSApub, NULL); +#ifdef NOTYET /* XXX RSA key id's are funky. */ + rc = rpmCheckPgpSignatureOnFile(ts, plaintextfn, RSAsig, NULL, NULL); +#endif } return rc; } static struct poptOption optionsTable[] = { - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0, N_("Common options:"), NULL }, + + /* XXX Note: these entries assume sizeof(int) == sizeof (void *). */ + { "bc", 0, POPT_ARG_VAL, &pgpImplVecs, (int)&rpmbcImplVecs, + N_("use beecrypt crypto implementation"), NULL }, +#ifdef NOTYET + { "gc", 0, POPT_ARG_VAL, &pgpImplVecs, (int)&rpmgcImplVecs, + N_("use gcrypt crypto implementation"), NULL }, +#endif + { "nss", 0, POPT_ARG_VAL, &pgpImplVecs, (int)&rpmnssImplVecs, + N_("use NSS crypto implementation"), NULL }, + { "ssl", 0, POPT_ARG_VAL, &pgpImplVecs, (int)&rpmsslImplVecs, + N_("use OpenSSL crypto implementation"), NULL }, + POPT_AUTOALIAS POPT_AUTOHELP POPT_TABLEEND @@ -220,7 +234,7 @@ int main(int argc, char *argv[]) { - poptContext optCon = rpmcliInit(argc, argv, optionsTable); + poptContext optCon; rpmts ts = NULL; int rc; @@ -228,6 +242,7 @@ _pgp_debug = 1; _pgp_print = 1; + optCon = rpmcliInit(argc, argv, optionsTable); ts = rpmtsCreate(); (void) rpmtsOpenDB(ts, O_RDONLY); @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org