static int replaceSignature(Header sigh, sigTarget sigt_v3, sigTarget sigt_v4) { int rc = -1; rpmtd sigtd = NULL; /* Make the cheaper v4 signature first */ if ((sigtd = makeGPGSignature(sigh, 1, sigt_v4)) == NULL) goto exit; /* See if we already have a signature by the same key and parameters */ if (haveSignature(sigtd, sigh)) { rc = 1; goto exit; } /* Nuke all signature tags */ deleteSigs(sigh); if (headerPut(sigh, sigtd, HEADERPUT_DEFAULT) == 0) goto exit; rpmtdFree(sigtd); /* Assume the same signature test holds for v3 signature too */ if ((sigtd = makeGPGSignature(sigh, 0, sigt_v3)) == NULL) goto exit; if (headerPut(sigh, sigtd, HEADERPUT_DEFAULT) == 0) goto exit; rc = 0; exit: rpmtdFree(sigtd); return rc; }
static int rpmGenSignature(Header sigh, sigTarget sigt1, sigTarget sigt2) { int ret; ret = makeGPGSignature(sigh, 0, sigt1); if (ret) goto exit; ret = makeGPGSignature(sigh, 1, sigt2); if (ret) goto exit; exit: return ret; }