Files
David Garske 77d9410aa0 Add missing API documentation for Doxygen:
This PR adds Doxygen documentation for native wolfSSL API functions that were previously undocumented. It includes documentation notes for APIs gated on specific preprocessor macros:

- WOLF_PRIVATE_KEY_ID: _Id and _Label init helpers (wc_AesInit_Id, wc_AesInit_Label, wc_ecc_init_id, wc_ecc_init_label, wc_InitRsaKey_Id, wc_InitRsaKey_Label) require this for PKCS11 support

- WC_NO_CONSTRUCTORS: New/Delete constructor functions (wc_AesNew/Delete, wc_curve25519_new/delete, wc_ed25519_new/delete, wc_NewRsaKey/DeleteRsaKey) are only available when this is not defined. WC_NO_CONSTRUCTORS is automatically defined when WOLFSSL_NO_MALLOC is defined.

- WOLFSSL_PUBLIC_ASN: ASN functions marked with WOLFSSL_ASN_API include  notes indicating they are not public by default

- WOLFSSL_DUAL_ALG_CERTS: wc_GeneratePreTBS and wc_MakeSigWithBitStr for Post-Quantum dual algorithm certificate signing

The New/Delete functions are documented as being exposed to support allocation of structures using dynamic memory to provide better ABI compatibility.
2025-12-26 08:41:56 -08:00

114 lines
3.3 KiB
C

/*!
\ingroup ARC4
\brief This function encrypts an input message from the buffer in, placing
the ciphertext in the output buffer out, or decrypts a ciphertext from the
buffer in, placing the plaintext in the output buffer out, using ARC4
encryption. This function is used for both encryption and decryption.
Before this method may be called, one must first initialize the ARC4
structure using wc_Arc4SetKey.
\return none
\param arc4 pointer to the ARC4 structure used to process the message
\param out pointer to the output buffer in which to store the
processed message
\param in pointer to the input buffer containing the message to process
\param length length of the message to process
_Example_
\code
Arc4 enc;
byte key[] = { key to use for encryption };
wc_Arc4SetKey(&enc, key, sizeof(key));
byte plain[] = { plain text to encode };
byte cipher[sizeof(plain)];
byte decrypted[sizeof(plain)];
// encrypt the plain into cipher
wc_Arc4Process(&enc, cipher, plain, sizeof(plain));
// decrypt the cipher
wc_Arc4Process(&enc, decrypted, cipher, sizeof(cipher));
\endcode
\sa wc_Arc4SetKey
*/
int wc_Arc4Process(Arc4* arc4, byte* out, const byte* in, word32 length);
/*!
\ingroup ARC4
\brief This function sets the key for a ARC4 object, initializing it for
use as a cipher. It should be called before using it for encryption
with wc_Arc4Process.
\return none
\param arc4 pointer to an arc4 structure to be used for encryption
\param key key with which to initialize the arc4 structure
\param length length of the key used to initialize the arc4 structure
_Example_
\code
Arc4 enc;
byte key[] = { initialize with key to use for encryption };
wc_Arc4SetKey(&enc, key, sizeof(key));
\endcode
\sa wc_Arc4Process
*/
int wc_Arc4SetKey(Arc4* arc4, const byte* key, word32 length);
/*!
\ingroup ARC4
\brief This function initializes an ARC4 structure for use with
asynchronous cryptographic operations. It sets up the heap hint and
device ID for hardware acceleration support.
\return 0 On success.
\return BAD_FUNC_ARG If arc4 is NULL.
\param arc4 pointer to the Arc4 structure to initialize
\param heap pointer to heap hint for memory allocation (can be NULL)
\param devId device ID for hardware acceleration (use INVALID_DEVID
for software)
_Example_
\code
Arc4 arc4;
int ret = wc_Arc4Init(&arc4, NULL, INVALID_DEVID);
if (ret != 0) {
// initialization failed
}
// use arc4 for encryption/decryption
wc_Arc4Free(&arc4);
\endcode
\sa wc_Arc4SetKey
\sa wc_Arc4Free
*/
int wc_Arc4Init(Arc4* arc4, void* heap, int devId);
/*!
\ingroup ARC4
\brief This function frees an ARC4 structure, releasing any resources
allocated for asynchronous cryptographic operations. It should be
called when the ARC4 structure is no longer needed.
\return none No return value.
\param arc4 pointer to the Arc4 structure to free
_Example_
\code
Arc4 arc4;
wc_Arc4Init(&arc4, NULL, INVALID_DEVID);
wc_Arc4SetKey(&arc4, key, keyLen);
// use arc4 for encryption/decryption
wc_Arc4Free(&arc4);
\endcode
\sa wc_Arc4Init
\sa wc_Arc4SetKey
*/
void wc_Arc4Free(Arc4* arc4);