rpm
5.2.1
|
#include "system.h"
#include <rpmio.h>
#include <rpmurl.h>
#include <rpmcb.h>
#include <rpmpgp.h>
#include <rpmmacro.h>
#include <rpmku.h>
#include <rpmtag.h>
#include "rpmdb.h"
#include <pkgio.h>
#include "legacy.h"
#include "signature.h"
#include "debug.h"
Go to the source code of this file.
Defines | |
#define | _RPMPGP_INTERNAL |
Functions | |
int | rpmTempFile (const char *prefix, const char **fnptr, void *fdptr) |
Return file handle for a temporaray file. | |
static int | makeGPGSignature (const char *file, rpmSigTag *sigTagp, rpmuint8_t **pktp, rpmuint32_t *pktlenp, const char *passPhrase) |
Generate GPG signature(s) for a header+payload file. | |
static int | makeHDRSignature (Header sigh, const char *file, rpmSigTag sigTag, const char *passPhrase) |
Generate header only signature(s) from a header+payload file. | |
int | rpmAddSignature (Header sigh, const char *file, rpmSigTag sigTag, const char *passPhrase) |
Generate signature(s) from a header+payload file, save in signature header. | |
int | rpmCheckPassPhrase (const char *passPhrase) |
Check for valid pass phrase by invoking a helper. | |
static const char * | rpmSigString (rpmRC res) |
static rpmRC | verifySize (const pgpDig dig, char *t) |
static rpmRC | verifyMD5 (pgpDig dig, char *t, DIGEST_CTX md5ctx) |
static rpmRC | verifySHA1 (pgpDig dig, char *t, DIGEST_CTX shactx) |
Verify header immutable region SHA-1 digest. | |
static rpmRC | verifyRSA (pgpDig dig, char *t, DIGEST_CTX rsactx) |
Verify RSA signature. | |
static rpmRC | verifyDSA (pgpDig dig, char *t, DIGEST_CTX dsactx) |
Verify DSA signature. | |
rpmRC | rpmVerifySignature (void *_dig, char *result) |
Verify a signature from a package. |
Definition in file signature.c.
#define _RPMPGP_INTERNAL |
Definition at line 10 of file signature.c.
static int makeGPGSignature | ( | const char * | file, |
rpmSigTag * | sigTagp, | ||
rpmuint8_t ** | pktp, | ||
rpmuint32_t * | pktlenp, | ||
const char * | passPhrase | ||
) | [static] |
Generate GPG signature(s) for a header+payload file.
file | header+payload file name |
*sigTagp | signature tag |
*pktp | signature packet(s) |
*pktlenp | signature packet(s) length |
passPhrase | private key pass phrase |
Definition at line 146 of file signature.c.
References _, _free(), addMacro(), alloca(), D_, delMacro(), errno, EXIT_FAILURE, Fclose(), Ferror(), Fopen(), Fread(), pgpDigFree(), pgpDigNew(), pgpGetSignature(), pgpPrtPkts(), PGPPUBKEYALGO_DSA, PGPPUBKEYALGO_RSA, rpmExpand(), rpmkuPassPhrase(), rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMSIGTAG_DSA, RPMSIGTAG_MD5, RPMSIGTAG_RSA, RPMSIGTAG_SHA1, RPMSIGTAG_SIZE, setenv(), Stat(), stpcpy(), Unlink(), unsetenv(), and xmalloc().
Referenced by makeHDRSignature().
static int makeHDRSignature | ( | Header | sigh, |
const char * | file, | ||
rpmSigTag | sigTag, | ||
const char * | passPhrase | ||
) | [static] |
Generate header only signature(s) from a header+payload file.
sigh | signature header |
file | header+payload file name |
sigTag | type of signature(s) to add |
passPhrase | private key pass phrase |
Definition at line 297 of file signature.c.
References _free(), alloca(), _HE_s::c, Fclose(), Ferror(), Fopen(), headerFree(), headerGet(), headerGetMagic(), headerIsEntry(), headerPut(), makeGPGSignature(), _HE_s::p, PGPHASHALGO_SHA1, rpmDataType_u::ptr, RPM_BIN_TYPE, RPM_STRING_TYPE, RPMDIGEST_NONE, rpmDigestFinal(), rpmDigestInit(), rpmDigestUpdate(), rpmlog(), RPMLOG_ERR, rpmpkgRead(), rpmpkgWrite(), RPMRC_OK, RPMSIGTAG_DSA, RPMSIGTAG_GPG, RPMSIGTAG_MD5, RPMSIGTAG_PGP, RPMSIGTAG_PGP5, RPMSIGTAG_SHA1, RPMSIGTAG_SIZE, RPMTAG_HEADERIMMUTABLE, rpmTempFile(), rpmDataType_u::str, _HE_s::t, _HE_s::tag, and Unlink().
Referenced by rpmAddSignature().
int rpmCheckPassPhrase | ( | const char * | passPhrase | ) |
Check for valid pass phrase by invoking a helper.
passPhrase | pass phrase |
Definition at line 487 of file signature.c.
References _, _free(), errno, rpmExpand(), rpmIsVerbose, rpmkuPassPhrase(), rpmlog(), RPMLOG_ERR, setenv(), and unsetenv().
Referenced by main().
static const char* rpmSigString | ( | rpmRC | res | ) | [static] |
Definition at line 559 of file signature.c.
References RPMRC_FAIL, RPMRC_NOKEY, RPMRC_NOTFOUND, RPMRC_NOTTRUSTED, and RPMRC_OK.
Referenced by verifyDSA(), verifyMD5(), verifyRSA(), verifySHA1(), and verifySize().
int rpmTempFile | ( | const char * | prefix, |
const char ** | fnptr, | ||
void * | fdptr | ||
) |
Return file handle for a temporaray file.
A unique temporaray file path will be generated using rpmGenPath(prefix, "%{_tmppath}/", "rpm-tmp.XXXXX") where "XXXXXX" is filled in using rand(3). The file is opened, and the link count and (dev,ino) location are verified after opening. The file name and the open file handle are returned.
prefix | leading part of temp file path |
*fnptr | temp file name (or NULL) |
*fdptr | temp file handle |
Definition at line 29 of file signature.c.
References _, _free(), errno, Fclose(), Ferror(), Fileno(), Fopen(), rpmGenPath(), rpmioMkpath(), rpmlog(), RPMLOG_ERR, S_ISLNK, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().
Referenced by makeHDRSignature(), manageFile(), runScript(), and writeRPM().
static rpmRC verifyDSA | ( | pgpDig | dig, |
char * | t, | ||
DIGEST_CTX | dsactx | ||
) | [static] |
Verify DSA signature.
dig | container |
t | verbose success/failure text |
dsactx | DSA digest context |
Definition at line 830 of file signature.c.
References _, rpmop_s::count, pgpFindPubkey(), pgpGetSig(), pgpGetSiglen(), pgpGetSignature(), pgpGetSigtag(), pgpHexCvt(), pgpImplSetDSA(), pgpImplVerifyDSA(), PGPPUBKEYALGO_DSA, pgpStatsAccumulator(), rpmDigestAlgo(), rpmDigestDup(), rpmDigestName(), rpmDigestUpdate(), RPMRC_FAIL, RPMRC_OK, rpmSigString(), RPMSIGTAG_DSA, rpmswEnter(), rpmswExit(), and stpcpy().
Referenced by rpmVerifySignature().
static rpmRC verifyMD5 | ( | pgpDig | dig, |
char * | t, | ||
DIGEST_CTX | md5ctx | ||
) | [static] |
Definition at line 608 of file signature.c.
References _, _free(), rpmop_s::count, pgpGetSig(), pgpGetSiglen(), pgpHexCvt(), pgpStatsAccumulator(), rpmDigestDup(), rpmDigestFinal(), rpmDigestName(), RPMRC_FAIL, RPMRC_NOKEY, RPMRC_OK, rpmSigString(), rpmswEnter(), rpmswExit(), and stpcpy().
Referenced by rpmVerifySignature().
static rpmRC verifyRSA | ( | pgpDig | dig, |
char * | t, | ||
DIGEST_CTX | rsactx | ||
) | [static] |
Verify RSA signature.
dig | container |
t | verbose success/failure text |
rsactx | RSA digest context |
Definition at line 732 of file signature.c.
References _, rpmop_s::count, pgpFindPubkey(), pgpGetSig(), pgpGetSiglen(), pgpGetSignature(), pgpGetSigtag(), pgpHexCvt(), pgpImplSetRSA(), pgpImplVerifyRSA(), PGPPUBKEYALGO_RSA, pgpStatsAccumulator(), rpmDigestAlgo(), rpmDigestDup(), rpmDigestName(), rpmDigestUpdate(), RPMRC_FAIL, RPMRC_OK, rpmSigString(), RPMSIGTAG_RSA, rpmswEnter(), rpmswExit(), and stpcpy().
Referenced by rpmVerifySignature().
static rpmRC verifySHA1 | ( | pgpDig | dig, |
char * | t, | ||
DIGEST_CTX | shactx | ||
) | [static] |
Verify header immutable region SHA-1 digest.
dig | container |
t | verbose success/failure text |
shactx | SHA-1 digest context |
Definition at line 670 of file signature.c.
References _, _free(), pgpGetSig(), pgpGetSiglen(), pgpStatsAccumulator(), rpmDigestDup(), rpmDigestFinal(), rpmDigestName(), RPMRC_FAIL, RPMRC_NOKEY, RPMRC_OK, rpmSigString(), rpmswEnter(), rpmswExit(), and stpcpy().
Referenced by rpmVerifySignature().
static rpmRC verifySize | ( | const pgpDig | dig, |
char * | t | ||
) | [static] |
Definition at line 575 of file signature.c.
References _, pgpGetSig(), RPMRC_FAIL, RPMRC_NOKEY, RPMRC_OK, rpmSigString(), and stpcpy().
Referenced by rpmVerifySignature().