FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/asn.c
/* Get the DER/BER encoding of an ASN.1 BOOLEAN.
 *
 * input     Buffer holding DER/BER encoded data.
 * inOutIdx  Current index into buffer to parse.
 * maxIdx    Length of data in buffer.
 * returns BUFFER_E when there is not enough data to parse.
 *         ASN_PARSE_E when the BOOLEAN tag is not found or length is not 1.
 *         Otherwise, 0 to indicate the value was false and 1 to indicate true.
 */
Get the DER/BER encoding of an ASN.1 BOOLEAN.
input     Buffer holding DER/BER encoded data.
inOutIdx  Current index into buffer to parse.
maxIdx    Length of data in buffer.
returns BUFFER_E when there is not enough data to parse.
ASN_PARSE_E when the BOOLEAN tag is not found or length is not 1.
Otherwise, 0 to indicate the value was false and 1 to indicate true.
Get the DER / BER encoding of an ASN . 1 BOOLEAN . input Buffer holding DER / BER encoded data . inOutIdx Current index into buffer to parse . maxIdx Length of data in buffer . returns BUFFER_E when there is not enough data to parse . ASN_PARSE_E when the BOOLEAN tag is not found or length is not 1 . Otherwise 0 to indicate the value was false and 1 to indicate true .
static int GetBoolean(const byte* input, word32* inOutIdx, word32 maxIdx)
{
    word32 idx = *inOutIdx;
    byte   b;
    if ((idx + 3) > maxIdx)
        return BUFFER_E;
    b = input[idx++];
    if (b != ASN_BOOLEAN)
        return ASN_PARSE_E;
    if (input[idx++] != 1)
        return ASN_PARSE_E;
    b = input[idx++] != 0;
    *inOutIdx = idx;
    return b;
}
static int GetBoolean ( const byte * input , word32 * inOutIdx , word32 maxIdx ) { word32 idx = * inOutIdx ; byte b ; if ( ( idx + 3 ) > maxIdx ) return BUFFER_E ; b = input [ idx ++ ] ; if ( b != ASN_BOOLEAN ) return ASN_PARSE_E ; if ( input [ idx ++ ] != 1 ) return ASN_PARSE_E ; b = input [ idx ++ ] != 0 ; * inOutIdx = idx ; return b ; }
Get the DER/BER encoding of an ASN.1 BOOLEAN.
Get the DER / BER encoding of an ASN . 1 BOOLEAN .