Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing AesInit comments to documentation. #116

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions wolfSSL/src-ja/chapter10.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@ const byte iv[]={ /*some 16 byte iv*/ };
byte plain[32]; /*an increment of 16, fill with data*/
byte cipher[32];

wc_AesInit(&enc, HEAP_HINT, INVALID_DEVID);
wc_AesInit(&dec, HEAP_HINT, INVALID_DEVID);

/*encrypt*/
wc_AesSetKey(&enc, key, sizeof(key), iv, AES_ENCRYPTION);
wc_AesCbcEncrypt(&enc, cipher, plain, sizeof(plain));
Expand Down
5 changes: 5 additions & 0 deletions wolfSSL/src/chapter10.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ wc_Poly1305Final(&pmac, pmacDigest);

wolfCrypt provides support for AES with key sizes of 16 bytes (128 bits), 24 bytes (192 bits), or 32 bytes (256 bits). Supported AES modes include CBC, CTR, GCM, and CCM-8.

**NOTE**: [`wc_AesInit()`](group__AES.md#function-wc_aesinit) should always be called first to initialize the `Aes` structure, before calling other `Aes` API functions such as [`wc_AesSetKey()`](group__AES.md#function-wc_aessetkey), and [`wc_AesGcmSetKey()`](group__AES.md#function-wc_aesgcmsetkey).

CBC mode is supported for both encryption and decryption and is provided through the [`wc_AesSetKey()`](group__AES.md#function-wc_aessetkey), [`wc_AesCbcEncrypt()`](group__AES.md#function-wc_aescbcencrypt) and [`wc_AesCbcDecrypt()`](group__AES.md#function-wc_aescbcdecrypt) functions. Please include the header `wolfssl/wolfcrypt/aes.h` to use AES. AES has a block size of 16 bytes and the IV should also be 16 bytes. Function usage is usually as follows:

```c
Expand All @@ -192,6 +194,9 @@ const byte iv[] = { /*some 16 byte iv*/ };
byte plain[32]; /*an increment of 16, fill with data*/
byte cipher[32];

wc_AesInit(&enc, HEAP_HINT, INVALID_DEVID);
wc_AesInit(&dec, HEAP_HINT, INVALID_DEVID);

/*encrypt*/
wc_AesSetKey(&enc, key, sizeof(key), iv, AES_ENCRYPTION);
wc_AesCbcEncrypt(&enc, cipher, plain, sizeof(plain));
Expand Down
Loading