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 
460 int wc_AesGcmDecrypt(Aes* aes, byte* out,
461  const byte* in, word32 sz,
462  const byte* iv, word32 ivSz,
463  const byte* authTag, word32 authTagSz,
464  const byte* authIn, word32 authInSz);
465 
489 int wc_GmacSetKey(Gmac* gmac, const byte* key, word32 len);
490 
527 int wc_GmacUpdate(Gmac* gmac, const byte* iv, word32 ivSz,
528  const byte* authIn, word32 authInSz,
529  byte* authTag, word32 authTagSz);
530 
555 int wc_AesCcmSetKey(Aes* aes, const byte* key, word32 keySz);
556 
600 int wc_AesCcmEncrypt(Aes* aes, byte* out,
601  const byte* in, word32 inSz,
602  const byte* nonce, word32 nonceSz,
603  byte* authTag, word32 authTagSz,
604  const byte* authIn, word32 authInSz);
605 
655 int wc_AesCcmDecrypt(Aes* aes, byte* out,
656  const byte* in, word32 inSz,
657  const byte* nonce, word32 nonceSz,
658  const byte* authTag, word32 authTagSz,
659  const byte* authIn, word32 authInSz);
660 
694 int wc_AesXtsInit(XtsAes* aes, void* heap, int devId);
695 
696 
733 int wc_AesXtsSetKeyNoInit(XtsAes* aes, const byte* key,
734  word32 len, int dir);
735 
736 
771 int wc_AesXtsSetKey(XtsAes* aes, const byte* key,
772  word32 len, int dir, void* heap, int devId);
773 
812 int wc_AesXtsEncryptSector(XtsAes* aes, byte* out,
813  const byte* in, word32 sz, word64 sector);
814 
853 int wc_AesXtsDecryptSector(XtsAes* aes, byte* out,
854  const byte* in, word32 sz, word64 sector);
855 
895 int wc_AesXtsEncrypt(XtsAes* aes, byte* out,
896  const byte* in, word32 sz, const byte* i, word32 iSz);
897 
936 int wc_AesXtsDecrypt(XtsAes* aes, byte* out,
937  const byte* in, word32 sz, const byte* i, word32 iSz);
938 
965 int wc_AesXtsFree(XtsAes* aes);
966 
967 
994 int wc_AesInit(Aes* aes, void* heap, int devId);
995 
1021 int wc_AesFree(Aes* aes);
1022 
1053 int wc_AesCfbEncrypt(Aes* aes, byte* out, const byte* in, word32 sz);
1054 
1085 int wc_AesCfbDecrypt(Aes* aes, byte* out, const byte* in, word32 sz);
1086 
1130 int wc_AesSivEncrypt(const byte* key, word32 keySz, const byte* assoc,
1131  word32 assocSz, const byte* nonce, word32 nonceSz,
1132  const byte* in, word32 inSz, byte* siv, byte* out);
1133 
1177 int wc_AesSivDecrypt(const byte* key, word32 keySz, const byte* assoc,
1178  word32 assocSz, const byte* nonce, word32 nonceSz,
1179  const byte* in, word32 inSz, byte* siv, byte* out);
1180 
1181 
1182 
1183 
1184 
1185 
1186 
1238 WOLFSSL_API int wc_AesEaxEncryptAuth(const byte* key, word32 keySz, byte* out,
1239  const byte* in, word32 inSz,
1240  const byte* nonce, word32 nonceSz,
1241  /* output computed auth tag */
1242  byte* authTag, word32 authTagSz,
1243  /* input data to authenticate */
1244  const byte* authIn, word32 authInSz);
1298 WOLFSSL_API int wc_AesEaxDecryptAuth(const byte* key, word32 keySz, byte* out,
1299  const byte* in, word32 inSz,
1300  const byte* nonce, word32 nonceSz,
1301  /* auth tag to verify against */
1302  const byte* authTag, word32 authTagSz,
1303  /* input data to authenticate */
1304  const byte* authIn, word32 authInSz);
1305 
1371 WOLFSSL_API int wc_AesEaxInit(AesEax* eax,
1372  const byte* key, word32 keySz,
1373  const byte* nonce, word32 nonceSz,
1374  const byte* authIn, word32 authInSz);
1375 
1437 WOLFSSL_API int wc_AesEaxEncryptUpdate(AesEax* eax, byte* out,
1438  const byte* in, word32 inSz,
1439  const byte* authIn, word32 authInSz);
1440 
1504 WOLFSSL_API int wc_AesEaxDecryptUpdate(AesEax* eax, byte* out,
1505  const byte* in, word32 inSz,
1506  const byte* authIn, word32 authInSz);
1569 WOLFSSL_API int wc_AesEaxAuthDataUpdate(AesEax* eax,
1570  const byte* authIn, word32 authInSz);
1571 
1630 WOLFSSL_API int wc_AesEaxEncryptFinal(AesEax* eax,
1631  byte* authTag, word32 authTagSz);
1632 
1695 WOLFSSL_API int wc_AesEaxDecryptFinal(AesEax* eax,
1696  const byte* authIn, word32 authInSz);
1726 WOLFSSL_API int wc_AesEaxFree(AesEax* eax);
1727 
1728 
1729 
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_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...
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_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_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_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_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...