Exemplo n.º 1
0
/*
 * Initialize the hashing context with the given parameter block and key.
 * Always returns 1.
 */
int BLAKE2b_Init_key(BLAKE2B_CTX *c, const BLAKE2B_PARAM *P, const void *key)
{
    blake2b_init_param(c, P);

    /* Pad the key to form first data block */
    {
        uint8_t block[BLAKE2B_BLOCKBYTES] = {0};

        memcpy(block, key, P->key_length);
        BLAKE2b_Update(c, block, BLAKE2B_BLOCKBYTES);
        OPENSSL_cleanse(block, BLAKE2B_BLOCKBYTES);
    }

    return 1;
}
Exemplo n.º 2
0
static int update(EVP_MD_CTX *ctx, const void *data, size_t count)
{
    return BLAKE2b_Update(EVP_MD_CTX_md_data(ctx), data, count);
}