FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/asn.c
/* add signature to end of buffer, size of buffer assumed checked, return
   new length */
add signature to end of buffer, size of buffer assumed checked, return
new length
add signature to end of buffer size of buffer assumed checked return new length
static int AddSignature(byte* buf, int bodySz, const byte* sig, int sigSz,
                        int sigAlgoType)
{
    byte seq[MAX_SEQ_SZ];
    int  idx = bodySz, seqSz;
    idx += SetAlgoID(sigAlgoType, buf ? buf + idx : NULL, oidSigType, 0);
    idx += SetBitString(sigSz, 0, buf ? buf + idx : NULL);
    if (buf)
        XMEMCPY(buf + idx, sig, sigSz);
    idx += sigSz;
    seqSz = SetSequence(idx, seq);
    if (buf) {
        XMEMMOVE(buf + seqSz, buf, idx);
        XMEMCPY(buf, seq, seqSz);
    }
    return idx + seqSz;
}
static int AddSignature ( byte * buf , int bodySz , const byte * sig , int sigSz , int sigAlgoType ) { byte seq [ MAX_SEQ_SZ ] ; int idx = bodySz , seqSz ; idx += SetAlgoID ( sigAlgoType , buf ? buf + idx : NULL , oidSigType , 0 ) ; idx += SetBitString ( sigSz , 0 , buf ? buf + idx : NULL ) ; if ( buf ) XMEMCPY ( buf + idx , sig , sigSz ) ; idx += sigSz ; seqSz = SetSequence ( idx , seq ) ; if ( buf ) { XMEMMOVE ( buf + seqSz , buf , idx ) ; XMEMCPY ( buf , seq , seqSz ) ; } return idx + seqSz ; }
add signature to end of buffer, size of buffer assumed checked, return
new length
add signature to end of buffer size of buffer assumed checked return new length
/* algo */ /* bit string */ /* signature */ /* make room for overall header */