diff options
Diffstat (limited to 'src/daemon/https/minitasn1/coding.c')
-rw-r--r-- | src/daemon/https/minitasn1/coding.c | 149 |
1 files changed, 83 insertions, 66 deletions
diff --git a/src/daemon/https/minitasn1/coding.c b/src/daemon/https/minitasn1/coding.c index 350828b3..aa2aecb6 100644 --- a/src/daemon/https/minitasn1/coding.c +++ b/src/daemon/https/minitasn1/coding.c | |||
@@ -47,15 +47,16 @@ | |||
47 | /******************************************************/ | 47 | /******************************************************/ |
48 | static void | 48 | static void |
49 | MHD__asn1_error_description_value_not_found (node_asn * node, | 49 | MHD__asn1_error_description_value_not_found (node_asn * node, |
50 | char *ErrorDescription) | 50 | char *ErrorDescription) |
51 | { | 51 | { |
52 | 52 | ||
53 | if (ErrorDescription == NULL) | 53 | if (ErrorDescription == NULL) |
54 | return; | 54 | return; |
55 | 55 | ||
56 | Estrcpy (ErrorDescription, ":: value of element '"); | 56 | Estrcpy (ErrorDescription, ":: value of element '"); |
57 | MHD__asn1_hierarchical_name (node, ErrorDescription + strlen (ErrorDescription), | 57 | MHD__asn1_hierarchical_name (node, |
58 | MAX_ERROR_DESCRIPTION_SIZE - 40); | 58 | ErrorDescription + strlen (ErrorDescription), |
59 | MAX_ERROR_DESCRIPTION_SIZE - 40); | ||
59 | Estrcat (ErrorDescription, "' not found"); | 60 | Estrcat (ErrorDescription, "' not found"); |
60 | 61 | ||
61 | } | 62 | } |
@@ -115,7 +116,7 @@ MHD__asn1_length_der (unsigned long int len, unsigned char *ans, int *ans_len) | |||
115 | /******************************************************/ | 116 | /******************************************************/ |
116 | static void | 117 | static void |
117 | MHD__asn1_tag_der (unsigned char class, unsigned int tag_value, | 118 | MHD__asn1_tag_der (unsigned char class, unsigned int tag_value, |
118 | unsigned char *ans, int *ans_len) | 119 | unsigned char *ans, int *ans_len) |
119 | { | 120 | { |
120 | int k; | 121 | int k; |
121 | unsigned char temp[SIZEOF_UNSIGNED_INT]; | 122 | unsigned char temp[SIZEOF_UNSIGNED_INT]; |
@@ -154,7 +155,7 @@ MHD__asn1_tag_der (unsigned char class, unsigned int tag_value, | |||
154 | **/ | 155 | **/ |
155 | void | 156 | void |
156 | MHD__asn1_octet_der (const unsigned char *str, int str_len, | 157 | MHD__asn1_octet_der (const unsigned char *str, int str_len, |
157 | unsigned char *der, int *der_len) | 158 | unsigned char *der, int *der_len) |
158 | { | 159 | { |
159 | int len_len; | 160 | int len_len; |
160 | 161 | ||
@@ -187,11 +188,12 @@ MHD__asn1_time_der (unsigned char *str, unsigned char *der, int *der_len) | |||
187 | 188 | ||
188 | max_len = *der_len; | 189 | max_len = *der_len; |
189 | 190 | ||
190 | MHD__asn1_length_der (strlen ((const char*) str), (max_len > 0) ? der : NULL, &len_len); | 191 | MHD__asn1_length_der (strlen ((const char *) str), |
192 | (max_len > 0) ? der : NULL, &len_len); | ||
191 | 193 | ||
192 | if ((len_len + (int) strlen ((const char*) str)) <= max_len) | 194 | if ((len_len + (int) strlen ((const char *) str)) <= max_len) |
193 | memcpy (der + len_len, str, strlen ((const char*) str)); | 195 | memcpy (der + len_len, str, strlen ((const char *) str)); |
194 | *der_len = len_len + strlen ((const char*) str); | 196 | *der_len = len_len + strlen ((const char *) str); |
195 | 197 | ||
196 | if ((*der_len) > max_len) | 198 | if ((*der_len) > max_len) |
197 | return ASN1_MEM_ERROR; | 199 | return ASN1_MEM_ERROR; |
@@ -223,11 +225,11 @@ MHD__asn1_objectid_der (unsigned char *str, unsigned char *der, int *der_len) | |||
223 | 225 | ||
224 | max_len = *der_len; | 226 | max_len = *der_len; |
225 | 227 | ||
226 | temp = (char *) MHD__asn1_alloca (strlen ((const char*)str) + 2); | 228 | temp = (char *) MHD__asn1_alloca (strlen ((const char *) str) + 2); |
227 | if (temp == NULL) | 229 | if (temp == NULL) |
228 | return ASN1_MEM_ALLOC_ERROR; | 230 | return ASN1_MEM_ALLOC_ERROR; |
229 | 231 | ||
230 | strcpy (temp, (const char*) str); | 232 | strcpy (temp, (const char *) str); |
231 | strcat (temp, "."); | 233 | strcat (temp, "."); |
232 | 234 | ||
233 | counter = 0; | 235 | counter = 0; |
@@ -284,7 +286,8 @@ MHD__asn1_objectid_der (unsigned char *str, unsigned char *der, int *der_len) | |||
284 | } | 286 | } |
285 | 287 | ||
286 | 288 | ||
287 | const char MHD_bit_mask[] = { 0xFF, 0xFE, 0xFC, 0xF8, 0xF0, 0xE0, 0xC0, 0x80 }; | 289 | const char MHD_bit_mask[] = |
290 | { 0xFF, 0xFE, 0xFC, 0xF8, 0xF0, 0xE0, 0xC0, 0x80 }; | ||
288 | 291 | ||
289 | /** | 292 | /** |
290 | * MHD__asn1_bit_der: | 293 | * MHD__asn1_bit_der: |
@@ -299,7 +302,7 @@ const char MHD_bit_mask[] = { 0xFF, 0xFE, 0xFC, 0xF8, 0xF0, 0xE0, 0xC0, 0x80 }; | |||
299 | **/ | 302 | **/ |
300 | void | 303 | void |
301 | MHD__asn1_bit_der (const unsigned char *str, int bit_len, | 304 | MHD__asn1_bit_der (const unsigned char *str, int bit_len, |
302 | unsigned char *der, int *der_len) | 305 | unsigned char *der, int *der_len) |
303 | { | 306 | { |
304 | int len_len, len_byte, len_pad; | 307 | int len_len, len_byte, len_pad; |
305 | 308 | ||
@@ -335,7 +338,7 @@ MHD__asn1_bit_der (const unsigned char *str, int bit_len, | |||
335 | /******************************************************/ | 338 | /******************************************************/ |
336 | static MHD__asn1_retCode | 339 | static MHD__asn1_retCode |
337 | MHD__asn1_complete_explicit_tag (node_asn * node, unsigned char *der, | 340 | MHD__asn1_complete_explicit_tag (node_asn * node, unsigned char *der, |
338 | int *counter, int *max_len) | 341 | int *counter, int *max_len) |
339 | { | 342 | { |
340 | node_asn *p; | 343 | node_asn *p; |
341 | int is_tag_implicit, len2, len3; | 344 | int is_tag_implicit, len2, len3; |
@@ -408,7 +411,7 @@ MHD__asn1_complete_explicit_tag (node_asn * node, unsigned char *der, | |||
408 | /******************************************************/ | 411 | /******************************************************/ |
409 | static MHD__asn1_retCode | 412 | static MHD__asn1_retCode |
410 | MHD__asn1_insert_tag_der (node_asn * node, unsigned char *der, int *counter, | 413 | MHD__asn1_insert_tag_der (node_asn * node, unsigned char *der, int *counter, |
411 | int *max_len) | 414 | int *max_len) |
412 | { | 415 | { |
413 | node_asn *p; | 416 | node_asn *p; |
414 | int tag_len, is_tag_implicit; | 417 | int tag_len, is_tag_implicit; |
@@ -438,21 +441,20 @@ MHD__asn1_insert_tag_der (node_asn * node, unsigned char *der, int *counter, | |||
438 | { | 441 | { |
439 | if (is_tag_implicit) | 442 | if (is_tag_implicit) |
440 | MHD__asn1_tag_der (class_implicit, tag_implicit, | 443 | MHD__asn1_tag_der (class_implicit, tag_implicit, |
441 | (unsigned char*) tag_der, | 444 | (unsigned char *) tag_der, &tag_len); |
442 | &tag_len); | ||
443 | else | 445 | else |
444 | MHD__asn1_tag_der (class | ASN1_CLASS_STRUCTURED, | 446 | MHD__asn1_tag_der (class | ASN1_CLASS_STRUCTURED, |
445 | strtoul ( (const char*) p->value, NULL, 10), | 447 | strtoul ((const char *) p->value, NULL, |
446 | (unsigned char*) tag_der, | 448 | 10), |
447 | &tag_len); | 449 | (unsigned char *) tag_der, &tag_len); |
448 | 450 | ||
449 | *max_len -= tag_len; | 451 | *max_len -= tag_len; |
450 | if (*max_len >= 0) | 452 | if (*max_len >= 0) |
451 | memcpy (der + *counter, tag_der, tag_len); | 453 | memcpy (der + *counter, tag_der, tag_len); |
452 | *counter += tag_len; | 454 | *counter += tag_len; |
453 | 455 | ||
454 | MHD__asn1_ltostr (*counter, (char*) temp); | 456 | MHD__asn1_ltostr (*counter, (char *) temp); |
455 | MHD__asn1_set_name (p, (const char*) temp); | 457 | MHD__asn1_set_name (p, (const char *) temp); |
456 | 458 | ||
457 | is_tag_implicit = 0; | 459 | is_tag_implicit = 0; |
458 | } | 460 | } |
@@ -466,7 +468,8 @@ MHD__asn1_insert_tag_der (node_asn * node, unsigned char *der, int *counter, | |||
466 | (type_field (node->type) == TYPE_SET_OF)) | 468 | (type_field (node->type) == TYPE_SET_OF)) |
467 | class |= ASN1_CLASS_STRUCTURED; | 469 | class |= ASN1_CLASS_STRUCTURED; |
468 | class_implicit = class; | 470 | class_implicit = class; |
469 | tag_implicit = strtoul ( (const char*) p->value, NULL, 10); | 471 | tag_implicit = |
472 | strtoul ((const char *) p->value, NULL, 10); | ||
470 | is_tag_implicit = 1; | 473 | is_tag_implicit = 1; |
471 | } | 474 | } |
472 | } | 475 | } |
@@ -477,63 +480,66 @@ MHD__asn1_insert_tag_der (node_asn * node, unsigned char *der, int *counter, | |||
477 | 480 | ||
478 | if (is_tag_implicit) | 481 | if (is_tag_implicit) |
479 | { | 482 | { |
480 | MHD__asn1_tag_der (class_implicit, tag_implicit, (unsigned char*) tag_der, &tag_len); | 483 | MHD__asn1_tag_der (class_implicit, tag_implicit, |
484 | (unsigned char *) tag_der, &tag_len); | ||
481 | } | 485 | } |
482 | else | 486 | else |
483 | { | 487 | { |
484 | switch (type_field (node->type)) | 488 | switch (type_field (node->type)) |
485 | { | 489 | { |
486 | case TYPE_NULL: | 490 | case TYPE_NULL: |
487 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_NULL, (unsigned char*) tag_der, | 491 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_NULL, |
488 | &tag_len); | 492 | (unsigned char *) tag_der, &tag_len); |
489 | break; | 493 | break; |
490 | case TYPE_BOOLEAN: | 494 | case TYPE_BOOLEAN: |
491 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_BOOLEAN, (unsigned char*) tag_der, | 495 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_BOOLEAN, |
492 | &tag_len); | 496 | (unsigned char *) tag_der, &tag_len); |
493 | break; | 497 | break; |
494 | case TYPE_INTEGER: | 498 | case TYPE_INTEGER: |
495 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_INTEGER, (unsigned char*) tag_der, | 499 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_INTEGER, |
496 | &tag_len); | 500 | (unsigned char *) tag_der, &tag_len); |
497 | break; | 501 | break; |
498 | case TYPE_ENUMERATED: | 502 | case TYPE_ENUMERATED: |
499 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_ENUMERATED, (unsigned char*) tag_der, | 503 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_ENUMERATED, |
500 | &tag_len); | 504 | (unsigned char *) tag_der, &tag_len); |
501 | break; | 505 | break; |
502 | case TYPE_OBJECT_ID: | 506 | case TYPE_OBJECT_ID: |
503 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_OBJECT_ID, (unsigned char*) tag_der, | 507 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_OBJECT_ID, |
504 | &tag_len); | 508 | (unsigned char *) tag_der, &tag_len); |
505 | break; | 509 | break; |
506 | case TYPE_TIME: | 510 | case TYPE_TIME: |
507 | if (node->type & CONST_UTC) | 511 | if (node->type & CONST_UTC) |
508 | { | 512 | { |
509 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_UTCTime, (unsigned char*) tag_der, | 513 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_UTCTime, |
510 | &tag_len); | 514 | (unsigned char *) tag_der, &tag_len); |
511 | } | 515 | } |
512 | else | 516 | else |
513 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_GENERALIZEDTime, | 517 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_GENERALIZEDTime, |
514 | (unsigned char*) tag_der, &tag_len); | 518 | (unsigned char *) tag_der, &tag_len); |
515 | break; | 519 | break; |
516 | case TYPE_OCTET_STRING: | 520 | case TYPE_OCTET_STRING: |
517 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_OCTET_STRING, (unsigned char*) tag_der, | 521 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_OCTET_STRING, |
518 | &tag_len); | 522 | (unsigned char *) tag_der, &tag_len); |
519 | break; | 523 | break; |
520 | case TYPE_GENERALSTRING: | 524 | case TYPE_GENERALSTRING: |
521 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_GENERALSTRING, | 525 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_GENERALSTRING, |
522 | (unsigned char*) tag_der, &tag_len); | 526 | (unsigned char *) tag_der, &tag_len); |
523 | break; | 527 | break; |
524 | case TYPE_BIT_STRING: | 528 | case TYPE_BIT_STRING: |
525 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_BIT_STRING, (unsigned char*) tag_der, | 529 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_BIT_STRING, |
526 | &tag_len); | 530 | (unsigned char *) tag_der, &tag_len); |
527 | break; | 531 | break; |
528 | case TYPE_SEQUENCE: | 532 | case TYPE_SEQUENCE: |
529 | case TYPE_SEQUENCE_OF: | 533 | case TYPE_SEQUENCE_OF: |
530 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL | ASN1_CLASS_STRUCTURED, | 534 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL | ASN1_CLASS_STRUCTURED, |
531 | ASN1_TAG_SEQUENCE, (unsigned char*) tag_der, &tag_len); | 535 | ASN1_TAG_SEQUENCE, (unsigned char *) tag_der, |
536 | &tag_len); | ||
532 | break; | 537 | break; |
533 | case TYPE_SET: | 538 | case TYPE_SET: |
534 | case TYPE_SET_OF: | 539 | case TYPE_SET_OF: |
535 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL | ASN1_CLASS_STRUCTURED, | 540 | MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL | ASN1_CLASS_STRUCTURED, |
536 | ASN1_TAG_SET, (unsigned char*) tag_der, &tag_len); | 541 | ASN1_TAG_SET, (unsigned char *) tag_der, |
542 | &tag_len); | ||
537 | break; | 543 | break; |
538 | case TYPE_TAG: | 544 | case TYPE_TAG: |
539 | tag_len = 0; | 545 | tag_len = 0; |
@@ -591,11 +597,11 @@ MHD__asn1_ordering_set (unsigned char *der, int der_len, node_asn * node) | |||
591 | return; | 597 | return; |
592 | 598 | ||
593 | p = node->down; | 599 | p = node->down; |
594 | while ( (p != NULL) && | 600 | while ((p != NULL) && |
595 | ((type_field (p->type) == TYPE_TAG) | 601 | ((type_field (p->type) == TYPE_TAG) |
596 | || (type_field (p->type) == TYPE_SIZE)) ) | 602 | || (type_field (p->type) == TYPE_SIZE))) |
597 | p = p->right; | 603 | p = p->right; |
598 | 604 | ||
599 | if ((p == NULL) || (p->right == NULL)) | 605 | if ((p == NULL) || (p->right == NULL)) |
600 | return; | 606 | return; |
601 | 607 | ||
@@ -623,7 +629,8 @@ MHD__asn1_ordering_set (unsigned char *der, int der_len, node_asn * node) | |||
623 | counter += len2; | 629 | counter += len2; |
624 | 630 | ||
625 | /* extraction and length */ | 631 | /* extraction and length */ |
626 | len2 = MHD__asn1_get_length_der (der + counter, der_len - counter, &len); | 632 | len2 = |
633 | MHD__asn1_get_length_der (der + counter, der_len - counter, &len); | ||
627 | if (len2 < 0) | 634 | if (len2 < 0) |
628 | return; | 635 | return; |
629 | counter += len + len2; | 636 | counter += len + len2; |
@@ -643,7 +650,8 @@ MHD__asn1_ordering_set (unsigned char *der, int der_len, node_asn * node) | |||
643 | if (p_vet->value > p2_vet->value) | 650 | if (p_vet->value > p2_vet->value) |
644 | { | 651 | { |
645 | /* change position */ | 652 | /* change position */ |
646 | temp = (unsigned char *) MHD__asn1_alloca (p_vet->end - counter); | 653 | temp = |
654 | (unsigned char *) MHD__asn1_alloca (p_vet->end - counter); | ||
647 | if (temp == NULL) | 655 | if (temp == NULL) |
648 | return; | 656 | return; |
649 | 657 | ||
@@ -738,7 +746,8 @@ MHD__asn1_ordering_set_of (unsigned char *der, int der_len, node_asn * node) | |||
738 | return; | 746 | return; |
739 | counter += len; | 747 | counter += len; |
740 | 748 | ||
741 | len2 = MHD__asn1_get_length_der (der + counter, der_len - counter, &len); | 749 | len2 = |
750 | MHD__asn1_get_length_der (der + counter, der_len - counter, &len); | ||
742 | if (len2 < 0) | 751 | if (len2 < 0) |
743 | return; | 752 | return; |
744 | counter += len + len2; | 753 | counter += len + len2; |
@@ -781,7 +790,8 @@ MHD__asn1_ordering_set_of (unsigned char *der, int der_len, node_asn * node) | |||
781 | if (change == 1) | 790 | if (change == 1) |
782 | { | 791 | { |
783 | /* change position */ | 792 | /* change position */ |
784 | temp = (unsigned char *) MHD__asn1_alloca (p_vet->end - counter); | 793 | temp = |
794 | (unsigned char *) MHD__asn1_alloca (p_vet->end - counter); | ||
785 | if (temp == NULL) | 795 | if (temp == NULL) |
786 | return; | 796 | return; |
787 | 797 | ||
@@ -837,8 +847,8 @@ MHD__asn1_ordering_set_of (unsigned char *der, int der_len, node_asn * node) | |||
837 | * | 847 | * |
838 | **/ | 848 | **/ |
839 | MHD__asn1_retCode | 849 | MHD__asn1_retCode |
840 | MHD__asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len, | 850 | MHD__asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, |
841 | char *ErrorDescription) | 851 | int *len, char *ErrorDescription) |
842 | { | 852 | { |
843 | node_asn *node, *p, *p2; | 853 | node_asn *node, *p, *p2; |
844 | char temp[SIZEOF_UNSIGNED_LONG_INT * 3 + 1]; | 854 | char temp[SIZEOF_UNSIGNED_LONG_INT * 3 + 1]; |
@@ -894,7 +904,7 @@ MHD__asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len, | |||
894 | if (p->value == NULL) | 904 | if (p->value == NULL) |
895 | { | 905 | { |
896 | MHD__asn1_error_description_value_not_found (p, | 906 | MHD__asn1_error_description_value_not_found (p, |
897 | ErrorDescription); | 907 | ErrorDescription); |
898 | err = ASN1_VALUE_NOT_FOUND; | 908 | err = ASN1_VALUE_NOT_FOUND; |
899 | goto error; | 909 | goto error; |
900 | } | 910 | } |
@@ -924,7 +934,7 @@ MHD__asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len, | |||
924 | if (p->value == NULL) | 934 | if (p->value == NULL) |
925 | { | 935 | { |
926 | MHD__asn1_error_description_value_not_found (p, | 936 | MHD__asn1_error_description_value_not_found (p, |
927 | ErrorDescription); | 937 | ErrorDescription); |
928 | err = ASN1_VALUE_NOT_FOUND; | 938 | err = ASN1_VALUE_NOT_FOUND; |
929 | goto error; | 939 | goto error; |
930 | } | 940 | } |
@@ -952,7 +962,7 @@ MHD__asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len, | |||
952 | if (p->value == NULL) | 962 | if (p->value == NULL) |
953 | { | 963 | { |
954 | MHD__asn1_error_description_value_not_found (p, | 964 | MHD__asn1_error_description_value_not_found (p, |
955 | ErrorDescription); | 965 | ErrorDescription); |
956 | err = ASN1_VALUE_NOT_FOUND; | 966 | err = ASN1_VALUE_NOT_FOUND; |
957 | goto error; | 967 | goto error; |
958 | } | 968 | } |
@@ -969,7 +979,8 @@ MHD__asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len, | |||
969 | case TYPE_TIME: | 979 | case TYPE_TIME: |
970 | if (p->value == NULL) | 980 | if (p->value == NULL) |
971 | { | 981 | { |
972 | MHD__asn1_error_description_value_not_found (p, ErrorDescription); | 982 | MHD__asn1_error_description_value_not_found (p, |
983 | ErrorDescription); | ||
973 | err = ASN1_VALUE_NOT_FOUND; | 984 | err = ASN1_VALUE_NOT_FOUND; |
974 | goto error; | 985 | goto error; |
975 | } | 986 | } |
@@ -985,7 +996,8 @@ MHD__asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len, | |||
985 | case TYPE_OCTET_STRING: | 996 | case TYPE_OCTET_STRING: |
986 | if (p->value == NULL) | 997 | if (p->value == NULL) |
987 | { | 998 | { |
988 | MHD__asn1_error_description_value_not_found (p, ErrorDescription); | 999 | MHD__asn1_error_description_value_not_found (p, |
1000 | ErrorDescription); | ||
989 | err = ASN1_VALUE_NOT_FOUND; | 1001 | err = ASN1_VALUE_NOT_FOUND; |
990 | goto error; | 1002 | goto error; |
991 | } | 1003 | } |
@@ -1004,7 +1016,8 @@ MHD__asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len, | |||
1004 | case TYPE_GENERALSTRING: | 1016 | case TYPE_GENERALSTRING: |
1005 | if (p->value == NULL) | 1017 | if (p->value == NULL) |
1006 | { | 1018 | { |
1007 | MHD__asn1_error_description_value_not_found (p, ErrorDescription); | 1019 | MHD__asn1_error_description_value_not_found (p, |
1020 | ErrorDescription); | ||
1008 | err = ASN1_VALUE_NOT_FOUND; | 1021 | err = ASN1_VALUE_NOT_FOUND; |
1009 | goto error; | 1022 | goto error; |
1010 | } | 1023 | } |
@@ -1023,7 +1036,8 @@ MHD__asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len, | |||
1023 | case TYPE_BIT_STRING: | 1036 | case TYPE_BIT_STRING: |
1024 | if (p->value == NULL) | 1037 | if (p->value == NULL) |
1025 | { | 1038 | { |
1026 | MHD__asn1_error_description_value_not_found (p, ErrorDescription); | 1039 | MHD__asn1_error_description_value_not_found (p, |
1040 | ErrorDescription); | ||
1027 | err = ASN1_VALUE_NOT_FOUND; | 1041 | err = ASN1_VALUE_NOT_FOUND; |
1028 | goto error; | 1042 | goto error; |
1029 | } | 1043 | } |
@@ -1069,11 +1083,12 @@ MHD__asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len, | |||
1069 | } | 1083 | } |
1070 | else | 1084 | else |
1071 | { /* move==UP */ | 1085 | { /* move==UP */ |
1072 | len2 = strtol ( (const char*) p->value, NULL, 10); | 1086 | len2 = strtol ((const char *) p->value, NULL, 10); |
1073 | MHD__asn1_set_value (p, NULL, 0); | 1087 | MHD__asn1_set_value (p, NULL, 0); |
1074 | if ((type_field (p->type) == TYPE_SET) && (max_len >= 0)) | 1088 | if ((type_field (p->type) == TYPE_SET) && (max_len >= 0)) |
1075 | MHD__asn1_ordering_set (der + len2, max_len - len2, p); | 1089 | MHD__asn1_ordering_set (der + len2, max_len - len2, p); |
1076 | MHD__asn1_length_der (counter - len2, (unsigned char*) temp, &len3); | 1090 | MHD__asn1_length_der (counter - len2, (unsigned char *) temp, |
1091 | &len3); | ||
1077 | max_len -= len3; | 1092 | max_len -= len3; |
1078 | if (max_len >= 0) | 1093 | if (max_len >= 0) |
1079 | { | 1094 | { |
@@ -1109,14 +1124,15 @@ MHD__asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len, | |||
1109 | } | 1124 | } |
1110 | if (move == UP) | 1125 | if (move == UP) |
1111 | { | 1126 | { |
1112 | len2 = strtol ( (const char*) p->value, NULL, 10); | 1127 | len2 = strtol ((const char *) p->value, NULL, 10); |
1113 | MHD__asn1_set_value (p, NULL, 0); | 1128 | MHD__asn1_set_value (p, NULL, 0); |
1114 | if ((type_field (p->type) == TYPE_SET_OF) | 1129 | if ((type_field (p->type) == TYPE_SET_OF) |
1115 | && (max_len - len2 > 0)) | 1130 | && (max_len - len2 > 0)) |
1116 | { | 1131 | { |
1117 | MHD__asn1_ordering_set_of (der + len2, max_len - len2, p); | 1132 | MHD__asn1_ordering_set_of (der + len2, max_len - len2, p); |
1118 | } | 1133 | } |
1119 | MHD__asn1_length_der (counter - len2, (unsigned char*) temp, &len3); | 1134 | MHD__asn1_length_der (counter - len2, (unsigned char *) temp, |
1135 | &len3); | ||
1120 | max_len -= len3; | 1136 | max_len -= len3; |
1121 | if (max_len >= 0) | 1137 | if (max_len >= 0) |
1122 | { | 1138 | { |
@@ -1130,7 +1146,8 @@ MHD__asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len, | |||
1130 | case TYPE_ANY: | 1146 | case TYPE_ANY: |
1131 | if (p->value == NULL) | 1147 | if (p->value == NULL) |
1132 | { | 1148 | { |
1133 | MHD__asn1_error_description_value_not_found (p, ErrorDescription); | 1149 | MHD__asn1_error_description_value_not_found (p, |
1150 | ErrorDescription); | ||
1134 | err = ASN1_VALUE_NOT_FOUND; | 1151 | err = ASN1_VALUE_NOT_FOUND; |
1135 | goto error; | 1152 | goto error; |
1136 | } | 1153 | } |