VirtualBox

Changeset 85121 in vbox for trunk/include/iprt/crypto


Ignore:
Timestamp:
Jul 8, 2020 7:33:26 PM (5 years ago)
Author:
vboxsync
Message:

iprt/cdefs.h: Refactored the typedef use of DECLCALLBACK as well as DECLCALLBACKMEMBER to wrap the whole expression, similar to the DECLR?CALLBACKMEMBER macros. This allows adding a throw() at the end when compiling with the VC++ compiler to indicate that the callbacks won't throw anything, so we can stop supressing the C5039 warning about passing functions that can potential throw C++ exceptions to extern C code that can't necessarily cope with such (unwind,++). Introduced a few _EX variations that allows specifying different/no calling convention too, as that's handy when dynamically resolving host APIs. Fixed numerous places missing DECLCALLBACK and such. Left two angry @todos regarding use of CreateThread. bugref:9794

Location:
trunk/include/iprt/crypto
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/crypto/applecodesign.h

    r84509 r85121  
    252252 * @param   pvUser      User argument.
    253253 */
    254 typedef DECLCALLBACK(int) FNRTCRAPPLECSDIGESTAREA(RTCRDIGEST hDigest, size_t off, size_t cb, void *pvUser);
     254typedef DECLCALLBACKTYPE(int, FNRTCRAPPLECSDIGESTAREA,(RTCRDIGEST hDigest, size_t off, size_t cb, void *pvUser));
    255255/** Pointer to a image digest callback. */
    256256typedef FNRTCRAPPLECSDIGESTAREA *PFNRTCRAPPLECSDIGESTAREA;
  • trunk/include/iprt/crypto/digest.h

    r82968 r85121  
    6666     * Allocates the digest data.
    6767     */
    68     DECLCALLBACKMEMBER(void *, pfnNew)(void);
     68    DECLCALLBACKMEMBER(void *, pfnNew,(void));
    6969
    7070    /**
     
    7373     * @param   pvState     The opaque message digest state.
    7474     */
    75     DECLCALLBACKMEMBER(void, pfnFree)(void *pvState);
     75    DECLCALLBACKMEMBER(void, pfnFree,(void *pvState));
    7676
    7777    /**
     
    8282     * @param   cbData      The amount of data to add to the digest.
    8383     */
    84     DECLCALLBACKMEMBER(void, pfnUpdate)(void *pvState, const void *pvData, size_t cbData);
     84    DECLCALLBACKMEMBER(void, pfnUpdate,(void *pvState, const void *pvData, size_t cbData));
    8585
    8686    /**
     
    9191     *                      least RTCRDIGESTDESC::cbHash bytes large.
    9292     */
    93     DECLCALLBACKMEMBER(void, pfnFinal)(void *pvState, uint8_t *pbHash);
     93    DECLCALLBACKMEMBER(void, pfnFinal,(void *pvState, uint8_t *pbHash));
    9494
    9595    /**
     
    103103     * @param   fReInit     Set if this is a re-init call.
    104104     */
    105     DECLCALLBACKMEMBER(int, pfnInit)(void *pvState, void *pvOpaque, bool fReInit);
     105    DECLCALLBACKMEMBER(int, pfnInit,(void *pvState, void *pvOpaque, bool fReInit));
    106106
    107107    /**
     
    112112     * @param   pvState     The opaque message digest state.
    113113     */
    114     DECLCALLBACKMEMBER(void, pfnDelete)(void *pvState);
     114    DECLCALLBACKMEMBER(void, pfnDelete,(void *pvState));
    115115
    116116    /**
     
    123123     * @param   pvSrcState  The opaque message digest state to clone (source).
    124124     */
    125     DECLCALLBACKMEMBER(int, pfnClone)(void *pvState, void const *pvSrcState);
     125    DECLCALLBACKMEMBER(int, pfnClone,(void *pvState, void const *pvSrcState));
    126126
    127127    /**
     
    135135     * @param   pvState     The opaque message digest state.
    136136     */
    137     DECLCALLBACKMEMBER(uint32_t, pfnGetHashSize)(void *pvState);
     137    DECLCALLBACKMEMBER(uint32_t, pfnGetHashSize,(void *pvState));
    138138
    139139    /**
     
    143143     * @param   pvState     The opaque message digest state.
    144144     */
    145     DECLCALLBACKMEMBER(RTDIGESTTYPE, pfnGetDigestType)(void *pvState);
     145    DECLCALLBACKMEMBER(RTDIGESTTYPE, pfnGetDigestType,(void *pvState));
    146146} RTCRDIGESTDESC;
    147147/** Pointer to const message digest details and vtable. */
  • trunk/include/iprt/crypto/pkcs7.h

    r84380 r85121  
    485485 * @param   pErrInfo            Optional error info buffer.
    486486 */
    487 typedef DECLCALLBACK(int) FNRTCRPKCS7VERIFYCERTCALLBACK(PCRTCRX509CERTIFICATE pCert, RTCRX509CERTPATHS hCertPaths,
    488                                                         uint32_t fFlags, void *pvUser, PRTERRINFO pErrInfo);
     487typedef DECLCALLBACKTYPE(int, FNRTCRPKCS7VERIFYCERTCALLBACK,(PCRTCRX509CERTIFICATE pCert, RTCRX509CERTPATHS hCertPaths,
     488                                                             uint32_t fFlags, void *pvUser, PRTERRINFO pErrInfo));
    489489/** Pointer to a FNRTCRPKCS7VERIFYCERTCALLBACK callback. */
    490490typedef FNRTCRPKCS7VERIFYCERTCALLBACK *PFNRTCRPKCS7VERIFYCERTCALLBACK;
  • trunk/include/iprt/crypto/pkix.h

    r84251 r85121  
    200200     *                          none.
    201201     */
    202     DECLCALLBACKMEMBER(int, pfnInit)(struct RTCRPKIXSIGNATUREDESC const *pDesc, void *pvState, void *pvOpaque, bool fSigning,
    203                                      RTCRKEY hKey, PCRTASN1DYNTYPE pParams);
     202    DECLCALLBACKMEMBER(int, pfnInit,(struct RTCRPKIXSIGNATUREDESC const *pDesc, void *pvState, void *pvOpaque, bool fSigning,
     203                                     RTCRKEY hKey, PCRTASN1DYNTYPE pParams));
    204204
    205205    /**
     
    214214     * @param   fSigning        Exactly the same value as the init call.
    215215     */
    216     DECLCALLBACKMEMBER(int, pfnReset)(struct RTCRPKIXSIGNATUREDESC const *pDesc, void *pvState, bool fSigning);
     216    DECLCALLBACKMEMBER(int, pfnReset,(struct RTCRPKIXSIGNATUREDESC const *pDesc, void *pvState, bool fSigning));
    217217
    218218    /**
     
    226226     * @param   fSigning        Exactly the same value as the init call.
    227227     */
    228     DECLCALLBACKMEMBER(void, pfnDelete)(struct RTCRPKIXSIGNATUREDESC const *pDesc, void *pvState, bool fSigning);
     228    DECLCALLBACKMEMBER(void, pfnDelete,(struct RTCRPKIXSIGNATUREDESC const *pDesc, void *pvState, bool fSigning));
    229229
    230230    /**
     
    249249     * @param   cbSignature     The size of the signature (in bytes).
    250250     */
    251     DECLCALLBACKMEMBER(int, pfnVerify)(struct RTCRPKIXSIGNATUREDESC const *pDesc, void *pvState, RTCRKEY hKey,
    252                                        RTCRDIGEST hDigest, void const *pvSignature, size_t cbSignature);
     251    DECLCALLBACKMEMBER(int, pfnVerify,(struct RTCRPKIXSIGNATUREDESC const *pDesc, void *pvState, RTCRKEY hKey,
     252                                       RTCRDIGEST hDigest, void const *pvSignature, size_t cbSignature));
    253253
    254254    /**
     
    277277     *                          case of VERR_BUFFER_OVERFLOW.
    278278     */
    279     DECLCALLBACKMEMBER(int, pfnSign)(struct RTCRPKIXSIGNATUREDESC const *pDesc, void *pvState, RTCRKEY hKey,
    280                                      RTCRDIGEST hDigest, void *pvSignature, size_t *pcbSignature);
     279    DECLCALLBACKMEMBER(int, pfnSign,(struct RTCRPKIXSIGNATUREDESC const *pDesc, void *pvState, RTCRKEY hKey,
     280                                     RTCRDIGEST hDigest, void *pvSignature, size_t *pcbSignature));
    281281
    282282} RTCRPKIXSIGNATUREDESC;
     
    435435     *                          none.
    436436     */
    437     DECLCALLBACKMEMBER(int, pfnInit)(struct RTCRPKIXENCRYPTIONDESC const *pDesc, void *pvState, void *pvOpaque, bool fEncrypt,
    438                                      PCRTASN1BITSTRING pKey, PCRTASN1DYNTYPE pParams);
     437    DECLCALLBACKMEMBER(int, pfnInit,(struct RTCRPKIXENCRYPTIONDESC const *pDesc, void *pvState, void *pvOpaque, bool fEncrypt,
     438                                     PCRTASN1BITSTRING pKey, PCRTASN1DYNTYPE pParams));
    439439
    440440    /**
     
    451451     * @param   enmOperation    Same as for the earlier pfnInit call.
    452452     */
    453     DECLCALLBACKMEMBER(int, pfnReset)(struct RTCRPKIXENCRYPTIONDESC const *pDesc, void *pvState, bool fEncrypt);
     453    DECLCALLBACKMEMBER(int, pfnReset,(struct RTCRPKIXENCRYPTIONDESC const *pDesc, void *pvState, bool fEncrypt));
    454454
    455455    /**
     
    464464     * @param   enmOperation    Same as for the earlier pfnInit call.
    465465     */
    466     DECLCALLBACKMEMBER(void, pfnDelete)(struct RTCRPKIXENCRYPTIONDESC const *pDesc, void *pvState, bool fEncrypt);
     466    DECLCALLBACKMEMBER(void, pfnDelete,(struct RTCRPKIXENCRYPTIONDESC const *pDesc, void *pvState, bool fEncrypt));
    467467
    468468    /**
     
    487487     * @param   fFinal          Whether this is the final call.
    488488     */
    489     DECLCALLBACKMEMBER(int, pfnEncrypt)(struct RTCRPKIXENCRYPTIONDESC const *pDesc, void *pvState,
     489    DECLCALLBACKMEMBER(int, pfnEncrypt,(struct RTCRPKIXENCRYPTIONDESC const *pDesc, void *pvState,
    490490                                        void const *pvPlaintext, size_t cbPlaintext,
    491                                         void *pvCiphertext, size_t cbMaxCiphertext, size_t *pcbCiphertext, bool fFinal);
     491                                        void *pvCiphertext, size_t cbMaxCiphertext, size_t *pcbCiphertext, bool fFinal));
    492492
    493493    /**
     
    503503     * @param   fFinal          Whether this is the final call.
    504504     */
    505     DECLCALLBACKMEMBER(int, pfnEncryptLength)(struct RTCRPKIXENCRYPTIONDESC const *pDesc, void *pvState,
    506                                               size_t cbPlaintext, size_t *pcbCiphertext, bool fFinal);
     505    DECLCALLBACKMEMBER(int, pfnEncryptLength,(struct RTCRPKIXENCRYPTIONDESC const *pDesc, void *pvState,
     506                                              size_t cbPlaintext, size_t *pcbCiphertext, bool fFinal));
    507507
    508508    /**
     
    527527     * @param   fFinal          Whether this is the final call.
    528528     */
    529     DECLCALLBACKMEMBER(int, pfnDecrypt)(struct RTCRPKIXENCRYPTIONDESC const *pDesc, void *pvState,
     529    DECLCALLBACKMEMBER(int, pfnDecrypt,(struct RTCRPKIXENCRYPTIONDESC const *pDesc, void *pvState,
    530530                                        void const *pvCiphertext, size_t cbCiphertext,
    531                                         void *pvPlaintext, size_t cbMaxPlaintext, size_t *pcbPlaintext, bool fFinal);
     531                                        void *pvPlaintext, size_t cbMaxPlaintext, size_t *pcbPlaintext, bool fFinal));
    532532
    533533    /**
     
    543543     * @param   fFinal          Whether this is the final call.
    544544     */
    545     DECLCALLBACKMEMBER(int, pfnDecryptLength)(struct RTCRPKIXENCRYPTIONDESC const *pDesc, void *pvState,
    546                                               size_t cbCiphertext, size_t *pcbPlaintext, bool fFinal);
     545    DECLCALLBACKMEMBER(int, pfnDecryptLength,(struct RTCRPKIXENCRYPTIONDESC const *pDesc, void *pvState,
     546                                              size_t cbCiphertext, size_t *pcbPlaintext, bool fFinal));
    547547} RTCRPKIXENCRYPTIONDESC;
    548548/** Pointer to a public key encryption schema provider descriptor. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette