FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/asn.c
/* Get the DER/BER encoding of an ASN.1 OBJECT_ID header.
 *
 * input     Buffer holding DER/BER encoded data.
 * inOutIdx  Current index into buffer to parse.
 * len       The number of bytes in the ASN.1 data.
 * maxIdx    Length of data in buffer.
 * returns BUFFER_E when there is not enough data to parse.
 *         ASN_OBJECt_ID_E when the OBJECT_ID tag is not found.
 *         ASN_PARSE_E when length is invalid.
 *         Otherwise, 0 to indicate success.
 */
Get the DER/BER encoding of an ASN.1 OBJECT_ID header.
input     Buffer holding DER/BER encoded data.
inOutIdx  Current index into buffer to parse.
len       The number of bytes in the ASN.1 data.
maxIdx    Length of data in buffer.
returns BUFFER_E when there is not enough data to parse.
ASN_OBJECt_ID_E when the OBJECT_ID tag is not found.
ASN_PARSE_E when length is invalid.
Otherwise, 0 to indicate success.
Get the DER / BER encoding of an ASN . 1 OBJECT_ID header . input Buffer holding DER / BER encoded data . inOutIdx Current index into buffer to parse . len The number of bytes in the ASN . 1 data . maxIdx Length of data in buffer . returns BUFFER_E when there is not enough data to parse . ASN_OBJECt_ID_E when the OBJECT_ID tag is not found . ASN_PARSE_E when length is invalid . Otherwise 0 to indicate success .
int GetASNObjectId(const byte* input, word32* inOutIdx, int* len,
                          word32 maxIdx)
{
    word32 idx = *inOutIdx;
    int    length;
    byte   tag;
    if ((idx + 1) > maxIdx)
        return BUFFER_E;
    if (GetASNTag(input, &idx, &tag, maxIdx) != 0)
        return ASN_PARSE_E;
    if (tag != ASN_OBJECT_ID)
        return ASN_OBJECT_ID_E;
    if (GetLength(input, &idx, &length, maxIdx) < 0)
        return ASN_PARSE_E;
    *len = length;
    *inOutIdx = idx;
    return 0;
}
int GetASNObjectId ( const byte * input , word32 * inOutIdx , int * len , word32 maxIdx ) { word32 idx = * inOutIdx ; int length ; byte tag ; if ( ( idx + 1 ) > maxIdx ) return BUFFER_E ; if ( GetASNTag ( input , & idx , & tag , maxIdx ) != 0 ) return ASN_PARSE_E ; if ( tag != ASN_OBJECT_ID ) return ASN_OBJECT_ID_E ; if ( GetLength ( input , & idx , & length , maxIdx ) < 0 ) return ASN_PARSE_E ; * len = length ; * inOutIdx = idx ; return 0 ; }
Get the DER/BER encoding of an ASN.1 OBJECT_ID header.
Get the DER / BER encoding of an ASN . 1 OBJECT_ID header .