src/wolfcrypt/src/port/kcapi/kcapi_rsa.c
/* Set the DER/BER encoding of the ASN.1 INTEGER header.
 *
 * len        Length of data to encode.
 * firstByte  First byte of data, most significant byte of integer, to encode.
 * output     Buffer to write into.
 * returns the number of bytes added to the buffer.
 */
Set the DER/BER encoding of the ASN.1 INTEGER header.

len        Length of data to encode.
firstByte  First byte of data, most significant byte of integer, to encode.
output     Buffer to write into.
returns the number of bytes added to the buffer.
Set the DER / BER encoding of the ASN . 1 INTEGER header . len Length of data to encode . firstByte First byte of data most significant byte of integer to encode . output Buffer to write into . returns the number of bytes added to the buffer .
static int SetASNInt(int len, byte firstByte, byte* output)
{
    word32 idx = 0;
    if (output)
        output[idx] = ASN_INTEGER;
    idx++;
    if (firstByte & 0x80)
        len++;
    idx += SetLength(len, output ? output + idx : NULL);
    if (firstByte & 0x80) {
        if (output)
            output[idx] = 0x00;
        idx++;
    }
    return idx;
}
static int SetASNInt ( int len , byte firstByte , byte * output ) { word32 idx = 0 ; if ( output ) output [ idx ] = ASN_INTEGER ; idx ++ ; if ( firstByte & 0x80 ) len ++ ; idx += SetLength ( len , output ? output + idx : NULL ) ; if ( firstByte & 0x80 ) { if ( output ) output [ idx ] = 0x00 ; idx ++ ; } return idx ; }
Set the DER/BER encoding of the ASN.1 INTEGER header.
Set the DER / BER encoding of the ASN . 1 INTEGER header .