summaryrefslogtreecommitdiffstats
path: root/aes.h
diff options
context:
space:
mode:
authorkokke <spam@rowdy.dk>2017-12-06 02:34:27 +0100
committerGitHub <noreply@github.com>2017-12-06 02:34:27 +0100
commit5268e93e5840933ef05c027da26c098fd99b8542 (patch)
tree5bd19b0fef85de50ce8c5ed08af31c6f01869dea /aes.h
parentUpdate aes.c (diff)
downloadtiny-AES-c-5268e93e5840933ef05c027da26c098fd99b8542.tar
tiny-AES-c-5268e93e5840933ef05c027da26c098fd99b8542.tar.gz
tiny-AES-c-5268e93e5840933ef05c027da26c098fd99b8542.tar.bz2
tiny-AES-c-5268e93e5840933ef05c027da26c098fd99b8542.tar.lz
tiny-AES-c-5268e93e5840933ef05c027da26c098fd99b8542.tar.xz
tiny-AES-c-5268e93e5840933ef05c027da26c098fd99b8542.tar.zst
tiny-AES-c-5268e93e5840933ef05c027da26c098fd99b8542.zip
Diffstat (limited to '')
-rw-r--r--aes.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/aes.h b/aes.h
index 41248d6..4d702fb 100644
--- a/aes.h
+++ b/aes.h
@@ -3,7 +3,6 @@
#include <stdint.h>
-
// #define the macros below to 1/0 to enable/disable the mode of operation.
//
// CBC enables AES encryption in CBC-mode of operation.
@@ -57,8 +56,8 @@ void AES_ctx_set_iv(struct AES_ctx* ctx, const uint8_t* iv);
#if defined(ECB) && (ECB == 1)
// buffer size is exactly AES_BLOCKLEN bytes;
-// you need only AES_init_ctx as Iv is not used in ECB
-// NB: ECB s considered insecure
+// you need only AES_init_ctx as IV is not used in ECB
+// NB: ECB is considered insecure for most uses
void AES_ECB_encrypt(struct AES_ctx* ctx, const uint8_t* buf);
void AES_ECB_decrypt(struct AES_ctx* ctx, const uint8_t* buf);
@@ -67,9 +66,9 @@ void AES_ECB_decrypt(struct AES_ctx* ctx, const uint8_t* buf);
#if defined(CBC) && (CBC == 1)
// buffer size MUST be mutile of AES_BLOCKLEN;
-// We suggest https://en.wikipedia.org/wiki/Padding_(cryptography)#PKCS7 if you need one
-// you need to set iv in ctx via AES_init_ctx_iv or AES_ctx_set_iv
-// NB: no IV should ever be reused with the same key
+// Suggest https://en.wikipedia.org/wiki/Padding_(cryptography)#PKCS7 for padding scheme
+// NOTES: you need to set IV in ctx via AES_init_ctx_iv() or AES_ctx_set_iv()
+// no IV should ever be reused with the same key
void AES_CBC_encrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, uint32_t length);
void AES_CBC_decrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, uint32_t length);
@@ -79,11 +78,11 @@ void AES_CBC_decrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, uint32_t length);
#if defined(CTR) && (CTR == 1)
// Same function for encrypting as for decrypting.
-// iv is incremented for every block, and usesd after encryption as xor compliment for output
-// buffer size MUST be mutile of AES_BLOCKLEN;
-// We suggest https://en.wikipedia.org/wiki/Padding_(cryptography)#PKCS7 if you need one
-// you need to set iv in ctx via AES_init_ctx_iv or AES_ctx_set_iv
-// NB: no IV should ever be reused with the same key
+// IV is incremented for every block, and used after encryption as XOR-compliment for output
+// buffer size MUST be multiple of AES_BLOCKLEN;
+// Suggesting https://en.wikipedia.org/wiki/Padding_(cryptography)#PKCS7 for padding scheme
+// NOTES: you need to set IV in ctx with AES_init_ctx_iv() or AES_ctx_set_iv()
+// no IV should ever be reused with the same key
void AES_CTR_xcrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, uint32_t length);
#endif // #if defined(CTR) && (CTR == 1)