FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/asn.c
/* Get date buffer, format and length. Returns 0=success or error */
Get date buffer, format and length. Returns 0=success or error
Get date buffer format and length . Returns 0 = success or error
static int GetDateInfo(const byte* source, word32* idx, const byte** pDate,
                        byte* pFormat, int* pLength, word32 maxIdx)
{
    int length;
    byte format;
    if (source == NULL || idx == NULL)
        return BAD_FUNC_ARG;
    if (*idx+1 > maxIdx)
        return BUFFER_E;
    format = source[*idx];
    *idx += 1;
    if (format != ASN_UTC_TIME && format != ASN_GENERALIZED_TIME)
        return ASN_TIME_E;
    if (GetLength(source, idx, &length, maxIdx) < 0)
        return ASN_PARSE_E;
    if (length > MAX_DATE_SIZE || length < MIN_DATE_SIZE)
        return ASN_DATE_SZ_E;
    if (pFormat)
        *pFormat = format;
    if (pDate)
        *pDate = &source[*idx];
    if (pLength)
        *pLength = length;
    *idx += length;
    return 0;
}
static int GetDateInfo ( const byte * source , word32 * idx , const byte * * pDate , byte * pFormat , int * pLength , word32 maxIdx ) { int length ; byte format ; if ( source == NULL || idx == NULL ) return BAD_FUNC_ARG ; if ( * idx + 1 > maxIdx ) return BUFFER_E ; format = source [ * idx ] ; * idx += 1 ; if ( format != ASN_UTC_TIME && format != ASN_GENERALIZED_TIME ) return ASN_TIME_E ; if ( GetLength ( source , idx , & length , maxIdx ) < 0 ) return ASN_PARSE_E ; if ( length > MAX_DATE_SIZE || length < MIN_DATE_SIZE ) return ASN_DATE_SZ_E ; if ( pFormat ) * pFormat = format ; if ( pDate ) * pDate = & source [ * idx ] ; if ( pLength ) * pLength = length ; * idx += length ; return 0 ; }
Get date buffer, format and length.
Get date buffer format and length .
/* get ASN format header */ /* get length */ /* return format, date and length */