Main Page Modules Data Structures File List Data Fields Globals Related Pages

# lib/signature.c File Reference

More...

`#include "system.h"`
`#include "rpmio_internal.h"`
`#include <rpmlib.h>`
`#include <rpmmacro.h>`
`#include "md5.h"`
`#include "misc.h"`
`#include "rpmlead.h"`
`#include "signature.h"`
`#include "debug.h"`

Go to the source code of this file.

## Defines

#define | X(_x) (unsigned)((_x) & 0xff)

## Typedefs

typedef int(* | md5func )(const char *fn, byte *digest)

## Functions

int | rpmLookupSignatureType (int action)
const char * | rpmDetectPGPVersion (pgpVersion *pgpVer)
rpmRC | checkSize (FD_t fd, int siglen, int pad, int datalen)
| Check package size. More...
rpmRC | rpmReadSignature (FD_t fd, Header *headerp, sigType sig_type)
int | rpmWriteSignature (FD_t fd, Header h)
Header | rpmNewSignature (void)
Header | rpmFreeSignature (Header h)
int | makePGPSignature (const char *file, void **sig, int_32 *size, const char *passPhrase)
int | makeGPGSignature (const char *file, void **sig, int_32 *size, const char *passPhrase)
int | rpmAddSignature (Header h, const char *file, int_32 sigTag, const char *passPhrase)
rpmVerifySignatureReturn | verifySizeSignature (const char *datafile, int_32 size, char *result)
rpmVerifySignatureReturn | verifyMD5Signature (const char *datafile, const byte *sig, char *result, md5func fn)
rpmVerifySignatureReturn | verifyPGPSignature (const char *datafile, const void *sig, int count, char *result)
rpmVerifySignatureReturn | verifyGPGSignature (const char *datafile, const void *sig, int count, char *result)
int | checkPassPhrase (const char *passPhrase, const int sigTag)
char * | rpmGetPassPhrase (const char *prompt, const int sigTag)
rpmVerifySignatureReturn | rpmVerifySignature (const char *file, int_32 sigTag, const void *sig, int count, char *result)

## Variables

char ** | environ = NULL

## Detailed Description

Definition in file signature.c.

## Define Documentation

#define X | ( | _x |  | ) | (unsigned)((_x) & 0xff)

| Definition at line 504 of file signature.c. Referenced by verifyMD5Signature.

## Typedef Documentation

typedef int(* md5func)(const char * fn, byte * digest)

| Definition at line 33 of file signature.c. Referenced by verifyMD5Signature.

## Function Documentation

int checkPassPhrase | ( | const char * | passPhrase,
|  | const int | sigTag
| ) | `[static]`

| Definition at line 783 of file signature.c. References _, dosetenv, environ, errno, PGP_2, PGP_5, PGP_NOTDETECTED, PGP_UNKNOWN, pgpVersion, poptParseArgvString, rpmDetectPGPVersion, rpmExpand, and strerror. Referenced by rpmGetPassPhrase.

rpmRC checkSize | ( | FD_t | fd,
|  | int | siglen,
|  | int | pad,
|  | int | datalen
| ) | `[inline, static]`

Check package size.

Todo:
  rpmio: use fdSize rather than fstat(2) to get file size.

Parameters:

  fd | package file handle
  siglen | signature header size
  pad | signature padding
  datalen | length of header+payload

Returns:
  rpmRC return code

Definition at line 115 of file signature.c.

References _, Fileno, rpmRC, RPMRC_BADSIZE, RPMRC_FAIL, and RPMRC_OK.

Referenced by rpmReadSignature.

int makeGPGSignature | ( | const char * | file,
|  | void ** | sig,
|  | int_32 * | size,
|  | const char * | passPhrase
| ) | `[static]`

| Definition at line 357 of file signature.c. References _, _free, addMacro, alloca, delMacro, dosetenv, environ, errno, Fclose, Ferror, Fopen, int_32, poptParseArgvString, rpmExpand, stpcpy, strerror, timedRead, and xmalloc. Referenced by rpmAddSignature.

int makePGPSignature | ( | const char * | file,
|  | void ** | sig,
|  | int_32 * | size,
|  | const char * | passPhrase
| ) | `[static]`

| Definition at line 245 of file signature.c. References _, _free, addMacro, alloca, delMacro, dosetenv, environ, errno, Fclose, Ferror, Fopen, int_32, PGP_2, PGP_5, PGP_NOTDETECTED, PGP_UNKNOWN, pgpVersion, poptParseArgvString, rpmDetectPGPVersion, rpmExpand, stpcpy, strerror, timedRead, and xmalloc. Referenced by rpmAddSignature.

Header rpmFreeSignature | ( | Header | h | ) |

| Definition at line 240 of file signature.c. References headerFree. Referenced by readPackageHeaders, rpmReadPackageHeader, and writeRPM.

rpmVerifySignatureReturn rpmVerifySignature | ( | const char * | file,
|  | int_32 | sigTag,
|  | const void * | sig,
|  | int | count,
|  | char * | result
| ) |

| Definition at line 930 of file signature.c. References _, int_32, verifyGPGSignature, verifyMD5Signature, verifyPGPSignature, and verifySizeSignature. Referenced by rpmCheckSig.

rpmVerifySignatureReturn verifyGPGSignature | ( | const char * | datafile,
|  | const void * | sig,
|  | int | count,
|  | char * | result
| ) | `[static]`

| Definition at line 689 of file signature.c. References _, _free, addMacro, delMacro, dosetenv, environ, errno, Fclose, Ferror, Fopen, Fwrite, makeTempFile, poptParseArgvString, rpmExpand, rpmGetPath, stpncpy, strerror, and xstrncasecmp. Referenced by rpmVerifySignature.

rpmVerifySignatureReturn verifyMD5Signature | ( | const char * | datafile,
|  | const byte * | sig,
|  | char * | result,
|  | md5func | fn
| ) | `[static]`

| Definition at line 507 of file signature.c. References md5func, and X. Referenced by rpmVerifySignature.

rpmVerifySignatureReturn verifyPGPSignature | ( | const char * | datafile,
|  | const void * | sig,
|  | int | count,
|  | char * | result
| ) | `[static]`

| Definition at line 544 of file signature.c. References _, _free, addMacro, delMacro, dosetenv, environ, errno, Fclose, Ferror, Fopen, Fwrite, makeTempFile, PGP_2, PGP_5, PGP_NOTDETECTED, PGP_UNKNOWN, pgpVersion, poptParseArgvString, rpmDetectPGPVersion, rpmExpand, rpmGetPath, stpncpy, and strerror. Referenced by rpmVerifySignature.

rpmVerifySignatureReturn verifySizeSignature | ( | const char * | datafile,
|  | int_32 | size,
|  | char * | result
| ) | `[static]`

| Definition at line 486 of file signature.c. References int_32. Referenced by rpmVerifySignature.

## Variable Documentation

char** environ = NULL

| Definition at line 30 of file signature.c. Referenced by checkPassPhrase, main, makeGPGSignature, makePGPSignature, verifyGPGSignature, verifyPGPSignature, and xmalloc.