FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/poly1305.c
/*  Takes a Poly1305 struct that has a key loaded and pads the provided length
    ctx        : Initialized Poly1305 struct to use
    lenToPad   : Current number of bytes updated that needs padding to 16
 */
Takes a Poly1305 struct that has a key loaded and pads the provided length
ctx        : Initialized Poly1305 struct to use
lenToPad   : Current number of bytes updated that needs padding to 16
Takes a Poly1305 struct that has a key loaded and pads the provided length ctx : Initialized Poly1305 struct to use lenToPad : Current number of bytes updated that needs padding to 16
int wc_Poly1305_Pad(Poly1305* ctx, word32 lenToPad)
{
    int ret = 0;
    word32 paddingLen;
    byte padding[WC_POLY1305_PAD_SZ - 1];
    if (ctx == NULL) {
        return BAD_FUNC_ARG;
    }
    if (lenToPad == 0) {
        return 0; 
    }
    XMEMSET(padding, 0, sizeof(padding));
    paddingLen = -(int)lenToPad & (WC_POLY1305_PAD_SZ - 1);
    if (paddingLen > 0) {
        ret = wc_Poly1305Update(ctx, padding, paddingLen);
    }
    return ret;
}
int wc_Poly1305_Pad ( Poly1305 * ctx , word32 lenToPad ) { int ret = 0 ; word32 paddingLen ; byte padding [ WC_POLY1305_PAD_SZ - 1 ] ; if ( ctx == NULL ) { return BAD_FUNC_ARG ; } if ( lenToPad == 0 ) { return 0 ; } XMEMSET ( padding , 0 , sizeof ( padding ) ) ; paddingLen = - ( int ) lenToPad & ( WC_POLY1305_PAD_SZ - 1 ) ; if ( paddingLen > 0 ) { ret = wc_Poly1305Update ( ctx , padding , paddingLen ) ; } return ret ; }
Takes a Poly1305 struct that has a key loaded and pads the provided length
ctx        : Initialized Poly1305 struct to use
lenToPad   : Current number of bytes updated that needs padding to 16
Takes a Poly1305 struct that has a key loaded and pads the provided length ctx : Initialized Poly1305 struct to use lenToPad : Current number of bytes updated that needs padding to 16
/* nothing needs to be done */ /* Pad length to 16 bytes */