| rpmpgp.h | | rpmpgp.h | |
| | | | |
| skipping to change at line 21 | | skipping to change at line 21 | |
| */ | | */ | |
| | | | |
| #include <string.h> | | #include <string.h> | |
| #include <popt.h> | | #include <popt.h> | |
| #include <rpmiotypes.h> | | #include <rpmiotypes.h> | |
| #include <yarn.h> | | #include <yarn.h> | |
| | | | |
| #if defined(_RPMPGP_INTERNAL) | | #if defined(_RPMPGP_INTERNAL) | |
| #include <rpmsw.h> | | #include <rpmsw.h> | |
| | | | |
|
| | | /*@unchecked@*/ | |
| | | extern int _pgp_error_count; | |
| | | | |
| /** \ingroup rpmpgp | | /** \ingroup rpmpgp | |
| * Values parsed from OpenPGP signature/pubkey packet(s). | | * Values parsed from OpenPGP signature/pubkey packet(s). | |
| */ | | */ | |
| struct pgpDigParams_s { | | struct pgpDigParams_s { | |
| /*@only@*/ /*@null@*/ | | /*@only@*/ /*@null@*/ | |
| const char * userid; | | const char * userid; | |
| /*@dependent@*/ /*@null@*/ | | /*@dependent@*/ /*@null@*/ | |
| const rpmuint8_t * hash; | | const rpmuint8_t * hash; | |
| rpmuint8_t tag; | | rpmuint8_t tag; | |
| | | | |
| | | | |
| skipping to change at line 57 | | skipping to change at line 60 | |
| }; | | }; | |
| | | | |
| /** \ingroup rpmpgp | | /** \ingroup rpmpgp | |
| * Container for values parsed from an OpenPGP signature and public key. | | * Container for values parsed from an OpenPGP signature and public key. | |
| */ | | */ | |
| struct pgpDig_s { | | struct pgpDig_s { | |
| struct rpmioItem_s _item; /*!< usage mutex and pool identifier. */ | | struct rpmioItem_s _item; /*!< usage mutex and pool identifier. */ | |
| struct pgpDigParams_s signature; | | struct pgpDigParams_s signature; | |
| struct pgpDigParams_s pubkey; | | struct pgpDigParams_s pubkey; | |
| | | | |
|
| | | /*@observer@*/ /*@null@*/ | |
| | | const char * pubkey_algoN; | |
| | | /*@observer@*/ /*@null@*/ | |
| | | const char * hash_algoN; | |
| | | | |
| rpmuint32_t sigtag; /*!< Package signature tag. */ | | rpmuint32_t sigtag; /*!< Package signature tag. */ | |
| rpmuint32_t sigtype; /*!< Package signature data type. */ | | rpmuint32_t sigtype; /*!< Package signature data type. */ | |
| /*@relnull@*/ | | /*@relnull@*/ | |
| const void * sig; /*!< Package signature. */ | | const void * sig; /*!< Package signature. */ | |
| rpmuint32_t siglen; /*!< Package signature length. */ | | rpmuint32_t siglen; /*!< Package signature length. */ | |
| | | | |
| pgpVSFlags vsflags; /*!< Digest/signature operation disa
blers. */ | | pgpVSFlags vsflags; /*!< Digest/signature operation disa
blers. */ | |
| struct rpmop_s dops; /*!< Digest operation statistics. */ | | struct rpmop_s dops; /*!< Digest operation statistics. */ | |
| struct rpmop_s sops; /*!< Signature operation statistics. */ | | struct rpmop_s sops; /*!< Signature operation statistics. */ | |
| | | | |
| | | | |
| skipping to change at line 89 | | skipping to change at line 97 | |
| DIGEST_CTX hdrsha1ctx; /*!< (dsa) header sha1 hash context. */ | | DIGEST_CTX hdrsha1ctx; /*!< (dsa) header sha1 hash context. */ | |
| /*@only@*/ /*@null@*/ | | /*@only@*/ /*@null@*/ | |
| void * sha1; /*!< (dsa) V3 signature hash. */ | | void * sha1; /*!< (dsa) V3 signature hash. */ | |
| size_t sha1len; /*!< (dsa) V3 signature hash length. */ | | size_t sha1len; /*!< (dsa) V3 signature hash length. */ | |
| | | | |
| /*@only@*/ /*@null@*/ | | /*@only@*/ /*@null@*/ | |
| DIGEST_CTX md5ctx; /*!< (rsa) md5 hash context. */ | | DIGEST_CTX md5ctx; /*!< (rsa) md5 hash context. */ | |
| /*@only@*/ /*@null@*/ | | /*@only@*/ /*@null@*/ | |
| DIGEST_CTX hdrctx; /*!< (rsa) header hash context. */ | | DIGEST_CTX hdrctx; /*!< (rsa) header hash context. */ | |
| /*@only@*/ /*@null@*/ | | /*@only@*/ /*@null@*/ | |
|
| void * md5; /*!< (rsa) V3 signature hash. */ | | void * md5; /*!< (rsa) signature hash. */ | |
| size_t md5len; /*!< (rsa) V3 signature hash length. */ | | size_t md5len; /*!< (rsa) signature hash length. */ | |
| | | | |
| /*@owned@*/ /*@relnull@*/ | | /*@owned@*/ /*@relnull@*/ | |
| void * impl; /*!< Implementation data */ | | void * impl; /*!< Implementation data */ | |
|
| | | | |
| #if defined(__LCLINT__) | | #if defined(__LCLINT__) | |
| /*@refs@*/ | | /*@refs@*/ | |
| int nrefs; /*!< (unused) keep splint happy */ | | int nrefs; /*!< (unused) keep splint happy */ | |
| #endif | | #endif | |
| }; | | }; | |
| #endif /* _RPMPGP_INTERNAL */ | | #endif /* _RPMPGP_INTERNAL */ | |
| | | | |
| /** | | /** | |
| */ | | */ | |
| typedef const struct pgpValTbl_s { | | typedef const struct pgpValTbl_s { | |
| | | | |
| skipping to change at line 1650 | | skipping to change at line 1660 | |
| return crc & 0xffffff; | | return crc & 0xffffff; | |
| } | | } | |
| | | | |
| /** | | /** | |
| */ | | */ | |
| typedef int (*pgpImplSet_t) (/*@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigP
arams sigp) | | typedef int (*pgpImplSet_t) (/*@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigP
arams sigp) | |
| /*@modifies ctx, dig @*/; | | /*@modifies ctx, dig @*/; | |
| | | | |
| /** | | /** | |
| */ | | */ | |
|
| | | typedef int (*pgpImplErrChk_t) (pgpDig dig, const char * msg, int rc, unsig | |
| | | ned expected) | |
| | | /*@*/; | |
| | | | |
| | | /** | |
| | | */ | |
| | | typedef int (*pgpImplAvailable_t) (pgpDig dig, int algo) | |
| | | /*@*/; | |
| | | | |
| | | /** | |
| | | */ | |
| | | typedef int (*pgpImplGenerate_t) (pgpDig dig) | |
| | | /*@*/; | |
| | | | |
| | | /** | |
| | | */ | |
| | | typedef int (*pgpImplSign_t) (pgpDig dig) | |
| | | /*@*/; | |
| | | | |
| | | /** | |
| | | */ | |
| typedef int (*pgpImplVerify_t) (pgpDig dig) | | typedef int (*pgpImplVerify_t) (pgpDig dig) | |
| /*@*/; | | /*@*/; | |
| | | | |
| /** | | /** | |
| */ | | */ | |
| typedef int (*pgpImplMpiItem_t) (const char * pre, pgpDig dig, int itemno, | | typedef int (*pgpImplMpiItem_t) (const char * pre, pgpDig dig, int itemno, | |
| const rpmuint8_t * p, /*@null@*/ const rpmuint8_t * pend) | | const rpmuint8_t * p, /*@null@*/ const rpmuint8_t * pend) | |
| /*@globals fileSystem @*/ | | /*@globals fileSystem @*/ | |
| /*@modifies dig, fileSystem @*/; | | /*@modifies dig, fileSystem @*/; | |
| | | | |
| | | | |
| skipping to change at line 1679 | | skipping to change at line 1709 | |
| | | | |
| /** | | /** | |
| */ | | */ | |
| typedef void * (*pgpImplInit_t) (void) | | typedef void * (*pgpImplInit_t) (void) | |
| /*@*/; | | /*@*/; | |
| | | | |
| /** | | /** | |
| */ | | */ | |
| typedef struct pgpImplVecs_s { | | typedef struct pgpImplVecs_s { | |
| pgpImplSet_t _pgpSetRSA; | | pgpImplSet_t _pgpSetRSA; | |
|
| pgpImplVerify_t _pgpVerifyRSA; | | | |
| pgpImplSet_t _pgpSetDSA; | | pgpImplSet_t _pgpSetDSA; | |
|
| pgpImplVerify_t _pgpVerifyDSA; | | pgpImplSet_t _pgpSetELG; | |
| pgpImplSet_t _pgpSetECDSA; | | pgpImplSet_t _pgpSetECDSA; | |
|
| pgpImplVerify_t _pgpVerifyECDSA; | | | |
| | | pgpImplErrChk_t _pgpErrChk; | |
| | | pgpImplAvailable_t _pgpAvailableCipher; | |
| | | pgpImplAvailable_t _pgpAvailableDigest; | |
| | | pgpImplAvailable_t _pgpAvailablePubkey; | |
| | | | |
| | | pgpImplVerify_t _pgpVerify; | |
| | | pgpImplSign_t _pgpSign; | |
| | | pgpImplGenerate_t _pgpGenerate; | |
| | | | |
| pgpImplMpiItem_t _pgpMpiItem; | | pgpImplMpiItem_t _pgpMpiItem; | |
| pgpImplClean_t _pgpClean; | | pgpImplClean_t _pgpClean; | |
| pgpImplFree_t _pgpFree; | | pgpImplFree_t _pgpFree; | |
| pgpImplInit_t _pgpInit; | | pgpImplInit_t _pgpInit; | |
| } pgpImplVecs_t; | | } pgpImplVecs_t; | |
| | | | |
| /** | | /** | |
| */ | | */ | |
| /*@unchecked@*/ | | /*@unchecked@*/ | |
| extern pgpImplVecs_t * pgpImplVecs; | | extern pgpImplVecs_t * pgpImplVecs; | |
| | | | |
| skipping to change at line 1708 | | skipping to change at line 1746 | |
| /*@unused@*/ static inline | | /*@unused@*/ static inline | |
| int pgpImplSetRSA(/*@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp) | | int pgpImplSetRSA(/*@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp) | |
| /*@modifies ctx, dig @*/ | | /*@modifies ctx, dig @*/ | |
| { | | { | |
| return (*pgpImplVecs->_pgpSetRSA) (ctx, dig, sigp); | | return (*pgpImplVecs->_pgpSetRSA) (ctx, dig, sigp); | |
| } | | } | |
| | | | |
| /** | | /** | |
| */ | | */ | |
| /*@unused@*/ static inline | | /*@unused@*/ static inline | |
|
| int pgpImplVerifyRSA(pgpDig dig) | | int pgpImplSetDSA(/*@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp) | |
| /*@*/ | | /*@modifies ctx, dig @*/ | |
| { | | { | |
|
| return (*pgpImplVecs->_pgpVerifyRSA) (dig); | | return (*pgpImplVecs->_pgpSetDSA) (ctx, dig, sigp); | |
| } | | } | |
| | | | |
| /** | | /** | |
| */ | | */ | |
| /*@unused@*/ static inline | | /*@unused@*/ static inline | |
|
| int pgpImplSetDSA(/*@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp) | | int pgpImplSetELG(/*@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp) | |
| /*@modifies ctx, dig @*/ | | /*@modifies ctx, dig @*/ | |
| { | | { | |
|
| return (*pgpImplVecs->_pgpSetDSA) (ctx, dig, sigp); | | return (*pgpImplVecs->_pgpSetELG) (ctx, dig, sigp); | |
| } | | } | |
| | | | |
| /** | | /** | |
| */ | | */ | |
| /*@unused@*/ static inline | | /*@unused@*/ static inline | |
|
| int pgpImplVerifyDSA(pgpDig dig) | | int pgpImplSetECDSA(/*@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sig | |
| | | p) | |
| | | /*@modifies ctx, dig @*/ | |
| | | { | |
| | | return (*pgpImplVecs->_pgpSetECDSA) (ctx, dig, sigp); | |
| | | } | |
| | | | |
| | | /** | |
| | | */ | |
| | | /*@unused@*/ static inline | |
| | | int pgpImplErrChk(pgpDig dig, const char * msg, int rc, unsigned expected) | |
| /*@*/ | | /*@*/ | |
| { | | { | |
|
| return (*pgpImplVecs->_pgpVerifyDSA) (dig); | | return (pgpImplVecs->_pgpErrChk | |
| | | ? (*pgpImplVecs->_pgpErrChk) (dig, msg, rc, expected) | |
| | | : rc); | |
| } | | } | |
| | | | |
| /** | | /** | |
| */ | | */ | |
| /*@unused@*/ static inline | | /*@unused@*/ static inline | |
|
| int pgpImplSetECDSA(/*@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sig | | int pgpImplAvailableCipher(pgpDig dig, int algo) | |
| p) | | /*@*/ | |
| /*@modifies ctx, dig @*/ | | | |
| { | | { | |
|
| return (*pgpImplVecs->_pgpSetECDSA) (ctx, dig, sigp); | | return (pgpImplVecs->_pgpAvailableCipher | |
| | | ? (*pgpImplVecs->_pgpAvailableCipher) (dig, algo) | |
| | | : 0); | |
| } | | } | |
| | | | |
| /** | | /** | |
| */ | | */ | |
| /*@unused@*/ static inline | | /*@unused@*/ static inline | |
|
| int pgpImplVerifyECDSA(pgpDig dig) | | int pgpImplAvailableDigest(pgpDig dig, int algo) | |
| /*@*/ | | /*@*/ | |
| { | | { | |
|
| return (*pgpImplVecs->_pgpVerifyECDSA) (dig); | | return (pgpImplVecs->_pgpAvailableDigest | |
| | | ? (*pgpImplVecs->_pgpAvailableDigest) (dig, algo) | |
| | | : 0); | |
| | | } | |
| | | | |
| | | /** | |
| | | */ | |
| | | /*@unused@*/ static inline | |
| | | int pgpImplAvailablePubkey(pgpDig dig, int algo) | |
| | | /*@*/ | |
| | | { | |
| | | return (pgpImplVecs->_pgpAvailablePubkey | |
| | | ? (*pgpImplVecs->_pgpAvailablePubkey) (dig, algo) | |
| | | : 0); | |
| | | } | |
| | | | |
| | | /** | |
| | | */ | |
| | | /*@unused@*/ static inline | |
| | | int pgpImplVerify(pgpDig dig) | |
| | | /*@*/ | |
| | | { | |
| | | return (pgpImplVecs->_pgpVerify | |
| | | ? (*pgpImplVecs->_pgpVerify) (dig) | |
| | | : 0); | |
| | | } | |
| | | | |
| | | /** | |
| | | */ | |
| | | /*@unused@*/ static inline | |
| | | int pgpImplSign(pgpDig dig) | |
| | | /*@*/ | |
| | | { | |
| | | return (pgpImplVecs->_pgpSign | |
| | | ? (*pgpImplVecs->_pgpSign) (dig) | |
| | | : 0); | |
| | | } | |
| | | | |
| | | /** | |
| | | */ | |
| | | /*@unused@*/ static inline | |
| | | int pgpImplGenerate(pgpDig dig) | |
| | | /*@*/ | |
| | | { | |
| | | return (pgpImplVecs->_pgpGenerate | |
| | | ? (*pgpImplVecs->_pgpGenerate) (dig) | |
| | | : 0); | |
| } | | } | |
| | | | |
| /** | | /** | |
| */ | | */ | |
| /*@unused@*/ static inline | | /*@unused@*/ static inline | |
| int pgpImplMpiItem(const char * pre, pgpDig dig, int itemno, | | int pgpImplMpiItem(const char * pre, pgpDig dig, int itemno, | |
| const rpmuint8_t * p, /*@null@*/ const rpmuint8_t * pend) | | const rpmuint8_t * p, /*@null@*/ const rpmuint8_t * pend) | |
| /*@modifies dig @*/ | | /*@modifies dig @*/ | |
| { | | { | |
| return (*pgpImplVecs->_pgpMpiItem) (pre, dig, itemno, p, pend); | | return (*pgpImplVecs->_pgpMpiItem) (pre, dig, itemno, p, pend); | |
| | | | |
End of changes. 18 change blocks. |
| 18 lines changed or deleted | | 116 lines changed or added | |
|