Exemple #1
0
/*@only@*/
static rpmvf rpmvfNew(rpmts ts, rpmfi fi, int i, rpmVerifyAttrs omitMask)
	/*@*/
{
    rpmvf vf = DRD_xcalloc(1, sizeof(*vf));

#ifdef	NOTYET
    vf->_item.use = yarnNewLock(1);
    vf->_item.pool = NULL;
#endif

/*@-mods@*/
    vf->fn = rpmGetPath(rpmtsRootDir(ts), fi->dnl[fi->dil[i]], fi->bnl[i], NULL);
/*@=mods@*/
    vf->flink = fi->flinks[i];
    vf->fuser = fi->fuser[i];
    vf->fgroup = fi->fgroup[i];

    {   struct stat *st = &vf->sb;
        st->st_dev =
        st->st_rdev = fi->frdevs[i];
        st->st_ino = fi->finodes[i];
        st->st_mode = fi->fmodes[i];
#ifdef	NOTNEEDED
        st->st_nlink = rpmfiFNlink(fi) + (int)S_ISDIR(st->st_mode);
#endif
        if (unameToUid(vf->fuser, &st->st_uid) == -1)
            st->st_uid = 0;             /* XXX */
        if (gnameToGid(vf->fgroup, &st->st_gid) == -1)
            st->st_gid = 0;             /* XXX */
        st->st_size = fi->fsizes[i];
        st->st_blksize = 4 * 1024;      /* XXX */
        st->st_blocks = (st->st_size + (st->st_blksize - 1)) / st->st_blksize;
        st->st_atime =
        st->st_ctime =
        st->st_mtime = fi->fmtimes[i];
    }

    vf->fflags = fi->fflags[i];
    vf->fstate = fi->fstates[i];
    vf->vflags = fi->vflags[i];
    vf->dalgo = fi->fdigestalgos
		? fi->fdigestalgos[i]
		: fi->digestalgo;
    vf->dlen = fi->digestlen;
    vf->digest = fi->digests + (fi->digestlen * i);

    /* Don't verify any features in omitMask. */
    vf->vflags &= ~(omitMask | RPMVERIFY_FAILURES);

    /* Content checks of %ghost files are meaningless. */
    if (vf->fflags & RPMFILE_GHOST)
	vf->vflags &= ~(RPMVERIFY_FDIGEST | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
			RPMVERIFY_LINKTO | RPMVERIFY_HMAC);

    return vf;
}
Exemple #2
0
 aes-[128|192|256]-ofb  128/192/256 bit AES in OFB mode
#endif

CIPHER_CTX
rpmCipherInit(pgpSymkeyAlgo symkeyalgo, rpmCipherFlags flags)
{
    CIPHER_CTX cph = cphGetPool(_cphPool);

    cph->symkeyalgo = symkeyalgo;
    cph->flags = flags;

    switch (symkeyalgo) {
    case PGPSYMKEYALGO_DES:
	cph->name = "des";
	cph->paramsize = 64/8;
	cph->param = DRD_xcalloc(1, cph->paramsize);
	cph->blocksize = 0;
	cph->keybitsmin = 0;
	cph->keybitsmax = 0;
	cph->keybitsinc = 0;
	cph->Setup = NULL;
	cph->SetIV = NULL;
	cph->SetCTR = NULL;
	cph->Feedback = NULL;
	break;
    case PGPSYMKEYALGO_PLAINTEXT:
    case PGPSYMKEYALGO_IDEA:
    case PGPSYMKEYALGO_TRIPLE_DES:
    case PGPSYMKEYALGO_CAST5:
    case PGPSYMKEYALGO_BLOWFISH:
    case PGPSYMKEYALGO_SAFER:
    case PGPSYMKEYALGO_DES_SK:
    case PGPSYMKEYALGO_AES_128:
    case PGPSYMKEYALGO_AES_192:
    case PGPSYMKEYALGO_AES_256:
    case PGPSYMKEYALGO_TWOFISH:
    case PGPSYMKEYALGO_CAMELLIA_128:
    case PGPSYMKEYALGO_CAMELLIA_192:
    case PGPSYMKEYALGO_CAMELLIA_256:
    case PGPSYMKEYALGO_NOENCRYPT:
    default:
	break;
    }

DPRINTF((stderr, "==> cph %p ==== Init(%s, %x) param %p\n", cph, cph->name, flags, cph->param));

    return (CIPHER_CTX)rpmioLinkPoolItem((rpmioItem)cph, __FUNCTION__, __FILE__, __LINE__);
}