aes.h
Go to the documentation of this file.
1 
32 int wc_AesSetKey(Aes* aes, const byte* key, word32 len,
33  const byte* iv, int dir);
34 
62 int wc_AesSetIV(Aes* aes, const byte* iv);
63 
110 int wc_AesCbcEncrypt(Aes* aes, byte* out,
111  const byte* in, word32 sz);
112 
161 int wc_AesCbcDecrypt(Aes* aes, byte* out,
162  const byte* in, word32 sz);
163 
208 int wc_AesCtrEncrypt(Aes* aes, byte* out,
209  const byte* in, word32 sz);
210 
242 int wc_AesEncryptDirect(Aes* aes, byte* out, const byte* in);
243 
276 int wc_AesDecryptDirect(Aes* aes, byte* out, const byte* in);
277 
316 int wc_AesSetKeyDirect(Aes* aes, const byte* key, word32 len,
317  const byte* iv, int dir);
318 
346 int wc_AesGcmSetKey(Aes* aes, const byte* key, word32 len);
347 
393 int wc_AesGcmEncrypt(Aes* aes, byte* out,
394  const byte* in, word32 sz,
395  const byte* iv, word32 ivSz,
396  byte* authTag, word32 authTagSz,
397  const byte* authIn, word32 authInSz);
398 
444 int wc_AesGcmDecrypt(Aes* aes, byte* out,
445  const byte* in, word32 sz,
446  const byte* iv, word32 ivSz,
447  const byte* authTag, word32 authTagSz,
448  const byte* authIn, word32 authInSz);
449 
473 int wc_GmacSetKey(Gmac* gmac, const byte* key, word32 len);
474 
511 int wc_GmacUpdate(Gmac* gmac, const byte* iv, word32 ivSz,
512  const byte* authIn, word32 authInSz,
513  byte* authTag, word32 authTagSz);
514 
538 int wc_AesCcmSetKey(Aes* aes, const byte* key, word32 keySz);
539 
583 int wc_AesCcmEncrypt(Aes* aes, byte* out,
584  const byte* in, word32 inSz,
585  const byte* nonce, word32 nonceSz,
586  byte* authTag, word32 authTagSz,
587  const byte* authIn, word32 authInSz);
588 
638 int wc_AesCcmDecrypt(Aes* aes, byte* out,
639  const byte* in, word32 inSz,
640  const byte* nonce, word32 nonceSz,
641  const byte* authTag, word32 authTagSz,
642  const byte* authIn, word32 authInSz);
643 
676 int wc_AesXtsSetKey(XtsAes* aes, const byte* key,
677  word32 len, int dir, void* heap, int devId);
678 
715 int wc_AesXtsEncryptSector(XtsAes* aes, byte* out,
716  const byte* in, word32 sz, word64 sector);
717 
754 int wc_AesXtsDecryptSector(XtsAes* aes, byte* out,
755  const byte* in, word32 sz, word64 sector);
756 
794 int wc_AesXtsEncrypt(XtsAes* aes, byte* out,
795  const byte* in, word32 sz, const byte* i, word32 iSz);
796 
833 int wc_AesXtsDecrypt(XtsAes* aes, byte* out,
834  const byte* in, word32 sz, const byte* i, word32 iSz);
835 
860 int wc_AesXtsFree(XtsAes* aes);
861 
862 
889 int wc_AesInit(Aes* aes, void* heap, int devId);
890 
916 int wc_AesFree(Aes* aes);
917 
948 int wc_AesCfbEncrypt(Aes* aes, byte* out, const byte* in, word32 sz);
949 
980 int wc_AesCfbDecrypt(Aes* aes, byte* out, const byte* in, word32 sz);
981 
1025 int wc_AesSivEncrypt(const byte* key, word32 keySz, const byte* assoc,
1026  word32 assocSz, const byte* nonce, word32 nonceSz,
1027  const byte* in, word32 inSz, byte* siv, byte* out);
1028 
1072 int wc_AesSivDecrypt(const byte* key, word32 keySz, const byte* assoc,
1073  word32 assocSz, const byte* nonce, word32 nonceSz,
1074  const byte* in, word32 inSz, byte* siv, byte* out);
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 ...
int wc_AesCfbEncrypt(Aes *aes, byte *out, const byte *in, word32 sz)
AES with CFB mode.
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...
int wc_AesXtsFree(XtsAes *aes)
This is to free up any resources used by the XtsAes structure.
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...
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...
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...
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.
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...
int 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 of the provided AES structure, which should be initialized with wc_AesSetKey before calling this function. wc_AesSetKey should have been called with the iv set to NULL. This 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.
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 ...
int wc_AesSivEncrypt(const byte *key, word32 keySz, const byte *assoc, word32 assocSz, const byte *nonce, word32 nonceSz, const byte *in, word32 inSz, byte *siv, byte *out)
This function performs SIV (synthetic initialization vector) encryption as described in RFC 5297...
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...
int wc_AesFree(Aes *aes)
free resources associated with the Aes structure when applicable. Internally may sometimes be a no-op...
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...
int wc_AesCfbDecrypt(Aes *aes, byte *out, const byte *in, word32 sz)
AES with CFB mode.
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...
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 ...
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...
int 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 of the provided AES structure, which should be initialized with wc_AesSetKey before calling this function. wc_AesSetKey should have been called with the iv set to NULL. This 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.
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...
int wc_AesSivDecrypt(const byte *key, word32 keySz, const byte *assoc, word32 assocSz, const byte *nonce, word32 nonceSz, const byte *in, word32 inSz, byte *siv, byte *out)
This function performs SIV (synthetic initialization vector) decryption as described in RFC 5297...
int wc_AesInit(Aes *aes, void *heap, int devId)
Initialize Aes structure. Sets heap hint to be used and ID for use with async hardware. It is up to the user to call wc_AesFree on the Aes structure when done.
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.
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...
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...
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...
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...