FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/asn.c
/* encode extensions header, return total bytes written */
encode extensions header, return total bytes written
encode extensions header return total bytes written
static int SetExtensionsHeader(byte* out, word32 outSz, int extSz)
{
    byte sequence[MAX_SEQ_SZ];
    byte len[MAX_LENGTH_SZ];
    int seqSz, lenSz, idx = 0;
    if (out == NULL)
        return BAD_FUNC_ARG;
    if (outSz < 3)
        return BUFFER_E;
    seqSz = SetSequence(extSz, sequence);
    lenSz = SetLength(extSz+seqSz, len);
    if (outSz < (word32)(lenSz+seqSz+1))
        return BUFFER_E;
    out[idx++] = ASN_EXTENSIONS; 
    XMEMCPY(&out[idx], len, lenSz);  
    idx += lenSz;
    XMEMCPY(&out[idx], sequence, seqSz);  
    idx += seqSz;
    return idx;
}
static int SetExtensionsHeader ( byte * out , word32 outSz , int extSz ) { byte sequence [ MAX_SEQ_SZ ] ; byte len [ MAX_LENGTH_SZ ] ; int seqSz , lenSz , idx = 0 ; if ( out == NULL ) return BAD_FUNC_ARG ; if ( outSz < 3 ) return BUFFER_E ; seqSz = SetSequence ( extSz , sequence ) ; lenSz = SetLength ( extSz + seqSz , len ) ; if ( outSz < ( word32 ) ( lenSz + seqSz + 1 ) ) return BUFFER_E ; out [ idx ++ ] = ASN_EXTENSIONS ; XMEMCPY ( & out [ idx ] , len , lenSz ) ; idx += lenSz ; XMEMCPY ( & out [ idx ] , sequence , seqSz ) ; idx += seqSz ; return idx ; }
encode extensions header, return total bytes written
encode extensions header return total bytes written
/* encode extensions length provided */ /* extensions id */ /* length */ /* sequence */