csomh / source-git / rpm

Forked from source-git/rpm 4 years ago
Clone
2ff057
#ifndef _RPMVS_H
2ff057
#define _RPMVS_H
2ff057
2ff057
#include <rpm/rpmtypes.h>
2ff057
#include <rpm/rpmts.h> /* for rpmVSFlags */
2ff057
#include "lib/header_internal.h"
2ff057
2ff057
/* siginfo range bits */
2ff057
enum {
2ff057
    RPMSIG_HEADER	= (1 << 0),
2ff057
    RPMSIG_PAYLOAD	= (1 << 1),
2ff057
};
2ff057
2ff057
struct rpmsinfo_s {
2ff057
    /* static data */
2ff057
    int type;
2ff057
    int disabler;
2ff057
    int range;
2ff057
    /* parsed data */
2ff057
    int hashalgo;
2ff057
    int sigalgo;
2ff057
    int id;
2ff057
    int wrapped;
2ff057
    int strength;
2ff057
    unsigned int keyid;
2ff057
    union {
2ff057
	pgpDigParams sig;
2ff057
	char *dig;
2ff057
    };
2ff057
    char *descr;
2ff057
    DIGEST_CTX ctx;
2ff057
    /* verify results */
2ff057
    rpmRC rc;
2ff057
    char *msg;
2ff057
};
2ff057
2ff057
/**
2ff057
 * Signature/digest verification callback prototype.
2ff057
 * Useful eg for customizing verification output and results.
2ff057
 *
2ff057
 * @param sinfo		signature/digest info
2ff057
 * @param cbdata	callback data
2ff057
 * @return		1 to continue, 0 to stop verification
2ff057
 */
2ff057
typedef int (*rpmsinfoCb)(struct rpmsinfo_s *sinfo, void *cbdata);
2ff057
2ff057
#ifdef __cplusplus
2ff057
extern "C" {
2ff057
#endif
2ff057
2ff057
const char *rpmsinfoDescr(struct rpmsinfo_s *sinfo);
2ff057
2ff057
char *rpmsinfoMsg(struct rpmsinfo_s *sinfo);
2ff057
2ff057
struct rpmvs_s *rpmvsCreate(int vfylevel, rpmVSFlags vsflags, rpmKeyring keyring);
2ff057
2ff057
void rpmvsInit(struct rpmvs_s *vs, hdrblob blob, rpmDigestBundle bundle);
2ff057
2ff057
rpmVSFlags rpmvsFlags(struct rpmvs_s *vs);
2ff057
2ff057
struct rpmvs_s *rpmvsFree(struct rpmvs_s *sis);
2ff057
2ff057
void rpmvsAppendTag(struct rpmvs_s *sis, hdrblob blob, rpmTagVal tag);
2ff057
2ff057
void rpmvsInitRange(struct rpmvs_s *sis, int range);
2ff057
2ff057
void rpmvsFiniRange(struct rpmvs_s *sis, int range);
2ff057
Panu Matilainen e637fd
int rpmvsRange(struct rpmvs_s *vs);
Panu Matilainen e637fd
2ff057
int rpmvsVerify(struct rpmvs_s *sis, int type,
2ff057
                       rpmsinfoCb cb, void *cbdata);
2ff057
2ff057
rpmRC rpmpkgRead(struct rpmvs_s *vs, FD_t fd,
2ff057
		hdrblob *sigblobp, hdrblob *blobp, char **emsg);
2ff057
2ff057
#ifdef __cplusplus
2ff057
}
2ff057
#endif
2ff057
2ff057
#endif /* _RPMVS_H */