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 
159 int wc_AesCbcDecrypt(Aes* aes, byte* out,
160  const byte* in, word32 sz);
161 
204 int wc_AesCtrEncrypt(Aes* aes, byte* out,
205  const byte* in, word32 sz);
206 
238 int wc_AesEncryptDirect(Aes* aes, byte* out, const byte* in);
239 
272 int wc_AesDecryptDirect(Aes* aes, byte* out, const byte* in);
273 
312 int wc_AesSetKeyDirect(Aes* aes, const byte* key, word32 len,
313  const byte* iv, int dir);
314 
342 int wc_AesGcmSetKey(Aes* aes, const byte* key, word32 len);
343 
387 int wc_AesGcmEncrypt(Aes* aes, byte* out,
388  const byte* in, word32 sz,
389  const byte* iv, word32 ivSz,
390  byte* authTag, word32 authTagSz,
391  const byte* authIn, word32 authInSz);
392 
436 int wc_AesGcmDecrypt(Aes* aes, byte* out,
437  const byte* in, word32 sz,
438  const byte* iv, word32 ivSz,
439  const byte* authTag, word32 authTagSz,
440  const byte* authIn, word32 authInSz);
441 
465 int wc_GmacSetKey(Gmac* gmac, const byte* key, word32 len);
466 
503 int wc_GmacUpdate(Gmac* gmac, const byte* iv, word32 ivSz,
504  const byte* authIn, word32 authInSz,
505  byte* authTag, word32 authTagSz);
506 
530 int wc_AesCcmSetKey(Aes* aes, const byte* key, word32 keySz);
531 
575 int wc_AesCcmEncrypt(Aes* aes, byte* out,
576  const byte* in, word32 inSz,
577  const byte* nonce, word32 nonceSz,
578  byte* authTag, word32 authTagSz,
579  const byte* authIn, word32 authInSz);
580 
630 int wc_AesCcmDecrypt(Aes* aes, byte* out,
631  const byte* in, word32 inSz,
632  const byte* nonce, word32 nonceSz,
633  const byte* authTag, word32 authTagSz,
634  const byte* authIn, word32 authInSz);
635 
668 int wc_AesXtsSetKey(XtsAes* aes, const byte* key,
669  word32 len, int dir, void* heap, int devId);
670 
707 int wc_AesXtsEncryptSector(XtsAes* aes, byte* out,
708  const byte* in, word32 sz, word64 sector);
709 
746 int wc_AesXtsDecryptSector(XtsAes* aes, byte* out,
747  const byte* in, word32 sz, word64 sector);
748 
786 int wc_AesXtsEncrypt(XtsAes* aes, byte* out,
787  const byte* in, word32 sz, const byte* i, word32 iSz);
788 
825 int wc_AesXtsDecrypt(XtsAes* aes, byte* out,
826  const byte* in, word32 sz, const byte* i, word32 iSz);
827 
852 int wc_AesXtsFree(XtsAes* aes);
853 
854 
879 int wc_AesInit(Aes* aes, void* heap, int devId);
880 
911 int wc_AesCfbEncrypt(Aes* aes, byte* out, const byte* in, word32 sz);
912 
943 int wc_AesCfbDecrypt(Aes* aes, byte* out, const byte* in, word32 sz);
944 
988 int wc_AesSivEncrypt(const byte* key, word32 keySz, const byte* assoc,
989  word32 assocSz, const byte* nonce, word32 nonceSz,
990  const byte* in, word32 inSz, byte* siv, byte* out);
991 
1035 int wc_AesSivDecrypt(const byte* key, word32 keySz, const byte* assoc,
1036  word32 assocSz, const byte* nonce, word32 nonceSz,
1037  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_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.
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...