Exemplo n.º 1
0
/**
 * \brief Frees a RandState object after destroying all sensitive material.
 *
 * \param state The RandState object to free.
 *
 * \return NOISE_ERROR_NONE on success.
 * \return NOISE_ERROR_INVALID_PARAM if \a state is NULL.
 *
 * \sa noise_randstate_new()
 */
int noise_randstate_free(NoiseRandState *state)
{
    /* Validate the parameter */
    if (!state)
        return NOISE_ERROR_INVALID_PARAM;

    /* Clean and free the memory */
    noise_free(state, state->size);
    return NOISE_ERROR_NONE;
}
Exemplo n.º 2
0
/* Clean up */
static void
gst_marble_finalize (GObject * obj)
{
  GstMarble *marble = GST_MARBLE_CAST (obj);

  noise_free (marble->noise);
  g_free (marble->sin_table);
  g_free (marble->cos_table);

  G_OBJECT_CLASS (parent_class)->finalize (obj);
}
Exemplo n.º 3
0
/**
 * \brief Frees a CipherState object after destroying all sensitive material.
 *
 * \param state The CipherState object to free.
 *
 * \return NOISE_ERROR_NONE on success.
 * \return NOISE_ERROR_INVALID_PARAM if \a state is NULL.
 *
 * \sa noise_cipherstate_new_by_id(), noise_cipherstate_new_by_name()
 */
int noise_cipherstate_free(NoiseCipherState *state)
{
    /* Bail out if no cipher state */
    if (!state)
        return NOISE_ERROR_INVALID_PARAM;

    /* Call the backend-specific destroy function if necessary */
    if (state->destroy)
        (*(state->destroy))(state);

    /* Clean and free the memory */
    noise_free(state, state->size);
    return NOISE_ERROR_NONE;
}
Exemplo n.º 4
0
/**
 * \brief Frees a SymmetricState object after destroying all sensitive material.
 *
 * \param state The SymmetricState object to free.
 *
 * \return NOISE_ERROR_NONE on success.
 * \return NOISE_ERROR_INVALID_PARAM if \a state is NULL.
 *
 * \sa noise_symmetricstate_new_by_id(), noise_symmetricstate_new_by_name()
 */
int noise_symmetricstate_free(NoiseSymmetricState *state)
{
    /* Bail out if no symmetric state */
    if (!state)
        return NOISE_ERROR_INVALID_PARAM;

    /* Free the sub objects that are hanging off the symmetricstate */
    if (state->cipher)
        noise_cipherstate_free(state->cipher);
    if (state->hash)
        noise_hashstate_free(state->hash);

    /* Clean and free the memory for "state" */
    noise_free(state, state->size);
    return NOISE_ERROR_NONE;
}