gnunet-android

GNUnet for Android
Log | Files | Refs | README

cryptocb.h (21016B)


      1 /* cryptocb.h
      2  *
      3  * Copyright (C) 2006-2025 wolfSSL Inc.
      4  *
      5  * This file is part of wolfSSL.
      6  *
      7  * wolfSSL is free software; you can redistribute it and/or modify
      8  * it under the terms of the GNU General Public License as published by
      9  * the Free Software Foundation; either version 3 of the License, or
     10  * (at your option) any later version.
     11  *
     12  * wolfSSL is distributed in the hope that it will be useful,
     13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15  * GNU General Public License for more details.
     16  *
     17  * You should have received a copy of the GNU General Public License
     18  * along with this program; if not, write to the Free Software
     19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20  */
     21 
     22 #ifndef _WOLF_CRYPTO_CB_H_
     23 #define _WOLF_CRYPTO_CB_H_
     24 
     25 #include <wolfssl/wolfcrypt/types.h>
     26 
     27 #ifdef __cplusplus
     28     extern "C" {
     29 #endif
     30 
     31 /* Defines the Crypto Callback interface version, for compatibility */
     32 /* Increment this when Crypto Callback interface changes are made */
     33 #define CRYPTO_CB_VER   2
     34 
     35 
     36 #ifdef WOLF_CRYPTO_CB
     37 
     38 #ifndef NO_RSA
     39     #include <wolfssl/wolfcrypt/rsa.h>
     40 #endif
     41 #ifdef HAVE_ECC
     42     #include <wolfssl/wolfcrypt/ecc.h>
     43 #endif
     44 #ifndef NO_AES
     45     #include <wolfssl/wolfcrypt/aes.h>
     46 #endif
     47 #ifndef NO_SHA
     48     #include <wolfssl/wolfcrypt/sha.h>
     49 #endif
     50 #ifndef NO_SHA256
     51     #include <wolfssl/wolfcrypt/sha256.h>
     52 #endif
     53 #ifdef WOLFSSL_SHA3
     54     #include <wolfssl/wolfcrypt/sha3.h>
     55 #endif
     56 #ifndef NO_HMAC
     57     #include <wolfssl/wolfcrypt/hmac.h>
     58 #endif
     59 #ifndef WC_NO_RNG
     60     #include <wolfssl/wolfcrypt/random.h>
     61 #endif
     62 #ifndef NO_DES3
     63     #include <wolfssl/wolfcrypt/des3.h>
     64 #endif
     65 #ifdef WOLFSSL_CMAC
     66     #include <wolfssl/wolfcrypt/cmac.h>
     67 #endif
     68 #ifdef HAVE_ED25519
     69     #include <wolfssl/wolfcrypt/ed25519.h>
     70 #endif
     71 #ifdef HAVE_CURVE25519
     72     #include <wolfssl/wolfcrypt/curve25519.h>
     73 #endif
     74 #if defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384)
     75     #include <wolfssl/wolfcrypt/sha512.h>
     76 #endif
     77 #ifdef WOLFSSL_HAVE_MLKEM
     78     #include <wolfssl/wolfcrypt/mlkem.h>
     79 #ifdef WOLFSSL_WC_MLKEM
     80     #include <wolfssl/wolfcrypt/wc_mlkem.h>
     81 #elif defined(HAVE_LIBOQS)
     82     #include <wolfssl/wolfcrypt/ext_mlkem.h>
     83 #endif
     84 #endif
     85 #if defined(HAVE_DILITHIUM)
     86     #include <wolfssl/wolfcrypt/dilithium.h>
     87 #endif
     88 #if defined(HAVE_FALCON)
     89     #include <wolfssl/wolfcrypt/falcon.h>
     90 #endif
     91 
     92 
     93 #ifdef WOLF_CRYPTO_CB_CMD
     94 /* CryptoCb Commands */
     95 enum wc_CryptoCbCmdType {
     96     WC_CRYPTOCB_CMD_TYPE_NONE = 0,
     97     WC_CRYPTOCB_CMD_TYPE_REGISTER,
     98     WC_CRYPTOCB_CMD_TYPE_UNREGISTER,
     99 
    100     WC_CRYPTOCB_CMD_TYPE_MAX = WC_CRYPTOCB_CMD_TYPE_UNREGISTER
    101 };
    102 #endif
    103 
    104 
    105 #if defined(HAVE_AESGCM) || defined(HAVE_AESCCM)
    106 typedef struct {
    107     Aes*        aes;
    108     byte*       out;
    109     const byte* in;
    110     word32      sz;
    111     const byte* nonce;
    112     word32      nonceSz;
    113     const byte* iv;
    114     word32      ivSz;
    115     byte*       authTag;
    116     word32      authTagSz;
    117     const byte* authIn;
    118     word32      authInSz;
    119 } wc_CryptoCb_AesAuthEnc;
    120 typedef struct {
    121     Aes*        aes;
    122     byte*       out;
    123     const byte* in;
    124     word32      sz;
    125     const byte* nonce;
    126     word32      nonceSz;
    127     const byte* iv;
    128     word32      ivSz;
    129     const byte* authTag;
    130     word32      authTagSz;
    131     const byte* authIn;
    132     word32      authInSz;
    133 } wc_CryptoCb_AesAuthDec;
    134 #endif
    135 
    136 /* Crypto Information Structure for callbacks */
    137 typedef struct wc_CryptoInfo {
    138     int algo_type; /* enum wc_AlgoType */
    139 #ifdef HAVE_ANONYMOUS_INLINE_AGGREGATES
    140     union {
    141 #endif
    142     struct {
    143         int type; /* enum wc_PkType */
    144 #ifdef HAVE_ANONYMOUS_INLINE_AGGREGATES
    145         union {
    146 #endif
    147         #ifndef NO_RSA
    148             struct {
    149                 const byte* in;
    150                 word32      inLen;
    151                 byte*       out;
    152                 word32*     outLen;
    153                 int         type;
    154                 RsaKey*     key;
    155                 WC_RNG*     rng;
    156             #ifdef WOLF_CRYPTO_CB_RSA_PAD
    157                 RsaPadding *padding;
    158             #endif
    159             } rsa;
    160         #ifdef WOLFSSL_KEY_GEN
    161             struct {
    162                 RsaKey* key;
    163                 int     size;
    164                 long    e;
    165                 WC_RNG* rng;
    166             } rsakg;
    167         #endif
    168             struct {
    169                 RsaKey*     key;
    170                 const byte* pubKey;
    171                 word32      pubKeySz;
    172             } rsa_check;
    173             struct {
    174                 const RsaKey* key;
    175                 int*          keySize;
    176             } rsa_get_size;
    177         #endif
    178         #ifdef HAVE_ECC
    179             #ifdef HAVE_ECC_DHE
    180             struct {
    181                 WC_RNG*  rng;
    182                 int      size;
    183                 ecc_key* key;
    184                 int      curveId;
    185             } eckg;
    186             struct {
    187                 ecc_key* private_key;
    188                 ecc_key* public_key;
    189                 byte*    out;
    190                 word32*  outlen;
    191             } ecdh;
    192             #endif
    193             #ifdef HAVE_ECC_SIGN
    194             struct {
    195                 const byte* in;
    196                 word32      inlen;
    197                 byte*       out;
    198                 word32*     outlen;
    199                 WC_RNG*     rng;
    200                 ecc_key*    key;
    201             } eccsign;
    202             #endif
    203             #ifdef HAVE_ECC_VERIFY
    204             struct {
    205                 const byte* sig;
    206                 word32      siglen;
    207                 const byte* hash;
    208                 word32      hashlen;
    209                 int*        res;
    210                 ecc_key*    key;
    211             } eccverify;
    212             #endif
    213             #ifdef HAVE_ECC_CHECK_KEY
    214             struct {
    215                 ecc_key*    key;
    216                 const byte* pubKey;
    217                 word32      pubKeySz;
    218             } ecc_check;
    219             #endif
    220         #endif /* HAVE_ECC */
    221         #ifdef HAVE_CURVE25519
    222             struct {
    223                 WC_RNG*  rng;
    224                 int      size;
    225                 curve25519_key* key;
    226                 int      curveId;
    227             } curve25519kg;
    228             struct {
    229                 curve25519_key* private_key;
    230                 curve25519_key* public_key;
    231                 byte*    out;
    232                 word32*  outlen;
    233                 int      endian;
    234             } curve25519;
    235         #endif
    236         #ifdef HAVE_ED25519
    237             struct {
    238                 WC_RNG*  rng;
    239                 int      size;
    240                 ed25519_key* key;
    241                 int      curveId;
    242             } ed25519kg;
    243             struct {
    244                 const byte*  in;
    245                 word32       inLen;
    246                 byte*        out;
    247                 word32*      outLen;
    248                 ed25519_key* key;
    249                 byte         type;
    250                 const byte*  context;
    251                 byte         contextLen;
    252             } ed25519sign;
    253             struct {
    254                 const byte*  sig;
    255                 word32       sigLen;
    256                 const byte*  msg;
    257                 word32       msgLen;
    258                 int*         res;
    259                 ed25519_key* key;
    260                 byte         type;
    261                 const byte*  context;
    262                 byte         contextLen;
    263             } ed25519verify;
    264         #endif
    265         #if defined(WOLFSSL_HAVE_MLKEM)
    266             struct {
    267                 WC_RNG*     rng;
    268                 int         size;
    269                 void*       key;
    270                 int         type; /* enum wc_PqcKemType */
    271             } pqc_kem_kg;
    272             struct {
    273                 byte*       ciphertext;
    274                 word32      ciphertextLen;
    275                 byte*       sharedSecret;
    276                 word32      sharedSecretLen;
    277                 WC_RNG*     rng;
    278                 void*       key;
    279                 int         type; /* enum wc_PqcKemType */
    280             } pqc_encaps;
    281             struct {
    282                 const byte* ciphertext;
    283                 word32      ciphertextLen;
    284                 byte*       sharedSecret;
    285                 word32      sharedSecretLen;
    286                 void*       key;
    287                 int         type; /* enum wc_PqcKemType */
    288             } pqc_decaps;
    289         #endif
    290         #if defined(HAVE_FALCON) || defined(HAVE_DILITHIUM)
    291             struct {
    292                 WC_RNG*     rng;
    293                 int         size;
    294                 void*       key;
    295                 int         type; /* enum wc_PqcSignatureType */
    296             } pqc_sig_kg;
    297             struct {
    298                 const byte* in;
    299                 word32      inlen;
    300                 byte*       out;
    301                 word32*     outlen;
    302                 WC_RNG*     rng;
    303                 void*       key;
    304                 int         type; /* enum wc_PqcSignatureType */
    305                 const byte* context;
    306                 byte        contextLen;
    307                 word32      preHashType; /* enum wc_HashType */
    308             } pqc_sign;
    309             struct {
    310                 const byte* sig;
    311                 word32      siglen;
    312                 const byte* msg;
    313                 word32      msglen;
    314                 int*        res;
    315                 void*       key;
    316                 int         type; /* enum wc_PqcSignatureType */
    317                 const byte* context;
    318                 byte        contextLen;
    319                 word32      preHashType; /* enum wc_HashType */
    320             } pqc_verify;
    321             struct {
    322                 void*       key;
    323                 const byte* pubKey;
    324                 word32      pubKeySz;
    325                 int         type; /* enum wc_PqcSignatureType */
    326             } pqc_sig_check;
    327         #endif
    328 #ifdef HAVE_ANONYMOUS_INLINE_AGGREGATES
    329         };
    330 #endif
    331     } pk;
    332 #if !defined(NO_AES) || !defined(NO_DES3)
    333     struct {
    334         int type; /* enum wc_CipherType */
    335         int enc;
    336 #ifdef HAVE_ANONYMOUS_INLINE_AGGREGATES
    337         union {
    338 #endif
    339         #ifdef HAVE_AESGCM
    340             wc_CryptoCb_AesAuthEnc aesgcm_enc;
    341             wc_CryptoCb_AesAuthDec aesgcm_dec;
    342         #endif /* HAVE_AESGCM */
    343         #ifdef HAVE_AESCCM
    344             wc_CryptoCb_AesAuthEnc aesccm_enc;
    345             wc_CryptoCb_AesAuthDec aesccm_dec;
    346         #endif /* HAVE_AESCCM */
    347         #if defined(HAVE_AES_CBC)
    348             struct {
    349                 Aes*        aes;
    350                 byte*       out;
    351                 const byte* in;
    352                 word32      sz;
    353             } aescbc;
    354         #endif /* HAVE_AES_CBC */
    355         #if defined(WOLFSSL_AES_COUNTER)
    356             struct {
    357                 Aes*        aes;
    358                 byte*       out;
    359                 const byte* in;
    360                 word32      sz;
    361             } aesctr;
    362         #endif /* WOLFSSL_AES_COUNTER */
    363         #if defined(HAVE_AES_ECB)
    364             struct {
    365                 Aes*        aes;
    366                 byte*       out;
    367                 const byte* in;
    368                 word32      sz;
    369             } aesecb;
    370         #endif /* HAVE_AES_ECB */
    371         #ifndef NO_DES3
    372             struct {
    373                 Des3*       des;
    374                 byte*       out;
    375                 const byte* in;
    376                 word32      sz;
    377             } des3;
    378         #endif
    379             void* ctx;
    380 #ifdef HAVE_ANONYMOUS_INLINE_AGGREGATES
    381         };
    382 #endif
    383     } cipher;
    384 #endif /* !NO_AES || !NO_DES3 */
    385 #if !defined(NO_SHA) || !defined(NO_SHA256) || \
    386     defined(WOLFSSL_SHA384) || defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA3)
    387     struct {
    388         int type; /* enum wc_HashType */
    389         const byte* in;
    390         word32 inSz;
    391         byte* digest;
    392 #ifdef HAVE_ANONYMOUS_INLINE_AGGREGATES
    393         union {
    394 #endif
    395         #ifndef NO_SHA
    396             wc_Sha* sha1;
    397         #endif
    398         #ifdef WOLFSSL_SHA224
    399             wc_Sha224* sha224;
    400         #endif
    401         #ifndef NO_SHA256
    402             wc_Sha256* sha256;
    403         #endif
    404         #ifdef WOLFSSL_SHA384
    405             wc_Sha384* sha384;
    406         #endif
    407         #ifdef WOLFSSL_SHA512
    408             wc_Sha512* sha512;
    409         #endif
    410         #ifdef WOLFSSL_SHA3
    411             wc_Sha3* sha3;
    412         #endif
    413             void* ctx;
    414 #ifdef HAVE_ANONYMOUS_INLINE_AGGREGATES
    415         };
    416 #endif
    417     } hash;
    418 #endif /* !NO_SHA || !NO_SHA256 */
    419 #ifndef NO_HMAC
    420     struct {
    421         int macType; /* enum wc_HashType */
    422         const byte* in;
    423         word32 inSz;
    424         byte* digest;
    425         Hmac* hmac;
    426     } hmac;
    427 #endif
    428 #ifndef WC_NO_RNG
    429     struct {
    430         WC_RNG* rng;
    431         byte* out;
    432         word32 sz;
    433     } rng;
    434     struct {
    435         OS_Seed* os;
    436         byte* seed;
    437         word32 sz;
    438     } seed;
    439 #endif
    440 #ifdef WOLFSSL_CMAC
    441     struct {
    442         Cmac* cmac;
    443         void* ctx;
    444         const byte* key;
    445         const byte* in;
    446         byte*       out;
    447         word32* outSz;
    448         word32  keySz;
    449         word32  inSz;
    450         int type;
    451     } cmac;
    452 #endif
    453 #ifndef NO_CERTS
    454     struct {
    455         const byte *id;
    456         word32 idLen;
    457         const char *label;
    458         word32 labelLen;
    459         byte **certDataOut;
    460         word32 *certSz;
    461         int *certFormatOut;
    462         void *heap;
    463     } cert;
    464 #endif
    465 #ifdef WOLF_CRYPTO_CB_CMD
    466     struct {      /* uses wc_AlgoType=ALGO_NONE */
    467         int type; /* enum wc_CryptoCbCmdType */
    468         void *ctx;
    469     } cmd;
    470 #endif
    471 #ifdef HAVE_ANONYMOUS_INLINE_AGGREGATES
    472     };
    473 #endif
    474 } wc_CryptoInfo;
    475 
    476 
    477 typedef int (*CryptoDevCallbackFunc)(int devId, struct wc_CryptoInfo* info, void* ctx);
    478 
    479 WOLFSSL_LOCAL void wc_CryptoCb_Init(void);
    480 WOLFSSL_LOCAL void wc_CryptoCb_Cleanup(void);
    481 WOLFSSL_LOCAL int wc_CryptoCb_GetDevIdAtIndex(int startIdx);
    482 WOLFSSL_API int  wc_CryptoCb_RegisterDevice(int devId, CryptoDevCallbackFunc cb, void* ctx);
    483 WOLFSSL_API void wc_CryptoCb_UnRegisterDevice(int devId);
    484 WOLFSSL_API int wc_CryptoCb_DefaultDevID(void);
    485 
    486 #ifdef WOLF_CRYPTO_CB_FIND
    487 typedef int (*CryptoDevCallbackFind)(int devId, int algoType);
    488 WOLFSSL_API void wc_CryptoCb_SetDeviceFindCb(CryptoDevCallbackFind cb);
    489 #endif
    490 
    491 #ifdef DEBUG_CRYPTOCB
    492 WOLFSSL_API void wc_CryptoCb_InfoString(wc_CryptoInfo* info);
    493 #endif
    494 
    495 /* old function names */
    496 #define wc_CryptoDev_RegisterDevice   wc_CryptoCb_RegisterDevice
    497 #define wc_CryptoDev_UnRegisterDevice wc_CryptoCb_UnRegisterDevice
    498 
    499 
    500 #ifndef NO_RSA
    501 WOLFSSL_LOCAL int wc_CryptoCb_Rsa(const byte* in, word32 inLen, byte* out,
    502     word32* outLen, int type, RsaKey* key, WC_RNG* rng);
    503 
    504 #ifdef WOLF_CRYPTO_CB_RSA_PAD
    505 WOLFSSL_LOCAL int wc_CryptoCb_RsaPad(const byte* in, word32 inLen, byte* out,
    506     word32* outLen, int type, RsaKey* key, WC_RNG* rng, RsaPadding *padding);
    507 #endif
    508 
    509 #ifdef WOLFSSL_KEY_GEN
    510 WOLFSSL_LOCAL int wc_CryptoCb_MakeRsaKey(RsaKey* key, int size, long e,
    511     WC_RNG* rng);
    512 #endif /* WOLFSSL_KEY_GEN */
    513 
    514 WOLFSSL_LOCAL int wc_CryptoCb_RsaCheckPrivKey(RsaKey* key, const byte* pubKey,
    515     word32 pubKeySz);
    516 WOLFSSL_LOCAL int wc_CryptoCb_RsaGetSize(const RsaKey* key, int* keySize);
    517 #endif /* !NO_RSA */
    518 
    519 #ifdef HAVE_ECC
    520 WOLFSSL_LOCAL int wc_CryptoCb_MakeEccKey(WC_RNG* rng, int keySize,
    521     ecc_key* key, int curveId);
    522 
    523 WOLFSSL_LOCAL int wc_CryptoCb_Ecdh(ecc_key* private_key, ecc_key* public_key,
    524     byte* out, word32* outlen);
    525 
    526 WOLFSSL_LOCAL int wc_CryptoCb_EccSign(const byte* in, word32 inlen, byte* out,
    527     word32 *outlen, WC_RNG* rng, ecc_key* key);
    528 
    529 WOLFSSL_LOCAL int wc_CryptoCb_EccVerify(const byte* sig, word32 siglen,
    530     const byte* hash, word32 hashlen, int* res, ecc_key* key);
    531 
    532 WOLFSSL_LOCAL int wc_CryptoCb_EccCheckPrivKey(ecc_key* key, const byte* pubKey,
    533     word32 pubKeySz);
    534 #endif /* HAVE_ECC */
    535 
    536 #ifdef HAVE_CURVE25519
    537 WOLFSSL_LOCAL int wc_CryptoCb_Curve25519Gen(WC_RNG* rng, int keySize,
    538     curve25519_key* key);
    539 
    540 WOLFSSL_LOCAL int wc_CryptoCb_Curve25519(curve25519_key* private_key,
    541     curve25519_key* public_key, byte* out, word32* outlen, int endian);
    542 #endif /* HAVE_CURVE25519 */
    543 
    544 #ifdef HAVE_ED25519
    545 WOLFSSL_LOCAL int wc_CryptoCb_Ed25519Gen(WC_RNG* rng, int keySize,
    546     ed25519_key* key);
    547 WOLFSSL_LOCAL int wc_CryptoCb_Ed25519Sign(const byte* in, word32 inLen,
    548     byte* out, word32 *outLen, ed25519_key* key, byte type, const byte* context,
    549     byte contextLen);
    550 WOLFSSL_LOCAL int wc_CryptoCb_Ed25519Verify(const byte* sig, word32 sigLen,
    551     const byte* msg, word32 msgLen, int* res, ed25519_key* key, byte type,
    552     const byte* context, byte contextLen);
    553 #endif /* HAVE_ED25519 */
    554 
    555 #if defined(WOLFSSL_HAVE_MLKEM)
    556 WOLFSSL_LOCAL int wc_CryptoCb_PqcKemGetDevId(int type, void* key);
    557 
    558 WOLFSSL_LOCAL int wc_CryptoCb_MakePqcKemKey(WC_RNG* rng, int type,
    559     int keySize, void* key);
    560 
    561 WOLFSSL_LOCAL int wc_CryptoCb_PqcEncapsulate(byte* ciphertext,
    562     word32 ciphertextLen, byte* sharedSecret, word32 sharedSecretLen,
    563     WC_RNG* rng, int type, void* key);
    564 
    565 WOLFSSL_LOCAL int wc_CryptoCb_PqcDecapsulate(const byte* ciphertext,
    566     word32 ciphertextLen, byte* sharedSecret, word32 sharedSecretLen,
    567     int type, void* key);
    568 #endif /* WOLFSSL_HAVE_MLKEM */
    569 
    570 #if defined(HAVE_FALCON) || defined(HAVE_DILITHIUM)
    571 WOLFSSL_LOCAL int wc_CryptoCb_PqcSigGetDevId(int type, void* key);
    572 
    573 WOLFSSL_LOCAL int wc_CryptoCb_MakePqcSignatureKey(WC_RNG* rng, int type,
    574     int keySize, void* key);
    575 
    576 WOLFSSL_LOCAL int wc_CryptoCb_PqcSign(const byte* in, word32 inlen, byte* out,
    577     word32 *outlen, const byte* context, byte contextLen, word32 preHashType,
    578     WC_RNG* rng, int type, void* key);
    579 
    580 WOLFSSL_LOCAL int wc_CryptoCb_PqcVerify(const byte* sig, word32 siglen,
    581     const byte* msg, word32 msglen, const byte* context, byte contextLen,
    582     word32 preHashType, int* res, int type, void* key);
    583 
    584 WOLFSSL_LOCAL int wc_CryptoCb_PqcSignatureCheckPrivKey(void* key, int type,
    585     const byte* pubKey, word32 pubKeySz);
    586 #endif /* HAVE_FALCON || HAVE_DILITHIUM */
    587 
    588 #ifndef NO_AES
    589 #ifdef HAVE_AESGCM
    590 WOLFSSL_LOCAL int wc_CryptoCb_AesGcmEncrypt(Aes* aes, byte* out,
    591      const byte* in, word32 sz, const byte* iv, word32 ivSz,
    592      byte* authTag, word32 authTagSz, const byte* authIn, word32 authInSz);
    593 
    594 WOLFSSL_LOCAL int wc_CryptoCb_AesGcmDecrypt(Aes* aes, byte* out,
    595      const byte* in, word32 sz, const byte* iv, word32 ivSz,
    596      const byte* authTag, word32 authTagSz,
    597      const byte* authIn, word32 authInSz);
    598 #endif /* HAVE_AESGCM */
    599 #ifdef HAVE_AESCCM
    600 WOLFSSL_LOCAL int wc_CryptoCb_AesCcmEncrypt(Aes* aes, byte* out,
    601     const byte* in, word32 sz,
    602     const byte* nonce, word32 nonceSz,
    603     byte* authTag, word32 authTagSz,
    604     const byte* authIn, word32 authInSz);
    605 
    606 WOLFSSL_LOCAL int wc_CryptoCb_AesCcmDecrypt(Aes* aes, byte* out,
    607     const byte* in, word32 sz,
    608     const byte* nonce, word32 nonceSz,
    609     const byte* authTag, word32 authTagSz,
    610     const byte* authIn, word32 authInSz);
    611 #endif /* HAVE_AESCCM */
    612 #ifdef HAVE_AES_CBC
    613 WOLFSSL_LOCAL int wc_CryptoCb_AesCbcEncrypt(Aes* aes, byte* out,
    614                                const byte* in, word32 sz);
    615 WOLFSSL_LOCAL int wc_CryptoCb_AesCbcDecrypt(Aes* aes, byte* out,
    616                                const byte* in, word32 sz);
    617 #endif /* HAVE_AES_CBC */
    618 #ifdef WOLFSSL_AES_COUNTER
    619 WOLFSSL_LOCAL int wc_CryptoCb_AesCtrEncrypt(Aes* aes, byte* out,
    620                                const byte* in, word32 sz);
    621 #endif /* WOLFSSL_AES_COUNTER */
    622 #ifdef HAVE_AES_ECB
    623 WOLFSSL_LOCAL int wc_CryptoCb_AesEcbEncrypt(Aes* aes, byte* out,
    624                                const byte* in, word32 sz);
    625 WOLFSSL_LOCAL int wc_CryptoCb_AesEcbDecrypt(Aes* aes, byte* out,
    626                                const byte* in, word32 sz);
    627 #endif /* HAVE_AES_ECB */
    628 #endif /* !NO_AES */
    629 
    630 #ifndef NO_DES3
    631 WOLFSSL_LOCAL int wc_CryptoCb_Des3Encrypt(Des3* des3, byte* out,
    632                                const byte* in, word32 sz);
    633 WOLFSSL_LOCAL int wc_CryptoCb_Des3Decrypt(Des3* des3, byte* out,
    634                                const byte* in, word32 sz);
    635 #endif /* !NO_DES3 */
    636 
    637 #ifndef NO_SHA
    638 WOLFSSL_LOCAL int wc_CryptoCb_ShaHash(wc_Sha* sha, const byte* in,
    639     word32 inSz, byte* digest);
    640 #endif /* !NO_SHA */
    641 
    642 #ifndef NO_SHA256
    643 WOLFSSL_LOCAL int wc_CryptoCb_Sha256Hash(wc_Sha256* sha256, const byte* in,
    644     word32 inSz, byte* digest);
    645 #endif /* !NO_SHA256 */
    646 #ifdef WOLFSSL_SHA384
    647 WOLFSSL_LOCAL int wc_CryptoCb_Sha384Hash(wc_Sha384* sha384, const byte* in,
    648     word32 inSz, byte* digest);
    649 #endif
    650 #ifdef WOLFSSL_SHA512
    651 WOLFSSL_LOCAL int wc_CryptoCb_Sha512Hash(wc_Sha512* sha512, const byte* in,
    652     word32 inSz, byte* digest);
    653 #endif
    654 
    655 #ifdef WOLFSSL_SHA3
    656 WOLFSSL_LOCAL int wc_CryptoCb_Sha3Hash(wc_Sha3* sha3, int type, const byte* in,
    657     word32 inSz, byte* digest);
    658 #endif
    659 
    660 #ifndef NO_HMAC
    661 WOLFSSL_LOCAL int wc_CryptoCb_Hmac(Hmac* hmac, int macType, const byte* in,
    662     word32 inSz, byte* digest);
    663 #endif /* !NO_HMAC */
    664 
    665 #ifndef WC_NO_RNG
    666 WOLFSSL_LOCAL int wc_CryptoCb_RandomBlock(WC_RNG* rng, byte* out, word32 sz);
    667 WOLFSSL_LOCAL int wc_CryptoCb_RandomSeed(OS_Seed* os, byte* seed, word32 sz);
    668 #endif
    669 
    670 #ifdef WOLFSSL_CMAC
    671 WOLFSSL_LOCAL int wc_CryptoCb_Cmac(Cmac* cmac, const byte* key, word32 keySz,
    672         const byte* in, word32 inSz, byte* out, word32* outSz, int type,
    673         void* ctx);
    674 #endif
    675 
    676 #ifndef NO_CERTS
    677 WOLFSSL_LOCAL int wc_CryptoCb_GetCert(int devId, const char *label,
    678     word32 labelLen, const byte *id, word32 idLen, byte** out,
    679     word32* outSz, int *format, void *heap);
    680 #endif
    681 
    682 #endif /* WOLF_CRYPTO_CB */
    683 
    684 #ifdef __cplusplus
    685     } /* extern "C" */
    686 #endif
    687 
    688 #endif /* _WOLF_CRYPTO_CB_H_ */