Skip to content

Commit 7a2e1c1

Browse files
Merge pull request #9585 from dgarske/add-missing-api-docs
Add missing API documentation
2 parents 0d44018 + 8bcac03 commit 7a2e1c1

36 files changed

+13275
-137
lines changed

doc/dox_comments/header_files/aes.h

Lines changed: 1715 additions & 0 deletions
Large diffs are not rendered by default.

doc/dox_comments/header_files/arc4.h

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,57 @@ int wc_Arc4Process(Arc4* arc4, byte* out, const byte* in, word32 length);
5757
\sa wc_Arc4Process
5858
*/
5959
int wc_Arc4SetKey(Arc4* arc4, const byte* key, word32 length);
60+
61+
/*!
62+
\ingroup ARC4
63+
\brief This function initializes an ARC4 structure for use with
64+
asynchronous cryptographic operations. It sets up the heap hint and
65+
device ID for hardware acceleration support.
66+
67+
\return 0 On success.
68+
\return BAD_FUNC_ARG If arc4 is NULL.
69+
70+
\param arc4 pointer to the Arc4 structure to initialize
71+
\param heap pointer to heap hint for memory allocation (can be NULL)
72+
\param devId device ID for hardware acceleration (use INVALID_DEVID
73+
for software)
74+
75+
_Example_
76+
\code
77+
Arc4 arc4;
78+
int ret = wc_Arc4Init(&arc4, NULL, INVALID_DEVID);
79+
if (ret != 0) {
80+
// initialization failed
81+
}
82+
// use arc4 for encryption/decryption
83+
wc_Arc4Free(&arc4);
84+
\endcode
85+
86+
\sa wc_Arc4SetKey
87+
\sa wc_Arc4Free
88+
*/
89+
int wc_Arc4Init(Arc4* arc4, void* heap, int devId);
90+
91+
/*!
92+
\ingroup ARC4
93+
\brief This function frees an ARC4 structure, releasing any resources
94+
allocated for asynchronous cryptographic operations. It should be
95+
called when the ARC4 structure is no longer needed.
96+
97+
\return none No return value.
98+
99+
\param arc4 pointer to the Arc4 structure to free
100+
101+
_Example_
102+
\code
103+
Arc4 arc4;
104+
wc_Arc4Init(&arc4, NULL, INVALID_DEVID);
105+
wc_Arc4SetKey(&arc4, key, keyLen);
106+
// use arc4 for encryption/decryption
107+
wc_Arc4Free(&arc4);
108+
\endcode
109+
110+
\sa wc_Arc4Init
111+
\sa wc_Arc4SetKey
112+
*/
113+
void wc_Arc4Free(Arc4* arc4);

doc/dox_comments/header_files/ascon.h

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,4 +466,109 @@ int wc_AsconAEAD128_DecryptUpdate(wc_AsconAEAD128* a, byte* out, const byte* in,
466466
*/
467467
int wc_AsconAEAD128_DecryptFinal(wc_AsconAEAD128* a, const byte* tag);
468468

469+
/*!
470+
\ingroup ASCON
471+
\brief This function allocates and initializes a new Ascon Hash256
472+
context. The returned context must be freed with wc_AsconHash256_Free
473+
when no longer needed.
474+
475+
\return Pointer to allocated wc_AsconHash256 structure on success.
476+
\return NULL on allocation or initialization failure.
477+
478+
_Example_
479+
\code
480+
wc_AsconHash256* hash = wc_AsconHash256_New();
481+
if (hash == NULL) {
482+
// handle allocation error
483+
}
484+
byte data[]; // data to hash
485+
wc_AsconHash256_Update(hash, data, sizeof(data));
486+
byte digest[ASCON_HASH256_SZ];
487+
wc_AsconHash256_Final(hash, digest);
488+
wc_AsconHash256_Free(hash);
489+
\endcode
490+
491+
\sa wc_AsconHash256_Free
492+
\sa wc_AsconHash256_Init
493+
*/
494+
wc_AsconHash256* wc_AsconHash256_New(void);
495+
496+
/*!
497+
\ingroup ASCON
498+
\brief This function frees an Ascon Hash256 context that was allocated
499+
with wc_AsconHash256_New. It clears the context before freeing to
500+
prevent information leakage.
501+
502+
\return none No return value.
503+
504+
\param a pointer to the wc_AsconHash256 structure to free
505+
506+
_Example_
507+
\code
508+
wc_AsconHash256* hash = wc_AsconHash256_New();
509+
if (hash != NULL) {
510+
// use hash context
511+
wc_AsconHash256_Free(hash);
512+
}
513+
\endcode
514+
515+
\sa wc_AsconHash256_New
516+
\sa wc_AsconHash256_Clear
517+
*/
518+
void wc_AsconHash256_Free(wc_AsconHash256* a);
519+
520+
/*!
521+
\ingroup ASCON
522+
\brief This function clears an Ascon Hash256 context by zeroing all
523+
internal state. This should be called to securely erase sensitive
524+
data from memory.
525+
526+
\return none No return value.
527+
528+
\param a pointer to the wc_AsconHash256 structure to clear
529+
530+
_Example_
531+
\code
532+
wc_AsconHash256 hash;
533+
wc_AsconHash256_Init(&hash);
534+
byte data[]; // data to hash
535+
wc_AsconHash256_Update(&hash, data, sizeof(data));
536+
byte digest[ASCON_HASH256_SZ];
537+
wc_AsconHash256_Final(&hash, digest);
538+
wc_AsconHash256_Clear(&hash);
539+
\endcode
540+
541+
\sa wc_AsconHash256_Init
542+
\sa wc_AsconHash256_Free
543+
*/
544+
void wc_AsconHash256_Clear(wc_AsconHash256* a);
545+
546+
/*!
547+
\ingroup ASCON
548+
\brief This function allocates and initializes a new Ascon AEAD128
549+
context. The returned context must be freed with wc_AsconAEAD128_Free
550+
when no longer needed.
551+
552+
\return Pointer to allocated wc_AsconAEAD128 structure on success.
553+
\return NULL on allocation or initialization failure.
554+
555+
_Example_
556+
\code
557+
wc_AsconAEAD128* aead = wc_AsconAEAD128_New();
558+
if (aead == NULL) {
559+
// handle allocation error
560+
}
561+
byte key[ASCON_AEAD128_KEY_SZ] = { }; // key
562+
byte nonce[ASCON_AEAD128_NONCE_SZ] = { }; // nonce
563+
wc_AsconAEAD128_SetKey(aead, key);
564+
wc_AsconAEAD128_SetNonce(aead, nonce);
565+
// perform encryption/decryption
566+
wc_AsconAEAD128_Free(aead);
567+
\endcode
568+
569+
\sa wc_AsconAEAD128_Free
570+
\sa wc_AsconAEAD128_Init
571+
*/
572+
wc_AsconAEAD128* wc_AsconAEAD128_New(void);
573+
469574

0 commit comments

Comments
 (0)