RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 07-Jul-2016 14:17:32 Branch: rpm-5_4 Handle: 2016070712173100 Modified files: (Branch: rpm-5_4) rpm/rpmio cipher.c digest.c librpmio.vers mire.c mire.h poptIO.c rpmhash.c rpmhash.h rpmio.c rpmiotypes.h rpmpgp.c rpmsql.c rpmurl.h url.c Log: - rpmio: rename internal variables necessary to use RPMPOOL_ macros. - digest: add/use RPMDIGEST_INIT/RPMDIGEST_INIT_FAMILY macros where possible. Summary: Revision Changes Path 1.1.2.3 +6 -22 rpm/rpmio/cipher.c 2.93.2.8 +340 -536 rpm/rpmio/digest.c 2.199.2.63 +4 -3 rpm/rpmio/librpmio.vers 1.56.4.3 +30 -86 rpm/rpmio/mire.c 1.32.4.4 +4 -3 rpm/rpmio/mire.h 1.94.2.23 +6 -6 rpm/rpmio/poptIO.c 1.17.4.2 +8 -38 rpm/rpmio/rpmhash.c 1.12.4.2 +16 -34 rpm/rpmio/rpmhash.h 1.230.2.36 +19 -39 rpm/rpmio/rpmio.c 1.47.2.22 +3 -0 rpm/rpmio/rpmiotypes.h 2.127.2.22 +44 -138 rpm/rpmio/rpmpgp.c 2.59.2.17 +28 -86 rpm/rpmio/rpmsql.c 1.41.4.11 +2 -1 rpm/rpmio/rpmurl.h 1.73.4.18 +6 -20 rpm/rpmio/url.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/rpmio/cipher.c ============================================================================ $ cvs diff -u -r1.1.2.2 -r1.1.2.3 cipher.c --- rpm/rpmio/cipher.c 18 Apr 2014 18:45:54 -0000 1.1.2.2 +++ rpm/rpmio/cipher.c 7 Jul 2016 12:17:31 -0000 1.1.2.3 @@ -4,6 +4,7 @@ #include "system.h" +#include "rpmiotypes.h" #include "rpmio_internal.h" #include <rpmbc.h> @@ -12,10 +13,10 @@ #define _CIPHER_DEBUG -1 /*@unchecked@*/ -int _cph_debug = _CIPHER_DEBUG; +int _rpmcph_debug = _CIPHER_DEBUG; #ifdef _CIPHER_DEBUG -#define DPRINTF(_a) if (_cph_debug < 0) fprintf _a +#define DPRINTF(_a) if (_rpmcph_debug < 0) fprintf _a #else #define DPRINTF(_a) #endif @@ -54,8 +55,7 @@ return (cph ? cph->param : NULL); } -static void cphFini(void * _cph) - /*@modifies _cph @*/ +static void rpmcphFini(void * _cph) { CIPHER_CTX cph = (CIPHER_CTX) _cph; if (cph->param != NULL && cph->paramsize > 0) @@ -80,23 +80,7 @@ cph->flags = (rpmCipherFlags)0; } -/*@unchecked@*/ /*@only@*/ /*@null@*/ -rpmioPool _cphPool; - -static CIPHER_CTX cphGetPool(rpmioPool pool) -{ - CIPHER_CTX cph; - - if (_cphPool == NULL) { -ANNOTATE_BENIGN_RACE(&_cphPool, ""); - _cphPool = rpmioNewPool("cph", sizeof(*cph), -1, _cph_debug, - NULL, NULL, cphFini); - pool = _cphPool; - } - cph = (CIPHER_CTX) rpmioGetPool(pool, sizeof(*cph)); - memset(((char *)cph)+sizeof(cph->_item), 0, sizeof(*cph)-sizeof(cph->_item)); - return cph; -} +RPMIOPOOL_MODULE(cph) #ifdef REFERENCE base64 Base 64 @@ -160,7 +144,7 @@ CIPHER_CTX rpmCipherInit(pgpSymkeyAlgo symkeyalgo, rpmCipherFlags flags) { - CIPHER_CTX cph = cphGetPool(_cphPool); + CIPHER_CTX cph = rpmcphGetPool(_rpmcphPool); cph->symkeyalgo = symkeyalgo; cph->flags = flags; @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/digest.c ============================================================================ $ cvs diff -u -r2.93.2.7 -r2.93.2.8 digest.c --- rpm/rpmio/digest.c 19 Apr 2016 13:07:45 -0000 2.93.2.7 +++ rpm/rpmio/digest.c 7 Jul 2016 12:17:31 -0000 2.93.2.8 @@ -117,11 +117,10 @@ #include "debug.h" -/*@unchecked@*/ -int _ctx_debug = 0; +int _rpmctx_debug = 0; #ifdef _DIGEST_DEBUG -#define DPRINTF(_a) if (_ctx_debug < 0) fprintf _a +#define DPRINTF(_a) if (_rpmctx_debug < 0) fprintf _a #else #define DPRINTF(_a) #endif @@ -130,34 +129,30 @@ #define _JLU3_jlu32l #include "lookup3.c" -/*@access DIGEST_CTX@*/ /** * Digest private data. */ struct DIGEST_CTX_s { struct rpmioItem_s _item; /*!< usage mutex and pool identifier. */ -/*@observer@*/ const char * name; /*!< Digest name. */ size_t paramsize; /*!< No. bytes of digest parameters. */ size_t blocksize; /*!< No. bytes in block of plaintext data. */ size_t digestsize; /*!< No. bytes of digest. */ - int (*Reset) (void * param) - /*@modifies param @*/; /*!< Digest initialize. */ - int (*Update) (void * param, const byte * data, size_t size) - /*@modifies param @*/; /*!< Digest update. */ - int (*Digest) (void * param, /*@out@*/ byte * digest) - /*@modifies param, digest @*/; /*!< Digest finish. */ + int (*Reset) (void * param); + /*!< Digest initialize. */ + int (*Update) (void * param, const byte * data, size_t size); + /*!< Digest update. */ + int (*Digest) (void * param, byte * digest); + /*!< Digest finish. */ pgpHashAlgo hashalgo; /*!< RFC 2440/4880 hash algorithm id. */ rpmDigestFlags flags; /*!< Bit(s) to control digest operation. */ -/*@observer@*/ /*@null@*/ const char * asn1; /*!< RFC 3447 ASN1 oid string (in hex). */ void * param; /*!< Digest parameters. */ void * salt; /*!< Key salt[2*blocksize] */ }; -static void ctxFini(void * _ctx) - /*@modifies _ctx @*/ +static void rpmctxFini(void * _ctx) { DIGEST_CTX ctx = (DIGEST_CTX) _ctx; if (ctx->param != NULL && ctx->paramsize > 0) @@ -178,23 +173,7 @@ ctx->asn1 = NULL; } -/*@unchecked@*/ /*@only@*/ /*@null@*/ -rpmioPool _ctxPool; - -static DIGEST_CTX ctxGetPool(rpmioPool pool) -{ - DIGEST_CTX ctx; - - if (_ctxPool == NULL) { -ANNOTATE_BENIGN_RACE(&_ctxPool, ""); - _ctxPool = rpmioNewPool("ctx", sizeof(*ctx), -1, _ctx_debug, - NULL, NULL, ctxFini); - pool = _ctxPool; - } - ctx = (DIGEST_CTX) rpmioGetPool(pool, sizeof(*ctx)); - memset(((char *)ctx)+sizeof(ctx->_item), 0, sizeof(*ctx)-sizeof(ctx->_item)); - return ctx; -} +RPMIOPOOL_MODULE(ctx) pgpHashAlgo rpmDigestAlgo(DIGEST_CTX ctx) { @@ -219,7 +198,7 @@ DIGEST_CTX rpmDigestDup(DIGEST_CTX octx) { - DIGEST_CTX nctx = ctxGetPool(_ctxPool); + DIGEST_CTX nctx = rpmctxGetPool(_rpmctxPool); nctx->name = octx->name; nctx->digestsize = octx->digestsize; @@ -254,7 +233,7 @@ DIGEST_CTX rpmDigestInit(pgpHashAlgo hashalgo, rpmDigestFlags flags) { - DIGEST_CTX ctx = ctxGetPool(_ctxPool); + DIGEST_CTX ctx = rpmctxGetPool(_rpmctxPool); int xx; ctx->name = ""; @@ -270,292 +249,192 @@ ctx->param = NULL; ctx->salt = NULL; +#define RPMDIGEST_INIT(XY, NAME, DIGESTBITS, BLOCKBITS) \ +{ ctx->name = #NAME; \ + ctx->digestsize = DIGESTBITS/8; \ + ctx->blocksize = BLOCKBITS; \ + ctx->paramsize = sizeof(XY##Param); \ + ctx->param = DRD_xcalloc(1, ctx->paramsize); \ + ctx->Reset = (int (*)(void *)) XY##Reset; \ + ctx->Update = (int (*)(void *, const byte *, size_t)) XY##Update; \ + ctx->Digest = (int (*)(void *, byte *)) XY##Digest; \ +} + +#define RPMDIGEST_INIT_FAMILY(XY, NAME) \ + case PGPHASHALGO_##NAME##_224: \ + RPMDIGEST_INIT(XY, #NAME-224, 224, 64) \ + goto XY; \ + case PGPHASHALGO_##NAME##_256: \ + RPMDIGEST_INIT(XY, #NAME-256, 256, 64) \ + goto XY; \ + case PGPHASHALGO_##NAME##_384: \ + RPMDIGEST_INIT(XY, #NAME-384, 384, 64) \ + goto XY; \ + case PGPHASHALGO_##NAME##_512: \ + RPMDIGEST_INIT(XY, #NAME-512, 512, 64) \ + goto XY; \ +XY: + + /* iso.identified-organization.dod.internet.private.enterprise.36106 */ + /* 1.3.6.1.4.1.36106 */ + /* enterprise(1).wraptastic(36106).hash(2).XX */ + /* 06 09 2B 06 01 04 01 82 9A 0A 02 XX */ + switch (hashalgo) { case PGPHASHALGO_MD5: - ctx->name = "MD5"; - ctx->digestsize = 128/8; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(md5Param); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); -/*@-type@*/ - ctx->Reset = (int (*)(void *)) md5Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) md5Update; - ctx->Digest = (int (*)(void *, byte *)) md5Digest; -/*@=type@*/ - ctx->asn1 = "3020300c06082a864886f70d020505000410"; + RPMDIGEST_INIT(md5, MD5, 128, 64) + /* Object ID is 1.2.840.113549.2.5 */ + ctx->asn1 = "3020300c" "06082a864886f70d0205" "05000410"; + /* iso.member-body.us.rsadsi.pkcs.pkcs-1.4 (md5WithRSAEncryption) */ + /* 1.2.840.113549.1.1.4 */ + /* RSADSI digestAlgorithm MD5 */ + /* 1.2.840.113549.2.5 */ break; case PGPHASHALGO_SHA1: - ctx->name = "SHA1"; - ctx->digestsize = 160/8; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(sha1Param); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); -/*@-type@*/ - ctx->Reset = (int (*)(void *)) sha1Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) sha1Update; - ctx->Digest = (int (*)(void *, byte *)) sha1Digest; -/*@=type@*/ - ctx->asn1 = "3021300906052b0e03021a05000414"; + RPMDIGEST_INIT(sha1, SHA1, 160, 64) + /* Object ID is 1.3.14.3.2.26 */ + ctx->asn1 = "30213009" "06052b0e03021a" "05000414"; + /* iso.member-body.us.rsadsi.pkcs.pkcs-1.5 (sha1WithRSAEncryption) */ + /* 1.2.840.113549.1.1.5 */ + /* iso.member-body.us.x9-57.x9cm.3 (dsaWithSha1)*/ + /* 1.2.840.10040.4.3 */ + /* from NIST's OIW (sha1) */ + /* 1.3.14.3.2.26 */ + /* from NIST OIW (sha-1WithRSAEncryption) */ + /* 1.3.14.3.2.29 */ + /* iso.member-body.us.ansi-x9-62.signatures.ecdsa-with-sha1 */ + /* 1.2.840.10045.4.1 */ break; case PGPHASHALGO_RIPEMD128: - ctx->name = "RIPEMD128"; - ctx->digestsize = 128/8; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(ripemd128Param); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); -/*@-type@*/ - ctx->Reset = (int (*)(void *)) ripemd128Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) ripemd128Update; - ctx->Digest = (int (*)(void *, byte *)) ripemd128Digest; -/*@=type@*/ + RPMDIGEST_INIT(ripemd128, RIPEMD128, 128, 64) + /* Object ID is 1.3.6.1.4.1.36106.2.105 */ + ctx->asn1 = "3022300c" "060A2B06010401829A0A0269" "05000410"; break; case PGPHASHALGO_RIPEMD160: - ctx->name = "RIPEMD160"; - ctx->digestsize = 160/8; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(ripemd160Param); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); -/*@-type@*/ - ctx->Reset = (int (*)(void *)) ripemd160Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) ripemd160Update; - ctx->Digest = (int (*)(void *, byte *)) ripemd160Digest; -/*@=type@*/ - ctx->asn1 = "3021300906052b2403020105000414"; + RPMDIGEST_INIT(ripemd160, RIPEMD160, 160, 64) + /* Object ID is 1.3.36.3.2.1 */ + ctx->asn1 = "30213009" "06052b24030201" "05000414"; + /* rsaSignatureWithripemd160 */ + /* 1.3.36.3.3.1.2 */ + /* TeleTrust hash algorithm. */ + /* 1.3.36.3.2.1 */ break; case PGPHASHALGO_RIPEMD256: - ctx->name = "RIPEMD256"; - ctx->digestsize = 256/8; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(ripemd256Param); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); -/*@-type@*/ - ctx->Reset = (int (*)(void *)) ripemd256Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) ripemd256Update; - ctx->Digest = (int (*)(void *, byte *)) ripemd256Digest; -/*@=type@*/ + RPMDIGEST_INIT(ripemd256, RIPEMD256, 256, 64) + /* Object ID is 1.3.6.1.4.1.36106.2.111 */ + ctx->asn1 = "3032300c" "060A2B06010401829A0A026F" "05000420"; break; case PGPHASHALGO_RIPEMD320: - ctx->name = "RIPEMD320"; - ctx->digestsize = 320/8; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(ripemd320Param); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); -/*@-type@*/ - ctx->Reset = (int (*)(void *)) ripemd320Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) ripemd320Update; - ctx->Digest = (int (*)(void *, byte *)) ripemd320Digest; -/*@=type@*/ + RPMDIGEST_INIT(ripemd320, RIPEMD320, 320, 64) + /* Object ID is 1.3.6.1.4.1.36106.2.112 */ + ctx->asn1 = "303A300c" "060A2B06010401829A0A0270" "05000428"; break; case PGPHASHALGO_SALSA10: - ctx->name = "SALSA10"; - ctx->digestsize = 512/8; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(salsa10Param); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); -/*@-type@*/ - ctx->Reset = (int (*)(void *)) salsa10Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) salsa10Update; - ctx->Digest = (int (*)(void *, byte *)) salsa10Digest; -/*@=type@*/ + RPMDIGEST_INIT(salsa10, SALSA10, 512, 64) + /* Object ID is 1.3.6.1.4.1.36106.2.113 */ + ctx->asn1 = "3052300C" "060A2B06010401829A0A0271" "05000440"; break; case PGPHASHALGO_SALSA20: - ctx->name = "SALSA20"; - ctx->digestsize = 512/8; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(salsa20Param); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); -/*@-type@*/ - ctx->Reset = (int (*)(void *)) salsa20Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) salsa20Update; - ctx->Digest = (int (*)(void *, byte *)) salsa20Digest; -/*@=type@*/ + RPMDIGEST_INIT(salsa20, SALSA20, 512, 64) + /* Object ID is 1.3.6.1.4.1.36106.2.114 */ + ctx->asn1 = "3052300C" "060A2B06010401829A0A0272" "05000440"; break; case PGPHASHALGO_TIGER192: - ctx->name = "TIGER192"; - ctx->digestsize = 192/8; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(tigerParam); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); -/*@-type@*/ - ctx->Reset = (int (*)(void *)) tigerReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) tigerUpdate; - ctx->Digest = (int (*)(void *, byte *)) tigerDigest; -/*@=type@*/ - ctx->asn1 = "3029300d06092b06010401da470c0205000418"; + /* XXX TIGER2 has different padding */ + RPMDIGEST_INIT(tiger, TIGER192, 192, 64) + /* Object ID is 1.3.6.1.4.1.11591.12.2 */ + ctx->asn1 = "3029300d" "06092b06010401da470c02" "05000418"; + /* GNU.digestAlgorithm TIGER */ + /* 1.3.6.1.4.1.11591.12.2 */ break; case PGPHASHALGO_MD2: - ctx->name = "MD2"; - ctx->digestsize = 128/8; - ctx->blocksize = 16; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(md2Param); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); -/*@-type@*/ - ctx->Reset = (int (*)(void *)) md2Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) md2Update; - ctx->Digest = (int (*)(void *, byte *)) md2Digest; -/*@=type@*/ - ctx->asn1 = "3020300c06082a864886f70d020205000410"; + RPMDIGEST_INIT(md2, MD2, 128, 16) + /* Object ID is 1.2.840.113549.2.2 */ + ctx->asn1 = "3020300c" "06082a864886f70d0202" "05000410"; + /* iso.member-body.us.rsadsi.digestAlgorithm.md2 */ + /* 1.2.840.113549.2.2 */ break; case PGPHASHALGO_MD4: - ctx->name = "MD4"; - ctx->digestsize = 128/8; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(md4Param); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); -/*@-type@*/ - ctx->Reset = (int (*)(void *)) md4Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) md4Update; - ctx->Digest = (int (*)(void *, byte *)) md4Digest; -/*@=type@*/ + RPMDIGEST_INIT(md4, MD4, 128, 64) + /* Object ID is 1.2.840.113549.2.4 */ + ctx->asn1 = "3020300c" "06082a864886f70d0204" "05000410"; + /* iso.member-body.us.rsadsi.digestAlgorithm.md4 */ + /* 1.2.840.113549.2.4 */ break; case PGPHASHALGO_CRC32: - ctx->name = "CRC32"; - ctx->digestsize = 32/8; - ctx->blocksize = 8; - { sum32Param * mp = (sum32Param *) DRD_xcalloc(1, sizeof(*mp)); -/*@-type @*/ + RPMDIGEST_INIT(sum32, CRC32, 32, 8) + { sum32Param * mp = (sum32Param *) ctx->param; mp->update = (rpmuint32_t (*)(rpmuint32_t, const byte *, size_t)) __crc32; mp->combine = (rpmuint32_t (*)(rpmuint32_t, rpmuint32_t, size_t)) __crc32_combine; -/*@=type @*/ - ctx->paramsize = sizeof(*mp); - ctx->param = mp; } -/*@-type@*/ - ctx->Reset = (int (*)(void *)) sum32Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) sum32Update; - ctx->Digest = (int (*)(void *, byte *)) sum32Digest; -/*@=type@*/ + /* Object ID is 1.3.6.1.4.1.36106.2.?? */ + /* ctx->asn1 = "???" "060A2B06010401829A0A02??" "05000404"; */ break; case PGPHASHALGO_ADLER32: - ctx->name = "ADLER32"; - ctx->digestsize = 32/8; - ctx->blocksize = 8; - { sum32Param * mp = (sum32Param *) DRD_xcalloc(1, sizeof(*mp)); -/*@-type @*/ + RPMDIGEST_INIT(sum32, ADLER32, 32, 8) + { sum32Param * mp = (sum32Param *) ctx->param; mp->update = (rpmuint32_t (*)(rpmuint32_t, const byte *, size_t)) __adler32; mp->combine = (rpmuint32_t (*)(rpmuint32_t, rpmuint32_t, size_t)) __adler32_combine; -/*@=type @*/ - ctx->paramsize = sizeof(*mp); - ctx->param = mp; } -/*@-type@*/ - ctx->Reset = (int (*)(void *)) sum32Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) sum32Update; - ctx->Digest = (int (*)(void *, byte *)) sum32Digest; -/*@=type@*/ + /* Object ID is 1.3.6.1.4.1.36106.2.?? */ + /* ctx->asn1 = "???" "060A2B06010401829A0A02??" "05000404"; */ break; case PGPHASHALGO_JLU32: - ctx->name = "JLU32"; - ctx->digestsize = 32/8; - ctx->blocksize = 8; - { sum32Param * mp = (sum32Param *) DRD_xcalloc(1, sizeof(*mp)); -/*@-type @*/ + RPMDIGEST_INIT(sum32, ADLER32, 32, 8) + { sum32Param * mp = (sum32Param *) ctx->param; mp->update = (rpmuint32_t (*)(rpmuint32_t, const byte *, size_t)) jlu32l; -/*@=type @*/ - ctx->paramsize = sizeof(*mp); - ctx->param = mp; } -/*@-type@*/ - ctx->Reset = (int (*)(void *)) sum32Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) sum32Update; - ctx->Digest = (int (*)(void *, byte *)) sum32Digest; -/*@=type@*/ + /* Object ID is 1.3.6.1.4.1.36106.2.?? */ + /* ctx->asn1 = "???" "060A2B06010401829A0A02??" "05000404"; */ break; case PGPHASHALGO_CRC64: - ctx->name = "CRC64"; - ctx->digestsize = 64/8; - ctx->blocksize = 8; - { sum64Param * mp = (sum64Param *) DRD_xcalloc(1, sizeof(*mp)); -/*@-type@*/ + RPMDIGEST_INIT(sum64, CRC64, 64, 8) + { sum64Param * mp = (sum64Param *) ctx->param; mp->update = (rpmuint64_t (*)(rpmuint64_t, const byte *, size_t)) __crc64; mp->combine = (rpmuint64_t (*)(rpmuint64_t, rpmuint64_t, size_t)) __crc64_combine; -/*@=type@*/ - ctx->paramsize = sizeof(*mp); - ctx->param = mp; } -/*@-type@*/ - ctx->Reset = (int (*)(void *)) sum64Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) sum64Update; - ctx->Digest = (int (*)(void *, byte *)) sum64Digest; -/*@=type@*/ + /* Object ID is 1.3.6.1.4.1.36106.2.?? */ + /* ctx->asn1 = "???" "060A2B06010401829A0A02??" "05000408"; */ break; case PGPHASHALGO_SHA224: - ctx->name = "SHA224"; - ctx->digestsize = 224/8; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(sha224Param); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); -/*@-type@*/ - ctx->Reset = (int (*)(void *)) sha224Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) sha224Update; - ctx->Digest = (int (*)(void *, byte *)) sha224Digest; -/*@=type@*/ - ctx->asn1 = "302d300d06096086480165030402040500041C"; + RPMDIGEST_INIT(sha224, SHA224, 224, 64) + /* Object ID is 2.16.840.1.101.3.4.2.4 */ + ctx->asn1 = "302d300d" "0609608648016503040204" "0500041C"; + /* From RFC3874, Section 4 */ + /* 2.16.840.1.101.3.4.2.4 */ break; case PGPHASHALGO_SHA256: - ctx->name = "SHA256"; - ctx->digestsize = 256/8; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(sha256Param); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); -/*@-type@*/ - ctx->Reset = (int (*)(void *)) sha256Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) sha256Update; - ctx->Digest = (int (*)(void *, byte *)) sha256Digest; -/*@=type@*/ - ctx->asn1 = "3031300d060960864801650304020105000420"; + RPMDIGEST_INIT(sha256, SHA256, 256, 64) + /* Object ID is 2.16.840.1.101.3.4.2.1 */ + ctx->asn1 = "3031300d" "0609608648016503040201" "05000420"; + /* According to the OpenPGP draft rfc2440-bis06 */ + /* 2.16.840.1.101.3.4.2.1 */ + /* PKCS#1 sha256WithRSAEncryption */ + /* 1.2.840.113549.1.1.11 */ break; case PGPHASHALGO_SHA384: - ctx->name = "SHA384"; - ctx->digestsize = 384/8; - ctx->blocksize = 128; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(sha384Param); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); -/*@-type@*/ - ctx->Reset = (int (*)(void *)) sha384Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) sha384Update; - ctx->Digest = (int (*)(void *, byte *)) sha384Digest; -/*@=type@*/ - ctx->asn1 = "3041300d060960864801650304020205000430"; + RPMDIGEST_INIT(sha384, SHA384, 384, 128) + /* Object ID is 2.16.840.1.101.3.4.2.2 */ + ctx->asn1 = "3041300d" "0609608648016503040202" "05000430"; + /* ??? */ + /* 2.16.840.1.101.3.4.2.2 */ + /* PKCS#1 sha384WithRSAEncryption */ + /* 1.2.840.113549.1.1.12 */ break; case PGPHASHALGO_SHA512: - ctx->name = "SHA512"; - ctx->digestsize = 512/8; - ctx->blocksize = 128; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(sha512Param); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); -/*@-type@*/ - ctx->Reset = (int (*)(void *)) sha512Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) sha512Update; - ctx->Digest = (int (*)(void *, byte *)) sha512Digest; -/*@=type@*/ - ctx->asn1 = "3051300d060960864801650304020305000440"; + RPMDIGEST_INIT(sha512, SHA512, 512, 128) + /* Object ID is 2.16.840.1.101.3.4.2.3 */ + ctx->asn1 = "3051300d" "0609608648016503040203" "05000440"; + /* ??? */ + /* 2.16.840.1.101.3.4.2.3 */ + /* PKCS#1 sha512WithRSAEncryption */ + /* 1.2.840.113549.1.1.13 */ break; case PGPHASHALGO_SKEIN_224: ctx->digestsize = 224/8; goto skein256; case PGPHASHALGO_SKEIN_256: ctx->digestsize = 256/8; goto skein256; skein256: ctx->name = "SKEIN256"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ ctx->paramsize = sizeof(Skein_256_Ctxt_t); -/*@=sizeoftype@*/ ctx->param = DRD_xcalloc(1, ctx->paramsize); (void) Skein_256_Init((Skein_256_Ctxt_t *)ctx->param, (int)(8 * ctx->digestsize)); @@ -567,9 +446,7 @@ case PGPHASHALGO_SKEIN_512: ctx->digestsize = 512/8; goto skein512; skein512: ctx->name = "SKEIN512"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ ctx->paramsize = sizeof(Skein_512_Ctxt_t); -/*@=sizeoftype@*/ ctx->param = DRD_xcalloc(1, ctx->paramsize); (void) Skein_512_Init((Skein_512_Ctxt_t *)ctx->param, (int)(8 * ctx->digestsize)); @@ -580,9 +457,7 @@ case PGPHASHALGO_SKEIN_1024: ctx->name = "SKEIN1024"; ctx->digestsize = 1024/8; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ ctx->paramsize = sizeof(Skein1024_Ctxt_t); -/*@=sizeoftype@*/ ctx->param = DRD_xcalloc(1, ctx->paramsize); (void) Skein1024_Init((Skein1024_Ctxt_t *)ctx->param, (int)(8 * ctx->digestsize)); @@ -590,290 +465,249 @@ ctx->Update = (int (*)(void *, const byte *, size_t)) Skein1024_Update; ctx->Digest = (int (*)(void *, byte *)) Skein1024_Final; break; - case PGPHASHALGO_ARIRANG_224: ctx->digestsize = 224/8; goto arirang; - case PGPHASHALGO_ARIRANG_256: ctx->digestsize = 256/8; goto arirang; - case PGPHASHALGO_ARIRANG_384: ctx->digestsize = 384/8; goto arirang; - case PGPHASHALGO_ARIRANG_512: ctx->digestsize = 512/8; goto arirang; -arirang: - ctx->name = "ARIRANG"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(arirangParam); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + + /* Object ID is 1.3.6.1.4.1.36106.2.208+{0,1,2,3} */ + RPMDIGEST_INIT_FAMILY(arirang, ARIRANG) (void) arirangInit((arirangParam *)ctx->param, (int)(8 * ctx->digestsize)); - ctx->Reset = (int (*)(void *)) arirangReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) arirangUpdate; - ctx->Digest = (int (*)(void *, byte *)) arirangDigest; - break; - case PGPHASHALGO_BLAKE_224: ctx->digestsize = 224/8; goto blake; - case PGPHASHALGO_BLAKE_256: ctx->digestsize = 256/8; goto blake; - case PGPHASHALGO_BLAKE_384: ctx->digestsize = 384/8; goto blake; - case PGPHASHALGO_BLAKE_512: ctx->digestsize = 512/8; goto blake; -blake: - ctx->name = "BLAKE"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(blakeParam); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + break; + + /* Object ID is 1.3.6.1.4.1.36106.2.184+{0,1,2,3} */ + /* ctx->asn1 = "???" "060B2B06010401829A0A028138" "0500041c"; */ + RPMDIGEST_INIT_FAMILY(blake, BLAKE) (void) blakeInit((blakeParam *)ctx->param, (int)(8 * ctx->digestsize)); - ctx->Reset = (int (*)(void *)) blakeReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) blakeUpdate; - ctx->Digest = (int (*)(void *, byte *)) blakeDigest; break; + case PGPHASHALGO_BLAKE2B: - ctx->name = "BLAKE2B"; - ctx->blocksize = 8 * BLAKE2B_BLOCKBYTES; - ctx->digestsize = BLAKE2B_OUTBYTES; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(blake2bParam); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + RPMDIGEST_INIT(blake2b, BLAKE2B, 8*BLAKE2B_OUTBYTES, 8*BLAKE2B_BLOCKBYTES) (void) blake2bInit((blake2bParam *)ctx->param, (int)(8 * ctx->digestsize)); - ctx->Reset = (int (*)(void *)) blake2bReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) blake2bUpdate; - ctx->Digest = (int (*)(void *, byte *)) blake2bDigest; + /* Object ID is 1.3.6.1.4.1.36106.2.188 */ + ctx->asn1 = "3033300D" "060B2B06010401829A0A02813C" "05000420"; break; case PGPHASHALGO_BLAKE2BP: - ctx->name = "BLAKE2BP"; - ctx->blocksize = 8 * BLAKE2B_BLOCKBYTES; - ctx->digestsize = BLAKE2B_OUTBYTES; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(blake2bpParam); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + RPMDIGEST_INIT(blake2bp, BLAKE2BP, 8*BLAKE2B_OUTBYTES, 8*BLAKE2B_BLOCKBYTES) (void) blake2bpInit((blake2bpParam *)ctx->param, (int)(8 * ctx->digestsize)); - ctx->Reset = (int (*)(void *)) blake2bpReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) blake2bpUpdate; - ctx->Digest = (int (*)(void *, byte *)) blake2bpDigest; + /* Object ID is 1.3.6.1.4.1.36106.2.189 */ + ctx->asn1 = "3033300D" "060B2B06010401829A0A02813D" "05000420"; break; case PGPHASHALGO_BLAKE2S: - ctx->name = "BLAKE2S"; - ctx->blocksize = 8 * BLAKE2S_BLOCKBYTES; - ctx->digestsize = BLAKE2S_OUTBYTES; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(blake2sParam); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + RPMDIGEST_INIT(blake2s, BLAKE2S, 8*BLAKE2S_OUTBYTES, 8*BLAKE2S_BLOCKBYTES) (void) blake2sInit((blake2sParam *)ctx->param, (int)(8 * ctx->digestsize)); - ctx->Reset = (int (*)(void *)) blake2sReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) blake2sUpdate; - ctx->Digest = (int (*)(void *, byte *)) blake2sDigest; + /* Object ID is 1.3.6.1.4.1.36106.2.190 */ + ctx->asn1 = "3033300D" "060B2B06010401829A0A02813E" "05000420"; break; case PGPHASHALGO_BLAKE2SP: - ctx->name = "BLAKE2SP"; - ctx->blocksize = 8 * BLAKE2S_BLOCKBYTES; - ctx->digestsize = BLAKE2S_OUTBYTES; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(blake2spParam); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + RPMDIGEST_INIT(blake2sp, BLAKE2SP, 8*BLAKE2S_OUTBYTES, 8*BLAKE2S_BLOCKBYTES) (void) blake2spInit((blake2spParam *)ctx->param, (int)(8 * ctx->digestsize)); - ctx->Reset = (int (*)(void *)) blake2spReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) blake2spUpdate; - ctx->Digest = (int (*)(void *, byte *)) blake2spDigest; - break; - case PGPHASHALGO_BMW_224: ctx->digestsize = 224/8; goto bmw; - case PGPHASHALGO_BMW_256: ctx->digestsize = 256/8; goto bmw; - case PGPHASHALGO_BMW_384: ctx->digestsize = 384/8; goto bmw; - case PGPHASHALGO_BMW_512: ctx->digestsize = 512/8; goto bmw; -bmw: - ctx->name = "BMW"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(bmwParam); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + /* Object ID is 1.3.6.1.4.1.36106.2.191 */ + ctx->asn1 = "3033300D" "060B2B06010401829A0A02813F" "05000420"; + break; + + /* Object ID is 1.3.6.1.4.1.36106.2.168+{0,1,2,3} */ + RPMDIGEST_INIT_FAMILY(bmw, BMW) (void) bmwInit((bmwParam *)ctx->param, (int)(8 * ctx->digestsize)); - ctx->Reset = (int (*)(void *)) bmwReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) bmwUpdate; - ctx->Digest = (int (*)(void *, byte *)) bmwDigest; - break; - case PGPHASHALGO_CHI_224: ctx->digestsize = 224/8; goto chi; - case PGPHASHALGO_CHI_256: ctx->digestsize = 256/8; goto chi; - case PGPHASHALGO_CHI_384: ctx->digestsize = 384/8; goto chi; - case PGPHASHALGO_CHI_512: ctx->digestsize = 512/8; goto chi; -chi: - ctx->name = "CHI"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(chiParam); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + break; + + /* Object ID is 1.3.6.1.4.1.36106.2.224+{0,1,2,3} */ + RPMDIGEST_INIT_FAMILY(chi, CHI) (void) chiInit((chiParam *)ctx->param, (int)(8 * ctx->digestsize)); - ctx->Reset = (int (*)(void *)) chiReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) chiUpdate; - ctx->Digest = (int (*)(void *, byte *)) chiDigest; - break; - case PGPHASHALGO_CUBEHASH_224: ctx->digestsize = 224/8; goto cubehash; - case PGPHASHALGO_CUBEHASH_256: ctx->digestsize = 256/8; goto cubehash; - case PGPHASHALGO_CUBEHASH_384: ctx->digestsize = 384/8; goto cubehash; - case PGPHASHALGO_CUBEHASH_512: ctx->digestsize = 512/8; goto cubehash; -cubehash: - ctx->name = "CUBEHASH"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(cubehashParam); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + break; + + /* Object ID is 1.3.6.1.4.1.36106.2.136+{0,1,2,3} */ + RPMDIGEST_INIT_FAMILY(cubehash, CUBEHASH) (void) cubehashInit((cubehashParam *)ctx->param, (int)(8 * ctx->digestsize), (int)((ctx->flags >> 8) & 0xff), (int)((ctx->flags ) & 0xff)); - ctx->Reset = (int (*)(void *)) cubehashReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) cubehashUpdate; - ctx->Digest = (int (*)(void *, byte *)) cubehashDigest; - break; - case PGPHASHALGO_ECHO_224: ctx->digestsize = 224/8; goto echo; - case PGPHASHALGO_ECHO_256: ctx->digestsize = 256/8; goto echo; - case PGPHASHALGO_ECHO_384: ctx->digestsize = 384/8; goto echo; - case PGPHASHALGO_ECHO_512: ctx->digestsize = 512/8; goto echo; + break; + + case PGPHASHALGO_ECHO_224: + ctx->digestsize = 224/8; + goto echo; + case PGPHASHALGO_ECHO_256: + ctx->digestsize = 256/8; + goto echo; + case PGPHASHALGO_ECHO_384: + ctx->digestsize = 384/8; + goto echo; + case PGPHASHALGO_ECHO_512: + ctx->digestsize = 512/8; + goto echo; echo: ctx->name = "ECHO"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ ctx->paramsize = sizeof(echo_hashState); -/*@=sizeoftype@*/ ctx->param = DRD_xcalloc(1, ctx->paramsize); - (void) echo_Init((echo_hashState *)ctx->param, - (int)(8 * ctx->digestsize)); ctx->Reset = (int (*)(void *)) noopReset; ctx->Update = (int (*)(void *, const byte *, size_t)) _echo_Update; ctx->Digest = (int (*)(void *, byte *)) echo_Final; + (void) echo_Init((echo_hashState *)ctx->param, + (int)(8 * ctx->digestsize)); break; + #ifndef CLANG_ASAN_COMPILES_SLOWLY - case PGPHASHALGO_EDONR_224: ctx->digestsize = 224/8; goto edonr; - case PGPHASHALGO_EDONR_256: ctx->digestsize = 256/8; goto edonr; - case PGPHASHALGO_EDONR_384: ctx->digestsize = 384/8; goto edonr; - case PGPHASHALGO_EDONR_512: ctx->digestsize = 512/8; goto edonr; + case PGPHASHALGO_EDONR_224: + ctx->digestsize = 224/8; + goto edonr; + case PGPHASHALGO_EDONR_256: + ctx->digestsize = 256/8; + goto edonr; + case PGPHASHALGO_EDONR_384: + ctx->digestsize = 384/8; + goto edonr; + case PGPHASHALGO_EDONR_512: + ctx->digestsize = 512/8; + goto edonr; edonr: ctx->name = "EDON-R"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ ctx->paramsize = sizeof(edonr_hashState); -/*@=sizeoftype@*/ ctx->param = DRD_xcalloc(1, ctx->paramsize); - (void) edonr_Init((edonr_hashState *)ctx->param, - (int)(8 * ctx->digestsize)); ctx->Reset = (int (*)(void *)) noopReset; ctx->Update = (int (*)(void *, const byte *, size_t)) edonr_Update; ctx->Digest = (int (*)(void *, byte *)) edonr_Final; + (void) edonr_Init((edonr_hashState *)ctx->param, + (int)(8 * ctx->digestsize)); break; #endif - case PGPHASHALGO_FUGUE_224: ctx->digestsize = 224/8; goto fugue; - case PGPHASHALGO_FUGUE_256: ctx->digestsize = 256/8; goto fugue; - case PGPHASHALGO_FUGUE_384: ctx->digestsize = 384/8; goto fugue; - case PGPHASHALGO_FUGUE_512: ctx->digestsize = 512/8; goto fugue; -fugue: - ctx->name = "FUGUE"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(fugueParam); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + + /* Object ID is 1.3.6.1.4.1.36106.2.156+{0,1,2,3| */ + RPMDIGEST_INIT_FAMILY(fugue, FUGUE) (void) fugueInit((fugueParam *)ctx->param, (int)(8 * ctx->digestsize)); - ctx->Reset = (int (*)(void *)) fugueReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) fugueUpdate; - ctx->Digest = (int (*)(void *, byte *)) fugueDigest; - break; - case PGPHASHALGO_GROESTL_224: ctx->digestsize = 224/8; goto groestl; - case PGPHASHALGO_GROESTL_256: ctx->digestsize = 256/8; goto groestl; - case PGPHASHALGO_GROESTL_384: ctx->digestsize = 384/8; goto groestl; - case PGPHASHALGO_GROESTL_512: ctx->digestsize = 512/8; goto groestl; + break; + + case PGPHASHALGO_GROESTL_224: + ctx->digestsize = 224/8; + goto groestl; + case PGPHASHALGO_GROESTL_256: + ctx->digestsize = 256/8; + goto groestl; + case PGPHASHALGO_GROESTL_384: + ctx->digestsize = 384/8; + goto groestl; + case PGPHASHALGO_GROESTL_512: + ctx->digestsize = 512/8; + goto groestl; groestl: ctx->name = "GROESTL"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ ctx->paramsize = sizeof(groestl_hashState); -/*@=sizeoftype@*/ ctx->param = DRD_xcalloc(1, ctx->paramsize); - (void) groestl_Init((groestl_hashState *)ctx->param, - (int)(8 * ctx->digestsize)); ctx->Reset = (int (*)(void *)) noopReset; ctx->Update = (int (*)(void *, const byte *, size_t)) _groestl_Update; ctx->Digest = (int (*)(void *, byte *)) groestl_Final; + (void) groestl_Init((groestl_hashState *)ctx->param, + (int)(8 * ctx->digestsize)); break; - case PGPHASHALGO_HAMSI_224: ctx->digestsize = 224/8; goto hamsi; - case PGPHASHALGO_HAMSI_256: ctx->digestsize = 256/8; goto hamsi; - case PGPHASHALGO_HAMSI_384: ctx->digestsize = 384/8; goto hamsi; - case PGPHASHALGO_HAMSI_512: ctx->digestsize = 512/8; goto hamsi; -hamsi: - ctx->name = "HAMSI"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(hamsiParam); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + + /* Object ID is 1.3.6.1.4.1.36106.2.248+{0,1,2,3| */ + RPMDIGEST_INIT_FAMILY(hamsi, HAMSI) (void) hamsiInit((hamsiParam *)ctx->param, (int)(8 * ctx->digestsize)); - ctx->Reset = (int (*)(void *)) hamsiReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) hamsiUpdate; - ctx->Digest = (int (*)(void *, byte *)) hamsiDigest; - break; - case PGPHASHALGO_JH_224: ctx->digestsize = 224/8; goto jh; - case PGPHASHALGO_JH_256: ctx->digestsize = 256/8; goto jh; - case PGPHASHALGO_JH_384: ctx->digestsize = 384/8; goto jh; - case PGPHASHALGO_JH_512: ctx->digestsize = 512/8; goto jh; -jh: - ctx->name = "JH"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(jhParam); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + break; + + /* Object ID is 1.3.6.1.4.1.36106.2.232+{0,1,2,3| */ + RPMDIGEST_INIT_FAMILY(jh, JH) (void) jhInit((jhParam *)ctx->param, (int)(8 * ctx->digestsize)); - ctx->Reset = (int (*)(void *)) jhReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) jhUpdate; - ctx->Digest = (int (*)(void *, byte *)) jhDigest; - break; - case PGPHASHALGO_KECCAK_224: ctx->digestsize = 224/8; goto keccak; - case PGPHASHALGO_KECCAK_256: ctx->digestsize = 256/8; goto keccak; - case PGPHASHALGO_KECCAK_384: ctx->digestsize = 384/8; goto keccak; - case PGPHASHALGO_KECCAK_512: ctx->digestsize = 512/8; goto keccak; + break; + +#ifdef REF + case GOSTR3411_CP: + /* Object ID is 1.2.643.2.2.3 */ + /* ctx->asn1 = "???" "06062A8503020203" "???"; */ + ctx->asn1 = "2a8503020203"; /* XXX bogus in libgcrypt */ + /* iso.member-body.ru.rans.cryptopro.3 (gostR3411-94-with-gostR3410-2001) */ + /* 1.2.643.2.2.3 */ + /* iso.member-body.ru.rans.cryptopro.9 (gostR3411-94) */ + /* 1.2.643.2.2.9 */ + break; +#endif + case PGPHASHALGO_KECCAK_224: + ctx->digestsize = 224/8; + /* ctx->asn1 = "???" "0609608648016503040207" "0500041C"; */ + /* joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) hashAlgs(2) 7 */ + /* 2.16.840.1.101.3.4.2.7 */ + /* PKCS#1 sha3_224WithRSAEncryption */ + /* ? */ + goto keccak; + case PGPHASHALGO_KECCAK_256: + ctx->digestsize = 256/8; + /* ctx->asn1 = "???" "0609608648016503040208" "05000420"; */ + /* joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) hashAlgs(2) 8 */ + /* 2.16.840.1.101.3.4.2.8 */ + /* PKCS#1 sha3_256WithRSAEncryption */ + /* ? */ + goto keccak; + case PGPHASHALGO_KECCAK_384: + ctx->digestsize = 384/8; + /* ctx->asn1 = "???" "0609608648016503040209" "05000430"; */ + /* joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) hashAlgs(2) 9 */ + /* 2.16.840.1.101.3.4.2.9 */ + /* PKCS#1 sha3_384WithRSAEncryption */ + /* ? */ + goto keccak; + case PGPHASHALGO_KECCAK_512: + ctx->digestsize = 512/8; + /* ctx->asn1 = "???" "060960864801650304020a" "05000440"; */ + /* joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) hashAlgs(2) 10 */ + /* 2.16.840.1.101.3.4.2.10 */ + /* PKCS#1 sha3_512WithRSAEncryption */ + /* ? */ + goto keccak; +#ifdef REF + case SHAKE128: + /* ctx->asn1 = "???" "060960864801650304020b" "05000410"; */ + /* joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) hashAlgs(2) 11 */ + /* 2.16.840.1.101.3.4.2.11 */ + /* PKCS#1 shake128WithRSAEncryption */ + /* ? */ + break; + case SHAKE256: + /* ctx->asn1 = "???" "060960864801650304020c" "05000420"; */ + /* joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) hashAlgs(2) 12 */ + /* 2.16.840.1.101.3.4.2.12 */ + /* PKCS#1 shake256WithRSAEncryption */ + /* ? */ + break; +#endif keccak: ctx->name = "KECCAK"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ ctx->paramsize = sizeof(keccak_hashState); -/*@=sizeoftype@*/ ctx->param = DRD_xcalloc(1, ctx->paramsize); - (void) keccak_Init((keccak_hashState *)ctx->param, - (int)(8 * ctx->digestsize)); ctx->Reset = (int (*)(void *)) noopReset; ctx->Update = (int (*)(void *, const byte *, size_t)) _keccak_Update; ctx->Digest = (int (*)(void *, byte *)) keccak_Final; + (void) keccak_Init((keccak_hashState *)ctx->param, + (int)(8 * ctx->digestsize)); break; + #ifndef CLANG_ASAN_COMPILES_SLOWLY - case PGPHASHALGO_LANE_224: ctx->digestsize = 224/8; goto lane; - case PGPHASHALGO_LANE_256: ctx->digestsize = 256/8; goto lane; - case PGPHASHALGO_LANE_384: ctx->digestsize = 384/8; goto lane; - case PGPHASHALGO_LANE_512: ctx->digestsize = 512/8; goto lane; -lane: - ctx->name = "LANE"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(laneParam); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + /* Object ID is 1.3.6.1.4.1.36106.2.212+{0,1,2,3| */ + RPMDIGEST_INIT_FAMILY(lane, LANE) (void) laneInit((laneParam *)ctx->param, (int)(8 * ctx->digestsize)); - ctx->Reset = (int (*)(void *)) laneReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) laneUpdate; - ctx->Digest = (int (*)(void *, byte *)) laneDigest; break; #endif + #ifndef CLANG_ASAN_COMPILES_SLOWLY - case PGPHASHALGO_LUFFA_224: ctx->digestsize = 224/8; goto luffa; - case PGPHASHALGO_LUFFA_256: ctx->digestsize = 256/8; goto luffa; - case PGPHASHALGO_LUFFA_384: ctx->digestsize = 384/8; goto luffa; - case PGPHASHALGO_LUFFA_512: ctx->digestsize = 512/8; goto luffa; -luffa: - ctx->name = "LUFFA"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(luffaParam); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + /* Object ID is 1.3.6.1.4.1.36106.2.216+{0,1,2,3| */ + RPMDIGEST_INIT_FAMILY(luffa, LUFFA) (void) luffaInit((luffaParam *)ctx->param, (int)(8 * ctx->digestsize)); - ctx->Reset = (int (*)(void *)) luffaReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) luffaUpdate; - ctx->Digest = (int (*)(void *, byte *)) luffaDigest; break; #endif - case PGPHASHALGO_MD6_224: ctx->digestsize = 224/8; goto md6; - case PGPHASHALGO_MD6_256: ctx->digestsize = 256/8; goto md6; - case PGPHASHALGO_MD6_384: ctx->digestsize = 384/8; goto md6; - case PGPHASHALGO_MD6_512: ctx->digestsize = 512/8; goto md6; + + case PGPHASHALGO_MD6_224: + ctx->digestsize = 224/8; + goto md6; + case PGPHASHALGO_MD6_256: + ctx->digestsize = 256/8; + goto md6; + case PGPHASHALGO_MD6_384: + ctx->digestsize = 384/8; + goto md6; + case PGPHASHALGO_MD6_512: + ctx->digestsize = 512/8; + goto md6; md6: ctx->name = "MD6"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ ctx->paramsize = sizeof(md6_state); -/*@=sizeoftype@*/ ctx->param = DRD_xcalloc(1, ctx->paramsize); + ctx->Reset = (int (*)(void *)) noopReset; + ctx->Update = (int (*)(void *, const byte *, size_t)) md6_Update; + ctx->Digest = (int (*)(void *, byte *)) md6_final; { int d = (8 * ctx->digestsize); /* no. of bits in digest */ int L = md6_default_L; /* no. of parallel passes */ unsigned char *K = NULL; /* key */ @@ -888,84 +722,59 @@ (void) md6_full_init((md6_state *)ctx->param, d, K, keylen, L, r); } - ctx->Reset = (int (*)(void *)) noopReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) md6_Update; - ctx->Digest = (int (*)(void *, byte *)) md6_final; break; - case PGPHASHALGO_RG32_256: ctx->digestsize = 256/8; - ctx->name = "RG32"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(rg32Param); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + case PGPHASHALGO_RG32_256: + RPMDIGEST_INIT(rg32, RG32, 256, 64) (void) rg32Init((rg32Param *)ctx->param, (int)(8 * ctx->digestsize)); - ctx->Reset = (int (*)(void *)) rg32Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) rg32Update; - ctx->Digest = (int (*)(void *, byte *)) rg32Digest; - break; - case PGPHASHALGO_RG64_256: ctx->digestsize = 256/8; - ctx->name = "RG64"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(rg64Param); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + /* Object ID is 1.3.6.1.4.1.36106.2.192 */ + ctx->asn1 = "3033300D" "060B2B06010401829A0A028140" "05000420"; + break; + case PGPHASHALGO_RG64_256: + RPMDIGEST_INIT(rg64, RG64, 256, 64) (void) rg64Init((rg64Param *)ctx->param, (int)(8 * ctx->digestsize)); - ctx->Reset = (int (*)(void *)) rg64Reset; - ctx->Update = (int (*)(void *, const byte *, size_t)) rg64Update; - ctx->Digest = (int (*)(void *, byte *)) rg64Digest; + /* Object ID is 1.3.6.1.4.1.36106.2.204 */ + ctx->asn1 = "3033300D" "060B2B06010401829A0A02814C" "05000420"; break; #ifdef NOTYET case PGPHASHALGO_SHABAL_192: ctx->digestsize = 192/8; goto shabal; #endif - case PGPHASHALGO_SHABAL_224: ctx->digestsize = 224/8; goto shabal; - case PGPHASHALGO_SHABAL_256: ctx->digestsize = 256/8; goto shabal; - case PGPHASHALGO_SHABAL_384: ctx->digestsize = 384/8; goto shabal; - case PGPHASHALGO_SHABAL_512: ctx->digestsize = 512/8; goto shabal; -shabal: - ctx->name = "SHABAL"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ - ctx->paramsize = sizeof(shabalParam); -/*@=sizeoftype@*/ - ctx->param = DRD_xcalloc(1, ctx->paramsize); + /* Object ID is 1.3.6.1.4.1.36106.2.176+{0,1,2,3| */ + RPMDIGEST_INIT_FAMILY(shabal, SHABAL) (void) shabalInit((shabalParam *)ctx->param, (int)(8 * ctx->digestsize)); - ctx->Reset = (int (*)(void *)) shabalReset; - ctx->Update = (int (*)(void *, const byte *, size_t)) shabalUpdate; - ctx->Digest = (int (*)(void *, byte *)) shabalDigest; break; + case PGPHASHALGO_SHAVITE3_224: ctx->digestsize = 224/8; goto shavite3; case PGPHASHALGO_SHAVITE3_256: ctx->digestsize = 256/8; goto shavite3; case PGPHASHALGO_SHAVITE3_384: ctx->digestsize = 384/8; goto shavite3; case PGPHASHALGO_SHAVITE3_512: ctx->digestsize = 512/8; goto shavite3; shavite3: ctx->name = "SHAVITE3"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ ctx->paramsize = sizeof(shavite3_hashState); -/*@=sizeoftype@*/ ctx->param = DRD_xcalloc(1, ctx->paramsize); - (void) shavite3_Init((shavite3_hashState *)ctx->param, - (int)(8 * ctx->digestsize)); ctx->Reset = (int (*)(void *)) noopReset; ctx->Update = (int (*)(void *, const byte *, size_t)) _shavite3_Update; ctx->Digest = (int (*)(void *, byte *)) shavite3_Final; + (void) shavite3_Init((shavite3_hashState *)ctx->param, + (int)(8 * ctx->digestsize)); break; + case PGPHASHALGO_SIMD_224: ctx->digestsize = 224/8; goto simd; case PGPHASHALGO_SIMD_256: ctx->digestsize = 256/8; goto simd; case PGPHASHALGO_SIMD_384: ctx->digestsize = 384/8; goto simd; case PGPHASHALGO_SIMD_512: ctx->digestsize = 512/8; goto simd; simd: ctx->name = "SIMD"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ ctx->paramsize = sizeof(simd_hashState); -/*@=sizeoftype@*/ ctx->param = DRD_xcalloc(1, ctx->paramsize); - (void) simd_Init((simd_hashState *)ctx->param, - (int)(8 * ctx->digestsize)); ctx->Reset = (int (*)(void *)) noopReset; ctx->Update = (int (*)(void *, const byte *, size_t)) _simd_Update; ctx->Digest = (int (*)(void *, byte *)) simd_Final; + (void) simd_Init((simd_hashState *)ctx->param, + (int)(8 * ctx->digestsize)); break; + #ifndef CLANG_ASAN_COMPILES_SLOWLY case PGPHASHALGO_TIB3_224: ctx->digestsize = 224/8; goto tib3; case PGPHASHALGO_TIB3_256: ctx->digestsize = 256/8; goto tib3; @@ -973,22 +782,21 @@ case PGPHASHALGO_TIB3_512: ctx->digestsize = 512/8; goto tib3; tib3: ctx->name = "TIB3"; -/*@-sizeoftype@*/ /* FIX: union, not void pointer */ ctx->paramsize = sizeof(tib3_hashState); -/*@=sizeoftype@*/ ctx->param = DRD_xcalloc(1, ctx->paramsize); - (void) tib3_Init((tib3_hashState *)ctx->param, - (int)(8 * ctx->digestsize)); ctx->Reset = (int (*)(void *)) noopReset; ctx->Update = (int (*)(void *, const byte *, size_t)) _tib3_Update; ctx->Digest = (int (*)(void *, byte *)) tib3_Final; + (void) tib3_Init((tib3_hashState *)ctx->param, + (int)(8 * ctx->digestsize)); break; #endif + case PGPHASHALGO_HAVAL_5_160: default: (void)rpmioFreePoolItem((rpmioItem)ctx, __FUNCTION__, __FILE__, __LINE__); return NULL; - /*@notreached@*/ break; + break; } xx = (*ctx->Reset) (ctx->param); @@ -997,7 +805,6 @@ return (DIGEST_CTX)rpmioLinkPoolItem((rpmioItem)ctx, __FUNCTION__, __FILE__, __LINE__); } -/*@-mustmod@*/ /* LCL: ctx->param may be modified, but ctx is abstract @*/ int rpmDigestUpdate(DIGEST_CTX ctx, const void * data, size_t len) { @@ -1007,7 +814,6 @@ DPRINTF((stderr, "==> ctx %p ==== Update(%s,%p[%u]) param %p\n", ctx, ctx->name, data, (unsigned)len, ctx->param)); return (*ctx->Update) (ctx->param, (byte *)data, len); } -/*@=mustmod@*/ #define HMAC_IPAD 0x36 #define HMAC_OPAD 0x5c @@ -1023,9 +829,7 @@ digest = (byte *) DRD_xmalloc(ctx->digestsize); DPRINTF((stderr, "==> ctx %p ==== Final(%s,%p,%p,%d) param %p digest %p[%u]\n", ctx, ctx->name, datap, lenp, asAscii, ctx->param, digest, (unsigned)ctx->digestsize)); -/*@-noeffectuncon@*/ /* FIX: check rc */ (void) (*ctx->Digest) (ctx->param, digest); -/*@=noeffectuncon@*/ /* If keyed HMAC, re-hash with key material. */ if (ctx->salt != NULL) { @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/librpmio.vers ============================================================================ $ cvs diff -u -r2.199.2.62 -r2.199.2.63 librpmio.vers --- rpm/rpmio/librpmio.vers 6 Jul 2016 14:25:43 -0000 2.199.2.62 +++ rpm/rpmio/librpmio.vers 7 Jul 2016 12:17:31 -0000 2.199.2.63 @@ -161,6 +161,7 @@ gzdio; hashEqualityString; hashFunctionString; + _rpmht_debug; htAddEntry; htCreate; htFree; @@ -196,14 +197,14 @@ lzdio; max_macro_depth; _max_load_depth; - _mire_debug; - _mirePool; + _rpmmire_debug; + _rpmmirePool; mireAppend; mireApply; mireClean; _mireEL; mireFreeAll; - mireGetPool; + rpmmireGetPool; _mireGLOBoptions; mireLoadPatterns; mireNew; @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/mire.c ============================================================================ $ cvs diff -u -r1.56.4.2 -r1.56.4.3 mire.c --- rpm/rpmio/mire.c 26 Jul 2013 23:10:45 -0000 1.56.4.2 +++ rpm/rpmio/mire.c 7 Jul 2016 12:17:31 -0000 1.56.4.3 @@ -12,27 +12,18 @@ #include "debug.h" -/*@access regex_t @*/ +int _rpmmire_debug = 0; -/*@unchecked@*/ -int _mire_debug = 0; - -/*@unchecked@*/ const unsigned char * _mirePCREtables = NULL; -/*@unchecked@*/ mireEL_t _mireEL = EL_LF; -/*@unchecked@*/ int _mireSTRINGoptions = 0; -/*@unchecked@*/ int _mireGLOBoptions = FNM_EXTMATCH | FNM_PATHNAME | FNM_PERIOD; -/*@unchecked@*/ int _mireREGEXoptions = REG_EXTENDED | REG_NEWLINE; -/*@unchecked@*/ int _mirePCREoptions = 0; int mireClean(miRE mire) @@ -42,10 +33,8 @@ if (mire->mode == RPMMIRE_REGEX) { if (mire->preg != NULL) { regfree(mire->preg); - /*@+voidabstract -usereleased @*/ /* LCL: regfree has bogus only */ if (mire->preg) free(mire->preg); mire->preg = NULL; - /*@=voidabstract =usereleased @*/ } } if (mire->mode == RPMMIRE_PCRE) { /* TODO: (*pcre_free)(_p) override */ @@ -61,38 +50,11 @@ mire->coptions = 0; mire->eoptions = 0; mire->notmatch = 0; -/*@-modfilesys@*/ -if (_mire_debug) +if (_rpmmire_debug) fprintf(stderr, "<-- mireClean(%p)\n", mire); -/*@=modfilesys@*/ return 0; } -static void mireFini(void * _mire) - /*@modifies _mire @*/ -{ - miRE mire = (miRE) _mire; - (void) mireClean(mire); -} - -/*@unchecked@*/ /*@only@*/ /*@null@*/ -rpmioPool _mirePool; - -miRE mireGetPool(rpmioPool pool) -{ - miRE mire; - - if (_mirePool == NULL) { - _mirePool = rpmioNewPool("mire", sizeof(*mire), -1, _mire_debug, - NULL, NULL, mireFini); - pool = _mirePool; - } - mire = (miRE) rpmioGetPool(pool, sizeof(*mire)); - memset(((char *)mire)+sizeof(mire->_item), 0, sizeof(*mire)-sizeof(mire->_item)); - return mire; -} - -/*@-onlytrans@*/ /* XXX miRE array, not refcounted. */ void * mireFreeAll(miRE mire, int nmire) { if (mire != NULL) { @@ -108,11 +70,21 @@ } return NULL; } -/*@=onlytrans@*/ + +static void rpmmireFini(void * _mire) +{ + miRE mire = (miRE) _mire; + (void) mireClean(mire); +} + +/* XXX rpmmireGetPool is exported tp rpmdb/rpmdb.c */ +#define static +RPMIOPOOL_MODULE(mire) +#undef static miRE mireNew(rpmMireMode mode, int tag) { - miRE mire = mireGetPool(_mirePool); + miRE mire = rpmmireGetPool(_rpmmirePool); mire->mode = mode; mire->tag = tag; return mireLink(mire); @@ -145,9 +117,7 @@ options = _mirePCREoptions; /* XXX check default compile options? */ mire->coptions = options; -/*@-assignexpose -temptrans @*/ mire->table = table; -/*@=assignexpose =temptrans @*/ break; } return rc; @@ -159,17 +129,13 @@ if (mire->mode == RPMMIRE_PCRE) { mire->startoff = 0; mire->eoptions = 0; -/*@-assignexpose@*/ mire->offsets = offsets; -/*@=assignexpose@*/ mire->noffsets = noffsets; } else if (mire->mode == RPMMIRE_REGEX) { mire->startoff = 0; mire->eoptions = 0; -/*@-assignexpose@*/ mire->offsets = offsets; -/*@=assignexpose@*/ mire->noffsets = noffsets; } else rc = -1; @@ -227,16 +193,12 @@ if (newline == NULL) { int val = 0; #if defined(PCRE_CONFIG_NEWLINE) -/*@-modunconnomods@*/ (void)pcre_config(PCRE_CONFIG_NEWLINE, &val); -/*@=modunconnomods@*/ #endif switch (val) { default: newline = "lf"; break; case '\r': newline = "cr"; break; -/*@-shiftimplementation@*/ case ('\r' << 8) | '\n': newline = "crlf"; break; -/*@=shiftimplementation@*/ case -1: newline = "any"; break; case -2: newline = "anycrlf"; break; } @@ -275,7 +237,7 @@ return rc; } -int mireSetLocale(/*@unused@*/ miRE mire, const char * locale) +int mireSetLocale(miRE mire, const char * locale) { const char * locale_from = NULL; int rc = -1; /* assume failure */ @@ -289,7 +251,6 @@ * LC_CTYPE or LC_ALL environment variable is set, and if so, * use it. */ -/*@-dependenttrans -observertrans@*/ if ((locale = getenv("LC_ALL")) != NULL) locale_from = "LC_ALL"; else if ((locale = getenv("LC_CTYPE")) != NULL) @@ -298,7 +259,6 @@ locale_from = "glibc"; locale = ""; } -/*@=dependenttrans =observertrans@*/ } /* @@ -308,17 +268,13 @@ if (locale != NULL) { const char * olocale = setlocale(LC_CTYPE, locale); if (olocale == NULL) { -/*@-modfilesys@*/ fprintf(stderr, _("%s: Failed to set locale %s (obtained from %s)\n"), __progname, locale, locale_from); -/*@=modfilesys@*/ goto exit; } #if defined(WITH_PCRE) -/*@-evalorderuncon -onlytrans @*/ _mirePCREtables = pcre_maketables(); -/*@=evalorderuncon =onlytrans @*/ #endif if (setlocale(LC_CTYPE, olocale) == NULL) goto exit; @@ -346,7 +302,7 @@ mire->pcre = pcre_compile2(mire->pattern, mire->coptions, &mire->errcode, &mire->errmsg, &mire->erroff, mire->table); if (mire->pcre == NULL) { - if (_mire_debug) + if (_rpmmire_debug) rpmlog(RPMLOG_ERR, _("pcre_compile2 failed: %s(%d) at offset %d of \"%s\"\n"), mire->errmsg, mire->errcode, mire->erroff, mire->pattern); @@ -386,10 +342,8 @@ #ifdef WITH_PCRE exit: #endif -/*@-modfilesys@*/ -if (_mire_debug) +if (_rpmmire_debug) fprintf(stderr, "<-- mireRegcomp(%p, \"%s\") rc %d\n", mire, pattern, rc); -/*@=modfilesys@*/ return rc; } @@ -421,14 +375,12 @@ } else if (vallen == 0) vallen = strlen(val); -/*@-nullpass@*/ /* XXX HACK: PCRE returns 2/3 of array, POSIX dimensions regmatch_t. */ rc = regexec(mire->preg, val, mire->noffsets/3, (regmatch_t *)mire->offsets, mire->eflags); -/*@=nullpass@*/ switch (rc) { - case 0: rc = 0; /*@innerbreak@*/ break; - case REG_NOMATCH: rc = -1;/*@innerbreak@*/ break; + case 0: rc = 0; break; + case REG_NOMATCH: rc = -1; break; default: { char msg[256]; (void) regerror(rc, mire->preg, msg, sizeof(msg)-1); @@ -437,7 +389,7 @@ mire->pattern, msg, rc); if (rc < 0) rc -= 1; /* XXX ensure -1 is nomatch. */ if (rc > 0) rc = -(rc+1); /* XXX ensure errors are negative. */ - } /*@innerbreak@*/ break; + } break; } break; case RPMMIRE_PCRE: @@ -450,12 +402,12 @@ val, (int)vallen, mire->startoff, mire->eoptions, mire->offsets, mire->noffsets); switch (rc) { - case 0: rc = 0; /*@innerbreak@*/ break; - case PCRE_ERROR_NOMATCH: rc = -1;/*@innerbreak@*/ break; + case 0: rc = 0; break; + case PCRE_ERROR_NOMATCH: rc = -1; break; default: - if (_mire_debug && rc < 0) + if (_rpmmire_debug && rc < 0) rpmlog(RPMLOG_ERR, _("pcre_exec failed: return %d\n"), rc); - /*@innerbreak@*/ break; + break; } #else rc = -99; @@ -466,28 +418,25 @@ break; rc = fnmatch(mire->pattern, val, mire->fnflags); switch (rc) { - case 0: rc = 0; /*@innerbreak@*/ break; - case FNM_NOMATCH: rc = -1;/*@innerbreak@*/ break; + case 0: rc = 0; break; + case FNM_NOMATCH: rc = -1; break; default: - if (_mire_debug) + if (_rpmmire_debug) rpmlog(RPMLOG_ERR, _("fnmatch failed: return %d\n"), rc); if (rc < 0) rc -= 1; /* XXX ensure -1 is nomatch. */ if (rc > 0) rc = -(rc+1); /* XXX ensure errors are negative. */ - /*@innerbreak@*/ break; + break; } break; default: break; } -/*@-modfilesys@*/ -if (_mire_debug) +if (_rpmmire_debug) fprintf(stderr, "<-- mireRegexec(%p, %p[%u]) rc %d mode %d \"%.*s\"\n", mire, val, (unsigned)vallen, rc, mire->mode, (int)(vallen < 20 ? vallen : 20), val); -/*@=modfilesys@*/ return rc; } -/*@-onlytrans@*/ /* XXX miRE array, not refcounted. */ int mireAppend(rpmMireMode mode, int tag, const char * pattern, const unsigned char * table, miRE * mirep, int * nmirep) { @@ -495,7 +444,7 @@ int xx; if (*mirep == NULL) { - (*mirep) = mireGetPool(_mirePool); + (*mirep) = rpmmireGetPool(_rpmmirePool); mire = (*mirep); } else { yarnLock use = (*mirep)->_item.use; @@ -506,19 +455,14 @@ mire = (*mirep) + (*nmirep); memset(mire, 0, sizeof(*mire)); /* XXX ensure no segfault, copy the use/pool from 1st item. */ -/*@-assignexpose@*/ mire->_item.use = use; mire->_item.pool = pool; -/*@=assignexpose@*/ } (*nmirep)++; xx = mireSetCOptions(mire, mode, tag, 0, table); -/*@-usereleased@*/ return mireRegcomp(mire, pattern); -/*@=usereleased@*/ } -/*@=onlytrans@*/ int mireLoadPatterns(rpmMireMode mode, int tag, const char ** patterns, const unsigned char * table, miRE * mirep, int * nmirep) @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/mire.h ============================================================================ $ cvs diff -u -r1.32.4.3 -r1.32.4.4 mire.h --- rpm/rpmio/mire.h 25 Jun 2016 07:31:08 -0000 1.32.4.3 +++ rpm/rpmio/mire.h 7 Jul 2016 12:17:31 -0000 1.32.4.4 @@ -12,9 +12,9 @@ /** */ -extern int _mire_debug; +extern int _rpmmire_debug; -extern rpmioPool _mirePool; +extern rpmioPool _rpmmirePool; /** */ @@ -40,6 +40,7 @@ /** */ typedef struct miRE_s * miRE; +typedef struct miRE_s * rpmmire; /** * Tag value pattern match mode. @@ -105,7 +106,7 @@ * @param pool mire pool * @return miRE container */ -miRE mireGetPool(rpmioPool pool); +rpmmire rpmmireGetPool(rpmioPool pool); /** * Unreference a pattern container instance. @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/poptIO.c ============================================================================ $ cvs diff -u -r1.94.2.22 -r1.94.2.23 poptIO.c --- rpm/rpmio/poptIO.c 4 Jul 2016 07:45:23 -0000 1.94.2.22 +++ rpm/rpmio/poptIO.c 7 Jul 2016 12:17:31 -0000 1.94.2.23 @@ -79,13 +79,13 @@ extern int _ar_debug; extern int _av_debug; extern int _cpio_debug; -extern int _ctx_debug; +extern int _rpmctx_debug; extern int _dav_cb_debug; extern int _dav_debug; extern int _dav_hook_debug; extern int _ftp_debug; extern int _fts_debug; -extern int _ht_debug; +extern int _rpmht_debug; extern int _html_debug; extern int _iosm_debug; extern int noLibio; @@ -585,7 +585,7 @@ N_("Debug argv collections"), NULL}, { "cpiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_cpio_debug, -1, N_("Debug cpio archives"), NULL}, - { "ctxdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ctx_debug, -1, + { "ctxdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmctx_debug, -1, N_("Debug digest contexts"), NULL}, { "davdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_dav_debug, -1, N_("Debug WebDAV data stream"), NULL}, @@ -597,13 +597,13 @@ N_("Debug FTP/HTTP data stream"), NULL}, { "ftsdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_fts_debug, -1, N_("Debug Fts(3) traverse"), NULL}, - { "htdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ht_debug, -1, + { "htdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmht_debug, -1, N_("Debug hash tables"), NULL}, { "htmldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_html_debug, -1, N_("Debug HTML parsing"), NULL}, { "iosmdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_iosm_debug, -1, N_("Debug I/O state machine"), NULL}, - { "miredebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_mire_debug, -1, + { "miredebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmmire_debug, -1, N_("Debug miRE patterns"), NULL}, { "pgpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_pgp_debug, -1, N_("Debug PGP usage"), NULL}, @@ -695,7 +695,7 @@ N_("Debug tar archives"), NULL}, { "stats", '\0', POPT_ARG_VAL, &_rpmsw_stats, -1, N_("Display operation statistics"), NULL}, - { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1, + { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmurl_debug, -1, N_("Debug URL cache handling"), NULL}, POPT_TABLEEND @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmhash.c ============================================================================ $ cvs diff -u -r1.17.4.1 -r1.17.4.2 rpmhash.c --- rpm/rpmio/rpmhash.c 16 Apr 2012 03:21:22 -0000 1.17.4.1 +++ rpm/rpmio/rpmhash.c 7 Jul 2016 12:17:31 -0000 1.17.4.2 @@ -9,10 +9,9 @@ #include <rpmhash.h> #include "debug.h" -/*@unchecked@*/ -int _ht_debug = 0; +int _rpmht_debug = 0; -typedef /*@owned@*/ const void * voidptr; +typedef const void * voidptr; typedef struct hashBucket_s * hashBucket; @@ -20,9 +19,9 @@ */ struct hashBucket_s { voidptr key; /*!< hash key */ -/*@owned@*/ voidptr * data; /*!< pointer to hashed data */ + voidptr * data; /*!< pointer to hashed data */ int dataCount; /*!< length of data (0 if unknown) */ -/*@dependent@*/hashBucket next; /*!< pointer to next item in bucket */ + hashBucket next; /*!< pointer to next item in bucket */ }; /** @@ -33,14 +32,8 @@ size_t keySize; /*!< size of key (0 if unknown) */ int freeData; /*!< should data be freed when table is destroyed? */ hashBucket * buckets; /*!< hash bucket array */ -/*@relnull@*/ hashFunctionType fn; /*!< generate hash value for key */ -/*@relnull@*/ hashEqualityType eq; /*!< compare hash keys for equality */ -#if defined(__LCLINT__) -/*@refs@*/ - int nrefs; /*!< (unused) keep splint happy */ -#endif }; #ifdef __cplusplus @@ -55,20 +48,17 @@ * @param key pointer to key value * @return pointer to hash bucket of key (or NULL) */ -static /*@shared@*/ /*@null@*/ +static hashBucket findEntry(hashTable ht, const void * key) - /*@*/ { rpmuint32_t hash = 0; hashBucket b; - /*@-modunconnomods@*/ hash = ht->fn(hash, key, 0) % ht->numBuckets; b = ht->buckets[hash]; while (b && b->key && ht->eq(b->key, key)) b = b->next; - /*@=modunconnomods@*/ return b; } @@ -227,9 +217,7 @@ return keypointer; } -/*@-mustmod@*/ /* XXX splint on crack */ -static void htFini(void * _ht) - /*@modifies _ht @*/ +static void rpmhtFini(void * _ht) { hashTable ht = (hashTable) _ht; hashBucket b, n; @@ -255,38 +243,20 @@ ht->buckets = _free(ht->buckets); } -/*@=mustmod@*/ -/*@unchecked@*/ /*@only@*/ /*@null@*/ -rpmioPool _htPool; - -static hashTable htGetPool(/*@null@*/ rpmioPool pool) - /*@globals _htPool, fileSystem @*/ - /*@modifies pool, _htPool, fileSystem @*/ -{ - hashTable ht; - - if (_htPool == NULL) { - _htPool = rpmioNewPool("ht", sizeof(*ht), -1, _ht_debug, - NULL, NULL, htFini); - pool = _htPool; - } - return (hashTable) rpmioGetPool(pool, sizeof(*ht)); -} +RPMIOPOOL_MODULE(ht) hashTable htCreate(int numBuckets, size_t keySize, int freeData, hashFunctionType fn, hashEqualityType eq) { - hashTable ht = htGetPool(_htPool); + hashTable ht = rpmhtGetPool(_rpmhtPool); ht->numBuckets = numBuckets; ht->buckets = (hashBucket *) xcalloc(numBuckets, sizeof(*ht->buckets)); ht->keySize = keySize; ht->freeData = freeData; - /*@-assignexpose@*/ ht->fn = (fn != NULL ? fn : hashFunctionString); ht->eq = (eq != NULL ? eq : hashEqualityString); - /*@=assignexpose@*/ return htLink(ht); } @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmhash.h ============================================================================ $ cvs diff -u -r1.12.4.1 -r1.12.4.2 rpmhash.h --- rpm/rpmio/rpmhash.h 24 Sep 2014 13:03:03 -0000 1.12.4.1 +++ rpm/rpmio/rpmhash.h 7 Jul 2016 12:17:31 -0000 1.12.4.2 @@ -10,7 +10,8 @@ /** */ -typedef /*@abstract@*/ /*@refcounted@*/ struct hashTable_s * hashTable; +typedef struct hashTable_s * hashTable; +typedef struct hashTable_s * rpmht; #ifdef __cplusplus extern "C" { @@ -22,8 +23,7 @@ * @param key2 entry 2 * @return 0 if entries are equal */ -typedef int (*hashEqualityType) (const void * key1, const void * key2) - /*@*/; +typedef int (*hashEqualityType) (const void * key1, const void * key2); /** * Compare two hash table entries for equality. @@ -32,8 +32,7 @@ * @return 0 if entries are equal */ int hashEqualityString(const void * key1, const void * key2) - RPM_GNUC_PURE - /*@*/; + RPM_GNUC_PURE; /** * Return hash value. @@ -43,8 +42,7 @@ * @return hash value */ typedef rpmuint32_t (*hashFunctionType) (rpmuint32_t h, const void * data, - size_t size) - /*@*/; + size_t size); /** * Return hash value of a string. @@ -54,8 +52,7 @@ * @return hash value */ rpmuint32_t hashFunctionString(rpmuint32_t h, const void * data, size_t size) - RPM_GNUC_PURE - /*@*/; + RPM_GNUC_PURE; /** * Add item to hash table. @@ -63,9 +60,7 @@ * @param key pointer to key * @param data pointer to data value */ -void htAddEntry(hashTable ht, /*@owned@*/ const void * key, - /*@owned@*/ const void * data) - /*@modifies ht */; +void htAddEntry(hashTable ht, const void * key, const void * data); /** * Retrieve item from hash table. @@ -77,18 +72,16 @@ * @return 0 on success, 1 if the item is not found. */ int htGetEntry(hashTable ht, const void * key, - /*@null@*/ /*@out@*/ const void * data, - /*@null@*/ /*@out@*/ int * dataCount, - /*@null@*/ /*@out@*/ const void * tableKey) - /*@modifies *data, *dataCount, *tableKey @*/; + const void * data, + int * dataCount, + const void * tableKey); /** * Retrieve keys from hash table. * @param ht pointer to hash table * @return array of key values terminated by a NULL pointer */ -const void ** htGetKeys(hashTable ht) - /*@*/; +const void ** htGetKeys(hashTable ht); /** * Check for key in hash table. @@ -96,18 +89,14 @@ * @param key pointer to key value * @return 1 if the key is present, 0 otherwise */ -/*@unused@*/ -int htHasEntry(hashTable ht, const void * key) - /*@*/; +int htHasEntry(hashTable ht, const void * key); /** * Unreference a hash table instance. * @param ht hash table * @return NULL on last dereference */ -/*@unused@*/ /*@null@*/ -hashTable htUnlink (/*@killref@*/ /*@null@*/ hashTable ht) - /*@modifies ht @*/; +hashTable htUnlink (hashTable ht); #define htUnlink(_ht) \ ((hashTable)rpmioUnlinkPoolItem((rpmioItem)(_ht), __FUNCTION__, __FILE__, __LINE__)) @@ -116,9 +105,7 @@ * @param ht hash table * @return new hash table reference */ -/*@unused@*/ /*@newref@*/ /*@null@*/ -hashTable htLink (/*@null@*/ hashTable ht) - /*@modifies ht @*/; +hashTable htLink (hashTable ht); #define htLink(_ht) \ ((hashTable)rpmioLinkPoolItem((rpmioItem)(_ht), __FUNCTION__, __FILE__, __LINE__)) @@ -127,9 +114,7 @@ * @param ht pointer to hash table * @return NULL on last dereference */ -/*@null@*/ -hashTable htFree( /*@only@*/ hashTable ht) - /*@modifies ht @*/; +hashTable htFree(hashTable ht); #define htFree(_ht) \ ((hashTable)rpmioFreePoolItem((rpmioItem)(_ht), __FUNCTION__, __FILE__, __LINE__)) @@ -144,11 +129,8 @@ * @param eq function to compare keys for equality (NULL for default) * @return pointer to initialized hash table */ -/*@newref@*/ /*@null@*/ hashTable htCreate(int numBuckets, size_t keySize, int freeData, - /*@null@*/ hashFunctionType fn, /*@null@*/ hashEqualityType eq) - /*@globals fileSystem @*/ - /*@modifies fileSystem @*/; + hashFunctionType fn, hashEqualityType eq); #ifdef __cplusplus } @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmio.c ============================================================================ $ cvs diff -u -r1.230.2.35 -r1.230.2.36 rpmio.c --- rpm/rpmio/rpmio.c 6 Jul 2016 14:25:43 -0000 1.230.2.35 +++ rpm/rpmio/rpmio.c 7 Jul 2016 12:17:31 -0000 1.230.2.36 @@ -2381,6 +2381,15 @@ FDIO_t ufdio = /*@-compmempass@*/ &ufdio_s /*@=compmempass@*/ ; /* =============================================================== */ +/*@-type@*/ /* LCL: function typedefs */ +static struct FDIO_s fpio_s = { + ufdRead, ufdWrite, fdSeek, ufdClose, NULL, NULL, NULL, +}; +/*@=type@*/ + +FDIO_t fpio = /*@-compmempass@*/ &fpio_s /*@=compmempass@*/ ; + +/* =============================================================== */ /*@observer@*/ static const char * getFdErrstr (FD_t fd) /*@*/ @@ -3240,7 +3249,6 @@ #ifdef __cplusplus extern "C" { #endif -/*@-exportheader@*/ #ifdef HAVE_NSS_INITCONTEXT extern void NSS_ShutdownContext(void * _nss_context); #else @@ -3248,36 +3256,18 @@ #endif extern void PL_ArenaFinish(void); extern void PR_Cleanup(void); -/*@=exportheader@*/ #ifdef __cplusplus } #endif -/*@unchecked@*/ int _rpmnss_init = 0; -/*@unchecked@*/ void * _rpmnss_context = NULL; #endif void rpmioClean(void) { -/*@-nestedextern@*/ - extern rpmioPool _urlPool; - extern rpmioPool _digPool; - extern rpmioPool _rpmvcPool; - extern rpmioPool _rpmvtPool; -/*@-shadow@*/ - extern rpmioPool _mirePool; - extern rpmioPool _htPool; - extern rpmioPool _cphPool; - extern rpmioPool _ctxPool; -/*@=shadow@*/ - - extern rpmioPool _rpmjsPool; extern rpmioPool _odbcPool; - extern rpmioPool _rpmsqlPool; -/*@=nestedextern@*/ #if defined(WITH_LUA) (void) rpmluaFree(NULL); @@ -3303,14 +3293,12 @@ RPMIOPOOL_INTERP_FREE(tcl) RPMIOPOOL_INTERP_FREE(squirrel) - _rpmsqlI = rpmsqlFree(_rpmsqlI); - _rpmsqlPool = rpmioFreePool(_rpmsqlPool); + RPMIOPOOL_INTERP_FREE(sql) RPMIOPOOL_INTERP_FREE(ruby) RPMIOPOOL_INTERP_FREE(python) RPMIOPOOL_INTERP_FREE(perl) RPMIOPOOL_INTERP_FREE(mrb) - _rpmjsI = rpmjsFree(_rpmjsI); - _rpmjsPool = rpmioFreePool(_rpmjsPool); + RPMIOPOOL_INTERP_FREE(js) RPMIOPOOL_INTERP_FREE(jni) RPMIOPOOL_INTERP_FREE(ficl) @@ -3348,26 +3336,26 @@ _rpmhkp_awol.bf = rpmbfFree(_rpmhkp_awol.bf); _rpmhkp_crl.bf = rpmbfFree(_rpmhkp_crl.bf); - _rpmvcPool = rpmioFreePool(_rpmvcPool); - _rpmvtPool = rpmioFreePool(_rpmvtPool); + RPMIOPOOL_FREE(vc) + RPMIOPOOL_FREE(vt) RPMIOPOOL_INTERP_FREE(sm) RPMIOPOOL_FREE(sp) RPMIOPOOL_INTERP_FREE(sx) RPMIOPOOL_FREE(html) - _mirePool = rpmioFreePool(_mirePool); + RPMIOPOOL_FREE(mire) RPMIOPOOL_FREE(mg) RPMIOPOOL_FREE(bf) - _htPool = rpmioFreePool(_htPool); - _cphPool = rpmioFreePool(_cphPool); - _ctxPool = rpmioFreePool(_ctxPool); + RPMIOPOOL_FREE(ht) + RPMIOPOOL_FREE(cph) + RPMIOPOOL_FREE(ctx) RPMIOPOOL_FREE(syck) RPMIOPOOL_FREE(iob) - _digPool = rpmioFreePool(_digPool); + RPMIOPOOL_FREE(dig) RPMIOPOOL_FREE(xar) RPMIOPOOL_FREE(avx) - _urlPool = rpmioFreePool(_urlPool); + RPMIOPOOL_FREE(url) _fdPool = rpmioFreePool(_fdPool); RPMIOPOOL_FREE(me) @@ -3375,11 +3363,3 @@ rpmlogClose(); } - -/*@-type@*/ /* LCL: function typedefs */ -static struct FDIO_s fpio_s = { - ufdRead, ufdWrite, fdSeek, ufdClose, NULL, NULL, NULL, -}; -/*@=type@*/ - -FDIO_t fpio = /*@-compmempass@*/ &fpio_s /*@=compmempass@*/ ; @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmiotypes.h ============================================================================ $ cvs diff -u -r1.47.2.21 -r1.47.2.22 rpmiotypes.h --- rpm/rpmio/rpmiotypes.h 25 Jun 2016 07:31:08 -0000 1.47.2.21 +++ rpm/rpmio/rpmiotypes.h 7 Jul 2016 12:17:31 -0000 1.47.2.22 @@ -84,6 +84,7 @@ /** \ingroup rpmpgp */ typedef struct pgpDig_s * pgpDig; +typedef struct pgpDig_s * rpmdig; /** \ingroup rpmpgp */ @@ -154,6 +155,7 @@ /** \ingroup rpmpgp */ typedef struct CIPHER_CTX_s * CIPHER_CTX; +typedef struct CIPHER_CTX_s * rpmcph; /** \ingroup rpmpgp * 9.2. Symmetric Key Algorithms @@ -247,6 +249,7 @@ /** \ingroup rpmpgp */ typedef struct DIGEST_CTX_s * DIGEST_CTX; +typedef struct DIGEST_CTX_s * rpmctx; /** \ingroup rpmpgp * 9.4. Hash Algorithms @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmpgp.c ============================================================================ $ cvs diff -u -r2.127.2.21 -r2.127.2.22 rpmpgp.c --- rpm/rpmio/rpmpgp.c 25 Jun 2016 07:31:08 -0000 2.127.2.21 +++ rpm/rpmio/rpmpgp.c 7 Jul 2016 12:17:31 -0000 2.127.2.22 @@ -32,24 +32,15 @@ #include "debug.h" -/*@access pgpDig @*/ -/*@access pgpDigParams @*/ -/*@access pgpPkt @*/ -/*@access rpmiob @*/ - #ifdef __cplusplus GENpair(rpmuint8_t **) #endif /* __cplusplus */ -/*@unchecked@*/ int _pgp_debug; -/*@unchecked@*/ int _pgp_print; -/*@unchecked@*/ int _pgp_error_count; -/*@unchecked@*/ pgpImplVecs_t * pgpImplVecs = /* explicit selection (order DOES NOT matter here) */ #if defined(USE_CRYPTO_TOMCRYPT) && defined(WITH_TOMCRYPT) @@ -81,10 +72,8 @@ #error INTERNAL ERROR: no suitable Cryptography library available #endif -/*@unchecked@*/ /*@refcounted@*/ /*@relnull@*/ static pgpDig _dig = NULL; -/*@unchecked@*/ /*@null@*/ static pgpDigParams _digp = NULL; #ifdef DYING @@ -169,13 +158,10 @@ { -1, "MD_UNKNOWN" }, }; -/*@-exportlocal -exportheadervar@*/ -/*@observer@*/ /*@unchecked@*/ struct pgpValTbl_s pgpKeyServerPrefsTbl[] = { { 0x80, "No-modify" }, { -1, "Unknown key server preference" }, }; -/*@=exportlocal =exportheadervar@*/ struct pgpValTbl_s pgpSubTypeTbl[] = { { PGPSUBTYPE_SIG_CREATE_TIME,"created" }, @@ -264,16 +250,12 @@ }; static void pgpPrtNL(void) - /*@globals fileSystem @*/ - /*@modifies fileSystem @*/ { if (!_pgp_print) return; fprintf(stderr, "\n"); } static void pgpPrtInt(const char *pre, int i) - /*@globals fileSystem @*/ - /*@modifies fileSystem @*/ { if (!_pgp_print) return; if (pre && *pre) @@ -282,8 +264,6 @@ } static void pgpPrtStr(const char *pre, const char *s) - /*@globals fileSystem @*/ - /*@modifies fileSystem @*/ { if (!_pgp_print) return; if (pre && *pre) @@ -292,8 +272,6 @@ } static void pgpPrtHex(const char *pre, const rpmuint8_t * p, size_t plen) - /*@globals fileSystem @*/ - /*@modifies fileSystem @*/ { if (!_pgp_print) return; if (pre && *pre) @@ -302,8 +280,6 @@ } void pgpPrtVal(const char * pre, pgpValTbl vs, rpmuint8_t val) - /*@globals fileSystem @*/ - /*@modifies fileSystem @*/ { if (!_pgp_print) return; if (pre && *pre) @@ -330,35 +306,33 @@ case PGPSUBTYPE_PREFER_SYMKEY: /* preferred symmetric algorithms */ for (i = 1; i < plen; i++) pgpPrtVal(" ", pgpSymkeyTbl, p[i]); - /*@switchbreak@*/ break; + break; case PGPSUBTYPE_PREFER_HASH: /* preferred hash algorithms */ for (i = 1; i < plen; i++) pgpPrtVal(" ", pgpHashTbl, p[i]); - /*@switchbreak@*/ break; + break; case PGPSUBTYPE_PREFER_COMPRESS:/* preferred compression algorithms */ for (i = 1; i < plen; i++) pgpPrtVal(" ", pgpCompressionTbl, p[i]); - /*@switchbreak@*/ break; + break; case PGPSUBTYPE_KEYSERVER_PREFERS:/* key server preferences */ for (i = 1; i < plen; i++) pgpPrtVal(" ", pgpKeyServerPrefsTbl, p[i]); - /*@switchbreak@*/ break; + break; case PGPSUBTYPE_SIG_CREATE_TIME: -/*@-mods -mayaliasunique @*/ if (_digp && !(_digp->saved & PGPDIG_SAVED_TIME) && (sigtype == PGPSIGTYPE_POSITIVE_CERT || sigtype == PGPSIGTYPE_BINARY || sigtype == PGPSIGTYPE_TEXT || sigtype == PGPSIGTYPE_STANDALONE)) { _digp->saved |= PGPDIG_SAVED_TIME; memcpy(_digp->time, p+1, sizeof(_digp->time)); } -/*@=mods =mayaliasunique @*/ if ((plen - 1) == 4) { time_t t = pgpGrab(p+1, plen-1); if (_pgp_print) fprintf(stderr, " %-24.24s(0x%08x)", ctime(&t), (unsigned)t); } else pgpPrtHex("", p+1, plen-1); - /*@switchbreak@*/ break; + break; case PGPSUBTYPE_SIG_EXPIRE_TIME: case PGPSUBTYPE_KEY_EXPIRE_TIME: /* XXX only on self-signature */ if ((plen - 1) == 4) { @@ -376,17 +350,15 @@ } } else pgpPrtHex("", p+1, plen-1); - /*@switchbreak@*/ break; + break; case PGPSUBTYPE_ISSUER_KEYID: /* issuer key ID */ -/*@-mods -mayaliasunique @*/ if (_digp && !(_digp->saved & PGPDIG_SAVED_ID) && (sigtype == PGPSIGTYPE_POSITIVE_CERT || sigtype == PGPSIGTYPE_BINARY || sigtype == PGPSIGTYPE_TEXT || sigtype == PGPSIGTYPE_STANDALONE)) { _digp->saved |= PGPDIG_SAVED_ID; memcpy(_digp->signid, p+1, sizeof(_digp->signid)); } -/*@=mods =mayaliasunique @*/ /*@fallthrough@*/ case PGPSUBTYPE_EXPORTABLE_CERT: case PGPSUBTYPE_TRUST_SIG: @@ -417,7 +389,7 @@ case PGPSUBTYPE_INTERNAL_110: default: pgpPrtHex("", p+1, plen-1); - /*@switchbreak@*/ break; + break; } pgpPrtNL(); p += plen; @@ -426,27 +398,22 @@ return 0; } -/*@-varuse =readonlytrans -nullassign @*/ -/*@observer@*/ /*@unchecked@*/ static const char * pgpSigRSA[] = { " m**d =", NULL, }; -/*@observer@*/ /*@unchecked@*/ static const char * pgpSigDSA[] = { " r =", " s =", NULL, }; -/*@observer@*/ /*@unchecked@*/ static const char * pgpSigECDSA[] = { " r =", " s =", NULL, }; -/*@=varuse =readonlytrans =nullassign @*/ int pgpPrtSigParams(pgpDig dig, const pgpPkt pp, pgpPubkeyAlgo pubkey_algo, pgpSigType sigtype, const rpmuint8_t * p) @@ -466,10 +433,10 @@ switch (i) { case 0: /* m**d */ xx = pgpImplMpiItem(pgpSigRSA[i], dig, 10+i, p, p+pgpMpiLen(p)); - /*@switchbreak@*/ break; + break; default: xx = 1; - /*@switchbreak@*/ break; + break; } if (xx) return xx; } @@ -483,13 +450,13 @@ switch (i) { case 0: /* r */ xx = pgpImplMpiItem(pgpSigDSA[i], dig, 20+i, p, p+pgpMpiLen(p)); - /*@switchbreak@*/ break; + break; case 1: /* s */ xx = pgpImplMpiItem(pgpSigDSA[i], dig, 20+i, p, p+pgpMpiLen(p)); - /*@switchbreak@*/ break; + break; default: xx = 1; - /*@switchbreak@*/ break; + break; } if (xx) return xx; } @@ -503,13 +470,13 @@ switch (i) { case 0: /* r */ xx = pgpImplMpiItem(pgpSigECDSA[i], dig, 50+i, p, p+pgpMpiLen(p)); - /*@switchbreak@*/ break; + break; case 1: /* s */ xx = pgpImplMpiItem(pgpSigECDSA[i], dig, 50+i, p, p+pgpMpiLen(p)); - /*@switchbreak@*/ break; + break; default: xx = 1; - /*@switchbreak@*/ break; + break; } if (xx) return xx; } @@ -527,8 +494,6 @@ } int pgpPrtSig(const pgpPkt pp) - /*@globals _digp @*/ - /*@modifies *_digp @*/ { rpmuint8_t version = pp->u.h[0]; rpmuint8_t * p; @@ -635,8 +600,6 @@ return rc; } -/*@-varuse =readonlytrans -nullassign @*/ -/*@observer@*/ /*@unchecked@*/ static const char * pgpPublicRSA[] = { " n =", " e =", @@ -644,7 +607,6 @@ }; #ifdef NOTYET -/*@observer@*/ /*@unchecked@*/ static const char * pgpSecretRSA[] = { " d =", " p =", @@ -654,7 +616,6 @@ }; #endif -/*@observer@*/ /*@unchecked@*/ static const char * pgpPublicDSA[] = { " p =", " q =", @@ -664,42 +625,36 @@ }; #ifdef NOTYET -/*@observer@*/ /*@unchecked@*/ static const char * pgpSecretDSA[] = { " x =", NULL, }; #endif -/*@observer@*/ /*@unchecked@*/ static const char * pgpPublicECDSA[] = { " Q =", NULL, }; #ifdef NOTYET -/*@observer@*/ /*@unchecked@*/ static const char * pgpSecretECDSA[] = { " d =", NULL, }; #endif -/*@observer@*/ /*@unchecked@*/ static const char * pgpPublicECDH[] = { " Q =", NULL, }; #ifdef NOTYET -/*@observer@*/ /*@unchecked@*/ static const char * pgpSecretECDH[] = { " d =", NULL, }; #endif -/*@observer@*/ /*@unchecked@*/ static const char * pgpPublicELGAMAL[] = { " p =", " g =", @@ -708,16 +663,14 @@ }; #ifdef NOTYET -/*@observer@*/ /*@unchecked@*/ static const char * pgpSecretELGAMAL[] = { " x =", NULL, }; #endif -/*@=varuse =readonlytrans =nullassign @*/ const rpmuint8_t * pgpPrtPubkeyParams(pgpDig dig, const pgpPkt pp, - pgpPubkeyAlgo pubkey_algo, /*@returned@*/ const rpmuint8_t * p) + pgpPubkeyAlgo pubkey_algo, const rpmuint8_t * p) { const rpmuint8_t * pend = pp->u.h + pp->hlen; int i; @@ -729,12 +682,12 @@ switch (i) { case 0: /* n */ (void) pgpImplMpiItem(pgpPublicRSA[i], dig, 30+i, p, p+pgpMpiLen(p)); - /*@switchbreak@*/ break; + break; case 1: /* e */ (void) pgpImplMpiItem(pgpPublicRSA[i], dig, 30+i, p, p+pgpMpiLen(p)); - /*@switchbreak@*/ break; + break; default: - /*@switchbreak@*/ break; + break; } } pgpPrtStr("", pgpPublicRSA[i]); @@ -744,18 +697,18 @@ switch (i) { case 0: /* p */ (void) pgpImplMpiItem(pgpPublicDSA[i], dig, 40+i, p, p+pgpMpiLen(p)); - /*@switchbreak@*/ break; + break; case 1: /* q */ (void) pgpImplMpiItem(pgpPublicDSA[i], dig, 40+i, p, p+pgpMpiLen(p)); - /*@switchbreak@*/ break; + break; case 2: /* g */ (void) pgpImplMpiItem(pgpPublicDSA[i], dig, 40+i, p, p+pgpMpiLen(p)); - /*@switchbreak@*/ break; + break; case 3: /* y */ (void) pgpImplMpiItem(pgpPublicDSA[i], dig, 40+i, p, p+pgpMpiLen(p)); - /*@switchbreak@*/ break; + break; default: - /*@switchbreak@*/ break; + break; } } pgpPrtStr("", pgpPublicDSA[i]); @@ -766,9 +719,9 @@ case 0: /* curve_oid & Q */ (void) pgpImplMpiItem(pgpPublicECDSA[i], dig, 60, p+1, p+1+p[0]); (void) pgpImplMpiItem(pgpPublicECDSA[i], dig, 61, p+1+p[0], p+pgpMpiLen(p)); - /*@switchbreak@*/ break; + break; default: - /*@switchbreak@*/ break; + break; } } if (i == 0) { @@ -787,9 +740,9 @@ case 0: /* curve_oid & Q */ (void) pgpImplMpiItem(pgpPublicECDH[i], dig, 60, p+1, p+1+p[0]); (void) pgpImplMpiItem(pgpPublicECDH[i], dig, 61, p+1+p[0], p+pgpMpiLen(p)); - /*@switchbreak@*/ break; + break; default: - /*@switchbreak@*/ break; + break; } } if (i == 0) { @@ -818,10 +771,8 @@ } static const rpmuint8_t * pgpPrtSeckeyParams(const pgpPkt pp, - /*@unused@*/ rpmuint8_t pubkey_algo, - /*@returned@*/ const rpmuint8_t *p) - /*@globals fileSystem @*/ - /*@modifies fileSystem @*/ + rpmuint8_t pubkey_algo, + const rpmuint8_t *p) { int i; @@ -836,19 +787,19 @@ case 0x00: pgpPrtVal(" simple ", pgpHashTbl, p[2]); p += 2; - /*@innerbreak@*/ break; + break; case 0x01: pgpPrtVal(" salted ", pgpHashTbl, p[2]); pgpPrtHex("", p+3, 8); p += 10; - /*@innerbreak@*/ break; + break; case 0x03: pgpPrtVal(" iterated/salted ", pgpHashTbl, p[2]); i = (16 + ((unsigned)p[11] & 0xf)) << (((unsigned)p[11] >> 4U) + 6); pgpPrtHex("", p+3, 8); pgpPrtInt(" iter", i); p += 11; - /*@innerbreak@*/ break; + break; } break; default: @@ -894,8 +845,6 @@ } int pgpPrtKey(const pgpPkt pp) - /*@globals _digp @*/ - /*@modifies *_digp @*/ { rpmuint8_t version = pp->u.h[0]; const rpmuint8_t * p; @@ -955,8 +904,6 @@ } int pgpPrtUserID(const pgpPkt pp) - /*@globals _digp @*/ - /*@modifies *_digp @*/ { pgpPrtVal("", pgpTagTbl, (rpmuint8_t)pp->tag); if (_pgp_print) @@ -1026,9 +973,7 @@ if (pleft > 0 && pp->pktlen > (unsigned)pleft) return -1; -/*@-assignexpose -temptrans @*/ pp->u.h = pkt + 1 + lenlen; -/*@=assignexpose =temptrans @*/ return pp->pktlen; } @@ -1052,7 +997,7 @@ case PGPPUBKEYALGO_RSA: se += pgpMpiLen(se); memmove(keyid, (se-8), 8); - /*@innerbreak@*/ break; + break; } } break; case 4: @@ -1108,12 +1053,10 @@ case PGPTAG_PUBLIC_KEY: /* Get the public key fingerprint. */ if (_digp) { -/*@-mods@*/ if (!pgpPubkeyFingerprint(pkt, pp->pktlen, _digp->signid)) _digp->saved |= PGPDIG_SAVED_ID; else memset(_digp->signid, 0, sizeof(_digp->signid)); -/*@=mods@*/ } /*@fallthrough@*/ case PGPTAG_PUBLIC_SUBKEY: @@ -1156,7 +1099,6 @@ return (rc ? -1 : (int)pp->pktlen); } -/*@unchecked@*/ pgpVSFlags pgpDigVSFlags; void pgpDigClean(pgpDig dig) @@ -1187,9 +1129,7 @@ pgpImplClean(dig->impl); } -/*@-nullstate@*/ return; -/*@=nullstate@*/ } const char * pgpHashAlgo2Name(uint32_t algo) @@ -1247,9 +1187,7 @@ return rc; } -static void pgpDigFini(void * __dig) - /*@globals fileSystem, internalState @*/ - /*@modifies __dig, fileSystem, internalState @*/ +static void rpmdigFini(void * __dig) { pgpDig dig = (pgpDig) __dig; @@ -1298,29 +1236,12 @@ } -/*@unchecked@*/ /*@only@*/ /*@null@*/ -rpmioPool _digPool; - -static pgpDig digGetPool(/*@null@*/ rpmioPool pool) - /*@globals _digPool, fileSystem @*/ - /*@modifies pool, _digPool, fileSystem @*/ -{ - pgpDig dig; - - if (_digPool == NULL) { - _digPool = rpmioNewPool("dig", sizeof(*dig), -1, _pgp_debug, - NULL, NULL, pgpDigFini); - pool = _digPool; - } - - dig = (pgpDig) rpmioGetPool(pool, sizeof(*dig)); - memset(((char *)dig)+sizeof(dig->_item), 0, sizeof(*dig)-sizeof(dig->_item)); - return dig; -} +#define _rpmdig_debug _pgp_debug +RPMIOPOOL_MODULE(dig) pgpDig pgpDigNew(pgpVSFlags vsflags, pgpPubkeyAlgo pubkey_algo) { - pgpDig dig = pgpDigLink( digGetPool(_digPool) ); + pgpDig dig = pgpDigLink( rpmdigGetPool(_rpmdigPool) ); pgpDigParams pubp = pgpGetPubkey(dig); pgpDigParams sigp = pgpGetSignature(dig); int xx; @@ -1407,15 +1328,11 @@ } int pgpSetFindPubkey(pgpDig dig, - int (*findPubkey) (void *ts, /*@null@*/ void *dig), void * _ts) + int (*findPubkey) (void *ts, void *dig), void * _ts) { if (dig) { -/*@-assignexpose@*/ dig->findPubkey = findPubkey; -/*@=assignexpose@*/ -/*@-dependenttrans@*/ dig->_ts = _ts; -/*@=dependenttrans@*/ } return 0; } @@ -1429,8 +1346,7 @@ } int pgpGrabPkts(const rpmuint8_t * pkts, size_t pktlen, - /*@out@*/ rpmuint8_t *** pppkts, /*@out@*/ int * pnpkts) - /*@modifies *pppkts, *pnpkts @*/ + rpmuint8_t *** pppkts, int * pnpkts) { pgpPkt pp = (pgpPkt) alloca(sizeof(*pp)); const rpmuint8_t * p; @@ -1473,10 +1389,7 @@ return 0; } -/*@-globstate -incondefs -nullderef @*/ /* _dig annotations are not correct. */ int pgpPrtPkts(const rpmuint8_t * pkts, size_t pktlen, pgpDig dig, int printing) - /*@globals _dig, _digp, _pgp_print @*/ - /*@modifies _dig, _digp, *_digp, _pgp_print @*/ { pgpPkt pp = (pgpPkt) alloca(sizeof(*pp)); unsigned int val = (unsigned int)*pkts; @@ -1518,7 +1431,6 @@ return 0; } -/*@=globstate =incondefs =nullderef @*/ pgpArmor pgpArmorUnwrap(rpmiob iob, rpmuint8_t ** pkt, size_t * pktlen) { @@ -1602,7 +1514,7 @@ continue; *t = '\0'; pstate++; - /*@switchbreak@*/ break; + break; case 1: enc = NULL; rc = pgpValTok(pgpArmorKeyTbl, t, te); @@ -1614,7 +1526,7 @@ } enc = te; /* Start of encoded packets */ pstate++; - /*@switchbreak@*/ break; + break; case 2: crcenc = NULL; if (*t != '=') @@ -1622,7 +1534,7 @@ *t++ = '\0'; /* Terminate encoded packets */ crcenc = t; /* Start of encoded crc */ pstate++; - /*@switchbreak@*/ break; + break; case 3: pstate = 0; if (!TOKEQ(t, "-----END PGP ")) { @@ -1678,7 +1590,7 @@ dec = NULL; declen = 0; goto exit; - /*@notreached@*/ /*@switchbreak@*/ break; + break; } } ec = PGPARMOR_NONE; @@ -1714,7 +1626,6 @@ int lc; nt = ((ns + 2) / 3) * 4; - /*@-globs@*/ /* Add additional bytes necessary for eol string(s). */ if (b64encode_chars_per_line > 0 && b64encode_eolstr != NULL) { lc = (nt + b64encode_chars_per_line - 1) / b64encode_chars_per_line; @@ -1722,7 +1633,6 @@ ++lc; nt += lc * strlen(b64encode_eolstr); } - /*@=globs@*/ nt += 512; /* XXX slop for armor and crc */ @@ -1730,9 +1640,7 @@ *t = '\0'; t = stpcpy(t, "-----BEGIN PGP "); t = stpcpy(t, pgpValStr(pgpArmorTbl, atype)); - /*@-globs@*/ t = stpcpy( stpcpy(t, "-----\nVersion: RPM "), VERSION); - /*@=globs@*/ if (pgpImplVecs->_pgpNV && pgpImplVecs->_pgpNV[0]) { t = stpcpy(t, " ("); @@ -1756,9 +1664,7 @@ t = stpcpy(t, pgpValStr(pgpArmorTbl, atype)); t = stpcpy(t, "-----\n"); -/*@-globstate@*/ /* XXX b64encode_eolstr needs annotation. */ return val; -/*@=globstate@*/ } pgpHashAlgo pgpHashAlgoStringToNumber(const char *name, size_t name_len) @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmsql.c ============================================================================ $ cvs diff -u -r2.59.2.16 -r2.59.2.17 rpmsql.c --- rpm/rpmio/rpmsql.c 19 Apr 2016 13:02:43 -0000 2.59.2.16 +++ rpm/rpmio/rpmsql.c 7 Jul 2016 12:17:31 -0000 2.59.2.17 @@ -39,23 +39,17 @@ #include "debug.h" -/*@unchecked@*/ int _rpmsql_debug = 0; -/*@unchecked@*/ int _rpmvt_debug = 0; -/*@unchecked@*/ int _rpmvc_debug = 0; -/*@unchecked@*/ /*@relnull@*/ rpmsql _rpmsqlI = NULL; -/*@unchecked@*/ volatile int _rpmsqlSeenInterrupt; #if defined(WITH_SQLITE) -/*@unchecked@*/ static struct rpmsql_s _sql; #endif /* defined(WITH_SQLITE) */ @@ -68,8 +62,6 @@ * rpmvt pool destructor. */ static void rpmvtFini(void * _VT) - /*@globals fileSystem @*/ - /*@modifies *_VT, fileSystem @*/ { struct rpmVT_s * VT = _VT; rpmvt vt = &VT->vt; @@ -86,12 +78,9 @@ vt->ac = 0; } -/*@unchecked@*/ /*@only@*/ /*@null@*/ rpmioPool _rpmvtPool; -static rpmvt rpmvtGetPool(/*@null@*/ rpmioPool pool) - /*@globals _rpmvtPool, fileSystem @*/ - /*@modifies pool, _rpmvtPool, fileSystem @*/ +static rpmvt rpmvtGetPool(rpmioPool pool) { struct rpmVT_s * VT; @@ -584,8 +573,6 @@ * rpmvc pool destructor. */ static void rpmvcFini(void * _VC) - /*@globals fileSystem @*/ - /*@modifies *_VC, fileSystem @*/ { struct rpmVC_s * VC = _VC; rpmvc vc = &VC->vc; @@ -596,12 +583,9 @@ vc->vt = NULL; } -/*@unchecked@*/ /*@only@*/ /*@null@*/ rpmioPool _rpmvcPool; -static rpmvc rpmvcGetPool(/*@null@*/ rpmioPool pool) - /*@globals _rpmvcPool, fileSystem @*/ - /*@modifies pool, _rpmvcPool, fileSystem @*/ +static rpmvc rpmvcGetPool(rpmioPool pool) { struct rpmVC_s * VC; @@ -863,11 +847,8 @@ * @param lvl error level (1 adds "Error: ", >=2 exits) * @param fmt msg format */ -/*@mayexit@*/ /*@printflike@*/ static void rpmsql_error(int lvl, const char *fmt, ...) - RPM_GNUC_PRINTF(2, 3) - /*@globals fileSystem @*/ - /*@modifies fileSystem @*/; + RPM_GNUC_PRINTF(2, 3); static void rpmsql_error(int lvl, const char *fmt, ...) { @@ -889,9 +870,7 @@ * @param sql sql interpreter * @return SQLITE_OK on success */ -int rpmsqlCmd(/*@null@*/ rpmsql sql, const char * msg, void * _db, int rc) - /*@globals fileSystem @*/ - /*@modifies fileSystem @*/ +int rpmsqlCmd(rpmsql sql, const char * msg, void * _db, int rc) { sqlite3 * db; @@ -973,8 +952,6 @@ * @return global sql interpreter */ static rpmsql rpmsqlI(void) - /*@globals _rpmsqlI @*/ - /*@modifies _rpmsqlI @*/ { if (_rpmsqlI == NULL) _rpmsqlI = rpmsqlNew(NULL, 0); @@ -988,10 +965,8 @@ * @param sql sql interpreter * @param fmt format string */ -/*@printflike@*/ static int rpmsqlFprintf(rpmsql sql, const char *fmt, ...) - RPM_GNUC_PRINTF(2, 3) - /*@*/; + RPM_GNUC_PRINTF(2, 3); static int rpmsqlFprintf(rpmsql sql, const char *fmt, ...) { char b[BUFSIZ]; @@ -2809,7 +2784,6 @@ }; static void rpmsqlVMFree(void * _VM) - /*@*/ { SQLDBG((stderr, "--> %s(%p)\n", __FUNCTION__, _VM)); if (_VM) @@ -2844,7 +2818,7 @@ } #endif -static /*@only@*/ rpmsqlVM rpmsqlVMNew(/*@null@*/ const rpmsqlVM s) +static rpmsqlVM rpmsqlVMNew(const rpmsqlVM s) { rpmsqlVM t = xcalloc(1, sizeof(*t)); @@ -3132,7 +3106,6 @@ * If a field contains any character identified by a 1 in the following * array, then the string must be quoted for CSV. */ -/*@unchecked@*/ static const char needCsvQuote[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -3539,11 +3512,8 @@ * @param sql sql interpreter * @return buffer, or NULL on end-of-file */ -/*@null@*/ static char * -rpmsqlFgets(/*@returned@*/ char * buf, size_t nbuf, rpmsql sql) - /*@globals fileSystem @*/ - /*@modifies buf, fileSystem @*/ +rpmsqlFgets(char * buf, size_t nbuf, rpmsql sql) { FD_t ifd = sql->ifd; /* XXX sadly, fgets(3) cannot be used against a LIBIO wrapped .fpio FD_t */ @@ -3572,23 +3542,23 @@ switch (*p) { case '\\': switch (*(p+1)) { - case '\r': /*@switchbreak@*/ break; - case '\n': /*@switchbreak@*/ break; - case '\0': /*@switchbreak@*/ break; - default: p++; /*@switchbreak@*/ break; + case '\r': break; + case '\n': break; + case '\0': break; + default: p++; break; } - /*@switchbreak@*/ break; + break; case '%': switch (*(p+1)) { - case '{': p++, bc++; /*@switchbreak@*/ break; - case '(': p++, pc++; /*@switchbreak@*/ break; - case '%': p++; /*@switchbreak@*/ break; + case '{': p++, bc++; break; + case '(': p++, pc++; break; + case '%': p++; break; } - /*@switchbreak@*/ break; - case '{': if (bc > 0) bc++; /*@switchbreak@*/ break; - case '}': if (bc > 0) bc--; /*@switchbreak@*/ break; - case '(': if (pc > 0) pc++; /*@switchbreak@*/ break; - case ')': if (pc > 0) pc--; /*@switchbreak@*/ break; + break; + case '{': if (bc > 0) bc++; break; + case '}': if (bc > 0) bc--; break; + case '(': if (pc > 0) pc++; break; + case ')': if (pc > 0) pc--; break; } } if (nb == 0 || (*q != '\\' && !bc && !pc) || *(q+1) == '\0') { @@ -3617,7 +3587,7 @@ * @param sql sql interpreter * @param zPrompt prompt string */ -static char *local_getline(rpmsql sql, /*@null@*/const char *zPrompt) +static char *local_getline(rpmsql sql, const char *zPrompt) { char * t; @@ -3974,7 +3944,6 @@ /* * Text of a help message */ -/*@unchecked@*/ static char zHelp[] = ".backup ?DB? FILE Backup DB (default \"main\") to FILE\n" ".bail ON|OFF Stop after hitting an error. Default OFF\n" @@ -4079,7 +4048,6 @@ return val; } -/*@unchecked@*/ /*@observer@*/ static const char *modeDescr[] = { "line", "column", @@ -4096,7 +4064,6 @@ static int rpmsqlInput(rpmsql sql); static int rpmsqlFOpen(const char * fn, FD_t *fdp) - /*@modifies *fdp @*/ { FD_t fd = *fdp; int rc = 0; @@ -5186,11 +5153,10 @@ * POPT argument processing callback. */ static void rpmsqlArgCallback(poptContext con, - /*@unused@ */ enum poptCallbackReason reason, + enum poptCallbackReason reason, const struct poptOption *opt, const char *arg, - /*@unused@ */ void *_data) - /*@ */ + void *_data) { rpmsql sql = &_sql; @@ -5207,25 +5173,22 @@ break; case 'V': /* -version */ printf("%s\n", sqlite3_libversion()); - /*@-exitarg@ */ exit(0); /*@=exitarg@ */ - /*@notreached@ */ break; + exit(0); + break; default: /* XXX fprintf(stderr, ...)? */ rpmsql_error(0, _("%s: Unknown callback(0x%x)\n"), __FUNCTION__, (unsigned) opt->val); poptPrintUsage(con, stderr, 0); - /*@-exitarg@ */ exit(2); /*@=exitarg@ */ - /*@notreached@ */ break; + exit(2); + break; } } -/*@unchecked@*/ /*@observer@*/ static struct poptOption _rpmsqlOptions[] = { - /*@-type@*//* FIX: cast? */ {NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE, rpmsqlArgCallback, 0, NULL, NULL}, -/*@=type@*/ { "debug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_ONEDASH|POPT_ARGFLAG_DOC_HIDDEN, &_rpmsql_debug, -1, N_("Debug embedded SQL interpreter"), NULL}, @@ -5309,8 +5272,6 @@ * rpmsql pool destructor. */ static void rpmsqlFini(void * _sql) - /*@globals fileSystem @*/ - /*@modifies *_sql, fileSystem @*/ { rpmsql sql = _sql; @@ -5359,25 +5320,7 @@ sql->iob = NULL; } -/*@unchecked@*/ /*@only@*/ /*@null@*/ -rpmioPool _rpmsqlPool; - -static rpmsql rpmsqlGetPool(/*@null@*/ rpmioPool pool) - /*@globals _rpmsqlPool, fileSystem @*/ - /*@modifies pool, _rpmsqlPool, fileSystem @*/ -{ - rpmsql sql; - - if (_rpmsqlPool == NULL) { - _rpmsqlPool = rpmioNewPool("sql", sizeof(*sql), -1, _rpmsql_debug, - NULL, NULL, rpmsqlFini); - pool = _rpmsqlPool; - } - sql = (rpmsql) rpmioGetPool(pool, sizeof(*sql)); - memset(((char *)sql)+sizeof(sql->_item), 0, sizeof(*sql)-sizeof(sql->_item)); - return sql; -} - +RPMIOPOOL_MODULE(sql) const char ** rpmsqlArgv(rpmsql sql, int * argcp) { const char ** av = sql->av; @@ -5393,7 +5336,6 @@ * @param sql sql interpreter */ static void rpmsqlInitPopt(rpmsql sql, int ac, char ** av, poptOption tbl) - /*@modifies sql @*/ { poptContext con; int rc; @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmurl.h ============================================================================ $ cvs diff -u -r1.41.4.10 -r1.41.4.11 rpmurl.h --- rpm/rpmio/rpmurl.h 29 Jun 2016 12:17:58 -0000 1.41.4.10 +++ rpm/rpmio/rpmurl.h 7 Jul 2016 12:17:31 -0000 1.41.4.11 @@ -40,6 +40,7 @@ /** */ typedef struct urlinfo_s * urlinfo; +typedef struct urlinfo_s * rpmurl; /** */ @@ -135,7 +136,7 @@ extern int _url_iobuf_size; /*!< Initial size of URL I/O buffer. */ #define RPMURL_IOBUF_SIZE 4096 -extern int _url_debug; /*!< URL debugging? */ +extern int _rpmurl_debug; /*!< URL debugging? */ #define RPMURL_DEBUG_IO 0x40000000 #define RPMURL_DEBUG_REFS 0x20000000 @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/url.c ============================================================================ $ cvs diff -u -r1.73.4.17 -r1.73.4.18 url.c --- rpm/rpmio/url.c 5 Jul 2016 14:44:53 -0000 1.73.4.17 +++ rpm/rpmio/url.c 7 Jul 2016 12:17:31 -0000 1.73.4.18 @@ -67,9 +67,9 @@ /** */ -int _url_debug = 0; +int _rpmurl_debug = 0; -#define URLDBG(_f, _m, _x) if ((_url_debug | (_f)) & (_m)) fprintf _x +#define URLDBG(_f, _m, _x) if ((_rpmurl_debug | (_f)) & (_m)) fprintf _x #define URLDBGIO(_f, _x) URLDBG((_f), RPMURL_DEBUG_IO, _x) #define URLDBGREFS(_f, _x) URLDBG((_f), RPMURL_DEBUG_REFS, _x) @@ -78,7 +78,7 @@ */ urlinfo *_url_cache = NULL; -static void urlFini(void * _u) +static void rpmurlFini(void * _u) { urlinfo u = (urlinfo) _u; int xx; @@ -170,25 +170,11 @@ */ int _url_count = 0; -rpmioPool _urlPool; - -static urlinfo urlGetPool(rpmioPool pool) -{ - urlinfo u; - - if (_urlPool == NULL) { - _urlPool = rpmioNewPool("u", sizeof(*u), -1, _url_debug, - NULL, NULL, urlFini); - pool = _urlPool; - } - u = (urlinfo) rpmioGetPool(pool, sizeof(*u)); - memset(((char *)u)+sizeof(u->_item), 0, sizeof(*u)-sizeof(u->_item)); - return u; -} +RPMIOPOOL_MODULE(url) urlinfo XurlNew(const char *msg, const char *fn, unsigned ln) { - urlinfo u = urlGetPool(_urlPool); + urlinfo u = rpmurlGetPool(_rpmurlPool); u->proxyp = -1; u->port = -1; @@ -650,7 +636,7 @@ /* XXX this can fail if directory in path does not exist. */ tfd = Fopen(dest, "w"); -if (_url_debug) +if (_rpmurl_debug) fprintf(stderr, "*** urlGetFile sfd %p %s tfd %p %s\n", sfd, url, (tfd ? tfd : NULL), dest); if (tfd == NULL || Ferror(tfd)) { rpmlog(RPMLOG_DEBUG, D_("failed to create %s: %s\n"), dest, Fstrerror(tfd)); @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org