-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83b81a7
commit 1cfd6f5
Showing
6 changed files
with
203 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* @file aes_auth.hh | ||
* @author Romulus-Emanuel Ruja <[email protected]> | ||
* @brief This file contains function definitions for AES GCM | ||
* @date 2021-12-19 | ||
* | ||
* @copyright Copyright (c) 2021 MIT License | ||
* | ||
*/ | ||
|
||
|
||
#include "aes_const.hh" | ||
#include "types.hh" | ||
|
||
|
||
namespace CRYPTO | ||
{ | ||
/** | ||
* @brief Perform AES GCM encryption. | ||
* | ||
* @param ctx Initialized AES context. | ||
* @param in Data to be encrypted. | ||
* @param inlen Data length in bytes. | ||
* @param out Encrypted data (if null, then it is dynamically allocated). | ||
* @param aad Additional Authenticated Data (AAD) | ||
* @param aadlen Additional authenticated data size in bytes | ||
* @return int Size of encrypted data if success, -1 if failure. | ||
*/ | ||
int AES_auth_encrypt(AES_CRYPTO ctx, const BYTE *in, SIZE inlen, BYTES *out); | ||
|
||
/** | ||
* @brief Perform AES GCM encryption. | ||
* | ||
* @param ctx Initialized AES context. | ||
* @param in Data to be encrypted. | ||
* @param inlen Data length in bytes. | ||
* @param out Encrypted data (if null, then it is dynamically allocated). | ||
* @param aad Additional Authenticated Data (AAD) | ||
* @param aadlen Additional authenticated data size in bytes | ||
* @return int Size of encrypted data if success, -1 if failure. | ||
*/ | ||
int AES_auth_encrypt(AES_CRYPTO ctx, const BYTE *in, SIZE inlen, const BYTE *aad, SIZE aadlen, BYTES *out); | ||
|
||
/** | ||
* @brief Perform AES GCM decryption. | ||
* | ||
* @param ctx Initialized AES context. | ||
* @param in Data to be decrypted. | ||
* @param inlen Data length in bytes. | ||
* @param out Decrypted data (if null, then it is dynamically allocated). | ||
* @param aad Additional Authenticated Data (AAD) | ||
* @param aadlen Additional authenticated data size in bytes | ||
* @return int Size of decrypted data if success, -1 if failure. | ||
*/ | ||
int AES_auth_decrypt(AES_CRYPTO ctx, const BYTE *in, SIZE inlen, const BYTE *aad, SIZE aadlen, BYTES *out); | ||
|
||
/** | ||
* @brief Perform AES GCM decryption. | ||
* | ||
* @param ctx Initialized AES context. | ||
* @param in Data to be decrypted. | ||
* @param inlen Data length in bytes. | ||
* @param out Decrypted data (if null, then it is dynamically allocated). | ||
* @return int Size of decrypted data if success, -1 if failure. | ||
*/ | ||
int AES_auth_decrypt(AES_CRYPTO ctx, const BYTE *in, SIZE inlen, BYTES *out); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.