~ubuntu-branches/ubuntu/lucid/seamonkey/lucid-security

« back to all changes in this revision

Viewing changes to security/nss-fips/lib/util/secdert.h

  • Committer: Bazaar Package Importer
  • Author(s): Fabien Tassin
  • Date: 2008-07-29 21:29:02 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080729212902-spm9kpvchp9udwbw
Tags: 1.1.11+nobinonly-0ubuntu1
* New security upstream release: 1.1.11 (LP: #218534)
  Fixes USN-602-1, USN-619-1, USN-623-1 and USN-629-1
* Refresh diverged patch:
  - update debian/patches/80_security_build.patch
* Fix FTBFS with missing -lfontconfig
  - add debian/patches/11_fix_ftbfs_with_fontconfig.patch
  - update debian/patches/series
* Build with default gcc (hardy: 4.2, intrepid: 4.3)
  - update debian/rules
  - update debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ***** BEGIN LICENSE BLOCK *****
 
2
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
3
 *
 
4
 * The contents of this file are subject to the Mozilla Public License Version
 
5
 * 1.1 (the "License"); you may not use this file except in compliance with
 
6
 * the License. You may obtain a copy of the License at
 
7
 * http://www.mozilla.org/MPL/
 
8
 *
 
9
 * Software distributed under the License is distributed on an "AS IS" basis,
 
10
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
11
 * for the specific language governing rights and limitations under the
 
12
 * License.
 
13
 *
 
14
 * The Original Code is the Netscape security libraries.
 
15
 *
 
16
 * The Initial Developer of the Original Code is
 
17
 * Netscape Communications Corporation.
 
18
 * Portions created by the Initial Developer are Copyright (C) 1994-2000
 
19
 * the Initial Developer. All Rights Reserved.
 
20
 *
 
21
 * Contributor(s):
 
22
 *
 
23
 * Alternatively, the contents of this file may be used under the terms of
 
24
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 
25
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
26
 * in which case the provisions of the GPL or the LGPL are applicable instead
 
27
 * of those above. If you wish to allow use of your version of this file only
 
28
 * under the terms of either the GPL or the LGPL, and not to allow others to
 
29
 * use your version of this file under the terms of the MPL, indicate your
 
30
 * decision by deleting the provisions above and replace them with the notice
 
31
 * and other provisions required by the GPL or the LGPL. If you do not delete
 
32
 * the provisions above, a recipient may use your version of this file under
 
33
 * the terms of any one of the MPL, the GPL or the LGPL.
 
34
 *
 
35
 * ***** END LICENSE BLOCK ***** */
 
36
 
 
37
#ifndef _SECDERT_H_
 
38
#define _SECDERT_H_
 
39
/*
 
40
 * secdert.h - public data structures for the DER encoding and
 
41
 *             decoding utilities library
 
42
 *
 
43
 * $Id: secdert.h,v 1.2 2004/04/25 15:03:18 gerv%gerv.net Exp $
 
44
 */
 
45
 
 
46
typedef struct DERTemplateStr DERTemplate;
 
47
 
 
48
/*
 
49
** An array of these structures defines an encoding for an object using DER.
 
50
** The array usually starts with a dummy entry whose kind is DER_SEQUENCE;
 
51
** such an array is terminated with an entry where kind == 0.  (An array
 
52
** which consists of a single component does not require a second dummy
 
53
** entry -- the array is only searched as long as previous component(s)
 
54
** instruct it.)
 
55
*/
 
56
struct DERTemplateStr {
 
57
    /*
 
58
    ** Kind of item being decoded/encoded, including tags and modifiers.
 
59
    */
 
60
    unsigned long kind;
 
61
 
 
62
    /*
 
63
    ** Offset from base of structure to field that holds the value
 
64
    ** being decoded/encoded.
 
65
    */
 
66
    unsigned int offset;
 
67
 
 
68
    /*
 
69
    ** When kind suggests it (DER_POINTER, DER_INDEFINITE, DER_INLINE),
 
70
    ** this points to a sub-template for nested encoding/decoding.
 
71
    */
 
72
    DERTemplate *sub;
 
73
 
 
74
    /*
 
75
    ** Argument value, dependent on "kind" and/or template placement
 
76
    ** within an array of templates:
 
77
    **  - In the first element of a template array, the value is the
 
78
    **    size of the structure to allocate when this template is being
 
79
    **    referenced by another template via DER_POINTER or DER_INDEFINITE.
 
80
    **  - In a component of a DER_SET or DER_SEQUENCE which is *not* a
 
81
    **    DER_UNIVERSAL type (that is, it has a class tag for either
 
82
    **    DER_APPLICATION, DER_CONTEXT_SPECIFIC, or DER_PRIVATE), the
 
83
    **    value is the underlying type of item being decoded/encoded.
 
84
    */
 
85
    unsigned long arg;
 
86
};
 
87
 
 
88
/************************************************************************/
 
89
 
 
90
/* default chunksize for arenas used for DER stuff */
 
91
#define DER_DEFAULT_CHUNKSIZE (2048)
 
92
 
 
93
/*
 
94
** BER/DER values for ASN.1 identifier octets.
 
95
*/
 
96
#define DER_TAG_MASK            0xff
 
97
 
 
98
/*
 
99
 * BER/DER universal type tag numbers.
 
100
 * The values are defined by the X.208 standard; do not change them!
 
101
 * NOTE: if you add anything to this list, you must add code to derdec.c
 
102
 * to accept the tag, and probably also to derenc.c to encode it.
 
103
 */
 
104
#define DER_TAGNUM_MASK         0x1f
 
105
#define DER_BOOLEAN             0x01
 
106
#define DER_INTEGER             0x02
 
107
#define DER_BIT_STRING          0x03
 
108
#define DER_OCTET_STRING        0x04
 
109
#define DER_NULL                0x05
 
110
#define DER_OBJECT_ID           0x06
 
111
#define DER_SEQUENCE            0x10
 
112
#define DER_SET                 0x11
 
113
#define DER_PRINTABLE_STRING    0x13
 
114
#define DER_T61_STRING          0x14
 
115
#define DER_IA5_STRING          0x16
 
116
#define DER_UTC_TIME            0x17
 
117
#define DER_VISIBLE_STRING      0x1a
 
118
#define DER_HIGH_TAG_NUMBER     0x1f
 
119
 
 
120
/*
 
121
** Modifiers to type tags.  These are also specified by a/the
 
122
** standard, and must not be changed.
 
123
*/
 
124
 
 
125
#define DER_METHOD_MASK         0x20
 
126
#define DER_PRIMITIVE           0x00
 
127
#define DER_CONSTRUCTED         0x20
 
128
 
 
129
#define DER_CLASS_MASK          0xc0
 
130
#define DER_UNIVERSAL           0x00
 
131
#define DER_APPLICATION         0x40
 
132
#define DER_CONTEXT_SPECIFIC    0x80
 
133
#define DER_PRIVATE             0xc0
 
134
 
 
135
/*
 
136
** Our additions, used for templates.
 
137
** These are not defined by any standard; the values are used internally only.
 
138
** Just be careful to keep them out of the low 8 bits.
 
139
*/
 
140
#define DER_OPTIONAL            0x00100
 
141
#define DER_EXPLICIT            0x00200
 
142
#define DER_ANY                 0x00400
 
143
#define DER_INLINE              0x00800
 
144
#define DER_POINTER             0x01000
 
145
#define DER_INDEFINITE          0x02000
 
146
#define DER_DERPTR              0x04000
 
147
#define DER_SKIP                0x08000
 
148
#define DER_FORCE               0x10000
 
149
#define DER_OUTER               0x40000 /* for DER_DERPTR */
 
150
 
 
151
/*
 
152
** Macro to convert der decoded bit string into a decoded octet
 
153
** string. All it needs to do is fiddle with the length code.
 
154
*/
 
155
#define DER_ConvertBitString(item)        \
 
156
{                                         \
 
157
    (item)->len = ((item)->len + 7) >> 3; \
 
158
}
 
159
 
 
160
extern DERTemplate SECAnyTemplate[];
 
161
extern DERTemplate SECBitStringTemplate[];
 
162
extern DERTemplate SECBooleanTemplate[];
 
163
extern DERTemplate SECIA5StringTemplate[];
 
164
extern DERTemplate SECIntegerTemplate[];
 
165
extern DERTemplate SECNullTemplate[];
 
166
extern DERTemplate SECObjectIDTemplate[];
 
167
extern DERTemplate SECOctetStringTemplate[];
 
168
extern DERTemplate SECPrintableStringTemplate[];
 
169
extern DERTemplate SECT61StringTemplate[];
 
170
extern DERTemplate SECUTCTimeTemplate[];
 
171
extern DERTemplate SECAlgorithmIDTemplate[];
 
172
 
 
173
#endif /* _SECDERT_H_ */