aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/https/x509
diff options
context:
space:
mode:
authorlv-426 <oxcafebaby@yahoo.com>2008-07-26 03:26:56 +0000
committerlv-426 <oxcafebaby@yahoo.com>2008-07-26 03:26:56 +0000
commit16abaea132ac90293a868ecb944abce24fd16d9f (patch)
tree490881a7b7ac6172608c2e9c9ba10d69160551b5 /src/daemon/https/x509
parent14a57219373afd8dd110ee8af89b32767c72c1dc (diff)
downloadlibmicrohttpd-16abaea132ac90293a868ecb944abce24fd16d9f.tar.gz
libmicrohttpd-16abaea132ac90293a868ecb944abce24fd16d9f.zip
'microhttps.h' merge
gnutls version added to configure.ac to enable assersion before running curl tests GNUTLS symbol renaming
Diffstat (limited to 'src/daemon/https/x509')
-rw-r--r--src/daemon/https/x509/common.c4
-rw-r--r--src/daemon/https/x509/crl_write.c3
-rw-r--r--src/daemon/https/x509/crq.c2
-rw-r--r--src/daemon/https/x509/mpi.c4
-rw-r--r--src/daemon/https/x509/output.c10
-rw-r--r--src/daemon/https/x509/pkcs12.c4
-rw-r--r--src/daemon/https/x509/privkey_pkcs8.c28
-rw-r--r--src/daemon/https/x509/sign.c4
-rw-r--r--src/daemon/https/x509/x509.c10
-rw-r--r--src/daemon/https/x509/x509_privkey.c32
-rw-r--r--src/daemon/https/x509/x509_verify.c8
-rw-r--r--src/daemon/https/x509/x509_write.c3
12 files changed, 57 insertions, 55 deletions
diff --git a/src/daemon/https/x509/common.c b/src/daemon/https/x509/common.c
index 98a655c7..82d433ce 100644
--- a/src/daemon/https/x509/common.c
+++ b/src/daemon/https/x509/common.c
@@ -1244,7 +1244,7 @@ _gnutls_x509_encode_and_copy_PKI_params (ASN1_TYPE dst,
1244 return _gnutls_asn2err (result); 1244 return _gnutls_asn2err (result);
1245 } 1245 }
1246 1246
1247 if (pk_algorithm == GNUTLS_PK_RSA) 1247 if (pk_algorithm == MHD_GNUTLS_PK_RSA)
1248 { 1248 {
1249 /* disable parameters, which are not used in RSA. 1249 /* disable parameters, which are not used in RSA.
1250 */ 1250 */
@@ -1363,7 +1363,7 @@ _gnutls_x509_get_pk_algorithm (ASN1_TYPE src,
1363 1363
1364 switch (algo) 1364 switch (algo)
1365 { 1365 {
1366 case GNUTLS_PK_RSA: 1366 case MHD_GNUTLS_PK_RSA:
1367 { 1367 {
1368 if ((result = _gnutls_x509_read_rsa_params (str, len, params)) < 0) 1368 if ((result = _gnutls_x509_read_rsa_params (str, len, params)) < 0)
1369 { 1369 {
diff --git a/src/daemon/https/x509/crl_write.c b/src/daemon/https/x509/crl_write.c
index 370a492c..465f1782 100644
--- a/src/daemon/https/x509/crl_write.c
+++ b/src/daemon/https/x509/crl_write.c
@@ -143,7 +143,8 @@ int
143gnutls_x509_crl_sign (gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer, 143gnutls_x509_crl_sign (gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer,
144 gnutls_x509_privkey_t issuer_key) 144 gnutls_x509_privkey_t issuer_key)
145{ 145{
146 return gnutls_x509_crl_sign2 (crl, issuer, issuer_key, GNUTLS_DIG_SHA1, 0); 146 return gnutls_x509_crl_sign2 (crl, issuer, issuer_key, MHD_GNUTLS_DIG_SHA1,
147 0);
147} 148}
148 149
149/** 150/**
diff --git a/src/daemon/https/x509/crq.c b/src/daemon/https/x509/crq.c
index 8e663d51..8a60d35f 100644
--- a/src/daemon/https/x509/crq.c
+++ b/src/daemon/https/x509/crq.c
@@ -805,7 +805,7 @@ gnutls_x509_crq_sign2 (gnutls_x509_crq_t crq, gnutls_x509_privkey_t key,
805int 805int
806gnutls_x509_crq_sign (gnutls_x509_crq_t crq, gnutls_x509_privkey_t key) 806gnutls_x509_crq_sign (gnutls_x509_crq_t crq, gnutls_x509_privkey_t key)
807{ 807{
808 return gnutls_x509_crq_sign2 (crq, key, GNUTLS_DIG_SHA1, 0); 808 return gnutls_x509_crq_sign2 (crq, key, MHD_GNUTLS_DIG_SHA1, 0);
809} 809}
810 810
811/** 811/**
diff --git a/src/daemon/https/x509/mpi.c b/src/daemon/https/x509/mpi.c
index 7fbd0b75..0d39adb5 100644
--- a/src/daemon/https/x509/mpi.c
+++ b/src/daemon/https/x509/mpi.c
@@ -231,7 +231,7 @@ _gnutls_x509_crt_get_mpis (gnutls_x509_crt_t cert,
231 231
232 switch (pk_algorithm) 232 switch (pk_algorithm)
233 { 233 {
234 case GNUTLS_PK_RSA: 234 case MHD_GNUTLS_PK_RSA:
235 /* params[0] is the modulus, 235 /* params[0] is the modulus,
236 * params[1] is the exponent 236 * params[1] is the exponent
237 */ 237 */
@@ -365,7 +365,7 @@ _gnutls_x509_write_sig_params (ASN1_TYPE dst,
365 _gnutls_str_cpy (name, sizeof (name), dst_name); 365 _gnutls_str_cpy (name, sizeof (name), dst_name);
366 _gnutls_str_cat (name, sizeof (name), ".parameters"); 366 _gnutls_str_cat (name, sizeof (name), ".parameters");
367 367
368 if (pk_algorithm == GNUTLS_PK_RSA) 368 if (pk_algorithm == MHD_GNUTLS_PK_RSA)
369 { /* RSA */ 369 { /* RSA */
370 result = asn1_write_value (dst, name, NULL, 0); 370 result = asn1_write_value (dst, name, NULL, 0);
371 371
diff --git a/src/daemon/https/x509/output.c b/src/daemon/https/x509/output.c
index dcc87ab1..8892cf4e 100644
--- a/src/daemon/https/x509/output.c
+++ b/src/daemon/https/x509/output.c
@@ -612,7 +612,7 @@ print_cert (gnutls_string * str, gnutls_x509_crt_t cert, int notsigned)
612 addf (str, _("\tSubject Public Key Algorithm: %s\n"), name); 612 addf (str, _("\tSubject Public Key Algorithm: %s\n"), name);
613 switch (err) 613 switch (err)
614 { 614 {
615 case GNUTLS_PK_RSA: 615 case MHD_GNUTLS_PK_RSA:
616 { 616 {
617 gnutls_datum_t m, e; 617 gnutls_datum_t m, e;
618 618
@@ -932,7 +932,7 @@ print_fingerprint (gnutls_string * str, gnutls_x509_crt_t cert,
932 return; 932 return;
933 } 933 }
934 934
935 if (algo == GNUTLS_DIG_MD5) 935 if (algo == MHD_GNUTLS_DIG_MD5)
936 addf (str, _("\tMD5 fingerprint:\n\t\t")); 936 addf (str, _("\tMD5 fingerprint:\n\t\t"));
937 else 937 else
938 addf (str, _("\tSHA-1 fingerprint:\n\t\t")); 938 addf (str, _("\tSHA-1 fingerprint:\n\t\t"));
@@ -981,8 +981,8 @@ print_other (gnutls_string * str, gnutls_x509_crt_t cert, int notsigned)
981{ 981{
982 if (!notsigned) 982 if (!notsigned)
983 { 983 {
984 print_fingerprint (str, cert, GNUTLS_DIG_MD5); 984 print_fingerprint (str, cert, MHD_GNUTLS_DIG_MD5);
985 print_fingerprint (str, cert, GNUTLS_DIG_SHA1); 985 print_fingerprint (str, cert, MHD_GNUTLS_DIG_SHA1);
986 } 986 }
987 print_keyid (str, cert); 987 print_keyid (str, cert);
988} 988}
@@ -1088,7 +1088,7 @@ print_oneline (gnutls_string * str, gnutls_x509_crt_t cert)
1088 size_t size = sizeof (buffer); 1088 size_t size = sizeof (buffer);
1089 int err; 1089 int err;
1090 1090
1091 err = gnutls_x509_crt_get_fingerprint (cert, GNUTLS_DIG_SHA1, 1091 err = gnutls_x509_crt_get_fingerprint (cert, MHD_GNUTLS_DIG_SHA1,
1092 buffer, &size); 1092 buffer, &size);
1093 if (err < 0) 1093 if (err < 0)
1094 { 1094 {
diff --git a/src/daemon/https/x509/pkcs12.c b/src/daemon/https/x509/pkcs12.c
index 40f7a243..abd647b0 100644
--- a/src/daemon/https/x509/pkcs12.c
+++ b/src/daemon/https/x509/pkcs12.c
@@ -924,7 +924,7 @@ gnutls_pkcs12_generate_mac (gnutls_pkcs12_t pkcs12, const char *pass)
924 924
925 /* MAC the data 925 /* MAC the data
926 */ 926 */
927 td1 = _gnutls_hmac_init (GNUTLS_MAC_SHA1, key, sizeof (key)); 927 td1 = _gnutls_hmac_init (MHD_GNUTLS_MAC_SHA1, key, sizeof (key));
928 if (td1 == GNUTLS_MAC_FAILED) 928 if (td1 == GNUTLS_MAC_FAILED)
929 { 929 {
930 gnutls_assert (); 930 gnutls_assert ();
@@ -1050,7 +1050,7 @@ gnutls_pkcs12_verify_mac (gnutls_pkcs12_t pkcs12, const char *pass)
1050 1050
1051 /* MAC the data 1051 /* MAC the data
1052 */ 1052 */
1053 td1 = _gnutls_hmac_init (GNUTLS_MAC_SHA1, key, sizeof (key)); 1053 td1 = _gnutls_hmac_init (MHD_GNUTLS_MAC_SHA1, key, sizeof (key));
1054 if (td1 == GNUTLS_MAC_FAILED) 1054 if (td1 == GNUTLS_MAC_FAILED)
1055 { 1055 {
1056 gnutls_assert (); 1056 gnutls_assert ();
diff --git a/src/daemon/https/x509/privkey_pkcs8.c b/src/daemon/https/x509/privkey_pkcs8.c
index 0812fa3c..c0ce6a5c 100644
--- a/src/daemon/https/x509/privkey_pkcs8.c
+++ b/src/daemon/https/x509/privkey_pkcs8.c
@@ -139,7 +139,7 @@ _encode_privkey (gnutls_x509_privkey pkey, gnutls_datum * raw)
139 139
140 switch (pkey->pk_algorithm) 140 switch (pkey->pk_algorithm)
141 { 141 {
142 case GNUTLS_PK_RSA: 142 case MHD_GNUTLS_PK_RSA:
143 ret = 143 ret =
144 gnutls_x509_privkey_export (pkey, GNUTLS_X509_FMT_DER, NULL, &size); 144 gnutls_x509_privkey_export (pkey, GNUTLS_X509_FMT_DER, NULL, &size);
145 if (ret != GNUTLS_E_SHORT_MEMORY_BUFFER) 145 if (ret != GNUTLS_E_SHORT_MEMORY_BUFFER)
@@ -196,7 +196,7 @@ encode_to_private_key_info (gnutls_x509_privkey_t pkey,
196 gnutls_datum algo_params = { NULL, 0 }; 196 gnutls_datum algo_params = { NULL, 0 };
197 gnutls_datum algo_privkey = { NULL, 0 }; 197 gnutls_datum algo_privkey = { NULL, 0 };
198 198
199 if (pkey->pk_algorithm == GNUTLS_PK_RSA) 199 if (pkey->pk_algorithm == MHD_GNUTLS_PK_RSA)
200 { 200 {
201 oid = PK_PKIX1_RSA_OID; 201 oid = PK_PKIX1_RSA_OID;
202 /* parameters are null 202 /* parameters are null
@@ -612,17 +612,17 @@ read_pkcs_schema_params (schema_id schema, const char *password,
612 612
613 if ((schema) == PKCS12_3DES_SHA1) 613 if ((schema) == PKCS12_3DES_SHA1)
614 { 614 {
615 enc_params->cipher = GNUTLS_CIPHER_3DES_CBC; 615 enc_params->cipher = MHD_GNUTLS_CIPHER_3DES_CBC;
616 enc_params->iv_size = 8; 616 enc_params->iv_size = 8;
617 } 617 }
618 else if ((schema) == PKCS12_ARCFOUR_SHA1) 618 else if ((schema) == PKCS12_ARCFOUR_SHA1)
619 { 619 {
620 enc_params->cipher = GNUTLS_CIPHER_ARCFOUR_128; 620 enc_params->cipher = MHD_GNUTLS_CIPHER_ARCFOUR_128;
621 enc_params->iv_size = 0; 621 enc_params->iv_size = 0;
622 } 622 }
623 else if ((schema) == PKCS12_RC2_40_SHA1) 623 else if ((schema) == PKCS12_RC2_40_SHA1)
624 { 624 {
625 enc_params->cipher = GNUTLS_CIPHER_RC2_40_CBC; 625 enc_params->cipher = MHD_GNUTLS_CIPHER_RC2_40_CBC;
626 enc_params->iv_size = 8; 626 enc_params->iv_size = 8;
627 } 627 }
628 628
@@ -950,7 +950,7 @@ decode_private_key_info (const gnutls_datum_t * der,
950 /* we only support RSA and DSA private keys. 950 /* we only support RSA and DSA private keys.
951 */ 951 */
952 if (strcmp (oid, PK_PKIX1_RSA_OID) == 0) 952 if (strcmp (oid, PK_PKIX1_RSA_OID) == 0)
953 pkey->pk_algorithm = GNUTLS_PK_RSA; 953 pkey->pk_algorithm = MHD_GNUTLS_PK_RSA;
954 else 954 else
955 { 955 {
956 gnutls_assert (); 956 gnutls_assert ();
@@ -963,7 +963,7 @@ decode_private_key_info (const gnutls_datum_t * der,
963 /* Get the DER encoding of the actual private key. 963 /* Get the DER encoding of the actual private key.
964 */ 964 */
965 965
966 if (pkey->pk_algorithm == GNUTLS_PK_RSA) 966 if (pkey->pk_algorithm == MHD_GNUTLS_PK_RSA)
967 result = _decode_pkcs8_rsa_key (pkcs8_asn, pkey); 967 result = _decode_pkcs8_rsa_key (pkcs8_asn, pkey);
968 if (result < 0) 968 if (result < 0)
969 { 969 {
@@ -1021,7 +1021,7 @@ gnutls_x509_privkey_import_pkcs8 (gnutls_x509_privkey_t key,
1021 _data.data = data->data; 1021 _data.data = data->data;
1022 _data.size = data->size; 1022 _data.size = data->size;
1023 1023
1024 key->pk_algorithm = GNUTLS_PK_UNKNOWN; 1024 key->pk_algorithm = MHD_GNUTLS_PK_UNKNOWN;
1025 1025
1026 /* If the Certificate is in PEM format then decode it 1026 /* If the Certificate is in PEM format then decode it
1027 */ 1027 */
@@ -1082,7 +1082,7 @@ gnutls_x509_privkey_import_pkcs8 (gnutls_x509_privkey_t key,
1082 return 0; 1082 return 0;
1083 1083
1084cleanup: 1084cleanup:
1085 key->pk_algorithm = GNUTLS_PK_UNKNOWN; 1085 key->pk_algorithm = MHD_GNUTLS_PK_UNKNOWN;
1086 if (need_free) 1086 if (need_free)
1087 _gnutls_free_datum (&_data); 1087 _gnutls_free_datum (&_data);
1088 return result; 1088 return result;
@@ -1291,13 +1291,13 @@ oid2cipher (const char *oid, gnutls_cipher_algorithm_t * algo)
1291 1291
1292 if (strcmp (oid, DES_EDE3_CBC_OID) == 0) 1292 if (strcmp (oid, DES_EDE3_CBC_OID) == 0)
1293 { 1293 {
1294 *algo = GNUTLS_CIPHER_3DES_CBC; 1294 *algo = MHD_GNUTLS_CIPHER_3DES_CBC;
1295 return 0; 1295 return 0;
1296 } 1296 }
1297 1297
1298 if (strcmp (oid, DES_CBC_OID) == 0) 1298 if (strcmp (oid, DES_CBC_OID) == 0)
1299 { 1299 {
1300 *algo = GNUTLS_CIPHER_DES_CBC; 1300 *algo = MHD_GNUTLS_CIPHER_DES_CBC;
1301 return 0; 1301 return 0;
1302 } 1302 }
1303 1303
@@ -1697,11 +1697,11 @@ generate_key (schema_id schema,
1697 */ 1697 */
1698 1698
1699 if (schema == PKCS12_ARCFOUR_SHA1) 1699 if (schema == PKCS12_ARCFOUR_SHA1)
1700 enc_params->cipher = GNUTLS_CIPHER_ARCFOUR_128; 1700 enc_params->cipher = MHD_GNUTLS_CIPHER_ARCFOUR_128;
1701 else if (schema == PKCS12_3DES_SHA1) 1701 else if (schema == PKCS12_3DES_SHA1)
1702 enc_params->cipher = GNUTLS_CIPHER_3DES_CBC; 1702 enc_params->cipher = MHD_GNUTLS_CIPHER_3DES_CBC;
1703 else if (schema == PKCS12_RC2_40_SHA1) 1703 else if (schema == PKCS12_RC2_40_SHA1)
1704 enc_params->cipher = GNUTLS_CIPHER_RC2_40_CBC; 1704 enc_params->cipher = MHD_GNUTLS_CIPHER_RC2_40_CBC;
1705 1705
1706 if (gc_pseudo_random (rnd, 2) != GC_OK) 1706 if (gc_pseudo_random (rnd, 2) != GC_OK)
1707 { 1707 {
diff --git a/src/daemon/https/x509/sign.c b/src/daemon/https/x509/sign.c
index 275fc3f7..7b21825e 100644
--- a/src/daemon/https/x509/sign.c
+++ b/src/daemon/https/x509/sign.c
@@ -162,7 +162,7 @@ pkcs1_rsa_sign (gnutls_digest_algorithm_t hash, const gnutls_datum_t * text,
162 } 162 }
163 163
164 if ((ret = 164 if ((ret =
165 _gnutls_sign (GNUTLS_PK_RSA, params, params_len, &info, 165 _gnutls_sign (MHD_GNUTLS_PK_RSA, params, params_len, &info,
166 signature)) < 0) 166 signature)) < 0)
167 { 167 {
168 gnutls_assert (); 168 gnutls_assert ();
@@ -193,7 +193,7 @@ _gnutls_x509_sign (const gnutls_datum_t * tbs,
193 193
194 switch (signer->pk_algorithm) 194 switch (signer->pk_algorithm)
195 { 195 {
196 case GNUTLS_PK_RSA: 196 case MHD_GNUTLS_PK_RSA:
197 ret = 197 ret =
198 pkcs1_rsa_sign (hash, tbs, signer->params, signer->params_size, 198 pkcs1_rsa_sign (hash, tbs, signer->params, signer->params_size,
199 signature); 199 signature);
diff --git a/src/daemon/https/x509/x509.c b/src/daemon/https/x509/x509.c
index 96999d27..90696168 100644
--- a/src/daemon/https/x509/x509.c
+++ b/src/daemon/https/x509/x509.c
@@ -2041,7 +2041,7 @@ rsadsa_get_key_id (gnutls_x509_crt_t crt,
2041 return result; 2041 return result;
2042 } 2042 }
2043 2043
2044 if (pk == GNUTLS_PK_RSA) 2044 if (pk == MHD_GNUTLS_PK_RSA)
2045 { 2045 {
2046 result = _gnutls_x509_write_rsa_params (params, params_size, &der); 2046 result = _gnutls_x509_write_rsa_params (params, params_size, &der);
2047 if (result < 0) 2047 if (result < 0)
@@ -2053,7 +2053,7 @@ rsadsa_get_key_id (gnutls_x509_crt_t crt,
2053 else 2053 else
2054 return GNUTLS_E_INTERNAL_ERROR; 2054 return GNUTLS_E_INTERNAL_ERROR;
2055 2055
2056 hd = _gnutls_hash_init (GNUTLS_MAC_SHA1); 2056 hd = _gnutls_hash_init (MHD_GNUTLS_MAC_SHA1);
2057 if (hd == GNUTLS_HASH_FAILED) 2057 if (hd == GNUTLS_HASH_FAILED)
2058 { 2058 {
2059 gnutls_assert (); 2059 gnutls_assert ();
@@ -2130,7 +2130,7 @@ gnutls_x509_crt_get_key_id (gnutls_x509_crt_t crt,
2130 return pk; 2130 return pk;
2131 } 2131 }
2132 2132
2133 if (pk == GNUTLS_PK_RSA) 2133 if (pk == MHD_GNUTLS_PK_RSA)
2134 { 2134 {
2135 /* This is for compatibility with what GnuTLS has printed for 2135 /* This is for compatibility with what GnuTLS has printed for
2136 RSA/DSA before the code below was added. The code below is 2136 RSA/DSA before the code below was added. The code below is
@@ -2165,7 +2165,7 @@ gnutls_x509_crt_get_key_id (gnutls_x509_crt_t crt,
2165 return _gnutls_asn2err (result); 2165 return _gnutls_asn2err (result);
2166 } 2166 }
2167 2167
2168 result = gnutls_fingerprint (GNUTLS_DIG_SHA1, &pubkey, output_data, 2168 result = gnutls_fingerprint (MHD_GNUTLS_DIG_SHA1, &pubkey, output_data,
2169 output_data_size); 2169 output_data_size);
2170 2170
2171 gnutls_afree (pubkey.data); 2171 gnutls_afree (pubkey.data);
@@ -2581,7 +2581,7 @@ gnutls_x509_crt_get_pk_rsa_raw (gnutls_x509_crt_t crt,
2581 } 2581 }
2582 2582
2583 ret = gnutls_x509_crt_get_pk_algorithm (crt, NULL); 2583 ret = gnutls_x509_crt_get_pk_algorithm (crt, NULL);
2584 if (ret != GNUTLS_PK_RSA) 2584 if (ret != MHD_GNUTLS_PK_RSA)
2585 { 2585 {
2586 gnutls_assert (); 2586 gnutls_assert ();
2587 return GNUTLS_E_INVALID_REQUEST; 2587 return GNUTLS_E_INVALID_REQUEST;
diff --git a/src/daemon/https/x509/x509_privkey.c b/src/daemon/https/x509/x509_privkey.c
index ff295fcd..596aedc0 100644
--- a/src/daemon/https/x509/x509_privkey.c
+++ b/src/daemon/https/x509/x509_privkey.c
@@ -64,7 +64,7 @@ gnutls_x509_privkey_init (gnutls_x509_privkey_t * key)
64 if (*key) 64 if (*key)
65 { 65 {
66 (*key)->key = ASN1_TYPE_EMPTY; 66 (*key)->key = ASN1_TYPE_EMPTY;
67 (*key)->pk_algorithm = GNUTLS_PK_UNKNOWN; 67 (*key)->pk_algorithm = MHD_GNUTLS_PK_UNKNOWN;
68 return 0; /* success */ 68 return 0; /* success */
69 } 69 }
70 70
@@ -126,7 +126,7 @@ gnutls_x509_privkey_cpy (gnutls_x509_privkey_t dst, gnutls_x509_privkey_t src)
126 { 126 {
127 switch (dst->pk_algorithm) 127 switch (dst->pk_algorithm)
128 { 128 {
129 case GNUTLS_PK_RSA: 129 case MHD_GNUTLS_PK_RSA:
130 ret = _gnutls_asn1_encode_rsa (&dst->key, dst->params); 130 ret = _gnutls_asn1_encode_rsa (&dst->key, dst->params);
131 if (ret < 0) 131 if (ret < 0)
132 { 132 {
@@ -355,7 +355,7 @@ gnutls_x509_privkey_import (gnutls_x509_privkey_t key,
355 _data.data = data->data; 355 _data.data = data->data;
356 _data.size = data->size; 356 _data.size = data->size;
357 357
358 key->pk_algorithm = GNUTLS_PK_UNKNOWN; 358 key->pk_algorithm = MHD_GNUTLS_PK_UNKNOWN;
359 359
360 /* If the Certificate is in PEM format then decode it */ 360 /* If the Certificate is in PEM format then decode it */
361 if (format == GNUTLS_X509_FMT_PEM) 361 if (format == GNUTLS_X509_FMT_PEM)
@@ -365,7 +365,7 @@ gnutls_x509_privkey_import (gnutls_x509_privkey_t key,
365 /* Try the first header */ 365 /* Try the first header */
366 result 366 result
367 = _gnutls_fbase64_decode (PEM_KEY_RSA, data->data, data->size, &out); 367 = _gnutls_fbase64_decode (PEM_KEY_RSA, data->data, data->size, &out);
368 key->pk_algorithm = GNUTLS_PK_RSA; 368 key->pk_algorithm = MHD_GNUTLS_PK_RSA;
369 369
370 // TODO rm 370 // TODO rm
371// if (result == GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERROR) 371// if (result == GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERROR)
@@ -390,7 +390,7 @@ gnutls_x509_privkey_import (gnutls_x509_privkey_t key,
390 need_free = 1; 390 need_free = 1;
391 } 391 }
392 392
393 if (key->pk_algorithm == GNUTLS_PK_RSA) 393 if (key->pk_algorithm == MHD_GNUTLS_PK_RSA)
394 { 394 {
395 key->key = _gnutls_privkey_decode_pkcs1_rsa_key (&_data, key); 395 key->key = _gnutls_privkey_decode_pkcs1_rsa_key (&_data, key);
396 if (key->key == NULL) 396 if (key->key == NULL)
@@ -399,7 +399,7 @@ gnutls_x509_privkey_import (gnutls_x509_privkey_t key,
399 else 399 else
400 { 400 {
401 /* Try decoding with both, and accept the one that succeeds. */ 401 /* Try decoding with both, and accept the one that succeeds. */
402 key->pk_algorithm = GNUTLS_PK_RSA; 402 key->pk_algorithm = MHD_GNUTLS_PK_RSA;
403 key->key = _gnutls_privkey_decode_pkcs1_rsa_key (&_data, key); 403 key->key = _gnutls_privkey_decode_pkcs1_rsa_key (&_data, key);
404 404
405 // TODO rm 405 // TODO rm
@@ -416,7 +416,7 @@ gnutls_x509_privkey_import (gnutls_x509_privkey_t key,
416 { 416 {
417 gnutls_assert (); 417 gnutls_assert ();
418 result = GNUTLS_E_ASN1_DER_ERROR; 418 result = GNUTLS_E_ASN1_DER_ERROR;
419 key->pk_algorithm = GNUTLS_PK_UNKNOWN; 419 key->pk_algorithm = MHD_GNUTLS_PK_UNKNOWN;
420 return result; 420 return result;
421 } 421 }
422 422
@@ -539,7 +539,7 @@ gnutls_x509_privkey_import_rsa_raw (gnutls_x509_privkey_t key,
539 } 539 }
540 540
541 key->params_size = RSA_PRIVATE_PARAMS; 541 key->params_size = RSA_PRIVATE_PARAMS;
542 key->pk_algorithm = GNUTLS_PK_RSA; 542 key->pk_algorithm = MHD_GNUTLS_PK_RSA;
543 543
544 return 0; 544 return 0;
545 545
@@ -605,7 +605,7 @@ gnutls_x509_privkey_export (gnutls_x509_privkey_t key,
605 return GNUTLS_E_INVALID_REQUEST; 605 return GNUTLS_E_INVALID_REQUEST;
606 } 606 }
607 607
608 if (key->pk_algorithm == GNUTLS_PK_RSA) 608 if (key->pk_algorithm == MHD_GNUTLS_PK_RSA)
609 msg = PEM_KEY_RSA; 609 msg = PEM_KEY_RSA;
610 else 610 else
611 msg = NULL; 611 msg = NULL;
@@ -615,7 +615,7 @@ gnutls_x509_privkey_export (gnutls_x509_privkey_t key,
615 */ 615 */
616 switch (key->pk_algorithm) 616 switch (key->pk_algorithm)
617 { 617 {
618 case GNUTLS_PK_RSA: 618 case MHD_GNUTLS_PK_RSA:
619 ret = _gnutls_asn1_encode_rsa (&key->key, key->params); 619 ret = _gnutls_asn1_encode_rsa (&key->key, key->params);
620 if (ret < 0) 620 if (ret < 0)
621 { 621 {
@@ -1204,7 +1204,7 @@ gnutls_x509_privkey_generate (gnutls_x509_privkey_t key,
1204 1204
1205 switch (algo) 1205 switch (algo)
1206 { 1206 {
1207 case GNUTLS_PK_RSA: 1207 case MHD_GNUTLS_PK_RSA:
1208 ret = _gnutls_rsa_generate_params (key->params, &params_len, bits); 1208 ret = _gnutls_rsa_generate_params (key->params, &params_len, bits);
1209 if (ret < 0) 1209 if (ret < 0)
1210 { 1210 {
@@ -1223,7 +1223,7 @@ gnutls_x509_privkey_generate (gnutls_x509_privkey_t key,
1223 } 1223 }
1224 1224
1225 key->params_size = params_len; 1225 key->params_size = params_len;
1226 key->pk_algorithm = GNUTLS_PK_RSA; 1226 key->pk_algorithm = MHD_GNUTLS_PK_RSA;
1227 1227
1228 break; 1228 break;
1229 default: 1229 default:
@@ -1233,7 +1233,7 @@ gnutls_x509_privkey_generate (gnutls_x509_privkey_t key,
1233 1233
1234 return 0; 1234 return 0;
1235 1235
1236cleanup:key->pk_algorithm = GNUTLS_PK_UNKNOWN; 1236cleanup:key->pk_algorithm = MHD_GNUTLS_PK_UNKNOWN;
1237 key->params_size = 0; 1237 key->params_size = 0;
1238 for (i = 0; i < params_len; i++) 1238 for (i = 0; i < params_len; i++)
1239 _gnutls_mpi_release (&key->params[i]); 1239 _gnutls_mpi_release (&key->params[i]);
@@ -1287,7 +1287,7 @@ gnutls_x509_privkey_get_key_id (gnutls_x509_privkey_t key,
1287 return GNUTLS_E_SHORT_MEMORY_BUFFER; 1287 return GNUTLS_E_SHORT_MEMORY_BUFFER;
1288 } 1288 }
1289 1289
1290 if (key->pk_algorithm == GNUTLS_PK_RSA) 1290 if (key->pk_algorithm == MHD_GNUTLS_PK_RSA)
1291 { 1291 {
1292 result = _gnutls_x509_write_rsa_params (key->params, key->params_size, 1292 result = _gnutls_x509_write_rsa_params (key->params, key->params_size,
1293 &der); 1293 &der);
@@ -1300,7 +1300,7 @@ gnutls_x509_privkey_get_key_id (gnutls_x509_privkey_t key,
1300 else 1300 else
1301 return GNUTLS_E_INTERNAL_ERROR; 1301 return GNUTLS_E_INTERNAL_ERROR;
1302 1302
1303 hd = _gnutls_hash_init (GNUTLS_MAC_SHA1); 1303 hd = _gnutls_hash_init (MHD_GNUTLS_MAC_SHA1);
1304 if (hd == GNUTLS_HASH_FAILED) 1304 if (hd == GNUTLS_HASH_FAILED)
1305 { 1305 {
1306 gnutls_assert (); 1306 gnutls_assert ();
@@ -1483,7 +1483,7 @@ gnutls_x509_privkey_fix (gnutls_x509_privkey_t key)
1483 asn1_delete_structure (&key->key); 1483 asn1_delete_structure (&key->key);
1484 switch (key->pk_algorithm) 1484 switch (key->pk_algorithm)
1485 { 1485 {
1486 case GNUTLS_PK_RSA: 1486 case MHD_GNUTLS_PK_RSA:
1487 ret = _gnutls_asn1_encode_rsa (&key->key, key->params); 1487 ret = _gnutls_asn1_encode_rsa (&key->key, key->params);
1488 if (ret < 0) 1488 if (ret < 0)
1489 { 1489 {
diff --git a/src/daemon/https/x509/x509_verify.c b/src/daemon/https/x509/x509_verify.c
index f01fed9d..75cdef04 100644
--- a/src/daemon/https/x509/x509_verify.c
+++ b/src/daemon/https/x509/x509_verify.c
@@ -500,7 +500,7 @@ decode_ber_digest_info (const gnutls_datum_t * info,
500 500
501 *hash = _gnutls_x509_oid2mac_algorithm (str); 501 *hash = _gnutls_x509_oid2mac_algorithm (str);
502 502
503 if (*hash == GNUTLS_MAC_UNKNOWN) 503 if (*hash == MHD_GNUTLS_MAC_UNKNOWN)
504 { 504 {
505 505
506 _gnutls_x509_log ("verify.c: HASH OID: %s\n", str); 506 _gnutls_x509_log ("verify.c: HASH OID: %s\n", str);
@@ -547,7 +547,7 @@ _pkcs1_rsa_verify_sig (const gnutls_datum_t * text,
547 const gnutls_datum_t * signature, 547 const gnutls_datum_t * signature,
548 mpi_t * params, int params_len) 548 mpi_t * params, int params_len)
549{ 549{
550 gnutls_mac_algorithm_t hash = GNUTLS_MAC_UNKNOWN; 550 gnutls_mac_algorithm_t hash = MHD_GNUTLS_MAC_UNKNOWN;
551 int ret; 551 int ret;
552 opaque digest[MAX_HASH_SIZE], md[MAX_HASH_SIZE]; 552 opaque digest[MAX_HASH_SIZE], md[MAX_HASH_SIZE];
553 int digest_size; 553 int digest_size;
@@ -613,7 +613,7 @@ dsa_verify_sig (const gnutls_datum_t * text,
613 gnutls_datum_t digest; 613 gnutls_datum_t digest;
614 GNUTLS_HASH_HANDLE hd; 614 GNUTLS_HASH_HANDLE hd;
615 615
616 hd = _gnutls_hash_init (GNUTLS_MAC_SHA1); 616 hd = _gnutls_hash_init (MHD_GNUTLS_MAC_SHA1);
617 if (hd == NULL) 617 if (hd == NULL)
618 { 618 {
619 gnutls_assert (); 619 gnutls_assert ();
@@ -643,7 +643,7 @@ verify_sig (const gnutls_datum_t * tbs,
643 643
644 switch (pk) 644 switch (pk)
645 { 645 {
646 case GNUTLS_PK_RSA: 646 case MHD_GNUTLS_PK_RSA:
647 647
648 if (_pkcs1_rsa_verify_sig 648 if (_pkcs1_rsa_verify_sig
649 (tbs, signature, issuer_params, issuer_params_size) != 0) 649 (tbs, signature, issuer_params, issuer_params_size) != 0)
diff --git a/src/daemon/https/x509/x509_write.c b/src/daemon/https/x509/x509_write.c
index d9529c33..8855eadb 100644
--- a/src/daemon/https/x509/x509_write.c
+++ b/src/daemon/https/x509/x509_write.c
@@ -632,7 +632,8 @@ int
632gnutls_x509_crt_sign (gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer, 632gnutls_x509_crt_sign (gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer,
633 gnutls_x509_privkey_t issuer_key) 633 gnutls_x509_privkey_t issuer_key)
634{ 634{
635 return gnutls_x509_crt_sign2 (crt, issuer, issuer_key, GNUTLS_DIG_SHA1, 0); 635 return gnutls_x509_crt_sign2 (crt, issuer, issuer_key, MHD_GNUTLS_DIG_SHA1,
636 0);
636} 637}
637 638
638/** 639/**