From: Nikos Mavrogiannopoulos Date: Mon, 20 Feb 2012 22:52:32 +0000 (+0100) Subject: hash copy no longer needed. X-Git-Tag: gnutls_3_0_14~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7caea810423c07ca9a6a0cf13dbcf568199c4d2c;p=thirdparty%2Fgnutls.git hash copy no longer needed. --- diff --git a/lib/accelerated/x86/sha-padlock.c b/lib/accelerated/x86/sha-padlock.c index ddb74cf64d..44f3a43881 100644 --- a/lib/accelerated/x86/sha-padlock.c +++ b/lib/accelerated/x86/sha-padlock.c @@ -298,28 +298,6 @@ wrap_padlock_hash_init (gnutls_digest_algorithm_t algo, void **_ctx) return 0; } -static int -wrap_padlock_hash_copy (void **bhd, void *ahd) -{ - struct padlock_hash_ctx *ctx = ahd; - struct padlock_hash_ctx *dst_ctx; - int ret; - - ret = wrap_padlock_hash_init (ctx->algo, bhd); - if (ret < 0) - { - gnutls_assert (); - return ret; - } - - dst_ctx = *bhd; - - memcpy (&dst_ctx->ctx, &ctx->ctx, sizeof (ctx->ctx)); - - return 0; -} - - static int wrap_padlock_hash_output (void *src_ctx, void *digest, size_t digestsize) { @@ -406,7 +384,6 @@ const gnutls_crypto_digest_st sha_padlock_nano_struct = { .init = wrap_padlock_hash_init, .hash = wrap_padlock_hash_update, .reset = wrap_padlock_hash_reset, - .copy = wrap_padlock_hash_copy, .output = wrap_padlock_hash_output, .deinit = wrap_padlock_hash_deinit, .fast = wrap_padlock_hash_fast, diff --git a/lib/crypto-backend.h b/lib/crypto-backend.h index a05359d821..1044f00ea9 100644 --- a/lib/crypto-backend.h +++ b/lib/crypto-backend.h @@ -67,7 +67,6 @@ int (*init) (gnutls_digest_algorithm_t, void **ctx); void (*reset) (void *ctx); int (*hash) (void *ctx, const void *src, size_t srcsize); - int (*copy) (void **dst_ctx, void *src_ctx); int (*output) (void *src_ctx, void *digest, size_t digestsize); void (*deinit) (void *ctx); int (*fast)(gnutls_digest_algorithm_t, const void *src, size_t srcsize, void *digest); diff --git a/lib/gnutls_hash_int.c b/lib/gnutls_hash_int.c index 277d21dd85..543369e546 100644 --- a/lib/gnutls_hash_int.c +++ b/lib/gnutls_hash_int.c @@ -77,7 +77,6 @@ _gnutls_hash_init (digest_hd_st * dig, gnutls_digest_algorithm_t algorithm) } dig->hash = cc->hash; - dig->copy = cc->copy; dig->reset = cc->reset; dig->output = cc->output; dig->deinit = cc->deinit; @@ -93,7 +92,6 @@ _gnutls_hash_init (digest_hd_st * dig, gnutls_digest_algorithm_t algorithm) } dig->hash = _gnutls_digest_ops.hash; - dig->copy = _gnutls_digest_ops.copy; dig->reset = _gnutls_digest_ops.reset; dig->output = _gnutls_digest_ops.output; dig->deinit = _gnutls_digest_ops.deinit; @@ -124,23 +122,6 @@ _gnutls_hash_get_algo_len (gnutls_digest_algorithm_t algorithm) return digest_length (algorithm); } -int -_gnutls_hash_copy (digest_hd_st * dst, digest_hd_st * src) -{ - - memset (dst, 0, sizeof (*dst)); - dst->algorithm = src->algorithm; - - dst->hash = src->hash; - dst->copy = src->copy; - dst->output = src->output; - dst->deinit = src->deinit; - - return src->copy (&dst->handle, src->handle); -} - - - int _gnutls_hash_fast (gnutls_digest_algorithm_t algorithm, const void *text, size_t textlen, void *digest) diff --git a/lib/gnutls_hash_int.h b/lib/gnutls_hash_int.h index 40a4f3dc03..565d6a612a 100644 --- a/lib/gnutls_hash_int.h +++ b/lib/gnutls_hash_int.h @@ -37,7 +37,6 @@ extern int crypto_digest_prio; extern gnutls_crypto_digest_st _gnutls_digest_ops; typedef int (*hash_func) (void *handle, const void *text, size_t size); -typedef int (*copy_func) (void **dst_ctx, void *src_ctx); typedef void (*reset_func) (void *ctx); typedef int (*output_func) (void *src_ctx, void *digest, size_t digestsize); typedef void (*deinit_func) (void *handle); @@ -49,7 +48,6 @@ typedef struct int keysize; hash_func hash; - copy_func copy; reset_func reset; output_func output; deinit_func deinit; @@ -169,8 +167,6 @@ void _gnutls_mac_reset_ssl3 (digest_hd_st * handle); int _gnutls_mac_deinit_ssl3_handshake (digest_hd_st * handle, void *digest, uint8_t * key, uint32_t key_size); -int _gnutls_hash_copy (digest_hd_st * dst_handle, digest_hd_st * src_handle); - inline static int IS_SHA(gnutls_digest_algorithm_t algo) { if (algo == GNUTLS_DIG_SHA1 || algo == GNUTLS_DIG_SHA224 || diff --git a/lib/nettle/mac.c b/lib/nettle/mac.c index 52e63b439e..acaacf4a84 100644 --- a/lib/nettle/mac.c +++ b/lib/nettle/mac.c @@ -268,27 +268,6 @@ wrap_nettle_hash_update (void *_ctx, const void *text, size_t textsize) return GNUTLS_E_SUCCESS; } -static int -wrap_nettle_hash_copy (void **bhd, void *ahd) -{ - struct nettle_hash_ctx *ctx = ahd; - struct nettle_hash_ctx *dst_ctx; - int ret; - - ret = wrap_nettle_hash_init (ctx->algo, bhd); - if (ret < 0) - { - gnutls_assert (); - return ret; - } - - dst_ctx = *bhd; - - memcpy (&dst_ctx->ctx, &ctx->ctx, sizeof (ctx->ctx)); - - return 0; -} - static void wrap_nettle_hash_deinit (void *hd) { @@ -459,7 +438,6 @@ gnutls_crypto_digest_st _gnutls_digest_ops = { .init = wrap_nettle_hash_init, .hash = wrap_nettle_hash_update, .reset = wrap_nettle_hash_reset, - .copy = wrap_nettle_hash_copy, .output = wrap_nettle_hash_output, .deinit = wrap_nettle_hash_deinit, .fast = wrap_nettle_hash_fast,