diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2014-03-08 17:04:22 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2014-03-08 17:04:22 +0100 |
commit | f225d1a0a68101409095dc1d5ef36f93a83519c1 (patch) | |
tree | 05191bb18be111d6acaad672aeeab0b69a424fd3 | |
parent | 422cbd3109aaef0f9e6b1ca11bbd63549fc4fcb1 (diff) | |
download | gnutls-f225d1a0a68101409095dc1d5ef36f93a83519c1.tar.gz |
stricter type usage
-rw-r--r-- | lib/algorithms.h | 1 | ||||
-rw-r--r-- | lib/algorithms/mac.c | 6 | ||||
-rw-r--r-- | lib/algorithms/sign.c | 2 | ||||
-rw-r--r-- | lib/crypto-api.c | 4 | ||||
-rw-r--r-- | lib/gnutls_buffers.c | 2 | ||||
-rw-r--r-- | lib/gnutls_cert.c | 2 | ||||
-rw-r--r-- | lib/gnutls_handshake.c | 4 | ||||
-rw-r--r-- | lib/gnutls_hash_int.c | 2 | ||||
-rw-r--r-- | lib/gnutls_int.h | 6 | ||||
-rw-r--r-- | lib/gnutls_pcert.c | 2 | ||||
-rw-r--r-- | lib/gnutls_privkey.c | 4 | ||||
-rw-r--r-- | lib/gnutls_pubkey.c | 13 | ||||
-rw-r--r-- | lib/gnutls_sig.c | 37 | ||||
-rw-r--r-- | lib/gnutls_srp.c | 2 | ||||
-rw-r--r-- | lib/gnutls_ui.c | 2 | ||||
-rw-r--r-- | lib/verify-tofu.c | 11 | ||||
-rw-r--r-- | lib/x509/crq.c | 2 | ||||
-rw-r--r-- | lib/x509/ocsp.c | 4 | ||||
-rw-r--r-- | lib/x509/ocsp_output.c | 4 | ||||
-rw-r--r-- | lib/x509/pkcs12_encr.c | 2 | ||||
-rw-r--r-- | lib/x509/privkey.c | 2 | ||||
-rw-r--r-- | lib/x509/x509.c | 4 |
22 files changed, 63 insertions, 55 deletions
diff --git a/lib/algorithms.h b/lib/algorithms.h index 0ab19a4afe..394a81fbbd 100644 --- a/lib/algorithms.h +++ b/lib/algorithms.h @@ -76,6 +76,7 @@ int _gnutls_version_has_explicit_iv(const version_entry_st * ver) /* Functions for MACs. */ const mac_entry_st *mac_to_entry(gnutls_mac_algorithm_t c); +#define hash_to_entry(x) mac_to_entry((gnutls_mac_algorithm_t)(x)) inline static int _gnutls_mac_is_ok(const mac_entry_st * e) { diff --git a/lib/algorithms/mac.c b/lib/algorithms/mac.c index e691a4ef3a..75ccd78052 100644 --- a/lib/algorithms/mac.c +++ b/lib/algorithms/mac.c @@ -132,8 +132,8 @@ gnutls_digest_algorithm_t gnutls_digest_get_id(const char *name) GNUTLS_HASH_LOOP( if (p->oid != NULL && strcasecmp(p->name, name) == 0) { - if (_gnutls_digest_exists(p->id)) - ret = p->id; + if (_gnutls_digest_exists((gnutls_digest_algorithm_t)p->id)) + ret = (gnutls_digest_algorithm_t)p->id; break; } ); @@ -254,7 +254,7 @@ const gnutls_digest_algorithm_t *gnutls_digest_list(void) if (p->oid != NULL && (p->placeholder != 0 || _gnutls_mac_exists(p->id))) { - supported_digests[i++] = p->id; + supported_digests[i++] = (gnutls_digest_algorithm_t)p->id; } ); supported_digests[i++] = 0; diff --git a/lib/algorithms/sign.c b/lib/algorithms/sign.c index 3dfade089a..5da5bf3668 100644 --- a/lib/algorithms/sign.c +++ b/lib/algorithms/sign.c @@ -143,7 +143,7 @@ int gnutls_sign_is_secure(gnutls_sign_algorithm_t algorithm) GNUTLS_SIGN_ALG_LOOP(dig = p->mac); if (dig != GNUTLS_DIG_UNKNOWN) - return _gnutls_digest_is_secure(mac_to_entry(dig)); + return _gnutls_digest_is_secure(hash_to_entry(dig)); return 0; } diff --git a/lib/crypto-api.c b/lib/crypto-api.c index 2ec9083337..3353a261c9 100644 --- a/lib/crypto-api.c +++ b/lib/crypto-api.c @@ -482,7 +482,7 @@ gnutls_hash_init(gnutls_hash_hd_t * dig, } return _gnutls_hash_init(((digest_hd_st *) * dig), - mac_to_entry(algorithm)); + hash_to_entry(algorithm)); } /** @@ -547,7 +547,7 @@ void gnutls_hash_deinit(gnutls_hash_hd_t handle, void *digest) **/ int gnutls_hash_get_len(gnutls_digest_algorithm_t algorithm) { - return _gnutls_hash_get_algo_len(mac_to_entry(algorithm)); + return _gnutls_hash_get_algo_len(hash_to_entry(algorithm)); } /** diff --git a/lib/gnutls_buffers.c b/lib/gnutls_buffers.c index a46a1175ca..0d81a4ec55 100644 --- a/lib/gnutls_buffers.c +++ b/lib/gnutls_buffers.c @@ -1310,7 +1310,7 @@ _gnutls_handshake_io_recv_int(gnutls_session_t session, return gnutls_assert_val(ret); } - if (htype != (unsigned) -1) { + if (htype != (gnutls_handshake_description_t) -1) { ret = handshake_remaining_time(session); if (ret < 0) return gnutls_assert_val(ret); diff --git a/lib/gnutls_cert.c b/lib/gnutls_cert.c index ba8bf232ab..7b8b2da6c5 100644 --- a/lib/gnutls_cert.c +++ b/lib/gnutls_cert.c @@ -247,7 +247,7 @@ _gnutls_selected_cert_supported_kx(gnutls_session_t session, gnutls_kx_algorithm_t * alg, int *alg_size) { - gnutls_kx_algorithm_t kx; + unsigned kx; gnutls_pk_algorithm_t pk, cert_pk; gnutls_pcert_st *cert; int i; diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c index 1331d92220..bf050ae24d 100644 --- a/lib/gnutls_handshake.c +++ b/lib/gnutls_handshake.c @@ -284,11 +284,11 @@ _gnutls_ssl3_finished(gnutls_session_t session, int type, uint8_t * ret, else len = session->internals.handshake_hash_buffer_prev_len; - rc = _gnutls_hash_init(&td_sha, mac_to_entry(GNUTLS_DIG_SHA1)); + rc = _gnutls_hash_init(&td_sha, hash_to_entry(GNUTLS_DIG_SHA1)); if (rc < 0) return gnutls_assert_val(rc); - rc = _gnutls_hash_init(&td_md5, mac_to_entry(GNUTLS_DIG_MD5)); + rc = _gnutls_hash_init(&td_md5, hash_to_entry(GNUTLS_DIG_MD5)); if (rc < 0) { _gnutls_hash_deinit(&td_sha, NULL); return gnutls_assert_val(rc); diff --git a/lib/gnutls_hash_int.c b/lib/gnutls_hash_int.c index 237f0aed96..39b04780a0 100644 --- a/lib/gnutls_hash_int.c +++ b/lib/gnutls_hash_int.c @@ -276,7 +276,7 @@ _gnutls_mac_init_ssl3(digest_hd_st * ret, const mac_entry_st * e, FAIL_IF_LIB_ERROR; - padsize = get_padsize((gnutls_digest_algorithm_t) e->id); + padsize = get_padsize(e->id); if (padsize == 0) { gnutls_assert(); return GNUTLS_E_HASH_FAILED; diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h index 6599f41faa..006f0635ea 100644 --- a/lib/gnutls_int.h +++ b/lib/gnutls_int.h @@ -185,8 +185,10 @@ typedef enum record_flush_t { * when receiving we use a different way as there are implementations that * store more data than allowed. */ -#define MAX_RECORD_SEND_OVERHEAD(session) (MAX_CIPHER_BLOCK_SIZE/*iv*/+MAX_PAD_SIZE+(gnutls_compression_get(session)!=GNUTLS_COMP_NULL)?EXTRA_COMP_SIZE:0+MAX_HASH_SIZE/*MAC*/) -#define MAX_RECORD_SEND_SIZE(session) (IS_DTLS(session)?((size_t)gnutls_dtls_get_mtu(session)):(size_t)session->security_parameters.max_record_send_size+MAX_RECORD_SEND_OVERHEAD(session)) +#define MAX_RECORD_SEND_OVERHEAD(session) (MAX_CIPHER_BLOCK_SIZE/*iv*/+MAX_PAD_SIZE+((gnutls_compression_get(session)!=GNUTLS_COMP_NULL)?(EXTRA_COMP_SIZE):(0))+MAX_HASH_SIZE/*MAC*/) +#define MAX_RECORD_SEND_SIZE(session) (IS_DTLS(session)? \ + ((size_t)gnutls_dtls_get_mtu(session)): \ + ((size_t)session->security_parameters.max_record_send_size+MAX_RECORD_SEND_OVERHEAD(session))) #define MAX_PAD_SIZE 255 #define EXTRA_COMP_SIZE 2048 diff --git a/lib/gnutls_pcert.c b/lib/gnutls_pcert.c index 344b3e9df6..83fbfda9a5 100644 --- a/lib/gnutls_pcert.c +++ b/lib/gnutls_pcert.c @@ -247,7 +247,7 @@ int gnutls_pcert_import_openpgp(gnutls_pcert_st * pcert, } ret = - gnutls_openpgp_crt_export(crt, GNUTLS_X509_FMT_DER, + gnutls_openpgp_crt_export(crt, GNUTLS_OPENPGP_FMT_RAW, pcert->cert.data, &sz); if (ret < 0) { ret = gnutls_assert_val(ret); diff --git a/lib/gnutls_privkey.c b/lib/gnutls_privkey.c index 50720ff325..1be9821caa 100644 --- a/lib/gnutls_privkey.c +++ b/lib/gnutls_privkey.c @@ -754,7 +754,7 @@ gnutls_privkey_sign_data(gnutls_privkey_t signer, { int ret; gnutls_datum_t digest; - const mac_entry_st *me = mac_to_entry(hash); + const mac_entry_st *me = hash_to_entry(hash); if (flags & GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA) return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); @@ -833,7 +833,7 @@ gnutls_privkey_sign_hash(gnutls_privkey_t signer, memcpy(digest.data, hash_data->data, digest.size); ret = - pk_prepare_hash(signer->pk_algorithm, mac_to_entry(hash_algo), + pk_prepare_hash(signer->pk_algorithm, hash_to_entry(hash_algo), &digest); if (ret < 0) { gnutls_assert(); diff --git a/lib/gnutls_pubkey.c b/lib/gnutls_pubkey.c index ef23c1042b..046d229220 100644 --- a/lib/gnutls_pubkey.c +++ b/lib/gnutls_pubkey.c @@ -1516,7 +1516,7 @@ gnutls_pubkey_verify_data(gnutls_pubkey_t pubkey, unsigned int flags, if (ret < 0) return gnutls_assert_val(ret); - ret = pubkey_verify_data(pubkey->pk_algorithm, mac_to_entry(hash), + ret = pubkey_verify_data(pubkey->pk_algorithm, hash_to_entry(hash), data, signature, &pubkey->params); if (ret < 0) { gnutls_assert(); @@ -1559,7 +1559,10 @@ gnutls_pubkey_verify_data2(gnutls_pubkey_t pubkey, if (flags & GNUTLS_PUBKEY_VERIFY_FLAG_TLS1_RSA) return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); - me = mac_to_entry(gnutls_sign_get_hash_algorithm(algo)); + me = hash_to_entry(gnutls_sign_get_hash_algorithm(algo)); + if (me == NULL) + return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); + ret = pubkey_verify_data(pubkey->pk_algorithm, me, data, signature, &pubkey->params); if (ret < 0) { @@ -1641,7 +1644,7 @@ gnutls_pubkey_verify_hash2(gnutls_pubkey_t key, return _gnutls_pk_verify(GNUTLS_PK_RSA, hash, signature, &key->params); } else { - me = mac_to_entry(gnutls_sign_get_hash_algorithm(algo)); + me = hash_to_entry(gnutls_sign_get_hash_algorithm(algo)); return pubkey_verify_hashed_data(key->pk_algorithm, me, hash, signature, &key->params); @@ -1731,7 +1734,7 @@ int _gnutls_pubkey_compatible_with_sig(gnutls_session_t session, gnutls_assert_val (GNUTLS_E_INCOMPAT_DSA_KEY_WITH_TLS_PROTOCOL); } else if (sign != GNUTLS_SIGN_UNKNOWN) { - me = mac_to_entry(gnutls_sign_get_hash_algorithm + me = hash_to_entry(gnutls_sign_get_hash_algorithm (sign)); sig_hash_size = _gnutls_hash_get_algo_len(me); if (sig_hash_size < hash_size) @@ -1748,7 +1751,7 @@ int _gnutls_pubkey_compatible_with_sig(gnutls_session_t session, &pubkey->params, &hash_size); - me = mac_to_entry(gnutls_sign_get_hash_algorithm + me = hash_to_entry(gnutls_sign_get_hash_algorithm (sign)); sig_hash_size = _gnutls_hash_get_algo_len(me); diff --git a/lib/gnutls_sig.c b/lib/gnutls_sig.c index 238f23c12e..5c5f4f3b30 100644 --- a/lib/gnutls_sig.c +++ b/lib/gnutls_sig.c @@ -79,7 +79,7 @@ _gnutls_handshake_sign_data(gnutls_session_t session, gnutls_sign_algorithm_set_server(session, *sign_algo); hash_algo = - mac_to_entry(gnutls_sign_get_hash_algorithm(*sign_algo)); + hash_to_entry(gnutls_sign_get_hash_algorithm(*sign_algo)); if (hash_algo == NULL) return gnutls_assert_val(GNUTLS_E_UNKNOWN_HASH_ALGORITHM); @@ -106,8 +106,8 @@ _gnutls_handshake_sign_data(gnutls_session_t session, ret = _gnutls_hash_init(&td_md5, - mac_to_entry - (GNUTLS_MAC_MD5)); + hash_to_entry + (GNUTLS_DIG_MD5)); if (ret < 0) { gnutls_assert(); return ret; @@ -139,7 +139,7 @@ _gnutls_handshake_sign_data(gnutls_session_t session, case GNUTLS_PK_EC: _gnutls_hash_deinit(&td_sha, concat); - if (!IS_SHA(hash_algo->id)) { + if (!IS_SHA((gnutls_digest_algorithm_t)hash_algo->id)) { gnutls_assert(); return GNUTLS_E_INTERNAL_ERROR; } @@ -241,8 +241,9 @@ sign_tls_hash(gnutls_session_t session, const mac_entry_st * hash_algo, return gnutls_privkey_sign_raw_data(pkey, 0, hash_concat, signature); else - return gnutls_privkey_sign_hash(pkey, hash_algo->id, 0, - hash_concat, signature); + return gnutls_privkey_sign_hash(pkey, + (gnutls_digest_algorithm_t)hash_algo->id, + 0, hash_concat, signature); } static int @@ -351,9 +352,9 @@ _gnutls_handshake_verify_data(gnutls_session_t session, return gnutls_assert_val(ret); hash_algo = gnutls_sign_get_hash_algorithm(sign_algo); - me = mac_to_entry(hash_algo); + me = hash_to_entry(hash_algo); } else { - me = mac_to_entry(GNUTLS_DIG_MD5); + me = hash_to_entry(GNUTLS_DIG_MD5); ret = _gnutls_hash_init(&td_md5, me); if (ret < 0) { gnutls_assert(); @@ -368,7 +369,7 @@ _gnutls_handshake_verify_data(gnutls_session_t session, GNUTLS_RANDOM_SIZE); _gnutls_hash(&td_md5, params->data, params->size); - me = mac_to_entry(GNUTLS_DIG_SHA1); + me = hash_to_entry(GNUTLS_DIG_SHA1); } ret = _gnutls_hash_init(&td_sha, me); @@ -435,10 +436,10 @@ _gnutls_handshake_verify_crt_vrfy12(gnutls_session_t session, gnutls_sign_algorithm_set_client(session, sign_algo); - me = mac_to_entry(gnutls_sign_get_hash_algorithm(sign_algo)); + me = hash_to_entry(gnutls_sign_get_hash_algorithm(sign_algo)); ret = - _gnutls_hash_fast(me->id, + _gnutls_hash_fast((gnutls_digest_algorithm_t)me->id, session->internals.handshake_hash_buffer. data, session->internals. @@ -489,13 +490,13 @@ _gnutls_handshake_verify_crt_vrfy(gnutls_session_t session, signature, sign_algo); - ret = _gnutls_hash_init(&td_md5, mac_to_entry(GNUTLS_DIG_MD5)); + ret = _gnutls_hash_init(&td_md5, hash_to_entry(GNUTLS_DIG_MD5)); if (ret < 0) { gnutls_assert(); return ret; } - ret = _gnutls_hash_init(&td_sha, mac_to_entry(GNUTLS_DIG_SHA1)); + ret = _gnutls_hash_init(&td_sha, hash_to_entry(GNUTLS_DIG_SHA1)); if (ret < 0) { gnutls_assert(); _gnutls_hash_deinit(&td_md5, NULL); @@ -577,14 +578,14 @@ _gnutls_handshake_sign_crt_vrfy12(gnutls_session_t session, gnutls_sign_algorithm_set_client(session, sign_algo); - me = mac_to_entry(gnutls_sign_get_hash_algorithm(sign_algo)); + me = hash_to_entry(gnutls_sign_get_hash_algorithm(sign_algo)); _gnutls_debug_log("sign handshake cert vrfy: picked %s with %s\n", gnutls_sign_algorithm_get_name(sign_algo), _gnutls_mac_get_name(me)); ret = - _gnutls_hash_fast(me->id, + _gnutls_hash_fast((gnutls_digest_algorithm_t)me->id, session->internals.handshake_hash_buffer. data, session->internals.handshake_hash_buffer. @@ -635,7 +636,7 @@ _gnutls_handshake_sign_crt_vrfy(gnutls_session_t session, return _gnutls_handshake_sign_crt_vrfy12(session, cert, pkey, signature); - ret = _gnutls_hash_init(&td_sha, mac_to_entry(GNUTLS_DIG_SHA1)); + ret = _gnutls_hash_init(&td_sha, hash_to_entry(GNUTLS_DIG_SHA1)); if (ret < 0) { gnutls_assert(); return ret; @@ -674,7 +675,7 @@ _gnutls_handshake_sign_crt_vrfy(gnutls_session_t session, case GNUTLS_PK_RSA: ret = _gnutls_hash_init(&td_md5, - mac_to_entry(GNUTLS_DIG_MD5)); + hash_to_entry(GNUTLS_DIG_MD5)); if (ret < 0) return gnutls_assert_val(ret); @@ -732,7 +733,7 @@ pk_hash_data(gnutls_pk_algorithm_t pk, const mac_entry_st * hash, } ret = - _gnutls_hash_fast(hash->id, data->data, data->size, + _gnutls_hash_fast((gnutls_digest_algorithm_t)hash->id, data->data, data->size, digest->data); if (ret < 0) { gnutls_assert(); diff --git a/lib/gnutls_srp.c b/lib/gnutls_srp.c index 8b5bbc37bf..8a7f49d5e0 100644 --- a/lib/gnutls_srp.c +++ b/lib/gnutls_srp.c @@ -186,7 +186,7 @@ bigint_t _gnutls_calc_srp_u(bigint_t A, bigint_t B, bigint_t n) _gnutls_mpi_print(A, &holder[n_size - a_size], &a_size); _gnutls_mpi_print(B, &holder[n_size + n_size - b_size], &b_size); - ret = _gnutls_hash_fast(GNUTLS_MAC_SHA1, holder, holder_size, hd); + ret = _gnutls_hash_fast(GNUTLS_DIG_SHA1, holder, holder_size, hd); if (ret < 0) { gnutls_free(holder); gnutls_assert(); diff --git a/lib/gnutls_ui.c b/lib/gnutls_ui.c index a0b393b330..b8bd6c6824 100644 --- a/lib/gnutls_ui.c +++ b/lib/gnutls_ui.c @@ -576,7 +576,7 @@ gnutls_fingerprint(gnutls_digest_algorithm_t algo, size_t * result_size) { int ret; - int hash_len = _gnutls_hash_get_algo_len(mac_to_entry(algo)); + int hash_len = _gnutls_hash_get_algo_len(hash_to_entry(algo)); if (hash_len < 0 || (unsigned) hash_len > *result_size || result == NULL) { diff --git a/lib/verify-tofu.c b/lib/verify-tofu.c index 28b1090fd3..7c6a2dc8cb 100644 --- a/lib/verify-tofu.c +++ b/lib/verify-tofu.c @@ -212,8 +212,8 @@ static int parse_commitment_line(char *line, /* hash and hex encode */ ret = - _gnutls_hash_fast(hash_algo->id, skey->data, skey->size, - phash); + _gnutls_hash_fast((gnutls_digest_algorithm_t)hash_algo->id, + skey->data, skey->size, phash); if (ret < 0) return gnutls_assert_val(ret); @@ -715,9 +715,9 @@ gnutls_store_commitment(const char *db_name, FILE *fd = NULL; int ret; char local_file[MAX_FILENAME]; - const mac_entry_st *me = mac_to_entry(hash_algo); + const mac_entry_st *me = hash_to_entry(hash_algo); - if (_gnutls_digest_is_secure(me) == 0) + if (me == NULL || _gnutls_digest_is_secure(me) == 0) return gnutls_assert_val(GNUTLS_E_ILLEGAL_PARAMETER); if (_gnutls_hash_get_algo_len(me) != hash->size) @@ -744,7 +744,8 @@ gnutls_store_commitment(const char *db_name, _gnutls_debug_log("Configuration file: %s\n", db_name); - tdb->cstore(db_name, host, service, expiration, me->id, hash); + tdb->cstore(db_name, host, service, expiration, + (gnutls_digest_algorithm_t)me->id, hash); ret = 0; diff --git a/lib/x509/crq.c b/lib/x509/crq.c index 98b5e190bd..a40a561295 100644 --- a/lib/x509/crq.c +++ b/lib/x509/crq.c @@ -2530,7 +2530,7 @@ int gnutls_x509_crq_verify(gnutls_x509_crq_t crq, unsigned int flags) ret = pubkey_verify_data(gnutls_x509_crq_get_pk_algorithm(crq, NULL), - mac_to_entry(algo), &data, &signature, + hash_to_entry(algo), &data, &signature, ¶ms); if (ret < 0) { gnutls_assert(); diff --git a/lib/x509/ocsp.c b/lib/x509/ocsp.c index 4e6adf850c..7fe5eb103d 100644 --- a/lib/x509/ocsp.c +++ b/lib/x509/ocsp.c @@ -565,7 +565,7 @@ gnutls_ocsp_req_add_cert_id(gnutls_ocsp_req_t req, return GNUTLS_E_INVALID_REQUEST; } - oid = _gnutls_x509_digest_to_oid(mac_to_entry(digest)); + oid = _gnutls_x509_digest_to_oid(hash_to_entry(digest)); if (oid == NULL) { gnutls_assert(); return GNUTLS_E_INVALID_REQUEST; @@ -1232,7 +1232,7 @@ gnutls_ocsp_resp_check_crt(gnutls_ocsp_resp_t resp, goto cleanup; } - hash_len = _gnutls_hash_get_algo_len(mac_to_entry(digest)); + hash_len = _gnutls_hash_get_algo_len(hash_to_entry(digest)); if (hash_len != rdn_hash.size) { ret = gnutls_assert_val(GNUTLS_E_OCSP_RESPONSE_ERROR); goto cleanup; diff --git a/lib/x509/ocsp_output.c b/lib/x509/ocsp_output.c index 8a2e0e4797..20fe7de70d 100644 --- a/lib/x509/ocsp_output.c +++ b/lib/x509/ocsp_output.c @@ -73,7 +73,7 @@ static void print_req(gnutls_buffer_st * str, gnutls_ocsp_req_t req) continue; } addf(str, "\t\t\tHash Algorithm: %s\n", - _gnutls_digest_get_name(mac_to_entry(digest))); + _gnutls_digest_get_name(hash_to_entry(digest))); adds(str, "\t\t\tIssuer Name Hash: "); _gnutls_buffer_hexprint(str, in.data, in.size); @@ -343,7 +343,7 @@ print_resp(gnutls_buffer_st * str, gnutls_ocsp_resp_t resp, continue; } addf(str, "\t\t\tHash Algorithm: %s\n", - _gnutls_digest_get_name(mac_to_entry(digest))); + _gnutls_digest_get_name(hash_to_entry(digest))); adds(str, "\t\t\tIssuer Name Hash: "); _gnutls_buffer_hexprint(str, in.data, in.size); diff --git a/lib/x509/pkcs12_encr.c b/lib/x509/pkcs12_encr.c index bac1840bff..c7ac7fb810 100644 --- a/lib/x509/pkcs12_encr.c +++ b/lib/x509/pkcs12_encr.c @@ -134,7 +134,7 @@ _gnutls_pkcs12_string_to_key(unsigned int id, const uint8_t * salt, _gnutls_hash(&md, buf_i, pw ? i_size : 64); _gnutls_hash_deinit(&md, hash); for (i = 1; i < iter; i++) { - rc = _gnutls_hash_fast(GNUTLS_MAC_SHA1, hash, 20, + rc = _gnutls_hash_fast(GNUTLS_DIG_SHA1, hash, 20, hash); if (rc < 0) { gnutls_assert(); diff --git a/lib/x509/privkey.c b/lib/x509/privkey.c index 192eea6fe6..0f630312a7 100644 --- a/lib/x509/privkey.c +++ b/lib/x509/privkey.c @@ -1624,7 +1624,7 @@ gnutls_x509_privkey_sign_data(gnutls_x509_privkey_t key, int result; gnutls_datum_t sig = { NULL, 0 }; gnutls_datum_t hash; - const mac_entry_st *me = mac_to_entry(digest); + const mac_entry_st *me = hash_to_entry(digest); if (key == NULL) { gnutls_assert(); diff --git a/lib/x509/x509.c b/lib/x509/x509.c index fa3fb1307e..08ea4f9c1e 100644 --- a/lib/x509/x509.c +++ b/lib/x509/x509.c @@ -2623,7 +2623,7 @@ _gnutls_get_key_id(gnutls_pk_algorithm_t pk, gnutls_pk_params_st * params, gnutls_datum_t der = { NULL, 0 }; const gnutls_digest_algorithm_t hash = GNUTLS_DIG_SHA1; unsigned int digest_len = - _gnutls_hash_get_algo_len(mac_to_entry(hash)); + _gnutls_hash_get_algo_len(hash_to_entry(hash)); if (output_data == NULL || *output_data_size < digest_len) { gnutls_assert(); @@ -3000,7 +3000,7 @@ gnutls_x509_crt_verify_hash(gnutls_x509_crt_t crt, unsigned int flags, ret = pubkey_verify_hashed_data(gnutls_x509_crt_get_pk_algorithm - (crt, NULL), mac_to_entry(algo), + (crt, NULL), hash_to_entry(algo), hash, signature, ¶ms); if (ret < 0) { gnutls_assert(); |