diff options
author | Daniel Stenberg <daniel@haxx.se> | 2012-08-06 19:20:35 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2012-08-06 22:39:13 +0200 |
commit | 9f304291bd72aae66944cd7523707e1b88c6ad7b (patch) | |
tree | 84433539497f9517f41c1eec6f70e4c85e827be8 | |
parent | 986c7949c0638bebb99bd08d63216433254c2185 (diff) |
metalink: change code order to build with gnutls-nettle
Bug: http://curl.haxx.se/bug/view.cgi?id=3554668
Reported by: Anthony G. Basile
-rw-r--r-- | src/tool_metalink.c | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/src/tool_metalink.c b/src/tool_metalink.c index 5491815a3..3a24a1556 100644 --- a/src/tool_metalink.c +++ b/src/tool_metalink.c @@ -82,64 +82,6 @@ return PARAM_NO_MEM; \ } WHILE_FALSE -const digest_params MD5_DIGEST_PARAMS[] = { - { - (Curl_digest_init_func) MD5_Init, - (Curl_digest_update_func) MD5_Update, - (Curl_digest_final_func) MD5_Final, - sizeof(MD5_CTX), - 16 - } -}; - -const digest_params SHA1_DIGEST_PARAMS[] = { - { - (Curl_digest_init_func) SHA1_Init, - (Curl_digest_update_func) SHA1_Update, - (Curl_digest_final_func) SHA1_Final, - sizeof(SHA_CTX), - 20 - } -}; - -const digest_params SHA256_DIGEST_PARAMS[] = { - { - (Curl_digest_init_func) SHA256_Init, - (Curl_digest_update_func) SHA256_Update, - (Curl_digest_final_func) SHA256_Final, - sizeof(SHA256_CTX), - 32 - } -}; - -static const metalink_digest_def SHA256_DIGEST_DEF[] = { - {"sha-256", SHA256_DIGEST_PARAMS} -}; - -static const metalink_digest_def SHA1_DIGEST_DEF[] = { - {"sha-1", SHA1_DIGEST_PARAMS} -}; - -static const metalink_digest_def MD5_DIGEST_DEF[] = { - {"md5", MD5_DIGEST_PARAMS} -}; - -/* - * The alias of supported hash functions in the order by preference - * (basically stronger hash comes first). We included "sha-256" and - * "sha256". The former is the name defined in the IANA registry named - * "Hash Function Textual Names". The latter is widely (and - * historically) used in Metalink version 3. - */ -static const metalink_digest_alias digest_aliases[] = { - {"sha-256", SHA256_DIGEST_DEF}, - {"sha256", SHA256_DIGEST_DEF}, - {"sha-1", SHA1_DIGEST_DEF}, - {"sha1", SHA1_DIGEST_DEF}, - {"md5", MD5_DIGEST_DEF}, - {NULL, NULL} -}; - #ifdef USE_GNUTLS_NETTLE static void MD5_Init(MD5_CTX *ctx) @@ -251,6 +193,64 @@ static void SHA256_Final(unsigned char digest[32], SHA256_CTX *ctx) #endif /* CRYPTO LIBS */ +const digest_params MD5_DIGEST_PARAMS[] = { + { + (Curl_digest_init_func) MD5_Init, + (Curl_digest_update_func) MD5_Update, + (Curl_digest_final_func) MD5_Final, + sizeof(MD5_CTX), + 16 + } +}; + +const digest_params SHA1_DIGEST_PARAMS[] = { + { + (Curl_digest_init_func) SHA1_Init, + (Curl_digest_update_func) SHA1_Update, + (Curl_digest_final_func) SHA1_Final, + sizeof(SHA_CTX), + 20 + } +}; + +const digest_params SHA256_DIGEST_PARAMS[] = { + { + (Curl_digest_init_func) SHA256_Init, + (Curl_digest_update_func) SHA256_Update, + (Curl_digest_final_func) SHA256_Final, + sizeof(SHA256_CTX), + 32 + } +}; + +static const metalink_digest_def SHA256_DIGEST_DEF[] = { + {"sha-256", SHA256_DIGEST_PARAMS} +}; + +static const metalink_digest_def SHA1_DIGEST_DEF[] = { + {"sha-1", SHA1_DIGEST_PARAMS} +}; + +static const metalink_digest_def MD5_DIGEST_DEF[] = { + {"md5", MD5_DIGEST_PARAMS} +}; + +/* + * The alias of supported hash functions in the order by preference + * (basically stronger hash comes first). We included "sha-256" and + * "sha256". The former is the name defined in the IANA registry named + * "Hash Function Textual Names". The latter is widely (and + * historically) used in Metalink version 3. + */ +static const metalink_digest_alias digest_aliases[] = { + {"sha-256", SHA256_DIGEST_DEF}, + {"sha256", SHA256_DIGEST_DEF}, + {"sha-1", SHA1_DIGEST_DEF}, + {"sha1", SHA1_DIGEST_DEF}, + {"md5", MD5_DIGEST_DEF}, + {NULL, NULL} +}; + digest_context *Curl_digest_init(const digest_params *dparams) { digest_context *ctxt; |