FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/asn.c
/* encode Subject Key Identifier, return total bytes written
 * RFC5280 : non-critical */
encode Subject Key Identifier, return total bytes written
RFC5280 : non-critical
encode Subject Key Identifier return total bytes written RFC5280 : non - critical
static int SetSKID(byte* output, word32 outSz, const byte *input, word32 length)
{
    byte skid_len[1 + MAX_LENGTH_SZ];
    byte skid_enc_len[MAX_LENGTH_SZ];
    int idx = 0, skid_lenSz, skid_enc_lenSz;
    const byte skid_oid[] = { 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04 };
    if (output == NULL || input == NULL)
        return BAD_FUNC_ARG;
    skid_lenSz = SetOctetString(length, skid_len);
    skid_enc_lenSz = SetLength(length + skid_lenSz, skid_enc_len);
    if (outSz < 3)
        return BUFFER_E;
    idx = SetSequence(length + sizeof(skid_oid) + skid_lenSz + skid_enc_lenSz,
                      output);
    if ((length + sizeof(skid_oid) + skid_lenSz + skid_enc_lenSz) > outSz)
        return BUFFER_E;
    XMEMCPY(output+idx, skid_oid, sizeof(skid_oid));
    idx += sizeof(skid_oid);
    XMEMCPY(output+idx, skid_enc_len, skid_enc_lenSz);
    idx += skid_enc_lenSz;
    XMEMCPY(output+idx, skid_len, skid_lenSz);
    idx += skid_lenSz;
    XMEMCPY(output+idx, input, length);
    idx += length;
    return idx;
}
static int SetSKID ( byte * output , word32 outSz , const byte * input , word32 length ) { byte skid_len [ 1 + MAX_LENGTH_SZ ] ; byte skid_enc_len [ MAX_LENGTH_SZ ] ; int idx = 0 , skid_lenSz , skid_enc_lenSz ; const byte skid_oid [ ] = { 0x06 , 0x03 , 0x55 , 0x1d , 0x0e , 0x04 } ; if ( output == NULL || input == NULL ) return BAD_FUNC_ARG ; skid_lenSz = SetOctetString ( length , skid_len ) ; skid_enc_lenSz = SetLength ( length + skid_lenSz , skid_enc_len ) ; if ( outSz < 3 ) return BUFFER_E ; idx = SetSequence ( length + sizeof ( skid_oid ) + skid_lenSz + skid_enc_lenSz , output ) ; if ( ( length + sizeof ( skid_oid ) + skid_lenSz + skid_enc_lenSz ) > outSz ) return BUFFER_E ; XMEMCPY ( output + idx , skid_oid , sizeof ( skid_oid ) ) ; idx += sizeof ( skid_oid ) ; XMEMCPY ( output + idx , skid_enc_len , skid_enc_lenSz ) ; idx += skid_enc_lenSz ; XMEMCPY ( output + idx , skid_len , skid_lenSz ) ; idx += skid_lenSz ; XMEMCPY ( output + idx , input , length ) ; idx += length ; return idx ; }
encode Subject Key Identifier, return total bytes written
 RFC5280 : non-critical
encode Subject Key Identifier return total bytes written RFC5280 : non - critical
/* Octet String header */ /* length of encoded value */ /* put oid */ /* put encoded len */ /* put octet header */ /* put value */