openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/libxcrypt/4.4.6-r0/git/lib/crypt-gost-yescrypt.c
void gensalt_gost_yescrypt_rn(unsigned long count, const uint8_t* rbytes,
                              size_t nrbytes, uint8_t* output, size_t o_size)
{
    if (o_size < 4 + 8 * 6 + BASE64_LEN(nrbytes) + 1 ||
        CRYPT_GENSALT_OUTPUT_SIZE < 4 + 8 * 6 + BASE64_LEN(nrbytes) + 1)
    {
        errno = ERANGE;
        return;
    }

    /* We pass 'o_size - 1' to gensalt, because we need to shift
             the prefix by 1 char to insert the gost marker.  */
    gensalt_yescrypt_rn(count, rbytes, nrbytes, output, o_size - 1);

    /* Check for failures.  */
    if (output[0] == '*')
        return;

    /* Shift output one byte further.  */
    memmove(output + 1, output, strlen((const char*)output) + 1);

    /* Insert the gost marker.  */
    output[1] = 'g';
}
/*
 * As OUTPUT is initialized with a failure token before gensalt_yescrypt_rn
 * is called, in case of an error we could just set an appropriate errno
 * and return.
 */
As OUTPUT is initialized with a failure token before gensalt_yescrypt_rn
is called, in case of an error we could just set an appropriate errno
and return.
As OUTPUT is initialized with a failure token before gensalt_yescrypt_rn is called in case of an error we could just set an appropriate errno and return .
void gensalt_gost_yescrypt_rn(unsigned long count, const uint8_t* rbytes,
                              size_t nrbytes, uint8_t* output, size_t o_size)
{
    if (o_size < 4 + 8 * 6 + BASE64_LEN(nrbytes) + 1 ||
        CRYPT_GENSALT_OUTPUT_SIZE < 4 + 8 * 6 + BASE64_LEN(nrbytes) + 1)
    {
        errno = ERANGE;
        return;
    }
    gensalt_yescrypt_rn(count, rbytes, nrbytes, output, o_size - 1);
    if (output[0] == '*')
        return;
    memmove(output + 1, output, strlen((const char*)output) + 1);
    output[1] = 'g';
}
void gensalt_gost_yescrypt_rn ( unsigned long count , const uint8_t * rbytes , size_t nrbytes , uint8_t * output , size_t o_size ) { if ( o_size < 4 + 8 * 6 + BASE64_LEN ( nrbytes ) + 1 || CRYPT_GENSALT_OUTPUT_SIZE < 4 + 8 * 6 + BASE64_LEN ( nrbytes ) + 1 ) { errno = ERANGE ; return ; } gensalt_yescrypt_rn ( count , rbytes , nrbytes , output , o_size - 1 ) ; if ( output [ 0 ] == ' ' ) return ; memmove ( output + 1 , output , strlen ( ( const char * ) output ) + 1 ) ; output [ 1 ] = ' ' ; }
As OUTPUT is initialized with a failure token before gensalt_yescrypt_rn
 is called, in case of an error we could just set an appropriate errno
 and return.
As OUTPUT is initialized with a failure token before gensalt_yescrypt_rn is called in case of an error we could just set an appropriate errno and return .
/* We pass 'o_size - 1' to gensalt, because we need to shift
             the prefix by 1 char to insert the gost marker.  */ /* Check for failures.  */ /* Shift output one byte further.  */ /* Insert the gost marker.  */