My Project
aes.h
Go to the documentation of this file.
1 
35 int wc_AesSetKey(Aes* aes, const byte* key, word32 len,
36  const byte* iv, int dir);
37 
65 int wc_AesSetIV(Aes* aes, const byte* iv);
66 
115 int wc_AesCbcEncrypt(Aes* aes, byte* out,
116  const byte* in, word32 sz);
117 
168 int wc_AesCbcDecrypt(Aes* aes, byte* out,
169  const byte* in, word32 sz);
170 
214 int wc_AesCtrEncrypt(Aes* aes, byte* out,
215  const byte* in, word32 sz);
216 
249 int wc_AesEncryptDirect(Aes* aes, byte* out, const byte* in);
250 
284 int wc_AesDecryptDirect(Aes* aes, byte* out, const byte* in);
285 
328 int wc_AesSetKeyDirect(Aes* aes, const byte* key, word32 len,
329  const byte* iv, int dir);
330 
361 int wc_AesGcmSetKey(Aes* aes, const byte* key, word32 len);
362 
408 int wc_AesGcmEncrypt(Aes* aes, byte* out,
409  const byte* in, word32 sz,
410  const byte* iv, word32 ivSz,
411  byte* authTag, word32 authTagSz,
412  const byte* authIn, word32 authInSz);
413 
462 int wc_AesGcmDecrypt(Aes* aes, byte* out,
463  const byte* in, word32 sz,
464  const byte* iv, word32 ivSz,
465  const byte* authTag, word32 authTagSz,
466  const byte* authIn, word32 authInSz);
467 
491 int wc_GmacSetKey(Gmac* gmac, const byte* key, word32 len);
492 
529 int wc_GmacUpdate(Gmac* gmac, const byte* iv, word32 ivSz,
530  const byte* authIn, word32 authInSz,
531  byte* authTag, word32 authTagSz);
532 
557 int wc_AesCcmSetKey(Aes* aes, const byte* key, word32 keySz);
558 
602 int wc_AesCcmEncrypt(Aes* aes, byte* out,
603  const byte* in, word32 inSz,
604  const byte* nonce, word32 nonceSz,
605  byte* authTag, word32 authTagSz,
606  const byte* authIn, word32 authInSz);
607 
658 int wc_AesCcmDecrypt(Aes* aes, byte* out,
659  const byte* in, word32 inSz,
660  const byte* nonce, word32 nonceSz,
661  const byte* authTag, word32 authTagSz,
662  const byte* authIn, word32 authInSz);
663 
697 int wc_AesXtsInit(XtsAes* aes, void* heap, int devId);
698 
699 
736 int wc_AesXtsSetKeyNoInit(XtsAes* aes, const byte* key,
737  word32 len, int dir);
738 
739 
774 int wc_AesXtsSetKey(XtsAes* aes, const byte* key,
775  word32 len, int dir, void* heap, int devId);
776 
815 int wc_AesXtsEncryptSector(XtsAes* aes, byte* out,
816  const byte* in, word32 sz, word64 sector);
817 
856 int wc_AesXtsDecryptSector(XtsAes* aes, byte* out,
857  const byte* in, word32 sz, word64 sector);
858 
898 int wc_AesXtsEncrypt(XtsAes* aes, byte* out,
899  const byte* in, word32 sz, const byte* i, word32 iSz);
900 
939 int wc_AesXtsDecrypt(XtsAes* aes, byte* out,
940  const byte* in, word32 sz, const byte* i, word32 iSz);
941 
968 int wc_AesXtsFree(XtsAes* aes);
969 
970 
997 int wc_AesInit(Aes* aes, void* heap, int devId);
998 
1024 int wc_AesFree(Aes* aes);
1025 
1056 int wc_AesCfbEncrypt(Aes* aes, byte* out, const byte* in, word32 sz);
1057 
1088 int wc_AesCfbDecrypt(Aes* aes, byte* out, const byte* in, word32 sz);
1089 
1133 int wc_AesSivEncrypt(const byte* key, word32 keySz, const byte* assoc,
1134  word32 assocSz, const byte* nonce, word32 nonceSz,
1135  const byte* in, word32 inSz, byte* siv, byte* out);
1136 
1182 int wc_AesSivDecrypt(const byte* key, word32 keySz, const byte* assoc,
1183  word32 assocSz, const byte* nonce, word32 nonceSz,
1184  const byte* in, word32 inSz, byte* siv, byte* out);
1185 
1186 
1187 
1188 
1189 
1190 
1191 
1243 WOLFSSL_API int wc_AesEaxEncryptAuth(const byte* key, word32 keySz, byte* out,
1244  const byte* in, word32 inSz,
1245  const byte* nonce, word32 nonceSz,
1246  /* output computed auth tag */
1247  byte* authTag, word32 authTagSz,
1248  /* input data to authenticate */
1249  const byte* authIn, word32 authInSz);
1306 WOLFSSL_API int wc_AesEaxDecryptAuth(const byte* key, word32 keySz, byte* out,
1307  const byte* in, word32 inSz,
1308  const byte* nonce, word32 nonceSz,
1309  /* auth tag to verify against */
1310  const byte* authTag, word32 authTagSz,
1311  /* input data to authenticate */
1312  const byte* authIn, word32 authInSz);
1313 
1379 WOLFSSL_API int wc_AesEaxInit(AesEax* eax,
1380  const byte* key, word32 keySz,
1381  const byte* nonce, word32 nonceSz,
1382  const byte* authIn, word32 authInSz);
1383 
1445 WOLFSSL_API int wc_AesEaxEncryptUpdate(AesEax* eax, byte* out,
1446  const byte* in, word32 inSz,
1447  const byte* authIn, word32 authInSz);
1448 
1512 WOLFSSL_API int wc_AesEaxDecryptUpdate(AesEax* eax, byte* out,
1513  const byte* in, word32 inSz,
1514  const byte* authIn, word32 authInSz);
1577 WOLFSSL_API int wc_AesEaxAuthDataUpdate(AesEax* eax,
1578  const byte* authIn, word32 authInSz);
1579 
1638 WOLFSSL_API int wc_AesEaxEncryptFinal(AesEax* eax,
1639  byte* authTag, word32 authTagSz);
1640 
1703 WOLFSSL_API int wc_AesEaxDecryptFinal(AesEax* eax,
1704  const byte* authIn, word32 authInSz);
1734 WOLFSSL_API int wc_AesEaxFree(AesEax* eax);
1735 
1770 int wc_AesCtsEncrypt(const byte* key, word32 keySz, byte* out,
1771  const byte* in, word32 inSz,
1772  const byte* iv);
1773 
1805 int wc_AesCtsEncrypt(const byte* key, word32 keySz, byte* out,
1806  const byte* in, word32 inSz,
1807  const byte* iv);
1808 
1838 int wc_AesCtsDecrypt(const byte* key, word32 keySz, byte* out,
1839  const byte* in, word32 inSz,
1840  const byte* iv);
1841 
1874 int wc_AesCtsEncryptUpdate(Aes* aes, byte* out, word32* outSz,
1875  const byte* in, word32 inSz);
1876 
1908 int wc_AesCtsEncryptFinal(Aes* aes, byte* out, word32* outSz);
1909 
1942 int wc_AesCtsDecryptUpdate(Aes* aes, byte* out, word32* outSz,
1943  const byte* in, word32 inSz);
1944 
1976 int wc_AesCtsDecryptFinal(Aes* aes, byte* out, word32* outSz);
int wc_AesXtsInit(XtsAes *aes, void *heap, int devId)
This is to initialize an AES-XTS context. It is up to user to call wc_AesXtsFree on aes key 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.
WOLFSSL_API int wc_AesEaxDecryptAuth(const byte *key, word32 keySz, byte *out, const byte *in, word32 inSz, const byte *nonce, word32 nonceSz, const byte *authTag, word32 authTagSz, const byte *authIn, word32 authInSz)
This function performs AES EAX decryption and authentication as described in "EAX: A Conventional Aut...
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 ...
WOLFSSL_API int wc_AesEaxEncryptAuth(const byte *key, word32 keySz, byte *out, const byte *in, word32 inSz, const byte *nonce, word32 nonceSz, byte *authTag, word32 authTagSz, const byte *authIn, word32 authInSz)
This function performs AES EAX encryption and authentication as described in "EAX: A Conventional Aut...
WOLFSSL_API int wc_AesEaxEncryptUpdate(AesEax *eax, byte *out, const byte *in, word32 inSz, const byte *authIn, word32 authInSz)
This function uses AES EAX to encrypt input data, and optionally, add more input data to the authenti...
int wc_AesCfbDecrypt(Aes *aes, byte *out, const byte *in, word32 sz)
AES with CFB mode.
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_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_AesInit(Aes *aes, void *heap, int devId)
Initialize Aes structure. Sets heap hint to be used and ID for use with async hardware....
WOLFSSL_API int wc_AesEaxDecryptUpdate(AesEax *eax, byte *out, const byte *in, word32 inSz, const byte *authIn, word32 authInSz)
This function uses AES EAX to decrypt input data, and optionally, add more input data to the authenti...
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_AesCtsDecrypt(const byte *key, word32 keySz, byte *out, const byte *in, word32 inSz, const byte *iv)
This function performs AES decryption using Ciphertext Stealing (CTS) mode. It is a one-shot API that...
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_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_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_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....
WOLFSSL_API int wc_AesEaxEncryptFinal(AesEax *eax, byte *authTag, word32 authTagSz)
This function finalizes the encrypt AEAD operation, producing an auth tag over the current authentica...
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...
WOLFSSL_API int wc_AesEaxInit(AesEax *eax, const byte *key, word32 keySz, const byte *nonce, word32 nonceSz, const byte *authIn, word32 authInSz)
This function initializes an AesEax object for use in authenticated encryption or decryption....
WOLFSSL_API int wc_AesEaxAuthDataUpdate(AesEax *eax, const byte *authIn, word32 authInSz)
This function adds input data to the authentication stream. eax must have been previously initialized...
int wc_AesXtsSetKeyNoInit(XtsAes *aes, const byte *key, word32 len, int dir)
This is to help with setting keys to correct encrypt or decrypt type, after first calling wc_AesXtsIn...
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_AesXtsFree(XtsAes *aes)
This is to free up any resources used by the XtsAes structure.
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_AesCfbEncrypt(Aes *aes, byte *out, const byte *in, word32 sz)
AES with CFB mode.
int wc_AesFree(Aes *aes)
free resources associated with the Aes structure when applicable. Internally may sometimes be a no-op...
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_AesCtsDecryptFinal(Aes *aes, byte *out, word32 *outSz)
This function finalizes the AES CTS decryption operation. It processes any remaining ciphertext and c...
WOLFSSL_API int wc_AesEaxDecryptFinal(AesEax *eax, const byte *authIn, word32 authInSz)
This function finalizes the decrypt AEAD operation, finalizing the auth tag computation and checking ...
int wc_AesCtsEncrypt(const byte *key, word32 keySz, byte *out, const byte *in, word32 inSz, const byte *iv)
This function performs AES encryption using Ciphertext Stealing (CTS) mode. It is a one-shot API that...
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_AesDecryptDirect(Aes *aes, byte *out, const byte *in)
This function is a one-block decrypt of the input block, in, into the output block,...
int wc_AesCtsEncryptFinal(Aes *aes, byte *out, word32 *outSz)
This function finalizes the AES CTS encryption operation. It processes any remaining plaintext and co...
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.
WOLFSSL_API int wc_AesEaxFree(AesEax *eax)
This frees up any resources, specifically keys, used by the Aes instance inside the AesEax wrapper st...
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_AesEncryptDirect(Aes *aes, byte *out, const byte *in)
This function is a one-block encrypt of the input block, in, into the output block,...
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_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_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_AesCtsEncryptUpdate(Aes *aes, byte *out, word32 *outSz, const byte *in, word32 inSz)
This function performs an update step of the AES CTS encryption. It processes a chunk of plaintext an...
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_AesCtsDecryptUpdate(Aes *aes, byte *out, word32 *outSz, const byte *in, word32 inSz)
This function performs an update step of the AES CTS decryption. It processes a chunk of ciphertext a...
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...