@@ -466,4 +466,109 @@ int wc_AsconAEAD128_DecryptUpdate(wc_AsconAEAD128* a, byte* out, const byte* in,
466466 */
467467int 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