INNER CODE UNIT · C

state

jedisct1/libsodium-php · libsodium.c:850

    state = (unsigned char *) Z_STRVAL(*state_zv);
    state_len = Z_STRLEN(*state_zv);
    if (state_len != sizeof (crypto_generichash_state)) {
        zend_throw_exception(sodium_exception_ce, "incorrect state length", 0);
        return;
    }
    memcpy(&state_tmp, state, sizeof state_tmp);
    if (crypto_generichash_update((void *) &state_tmp, msg,
                                  (unsigned long long) msg_len) != 0) {
        sodium_memzero(&state_tmp, sizeof state_tmp);
        zend_throw_exception(sodium_exception_ce, "internal error", 0);
        return;
    }
    memcpy(state, &state_tmp, state_len);
    sodium_memzero(&state_tmp, sizeof state_tmp);

    RETURN_TRUE;
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…