diff options
Diffstat (limited to 'src/daemon/https/x509/x509.c')
-rw-r--r-- | src/daemon/https/x509/x509.c | 72 |
1 files changed, 3 insertions, 69 deletions
diff --git a/src/daemon/https/x509/x509.c b/src/daemon/https/x509/x509.c index 343030cc..7bb907ab 100644 --- a/src/daemon/https/x509/x509.c +++ b/src/daemon/https/x509/x509.c | |||
@@ -256,7 +256,7 @@ MHD_gnutls_x509_crt_get_signature_algorithm (MHD_gnutls_x509_crt_t cert) | |||
256 | return result; | 256 | return result; |
257 | } | 257 | } |
258 | 258 | ||
259 | result = MHD_gtls_x509_oid2sign_algorithm (sa.data); | 259 | result = MHD_gtls_x509_oid2sign_algorithm ((const char*) sa.data); |
260 | 260 | ||
261 | MHD__gnutls_free_datum (&sa); | 261 | MHD__gnutls_free_datum (&sa); |
262 | 262 | ||
@@ -533,7 +533,7 @@ parse_general_name (ASN1_TYPE src, | |||
533 | return MHD_gtls_asn2err (result); | 533 | return MHD_gtls_asn2err (result); |
534 | } | 534 | } |
535 | 535 | ||
536 | type = MHD__gnutls_x509_san_find_type (choice_type); | 536 | type = MHD__gnutls_x509_san_find_type ((char*) choice_type); |
537 | if (type == (MHD_gnutls_x509_subject_alt_name_t) - 1) | 537 | if (type == (MHD_gnutls_x509_subject_alt_name_t) - 1) |
538 | { | 538 | { |
539 | MHD_gnutls_assert (); | 539 | MHD_gnutls_assert (); |
@@ -636,7 +636,7 @@ parse_general_name (ASN1_TYPE src, | |||
636 | size_t orig_name_size = *name_size; | 636 | size_t orig_name_size = *name_size; |
637 | 637 | ||
638 | MHD_gtls_str_cat (nptr, sizeof (nptr), "."); | 638 | MHD_gtls_str_cat (nptr, sizeof (nptr), "."); |
639 | MHD_gtls_str_cat (nptr, sizeof (nptr), choice_type); | 639 | MHD_gtls_str_cat (nptr, sizeof (nptr), (const char*) choice_type); |
640 | 640 | ||
641 | len = *name_size; | 641 | len = *name_size; |
642 | result = MHD__asn1_read_value (src, nptr, name, &len); | 642 | result = MHD__asn1_read_value (src, nptr, name, &len); |
@@ -942,72 +942,6 @@ MHD_gnutls_x509_crt_get_key_usage (MHD_gnutls_x509_crt_t cert, | |||
942 | } | 942 | } |
943 | 943 | ||
944 | 944 | ||
945 | /** | ||
946 | * MHD_gnutls_x509_crt_get_extension_by_oid - This function returns the specified extension | ||
947 | * @cert: should contain a MHD_gnutls_x509_crt_t structure | ||
948 | * @oid: holds an Object Identified in null terminated string | ||
949 | * @indx: In case multiple same OIDs exist in the extensions, this specifies which to send. Use zero to get the first one. | ||
950 | * @buf: a pointer to a structure to hold the name (may be null) | ||
951 | * @sizeof_buf: initially holds the size of @buf | ||
952 | * @critical: will be non zero if the extension is marked as critical | ||
953 | * | ||
954 | * This function will return the extension specified by the OID in the certificate. | ||
955 | * The extensions will be returned as binary data DER encoded, in the provided | ||
956 | * buffer. | ||
957 | * | ||
958 | * A negative value may be returned in case of parsing error. | ||
959 | * If the certificate does not contain the specified extension | ||
960 | * GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned. | ||
961 | * | ||
962 | **/ | ||
963 | static int | ||
964 | MHD_gnutls_x509_crt_get_extension_by_oid (MHD_gnutls_x509_crt_t cert, | ||
965 | const char *oid, | ||
966 | int indx, | ||
967 | void *buf, | ||
968 | size_t * sizeof_buf, | ||
969 | unsigned int *critical) | ||
970 | { | ||
971 | int result; | ||
972 | MHD_gnutls_datum_t output; | ||
973 | |||
974 | if (cert == NULL) | ||
975 | { | ||
976 | MHD_gnutls_assert (); | ||
977 | return GNUTLS_E_INVALID_REQUEST; | ||
978 | } | ||
979 | |||
980 | if ((result = MHD__gnutls_x509_crt_get_extension (cert, oid, indx, &output, | ||
981 | critical)) < 0) | ||
982 | { | ||
983 | MHD_gnutls_assert (); | ||
984 | return result; | ||
985 | } | ||
986 | |||
987 | if (output.size == 0 || output.data == NULL) | ||
988 | { | ||
989 | MHD_gnutls_assert (); | ||
990 | return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE; | ||
991 | } | ||
992 | |||
993 | if (output.size > (unsigned int) *sizeof_buf) | ||
994 | { | ||
995 | *sizeof_buf = output.size; | ||
996 | MHD__gnutls_free_datum (&output); | ||
997 | return GNUTLS_E_SHORT_MEMORY_BUFFER; | ||
998 | } | ||
999 | |||
1000 | *sizeof_buf = output.size; | ||
1001 | |||
1002 | if (buf) | ||
1003 | memcpy (buf, output.data, output.size); | ||
1004 | |||
1005 | MHD__gnutls_free_datum (&output); | ||
1006 | |||
1007 | return 0; | ||
1008 | |||
1009 | } | ||
1010 | |||
1011 | static int | 945 | static int |
1012 | MHD__gnutls_x509_crt_get_raw_dn2 (MHD_gnutls_x509_crt_t cert, | 946 | MHD__gnutls_x509_crt_get_raw_dn2 (MHD_gnutls_x509_crt_t cert, |
1013 | const char *whom, MHD_gnutls_datum_t * start) | 947 | const char *whom, MHD_gnutls_datum_t * start) |