| OLD | NEW |
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | 4 |
| 5 #include "plarena.h" | 5 #include "plarena.h" |
| 6 #include "seccomon.h" | 6 #include "seccomon.h" |
| 7 #include "secitem.h" | 7 #include "secitem.h" |
| 8 #include "secoidt.h" | 8 #include "secoidt.h" |
| 9 #include "secasn1.h" | 9 #include "secasn1.h" |
| 10 #include "secder.h" | 10 #include "secder.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 SEC_ASN1_SUB(SEC_AnyTemplate) }, | 60 SEC_ASN1_SUB(SEC_AnyTemplate) }, |
| 61 { 0, } | 61 { 0, } |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 static const SEC_ASN1Template CERTOtherNameTemplate[] = { | 64 static const SEC_ASN1Template CERTOtherNameTemplate[] = { |
| 65 { SEC_ASN1_CONTEXT_SPECIFIC | SEC_ASN1_CONSTRUCTED | 0 , | 65 { SEC_ASN1_CONTEXT_SPECIFIC | SEC_ASN1_CONSTRUCTED | 0 , |
| 66 offsetof(CERTGeneralName, name.OthName), CERTOthNameTemplate, | 66 offsetof(CERTGeneralName, name.OthName), CERTOthNameTemplate, |
| 67 sizeof(CERTGeneralName) } | 67 sizeof(CERTGeneralName) } |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 static const SEC_ASN1Template CERTOtherName2Template[] = { | |
| 71 { SEC_ASN1_SEQUENCE | SEC_ASN1_CONTEXT_SPECIFIC | 0 , | |
| 72 0, NULL, sizeof(CERTGeneralName) }, | |
| 73 { SEC_ASN1_OBJECT_ID, | |
| 74 offsetof(CERTGeneralName, name.OthName) + offsetof(OtherName, oid) }, | |
| 75 { SEC_ASN1_ANY, | |
| 76 offsetof(CERTGeneralName, name.OthName) + offsetof(OtherName, name) }, | |
| 77 { 0, } | |
| 78 }; | |
| 79 | |
| 80 static const SEC_ASN1Template CERT_RFC822NameTemplate[] = { | 70 static const SEC_ASN1Template CERT_RFC822NameTemplate[] = { |
| 81 { SEC_ASN1_CONTEXT_SPECIFIC | SEC_ASN1_XTRN | 1 , | 71 { SEC_ASN1_CONTEXT_SPECIFIC | SEC_ASN1_XTRN | 1 , |
| 82 offsetof(CERTGeneralName, name.other), | 72 offsetof(CERTGeneralName, name.other), |
| 83 SEC_ASN1_SUB(SEC_IA5StringTemplate), | 73 SEC_ASN1_SUB(SEC_IA5StringTemplate), |
| 84 sizeof (CERTGeneralName)} | 74 sizeof (CERTGeneralName)} |
| 85 }; | 75 }; |
| 86 | 76 |
| 87 static const SEC_ASN1Template CERT_DNSNameTemplate[] = { | 77 static const SEC_ASN1Template CERT_DNSNameTemplate[] = { |
| 88 { SEC_ASN1_CONTEXT_SPECIFIC | SEC_ASN1_XTRN | 2 , | 78 { SEC_ASN1_CONTEXT_SPECIFIC | SEC_ASN1_XTRN | 2 , |
| 89 offsetof(CERTGeneralName, name.other), | 79 offsetof(CERTGeneralName, name.other), |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 * point anywhere else. Otherwise, bad things will happen. | 667 * point anywhere else. Otherwise, bad things will happen. |
| 678 */ | 668 */ |
| 679 constraint->name.l.prev = constraint->name.l.next = &(constraint->name.l); | 669 constraint->name.l.prev = constraint->name.l.next = &(constraint->name.l); |
| 680 /* TODO: unmark arena */ | 670 /* TODO: unmark arena */ |
| 681 return constraint; | 671 return constraint; |
| 682 loser: | 672 loser: |
| 683 /* TODO: release arena back to mark */ | 673 /* TODO: release arena back to mark */ |
| 684 return NULL; | 674 return NULL; |
| 685 } | 675 } |
| 686 | 676 |
| 687 CERTNameConstraint * | 677 static CERTNameConstraint * |
| 688 cert_DecodeNameConstraintSubTree(PLArenaPool *arena, | 678 cert_DecodeNameConstraintSubTree(PLArenaPool *arena, |
| 689 SECItem **subTree, | 679 SECItem **subTree, |
| 690 PRBool permited) | 680 PRBool permited) |
| 691 { | 681 { |
| 692 CERTNameConstraint *current = NULL; | 682 CERTNameConstraint *current = NULL; |
| 693 CERTNameConstraint *first = NULL; | 683 CERTNameConstraint *first = NULL; |
| 694 CERTNameConstraint *last = NULL; | 684 CERTNameConstraint *last = NULL; |
| 695 int i = 0; | 685 int i = 0; |
| 696 | 686 |
| 697 PORT_Assert(arena); | 687 PORT_Assert(arena); |
| 698 /* TODO: mark arena */ | 688 /* TODO: mark arena */ |
| 699 while (subTree[i] != NULL) { | 689 while (subTree[i] != NULL) { |
| 700 current = cert_DecodeNameConstraint(arena, subTree[i]); | 690 current = cert_DecodeNameConstraint(arena, subTree[i]); |
| 701 if (current == NULL) { | 691 if (current == NULL) { |
| 702 goto loser; | 692 goto loser; |
| 703 } | 693 } |
| 704 » if (last == NULL) { | 694 » if (first == NULL) { |
| 705 » first = last = current; | 695 » first = current; |
| 696 » } else { |
| 697 » current->l.prev = &(last->l); |
| 698 » last->l.next = &(current->l); |
| 706 } | 699 } |
| 707 » current->l.prev = &(last->l); | 700 » last = current; |
| 708 » current->l.next = last->l.next; | |
| 709 » last->l.next = &(current->l); | |
| 710 i++; | 701 i++; |
| 711 } | 702 } |
| 712 first->l.prev = &(current->l); | 703 first->l.prev = &(last->l); |
| 704 last->l.next = &(first->l); |
| 713 /* TODO: unmark arena */ | 705 /* TODO: unmark arena */ |
| 714 return first; | 706 return first; |
| 715 loser: | 707 loser: |
| 716 /* TODO: release arena back to mark */ | 708 /* TODO: release arena back to mark */ |
| 717 return NULL; | 709 return NULL; |
| 718 } | 710 } |
| 719 | 711 |
| 720 CERTNameConstraints * | 712 CERTNameConstraints * |
| 721 cert_DecodeNameConstraints(PLArenaPool *reqArena, | 713 cert_DecodeNameConstraints(PLArenaPool *reqArena, |
| 722 const SECItem *encodedConstraints) | 714 const SECItem *encodedConstraints) |
| (...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1984 break; | 1976 break; |
| 1985 } | 1977 } |
| 1986 list->name = cert_CombineNamesLists(list->name, name); | 1978 list->name = cert_CombineNamesLists(list->name, name); |
| 1987 list->len++; | 1979 list->len++; |
| 1988 done: | 1980 done: |
| 1989 PZ_Unlock(list->lock); | 1981 PZ_Unlock(list->lock); |
| 1990 } | 1982 } |
| 1991 return; | 1983 return; |
| 1992 } | 1984 } |
| 1993 #endif | 1985 #endif |
| OLD | NEW |