aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/https/x509/dn.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/https/x509/dn.c')
-rw-r--r--src/daemon/https/x509/dn.c160
1 files changed, 96 insertions, 64 deletions
diff --git a/src/daemon/https/x509/dn.c b/src/daemon/https/x509/dn.c
index eac31f33..17b4ed76 100644
--- a/src/daemon/https/x509/dn.c
+++ b/src/daemon/https/x509/dn.c
@@ -88,8 +88,8 @@ str_escape (char *str, char *buffer, unsigned int buffer_size)
88 */ 88 */
89int 89int
90MHD__gnutls_x509_parse_dn (ASN1_TYPE MHD__asn1_struct, 90MHD__gnutls_x509_parse_dn (ASN1_TYPE MHD__asn1_struct,
91 const char *MHD__asn1_rdn_name, char *buf, 91 const char *MHD__asn1_rdn_name, char *buf,
92 size_t * sizeof_buf) 92 size_t * sizeof_buf)
93{ 93{
94 MHD_gtls_string out_str; 94 MHD_gtls_string out_str;
95 int k2, k1, result; 95 int k2, k1, result;
@@ -115,7 +115,8 @@ MHD__gnutls_x509_parse_dn (ASN1_TYPE MHD__asn1_struct,
115 else 115 else
116 *sizeof_buf = 0; 116 *sizeof_buf = 0;
117 117
118 MHD_gtls_string_init (&out_str, MHD_gnutls_malloc, MHD_gnutls_realloc, MHD_gnutls_free); 118 MHD_gtls_string_init (&out_str, MHD_gnutls_malloc, MHD_gnutls_realloc,
119 MHD_gnutls_free);
119 120
120 k1 = 0; 121 k1 = 0;
121 do 122 do
@@ -125,13 +126,14 @@ MHD__gnutls_x509_parse_dn (ASN1_TYPE MHD__asn1_struct,
125 /* create a string like "tbsCertList.issuer.rdnSequence.?1" 126 /* create a string like "tbsCertList.issuer.rdnSequence.?1"
126 */ 127 */
127 if (MHD__asn1_rdn_name[0] != 0) 128 if (MHD__asn1_rdn_name[0] != 0)
128 snprintf (tmpbuffer1, sizeof (tmpbuffer1), "%s.?%u", MHD__asn1_rdn_name, 129 snprintf (tmpbuffer1, sizeof (tmpbuffer1), "%s.?%u",
129 k1); 130 MHD__asn1_rdn_name, k1);
130 else 131 else
131 snprintf (tmpbuffer1, sizeof (tmpbuffer1), "?%u", k1); 132 snprintf (tmpbuffer1, sizeof (tmpbuffer1), "?%u", k1);
132 133
133 len = sizeof (value) - 1; 134 len = sizeof (value) - 1;
134 result = MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer1, value, &len); 135 result =
136 MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer1, value, &len);
135 137
136 if (result == ASN1_ELEMENT_NOT_FOUND) 138 if (result == ASN1_ELEMENT_NOT_FOUND)
137 { 139 {
@@ -162,7 +164,8 @@ MHD__gnutls_x509_parse_dn (ASN1_TYPE MHD__asn1_struct,
162 */ 164 */
163 165
164 len = sizeof (value) - 1; 166 len = sizeof (value) - 1;
165 result = MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer2, value, &len); 167 result =
168 MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer2, value, &len);
166 169
167 if (result == ASN1_ELEMENT_NOT_FOUND) 170 if (result == ASN1_ELEMENT_NOT_FOUND)
168 break; 171 break;
@@ -179,7 +182,8 @@ MHD__gnutls_x509_parse_dn (ASN1_TYPE MHD__asn1_struct,
179 MHD_gtls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); 182 MHD_gtls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type");
180 183
181 len = sizeof (oid) - 1; 184 len = sizeof (oid) - 1;
182 result = MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer3, oid, &len); 185 result =
186 MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer3, oid, &len);
183 187
184 if (result == ASN1_ELEMENT_NOT_FOUND) 188 if (result == ASN1_ELEMENT_NOT_FOUND)
185 break; 189 break;
@@ -196,7 +200,8 @@ MHD__gnutls_x509_parse_dn (ASN1_TYPE MHD__asn1_struct,
196 MHD_gtls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".value"); 200 MHD_gtls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".value");
197 201
198 len = 0; 202 len = 0;
199 result = MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer3, NULL, &len); 203 result =
204 MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer3, NULL, &len);
200 205
201 value2 = MHD_gnutls_malloc (len); 206 value2 = MHD_gnutls_malloc (len);
202 if (value2 == NULL) 207 if (value2 == NULL)
@@ -206,7 +211,8 @@ MHD__gnutls_x509_parse_dn (ASN1_TYPE MHD__asn1_struct,
206 goto cleanup; 211 goto cleanup;
207 } 212 }
208 213
209 result = MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer3, value2, &len); 214 result =
215 MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer3, value2, &len);
210 216
211 if (result != ASN1_SUCCESS) 217 if (result != ASN1_SUCCESS)
212 { 218 {
@@ -268,12 +274,14 @@ MHD__gnutls_x509_parse_dn (ASN1_TYPE MHD__asn1_struct,
268 if (printable) 274 if (printable)
269 result = 275 result =
270 MHD__gnutls_x509_oid_data2string (oid, 276 MHD__gnutls_x509_oid_data2string (oid,
271 value2, len, 277 value2, len,
272 string, &sizeof_string); 278 string, &sizeof_string);
273 279
274 if (!printable || result < 0) 280 if (!printable || result < 0)
275 result = 281 result =
276 MHD__gnutls_x509_data2hex ((const unsigned char*) value2, len, (unsigned char*) string, &sizeof_string); 282 MHD__gnutls_x509_data2hex ((const unsigned char *) value2, len,
283 (unsigned char *) string,
284 &sizeof_string);
277 285
278 if (result < 0) 286 if (result < 0)
279 { 287 {
@@ -338,10 +346,10 @@ cleanup:
338 */ 346 */
339int 347int
340MHD__gnutls_x509_parse_dn_oid (ASN1_TYPE MHD__asn1_struct, 348MHD__gnutls_x509_parse_dn_oid (ASN1_TYPE MHD__asn1_struct,
341 const char *MHD__asn1_rdn_name, 349 const char *MHD__asn1_rdn_name,
342 const char *given_oid, int indx, 350 const char *given_oid, int indx,
343 unsigned int raw_flag, 351 unsigned int raw_flag,
344 void *buf, size_t * sizeof_buf) 352 void *buf, size_t * sizeof_buf)
345{ 353{
346 int k2, k1, result; 354 int k2, k1, result;
347 char tmpbuffer1[MAX_NAME_SIZE]; 355 char tmpbuffer1[MAX_NAME_SIZE];
@@ -366,13 +374,14 @@ MHD__gnutls_x509_parse_dn_oid (ASN1_TYPE MHD__asn1_struct,
366 /* create a string like "tbsCertList.issuer.rdnSequence.?1" 374 /* create a string like "tbsCertList.issuer.rdnSequence.?1"
367 */ 375 */
368 if (MHD__asn1_rdn_name[0] != 0) 376 if (MHD__asn1_rdn_name[0] != 0)
369 snprintf (tmpbuffer1, sizeof (tmpbuffer1), "%s.?%u", MHD__asn1_rdn_name, 377 snprintf (tmpbuffer1, sizeof (tmpbuffer1), "%s.?%u",
370 k1); 378 MHD__asn1_rdn_name, k1);
371 else 379 else
372 snprintf (tmpbuffer1, sizeof (tmpbuffer1), "?%u", k1); 380 snprintf (tmpbuffer1, sizeof (tmpbuffer1), "?%u", k1);
373 381
374 len = sizeof (value) - 1; 382 len = sizeof (value) - 1;
375 result = MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer1, value, &len); 383 result =
384 MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer1, value, &len);
376 385
377 if (result == ASN1_ELEMENT_NOT_FOUND) 386 if (result == ASN1_ELEMENT_NOT_FOUND)
378 { 387 {
@@ -404,7 +413,8 @@ MHD__gnutls_x509_parse_dn_oid (ASN1_TYPE MHD__asn1_struct,
404 */ 413 */
405 414
406 len = sizeof (value) - 1; 415 len = sizeof (value) - 1;
407 result = MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer2, value, &len); 416 result =
417 MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer2, value, &len);
408 418
409 if (result == ASN1_ELEMENT_NOT_FOUND) 419 if (result == ASN1_ELEMENT_NOT_FOUND)
410 { 420 {
@@ -423,7 +433,8 @@ MHD__gnutls_x509_parse_dn_oid (ASN1_TYPE MHD__asn1_struct,
423 MHD_gtls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); 433 MHD_gtls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type");
424 434
425 len = sizeof (oid) - 1; 435 len = sizeof (oid) - 1;
426 result = MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer3, oid, &len); 436 result =
437 MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer3, oid, &len);
427 438
428 if (result == ASN1_ELEMENT_NOT_FOUND) 439 if (result == ASN1_ELEMENT_NOT_FOUND)
429 break; 440 break;
@@ -443,7 +454,9 @@ MHD__gnutls_x509_parse_dn_oid (ASN1_TYPE MHD__asn1_struct,
443 MHD_gtls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".value"); 454 MHD_gtls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".value");
444 455
445 len = *sizeof_buf; 456 len = *sizeof_buf;
446 result = MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer3, buf, &len); 457 result =
458 MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer3, buf,
459 &len);
447 460
448 if (result != ASN1_SUCCESS) 461 if (result != ASN1_SUCCESS)
449 { 462 {
@@ -474,10 +487,12 @@ MHD__gnutls_x509_parse_dn_oid (ASN1_TYPE MHD__asn1_struct,
474 if (printable == 1) 487 if (printable == 1)
475 result = 488 result =
476 MHD__gnutls_x509_oid_data2string (oid, buf, len, 489 MHD__gnutls_x509_oid_data2string (oid, buf, len,
477 cbuf, sizeof_buf); 490 cbuf, sizeof_buf);
478 else 491 else
479 result = 492 result =
480 MHD__gnutls_x509_data2hex (buf, len, (unsigned char*) cbuf, sizeof_buf); 493 MHD__gnutls_x509_data2hex (buf, len,
494 (unsigned char *) cbuf,
495 sizeof_buf);
481 496
482 if (result < 0) 497 if (result < 0)
483 { 498 {
@@ -515,8 +530,8 @@ cleanup:
515 */ 530 */
516int 531int
517MHD__gnutls_x509_get_dn_oid (ASN1_TYPE MHD__asn1_struct, 532MHD__gnutls_x509_get_dn_oid (ASN1_TYPE MHD__asn1_struct,
518 const char *MHD__asn1_rdn_name, 533 const char *MHD__asn1_rdn_name,
519 int indx, void *_oid, size_t * sizeof_oid) 534 int indx, void *_oid, size_t * sizeof_oid)
520{ 535{
521 int k2, k1, result; 536 int k2, k1, result;
522 char tmpbuffer1[MAX_NAME_SIZE]; 537 char tmpbuffer1[MAX_NAME_SIZE];
@@ -535,13 +550,14 @@ MHD__gnutls_x509_get_dn_oid (ASN1_TYPE MHD__asn1_struct,
535 /* create a string like "tbsCertList.issuer.rdnSequence.?1" 550 /* create a string like "tbsCertList.issuer.rdnSequence.?1"
536 */ 551 */
537 if (MHD__asn1_rdn_name[0] != 0) 552 if (MHD__asn1_rdn_name[0] != 0)
538 snprintf (tmpbuffer1, sizeof (tmpbuffer1), "%s.?%u", MHD__asn1_rdn_name, 553 snprintf (tmpbuffer1, sizeof (tmpbuffer1), "%s.?%u",
539 k1); 554 MHD__asn1_rdn_name, k1);
540 else 555 else
541 snprintf (tmpbuffer1, sizeof (tmpbuffer1), "?%u", k1); 556 snprintf (tmpbuffer1, sizeof (tmpbuffer1), "?%u", k1);
542 557
543 len = sizeof (value) - 1; 558 len = sizeof (value) - 1;
544 result = MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer1, value, &len); 559 result =
560 MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer1, value, &len);
545 561
546 if (result == ASN1_ELEMENT_NOT_FOUND) 562 if (result == ASN1_ELEMENT_NOT_FOUND)
547 { 563 {
@@ -573,7 +589,8 @@ MHD__gnutls_x509_get_dn_oid (ASN1_TYPE MHD__asn1_struct,
573 */ 589 */
574 590
575 len = sizeof (value) - 1; 591 len = sizeof (value) - 1;
576 result = MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer2, value, &len); 592 result =
593 MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer2, value, &len);
577 594
578 if (result == ASN1_ELEMENT_NOT_FOUND) 595 if (result == ASN1_ELEMENT_NOT_FOUND)
579 { 596 {
@@ -592,7 +609,8 @@ MHD__gnutls_x509_get_dn_oid (ASN1_TYPE MHD__asn1_struct,
592 MHD_gtls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); 609 MHD_gtls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type");
593 610
594 len = sizeof (oid) - 1; 611 len = sizeof (oid) - 1;
595 result = MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer3, oid, &len); 612 result =
613 MHD__asn1_read_value (MHD__asn1_struct, tmpbuffer3, oid, &len);
596 614
597 if (result == ASN1_ELEMENT_NOT_FOUND) 615 if (result == ASN1_ELEMENT_NOT_FOUND)
598 break; 616 break;
@@ -640,10 +658,10 @@ cleanup:
640 */ 658 */
641int 659int
642MHD__gnutls_x509_encode_and_write_attribute (const char *given_oid, 660MHD__gnutls_x509_encode_and_write_attribute (const char *given_oid,
643 ASN1_TYPE MHD__asn1_struct, 661 ASN1_TYPE MHD__asn1_struct,
644 const char *where, 662 const char *where,
645 const void *_data, 663 const void *_data,
646 int sizeof_data, int multi) 664 int sizeof_data, int multi)
647{ 665{
648 const char *val_name; 666 const char *val_name;
649 const opaque *data = _data; 667 const opaque *data = _data;
@@ -654,7 +672,8 @@ MHD__gnutls_x509_encode_and_write_attribute (const char *given_oid,
654 672
655 /* Find how to encode the data. 673 /* Find how to encode the data.
656 */ 674 */
657 val_name = MHD__asn1_find_structure_from_oid (MHD__gnutls_get_pkix (), given_oid); 675 val_name =
676 MHD__asn1_find_structure_from_oid (MHD__gnutls_get_pkix (), given_oid);
658 if (val_name == NULL) 677 if (val_name == NULL)
659 { 678 {
660 MHD_gnutls_assert (); 679 MHD_gnutls_assert ();
@@ -736,7 +755,8 @@ MHD__gnutls_x509_encode_and_write_attribute (const char *given_oid,
736 755
737 } 756 }
738 757
739 result = MHD__gnutls_x509_der_encode_and_copy (c2, "", MHD__asn1_struct, tmp, 0); 758 result =
759 MHD__gnutls_x509_der_encode_and_copy (c2, "", MHD__asn1_struct, tmp, 0);
740 if (result < 0) 760 if (result < 0)
741 { 761 {
742 MHD_gnutls_assert (); 762 MHD_gnutls_assert ();
@@ -763,8 +783,9 @@ MHD__gnutls_x509_encode_and_write_attribute (const char *given_oid,
763 */ 783 */
764static int 784static int
765MHD__gnutls_x509_write_attribute (const char *given_oid, 785MHD__gnutls_x509_write_attribute (const char *given_oid,
766 ASN1_TYPE MHD__asn1_struct, const char *where, 786 ASN1_TYPE MHD__asn1_struct,
767 const void *_data, int sizeof_data) 787 const char *where, const void *_data,
788 int sizeof_data)
768{ 789{
769 char tmp[128]; 790 char tmp[128];
770 int result; 791 int result;
@@ -808,9 +829,10 @@ MHD__gnutls_x509_write_attribute (const char *given_oid,
808 */ 829 */
809int 830int
810MHD__gnutls_x509_decode_and_read_attribute (ASN1_TYPE MHD__asn1_struct, 831MHD__gnutls_x509_decode_and_read_attribute (ASN1_TYPE MHD__asn1_struct,
811 const char *where, char *oid, 832 const char *where, char *oid,
812 int oid_size, MHD_gnutls_datum_t * value, 833 int oid_size,
813 int multi, int octet_string) 834 MHD_gnutls_datum_t * value,
835 int multi, int octet_string)
814{ 836{
815 char tmpbuffer[128]; 837 char tmpbuffer[128];
816 int len, result; 838 int len, result;
@@ -840,7 +862,8 @@ MHD__gnutls_x509_decode_and_read_attribute (ASN1_TYPE MHD__asn1_struct,
840 MHD_gtls_str_cat (tmpbuffer, sizeof (tmpbuffer), "s.?1"); /* .values.?1 */ 862 MHD_gtls_str_cat (tmpbuffer, sizeof (tmpbuffer), "s.?1"); /* .values.?1 */
841 863
842 result = 864 result =
843 MHD__gnutls_x509_read_value (MHD__asn1_struct, tmpbuffer, value, octet_string); 865 MHD__gnutls_x509_read_value (MHD__asn1_struct, tmpbuffer, value,
866 octet_string);
844 if (result < 0) 867 if (result < 0)
845 { 868 {
846 MHD_gnutls_assert (); 869 MHD_gnutls_assert ();
@@ -860,8 +883,9 @@ MHD__gnutls_x509_decode_and_read_attribute (ASN1_TYPE MHD__asn1_struct,
860 */ 883 */
861int 884int
862MHD__gnutls_x509_set_dn_oid (ASN1_TYPE MHD__asn1_struct, 885MHD__gnutls_x509_set_dn_oid (ASN1_TYPE MHD__asn1_struct,
863 const char *MHD__asn1_name, const char *given_oid, 886 const char *MHD__asn1_name,
864 int raw_flag, const char *name, int sizeof_name) 887 const char *given_oid, int raw_flag,
888 const char *name, int sizeof_name)
865{ 889{
866 int result; 890 int result;
867 char tmp[MAX_NAME_SIZE], MHD__asn1_rdn_name[MAX_NAME_SIZE]; 891 char tmp[MAX_NAME_SIZE], MHD__asn1_rdn_name[MAX_NAME_SIZE];
@@ -874,19 +898,24 @@ MHD__gnutls_x509_set_dn_oid (ASN1_TYPE MHD__asn1_struct,
874 898
875 /* create the rdnSequence 899 /* create the rdnSequence
876 */ 900 */
877 result = MHD__asn1_write_value (MHD__asn1_struct, MHD__asn1_name, "rdnSequence", 1); 901 result =
902 MHD__asn1_write_value (MHD__asn1_struct, MHD__asn1_name, "rdnSequence",
903 1);
878 if (result != ASN1_SUCCESS) 904 if (result != ASN1_SUCCESS)
879 { 905 {
880 MHD_gnutls_assert (); 906 MHD_gnutls_assert ();
881 return MHD_gtls_asn2err (result); 907 return MHD_gtls_asn2err (result);
882 } 908 }
883 909
884 MHD_gtls_str_cpy (MHD__asn1_rdn_name, sizeof (MHD__asn1_rdn_name), MHD__asn1_name); 910 MHD_gtls_str_cpy (MHD__asn1_rdn_name, sizeof (MHD__asn1_rdn_name),
885 MHD_gtls_str_cat (MHD__asn1_rdn_name, sizeof (MHD__asn1_rdn_name), ".rdnSequence"); 911 MHD__asn1_name);
912 MHD_gtls_str_cat (MHD__asn1_rdn_name, sizeof (MHD__asn1_rdn_name),
913 ".rdnSequence");
886 914
887 /* create a new element 915 /* create a new element
888 */ 916 */
889 result = MHD__asn1_write_value (MHD__asn1_struct, MHD__asn1_rdn_name, "NEW", 1); 917 result =
918 MHD__asn1_write_value (MHD__asn1_struct, MHD__asn1_rdn_name, "NEW", 1);
890 if (result != ASN1_SUCCESS) 919 if (result != ASN1_SUCCESS)
891 { 920 {
892 MHD_gnutls_assert (); 921 MHD_gnutls_assert ();
@@ -915,14 +944,15 @@ MHD__gnutls_x509_set_dn_oid (ASN1_TYPE MHD__asn1_struct,
915 { 944 {
916 result = 945 result =
917 MHD__gnutls_x509_encode_and_write_attribute (given_oid, 946 MHD__gnutls_x509_encode_and_write_attribute (given_oid,
918 MHD__asn1_struct, 947 MHD__asn1_struct,
919 tmp, name, sizeof_name, 0); 948 tmp, name, sizeof_name,
949 0);
920 } 950 }
921 else 951 else
922 { 952 {
923 result = 953 result =
924 MHD__gnutls_x509_write_attribute (given_oid, MHD__asn1_struct, 954 MHD__gnutls_x509_write_attribute (given_oid, MHD__asn1_struct,
925 tmp, name, sizeof_name); 955 tmp, name, sizeof_name);
926 } 956 }
927 957
928 if (result < 0) 958 if (result < 0)
@@ -952,7 +982,7 @@ MHD__gnutls_x509_set_dn_oid (ASN1_TYPE MHD__asn1_struct,
952 **/ 982 **/
953int 983int
954MHD_gnutls_x509_rdn_get (const MHD_gnutls_datum_t * idn, 984MHD_gnutls_x509_rdn_get (const MHD_gnutls_datum_t * idn,
955 char *buf, size_t * sizeof_buf) 985 char *buf, size_t * sizeof_buf)
956{ 986{
957 int result; 987 int result;
958 ASN1_TYPE dn = ASN1_TYPE_EMPTY; 988 ASN1_TYPE dn = ASN1_TYPE_EMPTY;
@@ -969,7 +999,7 @@ MHD_gnutls_x509_rdn_get (const MHD_gnutls_datum_t * idn,
969 999
970 if ((result = 1000 if ((result =
971 MHD__asn1_create_element (MHD__gnutls_get_pkix (), 1001 MHD__asn1_create_element (MHD__gnutls_get_pkix (),
972 "PKIX1.Name", &dn)) != ASN1_SUCCESS) 1002 "PKIX1.Name", &dn)) != ASN1_SUCCESS)
973 { 1003 {
974 MHD_gnutls_assert (); 1004 MHD_gnutls_assert ();
975 return MHD_gtls_asn2err (result); 1005 return MHD_gtls_asn2err (result);
@@ -1010,9 +1040,10 @@ MHD_gnutls_x509_rdn_get (const MHD_gnutls_datum_t * idn,
1010 * 1040 *
1011 **/ 1041 **/
1012int 1042int
1013MHD_gnutls_x509_rdn_get_by_oid (const MHD_gnutls_datum_t * idn, const char *oid, 1043MHD_gnutls_x509_rdn_get_by_oid (const MHD_gnutls_datum_t * idn,
1014 int indx, unsigned int raw_flag, 1044 const char *oid, int indx,
1015 void *buf, size_t * sizeof_buf) 1045 unsigned int raw_flag, void *buf,
1046 size_t * sizeof_buf)
1016{ 1047{
1017 int result; 1048 int result;
1018 ASN1_TYPE dn = ASN1_TYPE_EMPTY; 1049 ASN1_TYPE dn = ASN1_TYPE_EMPTY;
@@ -1024,7 +1055,7 @@ MHD_gnutls_x509_rdn_get_by_oid (const MHD_gnutls_datum_t * idn, const char *oid,
1024 1055
1025 if ((result = 1056 if ((result =
1026 MHD__asn1_create_element (MHD__gnutls_get_pkix (), 1057 MHD__asn1_create_element (MHD__gnutls_get_pkix (),
1027 "PKIX1.Name", &dn)) != ASN1_SUCCESS) 1058 "PKIX1.Name", &dn)) != ASN1_SUCCESS)
1028 { 1059 {
1029 MHD_gnutls_assert (); 1060 MHD_gnutls_assert ();
1030 return MHD_gtls_asn2err (result); 1061 return MHD_gtls_asn2err (result);
@@ -1041,7 +1072,7 @@ MHD_gnutls_x509_rdn_get_by_oid (const MHD_gnutls_datum_t * idn, const char *oid,
1041 1072
1042 result = 1073 result =
1043 MHD__gnutls_x509_parse_dn_oid (dn, "rdnSequence", oid, indx, 1074 MHD__gnutls_x509_parse_dn_oid (dn, "rdnSequence", oid, indx,
1044 raw_flag, buf, sizeof_buf); 1075 raw_flag, buf, sizeof_buf);
1045 1076
1046 MHD__asn1_delete_structure (&dn); 1077 MHD__asn1_delete_structure (&dn);
1047 return result; 1078 return result;
@@ -1064,7 +1095,7 @@ MHD_gnutls_x509_rdn_get_by_oid (const MHD_gnutls_datum_t * idn, const char *oid,
1064 **/ 1095 **/
1065int 1096int
1066MHD_gnutls_x509_rdn_get_oid (const MHD_gnutls_datum_t * idn, 1097MHD_gnutls_x509_rdn_get_oid (const MHD_gnutls_datum_t * idn,
1067 int indx, void *buf, size_t * sizeof_buf) 1098 int indx, void *buf, size_t * sizeof_buf)
1068{ 1099{
1069 int result; 1100 int result;
1070 ASN1_TYPE dn = ASN1_TYPE_EMPTY; 1101 ASN1_TYPE dn = ASN1_TYPE_EMPTY;
@@ -1076,7 +1107,7 @@ MHD_gnutls_x509_rdn_get_oid (const MHD_gnutls_datum_t * idn,
1076 1107
1077 if ((result = 1108 if ((result =
1078 MHD__asn1_create_element (MHD__gnutls_get_pkix (), 1109 MHD__asn1_create_element (MHD__gnutls_get_pkix (),
1079 "PKIX1.Name", &dn)) != ASN1_SUCCESS) 1110 "PKIX1.Name", &dn)) != ASN1_SUCCESS)
1080 { 1111 {
1081 MHD_gnutls_assert (); 1112 MHD_gnutls_assert ();
1082 return MHD_gtls_asn2err (result); 1113 return MHD_gtls_asn2err (result);
@@ -1091,7 +1122,8 @@ MHD_gnutls_x509_rdn_get_oid (const MHD_gnutls_datum_t * idn,
1091 return MHD_gtls_asn2err (result); 1122 return MHD_gtls_asn2err (result);
1092 } 1123 }
1093 1124
1094 result = MHD__gnutls_x509_get_dn_oid (dn, "rdnSequence", indx, buf, sizeof_buf); 1125 result =
1126 MHD__gnutls_x509_get_dn_oid (dn, "rdnSequence", indx, buf, sizeof_buf);
1095 1127
1096 MHD__asn1_delete_structure (&dn); 1128 MHD__asn1_delete_structure (&dn);
1097 return result; 1129 return result;
@@ -1108,7 +1140,7 @@ MHD_gnutls_x509_rdn_get_oid (const MHD_gnutls_datum_t * idn,
1108 */ 1140 */
1109int 1141int
1110MHD__gnutls_x509_compare_raw_dn (const MHD_gnutls_datum_t * dn1, 1142MHD__gnutls_x509_compare_raw_dn (const MHD_gnutls_datum_t * dn1,
1111 const MHD_gnutls_datum_t * dn2) 1143 const MHD_gnutls_datum_t * dn2)
1112{ 1144{
1113 1145
1114 if (dn1->size != dn2->size) 1146 if (dn1->size != dn2->size)