summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/objects
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>2002-05-15 02:29:24 +0000
committercvs2svn <admin@example.com>2002-05-15 02:29:24 +0000
commit027351f729b9e837200dae6e1520cda6577ab930 (patch)
treee25a717057aa4529e433fc3b1fac8d4df8db3a5c /src/lib/libcrypto/objects
parentaeeae06a79815dc190061534d47236cec09f9e32 (diff)
downloadopenbsd-027351f729b9e837200dae6e1520cda6577ab930.tar.gz
openbsd-027351f729b9e837200dae6e1520cda6577ab930.tar.bz2
openbsd-027351f729b9e837200dae6e1520cda6577ab930.zip
This commit was manufactured by cvs2git to create branch 'unlabeled-1.1.1'.
Diffstat (limited to 'src/lib/libcrypto/objects')
-rw-r--r--src/lib/libcrypto/objects/o_names.c243
-rw-r--r--src/lib/libcrypto/objects/obj_mac.num392
-rw-r--r--src/lib/libcrypto/objects/objects.README44
-rw-r--r--src/lib/libcrypto/objects/objects.pl224
4 files changed, 903 insertions, 0 deletions
diff --git a/src/lib/libcrypto/objects/o_names.c b/src/lib/libcrypto/objects/o_names.c
new file mode 100644
index 0000000000..4da5e45b9c
--- /dev/null
+++ b/src/lib/libcrypto/objects/o_names.c
@@ -0,0 +1,243 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4
5#include <openssl/lhash.h>
6#include <openssl/objects.h>
7
8/* I use the ex_data stuff to manage the identifiers for the obj_name_types
9 * that applications may define. I only really use the free function field.
10 */
11static LHASH *names_lh=NULL;
12static int names_type_num=OBJ_NAME_TYPE_NUM;
13static STACK *names_cmp=NULL;
14static STACK *names_hash=NULL;
15static STACK *names_free=NULL;
16
17static unsigned long obj_name_hash(OBJ_NAME *a);
18static int obj_name_cmp(OBJ_NAME *a,OBJ_NAME *b);
19
20int OBJ_NAME_init(void)
21 {
22 if (names_lh != NULL) return(1);
23 MemCheck_off();
24 names_lh=lh_new(obj_name_hash,obj_name_cmp);
25 MemCheck_on();
26 return(names_lh != NULL);
27 }
28
29int OBJ_NAME_new_index(unsigned long (*hash_func)(), int (*cmp_func)(),
30 void (*free_func)())
31 {
32 int ret;
33 int i;
34
35 if (names_free == NULL)
36 {
37 MemCheck_off();
38 names_hash=sk_new_null();
39 names_cmp=sk_new_null();
40 names_free=sk_new_null();
41 MemCheck_on();
42 }
43 if ((names_free == NULL) || (names_hash == NULL) || (names_cmp == NULL))
44 {
45 /* ERROR */
46 return(0);
47 }
48 ret=names_type_num;
49 names_type_num++;
50 for (i=sk_num(names_free); i<names_type_num; i++)
51 {
52 MemCheck_off();
53 sk_push(names_hash,(char *)strcmp);
54 sk_push(names_cmp,(char *)lh_strhash);
55 sk_push(names_free,NULL);
56 MemCheck_on();
57 }
58 if (hash_func != NULL)
59 sk_set(names_hash,ret,(char *)hash_func);
60 if (cmp_func != NULL)
61 sk_set(names_cmp,ret,(char *)cmp_func);
62 if (free_func != NULL)
63 sk_set(names_free,ret,(char *)free_func);
64 return(ret);
65 }
66
67static int obj_name_cmp(OBJ_NAME *a, OBJ_NAME *b)
68 {
69 int ret;
70 int (*cmp)();
71
72 ret=a->type-b->type;
73 if (ret == 0)
74 {
75 if ((names_cmp != NULL) && (sk_num(names_cmp) > a->type))
76 {
77 cmp=(int (*)())sk_value(names_cmp,a->type);
78 ret=cmp(a->name,b->name);
79 }
80 else
81 ret=strcmp(a->name,b->name);
82 }
83 return(ret);
84 }
85
86static unsigned long obj_name_hash(OBJ_NAME *a)
87 {
88 unsigned long ret;
89 unsigned long (*hash)();
90
91 if ((names_hash != NULL) && (sk_num(names_hash) > a->type))
92 {
93 hash=(unsigned long (*)())sk_value(names_hash,a->type);
94 ret=hash(a->name);
95 }
96 else
97 {
98 ret=lh_strhash(a->name);
99 }
100 ret^=a->type;
101 return(ret);
102 }
103
104const char *OBJ_NAME_get(const char *name, int type)
105 {
106 OBJ_NAME on,*ret;
107 int num=0,alias;
108
109 if (name == NULL) return(NULL);
110 if ((names_lh == NULL) && !OBJ_NAME_init()) return(NULL);
111
112 alias=type&OBJ_NAME_ALIAS;
113 type&= ~OBJ_NAME_ALIAS;
114
115 on.name=name;
116 on.type=type;
117
118 for (;;)
119 {
120 ret=(OBJ_NAME *)lh_retrieve(names_lh,(char *)&on);
121 if (ret == NULL) return(NULL);
122 if ((ret->alias) && !alias)
123 {
124 if (++num > 10) return(NULL);
125 on.name=ret->data;
126 }
127 else
128 {
129 return(ret->data);
130 }
131 }
132 }
133
134int OBJ_NAME_add(const char *name, int type, const char *data)
135 {
136 void (*f)();
137 OBJ_NAME *onp,*ret;
138 int alias;
139
140 if ((names_lh == NULL) && !OBJ_NAME_init()) return(0);
141
142 alias=type&OBJ_NAME_ALIAS;
143 type&= ~OBJ_NAME_ALIAS;
144
145 onp=(OBJ_NAME *)Malloc(sizeof(OBJ_NAME));
146 if (onp == NULL)
147 {
148 /* ERROR */
149 return(0);
150 }
151
152 onp->name=name;
153 onp->alias=alias;
154 onp->type=type;
155 onp->data=data;
156
157 ret=(OBJ_NAME *)lh_insert(names_lh,(char *)onp);
158 if (ret != NULL)
159 {
160 /* free things */
161 if ((names_free != NULL) && (sk_num(names_free) > ret->type))
162 {
163 f=(void (*)())sk_value(names_free,ret->type);
164 f(ret->name,ret->type,ret->data);
165 }
166 Free((char *)ret);
167 }
168 else
169 {
170 if (lh_error(names_lh))
171 {
172 /* ERROR */
173 return(0);
174 }
175 }
176 return(1);
177 }
178
179int OBJ_NAME_remove(const char *name, int type)
180 {
181 OBJ_NAME on,*ret;
182 void (*f)();
183
184 if (names_lh == NULL) return(0);
185
186 type&= ~OBJ_NAME_ALIAS;
187 on.name=name;
188 on.type=type;
189 ret=(OBJ_NAME *)lh_delete(names_lh,(char *)&on);
190 if (ret != NULL)
191 {
192 /* free things */
193 if ((names_free != NULL) && (sk_num(names_free) > type))
194 {
195 f=(void (*)())sk_value(names_free,type);
196 f(ret->name,ret->type,ret->data);
197 }
198 Free((char *)ret);
199 return(1);
200 }
201 else
202 return(0);
203 }
204
205static int free_type;
206
207static void names_lh_free(OBJ_NAME *onp, int type)
208{
209 if(onp == NULL)
210 return;
211
212 if ((free_type < 0) || (free_type == onp->type))
213 {
214 OBJ_NAME_remove(onp->name,onp->type);
215 }
216 }
217
218void OBJ_NAME_cleanup(int type)
219 {
220 unsigned long down_load;
221
222 if (names_lh == NULL) return;
223
224 free_type=type;
225 down_load=names_lh->down_load;
226 names_lh->down_load=0;
227
228 lh_doall(names_lh,names_lh_free);
229 if (type < 0)
230 {
231 lh_free(names_lh);
232 sk_free(names_hash);
233 sk_free(names_cmp);
234 sk_free(names_free);
235 names_lh=NULL;
236 names_hash=NULL;
237 names_cmp=NULL;
238 names_free=NULL;
239 }
240 else
241 names_lh->down_load=down_load;
242 }
243
diff --git a/src/lib/libcrypto/objects/obj_mac.num b/src/lib/libcrypto/objects/obj_mac.num
new file mode 100644
index 0000000000..d73a51370f
--- /dev/null
+++ b/src/lib/libcrypto/objects/obj_mac.num
@@ -0,0 +1,392 @@
1undef 0
2rsadsi 1
3pkcs 2
4md2 3
5md5 4
6rc4 5
7rsaEncryption 6
8md2WithRSAEncryption 7
9md5WithRSAEncryption 8
10pbeWithMD2AndDES_CBC 9
11pbeWithMD5AndDES_CBC 10
12X500 11
13X509 12
14commonName 13
15countryName 14
16localityName 15
17stateOrProvinceName 16
18organizationName 17
19organizationalUnitName 18
20rsa 19
21pkcs7 20
22pkcs7_data 21
23pkcs7_signed 22
24pkcs7_enveloped 23
25pkcs7_signedAndEnveloped 24
26pkcs7_digest 25
27pkcs7_encrypted 26
28pkcs3 27
29dhKeyAgreement 28
30des_ecb 29
31des_cfb64 30
32des_cbc 31
33des_ede 32
34des_ede3 33
35idea_cbc 34
36idea_cfb64 35
37idea_ecb 36
38rc2_cbc 37
39rc2_ecb 38
40rc2_cfb64 39
41rc2_ofb64 40
42sha 41
43shaWithRSAEncryption 42
44des_ede_cbc 43
45des_ede3_cbc 44
46des_ofb64 45
47idea_ofb64 46
48pkcs9 47
49pkcs9_emailAddress 48
50pkcs9_unstructuredName 49
51pkcs9_contentType 50
52pkcs9_messageDigest 51
53pkcs9_signingTime 52
54pkcs9_countersignature 53
55pkcs9_challengePassword 54
56pkcs9_unstructuredAddress 55
57pkcs9_extCertAttributes 56
58netscape 57
59netscape_cert_extension 58
60netscape_data_type 59
61des_ede_cfb64 60
62des_ede3_cfb64 61
63des_ede_ofb64 62
64des_ede3_ofb64 63
65sha1 64
66sha1WithRSAEncryption 65
67dsaWithSHA 66
68dsa_2 67
69pbeWithSHA1AndRC2_CBC 68
70id_pbkdf2 69
71dsaWithSHA1_2 70
72netscape_cert_type 71
73netscape_base_url 72
74netscape_revocation_url 73
75netscape_ca_revocation_url 74
76netscape_renewal_url 75
77netscape_ca_policy_url 76
78netscape_ssl_server_name 77
79netscape_comment 78
80netscape_cert_sequence 79
81desx_cbc 80
82id_ce 81
83subject_key_identifier 82
84key_usage 83
85private_key_usage_period 84
86subject_alt_name 85
87issuer_alt_name 86
88basic_constraints 87
89crl_number 88
90certificate_policies 89
91authority_key_identifier 90
92bf_cbc 91
93bf_ecb 92
94bf_cfb64 93
95bf_ofb64 94
96mdc2 95
97mdc2WithRSA 96
98rc4_40 97
99rc2_40_cbc 98
100givenName 99
101surname 100
102initials 101
103uniqueIdentifier 102
104crl_distribution_points 103
105md5WithRSA 104
106serialNumber 105
107title 106
108description 107
109cast5_cbc 108
110cast5_ecb 109
111cast5_cfb64 110
112cast5_ofb64 111
113pbeWithMD5AndCast5_CBC 112
114dsaWithSHA1 113
115md5_sha1 114
116sha1WithRSA 115
117dsa 116
118ripemd160 117
119ripemd160WithRSA 119
120rc5_cbc 120
121rc5_ecb 121
122rc5_cfb64 122
123rc5_ofb64 123
124rle_compression 124
125zlib_compression 125
126ext_key_usage 126
127id_pkix 127
128id_kp 128
129server_auth 129
130client_auth 130
131code_sign 131
132email_protect 132
133time_stamp 133
134ms_code_ind 134
135ms_code_com 135
136ms_ctl_sign 136
137ms_sgc 137
138ms_efs 138
139ns_sgc 139
140delta_crl 140
141crl_reason 141
142invalidity_date 142
143sxnet 143
144pbe_WithSHA1And128BitRC4 144
145pbe_WithSHA1And40BitRC4 145
146pbe_WithSHA1And3_Key_TripleDES_CBC 146
147pbe_WithSHA1And2_Key_TripleDES_CBC 147
148pbe_WithSHA1And128BitRC2_CBC 148
149pbe_WithSHA1And40BitRC2_CBC 149
150keyBag 150
151pkcs8ShroudedKeyBag 151
152certBag 152
153crlBag 153
154secretBag 154
155safeContentsBag 155
156friendlyName 156
157localKeyID 157
158x509Certificate 158
159sdsiCertificate 159
160x509Crl 160
161pbes2 161
162pbmac1 162
163hmacWithSHA1 163
164id_qt_cps 164
165id_qt_unotice 165
166rc2_64_cbc 166
167SMIMECapabilities 167
168pbeWithMD2AndRC2_CBC 168
169pbeWithMD5AndRC2_CBC 169
170pbeWithSHA1AndDES_CBC 170
171ms_ext_req 171
172ext_req 172
173name 173
174dnQualifier 174
175id_pe 175
176id_ad 176
177info_access 177
178ad_OCSP 178
179ad_ca_issuers 179
180OCSP_sign 180
181iso 181
182member_body 182
183ISO_US 183
184X9_57 184
185X9cm 185
186pkcs1 186
187pkcs5 187
188SMIME 188
189id_smime_mod 189
190id_smime_ct 190
191id_smime_aa 191
192id_smime_alg 192
193id_smime_cd 193
194id_smime_spq 194
195id_smime_cti 195
196id_smime_mod_cms 196
197id_smime_mod_ess 197
198id_smime_mod_oid 198
199id_smime_mod_msg_v3 199
200id_smime_mod_ets_eSignature_88 200
201id_smime_mod_ets_eSignature_97 201
202id_smime_mod_ets_eSigPolicy_88 202
203id_smime_mod_ets_eSigPolicy_97 203
204id_smime_ct_receipt 204
205id_smime_ct_authData 205
206id_smime_ct_publishCert 206
207id_smime_ct_TSTInfo 207
208id_smime_ct_TDTInfo 208
209id_smime_ct_contentInfo 209
210id_smime_ct_DVCSRequestData 210
211id_smime_ct_DVCSResponseData 211
212id_smime_aa_receiptRequest 212
213id_smime_aa_securityLabel 213
214id_smime_aa_mlExpandHistory 214
215id_smime_aa_contentHint 215
216id_smime_aa_msgSigDigest 216
217id_smime_aa_encapContentType 217
218id_smime_aa_contentIdentifier 218
219id_smime_aa_macValue 219
220id_smime_aa_equivalentLabels 220
221id_smime_aa_contentReference 221
222id_smime_aa_encrypKeyPref 222
223id_smime_aa_signingCertificate 223
224id_smime_aa_smimeEncryptCerts 224
225id_smime_aa_timeStampToken 225
226id_smime_aa_ets_sigPolicyId 226
227id_smime_aa_ets_commitmentType 227
228id_smime_aa_ets_signerLocation 228
229id_smime_aa_ets_signerAttr 229
230id_smime_aa_ets_otherSigCert 230
231id_smime_aa_ets_contentTimestamp 231
232id_smime_aa_ets_CertificateRefs 232
233id_smime_aa_ets_RevocationRefs 233
234id_smime_aa_ets_certValues 234
235id_smime_aa_ets_revocationValues 235
236id_smime_aa_ets_escTimeStamp 236
237id_smime_aa_ets_certCRLTimestamp 237
238id_smime_aa_ets_archiveTimeStamp 238
239id_smime_aa_signatureType 239
240id_smime_aa_dvcs_dvc 240
241id_smime_alg_ESDHwith3DES 241
242id_smime_alg_ESDHwithRC2 242
243id_smime_alg_3DESwrap 243
244id_smime_alg_RC2wrap 244
245id_smime_alg_ESDH 245
246id_smime_alg_CMS3DESwrap 246
247id_smime_alg_CMSRC2wrap 247
248id_smime_cd_ldap 248
249id_smime_spq_ets_sqt_uri 249
250id_smime_spq_ets_sqt_unotice 250
251id_smime_cti_ets_proofOfOrigin 251
252id_smime_cti_ets_proofOfReceipt 252
253id_smime_cti_ets_proofOfDelivery 253
254id_smime_cti_ets_proofOfSender 254
255id_smime_cti_ets_proofOfApproval 255
256id_smime_cti_ets_proofOfCreation 256
257md4 257
258id_pkix_mod 258
259id_qt 259
260id_it 260
261id_pkip 261
262id_alg 262
263id_cmc 263
264id_on 264
265id_pda 265
266id_aca 266
267id_qcs 267
268id_cct 268
269id_pkix1_explicit_88 269
270id_pkix1_implicit_88 270
271id_pkix1_explicit_93 271
272id_pkix1_implicit_93 272
273id_mod_crmf 273
274id_mod_cmc 274
275id_mod_kea_profile_88 275
276id_mod_kea_profile_93 276
277id_mod_cmp 277
278id_mod_qualified_cert_88 278
279id_mod_qualified_cert_93 279
280id_mod_attribute_cert 280
281id_mod_timestamp_protocol 281
282id_mod_ocsp 282
283id_mod_dvcs 283
284id_mod_cmp2000 284
285biometricInfo 285
286qcStatements 286
287ac_auditEntity 287
288ac_targeting 288
289aaControls 289
290sbqp_ipAddrBlock 290
291sbqp_autonomousSysNum 291
292sbqp_routerIdentifier 292
293textNotice 293
294ipsecEndSystem 294
295ipsecTunnel 295
296ipsecUser 296
297dvcs 297
298id_it_caProtEncCert 298
299id_it_signKeyPairTypes 299
300id_it_encKeyPairTypes 300
301id_it_preferredSymmAlg 301
302id_it_caKeyUpdateInfo 302
303id_it_currentCRL 303
304id_it_unsupportedOIDs 304
305id_it_subscriptionRequest 305
306id_it_subscriptionResponse 306
307id_it_keyPairParamReq 307
308id_it_keyPairParamRep 308
309id_it_revPassphrase 309
310id_it_implicitConfirm 310
311id_it_confirmWaitTime 311
312id_it_origPKIMessage 312
313id_regCtrl 313
314id_regInfo 314
315id_regCtrl_regToken 315
316id_regCtrl_authenticator 316
317id_regCtrl_pkiPublicationInfo 317
318id_regCtrl_pkiArchiveOptions 318
319id_regCtrl_oldCertID 319
320id_regCtrl_protocolEncrKey 320
321id_regInfo_utf8Pairs 321
322id_regInfo_certReq 322
323id_alg_des40 323
324id_alg_noSignature 324
325id_alg_dh_sig_hmac_sha1 325
326id_alg_dh_pop 326
327id_cmc_statusInfo 327
328id_cmc_identification 328
329id_cmc_identityProof 329
330id_cmc_dataReturn 330
331id_cmc_transactionId 331
332id_cmc_senderNonce 332
333id_cmc_recipientNonce 333
334id_cmc_addExtensions 334
335id_cmc_encryptedPOP 335
336id_cmc_decryptedPOP 336
337id_cmc_lraPOPWitness 337
338id_cmc_getCert 338
339id_cmc_getCRL 339
340id_cmc_revokeRequest 340
341id_cmc_regInfo 341
342id_cmc_responseInfo 342
343id_cmc_queryPending 343
344id_cmc_popLinkRandom 344
345id_cmc_popLinkWitness 345
346id_cmc_confirmCertAcceptance 346
347id_on_personalData 347
348id_pda_dateOfBirth 348
349id_pda_placeOfBirth 349
350id_pda_pseudonym 350
351id_pda_gender 351
352id_pda_countryOfCitizenship 352
353id_pda_countryOfResidence 353
354id_aca_authenticationInfo 354
355id_aca_accessIdentity 355
356id_aca_chargingIdentity 356
357id_aca_group 357
358id_aca_role 358
359id_qcs_pkixQCSyntax_v1 359
360id_cct_crs 360
361id_cct_PKIData 361
362id_cct_PKIResponse 362
363ad_timeStamping 363
364ad_dvcs 364
365id_pkix_OCSP_basic 365
366id_pkix_OCSP_Nonce 366
367id_pkix_OCSP_CrlID 367
368id_pkix_OCSP_acceptableResponses 368
369id_pkix_OCSP_noCheck 369
370id_pkix_OCSP_archiveCutoff 370
371id_pkix_OCSP_serviceLocator 371
372id_pkix_OCSP_extendedStatus 372
373id_pkix_OCSP_valid 373
374id_pkix_OCSP_path 374
375id_pkix_OCSP_trustRoot 375
376algorithm 376
377rsaSignature 377
378X500algorithms 378
379org 379
380dod 380
381iana 381
382Directory 382
383Management 383
384Experimental 384
385Private 385
386Security 386
387SNMPv2 387
388Mail 388
389Enterprises 389
390dcObject 390
391domainComponent 391
392Domain 392
diff --git a/src/lib/libcrypto/objects/objects.README b/src/lib/libcrypto/objects/objects.README
new file mode 100644
index 0000000000..4d745508d8
--- /dev/null
+++ b/src/lib/libcrypto/objects/objects.README
@@ -0,0 +1,44 @@
1objects.txt syntax
2------------------
3
4To cover all the naming hacks that were previously in objects.h needed some
5kind of hacks in objects.txt.
6
7The basic syntax for adding an object is as follows:
8
9 1 2 3 4 : shortName : Long Name
10
11 If the long name doesn't contain spaces, or no short name
12 exists, the long name is used as basis for the base name
13 in C. Otherwise, the short name is used.
14
15 The base name (let's call it 'base') will then be used to
16 create the C macros SN_base, LN_base, NID_base and OBJ_base.
17
18 Note that if the base name contains spaces, dashes or periods,
19 those will be converte to underscore.
20
21Then there are some extra commands:
22
23 !Alias foo 1 2 3 4
24
25 This juts makes a name foo for an OID. The C macro
26 OBJ_foo will be created as a result.
27
28 !Cname foo
29
30 This makes sure that the name foo will be used as base name
31 in C.
32
33 !module foo
34 1 2 3 4 : shortName : Long Name
35 !global
36
37 The !module command was meant to define a kind of modularity.
38 What it does is to make sure the module name is prepended
39 to the base name. !global turns this off. This construction
40 is not recursive.
41
42Lines starting with # are treated as comments, as well as any line starting
43with ! and not matching the commands above.
44
diff --git a/src/lib/libcrypto/objects/objects.pl b/src/lib/libcrypto/objects/objects.pl
new file mode 100644
index 0000000000..c956bbb841
--- /dev/null
+++ b/src/lib/libcrypto/objects/objects.pl
@@ -0,0 +1,224 @@
1#!/usr/local/bin/perl
2
3open (NUMIN,"$ARGV[1]") || die "Can't open number file $ARGV[1]";
4$max_nid=0;
5$o=0;
6while(<NUMIN>)
7 {
8 chop;
9 $o++;
10 s/#.*$//;
11 next if /^\s*$/;
12 ($Cname,$mynum) = split;
13 if (defined($nidn{$mynum}))
14 { die "$ARGV[1]:$o:There's already an object with NID ",$mynum," on line ",$order{$mynum},"\n"; }
15 $nid{$Cname} = $mynum;
16 $nidn{$mynum} = $Cname;
17 $order{$mynum} = $o;
18 $max_nid = $mynum if $mynum > $max_nid;
19 }
20close NUMIN;
21
22open (IN,"$ARGV[0]") || die "Can't open input file $ARGV[0]";
23$Cname="";
24$o=0;
25while (<IN>)
26 {
27 chop;
28 $o++;
29 if (/^!module\s+(.*)$/)
30 {
31 $module = $1."-";
32 $module =~ s/\./_/g;
33 $module =~ s/-/_/g;
34 }
35 if (/^!global$/)
36 { $module = ""; }
37 if (/^!Cname\s+(.*)$/)
38 { $Cname = $1; }
39 if (/^!Alias\s+(.+?)\s+(.*)$/)
40 {
41 $Cname = $module.$1;
42 $myoid = $2;
43 $myoid = &process_oid($myoid);
44 $Cname =~ s/-/_/g;
45 $ordern{$o} = $Cname;
46 $order{$Cname} = $o;
47 $obj{$Cname} = $myoid;
48 $_ = "";
49 $Cname = "";
50 }
51 s/!.*$//;
52 s/#.*$//;
53 next if /^\s*$/;
54 ($myoid,$mysn,$myln) = split ':';
55 $mysn =~ s/^\s*//;
56 $mysn =~ s/\s*$//;
57 $myln =~ s/^\s*//;
58 $myln =~ s/\s*$//;
59 $myoid =~ s/^\s*//;
60 $myoid =~ s/\s*$//;
61 if ($myoid ne "")
62 {
63 $myoid = &process_oid($myoid);
64 }
65
66 if ($Cname eq "" && !($myln =~ / /))
67 {
68 $Cname = $myln;
69 $Cname =~ s/\./_/g;
70 $Cname =~ s/-/_/g;
71 if ($Cname ne "" && defined($ln{$module.$Cname}))
72 { die "objects.txt:$o:There's already an object with long name ",$ln{$module.$Cname}," on line ",$order{$module.$Cname},"\n"; }
73 }
74 if ($Cname eq "")
75 {
76 $Cname = $mysn;
77 $Cname =~ s/-/_/g;
78 if ($Cname ne "" && defined($sn{$module.$Cname}))
79 { die "objects.txt:$o:There's already an object with short name ",$sn{$module.$Cname}," on line ",$order{$module.$Cname},"\n"; }
80 }
81 if ($Cname eq "")
82 {
83 $Cname = $myln;
84 $Cname =~ s/-/_/g;
85 $Cname =~ s/\./_/g;
86 $Cname =~ s/ /_/g;
87 if ($Cname ne "" && defined($ln{$module.$Cname}))
88 { die "objects.txt:$o:There's already an object with long name ",$ln{$module.$Cname}," on line ",$order{$module.$Cname},"\n"; }
89 }
90 $Cname =~ s/\./_/g;
91 $Cname =~ s/-/_/g;
92 $Cname = $module.$Cname;
93 $ordern{$o} = $Cname;
94 $order{$Cname} = $o;
95 $sn{$Cname} = $mysn;
96 $ln{$Cname} = $myln;
97 $obj{$Cname} = $myoid;
98 if (!defined($nid{$Cname}))
99 {
100 $max_nid++;
101 $nid{$Cname} = $max_nid;
102 $nidn{$max_nid} = $Cname;
103 }
104 $Cname="";
105 }
106close IN;
107
108open (NUMOUT,">$ARGV[1]") || die "Can't open output file $ARGV[1]";
109foreach (sort { $a <=> $b } keys %nidn)
110 {
111 print NUMOUT $nidn{$_},"\t\t",$_,"\n";
112 }
113close NUMOUT;
114
115open (OUT,">$ARGV[2]") || die "Can't open output file $ARGV[2]";
116print OUT <<'EOF';
117/* lib/obj/obj_mac.h */
118/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
119 * All rights reserved.
120 *
121 * This package is an SSL implementation written
122 * by Eric Young (eay@cryptsoft.com).
123 * The implementation was written so as to conform with Netscapes SSL.
124 *
125 * This library is free for commercial and non-commercial use as long as
126 * the following conditions are aheared to. The following conditions
127 * apply to all code found in this distribution, be it the RC4, RSA,
128 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
129 * included with this distribution is covered by the same copyright terms
130 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
131 *
132 * Copyright remains Eric Young's, and as such any Copyright notices in
133 * the code are not to be removed.
134 * If this package is used in a product, Eric Young should be given attribution
135 * as the author of the parts of the library used.
136 * This can be in the form of a textual message at program startup or
137 * in documentation (online or textual) provided with the package.
138 *
139 * Redistribution and use in source and binary forms, with or without
140 * modification, are permitted provided that the following conditions
141 * are met:
142 * 1. Redistributions of source code must retain the copyright
143 * notice, this list of conditions and the following disclaimer.
144 * 2. Redistributions in binary form must reproduce the above copyright
145 * notice, this list of conditions and the following disclaimer in the
146 * documentation and/or other materials provided with the distribution.
147 * 3. All advertising materials mentioning features or use of this software
148 * must display the following acknowledgement:
149 * "This product includes cryptographic software written by
150 * Eric Young (eay@cryptsoft.com)"
151 * The word 'cryptographic' can be left out if the rouines from the library
152 * being used are not cryptographic related :-).
153 * 4. If you include any Windows specific code (or a derivative thereof) from
154 * the apps directory (application code) you must include an acknowledgement:
155 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
156 *
157 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
158 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
159 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
160 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
161 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
162 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
163 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
164 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
165 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
166 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
167 * SUCH DAMAGE.
168 *
169 * The licence and distribution terms for any publically available version or
170 * derivative of this code cannot be changed. i.e. this code cannot simply be
171 * copied and put under another distribution licence
172 * [including the GNU Public Licence.]
173 */
174
175/* THIS FILE IS GENERATED FROM objects.txt by objects.pl via the
176 * following command:
177 * perl objects.pl objects.txt obj_mac.num obj_mac.h
178 */
179
180#define SN_undef "UNDEF"
181#define LN_undef "undefined"
182#define NID_undef 0
183#define OBJ_undef 0L
184
185EOF
186
187foreach (sort { $a <=> $b } keys %ordern)
188 {
189 $Cname=$ordern{$_};
190 print OUT "#define SN_",$Cname,"\t\t\"",$sn{$Cname},"\"\n" if $sn{$Cname} ne "";
191 print OUT "#define LN_",$Cname,"\t\t\"",$ln{$Cname},"\"\n" if $ln{$Cname} ne "";
192 print OUT "#define NID_",$Cname,"\t\t",$nid{$Cname},"\n" if $nid{$Cname} ne "";
193 print OUT "#define OBJ_",$Cname,"\t\t",$obj{$Cname},"\n" if $obj{$Cname} ne "";
194 print OUT "\n";
195 }
196
197close OUT;
198
199sub process_oid
200 {
201 local($oid)=@_;
202 local(@a,$oid_pref);
203
204 @a = split(/\s+/,$myoid);
205 $pref_oid = "";
206 $pref_sep = "";
207 if (!($a[0] =~ /^[0-9]+$/))
208 {
209 $a[0] =~ s/-/_/g;
210 $pref_oid = "OBJ_" . $a[0];
211 $pref_sep = ",";
212 shift @a;
213 }
214 $oids = join('L,',@a) . "L";
215 if ($oids ne "L")
216 {
217 $oids = $pref_oid . $pref_sep . $oids;
218 }
219 else
220 {
221 $oids = $pref_oid;
222 }
223 return($oids);
224 }