aes.h
1 
31 WOLFSSL_API int wc_AesSetKey(Aes* aes, const byte* key, word32 len,
32  const byte* iv, int dir);
33 
61 WOLFSSL_API int wc_AesSetIV(Aes* aes, const byte* iv);
62 
103 WOLFSSL_API int wc_AesCbcEncrypt(Aes* aes, byte* out,
104  const byte* in, word32 sz);
105 
146 WOLFSSL_API int wc_AesCbcDecrypt(Aes* aes, byte* out,
147  const byte* in, word32 sz);
148 
191 WOLFSSL_API int wc_AesCtrEncrypt(Aes* aes, byte* out,
192  const byte* in, word32 sz);
193 
222 WOLFSSL_API void wc_AesEncryptDirect(Aes* aes, byte* out, const byte* in);
223 
256 WOLFSSL_API void wc_AesDecryptDirect(Aes* aes, byte* out, const byte* in);
257 
296 WOLFSSL_API int wc_AesSetKeyDirect(Aes* aes, const byte* key, word32 len,
297  const byte* iv, int dir);
298 
326 WOLFSSL_API int wc_AesGcmSetKey(Aes* aes, const byte* key, word32 len);
327 
371 WOLFSSL_API int wc_AesGcmEncrypt(Aes* aes, byte* out,
372  const byte* in, word32 sz,
373  const byte* iv, word32 ivSz,
374  byte* authTag, word32 authTagSz,
375  const byte* authIn, word32 authInSz);
376 
420 WOLFSSL_API int wc_AesGcmDecrypt(Aes* aes, byte* out,
421  const byte* in, word32 sz,
422  const byte* iv, word32 ivSz,
423  const byte* authTag, word32 authTagSz,
424  const byte* authIn, word32 authInSz);
425 
447 WOLFSSL_API int wc_GmacSetKey(Gmac* gmac, const byte* key, word32 len);
448 
483 WOLFSSL_API int wc_GmacUpdate(Gmac* gmac, const byte* iv, word32 ivSz,
484  const byte* authIn, word32 authInSz,
485  byte* authTag, word32 authTagSz);
486 
510 WOLFSSL_API int wc_AesCcmSetKey(Aes* aes, const byte* key, word32 keySz);
511 
555 WOLFSSL_API int wc_AesCcmEncrypt(Aes* aes, byte* out,
556  const byte* in, word32 inSz,
557  const byte* nonce, word32 nonceSz,
558  byte* authTag, word32 authTagSz,
559  const byte* authIn, word32 authInSz);
560 
610 WOLFSSL_API int wc_AesCcmDecrypt(Aes* aes, byte* out,
611  const byte* in, word32 inSz,
612  const byte* nonce, word32 nonceSz,
613  const byte* authTag, word32 authTagSz,
614  const byte* authIn, word32 authInSz);
615 
648 WOLFSSL_API int wc_AesXtsSetKey(XtsAes* aes, const byte* key,
649  word32 len, int dir, void* heap, int devId);
650 
687 WOLFSSL_API int wc_AesXtsEncryptSector(XtsAes* aes, byte* out,
688  const byte* in, word32 sz, word64 sector);
689 
726 WOLFSSL_API int wc_AesXtsDecryptSector(XtsAes* aes, byte* out,
727  const byte* in, word32 sz, word64 sector);
728 
766 WOLFSSL_API int wc_AesXtsEncrypt(XtsAes* aes, byte* out,
767  const byte* in, word32 sz, const byte* i, word32 iSz);
768 
805 WOLFSSL_API int wc_AesXtsDecrypt(XtsAes* aes, byte* out,
806  const byte* in, word32 sz, const byte* i, word32 iSz);
807 
832 WOLFSSL_API int wc_AesXtsFree(XtsAes* aes);
833 
834 
859 WOLFSSL_API int wc_AesInit(Aes*, void*, int);
860 
WOLFSSL_API int wc_AesCbcDecrypt(Aes *aes, byte *out, const byte *in, word32 sz)
Decrypts a cipher from the input buffer in, and places the resulting plain text in the output buffer ...
Definition: aes.c:3008
WOLFSSL_API void wc_AesEncryptDirect(Aes *aes, byte *out, const byte *in)
This function is a one-block encrypt of the input block, in, into the output block, out. It uses the key and iv (initialization vector) of the provided AES structure, which should be initialized with wc_AesSetKey before calling this function. It is only enabled if the configure option WOLFSSL_AES_DIRECT is enabled. Warning: In nearly all use cases ECB mode is considered to be less secure. Please avoid using ECB API’s directly whenever possible.
Definition: aes.c:2860
Definition: aes.h:239
WOLFSSL_API int wc_AesCcmEncrypt(Aes *aes, byte *out, const byte *in, word32 inSz, const byte *nonce, word32 nonceSz, byte *authTag, word32 authTagSz, const byte *authIn, word32 authInSz)
This function encrypts the input message, in, into the output buffer, out, using CCM (Counter with CB...
Definition: aes.c:6985
Definition: aes.h:246
WOLFSSL_API int wc_AesXtsEncrypt(XtsAes *aes, byte *out, const byte *in, word32 sz, const byte *i, word32 iSz)
AES with XTS mode. (XTS) XEX encryption with Tweak and cipher text Stealing.
Definition: aes.c:8465
WOLFSSL_API int wc_AesXtsDecrypt(XtsAes *aes, byte *out, const byte *in, word32 sz, const byte *i, word32 iSz)
Same process as encryption but Aes key is AES_DECRYPTION type.
Definition: aes.c:8573
WOLFSSL_API int wc_AesXtsEncryptSector(XtsAes *aes, byte *out, const byte *in, word32 sz, word64 sector)
Same process as wc_AesXtsEncrypt but uses a word64 type as the tweak value instead of a byte array...
Definition: aes.c:8368
WOLFSSL_API int wc_GmacSetKey(Gmac *gmac, const byte *key, word32 len)
This function initializes and sets the key for a GMAC object to be used for Galois Message Authentica...
Definition: aes.c:6943
WOLFSSL_API int wc_AesCbcEncrypt(Aes *aes, byte *out, const byte *in, word32 sz)
Encrypts a plaintext message from the input buffer in, and places the resulting cipher text in the ou...
Definition: aes.c:2951
Definition: aes.h:149
WOLFSSL_API int wc_AesInit(Aes *, void *, int)
Initialize Aes structure. Sets heap hint to be used and ID for use with async hardware.
Definition: aes.c:7447
WOLFSSL_API int wc_AesXtsFree(XtsAes *aes)
This is to free up any resources used by the XtsAes structure.
Definition: aes.c:8345
WOLFSSL_API int wc_AesXtsSetKey(XtsAes *aes, const byte *key, word32 len, int dir, void *heap, int devId)
This is to help with setting keys to correct encrypt or decrypt type. It is up to user to call wc_Aes...
Definition: aes.c:8304
WOLFSSL_API int wc_AesCcmSetKey(Aes *aes, const byte *key, word32 keySz)
This function sets the key for an AES object using CCM (Counter with CBC-MAC). It takes a pointer to ...
Definition: aes.c:6965
WOLFSSL_API int wc_AesCcmDecrypt(Aes *aes, byte *out, const byte *in, word32 inSz, const byte *nonce, word32 nonceSz, const byte *authTag, word32 authTagSz, const byte *authIn, word32 authInSz)
This function decrypts the input cipher text, in, into the output buffer, out, using CCM (Counter wit...
Definition: aes.c:7013
WOLFSSL_API int wc_AesSetIV(Aes *aes, const byte *iv)
This function sets the initialization vector for a particular AES object. The AES object should be in...
Definition: aes.c:2840
WOLFSSL_API int wc_GmacUpdate(Gmac *gmac, const byte *iv, word32 ivSz, const byte *authIn, word32 authInSz, byte *authTag, word32 authTagSz)
This function generates the Gmac hash of the authIn input and stores the result in the authTag buffer...
Definition: aes.c:6952
WOLFSSL_API int wc_AesGcmSetKey(Aes *aes, const byte *key, word32 len)
This function is used to set the key for AES GCM (Galois/Counter Mode). It initializes an AES object ...
Definition: aes.c:4118
WOLFSSL_API int wc_AesGcmDecrypt(Aes *aes, byte *out, const byte *in, word32 sz, const byte *iv, word32 ivSz, const byte *authTag, word32 authTagSz, const byte *authIn, word32 authInSz)
This function decrypts the input cipher text, held in the buffer in, and stores the resulting message...
Definition: aes.c:6319
WOLFSSL_API int wc_AesSetKey(Aes *aes, const byte *key, word32 len, const byte *iv, int dir)
This function initializes an AES structure by setting the key and then setting the initialization vec...
Definition: aes.c:2178
WOLFSSL_API void wc_AesDecryptDirect(Aes *aes, byte *out, const byte *in)
This function is a one-block decrypt of the input block, in, into the output block, out. It uses the key and iv (initialization vector) of the provided AES structure, which should be initialized with wc_AesSetKey before calling this function. It is only enabled if the configure option WOLFSSL_AES_DIRECT is enabled, and there is support for direct AES encryption on the system in question. Warning: In nearly all use cases ECB mode is considered to be less secure. Please avoid using ECB API’s directly whenever possible.
Definition: aes.c:2873
WOLFSSL_API int wc_AesGcmEncrypt(Aes *aes, byte *out, const byte *in, word32 sz, const byte *iv, word32 ivSz, byte *authTag, word32 authTagSz, const byte *authIn, word32 authInSz)
This function encrypts the input message, held in the buffer in, and stores the resulting cipher text...
Definition: aes.c:5885
WOLFSSL_API int wc_AesCtrEncrypt(Aes *aes, byte *out, const byte *in, word32 sz)
Encrypts/Decrypts a message from the input buffer in, and places the resulting cipher text in the out...
Definition: aes.c:3859
WOLFSSL_API int wc_AesSetKeyDirect(Aes *aes, const byte *key, word32 len, const byte *iv, int dir)
This function is used to set the AES keys for CTR mode with AES. It initializes an AES object with th...
Definition: aes.c:2208
WOLFSSL_API int wc_AesXtsDecryptSector(XtsAes *aes, byte *out, const byte *in, word32 sz, word64 sector)
Same process as wc_AesXtsDecrypt but uses a word64 type as the tweak value instead of a byte array...
Definition: aes.c:8396