From 46cc54541b5d870318861d524e82b3fc01287484 Mon Sep 17 00:00:00 2001 From: Sehong Na Date: Sat, 31 May 2014 12:54:49 +0900 Subject: [PATCH] Initialize Tizen 2.3 --- LICENSE | 33 + mozilla/dbm/.cvsignore | 1 + mozilla/dbm/Makefile.in | 0 mozilla/dbm/include/.cvsignore | 1 + mozilla/dbm/include/Makefile.in | 71 + mozilla/dbm/include/Makefile.win | 77 + mozilla/dbm/include/cdefs.h | 126 + mozilla/dbm/include/extern.h | 63 + mozilla/dbm/include/hash.h | 335 + mozilla/dbm/include/hsearch.h | 49 + mozilla/dbm/include/mcom_db.h | 413 + mozilla/dbm/include/mpool.h | 97 + mozilla/dbm/include/ncompat.h | 230 + mozilla/dbm/include/page.h | 94 + mozilla/dbm/include/queue.h | 243 + mozilla/dbm/include/search.h | 49 + mozilla/dbm/include/winfile.h | 112 + mozilla/dbm/src/.cvsignore | 1 + mozilla/dbm/src/Makefile.in | 95 + mozilla/dbm/src/Makefile.win | 113 + mozilla/dbm/src/db.c | 136 + mozilla/dbm/src/h_bigkey.c | 709 + mozilla/dbm/src/h_func.c | 207 + mozilla/dbm/src/h_log2.c | 52 + mozilla/dbm/src/h_page.c | 1286 + mozilla/dbm/src/hash.c | 1175 + mozilla/dbm/src/hash_buf.c | 410 + mozilla/dbm/src/memmove.c | 146 + mozilla/dbm/src/mktemp.c | 160 + mozilla/dbm/src/snprintf.c | 73 + mozilla/dbm/src/strerror.c | 74 + mozilla/dbm/tests/.cvsignore | 3 + mozilla/dbm/tests/Makefile.in | 62 + mozilla/dbm/tests/dbmtest.pkg | 2 + mozilla/dbm/tests/lots.c | 638 + mozilla/security/coreconf/AIX.mk | 99 + mozilla/security/coreconf/BSD_OS.mk | 89 + mozilla/security/coreconf/BeOS.mk | 79 + mozilla/security/coreconf/Darwin.mk | 139 + mozilla/security/coreconf/FreeBSD.mk | 90 + mozilla/security/coreconf/HP-UX.mk | 116 + mozilla/security/coreconf/HP-UXA.09.03.mk | 49 + mozilla/security/coreconf/HP-UXA.09.07.mk | 48 + mozilla/security/coreconf/HP-UXA.09.mk | 43 + mozilla/security/coreconf/HP-UXB.10.01.mk | 44 + mozilla/security/coreconf/HP-UXB.10.10.mk | 54 + mozilla/security/coreconf/HP-UXB.10.20.mk | 54 + mozilla/security/coreconf/HP-UXB.10.30.mk | 60 + mozilla/security/coreconf/HP-UXB.10.mk | 40 + mozilla/security/coreconf/HP-UXB.11.00.mk | 49 + mozilla/security/coreconf/HP-UXB.11.11.mk | 49 + mozilla/security/coreconf/HP-UXB.11.20.mk | 49 + mozilla/security/coreconf/HP-UXB.11.22.mk | 49 + mozilla/security/coreconf/HP-UXB.11.23.mk | 49 + mozilla/security/coreconf/HP-UXB.11.mk | 80 + mozilla/security/coreconf/IRIX.mk | 126 + mozilla/security/coreconf/IRIX5.2.mk | 37 + mozilla/security/coreconf/IRIX5.3.mk | 39 + mozilla/security/coreconf/IRIX5.mk | 42 + mozilla/security/coreconf/IRIX6.2.mk | 45 + mozilla/security/coreconf/IRIX6.3.mk | 44 + mozilla/security/coreconf/IRIX6.5.mk | 47 + mozilla/security/coreconf/IRIX6.mk | 49 + mozilla/security/coreconf/Linux.mk | 194 + mozilla/security/coreconf/Linux2.1.mk | 48 + mozilla/security/coreconf/Linux2.2.mk | 48 + mozilla/security/coreconf/Linux2.4.mk | 53 + mozilla/security/coreconf/Linux2.5.mk | 48 + mozilla/security/coreconf/Linux2.6.mk | 48 + mozilla/security/coreconf/LinuxELF1.2.mk | 38 + mozilla/security/coreconf/LinuxELF2.0.mk | 38 + mozilla/security/coreconf/Makefile | 47 + mozilla/security/coreconf/NCR3.0.mk | 97 + mozilla/security/coreconf/NEC4.2.mk | 68 + mozilla/security/coreconf/NetBSD.mk | 87 + mozilla/security/coreconf/OS2.mk | 188 + mozilla/security/coreconf/OSF1.mk | 80 + mozilla/security/coreconf/OSF1V2.0.mk | 37 + mozilla/security/coreconf/OSF1V3.0.mk | 37 + mozilla/security/coreconf/OSF1V3.2.mk | 48 + mozilla/security/coreconf/OSF1V4.0.mk | 56 + mozilla/security/coreconf/OSF1V4.0B.mk | 37 + mozilla/security/coreconf/OSF1V4.0D.mk | 41 + mozilla/security/coreconf/OSF1V5.0.mk | 52 + mozilla/security/coreconf/OSF1V5.1.mk | 52 + mozilla/security/coreconf/OpenBSD.mk | 73 + mozilla/security/coreconf/OpenUNIX.mk | 92 + mozilla/security/coreconf/QNX.mk | 71 + mozilla/security/coreconf/README | 561 + mozilla/security/coreconf/RISCOS.mk | 55 + mozilla/security/coreconf/ReliantUNIX.mk | 90 + mozilla/security/coreconf/ReliantUNIX5.4.mk | 37 + mozilla/security/coreconf/SCOOS5.0.mk | 38 + mozilla/security/coreconf/SCO_SV3.2.mk | 92 + mozilla/security/coreconf/SunOS4.1.3_U1.mk | 60 + mozilla/security/coreconf/SunOS5.10.mk | 46 + mozilla/security/coreconf/SunOS5.10_i86pc.mk | 53 + mozilla/security/coreconf/SunOS5.11.mk | 46 + mozilla/security/coreconf/SunOS5.11_i86pc.mk | 53 + mozilla/security/coreconf/SunOS5.3.mk | 40 + mozilla/security/coreconf/SunOS5.4.mk | 40 + mozilla/security/coreconf/SunOS5.4_i86pc.mk | 69 + mozilla/security/coreconf/SunOS5.5.1.mk | 46 + mozilla/security/coreconf/SunOS5.5.1_i86pc.mk | 48 + mozilla/security/coreconf/SunOS5.5.mk | 44 + mozilla/security/coreconf/SunOS5.6.mk | 46 + mozilla/security/coreconf/SunOS5.6_i86pc.mk | 48 + mozilla/security/coreconf/SunOS5.7.mk | 46 + mozilla/security/coreconf/SunOS5.7_i86pc.mk | 50 + mozilla/security/coreconf/SunOS5.8.mk | 46 + mozilla/security/coreconf/SunOS5.8_i86pc.mk | 50 + mozilla/security/coreconf/SunOS5.9.mk | 46 + mozilla/security/coreconf/SunOS5.9_i86pc.mk | 50 + mozilla/security/coreconf/SunOS5.mk | 180 + mozilla/security/coreconf/UNIX.mk | 96 + mozilla/security/coreconf/UNIXWARE2.1.mk | 61 + mozilla/security/coreconf/WIN32.mk | 389 + mozilla/security/coreconf/WIN95.mk | 47 + mozilla/security/coreconf/WINCE.mk | 214 + mozilla/security/coreconf/WINNT.mk | 52 + mozilla/security/coreconf/arch.mk | 341 + mozilla/security/coreconf/command.mk | 72 + mozilla/security/coreconf/config.mk | 209 + mozilla/security/coreconf/coreconf.dep | 45 + mozilla/security/coreconf/coreconf.pl | 160 + mozilla/security/coreconf/cpdist.pl | 199 + mozilla/security/coreconf/headers.mk | 56 + mozilla/security/coreconf/import.pl | 221 + mozilla/security/coreconf/jdk.mk | 536 + mozilla/security/coreconf/jniregen.pl | 111 + mozilla/security/coreconf/location.mk | 106 + mozilla/security/coreconf/mkdepend/Makefile | 93 + mozilla/security/coreconf/mkdepend/cppsetup.c | 233 + mozilla/security/coreconf/mkdepend/def.h | 184 + mozilla/security/coreconf/mkdepend/ifparser.c | 551 + mozilla/security/coreconf/mkdepend/ifparser.h | 83 + mozilla/security/coreconf/mkdepend/imakemdep.h | 782 + mozilla/security/coreconf/mkdepend/include.c | 337 + mozilla/security/coreconf/mkdepend/main.c | 870 + mozilla/security/coreconf/mkdepend/mkdepend.man | 382 + mozilla/security/coreconf/mkdepend/parse.c | 686 + mozilla/security/coreconf/mkdepend/pr.c | 124 + mozilla/security/coreconf/module.mk | 69 + mozilla/security/coreconf/nsinstall/Makefile | 74 + mozilla/security/coreconf/nsinstall/nsinstall.c | 439 + mozilla/security/coreconf/nsinstall/pathsub.c | 306 + mozilla/security/coreconf/nsinstall/pathsub.h | 80 + mozilla/security/coreconf/nsinstall/sunos4.h | 166 + mozilla/security/coreconf/outofdate.pl | 71 + mozilla/security/coreconf/prefix.mk | 76 + mozilla/security/coreconf/release.pl | 144 + mozilla/security/coreconf/rules.mk | 994 + mozilla/security/coreconf/ruleset.mk | 250 + mozilla/security/coreconf/source.mk | 194 + mozilla/security/coreconf/suffix.mk | 99 + mozilla/security/coreconf/tree.mk | 84 + mozilla/security/coreconf/version.mk | 109 + mozilla/security/coreconf/version.pl | 80 + mozilla/security/dbm/Makefile | 88 + mozilla/security/dbm/config/config.mk | 71 + mozilla/security/dbm/include/Makefile | 80 + mozilla/security/dbm/include/manifest.mn | 59 + mozilla/security/dbm/manifest.mn | 49 + mozilla/security/dbm/src/Makefile | 80 + mozilla/security/dbm/src/config.mk | 67 + mozilla/security/dbm/src/dirent.c | 348 + mozilla/security/dbm/src/dirent.h | 97 + mozilla/security/dbm/src/manifest.mn | 62 + mozilla/security/dbm/tests/Makefile | 73 + mozilla/security/nss/Makefile | 185 + mozilla/security/nss/cmd/.cvsignore | 1 + mozilla/security/nss/cmd/Makefile | 57 + mozilla/security/nss/cmd/addbuiltin/Makefile | 80 + mozilla/security/nss/cmd/addbuiltin/addbuiltin.c | 391 + mozilla/security/nss/cmd/addbuiltin/manifest.mn | 52 + mozilla/security/nss/cmd/atob/Makefile | 80 + mozilla/security/nss/cmd/atob/atob.c | 180 + mozilla/security/nss/cmd/atob/manifest.mn | 54 + mozilla/security/nss/cmd/bltest/Makefile | 86 + mozilla/security/nss/cmd/bltest/blapitest.c | 3971 + mozilla/security/nss/cmd/bltest/manifest.mn | 58 + mozilla/security/nss/cmd/bltest/tests/README | 49 + .../nss/cmd/bltest/tests/aes_cbc/ciphertext0 | 1 + mozilla/security/nss/cmd/bltest/tests/aes_cbc/iv0 | 1 + mozilla/security/nss/cmd/bltest/tests/aes_cbc/key0 | 1 + .../security/nss/cmd/bltest/tests/aes_cbc/numtests | 1 + .../nss/cmd/bltest/tests/aes_cbc/plaintext0 | 1 + .../nss/cmd/bltest/tests/aes_ecb/ciphertext0 | 1 + mozilla/security/nss/cmd/bltest/tests/aes_ecb/key0 | 1 + .../security/nss/cmd/bltest/tests/aes_ecb/numtests | 1 + .../nss/cmd/bltest/tests/aes_ecb/plaintext0 | 1 + .../nss/cmd/bltest/tests/camellia_cbc/ciphertext0 | 1 + .../nss/cmd/bltest/tests/camellia_cbc/ciphertext1 | 1 + .../nss/cmd/bltest/tests/camellia_cbc/ciphertext2 | 1 + .../security/nss/cmd/bltest/tests/camellia_cbc/iv0 | 1 + .../nss/cmd/bltest/tests/camellia_cbc/key0 | 1 + .../nss/cmd/bltest/tests/camellia_cbc/key1 | 1 + .../nss/cmd/bltest/tests/camellia_cbc/key2 | 1 + .../nss/cmd/bltest/tests/camellia_cbc/numtests | 1 + .../nss/cmd/bltest/tests/camellia_cbc/plaintext0 | 1 + .../nss/cmd/bltest/tests/camellia_ecb/ciphertext0 | 1 + .../nss/cmd/bltest/tests/camellia_ecb/ciphertext1 | 1 + .../nss/cmd/bltest/tests/camellia_ecb/ciphertext2 | 1 + .../nss/cmd/bltest/tests/camellia_ecb/key0 | 1 + .../nss/cmd/bltest/tests/camellia_ecb/key1 | 1 + .../nss/cmd/bltest/tests/camellia_ecb/key2 | 1 + .../nss/cmd/bltest/tests/camellia_ecb/numtests | 1 + .../nss/cmd/bltest/tests/camellia_ecb/plaintext0 | 1 + .../nss/cmd/bltest/tests/des3_cbc/ciphertext0 | 1 + mozilla/security/nss/cmd/bltest/tests/des3_cbc/iv0 | 1 + .../security/nss/cmd/bltest/tests/des3_cbc/key0 | 1 + .../nss/cmd/bltest/tests/des3_cbc/numtests | 1 + .../nss/cmd/bltest/tests/des3_cbc/plaintext0 | 1 + .../nss/cmd/bltest/tests/des3_ecb/ciphertext0 | 1 + .../security/nss/cmd/bltest/tests/des3_ecb/key0 | 1 + .../nss/cmd/bltest/tests/des3_ecb/numtests | 1 + .../nss/cmd/bltest/tests/des3_ecb/plaintext0 | 1 + .../nss/cmd/bltest/tests/des_cbc/ciphertext0 | 1 + mozilla/security/nss/cmd/bltest/tests/des_cbc/iv0 | 1 + mozilla/security/nss/cmd/bltest/tests/des_cbc/key0 | 1 + .../security/nss/cmd/bltest/tests/des_cbc/numtests | 1 + .../nss/cmd/bltest/tests/des_cbc/plaintext0 | 1 + .../nss/cmd/bltest/tests/des_ecb/ciphertext0 | 1 + mozilla/security/nss/cmd/bltest/tests/des_ecb/key0 | 1 + .../security/nss/cmd/bltest/tests/des_ecb/numtests | 1 + .../nss/cmd/bltest/tests/des_ecb/plaintext0 | 1 + .../security/nss/cmd/bltest/tests/dsa/ciphertext0 | 1 + mozilla/security/nss/cmd/bltest/tests/dsa/key0 | 6 + mozilla/security/nss/cmd/bltest/tests/dsa/keyseed0 | 1 + mozilla/security/nss/cmd/bltest/tests/dsa/numtests | 1 + .../security/nss/cmd/bltest/tests/dsa/plaintext0 | 1 + mozilla/security/nss/cmd/bltest/tests/dsa/pqg0 | 4 + mozilla/security/nss/cmd/bltest/tests/dsa/sigseed0 | 1 + mozilla/security/nss/cmd/bltest/tests/ecdsa/README | 22 + .../nss/cmd/bltest/tests/ecdsa/ciphertext0 | 1 + .../nss/cmd/bltest/tests/ecdsa/ciphertext1 | 1 + .../nss/cmd/bltest/tests/ecdsa/ciphertext10 | 2 + .../nss/cmd/bltest/tests/ecdsa/ciphertext11 | 2 + .../nss/cmd/bltest/tests/ecdsa/ciphertext12 | 2 + .../nss/cmd/bltest/tests/ecdsa/ciphertext13 | 2 + .../nss/cmd/bltest/tests/ecdsa/ciphertext14 | 2 + .../nss/cmd/bltest/tests/ecdsa/ciphertext15 | 2 + .../nss/cmd/bltest/tests/ecdsa/ciphertext16 | 3 + .../nss/cmd/bltest/tests/ecdsa/ciphertext17 | 3 + .../nss/cmd/bltest/tests/ecdsa/ciphertext18 | 3 + .../nss/cmd/bltest/tests/ecdsa/ciphertext19 | 3 + .../nss/cmd/bltest/tests/ecdsa/ciphertext2 | 1 + .../nss/cmd/bltest/tests/ecdsa/ciphertext20 | 3 + .../nss/cmd/bltest/tests/ecdsa/ciphertext3 | 1 + .../nss/cmd/bltest/tests/ecdsa/ciphertext4 | 1 + .../nss/cmd/bltest/tests/ecdsa/ciphertext5 | 1 + .../nss/cmd/bltest/tests/ecdsa/ciphertext6 | 1 + .../nss/cmd/bltest/tests/ecdsa/ciphertext7 | 1 + .../nss/cmd/bltest/tests/ecdsa/ciphertext8 | 2 + .../nss/cmd/bltest/tests/ecdsa/ciphertext9 | 2 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key0 | 2 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key1 | 2 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key10 | 3 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key11 | 3 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key12 | 3 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key13 | 3 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key14 | 3 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key15 | 4 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key16 | 4 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key17 | 4 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key18 | 5 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key19 | 5 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key2 | 2 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key20 | 5 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key3 | 2 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key4 | 2 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key5 | 2 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key6 | 2 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key7 | 2 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key8 | 3 + mozilla/security/nss/cmd/bltest/tests/ecdsa/key9 | 3 + .../security/nss/cmd/bltest/tests/ecdsa/numtests | 1 + .../security/nss/cmd/bltest/tests/ecdsa/plaintext0 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/plaintext1 | 1 + .../nss/cmd/bltest/tests/ecdsa/plaintext10 | 1 + .../nss/cmd/bltest/tests/ecdsa/plaintext11 | 1 + .../nss/cmd/bltest/tests/ecdsa/plaintext12 | 1 + .../nss/cmd/bltest/tests/ecdsa/plaintext13 | 1 + .../nss/cmd/bltest/tests/ecdsa/plaintext14 | 1 + .../nss/cmd/bltest/tests/ecdsa/plaintext15 | 1 + .../nss/cmd/bltest/tests/ecdsa/plaintext16 | 1 + .../nss/cmd/bltest/tests/ecdsa/plaintext17 | 1 + .../nss/cmd/bltest/tests/ecdsa/plaintext18 | 1 + .../nss/cmd/bltest/tests/ecdsa/plaintext19 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/plaintext2 | 1 + .../nss/cmd/bltest/tests/ecdsa/plaintext20 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/plaintext3 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/plaintext4 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/plaintext5 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/plaintext6 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/plaintext7 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/plaintext8 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/plaintext9 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed0 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed1 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed10 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed11 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed12 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed13 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed14 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed15 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed16 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed17 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed18 | 2 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed19 | 2 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed2 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed20 | 2 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed3 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed4 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed5 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed6 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed7 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed8 | 1 + .../security/nss/cmd/bltest/tests/ecdsa/sigseed9 | 1 + .../security/nss/cmd/bltest/tests/md2/ciphertext0 | 1 + mozilla/security/nss/cmd/bltest/tests/md2/numtests | 1 + .../security/nss/cmd/bltest/tests/md2/plaintext0 | 1 + .../security/nss/cmd/bltest/tests/md5/ciphertext0 | 1 + mozilla/security/nss/cmd/bltest/tests/md5/numtests | 1 + .../security/nss/cmd/bltest/tests/md5/plaintext0 | 1 + .../nss/cmd/bltest/tests/rc2_cbc/ciphertext0 | 1 + mozilla/security/nss/cmd/bltest/tests/rc2_cbc/iv0 | 1 + mozilla/security/nss/cmd/bltest/tests/rc2_cbc/key0 | 1 + .../security/nss/cmd/bltest/tests/rc2_cbc/numtests | 1 + .../nss/cmd/bltest/tests/rc2_cbc/plaintext0 | 1 + .../nss/cmd/bltest/tests/rc2_ecb/ciphertext0 | 1 + mozilla/security/nss/cmd/bltest/tests/rc2_ecb/key0 | 1 + .../security/nss/cmd/bltest/tests/rc2_ecb/numtests | 1 + .../nss/cmd/bltest/tests/rc2_ecb/plaintext0 | 1 + .../security/nss/cmd/bltest/tests/rc4/ciphertext0 | 1 + .../security/nss/cmd/bltest/tests/rc4/ciphertext1 | 1 + mozilla/security/nss/cmd/bltest/tests/rc4/key0 | 1 + mozilla/security/nss/cmd/bltest/tests/rc4/key1 | 1 + mozilla/security/nss/cmd/bltest/tests/rc4/numtests | 1 + .../security/nss/cmd/bltest/tests/rc4/plaintext0 | 1 + .../security/nss/cmd/bltest/tests/rc4/plaintext1 | 1 + .../nss/cmd/bltest/tests/rc5_cbc/ciphertext0 | 1 + mozilla/security/nss/cmd/bltest/tests/rc5_cbc/iv0 | 1 + mozilla/security/nss/cmd/bltest/tests/rc5_cbc/key0 | 1 + .../security/nss/cmd/bltest/tests/rc5_cbc/numtests | 1 + .../security/nss/cmd/bltest/tests/rc5_cbc/params0 | 2 + .../nss/cmd/bltest/tests/rc5_cbc/plaintext0 | 1 + .../nss/cmd/bltest/tests/rc5_ecb/ciphertext0 | 1 + mozilla/security/nss/cmd/bltest/tests/rc5_ecb/key0 | 1 + .../security/nss/cmd/bltest/tests/rc5_ecb/numtests | 1 + .../security/nss/cmd/bltest/tests/rc5_ecb/params0 | 2 + .../nss/cmd/bltest/tests/rc5_ecb/plaintext0 | 1 + .../security/nss/cmd/bltest/tests/rsa/ciphertext0 | 1 + mozilla/security/nss/cmd/bltest/tests/rsa/key0 | 4 + mozilla/security/nss/cmd/bltest/tests/rsa/numtests | 1 + .../security/nss/cmd/bltest/tests/rsa/plaintext0 | 1 + .../nss/cmd/bltest/tests/seed_cbc/ciphertext0 | 1 + mozilla/security/nss/cmd/bltest/tests/seed_cbc/iv0 | 1 + .../security/nss/cmd/bltest/tests/seed_cbc/key0 | 1 + .../nss/cmd/bltest/tests/seed_cbc/numtests | 1 + .../nss/cmd/bltest/tests/seed_cbc/plaintext0 | 1 + .../nss/cmd/bltest/tests/seed_ecb/ciphertext0 | 1 + mozilla/security/nss/cmd/bltest/tests/seed_ecb/iv0 | 1 + .../security/nss/cmd/bltest/tests/seed_ecb/key0 | 1 + .../nss/cmd/bltest/tests/seed_ecb/numtests | 1 + .../nss/cmd/bltest/tests/seed_ecb/plaintext0 | 1 + .../security/nss/cmd/bltest/tests/sha1/ciphertext0 | 1 + .../security/nss/cmd/bltest/tests/sha1/numtests | 1 + .../security/nss/cmd/bltest/tests/sha1/plaintext0 | 1 + .../nss/cmd/bltest/tests/sha256/ciphertext0 | 1 + .../nss/cmd/bltest/tests/sha256/ciphertext1 | 1 + .../security/nss/cmd/bltest/tests/sha256/numtests | 1 + .../nss/cmd/bltest/tests/sha256/plaintext0 | 1 + .../nss/cmd/bltest/tests/sha256/plaintext1 | 1 + .../nss/cmd/bltest/tests/sha384/ciphertext0 | 1 + .../nss/cmd/bltest/tests/sha384/ciphertext1 | 1 + .../security/nss/cmd/bltest/tests/sha384/numtests | 1 + .../nss/cmd/bltest/tests/sha384/plaintext0 | 1 + .../nss/cmd/bltest/tests/sha384/plaintext1 | 1 + .../nss/cmd/bltest/tests/sha512/ciphertext0 | 2 + .../nss/cmd/bltest/tests/sha512/ciphertext1 | 2 + .../security/nss/cmd/bltest/tests/sha512/numtests | 1 + .../nss/cmd/bltest/tests/sha512/plaintext0 | 1 + .../nss/cmd/bltest/tests/sha512/plaintext1 | 1 + mozilla/security/nss/cmd/btoa/Makefile | 79 + mozilla/security/nss/cmd/btoa/btoa.c | 213 + mozilla/security/nss/cmd/btoa/manifest.mn | 53 + mozilla/security/nss/cmd/certcgi/HOWTO.txt | 168 + mozilla/security/nss/cmd/certcgi/Makefile | 80 + mozilla/security/nss/cmd/certcgi/ca.html | 51 + mozilla/security/nss/cmd/certcgi/ca_form.html | 388 + mozilla/security/nss/cmd/certcgi/certcgi.c | 2408 + mozilla/security/nss/cmd/certcgi/index.html | 821 + mozilla/security/nss/cmd/certcgi/main.html | 108 + mozilla/security/nss/cmd/certcgi/manifest.mn | 54 + .../security/nss/cmd/certcgi/nscp_ext_form.html | 116 + .../security/nss/cmd/certcgi/stnd_ext_form.html | 250 + mozilla/security/nss/cmd/certutil/Makefile | 80 + mozilla/security/nss/cmd/certutil/certext.c | 1817 + mozilla/security/nss/cmd/certutil/certutil.c | 3102 + mozilla/security/nss/cmd/certutil/certutil.h | 82 + mozilla/security/nss/cmd/certutil/keystuff.c | 610 + mozilla/security/nss/cmd/certutil/manifest.mn | 57 + mozilla/security/nss/cmd/checkcert/Makefile | 80 + mozilla/security/nss/cmd/checkcert/checkcert.c | 591 + mozilla/security/nss/cmd/checkcert/manifest.mn | 51 + mozilla/security/nss/cmd/crlutil/Makefile | 85 + mozilla/security/nss/cmd/crlutil/crlgen.c | 1589 + mozilla/security/nss/cmd/crlutil/crlgen.h | 182 + mozilla/security/nss/cmd/crlutil/crlgen_lex.c | 1783 + .../security/nss/cmd/crlutil/crlgen_lex_fix.sed | 6 + mozilla/security/nss/cmd/crlutil/crlgen_lex_orig.l | 177 + mozilla/security/nss/cmd/crlutil/crlutil.c | 1089 + mozilla/security/nss/cmd/crlutil/manifest.mn | 57 + mozilla/security/nss/cmd/crmf-cgi/Makefile | 85 + mozilla/security/nss/cmd/crmf-cgi/config.mk | 48 + mozilla/security/nss/cmd/crmf-cgi/crmfcgi.c | 1122 + mozilla/security/nss/cmd/crmf-cgi/crmfcgi.html | 168 + mozilla/security/nss/cmd/crmf-cgi/manifest.mn | 65 + mozilla/security/nss/cmd/crmftest/Makefile | 96 + mozilla/security/nss/cmd/crmftest/config.mk | 47 + mozilla/security/nss/cmd/crmftest/manifest.mn | 57 + mozilla/security/nss/cmd/crmftest/testcrmf.c | 1710 + mozilla/security/nss/cmd/dbck/Makefile | 79 + mozilla/security/nss/cmd/dbck/dbck.c | 1385 + mozilla/security/nss/cmd/dbck/dbrecover.c | 702 + mozilla/security/nss/cmd/dbck/manifest.mn | 54 + mozilla/security/nss/cmd/dbtest/Makefile | 78 + mozilla/security/nss/cmd/dbtest/dbtest.c | 266 + mozilla/security/nss/cmd/dbtest/manifest.mn | 54 + mozilla/security/nss/cmd/derdump/Makefile | 80 + mozilla/security/nss/cmd/derdump/derdump.c | 137 + mozilla/security/nss/cmd/derdump/manifest.mn | 53 + mozilla/security/nss/cmd/digest/Makefile | 80 + mozilla/security/nss/cmd/digest/digest.c | 256 + mozilla/security/nss/cmd/digest/manifest.mn | 54 + mozilla/security/nss/cmd/fipstest/Makefile | 81 + mozilla/security/nss/cmd/fipstest/aes.sh | 94 + mozilla/security/nss/cmd/fipstest/dsa.sh | 34 + mozilla/security/nss/cmd/fipstest/ecdsa.sh | 29 + mozilla/security/nss/cmd/fipstest/fipstest.c | 5071 + mozilla/security/nss/cmd/fipstest/hmac.sh | 20 + mozilla/security/nss/cmd/fipstest/manifest.mn | 55 + mozilla/security/nss/cmd/fipstest/rng.sh | 19 + mozilla/security/nss/cmd/fipstest/rsa.sh | 20 + mozilla/security/nss/cmd/fipstest/sha.sh | 46 + mozilla/security/nss/cmd/fipstest/tdea.sh | 87 + mozilla/security/nss/cmd/lib/Makefile | 82 + mozilla/security/nss/cmd/lib/NSPRerrs.h | 153 + mozilla/security/nss/cmd/lib/SECerrs.h | 575 + mozilla/security/nss/cmd/lib/SSLerrs.h | 407 + mozilla/security/nss/cmd/lib/berparse.c | 407 + mozilla/security/nss/cmd/lib/config.mk | 51 + mozilla/security/nss/cmd/lib/derprint.c | 622 + mozilla/security/nss/cmd/lib/ffs.c | 51 + mozilla/security/nss/cmd/lib/manifest.mn | 65 + mozilla/security/nss/cmd/lib/moreoids.c | 180 + mozilla/security/nss/cmd/lib/pk11table.c | 1449 + mozilla/security/nss/cmd/lib/pk11table.h | 212 + mozilla/security/nss/cmd/lib/pppolicy.c | 299 + mozilla/security/nss/cmd/lib/secerror.c | 110 + mozilla/security/nss/cmd/lib/secpwd.c | 199 + mozilla/security/nss/cmd/lib/secutil.c | 4201 + mozilla/security/nss/cmd/lib/secutil.h | 465 + mozilla/security/nss/cmd/lib/wincemain.c | 65 + mozilla/security/nss/cmd/libpkix/Makefile | 79 + mozilla/security/nss/cmd/libpkix/config.mk | 42 + mozilla/security/nss/cmd/libpkix/manifest.mn | 44 + mozilla/security/nss/cmd/libpkix/perf/Makefile | 79 + .../nss/cmd/libpkix/perf/libpkix_buildthreads.c | 382 + mozilla/security/nss/cmd/libpkix/perf/manifest.mn | 54 + .../security/nss/cmd/libpkix/perf/nss_threads.c | 197 + mozilla/security/nss/cmd/libpkix/pkix/Makefile | 81 + .../security/nss/cmd/libpkix/pkix/certsel/Makefile | 80 + .../nss/cmd/libpkix/pkix/certsel/manifest.mn | 54 + .../cmd/libpkix/pkix/certsel/test_certselector.c | 1992 + .../libpkix/pkix/certsel/test_comcertselparams.c | 953 + .../security/nss/cmd/libpkix/pkix/checker/Makefile | 80 + .../nss/cmd/libpkix/pkix/checker/manifest.mn | 52 + .../libpkix/pkix/checker/test_certchainchecker.c | 255 + .../security/nss/cmd/libpkix/pkix/crlsel/Makefile | 80 + .../nss/cmd/libpkix/pkix/crlsel/manifest.mn | 54 + .../cmd/libpkix/pkix/crlsel/test_comcrlselparams.c | 474 + .../nss/cmd/libpkix/pkix/crlsel/test_crlselector.c | 206 + mozilla/security/nss/cmd/libpkix/pkix/manifest.mn | 44 + .../security/nss/cmd/libpkix/pkix/params/Makefile | 80 + .../nss/cmd/libpkix/pkix/params/manifest.mn | 56 + .../nss/cmd/libpkix/pkix/params/test_buildparams.c | 212 + .../nss/cmd/libpkix/pkix/params/test_procparams.c | 552 + .../cmd/libpkix/pkix/params/test_resourcelimits.c | 147 + .../nss/cmd/libpkix/pkix/params/test_trustanchor.c | 295 + .../nss/cmd/libpkix/pkix/params/test_valparams.c | 301 + .../security/nss/cmd/libpkix/pkix/results/Makefile | 80 + .../nss/cmd/libpkix/pkix/results/manifest.mn | 56 + .../cmd/libpkix/pkix/results/test_buildresult.c | 251 + .../nss/cmd/libpkix/pkix/results/test_policynode.c | 712 + .../nss/cmd/libpkix/pkix/results/test_valresult.c | 240 + .../nss/cmd/libpkix/pkix/results/test_verifynode.c | 153 + .../security/nss/cmd/libpkix/pkix/store/Makefile | 80 + .../nss/cmd/libpkix/pkix/store/manifest.mn | 52 + .../nss/cmd/libpkix/pkix/store/test_store.c | 229 + mozilla/security/nss/cmd/libpkix/pkix/top/Makefile | 80 + .../security/nss/cmd/libpkix/pkix/top/manifest.mn | 66 + .../nss/cmd/libpkix/pkix/top/test_basicchecker.c | 276 + .../pkix/top/test_basicconstraintschecker.c | 177 + .../nss/cmd/libpkix/pkix/top/test_buildchain.c | 504 + .../pkix/top/test_buildchain_partialchain.c | 854 + .../pkix/top/test_buildchain_resourcelimits.c | 530 + .../libpkix/pkix/top/test_buildchain_uchecker.c | 406 + .../cmd/libpkix/pkix/top/test_customcrlchecker.c | 497 + .../pkix/top/test_defaultcrlchecker2stores.c | 274 + .../security/nss/cmd/libpkix/pkix/top/test_ocsp.c | 349 + .../nss/cmd/libpkix/pkix/top/test_policychecker.c | 595 + .../cmd/libpkix/pkix/top/test_subjaltnamechecker.c | 299 + .../nss/cmd/libpkix/pkix/top/test_validatechain.c | 265 + .../cmd/libpkix/pkix/top/test_validatechain_NB.c | 402 + .../cmd/libpkix/pkix/top/test_validatechain_bc.c | 289 + .../security/nss/cmd/libpkix/pkix/util/Makefile | 80 + .../security/nss/cmd/libpkix/pkix/util/manifest.mn | 56 + .../nss/cmd/libpkix/pkix/util/test_error.c | 450 + .../security/nss/cmd/libpkix/pkix/util/test_list.c | 878 + .../nss/cmd/libpkix/pkix/util/test_list2.c | 154 + .../nss/cmd/libpkix/pkix/util/test_logger.c | 366 + mozilla/security/nss/cmd/libpkix/pkix_pl/Makefile | 81 + .../security/nss/cmd/libpkix/pkix_pl/manifest.mn | 44 + .../nss/cmd/libpkix/pkix_pl/module/Makefile | 80 + .../nss/cmd/libpkix/pkix_pl/module/manifest.mn | 57 + .../cmd/libpkix/pkix_pl/module/test_colcertstore.c | 285 + .../cmd/libpkix/pkix_pl/module/test_ekuchecker.c | 321 + .../libpkix/pkix_pl/module/test_httpcertstore.c | 324 + .../libpkix/pkix_pl/module/test_pk11certstore.c | 664 + .../nss/cmd/libpkix/pkix_pl/module/test_socket.c | 600 + .../security/nss/cmd/libpkix/pkix_pl/pki/Makefile | 80 + .../nss/cmd/libpkix/pkix_pl/pki/manifest.mn | 61 + .../libpkix/pkix_pl/pki/test_authorityinfoaccess.c | 148 + .../nss/cmd/libpkix/pkix_pl/pki/test_cert.c | 2360 + .../nss/cmd/libpkix/pkix_pl/pki/test_crl.c | 341 + .../nss/cmd/libpkix/pkix_pl/pki/test_crlentry.c | 244 + .../nss/cmd/libpkix/pkix_pl/pki/test_date.c | 141 + .../nss/cmd/libpkix/pkix_pl/pki/test_generalname.c | 155 + .../cmd/libpkix/pkix_pl/pki/test_nameconstraints.c | 157 + .../libpkix/pkix_pl/pki/test_subjectinfoaccess.c | 166 + .../nss/cmd/libpkix/pkix_pl/pki/test_x500name.c | 210 + .../nss/cmd/libpkix/pkix_pl/system/Makefile | 80 + .../nss/cmd/libpkix/pkix_pl/system/manifest.mn | 71 + .../nss/cmd/libpkix/pkix_pl/system/stress_test.c | 188 + .../nss/cmd/libpkix/pkix_pl/system/test_bigint.c | 227 + .../cmd/libpkix/pkix_pl/system/test_bytearray.c | 274 + .../cmd/libpkix/pkix_pl/system/test_hashtable.c | 458 + .../nss/cmd/libpkix/pkix_pl/system/test_mem.c | 164 + .../cmd/libpkix/pkix_pl/system/test_monitorlock.c | 144 + .../nss/cmd/libpkix/pkix_pl/system/test_mutex.c | 136 + .../nss/cmd/libpkix/pkix_pl/system/test_mutex2.c | 193 + .../nss/cmd/libpkix/pkix_pl/system/test_mutex3.c | 127 + .../nss/cmd/libpkix/pkix_pl/system/test_object.c | 322 + .../nss/cmd/libpkix/pkix_pl/system/test_oid.c | 246 + .../nss/cmd/libpkix/pkix_pl/system/test_rwlock.c | 227 + .../nss/cmd/libpkix/pkix_pl/system/test_string.c | 479 + .../nss/cmd/libpkix/pkix_pl/system/test_string2.c | 375 + mozilla/security/nss/cmd/libpkix/pkixlibs.mk | 60 + mozilla/security/nss/cmd/libpkix/pkixrules.mk | 40 + mozilla/security/nss/cmd/libpkix/pkixutil/Makefile | 75 + .../security/nss/cmd/libpkix/pkixutil/manifest.mn | 73 + .../security/nss/cmd/libpkix/pkixutil/pkixutil.c | 335 + .../security/nss/cmd/libpkix/sample_apps/Makefile | 79 + .../nss/cmd/libpkix/sample_apps/build_chain.c | 298 + .../nss/cmd/libpkix/sample_apps/dumpcert.c | 217 + .../security/nss/cmd/libpkix/sample_apps/dumpcrl.c | 220 + .../nss/cmd/libpkix/sample_apps/manifest.mn | 56 + .../nss/cmd/libpkix/sample_apps/validate_chain.c | 267 + mozilla/security/nss/cmd/libpkix/testutil/Makefile | 84 + .../security/nss/cmd/libpkix/testutil/config.mk | 48 + .../security/nss/cmd/libpkix/testutil/manifest.mn | 59 + .../security/nss/cmd/libpkix/testutil/pkixutil.def | 81 + .../security/nss/cmd/libpkix/testutil/testutil.c | 619 + .../security/nss/cmd/libpkix/testutil/testutil.h | 337 + .../nss/cmd/libpkix/testutil/testutil_nss.c | 663 + .../nss/cmd/libpkix/testutil/testutil_nss.h | 153 + mozilla/security/nss/cmd/makepqg/Makefile | 81 + mozilla/security/nss/cmd/makepqg/makepqg.c | 363 + mozilla/security/nss/cmd/makepqg/manifest.mn | 51 + mozilla/security/nss/cmd/makepqg/testit.ksh | 45 + mozilla/security/nss/cmd/manifest.mn | 98 + mozilla/security/nss/cmd/modutil/Makefile | 90 + mozilla/security/nss/cmd/modutil/README | 7 + mozilla/security/nss/cmd/modutil/error.h | 189 + mozilla/security/nss/cmd/modutil/install-ds.c | 1544 + mozilla/security/nss/cmd/modutil/install-ds.h | 293 + mozilla/security/nss/cmd/modutil/install.c | 988 + mozilla/security/nss/cmd/modutil/install.h | 133 + mozilla/security/nss/cmd/modutil/installparse.c | 429 + mozilla/security/nss/cmd/modutil/installparse.h | 3 + mozilla/security/nss/cmd/modutil/installparse.l | 169 + mozilla/security/nss/cmd/modutil/installparse.y | 136 + mozilla/security/nss/cmd/modutil/instsec.c | 181 + .../security/nss/cmd/modutil/lex.Pk11Install_yy.c | 1694 + mozilla/security/nss/cmd/modutil/manifest.mn | 66 + mozilla/security/nss/cmd/modutil/modutil.c | 979 + mozilla/security/nss/cmd/modutil/modutil.h | 70 + mozilla/security/nss/cmd/modutil/pk11.c | 983 + mozilla/security/nss/cmd/modutil/pk11jar.html | 311 + mozilla/security/nss/cmd/modutil/rules.mk | 58 + .../security/nss/cmd/modutil/specification.html | 354 + mozilla/security/nss/cmd/multinit/Makefile | 79 + mozilla/security/nss/cmd/multinit/manifest.mn | 45 + mozilla/security/nss/cmd/multinit/multinit.c | 940 + mozilla/security/nss/cmd/ocspclnt/Makefile | 77 + mozilla/security/nss/cmd/ocspclnt/manifest.mn | 58 + mozilla/security/nss/cmd/ocspclnt/ocspclnt.c | 1293 + mozilla/security/nss/cmd/oidcalc/Makefile | 80 + mozilla/security/nss/cmd/oidcalc/manifest.mn | 51 + mozilla/security/nss/cmd/oidcalc/oidcalc.c | 120 + mozilla/security/nss/cmd/p7content/Makefile | 79 + mozilla/security/nss/cmd/p7content/manifest.mn | 47 + mozilla/security/nss/cmd/p7content/p7content.c | 287 + mozilla/security/nss/cmd/p7env/Makefile | 79 + mozilla/security/nss/cmd/p7env/manifest.mn | 47 + mozilla/security/nss/cmd/p7env/p7env.c | 273 + mozilla/security/nss/cmd/p7sign/Makefile | 79 + mozilla/security/nss/cmd/p7sign/manifest.mn | 47 + mozilla/security/nss/cmd/p7sign/p7sign.c | 309 + mozilla/security/nss/cmd/p7verify/Makefile | 79 + mozilla/security/nss/cmd/p7verify/manifest.mn | 47 + mozilla/security/nss/cmd/p7verify/p7verify.c | 308 + mozilla/security/nss/cmd/pk11mode/Makefile | 97 + mozilla/security/nss/cmd/pk11mode/manifest.mn | 48 + mozilla/security/nss/cmd/pk11mode/pk11mode.c | 5336 + mozilla/security/nss/cmd/pk11util/Makefile | 80 + mozilla/security/nss/cmd/pk11util/manifest.mn | 55 + mozilla/security/nss/cmd/pk11util/pk11util.c | 2192 + mozilla/security/nss/cmd/pk11util/scripts/dosign | 162 + mozilla/security/nss/cmd/pk11util/scripts/hssign | 48 + mozilla/security/nss/cmd/pk11util/scripts/lcert | 35 + .../security/nss/cmd/pk11util/scripts/mechanisms | 11 + mozilla/security/nss/cmd/pk11util/scripts/pLabel1 | 6 + .../security/nss/cmd/pk11util/scripts/pMechanisms | 8 + mozilla/security/nss/cmd/pk11util/scripts/pcert | 30 + mozilla/security/nss/cmd/pk12util/Makefile | 80 + mozilla/security/nss/cmd/pk12util/manifest.mn | 55 + mozilla/security/nss/cmd/pk12util/pk12util.c | 1140 + mozilla/security/nss/cmd/pk12util/pk12util.h | 73 + mozilla/security/nss/cmd/platlibs.mk | 251 + mozilla/security/nss/cmd/platrules.mk | 51 + mozilla/security/nss/cmd/pp/Makefile | 79 + mozilla/security/nss/cmd/pp/manifest.mn | 51 + mozilla/security/nss/cmd/pp/pp.c | 190 + mozilla/security/nss/cmd/pwdecrypt/Makefile | 77 + mozilla/security/nss/cmd/pwdecrypt/manifest.mn | 58 + mozilla/security/nss/cmd/pwdecrypt/pwdecrypt.c | 368 + mozilla/security/nss/cmd/rsaperf/Makefile | 78 + mozilla/security/nss/cmd/rsaperf/defkey.c | 325 + mozilla/security/nss/cmd/rsaperf/manifest.mn | 56 + mozilla/security/nss/cmd/rsaperf/rsaperf.c | 714 + mozilla/security/nss/cmd/rsapoptst/Makefile | 86 + mozilla/security/nss/cmd/rsapoptst/manifest.mn | 54 + mozilla/security/nss/cmd/rsapoptst/rsapoptst.c | 550 + mozilla/security/nss/cmd/samples/cert | 15 + mozilla/security/nss/cmd/samples/cert0 | Bin 0 -> 505 bytes mozilla/security/nss/cmd/samples/cert1 | Bin 0 -> 515 bytes mozilla/security/nss/cmd/samples/cert2 | Bin 0 -> 528 bytes mozilla/security/nss/cmd/samples/pkcs7.ber | Bin 0 -> 1771 bytes mozilla/security/nss/cmd/samples/pkcs7bday.ber | Bin 0 -> 1881 bytes mozilla/security/nss/cmd/samples/pkcs7cnet.ber | Bin 0 -> 3330 bytes mozilla/security/nss/cmd/samples/pkcs7news.ber | Bin 0 -> 255328 bytes mozilla/security/nss/cmd/samples/x509v3.der | Bin 0 -> 463 bytes mozilla/security/nss/cmd/samples/x509v3.txt | 10 + mozilla/security/nss/cmd/sdrtest/Makefile | 77 + mozilla/security/nss/cmd/sdrtest/manifest.mn | 58 + mozilla/security/nss/cmd/sdrtest/sdrtest.c | 451 + mozilla/security/nss/cmd/selfserv/Makefile | 78 + mozilla/security/nss/cmd/selfserv/manifest.mn | 52 + mozilla/security/nss/cmd/selfserv/selfserv.c | 2435 + mozilla/security/nss/cmd/shlibsign/Makefile | 124 + mozilla/security/nss/cmd/shlibsign/mangle/Makefile | 97 + mozilla/security/nss/cmd/shlibsign/mangle/mangle.c | 175 + .../security/nss/cmd/shlibsign/mangle/manifest.mn | 56 + mozilla/security/nss/cmd/shlibsign/manifest.mn | 62 + mozilla/security/nss/cmd/shlibsign/shlibsign.c | 1123 + mozilla/security/nss/cmd/shlibsign/sign.cmd | 21 + mozilla/security/nss/cmd/shlibsign/sign.sh | 40 + mozilla/security/nss/cmd/signtool/Makefile | 81 + mozilla/security/nss/cmd/signtool/README | 128 + mozilla/security/nss/cmd/signtool/certgen.c | 741 + mozilla/security/nss/cmd/signtool/javascript.c | 1867 + mozilla/security/nss/cmd/signtool/list.c | 251 + mozilla/security/nss/cmd/signtool/manifest.mn | 57 + mozilla/security/nss/cmd/signtool/sign.c | 869 + mozilla/security/nss/cmd/signtool/signtool.c | 1108 + mozilla/security/nss/cmd/signtool/signtool.h | 146 + mozilla/security/nss/cmd/signtool/util.c | 1131 + mozilla/security/nss/cmd/signtool/verify.c | 371 + mozilla/security/nss/cmd/signtool/zip.c | 721 + mozilla/security/nss/cmd/signtool/zip.h | 103 + mozilla/security/nss/cmd/signver/Makefile | 75 + .../security/nss/cmd/signver/examples/1/form.pl | 54 + .../nss/cmd/signver/examples/1/signedForm.html | 87 + .../nss/cmd/signver/examples/1/signedForm.nt.html | 87 + .../nss/cmd/signver/examples/1/signedForm.pl | 92 + mozilla/security/nss/cmd/signver/manifest.mn | 56 + mozilla/security/nss/cmd/signver/pk7print.c | 900 + mozilla/security/nss/cmd/signver/signver.c | 347 + mozilla/security/nss/cmd/smimetools/Makefile | 81 + mozilla/security/nss/cmd/smimetools/cmsutil.c | 1651 + mozilla/security/nss/cmd/smimetools/manifest.mn | 49 + mozilla/security/nss/cmd/smimetools/rules.mk | 40 + mozilla/security/nss/cmd/smimetools/smime | 581 + mozilla/security/nss/cmd/ssltap/Makefile | 83 + mozilla/security/nss/cmd/ssltap/manifest.mn | 55 + mozilla/security/nss/cmd/ssltap/ssltap-manual.html | 202 + mozilla/security/nss/cmd/ssltap/ssltap.c | 1804 + mozilla/security/nss/cmd/strsclnt/Makefile | 79 + mozilla/security/nss/cmd/strsclnt/manifest.mn | 51 + mozilla/security/nss/cmd/strsclnt/strsclnt.c | 1574 + mozilla/security/nss/cmd/symkeyutil/Makefile | 80 + mozilla/security/nss/cmd/symkeyutil/manifest.mn | 55 + mozilla/security/nss/cmd/symkeyutil/symkey.man | 182 + mozilla/security/nss/cmd/symkeyutil/symkeyutil.c | 1135 + mozilla/security/nss/cmd/tests/Makefile | 77 + mozilla/security/nss/cmd/tests/baddbdir.c | 68 + mozilla/security/nss/cmd/tests/conflict.c | 58 + mozilla/security/nss/cmd/tests/dertimetest.c | 129 + mozilla/security/nss/cmd/tests/manifest.mn | 59 + mozilla/security/nss/cmd/tests/nonspr10.c | 121 + mozilla/security/nss/cmd/tests/remtest.c | 167 + mozilla/security/nss/cmd/tstclnt/Makefile | 78 + mozilla/security/nss/cmd/tstclnt/manifest.mn | 54 + mozilla/security/nss/cmd/tstclnt/tstclnt.c | 1121 + mozilla/security/nss/cmd/vfychain/Makefile | 78 + mozilla/security/nss/cmd/vfychain/manifest.mn | 55 + mozilla/security/nss/cmd/vfychain/vfychain.c | 793 + mozilla/security/nss/cmd/vfyserv/Makefile | 78 + mozilla/security/nss/cmd/vfyserv/manifest.mn | 55 + mozilla/security/nss/cmd/vfyserv/vfyserv.c | 594 + mozilla/security/nss/cmd/vfyserv/vfyserv.h | 180 + mozilla/security/nss/cmd/vfyserv/vfyutil.c | 665 + mozilla/security/nss/coverage/cov.sh | 163 + mozilla/security/nss/coverage/report.sh | 238 + mozilla/security/nss/lib/Makefile | 92 + mozilla/security/nss/lib/base/Makefile | 44 + mozilla/security/nss/lib/base/arena.c | 1158 + mozilla/security/nss/lib/base/base.h | 1430 + mozilla/security/nss/lib/base/baset.h | 161 + mozilla/security/nss/lib/base/config.mk | 52 + mozilla/security/nss/lib/base/error.c | 305 + mozilla/security/nss/lib/base/errorval.c | 98 + mozilla/security/nss/lib/base/hash.c | 409 + mozilla/security/nss/lib/base/hashops.c | 120 + mozilla/security/nss/lib/base/item.c | 244 + mozilla/security/nss/lib/base/libc.c | 200 + mozilla/security/nss/lib/base/list.c | 437 + mozilla/security/nss/lib/base/manifest.mn | 71 + mozilla/security/nss/lib/base/nssbase.h | 170 + mozilla/security/nss/lib/base/nssbaset.h | 155 + mozilla/security/nss/lib/base/tracker.c | 447 + mozilla/security/nss/lib/base/utf8.c | 762 + mozilla/security/nss/lib/certdb/.cvsignore | 1 + mozilla/security/nss/lib/certdb/Makefile | 80 + mozilla/security/nss/lib/certdb/alg1485.c | 1578 + mozilla/security/nss/lib/certdb/cert.h | 1691 + mozilla/security/nss/lib/certdb/certdb.c | 3255 + mozilla/security/nss/lib/certdb/certdb.h | 97 + mozilla/security/nss/lib/certdb/certi.h | 394 + mozilla/security/nss/lib/certdb/certt.h | 1321 + mozilla/security/nss/lib/certdb/certv3.c | 399 + mozilla/security/nss/lib/certdb/certxutl.c | 531 + mozilla/security/nss/lib/certdb/certxutl.h | 82 + mozilla/security/nss/lib/certdb/config.mk | 47 + mozilla/security/nss/lib/certdb/crl.c | 3464 + mozilla/security/nss/lib/certdb/genname.c | 1998 + mozilla/security/nss/lib/certdb/genname.h | 138 + mozilla/security/nss/lib/certdb/manifest.mn | 74 + mozilla/security/nss/lib/certdb/polcyxtn.c | 860 + mozilla/security/nss/lib/certdb/secname.c | 742 + mozilla/security/nss/lib/certdb/stanpcertdb.c | 1086 + mozilla/security/nss/lib/certdb/xauthkid.c | 160 + mozilla/security/nss/lib/certdb/xbsconst.c | 177 + mozilla/security/nss/lib/certdb/xconst.c | 318 + mozilla/security/nss/lib/certdb/xconst.h | 68 + mozilla/security/nss/lib/certhigh/Makefile | 80 + mozilla/security/nss/lib/certhigh/certhigh.c | 1225 + mozilla/security/nss/lib/certhigh/certhtml.c | 333 + mozilla/security/nss/lib/certhigh/certreq.c | 356 + mozilla/security/nss/lib/certhigh/certvfy.c | 1999 + mozilla/security/nss/lib/certhigh/certvfypkix.c | 2277 + .../security/nss/lib/certhigh/certvfypkixprint.c | 239 + mozilla/security/nss/lib/certhigh/config.mk | 47 + mozilla/security/nss/lib/certhigh/crlv2.c | 194 + mozilla/security/nss/lib/certhigh/manifest.mn | 68 + mozilla/security/nss/lib/certhigh/ocsp.c | 5724 + mozilla/security/nss/lib/certhigh/ocsp.h | 670 + mozilla/security/nss/lib/certhigh/ocspi.h | 172 + mozilla/security/nss/lib/certhigh/ocspt.h | 316 + mozilla/security/nss/lib/certhigh/ocspti.h | 409 + mozilla/security/nss/lib/certhigh/xcrldist.c | 249 + mozilla/security/nss/lib/ckfw/Makefile | 72 + mozilla/security/nss/lib/ckfw/builtins/Makefile | 80 + mozilla/security/nss/lib/ckfw/builtins/README | 48 + mozilla/security/nss/lib/ckfw/builtins/anchor.c | 53 + mozilla/security/nss/lib/ckfw/builtins/bfind.c | 286 + mozilla/security/nss/lib/ckfw/builtins/binst.c | 138 + mozilla/security/nss/lib/ckfw/builtins/bobject.c | 258 + mozilla/security/nss/lib/ckfw/builtins/bsession.c | 111 + mozilla/security/nss/lib/ckfw/builtins/bslot.c | 127 + mozilla/security/nss/lib/ckfw/builtins/btoken.c | 187 + mozilla/security/nss/lib/ckfw/builtins/builtins.h | 108 + mozilla/security/nss/lib/ckfw/builtins/certdata.c | 21318 ++++ .../security/nss/lib/ckfw/builtins/certdata.perl | 299 + .../security/nss/lib/ckfw/builtins/certdata.txt | 21638 ++++ mozilla/security/nss/lib/ckfw/builtins/ckbiver.c | 58 + mozilla/security/nss/lib/ckfw/builtins/config.mk | 67 + mozilla/security/nss/lib/ckfw/builtins/constants.c | 97 + mozilla/security/nss/lib/ckfw/builtins/manifest.mn | 63 + mozilla/security/nss/lib/ckfw/builtins/nssckbi.def | 58 + mozilla/security/nss/lib/ckfw/builtins/nssckbi.h | 92 + mozilla/security/nss/lib/ckfw/builtins/nssckbi.rc | 96 + mozilla/security/nss/lib/ckfw/capi/Makefile | 108 + mozilla/security/nss/lib/ckfw/capi/README | 7 + mozilla/security/nss/lib/ckfw/capi/anchor.c | 55 + mozilla/security/nss/lib/ckfw/capi/cfind.c | 618 + mozilla/security/nss/lib/ckfw/capi/cinst.c | 148 + mozilla/security/nss/lib/ckfw/capi/ckcapi.h | 309 + mozilla/security/nss/lib/ckfw/capi/ckcapiver.c | 59 + mozilla/security/nss/lib/ckfw/capi/cobject.c | 2346 + mozilla/security/nss/lib/ckfw/capi/config.mk | 67 + mozilla/security/nss/lib/ckfw/capi/constants.c | 98 + mozilla/security/nss/lib/ckfw/capi/crsa.c | 748 + mozilla/security/nss/lib/ckfw/capi/csession.c | 131 + mozilla/security/nss/lib/ckfw/capi/cslot.c | 129 + mozilla/security/nss/lib/ckfw/capi/ctoken.c | 246 + mozilla/security/nss/lib/ckfw/capi/manifest.mn | 66 + mozilla/security/nss/lib/ckfw/capi/nsscapi.def | 58 + mozilla/security/nss/lib/ckfw/capi/nsscapi.h | 75 + mozilla/security/nss/lib/ckfw/capi/nsscapi.rc | 96 + mozilla/security/nss/lib/ckfw/capi/staticobj.c | 77 + mozilla/security/nss/lib/ckfw/ck.api | 575 + mozilla/security/nss/lib/ckfw/ck.h | 124 + mozilla/security/nss/lib/ckfw/ckapi.perl | 515 + mozilla/security/nss/lib/ckfw/ckfw.h | 2462 + mozilla/security/nss/lib/ckfw/ckfwm.h | 164 + mozilla/security/nss/lib/ckfw/ckfwtm.h | 59 + mozilla/security/nss/lib/ckfw/ckmd.h | 68 + mozilla/security/nss/lib/ckfw/ckt.h | 40 + mozilla/security/nss/lib/ckfw/config.mk | 58 + mozilla/security/nss/lib/ckfw/crypto.c | 377 + mozilla/security/nss/lib/ckfw/dbm/Makefile | 42 + mozilla/security/nss/lib/ckfw/dbm/anchor.c | 53 + mozilla/security/nss/lib/ckfw/dbm/ckdbm.h | 284 + mozilla/security/nss/lib/ckfw/dbm/config.mk | 41 + mozilla/security/nss/lib/ckfw/dbm/db.c | 1068 + mozilla/security/nss/lib/ckfw/dbm/find.c | 169 + mozilla/security/nss/lib/ckfw/dbm/instance.c | 199 + mozilla/security/nss/lib/ckfw/dbm/manifest.mn | 58 + mozilla/security/nss/lib/ckfw/dbm/object.c | 207 + mozilla/security/nss/lib/ckfw/dbm/session.c | 301 + mozilla/security/nss/lib/ckfw/dbm/slot.c | 217 + mozilla/security/nss/lib/ckfw/dbm/token.c | 318 + mozilla/security/nss/lib/ckfw/find.c | 415 + mozilla/security/nss/lib/ckfw/hash.c | 337 + mozilla/security/nss/lib/ckfw/instance.c | 1372 + mozilla/security/nss/lib/ckfw/manifest.mn | 86 + mozilla/security/nss/lib/ckfw/mechanism.c | 1218 + mozilla/security/nss/lib/ckfw/mutex.c | 305 + mozilla/security/nss/lib/ckfw/nssck.api | 1890 + mozilla/security/nss/lib/ckfw/nssckepv.h | 42 + mozilla/security/nss/lib/ckfw/nssckft.h | 43 + mozilla/security/nss/lib/ckfw/nssckfw.h | 526 + mozilla/security/nss/lib/ckfw/nssckfwc.h | 1049 + mozilla/security/nss/lib/ckfw/nssckfwt.h | 146 + mozilla/security/nss/lib/ckfw/nssckg.h | 42 + mozilla/security/nss/lib/ckfw/nssckmdt.h | 1981 + mozilla/security/nss/lib/ckfw/nssckt.h | 45 + mozilla/security/nss/lib/ckfw/nssmkey/Makefile | 105 + mozilla/security/nss/lib/ckfw/nssmkey/README | 21 + mozilla/security/nss/lib/ckfw/nssmkey/ckmk.h | 236 + mozilla/security/nss/lib/ckfw/nssmkey/ckmkver.c | 59 + mozilla/security/nss/lib/ckfw/nssmkey/config.mk | 57 + mozilla/security/nss/lib/ckfw/nssmkey/manchor.c | 55 + mozilla/security/nss/lib/ckfw/nssmkey/manifest.mn | 66 + mozilla/security/nss/lib/ckfw/nssmkey/mconstants.c | 96 + mozilla/security/nss/lib/ckfw/nssmkey/mfind.c | 404 + mozilla/security/nss/lib/ckfw/nssmkey/minst.c | 148 + mozilla/security/nss/lib/ckfw/nssmkey/mobject.c | 1961 + mozilla/security/nss/lib/ckfw/nssmkey/mrsa.c | 547 + mozilla/security/nss/lib/ckfw/nssmkey/msession.c | 131 + mozilla/security/nss/lib/ckfw/nssmkey/mslot.c | 129 + mozilla/security/nss/lib/ckfw/nssmkey/mtoken.c | 246 + mozilla/security/nss/lib/ckfw/nssmkey/nssmkey.def | 58 + mozilla/security/nss/lib/ckfw/nssmkey/nssmkey.h | 75 + mozilla/security/nss/lib/ckfw/nssmkey/staticobj.c | 74 + mozilla/security/nss/lib/ckfw/object.c | 1059 + mozilla/security/nss/lib/ckfw/session.c | 2496 + mozilla/security/nss/lib/ckfw/sessobj.c | 1111 + mozilla/security/nss/lib/ckfw/slot.c | 759 + mozilla/security/nss/lib/ckfw/token.c | 1928 + mozilla/security/nss/lib/ckfw/wrap.c | 5708 + mozilla/security/nss/lib/crmf/Makefile | 81 + mozilla/security/nss/lib/crmf/asn1cmn.c | 252 + mozilla/security/nss/lib/crmf/challcli.c | 274 + mozilla/security/nss/lib/crmf/cmmf.h | 1122 + mozilla/security/nss/lib/crmf/cmmfasn1.c | 164 + mozilla/security/nss/lib/crmf/cmmfchal.c | 322 + mozilla/security/nss/lib/crmf/cmmfi.h | 130 + mozilla/security/nss/lib/crmf/cmmfit.h | 148 + mozilla/security/nss/lib/crmf/cmmfrec.c | 350 + mozilla/security/nss/lib/crmf/cmmfresp.c | 315 + mozilla/security/nss/lib/crmf/cmmft.h | 105 + mozilla/security/nss/lib/crmf/config.mk | 48 + mozilla/security/nss/lib/crmf/crmf.h | 1782 + mozilla/security/nss/lib/crmf/crmfcont.c | 1190 + mozilla/security/nss/lib/crmf/crmfdec.c | 395 + mozilla/security/nss/lib/crmf/crmfenc.c | 87 + mozilla/security/nss/lib/crmf/crmffut.h | 393 + mozilla/security/nss/lib/crmf/crmfget.c | 482 + mozilla/security/nss/lib/crmf/crmfi.h | 190 + mozilla/security/nss/lib/crmf/crmfit.h | 219 + mozilla/security/nss/lib/crmf/crmfpop.c | 632 + mozilla/security/nss/lib/crmf/crmfreq.c | 702 + mozilla/security/nss/lib/crmf/crmft.h | 220 + mozilla/security/nss/lib/crmf/crmftmpl.c | 302 + mozilla/security/nss/lib/crmf/encutil.c | 66 + mozilla/security/nss/lib/crmf/manifest.mn | 78 + mozilla/security/nss/lib/crmf/respcli.c | 169 + mozilla/security/nss/lib/crmf/respcmn.c | 438 + mozilla/security/nss/lib/crmf/servget.c | 1010 + mozilla/security/nss/lib/cryptohi/Makefile | 81 + mozilla/security/nss/lib/cryptohi/config.mk | 47 + mozilla/security/nss/lib/cryptohi/cryptohi.h | 402 + mozilla/security/nss/lib/cryptohi/cryptoht.h | 48 + mozilla/security/nss/lib/cryptohi/dsautil.c | 300 + mozilla/security/nss/lib/cryptohi/key.h | 45 + mozilla/security/nss/lib/cryptohi/keyhi.h | 311 + mozilla/security/nss/lib/cryptohi/keyi.h | 57 + mozilla/security/nss/lib/cryptohi/keyt.h | 43 + mozilla/security/nss/lib/cryptohi/keythi.h | 273 + mozilla/security/nss/lib/cryptohi/manifest.mn | 68 + mozilla/security/nss/lib/cryptohi/sechash.c | 422 + mozilla/security/nss/lib/cryptohi/seckey.c | 2551 + mozilla/security/nss/lib/cryptohi/secsign.c | 518 + mozilla/security/nss/lib/cryptohi/secvfy.c | 756 + mozilla/security/nss/lib/dev/Makefile | 57 + mozilla/security/nss/lib/dev/ckhelper.c | 618 + mozilla/security/nss/lib/dev/ckhelper.h | 193 + mozilla/security/nss/lib/dev/config.mk | 52 + mozilla/security/nss/lib/dev/dev.h | 974 + mozilla/security/nss/lib/dev/devm.h | 241 + mozilla/security/nss/lib/dev/devslot.c | 296 + mozilla/security/nss/lib/dev/devt.h | 192 + mozilla/security/nss/lib/dev/devtm.h | 61 + mozilla/security/nss/lib/dev/devtoken.c | 1618 + mozilla/security/nss/lib/dev/devutil.c | 1042 + mozilla/security/nss/lib/dev/manifest.mn | 68 + mozilla/security/nss/lib/dev/nssdev.h | 75 + mozilla/security/nss/lib/dev/nssdevt.h | 72 + mozilla/security/nss/lib/freebl/Makefile | 619 + mozilla/security/nss/lib/freebl/aeskeywrap.c | 417 + mozilla/security/nss/lib/freebl/alg2268.c | 519 + mozilla/security/nss/lib/freebl/alghmac.c | 197 + mozilla/security/nss/lib/freebl/alghmac.h | 96 + mozilla/security/nss/lib/freebl/arcfive.c | 121 + .../security/nss/lib/freebl/arcfour-amd64-gas.s | 120 + .../security/nss/lib/freebl/arcfour-amd64-masm.asm | 139 + .../security/nss/lib/freebl/arcfour-amd64-sun.s | 116 + mozilla/security/nss/lib/freebl/arcfour.c | 646 + mozilla/security/nss/lib/freebl/blapi.h | 1322 + mozilla/security/nss/lib/freebl/blapii.h | 60 + mozilla/security/nss/lib/freebl/blapit.h | 389 + mozilla/security/nss/lib/freebl/camellia.c | 1797 + mozilla/security/nss/lib/freebl/camellia.h | 79 + mozilla/security/nss/lib/freebl/config.mk | 131 + mozilla/security/nss/lib/freebl/des.c | 699 + mozilla/security/nss/lib/freebl/des.h | 75 + mozilla/security/nss/lib/freebl/desblapi.c | 305 + mozilla/security/nss/lib/freebl/dh.c | 391 + mozilla/security/nss/lib/freebl/drbg.c | 729 + mozilla/security/nss/lib/freebl/dsa.c | 612 + mozilla/security/nss/lib/freebl/ec.c | 173 + mozilla/security/nss/lib/freebl/ec.h | 52 + mozilla/security/nss/lib/freebl/ecl/Makefile | 0 mozilla/security/nss/lib/freebl/ecl/README | 0 mozilla/security/nss/lib/freebl/ecl/README.FP | 0 mozilla/security/nss/lib/freebl/ecl/ec2.h | 0 mozilla/security/nss/lib/freebl/ecl/ec2_163.c | 0 mozilla/security/nss/lib/freebl/ecl/ec2_193.c | 0 mozilla/security/nss/lib/freebl/ecl/ec2_233.c | 0 mozilla/security/nss/lib/freebl/ecl/ec2_aff.c | 0 mozilla/security/nss/lib/freebl/ecl/ec2_mont.c | 0 mozilla/security/nss/lib/freebl/ecl/ec2_proj.c | 0 mozilla/security/nss/lib/freebl/ecl/ec_naf.c | 0 mozilla/security/nss/lib/freebl/ecl/ecl-curve.h | 0 mozilla/security/nss/lib/freebl/ecl/ecl-exp.h | 196 + mozilla/security/nss/lib/freebl/ecl/ecl-priv.h | 0 mozilla/security/nss/lib/freebl/ecl/ecl.c | 0 mozilla/security/nss/lib/freebl/ecl/ecl.h | 0 mozilla/security/nss/lib/freebl/ecl/ecl_curve.c | 0 mozilla/security/nss/lib/freebl/ecl/ecl_gf.c | 0 mozilla/security/nss/lib/freebl/ecl/ecl_mult.c | 0 mozilla/security/nss/lib/freebl/ecl/ecp.h | 0 mozilla/security/nss/lib/freebl/ecl/ecp_192.c | 0 mozilla/security/nss/lib/freebl/ecl/ecp_224.c | 0 mozilla/security/nss/lib/freebl/ecl/ecp_256.c | 0 mozilla/security/nss/lib/freebl/ecl/ecp_384.c | 0 mozilla/security/nss/lib/freebl/ecl/ecp_521.c | 0 mozilla/security/nss/lib/freebl/ecl/ecp_aff.c | 0 mozilla/security/nss/lib/freebl/ecl/ecp_fp.c | 0 mozilla/security/nss/lib/freebl/ecl/ecp_fp.h | 0 mozilla/security/nss/lib/freebl/ecl/ecp_fp160.c | 0 mozilla/security/nss/lib/freebl/ecl/ecp_fp192.c | 0 mozilla/security/nss/lib/freebl/ecl/ecp_fp224.c | 0 mozilla/security/nss/lib/freebl/ecl/ecp_fpinc.c | 0 mozilla/security/nss/lib/freebl/ecl/ecp_jac.c | 0 mozilla/security/nss/lib/freebl/ecl/ecp_jm.c | 0 mozilla/security/nss/lib/freebl/ecl/ecp_mont.c | 0 mozilla/security/nss/lib/freebl/freebl.def | 58 + mozilla/security/nss/lib/freebl/freebl.rc | 100 + mozilla/security/nss/lib/freebl/freebl_hash.def | 71 + mozilla/security/nss/lib/freebl/freeblver.c | 56 + mozilla/security/nss/lib/freebl/genload.c | 191 + mozilla/security/nss/lib/freebl/hasht.h | 102 + mozilla/security/nss/lib/freebl/intel-aes.h | 156 + mozilla/security/nss/lib/freebl/intel-aes.s | 1667 + mozilla/security/nss/lib/freebl/jpake.c | 526 + mozilla/security/nss/lib/freebl/ldvector.c | 291 + mozilla/security/nss/lib/freebl/loader.c | 1757 + mozilla/security/nss/lib/freebl/loader.h | 586 + mozilla/security/nss/lib/freebl/manifest.mn | 192 + mozilla/security/nss/lib/freebl/md2.c | 300 + mozilla/security/nss/lib/freebl/md5.c | 599 + mozilla/security/nss/lib/freebl/mknewpc2.c | 242 + mozilla/security/nss/lib/freebl/mksp.c | 159 + mozilla/security/nss/lib/freebl/mpi/Makefile | 281 + mozilla/security/nss/lib/freebl/mpi/Makefile.os2 | 280 + mozilla/security/nss/lib/freebl/mpi/Makefile.win | 291 + mozilla/security/nss/lib/freebl/mpi/README | 799 + mozilla/security/nss/lib/freebl/mpi/all-tests | 115 + mozilla/security/nss/lib/freebl/mpi/doc/LICENSE | 11 + .../security/nss/lib/freebl/mpi/doc/LICENSE-MPL | 35 + .../security/nss/lib/freebl/mpi/doc/basecvt.pod | 63 + mozilla/security/nss/lib/freebl/mpi/doc/build | 66 + mozilla/security/nss/lib/freebl/mpi/doc/div.txt | 101 + mozilla/security/nss/lib/freebl/mpi/doc/expt.txt | 132 + mozilla/security/nss/lib/freebl/mpi/doc/gcd.pod | 27 + mozilla/security/nss/lib/freebl/mpi/doc/invmod.pod | 33 + .../security/nss/lib/freebl/mpi/doc/isprime.pod | 62 + mozilla/security/nss/lib/freebl/mpi/doc/lap.pod | 35 + .../security/nss/lib/freebl/mpi/doc/mpi-test.pod | 49 + mozilla/security/nss/lib/freebl/mpi/doc/mul.txt | 114 + mozilla/security/nss/lib/freebl/mpi/doc/pi.txt | 90 + mozilla/security/nss/lib/freebl/mpi/doc/prime.txt | 6542 ++ mozilla/security/nss/lib/freebl/mpi/doc/prng.pod | 41 + mozilla/security/nss/lib/freebl/mpi/doc/redux.txt | 121 + mozilla/security/nss/lib/freebl/mpi/doc/sqrt.txt | 87 + mozilla/security/nss/lib/freebl/mpi/doc/square.txt | 109 + mozilla/security/nss/lib/freebl/mpi/doc/timing.txt | 250 + mozilla/security/nss/lib/freebl/mpi/hpma512.s | 646 + mozilla/security/nss/lib/freebl/mpi/hppa20.s | 935 + mozilla/security/nss/lib/freebl/mpi/hppatch.adb | 54 + mozilla/security/nss/lib/freebl/mpi/logtab.h | 62 + mozilla/security/nss/lib/freebl/mpi/make-logtab | 64 + .../security/nss/lib/freebl/mpi/make-test-arrays | 133 + mozilla/security/nss/lib/freebl/mpi/mdxptest.c | 342 + mozilla/security/nss/lib/freebl/mpi/montmulf.c | 329 + mozilla/security/nss/lib/freebl/mpi/montmulf.h | 103 + mozilla/security/nss/lib/freebl/mpi/montmulf.il | 141 + mozilla/security/nss/lib/freebl/mpi/montmulf.s | 1970 + mozilla/security/nss/lib/freebl/mpi/montmulfv8.il | 141 + mozilla/security/nss/lib/freebl/mpi/montmulfv8.s | 1850 + mozilla/security/nss/lib/freebl/mpi/montmulfv9.il | 126 + mozilla/security/nss/lib/freebl/mpi/montmulfv9.s | 2380 + mozilla/security/nss/lib/freebl/mpi/mp_comba.c | 1298 + .../nss/lib/freebl/mpi/mp_comba_amd64_masm.asm | 13100 +++ .../nss/lib/freebl/mpi/mp_comba_amd64_sun.s | 16097 +++ mozilla/security/nss/lib/freebl/mpi/mp_gf2m-priv.h | 102 + mozilla/security/nss/lib/freebl/mpi/mp_gf2m.c | 603 + mozilla/security/nss/lib/freebl/mpi/mp_gf2m.h | 63 + mozilla/security/nss/lib/freebl/mpi/mpcpucache.c | 838 + .../security/nss/lib/freebl/mpi/mpcpucache_amd64.s | 894 + .../security/nss/lib/freebl/mpi/mpcpucache_x86.s | 934 + mozilla/security/nss/lib/freebl/mpi/mpi-config.h | 112 + mozilla/security/nss/lib/freebl/mpi/mpi-priv.h | 319 + mozilla/security/nss/lib/freebl/mpi/mpi-test.c | 1986 + mozilla/security/nss/lib/freebl/mpi/mpi.c | 4850 + mozilla/security/nss/lib/freebl/mpi/mpi.h | 340 + mozilla/security/nss/lib/freebl/mpi/mpi_amd64.c | 65 + .../security/nss/lib/freebl/mpi/mpi_amd64_gas.s | 422 + .../security/nss/lib/freebl/mpi/mpi_amd64_masm.asm | 422 + .../security/nss/lib/freebl/mpi/mpi_amd64_sun.s | 418 + mozilla/security/nss/lib/freebl/mpi/mpi_hp.c | 115 + mozilla/security/nss/lib/freebl/mpi/mpi_i86pc.s | 348 + mozilla/security/nss/lib/freebl/mpi/mpi_mips.s | 504 + mozilla/security/nss/lib/freebl/mpi/mpi_sparc.c | 257 + mozilla/security/nss/lib/freebl/mpi/mpi_x86.s | 576 + mozilla/security/nss/lib/freebl/mpi/mpi_x86_asm.c | 568 + mozilla/security/nss/lib/freebl/mpi/mpi_x86_os2.s | 573 + mozilla/security/nss/lib/freebl/mpi/mplogic.c | 465 + mozilla/security/nss/lib/freebl/mpi/mplogic.h | 85 + mozilla/security/nss/lib/freebl/mpi/mpmontg.c | 1209 + mozilla/security/nss/lib/freebl/mpi/mpprime.c | 617 + mozilla/security/nss/lib/freebl/mpi/mpprime.h | 70 + mozilla/security/nss/lib/freebl/mpi/mpv_sparc.c | 253 + mozilla/security/nss/lib/freebl/mpi/mpv_sparcv8.s | 1639 + mozilla/security/nss/lib/freebl/mpi/mpv_sparcv8x.s | 175 + mozilla/security/nss/lib/freebl/mpi/mpv_sparcv9.s | 1680 + mozilla/security/nss/lib/freebl/mpi/mpvalpha.c | 214 + mozilla/security/nss/lib/freebl/mpi/mulsqr.c | 115 + mozilla/security/nss/lib/freebl/mpi/multest | 111 + mozilla/security/nss/lib/freebl/mpi/primes.c | 874 + mozilla/security/nss/lib/freebl/mpi/stats | 74 + mozilla/security/nss/lib/freebl/mpi/target.mk | 262 + .../security/nss/lib/freebl/mpi/test-arrays.txt | 90 + mozilla/security/nss/lib/freebl/mpi/test-info.c | 194 + mozilla/security/nss/lib/freebl/mpi/tests/LICENSE | 6 + .../security/nss/lib/freebl/mpi/tests/LICENSE-MPL | 35 + .../security/nss/lib/freebl/mpi/tests/mptest-1.c | 75 + .../security/nss/lib/freebl/mpi/tests/mptest-2.c | 86 + .../security/nss/lib/freebl/mpi/tests/mptest-3.c | 131 + .../security/nss/lib/freebl/mpi/tests/mptest-3a.c | 144 + .../security/nss/lib/freebl/mpi/tests/mptest-4.c | 126 + .../security/nss/lib/freebl/mpi/tests/mptest-4a.c | 138 + .../security/nss/lib/freebl/mpi/tests/mptest-4b.c | 135 + .../security/nss/lib/freebl/mpi/tests/mptest-5.c | 103 + .../security/nss/lib/freebl/mpi/tests/mptest-5a.c | 165 + .../security/nss/lib/freebl/mpi/tests/mptest-6.c | 111 + .../security/nss/lib/freebl/mpi/tests/mptest-7.c | 107 + .../security/nss/lib/freebl/mpi/tests/mptest-8.c | 98 + .../security/nss/lib/freebl/mpi/tests/mptest-9.c | 116 + .../security/nss/lib/freebl/mpi/tests/mptest-b.c | 220 + mozilla/security/nss/lib/freebl/mpi/tests/pi1k.txt | 1 + mozilla/security/nss/lib/freebl/mpi/tests/pi2k.txt | 1 + mozilla/security/nss/lib/freebl/mpi/tests/pi5k.txt | 1 + mozilla/security/nss/lib/freebl/mpi/timetest | 136 + mozilla/security/nss/lib/freebl/mpi/types.pl | 162 + mozilla/security/nss/lib/freebl/mpi/utils/LICENSE | 4 + .../security/nss/lib/freebl/mpi/utils/LICENSE-MPL | 35 + mozilla/security/nss/lib/freebl/mpi/utils/PRIMES | 41 + mozilla/security/nss/lib/freebl/mpi/utils/README | 241 + .../security/nss/lib/freebl/mpi/utils/basecvt.c | 100 + .../security/nss/lib/freebl/mpi/utils/bbs_rand.c | 96 + .../security/nss/lib/freebl/mpi/utils/bbs_rand.h | 57 + .../security/nss/lib/freebl/mpi/utils/bbsrand.c | 67 + .../security/nss/lib/freebl/mpi/utils/dec2hex.c | 71 + .../security/nss/lib/freebl/mpi/utils/exptmod.c | 83 + mozilla/security/nss/lib/freebl/mpi/utils/fact.c | 115 + mozilla/security/nss/lib/freebl/mpi/utils/gcd.c | 119 + .../security/nss/lib/freebl/mpi/utils/hex2dec.c | 71 + .../security/nss/lib/freebl/mpi/utils/identest.c | 79 + mozilla/security/nss/lib/freebl/mpi/utils/invmod.c | 92 + .../security/nss/lib/freebl/mpi/utils/isprime.c | 121 + mozilla/security/nss/lib/freebl/mpi/utils/lap.c | 121 + .../security/nss/lib/freebl/mpi/utils/makeprime.c | 147 + mozilla/security/nss/lib/freebl/mpi/utils/metime.c | 136 + mozilla/security/nss/lib/freebl/mpi/utils/pi.c | 197 + .../security/nss/lib/freebl/mpi/utils/primegen.c | 201 + mozilla/security/nss/lib/freebl/mpi/utils/prng.c | 90 + mozilla/security/nss/lib/freebl/mpi/utils/ptab.pl | 61 + mozilla/security/nss/lib/freebl/mpi/utils/sieve.c | 268 + mozilla/security/nss/lib/freebl/mpi/vis_32.il | 1324 + mozilla/security/nss/lib/freebl/mpi/vis_64.il | 1030 + mozilla/security/nss/lib/freebl/mpi/vis_proto.h | 267 + mozilla/security/nss/lib/freebl/nsslowhash.c | 406 + mozilla/security/nss/lib/freebl/nsslowhash.h | 60 + mozilla/security/nss/lib/freebl/os2_rand.c | 373 + mozilla/security/nss/lib/freebl/pqg.c | 717 + mozilla/security/nss/lib/freebl/rawhash.c | 168 + mozilla/security/nss/lib/freebl/ret_cr16.s | 57 + mozilla/security/nss/lib/freebl/rijndael.c | 1198 + mozilla/security/nss/lib/freebl/rijndael.h | 95 + mozilla/security/nss/lib/freebl/rijndael32.tab | 1215 + mozilla/security/nss/lib/freebl/rijndael_tables.c | 246 + mozilla/security/nss/lib/freebl/rsa.c | 1488 + mozilla/security/nss/lib/freebl/sechash.h | 90 + mozilla/security/nss/lib/freebl/secmpi.h | 61 + mozilla/security/nss/lib/freebl/secrng.h | 99 + mozilla/security/nss/lib/freebl/seed.c | 678 + mozilla/security/nss/lib/freebl/seed.h | 160 + .../security/nss/lib/freebl/sha-fast-amd64-sun.s | 2142 + mozilla/security/nss/lib/freebl/sha256.h | 51 + mozilla/security/nss/lib/freebl/sha512.c | 1410 + mozilla/security/nss/lib/freebl/sha_fast.c | 477 + mozilla/security/nss/lib/freebl/sha_fast.h | 184 + mozilla/security/nss/lib/freebl/shsign.h | 47 + mozilla/security/nss/lib/freebl/shvfy.c | 300 + mozilla/security/nss/lib/freebl/stubs.c | 600 + mozilla/security/nss/lib/freebl/stubs.h | 90 + mozilla/security/nss/lib/freebl/sysrand.c | 78 + mozilla/security/nss/lib/freebl/tlsprfalg.c | 169 + mozilla/security/nss/lib/freebl/unix_rand.c | 1182 + mozilla/security/nss/lib/freebl/win_rand.c | 579 + mozilla/security/nss/lib/jar/Makefile | 43 + mozilla/security/nss/lib/jar/config.mk | 58 + mozilla/security/nss/lib/jar/jar-ds.c | 68 + mozilla/security/nss/lib/jar/jar-ds.h | 110 + mozilla/security/nss/lib/jar/jar.c | 716 + mozilla/security/nss/lib/jar/jar.h | 405 + mozilla/security/nss/lib/jar/jarfile.c | 997 + mozilla/security/nss/lib/jar/jarfile.h | 108 + mozilla/security/nss/lib/jar/jarint.c | 84 + mozilla/security/nss/lib/jar/jarint.h | 87 + mozilla/security/nss/lib/jar/jarnav.c | 94 + mozilla/security/nss/lib/jar/jarsign.c | 270 + mozilla/security/nss/lib/jar/jarver.c | 1207 + mozilla/security/nss/lib/jar/jzconf.h | 190 + mozilla/security/nss/lib/jar/jzlib.h | 896 + mozilla/security/nss/lib/jar/manifest.mn | 59 + mozilla/security/nss/lib/libpkix/Makefile | 81 + mozilla/security/nss/lib/libpkix/config.mk | 49 + mozilla/security/nss/lib/libpkix/include/Makefile | 81 + mozilla/security/nss/lib/libpkix/include/config.mk | 48 + .../security/nss/lib/libpkix/include/manifest.mn | 65 + mozilla/security/nss/lib/libpkix/include/pkix.h | 334 + .../nss/lib/libpkix/include/pkix_certsel.h | 1859 + .../nss/lib/libpkix/include/pkix_certstore.h | 746 + .../nss/lib/libpkix/include/pkix_checker.h | 427 + .../security/nss/lib/libpkix/include/pkix_crlsel.h | 792 + .../nss/lib/libpkix/include/pkix_errorstrings.h | 1129 + .../security/nss/lib/libpkix/include/pkix_params.h | 1759 + .../security/nss/lib/libpkix/include/pkix_pl_pki.h | 2695 + .../nss/lib/libpkix/include/pkix_pl_system.h | 1578 + .../nss/lib/libpkix/include/pkix_results.h | 458 + .../nss/lib/libpkix/include/pkix_revchecker.h | 250 + .../nss/lib/libpkix/include/pkix_sample_modules.h | 451 + .../security/nss/lib/libpkix/include/pkix_util.h | 974 + mozilla/security/nss/lib/libpkix/include/pkixt.h | 518 + mozilla/security/nss/lib/libpkix/manifest.mn | 46 + mozilla/security/nss/lib/libpkix/pkix/Makefile | 81 + .../security/nss/lib/libpkix/pkix/certsel/Makefile | 81 + .../nss/lib/libpkix/pkix/certsel/config.mk | 48 + .../nss/lib/libpkix/pkix/certsel/manifest.mn | 58 + .../lib/libpkix/pkix/certsel/pkix_certselector.c | 1666 + .../lib/libpkix/pkix/certsel/pkix_certselector.h | 74 + .../libpkix/pkix/certsel/pkix_comcertselparams.c | 1221 + .../libpkix/pkix/certsel/pkix_comcertselparams.h | 90 + .../security/nss/lib/libpkix/pkix/checker/Makefile | 81 + .../nss/lib/libpkix/pkix/checker/config.mk | 48 + .../nss/lib/libpkix/pkix/checker/manifest.mn | 80 + .../pkix/checker/pkix_basicconstraintschecker.c | 339 + .../pkix/checker/pkix_basicconstraintschecker.h | 75 + .../libpkix/pkix/checker/pkix_certchainchecker.c | 355 + .../libpkix/pkix/checker/pkix_certchainchecker.h | 69 + .../nss/lib/libpkix/pkix/checker/pkix_crlchecker.c | 470 + .../nss/lib/libpkix/pkix/checker/pkix_crlchecker.h | 101 + .../nss/lib/libpkix/pkix/checker/pkix_ekuchecker.c | 361 + .../nss/lib/libpkix/pkix/checker/pkix_ekuchecker.h | 125 + .../libpkix/pkix/checker/pkix_expirationchecker.c | 146 + .../libpkix/pkix/checker/pkix_expirationchecker.h | 63 + .../pkix/checker/pkix_namechainingchecker.c | 154 + .../pkix/checker/pkix_namechainingchecker.h | 63 + .../pkix/checker/pkix_nameconstraintschecker.c | 338 + .../pkix/checker/pkix_nameconstraintschecker.h | 76 + .../lib/libpkix/pkix/checker/pkix_ocspchecker.c | 380 + .../lib/libpkix/pkix/checker/pkix_ocspchecker.h | 100 + .../lib/libpkix/pkix/checker/pkix_policychecker.c | 2816 + .../lib/libpkix/pkix/checker/pkix_policychecker.h | 106 + .../libpkix/pkix/checker/pkix_revocationchecker.c | 502 + .../libpkix/pkix/checker/pkix_revocationchecker.h | 183 + .../libpkix/pkix/checker/pkix_revocationmethod.c | 99 + .../libpkix/pkix/checker/pkix_revocationmethod.h | 113 + .../libpkix/pkix/checker/pkix_signaturechecker.c | 475 + .../libpkix/pkix/checker/pkix_signaturechecker.h | 77 + .../libpkix/pkix/checker/pkix_targetcertchecker.c | 549 + .../libpkix/pkix/checker/pkix_targetcertchecker.h | 80 + mozilla/security/nss/lib/libpkix/pkix/config.mk | 48 + .../security/nss/lib/libpkix/pkix/crlsel/Makefile | 81 + .../security/nss/lib/libpkix/pkix/crlsel/config.mk | 48 + .../nss/lib/libpkix/pkix/crlsel/manifest.mn | 58 + .../lib/libpkix/pkix/crlsel/pkix_comcrlselparams.c | 859 + .../lib/libpkix/pkix/crlsel/pkix_comcrlselparams.h | 71 + .../nss/lib/libpkix/pkix/crlsel/pkix_crlselector.c | 903 + .../nss/lib/libpkix/pkix/crlsel/pkix_crlselector.h | 73 + mozilla/security/nss/lib/libpkix/pkix/manifest.mn | 44 + .../security/nss/lib/libpkix/pkix/params/Makefile | 81 + .../security/nss/lib/libpkix/pkix/params/config.mk | 48 + .../nss/lib/libpkix/pkix/params/manifest.mn | 62 + .../nss/lib/libpkix/pkix/params/pkix_buildparams.c | 317 + .../nss/lib/libpkix/pkix/params/pkix_buildparams.h | 65 + .../nss/lib/libpkix/pkix/params/pkix_procparams.c | 1411 + .../nss/lib/libpkix/pkix/params/pkix_procparams.h | 82 + .../lib/libpkix/pkix/params/pkix_resourcelimits.c | 466 + .../lib/libpkix/pkix/params/pkix_resourcelimits.h | 69 + .../nss/lib/libpkix/pkix/params/pkix_trustanchor.c | 554 + .../nss/lib/libpkix/pkix/params/pkix_trustanchor.h | 68 + .../nss/lib/libpkix/pkix/params/pkix_valparams.c | 368 + .../nss/lib/libpkix/pkix/params/pkix_valparams.h | 66 + .../security/nss/lib/libpkix/pkix/results/Makefile | 81 + .../nss/lib/libpkix/pkix/results/config.mk | 48 + .../nss/lib/libpkix/pkix/results/manifest.mn | 62 + .../lib/libpkix/pkix/results/pkix_buildresult.c | 395 + .../lib/libpkix/pkix/results/pkix_buildresult.h | 73 + .../nss/lib/libpkix/pkix/results/pkix_policynode.c | 1410 + .../nss/lib/libpkix/pkix/results/pkix_policynode.h | 107 + .../nss/lib/libpkix/pkix/results/pkix_valresult.c | 465 + .../nss/lib/libpkix/pkix/results/pkix_valresult.h | 76 + .../nss/lib/libpkix/pkix/results/pkix_verifynode.c | 1215 + .../nss/lib/libpkix/pkix/results/pkix_verifynode.h | 108 + .../security/nss/lib/libpkix/pkix/store/Makefile | 81 + .../security/nss/lib/libpkix/pkix/store/config.mk | 48 + .../nss/lib/libpkix/pkix/store/manifest.mn | 56 + .../nss/lib/libpkix/pkix/store/pkix_store.c | 448 + .../nss/lib/libpkix/pkix/store/pkix_store.h | 74 + mozilla/security/nss/lib/libpkix/pkix/top/Makefile | 81 + .../security/nss/lib/libpkix/pkix/top/config.mk | 48 + .../security/nss/lib/libpkix/pkix/top/manifest.mn | 60 + .../security/nss/lib/libpkix/pkix/top/pkix_build.c | 3802 + .../security/nss/lib/libpkix/pkix/top/pkix_build.h | 155 + .../nss/lib/libpkix/pkix/top/pkix_lifecycle.c | 243 + .../nss/lib/libpkix/pkix/top/pkix_lifecycle.h | 56 + .../nss/lib/libpkix/pkix/top/pkix_validate.c | 1404 + .../nss/lib/libpkix/pkix/top/pkix_validate.h | 75 + .../security/nss/lib/libpkix/pkix/util/Makefile | 81 + .../security/nss/lib/libpkix/pkix/util/config.mk | 48 + .../security/nss/lib/libpkix/pkix/util/manifest.mn | 63 + .../nss/lib/libpkix/pkix/util/pkix_error.c | 598 + .../nss/lib/libpkix/pkix/util/pkix_error.h | 69 + .../nss/lib/libpkix/pkix/util/pkix_errpaths.c | 136 + .../security/nss/lib/libpkix/pkix/util/pkix_list.c | 1734 + .../security/nss/lib/libpkix/pkix/util/pkix_list.h | 128 + .../nss/lib/libpkix/pkix/util/pkix_logger.c | 1121 + .../nss/lib/libpkix/pkix/util/pkix_logger.h | 90 + .../nss/lib/libpkix/pkix/util/pkix_tools.c | 1552 + .../nss/lib/libpkix/pkix/util/pkix_tools.h | 1611 + .../security/nss/lib/libpkix/pkix_pl_nss/Makefile | 81 + .../security/nss/lib/libpkix/pkix_pl_nss/config.mk | 48 + .../nss/lib/libpkix/pkix_pl_nss/manifest.mn | 44 + .../nss/lib/libpkix/pkix_pl_nss/module/Makefile | 81 + .../nss/lib/libpkix/pkix_pl_nss/module/config.mk | 48 + .../nss/lib/libpkix/pkix_pl_nss/module/manifest.mn | 81 + .../libpkix/pkix_pl_nss/module/pkix_pl_aiamgr.c | 707 + .../libpkix/pkix_pl_nss/module/pkix_pl_aiamgr.h | 94 + .../pkix_pl_nss/module/pkix_pl_colcertstore.c | 1315 + .../pkix_pl_nss/module/pkix_pl_colcertstore.h | 67 + .../pkix_pl_nss/module/pkix_pl_httpcertstore.c | 1180 + .../pkix_pl_nss/module/pkix_pl_httpcertstore.h | 95 + .../pkix_pl_nss/module/pkix_pl_httpdefaultclient.c | 1688 + .../pkix_pl_nss/module/pkix_pl_httpdefaultclient.h | 172 + .../pkix_pl_nss/module/pkix_pl_ldapcertstore.c | 1149 + .../pkix_pl_nss/module/pkix_pl_ldapcertstore.h | 108 + .../pkix_pl_nss/module/pkix_pl_ldapdefaultclient.c | 2526 + .../pkix_pl_nss/module/pkix_pl_ldapdefaultclient.h | 115 + .../pkix_pl_nss/module/pkix_pl_ldaprequest.c | 794 + .../pkix_pl_nss/module/pkix_pl_ldaprequest.h | 119 + .../pkix_pl_nss/module/pkix_pl_ldapresponse.c | 819 + .../pkix_pl_nss/module/pkix_pl_ldapresponse.h | 129 + .../lib/libpkix/pkix_pl_nss/module/pkix_pl_ldapt.h | 348 + .../pkix_pl_nss/module/pkix_pl_ldaptemplates.c | 451 + .../pkix_pl_nss/module/pkix_pl_nsscontext.c | 350 + .../pkix_pl_nss/module/pkix_pl_nsscontext.h | 84 + .../pkix_pl_nss/module/pkix_pl_pk11certstore.c | 1086 + .../pkix_pl_nss/module/pkix_pl_pk11certstore.h | 64 + .../libpkix/pkix_pl_nss/module/pkix_pl_socket.c | 1723 + .../libpkix/pkix_pl_nss/module/pkix_pl_socket.h | 242 + .../nss/lib/libpkix/pkix_pl_nss/pki/Makefile | 82 + .../nss/lib/libpkix/pkix_pl_nss/pki/config.mk | 48 + .../nss/lib/libpkix/pkix_pl_nss/pki/manifest.mn | 89 + .../pkix_pl_nss/pki/pkix_pl_basicconstraints.c | 440 + .../pkix_pl_nss/pki/pkix_pl_basicconstraints.h | 80 + .../nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_cert.c | 3657 + .../nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_cert.h | 137 + .../pkix_pl_nss/pki/pkix_pl_certpolicyinfo.c | 404 + .../pkix_pl_nss/pki/pkix_pl_certpolicyinfo.h | 83 + .../pkix_pl_nss/pki/pkix_pl_certpolicymap.c | 419 + .../pkix_pl_nss/pki/pkix_pl_certpolicymap.h | 82 + .../pkix_pl_nss/pki/pkix_pl_certpolicyqualifier.c | 398 + .../pkix_pl_nss/pki/pkix_pl_certpolicyqualifier.h | 85 + .../nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crl.c | 1100 + .../nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crl.h | 81 + .../lib/libpkix/pkix_pl_nss/pki/pkix_pl_crldp.c | 184 + .../lib/libpkix/pkix_pl_nss/pki/pkix_pl_crldp.h | 81 + .../lib/libpkix/pkix_pl_nss/pki/pkix_pl_crlentry.c | 913 + .../lib/libpkix/pkix_pl_nss/pki/pkix_pl_crlentry.h | 79 + .../nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_date.c | 499 + .../nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_date.h | 88 + .../libpkix/pkix_pl_nss/pki/pkix_pl_generalname.c | 906 + .../libpkix/pkix_pl_nss/pki/pkix_pl_generalname.h | 82 + .../libpkix/pkix_pl_nss/pki/pkix_pl_infoaccess.c | 884 + .../libpkix/pkix_pl_nss/pki/pkix_pl_infoaccess.h | 80 + .../pkix_pl_nss/pki/pkix_pl_nameconstraints.c | 1307 + .../pkix_pl_nss/pki/pkix_pl_nameconstraints.h | 101 + .../libpkix/pkix_pl_nss/pki/pkix_pl_ocspcertid.c | 283 + .../libpkix/pkix_pl_nss/pki/pkix_pl_ocspcertid.h | 86 + .../libpkix/pkix_pl_nss/pki/pkix_pl_ocsprequest.c | 474 + .../libpkix/pkix_pl_nss/pki/pkix_pl_ocsprequest.h | 94 + .../libpkix/pkix_pl_nss/pki/pkix_pl_ocspresponse.c | 1022 + .../libpkix/pkix_pl_nss/pki/pkix_pl_ocspresponse.h | 136 + .../libpkix/pkix_pl_nss/pki/pkix_pl_publickey.c | 525 + .../libpkix/pkix_pl_nss/pki/pkix_pl_publickey.h | 71 + .../lib/libpkix/pkix_pl_nss/pki/pkix_pl_x500name.c | 755 + .../lib/libpkix/pkix_pl_nss/pki/pkix_pl_x500name.h | 107 + .../nss/lib/libpkix/pkix_pl_nss/system/Makefile | 82 + .../nss/lib/libpkix/pkix_pl_nss/system/config.mk | 48 + .../nss/lib/libpkix/pkix_pl_nss/system/manifest.mn | 81 + .../libpkix/pkix_pl_nss/system/pkix_pl_bigint.c | 431 + .../libpkix/pkix_pl_nss/system/pkix_pl_bigint.h | 73 + .../libpkix/pkix_pl_nss/system/pkix_pl_bytearray.c | 537 + .../libpkix/pkix_pl_nss/system/pkix_pl_bytearray.h | 73 + .../libpkix/pkix_pl_nss/system/pkix_pl_common.c | 1106 + .../libpkix/pkix_pl_nss/system/pkix_pl_common.h | 188 + .../lib/libpkix/pkix_pl_nss/system/pkix_pl_error.c | 59 + .../libpkix/pkix_pl_nss/system/pkix_pl_hashtable.c | 416 + .../libpkix/pkix_pl_nss/system/pkix_pl_hashtable.h | 62 + .../libpkix/pkix_pl_nss/system/pkix_pl_lifecycle.c | 304 + .../libpkix/pkix_pl_nss/system/pkix_pl_lifecycle.h | 122 + .../lib/libpkix/pkix_pl_nss/system/pkix_pl_mem.c | 201 + .../lib/libpkix/pkix_pl_nss/system/pkix_pl_mem.h | 57 + .../pkix_pl_nss/system/pkix_pl_monitorlock.c | 169 + .../pkix_pl_nss/system/pkix_pl_monitorlock.h | 66 + .../lib/libpkix/pkix_pl_nss/system/pkix_pl_mutex.c | 196 + .../lib/libpkix/pkix_pl_nss/system/pkix_pl_mutex.h | 66 + .../libpkix/pkix_pl_nss/system/pkix_pl_object.c | 1473 + .../libpkix/pkix_pl_nss/system/pkix_pl_object.h | 109 + .../lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.c | 365 + .../lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.h | 72 + .../libpkix/pkix_pl_nss/system/pkix_pl_primhash.c | 617 + .../libpkix/pkix_pl_nss/system/pkix_pl_primhash.h | 135 + .../libpkix/pkix_pl_nss/system/pkix_pl_rwlock.c | 250 + .../libpkix/pkix_pl_nss/system/pkix_pl_rwlock.h | 68 + .../libpkix/pkix_pl_nss/system/pkix_pl_string.c | 654 + .../libpkix/pkix_pl_nss/system/pkix_pl_string.h | 70 + mozilla/security/nss/lib/manifest.mn | 66 + mozilla/security/nss/lib/nss/Makefile | 78 + mozilla/security/nss/lib/nss/config.mk | 134 + mozilla/security/nss/lib/nss/manifest.mn | 63 + mozilla/security/nss/lib/nss/nss.def | 1015 + mozilla/security/nss/lib/nss/nss.h | 348 + mozilla/security/nss/lib/nss/nss.rc | 100 + mozilla/security/nss/lib/nss/nssinit.c | 1206 + mozilla/security/nss/lib/nss/nssrenam.h | 47 + mozilla/security/nss/lib/nss/nssver.c | 56 + mozilla/security/nss/lib/nss/pkixpriv.def | 318 + mozilla/security/nss/lib/nss/utilwrap.c | 826 + mozilla/security/nss/lib/pk11wrap/Makefile | 92 + mozilla/security/nss/lib/pk11wrap/config.mk | 47 + mozilla/security/nss/lib/pk11wrap/debug_module.c | 2743 + mozilla/security/nss/lib/pk11wrap/dev3hack.c | 339 + mozilla/security/nss/lib/pk11wrap/dev3hack.h | 66 + mozilla/security/nss/lib/pk11wrap/manifest.mn | 96 + mozilla/security/nss/lib/pk11wrap/pk11akey.c | 2392 + mozilla/security/nss/lib/pk11wrap/pk11auth.c | 803 + mozilla/security/nss/lib/pk11wrap/pk11cert.c | 2602 + mozilla/security/nss/lib/pk11wrap/pk11cxt.c | 1069 + mozilla/security/nss/lib/pk11wrap/pk11err.c | 163 + mozilla/security/nss/lib/pk11wrap/pk11func.h | 47 + mozilla/security/nss/lib/pk11wrap/pk11kea.c | 163 + mozilla/security/nss/lib/pk11wrap/pk11list.c | 127 + mozilla/security/nss/lib/pk11wrap/pk11load.c | 630 + mozilla/security/nss/lib/pk11wrap/pk11mech.c | 1900 + mozilla/security/nss/lib/pk11wrap/pk11merge.c | 1415 + mozilla/security/nss/lib/pk11wrap/pk11nobj.c | 817 + mozilla/security/nss/lib/pk11wrap/pk11obj.c | 1821 + mozilla/security/nss/lib/pk11wrap/pk11pars.c | 1232 + mozilla/security/nss/lib/pk11wrap/pk11pbe.c | 1460 + mozilla/security/nss/lib/pk11wrap/pk11pk12.c | 559 + mozilla/security/nss/lib/pk11wrap/pk11pqg.c | 470 + mozilla/security/nss/lib/pk11wrap/pk11pqg.h | 155 + mozilla/security/nss/lib/pk11wrap/pk11priv.h | 219 + mozilla/security/nss/lib/pk11wrap/pk11pub.h | 850 + mozilla/security/nss/lib/pk11wrap/pk11sdr.c | 410 + mozilla/security/nss/lib/pk11wrap/pk11sdr.h | 60 + mozilla/security/nss/lib/pk11wrap/pk11skey.c | 2351 + mozilla/security/nss/lib/pk11wrap/pk11slot.c | 2295 + mozilla/security/nss/lib/pk11wrap/pk11util.c | 1585 + mozilla/security/nss/lib/pk11wrap/secmod.h | 196 + mozilla/security/nss/lib/pk11wrap/secmodi.h | 206 + mozilla/security/nss/lib/pk11wrap/secmodti.h | 220 + mozilla/security/nss/lib/pk11wrap/secpkcs5.h | 94 + mozilla/security/nss/lib/pkcs12/Makefile | 81 + mozilla/security/nss/lib/pkcs12/config.mk | 48 + mozilla/security/nss/lib/pkcs12/manifest.mn | 65 + mozilla/security/nss/lib/pkcs12/p12.h | 212 + mozilla/security/nss/lib/pkcs12/p12creat.c | 254 + mozilla/security/nss/lib/pkcs12/p12d.c | 3586 + mozilla/security/nss/lib/pkcs12/p12dec.c | 696 + mozilla/security/nss/lib/pkcs12/p12e.c | 2102 + mozilla/security/nss/lib/pkcs12/p12exp.c | 1410 + mozilla/security/nss/lib/pkcs12/p12local.c | 1372 + mozilla/security/nss/lib/pkcs12/p12local.h | 91 + mozilla/security/nss/lib/pkcs12/p12plcy.c | 157 + mozilla/security/nss/lib/pkcs12/p12plcy.h | 57 + mozilla/security/nss/lib/pkcs12/p12t.h | 187 + mozilla/security/nss/lib/pkcs12/p12tmpl.c | 323 + mozilla/security/nss/lib/pkcs12/pkcs12.h | 74 + mozilla/security/nss/lib/pkcs12/pkcs12t.h | 398 + mozilla/security/nss/lib/pkcs7/Makefile | 80 + mozilla/security/nss/lib/pkcs7/certread.c | 456 + mozilla/security/nss/lib/pkcs7/config.mk | 46 + mozilla/security/nss/lib/pkcs7/manifest.mn | 67 + mozilla/security/nss/lib/pkcs7/p7common.c | 725 + mozilla/security/nss/lib/pkcs7/p7create.c | 1321 + mozilla/security/nss/lib/pkcs7/p7decode.c | 2055 + mozilla/security/nss/lib/pkcs7/p7encode.c | 1297 + mozilla/security/nss/lib/pkcs7/p7local.c | 1410 + mozilla/security/nss/lib/pkcs7/p7local.h | 179 + mozilla/security/nss/lib/pkcs7/pkcs7t.h | 299 + mozilla/security/nss/lib/pkcs7/secmime.c | 904 + mozilla/security/nss/lib/pkcs7/secmime.h | 195 + mozilla/security/nss/lib/pkcs7/secpkcs7.h | 626 + mozilla/security/nss/lib/pki/Makefile | 44 + mozilla/security/nss/lib/pki/asymmkey.c | 434 + mozilla/security/nss/lib/pki/certdecode.c | 101 + mozilla/security/nss/lib/pki/certificate.c | 1157 + mozilla/security/nss/lib/pki/config.mk | 52 + mozilla/security/nss/lib/pki/cryptocontext.c | 1018 + mozilla/security/nss/lib/pki/doc/standiag.png | Bin 0 -> 20475 bytes mozilla/security/nss/lib/pki/doc/standoc.html | 474 + mozilla/security/nss/lib/pki/manifest.mn | 78 + mozilla/security/nss/lib/pki/nsspki.h | 3200 + mozilla/security/nss/lib/pki/nsspkit.h | 283 + mozilla/security/nss/lib/pki/pki.h | 248 + mozilla/security/nss/lib/pki/pki3hack.c | 1299 + mozilla/security/nss/lib/pki/pki3hack.h | 197 + mozilla/security/nss/lib/pki/pkibase.c | 1268 + mozilla/security/nss/lib/pki/pkim.h | 731 + mozilla/security/nss/lib/pki/pkistore.c | 774 + mozilla/security/nss/lib/pki/pkistore.h | 204 + mozilla/security/nss/lib/pki/pkit.h | 224 + mozilla/security/nss/lib/pki/pkitm.h | 121 + mozilla/security/nss/lib/pki/symmkey.c | 300 + mozilla/security/nss/lib/pki/tdcache.c | 1178 + mozilla/security/nss/lib/pki/trustdomain.c | 1290 + mozilla/security/nss/lib/smime/Makefile | 80 + mozilla/security/nss/lib/smime/cms.h | 1134 + mozilla/security/nss/lib/smime/cmsarray.c | 219 + mozilla/security/nss/lib/smime/cmsasn1.c | 577 + mozilla/security/nss/lib/smime/cmsattr.c | 461 + mozilla/security/nss/lib/smime/cmscinfo.c | 360 + mozilla/security/nss/lib/smime/cmscipher.c | 749 + mozilla/security/nss/lib/smime/cmsdecode.c | 748 + mozilla/security/nss/lib/smime/cmsdigdata.c | 231 + mozilla/security/nss/lib/smime/cmsdigest.c | 294 + mozilla/security/nss/lib/smime/cmsencdata.c | 283 + mozilla/security/nss/lib/smime/cmsencode.c | 764 + mozilla/security/nss/lib/smime/cmsenvdata.c | 421 + mozilla/security/nss/lib/smime/cmslocal.h | 346 + mozilla/security/nss/lib/smime/cmsmessage.c | 321 + mozilla/security/nss/lib/smime/cmspubkey.c | 565 + mozilla/security/nss/lib/smime/cmsrecinfo.c | 717 + mozilla/security/nss/lib/smime/cmsreclist.c | 201 + mozilla/security/nss/lib/smime/cmsreclist.h | 62 + mozilla/security/nss/lib/smime/cmssigdata.c | 1146 + mozilla/security/nss/lib/smime/cmssiginfo.c | 1038 + mozilla/security/nss/lib/smime/cmst.h | 534 + mozilla/security/nss/lib/smime/cmsutil.c | 351 + mozilla/security/nss/lib/smime/config.mk | 95 + mozilla/security/nss/lib/smime/manifest.mn | 84 + mozilla/security/nss/lib/smime/smime.def | 275 + mozilla/security/nss/lib/smime/smime.h | 156 + mozilla/security/nss/lib/smime/smime.rc | 100 + mozilla/security/nss/lib/smime/smimemessage.c | 218 + mozilla/security/nss/lib/smime/smimesym.c | 8 + mozilla/security/nss/lib/smime/smimeutil.c | 795 + mozilla/security/nss/lib/smime/smimever.c | 56 + mozilla/security/nss/lib/softoken/Makefile | 100 + mozilla/security/nss/lib/softoken/config.mk | 103 + mozilla/security/nss/lib/softoken/ecdecode.c | 641 + mozilla/security/nss/lib/softoken/fipsaudt.c | 351 + mozilla/security/nss/lib/softoken/fipstest.c | 2155 + mozilla/security/nss/lib/softoken/fipstokn.c | 1607 + mozilla/security/nss/lib/softoken/jpakesftk.c | 396 + .../security/nss/lib/softoken/legacydb/Makefile | 82 + .../security/nss/lib/softoken/legacydb/cdbhdl.h | 85 + .../security/nss/lib/softoken/legacydb/config.mk | 98 + .../security/nss/lib/softoken/legacydb/dbmshim.c | 647 + mozilla/security/nss/lib/softoken/legacydb/keydb.c | 2272 + .../security/nss/lib/softoken/legacydb/keydbi.h | 86 + .../security/nss/lib/softoken/legacydb/lgattr.c | 1824 + .../security/nss/lib/softoken/legacydb/lgcreate.c | 1011 + mozilla/security/nss/lib/softoken/legacydb/lgdb.h | 216 + .../security/nss/lib/softoken/legacydb/lgdestroy.c | 144 + .../security/nss/lib/softoken/legacydb/lgfind.c | 946 + .../security/nss/lib/softoken/legacydb/lginit.c | 674 + .../security/nss/lib/softoken/legacydb/lgutil.c | 424 + .../security/nss/lib/softoken/legacydb/lowcert.c | 831 + .../security/nss/lib/softoken/legacydb/lowkey.c | 468 + .../security/nss/lib/softoken/legacydb/lowkeyi.h | 198 + .../security/nss/lib/softoken/legacydb/lowkeyti.h | 170 + .../security/nss/lib/softoken/legacydb/manifest.mn | 63 + .../security/nss/lib/softoken/legacydb/nssdbm.def | 64 + .../security/nss/lib/softoken/legacydb/nssdbm.rc | 100 + mozilla/security/nss/lib/softoken/legacydb/pcert.h | 261 + .../security/nss/lib/softoken/legacydb/pcertdb.c | 5389 + .../security/nss/lib/softoken/legacydb/pcertt.h | 452 + .../security/nss/lib/softoken/legacydb/pk11db.c | 773 + mozilla/security/nss/lib/softoken/lgglue.c | 468 + mozilla/security/nss/lib/softoken/lgglue.h | 92 + mozilla/security/nss/lib/softoken/lowkey.c | 525 + mozilla/security/nss/lib/softoken/lowkeyi.h | 108 + mozilla/security/nss/lib/softoken/lowkeyti.h | 127 + mozilla/security/nss/lib/softoken/lowpbe.c | 1410 + mozilla/security/nss/lib/softoken/lowpbe.h | 140 + mozilla/security/nss/lib/softoken/manifest.mn | 100 + mozilla/security/nss/lib/softoken/padbuf.c | 81 + mozilla/security/nss/lib/softoken/pk11init.h | 55 + mozilla/security/nss/lib/softoken/pk11pars.h | 872 + mozilla/security/nss/lib/softoken/pkcs11.c | 4606 + mozilla/security/nss/lib/softoken/pkcs11c.c | 6471 + mozilla/security/nss/lib/softoken/pkcs11i.h | 731 + mozilla/security/nss/lib/softoken/pkcs11ni.h | 52 + mozilla/security/nss/lib/softoken/pkcs11u.c | 2012 + mozilla/security/nss/lib/softoken/rsawrapr.c | 917 + mozilla/security/nss/lib/softoken/sdb.c | 2065 + mozilla/security/nss/lib/softoken/sdb.h | 111 + mozilla/security/nss/lib/softoken/secmodt.h | 503 + mozilla/security/nss/lib/softoken/sftkdb.c | 2769 + mozilla/security/nss/lib/softoken/sftkdb.h | 118 + mozilla/security/nss/lib/softoken/sftkdbt.h | 51 + mozilla/security/nss/lib/softoken/sftkdbti.h | 92 + mozilla/security/nss/lib/softoken/sftkmod.c | 734 + mozilla/security/nss/lib/softoken/sftkpars.c | 650 + mozilla/security/nss/lib/softoken/sftkpars.h | 49 + mozilla/security/nss/lib/softoken/sftkpwd.c | 1309 + mozilla/security/nss/lib/softoken/softkver.c | 56 + mozilla/security/nss/lib/softoken/softkver.h | 67 + mozilla/security/nss/lib/softoken/softoken.h | 385 + mozilla/security/nss/lib/softoken/softokn.def | 61 + mozilla/security/nss/lib/softoken/softokn.rc | 100 + mozilla/security/nss/lib/softoken/softoknt.h | 94 + mozilla/security/nss/lib/softoken/tlsprf.c | 215 + mozilla/security/nss/lib/sqlite/Makefile | 80 + mozilla/security/nss/lib/sqlite/README | 6 + mozilla/security/nss/lib/sqlite/config.mk | 69 + mozilla/security/nss/lib/sqlite/manifest.mn | 66 + mozilla/security/nss/lib/sqlite/sqlite.def | 141 + mozilla/security/nss/lib/sqlite/sqlite3.c | 110864 ++++++++++++++++++ mozilla/security/nss/lib/sqlite/sqlite3.h | 5662 + mozilla/security/nss/lib/ssl/Makefile | 93 + mozilla/security/nss/lib/ssl/authcert.c | 122 + mozilla/security/nss/lib/ssl/cmpcert.c | 123 + mozilla/security/nss/lib/ssl/config.mk | 120 + mozilla/security/nss/lib/ssl/derive.c | 853 + mozilla/security/nss/lib/ssl/manifest.mn | 83 + mozilla/security/nss/lib/ssl/notes.txt | 166 + mozilla/security/nss/lib/ssl/nsskea.c | 78 + mozilla/security/nss/lib/ssl/os2_err.c | 313 + mozilla/security/nss/lib/ssl/os2_err.h | 86 + mozilla/security/nss/lib/ssl/preenc.h | 146 + mozilla/security/nss/lib/ssl/prelib.c | 67 + mozilla/security/nss/lib/ssl/ssl.def | 154 + mozilla/security/nss/lib/ssl/ssl.h | 635 + mozilla/security/nss/lib/ssl/ssl.rc | 100 + mozilla/security/nss/lib/ssl/ssl3con.c | 9493 ++ mozilla/security/nss/lib/ssl/ssl3ecc.c | 1193 + mozilla/security/nss/lib/ssl/ssl3ext.c | 1521 + mozilla/security/nss/lib/ssl/ssl3gthr.c | 255 + mozilla/security/nss/lib/ssl/ssl3prot.h | 350 + mozilla/security/nss/lib/ssl/sslauth.c | 280 + mozilla/security/nss/lib/ssl/sslcon.c | 3854 + mozilla/security/nss/lib/ssl/ssldef.c | 238 + mozilla/security/nss/lib/ssl/sslenum.c | 165 + mozilla/security/nss/lib/ssl/sslerr.c | 74 + mozilla/security/nss/lib/ssl/sslerr.h | 210 + mozilla/security/nss/lib/ssl/sslgathr.c | 483 + mozilla/security/nss/lib/ssl/sslimpl.h | 1633 + mozilla/security/nss/lib/ssl/sslinfo.c | 357 + mozilla/security/nss/lib/ssl/sslmutex.c | 663 + mozilla/security/nss/lib/ssl/sslmutex.h | 155 + mozilla/security/nss/lib/ssl/sslnonce.c | 530 + mozilla/security/nss/lib/ssl/sslproto.h | 231 + mozilla/security/nss/lib/ssl/sslreveal.c | 150 + mozilla/security/nss/lib/ssl/sslsecur.c | 1527 + mozilla/security/nss/lib/ssl/sslsnce.c | 2162 + mozilla/security/nss/lib/ssl/sslsock.c | 2396 + mozilla/security/nss/lib/ssl/sslt.h | 211 + mozilla/security/nss/lib/ssl/ssltrace.c | 276 + mozilla/security/nss/lib/ssl/sslver.c | 56 + mozilla/security/nss/lib/ssl/unix_err.c | 550 + mozilla/security/nss/lib/ssl/unix_err.h | 90 + mozilla/security/nss/lib/ssl/win32err.c | 376 + mozilla/security/nss/lib/ssl/win32err.h | 84 + mozilla/security/nss/lib/sysinit/Makefile | 80 + mozilla/security/nss/lib/sysinit/config.mk | 112 + mozilla/security/nss/lib/sysinit/manifest.mn | 47 + mozilla/security/nss/lib/sysinit/nsssysinit.c | 459 + mozilla/security/nss/lib/util/Makefile | 88 + mozilla/security/nss/lib/util/base64.h | 75 + mozilla/security/nss/lib/util/ciferfam.h | 92 + mozilla/security/nss/lib/util/config.mk | 77 + mozilla/security/nss/lib/util/derdec.c | 221 + mozilla/security/nss/lib/util/derenc.c | 505 + mozilla/security/nss/lib/util/dersubr.c | 266 + mozilla/security/nss/lib/util/dertime.c | 342 + mozilla/security/nss/lib/util/manifest.mn | 111 + mozilla/security/nss/lib/util/nssb64.h | 128 + mozilla/security/nss/lib/util/nssb64d.c | 864 + mozilla/security/nss/lib/util/nssb64e.c | 765 + mozilla/security/nss/lib/util/nssb64t.h | 49 + mozilla/security/nss/lib/util/nssilckt.h | 223 + mozilla/security/nss/lib/util/nssilock.c | 530 + mozilla/security/nss/lib/util/nssilock.h | 320 + mozilla/security/nss/lib/util/nsslocks.h | 45 + mozilla/security/nss/lib/util/nssrwlk.c | 479 + mozilla/security/nss/lib/util/nssrwlk.h | 164 + mozilla/security/nss/lib/util/nssrwlkt.h | 52 + mozilla/security/nss/lib/util/nssutil.def | 256 + mozilla/security/nss/lib/util/nssutil.h | 61 + mozilla/security/nss/lib/util/nssutil.rc | 100 + mozilla/security/nss/lib/util/oidstring.c | 145 + mozilla/security/nss/lib/util/pkcs11.h | 290 + mozilla/security/nss/lib/util/pkcs11f.h | 937 + mozilla/security/nss/lib/util/pkcs11n.h | 403 + mozilla/security/nss/lib/util/pkcs11p.h | 54 + mozilla/security/nss/lib/util/pkcs11t.h | 1785 + mozilla/security/nss/lib/util/pkcs11u.h | 52 + mozilla/security/nss/lib/util/portreg.c | 412 + mozilla/security/nss/lib/util/portreg.h | 117 + mozilla/security/nss/lib/util/quickder.c | 912 + mozilla/security/nss/lib/util/secalgid.c | 157 + mozilla/security/nss/lib/util/secasn1.h | 326 + mozilla/security/nss/lib/util/secasn1d.c | 3269 + mozilla/security/nss/lib/util/secasn1e.c | 1647 + mozilla/security/nss/lib/util/secasn1t.h | 302 + mozilla/security/nss/lib/util/secasn1u.c | 131 + mozilla/security/nss/lib/util/seccomon.h | 119 + mozilla/security/nss/lib/util/secder.h | 211 + mozilla/security/nss/lib/util/secdert.h | 163 + mozilla/security/nss/lib/util/secdig.c | 212 + mozilla/security/nss/lib/util/secdig.h | 136 + mozilla/security/nss/lib/util/secdigt.h | 61 + mozilla/security/nss/lib/util/secerr.h | 244 + mozilla/security/nss/lib/util/secitem.c | 324 + mozilla/security/nss/lib/util/secitem.h | 128 + mozilla/security/nss/lib/util/secload.c | 217 + mozilla/security/nss/lib/util/secoid.c | 2177 + mozilla/security/nss/lib/util/secoid.h | 175 + mozilla/security/nss/lib/util/secoidt.h | 500 + mozilla/security/nss/lib/util/secplcy.c | 117 + mozilla/security/nss/lib/util/secplcy.h | 138 + mozilla/security/nss/lib/util/secport.c | 716 + mozilla/security/nss/lib/util/secport.h | 283 + mozilla/security/nss/lib/util/sectime.c | 194 + mozilla/security/nss/lib/util/templates.c | 168 + mozilla/security/nss/lib/util/utf8.c | 1833 + mozilla/security/nss/lib/util/utilrename.h | 194 + mozilla/security/nss/lib/zlib/Makefile | 88 + mozilla/security/nss/lib/zlib/README | 125 + mozilla/security/nss/lib/zlib/adler32.c | 149 + mozilla/security/nss/lib/zlib/compress.c | 79 + mozilla/security/nss/lib/zlib/config.mk | 48 + mozilla/security/nss/lib/zlib/crc32.c | 423 + mozilla/security/nss/lib/zlib/crc32.h | 441 + mozilla/security/nss/lib/zlib/deflate.c | 1736 + mozilla/security/nss/lib/zlib/deflate.h | 331 + mozilla/security/nss/lib/zlib/example.c | 565 + mozilla/security/nss/lib/zlib/gzio.c | 1026 + mozilla/security/nss/lib/zlib/infback.c | 623 + mozilla/security/nss/lib/zlib/inffast.c | 318 + mozilla/security/nss/lib/zlib/inffast.h | 11 + mozilla/security/nss/lib/zlib/inffixed.h | 94 + mozilla/security/nss/lib/zlib/inflate.c | 1368 + mozilla/security/nss/lib/zlib/inflate.h | 115 + mozilla/security/nss/lib/zlib/inftrees.c | 329 + mozilla/security/nss/lib/zlib/inftrees.h | 55 + mozilla/security/nss/lib/zlib/manifest.mn | 68 + mozilla/security/nss/lib/zlib/minigzip.c | 318 + mozilla/security/nss/lib/zlib/trees.c | 1219 + mozilla/security/nss/lib/zlib/trees.h | 128 + mozilla/security/nss/lib/zlib/uncompr.c | 61 + mozilla/security/nss/lib/zlib/zconf.h | 324 + mozilla/security/nss/lib/zlib/zlib.h | 1357 + mozilla/security/nss/lib/zlib/zutil.c | 318 + mozilla/security/nss/lib/zlib/zutil.h | 267 + mozilla/security/nss/manifest.mn | 47 + mozilla/security/nss/pkg/Makefile | 59 + mozilla/security/nss/pkg/linux/Makefile | 122 + mozilla/security/nss/pkg/linux/sun-nss.spec | 84 + mozilla/security/nss/pkg/solaris/Makefile | 125 + mozilla/security/nss/pkg/solaris/Makefile-devl.com | 71 + .../security/nss/pkg/solaris/Makefile-devl.targ | 62 + mozilla/security/nss/pkg/solaris/Makefile-tlsu.com | 71 + .../security/nss/pkg/solaris/Makefile-tlsu.targ | 70 + mozilla/security/nss/pkg/solaris/Makefile.com | 71 + mozilla/security/nss/pkg/solaris/Makefile.targ | 70 + mozilla/security/nss/pkg/solaris/SUNWtls/Makefile | 52 + mozilla/security/nss/pkg/solaris/SUNWtls/pkgdepend | 64 + .../security/nss/pkg/solaris/SUNWtls/pkginfo.tmpl | 70 + .../security/nss/pkg/solaris/SUNWtls/prototype_com | 77 + .../nss/pkg/solaris/SUNWtls/prototype_i386 | 90 + .../nss/pkg/solaris/SUNWtls/prototype_sparc | 103 + mozilla/security/nss/pkg/solaris/SUNWtlsd/Makefile | 52 + .../security/nss/pkg/solaris/SUNWtlsd/pkgdepend | 59 + .../security/nss/pkg/solaris/SUNWtlsd/pkginfo.tmpl | 70 + .../security/nss/pkg/solaris/SUNWtlsd/prototype | 162 + mozilla/security/nss/pkg/solaris/SUNWtlsu/Makefile | 52 + .../security/nss/pkg/solaris/SUNWtlsu/pkgdepend | 58 + .../security/nss/pkg/solaris/SUNWtlsu/pkginfo.tmpl | 70 + .../nss/pkg/solaris/SUNWtlsu/prototype_com | 73 + .../nss/pkg/solaris/SUNWtlsu/prototype_i386 | 78 + .../nss/pkg/solaris/SUNWtlsu/prototype_sparc | 78 + .../security/nss/pkg/solaris/bld_awk_pkginfo.ksh | 141 + .../nss/pkg/solaris/common_files/copyright | 38 + mozilla/security/nss/pkg/solaris/proto64.mk | 50 + mozilla/security/nss/tests/README.txt | 6 + mozilla/security/nss/tests/all.sh | 359 + mozilla/security/nss/tests/cert/cert.sh | 1435 + mozilla/security/nss/tests/cert/certext.txt | 162 + mozilla/security/nss/tests/chains/chains.sh | 1081 + .../nss/tests/chains/ocspd-config/ocspd-certs.sh | 116 + .../tests/chains/ocspd-config/ocspd.conf.template | 45 + .../security/nss/tests/chains/ocspd-config/readme | 16 + .../security/nss/tests/chains/scenarios/aia.cfg | 67 + .../nss/tests/chains/scenarios/anypolicy.cfg | 109 + .../tests/chains/scenarios/anypolicywithlevel.cfg | 431 + .../security/nss/tests/chains/scenarios/bridge.cfg | 138 + .../nss/tests/chains/scenarios/bridgewithaia.cfg | 86 + .../tests/chains/scenarios/bridgewithhalfaia.cfg | 121 + .../bridgewithpolicyextensionandmapping.cfg | 219 + .../security/nss/tests/chains/scenarios/crldp.cfg | 137 + .../security/nss/tests/chains/scenarios/dsa.cfg | 104 + .../nss/tests/chains/scenarios/explicitPolicy.cfg | 110 + .../nss/tests/chains/scenarios/extension.cfg | 134 + .../nss/tests/chains/scenarios/extension2.cfg | 172 + .../nss/tests/chains/scenarios/mapping.cfg | 95 + .../nss/tests/chains/scenarios/mapping2.cfg | 103 + .../nss/tests/chains/scenarios/megabridge_3_2.cfg | 162 + .../security/nss/tests/chains/scenarios/ocsp.cfg | 209 + .../security/nss/tests/chains/scenarios/ocspd.cfg | 169 + .../nss/tests/chains/scenarios/realcerts.cfg | 61 + .../security/nss/tests/chains/scenarios/revoc.cfg | 118 + .../security/nss/tests/chains/scenarios/scenarios | 53 + mozilla/security/nss/tests/cipher/cipher.sh | 138 + mozilla/security/nss/tests/cipher/cipher.txt | 78 + mozilla/security/nss/tests/cipher/dsa.txt | 43 + mozilla/security/nss/tests/cipher/hash.txt | 43 + mozilla/security/nss/tests/cipher/performance.sh | 187 + mozilla/security/nss/tests/cipher/rsa.txt | 43 + mozilla/security/nss/tests/cipher/symmkey.txt | 64 + mozilla/security/nss/tests/clean_tbx | 172 + mozilla/security/nss/tests/cmdtests/cmdtests.sh | 133 + mozilla/security/nss/tests/common/Makefile | 53 + mozilla/security/nss/tests/common/cleanup.sh | 79 + mozilla/security/nss/tests/common/init.sh | 658 + .../security/nss/tests/common/results_header.html | 6 + mozilla/security/nss/tests/core_watch | 45 + mozilla/security/nss/tests/crmf/crmf.sh | 121 + mozilla/security/nss/tests/dbtests/dbtests.sh | 285 + mozilla/security/nss/tests/dbupgrade/dbupgrade.sh | 138 + mozilla/security/nss/tests/dll_version.sh | 50 + mozilla/security/nss/tests/doc/clean.gif | Bin 0 -> 5503 bytes mozilla/security/nss/tests/doc/nssqa.txt | 108 + .../nss/tests/doc/platform_specific_problems | 110 + mozilla/security/nss/tests/doc/qa_wrapper.html | 269 + mozilla/security/nss/tests/fips/fips.sh | 319 + mozilla/security/nss/tests/header | 1636 + mozilla/security/nss/tests/iopr/cert_iopr.sh | 437 + mozilla/security/nss/tests/iopr/ocsp_iopr.sh | 263 + .../nss/tests/iopr/server_scr/apache_unix.cfg | 78 + .../security/nss/tests/iopr/server_scr/cert_gen.sh | 398 + .../security/nss/tests/iopr/server_scr/cipher.list | 166 + .../security/nss/tests/iopr/server_scr/client.cgi | 557 + mozilla/security/nss/tests/iopr/server_scr/config | 48 + .../nss/tests/iopr/server_scr/iis_windows.cfg | 64 + .../nss/tests/iopr/server_scr/iopr_server.cfg | 98 + .../security/nss/tests/iopr/server_scr/sslreq.dat | 2 + mozilla/security/nss/tests/iopr/ssl_iopr.sh | 675 + mozilla/security/nss/tests/jss_dll_version.sh | 22 + mozilla/security/nss/tests/jssdir | 28 + mozilla/security/nss/tests/jssqa | 220 + mozilla/security/nss/tests/libpkix/cert_trust.map | 6 + .../nss/tests/libpkix/certs/BrAirWaysBadSig.cert | Bin 0 -> 1647 bytes .../libpkix/certs/CertificatePoliciesCritical.crt | Bin 0 -> 805 bytes .../nss/tests/libpkix/certs/GoodCACert.crt | Bin 0 -> 625 bytes .../security/nss/tests/libpkix/certs/OCSPCA1.cert | Bin 0 -> 585 bytes .../security/nss/tests/libpkix/certs/OCSPCA1.p12 | Bin 0 -> 1700 bytes .../security/nss/tests/libpkix/certs/OCSPCA2.cert | Bin 0 -> 585 bytes .../security/nss/tests/libpkix/certs/OCSPCA2.p12 | Bin 0 -> 1700 bytes .../security/nss/tests/libpkix/certs/OCSPCA3.cert | Bin 0 -> 585 bytes .../security/nss/tests/libpkix/certs/OCSPCA3.p12 | Bin 0 -> 1700 bytes .../security/nss/tests/libpkix/certs/OCSPEE11.cert | Bin 0 -> 563 bytes .../security/nss/tests/libpkix/certs/OCSPEE12.cert | Bin 0 -> 563 bytes .../security/nss/tests/libpkix/certs/OCSPEE13.cert | Bin 0 -> 563 bytes .../security/nss/tests/libpkix/certs/OCSPEE14.cert | Bin 0 -> 563 bytes .../security/nss/tests/libpkix/certs/OCSPEE15.cert | Bin 0 -> 563 bytes .../security/nss/tests/libpkix/certs/OCSPEE21.cert | Bin 0 -> 563 bytes .../security/nss/tests/libpkix/certs/OCSPEE22.cert | Bin 0 -> 563 bytes .../security/nss/tests/libpkix/certs/OCSPEE23.cert | Bin 0 -> 563 bytes .../security/nss/tests/libpkix/certs/OCSPEE31.cert | Bin 0 -> 563 bytes .../security/nss/tests/libpkix/certs/OCSPEE32.cert | Bin 0 -> 563 bytes .../security/nss/tests/libpkix/certs/OCSPEE33.cert | Bin 0 -> 563 bytes .../security/nss/tests/libpkix/certs/OCSPRoot.cert | Bin 0 -> 549 bytes .../security/nss/tests/libpkix/certs/OCSPRoot.p12 | Bin 0 -> 1662 bytes .../security/nss/tests/libpkix/certs/PayPalEE.cert | Bin 0 -> 1615 bytes .../nss/tests/libpkix/certs/PayPalICA.cert | Bin 0 -> 1512 bytes .../nss/tests/libpkix/certs/PayPalRootCA.cert | Bin 0 -> 1249 bytes .../nss/tests/libpkix/certs/TestCA.ca.cert | Bin 0 -> 628 bytes .../nss/tests/libpkix/certs/TestUser50.cert | Bin 0 -> 613 bytes .../nss/tests/libpkix/certs/TestUser51.cert | Bin 0 -> 613 bytes .../libpkix/certs/TrustAnchorRootCertificate.crt | Bin 0 -> 572 bytes .../libpkix/certs/ValidCertificatePathTest1EE.crt | Bin 0 -> 622 bytes .../security/nss/tests/libpkix/certs/anchor2dsa | Bin 0 -> 906 bytes .../security/nss/tests/libpkix/certs/crldiff.crl | Bin 0 -> 237 bytes .../security/nss/tests/libpkix/certs/crlgood.crl | Bin 0 -> 237 bytes .../libpkix/certs/extKeyUsage/codeSigningEKUCert | Bin 0 -> 696 bytes .../tests/libpkix/certs/extKeyUsage/multiEKUCert | Bin 0 -> 716 bytes .../nss/tests/libpkix/certs/extKeyUsage/noEKUCert | Bin 0 -> 742 bytes .../tests/libpkix/certs/generalName/altNameDnCert | Bin 0 -> 748 bytes .../libpkix/certs/generalName/altNameDnCert_diff | Bin 0 -> 747 bytes .../tests/libpkix/certs/generalName/altNameDnsCert | Bin 0 -> 700 bytes .../libpkix/certs/generalName/altNameDnsCert_diff | Bin 0 -> 700 bytes .../tests/libpkix/certs/generalName/altNameEdiCert | Bin 0 -> 702 bytes .../libpkix/certs/generalName/altNameEdiCert_diff | Bin 0 -> 700 bytes .../tests/libpkix/certs/generalName/altNameIpCert | Bin 0 -> 692 bytes .../libpkix/certs/generalName/altNameIpCert_diff | Bin 0 -> 692 bytes .../libpkix/certs/generalName/altNameNoneCert | Bin 0 -> 742 bytes .../tests/libpkix/certs/generalName/altNameOidCert | Bin 0 -> 691 bytes .../libpkix/certs/generalName/altNameOidCert_diff | Bin 0 -> 694 bytes .../libpkix/certs/generalName/altNameOtherCert | Bin 0 -> 698 bytes .../certs/generalName/altNameOtherCert_diff | Bin 0 -> 698 bytes .../libpkix/certs/generalName/altNameRfc822Cert | Bin 0 -> 740 bytes .../certs/generalName/altNameRfc822Cert_diff | Bin 0 -> 703 bytes .../libpkix/certs/generalName/altNameRfc822DnsCert | Bin 0 -> 718 bytes .../tests/libpkix/certs/generalName/altNameUriCert | Bin 0 -> 706 bytes .../libpkix/certs/generalName/altNameUriCert_diff | Bin 0 -> 708 bytes .../libpkix/certs/generalName/altNameX400Cert | Bin 0 -> 691 bytes .../libpkix/certs/generalName/altNameX400Cert_diff | Bin 0 -> 691 bytes .../nss/tests/libpkix/certs/hanfeiyu2hanfeiyu | Bin 0 -> 669 bytes mozilla/security/nss/tests/libpkix/certs/hy2hc-bc | Bin 0 -> 668 bytes mozilla/security/nss/tests/libpkix/certs/hy2hy-bc0 | Bin 0 -> 685 bytes .../nss/tests/libpkix/certs/issuer-hanfei.crl | Bin 0 -> 199 bytes .../nss/tests/libpkix/certs/issuer-none.crl | Bin 0 -> 196 bytes .../libpkix/certs/keyIdentifier/authKeyIDCert | Bin 0 -> 536 bytes .../libpkix/certs/keyIdentifier/subjKeyIDCert | Bin 0 -> 906 bytes .../tests/libpkix/certs/keyUsage/decipherOnlyCert | Bin 0 -> 692 bytes .../tests/libpkix/certs/keyUsage/encipherOnlyCert | Bin 0 -> 692 bytes .../libpkix/certs/keyUsage/multiKeyUsagesCert | Bin 0 -> 742 bytes .../tests/libpkix/certs/keyUsage/noKeyUsagesCert | Bin 0 -> 675 bytes .../nss/tests/libpkix/certs/noExtensionsCert | Bin 0 -> 680 bytes mozilla/security/nss/tests/libpkix/certs/nss2alice | Bin 0 -> 602 bytes .../tests/libpkix/certs/publicKey/dsaWithParams | Bin 0 -> 906 bytes .../tests/libpkix/certs/publicKey/dsaWithoutParams | Bin 0 -> 536 bytes .../nss/tests/libpkix/certs/publicKey/labs2yassir | Bin 0 -> 676 bytes .../nss/tests/libpkix/certs/publicKey/yassir2labs | Bin 0 -> 676 bytes mozilla/security/nss/tests/libpkix/certs/sun2sun | Bin 0 -> 666 bytes .../security/nss/tests/libpkix/certs/yassir2bcn | Bin 0 -> 742 bytes .../security/nss/tests/libpkix/certs/yassir2yassir | Bin 0 -> 760 bytes .../nss/tests/libpkix/common/libpkix_init.sh | 357 + .../nss/tests/libpkix/common/libpkix_init_nist.sh | 103 + mozilla/security/nss/tests/libpkix/libpkix.sh | 172 + .../tests/libpkix/pkix_pl_tests/module/cert8.db | Bin 0 -> 65536 bytes .../nss/tests/libpkix/pkix_pl_tests/module/key3.db | Bin 0 -> 32768 bytes .../module/rev_data/local/crldiff.crl | Bin 0 -> 237 bytes .../module/rev_data/local/crlgood.crl | Bin 0 -> 237 bytes .../module/rev_data/local/issuer-hanfei.crl | Bin 0 -> 199 bytes .../module/rev_data/local/issuer-none.crl | Bin 0 -> 196 bytes .../pkix_pl_tests/module/rev_data/test_eku_all.crt | Bin 0 -> 774 bytes .../rev_data/test_eku_allbutcodesigningEE.crt | Bin 0 -> 732 bytes .../module/rev_data/test_eku_clientauth.crt | Bin 0 -> 726 bytes .../module/rev_data/test_eku_clientauthEE.crt | Bin 0 -> 694 bytes .../rev_data/test_eku_codesigning_clientauth.crt | Bin 0 -> 734 bytes .../libpkix/pkix_pl_tests/module/runPLTests.sh | 134 + .../tests/libpkix/pkix_pl_tests/module/secmod.db | Bin 0 -> 32768 bytes .../pkix_pl_tests/pki/rev_data/local/README | 3 + .../pkix_pl_tests/pki/rev_data/local/crldiff.crl | Bin 0 -> 237 bytes .../pkix_pl_tests/pki/rev_data/local/crlgood.crl | Bin 0 -> 237 bytes .../pki/rev_data/local/issuer-hanfei.crl | Bin 0 -> 199 bytes .../pki/rev_data/local/issuer-none.crl | Bin 0 -> 196 bytes .../tests/libpkix/pkix_pl_tests/pki/runPLTests.sh | 114 + .../nss/tests/libpkix/pkix_pl_tests/runPLTests.sh | 100 + .../libpkix/pkix_pl_tests/system/runPLTests.sh | 79 + .../nss/tests/libpkix/pkix_tests/certsel/keyUsage | 0 .../tests/libpkix/pkix_tests/certsel/runTests.sh | 66 + .../tests/libpkix/pkix_tests/checker/runTests.sh | 64 + .../tests/libpkix/pkix_tests/crlsel/runTests.sh | 66 + .../tests/libpkix/pkix_tests/params/runTests.sh | 69 + .../tests/libpkix/pkix_tests/results/runTests.sh | 69 + .../nss/tests/libpkix/pkix_tests/runTests.sh | 131 + .../nss/tests/libpkix/pkix_tests/store/runTests.sh | 65 + .../tests/libpkix/pkix_tests/top/anchorcert.crt | Bin 0 -> 694 bytes .../top/build_data/backtracking/signature/greg.crl | Bin 0 -> 169 bytes .../backtracking/signature/greg2yassir_badsig.crt | Bin 0 -> 689 bytes .../top/build_data/backtracking/signature/jes.crl | Bin 0 -> 153 bytes .../build_data/backtracking/signature/jes2greg.crt | Bin 0 -> 671 bytes .../build_data/backtracking/signature/jes2jes.crt | Bin 0 -> 656 bytes .../build_data/backtracking/signature/jes2labs.crt | Bin 0 -> 555 bytes .../top/build_data/backtracking/signature/labs.crl | Bin 0 -> 155 bytes .../backtracking/signature/labs2yassir.crt | Bin 0 -> 675 bytes .../build_data/backtracking/signature/yassir.crl | Bin 0 -> 173 bytes .../backtracking/signature/yassir2hanfei.crt | Bin 0 -> 692 bytes .../build_data/multi_path/signature/fail/greg.crl | Bin 0 -> 169 bytes .../multi_path/signature/fail/greg2yassir.crt | Bin 0 -> 689 bytes .../build_data/multi_path/signature/fail/jes.crl | Bin 0 -> 153 bytes .../multi_path/signature/fail/jes2greg.crt | Bin 0 -> 671 bytes .../multi_path/signature/fail/jes2jes.crt | Bin 0 -> 656 bytes .../multi_path/signature/fail/jes2labs.crt | Bin 0 -> 555 bytes .../build_data/multi_path/signature/fail/labs.crl | Bin 0 -> 155 bytes .../multi_path/signature/fail/labs2yassir.crt | Bin 0 -> 676 bytes .../multi_path/signature/fail/yassir.crl | Bin 0 -> 173 bytes .../multi_path/signature/fail/yassir2hanfei.crt | Bin 0 -> 692 bytes .../build_data/multi_path/signature/pass/greg.crl | Bin 0 -> 169 bytes .../multi_path/signature/pass/greg2yassir.crt | Bin 0 -> 689 bytes .../build_data/multi_path/signature/pass/jes.crl | Bin 0 -> 153 bytes .../multi_path/signature/pass/jes2greg.crt | Bin 0 -> 671 bytes .../multi_path/signature/pass/jes2jes.crt | Bin 0 -> 656 bytes .../multi_path/signature/pass/jes2labs.crt | Bin 0 -> 555 bytes .../build_data/multi_path/signature/pass/labs.crl | Bin 0 -> 155 bytes .../multi_path/signature/pass/labs2yassir.crt | Bin 0 -> 676 bytes .../multi_path/signature/pass/yassir.crl | Bin 0 -> 173 bytes .../multi_path/signature/pass/yassir2hanfei.crt | Bin 0 -> 692 bytes .../build_data/single_path/signature/fail/greg.crl | Bin 0 -> 169 bytes .../signature/fail/greg2yassir_badsig.crt | Bin 0 -> 689 bytes .../build_data/single_path/signature/fail/jes.crl | Bin 0 -> 153 bytes .../single_path/signature/fail/jes2greg.crt | Bin 0 -> 671 bytes .../single_path/signature/fail/jes2jes.crt | Bin 0 -> 656 bytes .../single_path/signature/fail/yassir.crl | Bin 0 -> 173 bytes .../single_path/signature/fail/yassir2hanfei.crt | Bin 0 -> 692 bytes .../build_data/single_path/signature/pass/greg.crl | Bin 0 -> 169 bytes .../single_path/signature/pass/greg2yassir.crt | Bin 0 -> 689 bytes .../build_data/single_path/signature/pass/jes.crl | Bin 0 -> 153 bytes .../single_path/signature/pass/jes2greg.crt | Bin 0 -> 671 bytes .../single_path/signature/pass/jes2jes.crt | Bin 0 -> 656 bytes .../single_path/signature/pass/yassir.crl | Bin 0 -> 173 bytes .../single_path/signature/pass/yassir2hanfei.crt | Bin 0 -> 692 bytes .../top/build_data/test1/greg2yassir.crt | Bin 0 -> 689 bytes .../pkix_tests/top/build_data/test1/jes2greg.crt | Bin 0 -> 671 bytes .../pkix_tests/top/build_data/test1/jes2jes.crt | Bin 0 -> 656 bytes .../pkix_tests/top/build_data/test1/jes2labs.crt | Bin 0 -> 555 bytes .../top/build_data/test1/labs2yassir.crt | Bin 0 -> 676 bytes .../top/build_data/test1/yassir2hanfei.crt | Bin 0 -> 692 bytes .../top/build_data/test1/yassir2richard.crt | Bin 0 -> 520 bytes .../pkix_tests/top/build_data/test2/jes2greg.crt | Bin 0 -> 671 bytes .../pkix_tests/top/build_data/test2/jes2jes.crt | Bin 0 -> 656 bytes .../pkix_tests/top/build_data/test2/jes2labs.crt | Bin 0 -> 555 bytes .../top/build_data/test2/labs2yassir.crt | Bin 0 -> 669 bytes .../top/build_data/test2/nelson2yassir.crt | Bin 0 -> 676 bytes .../top/build_data/test2/yassir2hanfei.crt | Bin 0 -> 692 bytes .../top/build_data/test2/yassir2richard.crt | Bin 0 -> 520 bytes .../pkix_tests/top/build_data/test3/jes2greg.crt | Bin 0 -> 671 bytes .../pkix_tests/top/build_data/test3/jes2jes.crt | Bin 0 -> 656 bytes .../pkix_tests/top/build_data/test3/jes2labs.crt | Bin 0 -> 555 bytes .../top/build_data/test3/labs2yassir.crt | Bin 0 -> 669 bytes .../top/build_data/test3/nelson2yassir.crt | Bin 0 -> 676 bytes .../top/build_data/test3/yassir2hanfei.crt | Bin 0 -> 692 bytes .../nss/tests/libpkix/pkix_tests/top/cert8.db | Bin 0 -> 65536 bytes .../nss/tests/libpkix/pkix_tests/top/goodcert.crt | Bin 0 -> 1031 bytes .../nss/tests/libpkix/pkix_tests/top/key3.db | Bin 0 -> 32768 bytes .../pkix_tests/top/rev_data/crlchecker/chem.crl | Bin 0 -> 239 bytes .../top/rev_data/crlchecker/chem2prof.crt | Bin 0 -> 709 bytes .../top/rev_data/crlchecker/phy2prof.crt | Bin 0 -> 707 bytes .../pkix_tests/top/rev_data/crlchecker/phys.crl | Bin 0 -> 201 bytes .../pkix_tests/top/rev_data/crlchecker/prof.crl | Bin 0 -> 203 bytes .../top/rev_data/crlchecker/prof2test.crt | Bin 0 -> 691 bytes .../pkix_tests/top/rev_data/crlchecker/sci.crl | Bin 0 -> 200 bytes .../top/rev_data/crlchecker/sci2chem.crt | Bin 0 -> 707 bytes .../pkix_tests/top/rev_data/crlchecker/sci2phy.crt | Bin 0 -> 703 bytes .../pkix_tests/top/rev_data/crlchecker/sci2sci.crt | Bin 0 -> 703 bytes .../pkix_tests/top/rev_data/crlchecker/test.crl | Bin 0 -> 205 bytes .../tests/libpkix/pkix_tests/top/revokedcert.crt | Bin 0 -> 1034 bytes .../nss/tests/libpkix/pkix_tests/top/runTests.sh | 550 + .../nss/tests/libpkix/pkix_tests/top/secmod.db | Bin 0 -> 32768 bytes .../nss/tests/libpkix/pkix_tests/util/runTests.sh | 66 + mozilla/security/nss/tests/libpkix/runTests.sh | 120 + .../security/nss/tests/libpkix/sample_apps/README | 110 + .../nss/tests/libpkix/sample_apps/cert8.db | Bin 0 -> 65536 bytes .../security/nss/tests/libpkix/sample_apps/key3.db | Bin 0 -> 32768 bytes .../nss/tests/libpkix/sample_apps/runPerf.sh | 176 + .../nss/tests/libpkix/sample_apps/secmod.db | Bin 0 -> 32768 bytes .../security/nss/tests/libpkix/vfychain_test.lst | 4 + mozilla/security/nss/tests/memleak/ignored | 87 + mozilla/security/nss/tests/memleak/memleak.sh | 934 + mozilla/security/nss/tests/memleak/sslreq.dat | 2 + mozilla/security/nss/tests/merge/merge.sh | 304 + mozilla/security/nss/tests/mksymlinks | 115 + mozilla/security/nss/tests/multinit/multinit.sh | 191 + mozilla/security/nss/tests/multinit/multinit.txt | 79 + mozilla/security/nss/tests/nssdir | 28 + mozilla/security/nss/tests/nsspath | 12 + mozilla/security/nss/tests/nssqa | 286 + mozilla/security/nss/tests/ocsp/ocsp.sh | 84 + mozilla/security/nss/tests/path_uniq | 107 + mozilla/security/nss/tests/perf/perf.sh | 93 + .../nss/tests/pkcs11/netscape/suites/Makefile | 80 + .../nss/tests/pkcs11/netscape/suites/config.mk | 46 + .../nss/tests/pkcs11/netscape/suites/manifest.mn | 41 + .../tests/pkcs11/netscape/suites/security/Makefile | 80 + .../pkcs11/netscape/suites/security/config.mk | 58 + .../pkcs11/netscape/suites/security/manifest.mn | 44 + .../netscape/suites/security/pkcs11/Makefile | 81 + .../netscape/suites/security/pkcs11/config.mk | 61 + .../netscape/suites/security/pkcs11/manifest.mn | 50 + .../netscape/suites/security/pkcs11/pk11test.c | 1363 + .../netscape/suites/security/pkcs11/pk11test.h | 114 + .../netscape/suites/security/pkcs11/pk11test.htp | 53 + .../netscape/suites/security/pkcs11/pkcs11.h | 193 + .../netscape/suites/security/pkcs11/pkcs11.reg | 964 + .../netscape/suites/security/pkcs11/pkcs11.rep | 161 + .../netscape/suites/security/pkcs11/rules.mk | 38 + .../pkcs11/netscape/suites/security/ssl/Makefile | 82 + .../pkcs11/netscape/suites/security/ssl/README | 11 + .../pkcs11/netscape/suites/security/ssl/cert7.db | Bin 0 -> 90112 bytes .../pkcs11/netscape/suites/security/ssl/config.mk | 66 + .../pkcs11/netscape/suites/security/ssl/key3.db | Bin 0 -> 16384 bytes .../netscape/suites/security/ssl/manifest.mn | 57 + .../pkcs11/netscape/suites/security/ssl/ssl.reg | 49198 ++++++++ .../pkcs11/netscape/suites/security/ssl/sslc.c | 296 + .../pkcs11/netscape/suites/security/ssl/sslc.h | 99 + .../pkcs11/netscape/suites/security/ssl/ssls.c | 108 + .../pkcs11/netscape/suites/security/ssl/ssls.h | 130 + .../pkcs11/netscape/suites/security/ssl/sslt.c | 1186 + .../pkcs11/netscape/suites/security/ssl/sslt.h | 241 + .../pkcs11/netscape/suites/security/ssl/sslt.htp | 139 + .../pkcs11/netscape/suites/security/ssl/sslt.rep | 421 + .../nss/tests/pkcs11/netscape/trivial/.cvsignore | 6 + .../nss/tests/pkcs11/netscape/trivial/Makefile.in | 180 + .../nss/tests/pkcs11/netscape/trivial/README.txt | 56 + .../nss/tests/pkcs11/netscape/trivial/acconfig.h | 39 + .../nss/tests/pkcs11/netscape/trivial/config.h.in | 28 + .../nss/tests/pkcs11/netscape/trivial/configure | 1906 + .../nss/tests/pkcs11/netscape/trivial/configure.in | 185 + .../nss/tests/pkcs11/netscape/trivial/install-sh | 251 + .../nss/tests/pkcs11/netscape/trivial/trivial.c | 1316 + mozilla/security/nss/tests/pkits/pkits.sh | 2019 + mozilla/security/nss/tests/platformlist | 11 + mozilla/security/nss/tests/platformlist.tbx | 14 + mozilla/security/nss/tests/qa_stage | 336 + mozilla/security/nss/tests/qa_stat | 938 + mozilla/security/nss/tests/qaclean | 144 + mozilla/security/nss/tests/run_niscc.sh | 657 + mozilla/security/nss/tests/sdr/sdr.sh | 143 + mozilla/security/nss/tests/set_environment | 234 + mozilla/security/nss/tests/smime/alice.txt | 6 + mozilla/security/nss/tests/smime/bob.txt | 6 + mozilla/security/nss/tests/smime/smime.sh | 292 + mozilla/security/nss/tests/ssl/ssl.sh | 999 + mozilla/security/nss/tests/ssl/ssl_dist_stress.sh | 345 + mozilla/security/nss/tests/ssl/sslauth.txt | 98 + mozilla/security/nss/tests/ssl/sslcov.txt | 132 + mozilla/security/nss/tests/ssl/sslreq.dat | 2 + mozilla/security/nss/tests/ssl/sslreq.txt | 2 + mozilla/security/nss/tests/ssl/sslstress.txt | 83 + mozilla/security/nss/tests/tools/sign.html | 40 + mozilla/security/nss/tests/tools/signjs.html | 43 + mozilla/security/nss/tests/tools/tools.sh | 531 + mozilla/security/nss/trademarks.txt | 129 + nss-sysinit.manifest | 8 + packaging/blank-cert8.db | Bin 0 -> 65536 bytes packaging/blank-cert9.db | Bin 0 -> 9216 bytes packaging/blank-key3.db | Bin 0 -> 16384 bytes packaging/blank-key4.db | Bin 0 -> 11264 bytes packaging/blank-secmod.db | Bin 0 -> 16384 bytes packaging/nss-3.12.8-char.patch | 11 + packaging/nss-bug524013.patch | 158 + packaging/nss-config.in | 145 + packaging/nss-enable-pem.patch | 12 + packaging/nss-kernel-3.x.patch | 85 + packaging/nss-no-rpath.patch | 14 + packaging/nss-nolocalsql.patch | 34 + packaging/nss-pem-20101125.tar.bz2 | Bin 0 -> 28548 bytes packaging/nss-prelink.conf | 2 + packaging/nss-sysinit-2.patch | 90 + packaging/nss-sysinit.patch | 15 + packaging/nss.changes | 173 + packaging/nss.pc.in | 11 + packaging/nss.spec | 529 + packaging/setup-nsssysinit.sh | 56 + packaging/system-pkcs11.txt | 5 + 2151 files changed, 915801 insertions(+) create mode 100644 LICENSE create mode 100644 mozilla/dbm/.cvsignore create mode 100644 mozilla/dbm/Makefile.in create mode 100644 mozilla/dbm/include/.cvsignore create mode 100644 mozilla/dbm/include/Makefile.in create mode 100644 mozilla/dbm/include/Makefile.win create mode 100644 mozilla/dbm/include/cdefs.h create mode 100644 mozilla/dbm/include/extern.h create mode 100644 mozilla/dbm/include/hash.h create mode 100644 mozilla/dbm/include/hsearch.h create mode 100644 mozilla/dbm/include/mcom_db.h create mode 100644 mozilla/dbm/include/mpool.h create mode 100644 mozilla/dbm/include/ncompat.h create mode 100644 mozilla/dbm/include/page.h create mode 100644 mozilla/dbm/include/queue.h create mode 100644 mozilla/dbm/include/search.h create mode 100644 mozilla/dbm/include/winfile.h create mode 100644 mozilla/dbm/src/.cvsignore create mode 100644 mozilla/dbm/src/Makefile.in create mode 100644 mozilla/dbm/src/Makefile.win create mode 100644 mozilla/dbm/src/db.c create mode 100644 mozilla/dbm/src/h_bigkey.c create mode 100644 mozilla/dbm/src/h_func.c create mode 100644 mozilla/dbm/src/h_log2.c create mode 100644 mozilla/dbm/src/h_page.c create mode 100644 mozilla/dbm/src/hash.c create mode 100644 mozilla/dbm/src/hash_buf.c create mode 100644 mozilla/dbm/src/memmove.c create mode 100644 mozilla/dbm/src/mktemp.c create mode 100644 mozilla/dbm/src/snprintf.c create mode 100644 mozilla/dbm/src/strerror.c create mode 100644 mozilla/dbm/tests/.cvsignore create mode 100644 mozilla/dbm/tests/Makefile.in create mode 100644 mozilla/dbm/tests/dbmtest.pkg create mode 100644 mozilla/dbm/tests/lots.c create mode 100644 mozilla/security/coreconf/AIX.mk create mode 100644 mozilla/security/coreconf/BSD_OS.mk create mode 100644 mozilla/security/coreconf/BeOS.mk create mode 100644 mozilla/security/coreconf/Darwin.mk create mode 100644 mozilla/security/coreconf/FreeBSD.mk create mode 100644 mozilla/security/coreconf/HP-UX.mk create mode 100644 mozilla/security/coreconf/HP-UXA.09.03.mk create mode 100644 mozilla/security/coreconf/HP-UXA.09.07.mk create mode 100644 mozilla/security/coreconf/HP-UXA.09.mk create mode 100644 mozilla/security/coreconf/HP-UXB.10.01.mk create mode 100644 mozilla/security/coreconf/HP-UXB.10.10.mk create mode 100644 mozilla/security/coreconf/HP-UXB.10.20.mk create mode 100644 mozilla/security/coreconf/HP-UXB.10.30.mk create mode 100644 mozilla/security/coreconf/HP-UXB.10.mk create mode 100644 mozilla/security/coreconf/HP-UXB.11.00.mk create mode 100644 mozilla/security/coreconf/HP-UXB.11.11.mk create mode 100644 mozilla/security/coreconf/HP-UXB.11.20.mk create mode 100644 mozilla/security/coreconf/HP-UXB.11.22.mk create mode 100644 mozilla/security/coreconf/HP-UXB.11.23.mk create mode 100644 mozilla/security/coreconf/HP-UXB.11.mk create mode 100644 mozilla/security/coreconf/IRIX.mk create mode 100644 mozilla/security/coreconf/IRIX5.2.mk create mode 100644 mozilla/security/coreconf/IRIX5.3.mk create mode 100644 mozilla/security/coreconf/IRIX5.mk create mode 100644 mozilla/security/coreconf/IRIX6.2.mk create mode 100644 mozilla/security/coreconf/IRIX6.3.mk create mode 100644 mozilla/security/coreconf/IRIX6.5.mk create mode 100644 mozilla/security/coreconf/IRIX6.mk create mode 100644 mozilla/security/coreconf/Linux.mk create mode 100644 mozilla/security/coreconf/Linux2.1.mk create mode 100644 mozilla/security/coreconf/Linux2.2.mk create mode 100644 mozilla/security/coreconf/Linux2.4.mk create mode 100644 mozilla/security/coreconf/Linux2.5.mk create mode 100644 mozilla/security/coreconf/Linux2.6.mk create mode 100644 mozilla/security/coreconf/LinuxELF1.2.mk create mode 100644 mozilla/security/coreconf/LinuxELF2.0.mk create mode 100644 mozilla/security/coreconf/Makefile create mode 100644 mozilla/security/coreconf/NCR3.0.mk create mode 100644 mozilla/security/coreconf/NEC4.2.mk create mode 100644 mozilla/security/coreconf/NetBSD.mk create mode 100644 mozilla/security/coreconf/OS2.mk create mode 100644 mozilla/security/coreconf/OSF1.mk create mode 100644 mozilla/security/coreconf/OSF1V2.0.mk create mode 100644 mozilla/security/coreconf/OSF1V3.0.mk create mode 100644 mozilla/security/coreconf/OSF1V3.2.mk create mode 100644 mozilla/security/coreconf/OSF1V4.0.mk create mode 100644 mozilla/security/coreconf/OSF1V4.0B.mk create mode 100644 mozilla/security/coreconf/OSF1V4.0D.mk create mode 100644 mozilla/security/coreconf/OSF1V5.0.mk create mode 100644 mozilla/security/coreconf/OSF1V5.1.mk create mode 100644 mozilla/security/coreconf/OpenBSD.mk create mode 100644 mozilla/security/coreconf/OpenUNIX.mk create mode 100644 mozilla/security/coreconf/QNX.mk create mode 100644 mozilla/security/coreconf/README create mode 100644 mozilla/security/coreconf/RISCOS.mk create mode 100644 mozilla/security/coreconf/ReliantUNIX.mk create mode 100644 mozilla/security/coreconf/ReliantUNIX5.4.mk create mode 100644 mozilla/security/coreconf/SCOOS5.0.mk create mode 100644 mozilla/security/coreconf/SCO_SV3.2.mk create mode 100644 mozilla/security/coreconf/SunOS4.1.3_U1.mk create mode 100644 mozilla/security/coreconf/SunOS5.10.mk create mode 100755 mozilla/security/coreconf/SunOS5.10_i86pc.mk create mode 100644 mozilla/security/coreconf/SunOS5.11.mk create mode 100644 mozilla/security/coreconf/SunOS5.11_i86pc.mk create mode 100644 mozilla/security/coreconf/SunOS5.3.mk create mode 100644 mozilla/security/coreconf/SunOS5.4.mk create mode 100644 mozilla/security/coreconf/SunOS5.4_i86pc.mk create mode 100644 mozilla/security/coreconf/SunOS5.5.1.mk create mode 100644 mozilla/security/coreconf/SunOS5.5.1_i86pc.mk create mode 100644 mozilla/security/coreconf/SunOS5.5.mk create mode 100644 mozilla/security/coreconf/SunOS5.6.mk create mode 100644 mozilla/security/coreconf/SunOS5.6_i86pc.mk create mode 100644 mozilla/security/coreconf/SunOS5.7.mk create mode 100644 mozilla/security/coreconf/SunOS5.7_i86pc.mk create mode 100644 mozilla/security/coreconf/SunOS5.8.mk create mode 100644 mozilla/security/coreconf/SunOS5.8_i86pc.mk create mode 100755 mozilla/security/coreconf/SunOS5.9.mk create mode 100755 mozilla/security/coreconf/SunOS5.9_i86pc.mk create mode 100644 mozilla/security/coreconf/SunOS5.mk create mode 100644 mozilla/security/coreconf/UNIX.mk create mode 100644 mozilla/security/coreconf/UNIXWARE2.1.mk create mode 100644 mozilla/security/coreconf/WIN32.mk create mode 100644 mozilla/security/coreconf/WIN95.mk create mode 100644 mozilla/security/coreconf/WINCE.mk create mode 100644 mozilla/security/coreconf/WINNT.mk create mode 100644 mozilla/security/coreconf/arch.mk create mode 100644 mozilla/security/coreconf/command.mk create mode 100644 mozilla/security/coreconf/config.mk create mode 100644 mozilla/security/coreconf/coreconf.dep create mode 100644 mozilla/security/coreconf/coreconf.pl create mode 100755 mozilla/security/coreconf/cpdist.pl create mode 100644 mozilla/security/coreconf/headers.mk create mode 100755 mozilla/security/coreconf/import.pl create mode 100644 mozilla/security/coreconf/jdk.mk create mode 100755 mozilla/security/coreconf/jniregen.pl create mode 100644 mozilla/security/coreconf/location.mk create mode 100644 mozilla/security/coreconf/mkdepend/Makefile create mode 100644 mozilla/security/coreconf/mkdepend/cppsetup.c create mode 100644 mozilla/security/coreconf/mkdepend/def.h create mode 100644 mozilla/security/coreconf/mkdepend/ifparser.c create mode 100644 mozilla/security/coreconf/mkdepend/ifparser.h create mode 100644 mozilla/security/coreconf/mkdepend/imakemdep.h create mode 100644 mozilla/security/coreconf/mkdepend/include.c create mode 100644 mozilla/security/coreconf/mkdepend/main.c create mode 100644 mozilla/security/coreconf/mkdepend/mkdepend.man create mode 100644 mozilla/security/coreconf/mkdepend/parse.c create mode 100644 mozilla/security/coreconf/mkdepend/pr.c create mode 100644 mozilla/security/coreconf/module.mk create mode 100644 mozilla/security/coreconf/nsinstall/Makefile create mode 100644 mozilla/security/coreconf/nsinstall/nsinstall.c create mode 100644 mozilla/security/coreconf/nsinstall/pathsub.c create mode 100644 mozilla/security/coreconf/nsinstall/pathsub.h create mode 100644 mozilla/security/coreconf/nsinstall/sunos4.h create mode 100755 mozilla/security/coreconf/outofdate.pl create mode 100644 mozilla/security/coreconf/prefix.mk create mode 100755 mozilla/security/coreconf/release.pl create mode 100644 mozilla/security/coreconf/rules.mk create mode 100644 mozilla/security/coreconf/ruleset.mk create mode 100644 mozilla/security/coreconf/source.mk create mode 100644 mozilla/security/coreconf/suffix.mk create mode 100644 mozilla/security/coreconf/tree.mk create mode 100644 mozilla/security/coreconf/version.mk create mode 100644 mozilla/security/coreconf/version.pl create mode 100644 mozilla/security/dbm/Makefile create mode 100644 mozilla/security/dbm/config/config.mk create mode 100644 mozilla/security/dbm/include/Makefile create mode 100644 mozilla/security/dbm/include/manifest.mn create mode 100644 mozilla/security/dbm/manifest.mn create mode 100644 mozilla/security/dbm/src/Makefile create mode 100644 mozilla/security/dbm/src/config.mk create mode 100644 mozilla/security/dbm/src/dirent.c create mode 100644 mozilla/security/dbm/src/dirent.h create mode 100644 mozilla/security/dbm/src/manifest.mn create mode 100644 mozilla/security/dbm/tests/Makefile create mode 100644 mozilla/security/nss/Makefile create mode 100644 mozilla/security/nss/cmd/.cvsignore create mode 100644 mozilla/security/nss/cmd/Makefile create mode 100644 mozilla/security/nss/cmd/addbuiltin/Makefile create mode 100644 mozilla/security/nss/cmd/addbuiltin/addbuiltin.c create mode 100644 mozilla/security/nss/cmd/addbuiltin/manifest.mn create mode 100644 mozilla/security/nss/cmd/atob/Makefile create mode 100644 mozilla/security/nss/cmd/atob/atob.c create mode 100644 mozilla/security/nss/cmd/atob/manifest.mn create mode 100644 mozilla/security/nss/cmd/bltest/Makefile create mode 100644 mozilla/security/nss/cmd/bltest/blapitest.c create mode 100644 mozilla/security/nss/cmd/bltest/manifest.mn create mode 100644 mozilla/security/nss/cmd/bltest/tests/README create mode 100644 mozilla/security/nss/cmd/bltest/tests/aes_cbc/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/aes_cbc/iv0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/aes_cbc/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/aes_cbc/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/aes_cbc/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/aes_ecb/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/aes_ecb/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/aes_ecb/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/aes_ecb/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_cbc/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_cbc/ciphertext1 create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_cbc/ciphertext2 create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_cbc/iv0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_cbc/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_cbc/key1 create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_cbc/key2 create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_cbc/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_cbc/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_ecb/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_ecb/ciphertext1 create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_ecb/ciphertext2 create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_ecb/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_ecb/key1 create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_ecb/key2 create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_ecb/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/camellia_ecb/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/des3_cbc/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/des3_cbc/iv0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/des3_cbc/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/des3_cbc/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/des3_cbc/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/des3_ecb/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/des3_ecb/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/des3_ecb/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/des3_ecb/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/des_cbc/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/des_cbc/iv0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/des_cbc/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/des_cbc/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/des_cbc/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/des_ecb/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/des_ecb/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/des_ecb/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/des_ecb/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/dsa/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/dsa/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/dsa/keyseed0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/dsa/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/dsa/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/dsa/pqg0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/dsa/sigseed0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/README create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext1 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext10 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext11 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext12 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext13 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext14 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext15 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext16 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext17 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext18 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext19 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext2 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext20 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext3 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext4 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext5 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext6 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext7 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext8 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext9 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key1 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key10 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key11 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key12 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key13 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key14 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key15 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key16 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key17 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key18 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key19 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key2 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key20 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key3 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key4 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key5 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key6 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key7 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key8 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/key9 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext1 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext10 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext11 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext12 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext13 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext14 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext15 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext16 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext17 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext18 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext19 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext2 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext20 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext3 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext4 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext5 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext6 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext7 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext8 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext9 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed1 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed10 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed11 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed12 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed13 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed14 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed15 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed16 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed17 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed18 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed19 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed2 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed20 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed3 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed4 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed5 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed6 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed7 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed8 create mode 100644 mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed9 create mode 100644 mozilla/security/nss/cmd/bltest/tests/md2/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/md2/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/md2/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/md5/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/md5/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/md5/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc2_cbc/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc2_cbc/iv0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc2_cbc/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc2_cbc/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc2_cbc/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc2_ecb/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc2_ecb/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc2_ecb/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc2_ecb/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc4/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc4/ciphertext1 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc4/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc4/key1 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc4/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc4/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc4/plaintext1 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc5_cbc/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc5_cbc/iv0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc5_cbc/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc5_cbc/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc5_cbc/params0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc5_cbc/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc5_ecb/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc5_ecb/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc5_ecb/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc5_ecb/params0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rc5_ecb/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rsa/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rsa/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/rsa/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/rsa/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/seed_cbc/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/seed_cbc/iv0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/seed_cbc/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/seed_cbc/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/seed_cbc/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/seed_ecb/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/seed_ecb/iv0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/seed_ecb/key0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/seed_ecb/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/seed_ecb/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha1/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha1/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha1/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha256/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha256/ciphertext1 create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha256/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha256/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha256/plaintext1 create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha384/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha384/ciphertext1 create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha384/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha384/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha384/plaintext1 create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha512/ciphertext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha512/ciphertext1 create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha512/numtests create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha512/plaintext0 create mode 100644 mozilla/security/nss/cmd/bltest/tests/sha512/plaintext1 create mode 100644 mozilla/security/nss/cmd/btoa/Makefile create mode 100644 mozilla/security/nss/cmd/btoa/btoa.c create mode 100644 mozilla/security/nss/cmd/btoa/manifest.mn create mode 100644 mozilla/security/nss/cmd/certcgi/HOWTO.txt create mode 100644 mozilla/security/nss/cmd/certcgi/Makefile create mode 100644 mozilla/security/nss/cmd/certcgi/ca.html create mode 100644 mozilla/security/nss/cmd/certcgi/ca_form.html create mode 100644 mozilla/security/nss/cmd/certcgi/certcgi.c create mode 100644 mozilla/security/nss/cmd/certcgi/index.html create mode 100644 mozilla/security/nss/cmd/certcgi/main.html create mode 100644 mozilla/security/nss/cmd/certcgi/manifest.mn create mode 100644 mozilla/security/nss/cmd/certcgi/nscp_ext_form.html create mode 100644 mozilla/security/nss/cmd/certcgi/stnd_ext_form.html create mode 100644 mozilla/security/nss/cmd/certutil/Makefile create mode 100644 mozilla/security/nss/cmd/certutil/certext.c create mode 100644 mozilla/security/nss/cmd/certutil/certutil.c create mode 100644 mozilla/security/nss/cmd/certutil/certutil.h create mode 100644 mozilla/security/nss/cmd/certutil/keystuff.c create mode 100644 mozilla/security/nss/cmd/certutil/manifest.mn create mode 100644 mozilla/security/nss/cmd/checkcert/Makefile create mode 100644 mozilla/security/nss/cmd/checkcert/checkcert.c create mode 100644 mozilla/security/nss/cmd/checkcert/manifest.mn create mode 100644 mozilla/security/nss/cmd/crlutil/Makefile create mode 100644 mozilla/security/nss/cmd/crlutil/crlgen.c create mode 100644 mozilla/security/nss/cmd/crlutil/crlgen.h create mode 100644 mozilla/security/nss/cmd/crlutil/crlgen_lex.c create mode 100644 mozilla/security/nss/cmd/crlutil/crlgen_lex_fix.sed create mode 100644 mozilla/security/nss/cmd/crlutil/crlgen_lex_orig.l create mode 100644 mozilla/security/nss/cmd/crlutil/crlutil.c create mode 100644 mozilla/security/nss/cmd/crlutil/manifest.mn create mode 100644 mozilla/security/nss/cmd/crmf-cgi/Makefile create mode 100644 mozilla/security/nss/cmd/crmf-cgi/config.mk create mode 100644 mozilla/security/nss/cmd/crmf-cgi/crmfcgi.c create mode 100644 mozilla/security/nss/cmd/crmf-cgi/crmfcgi.html create mode 100644 mozilla/security/nss/cmd/crmf-cgi/manifest.mn create mode 100644 mozilla/security/nss/cmd/crmftest/Makefile create mode 100644 mozilla/security/nss/cmd/crmftest/config.mk create mode 100644 mozilla/security/nss/cmd/crmftest/manifest.mn create mode 100644 mozilla/security/nss/cmd/crmftest/testcrmf.c create mode 100644 mozilla/security/nss/cmd/dbck/Makefile create mode 100644 mozilla/security/nss/cmd/dbck/dbck.c create mode 100644 mozilla/security/nss/cmd/dbck/dbrecover.c create mode 100644 mozilla/security/nss/cmd/dbck/manifest.mn create mode 100644 mozilla/security/nss/cmd/dbtest/Makefile create mode 100644 mozilla/security/nss/cmd/dbtest/dbtest.c create mode 100644 mozilla/security/nss/cmd/dbtest/manifest.mn create mode 100644 mozilla/security/nss/cmd/derdump/Makefile create mode 100644 mozilla/security/nss/cmd/derdump/derdump.c create mode 100644 mozilla/security/nss/cmd/derdump/manifest.mn create mode 100644 mozilla/security/nss/cmd/digest/Makefile create mode 100644 mozilla/security/nss/cmd/digest/digest.c create mode 100644 mozilla/security/nss/cmd/digest/manifest.mn create mode 100755 mozilla/security/nss/cmd/fipstest/Makefile create mode 100644 mozilla/security/nss/cmd/fipstest/aes.sh create mode 100755 mozilla/security/nss/cmd/fipstest/dsa.sh create mode 100644 mozilla/security/nss/cmd/fipstest/ecdsa.sh create mode 100644 mozilla/security/nss/cmd/fipstest/fipstest.c create mode 100755 mozilla/security/nss/cmd/fipstest/hmac.sh create mode 100644 mozilla/security/nss/cmd/fipstest/manifest.mn create mode 100644 mozilla/security/nss/cmd/fipstest/rng.sh create mode 100644 mozilla/security/nss/cmd/fipstest/rsa.sh create mode 100644 mozilla/security/nss/cmd/fipstest/sha.sh create mode 100644 mozilla/security/nss/cmd/fipstest/tdea.sh create mode 100644 mozilla/security/nss/cmd/lib/Makefile create mode 100644 mozilla/security/nss/cmd/lib/NSPRerrs.h create mode 100644 mozilla/security/nss/cmd/lib/SECerrs.h create mode 100644 mozilla/security/nss/cmd/lib/SSLerrs.h create mode 100644 mozilla/security/nss/cmd/lib/berparse.c create mode 100644 mozilla/security/nss/cmd/lib/config.mk create mode 100644 mozilla/security/nss/cmd/lib/derprint.c create mode 100644 mozilla/security/nss/cmd/lib/ffs.c create mode 100644 mozilla/security/nss/cmd/lib/manifest.mn create mode 100644 mozilla/security/nss/cmd/lib/moreoids.c create mode 100644 mozilla/security/nss/cmd/lib/pk11table.c create mode 100644 mozilla/security/nss/cmd/lib/pk11table.h create mode 100644 mozilla/security/nss/cmd/lib/pppolicy.c create mode 100644 mozilla/security/nss/cmd/lib/secerror.c create mode 100644 mozilla/security/nss/cmd/lib/secpwd.c create mode 100644 mozilla/security/nss/cmd/lib/secutil.c create mode 100644 mozilla/security/nss/cmd/lib/secutil.h create mode 100644 mozilla/security/nss/cmd/lib/wincemain.c create mode 100755 mozilla/security/nss/cmd/libpkix/Makefile create mode 100644 mozilla/security/nss/cmd/libpkix/config.mk create mode 100755 mozilla/security/nss/cmd/libpkix/manifest.mn create mode 100755 mozilla/security/nss/cmd/libpkix/perf/Makefile create mode 100644 mozilla/security/nss/cmd/libpkix/perf/libpkix_buildthreads.c create mode 100755 mozilla/security/nss/cmd/libpkix/perf/manifest.mn create mode 100644 mozilla/security/nss/cmd/libpkix/perf/nss_threads.c create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/Makefile create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/certsel/Makefile create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/certsel/manifest.mn create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/certsel/test_certselector.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/certsel/test_comcertselparams.c create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/checker/Makefile create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/checker/manifest.mn create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/checker/test_certchainchecker.c create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/crlsel/Makefile create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/crlsel/manifest.mn create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/crlsel/test_comcrlselparams.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/crlsel/test_crlselector.c create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/manifest.mn create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/params/Makefile create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/params/manifest.mn create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/params/test_buildparams.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/params/test_procparams.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/params/test_resourcelimits.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/params/test_trustanchor.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/params/test_valparams.c create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/results/Makefile create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/results/manifest.mn create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/results/test_buildresult.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/results/test_policynode.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/results/test_valresult.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/results/test_verifynode.c create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/store/Makefile create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/store/manifest.mn create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/store/test_store.c create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/top/Makefile create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/top/manifest.mn create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/top/test_basicchecker.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/top/test_basicconstraintschecker.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/top/test_buildchain.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/top/test_buildchain_partialchain.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/top/test_buildchain_resourcelimits.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/top/test_buildchain_uchecker.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/top/test_customcrlchecker.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/top/test_defaultcrlchecker2stores.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/top/test_ocsp.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/top/test_policychecker.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/top/test_subjaltnamechecker.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/top/test_validatechain.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/top/test_validatechain_NB.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/top/test_validatechain_bc.c create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/util/Makefile create mode 100755 mozilla/security/nss/cmd/libpkix/pkix/util/manifest.mn create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/util/test_error.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/util/test_list.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/util/test_list2.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix/util/test_logger.c create mode 100755 mozilla/security/nss/cmd/libpkix/pkix_pl/Makefile create mode 100755 mozilla/security/nss/cmd/libpkix/pkix_pl/manifest.mn create mode 100755 mozilla/security/nss/cmd/libpkix/pkix_pl/module/Makefile create mode 100755 mozilla/security/nss/cmd/libpkix/pkix_pl/module/manifest.mn create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/module/test_colcertstore.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/module/test_ekuchecker.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/module/test_httpcertstore.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/module/test_pk11certstore.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/module/test_socket.c create mode 100755 mozilla/security/nss/cmd/libpkix/pkix_pl/pki/Makefile create mode 100755 mozilla/security/nss/cmd/libpkix/pkix_pl/pki/manifest.mn create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/pki/test_authorityinfoaccess.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/pki/test_cert.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/pki/test_crl.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/pki/test_crlentry.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/pki/test_date.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/pki/test_generalname.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/pki/test_nameconstraints.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/pki/test_subjectinfoaccess.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/pki/test_x500name.c create mode 100755 mozilla/security/nss/cmd/libpkix/pkix_pl/system/Makefile create mode 100755 mozilla/security/nss/cmd/libpkix/pkix_pl/system/manifest.mn create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/system/stress_test.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/system/test_bigint.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/system/test_bytearray.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/system/test_hashtable.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/system/test_mem.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/system/test_monitorlock.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/system/test_mutex.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/system/test_mutex2.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/system/test_mutex3.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/system/test_object.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/system/test_oid.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/system/test_rwlock.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/system/test_string.c create mode 100644 mozilla/security/nss/cmd/libpkix/pkix_pl/system/test_string2.c create mode 100755 mozilla/security/nss/cmd/libpkix/pkixlibs.mk create mode 100755 mozilla/security/nss/cmd/libpkix/pkixrules.mk create mode 100644 mozilla/security/nss/cmd/libpkix/pkixutil/Makefile create mode 100644 mozilla/security/nss/cmd/libpkix/pkixutil/manifest.mn create mode 100644 mozilla/security/nss/cmd/libpkix/pkixutil/pkixutil.c create mode 100755 mozilla/security/nss/cmd/libpkix/sample_apps/Makefile create mode 100644 mozilla/security/nss/cmd/libpkix/sample_apps/build_chain.c create mode 100644 mozilla/security/nss/cmd/libpkix/sample_apps/dumpcert.c create mode 100644 mozilla/security/nss/cmd/libpkix/sample_apps/dumpcrl.c create mode 100755 mozilla/security/nss/cmd/libpkix/sample_apps/manifest.mn create mode 100644 mozilla/security/nss/cmd/libpkix/sample_apps/validate_chain.c create mode 100755 mozilla/security/nss/cmd/libpkix/testutil/Makefile create mode 100644 mozilla/security/nss/cmd/libpkix/testutil/config.mk create mode 100755 mozilla/security/nss/cmd/libpkix/testutil/manifest.mn create mode 100644 mozilla/security/nss/cmd/libpkix/testutil/pkixutil.def create mode 100755 mozilla/security/nss/cmd/libpkix/testutil/testutil.c create mode 100755 mozilla/security/nss/cmd/libpkix/testutil/testutil.h create mode 100755 mozilla/security/nss/cmd/libpkix/testutil/testutil_nss.c create mode 100755 mozilla/security/nss/cmd/libpkix/testutil/testutil_nss.h create mode 100644 mozilla/security/nss/cmd/makepqg/Makefile create mode 100644 mozilla/security/nss/cmd/makepqg/makepqg.c create mode 100644 mozilla/security/nss/cmd/makepqg/manifest.mn create mode 100644 mozilla/security/nss/cmd/makepqg/testit.ksh create mode 100644 mozilla/security/nss/cmd/manifest.mn create mode 100644 mozilla/security/nss/cmd/modutil/Makefile create mode 100644 mozilla/security/nss/cmd/modutil/README create mode 100644 mozilla/security/nss/cmd/modutil/error.h create mode 100644 mozilla/security/nss/cmd/modutil/install-ds.c create mode 100644 mozilla/security/nss/cmd/modutil/install-ds.h create mode 100644 mozilla/security/nss/cmd/modutil/install.c create mode 100644 mozilla/security/nss/cmd/modutil/install.h create mode 100644 mozilla/security/nss/cmd/modutil/installparse.c create mode 100644 mozilla/security/nss/cmd/modutil/installparse.h create mode 100644 mozilla/security/nss/cmd/modutil/installparse.l create mode 100644 mozilla/security/nss/cmd/modutil/installparse.y create mode 100644 mozilla/security/nss/cmd/modutil/instsec.c create mode 100644 mozilla/security/nss/cmd/modutil/lex.Pk11Install_yy.c create mode 100644 mozilla/security/nss/cmd/modutil/manifest.mn create mode 100644 mozilla/security/nss/cmd/modutil/modutil.c create mode 100644 mozilla/security/nss/cmd/modutil/modutil.h create mode 100644 mozilla/security/nss/cmd/modutil/pk11.c create mode 100644 mozilla/security/nss/cmd/modutil/pk11jar.html create mode 100644 mozilla/security/nss/cmd/modutil/rules.mk create mode 100644 mozilla/security/nss/cmd/modutil/specification.html create mode 100644 mozilla/security/nss/cmd/multinit/Makefile create mode 100644 mozilla/security/nss/cmd/multinit/manifest.mn create mode 100644 mozilla/security/nss/cmd/multinit/multinit.c create mode 100644 mozilla/security/nss/cmd/ocspclnt/Makefile create mode 100644 mozilla/security/nss/cmd/ocspclnt/manifest.mn create mode 100644 mozilla/security/nss/cmd/ocspclnt/ocspclnt.c create mode 100644 mozilla/security/nss/cmd/oidcalc/Makefile create mode 100644 mozilla/security/nss/cmd/oidcalc/manifest.mn create mode 100644 mozilla/security/nss/cmd/oidcalc/oidcalc.c create mode 100644 mozilla/security/nss/cmd/p7content/Makefile create mode 100644 mozilla/security/nss/cmd/p7content/manifest.mn create mode 100644 mozilla/security/nss/cmd/p7content/p7content.c create mode 100644 mozilla/security/nss/cmd/p7env/Makefile create mode 100644 mozilla/security/nss/cmd/p7env/manifest.mn create mode 100644 mozilla/security/nss/cmd/p7env/p7env.c create mode 100644 mozilla/security/nss/cmd/p7sign/Makefile create mode 100644 mozilla/security/nss/cmd/p7sign/manifest.mn create mode 100644 mozilla/security/nss/cmd/p7sign/p7sign.c create mode 100644 mozilla/security/nss/cmd/p7verify/Makefile create mode 100644 mozilla/security/nss/cmd/p7verify/manifest.mn create mode 100644 mozilla/security/nss/cmd/p7verify/p7verify.c create mode 100755 mozilla/security/nss/cmd/pk11mode/Makefile create mode 100644 mozilla/security/nss/cmd/pk11mode/manifest.mn create mode 100644 mozilla/security/nss/cmd/pk11mode/pk11mode.c create mode 100644 mozilla/security/nss/cmd/pk11util/Makefile create mode 100644 mozilla/security/nss/cmd/pk11util/manifest.mn create mode 100644 mozilla/security/nss/cmd/pk11util/pk11util.c create mode 100644 mozilla/security/nss/cmd/pk11util/scripts/dosign create mode 100644 mozilla/security/nss/cmd/pk11util/scripts/hssign create mode 100644 mozilla/security/nss/cmd/pk11util/scripts/lcert create mode 100644 mozilla/security/nss/cmd/pk11util/scripts/mechanisms create mode 100644 mozilla/security/nss/cmd/pk11util/scripts/pLabel1 create mode 100644 mozilla/security/nss/cmd/pk11util/scripts/pMechanisms create mode 100644 mozilla/security/nss/cmd/pk11util/scripts/pcert create mode 100644 mozilla/security/nss/cmd/pk12util/Makefile create mode 100644 mozilla/security/nss/cmd/pk12util/manifest.mn create mode 100644 mozilla/security/nss/cmd/pk12util/pk12util.c create mode 100644 mozilla/security/nss/cmd/pk12util/pk12util.h create mode 100644 mozilla/security/nss/cmd/platlibs.mk create mode 100644 mozilla/security/nss/cmd/platrules.mk create mode 100644 mozilla/security/nss/cmd/pp/Makefile create mode 100644 mozilla/security/nss/cmd/pp/manifest.mn create mode 100644 mozilla/security/nss/cmd/pp/pp.c create mode 100644 mozilla/security/nss/cmd/pwdecrypt/Makefile create mode 100644 mozilla/security/nss/cmd/pwdecrypt/manifest.mn create mode 100644 mozilla/security/nss/cmd/pwdecrypt/pwdecrypt.c create mode 100644 mozilla/security/nss/cmd/rsaperf/Makefile create mode 100644 mozilla/security/nss/cmd/rsaperf/defkey.c create mode 100644 mozilla/security/nss/cmd/rsaperf/manifest.mn create mode 100644 mozilla/security/nss/cmd/rsaperf/rsaperf.c create mode 100644 mozilla/security/nss/cmd/rsapoptst/Makefile create mode 100644 mozilla/security/nss/cmd/rsapoptst/manifest.mn create mode 100644 mozilla/security/nss/cmd/rsapoptst/rsapoptst.c create mode 100644 mozilla/security/nss/cmd/samples/cert create mode 100644 mozilla/security/nss/cmd/samples/cert0 create mode 100644 mozilla/security/nss/cmd/samples/cert1 create mode 100644 mozilla/security/nss/cmd/samples/cert2 create mode 100644 mozilla/security/nss/cmd/samples/pkcs7.ber create mode 100644 mozilla/security/nss/cmd/samples/pkcs7bday.ber create mode 100644 mozilla/security/nss/cmd/samples/pkcs7cnet.ber create mode 100644 mozilla/security/nss/cmd/samples/pkcs7news.ber create mode 100644 mozilla/security/nss/cmd/samples/x509v3.der create mode 100644 mozilla/security/nss/cmd/samples/x509v3.txt create mode 100644 mozilla/security/nss/cmd/sdrtest/Makefile create mode 100644 mozilla/security/nss/cmd/sdrtest/manifest.mn create mode 100644 mozilla/security/nss/cmd/sdrtest/sdrtest.c create mode 100644 mozilla/security/nss/cmd/selfserv/Makefile create mode 100644 mozilla/security/nss/cmd/selfserv/manifest.mn create mode 100644 mozilla/security/nss/cmd/selfserv/selfserv.c create mode 100644 mozilla/security/nss/cmd/shlibsign/Makefile create mode 100644 mozilla/security/nss/cmd/shlibsign/mangle/Makefile create mode 100644 mozilla/security/nss/cmd/shlibsign/mangle/mangle.c create mode 100644 mozilla/security/nss/cmd/shlibsign/mangle/manifest.mn create mode 100644 mozilla/security/nss/cmd/shlibsign/manifest.mn create mode 100644 mozilla/security/nss/cmd/shlibsign/shlibsign.c create mode 100644 mozilla/security/nss/cmd/shlibsign/sign.cmd create mode 100644 mozilla/security/nss/cmd/shlibsign/sign.sh create mode 100644 mozilla/security/nss/cmd/signtool/Makefile create mode 100644 mozilla/security/nss/cmd/signtool/README create mode 100644 mozilla/security/nss/cmd/signtool/certgen.c create mode 100644 mozilla/security/nss/cmd/signtool/javascript.c create mode 100644 mozilla/security/nss/cmd/signtool/list.c create mode 100644 mozilla/security/nss/cmd/signtool/manifest.mn create mode 100644 mozilla/security/nss/cmd/signtool/sign.c create mode 100644 mozilla/security/nss/cmd/signtool/signtool.c create mode 100644 mozilla/security/nss/cmd/signtool/signtool.h create mode 100644 mozilla/security/nss/cmd/signtool/util.c create mode 100644 mozilla/security/nss/cmd/signtool/verify.c create mode 100644 mozilla/security/nss/cmd/signtool/zip.c create mode 100644 mozilla/security/nss/cmd/signtool/zip.h create mode 100644 mozilla/security/nss/cmd/signver/Makefile create mode 100755 mozilla/security/nss/cmd/signver/examples/1/form.pl create mode 100644 mozilla/security/nss/cmd/signver/examples/1/signedForm.html create mode 100644 mozilla/security/nss/cmd/signver/examples/1/signedForm.nt.html create mode 100755 mozilla/security/nss/cmd/signver/examples/1/signedForm.pl create mode 100644 mozilla/security/nss/cmd/signver/manifest.mn create mode 100644 mozilla/security/nss/cmd/signver/pk7print.c create mode 100644 mozilla/security/nss/cmd/signver/signver.c create mode 100644 mozilla/security/nss/cmd/smimetools/Makefile create mode 100644 mozilla/security/nss/cmd/smimetools/cmsutil.c create mode 100644 mozilla/security/nss/cmd/smimetools/manifest.mn create mode 100644 mozilla/security/nss/cmd/smimetools/rules.mk create mode 100755 mozilla/security/nss/cmd/smimetools/smime create mode 100644 mozilla/security/nss/cmd/ssltap/Makefile create mode 100644 mozilla/security/nss/cmd/ssltap/manifest.mn create mode 100644 mozilla/security/nss/cmd/ssltap/ssltap-manual.html create mode 100644 mozilla/security/nss/cmd/ssltap/ssltap.c create mode 100644 mozilla/security/nss/cmd/strsclnt/Makefile create mode 100644 mozilla/security/nss/cmd/strsclnt/manifest.mn create mode 100644 mozilla/security/nss/cmd/strsclnt/strsclnt.c create mode 100644 mozilla/security/nss/cmd/symkeyutil/Makefile create mode 100644 mozilla/security/nss/cmd/symkeyutil/manifest.mn create mode 100644 mozilla/security/nss/cmd/symkeyutil/symkey.man create mode 100644 mozilla/security/nss/cmd/symkeyutil/symkeyutil.c create mode 100644 mozilla/security/nss/cmd/tests/Makefile create mode 100644 mozilla/security/nss/cmd/tests/baddbdir.c create mode 100644 mozilla/security/nss/cmd/tests/conflict.c create mode 100644 mozilla/security/nss/cmd/tests/dertimetest.c create mode 100644 mozilla/security/nss/cmd/tests/manifest.mn create mode 100644 mozilla/security/nss/cmd/tests/nonspr10.c create mode 100644 mozilla/security/nss/cmd/tests/remtest.c create mode 100644 mozilla/security/nss/cmd/tstclnt/Makefile create mode 100644 mozilla/security/nss/cmd/tstclnt/manifest.mn create mode 100644 mozilla/security/nss/cmd/tstclnt/tstclnt.c create mode 100644 mozilla/security/nss/cmd/vfychain/Makefile create mode 100644 mozilla/security/nss/cmd/vfychain/manifest.mn create mode 100644 mozilla/security/nss/cmd/vfychain/vfychain.c create mode 100644 mozilla/security/nss/cmd/vfyserv/Makefile create mode 100644 mozilla/security/nss/cmd/vfyserv/manifest.mn create mode 100644 mozilla/security/nss/cmd/vfyserv/vfyserv.c create mode 100644 mozilla/security/nss/cmd/vfyserv/vfyserv.h create mode 100644 mozilla/security/nss/cmd/vfyserv/vfyutil.c create mode 100755 mozilla/security/nss/coverage/cov.sh create mode 100755 mozilla/security/nss/coverage/report.sh create mode 100644 mozilla/security/nss/lib/Makefile create mode 100644 mozilla/security/nss/lib/base/Makefile create mode 100644 mozilla/security/nss/lib/base/arena.c create mode 100644 mozilla/security/nss/lib/base/base.h create mode 100644 mozilla/security/nss/lib/base/baset.h create mode 100644 mozilla/security/nss/lib/base/config.mk create mode 100644 mozilla/security/nss/lib/base/error.c create mode 100644 mozilla/security/nss/lib/base/errorval.c create mode 100644 mozilla/security/nss/lib/base/hash.c create mode 100644 mozilla/security/nss/lib/base/hashops.c create mode 100644 mozilla/security/nss/lib/base/item.c create mode 100644 mozilla/security/nss/lib/base/libc.c create mode 100644 mozilla/security/nss/lib/base/list.c create mode 100644 mozilla/security/nss/lib/base/manifest.mn create mode 100644 mozilla/security/nss/lib/base/nssbase.h create mode 100644 mozilla/security/nss/lib/base/nssbaset.h create mode 100644 mozilla/security/nss/lib/base/tracker.c create mode 100644 mozilla/security/nss/lib/base/utf8.c create mode 100644 mozilla/security/nss/lib/certdb/.cvsignore create mode 100644 mozilla/security/nss/lib/certdb/Makefile create mode 100644 mozilla/security/nss/lib/certdb/alg1485.c create mode 100644 mozilla/security/nss/lib/certdb/cert.h create mode 100644 mozilla/security/nss/lib/certdb/certdb.c create mode 100644 mozilla/security/nss/lib/certdb/certdb.h create mode 100644 mozilla/security/nss/lib/certdb/certi.h create mode 100644 mozilla/security/nss/lib/certdb/certt.h create mode 100644 mozilla/security/nss/lib/certdb/certv3.c create mode 100644 mozilla/security/nss/lib/certdb/certxutl.c create mode 100644 mozilla/security/nss/lib/certdb/certxutl.h create mode 100644 mozilla/security/nss/lib/certdb/config.mk create mode 100644 mozilla/security/nss/lib/certdb/crl.c create mode 100644 mozilla/security/nss/lib/certdb/genname.c create mode 100644 mozilla/security/nss/lib/certdb/genname.h create mode 100644 mozilla/security/nss/lib/certdb/manifest.mn create mode 100644 mozilla/security/nss/lib/certdb/polcyxtn.c create mode 100644 mozilla/security/nss/lib/certdb/secname.c create mode 100644 mozilla/security/nss/lib/certdb/stanpcertdb.c create mode 100644 mozilla/security/nss/lib/certdb/xauthkid.c create mode 100644 mozilla/security/nss/lib/certdb/xbsconst.c create mode 100644 mozilla/security/nss/lib/certdb/xconst.c create mode 100644 mozilla/security/nss/lib/certdb/xconst.h create mode 100644 mozilla/security/nss/lib/certhigh/Makefile create mode 100644 mozilla/security/nss/lib/certhigh/certhigh.c create mode 100644 mozilla/security/nss/lib/certhigh/certhtml.c create mode 100644 mozilla/security/nss/lib/certhigh/certreq.c create mode 100644 mozilla/security/nss/lib/certhigh/certvfy.c create mode 100644 mozilla/security/nss/lib/certhigh/certvfypkix.c create mode 100644 mozilla/security/nss/lib/certhigh/certvfypkixprint.c create mode 100644 mozilla/security/nss/lib/certhigh/config.mk create mode 100644 mozilla/security/nss/lib/certhigh/crlv2.c create mode 100644 mozilla/security/nss/lib/certhigh/manifest.mn create mode 100644 mozilla/security/nss/lib/certhigh/ocsp.c create mode 100644 mozilla/security/nss/lib/certhigh/ocsp.h create mode 100644 mozilla/security/nss/lib/certhigh/ocspi.h create mode 100644 mozilla/security/nss/lib/certhigh/ocspt.h create mode 100644 mozilla/security/nss/lib/certhigh/ocspti.h create mode 100644 mozilla/security/nss/lib/certhigh/xcrldist.c create mode 100644 mozilla/security/nss/lib/ckfw/Makefile create mode 100644 mozilla/security/nss/lib/ckfw/builtins/Makefile create mode 100644 mozilla/security/nss/lib/ckfw/builtins/README create mode 100644 mozilla/security/nss/lib/ckfw/builtins/anchor.c create mode 100644 mozilla/security/nss/lib/ckfw/builtins/bfind.c create mode 100644 mozilla/security/nss/lib/ckfw/builtins/binst.c create mode 100644 mozilla/security/nss/lib/ckfw/builtins/bobject.c create mode 100644 mozilla/security/nss/lib/ckfw/builtins/bsession.c create mode 100644 mozilla/security/nss/lib/ckfw/builtins/bslot.c create mode 100644 mozilla/security/nss/lib/ckfw/builtins/btoken.c create mode 100644 mozilla/security/nss/lib/ckfw/builtins/builtins.h create mode 100644 mozilla/security/nss/lib/ckfw/builtins/certdata.c create mode 100644 mozilla/security/nss/lib/ckfw/builtins/certdata.perl create mode 100644 mozilla/security/nss/lib/ckfw/builtins/certdata.txt create mode 100644 mozilla/security/nss/lib/ckfw/builtins/ckbiver.c create mode 100644 mozilla/security/nss/lib/ckfw/builtins/config.mk create mode 100644 mozilla/security/nss/lib/ckfw/builtins/constants.c create mode 100644 mozilla/security/nss/lib/ckfw/builtins/manifest.mn create mode 100644 mozilla/security/nss/lib/ckfw/builtins/nssckbi.def create mode 100644 mozilla/security/nss/lib/ckfw/builtins/nssckbi.h create mode 100644 mozilla/security/nss/lib/ckfw/builtins/nssckbi.rc create mode 100644 mozilla/security/nss/lib/ckfw/capi/Makefile create mode 100644 mozilla/security/nss/lib/ckfw/capi/README create mode 100644 mozilla/security/nss/lib/ckfw/capi/anchor.c create mode 100644 mozilla/security/nss/lib/ckfw/capi/cfind.c create mode 100644 mozilla/security/nss/lib/ckfw/capi/cinst.c create mode 100644 mozilla/security/nss/lib/ckfw/capi/ckcapi.h create mode 100644 mozilla/security/nss/lib/ckfw/capi/ckcapiver.c create mode 100644 mozilla/security/nss/lib/ckfw/capi/cobject.c create mode 100644 mozilla/security/nss/lib/ckfw/capi/config.mk create mode 100644 mozilla/security/nss/lib/ckfw/capi/constants.c create mode 100644 mozilla/security/nss/lib/ckfw/capi/crsa.c create mode 100644 mozilla/security/nss/lib/ckfw/capi/csession.c create mode 100644 mozilla/security/nss/lib/ckfw/capi/cslot.c create mode 100644 mozilla/security/nss/lib/ckfw/capi/ctoken.c create mode 100644 mozilla/security/nss/lib/ckfw/capi/manifest.mn create mode 100644 mozilla/security/nss/lib/ckfw/capi/nsscapi.def create mode 100644 mozilla/security/nss/lib/ckfw/capi/nsscapi.h create mode 100644 mozilla/security/nss/lib/ckfw/capi/nsscapi.rc create mode 100644 mozilla/security/nss/lib/ckfw/capi/staticobj.c create mode 100644 mozilla/security/nss/lib/ckfw/ck.api create mode 100644 mozilla/security/nss/lib/ckfw/ck.h create mode 100644 mozilla/security/nss/lib/ckfw/ckapi.perl create mode 100644 mozilla/security/nss/lib/ckfw/ckfw.h create mode 100644 mozilla/security/nss/lib/ckfw/ckfwm.h create mode 100644 mozilla/security/nss/lib/ckfw/ckfwtm.h create mode 100644 mozilla/security/nss/lib/ckfw/ckmd.h create mode 100644 mozilla/security/nss/lib/ckfw/ckt.h create mode 100644 mozilla/security/nss/lib/ckfw/config.mk create mode 100644 mozilla/security/nss/lib/ckfw/crypto.c create mode 100644 mozilla/security/nss/lib/ckfw/dbm/Makefile create mode 100644 mozilla/security/nss/lib/ckfw/dbm/anchor.c create mode 100644 mozilla/security/nss/lib/ckfw/dbm/ckdbm.h create mode 100644 mozilla/security/nss/lib/ckfw/dbm/config.mk create mode 100644 mozilla/security/nss/lib/ckfw/dbm/db.c create mode 100644 mozilla/security/nss/lib/ckfw/dbm/find.c create mode 100644 mozilla/security/nss/lib/ckfw/dbm/instance.c create mode 100644 mozilla/security/nss/lib/ckfw/dbm/manifest.mn create mode 100644 mozilla/security/nss/lib/ckfw/dbm/object.c create mode 100644 mozilla/security/nss/lib/ckfw/dbm/session.c create mode 100644 mozilla/security/nss/lib/ckfw/dbm/slot.c create mode 100644 mozilla/security/nss/lib/ckfw/dbm/token.c create mode 100644 mozilla/security/nss/lib/ckfw/find.c create mode 100644 mozilla/security/nss/lib/ckfw/hash.c create mode 100644 mozilla/security/nss/lib/ckfw/instance.c create mode 100644 mozilla/security/nss/lib/ckfw/manifest.mn create mode 100644 mozilla/security/nss/lib/ckfw/mechanism.c create mode 100644 mozilla/security/nss/lib/ckfw/mutex.c create mode 100644 mozilla/security/nss/lib/ckfw/nssck.api create mode 100644 mozilla/security/nss/lib/ckfw/nssckepv.h create mode 100644 mozilla/security/nss/lib/ckfw/nssckft.h create mode 100644 mozilla/security/nss/lib/ckfw/nssckfw.h create mode 100644 mozilla/security/nss/lib/ckfw/nssckfwc.h create mode 100644 mozilla/security/nss/lib/ckfw/nssckfwt.h create mode 100644 mozilla/security/nss/lib/ckfw/nssckg.h create mode 100644 mozilla/security/nss/lib/ckfw/nssckmdt.h create mode 100644 mozilla/security/nss/lib/ckfw/nssckt.h create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/Makefile create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/README create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/ckmk.h create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/ckmkver.c create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/config.mk create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/manchor.c create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/manifest.mn create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/mconstants.c create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/mfind.c create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/minst.c create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/mobject.c create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/mrsa.c create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/msession.c create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/mslot.c create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/mtoken.c create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/nssmkey.def create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/nssmkey.h create mode 100644 mozilla/security/nss/lib/ckfw/nssmkey/staticobj.c create mode 100644 mozilla/security/nss/lib/ckfw/object.c create mode 100644 mozilla/security/nss/lib/ckfw/session.c create mode 100644 mozilla/security/nss/lib/ckfw/sessobj.c create mode 100644 mozilla/security/nss/lib/ckfw/slot.c create mode 100644 mozilla/security/nss/lib/ckfw/token.c create mode 100644 mozilla/security/nss/lib/ckfw/wrap.c create mode 100644 mozilla/security/nss/lib/crmf/Makefile create mode 100644 mozilla/security/nss/lib/crmf/asn1cmn.c create mode 100644 mozilla/security/nss/lib/crmf/challcli.c create mode 100644 mozilla/security/nss/lib/crmf/cmmf.h create mode 100644 mozilla/security/nss/lib/crmf/cmmfasn1.c create mode 100644 mozilla/security/nss/lib/crmf/cmmfchal.c create mode 100644 mozilla/security/nss/lib/crmf/cmmfi.h create mode 100644 mozilla/security/nss/lib/crmf/cmmfit.h create mode 100644 mozilla/security/nss/lib/crmf/cmmfrec.c create mode 100644 mozilla/security/nss/lib/crmf/cmmfresp.c create mode 100644 mozilla/security/nss/lib/crmf/cmmft.h create mode 100644 mozilla/security/nss/lib/crmf/config.mk create mode 100644 mozilla/security/nss/lib/crmf/crmf.h create mode 100644 mozilla/security/nss/lib/crmf/crmfcont.c create mode 100644 mozilla/security/nss/lib/crmf/crmfdec.c create mode 100644 mozilla/security/nss/lib/crmf/crmfenc.c create mode 100644 mozilla/security/nss/lib/crmf/crmffut.h create mode 100644 mozilla/security/nss/lib/crmf/crmfget.c create mode 100644 mozilla/security/nss/lib/crmf/crmfi.h create mode 100644 mozilla/security/nss/lib/crmf/crmfit.h create mode 100644 mozilla/security/nss/lib/crmf/crmfpop.c create mode 100644 mozilla/security/nss/lib/crmf/crmfreq.c create mode 100644 mozilla/security/nss/lib/crmf/crmft.h create mode 100644 mozilla/security/nss/lib/crmf/crmftmpl.c create mode 100644 mozilla/security/nss/lib/crmf/encutil.c create mode 100644 mozilla/security/nss/lib/crmf/manifest.mn create mode 100644 mozilla/security/nss/lib/crmf/respcli.c create mode 100644 mozilla/security/nss/lib/crmf/respcmn.c create mode 100644 mozilla/security/nss/lib/crmf/servget.c create mode 100644 mozilla/security/nss/lib/cryptohi/Makefile create mode 100644 mozilla/security/nss/lib/cryptohi/config.mk create mode 100644 mozilla/security/nss/lib/cryptohi/cryptohi.h create mode 100644 mozilla/security/nss/lib/cryptohi/cryptoht.h create mode 100644 mozilla/security/nss/lib/cryptohi/dsautil.c create mode 100644 mozilla/security/nss/lib/cryptohi/key.h create mode 100644 mozilla/security/nss/lib/cryptohi/keyhi.h create mode 100644 mozilla/security/nss/lib/cryptohi/keyi.h create mode 100644 mozilla/security/nss/lib/cryptohi/keyt.h create mode 100644 mozilla/security/nss/lib/cryptohi/keythi.h create mode 100644 mozilla/security/nss/lib/cryptohi/manifest.mn create mode 100644 mozilla/security/nss/lib/cryptohi/sechash.c create mode 100644 mozilla/security/nss/lib/cryptohi/seckey.c create mode 100644 mozilla/security/nss/lib/cryptohi/secsign.c create mode 100644 mozilla/security/nss/lib/cryptohi/secvfy.c create mode 100644 mozilla/security/nss/lib/dev/Makefile create mode 100644 mozilla/security/nss/lib/dev/ckhelper.c create mode 100644 mozilla/security/nss/lib/dev/ckhelper.h create mode 100644 mozilla/security/nss/lib/dev/config.mk create mode 100644 mozilla/security/nss/lib/dev/dev.h create mode 100644 mozilla/security/nss/lib/dev/devm.h create mode 100644 mozilla/security/nss/lib/dev/devslot.c create mode 100644 mozilla/security/nss/lib/dev/devt.h create mode 100644 mozilla/security/nss/lib/dev/devtm.h create mode 100644 mozilla/security/nss/lib/dev/devtoken.c create mode 100644 mozilla/security/nss/lib/dev/devutil.c create mode 100644 mozilla/security/nss/lib/dev/manifest.mn create mode 100644 mozilla/security/nss/lib/dev/nssdev.h create mode 100644 mozilla/security/nss/lib/dev/nssdevt.h create mode 100644 mozilla/security/nss/lib/freebl/Makefile create mode 100644 mozilla/security/nss/lib/freebl/aeskeywrap.c create mode 100644 mozilla/security/nss/lib/freebl/alg2268.c create mode 100644 mozilla/security/nss/lib/freebl/alghmac.c create mode 100644 mozilla/security/nss/lib/freebl/alghmac.h create mode 100644 mozilla/security/nss/lib/freebl/arcfive.c create mode 100644 mozilla/security/nss/lib/freebl/arcfour-amd64-gas.s create mode 100644 mozilla/security/nss/lib/freebl/arcfour-amd64-masm.asm create mode 100644 mozilla/security/nss/lib/freebl/arcfour-amd64-sun.s create mode 100644 mozilla/security/nss/lib/freebl/arcfour.c create mode 100644 mozilla/security/nss/lib/freebl/blapi.h create mode 100644 mozilla/security/nss/lib/freebl/blapii.h create mode 100644 mozilla/security/nss/lib/freebl/blapit.h create mode 100644 mozilla/security/nss/lib/freebl/camellia.c create mode 100644 mozilla/security/nss/lib/freebl/camellia.h create mode 100644 mozilla/security/nss/lib/freebl/config.mk create mode 100644 mozilla/security/nss/lib/freebl/des.c create mode 100644 mozilla/security/nss/lib/freebl/des.h create mode 100644 mozilla/security/nss/lib/freebl/desblapi.c create mode 100644 mozilla/security/nss/lib/freebl/dh.c create mode 100644 mozilla/security/nss/lib/freebl/drbg.c create mode 100644 mozilla/security/nss/lib/freebl/dsa.c create mode 100644 mozilla/security/nss/lib/freebl/ec.c create mode 100644 mozilla/security/nss/lib/freebl/ec.h create mode 100644 mozilla/security/nss/lib/freebl/ecl/Makefile create mode 100644 mozilla/security/nss/lib/freebl/ecl/README create mode 100644 mozilla/security/nss/lib/freebl/ecl/README.FP create mode 100644 mozilla/security/nss/lib/freebl/ecl/ec2.h create mode 100644 mozilla/security/nss/lib/freebl/ecl/ec2_163.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ec2_193.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ec2_233.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ec2_aff.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ec2_mont.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ec2_proj.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ec_naf.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecl-curve.h create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecl-exp.h create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecl-priv.h create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecl.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecl.h create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecl_curve.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecl_gf.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecl_mult.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecp.h create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecp_192.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecp_224.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecp_256.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecp_384.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecp_521.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecp_aff.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecp_fp.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecp_fp.h create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecp_fp160.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecp_fp192.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecp_fp224.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecp_fpinc.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecp_jac.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecp_jm.c create mode 100644 mozilla/security/nss/lib/freebl/ecl/ecp_mont.c create mode 100644 mozilla/security/nss/lib/freebl/freebl.def create mode 100644 mozilla/security/nss/lib/freebl/freebl.rc create mode 100644 mozilla/security/nss/lib/freebl/freebl_hash.def create mode 100644 mozilla/security/nss/lib/freebl/freeblver.c create mode 100644 mozilla/security/nss/lib/freebl/genload.c create mode 100644 mozilla/security/nss/lib/freebl/hasht.h create mode 100644 mozilla/security/nss/lib/freebl/intel-aes.h create mode 100644 mozilla/security/nss/lib/freebl/intel-aes.s create mode 100644 mozilla/security/nss/lib/freebl/jpake.c create mode 100644 mozilla/security/nss/lib/freebl/ldvector.c create mode 100644 mozilla/security/nss/lib/freebl/loader.c create mode 100644 mozilla/security/nss/lib/freebl/loader.h create mode 100644 mozilla/security/nss/lib/freebl/manifest.mn create mode 100644 mozilla/security/nss/lib/freebl/md2.c create mode 100644 mozilla/security/nss/lib/freebl/md5.c create mode 100644 mozilla/security/nss/lib/freebl/mknewpc2.c create mode 100644 mozilla/security/nss/lib/freebl/mksp.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/Makefile create mode 100644 mozilla/security/nss/lib/freebl/mpi/Makefile.os2 create mode 100644 mozilla/security/nss/lib/freebl/mpi/Makefile.win create mode 100644 mozilla/security/nss/lib/freebl/mpi/README create mode 100755 mozilla/security/nss/lib/freebl/mpi/all-tests create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/LICENSE create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/LICENSE-MPL create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/basecvt.pod create mode 100755 mozilla/security/nss/lib/freebl/mpi/doc/build create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/div.txt create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/expt.txt create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/gcd.pod create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/invmod.pod create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/isprime.pod create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/lap.pod create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/mpi-test.pod create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/mul.txt create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/pi.txt create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/prime.txt create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/prng.pod create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/redux.txt create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/sqrt.txt create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/square.txt create mode 100644 mozilla/security/nss/lib/freebl/mpi/doc/timing.txt create mode 100644 mozilla/security/nss/lib/freebl/mpi/hpma512.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/hppa20.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/hppatch.adb create mode 100644 mozilla/security/nss/lib/freebl/mpi/logtab.h create mode 100755 mozilla/security/nss/lib/freebl/mpi/make-logtab create mode 100755 mozilla/security/nss/lib/freebl/mpi/make-test-arrays create mode 100644 mozilla/security/nss/lib/freebl/mpi/mdxptest.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/montmulf.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/montmulf.h create mode 100644 mozilla/security/nss/lib/freebl/mpi/montmulf.il create mode 100644 mozilla/security/nss/lib/freebl/mpi/montmulf.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/montmulfv8.il create mode 100644 mozilla/security/nss/lib/freebl/mpi/montmulfv8.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/montmulfv9.il create mode 100644 mozilla/security/nss/lib/freebl/mpi/montmulfv9.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/mp_comba.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/mp_comba_amd64_masm.asm create mode 100644 mozilla/security/nss/lib/freebl/mpi/mp_comba_amd64_sun.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/mp_gf2m-priv.h create mode 100644 mozilla/security/nss/lib/freebl/mpi/mp_gf2m.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/mp_gf2m.h create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpcpucache.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpcpucache_amd64.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpcpucache_x86.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpi-config.h create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpi-priv.h create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpi-test.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpi.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpi.h create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpi_amd64.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpi_amd64_gas.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpi_amd64_masm.asm create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpi_amd64_sun.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpi_hp.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpi_i86pc.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpi_mips.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpi_sparc.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpi_x86.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpi_x86_asm.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpi_x86_os2.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/mplogic.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/mplogic.h create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpmontg.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpprime.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpprime.h create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpv_sparc.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpv_sparcv8.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpv_sparcv8x.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpv_sparcv9.s create mode 100644 mozilla/security/nss/lib/freebl/mpi/mpvalpha.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/mulsqr.c create mode 100755 mozilla/security/nss/lib/freebl/mpi/multest create mode 100644 mozilla/security/nss/lib/freebl/mpi/primes.c create mode 100755 mozilla/security/nss/lib/freebl/mpi/stats create mode 100644 mozilla/security/nss/lib/freebl/mpi/target.mk create mode 100644 mozilla/security/nss/lib/freebl/mpi/test-arrays.txt create mode 100644 mozilla/security/nss/lib/freebl/mpi/test-info.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/LICENSE create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/LICENSE-MPL create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/mptest-1.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/mptest-2.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/mptest-3.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/mptest-3a.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/mptest-4.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/mptest-4a.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/mptest-4b.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/mptest-5.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/mptest-5a.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/mptest-6.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/mptest-7.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/mptest-8.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/mptest-9.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/mptest-b.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/pi1k.txt create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/pi2k.txt create mode 100644 mozilla/security/nss/lib/freebl/mpi/tests/pi5k.txt create mode 100755 mozilla/security/nss/lib/freebl/mpi/timetest create mode 100755 mozilla/security/nss/lib/freebl/mpi/types.pl create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/LICENSE create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/LICENSE-MPL create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/PRIMES create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/README create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/basecvt.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/bbs_rand.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/bbs_rand.h create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/bbsrand.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/dec2hex.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/exptmod.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/fact.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/gcd.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/hex2dec.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/identest.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/invmod.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/isprime.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/lap.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/makeprime.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/metime.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/pi.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/primegen.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/prng.c create mode 100755 mozilla/security/nss/lib/freebl/mpi/utils/ptab.pl create mode 100644 mozilla/security/nss/lib/freebl/mpi/utils/sieve.c create mode 100644 mozilla/security/nss/lib/freebl/mpi/vis_32.il create mode 100644 mozilla/security/nss/lib/freebl/mpi/vis_64.il create mode 100644 mozilla/security/nss/lib/freebl/mpi/vis_proto.h create mode 100644 mozilla/security/nss/lib/freebl/nsslowhash.c create mode 100644 mozilla/security/nss/lib/freebl/nsslowhash.h create mode 100644 mozilla/security/nss/lib/freebl/os2_rand.c create mode 100644 mozilla/security/nss/lib/freebl/pqg.c create mode 100644 mozilla/security/nss/lib/freebl/rawhash.c create mode 100644 mozilla/security/nss/lib/freebl/ret_cr16.s create mode 100644 mozilla/security/nss/lib/freebl/rijndael.c create mode 100644 mozilla/security/nss/lib/freebl/rijndael.h create mode 100644 mozilla/security/nss/lib/freebl/rijndael32.tab create mode 100644 mozilla/security/nss/lib/freebl/rijndael_tables.c create mode 100644 mozilla/security/nss/lib/freebl/rsa.c create mode 100644 mozilla/security/nss/lib/freebl/sechash.h create mode 100644 mozilla/security/nss/lib/freebl/secmpi.h create mode 100644 mozilla/security/nss/lib/freebl/secrng.h create mode 100644 mozilla/security/nss/lib/freebl/seed.c create mode 100644 mozilla/security/nss/lib/freebl/seed.h create mode 100644 mozilla/security/nss/lib/freebl/sha-fast-amd64-sun.s create mode 100644 mozilla/security/nss/lib/freebl/sha256.h create mode 100644 mozilla/security/nss/lib/freebl/sha512.c create mode 100644 mozilla/security/nss/lib/freebl/sha_fast.c create mode 100644 mozilla/security/nss/lib/freebl/sha_fast.h create mode 100644 mozilla/security/nss/lib/freebl/shsign.h create mode 100644 mozilla/security/nss/lib/freebl/shvfy.c create mode 100644 mozilla/security/nss/lib/freebl/stubs.c create mode 100644 mozilla/security/nss/lib/freebl/stubs.h create mode 100644 mozilla/security/nss/lib/freebl/sysrand.c create mode 100644 mozilla/security/nss/lib/freebl/tlsprfalg.c create mode 100644 mozilla/security/nss/lib/freebl/unix_rand.c create mode 100644 mozilla/security/nss/lib/freebl/win_rand.c create mode 100644 mozilla/security/nss/lib/jar/Makefile create mode 100644 mozilla/security/nss/lib/jar/config.mk create mode 100644 mozilla/security/nss/lib/jar/jar-ds.c create mode 100644 mozilla/security/nss/lib/jar/jar-ds.h create mode 100644 mozilla/security/nss/lib/jar/jar.c create mode 100644 mozilla/security/nss/lib/jar/jar.h create mode 100644 mozilla/security/nss/lib/jar/jarfile.c create mode 100644 mozilla/security/nss/lib/jar/jarfile.h create mode 100644 mozilla/security/nss/lib/jar/jarint.c create mode 100644 mozilla/security/nss/lib/jar/jarint.h create mode 100644 mozilla/security/nss/lib/jar/jarnav.c create mode 100644 mozilla/security/nss/lib/jar/jarsign.c create mode 100644 mozilla/security/nss/lib/jar/jarver.c create mode 100644 mozilla/security/nss/lib/jar/jzconf.h create mode 100644 mozilla/security/nss/lib/jar/jzlib.h create mode 100644 mozilla/security/nss/lib/jar/manifest.mn create mode 100755 mozilla/security/nss/lib/libpkix/Makefile create mode 100755 mozilla/security/nss/lib/libpkix/config.mk create mode 100755 mozilla/security/nss/lib/libpkix/include/Makefile create mode 100755 mozilla/security/nss/lib/libpkix/include/config.mk create mode 100755 mozilla/security/nss/lib/libpkix/include/manifest.mn create mode 100755 mozilla/security/nss/lib/libpkix/include/pkix.h create mode 100755 mozilla/security/nss/lib/libpkix/include/pkix_certsel.h create mode 100755 mozilla/security/nss/lib/libpkix/include/pkix_certstore.h create mode 100755 mozilla/security/nss/lib/libpkix/include/pkix_checker.h create mode 100755 mozilla/security/nss/lib/libpkix/include/pkix_crlsel.h create mode 100755 mozilla/security/nss/lib/libpkix/include/pkix_errorstrings.h create mode 100755 mozilla/security/nss/lib/libpkix/include/pkix_params.h create mode 100755 mozilla/security/nss/lib/libpkix/include/pkix_pl_pki.h create mode 100755 mozilla/security/nss/lib/libpkix/include/pkix_pl_system.h create mode 100755 mozilla/security/nss/lib/libpkix/include/pkix_results.h create mode 100755 mozilla/security/nss/lib/libpkix/include/pkix_revchecker.h create mode 100755 mozilla/security/nss/lib/libpkix/include/pkix_sample_modules.h create mode 100755 mozilla/security/nss/lib/libpkix/include/pkix_util.h create mode 100755 mozilla/security/nss/lib/libpkix/include/pkixt.h create mode 100755 mozilla/security/nss/lib/libpkix/manifest.mn create mode 100755 mozilla/security/nss/lib/libpkix/pkix/Makefile create mode 100755 mozilla/security/nss/lib/libpkix/pkix/certsel/Makefile create mode 100755 mozilla/security/nss/lib/libpkix/pkix/certsel/config.mk create mode 100755 mozilla/security/nss/lib/libpkix/pkix/certsel/manifest.mn create mode 100755 mozilla/security/nss/lib/libpkix/pkix/certsel/pkix_certselector.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/certsel/pkix_certselector.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/certsel/pkix_comcertselparams.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/certsel/pkix_comcertselparams.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/Makefile create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/config.mk create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/manifest.mn create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_basicconstraintschecker.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_basicconstraintschecker.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_certchainchecker.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_certchainchecker.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_crlchecker.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_crlchecker.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_ekuchecker.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_ekuchecker.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_expirationchecker.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_expirationchecker.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_namechainingchecker.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_namechainingchecker.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_nameconstraintschecker.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_nameconstraintschecker.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_ocspchecker.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_ocspchecker.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_policychecker.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_policychecker.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_revocationchecker.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_revocationchecker.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_revocationmethod.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_revocationmethod.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_signaturechecker.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_signaturechecker.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_targetcertchecker.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/checker/pkix_targetcertchecker.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/config.mk create mode 100755 mozilla/security/nss/lib/libpkix/pkix/crlsel/Makefile create mode 100755 mozilla/security/nss/lib/libpkix/pkix/crlsel/config.mk create mode 100755 mozilla/security/nss/lib/libpkix/pkix/crlsel/manifest.mn create mode 100755 mozilla/security/nss/lib/libpkix/pkix/crlsel/pkix_comcrlselparams.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/crlsel/pkix_comcrlselparams.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/crlsel/pkix_crlselector.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/crlsel/pkix_crlselector.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/manifest.mn create mode 100755 mozilla/security/nss/lib/libpkix/pkix/params/Makefile create mode 100755 mozilla/security/nss/lib/libpkix/pkix/params/config.mk create mode 100755 mozilla/security/nss/lib/libpkix/pkix/params/manifest.mn create mode 100755 mozilla/security/nss/lib/libpkix/pkix/params/pkix_buildparams.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/params/pkix_buildparams.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/params/pkix_procparams.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/params/pkix_procparams.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/params/pkix_resourcelimits.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/params/pkix_resourcelimits.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/params/pkix_trustanchor.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/params/pkix_trustanchor.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/params/pkix_valparams.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/params/pkix_valparams.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/results/Makefile create mode 100755 mozilla/security/nss/lib/libpkix/pkix/results/config.mk create mode 100755 mozilla/security/nss/lib/libpkix/pkix/results/manifest.mn create mode 100755 mozilla/security/nss/lib/libpkix/pkix/results/pkix_buildresult.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/results/pkix_buildresult.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/results/pkix_policynode.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/results/pkix_policynode.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/results/pkix_valresult.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/results/pkix_valresult.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/results/pkix_verifynode.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/results/pkix_verifynode.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/store/Makefile create mode 100755 mozilla/security/nss/lib/libpkix/pkix/store/config.mk create mode 100755 mozilla/security/nss/lib/libpkix/pkix/store/manifest.mn create mode 100755 mozilla/security/nss/lib/libpkix/pkix/store/pkix_store.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/store/pkix_store.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/top/Makefile create mode 100755 mozilla/security/nss/lib/libpkix/pkix/top/config.mk create mode 100755 mozilla/security/nss/lib/libpkix/pkix/top/manifest.mn create mode 100755 mozilla/security/nss/lib/libpkix/pkix/top/pkix_build.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/top/pkix_build.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/top/pkix_lifecycle.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/top/pkix_lifecycle.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/top/pkix_validate.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/top/pkix_validate.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/util/Makefile create mode 100755 mozilla/security/nss/lib/libpkix/pkix/util/config.mk create mode 100755 mozilla/security/nss/lib/libpkix/pkix/util/manifest.mn create mode 100755 mozilla/security/nss/lib/libpkix/pkix/util/pkix_error.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/util/pkix_error.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix/util/pkix_errpaths.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/util/pkix_list.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/util/pkix_list.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix/util/pkix_logger.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix/util/pkix_logger.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix/util/pkix_tools.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix/util/pkix_tools.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/Makefile create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/config.mk create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/manifest.mn create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/Makefile create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/config.mk create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/manifest.mn create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_aiamgr.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_aiamgr.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_colcertstore.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_colcertstore.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpdefaultclient.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpdefaultclient.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_ldapcertstore.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_ldapcertstore.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_ldapdefaultclient.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_ldapdefaultclient.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_ldaprequest.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_ldaprequest.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_ldapresponse.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_ldapresponse.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_ldapt.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_ldaptemplates.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_nsscontext.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_nsscontext.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_pk11certstore.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_pk11certstore.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_socket.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_socket.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/Makefile create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/config.mk create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/manifest.mn create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_basicconstraints.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_basicconstraints.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_cert.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_cert.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicyinfo.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicyinfo.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicymap.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicymap.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicyqualifier.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicyqualifier.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crl.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crl.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crldp.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crldp.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crlentry.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crlentry.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_date.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_date.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_generalname.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_generalname.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_infoaccess.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_infoaccess.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_nameconstraints.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_nameconstraints.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocspcertid.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocspcertid.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocsprequest.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocsprequest.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocspresponse.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocspresponse.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_publickey.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_publickey.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_x500name.c create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_x500name.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/Makefile create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/config.mk create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/manifest.mn create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_bigint.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_bigint.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_bytearray.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_bytearray.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_common.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_common.h create mode 100644 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_error.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_hashtable.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_hashtable.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_lifecycle.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_lifecycle.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_mem.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_mem.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_monitorlock.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_monitorlock.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_mutex.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_mutex.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_object.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_object.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_primhash.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_primhash.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_rwlock.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_rwlock.h create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_string.c create mode 100755 mozilla/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_string.h create mode 100644 mozilla/security/nss/lib/manifest.mn create mode 100644 mozilla/security/nss/lib/nss/Makefile create mode 100644 mozilla/security/nss/lib/nss/config.mk create mode 100644 mozilla/security/nss/lib/nss/manifest.mn create mode 100644 mozilla/security/nss/lib/nss/nss.def create mode 100644 mozilla/security/nss/lib/nss/nss.h create mode 100644 mozilla/security/nss/lib/nss/nss.rc create mode 100644 mozilla/security/nss/lib/nss/nssinit.c create mode 100644 mozilla/security/nss/lib/nss/nssrenam.h create mode 100644 mozilla/security/nss/lib/nss/nssver.c create mode 100644 mozilla/security/nss/lib/nss/pkixpriv.def create mode 100644 mozilla/security/nss/lib/nss/utilwrap.c create mode 100644 mozilla/security/nss/lib/pk11wrap/Makefile create mode 100644 mozilla/security/nss/lib/pk11wrap/config.mk create mode 100644 mozilla/security/nss/lib/pk11wrap/debug_module.c create mode 100644 mozilla/security/nss/lib/pk11wrap/dev3hack.c create mode 100644 mozilla/security/nss/lib/pk11wrap/dev3hack.h create mode 100644 mozilla/security/nss/lib/pk11wrap/manifest.mn create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11akey.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11auth.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11cert.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11cxt.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11err.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11func.h create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11kea.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11list.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11load.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11mech.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11merge.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11nobj.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11obj.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11pars.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11pbe.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11pk12.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11pqg.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11pqg.h create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11priv.h create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11pub.h create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11sdr.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11sdr.h create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11skey.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11slot.c create mode 100644 mozilla/security/nss/lib/pk11wrap/pk11util.c create mode 100644 mozilla/security/nss/lib/pk11wrap/secmod.h create mode 100644 mozilla/security/nss/lib/pk11wrap/secmodi.h create mode 100644 mozilla/security/nss/lib/pk11wrap/secmodti.h create mode 100644 mozilla/security/nss/lib/pk11wrap/secpkcs5.h create mode 100644 mozilla/security/nss/lib/pkcs12/Makefile create mode 100644 mozilla/security/nss/lib/pkcs12/config.mk create mode 100644 mozilla/security/nss/lib/pkcs12/manifest.mn create mode 100644 mozilla/security/nss/lib/pkcs12/p12.h create mode 100644 mozilla/security/nss/lib/pkcs12/p12creat.c create mode 100644 mozilla/security/nss/lib/pkcs12/p12d.c create mode 100644 mozilla/security/nss/lib/pkcs12/p12dec.c create mode 100644 mozilla/security/nss/lib/pkcs12/p12e.c create mode 100644 mozilla/security/nss/lib/pkcs12/p12exp.c create mode 100644 mozilla/security/nss/lib/pkcs12/p12local.c create mode 100644 mozilla/security/nss/lib/pkcs12/p12local.h create mode 100644 mozilla/security/nss/lib/pkcs12/p12plcy.c create mode 100644 mozilla/security/nss/lib/pkcs12/p12plcy.h create mode 100644 mozilla/security/nss/lib/pkcs12/p12t.h create mode 100644 mozilla/security/nss/lib/pkcs12/p12tmpl.c create mode 100644 mozilla/security/nss/lib/pkcs12/pkcs12.h create mode 100644 mozilla/security/nss/lib/pkcs12/pkcs12t.h create mode 100644 mozilla/security/nss/lib/pkcs7/Makefile create mode 100644 mozilla/security/nss/lib/pkcs7/certread.c create mode 100644 mozilla/security/nss/lib/pkcs7/config.mk create mode 100644 mozilla/security/nss/lib/pkcs7/manifest.mn create mode 100644 mozilla/security/nss/lib/pkcs7/p7common.c create mode 100644 mozilla/security/nss/lib/pkcs7/p7create.c create mode 100644 mozilla/security/nss/lib/pkcs7/p7decode.c create mode 100644 mozilla/security/nss/lib/pkcs7/p7encode.c create mode 100644 mozilla/security/nss/lib/pkcs7/p7local.c create mode 100644 mozilla/security/nss/lib/pkcs7/p7local.h create mode 100644 mozilla/security/nss/lib/pkcs7/pkcs7t.h create mode 100644 mozilla/security/nss/lib/pkcs7/secmime.c create mode 100644 mozilla/security/nss/lib/pkcs7/secmime.h create mode 100644 mozilla/security/nss/lib/pkcs7/secpkcs7.h create mode 100644 mozilla/security/nss/lib/pki/Makefile create mode 100644 mozilla/security/nss/lib/pki/asymmkey.c create mode 100644 mozilla/security/nss/lib/pki/certdecode.c create mode 100644 mozilla/security/nss/lib/pki/certificate.c create mode 100644 mozilla/security/nss/lib/pki/config.mk create mode 100644 mozilla/security/nss/lib/pki/cryptocontext.c create mode 100644 mozilla/security/nss/lib/pki/doc/standiag.png create mode 100644 mozilla/security/nss/lib/pki/doc/standoc.html create mode 100644 mozilla/security/nss/lib/pki/manifest.mn create mode 100644 mozilla/security/nss/lib/pki/nsspki.h create mode 100644 mozilla/security/nss/lib/pki/nsspkit.h create mode 100644 mozilla/security/nss/lib/pki/pki.h create mode 100644 mozilla/security/nss/lib/pki/pki3hack.c create mode 100644 mozilla/security/nss/lib/pki/pki3hack.h create mode 100644 mozilla/security/nss/lib/pki/pkibase.c create mode 100644 mozilla/security/nss/lib/pki/pkim.h create mode 100644 mozilla/security/nss/lib/pki/pkistore.c create mode 100644 mozilla/security/nss/lib/pki/pkistore.h create mode 100644 mozilla/security/nss/lib/pki/pkit.h create mode 100644 mozilla/security/nss/lib/pki/pkitm.h create mode 100644 mozilla/security/nss/lib/pki/symmkey.c create mode 100644 mozilla/security/nss/lib/pki/tdcache.c create mode 100644 mozilla/security/nss/lib/pki/trustdomain.c create mode 100644 mozilla/security/nss/lib/smime/Makefile create mode 100644 mozilla/security/nss/lib/smime/cms.h create mode 100644 mozilla/security/nss/lib/smime/cmsarray.c create mode 100644 mozilla/security/nss/lib/smime/cmsasn1.c create mode 100644 mozilla/security/nss/lib/smime/cmsattr.c create mode 100644 mozilla/security/nss/lib/smime/cmscinfo.c create mode 100644 mozilla/security/nss/lib/smime/cmscipher.c create mode 100644 mozilla/security/nss/lib/smime/cmsdecode.c create mode 100644 mozilla/security/nss/lib/smime/cmsdigdata.c create mode 100644 mozilla/security/nss/lib/smime/cmsdigest.c create mode 100644 mozilla/security/nss/lib/smime/cmsencdata.c create mode 100644 mozilla/security/nss/lib/smime/cmsencode.c create mode 100644 mozilla/security/nss/lib/smime/cmsenvdata.c create mode 100644 mozilla/security/nss/lib/smime/cmslocal.h create mode 100644 mozilla/security/nss/lib/smime/cmsmessage.c create mode 100644 mozilla/security/nss/lib/smime/cmspubkey.c create mode 100644 mozilla/security/nss/lib/smime/cmsrecinfo.c create mode 100644 mozilla/security/nss/lib/smime/cmsreclist.c create mode 100644 mozilla/security/nss/lib/smime/cmsreclist.h create mode 100644 mozilla/security/nss/lib/smime/cmssigdata.c create mode 100644 mozilla/security/nss/lib/smime/cmssiginfo.c create mode 100644 mozilla/security/nss/lib/smime/cmst.h create mode 100644 mozilla/security/nss/lib/smime/cmsutil.c create mode 100644 mozilla/security/nss/lib/smime/config.mk create mode 100644 mozilla/security/nss/lib/smime/manifest.mn create mode 100644 mozilla/security/nss/lib/smime/smime.def create mode 100644 mozilla/security/nss/lib/smime/smime.h create mode 100644 mozilla/security/nss/lib/smime/smime.rc create mode 100644 mozilla/security/nss/lib/smime/smimemessage.c create mode 100644 mozilla/security/nss/lib/smime/smimesym.c create mode 100644 mozilla/security/nss/lib/smime/smimeutil.c create mode 100644 mozilla/security/nss/lib/smime/smimever.c create mode 100644 mozilla/security/nss/lib/softoken/Makefile create mode 100644 mozilla/security/nss/lib/softoken/config.mk create mode 100644 mozilla/security/nss/lib/softoken/ecdecode.c create mode 100644 mozilla/security/nss/lib/softoken/fipsaudt.c create mode 100644 mozilla/security/nss/lib/softoken/fipstest.c create mode 100644 mozilla/security/nss/lib/softoken/fipstokn.c create mode 100644 mozilla/security/nss/lib/softoken/jpakesftk.c create mode 100644 mozilla/security/nss/lib/softoken/legacydb/Makefile create mode 100644 mozilla/security/nss/lib/softoken/legacydb/cdbhdl.h create mode 100644 mozilla/security/nss/lib/softoken/legacydb/config.mk create mode 100644 mozilla/security/nss/lib/softoken/legacydb/dbmshim.c create mode 100644 mozilla/security/nss/lib/softoken/legacydb/keydb.c create mode 100644 mozilla/security/nss/lib/softoken/legacydb/keydbi.h create mode 100644 mozilla/security/nss/lib/softoken/legacydb/lgattr.c create mode 100644 mozilla/security/nss/lib/softoken/legacydb/lgcreate.c create mode 100644 mozilla/security/nss/lib/softoken/legacydb/lgdb.h create mode 100644 mozilla/security/nss/lib/softoken/legacydb/lgdestroy.c create mode 100644 mozilla/security/nss/lib/softoken/legacydb/lgfind.c create mode 100644 mozilla/security/nss/lib/softoken/legacydb/lginit.c create mode 100644 mozilla/security/nss/lib/softoken/legacydb/lgutil.c create mode 100644 mozilla/security/nss/lib/softoken/legacydb/lowcert.c create mode 100644 mozilla/security/nss/lib/softoken/legacydb/lowkey.c create mode 100644 mozilla/security/nss/lib/softoken/legacydb/lowkeyi.h create mode 100644 mozilla/security/nss/lib/softoken/legacydb/lowkeyti.h create mode 100644 mozilla/security/nss/lib/softoken/legacydb/manifest.mn create mode 100644 mozilla/security/nss/lib/softoken/legacydb/nssdbm.def create mode 100644 mozilla/security/nss/lib/softoken/legacydb/nssdbm.rc create mode 100644 mozilla/security/nss/lib/softoken/legacydb/pcert.h create mode 100644 mozilla/security/nss/lib/softoken/legacydb/pcertdb.c create mode 100644 mozilla/security/nss/lib/softoken/legacydb/pcertt.h create mode 100644 mozilla/security/nss/lib/softoken/legacydb/pk11db.c create mode 100644 mozilla/security/nss/lib/softoken/lgglue.c create mode 100644 mozilla/security/nss/lib/softoken/lgglue.h create mode 100644 mozilla/security/nss/lib/softoken/lowkey.c create mode 100644 mozilla/security/nss/lib/softoken/lowkeyi.h create mode 100644 mozilla/security/nss/lib/softoken/lowkeyti.h create mode 100644 mozilla/security/nss/lib/softoken/lowpbe.c create mode 100644 mozilla/security/nss/lib/softoken/lowpbe.h create mode 100644 mozilla/security/nss/lib/softoken/manifest.mn create mode 100644 mozilla/security/nss/lib/softoken/padbuf.c create mode 100644 mozilla/security/nss/lib/softoken/pk11init.h create mode 100644 mozilla/security/nss/lib/softoken/pk11pars.h create mode 100644 mozilla/security/nss/lib/softoken/pkcs11.c create mode 100644 mozilla/security/nss/lib/softoken/pkcs11c.c create mode 100644 mozilla/security/nss/lib/softoken/pkcs11i.h create mode 100644 mozilla/security/nss/lib/softoken/pkcs11ni.h create mode 100644 mozilla/security/nss/lib/softoken/pkcs11u.c create mode 100644 mozilla/security/nss/lib/softoken/rsawrapr.c create mode 100644 mozilla/security/nss/lib/softoken/sdb.c create mode 100644 mozilla/security/nss/lib/softoken/sdb.h create mode 100644 mozilla/security/nss/lib/softoken/secmodt.h create mode 100644 mozilla/security/nss/lib/softoken/sftkdb.c create mode 100644 mozilla/security/nss/lib/softoken/sftkdb.h create mode 100644 mozilla/security/nss/lib/softoken/sftkdbt.h create mode 100644 mozilla/security/nss/lib/softoken/sftkdbti.h create mode 100644 mozilla/security/nss/lib/softoken/sftkmod.c create mode 100644 mozilla/security/nss/lib/softoken/sftkpars.c create mode 100644 mozilla/security/nss/lib/softoken/sftkpars.h create mode 100644 mozilla/security/nss/lib/softoken/sftkpwd.c create mode 100644 mozilla/security/nss/lib/softoken/softkver.c create mode 100644 mozilla/security/nss/lib/softoken/softkver.h create mode 100644 mozilla/security/nss/lib/softoken/softoken.h create mode 100644 mozilla/security/nss/lib/softoken/softokn.def create mode 100644 mozilla/security/nss/lib/softoken/softokn.rc create mode 100644 mozilla/security/nss/lib/softoken/softoknt.h create mode 100644 mozilla/security/nss/lib/softoken/tlsprf.c create mode 100644 mozilla/security/nss/lib/sqlite/Makefile create mode 100644 mozilla/security/nss/lib/sqlite/README create mode 100644 mozilla/security/nss/lib/sqlite/config.mk create mode 100644 mozilla/security/nss/lib/sqlite/manifest.mn create mode 100644 mozilla/security/nss/lib/sqlite/sqlite.def create mode 100644 mozilla/security/nss/lib/sqlite/sqlite3.c create mode 100644 mozilla/security/nss/lib/sqlite/sqlite3.h create mode 100644 mozilla/security/nss/lib/ssl/Makefile create mode 100644 mozilla/security/nss/lib/ssl/authcert.c create mode 100644 mozilla/security/nss/lib/ssl/cmpcert.c create mode 100644 mozilla/security/nss/lib/ssl/config.mk create mode 100644 mozilla/security/nss/lib/ssl/derive.c create mode 100644 mozilla/security/nss/lib/ssl/manifest.mn create mode 100644 mozilla/security/nss/lib/ssl/notes.txt create mode 100644 mozilla/security/nss/lib/ssl/nsskea.c create mode 100644 mozilla/security/nss/lib/ssl/os2_err.c create mode 100644 mozilla/security/nss/lib/ssl/os2_err.h create mode 100644 mozilla/security/nss/lib/ssl/preenc.h create mode 100644 mozilla/security/nss/lib/ssl/prelib.c create mode 100644 mozilla/security/nss/lib/ssl/ssl.def create mode 100644 mozilla/security/nss/lib/ssl/ssl.h create mode 100644 mozilla/security/nss/lib/ssl/ssl.rc create mode 100644 mozilla/security/nss/lib/ssl/ssl3con.c create mode 100644 mozilla/security/nss/lib/ssl/ssl3ecc.c create mode 100644 mozilla/security/nss/lib/ssl/ssl3ext.c create mode 100644 mozilla/security/nss/lib/ssl/ssl3gthr.c create mode 100644 mozilla/security/nss/lib/ssl/ssl3prot.h create mode 100644 mozilla/security/nss/lib/ssl/sslauth.c create mode 100644 mozilla/security/nss/lib/ssl/sslcon.c create mode 100644 mozilla/security/nss/lib/ssl/ssldef.c create mode 100644 mozilla/security/nss/lib/ssl/sslenum.c create mode 100644 mozilla/security/nss/lib/ssl/sslerr.c create mode 100644 mozilla/security/nss/lib/ssl/sslerr.h create mode 100644 mozilla/security/nss/lib/ssl/sslgathr.c create mode 100644 mozilla/security/nss/lib/ssl/sslimpl.h create mode 100644 mozilla/security/nss/lib/ssl/sslinfo.c create mode 100644 mozilla/security/nss/lib/ssl/sslmutex.c create mode 100644 mozilla/security/nss/lib/ssl/sslmutex.h create mode 100644 mozilla/security/nss/lib/ssl/sslnonce.c create mode 100644 mozilla/security/nss/lib/ssl/sslproto.h create mode 100644 mozilla/security/nss/lib/ssl/sslreveal.c create mode 100644 mozilla/security/nss/lib/ssl/sslsecur.c create mode 100644 mozilla/security/nss/lib/ssl/sslsnce.c create mode 100644 mozilla/security/nss/lib/ssl/sslsock.c create mode 100644 mozilla/security/nss/lib/ssl/sslt.h create mode 100644 mozilla/security/nss/lib/ssl/ssltrace.c create mode 100644 mozilla/security/nss/lib/ssl/sslver.c create mode 100644 mozilla/security/nss/lib/ssl/unix_err.c create mode 100644 mozilla/security/nss/lib/ssl/unix_err.h create mode 100644 mozilla/security/nss/lib/ssl/win32err.c create mode 100644 mozilla/security/nss/lib/ssl/win32err.h create mode 100644 mozilla/security/nss/lib/sysinit/Makefile create mode 100644 mozilla/security/nss/lib/sysinit/config.mk create mode 100644 mozilla/security/nss/lib/sysinit/manifest.mn create mode 100644 mozilla/security/nss/lib/sysinit/nsssysinit.c create mode 100644 mozilla/security/nss/lib/util/Makefile create mode 100644 mozilla/security/nss/lib/util/base64.h create mode 100644 mozilla/security/nss/lib/util/ciferfam.h create mode 100644 mozilla/security/nss/lib/util/config.mk create mode 100644 mozilla/security/nss/lib/util/derdec.c create mode 100644 mozilla/security/nss/lib/util/derenc.c create mode 100644 mozilla/security/nss/lib/util/dersubr.c create mode 100644 mozilla/security/nss/lib/util/dertime.c create mode 100644 mozilla/security/nss/lib/util/manifest.mn create mode 100644 mozilla/security/nss/lib/util/nssb64.h create mode 100644 mozilla/security/nss/lib/util/nssb64d.c create mode 100644 mozilla/security/nss/lib/util/nssb64e.c create mode 100644 mozilla/security/nss/lib/util/nssb64t.h create mode 100644 mozilla/security/nss/lib/util/nssilckt.h create mode 100644 mozilla/security/nss/lib/util/nssilock.c create mode 100644 mozilla/security/nss/lib/util/nssilock.h create mode 100644 mozilla/security/nss/lib/util/nsslocks.h create mode 100644 mozilla/security/nss/lib/util/nssrwlk.c create mode 100644 mozilla/security/nss/lib/util/nssrwlk.h create mode 100644 mozilla/security/nss/lib/util/nssrwlkt.h create mode 100644 mozilla/security/nss/lib/util/nssutil.def create mode 100644 mozilla/security/nss/lib/util/nssutil.h create mode 100644 mozilla/security/nss/lib/util/nssutil.rc create mode 100644 mozilla/security/nss/lib/util/oidstring.c create mode 100644 mozilla/security/nss/lib/util/pkcs11.h create mode 100644 mozilla/security/nss/lib/util/pkcs11f.h create mode 100644 mozilla/security/nss/lib/util/pkcs11n.h create mode 100644 mozilla/security/nss/lib/util/pkcs11p.h create mode 100644 mozilla/security/nss/lib/util/pkcs11t.h create mode 100644 mozilla/security/nss/lib/util/pkcs11u.h create mode 100644 mozilla/security/nss/lib/util/portreg.c create mode 100644 mozilla/security/nss/lib/util/portreg.h create mode 100644 mozilla/security/nss/lib/util/quickder.c create mode 100644 mozilla/security/nss/lib/util/secalgid.c create mode 100644 mozilla/security/nss/lib/util/secasn1.h create mode 100644 mozilla/security/nss/lib/util/secasn1d.c create mode 100644 mozilla/security/nss/lib/util/secasn1e.c create mode 100644 mozilla/security/nss/lib/util/secasn1t.h create mode 100644 mozilla/security/nss/lib/util/secasn1u.c create mode 100644 mozilla/security/nss/lib/util/seccomon.h create mode 100644 mozilla/security/nss/lib/util/secder.h create mode 100644 mozilla/security/nss/lib/util/secdert.h create mode 100644 mozilla/security/nss/lib/util/secdig.c create mode 100644 mozilla/security/nss/lib/util/secdig.h create mode 100644 mozilla/security/nss/lib/util/secdigt.h create mode 100644 mozilla/security/nss/lib/util/secerr.h create mode 100644 mozilla/security/nss/lib/util/secitem.c create mode 100644 mozilla/security/nss/lib/util/secitem.h create mode 100644 mozilla/security/nss/lib/util/secload.c create mode 100644 mozilla/security/nss/lib/util/secoid.c create mode 100644 mozilla/security/nss/lib/util/secoid.h create mode 100644 mozilla/security/nss/lib/util/secoidt.h create mode 100644 mozilla/security/nss/lib/util/secplcy.c create mode 100644 mozilla/security/nss/lib/util/secplcy.h create mode 100644 mozilla/security/nss/lib/util/secport.c create mode 100644 mozilla/security/nss/lib/util/secport.h create mode 100644 mozilla/security/nss/lib/util/sectime.c create mode 100644 mozilla/security/nss/lib/util/templates.c create mode 100644 mozilla/security/nss/lib/util/utf8.c create mode 100644 mozilla/security/nss/lib/util/utilrename.h create mode 100644 mozilla/security/nss/lib/zlib/Makefile create mode 100644 mozilla/security/nss/lib/zlib/README create mode 100644 mozilla/security/nss/lib/zlib/adler32.c create mode 100644 mozilla/security/nss/lib/zlib/compress.c create mode 100644 mozilla/security/nss/lib/zlib/config.mk create mode 100644 mozilla/security/nss/lib/zlib/crc32.c create mode 100644 mozilla/security/nss/lib/zlib/crc32.h create mode 100644 mozilla/security/nss/lib/zlib/deflate.c create mode 100644 mozilla/security/nss/lib/zlib/deflate.h create mode 100644 mozilla/security/nss/lib/zlib/example.c create mode 100644 mozilla/security/nss/lib/zlib/gzio.c create mode 100644 mozilla/security/nss/lib/zlib/infback.c create mode 100644 mozilla/security/nss/lib/zlib/inffast.c create mode 100644 mozilla/security/nss/lib/zlib/inffast.h create mode 100644 mozilla/security/nss/lib/zlib/inffixed.h create mode 100644 mozilla/security/nss/lib/zlib/inflate.c create mode 100644 mozilla/security/nss/lib/zlib/inflate.h create mode 100644 mozilla/security/nss/lib/zlib/inftrees.c create mode 100644 mozilla/security/nss/lib/zlib/inftrees.h create mode 100644 mozilla/security/nss/lib/zlib/manifest.mn create mode 100644 mozilla/security/nss/lib/zlib/minigzip.c create mode 100644 mozilla/security/nss/lib/zlib/trees.c create mode 100644 mozilla/security/nss/lib/zlib/trees.h create mode 100644 mozilla/security/nss/lib/zlib/uncompr.c create mode 100644 mozilla/security/nss/lib/zlib/zconf.h create mode 100644 mozilla/security/nss/lib/zlib/zlib.h create mode 100644 mozilla/security/nss/lib/zlib/zutil.c create mode 100644 mozilla/security/nss/lib/zlib/zutil.h create mode 100644 mozilla/security/nss/manifest.mn create mode 100644 mozilla/security/nss/pkg/Makefile create mode 100644 mozilla/security/nss/pkg/linux/Makefile create mode 100644 mozilla/security/nss/pkg/linux/sun-nss.spec create mode 100644 mozilla/security/nss/pkg/solaris/Makefile create mode 100755 mozilla/security/nss/pkg/solaris/Makefile-devl.com create mode 100755 mozilla/security/nss/pkg/solaris/Makefile-devl.targ create mode 100755 mozilla/security/nss/pkg/solaris/Makefile-tlsu.com create mode 100755 mozilla/security/nss/pkg/solaris/Makefile-tlsu.targ create mode 100644 mozilla/security/nss/pkg/solaris/Makefile.com create mode 100644 mozilla/security/nss/pkg/solaris/Makefile.targ create mode 100644 mozilla/security/nss/pkg/solaris/SUNWtls/Makefile create mode 100644 mozilla/security/nss/pkg/solaris/SUNWtls/pkgdepend create mode 100644 mozilla/security/nss/pkg/solaris/SUNWtls/pkginfo.tmpl create mode 100644 mozilla/security/nss/pkg/solaris/SUNWtls/prototype_com create mode 100644 mozilla/security/nss/pkg/solaris/SUNWtls/prototype_i386 create mode 100644 mozilla/security/nss/pkg/solaris/SUNWtls/prototype_sparc create mode 100755 mozilla/security/nss/pkg/solaris/SUNWtlsd/Makefile create mode 100755 mozilla/security/nss/pkg/solaris/SUNWtlsd/pkgdepend create mode 100755 mozilla/security/nss/pkg/solaris/SUNWtlsd/pkginfo.tmpl create mode 100755 mozilla/security/nss/pkg/solaris/SUNWtlsd/prototype create mode 100755 mozilla/security/nss/pkg/solaris/SUNWtlsu/Makefile create mode 100755 mozilla/security/nss/pkg/solaris/SUNWtlsu/pkgdepend create mode 100755 mozilla/security/nss/pkg/solaris/SUNWtlsu/pkginfo.tmpl create mode 100755 mozilla/security/nss/pkg/solaris/SUNWtlsu/prototype_com create mode 100644 mozilla/security/nss/pkg/solaris/SUNWtlsu/prototype_i386 create mode 100644 mozilla/security/nss/pkg/solaris/SUNWtlsu/prototype_sparc create mode 100644 mozilla/security/nss/pkg/solaris/bld_awk_pkginfo.ksh create mode 100644 mozilla/security/nss/pkg/solaris/common_files/copyright create mode 100644 mozilla/security/nss/pkg/solaris/proto64.mk create mode 100644 mozilla/security/nss/tests/README.txt create mode 100755 mozilla/security/nss/tests/all.sh create mode 100755 mozilla/security/nss/tests/cert/cert.sh create mode 100644 mozilla/security/nss/tests/cert/certext.txt create mode 100644 mozilla/security/nss/tests/chains/chains.sh create mode 100755 mozilla/security/nss/tests/chains/ocspd-config/ocspd-certs.sh create mode 100644 mozilla/security/nss/tests/chains/ocspd-config/ocspd.conf.template create mode 100644 mozilla/security/nss/tests/chains/ocspd-config/readme create mode 100644 mozilla/security/nss/tests/chains/scenarios/aia.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/anypolicy.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/anypolicywithlevel.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/bridge.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/bridgewithaia.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/bridgewithhalfaia.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/bridgewithpolicyextensionandmapping.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/crldp.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/dsa.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/explicitPolicy.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/extension.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/extension2.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/mapping.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/mapping2.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/megabridge_3_2.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/ocsp.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/ocspd.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/realcerts.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/revoc.cfg create mode 100644 mozilla/security/nss/tests/chains/scenarios/scenarios create mode 100755 mozilla/security/nss/tests/cipher/cipher.sh create mode 100644 mozilla/security/nss/tests/cipher/cipher.txt create mode 100644 mozilla/security/nss/tests/cipher/dsa.txt create mode 100644 mozilla/security/nss/tests/cipher/hash.txt create mode 100755 mozilla/security/nss/tests/cipher/performance.sh create mode 100644 mozilla/security/nss/tests/cipher/rsa.txt create mode 100644 mozilla/security/nss/tests/cipher/symmkey.txt create mode 100755 mozilla/security/nss/tests/clean_tbx create mode 100644 mozilla/security/nss/tests/cmdtests/cmdtests.sh create mode 100644 mozilla/security/nss/tests/common/Makefile create mode 100755 mozilla/security/nss/tests/common/cleanup.sh create mode 100644 mozilla/security/nss/tests/common/init.sh create mode 100644 mozilla/security/nss/tests/common/results_header.html create mode 100755 mozilla/security/nss/tests/core_watch create mode 100644 mozilla/security/nss/tests/crmf/crmf.sh create mode 100755 mozilla/security/nss/tests/dbtests/dbtests.sh create mode 100755 mozilla/security/nss/tests/dbupgrade/dbupgrade.sh create mode 100755 mozilla/security/nss/tests/dll_version.sh create mode 100644 mozilla/security/nss/tests/doc/clean.gif create mode 100755 mozilla/security/nss/tests/doc/nssqa.txt create mode 100644 mozilla/security/nss/tests/doc/platform_specific_problems create mode 100755 mozilla/security/nss/tests/doc/qa_wrapper.html create mode 100755 mozilla/security/nss/tests/fips/fips.sh create mode 100644 mozilla/security/nss/tests/header create mode 100644 mozilla/security/nss/tests/iopr/cert_iopr.sh create mode 100644 mozilla/security/nss/tests/iopr/ocsp_iopr.sh create mode 100644 mozilla/security/nss/tests/iopr/server_scr/apache_unix.cfg create mode 100644 mozilla/security/nss/tests/iopr/server_scr/cert_gen.sh create mode 100644 mozilla/security/nss/tests/iopr/server_scr/cipher.list create mode 100644 mozilla/security/nss/tests/iopr/server_scr/client.cgi create mode 100644 mozilla/security/nss/tests/iopr/server_scr/config create mode 100644 mozilla/security/nss/tests/iopr/server_scr/iis_windows.cfg create mode 100644 mozilla/security/nss/tests/iopr/server_scr/iopr_server.cfg create mode 100644 mozilla/security/nss/tests/iopr/server_scr/sslreq.dat create mode 100644 mozilla/security/nss/tests/iopr/ssl_iopr.sh create mode 100755 mozilla/security/nss/tests/jss_dll_version.sh create mode 100755 mozilla/security/nss/tests/jssdir create mode 100755 mozilla/security/nss/tests/jssqa create mode 100644 mozilla/security/nss/tests/libpkix/cert_trust.map create mode 100644 mozilla/security/nss/tests/libpkix/certs/BrAirWaysBadSig.cert create mode 100755 mozilla/security/nss/tests/libpkix/certs/CertificatePoliciesCritical.crt create mode 100644 mozilla/security/nss/tests/libpkix/certs/GoodCACert.crt create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPCA1.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPCA1.p12 create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPCA2.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPCA2.p12 create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPCA3.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPCA3.p12 create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPEE11.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPEE12.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPEE13.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPEE14.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPEE15.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPEE21.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPEE22.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPEE23.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPEE31.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPEE32.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPEE33.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPRoot.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/OCSPRoot.p12 create mode 100644 mozilla/security/nss/tests/libpkix/certs/PayPalEE.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/PayPalICA.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/PayPalRootCA.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/TestCA.ca.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/TestUser50.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/TestUser51.cert create mode 100644 mozilla/security/nss/tests/libpkix/certs/TrustAnchorRootCertificate.crt create mode 100644 mozilla/security/nss/tests/libpkix/certs/ValidCertificatePathTest1EE.crt create mode 100755 mozilla/security/nss/tests/libpkix/certs/anchor2dsa create mode 100755 mozilla/security/nss/tests/libpkix/certs/crldiff.crl create mode 100755 mozilla/security/nss/tests/libpkix/certs/crlgood.crl create mode 100755 mozilla/security/nss/tests/libpkix/certs/extKeyUsage/codeSigningEKUCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/extKeyUsage/multiEKUCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/extKeyUsage/noEKUCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameDnCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameDnCert_diff create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameDnsCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameDnsCert_diff create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameEdiCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameEdiCert_diff create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameIpCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameIpCert_diff create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameNoneCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameOidCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameOidCert_diff create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameOtherCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameOtherCert_diff create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameRfc822Cert create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameRfc822Cert_diff create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameRfc822DnsCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameUriCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameUriCert_diff create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameX400Cert create mode 100755 mozilla/security/nss/tests/libpkix/certs/generalName/altNameX400Cert_diff create mode 100755 mozilla/security/nss/tests/libpkix/certs/hanfeiyu2hanfeiyu create mode 100755 mozilla/security/nss/tests/libpkix/certs/hy2hc-bc create mode 100755 mozilla/security/nss/tests/libpkix/certs/hy2hy-bc0 create mode 100755 mozilla/security/nss/tests/libpkix/certs/issuer-hanfei.crl create mode 100755 mozilla/security/nss/tests/libpkix/certs/issuer-none.crl create mode 100755 mozilla/security/nss/tests/libpkix/certs/keyIdentifier/authKeyIDCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/keyIdentifier/subjKeyIDCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/keyUsage/decipherOnlyCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/keyUsage/encipherOnlyCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/keyUsage/multiKeyUsagesCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/keyUsage/noKeyUsagesCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/noExtensionsCert create mode 100755 mozilla/security/nss/tests/libpkix/certs/nss2alice create mode 100755 mozilla/security/nss/tests/libpkix/certs/publicKey/dsaWithParams create mode 100755 mozilla/security/nss/tests/libpkix/certs/publicKey/dsaWithoutParams create mode 100755 mozilla/security/nss/tests/libpkix/certs/publicKey/labs2yassir create mode 100755 mozilla/security/nss/tests/libpkix/certs/publicKey/yassir2labs create mode 100755 mozilla/security/nss/tests/libpkix/certs/sun2sun create mode 100755 mozilla/security/nss/tests/libpkix/certs/yassir2bcn create mode 100755 mozilla/security/nss/tests/libpkix/certs/yassir2yassir create mode 100644 mozilla/security/nss/tests/libpkix/common/libpkix_init.sh create mode 100644 mozilla/security/nss/tests/libpkix/common/libpkix_init_nist.sh create mode 100755 mozilla/security/nss/tests/libpkix/libpkix.sh create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/cert8.db create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/key3.db create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/rev_data/local/crldiff.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/rev_data/local/crlgood.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/rev_data/local/issuer-hanfei.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/rev_data/local/issuer-none.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/rev_data/test_eku_all.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/rev_data/test_eku_allbutcodesigningEE.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/rev_data/test_eku_clientauth.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/rev_data/test_eku_clientauthEE.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/rev_data/test_eku_codesigning_clientauth.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/runPLTests.sh create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/secmod.db create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/pki/rev_data/local/README create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/pki/rev_data/local/crldiff.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/pki/rev_data/local/crlgood.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/pki/rev_data/local/issuer-hanfei.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/pki/rev_data/local/issuer-none.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/pki/runPLTests.sh create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/runPLTests.sh create mode 100755 mozilla/security/nss/tests/libpkix/pkix_pl_tests/system/runPLTests.sh create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/certsel/keyUsage create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/certsel/runTests.sh create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/checker/runTests.sh create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/crlsel/runTests.sh create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/params/runTests.sh create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/results/runTests.sh create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/runTests.sh create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/store/runTests.sh create mode 100644 mozilla/security/nss/tests/libpkix/pkix_tests/top/anchorcert.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/backtracking/signature/greg.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/backtracking/signature/greg2yassir_badsig.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/backtracking/signature/jes.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/backtracking/signature/jes2greg.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/backtracking/signature/jes2jes.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/backtracking/signature/jes2labs.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/backtracking/signature/labs.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/backtracking/signature/labs2yassir.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/backtracking/signature/yassir.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/backtracking/signature/yassir2hanfei.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/fail/greg.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/fail/greg2yassir.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/fail/jes.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/fail/jes2greg.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/fail/jes2jes.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/fail/jes2labs.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/fail/labs.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/fail/labs2yassir.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/fail/yassir.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/fail/yassir2hanfei.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/pass/greg.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/pass/greg2yassir.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/pass/jes.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/pass/jes2greg.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/pass/jes2jes.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/pass/jes2labs.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/pass/labs.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/pass/labs2yassir.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/pass/yassir.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/multi_path/signature/pass/yassir2hanfei.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/single_path/signature/fail/greg.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/single_path/signature/fail/greg2yassir_badsig.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/single_path/signature/fail/jes.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/single_path/signature/fail/jes2greg.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/single_path/signature/fail/jes2jes.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/single_path/signature/fail/yassir.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/single_path/signature/fail/yassir2hanfei.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/single_path/signature/pass/greg.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/single_path/signature/pass/greg2yassir.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/single_path/signature/pass/jes.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/single_path/signature/pass/jes2greg.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/single_path/signature/pass/jes2jes.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/single_path/signature/pass/yassir.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/single_path/signature/pass/yassir2hanfei.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test1/greg2yassir.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test1/jes2greg.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test1/jes2jes.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test1/jes2labs.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test1/labs2yassir.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test1/yassir2hanfei.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test1/yassir2richard.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test2/jes2greg.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test2/jes2jes.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test2/jes2labs.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test2/labs2yassir.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test2/nelson2yassir.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test2/yassir2hanfei.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test2/yassir2richard.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test3/jes2greg.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test3/jes2jes.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test3/jes2labs.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test3/labs2yassir.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test3/nelson2yassir.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/build_data/test3/yassir2hanfei.crt create mode 100644 mozilla/security/nss/tests/libpkix/pkix_tests/top/cert8.db create mode 100644 mozilla/security/nss/tests/libpkix/pkix_tests/top/goodcert.crt create mode 100644 mozilla/security/nss/tests/libpkix/pkix_tests/top/key3.db create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/rev_data/crlchecker/chem.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/rev_data/crlchecker/chem2prof.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/rev_data/crlchecker/phy2prof.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/rev_data/crlchecker/phys.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/rev_data/crlchecker/prof.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/rev_data/crlchecker/prof2test.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/rev_data/crlchecker/sci.crl create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/rev_data/crlchecker/sci2chem.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/rev_data/crlchecker/sci2phy.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/rev_data/crlchecker/sci2sci.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/rev_data/crlchecker/test.crl create mode 100644 mozilla/security/nss/tests/libpkix/pkix_tests/top/revokedcert.crt create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/top/runTests.sh create mode 100644 mozilla/security/nss/tests/libpkix/pkix_tests/top/secmod.db create mode 100755 mozilla/security/nss/tests/libpkix/pkix_tests/util/runTests.sh create mode 100755 mozilla/security/nss/tests/libpkix/runTests.sh create mode 100755 mozilla/security/nss/tests/libpkix/sample_apps/README create mode 100755 mozilla/security/nss/tests/libpkix/sample_apps/cert8.db create mode 100755 mozilla/security/nss/tests/libpkix/sample_apps/key3.db create mode 100755 mozilla/security/nss/tests/libpkix/sample_apps/runPerf.sh create mode 100755 mozilla/security/nss/tests/libpkix/sample_apps/secmod.db create mode 100644 mozilla/security/nss/tests/libpkix/vfychain_test.lst create mode 100644 mozilla/security/nss/tests/memleak/ignored create mode 100644 mozilla/security/nss/tests/memleak/memleak.sh create mode 100644 mozilla/security/nss/tests/memleak/sslreq.dat create mode 100755 mozilla/security/nss/tests/merge/merge.sh create mode 100755 mozilla/security/nss/tests/mksymlinks create mode 100755 mozilla/security/nss/tests/multinit/multinit.sh create mode 100644 mozilla/security/nss/tests/multinit/multinit.txt create mode 100755 mozilla/security/nss/tests/nssdir create mode 100755 mozilla/security/nss/tests/nsspath create mode 100755 mozilla/security/nss/tests/nssqa create mode 100644 mozilla/security/nss/tests/ocsp/ocsp.sh create mode 100755 mozilla/security/nss/tests/path_uniq create mode 100755 mozilla/security/nss/tests/perf/perf.sh create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/Makefile create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/config.mk create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/manifest.mn create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/Makefile create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/config.mk create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/manifest.mn create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/pkcs11/Makefile create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/pkcs11/config.mk create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/pkcs11/manifest.mn create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/pkcs11/pk11test.c create mode 100755 mozilla/security/nss/tests/pkcs11/netscape/suites/security/pkcs11/pk11test.h create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/pkcs11/pk11test.htp create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/pkcs11/pkcs11.h create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/pkcs11/pkcs11.reg create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/pkcs11/pkcs11.rep create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/pkcs11/rules.mk create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/ssl/Makefile create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/ssl/README create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/ssl/cert7.db create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/ssl/config.mk create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/ssl/key3.db create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/ssl/manifest.mn create mode 100755 mozilla/security/nss/tests/pkcs11/netscape/suites/security/ssl/ssl.reg create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/ssl/sslc.c create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/ssl/sslc.h create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/ssl/ssls.c create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/ssl/ssls.h create mode 100755 mozilla/security/nss/tests/pkcs11/netscape/suites/security/ssl/sslt.c create mode 100755 mozilla/security/nss/tests/pkcs11/netscape/suites/security/ssl/sslt.h create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/ssl/sslt.htp create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/suites/security/ssl/sslt.rep create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/trivial/.cvsignore create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/trivial/Makefile.in create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/trivial/README.txt create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/trivial/acconfig.h create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/trivial/config.h.in create mode 100755 mozilla/security/nss/tests/pkcs11/netscape/trivial/configure create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/trivial/configure.in create mode 100755 mozilla/security/nss/tests/pkcs11/netscape/trivial/install-sh create mode 100644 mozilla/security/nss/tests/pkcs11/netscape/trivial/trivial.c create mode 100755 mozilla/security/nss/tests/pkits/pkits.sh create mode 100644 mozilla/security/nss/tests/platformlist create mode 100644 mozilla/security/nss/tests/platformlist.tbx create mode 100755 mozilla/security/nss/tests/qa_stage create mode 100755 mozilla/security/nss/tests/qa_stat create mode 100755 mozilla/security/nss/tests/qaclean create mode 100755 mozilla/security/nss/tests/run_niscc.sh create mode 100755 mozilla/security/nss/tests/sdr/sdr.sh create mode 100644 mozilla/security/nss/tests/set_environment create mode 100644 mozilla/security/nss/tests/smime/alice.txt create mode 100644 mozilla/security/nss/tests/smime/bob.txt create mode 100755 mozilla/security/nss/tests/smime/smime.sh create mode 100755 mozilla/security/nss/tests/ssl/ssl.sh create mode 100755 mozilla/security/nss/tests/ssl/ssl_dist_stress.sh create mode 100644 mozilla/security/nss/tests/ssl/sslauth.txt create mode 100644 mozilla/security/nss/tests/ssl/sslcov.txt create mode 100644 mozilla/security/nss/tests/ssl/sslreq.dat create mode 100644 mozilla/security/nss/tests/ssl/sslreq.txt create mode 100644 mozilla/security/nss/tests/ssl/sslstress.txt create mode 100644 mozilla/security/nss/tests/tools/sign.html create mode 100644 mozilla/security/nss/tests/tools/signjs.html create mode 100644 mozilla/security/nss/tests/tools/tools.sh create mode 100755 mozilla/security/nss/trademarks.txt create mode 100644 nss-sysinit.manifest create mode 100644 packaging/blank-cert8.db create mode 100644 packaging/blank-cert9.db create mode 100644 packaging/blank-key3.db create mode 100644 packaging/blank-key4.db create mode 100644 packaging/blank-secmod.db create mode 100644 packaging/nss-3.12.8-char.patch create mode 100644 packaging/nss-bug524013.patch create mode 100644 packaging/nss-config.in create mode 100644 packaging/nss-enable-pem.patch create mode 100644 packaging/nss-kernel-3.x.patch create mode 100644 packaging/nss-no-rpath.patch create mode 100644 packaging/nss-nolocalsql.patch create mode 100644 packaging/nss-pem-20101125.tar.bz2 create mode 100644 packaging/nss-prelink.conf create mode 100644 packaging/nss-sysinit-2.patch create mode 100644 packaging/nss-sysinit.patch create mode 100644 packaging/nss.changes create mode 100644 packaging/nss.pc.in create mode 100644 packaging/nss.spec create mode 100644 packaging/setup-nsssysinit.sh create mode 100644 packaging/system-pkcs11.txt diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..83e8d2b --- /dev/null +++ b/LICENSE @@ -0,0 +1,33 @@ +Version: MPL 1.1/GPL 2.0/LGPL 2.1 + +The contents of this file are subject to the Mozilla Public License Version +1.1 (the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +for the specific language governing rights and limitations under the +License. + +The Original Code is the Netscape security libraries. + +The Initial Developer of the Original Code is +Netscape Communications Corporation. +Portions created by the Initial Developer are Copyright (C) 1994-2000 +the Initial Developer. All Rights Reserved. + +Contributor(s): + +Alternatively, the contents of this file may be used under the terms of +either the GNU General Public License Version 2 or later (the "GPL"), or +the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +in which case the provisions of the GPL or the LGPL are applicable instead +of those above. If you wish to allow use of your version of this file only +under the terms of either the GPL or the LGPL, and not to allow others to +use your version of this file under the terms of the MPL, indicate your +decision by deleting the provisions above and replace them with the notice +and other provisions required by the GPL or the LGPL. If you do not delete +the provisions above, a recipient may use your version of this file under +the terms of any one of the MPL, the GPL or the LGPL. + diff --git a/mozilla/dbm/.cvsignore b/mozilla/dbm/.cvsignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/mozilla/dbm/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/mozilla/dbm/Makefile.in b/mozilla/dbm/Makefile.in new file mode 100644 index 0000000..e69de29 diff --git a/mozilla/dbm/include/.cvsignore b/mozilla/dbm/include/.cvsignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/mozilla/dbm/include/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/mozilla/dbm/include/Makefile.in b/mozilla/dbm/include/Makefile.in new file mode 100644 index 0000000..343a088 --- /dev/null +++ b/mozilla/dbm/include/Makefile.in @@ -0,0 +1,71 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = dbm + +EXPORTS = \ + nsres.h \ + cdefs.h \ + mcom_db.h \ + ncompat.h \ + winfile.h \ + $(NULL) + +EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) + +PRIVATE_EXPORTS = \ + hsearch.h \ + page.h \ + extern.h \ + ndbm.h \ + queue.h \ + hash.h \ + mpool.h \ + search.h \ + $(NULL) + +PRIVATE_EXPORTS := $(addprefix $(srcdir)/, $(PRIVATE_EXPORTS)) + +include $(topsrcdir)/config/rules.mk + diff --git a/mozilla/dbm/include/Makefile.win b/mozilla/dbm/include/Makefile.win new file mode 100644 index 0000000..df31e52 --- /dev/null +++ b/mozilla/dbm/include/Makefile.win @@ -0,0 +1,77 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + + +#//------------------------------------------------------------------------ +#// +#// Makefile to build the cert library +#// +#//------------------------------------------------------------------------ + +!if "$(MOZ_BITS)" == "16" +!ifndef MOZ_DEBUG +OPTIMIZER=-Os -UDEBUG -DNDEBUG +!endif +!endif + +#//------------------------------------------------------------------------ +#// +#// Specify the depth of the current directory relative to the +#// root of NS +#// +#//------------------------------------------------------------------------ +DEPTH= ..\.. + +!ifndef MAKE_OBJ_TYPE +MAKE_OBJ_TYPE=EXE +!endif + +#//------------------------------------------------------------------------ +#// +#// install headers +#// +#//------------------------------------------------------------------------ +EXPORTS=nsres.h cdefs.h mcom_db.h ncompat.h winfile.h + +#//------------------------------------------------------------------------ +#// +#// Include the common makefile rules +#// +#//------------------------------------------------------------------------ +include <$(DEPTH)/config/rules.mak> + +CFLAGS = $(CFLAGS) -DMOZILLA_CLIENT + diff --git a/mozilla/dbm/include/cdefs.h b/mozilla/dbm/include/cdefs.h new file mode 100644 index 0000000..6df5a80 --- /dev/null +++ b/mozilla/dbm/include/cdefs.h @@ -0,0 +1,126 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Berkeley Software Design, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)cdefs.h 8.7 (Berkeley) 1/21/94 + */ + +#ifndef _CDEFS_H_ +#define _CDEFS_H_ + +#if defined(__cplusplus) +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS } +#else +#define __BEGIN_DECLS +#define __END_DECLS +#endif + +/* + * The __CONCAT macro is used to concatenate parts of symbol names, e.g. + * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. + * The __CONCAT macro is a bit tricky -- make sure you don't put spaces + * in between its arguments. __CONCAT can also concatenate double-quoted + * strings produced by the __STRING macro, but this only works with ANSI C. + */ +#if defined(__STDC__) || defined(__cplusplus) || defined(_WINDOWS) || defined(XP_OS2) +#define __P(protos) protos /* full-blown ANSI C */ +#define __CONCAT(x,y) x ## y +#define __STRING(x) #x + +/* On HP-UX 11.00, defines __const. */ +#ifndef __const +#define __const const /* define reserved names to standard */ +#endif /* __const */ +#define __signed signed +#define __volatile volatile +#ifndef _WINDOWS +#if defined(__cplusplus) +#define __inline inline /* convert to C++ keyword */ +#else +#if !defined(__GNUC__) && !defined(__MWERKS__) +#define __inline /* delete GCC keyword */ +#endif /* !__GNUC__ */ +#endif /* !__cplusplus */ +#endif /* !_WINDOWS */ + +#else /* !(__STDC__ || __cplusplus) */ +#define __P(protos) () /* traditional C preprocessor */ +#define __CONCAT(x,y) x/**/y +#define __STRING(x) "x" + +#ifndef __GNUC__ +#define __const /* delete pseudo-ANSI C keywords */ +#define __inline +#define __signed +#define __volatile +/* + * In non-ANSI C environments, new programs will want ANSI-only C keywords + * deleted from the program and old programs will want them left alone. + * When using a compiler other than gcc, programs using the ANSI C keywords + * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. + * When using "gcc -traditional", we assume that this is the intent; if + * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. + */ +#ifndef NO_ANSI_KEYWORDS +#define const /* delete ANSI C keywords */ +#define inline +#define signed +#define volatile +#endif +#endif /* !__GNUC__ */ +#endif /* !(__STDC__ || __cplusplus) */ + +/* + * GCC1 and some versions of GCC2 declare dead (non-returning) and + * pure (no side effects) functions using "volatile" and "const"; + * unfortunately, these then cause warnings under "-ansi -pedantic". + * GCC2 uses a new, peculiar __attribute__((attrs)) style. All of + * these work for GNU C++ (modulo a slight glitch in the C++ grammar + * in the distribution version of 2.5.5). + */ +#if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5 +#define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */ +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +#define __dead __volatile +#define __pure __const +#endif +#endif + +/* Delete pseudo-keywords wherever they are not available or needed. */ +#ifndef __dead +#define __dead +#define __pure +#endif + +#endif /* !_CDEFS_H_ */ diff --git a/mozilla/dbm/include/extern.h b/mozilla/dbm/include/extern.h new file mode 100644 index 0000000..cbc9922 --- /dev/null +++ b/mozilla/dbm/include/extern.h @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 1991, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)extern.h 8.4 (Berkeley) 6/16/94 + */ + +BUFHEAD *__add_ovflpage (HTAB *, BUFHEAD *); +int __addel (HTAB *, BUFHEAD *, const DBT *, const DBT *); +int __big_delete (HTAB *, BUFHEAD *); +int __big_insert (HTAB *, BUFHEAD *, const DBT *, const DBT *); +int __big_keydata (HTAB *, BUFHEAD *, DBT *, DBT *, int); +int __big_return (HTAB *, BUFHEAD *, int, DBT *, int); +int __big_split (HTAB *, BUFHEAD *, BUFHEAD *, BUFHEAD *, + uint32, uint32, SPLIT_RETURN *); +int __buf_free (HTAB *, int, int); +void __buf_init (HTAB *, int); +uint32 __call_hash (HTAB *, char *, size_t); +int __delpair (HTAB *, BUFHEAD *, int); +int __expand_table (HTAB *); +int __find_bigpair (HTAB *, BUFHEAD *, int, char *, int); +uint16 __find_last_page (HTAB *, BUFHEAD **); +void __free_ovflpage (HTAB *, BUFHEAD *); +BUFHEAD *__get_buf (HTAB *, uint32, BUFHEAD *, int); +int __get_page (HTAB *, char *, uint32, int, int, int); +int __ibitmap (HTAB *, int, int, int); +uint32 __log2 (uint32); +int __put_page (HTAB *, char *, uint32, int, int); +void __reclaim_buf (HTAB *, BUFHEAD *); +int __split_page (HTAB *, uint32, uint32); + +/* Default hash routine. */ +extern uint32 (*__default_hash) (const void *, size_t); + +#ifdef HASH_STATISTICS +extern int hash_accesses, hash_collisions, hash_expansions, hash_overflows; +#endif diff --git a/mozilla/dbm/include/hash.h b/mozilla/dbm/include/hash.h new file mode 100644 index 0000000..20307b5 --- /dev/null +++ b/mozilla/dbm/include/hash.h @@ -0,0 +1,335 @@ +/*- + * Copyright (c) 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Margo Seltzer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)hash.h 8.3 (Berkeley) 5/31/94 + */ + +/* Operations */ + +#include +#include "mcom_db.h" +typedef enum { + HASH_GET, HASH_PUT, HASH_PUTNEW, HASH_DELETE, HASH_FIRST, HASH_NEXT +} ACTION; + +/* Buffer Management structures */ +typedef struct _bufhead BUFHEAD; + +struct _bufhead { + BUFHEAD *prev; /* LRU links */ + BUFHEAD *next; /* LRU links */ + BUFHEAD *ovfl; /* Overflow page buffer header */ + uint32 addr; /* Address of this page */ + char *page; /* Actual page data */ + char is_disk; + char flags; +#define BUF_MOD 0x0001 +#define BUF_DISK 0x0002 +#define BUF_BUCKET 0x0004 +#define BUF_PIN 0x0008 +}; + +#define IS_BUCKET(X) ((X) & BUF_BUCKET) + +typedef BUFHEAD **SEGMENT; + +typedef int DBFILE_PTR; +#define NO_FILE -1 +#ifdef macintosh +#define DBFILE_OPEN(path, flag,mode) open((path), flag) +#define EXISTS(path) +#else +#define DBFILE_OPEN(path, flag,mode) open((path), (flag), (mode)) +#endif +/* Hash Table Information */ +typedef struct hashhdr { /* Disk resident portion */ + int32 magic; /* Magic NO for hash tables */ + int32 version; /* Version ID */ + uint32 lorder; /* Byte Order */ + int32 bsize; /* Bucket/Page Size */ + int32 bshift; /* Bucket shift */ + int32 dsize; /* Directory Size */ + int32 ssize; /* Segment Size */ + int32 sshift; /* Segment shift */ + int32 ovfl_point; /* Where overflow pages are being + * allocated */ + int32 last_freed; /* Last overflow page freed */ + int32 max_bucket; /* ID of Maximum bucket in use */ + int32 high_mask; /* Mask to modulo into entire table */ + int32 low_mask; /* Mask to modulo into lower half of + * table */ + int32 ffactor; /* Fill factor */ + int32 nkeys; /* Number of keys in hash table */ + int32 hdrpages; /* Size of table header */ + uint32 h_charkey; /* value of hash(CHARKEY) */ +#define NCACHED 32 /* number of bit maps and spare + * points */ + int32 spares[NCACHED];/* spare pages for overflow */ + uint16 bitmaps[NCACHED]; /* address of overflow page + * bitmaps */ +} HASHHDR; + +typedef struct htab { /* Memory resident data structure */ + HASHHDR hdr; /* Header */ + int nsegs; /* Number of allocated segments */ + int exsegs; /* Number of extra allocated + * segments */ + uint32 /* Hash function */ + (*hash)(const void *, size_t); + int flags; /* Flag values */ + DBFILE_PTR fp; /* File pointer */ + char *filename; + char *tmp_buf; /* Temporary Buffer for BIG data */ + char *tmp_key; /* Temporary Buffer for BIG keys */ + BUFHEAD *cpage; /* Current page */ + int cbucket; /* Current bucket */ + int cndx; /* Index of next item on cpage */ + int dbmerrno; /* Error Number -- for DBM + * compatability */ + int new_file; /* Indicates if fd is backing store + * or no */ + int save_file; /* Indicates whether we need to flush + * file at + * exit */ + uint32 *mapp[NCACHED]; /* Pointers to page maps */ + int nmaps; /* Initial number of bitmaps */ + int nbufs; /* Number of buffers left to + * allocate */ + BUFHEAD bufhead; /* Header of buffer lru list */ + SEGMENT *dir; /* Hash Bucket directory */ + off_t file_size; /* in bytes */ + char is_temp; /* unlink file on close */ + char updateEOF; /* force EOF update on flush */ +} HTAB; + +/* + * Constants + */ +#define DATABASE_CORRUPTED_ERROR -999 /* big ugly abort, delete database */ +#define OLD_MAX_BSIZE 65536 /* 2^16 */ +#define MAX_BSIZE 32l*1024l /* 2^15 */ +#define MIN_BUFFERS 6 +#define MINHDRSIZE 512 +#define DEF_BUFSIZE 65536l /* 64 K */ +#define DEF_BUCKET_SIZE 4096 +#define DEF_BUCKET_SHIFT 12 /* log2(BUCKET) */ +#define DEF_SEGSIZE 256 +#define DEF_SEGSIZE_SHIFT 8 /* log2(SEGSIZE) */ +#define DEF_DIRSIZE 256 +#define DEF_FFACTOR 65536l +#define MIN_FFACTOR 4 +#define SPLTMAX 8 +#define CHARKEY "%$sniglet^&" +#define NUMKEY 1038583l +#define BYTE_SHIFT 3 +#define INT_TO_BYTE 2 +#define INT_BYTE_SHIFT 5 +#define ALL_SET ((uint32)0xFFFFFFFF) +#define ALL_CLEAR 0 + +#define PTROF(X) ((ptrdiff_t)(X) == BUF_DISK ? 0 : (X)) +#define ISDISK(X) ((X) ? ((ptrdiff_t)(X) == BUF_DISK ? BUF_DISK \ + : (X)->is_disk) : 0) + +#define BITS_PER_MAP 32 + +/* Given the address of the beginning of a big map, clear/set the nth bit */ +#define CLRBIT(A, N) ((A)[(N)/BITS_PER_MAP] &= ~(1<<((N)%BITS_PER_MAP))) +#define SETBIT(A, N) ((A)[(N)/BITS_PER_MAP] |= (1<<((N)%BITS_PER_MAP))) +#define ISSET(A, N) ((A)[(N)/BITS_PER_MAP] & (1<<((N)%BITS_PER_MAP))) + +/* Overflow management */ +/* + * Overflow page numbers are allocated per split point. At each doubling of + * the table, we can allocate extra pages. So, an overflow page number has + * the top 5 bits indicate which split point and the lower 11 bits indicate + * which page at that split point is indicated (pages within split points are + * numberered starting with 1). + */ + +#define SPLITSHIFT 11 +#define SPLITMASK 0x7FF +#define SPLITNUM(N) (((uint32)(N)) >> SPLITSHIFT) +#define OPAGENUM(N) ((N) & SPLITMASK) +#define OADDR_OF(S,O) ((uint32)((uint32)(S) << SPLITSHIFT) + (O)) + +#define BUCKET_TO_PAGE(B) \ + (B) + hashp->HDRPAGES + ((B) ? hashp->SPARES[__log2((uint32)((B)+1))-1] : 0) +#define OADDR_TO_PAGE(B) \ + BUCKET_TO_PAGE ( (1 << SPLITNUM((B))) -1 ) + OPAGENUM((B)); + +/* + * page.h contains a detailed description of the page format. + * + * Normally, keys and data are accessed from offset tables in the top of + * each page which point to the beginning of the key and data. There are + * four flag values which may be stored in these offset tables which indicate + * the following: + * + * + * OVFLPAGE Rather than a key data pair, this pair contains + * the address of an overflow page. The format of + * the pair is: + * OVERFLOW_PAGE_NUMBER OVFLPAGE + * + * PARTIAL_KEY This must be the first key/data pair on a page + * and implies that page contains only a partial key. + * That is, the key is too big to fit on a single page + * so it starts on this page and continues on the next. + * The format of the page is: + * KEY_OFF PARTIAL_KEY OVFL_PAGENO OVFLPAGE + * + * KEY_OFF -- offset of the beginning of the key + * PARTIAL_KEY -- 1 + * OVFL_PAGENO - page number of the next overflow page + * OVFLPAGE -- 0 + * + * FULL_KEY This must be the first key/data pair on the page. It + * is used in two cases. + * + * Case 1: + * There is a complete key on the page but no data + * (because it wouldn't fit). The next page contains + * the data. + * + * Page format it: + * KEY_OFF FULL_KEY OVFL_PAGENO OVFL_PAGE + * + * KEY_OFF -- offset of the beginning of the key + * FULL_KEY -- 2 + * OVFL_PAGENO - page number of the next overflow page + * OVFLPAGE -- 0 + * + * Case 2: + * This page contains no key, but part of a large + * data field, which is continued on the next page. + * + * Page format it: + * DATA_OFF FULL_KEY OVFL_PAGENO OVFL_PAGE + * + * KEY_OFF -- offset of the beginning of the data on + * this page + * FULL_KEY -- 2 + * OVFL_PAGENO - page number of the next overflow page + * OVFLPAGE -- 0 + * + * FULL_KEY_DATA + * This must be the first key/data pair on the page. + * There are two cases: + * + * Case 1: + * This page contains a key and the beginning of the + * data field, but the data field is continued on the + * next page. + * + * Page format is: + * KEY_OFF FULL_KEY_DATA OVFL_PAGENO DATA_OFF + * + * KEY_OFF -- offset of the beginning of the key + * FULL_KEY_DATA -- 3 + * OVFL_PAGENO - page number of the next overflow page + * DATA_OFF -- offset of the beginning of the data + * + * Case 2: + * This page contains the last page of a big data pair. + * There is no key, only the tail end of the data + * on this page. + * + * Page format is: + * DATA_OFF FULL_KEY_DATA + * + * DATA_OFF -- offset of the beginning of the data on + * this page + * FULL_KEY_DATA -- 3 + * OVFL_PAGENO - page number of the next overflow page + * OVFLPAGE -- 0 + * + * OVFL_PAGENO and OVFLPAGE are optional (they are + * not present if there is no next page). + */ + +#define OVFLPAGE 0 +#define PARTIAL_KEY 1 +#define FULL_KEY 2 +#define FULL_KEY_DATA 3 +#define REAL_KEY 4 + +/* Short hands for accessing structure */ +#undef BSIZE +#define BSIZE hdr.bsize +#undef BSHIFT +#define BSHIFT hdr.bshift +#define DSIZE hdr.dsize +#define SGSIZE hdr.ssize +#define SSHIFT hdr.sshift +#define LORDER hdr.lorder +#define OVFL_POINT hdr.ovfl_point +#define LAST_FREED hdr.last_freed +#define MAX_BUCKET hdr.max_bucket +#define FFACTOR hdr.ffactor +#define HIGH_MASK hdr.high_mask +#define LOW_MASK hdr.low_mask +#define NKEYS hdr.nkeys +#define HDRPAGES hdr.hdrpages +#define SPARES hdr.spares +#define BITMAPS hdr.bitmaps +#define VERSION hdr.version +#define MAGIC hdr.magic +#define NEXT_FREE hdr.next_free +#define H_CHARKEY hdr.h_charkey + +extern uint32 (*__default_hash) (const void *, size_t); +void __buf_init(HTAB *hashp, int32 nbytes); +int __big_delete(HTAB *hashp, BUFHEAD *bufp); +BUFHEAD * __get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage); +uint32 __call_hash(HTAB *hashp, char *k, size_t len); +#include "page.h" +extern int __big_split(HTAB *hashp, BUFHEAD *op,BUFHEAD *np, +BUFHEAD *big_keyp,uint32 addr,uint32 obucket, SPLIT_RETURN *ret); +void __free_ovflpage(HTAB *hashp, BUFHEAD *obufp); +BUFHEAD * __add_ovflpage(HTAB *hashp, BUFHEAD *bufp); +int __big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val); +int __expand_table(HTAB *hashp); +uint32 __log2(uint32 num); +void __reclaim_buf(HTAB *hashp, BUFHEAD *bp); +int __get_page(HTAB *hashp, char * p, uint32 bucket, int is_bucket, int is_disk, int is_bitmap); +int __put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap); +int __ibitmap(HTAB *hashp, int pnum, int nbits, int ndx); +int __buf_free(HTAB *hashp, int do_free, int to_disk); +int __find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size); +uint16 __find_last_page(HTAB *hashp, BUFHEAD **bpp); +int __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT * val); +int __big_return(HTAB *hashp, BUFHEAD *bufp, int ndx, DBT *val, int set_current); +int __delpair(HTAB *hashp, BUFHEAD *bufp, int ndx); +int __big_keydata(HTAB *hashp, BUFHEAD *bufp, DBT *key, DBT *val, int set); +int __split_page(HTAB *hashp, uint32 obucket, uint32 nbucket); diff --git a/mozilla/dbm/include/hsearch.h b/mozilla/dbm/include/hsearch.h new file mode 100644 index 0000000..ae1df1c --- /dev/null +++ b/mozilla/dbm/include/hsearch.h @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Margo Seltzer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)search.h 8.1 (Berkeley) 6/4/93 + */ + +/* Backward compatibility to hsearch interface. */ +typedef struct entry { + char *key; + char *data; +} ENTRY; + +typedef enum { + FIND, ENTER +} ACTION; + +int hcreate (unsigned int); +void hdestroy (void); +ENTRY *hsearch (ENTRY, ACTION); diff --git a/mozilla/dbm/include/mcom_db.h b/mozilla/dbm/include/mcom_db.h new file mode 100644 index 0000000..629cb0f --- /dev/null +++ b/mozilla/dbm/include/mcom_db.h @@ -0,0 +1,413 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/*- + * Copyright (c) 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)db.h 8.7 (Berkeley) 6/16/94 + */ + +#ifndef _DB_H_ +#define _DB_H_ + + +#ifdef WINCE +#define off_t long +#endif + +#ifndef macintosh +#include +#endif +#include "prtypes.h" + +#include + +#ifdef __DBINTERFACE_PRIVATE + +#ifdef HAVE_SYS_CDEFS_H +#include +#else +#include "cdefs.h" +#endif + +#ifdef HAVE_SYS_BYTEORDER_H +#include +#endif + +#if defined(__linux) || defined(__BEOS__) +#include +#ifndef BYTE_ORDER +#define BYTE_ORDER __BYTE_ORDER +#define BIG_ENDIAN __BIG_ENDIAN +#define LITTLE_ENDIAN __LITTLE_ENDIAN +#endif +#endif /* __linux */ + +#ifdef __sgi +#define BYTE_ORDER BIG_ENDIAN +#define BIG_ENDIAN 4321 +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */ +#endif + +#ifdef __sun +#define BIG_ENDIAN 4321 +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */ + +#ifndef __SVR4 +/* compat.h is only in 4.1.3 machines. - dp */ +#include +#endif + +/* XXX - dp + * Need to find a general way of defining endian-ness in SunOS 5.3 + * SunOS 5.4 defines _BIG_ENDIAN and _LITTLE_ENDIAN + * SunOS 5.3 does nothing like this. + */ + +#ifndef BYTE_ORDER + +#if defined(_BIG_ENDIAN) +#define BYTE_ORDER BIG_ENDIAN +#elif defined(_LITTLE_ENDIAN) +#define BYTE_ORDER LITTLE_ENDIAN +#elif !defined(__SVR4) +/* 4.1.3 is always BIG_ENDIAN as it was released only on sparc platforms. */ +#define BYTE_ORDER BIG_ENDIAN +#elif !defined(vax) && !defined(ntohl) && !defined(lint) && !defined(i386) +/* 5.3 big endian. Copied this above line from sys/byteorder.h */ +/* Now we are in a 5.3 SunOS rather non 5.4 or above SunOS */ +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif + +#endif /* !BYTE_ORDER */ +#endif /* __sun */ + +#if defined(__hpux) || defined(__hppa) +#define BYTE_ORDER BIG_ENDIAN +#define BIG_ENDIAN 4321 +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */ +#endif + +#if defined(AIXV3) || defined(AIX) +/* BYTE_ORDER, LITTLE_ENDIAN, BIG_ENDIAN are all defined here */ +#include +#endif + +/* Digital Unix */ +#ifdef __osf__ +#include +#endif + +#ifdef __alpha +#ifndef WIN32 +#else +/* Alpha NT */ +#define BYTE_ORDER LITTLE_ENDIAN +#define BIG_ENDIAN 4321 +#define LITTLE_ENDIAN 1234 +#endif +#endif + +#ifdef NCR +#include +#endif + +#ifdef __QNX__ +#ifdef __QNXNTO__ +#include +#else +#define LITTLE_ENDIAN 1234 +#define BIG_ENDIAN 4321 +#define BYTE_ORDER LITTLE_ENDIAN +#endif +#endif + +#ifdef SNI +/* #include */ +#define BYTE_ORDER BIG_ENDIAN +#define BIG_ENDIAN 4321 +#define LITTLE_ENDIAN 1234 +#endif + +#ifdef _WINDOWS +#ifdef BYTE_ORDER +#undef BYTE_ORDER +#endif + +#define BYTE_ORDER LITTLE_ENDIAN +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */ +#define BIG_ENDIAN 4321 +#endif + +#ifdef macintosh +#define BIG_ENDIAN 4321 +#define LITTLE_ENDIAN 1234 +#define BYTE_ORDER BIG_ENDIAN +#endif + +#endif /* __DBINTERFACE_PRIVATE */ + +#ifdef SCO +#define MAXPATHLEN 1024 +#endif + +#include + +#if defined(_WINDOWS) || defined(XP_OS2) +#include +#include + +#ifndef XP_OS2 +#define MAXPATHLEN 1024 +#endif + +#define EFTYPE EINVAL /* POSIX 1003.1 format errno. */ + +#ifndef STDERR_FILENO +#define STDIN_FILENO 0 /* ANSI C #defines */ +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 +#endif + +#ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */ +#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) +#endif +#endif + +#ifdef macintosh +#include +#include "xp_mcom.h" +#define O_ACCMODE 3 /* Mask for file access modes */ +#define EFTYPE 2000 +PR_BEGIN_EXTERN_C +int mkstemp(const char *path); +PR_END_EXTERN_C +#endif /* MACINTOSH */ + +#if !defined(_WINDOWS) && !defined(macintosh) +#include +#include +#endif + +/* define EFTYPE since most don't */ +#ifndef EFTYPE +#define EFTYPE EINVAL /* POSIX 1003.1 format errno. */ +#endif + +#define RET_ERROR -1 /* Return values. */ +#define RET_SUCCESS 0 +#define RET_SPECIAL 1 + +#define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */ + +#ifndef __sgi +typedef uint32 pgno_t; +#endif + +#define MAX_PAGE_OFFSET 65535 /* >= # of bytes in a page */ +typedef uint16 indx_t; +#define MAX_REC_NUMBER 0xffffffff /* >= # of records in a tree */ +typedef uint32 recno_t; + +/* Key/data structure -- a Data-Base Thang. */ +typedef struct { + void *data; /* data */ + size_t size; /* data length */ +} DBT; + +/* Routine flags. */ +#define R_CURSOR 1 /* del, put, seq */ +#define __R_UNUSED 2 /* UNUSED */ +#define R_FIRST 3 /* seq */ +#define R_IAFTER 4 /* put (RECNO) */ +#define R_IBEFORE 5 /* put (RECNO) */ +#define R_LAST 6 /* seq (BTREE, RECNO) */ +#define R_NEXT 7 /* seq */ +#define R_NOOVERWRITE 8 /* put */ +#define R_PREV 9 /* seq (BTREE, RECNO) */ +#define R_SETCURSOR 10 /* put (RECNO) */ +#define R_RECNOSYNC 11 /* sync (RECNO) */ + +typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE; + +typedef enum { LockOutDatabase, UnlockDatabase } DBLockFlagEnum; + +/* + * !!! + * The following flags are included in the dbopen(3) call as part of the + * open(2) flags. In order to avoid conflicts with the open flags, start + * at the top of the 16 or 32-bit number space and work our way down. If + * the open flags were significantly expanded in the future, it could be + * a problem. Wish I'd left another flags word in the dbopen call. + * + * !!! + * None of this stuff is implemented yet. The only reason that it's here + * is so that the access methods can skip copying the key/data pair when + * the DB_LOCK flag isn't set. + */ +#if UINT_MAX > 65535 +#define DB_LOCK 0x20000000 /* Do locking. */ +#define DB_SHMEM 0x40000000 /* Use shared memory. */ +#define DB_TXN 0x80000000 /* Do transactions. */ +#else +#define DB_LOCK 0x2000 /* Do locking. */ +#define DB_SHMEM 0x4000 /* Use shared memory. */ +#define DB_TXN 0x8000 /* Do transactions. */ +#endif + +/* Access method description structure. */ +typedef struct __db { + DBTYPE type; /* Underlying db type. */ + int (*close) (struct __db *); + int (*del) (const struct __db *, const DBT *, uint); + int (*get) (const struct __db *, const DBT *, DBT *, uint); + int (*put) (const struct __db *, DBT *, const DBT *, uint); + int (*seq) (const struct __db *, DBT *, DBT *, uint); + int (*sync) (const struct __db *, uint); + void *internal; /* Access method private. */ + int (*fd) (const struct __db *); +} DB; + +#define BTREEMAGIC 0x053162 +#define BTREEVERSION 3 + +/* Structure used to pass parameters to the btree routines. */ +typedef struct { +#define R_DUP 0x01 /* duplicate keys */ + uint32 flags; + uint cachesize; /* bytes to cache */ + int maxkeypage; /* maximum keys per page */ + int minkeypage; /* minimum keys per page */ + uint psize; /* page size */ + int (*compare) /* comparison function */ + (const DBT *, const DBT *); + size_t (*prefix) /* prefix function */ + (const DBT *, const DBT *); + int lorder; /* byte order */ +} BTREEINFO; + +#define HASHMAGIC 0x061561 +#define HASHVERSION 2 + +/* Structure used to pass parameters to the hashing routines. */ +typedef struct { + uint bsize; /* bucket size */ + uint ffactor; /* fill factor */ + uint nelem; /* number of elements */ + uint cachesize; /* bytes to cache */ + uint32 /* hash function */ + (*hash) (const void *, size_t); + int lorder; /* byte order */ +} HASHINFO; + +/* Structure used to pass parameters to the record routines. */ +typedef struct { +#define R_FIXEDLEN 0x01 /* fixed-length records */ +#define R_NOKEY 0x02 /* key not required */ +#define R_SNAPSHOT 0x04 /* snapshot the input */ + uint32 flags; + uint cachesize; /* bytes to cache */ + uint psize; /* page size */ + int lorder; /* byte order */ + size_t reclen; /* record length (fixed-length records) */ + uint8 bval; /* delimiting byte (variable-length records */ + char *bfname; /* btree file name */ +} RECNOINFO; + +#ifdef __DBINTERFACE_PRIVATE +/* + * Little endian <==> big endian 32-bit swap macros. + * M_32_SWAP swap a memory location + * P_32_SWAP swap a referenced memory location + * P_32_COPY swap from one location to another + */ +#define M_32_SWAP(a) { \ + uint32 _tmp = a; \ + ((char *)&a)[0] = ((char *)&_tmp)[3]; \ + ((char *)&a)[1] = ((char *)&_tmp)[2]; \ + ((char *)&a)[2] = ((char *)&_tmp)[1]; \ + ((char *)&a)[3] = ((char *)&_tmp)[0]; \ +} +#define P_32_SWAP(a) { \ + uint32 _tmp = *(uint32 *)a; \ + ((char *)a)[0] = ((char *)&_tmp)[3]; \ + ((char *)a)[1] = ((char *)&_tmp)[2]; \ + ((char *)a)[2] = ((char *)&_tmp)[1]; \ + ((char *)a)[3] = ((char *)&_tmp)[0]; \ +} +#define P_32_COPY(a, b) { \ + ((char *)&(b))[0] = ((char *)&(a))[3]; \ + ((char *)&(b))[1] = ((char *)&(a))[2]; \ + ((char *)&(b))[2] = ((char *)&(a))[1]; \ + ((char *)&(b))[3] = ((char *)&(a))[0]; \ +} + +/* + * Little endian <==> big endian 16-bit swap macros. + * M_16_SWAP swap a memory location + * P_16_SWAP swap a referenced memory location + * P_16_COPY swap from one location to another + */ +#define M_16_SWAP(a) { \ + uint16 _tmp = a; \ + ((char *)&a)[0] = ((char *)&_tmp)[1]; \ + ((char *)&a)[1] = ((char *)&_tmp)[0]; \ +} +#define P_16_SWAP(a) { \ + uint16 _tmp = *(uint16 *)a; \ + ((char *)a)[0] = ((char *)&_tmp)[1]; \ + ((char *)a)[1] = ((char *)&_tmp)[0]; \ +} +#define P_16_COPY(a, b) { \ + ((char *)&(b))[0] = ((char *)&(a))[1]; \ + ((char *)&(b))[1] = ((char *)&(a))[0]; \ +} +#endif + +PR_BEGIN_EXTERN_C + +extern DB * +dbopen (const char *, int, int, DBTYPE, const void *); + +/* set or unset a global lock flag to disable the + * opening of any DBM file + */ +void dbSetOrClearDBLock(DBLockFlagEnum type); + +#ifdef __DBINTERFACE_PRIVATE +DB *__bt_open (const char *, int, int, const BTREEINFO *, int); +DB *__hash_open (const char *, int, int, const HASHINFO *, int); +DB *__rec_open (const char *, int, int, const RECNOINFO *, int); +void __dbpanic (DB *dbp); +#endif + +PR_END_EXTERN_C + +#endif /* !_DB_H_ */ diff --git a/mozilla/dbm/include/mpool.h b/mozilla/dbm/include/mpool.h new file mode 100644 index 0000000..0483d24 --- /dev/null +++ b/mozilla/dbm/include/mpool.h @@ -0,0 +1,97 @@ +/*- + * Copyright (c) 1991, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)mpool.h 8.2 (Berkeley) 7/14/94 + */ + +#include + +/* + * The memory pool scheme is a simple one. Each in-memory page is referenced + * by a bucket which is threaded in up to two of three ways. All active pages + * are threaded on a hash chain (hashed by page number) and an lru chain. + * Inactive pages are threaded on a free chain. Each reference to a memory + * pool is handed an opaque MPOOL cookie which stores all of this information. + */ +#define HASHSIZE 128 +#define HASHKEY(pgno) ((pgno - 1) % HASHSIZE) + +/* The BKT structures are the elements of the queues. */ +typedef struct _bkt { + CIRCLEQ_ENTRY(_bkt) hq; /* hash queue */ + CIRCLEQ_ENTRY(_bkt) q; /* lru queue */ + void *page; /* page */ + pgno_t pgno; /* page number */ + +#define MPOOL_DIRTY 0x01 /* page needs to be written */ +#define MPOOL_PINNED 0x02 /* page is pinned into memory */ + uint8 flags; /* flags */ +} BKT; + +typedef struct MPOOL { + CIRCLEQ_HEAD(_lqh, _bkt) lqh; /* lru queue head */ + /* hash queue array */ + CIRCLEQ_HEAD(_hqh, _bkt) hqh[HASHSIZE]; + pgno_t curcache; /* current number of cached pages */ + pgno_t maxcache; /* max number of cached pages */ + pgno_t npages; /* number of pages in the file */ + uint32 pagesize; /* file page size */ + int fd; /* file descriptor */ + /* page in conversion routine */ + void (*pgin) (void *, pgno_t, void *); + /* page out conversion routine */ + void (*pgout) (void *, pgno_t, void *); + void *pgcookie; /* cookie for page in/out routines */ +#ifdef STATISTICS + uint32 cachehit; + uint32 cachemiss; + uint32 pagealloc; + uint32 pageflush; + uint32 pageget; + uint32 pagenew; + uint32 pageput; + uint32 pageread; + uint32 pagewrite; +#endif +} MPOOL; + +__BEGIN_DECLS +MPOOL *mpool_open (void *, int, pgno_t, pgno_t); +void mpool_filter (MPOOL *, void (*)(void *, pgno_t, void *), + void (*)(void *, pgno_t, void *), void *); +void *mpool_new (MPOOL *, pgno_t *); +void *mpool_get (MPOOL *, pgno_t, uint); +int mpool_put (MPOOL *, void *, uint); +int mpool_sync (MPOOL *); +int mpool_close (MPOOL *); +#ifdef STATISTICS +void mpool_stat (MPOOL *); +#endif +__END_DECLS diff --git a/mozilla/dbm/include/ncompat.h b/mozilla/dbm/include/ncompat.h new file mode 100644 index 0000000..b6126f8 --- /dev/null +++ b/mozilla/dbm/include/ncompat.h @@ -0,0 +1,230 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)compat.h 8.13 (Berkeley) 2/21/94 + */ + +#ifndef _COMPAT_H_ +#define _COMPAT_H_ + +#include + +/* + * If your system doesn't typedef u_long, u_short, or u_char, change + * the 0 to a 1. + */ +#if 0 +typedef unsigned char u_char; /* 4.[34]BSD names. */ +typedef unsigned int u_int; +typedef unsigned long u_long; +typedef unsigned short u_short; +#endif + +/* If your system doesn't typedef size_t, change the 0 to a 1. */ +#if 0 +typedef unsigned int size_t; /* POSIX, 4.[34]BSD names. */ +#endif + +/* If your system doesn't typedef ssize_t, change the 0 to a 1. */ +#if 0 +typedef int ssize_t; /* POSIX names. */ +#endif + +/* + * If your system doesn't have the POSIX type for a signal mask, + * change the 0 to a 1. + */ +#if 0 /* POSIX 1003.1 signal mask type. */ +typedef unsigned int sigset_t; +#endif + +/* + * If your system's vsprintf returns a char *, not an int, + * change the 0 to a 1. + */ +#if defined (__sun) && !defined(__SVR4) /* SUNOS */ +#define VSPRINTF_CHARSTAR +#endif +/* + * If you don't have POSIX 1003.1 signals, the signal code surrounding the + * temporary file creation is intended to block all of the possible signals + * long enough to create the file and unlink it. All of this stuff is + * intended to use old-style BSD calls to fake POSIX 1003.1 calls. + */ +#ifdef NO_POSIX_SIGNALS +#define sigemptyset(set) (*(set) = 0) +#define sigfillset(set) (*(set) = ~(sigset_t)0, 0) +#define sigaddset(set,signo) (*(set) |= sigmask(signo), 0) +#define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0) +#define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0) + +#define SIG_BLOCK 1 +#define SIG_UNBLOCK 2 +#define SIG_SETMASK 3 + +static int __sigtemp; /* For the use of sigprocmask */ + +/* Repeated test of oset != NULL is to avoid "*0". */ +#define sigprocmask(how, set, oset) \ + ((__sigtemp = \ + (((how) == SIG_BLOCK) ? \ + sigblock(0) | *(set) : \ + (((how) == SIG_UNBLOCK) ? \ + sigblock(0) & ~(*(set)) : \ + ((how) == SIG_SETMASK ? \ + *(set) : sigblock(0))))), \ + ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : \ + sigsetmask(__sigtemp)), 0) +#endif + +/* + * If your system doesn't have an include file with the appropriate + * byte order set, make sure you specify the correct one. + */ +#ifndef BYTE_ORDER +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ +#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ +#define BYTE_ORDER BIG_ENDIAN /* Set for your system. */ +#endif + +#if defined(SYSV) || defined(SYSTEM5) || defined(__sun) +#define index(a, b) strchr(a, b) +#define rindex(a, b) strrchr(a, b) +#define bzero(a, b) memset(a, 0, b) +#define bcmp(a, b, n) memcmp(a, b, n) +#define bcopy(a, b, n) memmove(b, a, n) +#endif + +#if defined(BSD) || defined(BSD4_3) +#define strchr(a, b) index(a, b) +#define strrchr(a, b) rindex(a, b) +#define memcmp(a, b, n) bcmp(a, b, n) +#define memmove(a, b, n) bcopy(b, a, n) +#endif + +/* + * 32-bit machine. The db routines are theoretically independent of + * the size of u_shorts and u_longs, but I don't know that anyone has + * ever actually tried it. At a minimum, change the following #define's + * if you are trying to compile on a different type of system. + */ +#ifndef USHRT_MAX +#define USHRT_MAX 0xFFFF +#define ULONG_MAX 0xFFFFFFFF +#endif + +#ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */ +#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) +#endif + +#ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 RE limit. */ +#define _POSIX2_RE_DUP_MAX 255 +#endif + +/* + * If you can't provide lock values in the open(2) call. Note, this + * allows races to happen. + */ +#ifndef O_EXLOCK /* 4.4BSD extension. */ +#define O_EXLOCK 0 +#endif + +#ifndef O_SHLOCK /* 4.4BSD extension. */ +#define O_SHLOCK 0 +#endif + +#ifndef EFTYPE +#define EFTYPE EINVAL /* POSIX 1003.1 format errno. */ +#endif + +#ifndef WCOREDUMP /* 4.4BSD extension */ +#define WCOREDUMP(a) 0 +#endif + +#ifndef STDERR_FILENO +#define STDIN_FILENO 0 /* ANSI C #defines */ +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 +#endif + +#ifndef SEEK_END +#define SEEK_SET 0 /* POSIX 1003.1 seek values */ +#define SEEK_CUR 1 +#define SEEK_END 2 +#endif + +#ifndef _POSIX_VDISABLE /* POSIX 1003.1 disabling char. */ +#define _POSIX_VDISABLE 0 /* Some systems used 0. */ +#endif + +#ifndef TCSASOFT /* 4.4BSD extension. */ +#define TCSASOFT 0 +#endif + +#ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 values. */ +#define _POSIX2_RE_DUP_MAX 255 +#endif + +#ifndef NULL /* ANSI C #defines NULL everywhere. */ +#define NULL 0 +#endif + +#ifndef MAX /* Usually found in . */ +#define MAX(_a,_b) ((_a)<(_b)?(_b):(_a)) +#endif +#ifndef MIN /* Usually found in . */ +#define MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) +#endif + +/* Default file permissions. */ +#ifndef DEFFILEMODE /* 4.4BSD extension. */ +#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) +#endif + +#ifndef __sun +#ifndef S_ISDIR /* POSIX 1003.1 file type tests. */ +#define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */ +#define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */ +#define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */ +#define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */ +#define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */ +#endif +#ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */ +#define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */ +#define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */ +#endif +#endif /* __sun */ + +/* The type of a va_list. */ +#ifndef _BSD_VA_LIST_ /* 4.4BSD #define. */ +#define _BSD_VA_LIST_ char * +#endif + +#endif /* !_COMPAT_H_ */ diff --git a/mozilla/dbm/include/page.h b/mozilla/dbm/include/page.h new file mode 100644 index 0000000..be2446d --- /dev/null +++ b/mozilla/dbm/include/page.h @@ -0,0 +1,94 @@ +/*- + * Copyright (c) 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Margo Seltzer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)page.h 8.2 (Berkeley) 5/31/94 + */ + +/* + * Definitions for hashing page file format. + */ + +/* + * routines dealing with a data page + * + * page format: + * +------------------------------+ + * p | n | keyoff | datoff | keyoff | + * +------------+--------+--------+ + * | datoff | free | ptr | --> | + * +--------+---------------------+ + * | F R E E A R E A | + * +--------------+---------------+ + * | <---- - - - | data | + * +--------+-----+----+----------+ + * | key | data | key | + * +--------+----------+----------+ + * + * Pointer to the free space is always: p[p[0] + 2] + * Amount of free space on the page is: p[p[0] + 1] + */ + +/* + * How many bytes required for this pair? + * 2 shorts in the table at the top of the page + room for the + * key and room for the data + * + * We prohibit entering a pair on a page unless there is also room to append + * an overflow page. The reason for this it that you can get in a situation + * where a single key/data pair fits on a page, but you can't append an + * overflow page and later you'd have to split the key/data and handle like + * a big pair. + * You might as well do this up front. + */ +#ifndef PAGE_H +#define PAGE_H + +#define PAIRSIZE(K,D) (2*sizeof(uint16) + (K)->size + (D)->size) +#define BIGOVERHEAD (4*sizeof(uint16)) +#define KEYSIZE(K) (4*sizeof(uint16) + (K)->size); +#define OVFLSIZE (2*sizeof(uint16)) +#define FREESPACE(P) ((P)[(P)[0]+1]) +#define OFFSET(P) ((P)[(P)[0]+2]) +#define PAIRFITS(P,K,D) \ + (((P)[2] >= REAL_KEY) && \ + (PAIRSIZE((K),(D)) + OVFLSIZE) <= FREESPACE((P))) +#define PAGE_META(N) (((N)+3) * sizeof(uint16)) + +typedef struct { + BUFHEAD *newp; + BUFHEAD *oldp; + BUFHEAD *nextp; + uint16 next_addr; +} SPLIT_RETURN; +#endif + diff --git a/mozilla/dbm/include/queue.h b/mozilla/dbm/include/queue.h new file mode 100644 index 0000000..3b4ffeb --- /dev/null +++ b/mozilla/dbm/include/queue.h @@ -0,0 +1,243 @@ +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)queue.h 8.3 (Berkeley) 12/13/93 + */ + +#ifndef _QUEUE_H_ +#define _QUEUE_H_ + +/* + * This file defines three types of data structures: lists, tail queues, + * and circular queues. + * + * A list is headed by a single forward pointer (or an array of forward + * pointers for a hash table header). The elements are doubly linked + * so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list after + * an existing element or at the head of the list. A list may only be + * traversed in the forward direction. + * + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list after + * an existing element, at the head of the list, or at the end of the + * list. A tail queue may only be traversed in the forward direction. + * + * A circle queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or after + * an existing element, at the head of the list, or at the end of the list. + * A circle queue may be traversed in either direction, but has a more + * complex end of list detection. + * + * For details on the use of these macros, see the queue(3) manual page. + */ + +/* + * List definitions. + */ +#define LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} + +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; /* next element */ \ + struct type **le_prev; /* address of previous next element */ \ +} + +/* + * List functions. + */ +#define LIST_INIT(head) { \ + (head)->lh_first = NULL; \ +} + +#define LIST_INSERT_AFTER(listelm, elm, field) { \ + if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ + (listelm)->field.le_next->field.le_prev = \ + &(elm)->field.le_next; \ + (listelm)->field.le_next = (elm); \ + (elm)->field.le_prev = &(listelm)->field.le_next; \ +} + +#define LIST_INSERT_HEAD(head, elm, field) { \ + if (((elm)->field.le_next = (head)->lh_first) != NULL) \ + (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ + (head)->lh_first = (elm); \ + (elm)->field.le_prev = &(head)->lh_first; \ +} + +#define LIST_REMOVE(elm, field) { \ + if ((elm)->field.le_next != NULL) \ + (elm)->field.le_next->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = (elm)->field.le_next; \ +} + +/* + * Tail queue definitions. + */ +#define TAILQ_HEAD(name, type) \ +struct name { \ + struct type *tqh_first; /* first element */ \ + struct type **tqh_last; /* addr of last next element */ \ +} + +#define TAILQ_ENTRY(type) \ +struct { \ + struct type *tqe_next; /* next element */ \ + struct type **tqe_prev; /* address of previous next element */ \ +} + +/* + * Tail queue functions. + */ +#define TAILQ_INIT(head) { \ + (head)->tqh_first = NULL; \ + (head)->tqh_last = &(head)->tqh_first; \ +} + +#define TAILQ_INSERT_HEAD(head, elm, field) { \ + if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ + (elm)->field.tqe_next->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_first = (elm); \ + (elm)->field.tqe_prev = &(head)->tqh_first; \ +} + +#define TAILQ_INSERT_TAIL(head, elm, field) { \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &(elm)->field.tqe_next; \ +} + +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) { \ + if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ + (elm)->field.tqe_next->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (listelm)->field.tqe_next = (elm); \ + (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ +} + +#define TAILQ_REMOVE(head, elm, field) { \ + if (((elm)->field.tqe_next) != NULL) \ + (elm)->field.tqe_next->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ +} + +/* + * Circular queue definitions. + */ +#define CIRCLEQ_HEAD(name, type) \ +struct name { \ + struct type *cqh_first; /* first element */ \ + struct type *cqh_last; /* last element */ \ +} + +#define CIRCLEQ_ENTRY(type) \ +struct { \ + struct type *cqe_next; /* next element */ \ + struct type *cqe_prev; /* previous element */ \ +} + +/* + * Circular queue functions. + */ +#define CIRCLEQ_INIT(head) { \ + (head)->cqh_first = (void *)(head); \ + (head)->cqh_last = (void *)(head); \ +} + +#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) { \ + (elm)->field.cqe_next = (listelm)->field.cqe_next; \ + (elm)->field.cqe_prev = (listelm); \ + if ((listelm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (listelm)->field.cqe_next->field.cqe_prev = (elm); \ + (listelm)->field.cqe_next = (elm); \ +} + +#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) { \ + (elm)->field.cqe_next = (listelm); \ + (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ + if ((listelm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (listelm)->field.cqe_prev->field.cqe_next = (elm); \ + (listelm)->field.cqe_prev = (elm); \ +} + +#define CIRCLEQ_INSERT_HEAD(head, elm, field) { \ + (elm)->field.cqe_next = (head)->cqh_first; \ + (elm)->field.cqe_prev = (void *)(head); \ + if ((head)->cqh_last == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (head)->cqh_first->field.cqe_prev = (elm); \ + (head)->cqh_first = (elm); \ +} + +#define CIRCLEQ_INSERT_TAIL(head, elm, field) { \ + (elm)->field.cqe_next = (void *)(head); \ + (elm)->field.cqe_prev = (head)->cqh_last; \ + if ((head)->cqh_first == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (head)->cqh_last->field.cqe_next = (elm); \ + (head)->cqh_last = (elm); \ +} + +#define CIRCLEQ_REMOVE(head, elm, field) { \ + if ((elm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm)->field.cqe_prev; \ + else \ + (elm)->field.cqe_next->field.cqe_prev = \ + (elm)->field.cqe_prev; \ + if ((elm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm)->field.cqe_next; \ + else \ + (elm)->field.cqe_prev->field.cqe_next = \ + (elm)->field.cqe_next; \ +} +#endif /* !_QUEUE_H_ */ diff --git a/mozilla/dbm/include/search.h b/mozilla/dbm/include/search.h new file mode 100644 index 0000000..ae1df1c --- /dev/null +++ b/mozilla/dbm/include/search.h @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Margo Seltzer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)search.h 8.1 (Berkeley) 6/4/93 + */ + +/* Backward compatibility to hsearch interface. */ +typedef struct entry { + char *key; + char *data; +} ENTRY; + +typedef enum { + FIND, ENTER +} ACTION; + +int hcreate (unsigned int); +void hdestroy (void); +ENTRY *hsearch (ENTRY, ACTION); diff --git a/mozilla/dbm/include/winfile.h b/mozilla/dbm/include/winfile.h new file mode 100644 index 0000000..36b59f7 --- /dev/null +++ b/mozilla/dbm/include/winfile.h @@ -0,0 +1,112 @@ + +/* --------------------------------------------------------------------------- + Stuff to fake unix file I/O on windows boxes + ------------------------------------------------------------------------*/ + +#ifndef WINFILE_H +#define WINFILE_H + +#ifdef _WINDOWS +/* hacked out of on an SGI */ +#if defined(XP_WIN32) || defined(_WIN32) +/* 32-bit stuff here */ +#include +#include +#ifdef __MINGW32__ +#include +#include +#else +#include +#include +#endif + +typedef struct DIR_Struct { + void * directoryPtr; + WIN32_FIND_DATA data; +} DIR; + +#define _ST_FSTYPSZ 16 + +#if !defined(__BORLANDC__) && !defined(__GNUC__) + typedef unsigned long mode_t; + typedef long uid_t; + typedef long gid_t; + +#ifdef WINCE + typedef long ino_t; +#else + typedef long off_t; +#endif + + typedef unsigned long nlink_t; +#endif + +typedef struct timestruc { + time_t tv_sec; /* seconds */ + long tv_nsec; /* and nanoseconds */ +} timestruc_t; + + +struct dirent { /* data from readdir() */ + ino_t d_ino; /* inode number of entry */ + off_t d_off; /* offset of disk direntory entry */ + unsigned short d_reclen; /* length of this record */ + char d_name[_MAX_FNAME]; /* name of file */ +}; + +#if !defined(__BORLANDC__) && !defined (__GNUC__) +#define S_ISDIR(s) ((s) & _S_IFDIR) +#endif + +#else /* _WIN32 */ +/* 16-bit windows stuff */ + +#include +#include +#include + + + +/* Getting cocky to support multiple file systems */ +typedef struct dirStruct_tag { + struct _find_t file_data; + char c_checkdrive; +} dirStruct; + +typedef struct DIR_Struct { + void * directoryPtr; + dirStruct data; +} DIR; + +#define _ST_FSTYPSZ 16 +typedef unsigned long mode_t; +typedef long uid_t; +typedef long gid_t; +typedef long off_t; +typedef unsigned long nlink_t; + +typedef struct timestruc { + time_t tv_sec; /* seconds */ + long tv_nsec; /* and nanoseconds */ +} timestruc_t; + +struct dirent { /* data from readdir() */ + ino_t d_ino; /* inode number of entry */ + off_t d_off; /* offset of disk direntory entry */ + unsigned short d_reclen; /* length of this record */ +#ifdef XP_WIN32 + char d_name[_MAX_FNAME]; /* name of file */ +#else + char d_name[20]; /* name of file */ +#endif +}; + +#define S_ISDIR(s) ((s) & _S_IFDIR) + +#endif /* 16-bit windows */ + +#define CONST const + +#endif /* _WINDOWS */ + +#endif /* WINFILE_H */ diff --git a/mozilla/dbm/src/.cvsignore b/mozilla/dbm/src/.cvsignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/mozilla/dbm/src/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/mozilla/dbm/src/Makefile.in b/mozilla/dbm/src/Makefile.in new file mode 100644 index 0000000..2f7476d --- /dev/null +++ b/mozilla/dbm/src/Makefile.in @@ -0,0 +1,95 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +LIBRARY_NAME = mozdbm_s +LIB_IS_C_ONLY = 1 + +ifeq ($(OS_ARCH),WINNT) +LIBRARY_NAME = dbm$(MOZ_BITS) +endif + +CSRCS = \ + db.c \ + h_bigkey.c \ + h_func.c \ + h_log2.c \ + h_page.c \ + hash.c \ + hash_buf.c \ + hsearch.c \ + mktemp.c \ + ndbm.c \ + strerror.c \ + nsres.c \ + $(NULL) + +ifeq ($(OS_ARCH),WINNT) +CSRCS += memmove.c snprintf.c +else +ifeq (,$(filter -DHAVE_MEMMOVE=1,$(ACDEFINES))) +CSRCS += memmove.c +endif + +ifeq (,$(filter -DHAVE_SNPRINTF=1,$(ACDEFINES))) +CSRCS += snprintf.c +endif +endif # WINNT + +LOCAL_INCLUDES = -I$(srcdir)/../include + +FORCE_STATIC_LIB = 1 +FORCE_USE_PIC = 1 + +include $(topsrcdir)/config/rules.mk + +DEFINES += -DMEMMOVE -D__DBINTERFACE_PRIVATE $(SECURITY_FLAG) + +ifeq ($(OS_ARCH),WINCE) +DEFINES += -D__STDC__ -DDBM_REOPEN_ON_FLUSH +endif + +ifeq ($(OS_ARCH),AIX) +OS_LIBS += -lc_r +endif + diff --git a/mozilla/dbm/src/Makefile.win b/mozilla/dbm/src/Makefile.win new file mode 100644 index 0000000..91bdf7d --- /dev/null +++ b/mozilla/dbm/src/Makefile.win @@ -0,0 +1,113 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + + +#//------------------------------------------------------------------------ +#// +#// Makefile to build the cert library +#// +#//------------------------------------------------------------------------ + +!if "$(MOZ_BITS)" == "16" +!ifndef MOZ_DEBUG +OPTIMIZER=-Os -UDEBUG -DNDEBUG +!endif +!endif + +#//------------------------------------------------------------------------ +#// +#// Specify the depth of the current directory relative to the +#// root of NS +#// +#//------------------------------------------------------------------------ +DEPTH= ..\.. + +!ifndef MAKE_OBJ_TYPE +MAKE_OBJ_TYPE=EXE +!endif + +#//------------------------------------------------------------------------ +#// +#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...) +#// +#//------------------------------------------------------------------------ +LIBNAME=dbm$(MOZ_BITS) +PDBFILE=$(LIBNAME).pdb + +#//------------------------------------------------------------------------ +#// +#// Define the files necessary to build the target (ie. OBJS) +#// +#//------------------------------------------------------------------------ +OBJS= \ + .\$(OBJDIR)\db.obj \ + .\$(OBJDIR)\h_bigkey.obj \ + .\$(OBJDIR)\h_func.obj \ + .\$(OBJDIR)\h_log2.obj \ + .\$(OBJDIR)\h_page.obj \ + .\$(OBJDIR)\hash.obj \ + .\$(OBJDIR)\hash_buf.obj \ + .\$(OBJDIR)\hsearch.obj \ + .\$(OBJDIR)\memmove.obj \ + .\$(OBJDIR)\mktemp.obj \ + .\$(OBJDIR)\ndbm.obj \ + .\$(OBJDIR)\snprintf.obj \ + .\$(OBJDIR)\strerror.obj \ + .\$(OBJDIR)\nsres.obj \ + $(NULL) + +#//------------------------------------------------------------------------ +#// +#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...) +#// (these must be defined before the common makefiles are included) +#// +#//------------------------------------------------------------------------ +LIBRARY = .\$(OBJDIR)\$(LIBNAME).lib +LINCS = -I..\include + +#//------------------------------------------------------------------------ +#// +#// Include the common makefile rules +#// +#//------------------------------------------------------------------------ +include <$(DEPTH)/config/rules.mak> + +CFLAGS = $(CFLAGS) -DMOZILLA_CLIENT -D__DBINTERFACE_PRIVATE + +install:: $(LIBRARY) + $(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib + + diff --git a/mozilla/dbm/src/db.c b/mozilla/dbm/src/db.c new file mode 100644 index 0000000..264e9fa --- /dev/null +++ b/mozilla/dbm/src/db.c @@ -0,0 +1,136 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)db.c 8.4 (Berkeley) 2/21/94"; +#endif /* LIBC_SCCS and not lint */ + +#ifndef __DBINTERFACE_PRIVATE +#define __DBINTERFACE_PRIVATE +#endif +#ifdef macintosh +#include +#else +#include +#endif + +#include +#include +#include +#include + +#include "mcom_db.h" + +/* a global flag that locks closed all databases */ +int all_databases_locked_closed = 0; + +/* set or unset a global lock flag to disable the + * opening of any DBM file + */ +void +dbSetOrClearDBLock(DBLockFlagEnum type) +{ + if(type == LockOutDatabase) + all_databases_locked_closed = 1; + else + all_databases_locked_closed = 0; +} + +DB * +dbopen(const char *fname, int flags,int mode, DBTYPE type, const void *openinfo) +{ + + /* lock out all file databases. Let in-memory databases through + */ + if(all_databases_locked_closed && fname) + { + errno = EINVAL; + return(NULL); + } + +#define DB_FLAGS (DB_LOCK | DB_SHMEM | DB_TXN) + + +#if 0 /* most systems don't have EXLOCK and SHLOCK */ +#define USE_OPEN_FLAGS \ + (O_CREAT | O_EXCL | O_EXLOCK | O_NONBLOCK | O_RDONLY | \ + O_RDWR | O_SHLOCK | O_TRUNC) +#else +#define USE_OPEN_FLAGS \ + (O_CREAT | O_EXCL | O_RDONLY | \ + O_RDWR | O_TRUNC) +#endif + + if ((flags & ~(USE_OPEN_FLAGS | DB_FLAGS)) == 0) + switch (type) { +/* we don't need btree and recno right now */ +#if 0 + case DB_BTREE: + return (__bt_open(fname, flags & USE_OPEN_FLAGS, + mode, openinfo, flags & DB_FLAGS)); + case DB_RECNO: + return (__rec_open(fname, flags & USE_OPEN_FLAGS, + mode, openinfo, flags & DB_FLAGS)); +#endif + + case DB_HASH: + return (__hash_open(fname, flags & USE_OPEN_FLAGS, + mode, (const HASHINFO *)openinfo, flags & DB_FLAGS)); + default: + break; + } + errno = EINVAL; + return (NULL); +} + +static int +__dberr() +{ + return (RET_ERROR); +} + +/* + * __DBPANIC -- Stop. + * + * Parameters: + * dbp: pointer to the DB structure. + */ +void +__dbpanic(DB *dbp) +{ + /* The only thing that can succeed is a close. */ + dbp->del = (int (*)(const struct __db *, const DBT *, uint))__dberr; + dbp->fd = (int (*)(const struct __db *))__dberr; + dbp->get = (int (*)(const struct __db *, const DBT *, DBT *, uint))__dberr; + dbp->put = (int (*)(const struct __db *, DBT *, const DBT *, uint))__dberr; + dbp->seq = (int (*)(const struct __db *, DBT *, DBT *, uint))__dberr; + dbp->sync = (int (*)(const struct __db *, uint))__dberr; +} diff --git a/mozilla/dbm/src/h_bigkey.c b/mozilla/dbm/src/h_bigkey.c new file mode 100644 index 0000000..c174e32 --- /dev/null +++ b/mozilla/dbm/src/h_bigkey.c @@ -0,0 +1,709 @@ +/*- + * Copyright (c) 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Margo Seltzer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)hash_bigkey.c 8.3 (Berkeley) 5/31/94"; +#endif /* LIBC_SCCS and not lint */ + +/* + * PACKAGE: hash + * DESCRIPTION: + * Big key/data handling for the hashing package. + * + * ROUTINES: + * External + * __big_keydata + * __big_split + * __big_insert + * __big_return + * __big_delete + * __find_last_page + * Internal + * collect_key + * collect_data + */ + +#if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh) +#include +#endif + +#include +#include +#include +#include + +#ifdef DEBUG +#include +#endif + +#include "mcom_db.h" +#include "hash.h" +#include "page.h" +/* #include "extern.h" */ + +static int collect_key __P((HTAB *, BUFHEAD *, int, DBT *, int)); +static int collect_data __P((HTAB *, BUFHEAD *, int, int)); + +/* + * Big_insert + * + * You need to do an insert and the key/data pair is too big + * + * Returns: + * 0 ==> OK + *-1 ==> ERROR + */ +extern int +__big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) +{ + register uint16 *p; + uint key_size, n, val_size; + uint16 space, move_bytes, off; + char *cp, *key_data, *val_data; + + cp = bufp->page; /* Character pointer of p. */ + p = (uint16 *)cp; + + key_data = (char *)key->data; + key_size = key->size; + val_data = (char *)val->data; + val_size = val->size; + + /* First move the Key */ + for (space = FREESPACE(p) - BIGOVERHEAD; key_size; + space = FREESPACE(p) - BIGOVERHEAD) { + move_bytes = PR_MIN(space, key_size); + off = OFFSET(p) - move_bytes; + memmove(cp + off, key_data, move_bytes); + key_size -= move_bytes; + key_data += move_bytes; + n = p[0]; + p[++n] = off; + p[0] = ++n; + FREESPACE(p) = off - PAGE_META(n); + OFFSET(p) = off; + p[n] = PARTIAL_KEY; + bufp = __add_ovflpage(hashp, bufp); + if (!bufp) + return (-1); + n = p[0]; + if (!key_size) { + if (FREESPACE(p)) { + move_bytes = PR_MIN(FREESPACE(p), val_size); + off = OFFSET(p) - move_bytes; + p[n] = off; + memmove(cp + off, val_data, move_bytes); + val_data += move_bytes; + val_size -= move_bytes; + p[n - 2] = FULL_KEY_DATA; + FREESPACE(p) = FREESPACE(p) - move_bytes; + OFFSET(p) = off; + } else + p[n - 2] = FULL_KEY; + } + p = (uint16 *)bufp->page; + cp = bufp->page; + bufp->flags |= BUF_MOD; + } + + /* Now move the data */ + for (space = FREESPACE(p) - BIGOVERHEAD; val_size; + space = FREESPACE(p) - BIGOVERHEAD) { + move_bytes = PR_MIN(space, val_size); + /* + * Here's the hack to make sure that if the data ends on the + * same page as the key ends, FREESPACE is at least one. + */ + if (space == val_size && val_size == val->size) + move_bytes--; + off = OFFSET(p) - move_bytes; + memmove(cp + off, val_data, move_bytes); + val_size -= move_bytes; + val_data += move_bytes; + n = p[0]; + p[++n] = off; + p[0] = ++n; + FREESPACE(p) = off - PAGE_META(n); + OFFSET(p) = off; + if (val_size) { + p[n] = FULL_KEY; + bufp = __add_ovflpage(hashp, bufp); + if (!bufp) + return (-1); + cp = bufp->page; + p = (uint16 *)cp; + } else + p[n] = FULL_KEY_DATA; + bufp->flags |= BUF_MOD; + } + return (0); +} + +/* + * Called when bufp's page contains a partial key (index should be 1) + * + * All pages in the big key/data pair except bufp are freed. We cannot + * free bufp because the page pointing to it is lost and we can't get rid + * of its pointer. + * + * Returns: + * 0 => OK + *-1 => ERROR + */ +extern int +__big_delete(HTAB *hashp, BUFHEAD *bufp) +{ + register BUFHEAD *last_bfp, *rbufp; + uint16 *bp, pageno; + int key_done, n; + + rbufp = bufp; + last_bfp = NULL; + bp = (uint16 *)bufp->page; + pageno = 0; + key_done = 0; + + while (!key_done || (bp[2] != FULL_KEY_DATA)) { + if (bp[2] == FULL_KEY || bp[2] == FULL_KEY_DATA) + key_done = 1; + + /* + * If there is freespace left on a FULL_KEY_DATA page, then + * the data is short and fits entirely on this page, and this + * is the last page. + */ + if (bp[2] == FULL_KEY_DATA && FREESPACE(bp)) + break; + pageno = bp[bp[0] - 1]; + rbufp->flags |= BUF_MOD; + rbufp = __get_buf(hashp, pageno, rbufp, 0); + if (last_bfp) + __free_ovflpage(hashp, last_bfp); + last_bfp = rbufp; + if (!rbufp) + return (-1); /* Error. */ + bp = (uint16 *)rbufp->page; + } + + /* + * If we get here then rbufp points to the last page of the big + * key/data pair. Bufp points to the first one -- it should now be + * empty pointing to the next page after this pair. Can't free it + * because we don't have the page pointing to it. + */ + + /* This is information from the last page of the pair. */ + n = bp[0]; + pageno = bp[n - 1]; + + /* Now, bp is the first page of the pair. */ + bp = (uint16 *)bufp->page; + if (n > 2) { + /* There is an overflow page. */ + bp[1] = pageno; + bp[2] = OVFLPAGE; + bufp->ovfl = rbufp->ovfl; + } else + /* This is the last page. */ + bufp->ovfl = NULL; + n -= 2; + bp[0] = n; + FREESPACE(bp) = hashp->BSIZE - PAGE_META(n); + OFFSET(bp) = hashp->BSIZE - 1; + + bufp->flags |= BUF_MOD; + if (rbufp) + __free_ovflpage(hashp, rbufp); + if (last_bfp != rbufp) + __free_ovflpage(hashp, last_bfp); + + hashp->NKEYS--; + return (0); +} +/* + * Returns: + * 0 = key not found + * -1 = get next overflow page + * -2 means key not found and this is big key/data + * -3 error + */ +extern int +__find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size) +{ + register uint16 *bp; + register char *p; + int ksize; + uint16 bytes; + char *kkey; + + bp = (uint16 *)bufp->page; + p = bufp->page; + ksize = size; + kkey = key; + + for (bytes = hashp->BSIZE - bp[ndx]; + bytes <= size && bp[ndx + 1] == PARTIAL_KEY; + bytes = hashp->BSIZE - bp[ndx]) { + if (memcmp(p + bp[ndx], kkey, bytes)) + return (-2); + kkey += bytes; + ksize -= bytes; + bufp = __get_buf(hashp, bp[ndx + 2], bufp, 0); + if (!bufp) + return (-3); + p = bufp->page; + bp = (uint16 *)p; + ndx = 1; + } + + if (bytes != ksize || memcmp(p + bp[ndx], kkey, bytes)) { +#ifdef HASH_STATISTICS + ++hash_collisions; +#endif + return (-2); + } else + return (ndx); +} + +/* + * Given the buffer pointer of the first overflow page of a big pair, + * find the end of the big pair + * + * This will set bpp to the buffer header of the last page of the big pair. + * It will return the pageno of the overflow page following the last page + * of the pair; 0 if there isn't any (i.e. big pair is the last key in the + * bucket) + */ +extern uint16 +__find_last_page(HTAB *hashp, BUFHEAD **bpp) +{ + BUFHEAD *bufp; + uint16 *bp, pageno; + uint n; + + bufp = *bpp; + bp = (uint16 *)bufp->page; + for (;;) { + n = bp[0]; + + /* + * This is the last page if: the tag is FULL_KEY_DATA and + * either only 2 entries OVFLPAGE marker is explicit there + * is freespace on the page. + */ + if (bp[2] == FULL_KEY_DATA && + ((n == 2) || (bp[n] == OVFLPAGE) || (FREESPACE(bp)))) + break; + + /* LJM bound the size of n to reasonable limits + */ + if(n > hashp->BSIZE/sizeof(uint16)) + return(0); + + pageno = bp[n - 1]; + bufp = __get_buf(hashp, pageno, bufp, 0); + if (!bufp) + return (0); /* Need to indicate an error! */ + bp = (uint16 *)bufp->page; + } + + *bpp = bufp; + if (bp[0] > 2) + return (bp[3]); + else + return (0); +} + +/* + * Return the data for the key/data pair that begins on this page at this + * index (index should always be 1). + */ +extern int +__big_return( + HTAB *hashp, + BUFHEAD *bufp, + int ndx, + DBT *val, + int set_current) +{ + BUFHEAD *save_p; + uint16 *bp, len, off, save_addr; + char *tp; + int save_flags; + + bp = (uint16 *)bufp->page; + while (bp[ndx + 1] == PARTIAL_KEY) { + bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0); + if (!bufp) + return (-1); + bp = (uint16 *)bufp->page; + ndx = 1; + } + + if (bp[ndx + 1] == FULL_KEY) { + bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0); + if (!bufp) + return (-1); + bp = (uint16 *)bufp->page; + save_p = bufp; + save_addr = save_p->addr; + off = bp[1]; + len = 0; + } else + if (!FREESPACE(bp)) { + /* + * This is a hack. We can't distinguish between + * FULL_KEY_DATA that contains complete data or + * incomplete data, so we require that if the data + * is complete, there is at least 1 byte of free + * space left. + */ + off = bp[bp[0]]; + len = bp[1] - off; + save_p = bufp; + save_addr = bufp->addr; + bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0); + if (!bufp) + return (-1); + bp = (uint16 *)bufp->page; + } else { + /* The data is all on one page. */ + tp = (char *)bp; + off = bp[bp[0]]; + val->data = (uint8 *)tp + off; + val->size = bp[1] - off; + if (set_current) { + if (bp[0] == 2) { /* No more buckets in + * chain */ + hashp->cpage = NULL; + hashp->cbucket++; + hashp->cndx = 1; + } else { + hashp->cpage = __get_buf(hashp, + bp[bp[0] - 1], bufp, 0); + if (!hashp->cpage) + return (-1); + hashp->cndx = 1; + if (!((uint16 *) + hashp->cpage->page)[0]) { + hashp->cbucket++; + hashp->cpage = NULL; + } + } + } + return (0); + } + + /* pin our saved buf so that we don't lose if + * we run out of buffers */ + save_flags = save_p->flags; + save_p->flags |= BUF_PIN; + val->size = collect_data(hashp, bufp, (int)len, set_current); + save_p->flags = save_flags; + if (val->size == (size_t)-1) + return (-1); + if (save_p->addr != save_addr) { + /* We are pretty short on buffers. */ + errno = EINVAL; /* OUT OF BUFFERS */ + return (-1); + } + memmove(hashp->tmp_buf, (save_p->page) + off, len); + val->data = (uint8 *)hashp->tmp_buf; + return (0); +} + + +/* + * Count how big the total datasize is by looping through the pages. Then + * allocate a buffer and copy the data in the second loop. NOTE: Our caller + * may already have a bp which it is holding onto. The caller is + * responsible for copying that bp into our temp buffer. 'len' is how much + * space to reserve for that buffer. + */ +static int +collect_data( + HTAB *hashp, + BUFHEAD *bufp, + int len, int set) +{ + register uint16 *bp; + BUFHEAD *save_bufp; + int save_flags; + int mylen, totlen; + + /* + * save the input buf head because we need to walk the list twice. + * pin it to make sure it doesn't leave the buffer pool. + * This has the effect of growing the buffer pool if necessary. + */ + save_bufp = bufp; + save_flags = save_bufp->flags; + save_bufp->flags |= BUF_PIN; + + /* read the length of the buffer */ + for (totlen = len; bufp ; bufp = __get_buf(hashp, bp[bp[0]-1], bufp, 0)) { + bp = (uint16 *)bufp->page; + mylen = hashp->BSIZE - bp[1]; + + /* if mylen ever goes negative it means that the + * page is screwed up. + */ + if (mylen < 0) { + save_bufp->flags = save_flags; + return (-1); + } + totlen += mylen; + if (bp[2] == FULL_KEY_DATA) { /* End of Data */ + break; + } + } + + if (!bufp) { + save_bufp->flags = save_flags; + return (-1); + } + + /* allocate a temp buf */ + if (hashp->tmp_buf) + free(hashp->tmp_buf); + if ((hashp->tmp_buf = (char *)malloc((size_t)totlen)) == NULL) { + save_bufp->flags = save_flags; + return (-1); + } + + /* copy the buffers back into temp buf */ + for (bufp = save_bufp; bufp ; + bufp = __get_buf(hashp, bp[bp[0]-1], bufp, 0)) { + bp = (uint16 *)bufp->page; + mylen = hashp->BSIZE - bp[1]; + memmove(&hashp->tmp_buf[len], (bufp->page) + bp[1], (size_t)mylen); + len += mylen; + if (bp[2] == FULL_KEY_DATA) { + break; + } + } + + /* 'clear' the pin flags */ + save_bufp->flags = save_flags; + + /* update the database cursor */ + if (set) { + hashp->cndx = 1; + if (bp[0] == 2) { /* No more buckets in chain */ + hashp->cpage = NULL; + hashp->cbucket++; + } else { + hashp->cpage = __get_buf(hashp, bp[bp[0] - 1], bufp, 0); + if (!hashp->cpage) + return (-1); + else if (!((uint16 *)hashp->cpage->page)[0]) { + hashp->cbucket++; + hashp->cpage = NULL; + } + } + } + return (totlen); +} + +/* + * Fill in the key and data for this big pair. + */ +extern int +__big_keydata( + HTAB *hashp, + BUFHEAD *bufp, + DBT *key, DBT *val, + int set) +{ + key->size = collect_key(hashp, bufp, 0, val, set); + if (key->size == (size_t)-1) + return (-1); + key->data = (uint8 *)hashp->tmp_key; + return (0); +} + +/* + * Count how big the total key size is by recursing through the pages. Then + * collect the data, allocate a buffer and copy the key as you recurse up. + */ +static int +collect_key( + HTAB *hashp, + BUFHEAD *bufp, + int len, + DBT *val, + int set) +{ + BUFHEAD *xbp; + char *p; + int mylen, totlen; + uint16 *bp, save_addr; + + p = bufp->page; + bp = (uint16 *)p; + mylen = hashp->BSIZE - bp[1]; + + save_addr = bufp->addr; + totlen = len + mylen; + if (bp[2] == FULL_KEY || bp[2] == FULL_KEY_DATA) { /* End of Key. */ + if (hashp->tmp_key != NULL) + free(hashp->tmp_key); + if ((hashp->tmp_key = (char *)malloc((size_t)totlen)) == NULL) + return (-1); + if (__big_return(hashp, bufp, 1, val, set)) + return (-1); + } else { + xbp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0); + if (!xbp || ((totlen = + collect_key(hashp, xbp, totlen, val, set)) < 1)) + return (-1); + } + if (bufp->addr != save_addr) { + errno = EINVAL; /* MIS -- OUT OF BUFFERS */ + return (-1); + } + memmove(&hashp->tmp_key[len], (bufp->page) + bp[1], (size_t)mylen); + return (totlen); +} + +/* + * Returns: + * 0 => OK + * -1 => error + */ +extern int +__big_split( + HTAB *hashp, + BUFHEAD *op, /* Pointer to where to put keys that go in old bucket */ + BUFHEAD *np, /* Pointer to new bucket page */ + /* Pointer to first page containing the big key/data */ + BUFHEAD *big_keyp, + uint32 addr, /* Address of big_keyp */ + uint32 obucket,/* Old Bucket */ + SPLIT_RETURN *ret) +{ + register BUFHEAD *tmpp; + register uint16 *tp; + BUFHEAD *bp; + DBT key, val; + uint32 change; + uint16 free_space, n, off; + + bp = big_keyp; + + /* Now figure out where the big key/data goes */ + if (__big_keydata(hashp, big_keyp, &key, &val, 0)) + return (-1); + change = (__call_hash(hashp,(char*) key.data, key.size) != obucket); + + if ((ret->next_addr = __find_last_page(hashp, &big_keyp))) { + if (!(ret->nextp = + __get_buf(hashp, ret->next_addr, big_keyp, 0))) + return (-1);; + } else + ret->nextp = NULL; + + /* Now make one of np/op point to the big key/data pair */ +#ifdef DEBUG + assert(np->ovfl == NULL); +#endif + if (change) + tmpp = np; + else + tmpp = op; + + tmpp->flags |= BUF_MOD; +#ifdef DEBUG1 + (void)fprintf(stderr, + "BIG_SPLIT: %d->ovfl was %d is now %d\n", tmpp->addr, + (tmpp->ovfl ? tmpp->ovfl->addr : 0), (bp ? bp->addr : 0)); +#endif + tmpp->ovfl = bp; /* one of op/np point to big_keyp */ + tp = (uint16 *)tmpp->page; + + +#if 0 /* this get's tripped on database corrupted error */ + assert(FREESPACE(tp) >= OVFLSIZE); +#endif + if(FREESPACE(tp) < OVFLSIZE) + return(DATABASE_CORRUPTED_ERROR); + + n = tp[0]; + off = OFFSET(tp); + free_space = FREESPACE(tp); + tp[++n] = (uint16)addr; + tp[++n] = OVFLPAGE; + tp[0] = n; + OFFSET(tp) = off; + FREESPACE(tp) = free_space - OVFLSIZE; + + /* + * Finally, set the new and old return values. BIG_KEYP contains a + * pointer to the last page of the big key_data pair. Make sure that + * big_keyp has no following page (2 elements) or create an empty + * following page. + */ + + ret->newp = np; + ret->oldp = op; + + tp = (uint16 *)big_keyp->page; + big_keyp->flags |= BUF_MOD; + if (tp[0] > 2) { + /* + * There may be either one or two offsets on this page. If + * there is one, then the overflow page is linked on normally + * and tp[4] is OVFLPAGE. If there are two, tp[4] contains + * the second offset and needs to get stuffed in after the + * next overflow page is added. + */ + n = tp[4]; + free_space = FREESPACE(tp); + off = OFFSET(tp); + tp[0] -= 2; + FREESPACE(tp) = free_space + OVFLSIZE; + OFFSET(tp) = off; + tmpp = __add_ovflpage(hashp, big_keyp); + if (!tmpp) + return (-1); + tp[4] = n; + } else + tmpp = big_keyp; + + if (change) + ret->newp = tmpp; + else + ret->oldp = tmpp; + return (0); +} diff --git a/mozilla/dbm/src/h_func.c b/mozilla/dbm/src/h_func.c new file mode 100644 index 0000000..8c86be6 --- /dev/null +++ b/mozilla/dbm/src/h_func.c @@ -0,0 +1,207 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Margo Seltzer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)hash_func.c 8.2 (Berkeley) 2/21/94"; +#endif /* LIBC_SCCS and not lint */ + +#ifndef macintosh +#include +#endif +#include "mcom_db.h" +#include "hash.h" +#include "page.h" +/* #include "extern.h" */ + +#if 0 +static uint32 hash1 __P((const void *, size_t)); +static uint32 hash2 __P((const void *, size_t)); +static uint32 hash3 __P((const void *, size_t)); +#endif +static uint32 hash4 __P((const void *, size_t)); + +/* Global default hash function */ +uint32 (*__default_hash) __P((const void *, size_t)) = hash4; + +/* + * HASH FUNCTIONS + * + * Assume that we've already split the bucket to which this key hashes, + * calculate that bucket, and check that in fact we did already split it. + * + * This came from ejb's hsearch. + */ + +#define PRIME1 37 +#define PRIME2 1048583 + +#if 0 +static uint32 +hash1(const void *keyarg, register size_t len) +{ + register const uint8 *key; + register uint32 h; + + /* Convert string to integer */ + for (key = (const uint8 *)keyarg, h = 0; len--;) + h = h * PRIME1 ^ (*key++ - ' '); + h %= PRIME2; + return (h); +} + +/* + * Phong's linear congruential hash + */ +#define dcharhash(h, c) ((h) = 0x63c63cd9*(h) + 0x9c39c33d + (c)) + +static uint32 +hash2(const void *keyarg, size_t len) +{ + register const uint8 *e, *key; + register uint32 h; + register uint8 c; + + key = (const uint8 *)keyarg; + e = key + len; + for (h = 0; key != e;) { + c = *key++; + if (!c && key > e) + break; + dcharhash(h, c); + } + return (h); +} + +/* + * This is INCREDIBLY ugly, but fast. We break the string up into 8 byte + * units. On the first time through the loop we get the "leftover bytes" + * (strlen % 8). On every other iteration, we perform 8 HASHC's so we handle + * all 8 bytes. Essentially, this saves us 7 cmp & branch instructions. If + * this routine is heavily used enough, it's worth the ugly coding. + * + * OZ's original sdbm hash + */ +static uint32 +hash3(const void *keyarg, register size_t len) +{ + register const uint8 *key; + register size_t loop; + register uint32 h; + +#define HASHC h = *key++ + 65599 * h + + h = 0; + key = (const uint8 *)keyarg; + if (len > 0) { + loop = (len + 8 - 1) >> 3; + + switch (len & (8 - 1)) { + case 0: + do { + HASHC; + /* FALLTHROUGH */ + case 7: + HASHC; + /* FALLTHROUGH */ + case 6: + HASHC; + /* FALLTHROUGH */ + case 5: + HASHC; + /* FALLTHROUGH */ + case 4: + HASHC; + /* FALLTHROUGH */ + case 3: + HASHC; + /* FALLTHROUGH */ + case 2: + HASHC; + /* FALLTHROUGH */ + case 1: + HASHC; + } while (--loop); + } + } + return (h); +} +#endif /* 0 */ + +/* Hash function from Chris Torek. */ +static uint32 +hash4(const void *keyarg, register size_t len) +{ + register const uint8 *key; + register size_t loop; + register uint32 h; + +#define HASH4a h = (h << 5) - h + *key++; +#define HASH4b h = (h << 5) + h + *key++; +#define HASH4 HASH4b + + h = 0; + key = (const uint8 *)keyarg; + if (len > 0) { + loop = (len + 8 - 1) >> 3; + + switch (len & (8 - 1)) { + case 0: + do { + HASH4; + /* FALLTHROUGH */ + case 7: + HASH4; + /* FALLTHROUGH */ + case 6: + HASH4; + /* FALLTHROUGH */ + case 5: + HASH4; + /* FALLTHROUGH */ + case 4: + HASH4; + /* FALLTHROUGH */ + case 3: + HASH4; + /* FALLTHROUGH */ + case 2: + HASH4; + /* FALLTHROUGH */ + case 1: + HASH4; + } while (--loop); + } + } + return (h); +} diff --git a/mozilla/dbm/src/h_log2.c b/mozilla/dbm/src/h_log2.c new file mode 100644 index 0000000..9c8ea06 --- /dev/null +++ b/mozilla/dbm/src/h_log2.c @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Margo Seltzer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)hash_log2.c 8.2 (Berkeley) 5/31/94"; +#endif /* LIBC_SCCS and not lint */ + +#include +#ifndef macintosh +#include +#endif +#include "mcom_db.h" + +uint32 __log2(uint32 num) +{ + register uint32 i, limit; + + limit = 1; + for (i = 0; limit < num; limit = limit << 1, i++) {} + return (i); +} diff --git a/mozilla/dbm/src/h_page.c b/mozilla/dbm/src/h_page.c new file mode 100644 index 0000000..3b95554 --- /dev/null +++ b/mozilla/dbm/src/h_page.c @@ -0,0 +1,1286 @@ +/*- + * Copyright (c) 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Margo Seltzer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(unix) +#define MY_LSEEK lseek +#else +#define MY_LSEEK new_lseek +extern long new_lseek(int fd, long pos, int start); +#endif + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)hash_page.c 8.7 (Berkeley) 8/16/94"; +#endif /* LIBC_SCCS and not lint */ + +/* + * PACKAGE: hashing + * + * DESCRIPTION: + * Page manipulation for hashing package. + * + * ROUTINES: + * + * External + * __get_page + * __add_ovflpage + * Internal + * overflow_page + * open_temp + */ +#ifndef macintosh +#include +#endif + +#if defined(macintosh) +#include +#endif + +#include +#include +#if defined(_WIN32) || defined(_WINDOWS) +#include +#endif +#include +#include +#include +#include + +#if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh) +#include +#endif + +#include + +#include "mcom_db.h" +#include "hash.h" +#include "page.h" +/* #include "extern.h" */ + +extern int mkstempflags(char *path, int extraFlags); + +static uint32 *fetch_bitmap __P((HTAB *, uint32)); +static uint32 first_free __P((uint32)); +static int open_temp __P((HTAB *)); +static uint16 overflow_page __P((HTAB *)); +static void squeeze_key __P((uint16 *, const DBT *, const DBT *)); +static int ugly_split + __P((HTAB *, uint32, BUFHEAD *, BUFHEAD *, int, int)); + +#define PAGE_INIT(P) { \ + ((uint16 *)(P))[0] = 0; \ + ((uint16 *)(P))[1] = hashp->BSIZE - 3 * sizeof(uint16); \ + ((uint16 *)(P))[2] = hashp->BSIZE; \ +} + +/* implement a new lseek using lseek that + * writes zero's when extending a file + * beyond the end. + */ +long new_lseek(int fd, long offset, int origin) +{ + long cur_pos=0; + long end_pos=0; + long seek_pos=0; + + if(origin == SEEK_CUR) + { + if(offset < 1) + return(lseek(fd, offset, SEEK_CUR)); + + cur_pos = lseek(fd, 0, SEEK_CUR); + + if(cur_pos < 0) + return(cur_pos); + } + + end_pos = lseek(fd, 0, SEEK_END); + if(end_pos < 0) + return(end_pos); + + if(origin == SEEK_SET) + seek_pos = offset; + else if(origin == SEEK_CUR) + seek_pos = cur_pos + offset; + else if(origin == SEEK_END) + seek_pos = end_pos + offset; + else + { + assert(0); + return(-1); + } + + /* the seek position desired is before the + * end of the file. We don't need + * to do anything special except the seek. + */ + if(seek_pos <= end_pos) + return(lseek(fd, seek_pos, SEEK_SET)); + + /* the seek position is beyond the end of the + * file. Write zero's to the end. + * + * we are already at the end of the file so + * we just need to "write()" zeros for the + * difference between seek_pos-end_pos and + * then seek to the position to finish + * the call + */ + { + char buffer[1024]; + long len = seek_pos-end_pos; + memset(&buffer, 0, 1024); + while(len > 0) + { + write(fd, (char*)&buffer, (size_t)(1024 > len ? len : 1024)); + len -= 1024; + } + return(lseek(fd, seek_pos, SEEK_SET)); + } + +} + +/* + * This is called AFTER we have verified that there is room on the page for + * the pair (PAIRFITS has returned true) so we go right ahead and start moving + * stuff on. + */ +static void +putpair(char *p, const DBT *key, DBT * val) +{ + register uint16 *bp, n, off; + + bp = (uint16 *)p; + + /* Enter the key first. */ + n = bp[0]; + + off = OFFSET(bp) - key->size; + memmove(p + off, key->data, key->size); + bp[++n] = off; + + /* Now the data. */ + off -= val->size; + memmove(p + off, val->data, val->size); + bp[++n] = off; + + /* Adjust page info. */ + bp[0] = n; + bp[n + 1] = off - ((n + 3) * sizeof(uint16)); + bp[n + 2] = off; +} + +/* + * Returns: + * 0 OK + * -1 error + */ +extern int +__delpair(HTAB *hashp, BUFHEAD *bufp, int ndx) +{ + register uint16 *bp, newoff; + register int n; + uint16 pairlen; + + bp = (uint16 *)bufp->page; + n = bp[0]; + + if (bp[ndx + 1] < REAL_KEY) + return (__big_delete(hashp, bufp)); + if (ndx != 1) + newoff = bp[ndx - 1]; + else + newoff = hashp->BSIZE; + pairlen = newoff - bp[ndx + 1]; + + if (ndx != (n - 1)) { + /* Hard Case -- need to shuffle keys */ + register int i; + register char *src = bufp->page + (int)OFFSET(bp); + uint32 dst_offset = (uint32)OFFSET(bp) + (uint32)pairlen; + register char *dst = bufp->page + dst_offset; + uint32 length = bp[ndx + 1] - OFFSET(bp); + + /* + * +-----------+XXX+---------+XXX+---------+---------> +infinity + * | | | | + * 0 src_offset dst_offset BSIZE + * + * Dst_offset is > src_offset, so if src_offset were bad, dst_offset + * would be too, therefore we check only dst_offset. + * + * If dst_offset is >= BSIZE, either OFFSET(bp), or pairlen, or both + * is corrupted. + * + * Once we know dst_offset is < BSIZE, we can subtract it from BSIZE + * to get an upper bound on length. + */ + if(dst_offset > (uint32)hashp->BSIZE) + return(DATABASE_CORRUPTED_ERROR); + + if(length > (uint32)(hashp->BSIZE - dst_offset)) + return(DATABASE_CORRUPTED_ERROR); + + memmove(dst, src, length); + + /* Now adjust the pointers */ + for (i = ndx + 2; i <= n; i += 2) { + if (bp[i + 1] == OVFLPAGE) { + bp[i - 2] = bp[i]; + bp[i - 1] = bp[i + 1]; + } else { + bp[i - 2] = bp[i] + pairlen; + bp[i - 1] = bp[i + 1] + pairlen; + } + } + } + /* Finally adjust the page data */ + bp[n] = OFFSET(bp) + pairlen; + bp[n - 1] = bp[n + 1] + pairlen + 2 * sizeof(uint16); + bp[0] = n - 2; + hashp->NKEYS--; + + bufp->flags |= BUF_MOD; + return (0); +} +/* + * Returns: + * 0 ==> OK + * -1 ==> Error + */ +extern int +__split_page(HTAB *hashp, uint32 obucket, uint32 nbucket) +{ + register BUFHEAD *new_bufp, *old_bufp; + register uint16 *ino; + register uint16 *tmp_uint16_array; + register char *np; + DBT key, val; + uint16 n, ndx; + int retval; + uint16 copyto, diff, moved; + size_t off; + char *op; + + copyto = (uint16)hashp->BSIZE; + off = (uint16)hashp->BSIZE; + old_bufp = __get_buf(hashp, obucket, NULL, 0); + if (old_bufp == NULL) + return (-1); + new_bufp = __get_buf(hashp, nbucket, NULL, 0); + if (new_bufp == NULL) + return (-1); + + old_bufp->flags |= (BUF_MOD | BUF_PIN); + new_bufp->flags |= (BUF_MOD | BUF_PIN); + + ino = (uint16 *)(op = old_bufp->page); + np = new_bufp->page; + + moved = 0; + + for (n = 1, ndx = 1; n < ino[0]; n += 2) { + if (ino[n + 1] < REAL_KEY) { + retval = ugly_split(hashp, obucket, old_bufp, new_bufp, + (int)copyto, (int)moved); + old_bufp->flags &= ~BUF_PIN; + new_bufp->flags &= ~BUF_PIN; + return (retval); + + } + key.data = (uint8 *)op + ino[n]; + + /* check here for ino[n] being greater than + * off. If it is then the database has + * been corrupted. + */ + if(ino[n] > off) + return(DATABASE_CORRUPTED_ERROR); + + key.size = off - ino[n]; + +#ifdef DEBUG + /* make sure the size is positive */ + assert(((int)key.size) > -1); +#endif + + if (__call_hash(hashp, (char *)key.data, key.size) == obucket) { + /* Don't switch page */ + diff = copyto - off; + if (diff) { + copyto = ino[n + 1] + diff; + memmove(op + copyto, op + ino[n + 1], + off - ino[n + 1]); + ino[ndx] = copyto + ino[n] - ino[n + 1]; + ino[ndx + 1] = copyto; + } else + copyto = ino[n + 1]; + ndx += 2; + } else { + /* Switch page */ + val.data = (uint8 *)op + ino[n + 1]; + val.size = ino[n] - ino[n + 1]; + + /* if the pair doesn't fit something is horribly + * wrong. LJM + */ + tmp_uint16_array = (uint16*)np; + if(!PAIRFITS(tmp_uint16_array, &key, &val)) + return(DATABASE_CORRUPTED_ERROR); + + putpair(np, &key, &val); + moved += 2; + } + + off = ino[n + 1]; + } + + /* Now clean up the page */ + ino[0] -= moved; + FREESPACE(ino) = copyto - sizeof(uint16) * (ino[0] + 3); + OFFSET(ino) = copyto; + +#ifdef DEBUG3 + (void)fprintf(stderr, "split %d/%d\n", + ((uint16 *)np)[0] / 2, + ((uint16 *)op)[0] / 2); +#endif + /* unpin both pages */ + old_bufp->flags &= ~BUF_PIN; + new_bufp->flags &= ~BUF_PIN; + return (0); +} + +/* + * Called when we encounter an overflow or big key/data page during split + * handling. This is special cased since we have to begin checking whether + * the key/data pairs fit on their respective pages and because we may need + * overflow pages for both the old and new pages. + * + * The first page might be a page with regular key/data pairs in which case + * we have a regular overflow condition and just need to go on to the next + * page or it might be a big key/data pair in which case we need to fix the + * big key/data pair. + * + * Returns: + * 0 ==> success + * -1 ==> failure + */ + +/* the maximum number of loops we will allow UGLY split to chew + * on before we assume the database is corrupted and throw it + * away. + */ +#define MAX_UGLY_SPLIT_LOOPS 10000 + +static int +ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp, + BUFHEAD *new_bufp,/* Same as __split_page. */ int copyto, int moved) + /* int copyto; First byte on page which contains key/data values. */ + /* int moved; Number of pairs moved to new page. */ +{ + register BUFHEAD *bufp; /* Buffer header for ino */ + register uint16 *ino; /* Page keys come off of */ + register uint16 *np; /* New page */ + register uint16 *op; /* Page keys go on to if they aren't moving */ + uint32 loop_detection=0; + + BUFHEAD *last_bfp; /* Last buf header OVFL needing to be freed */ + DBT key, val; + SPLIT_RETURN ret; + uint16 n, off, ov_addr, scopyto; + char *cino; /* Character value of ino */ + int status; + + bufp = old_bufp; + ino = (uint16 *)old_bufp->page; + np = (uint16 *)new_bufp->page; + op = (uint16 *)old_bufp->page; + last_bfp = NULL; + scopyto = (uint16)copyto; /* ANSI */ + + n = ino[0] - 1; + while (n < ino[0]) { + + + /* this function goes nuts sometimes and never returns. + * I havent found the problem yet but I need a solution + * so if we loop too often we assume a database curruption error + * :LJM + */ + loop_detection++; + + if(loop_detection > MAX_UGLY_SPLIT_LOOPS) + return DATABASE_CORRUPTED_ERROR; + + if (ino[2] < REAL_KEY && ino[2] != OVFLPAGE) { + if ((status = __big_split(hashp, old_bufp, + new_bufp, bufp, bufp->addr, obucket, &ret))) + return (status); + old_bufp = ret.oldp; + if (!old_bufp) + return (-1); + op = (uint16 *)old_bufp->page; + new_bufp = ret.newp; + if (!new_bufp) + return (-1); + np = (uint16 *)new_bufp->page; + bufp = ret.nextp; + if (!bufp) + return (0); + cino = (char *)bufp->page; + ino = (uint16 *)cino; + last_bfp = ret.nextp; + } else if (ino[n + 1] == OVFLPAGE) { + ov_addr = ino[n]; + /* + * Fix up the old page -- the extra 2 are the fields + * which contained the overflow information. + */ + ino[0] -= (moved + 2); + FREESPACE(ino) = + scopyto - sizeof(uint16) * (ino[0] + 3); + OFFSET(ino) = scopyto; + + bufp = __get_buf(hashp, ov_addr, bufp, 0); + if (!bufp) + return (-1); + + ino = (uint16 *)bufp->page; + n = 1; + scopyto = hashp->BSIZE; + moved = 0; + + if (last_bfp) + __free_ovflpage(hashp, last_bfp); + last_bfp = bufp; + } + /* Move regular sized pairs of there are any */ + off = hashp->BSIZE; + for (n = 1; (n < ino[0]) && (ino[n + 1] >= REAL_KEY); n += 2) { + cino = (char *)ino; + key.data = (uint8 *)cino + ino[n]; + key.size = off - ino[n]; + val.data = (uint8 *)cino + ino[n + 1]; + val.size = ino[n] - ino[n + 1]; + off = ino[n + 1]; + + if (__call_hash(hashp, (char*)key.data, key.size) == obucket) { + /* Keep on old page */ + if (PAIRFITS(op, (&key), (&val))) + putpair((char *)op, &key, &val); + else { + old_bufp = + __add_ovflpage(hashp, old_bufp); + if (!old_bufp) + return (-1); + op = (uint16 *)old_bufp->page; + putpair((char *)op, &key, &val); + } + old_bufp->flags |= BUF_MOD; + } else { + /* Move to new page */ + if (PAIRFITS(np, (&key), (&val))) + putpair((char *)np, &key, &val); + else { + new_bufp = + __add_ovflpage(hashp, new_bufp); + if (!new_bufp) + return (-1); + np = (uint16 *)new_bufp->page; + putpair((char *)np, &key, &val); + } + new_bufp->flags |= BUF_MOD; + } + } + } + if (last_bfp) + __free_ovflpage(hashp, last_bfp); + return (0); +} + +/* + * Add the given pair to the page + * + * Returns: + * 0 ==> OK + * 1 ==> failure + */ +extern int +__addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT * val) +{ + register uint16 *bp, *sop; + int do_expand; + + bp = (uint16 *)bufp->page; + do_expand = 0; + while (bp[0] && (bp[2] < REAL_KEY || bp[bp[0]] < REAL_KEY)) + /* Exception case */ + if (bp[2] == FULL_KEY_DATA && bp[0] == 2) + /* This is the last page of a big key/data pair + and we need to add another page */ + break; + else if (bp[2] < REAL_KEY && bp[bp[0]] != OVFLPAGE) { + bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0); + if (!bufp) + { +#ifdef DEBUG + assert(0); +#endif + return (-1); + } + bp = (uint16 *)bufp->page; + } else + /* Try to squeeze key on this page */ + if (FREESPACE(bp) > PAIRSIZE(key, val)) { + { + squeeze_key(bp, key, val); + + /* LJM: I added this because I think it was + * left out on accident. + * if this isn't incremented nkeys will not + * be the actual number of keys in the db. + */ + hashp->NKEYS++; + return (0); + } + } else { + bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0); + if (!bufp) + { +#ifdef DEBUG + assert(0); +#endif + return (-1); + } + bp = (uint16 *)bufp->page; + } + + if (PAIRFITS(bp, key, val)) + putpair(bufp->page, key, (DBT *)val); + else { + do_expand = 1; + bufp = __add_ovflpage(hashp, bufp); + if (!bufp) + { +#ifdef DEBUG + assert(0); +#endif + return (-1); + } + sop = (uint16 *)bufp->page; + + if (PAIRFITS(sop, key, val)) + putpair((char *)sop, key, (DBT *)val); + else + if (__big_insert(hashp, bufp, key, val)) + { +#ifdef DEBUG + assert(0); +#endif + return (-1); + } + } + bufp->flags |= BUF_MOD; + /* + * If the average number of keys per bucket exceeds the fill factor, + * expand the table. + */ + hashp->NKEYS++; + if (do_expand || + (hashp->NKEYS / (hashp->MAX_BUCKET + 1) > hashp->FFACTOR)) + return (__expand_table(hashp)); + return (0); +} + +/* + * + * Returns: + * pointer on success + * NULL on error + */ +extern BUFHEAD * +__add_ovflpage(HTAB *hashp, BUFHEAD *bufp) +{ + register uint16 *sp; + uint16 ndx, ovfl_num; +#ifdef DEBUG1 + int tmp1, tmp2; +#endif + sp = (uint16 *)bufp->page; + + /* Check if we are dynamically determining the fill factor */ + if (hashp->FFACTOR == DEF_FFACTOR) { + hashp->FFACTOR = sp[0] >> 1; + if (hashp->FFACTOR < MIN_FFACTOR) + hashp->FFACTOR = MIN_FFACTOR; + } + bufp->flags |= BUF_MOD; + ovfl_num = overflow_page(hashp); +#ifdef DEBUG1 + tmp1 = bufp->addr; + tmp2 = bufp->ovfl ? bufp->ovfl->addr : 0; +#endif + if (!ovfl_num || !(bufp->ovfl = __get_buf(hashp, ovfl_num, bufp, 1))) + return (NULL); + bufp->ovfl->flags |= BUF_MOD; +#ifdef DEBUG1 + (void)fprintf(stderr, "ADDOVFLPAGE: %d->ovfl was %d is now %d\n", + tmp1, tmp2, bufp->ovfl->addr); +#endif + ndx = sp[0]; + /* + * Since a pair is allocated on a page only if there's room to add + * an overflow page, we know that the OVFL information will fit on + * the page. + */ + sp[ndx + 4] = OFFSET(sp); + sp[ndx + 3] = FREESPACE(sp) - OVFLSIZE; + sp[ndx + 1] = ovfl_num; + sp[ndx + 2] = OVFLPAGE; + sp[0] = ndx + 2; +#ifdef HASH_STATISTICS + hash_overflows++; +#endif + return (bufp->ovfl); +} + +/* + * Returns: + * 0 indicates SUCCESS + * -1 indicates FAILURE + */ +extern int +__get_page(HTAB *hashp, + char * p, + uint32 bucket, + int is_bucket, + int is_disk, + int is_bitmap) +{ + register int fd, page; + size_t size; + int rsize; + uint16 *bp; + + fd = hashp->fp; + size = hashp->BSIZE; + + if ((fd == -1) || !is_disk) { + PAGE_INIT(p); + return (0); + } + if (is_bucket) + page = BUCKET_TO_PAGE(bucket); + else + page = OADDR_TO_PAGE(bucket); + if ((MY_LSEEK(fd, (off_t)page << hashp->BSHIFT, SEEK_SET) == -1) || + ((rsize = read(fd, p, size)) == -1)) + return (-1); + + bp = (uint16 *)p; + if (!rsize) + bp[0] = 0; /* We hit the EOF, so initialize a new page */ + else + if ((unsigned)rsize != size) { + errno = EFTYPE; + return (-1); + } + + if (!is_bitmap && !bp[0]) { + PAGE_INIT(p); + } else { + +#ifdef DEBUG + if(BYTE_ORDER == LITTLE_ENDIAN) + { + int is_little_endian; + is_little_endian = BYTE_ORDER; + } + else if(BYTE_ORDER == BIG_ENDIAN) + { + int is_big_endian; + is_big_endian = BYTE_ORDER; + } + else + { + assert(0); + } +#endif + + if (hashp->LORDER != BYTE_ORDER) { + register int i, max; + + if (is_bitmap) { + max = hashp->BSIZE >> 2; /* divide by 4 */ + for (i = 0; i < max; i++) + M_32_SWAP(((int *)p)[i]); + } else { + M_16_SWAP(bp[0]); + max = bp[0] + 2; + + /* bound the size of max by + * the maximum number of entries + * in the array + */ + if((unsigned)max > (size / sizeof(uint16))) + return(DATABASE_CORRUPTED_ERROR); + + /* do the byte order swap + */ + for (i = 1; i <= max; i++) + M_16_SWAP(bp[i]); + } + } + + /* check the validity of the page here + * (after doing byte order swaping if necessary) + */ + if(!is_bitmap && bp[0] != 0) + { + uint16 num_keys = bp[0]; + uint16 offset; + uint16 i; + + /* bp[0] is supposed to be the number of + * entries currently in the page. If + * bp[0] is too large (larger than the whole + * page) then the page is corrupted + */ + if(bp[0] > (size / sizeof(uint16))) + return(DATABASE_CORRUPTED_ERROR); + + /* bound free space */ + if(FREESPACE(bp) > size) + return(DATABASE_CORRUPTED_ERROR); + + /* check each key and data offset to make + * sure they are all within bounds they + * should all be less than the previous + * offset as well. + */ + offset = size; + for(i=1 ; i <= num_keys; i+=2) + { + /* ignore overflow pages etc. */ + if(bp[i+1] >= REAL_KEY) + { + + if(bp[i] > offset || bp[i+1] > bp[i]) + return(DATABASE_CORRUPTED_ERROR); + + offset = bp[i+1]; + } + else + { + /* there are no other valid keys after + * seeing a non REAL_KEY + */ + break; + } + } + } + } + return (0); +} + +/* + * Write page p to disk + * + * Returns: + * 0 ==> OK + * -1 ==>failure + */ +extern int +__put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap) +{ + register int fd, page; + size_t size; + int wsize; + off_t offset; + + size = hashp->BSIZE; + if ((hashp->fp == -1) && open_temp(hashp)) + return (-1); + fd = hashp->fp; + + if (hashp->LORDER != BYTE_ORDER) { + register int i; + register int max; + + if (is_bitmap) { + max = hashp->BSIZE >> 2; /* divide by 4 */ + for (i = 0; i < max; i++) + M_32_SWAP(((int *)p)[i]); + } else { + max = ((uint16 *)p)[0] + 2; + + /* bound the size of max by + * the maximum number of entries + * in the array + */ + if((unsigned)max > (size / sizeof(uint16))) + return(DATABASE_CORRUPTED_ERROR); + + for (i = 0; i <= max; i++) + M_16_SWAP(((uint16 *)p)[i]); + + } + } + + if (is_bucket) + page = BUCKET_TO_PAGE(bucket); + else + page = OADDR_TO_PAGE(bucket); + offset = (off_t)page << hashp->BSHIFT; + if ((MY_LSEEK(fd, offset, SEEK_SET) == -1) || + ((wsize = write(fd, p, size)) == -1)) + /* Errno is set */ + return (-1); + if ((unsigned)wsize != size) { + errno = EFTYPE; + return (-1); + } +#if defined(_WIN32) || defined(_WINDOWS) + if (offset + size > hashp->file_size) { + hashp->updateEOF = 1; + } +#endif + /* put the page back the way it was so that it isn't byteswapped + * if it remains in memory - LJM + */ + if (hashp->LORDER != BYTE_ORDER) { + register int i; + register int max; + + if (is_bitmap) { + max = hashp->BSIZE >> 2; /* divide by 4 */ + for (i = 0; i < max; i++) + M_32_SWAP(((int *)p)[i]); + } else { + uint16 *bp = (uint16 *)p; + + M_16_SWAP(bp[0]); + max = bp[0] + 2; + + /* no need to bound the size if max again + * since it was done already above + */ + + /* do the byte order re-swap + */ + for (i = 1; i <= max; i++) + M_16_SWAP(bp[i]); + } + } + + return (0); +} + +#define BYTE_MASK ((1 << INT_BYTE_SHIFT) -1) +/* + * Initialize a new bitmap page. Bitmap pages are left in memory + * once they are read in. + */ +extern int +__ibitmap(HTAB *hashp, int pnum, int nbits, int ndx) +{ + uint32 *ip; + size_t clearbytes, clearints; + + if ((ip = (uint32 *)malloc((size_t)hashp->BSIZE)) == NULL) + return (1); + hashp->nmaps++; + clearints = ((nbits - 1) >> INT_BYTE_SHIFT) + 1; + clearbytes = clearints << INT_TO_BYTE; + (void)memset((char *)ip, 0, clearbytes); + (void)memset(((char *)ip) + clearbytes, 0xFF, + hashp->BSIZE - clearbytes); + ip[clearints - 1] = ALL_SET << (nbits & BYTE_MASK); + SETBIT(ip, 0); + hashp->BITMAPS[ndx] = (uint16)pnum; + hashp->mapp[ndx] = ip; + return (0); +} + +static uint32 +first_free(uint32 map) +{ + register uint32 i, mask; + + mask = 0x1; + for (i = 0; i < BITS_PER_MAP; i++) { + if (!(mask & map)) + return (i); + mask = mask << 1; + } + return (i); +} + +static uint16 +overflow_page(HTAB *hashp) +{ + register uint32 *freep=NULL; + register int max_free, offset, splitnum; + uint16 addr; + uint32 i; + int bit, first_page, free_bit, free_page, in_use_bits, j; +#ifdef DEBUG2 + int tmp1, tmp2; +#endif + splitnum = hashp->OVFL_POINT; + max_free = hashp->SPARES[splitnum]; + + free_page = (max_free - 1) >> (hashp->BSHIFT + BYTE_SHIFT); + free_bit = (max_free - 1) & ((hashp->BSIZE << BYTE_SHIFT) - 1); + + /* Look through all the free maps to find the first free block */ + first_page = hashp->LAST_FREED >>(hashp->BSHIFT + BYTE_SHIFT); + for ( i = first_page; i <= (unsigned)free_page; i++ ) { + if (!(freep = (uint32 *)hashp->mapp[i]) && + !(freep = fetch_bitmap(hashp, i))) + return (0); + if (i == (unsigned)free_page) + in_use_bits = free_bit; + else + in_use_bits = (hashp->BSIZE << BYTE_SHIFT) - 1; + + if (i == (unsigned)first_page) { + bit = hashp->LAST_FREED & + ((hashp->BSIZE << BYTE_SHIFT) - 1); + j = bit / BITS_PER_MAP; + bit = bit & ~(BITS_PER_MAP - 1); + } else { + bit = 0; + j = 0; + } + for (; bit <= in_use_bits; j++, bit += BITS_PER_MAP) + if (freep[j] != ALL_SET) + goto found; + } + + /* No Free Page Found */ + hashp->LAST_FREED = hashp->SPARES[splitnum]; + hashp->SPARES[splitnum]++; + offset = hashp->SPARES[splitnum] - + (splitnum ? hashp->SPARES[splitnum - 1] : 0); + +#define OVMSG "HASH: Out of overflow pages. Increase page size\n" + if (offset > SPLITMASK) { + if (++splitnum >= NCACHED) { +#ifndef macintosh + (void)write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1); +#endif + return (0); + } + hashp->OVFL_POINT = splitnum; + hashp->SPARES[splitnum] = hashp->SPARES[splitnum-1]; + hashp->SPARES[splitnum-1]--; + offset = 1; + } + + /* Check if we need to allocate a new bitmap page */ + if (free_bit == (hashp->BSIZE << BYTE_SHIFT) - 1) { + free_page++; + if (free_page >= NCACHED) { +#ifndef macintosh + (void)write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1); +#endif + return (0); + } + /* + * This is tricky. The 1 indicates that you want the new page + * allocated with 1 clear bit. Actually, you are going to + * allocate 2 pages from this map. The first is going to be + * the map page, the second is the overflow page we were + * looking for. The init_bitmap routine automatically, sets + * the first bit of itself to indicate that the bitmap itself + * is in use. We would explicitly set the second bit, but + * don't have to if we tell init_bitmap not to leave it clear + * in the first place. + */ + if (__ibitmap(hashp, + (int)OADDR_OF(splitnum, offset), 1, free_page)) + return (0); + hashp->SPARES[splitnum]++; +#ifdef DEBUG2 + free_bit = 2; +#endif + offset++; + if (offset > SPLITMASK) { + if (++splitnum >= NCACHED) { +#ifndef macintosh + (void)write(STDERR_FILENO, OVMSG, + sizeof(OVMSG) - 1); +#endif + return (0); + } + hashp->OVFL_POINT = splitnum; + hashp->SPARES[splitnum] = hashp->SPARES[splitnum-1]; + hashp->SPARES[splitnum-1]--; + offset = 0; + } + } else { + /* + * Free_bit addresses the last used bit. Bump it to address + * the first available bit. + */ + free_bit++; + SETBIT(freep, free_bit); + } + + /* Calculate address of the new overflow page */ + addr = OADDR_OF(splitnum, offset); +#ifdef DEBUG2 + (void)fprintf(stderr, "OVERFLOW_PAGE: ADDR: %d BIT: %d PAGE %d\n", + addr, free_bit, free_page); +#endif + return (addr); + +found: + bit = bit + first_free(freep[j]); + SETBIT(freep, bit); +#ifdef DEBUG2 + tmp1 = bit; + tmp2 = i; +#endif + /* + * Bits are addressed starting with 0, but overflow pages are addressed + * beginning at 1. Bit is a bit addressnumber, so we need to increment + * it to convert it to a page number. + */ + bit = 1 + bit + (i * (hashp->BSIZE << BYTE_SHIFT)); + if (bit >= hashp->LAST_FREED) + hashp->LAST_FREED = bit - 1; + + /* Calculate the split number for this page */ + for (i = 0; (i < (unsigned)splitnum) && (bit > hashp->SPARES[i]); i++) {} + offset = (i ? bit - hashp->SPARES[i - 1] : bit); + if (offset >= SPLITMASK) + return (0); /* Out of overflow pages */ + addr = OADDR_OF(i, offset); +#ifdef DEBUG2 + (void)fprintf(stderr, "OVERFLOW_PAGE: ADDR: %d BIT: %d PAGE %d\n", + addr, tmp1, tmp2); +#endif + + /* Allocate and return the overflow page */ + return (addr); +} + +/* + * Mark this overflow page as free. + */ +extern void +__free_ovflpage(HTAB *hashp, BUFHEAD *obufp) +{ + uint16 addr; + uint32 *freep; + uint32 bit_address, free_page, free_bit; + uint16 ndx; + + if(!obufp || !obufp->addr) + return; + + addr = obufp->addr; +#ifdef DEBUG1 + (void)fprintf(stderr, "Freeing %d\n", addr); +#endif + ndx = (((uint16)addr) >> SPLITSHIFT); + bit_address = + (ndx ? hashp->SPARES[ndx - 1] : 0) + (addr & SPLITMASK) - 1; + if (bit_address < (uint32)hashp->LAST_FREED) + hashp->LAST_FREED = bit_address; + free_page = (bit_address >> (hashp->BSHIFT + BYTE_SHIFT)); + free_bit = bit_address & ((hashp->BSIZE << BYTE_SHIFT) - 1); + + if (!(freep = hashp->mapp[free_page])) + freep = fetch_bitmap(hashp, free_page); + +#ifdef DEBUG + /* + * This had better never happen. It means we tried to read a bitmap + * that has already had overflow pages allocated off it, and we + * failed to read it from the file. + */ + if (!freep) + { + assert(0); + return; + } +#endif + CLRBIT(freep, free_bit); +#ifdef DEBUG2 + (void)fprintf(stderr, "FREE_OVFLPAGE: ADDR: %d BIT: %d PAGE %d\n", + obufp->addr, free_bit, free_page); +#endif + __reclaim_buf(hashp, obufp); +} + +/* + * Returns: + * 0 success + * -1 failure + */ +static int +open_temp(HTAB *hashp) +{ +#ifdef XP_OS2 + hashp->fp = mkstemp(NULL); +#else +#if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh) + sigset_t set, oset; +#endif +#if !defined(macintosh) + char * tmpdir; + size_t len; + char last; +#endif + static const char namestr[] = "/_hashXXXXXX"; + char filename[1024]; + +#if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh) + /* Block signals; make sure file goes away at process exit. */ + (void)sigfillset(&set); + (void)sigprocmask(SIG_BLOCK, &set, &oset); +#endif + + filename[0] = 0; +#if defined(macintosh) + strcat(filename, namestr + 1); +#else + tmpdir = getenv("TMP"); + if (!tmpdir) + tmpdir = getenv("TMPDIR"); + if (!tmpdir) + tmpdir = getenv("TEMP"); + if (!tmpdir) + tmpdir = "."; + len = strlen(tmpdir); + if (len && len < (sizeof filename - sizeof namestr)) { + strcpy(filename, tmpdir); + } + len = strlen(filename); + last = tmpdir[len - 1]; + strcat(filename, (last == '/' || last == '\\') ? namestr + 1 : namestr); +#endif + +#if defined(_WIN32) || defined(_WINDOWS) + if ((hashp->fp = mkstempflags(filename, _O_BINARY|_O_TEMPORARY)) != -1) { + if (hashp->filename) { + free(hashp->filename); + } + hashp->filename = strdup(filename); + hashp->is_temp = 1; + } +#else + if ((hashp->fp = mkstemp(filename)) != -1) { + (void)unlink(filename); +#if !defined(macintosh) + (void)fcntl(hashp->fp, F_SETFD, 1); +#endif + } +#endif + +#if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh) + (void)sigprocmask(SIG_SETMASK, &oset, (sigset_t *)NULL); +#endif +#endif /* !OS2 */ + return (hashp->fp != -1 ? 0 : -1); +} + +/* + * We have to know that the key will fit, but the last entry on the page is + * an overflow pair, so we need to shift things. + */ +static void +squeeze_key(uint16 *sp, const DBT * key, const DBT * val) +{ + register char *p; + uint16 free_space, n, off, pageno; + + p = (char *)sp; + n = sp[0]; + free_space = FREESPACE(sp); + off = OFFSET(sp); + + pageno = sp[n - 1]; + off -= key->size; + sp[n - 1] = off; + memmove(p + off, key->data, key->size); + off -= val->size; + sp[n] = off; + memmove(p + off, val->data, val->size); + sp[0] = n + 2; + sp[n + 1] = pageno; + sp[n + 2] = OVFLPAGE; + FREESPACE(sp) = free_space - PAIRSIZE(key, val); + OFFSET(sp) = off; +} + +static uint32 * +fetch_bitmap(HTAB *hashp, uint32 ndx) +{ + if (ndx >= (unsigned)hashp->nmaps) + return (NULL); + if ((hashp->mapp[ndx] = (uint32 *)malloc((size_t)hashp->BSIZE)) == NULL) + return (NULL); + if (__get_page(hashp, + (char *)hashp->mapp[ndx], hashp->BITMAPS[ndx], 0, 1, 1)) { + free(hashp->mapp[ndx]); + hashp->mapp[ndx] = NULL; /* NEW: 9-11-95 */ + return (NULL); + } + return (hashp->mapp[ndx]); +} + +#ifdef DEBUG4 +int +print_chain(int addr) +{ + BUFHEAD *bufp; + short *bp, oaddr; + + (void)fprintf(stderr, "%d ", addr); + bufp = __get_buf(hashp, addr, NULL, 0); + bp = (short *)bufp->page; + while (bp[0] && ((bp[bp[0]] == OVFLPAGE) || + ((bp[0] > 2) && bp[2] < REAL_KEY))) { + oaddr = bp[bp[0] - 1]; + (void)fprintf(stderr, "%d ", (int)oaddr); + bufp = __get_buf(hashp, (int)oaddr, bufp, 0); + bp = (short *)bufp->page; + } + (void)fprintf(stderr, "\n"); +} +#endif diff --git a/mozilla/dbm/src/hash.c b/mozilla/dbm/src/hash.c new file mode 100644 index 0000000..c7b1d18 --- /dev/null +++ b/mozilla/dbm/src/hash.c @@ -0,0 +1,1175 @@ +/*- + * Copyright (c) 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Margo Seltzer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)hash.c 8.9 (Berkeley) 6/16/94"; +#endif /* LIBC_SCCS and not lint */ + +#if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh) +#include +#endif + +#if !defined(macintosh) +#ifdef XP_OS2 +#include +#endif +#include +#endif + +#if defined(macintosh) +#include +#include +#endif + +#include +#include +#include +#include +#include + +#if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh) +#include +#endif +#if defined(_WIN32) || defined(_WINDOWS) +#include +#endif + +#include + +#include "mcom_db.h" +#include "hash.h" +#include "page.h" + +/* +#include "extern.h" +*/ +static int alloc_segs __P((HTAB *, int)); +static int flush_meta __P((HTAB *)); +static int hash_access __P((HTAB *, ACTION, DBT *, DBT *)); +static int hash_close __P((DB *)); +static int hash_delete __P((const DB *, const DBT *, uint)); +static int hash_fd __P((const DB *)); +static int hash_get __P((const DB *, const DBT *, DBT *, uint)); +static int hash_put __P((const DB *, DBT *, const DBT *, uint)); +static void *hash_realloc __P((SEGMENT **, size_t, size_t)); +static int hash_seq __P((const DB *, DBT *, DBT *, uint)); +static int hash_sync __P((const DB *, uint)); +static int hdestroy __P((HTAB *)); +static HTAB *init_hash __P((HTAB *, const char *, HASHINFO *)); +static int init_htab __P((HTAB *, int)); +#if BYTE_ORDER == LITTLE_ENDIAN +static void swap_header __P((HTAB *)); +static void swap_header_copy __P((HASHHDR *, HASHHDR *)); +#endif + +/* Fast arithmetic, relying on powers of 2, */ +#define MOD(x, y) ((x) & ((y) - 1)) + +#define RETURN_ERROR(ERR, LOC) { save_errno = ERR; goto LOC; } + +/* Return values */ +#define SUCCESS (0) +#define DBM_ERROR (-1) +#define ABNORMAL (1) + +#ifdef HASH_STATISTICS +int hash_accesses, hash_collisions, hash_expansions, hash_overflows; +#endif + +/* A new Lou (montulli@mozilla.com) routine. + * + * The database is screwed. + * + * This closes the file, flushing buffers as appropriate. + */ +static void +__remove_database(DB *dbp) +{ + HTAB *hashp = (HTAB *)dbp->internal; + + assert(0); + + if (!hashp) + return; + hdestroy(hashp); + dbp->internal = NULL; +} + +/************************** INTERFACE ROUTINES ***************************/ +/* OPEN/CLOSE */ + + +extern DB * +__hash_open(const char *file, int flags, int mode, const HASHINFO *info, int dflags) +{ + HTAB *hashp=NULL; + struct stat statbuf; + DB *dbp; + int bpages, hdrsize, new_table, nsegs, save_errno; + + if ((flags & O_ACCMODE) == O_WRONLY) { + errno = EINVAL; + return NULL; + } + + /* zero the statbuffer so that + * we can check it for a non-zero + * date to see if stat succeeded + */ + memset(&statbuf, 0, sizeof(struct stat)); + + if (!(hashp = (HTAB *)calloc(1, sizeof(HTAB)))) { + errno = ENOMEM; + return NULL; + } + hashp->fp = NO_FILE; + if(file) + hashp->filename = strdup(file); + + /* + * Even if user wants write only, we need to be able to read + * the actual file, so we need to open it read/write. But, the + * field in the hashp structure needs to be accurate so that + * we can check accesses. + */ + hashp->flags = flags; + + new_table = 0; + if (!file || (flags & O_TRUNC) || (stat(file, &statbuf) && (errno == ENOENT))) + { + if (errno == ENOENT) + errno = 0; /* Just in case someone looks at errno */ + new_table = 1; + } + else if(statbuf.st_mtime && statbuf.st_size == 0) + { + /* check for a zero length file and delete it + * if it exists + */ + new_table = 1; + } + hashp->file_size = statbuf.st_size; + + if (file) { +#if defined(_WIN32) || defined(_WINDOWS) || defined (macintosh) || defined(XP_OS2) + if ((hashp->fp = DBFILE_OPEN(file, flags | O_BINARY, mode)) == -1) + RETURN_ERROR(errno, error1); +#else + if ((hashp->fp = open(file, flags, mode)) == -1) + RETURN_ERROR(errno, error1); + (void)fcntl(hashp->fp, F_SETFD, 1); +#endif + } + if (new_table) { + if (!init_hash(hashp, file, (HASHINFO *)info)) + RETURN_ERROR(errno, error1); + } else { + /* Table already exists */ + if (info && info->hash) + hashp->hash = info->hash; + else + hashp->hash = __default_hash; + + hdrsize = read(hashp->fp, (char *)&hashp->hdr, sizeof(HASHHDR)); + if (hdrsize == -1) + RETURN_ERROR(errno, error1); + if (hdrsize != sizeof(HASHHDR)) + RETURN_ERROR(EFTYPE, error1); +#if BYTE_ORDER == LITTLE_ENDIAN + swap_header(hashp); +#endif + /* Verify file type, versions and hash function */ + if (hashp->MAGIC != HASHMAGIC) + RETURN_ERROR(EFTYPE, error1); +#define OLDHASHVERSION 1 + if (hashp->VERSION != HASHVERSION && + hashp->VERSION != OLDHASHVERSION) + RETURN_ERROR(EFTYPE, error1); + if (hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY) + RETURN_ERROR(EFTYPE, error1); + if (hashp->NKEYS < 0) /* Old bad database. */ + RETURN_ERROR(EFTYPE, error1); + + /* + * Figure out how many segments we need. Max_Bucket is the + * maximum bucket number, so the number of buckets is + * max_bucket + 1. + */ + nsegs = (hashp->MAX_BUCKET + 1 + hashp->SGSIZE - 1) / + hashp->SGSIZE; + hashp->nsegs = 0; + if (alloc_segs(hashp, nsegs)) + /* If alloc_segs fails, errno will have been set. */ + RETURN_ERROR(errno, error1); + /* Read in bitmaps */ + bpages = (hashp->SPARES[hashp->OVFL_POINT] + + (hashp->BSIZE << BYTE_SHIFT) - 1) >> + (hashp->BSHIFT + BYTE_SHIFT); + + hashp->nmaps = bpages; + (void)memset(&hashp->mapp[0], 0, bpages * sizeof(uint32 *)); + } + + /* Initialize Buffer Manager */ + if (info && info->cachesize) + __buf_init(hashp, (int32) info->cachesize); + else + __buf_init(hashp, DEF_BUFSIZE); + + hashp->new_file = new_table; +#ifdef macintosh + hashp->save_file = file && !(hashp->flags & O_RDONLY); +#else + hashp->save_file = file && (hashp->flags & O_RDWR); +#endif + hashp->cbucket = -1; + if (!(dbp = (DB *)malloc(sizeof(DB)))) { + RETURN_ERROR(ENOMEM, error1); + } + dbp->internal = hashp; + dbp->close = hash_close; + dbp->del = hash_delete; + dbp->fd = hash_fd; + dbp->get = hash_get; + dbp->put = hash_put; + dbp->seq = hash_seq; + dbp->sync = hash_sync; + dbp->type = DB_HASH; + +#ifdef HASH_STATISTICS + hash_overflows = hash_accesses = hash_collisions = hash_expansions = 0; +#endif + return (dbp); + +error1: + hdestroy(hashp); + errno = save_errno; + return (NULL); +} + +static int +hash_close(DB *dbp) +{ + HTAB *hashp; + int retval; + + if (!dbp) + return (DBM_ERROR); + + hashp = (HTAB *)dbp->internal; + if(!hashp) + return (DBM_ERROR); + + retval = hdestroy(hashp); + free(dbp); + return (retval); +} + +static int hash_fd(const DB *dbp) +{ + HTAB *hashp; + + if (!dbp) + return (DBM_ERROR); + + hashp = (HTAB *)dbp->internal; + if(!hashp) + return (DBM_ERROR); + + if (hashp->fp == -1) { + errno = ENOENT; + return (-1); + } + return (hashp->fp); +} + +/************************** LOCAL CREATION ROUTINES **********************/ +static HTAB * +init_hash(HTAB *hashp, const char *file, HASHINFO *info) +{ + struct stat statbuf; + int nelem; + + nelem = 1; + hashp->NKEYS = 0; + hashp->LORDER = BYTE_ORDER; + hashp->BSIZE = DEF_BUCKET_SIZE; + hashp->BSHIFT = DEF_BUCKET_SHIFT; + hashp->SGSIZE = DEF_SEGSIZE; + hashp->SSHIFT = DEF_SEGSIZE_SHIFT; + hashp->DSIZE = DEF_DIRSIZE; + hashp->FFACTOR = DEF_FFACTOR; + hashp->hash = __default_hash; + memset(hashp->SPARES, 0, sizeof(hashp->SPARES)); + memset(hashp->BITMAPS, 0, sizeof (hashp->BITMAPS)); + + /* Fix bucket size to be optimal for file system */ + if (file != NULL) { + if (stat(file, &statbuf)) + return (NULL); + +#if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh) && !defined(XP_OS2) +#if defined(__QNX__) && !defined(__QNXNTO__) + hashp->BSIZE = 512; /* preferred blk size on qnx4 */ +#else + hashp->BSIZE = statbuf.st_blksize; +#endif + + /* new code added by Lou to reduce block + * size down below MAX_BSIZE + */ + if (hashp->BSIZE > MAX_BSIZE) + hashp->BSIZE = MAX_BSIZE; +#endif + hashp->BSHIFT = __log2((uint32)hashp->BSIZE); + } + + if (info) { + if (info->bsize) { + /* Round pagesize up to power of 2 */ + hashp->BSHIFT = __log2(info->bsize); + hashp->BSIZE = 1 << hashp->BSHIFT; + if (hashp->BSIZE > MAX_BSIZE) { + errno = EINVAL; + return (NULL); + } + } + if (info->ffactor) + hashp->FFACTOR = info->ffactor; + if (info->hash) + hashp->hash = info->hash; + if (info->nelem) + nelem = info->nelem; + if (info->lorder) { + if (info->lorder != BIG_ENDIAN && + info->lorder != LITTLE_ENDIAN) { + errno = EINVAL; + return (NULL); + } + hashp->LORDER = info->lorder; + } + } + /* init_htab sets errno if it fails */ + if (init_htab(hashp, nelem)) + return (NULL); + else + return (hashp); +} +/* + * This calls alloc_segs which may run out of memory. Alloc_segs will + * set errno, so we just pass the error information along. + * + * Returns 0 on No Error + */ +static int +init_htab(HTAB *hashp, int nelem) +{ + register int nbuckets, nsegs; + int l2; + + /* + * Divide number of elements by the fill factor and determine a + * desired number of buckets. Allocate space for the next greater + * power of two number of buckets. + */ + nelem = (nelem - 1) / hashp->FFACTOR + 1; + + l2 = __log2((uint32)PR_MAX(nelem, 2)); + nbuckets = 1 << l2; + + hashp->SPARES[l2] = l2 + 1; + hashp->SPARES[l2 + 1] = l2 + 1; + hashp->OVFL_POINT = l2; + hashp->LAST_FREED = 2; + + /* First bitmap page is at: splitpoint l2 page offset 1 */ + if (__ibitmap(hashp, (int)OADDR_OF(l2, 1), l2 + 1, 0)) + return (-1); + + hashp->MAX_BUCKET = hashp->LOW_MASK = nbuckets - 1; + hashp->HIGH_MASK = (nbuckets << 1) - 1; + hashp->HDRPAGES = ((PR_MAX(sizeof(HASHHDR), MINHDRSIZE) - 1) >> + hashp->BSHIFT) + 1; + + nsegs = (nbuckets - 1) / hashp->SGSIZE + 1; + nsegs = 1 << __log2((uint32)nsegs); + + if (nsegs > hashp->DSIZE) + hashp->DSIZE = nsegs; + return (alloc_segs(hashp, nsegs)); +} + +/********************** DESTROY/CLOSE ROUTINES ************************/ + +/* + * Flushes any changes to the file if necessary and destroys the hashp + * structure, freeing all allocated space. + */ +static int +hdestroy(HTAB *hashp) +{ + int i, save_errno; + + save_errno = 0; + +#ifdef HASH_STATISTICS + (void)fprintf(stderr, "hdestroy: accesses %ld collisions %ld\n", + hash_accesses, hash_collisions); + (void)fprintf(stderr, "hdestroy: expansions %ld\n", + hash_expansions); + (void)fprintf(stderr, "hdestroy: overflows %ld\n", + hash_overflows); + (void)fprintf(stderr, "keys %ld maxp %d segmentcount %d\n", + hashp->NKEYS, hashp->MAX_BUCKET, hashp->nsegs); + + for (i = 0; i < NCACHED; i++) + (void)fprintf(stderr, + "spares[%d] = %d\n", i, hashp->SPARES[i]); +#endif + /* + * Call on buffer manager to free buffers, and if required, + * write them to disk. + */ + if (__buf_free(hashp, 1, hashp->save_file)) + save_errno = errno; + if (hashp->dir) { + free(*hashp->dir); /* Free initial segments */ + /* Free extra segments */ + while (hashp->exsegs--) + free(hashp->dir[--hashp->nsegs]); + free(hashp->dir); + } + if (flush_meta(hashp) && !save_errno) + save_errno = errno; + /* Free Bigmaps */ + for (i = 0; i < hashp->nmaps; i++) + if (hashp->mapp[i]) + free(hashp->mapp[i]); + + if (hashp->fp != -1) + (void)close(hashp->fp); + + if(hashp->filename) { +#if defined(_WIN32) || defined(_WINDOWS) || defined(XP_OS2) + if (hashp->is_temp) + (void)unlink(hashp->filename); +#endif + free(hashp->filename); + } + if (hashp->tmp_buf) + free(hashp->tmp_buf); + if (hashp->tmp_key) + free(hashp->tmp_key); + free(hashp); + if (save_errno) { + errno = save_errno; + return (DBM_ERROR); + } + return (SUCCESS); +} + +#if defined(_WIN32) || defined(_WINDOWS) +/* + * Close and reopen file to force file length update on windows. + * + * Returns: + * 0 == OK + * -1 DBM_ERROR + */ +static int +update_EOF(HTAB *hashp) +{ +#if defined(DBM_REOPEN_ON_FLUSH) + char * file = hashp->filename; + off_t file_size; + int flags; + int mode = -1; + struct stat statbuf; + + memset(&statbuf, 0, sizeof statbuf); + + /* make sure we won't lose the file by closing it. */ + if (!file || (stat(file, &statbuf) && (errno == ENOENT))) { + /* pretend we did it. */ + return 0; + } + + (void)close(hashp->fp); + + flags = hashp->flags & ~(O_TRUNC | O_CREAT | O_EXCL); + + if ((hashp->fp = DBFILE_OPEN(file, flags | O_BINARY, mode)) == -1) + return -1; + file_size = lseek(hashp->fp, (off_t)0, SEEK_END); + if (file_size == -1) + return -1; + hashp->file_size = file_size; + return 0; +#else + int fd = hashp->fp; + off_t file_size = lseek(fd, (off_t)0, SEEK_END); + HANDLE handle = (HANDLE)_get_osfhandle(fd); + BOOL cool = FlushFileBuffers(handle); +#ifdef DEBUG3 + if (!cool) { + DWORD err = GetLastError(); + (void)fprintf(stderr, + "FlushFileBuffers failed, last error = %d, 0x%08x\n", + err, err); + } +#endif + if (file_size == -1) + return -1; + hashp->file_size = file_size; + return cool ? 0 : -1; +#endif +} +#endif + +/* + * Write modified pages to disk + * + * Returns: + * 0 == OK + * -1 DBM_ERROR + */ +static int +hash_sync(const DB *dbp, uint flags) +{ + HTAB *hashp; + + if (flags != 0) { + errno = EINVAL; + return (DBM_ERROR); + } + + if (!dbp) + return (DBM_ERROR); + + hashp = (HTAB *)dbp->internal; + if(!hashp) + return (DBM_ERROR); + + if (!hashp->save_file) + return (0); + if (__buf_free(hashp, 0, 1) || flush_meta(hashp)) + return (DBM_ERROR); +#if defined(_WIN32) || defined(_WINDOWS) + if (hashp->updateEOF && hashp->filename && !hashp->is_temp) { + int status = update_EOF(hashp); + hashp->updateEOF = 0; + if (status) + return status; + } +#endif + hashp->new_file = 0; + return (0); +} + +/* + * Returns: + * 0 == OK + * -1 indicates that errno should be set + */ +static int +flush_meta(HTAB *hashp) +{ + HASHHDR *whdrp; +#if BYTE_ORDER == LITTLE_ENDIAN + HASHHDR whdr; +#endif + int fp, i, wsize; + + if (!hashp->save_file) + return (0); + hashp->MAGIC = HASHMAGIC; + hashp->VERSION = HASHVERSION; + hashp->H_CHARKEY = hashp->hash(CHARKEY, sizeof(CHARKEY)); + + fp = hashp->fp; + whdrp = &hashp->hdr; +#if BYTE_ORDER == LITTLE_ENDIAN + whdrp = &whdr; + swap_header_copy(&hashp->hdr, whdrp); +#endif + if ((lseek(fp, (off_t)0, SEEK_SET) == -1) || + ((wsize = write(fp, (char*)whdrp, sizeof(HASHHDR))) == -1)) + return (-1); + else + if (wsize != sizeof(HASHHDR)) { + errno = EFTYPE; + hashp->dbmerrno = errno; + return (-1); + } + for (i = 0; i < NCACHED; i++) + if (hashp->mapp[i]) + if (__put_page(hashp, (char *)hashp->mapp[i], + hashp->BITMAPS[i], 0, 1)) + return (-1); + return (0); +} + +/*******************************SEARCH ROUTINES *****************************/ +/* + * All the access routines return + * + * Returns: + * 0 on SUCCESS + * 1 to indicate an external DBM_ERROR (i.e. key not found, etc) + * -1 to indicate an internal DBM_ERROR (i.e. out of memory, etc) + */ +static int +hash_get( + const DB *dbp, + const DBT *key, + DBT *data, + uint flag) +{ + HTAB *hashp; + int rv; + + hashp = (HTAB *)dbp->internal; + if (!hashp) + return (DBM_ERROR); + + if (flag) { + hashp->dbmerrno = errno = EINVAL; + return (DBM_ERROR); + } + + rv = hash_access(hashp, HASH_GET, (DBT *)key, data); + + if(rv == DATABASE_CORRUPTED_ERROR) + { +#if defined(unix) && defined(DEBUG) + printf("\n\nDBM Database has been corrupted, tell Lou...\n\n"); +#endif + __remove_database((DB *)dbp); + } + + return(rv); +} + +static int +hash_put( + const DB *dbp, + DBT *key, + const DBT *data, + uint flag) +{ + HTAB *hashp; + int rv; + + hashp = (HTAB *)dbp->internal; + if (!hashp) + return (DBM_ERROR); + + if (flag && flag != R_NOOVERWRITE) { + hashp->dbmerrno = errno = EINVAL; + return (DBM_ERROR); + } + if ((hashp->flags & O_ACCMODE) == O_RDONLY) { + hashp->dbmerrno = errno = EPERM; + return (DBM_ERROR); + } + + rv = hash_access(hashp, flag == R_NOOVERWRITE ? + HASH_PUTNEW : HASH_PUT, (DBT *)key, (DBT *)data); + + if(rv == DATABASE_CORRUPTED_ERROR) + { +#if defined(unix) && defined(DEBUG) + printf("\n\nDBM Database has been corrupted, tell Lou...\n\n"); +#endif + __remove_database((DB *)dbp); + } + + return(rv); +} + +static int +hash_delete( + const DB *dbp, + const DBT *key, + uint flag) /* Ignored */ +{ + HTAB *hashp; + int rv; + + hashp = (HTAB *)dbp->internal; + if (!hashp) + return (DBM_ERROR); + + if (flag && flag != R_CURSOR) { + hashp->dbmerrno = errno = EINVAL; + return (DBM_ERROR); + } + if ((hashp->flags & O_ACCMODE) == O_RDONLY) { + hashp->dbmerrno = errno = EPERM; + return (DBM_ERROR); + } + rv = hash_access(hashp, HASH_DELETE, (DBT *)key, NULL); + + if(rv == DATABASE_CORRUPTED_ERROR) + { +#if defined(unix) && defined(DEBUG) + printf("\n\nDBM Database has been corrupted, tell Lou...\n\n"); +#endif + __remove_database((DB *)dbp); + } + + return(rv); +} + +#define MAX_OVERFLOW_HASH_ACCESS_LOOPS 2000 +/* + * Assume that hashp has been set in wrapper routine. + */ +static int +hash_access( + HTAB *hashp, + ACTION action, + DBT *key, DBT *val) +{ + register BUFHEAD *rbufp; + BUFHEAD *bufp, *save_bufp; + register uint16 *bp; + register long n, ndx, off; + register size_t size; + register char *kp; + uint16 pageno; + uint32 ovfl_loop_count=0; + int32 last_overflow_page_no = -1; + +#ifdef HASH_STATISTICS + hash_accesses++; +#endif + + off = hashp->BSIZE; + size = key->size; + kp = (char *)key->data; + rbufp = __get_buf(hashp, __call_hash(hashp, kp, size), NULL, 0); + if (!rbufp) + return (DATABASE_CORRUPTED_ERROR); + save_bufp = rbufp; + + /* Pin the bucket chain */ + rbufp->flags |= BUF_PIN; + for (bp = (uint16 *)rbufp->page, n = *bp++, ndx = 1; ndx < n;) + { + + if (bp[1] >= REAL_KEY) { + /* Real key/data pair */ + if (size == (unsigned long)(off - *bp) && + memcmp(kp, rbufp->page + *bp, size) == 0) + goto found; + off = bp[1]; +#ifdef HASH_STATISTICS + hash_collisions++; +#endif + bp += 2; + ndx += 2; + } else if (bp[1] == OVFLPAGE) { + + /* database corruption: overflow loop detection */ + if(last_overflow_page_no == (int32)*bp) + return (DATABASE_CORRUPTED_ERROR); + + last_overflow_page_no = *bp; + + rbufp = __get_buf(hashp, *bp, rbufp, 0); + if (!rbufp) { + save_bufp->flags &= ~BUF_PIN; + return (DBM_ERROR); + } + + ovfl_loop_count++; + if(ovfl_loop_count > MAX_OVERFLOW_HASH_ACCESS_LOOPS) + return (DATABASE_CORRUPTED_ERROR); + + /* FOR LOOP INIT */ + bp = (uint16 *)rbufp->page; + n = *bp++; + ndx = 1; + off = hashp->BSIZE; + } else if (bp[1] < REAL_KEY) { + if ((ndx = + __find_bigpair(hashp, rbufp, ndx, kp, (int)size)) > 0) + goto found; + if (ndx == -2) { + bufp = rbufp; + if (!(pageno = + __find_last_page(hashp, &bufp))) { + ndx = 0; + rbufp = bufp; + break; /* FOR */ + } + rbufp = __get_buf(hashp, pageno, bufp, 0); + if (!rbufp) { + save_bufp->flags &= ~BUF_PIN; + return (DBM_ERROR); + } + /* FOR LOOP INIT */ + bp = (uint16 *)rbufp->page; + n = *bp++; + ndx = 1; + off = hashp->BSIZE; + } else { + save_bufp->flags &= ~BUF_PIN; + return (DBM_ERROR); + + } + } + } + + /* Not found */ + switch (action) { + case HASH_PUT: + case HASH_PUTNEW: + if (__addel(hashp, rbufp, key, val)) { + save_bufp->flags &= ~BUF_PIN; + return (DBM_ERROR); + } else { + save_bufp->flags &= ~BUF_PIN; + return (SUCCESS); + } + case HASH_GET: + case HASH_DELETE: + default: + save_bufp->flags &= ~BUF_PIN; + return (ABNORMAL); + } + +found: + switch (action) { + case HASH_PUTNEW: + save_bufp->flags &= ~BUF_PIN; + return (ABNORMAL); + case HASH_GET: + bp = (uint16 *)rbufp->page; + if (bp[ndx + 1] < REAL_KEY) { + if (__big_return(hashp, rbufp, ndx, val, 0)) + return (DBM_ERROR); + } else { + val->data = (uint8 *)rbufp->page + (int)bp[ndx + 1]; + val->size = bp[ndx] - bp[ndx + 1]; + } + break; + case HASH_PUT: + if ((__delpair(hashp, rbufp, ndx)) || + (__addel(hashp, rbufp, key, val))) { + save_bufp->flags &= ~BUF_PIN; + return (DBM_ERROR); + } + break; + case HASH_DELETE: + if (__delpair(hashp, rbufp, ndx)) + return (DBM_ERROR); + break; + default: + abort(); + } + save_bufp->flags &= ~BUF_PIN; + return (SUCCESS); +} + +static int +hash_seq( + const DB *dbp, + DBT *key, DBT *data, + uint flag) +{ + register uint32 bucket; + register BUFHEAD *bufp; + HTAB *hashp; + uint16 *bp, ndx; + + hashp = (HTAB *)dbp->internal; + if (!hashp) + return (DBM_ERROR); + + if (flag && flag != R_FIRST && flag != R_NEXT) { + hashp->dbmerrno = errno = EINVAL; + return (DBM_ERROR); + } +#ifdef HASH_STATISTICS + hash_accesses++; +#endif + if ((hashp->cbucket < 0) || (flag == R_FIRST)) { + hashp->cbucket = 0; + hashp->cndx = 1; + hashp->cpage = NULL; + } + + for (bp = NULL; !bp || !bp[0]; ) { + if (!(bufp = hashp->cpage)) { + for (bucket = hashp->cbucket; + bucket <= (uint32)hashp->MAX_BUCKET; + bucket++, hashp->cndx = 1) { + bufp = __get_buf(hashp, bucket, NULL, 0); + if (!bufp) + return (DBM_ERROR); + hashp->cpage = bufp; + bp = (uint16 *)bufp->page; + if (bp[0]) + break; + } + hashp->cbucket = bucket; + if (hashp->cbucket > hashp->MAX_BUCKET) { + hashp->cbucket = -1; + return (ABNORMAL); + } + } else + bp = (uint16 *)hashp->cpage->page; + +#ifdef DEBUG + assert(bp); + assert(bufp); +#endif + while (bp[hashp->cndx + 1] == OVFLPAGE) { + bufp = hashp->cpage = + __get_buf(hashp, bp[hashp->cndx], bufp, 0); + if (!bufp) + return (DBM_ERROR); + bp = (uint16 *)(bufp->page); + hashp->cndx = 1; + } + if (!bp[0]) { + hashp->cpage = NULL; + ++hashp->cbucket; + } + } + ndx = hashp->cndx; + if (bp[ndx + 1] < REAL_KEY) { + if (__big_keydata(hashp, bufp, key, data, 1)) + return (DBM_ERROR); + } else { + key->data = (uint8 *)hashp->cpage->page + bp[ndx]; + key->size = (ndx > 1 ? bp[ndx - 1] : hashp->BSIZE) - bp[ndx]; + data->data = (uint8 *)hashp->cpage->page + bp[ndx + 1]; + data->size = bp[ndx] - bp[ndx + 1]; + ndx += 2; + if (ndx > bp[0]) { + hashp->cpage = NULL; + hashp->cbucket++; + hashp->cndx = 1; + } else + hashp->cndx = ndx; + } + return (SUCCESS); +} + +/********************************* UTILITIES ************************/ + +/* + * Returns: + * 0 ==> OK + * -1 ==> Error + */ +extern int +__expand_table(HTAB *hashp) +{ + uint32 old_bucket, new_bucket; + int new_segnum, spare_ndx; + size_t dirsize; + +#ifdef HASH_STATISTICS + hash_expansions++; +#endif + new_bucket = ++hashp->MAX_BUCKET; + old_bucket = (hashp->MAX_BUCKET & hashp->LOW_MASK); + + new_segnum = new_bucket >> hashp->SSHIFT; + + /* Check if we need a new segment */ + if (new_segnum >= hashp->nsegs) { + /* Check if we need to expand directory */ + if (new_segnum >= hashp->DSIZE) { + /* Reallocate directory */ + dirsize = hashp->DSIZE * sizeof(SEGMENT *); + if (!hash_realloc(&hashp->dir, dirsize, dirsize << 1)) + return (-1); + hashp->DSIZE = dirsize << 1; + } + if ((hashp->dir[new_segnum] = + (SEGMENT)calloc((size_t)hashp->SGSIZE, sizeof(SEGMENT))) == NULL) + return (-1); + hashp->exsegs++; + hashp->nsegs++; + } + /* + * If the split point is increasing (MAX_BUCKET's log base 2 + * * increases), we need to copy the current contents of the spare + * split bucket to the next bucket. + */ + spare_ndx = __log2((uint32)(hashp->MAX_BUCKET + 1)); + if (spare_ndx > hashp->OVFL_POINT) { + hashp->SPARES[spare_ndx] = hashp->SPARES[hashp->OVFL_POINT]; + hashp->OVFL_POINT = spare_ndx; + } + + if (new_bucket > (uint32)hashp->HIGH_MASK) { + /* Starting a new doubling */ + hashp->LOW_MASK = hashp->HIGH_MASK; + hashp->HIGH_MASK = new_bucket | hashp->LOW_MASK; + } + /* Relocate records to the new bucket */ + return (__split_page(hashp, old_bucket, new_bucket)); +} + +/* + * If realloc guarantees that the pointer is not destroyed if the realloc + * fails, then this routine can go away. + */ +static void * +hash_realloc( + SEGMENT **p_ptr, + size_t oldsize, size_t newsize) +{ + register void *p; + + if ((p = malloc(newsize))) { + memmove(p, *p_ptr, oldsize); + memset((char *)p + oldsize, 0, newsize - oldsize); + free(*p_ptr); + *p_ptr = (SEGMENT *)p; + } + return (p); +} + +extern uint32 +__call_hash(HTAB *hashp, char *k, size_t len) +{ + uint32 n, bucket; + + n = hashp->hash(k, len); + bucket = n & hashp->HIGH_MASK; + if (bucket > (uint32)hashp->MAX_BUCKET) + bucket = bucket & hashp->LOW_MASK; + return (bucket); +} + +/* + * Allocate segment table. On error, set errno. + * + * Returns 0 on success + */ +static int +alloc_segs( + HTAB *hashp, + int nsegs) +{ + register int i; + register SEGMENT store; + + if ((hashp->dir = + (SEGMENT *)calloc((size_t)hashp->DSIZE, sizeof(SEGMENT *))) == NULL) { + errno = ENOMEM; + return (-1); + } + /* Allocate segments */ + if ((store = + (SEGMENT)calloc((size_t)nsegs << hashp->SSHIFT, sizeof(SEGMENT))) == NULL) { + errno = ENOMEM; + return (-1); + } + for (i = 0; i < nsegs; i++, hashp->nsegs++) + hashp->dir[i] = &store[i << hashp->SSHIFT]; + return (0); +} + +#if BYTE_ORDER == LITTLE_ENDIAN +/* + * Hashp->hdr needs to be byteswapped. + */ +static void +swap_header_copy( + HASHHDR *srcp, HASHHDR *destp) +{ + int i; + + P_32_COPY(srcp->magic, destp->magic); + P_32_COPY(srcp->version, destp->version); + P_32_COPY(srcp->lorder, destp->lorder); + P_32_COPY(srcp->bsize, destp->bsize); + P_32_COPY(srcp->bshift, destp->bshift); + P_32_COPY(srcp->dsize, destp->dsize); + P_32_COPY(srcp->ssize, destp->ssize); + P_32_COPY(srcp->sshift, destp->sshift); + P_32_COPY(srcp->ovfl_point, destp->ovfl_point); + P_32_COPY(srcp->last_freed, destp->last_freed); + P_32_COPY(srcp->max_bucket, destp->max_bucket); + P_32_COPY(srcp->high_mask, destp->high_mask); + P_32_COPY(srcp->low_mask, destp->low_mask); + P_32_COPY(srcp->ffactor, destp->ffactor); + P_32_COPY(srcp->nkeys, destp->nkeys); + P_32_COPY(srcp->hdrpages, destp->hdrpages); + P_32_COPY(srcp->h_charkey, destp->h_charkey); + for (i = 0; i < NCACHED; i++) { + P_32_COPY(srcp->spares[i], destp->spares[i]); + P_16_COPY(srcp->bitmaps[i], destp->bitmaps[i]); + } +} + +static void +swap_header(HTAB *hashp) +{ + HASHHDR *hdrp; + int i; + + hdrp = &hashp->hdr; + + M_32_SWAP(hdrp->magic); + M_32_SWAP(hdrp->version); + M_32_SWAP(hdrp->lorder); + M_32_SWAP(hdrp->bsize); + M_32_SWAP(hdrp->bshift); + M_32_SWAP(hdrp->dsize); + M_32_SWAP(hdrp->ssize); + M_32_SWAP(hdrp->sshift); + M_32_SWAP(hdrp->ovfl_point); + M_32_SWAP(hdrp->last_freed); + M_32_SWAP(hdrp->max_bucket); + M_32_SWAP(hdrp->high_mask); + M_32_SWAP(hdrp->low_mask); + M_32_SWAP(hdrp->ffactor); + M_32_SWAP(hdrp->nkeys); + M_32_SWAP(hdrp->hdrpages); + M_32_SWAP(hdrp->h_charkey); + for (i = 0; i < NCACHED; i++) { + M_32_SWAP(hdrp->spares[i]); + M_16_SWAP(hdrp->bitmaps[i]); + } +} +#endif diff --git a/mozilla/dbm/src/hash_buf.c b/mozilla/dbm/src/hash_buf.c new file mode 100644 index 0000000..727164c --- /dev/null +++ b/mozilla/dbm/src/hash_buf.c @@ -0,0 +1,410 @@ +/*- + * Copyright (c) 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Margo Seltzer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)hash_buf.c 8.5 (Berkeley) 7/15/94"; +#endif /* LIBC_SCCS and not lint */ + +/* + * PACKAGE: hash + * + * DESCRIPTION: + * Contains buffer management + * + * ROUTINES: + * External + * __buf_init + * __get_buf + * __buf_free + * __reclaim_buf + * Internal + * newbuf + */ +#if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh) +#include +#endif + +#include +#include +#include +#include +#include + +#ifdef DEBUG +#include +#endif + +#include "mcom_db.h" +#include "hash.h" +#include "page.h" +/* #include "extern.h" */ + +static BUFHEAD *newbuf __P((HTAB *, uint32, BUFHEAD *)); + +/* Unlink B from its place in the lru */ +#define BUF_REMOVE(B) { \ + (B)->prev->next = (B)->next; \ + (B)->next->prev = (B)->prev; \ +} + +/* Insert B after P */ +#define BUF_INSERT(B, P) { \ + (B)->next = (P)->next; \ + (B)->prev = (P); \ + (P)->next = (B); \ + (B)->next->prev = (B); \ +} + +#define MRU hashp->bufhead.next +#define LRU hashp->bufhead.prev + +#define MRU_INSERT(B) BUF_INSERT((B), &hashp->bufhead) +#define LRU_INSERT(B) BUF_INSERT((B), LRU) + +/* + * We are looking for a buffer with address "addr". If prev_bp is NULL, then + * address is a bucket index. If prev_bp is not NULL, then it points to the + * page previous to an overflow page that we are trying to find. + * + * CAVEAT: The buffer header accessed via prev_bp's ovfl field may no longer + * be valid. Therefore, you must always verify that its address matches the + * address you are seeking. + */ +extern BUFHEAD * +__get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage) +/* If prev_bp set, indicates a new overflow page. */ +{ + register BUFHEAD *bp; + register uint32 is_disk_mask; + register int is_disk, segment_ndx = 0; + SEGMENT segp = 0; + + is_disk = 0; + is_disk_mask = 0; + if (prev_bp) { + bp = prev_bp->ovfl; + if (!bp || (bp->addr != addr)) + bp = NULL; + if (!newpage) + is_disk = BUF_DISK; + } else { + /* Grab buffer out of directory */ + segment_ndx = addr & (hashp->SGSIZE - 1); + + /* valid segment ensured by __call_hash() */ + segp = hashp->dir[addr >> hashp->SSHIFT]; +#ifdef DEBUG + assert(segp != NULL); +#endif + + bp = PTROF(segp[segment_ndx]); + + is_disk_mask = ISDISK(segp[segment_ndx]); + is_disk = is_disk_mask || !hashp->new_file; + } + + if (!bp) { + bp = newbuf(hashp, addr, prev_bp); + if (!bp) + return(NULL); + if(__get_page(hashp, bp->page, addr, !prev_bp, is_disk, 0)) + { + /* free bp and its page */ + if(prev_bp) + { + /* if prev_bp is set then the new page that + * failed is hooked onto prev_bp as an overflow page. + * if we don't remove the pointer to the bad page + * we may try and access it later and we will die + * horribly because it will have already been + * free'd and overwritten with bogus data. + */ + prev_bp->ovfl = NULL; + } + BUF_REMOVE(bp); + free(bp->page); + free(bp); + return (NULL); + } + + if (!prev_bp) + { +#if 0 + /* 16 bit windows and mac can't handle the + * oring of the is disk flag. + */ + segp[segment_ndx] = + (BUFHEAD *)((ptrdiff_t)bp | is_disk_mask); +#else + /* set the is_disk thing inside the structure + */ + bp->is_disk = is_disk_mask; + segp[segment_ndx] = bp; +#endif + } + } else { + BUF_REMOVE(bp); + MRU_INSERT(bp); + } + return (bp); +} + +/* + * We need a buffer for this page. Either allocate one, or evict a resident + * one (if we have as many buffers as we're allowed) and put this one in. + * + * If newbuf finds an error (returning NULL), it also sets errno. + */ +static BUFHEAD * +newbuf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp) +{ + register BUFHEAD *bp; /* The buffer we're going to use */ + register BUFHEAD *xbp; /* Temp pointer */ + register BUFHEAD *next_xbp; + SEGMENT segp; + int segment_ndx; + uint16 oaddr, *shortp; + + oaddr = 0; + bp = LRU; + /* + * If LRU buffer is pinned, the buffer pool is too small. We need to + * allocate more buffers. + */ + if (hashp->nbufs || (bp->flags & BUF_PIN)) { + /* Allocate a new one */ + if ((bp = (BUFHEAD *)malloc(sizeof(BUFHEAD))) == NULL) + return (NULL); + + /* this memset is supposedly unnecessary but lets add + * it anyways. + */ + memset(bp, 0xff, sizeof(BUFHEAD)); + + if ((bp->page = (char *)malloc((size_t)hashp->BSIZE)) == NULL) { + free(bp); + return (NULL); + } + + /* this memset is supposedly unnecessary but lets add + * it anyways. + */ + memset(bp->page, 0xff, (size_t)hashp->BSIZE); + + if (hashp->nbufs) + hashp->nbufs--; + } else { + /* Kick someone out */ + BUF_REMOVE(bp); + /* + * If this is an overflow page with addr 0, it's already been + * flushed back in an overflow chain and initialized. + */ + if ((bp->addr != 0) || (bp->flags & BUF_BUCKET)) { + /* + * Set oaddr before __put_page so that you get it + * before bytes are swapped. + */ + shortp = (uint16 *)bp->page; + if (shortp[0]) + { + if(shortp[0] > (hashp->BSIZE / sizeof(uint16))) + { + return(NULL); + } + oaddr = shortp[shortp[0] - 1]; + } + if ((bp->flags & BUF_MOD) && __put_page(hashp, bp->page, + bp->addr, (int)IS_BUCKET(bp->flags), 0)) + return (NULL); + /* + * Update the pointer to this page (i.e. invalidate it). + * + * If this is a new file (i.e. we created it at open + * time), make sure that we mark pages which have been + * written to disk so we retrieve them from disk later, + * rather than allocating new pages. + */ + if (IS_BUCKET(bp->flags)) { + segment_ndx = bp->addr & (hashp->SGSIZE - 1); + segp = hashp->dir[bp->addr >> hashp->SSHIFT]; +#ifdef DEBUG + assert(segp != NULL); +#endif + + if (hashp->new_file && + ((bp->flags & BUF_MOD) || + ISDISK(segp[segment_ndx]))) + segp[segment_ndx] = (BUFHEAD *)BUF_DISK; + else + segp[segment_ndx] = NULL; + } + /* + * Since overflow pages can only be access by means of + * their bucket, free overflow pages associated with + * this bucket. + */ + for (xbp = bp; xbp->ovfl;) { + next_xbp = xbp->ovfl; + xbp->ovfl = 0; + xbp = next_xbp; + + /* leave pinned pages alone, we are still using + * them. */ + if (xbp->flags & BUF_PIN) { + continue; + } + + /* Check that ovfl pointer is up date. */ + if (IS_BUCKET(xbp->flags) || + (oaddr != xbp->addr)) + break; + + shortp = (uint16 *)xbp->page; + if (shortp[0]) + { + /* LJM is the number of reported + * pages way too much? + */ + if(shortp[0] > hashp->BSIZE/sizeof(uint16)) + return NULL; + /* set before __put_page */ + oaddr = shortp[shortp[0] - 1]; + } + if ((xbp->flags & BUF_MOD) && __put_page(hashp, + xbp->page, xbp->addr, 0, 0)) + return (NULL); + xbp->addr = 0; + xbp->flags = 0; + BUF_REMOVE(xbp); + LRU_INSERT(xbp); + } + } + } + + /* Now assign this buffer */ + bp->addr = addr; +#ifdef DEBUG1 + (void)fprintf(stderr, "NEWBUF1: %d->ovfl was %d is now %d\n", + bp->addr, (bp->ovfl ? bp->ovfl->addr : 0), 0); +#endif + bp->ovfl = NULL; + if (prev_bp) { + /* + * If prev_bp is set, this is an overflow page, hook it in to + * the buffer overflow links. + */ +#ifdef DEBUG1 + (void)fprintf(stderr, "NEWBUF2: %d->ovfl was %d is now %d\n", + prev_bp->addr, (prev_bp->ovfl ? bp->ovfl->addr : 0), + (bp ? bp->addr : 0)); +#endif + prev_bp->ovfl = bp; + bp->flags = 0; + } else + bp->flags = BUF_BUCKET; + MRU_INSERT(bp); + return (bp); +} + +extern void __buf_init(HTAB *hashp, int32 nbytes) +{ + BUFHEAD *bfp; + int npages; + + bfp = &(hashp->bufhead); + npages = (nbytes + hashp->BSIZE - 1) >> hashp->BSHIFT; + npages = PR_MAX(npages, MIN_BUFFERS); + + hashp->nbufs = npages; + bfp->next = bfp; + bfp->prev = bfp; + /* + * This space is calloc'd so these are already null. + * + * bfp->ovfl = NULL; + * bfp->flags = 0; + * bfp->page = NULL; + * bfp->addr = 0; + */ +} + +extern int +__buf_free(HTAB *hashp, int do_free, int to_disk) +{ + BUFHEAD *bp; + int status = -1; + + /* Need to make sure that buffer manager has been initialized */ + if (!LRU) + return (0); + for (bp = LRU; bp != &hashp->bufhead;) { + /* Check that the buffer is valid */ + if (bp->addr || IS_BUCKET(bp->flags)) { + if (to_disk && (bp->flags & BUF_MOD) && + (status = __put_page(hashp, bp->page, + bp->addr, IS_BUCKET(bp->flags), 0))) { + + if (do_free) { + if (bp->page) + free(bp->page); + BUF_REMOVE(bp); + free(bp); + } + + return (status); + } + } + /* Check if we are freeing stuff */ + if (do_free) { + if (bp->page) + free(bp->page); + BUF_REMOVE(bp); + free(bp); + bp = LRU; + } else + bp = bp->prev; + } + return (0); +} + +extern void +__reclaim_buf(HTAB *hashp, BUFHEAD *bp) +{ + bp->ovfl = 0; + bp->addr = 0; + bp->flags = 0; + BUF_REMOVE(bp); + LRU_INSERT(bp); +} diff --git a/mozilla/dbm/src/memmove.c b/mozilla/dbm/src/memmove.c new file mode 100644 index 0000000..935ab46 --- /dev/null +++ b/mozilla/dbm/src/memmove.c @@ -0,0 +1,146 @@ +#if defined(__sun) && !defined(__SVR4) +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)bcopy.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +#ifdef HAVE_SYS_CDEFS_H +#include +#else +#include "cdefs.h" +#endif +#include + +/* + * sizeof(word) MUST BE A POWER OF TWO + * SO THAT wmask BELOW IS ALL ONES + */ +typedef int word; /* "word" used for optimal copy speed */ + +#define wsize sizeof(word) +#define wmask (wsize - 1) + +/* + * Copy a block of memory, handling overlap. + * This is the routine that actually implements + * (the portable versions of) bcopy, memcpy, and memmove. + */ +#ifdef MEMCOPY +void * +memcpy(dst0, src0, length) +#else +#ifdef MEMMOVE +void * +memmove(dst0, src0, length) +#else +void +bcopy(src0, dst0, length) +#endif +#endif + void *dst0; + const void *src0; + register size_t length; +{ + register char *dst = dst0; + register const char *src = src0; + register size_t t; + + if (length == 0 || dst == src) /* nothing to do */ + goto done; + + /* + * Macros: loop-t-times; and loop-t-times, t>0 + */ +#define TLOOP(s) if (t) TLOOP1(s) +#define TLOOP1(s) do { s; } while (--t) + + if ((unsigned long)dst < (unsigned long)src) { + /* + * Copy forward. + */ + t = (int)src; /* only need low bits */ + if ((t | (int)dst) & wmask) { + /* + * Try to align operands. This cannot be done + * unless the low bits match. + */ + if ((t ^ (int)dst) & wmask || length < wsize) + t = length; + else + t = wsize - (t & wmask); + length -= t; + TLOOP1(*dst++ = *src++); + } + /* + * Copy whole words, then mop up any trailing bytes. + */ + t = length / wsize; + TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize); + t = length & wmask; + TLOOP(*dst++ = *src++); + } else { + /* + * Copy backwards. Otherwise essentially the same. + * Alignment works as before, except that it takes + * (t&wmask) bytes to align, not wsize-(t&wmask). + */ + src += length; + dst += length; + t = (int)src; + if ((t | (int)dst) & wmask) { + if ((t ^ (int)dst) & wmask || length <= wsize) + t = length; + else + t &= wmask; + length -= t; + TLOOP1(*--dst = *--src); + } + t = length / wsize; + TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src); + t = length & wmask; + TLOOP(*--dst = *--src); + } +done: +#if defined(MEMCOPY) || defined(MEMMOVE) + return (dst0); +#else + return; +#endif +} +#endif /* no __sgi */ + +/* Some compilers don't like an empty source file. */ +static int dummy = 0; diff --git a/mozilla/dbm/src/mktemp.c b/mozilla/dbm/src/mktemp.c new file mode 100644 index 0000000..d93da9f --- /dev/null +++ b/mozilla/dbm/src/mktemp.c @@ -0,0 +1,160 @@ +/* + * Copyright (c) 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +#ifdef macintosh +#include +#else +#include +#include +#endif +#include +#include +#include +#include +#include "mcom_db.h" + +#ifndef _WINDOWS +#include +#endif + +#ifdef _WINDOWS +#include +#include "winfile.h" +#endif + +static int _gettemp(char *path, register int *doopen, int extraFlags); + +int +mkstemp(char *path) +{ +#ifdef XP_OS2 + FILE *temp = tmpfile(); + + return (temp ? fileno(temp) : -1); +#else + int fd; + + return (_gettemp(path, &fd, 0) ? fd : -1); +#endif +} + +int +mkstempflags(char *path, int extraFlags) +{ + int fd; + + return (_gettemp(path, &fd, extraFlags) ? fd : -1); +} + +#ifdef WINCE /* otherwise, use the one in libc */ +char * +mktemp(char *path) +{ + return(_gettemp(path, (int *)NULL, 0) ? path : (char *)NULL); +} +#endif + +/* NB: This routine modifies its input string, and does not always restore it. +** returns 1 on success, 0 on failure. +*/ +static int +_gettemp(char *path, register int *doopen, int extraFlags) +{ +#if !defined(_WINDOWS) || defined(_WIN32) + extern int errno; +#endif + register char *start, *trv; + struct stat sbuf; + unsigned int pid; + + pid = getpid(); + for (trv = path; *trv; ++trv); /* extra X's get set to 0's */ + while (*--trv == 'X') { + *trv = (pid % 10) + '0'; + pid /= 10; + } + + /* + * check the target directory; if you have six X's and it + * doesn't exist this runs for a *very* long time. + */ + for (start = trv + 1;; --trv) { + char saved; + if (trv <= path) + break; + saved = *trv; + if (saved == '/' || saved == '\\') { + int rv; + *trv = '\0'; + rv = stat(path, &sbuf); + *trv = saved; + if (rv) + return(0); + if (!S_ISDIR(sbuf.st_mode)) { + errno = ENOTDIR; + return(0); + } + break; + } + } + + for (;;) { + if (doopen) { + if ((*doopen = + open(path, O_CREAT|O_EXCL|O_RDWR|extraFlags, 0600)) >= 0) + return(1); + if (errno != EEXIST) + return(0); + } + else if (stat(path, &sbuf)) + return(errno == ENOENT ? 1 : 0); + + /* tricky little algorithm for backward compatibility */ + for (trv = start;;) { + if (!*trv) + return(0); + if (*trv == 'z') + *trv++ = 'a'; + else { + if (isdigit(*trv)) + *trv = 'a'; + else + ++*trv; + break; + } + } + } + /*NOTREACHED*/ +} diff --git a/mozilla/dbm/src/snprintf.c b/mozilla/dbm/src/snprintf.c new file mode 100644 index 0000000..96696d8 --- /dev/null +++ b/mozilla/dbm/src/snprintf.c @@ -0,0 +1,73 @@ +#ifndef HAVE_SNPRINTF + +#include +#include +#include + +#ifdef HAVE_SYS_CDEFS_H +#include +#else +#include "cdefs.h" +#endif + +#include "prtypes.h" + +#include + +#ifdef __STDC__ +#include +#else +#include +#endif + +int +#ifdef __STDC__ +snprintf(char *str, size_t n, const char *fmt, ...) +#else +snprintf(str, n, fmt, va_alist) + char *str; + size_t n; + const char *fmt; + va_dcl +#endif +{ + va_list ap; +#ifdef VSPRINTF_CHARSTAR + char *rp; +#else + int rval; +#endif +#ifdef __STDC__ + va_start(ap, fmt); +#else + va_start(ap); +#endif +#ifdef VSPRINTF_CHARSTAR + rp = vsprintf(str, fmt, ap); + va_end(ap); + return (strlen(rp)); +#else + rval = vsprintf(str, fmt, ap); + va_end(ap); + return (rval); +#endif +} + +int +vsnprintf(str, n, fmt, ap) + char *str; + size_t n; + const char *fmt; + va_list ap; +{ +#ifdef VSPRINTF_CHARSTAR + return (strlen(vsprintf(str, fmt, ap))); +#else + return (vsprintf(str, fmt, ap)); +#endif +} + +#endif /* HAVE_SNPRINTF */ + +/* Some compilers don't like an empty source file. */ +static int dummy = 0; diff --git a/mozilla/dbm/src/strerror.c b/mozilla/dbm/src/strerror.c new file mode 100644 index 0000000..83d16e7 --- /dev/null +++ b/mozilla/dbm/src/strerror.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. ***REMOVED*** - see + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)strerror.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +#include + +#ifdef _DLL +#define sys_nerr (*_sys_nerr_dll) +#endif + +#ifndef HAVE_STRERROR +#ifndef _AFXDLL +char * +strerror(num) + int num; +{ + extern int sys_nerr; + extern char *sys_errlist[]; +#define UPREFIX "Unknown error: " + static char ebuf[40] = UPREFIX; /* 64-bit number + slop */ + register unsigned int errnum; + register char *p, *t; + char tmp[40]; + + errnum = num; /* convert to unsigned */ + if (errnum < sys_nerr) + return(sys_errlist[errnum]); + + /* Do this by hand, so we don't include stdio(3). */ + t = tmp; + do { + *t++ = "0123456789"[errnum % 10]; + } while (errnum /= 10); + for (p = ebuf + sizeof(UPREFIX) - 1;;) { + *p++ = *--t; + if (t <= tmp) + break; + } + return(ebuf); +} + +#endif +#endif /* !HAVE_STRERROR */ diff --git a/mozilla/dbm/tests/.cvsignore b/mozilla/dbm/tests/.cvsignore new file mode 100644 index 0000000..a21fbfc --- /dev/null +++ b/mozilla/dbm/tests/.cvsignore @@ -0,0 +1,3 @@ +Makefile +lots +test.db diff --git a/mozilla/dbm/tests/Makefile.in b/mozilla/dbm/tests/Makefile.in new file mode 100644 index 0000000..ffb83f2 --- /dev/null +++ b/mozilla/dbm/tests/Makefile.in @@ -0,0 +1,62 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = dbm + +PACKAGE_FILE = dbmtest.pkg + +PROGRAM = lots$(BIN_SUFFIX) + +CSRCS = lots.c + +ifeq ($(OS_ARCH),WINNT) +EXTRA_DSO_LIBS = dbm$(MOZ_BITS) +else +EXTRA_DSO_LIBS = mozdbm_s +endif + +LIBS = $(EXTRA_DSO_LIBS) + +include $(topsrcdir)/config/rules.mk + diff --git a/mozilla/dbm/tests/dbmtest.pkg b/mozilla/dbm/tests/dbmtest.pkg new file mode 100644 index 0000000..abd564b --- /dev/null +++ b/mozilla/dbm/tests/dbmtest.pkg @@ -0,0 +1,2 @@ +[gecko-tests] +dist/bin/lots@BINS@ diff --git a/mozilla/dbm/tests/lots.c b/mozilla/dbm/tests/lots.c new file mode 100644 index 0000000..ea8bc6e --- /dev/null +++ b/mozilla/dbm/tests/lots.c @@ -0,0 +1,638 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* use sequental numbers printed to strings + * to store lots and lots of entries in the + * database. + * + * Start with 100 entries, put them and then + * read them out. Then delete the first + * half and verify that all of the first half + * is gone and then verify that the second + * half is still there. + * Then add the first half back and verify + * again. Then delete the middle third + * and verify again. + * Then increase the size by 1000 and do + * the whole add delete thing again. + * + * The data for each object is the number string translated + * to hex and replicated a random number of times. The + * number of times that the data is replicated is the first + * int32 in the data. + */ + +#include + +#include +#ifdef STDC_HEADERS +#include +#else +#include +#endif + +#ifdef HAVE_MEMORY_H +#include +#endif +#include +#include +#include "mcom_db.h" + +DB *database=0; +int MsgPriority=5; + +#if defined(_WINDOWS) && !defined(WIN32) +#define int32 long +#define uint32 unsigned long +#else +#define int32 int +#define uint32 unsigned int +#endif + +typedef enum { +USE_LARGE_KEY, +USE_SMALL_KEY +} key_type_enum; + +#define TraceMe(priority, msg) \ + do { \ + if(priority <= MsgPriority) \ + { \ + ReportStatus msg; \ + } \ + } while(0) + +int +ReportStatus(char *string, ...) +{ + va_list args; + +#ifdef STDC_HEADERS + va_start(args, string); +#else + va_start(args); +#endif + vfprintf(stderr, string, args); + va_end(args); + + fprintf (stderr, "\n"); + + return(0); +} + +int +ReportError(char *string, ...) +{ + va_list args; + +#ifdef STDC_HEADERS + va_start(args, string); +#else + va_start(args); +#endif + fprintf (stderr, "\n "); + vfprintf(stderr, string, args); + fprintf (stderr, "\n"); + va_end(args); + + return(0); +} + +DBT * MakeLargeKey(int32 num) +{ + int32 low_bits; + static DBT rv; + static char *string_rv=0; + int rep_char; + size_t size; + + if(string_rv) + free(string_rv); + + /* generate a really large text key derived from + * an int32 + */ + low_bits = (num % 10000) + 1; + + /* get the repeat char from the low 26 */ + rep_char = (char) ((low_bits % 26) + 'a'); + + /* malloc a string low_bits wide */ + size = low_bits*sizeof(char); + string_rv = (char *)malloc(size); + + memset(string_rv, rep_char, size); + + rv.data = string_rv; + rv.size = size; + + return(&rv); +} + +DBT * MakeSmallKey(int32 num) +{ + static DBT rv; + static char data_string[64]; + + rv.data = data_string; + + sprintf(data_string, "%ld", (long)num); + rv.size = strlen(data_string); + + return(&rv); + +} + +DBT * GenKey(int32 num, key_type_enum key_type) +{ + DBT *key; + + switch(key_type) + { + case USE_LARGE_KEY: + key = MakeLargeKey(num); + break; + case USE_SMALL_KEY: + key = MakeSmallKey(num); + break; + default: + abort(); + break; + } + + return(key); +} + +int +SeqDatabase() +{ + int status; + DBT key, data; + + ReportStatus("SEQuencing through database..."); + + /* seq through the whole database */ + if(!(status = (*database->seq)(database, &key, &data, R_FIRST))) + { + while(!(status = (database->seq) (database, &key, &data, R_NEXT))) + ; /* null body */ + } + + if(status < 0) + ReportError("Error seq'ing database"); + + return(status); +} + +int +VerifyData(DBT *data, int32 num, key_type_enum key_type) +{ + int32 count, compare_num; + size_t size; + int32 *int32_array; + + /* The first int32 is count + * The other n entries should + * all equal num + */ + if(data->size < sizeof(int32)) + { + ReportError("Data size corrupted"); + return -1; + } + + memcpy(&count, data->data, sizeof(int32)); + + size = sizeof(int32)*(count+1); + + if(size != data->size) + { + ReportError("Data size corrupted"); + return -1; + } + + int32_array = (int32*)data->data; + + for(;count > 0; count--) + { + memcpy(&compare_num, &int32_array[count], sizeof(int32)); + + if(compare_num != num) + { + ReportError("Data corrupted"); + return -1; + } + } + + return(0); +} + + +/* verify that a range of number strings exist + * or don't exist. And that the data is valid + */ +#define SHOULD_EXIST 1 +#define SHOULD_NOT_EXIST 0 +int +VerifyRange(int32 low, int32 high, int32 should_exist, key_type_enum key_type) +{ + DBT *key, data; + int32 num; + int status; + + TraceMe(1, ("Verifying: %ld to %ld, using %s keys", + low, high, key_type == USE_SMALL_KEY ? "SMALL" : "LARGE")); + + for(num = low; num <= high; num++) + { + + key = GenKey(num, key_type); + + status = (*database->get)(database, key, &data, 0); + + if(status == 0) + { + /* got the item */ + if(!should_exist) + { + ReportError("Item exists but shouldn't: %ld", num); + } + else + { + /* else verify the data */ + VerifyData(&data, num, key_type); + } + } + else if(status > 0) + { + /* item not found */ + if(should_exist) + { + ReportError("Item not found but should be: %ld", num); + } + } + else + { + /* database error */ + ReportError("Database error"); + return(-1); + } + + } + + TraceMe(1, ("Correctly verified: %ld to %ld", low, high)); + + return(0); + +} + +DBT * +GenData(int32 num) +{ + int32 n; + static DBT *data=0; + int32 *int32_array; + size_t size; + + if(!data) + { + data = (DBT*)malloc(sizeof(DBT)); + data->size = 0; + data->data = 0; + } + else if(data->data) + { + free(data->data); + } + + n = rand(); + + n = n % 512; /* bound to a 2K size */ + + + size = sizeof(int32)*(n+1); + int32_array = (int32 *) malloc(size); + + memcpy(&int32_array[0], &n, sizeof(int32)); + + for(; n > 0; n--) + { + memcpy(&int32_array[n], &num, sizeof(int32)); + } + + data->data = (void*)int32_array; + data->size = size; + + return(data); +} + +#define ADD_RANGE 1 +#define DELETE_RANGE 2 + +int +AddOrDelRange(int32 low, int32 high, int action, key_type_enum key_type) +{ + DBT *key, *data; +#if 0 /* only do this if your really analy checking the puts */ + DBT tmp_data; +#endif + int32 num; + int status; + + if(action != ADD_RANGE && action != DELETE_RANGE) + assert(0); + + if(action == ADD_RANGE) + { + TraceMe(1, ("Adding: %ld to %ld: %s keys", low, high, + key_type == USE_SMALL_KEY ? "SMALL" : "LARGE")); + } + else + { + TraceMe(1, ("Deleting: %ld to %ld: %s keys", low, high, + key_type == USE_SMALL_KEY ? "SMALL" : "LARGE")); + } + + for(num = low; num <= high; num++) + { + + key = GenKey(num, key_type); + + if(action == ADD_RANGE) + { + data = GenData(num); + status = (*database->put)(database, key, data, 0); + } + else + { + status = (*database->del)(database, key, 0); + } + + if(status < 0) + { + ReportError("Database error %s item: %ld", + action == ADD_RANGE ? "ADDING" : "DELETING", + num); + } + else if(status > 0) + { + ReportError("Could not %s item: %ld", + action == ADD_RANGE ? "ADD" : "DELETE", + num); + } + else if(action == ADD_RANGE) + { +#define SYNC_EVERY_TIME +#ifdef SYNC_EVERY_TIME + status = (*database->sync)(database, 0); + if(status != 0) + ReportError("Database error syncing after add"); +#endif + +#if 0 /* only do this if your really analy checking the puts */ + + /* make sure we can still get it + */ + status = (*database->get)(database, key, &tmp_data, 0); + + if(status != 0) + { + ReportError("Database error checking item just added: %d", + num); + } + else + { + /* now verify that none of the ones we already + * put in have disappeared + */ + VerifyRange(low, num, SHOULD_EXIST, key_type); + } +#endif + + } + } + + + if(action == ADD_RANGE) + { + TraceMe(1, ("Successfully added: %ld to %ld", low, high)); + } + else + { + TraceMe(1, ("Successfully deleted: %ld to %ld", low, high)); + } + + return(0); +} + +int +TestRange(int32 low, int32 range, key_type_enum key_type) +{ + int status; int32 low_of_range1, high_of_range1; int32 low_of_range2, high_of_range2; + int32 low_of_range3, high_of_range3; + + status = AddOrDelRange(low, low+range, ADD_RANGE, key_type); + status = VerifyRange(low, low+range, SHOULD_EXIST, key_type); + + TraceMe(1, ("Finished with sub test 1")); + + SeqDatabase(); + + low_of_range1 = low; + high_of_range1 = low+(range/2); + low_of_range2 = high_of_range1+1; + high_of_range2 = low+range; + status = AddOrDelRange(low_of_range1, high_of_range1, DELETE_RANGE, key_type); + status = VerifyRange(low_of_range1, high_of_range1, SHOULD_NOT_EXIST, key_type); + status = VerifyRange(low_of_range2, low_of_range2, SHOULD_EXIST, key_type); + + TraceMe(1, ("Finished with sub test 2")); + + SeqDatabase(); + + status = AddOrDelRange(low_of_range1, high_of_range1, ADD_RANGE, key_type); + /* the whole thing should exist now */ + status = VerifyRange(low, low+range, SHOULD_EXIST, key_type); + + TraceMe(1, ("Finished with sub test 3")); + + SeqDatabase(); + + status = AddOrDelRange(low_of_range2, high_of_range2, DELETE_RANGE, key_type); + status = VerifyRange(low_of_range1, high_of_range1, SHOULD_EXIST, key_type); + status = VerifyRange(low_of_range2, high_of_range2, SHOULD_NOT_EXIST, key_type); + + TraceMe(1, ("Finished with sub test 4")); + + SeqDatabase(); + + status = AddOrDelRange(low_of_range2, high_of_range2, ADD_RANGE, key_type); + /* the whole thing should exist now */ + status = VerifyRange(low, low+range, SHOULD_EXIST, key_type); + + TraceMe(1, ("Finished with sub test 5")); + + SeqDatabase(); + + low_of_range1 = low; + high_of_range1 = low+(range/3); + low_of_range2 = high_of_range1+1; + high_of_range2 = high_of_range1+(range/3); + low_of_range3 = high_of_range2+1; + high_of_range3 = low+range; + /* delete range 2 */ + status = AddOrDelRange(low_of_range2, high_of_range2, DELETE_RANGE, key_type); + status = VerifyRange(low_of_range1, high_of_range1, SHOULD_EXIST, key_type); + status = VerifyRange(low_of_range2, low_of_range2, SHOULD_NOT_EXIST, key_type); + status = VerifyRange(low_of_range3, low_of_range2, SHOULD_EXIST, key_type); + + TraceMe(1, ("Finished with sub test 6")); + + SeqDatabase(); + + status = AddOrDelRange(low_of_range2, high_of_range2, ADD_RANGE, key_type); + /* the whole thing should exist now */ + status = VerifyRange(low, low+range, SHOULD_EXIST, key_type); + + TraceMe(1, ("Finished with sub test 7")); + + return(0); +} + +#define START_RANGE 109876 +int +main(int argc, char **argv) +{ + int32 i, j=0; + int quick_exit = 0; + int large_keys = 0; + HASHINFO hash_info = { + 16*1024, + 0, + 0, + 0, + 0, + 0}; + + + if(argc > 1) + { + while(argc > 1) + { + if(!strcmp(argv[argc-1], "-quick")) + quick_exit = 1; + else if(!strcmp(argv[argc-1], "-large")) + { + large_keys = 1; + } + argc--; + } + } + + database = dbopen("test.db", O_RDWR | O_CREAT, 0644, DB_HASH, &hash_info); + + if(!database) + { + ReportError("Could not open database"); +#ifdef unix + perror(""); +#endif + exit(1); + } + + if(quick_exit) + { + if(large_keys) + TestRange(START_RANGE, 200, USE_LARGE_KEY); + else + TestRange(START_RANGE, 200, USE_SMALL_KEY); + + (*database->sync)(database, 0); + (*database->close)(database); + exit(0); + } + + for(i=100; i < 10000000; i+=200) + { + if(1 || j) + { + TestRange(START_RANGE, i, USE_LARGE_KEY); + j = 0; + } + else + { + TestRange(START_RANGE, i, USE_SMALL_KEY); + j = 1; + } + + if(1 == rand() % 3) + { + (*database->sync)(database, 0); + } + + if(1 == rand() % 3) + { + /* close and reopen */ + (*database->close)(database); + database = dbopen("test.db", O_RDWR | O_CREAT, 0644, DB_HASH, 0); + if(!database) + { + ReportError("Could not reopen database"); +#ifdef unix + perror(""); +#endif + exit(1); + } + } + else + { + /* reopen database without closeing the other */ + database = dbopen("test.db", O_RDWR | O_CREAT, 0644, DB_HASH, 0); + if(!database) + { + ReportError("Could not reopen database " + "after not closing the other"); +#ifdef unix + perror(""); +#endif + exit(1); + } + } + } + + return(0); +} diff --git a/mozilla/security/coreconf/AIX.mk b/mozilla/security/coreconf/AIX.mk new file mode 100644 index 0000000..255be17 --- /dev/null +++ b/mozilla/security/coreconf/AIX.mk @@ -0,0 +1,99 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# Config stuff for AIX. + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +# +# There are two implementation strategies available on AIX: +# pthreads, and pthreads-user. The default is pthreads. +# In both strategies, we need to use pthread_user.c, instead of +# aix.c. The fact that aix.c is never used is somewhat strange. +# +# So we need to do the following: +# - Default (PTHREADS_USER not defined in the environment or on +# the command line): +# Set PTHREADS_USER=1, USE_PTHREADS=1 +# - PTHREADS_USER=1 set in the environment or on the command line: +# Do nothing. +# +ifeq ($(PTHREADS_USER),1) + USE_PTHREADS = # just to be safe + IMPL_STRATEGY = _PTH_USER +else + USE_PTHREADS = 1 + PTHREADS_USER = 1 +endif + +DEFAULT_COMPILER = xlc_r + +CC = xlc_r +CCC = xlC_r + +CPU_ARCH = rs6000 + +RANLIB = ranlib + +OS_CFLAGS = -DAIX -DSYSV +OS_LIBS += -blibpath:/usr/lib:/lib -lc -lm + +DSO_LDOPTS = -brtl -bnortllib -bM:SRE -bnoentry +MKSHLIB = $(LD) $(DSO_LDOPTS) -blibpath:/usr/lib:/lib -lc -lm + +AIX_WRAP = $(DIST)/lib/aixwrap.o +AIX_TMP = $(OBJDIR)/_aix_tmp.o + +ifdef MAPFILE +DSO_LDOPTS += -bexport:$(MAPFILE) +else +DSO_LDOPTS += -bexpall +endif + +PROCESS_MAP_FILE = grep -v ';+' $< | grep -v ';-' | \ + sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' > $@ + +ifdef BUILD_OPT + OPTIMIZER += -qmaxmem=-1 +endif + +ifeq ($(USE_64), 1) + OS_CFLAGS += -DAIX_64BIT + OBJECT_MODE=64 + export OBJECT_MODE +endif + diff --git a/mozilla/security/coreconf/BSD_OS.mk b/mozilla/security/coreconf/BSD_OS.mk new file mode 100644 index 0000000..95cb706 --- /dev/null +++ b/mozilla/security/coreconf/BSD_OS.mk @@ -0,0 +1,89 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Kurt J. Lidl +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +DEFAULT_COMPILER = gcc +CC = gcc +CCC = g++ +RANLIB = ranlib + +ifeq ($(OS_TEST),i386) + OS_REL_CFLAGS = -D__i386__ + CPU_ARCH = x86 +else +ifeq ($(OS_TEST),ppc) + OS_REL_CFLAGS = -D__ppc__ + CPU_ARCH = ppc +else +ifeq ($(OS_TEST),sparc) + OS_REL_CFLAGS = -D__sparc__ + CPU_ARCH = sparc +else +# treat the ultrasparc like a regular sparc, at least for now! +ifeq ($(OS_TEST),sparc_v9) + OS_REL_CFLAGS = -D__sparc__ + CPU_ARCH = sparc +endif +endif +endif +endif + +DLL_SUFFIX = so + +OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wall -Wno-switch -DBSD_OS -DBSDI -Dunix -DHAVE_STRERROR -DHAVE_BSD_FLOCK + +ARCH = bsdos + +DSO_CFLAGS = -fPIC -DPIC +DSO_LDOPTS = -shared -Wl,-soname,lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX) + +ifdef LIBRUNPATH +DSO_LDOPTS += -Wl,-R$(LIBRUNPATH) +endif + +MKSHLIB = $(CC) $(DSO_LDOPTS) +ifdef MAPFILE +# Add LD options to restrict exported symbols to those in the map file +endif +# Change PROCESS to put the mapfile in the correct format for this platform +PROCESS_MAP_FILE = cp $< $@ + +G++INCLUDES = -I/usr/include/g++ + +INCLUDES += -I/usr/X11R6/include diff --git a/mozilla/security/coreconf/BeOS.mk b/mozilla/security/coreconf/BeOS.mk new file mode 100644 index 0000000..2695891 --- /dev/null +++ b/mozilla/security/coreconf/BeOS.mk @@ -0,0 +1,79 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 2002 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +XP_DEFINE := $(XP_DEFINE:-DXP_UNIX=-DXP_BEOS) + +USE_PTHREADS = + +ifeq ($(USE_PTHREADS),1) + IMPL_STRATEGY = _PTH +endif + +CC = gcc +CCC = g++ +RANLIB = ranlib + +DEFAULT_COMPILER = gcc + +ifeq ($(OS_TEST),ppc) + OS_REL_CFLAGS = -Dppc + CPU_ARCH = ppc +else + OS_REL_CFLAGS = -Di386 + CPU_ARCH = x86 +endif + +MKSHLIB = $(CC) -nostart -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) +ifdef BUILD_OPT + OPTIMIZER = -O2 +endif + +OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wall -Wno-switch -pipe +OS_LIBS = -lbe + +DEFINES += -DBEOS + +ifdef USE_PTHREADS + DEFINES += -D_REENTRANT +endif + +ARCH = beos + +DSO_CFLAGS = -fPIC +DSO_LDOPTS = diff --git a/mozilla/security/coreconf/Darwin.mk b/mozilla/security/coreconf/Darwin.mk new file mode 100644 index 0000000..9edf4d8 --- /dev/null +++ b/mozilla/security/coreconf/Darwin.mk @@ -0,0 +1,139 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +DEFAULT_COMPILER = cc + +CC = cc +CCC = c++ +RANLIB = ranlib + +ifndef CPU_ARCH +# When cross-compiling, CPU_ARCH should already be defined as the target +# architecture, set to powerpc or i386. +CPU_ARCH := $(shell uname -p) +endif + +ifeq (,$(filter-out i%86,$(CPU_ARCH))) +ifdef USE_64 +CC += -arch x86_64 +else +OS_REL_CFLAGS = -Di386 +endif +else +OS_REL_CFLAGS = -Dppc +endif + +ifneq (,$(MACOS_SDK_DIR)) + GCC_VERSION_FULL := $(shell $(CC) -v 2>&1 | grep "gcc version" | sed -e "s/^.*gcc version[ ]*//" | awk '{ print $$1 }') + GCC_VERSION_MAJOR := $(shell echo $(GCC_VERSION_FULL) | awk -F. '{ print $$1 }') + GCC_VERSION_MINOR := $(shell echo $(GCC_VERSION_FULL) | awk -F. '{ print $$2 }') + GCC_VERSION = $(GCC_VERSION_MAJOR).$(GCC_VERSION_MINOR) + + ifeq (,$(filter-out 2 3,$(GCC_VERSION_MAJOR))) + # GCC <= 3 + DARWIN_SDK_FRAMEWORKS = -F$(MACOS_SDK_DIR)/System/Library/Frameworks + ifneq (,$(shell find $(MACOS_SDK_DIR)/Library/Frameworks -maxdepth 0)) + DARWIN_SDK_FRAMEWORKS += -F$(MACOS_SDK_DIR)/Library/Frameworks + endif + DARWIN_SDK_CFLAGS = -nostdinc -isystem $(MACOS_SDK_DIR)/usr/include/gcc/darwin/$(GCC_VERSION) -isystem $(MACOS_SDK_DIR)/usr/include $(DARWIN_SDK_FRAMEWORKS) + DARWIN_SDK_LDFLAGS = -L$(MACOS_SDK_DIR)/usr/lib/gcc/darwin -L$(MACOS_SDK_DIR)/usr/lib/gcc/darwin/$(GCC_VERSION_FULL) -L$(MACOS_SDK_DIR)/usr/lib + DARWIN_SDK_SHLIBFLAGS = $(DARWIN_SDK_LDFLAGS) $(DARWIN_SDK_FRAMEWORKS) + NEXT_ROOT = $(MACOS_SDK_DIR) + export NEXT_ROOT + else + # GCC >= 4 + DARWIN_SDK_CFLAGS = -isysroot $(MACOS_SDK_DIR) + ifneq (4.0.0,$(GCC_VERSION_FULL)) + # gcc > 4.0.0 passes -syslibroot to ld based on -isysroot. + # Don't add -isysroot to DARWIN_SDK_LDFLAGS, because the programs + # that are linked with those flags also get DARWIN_SDK_CFLAGS. + DARWIN_SDK_SHLIBFLAGS = -isysroot $(MACOS_SDK_DIR) + else + # gcc 4.0.0 doesn't pass -syslibroot to ld, it needs to be + # explicit. + DARWIN_SDK_LDFLAGS = -Wl,-syslibroot,$(MACOS_SDK_DIR) + DARWIN_SDK_SHLIBFLAGS = $(DARWIN_SDK_LDFLAGS) + endif + endif + + LDFLAGS += $(DARWIN_SDK_LDFLAGS) +endif + +# "Commons" are tentative definitions in a global scope, like this: +# int x; +# The meaning of a common is ambiguous. It may be a true definition: +# int x = 0; +# or it may be a declaration of a symbol defined in another file: +# extern int x; +# Use the -fno-common option to force all commons to become true +# definitions so that the linker can catch multiply-defined symbols. +# Also, common symbols are not allowed with Darwin dynamic libraries. + +OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wmost -fpascal-strings -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK $(DARWIN_SDK_CFLAGS) + +ifdef BUILD_OPT +ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE)) + OPTIMIZER = -Oz +else + OPTIMIZER = -O2 +endif +ifdef MOZ_DEBUG_SYMBOLS + ifdef MOZ_DEBUG_FLAGS + OPTIMIZER += $(MOZ_DEBUG_FLAGS) + else + OPTIMIZER += -gdwarf-2 -gfull + endif +endif +endif + +ARCH = darwin + +DSO_CFLAGS = -fPIC +# May override this with different compatibility and current version numbers. +DARWIN_DYLIB_VERSIONS = -compatibility_version 1 -current_version 1 +# May override this with -bundle to create a loadable module. +DSO_LDOPTS = -dynamiclib $(DARWIN_DYLIB_VERSIONS) -install_name @executable_path/$(notdir $@) -headerpad_max_install_names + +MKSHLIB = $(CC) $(DSO_LDOPTS) $(DARWIN_SDK_SHLIBFLAGS) +DLL_SUFFIX = dylib +PROCESS_MAP_FILE = grep -v ';+' $< | grep -v ';-' | \ + sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' -e 's,^,_,' > $@ + +USE_SYSTEM_ZLIB = 1 +ZLIB_LIBS = -lz diff --git a/mozilla/security/coreconf/FreeBSD.mk b/mozilla/security/coreconf/FreeBSD.mk new file mode 100644 index 0000000..8d1dad7 --- /dev/null +++ b/mozilla/security/coreconf/FreeBSD.mk @@ -0,0 +1,90 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +DEFAULT_COMPILER = gcc +CC = gcc +CCC = g++ +RANLIB = ranlib + +CPU_ARCH = $(OS_TEST) +ifeq ($(CPU_ARCH),i386) +CPU_ARCH = x86 +endif +ifeq ($(CPU_ARCH),pc98) +CPU_ARCH = x86 +endif +ifeq ($(CPU_ARCH),amd64) +CPU_ARCH = x86_64 +endif + +OS_CFLAGS = $(DSO_CFLAGS) -ansi -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK + +DSO_CFLAGS = -fPIC +DSO_LDOPTS = -shared -Wl,-soname -Wl,$(notdir $@) + +# +# The default implementation strategy for FreeBSD is pthreads. +# +ifndef CLASSIC_NSPR +USE_PTHREADS = 1 +DEFINES += -D_THREAD_SAFE -D_REENTRANT +OS_LIBS += -pthread +DSO_LDOPTS += -pthread +endif + +ARCH = freebsd + +MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf) + +ifeq ($(MOZ_OBJFORMAT),elf) +DLL_SUFFIX = so +else +DLL_SUFFIX = so.1.0 +endif + +MKSHLIB = $(CC) $(DSO_LDOPTS) +ifdef MAPFILE + MKSHLIB += -Wl,--version-script,$(MAPFILE) +endif +PROCESS_MAP_FILE = grep -v ';-' $< | \ + sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@ + +G++INCLUDES = -I/usr/include/g++ + +INCLUDES += -I/usr/X11R6/include diff --git a/mozilla/security/coreconf/HP-UX.mk b/mozilla/security/coreconf/HP-UX.mk new file mode 100644 index 0000000..a82e58b --- /dev/null +++ b/mozilla/security/coreconf/HP-UX.mk @@ -0,0 +1,116 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# +# Config stuff for HP-UX +# + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +DEFAULT_COMPILER = cc + +ifeq ($(OS_TEST),ia64) + CPU_ARCH = ia64 + CPU_TAG = _$(CPU_ARCH) + ifneq ($(USE_64),1) + 64BIT_TAG = _32 + endif + DLL_SUFFIX = so +else + CPU_ARCH = hppa + DLL_SUFFIX = sl +endif +CC = cc +CCC = CC +ifndef NS_USE_GCC +OS_CFLAGS += -Ae +endif +OS_CFLAGS += $(DSO_CFLAGS) -DHPUX -D$(CPU_ARCH) -D_HPUX_SOURCE -D_USE_BIG_FDS + +ifeq ($(DEFAULT_IMPL_STRATEGY),_PTH) + USE_PTHREADS = 1 + ifeq ($(CLASSIC_NSPR),1) + USE_PTHREADS = + IMPL_STRATEGY = _CLASSIC + endif + ifeq ($(PTHREADS_USER),1) + USE_PTHREADS = + IMPL_STRATEGY = _PTH_USER + endif +endif + +ifdef PTHREADS_USER + OS_CFLAGS += -D_POSIX_C_SOURCE=199506L +endif + +LDFLAGS = -z -Wl,+s + +ifdef NS_USE_GCC +LD = $(CC) +endif +MKSHLIB = $(LD) $(DSO_LDOPTS) $(RPATH) +ifdef MAPFILE +ifndef NS_USE_GCC +MKSHLIB += -c $(MAPFILE) +else +MKSHLIB += -Wl,-c,$(MAPFILE) +endif +endif +PROCESS_MAP_FILE = grep -v ';+' $< | grep -v ';-' | \ + sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' -e 's,^,+e ,' > $@ + +ifndef NS_USE_GCC +DSO_LDOPTS = -b +h $(notdir $@) +RPATH = +b '$$ORIGIN' +else +DSO_LDOPTS = -shared -Wl,+h,$(notdir $@) +RPATH = -Wl,+b,'$$ORIGIN' +endif +ifneq ($(OS_TEST),ia64) +# pa-risc +ifndef USE_64 +RPATH = +endif +endif + +# +Z generates position independent code for use in shared libraries. +ifndef NS_USE_GCC +DSO_CFLAGS = +Z +else +DSO_CFLAGS = -fPIC +ASFLAGS += -x assembler-with-cpp +endif diff --git a/mozilla/security/coreconf/HP-UXA.09.03.mk b/mozilla/security/coreconf/HP-UXA.09.03.mk new file mode 100644 index 0000000..d4270b2 --- /dev/null +++ b/mozilla/security/coreconf/HP-UXA.09.03.mk @@ -0,0 +1,49 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# +# On HP-UX 9, the default (and only) implementation strategy is +# classic nspr. +# +ifeq ($(OS_RELEASE),A.09.03) + DEFAULT_IMPL_STRATEGY = _CLASSIC +endif + +# +# Config stuff for HP-UXA.09.03 +# +include $(CORE_DEPTH)/coreconf/HP-UXA.09.mk diff --git a/mozilla/security/coreconf/HP-UXA.09.07.mk b/mozilla/security/coreconf/HP-UXA.09.07.mk new file mode 100644 index 0000000..fbc9971 --- /dev/null +++ b/mozilla/security/coreconf/HP-UXA.09.07.mk @@ -0,0 +1,48 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# On HP-UX 9, the default (and only) implementation strategy is +# classic nspr. + +ifeq ($(OS_RELEASE),A.09.07) + DEFAULT_IMPL_STRATEGY = _CLASSIC +endif + +# +# Config stuff for HP-UXA.09.07 +# +include $(CORE_DEPTH)/coreconf/HP-UXA.09.mk diff --git a/mozilla/security/coreconf/HP-UXA.09.mk b/mozilla/security/coreconf/HP-UXA.09.mk new file mode 100644 index 0000000..307c721 --- /dev/null +++ b/mozilla/security/coreconf/HP-UXA.09.mk @@ -0,0 +1,43 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# +# Config stuff for HP-UXA.09 +# +include $(CORE_DEPTH)/coreconf/HP-UX.mk + +OS_CFLAGS += -DHPUX9 diff --git a/mozilla/security/coreconf/HP-UXB.10.01.mk b/mozilla/security/coreconf/HP-UXB.10.01.mk new file mode 100644 index 0000000..b2cffc7 --- /dev/null +++ b/mozilla/security/coreconf/HP-UXB.10.01.mk @@ -0,0 +1,44 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +ifeq ($(OS_RELEASE),B.10.01) + DEFAULT_IMPL_STRATEGY = _CLASSIC +endif + +# +# Config stuff for HP-UXB.10.01 +# +include $(CORE_DEPTH)/coreconf/HP-UXB.10.mk diff --git a/mozilla/security/coreconf/HP-UXB.10.10.mk b/mozilla/security/coreconf/HP-UXB.10.10.mk new file mode 100644 index 0000000..9193fd2 --- /dev/null +++ b/mozilla/security/coreconf/HP-UXB.10.10.mk @@ -0,0 +1,54 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# On HP-UX 10.10 and 10.20, the default implementation strategy is +# pthreads (actually DCE threads). Classic nspr is also available. + +ifeq ($(OS_RELEASE),B.10.10) + DEFAULT_IMPL_STRATEGY = _PTH +endif + +# +# Config stuff for HP-UXB.10.10 +# +include $(CORE_DEPTH)/coreconf/HP-UXB.10.mk + +OS_CFLAGS += -DHPUX10_10 + +ifeq ($(USE_PTHREADS),1) + OS_CFLAGS += -D_REENTRANT +endif diff --git a/mozilla/security/coreconf/HP-UXB.10.20.mk b/mozilla/security/coreconf/HP-UXB.10.20.mk new file mode 100644 index 0000000..22c1a2e --- /dev/null +++ b/mozilla/security/coreconf/HP-UXB.10.20.mk @@ -0,0 +1,54 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# On HP-UX 10.10 and 10.20, the default implementation strategy is +# pthreads (actually DCE threads). Classic nspr is also available. + +ifeq ($(OS_RELEASE),B.10.20) + DEFAULT_IMPL_STRATEGY = _PTH +endif + +# +# Config stuff for HP-UXB.10.20 +# +include $(CORE_DEPTH)/coreconf/HP-UXB.10.mk + +OS_CFLAGS += -DHPUX10_20 + +ifeq ($(USE_PTHREADS),1) + OS_CFLAGS += -D_REENTRANT +endif diff --git a/mozilla/security/coreconf/HP-UXB.10.30.mk b/mozilla/security/coreconf/HP-UXB.10.30.mk new file mode 100644 index 0000000..54104e2 --- /dev/null +++ b/mozilla/security/coreconf/HP-UXB.10.30.mk @@ -0,0 +1,60 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# On HP-UX 10.30 and 11.00, the default implementation strategy is +# pthreads. Classic nspr and pthreads-user are also available. + +ifeq ($(OS_RELEASE),B.10.30) + DEFAULT_IMPL_STRATEGY = _PTH +endif + +# +# Config stuff for HP-UXB.10.30. +# +include $(CORE_DEPTH)/coreconf/HP-UXB.10.mk + +OS_CFLAGS += -DHPUX10_30 + +# +# To use the true pthread (kernel thread) library on 10.30 and +# 11.00, we should define _POSIX_C_SOURCE to be 199506L. +# The _REENTRANT macro is deprecated. +# + +ifdef USE_PTHREADS + OS_CFLAGS += -D_POSIX_C_SOURCE=199506L +endif diff --git a/mozilla/security/coreconf/HP-UXB.10.mk b/mozilla/security/coreconf/HP-UXB.10.mk new file mode 100644 index 0000000..070a779 --- /dev/null +++ b/mozilla/security/coreconf/HP-UXB.10.mk @@ -0,0 +1,40 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +include $(CORE_DEPTH)/coreconf/HP-UX.mk + +OS_CFLAGS += -DHPUX10 +OS_LIBS += -lpthread -lm diff --git a/mozilla/security/coreconf/HP-UXB.11.00.mk b/mozilla/security/coreconf/HP-UXB.11.00.mk new file mode 100644 index 0000000..ccfd663 --- /dev/null +++ b/mozilla/security/coreconf/HP-UXB.11.00.mk @@ -0,0 +1,49 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# On HP-UX 10.30 and 11.00, the default implementation strategy is +# pthreads. Classic nspr and pthreads-user are also available. + +ifeq ($(OS_RELEASE),B.11.00) +OS_CFLAGS += -DHPUX10 +DEFAULT_IMPL_STRATEGY = _PTH +endif + +# +# Config stuff for HP-UXB.11.00. +# +include $(CORE_DEPTH)/coreconf/HP-UXB.11.mk diff --git a/mozilla/security/coreconf/HP-UXB.11.11.mk b/mozilla/security/coreconf/HP-UXB.11.11.mk new file mode 100644 index 0000000..51076c2 --- /dev/null +++ b/mozilla/security/coreconf/HP-UXB.11.11.mk @@ -0,0 +1,49 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 2001 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# On HP-UX 10.30 and 11.x, the default implementation strategy is +# pthreads. Classic nspr and pthreads-user are also available. + +ifeq ($(OS_RELEASE),B.11.11) +OS_CFLAGS += -DHPUX10 +DEFAULT_IMPL_STRATEGY = _PTH +endif + +# +# Config stuff for HP-UXB.11.11. +# +include $(CORE_DEPTH)/coreconf/HP-UXB.11.mk diff --git a/mozilla/security/coreconf/HP-UXB.11.20.mk b/mozilla/security/coreconf/HP-UXB.11.20.mk new file mode 100644 index 0000000..193e91d --- /dev/null +++ b/mozilla/security/coreconf/HP-UXB.11.20.mk @@ -0,0 +1,49 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 2002 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# On HP-UX 10.30 and 11.x, the default implementation strategy is +# pthreads. Classic nspr and pthreads-user are also available. + +ifeq ($(OS_RELEASE),B.11.20) +OS_CFLAGS += -DHPUX10 +DEFAULT_IMPL_STRATEGY = _PTH +endif + +# +# Config stuff for HP-UXB.11.x. +# +include $(CORE_DEPTH)/coreconf/HP-UXB.11.mk diff --git a/mozilla/security/coreconf/HP-UXB.11.22.mk b/mozilla/security/coreconf/HP-UXB.11.22.mk new file mode 100644 index 0000000..d7f04ca --- /dev/null +++ b/mozilla/security/coreconf/HP-UXB.11.22.mk @@ -0,0 +1,49 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 2002 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# On HP-UX 10.30 and 11.x, the default implementation strategy is +# pthreads. Classic nspr and pthreads-user are also available. + +ifeq ($(OS_RELEASE),B.11.22) +OS_CFLAGS += -DHPUX10 +DEFAULT_IMPL_STRATEGY = _PTH +endif + +# +# Config stuff for HP-UXB.11.x. +# +include $(CORE_DEPTH)/coreconf/HP-UXB.11.mk diff --git a/mozilla/security/coreconf/HP-UXB.11.23.mk b/mozilla/security/coreconf/HP-UXB.11.23.mk new file mode 100644 index 0000000..25c8a61 --- /dev/null +++ b/mozilla/security/coreconf/HP-UXB.11.23.mk @@ -0,0 +1,49 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 2002 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# On HP-UX 10.30 and 11.x, the default implementation strategy is +# pthreads. Classic nspr and pthreads-user are also available. + +ifeq ($(OS_RELEASE),B.11.23) +OS_CFLAGS += -DHPUX10 +DEFAULT_IMPL_STRATEGY = _PTH +endif + +# +# Config stuff for HP-UXB.11.x. +# +include $(CORE_DEPTH)/coreconf/HP-UXB.11.mk diff --git a/mozilla/security/coreconf/HP-UXB.11.mk b/mozilla/security/coreconf/HP-UXB.11.mk new file mode 100644 index 0000000..da0cb4c --- /dev/null +++ b/mozilla/security/coreconf/HP-UXB.11.mk @@ -0,0 +1,80 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +include $(CORE_DEPTH)/coreconf/HP-UX.mk + +ifndef NS_USE_GCC + CCC = /opt/aCC/bin/aCC -ext + ifeq ($(USE_64), 1) + ifeq ($(OS_TEST), ia64) + ARCHFLAG = -Aa +e +p +DD64 + else + # Our HP-UX build machine has a strange problem. If + # a 64-bit PA-RISC executable calls getcwd() in a + # network-mounted directory, it fails with ENOENT. + # We don't know why. Since nsinstall calls getcwd(), + # this breaks our 64-bit HP-UX nightly builds. None + # of our other HP-UX machines have this problem. + # + # We worked around this problem by building nsinstall + # as a 32-bit PA-RISC executable for 64-bit PA-RISC + # builds. -- wtc 2003-06-03 + ifdef INTERNAL_TOOLS + ARCHFLAG = +DAportable +DS2.0 + else + ARCHFLAG = -Aa +e +DA2.0W +DS2.0 +DChpux + endif + endif + else + ifeq ($(OS_TEST), ia64) + ARCHFLAG = -Aa +e +p +DD32 + else + ARCHFLAG = +DAportable +DS2.0 + endif + endif +else + CCC = aCC +endif + +# +# To use the true pthread (kernel thread) library on HP-UX +# 11.x, we should define _POSIX_C_SOURCE to be 199506L. +# The _REENTRANT macro is deprecated. +# + +OS_CFLAGS += $(ARCHFLAG) -DHPUX11 -D_POSIX_C_SOURCE=199506L +OS_LIBS += -lpthread -lm -lrt +HPUX11 = 1 diff --git a/mozilla/security/coreconf/IRIX.mk b/mozilla/security/coreconf/IRIX.mk new file mode 100644 index 0000000..28f4f05 --- /dev/null +++ b/mozilla/security/coreconf/IRIX.mk @@ -0,0 +1,126 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +# +# The default implementation strategy for Irix is classic nspr. +# +ifeq ($(USE_PTHREADS),1) + ifeq ($(USE_N32),1) + IMPL_STRATEGY = _n32_PTH + else + IMPL_STRATEGY = _PTH + endif +endif + +DEFAULT_COMPILER = cc + +ifdef NS_USE_GCC + CC = gcc + AS = $(CC) -x assembler-with-cpp + ODD_CFLAGS = -Wall -Wno-format -Wno-switch + ifdef BUILD_OPT + OPTIMIZER = -O6 + endif +else + CC = cc + CCC = CC + ODD_CFLAGS = -fullwarn -xansi -woff 1209 + ifdef BUILD_OPT + ifeq ($(USE_N32),1) + OPTIMIZER = -O -OPT:Olimit=4000 + else + OPTIMIZER = -O -Olimit 4000 + endif + endif + + # For 6.x machines, include this flag + ifeq (6., $(findstring 6., $(OS_RELEASE))) + ifeq ($(USE_N32),1) + ODD_CFLAGS += -n32 -mips3 -exceptions + else + ODD_CFLAGS += -32 -multigot + endif + else + ODD_CFLAGS += -xgot + endif + ifeq ($(USE_N32),1) + OS_CFLAGS += -dollar + endif +endif + +ODD_CFLAGS += -DSVR4 -DIRIX + +CPU_ARCH = mips + +RANLIB = /bin/true +# For purify +# NOTE: should always define _SGI_MP_SOURCE +NOMD_OS_CFLAGS += $(ODD_CFLAGS) -D_SGI_MP_SOURCE + +OS_CFLAGS += $(NOMD_OS_CFLAGS) +ifdef USE_MDUPDATE + OS_CFLAGS += -MDupdate $(DEPENDENCIES) +endif + +ifeq ($(USE_N32),1) + SHLIB_LD_OPTS += -n32 -mips3 +endif + +MKSHLIB += $(LD) $(SHLIB_LD_OPTS) -shared -soname $(@:$(OBJDIR)/%.so=%.so) +ifdef MAPFILE +# Add LD options to restrict exported symbols to those in the map file +endif +# Change PROCESS to put the mapfile in the correct format for this platform +PROCESS_MAP_FILE = cp $< $@ + +DSO_LDOPTS = -elf -shared -all + +ifdef DSO_BACKEND + DSO_LDOPTS += -soname $(DSO_NAME) +endif + +# +# Revision notes: +# +# In the IRIX compilers prior to version 7.2, -n32 implied -mips3. +# Beginning in the 7.2 compilers, -n32 implies -mips4 when the compiler +# is running on a system with a mips4 CPU (e.g. R8K, R10K). +# We want our code to explicitly be mips3 code, so we now explicitly +# set -mips3 whenever we set -n32. +# diff --git a/mozilla/security/coreconf/IRIX5.2.mk b/mozilla/security/coreconf/IRIX5.2.mk new file mode 100644 index 0000000..c28e7b3 --- /dev/null +++ b/mozilla/security/coreconf/IRIX5.2.mk @@ -0,0 +1,37 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +include $(CORE_DEPTH)/coreconf/IRIX5.mk diff --git a/mozilla/security/coreconf/IRIX5.3.mk b/mozilla/security/coreconf/IRIX5.3.mk new file mode 100644 index 0000000..0fe37ec --- /dev/null +++ b/mozilla/security/coreconf/IRIX5.3.mk @@ -0,0 +1,39 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +include $(CORE_DEPTH)/coreconf/IRIX5.mk + +OS_CFLAGS += -DIRIX5_3 diff --git a/mozilla/security/coreconf/IRIX5.mk b/mozilla/security/coreconf/IRIX5.mk new file mode 100644 index 0000000..1621416 --- /dev/null +++ b/mozilla/security/coreconf/IRIX5.mk @@ -0,0 +1,42 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/IRIX.mk + +ifndef NS_USE_GCC + ODD_CFLAGS += -xgot +endif diff --git a/mozilla/security/coreconf/IRIX6.2.mk b/mozilla/security/coreconf/IRIX6.2.mk new file mode 100644 index 0000000..a0dd47b --- /dev/null +++ b/mozilla/security/coreconf/IRIX6.2.mk @@ -0,0 +1,45 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + + +# catch unresolved symbols + +SHLIB_LD_OPTS += -no_unresolved + +include $(CORE_DEPTH)/coreconf/IRIX6.mk + +OS_CFLAGS += -DIRIX6_2 diff --git a/mozilla/security/coreconf/IRIX6.3.mk b/mozilla/security/coreconf/IRIX6.3.mk new file mode 100644 index 0000000..6d4c3f7 --- /dev/null +++ b/mozilla/security/coreconf/IRIX6.3.mk @@ -0,0 +1,44 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# catch unresolved symbols + +SHLIB_LD_OPTS += -no_unresolved + +include $(CORE_DEPTH)/coreconf/IRIX6.mk + +OS_CFLAGS += -DIRIX6_3 diff --git a/mozilla/security/coreconf/IRIX6.5.mk b/mozilla/security/coreconf/IRIX6.5.mk new file mode 100644 index 0000000..1576d8b --- /dev/null +++ b/mozilla/security/coreconf/IRIX6.5.mk @@ -0,0 +1,47 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# catch unresolved symbols + +SHLIB_LD_OPTS += -no_unresolved + +include $(CORE_DEPTH)/coreconf/IRIX6.mk + +OS_CFLAGS += -DIRIX6_5 +ifndef NS_USE_GCC +OS_CFLAGS += -mips3 +endif diff --git a/mozilla/security/coreconf/IRIX6.mk b/mozilla/security/coreconf/IRIX6.mk new file mode 100644 index 0000000..09054fb --- /dev/null +++ b/mozilla/security/coreconf/IRIX6.mk @@ -0,0 +1,49 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/IRIX.mk + +ifndef NS_USE_GCC + ifneq ($(USE_N32),1) + OS_CFLAGS += -32 + endif + ODD_CFLAGS += -multigot +endif + +ifeq ($(USE_PTHREADS),1) +OS_LIBS += -lpthread +endif diff --git a/mozilla/security/coreconf/Linux.mk b/mozilla/security/coreconf/Linux.mk new file mode 100644 index 0000000..caf05a8 --- /dev/null +++ b/mozilla/security/coreconf/Linux.mk @@ -0,0 +1,194 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +# +# The default implementation strategy for Linux is now pthreads +# +USE_PTHREADS = 1 + +ifeq ($(USE_PTHREADS),1) + IMPL_STRATEGY = _PTH +endif + +CC = gcc +CCC = g++ +RANLIB = ranlib + +DEFAULT_COMPILER = gcc + +ifeq ($(OS_TEST),ppc64) + CPU_ARCH = ppc +ifeq ($(USE_64),1) + ARCHFLAG = -m64 +endif +else +ifeq ($(OS_TEST),alpha) + OS_REL_CFLAGS = -D_ALPHA_ + CPU_ARCH = alpha +else +ifeq ($(OS_TEST),x86_64) +ifeq ($(USE_64),1) + CPU_ARCH = x86_64 +else + OS_REL_CFLAGS = -Di386 + CPU_ARCH = x86 + ARCHFLAG = -m32 +endif +else +ifeq ($(OS_TEST),sparc64) + CPU_ARCH = sparc +else +ifeq (,$(filter-out arm% sa110,$(OS_TEST))) + CPU_ARCH = arm +else +ifeq (,$(filter-out parisc%,$(OS_TEST))) + CPU_ARCH = hppa +else +ifeq (,$(filter-out i%86,$(OS_TEST))) + OS_REL_CFLAGS = -Di386 + CPU_ARCH = x86 +else +ifeq ($(OS_TEST),sh4a) + CPU_ARCH = sh4 +else +# $(OS_TEST) == m68k, ppc, ia64, sparc, s390, s390x, mips, sh3, sh4 + CPU_ARCH = $(OS_TEST) +endif +endif +endif +endif +endif +endif +endif +endif + + +LIBC_TAG = _glibc + +ifeq ($(OS_RELEASE),2.0) + OS_REL_CFLAGS += -DLINUX2_0 + MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH) + ifdef MAPFILE + MKSHLIB += -Wl,--version-script,$(MAPFILE) + endif + PROCESS_MAP_FILE = grep -v ';-' $< | \ + sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@ +endif + +ifdef BUILD_OPT +ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE)) + OPTIMIZER = -Os +else + OPTIMIZER = -O2 +endif +ifdef MOZ_DEBUG_SYMBOLS + ifdef MOZ_DEBUG_FLAGS + OPTIMIZER += $(MOZ_DEBUG_FLAGS) + else + OPTIMIZER += -gdwarf-2 + endif +endif +endif + + +ifeq ($(USE_PTHREADS),1) +OS_PTHREAD = -lpthread +endif + +# See bug 537829, in particular comment 23. +# Place -ansi and *_SOURCE before $(DSO_CFLAGS) so DSO_CFLAGS can override +# -ansi on platforms like Android where the system headers are C99 and do +# not build with -ansi. +STANDARDS_CFLAGS = -ansi -D_POSIX_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE +OS_CFLAGS = $(STANDARDS_CFLAGS) $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -Wall -Werror-implicit-function-declaration -Wno-switch -pipe -DLINUX -Dlinux -DHAVE_STRERROR +OS_LIBS = $(OS_PTHREAD) -ldl -lc + +ifdef USE_PTHREADS + DEFINES += -D_REENTRANT +endif + +ARCH = linux + +DSO_CFLAGS = -fPIC +DSO_LDOPTS = -shared $(ARCHFLAG) +# The linker on Red Hat Linux 7.2 and RHEL 2.1 (GNU ld version 2.11.90.0.8) +# incorrectly reports undefined references in the libraries we link with, so +# we don't use -z defs there. +ZDEFS_FLAG = -Wl,-z,defs +DSO_LDOPTS += $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG)) +LDFLAGS += $(ARCHFLAG) + +# On Maemo, we need to use the -rpath-link flag for even the standard system +# library directories. +ifdef _SBOX_DIR +LDFLAGS += -Wl,-rpath-link,/usr/lib:/lib +endif + +# INCLUDES += -I/usr/include -Y/usr/include/linux +G++INCLUDES = -I/usr/include/g++ + +# +# Always set CPU_TAG on Linux, WINCE. +# +CPU_TAG = _$(CPU_ARCH) + +# +# On Linux 2.6 or later, build libfreebl3.so with no NSPR and libnssutil3.so +# dependencies by default. Set FREEBL_NO_DEPEND to 0 in the environment to +# override this. +# +ifeq (2.6,$(firstword $(sort 2.6 $(OS_RELEASE)))) +ifndef FREEBL_NO_DEPEND +FREEBL_NO_DEPEND = 1 +endif +endif + +USE_SYSTEM_ZLIB = 1 +ZLIB_LIBS = -lz + +# The -rpath '$$ORIGIN' linker option instructs this library to search for its +# dependencies in the same directory where it resides. +ifeq ($(BUILD_SUN_PKG), 1) +ifeq ($(USE_64), 1) +RPATH = -Wl,-rpath,'$$ORIGIN:/opt/sun/private/lib64:/opt/sun/private/lib' +else +RPATH = -Wl,-rpath,'$$ORIGIN:/opt/sun/private/lib' +endif +endif + diff --git a/mozilla/security/coreconf/Linux2.1.mk b/mozilla/security/coreconf/Linux2.1.mk new file mode 100644 index 0000000..e92503a --- /dev/null +++ b/mozilla/security/coreconf/Linux2.1.mk @@ -0,0 +1,48 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/Linux.mk +ifeq ($(OS_RELEASE),2.1) + OS_REL_CFLAGS += -DLINUX2_1 + MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH) + ifdef MAPFILE + MKSHLIB += -Wl,--version-script,$(MAPFILE) + endif + PROCESS_MAP_FILE = grep -v ';-' $< | \ + sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@ +endif + diff --git a/mozilla/security/coreconf/Linux2.2.mk b/mozilla/security/coreconf/Linux2.2.mk new file mode 100644 index 0000000..4a6cc1e --- /dev/null +++ b/mozilla/security/coreconf/Linux2.2.mk @@ -0,0 +1,48 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/Linux.mk + +OS_REL_CFLAGS += -DLINUX2_1 +MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH) + +ifdef MAPFILE + MKSHLIB += -Wl,--version-script,$(MAPFILE) +endif +PROCESS_MAP_FILE = grep -v ';-' $< | \ + sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@ + diff --git a/mozilla/security/coreconf/Linux2.4.mk b/mozilla/security/coreconf/Linux2.4.mk new file mode 100644 index 0000000..a387672 --- /dev/null +++ b/mozilla/security/coreconf/Linux2.4.mk @@ -0,0 +1,53 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/Linux.mk + +OS_REL_CFLAGS += -DLINUX2_1 +MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH) + +ifdef MAPFILE + MKSHLIB += -Wl,--version-script,$(MAPFILE) +endif +PROCESS_MAP_FILE = grep -v ';-' $< | \ + sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@ + +# Softoken 3.13 uses NO_FORK_CHECK only. +# Softoken 3.12 uses NO_FORK_CHECK and NO_CHECK_FORK. +# Don't use NO_CHECK_FORK in new code. +DEFINES += -DNO_FORK_CHECK -DNO_CHECK_FORK + diff --git a/mozilla/security/coreconf/Linux2.5.mk b/mozilla/security/coreconf/Linux2.5.mk new file mode 100644 index 0000000..4a6cc1e --- /dev/null +++ b/mozilla/security/coreconf/Linux2.5.mk @@ -0,0 +1,48 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/Linux.mk + +OS_REL_CFLAGS += -DLINUX2_1 +MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH) + +ifdef MAPFILE + MKSHLIB += -Wl,--version-script,$(MAPFILE) +endif +PROCESS_MAP_FILE = grep -v ';-' $< | \ + sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@ + diff --git a/mozilla/security/coreconf/Linux2.6.mk b/mozilla/security/coreconf/Linux2.6.mk new file mode 100644 index 0000000..4a6cc1e --- /dev/null +++ b/mozilla/security/coreconf/Linux2.6.mk @@ -0,0 +1,48 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/Linux.mk + +OS_REL_CFLAGS += -DLINUX2_1 +MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH) + +ifdef MAPFILE + MKSHLIB += -Wl,--version-script,$(MAPFILE) +endif +PROCESS_MAP_FILE = grep -v ';-' $< | \ + sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@ + diff --git a/mozilla/security/coreconf/LinuxELF1.2.mk b/mozilla/security/coreconf/LinuxELF1.2.mk new file mode 100644 index 0000000..083d886 --- /dev/null +++ b/mozilla/security/coreconf/LinuxELF1.2.mk @@ -0,0 +1,38 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/Linux.mk diff --git a/mozilla/security/coreconf/LinuxELF2.0.mk b/mozilla/security/coreconf/LinuxELF2.0.mk new file mode 100644 index 0000000..083d886 --- /dev/null +++ b/mozilla/security/coreconf/LinuxELF2.0.mk @@ -0,0 +1,38 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/Linux.mk diff --git a/mozilla/security/coreconf/Makefile b/mozilla/security/coreconf/Makefile new file mode 100644 index 0000000..e162c0a --- /dev/null +++ b/mozilla/security/coreconf/Makefile @@ -0,0 +1,47 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +DEPTH = .. +CORE_DEPTH = .. + +MODULE = coreconf + +DIRS = nsinstall + +include $(DEPTH)/coreconf/config.mk +include $(DEPTH)/coreconf/rules.mk + +export:: libs diff --git a/mozilla/security/coreconf/NCR3.0.mk b/mozilla/security/coreconf/NCR3.0.mk new file mode 100644 index 0000000..e312a5d --- /dev/null +++ b/mozilla/security/coreconf/NCR3.0.mk @@ -0,0 +1,97 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +DEFAULT_COMPILER = cc + +### +NS_USE_NATIVE = 1 + +# NS_USE_GCC = 1 + +export PATH:=$(PATH):/opt/ncc/bin +### + +RANLIB = true +GCC_FLAGS_EXTRA += -pipe + +DEFINES += -DSVR4 -DSYSV -DHAVE_STRERROR -DNCR + +OS_CFLAGS += -Hnocopyr -DSVR4 -DSYSV -DHAVE_STRERROR -DNCR -DPRFSTREAMS_BROKEN + +ifdef NS_USE_NATIVE + CC = cc + CCC = ncc + CXX = ncc +# OS_LIBS += -L/opt/ncc/lib +else +# OS_LIBS += +endif + +#OS_LIBS += -lsocket -lnsl -ldl -lc + +MKSHLIB += $(LD) $(DSO_LDOPTS) +#DSO_LDOPTS += -G -z defs +DSO_LDOPTS += -G +ifdef MAPFILE +# Add LD options to restrict exported symbols to those in the map file +endif +# Change PROCESS to put the mapfile in the correct format for this platform +PROCESS_MAP_FILE = cp $< $@ + +CPU_ARCH = x86 +ARCH = ncr + +NOSUCHFILE = /solaris-rm-f-sucks + +# now take care of default GCC (rus@5/5/97) + +ifdef NS_USE_GCC + # if gcc-settings are redefined already - don't touch it + # + ifeq (,$(findstring gcc, $(CC))) + CC = gcc + CCC = g++ + CXX = g++ + # always use -fPIC - some makefiles are still broken and don't distinguish + # situation when they build shared and static libraries + CFLAGS += -fPIC -Wall -Wno-switch $(GCC_FLAGS_EXTRA) +# OS_LIBS += -L/usr/local/lib -lstdc++ -lg++ -lgcc + endif +endif +### diff --git a/mozilla/security/coreconf/NEC4.2.mk b/mozilla/security/coreconf/NEC4.2.mk new file mode 100644 index 0000000..71d7187 --- /dev/null +++ b/mozilla/security/coreconf/NEC4.2.mk @@ -0,0 +1,68 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +DEFAULT_COMPILER = $(CORE_DEPTH)/build/hcc + +CPU_ARCH = mips + +ifdef NS_USE_GCC +CC = gcc +CCC = g++ +else +CC = $(CORE_DEPTH)/build/hcc +OS_CFLAGS = -Xa -KGnum=0 -KOlimit=4000 +CCC = g++ +endif + +MKSHLIB = $(LD) $(DSO_LDOPTS) +ifdef MAPFILE +# Add LD options to restrict exported symbols to those in the map file +endif +# Change PROCESS to put the mapfile in the correct format for this platform +PROCESS_MAP_FILE = cp $< $@ + +RANLIB = /bin/true + +OS_CFLAGS += $(ODD_CFLAGS) -DSVR4 -D__SVR4 -DNEC -Dnec_ews -DHAVE_STRERROR +OS_LIBS = -lsocket -lnsl -ldl $(LDOPTIONS) +LDOPTIONS = -lc -L/usr/ucblib -lucb + +NOSUCHFILE = /nec-rm-f-sucks + +DSO_LDOPTS = -G diff --git a/mozilla/security/coreconf/NetBSD.mk b/mozilla/security/coreconf/NetBSD.mk new file mode 100644 index 0000000..551f10f --- /dev/null +++ b/mozilla/security/coreconf/NetBSD.mk @@ -0,0 +1,87 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +DEFAULT_COMPILER = gcc +CC = gcc +CCC = g++ +RANLIB = ranlib + +CPU_ARCH := $(shell uname -p) +ifeq ($(CPU_ARCH),i386) +OS_REL_CFLAGS = -Di386 +CPU_ARCH = x86 +endif + +ifndef OBJECT_FMT +OBJECT_FMT := $(shell if echo __ELF__ | $${CC:-cc} -E - | grep -q __ELF__ ; then echo a.out ; else echo ELF ; fi) +endif + +ifeq ($(OBJECT_FMT),ELF) +DLL_SUFFIX = so +else +DLL_SUFFIX = so.1.0 +endif + +OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -ansi -Wall -Wno-switch -pipe -DNETBSD -Dunix -DHAVE_STRERROR -DHAVE_BSD_FLOCK + +OS_LIBS = -lcompat + +ARCH = netbsd + +DSO_CFLAGS = -fPIC -DPIC +DSO_LDOPTS = -shared +ifeq ($(OBJECT_FMT),ELF) +DSO_LDOPTS += -Wl,-soname,lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX) +endif + +ifdef LIBRUNPATH +DSO_LDOPTS += -Wl,-R$(LIBRUNPATH) +endif + +MKSHLIB = $(CC) $(DSO_LDOPTS) +ifdef MAPFILE +# Add LD options to restrict exported symbols to those in the map file +endif +# Change PROCESS to put the mapfile in the correct format for this platform +PROCESS_MAP_FILE = cp $< $@ + + +G++INCLUDES = -I/usr/include/g++ + +INCLUDES += -I/usr/X11R6/include diff --git a/mozilla/security/coreconf/OS2.mk b/mozilla/security/coreconf/OS2.mk new file mode 100644 index 0000000..4dd01a0 --- /dev/null +++ b/mozilla/security/coreconf/OS2.mk @@ -0,0 +1,188 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +MOZ_WIDGET_TOOLKIT = os2 + +# XP_PC is for Window and OS2 on Intel X86 +# XP_OS2 is strictly for OS2 only +XP_DEFINE += -DXP_PC=1 -DXP_OS2=1 + +# Override prefix +LIB_PREFIX = $(NULL) + +# Override suffix in suffix.mk +LIB_SUFFIX = lib +# the DLL_SUFFIX must be uppercase for FIPS mode to work. bugzilla 240784 +DLL_SUFFIX = DLL +PROG_SUFFIX = .exe + + +CCC = gcc +LINK = gcc +AR = emxomfar r $@ +# Keep AR_FLAGS blank so that we do not have to change rules.mk +AR_FLAGS = +RANLIB = @echo OS2 RANLIB +BSDECHO = @echo OS2 BSDECHO +IMPLIB = emximp -o +FILTER = emxexp -o + +# GCC for OS/2 currently predefines these, but we don't want them +DEFINES += -Uunix -U__unix -U__unix__ + +DEFINES += -DTCPV40HDRS + +ifeq ($(MOZ_OS2_HIGH_MEMORY),1) +HIGHMEM_LDFLAG = -Zhigh-mem +endif + +ifndef NO_SHARED_LIB +WRAP_MALLOC_LIB = +WRAP_MALLOC_CFLAGS = +DSO_CFLAGS = +DSO_PIC_CFLAGS = +MKSHLIB = $(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@ +MKCSHLIB = $(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@ +MKSHLIB_FORCE_ALL = +MKSHLIB_UNFORCE_ALL = +DSO_LDOPTS = -Zomf -Zdll -Zmap $(HIGHMEM_LDFLAG) +SHLIB_LDSTARTFILE = +SHLIB_LDENDFILE = +ifdef MAPFILE +MKSHLIB += $(MAPFILE) +endif +PROCESS_MAP_FILE = \ + echo LIBRARY $(LIBRARY_NAME)$(LIBRARY_VERSION) INITINSTANCE TERMINSTANCE > $@; \ + echo PROTMODE >> $@; \ + echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@; \ + echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@; \ + echo EXPORTS >> $@; \ + grep -v ';+' $< | grep -v ';-' | \ + sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' -e 's,\([\t ]*\),\1_,' | \ + awk 'BEGIN {ord=1;} { print($$0 " @" ord " RESIDENTNAME"); ord++;}' >> $@ + +endif #NO_SHARED_LIB + +OS_CFLAGS = -Wall -Wno-unused -Wpointer-arith -Wcast-align -Wno-switch -Zomf -DDEBUG -DTRACING -g + +ifdef BUILD_OPT +ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE)) + OPTIMIZER += -Os -s +else + OPTIMIZER += -O2 -s +endif +DEFINES += -UDEBUG -U_DEBUG -DNDEBUG +DLLFLAGS = -DLL -OUT:$@ -MAP:$(@:.dll=.map) $(HIGHMEM_LDFLAG) +EXEFLAGS = -PMTYPE:VIO -OUT:$@ -MAP:$(@:.exe=.map) -nologo -NOE $(HIGHMEM_LDFLAG) +OBJDIR_TAG = _OPT +else +#OPTIMIZER = -O+ -Oi +DEFINES += -DDEBUG -D_DEBUG -DDEBUGPRINTS #HCT Need += to avoid overidding manifest.mn +DLLFLAGS = -DEBUG -DLL -OUT:$@ -MAP:$(@:.dll=.map) $(HIGHMEM_LDFLAG) +EXEFLAGS = -DEBUG -PMTYPE:VIO -OUT:$@ -MAP:$(@:.exe=.map) -nologo -NOE $(HIGHMEM_LDFLAG) +OBJDIR_TAG = _DBG +LDFLAGS = -DEBUG $(HIGHMEM_LDFLAG) +endif # BUILD_OPT + +# OS/2 use nsinstall that is included in the toolkit. +# since we do not wish to support and maintain 3 version of nsinstall in mozilla, nspr and nss + +ifdef BUILD_TREE +NSINSTALL_DIR = $(BUILD_TREE)/nss +else +NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall +endif +# NSINSTALL = $(NSINSTALL_DIR)/$(OBJDIR_NAME)/nsinstall +NSINSTALL = nsinstall # HCT4OS2 +INSTALL = $(NSINSTALL) + +MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend +MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend +MKDEPENDENCIES = $(OBJDIR_NAME)/depend.mk + +#################################################################### +# +# One can define the makefile variable NSDISTMODE to control +# how files are published to the 'dist' directory. If not +# defined, the default is "install using relative symbolic +# links". The two possible values are "copy", which copies files +# but preserves source mtime, and "absolute_symlink", which +# installs using absolute symbolic links. +# - THIS IS NOT PART OF THE NEW BINARY RELEASE PLAN for 9/30/97 +# - WE'RE KEEPING IT ONLY FOR BACKWARDS COMPATIBILITY +#################################################################### + +ifeq ($(NSDISTMODE),copy) + # copy files, but preserve source mtime + INSTALL = $(NSINSTALL) + INSTALL += -t +else + ifeq ($(NSDISTMODE),absolute_symlink) + # install using absolute symbolic links + INSTALL = $(NSINSTALL) + INSTALL += -L `pwd` + else + # install using relative symbolic links + INSTALL = $(NSINSTALL) + INSTALL += -R + endif +endif + +define MAKE_OBJDIR +if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi +endef + +# +# override the definition of DLL_PREFIX in prefix.mk +# + +ifndef DLL_PREFIX + DLL_PREFIX = $(NULL) +endif + +# +# override the TARGETS defined in ruleset.mk, adding IMPORT_LIBRARY +# +ifndef TARGETS + TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(PROGRAM) +endif + + +ifdef LIBRARY_NAME + IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)$(JDK_DEBUG_SUFFIX).lib +endif + diff --git a/mozilla/security/coreconf/OSF1.mk b/mozilla/security/coreconf/OSF1.mk new file mode 100644 index 0000000..fd52047 --- /dev/null +++ b/mozilla/security/coreconf/OSF1.mk @@ -0,0 +1,80 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# +# The Bourne shell (sh) on OSF1 doesn't handle "set -e" correctly, +# which we use to stop LOOP_OVER_DIRS submakes as soon as any +# submake fails. So we use the Korn shell instead. +# +SHELL = /usr/bin/ksh + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +DEFAULT_COMPILER = cc + +CC = cc +OS_CFLAGS += $(NON_LD_FLAGS) -std1 +CCC = cxx +RANLIB = /bin/true +CPU_ARCH = alpha + +ifdef BUILD_OPT + OPTIMIZER += -Olimit 4000 +endif + +NON_LD_FLAGS += -ieee_with_inexact +OS_CFLAGS += -DOSF1 -D_REENTRANT + +ifeq ($(USE_PTHREADS),1) + OS_CFLAGS += -pthread +endif + +# The command to build a shared library on OSF1. +MKSHLIB += ld -shared -expect_unresolved "*" -soname $(notdir $@) +ifdef MAPFILE +MKSHLIB += -hidden -input $(MAPFILE) +endif +PROCESS_MAP_FILE = grep -v ';+' $< | grep -v ';-' | \ + sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' -e 's,^,-exported_symbol ,' > $@ + +DSO_LDOPTS += -shared + +# required for freebl +USE_64=1 +# this platform name does not use a bit tag due to only having a 64-bit ABI +64BIT_TAG= + diff --git a/mozilla/security/coreconf/OSF1V2.0.mk b/mozilla/security/coreconf/OSF1V2.0.mk new file mode 100644 index 0000000..40751ac --- /dev/null +++ b/mozilla/security/coreconf/OSF1V2.0.mk @@ -0,0 +1,37 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +include $(CORE_DEPTH)/coreconf/OSF1.mk diff --git a/mozilla/security/coreconf/OSF1V3.0.mk b/mozilla/security/coreconf/OSF1V3.0.mk new file mode 100644 index 0000000..40751ac --- /dev/null +++ b/mozilla/security/coreconf/OSF1V3.0.mk @@ -0,0 +1,37 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +include $(CORE_DEPTH)/coreconf/OSF1.mk diff --git a/mozilla/security/coreconf/OSF1V3.2.mk b/mozilla/security/coreconf/OSF1V3.2.mk new file mode 100644 index 0000000..0f677ac --- /dev/null +++ b/mozilla/security/coreconf/OSF1V3.2.mk @@ -0,0 +1,48 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# On OSF1 V3.2, classic nspr is the default (and only) implementation +# strategy. + +# +# Config stuff for DEC OSF/1 V3.2 +# +include $(CORE_DEPTH)/coreconf/OSF1.mk + +ifeq ($(OS_RELEASE),V3.2) + OS_CFLAGS += -DOSF1V3 +endif diff --git a/mozilla/security/coreconf/OSF1V4.0.mk b/mozilla/security/coreconf/OSF1V4.0.mk new file mode 100644 index 0000000..12e6d2d --- /dev/null +++ b/mozilla/security/coreconf/OSF1V4.0.mk @@ -0,0 +1,56 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# On OSF1 V4.0, pthreads is the default implementation strategy. +# Classic nspr is also available. + +ifneq ($(OS_RELEASE),V3.2) + USE_PTHREADS = 1 + ifeq ($(CLASSIC_NSPR), 1) + USE_PTHREADS = + IMPL_STRATEGY := _CLASSIC + endif +endif + +# +# Config stuff for DEC OSF/1 V4.0 +# +include $(CORE_DEPTH)/coreconf/OSF1.mk + +ifeq ($(OS_RELEASE),V4.0) + OS_CFLAGS += -DOSF1V4 +endif diff --git a/mozilla/security/coreconf/OSF1V4.0B.mk b/mozilla/security/coreconf/OSF1V4.0B.mk new file mode 100644 index 0000000..187f5b0 --- /dev/null +++ b/mozilla/security/coreconf/OSF1V4.0B.mk @@ -0,0 +1,37 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +include $(CORE_DEPTH)/coreconf/OSF1V4.0.mk diff --git a/mozilla/security/coreconf/OSF1V4.0D.mk b/mozilla/security/coreconf/OSF1V4.0D.mk new file mode 100644 index 0000000..e154c04 --- /dev/null +++ b/mozilla/security/coreconf/OSF1V4.0D.mk @@ -0,0 +1,41 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +include $(CORE_DEPTH)/coreconf/OSF1V4.0.mk +DEFINES += -DOSF1V4D + +OS_LIBS += -lpthread -lrt + diff --git a/mozilla/security/coreconf/OSF1V5.0.mk b/mozilla/security/coreconf/OSF1V5.0.mk new file mode 100644 index 0000000..a17d369 --- /dev/null +++ b/mozilla/security/coreconf/OSF1V5.0.mk @@ -0,0 +1,52 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# On OSF1 V5.0, pthreads is the default implementation strategy. +# Classic nspr is also available. + +ifneq ($(OS_RELEASE),V3.2) + USE_PTHREADS = 1 + ifeq ($(CLASSIC_NSPR), 1) + USE_PTHREADS = + IMPL_STRATEGY := _CLASSIC + endif +endif + +# +# Config stuff for DEC OSF/1 V5.0 +# +include $(CORE_DEPTH)/coreconf/OSF1.mk diff --git a/mozilla/security/coreconf/OSF1V5.1.mk b/mozilla/security/coreconf/OSF1V5.1.mk new file mode 100644 index 0000000..75c538d --- /dev/null +++ b/mozilla/security/coreconf/OSF1V5.1.mk @@ -0,0 +1,52 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 2001 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# On OSF1 V5.0, pthreads is the default implementation strategy. +# Classic nspr is also available. + +ifneq ($(OS_RELEASE),V3.2) + USE_PTHREADS = 1 + ifeq ($(CLASSIC_NSPR), 1) + USE_PTHREADS = + IMPL_STRATEGY := _CLASSIC + endif +endif + +# +# Config stuff for DEC OSF/1 V5.1 +# +include $(CORE_DEPTH)/coreconf/OSF1.mk diff --git a/mozilla/security/coreconf/OpenBSD.mk b/mozilla/security/coreconf/OpenBSD.mk new file mode 100644 index 0000000..6ec4c34 --- /dev/null +++ b/mozilla/security/coreconf/OpenBSD.mk @@ -0,0 +1,73 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +CC ?= gcc +CXX ?= g++ +DEFAULT_COMPILER = ${CC} +CCC = ${CXX} +RANLIB = ranlib + +CPU_ARCH := $(shell arch -s) +ifeq ($(CPU_ARCH),i386) +OS_REL_CFLAGS = -Di386 +CPU_ARCH = x86 +endif + +ifndef CLASSIC_NSPR +USE_PTHREADS = 1 +DEFINES += -pthread +OS_LIBS += -pthread +DSO_LDOPTS += -pthread +endif + +DLL_SUFFIX = so.1.0 + +OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -ansi -Wall -Wno-switch -pipe -DOPENBSD + +OS_LIBS = + +ARCH = openbsd + +DSO_CFLAGS = -fPIC -DPIC +DSO_LDOPTS = -shared -fPIC -Wl,-soname,lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX) + +MKSHLIB = $(CC) $(DSO_LDOPTS) + +USE_SYSTEM_ZLIB = 1 +ZLIB_LIBS = -lz diff --git a/mozilla/security/coreconf/OpenUNIX.mk b/mozilla/security/coreconf/OpenUNIX.mk new file mode 100644 index 0000000..d48a126 --- /dev/null +++ b/mozilla/security/coreconf/OpenUNIX.mk @@ -0,0 +1,92 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +DEFAULT_COMPILER = gcc + +CC = gcc +OS_CFLAGS += -fPIC +CCC = g++ +CCC += -DPRFSTREAMS_BROKEN -I/usr/gnu/lib/g++-include +# CCC = $(CORE_DEPTH)/build/hcpp +# CCC += +.cpp +w +RANLIB = /bin/true + +# +# -DSCO_PM - Policy Manager AKA: SCO Licensing +# -DSCO - Changes to Netscape source (consistent with AIX, LINUX, etc..) +# -Dsco - Needed for /usr/include/X11/* +# +OS_CFLAGS += -DSCO_SV -DSYSV -D_SVID3 -DHAVE_STRERROR -DSW_THREADS -DSCO_PM -DSCO -Dsco +#OS_LIBS += -lpmapi -lsocket -lc +MKSHLIB = $(LD) +MKSHLIB += $(DSO_LDOPTS) +XINC = /usr/include/X11 +MOTIFLIB += -lXm +INCLUDES += -I$(XINC) +CPU_ARCH = x86 +GFX_ARCH = x +ARCH = sco +LOCALE_MAP = $(CORE_DEPTH)/cmd/xfe/intl/sco.lm +EN_LOCALE = C +DE_LOCALE = de_DE.ISO8859-1 +FR_LOCALE = fr_FR.ISO8859-1 +JP_LOCALE = ja +SJIS_LOCALE = ja_JP.SJIS +KR_LOCALE = ko_KR.EUC +CN_LOCALE = zh +TW_LOCALE = zh +I2_LOCALE = i2 +LOC_LIB_DIR = /usr/lib/X11 +NOSUCHFILE = /solaris-rm-f-sucks +BSDECHO = /bin/echo +ifdef MAPFILE +# Add LD options to restrict exported symbols to those in the map file +endif +# Change PROCESS to put the mapfile in the correct format for this platform +PROCESS_MAP_FILE = cp $< $@ + +# +# These defines are for building unix plugins +# +BUILD_UNIX_PLUGINS = 1 +#DSO_LDOPTS += -b elf -G -z defs +DSO_LDOPTS += -G + +# Used for Java compiler +EXPORT_FLAGS += -W l,-Bexport diff --git a/mozilla/security/coreconf/QNX.mk b/mozilla/security/coreconf/QNX.mk new file mode 100644 index 0000000..315bde4 --- /dev/null +++ b/mozilla/security/coreconf/QNX.mk @@ -0,0 +1,71 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 2001 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +USE_PTHREADS = 1 + +ifeq ($(USE_PTHREADS),1) + IMPL_STRATEGY = _PTH +endif + +CC = qcc +CCC = qcc +RANLIB = ranlib + +DEFAULT_COMPILER = qcc +ifeq ($(OS_TEST),mips) + CPU_ARCH = mips +else + CPU_ARCH = x86 +endif + +MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) +ifdef BUILD_OPT + OPTIMIZER = -O2 +endif + +OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Vgcc_ntox86 -Wall -pipe -DNTO -DHAVE_STRERROR -D_QNX_SOURCE -D_POSIX_C_SOURCE=199506 -D_XOPEN_SOURCE=500 + +ifdef USE_PTHREADS + DEFINES += -D_REENTRANT +endif + +ARCH = QNX + +DSO_CFLAGS = -Wc,-fPIC +DSO_LDOPTS = -shared diff --git a/mozilla/security/coreconf/README b/mozilla/security/coreconf/README new file mode 100644 index 0000000..987a458 --- /dev/null +++ b/mozilla/security/coreconf/README @@ -0,0 +1,561 @@ +OVERVIEW of "ns/coreconf": + + This README file is an attempt to provide the reader with a simple + synopsis of the "ns/coreconf" build system which was originally + fundamentally designed and built to accomodate Netscape's binary + release model. Wherever possible, an attempt has been made to + comply with the NSPR 2.0 build system, including mimicing the + compiler/linker flags, and directory naming structure. The reader + should keep in mind that the system builds binary releases of + header files, class files, libraries, and executables on numerous + flavors of UNIX and Windows operating systems. Unfortunately, + no serious attempt has ever been made to incorporate an ability to + generate cross-platform binaries on an Apple MacIntosh platform. + + Note that this file will not attempt to redefine or document the + architecture of this system. However, documents on this subject + are available at the following URL: + + http://warp/hardcore/prj-ttools/specs/release/index.html + + + +DEPENDENCIES of "ns/coreconf": + + The "ns/coreconf" build system requires the specified versions of + the following platform-dependent tools: + + UNIX Platforms: + -------------- + gmake (version 3.74 or later) + perl 4.0 (NOTE: perl 5.003 or later recommended) + uname + + Windows Platforms: + ----------------- + gmake 3.74 (must use hacked Netscape version) + shmsdos.exe (contained in Netscape gmake.exe) + nsinstall.exe (contained in Netscape gmake.exe) + perl.exe (version 4.0 for everything except testing; + NOTE: MKS toolkit perl 5.002 is broken) + perl5.exe (for testing; + NOTE: perl 5.003 or later recommended; + MKS toolkit perl 5.002 is broken) + uname.exe (use nstools version) + +ENHANCEMENTS to "ns/coreconf": + + With the advent of Certificate Server 4.0 using the ns/coreconf + build system, several changes had to be made to enhance + ns/coreconf support for building Java/JNI classes/programs, as + well as libraries slated to be released as binaries. While the + following may not represent an exhaustive list of these changes, + it does attempt to be at least somewhat comprehensive: + + (1) During the course of these enhancements, a total of + four files have been modified, and four new files have + been added. + + The following files have been modified: + + - command.mk: removed old definition of JAR + + - config.mk: added include statement of new + "jdk.mk" file + + - ruleset.mk: allowed the $(MKPROG) variable to be + overridden by supplying it with a + default value of $(CC); augmented + numerous definitions to enhance + ability of ns/coreconf to produce + a more robust set of libraries; + added some JNI definitions; PACKAGE + definition may be overridden by new + "jdk.mk" file + + - rules.mk: separated the compile phase of a + program from the link phase of a + program such that a developer can + now strictly override program linkage + by simply supplying a $(MKPROG) + variable; augmented NETLIBDEPTH + to use CORE_DEPTH but retain backward + compatibility; added JNI section; + modified .PRECIOUS rule; + + The following files have been added: + + - README: this file; an ASCII-based text + document used to summarize the + ns/coreconf build system and + suitable (paginated) for printing + + - jdk.mk: a file comprising most (if not all) + of the default Java related build + information; the definitions in this + file are only included if NS_USE_JDK + has been defined + + - jniregen.pl: a perl script used to create a + dependency for when JNI files should + be regenerated (based upon any change + to the ".class" file from which the + ".h" file was originally generated) + + - outofdate.pl: a perl script used to create a + dependency for when ".class" files + should be regenerated (based upon + any change to the ".java" file + from which the ".class" file was + originally generated) + + (2) As stated above, the ns/coreconf build system now separates + the link phase of a program from its compilation phase. + While ns/coreconf still works exactly as it used to because + the $(MKPROG) variable is assigned $(CC) by default, a developer + may now override this behavior by simply supplying their + own unique value for $(MKPROG) on every platform. This allows + a program compiled with $(CC) to link with external libraries + that may contain "C++" linkage. Before this change, a + programmer would need to reference their own local copy of + rules.mk (see the ns/sectools/cmd/pk12util program for + an example of how this used to be accomplished). + + (3) Currently, the ns/coreconf build system differs from the + NSPR 2.0 build system which utilizes an "_s" to denote + static libraries from import libraries. In fact, the + ns/coreconf build system adds no prefixes or suffixes to + distinguish one version of static libraries from another. + Note that both the ns/coreconf build system as well as the + NSPR 2.0 build system do nothing to provide a method of + distinguishing 16-bit from 32-bit static libraries on the + same machine, either, since: + + a) this might only provide difficulty during + development, since static libraries always + need to be embedded within a program + (note this is highly unlikely, since libraries + for different platforms are subdivided via + a well-known subdirectory structure, and + a developer may use multiple trees for + development), + + b) this maintains backwards compatibility, + something very important since no legacy + programs will need to change their link phase, and + + c) Netscape as a company has dropped any plans + of future development of 16-bit products. + + (4) Since several members of the Hardcore Security group did + not favor NSPR 2.0's solution of adding an "_s" to static + libraries on Windows platforms as a method to distinguish + them from their import library cousins, a different solution + was proposed and has been recently implemented for ns/coreconf: + + - a 16 has been added as a suffix to both dynamic and + import libraries built on 16-bit Windows platforms + + - a 32 has been added as a suffix to both dynamic and + import libraries built on 32-bit Windows platforms + + Since the HCL release process currently only contains a + single instance of building a dynamic library, + ns/security/lib/fortcrypt/fort12.dll, the impact of this + change should be relatively small. (Note: HCL was the + old name of NSS.) + + It should be noted that although this would additionally + limit the 8.3 namespace on 16-bit platforms, it is highly + unlikely that any future development will be performed on + this platform. + + (5) The $(LIBRARY_VERSION) tag has been added to all non-static + libraries created on UNIX operating systems to alleviate + any future confusion for binary releases which utilize this + tag. Again, it should be noted that this tag is only + utilized on non-static libraries, since more than one + version of the library may need to exist simultaneously + if multiple products are utilized. + + Currently, only one HCL released library utilizes this tag: + + ns/security/lib/fortcrypt/fort12.a + (e. g. - in this library, the tag has been set to '12') + + Again, it should be noted that although this would + additionally limit the 8.3 namespace on 16-bit platforms, + it is highly unlikely that any future development will be + performed on this platform. + + (6) The $(JDK_DEBUG_SUFFIX) extension has been added to all + library and program names to support debug versions of + Java programs (e. g. - java_g, javac_g, etc). + + Once again, it should be noted that although this would + additionally limit the 8.3 namespace on 16-bit platforms, + it is highly unlikely that any future Java development + will be performed on this platform. + + (7) Most (if not all) default definitions for java have been + encapsulated within their own file, jdk.mk, which is + always included by default in ns/coreconf/config.mk. + However, the definitions within this file are only ever + activated if NS_USE_JDK has been set to be 1. + + + (8) Two perl scripts (jniregen.pl and outofdate.pl) have been + added to the system to foster a more robust development + environment for composing Java and JNI programs + utilizing the ns/coreconf build system. Both of these + perl scripts are related to resolving dependencies which + can not be accomplished through normal makefile dependencies. + + (9) This file, README, was created in an attempt to allow + developers who have familiarity with ns/coreconf a simple + roadmap for what has changed, as well as a top-level view of + what comprises ns/coreconf. This file was written in + ASCII (rather than HTML) primarily to promote simple + paginated printing. + +OVERVIEW of "config.mk": + + This file contains the configuration information necessary to + build each "Core Components" source module: + + include file name Purpose + =================== ======================================= + arch.mk source and release tags + + command.mk default command macros + (NOTE: may be overridden in $(OS_CONFIG).mk) + + $(OS_CONFIG).mk -specific macros + (dependent upon tags) + + tree.mk release tags + (dependent upon tags) + + module.mk source and release tags + (NOTE: A component is also called a module + or a subsystem. This file is dependent upon + $(MODULE) being defined on the command + line, as an environment variable, or in + individual makefiles, or more + appropriately, manifest.mn) + + version.mk release tags + (dependent upon $(MODULE) being defined on + the command line, as an environment variable, + or in individual makefiles, or more + appropriately, manifest.mn) + + location.mk macros to figure out binary code location + (dependent upon tags) + + source.mk -specific source path + (dependent upon , + , , and + tags) + + headers.mk include switch for support header files + (dependent upon , , , + and tags) + + prefix.mk compute program prefixes + + suffix.mk compute program suffixes + (dependent upon tags) + + jdk.mk define JDK + (dependent upon , + , and tags) + + ruleset.mk Master "Core Components" rule set + (should always be the last file + included by config.mk) + + + +OVERVIEW of "rules.mk": + + The "rules.mk" file consists of four sections. The first section + contains the "master" build rules for all binary releases. While + this section can (and should) largely be thought of as "language" + independent, it does utilize the "perl" scripting language to + perform both the "import" and "release" of binary modules. + + The rules which dwell in this section and their purpose: + + + CATEGORY/rule:: Purpose + =================== ======================================= + + GENERAL + ------- + all:: "default" all-encompassing rule which + performs "export libs program install" + + export:: recursively copy specified + cross-platform header files to the + $(SOURCE_XPHEADERS_DIR) directory; + recursively copy specified + machine-dependent header files to the + $(SOURCE_MDHEADERS_DIR) directory; + although all rules can be written to + repetively "chain" into other sections, + this rule is the most commonly used + rule to "chain" into other sections + such as Java providing a simple + mechanism which allows no need for + developers to memorize specialized + rules + + libs:: recursively build + static (archival) $(LIBRARY), shared + (dynamic link) $(SHARED_LIBRARY), + and/or import $(IMPORT_LIBRARY) + libraries + + program:: recursively build $(PROGRAM) + executable + + install:: recursively copy all libraries to + $(SOURCE_LIB_DIR) directory; + recursively copy all executables to + $(SOURCE_BIN_DIR) directory + + clean:: remove all files specified in the + $(ALL_TRASH) variable + + clobber:: synonym for "clean::" rule + + realclean:: remove all files specified by + $(wildcard *.OBJ), dist, and in + the $(ALL_TRASH) variable + + clobber_all:: synonym for "realclean::" rule + + private_export:: recursively copy specified + cross-platform header files to the + $(SOURCE_XPPRIVATE_DIR) directory + + + IMPORT + ------ + import:: uses perl script to retrieve specified + VERSION of the binary release from + $(RELEASE_TREE) + + RELEASE + ------- + release_clean:: remove all files from the + $(SOURCE_RELEASE_PREFIX) directory + + release:: place specified VERSION of the + binary release in the appropriate + $(RELEASE_TREE) directory + + release_export:: recursively copy specified + cross-platform header files to the + $(SOURCE_XPHEADERS_DIR)/include + directory + + release_md:: recursively copy all libraries to + $(SOURCE_RELEASE_PREFIX)/ + $(SOURCE_RELEASE_LIB_DIR) directory; + recursively copy all executables to + $(SOURCE_RELEASE_PREFIX)/ + $(SOURCE_RELEASE_BIN_DIR) directory + + release_jars:: use perl script to package appropriate + files in the $(XPCLASS_JAR), + $(XPHEADER_JAR), $(MDHEADER_JAR), and + $(MDBINARY_JAR) jar files + + release_cpdistdir:: use perl script to copy the + $(XPCLASS_JAR), $(XPHEADER_JAR), + $(MDHEADER_JAR), and $(MDBINARY_JAR) + jar files to the specified VERSION + of the $(RELEASE_TREE) directory + + + + TOOLS and AUTOMATION + -------------------- + platform:: tool used to display the platform name + as composed within the "arch.mk" file + + autobuild:: automation rule used by "Bonsai" and + "Tinderbox" to automatically generate + binary releases on various platforms + + tests:: automation tool used to run the + "regress" and "reporter" tools + on various regression test suites + + The second section of "rules.mk" primarily contains several + "language" dependent build rules for binary releases. These are + generally "computed" rules (created on the "fly"), and include + rules used by "C", "C++", assembly, the preprocessor, perl, and + the shell. + + The rules which dwell in this section and their purpose: + + + CATEGORY/rule:: Purpose + =================== ============================= + + LIBRARIES + --------- + $(LIBRARY): build the static library + specified by the $(LIBRARY) + variable + + $(IMPORT_LIBRARY): build the import library + specified by the + $(IMPORT_LIBRARY) variable + + $(SHARED_LIBRARY): build the shared + (dynamic link) library + specified by the + $(SHARED_LIBRARY) variable + + + PROGRAMS + -------- + $(PROGRAM): build the binary executable + specified by the $(PROGRAM) + rule + + $(OBJDIR)/ + $(PROG_PREFIX)%.pure: build the "purified" binary + executable specified by this + rule + + + OBJECTS + ------- + $(OBJDIR)/ + $(PROG_PREFIX)%$(OBJ_SUFFIX): build the object file + associated with the + makefile rule dependency: + + %.c = C file + %.cpp = C++ file + %.cc = C++ file + %.s = assembly file + %.S = assembly file + + $(OBJDIR)/ + $(PROG_PREFIX)%: (NOTE: deprecated rule) + build the object file + associated with the + makefile rule dependency: + + %.cpp = C++ file + + MISCELLANEOUS + ------------- + $(DIRS):: specifies a helper method + used by $(LOOP_THROUGH_DIRS) + to recursively change + directories and invoke + $(MAKE) + + %.i: build the preprocessor file + associated with the + makefile rule dependency: + + %.c = C file + %.cpp = C++ file + + %: process the specified file + using the method associated + with the makefile rule + dependency: + + %.pl = perl script + %.sh = shell script + + alltags: tool used to recursively + create a "ctags"-style + file for reference + + The third section of "rules.mk' primarily contains several JAVA + "language" build rules for binary releases. These are also + generally "computed" rules (created on the "fly"). + + The rules which dwell in this section and their purpose: + + + CATEGORY/rule:: Purpose + =================== ============================= + $(JAVA_DESTPATH):: create directory specified + as the Java destination path + for where classes are + deposited + + $(JAVA_DESTPATH)/$(PACKAGE):: create directories specified + within the $(PACKAGE) + variable + + $(JMCSRCDIR):: create directory specified + as the JMC destination path + + $(JRI_HEADER_CFILES): used to generate/regenerate + JRI header files for "C" + + $(JRI_STUB_CFILES): used to generate/regenerate + JRI stub files for "C" + + $(JNI_HEADERS): used to generate/regenerate + JNI header files for "C" + + The fourth section of "rules.mk" primarily contains miscellaneous + build rules for binary releases. Many of these rules are here to + create new subdirectories, manage dependencies, and/or override + standard gmake "Makefile" rules. + + The rules which dwell in this section and their purpose: + + + CATEGORY/rule:: Purpose + =================== ============================= + + $(PUBLIC_EXPORT_DIR):: create directory used to + house public "C" header files + + $(PRIVATE_EXPORT_DIR):: create directory used to + house private "C" header + files + + $(SOURCE_XP_DIR)/ + release/include:: create directory used to + house "C" header files + contained in a release + + $(MKDEPENDENCIES):: for UNIX systems, create + a directory used to house + dependencies and utilize + the $(MKDEPEND) rule to + create them + + $(MKDEPEND):: cd to the dependency + directory and create them + + depend:: if $(OBJS) exist, perform the + $(MKDEPEND) rule followed by + the $(MKDEPENDENCIES) rule + + dependclean:: remove all files contained + in the dependency repository + + .DEFAULT: standard gmake rule + + .SUFFIXES: standard gmake rule + + .PRECIOUS: standard gmake rule + + .PHONY: standard gmake rule + diff --git a/mozilla/security/coreconf/RISCOS.mk b/mozilla/security/coreconf/RISCOS.mk new file mode 100644 index 0000000..29f4203 --- /dev/null +++ b/mozilla/security/coreconf/RISCOS.mk @@ -0,0 +1,55 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Peter Naulls +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +LIB_SUFFIX = a +DLL_SUFFIX = so +AR = ar cr $@ +LDOPTS += -L$(SOURCE_LIB_DIR) +MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) + +OS_RELEASE = +OS_TARGET = RISCOS + +DSO_CFLAGS = -fPIC +DSO_LDOPTS = -shared + +ifdef BUILD_OPT + OPTIMIZER = -O3 +endif diff --git a/mozilla/security/coreconf/ReliantUNIX.mk b/mozilla/security/coreconf/ReliantUNIX.mk new file mode 100644 index 0000000..671132a --- /dev/null +++ b/mozilla/security/coreconf/ReliantUNIX.mk @@ -0,0 +1,90 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +DEFAULT_COMPILER = cc + +ifdef NS_USE_GCC + ## gcc-2.7.2 homebrewn + CC = gcc + CCC = g++ + AS = $(CC) + ASFLAGS += -x assembler-with-cpp + LD = gld + ODD_CFLAGS = -pipe -Wall -Wno-format -Wno-switch + ifdef BUILD_OPT + OPTIMIZER += -O6 + endif + MKSHLIB = $(LD) + MKSHLIB += -G -h $(@:$(OBJDIR)/%.so=%.so) + DSO_LDOPTS += -G -Xlinker -Blargedynsym +else + ## native compiler (CDS++ 1.0) +# CC = /usr/bin/cc + CC = cc + CCC = /usr/bin/CC + AS = /usr/bin/cc + ODD_CFLAGS = + ifdef BUILD_OPT + OPTIMIZER += -O -F Olimit,4000 + endif + MKSHLIB = $(CC) + MKSHLIB += -G -h $(@:$(OBJDIR)/%.so=%.so) + DSO_LDOPTS += -G -W l,-Blargedynsym +endif +ifdef MAPFILE +# Add LD options to restrict exported symbols to those in the map file +endif +# Change PROCESS to put the mapfile in the correct format for this platform +PROCESS_MAP_FILE = cp $< $@ + +NOSUCHFILE = /sni-rm-f-sucks +ODD_CFLAGS += -DSVR4 -DSNI -DRELIANTUNIX +CPU_ARCH = mips +RANLIB = /bin/true + +# For purify +NOMD_OS_CFLAGS += $(ODD_CFLAGS) + +# we do not have -MDupdate ... +OS_CFLAGS += $(NOMD_OS_CFLAGS) +OS_LIBS += -lsocket -lnsl -lresolv -lgen -ldl -lc /usr/ucblib/libucb.a + +ifdef DSO_BACKEND + DSO_LDOPTS += -h $(DSO_NAME) +endif diff --git a/mozilla/security/coreconf/ReliantUNIX5.4.mk b/mozilla/security/coreconf/ReliantUNIX5.4.mk new file mode 100644 index 0000000..6b35607 --- /dev/null +++ b/mozilla/security/coreconf/ReliantUNIX5.4.mk @@ -0,0 +1,37 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +include $(CORE_DEPTH)/coreconf/ReliantUNIX.mk diff --git a/mozilla/security/coreconf/SCOOS5.0.mk b/mozilla/security/coreconf/SCOOS5.0.mk new file mode 100644 index 0000000..000dea6 --- /dev/null +++ b/mozilla/security/coreconf/SCOOS5.0.mk @@ -0,0 +1,38 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/SCO_SV3.2.mk diff --git a/mozilla/security/coreconf/SCO_SV3.2.mk b/mozilla/security/coreconf/SCO_SV3.2.mk new file mode 100644 index 0000000..b2e4efc --- /dev/null +++ b/mozilla/security/coreconf/SCO_SV3.2.mk @@ -0,0 +1,92 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +DEFAULT_COMPILER = cc + +CC = cc +OS_CFLAGS += -b elf -KPIC +CCC = g++ +CCC += -b elf -DPRFSTREAMS_BROKEN -I/usr/local/lib/g++-include +# CCC = $(CORE_DEPTH)/build/hcpp +# CCC += +.cpp +w +RANLIB = /bin/true + +# +# -DSCO_PM - Policy Manager AKA: SCO Licensing +# -DSCO - Changes to Netscape source (consistent with AIX, LINUX, etc..) +# -Dsco - Needed for /usr/include/X11/* +# +OS_CFLAGS += -DSCO_SV -DSYSV -D_SVID3 -DHAVE_STRERROR -DSW_THREADS -DSCO_PM -DSCO -Dsco +#OS_LIBS += -lpmapi -lsocket -lc +MKSHLIB = $(LD) +MKSHLIB += $(DSO_LDOPTS) +XINC = /usr/include/X11 +MOTIFLIB += -lXm +INCLUDES += -I$(XINC) +CPU_ARCH = x86 +GFX_ARCH = x +ARCH = sco +LOCALE_MAP = $(CORE_DEPTH)/cmd/xfe/intl/sco.lm +EN_LOCALE = C +DE_LOCALE = de_DE.ISO8859-1 +FR_LOCALE = fr_FR.ISO8859-1 +JP_LOCALE = ja +SJIS_LOCALE = ja_JP.SJIS +KR_LOCALE = ko_KR.EUC +CN_LOCALE = zh +TW_LOCALE = zh +I2_LOCALE = i2 +LOC_LIB_DIR = /usr/lib/X11 +NOSUCHFILE = /solaris-rm-f-sucks +BSDECHO = /bin/echo +ifdef MAPFILE +# Add LD options to restrict exported symbols to those in the map file +endif +# Change PROCESS to put the mapfile in the correct format for this platform +PROCESS_MAP_FILE = cp $< $@ + +# +# These defines are for building unix plugins +# +BUILD_UNIX_PLUGINS = 1 +#DSO_LDOPTS += -b elf -G -z defs +DSO_LDOPTS += -b elf -G + +# Used for Java compiler +EXPORT_FLAGS += -W l,-Bexport diff --git a/mozilla/security/coreconf/SunOS4.1.3_U1.mk b/mozilla/security/coreconf/SunOS4.1.3_U1.mk new file mode 100644 index 0000000..146d46b --- /dev/null +++ b/mozilla/security/coreconf/SunOS4.1.3_U1.mk @@ -0,0 +1,60 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +DEFAULT_COMPILER = cc + +INCLUDES += -I/usr/dt/include -I/usr/openwin/include -I/home/motif/usr/include + +# SunOS 4 _requires_ that shared libs have a version number. +# XXX FIXME: Version number should use NSPR_VERSION_NUMBER? +DLL_SUFFIX = so.1.0 +CC = gcc +RANLIB = ranlib +CPU_ARCH = sparc + +# Purify doesn't like -MDupdate +NOMD_OS_CFLAGS += -Wall -Wno-format -Wno-switch -DSUNOS4 +OS_CFLAGS += $(DSO_CFLAGS) $(NOMD_OS_CFLAGS) -MDupdate $(DEPENDENCIES) +MKSHLIB = $(LD) +MKSHLIB += $(DSO_LDOPTS) +NOSUCHFILE = /solaris-rm-f-sucks +DSO_LDOPTS = + +# -fPIC generates position-independent code for use in a shared library. +DSO_CFLAGS += -fPIC diff --git a/mozilla/security/coreconf/SunOS5.10.mk b/mozilla/security/coreconf/SunOS5.10.mk new file mode 100644 index 0000000..935374b --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.10.mk @@ -0,0 +1,46 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS += -D_SVID_GETTOD + +include $(CORE_DEPTH)/coreconf/SunOS5.mk + +ifeq ($(OS_RELEASE),5.10) + OS_DEFINES += -DSOLARIS2_10 +endif + +OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/mozilla/security/coreconf/SunOS5.10_i86pc.mk b/mozilla/security/coreconf/SunOS5.10_i86pc.mk new file mode 100755 index 0000000..bb3b413 --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.10_i86pc.mk @@ -0,0 +1,53 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS = -D_SVID_GETTOD + +include $(CORE_DEPTH)/coreconf/SunOS5.mk + +ifeq ($(USE_64),1) + CPU_ARCH = x86_64 +else + CPU_ARCH = x86 + OS_DEFINES += -Di386 +endif + +ifeq ($(OS_RELEASE),5.10_i86pc) + OS_DEFINES += -DSOLARIS2_10 +endif + +OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/mozilla/security/coreconf/SunOS5.11.mk b/mozilla/security/coreconf/SunOS5.11.mk new file mode 100644 index 0000000..5bcf4e8 --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.11.mk @@ -0,0 +1,46 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS += -D_SVID_GETTOD + +include $(CORE_DEPTH)/coreconf/SunOS5.mk + +ifeq ($(OS_RELEASE),5.11) + OS_DEFINES += -DSOLARIS2_11 +endif + +OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/mozilla/security/coreconf/SunOS5.11_i86pc.mk b/mozilla/security/coreconf/SunOS5.11_i86pc.mk new file mode 100644 index 0000000..1237f90 --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.11_i86pc.mk @@ -0,0 +1,53 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS = -D_SVID_GETTOD + +include $(CORE_DEPTH)/coreconf/SunOS5.mk + +ifeq ($(USE_64),1) + CPU_ARCH = x86_64 +else + CPU_ARCH = x86 + OS_DEFINES += -Di386 +endif + +ifeq ($(OS_RELEASE),5.11_i86pc) + OS_DEFINES += -DSOLARIS2_11 +endif + +OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/mozilla/security/coreconf/SunOS5.3.mk b/mozilla/security/coreconf/SunOS5.3.mk new file mode 100644 index 0000000..748c2e6 --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.3.mk @@ -0,0 +1,40 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS = + +include $(CORE_DEPTH)/coreconf/SunOS5.mk diff --git a/mozilla/security/coreconf/SunOS5.4.mk b/mozilla/security/coreconf/SunOS5.4.mk new file mode 100644 index 0000000..748c2e6 --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.4.mk @@ -0,0 +1,40 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS = + +include $(CORE_DEPTH)/coreconf/SunOS5.mk diff --git a/mozilla/security/coreconf/SunOS5.4_i86pc.mk b/mozilla/security/coreconf/SunOS5.4_i86pc.mk new file mode 100644 index 0000000..53c0138 --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.4_i86pc.mk @@ -0,0 +1,69 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +DEFAULT_COMPILER = cc + +ifdef NS_USE_GCC + CC = gcc + OS_CFLAGS += -Wall -Wno-format -Wno-switch + CCC = g++ + CCC += -Wall -Wno-format + ASFLAGS += -x assembler-with-cpp + OS_CFLAGS += $(NOMD_OS_CFLAGS) + ifdef USE_MDUPDATE + OS_CFLAGS += -MDupdate $(DEPENDENCIES) + endif +else + CC = cc + CCC = CC + ASFLAGS += -Wa,-P + OS_CFLAGS += $(NOMD_OS_CFLAGS) +endif + +CPU_ARCH = x86 + +MKSHLIB = $(LD) +MKSHLIB += $(DSO_LDOPTS) +NOSUCHFILE = /solx86-rm-f-sucks +RANLIB = echo + +# for purify +NOMD_OS_CFLAGS += -DSVR4 -DSYSV -D_REENTRANT -DSOLARIS -D__svr4__ -Di386 + +DSO_LDOPTS += -G diff --git a/mozilla/security/coreconf/SunOS5.5.1.mk b/mozilla/security/coreconf/SunOS5.5.1.mk new file mode 100644 index 0000000..330fd12 --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.5.1.mk @@ -0,0 +1,46 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS += -D_SVID_GETTOD + +include $(CORE_DEPTH)/coreconf/SunOS5.mk + +ifeq ($(OS_RELEASE),5.5.1) + OS_DEFINES += -DSOLARIS2_5 +endif + +OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/mozilla/security/coreconf/SunOS5.5.1_i86pc.mk b/mozilla/security/coreconf/SunOS5.5.1_i86pc.mk new file mode 100644 index 0000000..87daae9 --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.5.1_i86pc.mk @@ -0,0 +1,48 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS = -D_SVID_GETTOD + +include $(CORE_DEPTH)/coreconf/SunOS5.mk + +CPU_ARCH = x86 +ARCHFLAG = +OS_DEFINES += -Di386 + +ifeq ($(OS_RELEASE),5.5.1_i86pc) + OS_DEFINES += -DSOLARIS2_5 +endif diff --git a/mozilla/security/coreconf/SunOS5.5.mk b/mozilla/security/coreconf/SunOS5.5.mk new file mode 100644 index 0000000..5c00867 --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.5.mk @@ -0,0 +1,44 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS += -D_SVID_GETTOD + +include $(CORE_DEPTH)/coreconf/SunOS5.mk + +ifeq ($(OS_RELEASE),5.5) + OS_DEFINES += -DSOLARIS2_5 +endif diff --git a/mozilla/security/coreconf/SunOS5.6.mk b/mozilla/security/coreconf/SunOS5.6.mk new file mode 100644 index 0000000..de10820 --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.6.mk @@ -0,0 +1,46 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS += -D_SVID_GETTOD + +include $(CORE_DEPTH)/coreconf/SunOS5.mk + +ifeq ($(OS_RELEASE),5.6) + OS_DEFINES += -DSOLARIS2_6 +endif + +OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/mozilla/security/coreconf/SunOS5.6_i86pc.mk b/mozilla/security/coreconf/SunOS5.6_i86pc.mk new file mode 100644 index 0000000..c87f249 --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.6_i86pc.mk @@ -0,0 +1,48 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS = -D_SVID_GETTOD + +include $(CORE_DEPTH)/coreconf/SunOS5.mk + +CPU_ARCH = x86 +ARCHFLAG = +OS_DEFINES += -Di386 + +ifeq ($(OS_RELEASE),5.6_i86pc) + OS_DEFINES += -DSOLARIS2_6 +endif diff --git a/mozilla/security/coreconf/SunOS5.7.mk b/mozilla/security/coreconf/SunOS5.7.mk new file mode 100644 index 0000000..55b50bb --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.7.mk @@ -0,0 +1,46 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS += -D_SVID_GETTOD + +include $(CORE_DEPTH)/coreconf/SunOS5.mk + +ifeq ($(OS_RELEASE),5.7) + OS_DEFINES += -DSOLARIS2_7 +endif + +OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/mozilla/security/coreconf/SunOS5.7_i86pc.mk b/mozilla/security/coreconf/SunOS5.7_i86pc.mk new file mode 100644 index 0000000..f78778f --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.7_i86pc.mk @@ -0,0 +1,50 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS = -D_SVID_GETTOD + +include $(CORE_DEPTH)/coreconf/SunOS5.mk + +CPU_ARCH = x86 +ARCHFLAG = +OS_DEFINES += -Di386 + +ifeq ($(OS_RELEASE),5.7_i86pc) + OS_DEFINES += -DSOLARIS2_7 +endif + +OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/mozilla/security/coreconf/SunOS5.8.mk b/mozilla/security/coreconf/SunOS5.8.mk new file mode 100644 index 0000000..2695c80 --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.8.mk @@ -0,0 +1,46 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS += -D_SVID_GETTOD + +include $(CORE_DEPTH)/coreconf/SunOS5.mk + +ifeq ($(OS_RELEASE),5.8) + OS_DEFINES += -DSOLARIS2_8 +endif + +OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/mozilla/security/coreconf/SunOS5.8_i86pc.mk b/mozilla/security/coreconf/SunOS5.8_i86pc.mk new file mode 100644 index 0000000..c4ba971 --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.8_i86pc.mk @@ -0,0 +1,50 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS = -D_SVID_GETTOD + +include $(CORE_DEPTH)/coreconf/SunOS5.mk + +CPU_ARCH = x86 +ARCHFLAG = +OS_DEFINES += -Di386 + +ifeq ($(OS_RELEASE),5.8_i86pc) + OS_DEFINES += -DSOLARIS2_8 +endif + +OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/mozilla/security/coreconf/SunOS5.9.mk b/mozilla/security/coreconf/SunOS5.9.mk new file mode 100755 index 0000000..8c9be20 --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.9.mk @@ -0,0 +1,46 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS += -D_SVID_GETTOD + +include $(CORE_DEPTH)/coreconf/SunOS5.mk + +ifeq ($(OS_RELEASE),5.9) + OS_DEFINES += -DSOLARIS2_9 +endif + +OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/mozilla/security/coreconf/SunOS5.9_i86pc.mk b/mozilla/security/coreconf/SunOS5.9_i86pc.mk new file mode 100755 index 0000000..d2bcaf4 --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.9_i86pc.mk @@ -0,0 +1,50 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +SOL_CFLAGS = -D_SVID_GETTOD + +include $(CORE_DEPTH)/coreconf/SunOS5.mk + +CPU_ARCH = x86 +ARCHFLAG = +OS_DEFINES += -Di386 + +ifeq ($(OS_RELEASE),5.9_i86pc) + OS_DEFINES += -DSOLARIS2_9 +endif + +OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/mozilla/security/coreconf/SunOS5.mk b/mozilla/security/coreconf/SunOS5.mk new file mode 100644 index 0000000..c3f8e18 --- /dev/null +++ b/mozilla/security/coreconf/SunOS5.mk @@ -0,0 +1,180 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +# +# Temporary define for the Client; to be removed when binary release is used +# +ifdef MOZILLA_CLIENT + ifndef NS_USE_NATIVE + NS_USE_GCC = 1 + endif +endif + +# Sun's WorkShop defines v8, v8plus and v9 architectures. +# gcc on Solaris defines v8 and v9 "cpus". +# gcc's v9 is equivalent to Workshop's v8plus. +# gcc's -m64 is equivalent to Workshop's v9 + +ifeq ($(USE_64), 1) + ifdef NS_USE_GCC + ARCHFLAG=-m64 + else + ifeq ($(OS_TEST),i86pc) + ARCHFLAG=-xarch=amd64 + else + ARCHFLAG=-xarch=v9 + endif + endif +else + ifneq ($(OS_TEST),i86pc) + ifdef NS_USE_GCC + ARCHFLAG=-mcpu=v8 + else + ARCHFLAG=-xarch=v8 + endif + endif +endif + +DEFAULT_COMPILER = cc + +ifdef NS_USE_GCC + CC = gcc + OS_CFLAGS += -Wall -Wno-format -Werror-implicit-function-declaration -Wno-switch + CCC = g++ + CCC += -Wall -Wno-format + ASFLAGS += -x assembler-with-cpp + OS_CFLAGS += $(NOMD_OS_CFLAGS) $(ARCHFLAG) + ifdef USE_MDUPDATE + OS_CFLAGS += -MDupdate $(DEPENDENCIES) + endif + ifdef BUILD_OPT + OPTIMIZER = -O2 + # Enable this for accurate dtrace profiling + # OPTIMIZER += -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer + endif +else + CC = cc + CCC = CC + ASFLAGS += -Wa,-P + OS_CFLAGS += $(NOMD_OS_CFLAGS) $(ARCHFLAG) + ifndef BUILD_OPT + OS_CFLAGS += -xs + else + OPTIMIZER = -xO4 + endif + ifdef USE_TCOV + CC += -xprofile=tcov + CCC += -xprofile=tcov + endif +endif + +INCLUDES += -I/usr/dt/include -I/usr/openwin/include + +RANLIB = echo +CPU_ARCH = sparc +OS_DEFINES += -DSVR4 -DSYSV -D__svr4 -D__svr4__ -DSOLARIS -D_REENTRANT + +# Purify doesn't like -MDupdate +NOMD_OS_CFLAGS += $(DSO_CFLAGS) $(OS_DEFINES) $(SOL_CFLAGS) + +MKSHLIB = $(CC) $(DSO_LDOPTS) $(RPATH) +ifdef NS_USE_GCC +ifeq (GNU,$(findstring GNU,$(shell `$(CC) -print-prog-name=ld` -v 2>&1))) + GCC_USE_GNU_LD = 1 +endif +endif +ifdef MAPFILE +ifdef NS_USE_GCC +ifdef GCC_USE_GNU_LD + MKSHLIB += -Wl,--version-script,$(MAPFILE) +else + MKSHLIB += -Wl,-M,$(MAPFILE) +endif +else + MKSHLIB += -M $(MAPFILE) +endif +endif +PROCESS_MAP_FILE = grep -v ';-' $< | \ + sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@ + + + + +# ld options: +# -G: produce a shared object +# -z defs: no unresolved symbols allowed +ifdef NS_USE_GCC +ifeq ($(USE_64), 1) + DSO_LDOPTS += -m64 +endif + DSO_LDOPTS += -shared -h $(notdir $@) +else +ifeq ($(USE_64), 1) + ifeq ($(OS_TEST),i86pc) + DSO_LDOPTS +=-xarch=amd64 + else + DSO_LDOPTS +=-xarch=v9 + endif +endif + DSO_LDOPTS += -G -h $(notdir $@) +endif +DSO_LDOPTS += -z combreloc -z defs -z ignore + +# -KPIC generates position independent code for use in shared libraries. +# (Similarly for -fPIC in case of gcc.) +ifdef NS_USE_GCC + DSO_CFLAGS += -fPIC +else + DSO_CFLAGS += -KPIC +endif + +NOSUCHFILE = /solaris-rm-f-sucks + +ifeq ($(BUILD_SUN_PKG), 1) +# The -R '$ORIGIN' linker option instructs this library to search for its +# dependencies in the same directory where it resides. +ifeq ($(USE_64), 1) +RPATH = -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64' +else +RPATH = -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps' +endif +else +RPATH = -R '$$ORIGIN' +endif + diff --git a/mozilla/security/coreconf/UNIX.mk b/mozilla/security/coreconf/UNIX.mk new file mode 100644 index 0000000..5853170 --- /dev/null +++ b/mozilla/security/coreconf/UNIX.mk @@ -0,0 +1,96 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +XP_DEFINE += -DXP_UNIX +LIB_SUFFIX = a +DLL_SUFFIX = so +AR = ar cr $@ +LDOPTS += -L$(SOURCE_LIB_DIR) + +ifdef BUILD_OPT + OPTIMIZER += -O + DEFINES += -UDEBUG -DNDEBUG +else + OPTIMIZER += -g + USERNAME := $(shell whoami) + USERNAME := $(subst -,_,$(USERNAME)) + DEFINES += -DDEBUG -UNDEBUG -DDEBUG_$(USERNAME) +endif + +ifdef BUILD_TREE +NSINSTALL_DIR = $(BUILD_TREE)/nss +NSINSTALL = $(BUILD_TREE)/nss/nsinstall +else +NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall +NSINSTALL = $(NSINSTALL_DIR)/$(OBJDIR_NAME)/nsinstall +endif + +MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend +MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend +MKDEPENDENCIES = $(OBJDIR_NAME)/depend.mk + +#################################################################### +# +# One can define the makefile variable NSDISTMODE to control +# how files are published to the 'dist' directory. If not +# defined, the default is "install using relative symbolic +# links". The two possible values are "copy", which copies files +# but preserves source mtime, and "absolute_symlink", which +# installs using absolute symbolic links. +# - THIS IS NOT PART OF THE NEW BINARY RELEASE PLAN for 9/30/97 +# - WE'RE KEEPING IT ONLY FOR BACKWARDS COMPATIBILITY +#################################################################### + +ifeq ($(NSDISTMODE),copy) + # copy files, but preserve source mtime + INSTALL = $(NSINSTALL) + INSTALL += -t +else + ifeq ($(NSDISTMODE),absolute_symlink) + # install using absolute symbolic links + INSTALL = $(NSINSTALL) + INSTALL += -L `pwd` + else + # install using relative symbolic links + INSTALL = $(NSINSTALL) + INSTALL += -R + endif +endif + +define MAKE_OBJDIR +if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi +endef diff --git a/mozilla/security/coreconf/UNIXWARE2.1.mk b/mozilla/security/coreconf/UNIXWARE2.1.mk new file mode 100644 index 0000000..7edcb1f --- /dev/null +++ b/mozilla/security/coreconf/UNIXWARE2.1.mk @@ -0,0 +1,61 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# +# Config stuff for SCO Unixware 2.1 +# + +include $(CORE_DEPTH)/coreconf/UNIX.mk + +DEFAULT_COMPILER = $(CORE_DEPTH)/build/hcc + +CC = $(CORE_DEPTH)/build/hcc +CCC = $(CORE_DEPTH)/build/hcpp +RANLIB = true +OS_CFLAGS = -KPIC -DSVR4 -DSYSV -DUNIXWARE +MKSHLIB = $(LD) +MKSHLIB += $(DSO_LDOPTS) +DSO_LDOPTS += -G +CPU_ARCH = x86 +ARCH = sco +NOSUCHFILE = /solaris-rm-f-sucks +ifdef MAPFILE +# Add LD options to restrict exported symbols to those in the map file +endif +# Change PROCESS to put the mapfile in the correct format for this platform +PROCESS_MAP_FILE = cp $< $@ + diff --git a/mozilla/security/coreconf/WIN32.mk b/mozilla/security/coreconf/WIN32.mk new file mode 100644 index 0000000..6f88016 --- /dev/null +++ b/mozilla/security/coreconf/WIN32.mk @@ -0,0 +1,389 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# +# Configuration common to all versions of Windows NT +# and Windows 95 +# + +DEFAULT_COMPILER = cl + +ifdef NS_USE_GCC + CC = gcc + CCC = g++ + LINK = ld + AR = ar + AR += cr $@ + RANLIB = ranlib + BSDECHO = echo + RC = windres.exe -O coff --use-temp-file + LINK_DLL = $(CC) $(OS_DLLFLAGS) $(DLLFLAGS) +else + CC = cl + CCC = cl + LINK = link + AR = lib + AR += -NOLOGO -OUT:"$@" + RANLIB = echo + BSDECHO = echo + RC = rc.exe + MT = mt.exe + # Determine compiler version + CC_VERSION := $(shell $(CC) 2>&1 | sed -ne \ + 's|.* \([0-9]\+\.[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\).*|\1|p') + # Change the dots to spaces. + _CC_VERSION_WORDS := $(subst ., ,$(CC_VERSION)) + _CC_VMAJOR := $(word 1,$(_CC_VERSION_WORDS)) + _CC_VMINOR := $(word 2,$(_CC_VERSION_WORDS)) + _CC_RELEASE := $(word 3,$(_CC_VERSION_WORDS)) + _CC_BUILD := $(word 4,$(_CC_VERSION_WORDS)) + _MSC_VER = $(_CC_VMAJOR)$(_CC_VMINOR) + _MSC_VER_6 = 1200 + ifeq ($(_CC_VMAJOR),14) + # -DYNAMICBASE is only supported on VC8SP1 or newer, + # so be very specific here! + # VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762 + ifeq ($(_CC_RELEASE).$(_CC_BUILD),50727.42) + USE_DYNAMICBASE = + else + ifeq ($(_CC_RELEASE).$(_CC_BUILD),50727.762) + USE_DYNAMICBASE = 1 + else + _LOSER := $(error Unknown compiler version $(CC_VERSION)) + endif + endif + endif + # if $(_CC_VMAJOR) >= 15 + # NOTE: 'sort' sorts the words in lexical order, so this test works + # only if $(_CC_VMAJOR) is two digits. + ifeq ($(firstword $(sort $(_CC_VMAJOR) 15)),15) + USE_DYNAMICBASE = 1 + endif +endif + +ifdef BUILD_TREE +NSINSTALL_DIR = $(BUILD_TREE)/nss +else +NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall +endif +NSINSTALL = nsinstall + +MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend +MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend.exe +# Note: MKDEPENDENCIES __MUST__ be a relative pathname, not absolute. +# If it is absolute, gmake will crash unless the named file exists. +MKDEPENDENCIES = $(OBJDIR_NAME)/depend.mk + +INSTALL = $(NSINSTALL) +MAKE_OBJDIR = mkdir +MAKE_OBJDIR += $(OBJDIR) +GARBAGE += $(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb +XP_DEFINE += -DXP_PC +ifdef NS_USE_GCC +LIB_SUFFIX = a +else +LIB_SUFFIX = lib +endif +DLL_SUFFIX = dll + +ifdef NS_USE_GCC + # The -mnop-fun-dllimport flag allows us to avoid a drawback of + # the dllimport attribute that a pointer to a function marked as + # dllimport cannot be used as as a constant address. + OS_CFLAGS += -mno-cygwin -mms-bitfields -mnop-fun-dllimport + _GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY) + DLLFLAGS += -mno-cygwin -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB)) + ifdef BUILD_OPT + ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE)) + OPTIMIZER += -Os + else + OPTIMIZER += -O2 + endif + DEFINES += -UDEBUG -U_DEBUG -DNDEBUG + else + OPTIMIZER += -g + NULLSTRING := + SPACE := $(NULLSTRING) # end of the line + USERNAME := $(subst $(SPACE),_,$(USERNAME)) + USERNAME := $(subst -,_,$(USERNAME)) + DEFINES += -DDEBUG -D_DEBUG -UNDEBUG -DDEBUG_$(USERNAME) + endif +else # !NS_USE_GCC + OS_CFLAGS += -W3 -nologo -D_CRT_SECURE_NO_WARNINGS + OS_DLLFLAGS += -nologo -DLL -SUBSYSTEM:WINDOWS + ifeq ($(_MSC_VER),$(_MSC_VER_6)) + ifndef MOZ_DEBUG_SYMBOLS + OS_DLLFLAGS += -PDB:NONE + endif + endif + ifdef USE_DYNAMICBASE + OS_DLLFLAGS += -DYNAMICBASE + endif + ifdef BUILD_OPT + OS_CFLAGS += -MD + ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE)) + OPTIMIZER += -O1 + else + OPTIMIZER += -O2 + endif + DEFINES += -UDEBUG -U_DEBUG -DNDEBUG + DLLFLAGS += -OUT:"$@" + ifdef MOZ_DEBUG_SYMBOLS + ifdef MOZ_DEBUG_FLAGS + OPTIMIZER += $(MOZ_DEBUG_FLAGS) -Fd$(OBJDIR)/ + else + OPTIMIZER += -Zi -Fd$(OBJDIR)/ + endif + DLLFLAGS += -DEBUG -OPT:REF + LDFLAGS += -DEBUG -OPT:REF + endif + else + # + # Define USE_DEBUG_RTL if you want to use the debug runtime library + # (RTL) in the debug build + # + ifdef USE_DEBUG_RTL + OS_CFLAGS += -MDd -D_CRTDBG_MAP_ALLOC + else + OS_CFLAGS += -MD + endif + OPTIMIZER += -Zi -Fd$(OBJDIR)/ -Od + NULLSTRING := + SPACE := $(NULLSTRING) # end of the line + USERNAME := $(subst $(SPACE),_,$(USERNAME)) + USERNAME := $(subst -,_,$(USERNAME)) + DEFINES += -DDEBUG -D_DEBUG -UNDEBUG -DDEBUG_$(USERNAME) + DLLFLAGS += -DEBUG -OUT:"$@" + LDFLAGS += -DEBUG +ifeq ($(_MSC_VER),$(_MSC_VER_6)) +ifndef MOZ_DEBUG_SYMBOLS + LDFLAGS += -PDB:NONE +endif +endif + # Purify requires /FIXED:NO when linking EXEs. + LDFLAGS += /FIXED:NO + endif +ifneq ($(_MSC_VER),$(_MSC_VER_6)) + # Convert certain deadly warnings to errors (see list at end of file) + OS_CFLAGS += -we4002 -we4003 -we4004 -we4006 -we4009 -we4013 \ + -we4015 -we4028 -we4033 -we4035 -we4045 -we4047 -we4053 -we4054 -we4063 \ + -we4064 -we4078 -we4087 -we4098 -we4390 -we4551 -we4553 -we4715 +endif # !MSVC6 +endif # NS_USE_GCC + +ifdef USE_64 +DEFINES += -DWIN64 +else +DEFINES += -DWIN32 +endif + +ifeq (,$(filter-out x386 x86_64,$(CPU_ARCH))) +ifdef USE_64 + DEFINES += -D_AMD64_ +else + DEFINES += -D_X86_ +endif +endif +ifeq ($(CPU_ARCH), ALPHA) + DEFINES += -D_ALPHA_=1 +endif + +ifdef MAPFILE +ifndef NS_USE_GCC +DLLFLAGS += -DEF:$(MAPFILE) +endif +endif +# Change PROCESS to put the mapfile in the correct format for this platform +PROCESS_MAP_FILE = cp $< $@ + + +# +# The following is NOT needed for the NSPR 2.0 library. +# + +DEFINES += -D_WINDOWS + +# override default, which is ASFLAGS = CFLAGS +ifdef NS_USE_GCC + AS = $(CC) + ASFLAGS = $(INCLUDES) +else +ifdef USE_64 + AS = ml64.exe + ASFLAGS = -Cp -Sn -Zi $(INCLUDES) +else + AS = ml.exe + ASFLAGS = -Cp -Sn -Zi -coff $(INCLUDES) +endif +endif + +# +# override the definitions of RELEASE_TREE found in tree.mk +# +ifndef RELEASE_TREE + ifdef BUILD_SHIP + ifdef USE_SHIPS + RELEASE_TREE = $(NTBUILD_SHIP) + else + RELEASE_TREE = //redbuild/components + endif + else + RELEASE_TREE = //redbuild/components + endif +endif + +# +# override the definitions of IMPORT_LIB_PREFIX, LIB_PREFIX, and +# DLL_PREFIX in prefix.mk +# + +ifndef IMPORT_LIB_PREFIX + ifdef NS_USE_GCC + IMPORT_LIB_PREFIX = lib + else + IMPORT_LIB_PREFIX = $(NULL) + endif +endif + +ifndef LIB_PREFIX + ifdef NS_USE_GCC + LIB_PREFIX = lib + else + LIB_PREFIX = $(NULL) + endif +endif + +ifndef DLL_PREFIX + DLL_PREFIX = $(NULL) +endif + +# +# override the definitions of various _SUFFIX symbols in suffix.mk +# + +# +# Object suffixes +# +ifndef OBJ_SUFFIX + ifdef NS_USE_GCC + OBJ_SUFFIX = .o + else + OBJ_SUFFIX = .obj + endif +endif + +# +# Assembler source suffixes +# +ifndef ASM_SUFFIX + ifdef NS_USE_GCC + ASM_SUFFIX = .s + else + ASM_SUFFIX = .asm + endif +endif + +# +# Library suffixes +# + +ifndef IMPORT_LIB_SUFFIX + IMPORT_LIB_SUFFIX = .$(LIB_SUFFIX) +endif + +ifndef DYNAMIC_LIB_SUFFIX_FOR_LINKING + DYNAMIC_LIB_SUFFIX_FOR_LINKING = $(IMPORT_LIB_SUFFIX) +endif + +# +# Program suffixes +# +ifndef PROG_SUFFIX + PROG_SUFFIX = .exe +endif + +# +# When the processor is NOT 386-based on Windows NT, override the +# value of $(CPU_TAG). For WinNT, 95, 16, not CE. +# +ifneq ($(CPU_ARCH),x386) + CPU_TAG = _$(CPU_ARCH) +endif + +# +# override ruleset.mk, removing the "lib" prefix for library names, and +# adding the "32" after the LIBRARY_VERSION. +# +ifdef LIBRARY_NAME + SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)32$(JDK_DEBUG_SUFFIX).dll + IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)32$(JDK_DEBUG_SUFFIX).lib +endif + +# +# override the TARGETS defined in ruleset.mk, adding IMPORT_LIBRARY +# +ifndef TARGETS + TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(PROGRAM) +endif + +# list of MSVC warnings converted to errors above: +# 4002: too many actual parameters for macro 'identifier' +# 4003: not enough actual parameters for macro 'identifier' +# 4004: incorrect construction after 'defined' +# 4006: #undef expected an identifier +# 4009: string too big; trailing characters truncated +# 4015: 'identifier' : type of bit field must be integral +# 4028: formal parameter different from declaration +# 4033: 'function' must return a value +# 4035: 'function' : no return value +# 4045: 'identifier' : array bounds overflow +# 4047: 'function' : 'type 1' differs in levels of indirection from 'type 2' +# 4053: one void operand for '?:' +# 4054: 'conversion' : from function pointer 'type1' to data pointer 'type2' +# 4059: pascal string too big, length byte is length % 256 +# 4063: case 'identifier' is not a valid value for switch of enum 'identifier' +# 4064: switch of incomplete enum 'identifier' +# 4078: case constant 'value' too big for the type of the switch expression +# 4087: 'function' : declared with 'void' parameter list +# 4098: 'function' : void function returning a value +# 4390: ';' : empty controlled statement found; is this the intent? +# 4541: RTTI train wreck +# 4715: not all control paths return a value +# 4013: function undefined; assuming extern returning int +# 4553: '==' : operator has no effect; did you intend '='? +# 4551: function call missing argument list + diff --git a/mozilla/security/coreconf/WIN95.mk b/mozilla/security/coreconf/WIN95.mk new file mode 100644 index 0000000..4a26739 --- /dev/null +++ b/mozilla/security/coreconf/WIN95.mk @@ -0,0 +1,47 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# +# Config stuff for OS_TARGET=WIN95 +# + +include $(CORE_DEPTH)/coreconf/WIN32.mk + +DEFINES += -DWIN95 + +# WINNT uses the lib prefix, Win95 and WinCE don't +NSPR31_LIB_PREFIX = $(NULL) diff --git a/mozilla/security/coreconf/WINCE.mk b/mozilla/security/coreconf/WINCE.mk new file mode 100644 index 0000000..af23a8e --- /dev/null +++ b/mozilla/security/coreconf/WINCE.mk @@ -0,0 +1,214 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# +# Configuration common to all versions of Windows CE and Pocket PC x. +# + +ifeq ($(CPU_ARCH),x86) + DEFAULT_COMPILER = cl + CC = cl + CCC = cl +else +ifeq ($(CPU_ARCH),ARM) + DEFAULT_COMPILER = clarm + CC = clarm + CCC = clarm +else +include CPU_ARCH_is_not_recognized +include _$(CPU_ARCH) +endif +endif + +LINK = link +AR = lib +AR += -NOLOGO -OUT:"$@" +RANLIB = echo +BSDECHO = echo + +ifdef BUILD_TREE +NSINSTALL_DIR = $(BUILD_TREE)/nss +else +NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall +endif +NSINSTALL = nsinstall + +MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend +MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend.exe +# Note: MKDEPENDENCIES __MUST__ be a relative pathname, not absolute. +# If it is absolute, gmake will crash unless the named file exists. +MKDEPENDENCIES = $(OBJDIR_NAME)/depend.mk + +INSTALL = $(NSINSTALL) +MAKE_OBJDIR = mkdir +MAKE_OBJDIR += $(OBJDIR) +RC = rc.exe +GARBAGE += $(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb +XP_DEFINE += -DXP_PC +LIB_SUFFIX = lib +DLL_SUFFIX = dll +OS_DLLFLAGS += -DLL + +EXTRA_EXE_LD_FLAGS += -ENTRY:mainWCRTStartup + +ifdef BUILD_OPT +# OS_CFLAGS += -MD + OPTIMIZER += -O2 + DEFINES += -UDEBUG -U_DEBUG -DNDEBUG + DLLFLAGS += -OUT:"$@" +else + # + # Define USE_DEBUG_RTL if you want to use the debug runtime library + # (RTL) in the debug build + # + ifdef USE_DEBUG_RTL +# OS_CFLAGS += -MDd + else +# OS_CFLAGS += -MD + endif + OPTIMIZER += -Od -Z7 + #OPTIMIZER += -Zi -Fd$(OBJDIR)/ -Od + DEFINES += -DDEBUG -D_DEBUG -UNDEBUG -DDEBUG_$(USERNAME) + DLLFLAGS += -DEBUG -DEBUGTYPE:CV -OUT:"$@" + LDFLAGS += -DEBUG -DEBUGTYPE:CV +endif + +# DEFINES += -DWIN32 + +ifdef MAPFILE + DLLFLAGS += -DEF:$(MAPFILE) +endif + +# Change PROCESS to put the mapfile in the correct format for this platform +PROCESS_MAP_FILE = cp $< $@ + +# +# The following is NOT needed for the NSPR 2.0 library. +# + +DEFINES += -D_WINDOWS + +# override default, which is ASFLAGS = CFLAGS +AS = ml.exe +ASFLAGS = -Cp -Sn -Zi -coff $(INCLUDES) + +# +# override the definitions of RELEASE_TREE found in tree.mk +# +ifndef RELEASE_TREE + ifdef BUILD_SHIP + ifdef USE_SHIPS + RELEASE_TREE = $(NTBUILD_SHIP) + else + RELEASE_TREE = //redbuild/components + endif + else + RELEASE_TREE = //redbuild/components + endif +endif + +# +# override the definitions of LIB_PREFIX and DLL_PREFIX in prefix.mk +# + +ifndef LIB_PREFIX + LIB_PREFIX = $(NULL) +endif + +ifndef DLL_PREFIX + DLL_PREFIX = $(NULL) +endif + +# +# override the definitions of various _SUFFIX symbols in suffix.mk +# + +# +# Object suffixes +# +ifndef OBJ_SUFFIX + OBJ_SUFFIX = .obj +endif + +# +# Assembler source suffixes +# +ifndef ASM_SUFFIX + ASM_SUFFIX = .asm +endif + +# +# Library suffixes +# + +ifndef IMPORT_LIB_SUFFIX + IMPORT_LIB_SUFFIX = .$(LIB_SUFFIX) +endif + +ifndef DYNAMIC_LIB_SUFFIX_FOR_LINKING + DYNAMIC_LIB_SUFFIX_FOR_LINKING = $(IMPORT_LIB_SUFFIX) +endif + +# +# Program suffixes +# +ifndef PROG_SUFFIX + PROG_SUFFIX = .exe +endif + +# +# override ruleset.mk, removing the "lib" prefix for library names, and +# adding the "32" after the LIBRARY_VERSION. +# +ifdef LIBRARY_NAME + SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)32$(JDK_DEBUG_SUFFIX).dll + IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)32$(JDK_DEBUG_SUFFIX).lib +endif + +# +# override the TARGETS defined in ruleset.mk, adding IMPORT_LIBRARY +# +ifndef TARGETS + TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(PROGRAM) +endif + + +# +# Always set CPU_TAG on Linux, WINCE. +# +CPU_TAG = _$(CPU_ARCH) + diff --git a/mozilla/security/coreconf/WINNT.mk b/mozilla/security/coreconf/WINNT.mk new file mode 100644 index 0000000..56a4ae8 --- /dev/null +++ b/mozilla/security/coreconf/WINNT.mk @@ -0,0 +1,52 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# +# Config stuff for OS_TARGET=WINNT +# + +include $(CORE_DEPTH)/coreconf/WIN32.mk + +DEFINES += -DWINNT + +# +# Win NT needs -GT so that fibers can work +# +OS_CFLAGS += -GT + +# WINNT uses the lib prefix, Win95 and WinCE don't +NSPR31_LIB_PREFIX = lib diff --git a/mozilla/security/coreconf/arch.mk b/mozilla/security/coreconf/arch.mk new file mode 100644 index 0000000..bd3c02c --- /dev/null +++ b/mozilla/security/coreconf/arch.mk @@ -0,0 +1,341 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Howard Chu +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# Master "Core Components" macros for getting the OS architecture # +# defines these symbols: +# 64BIT_TAG +# OS_ARCH (from uname -r) +# OS_TEST (from uname -m) +# OS_RELEASE (from uname -v and/or -r) +# OS_TARGET User defined, or set to OS_ARCH +# CPU_ARCH (from unmame -m or -p, ONLY on WINNT) +# OS_CONFIG OS_TARGET + OS_RELEASE +# OBJDIR_TAG +# OBJDIR_NAME +####################################################################### + +# +# Macros for getting the OS architecture +# + +ifeq ($(USE_64), 1) + 64BIT_TAG=_64 +else + 64BIT_TAG= +endif + +OS_ARCH := $(subst /,_,$(shell uname -s)) + +# +# Attempt to differentiate between sparc and x86 Solaris +# + +OS_TEST := $(shell uname -m) +ifeq ($(OS_TEST),i86pc) + OS_RELEASE := $(shell uname -r)_$(OS_TEST) +else + OS_RELEASE := $(shell uname -r) +endif + +# +# Force the IRIX64 machines to use IRIX. +# + +ifeq ($(OS_ARCH),IRIX64) + OS_ARCH = IRIX +endif + +# +# Force the older BSD/OS versions to use the new arch name. +# + +ifeq ($(OS_ARCH),BSD_386) + OS_ARCH = BSD_OS +endif + +# +# Catch Deterim if SVR4 is NCR or UNIXWARE +# + +ifeq ($(OS_ARCH),UNIX_SV) + ifneq ($(findstring NCR, $(shell grep NCR /etc/bcheckrc | head -1 )),) + OS_ARCH = NCR + else + # Make UnixWare something human readable + OS_ARCH = UNIXWARE + endif + + # Get the OS release number, not 4.2 + OS_RELEASE := $(shell uname -v) +endif + +ifeq ($(OS_ARCH),UNIX_System_V) + OS_ARCH = NEC +endif + +ifeq ($(OS_ARCH),AIX) + OS_RELEASE := $(shell uname -v).$(shell uname -r) +endif + +# +# Distinguish between OSF1 V4.0B and V4.0D +# + +ifeq ($(OS_ARCH)$(OS_RELEASE),OSF1V4.0) + OS_VERSION := $(shell uname -v) + ifeq ($(OS_VERSION),564) + OS_RELEASE := V4.0B + endif + ifeq ($(OS_VERSION),878) + OS_RELEASE := V4.0D + endif +endif + +# +# SINIX changes name to ReliantUNIX with 5.43 +# + +ifeq ($(OS_ARCH),ReliantUNIX-N) + OS_ARCH = ReliantUNIX + OS_RELEASE = 5.4 +endif + +ifeq ($(OS_ARCH),SINIX-N) + OS_ARCH = ReliantUNIX + OS_RELEASE = 5.4 +endif + +# +# Handle FreeBSD 2.2-STABLE, Linux 2.0.30-osfmach3, and +# IRIX 6.5-ALPHA-1289139620. +# + +ifeq (,$(filter-out Linux FreeBSD IRIX,$(OS_ARCH))) + OS_RELEASE := $(shell echo $(OS_RELEASE) | sed 's/-.*//') +endif + +ifeq ($(OS_ARCH),Linux) + OS_RELEASE := $(subst ., ,$(OS_RELEASE)) + ifneq ($(words $(OS_RELEASE)),1) + OS_RELEASE := $(word 1,$(OS_RELEASE)).$(word 2,$(OS_RELEASE)) + endif +endif + +# +# For OS/2 +# +ifeq ($(OS_ARCH),OS_2) + OS_ARCH = OS2 + OS_RELEASE := $(shell uname -v) +endif + +####################################################################### +# Master "Core Components" macros for getting the OS target # +####################################################################### + +# +# Note: OS_TARGET should be specified on the command line for gmake. +# When OS_TARGET=WIN95 is specified, then a Windows 95 target is built. +# The difference between the Win95 target and the WinNT target is that +# the WinNT target uses Windows NT specific features not available +# in Windows 95. The Win95 target will run on Windows NT, but (supposedly) +# at lesser performance (the Win95 target uses threads; the WinNT target +# uses fibers). +# +# If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no +# cross-compilation. +# + +# +# The following hack allows one to build on a WIN95 machine (as if +# s/he were cross-compiling on a WINNT host for a WIN95 target). +# It also accomodates for MKS's and Cygwin's uname.exe. +# +ifeq ($(OS_ARCH),WIN95) + OS_ARCH = WINNT + OS_TARGET = WIN95 +endif +ifeq ($(OS_ARCH),Windows_95) + OS_ARCH = Windows_NT + OS_TARGET = WIN95 +endif +ifeq ($(OS_ARCH),CYGWIN_95-4.0) + OS_ARCH = CYGWIN_NT-4.0 + OS_TARGET = WIN95 +endif +ifeq ($(OS_ARCH),CYGWIN_98-4.10) + OS_ARCH = CYGWIN_NT-4.0 + OS_TARGET = WIN95 +endif +ifeq ($(OS_ARCH),CYGWIN_ME-4.90) + OS_ARCH = CYGWIN_NT-4.0 + OS_TARGET = WIN95 +endif + +# +# On WIN32, we also define the variable CPU_ARCH, if it isn't already. +# +ifndef CPU_ARCH + ifeq ($(OS_ARCH), WINNT) + CPU_ARCH := $(shell uname -p) + ifeq ($(CPU_ARCH),I386) + CPU_ARCH = x386 + endif + endif +endif + +# If uname -s returns "Windows_NT", we assume that we are using +# the uname.exe in MKS toolkit. +# +# The -r option of MKS uname only returns the major version number. +# So we need to use its -v option to get the minor version number. +# Moreover, it doesn't have the -p option, so we need to use uname -m. +# +ifeq ($(OS_ARCH), Windows_NT) + OS_ARCH = WINNT + OS_MINOR_RELEASE := $(shell uname -v) + # strip leading 0 + OS_MINOR_RELEASE := $(patsubst 0%,%,$(OS_MINOR_RELEASE)) + OS_RELEASE := $(OS_RELEASE).$(OS_MINOR_RELEASE) + ifndef CPU_ARCH + CPU_ARCH := $(shell uname -m) + # + # MKS's uname -m returns "586" on a Pentium machine. + # + ifneq (,$(findstring 86,$(CPU_ARCH))) + CPU_ARCH = x386 + endif + endif +endif +# +# If uname -s returns "CYGWIN_NT-4.0", we assume that we are using +# the uname.exe in the Cygwin tools. +# +ifeq (CYGWIN_NT,$(findstring CYGWIN_NT,$(OS_ARCH))) + OS_RELEASE := $(patsubst CYGWIN_NT-%,%,$(OS_ARCH)) + OS_ARCH = WINNT + ifndef CPU_ARCH + ifeq (WOW64,$(findstring WOW64,$(OS_RELEASE))) + OS_RELEASE := $(patsubst %-WOW64,%,$(OS_RELEASE)) + endif + CPU_ARCH := $(shell uname -m) + # + # Cygwin's uname -m returns "i686" on a Pentium Pro machine. + # + ifneq (,$(findstring 86,$(CPU_ARCH))) + CPU_ARCH = x386 + endif + endif +endif +# +# If uname -s returns "MINGW32_NT-5.1", we assume that we are using +# the uname.exe in the MSYS toolkit. +# +ifeq (MINGW32_NT,$(findstring MINGW32_NT,$(OS_ARCH))) + OS_RELEASE := $(patsubst MINGW32_NT-%,%,$(OS_ARCH)) + OS_ARCH = WINNT + USE_MSYS = 1 + ifndef CPU_ARCH + CPU_ARCH := $(shell uname -m) + # + # MSYS's uname -m returns "i686" on a Pentium Pro machine. + # + ifneq (,$(findstring 86,$(CPU_ARCH))) + CPU_ARCH = x386 + endif + endif +endif + +ifndef OS_TARGET + OS_TARGET = $(OS_ARCH) +endif + +ifeq ($(OS_TARGET), WIN95) + OS_RELEASE = 4.0 +endif + +ifdef OS_TARGET_RELEASE + OS_RELEASE = $(OS_TARGET_RELEASE) +endif + +# +# This variable is used to get OS_CONFIG.mk. +# + +OS_CONFIG = $(OS_TARGET)$(OS_RELEASE) + +# +# OBJDIR_TAG depends on the predefined variable BUILD_OPT, +# to distinguish between debug and release builds. +# + +ifdef BUILD_OPT + OBJDIR_TAG = $(64BIT_TAG)_OPT +else + ifdef BUILD_IDG + OBJDIR_TAG = $(64BIT_TAG)_IDG + else + OBJDIR_TAG = $(64BIT_TAG)_DBG + endif +endif + +# +# The following flags are defined in the individual $(OS_CONFIG).mk +# files. +# +# CPU_TAG is defined if the CPU is not the most common CPU. +# COMPILER_TAG is defined if the compiler is not the default compiler. +# IMPL_STRATEGY may be defined too. +# + +OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ + +ifeq (,$(filter-out WIN%,$(OS_TARGET))) +ifndef BUILD_OPT +# +# Define USE_DEBUG_RTL if you want to use the debug runtime library +# (RTL) in the debug build +# +ifdef USE_DEBUG_RTL + OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJD +endif +endif +endif + +MK_ARCH = included diff --git a/mozilla/security/coreconf/command.mk b/mozilla/security/coreconf/command.mk new file mode 100644 index 0000000..1d018c0 --- /dev/null +++ b/mozilla/security/coreconf/command.mk @@ -0,0 +1,72 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# Master "Core Components" default command macros; # +# can be overridden in .mk # +####################################################################### + +AS = $(CC) +ASFLAGS += $(CFLAGS) +CCF = $(CC) $(CFLAGS) +LINK_DLL = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS) +LINK_EXE = $(LINK) $(OS_LFLAGS) $(LFLAGS) +CFLAGS = $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \ + $(XCFLAGS) +PERL = perl +RANLIB = echo +TAR = /bin/tar +# +# For purify +# +NOMD_CFLAGS += $(OPTIMIZER) $(NOMD_OS_CFLAGS) $(XP_DEFINE) $(DEFINES) \ + $(INCLUDES) $(XCFLAGS) + +# Optimization of code for size +# OPT_CODE_SIZE +# =1: The code can be optimized for size. +# The code is actually optimized for size only if ALLOW_OPT_CODE_SIZE=1 +# in a given source code directory (in manifest.mn) +# =0: Never optimize the code for size. +# +# Default value = 0 +# Can be overridden from the make command line. +ifndef OPT_CODE_SIZE +OPT_CODE_SIZE = 0 +endif + +MK_COMMAND = included diff --git a/mozilla/security/coreconf/config.mk b/mozilla/security/coreconf/config.mk new file mode 100644 index 0000000..5b560fb --- /dev/null +++ b/mozilla/security/coreconf/config.mk @@ -0,0 +1,209 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# Configuration information for building in the "Core Components" source module + +####################################################################### +# [1.0] Master "Core Components" source and release # +# tags # +####################################################################### +ifndef MK_ARCH +include $(CORE_DEPTH)/coreconf/arch.mk +endif + +####################################################################### +# [2.0] Master "Core Components" default command macros # +# (NOTE: may be overridden in $(OS_TARGET)$(OS_RELEASE).mk) # +####################################################################### +ifndef MK_COMMAND +include $(CORE_DEPTH)/coreconf/command.mk +endif + +####################################################################### +# [3.0] Master "Core Components" -specific macros # +# (dependent upon tags) # +# # +# We are moving towards just having a $(OS_TARGET).mk file # +# as opposed to multiple $(OS_TARGET)$(OS_RELEASE).mk files, # +# one for each OS release. # +####################################################################### + +TARGET_OSES = FreeBSD BSD_OS NetBSD OpenUNIX OS2 QNX Darwin BeOS OpenBSD \ + AIX RISCOS WINNT WIN95 WINCE + +ifeq (,$(filter-out $(TARGET_OSES),$(OS_TARGET))) +include $(CORE_DEPTH)/coreconf/$(OS_TARGET).mk +else +include $(CORE_DEPTH)/coreconf/$(OS_TARGET)$(OS_RELEASE).mk +endif + +####################################################################### +# [4.0] Master "Core Components" source and release tags # +# (dependent upon tags) # +####################################################################### +PLATFORM = $(OBJDIR_NAME) + +####################################################################### +# [5.0] Master "Core Components" release tags # +# (dependent upon tags) # +####################################################################### +ifndef MK_TREE +include $(CORE_DEPTH)/coreconf/tree.mk +endif + +####################################################################### +# [6.0] Master "Core Components" source and release tags # +# NOTE: A component is also called a module or a subsystem. # +# (dependent upon $(MODULE) being defined on the # +# command line, as an environment variable, or in individual # +# makefiles, or more appropriately, manifest.mn) # +####################################################################### +ifndef MK_MODULE +include $(CORE_DEPTH)/coreconf/module.mk +endif + +####################################################################### +# [7.0] Master "Core Components" release tags # +# (dependent upon $(MODULE) being defined on the # +# command line, as an environment variable, or in individual # +# makefiles, or more appropriately, manifest.mn) # +####################################################################### +ifndef MK_VERSION +include $(CORE_DEPTH)/coreconf/version.mk +endif + +####################################################################### +# [8.0] Master "Core Components" macros to figure out # +# binary code location # +# (dependent upon tags) # +####################################################################### +ifndef MK_LOCATION +include $(CORE_DEPTH)/coreconf/location.mk +endif + +####################################################################### +# [9.0] Master "Core Components" -specific source path # +# (dependent upon , , # +# , and tags) # +####################################################################### +ifndef MK_SOURCE +include $(CORE_DEPTH)/coreconf/source.mk +endif + +####################################################################### +# [10.0] Master "Core Components" include switch for support header # +# files # +# (dependent upon , , , # +# and tags) # +####################################################################### +ifndef MK_HEADERS +include $(CORE_DEPTH)/coreconf/headers.mk +endif + +####################################################################### +# [11.0] Master "Core Components" for computing program prefixes # +####################################################################### +ifndef MK_PREFIX +include $(CORE_DEPTH)/coreconf/prefix.mk +endif + +####################################################################### +# [12.0] Master "Core Components" for computing program suffixes # +# (dependent upon tags) # +####################################################################### +ifndef MK_SUFFIX +include $(CORE_DEPTH)/coreconf/suffix.mk +endif + +####################################################################### +# [13.0] Master "Core Components" for defining JDK # +# (dependent upon , , and tags)# +####################################################################### +ifdef NS_USE_JDK +include $(CORE_DEPTH)/coreconf/jdk.mk +endif + +####################################################################### +# [14.0] Master "Core Components" rule set # +####################################################################### +ifndef MK_RULESET +include $(CORE_DEPTH)/coreconf/ruleset.mk +endif + +####################################################################### +# [15.0] Dependencies. +####################################################################### + +-include $(MKDEPENDENCIES) + +####################################################################### +# [16.0] Global environ ment defines +####################################################################### + +ifdef NSS_ENABLE_ECC +DEFINES += -DNSS_ENABLE_ECC +endif + +ifdef NSS_ECC_MORE_THAN_SUITE_B +DEFINES += -DNSS_ECC_MORE_THAN_SUITE_B +endif + +ifdef NSS_ALLOW_UNSUPPORTED_CRITICAL +DEFINES += -DNSS_ALLOW_UNSUPPORTED_CRITICAL +endif + +ifdef BUILD_LIBPKIX_TESTS +DEFINES += -DBUILD_LIBPKIX_TESTS +endif + +ifdef NSS_DISABLE_DBM +DEFINES += -DNSS_DISABLE_DBM +endif + +# Avoid building object leak test code for optimized library +ifndef BUILD_OPT +ifdef PKIX_OBJECT_LEAK_TEST +DEFINES += -DPKIX_OBJECT_LEAK_TEST +endif +endif + +# This allows all library and tools code to use the util function +# implementations directly from libnssutil3, rather than the wrappers +# in libnss3 which are present for binary compatibility only +DEFINES += -DUSE_UTIL_DIRECTLY +USE_UTIL_DIRECTLY = 1 + diff --git a/mozilla/security/coreconf/coreconf.dep b/mozilla/security/coreconf/coreconf.dep new file mode 100644 index 0000000..b536cfc --- /dev/null +++ b/mozilla/security/coreconf/coreconf.dep @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* + * A dummy header file that is a dependency for all the object files. + * Used to force a full recompilation of NSS in Mozilla's Tinderbox + * depend builds. See comments in rules.mk. + */ + +#error "Do not include this header file." + diff --git a/mozilla/security/coreconf/coreconf.pl b/mozilla/security/coreconf/coreconf.pl new file mode 100644 index 0000000..ce97535 --- /dev/null +++ b/mozilla/security/coreconf/coreconf.pl @@ -0,0 +1,160 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +sub recursive_copy { + local($fromdir); + local($todir); + local(@dirlist); + $fromdir = shift; + $todir = shift; + + print STDERR "recursive copy called with $fromdir, $todir\n"; + +#remove any trailing slashes. + $fromdir =~ s/\/$//; + $todir =~ s/\/$//; + + opendir(DIR, $fromdir); + @dirlist = readdir DIR; + close DIR; + + + foreach $file (@dirlist) { + if (! (($file eq "." ) || ($file eq "..") )) { + + if (-d "$fromdir/$file") { + print STDERR "handling directory $todir/$file\n"; + &rec_mkdir("$todir/$file"); + &recursive_copy("$fromdir/$file","$todir/$file"); + } + else { + print STDERR "handling file $fromdir/$file\n"; + &my_copy("$fromdir/$file","$todir/$file"); + } + } + } +} + +sub parse_argv { + +# print STDERR "Parsing Variables\n"; + + foreach $q ( @ARGV ) { + if (! ($q =~ /=/)) { + $var{$lastassigned} .= " $q"; + } + else { + $q =~ /^([^=]*)=(.*)/; + $left = $1; + $right = $2; + + $right =~ s/ *$//; + $var{$left} = $right; + + $lastassigned = $left; + + } + print STDERR "Assigned $lastassigned = $var{$lastassigned}\n"; + } +} + + +# usage: &my_copy("dir/fromfile","dir2/tofile"); +# do a 'copy' - files only, 'to' MUST be a filename, not a directory. + +# fix this to be able to use copy on win nt. + +sub my_copy { + local($from); + local($to); + local($cpcmd); + + $from = shift; + $to = shift; + + if ( ! defined $var{OS_ARCH}) { + die "OS_ARCH not defined!"; + } + else { + if ($var{OS_ARCH} eq 'WINNT') { + $cpcmd = 'cp'; + } + else { + $cpcmd = 'cp'; + } + print STDERR "COPYING: $cpcmd $from $to\n"; + system("$cpcmd $from $to"); + } +} + + +sub old_my_copy { + local($from); + local($to); + + $from = shift; + $to = shift; + open(FIN, "<$from") || die("Can't read from file $from\n"); + if ( ! open(FOUT,">$to")) { + close FIN; + die "Can't write to file $to\n"; + } + while (read(FIN, $buf, 100000)) { + print FOUT $buf; + } + close (FIN); + close (FOUT); +} + +sub rec_mkdir { + local($arg); + local($t); + local($q); + + $arg = shift; + $t = ""; + foreach $q (split(/\//,$arg)) { + $t .= $q; + if (! ($t =~ /\.\.$/)) { + if ($t =~ /./) { + mkdir($t,0775); + } + } + $t.= '/'; + } +} + +1; diff --git a/mozilla/security/coreconf/cpdist.pl b/mozilla/security/coreconf/cpdist.pl new file mode 100755 index 0000000..9105bc1 --- /dev/null +++ b/mozilla/security/coreconf/cpdist.pl @@ -0,0 +1,199 @@ +#! /usr/local/bin/perl +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +require('coreconf.pl'); + +#######-- read in variables on command line into %var + +&parse_argv; + +### do the copy + +print STDERR "RELEASE TREE / MODULE = $var{RELEASE_TREE} $var{MODULE}\n"; + + + +# 1 +if ($var{RELEASE} eq "") { exit; } # Can't do release here, so exit. + +# 2 +#if (! ($var{RELEASE} =~ /\//)) { # if no specific version is specified in RELEASE variable +# $component = $var{RELEASE}; +#} +#else { # if a subcomponent/version is given in the RELEASE variable +# $var{RELEASE} =~ m|^([^/]*)/|; +# $component = $1; # everything before the first slash; +# } + +# 3 +$path = $var{RELEASE}; + + +# 4 +# find out what directory we would create for 'today' + +$year = (localtime)[5] + 1900; +$month = (localtime)[4] + 1; +$day = (localtime)[3]; +$today = sprintf( "%d%02d%02d", $year, $month, $day ); + +# 5 +# if version is null, then set the version to today. +if ($var{"RELEASE_VERSION"} eq "") { + $var{"RELEASE_VERSION"} = $today; +} + +#6 +$version = $var{"RELEASE_VERSION"}; # set RELEASE_VERSION to passed in variable + +#7 +# if version is today, then we will want to make a 'current' link. + +if ($version eq $today) { + $create_current = 1; +} + +#8 +# version can be a) passed in value from command line, b) value in manifest.mn +# or c) computed value such as '19970909' + + +$dir = "$var{'RELEASE_TREE'}/$path"; + +#9 +if (! (-e "$dir/$version" && -d "$dir/$version")) { + print "making dir $dir \n"; + &rec_mkdir("$dir/$version"); +} + + + +print "version = $version\n"; +print "path = $path\n"; +print "var{release_tree} = $var{'RELEASE_TREE'}\n"; +print "dir = $dir = RELEASE_TREE/path\n"; + + +#10 +if ($create_current == 1) { + +# unlinking and linking always occurs, even if the link is correct + print "unlinking $dir/current\n"; + unlink("$dir/current"); + + print "putting version number $today into 'current' file.."; + + open(FILE,">$dir/current") || die " couldn't open current\n"; + print FILE "$today\n"; + close(FILE); + print " ..done\n" + +} + +&rec_mkdir("$dir/$version/$var{'RELEASE_MD_DIR'}"); +&rec_mkdir("$dir/$version/$var{'RELEASE_XP_DIR'}"); + + + + +foreach $jarfile (split(/ /,$var{FILES}) ) { + print STDERR "---------------------------------------------\n"; + + $jarinfo = $var{$jarfile}; + + ($jardir,$jaropts) = split(/\|/,$jarinfo); + + if ($jaropts =~ /f/) { + print STDERR "Copying files $jardir....\n"; + } + else { + print STDERR "Copying jar file $jarfile....\n"; + } + + print "jaropts = $jaropts\n"; + + if ($jaropts =~ /m/) { + $destdir = $var{"RELEASE_MD_DIR"}; + print "found m, using MD dir $destdir\n"; + } + elsif ($jaropts =~ /x/) { + $destdir = $var{"RELEASE_XP_DIR"}; + print "found x, using XP dir $destdir\n"; + } + else { + die "Error: must specify m or x in jar options in $jarinfo line\n"; + } + + + $distdir = "$dir/$version/$destdir"; + + + + if ($jaropts =~ /f/) { + + print "splitting: \"$jardir\"\n"; + for $srcfile (split(/ /,$jardir)) { + +#if srcfile has a slash + if ($srcfile =~ m|/|) { +#pull out everything before the last slash into $1 + $srcfile =~ m|(.*)/|; + $distsubdir = "/$1"; + print "making dir $distdir$distsubdir\n"; + &rec_mkdir("$distdir$distsubdir"); + } + print "copy: from $srcfile\n"; + print " to $distdir$distsubdir\n"; + $srcprefix = ""; + if ($jaropts =~/m/) { + $srcprefix = "$var{'PLATFORM'}/"; + } + system("cp $srcprefix$srcfile $distdir$distsubdir"); + } + } + else { + $srcfile = "$var{SOURCE_RELEASE_PREFIX}/$jardir/$jarfile"; + + print "copy: from $srcfile\n"; + print " to $distdir\n"; + + system("cp $srcfile $distdir"); + + } + + } + diff --git a/mozilla/security/coreconf/headers.mk b/mozilla/security/coreconf/headers.mk new file mode 100644 index 0000000..e78fa72 --- /dev/null +++ b/mozilla/security/coreconf/headers.mk @@ -0,0 +1,56 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# Master "Core Components" include switch for support header files # +####################################################################### + +# +# Always append source-side machine-dependent (md) and cross-platform +# (xp) include paths +# + +INCLUDES += -I$(SOURCE_MDHEADERS_DIR) -I$(SOURCE_XPHEADERS_DIR) + +# +# Only append source-side private cross-platform include paths for +# sectools +# + +INCLUDES += -I$(SOURCE_XPPRIVATE_DIR) + +MK_HEADERS = included diff --git a/mozilla/security/coreconf/import.pl b/mozilla/security/coreconf/import.pl new file mode 100755 index 0000000..bc50077 --- /dev/null +++ b/mozilla/security/coreconf/import.pl @@ -0,0 +1,221 @@ +#! /usr/local/bin/perl +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +print STDERR "import.pl\n"; + +require('coreconf.pl'); + + +$returncode =0; + + +#######-- read in variables on command line into %var + +$var{UNZIP} = "unzip -o"; + +&parse_argv; + +if (! ($var{IMPORTS} =~ /\w/)) { + print STDERR "nothing to import\n"; +} + +######-- Do the import! + +foreach $import (split(/ /,$var{IMPORTS}) ) { + + print STDERR "\n\nIMPORTING .... $import\n-----------------------------\n"; + + +# if a specific version specified in IMPORT variable +# (if $import has a slash in it) + + if ($import =~ /\//) { + # $component=everything before the first slash of $import + + $import =~ m|^([^/]*)/|; + $component = $1; + + $import =~ m|^(.*)/([^/]*)$|; + + # $path=everything before the last slash of $import + $path = $1; + + # $version=everything after the last slash of $import + $version = $2; + + if ($var{VERSION} ne "current") { + $version = $var{VERSION}; + } + } + else { + $component = $import; + $path = $import; + $version = $var{VERSION}; + } + + $releasejardir = "$var{RELEASE_TREE}/$path"; + if ($version eq "current") { + print STDERR "Current version specified. Reading 'current' file ... \n"; + + open(CURRENT,"$releasejardir/current") || die "NO CURRENT FILE\n"; + $version = ; + $version =~ s/(\r?\n)*$//; # remove any trailing [CR/]LF's + close(CURRENT); + print STDERR "Using version $version\n"; + if ( $version eq "") { + die "Current version file empty. Stopping\n"; + } + } + + $releasejardir = "$releasejardir/$version"; + if ( ! -d $releasejardir) { + die "$releasejardir doesn't exist (Invalid Version?)\n"; + } + foreach $jarfile (split(/ /,$var{FILES})) { + + ($relpath,$distpath,$options) = split(/\|/, $var{$jarfile}); + + if ($var{'OVERRIDE_IMPORT_CHECK'} eq 'YES') { + $options =~ s/v//g; + } + + if ( $relpath ne "") { $releasejarpathname = "$releasejardir/$relpath";} + else { $releasejarpathname = $releasejardir; } + +# If a component doesn't have IDG versions, import the DBG ones + if( ! -e "$releasejarpathname/$jarfile" ) { + if( $relpath =~ /IDG\.OBJ$/ ) { + $relpath =~ s/IDG.OBJ/DBG.OBJ/; + $releasejarpathname = "$releasejardir/$relpath"; + } elsif( $relpath =~ /IDG\.OBJD$/ ) { + $relpath =~ s/IDG.OBJD/DBG.OBJD/; + $releasejarpathname = "$releasejardir/$relpath"; + } + } + + if (-e "$releasejarpathname/$jarfile") { + print STDERR "\nWorking on jarfile: $jarfile\n"; + + if ($distpath =~ m|/$|) { + $distpathname = "$distpath$component"; + } + else { + $distpathname = "$distpath"; + } + + +#the block below is used to determine whether or not the xp headers have +#already been imported for this component + + $doimport = 1; + if ($options =~ /v/) { # if we should check the imported version + print STDERR "Checking if version file exists $distpathname/version\n"; + if (-e "$distpathname/version") { + open( VFILE, "<$distpathname/version") || + die "Cannot open $distpathname/version for reading. Permissions?\n"; + $importversion = ; + close (VFILE); + $importversion =~ s/\r?\n$//; # Strip off any trailing CR/LF + if ($version eq $importversion) { + print STDERR "$distpathname version '$importversion' already imported. Skipping...\n"; + $doimport =0; + } + } + } + + if ($doimport == 1) { + if (! -d "$distpathname") { + &rec_mkdir("$distpathname"); + } + # delete the stuff in there already. + # (this should really be recursive delete.) + + if ($options =~ /v/) { + $remheader = "\nREMOVING files in '$distpathname/' :"; + opendir(DIR,"$distpathname") || + die ("Cannot read directory $distpathname\n"); + @filelist = readdir(DIR); + closedir(DIR); + foreach $file ( @filelist ) { + if (! ($file =~ m!/.?.$!) ) { + if (! (-d $file)) { + $file =~ m!([^/]*)$!; + print STDERR "$remheader $1"; + $remheader = " "; + unlink "$distpathname/$file"; + } + } + } + } + + + print STDERR "\n\n"; + + print STDERR "\nExtracting jarfile '$jarfile' to local directory $distpathname/\n"; + + print STDERR "$var{UNZIP} $releasejarpathname/$jarfile -d $distpathname\n"; + system("$var{UNZIP} $releasejarpathname/$jarfile -d $distpathname"); + + $r = $?; + + if ($options =~ /v/) { + if ($r == 0) { + unlink ("$distpathname/version"); + if (open(VFILE,">$distpathname/version")) { + print VFILE "$version\n"; + close(VFILE); + } + } + else { + print STDERR "Could not create '$distpathname/version'. Permissions?\n"; + $returncode ++; + } + } + } # if (doimport) + } # if (-e releasejarpathname/jarfile) + } # foreach jarfile) +} # foreach IMPORT + + + +exit($returncode); + + + + + diff --git a/mozilla/security/coreconf/jdk.mk b/mozilla/security/coreconf/jdk.mk new file mode 100644 index 0000000..98bc188 --- /dev/null +++ b/mozilla/security/coreconf/jdk.mk @@ -0,0 +1,536 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +ifdef NS_USE_JDK +####################################################################### +# [1] Define preliminary JDK "Core Components" toolset options # +####################################################################### + +# set default JDK java threading model +ifeq ($(JDK_THREADING_MODEL),) + JDK_THREADING_MODEL = native_threads +# no such thing as -native flag + JDK_THREADING_MODEL_OPT = +endif + +####################################################################### +# [2] Define platform-independent JDK "Core Components" options # +####################################################################### + +# set default location of the java classes repository +ifeq ($(JAVA_DESTPATH),) +ifdef BUILD_OPT + JAVA_DESTPATH = $(SOURCE_CLASSES_DIR) +else + JAVA_DESTPATH = $(SOURCE_CLASSES_DBG_DIR) +endif +endif + +# set default location of the package under the java classes repository +# note that this overrides the default package value in ruleset.mk +ifeq ($(PACKAGE),) + PACKAGE = . +endif + +# set default location of the java source code repository +ifeq ($(JAVA_SOURCEPATH),) + JAVA_SOURCEPATH = . +endif + +# add JNI directory to default include search path +ifneq ($(JNI_GEN),) + ifdef NSBUILDROOT + INCLUDES += -I$(JNI_GEN_DIR) -I$(SOURCE_XP_DIR) + else + INCLUDES += -I$(JNI_GEN_DIR) + endif +endif + +####################################################################### +# [3] Define platform-dependent JDK "Core Components" options # +####################################################################### + +# set [Microsoft Windows] platforms +ifeq ($(OS_ARCH), WINNT) + JAVA_CLASSES = $(JAVA_HOME)/jre/lib/rt.jar + + ifeq ($(JRE_HOME),) + JRE_HOME = $(JAVA_HOME) + JRE_CLASSES = $(JAVA_CLASSES) + else + ifeq ($(JRE_CLASSES),) + JRE_CLASSES = $(JRE_HOME)/lib/rt.jar + endif + endif + + PATH_SEPARATOR = ; + + # (2) specify "header" information + JAVA_ARCH = win32 + + INCLUDES += -I$(JAVA_HOME)/include + INCLUDES += -I$(JAVA_HOME)/include/$(JAVA_ARCH) + + # currently, disable JIT option on this platform + JDK_JIT_OPT = -nojit +endif + +# set [Sun Solaris] platforms +ifeq ($(OS_ARCH), SunOS) + JAVA_CLASSES = $(JAVA_HOME)/jre/lib/rt.jar + + ifeq ($(JRE_HOME),) + JRE_HOME = $(JAVA_HOME) + JRE_CLASSES = $(JAVA_CLASSES) + else + ifeq ($(JRE_CLASSES),) + JRE_CLASSES = $(JRE_HOME)/lib/rt.jar + endif + endif + + PATH_SEPARATOR = : + + # (2) specify "header" information + JAVA_ARCH = solaris + + INCLUDES += -I$(JAVA_HOME)/include + INCLUDES += -I$(JAVA_HOME)/include/$(JAVA_ARCH) + + # currently, disable JIT option on this platform + JDK_JIT_OPT = +endif + +# set [Hewlett Packard HP-UX] platforms +ifeq ($(OS_ARCH), HP-UX) + JAVA_CLASSES = $(JAVA_HOME)/jre/lib/rt.jar + + ifeq ($(JRE_HOME),) + JRE_HOME = $(JAVA_HOME) + JRE_CLASSES = $(JAVA_CLASSES) + else + ifeq ($(JRE_CLASSES),) + JRE_CLASSES = $(JRE_HOME)/lib/rt.jar + endif + endif + + PATH_SEPARATOR = : + + # (2) specify "header" information + JAVA_ARCH = hp-ux + + INCLUDES += -I$(JAVA_HOME)/include + INCLUDES += -I$(JAVA_HOME)/include/$(JAVA_ARCH) + + # no JIT option available on this platform + JDK_JIT_OPT = +endif + +# set [Redhat Linux] platforms +ifeq ($(OS_ARCH), Linux) + JAVA_CLASSES = $(JAVA_HOME)/jre/lib/rt.jar + + ifeq ($(JRE_HOME),) + JRE_HOME = $(JAVA_HOME) + JRE_CLASSES = $(JAVA_CLASSES) + else + ifeq ($(JRE_CLASSES),) + JRE_CLASSES = $(JRE_HOME)/lib/rt.jar + endif + endif + + PATH_SEPARATOR = : + + # (2) specify "header" information + JAVA_ARCH = linux + + INCLUDES += -I$(JAVA_HOME)/include + INCLUDES += -I$(JAVA_HOME)/include/$(JAVA_ARCH) + + # no JIT option available on this platform + JDK_JIT_OPT = +endif + +# set [Mac OS X] platforms +ifeq ($(OS_ARCH), Darwin) + JAVA_CLASSES = $(JAVA_HOME)/../Classes/classes.jar + + ifeq ($(JRE_HOME),) + JRE_HOME = $(JAVA_HOME) + JRE_CLASSES = $(JAVA_CLASSES) + else + ifeq ($(JRE_CLASSES),) + JRE_CLASSES = $(JRE_HOME)/../Classes/classes.jar + endif + endif + + PATH_SEPARATOR = : + + # (2) specify "header" information + JAVA_ARCH = darwin + + INCLUDES += -I$(JAVA_HOME)/include + INCLUDES += -I$(JAVA_HOME)/include/$(JAVA_ARCH) + + # no JIT option available on this platform + JDK_JIT_OPT = +endif + +# set [IBM AIX] platforms +ifeq ($(OS_ARCH), AIX) + JAVA_CLASSES = $(JAVA_HOME)/jre/lib/rt.jar + + ifeq ($(JRE_HOME),) + JRE_HOME = $(JAVA_HOME) + JRE_CLASSES = $(JAVA_CLASSES) + else + ifeq ($(JRE_CLASSES),) + JRE_CLASSES = $(JRE_HOME)/lib/rt.jar + endif + endif + + PATH_SEPARATOR = : + + # (2) specify "header" information + JAVA_ARCH = aix + + INCLUDES += -I$(JAVA_HOME)/include + INCLUDES += -I$(JAVA_HOME)/include/$(JAVA_ARCH) + + # no JIT option available on this platform + JDK_JIT_OPT = +endif + +# set [Digital UNIX] platforms +ifeq ($(OS_ARCH), OSF1) + JAVA_CLASSES = $(JAVA_HOME)/jre/lib/rt.jar + + ifeq ($(JRE_HOME),) + JRE_HOME = $(JAVA_HOME) + JRE_CLASSES = $(JAVA_CLASSES) + else + ifeq ($(JRE_CLASSES),) + JRE_CLASSES = $(JRE_HOME)/lib/rt.jar + endif + endif + + PATH_SEPARATOR = : + + # (2) specify "header" information + JAVA_ARCH = alpha + + INCLUDES += -I$(JAVA_HOME)/include + INCLUDES += -I$(JAVA_HOME)/include/$(JAVA_ARCH) + + # no JIT option available on this platform + JDK_JIT_OPT = +endif + +# set [Silicon Graphics IRIX] platforms +ifeq ($(OS_ARCH), IRIX) + JAVA_CLASSES = $(JAVA_HOME)/lib/dev.jar:$(JAVA_HOME)/lib/rt.jar + + ifeq ($(JRE_HOME),) + JRE_HOME = $(JAVA_HOME) + JRE_CLASSES = $(JAVA_CLASSES) + else + ifeq ($(JRE_CLASSES),) + JRE_CLASSES = $(JRE_HOME)/lib/dev.jar:$(JRE_HOME)/lib/rt.jar + endif + endif + + PATH_SEPARATOR = : + + # (2) specify "header" information + JAVA_ARCH = irix + + INCLUDES += -I$(JAVA_HOME)/include + INCLUDES += -I$(JAVA_HOME)/include/$(JAVA_ARCH) + + # no JIT option available on this platform + JDK_JIT_OPT = +endif + +####################################################################### +# [4] Define remaining JDK "Core Components" default toolset options # +####################################################################### + +# set JDK optimization model +ifeq ($(BUILD_OPT),1) + JDK_OPTIMIZER_OPT = -O +else + JDK_OPTIMIZER_OPT = -g +endif + +# set minimal JDK debugging model +ifeq ($(JDK_DEBUG),1) + JDK_DEBUG_OPT = -debug +else + JDK_DEBUG_OPT = +endif + +# set default path to repository for JDK classes +ifeq ($(JDK_CLASS_REPOSITORY_OPT),) + JDK_CLASS_REPOSITORY_OPT = -d $(JAVA_DESTPATH) +endif + +# define a default JDK classpath +ifeq ($(JDK_CLASSPATH),) + JDK_CLASSPATH = '$(JAVA_DESTPATH)$(PATH_SEPARATOR)$(JAVA_SOURCEPATH)$(PATH_SEPARATOR)$(JAVA_CLASSES)' +endif + +# by default, override CLASSPATH environment variable using the JDK classpath option with $(JDK_CLASSPATH) +ifeq ($(JDK_CLASSPATH_OPT),) + JDK_CLASSPATH_OPT = -classpath $(JDK_CLASSPATH) +endif + +ifeq ($(USE_64), 1) + JDK_USE_64 = -d64 +endif + +endif + + +####################################################################### +# [5] Define JDK "Core Components" toolset; # +# (always allow a user to override these values) # +####################################################################### + +# +# (1) appletviewer +# + +ifeq ($(APPLETVIEWER),) + APPLETVIEWER_PROG = $(JAVA_HOME)/bin/appletviewer$(PROG_SUFFIX) + APPLETVIEWER_FLAGS = $(JDK_THREADING_MODEL_OPT) + APPLETVIEWER_FLAGS += $(JDK_DEBUG_OPT) + APPLETVIEWER_FLAGS += $(JDK_JIT_OPT) + APPLETVIEWER = $(APPLETVIEWER_PROG) $(APPLETVIEWER_FLAGS) +endif + +# +# (2) jar +# + +ifeq ($(JAR),) + JAR_PROG = $(JAVA_HOME)/bin/jar$(PROG_SUFFIX) + JAR_FLAGS = $(JDK_THREADING_MODEL_OPT) + JAR = $(JAR_PROG) $(JAR_FLAGS) +endif + +# +# (3) java +# + +ifeq ($(JAVA),) + JAVA_PROG = $(JAVA_HOME)/bin/java$(PROG_SUFFIX) + JAVA_FLAGS = $(JDK_THREADING_MODEL_OPT) + JAVA_FLAGS += $(JDK_DEBUG_OPT) + JAVA_FLAGS += $(JDK_CLASSPATH_OPT) + JAVA_FLAGS += $(JDK_JIT_OPT) + JAVA_FLAGS += $(JDK_USE_64) + JAVA = $(JAVA_PROG) $(JAVA_FLAGS) +endif + +# +# (4) javac +# + +ifeq ($(JAVAC),) + JAVAC_PROG = $(JAVA_HOME)/bin/javac$(PROG_SUFFIX) + JAVAC_FLAGS = $(JDK_THREADING_MODEL_OPT) + JAVAC_FLAGS += $(JDK_OPTIMIZER_OPT) + JAVAC_FLAGS += $(JDK_DEBUG_OPT) + JAVAC_FLAGS += $(JDK_CLASSPATH_OPT) + JAVAC_FLAGS += $(JDK_CLASS_REPOSITORY_OPT) + JAVAC_FLAGS += $(JDK_USE_64) + JAVAC = $(JAVAC_PROG) $(JAVAC_FLAGS) +endif + +# +# (5) javadoc +# + +ifeq ($(JAVADOC),) + JAVADOC_PROG = $(JAVA_HOME)/bin/javadoc$(PROG_SUFFIX) + JAVADOC_FLAGS = $(JDK_THREADING_MODEL_OPT) + JAVADOC_FLAGS += $(JDK_CLASSPATH_OPT) + JAVADOC = $(JAVADOC_PROG) $(JAVADOC_FLAGS) +endif + +# +# (6) javah +# + +ifeq ($(JAVAH),) + JAVAH_PROG = $(JAVA_HOME)/bin/javah$(PROG_SUFFIX) + JAVAH_FLAGS = $(JDK_THREADING_MODEL_OPT) + JAVAH_FLAGS += $(JDK_CLASSPATH_OPT) + JAVAH = $(JAVAH_PROG) $(JAVAH_FLAGS) +endif + +# +# (7) javakey +# + +ifeq ($(JAVAKEY),) + JAVAKEY_PROG = $(JAVA_HOME)/bin/javakey$(PROG_SUFFIX) + JAVAKEY_FLAGS = $(JDK_THREADING_MODEL_OPT) + JAVAKEY = $(JAVAKEY_PROG) $(JAVAKEY_FLAGS) +endif + +# +# (8) javap +# + +ifeq ($(JAVAP),) + JAVAP_PROG = $(JAVA_HOME)/bin/javap$(PROG_SUFFIX) + JAVAP_FLAGS = $(JDK_THREADING_MODEL_OPT) + JAVAP_FLAGS += $(JDK_CLASSPATH_OPT) + JAVAP = $(JAVAP_PROG) $(JAVAP_FLAGS) +endif + +# +# (9) javat +# + +ifeq ($(JAVAT),) + JAVAT_PROG = $(JAVA_HOME)/bin/javat$(PROG_SUFFIX) + JAVAT_FLAGS = $(JDK_THREADING_MODEL_OPT) + JAVAT = $(JAVAT_PROG) $(JAVAT_FLAGS) +endif + +# +# (10) javaverify +# + +ifeq ($(JAVAVERIFY),) + JAVAVERIFY_PROG = $(JAVA_HOME)/bin/javaverify$(PROG_SUFFIX) + JAVAVERIFY_FLAGS = $(JDK_THREADING_MODEL_OPT) + JAVAVERIFY = $(JAVAVERIFY_PROG) $(JAVAVERIFY_FLAGS) +endif + +# +# (11) javaw +# + +ifeq ($(JAVAW),) + jJAVAW_PROG = $(JAVA_HOME)/bin/javaw$(PROG_SUFFIX) + jJAVAW_FLAGS = $(JDK_THREADING_MODEL_OPT) + jJAVAW_FLAGS += $(JDK_DEBUG_OPT) + jJAVAW_FLAGS += $(JDK_CLASSPATH_OPT) + jJAVAW_FLAGS += $(JDK_JIT_OPT) + jJAVAW = $(JAVAW_PROG) $(JAVAW_FLAGS) +endif + +# +# (12) jdb +# + +ifeq ($(JDB),) + JDB_PROG = $(JAVA_HOME)/bin/jdb$(PROG_SUFFIX) + JDB_FLAGS = $(JDK_THREADING_MODEL_OPT) + JDB_FLAGS += $(JDK_DEBUG_OPT) + JDB_FLAGS += $(JDK_CLASSPATH_OPT) + JDB_FLAGS += $(JDK_JIT_OPT) + JDB = $(JDB_PROG) $(JDB_FLAGS) +endif + +# +# (13) jre +# + +ifeq ($(JRE),) + JRE_PROG = $(JAVA_HOME)/bin/jre$(PROG_SUFFIX) + JRE_FLAGS = $(JDK_THREADING_MODEL_OPT) + JRE_FLAGS += $(JDK_CLASSPATH_OPT) + JRE_FLAGS += $(JDK_JIT_OPT) + JRE = $(JRE_PROG) $(JRE_FLAGS) +endif + +# +# (14) jrew +# + +ifeq ($(JREW),) + JREW_PROG = $(JAVA_HOME)/bin/jrew$(PROG_SUFFIX) + JREW_FLAGS = $(JDK_THREADING_MODEL_OPT) + JREW_FLAGS += $(JDK_CLASSPATH_OPT) + JREW_FLAGS += $(JDK_JIT_OPT) + JREW = $(JREW_PROG) $(JREW_FLAGS) +endif + +# +# (15) native2ascii +# + +ifeq ($(NATIVE2ASCII),) + NATIVE2ASCII_PROG = $(JAVA_HOME)/bin/native2ascii$(PROG_SUFFIX) + NATIVE2ASCII_FLAGS = $(JDK_THREADING_MODEL_OPT) + NATIVE2ASCII = $(NATIVE2ASCII_PROG) $(NATIVE2ASCII_FLAGS) +endif + +# +# (16) rmic +# + +ifeq ($(RMIC),) + RMIC_PROG = $(JAVA_HOME)/bin/rmic$(PROG_SUFFIX) + RMIC_FLAGS = $(JDK_THREADING_MODEL_OPT) + RMIC_FLAGS += $(JDK_OPTIMIZER_OPT) + RMIC_FLAGS += $(JDK_CLASSPATH_OPT) + RMIC = $(RMIC_PROG) $(RMIC_FLAGS) +endif + +# +# (17) rmiregistry +# + +ifeq ($(RMIREGISTRY),) + RMIREGISTRY_PROG = $(JAVA_HOME)/bin/rmiregistry$(PROG_SUFFIX) + RMIREGISTRY_FLAGS = $(JDK_THREADING_MODEL_OPT) + RMIREGISTRY = $(RMIREGISTRY_PROG) $(RMIREGISTRY_FLAGS) +endif + +# +# (18) serialver +# + +ifeq ($(SERIALVER),) + SERIALVER_PROG = $(JAVA_HOME)/bin/serialver$(PROG_SUFFIX) + SERIALVER_FLAGS = $(JDK_THREADING_MODEL_OPT) + SERIALVER = $(SERIALVER_PROG) $(SERIALVER_FLAGS) +endif diff --git a/mozilla/security/coreconf/jniregen.pl b/mozilla/security/coreconf/jniregen.pl new file mode 100755 index 0000000..a604fe0 --- /dev/null +++ b/mozilla/security/coreconf/jniregen.pl @@ -0,0 +1,111 @@ +#!/usr/local/bin/perl +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# Input: -d dir -j javahcmd foo1 foo2 . . . +# Compares generated "_jni/foo1.h" file with "foo1.class", and +# generated "_jni/foo2.h" file with "foo2.class", etc. +# (NOTE: unlike its closely related cousin, outofdate.pl, +# the "-d dir" must always be specified) +# Runs the javahcmd on all files that are different. +# +# Returns: list of headers which are OLDER than corresponding class +# files (non-existent class files are considered to be real old :-) + +my $javah = ""; +my $classdir = ""; + +while(1) { + if ($ARGV[0] eq '-d') { + $classdir = $ARGV[1]; + $classdir .= "/"; + shift; + shift; + } elsif($ARGV[0] eq '-j') { + $javah = $ARGV[1]; + shift; + shift; + } else { + last; + } +} + +if( $javah eq "") { + die "Must specify -j "; +} +if( $classdir eq "") { + die "Must specify -d "; +} + +foreach $filename (@ARGV) +{ + $headerfilename = "_jni/"; + $headerfilename .= $filename; + $headerfilename =~ s/\./_/g; + $headerfilename .= ".h"; + + $classfilename = $filename; + $classfilename =~ s|\.|/|g; + $classfilename .= ".class"; + + $classfilename = $classdir . $classfilename; + + + ( $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $headermtime, + $ctime, $blksize, $blocks ) = stat( $headerfilename ); + + ( $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $classmtime, + $ctime, $blksize, $blocks ) = stat( $classfilename ); + + if( $headermtime < $classmtime ) + { + # NOTE: Since this is used by "javah", and "javah" refuses to overwrite + # an existing file, we force an unlink from this script, since + # we actually want to regenerate the header file at this time. + unlink $headerfilename; + push @filelist, $filename; + } +} + +if( @filelist ) { + $cmd = "$javah " . join(" ",@filelist); + $cmd =~ s/\'/\"/g; # because windows doesn't understand single quote + print "$cmd\n"; + exit (system($cmd) >> 8); +} else { + print "All JNI header files up to date.\n" +} diff --git a/mozilla/security/coreconf/location.mk b/mozilla/security/coreconf/location.mk new file mode 100644 index 0000000..257d0d3 --- /dev/null +++ b/mozilla/security/coreconf/location.mk @@ -0,0 +1,106 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# Master "Core Components" macros to figure out binary code location # +####################################################################### + +# +# Figure out where the binary code lives. +# + +ifdef BUILD_TREE +ifdef LIBRARY_NAME +BUILD = $(BUILD_TREE)/nss/$(LIBRARY_NAME) +OBJDIR = $(BUILD_TREE)/nss/$(LIBRARY_NAME) +DEPENDENCIES = $(BUILD_TREE)/nss/$(LIBRARY_NAME)/.md +else +BUILD = $(BUILD_TREE)/nss +OBJDIR = $(BUILD_TREE)/nss +DEPENDENCIES = $(BUILD_TREE)/nss/.md +endif +else +BUILD = $(PLATFORM) +OBJDIR = $(PLATFORM) +DEPENDENCIES = $(PLATFORM)/.md +endif + +DIST = $(SOURCE_PREFIX)/$(PLATFORM) + +ifdef BUILD_DEBUG_GC + DEFINES += -DDEBUG_GC +endif + +GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*) + +ifdef NSPR_INCLUDE_DIR + INCLUDES += -I$(NSPR_INCLUDE_DIR) +endif + +ifndef NSPR_LIB_DIR + NSPR_LIB_DIR = $(DIST)/lib +endif + +ifdef NSS_INCLUDE_DIR + INCLUDES += -I$(NSS_INCLUDE_DIR) +endif + +ifndef NSS_LIB_DIR + NSS_LIB_DIR = $(DIST)/lib +endif + +ifdef NSSUTIL_INCLUDE_DIR + INCLUDES += -I$(NSSUTIL_INCLUDE_DIR) +endif + +ifndef NSSUTIL_LIB_DIR + NSSUTIL_LIB_DIR = $(DIST)/lib +endif + +ifdef SOFTOKEN_INCLUDE_DIR + INCLUDES += -I$(SOFTOKEN_INCLUDE_DIR) +endif + +ifndef SOFTOKEN_LIB_DIR + SOFTOKEN_LIB_DIR = $(DIST)/lib +endif + +ifndef SQLITE_LIB_NAME + SQLITE_LIB_NAME = sqlite3 +endif + +MK_LOCATION = included diff --git a/mozilla/security/coreconf/mkdepend/Makefile b/mozilla/security/coreconf/mkdepend/Makefile new file mode 100644 index 0000000..ab280e6 --- /dev/null +++ b/mozilla/security/coreconf/mkdepend/Makefile @@ -0,0 +1,93 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../.. +CORE_DEPTH = ../.. + +MODULE = coreconf + +CSRCS = \ + cppsetup.c \ + ifparser.c \ + include.c \ + main.c \ + parse.c \ + pr.c + +PROGRAM = mkdepend + +# Indicate that this directory builds build tools. +INTERNAL_TOOLS = 1 + + +include $(DEPTH)/coreconf/config.mk + +TARGETS = $(PROGRAM) +ifeq (,$(filter-out OS2 WIN%,$(OS_TARGET))) +DEFINES += -DNO_X11 +else +INSTALL = true +endif + +ifdef NATIVE_CC +CC=$(NATIVE_CC) +endif + +ifdef NATIVE_FLAGS +OS_CFLAGS=$(NATIVE_FLAGS) +endif + +include $(DEPTH)/coreconf/rules.mk + +ifdef GNU_CC +OPTIMIZER = -O3 +else +ifeq ($(OS_ARCH),SunOS) +OPTIMIZER = -fast +endif +ifeq ($(OS_ARCH),WINNT) +OPTIMIZER = -Ox +endif +endif + +DEFINES += -DINCLUDEDIR=\"/usr/include\" -DOBJSUFFIX=\".$(OBJ_SUFFIX)\" + +# Redefine MAKE_OBJDIR for just this directory +define MAKE_OBJDIR +if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); fi +endef + diff --git a/mozilla/security/coreconf/mkdepend/cppsetup.c b/mozilla/security/coreconf/mkdepend/cppsetup.c new file mode 100644 index 0000000..49a746a --- /dev/null +++ b/mozilla/security/coreconf/mkdepend/cppsetup.c @@ -0,0 +1,233 @@ +/* $Xorg: cppsetup.c,v 1.5 2001/02/09 02:03:16 xorgcvs Exp $ */ +/* + +Copyright (c) 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ +/* $XFree86: xc/config/makedepend/cppsetup.c,v 3.11 2001/12/17 20:52:22 dawes Exp $ */ + +#include "def.h" + +#ifdef CPP +/* + * This file is strictly for the sake of cpy.y and yylex.c (if + * you indeed have the source for cpp). + */ +#define IB 1 +#define SB 2 +#define NB 4 +#define CB 8 +#define QB 16 +#define WB 32 +#define SALT '#' +#if defined(pdp11) || defined(vax) || defined(ns16000) || defined(mc68000) || defined(ibm032) +#define COFF 128 +#else +#define COFF 0 +#endif +/* + * These variables used by cpy.y and yylex.c + */ +extern char *outp, *inp, *newp, *pend; +extern char *ptrtab; +extern char fastab[]; +extern char slotab[]; + +/* + * cppsetup + */ +struct filepointer *currentfile; +struct inclist *currentinc; + +int +cppsetup(char *line, struct filepointer *filep, struct inclist *inc) +{ + char *p, savec; + static boolean setupdone = FALSE; + boolean value; + + if (!setupdone) { + cpp_varsetup(); + setupdone = TRUE; + } + + currentfile = filep; + currentinc = inc; + inp = newp = line; + for (p=newp; *p; p++) + ; + + /* + * put a newline back on the end, and set up pend, etc. + */ + *p++ = '\n'; + savec = *p; + *p = '\0'; + pend = p; + + ptrtab = slotab+COFF; + *--inp = SALT; + outp=inp; + value = yyparse(); + *p = savec; + return(value); +} + +struct symtab **lookup(symbol) + char *symbol; +{ + static struct symtab *undefined; + struct symtab **sp; + + sp = isdefined(symbol, currentinc, NULL); + if (sp == NULL) { + sp = &undefined; + (*sp)->s_value = NULL; + } + return (sp); +} + +pperror(tag, x0,x1,x2,x3,x4) + int tag,x0,x1,x2,x3,x4; +{ + warning("\"%s\", line %d: ", currentinc->i_file, currentfile->f_line); + warning(x0,x1,x2,x3,x4); +} + + +yyerror(s) + register char *s; +{ + fatalerr("Fatal error: %s\n", s); +} +#else /* not CPP */ + +#include "ifparser.h" +struct _parse_data { + struct filepointer *filep; + struct inclist *inc; + char *filename; + const char *line; +}; + +static const char * +my_if_errors (IfParser *ip, const char *cp, const char *expecting) +{ + struct _parse_data *pd = (struct _parse_data *) ip->data; + int lineno = pd->filep->f_line; + char *filename = pd->filename; + char prefix[300]; + int prefixlen; + int i; + + sprintf (prefix, "\"%s\":%d", filename, lineno); + prefixlen = strlen(prefix); + fprintf (stderr, "%s: %s", prefix, pd->line); + i = cp - pd->line; + if (i > 0 && pd->line[i-1] != '\n') { + putc ('\n', stderr); + } + for (i += prefixlen + 3; i > 0; i--) { + putc (' ', stderr); + } + fprintf (stderr, "^--- expecting %s\n", expecting); + return NULL; +} + + +#define MAXNAMELEN 256 + +static struct symtab ** +lookup_variable (IfParser *ip, const char *var, int len) +{ + char tmpbuf[MAXNAMELEN + 1]; + struct _parse_data *pd = (struct _parse_data *) ip->data; + + if (len > MAXNAMELEN) + return 0; + + strncpy (tmpbuf, var, len); + tmpbuf[len] = '\0'; + return isdefined (tmpbuf, pd->inc, NULL); +} + + +static int +my_eval_defined (IfParser *ip, const char *var, int len) +{ + if (lookup_variable (ip, var, len)) + return 1; + else + return 0; +} + +#define isvarfirstletter(ccc) (isalpha(ccc) || (ccc) == '_') + +static long +my_eval_variable (IfParser *ip, const char *var, int len) +{ + long val; + struct symtab **s; + + s = lookup_variable (ip, var, len); + if (!s) + return 0; + do { + var = (*s)->s_value; + if (!isvarfirstletter(*var) || !strcmp((*s)->s_name, var)) + break; + s = lookup_variable (ip, var, strlen(var)); + } while (s); + + var = ParseIfExpression(ip, var, &val); + if (var && *var) debug(4, ("extraneous: '%s'\n", var)); + return val; +} + +int +cppsetup(char *filename, + char *line, + struct filepointer *filep, + struct inclist *inc) +{ + IfParser ip; + struct _parse_data pd; + long val = 0; + + pd.filep = filep; + pd.inc = inc; + pd.line = line; + pd.filename = filename; + ip.funcs.handle_error = my_if_errors; + ip.funcs.eval_defined = my_eval_defined; + ip.funcs.eval_variable = my_eval_variable; + ip.data = (char *) &pd; + + (void) ParseIfExpression (&ip, line, &val); + if (val) + return IF; + else + return IFFALSE; +} +#endif /* CPP */ + diff --git a/mozilla/security/coreconf/mkdepend/def.h b/mozilla/security/coreconf/mkdepend/def.h new file mode 100644 index 0000000..d6e5f89 --- /dev/null +++ b/mozilla/security/coreconf/mkdepend/def.h @@ -0,0 +1,184 @@ +/* $Xorg: def.h,v 1.4 2001/02/09 02:03:16 xorgcvs Exp $ */ +/* + +Copyright (c) 1993, 1994, 1998 The Open Group. + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ +/* $XFree86: xc/config/makedepend/def.h,v 3.14 2003/01/17 17:09:49 tsi Exp $ */ + +#ifndef NO_X11 +#include +#include +#endif +#include +#include +#include +#include +#if 0 +#ifndef X_NOT_POSIX +#ifndef _POSIX_SOURCE +#define _POSIX_SOURCE +#endif +#endif +#endif +#include +#include +#include + +#define MAXDEFINES 512 +#define MAXFILES 1024 +#define MAXINCFILES 256 /* "-include" files */ +#define MAXDIRS 1024 +#define SYMTABINC 10 /* must be > 1 for define() to work right */ +#define TRUE 1 +#define FALSE 0 + +/* the following must match the directives table in main.c */ +#define IF 0 +#define IFDEF 1 +#define IFNDEF 2 +#define ELSE 3 +#define ENDIF 4 +#define DEFINE 5 +#define UNDEF 6 +#define INCLUDE 7 +#define LINE 8 +#define PRAGMA 9 +#define ERROR 10 +#define IDENT 11 +#define SCCS 12 +#define ELIF 13 +#define EJECT 14 +#define WARNING 15 +#define INCLUDENEXT 16 +#define IFFALSE 17 /* pseudo value --- never matched */ +#define ELIFFALSE 18 /* pseudo value --- never matched */ +#define INCLUDEDOT 19 /* pseudo value --- never matched */ +#define IFGUESSFALSE 20 /* pseudo value --- never matched */ +#define ELIFGUESSFALSE 21 /* pseudo value --- never matched */ +#define INCLUDENEXTDOT 22 /* pseudo value --- never matched */ + +#ifdef DEBUG +extern int _debugmask; +/* + * debug levels are: + * + * 0 show ifn*(def)*,endif + * 1 trace defined/!defined + * 2 show #include + * 3 show #include SYMBOL + * 4-6 unused + */ +#define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; } +#else +#define debug(level,arg) /**/ +#endif /* DEBUG */ + +typedef unsigned char boolean; + +struct symtab { + char *s_name; + char *s_value; +}; + +/* possible i_flag */ +#define DEFCHECKED (1<<0) /* whether defines have been checked */ +#define NOTIFIED (1<<1) /* whether we have revealed includes */ +#define MARKED (1<<2) /* whether it's in the makefile */ +#define SEARCHED (1<<3) /* whether we have read this */ +#define FINISHED (1<<4) /* whether we are done reading this */ +#define INCLUDED_SYM (1<<5) /* whether #include SYMBOL was found + Can't use i_list if TRUE */ +struct inclist { + char *i_incstring; /* string from #include line */ + char *i_file; /* path name of the include file */ + struct inclist **i_list; /* list of files it itself includes */ + int i_listlen; /* length of i_list */ + struct symtab **i_defs; /* symbol table for this file and its + children when merged */ + int i_ndefs; /* current # defines */ + boolean *i_merged; /* whether we have merged child + defines */ + unsigned char i_flags; +}; + +struct filepointer { + char *f_name; + char *f_p; + char *f_base; + char *f_end; + long f_len; + long f_line; + long cmdinc_count; + char **cmdinc_list; + long cmdinc_line; +}; + +#include +#if defined(macII) && !defined(__STDC__) /* stdlib.h fails to define these */ +char *malloc(), *realloc(); +#endif /* macII */ + +char *copy(char *str); +int match(char *str, char **list); +char *base_name(char *file); +char *getnextline(struct filepointer *fp); +struct symtab **slookup(char *symbol, struct inclist *file); +struct symtab **isdefined(char *symbol, struct inclist *file, + struct inclist **srcfile); +struct symtab **fdefined(char *symbol, struct inclist *file, + struct inclist **srcfile); +struct filepointer *getfile(char *file); +void included_by(struct inclist *ip, + struct inclist *newfile); +struct inclist *newinclude(char *newfile, char *incstring); +void inc_clean (void); +struct inclist *inc_path(char *file, char *include, int type); + +void freefile(struct filepointer *fp); + +void define2(char *name, char *val, struct inclist *file); +void define(char *def, struct inclist *file); +void undefine(char *symbol, struct inclist *file); +int find_includes(struct filepointer *filep, + struct inclist *file, + struct inclist *file_red, + int recursion, boolean failOK); + +void recursive_pr_include(struct inclist *head, + char *file, char *base); +void add_include(struct filepointer *filep, + struct inclist *file, + struct inclist *file_red, + char *include, int type, + boolean failOK); + +int cppsetup(char *filename, + char *line, + struct filepointer *filep, + struct inclist *inc); + + +extern void fatalerr(char *, ...); +extern void warning(char *, ...); +extern void warning1(char *, ...); diff --git a/mozilla/security/coreconf/mkdepend/ifparser.c b/mozilla/security/coreconf/mkdepend/ifparser.c new file mode 100644 index 0000000..0b184c2 --- /dev/null +++ b/mozilla/security/coreconf/mkdepend/ifparser.c @@ -0,0 +1,551 @@ +/* + * $Xorg: ifparser.c,v 1.3 2000/08/17 19:41:50 cpqbld Exp $ + * + * Copyright 1992 Network Computing Devices, Inc. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Network Computing Devices may not be + * used in advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. Network Computing Devices makes + * no representations about the suitability of this software for any purpose. + * It is provided ``as is'' without express or implied warranty. + * + * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, + * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Author: Jim Fulton + * Network Computing Devices, Inc. + * + * Simple if statement processor + * + * This module can be used to evaluate string representations of C language + * if constructs. It accepts the following grammar: + * + * EXPRESSION := VALUE + * | VALUE BINOP EXPRESSION + * | VALUE '?' EXPRESSION ':' EXPRESSION + * + * VALUE := '(' EXPRESSION ')' + * | '!' VALUE + * | '-' VALUE + * | '+' VALUE + * | '~' VALUE + * | 'defined' '(' variable ')' + * | 'defined' variable + * | # variable '(' variable-list ')' + * | variable + * | number + * + * BINOP := '*' | '/' | '%' + * | '+' | '-' + * | '<<' | '>>' + * | '<' | '>' | '<=' | '>=' + * | '==' | '!=' + * | '&' | '^' | '|' + * | '&&' | '||' + * + * The normal C order of precedence is supported. + * + * + * External Entry Points: + * + * ParseIfExpression parse a string for #if + */ +/* $XFree86: xc/config/makedepend/ifparser.c,v 3.11 2002/09/23 01:48:08 tsi Exp $ */ + +#include "ifparser.h" +#include +#include +#include + +/**************************************************************************** + Internal Macros and Utilities for Parser + ****************************************************************************/ + +#define DO(val) if (!(val)) return NULL +#define CALLFUNC(ggg,fff) (*((ggg)->funcs.fff)) +#define SKIPSPACE(ccc) while (isspace(*ccc)) ccc++ +#define isvarfirstletter(ccc) (isalpha(ccc) || (ccc) == '_') + + +static const char * +parse_variable (IfParser *g, const char *cp, const char **varp) +{ + SKIPSPACE (cp); + + if (!isvarfirstletter (*cp)) + return CALLFUNC(g, handle_error) (g, cp, "variable name"); + + *varp = cp; + /* EMPTY */ + for (cp++; isalnum(*cp) || *cp == '_'; cp++) ; + return cp; +} + + +static const char * +parse_number (IfParser *g, const char *cp, long *valp) +{ + long base = 10; + SKIPSPACE (cp); + + if (!isdigit(*cp)) + return CALLFUNC(g, handle_error) (g, cp, "number"); + + *valp = 0; + + if (*cp == '0') { + cp++; + if ((*cp == 'x') || (*cp == 'X')) { + base = 16; + cp++; + } else { + base = 8; + } + } + + /* Ignore overflows and assume ASCII, what source is usually written in */ + while (1) { + int increment = -1; + if (base == 8) { + if ((*cp >= '0') && (*cp <= '7')) + increment = *cp++ - '0'; + } else if (base == 16) { + if ((*cp >= '0') && (*cp <= '9')) + increment = *cp++ - '0'; + else if ((*cp >= 'A') && (*cp <= 'F')) + increment = *cp++ - ('A' - 10); + else if ((*cp >= 'a') && (*cp <= 'f')) + increment = *cp++ - ('a' - 10); + } else { /* Decimal */ + if ((*cp >= '0') && (*cp <= '9')) + increment = *cp++ - '0'; + } + if (increment < 0) + break; + *valp = (*valp * base) + increment; + } + + /* Skip trailing qualifiers */ + while (*cp == 'U' || *cp == 'u' || *cp == 'L' || *cp == 'l') cp++; + return cp; +} + +static const char * +parse_character (IfParser *g, const char *cp, long *valp) +{ + char val; + + SKIPSPACE (cp); + if (*cp == '\\') + switch (cp[1]) { + case 'n': val = '\n'; break; + case 't': val = '\t'; break; + case 'v': val = '\v'; break; + case 'b': val = '\b'; break; + case 'r': val = '\r'; break; + case 'f': val = '\f'; break; + case 'a': val = '\a'; break; + case '\\': val = '\\'; break; + case '?': val = '\?'; break; + case '\'': val = '\''; break; + case '\"': val = '\"'; break; + case 'x': val = (char) strtol (cp + 2, NULL, 16); break; + default: val = (char) strtol (cp + 1, NULL, 8); break; + } + else + val = *cp; + while (*cp != '\'') cp++; + *valp = (long) val; + return cp; +} + +static const char * +parse_value (IfParser *g, const char *cp, long *valp) +{ + const char *var, *varend; + + *valp = 0; + + SKIPSPACE (cp); + if (!*cp) + return cp; + + switch (*cp) { + case '(': + DO (cp = ParseIfExpression (g, cp + 1, valp)); + SKIPSPACE (cp); + if (*cp != ')') + return CALLFUNC(g, handle_error) (g, cp, ")"); + + return cp + 1; /* skip the right paren */ + + case '!': + DO (cp = parse_value (g, cp + 1, valp)); + *valp = !(*valp); + return cp; + + case '-': + DO (cp = parse_value (g, cp + 1, valp)); + *valp = -(*valp); + return cp; + + case '+': + DO (cp = parse_value (g, cp + 1, valp)); + return cp; + + case '~': + DO (cp = parse_value (g, cp + 1, valp)); + *valp = ~(*valp); + return cp; + + case '#': + DO (cp = parse_variable (g, cp + 1, &var)); + SKIPSPACE (cp); + if (*cp != '(') + return CALLFUNC(g, handle_error) (g, cp, "("); + do { + DO (cp = parse_variable (g, cp + 1, &var)); + SKIPSPACE (cp); + } while (*cp && *cp != ')'); + if (*cp != ')') + return CALLFUNC(g, handle_error) (g, cp, ")"); + *valp = 1; /* XXX */ + return cp + 1; + + case '\'': + DO (cp = parse_character (g, cp + 1, valp)); + if (*cp != '\'') + return CALLFUNC(g, handle_error) (g, cp, "'"); + return cp + 1; + + case 'd': + if (strncmp (cp, "defined", 7) == 0 && !isalnum(cp[7])) { + int paren = 0; + int len; + + cp += 7; + SKIPSPACE (cp); + if (*cp == '(') { + paren = 1; + cp++; + } + DO (cp = parse_variable (g, cp, &var)); + len = cp - var; + SKIPSPACE (cp); + if (paren && *cp != ')') + return CALLFUNC(g, handle_error) (g, cp, ")"); + *valp = (*(g->funcs.eval_defined)) (g, var, len); + return cp + paren; /* skip the right paren */ + } + /* fall out */ + } + + if (isdigit(*cp)) { + DO (cp = parse_number (g, cp, valp)); + } else if (!isvarfirstletter(*cp)) + return CALLFUNC(g, handle_error) (g, cp, "variable or number"); + else { + DO (cp = parse_variable (g, cp, &var)); + varend = cp; + SKIPSPACE(cp); + if (*cp != '(') { + *valp = (*(g->funcs.eval_variable)) (g, var, varend - var); + } else { + do { + long dummy; + DO (cp = ParseIfExpression (g, cp + 1, &dummy)); + SKIPSPACE(cp); + if (*cp == ')') + break; + if (*cp != ',') + return CALLFUNC(g, handle_error) (g, cp, ","); + } while (1); + + *valp = 1; /* XXX */ + cp++; + } + } + + return cp; +} + + + +static const char * +parse_product (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_value (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '*': + DO (cp = parse_product (g, cp + 1, &rightval)); + *valp = (*valp * rightval); + break; + + case '/': + DO (cp = parse_product (g, cp + 1, &rightval)); + if (rightval == 0) + return CALLFUNC(g, handle_error) (g, cp, "0"); + *valp = (*valp / rightval); + break; + + case '%': + DO (cp = parse_product (g, cp + 1, &rightval)); + *valp = (*valp % rightval); + break; + } + return cp; +} + + +static const char * +parse_sum (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_product (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '+': + DO (cp = parse_sum (g, cp + 1, &rightval)); + *valp = (*valp + rightval); + break; + + case '-': + DO (cp = parse_sum (g, cp + 1, &rightval)); + *valp = (*valp - rightval); + break; + } + return cp; +} + + +static const char * +parse_shift (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_sum (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '<': + if (cp[1] == '<') { + DO (cp = parse_shift (g, cp + 2, &rightval)); + *valp = (*valp << rightval); + } + break; + + case '>': + if (cp[1] == '>') { + DO (cp = parse_shift (g, cp + 2, &rightval)); + *valp = (*valp >> rightval); + } + break; + } + return cp; +} + + +static const char * +parse_inequality (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_shift (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '<': + if (cp[1] == '=') { + DO (cp = parse_inequality (g, cp + 2, &rightval)); + *valp = (*valp <= rightval); + } else { + DO (cp = parse_inequality (g, cp + 1, &rightval)); + *valp = (*valp < rightval); + } + break; + + case '>': + if (cp[1] == '=') { + DO (cp = parse_inequality (g, cp + 2, &rightval)); + *valp = (*valp >= rightval); + } else { + DO (cp = parse_inequality (g, cp + 1, &rightval)); + *valp = (*valp > rightval); + } + break; + } + return cp; +} + + +static const char * +parse_equality (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_inequality (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '=': + if (cp[1] == '=') + cp++; + DO (cp = parse_equality (g, cp + 1, &rightval)); + *valp = (*valp == rightval); + break; + + case '!': + if (cp[1] != '=') + break; + DO (cp = parse_equality (g, cp + 2, &rightval)); + *valp = (*valp != rightval); + break; + } + return cp; +} + + +static const char * +parse_band (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_equality (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '&': + if (cp[1] != '&') { + DO (cp = parse_band (g, cp + 1, &rightval)); + *valp = (*valp & rightval); + } + break; + } + return cp; +} + + +static const char * +parse_bxor (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_band (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '^': + DO (cp = parse_bxor (g, cp + 1, &rightval)); + *valp = (*valp ^ rightval); + break; + } + return cp; +} + + +static const char * +parse_bor (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_bxor (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '|': + if (cp[1] != '|') { + DO (cp = parse_bor (g, cp + 1, &rightval)); + *valp = (*valp | rightval); + } + break; + } + return cp; +} + + +static const char * +parse_land (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_bor (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '&': + if (cp[1] != '&') + return CALLFUNC(g, handle_error) (g, cp, "&&"); + DO (cp = parse_land (g, cp + 2, &rightval)); + *valp = (*valp && rightval); + break; + } + return cp; +} + + +static const char * +parse_lor (IfParser *g, const char *cp, long *valp) +{ + long rightval; + + DO (cp = parse_land (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '|': + if (cp[1] != '|') + return CALLFUNC(g, handle_error) (g, cp, "||"); + DO (cp = parse_lor (g, cp + 2, &rightval)); + *valp = (*valp || rightval); + break; + } + return cp; +} + + +static const char * +parse_cond(IfParser *g, const char *cp, long *valp) +{ + long trueval, falseval; + + DO (cp = parse_lor (g, cp, valp)); + SKIPSPACE (cp); + + switch (*cp) { + case '?': + DO (cp = parse_cond (g, cp + 1, &trueval)); + SKIPSPACE (cp); + if (*cp != ':') + return CALLFUNC(g, handle_error) (g, cp, ":"); + DO (cp = parse_cond (g, cp + 1, &falseval)); + *valp = (*valp ? trueval : falseval); + break; + } + return cp; +} + + +/**************************************************************************** + External Entry Points + ****************************************************************************/ + +const char * +ParseIfExpression (IfParser *g, const char *cp, long *valp) +{ + return parse_cond (g, cp, valp); +} diff --git a/mozilla/security/coreconf/mkdepend/ifparser.h b/mozilla/security/coreconf/mkdepend/ifparser.h new file mode 100644 index 0000000..89d2a2f --- /dev/null +++ b/mozilla/security/coreconf/mkdepend/ifparser.h @@ -0,0 +1,83 @@ +/* + * $Xorg: ifparser.h,v 1.3 2000/08/17 19:41:51 cpqbld Exp $ + * + * Copyright 1992 Network Computing Devices, Inc. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Network Computing Devices may not be + * used in advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. Network Computing Devices makes + * no representations about the suitability of this software for any purpose. + * It is provided ``as is'' without express or implied warranty. + * + * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, + * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Author: Jim Fulton + * Network Computing Devices, Inc. + * + * Simple if statement processor + * + * This module can be used to evaluate string representations of C language + * if constructs. It accepts the following grammar: + * + * EXPRESSION := VALUE + * | VALUE BINOP EXPRESSION + * | VALUE '?' EXPRESSION ':' EXPRESSION + * + * VALUE := '(' EXPRESSION ')' + * | '!' VALUE + * | '-' VALUE + * | '~' VALUE + * | 'defined' '(' variable ')' + * | variable + * | number + * + * BINOP := '*' | '/' | '%' + * | '+' | '-' + * | '<<' | '>>' + * | '<' | '>' | '<=' | '>=' + * | '==' | '!=' + * | '&' | '^' | '|' + * | '&&' | '||' + * + * The normal C order of precedence is supported. + * + * + * External Entry Points: + * + * ParseIfExpression parse a string for #if + */ + +/* $XFree86: xc/config/makedepend/ifparser.h,v 3.5 2001/07/25 15:04:40 dawes Exp $ */ + +#include + +typedef int Bool; +#define False 0 +#define True 1 + +typedef struct _if_parser { + struct { /* functions */ + const char *(*handle_error) (struct _if_parser *, const char *, + const char *); + long (*eval_variable) (struct _if_parser *, const char *, int); + int (*eval_defined) (struct _if_parser *, const char *, int); + } funcs; + char *data; +} IfParser; + +const char *ParseIfExpression ( + IfParser *, + const char *, + long * +); + diff --git a/mozilla/security/coreconf/mkdepend/imakemdep.h b/mozilla/security/coreconf/mkdepend/imakemdep.h new file mode 100644 index 0000000..7321972 --- /dev/null +++ b/mozilla/security/coreconf/mkdepend/imakemdep.h @@ -0,0 +1,782 @@ + +/* $XConsortium: imakemdep.h,v 1.83 95/04/07 19:47:46 kaleb Exp $ */ +/* $XFree86: xc/config/imake/imakemdep.h,v 3.12 1995/07/08 10:22:17 dawes Exp $ */ +/* + +Copyright (c) 1993, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + + +/* + * This file contains machine-dependent constants for the imake utility. + * When porting imake, read each of the steps below and add in any necessary + * definitions. In general you should *not* edit ccimake.c or imake.c! + */ + +#ifdef CCIMAKE +/* + * Step 1: imake_ccflags + * Define any special flags that will be needed to get imake.c to compile. + * These will be passed to the compile along with the contents of the + * make variable BOOTSTRAPCFLAGS. + */ +#ifdef hpux +#ifdef hp9000s800 +#define imake_ccflags "-DSYSV" +#else +#define imake_ccflags "-Wc,-Nd4000,-Ns3000 -DSYSV" +#endif +#endif + +#if defined(macII) || defined(_AUX_SOURCE) +#define imake_ccflags "-DmacII -DSYSV" +#endif + +#ifdef stellar +#define imake_ccflags "-DSYSV" +#endif + +#if defined(USL) || defined(Oki) || defined(NCR) +#define imake_ccflags "-Xc -DSVR4" +#endif + +#ifdef sony +#if defined(SYSTYPE_SYSV) || defined(_SYSTYPE_SYSV) +#define imake_ccflags "-DSVR4" +#else +#include +#if NEWSOS < 41 +#define imake_ccflags "-Dbsd43 -DNOSTDHDRS" +#else +#if NEWSOS < 42 +#define imake_ccflags "-Dbsd43" +#endif +#endif +#endif +#endif + +#ifdef _CRAY +#define imake_ccflags "-DSYSV -DUSG" +#endif + +#if defined(_IBMR2) || defined(aix) +#define imake_ccflags "-Daix -DSYSV" +#endif + +#ifdef Mips +# if defined(SYSTYPE_BSD) || defined(BSD) || defined(BSD43) +# define imake_ccflags "-DBSD43" +# else +# define imake_ccflags "-DSYSV" +# endif +#endif + +#ifdef is68k +#define imake_ccflags "-Dluna -Duniosb" +#endif + +#ifdef SYSV386 +# ifdef SVR4 +# define imake_ccflags "-Xc -DSVR4" +# else +# define imake_ccflags "-DSYSV" +# endif +#endif + +#ifdef SVR4 +# ifdef i386 +# define imake_ccflags "-Xc -DSVR4" +# endif +#endif + +#ifdef SYSV +# ifdef i386 +# define imake_ccflags "-DSYSV" +# endif +#endif + +#ifdef __convex__ +#define imake_ccflags "-fn -tm c1" +#endif + +#ifdef apollo +#define imake_ccflags "-DX_NOT_POSIX" +#endif + +#ifdef WIN32 +#define imake_ccflags "-nologo -batch -D__STDC__" +#endif + +#ifdef __uxp__ +#define imake_ccflags "-DSVR4 -DANSICPP" +#endif + +#ifdef __sxg__ +#define imake_ccflags "-DSYSV -DUSG -DNOSTDHDRS" +#endif + +#ifdef sequent +#define imake_ccflags "-DX_NOT_STDC_ENV -DX_NOT_POSIX" +#endif + +#ifdef _SEQUENT_ +#define imake_ccflags "-DSYSV -DUSG" +#endif + +#if defined(SX) || defined(PC_UX) +#define imake_ccflags "-DSYSV" +#endif + +#ifdef nec_ews_svr2 +#define imake_ccflags "-DUSG" +#endif + +#if defined(nec_ews_svr4) || defined(_nec_ews_svr4) || defined(_nec_up) || defined(_nec_ft) +#define imake_ccflags "-DSVR4" +#endif + +#ifdef MACH +#define imake_ccflags "-DNOSTDHDRS" +#endif + +/* this is for OS/2 under EMX. This won't work with DOS */ +#if defined(__EMX__) +#define imake_ccflags "-DBSD43" +#endif + +#else /* not CCIMAKE */ +#ifndef MAKEDEPEND +/* + * Step 2: dup2 + * If your OS doesn't have a dup2() system call to duplicate one file + * descriptor onto another, define such a mechanism here (if you don't + * already fall under the existing category(ies). + */ +#if defined(SYSV) && !defined(_CRAY) && !defined(Mips) && !defined(_SEQUENT_) +#define dup2(fd1,fd2) ((fd1 == fd2) ? fd1 : (close(fd2), \ + fcntl(fd1, F_DUPFD, fd2))) +#endif + + +/* + * Step 3: FIXUP_CPP_WHITESPACE + * If your cpp collapses tabs macro expansions into a single space and + * replaces escaped newlines with a space, define this symbol. This will + * cause imake to attempt to patch up the generated Makefile by looking + * for lines that have colons in them (this is why the rules file escapes + * all colons). One way to tell if you need this is to see whether or not + * your Makefiles have no tabs in them and lots of @@ strings. + */ +#if defined(sun) || defined(SYSV) || defined(SVR4) || defined(hcx) || defined(WIN32) || (defined(AMOEBA) && defined(CROSS_COMPILE)) +#define FIXUP_CPP_WHITESPACE +#endif +#ifdef WIN32 +#define REMOVE_CPP_LEADSPACE +#define INLINE_SYNTAX +#define MAGIC_MAKE_VARS +#endif +#ifdef __minix_vmd +#define FIXUP_CPP_WHITESPACE +#endif + +/* + * Step 4: USE_CC_E, DEFAULT_CC, DEFAULT_CPP + * If you want to use cc -E instead of cpp, define USE_CC_E. + * If use cc -E but want a different compiler, define DEFAULT_CC. + * If the cpp you need is not in /lib/cpp, define DEFAULT_CPP. + */ +#ifdef hpux +#define USE_CC_E +#endif +#ifdef WIN32 +#define USE_CC_E +#define DEFAULT_CC "cl" +#endif +#ifdef apollo +#define DEFAULT_CPP "/usr/lib/cpp" +#endif +#if defined(_IBMR2) && !defined(DEFAULT_CPP) +#define DEFAULT_CPP "/usr/lpp/X11/Xamples/util/cpp/cpp" +#endif +#if defined(sun) && defined(SVR4) +#define DEFAULT_CPP "/usr/ccs/lib/cpp" +#endif +#ifdef __bsdi__ +#define DEFAULT_CPP "/usr/bin/cpp" +#endif +#ifdef __uxp__ +#define DEFAULT_CPP "/usr/ccs/lib/cpp" +#endif +#ifdef __sxg__ +#define DEFAULT_CPP "/usr/lib/cpp" +#endif +#ifdef _CRAY +#define DEFAULT_CPP "/lib/pcpp" +#endif +#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#define DEFAULT_CPP "/usr/libexec/cpp" +#endif +#ifdef MACH +#define USE_CC_E +#endif +#ifdef __minix_vmd +#define DEFAULT_CPP "/usr/lib/cpp" +#endif +#if defined(__EMX__) +/* expects cpp in PATH */ +#define DEFAULT_CPP "cpp" +#endif + +/* + * Step 5: cpp_argv + * The following table contains the flags that should be passed + * whenever a Makefile is being generated. If your preprocessor + * doesn't predefine any unique symbols, choose one and add it to the + * end of this table. Then, do the following: + * + * a. Use this symbol in Imake.tmpl when setting MacroFile. + * b. Put this symbol in the definition of BootstrapCFlags in your + * .cf file. + * c. When doing a make World, always add "BOOTSTRAPCFLAGS=-Dsymbol" + * to the end of the command line. + * + * Note that you may define more than one symbol (useful for platforms + * that support multiple operating systems). + */ + +#define ARGUMENTS 50 /* number of arguments in various arrays */ +char *cpp_argv[ARGUMENTS] = { + "cc", /* replaced by the actual program to exec */ + "-I.", /* add current directory to include path */ +#ifdef unix + "-Uunix", /* remove unix symbol so that filename unix.c okay */ +#endif +#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(MACH) +# ifdef __i386__ + "-D__i386__", +# endif +# ifdef __x86_64__ + "-D__x86_64__", +# endif +# ifdef __GNUC__ + "-traditional", +# endif +#endif +#ifdef M4330 + "-DM4330", /* Tektronix */ +#endif +#ifdef M4310 + "-DM4310", /* Tektronix */ +#endif +#if defined(macII) || defined(_AUX_SOURCE) + "-DmacII", /* Apple A/UX */ +#endif +#ifdef USL + "-DUSL", /* USL */ +#endif +#ifdef sony + "-Dsony", /* Sony */ +#if !defined(SYSTYPE_SYSV) && !defined(_SYSTYPE_SYSV) && NEWSOS < 42 + "-Dbsd43", +#endif +#endif +#ifdef _IBMR2 + "-D_IBMR2", /* IBM RS-6000 (we ensured that aix is defined above */ +#ifndef aix +#define aix /* allow BOOTSTRAPCFLAGS="-D_IBMR2" */ +#endif +#endif /* _IBMR2 */ +#ifdef aix + "-Daix", /* AIX instead of AOS */ +#ifndef ibm +#define ibm /* allow BOOTSTRAPCFLAGS="-Daix" */ +#endif +#endif /* aix */ +#ifdef ibm + "-Dibm", /* IBM PS/2 and RT under both AOS and AIX */ +#endif +#ifdef luna + "-Dluna", /* OMRON luna 68K and 88K */ +#ifdef luna1 + "-Dluna1", +#endif +#ifdef luna88k /* need not on UniOS-Mach Vers. 1.13 */ + "-traditional", /* for some older version */ +#endif /* instead of "-DXCOMM=\\#" */ +#ifdef uniosb + "-Duniosb", +#endif +#ifdef uniosu + "-Duniosu", +#endif +#endif /* luna */ +#ifdef _CRAY /* Cray */ + "-Ucray", +#endif +#ifdef Mips + "-DMips", /* Define and use Mips for Mips Co. OS/mach. */ +# if defined(SYSTYPE_BSD) || defined(BSD) || defined(BSD43) + "-DBSD43", /* Mips RISCOS supports two environments */ +# else + "-DSYSV", /* System V environment is the default */ +# endif +#endif /* Mips */ +#ifdef MOTOROLA + "-DMOTOROLA", /* Motorola Delta Systems */ +# ifdef SYSV + "-DSYSV", +# endif +# ifdef SVR4 + "-DSVR4", +# endif +#endif /* MOTOROLA */ +#ifdef i386 + "-Di386", +# ifdef SVR4 + "-DSVR4", +# endif +# ifdef SYSV + "-DSYSV", +# ifdef ISC + "-DISC", +# ifdef ISC40 + "-DISC40", /* ISC 4.0 */ +# else +# ifdef ISC202 + "-DISC202", /* ISC 2.0.2 */ +# else +# ifdef ISC30 + "-DISC30", /* ISC 3.0 */ +# else + "-DISC22", /* ISC 2.2.1 */ +# endif +# endif +# endif +# endif +# ifdef SCO + "-DSCO", +# ifdef SCO324 + "-DSCO324", +# endif +# endif +# endif +# ifdef ESIX + "-DESIX", +# endif +# ifdef ATT + "-DATT", +# endif +# ifdef DELL + "-DDELL", +# endif +#endif +#ifdef SYSV386 /* System V/386 folks, obsolete */ + "-Di386", +# ifdef SVR4 + "-DSVR4", +# endif +# ifdef ISC + "-DISC", +# ifdef ISC40 + "-DISC40", /* ISC 4.0 */ +# else +# ifdef ISC202 + "-DISC202", /* ISC 2.0.2 */ +# else +# ifdef ISC30 + "-DISC30", /* ISC 3.0 */ +# else + "-DISC22", /* ISC 2.2.1 */ +# endif +# endif +# endif +# endif +# ifdef SCO + "-DSCO", +# ifdef SCO324 + "-DSCO324", +# endif +# endif +# ifdef ESIX + "-DESIX", +# endif +# ifdef ATT + "-DATT", +# endif +# ifdef DELL + "-DDELL", +# endif +#endif +#ifdef __osf__ + "-D__osf__", +# ifdef __mips__ + "-D__mips__", +# endif +# ifdef __alpha + "-D__alpha", +# endif +# ifdef __i386__ + "-D__i386__", +# endif +# ifdef __GNUC__ + "-traditional", +# endif +#endif +#ifdef Oki + "-DOki", +#endif +#ifdef sun +#ifdef SVR4 + "-DSVR4", +#endif +#endif +#ifdef WIN32 + "-DWIN32", + "-nologo", + "-batch", + "-D__STDC__", +#endif +#ifdef NCR + "-DNCR", /* NCR */ +#endif +#ifdef linux + "-traditional", + "-Dlinux", +#endif +#ifdef __uxp__ + "-D__uxp__", +#endif +#ifdef __sxg__ + "-D__sxg__", +#endif +#ifdef nec_ews_svr2 + "-Dnec_ews_svr2", +#endif +#ifdef AMOEBA + "-DAMOEBA", +# ifdef CROSS_COMPILE + "-DCROSS_COMPILE", +# ifdef CROSS_i80386 + "-Di80386", +# endif +# ifdef CROSS_sparc + "-Dsparc", +# endif +# ifdef CROSS_mc68000 + "-Dmc68000", +# endif +# else +# ifdef i80386 + "-Di80386", +# endif +# ifdef sparc + "-Dsparc", +# endif +# ifdef mc68000 + "-Dmc68000", +# endif +# endif +#endif +#ifdef __minix_vmd + "-Dminix", +#endif + +#if defined(__EMX__) + "-traditional", + "-Demxos2", +#endif + +}; +#else /* else MAKEDEPEND */ +/* + * Step 6: predefs + * If your compiler and/or preprocessor define any specific symbols, add + * them to the the following table. The definition of struct symtab is + * in util/makedepend/def.h. + */ +#define QUOTEIT(x) #x +#define QUOTEEXPANSION(x) QUOTEIT(x) + +struct symtab predefs[] = { +#ifdef apollo + {"apollo", "1"}, +#endif +#ifdef ibm032 + {"ibm032", "1"}, +#endif +#ifdef ibm + {"ibm", "1"}, +#endif +#ifdef aix + {"aix", "1"}, +#endif +#ifdef sun + {"sun", "1"}, +#endif +#ifdef sun2 + {"sun2", "1"}, +#endif +#ifdef sun3 + {"sun3", "1"}, +#endif +#ifdef sun4 + {"sun4", "1"}, +#endif +#ifdef sparc + {"sparc", "1"}, +#endif +#ifdef __sparc__ + {"__sparc__", "1"}, +#endif +#ifdef hpux + {"hpux", "1"}, +#endif +#ifdef __hpux + {"__hpux", "1"}, +#endif +#ifdef __hp9000s800 + {"__hp9000s800", "1"}, +#endif +#ifdef __hp9000s700 + {"__hp9000s700", "1"}, +#endif +#ifdef vax + {"vax", "1"}, +#endif +#ifdef VMS + {"VMS", "1"}, +#endif +#ifdef cray + {"cray", "1"}, +#endif +#ifdef CRAY + {"CRAY", "1"}, +#endif +#ifdef _CRAY + {"_CRAY", "1"}, +#endif +#ifdef att + {"att", "1"}, +#endif +#ifdef mips + {"mips", "1"}, +#endif +#ifdef __mips__ + {"__mips__", "1"}, +#endif +#ifdef ultrix + {"ultrix", "1"}, +#endif +#ifdef stellar + {"stellar", "1"}, +#endif +#ifdef mc68000 + {"mc68000", "1"}, +#endif +#ifdef mc68020 + {"mc68020", "1"}, +#endif +#ifdef __GNUC__ + {"__GNUC__", "1"}, +#endif +#if __STDC__ + {"__STDC__", "1"}, +#endif +#ifdef __HIGHC__ + {"__HIGHC__", "1"}, +#endif +#ifdef CMU + {"CMU", "1"}, +#endif +#ifdef luna + {"luna", "1"}, +#ifdef luna1 + {"luna1", "1"}, +#endif +#ifdef luna2 + {"luna2", "1"}, +#endif +#ifdef luna88k + {"luna88k", "1"}, +#endif +#ifdef uniosb + {"uniosb", "1"}, +#endif +#ifdef uniosu + {"uniosu", "1"}, +#endif +#endif +#ifdef ieeep754 + {"ieeep754", "1"}, +#endif +#ifdef is68k + {"is68k", "1"}, +#endif +#ifdef m68k + {"m68k", "1"}, +#endif +#ifdef m88k + {"m88k", "1"}, +#endif +#ifdef __m88k__ + {"__m88k__", "1"}, +#endif +#ifdef bsd43 + {"bsd43", "1"}, +#endif +#ifdef hcx + {"hcx", "1"}, +#endif +#ifdef sony + {"sony", "1"}, +#ifdef SYSTYPE_SYSV + {"SYSTYPE_SYSV", "1"}, +#endif +#ifdef _SYSTYPE_SYSV + {"_SYSTYPE_SYSV", "1"}, +#endif +#endif +#ifdef __OSF__ + {"__OSF__", "1"}, +#endif +#ifdef __osf__ + {"__osf__", "1"}, +#endif +#ifdef __alpha + {"__alpha", "1"}, +#endif +#ifdef __DECC + {"__DECC", "1"}, +#endif +#ifdef __decc + {"__decc", "1"}, +#endif +#ifdef __uxp__ + {"__uxp__", "1"}, +#endif +#ifdef __sxg__ + {"__sxg__", "1"}, +#endif +#ifdef _SEQUENT_ + {"_SEQUENT_", "1"}, + {"__STDC__", "1"}, +#endif +#ifdef __bsdi__ + {"__bsdi__", "1"}, +#endif +#ifdef nec_ews_svr2 + {"nec_ews_svr2", "1"}, +#endif +#ifdef nec_ews_svr4 + {"nec_ews_svr4", "1"}, +#endif +#ifdef _nec_ews_svr4 + {"_nec_ews_svr4", "1"}, +#endif +#ifdef _nec_up + {"_nec_up", "1"}, +#endif +#ifdef SX + {"SX", "1"}, +#endif +#ifdef nec + {"nec", "1"}, +#endif +#ifdef _nec_ft + {"_nec_ft", "1"}, +#endif +#ifdef PC_UX + {"PC_UX", "1"}, +#endif +#ifdef sgi + {"sgi", "1"}, +#endif +#ifdef __sgi + {"__sgi", "1"}, +#endif +#ifdef __FreeBSD__ + {"__FreeBSD__", "1"}, +#endif +#ifdef __NetBSD__ + {"__NetBSD__", "1"}, +#endif +#ifdef __OpenBSD__ + {"__OpenBSD__", "1"}, +#endif +#ifdef __EMX__ + {"__EMX__", "1"}, +#endif + /* ADDED THE FOLLOWING SYMBOLS FOR WINDOWS */ +#ifdef _WIN32 + {"_WIN32", QUOTEEXPANSION(_WIN32) }, +#endif +#ifdef _WIN64 + {"_WIN64", QUOTEEXPANSION(_WIN64) }, +#endif +#ifdef _X86 + {"_X86", QUOTEEXPANSION(_X86) }, +#endif +#ifdef _X86_ + {"_X86_", QUOTEEXPANSION(_X86_) }, +#endif +#ifdef _X86_64 + {"_X86_64", QUOTEEXPANSION(_X86_64) }, +#endif +#ifdef _X86_64_ + {"_X86_64_", QUOTEEXPANSION(_X86_64_) }, +#endif +#ifdef _DEBUG + {"_DEBUG", QUOTEEXPANSION(_DEBUG) }, +#endif +#ifdef _DLL + {"_DLL", QUOTEEXPANSION(_DLL) }, +#endif +#ifdef _M_IX86 + {"_M_IX86", QUOTEEXPANSION(_M_IX86) }, +#endif +#ifdef _M_X64 + {"_M_X64", QUOTEEXPANSION(_M_X64) }, +#endif +#ifdef _MSC_FULL_VER + {"_MSC_FULL_VER", QUOTEEXPANSION(_MSC_FULL_VER) }, +#endif +#ifdef _MSC_VER + {"_MSC_VER", QUOTEEXPANSION(_MSC_VER) }, +#endif +#ifdef _MSVC_RUNTIME_CHECKS + {"_MSVC_RUNTIME_CHECKS", QUOTEEXPANSION(_MSVC_RUNTIME_CHECKS) }, +#endif +#ifdef _MT + {"_MT", QUOTEEXPANSION(_MT) }, +#endif +#ifdef _CHAR_UNSIGNED + {"_CHAR_UNSIGNED", QUOTEEXPANSION(_CHAR_UNSIGNED) }, +#endif + /* add any additional symbols before this line */ + {NULL, NULL} +}; + +#endif /* MAKEDEPEND */ +#endif /* CCIMAKE */ diff --git a/mozilla/security/coreconf/mkdepend/include.c b/mozilla/security/coreconf/mkdepend/include.c new file mode 100644 index 0000000..3b89f26 --- /dev/null +++ b/mozilla/security/coreconf/mkdepend/include.c @@ -0,0 +1,337 @@ +/* $Xorg: include.c,v 1.4 2001/02/09 02:03:16 xorgcvs Exp $ */ +/* + +Copyright (c) 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ +/* $XFree86: xc/config/makedepend/include.c,v 3.7 2001/12/14 19:53:20 dawes Exp $ */ + + +#include "def.h" + +#ifdef _MSC_VER +#include +static int +does_file_exist(char *file) +{ + WIN32_FILE_ATTRIBUTE_DATA data; + BOOL b = GetFileAttributesExA(file, GetFileExInfoStandard, &data); + if (!b) + return 0; + return (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0; +} +#else +static int +does_file_exist(char *file) +{ + struct stat sb; + return stat(file, &sb) == 0 && !S_ISDIR(sb.st_mode); +} +#endif + +extern struct inclist inclist[ MAXFILES ], + *inclistp, *inclistnext; +extern char *includedirs[ ], + **includedirsnext; +extern char *notdotdot[ ]; +extern boolean show_where_not; +extern boolean warn_multiple; + +static boolean +isdot(char *p) +{ + if(p && *p++ == '.' && *p++ == '\0') + return(TRUE); + return(FALSE); +} + +static boolean +isdotdot(char *p) +{ + if(p && *p++ == '.' && *p++ == '.' && *p++ == '\0') + return(TRUE); + return(FALSE); +} + +static boolean +issymbolic(char *dir, char *component) +{ +#ifdef S_IFLNK + struct stat st; + char buf[ BUFSIZ ], **pp; + + sprintf(buf, "%s%s%s", dir, *dir ? "/" : "", component); + for (pp=notdotdot; *pp; pp++) + if (strcmp(*pp, buf) == 0) + return (TRUE); + if (lstat(buf, &st) == 0 + && (st.st_mode & S_IFMT) == S_IFLNK) { + *pp++ = copy(buf); + if (pp >= ¬dotdot[ MAXDIRS ]) + fatalerr("out of .. dirs, increase MAXDIRS\n"); + return(TRUE); + } +#endif + return(FALSE); +} + +/* + * Occasionally, pathnames are created that look like .../x/../y + * Any of the 'x/..' sequences within the name can be eliminated. + * (but only if 'x' is not a symbolic link!!) + */ +static void +remove_dotdot(char *path) +{ + register char *end, *from, *to, **cp; + char *components[ MAXFILES ], + newpath[ BUFSIZ ]; + boolean component_copied; + + /* + * slice path up into components. + */ + to = newpath; + if (*path == '/') + *to++ = '/'; + *to = '\0'; + cp = components; + for (from=end=path; *end; end++) + if (*end == '/') { + while (*end == '/') + *end++ = '\0'; + if (*from) + *cp++ = from; + from = end; + } + *cp++ = from; + *cp = NULL; + + /* + * Recursively remove all 'x/..' component pairs. + */ + cp = components; + while(*cp) { + if (!isdot(*cp) && !isdotdot(*cp) && isdotdot(*(cp+1)) + && !issymbolic(newpath, *cp)) + { + char **fp = cp + 2; + char **tp = cp; + + do + *tp++ = *fp; /* move all the pointers down */ + while (*fp++); + if (cp != components) + cp--; /* go back and check for nested ".." */ + } else { + cp++; + } + } + /* + * Concatenate the remaining path elements. + */ + cp = components; + component_copied = FALSE; + while(*cp) { + if (component_copied) + *to++ = '/'; + component_copied = TRUE; + for (from = *cp; *from; ) + *to++ = *from++; + *to = '\0'; + cp++; + } + *to++ = '\0'; + + /* + * copy the reconstituted path back to our pointer. + */ + strcpy(path, newpath); +} + +/* + * Add an include file to the list of those included by 'file'. + */ +struct inclist * +newinclude(char *newfile, char *incstring) +{ + register struct inclist *ip; + + /* + * First, put this file on the global list of include files. + */ + ip = inclistp++; + if (inclistp == inclist + MAXFILES - 1) + fatalerr("out of space: increase MAXFILES\n"); + ip->i_file = copy(newfile); + + if (incstring == NULL) + ip->i_incstring = ip->i_file; + else + ip->i_incstring = copy(incstring); + + inclistnext = inclistp; + return(ip); +} + +void +included_by(struct inclist *ip, struct inclist *newfile) +{ + register int i; + + if (ip == NULL) + return; + /* + * Put this include file (newfile) on the list of files included + * by 'file'. If 'file' is NULL, then it is not an include + * file itself (i.e. was probably mentioned on the command line). + * If it is already on the list, don't stick it on again. + */ + if (ip->i_list == NULL) { + ip->i_list = (struct inclist **) + malloc(sizeof(struct inclist *) * ++ip->i_listlen); + ip->i_merged = (boolean *) + malloc(sizeof(boolean) * ip->i_listlen); + } else { + for (i=0; ii_listlen; i++) + if (ip->i_list[ i ] == newfile) { + i = strlen(newfile->i_file); + if (!(ip->i_flags & INCLUDED_SYM) && + !(i > 2 && + newfile->i_file[i-1] == 'c' && + newfile->i_file[i-2] == '.')) + { + /* only bitch if ip has */ + /* no #include SYMBOL lines */ + /* and is not a .c file */ + if (warn_multiple) + { + warning("%s includes %s more than once!\n", + ip->i_file, newfile->i_file); + warning1("Already have\n"); + for (i=0; ii_listlen; i++) + warning1("\t%s\n", ip->i_list[i]->i_file); + } + } + return; + } + ip->i_list = (struct inclist **) realloc(ip->i_list, + sizeof(struct inclist *) * ++ip->i_listlen); + ip->i_merged = (boolean *) + realloc(ip->i_merged, sizeof(boolean) * ip->i_listlen); + } + ip->i_list[ ip->i_listlen-1 ] = newfile; + ip->i_merged[ ip->i_listlen-1 ] = FALSE; +} + +void +inc_clean (void) +{ + register struct inclist *ip; + + for (ip = inclist; ip < inclistp; ip++) { + ip->i_flags &= ~MARKED; + } +} + +struct inclist * +inc_path(char *file, char *include, int type) +{ + static char path[ BUFSIZ ]; + register char **pp, *p; + register struct inclist *ip; + + /* + * Check all previously found include files for a path that + * has already been expanded. + */ + if ((type == INCLUDE) || (type == INCLUDEDOT)) + inclistnext = inclist; + ip = inclistnext; + + for (; ip->i_file; ip++) { + if ((strcmp(ip->i_incstring, include) == 0) && + !(ip->i_flags & INCLUDED_SYM)) { + inclistnext = ip + 1; + return ip; + } + } + + if (inclistnext == inclist) { + /* + * If the path was surrounded by "" or is an absolute path, + * then check the exact path provided. + */ + if ((type == INCLUDEDOT) || + (type == INCLUDENEXTDOT) || + (*include == '/')) { + if (does_file_exist(include)) + return newinclude(include, include); + if (show_where_not) + warning1("\tnot in %s\n", include); + } + + /* + * If the path was surrounded by "" see if this include file is + * in the directory of the file being parsed. + */ + if ((type == INCLUDEDOT) || (type == INCLUDENEXTDOT)) { + for (p=file+strlen(file); p>file; p--) + if (*p == '/') + break; + if (p == file) { + strcpy(path, include); + } else { + strncpy(path, file, (p-file) + 1); + path[ (p-file) + 1 ] = '\0'; + strcpy(path + (p-file) + 1, include); + } + remove_dotdot(path); + if (does_file_exist(path)) + return newinclude(path, include); + if (show_where_not) + warning1("\tnot in %s\n", path); + } + } + + /* + * Check the include directories specified. Standard include dirs + * should be at the end. + */ + if ((type == INCLUDE) || (type == INCLUDEDOT)) + includedirsnext = includedirs; + pp = includedirsnext; + + for (; *pp; pp++) { + sprintf(path, "%s/%s", *pp, include); + remove_dotdot(path); + if (does_file_exist(path)) { + includedirsnext = pp + 1; + return newinclude(path, include); + } + if (show_where_not) + warning1("\tnot in %s\n", path); + } + + return NULL; +} diff --git a/mozilla/security/coreconf/mkdepend/main.c b/mozilla/security/coreconf/mkdepend/main.c new file mode 100644 index 0000000..d5485f7 --- /dev/null +++ b/mozilla/security/coreconf/mkdepend/main.c @@ -0,0 +1,870 @@ +/* $Xorg: main.c,v 1.5 2001/02/09 02:03:16 xorgcvs Exp $ */ +/* + +Copyright (c) 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ +/* $XFree86: xc/config/makedepend/main.c,v 3.32 2003/03/26 20:43:48 tsi Exp $ */ + +#include "def.h" +#ifdef hpux +#define sigvec sigvector +#endif /* hpux */ + +#ifdef X_POSIX_C_SOURCE +#define _POSIX_C_SOURCE X_POSIX_C_SOURCE +#include +#undef _POSIX_C_SOURCE +#else +#if defined(X_NOT_POSIX) || defined(_POSIX_SOURCE) +#include +#else +#define _POSIX_SOURCE +#include +#undef _POSIX_SOURCE +#endif +#endif + +#include +#ifdef _WIN32 +#include +#endif + +#ifdef MINIX +#define USE_CHMOD 1 +#endif + +#ifdef DEBUG +int _debugmask; +#endif + +/* #define DEBUG_DUMP */ +#ifdef DEBUG_DUMP +#define DBG_PRINT(file, fmt, args) fprintf(file, fmt, args) +#else +#define DBG_PRINT(file, fmt, args) /* empty */ +#endif + +#define DASH_INC_PRE "#include \"" +#define DASH_INC_POST "\"" + +char *ProgramName; + +char *directives[] = { + "if", + "ifdef", + "ifndef", + "else", + "endif", + "define", + "undef", + "include", + "line", + "pragma", + "error", + "ident", + "sccs", + "elif", + "eject", + "warning", + "include_next", + NULL +}; + +#define MAKEDEPEND +#include "imakemdep.h" /* from config sources */ +#undef MAKEDEPEND + +struct inclist inclist[ MAXFILES ], + *inclistp = inclist, + *inclistnext = inclist, + maininclist; + +static char *filelist[ MAXFILES ]; +char *includedirs[ MAXDIRS + 1 ], + **includedirsnext = includedirs; +char *notdotdot[ MAXDIRS ]; +static int cmdinc_count = 0; +static char *cmdinc_list[ 2 * MAXINCFILES ]; +char *objprefix = ""; +char *objsuffix = OBJSUFFIX; +static char *startat = "# DO NOT DELETE"; +int width = 78; +static boolean append = FALSE; +boolean printed = FALSE; +boolean verbose = FALSE; +boolean show_where_not = FALSE; +/* Warn on multiple includes of same file */ +boolean warn_multiple = FALSE; + +static void setfile_cmdinc(struct filepointer *filep, long count, char **list); +static void redirect(char *line, char *makefile); + +static +#ifdef SIGNALRETURNSINT +int +#else +void +#endif +catch (int sig) +{ + fflush (stdout); + fatalerr ("got signal %d\n", sig); +} + +#if defined(USG) || (defined(i386) && defined(SYSV)) || defined(WIN32) || defined(__UNIXOS2__) || defined(Lynx_22) || defined(__CYGWIN__) +#define USGISH +#endif + +#ifndef USGISH +#ifdef X_NOT_POSIX +#define sigaction sigvec +#define sa_handler sv_handler +#define sa_mask sv_mask +#define sa_flags sv_flags +#endif +struct sigaction sig_act; +#endif /* USGISH */ + +int +main(int argc, char *argv[]) +{ + char **fp = filelist; + char **incp = includedirs; + char *p; + struct inclist *ip; + char *makefile = NULL; + struct filepointer *filecontent; + struct symtab *psymp = predefs; + char *endmarker = NULL; + char *defincdir = NULL; + char **undeflist = NULL; + int numundefs = 0, i; + register char offset; + + ProgramName = argv[0]; + + while (psymp->s_name) + { + define2(psymp->s_name, psymp->s_value, &maininclist); + psymp++; + } + if (argc == 2 && argv[1][0] == '@') { + struct stat ast; + int afd; + char *args; + char **nargv; + int nargc; + char quotechar = '\0'; + + nargc = 1; + if ((afd = open(argv[1]+1, O_RDONLY)) < 0) + fatalerr("cannot open \"%s\"\n", argv[1]+1); + fstat(afd, &ast); + args = (char *)malloc(ast.st_size + 1); + if ((ast.st_size = read(afd, args, ast.st_size)) < 0) + fatalerr("failed to read %s\n", argv[1]+1); + args[ast.st_size] = '\0'; + close(afd); + for (p = args; *p; p++) { + if (quotechar) { + if (quotechar == '\\' || + (*p == quotechar && p[-1] != '\\')) + quotechar = '\0'; + continue; + } + switch (*p) { + case '\\': + case '"': + case '\'': + quotechar = *p; + break; + case ' ': + case '\n': + *p = '\0'; + if (p > args && p[-1]) + nargc++; + break; + } + } + if (p[-1]) + nargc++; + nargv = (char **)malloc(nargc * sizeof(char *)); + nargv[0] = argv[0]; + argc = 1; + for (p = args; argc < nargc; p += strlen(p) + 1) + if (*p) nargv[argc++] = p; + argv = nargv; + } + for(argc--, argv++; argc; argc--, argv++) { + /* if looking for endmarker then check before parsing */ + if (endmarker && strcmp (endmarker, *argv) == 0) { + endmarker = NULL; + continue; + } + if (**argv != '-') { + /* treat +thing as an option for C++ */ + if (endmarker && **argv == '+') + continue; + *fp++ = argv[0]; + continue; + } + switch(argv[0][1]) { + case '-': + endmarker = &argv[0][2]; + if (endmarker[0] == '\0') endmarker = "--"; + break; + case 'D': + offset = 2; + if (argv[0][2] == '\0') { + argv++; + argc--; + offset = 0; + } + /* offset +1 here since first def letter + * cannot be `=` + */ + for (p = argv[0] + offset + 1; *p; p++) + if (*p == '=') { + *p = ' '; + break; + } + define(argv[0] + offset, &maininclist); + break; + case 'I': + if (incp >= includedirs + MAXDIRS) + fatalerr("Too many -I flags.\n"); + *incp++ = argv[0]+2; + if (**(incp-1) == '\0') { + *(incp-1) = *(++argv); + argc--; + } + break; + case 'U': + /* Undef's override all -D's so save them up */ + numundefs++; + if (numundefs == 1) + undeflist = malloc(sizeof(char *)); + else + undeflist = realloc(undeflist, + numundefs * sizeof(char *)); + offset = 2; + if (argv[0][2] == '\0') { + argv++; + argc--; + offset = 0; + } + undeflist[numundefs - 1] = argv[0] + offset; + break; + case 'Y': + defincdir = argv[0]+2; + break; + /* do not use if endmarker processing */ + case 'a': + if (endmarker) break; + append = TRUE; + break; + case 'w': + if (endmarker) break; + if (argv[0][2] == '\0') { + argv++; + argc--; + width = atoi(argv[0]); + } else + width = atoi(argv[0]+2); + break; + case 'o': + if (endmarker) break; + if (argv[0][2] == '\0') { + argv++; + argc--; + objsuffix = argv[0]; + } else + objsuffix = argv[0]+2; + break; + case 'p': + if (endmarker) break; + if (argv[0][2] == '\0') { + argv++; + argc--; + objprefix = argv[0]; + } else + objprefix = argv[0]+2; + break; + case 'v': + if (endmarker) break; + verbose = TRUE; +#ifdef DEBUG + if (argv[0][2]) + _debugmask = atoi(argv[0]+2); +#endif + break; + case 's': + if (endmarker) break; + startat = argv[0]+2; + if (*startat == '\0') { + startat = *(++argv); + argc--; + } + if (*startat != '#') + fatalerr("-s flag's value should start %s\n", + "with '#'."); + break; + case 'f': + if (endmarker) break; + makefile = argv[0]+2; + if (*makefile == '\0') { + makefile = *(++argv); + argc--; + } + break; + + case 'm': + warn_multiple = TRUE; + break; + + /* Ignore -O, -g so we can just pass ${CFLAGS} to + makedepend + */ + case 'O': + case 'g': + break; + case 'i': + if (strcmp(&argv[0][1],"include") == 0) { + char *buf; + if (argc<2) + fatalerr("option -include is a " + "missing its parameter\n"); + if (cmdinc_count >= MAXINCFILES) + fatalerr("Too many -include flags.\n"); + argc--; + argv++; + buf = malloc(strlen(DASH_INC_PRE) + + strlen(argv[0]) + + strlen(DASH_INC_POST) + 1); + if(!buf) + fatalerr("out of memory at " + "-include string\n"); + cmdinc_list[2 * cmdinc_count + 0] = argv[0]; + cmdinc_list[2 * cmdinc_count + 1] = buf; + cmdinc_count++; + break; + } + /* intentional fall through */ + default: + if (endmarker) break; + /* fatalerr("unknown opt = %s\n", argv[0]); */ + warning("ignoring option %s\n", argv[0]); + } + } + /* Now do the undefs from the command line */ + for (i = 0; i < numundefs; i++) + undefine(undeflist[i], &maininclist); + if (numundefs > 0) + free(undeflist); + + if (!defincdir) { +#ifdef PREINCDIR + if (incp >= includedirs + MAXDIRS) + fatalerr("Too many -I flags.\n"); + *incp++ = PREINCDIR; +#endif +#if defined(__UNIXOS2__) || defined(_MSC_VER) + { +#if defined(_MSC_VER) + char *includepath = getenv("INCLUDE"); +#else + char *includepath = getenv("C_INCLUDE_PATH"); +#endif + /* can have more than one component */ + if (includepath) { + char *beg, *end; + beg= (char*)strdup(includepath); + for (;;) { + end = (char*)strchr(beg,';'); + if (end) *end = 0; + if (incp >= includedirs + MAXDIRS) + fatalerr("Too many include dirs\n"); + *incp++ = beg; + if (!end) break; + beg = end+1; + } + } + } +#else /* !__UNIXOS2__ && !_MSC_VER, does not use INCLUDEDIR at all */ + if (incp >= includedirs + MAXDIRS) + fatalerr("Too many -I flags.\n"); + *incp++ = INCLUDEDIR; +#endif + +#ifdef EXTRAINCDIR + if (incp >= includedirs + MAXDIRS) + fatalerr("Too many -I flags.\n"); + *incp++ = EXTRAINCDIR; +#endif + +#ifdef POSTINCDIR + if (incp >= includedirs + MAXDIRS) + fatalerr("Too many -I flags.\n"); + *incp++ = POSTINCDIR; +#endif + } else if (*defincdir) { + if (incp >= includedirs + MAXDIRS) + fatalerr("Too many -I flags.\n"); + *incp++ = defincdir; + } + + redirect(startat, makefile); + + /* + * catch signals. + */ +#ifdef USGISH +/* should really reset SIGINT to SIG_IGN if it was. */ +#ifdef SIGHUP + signal (SIGHUP, catch); +#endif + signal (SIGINT, catch); +#ifdef SIGQUIT + signal (SIGQUIT, catch); +#endif + signal (SIGILL, catch); +#ifdef SIGBUS + signal (SIGBUS, catch); +#endif + signal (SIGSEGV, catch); +#ifdef SIGSYS + signal (SIGSYS, catch); +#endif +#else + sig_act.sa_handler = catch; +#if defined(_POSIX_SOURCE) || !defined(X_NOT_POSIX) + sigemptyset(&sig_act.sa_mask); + sigaddset(&sig_act.sa_mask, SIGINT); + sigaddset(&sig_act.sa_mask, SIGQUIT); +#ifdef SIGBUS + sigaddset(&sig_act.sa_mask, SIGBUS); +#endif + sigaddset(&sig_act.sa_mask, SIGILL); + sigaddset(&sig_act.sa_mask, SIGSEGV); + sigaddset(&sig_act.sa_mask, SIGHUP); + sigaddset(&sig_act.sa_mask, SIGPIPE); +#ifdef SIGSYS + sigaddset(&sig_act.sa_mask, SIGSYS); +#endif +#else + sig_act.sa_mask = ((1<<(SIGINT -1)) + |(1<<(SIGQUIT-1)) +#ifdef SIGBUS + |(1<<(SIGBUS-1)) +#endif + |(1<<(SIGILL-1)) + |(1<<(SIGSEGV-1)) + |(1<<(SIGHUP-1)) + |(1<<(SIGPIPE-1)) +#ifdef SIGSYS + |(1<<(SIGSYS-1)) +#endif + ); +#endif /* _POSIX_SOURCE */ + sig_act.sa_flags = 0; + sigaction(SIGHUP, &sig_act, (struct sigaction *)0); + sigaction(SIGINT, &sig_act, (struct sigaction *)0); + sigaction(SIGQUIT, &sig_act, (struct sigaction *)0); + sigaction(SIGILL, &sig_act, (struct sigaction *)0); +#ifdef SIGBUS + sigaction(SIGBUS, &sig_act, (struct sigaction *)0); +#endif + sigaction(SIGSEGV, &sig_act, (struct sigaction *)0); +#ifdef SIGSYS + sigaction(SIGSYS, &sig_act, (struct sigaction *)0); +#endif +#endif /* USGISH */ + + /* + * now peruse through the list of files. + */ + for(fp=filelist; *fp; fp++) { + DBG_PRINT(stderr,"file: %s\n",*fp); + filecontent = getfile(*fp); + setfile_cmdinc(filecontent, cmdinc_count, cmdinc_list); + ip = newinclude(*fp, (char *)NULL); + + find_includes(filecontent, ip, ip, 0, FALSE); + freefile(filecontent); + recursive_pr_include(ip, ip->i_file, base_name(*fp)); + inc_clean(); + } + if (printed) + printf("\n"); + return 0; +} + +#ifdef __UNIXOS2__ +/* + * eliminate \r chars from file + */ +static int +elim_cr(char *buf, int sz) +{ + int i,wp; + for (i= wp = 0; if_name = file; + if ((fd = open(file, O_RDONLY)) < 0) { + warning("cannot open \"%s\"\n", file); + content->f_p = content->f_base = content->f_end = (char *)malloc(1); + *content->f_p = '\0'; + return(content); + } + fstat(fd, &st); + content->f_base = (char *)malloc(st.st_size+1); + if (content->f_base == NULL) + fatalerr("cannot allocate mem\n"); + if ((st.st_size = read(fd, content->f_base, st.st_size)) < 0) + fatalerr("failed to read %s\n", file); +#ifdef __UNIXOS2__ + st.st_size = elim_cr(content->f_base,st.st_size); +#endif + close(fd); + content->f_len = st.st_size+1; + content->f_p = content->f_base; + content->f_end = content->f_base + st.st_size; + *content->f_end = '\0'; + content->f_line = 0; + content->cmdinc_count = 0; + content->cmdinc_list = NULL; + content->cmdinc_line = 0; + return(content); +} + +void +setfile_cmdinc(struct filepointer* filep, long count, char** list) +{ + filep->cmdinc_count = count; + filep->cmdinc_list = list; + filep->cmdinc_line = 0; +} + +void +freefile(struct filepointer *fp) +{ + free(fp->f_base); + free(fp); +} + +char *copy(char *str) +{ + char *p = (char *)malloc(strlen(str) + 1); + + strcpy(p, str); + return(p); +} + +int +match(char *str, char **list) +{ + int i; + + for (i=0; *list; i++, list++) + if (strcmp(str, *list) == 0) + return(i); + return(-1); +} + +/* + * Get the next line. We only return lines beginning with '#' since that + * is all this program is ever interested in. + */ +char *getnextline(struct filepointer *filep) +{ + char *p, /* walking pointer */ + *eof, /* end of file pointer */ + *bol; /* beginning of line pointer */ + int lineno; /* line number */ + boolean whitespace = FALSE; + + /* + * Fake the "-include" line files in form of #include to the + * start of each file. + */ + if (filep->cmdinc_line < filep->cmdinc_count) { + char *inc = filep->cmdinc_list[2 * filep->cmdinc_line + 0]; + char *buf = filep->cmdinc_list[2 * filep->cmdinc_line + 1]; + filep->cmdinc_line++; + sprintf(buf,"%s%s%s",DASH_INC_PRE,inc,DASH_INC_POST); + DBG_PRINT(stderr,"%s\n",buf); + return(buf); + } + + p = filep->f_p; + eof = filep->f_end; + if (p >= eof) + return((char *)NULL); + lineno = filep->f_line; + + for (bol = p--; ++p < eof; ) { + if ((bol == p) && ((*p == ' ') || (*p == '\t'))) + { + /* Consume leading white-spaces for this line */ + while (((p+1) < eof) && ((*p == ' ') || (*p == '\t'))) + { + p++; + bol++; + } + whitespace = TRUE; + } + + if (*p == '/' && (p+1) < eof && *(p+1) == '*') { + /* Consume C comments */ + *(p++) = ' '; + *(p++) = ' '; + while (p < eof && *p) { + if (*p == '*' && (p+1) < eof && *(p+1) == '/') { + *(p++) = ' '; + *(p++) = ' '; + break; + } + if (*p == '\n') + lineno++; + *(p++) = ' '; + } + --p; + } + else if (*p == '/' && (p+1) < eof && *(p+1) == '/') { + /* Consume C++ comments */ + *(p++) = ' '; + *(p++) = ' '; + while (p < eof && *p) { + if (*p == '\\' && (p+1) < eof && + *(p+1) == '\n') { + *(p++) = ' '; + lineno++; + } + else if (*p == '?' && (p+3) < eof && + *(p+1) == '?' && + *(p+2) == '/' && + *(p+3) == '\n') { + *(p++) = ' '; + *(p++) = ' '; + *(p++) = ' '; + lineno++; + } + else if (*p == '\n') + break; /* to process end of line */ + *(p++) = ' '; + } + --p; + } + else if (*p == '\\' && (p+1) < eof && *(p+1) == '\n') { + /* Consume backslash line terminations */ + *(p++) = ' '; + *p = ' '; + lineno++; + } + else if (*p == '?' && (p+3) < eof && + *(p+1) == '?' && *(p+2) == '/' && *(p+3) == '\n') { + /* Consume trigraph'ed backslash line terminations */ + *(p++) = ' '; + *(p++) = ' '; + *(p++) = ' '; + *p = ' '; + lineno++; + } + else if (*p == '\n') { + lineno++; + if (*bol == '#') { + char *cp; + + *(p++) = '\0'; + /* punt lines with just # (yacc generated) */ + for (cp = bol+1; + *cp && (*cp == ' ' || *cp == '\t'); cp++); + if (*cp) goto done; + --p; + } + bol = p+1; + whitespace = FALSE; + } + } + if (*bol != '#') + bol = NULL; +done: +#if !defined(__UNIXOS2__) && !defined(_MSC_VER) && !defined(_WIN32) + /* Don't print warnings for system header files */ + if (bol && whitespace && !strstr(filep->f_name, INCLUDEDIR)) { + warning("%s: non-portable whitespace encountered at line %d\n", + filep->f_name, lineno); + } +#endif + filep->f_p = p; + filep->f_line = lineno; +#ifdef DEBUG_DUMP + if (bol) + DBG_PRINT(stderr,"%s\n",bol); +#endif + return(bol); +} + +/* + * Strip the file name down to what we want to see in the Makefile. + * It will have objprefix and objsuffix around it. + */ +char *base_name(char *file) +{ + char *p; + + file = copy(file); + for(p=file+strlen(file); p>file && *p != '.'; p--) ; + + if (*p == '.') + *p = '\0'; + return(file); +} + +#if defined(USG) && !defined(CRAY) && !defined(SVR4) && !defined(__UNIXOS2__) && !defined(clipper) && !defined(__clipper__) +int rename (char *from, char *to) +{ + (void) unlink (to); + if (link (from, to) == 0) { + unlink (from); + return 0; + } else { + return -1; + } +} +#endif /* USGISH */ + +void +redirect(char *line, char *makefile) +{ + struct stat st; + FILE *fdin, *fdout; + char backup[ BUFSIZ ], + buf[ BUFSIZ ]; + boolean found = FALSE; + int len; + + /* + * if makefile is "-" then let it pour onto stdout. + */ + if (makefile && *makefile == '-' && *(makefile+1) == '\0') { + puts(line); + return; + } + + /* + * use a default makefile is not specified. + */ + if (!makefile) { + if (stat("Makefile", &st) == 0) + makefile = "Makefile"; + else if (stat("makefile", &st) == 0) + makefile = "makefile"; + else + fatalerr("[mM]akefile is not present\n"); + } + else + stat(makefile, &st); + if ((fdin = fopen(makefile, "r")) == NULL) + fatalerr("cannot open \"%s\"\n", makefile); + sprintf(backup, "%s.bak", makefile); + unlink(backup); +#if defined(WIN32) || defined(__UNIXOS2__) || defined(__CYGWIN__) + fclose(fdin); +#endif + if (rename(makefile, backup) < 0) + fatalerr("cannot rename %s to %s\n", makefile, backup); +#if defined(WIN32) || defined(__UNIXOS2__) || defined(__CYGWIN__) + if ((fdin = fopen(backup, "r")) == NULL) + fatalerr("cannot open \"%s\"\n", backup); +#endif + if ((fdout = freopen(makefile, "w", stdout)) == NULL) + fatalerr("cannot open \"%s\"\n", backup); + len = strlen(line); + while (!found && fgets(buf, BUFSIZ, fdin)) { + if (*buf == '#' && strncmp(line, buf, len) == 0) + found = TRUE; + fputs(buf, fdout); + } + if (!found) { + if (verbose) + warning("Adding new delimiting line \"%s\" and dependencies...\n", + line); + puts(line); /* same as fputs(fdout); but with newline */ + } else if (append) { + while (fgets(buf, BUFSIZ, fdin)) { + fputs(buf, fdout); + } + } + fflush(fdout); +#if defined(USGISH) || defined(_SEQUENT_) || defined(USE_CHMOD) + chmod(makefile, st.st_mode); +#else + fchmod(fileno(fdout), st.st_mode); +#endif /* USGISH */ +} + +void +fatalerr(char *msg, ...) +{ + va_list args; + fprintf(stderr, "%s: error: ", ProgramName); + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); + exit (1); +} + +void +warning(char *msg, ...) +{ + va_list args; + fprintf(stderr, "%s: warning: ", ProgramName); + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); +} + +void +warning1(char *msg, ...) +{ + va_list args; + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); +} diff --git a/mozilla/security/coreconf/mkdepend/mkdepend.man b/mozilla/security/coreconf/mkdepend/mkdepend.man new file mode 100644 index 0000000..595c87e --- /dev/null +++ b/mozilla/security/coreconf/mkdepend/mkdepend.man @@ -0,0 +1,382 @@ +.\" $Xorg: mkdepend.man,v 1.5 2001/02/09 02:03:16 xorgcvs Exp $ +.\" Copyright (c) 1993, 1994, 1998 The Open Group +.\" +.\" Permission to use, copy, modify, distribute, and sell this software and its +.\" documentation for any purpose is hereby granted without fee, provided that +.\" the above copyright notice appear in all copies and that both that +.\" copyright notice and this permission notice appear in supporting +.\" documentation. +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Except as contained in this notice, the name of The Open Group shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from The +.\" Open Group. +.\" +.\" $XFree86: xc/config/makedepend/mkdepend.man,v 1.7 2002/12/14 02:39:45 dawes Exp $ +.\" +.TH MAKEDEPEND 1 __xorgversion__ +.UC 4 +.SH NAME +makedepend \- create dependencies in makefiles +.SH SYNOPSIS +.B makedepend +[ +.BI \-D name\fB=\fPdef +] [ +.BI \-D name +] [ +.BI \-I includedir +] [ +.BI \-Y includedir +] [ +.B \-a +] [ +.BI \-f makefile +] [ +.BI \-include \ file +] [ +.BI \-o objsuffix +] [ +.BI \-p objprefix +] [ +.BI \-s string +] [ +.BI \-w width +] [ +.B \-v +] [ +.B \-m +] [ +\-\^\- +.I otheroptions +\-\^\- +] +.I sourcefile +\&.\|.\|. +.br +.SH DESCRIPTION +The +.B makedepend +program reads each +.I sourcefile +in sequence and parses it like a C-preprocessor, +processing all +.I #include, +.I #define, +.I #undef, +.I #ifdef, +.I #ifndef, +.I #endif, +.I #if, +.I #elif +and +.I #else +directives so that it can correctly tell which +.I #include, +directives would be used in a compilation. +Any +.I #include, +directives can reference files having other +.I #include +directives, and parsing will occur in these files as well. +.PP +Every file that a +.I sourcefile +includes, +directly or indirectly, +is what +.B makedepend +calls a \fIdependency.\fP +These dependencies are then written to a +.I makefile +in such a way that +.B make(1) +will know which object files must be recompiled when a dependency has changed. +.PP +By default, +.B makedepend +places its output in the file named +.I makefile +if it exists, otherwise +.I Makefile. +An alternate makefile may be specified with the +.B \-f +option. +It first searches the makefile for +the line +.sp +\& # DO NOT DELETE THIS LINE \-\^\- make depend depends on it. +.sp +or one provided with the +.B \-s +option, +as a delimiter for the dependency output. +If it finds it, it will delete everything +following this to the end of the makefile +and put the output after this line. +If it doesn't find it, the program +will append the string to the end of the makefile +and place the output following that. +For each +.I sourcefile +appearing on the command line, +.B makedepend +puts lines in the makefile of the form +.sp + sourcefile.o:\0dfile .\|.\|. +.sp +Where \fIsourcefile.o\fP is the name from the command +line with its suffix replaced with ``.o'', +and \fIdfile\fP is a dependency discovered in a +.I #include +directive while parsing +.I sourcefile +or one of the files it included. +.SH EXAMPLE +Normally, +.B makedepend +will be used in a makefile target so that typing ``make depend'' will +bring the dependencies up to date for the makefile. +For example, +.nf + SRCS\0=\0file1.c\0file2.c\0.\|.\|. + CFLAGS\0=\0\-O\0\-DHACK\0\-I\^.\^.\^/foobar\0\-xyz + depend: + makedepend\0\-\^\-\0$(CFLAGS)\0\-\^\-\0$(SRCS) +.fi +.SH OPTIONS +The program +will ignore any option that it does not understand so that you may use +the same arguments that you would for +.B cc(1). +.TP 5 +.B \-D\fIname\fP=\fIdef\fP \fRor\fP \-D\fIname\fP +Define. +This places a definition for +.I name +in +.B makedepend's +symbol table. +Without +.I =def\| +the symbol becomes defined as ``1''. +.TP 5 +.B \-I\fIincludedir\fP +Include directory. +This option tells +.B makedepend +to prepend +.I includedir +to its list of directories to search when it encounters +a +.I #include +directive. +By default, +.B makedepend +only searches the standard include directories (usually /usr/include +and possibly a compiler-dependent directory). +.TP 5 +.B \-Y\fIincludedir\fP +Replace all of the standard include directories with the single specified +include directory; you can omit the +.I includedir +to simply prevent searching the standard include directories. +.TP 5 +.B \-a +Append the dependencies to the end of the file instead of replacing them. +.TP 5 +.B \-f\fImakefile\fP +Filename. +This allows you to specify an alternate makefile in which +.B makedepend +can place its output. +Specifying ``\-'' as the file name (i.e., \fB\-f\-\fP) sends the +output to standard output instead of modifying an existing file. +.TP 5 +.B \-include \fIfile\fP +Process file as input, and include all the resulting output +before processing the regular input file. This has the same +affect as if the specified file is an include statement that +appears before the very first line of the regular input file. +.TP 5 +.B \-o\fIobjsuffix\fP +Object file suffix. +Some systems may have object files whose suffix is something other +than ``.o''. +This option allows you to specify another suffix, such as +``.b'' with +.I \-o.b +or ``:obj'' +with +.I \-o:obj +and so forth. +.TP 5 +.B \-p\fIobjprefix\fP +Object file prefix. +The prefix is prepended to the name of the object file. This is +usually used to designate a different directory for the object file. +The default is the empty string. +.TP 5 +.B \-s\fIstring\fP +Starting string delimiter. +This option permits you to specify +a different string for +.B makedepend +to look for in the makefile. +.TP 5 +.B \-w\fIwidth\fP +Line width. +Normally, +.B makedepend +will ensure that every output line that it writes will be no wider than +78 characters for the sake of readability. +This option enables you to change this width. +.TP 5 +.B \-v +Verbose operation. +This option causes +.B makedepend +to emit the list of files included by each input file. +.TP 5 +.B \-m +Warn about multiple inclusion. +This option causes +.B makedepend +to produce a warning if any input file includes another file more than +once. In previous versions of +.B makedepend +this was the default behavior; the default has been changed to better +match the behavior of the C compiler, which does not consider multiple +inclusion to be an error. This option is provided for backward +compatibility, and to aid in debugging problems related to multiple +inclusion. +.TP 5 +.B "\-\^\- \fIoptions\fP \-\^\-" +If +.B makedepend +encounters a double hyphen (\-\^\-) in the argument list, +then any unrecognized argument following it +will be silently ignored; a second double hyphen terminates this +special treatment. +In this way, +.B makedepend +can be made to safely ignore esoteric compiler arguments that might +normally be found in a CFLAGS +.B make +macro (see the +.B EXAMPLE +section above). +All options that +.B makedepend +recognizes and appear between the pair of double hyphens +are processed normally. +.SH ALGORITHM +The approach used in this program enables it to run an order of magnitude +faster than any other ``dependency generator'' I have ever seen. +Central to this performance are two assumptions: +that all files compiled by a single +makefile will be compiled with roughly the same +.I \-I +and +.I \-D +options; +and that most files in a single directory will include largely the +same files. +.PP +Given these assumptions, +.B makedepend +expects to be called once for each makefile, with +all source files that are maintained by the +makefile appearing on the command line. +It parses each source and include +file exactly once, maintaining an internal symbol table +for each. +Thus, the first file on the command line will take an amount of time +proportional to the amount of time that a normal C preprocessor takes. +But on subsequent files, if it encounters an include file +that it has already parsed, it does not parse it again. +.PP +For example, +imagine you are compiling two files, +.I file1.c +and +.I file2.c, +they each include the header file +.I header.h, +and the file +.I header.h +in turn includes the files +.I def1.h +and +.I def2.h. +When you run the command +.sp + makedepend\0file1.c\0file2.c +.sp +.B makedepend +will parse +.I file1.c +and consequently, +.I header.h +and then +.I def1.h +and +.I def2.h. +It then decides that the dependencies for this file are +.sp + file1.o:\0header.h\0def1.h\0def2.h +.sp +But when the program parses +.I file2.c +and discovers that it, too, includes +.I header.h, +it does not parse the file, +but simply adds +.I header.h, +.I def1.h +and +.I def2.h +to the list of dependencies for +.I file2.o. +.SH "SEE ALSO" +cc(1), make(1) +.SH BUGS +.B makedepend +parses, but does not currently evaluate, the SVR4 #predicate(token-list) +preprocessor expression; such expressions are simply assumed to be true. +This may cause the wrong +.I #include +directives to be evaluated. +.PP +Imagine you are parsing two files, +say +.I file1.c +and +.I file2.c, +each includes the file +.I def.h. +The list of files that +.I def.h +includes might truly be different when +.I def.h +is included by +.I file1.c +than when it is included by +.I file2.c. +But once +.B makedepend +arrives at a list of dependencies for a file, +it is cast in concrete. +.SH AUTHOR +Todd Brunhoff, Tektronix, Inc. and MIT Project Athena diff --git a/mozilla/security/coreconf/mkdepend/parse.c b/mozilla/security/coreconf/mkdepend/parse.c new file mode 100644 index 0000000..968d2c4 --- /dev/null +++ b/mozilla/security/coreconf/mkdepend/parse.c @@ -0,0 +1,686 @@ +/* $Xorg: parse.c,v 1.6 2001/02/09 02:03:16 xorgcvs Exp $ */ +/* + +Copyright (c) 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ +/* $XFree86: xc/config/makedepend/parse.c,v 1.12 2002/02/26 05:09:10 tsi Exp $ */ + +#include "def.h" + +extern char *directives[]; +extern struct inclist inclist[ MAXFILES ], + *inclistnext, + maininclist; +extern char *includedirs[ ], + **includedirsnext; + +static int deftype (char *line, struct filepointer *filep, + struct inclist *file_red, struct inclist *file, + int parse_it); +static int zero_value(char *filename, char *exp, struct filepointer *filep, + struct inclist *file_red); +static int merge2defines(struct inclist *file1, struct inclist *file2); + +static int +gobble(struct filepointer *filep, struct inclist *file, + struct inclist *file_red) +{ + char *line; + int type; + + while ((line = getnextline(filep))) { + switch(type = deftype(line, filep, file_red, file, FALSE)) { + case IF: + case IFFALSE: + case IFGUESSFALSE: + case IFDEF: + case IFNDEF: + type = gobble(filep, file, file_red); + while ((type == ELIF) || (type == ELIFFALSE) || + (type == ELIFGUESSFALSE)) + type = gobble(filep, file, file_red); + if (type == ELSE) + (void)gobble(filep, file, file_red); + break; + case ELSE: + case ENDIF: + debug(0,("%s, line %d: #%s\n", + file->i_file, filep->f_line, + directives[type])); + return(type); + case DEFINE: + case UNDEF: + case INCLUDE: + case INCLUDEDOT: + case PRAGMA: + case ERROR: + case IDENT: + case SCCS: + case EJECT: + case WARNING: + case INCLUDENEXT: + case INCLUDENEXTDOT: + break; + case ELIF: + case ELIFFALSE: + case ELIFGUESSFALSE: + return(type); + case -1: + warning("%s", file_red->i_file); + if (file_red != file) + warning1(" (reading %s)", file->i_file); + warning1(", line %d: unknown directive == \"%s\"\n", + filep->f_line, line); + break; + } + } + return(-1); +} + +/* + * Decide what type of # directive this line is. + */ +static int +deftype (char *line, struct filepointer *filep, + struct inclist *file_red, struct inclist *file, int parse_it) +{ + register char *p; + char *directive, savechar, *q; + register int ret; + + /* + * Parse the directive... + */ + directive=line+1; + while (*directive == ' ' || *directive == '\t') + directive++; + + p = directive; + while ((*p == '_') || (*p >= 'a' && *p <= 'z')) + p++; + savechar = *p; + *p = '\0'; + ret = match(directive, directives); + *p = savechar; + + /* If we don't recognize this compiler directive or we happen to just + * be gobbling up text while waiting for an #endif or #elif or #else + * in the case of an #elif we must check the zero_value and return an + * ELIF or an ELIFFALSE. + */ + + if (ret == ELIF && !parse_it) + { + while (*p == ' ' || *p == '\t') + p++; + /* + * parse an expression. + */ + debug(0,("%s, line %d: #elif %s ", + file->i_file, filep->f_line, p)); + ret = zero_value(file->i_file, p, filep, file_red); + if (ret != IF) + { + debug(0,("false...\n")); + if (ret == IFFALSE) + return(ELIFFALSE); + else + return(ELIFGUESSFALSE); + } + else + { + debug(0,("true...\n")); + return(ELIF); + } + } + + if (ret < 0 || ! parse_it) + return(ret); + + /* + * now decide how to parse the directive, and do it. + */ + while (*p == ' ' || *p == '\t') + p++; + q = p + strlen(p); + do { + q--; + } while (*q == ' ' || *q == '\t'); + q[1] = '\0'; + switch (ret) { + case IF: + /* + * parse an expression. + */ + ret = zero_value(file->i_file, p, filep, file_red); + debug(0,("%s, line %d: %s #if %s\n", + file->i_file, filep->f_line, ret?"false":"true", p)); + break; + case IFDEF: + case IFNDEF: + debug(0,("%s, line %d: #%s %s\n", + file->i_file, filep->f_line, directives[ret], p)); + case UNDEF: + /* + * separate the name of a single symbol. + */ + while (isalnum(*p) || *p == '_') + *line++ = *p++; + *line = '\0'; + break; + case INCLUDE: + case INCLUDENEXT: + debug(2,("%s, line %d: #include%s %s\n", + file->i_file, filep->f_line, + (ret == INCLUDE) ? "" : "_next", p)); + + /* Support ANSI macro substitution */ + while (1) { + struct symtab **sym; + + if (!*p || *p == '"' || *p == '<') + break; + + sym = isdefined(p, file_red, NULL); + if (!sym) + break; + + p = (*sym)->s_value; + debug(3,("%s : #includes SYMBOL %s = %s\n", + file->i_incstring, + (*sym) -> s_name, + (*sym) -> s_value)); + /* mark file as having included a 'soft include' */ + file->i_flags |= INCLUDED_SYM; + } + + /* + * Separate the name of the include file. + */ + while (*p && *p != '"' && *p != '<') + p++; + if (! *p) + return(-2); + if (*p++ == '"') { + if (ret == INCLUDE) + ret = INCLUDEDOT; + else + ret = INCLUDENEXTDOT; + while (*p && *p != '"') + *line++ = *p++; + } else + while (*p && *p != '>') + *line++ = *p++; + *line = '\0'; + break; + case DEFINE: + /* + * copy the definition back to the beginning of the line. + */ + strcpy (line, p); + break; + case ELSE: + case ENDIF: + case ELIF: + case PRAGMA: + case ERROR: + case IDENT: + case SCCS: + case EJECT: + case WARNING: + debug(0,("%s, line %d: #%s\n", + file->i_file, filep->f_line, directives[ret])); + /* + * nothing to do. + */ + break; + } + return(ret); +} + +struct symtab ** +fdefined(char *symbol, struct inclist *file, struct inclist **srcfile) +{ + struct inclist **ip; + struct symtab **val; + int i; + static int recurse_lvl = 0; + + if (file->i_flags & DEFCHECKED) + return(NULL); + debug(2,("Looking for %s in %s\n", symbol, file->i_file)); + file->i_flags |= DEFCHECKED; + if ((val = slookup(symbol, file))) + debug(1,("%s defined in %s as %s\n", + symbol, file->i_file, (*val)->s_value)); + if (val == NULL && file->i_list) + { + for (ip = file->i_list, i=0; i < file->i_listlen; i++, ip++) + if (file->i_merged[i]==FALSE) { + val = fdefined(symbol, *ip, srcfile); + file->i_merged[i]=merge2defines(file,*ip); + if (val!=NULL) break; + } + } + else if (val != NULL && srcfile != NULL) *srcfile = file; + recurse_lvl--; + file->i_flags &= ~DEFCHECKED; + + return(val); +} + +struct symtab ** +isdefined(char *symbol, struct inclist *file, struct inclist **srcfile) +{ + struct symtab **val; + + if ((val = slookup(symbol, &maininclist))) { + debug(1,("%s defined on command line\n", symbol)); + if (srcfile != NULL) *srcfile = &maininclist; + return(val); + } + if ((val = fdefined(symbol, file, srcfile))) + return(val); + debug(1,("%s not defined in %s\n", symbol, file->i_file)); + return(NULL); +} + +/* + * Return type based on if the #if expression evaluates to 0 + */ +static int +zero_value(char *filename, + char *exp, + struct filepointer *filep, + struct inclist *file_red) +{ + if (cppsetup(filename, exp, filep, file_red)) + return(IFFALSE); + else + return(IF); +} + +void +define2(char *name, char *val, struct inclist *file) +{ + int first, last, below; + register struct symtab **sp = NULL, **dest; + struct symtab *stab; + + /* Make space if it's needed */ + if (file->i_defs == NULL) + { + file->i_defs = (struct symtab **) + malloc(sizeof (struct symtab*) * SYMTABINC); + file->i_ndefs = 0; + } + else if (!(file->i_ndefs % SYMTABINC)) + file->i_defs = (struct symtab **) + realloc(file->i_defs, + sizeof(struct symtab*)*(file->i_ndefs+SYMTABINC)); + + if (file->i_defs == NULL) + fatalerr("malloc()/realloc() failure in insert_defn()\n"); + + below = first = 0; + last = file->i_ndefs - 1; + while (last >= first) + { + /* Fast inline binary search */ + register char *s1; + register char *s2; + register int middle = (first + last) / 2; + + /* Fast inline strchr() */ + s1 = name; + s2 = file->i_defs[middle]->s_name; + while (*s1++ == *s2++) + if (s2[-1] == '\0') break; + + /* If exact match, set sp and break */ + if (*--s1 == *--s2) + { + sp = file->i_defs + middle; + break; + } + + /* If name > i_defs[middle] ... */ + if (*s1 > *s2) + { + below = first; + first = middle + 1; + } + /* else ... */ + else + { + below = last = middle - 1; + } + } + + /* Search is done. If we found an exact match to the symbol name, + just replace its s_value */ + if (sp != NULL) + { + debug(1,("redefining %s from %s to %s in file %s\n", + name, (*sp)->s_value, val, file->i_file)); + free((*sp)->s_value); + (*sp)->s_value = copy(val); + return; + } + + sp = file->i_defs + file->i_ndefs++; + dest = file->i_defs + below + 1; + while (sp > dest) + { + *sp = sp[-1]; + sp--; + } + stab = (struct symtab *) malloc(sizeof (struct symtab)); + if (stab == NULL) + fatalerr("malloc()/realloc() failure in insert_defn()\n"); + + debug(1,("defining %s to %s in file %s\n", name, val, file->i_file)); + stab->s_name = copy(name); + stab->s_value = copy(val); + *sp = stab; +} + +void +define(char *def, struct inclist *file) +{ + char *val; + + /* Separate symbol name and its value */ + val = def; + while (isalnum(*val) || *val == '_') + val++; + if (*val) + *val++ = '\0'; + while (*val == ' ' || *val == '\t') + val++; + + if (!*val) + val = "1"; + define2(def, val, file); +} + +struct symtab ** +slookup(char *symbol, struct inclist *file) +{ + register int first = 0; + register int last = file->i_ndefs - 1; + + if (file) while (last >= first) + { + /* Fast inline binary search */ + register char *s1; + register char *s2; + register int middle = (first + last) / 2; + + /* Fast inline strchr() */ + s1 = symbol; + s2 = file->i_defs[middle]->s_name; + while (*s1++ == *s2++) + if (s2[-1] == '\0') break; + + /* If exact match, we're done */ + if (*--s1 == *--s2) + { + return file->i_defs + middle; + } + + /* If symbol > i_defs[middle] ... */ + if (*s1 > *s2) + { + first = middle + 1; + } + /* else ... */ + else + { + last = middle - 1; + } + } + return(NULL); +} + +static int +merge2defines(struct inclist *file1, struct inclist *file2) +{ + int i; + + if ((file1==NULL) || (file2==NULL) || + !(file2->i_flags & FINISHED)) + return 0; + + for (i=0; i < file2->i_listlen; i++) + if (file2->i_merged[i]==FALSE) + return 0; + + { + int first1 = 0; + int last1 = file1->i_ndefs - 1; + + int first2 = 0; + int last2 = file2->i_ndefs - 1; + + int first=0; + struct symtab** i_defs = NULL; + int deflen=file1->i_ndefs+file2->i_ndefs; + + debug(2,("merging %s into %s\n", + file2->i_file, file1->i_file)); + + if (deflen>0) + { + /* make sure deflen % SYMTABINC == 0 is still true */ + deflen += (SYMTABINC - deflen % SYMTABINC) % SYMTABINC; + i_defs=(struct symtab**) + malloc(deflen*sizeof(struct symtab*)); + if (i_defs==NULL) return 0; + } + + while ((last1 >= first1) && (last2 >= first2)) + { + char *s1=file1->i_defs[first1]->s_name; + char *s2=file2->i_defs[first2]->s_name; + + if (strcmp(s1,s2) < 0) + i_defs[first++]=file1->i_defs[first1++]; + else if (strcmp(s1,s2) > 0) + i_defs[first++]=file2->i_defs[first2++]; + else /* equal */ + { + i_defs[first++]=file2->i_defs[first2++]; + first1++; + } + } + while (last1 >= first1) + { + i_defs[first++]=file1->i_defs[first1++]; + } + while (last2 >= first2) + { + i_defs[first++]=file2->i_defs[first2++]; + } + + if (file1->i_defs) free(file1->i_defs); + file1->i_defs=i_defs; + file1->i_ndefs=first; + + return 1; + } +} + +void +undefine(char *symbol, struct inclist *file) +{ + register struct symtab **ptr; + struct inclist *srcfile; + while ((ptr = isdefined(symbol, file, &srcfile)) != NULL) + { + srcfile->i_ndefs--; + for (; ptr < srcfile->i_defs + srcfile->i_ndefs; ptr++) + *ptr = ptr[1]; + } +} + +int +find_includes(struct filepointer *filep, struct inclist *file, + struct inclist *file_red, int recursion, boolean failOK) +{ + struct inclist *inclistp; + char **includedirsp; + register char *line; + register int type; + boolean recfailOK; + + while ((line = getnextline(filep))) { + switch(type = deftype(line, filep, file_red, file, TRUE)) { + case IF: + doif: + type = find_includes(filep, file, + file_red, recursion+1, failOK); + while ((type == ELIF) || (type == ELIFFALSE) || + (type == ELIFGUESSFALSE)) + type = gobble(filep, file, file_red); + if (type == ELSE) + gobble(filep, file, file_red); + break; + case IFFALSE: + case IFGUESSFALSE: + doiffalse: + if (type == IFGUESSFALSE || type == ELIFGUESSFALSE) + recfailOK = TRUE; + else + recfailOK = failOK; + type = gobble(filep, file, file_red); + if (type == ELSE) + find_includes(filep, file, + file_red, recursion+1, recfailOK); + else + if (type == ELIF) + goto doif; + else + if ((type == ELIFFALSE) || (type == ELIFGUESSFALSE)) + goto doiffalse; + break; + case IFDEF: + case IFNDEF: + if ((type == IFDEF && isdefined(line, file_red, NULL)) + || (type == IFNDEF && !isdefined(line, file_red, NULL))) { + debug(1,(type == IFNDEF ? + "line %d: %s !def'd in %s via %s%s\n" : "", + filep->f_line, line, + file->i_file, file_red->i_file, ": doit")); + type = find_includes(filep, file, + file_red, recursion+1, failOK); + while (type == ELIF || type == ELIFFALSE || type == ELIFGUESSFALSE) + type = gobble(filep, file, file_red); + if (type == ELSE) + gobble(filep, file, file_red); + } + else { + debug(1,(type == IFDEF ? + "line %d: %s !def'd in %s via %s%s\n" : "", + filep->f_line, line, + file->i_file, file_red->i_file, ": gobble")); + type = gobble(filep, file, file_red); + if (type == ELSE) + find_includes(filep, file, + file_red, recursion+1, failOK); + else if (type == ELIF) + goto doif; + else if (type == ELIFFALSE || type == ELIFGUESSFALSE) + goto doiffalse; + } + break; + case ELSE: + case ELIFFALSE: + case ELIFGUESSFALSE: + case ELIF: + if (!recursion) + gobble(filep, file, file_red); + case ENDIF: + if (recursion) + return(type); + case DEFINE: + define(line, file); + break; + case UNDEF: + if (!*line) { + warning("%s", file_red->i_file); + if (file_red != file) + warning1(" (reading %s)", file->i_file); + warning1(", line %d: incomplete undef == \"%s\"\n", + filep->f_line, line); + break; + } + undefine(line, file_red); + break; + case INCLUDE: + case INCLUDEDOT: + case INCLUDENEXT: + case INCLUDENEXTDOT: + inclistp = inclistnext; + includedirsp = includedirsnext; + debug(2,("%s, reading %s, includes %s\n", + file_red->i_file, file->i_file, line)); + add_include(filep, file, file_red, line, type, failOK); + inclistnext = inclistp; + includedirsnext = includedirsp; + break; + case ERROR: + case WARNING: + warning("%s", file_red->i_file); + if (file_red != file) + warning1(" (reading %s)", file->i_file); + warning1(", line %d: %s\n", + filep->f_line, line); + break; + + case PRAGMA: + case IDENT: + case SCCS: + case EJECT: + break; + case -1: + warning("%s", file_red->i_file); + if (file_red != file) + warning1(" (reading %s)", file->i_file); + warning1(", line %d: unknown directive == \"%s\"\n", + filep->f_line, line); + break; + case -2: + warning("%s", file_red->i_file); + if (file_red != file) + warning1(" (reading %s)", file->i_file); + warning1(", line %d: incomplete include == \"%s\"\n", + filep->f_line, line); + break; + } + } + file->i_flags |= FINISHED; + debug(2,("finished with %s\n", file->i_file)); + return(-1); +} diff --git a/mozilla/security/coreconf/mkdepend/pr.c b/mozilla/security/coreconf/mkdepend/pr.c new file mode 100644 index 0000000..e864793 --- /dev/null +++ b/mozilla/security/coreconf/mkdepend/pr.c @@ -0,0 +1,124 @@ +/* $Xorg: pr.c,v 1.4 2001/02/09 02:03:16 xorgcvs Exp $ */ +/* + +Copyright (c) 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ +/* $XFree86: xc/config/makedepend/pr.c,v 1.5 2001/12/14 19:53:21 dawes Exp $ */ + +#include "def.h" + +extern struct inclist inclist[ MAXFILES ], + *inclistp; +extern char *objprefix; +extern char *objsuffix; +extern int width; +extern boolean printed; +extern boolean verbose; +extern boolean show_where_not; + +void +add_include(struct filepointer *filep, struct inclist *file, + struct inclist *file_red, char *include, int type, + boolean failOK) +{ + register struct inclist *newfile; + register struct filepointer *content; + + /* + * First decide what the pathname of this include file really is. + */ + newfile = inc_path(file->i_file, include, type); + if (newfile == NULL) { + if (failOK) + return; + if (file != file_red) + warning("%s (reading %s, line %d): ", + file_red->i_file, file->i_file, filep->f_line); + else + warning("%s, line %d: ", file->i_file, filep->f_line); + warning1("cannot find include file \"%s\"\n", include); + show_where_not = TRUE; + newfile = inc_path(file->i_file, include, type); + show_where_not = FALSE; + } + + if (newfile) { + included_by(file, newfile); + if (!(newfile->i_flags & SEARCHED)) { + newfile->i_flags |= SEARCHED; + content = getfile(newfile->i_file); + find_includes(content, newfile, file_red, 0, failOK); + freefile(content); + } + } +} + +static void +pr(struct inclist *ip, char *file, char *base) +{ + static char *lastfile; + static int current_len; + register int len, i; + char buf[ BUFSIZ ]; + + printed = TRUE; + len = strlen(ip->i_file)+1; + if (current_len + len > width || file != lastfile) { + lastfile = file; + sprintf(buf, "\n%s%s%s: %s", objprefix, base, objsuffix, + ip->i_file); + len = current_len = strlen(buf); + } + else { + buf[0] = ' '; + strcpy(buf+1, ip->i_file); + current_len += len; + } + fwrite(buf, len, 1, stdout); + + /* + * If verbose is set, then print out what this file includes. + */ + if (! verbose || ip->i_list == NULL || ip->i_flags & NOTIFIED) + return; + ip->i_flags |= NOTIFIED; + lastfile = NULL; + printf("\n# %s includes:", ip->i_file); + for (i=0; ii_listlen; i++) + printf("\n#\t%s", ip->i_list[ i ]->i_incstring); +} + +void +recursive_pr_include(struct inclist *head, char *file, char *base) +{ + int i; + + if (head->i_flags & MARKED) + return; + head->i_flags |= MARKED; + if (head->i_file != file) + pr(head, file, base); + for (i=0; ii_listlen; i++) + recursive_pr_include(head->i_list[ i ], file, base); +} diff --git a/mozilla/security/coreconf/module.mk b/mozilla/security/coreconf/module.mk new file mode 100644 index 0000000..5de3984 --- /dev/null +++ b/mozilla/security/coreconf/module.mk @@ -0,0 +1,69 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# The master "Core Components" source and release component directory # +# names are ALWAYS identical and are the value of $(MODULE). # +# NOTE: A component is also called a module or a subsystem. # +####################################################################### + +# +# All "Core Components" -specific source-side tags must +# always be identified for compiling/linking purposes +# + +ifndef JAVA_SOURCE_COMPONENT + JAVA_SOURCE_COMPONENT = java +endif + +ifndef NETLIB_SOURCE_COMPONENT + NETLIB_SOURCE_COMPONENT = netlib +endif + +ifndef NSPR_SOURCE_COMPONENT + NSPR_SOURCE_COMPONENT = nspr20 +endif + +ifndef SECTOOLS_SOURCE_COMPONENT + SECTOOLS_SOURCE_COMPONENT = sectools +endif + +ifndef SECURITY_SOURCE_COMPONENT + SECURITY_SOURCE_COMPONENT = security +endif + +MK_MODULE = included diff --git a/mozilla/security/coreconf/nsinstall/Makefile b/mozilla/security/coreconf/nsinstall/Makefile new file mode 100644 index 0000000..c794890 --- /dev/null +++ b/mozilla/security/coreconf/nsinstall/Makefile @@ -0,0 +1,74 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../.. +CORE_DEPTH = ../.. + +MODULE = coreconf + +CSRCS = nsinstall.c pathsub.c + +PROGRAM = nsinstall + +# Indicate that this directory builds build tools. +INTERNAL_TOOLS = 1 + + +include $(DEPTH)/coreconf/config.mk + +ifeq (,$(filter-out OS2 WIN%,$(OS_TARGET))) +PROGRAM = +else +TARGETS = $(PROGRAM) +INSTALL = true +endif + +ifdef NATIVE_CC +CC=$(NATIVE_CC) +endif + +ifdef NATIVE_FLAGS +OS_CFLAGS=$(NATIVE_FLAGS) +endif + +include $(DEPTH)/coreconf/rules.mk + +# Redefine MAKE_OBJDIR for just this directory +define MAKE_OBJDIR +if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); fi +endef + diff --git a/mozilla/security/coreconf/nsinstall/nsinstall.c b/mozilla/security/coreconf/nsinstall/nsinstall.c new file mode 100644 index 0000000..647f111 --- /dev/null +++ b/mozilla/security/coreconf/nsinstall/nsinstall.c @@ -0,0 +1,439 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* +** Netscape portable install command. +*/ +#include /* OSF/1 requires this before grp.h, so put it first */ +#include +#include +#include +#if defined(_WINDOWS) +#include +typedef unsigned int mode_t; +#else +#include +#include +#include +#include +#include +#include +#endif +#include +#include +#include "pathsub.h" + +#define HAVE_LCHOWN + +#if defined(AIX) || defined(BSDI) || defined(HPUX) || defined(LINUX) || defined(SUNOS4) || defined(SCO) || defined(UNIXWARE) || defined(NTO) || defined(DARWIN) || defined(BEOS) || defined(__riscos__) +#undef HAVE_LCHOWN +#endif + +#define HAVE_FCHMOD + +#if defined(BEOS) +#undef HAVE_FCHMOD +#endif + +#ifdef LINUX +#include +#endif + +#if defined(SCO) || defined(UNIXWARE) || defined(SNI) || defined(NCR) || defined(NEC) +#if !defined(S_ISLNK) && defined(S_IFLNK) +#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK) +#endif +#endif + +#if defined(SNI) +extern int fchmod(int fildes, mode_t mode); +#endif + + +#ifdef GETCWD_CANT_MALLOC +/* + * this should probably go into a utility library in case other applications + * need it. + */ +static char * +getcwd_do_malloc(char *path, int len) { + + if (!path) { + path = malloc(PATH_MAX +1); + if (!path) return NULL; + } + return getcwd(path, PATH_MAX); +} +#define GETCWD getcwd_do_malloc +#else +#define GETCWD getcwd +#endif + + +static void +usage(void) +{ + fprintf(stderr, + "usage: %s [-C cwd] [-L linkprefix] [-m mode] [-o owner] [-g group]\n" + " %*s [-DdltR] file [file ...] directory\n", + program, (int)strlen(program), ""); + exit(2); +} + +/* this is more-or-less equivalent to mkdir -p */ +static int +mkdirs(char *path, mode_t mode) +{ + char * cp; + int rv; + struct stat sb; + + if (!path || !path[0]) + fail("Null pointer or empty string passed to mkdirs()"); + while (*path == '/' && path[1] == '/') + path++; + for (cp = strrchr(path, '/'); cp && cp != path && *(cp - 1) == '/'; cp--); + if (cp && cp != path) { + *cp = '\0'; + if ((stat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) && + mkdirs(path, mode) < 0) { + return -1; + } + *cp = '/'; + } + rv = mkdir(path, mode); + if (rv) { + if (errno != EEXIST) + fail("mkdirs cannot make %s", path); + fprintf(stderr, "directory creation race: %s\n", path); + if (!stat(path, &sb) && S_ISDIR(sb.st_mode)) + rv = 0; + } + return rv; +} + +static uid_t +touid(char *owner) +{ + struct passwd *pw; + uid_t uid; + char *cp; + + if (!owner || !owner[0]) + fail("Null pointer or empty string passed to touid()"); + pw = getpwnam(owner); + if (pw) + return pw->pw_uid; + uid = strtol(owner, &cp, 0); + if (uid == 0 && cp == owner) + fail("cannot find uid for %s", owner); + return uid; +} + +static gid_t +togid(char *group) +{ + struct group *gr; + gid_t gid; + char *cp; + + if (!group || !group[0]) + fail("Null pointer or empty string passed to togid()"); + gr = getgrnam(group); + if (gr) + return gr->gr_gid; + gid = strtol(group, &cp, 0); + if (gid == 0 && cp == group) + fail("cannot find gid for %s", group); + return gid; +} + +void * const uninit = (void *)0xdeadbeef; + +int +main(int argc, char **argv) +{ + char * base = uninit; + char * bp = uninit; + char * cp = uninit; + char * cwd = 0; + char * group = 0; + char * linkname = 0; + char * linkprefix = 0; + char * name = uninit; + char * owner = 0; + char * todir = uninit; + char * toname = uninit; + + int bnlen = -1; + int cc = 0; + int dodir = 0; + int dolink = 0; + int dorelsymlink = 0; + int dotimes = 0; + int exists = 0; + int fromfd = -1; + int len = -1; + int lplen = 0; + int onlydir = 0; + int opt = -1; + int tdlen = -1; + int tofd = -1; + int wc = -1; + + mode_t mode = 0755; + + uid_t uid = -1; + gid_t gid = -1; + + struct stat sb; + struct stat tosb; + struct utimbuf utb; + char buf[BUFSIZ]; + + program = strrchr(argv[0], '/'); + if (!program) + program = strrchr(argv[0], '\\'); + program = program ? program+1 : argv[0]; + + + while ((opt = getopt(argc, argv, "C:DdlL:Rm:o:g:t")) != EOF) { + switch (opt) { + case 'C': cwd = optarg; break; + case 'D': onlydir = 1; break; + case 'd': dodir = 1; break; + case 'l': dolink = 1; break; + case 'L': + linkprefix = optarg; + lplen = strlen(linkprefix); + dolink = 1; + break; + case 'R': dolink = dorelsymlink = 1; break; + case 'm': + mode = strtoul(optarg, &cp, 8); + if (mode == 0 && cp == optarg) + usage(); + break; + case 'o': owner = optarg; break; + case 'g': group = optarg; break; + case 't': dotimes = 1; break; + default: usage(); + } + } + + argc -= optind; + argv += optind; + if (argc < 2 - onlydir) + usage(); + + todir = argv[argc-1]; + if ((stat(todir, &sb) < 0 || !S_ISDIR(sb.st_mode)) && + mkdirs(todir, 0777) < 0) { + fail("cannot mkdir -p %s", todir); + } + if (onlydir) + return 0; + + if (!cwd) { + cwd = GETCWD(0, PATH_MAX); + if (!cwd) + fail("could not get CWD"); + } + + /* make sure we can get into todir. */ + xchdir(todir); + todir = GETCWD(0, PATH_MAX); + if (!todir) + fail("could not get CWD in todir"); + tdlen = strlen(todir); + + /* back to original directory. */ + xchdir(cwd); + + uid = owner ? touid(owner) : -1; + gid = group ? togid(group) : -1; + + while (--argc > 0) { + name = *argv++; + len = strlen(name); + base = xbasename(name); + bnlen = strlen(base); + toname = (char*)xmalloc(tdlen + 1 + bnlen + 1); + sprintf(toname, "%s/%s", todir, base); +retry: + exists = (lstat(toname, &tosb) == 0); + + if (dodir) { + /* -d means create a directory, always */ + if (exists && !S_ISDIR(tosb.st_mode)) { + int rv = unlink(toname); + if (rv) + fail("cannot unlink %s", toname); + exists = 0; + } + if (!exists && mkdir(toname, mode) < 0) { + /* we probably have two nsinstall programs in a race here. */ + if (errno == EEXIST && !stat(toname, &sb) && + S_ISDIR(sb.st_mode)) { + fprintf(stderr, "directory creation race: %s\n", toname); + goto retry; + } + fail("cannot make directory %s", toname); + } + if ((owner || group) && chown(toname, uid, gid) < 0) + fail("cannot change owner of %s", toname); + } else if (dolink) { + if (*name == '/') { + /* source is absolute pathname, link to it directly */ + linkname = 0; + } else { + if (linkprefix) { + /* -L implies -l and prefixes names with a $cwd arg. */ + len += lplen + 1; + linkname = (char*)xmalloc(len + 1); + sprintf(linkname, "%s/%s", linkprefix, name); + } else if (dorelsymlink) { + /* Symlink the relative path from todir to source name. */ + linkname = (char*)xmalloc(PATH_MAX); + + if (*todir == '/') { + /* todir is absolute: skip over common prefix. */ + lplen = relatepaths(todir, cwd, linkname); + strcpy(linkname + lplen, name); + } else { + /* todir is named by a relative path: reverse it. */ + reversepath(todir, name, len, linkname); + xchdir(cwd); + } + + len = strlen(linkname); + } + name = linkname; + } + + /* Check for a pre-existing symlink with identical content. */ + if (exists && + (!S_ISLNK(tosb.st_mode) || + readlink(toname, buf, sizeof buf) != len || + strncmp(buf, name, len) != 0)) { + int rmrv; + rmrv = (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname); + if (rmrv < 0) { + fail("destination exists, cannot remove %s", toname); + } + exists = 0; + } + if (!exists && symlink(name, toname) < 0) { + if (errno == EEXIST) { + fprintf(stderr, "symlink creation race: %s\n", toname); + fail("symlink was attempted in working directory %s " + "from %s to %s.\n", cwd, name, toname); + goto retry; + } + diagnosePath(toname); + fail("cannot make symbolic link %s", toname); + } +#ifdef HAVE_LCHOWN + if ((owner || group) && lchown(toname, uid, gid) < 0) + fail("cannot change owner of %s", toname); +#endif + + if (linkname) { + free(linkname); + linkname = 0; + } + } else { + /* Copy from name to toname, which might be the same file. */ + fromfd = open(name, O_RDONLY); + if (fromfd < 0 || fstat(fromfd, &sb) < 0) + fail("cannot access %s", name); + if (exists && + (!S_ISREG(tosb.st_mode) || access(toname, W_OK) < 0)) { + int rmrv; + rmrv = (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname); + if (rmrv < 0) { + fail("destination exists, cannot remove %s", toname); + } + } + tofd = open(toname, O_CREAT | O_WRONLY, 0666); + if (tofd < 0) + fail("cannot create %s", toname); + + bp = buf; + while ((cc = read(fromfd, bp, sizeof buf)) > 0) { + while ((wc = write(tofd, bp, cc)) > 0) { + if ((cc -= wc) == 0) + break; + bp += wc; + } + if (wc < 0) + fail("cannot write to %s", toname); + } + if (cc < 0) + fail("cannot read from %s", name); + + if (ftruncate(tofd, sb.st_size) < 0) + fail("cannot truncate %s", toname); + if (dotimes) { + utb.actime = sb.st_atime; + utb.modtime = sb.st_mtime; + if (utime(toname, &utb) < 0) + fail("cannot set times of %s", toname); + } +#ifdef HAVE_FCHMOD + if (fchmod(tofd, mode) < 0) +#else + if (chmod(toname, mode) < 0) +#endif + fail("cannot change mode of %s", toname); + + if ((owner || group) && fchown(tofd, uid, gid) < 0) + fail("cannot change owner of %s", toname); + + /* Must check for delayed (NFS) write errors on close. */ + if (close(tofd) < 0) + fail("close reports write error on %s", toname); + close(fromfd); + } + + free(toname); + } + + free(cwd); + free(todir); + return 0; +} + diff --git a/mozilla/security/coreconf/nsinstall/pathsub.c b/mozilla/security/coreconf/nsinstall/pathsub.c new file mode 100644 index 0000000..d8ac93e --- /dev/null +++ b/mozilla/security/coreconf/nsinstall/pathsub.c @@ -0,0 +1,306 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* +** Pathname subroutines. +*/ +#include +#if defined(FREEBSD) || defined(BSDI) || defined(DARWIN) +#include +#endif /* FREEBSD */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pathsub.h" +#ifdef USE_REENTRANT_LIBC +#include "libc_r.h" +#endif /* USE_REENTRANT_LIBC */ + +char *program; + +void +fail(char *format, ...) +{ + int error; + va_list ap; + +#ifdef USE_REENTRANT_LIBC + R_STRERROR_INIT_R(); +#endif + + error = errno; + fprintf(stderr, "%s: ", program); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + if (error) { + +#ifdef USE_REENTRANT_LIBC + R_STRERROR_R(errno); + fprintf(stderr, ": %s", r_strerror_r); +#else + fprintf(stderr, ": %s", strerror(errno)); +#endif + } + + putc('\n', stderr); + abort(); + exit(1); +} + +char * +getcomponent(char *path, char *name) +{ + if (*path == '\0') + return 0; + if (*path == '/') { + *name++ = '/'; + } else { + do { + *name++ = *path++; + } while (*path != '/' && *path != '\0'); + } + *name = '\0'; + while (*path == '/') + path++; + return path; +} + +#ifdef UNIXWARE +/* The static buffer in Unixware's readdir is too small. */ +struct dirent * readdir(DIR *d) +{ + static struct dirent *buf = NULL; +#define MAX_PATH_LEN 1024 + + if (buf == NULL) + buf = (struct dirent *)xmalloc(sizeof(struct dirent) + MAX_PATH_LEN) ; + return readdir_r(d, buf); +} +#endif + +/* APPARENT BUG - ignores argument "dir", uses ".." instead. */ +char * +ino2name(ino_t ino, char *dir) +{ + DIR *dp; + struct dirent *ep; + char *name; + + dp = opendir(".."); /* XXX */ + if (!dp) + fail("cannot read parent directory"); + for (;;) { + if (!(ep = readdir(dp))) + fail("cannot find current directory"); + if (ep->d_ino == ino) + break; + } + name = xstrdup(ep->d_name); + closedir(dp); + return name; +} + +void * +xmalloc(size_t size) +{ + void *p; + + if (size <= 0) + fail("attempted to allocate %u bytes", size); + p = malloc(size); + if (!p) + fail("cannot allocate %u bytes", size); + return p; +} + +char * +xstrdup(char *s) +{ + if (!s || !s[0]) + fail("Null pointer or empty string passed to xstrdup()"); + return strcpy((char*)xmalloc(strlen(s) + 1), s); +} + +char * +xbasename(char *path) +{ + char *cp; + + if (!path || !path[0]) + fail("Null pointer or empty string passed to xbasename()"); + while ((cp = strrchr(path, '/')) && cp[1] == '\0') + *cp = '\0'; + if (!cp) return path; + return cp + 1; +} + +void +xchdir(char *dir) +{ + if (!dir || !dir[0]) + fail("Null pointer or empty string passed to xchdir()"); + if (chdir(dir) < 0) + fail("cannot change directory to %s", dir); +} + +int +relatepaths(char *from, char *to, char *outpath) +{ + char *cp, *cp2; + int len; + char buf[NAME_MAX]; + + assert(*from == '/' && *to == '/'); + if (!from || *from != '/') + fail("relatepaths: from path does not start with /"); + if (!to || *to != '/') + fail("relatepaths: to path does not start with /"); + + for (cp = to, cp2 = from; *cp == *cp2; cp++, cp2++) + if (*cp == '\0') + break; + while (cp[-1] != '/') + cp--, cp2--; + if (cp - 1 == to) { + /* closest common ancestor is /, so use full pathname */ + len = strlen(strcpy(outpath, to)); + if (outpath[len] != '/') { + outpath[len++] = '/'; + outpath[len] = '\0'; + } + } else { + len = 0; + while ((cp2 = getcomponent(cp2, buf)) != 0) { + strcpy(outpath + len, "../"); + len += 3; + } + while ((cp = getcomponent(cp, buf)) != 0) { + sprintf(outpath + len, "%s/", buf); + len += strlen(outpath + len); + } + } + return len; +} + +void +reversepath(char *inpath, char *name, int len, char *outpath) +{ + char *cp, *cp2; + char buf[NAME_MAX]; + struct stat sb; + + cp = strcpy(outpath + PATH_MAX - (len + 1), name); + cp2 = inpath; + while ((cp2 = getcomponent(cp2, buf)) != 0) { + if (strcmp(buf, ".") == 0) + continue; + if (strcmp(buf, "..") == 0) { + if (stat(".", &sb) < 0) + fail("cannot stat current directory"); + name = ino2name(sb.st_ino, ".."); + len = strlen(name); + cp -= len + 1; + strcpy(cp, name); + cp[len] = '/'; + free(name); + xchdir(".."); + } else { + cp -= 3; + strncpy(cp, "../", 3); + xchdir(buf); + } + } + strcpy(outpath, cp); +} + +void +diagnosePath(const char * path) +{ + char * myPath; + char * slash; + int rv; + struct stat sb; + char buf[BUFSIZ]; + + if (!path || !path[0]) + fail("Null pointer or empty string passed to mkdirs()"); + myPath = strdup(path); + if (!myPath) + fail("strdup() failed!"); + do { + rv = lstat(myPath, &sb); + if (rv < 0) { + perror(myPath); + } else if (S_ISLNK(sb.st_mode)) { + rv = readlink(myPath, buf, sizeof buf); + if (rv < 0) { + perror("readlink"); + buf[0] = 0; + } else { + buf[rv] = 0; + } + fprintf(stderr, "%s is a link to %s\n", myPath, buf); + } else if (S_ISDIR(sb.st_mode)) { + fprintf(stderr, "%s is a directory\n", myPath); + rv = access(myPath, X_OK); + if (rv < 0) { + fprintf(stderr, "%s: no search permission\n", myPath); + } + } else { + fprintf(stderr, "%s is a file !?!\n", myPath); + rv = access(myPath, F_OK); + if (rv < 0) { + fprintf(stderr, "%s does not exist\n", myPath); + } + } + + /* chop path off one level. */ + slash = strrchr(myPath, '/'); + if (!slash) + slash = strrchr(myPath, '\\'); + if (!slash) + slash = myPath; + *slash = 0; + } while (myPath[0]); + free(myPath); +} diff --git a/mozilla/security/coreconf/nsinstall/pathsub.h b/mozilla/security/coreconf/nsinstall/pathsub.h new file mode 100644 index 0000000..a3b828b --- /dev/null +++ b/mozilla/security/coreconf/nsinstall/pathsub.h @@ -0,0 +1,80 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef pathsub_h___ +#define pathsub_h___ +/* +** Pathname subroutines. +** +** Brendan Eich, 8/29/95 +*/ +#include +#include + +#if SUNOS4 +#include "sunos4.h" +#endif + +#ifndef PATH_MAX +#define PATH_MAX 1024 +#endif + +/* + * Just keep sane lengths + */ +#undef NAME_MAX +#define NAME_MAX 256 + +extern char *program; + +extern void fail(char *format, ...); +extern char *getcomponent(char *path, char *name); +extern char *ino2name(ino_t ino, char *dir); +extern void *xmalloc(size_t size); +extern char *xstrdup(char *s); +extern char *xbasename(char *path); +extern void xchdir(char *dir); + +/* Relate absolute pathnames from and to returning the result in outpath. */ +extern int relatepaths(char *from, char *to, char *outpath); + +/* NOTE: changes current working directory -- caveat emptor */ +extern void reversepath(char *inpath, char *name, int len, char *outpath); + +/* stats every directory in path, reports results. */ +extern void diagnosePath(const char * path); + +#endif /* pathsub_h___ */ diff --git a/mozilla/security/coreconf/nsinstall/sunos4.h b/mozilla/security/coreconf/nsinstall/sunos4.h new file mode 100644 index 0000000..5327880 --- /dev/null +++ b/mozilla/security/coreconf/nsinstall/sunos4.h @@ -0,0 +1,166 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef pr_sunos4_h___ +#define pr_sunos4_h___ + +#ifndef SVR4 + +/* +** Hodge podge of random missing prototypes for the Sunos4 system +*/ +#include +#include +#include +#include +#include + +#define PATH_MAX _POSIX_PATH_MAX + +struct timeval; +struct timezone; +struct itimerval; +struct sockaddr; +struct stat; +struct tm; + +/* ctype.h */ +extern int tolower(int); +extern int toupper(int); + +/* errno.h */ +extern char *sys_errlist[]; +extern int sys_nerr; + +#define strerror(e) sys_errlist[((unsigned)(e) < sys_nerr) ? e : 0] + +extern void perror(const char *); + +/* getopt */ +extern char *optarg; +extern int optind; +extern int getopt(int argc, char **argv, char *spec); + +/* math.h */ +extern int srandom(long val); +extern long random(void); + +/* memory.h */ +#define memmove(to,from,len) bcopy((char*)(from),(char*)(to),len) + +extern void bcopy(const char *, char *, int); + +/* signal.h */ +/* +** SunOS4 sigaction hides interrupts by default, so we can safely define +** SA_RESTART to 0 (HP-UX is a counter-example -- its sigaction does not +** hide interrupts but lacks an SA_RESTART option; you must use sigvector +** and tweak the sigcontext from within each signal handler!). +*/ +#define SA_RESTART 0 +#define SA_SIGINFO 0 + +/* stdio.h */ +extern int printf(const char *, ...); +extern int fprintf(FILE *, const char *, ...); +extern int vprintf(const char *, va_list); +extern int vfprintf(FILE *, const char *, va_list); +extern char *vsprintf(char *, const char *, va_list); +extern int scanf(const char *, ...); +extern int sscanf(const char *, const char *, ...); +extern int fscanf(FILE *, const char *, ...); +extern int fgetc(FILE *); +extern int fputc(int, FILE *); +extern int fputs(const char *, FILE *); +extern int puts(const char *); +extern int fread(void *, size_t, size_t, FILE *); +extern int fwrite(const char *, int, int, FILE *); +extern int fseek(FILE *, long, int); +extern long ftell(FILE *); +extern int rewind(FILE *); +extern int fflush(FILE *); +extern int _flsbuf(unsigned char, FILE *); +extern int fclose(FILE *); +extern int remove(const char *); +extern int setvbuf(FILE *, char *, int, size_t); +extern int system(const char *); +extern FILE *popen(const char *, const char *); +extern int pclose(FILE *); + +/* stdlib.h */ +#define strtoul strtol + +extern int isatty(int fildes); +extern long strtol(const char *, char **, int); +extern int putenv(const char *); +extern void srand48(long); +extern long lrand48(void); +extern double drand48(void); + +/* string.h */ +extern int strcasecmp(const char *, const char *); +extern int strncasecmp(const char *, const char *, size_t); +extern int strcoll(const char *, const char *); + +/* time.h */ +extern time_t mktime(struct tm *); +extern size_t strftime(char *, size_t, const char *, const struct tm *); +extern int gettimeofday(struct timeval *, struct timezone *); +extern int setitimer(int, struct itimerval *, struct itimerval *); +extern time_t time(time_t *); +extern time_t timegm(struct tm *); +extern struct tm *localtime(const time_t *); +extern struct tm *gmtime(const time_t *); + +/* unistd.h */ +extern int rename(const char *, const char *); +extern int ioctl(int, int, int *arg); +extern int connect(int, struct sockaddr *, int); +extern int readlink(const char *, char *, int); +extern int symlink(const char *, const char *); +extern int ftruncate(int, off_t); +extern int fchmod(int, mode_t); +extern int fchown(int, uid_t, gid_t); +extern int lstat(const char *, struct stat *); +extern int fstat(int, struct stat *); +extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); +extern int gethostname(char *, int); +extern char *getwd(char *); +extern int getpagesize(void); + +#endif /* SVR4 */ + +#endif /* pr_sunos4_h___ */ diff --git a/mozilla/security/coreconf/outofdate.pl b/mozilla/security/coreconf/outofdate.pl new file mode 100755 index 0000000..54aec09 --- /dev/null +++ b/mozilla/security/coreconf/outofdate.pl @@ -0,0 +1,71 @@ +#!/usr/local/bin/perl +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +#Input: [-d dir] foo1.java foo2.java +#Compares with: foo1.class foo2.class (if -d specified, checks in 'dir', +# otherwise assumes .class files in same directory as .java files) +#Returns: list of input arguments which are newer than corresponding class +#files (non-existent class files are considered to be real old :-) + +$found = 1; + +if ($ARGV[0] eq '-d') { + $classdir = $ARGV[1]; + $classdir .= "/"; + shift; + shift; +} else { + $classdir = "./"; +} + +foreach $filename (@ARGV) { + $classfilename = $classdir; + $classfilename .= $filename; + $classfilename =~ s/.java$/.class/; + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime, + $ctime,$blksize,$blocks) = stat($filename); + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$classmtime, + $ctime,$blksize,$blocks) = stat($classfilename); +# print $filename, " ", $mtime, ", ", $classfilename, " ", $classmtime, "\n"; + if ($mtime > $classmtime) { + print $filename, " "; + $found = 0; + } +} + +print "\n"; diff --git a/mozilla/security/coreconf/prefix.mk b/mozilla/security/coreconf/prefix.mk new file mode 100644 index 0000000..a59215b --- /dev/null +++ b/mozilla/security/coreconf/prefix.mk @@ -0,0 +1,76 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# Master "Core Components" for computing program prefixes # +####################################################################### + +# +# Object prefixes +# + +ifndef OBJ_PREFIX + OBJ_PREFIX = +endif + +# +# Library suffixes +# + +ifndef LIB_PREFIX + LIB_PREFIX = lib +endif + + +ifndef DLL_PREFIX + DLL_PREFIX = lib +endif + + +ifndef IMPORT_LIB_PREFIX + IMPORT_LIB_PREFIX = +endif + +# +# Program prefixes +# + +ifndef PROG_PREFIX + PROG_PREFIX = +endif + +MK_PREFIX = included diff --git a/mozilla/security/coreconf/release.pl b/mozilla/security/coreconf/release.pl new file mode 100755 index 0000000..286ec5c --- /dev/null +++ b/mozilla/security/coreconf/release.pl @@ -0,0 +1,144 @@ +#! /usr/local/bin/perl +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + + +require('coreconf.pl'); + +#######-- read in variables on command line into %var + +$use_jar = 1; +$ZIP = "$ENV{JAVA_HOME}/bin/jar"; + +if ( $ENV{JAVA_HOME} eq "" ) { + $ZIP = "zip"; + $use_jar = 0; +} + + +&parse_argv; + + +######-- Do the packaging of jars. + +foreach $jarfile (split(/ /,$var{FILES}) ) { + print STDERR "---------------------------------------------\n"; + print STDERR "Packaging jar file $jarfile....\n"; + + $jarinfo = $var{$jarfile}; + + ($jardir,$jaropts) = split(/\|/,$jarinfo); + + if ( $use_jar ) { + $zipoptions = "-cvf"; + } else { + $zipoptions = "-T -r"; + if ($jaropts =~ /a/) { + if ($var{OS_ARCH} eq 'WINNT') { + $zipoptions .= ' -ll'; + } + } + } + +# just in case the directory ends in a /, remove it + if ($jardir =~ /\/$/) { + chop $jardir; + } + + $dirdepth --; + + print STDERR "jardir = $jardir\n"; + system("ls $jardir"); + + if (-d $jardir) { + + +# count the number of slashes + + $slashes =0; + + foreach $i (split(//,$jardir)) { + if ($i =~ /\//) { + $slashes++; + } + } + + $dotdots =0; + + foreach $i (split(m|/|,$jardir)) { + if ($i eq '..') { + $dotdots ++; + } + } + + $dirdepth = ($slashes +1) - (2*$dotdots); + + print STDERR "changing dir $jardir\n"; + chdir($jardir); + print STDERR "making dir META-INF\n"; + mkdir("META-INF",0755); + + $filelist = ""; + opendir(DIR,"."); + while ($_ = readdir(DIR)) { + if (! ( ($_ eq '.') || ($_ eq '..'))) { + if ( $jaropts =~ /i/) { + if (! /^include$/) { + $filelist .= "$_ "; + } + } + else { + $filelist .= "$_ "; + } + } + } + closedir(DIR); + + print STDERR "$ZIP $zipoptions $jarfile $filelist\n"; + system("$ZIP $zipoptions $jarfile $filelist"); + rmdir("META-INF"); + for $i (1 .. $dirdepth) { + chdir(".."); + print STDERR "chdir ..\n"; + } + } + else { + print STDERR "Directory $jardir doesn't exist\n"; + } + +} + diff --git a/mozilla/security/coreconf/rules.mk b/mozilla/security/coreconf/rules.mk new file mode 100644 index 0000000..01b4fc2 --- /dev/null +++ b/mozilla/security/coreconf/rules.mk @@ -0,0 +1,994 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +### ### +### R U L E S O F E N G A G E M E N T ### +### ### +####################################################################### + +####################################################################### +# Double-Colon rules for utilizing the binary release model. # +####################################################################### + +all:: export libs + +ifeq ($(AUTOCLEAN),1) +autobuild:: clean export private_export libs program install +else +autobuild:: export private_export libs program install +endif + +platform:: + @echo $(OBJDIR_NAME) + +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET))) +USE_NT_C_SYNTAX=1 +endif + +# +# IMPORTS will always be associated with a component. Therefore, +# the "import" rule will always change directory to the top-level +# of a component, and traverse the IMPORTS keyword from the +# "manifest.mn" file located at this level only. +# +# note: if there is a trailing slash, the component will be appended +# (see import.pl - only used for xpheader.jar) + +import:: + @echo "== import.pl ==" + @$(PERL) -I$(CORE_DEPTH)/coreconf $(CORE_DEPTH)/coreconf/import.pl \ + "RELEASE_TREE=$(RELEASE_TREE)" \ + "IMPORTS=$(IMPORTS)" \ + "VERSION=$(VERSION)" \ + "OS_ARCH=$(OS_ARCH)" \ + "PLATFORM=$(PLATFORM)" \ + "OVERRIDE_IMPORT_CHECK=$(OVERRIDE_IMPORT_CHECK)" \ + "ALLOW_VERSION_OVERRIDE=$(ALLOW_VERSION_OVERRIDE)" \ + "SOURCE_RELEASE_PREFIX=$(SOURCE_RELEASE_XP_DIR)" \ + "SOURCE_MD_DIR=$(SOURCE_MD_DIR)" \ + "SOURCE_XP_DIR=$(SOURCE_XP_DIR)" \ + "FILES=$(IMPORT_XPCLASS_JAR) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR)" \ + "$(IMPORT_XPCLASS_JAR)=$(IMPORT_XP_DIR)|$(IMPORT_XPCLASS_DIR)|" \ + "$(XPHEADER_JAR)=$(IMPORT_XP_DIR)|$(SOURCE_XP_DIR)/public/|v" \ + "$(MDHEADER_JAR)=$(IMPORT_MD_DIR)|$(SOURCE_MD_DIR)/include|" \ + "$(MDBINARY_JAR)=$(IMPORT_MD_DIR)|$(SOURCE_MD_DIR)|" +# On Mac OS X ranlib needs to be rerun after static libs are moved. +ifeq ($(OS_TARGET),Darwin) + find $(SOURCE_MD_DIR)/lib -name "*.a" -exec $(RANLIB) {} \; +endif + +export:: + +$(LOOP_OVER_DIRS) + +private_export:: + +$(LOOP_OVER_DIRS) + +release_export:: + +$(LOOP_OVER_DIRS) + +release_classes:: + +$(LOOP_OVER_DIRS) + +libs program install:: $(TARGETS) +ifdef LIBRARY + $(INSTALL) -m 664 $(LIBRARY) $(SOURCE_LIB_DIR) +endif +ifdef SHARED_LIBRARY + $(INSTALL) -m 775 $(SHARED_LIBRARY) $(SOURCE_LIB_DIR) +ifdef MOZ_DEBUG_SYMBOLS +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET))) + $(INSTALL) -m 644 $(SHARED_LIBRARY:$(DLL_SUFFIX)=pdb) $(SOURCE_LIB_DIR) +endif +endif +endif +ifdef IMPORT_LIBRARY + $(INSTALL) -m 775 $(IMPORT_LIBRARY) $(SOURCE_LIB_DIR) +endif +ifdef PROGRAM + $(INSTALL) -m 775 $(PROGRAM) $(SOURCE_BIN_DIR) +ifdef MOZ_DEBUG_SYMBOLS +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET))) + $(INSTALL) -m 644 $(PROGRAM:$(PROG_SUFFIX)=.pdb) $(SOURCE_BIN_DIR) +endif +endif +endif +ifdef PROGRAMS + $(INSTALL) -m 775 $(PROGRAMS) $(SOURCE_BIN_DIR) +endif + +$(LOOP_OVER_DIRS) + +tests:: + +$(LOOP_OVER_DIRS) + +clean clobber:: + rm -rf $(ALL_TRASH) + +$(LOOP_OVER_DIRS) + +realclean clobber_all:: + rm -rf $(wildcard *.OBJ) dist $(ALL_TRASH) + +$(LOOP_OVER_DIRS) + +####################################################################### +# Double-Colon rules for populating the binary release model. # +####################################################################### + + +release_clean:: + rm -rf $(SOURCE_XP_DIR)/release/$(RELEASE_MD_DIR) + +release:: release_clean release_export release_classes release_policy release_md release_jars release_cpdistdir + +release_cpdistdir:: + @echo "== cpdist.pl ==" + @$(PERL) -I$(CORE_DEPTH)/coreconf $(CORE_DEPTH)/coreconf/cpdist.pl \ + "RELEASE_TREE=$(RELEASE_TREE)" \ + "CORE_DEPTH=$(CORE_DEPTH)" \ + "MODULE=${MODULE}" \ + "OS_ARCH=$(OS_ARCH)" \ + "RELEASE=$(RELEASE)" \ + "PLATFORM=$(PLATFORM)" \ + "RELEASE_VERSION=$(RELEASE_VERSION)" \ + "SOURCE_RELEASE_PREFIX=$(SOURCE_RELEASE_XP_DIR)" \ + "RELEASE_XP_DIR=$(RELEASE_XP_DIR)" \ + "RELEASE_MD_DIR=$(RELEASE_MD_DIR)" \ + "FILES=$(XPCLASS_JAR) $(XPCLASS_DBG_JAR) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR) XP_FILES MD_FILES" \ + "$(XPCLASS_JAR)=$(SOURCE_RELEASE_CLASSES_DIR)|x"\ + "$(XPCLASS_DBG_JAR)=$(SOURCE_RELEASE_CLASSES_DBG_DIR)|x"\ + "$(XPHEADER_JAR)=$(SOURCE_RELEASE_XPHEADERS_DIR)|x" \ + "$(MDHEADER_JAR)=$(SOURCE_RELEASE_MDHEADERS_DIR)|m" \ + "$(MDBINARY_JAR)=$(SOURCE_RELEASE_MD_DIR)|m" \ + "XP_FILES=$(XP_FILES)|xf" \ + "MD_FILES=$(MD_FILES)|mf" + + +# $(SOURCE_RELEASE_xxx_JAR) is a name like yyy.jar +# $(SOURCE_RELEASE_xx_DIR) is a name like + +release_jars:: + @echo "== release.pl ==" + @$(PERL) -I$(CORE_DEPTH)/coreconf $(CORE_DEPTH)/coreconf/release.pl \ + "RELEASE_TREE=$(RELEASE_TREE)" \ + "PLATFORM=$(PLATFORM)" \ + "OS_ARCH=$(OS_ARCH)" \ + "RELEASE_VERSION=$(RELEASE_VERSION)" \ + "SOURCE_RELEASE_DIR=$(SOURCE_RELEASE_DIR)" \ + "FILES=$(XPCLASS_JAR) $(XPCLASS_DBG_JAR) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR)" \ + "$(XPCLASS_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DIR)|b"\ + "$(XPCLASS_DBG_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DBG_DIR)|b"\ + "$(XPHEADER_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_XPHEADERS_DIR)|a" \ + "$(MDHEADER_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_MDHEADERS_DIR)|a" \ + "$(MDBINARY_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_MD_DIR)|bi" + +# Rules for releasing classes. +# We have to do some REALLY gross stuff to deal with multiple classes in one +# file, as well as nested classes, which have a filename of the form +# ContainingClass$NestedClass.class. +# RELEASE_CLASSES simply performs a required patsubst on CLASSES +# RELEASE_CLASS_PATH is RELEASE_CLASSES with the path (in ns/dist) prepended +# RELEASE_NESTED is all the nested classes in RELEASE_CLASS_PATH. We use a +# foreach and wildcard to get all the files that start out like one of the +# class files, then have a $. So, for each class file, we look for file$* +# RELEASE_FILES is the combination of RELEASE_NESTED and the class files +# specified by RELEASE_CLASSES which have .class appended to them. Note that +# the RELEASE_NESTED don't need to have .class appended because they were +# read in from the wildcard as complete filenames. +# +# The _DBG versions are the debuggable ones. +ifneq ($(CLASSES),) + +RELEASE_CLASSES := $(patsubst %,%,$(CLASSES)) + +ifdef BUILD_OPT + RELEASE_CLASS_PATH := $(patsubst %,$(SOURCE_CLASSES_DIR)/$(PACKAGE)/%, $(RELEASE_CLASSES)) + RELEASE_NESTED := $(foreach file,$(RELEASE_CLASS_PATH),$(wildcard $(file)$$*)) + RELEASE_FILES := $(patsubst %,%.class,$(RELEASE_CLASS_PATH)) $(RELEASE_NESTED) +else + RELEASE_DBG_CLASS_PATH:= $(patsubst %,$(SOURCE_CLASSES_DBG_DIR)/$(PACKAGE)/%, $(RELEASE_CLASSES)) + RELEASE_DBG_NESTED := $(foreach file,$(RELEASE_DBG_CLASS_PATH),$(wildcard $(file)$$*)) + RELEASE_DBG_FILES := $(patsubst %,%.class,$(RELEASE_DBG_CLASS_PATH)) $(RELEASE_DBG_NESTED) +endif + +# Substitute \$ for $ so the shell doesn't choke +ifdef BUILD_OPT +release_classes:: + $(INSTALL) -m 444 $(subst $$,\$$,$(RELEASE_FILES)) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DIR)/$(PACKAGE) +else +release_classes:: + $(INSTALL) -m 444 $(subst $$,\$$,$(RELEASE_DBG_FILES)) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DBG_DIR)/$(PACKAGE) +endif + +endif + +release_policy:: + +$(LOOP_OVER_DIRS) + +ifndef NO_MD_RELEASE + ifdef LIBRARY + MD_LIB_RELEASE_FILES += $(LIBRARY) + endif + ifdef SHARED_LIBRARY + MD_LIB_RELEASE_FILES += $(SHARED_LIBRARY) + endif + ifdef IMPORT_LIBRARY + MD_LIB_RELEASE_FILES += $(IMPORT_LIBRARY) + endif + ifdef PROGRAM + MD_BIN_RELEASE_FILES += $(PROGRAM) + endif + ifdef PROGRAMS + MD_BIN_RELEASE_FILES += $(PROGRAMS) + endif +endif + +release_md:: +ifneq ($(MD_LIB_RELEASE_FILES),) + $(INSTALL) -m 444 $(MD_LIB_RELEASE_FILES) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR) +endif +ifneq ($(MD_BIN_RELEASE_FILES),) + $(INSTALL) -m 555 $(MD_BIN_RELEASE_FILES) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_BIN_DIR) +endif + +$(LOOP_OVER_DIRS) + + +alltags: + rm -f TAGS + find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs etags -a + find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs ctags -a + +$(PROGRAM): $(OBJS) $(EXTRA_LIBS) + @$(MAKE_OBJDIR) +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET))) + $(MKPROG) $(subst /,\\,$(OBJS)) -Fe$@ -link $(LDFLAGS) $(subst /,\\,$(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)) $(EXTRA_EXE_LD_FLAGS) +ifdef MT + if test -f $@.manifest; then \ + $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \ + rm -f $@.manifest; \ + fi +endif # MSVC with manifest tool +else + $(MKPROG) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) +endif + +get_objs: + @echo $(OBJS) + +$(LIBRARY): $(OBJS) + @$(MAKE_OBJDIR) + rm -f $@ +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET))) + $(AR) $(subst /,\\,$(OBJS)) +else + $(AR) $(OBJS) +endif + $(RANLIB) $@ + + +ifeq ($(OS_TARGET),OS2) +$(IMPORT_LIBRARY): $(MAPFILE) + rm -f $@ + $(IMPLIB) $@ $< + $(RANLIB) $@ +endif + +ifdef SHARED_LIBRARY_LIBS +ifdef BUILD_TREE +SUB_SHLOBJS = $(foreach dir,$(SHARED_LIBRARY_DIRS),$(shell $(MAKE) -C $(dir) --no-print-directory get_objs)) +else +SUB_SHLOBJS = $(foreach dir,$(SHARED_LIBRARY_DIRS),$(addprefix $(dir)/,$(shell $(MAKE) -C $(dir) --no-print-directory get_objs))) +endif +endif + +$(SHARED_LIBRARY): $(OBJS) $(RES) $(MAPFILE) $(SUB_SHLOBJS) + @$(MAKE_OBJDIR) + rm -f $@ +ifeq ($(OS_TARGET)$(OS_RELEASE), AIX4.1) + echo "#!" > $(OBJDIR)/lib$(LIBRARY_NAME)_syms + nm -B -C -g $(OBJS) \ + | awk '/ [T,D] / {print $$3}' \ + | sed -e 's/^\.//' \ + | sort -u >> $(OBJDIR)/lib$(LIBRARY_NAME)_syms + $(LD) $(XCFLAGS) -o $@ $(OBJS) -bE:$(OBJDIR)/lib$(LIBRARY_NAME)_syms \ + -bM:SRE -bnoentry $(OS_LIBS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) +else +ifeq (,$(filter-out WIN%,$(OS_TARGET))) +ifdef NS_USE_GCC + $(LINK_DLL) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES) +else + $(LINK_DLL) -MAP $(DLLBASE) $(subst /,\\,$(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)) +ifdef MT + if test -f $@.manifest; then \ + $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \ + rm -f $@.manifest; \ + fi +endif # MSVC with manifest tool +endif +else + $(MKSHLIB) -o $@ $(OBJS) $(SUB_SHLOBJS) $(LD_LIBS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) + chmod +x $@ +ifeq ($(OS_TARGET),Darwin) +ifdef MAPFILE + nmedit -s $(MAPFILE) $@ +endif +endif +endif +endif + +ifeq (,$(filter-out WIN%,$(OS_TARGET))) +$(RES): $(RESNAME) + @$(MAKE_OBJDIR) +# The resource compiler does not understand the -U option. +ifdef NS_USE_GCC + $(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $< +else + $(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $< +endif + @echo $(RES) finished +endif + +$(MAPFILE): $(MAPFILE_SOURCE) + @$(MAKE_OBJDIR) + $(PROCESS_MAP_FILE) + + +$(OBJDIR)/$(PROG_PREFIX)%$(PROG_SUFFIX): $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX) + @$(MAKE_OBJDIR) +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET))) + $(MKPROG) $< -Fe$@ -link \ + $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(EXTRA_EXE_LD_FLAGS) +ifdef MT + if test -f $@.manifest; then \ + $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \ + rm -f $@.manifest; \ + fi +endif # MSVC with manifest tool +else + $(MKPROG) -o $@ $(CFLAGS) $< \ + $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) +endif + +WCCFLAGS1 := $(subst /,\\,$(CFLAGS)) +WCCFLAGS2 := $(subst -I,-i=,$(WCCFLAGS1)) +WCCFLAGS3 := $(subst -D,-d,$(WCCFLAGS2)) + +# Translate source filenames to absolute paths. This is required for +# debuggers under Windows & OS/2 to find source files automatically + +ifeq (,$(filter-out OS2 AIX,$(OS_TARGET))) +# OS/2 and AIX +NEED_ABSOLUTE_PATH := 1 +PWD := $(shell pwd) + +else +# Windows +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET))) +NEED_ABSOLUTE_PATH := 1 +PWD := $(shell pwd) +ifeq (,$(findstring ;,$(PATH))) +ifndef USE_MSYS +PWD := $(subst \,/,$(shell cygpath -w $(PWD))) +endif +endif + +else +# everything else +PWD := $(shell pwd) +endif +endif + +# The quotes allow absolute paths to contain spaces. +core_abspath = "$(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))" + +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c + @$(MAKE_OBJDIR) +ifdef USE_NT_C_SYNTAX + $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<) +else +ifdef NEED_ABSOLUTE_PATH + $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<) +else + $(CC) -o $@ -c $(CFLAGS) $< +endif +endif + +$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c +ifdef USE_NT_C_SYNTAX + $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<) +else +ifdef NEED_ABSOLUTE_PATH + $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<) +else + $(CC) -o $@ -c $(CFLAGS) $< +endif +endif + +ifneq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET))) +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.s + @$(MAKE_OBJDIR) + $(AS) -o $@ $(ASFLAGS) -c $< +endif + +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.asm + @$(MAKE_OBJDIR) + $(AS) -Fo$@ $(ASFLAGS) -c $< + +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.S + @$(MAKE_OBJDIR) + $(AS) -o $@ $(ASFLAGS) -c $< + +$(OBJDIR)/$(PROG_PREFIX)%: %.cpp + @$(MAKE_OBJDIR) +ifdef USE_NT_C_SYNTAX + $(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<) +else +ifdef NEED_ABSOLUTE_PATH + $(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<) +else + $(CCC) -o $@ -c $(CFLAGS) $< +endif +endif + +# +# Please keep the next two rules in sync. +# +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.cc + @$(MAKE_OBJDIR) + $(CCC) -o $@ -c $(CFLAGS) $< + +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.cpp + @$(MAKE_OBJDIR) +ifdef STRICT_CPLUSPLUS_SUFFIX + echo "#line 1 \"$<\"" | cat - $< > $(OBJDIR)/t_$*.cc + $(CCC) -o $@ -c $(CFLAGS) $(OBJDIR)/t_$*.cc + rm -f $(OBJDIR)/t_$*.cc +else +ifdef USE_NT_C_SYNTAX + $(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<) +else +ifdef NEED_ABSOLUTE_PATH + $(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<) +else + $(CCC) -o $@ -c $(CFLAGS) $< +endif +endif +endif #STRICT_CPLUSPLUS_SUFFIX + +%.i: %.cpp + $(CCC) -C -E $(CFLAGS) $< > $@ + +%.i: %.c +ifeq (,$(filter-out WIN%,$(OS_TARGET))) + $(CC) -C /P $(CFLAGS) $< +else + $(CC) -C -E $(CFLAGS) $< > $@ +endif + +ifneq (,$(filter-out WIN%,$(OS_TARGET))) +%.i: %.s + $(CC) -C -E $(CFLAGS) $< > $@ +endif + +%: %.pl + rm -f $@; cp $< $@; chmod +x $@ + +%: %.sh + rm -f $@; cp $< $@; chmod +x $@ + +ifdef DIRS +$(DIRS):: + @if test -d $@; then \ + set $(EXIT_ON_ERROR); \ + echo "cd $@; $(MAKE)"; \ + cd $@; $(MAKE); \ + set +e; \ + else \ + echo "Skipping non-directory $@..."; \ + fi; \ + $(CLICK_STOPWATCH) +endif + +################################################################################ +# Bunch of things that extend the 'export' rule (in order): +################################################################################ + +$(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE) $(JMCSRCDIR):: + @if test ! -d $@; then \ + echo Creating $@; \ + rm -rf $@; \ + $(NSINSTALL) -D $@; \ + fi + +################################################################################ +## IDL_GEN + +ifneq ($(IDL_GEN),) + +#export:: +# $(IDL2JAVA) $(IDL_GEN) + +#all:: export + +#clobber:: +# rm -f $(IDL_GEN:.idl=.class) # XXX wrong! + +endif + +################################################################################ +### JSRCS -- for compiling java files +### +### NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined, +### replace $(CORE_DEPTH) with $(NETLIBDEPTH). +### + +ifneq ($(JSRCS),) +ifneq ($(JAVAC),) +ifdef NETLIBDEPTH + CORE_DEPTH := $(NETLIBDEPTH) +endif + +JAVA_EXPORT_SRCS=$(shell $(PERL) $(CORE_DEPTH)/coreconf/outofdate.pl $(PERLARG) -d $(JAVA_DESTPATH)/$(PACKAGE) $(JSRCS) $(PRIVATE_JSRCS)) + +export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE) +ifneq ($(JAVA_EXPORT_SRCS),) + $(JAVAC) $(JAVA_EXPORT_SRCS) +endif + +all:: export + +clobber:: + rm -f $(SOURCE_XP_DIR)/classes/$(PACKAGE)/*.class + +endif +endif + +# +# JDIRS -- like JSRCS, except you can give a list of directories and it will +# compile all the out-of-date java files in those directories. +# +# NOTE: recursing through these can speed things up, but they also cause +# some builds to run out of memory +# +# NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined, +# replace $(CORE_DEPTH) with $(NETLIBDEPTH). +# +ifdef JDIRS +ifneq ($(JAVAC),) +ifdef NETLIBDEPTH + CORE_DEPTH := $(NETLIBDEPTH) +endif + +# !!!!! THIS WILL CRASH SHMSDOS.EXE !!!!! +# shmsdos does not support shell variables. It will crash when it tries +# to parse the '=' character. A solution is to rewrite outofdate.pl so it +# takes the Javac command as an argument and executes the command itself, +# instead of returning a list of files. +export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE) + @echo "!!! THIS COMMAND IS BROKEN ON WINDOWS--SEE rules.mk FOR DETAILS !!!" + return -1 + @for d in $(JDIRS); do \ + if test -d $$d; then \ + set $(EXIT_ON_ERROR); \ + files=`echo $$d/*.java`; \ + list=`$(PERL) $(CORE_DEPTH)/coreconf/outofdate.pl $(PERLARG) \ + -d $(JAVA_DESTPATH)/$(PACKAGE) $$files`; \ + if test "$${list}x" != "x"; then \ + echo Building all java files in $$d; \ + echo $(JAVAC) $$list; \ + $(JAVAC) $$list; \ + fi; \ + set +e; \ + else \ + echo "Skipping non-directory $$d..."; \ + fi; \ + $(CLICK_STOPWATCH); \ + done +endif +endif + +# +# JDK_GEN -- for generating "old style" native methods +# +# Generate JDK Headers and Stubs into the '_gen' and '_stubs' directory +# +# NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined, +# replace $(CORE_DEPTH) with $(NETLIBDEPTH). +# +ifneq ($(JDK_GEN),) +ifneq ($(JAVAH),) +ifdef NSBUILDROOT + INCLUDES += -I$(JDK_GEN_DIR) -I$(SOURCE_XP_DIR) +else + INCLUDES += -I$(JDK_GEN_DIR) +endif + +ifdef NETLIBDEPTH + CORE_DEPTH := $(NETLIBDEPTH) +endif + +JDK_PACKAGE_CLASSES := $(JDK_GEN) +JDK_PATH_CLASSES := $(subst .,/,$(JDK_PACKAGE_CLASSES)) +JDK_HEADER_CLASSFILES := $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JDK_PATH_CLASSES)) +JDK_STUB_CLASSFILES := $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JDK_PATH_CLASSES)) +JDK_HEADER_CFILES := $(patsubst %,$(JDK_GEN_DIR)/%.h,$(JDK_GEN)) +JDK_STUB_CFILES := $(patsubst %,$(JDK_STUB_DIR)/%.c,$(JDK_GEN)) + +$(JDK_HEADER_CFILES): $(JDK_HEADER_CLASSFILES) +$(JDK_STUB_CFILES): $(JDK_STUB_CLASSFILES) + +export:: + @echo Generating/Updating JDK headers + $(JAVAH) -d $(JDK_GEN_DIR) $(JDK_PACKAGE_CLASSES) + @echo Generating/Updating JDK stubs + $(JAVAH) -stubs -d $(JDK_STUB_DIR) $(JDK_PACKAGE_CLASSES) +ifndef NO_MAC_JAVA_SHIT + @if test ! -d $(CORE_DEPTH)/lib/mac/Java/; then \ + echo "!!! You need to have a ns/lib/mac/Java directory checked out."; \ + echo "!!! This allows us to automatically update generated files for the mac."; \ + echo "!!! If you see any modified files there, please check them in."; \ + fi + @echo Generating/Updating JDK headers for the Mac + $(JAVAH) -mac -d $(CORE_DEPTH)/lib/mac/Java/_gen $(JDK_PACKAGE_CLASSES) + @echo Generating/Updating JDK stubs for the Mac + $(JAVAH) -mac -stubs -d $(CORE_DEPTH)/lib/mac/Java/_stubs $(JDK_PACKAGE_CLASSES) +endif +endif +endif + +# +# JRI_GEN -- for generating "old style" JRI native methods +# +# Generate JRI Headers and Stubs into the 'jri' directory +# +# NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined, +# replace $(CORE_DEPTH) with $(NETLIBDEPTH). +# +ifneq ($(JRI_GEN),) +ifneq ($(JAVAH),) +ifdef NSBUILDROOT + INCLUDES += -I$(JRI_GEN_DIR) -I$(SOURCE_XP_DIR) +else + INCLUDES += -I$(JRI_GEN_DIR) +endif + +ifdef NETLIBDEPTH + CORE_DEPTH := $(NETLIBDEPTH) +endif + +JRI_PACKAGE_CLASSES := $(JRI_GEN) +JRI_PATH_CLASSES := $(subst .,/,$(JRI_PACKAGE_CLASSES)) +JRI_HEADER_CLASSFILES := $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JRI_PATH_CLASSES)) +JRI_STUB_CLASSFILES := $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JRI_PATH_CLASSES)) +JRI_HEADER_CFILES := $(patsubst %,$(JRI_GEN_DIR)/%.h,$(JRI_GEN)) +JRI_STUB_CFILES := $(patsubst %,$(JRI_GEN_DIR)/%.c,$(JRI_GEN)) + +$(JRI_HEADER_CFILES): $(JRI_HEADER_CLASSFILES) +$(JRI_STUB_CFILES): $(JRI_STUB_CLASSFILES) + +export:: + @echo Generating/Updating JRI headers + $(JAVAH) -jri -d $(JRI_GEN_DIR) $(JRI_PACKAGE_CLASSES) + @echo Generating/Updating JRI stubs + $(JAVAH) -jri -stubs -d $(JRI_GEN_DIR) $(JRI_PACKAGE_CLASSES) +ifndef NO_MAC_JAVA_SHIT + @if test ! -d $(CORE_DEPTH)/lib/mac/Java/; then \ + echo "!!! You need to have a ns/lib/mac/Java directory checked out."; \ + echo "!!! This allows us to automatically update generated files for the mac."; \ + echo "!!! If you see any modified files there, please check them in."; \ + fi + @echo Generating/Updating JRI headers for the Mac + $(JAVAH) -jri -mac -d $(CORE_DEPTH)/lib/mac/Java/_jri $(JRI_PACKAGE_CLASSES) + @echo Generating/Updating JRI stubs for the Mac + $(JAVAH) -jri -mac -stubs -d $(CORE_DEPTH)/lib/mac/Java/_jri $(JRI_PACKAGE_CLASSES) +endif +endif +endif + +# +# JNI_GEN -- for generating JNI native methods +# +# Generate JNI Headers into the 'jni' directory +# +ifneq ($(JNI_GEN),) +ifneq ($(JAVAH),) +JNI_HEADERS := $(patsubst %,$(JNI_GEN_DIR)/%.h,$(JNI_GEN)) + +export:: + @if test ! -d $(JNI_GEN_DIR); then \ + echo $(JAVAH) -jni -d $(JNI_GEN_DIR) $(JNI_GEN); \ + $(JAVAH) -jni -d $(JNI_GEN_DIR) $(JNI_GEN); \ + else \ + echo "Checking for out of date header files" ; \ + $(PERL) $(CORE_DEPTH)/coreconf/jniregen.pl $(PERLARG) \ + -d $(JAVA_DESTPATH) -j "$(JAVAH) -jni -d $(JNI_GEN_DIR)" $(JNI_GEN);\ + fi +endif +endif + +# +# JMC_EXPORT -- for declaring which java classes are to be exported for jmc +# +ifneq ($(JMC_EXPORT),) +JMC_EXPORT_PATHS := $(subst .,/,$(JMC_EXPORT)) +JMC_EXPORT_FILES := $(patsubst %,$(JAVA_DESTPATH)/$(PACKAGE)/%.class,$(JMC_EXPORT_PATHS)) + +# +# We're doing NSINSTALL -t here (copy mode) because calling INSTALL will pick up +# your NSDISTMODE and make links relative to the current directory. This is a +# problem because the source isn't in the current directory: +# +export:: $(JMC_EXPORT_FILES) $(JMCSRCDIR) + $(NSINSTALL) -t -m 444 $(JMC_EXPORT_FILES) $(JMCSRCDIR) +endif + +# +# JMC_GEN -- for generating java modules +# +# Provide default export & install rules when using JMC_GEN +# +ifneq ($(JMC_GEN),) +ifneq ($(JMC),) + INCLUDES += -I$(JMC_GEN_DIR) -I. + JMC_HEADERS := $(patsubst %,$(JMC_GEN_DIR)/%.h,$(JMC_GEN)) + JMC_STUBS := $(patsubst %,$(JMC_GEN_DIR)/%.c,$(JMC_GEN)) + JMC_OBJS := $(patsubst %,$(OBJDIR)/%$(OBJ_SUFFIX),$(JMC_GEN)) + +$(JMC_GEN_DIR)/M%.h: $(JMCSRCDIR)/%.class + $(JMC) -d $(JMC_GEN_DIR) -interface $(JMC_GEN_FLAGS) $(?F:.class=) + +$(JMC_GEN_DIR)/M%.c: $(JMCSRCDIR)/%.class + $(JMC) -d $(JMC_GEN_DIR) -module $(JMC_GEN_FLAGS) $(?F:.class=) + +$(OBJDIR)/M%$(OBJ_SUFFIX): $(JMC_GEN_DIR)/M%.c $(JMC_GEN_DIR)/M%.h + @$(MAKE_OBJDIR) + $(CC) -o $@ -c $(CFLAGS) $< + +export:: $(JMC_HEADERS) $(JMC_STUBS) +endif +endif + +# +# Copy each element of EXPORTS to $(SOURCE_XP_DIR)/public/$(MODULE)/ +# +PUBLIC_EXPORT_DIR = $(SOURCE_XP_DIR)/public/$(MODULE) + +ifneq ($(EXPORTS),) +$(PUBLIC_EXPORT_DIR):: + @if test ! -d $@; then \ + echo Creating $@; \ + $(NSINSTALL) -D $@; \ + fi + +export:: $(PUBLIC_EXPORT_DIR) + +export:: $(EXPORTS) + $(INSTALL) -m 444 $^ $(PUBLIC_EXPORT_DIR) + +export:: $(BUILT_SRCS) +endif + +# Duplicate export rule for private exports, with different directories + +PRIVATE_EXPORT_DIR = $(SOURCE_XP_DIR)/private/$(MODULE) + +ifneq ($(PRIVATE_EXPORTS),) +$(PRIVATE_EXPORT_DIR):: + @if test ! -d $@; then \ + echo Creating $@; \ + $(NSINSTALL) -D $@; \ + fi + +private_export:: $(PRIVATE_EXPORT_DIR) + +private_export:: $(PRIVATE_EXPORTS) + $(INSTALL) -m 444 $^ $(PRIVATE_EXPORT_DIR) +else +private_export:: + @echo There are no private exports.; +endif + +########################################################################## +### RULES FOR RUNNING REGRESSION SUITE TESTS +### REQUIRES 'REGRESSION_SPEC' TO BE SET TO THE NAME OF A REGRESSION SPECFILE +### AND RESULTS_SUBDIR TO BE SET TO SOMETHING LIKE SECURITY/PKCS5 +########################################################################## + +TESTS_DIR = $(RESULTS_DIR)/$(RESULTS_SUBDIR)/$(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(IMPL_STRATEGY) + +ifneq ($(REGRESSION_SPEC),) + +ifneq ($(BUILD_OPT),) +REGDATE = $(subst \ ,, $(shell $(PERL) $(CORE_DEPTH)/$(MODULE)/scripts/now)) +endif + +tests:: $(REGRESSION_SPEC) + cd $(PLATFORM); \ + ../$(SOURCE_MD_DIR)/bin/regress$(PROG_SUFFIX) specfile=../$(REGRESSION_SPEC) progress $(EXTRA_REGRESS_OPTIONS); \ + if test ! -d $(TESTS_DIR); then \ + echo Creating $(TESTS_DIR); \ + $(NSINSTALL) -D $(TESTS_DIR); \ + fi +ifneq ($(BUILD_OPT),) + $(NSINSTALL) -m 664 $(PLATFORM)/$(REGDATE).sum $(TESTS_DIR); \ + $(NSINSTALL) -m 664 $(PLATFORM)/$(REGDATE).htm $(TESTS_DIR); \ + echo "Please now make sure your results files are copied to $(TESTS_DIR), "; \ + echo "then run 'reporter specfile=$(RESULTS_DIR)/rptspec'" +endif +else +tests:: + @echo Error: you didn't specify REGRESSION_SPEC in your manifest.mn file!; +endif + + +# Duplicate export rule for releases, with different directories + +ifneq ($(EXPORTS),) +$(SOURCE_RELEASE_XP_DIR)/include:: + @if test ! -d $@; then \ + echo Creating $@; \ + $(NSINSTALL) -D $@; \ + fi + +release_export:: $(SOURCE_RELEASE_XP_DIR)/include + +release_export:: $(EXPORTS) + $(INSTALL) -m 444 $^ $(SOURCE_RELEASE_XP_DIR)/include +endif + + + + +################################################################################ + +-include $(DEPENDENCIES) + +ifneq (,$(filter-out OS2 WIN%,$(OS_TARGET))) +# Can't use sed because of its 4000-char line length limit, so resort to perl +PERL_DEPENDENCIES_PROGRAM = \ + open(MD, "< $(DEPENDENCIES)"); \ + while () { \ + if (m@ \.*/*$< @) { \ + $$found = 1; \ + last; \ + } \ + } \ + if ($$found) { \ + print "Removing stale dependency $< from $(DEPENDENCIES)\n"; \ + seek(MD, 0, 0); \ + $$tmpname = "$(OBJDIR)/fix.md" . $$$$; \ + open(TMD, "> " . $$tmpname); \ + while () { \ + s@ \.*/*$< @ @; \ + if (!print TMD "$$_") { \ + unlink(($$tmpname)); \ + exit(1); \ + } \ + } \ + close(TMD); \ + if (!rename($$tmpname, "$(DEPENDENCIES)")) { \ + unlink(($$tmpname)); \ + } \ + } elsif ("$<" ne "$(DEPENDENCIES)") { \ + print "$(MAKE): *** No rule to make target $<. Stop.\n"; \ + exit(1); \ + } + +.DEFAULT: + @$(PERL) -e '$(PERL_DEPENDENCIES_PROGRAM)' +endif + +############################################################################# +# X dependency system +############################################################################# + +ifdef MKDEPENDENCIES + +# For Windows, $(MKDEPENDENCIES) must be -included before including rules.mk + +$(MKDEPENDENCIES):: + @$(MAKE_OBJDIR) + touch $(MKDEPENDENCIES) + chmod u+w $(MKDEPENDENCIES) +#on NT, the preceding touch command creates a read-only file !?!?! +#which is why we have to explicitly chmod it. + $(MKDEPEND) -p$(OBJDIR_NAME)/ -o'$(OBJ_SUFFIX)' -f$(MKDEPENDENCIES) \ +$(NOMD_CFLAGS) $(YOPT) $(CSRCS) $(CPPSRCS) $(ASFILES) + +$(MKDEPEND):: $(MKDEPEND_DIR)/*.c $(MKDEPEND_DIR)/*.h + cd $(MKDEPEND_DIR); $(MAKE) + +ifdef OBJS +depend:: $(MKDEPEND) $(MKDEPENDENCIES) +else +depend:: +endif + +$(LOOP_OVER_DIRS) + +dependclean:: + rm -f $(MKDEPENDENCIES) + +$(LOOP_OVER_DIRS) + +#-include $(NSINSTALL_DIR)/$(OBJDIR)/depend.mk + +else +depend:: +endif + +# +# HACK ALERT +# +# The only purpose of this rule is to pass Mozilla's Tinderbox depend +# builds (http://tinderbox.mozilla.org/showbuilds.cgi). Mozilla's +# Tinderbox builds NSS continuously as part of the Mozilla client. +# Because NSS's make depend is not implemented, whenever we change +# an NSS header file, the depend build does not recompile the NSS +# files that depend on the header. +# +# This rule makes all the objects depend on a dummy header file. +# Check in a change to this dummy header file to force the depend +# build to recompile everything. +# +# This rule should be removed when make depend is implemented. +# + +DUMMY_DEPEND = $(CORE_DEPTH)/coreconf/coreconf.dep + +$(filter $(OBJDIR)/%$(OBJ_SUFFIX),$(OBJS)): $(OBJDIR)/%$(OBJ_SUFFIX): $(DUMMY_DEPEND) + +# END OF HACK + +################################################################################ +# Special gmake rules. +################################################################################ + +# +# Re-define the list of default suffixes, so gmake won't have to churn through +# hundreds of built-in suffix rules for stuff we don't need. +# +.SUFFIXES: +.SUFFIXES: .out .a .ln .o .obj .c .cc .C .cpp .y .l .s .S .h .sh .i .pl .class .java .html .asm .dep + +# +# Don't delete these files if we get killed. +# +.PRECIOUS: .java $(JDK_HEADERS) $(JDK_STUBS) $(JRI_HEADERS) $(JRI_STUBS) $(JMC_HEADERS) $(JMC_STUBS) $(JNI_HEADERS) + +# +# Fake targets. Always run these rules, even if a file/directory with that +# name already exists. +# +.PHONY: all all_platforms alltags boot clean clobber clobber_all export install libs program realclean release $(OBJDIR) $(DIRS) + diff --git a/mozilla/security/coreconf/ruleset.mk b/mozilla/security/coreconf/ruleset.mk new file mode 100644 index 0000000..c083378 --- /dev/null +++ b/mozilla/security/coreconf/ruleset.mk @@ -0,0 +1,250 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# # +# Parameters to this makefile (set these in this file): # +# # +# a) # +# TARGETS -- the target to create # +# (defaults to $LIBRARY $PROGRAM) # +# b) # +# DIRS -- subdirectories for make to recurse on # +# (the 'all' rule builds $TARGETS $DIRS) # +# c) # +# CSRCS, CPPSRCS -- .c and .cpp files to compile # +# (used to define $OBJS) # +# d) # +# PROGRAM -- the target program name to create from $OBJS # +# ($OBJDIR automatically prepended to it) # +# e) # +# LIBRARY -- the target library name to create from $OBJS # +# ($OBJDIR automatically prepended to it) # +# f) # +# JSRCS -- java source files to compile into class files # +# (if you don't specify this it will default # +# to *.java) # +# g) # +# PACKAGE -- the package to put the .class files into # +# (e.g. netscape/applet) # +# (NOTE: the default definition for this may be # +# overridden if "jdk.mk" is included) # +# h) # +# JMC_EXPORT -- java files to be exported for use by JMC_GEN # +# (this is a list of Class names) # +# i) # +# JRI_GEN -- files to run through javah to generate headers # +# and stubs # +# (output goes into the _jri sub-dir) # +# j) # +# JMC_GEN -- files to run through jmc to generate headers # +# and stubs # +# (output goes into the _jmc sub-dir) # +# k) # +# JNI_GEN -- files to run through javah to generate headers # +# (output goes into the _jni sub-dir) # +# # +####################################################################### + +# +# CPU_TAG is now defined in the $(TARGET).mk files +# + +ifndef COMPILER_TAG + ifneq ($(DEFAULT_COMPILER), $(notdir $(firstword $(CC)))) +# +# Temporary define for the Client; to be removed when binary release is used +# + ifdef MOZILLA_CLIENT + COMPILER_TAG = + else + COMPILER_TAG = _$(notdir $(firstword $(CC))) + endif + else + COMPILER_TAG = + endif +endif + +ifeq ($(MKPROG),) + MKPROG = $(CC) +endif + +# +# This makefile contains rules for building the following kinds of +# objects: +# - (1) LIBRARY: a static (archival) library +# - (2) SHARED_LIBRARY: a shared (dynamic link) library +# - (3) IMPORT_LIBRARY: an import library, defined in $(OS_TARGET).mk +# - (4) PROGRAM: an executable binary +# +# NOTE: The names of libraries can be generated by simply specifying +# LIBRARY_NAME (and LIBRARY_VERSION in the case of non-static libraries). +# LIBRARY and SHARED_LIBRARY may be defined differently in $(OS_TARGET).mk +# + +ifdef LIBRARY_NAME + ifndef LIBRARY + LIBRARY = $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX) + endif + ifndef SHARED_LIBRARY + SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(JDK_DEBUG_SUFFIX).$(DLL_SUFFIX) + endif + ifndef MAPFILE_SOURCE + MAPFILE_SOURCE = $(LIBRARY_NAME).def + endif +endif + +# +# Common rules used by lots of makefiles... +# + +ifdef PROGRAM + PROGRAM := $(addprefix $(OBJDIR)/, $(PROGRAM)$(JDK_DEBUG_SUFFIX)$(PROG_SUFFIX)) +endif + +ifdef PROGRAMS + PROGRAMS := $(addprefix $(OBJDIR)/, $(PROGRAMS:%=%$(JDK_DEBUG_SUFFIX)$(PROG_SUFFIX))) +endif + +ifndef TARGETS + TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) +endif + +ifndef OBJS + SIMPLE_OBJS = $(JRI_STUB_CFILES) \ + $(addsuffix $(OBJ_SUFFIX), $(JMC_GEN)) \ + $(CSRCS:.c=$(OBJ_SUFFIX)) \ + $(CPPSRCS:.cpp=$(OBJ_SUFFIX)) \ + $(ASFILES:$(ASM_SUFFIX)=$(OBJ_SUFFIX)) \ + $(BUILT_CSRCS:.c=$(OBJ_SUFFIX)) \ + $(BUILT_CPPSRCS:.cpp=$(OBJ_SUFFIX)) \ + $(BUILT_ASFILES:$(ASM_SUFFIX)=$(OBJ_SUFFIX)) + OBJS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(SIMPLE_OBJS)) +endif + +ifndef BUILT_SRCS + BUILT_SRCS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), \ + $(BUILT_CSRCS) $(BUILT_CPPSRCS) $(BUILT_ASFILES)) +endif + + +ifeq (,$(filter-out WIN%,$(OS_TARGET))) + MAKE_OBJDIR = $(INSTALL) -D $(OBJDIR) +else + define MAKE_OBJDIR + if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi + endef +endif + +ifndef PACKAGE + PACKAGE = . +endif + +ifdef NSBUILDROOT + JDK_GEN_DIR = $(SOURCE_XP_DIR)/_gen + JMC_GEN_DIR = $(SOURCE_XP_DIR)/_jmc + JNI_GEN_DIR = $(SOURCE_XP_DIR)/_jni + JRI_GEN_DIR = $(SOURCE_XP_DIR)/_jri + JDK_STUB_DIR = $(SOURCE_XP_DIR)/_stubs +else + JDK_GEN_DIR = _gen + JMC_GEN_DIR = _jmc + JNI_GEN_DIR = _jni + JRI_GEN_DIR = _jri + JDK_STUB_DIR = _stubs +endif + +ALL_TRASH = $(TARGETS) $(OBJS) $(OBJDIR) LOGS TAGS $(GARBAGE) \ + so_locations $(BUILT_SRCS) $(NOSUCHFILE) + +ifdef NS_USE_JDK + ALL_TRASH += $(JDK_HEADER_CFILES) $(JDK_STUB_CFILES) \ + $(JMC_HEADERS) $(JMC_STUBS) $(JMC_EXPORT_FILES) \ + $(JNI_HEADERS) \ + $(JRI_HEADER_CFILES) $(JRI_STUB_CFILES) \ + $(JDK_GEN_DIR) $(JMC_GEN_DIR) $(JNI_GEN_DIR) \ + $(JRI_GEN_DIR) $(JDK_STUB_DIR) + +ifdef JAVA_DESTPATH + ALL_TRASH += $(wildcard $(JAVA_DESTPATH)/$(PACKAGE)/*.class) +ifdef JDIRS + ALL_TRASH += $(addprefix $(JAVA_DESTPATH)/,$(JDIRS)) +endif +else # !JAVA_DESTPATH + ALL_TRASH += $(wildcard $(PACKAGE)/*.class) $(JDIRS) +endif + +endif #NS_USE_JDK + +ifdef NSS_BUILD_CONTINUE_ON_ERROR +# Try to build everything. I.e., don't exit on errors. + EXIT_ON_ERROR = +e + CLICK_STOPWATCH = date +else + EXIT_ON_ERROR = -e + CLICK_STOPWATCH = true +endif + +ifdef REQUIRES + MODULE_INCLUDES := $(addprefix -I$(SOURCE_XP_DIR)/public/, $(REQUIRES)) + INCLUDES += $(MODULE_INCLUDES) + ifeq ($(MODULE), sectools) + PRIVATE_INCLUDES := $(addprefix -I$(SOURCE_XP_DIR)/private/, $(REQUIRES)) + INCLUDES += $(PRIVATE_INCLUDES) + endif +endif + +ifdef SYSTEM_INCL_DIR + YOPT = -Y$(SYSTEM_INCL_DIR) +endif + +ifdef DIRS + LOOP_OVER_DIRS = \ + @for directory in $(DIRS); do \ + if test -d $$directory; then \ + set $(EXIT_ON_ERROR); \ + echo "cd $$directory; $(MAKE) $@"; \ + $(MAKE) -C $$directory $@; \ + set +e; \ + else \ + echo "Skipping non-directory $$directory..."; \ + fi; \ + $(CLICK_STOPWATCH); \ + done +endif + +MK_RULESET = included diff --git a/mozilla/security/coreconf/source.mk b/mozilla/security/coreconf/source.mk new file mode 100644 index 0000000..c25a0dd --- /dev/null +++ b/mozilla/security/coreconf/source.mk @@ -0,0 +1,194 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# Master -specific source import/export directories # +####################################################################### + +# +# master import/export directory prefix +# + +ifndef SOURCE_PREFIX + ifndef BUILD_TREE + SOURCE_PREFIX = $(CORE_DEPTH)/../dist + else + SOURCE_PREFIX = $(BUILD_TREE)/dist + endif +endif + +# +# cross-platform (xp) master import/export directory +# + +ifndef SOURCE_XP_DIR + SOURCE_XP_DIR = $(SOURCE_PREFIX) +endif + +# +# cross-platform (xp) import/export directories +# + +SOURCE_CLASSES_DIR = $(SOURCE_XP_DIR)/classes +SOURCE_CLASSES_DBG_DIR = $(SOURCE_XP_DIR)/classes_DBG +SOURCE_XPHEADERS_DIR = $(SOURCE_XP_DIR)/public/$(MODULE) +SOURCE_XPPRIVATE_DIR = $(SOURCE_XP_DIR)/private/$(MODULE) + +ifdef BUILD_OPT + IMPORT_XPCLASS_DIR = $(SOURCE_CLASSES_DIR) +else + IMPORT_XPCLASS_DIR = $(SOURCE_CLASSES_DBG_DIR) +endif + +# +# machine-dependent (md) master import/export directory +# + +ifndef SOURCE_MD_DIR + SOURCE_MD_DIR = $(SOURCE_PREFIX)/$(PLATFORM) +endif + +# +# machine-dependent (md) import/export directories +# + +#This is where we install built executables and (for Windows only) DLLs. +ifndef SOURCE_BIN_DIR + SOURCE_BIN_DIR = $(SOURCE_MD_DIR)/bin +endif + +#This is where we install built libraries (.a, .so, .lib). +ifndef SOURCE_LIB_DIR + SOURCE_LIB_DIR = $(SOURCE_MD_DIR)/lib +endif + +# This is where NSPR header files are found. +ifndef SOURCE_MDHEADERS_DIR + SOURCE_MDHEADERS_DIR = $(SOURCE_MD_DIR)/include +endif + +####################################################################### +# Master -specific source release directories and files # +####################################################################### + +# +# source-side master release directory prefix +# NOTE: export control policy enforced for XP and MD files released to +# the staging area +# + +ifeq ($(POLICY), domestic) + SOURCE_RELEASE_PREFIX = $(SOURCE_PREFIX)/release/domestic +else + ifeq ($(POLICY), export) + SOURCE_RELEASE_PREFIX = $(SOURCE_PREFIX)/release/export + else + ifeq ($(POLICY), france) + SOURCE_RELEASE_PREFIX = $(SOURCE_PREFIX)/release/france + else +#We shouldn't have to put another directory under here, but without it the perl +#script for releasing doesn't find the directory. It thinks it doesn't exist. +#So we're adding this no-policy directory so that the script for releasing works +#in all casese when policy is not set. This doesn't affect where the final jar +#files land, only where they are placed in the local tree when building the jar +#files. When there is no policy, the jar files will still land in +#/// like they used to. + SOURCE_RELEASE_PREFIX = $(SOURCE_PREFIX)/release/no-policy + endif + endif +endif + +# +# cross-platform (xp) source-side master release directory +# + +SOURCE_RELEASE_XP_DIR = $(SOURCE_RELEASE_PREFIX) + +# +# cross-platform (xp) source-side release directories +# + +SOURCE_RELEASE_CLASSES_DIR = classes +SOURCE_RELEASE_CLASSES_DBG_DIR = classes_DBG +SOURCE_RELEASE_XPHEADERS_DIR = include + +# +# cross-platform (xp) JAR source-side release files +# + +XPCLASS_JAR = xpclass.jar +XPCLASS_DBG_JAR = xpclass_dbg.jar +XPHEADER_JAR = xpheader.jar + +ifdef BUILD_OPT + SOURCE_RELEASE_XP_CLASSES_DIR = $(SOURCE_RELEASE_CLASSES_DIR) + IMPORT_XPCLASS_JAR = $(XPCLASS_JAR) +else + SOURCE_RELEASE_XP_CLASSES_DIR = $(SOURCE_RELEASE_CLASSES_DBG_DIR) + IMPORT_XPCLASS_JAR = $(XPCLASS_DBG_JAR) +endif + +# +# machine-dependent (md) source-side master release directory +# + +SOURCE_RELEASE_MD_DIR = $(PLATFORM) + +# +# machine-dependent (md) source-side release directories +# + +SOURCE_RELEASE_BIN_DIR = $(PLATFORM)/bin +SOURCE_RELEASE_LIB_DIR = $(PLATFORM)/lib +SOURCE_RELEASE_MDHEADERS_DIR = $(PLATFORM)/include +SOURCE_RELEASE_SPEC_DIR = $(SOURCE_RELEASE_MD_DIR) + +# +# machine-dependent (md) JAR/tar source-side release files +# + +MDBINARY_JAR = mdbinary.jar +MDHEADER_JAR = mdheader.jar + + +# Where to put the results + +ifneq ($(RESULTS_DIR),) + RESULTS_DIR = $(RELEASE_TREE)/sectools/results +endif + +MK_SOURCE = included diff --git a/mozilla/security/coreconf/suffix.mk b/mozilla/security/coreconf/suffix.mk new file mode 100644 index 0000000..dcb87ef --- /dev/null +++ b/mozilla/security/coreconf/suffix.mk @@ -0,0 +1,99 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# Master "Core Components" suffixes # +####################################################################### + +# +# Object suffixes (OS2 and WIN% override this) +# +ifndef OBJ_SUFFIX + OBJ_SUFFIX = .o +endif + +# +# Assembler source suffixes (OS2 and WIN% override this) +# +ifndef ASM_SUFFIX + ASM_SUFFIX = .s +endif + +# +# Library suffixes +# +STATIC_LIB_EXTENSION = + +ifndef DYNAMIC_LIB_EXTENSION + DYNAMIC_LIB_EXTENSION = +endif + + +ifndef STATIC_LIB_SUFFIX + STATIC_LIB_SUFFIX = .$(LIB_SUFFIX) +endif + + +ifndef DYNAMIC_LIB_SUFFIX + DYNAMIC_LIB_SUFFIX = .$(DLL_SUFFIX) +endif + +# WIN% overridese this +ifndef IMPORT_LIB_SUFFIX + IMPORT_LIB_SUFFIX = +endif + + +ifndef STATIC_LIB_SUFFIX_FOR_LINKING + STATIC_LIB_SUFFIX_FOR_LINKING = $(STATIC_LIB_SUFFIX) +endif + + +# WIN% overridese this +ifndef DYNAMIC_LIB_SUFFIX_FOR_LINKING + DYNAMIC_LIB_SUFFIX_FOR_LINKING = $(DYNAMIC_LIB_SUFFIX) +endif + +# +# Program suffixes (OS2 and WIN% override this) +# + +ifndef PROG_SUFFIX + PROG_SUFFIX = +endif + +MK_SUFFIX = included diff --git a/mozilla/security/coreconf/tree.mk b/mozilla/security/coreconf/tree.mk new file mode 100644 index 0000000..811804f --- /dev/null +++ b/mozilla/security/coreconf/tree.mk @@ -0,0 +1,84 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# Master "Core Components" file system "release" prefixes # +####################################################################### + +# Windows platforms override this. See WIN32.mk. +ifndef RELEASE_TREE + ifdef BUILD_SHIP + ifdef USE_SHIPS + RELEASE_TREE = $(BUILD_SHIP) + else + RELEASE_TREE = /share/builds/components + endif + else + RELEASE_TREE = /share/builds/components + endif +endif + +# +# NOTE: export control policy enforced for XP and MD files +# released to the binary release tree +# + +ifeq ($(POLICY), domestic) + RELEASE_XP_DIR = domestic + RELEASE_MD_DIR = domestic/$(PLATFORM) +else + ifeq ($(POLICY), export) + RELEASE_XP_DIR = export + RELEASE_MD_DIR = export/$(PLATFORM) + else + ifeq ($(POLICY), france) + RELEASE_XP_DIR = france + RELEASE_MD_DIR = france/$(PLATFORM) + else + RELEASE_XP_DIR = + RELEASE_MD_DIR = $(PLATFORM) + endif + endif +endif + + +REPORTER_TREE = $(subst \,\\,$(RELEASE_TREE)) + +IMPORT_XP_DIR = +IMPORT_MD_DIR = $(PLATFORM) + +MK_TREE = included diff --git a/mozilla/security/coreconf/version.mk b/mozilla/security/coreconf/version.mk new file mode 100644 index 0000000..9e6ce97 --- /dev/null +++ b/mozilla/security/coreconf/version.mk @@ -0,0 +1,109 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# Build master "Core Components" release version directory name # +####################################################################### + +# +# Always set CURRENT_VERSION_SYMLINK to the symbolic link. +# + +CURRENT_VERSION_SYMLINK = current + + +# +# For the sake of backwards compatibility (*sigh*) ... +# + +ifndef VERSION + ifdef BUILD_NUM + VERSION = $(BUILD_NUM) + endif +endif + +ifndef RELEASE_VERSION + ifdef BUILD_NUM + RELEASE_VERSION = $(BUILD_NUM) + endif +endif + +# +# If VERSION has still NOT been set on the command line, +# as an environment variable, by the individual Makefile, or +# by the -specific "version.mk" file, set VERSION equal +# to $(CURRENT_VERSION_SYMLINK). + +ifndef VERSION + VERSION = $(CURRENT_VERSION_SYMLINK) +endif + +# If RELEASE_VERSION has still NOT been set on the command line, +# as an environment variable, by the individual Makefile, or +# by the -specific "version.mk" file, automatically +# generate the next available version number via a perl script. +# + +ifndef RELEASE_VERSION + RELEASE_VERSION = +endif + +# +# Set -specific versions for compiliation and linkage. +# + +ifndef JAVA_VERSION + JAVA_VERSION = $(CURRENT_VERSION_SYMLINK) +endif + +ifndef NETLIB_VERSION + NETLIB_VERSION = $(CURRENT_VERSION_SYMLINK) +endif + +ifndef NSPR_VERSION + NSPR_VERSION = $(CURRENT_VERSION_SYMLINK) +endif + +ifndef SECTOOLS_VERSION + SECTOOLS_VERSION = $(CURRENT_VERSION_SYMLINK) +endif + +ifndef SECURITY_VERSION + SECURITY_VERSION = $(CURRENT_VERSION_SYMLINK) +endif + +MK_VERSION = included diff --git a/mozilla/security/coreconf/version.pl b/mozilla/security/coreconf/version.pl new file mode 100644 index 0000000..3de36f3 --- /dev/null +++ b/mozilla/security/coreconf/version.pl @@ -0,0 +1,80 @@ +#!/usr/sbin/perl +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# Compose lowercase alphabet +@alphabet = ( "a", "b", "c", "d", "e", "f", "g", "h", + "i", "j", "k", "l", "m", "n", "o", "p", + "q", "r", "s", "t", "u", "v", "w", "x", + "y", "z" ); + +# Compute year +$year = (localtime)[5] + 1900; + +# Compute month +$month = (localtime)[4] + 1; + +# Compute day +$day = (localtime)[3]; + +# Compute base build number +$version = sprintf( "%d%02d%02d", $year, $month, $day ); +$directory = sprintf( "%s\/%s\/%d%02d%02d", $ARGV[0], $ARGV[1], $year, $month, $day ); + +# Print out the name of the first version directory which does not exist +#if( ! -e $directory ) +#{ + print $version; +#} +#else +#{ +# # Loop through combinations +# foreach $ch1 (@alphabet) +# { +# foreach $ch2 (@alphabet) +# { +# $version = sprintf( "%d%02d%02d%s%s", $year, $month, $day, $ch1, $ch2 ); +# $directory = sprintf( "%s\/%s\/%d%02d%02d%s%s", $ARGV[0], $ARGV[1], $year, $month, $day, $ch1, $ch2 ); +# if( ! -e $directory ) +# { +# print STDOUT $version; +# exit; +# } +# } +# } +#} + diff --git a/mozilla/security/dbm/Makefile b/mozilla/security/dbm/Makefile new file mode 100644 index 0000000..bfcff6a --- /dev/null +++ b/mozilla/security/dbm/Makefile @@ -0,0 +1,88 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +ifdef NSS_DISABLE_DBM +DIRS = dummy +endif + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + + + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + +coreconf_hack: + cd ../coreconf; gmake + gmake import + +RelEng_bld: coreconf_hack + gmake diff --git a/mozilla/security/dbm/config/config.mk b/mozilla/security/dbm/config/config.mk new file mode 100644 index 0000000..adab124 --- /dev/null +++ b/mozilla/security/dbm/config/config.mk @@ -0,0 +1,71 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# +# These macros are defined by mozilla's configure script. +# We define them manually here. +# + +DEFINES += -DSTDC_HEADERS -DHAVE_STRERROR + +# +# Most platforms have snprintf, so it's simpler to list the exceptions. +# +HAVE_SNPRINTF = 1 +# +# OSF1 V4.0D doesn't have snprintf but V5.0A does. +# +ifeq ($(OS_TARGET)$(OS_RELEASE),OSF1V4.0D) +HAVE_SNPRINTF = +endif +ifdef HAVE_SNPRINTF +DEFINES += -DHAVE_SNPRINTF +endif + +ifeq (,$(filter-out IRIX Linux,$(OS_TARGET))) +DEFINES += -DHAVE_SYS_CDEFS_H +endif + +ifeq (,$(filter-out DGUX NCR ReliantUNIX SCO_SV SCOOS UNIXWARE,$(OS_TARGET))) +DEFINES += -DHAVE_SYS_BYTEORDER_H +endif + +# +# None of the platforms that we are interested in need to +# define HAVE_MEMORY_H. +# diff --git a/mozilla/security/dbm/include/Makefile b/mozilla/security/dbm/include/Makefile new file mode 100644 index 0000000..5189628 --- /dev/null +++ b/mozilla/security/dbm/include/Makefile @@ -0,0 +1,80 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + + + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + + + diff --git a/mozilla/security/dbm/include/manifest.mn b/mozilla/security/dbm/include/manifest.mn new file mode 100644 index 0000000..31cbe56 --- /dev/null +++ b/mozilla/security/dbm/include/manifest.mn @@ -0,0 +1,59 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +CORE_DEPTH = ../.. + +VPATH = $(CORE_DEPTH)/../dbm/include + +MODULE = dbm + +EXPORTS = cdefs.h \ + mcom_db.h \ + ncompat.h \ + winfile.h \ + $(NULL) + +PRIVATE_EXPORTS = hsearch.h \ + page.h \ + extern.h \ + queue.h \ + hash.h \ + mpool.h \ + search.h \ + $(NULL) + diff --git a/mozilla/security/dbm/manifest.mn b/mozilla/security/dbm/manifest.mn new file mode 100644 index 0000000..48b3917 --- /dev/null +++ b/mozilla/security/dbm/manifest.mn @@ -0,0 +1,49 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +CORE_DEPTH = .. + +MODULE = dbm + +IMPORTS = nspr20/v4.4.1 + +RELEASE = dbm + +DIRS = include \ + src \ + $(NULL) diff --git a/mozilla/security/dbm/src/Makefile b/mozilla/security/dbm/src/Makefile new file mode 100644 index 0000000..6d9a95b --- /dev/null +++ b/mozilla/security/dbm/src/Makefile @@ -0,0 +1,80 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/dbm/config/config.mk + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + +include config.mk + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + + + diff --git a/mozilla/security/dbm/src/config.mk b/mozilla/security/dbm/src/config.mk new file mode 100644 index 0000000..e64d886 --- /dev/null +++ b/mozilla/security/dbm/src/config.mk @@ -0,0 +1,67 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEFINES += -DMEMMOVE -D__DBINTERFACE_PRIVATE $(SECURITY_FLAG) + +INCLUDES += -I$(CORE_DEPTH)/../dbm/include + +# +# Currently, override TARGETS variable so that only static libraries +# are specifed as dependencies within rules.mk. +# + +TARGETS = $(LIBRARY) +SHARED_LIBRARY = +IMPORT_LIBRARY = +PURE_LIBRARY = +PROGRAM = + +ifdef SHARED_LIBRARY + ifeq (,$(filter-out WIN%,$(OS_TARGET))) + DLLBASE=/BASE:0x30000000 + RES=$(OBJDIR)/dbm.res + RESNAME=../include/dbm.rc + endif + ifeq ($(DLL_SUFFIX),dll) + DEFINES += -D_DLL + endif +endif + +ifeq ($(OS_TARGET),AIX) + OS_LIBS += -lc_r +endif diff --git a/mozilla/security/dbm/src/dirent.c b/mozilla/security/dbm/src/dirent.c new file mode 100644 index 0000000..cae92d8 --- /dev/null +++ b/mozilla/security/dbm/src/dirent.c @@ -0,0 +1,348 @@ +#ifdef OS2 + +#include +#include +#include +#include + +#include +#include + +/*#ifndef __EMX__ +#include +#endif */ + +#define INCL_DOSFILEMGR +#define INCL_DOSERRORS +#include + +#if OS2 >= 2 +# define FFBUF FILEFINDBUF3 +# define Word ULONG + /* + * LS20 recommends a request count of 100, but according to the + * APAR text it does not lead to missing files, just to funny + * numbers of returned entries. + * + * LS30 HPFS386 requires a count greater than 2, or some files + * are missing (those starting with a character less that '.'). + * + * Novell loses entries which overflow the buffer. In previous + * versions of dirent2, this could have lead to missing files + * when the average length of 100 directory entries was 40 bytes + * or more (quite unlikely for files on a Novell server). + * + * Conclusion: Make sure that the entries all fit into the buffer + * and that the buffer is large enough for more than 2 entries + * (each entry is at most 300 bytes long). And ignore the LS20 + * effect. + */ +# define Count 25 +# define BufSz (25 * (sizeof(FILEFINDBUF3)+1)) +#else +# define FFBUF FILEFINDBUF +# define Word USHORT +# define BufSz 1024 +# define Count 3 +#endif + +#if defined(__IBMC__) || defined(__IBMCPP__) + #define error(rc) _doserrno = rc, errno = EOS2ERR +#elif defined(MICROSOFT) + #define error(rc) _doserrno = rc, errno = 255 +#else + #define error(rc) errno = 255 +#endif + +struct _dirdescr { + HDIR handle; /* DosFindFirst handle */ + char fstype; /* filesystem type */ + Word count; /* valid entries in */ + long number; /* absolute number of next entry */ + int index; /* relative number of next entry */ + FFBUF * next; /* pointer to next entry */ + char name[MAXPATHLEN+3]; /* directory name */ + unsigned attrmask; /* attribute mask for seekdir */ + struct dirent entry; /* buffer for directory entry */ + BYTE ffbuf[BufSz]; +}; + +/* + * Return first char of filesystem type, or 0 if unknown. + */ +static char +getFSType(const char *path) +{ + static char cache[1+26]; + char drive[3], info[512]; + Word unit, infolen; + char r; + + if (isalpha(path[0]) && path[1] == ':') { + unit = toupper(path[0]) - '@'; + path += 2; + } else { + ULONG driveMap; +#if OS2 >= 2 + if (DosQueryCurrentDisk(&unit, &driveMap)) +#else + if (DosQCurDisk(&unit, &driveMap)) +#endif + return 0; + } + + if ((path[0] == '\\' || path[0] == '/') + && (path[1] == '\\' || path[1] == '/')) + return 0; + + if (cache [unit]) + return cache [unit]; + + drive[0] = '@' + unit; + drive[1] = ':'; + drive[2] = '\0'; + infolen = sizeof info; +#if OS2 >= 2 + if (DosQueryFSAttach(drive, 0, FSAIL_QUERYNAME, (PVOID)info, &infolen)) + return 0; + if (infolen >= sizeof(FSQBUFFER2)) { + FSQBUFFER2 *p = (FSQBUFFER2 *)info; + r = p->szFSDName[p->cbName]; + } else +#else + if (DosQFSAttach((PSZ)drive, 0, FSAIL_QUERYNAME, (PVOID)info, &infolen, 0)) + return 0; + if (infolen >= 9) { + char *p = info + sizeof(USHORT); + p += sizeof(USHORT) + *(USHORT *)p + 1 + sizeof(USHORT); + r = *p; + } else +#endif + r = 0; + return cache [unit] = r; +} + +char * +abs_path(const char *name, char *buffer, int len) +{ + char buf[4]; + if (isalpha(name[0]) && name[1] == ':' && name[2] == '\0') { + buf[0] = name[0]; + buf[1] = name[1]; + buf[2] = '.'; + buf[3] = '\0'; + name = buf; + } +#if OS2 >= 2 + if (DosQueryPathInfo((PSZ)name, FIL_QUERYFULLNAME, buffer, len)) +#else + if (DosQPathInfo((PSZ)name, FIL_QUERYFULLNAME, (PBYTE)buffer, len, 0L)) +#endif + return NULL; + return buffer; +} + +DIR * +openxdir(const char *path, unsigned att_mask) +{ + DIR *dir; + char name[MAXPATHLEN+3]; + Word rc; + + dir = malloc(sizeof(DIR)); + if (dir == NULL) { + errno = ENOMEM; + return NULL; + } + + strncpy(name, path, MAXPATHLEN); + name[MAXPATHLEN] = '\0'; + switch (name[strlen(name)-1]) { + default: + strcat(name, "\\"); + case '\\': + case '/': + case ':': + ; + } + strcat(name, "."); + if (!abs_path(name, dir->name, MAXPATHLEN+1)) + strcpy(dir->name, name); + if (dir->name[strlen(dir->name)-1] == '\\') + strcat(dir->name, "*"); + else + strcat(dir->name, "\\*"); + + dir->fstype = getFSType(dir->name); + dir->attrmask = att_mask | A_DIR; + + dir->handle = HDIR_CREATE; + dir->count = 100; +#if OS2 >= 2 + rc = DosFindFirst(dir->name, &dir->handle, dir->attrmask, + dir->ffbuf, sizeof dir->ffbuf, &dir->count, FIL_STANDARD); +#else + rc = DosFindFirst((PSZ)dir->name, &dir->handle, dir->attrmask, + (PFILEFINDBUF)dir->ffbuf, sizeof dir->ffbuf, &dir->count, 0); +#endif + switch (rc) { + default: + free(dir); + error(rc); + return NULL; + case NO_ERROR: + case ERROR_NO_MORE_FILES: + ; + } + + dir->number = 0; + dir->index = 0; + dir->next = (FFBUF *)dir->ffbuf; + + return (DIR *)dir; +} + +DIR * +opendir(const char *pathname) +{ + return openxdir(pathname, 0); +} + +struct dirent * +readdir(DIR *dir) +{ + static int dummy_ino = 2; + + if (dir->index == dir->count) { + Word rc; + dir->count = 100; +#if OS2 >= 2 + rc = DosFindNext(dir->handle, dir->ffbuf, + sizeof dir->ffbuf, &dir->count); +#else + rc = DosFindNext(dir->handle, (PFILEFINDBUF)dir->ffbuf, + sizeof dir->ffbuf, &dir->count); +#endif + if (rc) { + error(rc); + return NULL; + } + + dir->index = 0; + dir->next = (FFBUF *)dir->ffbuf; + } + + if (dir->index == dir->count) + return NULL; + + memcpy(dir->entry.d_name, dir->next->achName, dir->next->cchName); + dir->entry.d_name[dir->next->cchName] = '\0'; + dir->entry.d_ino = dummy_ino++; + dir->entry.d_reclen = dir->next->cchName; + dir->entry.d_namlen = dir->next->cchName; + dir->entry.d_size = dir->next->cbFile; + dir->entry.d_attribute = dir->next->attrFile; + dir->entry.d_time = *(USHORT *)&dir->next->ftimeLastWrite; + dir->entry.d_date = *(USHORT *)&dir->next->fdateLastWrite; + + switch (dir->fstype) { + case 'F': /* FAT */ + case 'C': /* CDFS */ + if (dir->next->attrFile & FILE_DIRECTORY) + strupr(dir->entry.d_name); + else + strlwr(dir->entry.d_name); + } + +#if OS2 >= 2 + dir->next = (FFBUF *)((BYTE *)dir->next + dir->next->oNextEntryOffset); +#else + dir->next = (FFBUF *)((BYTE *)dir->next->achName + dir->next->cchName + 1); +#endif + ++dir->number; + ++dir->index; + + return &dir->entry; +} + +long +telldir(DIR *dir) +{ + return dir->number; +} + +void +seekdir(DIR *dir, long off) +{ + if (dir->number > off) { + char name[MAXPATHLEN+2]; + Word rc; + + DosFindClose(dir->handle); + + strcpy(name, dir->name); + strcat(name, "*"); + + dir->handle = HDIR_CREATE; + dir->count = 32767; +#if OS2 >= 2 + rc = DosFindFirst(name, &dir->handle, dir->attrmask, + dir->ffbuf, sizeof dir->ffbuf, &dir->count, FIL_STANDARD); +#else + rc = DosFindFirst((PSZ)name, &dir->handle, dir->attrmask, + (PFILEFINDBUF)dir->ffbuf, sizeof dir->ffbuf, &dir->count, 0); +#endif + switch (rc) { + default: + error(rc); + return; + case NO_ERROR: + case ERROR_NO_MORE_FILES: + ; + } + + dir->number = 0; + dir->index = 0; + dir->next = (FFBUF *)dir->ffbuf; + } + + while (dir->number < off && readdir(dir)) + ; +} + +void +closedir(DIR *dir) +{ + DosFindClose(dir->handle); + free(dir); +} + +/*****************************************************************************/ + +#ifdef TEST + +main(int argc, char **argv) +{ + int i; + DIR *dir; + struct dirent *ep; + + for (i = 1; i < argc; ++i) { + dir = opendir(argv[i]); + if (!dir) + continue; + while (ep = readdir(dir)) + if (strchr("\\/:", argv[i] [strlen(argv[i]) - 1])) + printf("%s%s\n", argv[i], ep->d_name); + else + printf("%s/%s\n", argv[i], ep->d_name); + closedir(dir); + } + + return 0; +} + +#endif + +#endif /* OS2 */ + diff --git a/mozilla/security/dbm/src/dirent.h b/mozilla/security/dbm/src/dirent.h new file mode 100644 index 0000000..07a6c0a --- /dev/null +++ b/mozilla/security/dbm/src/dirent.h @@ -0,0 +1,97 @@ +#ifndef __DIRENT_H__ +#define __DIRENT_H__ +/* + * @(#)msd_dir.h 1.4 87/11/06 Public Domain. + * + * A public domain implementation of BSD directory routines for + * MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield), + * August 1897 + * + * Extended by Peter Lim (lim@mullian.oz) to overcome some MS DOS quirks + * and returns 2 more pieces of information - file size & attribute. + * Plus a little reshuffling of some #define's positions December 1987 + * + * Some modifications by Martin Junius 02-14-89 + * + * AK900712 + * AK910410 abs_path - make absolute path + * + */ + +#ifdef __EMX__ +#include +#else +#if defined(__IBMC__) || defined(__IBMCPP__) || defined(XP_W32_MSVC) +#include +#ifdef MAXPATHLEN + #undef MAXPATHLEN +#endif +#define MAXPATHLEN (FILENAME_MAX*4) +#define MAXNAMLEN FILENAME_MAX + +#else +#include +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* attribute stuff */ +#ifndef A_RONLY +# define A_RONLY 0x01 +# define A_HIDDEN 0x02 +# define A_SYSTEM 0x04 +# define A_LABEL 0x08 +# define A_DIR 0x10 +# define A_ARCHIVE 0x20 +#endif + +struct dirent { +#if defined(OS2) || defined(WIN32) /* use the layout of EMX to avoid trouble */ + int d_ino; /* Dummy */ + int d_reclen; /* Dummy, same as d_namlen */ + int d_namlen; /* length of name */ + char d_name[MAXNAMLEN + 1]; + unsigned long d_size; + unsigned short d_attribute; /* attributes (see above) */ + unsigned short d_time; /* modification time */ + unsigned short d_date; /* modification date */ +#else + char d_name[MAXNAMLEN + 1]; /* garentee null termination */ + char d_attribute; /* .. extension .. */ + unsigned long d_size; /* .. extension .. */ +#endif +}; + +typedef struct _dirdescr DIR; +/* the structs do not have to be defined here */ + +extern DIR *opendir(const char *); +extern DIR *openxdir(const char *, unsigned); +extern struct dirent *readdir(DIR *); +extern void seekdir(DIR *, long); +extern long telldir(DIR *); +extern void closedir(DIR *); +#define rewinddir(dirp) seekdir(dirp, 0L) + +extern char * abs_path(const char *name, char *buffer, int len); + +#ifndef S_IFMT +#define S_IFMT ( S_IFDIR | S_IFREG ) +#endif + +#ifndef S_ISDIR +#define S_ISDIR( m ) (((m) & S_IFMT) == S_IFDIR) +#endif + +#ifndef S_ISREG +#define S_ISREG( m ) (((m) & S_IFMT) == S_IFREG) +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mozilla/security/dbm/src/manifest.mn b/mozilla/security/dbm/src/manifest.mn new file mode 100644 index 0000000..392f564 --- /dev/null +++ b/mozilla/security/dbm/src/manifest.mn @@ -0,0 +1,62 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +CORE_DEPTH = ../.. + +VPATH = $(CORE_DEPTH)/../dbm/src + +MODULE = dbm + +# +# memmove.c, snprintf.c, and strerror.c are not in CSRCS because +# the Standard C Library has memmove and strerror and DBM is not +# using snprintf. +# + +CSRCS = db.c \ + h_bigkey.c \ + h_func.c \ + h_log2.c \ + h_page.c \ + hash.c \ + hash_buf.c \ + mktemp.c \ + dirent.c \ + $(NULL) + +LIBRARY_NAME = dbm diff --git a/mozilla/security/dbm/tests/Makefile b/mozilla/security/dbm/tests/Makefile new file mode 100644 index 0000000..63bc293 --- /dev/null +++ b/mozilla/security/dbm/tests/Makefile @@ -0,0 +1,73 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +DEPTH = ../.. +CORE_DEPTH = ../.. + +VPATH = $(CORE_DEPTH)/../dbm/tests + +MODULE = dbm + +CSRCS = lots.c + +PROGRAM = lots + +include $(DEPTH)/coreconf/config.mk + +include $(DEPTH)/dbm/config/config.mk + +ifeq (,$(filter-out WIN%,$(OS_TARGET))) +LIBDBM = ../src/$(PLATFORM)/dbm$(STATIC_LIB_SUFFIX) +else +LIBDBM = ../src/$(PLATFORM)/libdbm$(STATIC_LIB_SUFFIX) +endif + +INCLUDES += -I$(CORE_DEPTH)/../dbm/include + +LDFLAGS = $(LDOPTS) $(LIBDBM) + +include $(DEPTH)/coreconf/rules.mk + +lots.pure: lots + purify $(CC) -o lots.pure $(CFLAGS) $(OBJS) $(MYLIBS) + +crash: crash.o $(MYLIBS) + $(CC) -o crash $(CFLAGS) $^ + +crash.pure: crash.o $(MYLIBS) + purify $(CC) -o crash.pure $(CFLAGS) $^ + diff --git a/mozilla/security/nss/Makefile b/mozilla/security/nss/Makefile new file mode 100644 index 0000000..0590b74 --- /dev/null +++ b/mozilla/security/nss/Makefile @@ -0,0 +1,185 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + +ifeq ($(OS_TARGET),WINCE) +DIRS = lib # omit cmd since wince has no command line shell +endif + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + +nss_build_all: build_coreconf build_nspr build_dbm all + +nss_clean_all: clobber_coreconf clobber_nspr clobber_dbm clobber + +build_coreconf: + cd $(CORE_DEPTH)/coreconf ; $(MAKE) + +clobber_coreconf: + cd $(CORE_DEPTH)/coreconf ; $(MAKE) clobber + +NSPR_CONFIG_STATUS = $(CORE_DEPTH)/../nsprpub/$(OBJDIR_NAME)/config.status +NSPR_CONFIGURE = $(CORE_DEPTH)/../nsprpub/configure + +# +# Translate coreconf build options to NSPR configure options. +# + +ifdef BUILD_OPT +NSPR_CONFIGURE_OPTS += --disable-debug --enable-optimize +endif +ifdef USE_64 +NSPR_CONFIGURE_OPTS += --enable-64bit +endif +ifeq ($(OS_TARGET),WIN95) +NSPR_CONFIGURE_OPTS += --enable-win32-target=WIN95 +endif +ifdef USE_DEBUG_RTL +NSPR_CONFIGURE_OPTS += --enable-debug-rtl +endif +ifdef NS_USE_GCC +NSPR_COMPILERS = CC=gcc CXX=g++ +endif + +# +# Some pwd commands on Windows (for example, the pwd +# command in Cygwin) return a pathname that begins +# with a (forward) slash. When such a pathname is +# passed to Windows build tools (for example, cl), it +# is mistaken as a command-line option. If that is the case, +# we use a relative pathname as NSPR's prefix on Windows. +# + +USEABSPATH="YES" +ifeq (,$(filter-out WIN%,$(OS_TARGET))) +ifeq (,$(findstring :,$(shell pwd))) +USEABSPATH="NO" +endif +endif +ifeq ($(USEABSPATH),"YES") +NSPR_PREFIX = $(shell pwd)/../../dist/$(OBJDIR_NAME) +else +NSPR_PREFIX = $$(topsrcdir)/../dist/$(OBJDIR_NAME) +endif + +$(NSPR_CONFIG_STATUS): $(NSPR_CONFIGURE) + $(NSINSTALL) -D $(CORE_DEPTH)/../nsprpub/$(OBJDIR_NAME) + cd $(CORE_DEPTH)/../nsprpub/$(OBJDIR_NAME) ; \ + $(NSPR_COMPILERS) sh ../configure \ + $(NSPR_CONFIGURE_OPTS) \ + --with-dist-prefix='$(NSPR_PREFIX)' \ + --with-dist-includedir='$(NSPR_PREFIX)/include' + +build_nspr: $(NSPR_CONFIG_STATUS) + cd $(CORE_DEPTH)/../nsprpub/$(OBJDIR_NAME) ; $(MAKE) + +clobber_nspr: $(NSPR_CONFIG_STATUS) + cd $(CORE_DEPTH)/../nsprpub/$(OBJDIR_NAME) ; $(MAKE) clobber + +build_dbm: +ifndef NSS_DISABLE_DBM + cd $(CORE_DEPTH)/dbm ; $(MAKE) export libs +else + echo "skipping the build of DBM" +endif + +clobber_dbm: + cd $(CORE_DEPTH)/dbm ; $(MAKE) clobber + +moz_import:: +ifeq (,$(filter-out WIN%,$(OS_TARGET))) + $(NSINSTALL) -D $(DIST)/include/nspr + cp $(DIST)/../include/nspr/*.h $(DIST)/include/nspr + cp $(DIST)/../include/* $(DIST)/include +ifdef BUILD_OPT + cp $(DIST)/../WIN32_O.OBJ/lib/* $(DIST)/lib +else + cp $(DIST)/../WIN32_D.OBJ/lib/* $(DIST)/lib +endif + mv $(DIST)/lib/dbm32.lib $(DIST)/lib/dbm.lib +else +ifeq ($(OS_TARGET),OS2) + cp -rf $(DIST)/../include $(DIST) + cp -rf $(DIST)/../lib $(DIST) + cp -f $(DIST)/lib/libmozdbm_s.$(LIB_SUFFIX) $(DIST)/lib/libdbm.$(LIB_SUFFIX) +else + $(NSINSTALL) -L ../../dist include $(DIST) + $(NSINSTALL) -L ../../dist lib $(DIST) + cp $(DIST)/lib/libmozdbm_s.$(LIB_SUFFIX) $(DIST)/lib/libdbm.$(LIB_SUFFIX) +endif +endif + +nss_RelEng_bld: build_coreconf import build_dbm all + +package: + $(MAKE) -C pkg publish diff --git a/mozilla/security/nss/cmd/.cvsignore b/mozilla/security/nss/cmd/.cvsignore new file mode 100644 index 0000000..6329db2 --- /dev/null +++ b/mozilla/security/nss/cmd/.cvsignore @@ -0,0 +1 @@ +.gdbinit diff --git a/mozilla/security/nss/cmd/Makefile b/mozilla/security/nss/cmd/Makefile new file mode 100644 index 0000000..67dd375 --- /dev/null +++ b/mozilla/security/nss/cmd/Makefile @@ -0,0 +1,57 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +CORE_DEPTH = ../.. +DEPTH = ../.. + +include manifest.mn +include $(CORE_DEPTH)/coreconf/config.mk + +ifdef BUILD_LIBPKIX_TESTS +DIRS += libpkix +endif + +INCLUDES += \ + -I$(DIST)/../public/security \ + -I./include \ + $(NULL) + +include $(CORE_DEPTH)/coreconf/rules.mk + +symbols:: + @echo "TARGETS = $(TARGETS)" diff --git a/mozilla/security/nss/cmd/addbuiltin/Makefile b/mozilla/security/nss/cmd/addbuiltin/Makefile new file mode 100644 index 0000000..fe79918 --- /dev/null +++ b/mozilla/security/nss/cmd/addbuiltin/Makefile @@ -0,0 +1,80 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + +include ../platlibs.mk + + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + + +include ../platrules.mk + diff --git a/mozilla/security/nss/cmd/addbuiltin/addbuiltin.c b/mozilla/security/nss/cmd/addbuiltin/addbuiltin.c new file mode 100644 index 0000000..693819f --- /dev/null +++ b/mozilla/security/nss/cmd/addbuiltin/addbuiltin.c @@ -0,0 +1,391 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* + * Tool for converting builtin CA certs. + * + * $Id: addbuiltin.c,v 1.14 2007/02/14 00:35:52 alexei.volkov.bugs%sun.com Exp $ + */ + +#include "nssrenam.h" +#include "nss.h" +#include "cert.h" +#include "certdb.h" +#include "secutil.h" +#include "pk11func.h" + +#if defined(WIN32) +#include +#include +#endif + +void dumpbytes(unsigned char *buf, int len) +{ + int i; + for (i=0; i < len; i++) { + if ((i !=0) && ((i & 0xf) == 0)) { + printf("\n"); + } + printf("\\%03o",buf[i]); + } + printf("\n"); +} + +char *getTrustString(unsigned int trust) +{ + if (trust & CERTDB_TRUSTED) { + if (trust & CERTDB_TRUSTED_CA) { + return "CKT_NETSCAPE_TRUSTED_DELEGATOR|CKT_NETSCAPE_TRUSTED"; + } else { + return "CKT_NETSCAPE_TRUSTED"; + } + } else { + if (trust & CERTDB_TRUSTED_CA) { + return "CKT_NETSCAPE_TRUSTED_DELEGATOR"; + } else if (trust & CERTDB_VALID_CA) { + return "CKT_NETSCAPE_VALID_DELEGATOR"; + } else { + return "CKT_NETSCAPE_TRUST_UNKNOWN"; + } + } + return "CKT_NETSCAPE_TRUST_UNKNOWN"; /* not reached */ +} + +static const SEC_ASN1Template serialTemplate[] = { + { SEC_ASN1_INTEGER, offsetof(CERTCertificate,serialNumber) }, + { 0 } +}; + +static SECStatus +ConvertCertificate(SECItem *sdder, char *nickname, CERTCertTrust *trust) +{ + SECStatus rv = SECSuccess; + CERTCertificate *cert; + unsigned char sha1_hash[SHA1_LENGTH]; + unsigned char md5_hash[MD5_LENGTH]; + SECItem *serial = NULL; + + cert = CERT_DecodeDERCertificate(sdder, PR_FALSE, nickname); + if (!cert) { + return SECFailure; + } + serial = SEC_ASN1EncodeItem(NULL,NULL,cert,serialTemplate); + if (!serial) { + return SECFailure; + } + + printf("\n#\n# Certificate \"%s\"\n#\n",nickname); + printf("CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE\n"); + printf("CKA_TOKEN CK_BBOOL CK_TRUE\n"); + printf("CKA_PRIVATE CK_BBOOL CK_FALSE\n"); + printf("CKA_MODIFIABLE CK_BBOOL CK_FALSE\n"); + printf("CKA_LABEL UTF8 \"%s\"\n",nickname); + printf("CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509\n"); + printf("CKA_SUBJECT MULTILINE_OCTAL\n"); + dumpbytes(cert->derSubject.data,cert->derSubject.len); + printf("END\n"); + printf("CKA_ID UTF8 \"0\"\n"); + printf("CKA_ISSUER MULTILINE_OCTAL\n"); + dumpbytes(cert->derIssuer.data,cert->derIssuer.len); + printf("END\n"); + printf("CKA_SERIAL_NUMBER MULTILINE_OCTAL\n"); + dumpbytes(serial->data,serial->len); + printf("END\n"); + printf("CKA_VALUE MULTILINE_OCTAL\n"); + dumpbytes(sdder->data,sdder->len); + printf("END\n"); + + PK11_HashBuf(SEC_OID_SHA1, sha1_hash, sdder->data, sdder->len); + PK11_HashBuf(SEC_OID_MD5, md5_hash, sdder->data, sdder->len); + printf("\n# Trust for Certificate \"%s\"\n",nickname); + printf("CKA_CLASS CK_OBJECT_CLASS CKO_NETSCAPE_TRUST\n"); + printf("CKA_TOKEN CK_BBOOL CK_TRUE\n"); + printf("CKA_PRIVATE CK_BBOOL CK_FALSE\n"); + printf("CKA_MODIFIABLE CK_BBOOL CK_FALSE\n"); + printf("CKA_LABEL UTF8 \"%s\"\n",nickname); + printf("CKA_CERT_SHA1_HASH MULTILINE_OCTAL\n"); + dumpbytes(sha1_hash,SHA1_LENGTH); + printf("END\n"); + printf("CKA_CERT_MD5_HASH MULTILINE_OCTAL\n"); + dumpbytes(md5_hash,MD5_LENGTH); + printf("END\n"); + + printf("CKA_ISSUER MULTILINE_OCTAL\n"); + dumpbytes(cert->derIssuer.data,cert->derIssuer.len); + printf("END\n"); + printf("CKA_SERIAL_NUMBER MULTILINE_OCTAL\n"); + dumpbytes(serial->data,serial->len); + printf("END\n"); + + printf("CKA_TRUST_SERVER_AUTH CK_TRUST %s\n", + getTrustString(trust->sslFlags)); + printf("CKA_TRUST_EMAIL_PROTECTION CK_TRUST %s\n", + getTrustString(trust->emailFlags)); + printf("CKA_TRUST_CODE_SIGNING CK_TRUST %s\n", + getTrustString(trust->objectSigningFlags)); +#ifdef notdef + printf("CKA_TRUST_CLIENT_AUTH CK_TRUST CKT_NETSCAPE_TRUSTED\n");*/ + printf("CKA_TRUST_DIGITAL_SIGNATURE CK_TRUST CKT_NETSCAPE_TRUSTED_DELEGATOR\n"); + printf("CKA_TRUST_NON_REPUDIATION CK_TRUST CKT_NETSCAPE_TRUSTED_DELEGATOR\n"); + printf("CKA_TRUST_KEY_ENCIPHERMENT CK_TRUST CKT_NETSCAPE_TRUSTED_DELEGATOR\n"); + printf("CKA_TRUST_DATA_ENCIPHERMENT CK_TRUST CKT_NETSCAPE_TRUSTED_DELEGATOR\n"); + printf("CKA_TRUST_KEY_AGREEMENT CK_TRUST CKT_NETSCAPE_TRUSTED_DELEGATOR\n"); + printf("CKA_TRUST_KEY_CERT_SIGN CK_TRUST CKT_NETSCAPE_TRUSTED_DELEGATOR\n"); +#endif + printf("CKA_TRUST_STEP_UP_APPROVED CK_BBOOL %s\n", + trust->sslFlags & CERTDB_GOVT_APPROVED_CA ? + "CK_TRUE" : "CK_FALSE"); + + + PORT_Free(sdder->data); + return(rv); + +} + +void printheader() { + printf("# \n" +"# ***** BEGIN LICENSE BLOCK *****\n" +"# Version: MPL 1.1/GPL 2.0/LGPL 2.1\n" +"#\n" +"# The contents of this file are subject to the Mozilla Public License Version\n" +"# 1.1 (the \"License\"); you may not use this file except in compliance with\n" +"# the License. You may obtain a copy of the License at\n" +"# http://www.mozilla.org/MPL/\n" +"#\n" +"# Software distributed under the License is distributed on an \"AS IS\" basis,\n" +"# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\n" +"# for the specific language governing rights and limitations under the\n" +"# License.\n" +"#\n" +"# The Original Code is the Netscape security libraries..\n" +"#\n" +"# The Initial Developer of the Original Code is\n" +"# Netscape Communications Corporation.\n" +"# Portions created by the Initial Developer are Copyright (C) 1994-2000\n" +"# the Initial Developer. All Rights Reserved.\n" +"#\n" +"# Contributor(s):\n" +"#\n" +"# Alternatively, the contents of this file may be used under the terms of\n" +"# either the GNU General Public License Version 2 or later (the \"GPL\"), or\n" +"# the GNU Lesser General Public License Version 2.1 or later (the \"LGPL\"),\n" +"# in which case the provisions of the GPL or the LGPL are applicable instead\n" +"# of those above. If you wish to allow use of your version of this file only\n" +"# under the terms of either the GPL or the LGPL, and not to allow others to\n" +"# use your version of this file under the terms of the MPL, indicate your\n" +"# decision by deleting the provisions above and replace them with the notice\n" +"# and other provisions required by the GPL or the LGPL. If you do not delete\n" +"# the provisions above, a recipient may use your version of this file under\n" +"# the terms of any one of the MPL, the GPL or the LGPL.\n" +"#\n" +"# ***** END LICENSE BLOCK *****\n" + "#\n" + "CVS_ID \"@(#) $RCSfile: addbuiltin.c,v $ $Revision: 1.14 $ $Date: 2007/02/14 00:35:52 $\"\n" + "\n" + "#\n" + "# certdata.txt\n" + "#\n" + "# This file contains the object definitions for the certs and other\n" + "# information \"built into\" NSS.\n" + "#\n" + "# Object definitions:\n" + "#\n" + "# Certificates\n" + "#\n" + "# -- Attribute -- -- type -- -- value --\n" + "# CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE\n" + "# CKA_TOKEN CK_BBOOL CK_TRUE\n" + "# CKA_PRIVATE CK_BBOOL CK_FALSE\n" + "# CKA_MODIFIABLE CK_BBOOL CK_FALSE\n" + "# CKA_LABEL UTF8 (varies)\n" + "# CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509\n" + "# CKA_SUBJECT DER+base64 (varies)\n" + "# CKA_ID byte array (varies)\n" + "# CKA_ISSUER DER+base64 (varies)\n" + "# CKA_SERIAL_NUMBER DER+base64 (varies)\n" + "# CKA_VALUE DER+base64 (varies)\n" + "# CKA_NETSCAPE_EMAIL ASCII7 (unused here)\n" + "#\n" + "# Trust\n" + "#\n" + "# -- Attribute -- -- type -- -- value --\n" + "# CKA_CLASS CK_OBJECT_CLASS CKO_TRUST\n" + "# CKA_TOKEN CK_BBOOL CK_TRUE\n" + "# CKA_PRIVATE CK_BBOOL CK_FALSE\n" + "# CKA_MODIFIABLE CK_BBOOL CK_FALSE\n" + "# CKA_LABEL UTF8 (varies)\n" + "# CKA_ISSUER DER+base64 (varies)\n" + "# CKA_SERIAL_NUMBER DER+base64 (varies)\n" + "# CKA_CERT_HASH binary+base64 (varies)\n" + "# CKA_EXPIRES CK_DATE (not used here)\n" + "# CKA_TRUST_DIGITAL_SIGNATURE CK_TRUST (varies)\n" + "# CKA_TRUST_NON_REPUDIATION CK_TRUST (varies)\n" + "# CKA_TRUST_KEY_ENCIPHERMENT CK_TRUST (varies)\n" + "# CKA_TRUST_DATA_ENCIPHERMENT CK_TRUST (varies)\n" + "# CKA_TRUST_KEY_AGREEMENT CK_TRUST (varies)\n" + "# CKA_TRUST_KEY_CERT_SIGN CK_TRUST (varies)\n" + "# CKA_TRUST_CRL_SIGN CK_TRUST (varies)\n" + "# CKA_TRUST_SERVER_AUTH CK_TRUST (varies)\n" + "# CKA_TRUST_CLIENT_AUTH CK_TRUST (varies)\n" + "# CKA_TRUST_CODE_SIGNING CK_TRUST (varies)\n" + "# CKA_TRUST_EMAIL_PROTECTION CK_TRUST (varies)\n" + "# CKA_TRUST_IPSEC_END_SYSTEM CK_TRUST (varies)\n" + "# CKA_TRUST_IPSEC_TUNNEL CK_TRUST (varies)\n" + "# CKA_TRUST_IPSEC_USER CK_TRUST (varies)\n" + "# CKA_TRUST_TIME_STAMPING CK_TRUST (varies)\n" + "# (other trust attributes can be defined)\n" + "#\n" + "\n" + "#\n" + "# The object to tell NSS that this is a root list and we don't\n" + "# have to go looking for others.\n" + "#\n" + "BEGINDATA\n" + "CKA_CLASS CK_OBJECT_CLASS CKO_NETSCAPE_BUILTIN_ROOT_LIST\n" + "CKA_TOKEN CK_BBOOL CK_TRUE\n" + "CKA_PRIVATE CK_BBOOL CK_FALSE\n" + "CKA_MODIFIABLE CK_BBOOL CK_FALSE\n" + "CKA_LABEL UTF8 \"Mozilla Builtin Roots\"\n"); +} + +static void Usage(char *progName) +{ + fprintf(stderr, "%s -n nickname -t trust [-i certfile]\n", progName); + fprintf(stderr, + "\tRead a der-encoded cert from certfile or stdin, and output\n" + "\tit to stdout in a format suitable for the builtin root module.\n" + "\tExample: %s -n MyCA -t \"C,C,C\" -i myca.der >> certdata.txt\n" + "\t(pipe through atob if the cert is b64-encoded)\n", progName); + fprintf(stderr, "%-15s nickname to assign to builtin cert.\n", + "-n nickname"); + fprintf(stderr, "%-15s trust flags (cCTpPuw).\n", "-t trust"); + fprintf(stderr, "%-15s file to read (default stdin)\n", "-i certfile"); + exit(-1); +} + +enum { + opt_Input = 0, + opt_Nickname, + opt_Trust +}; + +static secuCommandFlag addbuiltin_options[] = +{ + { /* opt_Input */ 'i', PR_TRUE, 0, PR_FALSE }, + { /* opt_Nickname */ 'n', PR_TRUE, 0, PR_FALSE }, + { /* opt_Trust */ 't', PR_TRUE, 0, PR_FALSE } +}; + +int main(int argc, char **argv) +{ + SECStatus rv; + char *nickname; + char *trusts; + char *progName; + PRFileDesc *infile; + CERTCertTrust trust = { 0 }; + SECItem derCert = { 0 }; + + secuCommand addbuiltin = { 0 }; + addbuiltin.numOptions = sizeof(addbuiltin_options)/sizeof(secuCommandFlag); + addbuiltin.options = addbuiltin_options; + + progName = strrchr(argv[0], '/'); + progName = progName ? progName+1 : argv[0]; + + rv = SECU_ParseCommandLine(argc, argv, progName, &addbuiltin); + + if (rv != SECSuccess) + Usage(progName); + + if (!addbuiltin.options[opt_Nickname].activated && + !addbuiltin.options[opt_Trust].activated) { + fprintf(stderr, "%s: you must specify both a nickname and trust.\n", + progName); + Usage(progName); + } + + if (addbuiltin.options[opt_Input].activated) { + infile = PR_Open(addbuiltin.options[opt_Input].arg, PR_RDONLY, 00660); + if (!infile) { + fprintf(stderr, "%s: failed to open input file.\n", progName); + exit(1); + } + } else { +#if defined(WIN32) + /* If we're going to read binary data from stdin, we must put stdin + ** into O_BINARY mode or else incoming \r\n's will become \n's, + ** and latin-1 characters will be altered. + */ + + int smrv = _setmode(_fileno(stdin), _O_BINARY); + if (smrv == -1) { + fprintf(stderr, + "%s: Cannot change stdin to binary mode. Use -i option instead.\n", + progName); + exit(1); + } +#endif + infile = PR_STDIN; + } + + nickname = strdup(addbuiltin.options[opt_Nickname].arg); + trusts = strdup(addbuiltin.options[opt_Trust].arg); + + NSS_NoDB_Init(NULL); + + rv = CERT_DecodeTrustString(&trust, trusts); + if (rv) { + fprintf(stderr, "%s: incorrectly formatted trust string.\n", progName); + Usage(progName); + } + + SECU_FileToItem(&derCert, infile); + + /*printheader();*/ + + rv = ConvertCertificate(&derCert, nickname, &trust); + if (rv) { + fprintf(stderr, "%s: failed to convert certificate.\n", progName); + exit(1); + } + + if (NSS_Shutdown() != SECSuccess) { + exit(1); + } + + return(SECSuccess); +} diff --git a/mozilla/security/nss/cmd/addbuiltin/manifest.mn b/mozilla/security/nss/cmd/addbuiltin/manifest.mn new file mode 100644 index 0000000..0729834 --- /dev/null +++ b/mozilla/security/nss/cmd/addbuiltin/manifest.mn @@ -0,0 +1,52 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +CORE_DEPTH = ../../.. + +# MODULE public and private header directories are implicitly REQUIRED. +MODULE = nss + +CSRCS = \ + addbuiltin.c \ + $(NULL) + +# The MODULE is always implicitly required. +# Listing it here in REQUIRES makes it appear twice in the cc command line. +REQUIRES = seccmd + +PROGRAM = addbuiltin + diff --git a/mozilla/security/nss/cmd/atob/Makefile b/mozilla/security/nss/cmd/atob/Makefile new file mode 100644 index 0000000..61e2cb3 --- /dev/null +++ b/mozilla/security/nss/cmd/atob/Makefile @@ -0,0 +1,80 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + +include ../platlibs.mk + + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + + +include ../platrules.mk + diff --git a/mozilla/security/nss/cmd/atob/atob.c b/mozilla/security/nss/cmd/atob/atob.c new file mode 100644 index 0000000..e5fad05 --- /dev/null +++ b/mozilla/security/nss/cmd/atob/atob.c @@ -0,0 +1,180 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "plgetopt.h" +#include "secutil.h" +#include "nssb64.h" +#include + +#if defined(XP_WIN) || (defined(__sun) && !defined(SVR4)) +#if !defined(WIN32) +extern int fread(char *, size_t, size_t, FILE*); +extern int fwrite(char *, size_t, size_t, FILE*); +extern int fprintf(FILE *, char *, ...); +#endif +#endif + +#if defined(WIN32) +#include "fcntl.h" +#include "io.h" +#endif + +static PRInt32 +output_binary (void *arg, const unsigned char *obuf, PRInt32 size) +{ + FILE *outFile = arg; + int nb; + + nb = fwrite(obuf, 1, size, outFile); + if (nb != size) { + PORT_SetError(SEC_ERROR_IO); + return -1; + } + + return nb; +} + +static SECStatus +decode_file(FILE *outFile, FILE *inFile) +{ + NSSBase64Decoder *cx; + int nb; + SECStatus status = SECFailure; + char ibuf[4096]; + + cx = NSSBase64Decoder_Create(output_binary, outFile); + if (!cx) { + return -1; + } + + for (;;) { + if (feof(inFile)) break; + nb = fread(ibuf, 1, sizeof(ibuf), inFile); + if (nb != sizeof(ibuf)) { + if (nb == 0) { + if (ferror(inFile)) { + PORT_SetError(SEC_ERROR_IO); + goto loser; + } + /* eof */ + break; + } + } + + status = NSSBase64Decoder_Update(cx, ibuf, nb); + if (status != SECSuccess) goto loser; + } + + return NSSBase64Decoder_Destroy(cx, PR_FALSE); + + loser: + (void) NSSBase64Decoder_Destroy(cx, PR_TRUE); + return status; +} + +static void Usage(char *progName) +{ + fprintf(stderr, + "Usage: %s [-i input] [-o output]\n", + progName); + fprintf(stderr, "%-20s Define an input file to use (default is stdin)\n", + "-i input"); + fprintf(stderr, "%-20s Define an output file to use (default is stdout)\n", + "-o output"); + exit(-1); +} + +int main(int argc, char **argv) +{ + char *progName; + SECStatus rv; + FILE *inFile, *outFile; + PLOptState *optstate; + PLOptStatus status; + + inFile = 0; + outFile = 0; + progName = strrchr(argv[0], '/'); + progName = progName ? progName+1 : argv[0]; + + /* Parse command line arguments */ + optstate = PL_CreateOptState(argc, argv, "i:o:"); + while ((status = PL_GetNextOpt(optstate)) == PL_OPT_OK) { + switch (optstate->option) { + case '?': + Usage(progName); + break; + + case 'i': + inFile = fopen(optstate->value, "r"); + if (!inFile) { + fprintf(stderr, "%s: unable to open \"%s\" for reading\n", + progName, optstate->value); + return -1; + } + break; + + case 'o': + outFile = fopen(optstate->value, "wb"); + if (!outFile) { + fprintf(stderr, "%s: unable to open \"%s\" for writing\n", + progName, optstate->value); + return -1; + } + break; + } + } + if (!inFile) inFile = stdin; + if (!outFile) { +#if defined(WIN32) + int smrv = _setmode(_fileno(stdout), _O_BINARY); + if (smrv == -1) { + fprintf(stderr, + "%s: Cannot change stdout to binary mode. Use -o option instead.\n", + progName); + return smrv; + } +#endif + outFile = stdout; + } + rv = decode_file(outFile, inFile); + if (rv != SECSuccess) { + fprintf(stderr, "%s: lossage: error=%d errno=%d\n", + progName, PORT_GetError(), errno); + return -1; + } + return 0; +} diff --git a/mozilla/security/nss/cmd/atob/manifest.mn b/mozilla/security/nss/cmd/atob/manifest.mn new file mode 100644 index 0000000..363cad1 --- /dev/null +++ b/mozilla/security/nss/cmd/atob/manifest.mn @@ -0,0 +1,54 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +CORE_DEPTH = ../../.. + +# MODULE public and private header directories are implicitly REQUIRED. +MODULE = nss + +# This next line is used by .mk files +# and gets translated into $LINCS in manifest.mnw +# The MODULE is always implicitly required. +# Listing it here in REQUIRES makes it appear twice in the cc command line. +REQUIRES = seccmd dbm + +DEFINES = -DNSPR20 + +CSRCS = atob.c + +PROGRAM = atob + diff --git a/mozilla/security/nss/cmd/bltest/Makefile b/mozilla/security/nss/cmd/bltest/Makefile new file mode 100644 index 0000000..115886c --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/Makefile @@ -0,0 +1,86 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn +#MKPROG = purify -cache-dir=/u/mcgreer/pcache -best-effort \ +# -always-use-cache-dir $(CC) + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + +include ../platlibs.mk + +#EXTRA_SHARED_LIBS += \ +# -L/usr/lib \ +# -lposix4 \ +# $(NULL) + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + +include ../platrules.mk diff --git a/mozilla/security/nss/cmd/bltest/blapitest.c b/mozilla/security/nss/cmd/bltest/blapitest.c new file mode 100644 index 0000000..a7a4886 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/blapitest.c @@ -0,0 +1,3971 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Douglas Stebila , Sun Microsystems Laboratories + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include +#include + +#include "blapi.h" +#include "secrng.h" +#include "prmem.h" +#include "prprf.h" +#include "prtime.h" +#include "prsystem.h" +#include "plstr.h" +#include "nssb64.h" +#include "secutil.h" +#include "plgetopt.h" +#include "softoken.h" +#include "nspr.h" +#include "nss.h" +#include "secoid.h" + +#ifdef NSS_ENABLE_ECC +#include "ecl-curve.h" +SECStatus EC_DecodeParams(const SECItem *encodedParams, + ECParams **ecparams); +SECStatus EC_CopyParams(PRArenaPool *arena, ECParams *dstParams, + const ECParams *srcParams); +#endif + +/* Temporary - add debugging output on windows for RSA to track QA failure */ +#ifdef _WIN32 +#define TRACK_BLTEST_BUG + char __bltDBG[] = "BLTEST DEBUG"; +#endif + +char *progName; +char *testdir = NULL; + +#define BLTEST_DEFAULT_CHUNKSIZE 4096 + +#define WORDSIZE sizeof(unsigned long) + +#define CHECKERROR(rv, ln) \ + if (rv) { \ + PRErrorCode prerror = PR_GetError(); \ + PR_fprintf(PR_STDERR, "%s: ERR %d (%s) at line %d.\n", progName, \ + prerror, SECU_Strerror(prerror), ln); \ + exit(-1); \ + } + +/* Macros for performance timing. */ +#define TIMESTART() \ + time1 = PR_IntervalNow(); + +#define TIMEFINISH(time, reps) \ + time2 = (PRIntervalTime)(PR_IntervalNow() - time1); \ + time1 = PR_IntervalToMilliseconds(time2); \ + time = ((double)(time1))/reps; + +#define TIMEMARK(seconds) \ + time1 = PR_SecondsToInterval(seconds); \ + { \ + PRInt64 tmp, L100; \ + LL_I2L(L100, 100); \ + if (time2 == 0) { \ + time2 = 1; \ + } \ + LL_DIV(tmp, time1, time2); \ + if (tmp < 10) { \ + if (tmp == 0) { \ + opsBetweenChecks = 1; \ + } else { \ + LL_L2I(opsBetweenChecks, tmp); \ + } \ + } else { \ + opsBetweenChecks = 10; \ + } \ + } \ + time2 = time1; \ + time1 = PR_IntervalNow(); + +#define TIMETOFINISH() \ + PR_IntervalNow() - time1 >= time2 + +static void Usage() +{ +#define PRINTUSAGE(subject, option, predicate) \ + fprintf(stderr, "%10s %s\t%s\n", subject, option, predicate); + fprintf(stderr, "\n"); + PRINTUSAGE(progName, "[-DEHSVR]", "List available cipher modes"); /* XXX */ + fprintf(stderr, "\n"); + PRINTUSAGE(progName, "-E -m mode ", "Encrypt a buffer"); + PRINTUSAGE("", "", "[-i plaintext] [-o ciphertext] [-k key] [-v iv]"); + PRINTUSAGE("", "", "[-b bufsize] [-g keysize] [-e exp] [-r rounds]"); + PRINTUSAGE("", "", "[-w wordsize] [-p repetitions | -5 time_interval]"); + PRINTUSAGE("", "", "[-4 th_num]"); + PRINTUSAGE("", "-m", "cipher mode to use"); + PRINTUSAGE("", "-i", "file which contains input buffer"); + PRINTUSAGE("", "-o", "file for output buffer"); + PRINTUSAGE("", "-k", "file which contains key"); + PRINTUSAGE("", "-v", "file which contains initialization vector"); + PRINTUSAGE("", "-b", "size of input buffer"); + PRINTUSAGE("", "-g", "key size (in bytes)"); + PRINTUSAGE("", "-p", "do performance test"); + PRINTUSAGE("", "-4", "run test in multithread mode. th_num number of parallel threads"); + PRINTUSAGE("", "-5", "run test for specified time interval(in seconds)"); + PRINTUSAGE("(rsa)", "-e", "rsa public exponent"); + PRINTUSAGE("(rc5)", "-r", "number of rounds"); + PRINTUSAGE("(rc5)", "-w", "wordsize (32 or 64)"); + fprintf(stderr, "\n"); + PRINTUSAGE(progName, "-D -m mode", "Decrypt a buffer"); + PRINTUSAGE("", "", "[-i plaintext] [-o ciphertext] [-k key] [-v iv]"); + PRINTUSAGE("", "", "[-p repetitions | -5 time_interval] [-4 th_num]"); + PRINTUSAGE("", "-m", "cipher mode to use"); + PRINTUSAGE("", "-i", "file which contains input buffer"); + PRINTUSAGE("", "-o", "file for output buffer"); + PRINTUSAGE("", "-k", "file which contains key"); + PRINTUSAGE("", "-v", "file which contains initialization vector"); + PRINTUSAGE("", "-p", "do performance test"); + PRINTUSAGE("", "-4", "run test in multithread mode. th_num number of parallel threads"); + PRINTUSAGE("", "-5", "run test for specified time interval(in seconds)"); + fprintf(stderr, "\n"); + PRINTUSAGE(progName, "-H -m mode", "Hash a buffer"); + PRINTUSAGE("", "", "[-i plaintext] [-o hash]"); + PRINTUSAGE("", "", "[-b bufsize]"); + PRINTUSAGE("", "", "[-p repetitions | -5 time_interval] [-4 th_num]"); + PRINTUSAGE("", "-m", "cipher mode to use"); + PRINTUSAGE("", "-i", "file which contains input buffer"); + PRINTUSAGE("", "-o", "file for hash"); + PRINTUSAGE("", "-b", "size of input buffer"); + PRINTUSAGE("", "-p", "do performance test"); + PRINTUSAGE("", "-4", "run test in multithread mode. th_num number of parallel threads"); + PRINTUSAGE("", "-5", "run test for specified time interval(in seconds)"); + fprintf(stderr, "\n"); + PRINTUSAGE(progName, "-S -m mode", "Sign a buffer"); + PRINTUSAGE("", "", "[-i plaintext] [-o signature] [-k key]"); + PRINTUSAGE("", "", "[-b bufsize]"); +#ifdef NSS_ENABLE_ECC + PRINTUSAGE("", "", "[-n curvename]"); +#endif + PRINTUSAGE("", "", "[-p repetitions | -5 time_interval] [-4 th_num]"); + PRINTUSAGE("", "-m", "cipher mode to use"); + PRINTUSAGE("", "-i", "file which contains input buffer"); + PRINTUSAGE("", "-o", "file for signature"); + PRINTUSAGE("", "-k", "file which contains key"); +#ifdef NSS_ENABLE_ECC + PRINTUSAGE("", "-n", "name of curve for EC key generation; one of:"); + PRINTUSAGE("", "", " sect163k1, nistk163, sect163r1, sect163r2,"); + PRINTUSAGE("", "", " nistb163, sect193r1, sect193r2, sect233k1, nistk233,"); + PRINTUSAGE("", "", " sect233r1, nistb233, sect239k1, sect283k1, nistk283,"); + PRINTUSAGE("", "", " sect283r1, nistb283, sect409k1, nistk409, sect409r1,"); + PRINTUSAGE("", "", " nistb409, sect571k1, nistk571, sect571r1, nistb571,"); + PRINTUSAGE("", "", " secp160k1, secp160r1, secp160r2, secp192k1, secp192r1,"); + PRINTUSAGE("", "", " nistp192, secp224k1, secp224r1, nistp224, secp256k1,"); + PRINTUSAGE("", "", " secp256r1, nistp256, secp384r1, nistp384, secp521r1,"); + PRINTUSAGE("", "", " nistp521, prime192v1, prime192v2, prime192v3,"); + PRINTUSAGE("", "", " prime239v1, prime239v2, prime239v3, c2pnb163v1,"); + PRINTUSAGE("", "", " c2pnb163v2, c2pnb163v3, c2pnb176v1, c2tnb191v1,"); + PRINTUSAGE("", "", " c2tnb191v2, c2tnb191v3, c2onb191v4, c2onb191v5,"); + PRINTUSAGE("", "", " c2pnb208w1, c2tnb239v1, c2tnb239v2, c2tnb239v3,"); + PRINTUSAGE("", "", " c2onb239v4, c2onb239v5, c2pnb272w1, c2pnb304w1,"); + PRINTUSAGE("", "", " c2tnb359w1, c2pnb368w1, c2tnb431r1, secp112r1,"); + PRINTUSAGE("", "", " secp112r2, secp128r1, secp128r2, sect113r1, sect113r2,"); + PRINTUSAGE("", "", " sect131r1, sect131r2"); +#endif + PRINTUSAGE("", "-p", "do performance test"); + PRINTUSAGE("", "-4", "run test in multithread mode. th_num number of parallel threads"); + PRINTUSAGE("", "-5", "run test for specified time interval(in seconds)"); + fprintf(stderr, "\n"); + PRINTUSAGE(progName, "-V -m mode", "Verify a signed buffer"); + PRINTUSAGE("", "", "[-i plaintext] [-s signature] [-k key]"); + PRINTUSAGE("", "", "[-p repetitions | -5 time_interval] [-4 th_num]"); + PRINTUSAGE("", "-m", "cipher mode to use"); + PRINTUSAGE("", "-i", "file which contains input buffer"); + PRINTUSAGE("", "-s", "file which contains signature of input buffer"); + PRINTUSAGE("", "-k", "file which contains key"); + PRINTUSAGE("", "-p", "do performance test"); + PRINTUSAGE("", "-4", "run test in multithread mode. th_num number of parallel threads"); + PRINTUSAGE("", "-5", "run test for specified time interval(in seconds)"); + fprintf(stderr, "\n"); + PRINTUSAGE(progName, "-N -m mode -b bufsize", + "Create a nonce plaintext and key"); + PRINTUSAGE("", "", "[-g keysize] [-u cxreps]"); + PRINTUSAGE("", "-g", "key size (in bytes)"); + PRINTUSAGE("", "-u", "number of repetitions of context creation"); + fprintf(stderr, "\n"); + PRINTUSAGE(progName, "-R [-g keysize] [-e exp]", + "Test the RSA populate key function"); + PRINTUSAGE("", "", "[-r repetitions]"); + PRINTUSAGE("", "-g", "key size (in bytes)"); + PRINTUSAGE("", "-e", "rsa public exponent"); + PRINTUSAGE("", "-r", "repetitions of the test"); + fprintf(stderr, "\n"); + PRINTUSAGE(progName, "-F", "Run the FIPS self-test"); + fprintf(stderr, "\n"); + PRINTUSAGE(progName, "-T [-m mode1,mode2...]", "Run the BLAPI self-test"); + fprintf(stderr, "\n"); + exit(1); +} + +/* Helper functions for ascii<-->binary conversion/reading/writing */ + +/* XXX argh */ +struct item_with_arena { + SECItem *item; + PRArenaPool *arena; +}; + +static PRInt32 +get_binary(void *arg, const unsigned char *ibuf, PRInt32 size) +{ + struct item_with_arena *it = arg; + SECItem *binary = it->item; + SECItem *tmp; + int index; + if (binary->data == NULL) { + tmp = SECITEM_AllocItem(it->arena, NULL, size); + binary->data = tmp->data; + binary->len = tmp->len; + index = 0; + } else { + SECITEM_ReallocItem(NULL, binary, binary->len, binary->len + size); + index = binary->len; + } + PORT_Memcpy(&binary->data[index], ibuf, size); + return binary->len; +} + +static SECStatus +atob(SECItem *ascii, SECItem *binary, PRArenaPool *arena) +{ + SECStatus status; + NSSBase64Decoder *cx; + struct item_with_arena it; + int len; + binary->data = NULL; + binary->len = 0; + it.item = binary; + it.arena = arena; + len = (strncmp(&ascii->data[ascii->len-2],"\r\n",2)) ? + ascii->len : ascii->len-2; + cx = NSSBase64Decoder_Create(get_binary, &it); + status = NSSBase64Decoder_Update(cx, (const char *)ascii->data, len); + status = NSSBase64Decoder_Destroy(cx, PR_FALSE); + return status; +} + +static PRInt32 +output_ascii(void *arg, const char *obuf, PRInt32 size) +{ + PRFileDesc *outfile = arg; + PRInt32 nb = PR_Write(outfile, obuf, size); + if (nb != size) { + PORT_SetError(SEC_ERROR_IO); + return -1; + } + return nb; +} + +static SECStatus +btoa_file(SECItem *binary, PRFileDesc *outfile) +{ + SECStatus status; + NSSBase64Encoder *cx; + SECItem ascii; + ascii.data = NULL; + ascii.len = 0; + if (binary->len == 0) + return SECSuccess; + cx = NSSBase64Encoder_Create(output_ascii, outfile); + status = NSSBase64Encoder_Update(cx, binary->data, binary->len); + status = NSSBase64Encoder_Destroy(cx, PR_FALSE); + status = PR_Write(outfile, "\r\n", 2); + return status; +} + +SECStatus +hex_from_2char(unsigned char *c2, unsigned char *byteval) +{ + int i; + unsigned char offset; + *byteval = 0; + for (i=0; i<2; i++) { + if (c2[i] >= '0' && c2[i] <= '9') { + offset = c2[i] - '0'; + *byteval |= offset << 4*(1-i); + } else if (c2[i] >= 'a' && c2[i] <= 'f') { + offset = c2[i] - 'a'; + *byteval |= (offset + 10) << 4*(1-i); + } else if (c2[i] >= 'A' && c2[i] <= 'F') { + offset = c2[i] - 'A'; + *byteval |= (offset + 10) << 4*(1-i); + } else { + return SECFailure; + } + } + return SECSuccess; +} + +SECStatus +char2_from_hex(unsigned char byteval, unsigned char *c2) +{ + int i; + unsigned char offset; + for (i=0; i<2; i++) { + offset = (byteval >> 4*(1-i)) & 0x0f; + if (offset < 10) { + c2[i] = '0' + offset; + } else { + c2[i] = 'A' + offset - 10; + } + } + return SECSuccess; +} + +void +serialize_key(SECItem *it, int ni, PRFileDesc *file) +{ + unsigned char len[4]; + int i; + SECStatus status; + NSSBase64Encoder *cx; + SECItem ascii; + ascii.data = NULL; + ascii.len = 0; + cx = NSSBase64Encoder_Create(output_ascii, file); + for (i=0; ilen >> 24) & 0xff; + len[1] = (it->len >> 16) & 0xff; + len[2] = (it->len >> 8) & 0xff; + len[3] = (it->len & 0xff); + status = NSSBase64Encoder_Update(cx, len, 4); + status = NSSBase64Encoder_Update(cx, it->data, it->len); + } + status = NSSBase64Encoder_Destroy(cx, PR_FALSE); + status = PR_Write(file, "\r\n", 2); +} + +void +key_from_filedata(PRArenaPool *arena, SECItem *it, int ns, int ni, SECItem *filedata) +{ + int fpos = 0; + int i, len; + unsigned char *buf = filedata->data; + for (i=0; i 0) { + it->len = len; + it->data = PORT_ArenaAlloc(arena, it->len); + PORT_Memcpy(it->data, &buf[fpos], it->len); + } else { + it->len = 0; + it->data = NULL; + } + it++; + } + fpos += len; + } +} + +static RSAPrivateKey * +rsakey_from_filedata(SECItem *filedata) +{ + RSAPrivateKey *key; + PRArenaPool *arena; + arena = PORT_NewArena(BLTEST_DEFAULT_CHUNKSIZE); + key = (RSAPrivateKey *)PORT_ArenaZAlloc(arena, sizeof(RSAPrivateKey)); + key->arena = arena; + key_from_filedata(arena, &key->version, 0, 9, filedata); + return key; +} + +static PQGParams * +pqg_from_filedata(SECItem *filedata) +{ + PQGParams *pqg; + PRArenaPool *arena; + arena = PORT_NewArena(BLTEST_DEFAULT_CHUNKSIZE); + pqg = (PQGParams *)PORT_ArenaZAlloc(arena, sizeof(PQGParams)); + pqg->arena = arena; + key_from_filedata(arena, &pqg->prime, 0, 3, filedata); + return pqg; +} + +static DSAPrivateKey * +dsakey_from_filedata(SECItem *filedata) +{ + DSAPrivateKey *key; + PRArenaPool *arena; + arena = PORT_NewArena(BLTEST_DEFAULT_CHUNKSIZE); + key = (DSAPrivateKey *)PORT_ArenaZAlloc(arena, sizeof(DSAPrivateKey)); + key->params.arena = arena; + key_from_filedata(arena, &key->params.prime, 0, 5, filedata); + return key; +} + +#ifdef NSS_ENABLE_ECC +static ECPrivateKey * +eckey_from_filedata(SECItem *filedata) +{ + ECPrivateKey *key; + PRArenaPool *arena; + SECStatus rv; + ECParams *tmpECParams = NULL; + arena = PORT_NewArena(BLTEST_DEFAULT_CHUNKSIZE); + key = (ECPrivateKey *)PORT_ArenaZAlloc(arena, sizeof(ECPrivateKey)); + /* read and convert params */ + key->ecParams.arena = arena; + key_from_filedata(arena, &key->ecParams.DEREncoding, 0, 1, filedata); + rv = SECOID_Init(); + CHECKERROR(rv, __LINE__); + rv = EC_DecodeParams(&key->ecParams.DEREncoding, &tmpECParams); + CHECKERROR(rv, __LINE__); + rv = EC_CopyParams(key->ecParams.arena, &key->ecParams, tmpECParams); + CHECKERROR(rv, __LINE__); + rv = SECOID_Shutdown(); + CHECKERROR(rv, __LINE__); + PORT_FreeArena(tmpECParams->arena, PR_TRUE); + /* read key */ + key_from_filedata(arena, &key->publicValue, 1, 3, filedata); + return key; +} + +typedef struct curveNameTagPairStr { + char *curveName; + SECOidTag curveOidTag; +} CurveNameTagPair; + +#define DEFAULT_CURVE_OID_TAG SEC_OID_SECG_EC_SECP192R1 +/* #define DEFAULT_CURVE_OID_TAG SEC_OID_SECG_EC_SECP160R1 */ + +static CurveNameTagPair nameTagPair[] = +{ + { "sect163k1", SEC_OID_SECG_EC_SECT163K1}, + { "nistk163", SEC_OID_SECG_EC_SECT163K1}, + { "sect163r1", SEC_OID_SECG_EC_SECT163R1}, + { "sect163r2", SEC_OID_SECG_EC_SECT163R2}, + { "nistb163", SEC_OID_SECG_EC_SECT163R2}, + { "sect193r1", SEC_OID_SECG_EC_SECT193R1}, + { "sect193r2", SEC_OID_SECG_EC_SECT193R2}, + { "sect233k1", SEC_OID_SECG_EC_SECT233K1}, + { "nistk233", SEC_OID_SECG_EC_SECT233K1}, + { "sect233r1", SEC_OID_SECG_EC_SECT233R1}, + { "nistb233", SEC_OID_SECG_EC_SECT233R1}, + { "sect239k1", SEC_OID_SECG_EC_SECT239K1}, + { "sect283k1", SEC_OID_SECG_EC_SECT283K1}, + { "nistk283", SEC_OID_SECG_EC_SECT283K1}, + { "sect283r1", SEC_OID_SECG_EC_SECT283R1}, + { "nistb283", SEC_OID_SECG_EC_SECT283R1}, + { "sect409k1", SEC_OID_SECG_EC_SECT409K1}, + { "nistk409", SEC_OID_SECG_EC_SECT409K1}, + { "sect409r1", SEC_OID_SECG_EC_SECT409R1}, + { "nistb409", SEC_OID_SECG_EC_SECT409R1}, + { "sect571k1", SEC_OID_SECG_EC_SECT571K1}, + { "nistk571", SEC_OID_SECG_EC_SECT571K1}, + { "sect571r1", SEC_OID_SECG_EC_SECT571R1}, + { "nistb571", SEC_OID_SECG_EC_SECT571R1}, + { "secp160k1", SEC_OID_SECG_EC_SECP160K1}, + { "secp160r1", SEC_OID_SECG_EC_SECP160R1}, + { "secp160r2", SEC_OID_SECG_EC_SECP160R2}, + { "secp192k1", SEC_OID_SECG_EC_SECP192K1}, + { "secp192r1", SEC_OID_SECG_EC_SECP192R1}, + { "nistp192", SEC_OID_SECG_EC_SECP192R1}, + { "secp224k1", SEC_OID_SECG_EC_SECP224K1}, + { "secp224r1", SEC_OID_SECG_EC_SECP224R1}, + { "nistp224", SEC_OID_SECG_EC_SECP224R1}, + { "secp256k1", SEC_OID_SECG_EC_SECP256K1}, + { "secp256r1", SEC_OID_SECG_EC_SECP256R1}, + { "nistp256", SEC_OID_SECG_EC_SECP256R1}, + { "secp384r1", SEC_OID_SECG_EC_SECP384R1}, + { "nistp384", SEC_OID_SECG_EC_SECP384R1}, + { "secp521r1", SEC_OID_SECG_EC_SECP521R1}, + { "nistp521", SEC_OID_SECG_EC_SECP521R1}, + + { "prime192v1", SEC_OID_ANSIX962_EC_PRIME192V1 }, + { "prime192v2", SEC_OID_ANSIX962_EC_PRIME192V2 }, + { "prime192v3", SEC_OID_ANSIX962_EC_PRIME192V3 }, + { "prime239v1", SEC_OID_ANSIX962_EC_PRIME239V1 }, + { "prime239v2", SEC_OID_ANSIX962_EC_PRIME239V2 }, + { "prime239v3", SEC_OID_ANSIX962_EC_PRIME239V3 }, + + { "c2pnb163v1", SEC_OID_ANSIX962_EC_C2PNB163V1 }, + { "c2pnb163v2", SEC_OID_ANSIX962_EC_C2PNB163V2 }, + { "c2pnb163v3", SEC_OID_ANSIX962_EC_C2PNB163V3 }, + { "c2pnb176v1", SEC_OID_ANSIX962_EC_C2PNB176V1 }, + { "c2tnb191v1", SEC_OID_ANSIX962_EC_C2TNB191V1 }, + { "c2tnb191v2", SEC_OID_ANSIX962_EC_C2TNB191V2 }, + { "c2tnb191v3", SEC_OID_ANSIX962_EC_C2TNB191V3 }, + { "c2onb191v4", SEC_OID_ANSIX962_EC_C2ONB191V4 }, + { "c2onb191v5", SEC_OID_ANSIX962_EC_C2ONB191V5 }, + { "c2pnb208w1", SEC_OID_ANSIX962_EC_C2PNB208W1 }, + { "c2tnb239v1", SEC_OID_ANSIX962_EC_C2TNB239V1 }, + { "c2tnb239v2", SEC_OID_ANSIX962_EC_C2TNB239V2 }, + { "c2tnb239v3", SEC_OID_ANSIX962_EC_C2TNB239V3 }, + { "c2onb239v4", SEC_OID_ANSIX962_EC_C2ONB239V4 }, + { "c2onb239v5", SEC_OID_ANSIX962_EC_C2ONB239V5 }, + { "c2pnb272w1", SEC_OID_ANSIX962_EC_C2PNB272W1 }, + { "c2pnb304w1", SEC_OID_ANSIX962_EC_C2PNB304W1 }, + { "c2tnb359v1", SEC_OID_ANSIX962_EC_C2TNB359V1 }, + { "c2pnb368w1", SEC_OID_ANSIX962_EC_C2PNB368W1 }, + { "c2tnb431r1", SEC_OID_ANSIX962_EC_C2TNB431R1 }, + + { "secp112r1", SEC_OID_SECG_EC_SECP112R1}, + { "secp112r2", SEC_OID_SECG_EC_SECP112R2}, + { "secp128r1", SEC_OID_SECG_EC_SECP128R1}, + { "secp128r2", SEC_OID_SECG_EC_SECP128R2}, + + { "sect113r1", SEC_OID_SECG_EC_SECT113R1}, + { "sect113r2", SEC_OID_SECG_EC_SECT113R2}, + { "sect131r1", SEC_OID_SECG_EC_SECT131R1}, + { "sect131r2", SEC_OID_SECG_EC_SECT131R2}, +}; + +static SECKEYECParams * +getECParams(const char *curve) +{ + SECKEYECParams *ecparams; + SECOidData *oidData = NULL; + SECOidTag curveOidTag = SEC_OID_UNKNOWN; /* default */ + int i, numCurves; + + if (curve != NULL) { + numCurves = sizeof(nameTagPair)/sizeof(CurveNameTagPair); + for (i = 0; ((i < numCurves) && (curveOidTag == SEC_OID_UNKNOWN)); + i++) { + if (PL_strcmp(curve, nameTagPair[i].curveName) == 0) + curveOidTag = nameTagPair[i].curveOidTag; + } + } + + /* Return NULL if curve name is not recognized */ + if ((curveOidTag == SEC_OID_UNKNOWN) || + (oidData = SECOID_FindOIDByTag(curveOidTag)) == NULL) { + fprintf(stderr, "Unrecognized elliptic curve %s\n", curve); + return NULL; + } + + ecparams = SECITEM_AllocItem(NULL, NULL, (2 + oidData->oid.len)); + + /* + * ecparams->data needs to contain the ASN encoding of an object ID (OID) + * representing the named curve. The actual OID is in + * oidData->oid.data so we simply prepend 0x06 and OID length + */ + ecparams->data[0] = SEC_ASN1_OBJECT_ID; + ecparams->data[1] = oidData->oid.len; + memcpy(ecparams->data + 2, oidData->oid.data, oidData->oid.len); + + return ecparams; +} +#endif /* NSS_ENABLE_ECC */ + +static void +dump_pqg(PQGParams *pqg) +{ + SECU_PrintInteger(stdout, &pqg->prime, "PRIME:", 0); + SECU_PrintInteger(stdout, &pqg->subPrime, "SUBPRIME:", 0); + SECU_PrintInteger(stdout, &pqg->base, "BASE:", 0); +} + +static void +dump_dsakey(DSAPrivateKey *key) +{ + dump_pqg(&key->params); + SECU_PrintInteger(stdout, &key->publicValue, "PUBLIC VALUE:", 0); + SECU_PrintInteger(stdout, &key->privateValue, "PRIVATE VALUE:", 0); +} + +#ifdef NSS_ENABLE_ECC +static void +dump_ecp(ECParams *ecp) +{ + /* TODO other fields */ + SECU_PrintInteger(stdout, &ecp->base, "BASE POINT:", 0); +} + +static void +dump_eckey(ECPrivateKey *key) +{ + dump_ecp(&key->ecParams); + SECU_PrintInteger(stdout, &key->publicValue, "PUBLIC VALUE:", 0); + SECU_PrintInteger(stdout, &key->privateValue, "PRIVATE VALUE:", 0); +} +#endif + +static void +dump_rsakey(RSAPrivateKey *key) +{ + SECU_PrintInteger(stdout, &key->version, "VERSION:", 0); + SECU_PrintInteger(stdout, &key->modulus, "MODULUS:", 0); + SECU_PrintInteger(stdout, &key->publicExponent, "PUBLIC EXP:", 0); + SECU_PrintInteger(stdout, &key->privateExponent, "PRIVATE EXP:", 0); + SECU_PrintInteger(stdout, &key->prime1, "CRT PRIME 1:", 0); + SECU_PrintInteger(stdout, &key->prime2, "CRT PRIME 2:", 0); + SECU_PrintInteger(stdout, &key->exponent1, "CRT EXP 1:", 0); + SECU_PrintInteger(stdout, &key->exponent2, "CRT EXP 2:", 0); + SECU_PrintInteger(stdout, &key->coefficient, "CRT COEFFICIENT:", 0); +} + +typedef enum { + bltestBase64Encoded, /* Base64 encoded ASCII */ + bltestBinary, /* straight binary */ + bltestHexSpaceDelim, /* 0x12 0x34 0xab 0xCD ... */ + bltestHexStream /* 1234abCD ... */ +} bltestIOMode; + +typedef struct +{ + SECItem buf; + SECItem pBuf; + bltestIOMode mode; + PRFileDesc* file; +} bltestIO; + +typedef SECStatus (* bltestSymmCipherFn)(void *cx, + unsigned char *output, + unsigned int *outputLen, + unsigned int maxOutputLen, + const unsigned char *input, + unsigned int inputLen); + +typedef SECStatus (* bltestPubKeyCipherFn)(void *key, + SECItem *output, + const SECItem *input); + +typedef SECStatus (* bltestHashCipherFn)(unsigned char *dest, + const unsigned char *src, + uint32 src_length); + +typedef enum { + bltestINVALID = -1, + bltestDES_ECB, /* Symmetric Key Ciphers */ + bltestDES_CBC, /* . */ + bltestDES_EDE_ECB, /* . */ + bltestDES_EDE_CBC, /* . */ + bltestRC2_ECB, /* . */ + bltestRC2_CBC, /* . */ + bltestRC4, /* . */ +#ifdef NSS_SOFTOKEN_DOES_RC5 + bltestRC5_ECB, /* . */ + bltestRC5_CBC, /* . */ +#endif + bltestAES_ECB, /* . */ + bltestAES_CBC, /* . */ + bltestCAMELLIA_ECB, /* . */ + bltestCAMELLIA_CBC, /* . */ + bltestSEED_ECB, /* SEED algorithm */ + bltestSEED_CBC, /* SEED algorithm */ + bltestRSA, /* Public Key Ciphers */ +#ifdef NSS_ENABLE_ECC + bltestECDSA, /* . (Public Key Sig.) */ +#endif + bltestDSA, /* . */ + bltestMD2, /* Hash algorithms */ + bltestMD5, /* . */ + bltestSHA1, /* . */ + bltestSHA256, /* . */ + bltestSHA384, /* . */ + bltestSHA512, /* . */ + NUMMODES +} bltestCipherMode; + +static char *mode_strings[] = +{ + "des_ecb", + "des_cbc", + "des3_ecb", + "des3_cbc", + "rc2_ecb", + "rc2_cbc", + "rc4", +#ifdef NSS_SOFTOKEN_DOES_RC5 + "rc5_ecb", + "rc5_cbc", +#endif + "aes_ecb", + "aes_cbc", + "camellia_ecb", + "camellia_cbc", + "seed_ecb", + "seed_cbc", + "rsa", +#ifdef NSS_ENABLE_ECC + "ecdsa", +#endif + /*"pqg",*/ + "dsa", + "md2", + "md5", + "sha1", + "sha256", + "sha384", + "sha512", +}; + +typedef struct +{ + bltestIO key; + bltestIO iv; +} bltestSymmKeyParams; + +typedef struct +{ + bltestIO key; + bltestIO iv; + int rounds; + int wordsize; +} bltestRC5Params; + +typedef struct +{ + bltestIO key; + int keysizeInBits; + RSAPrivateKey *rsakey; +} bltestRSAParams; + +typedef struct +{ + bltestIO key; + bltestIO pqgdata; + unsigned int j; + bltestIO keyseed; + bltestIO sigseed; + bltestIO sig; /* if doing verify, have additional input */ + PQGParams *pqg; + DSAPrivateKey *dsakey; +} bltestDSAParams; + +#ifdef NSS_ENABLE_ECC +typedef struct +{ + bltestIO key; + char *curveName; + bltestIO sigseed; + bltestIO sig; /* if doing verify, have additional input */ + ECPrivateKey *eckey; +} bltestECDSAParams; +#endif + +typedef struct +{ + bltestIO key; /* unused */ + PRBool restart; +} bltestHashParams; + +typedef union +{ + bltestIO key; + bltestSymmKeyParams sk; + bltestRC5Params rc5; + bltestRSAParams rsa; + bltestDSAParams dsa; +#ifdef NSS_ENABLE_ECC + bltestECDSAParams ecdsa; +#endif + bltestHashParams hash; +} bltestParams; + +typedef struct bltestCipherInfoStr bltestCipherInfo; + +struct bltestCipherInfoStr { + PRArenaPool *arena; + /* link to next in multithreaded test */ + bltestCipherInfo *next; + PRThread *cipherThread; + + /* MonteCarlo test flag*/ + PRBool mCarlo; + /* cipher context */ + void *cx; + /* I/O streams */ + bltestIO input; + bltestIO output; + /* Cipher-specific parameters */ + bltestParams params; + /* Cipher mode */ + bltestCipherMode mode; + /* Cipher function (encrypt/decrypt/sign/verify/hash) */ + union { + bltestSymmCipherFn symmkeyCipher; + bltestPubKeyCipherFn pubkeyCipher; + bltestHashCipherFn hashCipher; + } cipher; + /* performance testing */ + int repetitionsToPerfom; + int seconds; + int repetitions; + int cxreps; + double cxtime; + double optime; +}; + +PRBool +is_symmkeyCipher(bltestCipherMode mode) +{ + /* change as needed! */ + if (mode >= bltestDES_ECB && mode <= bltestSEED_CBC) + return PR_TRUE; + return PR_FALSE; +} + +PRBool +is_pubkeyCipher(bltestCipherMode mode) +{ + /* change as needed! */ + if (mode >= bltestRSA && mode <= bltestDSA) + return PR_TRUE; + return PR_FALSE; +} + +PRBool +is_hashCipher(bltestCipherMode mode) +{ + /* change as needed! */ + if (mode >= bltestMD2 && mode <= bltestSHA512) + return PR_TRUE; + return PR_FALSE; +} + +PRBool +is_sigCipher(bltestCipherMode mode) +{ + /* change as needed! */ +#ifdef NSS_ENABLE_ECC + if (mode >= bltestECDSA && mode <= bltestDSA) +#else + if (mode >= bltestDSA && mode <= bltestDSA) +#endif + return PR_TRUE; + return PR_FALSE; +} + +PRBool +cipher_requires_IV(bltestCipherMode mode) +{ + /* change as needed! */ + if (mode == bltestDES_CBC || mode == bltestDES_EDE_CBC || + mode == bltestRC2_CBC || +#ifdef NSS_SOFTOKEN_DOES_RC5 + mode == bltestRC5_CBC || +#endif + mode == bltestAES_CBC || mode == bltestCAMELLIA_CBC|| + mode == bltestSEED_CBC) + return PR_TRUE; + return PR_FALSE; +} + +SECStatus finishIO(bltestIO *output, PRFileDesc *file); + +SECStatus +setupIO(PRArenaPool *arena, bltestIO *input, PRFileDesc *file, + char *str, int numBytes) +{ + SECStatus rv = SECSuccess; + SECItem fileData; + SECItem *in; + unsigned char *tok; + unsigned int i, j; + + if (file && (numBytes == 0 || file == PR_STDIN)) { + /* grabbing data from a file */ + rv = SECU_FileToItem(&fileData, file); + if (rv != SECSuccess) { + PR_Close(file); + return SECFailure; + } + in = &fileData; + } else if (str) { + /* grabbing data from command line */ + fileData.data = str; + fileData.len = PL_strlen(str); + in = &fileData; + } else if (file) { + /* create nonce */ + SECITEM_AllocItem(arena, &input->buf, numBytes); + RNG_GenerateGlobalRandomBytes(input->buf.data, numBytes); + return finishIO(input, file); + } else { + return SECFailure; + } + + switch (input->mode) { + case bltestBase64Encoded: + rv = atob(in, &input->buf, arena); + break; + case bltestBinary: + if (in->data[in->len-1] == '\n') --in->len; + if (in->data[in->len-1] == '\r') --in->len; + SECITEM_CopyItem(arena, &input->buf, in); + break; + case bltestHexSpaceDelim: + SECITEM_AllocItem(arena, &input->buf, in->len/5); + for (i=0, j=0; ilen; i+=5, j++) { + tok = &in->data[i]; + if (tok[0] != '0' || tok[1] != 'x' || tok[4] != ' ') + /* bad hex token */ + break; + + rv = hex_from_2char(&tok[2], input->buf.data + j); + if (rv) + break; + } + break; + case bltestHexStream: + SECITEM_AllocItem(arena, &input->buf, in->len/2); + for (i=0, j=0; ilen; i+=2, j++) { + tok = &in->data[i]; + rv = hex_from_2char(tok, input->buf.data + j); + if (rv) + break; + } + break; + } + + if (file) + SECITEM_FreeItem(&fileData, PR_FALSE); + return rv; +} + +SECStatus +finishIO(bltestIO *output, PRFileDesc *file) +{ + SECStatus rv = SECSuccess; + PRInt32 nb; + unsigned char byteval; + SECItem *it; + char hexstr[5]; + unsigned int i; + if (output->pBuf.len > 0) { + it = &output->pBuf; + } else { + it = &output->buf; + } + switch (output->mode) { + case bltestBase64Encoded: + rv = btoa_file(it, file); + break; + case bltestBinary: + nb = PR_Write(file, it->data, it->len); + rv = (nb == (PRInt32)it->len) ? SECSuccess : SECFailure; + break; + case bltestHexSpaceDelim: + hexstr[0] = '0'; + hexstr[1] = 'x'; + hexstr[4] = ' '; + for (i=0; ilen; i++) { + byteval = it->data[i]; + rv = char2_from_hex(byteval, hexstr + 2); + nb = PR_Write(file, hexstr, 5); + if (rv) + break; + } + PR_Write(file, "\n", 1); + break; + case bltestHexStream: + for (i=0; ilen; i++) { + byteval = it->data[i]; + rv = char2_from_hex(byteval, hexstr); + if (rv) + break; + nb = PR_Write(file, hexstr, 2); + } + PR_Write(file, "\n", 1); + break; + } + return rv; +} + +void +bltestCopyIO(PRArenaPool *arena, bltestIO *dest, bltestIO *src) +{ + SECITEM_CopyItem(arena, &dest->buf, &src->buf); + if (src->pBuf.len > 0) { + dest->pBuf.len = src->pBuf.len; + dest->pBuf.data = dest->buf.data + (src->pBuf.data - src->buf.data); + } + dest->mode = src->mode; + dest->file = src->file; +} + +void +misalignBuffer(PRArenaPool *arena, bltestIO *io, int off) +{ + ptrdiff_t offset = (ptrdiff_t)io->buf.data % WORDSIZE; + int length = io->buf.len; + if (offset != off) { + SECITEM_ReallocItem(arena, &io->buf, length, length + 2*WORDSIZE); + io->buf.len = length + 2*WORDSIZE; /* why doesn't realloc do this? */ + /* offset may have changed? */ + offset = (ptrdiff_t)io->buf.data % WORDSIZE; + if (offset != off) { + memmove(io->buf.data + off, io->buf.data, length); + io->pBuf.data = io->buf.data + off; + io->pBuf.len = length; + } else { + io->pBuf.data = io->buf.data; + io->pBuf.len = length; + } + } else { + io->pBuf.data = io->buf.data; + io->pBuf.len = length; + } +} + +SECStatus +des_Encrypt(void *cx, unsigned char *output, unsigned int *outputLen, + unsigned int maxOutputLen, const unsigned char *input, + unsigned int inputLen) +{ + return DES_Encrypt((DESContext *)cx, output, outputLen, maxOutputLen, + input, inputLen); +} + +SECStatus +des_Decrypt(void *cx, unsigned char *output, unsigned int *outputLen, + unsigned int maxOutputLen, const unsigned char *input, + unsigned int inputLen) +{ + return DES_Decrypt((DESContext *)cx, output, outputLen, maxOutputLen, + input, inputLen); +} + +SECStatus +rc2_Encrypt(void *cx, unsigned char *output, unsigned int *outputLen, + unsigned int maxOutputLen, const unsigned char *input, + unsigned int inputLen) +{ + return RC2_Encrypt((RC2Context *)cx, output, outputLen, maxOutputLen, + input, inputLen); +} + +SECStatus +rc2_Decrypt(void *cx, unsigned char *output, unsigned int *outputLen, + unsigned int maxOutputLen, const unsigned char *input, + unsigned int inputLen) +{ + return RC2_Decrypt((RC2Context *)cx, output, outputLen, maxOutputLen, + input, inputLen); +} + +SECStatus +rc4_Encrypt(void *cx, unsigned char *output, unsigned int *outputLen, + unsigned int maxOutputLen, const unsigned char *input, + unsigned int inputLen) +{ + return RC4_Encrypt((RC4Context *)cx, output, outputLen, maxOutputLen, + input, inputLen); +} + +SECStatus +rc4_Decrypt(void *cx, unsigned char *output, unsigned int *outputLen, + unsigned int maxOutputLen, const unsigned char *input, + unsigned int inputLen) +{ + return RC4_Decrypt((RC4Context *)cx, output, outputLen, maxOutputLen, + input, inputLen); +} + +SECStatus +aes_Encrypt(void *cx, unsigned char *output, unsigned int *outputLen, + unsigned int maxOutputLen, const unsigned char *input, + unsigned int inputLen) +{ + return AES_Encrypt((AESContext *)cx, output, outputLen, maxOutputLen, + input, inputLen); +} + +SECStatus +aes_Decrypt(void *cx, unsigned char *output, unsigned int *outputLen, + unsigned int maxOutputLen, const unsigned char *input, + unsigned int inputLen) +{ + return AES_Decrypt((AESContext *)cx, output, outputLen, maxOutputLen, + input, inputLen); +} + +SECStatus +camellia_Encrypt(void *cx, unsigned char *output, unsigned int *outputLen, + unsigned int maxOutputLen, const unsigned char *input, + unsigned int inputLen) +{ + return Camellia_Encrypt((CamelliaContext *)cx, output, outputLen, + maxOutputLen, + input, inputLen); +} + +SECStatus +camellia_Decrypt(void *cx, unsigned char *output, unsigned int *outputLen, + unsigned int maxOutputLen, const unsigned char *input, + unsigned int inputLen) +{ + return Camellia_Decrypt((CamelliaContext *)cx, output, outputLen, + maxOutputLen, + input, inputLen); +} + +SECStatus +seed_Encrypt(void *cx, unsigned char *output, unsigned int *outputLen, + unsigned int maxOutputLen, const unsigned char *input, + unsigned int inputLen) +{ + return SEED_Encrypt((SEEDContext *)cx, output, outputLen, maxOutputLen, + input, inputLen); +} + +SECStatus +seed_Decrypt(void *cx, unsigned char *output, unsigned int *outputLen, + unsigned int maxOutputLen, const unsigned char *input, + unsigned int inputLen) +{ + return SEED_Decrypt((SEEDContext *)cx, output, outputLen, maxOutputLen, + input, inputLen); +} + +SECStatus +rsa_PublicKeyOp(void *key, SECItem *output, const SECItem *input) +{ + return RSA_PublicKeyOp((RSAPublicKey *)key, output->data, input->data); +} + +SECStatus +rsa_PrivateKeyOp(void *key, SECItem *output, const SECItem *input) +{ + return RSA_PrivateKeyOp((RSAPrivateKey *)key, output->data, input->data); +} + +SECStatus +dsa_signDigest(void *key, SECItem *output, const SECItem *input) +{ + return DSA_SignDigest((DSAPrivateKey *)key, output, input); +} + +SECStatus +dsa_verifyDigest(void *key, SECItem *output, const SECItem *input) +{ + return DSA_VerifyDigest((DSAPublicKey *)key, output, input); +} + +#ifdef NSS_ENABLE_ECC +SECStatus +ecdsa_signDigest(void *key, SECItem *output, const SECItem *input) +{ + return ECDSA_SignDigest((ECPrivateKey *)key, output, input); +} + +SECStatus +ecdsa_verifyDigest(void *key, SECItem *output, const SECItem *input) +{ + return ECDSA_VerifyDigest((ECPublicKey *)key, output, input); +} +#endif + +SECStatus +bltest_des_init(bltestCipherInfo *cipherInfo, PRBool encrypt) +{ + PRIntervalTime time1, time2; + bltestSymmKeyParams *desp = &cipherInfo->params.sk; + int minorMode; + int i; + switch (cipherInfo->mode) { + case bltestDES_ECB: minorMode = NSS_DES; break; + case bltestDES_CBC: minorMode = NSS_DES_CBC; break; + case bltestDES_EDE_ECB: minorMode = NSS_DES_EDE3; break; + case bltestDES_EDE_CBC: minorMode = NSS_DES_EDE3_CBC; break; + default: + return SECFailure; + } + cipherInfo->cx = (void*)DES_CreateContext(desp->key.buf.data, + desp->iv.buf.data, + minorMode, encrypt); + if (cipherInfo->cxreps > 0) { + DESContext **dummycx; + dummycx = PORT_Alloc(cipherInfo->cxreps * sizeof(DESContext *)); + TIMESTART(); + for (i=0; icxreps; i++) { + dummycx[i] = (void*)DES_CreateContext(desp->key.buf.data, + desp->iv.buf.data, + minorMode, encrypt); + } + TIMEFINISH(cipherInfo->cxtime, 1.0); + for (i=0; icxreps; i++) { + DES_DestroyContext(dummycx[i], PR_TRUE); + } + PORT_Free(dummycx); + } + if (encrypt) + cipherInfo->cipher.symmkeyCipher = des_Encrypt; + else + cipherInfo->cipher.symmkeyCipher = des_Decrypt; + return SECSuccess; +} + +SECStatus +bltest_rc2_init(bltestCipherInfo *cipherInfo, PRBool encrypt) +{ + PRIntervalTime time1, time2; + bltestSymmKeyParams *rc2p = &cipherInfo->params.sk; + int minorMode; + int i; + switch (cipherInfo->mode) { + case bltestRC2_ECB: minorMode = NSS_RC2; break; + case bltestRC2_CBC: minorMode = NSS_RC2_CBC; break; + default: + return SECFailure; + } + cipherInfo->cx = (void*)RC2_CreateContext(rc2p->key.buf.data, + rc2p->key.buf.len, + rc2p->iv.buf.data, + minorMode, + rc2p->key.buf.len); + if (cipherInfo->cxreps > 0) { + RC2Context **dummycx; + dummycx = PORT_Alloc(cipherInfo->cxreps * sizeof(RC2Context *)); + TIMESTART(); + for (i=0; icxreps; i++) { + dummycx[i] = (void*)RC2_CreateContext(rc2p->key.buf.data, + rc2p->key.buf.len, + rc2p->iv.buf.data, + minorMode, + rc2p->key.buf.len); + } + TIMEFINISH(cipherInfo->cxtime, 1.0); + for (i=0; icxreps; i++) { + RC2_DestroyContext(dummycx[i], PR_TRUE); + } + PORT_Free(dummycx); + } + if (encrypt) + cipherInfo->cipher.symmkeyCipher = rc2_Encrypt; + else + cipherInfo->cipher.symmkeyCipher = rc2_Decrypt; + return SECSuccess; +} + +SECStatus +bltest_rc4_init(bltestCipherInfo *cipherInfo, PRBool encrypt) +{ + PRIntervalTime time1, time2; + int i; + bltestSymmKeyParams *rc4p = &cipherInfo->params.sk; + cipherInfo->cx = (void*)RC4_CreateContext(rc4p->key.buf.data, + rc4p->key.buf.len); + if (cipherInfo->cxreps > 0) { + RC4Context **dummycx; + dummycx = PORT_Alloc(cipherInfo->cxreps * sizeof(RC4Context *)); + TIMESTART(); + for (i=0; icxreps; i++) { + dummycx[i] = (void*)RC4_CreateContext(rc4p->key.buf.data, + rc4p->key.buf.len); + } + TIMEFINISH(cipherInfo->cxtime, 1.0); + for (i=0; icxreps; i++) { + RC4_DestroyContext(dummycx[i], PR_TRUE); + } + PORT_Free(dummycx); + } + if (encrypt) + cipherInfo->cipher.symmkeyCipher = rc4_Encrypt; + else + cipherInfo->cipher.symmkeyCipher = rc4_Decrypt; + return SECSuccess; +} + +SECStatus +bltest_rc5_init(bltestCipherInfo *cipherInfo, PRBool encrypt) +{ +#ifdef NSS_SOFTOKEN_DOES_RC5 + PRIntervalTime time1, time2; + bltestRC5Params *rc5p = &cipherInfo->params.rc5; + int minorMode; + switch (cipherInfo->mode) { + case bltestRC5_ECB: minorMode = NSS_RC5; break; + case bltestRC5_CBC: minorMode = NSS_RC5_CBC; break; + default: + return SECFailure; + } + TIMESTART(); + cipherInfo->cx = (void*)RC5_CreateContext(&rc5p->key.buf, + rc5p->rounds, rc5p->wordsize, + rc5p->iv.buf.data, minorMode); + TIMEFINISH(cipherInfo->cxtime, 1.0); + if (encrypt) + cipherInfo->cipher.symmkeyCipher = RC5_Encrypt; + else + cipherInfo->cipher.symmkeyCipher = RC5_Decrypt; + return SECSuccess; +#else + return SECFailure; +#endif +} + +SECStatus +bltest_aes_init(bltestCipherInfo *cipherInfo, PRBool encrypt) +{ + bltestSymmKeyParams *aesp = &cipherInfo->params.sk; + int minorMode; + int i; + int keylen = aesp->key.buf.len; + int blocklen = AES_BLOCK_SIZE; + PRIntervalTime time1, time2; + + switch (cipherInfo->mode) { + case bltestAES_ECB: minorMode = NSS_AES; break; + case bltestAES_CBC: minorMode = NSS_AES_CBC; break; + default: + return SECFailure; + } + cipherInfo->cx = (void*)AES_CreateContext(aesp->key.buf.data, + aesp->iv.buf.data, + minorMode, encrypt, + keylen, blocklen); + if (cipherInfo->cxreps > 0) { + AESContext **dummycx; + dummycx = PORT_Alloc(cipherInfo->cxreps * sizeof(AESContext *)); + TIMESTART(); + for (i=0; icxreps; i++) { + dummycx[i] = (void*)AES_CreateContext(aesp->key.buf.data, + aesp->iv.buf.data, + minorMode, encrypt, + keylen, blocklen); + } + TIMEFINISH(cipherInfo->cxtime, 1.0); + for (i=0; icxreps; i++) { + AES_DestroyContext(dummycx[i], PR_TRUE); + } + PORT_Free(dummycx); + } + if (encrypt) + cipherInfo->cipher.symmkeyCipher = aes_Encrypt; + else + cipherInfo->cipher.symmkeyCipher = aes_Decrypt; + return SECSuccess; +} + +SECStatus +bltest_camellia_init(bltestCipherInfo *cipherInfo, PRBool encrypt) +{ + bltestSymmKeyParams *camelliap = &cipherInfo->params.sk; + int minorMode; + int i; + int keylen = camelliap->key.buf.len; + int blocklen = CAMELLIA_BLOCK_SIZE; + PRIntervalTime time1, time2; + + switch (cipherInfo->mode) { + case bltestCAMELLIA_ECB: minorMode = NSS_CAMELLIA; break; + case bltestCAMELLIA_CBC: minorMode = NSS_CAMELLIA_CBC; break; + default: + return SECFailure; + } + cipherInfo->cx = (void*)Camellia_CreateContext(camelliap->key.buf.data, + camelliap->iv.buf.data, + minorMode, encrypt, + keylen); + if (cipherInfo->cxreps > 0) { + CamelliaContext **dummycx; + dummycx = PORT_Alloc(cipherInfo->cxreps * sizeof(CamelliaContext *)); + TIMESTART(); + for (i=0; icxreps; i++) { + dummycx[i] = (void*)Camellia_CreateContext(camelliap->key.buf.data, + camelliap->iv.buf.data, + minorMode, encrypt, + keylen); + } + TIMEFINISH(cipherInfo->cxtime, 1.0); + for (i=0; icxreps; i++) { + Camellia_DestroyContext(dummycx[i], PR_TRUE); + } + PORT_Free(dummycx); + } + if (encrypt) + cipherInfo->cipher.symmkeyCipher = camellia_Encrypt; + else + cipherInfo->cipher.symmkeyCipher = camellia_Decrypt; + return SECSuccess; +} + +SECStatus +bltest_seed_init(bltestCipherInfo *cipherInfo, PRBool encrypt) +{ + PRIntervalTime time1, time2; + bltestSymmKeyParams *seedp = &cipherInfo->params.sk; + int minorMode; + int i; + + switch (cipherInfo->mode) { + case bltestSEED_ECB: minorMode = NSS_SEED; break; + case bltestSEED_CBC: minorMode = NSS_SEED_CBC; break; + default: + return SECFailure; + } + cipherInfo->cx = (void*)SEED_CreateContext(seedp->key.buf.data, + seedp->iv.buf.data, + minorMode, encrypt); + if (cipherInfo->cxreps > 0) { + SEEDContext **dummycx; + dummycx = PORT_Alloc(cipherInfo->cxreps * sizeof(SEEDContext *)); + TIMESTART(); + for (i=0; icxreps; i++) { + dummycx[i] = (void*)SEED_CreateContext(seedp->key.buf.data, + seedp->iv.buf.data, + minorMode, encrypt); + } + TIMEFINISH(cipherInfo->cxtime, 1.0); + for (i=0; icxreps; i++) { + SEED_DestroyContext(dummycx[i], PR_TRUE); + } + PORT_Free(dummycx); + } + if (encrypt) + cipherInfo->cipher.symmkeyCipher = seed_Encrypt; + else + cipherInfo->cipher.symmkeyCipher = seed_Decrypt; + + return SECSuccess; +} + +SECStatus +bltest_rsa_init(bltestCipherInfo *cipherInfo, PRBool encrypt) +{ + int i; + RSAPrivateKey **dummyKey; + PRIntervalTime time1, time2; + bltestRSAParams *rsap = &cipherInfo->params.rsa; + /* RSA key gen was done during parameter setup */ + cipherInfo->cx = cipherInfo->params.rsa.rsakey; + /* For performance testing */ + if (cipherInfo->cxreps > 0) { + /* Create space for n private key objects */ + dummyKey = (RSAPrivateKey **)PORT_Alloc(cipherInfo->cxreps * + sizeof(RSAPrivateKey *)); + /* Time n keygens, storing in the array */ + TIMESTART(); + for (i=0; icxreps; i++) + dummyKey[i] = RSA_NewKey(rsap->keysizeInBits, + &rsap->rsakey->publicExponent); + TIMEFINISH(cipherInfo->cxtime, cipherInfo->cxreps); + /* Free the n key objects */ + for (i=0; icxreps; i++) + PORT_FreeArena(dummyKey[i]->arena, PR_TRUE); + PORT_Free(dummyKey); + } + if (encrypt) { + /* Have to convert private key to public key. Memory + * is freed with private key's arena */ + RSAPublicKey *pubkey; + RSAPrivateKey *key = (RSAPrivateKey *)cipherInfo->cx; + pubkey = (RSAPublicKey *)PORT_ArenaAlloc(key->arena, + sizeof(RSAPublicKey)); + pubkey->modulus.len = key->modulus.len; + pubkey->modulus.data = key->modulus.data; + pubkey->publicExponent.len = key->publicExponent.len; + pubkey->publicExponent.data = key->publicExponent.data; + cipherInfo->cx = (void *)pubkey; + cipherInfo->cipher.pubkeyCipher = rsa_PublicKeyOp; + } else { + cipherInfo->cipher.pubkeyCipher = rsa_PrivateKeyOp; + } + return SECSuccess; +} + +SECStatus +bltest_pqg_init(bltestDSAParams *dsap) +{ + SECStatus rv, res; + PQGVerify *vfy = NULL; + rv = PQG_ParamGen(dsap->j, &dsap->pqg, &vfy); + CHECKERROR(rv, __LINE__); + rv = PQG_VerifyParams(dsap->pqg, vfy, &res); + CHECKERROR(res, __LINE__); + CHECKERROR(rv, __LINE__); + return rv; +} + +SECStatus +bltest_dsa_init(bltestCipherInfo *cipherInfo, PRBool encrypt) +{ + int i; + DSAPrivateKey **dummyKey; + PQGParams *dummypqg; + PRIntervalTime time1, time2; + bltestDSAParams *dsap = &cipherInfo->params.dsa; + PQGVerify *ignore = NULL; + /* DSA key gen was done during parameter setup */ + cipherInfo->cx = cipherInfo->params.dsa.dsakey; + /* For performance testing */ + if (cipherInfo->cxreps > 0) { + /* Create space for n private key objects */ + dummyKey = (DSAPrivateKey **)PORT_ZAlloc(cipherInfo->cxreps * + sizeof(DSAPrivateKey *)); + /* Time n keygens, storing in the array */ + TIMESTART(); + for (i=0; icxreps; i++) { + dummypqg = NULL; + PQG_ParamGen(dsap->j, &dummypqg, &ignore); + DSA_NewKey(dummypqg, &dummyKey[i]); + } + TIMEFINISH(cipherInfo->cxtime, cipherInfo->cxreps); + /* Free the n key objects */ + for (i=0; icxreps; i++) + PORT_FreeArena(dummyKey[i]->params.arena, PR_TRUE); + PORT_Free(dummyKey); + } + if (!dsap->pqg && dsap->pqgdata.buf.len > 0) { + dsap->pqg = pqg_from_filedata(&dsap->pqgdata.buf); + } + if (!cipherInfo->cx && dsap->key.buf.len > 0) { + cipherInfo->cx = dsakey_from_filedata(&dsap->key.buf); + } + if (encrypt) { + cipherInfo->cipher.pubkeyCipher = dsa_signDigest; + } else { + /* Have to convert private key to public key. Memory + * is freed with private key's arena */ + DSAPublicKey *pubkey; + DSAPrivateKey *key = (DSAPrivateKey *)cipherInfo->cx; + pubkey = (DSAPublicKey *)PORT_ArenaZAlloc(key->params.arena, + sizeof(DSAPublicKey)); + pubkey->params.prime.len = key->params.prime.len; + pubkey->params.prime.data = key->params.prime.data; + pubkey->params.subPrime.len = key->params.subPrime.len; + pubkey->params.subPrime.data = key->params.subPrime.data; + pubkey->params.base.len = key->params.base.len; + pubkey->params.base.data = key->params.base.data; + pubkey->publicValue.len = key->publicValue.len; + pubkey->publicValue.data = key->publicValue.data; + cipherInfo->cipher.pubkeyCipher = dsa_verifyDigest; + } + return SECSuccess; +} + +#ifdef NSS_ENABLE_ECC +SECStatus +bltest_ecdsa_init(bltestCipherInfo *cipherInfo, PRBool encrypt) +{ + int i; + ECPrivateKey **dummyKey; + PRIntervalTime time1, time2; + bltestECDSAParams *ecdsap = &cipherInfo->params.ecdsa; + /* ECDSA key gen was done during parameter setup */ + cipherInfo->cx = cipherInfo->params.ecdsa.eckey; + /* For performance testing */ + if (cipherInfo->cxreps > 0) { + /* Create space for n private key objects */ + dummyKey = (ECPrivateKey **)PORT_ZAlloc(cipherInfo->cxreps * + sizeof(ECPrivateKey *)); + /* Time n keygens, storing in the array */ + TIMESTART(); + for (i=0; icxreps; i++) { + EC_NewKey(&ecdsap->eckey->ecParams, &dummyKey[i]); + } + TIMEFINISH(cipherInfo->cxtime, cipherInfo->cxreps); + /* Free the n key objects */ + for (i=0; icxreps; i++) + PORT_FreeArena(dummyKey[i]->ecParams.arena, PR_TRUE); + PORT_Free(dummyKey); + } + if (!cipherInfo->cx && ecdsap->key.buf.len > 0) { + cipherInfo->cx = eckey_from_filedata(&ecdsap->key.buf); + } + if (encrypt) { + cipherInfo->cipher.pubkeyCipher = ecdsa_signDigest; + } else { + /* Have to convert private key to public key. Memory + * is freed with private key's arena */ + ECPublicKey *pubkey; + ECPrivateKey *key = (ECPrivateKey *)cipherInfo->cx; + pubkey = (ECPublicKey *)PORT_ArenaZAlloc(key->ecParams.arena, + sizeof(ECPublicKey)); + pubkey->ecParams.type = key->ecParams.type; + pubkey->ecParams.fieldID.size = key->ecParams.fieldID.size; + pubkey->ecParams.fieldID.type = key->ecParams.fieldID.type; + pubkey->ecParams.fieldID.u.prime.len = key->ecParams.fieldID.u.prime.len; + pubkey->ecParams.fieldID.u.prime.data = key->ecParams.fieldID.u.prime.data; + pubkey->ecParams.fieldID.k1 = key->ecParams.fieldID.k1; + pubkey->ecParams.fieldID.k2 = key->ecParams.fieldID.k2; + pubkey->ecParams.fieldID.k3 = key->ecParams.fieldID.k3; + pubkey->ecParams.curve.a.len = key->ecParams.curve.a.len; + pubkey->ecParams.curve.a.data = key->ecParams.curve.a.data; + pubkey->ecParams.curve.b.len = key->ecParams.curve.b.len; + pubkey->ecParams.curve.b.data = key->ecParams.curve.b.data; + pubkey->ecParams.curve.seed.len = key->ecParams.curve.seed.len; + pubkey->ecParams.curve.seed.data = key->ecParams.curve.seed.data; + pubkey->ecParams.base.len = key->ecParams.base.len; + pubkey->ecParams.base.data = key->ecParams.base.data; + pubkey->ecParams.order.len = key->ecParams.order.len; + pubkey->ecParams.order.data = key->ecParams.order.data; + pubkey->ecParams.cofactor = key->ecParams.cofactor; + pubkey->ecParams.DEREncoding.len = key->ecParams.DEREncoding.len; + pubkey->ecParams.DEREncoding.data = key->ecParams.DEREncoding.data; + pubkey->ecParams.name= key->ecParams.name; + pubkey->publicValue.len = key->publicValue.len; + pubkey->publicValue.data = key->publicValue.data; + cipherInfo->cipher.pubkeyCipher = ecdsa_verifyDigest; + } + return SECSuccess; +} +#endif + +/* XXX unfortunately, this is not defined in blapi.h */ +SECStatus +md2_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length) +{ + unsigned int len; + MD2Context *cx = MD2_NewContext(); + if (cx == NULL) return SECFailure; + MD2_Begin(cx); + MD2_Update(cx, src, src_length); + MD2_End(cx, dest, &len, MD2_LENGTH); + MD2_DestroyContext(cx, PR_TRUE); + return SECSuccess; +} + +SECStatus +md2_restart(unsigned char *dest, const unsigned char *src, uint32 src_length) +{ + MD2Context *cx, *cx_cpy; + unsigned char *cxbytes; + unsigned int len; + unsigned int i, quarter; + SECStatus rv = SECSuccess; + cx = MD2_NewContext(); + MD2_Begin(cx); + /* divide message by 4, restarting 3 times */ + quarter = (src_length + 3)/ 4; + for (i=0; i < 4 && src_length > 0; i++) { + MD2_Update(cx, src + i*quarter, PR_MIN(quarter, src_length)); + len = MD2_FlattenSize(cx); + cxbytes = PORT_Alloc(len); + MD2_Flatten(cx, cxbytes); + cx_cpy = MD2_Resurrect(cxbytes, NULL); + if (!cx_cpy) { + PR_fprintf(PR_STDERR, "%s: MD2_Resurrect failed!\n", progName); + goto finish; + } + rv = PORT_Memcmp(cx, cx_cpy, len); + if (rv) { + MD2_DestroyContext(cx_cpy, PR_TRUE); + PR_fprintf(PR_STDERR, "%s: MD2_restart failed!\n", progName); + goto finish; + } + MD2_DestroyContext(cx_cpy, PR_TRUE); + PORT_Free(cxbytes); + src_length -= quarter; + } + MD2_End(cx, dest, &len, MD2_LENGTH); +finish: + MD2_DestroyContext(cx, PR_TRUE); + return rv; +} + +SECStatus +md5_restart(unsigned char *dest, const unsigned char *src, uint32 src_length) +{ + SECStatus rv = SECSuccess; + MD5Context *cx, *cx_cpy; + unsigned char *cxbytes; + unsigned int len; + unsigned int i, quarter; + cx = MD5_NewContext(); + MD5_Begin(cx); + /* divide message by 4, restarting 3 times */ + quarter = (src_length + 3)/ 4; + for (i=0; i < 4 && src_length > 0; i++) { + MD5_Update(cx, src + i*quarter, PR_MIN(quarter, src_length)); + len = MD5_FlattenSize(cx); + cxbytes = PORT_Alloc(len); + MD5_Flatten(cx, cxbytes); + cx_cpy = MD5_Resurrect(cxbytes, NULL); + if (!cx_cpy) { + PR_fprintf(PR_STDERR, "%s: MD5_Resurrect failed!\n", progName); + rv = SECFailure; + goto finish; + } + rv = PORT_Memcmp(cx, cx_cpy, len); + if (rv) { + MD5_DestroyContext(cx_cpy, PR_TRUE); + PR_fprintf(PR_STDERR, "%s: MD5_restart failed!\n", progName); + goto finish; + } + MD5_DestroyContext(cx_cpy, PR_TRUE); + PORT_Free(cxbytes); + src_length -= quarter; + } + MD5_End(cx, dest, &len, MD5_LENGTH); +finish: + MD5_DestroyContext(cx, PR_TRUE); + return rv; +} + +SECStatus +sha1_restart(unsigned char *dest, const unsigned char *src, uint32 src_length) +{ + SECStatus rv = SECSuccess; + SHA1Context *cx, *cx_cpy; + unsigned char *cxbytes; + unsigned int len; + unsigned int i, quarter; + cx = SHA1_NewContext(); + SHA1_Begin(cx); + /* divide message by 4, restarting 3 times */ + quarter = (src_length + 3)/ 4; + for (i=0; i < 4 && src_length > 0; i++) { + SHA1_Update(cx, src + i*quarter, PR_MIN(quarter, src_length)); + len = SHA1_FlattenSize(cx); + cxbytes = PORT_Alloc(len); + SHA1_Flatten(cx, cxbytes); + cx_cpy = SHA1_Resurrect(cxbytes, NULL); + if (!cx_cpy) { + PR_fprintf(PR_STDERR, "%s: SHA1_Resurrect failed!\n", progName); + rv = SECFailure; + goto finish; + } + rv = PORT_Memcmp(cx, cx_cpy, len); + if (rv) { + SHA1_DestroyContext(cx_cpy, PR_TRUE); + PR_fprintf(PR_STDERR, "%s: SHA1_restart failed!\n", progName); + goto finish; + } + SHA1_DestroyContext(cx_cpy, PR_TRUE); + PORT_Free(cxbytes); + src_length -= quarter; + } + SHA1_End(cx, dest, &len, MD5_LENGTH); +finish: + SHA1_DestroyContext(cx, PR_TRUE); + return rv; +} + +SECStatus +SHA256_restart(unsigned char *dest, const unsigned char *src, uint32 src_length) +{ + SECStatus rv = SECSuccess; + SHA256Context *cx, *cx_cpy; + unsigned char *cxbytes; + unsigned int len; + unsigned int i, quarter; + cx = SHA256_NewContext(); + SHA256_Begin(cx); + /* divide message by 4, restarting 3 times */ + quarter = (src_length + 3)/ 4; + for (i=0; i < 4 && src_length > 0; i++) { + SHA256_Update(cx, src + i*quarter, PR_MIN(quarter, src_length)); + len = SHA256_FlattenSize(cx); + cxbytes = PORT_Alloc(len); + SHA256_Flatten(cx, cxbytes); + cx_cpy = SHA256_Resurrect(cxbytes, NULL); + if (!cx_cpy) { + PR_fprintf(PR_STDERR, "%s: SHA256_Resurrect failed!\n", progName); + rv = SECFailure; + goto finish; + } + rv = PORT_Memcmp(cx, cx_cpy, len); + if (rv) { + SHA256_DestroyContext(cx_cpy, PR_TRUE); + PR_fprintf(PR_STDERR, "%s: SHA256_restart failed!\n", progName); + goto finish; + } + SHA256_DestroyContext(cx_cpy, PR_TRUE); + PORT_Free(cxbytes); + src_length -= quarter; + } + SHA256_End(cx, dest, &len, MD5_LENGTH); +finish: + SHA256_DestroyContext(cx, PR_TRUE); + return rv; +} + +SECStatus +SHA384_restart(unsigned char *dest, const unsigned char *src, uint32 src_length) +{ + SECStatus rv = SECSuccess; + SHA384Context *cx, *cx_cpy; + unsigned char *cxbytes; + unsigned int len; + unsigned int i, quarter; + cx = SHA384_NewContext(); + SHA384_Begin(cx); + /* divide message by 4, restarting 3 times */ + quarter = (src_length + 3)/ 4; + for (i=0; i < 4 && src_length > 0; i++) { + SHA384_Update(cx, src + i*quarter, PR_MIN(quarter, src_length)); + len = SHA384_FlattenSize(cx); + cxbytes = PORT_Alloc(len); + SHA384_Flatten(cx, cxbytes); + cx_cpy = SHA384_Resurrect(cxbytes, NULL); + if (!cx_cpy) { + PR_fprintf(PR_STDERR, "%s: SHA384_Resurrect failed!\n", progName); + rv = SECFailure; + goto finish; + } + rv = PORT_Memcmp(cx, cx_cpy, len); + if (rv) { + SHA384_DestroyContext(cx_cpy, PR_TRUE); + PR_fprintf(PR_STDERR, "%s: SHA384_restart failed!\n", progName); + goto finish; + } + SHA384_DestroyContext(cx_cpy, PR_TRUE); + PORT_Free(cxbytes); + src_length -= quarter; + } + SHA384_End(cx, dest, &len, MD5_LENGTH); +finish: + SHA384_DestroyContext(cx, PR_TRUE); + return rv; +} + +SECStatus +SHA512_restart(unsigned char *dest, const unsigned char *src, uint32 src_length) +{ + SECStatus rv = SECSuccess; + SHA512Context *cx, *cx_cpy; + unsigned char *cxbytes; + unsigned int len; + unsigned int i, quarter; + cx = SHA512_NewContext(); + SHA512_Begin(cx); + /* divide message by 4, restarting 3 times */ + quarter = (src_length + 3)/ 4; + for (i=0; i < 4 && src_length > 0; i++) { + SHA512_Update(cx, src + i*quarter, PR_MIN(quarter, src_length)); + len = SHA512_FlattenSize(cx); + cxbytes = PORT_Alloc(len); + SHA512_Flatten(cx, cxbytes); + cx_cpy = SHA512_Resurrect(cxbytes, NULL); + if (!cx_cpy) { + PR_fprintf(PR_STDERR, "%s: SHA512_Resurrect failed!\n", progName); + rv = SECFailure; + goto finish; + } + rv = PORT_Memcmp(cx, cx_cpy, len); + if (rv) { + SHA512_DestroyContext(cx_cpy, PR_TRUE); + PR_fprintf(PR_STDERR, "%s: SHA512_restart failed!\n", progName); + goto finish; + } + SHA512_DestroyContext(cx_cpy, PR_TRUE); + PORT_Free(cxbytes); + src_length -= quarter; + } + SHA512_End(cx, dest, &len, MD5_LENGTH); +finish: + SHA512_DestroyContext(cx, PR_TRUE); + return rv; +} + +SECStatus +pubkeyInitKey(bltestCipherInfo *cipherInfo, PRFileDesc *file, +#ifdef NSS_ENABLE_ECC + int keysize, int exponent, char *curveName) +#else + int keysize, int exponent) +#endif +{ + int i; + SECStatus rv = SECSuccess; + bltestRSAParams *rsap; + bltestDSAParams *dsap; +#ifdef NSS_ENABLE_ECC + bltestECDSAParams *ecdsap; + SECItem *tmpECParamsDER; + ECParams *tmpECParams = NULL; + SECItem ecSerialize[3]; +#endif + switch (cipherInfo->mode) { + case bltestRSA: + rsap = &cipherInfo->params.rsa; + if (keysize > 0) { + SECItem expitem = { 0, 0, 0 }; + SECITEM_AllocItem(cipherInfo->arena, &expitem, sizeof(int)); + for (i = 1; i <= sizeof(int); i++) + expitem.data[i-1] = exponent >> (8*(sizeof(int) - i)); + rsap->rsakey = RSA_NewKey(keysize * 8, &expitem); + serialize_key(&rsap->rsakey->version, 9, file); + rsap->keysizeInBits = keysize * 8; + } else { + setupIO(cipherInfo->arena, &cipherInfo->params.key, file, NULL, 0); + rsap->rsakey = rsakey_from_filedata(&cipherInfo->params.key.buf); + rsap->keysizeInBits = rsap->rsakey->modulus.len * 8; + } + break; + case bltestDSA: + dsap = &cipherInfo->params.dsa; + if (keysize > 0) { + dsap->j = PQG_PBITS_TO_INDEX(8*keysize); + if (!dsap->pqg) + bltest_pqg_init(dsap); + rv = DSA_NewKey(dsap->pqg, &dsap->dsakey); + CHECKERROR(rv, __LINE__); + serialize_key(&dsap->dsakey->params.prime, 5, file); + } else { + setupIO(cipherInfo->arena, &cipherInfo->params.key, file, NULL, 0); + dsap->dsakey = dsakey_from_filedata(&cipherInfo->params.key.buf); + dsap->j = PQG_PBITS_TO_INDEX(8*dsap->dsakey->params.prime.len); + } + break; +#ifdef NSS_ENABLE_ECC + case bltestECDSA: + ecdsap = &cipherInfo->params.ecdsa; + if (curveName != NULL) { + tmpECParamsDER = getECParams(curveName); + rv = SECOID_Init(); + CHECKERROR(rv, __LINE__); + rv = EC_DecodeParams(tmpECParamsDER, &tmpECParams) == SECFailure; + CHECKERROR(rv, __LINE__); + rv = EC_NewKey(tmpECParams, &ecdsap->eckey); + CHECKERROR(rv, __LINE__); + ecSerialize[0].type = tmpECParamsDER->type; + ecSerialize[0].data = tmpECParamsDER->data; + ecSerialize[0].len = tmpECParamsDER->len; + ecSerialize[1].type = ecdsap->eckey->publicValue.type; + ecSerialize[1].data = ecdsap->eckey->publicValue.data; + ecSerialize[1].len = ecdsap->eckey->publicValue.len; + ecSerialize[2].type = ecdsap->eckey->privateValue.type; + ecSerialize[2].data = ecdsap->eckey->privateValue.data; + ecSerialize[2].len = ecdsap->eckey->privateValue.len; + serialize_key(&(ecSerialize[0]), 3, file); + SECITEM_FreeItem(tmpECParamsDER, PR_TRUE); + PORT_FreeArena(tmpECParams->arena, PR_TRUE); + rv = SECOID_Shutdown(); + CHECKERROR(rv, __LINE__); + } else { + setupIO(cipherInfo->arena, &cipherInfo->params.key, file, NULL, 0); + ecdsap->eckey = eckey_from_filedata(&cipherInfo->params.key.buf); + } + break; +#endif + default: + return SECFailure; + } + return SECSuccess; +} + +SECStatus +cipherInit(bltestCipherInfo *cipherInfo, PRBool encrypt) +{ + PRBool restart; + switch (cipherInfo->mode) { + case bltestDES_ECB: + case bltestDES_CBC: + case bltestDES_EDE_ECB: + case bltestDES_EDE_CBC: + SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, + cipherInfo->input.pBuf.len); + return bltest_des_init(cipherInfo, encrypt); + break; + case bltestRC2_ECB: + case bltestRC2_CBC: + SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, + cipherInfo->input.pBuf.len); + return bltest_rc2_init(cipherInfo, encrypt); + break; + case bltestRC4: + SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, + cipherInfo->input.pBuf.len); + return bltest_rc4_init(cipherInfo, encrypt); + break; +#ifdef NSS_SOFTOKEN_DOES_RC5 + case bltestRC5_ECB: + case bltestRC5_CBC: + SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, + cipherInfo->input.pBuf.len); +#endif + return bltest_rc5_init(cipherInfo, encrypt); + break; + case bltestAES_ECB: + case bltestAES_CBC: + SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, + cipherInfo->input.pBuf.len); + return bltest_aes_init(cipherInfo, encrypt); + break; + case bltestCAMELLIA_ECB: + case bltestCAMELLIA_CBC: + SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, + cipherInfo->input.pBuf.len); + return bltest_camellia_init(cipherInfo, encrypt); + break; + case bltestSEED_ECB: + case bltestSEED_CBC: + SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, + cipherInfo->input.pBuf.len); + return bltest_seed_init(cipherInfo, encrypt); + break; + case bltestRSA: + SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, + cipherInfo->input.pBuf.len); + return bltest_rsa_init(cipherInfo, encrypt); + break; + case bltestDSA: + SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, + DSA_SIGNATURE_LEN); + return bltest_dsa_init(cipherInfo, encrypt); + break; +#ifdef NSS_ENABLE_ECC + case bltestECDSA: + SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, + 2 * MAX_ECKEY_LEN); + return bltest_ecdsa_init(cipherInfo, encrypt); + break; +#endif + case bltestMD2: + restart = cipherInfo->params.hash.restart; + SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, + MD2_LENGTH); + cipherInfo->cipher.hashCipher = (restart) ? md2_restart : md2_HashBuf; + return SECSuccess; + break; + case bltestMD5: + restart = cipherInfo->params.hash.restart; + SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, + MD5_LENGTH); + cipherInfo->cipher.hashCipher = (restart) ? md5_restart : MD5_HashBuf; + return SECSuccess; + break; + case bltestSHA1: + restart = cipherInfo->params.hash.restart; + SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, + SHA1_LENGTH); + cipherInfo->cipher.hashCipher = (restart) ? sha1_restart : SHA1_HashBuf; + return SECSuccess; + break; + case bltestSHA256: + restart = cipherInfo->params.hash.restart; + SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, + SHA256_LENGTH); + cipherInfo->cipher.hashCipher = (restart) ? SHA256_restart + : SHA256_HashBuf; + return SECSuccess; + break; + case bltestSHA384: + restart = cipherInfo->params.hash.restart; + SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, + SHA384_LENGTH); + cipherInfo->cipher.hashCipher = (restart) ? SHA384_restart + : SHA384_HashBuf; + return SECSuccess; + break; + case bltestSHA512: + restart = cipherInfo->params.hash.restart; + SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, + SHA512_LENGTH); + cipherInfo->cipher.hashCipher = (restart) ? SHA512_restart + : SHA512_HashBuf; + return SECSuccess; + break; + default: + return SECFailure; + } + return SECSuccess; +} + +SECStatus +dsaOp(bltestCipherInfo *cipherInfo) +{ + PRIntervalTime time1, time2; + SECStatus rv = SECSuccess; + int i; + int maxLen = cipherInfo->output.pBuf.len; + SECItem dummyOut = { 0, 0, 0 }; + SECITEM_AllocItem(NULL, &dummyOut, maxLen); + if (cipherInfo->cipher.pubkeyCipher == dsa_signDigest) { + if (cipherInfo->params.dsa.sigseed.buf.len > 0) { + bltestDSAParams *dsa = &cipherInfo->params.dsa; + DSAPrivateKey *key = (DSAPrivateKey *)cipherInfo->cx; + + TIMESTART(); + rv = DSA_SignDigestWithSeed(key, + &cipherInfo->output.pBuf, + &cipherInfo->input.pBuf, + dsa->sigseed.buf.data); + TIMEFINISH(cipherInfo->optime, 1.0); + CHECKERROR(rv, __LINE__); + cipherInfo->repetitions = 0; + if (cipherInfo->repetitionsToPerfom != 0) { + TIMESTART(); + for (i=0; irepetitionsToPerfom; + i++, cipherInfo->repetitions++) { + rv = DSA_SignDigestWithSeed(key, &dummyOut, + &cipherInfo->input.pBuf, + dsa->sigseed.buf.data); + CHECKERROR(rv, __LINE__); + } + } else { + int opsBetweenChecks = 0; + TIMEMARK(cipherInfo->seconds); + while (! (TIMETOFINISH())) { + int j = 0; + for (;j < opsBetweenChecks;j++) { + rv = DSA_SignDigestWithSeed(key, &dummyOut, + &cipherInfo->input.pBuf, + dsa->sigseed.buf.data); + CHECKERROR(rv, __LINE__); + } + cipherInfo->repetitions += j; + } + } + TIMEFINISH(cipherInfo->optime, 1.0); + } else { + TIMESTART(); + rv = DSA_SignDigest((DSAPrivateKey *)cipherInfo->cx, + &cipherInfo->output.pBuf, + &cipherInfo->input.pBuf); + TIMEFINISH(cipherInfo->optime, 1.0); + CHECKERROR(rv, __LINE__); + cipherInfo->repetitions = 0; + if (cipherInfo->repetitionsToPerfom != 0) { + TIMESTART(); + for (i=0; irepetitionsToPerfom; + i++, cipherInfo->repetitions++) { + rv = DSA_SignDigest((DSAPrivateKey *)cipherInfo->cx, + &dummyOut, + &cipherInfo->input.pBuf); + CHECKERROR(rv, __LINE__); + } + } else { + int opsBetweenChecks = 0; + TIMEMARK(cipherInfo->seconds); + while (! (TIMETOFINISH())) { + int j = 0; + for (;j < opsBetweenChecks;j++) { + rv = DSA_SignDigest((DSAPrivateKey *)cipherInfo->cx, + &dummyOut, + &cipherInfo->input.pBuf); + CHECKERROR(rv, __LINE__); + } + cipherInfo->repetitions += j; + } + } + TIMEFINISH(cipherInfo->optime, 1.0); + } + bltestCopyIO(cipherInfo->arena, &cipherInfo->params.dsa.sig, + &cipherInfo->output); + } else { + TIMESTART(); + rv = DSA_VerifyDigest((DSAPublicKey *)cipherInfo->cx, + &cipherInfo->params.dsa.sig.buf, + &cipherInfo->input.pBuf); + TIMEFINISH(cipherInfo->optime, 1.0); + CHECKERROR(rv, __LINE__); + cipherInfo->repetitions = 0; + if (cipherInfo->repetitionsToPerfom != 0) { + TIMESTART(); + for (i=0; irepetitionsToPerfom; + i++, cipherInfo->repetitions++) { + rv = DSA_VerifyDigest((DSAPublicKey *)cipherInfo->cx, + &cipherInfo->params.dsa.sig.buf, + &cipherInfo->input.pBuf); + CHECKERROR(rv, __LINE__); + } + } else { + int opsBetweenChecks = 0; + TIMEMARK(cipherInfo->seconds); + while (! (TIMETOFINISH())) { + int j = 0; + for (;j < opsBetweenChecks;j++) { + rv = DSA_VerifyDigest((DSAPublicKey *)cipherInfo->cx, + &cipherInfo->params.dsa.sig.buf, + &cipherInfo->input.pBuf); + CHECKERROR(rv, __LINE__); + } + cipherInfo->repetitions += j; + } + } + TIMEFINISH(cipherInfo->optime, 1.0); + } + SECITEM_FreeItem(&dummyOut, PR_FALSE); + return rv; +} + +#ifdef NSS_ENABLE_ECC +SECStatus +ecdsaOp(bltestCipherInfo *cipherInfo) +{ + PRIntervalTime time1, time2; + SECStatus rv = SECSuccess; + int i; + int maxLen = cipherInfo->output.pBuf.len; + SECItem dummyOut = { 0, 0, 0 }; + SECITEM_AllocItem(NULL, &dummyOut, maxLen); + if (cipherInfo->cipher.pubkeyCipher == ecdsa_signDigest) { + if (cipherInfo->params.ecdsa.sigseed.buf.len > 0) { + ECPrivateKey *key = (ECPrivateKey *)cipherInfo->cx; + bltestECDSAParams *ecdsa = &cipherInfo->params.ecdsa; + + TIMESTART(); + rv = ECDSA_SignDigestWithSeed(key, + &cipherInfo->output.pBuf, + &cipherInfo->input.pBuf, + ecdsa->sigseed.buf.data, + ecdsa->sigseed.buf.len); + TIMEFINISH(cipherInfo->optime, 1.0); + CHECKERROR(rv, __LINE__); + cipherInfo->repetitions = 0; + if (cipherInfo->repetitionsToPerfom != 0) { + TIMESTART(); + for (i=0; irepetitionsToPerfom; + i++, cipherInfo->repetitions++) { + rv = ECDSA_SignDigestWithSeed(key, &dummyOut, + &cipherInfo->input.pBuf, + ecdsa->sigseed.buf.data, + ecdsa->sigseed.buf.len); + CHECKERROR(rv, __LINE__); + } + } else { + int opsBetweenChecks = 0; + TIMEMARK(cipherInfo->seconds); + while (! (TIMETOFINISH())) { + int j = 0; + for (;j < opsBetweenChecks;j++) { + rv = ECDSA_SignDigestWithSeed(key, &dummyOut, + &cipherInfo->input.pBuf, + ecdsa->sigseed.buf.data, + ecdsa->sigseed.buf.len); + CHECKERROR(rv, __LINE__); + } + cipherInfo->repetitions += j; + } + } + TIMEFINISH(cipherInfo->optime, 1.0); + } else { + TIMESTART(); + rv = ECDSA_SignDigest((ECPrivateKey *)cipherInfo->cx, + &cipherInfo->output.pBuf, + &cipherInfo->input.pBuf); + TIMEFINISH(cipherInfo->optime, 1.0); + CHECKERROR(rv, __LINE__); + cipherInfo->repetitions = 0; + if (cipherInfo->repetitionsToPerfom != 0) { + TIMESTART(); + for (i=0; irepetitionsToPerfom; + i++, cipherInfo->repetitions++) { + rv = ECDSA_SignDigest((ECPrivateKey *)cipherInfo->cx, + &dummyOut, + &cipherInfo->input.pBuf); + CHECKERROR(rv, __LINE__); + } + } else { + int opsBetweenChecks = 0; + TIMEMARK(cipherInfo->seconds); + while (! (TIMETOFINISH())) { + int j = 0; + for (;j < opsBetweenChecks;j++) { + rv = ECDSA_SignDigest((ECPrivateKey *)cipherInfo->cx, + &dummyOut, + &cipherInfo->input.pBuf); + CHECKERROR(rv, __LINE__); + } + cipherInfo->repetitions += j; + } + } + TIMEFINISH(cipherInfo->optime, 1.0); + } + bltestCopyIO(cipherInfo->arena, &cipherInfo->params.ecdsa.sig, + &cipherInfo->output); + } else { + TIMESTART(); + rv = ECDSA_VerifyDigest((ECPublicKey *)cipherInfo->cx, + &cipherInfo->params.ecdsa.sig.buf, + &cipherInfo->input.pBuf); + TIMEFINISH(cipherInfo->optime, 1.0); + CHECKERROR(rv, __LINE__); + cipherInfo->repetitions = 0; + if (cipherInfo->repetitionsToPerfom != 0) { + TIMESTART(); + for (i=0; irepetitionsToPerfom; + i++, cipherInfo->repetitions++) { + rv = ECDSA_VerifyDigest((ECPublicKey *)cipherInfo->cx, + &cipherInfo->params.ecdsa.sig.buf, + &cipherInfo->input.pBuf); + CHECKERROR(rv, __LINE__); + } + } else { + int opsBetweenChecks = 0; + TIMEMARK(cipherInfo->seconds); + while (! (TIMETOFINISH())) { + int j = 0; + for (;j < opsBetweenChecks;j++) { + rv = ECDSA_VerifyDigest((ECPublicKey *)cipherInfo->cx, + &cipherInfo->params.ecdsa.sig.buf, + &cipherInfo->input.pBuf); + CHECKERROR(rv, __LINE__); + } + cipherInfo->repetitions += j; + } + } + TIMEFINISH(cipherInfo->optime, 1.0); + } + SECITEM_FreeItem(&dummyOut, PR_FALSE); + return rv; +} +#endif + +SECStatus +cipherDoOp(bltestCipherInfo *cipherInfo) +{ + PRIntervalTime time1, time2; + SECStatus rv = SECSuccess; + int i, len; + int maxLen = cipherInfo->output.pBuf.len; + unsigned char *dummyOut; + if (cipherInfo->mode == bltestDSA) + return dsaOp(cipherInfo); +#ifdef NSS_ENABLE_ECC + else if (cipherInfo->mode == bltestECDSA) + return ecdsaOp(cipherInfo); +#endif + dummyOut = PORT_Alloc(maxLen); + if (is_symmkeyCipher(cipherInfo->mode)) { + TIMESTART(); + rv = (*cipherInfo->cipher.symmkeyCipher)(cipherInfo->cx, + cipherInfo->output.pBuf.data, + &len, maxLen, + cipherInfo->input.pBuf.data, + cipherInfo->input.pBuf.len); + TIMEFINISH(cipherInfo->optime, 1.0); + CHECKERROR(rv, __LINE__); + cipherInfo->repetitions = 0; + if (cipherInfo->repetitionsToPerfom != 0) { + TIMESTART(); + for (i=0; irepetitionsToPerfom; i++, + cipherInfo->repetitions++) { + (*cipherInfo->cipher.symmkeyCipher)(cipherInfo->cx, dummyOut, + &len, maxLen, + cipherInfo->input.pBuf.data, + cipherInfo->input.pBuf.len); + + CHECKERROR(rv, __LINE__); + } + } else { + int opsBetweenChecks = 0; + bltestIO *input = &cipherInfo->input; + TIMEMARK(cipherInfo->seconds); + while (! (TIMETOFINISH())) { + int j = 0; + for (;j < opsBetweenChecks;j++) { + (*cipherInfo->cipher.symmkeyCipher)(cipherInfo->cx, + dummyOut, + &len, maxLen, + input->pBuf.data, + input->pBuf.len); + } + cipherInfo->repetitions += j; + } + } + TIMEFINISH(cipherInfo->optime, 1.0); + } else if (is_pubkeyCipher(cipherInfo->mode)) { + TIMESTART(); + rv = (*cipherInfo->cipher.pubkeyCipher)(cipherInfo->cx, + &cipherInfo->output.pBuf, + &cipherInfo->input.pBuf); + TIMEFINISH(cipherInfo->optime, 1.0); + CHECKERROR(rv, __LINE__); + cipherInfo->repetitions = 0; + if (cipherInfo->repetitionsToPerfom != 0) { + TIMESTART(); + for (i=0; irepetitionsToPerfom; + i++, cipherInfo->repetitions++) { + SECItem dummy; + dummy.data = dummyOut; + dummy.len = maxLen; + (*cipherInfo->cipher.pubkeyCipher)(cipherInfo->cx, &dummy, + &cipherInfo->input.pBuf); + CHECKERROR(rv, __LINE__); + } + } else { + int opsBetweenChecks = 0; + TIMEMARK(cipherInfo->seconds); + while (! (TIMETOFINISH())) { + int j = 0; + for (;j < opsBetweenChecks;j++) { + SECItem dummy; + dummy.data = dummyOut; + dummy.len = maxLen; + (*cipherInfo->cipher.pubkeyCipher)(cipherInfo->cx, &dummy, + &cipherInfo->input.pBuf); + CHECKERROR(rv, __LINE__); + } + cipherInfo->repetitions += j; + } + } + TIMEFINISH(cipherInfo->optime, 1.0); + } else if (is_hashCipher(cipherInfo->mode)) { + TIMESTART(); + rv = (*cipherInfo->cipher.hashCipher)(cipherInfo->output.pBuf.data, + cipherInfo->input.pBuf.data, + cipherInfo->input.pBuf.len); + TIMEFINISH(cipherInfo->optime, 1.0); + CHECKERROR(rv, __LINE__); + cipherInfo->repetitions = 0; + if (cipherInfo->repetitionsToPerfom != 0) { + TIMESTART(); + for (i=0; irepetitionsToPerfom; + i++, cipherInfo->repetitions++) { + (*cipherInfo->cipher.hashCipher)(dummyOut, + cipherInfo->input.pBuf.data, + cipherInfo->input.pBuf.len); + CHECKERROR(rv, __LINE__); + } + } else { + int opsBetweenChecks = 0; + TIMEMARK(cipherInfo->seconds); + while (! (TIMETOFINISH())) { + int j = 0; + for (;j < opsBetweenChecks;j++) { + bltestIO *input = &cipherInfo->input; + (*cipherInfo->cipher.hashCipher)(dummyOut, + input->pBuf.data, + input->pBuf.len); + CHECKERROR(rv, __LINE__); + } + cipherInfo->repetitions += j; + } + } + TIMEFINISH(cipherInfo->optime, 1.0); + } + PORT_Free(dummyOut); + return rv; +} + +SECStatus +cipherFinish(bltestCipherInfo *cipherInfo) +{ + switch (cipherInfo->mode) { + case bltestDES_ECB: + case bltestDES_CBC: + case bltestDES_EDE_ECB: + case bltestDES_EDE_CBC: + DES_DestroyContext((DESContext *)cipherInfo->cx, PR_TRUE); + break; + case bltestAES_ECB: + case bltestAES_CBC: + AES_DestroyContext((AESContext *)cipherInfo->cx, PR_TRUE); + break; + case bltestCAMELLIA_ECB: + case bltestCAMELLIA_CBC: + Camellia_DestroyContext((CamelliaContext *)cipherInfo->cx, PR_TRUE); + break; + case bltestSEED_ECB: + case bltestSEED_CBC: + SEED_DestroyContext((SEEDContext *)cipherInfo->cx, PR_TRUE); + break; + case bltestRC2_ECB: + case bltestRC2_CBC: + RC2_DestroyContext((RC2Context *)cipherInfo->cx, PR_TRUE); + break; + case bltestRC4: + RC4_DestroyContext((RC4Context *)cipherInfo->cx, PR_TRUE); + break; +#ifdef NSS_SOFTOKEN_DOES_RC5 + case bltestRC5_ECB: + case bltestRC5_CBC: + RC5_DestroyContext((RC5Context *)cipherInfo->cx, PR_TRUE); + break; +#endif + case bltestRSA: /* keys are alloc'ed within cipherInfo's arena, */ + case bltestDSA: /* will be freed with it. */ +#ifdef NSS_ENABLE_ECC + case bltestECDSA: +#endif + case bltestMD2: /* hash contexts are ephemeral */ + case bltestMD5: + case bltestSHA1: + case bltestSHA256: + case bltestSHA384: + case bltestSHA512: + return SECSuccess; + break; + default: + return SECFailure; + } + return SECSuccess; +} + +void +print_exponent(SECItem *exp) +{ + int i; + int e = 0; + if (exp->len <= 4) { + for (i=exp->len; i >=0; --i) e |= exp->data[exp->len-i] << 8*(i-1); + fprintf(stdout, "%12d", e); + } else { + e = 8*exp->len; + fprintf(stdout, "~2**%-8d", e); + } +} + +static void +splitToReportUnit(PRInt64 res, int *resArr, int *del, int size) +{ + PRInt64 remaining = res, tmp = 0; + PRInt64 Ldel; + int i = -1; + + while (remaining > 0 && ++i < size) { + LL_I2L(Ldel, del[i]); + LL_MOD(tmp, remaining, Ldel); + LL_L2I(resArr[i], tmp); + LL_DIV(remaining, remaining, Ldel); + } +} + +static char* +getHighUnitBytes(PRInt64 res) +{ + int spl[] = {0, 0, 0, 0}; + int del[] = {1024, 1024, 1024, 1024}; + char *marks[] = {"b", "Kb", "Mb", "Gb"}; + int i = 3; + + splitToReportUnit(res, spl, del, 4); + + for (;i>0;i--) { + if (spl[i] != 0) { + break; + } + } + + return PR_smprintf("%d%s", spl[i], marks[i]); +} + + +static void +printPR_smpString(const char *sformat, char *reportStr, + const char *nformat, PRInt64 rNum) +{ + if (reportStr) { + fprintf(stdout, sformat, reportStr); + PR_smprintf_free(reportStr); + } else { + int prnRes; + LL_L2I(prnRes, rNum); + fprintf(stdout, nformat, rNum); + } +} + +static char* +getHighUnitOps(PRInt64 res) +{ + int spl[] = {0, 0, 0, 0}; + int del[] = {1000, 1000, 1000, 1000}; + char *marks[] = {"", "T", "M", "B"}; + int i = 3; + + splitToReportUnit(res, spl, del, 4); + + for (;i>0;i--) { + if (spl[i] != 0) { + break; + } + } + + return PR_smprintf("%d%s", spl[i], marks[i]); +} + +void +dump_performance_info(bltestCipherInfo *infoList, double totalTimeInt, + PRBool encrypt, PRBool cxonly) +{ + bltestCipherInfo *info = infoList; + + PRInt64 totalIn = 0; + PRBool td = PR_TRUE; + + int repetitions = 0; + int cxreps = 0; + double cxtime = 0; + double optime = 0; + while (info != NULL) { + repetitions += info->repetitions; + cxreps += info->cxreps; + cxtime += info->cxtime; + optime += info->optime; + totalIn += (PRInt64) info->input.buf.len * (PRInt64) info->repetitions; + + info = info->next; + } + info = infoList; + + fprintf(stdout, "#%9s", "mode"); + fprintf(stdout, "%12s", "in"); +print_td: + switch (info->mode) { + case bltestDES_ECB: + case bltestDES_CBC: + case bltestDES_EDE_ECB: + case bltestDES_EDE_CBC: + case bltestAES_ECB: + case bltestAES_CBC: + case bltestCAMELLIA_ECB: + case bltestCAMELLIA_CBC: + case bltestSEED_ECB: + case bltestSEED_CBC: + case bltestRC2_ECB: + case bltestRC2_CBC: + case bltestRC4: + if (td) + fprintf(stdout, "%8s", "symmkey"); + else + fprintf(stdout, "%8d", 8*info->params.sk.key.buf.len); + break; +#ifdef NSS_SOFTOKEN_DOES_RC5 + case bltestRC5_ECB: + case bltestRC5_CBC: + if (info->params.sk.key.buf.len > 0) + printf("symmetric key(bytes)=%d,", info->params.sk.key.buf.len); + if (info->rounds > 0) + printf("rounds=%d,", info->params.rc5.rounds); + if (info->wordsize > 0) + printf("wordsize(bytes)=%d,", info->params.rc5.wordsize); + break; +#endif + case bltestRSA: + if (td) { + fprintf(stdout, "%8s", "rsa_mod"); + fprintf(stdout, "%12s", "rsa_pe"); + } else { + fprintf(stdout, "%8d", info->params.rsa.keysizeInBits); + print_exponent(&info->params.rsa.rsakey->publicExponent); + } + break; + case bltestDSA: + if (td) + fprintf(stdout, "%8s", "pqg_mod"); + else + fprintf(stdout, "%8d", PQG_INDEX_TO_PBITS(info->params.dsa.j)); + break; +#ifdef NSS_ENABLE_ECC + case bltestECDSA: + if (td) + fprintf(stdout, "%12s", "ec_curve"); + else { + ECCurveName curveName = info->params.ecdsa.eckey->ecParams.name; + fprintf(stdout, "%12s", + ecCurve_map[curveName]? ecCurve_map[curveName]->text: + "Unsupported curve"); + } + break; +#endif + case bltestMD2: + case bltestMD5: + case bltestSHA1: + case bltestSHA256: + case bltestSHA384: + case bltestSHA512: + default: + break; + } + if (!td) { + PRInt64 totalThroughPut; + + printPR_smpString("%8s", getHighUnitOps(repetitions), + "%8d", repetitions); + + printPR_smpString("%8s", getHighUnitOps(cxreps), "%8d", cxreps); + + fprintf(stdout, "%12.3f", cxtime); + fprintf(stdout, "%12.3f", optime); + fprintf(stdout, "%12.03f", totalTimeInt / 1000); + + totalThroughPut = (PRInt64)(totalIn / totalTimeInt * 1000); + printPR_smpString("%12s", getHighUnitBytes(totalThroughPut), + "%12d", totalThroughPut); + + fprintf(stdout, "\n"); + return; + } + + fprintf(stdout, "%8s", "opreps"); + fprintf(stdout, "%8s", "cxreps"); + fprintf(stdout, "%12s", "context"); + fprintf(stdout, "%12s", "op"); + fprintf(stdout, "%12s", "time(sec)"); + fprintf(stdout, "%12s", "thrgput"); + fprintf(stdout, "\n"); + fprintf(stdout, "%8s", mode_strings[info->mode]); + fprintf(stdout, "_%c", (cxonly) ? 'c' : (encrypt) ? 'e' : 'd'); + printPR_smpString("%12s", getHighUnitBytes(totalIn), "%12d", totalIn); + + td = !td; + goto print_td; +} + +void +printmodes() +{ + bltestCipherMode mode; + int nummodes = sizeof(mode_strings) / sizeof(char *); + fprintf(stderr, "%s: Available modes (specify with -m):\n", progName); + for (mode=0; modemode = ioMode; + data->file = NULL; /* don't use -- not saving anything */ + data->pBuf.data = NULL; + data->pBuf.len = 0; + file = PR_Open(fn, PR_RDONLY, 00660); + if (file) + setupIO(arena, data, file, NULL, 0); +} + +void +get_params(PRArenaPool *arena, bltestParams *params, + bltestCipherMode mode, int j) +{ + char filename[256]; + char *modestr = mode_strings[mode]; +#ifdef NSS_SOFTOKEN_DOES_RC5 + FILE *file; + char *mark, *param, *val; + int index = 0; +#endif + switch (mode) { + case bltestDES_CBC: + case bltestDES_EDE_CBC: + case bltestRC2_CBC: + case bltestAES_CBC: + case bltestCAMELLIA_CBC: + case bltestSEED_CBC: + sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "iv", j); + load_file_data(arena, ¶ms->sk.iv, filename, bltestBinary); + case bltestDES_ECB: + case bltestDES_EDE_ECB: + case bltestRC2_ECB: + case bltestRC4: + case bltestAES_ECB: + case bltestCAMELLIA_ECB: + case bltestSEED_ECB: + sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "key", j); + load_file_data(arena, ¶ms->sk.key, filename, bltestBinary); + break; +#ifdef NSS_SOFTOKEN_DOES_RC5 + case bltestRC5_ECB: + case bltestRC5_CBC: + sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "iv", j); + load_file_data(arena, ¶ms->sk.iv, filename, bltestBinary); + sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "key", j); + load_file_data(arena, ¶ms->sk.key, filename, bltestBinary); + sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, + "params", j); + file = fopen(filename, "r"); + if (!file) return; + param = malloc(100); + len = fread(param, 1, 100, file); + while (index < len) { + mark = PL_strchr(param, '='); + *mark = '\0'; + val = mark + 1; + mark = PL_strchr(val, '\n'); + *mark = '\0'; + if (PL_strcmp(param, "rounds") == 0) { + params->rc5.rounds = atoi(val); + } else if (PL_strcmp(param, "wordsize") == 0) { + params->rc5.wordsize = atoi(val); + } + index += PL_strlen(param) + PL_strlen(val) + 2; + param = mark + 1; + } + break; +#endif + case bltestRSA: + sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "key", j); + load_file_data(arena, ¶ms->rsa.key, filename, bltestBase64Encoded); + params->rsa.rsakey = rsakey_from_filedata(¶ms->key.buf); + break; + case bltestDSA: + sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "key", j); + load_file_data(arena, ¶ms->dsa.key, filename, bltestBase64Encoded); + params->dsa.dsakey = dsakey_from_filedata(¶ms->key.buf); + sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "pqg", j); + load_file_data(arena, ¶ms->dsa.pqgdata, filename, + bltestBase64Encoded); + params->dsa.pqg = pqg_from_filedata(¶ms->dsa.pqgdata.buf); + sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "keyseed", j); + load_file_data(arena, ¶ms->dsa.keyseed, filename, + bltestBase64Encoded); + sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "sigseed", j); + load_file_data(arena, ¶ms->dsa.sigseed, filename, + bltestBase64Encoded); + sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "ciphertext",j); + load_file_data(arena, ¶ms->dsa.sig, filename, bltestBase64Encoded); + break; +#ifdef NSS_ENABLE_ECC + case bltestECDSA: + sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "key", j); + load_file_data(arena, ¶ms->ecdsa.key, filename, bltestBase64Encoded); + params->ecdsa.eckey = eckey_from_filedata(¶ms->key.buf); + sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "sigseed", j); + load_file_data(arena, ¶ms->ecdsa.sigseed, filename, + bltestBase64Encoded); + sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "ciphertext",j); + load_file_data(arena, ¶ms->ecdsa.sig, filename, bltestBase64Encoded); + break; +#endif + case bltestMD2: + case bltestMD5: + case bltestSHA1: + case bltestSHA256: + case bltestSHA384: + case bltestSHA512: + /*params->hash.restart = PR_TRUE;*/ + params->hash.restart = PR_FALSE; + break; + default: + break; + } +} + +SECStatus +verify_self_test(bltestIO *result, bltestIO *cmp, bltestCipherMode mode, + PRBool forward, SECStatus sigstatus) +{ + int res; + char *modestr = mode_strings[mode]; + res = SECITEM_CompareItem(&result->pBuf, &cmp->buf); + if (is_sigCipher(mode)) { + if (forward) { + if (res == 0) { + printf("Signature self-test for %s passed.\n", modestr); + } else { + printf("Signature self-test for %s failed!\n", modestr); + } + } else { + if (sigstatus == SECSuccess) { + printf("Verification self-test for %s passed.\n", modestr); + } else { + printf("Verification self-test for %s failed!\n", modestr); + } + } + return sigstatus; + } else if (is_hashCipher(mode)) { + if (res == 0) { + printf("Hash self-test for %s passed.\n", modestr); + } else { + printf("Hash self-test for %s failed!\n", modestr); + } + } else { + if (forward) { + if (res == 0) { + printf("Encryption self-test for %s passed.\n", modestr); + } else { + printf("Encryption self-test for %s failed!\n", modestr); + } + } else { + if (res == 0) { + printf("Decryption self-test for %s passed.\n", modestr); + } else { + printf("Decryption self-test for %s failed!\n", modestr); + } + } + } + return (res != 0); +} + +static SECStatus +blapi_selftest(bltestCipherMode *modes, int numModes, int inoff, int outoff, + PRBool encrypt, PRBool decrypt) +{ + bltestCipherInfo cipherInfo; + bltestIO pt, ct; + bltestCipherMode mode; + bltestParams *params; + int i, j, nummodes, numtests; + char *modestr; + char filename[256]; + PRFileDesc *file; + PRArenaPool *arena; + SECItem item; + PRBool finished; + SECStatus rv = SECSuccess, srv; + + PORT_Memset(&cipherInfo, 0, sizeof(cipherInfo)); + arena = PORT_NewArena(BLTEST_DEFAULT_CHUNKSIZE); + cipherInfo.arena = arena; + + finished = PR_FALSE; + nummodes = (numModes == 0) ? NUMMODES : numModes; + for (i=0; i < nummodes && !finished; i++) { + if (numModes > 0) + mode = modes[i]; + else + mode = i; + if (mode == bltestINVALID) { + fprintf(stderr, "%s: Skipping invalid mode.\n",progName); + continue; + } + modestr = mode_strings[mode]; + cipherInfo.mode = mode; + params = &cipherInfo.params; +#ifdef TRACK_BLTEST_BUG + if (mode == bltestRSA) { + fprintf(stderr, "[%s] Self-Testing RSA\n", __bltDBG); + } +#endif + /* get the number of tests in the directory */ + sprintf(filename, "%s/tests/%s/%s", testdir, modestr, "numtests"); + file = PR_Open(filename, PR_RDONLY, 00660); + if (!file) { + fprintf(stderr, "%s: File %s does not exist.\n", progName,filename); + return SECFailure; + } + rv = SECU_FileToItem(&item, file); +#ifdef TRACK_BLTEST_BUG + if (mode == bltestRSA) { + fprintf(stderr, "[%s] Loaded data from %s\n", __bltDBG, filename); + } +#endif + PR_Close(file); + /* loop over the tests in the directory */ + numtests = 0; + for (j=0; jmCarlo == PR_TRUE) { + int mciter; + for (mciter=0; mciter<10000; mciter++) { + cipherDoOp(cipherInfo); + memcpy(cipherInfo->input.buf.data, + cipherInfo->output.buf.data, + cipherInfo->input.buf.len); + } + } else { + cipherDoOp(cipherInfo); + } + cipherFinish(cipherInfo); +} + +static void rsaPrivKeyReset(RSAPrivateKey *tstKey) +{ + PLArenaPool *arena; + + tstKey->version.data = NULL; + tstKey->version.len = 0; + tstKey->modulus.data = NULL; + tstKey->modulus.len = 0; + tstKey->publicExponent.data = NULL; + tstKey->publicExponent.len = 0; + tstKey->privateExponent.data = NULL; + tstKey->privateExponent.len = 0; + tstKey->prime1.data = NULL; + tstKey->prime1.len = 0; + tstKey->prime2.data = NULL; + tstKey->prime2.len = 0; + tstKey->exponent1.data = NULL; + tstKey->exponent1.len = 0; + tstKey->exponent2.data = NULL; + tstKey->exponent2.len = 0; + tstKey->coefficient.data = NULL; + tstKey->coefficient.len = 0; + + arena = tstKey->arena; + tstKey->arena = NULL; + if (arena) { + PORT_FreeArena(arena, PR_TRUE); + } +} + + +#define RSA_TEST_EQUAL(comp) \ + if (!SECITEM_ItemsAreEqual(&(src->comp),&(dest->comp))) { \ + fprintf(stderr, "key->" #comp " not equal"); \ + if (src->comp.len != dest->comp.len) { \ + fprintf(stderr, "src_len = %d, dest_len = %d", \ + src->comp.len, dest->comp.len); \ + } \ + fprintf(stderr, "\n"); \ + areEqual = PR_FALSE; \ + } + + +static PRBool rsaPrivKeysAreEqual(RSAPrivateKey *src, RSAPrivateKey *dest) +{ + PRBool areEqual = PR_TRUE; + RSA_TEST_EQUAL(modulus) + RSA_TEST_EQUAL(publicExponent) + RSA_TEST_EQUAL(privateExponent) + RSA_TEST_EQUAL(prime1) + RSA_TEST_EQUAL(prime2) + RSA_TEST_EQUAL(exponent1) + RSA_TEST_EQUAL(exponent2) + RSA_TEST_EQUAL(coefficient) + if (!areEqual) { + fprintf(stderr, "original key:\n"); + dump_rsakey(src); + fprintf(stderr, "recreated key:\n"); + dump_rsakey(dest); + } + return areEqual; +} + +/* + * Test the RSA populate command to see that it can really build + * keys from it's components. + */ +static int doRSAPopulateTest(unsigned int keySize, unsigned long exponent) +{ + RSAPrivateKey *srcKey; + RSAPrivateKey tstKey = { 0 }; + SECItem expitem = { 0, 0, 0 }; + SECStatus rv; + unsigned char pubExp[4]; + int expLen = 0; + int failed = 0; + int i; + + for (i=0; i < sizeof(unsigned long); i++) { + int shift = (sizeof(unsigned long) - i -1 ) * 8; + if (expLen || (exponent && ((unsigned long)0xffL << shift))) { + pubExp[expLen] = (unsigned char) ((exponent >> shift) & 0xff); + expLen++; + } + } + + expitem.data = pubExp; + expitem.len = expLen; + + srcKey = RSA_NewKey(keySize, &expitem); + if (srcKey == NULL) { + fprintf(stderr, "RSA Key Gen failed"); + return -1; + } + + /* test the basic case - most common, public exponent, modulus, prime */ + tstKey.arena = NULL; + rsaPrivKeyReset(&tstKey); + + tstKey.publicExponent = srcKey->publicExponent; + tstKey.modulus = srcKey->modulus; + tstKey.prime1 = srcKey->prime1; + + rv = RSA_PopulatePrivateKey(&tstKey); + if (rv != SECSuccess) { + fprintf(stderr, "RSA Populate failed: pubExp mod p\n"); + failed = 1; + } else if (!rsaPrivKeysAreEqual(&tstKey, srcKey)) { + fprintf(stderr, "RSA Populate key mismatch: pubExp mod p\n"); + failed = 1; + } + + /* test the basic2 case, public exponent, modulus, prime2 */ + rsaPrivKeyReset(&tstKey); + + tstKey.publicExponent = srcKey->publicExponent; + tstKey.modulus = srcKey->modulus; + tstKey.prime1 = srcKey->prime2; /* test with q in the prime1 position */ + + rv = RSA_PopulatePrivateKey(&tstKey); + if (rv != SECSuccess) { + fprintf(stderr, "RSA Populate failed: pubExp mod q\n"); + failed = 1; + } else if (!rsaPrivKeysAreEqual(&tstKey, srcKey)) { + fprintf(stderr, "RSA Populate key mismatch: pubExp mod q\n"); + failed = 1; + } + + /* test the medium case, private exponent, prime1, prime2 */ + rsaPrivKeyReset(&tstKey); + + tstKey.privateExponent = srcKey->privateExponent; + tstKey.prime1 = srcKey->prime2; /* purposefully swap them to make */ + tstKey.prime2 = srcKey->prime1; /* sure populated swaps them back */ + + rv = RSA_PopulatePrivateKey(&tstKey); + if (rv != SECSuccess) { + fprintf(stderr, "RSA Populate failed: privExp p q\n"); + failed = 1; + } else if (!rsaPrivKeysAreEqual(&tstKey, srcKey)) { + fprintf(stderr, "RSA Populate key mismatch: privExp p q\n"); + failed = 1; + } + + /* test the advanced case, public exponent, private exponent, prime2 */ + rsaPrivKeyReset(&tstKey); + + tstKey.privateExponent = srcKey->privateExponent; + tstKey.publicExponent = srcKey->publicExponent; + tstKey.prime2 = srcKey->prime2; /* use q in the prime2 position */ + + rv = RSA_PopulatePrivateKey(&tstKey); + if (rv != SECSuccess) { + fprintf(stderr, "RSA Populate failed: pubExp privExp q\n"); + fprintf(stderr, " - not fatal\n"); + /* it's possible that we can't uniquely determine the original key + * from just the exponents and prime. Populate returns an error rather + * than return the wrong key. */ + } else if (!rsaPrivKeysAreEqual(&tstKey, srcKey)) { + /* if we returned a key, it *must* be correct */ + fprintf(stderr, "RSA Populate key mismatch: pubExp privExp q\n"); + rv = RSA_PrivateKeyCheck(&tstKey); + failed = 1; + } + + /* test the advanced case2, public exponent, private exponent, modulus */ + rsaPrivKeyReset(&tstKey); + + tstKey.privateExponent = srcKey->privateExponent; + tstKey.publicExponent = srcKey->publicExponent; + tstKey.modulus = srcKey->modulus; + + rv = RSA_PopulatePrivateKey(&tstKey); + if (rv != SECSuccess) { + fprintf(stderr, "RSA Populate failed: pubExp privExp mod\n"); + failed = 1; + } else if (!rsaPrivKeysAreEqual(&tstKey, srcKey)) { + fprintf(stderr, "RSA Populate key mismatch: pubExp privExp mod\n"); + failed = 1; + } + + return failed ? -1 : 0; +} + + + +/* bltest commands */ +enum { + cmd_Decrypt = 0, + cmd_Encrypt, + cmd_FIPS, + cmd_Hash, + cmd_Nonce, + cmd_Dump, + cmd_RSAPopulate, + cmd_Sign, + cmd_SelfTest, + cmd_Verify +}; + +/* bltest options */ +enum { + opt_B64 = 0, + opt_BufSize, + opt_Restart, + opt_SelfTestDir, + opt_Exponent, + opt_SigFile, + opt_KeySize, + opt_Hex, + opt_Input, + opt_PQGFile, + opt_Key, + opt_HexWSpc, + opt_Mode, +#ifdef NSS_ENABLE_ECC + opt_CurveName, +#endif + opt_Output, + opt_Repetitions, + opt_ZeroBuf, + opt_Rounds, + opt_Seed, + opt_SigSeedFile, + opt_CXReps, + opt_IV, + opt_WordSize, + opt_UseSeed, + opt_UseSigSeed, + opt_SeedFile, + opt_InputOffset, + opt_OutputOffset, + opt_MonteCarlo, + opt_ThreadNum, + opt_SecondsToRun, + opt_CmdLine +}; + +static secuCommandFlag bltest_commands[] = +{ + { /* cmd_Decrypt */ 'D', PR_FALSE, 0, PR_FALSE }, + { /* cmd_Encrypt */ 'E', PR_FALSE, 0, PR_FALSE }, + { /* cmd_FIPS */ 'F', PR_FALSE, 0, PR_FALSE }, + { /* cmd_Hash */ 'H', PR_FALSE, 0, PR_FALSE }, + { /* cmd_Nonce */ 'N', PR_FALSE, 0, PR_FALSE }, + { /* cmd_Dump */ 'P', PR_FALSE, 0, PR_FALSE }, + { /* cmd_RSAPopulate*/ 'R', PR_FALSE, 0, PR_FALSE }, + { /* cmd_Sign */ 'S', PR_FALSE, 0, PR_FALSE }, + { /* cmd_SelfTest */ 'T', PR_FALSE, 0, PR_FALSE }, + { /* cmd_Verify */ 'V', PR_FALSE, 0, PR_FALSE } +}; + +static secuCommandFlag bltest_options[] = +{ + { /* opt_B64 */ 'a', PR_FALSE, 0, PR_FALSE }, + { /* opt_BufSize */ 'b', PR_TRUE, 0, PR_FALSE }, + { /* opt_Restart */ 'c', PR_FALSE, 0, PR_FALSE }, + { /* opt_SelfTestDir */ 'd', PR_TRUE, 0, PR_FALSE }, + { /* opt_Exponent */ 'e', PR_TRUE, 0, PR_FALSE }, + { /* opt_SigFile */ 'f', PR_TRUE, 0, PR_FALSE }, + { /* opt_KeySize */ 'g', PR_TRUE, 0, PR_FALSE }, + { /* opt_Hex */ 'h', PR_FALSE, 0, PR_FALSE }, + { /* opt_Input */ 'i', PR_TRUE, 0, PR_FALSE }, + { /* opt_PQGFile */ 'j', PR_TRUE, 0, PR_FALSE }, + { /* opt_Key */ 'k', PR_TRUE, 0, PR_FALSE }, + { /* opt_HexWSpc */ 'l', PR_FALSE, 0, PR_FALSE }, + { /* opt_Mode */ 'm', PR_TRUE, 0, PR_FALSE }, +#ifdef NSS_ENABLE_ECC + { /* opt_CurveName */ 'n', PR_TRUE, 0, PR_FALSE }, +#endif + { /* opt_Output */ 'o', PR_TRUE, 0, PR_FALSE }, + { /* opt_Repetitions */ 'p', PR_TRUE, 0, PR_FALSE }, + { /* opt_ZeroBuf */ 'q', PR_FALSE, 0, PR_FALSE }, + { /* opt_Rounds */ 'r', PR_TRUE, 0, PR_FALSE }, + { /* opt_Seed */ 's', PR_TRUE, 0, PR_FALSE }, + { /* opt_SigSeedFile */ 't', PR_TRUE, 0, PR_FALSE }, + { /* opt_CXReps */ 'u', PR_TRUE, 0, PR_FALSE }, + { /* opt_IV */ 'v', PR_TRUE, 0, PR_FALSE }, + { /* opt_WordSize */ 'w', PR_TRUE, 0, PR_FALSE }, + { /* opt_UseSeed */ 'x', PR_FALSE, 0, PR_FALSE }, + { /* opt_UseSigSeed */ 'y', PR_FALSE, 0, PR_FALSE }, + { /* opt_SeedFile */ 'z', PR_FALSE, 0, PR_FALSE }, + { /* opt_InputOffset */ '1', PR_TRUE, 0, PR_FALSE }, + { /* opt_OutputOffset */ '2', PR_TRUE, 0, PR_FALSE }, + { /* opt_MonteCarlo */ '3', PR_FALSE, 0, PR_FALSE }, + { /* opt_ThreadNum */ '4', PR_TRUE, 0, PR_FALSE }, + { /* opt_SecondsToRun */ '5', PR_TRUE, 0, PR_FALSE }, + { /* opt_CmdLine */ '-', PR_FALSE, 0, PR_FALSE } +}; + +int main(int argc, char **argv) +{ + char *infileName, *outfileName, *keyfileName, *ivfileName; + SECStatus rv = SECFailure; + + double totalTime; + PRIntervalTime time1, time2; + PRFileDesc *outfile = NULL; + bltestCipherInfo *cipherInfoListHead, *cipherInfo; + bltestIOMode ioMode; + int bufsize, exponent, curThrdNum; +#ifdef NSS_ENABLE_ECC + char *curveName = NULL; +#endif + int i, commandsEntered; + int inoff, outoff; + int threads = 1; + + secuCommand bltest; + bltest.numCommands = sizeof(bltest_commands) / sizeof(secuCommandFlag); + bltest.numOptions = sizeof(bltest_options) / sizeof(secuCommandFlag); + bltest.commands = bltest_commands; + bltest.options = bltest_options; + + progName = strrchr(argv[0], '/'); + if (!progName) + progName = strrchr(argv[0], '\\'); + progName = progName ? progName+1 : argv[0]; + + rv = RNG_RNGInit(); + if (rv != SECSuccess) { + SECU_PrintPRandOSError(progName); + return -1; + } + rv = BL_Init(); + if (rv != SECSuccess) { + SECU_PrintPRandOSError(progName); + return -1; + } + RNG_SystemInfoForRNG(); + + rv = SECU_ParseCommandLine(argc, argv, progName, &bltest); + if (rv == SECFailure) { + fprintf(stderr, "%s: command line parsing error!\n", progName); + goto print_usage; + } + rv = SECFailure; + + cipherInfo = PORT_ZNew(bltestCipherInfo); + cipherInfoListHead = cipherInfo; + /* set some defaults */ + infileName = outfileName = keyfileName = ivfileName = NULL; + + /* Check the number of commands entered on the command line. */ + commandsEntered = 0; + for (i=0; i 1 && + !(commandsEntered == 2 && bltest.commands[cmd_SelfTest].activated)) { + fprintf(stderr, "%s: one command at a time!\n", progName); + goto print_usage; + } + + if (commandsEntered == 0) { + fprintf(stderr, "%s: you must enter a command!\n", progName); + goto print_usage; + } + + + if (bltest.commands[cmd_Sign].activated) + bltest.commands[cmd_Encrypt].activated = PR_TRUE; + if (bltest.commands[cmd_Verify].activated) + bltest.commands[cmd_Decrypt].activated = PR_TRUE; + if (bltest.commands[cmd_Hash].activated) + bltest.commands[cmd_Encrypt].activated = PR_TRUE; + + inoff = outoff = 0; + if (bltest.options[opt_InputOffset].activated) + inoff = PORT_Atoi(bltest.options[opt_InputOffset].arg); + if (bltest.options[opt_OutputOffset].activated) + outoff = PORT_Atoi(bltest.options[opt_OutputOffset].arg); + + testdir = (bltest.options[opt_SelfTestDir].activated) ? + strdup(bltest.options[opt_SelfTestDir].arg) : "."; + + /* + * Handle three simple cases first + */ + + /* test the RSA_PopulatePrivateKey function */ + if (bltest.commands[cmd_RSAPopulate].activated) { + unsigned int keySize = 1024; + unsigned long exponent = 65537; + int rounds = 1; + int ret; + + if (bltest.options[opt_KeySize].activated) { + keySize = PORT_Atoi(bltest.options[opt_KeySize].arg); + } + if (bltest.options[opt_Rounds].activated) { + rounds = PORT_Atoi(bltest.options[opt_Rounds].arg); + } + if (bltest.options[opt_Exponent].activated) { + exponent = PORT_Atoi(bltest.options[opt_Exponent].arg); + } + + for (i=0; i < rounds; i++) { + printf("Running RSA Populate test round %d\n",i); + ret = doRSAPopulateTest(keySize,exponent); + if (ret != 0) { + break; + } + } + if (ret != 0) { + fprintf(stderr,"RSA Populate test round %d: FAILED\n",i); + } + return ret; + } + + /* Do BLAPI self-test */ + if (bltest.commands[cmd_SelfTest].activated) { + PRBool encrypt = PR_TRUE, decrypt = PR_TRUE; + /* user may specified a set of ciphers to test. parse them. */ + bltestCipherMode modesToTest[NUMMODES]; + int numModesToTest = 0; + char *tok, *str; + str = bltest.options[opt_Mode].arg; + while (str) { + tok = strchr(str, ','); + if (tok) *tok = '\0'; + modesToTest[numModesToTest++] = get_mode(str); + if (tok) { + *tok = ','; + str = tok + 1; + } else { + break; + } + } + if (bltest.commands[cmd_Decrypt].activated && + !bltest.commands[cmd_Encrypt].activated) + encrypt = PR_FALSE; + if (bltest.commands[cmd_Encrypt].activated && + !bltest.commands[cmd_Decrypt].activated) + decrypt = PR_FALSE; + rv = blapi_selftest(modesToTest, numModesToTest, inoff, outoff, + encrypt, decrypt); + PORT_Free(cipherInfo); + return rv; + } + + /* Do FIPS self-test */ + if (bltest.commands[cmd_FIPS].activated) { + CK_RV ckrv = sftk_fipsPowerUpSelfTest(); + fprintf(stdout, "CK_RV: %ld.\n", ckrv); + PORT_Free(cipherInfo); + if (ckrv == CKR_OK) + return SECSuccess; + return SECFailure; + } + + /* + * Check command line arguments for Encrypt/Decrypt/Hash/Sign/Verify + */ + + if ((bltest.commands[cmd_Decrypt].activated || + bltest.commands[cmd_Verify].activated) && + bltest.options[opt_BufSize].activated) { + fprintf(stderr, "%s: Cannot use a nonce as input to decrypt/verify.\n", + progName); + goto print_usage; + } + + if (bltest.options[opt_Mode].activated) { + cipherInfo->mode = get_mode(bltest.options[opt_Mode].arg); + if (cipherInfo->mode == bltestINVALID) { + goto print_usage; + } + } else { + fprintf(stderr, "%s: You must specify a cipher mode with -m.\n", + progName); + goto print_usage; + } + + + if (bltest.options[opt_Repetitions].activated && + bltest.options[opt_SecondsToRun].activated) { + fprintf(stderr, "%s: Operation time should be defined in either " + "repetitions(-p) or seconds(-5) not both", + progName); + goto print_usage; + } + + if (bltest.options[opt_Repetitions].activated) { + cipherInfo->repetitionsToPerfom = + PORT_Atoi(bltest.options[opt_Repetitions].arg); + } else { + cipherInfo->repetitionsToPerfom = 0; + } + + if (bltest.options[opt_SecondsToRun].activated) { + cipherInfo->seconds = PORT_Atoi(bltest.options[opt_SecondsToRun].arg); + } else { + cipherInfo->seconds = 0; + } + + + if (bltest.options[opt_CXReps].activated) { + cipherInfo->cxreps = PORT_Atoi(bltest.options[opt_CXReps].arg); + } else { + cipherInfo->cxreps = 0; + } + + if (bltest.options[opt_ThreadNum].activated) { + threads = PORT_Atoi(bltest.options[opt_ThreadNum].arg); + if (threads <= 0) { + threads = 1; + } + } + + /* Dump a file (rsakey, dsakey, etc.) */ + if (bltest.commands[cmd_Dump].activated) { + rv = dump_file(cipherInfo->mode, bltest.options[opt_Input].arg); + PORT_Free(cipherInfo); + return rv; + } + + /* default input mode is binary */ + ioMode = (bltest.options[opt_B64].activated) ? bltestBase64Encoded : + (bltest.options[opt_Hex].activated) ? bltestHexStream : + (bltest.options[opt_HexWSpc].activated) ? bltestHexSpaceDelim : + bltestBinary; + + if (bltest.options[opt_Exponent].activated) + exponent = PORT_Atoi(bltest.options[opt_Exponent].arg); + else + exponent = 65537; + +#ifdef NSS_ENABLE_ECC + if (bltest.options[opt_CurveName].activated) + curveName = PORT_Strdup(bltest.options[opt_CurveName].arg); + else + curveName = NULL; +#endif + + if (bltest.commands[cmd_Verify].activated && + !bltest.options[opt_SigFile].activated) { + fprintf(stderr, "%s: You must specify a signature file with -f.\n", + progName); + + print_usage: + PORT_Free(cipherInfo); + Usage(); + } + + if (bltest.options[opt_MonteCarlo].activated) { + cipherInfo->mCarlo = PR_TRUE; + } else { + cipherInfo->mCarlo = PR_FALSE; + } + + for (curThrdNum = 0;curThrdNum < threads;curThrdNum++) { + int keysize = 0; + PRFileDesc *file = NULL, *infile; + bltestParams *params; + char *instr = NULL; + PRArenaPool *arena; + + if (curThrdNum > 0) { + bltestCipherInfo *newCInfo = PORT_ZNew(bltestCipherInfo); + if (!newCInfo) { + fprintf(stderr, "%s: Can not allocate memory.\n", progName); + goto exit_point; + } + newCInfo->mode = cipherInfo->mode; + newCInfo->mCarlo = cipherInfo->mCarlo; + newCInfo->repetitionsToPerfom = + cipherInfo->repetitionsToPerfom; + newCInfo->seconds = cipherInfo->seconds; + newCInfo->cxreps = cipherInfo->cxreps; + cipherInfo->next = newCInfo; + cipherInfo = newCInfo; + } + arena = PORT_NewArena(BLTEST_DEFAULT_CHUNKSIZE); + if (!arena) { + fprintf(stderr, "%s: Can not allocate memory.\n", progName); + goto exit_point; + } + cipherInfo->arena = arena; + params = &cipherInfo->params; + + /* Set up an encryption key. */ + keysize = 0; + file = NULL; + if (is_symmkeyCipher(cipherInfo->mode)) { + char *keystr = NULL; /* if key is on command line */ + if (bltest.options[opt_Key].activated) { + if (bltest.options[opt_CmdLine].activated) { + keystr = bltest.options[opt_Key].arg; + } else { + file = PR_Open(bltest.options[opt_Key].arg, + PR_RDONLY, 00660); + } + } else { + if (bltest.options[opt_KeySize].activated) + keysize = PORT_Atoi(bltest.options[opt_KeySize].arg); + else + keysize = 8; /* use 64-bit default (DES) */ + /* save the random key for reference */ + file = PR_Open("tmp.key", PR_WRONLY|PR_CREATE_FILE, 00660); + } + params->key.mode = ioMode; + setupIO(cipherInfo->arena, ¶ms->key, file, keystr, keysize); + if (file) + PR_Close(file); + } else if (is_pubkeyCipher(cipherInfo->mode)) { + if (bltest.options[opt_Key].activated) { + file = PR_Open(bltest.options[opt_Key].arg, PR_RDONLY, 00660); + } else { + if (bltest.options[opt_KeySize].activated) + keysize = PORT_Atoi(bltest.options[opt_KeySize].arg); + else + keysize = 64; /* use 512-bit default */ + file = PR_Open("tmp.key", PR_WRONLY|PR_CREATE_FILE, 00660); + } + params->key.mode = bltestBase64Encoded; +#ifdef NSS_ENABLE_ECC + pubkeyInitKey(cipherInfo, file, keysize, exponent, curveName); +#else + pubkeyInitKey(cipherInfo, file, keysize, exponent); +#endif + PR_Close(file); + } + + /* set up an initialization vector. */ + if (cipher_requires_IV(cipherInfo->mode)) { + char *ivstr = NULL; + bltestSymmKeyParams *skp; + file = NULL; +#ifdef NSS_SOFTOKEN_DOES_RC5 + if (cipherInfo->mode == bltestRC5_CBC) + skp = (bltestSymmKeyParams *)¶ms->rc5; + else +#endif + skp = ¶ms->sk; + if (bltest.options[opt_IV].activated) { + if (bltest.options[opt_CmdLine].activated) { + ivstr = bltest.options[opt_IV].arg; + } else { + file = PR_Open(bltest.options[opt_IV].arg, + PR_RDONLY, 00660); + } + } else { + /* save the random iv for reference */ + file = PR_Open("tmp.iv", PR_WRONLY|PR_CREATE_FILE, 00660); + } + memset(&skp->iv, 0, sizeof skp->iv); + skp->iv.mode = ioMode; + setupIO(cipherInfo->arena, &skp->iv, file, ivstr, keysize); + if (file) { + PR_Close(file); + } + } + + if (bltest.commands[cmd_Verify].activated) { + file = PR_Open(bltest.options[opt_SigFile].arg, PR_RDONLY, 00660); + if (cipherInfo->mode == bltestDSA) { + memset(&cipherInfo->params.dsa.sig, 0, sizeof(bltestIO)); + cipherInfo->params.dsa.sig.mode = ioMode; + setupIO(cipherInfo->arena, &cipherInfo->params.dsa.sig, + file, NULL, 0); +#ifdef NSS_ENABLE_ECC + } else if (cipherInfo->mode == bltestECDSA) { + memset(&cipherInfo->params.ecdsa.sig, 0, sizeof(bltestIO)); + cipherInfo->params.ecdsa.sig.mode = ioMode; + setupIO(cipherInfo->arena, &cipherInfo->params.ecdsa.sig, + file, NULL, 0); +#endif + } + if (file) { + PR_Close(file); + } + } + + if (bltest.options[opt_PQGFile].activated) { + file = PR_Open(bltest.options[opt_PQGFile].arg, PR_RDONLY, 00660); + params->dsa.pqgdata.mode = bltestBase64Encoded; + setupIO(cipherInfo->arena, ¶ms->dsa.pqgdata, file, NULL, 0); + if (file) { + PR_Close(file); + } + } + + /* Set up the input buffer */ + if (bltest.options[opt_Input].activated) { + if (bltest.options[opt_CmdLine].activated) { + instr = bltest.options[opt_Input].arg; + infile = NULL; + } else { + /* form file name from testdir and input arg. */ + char * filename = bltest.options[opt_Input].arg; + if (bltest.options[opt_SelfTestDir].activated && + testdir && filename && filename[0] != '/') { + filename = PR_smprintf("%s/tests/%s/%s", testdir, + mode_strings[cipherInfo->mode], + filename); + if (!filename) { + fprintf(stderr, "%s: Can not allocate memory.\n", + progName); + goto exit_point; + } + infile = PR_Open(filename, PR_RDONLY, 00660); + PR_smprintf_free(filename); + } else { + infile = PR_Open(filename, PR_RDONLY, 00660); + } + } + } else if (bltest.options[opt_BufSize].activated) { + /* save the random plaintext for reference */ + char *tmpFName = PR_smprintf("tmp.in.%d", curThrdNum); + if (!tmpFName) { + fprintf(stderr, "%s: Can not allocate memory.\n", progName); + goto exit_point; + } + infile = PR_Open(tmpFName, PR_WRONLY|PR_CREATE_FILE, 00660); + PR_smprintf_free(tmpFName); + } else { + infile = PR_STDIN; + } + if (!infile) { + fprintf(stderr, "%s: Failed to open input file.\n", progName); + goto exit_point; + } + cipherInfo->input.mode = ioMode; + + /* Set up the output stream */ + if (bltest.options[opt_Output].activated) { + /* form file name from testdir and input arg. */ + char * filename = bltest.options[opt_Output].arg; + if (bltest.options[opt_SelfTestDir].activated && + testdir && filename && filename[0] != '/') { + filename = PR_smprintf("%s/tests/%s/%s", testdir, + mode_strings[cipherInfo->mode], + filename); + if (!filename) { + fprintf(stderr, "%s: Can not allocate memory.\n", progName); + goto exit_point; + } + outfile = PR_Open(filename, PR_WRONLY|PR_CREATE_FILE, 00660); + PR_smprintf_free(filename); + } else { + outfile = PR_Open(filename, PR_WRONLY|PR_CREATE_FILE, 00660); + } + } else { + outfile = PR_STDOUT; + } + if (!outfile) { + fprintf(stderr, "%s: Failed to open output file.\n", progName); + rv = SECFailure; + goto exit_point; + } + cipherInfo->output.mode = ioMode; + if (bltest.options[opt_SelfTestDir].activated && ioMode == bltestBinary) + cipherInfo->output.mode = bltestBase64Encoded; + + if (is_hashCipher(cipherInfo->mode)) + cipherInfo->params.hash.restart = + bltest.options[opt_Restart].activated; + + bufsize = 0; + if (bltest.options[opt_BufSize].activated) + bufsize = PORT_Atoi(bltest.options[opt_BufSize].arg); + + /*infile = NULL;*/ + setupIO(cipherInfo->arena, &cipherInfo->input, infile, instr, bufsize); + if (infile && infile != PR_STDIN) + PR_Close(infile); + misalignBuffer(cipherInfo->arena, &cipherInfo->input, inoff); + + cipherInit(cipherInfo, bltest.commands[cmd_Encrypt].activated); + misalignBuffer(cipherInfo->arena, &cipherInfo->output, outoff); + } + + if (!bltest.commands[cmd_Nonce].activated) { + TIMESTART(); + cipherInfo = cipherInfoListHead; + while (cipherInfo != NULL) { + cipherInfo->cipherThread = + PR_CreateThread(PR_USER_THREAD, + ThreadExecTest, + cipherInfo, + PR_PRIORITY_NORMAL, + PR_GLOBAL_THREAD, + PR_JOINABLE_THREAD, + 0); + cipherInfo = cipherInfo->next; + } + + cipherInfo = cipherInfoListHead; + while (cipherInfo != NULL) { + PR_JoinThread(cipherInfo->cipherThread); + finishIO(&cipherInfo->output, outfile); + cipherInfo = cipherInfo->next; + } + TIMEFINISH(totalTime, 1); + } + + cipherInfo = cipherInfoListHead; + if (cipherInfo->repetitions > 0 || cipherInfo->cxreps > 0 || + threads > 1) + dump_performance_info(cipherInfoListHead, totalTime, + bltest.commands[cmd_Encrypt].activated, + (cipherInfo->repetitions == 0)); + + rv = SECSuccess; + + exit_point: + if (outfile && outfile != PR_STDOUT) + PR_Close(outfile); + cipherInfo = cipherInfoListHead; + while (cipherInfo != NULL) { + bltestCipherInfo *tmpInfo = cipherInfo; + + if (cipherInfo->arena) + PORT_FreeArena(cipherInfo->arena, PR_TRUE); + cipherInfo = cipherInfo->next; + PORT_Free(tmpInfo); + } + + /*NSS_Shutdown();*/ + + return SECSuccess; +} + diff --git a/mozilla/security/nss/cmd/bltest/manifest.mn b/mozilla/security/nss/cmd/bltest/manifest.mn new file mode 100644 index 0000000..3c283af --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/manifest.mn @@ -0,0 +1,58 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +CORE_DEPTH = ../../.. + +MODULE = nss + +REQUIRES = seccmd dbm softoken + +INCLUDES += -I$(CORE_DEPTH)/nss/lib/softoken + +PROGRAM = bltest + + USE_STATIC_LIBS = 1 + +EXPORTS = \ + $(NULL) + +PRIVATE_EXPORTS = \ + $(NULL) + +CSRCS = \ + blapitest.c \ + $(NULL) + diff --git a/mozilla/security/nss/cmd/bltest/tests/README b/mozilla/security/nss/cmd/bltest/tests/README new file mode 100644 index 0000000..9982a2f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/README @@ -0,0 +1,49 @@ +This directory contains a set of tests for each cipher supported by +BLAPI. Each subdirectory contains known plaintext and ciphertext pairs +(and keys and/or iv's if needed). The tests can be run as a full set +with: + bltest -T +or as subsets, for example: + bltest -T -m des_ecb,md2,rsa + +In each subdirectory, the plaintext, key, and iv are ascii, and treated +as such. The ciphertext is base64-encoded to avoid the hassle of binary +files. + +To add a test, incremement the value in the numtests file. Create a +plaintext, key, and iv file, such that the name of the file is +incrememted one from the last set of tests. For example, if you are +adding the second test, put your data in files named plaintext1, key1, +and iv1 (ignoring key and iv if they are not needed, of course). Make +sure your key and iv are the correct number of bytes for your cipher (a +trailing \n is okay, but any other trailing bytes will be used!). Once +you have your input data, create output data by running bltest on a +trusted implementation. For example, for a new DES ECB test, run + bltest -E -m des_ecb -i plaintext1 -k key1 -o ciphertext1 -a in the +tests/des_ecb directory. Then run + bltest -T des_ecb from the cmd/bltest directory in the tree of the +implementation you want to test. + +Note that the -a option above is important, it tells bltest to expect +the input to be straight ASCII, and not base64 encoded binary! + +Special cases: + +RC5: +RC5 can take additional parameters, the number of rounds to perform and +the wordsize to use. The number of rounds is between is between 0 and +255, and the wordsize is either is either 16, 32, or 64 bits (at this +time only 32-bit is supported). These parameters are specified in a +paramsN file, where N is an index as above. The format of the file is +"rounds=R\nwordsize=W\n". + +public key modes (RSA and DSA): +Asymmetric key ciphers use keys with special properties, so creating a +key file with "Mozilla!" in it will not get you very far! To create a +public key, run bltest with the plaintext you want to encrypt, using a +trusted implementation. bltest will generate a key and store it in +"tmp.key", rename that file to keyN. For example: + bltest -E -m rsa -i plaintext0 -o ciphertext0 -e 65537 -g 32 -a + mv tmp.key key0 + +[note: specifying a keysize (-g) when using RSA is important!] diff --git a/mozilla/security/nss/cmd/bltest/tests/aes_cbc/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/aes_cbc/ciphertext0 new file mode 100644 index 0000000..040a397 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/aes_cbc/ciphertext0 @@ -0,0 +1 @@ +oJLgOzZ1GiWt3DGo2sPKaA== diff --git a/mozilla/security/nss/cmd/bltest/tests/aes_cbc/iv0 b/mozilla/security/nss/cmd/bltest/tests/aes_cbc/iv0 new file mode 100644 index 0000000..4e65bc0 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/aes_cbc/iv0 @@ -0,0 +1 @@ +qwertyuiopasdfgh diff --git a/mozilla/security/nss/cmd/bltest/tests/aes_cbc/key0 b/mozilla/security/nss/cmd/bltest/tests/aes_cbc/key0 new file mode 100644 index 0000000..13911cc --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/aes_cbc/key0 @@ -0,0 +1 @@ +fedcba9876543210 diff --git a/mozilla/security/nss/cmd/bltest/tests/aes_cbc/numtests b/mozilla/security/nss/cmd/bltest/tests/aes_cbc/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/aes_cbc/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/aes_cbc/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/aes_cbc/plaintext0 new file mode 100644 index 0000000..8d6a8d5 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/aes_cbc/plaintext0 @@ -0,0 +1 @@ +0123456789abcdef diff --git a/mozilla/security/nss/cmd/bltest/tests/aes_ecb/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/aes_ecb/ciphertext0 new file mode 100644 index 0000000..d6818c1 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/aes_ecb/ciphertext0 @@ -0,0 +1 @@ +PVuaCIiaKQhblgFCbVMTTg== diff --git a/mozilla/security/nss/cmd/bltest/tests/aes_ecb/key0 b/mozilla/security/nss/cmd/bltest/tests/aes_ecb/key0 new file mode 100644 index 0000000..13911cc --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/aes_ecb/key0 @@ -0,0 +1 @@ +fedcba9876543210 diff --git a/mozilla/security/nss/cmd/bltest/tests/aes_ecb/numtests b/mozilla/security/nss/cmd/bltest/tests/aes_ecb/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/aes_ecb/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/aes_ecb/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/aes_ecb/plaintext0 new file mode 100644 index 0000000..8d6a8d5 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/aes_ecb/plaintext0 @@ -0,0 +1 @@ +0123456789abcdef diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/ciphertext0 new file mode 100644 index 0000000..e789595 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/ciphertext0 @@ -0,0 +1 @@ +taydfPlRJe3wf8Td0xJ9Tw== diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/ciphertext1 b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/ciphertext1 new file mode 100644 index 0000000..7dbd9b0 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/ciphertext1 @@ -0,0 +1 @@ +yoYCZwKnUMcS4ADHxnwObA== diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/ciphertext2 b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/ciphertext2 new file mode 100644 index 0000000..007a2b0 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/ciphertext2 @@ -0,0 +1 @@ +T+Wn4cs1Sbqrh/XtNd4vzQ== diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/iv0 b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/iv0 new file mode 100644 index 0000000..4e65bc0 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/iv0 @@ -0,0 +1 @@ +qwertyuiopasdfgh diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/key0 b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/key0 new file mode 100644 index 0000000..13911cc --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/key0 @@ -0,0 +1 @@ +fedcba9876543210 diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/key1 b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/key1 new file mode 100644 index 0000000..a9cb2f1 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/key1 @@ -0,0 +1 @@ +fedcba9876543210fedcba98 diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/key2 b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/key2 new file mode 100644 index 0000000..ab55fe2 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/key2 @@ -0,0 +1 @@ +fedcba9876543210fedcba9876543210 diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/numtests b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/numtests new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/numtests @@ -0,0 +1 @@ +3 diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/plaintext0 new file mode 100644 index 0000000..8d6a8d5 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_cbc/plaintext0 @@ -0,0 +1 @@ +0123456789abcdef diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/ciphertext0 new file mode 100644 index 0000000..084ba78 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/ciphertext0 @@ -0,0 +1 @@ +6v0CGxSwow3AhsyhunfdbQ== diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/ciphertext1 b/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/ciphertext1 new file mode 100644 index 0000000..dbd6e5f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/ciphertext1 @@ -0,0 +1 @@ +Nf1GwJiBtZT+VPJp+gBhPA== diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/ciphertext2 b/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/ciphertext2 new file mode 100644 index 0000000..0b278ce --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/ciphertext2 @@ -0,0 +1 @@ +ilB/0K3SI86Oecwh7cruGA== diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/key0 b/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/key0 new file mode 100644 index 0000000..13911cc --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/key0 @@ -0,0 +1 @@ +fedcba9876543210 diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/key1 b/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/key1 new file mode 100644 index 0000000..a9cb2f1 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/key1 @@ -0,0 +1 @@ +fedcba9876543210fedcba98 diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/key2 b/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/key2 new file mode 100644 index 0000000..ab55fe2 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/key2 @@ -0,0 +1 @@ +fedcba9876543210fedcba9876543210 diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/numtests b/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/numtests new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/numtests @@ -0,0 +1 @@ +3 diff --git a/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/plaintext0 new file mode 100644 index 0000000..8d6a8d5 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/camellia_ecb/plaintext0 @@ -0,0 +1 @@ +0123456789abcdef diff --git a/mozilla/security/nss/cmd/bltest/tests/des3_cbc/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/des3_cbc/ciphertext0 new file mode 100644 index 0000000..61dae31 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des3_cbc/ciphertext0 @@ -0,0 +1 @@ +KV3MDNGKWOc= diff --git a/mozilla/security/nss/cmd/bltest/tests/des3_cbc/iv0 b/mozilla/security/nss/cmd/bltest/tests/des3_cbc/iv0 new file mode 100644 index 0000000..97b5955 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des3_cbc/iv0 @@ -0,0 +1 @@ +12345678 diff --git a/mozilla/security/nss/cmd/bltest/tests/des3_cbc/key0 b/mozilla/security/nss/cmd/bltest/tests/des3_cbc/key0 new file mode 100644 index 0000000..588efd1 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des3_cbc/key0 @@ -0,0 +1 @@ +abcdefghijklmnopqrstuvwx diff --git a/mozilla/security/nss/cmd/bltest/tests/des3_cbc/numtests b/mozilla/security/nss/cmd/bltest/tests/des3_cbc/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des3_cbc/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/des3_cbc/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/des3_cbc/plaintext0 new file mode 100644 index 0000000..5513e43 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des3_cbc/plaintext0 @@ -0,0 +1 @@ +Mozilla! diff --git a/mozilla/security/nss/cmd/bltest/tests/des3_ecb/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/des3_ecb/ciphertext0 new file mode 100644 index 0000000..76dc820 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des3_ecb/ciphertext0 @@ -0,0 +1 @@ +RgckVNh4QcM= diff --git a/mozilla/security/nss/cmd/bltest/tests/des3_ecb/key0 b/mozilla/security/nss/cmd/bltest/tests/des3_ecb/key0 new file mode 100644 index 0000000..588efd1 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des3_ecb/key0 @@ -0,0 +1 @@ +abcdefghijklmnopqrstuvwx diff --git a/mozilla/security/nss/cmd/bltest/tests/des3_ecb/numtests b/mozilla/security/nss/cmd/bltest/tests/des3_ecb/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des3_ecb/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/des3_ecb/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/des3_ecb/plaintext0 new file mode 100644 index 0000000..5513e43 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des3_ecb/plaintext0 @@ -0,0 +1 @@ +Mozilla! diff --git a/mozilla/security/nss/cmd/bltest/tests/des_cbc/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/des_cbc/ciphertext0 new file mode 100644 index 0000000..67d2ad1 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des_cbc/ciphertext0 @@ -0,0 +1 @@ +Perdg9FMYQ4= diff --git a/mozilla/security/nss/cmd/bltest/tests/des_cbc/iv0 b/mozilla/security/nss/cmd/bltest/tests/des_cbc/iv0 new file mode 100644 index 0000000..97b5955 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des_cbc/iv0 @@ -0,0 +1 @@ +12345678 diff --git a/mozilla/security/nss/cmd/bltest/tests/des_cbc/key0 b/mozilla/security/nss/cmd/bltest/tests/des_cbc/key0 new file mode 100644 index 0000000..65513c1 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des_cbc/key0 @@ -0,0 +1 @@ +zyxwvuts diff --git a/mozilla/security/nss/cmd/bltest/tests/des_cbc/numtests b/mozilla/security/nss/cmd/bltest/tests/des_cbc/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des_cbc/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/des_cbc/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/des_cbc/plaintext0 new file mode 100644 index 0000000..5513e43 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des_cbc/plaintext0 @@ -0,0 +1 @@ +Mozilla! diff --git a/mozilla/security/nss/cmd/bltest/tests/des_ecb/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/des_ecb/ciphertext0 new file mode 100644 index 0000000..8be22fa --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des_ecb/ciphertext0 @@ -0,0 +1 @@ +3bNoWzzNiFc= diff --git a/mozilla/security/nss/cmd/bltest/tests/des_ecb/key0 b/mozilla/security/nss/cmd/bltest/tests/des_ecb/key0 new file mode 100644 index 0000000..65513c1 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des_ecb/key0 @@ -0,0 +1 @@ +zyxwvuts diff --git a/mozilla/security/nss/cmd/bltest/tests/des_ecb/numtests b/mozilla/security/nss/cmd/bltest/tests/des_ecb/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des_ecb/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/des_ecb/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/des_ecb/plaintext0 new file mode 100644 index 0000000..5513e43 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/des_ecb/plaintext0 @@ -0,0 +1 @@ +Mozilla! diff --git a/mozilla/security/nss/cmd/bltest/tests/dsa/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/dsa/ciphertext0 new file mode 100644 index 0000000..8e71505 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/dsa/ciphertext0 @@ -0,0 +1 @@ +fB0bnKWvjT6X5NIkZ5l/Y/DXZ6QNI6j0iPhR/ZERkfj67xRnTWY1cg== diff --git a/mozilla/security/nss/cmd/bltest/tests/dsa/key0 b/mozilla/security/nss/cmd/bltest/tests/dsa/key0 new file mode 100644 index 0000000..e582eeb --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/dsa/key0 @@ -0,0 +1,6 @@ +AAAAQI3ypJRJInaqPSV1m7BoacvqwNg6+40M98u4Mk8NeILl0HYvxbchDq/C6a2s +Mqt6rElpPfv4NyTC7Ac27jHIApEAAAAUx3MhjHN+yO6ZO08t7TD0jtrOkV8AAABA +Ym0CeDnqChNBMWOlW0y1ACmdVSKVbO/LO/8Q85nOLC5xy53l+iS6v1jlt5Uhklyc +xC6fb0ZLCIzFcq9T5teIAgAAAEAZExhx11sWEqgZ8p140bDXNG96p3u2KoWb/WxW +ddqdIS06Nu8Wcu9mC4x8JVzA7HSFj7oz9EwGaZYwp2sDDuMzAAAAFCBwsyI9ujcv +3hwP/HsuO0mLJgYU diff --git a/mozilla/security/nss/cmd/bltest/tests/dsa/keyseed0 b/mozilla/security/nss/cmd/bltest/tests/dsa/keyseed0 new file mode 100644 index 0000000..6eea359 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/dsa/keyseed0 @@ -0,0 +1 @@ +AAAAAAAAAAAAAAAAAAAAAAAAAAA= diff --git a/mozilla/security/nss/cmd/bltest/tests/dsa/numtests b/mozilla/security/nss/cmd/bltest/tests/dsa/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/dsa/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/dsa/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/dsa/plaintext0 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/dsa/plaintext0 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/dsa/pqg0 b/mozilla/security/nss/cmd/bltest/tests/dsa/pqg0 new file mode 100644 index 0000000..f16326c --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/dsa/pqg0 @@ -0,0 +1,4 @@ +AAAAQI3ypJRJInaqPSV1m7BoacvqwNg6+40M98u4Mk8NeILl0HYvxbchDq/C6a2s +Mqt6rElpPfv4NyTC7Ac27jHIApEAAAAUx3MhjHN+yO6ZO08t7TD0jtrOkV8AAABA +Ym0CeDnqChNBMWOlW0y1ACmdVSKVbO/LO/8Q85nOLC5xy53l+iS6v1jlt5Uhklyc +xC6fb0ZLCIzFcq9T5teIAg== diff --git a/mozilla/security/nss/cmd/bltest/tests/dsa/sigseed0 b/mozilla/security/nss/cmd/bltest/tests/dsa/sigseed0 new file mode 100644 index 0000000..05d7fd2 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/dsa/sigseed0 @@ -0,0 +1 @@ +aHpm2QZI+ZOGfhIfTd+d2wEgVYQ= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/README b/mozilla/security/nss/cmd/bltest/tests/ecdsa/README new file mode 100644 index 0000000..764aeec --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/README @@ -0,0 +1,22 @@ +0 secp160k1 +1 secp160r1 +2 secp160r2 +3 nistk163 +4 sect163r1 +5 nistb163 +6 secp192k1 +7 nistp192 +8 secp224k1 +9 nistp224 +10 nistk233 +11 nistb233 +12 nistp256 +13 nistk283 +14 nistb283 +15 nistp384 +16 nistk409 +17 nistb409 +18 nistk571 +19 nistb571 +# the following tests are not yet implemented +#20 nistp521 diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext0 new file mode 100644 index 0000000..14d8e0e --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext0 @@ -0,0 +1 @@ +GoWqve3YezF7HOABQjioFL/3oq32oM9pHsGTQTJE7aFE62nItVqAdg== diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext1 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext1 new file mode 100644 index 0000000..4484aae --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext1 @@ -0,0 +1 @@ +PM6xHbiwP6Xcb44mg7BHtaJvd8PkxgvHAB1sh2cF0so3naFf0Tj6vQ== diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext10 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext10 new file mode 100644 index 0000000..a956d53 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext10 @@ -0,0 +1,2 @@ +AF3bbyED08NTrUgKmag9HiuUbaW0skXA/Bp9RPjRAD6M0rp3nvLDKozI940jxPP1 +nWpHF7VcyCVzJeV6 diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext11 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext11 new file mode 100644 index 0000000..8cc2c26 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext11 @@ -0,0 +1,2 @@ +AOLrxy4FWd29ToUjOwLs6GyQ+dYZN6NkZ8oVO6dsAEXt55ePlCWZbOtmk6v9PrNG +JOsY/MHnGhDeAGRl diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext12 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext12 new file mode 100644 index 0000000..5a05a78 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext12 @@ -0,0 +1,2 @@ +aQHMte9cFByD9Ff3rZOPOtPI75luPoxemmgjXIgh/9jEeoTdDk8xuAYQUkayCfs+ +DpDaGnOLkfAyZ8GcuaCujg== diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext13 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext13 new file mode 100644 index 0000000..690c00a --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext13 @@ -0,0 +1,2 @@ +AaeVCRJQPbpTqa1+zLd/8xAbkz3KKTr0dlS4tuGC8hc9j5esAeEv+7IklbA3v5Jz +jC+nJy4p81iNO5E9H8nfGGckfQSiFzHG diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext14 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext14 new file mode 100644 index 0000000..fe527c6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext14 @@ -0,0 +1,2 @@ +AgU0N7zJPg/1UxmCWD5Z+DqDqkRKjy4heFgayCyopb/u4XErAZArgsjashAxzMKC +PSDJasPT90T5Va8sNtjXtSpHWxc2roV9 diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext15 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext15 new file mode 100644 index 0000000..d109094 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext15 @@ -0,0 +1,2 @@ +NXo8is+7lAoOwWGt7+GBbT/UX8LGs8TXEHBI+tX9311pJ4J3pfBYobgN0ZK6ZBtp +dS6PkrPaQp0S9nrfTOS5uAH95eD1eymRfCbOnjTUKzLuIn53V17vRjdcDtLzrhzX diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext16 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext16 new file mode 100644 index 0000000..d5fe144 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext16 @@ -0,0 +1,3 @@ +ADhxjBz/ACTy4GJlL0tYZpyNpC4DsXND9lJuU7x9N7g6gkpJyBPw3vBYU1olw6PH +dnegpgAm4Gh6MCsZB4KBcLwl1wjt4B3p2eqEqDYn5fiie5f4XuRomvI92jR5Sb+I +nBLCHIppt/Q= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext17 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext17 new file mode 100644 index 0000000..486bf66 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext17 @@ -0,0 +1,3 @@ +AGhHQ6kfdZRgu1svQTXEIewvFVglnUy6ANPumyUbM14AEfRkCUNa1uzvhV1sbWYj +qT3egQCA9MTjThDNJeDOvvL6hVVOryUv4+C3RtkpQGCtdml+CSsjVTej8h9JbMds +Dme40b2G6fE= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext18 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext18 new file mode 100644 index 0000000..7eeef38 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext18 @@ -0,0 +1,3 @@ +AGBuqk48tufy0bKEWpu+xEHsmi+6KCfdwOSRwLDnpVetGe9AWknHDzeTSwe0QxcE +RsEkUZGDpxfzUlCLSSSU+ErrYY/uyLV2AJTb3prB6A2YNwdmFGeRbDoxeOu7FuQA +3gxBQhR+TGMuskeM+BdHFmFrwvTTdHCGzjTBa5S8mbgEJTfeik/it28T/9i+duZ8 diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext19 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext19 new file mode 100644 index 0000000..ef8e5f3 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext19 @@ -0,0 +1,3 @@ +AaiotJfCiWU1d2LFe+t0CcWHDSF7EOlApWYJ+RNRSq8TbkXJIzi6abbb7BovtRwf +i/COYwjS7OnkFQ6x5Pdrb7OZ0dTAdDRXAKtXWSKR20Y4fhnx/HUxisFwKrsCEQ3O +uVtwDG8rh5V8zjBnCEcs5Iy9CsklucibR0PIyglVmW+ZuY42YNebuOC2VUKqHNF7 diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext2 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext2 new file mode 100644 index 0000000..a3837a4 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext2 @@ -0,0 +1 @@ +Vli8Hau3xL8oder6ZdM9Y3fMd92jbguiMq6F+9CUjlUQXy5EwAVGeg== diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext20 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext20 new file mode 100644 index 0000000..67c9924 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext20 @@ -0,0 +1,3 @@ +ALAM5hGnex7TvBbSEzDlfv+n5g7aWyRyZsBbl2Y6wW1plSovbq2GcV6w1ZV1Vlot +70zbqkKyNApvTi3xoD4Ens6pAeLMYDILwaQhnyJZWQv3etbWqUKJZNgfH1IDj03k +n9hbjYLX3y4bc4CnrhOiv5Ab34s7M8wUYcjC+DbHwhLl/S6N diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext3 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext3 new file mode 100644 index 0000000..e9a4808 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext3 @@ -0,0 +1 @@ +AFohw5TN/dpmqbhp/T4z1Rl1boAUA6r9eEPJbYN0zf+eHZzyvezxqjxU diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext4 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext4 new file mode 100644 index 0000000..57ce239 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext4 @@ -0,0 +1 @@ +AtJdCPXn5yQW34jekhsnsNmaMOeeA3KIVl1d2+7pb6QycUAzYccgwSrp diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext5 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext5 new file mode 100644 index 0000000..e476c80 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext5 @@ -0,0 +1 @@ +AzEg0sOGHwxd0o3cv+o9dsRPOzXMAdpgtI6O0uUmVN2+a5qI5FYQlItz diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext6 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext6 new file mode 100644 index 0000000..bdea717 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext6 @@ -0,0 +1 @@ +5+HDXH/ieN8Bzxd3dfxKZoqbbhsm7jyeqWdemt6Xy0kx+7zwSYsh9Ng5KRdy6wtA diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext7 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext7 new file mode 100644 index 0000000..3273fd9 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext7 @@ -0,0 +1 @@ +WcS9umnUASP0X6lHvkWJwPY37ZVvAMLBERHLjL3Vzg6QVjwcS8kDVortTFei3aTx diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext8 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext8 new file mode 100644 index 0000000..636392e --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext8 @@ -0,0 +1,2 @@ +ItpmPaGAaoe2feXPbh5+EASLGnEzyYbEnwJ+JFNSOQcoY4a/cMV2rn8FYyBsEDiZ +LPDBU0i2uOg= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext9 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext9 new file mode 100644 index 0000000..0c43fa3 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/ciphertext9 @@ -0,0 +1,2 @@ +QjzCVGRUjulOLqeBqC5xpY0GWomOrmQUCtImY0czn98a/jHrdgsSRKiMHukBUxM1 +TIRGjkV2L+A= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key0 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key0 new file mode 100644 index 0000000..7c6d61b --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key0 @@ -0,0 +1,2 @@ +AAAABwYFK4EEAAkAAAApBPiF0ntSFtn41JULxlA1l/lHE/zUPGJWkCqtdOryS6yD +WFCoF/IHwHsAAAAUcw+b2b1AJUlmezgu5EjmAGPC0YQ= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key1 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key1 new file mode 100644 index 0000000..049aa1e --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key1 @@ -0,0 +1,2 @@ +AAAABwYFK4EEAAgAAAApBI80VWK9xatmkFRiDTcdeFQ0T9h3h6iVOinMURyWZw0T +5vZqd8/gvwwAAAAUYOQMjDdtNSL5zY0nVWPWY+UJoqQ= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key10 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key10 new file mode 100644 index 0000000..3e33417 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key10 @@ -0,0 +1,3 @@ +AAAABwYFK4EEABoAAAA9BACmzalMQJBOWV2FoyV0tXSpT07Xajq4bB1SUwSY7QGn +dgGC3GBqjPs9vEpqfMMQ2M9k3+5oubWnexNFhQAAAB4BRha/6sE7VSHl92ZqCj5p +LYtBpK23jzfdVWO8SAY= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key11 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key11 new file mode 100644 index 0000000..6111d52 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key11 @@ -0,0 +1,3 @@ +AAAABwYFK4EEABsAAAA9BAD2/x9HSYYVEQ9AU4MivlIKPypJjsm0sTrp8BftlQGv +KaYrKpZCg/CEw3C2kqvke7HAu+10hafK9asRxQAAAB4AXyFCurtsXhahkyJpkb5J +LUg3xVL00vviR0KyFZY= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key12 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key12 new file mode 100644 index 0000000..491fdba --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key12 @@ -0,0 +1,3 @@ +AAAACgYIKoZIzj0DAQcAAABBBNGB7n4kH15tKA/SMpetaQVqg6WxIuuUuMQT2tDX +NN5jKZfaxD47NsTjTr3x3D5t1qRBYuL6VtdgIuxBIHGG9dcAAAAgaGjyZBL+LN3a +7NkGiHJBfqh7XKNH0AnPF3vFWpostIQ= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key13 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key13 new file mode 100644 index 0000000..fc8057a --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key13 @@ -0,0 +1,3 @@ +AAAABwYFK4EEABAAAABJBAT3klWkt7+1Pr6QGEcvEIZplopwt1alrsJUThDOxvUF +7KvBpQLVjB+DQTwYQnEREb/WFyRgUBuIbII0+zd/g0fLHE4PQ8SNlAAAACQFPsMX +mqSVRreUVasUOIZQFB2jnpwCUyoq+xa9SRril5LeOCY= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key14 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key14 new file mode 100644 index 0000000..2e15823 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key14 @@ -0,0 +1,3 @@ +AAAABwYFK4EEABEAAABJBAf/ei/XCrFrMZLBp5BFkKZ3Odn+ZJu7QIAK32Ubuxmi +xgWTewf2vv+KY5kHwsBYuBXmmnKe9Ak9zGP4Lykvgk5n5J6iUz5ycQAAACQAQHXa +d29OqGxoDNCl9xETW3tAL/2hfZzstNuOPLm5kj4j1Dc= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key15 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key15 new file mode 100644 index 0000000..a062f1f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key15 @@ -0,0 +1,4 @@ +AAAABwYFK4EEACIAAABhBLWMJG3t4khPYcsl3H492rAqukJ1RqJm27pqpN54rFGG +r2VDwOfqb9tMninq8IyOh42eaaVOEPXXu4Q/ATWBEfrbTRBjTpzAE2SSPuQma0lM +q0RSVECCgdBOKIhB0H6VxAAAADA3WPjUaMWCS9E5KbVDrEcf5CV5tCNNWJQkwjsA +yALMCiXJqRVXwbq42WMuaELMW+g= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key16 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key16 new file mode 100644 index 0000000..d2694ae --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key16 @@ -0,0 +1,4 @@ +AAAABwYFK4EEACQAAABpBADkgknFgTPuirxQxFlqIK+vcARWzlpJR+qmyRyQsBiz +Nh6Ws036xUKY9M8LxMIWXFNM6aIA2wxKsBF+HHD6oy27EAJSJOGbke/9F9Kv5AiW +2RXA4mllUaxCNsuQ36PqUdqv4FeXxWTpAAAANAHTZloqhR0V4bfyaeo2hojcvY3T +NO04ewNryBpsHZ0bhID0EfewYuwQmX00GYNfuV3mJ2w= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key17 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key17 new file mode 100644 index 0000000..30be057 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key17 @@ -0,0 +1,4 @@ +AAAABwYFK4EEACUAAABpBAAEE/bAmqCjO3FLvN93Q/UjDyDp2sj+F//buuf1hZ0K +1rSOGXMLcBrqVa8R6UJ57F9/Yc0BCTylpJMXjfCr4eDczG4WOQk+5x8kpKQs5Q9U +V3IolHDiQY/Nhn7o4UFn5/mF71T3qUqwAAAANAH/o7jEl9Bw+Arj9uQ7ZHkoPGgx +t92UJg1r/lxa7UUd66iJfRI8n8yQH/sw56D1+CweeII= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key18 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key18 new file mode 100644 index 0000000..bbdcb13 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key18 @@ -0,0 +1,5 @@ +AAAABwYFK4EEACYAAACRBAffZTrfwIl0dciO2fui3UhZw6r+jnFh7gyER92gXL7+ +LzPgTHagd1vdQiIX4K8Dv76KN0BldiFuX5odP7qC26MUaiURDdWT0AWcPmumSSBH +NXZYLLx5hQjW3BTNwV7v5bmUjezfgtuOCC30dQGs2GMgExAmiWRjTkiPrHg1SFKF +3RklauOyMWauaVpEzh3c+wAAAEgAZvLs4/Rx7tS+QGH92fGGIxPWPbVYOpDKwabY +poV2i1BD5Fxvw+eHlvxVOLmRPqRCPTfOLwAeNbHyt17U/BVZ8+svTChlzuA= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key19 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key19 new file mode 100644 index 0000000..31b4071 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key19 @@ -0,0 +1,5 @@ +AAAABwYFK4EEACcAAACRBASpPvOfQVqiMD+cBL/nulFit5pk/5beJ6/KpeIltg4s +6/s7PPggJA59BP7RJwak6rgY3PsRqXVPjyM/1UkUfRUR2BJgOfNTkQe9WF7Y5zXy +TM76cWhOP+sLSoUcscy/HTLCpHqRLLvWZPDzgjrfJqSlydMEDZjWsJRVPk9IfeQ/ +amGiWOhJIQd/bSrAazZn6AAAAEgFz1qZzjHuhuP1boJ7gzndJhQslx1efbESxHSc +wbOpeBpw2MsCAwjtgo3Y8pviFIC8+5MStkFjE8uHQ0ngXc02wm3G0xj8XGQ= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key2 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key2 new file mode 100644 index 0000000..f4ba6f2 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key2 @@ -0,0 +1,2 @@ +AAAABwYFK4EEAB4AAAApBGouC+vgvmItzsLO4hXn+AXi3skEE+M19o/QHLfjibbA +p7av8F4tcGgAAAAUmpQDUgnIkiXPBs0moD4jEmJHato= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key20 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key20 new file mode 100644 index 0000000..c4da348 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key20 @@ -0,0 +1,5 @@ +AAAABwYFK4EEACMAAACFBAHLMSpMFVyG6mXE7SZ5O5Bwv4d8/QiAB3BzpXkyrU1W +jJ9O9uOYTXM+cFtF5v56+LsI4yGkaAl9+RF6lFPjrhpIswCmBmEqMBgZpjoz38my +nLHBI9MaFF8AHkRQwD3LJLo4eSZHOVkdIvDYLwicdlgr0zD3Nf76/HB1+0DkBGqE +MyG22gAAAEIAFah7z179UbqqdH68pzdZsP1ChXjtYZ11rBM0+HP7yLirxH3ahKTt +DjsY19GEjz4gKsaLfLiQ1/Dp+VKVLcBKpk0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key3 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key3 new file mode 100644 index 0000000..689e06b --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key3 @@ -0,0 +1,2 @@ +AAAABwYFK4EEAAEAAAArBAe4qW9DTVGRVIYYznwJZbn8mWXLugA2A+Mv112Bu+y7 +gxI8E4/fEdLTsQAAABUGEQDNcbxi0JhwALA8FCCxvmWYM3E= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key4 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key4 new file mode 100644 index 0000000..90ecb72 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key4 @@ -0,0 +1,2 @@ +AAAABwYFK4EEAAIAAAArBAXw45Pc59l1QWmAB1W6M30lyFzQmAH/0FIFKYgEOYIa +dnEXMwKNwaRdsQAAABUCErj052f+Rth5OxAm376LOAQyvBY= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key5 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key5 new file mode 100644 index 0000000..b9d221f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key5 @@ -0,0 +1,2 @@ +AAAABwYFK4EEAA8AAAArBAFhm71N2wsUOYCwDNr/6rFvNX1okAbki1SNlHq2TQDO +Bktd1M0jlApWVQAAABUCILsraWg3Qi5nBsXQ1pGmZk0YuSA= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key6 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key6 new file mode 100644 index 0000000..92fb463 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key6 @@ -0,0 +1,2 @@ +AAAABwYFK4EEAB8AAAAxBHOYACoc9XsLk5n8NZZKV2U9CDoMj/VRDvqbf+myloR7 +uBfVNm+uVN33Sa65phAfXQAAABitxs6KZtkqU4tglcdQ1Rmk2U74vjYP0JM= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key7 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key7 new file mode 100644 index 0000000..83fced1 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key7 @@ -0,0 +1,2 @@ +AAAACgYIKoZIzj0DAQEAAAAxBOyOI+rIs3x+jsChxQqSVblnoZGqhIM1WX0FMfw+ +D8Dz6Y25iPcAQFpIAWh29FxnrgAAABh+uEQYXwMB783sULxE6PEd1t/MNZ9HSHI= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key8 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key8 new file mode 100644 index 0000000..cc7c610 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key8 @@ -0,0 +1,3 @@ +AAAABwYFK4EEACAAAAA5BKQnZoj4VtlPqrJ5dekM4haG+7PjfgO4wNNIqD7JnrKI +gTUd+oUQ41d517xCObyBaHNzdVPty9DvAAAAHIrG9+FE+OJV5UV2l/op7PCDPI4G +qkpgzPIwe7U= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/key9 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key9 new file mode 100644 index 0000000..ab8f43b --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/key9 @@ -0,0 +1,3 @@ +AAAABwYFK4EEACEAAAA5BGCNDWldzQCbI83PMR96tqR6JnIUpvfIO8l6hIf/QfMc +rx2BbrSLoy6EJmP++Jyw5yNyaoVaNYl6AAAAHDnjgcUSIshTSLuejnSsvtvU363b +1NJv4ULUbIs= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/numtests b/mozilla/security/nss/cmd/bltest/tests/ecdsa/numtests new file mode 100644 index 0000000..aabe6ec --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/numtests @@ -0,0 +1 @@ +21 diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext0 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext0 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext1 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext1 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext1 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext10 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext10 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext10 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext11 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext11 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext11 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext12 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext12 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext12 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext13 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext13 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext13 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext14 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext14 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext14 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext15 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext15 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext15 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext16 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext16 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext16 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext17 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext17 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext17 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext18 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext18 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext18 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext19 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext19 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext19 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext2 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext2 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext2 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext20 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext20 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext20 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext3 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext3 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext3 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext4 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext4 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext4 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext5 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext5 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext5 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext6 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext6 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext6 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext7 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext7 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext7 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext8 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext8 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext8 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext9 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext9 new file mode 100644 index 0000000..48fbdb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/plaintext9 @@ -0,0 +1 @@ +qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed0 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed0 new file mode 100644 index 0000000..05d7fd2 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed0 @@ -0,0 +1 @@ +aHpm2QZI+ZOGfhIfTd+d2wEgVYQ= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed1 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed1 new file mode 100644 index 0000000..05d7fd2 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed1 @@ -0,0 +1 @@ +aHpm2QZI+ZOGfhIfTd+d2wEgVYQ= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed10 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed10 new file mode 100644 index 0000000..6983e5f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed10 @@ -0,0 +1 @@ +fjIzMWJpdHNPZlRleHQwMTAyMDMwNDA1MDYwNzA= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed11 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed11 new file mode 100644 index 0000000..6983e5f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed11 @@ -0,0 +1 @@ +fjIzMWJpdHNPZlRleHQwMTAyMDMwNDA1MDYwNzA= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed12 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed12 new file mode 100644 index 0000000..92aa40c --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed12 @@ -0,0 +1 @@ +/jI1NmJpdHNPZlRleHQwMTAyMDMwNDA1MDYwNzA4MDk= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed13 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed13 new file mode 100644 index 0000000..4ac0765 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed13 @@ -0,0 +1 @@ +ATI4MWJpdHNPZlRleHQwMTAyMDMwNDA1MDYwNzA4MDkwYTBi diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed14 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed14 new file mode 100644 index 0000000..4ac0765 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed14 @@ -0,0 +1 @@ +ATI4MWJpdHNPZlRleHQwMTAyMDMwNDA1MDYwNzA4MDkwYTBi diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed15 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed15 new file mode 100644 index 0000000..0975230 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed15 @@ -0,0 +1 @@ +/jM4NGJpdHNPZlRleHQwMTAyMDMwNDA1MDYwNzA4MDkwYTBiMGMwZDBlMGYxMDEx diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed16 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed16 new file mode 100644 index 0000000..36fbf09 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed16 @@ -0,0 +1 @@ +fjQwN2JpdHNPZlRleHQwMTAyMDMwNDA1MDYwNzA4MDkwYTBiMGMwZDBlMGYxMDExMTIx diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed17 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed17 new file mode 100644 index 0000000..36fbf09 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed17 @@ -0,0 +1 @@ +fjQwN2JpdHNPZlRleHQwMTAyMDMwNDA1MDYwNzA4MDkwYTBiMGMwZDBlMGYxMDExMTIx diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed18 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed18 new file mode 100644 index 0000000..7be8ce6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed18 @@ -0,0 +1,2 @@ +PjU2NmJpdHNPZlRleHQwMDAxMDIwMzA0MDUwNjA3MDgwOTBhMGIwYzBkMGUwZjEwMTExMjEz +MTQxNTE2MTcxODE5MWExYjE= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed19 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed19 new file mode 100644 index 0000000..7be8ce6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed19 @@ -0,0 +1,2 @@ +PjU2NmJpdHNPZlRleHQwMDAxMDIwMzA0MDUwNjA3MDgwOTBhMGIwYzBkMGUwZjEwMTExMjEz +MTQxNTE2MTcxODE5MWExYjE= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed2 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed2 new file mode 100644 index 0000000..05d7fd2 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed2 @@ -0,0 +1 @@ +aHpm2QZI+ZOGfhIfTd+d2wEgVYQ= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed20 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed20 new file mode 100644 index 0000000..f0dddb6 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed20 @@ -0,0 +1,2 @@ +/jUyMGJpdHNPZlRleHQwMDAxMDIwMzA0MDUwNjA3MDgwOTBhMGIwYzBkMGUwZjEwMTExMjEz +MTQxNTE2MTcxODE= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed3 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed3 new file mode 100644 index 0000000..05d7fd2 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed3 @@ -0,0 +1 @@ +aHpm2QZI+ZOGfhIfTd+d2wEgVYQ= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed4 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed4 new file mode 100644 index 0000000..05d7fd2 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed4 @@ -0,0 +1 @@ +aHpm2QZI+ZOGfhIfTd+d2wEgVYQ= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed5 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed5 new file mode 100644 index 0000000..05d7fd2 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed5 @@ -0,0 +1 @@ +aHpm2QZI+ZOGfhIfTd+d2wEgVYQ= diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed6 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed6 new file mode 100644 index 0000000..a068719 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed6 @@ -0,0 +1 @@ +/jE5MmJpdHNPZlRleHQwMDAwMDAwMDAw diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed7 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed7 new file mode 100644 index 0000000..a068719 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed7 @@ -0,0 +1 @@ +/jE5MmJpdHNPZlRleHQwMDAwMDAwMDAw diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed8 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed8 new file mode 100644 index 0000000..01ae265 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed8 @@ -0,0 +1 @@ +/jIyNGJpdHNPZlRleHQwMDAwMDAwMDAwMDAwMA== diff --git a/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed9 b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed9 new file mode 100644 index 0000000..01ae265 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/ecdsa/sigseed9 @@ -0,0 +1 @@ +/jIyNGJpdHNPZlRleHQwMDAwMDAwMDAwMDAwMA== diff --git a/mozilla/security/nss/cmd/bltest/tests/md2/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/md2/ciphertext0 new file mode 100644 index 0000000..22e1fc4 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/md2/ciphertext0 @@ -0,0 +1 @@ +CS/UNcrWhB5Knt7Gf8Tz3Q== diff --git a/mozilla/security/nss/cmd/bltest/tests/md2/numtests b/mozilla/security/nss/cmd/bltest/tests/md2/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/md2/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/md2/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/md2/plaintext0 new file mode 100644 index 0000000..dce2994 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/md2/plaintext0 @@ -0,0 +1 @@ +16-bytes to MD2. diff --git a/mozilla/security/nss/cmd/bltest/tests/md5/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/md5/ciphertext0 new file mode 100644 index 0000000..ea11ee5 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/md5/ciphertext0 @@ -0,0 +1 @@ +XN8lnQuWAiMqmSGfvd8Hdw== diff --git a/mozilla/security/nss/cmd/bltest/tests/md5/numtests b/mozilla/security/nss/cmd/bltest/tests/md5/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/md5/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/md5/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/md5/plaintext0 new file mode 100644 index 0000000..5ae3875 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/md5/plaintext0 @@ -0,0 +1 @@ +63-byte input to MD5 can be a bit tricky, but no problems here. diff --git a/mozilla/security/nss/cmd/bltest/tests/rc2_cbc/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/rc2_cbc/ciphertext0 new file mode 100644 index 0000000..d964ef8 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc2_cbc/ciphertext0 @@ -0,0 +1 @@ +3ki6eVsWpY8= diff --git a/mozilla/security/nss/cmd/bltest/tests/rc2_cbc/iv0 b/mozilla/security/nss/cmd/bltest/tests/rc2_cbc/iv0 new file mode 100644 index 0000000..97b5955 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc2_cbc/iv0 @@ -0,0 +1 @@ +12345678 diff --git a/mozilla/security/nss/cmd/bltest/tests/rc2_cbc/key0 b/mozilla/security/nss/cmd/bltest/tests/rc2_cbc/key0 new file mode 100644 index 0000000..65513c1 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc2_cbc/key0 @@ -0,0 +1 @@ +zyxwvuts diff --git a/mozilla/security/nss/cmd/bltest/tests/rc2_cbc/numtests b/mozilla/security/nss/cmd/bltest/tests/rc2_cbc/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc2_cbc/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/rc2_cbc/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/rc2_cbc/plaintext0 new file mode 100644 index 0000000..5513e43 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc2_cbc/plaintext0 @@ -0,0 +1 @@ +Mozilla! diff --git a/mozilla/security/nss/cmd/bltest/tests/rc2_ecb/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/rc2_ecb/ciphertext0 new file mode 100644 index 0000000..337d307 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc2_ecb/ciphertext0 @@ -0,0 +1 @@ +WT+tc4fANhQ= diff --git a/mozilla/security/nss/cmd/bltest/tests/rc2_ecb/key0 b/mozilla/security/nss/cmd/bltest/tests/rc2_ecb/key0 new file mode 100644 index 0000000..65513c1 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc2_ecb/key0 @@ -0,0 +1 @@ +zyxwvuts diff --git a/mozilla/security/nss/cmd/bltest/tests/rc2_ecb/numtests b/mozilla/security/nss/cmd/bltest/tests/rc2_ecb/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc2_ecb/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/rc2_ecb/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/rc2_ecb/plaintext0 new file mode 100644 index 0000000..5513e43 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc2_ecb/plaintext0 @@ -0,0 +1 @@ +Mozilla! diff --git a/mozilla/security/nss/cmd/bltest/tests/rc4/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/rc4/ciphertext0 new file mode 100644 index 0000000..004f134 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc4/ciphertext0 @@ -0,0 +1 @@ +34sTZJtr20k= diff --git a/mozilla/security/nss/cmd/bltest/tests/rc4/ciphertext1 b/mozilla/security/nss/cmd/bltest/tests/rc4/ciphertext1 new file mode 100644 index 0000000..6050da4 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc4/ciphertext1 @@ -0,0 +1 @@ +34sTZJtr20nGP6VxS3BIBxxIYm6QGIa1rehFHn51z9M= diff --git a/mozilla/security/nss/cmd/bltest/tests/rc4/key0 b/mozilla/security/nss/cmd/bltest/tests/rc4/key0 new file mode 100644 index 0000000..65513c1 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc4/key0 @@ -0,0 +1 @@ +zyxwvuts diff --git a/mozilla/security/nss/cmd/bltest/tests/rc4/key1 b/mozilla/security/nss/cmd/bltest/tests/rc4/key1 new file mode 100644 index 0000000..65513c1 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc4/key1 @@ -0,0 +1 @@ +zyxwvuts diff --git a/mozilla/security/nss/cmd/bltest/tests/rc4/numtests b/mozilla/security/nss/cmd/bltest/tests/rc4/numtests new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc4/numtests @@ -0,0 +1 @@ +2 diff --git a/mozilla/security/nss/cmd/bltest/tests/rc4/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/rc4/plaintext0 new file mode 100644 index 0000000..5513e43 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc4/plaintext0 @@ -0,0 +1 @@ +Mozilla! diff --git a/mozilla/security/nss/cmd/bltest/tests/rc4/plaintext1 b/mozilla/security/nss/cmd/bltest/tests/rc4/plaintext1 new file mode 100644 index 0000000..d41abc7 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc4/plaintext1 @@ -0,0 +1 @@ +Mozilla!Mozilla!Mozilla!Mozilla! diff --git a/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/ciphertext0 new file mode 100644 index 0000000..544713b --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/ciphertext0 @@ -0,0 +1 @@ +qsv4Fn2J6d0= diff --git a/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/iv0 b/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/iv0 new file mode 100644 index 0000000..97b5955 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/iv0 @@ -0,0 +1 @@ +12345678 diff --git a/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/key0 b/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/key0 new file mode 100644 index 0000000..65513c1 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/key0 @@ -0,0 +1 @@ +zyxwvuts diff --git a/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/numtests b/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/params0 b/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/params0 new file mode 100644 index 0000000..d68e036 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/params0 @@ -0,0 +1,2 @@ +rounds=10 +wordsize=4 diff --git a/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/plaintext0 new file mode 100644 index 0000000..5513e43 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc5_cbc/plaintext0 @@ -0,0 +1 @@ +Mozilla! diff --git a/mozilla/security/nss/cmd/bltest/tests/rc5_ecb/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/rc5_ecb/ciphertext0 new file mode 100644 index 0000000..133777d --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc5_ecb/ciphertext0 @@ -0,0 +1 @@ +4ZKK/1v5Ohc= diff --git a/mozilla/security/nss/cmd/bltest/tests/rc5_ecb/key0 b/mozilla/security/nss/cmd/bltest/tests/rc5_ecb/key0 new file mode 100644 index 0000000..65513c1 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc5_ecb/key0 @@ -0,0 +1 @@ +zyxwvuts diff --git a/mozilla/security/nss/cmd/bltest/tests/rc5_ecb/numtests b/mozilla/security/nss/cmd/bltest/tests/rc5_ecb/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc5_ecb/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/rc5_ecb/params0 b/mozilla/security/nss/cmd/bltest/tests/rc5_ecb/params0 new file mode 100644 index 0000000..d68e036 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc5_ecb/params0 @@ -0,0 +1,2 @@ +rounds=10 +wordsize=4 diff --git a/mozilla/security/nss/cmd/bltest/tests/rc5_ecb/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/rc5_ecb/plaintext0 new file mode 100644 index 0000000..5513e43 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rc5_ecb/plaintext0 @@ -0,0 +1 @@ +Mozilla! diff --git a/mozilla/security/nss/cmd/bltest/tests/rsa/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/rsa/ciphertext0 new file mode 100644 index 0000000..943ea59 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rsa/ciphertext0 @@ -0,0 +1 @@ +qPVrXv0y3SC5rY44bIi6GE4Aec8uDpHH7/cCg0FU5as= diff --git a/mozilla/security/nss/cmd/bltest/tests/rsa/key0 b/mozilla/security/nss/cmd/bltest/tests/rsa/key0 new file mode 100644 index 0000000..1352fe9 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rsa/key0 @@ -0,0 +1,4 @@ +AAAAAAAAACC5lyu2K2ro8YGnvOCKaL1sFX1HEIblIVbuMXsa8oeFSwAAAAERAAAA +IBXVjKwFG6LvPG4WOIjBBzmxGNpkQwDs3W5qZcXVzqahAAAAEOEOH/WnhZCJyM39 +oNfhf18AAAAQ0xvmxqXXs3L62xxogUl9lQAAABAaeiHgqkvy4wiQtG1Gkv/tAAAA +EMaw2TNu6SFdKFXAYluQdjEAAAAQi0u+IlgKCt/hatGAsTrfzQ== diff --git a/mozilla/security/nss/cmd/bltest/tests/rsa/numtests b/mozilla/security/nss/cmd/bltest/tests/rsa/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rsa/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/rsa/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/rsa/plaintext0 new file mode 100644 index 0000000..d915bc8 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/rsa/plaintext0 @@ -0,0 +1 @@ +512bitsforRSAPublicKeyEncryption diff --git a/mozilla/security/nss/cmd/bltest/tests/seed_cbc/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/seed_cbc/ciphertext0 new file mode 100644 index 0000000..97e970e --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/seed_cbc/ciphertext0 @@ -0,0 +1 @@ +JVdzim3if1YIcpGABasoCQ== diff --git a/mozilla/security/nss/cmd/bltest/tests/seed_cbc/iv0 b/mozilla/security/nss/cmd/bltest/tests/seed_cbc/iv0 new file mode 100644 index 0000000..2b3b076 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/seed_cbc/iv0 @@ -0,0 +1 @@ +1234567890123456 diff --git a/mozilla/security/nss/cmd/bltest/tests/seed_cbc/key0 b/mozilla/security/nss/cmd/bltest/tests/seed_cbc/key0 new file mode 100644 index 0000000..13911cc --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/seed_cbc/key0 @@ -0,0 +1 @@ +fedcba9876543210 diff --git a/mozilla/security/nss/cmd/bltest/tests/seed_cbc/numtests b/mozilla/security/nss/cmd/bltest/tests/seed_cbc/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/seed_cbc/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/seed_cbc/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/seed_cbc/plaintext0 new file mode 100644 index 0000000..8d6a8d5 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/seed_cbc/plaintext0 @@ -0,0 +1 @@ +0123456789abcdef diff --git a/mozilla/security/nss/cmd/bltest/tests/seed_ecb/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/seed_ecb/ciphertext0 new file mode 100644 index 0000000..314ffbd --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/seed_ecb/ciphertext0 @@ -0,0 +1 @@ +GX8KY3uUhAQnL6XbQhXjEw== diff --git a/mozilla/security/nss/cmd/bltest/tests/seed_ecb/iv0 b/mozilla/security/nss/cmd/bltest/tests/seed_ecb/iv0 new file mode 100644 index 0000000..2b3b076 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/seed_ecb/iv0 @@ -0,0 +1 @@ +1234567890123456 diff --git a/mozilla/security/nss/cmd/bltest/tests/seed_ecb/key0 b/mozilla/security/nss/cmd/bltest/tests/seed_ecb/key0 new file mode 100644 index 0000000..13911cc --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/seed_ecb/key0 @@ -0,0 +1 @@ +fedcba9876543210 diff --git a/mozilla/security/nss/cmd/bltest/tests/seed_ecb/numtests b/mozilla/security/nss/cmd/bltest/tests/seed_ecb/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/seed_ecb/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/seed_ecb/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/seed_ecb/plaintext0 new file mode 100644 index 0000000..8d6a8d5 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/seed_ecb/plaintext0 @@ -0,0 +1 @@ +0123456789abcdef diff --git a/mozilla/security/nss/cmd/bltest/tests/sha1/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/sha1/ciphertext0 new file mode 100644 index 0000000..1fe4bd2 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha1/ciphertext0 @@ -0,0 +1 @@ +cDSMAygXMPIJZC5bntZ4ZhecQ9g= diff --git a/mozilla/security/nss/cmd/bltest/tests/sha1/numtests b/mozilla/security/nss/cmd/bltest/tests/sha1/numtests new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha1/numtests @@ -0,0 +1 @@ +1 diff --git a/mozilla/security/nss/cmd/bltest/tests/sha1/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/sha1/plaintext0 new file mode 100644 index 0000000..863e79c --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha1/plaintext0 @@ -0,0 +1 @@ +A cage went in search of a bird. diff --git a/mozilla/security/nss/cmd/bltest/tests/sha256/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/sha256/ciphertext0 new file mode 100644 index 0000000..07e2ff1 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha256/ciphertext0 @@ -0,0 +1 @@ +ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0= diff --git a/mozilla/security/nss/cmd/bltest/tests/sha256/ciphertext1 b/mozilla/security/nss/cmd/bltest/tests/sha256/ciphertext1 new file mode 100644 index 0000000..2ab6e1d --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha256/ciphertext1 @@ -0,0 +1 @@ +JI1qYdIGOLjlwCaTDD5gOaM85Flk/yFn9uzt1BnbBsE= diff --git a/mozilla/security/nss/cmd/bltest/tests/sha256/numtests b/mozilla/security/nss/cmd/bltest/tests/sha256/numtests new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha256/numtests @@ -0,0 +1 @@ +2 diff --git a/mozilla/security/nss/cmd/bltest/tests/sha256/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/sha256/plaintext0 new file mode 100644 index 0000000..8baef1b --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha256/plaintext0 @@ -0,0 +1 @@ +abc diff --git a/mozilla/security/nss/cmd/bltest/tests/sha256/plaintext1 b/mozilla/security/nss/cmd/bltest/tests/sha256/plaintext1 new file mode 100644 index 0000000..afb5dce --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha256/plaintext1 @@ -0,0 +1 @@ +abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq diff --git a/mozilla/security/nss/cmd/bltest/tests/sha384/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/sha384/ciphertext0 new file mode 100644 index 0000000..c94f91e --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha384/ciphertext0 @@ -0,0 +1 @@ +ywB1P0WjXou1oD1pmsZQBycsMqsO3tFjGotgWkP/W+2AhgcroefMI1i67KE0yCWn diff --git a/mozilla/security/nss/cmd/bltest/tests/sha384/ciphertext1 b/mozilla/security/nss/cmd/bltest/tests/sha384/ciphertext1 new file mode 100644 index 0000000..833f06d --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha384/ciphertext1 @@ -0,0 +1 @@ +CTMMM/cRR+g9GS/Hgs0bR1MRGxc7OwXSL6CAhuOw9xL8x8caVX4tuWbD6fqRdGA5 diff --git a/mozilla/security/nss/cmd/bltest/tests/sha384/numtests b/mozilla/security/nss/cmd/bltest/tests/sha384/numtests new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha384/numtests @@ -0,0 +1 @@ +2 diff --git a/mozilla/security/nss/cmd/bltest/tests/sha384/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/sha384/plaintext0 new file mode 100644 index 0000000..8baef1b --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha384/plaintext0 @@ -0,0 +1 @@ +abc diff --git a/mozilla/security/nss/cmd/bltest/tests/sha384/plaintext1 b/mozilla/security/nss/cmd/bltest/tests/sha384/plaintext1 new file mode 100644 index 0000000..94fcc2b --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha384/plaintext1 @@ -0,0 +1 @@ +abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu diff --git a/mozilla/security/nss/cmd/bltest/tests/sha512/ciphertext0 b/mozilla/security/nss/cmd/bltest/tests/sha512/ciphertext0 new file mode 100644 index 0000000..8b626e2 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha512/ciphertext0 @@ -0,0 +1,2 @@ +3a81oZNherrMQXNJriBBMRLm+k6JqX6iCp7u5ktV05ohkpkqJ0/BqDa6PCOj/uu9 +RU1EI2Q86A4qmslPpUyknw== diff --git a/mozilla/security/nss/cmd/bltest/tests/sha512/ciphertext1 b/mozilla/security/nss/cmd/bltest/tests/sha512/ciphertext1 new file mode 100644 index 0000000..c02d175 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha512/ciphertext1 @@ -0,0 +1,2 @@ +jpWbddrjE9qM9PcoFPwUP493ecbrn3+hcpmurbaIkBhQHSieSQD35DMbmd7EtUM6 +x9Mp7rbdJlReluVbh0vpCQ== diff --git a/mozilla/security/nss/cmd/bltest/tests/sha512/numtests b/mozilla/security/nss/cmd/bltest/tests/sha512/numtests new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha512/numtests @@ -0,0 +1 @@ +2 diff --git a/mozilla/security/nss/cmd/bltest/tests/sha512/plaintext0 b/mozilla/security/nss/cmd/bltest/tests/sha512/plaintext0 new file mode 100644 index 0000000..8baef1b --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha512/plaintext0 @@ -0,0 +1 @@ +abc diff --git a/mozilla/security/nss/cmd/bltest/tests/sha512/plaintext1 b/mozilla/security/nss/cmd/bltest/tests/sha512/plaintext1 new file mode 100644 index 0000000..94fcc2b --- /dev/null +++ b/mozilla/security/nss/cmd/bltest/tests/sha512/plaintext1 @@ -0,0 +1 @@ +abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu diff --git a/mozilla/security/nss/cmd/btoa/Makefile b/mozilla/security/nss/cmd/btoa/Makefile new file mode 100644 index 0000000..6eb6e71 --- /dev/null +++ b/mozilla/security/nss/cmd/btoa/Makefile @@ -0,0 +1,79 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + +include ../platlibs.mk + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + + +include ../platrules.mk + diff --git a/mozilla/security/nss/cmd/btoa/btoa.c b/mozilla/security/nss/cmd/btoa/btoa.c new file mode 100644 index 0000000..f140bdd --- /dev/null +++ b/mozilla/security/nss/cmd/btoa/btoa.c @@ -0,0 +1,213 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "plgetopt.h" +#include "secutil.h" +#include "nssb64.h" +#include + +#if defined(XP_WIN) || (defined(__sun) && !defined(SVR4)) +#if !defined(WIN32) +extern int fread(char *, size_t, size_t, FILE*); +extern int fwrite(char *, size_t, size_t, FILE*); +extern int fprintf(FILE *, char *, ...); +#endif +#endif + +#if defined(WIN32) +#include "fcntl.h" +#include "io.h" +#endif + +static PRInt32 +output_ascii (void *arg, const char *obuf, PRInt32 size) +{ + FILE *outFile = arg; + int nb; + + nb = fwrite(obuf, 1, size, outFile); + if (nb != size) { + PORT_SetError(SEC_ERROR_IO); + return -1; + } + + return nb; +} + +static SECStatus +encode_file(FILE *outFile, FILE *inFile) +{ + NSSBase64Encoder *cx; + int nb; + SECStatus status = SECFailure; + unsigned char ibuf[4096]; + + cx = NSSBase64Encoder_Create(output_ascii, outFile); + if (!cx) { + return -1; + } + + for (;;) { + if (feof(inFile)) break; + nb = fread(ibuf, 1, sizeof(ibuf), inFile); + if (nb != sizeof(ibuf)) { + if (nb == 0) { + if (ferror(inFile)) { + PORT_SetError(SEC_ERROR_IO); + goto loser; + } + /* eof */ + break; + } + } + + status = NSSBase64Encoder_Update(cx, ibuf, nb); + if (status != SECSuccess) goto loser; + } + + status = NSSBase64Encoder_Destroy(cx, PR_FALSE); + if (status != SECSuccess) + return status; + + /* + * Add a trailing CRLF. Note this must be done *after* the call + * to Destroy above (because only then are we sure all data has + * been written out). + */ + fwrite("\r\n", 1, 2, outFile); + return SECSuccess; + + loser: + (void) NSSBase64Encoder_Destroy(cx, PR_TRUE); + return status; +} + +static void Usage(char *progName) +{ + fprintf(stderr, + "Usage: %s [-i input] [-o output]\n", + progName); + fprintf(stderr, "%-20s Define an input file to use (default is stdin)\n", + "-i input"); + fprintf(stderr, "%-20s Define an output file to use (default is stdout)\n", + "-o output"); + exit(-1); +} + +int main(int argc, char **argv) +{ + char *progName; + SECStatus rv; + FILE *inFile, *outFile; + PLOptState *optstate; + PLOptStatus status; + + inFile = 0; + outFile = 0; + progName = strrchr(argv[0], '/'); + if (!progName) + progName = strrchr(argv[0], '\\'); + progName = progName ? progName+1 : argv[0]; + + /* Parse command line arguments */ + optstate = PL_CreateOptState(argc, argv, "i:o:"); + while ((status = PL_GetNextOpt(optstate)) == PL_OPT_OK) { + switch (optstate->option) { + default: + Usage(progName); + break; + + case 'i': + inFile = fopen(optstate->value, "rb"); + if (!inFile) { + fprintf(stderr, "%s: unable to open \"%s\" for reading\n", + progName, optstate->value); + return -1; + } + break; + + case 'o': + outFile = fopen(optstate->value, "wb"); + if (!outFile) { + fprintf(stderr, "%s: unable to open \"%s\" for writing\n", + progName, optstate->value); + return -1; + } + break; + } + } + if (status == PL_OPT_BAD) + Usage(progName); + if (!inFile) { +#if defined(WIN32) + /* If we're going to read binary data from stdin, we must put stdin + ** into O_BINARY mode or else incoming \r\n's will become \n's. + */ + + int smrv = _setmode(_fileno(stdin), _O_BINARY); + if (smrv == -1) { + fprintf(stderr, + "%s: Cannot change stdin to binary mode. Use -i option instead.\n", + progName); + return smrv; + } +#endif + inFile = stdin; + } + if (!outFile) { +#if defined(WIN32) + /* We're going to write binary data to stdout. We must put stdout + ** into O_BINARY mode or else outgoing \r\n's will become \r\r\n's. + */ + + int smrv = _setmode(_fileno(stdout), _O_BINARY); + if (smrv == -1) { + fprintf(stderr, + "%s: Cannot change stdout to binary mode. Use -o option instead.\n", + progName); + return smrv; + } +#endif + outFile = stdout; + } + rv = encode_file(outFile, inFile); + if (rv != SECSuccess) { + fprintf(stderr, "%s: lossage: error=%d errno=%d\n", + progName, PORT_GetError(), errno); + return -1; + } + return 0; +} diff --git a/mozilla/security/nss/cmd/btoa/manifest.mn b/mozilla/security/nss/cmd/btoa/manifest.mn new file mode 100644 index 0000000..394c661 --- /dev/null +++ b/mozilla/security/nss/cmd/btoa/manifest.mn @@ -0,0 +1,53 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +CORE_DEPTH = ../../.. + +# MODULE public and private header directories are implicitly REQUIRED. +MODULE = nss + +# This next line is used by .mk files +# and gets translated into $LINCS in manifest.mnw +# MODULE is implicitly REQUIRED, doesn't need to be listed below. +REQUIRES = seccmd dbm + +DEFINES = -DNSPR20 + +CSRCS = btoa.c + +PROGRAM = btoa + diff --git a/mozilla/security/nss/cmd/certcgi/HOWTO.txt b/mozilla/security/nss/cmd/certcgi/HOWTO.txt new file mode 100644 index 0000000..f02ad32 --- /dev/null +++ b/mozilla/security/nss/cmd/certcgi/HOWTO.txt @@ -0,0 +1,168 @@ + How to setup your very own Cert-O-Matic Root CA server + +***** BEGIN LICENSE BLOCK ***** +Version: MPL 1.1/GPL 2.0/LGPL 2.1 + +The contents of this file are subject to the Mozilla Public License Version +1.1 (the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +for the specific language governing rights and limitations under the +License. + +The Original Code is Netscape security libraries. + +The Initial Developer of the Original Code is Netscape Communications +Corporation. Portions created by the Initial Developer are +Copyright (C) 2001 the Initial Developer. All Rights Reserved. + +Contributor(s): + +Alternatively, the contents of this file may be used under the terms of +either the GNU General Public License Version 2 or later (the "GPL"), or +the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +in which case the provisions of the GPL or the LGPL are applicable instead +of those above. If you wish to allow use of your version of this file only +under the terms of either the GPL or the LGPL, and not to allow others to +use your version of this file under the terms of the MPL, indicate your +decision by deleting the provisions above and replace them with the notice +and other provisions required by the GPL or the LGPL. If you do not delete +the provisions above, a recipient may use your version of this file under +the terms of any one of the MPL, the GPL or the LGPL. + +***** END LICENSE BLOCK ***** + + How to setup your very own Cert-O-Matic Root CA server + +The program certcgi is part of a small test CA that is used inside +Netscape by the NSS development team. That CA is affectionately known +as "Cert-O-Matic" or "Cert-O-Matic II". It presently runs on a server +named interzone.mcom.com inside Netscape's firewall. + +If you wish to setup your own Cert-O-Matic, here are directions. + +Disclaimer: This program does not follow good practices for root CAs. +It should be used only for playing/testing and never for production use. +Remember, you've been warned! + +Cert-O-Matic consists of some html files, shell scripts, one executable +program that uses NSS and NSPR, the usual set of NSS .db files, and a file +in which to remember the serial number of the last cert issued. The +html files and the source to the executable program are in this directory. +Sample shell scripts are shown below. + +The shell scripts and executable program run as CGI "scripts". The +entire thing runs on an ordinary http web server. It would also run on +an https web server. The shell scripts and html files must be +customized for the server on which they run. + +The package assumes you have a "document root" directory $DOCROOT, and a +"cgi-bin" directory $CGIBIN. In this example, the document root is +assumed to be located in /var/www/htdocs, and the cgi-bin directory in +/var/www/cgi-bin. + +The server is assumed to run all cgi scripts as the user "nobody". +The names of the cgi scripts run directly by the server all end in .cgi +because some servers like it that way. + +Instructions: + +- Create directory $DOCROOT/certomatic +- Copy the following files from nss/cmd/certcgi to $DOCROOT/certomatic + ca.html index.html main.html nscp_ext_form.html stnd_ext_form.html +- Edit the html files, substituting the name of your own server for the + server named in those files. +- In some web page (e.g. your server's home page), provide an html link to + $DOCROOT/certomatic/index.html. This is where users start to get their + own certs from certomatic. +- give these files and directories appropriate permissions. + +- Create directories $CGIBIN/certomatic and $CGIBIN/certomatic/bin + make sure that $CGIBIN/certomatic is writable by "nobody" + +- Create a new set of NSS db files there with the following command: + + certutil -N -d $CGIBIN/certomatic + +- when certutil prompts you for the password, enter the word foo + because that is compiled into the certcgi program. + +- Create the new Root CA cert with this command + + certutil -S -x -d $CGIBIN/certomatic -n "Cert-O-Matic II" \ + -s "CN=Cert-O-Matic II, O=Cert-O-Matic II" -t TCu,cu,cu -k rsa \ + -g 1024 -m 10001 -v 60 + + (adjust the -g, -m and -v parameters to taste. -s and -x must be as +shown.) + +- dump out the new root CA cert in base64 encoding: + + certutil -d $CGIBIN/certomatic -L -n "Cert-O-Matic II" -a > \ + $CGIBIN/certomatic/root.cacert + +- In $CGIBIN/certomatic/bin add two shell scripts - one to download the + root CA cert on demand, and one to run the certcgi program. + +download.cgi, the script to install the root CA cert into a browser on +demand, is this: + +#!/bin/sh +echo "Content-type: application/x-x509-ca-cert" +echo +cat $CGIBIN/certomatic/root.cacert + +You'll have to put the real path into that cat command because CGIBIN +won't be defined when this script is run by the server. + +certcgi.cgi, the script to run the certcgi program is similar to this: + +#!/bin/sh +cd $CGIBIN/certomatic/bin +LD_LIBRARY_PATH=$PLATFORM/lib +export LD_LIBRARY_PATH +$PLATFORM/bin/certcgi $* 2>&1 + +Where $PLATFORM/lib is where the NSPR nad NSS DSOs are located, and +$PLATFORM/bin is where certcgi is located. PLATFORM is not defined when +the server runs this script, so you'll have to substitute the right value +in your script. certcgi requires that the working directory be one level +below the NSS DBs, that is, the DBs are accessed in the directory "..". + +You'll want to provide an html link somewhere to the script that downloads +the root.cacert file. You'll probably want to put that next to the link +that loads the index.html page. On interzone, this is done with the +following html: + +Cert-O-Matic II Root CA server +

+Download and trust Root CA +certificate + +The index.html file in this directory invokes the certcgi.cgi script with +the form post method, so if you change the name of the certcgi.cgi script, +you'll also have to change the index.html file in $DOCROOT/certomatic + +The 4 files used by the certcgi program (the 3 NSS DBs, and the serial +number file) are not required to live in $CGIBIN/certomatic, but they are +required to live in $CWD/.. when certcgi starts. + +Known bugs: + +1. Because multiple of these CAs exist simultaneously, it would be best if +they didn't all have to be called "Cert-O-Matic II", but that string is +presently hard coded into certcgi.c. + +2. the html files in this directory contain numerous extraneous

tags +which appear to use the post method and have action URLS that are never +actually used. burp.cgi and echoform.cgi are never actually used. This +should be cleaned up. + +3. The html files use tags which are supported only in Netscape +Navigator and Netscape Communication 4.x browsers. The html files do +not work as intended with Netscape 6.x, Mozilla or Microsoft IE browsers. +The html files should be fixed to work with all those named browsers. + diff --git a/mozilla/security/nss/cmd/certcgi/Makefile b/mozilla/security/nss/cmd/certcgi/Makefile new file mode 100644 index 0000000..140b419 --- /dev/null +++ b/mozilla/security/nss/cmd/certcgi/Makefile @@ -0,0 +1,80 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + +include ../platlibs.mk + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + + + +include ../platrules.mk + diff --git a/mozilla/security/nss/cmd/certcgi/ca.html b/mozilla/security/nss/cmd/certcgi/ca.html new file mode 100644 index 0000000..5525b38 --- /dev/null +++ b/mozilla/security/nss/cmd/certcgi/ca.html @@ -0,0 +1,51 @@ + + + + + Use the Cert-O-matic certificate to issue the cert

+ Use a + CA long + automatically generated chain ending with the Cert-O-Matic Cert + (18 maximum)

+ Use a + CA long + user input chain ending in the Cert-O-Matic Cert.

+ diff --git a/mozilla/security/nss/cmd/certcgi/ca_form.html b/mozilla/security/nss/cmd/certcgi/ca_form.html new file mode 100644 index 0000000..cb3e195 --- /dev/null +++ b/mozilla/security/nss/cmd/certcgi/ca_form.html @@ -0,0 +1,388 @@ + + +
+ + + + + + + + + + + + + +
+ Common Name:

+
+ Mail:

+ RFC 1274 + e-mail
+ Organization:

+ Organizational Unit:

+ RFC 1274 UID:

+ Locality:

+ State or Province:

+ Country:

+ + + + + + + +
+ Serial Number:

+
+ Auto Generate

+
+ + Use this value:

+
+ X.509 version:

+
+ Version 1

+
+ Version 3

+ Key Type:

+
+ RSA

+
+ DSA

+ DN:

+ +

+
+

+ + + + + + + + + + + + + + + + + +
+ Netscape Certificate Type:

+ Activate extension:

+ Critical: +
+ SSL Client

+ SSL Server

+ S/MIME

+ Object Signing

+ Reserved for future use (bit 4)

+ SSL CA

+ S/MIME CA

+ Object Signing CA

+
+ Netscape Base URL:

+ Activate extension:

+ Critical: +
+ +
+ Netscape Revocation URL:

+ Activate extension:

+ Critical: +
+ +
+ Netscape CA Revocation URL:

+ Activate extension:

+ Critical: +
+ +
+ Netscape Certificate Renewal URL:

+ Activate extension:

+ Critical: +
+ +
+ Netscape CA Policy URL:

+ Activate extension:

+ Critical: +
+ +
+ Netscape SSL Server Name:

+ Activate extension:

+ Critical: +
+ +
+ Netscape Comment:

+ Activate extension:

+ Critical: +
+ +
+

+
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ Key Usage:

+ Activate extension:

+ Critical: +
+ Digital Signature

+ Non Repudiation

+ Key Encipherment

+ Data Encipherment

+ Key Agreement

+ Key Certificate Signing

+ CRL Signing

+
+ Extended Key Usage:

+ Activate extension:

+ Critical: +
+ Server Auth

+ Client Auth

+ Code Signing

+ Email Protection

+ Timestamp

+ OCSP Responder

+ Step-up

+
+ Basic Constraints:

+ Activate extension:

+ Critical: +
+ CA:

+
True

+
False

+ + Include Path length:

+
+ Authority Key Identifier:

+ Activate extension: +
+ Key Identider

+ Issuer Name and Serial number

+
+ Subject Key Identifier:

+ Activate extension: +
+ Key Identifier: +

+ This is an:

+

ascii text value

+

hex value

+

+ Private Key Usage Period:

+ Activate extension:

+ Critical: +
+ Use:

+
Not Before

+
Not After

+
Both

+ Not to be used to sign before:

+
Set to time of certificate issue

+
Use This value

+
(YYYY/MM/DD HH:MM:SS): + / + / + + : + : +

+ Not to be used to sign after:

+
(YYYY/MM/DD HH:MM:SS): + / + / + + : + : +

+
+ Subject Alternative Name:

+ Activate extension:

+ Critical: +
+ + + +
+ General Names:

+

+ + +
+ +
+ Name Type:
+ Other Name, + OID: + RFC 822 Name
+ DNS Name + X400 Address
+ Directory Name + EDI Party Name
+ Uniform Resource Locator + IP Address
+ Registered ID + Netscape Certificate Nickname
+ Name: + Binary Encoded:

+
+
+ Issuer Alternative Name:

+ Activate extension:

+ Critical: +
+ Use the Subject Alternative Name from the Issuers Certificate

+ Use this Name: + + + +
+ General Names:

+

+ + +
+ +
+ Name Type:
+ Other Name, + OID: + RFC 822 Name
+ DNS Name + X400 Address
+ Directory Name + EDI Party Name
+ Uniform Resource Locator + IP Address
+ Registered ID
+ Name: + Binary Encoded:

+
+
+ Name Constraints:

+ Activate extension:

+
+ + + +
+ Name Constraints:

+ + +

+ + +
+ +
+ Name Type:
+ Other Name, + OID: + RFC 822 Name
+ DNS Name + X400 Address
+ Directory Name + EDI Party Name
+ Uniform Resource Locator + IP Address
+ Registered ID
+ Name: + Binary Encoded:

+ Constraint type:

+

permited

+

excluded

+ Minimum:

+ Maximum:

+ + + +
+
+
+ + + + + + + + + + diff --git a/mozilla/security/nss/cmd/certcgi/certcgi.c b/mozilla/security/nss/cmd/certcgi/certcgi.c new file mode 100644 index 0000000..038b55f --- /dev/null +++ b/mozilla/security/nss/cmd/certcgi/certcgi.c @@ -0,0 +1,2408 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Cert-O-Matic CGI */ + + +#include "nspr.h" +#include "prtypes.h" +#include "prtime.h" +#include "prlong.h" + +#include "pk11func.h" +#include "cert.h" +#include "cryptohi.h" +#include "secoid.h" +#include "secder.h" +#include "genname.h" +#include "xconst.h" +#include "secutil.h" +#include "pk11pqg.h" +#include "certxutl.h" +#include "nss.h" + + +/* #define TEST 1 */ +/* #define FILEOUT 1 */ +/* #define OFFLINE 1 */ +#define START_FIELDS 100 +#define PREFIX_LEN 6 +#define SERIAL_FILE "../serial" +#define DB_DIRECTORY ".." + +static char *progName; + +typedef struct PairStr Pair; + +struct PairStr { + char *name; + char *data; +}; + + +char prefix[PREFIX_LEN]; + + +const SEC_ASN1Template CERTIA5TypeTemplate[] = { + { SEC_ASN1_IA5_STRING } +}; + + + +SECKEYPrivateKey *privkeys[9] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL}; + + +#ifdef notdef +const SEC_ASN1Template CERT_GeneralNameTemplate[] = { + { SEC_ASN1_SEQUENCE_OF, 0, SEC_AnyTemplate } +}; +#endif + + +static void +error_out(char *error_string) +{ + printf("Content-type: text/plain\n\n"); + printf(error_string); + fflush(stderr); + fflush(stdout); + exit(1); +} + +static void +error_allocate(void) +{ + error_out("ERROR: Unable to allocate memory"); +} + + +static char * +make_copy_string(char *read_pos, + int length, + char sentinal_value) + /* copys string from to a new string it creates and + returns a pointer to the new string */ +{ + int remaining = length; + char *write_pos; + char *new; + + new = write_pos = (char *) PORT_Alloc (length); + if (new == NULL) { + error_allocate(); + } + while (*read_pos != sentinal_value) { + if (remaining == 1) { + remaining += length; + length = length * 2; + new = PORT_Realloc(new,length); + if (new == NULL) { + error_allocate(); + } + write_pos = new + length - remaining; + } + *write_pos = *read_pos; + ++write_pos; + ++read_pos; + remaining = remaining - 1; + } + *write_pos = '\0'; + return new; +} + + +static SECStatus +clean_input(Pair *data) + /* converts the non-alphanumeric characters in a form post + from hex codes back to characters */ +{ + int length; + int hi_digit; + int low_digit; + char character; + char *begin_pos; + char *read_pos; + char *write_pos; + PRBool name = PR_TRUE; + + begin_pos = data->name; + while (begin_pos != NULL) { + length = strlen(begin_pos); + read_pos = write_pos = begin_pos; + while ((read_pos - begin_pos) < length) { + if (*read_pos == '+') { + *read_pos = ' '; + } + if (*read_pos == '%') { + hi_digit = *(read_pos + 1); + low_digit = *(read_pos +2); + read_pos += 3; + if (isdigit(hi_digit)){ + hi_digit = hi_digit - '0'; + } else { + hi_digit = toupper(hi_digit); + if (isxdigit(hi_digit)) { + hi_digit = (hi_digit - 'A') + 10; + } else { + error_out("ERROR: Form data incorrectly formated"); + } + } + if (isdigit(low_digit)){ + low_digit = low_digit - '0'; + } else { + low_digit = toupper(low_digit); + if ((low_digit >='A') && (low_digit <= 'F')) { + low_digit = (low_digit - 'A') + 10; + } else { + error_out("ERROR: Form data incorrectly formated"); + } + } + character = (hi_digit << 4) | low_digit; + if (character != 10) { + *write_pos = character; + ++write_pos; + } + } else { + *write_pos = *read_pos; + ++write_pos; + ++read_pos; + } + } + *write_pos = '\0'; + if (name == PR_TRUE) { + begin_pos = data->data; + name = PR_FALSE; + } else { + data++; + begin_pos = data->name; + name = PR_TRUE; + } + } + return SECSuccess; +} + +static char * +make_name(char *new_data) + /* gets the next field name in the input string and returns + a pointer to a string containing a copy of it */ +{ + int length = 20; + char *name; + + name = make_copy_string(new_data, length, '='); + return name; +} + +static char * +make_data(char *new_data) + /* gets the data for the next field in the input string + and returns a pointer to a string containing it */ +{ + int length = 100; + char *data; + char *read_pos; + + read_pos = new_data; + while (*(read_pos - 1) != '=') { + ++read_pos; + } + data = make_copy_string(read_pos, length, '&'); + return data; +} + + +static Pair +make_pair(char *new_data) + /* makes a pair name/data pair from the input string */ +{ + Pair temp; + + temp.name = make_name(new_data); + temp.data = make_data(new_data); + return temp; +} + + + +static Pair * +make_datastruct(char *data, int len) + /* parses the input from the form post into a data + structure of field name/data pairs */ +{ + Pair *datastruct; + Pair *current; + char *curr_pos; + int fields = START_FIELDS; + int remaining = START_FIELDS; + + curr_pos = data; + datastruct = current = (Pair *) PORT_Alloc(fields * sizeof(Pair)); + if (datastruct == NULL) { + error_allocate(); + } + while (curr_pos - data < len) { + if (remaining == 1) { + remaining += fields; + fields = fields * 2; + datastruct = (Pair *) PORT_Realloc + (datastruct, fields * sizeof(Pair)); + if (datastruct == NULL) { + error_allocate(); + } + current = datastruct + (fields - remaining); + } + *current = make_pair(curr_pos); + while (*curr_pos != '&') { + ++curr_pos; + } + ++curr_pos; + ++current; + remaining = remaining - 1; + } + current->name = NULL; + return datastruct; +} + +static char * +return_name(Pair *data_struct, + int n) + /* returns a pointer to the name of the nth + (starting from 0) item in the data structure */ +{ + char *name; + + if ((data_struct + n)->name != NULL) { + name = (data_struct + n)->name; + return name; + } else { + return NULL; + } +} + +static char * +return_data(Pair *data_struct,int n) + /* returns a pointer to the data of the nth (starting from 0) + itme in the data structure */ +{ + char *data; + + data = (data_struct + n)->data; + return data; +} + + +static char * +add_prefix(char *field_name) +{ + extern char prefix[PREFIX_LEN]; + int i = 0; + char *rv; + char *write; + + rv = write = PORT_Alloc(PORT_Strlen(prefix) + PORT_Strlen(field_name) + 1); + for(i = 0; i < PORT_Strlen(prefix); i++) { + *write = prefix[i]; + write++; + } + *write = '\0'; + rv = PORT_Strcat(rv,field_name); + return rv; +} + + +static char * +find_field(Pair *data, + char *field_name, + PRBool add_pre) + /* returns a pointer to the data of the first pair + thats name matches the string it is passed */ +{ + int i = 0; + char *retrieved; + int found = 0; + + if (add_pre) { + field_name = add_prefix(field_name); + } + while(return_name(data, i) != NULL) { + if (PORT_Strcmp(return_name(data, i), field_name) == 0) { + retrieved = return_data(data, i); + found = 1; + break; + } + i++; + } + if (!found) { + retrieved = NULL; + } + return retrieved; +} + +static PRBool +find_field_bool(Pair *data, + char *fieldname, + PRBool add_pre) +{ + char *rv; + + rv = find_field(data, fieldname, add_pre); + + if ((rv != NULL) && (PORT_Strcmp(rv, "true")) == 0) { + return PR_TRUE; + } else { + return PR_FALSE; + } +} + +static char * +update_data_by_name(Pair *data, + char *field_name, + char *new_data) + /* replaces the data in the data structure associated with + a name with new data, returns null if not found */ +{ + int i = 0; + int found = 0; + int length = 100; + char *new; + + while (return_name(data, i) != NULL) { + if (PORT_Strcmp(return_name(data, i), field_name) == 0) { + new = make_copy_string( new_data, length, '\0'); + PORT_Free(return_data(data, i)); + found = 1; + (*(data + i)).data = new; + break; + } + i++; + } + if (!found) { + new = NULL; + } + return new; +} + +static char * +update_data_by_index(Pair *data, + int n, + char *new_data) + /* replaces the data of a particular index in the data structure */ +{ + int length = 100; + char *new; + + new = make_copy_string(new_data, length, '\0'); + PORT_Free(return_data(data, n)); + (*(data + n)).data = new; + return new; +} + + +static Pair * +add_field(Pair *data, + char* field_name, + char* field_data) + /* adds a new name/data pair to the data structure */ +{ + int i = 0; + int j; + int name_length = 100; + int data_length = 100; + + while(return_name(data, i) != NULL) { + i++; + } + j = START_FIELDS; + while ( j < (i + 1) ) { + j = j * 2; + } + if (j == (i + 1)) { + data = (Pair *) PORT_Realloc(data, (j * 2) * sizeof(Pair)); + if (data == NULL) { + error_allocate(); + } + } + (*(data + i)).name = make_copy_string(field_name, name_length, '\0'); + (*(data + i)).data = make_copy_string(field_data, data_length, '\0'); + (data + i + 1)->name = NULL; + return data; +} + + +static CERTCertificateRequest * +makeCertReq(Pair *form_data, + int which_priv_key) + /* makes and encodes a certrequest */ +{ + + PK11SlotInfo *slot; + CERTCertificateRequest *certReq = NULL; + CERTSubjectPublicKeyInfo *spki; + SECKEYPrivateKey *privkey = NULL; + SECKEYPublicKey *pubkey = NULL; + CERTName *name; + char *key; + extern SECKEYPrivateKey *privkeys[9]; + int keySizeInBits; + char *challenge = "foo"; + SECStatus rv = SECSuccess; + PQGParams *pqgParams = NULL; + PQGVerify *pqgVfy = NULL; + + name = CERT_AsciiToName(find_field(form_data, "subject", PR_TRUE)); + if (name == NULL) { + error_out("ERROR: Unable to create Subject Name"); + } + key = find_field(form_data, "key", PR_TRUE); + if (key == NULL) { + switch (*find_field(form_data, "keysize", PR_TRUE)) { + case '0': + keySizeInBits = 2048; + break; + case '1': + keySizeInBits = 1024; + break; + case '2': + keySizeInBits = 512; + break; + default: + error_out("ERROR: Unsupported Key length selected"); + } + if (find_field_bool(form_data, "keyType-dsa", PR_TRUE)) { + rv = PK11_PQG_ParamGen(keySizeInBits, &pqgParams, &pqgVfy); + if (rv != SECSuccess) { + error_out("ERROR: Unable to generate PQG parameters"); + } + slot = PK11_GetBestSlot(CKM_DSA_KEY_PAIR_GEN, NULL); + privkey = PK11_GenerateKeyPair(slot, CKM_DSA_KEY_PAIR_GEN, + pqgParams,&pubkey, PR_FALSE, + PR_TRUE, NULL); + } else { + privkey = SECKEY_CreateRSAPrivateKey(keySizeInBits, &pubkey, NULL); + } + privkeys[which_priv_key] = privkey; + spki = SECKEY_CreateSubjectPublicKeyInfo(pubkey); + } else { + spki = SECKEY_ConvertAndDecodePublicKeyAndChallenge(key, challenge, + NULL); + if (spki == NULL) { + error_out("ERROR: Unable to decode Public Key and Challenge String"); + } + } + certReq = CERT_CreateCertificateRequest(name, spki, NULL); + if (certReq == NULL) { + error_out("ERROR: Unable to create Certificate Request"); + } + if (pubkey != NULL) { + SECKEY_DestroyPublicKey(pubkey); + } + if (spki != NULL) { + SECKEY_DestroySubjectPublicKeyInfo(spki); + } + if (pqgParams != NULL) { + PK11_PQG_DestroyParams(pqgParams); + } + if (pqgVfy != NULL) { + PK11_PQG_DestroyVerify(pqgVfy); + } + return certReq; +} + + + +static CERTCertificate * +MakeV1Cert(CERTCertDBHandle *handle, + CERTCertificateRequest *req, + char *issuerNameStr, + PRBool selfsign, + int serialNumber, + int warpmonths, + Pair *data) +{ + CERTCertificate *issuerCert = NULL; + CERTValidity *validity; + CERTCertificate *cert = NULL; + PRExplodedTime printableTime; + PRTime now, + after; + SECStatus rv; + + + + if ( !selfsign ) { + issuerCert = CERT_FindCertByNameString(handle, issuerNameStr); + if (!issuerCert) { + error_out("ERROR: Could not find issuer's certificate"); + return NULL; + } + } + if (find_field_bool(data, "manValidity", PR_TRUE)) { + rv = DER_AsciiToTime(&now, find_field(data, "notBefore", PR_TRUE)); + } else { + now = PR_Now(); + } + PR_ExplodeTime (now, PR_GMTParameters, &printableTime); + if ( warpmonths ) { + printableTime.tm_month += warpmonths; + now = PR_ImplodeTime (&printableTime); + PR_ExplodeTime (now, PR_GMTParameters, &printableTime); + } + if (find_field_bool(data, "manValidity", PR_TRUE)) { + rv = DER_AsciiToTime(&after, find_field(data, "notAfter", PR_TRUE)); + PR_ExplodeTime (after, PR_GMTParameters, &printableTime); + } else { + printableTime.tm_month += 3; + after = PR_ImplodeTime (&printableTime); + } + /* note that the time is now in micro-second unit */ + validity = CERT_CreateValidity (now, after); + + if ( selfsign ) { + cert = CERT_CreateCertificate + (serialNumber,&(req->subject), validity, req); + } else { + cert = CERT_CreateCertificate + (serialNumber,&(issuerCert->subject), validity, req); + } + + CERT_DestroyValidity(validity); + if ( issuerCert ) { + CERT_DestroyCertificate (issuerCert); + } + return(cert); +} + +static int +get_serial_number(Pair *data) +{ + int serial = 0; + int error; + char *filename = SERIAL_FILE; + char *SN; + FILE *serialFile; + + + if (find_field_bool(data, "serial-auto", PR_TRUE)) { + serialFile = fopen(filename, "r"); + if (serialFile != NULL) { + fread(&serial, sizeof(int), 1, serialFile); + if (ferror(serialFile) != 0) { + error_out("Error: Unable to read serial number file"); + } + if (serial == 4294967295) { + serial = 21; + } + fclose(serialFile); + ++serial; + serialFile = fopen(filename,"w"); + if (serialFile == NULL) { + error_out("ERROR: Unable to open serial number file for writing"); + } + fwrite(&serial, sizeof(int), 1, serialFile); + if (ferror(serialFile) != 0) { + error_out("Error: Unable to write to serial number file"); + } + } else { + fclose(serialFile); + serialFile = fopen(filename,"w"); + if (serialFile == NULL) { + error_out("ERROR: Unable to open serial number file"); + } + serial = 21; + fwrite(&serial, sizeof(int), 1, serialFile); + if (ferror(serialFile) != 0) { + error_out("Error: Unable to write to serial number file"); + } + error = ferror(serialFile); + if (error != 0) { + error_out("ERROR: Unable to write to serial file"); + } + } + fclose(serialFile); + } else { + SN = find_field(data, "serial_value", PR_TRUE); + while (*SN != '\0') { + serial = serial * 16; + if ((*SN >= 'A') && (*SN <='F')) { + serial += *SN - 'A' + 10; + } else { + if ((*SN >= 'a') && (*SN <='f')) { + serial += *SN - 'a' + 10; + } else { + serial += *SN - '0'; + } + } + ++SN; + } + } + return serial; +} + + + +typedef SECStatus (* EXTEN_VALUE_ENCODER) + (PRArenaPool *extHandle, void *value, SECItem *encodedValue); + +static SECStatus +EncodeAndAddExtensionValue( + PRArenaPool *arena, + void *extHandle, + void *value, + PRBool criticality, + int extenType, + EXTEN_VALUE_ENCODER EncodeValueFn) +{ + SECItem encodedValue; + SECStatus rv; + + + encodedValue.data = NULL; + encodedValue.len = 0; + rv = (*EncodeValueFn)(arena, value, &encodedValue); + if (rv != SECSuccess) { + error_out("ERROR: Unable to encode extension value"); + } + rv = CERT_AddExtension + (extHandle, extenType, &encodedValue, criticality, PR_TRUE); + return (rv); +} + + + +static SECStatus +AddKeyUsage (void *extHandle, + Pair *data) +{ + SECItem bitStringValue; + unsigned char keyUsage = 0x0; + + if (find_field_bool(data,"keyUsage-digitalSignature", PR_TRUE)){ + keyUsage |= (0x80 >> 0); + } + if (find_field_bool(data,"keyUsage-nonRepudiation", PR_TRUE)){ + keyUsage |= (0x80 >> 1); + } + if (find_field_bool(data,"keyUsage-keyEncipherment", PR_TRUE)){ + keyUsage |= (0x80 >> 2); + } + if (find_field_bool(data,"keyUsage-dataEncipherment", PR_TRUE)){ + keyUsage |= (0x80 >> 3); + } + if (find_field_bool(data,"keyUsage-keyAgreement", PR_TRUE)){ + keyUsage |= (0x80 >> 4); + } + if (find_field_bool(data,"keyUsage-keyCertSign", PR_TRUE)) { + keyUsage |= (0x80 >> 5); + } + if (find_field_bool(data,"keyUsage-cRLSign", PR_TRUE)) { + keyUsage |= (0x80 >> 6); + } + + bitStringValue.data = &keyUsage; + bitStringValue.len = 1; + + return (CERT_EncodeAndAddBitStrExtension + (extHandle, SEC_OID_X509_KEY_USAGE, &bitStringValue, + (find_field_bool(data, "keyUsage-crit", PR_TRUE)))); + +} + +static CERTOidSequence * +CreateOidSequence(void) +{ + CERTOidSequence *rv = (CERTOidSequence *)NULL; + PRArenaPool *arena = (PRArenaPool *)NULL; + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if( (PRArenaPool *)NULL == arena ) { + goto loser; + } + + rv = (CERTOidSequence *)PORT_ArenaZAlloc(arena, sizeof(CERTOidSequence)); + if( (CERTOidSequence *)NULL == rv ) { + goto loser; + } + + rv->oids = (SECItem **)PORT_ArenaZAlloc(arena, sizeof(SECItem *)); + if( (SECItem **)NULL == rv->oids ) { + goto loser; + } + + rv->arena = arena; + return rv; + + loser: + if( (PRArenaPool *)NULL != arena ) { + PORT_FreeArena(arena, PR_FALSE); + } + + return (CERTOidSequence *)NULL; +} + +static SECStatus +AddOidToSequence(CERTOidSequence *os, SECOidTag oidTag) +{ + SECItem **oids; + PRUint32 count = 0; + SECOidData *od; + + od = SECOID_FindOIDByTag(oidTag); + if( (SECOidData *)NULL == od ) { + return SECFailure; + } + + for( oids = os->oids; (SECItem *)NULL != *oids; oids++ ) { + count++; + } + + /* ArenaZRealloc */ + + { + PRUint32 i; + + oids = (SECItem **)PORT_ArenaZAlloc(os->arena, sizeof(SECItem *) * (count+2)); + if( (SECItem **)NULL == oids ) { + return SECFailure; + } + + for( i = 0; i < count; i++ ) { + oids[i] = os->oids[i]; + } + + /* ArenaZFree(os->oids); */ + } + + os->oids = oids; + os->oids[count] = &od->oid; + + return SECSuccess; +} + +static SECItem * +EncodeOidSequence(CERTOidSequence *os) +{ + SECItem *rv; + extern const SEC_ASN1Template CERT_OidSeqTemplate[]; + + rv = (SECItem *)PORT_ArenaZAlloc(os->arena, sizeof(SECItem)); + if( (SECItem *)NULL == rv ) { + goto loser; + } + + if( !SEC_ASN1EncodeItem(os->arena, rv, os, CERT_OidSeqTemplate) ) { + goto loser; + } + + return rv; + + loser: + return (SECItem *)NULL; +} + +static SECStatus +AddExtKeyUsage(void *extHandle, Pair *data) +{ + SECStatus rv; + CERTOidSequence *os; + SECItem *value; + PRBool crit; + + os = CreateOidSequence(); + if( (CERTOidSequence *)NULL == os ) { + return SECFailure; + } + + if( find_field_bool(data, "extKeyUsage-serverAuth", PR_TRUE) ) { + rv = AddOidToSequence(os, SEC_OID_EXT_KEY_USAGE_SERVER_AUTH); + if( SECSuccess != rv ) goto loser; + } + + if( find_field_bool(data, "extKeyUsage-clientAuth", PR_TRUE) ) { + rv = AddOidToSequence(os, SEC_OID_EXT_KEY_USAGE_CLIENT_AUTH); + if( SECSuccess != rv ) goto loser; + } + + if( find_field_bool(data, "extKeyUsage-codeSign", PR_TRUE) ) { + rv = AddOidToSequence(os, SEC_OID_EXT_KEY_USAGE_CODE_SIGN); + if( SECSuccess != rv ) goto loser; + } + + if( find_field_bool(data, "extKeyUsage-emailProtect", PR_TRUE) ) { + rv = AddOidToSequence(os, SEC_OID_EXT_KEY_USAGE_EMAIL_PROTECT); + if( SECSuccess != rv ) goto loser; + } + + if( find_field_bool(data, "extKeyUsage-timeStamp", PR_TRUE) ) { + rv = AddOidToSequence(os, SEC_OID_EXT_KEY_USAGE_TIME_STAMP); + if( SECSuccess != rv ) goto loser; + } + + if( find_field_bool(data, "extKeyUsage-ocspResponder", PR_TRUE) ) { + rv = AddOidToSequence(os, SEC_OID_OCSP_RESPONDER); + if( SECSuccess != rv ) goto loser; + } + + if( find_field_bool(data, "extKeyUsage-NS-govtApproved", PR_TRUE) ) { + rv = AddOidToSequence(os, SEC_OID_NS_KEY_USAGE_GOVT_APPROVED); + if( SECSuccess != rv ) goto loser; + } + + value = EncodeOidSequence(os); + + crit = find_field_bool(data, "extKeyUsage-crit", PR_TRUE); + + rv = CERT_AddExtension(extHandle, SEC_OID_X509_EXT_KEY_USAGE, value, + crit, PR_TRUE); + /*FALLTHROUGH*/ + loser: + CERT_DestroyOidSequence(os); + return rv; +} + +static SECStatus +AddSubKeyID(void *extHandle, + Pair *data, + CERTCertificate *subjectCert) +{ + SECItem encodedValue; + SECStatus rv; + char *read; + char *write; + char *first; + char character; + int high_digit = 0, + low_digit = 0; + int len; + PRBool odd = PR_FALSE; + + + encodedValue.data = NULL; + encodedValue.len = 0; + first = read = write = find_field(data,"subjectKeyIdentifier-text", + PR_TRUE); + len = PORT_Strlen(first); + odd = ((len % 2) != 0 ) ? PR_TRUE : PR_FALSE; + if (find_field_bool(data, "subjectKeyIdentifier-radio-hex", PR_TRUE)) { + if (odd) { + error_out("ERROR: Improperly formated subject key identifier, hex values must be expressed as an octet string"); + } + while (*read != '\0') { + if (!isxdigit(*read)) { + error_out("ERROR: Improperly formated subject key identifier"); + } + *read = toupper(*read); + if ((*read >= 'A') && (*read <= 'F')) { + high_digit = *read - 'A' + 10; + } else { + high_digit = *read - '0'; + } + ++read; + if (!isxdigit(*read)) { + error_out("ERROR: Improperly formated subject key identifier"); + } + *read = toupper(*read); + if ((*read >= 'A') && (*read <= 'F')) { + low_digit = *(read) - 'A' + 10; + } else { + low_digit = *(read) - '0'; + } + character = (high_digit << 4) | low_digit; + *write = character; + ++write; + ++read; + } + *write = '\0'; + len = write - first; + } + subjectCert->subjectKeyID.data = (unsigned char *) find_field + (data,"subjectKeyIdentifier-text", PR_TRUE); + subjectCert->subjectKeyID.len = len; + rv = CERT_EncodeSubjectKeyID + (NULL, &subjectCert->subjectKeyID, &encodedValue); + if (rv) { + return (rv); + } + return (CERT_AddExtension(extHandle, SEC_OID_X509_SUBJECT_KEY_ID, + &encodedValue, PR_FALSE, PR_TRUE)); +} + + +static SECStatus +AddAuthKeyID (void *extHandle, + Pair *data, + char *issuerNameStr, + CERTCertDBHandle *handle) +{ + CERTAuthKeyID *authKeyID = NULL; + PRArenaPool *arena = NULL; + SECStatus rv = SECSuccess; + CERTCertificate *issuerCert = NULL; + CERTGeneralName *genNames; + CERTName *directoryName = NULL; + + + issuerCert = CERT_FindCertByNameString(handle, issuerNameStr); + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if ( !arena ) { + error_allocate(); + } + + authKeyID = PORT_ArenaZAlloc (arena, sizeof (CERTAuthKeyID)); + if (authKeyID == NULL) { + error_allocate(); + } + if (find_field_bool(data, "authorityKeyIdentifier-radio-keyIdentifier", + PR_TRUE)) { + authKeyID->keyID.data = PORT_ArenaAlloc (arena, PORT_Strlen + ((char *)issuerCert->subjectKeyID.data)); + if (authKeyID->keyID.data == NULL) { + error_allocate(); + } + PORT_Memcpy (authKeyID->keyID.data, issuerCert->subjectKeyID.data, + authKeyID->keyID.len = + PORT_Strlen((char *)issuerCert->subjectKeyID.data)); + } else { + + PORT_Assert (arena); + genNames = (CERTGeneralName *) PORT_ArenaZAlloc (arena, (sizeof(CERTGeneralName))); + if (genNames == NULL){ + error_allocate(); + } + genNames->l.next = genNames->l.prev = &(genNames->l); + genNames->type = certDirectoryName; + + directoryName = CERT_AsciiToName(issuerCert->subjectName); + if (!directoryName) { + error_out("ERROR: Unable to create Directory Name"); + } + rv = CERT_CopyName (arena, &genNames->name.directoryName, + directoryName); + CERT_DestroyName (directoryName); + if (rv != SECSuccess) { + error_out("ERROR: Unable to copy Directory Name"); + } + authKeyID->authCertIssuer = genNames; + if (authKeyID->authCertIssuer == NULL && SECFailure == + PORT_GetError ()) { + error_out("ERROR: Unable to get Issuer General Name for Authority Key ID Extension"); + } + authKeyID->authCertSerialNumber = issuerCert->serialNumber; + } + rv = EncodeAndAddExtensionValue(arena, extHandle, authKeyID, PR_FALSE, + SEC_OID_X509_AUTH_KEY_ID, + (EXTEN_VALUE_ENCODER) + CERT_EncodeAuthKeyID); + if (arena) { + PORT_FreeArena (arena, PR_FALSE); + } + return (rv); +} + + +static SECStatus +AddPrivKeyUsagePeriod(void *extHandle, + Pair *data, + CERTCertificate *cert) +{ + char *notBeforeStr; + char *notAfterStr; + PRArenaPool *arena = NULL; + SECStatus rv = SECSuccess; + CERTPrivKeyUsagePeriod *pkup; + + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if ( !arena ) { + error_allocate(); + } + pkup = PORT_ArenaZNew (arena, CERTPrivKeyUsagePeriod); + if (pkup == NULL) { + error_allocate(); + } + notBeforeStr = (char *) PORT_Alloc(16 ); + notAfterStr = (char *) PORT_Alloc(16 ); + *notBeforeStr = '\0'; + *notAfterStr = '\0'; + pkup->arena = arena; + pkup->notBefore.len = 0; + pkup->notBefore.data = NULL; + pkup->notAfter.len = 0; + pkup->notAfter.data = NULL; + if (find_field_bool(data, "privKeyUsagePeriod-radio-notBefore", PR_TRUE) || + find_field_bool(data, "privKeyUsagePeriod-radio-both", PR_TRUE)) { + pkup->notBefore.len = 15; + pkup->notBefore.data = (unsigned char *)notBeforeStr; + if (find_field_bool(data, "privKeyUsagePeriod-notBefore-radio-manual", + PR_TRUE)) { + PORT_Strcat(notBeforeStr,find_field(data, + "privKeyUsagePeriod-notBefore-year", + PR_TRUE)); + PORT_Strcat(notBeforeStr,find_field(data, + "privKeyUsagePeriod-notBefore-month", + PR_TRUE)); + PORT_Strcat(notBeforeStr,find_field(data, + "privKeyUsagePeriod-notBefore-day", + PR_TRUE)); + PORT_Strcat(notBeforeStr,find_field(data, + "privKeyUsagePeriod-notBefore-hour", + PR_TRUE)); + PORT_Strcat(notBeforeStr,find_field(data, + "privKeyUsagePeriod-notBefore-minute", + PR_TRUE)); + PORT_Strcat(notBeforeStr,find_field(data, + "privKeyUsagePeriod-notBefore-second", + PR_TRUE)); + if ((*(notBeforeStr + 14) != '\0') || + (!isdigit(*(notBeforeStr + 13))) || + (*(notBeforeStr + 12) >= '5' && *(notBeforeStr + 12) <= '0') || + (!isdigit(*(notBeforeStr + 11))) || + (*(notBeforeStr + 10) >= '5' && *(notBeforeStr + 10) <= '0') || + (!isdigit(*(notBeforeStr + 9))) || + (*(notBeforeStr + 8) >= '2' && *(notBeforeStr + 8) <= '0') || + (!isdigit(*(notBeforeStr + 7))) || + (*(notBeforeStr + 6) >= '3' && *(notBeforeStr + 6) <= '0') || + (!isdigit(*(notBeforeStr + 5))) || + (*(notBeforeStr + 4) >= '1' && *(notBeforeStr + 4) <= '0') || + (!isdigit(*(notBeforeStr + 3))) || + (!isdigit(*(notBeforeStr + 2))) || + (!isdigit(*(notBeforeStr + 1))) || + (!isdigit(*(notBeforeStr + 0))) || + (*(notBeforeStr + 8) == '2' && *(notBeforeStr + 9) >= '4') || + (*(notBeforeStr + 6) == '3' && *(notBeforeStr + 7) >= '1') || + (*(notBeforeStr + 4) == '1' && *(notBeforeStr + 5) >= '2')) { + error_out("ERROR: Improperly formated private key usage period"); + } + *(notBeforeStr + 14) = 'Z'; + *(notBeforeStr + 15) = '\0'; + } else { + if ((*(cert->validity.notBefore.data) > '5') || + ((*(cert->validity.notBefore.data) == '5') && + (*(cert->validity.notBefore.data + 1) != '0'))) { + PORT_Strcat(notBeforeStr, "19"); + } else { + PORT_Strcat(notBeforeStr, "20"); + } + PORT_Strcat(notBeforeStr, (char *)cert->validity.notBefore.data); + } + } + if (find_field_bool(data, "privKeyUsagePeriod-radio-notAfter", PR_TRUE) || + find_field_bool(data, "privKeyUsagePeriod-radio-both", PR_TRUE)) { + pkup->notAfter.len = 15; + pkup->notAfter.data = (unsigned char *)notAfterStr; + PORT_Strcat(notAfterStr,find_field(data,"privKeyUsagePeriod-notAfter-year", + PR_TRUE)); + PORT_Strcat(notAfterStr,find_field(data,"privKeyUsagePeriod-notAfter-month", + PR_TRUE)); + PORT_Strcat(notAfterStr,find_field(data,"privKeyUsagePeriod-notAfter-day", + PR_TRUE)); + PORT_Strcat(notAfterStr,find_field(data,"privKeyUsagePeriod-notAfter-hour", + PR_TRUE)); + PORT_Strcat(notAfterStr,find_field(data,"privKeyUsagePeriod-notAfter-minute", + PR_TRUE)); + PORT_Strcat(notAfterStr,find_field(data,"privKeyUsagePeriod-notAfter-second", + PR_TRUE)); + if ((*(notAfterStr + 14) != '\0') || + (!isdigit(*(notAfterStr + 13))) || + (*(notAfterStr + 12) >= '5' && *(notAfterStr + 12) <= '0') || + (!isdigit(*(notAfterStr + 11))) || + (*(notAfterStr + 10) >= '5' && *(notAfterStr + 10) <= '0') || + (!isdigit(*(notAfterStr + 9))) || + (*(notAfterStr + 8) >= '2' && *(notAfterStr + 8) <= '0') || + (!isdigit(*(notAfterStr + 7))) || + (*(notAfterStr + 6) >= '3' && *(notAfterStr + 6) <= '0') || + (!isdigit(*(notAfterStr + 5))) || + (*(notAfterStr + 4) >= '1' && *(notAfterStr + 4) <= '0') || + (!isdigit(*(notAfterStr + 3))) || + (!isdigit(*(notAfterStr + 2))) || + (!isdigit(*(notAfterStr + 1))) || + (!isdigit(*(notAfterStr + 0))) || + (*(notAfterStr + 8) == '2' && *(notAfterStr + 9) >= '4') || + (*(notAfterStr + 6) == '3' && *(notAfterStr + 7) >= '1') || + (*(notAfterStr + 4) == '1' && *(notAfterStr + 5) >= '2')) { + error_out("ERROR: Improperly formated private key usage period"); + } + *(notAfterStr + 14) = 'Z'; + *(notAfterStr + 15) = '\0'; + } + + PORT_Assert (arena); + + rv = EncodeAndAddExtensionValue(arena, extHandle, pkup, + find_field_bool(data, + "privKeyUsagePeriod-crit", + PR_TRUE), + SEC_OID_X509_PRIVATE_KEY_USAGE_PERIOD, + (EXTEN_VALUE_ENCODER) + CERT_EncodePrivateKeyUsagePeriod); + if (arena) { + PORT_FreeArena (arena, PR_FALSE); + } + if (notBeforeStr != NULL) { + PORT_Free(notBeforeStr); + } + if (notAfterStr != NULL) { + PORT_Free(notAfterStr); + } + return (rv); +} + +static SECStatus +AddBasicConstraint(void *extHandle, + Pair *data) +{ + CERTBasicConstraints basicConstraint; + SECItem encodedValue; + SECStatus rv; + + encodedValue.data = NULL; + encodedValue.len = 0; + basicConstraint.pathLenConstraint = CERT_UNLIMITED_PATH_CONSTRAINT; + basicConstraint.isCA = (find_field_bool(data,"basicConstraints-cA-radio-CA", + PR_TRUE)); + if (find_field_bool(data,"basicConstraints-pathLengthConstraint", PR_TRUE)){ + basicConstraint.pathLenConstraint = atoi + (find_field(data,"basicConstraints-pathLengthConstraint-text", + PR_TRUE)); + } + + rv = CERT_EncodeBasicConstraintValue (NULL, &basicConstraint, + &encodedValue); + if (rv) + return (rv); + rv = CERT_AddExtension(extHandle, SEC_OID_X509_BASIC_CONSTRAINTS, + &encodedValue, + (find_field_bool(data,"basicConstraints-crit", + PR_TRUE)), PR_TRUE); + + PORT_Free (encodedValue.data); + return (rv); +} + + + +static SECStatus +AddNscpCertType (void *extHandle, + Pair *data) +{ + SECItem bitStringValue; + unsigned char CertType = 0x0; + + if (find_field_bool(data,"netscape-cert-type-ssl-client", PR_TRUE)){ + CertType |= (0x80 >> 0); + } + if (find_field_bool(data,"netscape-cert-type-ssl-server", PR_TRUE)){ + CertType |= (0x80 >> 1); + } + if (find_field_bool(data,"netscape-cert-type-smime", PR_TRUE)){ + CertType |= (0x80 >> 2); + } + if (find_field_bool(data,"netscape-cert-type-object-signing", PR_TRUE)){ + CertType |= (0x80 >> 3); + } + if (find_field_bool(data,"netscape-cert-type-reserved", PR_TRUE)){ + CertType |= (0x80 >> 4); + } + if (find_field_bool(data,"netscape-cert-type-ssl-ca", PR_TRUE)) { + CertType |= (0x80 >> 5); + } + if (find_field_bool(data,"netscape-cert-type-smime-ca", PR_TRUE)) { + CertType |= (0x80 >> 6); + } + if (find_field_bool(data,"netscape-cert-type-object-signing-ca", PR_TRUE)) { + CertType |= (0x80 >> 7); + } + + bitStringValue.data = &CertType; + bitStringValue.len = 1; + + return (CERT_EncodeAndAddBitStrExtension + (extHandle, SEC_OID_NS_CERT_EXT_CERT_TYPE, &bitStringValue, + (find_field_bool(data, "netscape-cert-type-crit", PR_TRUE)))); +} + + +static SECStatus +add_IA5StringExtension(void *extHandle, + char *string, + PRBool crit, + int idtag) +{ + SECItem encodedValue; + SECStatus rv; + + encodedValue.data = NULL; + encodedValue.len = 0; + + rv = CERT_EncodeIA5TypeExtension(NULL, string, &encodedValue); + if (rv) { + return (rv); + } + return (CERT_AddExtension(extHandle, idtag, &encodedValue, crit, PR_TRUE)); +} + +static SECItem * +string_to_oid(char *string) +{ + int i; + int length = 20; + int remaining; + int first_value; + int second_value; + int value; + int oidLength; + unsigned char *oidString; + unsigned char *write; + unsigned char *read; + unsigned char *temp; + SECItem *oid; + + + remaining = length; + i = 0; + while (*string == ' ') { + string++; + } + while (isdigit(*(string + i))) { + i++; + } + if (*(string + i) == '.') { + *(string + i) = '\0'; + } else { + error_out("ERROR: Improperly formated OID"); + } + first_value = atoi(string); + if (first_value < 0 || first_value > 2) { + error_out("ERROR: Improperly formated OID"); + } + string += i + 1; + i = 0; + while (isdigit(*(string + i))) { + i++; + } + if (*(string + i) == '.') { + *(string + i) = '\0'; + } else { + error_out("ERROR: Improperly formated OID"); + } + second_value = atoi(string); + if (second_value < 0 || second_value > 39) { + error_out("ERROR: Improperly formated OID"); + } + oidString = PORT_ZAlloc(2); + *oidString = (first_value * 40) + second_value; + *(oidString + 1) = '\0'; + oidLength = 1; + string += i + 1; + i = 0; + temp = write = PORT_ZAlloc(length); + while (*string != '\0') { + value = 0; + while(isdigit(*(string + i))) { + i++; + } + if (*(string + i) == '\0') { + value = atoi(string); + string += i; + } else { + if (*(string + i) == '.') { + *(string + i) = '\0'; + value = atoi(string); + string += i + 1; + } else { + *(string + i) = '\0'; + i++; + value = atoi(string); + while (*(string + i) == ' ') + i++; + if (*(string + i) != '\0') { + error_out("ERROR: Improperly formated OID"); + } + } + } + i = 0; + while (value != 0) { + if (remaining < 1) { + remaining += length; + length = length * 2; + temp = PORT_Realloc(temp, length); + write = temp + length - remaining; + } + *write = (value & 0x7f) | (0x80); + write++; + remaining--; + value = value >> 7; + } + *temp = *temp & (0x7f); + oidLength += write - temp; + oidString = PORT_Realloc(oidString, (oidLength + 1)); + read = write - 1; + write = oidLength + oidString - 1; + for (i = 0; i < (length - remaining); i++) { + *write = *read; + write--; + read++; + } + write = temp; + remaining = length; + } + *(oidString + oidLength) = '\0'; + oid = (SECItem *) PORT_ZAlloc(sizeof(SECItem)); + oid->data = oidString; + oid->len = oidLength; + PORT_Free(temp); + return oid; +} + +static SECItem * +string_to_ipaddress(char *string) +{ + int i = 0; + int value; + int j = 0; + SECItem *ipaddress; + + + while (*string == ' ') { + string++; + } + ipaddress = (SECItem *) PORT_ZAlloc(sizeof(SECItem)); + ipaddress->data = PORT_ZAlloc(9); + while (*string != '\0' && j < 8) { + while (isdigit(*(string + i))) { + i++; + } + if (*(string + i) == '.') { + *(string + i) = '\0'; + value = atoi(string); + string = string + i + 1; + i = 0; + } else { + if (*(string + i) == '\0') { + value = atoi(string); + string = string + i; + i = 0; + } else { + *(string + i) = '\0'; + while (*(string + i) == ' ') { + i++; + } + if (*(string + i) == '\0') { + value = atoi(string); + string = string + i; + i = 0; + } else { + error_out("ERROR: Improperly formated IP Address"); + } + } + } + if (value >= 0 || value < 256) { + *(ipaddress->data + j) = value; + } else { + error_out("ERROR: Improperly formated IP Address"); + } + j++; + } + *(ipaddress->data + j) = '\0'; + if (j != 4 && j != 8) { + error_out("ERROR: Improperly formated IP Address"); + } + ipaddress->len = j; + return ipaddress; +} + +static SECItem * +string_to_binary(char *string) +{ + SECItem *rv; + int high_digit; + int low_digit; + + rv = (SECItem *) PORT_ZAlloc(sizeof(SECItem)); + if (rv == NULL) { + error_allocate(); + } + rv->data = (unsigned char *) PORT_ZAlloc((PORT_Strlen(string))/3 + 2); + while (!isxdigit(*string)) { + string++; + } + rv->len = 0; + while (*string != '\0') { + if (isxdigit(*string)) { + if (*string >= '0' && *string <= '9') { + high_digit = *string - '0'; + } else { + *string = toupper(*string); + high_digit = *string - 'A'; + } + string++; + if (*string >= '0' && *string <= '9') { + low_digit = *string - '0'; + } else { + *string = toupper(*string); + low_digit = *string = 'A'; + } + (rv->len)++; + } else { + if (*string == ':') { + string++; + } else { + if (*string == ' ') { + while (*string == ' ') { + string++; + } + } + if (*string != '\0') { + error_out("ERROR: Improperly formated binary encoding"); + } + } + } + } + + return rv; +} + +static SECStatus +MakeGeneralName(char *name, + CERTGeneralName *genName, + PRArenaPool *arena) +{ + SECItem *oid; + SECOidData *oidData; + SECItem *ipaddress; + SECItem *temp = NULL; + int i; + int nameType; + PRBool binary = PR_FALSE; + SECStatus rv = SECSuccess; + PRBool nickname = PR_FALSE; + + PORT_Assert(genName); + PORT_Assert(arena); + nameType = *(name + PORT_Strlen(name) - 1) - '0'; + if (nameType == 0 && *(name +PORT_Strlen(name) - 2) == '1') { + nickname = PR_TRUE; + nameType = certOtherName; + } + if (nameType < 1 || nameType > 9) { + error_out("ERROR: Unknown General Name Type"); + } + *(name + PORT_Strlen(name) - 4) = '\0'; + genName->type = nameType; + + switch (genName->type) { + case certURI: + case certRFC822Name: + case certDNSName: { + genName->name.other.data = (unsigned char *)name; + genName->name.other.len = PORT_Strlen(name); + break; + } + + case certIPAddress: { + ipaddress = string_to_ipaddress(name); + genName->name.other.data = ipaddress->data; + genName->name.other.len = ipaddress->len; + break; + } + + case certRegisterID: { + oid = string_to_oid(name); + genName->name.other.data = oid->data; + genName->name.other.len = oid->len; + break; + } + + case certEDIPartyName: + case certX400Address: { + + genName->name.other.data = PORT_ArenaAlloc (arena, + PORT_Strlen (name) + 2); + if (genName->name.other.data == NULL) { + error_allocate(); + } + + PORT_Memcpy (genName->name.other.data + 2, name, PORT_Strlen (name)); + /* This may not be accurate for all cases. + For now, use this tag type */ + genName->name.other.data[0] = (char)(((genName->type - 1) & + 0x1f)| 0x80); + genName->name.other.data[1] = (char)PORT_Strlen (name); + genName->name.other.len = PORT_Strlen (name) + 2; + break; + } + + case certOtherName: { + i = 0; + if (!nickname) { + while (!isdigit(*(name + PORT_Strlen(name) - i))) { + i++; + } + if (*(name + PORT_Strlen(name) - i) == '1') { + binary = PR_TRUE; + } else { + binary = PR_FALSE; + } + while (*(name + PORT_Strlen(name) - i) != '-') { + i++; + } + *(name + PORT_Strlen(name) - i - 1) = '\0'; + i = 0; + while (*(name + i) != '-') { + i++; + } + *(name + i - 1) = '\0'; + oid = string_to_oid(name + i + 2); + } else { + oidData = SECOID_FindOIDByTag(SEC_OID_NETSCAPE_NICKNAME); + oid = &oidData->oid; + while (*(name + PORT_Strlen(name) - i) != '-') { + i++; + } + *(name + PORT_Strlen(name) - i) = '\0'; + } + genName->name.OthName.oid.data = oid->data; + genName->name.OthName.oid.len = oid->len; + if (binary) { + temp = string_to_binary(name); + genName->name.OthName.name.data = temp->data; + genName->name.OthName.name.len = temp->len; + } else { + temp = (SECItem *) PORT_ZAlloc(sizeof(SECItem)); + if (temp == NULL) { + error_allocate(); + } + temp->data = (unsigned char *)name; + temp->len = PORT_Strlen(name); + SEC_ASN1EncodeItem (arena, &(genName->name.OthName.name), temp, + CERTIA5TypeTemplate); + } + PORT_Free(temp); + break; + } + + case certDirectoryName: { + CERTName *directoryName = NULL; + + directoryName = CERT_AsciiToName (name); + if (!directoryName) { + error_out("ERROR: Improperly formated alternative name"); + break; + } + rv = CERT_CopyName (arena, &genName->name.directoryName, + directoryName); + CERT_DestroyName (directoryName); + + break; + } + } + genName->l.next = &(genName->l); + genName->l.prev = &(genName->l); + return rv; +} + + +static CERTGeneralName * +MakeAltName(Pair *data, + char *which, + PRArenaPool *arena) +{ + CERTGeneralName *SubAltName; + CERTGeneralName *current; + CERTGeneralName *newname; + char *name = NULL; + SECStatus rv = SECSuccess; + int len; + + + len = PORT_Strlen(which); + name = find_field(data, which, PR_TRUE); + SubAltName = current = (CERTGeneralName *) PORT_ZAlloc + (sizeof(CERTGeneralName)); + if (current == NULL) { + error_allocate(); + } + while (name != NULL) { + + rv = MakeGeneralName(name, current, arena); + + if (rv != SECSuccess) { + break; + } + if (*(which + len -1) < '9') { + *(which + len - 1) = *(which + len - 1) + 1; + } else { + if (isdigit(*(which + len - 2) )) { + *(which + len - 2) = *(which + len - 2) + 1; + *(which + len - 1) = '0'; + } else { + *(which + len - 1) = '1'; + *(which + len) = '0'; + *(which + len + 1) = '\0'; + len++; + } + } + len = PORT_Strlen(which); + name = find_field(data, which, PR_TRUE); + if (name != NULL) { + newname = (CERTGeneralName *) PORT_ZAlloc(sizeof(CERTGeneralName)); + if (newname == NULL) { + error_allocate(); + } + current->l.next = &(newname->l); + newname->l.prev = &(current->l); + current = newname; + newname = NULL; + } else { + current->l.next = &(SubAltName->l); + SubAltName->l.prev = &(current->l); + } + } + if (rv == SECFailure) { + return NULL; + } + return SubAltName; +} + +static CERTNameConstraints * +MakeNameConstraints(Pair *data, + PRArenaPool *arena) +{ + CERTNameConstraints *NameConstraints; + CERTNameConstraint *current = NULL; + CERTNameConstraint *last_permited = NULL; + CERTNameConstraint *last_excluded = NULL; + char *constraint = NULL; + char *which; + SECStatus rv = SECSuccess; + int len; + int i; + long max; + long min; + PRBool permited; + + + NameConstraints = (CERTNameConstraints *) PORT_ZAlloc + (sizeof(CERTNameConstraints)); + which = make_copy_string("NameConstraintSelect0", 25,'\0'); + len = PORT_Strlen(which); + constraint = find_field(data, which, PR_TRUE); + NameConstraints->permited = NameConstraints->excluded = NULL; + while (constraint != NULL) { + current = (CERTNameConstraint *) PORT_ZAlloc + (sizeof(CERTNameConstraint)); + if (current == NULL) { + error_allocate(); + } + i = 0; + while (*(constraint + PORT_Strlen(constraint) - i) != '-') { + i++; + } + *(constraint + PORT_Strlen(constraint) - i - 1) = '\0'; + max = (long) atoi(constraint + PORT_Strlen(constraint) + 3); + if (max > 0) { + (void) SEC_ASN1EncodeInteger(arena, ¤t->max, max); + } + i = 0; + while (*(constraint + PORT_Strlen(constraint) - i) != '-') { + i++; + } + *(constraint + PORT_Strlen(constraint) - i - 1) = '\0'; + min = (long) atoi(constraint + PORT_Strlen(constraint) + 3); + (void) SEC_ASN1EncodeInteger(arena, ¤t->min, min); + while (*(constraint + PORT_Strlen(constraint) - i) != '-') { + i++; + } + *(constraint + PORT_Strlen(constraint) - i - 1) = '\0'; + if (*(constraint + PORT_Strlen(constraint) + 3) == 'p') { + permited = PR_TRUE; + } else { + permited = PR_FALSE; + } + rv = MakeGeneralName(constraint, &(current->name), arena); + + if (rv != SECSuccess) { + break; + } + if (*(which + len - 1) < '9') { + *(which + len - 1) = *(which + len - 1) + 1; + } else { + if (isdigit(*(which + len - 2) )) { + *(which + len - 2) = *(which + len - 2) + 1; + *(which + len - 1) = '0'; + } else { + *(which + len - 1) = '1'; + *(which + len) = '0'; + *(which + len + 1) = '\0'; + len++; + } + } + len = PORT_Strlen(which); + if (permited) { + if (NameConstraints->permited == NULL) { + NameConstraints->permited = last_permited = current; + } + last_permited->l.next = &(current->l); + current->l.prev = &(last_permited->l); + last_permited = current; + } else { + if (NameConstraints->excluded == NULL) { + NameConstraints->excluded = last_excluded = current; + } + last_excluded->l.next = &(current->l); + current->l.prev = &(last_excluded->l); + last_excluded = current; + } + constraint = find_field(data, which, PR_TRUE); + if (constraint != NULL) { + current = (CERTNameConstraint *) PORT_ZAlloc(sizeof(CERTNameConstraint)); + if (current == NULL) { + error_allocate(); + } + } + } + if (NameConstraints->permited != NULL) { + last_permited->l.next = &(NameConstraints->permited->l); + NameConstraints->permited->l.prev = &(last_permited->l); + } + if (NameConstraints->excluded != NULL) { + last_excluded->l.next = &(NameConstraints->excluded->l); + NameConstraints->excluded->l.prev = &(last_excluded->l); + } + if (which != NULL) { + PORT_Free(which); + } + if (rv == SECFailure) { + return NULL; + } + return NameConstraints; +} + + + +static SECStatus +AddAltName(void *extHandle, + Pair *data, + char *issuerNameStr, + CERTCertDBHandle *handle, + int type) +{ + PRBool autoIssuer = PR_FALSE; + PRArenaPool *arena = NULL; + CERTGeneralName *genName = NULL; + char *which = NULL; + char *name = NULL; + SECStatus rv = SECSuccess; + SECItem *issuersAltName = NULL; + CERTCertificate *issuerCert = NULL; + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if (arena == NULL) { + error_allocate(); + } + if (type == 0) { + which = make_copy_string("SubAltNameSelect0", 20,'\0'); + genName = MakeAltName(data, which, arena); + } else { + if (autoIssuer) { + autoIssuer = find_field_bool(data,"IssuerAltNameSourceRadio-auto", + PR_TRUE); + issuerCert = CERT_FindCertByNameString(handle, issuerNameStr); + rv = cert_FindExtension((*issuerCert).extensions, + SEC_OID_X509_SUBJECT_ALT_NAME, + issuersAltName); + if (issuersAltName == NULL) { + name = PORT_Alloc(PORT_Strlen((*issuerCert).subjectName) + 4); + PORT_Strcpy(name, (*issuerCert).subjectName); + PORT_Strcat(name, " - 5"); + } + } else { + which = make_copy_string("IssuerAltNameSelect0", 20,'\0'); + genName = MakeAltName(data, which, arena); + } + } + if (type == 0) { + EncodeAndAddExtensionValue(arena, extHandle, genName, + find_field_bool(data, "SubAltName-crit", + PR_TRUE), + SEC_OID_X509_SUBJECT_ALT_NAME, + (EXTEN_VALUE_ENCODER) + CERT_EncodeAltNameExtension); + + } else { + if (autoIssuer && (name == NULL)) { + rv = CERT_AddExtension + (extHandle, SEC_OID_X509_ISSUER_ALT_NAME, issuersAltName, + find_field_bool(data, "IssuerAltName-crit", PR_TRUE), PR_TRUE); + } else { + EncodeAndAddExtensionValue(arena, extHandle, genName, + find_field_bool(data, + "IssuerAltName-crit", + PR_TRUE), + SEC_OID_X509_ISSUER_ALT_NAME, + (EXTEN_VALUE_ENCODER) + CERT_EncodeAltNameExtension); + } + } + if (which != NULL) { + PORT_Free(which); + } + if (issuerCert != NULL) { + CERT_DestroyCertificate(issuerCert); + } + return rv; +} + + +static SECStatus +AddNameConstraints(void *extHandle, + Pair *data) +{ + PRArenaPool *arena = NULL; + CERTNameConstraints *constraints = NULL; + SECStatus rv = SECSuccess; + + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if (arena == NULL) { + error_allocate(); + } + constraints = MakeNameConstraints(data, arena); + if (constraints != NULL) { + EncodeAndAddExtensionValue(arena, extHandle, constraints, PR_TRUE, + SEC_OID_X509_NAME_CONSTRAINTS, + (EXTEN_VALUE_ENCODER) + CERT_EncodeNameConstraintsExtension); + } + if (arena != NULL) { + PORT_ArenaRelease (arena, NULL); + } + return rv; +} + + +static SECStatus +add_extensions(CERTCertificate *subjectCert, + Pair *data, + char *issuerNameStr, + CERTCertDBHandle *handle) +{ + void *extHandle; + SECStatus rv = SECSuccess; + + + extHandle = CERT_StartCertExtensions (subjectCert); + if (extHandle == NULL) { + error_out("ERROR: Unable to get certificates extension handle"); + } + if (find_field_bool(data, "keyUsage", PR_TRUE)) { + rv = AddKeyUsage(extHandle, data); + if (rv != SECSuccess) { + error_out("ERROR: Unable to add Key Usage extension"); + } + } + + if( find_field_bool(data, "extKeyUsage", PR_TRUE) ) { + rv = AddExtKeyUsage(extHandle, data); + if( SECSuccess != rv ) { + error_out("ERROR: Unable to add Extended Key Usage extension"); + } + } + + if (find_field_bool(data, "basicConstraints", PR_TRUE)) { + rv = AddBasicConstraint(extHandle, data); + if (rv != SECSuccess) { + error_out("ERROR: Unable to add Basic Constraint extension"); + } + } + if (find_field_bool(data, "subjectKeyIdentifier", PR_TRUE)) { + rv = AddSubKeyID(extHandle, data, subjectCert); + if (rv != SECSuccess) { + error_out("ERROR: Unable to add Subject Key Identifier Extension"); + } + } + if (find_field_bool(data, "authorityKeyIdentifier", PR_TRUE)) { + rv = AddAuthKeyID (extHandle, data, issuerNameStr, handle); + if (rv != SECSuccess) { + error_out("ERROR: Unable to add Authority Key Identifier extension"); + } + } + if (find_field_bool(data, "privKeyUsagePeriod", PR_TRUE)) { + rv = AddPrivKeyUsagePeriod (extHandle, data, subjectCert); + if (rv != SECSuccess) { + error_out("ERROR: Unable to add Private Key Usage Period extension"); + } + } + if (find_field_bool(data, "SubAltName", PR_TRUE)) { + rv = AddAltName (extHandle, data, NULL, NULL, 0); + if (rv != SECSuccess) { + error_out("ERROR: Unable to add Subject Alternative Name extension"); + } + } + if (find_field_bool(data, "IssuerAltName", PR_TRUE)) { + rv = AddAltName (extHandle, data, issuerNameStr, handle, 1); + if (rv != SECSuccess) { + error_out("ERROR: Unable to add Issuer Alternative Name Extension"); + } + } + if (find_field_bool(data, "NameConstraints", PR_TRUE)) { + rv = AddNameConstraints(extHandle, data); + if (rv != SECSuccess) { + error_out("ERROR: Unable to add Name Constraints Extension"); + } + } + if (find_field_bool(data, "netscape-cert-type", PR_TRUE)) { + rv = AddNscpCertType(extHandle, data); + if (rv != SECSuccess) { + error_out("ERROR: Unable to add Netscape Certificate Type Extension"); + } + } + if (find_field_bool(data, "netscape-base-url", PR_TRUE)) { + rv = add_IA5StringExtension(extHandle, + find_field(data, "netscape-base-url-text", + PR_TRUE), + find_field_bool(data, + "netscape-base-url-crit", + PR_TRUE), + SEC_OID_NS_CERT_EXT_BASE_URL); + if (rv != SECSuccess) { + error_out("ERROR: Unable to add Netscape Base URL Extension"); + } + } + if (find_field_bool(data, "netscape-revocation-url", PR_TRUE)) { + rv = add_IA5StringExtension(extHandle, + find_field(data, + "netscape-revocation-url-text", + PR_TRUE), + find_field_bool + (data, "netscape-revocation-url-crit", + PR_TRUE), + SEC_OID_NS_CERT_EXT_REVOCATION_URL); + if (rv != SECSuccess) { + error_out("ERROR: Unable to add Netscape Revocation URL Extension"); + } + } + if (find_field_bool(data, "netscape-ca-revocation-url", PR_TRUE)) { + rv = add_IA5StringExtension(extHandle, + find_field(data, + "netscape-ca-revocation-url-text", + PR_TRUE), + find_field_bool + (data, "netscape-ca-revocation-url-crit" + , PR_TRUE), + SEC_OID_NS_CERT_EXT_CA_REVOCATION_URL); + if (rv != SECSuccess) { + error_out("ERROR: Unable to add Netscape CA Revocation URL Extension"); + } + } + if (find_field_bool(data, "netscape-cert-renewal-url", PR_TRUE)) { + rv = add_IA5StringExtension(extHandle, + find_field(data, + "netscape-cert-renewal-url-text", + PR_TRUE), + find_field_bool + (data, "netscape-cert-renewal-url-crit", + PR_TRUE), + SEC_OID_NS_CERT_EXT_CERT_RENEWAL_URL); + if (rv != SECSuccess) { + error_out("ERROR: Unable to add Netscape Certificate Renewal URL Extension"); + } + } + if (find_field_bool(data, "netscape-ca-policy-url", PR_TRUE)) { + rv = add_IA5StringExtension(extHandle, + find_field(data, + "netscape-ca-policy-url-text", + PR_TRUE), + find_field_bool + (data, "netscape-ca-policy-url-crit", + PR_TRUE), + SEC_OID_NS_CERT_EXT_CA_POLICY_URL); + if (rv != SECSuccess) { + error_out("ERROR: Unable to add Netscape CA Policy URL Extension"); + } + } + if (find_field_bool(data, "netscape-ssl-server-name", PR_TRUE)) { + rv = add_IA5StringExtension(extHandle, + find_field(data, + "netscape-ssl-server-name-text", + PR_TRUE), + find_field_bool + (data, "netscape-ssl-server-name-crit", + PR_TRUE), + SEC_OID_NS_CERT_EXT_SSL_SERVER_NAME); + if (rv != SECSuccess) { + error_out("ERROR: Unable to add Netscape SSL Server Name Extension"); + } + } + if (find_field_bool(data, "netscape-comment", PR_TRUE)) { + rv = add_IA5StringExtension(extHandle, + find_field(data, "netscape-comment-text", + PR_TRUE), + find_field_bool(data, + "netscape-comment-crit", + PR_TRUE), + SEC_OID_NS_CERT_EXT_COMMENT); + if (rv != SECSuccess) { + error_out("ERROR: Unable to add Netscape Comment Extension"); + } + } + CERT_FinishExtensions(extHandle); + return (rv); +} + + + +char * +return_dbpasswd(PK11SlotInfo *slot, PRBool retry, void *data) +{ + char *rv; + + /* don't clobber our poor smart card */ + if (retry == PR_TRUE) { + return NULL; + } + rv = PORT_Alloc(4); + PORT_Strcpy(rv, "foo"); + return rv; +} + + +SECKEYPrivateKey * +FindPrivateKeyFromNameStr(char *name, + CERTCertDBHandle *certHandle) +{ + SECKEYPrivateKey *key; + CERTCertificate *cert; + CERTCertificate *p11Cert; + + + /* We don't presently have a PK11 function to find a cert by + ** subject name. + ** We do have a function to find a cert in the internal slot's + ** cert db by subject name, but it doesn't setup the slot info. + ** So, this HACK works, but should be replaced as soon as we + ** have a function to search for certs accross slots by subject name. + */ + cert = CERT_FindCertByNameString(certHandle, name); + if (cert == NULL || cert->nickname == NULL) { + error_out("ERROR: Unable to retrieve issuers certificate"); + } + p11Cert = PK11_FindCertFromNickname(cert->nickname, NULL); + if (p11Cert == NULL) { + error_out("ERROR: Unable to retrieve issuers certificate"); + } + key = PK11_FindKeyByAnyCert(p11Cert, NULL); + return key; +} + +static SECItem * +SignCert(CERTCertificate *cert, + char *issuerNameStr, + Pair *data, + CERTCertDBHandle *handle, + int which_key) +{ + SECItem der; + SECKEYPrivateKey *caPrivateKey = NULL; + SECStatus rv; + PRArenaPool *arena; + SECOidTag algID; + + if (which_key == 0) { + caPrivateKey = FindPrivateKeyFromNameStr(issuerNameStr, handle); + } else { + caPrivateKey = privkeys[which_key - 1]; + } + if (caPrivateKey == NULL) { + error_out("ERROR: unable to retrieve issuers key"); + } + + arena = cert->arena; + + algID = SEC_GetSignatureAlgorithmOidTag(caPrivateKey->keyType, + SEC_OID_UNKNOWN); + if (algID == SEC_OID_UNKNOWN) { + error_out("ERROR: Unknown key type for issuer."); + goto done; + } + + rv = SECOID_SetAlgorithmID(arena, &cert->signature, algID, 0); + if (rv != SECSuccess) { + error_out("ERROR: Could not set signature algorithm id."); + } + + if (find_field_bool(data,"ver-1", PR_TRUE)) { + *(cert->version.data) = 0; + cert->version.len = 1; + } else { + *(cert->version.data) = 2; + cert->version.len = 1; + } + der.data = NULL; + der.len = 0; + (void) SEC_ASN1EncodeItem (arena, &der, cert, CERT_CertificateTemplate); + if (der.data == NULL) { + error_out("ERROR: Could not encode certificate.\n"); + } + rv = SEC_DerSignData (arena, &(cert->derCert), der.data, der.len, caPrivateKey, + algID); + if (rv != SECSuccess) { + error_out("ERROR: Could not sign encoded certificate data.\n"); + } +done: + SECKEY_DestroyPrivateKey(caPrivateKey); + return &(cert->derCert); +} + + +int +main(int argc, char **argv) +{ + int length = 500; + int remaining = 500; + int n; + int i; + int serial; + int chainLen; + int which_key; + char *pos; +#ifdef OFFLINE + char *form_output = "key=MIIBPTCBpzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA7SLqjWBL9Wl11Vlg%0AaMqZCvcQOL%2FnvSqYPPRP0XZy9SoAeyWzQnBOiCm2t8H5mK7r2jnKdAQOmfhjaJil%0A3hNVu3SekHOXF6Ze7bkWa6%2FSGVcY%2FojkydxFSgY43nd1iydzPQDp8WWLL%2BpVpt%2B%2B%0ATRhFtVXbF0fQI03j9h3BoTgP2lkCAwEAARYDZm9vMA0GCSqGSIb3DQEBBAUAA4GB%0AAJ8UfRKJ0GtG%2B%2BufCC6tAfTzKrq3CTBHnom55EyXcsAsv6WbDqI%2F0rLAPkn2Xo1r%0AnNhtMxIuj441blMt%2Fa3AGLOy5zmC7Qawt8IytvQikQ1XTpTBCXevytrmLjCmlURr%0ANJryTM48WaMQHiMiJpbXCqVJC1d%2FpEWBtqvALzZaOOIy&subject=CN%3D%22test%22%26serial-auto%3Dtrue%26serial_value%3D%26ver-1%3Dtrue%26ver-3%3Dfalse%26caChoiceradio-SignWithDefaultkey%3Dtrue%26caChoiceradio-SignWithRandomChain%3Dfalse%26autoCAs%3D%26caChoiceradio-SignWithSpecifiedChain%3Dfalse%26manCAs%3D%26%24"; +#else + char *form_output; +#endif + char *issuerNameStr; + char *certName; + char *DBdir = DB_DIRECTORY; + char *prefixs[10] = {"CA#1-", "CA#2-", "CA#3-", + "CA#4-", "CA#5-", "CA#6-", + "CA#7-", "CA#8-", "CA#9-", ""}; + Pair *form_data; + CERTCertificate *cert; + CERTCertDBHandle *handle; + CERTCertificateRequest *certReq = NULL; + int warpmonths = 0; + SECItem *certDER; +#ifdef FILEOUT + FILE *outfile; +#endif + SECStatus status = SECSuccess; + extern char prefix[PREFIX_LEN]; + SEC_PKCS7ContentInfo *certChain; + SECItem *encodedCertChain; + PRBool UChain = PR_FALSE; + + + progName = strrchr(argv[0], '/'); + progName = progName ? progName+1 : argv[0]; + + +#ifdef TEST + sleep(20); +#endif + SECU_ConfigDirectory(DBdir); + + PK11_SetPasswordFunc(return_dbpasswd); + status = NSS_InitReadWrite(DBdir); + if (status != SECSuccess) { + SECU_PrintPRandOSError(progName); + return -1; + } + handle = CERT_GetDefaultCertDB(); + + prefix[0]= '\0'; +#if !defined(OFFLINE) + form_output = (char*) PORT_Alloc(length); + if (form_output == NULL) { + error_allocate(); + } + pos = form_output; + while (feof(stdin) == 0 ) { + if (remaining <= 1) { + remaining += length; + length = length * 2; + form_output = PORT_Realloc(form_output, (length)); + if (form_output == NULL) { + error_allocate(); + } + pos = form_output + length - remaining; + } + n = fread(pos, 1, (size_t) (remaining - 1), stdin); + pos += n; + remaining -= n; + } + *pos = '&'; + pos++; + length = pos - form_output; +#else + length = PORT_Strlen(form_output); +#endif +#ifdef FILEOUT + printf("Content-type: text/plain\n\n"); + fwrite(form_output, 1, (size_t)length, stdout); + printf("\n"); +#endif +#ifdef FILEOUT + fwrite(form_output, 1, (size_t)length, stdout); + printf("\n"); + fflush(stdout); +#endif + form_data = make_datastruct(form_output, length); + status = clean_input(form_data); +#if !defined(OFFLINE) + PORT_Free(form_output); +#endif +#ifdef FILEOUT + i = 0; + while(return_name(form_data, i) != NULL) { + printf("%s",return_name(form_data,i)); + printf("=\n"); + printf("%s",return_data(form_data,i)); + printf("\n"); + i++; + } + printf("I got that done, woo hoo\n"); + fflush(stdout); +#endif + issuerNameStr = PORT_Alloc(200); + if (find_field_bool(form_data, "caChoiceradio-SignWithSpecifiedChain", + PR_FALSE)) { + UChain = PR_TRUE; + chainLen = atoi(find_field(form_data, "manCAs", PR_FALSE)); + PORT_Strcpy(prefix, prefixs[0]); + issuerNameStr = PORT_Strcpy(issuerNameStr, + "CN=Cert-O-Matic II, O=Cert-O-Matic II"); + if (chainLen == 0) { + UChain = PR_FALSE; + } + } else { + if (find_field_bool(form_data, "caChoiceradio-SignWithRandomChain", + PR_FALSE)) { + PORT_Strcpy(prefix,prefixs[9]); + chainLen = atoi(find_field(form_data, "autoCAs", PR_FALSE)); + if (chainLen < 1 || chainLen > 18) { + issuerNameStr = PORT_Strcpy(issuerNameStr, + "CN=CA18, O=Cert-O-Matic II"); + } + issuerNameStr = PORT_Strcpy(issuerNameStr, "CN=CA"); + issuerNameStr = PORT_Strcat(issuerNameStr, + find_field(form_data,"autoCAs", PR_FALSE)); + issuerNameStr = PORT_Strcat(issuerNameStr,", O=Cert-O-Matic II"); + } else { + issuerNameStr = PORT_Strcpy(issuerNameStr, + "CN=Cert-O-Matic II, O=Cert-O-Matic II"); + } + chainLen = 0; + } + + i = -1; + which_key = 0; + do { + extern SECStatus cert_GetKeyID(CERTCertificate *cert); + i++; + if (i != 0 && UChain) { + PORT_Strcpy(prefix, prefixs[i]); + } + /* find_field(form_data,"subject", PR_TRUE); */ + certReq = makeCertReq(form_data, which_key); +#ifdef OFFLINE + serial = 900; +#else + serial = get_serial_number(form_data); +#endif + cert = MakeV1Cert(handle, certReq, issuerNameStr, PR_FALSE, + serial, warpmonths, form_data); + if (certReq != NULL) { + CERT_DestroyCertificateRequest(certReq); + } + if (find_field_bool(form_data,"ver-3", PR_TRUE)) { + status = add_extensions(cert, form_data, issuerNameStr, handle); + if (status != SECSuccess) { + error_out("ERROR: Unable to add extensions"); + } + } + status = cert_GetKeyID(cert); + if (status == SECFailure) { + error_out("ERROR: Unable to get Key ID."); + } + certDER = SignCert(cert, issuerNameStr, form_data, handle, which_key); + CERT_NewTempCertificate(handle, certDER, NULL, PR_FALSE, PR_TRUE); + issuerNameStr = find_field(form_data, "subject", PR_TRUE); + /* SECITEM_FreeItem(certDER, PR_TRUE); */ + CERT_DestroyCertificate(cert); + if (i == (chainLen - 1)) { + i = 8; + } + ++which_key; + } while (i < 9 && UChain); + + + +#ifdef FILEOUT + outfile = fopen("../certout", "wb"); +#endif + certName = find_field(form_data, "subject", PR_FALSE); + cert = CERT_FindCertByNameString(handle, certName); + certChain = SEC_PKCS7CreateCertsOnly (cert, PR_TRUE, handle); + if (certChain == NULL) { + error_out("ERROR: No certificates in cert chain"); + } + encodedCertChain = SEC_PKCS7EncodeItem (NULL, NULL, certChain, NULL, NULL, + NULL); + if (encodedCertChain) { +#if !defined(FILEOUT) + printf("Content-type: application/x-x509-user-cert\r\n"); + printf("Content-length: %d\r\n\r\n", encodedCertChain->len); + fwrite (encodedCertChain->data, 1, encodedCertChain->len, stdout); +#else + fwrite (encodedCertChain->data, 1, encodedCertChain->len, outfile); +#endif + + } else { + error_out("Error: Unable to DER encode certificate"); + } +#ifdef FILEOUT + printf("\nI got here!\n"); + fflush(outfile); + fclose(outfile); +#endif + fflush(stdout); + if (NSS_Shutdown() != SECSuccess) { + exit(1); + } + return 0; +} + diff --git a/mozilla/security/nss/cmd/certcgi/index.html b/mozilla/security/nss/cmd/certcgi/index.html new file mode 100644 index 0000000..2909dd0 --- /dev/null +++ b/mozilla/security/nss/cmd/certcgi/index.html @@ -0,0 +1,821 @@ + + + + + + + +Cert-O-Matic + + + + + diff --git a/mozilla/security/nss/cmd/certcgi/main.html b/mozilla/security/nss/cmd/certcgi/main.html new file mode 100644 index 0000000..8a04ef9 --- /dev/null +++ b/mozilla/security/nss/cmd/certcgi/main.html @@ -0,0 +1,108 @@ + + + + Main Layer for CertOMatic + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ Common Name:

+
+ Organization:

+ MAIL= + + E= + + + + Organizational Unit:

+ UID=

+ Locality:

+ State or Province:

+ Country:

+ Serial Number: +
Auto Generate +
+ Use this hex value: 

+
+ X.509 version: +
Version 1 +
Version 3

+ Key Type: +
RSA +
DSA

+ Intermediate CA Key Sizes: +
+
+ Validity: +
+ Generate Automatically +
Use these values: +
Not Before:  +
Not After:    +
         + YYMMDDhhmm[ss]{Z|+hhmm|-hhmm} +
+ DN:

+
+ diff --git a/mozilla/security/nss/cmd/certcgi/manifest.mn b/mozilla/security/nss/cmd/certcgi/manifest.mn new file mode 100644 index 0000000..057f259 --- /dev/null +++ b/mozilla/security/nss/cmd/certcgi/manifest.mn @@ -0,0 +1,54 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +CORE_DEPTH = ../../.. + +# MODULE public and private header directories are implicitly REQUIREd. +MODULE = nss + +# This next line is used by .mk files +# and gets translated into $LINCS in manifest.mnw +REQUIRES = seccmd dbm + +DEFINES = -DNSPR20 + +CSRCS = certcgi.c + +PROGRAM = certcgi + +USE_STATIC_LIBS = 1 + diff --git a/mozilla/security/nss/cmd/certcgi/nscp_ext_form.html b/mozilla/security/nss/cmd/certcgi/nscp_ext_form.html new file mode 100644 index 0000000..bc94ab3 --- /dev/null +++ b/mozilla/security/nss/cmd/certcgi/nscp_ext_form.html @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
+ Netscape Certificate Type:

+ Activate extension:

+ Critical: +
+ SSL Client

+ SSL Server

+ S/MIME

+ Object Signing

+ Reserved for future use (bit 4)

+ SSL CA

+ S/MIME CA

+ Object Signing CA

+
+ Netscape Base URL:

+ Activate extension:

+ Critical: +
+ +
+ Netscape Revocation URL:

+ Activate extension:

+ Critical: +
+ +
+ Netscape CA Revocation URL:

+ Activate extension:

+ Critical: +
+ +
+ Netscape Certificate Renewal URL:

+ Activate extension:

+ Critical: +
+ +
+ Netscape CA Policy URL:

+ Activate extension:

+ Critical: +
+ +
+ Netscape SSL Server Name:

+ Activate extension:

+ Critical: +
+ +
+ Netscape Comment:

+ Activate extension:

+ Critical: +
+ +
+ + diff --git a/mozilla/security/nss/cmd/certcgi/stnd_ext_form.html b/mozilla/security/nss/cmd/certcgi/stnd_ext_form.html new file mode 100644 index 0000000..de5d795 --- /dev/null +++ b/mozilla/security/nss/cmd/certcgi/stnd_ext_form.html @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Key Usage:

+ Activate extension:

+ Critical: +
+ Digital Signature

+ Non Repudiation

+ Key Encipherment

+ Data Encipherment

+ Key Agreement

+ Key Certificate Signing

+ CRL Signing

+
+ Extended Key Usage:

+ Activate extension:

+ Critical: +
+ Server Auth

+ Client Auth

+ Code Signing

+ Email Protection

+ Timestamp

+ OCSP Responder

+ Step-up

+
+ Basic Constraints:

+ Activate extension:

+ Critical: +
+ CA:

+
True

+
False

+ + Include Path length:

+
+ Authority Key Identifier:

+ Activate extension: +
+ Key Identider

+ Issuer Name and Serial number

+
+ Subject Key Identifier:

+ Activate extension: +
+ Key Identifier: +

+ This is an:

+

ascii text value

+

hex value

+

+ Private Key Usage Period:

+ Activate extension:

+ Critical: +
+ Use:

+
Not Before

+
Not After

+
Both

+ Not to be used to sign before:

+
Set to time of certificate issue

+
Use This value

+
(YYYY/MM/DD HH:MM:SS): + / + / + + : + : +

+ Not to be used to sign after:

+
(YYYY/MM/DD HH:MM:SS): + / + / + + : + : +

+
+ Subject Alternative Name:

+ Activate extension:

+ Critical: +
+ + + +
+ General Names:

+

+ + +
+ +
+ Name Type:
+ Other Name, + OID: + RFC 822 Name
+ DNS Name + X400 Address
+ Directory Name + EDI Party Name
+ Uniform Resource Locator + IP Address
+ Registered ID + Netscape Certificate Nickname
+ Name: + Binary Encoded:

+
+
+ Issuer Alternative Name:

+ Activate extension:

+ Critical: +
+ Use the Subject Alternative Name from the Issuers Certificate

+ Use this Name: + + + +
+ General Names:

+

+ + +
+ +
+ Name Type:
+ Other Name, + OID: + RFC 822 Name
+ DNS Name + X400 Address
+ Directory Name + EDI Party Name
+ Uniform Resource Locator + IP Address
+ Registered ID
+ Name: + Binary Encoded:

+
+
+ Name Constraints:

+ Activate extension:

+
+ + + +
+ Name Constraints:

+

+ + +
+ +
+ Name Type:
+ Other Name, + OID: + RFC 822 Name
+ DNS Name + X400 Address
+ Directory Name + EDI Party Name
+ Uniform Resource Locator + IP Address
+ Registered ID
+ Name: + Binary Encoded:

+ Constraint type:

+

permited

+

excluded

+ Minimum:

+ Maximum:

+
+
+ + + + + + + + + + diff --git a/mozilla/security/nss/cmd/certutil/Makefile b/mozilla/security/nss/cmd/certutil/Makefile new file mode 100644 index 0000000..fe79918 --- /dev/null +++ b/mozilla/security/nss/cmd/certutil/Makefile @@ -0,0 +1,80 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + +include ../platlibs.mk + + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + + +include ../platrules.mk + diff --git a/mozilla/security/nss/cmd/certutil/certext.c b/mozilla/security/nss/cmd/certutil/certext.c new file mode 100644 index 0000000..b9ccfbf --- /dev/null +++ b/mozilla/security/nss/cmd/certutil/certext.c @@ -0,0 +1,1817 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Dr Vipul Gupta , Sun Microsystems Laboratories + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* +** certext.c +** +** part of certutil for managing certificates extensions +** +*/ +#include +#include +#include + +#if defined(WIN32) +#include "fcntl.h" +#include "io.h" +#endif + +#include "secutil.h" + +#if defined(XP_UNIX) +#include +#endif + +#include "cert.h" +#include "xconst.h" +#include "prprf.h" +#include "certutil.h" + +#define GEN_BREAK(e) rv=e; break; + +static char * +Gets_s(char *buff, size_t size) { + char *str; + + if (buff == NULL || size < 1) { + PORT_Assert(0); + return NULL; + } + if ((str = fgets(buff, size, stdin)) != NULL) { + int len = PORT_Strlen(str); + /* + * fgets() automatically converts native text file + * line endings to '\n'. As defensive programming + * (just in case fgets has a bug or we put stdin in + * binary mode by mistake), we handle three native + * text file line endings here: + * '\n' Unix (including Linux and Mac OS X) + * '\r''\n' DOS/Windows & OS/2 + * '\r' Mac OS Classic + * len can not be less then 1, since in case with + * empty string it has at least '\n' in the buffer + */ + if (buff[len - 1] == '\n' || buff[len - 1] == '\r') { + buff[len - 1] = '\0'; + if (len > 1 && buff[len - 2] == '\r') + buff[len - 2] = '\0'; + } + } else { + buff[0] = '\0'; + } + return str; +} + + +static SECStatus +PrintChoicesAndGetAnswer(char* str, char* rBuff, int rSize) +{ + fputs(str, stdout); + fputs(" > ", stdout); + fflush (stdout); + if (Gets_s(rBuff, rSize) == NULL) { + PORT_SetError(SEC_ERROR_INPUT_LEN); + return SECFailure; + } + return SECSuccess; +} + +static CERTGeneralName * +GetGeneralName (PRArenaPool *arena) +{ + CERTGeneralName *namesList = NULL; + CERTGeneralName *current; + CERTGeneralName *tail = NULL; + SECStatus rv = SECSuccess; + int intValue; + char buffer[512]; + void *mark; + + PORT_Assert (arena); + mark = PORT_ArenaMark (arena); + do { + if (PrintChoicesAndGetAnswer( + "\nSelect one of the following general name type: \n" + "\t2 - rfc822Name\n" + "\t3 - dnsName\n" + "\t5 - directoryName\n" + "\t7 - uniformResourceidentifier\n" + "\t8 - ipAddress\n" + "\t9 - registerID\n" + "\tAny other number to finish\n" + "\t\tChoice:", buffer, sizeof(buffer)) == SECFailure) { + GEN_BREAK (SECFailure); + } + intValue = PORT_Atoi (buffer); + /* + * Should use ZAlloc instead of Alloc to avoid problem with garbage + * initialized pointers in CERT_CopyName + */ + switch (intValue) { + case certRFC822Name: + case certDNSName: + case certDirectoryName: + case certURI: + case certIPAddress: + case certRegisterID: + break; + default: + intValue = 0; /* force a break for anything else */ + } + + if (intValue == 0) + break; + + if (namesList == NULL) { + namesList = current = tail = + PORT_ArenaZNew(arena, CERTGeneralName); + } else { + current = PORT_ArenaZNew(arena, CERTGeneralName); + } + if (current == NULL) { + GEN_BREAK (SECFailure); + } + + current->type = intValue; + puts ("\nEnter data:"); + fflush (stdout); + if (Gets_s (buffer, sizeof(buffer)) == NULL) { + PORT_SetError(SEC_ERROR_INPUT_LEN); + GEN_BREAK (SECFailure); + } + switch (current->type) { + case certURI: + case certDNSName: + case certRFC822Name: + current->name.other.data = + PORT_ArenaAlloc (arena, strlen (buffer)); + if (current->name.other.data == NULL) { + GEN_BREAK (SECFailure); + } + PORT_Memcpy(current->name.other.data, buffer, + current->name.other.len = strlen(buffer)); + break; + + case certEDIPartyName: + case certIPAddress: + case certOtherName: + case certRegisterID: + case certX400Address: { + + current->name.other.data = + PORT_ArenaAlloc (arena, strlen (buffer) + 2); + if (current->name.other.data == NULL) { + GEN_BREAK (SECFailure); + } + + PORT_Memcpy (current->name.other.data + 2, buffer, + strlen (buffer)); + /* This may not be accurate for all cases. For now, + * use this tag type */ + current->name.other.data[0] = + (char)(((current->type - 1) & 0x1f)| 0x80); + current->name.other.data[1] = (char)strlen (buffer); + current->name.other.len = strlen (buffer) + 2; + break; + } + + case certDirectoryName: { + CERTName *directoryName = NULL; + + directoryName = CERT_AsciiToName (buffer); + if (!directoryName) { + fprintf(stderr, "certutil: improperly formatted name: " + "\"%s\"\n", buffer); + break; + } + + rv = CERT_CopyName (arena, ¤t->name.directoryName, + directoryName); + CERT_DestroyName (directoryName); + + break; + } + } + if (rv != SECSuccess) + break; + current->l.next = &(namesList->l); + current->l.prev = &(tail->l); + tail->l.next = &(current->l); + tail = current; + + }while (1); + + if (rv != SECSuccess) { + PORT_ArenaRelease (arena, mark); + namesList = NULL; + } + return (namesList); +} + +static SECStatus +GetString(PRArenaPool *arena, char *prompt, SECItem *value) +{ + char buffer[251]; + char *buffPrt; + + buffer[0] = '\0'; + value->data = NULL; + value->len = 0; + + puts (prompt); + buffPrt = Gets_s (buffer, sizeof(buffer)); + /* returned NULL here treated the same way as empty string */ + if (buffPrt && strlen (buffer) > 0) { + value->data = PORT_ArenaAlloc (arena, strlen (buffer)); + if (value->data == NULL) { + PORT_SetError (SEC_ERROR_NO_MEMORY); + return (SECFailure); + } + PORT_Memcpy (value->data, buffer, value->len = strlen(buffer)); + } + return (SECSuccess); +} + +static PRBool +GetYesNo(char *prompt) +{ + char buf[3]; + char *buffPrt; + + buf[0] = 'n'; + puts(prompt); + buffPrt = Gets_s(buf, sizeof(buf)); + return (buffPrt && (buf[0] == 'y' || buf[0] == 'Y')) ? PR_TRUE : PR_FALSE; +} + +/* Parses comma separated values out of the string pointed by nextPos. + * Parsed value is compared to an array of possible values(valueArray). + * If match is found, a value index is returned, otherwise returns SECFailue. + * nextPos is set to the token after found comma separator or to NULL. + * NULL in nextPos should be used as indication of the last parsed token. + * A special value "critical" can be parsed out from the supplied sting.*/ + +static SECStatus +parseNextCmdInput(const char * const *valueArray, int *value, char **nextPos, + PRBool *critical) +{ + char *thisPos = *nextPos; + int keyLen = 0; + int arrIndex = 0; + + if (!valueArray || !value || !nextPos || !critical) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + while (1) { + if ((*nextPos = strchr(thisPos, ',')) == NULL) { + keyLen = strlen(thisPos); + } else { + keyLen = *nextPos - thisPos; + *nextPos += 1; + } + /* if critical keyword is found, go for another loop, + * but check, if it is the last keyword of + * the string.*/ + if (!strncmp("critical", thisPos, keyLen)) { + *critical = PR_TRUE; + if (*nextPos == NULL) { + return SECSuccess; + } + thisPos = *nextPos; + continue; + } + break; + } + for (arrIndex = 0; valueArray[arrIndex]; arrIndex++) { + if (!strncmp(valueArray[arrIndex], thisPos, keyLen)) { + *value = arrIndex; + return SECSuccess; + } + } + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; +} + +static const char * const +keyUsageKeyWordArray[] = { "digitalSignature", + "nonRepudiation", + "keyEncipherment", + "dataEncipherment", + "keyAgreement", + "certSigning", + "crlSigning", + NULL}; + +static SECStatus +AddKeyUsage (void *extHandle, const char *userSuppliedValue) +{ + SECItem bitStringValue; + unsigned char keyUsage = 0x0; + char buffer[5]; + int value; + char *nextPos = (char*)userSuppliedValue; + PRBool isCriticalExt = PR_FALSE; + + if (!userSuppliedValue) { + while (1) { + if (PrintChoicesAndGetAnswer( + "\t\t0 - Digital Signature\n" + "\t\t1 - Non-repudiation\n" + "\t\t2 - Key encipherment\n" + "\t\t3 - Data encipherment\n" + "\t\t4 - Key agreement\n" + "\t\t5 - Cert signing key\n" + "\t\t6 - CRL signing key\n" + "\t\tOther to finish\n", + buffer, sizeof(buffer)) == SECFailure) { + return SECFailure; + } + value = PORT_Atoi (buffer); + if (value < 0 || value > 6) + break; + if (value == 0) { + /* Checking that zero value of variable 'value' + * corresponds to '0' input made by user */ + char *chPtr = strchr(buffer, '0'); + if (chPtr == NULL) { + continue; + } + } + keyUsage |= (0x80 >> value); + } + isCriticalExt = GetYesNo("Is this a critical extension [y/N]?"); + } else { + while (1) { + if (parseNextCmdInput(keyUsageKeyWordArray, &value, &nextPos, + &isCriticalExt) == SECFailure) { + return SECFailure; + } + keyUsage |= (0x80 >> value); + if (!nextPos) + break; + } + } + + bitStringValue.data = &keyUsage; + bitStringValue.len = 1; + + return (CERT_EncodeAndAddBitStrExtension + (extHandle, SEC_OID_X509_KEY_USAGE, &bitStringValue, + isCriticalExt)); + +} + + +static CERTOidSequence * +CreateOidSequence(void) +{ + CERTOidSequence *rv = (CERTOidSequence *)NULL; + PRArenaPool *arena = (PRArenaPool *)NULL; + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if( (PRArenaPool *)NULL == arena ) { + goto loser; + } + + rv = (CERTOidSequence *)PORT_ArenaZNew(arena, CERTOidSequence); + if( (CERTOidSequence *)NULL == rv ) { + goto loser; + } + + rv->oids = (SECItem **)PORT_ArenaZNew(arena, SECItem *); + if( (SECItem **)NULL == rv->oids ) { + goto loser; + } + + rv->arena = arena; + return rv; + +loser: + if( (PRArenaPool *)NULL != arena ) { + PORT_FreeArena(arena, PR_FALSE); + } + + return (CERTOidSequence *)NULL; +} + +static void +DestroyOidSequence(CERTOidSequence *os) +{ + if (os->arena) { + PORT_FreeArena(os->arena, PR_FALSE); + } +} + +static SECStatus +AddOidToSequence(CERTOidSequence *os, SECOidTag oidTag) +{ + SECItem **oids; + PRUint32 count = 0; + SECOidData *od; + + od = SECOID_FindOIDByTag(oidTag); + if( (SECOidData *)NULL == od ) { + return SECFailure; + } + + for( oids = os->oids; (SECItem *)NULL != *oids; oids++ ) { + if (*oids == &od->oid) { + /* We already have this oid */ + return SECSuccess; + } + count++; + } + + /* ArenaZRealloc */ + + { + PRUint32 i; + + oids = (SECItem **)PORT_ArenaZNewArray(os->arena, SECItem *, count + 2); + if( (SECItem **)NULL == oids ) { + return SECFailure; + } + + for( i = 0; i < count; i++ ) { + oids[i] = os->oids[i]; + } + + /* ArenaZFree(os->oids); */ + } + + os->oids = oids; + os->oids[count] = &od->oid; + + return SECSuccess; +} + +SEC_ASN1_MKSUB(SEC_ObjectIDTemplate) + +const SEC_ASN1Template CERT_OidSeqTemplate[] = { + { SEC_ASN1_SEQUENCE_OF | SEC_ASN1_XTRN, offsetof(CERTOidSequence, oids), + SEC_ASN1_SUB(SEC_ObjectIDTemplate) } +}; + + +static SECItem * +EncodeOidSequence(CERTOidSequence *os) +{ + SECItem *rv; + + rv = (SECItem *)PORT_ArenaZNew(os->arena, SECItem); + if( (SECItem *)NULL == rv ) { + goto loser; + } + + if( !SEC_ASN1EncodeItem(os->arena, rv, os, CERT_OidSeqTemplate) ) { + goto loser; + } + + return rv; + +loser: + return (SECItem *)NULL; +} + +static const char * const +extKeyUsageKeyWordArray[] = { "serverAuth", + "clientAuth", + "codeSigning", + "emailProtection", + "timeStamp", + "ocspResponder", + "stepUp", + NULL}; + +static SECStatus +AddExtKeyUsage (void *extHandle, const char *userSuppliedValue) +{ + char buffer[5]; + int value; + CERTOidSequence *os; + SECStatus rv; + SECItem *item; + PRBool isCriticalExt = PR_FALSE; + char *nextPos = (char*)userSuppliedValue; + + os = CreateOidSequence(); + if( (CERTOidSequence *)NULL == os ) { + return SECFailure; + } + + while (1) { + if (!userSuppliedValue) { + if (PrintChoicesAndGetAnswer( + "\t\t0 - Server Auth\n" + "\t\t1 - Client Auth\n" + "\t\t2 - Code Signing\n" + "\t\t3 - Email Protection\n" + "\t\t4 - Timestamp\n" + "\t\t5 - OCSP Responder\n" + "\t\t6 - Step-up\n" + "\t\tOther to finish\n", + buffer, sizeof(buffer)) == SECFailure) { + GEN_BREAK(SECFailure); + } + value = PORT_Atoi(buffer); + + if (value == 0) { + /* Checking that zero value of variable 'value' + * corresponds to '0' input made by user */ + char *chPtr = strchr(buffer, '0'); + if (chPtr == NULL) { + continue; + } + } + } else { + if (parseNextCmdInput(extKeyUsageKeyWordArray, &value, &nextPos, + &isCriticalExt) == SECFailure) { + return SECFailure; + } + } + + switch( value ) { + case 0: + rv = AddOidToSequence(os, SEC_OID_EXT_KEY_USAGE_SERVER_AUTH); + break; + case 1: + rv = AddOidToSequence(os, SEC_OID_EXT_KEY_USAGE_CLIENT_AUTH); + break; + case 2: + rv = AddOidToSequence(os, SEC_OID_EXT_KEY_USAGE_CODE_SIGN); + break; + case 3: + rv = AddOidToSequence(os, SEC_OID_EXT_KEY_USAGE_EMAIL_PROTECT); + break; + case 4: + rv = AddOidToSequence(os, SEC_OID_EXT_KEY_USAGE_TIME_STAMP); + break; + case 5: + rv = AddOidToSequence(os, SEC_OID_OCSP_RESPONDER); + break; + case 6: + rv = AddOidToSequence(os, SEC_OID_NS_KEY_USAGE_GOVT_APPROVED); + break; + default: + goto endloop; + } + + if (userSuppliedValue && !nextPos) + break; + if( SECSuccess != rv ) + goto loser; + } + +endloop: + item = EncodeOidSequence(os); + + if (!userSuppliedValue) { + isCriticalExt = GetYesNo("Is this a critical extension [y/N]?"); + } + + rv = CERT_AddExtension(extHandle, SEC_OID_X509_EXT_KEY_USAGE, item, + isCriticalExt, PR_TRUE); + /*FALLTHROUGH*/ +loser: + DestroyOidSequence(os); + return rv; +} + +static const char * const +nsCertTypeKeyWordArray[] = { "sslClient", + "sslServer", + "smime", + "objectSigning", + "Not!Used", + "sslCA", + "smimeCA", + "objectSigningCA", + NULL }; + +static SECStatus +AddNscpCertType (void *extHandle, const char *userSuppliedValue) +{ + SECItem bitStringValue; + unsigned char keyUsage = 0x0; + char buffer[5]; + int value; + char *nextPos = (char*)userSuppliedValue; + PRBool isCriticalExt = PR_FALSE; + + if (!userSuppliedValue) { + while (1) { + if (PrintChoicesAndGetAnswer( + "\t\t0 - SSL Client\n" + "\t\t1 - SSL Server\n" + "\t\t2 - S/MIME\n" + "\t\t3 - Object Signing\n" + "\t\t4 - Reserved for future use\n" + "\t\t5 - SSL CA\n" + "\t\t6 - S/MIME CA\n" + "\t\t7 - Object Signing CA\n" + "\t\tOther to finish\n", + buffer, sizeof(buffer)) == SECFailure) { + return SECFailure; + } + value = PORT_Atoi (buffer); + if (value < 0 || value > 7) + break; + if (value == 0) { + /* Checking that zero value of variable 'value' + * corresponds to '0' input made by user */ + char *chPtr = strchr(buffer, '0'); + if (chPtr == NULL) { + continue; + } + } + keyUsage |= (0x80 >> value); + } + isCriticalExt = GetYesNo("Is this a critical extension [y/N]?"); + } else { + while (1) { + if (parseNextCmdInput(nsCertTypeKeyWordArray, &value, &nextPos, + &isCriticalExt) == SECFailure) { + return SECFailure; + } + keyUsage |= (0x80 >> value); + if (!nextPos) + break; + } + } + + bitStringValue.data = &keyUsage; + bitStringValue.len = 1; + + return (CERT_EncodeAndAddBitStrExtension + (extHandle, SEC_OID_NS_CERT_EXT_CERT_TYPE, &bitStringValue, + isCriticalExt)); + +} + +static SECStatus +AddSubjectAltNames(PRArenaPool *arena, CERTGeneralName **existingListp, + const char *names, CERTGeneralNameType type) +{ + CERTGeneralName *nameList = NULL; + CERTGeneralName *current = NULL; + PRCList *prev = NULL; + const char *cp; + char *tbuf; + SECStatus rv = SECSuccess; + + /* + * walk down the comma separated list of names. NOTE: there is + * no sanity checks to see if the email address look like + * email addresses. + */ + for (cp=names; cp; cp = PORT_Strchr(cp,',')) { + int len; + char *end; + + if (*cp == ',') { + cp++; + } + end = PORT_Strchr(cp,','); + len = end ? end-cp : PORT_Strlen(cp); + if (len <= 0) { + continue; + } + tbuf = PORT_ArenaAlloc(arena,len+1); + PORT_Memcpy(tbuf,cp,len); + tbuf[len] = 0; + current = (CERTGeneralName *) PORT_ZAlloc(sizeof(CERTGeneralName)); + if (!current) { + rv = SECFailure; + break; + } + if (prev) { + current->l.prev = prev; + prev->next = &(current->l); + } else { + nameList = current; + } + current->type = type; + current->name.other.data = (unsigned char *)tbuf; + current->name.other.len = PORT_Strlen(tbuf); + prev = &(current->l); + } + /* at this point nameList points to the head of a doubly linked, + * but not yet circular, list and current points to its tail. */ + if (rv == SECSuccess && nameList) { + if (*existingListp != NULL) { + PRCList *existingprev; + /* add nameList to the end of the existing list */ + existingprev = (*existingListp)->l.prev; + (*existingListp)->l.prev = &(current->l); + nameList->l.prev = existingprev; + existingprev->next = &(nameList->l); + current->l.next = &((*existingListp)->l); + } + else { + /* make nameList circular and set it as the new existingList */ + nameList->l.prev = prev; + current->l.next = &(nameList->l); + *existingListp = nameList; + } + } + return rv; +} + +static SECStatus +AddEmailSubjectAlt(PRArenaPool *arena, CERTGeneralName **existingListp, + const char *emailAddrs) +{ + return AddSubjectAltNames(arena, existingListp, emailAddrs, + certRFC822Name); +} + +static SECStatus +AddDNSSubjectAlt(PRArenaPool *arena, CERTGeneralName **existingListp, + const char *dnsNames) +{ + return AddSubjectAltNames(arena, existingListp, dnsNames, certDNSName); +} + + +static SECStatus +AddBasicConstraint(void *extHandle) +{ + CERTBasicConstraints basicConstraint; + SECStatus rv; + char buffer[10]; + PRBool yesNoAns; + + do { + basicConstraint.pathLenConstraint = CERT_UNLIMITED_PATH_CONSTRAINT; + basicConstraint.isCA = GetYesNo ("Is this a CA certificate [y/N]?"); + + buffer[0] = '\0'; + if (PrintChoicesAndGetAnswer("Enter the path length constraint, " + "enter to skip [<0 for unlimited path]:", + buffer, sizeof(buffer)) == SECFailure) { + GEN_BREAK(SECFailure); + } + if (PORT_Strlen (buffer) > 0) + basicConstraint.pathLenConstraint = PORT_Atoi (buffer); + + yesNoAns = GetYesNo ("Is this a critical extension [y/N]?"); + + rv = SECU_EncodeAndAddExtensionValue(NULL, extHandle, + &basicConstraint, yesNoAns, SEC_OID_X509_BASIC_CONSTRAINTS, + (EXTEN_EXT_VALUE_ENCODER)CERT_EncodeBasicConstraintValue); + } while (0); + + return (rv); +} + +static SECStatus +AddAuthKeyID (void *extHandle) +{ + CERTAuthKeyID *authKeyID = NULL; + PRArenaPool *arena = NULL; + SECStatus rv = SECSuccess; + PRBool yesNoAns; + + do { + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if ( !arena ) { + SECU_PrintError(progName, "out of memory"); + GEN_BREAK (SECFailure); + } + + if (GetYesNo ("Enter value for the authKeyID extension [y/N]?") == 0) + break; + + authKeyID = PORT_ArenaZNew(arena, CERTAuthKeyID); + if (authKeyID == NULL) { + GEN_BREAK (SECFailure); + } + + rv = GetString (arena, "Enter value for the key identifier fields," + "enter to omit:", &authKeyID->keyID); + if (rv != SECSuccess) + break; + + SECU_SECItemHexStringToBinary(&authKeyID->keyID); + + authKeyID->authCertIssuer = GetGeneralName (arena); + if (authKeyID->authCertIssuer == NULL && + SECFailure == PORT_GetError ()) + break; + + + rv = GetString (arena, "Enter value for the authCertSerial field, " + "enter to omit:", &authKeyID->authCertSerialNumber); + + yesNoAns = GetYesNo ("Is this a critical extension [y/N]?"); + + rv = SECU_EncodeAndAddExtensionValue(arena, extHandle, + authKeyID, yesNoAns, SEC_OID_X509_AUTH_KEY_ID, + (EXTEN_EXT_VALUE_ENCODER) CERT_EncodeAuthKeyID); + if (rv) + break; + + } while (0); + if (arena) + PORT_FreeArena (arena, PR_FALSE); + return (rv); +} + +static SECStatus +AddSubjKeyID (void *extHandle) +{ + SECItem keyID; + PRArenaPool *arena = NULL; + SECStatus rv = SECSuccess; + PRBool yesNoAns; + + do { + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if ( !arena ) { + SECU_PrintError(progName, "out of memory"); + GEN_BREAK (SECFailure); + } + printf("Adding Subject Key ID extension.\n"); + + rv = GetString (arena, "Enter value for the key identifier fields," + "enter to omit:", &keyID); + if (rv != SECSuccess) + break; + + SECU_SECItemHexStringToBinary(&keyID); + + yesNoAns = GetYesNo ("Is this a critical extension [y/N]?"); + + rv = SECU_EncodeAndAddExtensionValue(arena, extHandle, + &keyID, yesNoAns, SEC_OID_X509_SUBJECT_KEY_ID, + (EXTEN_EXT_VALUE_ENCODER) CERT_EncodeSubjectKeyID); + if (rv) + break; + + } while (0); + if (arena) + PORT_FreeArena (arena, PR_FALSE); + return (rv); +} + +static SECStatus +AddCrlDistPoint(void *extHandle) +{ + PRArenaPool *arena = NULL; + CERTCrlDistributionPoints *crlDistPoints = NULL; + CRLDistributionPoint *current; + SECStatus rv = SECSuccess; + int count = 0, intValue; + char buffer[512]; + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if ( !arena ) + return (SECFailure); + + do { + current = NULL; + + current = PORT_ArenaZNew(arena, CRLDistributionPoint); + if (current == NULL) { + GEN_BREAK (SECFailure); + } + + /* Get the distributionPointName fields - this field is optional */ + if (PrintChoicesAndGetAnswer( + "Enter the type of the distribution point name:\n" + "\t1 - Full Name\n\t2 - Relative Name\n\tAny other " + "number to finish\n\t\tChoice: ", + buffer, sizeof(buffer)) == SECFailure) { + GEN_BREAK (SECFailure); + } + intValue = PORT_Atoi (buffer); + switch (intValue) { + case generalName: + current->distPointType = intValue; + current->distPoint.fullName = GetGeneralName (arena); + rv = PORT_GetError(); + break; + + case relativeDistinguishedName: { + CERTName *name; + + current->distPointType = intValue; + puts ("Enter the relative name: "); + fflush (stdout); + if (Gets_s (buffer, sizeof(buffer)) == NULL) { + GEN_BREAK (SECFailure); + } + /* For simplicity, use CERT_AsciiToName to converse from a string + to NAME, but we only interest in the first RDN */ + name = CERT_AsciiToName (buffer); + if (!name) { + GEN_BREAK (SECFailure); + } + rv = CERT_CopyRDN (arena, ¤t->distPoint.relativeName, + name->rdns[0]); + CERT_DestroyName (name); + break; + } + } + if (rv != SECSuccess) + break; + + /* Get the reason flags */ + if (PrintChoicesAndGetAnswer( + "\nSelect one of the following for the reason flags\n" + "\t0 - unused\n\t1 - keyCompromise\n" + "\t2 - caCompromise\n\t3 - affiliationChanged\n" + "\t4 - superseded\n\t5 - cessationOfOperation\n" + "\t6 - certificateHold\n" + "\tAny other number to finish\t\tChoice: ", + buffer, sizeof(buffer)) == SECFailure) { + GEN_BREAK(SECFailure); + } + intValue = PORT_Atoi (buffer); + if (intValue == 0) { + /* Checking that zero value of variable 'value' + * corresponds to '0' input made by user */ + char *chPtr = strchr(buffer, '0'); + if (chPtr == NULL) { + intValue = -1; + } + } + if (intValue >= 0 && intValue <8) { + current->reasons.data = PORT_ArenaAlloc (arena, sizeof(char)); + if (current->reasons.data == NULL) { + GEN_BREAK (SECFailure); + } + *current->reasons.data = (char)(0x80 >> intValue); + current->reasons.len = 1; + } + puts ("Enter value for the CRL Issuer name:\n"); + current->crlIssuer = GetGeneralName (arena); + if (current->crlIssuer == NULL && (rv = PORT_GetError()) == SECFailure) + break; + + if (crlDistPoints == NULL) { + crlDistPoints = PORT_ArenaZNew(arena, CERTCrlDistributionPoints); + if (crlDistPoints == NULL) { + GEN_BREAK (SECFailure); + } + } + + crlDistPoints->distPoints = + PORT_ArenaGrow (arena, crlDistPoints->distPoints, + sizeof (*crlDistPoints->distPoints) * count, + sizeof (*crlDistPoints->distPoints) *(count + 1)); + if (crlDistPoints->distPoints == NULL) { + GEN_BREAK (SECFailure); + } + + crlDistPoints->distPoints[count] = current; + ++count; + if (GetYesNo("Enter another value for the CRLDistributionPoint " + "extension [y/N]?") == 0) { + /* Add null to the end to mark end of data */ + crlDistPoints->distPoints = + PORT_ArenaGrow(arena, crlDistPoints->distPoints, + sizeof (*crlDistPoints->distPoints) * count, + sizeof (*crlDistPoints->distPoints) *(count + 1)); + crlDistPoints->distPoints[count] = NULL; + break; + } + + + } while (1); + + if (rv == SECSuccess) { + PRBool yesNoAns = GetYesNo ("Is this a critical extension [y/N]?"); + + rv = SECU_EncodeAndAddExtensionValue(arena, extHandle, + crlDistPoints, yesNoAns, SEC_OID_X509_CRL_DIST_POINTS, + (EXTEN_EXT_VALUE_ENCODER)CERT_EncodeCRLDistributionPoints); + } + if (arena) + PORT_FreeArena (arena, PR_FALSE); + return (rv); +} + + + +static SECStatus +AddPolicyConstraints(void *extHandle) +{ + CERTCertificatePolicyConstraints *policyConstr; + PRArenaPool *arena = NULL; + SECStatus rv = SECSuccess; + SECItem *item, *dummy; + char buffer[512]; + int value; + PRBool yesNoAns; + PRBool skipExt = PR_TRUE; + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if ( !arena ) { + SECU_PrintError(progName, "out of memory"); + return SECFailure; + } + + policyConstr = PORT_ArenaZNew(arena, CERTCertificatePolicyConstraints); + if (policyConstr == NULL) { + SECU_PrintError(progName, "out of memory"); + goto loser; + } + + if (PrintChoicesAndGetAnswer("for requireExplicitPolicy enter the number " + "of certs in path\nbefore explicit policy is required\n" + "(press Enter to omit)", buffer, sizeof(buffer)) == SECFailure) { + goto loser; + } + + if (PORT_Strlen(buffer)) { + value = PORT_Atoi(buffer); + if (value < 0) { + goto loser; + } + item = &policyConstr->explicitPolicySkipCerts; + dummy = SEC_ASN1EncodeInteger(arena, item, value); + if (!dummy) { + goto loser; + } + skipExt = PR_FALSE; + } + + if (PrintChoicesAndGetAnswer("for inihibitPolicyMapping enter " + "the number of certs in path\n" + "after which policy mapping is not allowed\n" + "(press Enter to omit)", buffer, sizeof(buffer)) == SECFailure) { + goto loser; + } + + if (PORT_Strlen(buffer)) { + value = PORT_Atoi(buffer); + if (value < 0) { + goto loser; + } + item = &policyConstr->inhibitMappingSkipCerts; + dummy = SEC_ASN1EncodeInteger(arena, item, value); + if (!dummy) { + goto loser; + } + skipExt = PR_FALSE; + } + + + if (!skipExt) { + yesNoAns = GetYesNo("Is this a critical extension [y/N]?"); + + rv = SECU_EncodeAndAddExtensionValue(arena, extHandle, policyConstr, + yesNoAns, SEC_OID_X509_POLICY_CONSTRAINTS, + (EXTEN_EXT_VALUE_ENCODER)CERT_EncodePolicyConstraintsExtension); + } else { + fprintf(stdout, "Policy Constraint extensions must contain " + "at least one policy field\n"); + rv = SECFailure; + } + +loser: + if (arena) { + PORT_FreeArena (arena, PR_FALSE); + } + return (rv); +} + + +static SECStatus +AddInhibitAnyPolicy(void *extHandle) +{ + CERTCertificateInhibitAny certInhibitAny; + PRArenaPool *arena = NULL; + SECStatus rv = SECSuccess; + SECItem *item, *dummy; + char buffer[10]; + int value; + PRBool yesNoAns; + + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if ( !arena ) { + SECU_PrintError(progName, "out of memory"); + return SECFailure; + } + + if (PrintChoicesAndGetAnswer("Enter the number of certs in the path " + "permitted to use anyPolicy.\n" + "(press Enter for 0)", + buffer, sizeof(buffer)) == SECFailure) { + goto loser; + } + + item = &certInhibitAny.inhibitAnySkipCerts; + value = PORT_Atoi(buffer); + if (value < 0) { + goto loser; + } + dummy = SEC_ASN1EncodeInteger(arena, item, value); + if (!dummy) { + goto loser; + } + + yesNoAns = GetYesNo("Is this a critical extension [y/N]?"); + + rv = SECU_EncodeAndAddExtensionValue(arena, extHandle, &certInhibitAny, + yesNoAns, SEC_OID_X509_INHIBIT_ANY_POLICY, + (EXTEN_EXT_VALUE_ENCODER)CERT_EncodeInhibitAnyExtension); +loser: + if (arena) { + PORT_FreeArena (arena, PR_FALSE); + } + return (rv); +} + + +static SECStatus +AddPolicyMappings(void *extHandle) +{ + CERTPolicyMap **policyMapArr = NULL; + CERTPolicyMap *current; + PRArenaPool *arena = NULL; + SECStatus rv = SECSuccess; + int count = 0; + char buffer[512]; + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if ( !arena ) { + SECU_PrintError(progName, "out of memory"); + return SECFailure; + } + + do { + if (PrintChoicesAndGetAnswer("Enter an Object Identifier (dotted " + "decimal format) for Issuer Domain Policy", + buffer, sizeof(buffer)) == SECFailure) { + GEN_BREAK (SECFailure); + } + + current = PORT_ArenaZNew(arena, CERTPolicyMap); + if (current == NULL) { + GEN_BREAK(SECFailure); + } + + rv = SEC_StringToOID(arena, ¤t->issuerDomainPolicy, buffer, 0); + if (rv == SECFailure) { + GEN_BREAK(SECFailure); + } + + if (PrintChoicesAndGetAnswer("Enter an Object Identifier for " + "Subject Domain Policy", + buffer, sizeof(buffer)) == SECFailure) { + GEN_BREAK (SECFailure); + } + + rv = SEC_StringToOID(arena, ¤t->subjectDomainPolicy, buffer, 0); + if (rv == SECFailure) { + GEN_BREAK(SECFailure); + } + + if (policyMapArr == NULL) { + policyMapArr = PORT_ArenaZNew(arena, CERTPolicyMap *); + if (policyMapArr == NULL) { + GEN_BREAK (SECFailure); + } + } + + policyMapArr = PORT_ArenaGrow(arena, policyMapArr, + sizeof (current) * count, + sizeof (current) *(count + 1)); + if (policyMapArr == NULL) { + GEN_BREAK (SECFailure); + } + + policyMapArr[count] = current; + ++count; + + if (!GetYesNo("Enter another Policy Mapping [y/N]")) { + /* Add null to the end to mark end of data */ + policyMapArr = PORT_ArenaGrow (arena, policyMapArr, + sizeof (current) * count, + sizeof (current) *(count + 1)); + if (policyMapArr == NULL) { + GEN_BREAK (SECFailure); + } + policyMapArr[count] = NULL; + break; + } + + } while (1); + + if (rv == SECSuccess) { + CERTCertificatePolicyMappings mappings; + PRBool yesNoAns = GetYesNo("Is this a critical extension [y/N]?"); + + mappings.arena = arena; + mappings.policyMaps = policyMapArr; + rv = SECU_EncodeAndAddExtensionValue(arena, extHandle, &mappings, + yesNoAns, SEC_OID_X509_POLICY_MAPPINGS, + (EXTEN_EXT_VALUE_ENCODER)CERT_EncodePolicyMappingExtension); + } + if (arena) + PORT_FreeArena (arena, PR_FALSE); + return (rv); +} + +enum PoliciQualifierEnum { + cpsPointer = 1, + userNotice = 2 +}; + + +static CERTPolicyQualifier ** +RequestPolicyQualifiers(PRArenaPool *arena, SECItem *policyID) +{ + CERTPolicyQualifier **policyQualifArr = NULL; + CERTPolicyQualifier *current; + SECStatus rv = SECSuccess; + int count = 0; + char buffer[512]; + void *mark; + SECOidData *oid = NULL; + int intValue = 0; + int inCount = 0; + + PORT_Assert(arena); + mark = PORT_ArenaMark(arena); + do { + current = PORT_ArenaZNew(arena, CERTPolicyQualifier); + if (current == NULL) { + GEN_BREAK(SECFailure); + } + + /* Get the accessMethod fields */ + SECU_PrintObjectID(stdout, policyID, + "Choose the type of qualifier for policy" , 0); + + if (PrintChoicesAndGetAnswer( + "\t1 - CPS Pointer qualifier\n" + "\t2 - User notice qualifier\n" + "\tAny other number to finish\n" + "\t\tChoice: ", buffer, sizeof(buffer)) == SECFailure) { + GEN_BREAK (SECFailure); + } + intValue = PORT_Atoi(buffer); + switch (intValue) { + case cpsPointer: { + SECItem input; + + oid = SECOID_FindOIDByTag(SEC_OID_PKIX_CPS_POINTER_QUALIFIER); + if (PrintChoicesAndGetAnswer("Enter CPS pointer URI: ", + buffer, sizeof(buffer)) == SECFailure) { + GEN_BREAK (SECFailure); + } + input.len = PORT_Strlen(buffer); + input.data = (void*)PORT_ArenaStrdup(arena, buffer); + if (input.data == NULL || + SEC_ASN1EncodeItem(arena, ¤t->qualifierValue, &input, + SEC_ASN1_GET(SEC_IA5StringTemplate)) == NULL) { + GEN_BREAK (SECFailure); + } + break; + } + case userNotice: { + SECItem **noticeNumArr; + CERTUserNotice *notice = PORT_ArenaZNew(arena, CERTUserNotice); + if (!notice) { + GEN_BREAK(SECFailure); + } + + oid = SECOID_FindOIDByTag(SEC_OID_PKIX_USER_NOTICE_QUALIFIER); + + if (GetYesNo("\t add a User Notice reference? [y/N]")) { + + if (PrintChoicesAndGetAnswer("Enter user organization string: ", + buffer, sizeof(buffer)) == SECFailure) { + GEN_BREAK (SECFailure); + } + + notice->noticeReference.organization.type = siAsciiString; + notice->noticeReference.organization.len = + PORT_Strlen(buffer); + notice->noticeReference.organization.data = + (void*)PORT_ArenaStrdup(arena, buffer); + + + noticeNumArr = PORT_ArenaZNewArray(arena, SECItem *, 2); + if (!noticeNumArr) { + GEN_BREAK (SECFailure); + } + + do { + SECItem *noticeNum; + + noticeNum = PORT_ArenaZNew(arena, SECItem); + + if (PrintChoicesAndGetAnswer( + "Enter User Notice reference number " + "(or -1 to quit): ", + buffer, sizeof(buffer)) == SECFailure) { + GEN_BREAK (SECFailure); + } + + intValue = PORT_Atoi(buffer); + if (noticeNum == NULL) { + if (intValue < 0) { + fprintf(stdout, "a noticeReference must have at " + "least one reference number\n"); + GEN_BREAK (SECFailure); + } + } else { + if (intValue >= 0) { + noticeNumArr = PORT_ArenaGrow(arena, noticeNumArr, + sizeof (current) * inCount, + sizeof (current) *(inCount + 1)); + if (noticeNumArr == NULL) { + GEN_BREAK (SECFailure); + } + } else { + break; + } + } + if (!SEC_ASN1EncodeInteger(arena, noticeNum, intValue)) { + GEN_BREAK (SECFailure); + } + noticeNumArr[inCount++] = noticeNum; + noticeNumArr[inCount] = NULL; + + } while (1); + if (rv == SECFailure) { + GEN_BREAK(SECFailure); + } + notice->noticeReference.noticeNumbers = noticeNumArr; + rv = CERT_EncodeNoticeReference(arena, ¬ice->noticeReference, + ¬ice->derNoticeReference); + if (rv == SECFailure) { + GEN_BREAK(SECFailure); + } + } + if (GetYesNo("\t EnterUser Notice explicit text? [y/N]")) { + /* Getting only 200 bytes - RFC limitation */ + if (PrintChoicesAndGetAnswer( + "\t", buffer, 200) == SECFailure) { + GEN_BREAK (SECFailure); + } + notice->displayText.type = siAsciiString; + notice->displayText.len = PORT_Strlen(buffer); + notice->displayText.data = + (void*)PORT_ArenaStrdup(arena, buffer); + if (notice->displayText.data == NULL) { + GEN_BREAK(SECFailure); + } + } + + rv = CERT_EncodeUserNotice(arena, notice, ¤t->qualifierValue); + if (rv == SECFailure) { + GEN_BREAK(SECFailure); + } + + break; + } + } + if (rv == SECFailure || oid == NULL || + SECITEM_CopyItem(arena, ¤t->qualifierID, &oid->oid) + == SECFailure) { + GEN_BREAK (SECFailure); + } + + if (!policyQualifArr) { + policyQualifArr = PORT_ArenaZNew(arena, CERTPolicyQualifier *); + } else { + policyQualifArr = PORT_ArenaGrow (arena, policyQualifArr, + sizeof (current) * count, + sizeof (current) *(count + 1)); + } + if (policyQualifArr == NULL) { + GEN_BREAK (SECFailure); + } + + policyQualifArr[count] = current; + ++count; + + if (!GetYesNo ("Enter another policy qualifier [y/N]")) { + /* Add null to the end to mark end of data */ + policyQualifArr = PORT_ArenaGrow(arena, policyQualifArr, + sizeof (current) * count, + sizeof (current) *(count + 1)); + if (policyQualifArr == NULL) { + GEN_BREAK (SECFailure); + } + policyQualifArr[count] = NULL; + break; + } + + } while (1); + + if (rv != SECSuccess) { + PORT_ArenaRelease (arena, mark); + policyQualifArr = NULL; + } + return (policyQualifArr); +} + +static SECStatus +AddCertPolicies(void *extHandle) +{ + CERTPolicyInfo **certPoliciesArr = NULL; + CERTPolicyInfo *current; + PRArenaPool *arena = NULL; + SECStatus rv = SECSuccess; + int count = 0; + char buffer[512]; + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if ( !arena ) { + SECU_PrintError(progName, "out of memory"); + return SECFailure; + } + + do { + current = PORT_ArenaZNew(arena, CERTPolicyInfo); + if (current == NULL) { + GEN_BREAK(SECFailure); + } + + if (PrintChoicesAndGetAnswer("Enter a CertPolicy Object Identifier " + "(dotted decimal format)\n" + "or \"any\" for AnyPolicy:", + buffer, sizeof(buffer)) == SECFailure) { + GEN_BREAK (SECFailure); + } + + if (strncmp(buffer, "any", 3) == 0) { + /* use string version of X509_CERTIFICATE_POLICIES.anyPolicy */ + strcpy(buffer, "OID.2.5.29.32.0"); + } + rv = SEC_StringToOID(arena, ¤t->policyID, buffer, 0); + + if (rv == SECFailure) { + GEN_BREAK(SECFailure); + } + + current->policyQualifiers = + RequestPolicyQualifiers(arena, ¤t->policyID); + + if (!certPoliciesArr) { + certPoliciesArr = PORT_ArenaZNew(arena, CERTPolicyInfo *); + } else { + certPoliciesArr = PORT_ArenaGrow(arena, certPoliciesArr, + sizeof (current) * count, + sizeof (current) *(count + 1)); + } + if (certPoliciesArr == NULL) { + GEN_BREAK (SECFailure); + } + + certPoliciesArr[count] = current; + ++count; + + if (!GetYesNo ("Enter another PolicyInformation field [y/N]?")) { + /* Add null to the end to mark end of data */ + certPoliciesArr = PORT_ArenaGrow(arena, certPoliciesArr, + sizeof (current) * count, + sizeof (current) *(count + 1)); + if (certPoliciesArr == NULL) { + GEN_BREAK (SECFailure); + } + certPoliciesArr[count] = NULL; + break; + } + + } while (1); + + if (rv == SECSuccess) { + CERTCertificatePolicies policies; + PRBool yesNoAns = GetYesNo("Is this a critical extension [y/N]?"); + + policies.arena = arena; + policies.policyInfos = certPoliciesArr; + + rv = SECU_EncodeAndAddExtensionValue(arena, extHandle, &policies, + yesNoAns, SEC_OID_X509_CERTIFICATE_POLICIES, + (EXTEN_EXT_VALUE_ENCODER)CERT_EncodeCertPoliciesExtension); + } + if (arena) + PORT_FreeArena(arena, PR_FALSE); + return (rv); +} + +enum AuthInfoAccessTypesEnum { + caIssuers = 1, + ocsp = 2 +}; + +enum SubjInfoAccessTypesEnum { + caRepository = 1, + timeStamping = 2 +}; + +/* Encode and add an AIA or SIA extension */ +static SECStatus +AddInfoAccess(void *extHandle, PRBool addSIAExt, PRBool isCACert) +{ + CERTAuthInfoAccess **infoAccArr = NULL; + CERTAuthInfoAccess *current; + PRArenaPool *arena = NULL; + SECStatus rv = SECSuccess; + int count = 0; + char buffer[512]; + SECOidData *oid = NULL; + int intValue = 0; + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if ( !arena ) { + SECU_PrintError(progName, "out of memory"); + return SECFailure; + } + + do { + current = NULL; + current = PORT_ArenaZNew(arena, CERTAuthInfoAccess); + if (current == NULL) { + GEN_BREAK(SECFailure); + } + + /* Get the accessMethod fields */ + if (addSIAExt) { + if (isCACert) { + puts("Adding \"CA Repository\" access method type for " + "Subject Information Access extension:\n"); + intValue = caRepository; + } else { + puts("Adding \"Time Stamping Services\" access method type for " + "Subject Information Access extension:\n"); + intValue = timeStamping; + } + } else { + PrintChoicesAndGetAnswer("Enter access method type " + "for Authority Information Access extension:\n" + "\t1 - CA Issuers\n\t2 - OCSP\n\tAny" + "other number to finish\n\tChoice", + buffer, sizeof(buffer)); + intValue = PORT_Atoi(buffer); + } + if (addSIAExt) { + switch (intValue) { + case caRepository: + oid = SECOID_FindOIDByTag(SEC_OID_PKIX_CA_REPOSITORY); + break; + + case timeStamping: + oid = SECOID_FindOIDByTag(SEC_OID_PKIX_TIMESTAMPING); + break; + } + } else { + switch (intValue) { + case caIssuers: + oid = SECOID_FindOIDByTag(SEC_OID_PKIX_CA_ISSUERS); + break; + + case ocsp: + oid = SECOID_FindOIDByTag(SEC_OID_PKIX_OCSP); + break; + } + } + if (oid == NULL || + SECITEM_CopyItem(arena, ¤t->method, &oid->oid) + == SECFailure) { + GEN_BREAK (SECFailure); + } + + current->location = GetGeneralName(arena); + if (!current->location) { + GEN_BREAK(SECFailure); + } + + if (infoAccArr == NULL) { + infoAccArr = PORT_ArenaZNew(arena, CERTAuthInfoAccess *); + } else { + infoAccArr = PORT_ArenaGrow(arena, infoAccArr, + sizeof (current) * count, + sizeof (current) *(count + 1)); + } + if (infoAccArr == NULL) { + GEN_BREAK (SECFailure); + } + + infoAccArr[count] = current; + ++count; + + PR_snprintf(buffer, sizeof(buffer), "Add another location to the %s" + " Information Access extension [y/N]", + (addSIAExt) ? "Subject" : "Authority"); + + if (GetYesNo (buffer) == 0) { + /* Add null to the end to mark end of data */ + infoAccArr = PORT_ArenaGrow(arena, infoAccArr, + sizeof (current) * count, + sizeof (current) *(count + 1)); + if (infoAccArr == NULL) { + GEN_BREAK (SECFailure); + } + infoAccArr[count] = NULL; + break; + } + + } while (1); + + if (rv == SECSuccess) { + int oidIdent = SEC_OID_X509_AUTH_INFO_ACCESS; + + PRBool yesNoAns = GetYesNo("Is this a critical extension [y/N]?"); + + if (addSIAExt) { + oidIdent = SEC_OID_X509_SUBJECT_INFO_ACCESS; + } + rv = SECU_EncodeAndAddExtensionValue(arena, extHandle, infoAccArr, + yesNoAns, oidIdent, + (EXTEN_EXT_VALUE_ENCODER)CERT_EncodeInfoAccessExtension); + } + if (arena) + PORT_FreeArena(arena, PR_FALSE); + return (rv); +} + +SECStatus +AddExtensions(void *extHandle, const char *emailAddrs, const char *dnsNames, + certutilExtnList extList) +{ + SECStatus rv = SECSuccess; + char *errstring = NULL; + + do { + /* Add key usage extension */ + if (extList[ext_keyUsage].activated) { + rv = AddKeyUsage(extHandle, extList[ext_keyUsage].arg); + if (rv) { + errstring = "KeyUsage"; + break; + } + } + + /* Add extended key usage extension */ + if (extList[ext_extKeyUsage].activated) { + rv = AddExtKeyUsage(extHandle, extList[ext_extKeyUsage].arg); + if (rv) { + errstring = "ExtendedKeyUsage"; + break; + } + } + + /* Add basic constraint extension */ + if (extList[ext_basicConstraint].activated) { + rv = AddBasicConstraint(extHandle); + if (rv) { + errstring = "BasicConstraint"; + break; + } + } + + if (extList[ext_authorityKeyID].activated) { + rv = AddAuthKeyID(extHandle); + if (rv) { + errstring = "AuthorityKeyID"; + break; + } + } + + if (extList[ext_subjectKeyID].activated) { + rv = AddSubjKeyID(extHandle); + if (rv) { + errstring = "SubjectKeyID"; + break; + } + } + + if (extList[ext_CRLDistPts].activated) { + rv = AddCrlDistPoint(extHandle); + if (rv) { + errstring = "CRLDistPoints"; + break; + } + } + + if (extList[ext_NSCertType].activated) { + rv = AddNscpCertType(extHandle, extList[ext_NSCertType].arg); + if (rv) { + errstring = "NSCertType"; + break; + } + } + + if (extList[ext_authInfoAcc].activated || + extList[ext_subjInfoAcc].activated) { + rv = AddInfoAccess(extHandle, extList[ext_subjInfoAcc].activated, + extList[ext_basicConstraint].activated); + if (rv) { + errstring = "InformationAccess"; + break; + } + } + + if (extList[ext_certPolicies].activated) { + rv = AddCertPolicies(extHandle); + if (rv) { + errstring = "Policies"; + break; + } + } + + if (extList[ext_policyMappings].activated) { + rv = AddPolicyMappings(extHandle); + if (rv) { + errstring = "PolicyMappings"; + break; + } + } + + if (extList[ext_policyConstr].activated) { + rv = AddPolicyConstraints(extHandle); + if (rv) { + errstring = "PolicyConstraints"; + break; + } + } + + if (extList[ext_inhibitAnyPolicy].activated) { + rv = AddInhibitAnyPolicy(extHandle); + if (rv) { + errstring = "InhibitAnyPolicy"; + break; + } + } + + if (emailAddrs || dnsNames) { + PRArenaPool *arena; + CERTGeneralName *namelist = NULL; + SECItem item = { 0, NULL, 0 }; + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if (arena == NULL) { + rv = SECFailure; + break; + } + + rv = AddEmailSubjectAlt(arena, &namelist, emailAddrs); + + rv |= AddDNSSubjectAlt(arena, &namelist, dnsNames); + + if (rv == SECSuccess) { + rv = CERT_EncodeAltNameExtension(arena, namelist, &item); + if (rv == SECSuccess) { + rv = CERT_AddExtension(extHandle, + SEC_OID_X509_SUBJECT_ALT_NAME, + &item, PR_FALSE, PR_TRUE); + } + } + PORT_FreeArena(arena, PR_FALSE); + if (rv) { + errstring = "SubjectAltName"; + break; + } + } + } while (0); + + if (rv != SECSuccess) { + SECU_PrintError(progName, "Problem creating %s extension", errstring); + } + return rv; +} diff --git a/mozilla/security/nss/cmd/certutil/certutil.c b/mozilla/security/nss/cmd/certutil/certutil.c new file mode 100644 index 0000000..4593578 --- /dev/null +++ b/mozilla/security/nss/cmd/certutil/certutil.c @@ -0,0 +1,3102 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Dr Vipul Gupta , Sun Microsystems Laboratories + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* +** certutil.c +** +** utility for managing certificates and the cert database +** +*/ +#include +#include +#include + +#if defined(WIN32) +#include "fcntl.h" +#include "io.h" +#endif + +#include "secutil.h" + +#if defined(XP_UNIX) +#include +#endif + +#include "nspr.h" +#include "prtypes.h" +#include "prtime.h" +#include "prlong.h" + +#include "pk11func.h" +#include "secasn1.h" +#include "cert.h" +#include "cryptohi.h" +#include "secoid.h" +#include "certdb.h" +#include "nss.h" +#include "certutil.h" + +#define MIN_KEY_BITS 512 +/* MAX_KEY_BITS should agree with MAX_RSA_MODULUS in freebl */ +#define MAX_KEY_BITS 8192 +#define DEFAULT_KEY_BITS 1024 + +#define GEN_BREAK(e) rv=e; break; + +char *progName; + +static CERTCertificateRequest * +GetCertRequest(PRFileDesc *inFile, PRBool ascii) +{ + CERTCertificateRequest *certReq = NULL; + CERTSignedData signedData; + PRArenaPool *arena = NULL; + SECItem reqDER; + SECStatus rv; + + reqDER.data = NULL; + do { + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if (arena == NULL) { + GEN_BREAK (SECFailure); + } + + rv = SECU_ReadDERFromFile(&reqDER, inFile, ascii); + if (rv) { + break; + } + certReq = (CERTCertificateRequest*) PORT_ArenaZAlloc + (arena, sizeof(CERTCertificateRequest)); + if (!certReq) { + GEN_BREAK(SECFailure); + } + certReq->arena = arena; + + /* Since cert request is a signed data, must decode to get the inner + data + */ + PORT_Memset(&signedData, 0, sizeof(signedData)); + rv = SEC_ASN1DecodeItem(arena, &signedData, + SEC_ASN1_GET(CERT_SignedDataTemplate), &reqDER); + if (rv) { + break; + } + rv = SEC_ASN1DecodeItem(arena, certReq, + SEC_ASN1_GET(CERT_CertificateRequestTemplate), &signedData.data); + if (rv) { + break; + } + rv = CERT_VerifySignedDataWithPublicKeyInfo(&signedData, + &certReq->subjectPublicKeyInfo, NULL /* wincx */); + } while (0); + + if (reqDER.data) { + SECITEM_FreeItem(&reqDER, PR_FALSE); + } + + if (rv) { + SECU_PrintError(progName, "bad certificate request\n"); + if (arena) { + PORT_FreeArena(arena, PR_FALSE); + } + certReq = NULL; + } + + return certReq; +} + +static SECStatus +AddCert(PK11SlotInfo *slot, CERTCertDBHandle *handle, char *name, char *trusts, + PRFileDesc *inFile, PRBool ascii, PRBool emailcert, void *pwdata) +{ + CERTCertTrust *trust = NULL; + CERTCertificate *cert = NULL; + SECItem certDER; + SECStatus rv; + + certDER.data = NULL; + do { + /* Read in the entire file specified with the -i argument */ + rv = SECU_ReadDERFromFile(&certDER, inFile, ascii); + if (rv != SECSuccess) { + SECU_PrintError(progName, "unable to read input file"); + break; + } + + /* Read in an ASCII cert and return a CERTCertificate */ + cert = CERT_DecodeCertFromPackage((char *)certDER.data, certDER.len); + if (!cert) { + SECU_PrintError(progName, "could not obtain certificate from file"); + GEN_BREAK(SECFailure); + } + + /* Create a cert trust */ + trust = (CERTCertTrust *)PORT_ZAlloc(sizeof(CERTCertTrust)); + if (!trust) { + SECU_PrintError(progName, "unable to allocate cert trust"); + GEN_BREAK(SECFailure); + } + + rv = CERT_DecodeTrustString(trust, trusts); + if (rv) { + SECU_PrintError(progName, "unable to decode trust string"); + GEN_BREAK(SECFailure); + } + + rv = PK11_ImportCert(slot, cert, CK_INVALID_HANDLE, name, PR_FALSE); + if (rv != SECSuccess) { + /* sigh, PK11_Import Cert and CERT_ChangeCertTrust should have + * been coded to take a password arg. */ + if (PORT_GetError() == SEC_ERROR_TOKEN_NOT_LOGGED_IN) { + rv = PK11_Authenticate(slot, PR_TRUE, pwdata); + if (rv != SECSuccess) { + SECU_PrintError(progName, + "could not authenticate to token %s.", + PK11_GetTokenName(slot)); + GEN_BREAK(SECFailure); + } + rv = PK11_ImportCert(slot, cert, CK_INVALID_HANDLE, + name, PR_FALSE); + } + if (rv != SECSuccess) { + SECU_PrintError(progName, + "could not add certificate to token or database"); + GEN_BREAK(SECFailure); + } + } + + rv = CERT_ChangeCertTrust(handle, cert, trust); + if (rv != SECSuccess) { + if (PORT_GetError() == SEC_ERROR_TOKEN_NOT_LOGGED_IN) { + rv = PK11_Authenticate(slot, PR_TRUE, pwdata); + if (rv != SECSuccess) { + SECU_PrintError(progName, + "could not authenticate to token %s.", + PK11_GetTokenName(slot)); + GEN_BREAK(SECFailure); + } + rv = CERT_ChangeCertTrust(handle, cert, trust); + } + if (rv != SECSuccess) { + SECU_PrintError(progName, + "could not change trust on certificate"); + GEN_BREAK(SECFailure); + } + } + + if ( emailcert ) { + CERT_SaveSMimeProfile(cert, NULL, pwdata); + } + + } while (0); + + CERT_DestroyCertificate (cert); + PORT_Free(trust); + PORT_Free(certDER.data); + + return rv; +} + +static SECStatus +CertReq(SECKEYPrivateKey *privk, SECKEYPublicKey *pubk, KeyType keyType, + SECOidTag hashAlgTag, CERTName *subject, char *phone, int ascii, + const char *emailAddrs, const char *dnsNames, + certutilExtnList extnList, + PRFileDesc *outFile) +{ + CERTSubjectPublicKeyInfo *spki; + CERTCertificateRequest *cr; + SECItem *encoding; + SECOidTag signAlgTag; + SECItem result; + SECStatus rv; + PRArenaPool *arena; + PRInt32 numBytes; + void *extHandle; + + /* Create info about public key */ + spki = SECKEY_CreateSubjectPublicKeyInfo(pubk); + if (!spki) { + SECU_PrintError(progName, "unable to create subject public key"); + return SECFailure; + } + + /* Generate certificate request */ + cr = CERT_CreateCertificateRequest(subject, spki, NULL); + SECKEY_DestroySubjectPublicKeyInfo(spki); + if (!cr) { + SECU_PrintError(progName, "unable to make certificate request"); + return SECFailure; + } + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if ( !arena ) { + SECU_PrintError(progName, "out of memory"); + return SECFailure; + } + + extHandle = CERT_StartCertificateRequestAttributes(cr); + if (extHandle == NULL) { + PORT_FreeArena (arena, PR_FALSE); + return SECFailure; + } + if (AddExtensions(extHandle, emailAddrs, dnsNames, extnList) + != SECSuccess) { + PORT_FreeArena (arena, PR_FALSE); + return SECFailure; + } + CERT_FinishExtensions(extHandle); + CERT_FinishCertificateRequestAttributes(cr); + + /* Der encode the request */ + encoding = SEC_ASN1EncodeItem(arena, NULL, cr, + SEC_ASN1_GET(CERT_CertificateRequestTemplate)); + CERT_DestroyCertificateRequest(cr); + if (encoding == NULL) { + PORT_FreeArena (arena, PR_FALSE); + SECU_PrintError(progName, "der encoding of request failed"); + return SECFailure; + } + + /* Sign the request */ + signAlgTag = SEC_GetSignatureAlgorithmOidTag(keyType, hashAlgTag); + if (signAlgTag == SEC_OID_UNKNOWN) { + PORT_FreeArena (arena, PR_FALSE); + SECU_PrintError(progName, "unknown Key or Hash type"); + return SECFailure; + } + rv = SEC_DerSignData(arena, &result, encoding->data, encoding->len, + privk, signAlgTag); + if (rv) { + PORT_FreeArena (arena, PR_FALSE); + SECU_PrintError(progName, "signing of data failed"); + return SECFailure; + } + + /* Encode request in specified format */ + if (ascii) { + char *obuf; + char *name, *email, *org, *state, *country; + SECItem *it; + int total; + + it = &result; + + obuf = BTOA_ConvertItemToAscii(it); + total = PL_strlen(obuf); + + name = CERT_GetCommonName(subject); + if (!name) { + name = PORT_Strdup("(not specified)"); + } + + if (!phone) + phone = strdup("(not specified)"); + + email = CERT_GetCertEmailAddress(subject); + if (!email) + email = PORT_Strdup("(not specified)"); + + org = CERT_GetOrgName(subject); + if (!org) + org = PORT_Strdup("(not specified)"); + + state = CERT_GetStateName(subject); + if (!state) + state = PORT_Strdup("(not specified)"); + + country = CERT_GetCountryName(subject); + if (!country) + country = PORT_Strdup("(not specified)"); + + PR_fprintf(outFile, + "\nCertificate request generated by Netscape certutil\n"); + PR_fprintf(outFile, "Phone: %s\n\n", phone); + PR_fprintf(outFile, "Common Name: %s\n", name); + PR_fprintf(outFile, "Email: %s\n", email); + PR_fprintf(outFile, "Organization: %s\n", org); + PR_fprintf(outFile, "State: %s\n", state); + PR_fprintf(outFile, "Country: %s\n\n", country); + + PORT_Free(name); + PORT_Free(email); + PORT_Free(org); + PORT_Free(state); + PORT_Free(country); + + PR_fprintf(outFile, "%s\n", NS_CERTREQ_HEADER); + numBytes = PR_Write(outFile, obuf, total); + PORT_Free(obuf); + if (numBytes != total) { + PORT_FreeArena (arena, PR_FALSE); + SECU_PrintError(progName, "write error"); + return SECFailure; + } + PR_fprintf(outFile, "\n%s\n", NS_CERTREQ_TRAILER); + } else { + numBytes = PR_Write(outFile, result.data, result.len); + if (numBytes != (int)result.len) { + PORT_FreeArena (arena, PR_FALSE); + SECU_PrintSystemError(progName, "write error"); + return SECFailure; + } + } + PORT_FreeArena (arena, PR_FALSE); + return SECSuccess; +} + +static SECStatus +ChangeTrustAttributes(CERTCertDBHandle *handle, PK11SlotInfo *slot, + char *name, char *trusts, void *pwdata) +{ + SECStatus rv; + CERTCertificate *cert; + CERTCertTrust *trust; + + cert = CERT_FindCertByNicknameOrEmailAddr(handle, name); + if (!cert) { + SECU_PrintError(progName, "could not find certificate named \"%s\"", + name); + return SECFailure; + } + + trust = (CERTCertTrust *)PORT_ZAlloc(sizeof(CERTCertTrust)); + if (!trust) { + SECU_PrintError(progName, "unable to allocate cert trust"); + return SECFailure; + } + + /* This function only decodes these characters: pPwcTCu, */ + rv = CERT_DecodeTrustString(trust, trusts); + if (rv) { + SECU_PrintError(progName, "unable to decode trust string"); + return SECFailure; + } + + /* CERT_ChangeCertTrust API does not have a way to pass in + * a context, so NSS can't prompt for the password if it needs to. + * check to see if the failure was token not logged in and + * log in if need be. */ + rv = CERT_ChangeCertTrust(handle, cert, trust); + if (rv != SECSuccess) { + if (PORT_GetError() == SEC_ERROR_TOKEN_NOT_LOGGED_IN) { + rv = PK11_Authenticate(slot, PR_TRUE, pwdata); + if (rv != SECSuccess) { + SECU_PrintError(progName, "could not authenticate to token %s.", + PK11_GetTokenName(slot)); + return SECFailure; + } + rv = CERT_ChangeCertTrust(handle, cert, trust); + } + if (rv != SECSuccess) { + SECU_PrintError(progName, "unable to modify trust attributes"); + return SECFailure; + } + } + CERT_DestroyCertificate(cert); + + return SECSuccess; +} + +static SECStatus +DumpChain(CERTCertDBHandle *handle, char *name, PRBool ascii) +{ + CERTCertificate *the_cert; + CERTCertificateList *chain; + int i, j; + the_cert = SECU_FindCertByNicknameOrFilename(handle, name, + ascii, NULL); + if (!the_cert) { + SECU_PrintError(progName, "Could not find: %s\n", name); + return SECFailure; + } + chain = CERT_CertChainFromCert(the_cert, 0, PR_TRUE); + CERT_DestroyCertificate(the_cert); + if (!chain) { + SECU_PrintError(progName, "Could not obtain chain for: %s\n", name); + return SECFailure; + } + for (i=chain->len-1; i>=0; i--) { + CERTCertificate *c; + c = CERT_FindCertByDERCert(handle, &chain->certs[i]); + for (j=i; jlen-1; j++) printf(" "); + printf("\"%s\" [%s]\n\n", c->nickname, c->subjectName); + CERT_DestroyCertificate(c); + } + CERT_DestroyCertificateList(chain); + return SECSuccess; +} + +static SECStatus +listCerts(CERTCertDBHandle *handle, char *name, char *email, PK11SlotInfo *slot, + PRBool raw, PRBool ascii, PRFileDesc *outfile, void *pwarg) +{ + SECItem data; + PRInt32 numBytes; + SECStatus rv = SECFailure; + CERTCertList *certs; + CERTCertListNode *node; + + /* List certs on a non-internal slot. */ + if (!PK11_IsFriendly(slot) && PK11_NeedLogin(slot)) { + SECStatus newrv = PK11_Authenticate(slot, PR_TRUE, pwarg); + if (newrv != SECSuccess) { + SECU_PrintError(progName, "could not authenticate to token %s.", + PK11_GetTokenName(slot)); + return SECFailure; + } + } + if (name) { + CERTCertificate *the_cert = + SECU_FindCertByNicknameOrFilename(handle, name, ascii, NULL); + if (!the_cert) { + SECU_PrintError(progName, "Could not find cert: %s\n", name); + return SECFailure; + } + /* Here, we have one cert with the desired nickname or email + * address. Now, we will attempt to get a list of ALL certs + * with the same subject name as the cert we have. That list + * should contain, at a minimum, the one cert we have already found. + * If the list of certs is empty (NULL), the libraries have failed. + */ + certs = CERT_CreateSubjectCertList(NULL, handle, &the_cert->derSubject, + PR_Now(), PR_FALSE); + CERT_DestroyCertificate(the_cert); + if (!certs) { + PORT_SetError(SEC_ERROR_LIBRARY_FAILURE); + SECU_PrintError(progName, "problem printing certificates"); + return SECFailure; + } + for (node = CERT_LIST_HEAD(certs); !CERT_LIST_END(node,certs); + node = CERT_LIST_NEXT(node)) { + the_cert = node->cert; + /* now get the subjectList that matches this cert */ + data.data = the_cert->derCert.data; + data.len = the_cert->derCert.len; + if (ascii) { + PR_fprintf(outfile, "%s\n%s\n%s\n", NS_CERT_HEADER, + BTOA_DataToAscii(data.data, data.len), NS_CERT_TRAILER); + rv = SECSuccess; + } else if (raw) { + numBytes = PR_Write(outfile, data.data, data.len); + if (numBytes != (PRInt32) data.len) { + SECU_PrintSystemError(progName, "error writing raw cert"); + rv = SECFailure; + } + rv = SECSuccess; + } else { + rv = SEC_PrintCertificateAndTrust(the_cert, "Certificate", + the_cert->trust); + if (rv != SECSuccess) { + SECU_PrintError(progName, "problem printing certificate"); + } + + } + if (rv != SECSuccess) { + break; + } + } + } else if (email) { + CERTCertificate *the_cert; + certs = PK11_FindCertsFromEmailAddress(email, NULL); + if (!certs) { + SECU_PrintError(progName, + "Could not find certificates for email address: %s\n", + email); + return SECFailure; + } + for (node = CERT_LIST_HEAD(certs); !CERT_LIST_END(node,certs); + node = CERT_LIST_NEXT(node)) { + the_cert = node->cert; + /* now get the subjectList that matches this cert */ + data.data = the_cert->derCert.data; + data.len = the_cert->derCert.len; + if (ascii) { + PR_fprintf(outfile, "%s\n%s\n%s\n", NS_CERT_HEADER, + BTOA_DataToAscii(data.data, data.len), + NS_CERT_TRAILER); + rv = SECSuccess; + } else if (raw) { + numBytes = PR_Write(outfile, data.data, data.len); + rv = SECSuccess; + if (numBytes != (PRInt32) data.len) { + SECU_PrintSystemError(progName, "error writing raw cert"); + rv = SECFailure; + } + } else { + rv = SEC_PrintCertificateAndTrust(the_cert, "Certificate", + the_cert->trust); + if (rv != SECSuccess) { + SECU_PrintError(progName, "problem printing certificate"); + } + } + if (rv != SECSuccess) { + break; + } + } + } else { + certs = PK11_ListCertsInSlot(slot); + if (certs) { + for (node = CERT_LIST_HEAD(certs); !CERT_LIST_END(node,certs); + node = CERT_LIST_NEXT(node)) { + SECU_PrintCertNickname(node,stdout); + } + rv = SECSuccess; + } + } + if (certs) { + CERT_DestroyCertList(certs); + } + if (rv) { + SECU_PrintError(progName, "problem printing certificate nicknames"); + return SECFailure; + } + + return SECSuccess; /* not rv ?? */ +} + +static SECStatus +ListCerts(CERTCertDBHandle *handle, char *nickname, char *email, + PK11SlotInfo *slot, PRBool raw, PRBool ascii, PRFileDesc *outfile, + secuPWData *pwdata) +{ + SECStatus rv; + + if (!ascii && !raw && !nickname && !email) { + PR_fprintf(outfile, "\n%-60s %-5s\n%-60s %-5s\n\n", + "Certificate Nickname", "Trust Attributes", "", + "SSL,S/MIME,JAR/XPI"); + } + if (slot == NULL) { + CERTCertList *list; + CERTCertListNode *node; + + list = PK11_ListCerts(PK11CertListAll, pwdata); + for (node = CERT_LIST_HEAD(list); !CERT_LIST_END(node, list); + node = CERT_LIST_NEXT(node)) { + SECU_PrintCertNickname(node, stdout); + } + CERT_DestroyCertList(list); + return SECSuccess; + } + rv = listCerts(handle, nickname, email, slot, raw, ascii, outfile, pwdata); + return rv; +} + +static SECStatus +DeleteCert(CERTCertDBHandle *handle, char *name) +{ + SECStatus rv; + CERTCertificate *cert; + + cert = CERT_FindCertByNicknameOrEmailAddr(handle, name); + if (!cert) { + SECU_PrintError(progName, "could not find certificate named \"%s\"", + name); + return SECFailure; + } + + rv = SEC_DeletePermCertificate(cert); + CERT_DestroyCertificate(cert); + if (rv) { + SECU_PrintError(progName, "unable to delete certificate"); + } + return rv; +} + +static SECStatus +ValidateCert(CERTCertDBHandle *handle, char *name, char *date, + char *certUsage, PRBool checkSig, PRBool logit, + PRBool ascii, secuPWData *pwdata) +{ + SECStatus rv; + CERTCertificate *cert = NULL; + int64 timeBoundary; + SECCertificateUsage usage; + CERTVerifyLog reallog; + CERTVerifyLog *log = NULL; + + if (!certUsage) { + PORT_SetError (SEC_ERROR_INVALID_ARGS); + return (SECFailure); + } + + switch (*certUsage) { + case 'O': + usage = certificateUsageStatusResponder; + break; + case 'C': + usage = certificateUsageSSLClient; + break; + case 'V': + usage = certificateUsageSSLServer; + break; + case 'S': + usage = certificateUsageEmailSigner; + break; + case 'R': + usage = certificateUsageEmailRecipient; + break; + case 'J': + usage = certificateUsageObjectSigner; + break; + default: + PORT_SetError (SEC_ERROR_INVALID_ARGS); + return (SECFailure); + } + do { + cert = SECU_FindCertByNicknameOrFilename(handle, name, ascii, + NULL); + if (!cert) { + SECU_PrintError(progName, "could not find certificate named \"%s\"", + name); + GEN_BREAK (SECFailure) + } + + if (date != NULL) { + rv = DER_AsciiToTime(&timeBoundary, date); + if (rv) { + SECU_PrintError(progName, "invalid input date"); + GEN_BREAK (SECFailure) + } + } else { + timeBoundary = PR_Now(); + } + + if ( logit ) { + log = &reallog; + + log->count = 0; + log->head = NULL; + log->tail = NULL; + log->arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if ( log->arena == NULL ) { + SECU_PrintError(progName, "out of memory"); + GEN_BREAK (SECFailure) + } + } + + rv = CERT_VerifyCertificate(handle, cert, checkSig, usage, + timeBoundary, pwdata, log, &usage); + if ( log ) { + if ( log->head == NULL ) { + fprintf(stdout, "%s: certificate is valid\n", progName); + GEN_BREAK (SECSuccess) + } else { + char *name; + CERTVerifyLogNode *node; + + node = log->head; + while ( node ) { + if ( node->cert->nickname != NULL ) { + name = node->cert->nickname; + } else { + name = node->cert->subjectName; + } + fprintf(stderr, "%s : %s\n", name, + SECU_Strerror(node->error)); + CERT_DestroyCertificate(node->cert); + node = node->next; + } + } + } else { + if (rv != SECSuccess) { + PRErrorCode perr = PORT_GetError(); + fprintf(stdout, "%s: certificate is invalid: %s\n", + progName, SECU_Strerror(perr)); + GEN_BREAK (SECFailure) + } + fprintf(stdout, "%s: certificate is valid\n", progName); + GEN_BREAK (SECSuccess) + } + } while (0); + + if (cert) { + CERT_DestroyCertificate(cert); + } + + return (rv); +} + +static PRBool +ItemIsPrintableASCII(const SECItem * item) +{ + unsigned char *src = item->data; + unsigned int len = item->len; + while (len-- > 0) { + unsigned char uc = *src++; + if (uc < 0x20 || uc > 0x7e) + return PR_FALSE; + } + return PR_TRUE; +} + +/* Caller ensures that dst is at least item->len*2+1 bytes long */ +static void +SECItemToHex(const SECItem * item, char * dst) +{ + if (dst && item && item->data) { + unsigned char * src = item->data; + unsigned int len = item->len; + for (; len > 0; --len, dst += 2) { + sprintf(dst, "%02x", *src++); + } + *dst = '\0'; + } +} + +static const char * const keyTypeName[] = { + "null", "rsa", "dsa", "fortezza", "dh", "kea", "ec" }; + +#define MAX_CKA_ID_BIN_LEN 20 +#define MAX_CKA_ID_STR_LEN 40 + +/* print key number, key ID (in hex or ASCII), key label (nickname) */ +static SECStatus +PrintKey(PRFileDesc *out, const char *nickName, int count, + SECKEYPrivateKey *key, void *pwarg) +{ + SECItem * ckaID; + char ckaIDbuf[MAX_CKA_ID_STR_LEN + 4]; + + pwarg = NULL; + ckaID = PK11_GetLowLevelKeyIDForPrivateKey(key); + if (!ckaID) { + strcpy(ckaIDbuf, "(no CKA_ID)"); + } else if (ItemIsPrintableASCII(ckaID)) { + int len = PR_MIN(MAX_CKA_ID_STR_LEN, ckaID->len); + ckaIDbuf[0] = '"'; + memcpy(ckaIDbuf + 1, ckaID->data, len); + ckaIDbuf[1 + len] = '"'; + ckaIDbuf[2 + len] = '\0'; + } else { + /* print ckaid in hex */ + SECItem idItem = *ckaID; + if (idItem.len > MAX_CKA_ID_BIN_LEN) + idItem.len = MAX_CKA_ID_BIN_LEN; + SECItemToHex(&idItem, ckaIDbuf); + } + + PR_fprintf(out, "<%2d> %-8.8s %-42.42s %s\n", count, + keyTypeName[key->keyType], ckaIDbuf, nickName); + SECITEM_ZfreeItem(ckaID, PR_TRUE); + + return SECSuccess; +} + +/* returns SECSuccess if ANY keys are found, SECFailure otherwise. */ +static SECStatus +ListKeysInSlot(PK11SlotInfo *slot, const char *nickName, KeyType keyType, + void *pwarg) +{ + SECKEYPrivateKeyList *list; + SECKEYPrivateKeyListNode *node; + int count = 0; + + if (PK11_NeedLogin(slot)) { + SECStatus rv = PK11_Authenticate(slot, PR_TRUE, pwarg); + if (rv != SECSuccess) { + SECU_PrintError(progName, "could not authenticate to token %s.", + PK11_GetTokenName(slot)); + return SECFailure; + } + } + + if (nickName && nickName[0]) + list = PK11_ListPrivKeysInSlot(slot, (char *)nickName, pwarg); + else + list = PK11_ListPrivateKeysInSlot(slot); + if (list == NULL) { + SECU_PrintError(progName, "problem listing keys"); + return SECFailure; + } + for (node=PRIVKEY_LIST_HEAD(list); + !PRIVKEY_LIST_END(node,list); + node=PRIVKEY_LIST_NEXT(node)) { + char * keyName; + static const char orphan[] = { "(orphan)" }; + + if (keyType != nullKey && keyType != node->key->keyType) + continue; + keyName = PK11_GetPrivateKeyNickname(node->key); + if (!keyName || !keyName[0]) { + /* Try extra hard to find nicknames for keys that lack them. */ + CERTCertificate * cert; + PORT_Free((void *)keyName); + keyName = NULL; + cert = PK11_GetCertFromPrivateKey(node->key); + if (cert) { + if (cert->nickname && cert->nickname[0]) { + keyName = PORT_Strdup(cert->nickname); + } else if (cert->emailAddr && cert->emailAddr[0]) { + keyName = PORT_Strdup(cert->emailAddr); + } + CERT_DestroyCertificate(cert); + } + } + if (nickName) { + if (!keyName || PL_strcmp(keyName,nickName)) { + /* PKCS#11 module returned unwanted keys */ + PORT_Free((void *)keyName); + continue; + } + } + if (!keyName) + keyName = (char *)orphan; + + PrintKey(PR_STDOUT, keyName, count, node->key, pwarg); + + if (keyName != (char *)orphan) + PORT_Free((void *)keyName); + count++; + } + SECKEY_DestroyPrivateKeyList(list); + + if (count == 0) { + PR_fprintf(PR_STDOUT, "%s: no keys found\n", progName); + return SECFailure; + } + return SECSuccess; +} + +/* returns SECSuccess if ANY keys are found, SECFailure otherwise. */ +static SECStatus +ListKeys(PK11SlotInfo *slot, const char *nickName, int index, + KeyType keyType, PRBool dopriv, secuPWData *pwdata) +{ + SECStatus rv = SECFailure; + static const char fmt[] = \ + "%s: Checking token \"%.33s\" in slot \"%.65s\"\n"; + + if (slot == NULL) { + PK11SlotList *list; + PK11SlotListElement *le; + + list= PK11_GetAllTokens(CKM_INVALID_MECHANISM,PR_FALSE,PR_FALSE,pwdata); + if (list) { + for (le = list->head; le; le = le->next) { + PR_fprintf(PR_STDOUT, fmt, progName, + PK11_GetTokenName(le->slot), + PK11_GetSlotName(le->slot)); + rv &= ListKeysInSlot(le->slot,nickName,keyType,pwdata); + } + PK11_FreeSlotList(list); + } + } else { + PR_fprintf(PR_STDOUT, fmt, progName, PK11_GetTokenName(slot), + PK11_GetSlotName(slot)); + rv = ListKeysInSlot(slot,nickName,keyType,pwdata); + } + return rv; +} + +static SECStatus +DeleteKey(char *nickname, secuPWData *pwdata) +{ + SECStatus rv; + CERTCertificate *cert; + PK11SlotInfo *slot; + + slot = PK11_GetInternalKeySlot(); + if (PK11_NeedLogin(slot)) { + SECStatus rv = PK11_Authenticate(slot, PR_TRUE, pwdata); + if (rv != SECSuccess) { + SECU_PrintError(progName, "could not authenticate to token %s.", + PK11_GetTokenName(slot)); + return SECFailure; + } + } + cert = PK11_FindCertFromNickname(nickname, pwdata); + if (!cert) { + PK11_FreeSlot(slot); + return SECFailure; + } + rv = PK11_DeleteTokenCertAndKey(cert, pwdata); + if (rv != SECSuccess) { + SECU_PrintError("problem deleting private key \"%s\"\n", nickname); + } + CERT_DestroyCertificate(cert); + PK11_FreeSlot(slot); + return rv; +} + + +/* + * L i s t M o d u l e s + * + * Print a list of the PKCS11 modules that are + * available. This is useful for smartcard people to + * make sure they have the drivers loaded. + * + */ +static SECStatus +ListModules(void) +{ + PK11SlotList *list; + PK11SlotListElement *le; + + /* get them all! */ + list = PK11_GetAllTokens(CKM_INVALID_MECHANISM,PR_FALSE,PR_FALSE,NULL); + if (list == NULL) return SECFailure; + + /* look at each slot*/ + for (le = list->head ; le; le = le->next) { + printf ("\n"); + printf (" slot: %s\n", PK11_GetSlotName(le->slot)); + printf (" token: %s\n", PK11_GetTokenName(le->slot)); + } + PK11_FreeSlotList(list); + + return SECSuccess; +} + +static void +Usage(char *progName) +{ +#define FPS fprintf(stderr, + FPS "Type %s -H for more detailed descriptions\n", progName); + FPS "Usage: %s -N [-d certdir] [-P dbprefix] [-f pwfile]\n", progName); + FPS "Usage: %s -T [-d certdir] [-P dbprefix] [-h token-name]\n" + "\t\t [-f pwfile] [-0 SSO-password]\n", progName); + FPS "\t%s -A -n cert-name -t trustargs [-d certdir] [-P dbprefix] [-a] [-i input]\n", + progName); + FPS "\t%s -B -i batch-file\n", progName); + FPS "\t%s -C [-c issuer-name | -x] -i cert-request-file -o cert-file\n" + "\t\t [-m serial-number] [-w warp-months] [-v months-valid]\n" + "\t\t [-f pwfile] [-d certdir] [-P dbprefix]\n" + "\t\t [-1 | --keyUsage [keyUsageKeyword,..]] [-2] [-3] [-4]\n" + "\t\t [-5 | --nsCertType [nsCertTypeKeyword,...]]\n" + "\t\t [-6 | --extKeyUsage [extKeyUsageKeyword,...]] [-7 emailAddrs]\n" + "\t\t [-8 dns-names] [-a]\n", + progName); + FPS "\t%s -D -n cert-name [-d certdir] [-P dbprefix]\n", progName); + FPS "\t%s -E -n cert-name -t trustargs [-d certdir] [-P dbprefix] [-a] [-i input]\n", + progName); + FPS "\t%s -G -n key-name [-h token-name] [-k rsa] [-g key-size] [-y exp]\n" + "\t\t [-f pwfile] [-z noisefile] [-d certdir] [-P dbprefix]\n", progName); + FPS "\t%s -G [-h token-name] -k dsa [-q pqgfile -g key-size] [-f pwfile]\n" + "\t\t [-z noisefile] [-d certdir] [-P dbprefix]\n", progName); +#ifdef NSS_ENABLE_ECC + FPS "\t%s -G [-h token-name] -k ec -q curve [-f pwfile]\n" + "\t\t [-z noisefile] [-d certdir] [-P dbprefix]\n", progName); + FPS "\t%s -K [-n key-name] [-h token-name] [-k dsa|ec|rsa|all]\n", + progName); +#else + FPS "\t%s -K [-n key-name] [-h token-name] [-k dsa|rsa|all]\n", + progName); +#endif /* NSS_ENABLE_ECC */ + FPS "\t\t [-f pwfile] [-X] [-d certdir] [-P dbprefix]\n"); + FPS "\t%s --upgrade-merge --source-dir upgradeDir --upgrade-id uniqueID\n", + progName); + FPS "\t\t [--upgrade-token-name tokenName] [-d targetDBDir]\n"); + FPS "\t\t [-P targetDBPrefix] [--source-prefix upgradeDBPrefix]\n"); + FPS "\t\t [-f targetPWfile] [-@ upgradePWFile]\n"); + FPS "\t%s --merge --source-dir sourceDBDir [-d targetDBdir]\n", + progName); + FPS "\t\t [-P targetDBPrefix] [--source-prefix sourceDBPrefix]\n"); + FPS "\t\t [-f targetPWfile] [-@ sourcePWFile]\n"); + FPS "\t%s -L [-n cert-name] [--email email-address] [-X] [-r] [-a]\n", + progName); + FPS "\t\t [-d certdir] [-P dbprefix]\n"); + FPS "\t%s -M -n cert-name -t trustargs [-d certdir] [-P dbprefix]\n", + progName); + FPS "\t%s -O -n cert-name [-X] [-d certdir] [-a] [-P dbprefix]\n", progName); + FPS "\t%s -R -s subj -o cert-request-file [-d certdir] [-P dbprefix] [-p phone] [-a]\n" + "\t\t [-7 emailAddrs] [-k key-type-or-id] [-h token-name] [-f pwfile] [-g key-size]\n", + progName); + FPS "\t%s -V -n cert-name -u usage [-b time] [-e] [-a]\n" + "\t\t[-X] [-d certdir] [-P dbprefix]\n", + progName); + FPS "Usage: %s -W [-d certdir] [-f pwfile] [-@newpwfile]\n", + progName); + FPS "\t%s -S -n cert-name -s subj [-c issuer-name | -x] -t trustargs\n" + "\t\t [-k key-type-or-id] [-q key-params] [-h token-name] [-g key-size]\n" + "\t\t [-m serial-number] [-w warp-months] [-v months-valid]\n" + "\t\t [-f pwfile] [-d certdir] [-P dbprefix]\n" + "\t\t [-p phone] [-1] [-2] [-3] [-4] [-5] [-6] [-7 emailAddrs]\n" + "\t\t [-8 DNS-names]\n" + "\t\t [--extAIA] [--extSIA] [--extCP] [--extPM] [--extPC] [--extIA]\n" + "\t\t [--extSKID]\n", progName); + FPS "\t%s -U [-X] [-d certdir] [-P dbprefix]\n", progName); + exit(1); +} + +static void LongUsage(char *progName) +{ + + FPS "%-15s Add a certificate to the database (create if needed)\n", + "-A"); + FPS "%-20s\n", " All options under -E apply"); + FPS "%-15s Run a series of certutil commands from a batch file\n", "-B"); + FPS "%-20s Specify the batch file\n", " -i batch-file"); + FPS "%-15s Add an Email certificate to the database (create if needed)\n", + "-E"); + FPS "%-20s Specify the nickname of the certificate to add\n", + " -n cert-name"); + FPS "%-20s Set the certificate trust attributes:\n", + " -t trustargs"); + FPS "%-25s trustargs is of the form x,y,z where x is for SSL, y is for S/MIME,\n", ""); + FPS "%-25s and z is for code signing\n", ""); + FPS "%-25s p \t valid peer\n", ""); + FPS "%-25s P \t trusted peer (implies p)\n", ""); + FPS "%-25s c \t valid CA\n", ""); + FPS "%-25s T \t trusted CA to issue client certs (implies c)\n", ""); + FPS "%-25s C \t trusted CA to issue server certs (implies c)\n", ""); + FPS "%-25s u \t user cert\n", ""); + FPS "%-25s w \t send warning\n", ""); + FPS "%-25s g \t make step-up cert\n", ""); + FPS "%-20s Specify the password file\n", + " -f pwfile"); + FPS "%-20s Cert database directory (default is ~/.netscape)\n", + " -d certdir"); + FPS "%-20s Cert & Key database prefix\n", + " -P dbprefix"); + FPS "%-20s The input certificate is encoded in ASCII (RFC1113)\n", + " -a"); + FPS "%-20s Specify the certificate file (default is stdin)\n", + " -i input"); + FPS "\n"); + + FPS "%-15s Create a new binary certificate from a BINARY cert request\n", + "-C"); + FPS "%-20s The nickname of the issuer cert\n", + " -c issuer-name"); + FPS "%-20s The BINARY certificate request file\n", + " -i cert-request "); + FPS "%-20s Output binary cert to this file (default is stdout)\n", + " -o output-cert"); + FPS "%-20s Self sign\n", + " -x"); + FPS "%-20s Cert serial number\n", + " -m serial-number"); + FPS "%-20s Time Warp\n", + " -w warp-months"); + FPS "%-20s Months valid (default is 3)\n", + " -v months-valid"); + FPS "%-20s Specify the password file\n", + " -f pwfile"); + FPS "%-20s Cert database directory (default is ~/.netscape)\n", + " -d certdir"); + FPS "%-20s Cert & Key database prefix\n", + " -P dbprefix"); + FPS "%-20s \n" + "%-20s Create key usage extension. Possible keywords:\n" + "%-20s \"digitalSignature\", \"nonRepudiation\", \"keyEncipherment\",\n" + "%-20s \"dataEncipherment\", \"keyAgreement\", \"certSigning\",\n" + "%-20s \"crlSigning\", \"critical\"\n", + " -1 | --keyUsage keyword,keyword,...", "", "", "", ""); + FPS "%-20s Create basic constraint extension\n", + " -2 "); + FPS "%-20s Create authority key ID extension\n", + " -3 "); + FPS "%-20s Create crl distribution point extension\n", + " -4 "); + FPS "%-20s \n" + "%-20s Create netscape cert type extension. Possible keywords:\n" + "%-20s \"sslClient\", \"sslServer\", \"smime\", \"objectSigning\",\n" + "%-20s \"sslCA\", \"smimeCA\", \"objectSigningCA\", \"critical\".\n", + " -5 | -nsCertType keyword,keyword,... ", "", "", ""); + FPS "%-20s \n" + "%-20s Create extended key usage extension. Possible keywords:\n" + "%-20s \"serverAuth\", \"clientAuth\",\"codeSigning\",\n" + "%-20s \"emailProtection\", \"timeStamp\",\"ocspResponder\",\n" + "%-20s \"stepUp\", \"critical\"\n", + " -6 | --extKeyUsage keyword,keyword,...", "", "", "", ""); + FPS "%-20s Create an email subject alt name extension\n", + " -7 emailAddrs"); + FPS "%-20s Create an dns subject alt name extension\n", + " -8 dnsNames"); + FPS "%-20s The input certificate request is encoded in ASCII (RFC1113)\n", + " -a"); + FPS "\n"); + + FPS "%-15s Generate a new key pair\n", + "-G"); + FPS "%-20s Name of token in which to generate key (default is internal)\n", + " -h token-name"); +#ifdef NSS_ENABLE_ECC + FPS "%-20s Type of key pair to generate (\"dsa\", \"ec\", \"rsa\" (default))\n", + " -k key-type"); + FPS "%-20s Key size in bits, (min %d, max %d, default %d) (not for ec)\n", + " -g key-size", MIN_KEY_BITS, MAX_KEY_BITS, DEFAULT_KEY_BITS); +#else + FPS "%-20s Type of key pair to generate (\"dsa\", \"rsa\" (default))\n", + " -k key-type"); + FPS "%-20s Key size in bits, (min %d, max %d, default %d)\n", + " -g key-size", MIN_KEY_BITS, MAX_KEY_BITS, DEFAULT_KEY_BITS); +#endif /* NSS_ENABLE_ECC */ + FPS "%-20s Set the public exponent value (3, 17, 65537) (rsa only)\n", + " -y exp"); + FPS "%-20s Specify the password file\n", + " -f password-file"); + FPS "%-20s Specify the noise file to be used\n", + " -z noisefile"); + FPS "%-20s read PQG value from pqgfile (dsa only)\n", + " -q pqgfile"); +#ifdef NSS_ENABLE_ECC + FPS "%-20s Elliptic curve name (ec only)\n", + " -q curve-name"); + FPS "%-20s One of nistp256, nistp384, nistp521\n", ""); +#ifdef NSS_ECC_MORE_THAN_SUITE_B + FPS "%-20s sect163k1, nistk163, sect163r1, sect163r2,\n", ""); + FPS "%-20s nistb163, sect193r1, sect193r2, sect233k1, nistk233,\n", ""); + FPS "%-20s sect233r1, nistb233, sect239k1, sect283k1, nistk283,\n", ""); + FPS "%-20s sect283r1, nistb283, sect409k1, nistk409, sect409r1,\n", ""); + FPS "%-20s nistb409, sect571k1, nistk571, sect571r1, nistb571,\n", ""); + FPS "%-20s secp160k1, secp160r1, secp160r2, secp192k1, secp192r1,\n", ""); + FPS "%-20s nistp192, secp224k1, secp224r1, nistp224, secp256k1,\n", ""); + FPS "%-20s secp256r1, secp384r1, secp521r1,\n", ""); + FPS "%-20s prime192v1, prime192v2, prime192v3, \n", ""); + FPS "%-20s prime239v1, prime239v2, prime239v3, c2pnb163v1, \n", ""); + FPS "%-20s c2pnb163v2, c2pnb163v3, c2pnb176v1, c2tnb191v1, \n", ""); + FPS "%-20s c2tnb191v2, c2tnb191v3, \n", ""); + FPS "%-20s c2pnb208w1, c2tnb239v1, c2tnb239v2, c2tnb239v3, \n", ""); + FPS "%-20s c2pnb272w1, c2pnb304w1, \n", ""); + FPS "%-20s c2tnb359w1, c2pnb368w1, c2tnb431r1, secp112r1, \n", ""); + FPS "%-20s secp112r2, secp128r1, secp128r2, sect113r1, sect113r2\n", ""); + FPS "%-20s sect131r1, sect131r2\n", ""); +#endif /* NSS_ECC_MORE_THAN_SUITE_B */ +#endif + FPS "%-20s Key database directory (default is ~/.netscape)\n", + " -d keydir"); + FPS "%-20s Cert & Key database prefix\n", + " -P dbprefix"); + FPS "\n"); + + FPS "%-15s Delete a certificate from the database\n", + "-D"); + FPS "%-20s The nickname of the cert to delete\n", + " -n cert-name"); + FPS "%-20s Cert database directory (default is ~/.netscape)\n", + " -d certdir"); + FPS "%-20s Cert & Key database prefix\n", + " -P dbprefix"); + FPS "\n"); + + FPS "%-15s List all modules\n", /*, or print out a single named module\n",*/ + "-U"); + FPS "%-20s Module database directory (default is '~/.netscape')\n", + " -d moddir"); + FPS "%-20s Cert & Key database prefix\n", + " -P dbprefix"); + FPS "%-20s force the database to open R/W\n", + " -X"); + FPS "\n"); + + FPS "%-15s List all private keys\n", + "-K"); + FPS "%-20s Name of token to search (\"all\" for all tokens)\n", + " -h token-name "); + + FPS "%-20s Key type (\"all\" (default), \"dsa\"," +#ifdef NSS_ENABLE_ECC + " \"ec\"," +#endif + " \"rsa\")\n", + " -k key-type"); + FPS "%-20s The nickname of the key or associated certificate\n", + " -n name"); + FPS "%-20s Specify the password file\n", + " -f password-file"); + FPS "%-20s Key database directory (default is ~/.netscape)\n", + " -d keydir"); + FPS "%-20s Cert & Key database prefix\n", + " -P dbprefix"); + FPS "%-20s force the database to open R/W\n", + " -X"); + FPS "\n"); + + FPS "%-15s List all certs, or print out a single named cert\n", + "-L"); + FPS "%-20s Pretty print named cert (list all if unspecified)\n", + " -n cert-name"); + FPS "%-20s \n" + "%-20s Pretty print cert with email address (list all if unspecified)\n", + " --email email-address", ""); + FPS "%-20s Cert database directory (default is ~/.netscape)\n", + " -d certdir"); + FPS "%-20s Cert & Key database prefix\n", + " -P dbprefix"); + FPS "%-20s force the database to open R/W\n", + " -X"); + FPS "%-20s For single cert, print binary DER encoding\n", + " -r"); + FPS "%-20s For single cert, print ASCII encoding (RFC1113)\n", + " -a"); + FPS "\n"); + + FPS "%-15s Modify trust attributes of certificate\n", + "-M"); + FPS "%-20s The nickname of the cert to modify\n", + " -n cert-name"); + FPS "%-20s Set the certificate trust attributes (see -A above)\n", + " -t trustargs"); + FPS "%-20s Cert database directory (default is ~/.netscape)\n", + " -d certdir"); + FPS "%-20s Cert & Key database prefix\n", + " -P dbprefix"); + FPS "\n"); + + FPS "%-15s Create a new certificate database\n", + "-N"); + FPS "%-20s Cert database directory (default is ~/.netscape)\n", + " -d certdir"); + FPS "%-20s Cert & Key database prefix\n", + " -P dbprefix"); + FPS "\n"); + FPS "%-15s Reset the Key database or token\n", + "-T"); + FPS "%-20s Cert database directory (default is ~/.netscape)\n", + " -d certdir"); + FPS "%-20s Cert & Key database prefix\n", + " -P dbprefix"); + FPS "%-20s Token to reset (default is internal)\n", + " -h token-name"); + FPS "%-20s Set token's Site Security Officer password\n", + " -0 SSO-password"); + FPS "\n"); + + FPS "\n"); + FPS "%-15s Print the chain of a certificate\n", + "-O"); + FPS "%-20s The nickname of the cert to modify\n", + " -n cert-name"); + FPS "%-20s Cert database directory (default is ~/.netscape)\n", + " -d certdir"); + FPS "%-20s Input the certificate in ASCII (RFC1113); default is binary\n", + " -a"); + FPS "%-20s Cert & Key database prefix\n", + " -P dbprefix"); + FPS "%-20s force the database to open R/W\n", + " -X"); + FPS "\n"); + + FPS "%-15s Generate a certificate request (stdout)\n", + "-R"); + FPS "%-20s Specify the subject name (using RFC1485)\n", + " -s subject"); + FPS "%-20s Output the cert request to this file\n", + " -o output-req"); +#ifdef NSS_ENABLE_ECC + FPS "%-20s Type of key pair to generate (\"dsa\", \"ec\", \"rsa\" (default))\n", +#else + FPS "%-20s Type of key pair to generate (\"dsa\", \"rsa\" (default))\n", +#endif /* NSS_ENABLE_ECC */ + " -k key-type-or-id"); + FPS "%-20s or nickname of the cert key to use \n", + ""); + FPS "%-20s Name of token in which to generate key (default is internal)\n", + " -h token-name"); + FPS "%-20s Key size in bits, RSA keys only (min %d, max %d, default %d)\n", + " -g key-size", MIN_KEY_BITS, MAX_KEY_BITS, DEFAULT_KEY_BITS); + FPS "%-20s Name of file containing PQG parameters (dsa only)\n", + " -q pqgfile"); +#ifdef NSS_ENABLE_ECC + FPS "%-20s Elliptic curve name (ec only)\n", + " -q curve-name"); + FPS "%-20s See the \"-G\" option for a full list of supported names.\n", + ""); +#endif /* NSS_ENABLE_ECC */ + FPS "%-20s Specify the password file\n", + " -f pwfile"); + FPS "%-20s Key database directory (default is ~/.netscape)\n", + " -d keydir"); + FPS "%-20s Cert & Key database prefix\n", + " -P dbprefix"); + FPS "%-20s Specify the contact phone number (\"123-456-7890\")\n", + " -p phone"); + FPS "%-20s Output the cert request in ASCII (RFC1113); default is binary\n", + " -a"); + FPS "%-20s \n", + " See -S for available extension options"); + FPS "\n"); + + FPS "%-15s Validate a certificate\n", + "-V"); + FPS "%-20s The nickname of the cert to Validate\n", + " -n cert-name"); + FPS "%-20s validity time (\"YYMMDDHHMMSS[+HHMM|-HHMM|Z]\")\n", + " -b time"); + FPS "%-20s Check certificate signature \n", + " -e "); + FPS "%-20s Specify certificate usage:\n", " -u certusage"); + FPS "%-25s C \t SSL Client\n", ""); + FPS "%-25s V \t SSL Server\n", ""); + FPS "%-25s S \t Email signer\n", ""); + FPS "%-25s R \t Email Recipient\n", ""); + FPS "%-25s O \t OCSP status responder\n", ""); + FPS "%-25s J \t Object signer\n", ""); + FPS "%-20s Cert database directory (default is ~/.netscape)\n", + " -d certdir"); + FPS "%-20s Input the certificate in ASCII (RFC1113); default is binary\n", + " -a"); + FPS "%-20s Cert & Key database prefix\n", + " -P dbprefix"); + FPS "%-20s force the database to open R/W\n", + " -X"); + FPS "\n"); + + FPS "%-15s Change the key database password\n", + "-W"); + FPS "%-20s cert and key database directory\n", + " -d certdir"); + FPS "%-20s Specify a file with the current password\n", + " -f pwfile"); + FPS "%-20s Specify a file with the new password in two lines\n", + " -@ newpwfile"); + + FPS "%-15s Upgrade an old database and merge it into a new one\n", + "--upgrade-merge"); + FPS "%-20s Cert database directory to merge into (default is ~/.netscape)\n", + " -d certdir"); + FPS "%-20s Cert & Key database prefix of the target database\n", + " -P dbprefix"); + FPS "%-20s Specify the password file for the target database\n", + " -f pwfile"); + FPS "%-20s \n%-20s Cert database directory to upgrade from\n", + " --source-dir certdir", ""); + FPS "%-20s \n%-20s Cert & Key database prefix of the upgrade database\n", + " --soruce-prefix dbprefix", ""); + FPS "%-20s \n%-20s Unique identifier for the upgrade database\n", + " --upgrade-id uniqueID", ""); + FPS "%-20s \n%-20s Name of the token while it is in upgrade state\n", + " --upgrade-token-name name", ""); + FPS "%-20s Specify the password file for the upgrade database\n", + " -@ pwfile"); + FPS "\n"); + + FPS "%-15s Merge source database into the target database\n", + "--merge"); + FPS "%-20s Cert database directory of target (default is ~/.netscape)\n", + " -d certdir"); + FPS "%-20s Cert & Key database prefix of the target database\n", + " -P dbprefix"); + FPS "%-20s Specify the password file for the target database\n", + " -f pwfile"); + FPS "%-20s \n%-20s Cert database directory of the source database\n", + " --source-dir certdir", ""); + FPS "%-20s \n%-20s Cert & Key database prefix of the source database\n", + " --source-prefix dbprefix", ""); + FPS "%-20s Specify the password file for the source database\n", + " -@ pwfile"); + FPS "\n"); + + FPS "%-15s Make a certificate and add to database\n", + "-S"); + FPS "%-20s Specify the nickname of the cert\n", + " -n key-name"); + FPS "%-20s Specify the subject name (using RFC1485)\n", + " -s subject"); + FPS "%-20s The nickname of the issuer cert\n", + " -c issuer-name"); + FPS "%-20s Set the certificate trust attributes (see -A above)\n", + " -t trustargs"); +#ifdef NSS_ENABLE_ECC + FPS "%-20s Type of key pair to generate (\"dsa\", \"ec\", \"rsa\" (default))\n", +#else + FPS "%-20s Type of key pair to generate (\"dsa\", \"rsa\" (default))\n", +#endif /* NSS_ENABLE_ECC */ + " -k key-type-or-id"); + FPS "%-20s Name of token in which to generate key (default is internal)\n", + " -h token-name"); + FPS "%-20s Key size in bits, RSA keys only (min %d, max %d, default %d)\n", + " -g key-size", MIN_KEY_BITS, MAX_KEY_BITS, DEFAULT_KEY_BITS); + FPS "%-20s Name of file containing PQG parameters (dsa only)\n", + " -q pqgfile"); +#ifdef NSS_ENABLE_ECC + FPS "%-20s Elliptic curve name (ec only)\n", + " -q curve-name"); + FPS "%-20s See the \"-G\" option for a full list of supported names.\n", + ""); +#endif /* NSS_ENABLE_ECC */ + FPS "%-20s Self sign\n", + " -x"); + FPS "%-20s Cert serial number\n", + " -m serial-number"); + FPS "%-20s Time Warp\n", + " -w warp-months"); + FPS "%-20s Months valid (default is 3)\n", + " -v months-valid"); + FPS "%-20s Specify the password file\n", + " -f pwfile"); + FPS "%-20s Cert database directory (default is ~/.netscape)\n", + " -d certdir"); + FPS "%-20s Cert & Key database prefix\n", + " -P dbprefix"); + FPS "%-20s Specify the contact phone number (\"123-456-7890\")\n", + " -p phone"); + FPS "%-20s Create key usage extension\n", + " -1 "); + FPS "%-20s Create basic constraint extension\n", + " -2 "); + FPS "%-20s Create authority key ID extension\n", + " -3 "); + FPS "%-20s Create crl distribution point extension\n", + " -4 "); + FPS "%-20s Create netscape cert type extension\n", + " -5 "); + FPS "%-20s Create extended key usage extension\n", + " -6 "); + FPS "%-20s Create an email subject alt name extension\n", + " -7 emailAddrs "); + FPS "%-20s Create a DNS subject alt name extension\n", + " -8 DNS-names"); + FPS "%-20s Create an Authority Information Access extension\n", + " --extAIA "); + FPS "%-20s Create a Subject Information Access extension\n", + " --extSIA "); + FPS "%-20s Create a Certificate Policies extension\n", + " --extCP "); + FPS "%-20s Create a Policy Mappings extension\n", + " --extPM "); + FPS "%-20s Create a Policy Constraints extension\n", + " --extPC "); + FPS "%-20s Create an Inhibit Any Policy extension\n", + " --extIA "); + FPS "%-20s Create a subject key ID extension\n", + " --extSKID "); + FPS "\n"); + + exit(1); +#undef FPS +} + + +static CERTCertificate * +MakeV1Cert( CERTCertDBHandle * handle, + CERTCertificateRequest *req, + char * issuerNickName, + PRBool selfsign, + unsigned int serialNumber, + int warpmonths, + int validityMonths) +{ + CERTCertificate *issuerCert = NULL; + CERTValidity *validity; + CERTCertificate *cert = NULL; + PRExplodedTime printableTime; + PRTime now, after; + + if ( !selfsign ) { + issuerCert = CERT_FindCertByNicknameOrEmailAddr(handle, issuerNickName); + if (!issuerCert) { + SECU_PrintError(progName, "could not find certificate named \"%s\"", + issuerNickName); + return NULL; + } + } + + now = PR_Now(); + PR_ExplodeTime (now, PR_GMTParameters, &printableTime); + if ( warpmonths ) { + printableTime.tm_month += warpmonths; + now = PR_ImplodeTime (&printableTime); + PR_ExplodeTime (now, PR_GMTParameters, &printableTime); + } + printableTime.tm_month += validityMonths; + after = PR_ImplodeTime (&printableTime); + + /* note that the time is now in micro-second unit */ + validity = CERT_CreateValidity (now, after); + if (validity) { + cert = CERT_CreateCertificate(serialNumber, + (selfsign ? &req->subject + : &issuerCert->subject), + validity, req); + + CERT_DestroyValidity(validity); + } + if ( issuerCert ) { + CERT_DestroyCertificate (issuerCert); + } + + return(cert); +} + +static SECItem * +SignCert(CERTCertDBHandle *handle, CERTCertificate *cert, PRBool selfsign, + SECOidTag hashAlgTag, + SECKEYPrivateKey *privKey, char *issuerNickName, void *pwarg) +{ + SECItem der; + SECItem *result = NULL; + SECKEYPrivateKey *caPrivateKey = NULL; + SECStatus rv; + PRArenaPool *arena; + SECOidTag algID; + void *dummy; + + if( !selfsign ) { + CERTCertificate *issuer = PK11_FindCertFromNickname(issuerNickName, pwarg); + if( (CERTCertificate *)NULL == issuer ) { + SECU_PrintError(progName, "unable to find issuer with nickname %s", + issuerNickName); + return (SECItem *)NULL; + } + + privKey = caPrivateKey = PK11_FindKeyByAnyCert(issuer, pwarg); + CERT_DestroyCertificate(issuer); + if (caPrivateKey == NULL) { + SECU_PrintError(progName, "unable to retrieve key %s", issuerNickName); + return NULL; + } + } + + arena = cert->arena; + + algID = SEC_GetSignatureAlgorithmOidTag(privKey->keyType, hashAlgTag); + if (algID == SEC_OID_UNKNOWN) { + fprintf(stderr, "Unknown key or hash type for issuer."); + goto done; + } + + rv = SECOID_SetAlgorithmID(arena, &cert->signature, algID, 0); + if (rv != SECSuccess) { + fprintf(stderr, "Could not set signature algorithm id."); + goto done; + } + + /* we only deal with cert v3 here */ + *(cert->version.data) = 2; + cert->version.len = 1; + + der.len = 0; + der.data = NULL; + dummy = SEC_ASN1EncodeItem (arena, &der, cert, + SEC_ASN1_GET(CERT_CertificateTemplate)); + if (!dummy) { + fprintf (stderr, "Could not encode certificate.\n"); + goto done; + } + + result = (SECItem *) PORT_ArenaZAlloc (arena, sizeof (SECItem)); + if (result == NULL) { + fprintf (stderr, "Could not allocate item for certificate data.\n"); + goto done; + } + + rv = SEC_DerSignData(arena, result, der.data, der.len, privKey, algID); + if (rv != SECSuccess) { + fprintf (stderr, "Could not sign encoded certificate data.\n"); + /* result allocated out of the arena, it will be freed + * when the arena is freed */ + result = NULL; + goto done; + } + cert->derCert = *result; +done: + if (caPrivateKey) { + SECKEY_DestroyPrivateKey(caPrivateKey); + } + return result; +} + +static SECStatus +CreateCert( + CERTCertDBHandle *handle, + PK11SlotInfo *slot, + char * issuerNickName, + PRFileDesc *inFile, + PRFileDesc *outFile, + SECKEYPrivateKey **selfsignprivkey, + void *pwarg, + SECOidTag hashAlgTag, + unsigned int serialNumber, + int warpmonths, + int validityMonths, + const char *emailAddrs, + const char *dnsNames, + PRBool ascii, + PRBool selfsign, + certutilExtnList extnList) +{ + void * extHandle; + SECItem * certDER; + CERTCertificate *subjectCert = NULL; + CERTCertificateRequest *certReq = NULL; + SECStatus rv = SECSuccess; + SECItem reqDER; + CERTCertExtension **CRexts; + + reqDER.data = NULL; + do { + /* Create a certrequest object from the input cert request der */ + certReq = GetCertRequest(inFile, ascii); + if (certReq == NULL) { + GEN_BREAK (SECFailure) + } + + subjectCert = MakeV1Cert (handle, certReq, issuerNickName, selfsign, + serialNumber, warpmonths, validityMonths); + if (subjectCert == NULL) { + GEN_BREAK (SECFailure) + } + + + extHandle = CERT_StartCertExtensions (subjectCert); + if (extHandle == NULL) { + GEN_BREAK (SECFailure) + } + + rv = AddExtensions(extHandle, emailAddrs, dnsNames, extnList); + if (rv != SECSuccess) { + GEN_BREAK (SECFailure) + } + + if (certReq->attributes != NULL && + certReq->attributes[0] != NULL && + certReq->attributes[0]->attrType.data != NULL && + certReq->attributes[0]->attrType.len > 0 && + SECOID_FindOIDTag(&certReq->attributes[0]->attrType) + == SEC_OID_PKCS9_EXTENSION_REQUEST) { + rv = CERT_GetCertificateRequestExtensions(certReq, &CRexts); + if (rv != SECSuccess) + break; + rv = CERT_MergeExtensions(extHandle, CRexts); + if (rv != SECSuccess) + break; + } + + CERT_FinishExtensions(extHandle); + + /* self-signing a cert request, find the private key */ + if (selfsign && *selfsignprivkey == NULL) { + *selfsignprivkey = PK11_FindKeyByDERCert(slot, subjectCert, pwarg); + if (!*selfsignprivkey) { + fprintf(stderr, "Failed to locate private key.\n"); + rv = SECFailure; + break; + } + } + + certDER = SignCert(handle, subjectCert, selfsign, hashAlgTag, + *selfsignprivkey, issuerNickName,pwarg); + + if (certDER) { + if (ascii) { + PR_fprintf(outFile, "%s\n%s\n%s\n", NS_CERT_HEADER, + BTOA_DataToAscii(certDER->data, certDER->len), + NS_CERT_TRAILER); + } else { + PR_Write(outFile, certDER->data, certDER->len); + } + } + + } while (0); + CERT_DestroyCertificateRequest (certReq); + CERT_DestroyCertificate (subjectCert); + if (rv != SECSuccess) { + PRErrorCode perr = PR_GetError(); + fprintf(stderr, "%s: unable to create cert (%s)\n", progName, + SECU_Strerror(perr)); + } + return (rv); +} + + +/* + * map a class to a user presentable string + */ +static const char *objClassArray[] = { + "Data", + "Certificate", + "Public Key", + "Private Key", + "Secret Key", + "Hardware Feature", + "Domain Parameters", + "Mechanism" +}; + +static const char *objNSSClassArray[] = { + "CKO_NSS", + "Crl", + "SMIME Record", + "Trust", + "Builtin Root List" +}; + + +const char * +getObjectClass(CK_ULONG classType) +{ + static char buf[sizeof(CK_ULONG)*2+3]; + + if (classType <= CKO_MECHANISM) { + return objClassArray[classType]; + } + if (classType >= CKO_NSS && classType <= CKO_NSS_BUILTIN_ROOT_LIST) { + return objNSSClassArray[classType - CKO_NSS]; + } + sprintf(buf, "0x%lx", classType); + return buf; +} + +char *mkNickname(unsigned char *data, int len) +{ + char *nick = PORT_Alloc(len+1); + if (!nick) { + return nick; + } + PORT_Memcpy(nick, data, len); + nick[len] = 0; + return nick; +} + +/* + * dump a PK11_MergeTokens error log to the console + */ +void +DumpMergeLog(const char *progname, PK11MergeLog *log) +{ + PK11MergeLogNode *node; + + for (node = log->head; node; node = node->next) { + SECItem attrItem; + char *nickname = NULL; + const char *objectClass = NULL; + SECStatus rv; + + attrItem.data = NULL; + rv = PK11_ReadRawAttribute(PK11_TypeGeneric, node->object, + CKA_LABEL, &attrItem); + if (rv == SECSuccess) { + nickname = mkNickname(attrItem.data, attrItem.len); + PORT_Free(attrItem.data); + } + attrItem.data = NULL; + rv = PK11_ReadRawAttribute(PK11_TypeGeneric, node->object, + CKA_CLASS, &attrItem); + if (rv == SECSuccess) { + if (attrItem.len == sizeof(CK_ULONG)) { + objectClass = getObjectClass(*(CK_ULONG *)attrItem.data); + } + PORT_Free(attrItem.data); + } + + fprintf(stderr, "%s: Could not merge object %s (type %s): %s\n", + progName, + nickname ? nickname : "unnamed", + objectClass ? objectClass : "unknown", + SECU_Strerror(node->error)); + + if (nickname) { + PORT_Free(nickname); + } + } +} + +/* Certutil commands */ +enum { + cmd_AddCert = 0, + cmd_CreateNewCert, + cmd_DeleteCert, + cmd_AddEmailCert, + cmd_DeleteKey, + cmd_GenKeyPair, + cmd_PrintHelp, + cmd_ListKeys, + cmd_ListCerts, + cmd_ModifyCertTrust, + cmd_NewDBs, + cmd_DumpChain, + cmd_CertReq, + cmd_CreateAndAddCert, + cmd_TokenReset, + cmd_ListModules, + cmd_CheckCertValidity, + cmd_ChangePassword, + cmd_Version, + cmd_Batch, + cmd_Merge, + cmd_UpgradeMerge /* test only */ +}; + +/* Certutil options */ +enum certutilOpts { + opt_SSOPass = 0, + opt_AddKeyUsageExt, + opt_AddBasicConstraintExt, + opt_AddAuthorityKeyIDExt, + opt_AddCRLDistPtsExt, + opt_AddNSCertTypeExt, + opt_AddExtKeyUsageExt, + opt_ExtendedEmailAddrs, + opt_ExtendedDNSNames, + opt_ASCIIForIO, + opt_ValidityTime, + opt_IssuerName, + opt_CertDir, + opt_VerifySig, + opt_PasswordFile, + opt_KeySize, + opt_TokenName, + opt_InputFile, + opt_Emailaddress, + opt_KeyIndex, + opt_KeyType, + opt_DetailedInfo, + opt_SerialNumber, + opt_Nickname, + opt_OutputFile, + opt_PhoneNumber, + opt_DBPrefix, + opt_PQGFile, + opt_BinaryDER, + opt_Subject, + opt_Trust, + opt_Usage, + opt_Validity, + opt_OffsetMonths, + opt_SelfSign, + opt_RW, + opt_Exponent, + opt_NoiseFile, + opt_Hash, + opt_NewPasswordFile, + opt_AddAuthInfoAccExt, + opt_AddSubjInfoAccExt, + opt_AddCertPoliciesExt, + opt_AddPolicyMapExt, + opt_AddPolicyConstrExt, + opt_AddInhibAnyExt, + opt_AddSubjectKeyIDExt, + opt_AddCmdKeyUsageExt, + opt_AddCmdNSCertTypeExt, + opt_AddCmdExtKeyUsageExt, + opt_SourceDir, + opt_SourcePrefix, + opt_UpgradeID, + opt_UpgradeTokenName +}; + +static const +secuCommandFlag commands_init[] = +{ + { /* cmd_AddCert */ 'A', PR_FALSE, 0, PR_FALSE }, + { /* cmd_CreateNewCert */ 'C', PR_FALSE, 0, PR_FALSE }, + { /* cmd_DeleteCert */ 'D', PR_FALSE, 0, PR_FALSE }, + { /* cmd_AddEmailCert */ 'E', PR_FALSE, 0, PR_FALSE }, + { /* cmd_DeleteKey */ 'F', PR_FALSE, 0, PR_FALSE }, + { /* cmd_GenKeyPair */ 'G', PR_FALSE, 0, PR_FALSE }, + { /* cmd_PrintHelp */ 'H', PR_FALSE, 0, PR_FALSE }, + { /* cmd_ListKeys */ 'K', PR_FALSE, 0, PR_FALSE }, + { /* cmd_ListCerts */ 'L', PR_FALSE, 0, PR_FALSE }, + { /* cmd_ModifyCertTrust */ 'M', PR_FALSE, 0, PR_FALSE }, + { /* cmd_NewDBs */ 'N', PR_FALSE, 0, PR_FALSE }, + { /* cmd_DumpChain */ 'O', PR_FALSE, 0, PR_FALSE }, + { /* cmd_CertReq */ 'R', PR_FALSE, 0, PR_FALSE }, + { /* cmd_CreateAndAddCert */ 'S', PR_FALSE, 0, PR_FALSE }, + { /* cmd_TokenReset */ 'T', PR_FALSE, 0, PR_FALSE }, + { /* cmd_ListModules */ 'U', PR_FALSE, 0, PR_FALSE }, + { /* cmd_CheckCertValidity */ 'V', PR_FALSE, 0, PR_FALSE }, + { /* cmd_ChangePassword */ 'W', PR_FALSE, 0, PR_FALSE }, + { /* cmd_Version */ 'Y', PR_FALSE, 0, PR_FALSE }, + { /* cmd_Batch */ 'B', PR_FALSE, 0, PR_FALSE }, + { /* cmd_Merge */ 0, PR_FALSE, 0, PR_FALSE, "merge" }, + { /* cmd_UpgradeMerge */ 0, PR_FALSE, 0, PR_FALSE, + "upgrade-merge" } +}; +#define NUM_COMMANDS ((sizeof commands_init) / (sizeof commands_init[0])) + +static const +secuCommandFlag options_init[] = +{ + { /* opt_SSOPass */ '0', PR_TRUE, 0, PR_FALSE }, + { /* opt_AddKeyUsageExt */ '1', PR_FALSE, 0, PR_FALSE }, + { /* opt_AddBasicConstraintExt*/ '2', PR_FALSE, 0, PR_FALSE }, + { /* opt_AddAuthorityKeyIDExt*/ '3', PR_FALSE, 0, PR_FALSE }, + { /* opt_AddCRLDistPtsExt */ '4', PR_FALSE, 0, PR_FALSE }, + { /* opt_AddNSCertTypeExt */ '5', PR_FALSE, 0, PR_FALSE }, + { /* opt_AddExtKeyUsageExt */ '6', PR_FALSE, 0, PR_FALSE }, + { /* opt_ExtendedEmailAddrs */ '7', PR_TRUE, 0, PR_FALSE }, + { /* opt_ExtendedDNSNames */ '8', PR_TRUE, 0, PR_FALSE }, + { /* opt_ASCIIForIO */ 'a', PR_FALSE, 0, PR_FALSE }, + { /* opt_ValidityTime */ 'b', PR_TRUE, 0, PR_FALSE }, + { /* opt_IssuerName */ 'c', PR_TRUE, 0, PR_FALSE }, + { /* opt_CertDir */ 'd', PR_TRUE, 0, PR_FALSE }, + { /* opt_VerifySig */ 'e', PR_FALSE, 0, PR_FALSE }, + { /* opt_PasswordFile */ 'f', PR_TRUE, 0, PR_FALSE }, + { /* opt_KeySize */ 'g', PR_TRUE, 0, PR_FALSE }, + { /* opt_TokenName */ 'h', PR_TRUE, 0, PR_FALSE }, + { /* opt_InputFile */ 'i', PR_TRUE, 0, PR_FALSE }, + { /* opt_Emailaddress */ 0, PR_TRUE, 0, PR_FALSE, "email" }, + { /* opt_KeyIndex */ 'j', PR_TRUE, 0, PR_FALSE }, + { /* opt_KeyType */ 'k', PR_TRUE, 0, PR_FALSE }, + { /* opt_DetailedInfo */ 'l', PR_FALSE, 0, PR_FALSE }, + { /* opt_SerialNumber */ 'm', PR_TRUE, 0, PR_FALSE }, + { /* opt_Nickname */ 'n', PR_TRUE, 0, PR_FALSE }, + { /* opt_OutputFile */ 'o', PR_TRUE, 0, PR_FALSE }, + { /* opt_PhoneNumber */ 'p', PR_TRUE, 0, PR_FALSE }, + { /* opt_DBPrefix */ 'P', PR_TRUE, 0, PR_FALSE }, + { /* opt_PQGFile */ 'q', PR_TRUE, 0, PR_FALSE }, + { /* opt_BinaryDER */ 'r', PR_FALSE, 0, PR_FALSE }, + { /* opt_Subject */ 's', PR_TRUE, 0, PR_FALSE }, + { /* opt_Trust */ 't', PR_TRUE, 0, PR_FALSE }, + { /* opt_Usage */ 'u', PR_TRUE, 0, PR_FALSE }, + { /* opt_Validity */ 'v', PR_TRUE, 0, PR_FALSE }, + { /* opt_OffsetMonths */ 'w', PR_TRUE, 0, PR_FALSE }, + { /* opt_SelfSign */ 'x', PR_FALSE, 0, PR_FALSE }, + { /* opt_RW */ 'X', PR_FALSE, 0, PR_FALSE }, + { /* opt_Exponent */ 'y', PR_TRUE, 0, PR_FALSE }, + { /* opt_NoiseFile */ 'z', PR_TRUE, 0, PR_FALSE }, + { /* opt_Hash */ 'Z', PR_TRUE, 0, PR_FALSE }, + { /* opt_NewPasswordFile */ '@', PR_TRUE, 0, PR_FALSE }, + { /* opt_AddAuthInfoAccExt */ 0, PR_FALSE, 0, PR_FALSE, "extAIA" }, + { /* opt_AddSubjInfoAccExt */ 0, PR_FALSE, 0, PR_FALSE, "extSIA" }, + { /* opt_AddCertPoliciesExt */ 0, PR_FALSE, 0, PR_FALSE, "extCP" }, + { /* opt_AddPolicyMapExt */ 0, PR_FALSE, 0, PR_FALSE, "extPM" }, + { /* opt_AddPolicyConstrExt */ 0, PR_FALSE, 0, PR_FALSE, "extPC" }, + { /* opt_AddInhibAnyExt */ 0, PR_FALSE, 0, PR_FALSE, "extIA" }, + { /* opt_AddSubjectKeyIDExt */ 0, PR_FALSE, 0, PR_FALSE, + "extSKID" }, + { /* opt_AddCmdKeyUsageExt */ 0, PR_TRUE, 0, PR_FALSE, + "keyUsage" }, + { /* opt_AddCmdNSCertTypeExt */ 0, PR_TRUE, 0, PR_FALSE, + "nsCertType" }, + { /* opt_AddCmdExtKeyUsageExt*/ 0, PR_TRUE, 0, PR_FALSE, + "extKeyUsage" }, + + { /* opt_SourceDir */ 0, PR_TRUE, 0, PR_FALSE, + "source-dir"}, + { /* opt_SourcePrefix */ 0, PR_TRUE, 0, PR_FALSE, + "source-prefix"}, + { /* opt_UpgradeID */ 0, PR_TRUE, 0, PR_FALSE, + "upgrade-id"}, + { /* opt_UpgradeTokenName */ 0, PR_TRUE, 0, PR_FALSE, + "upgrade-token-name"}, +}; +#define NUM_OPTIONS ((sizeof options_init) / (sizeof options_init[0])) + +static secuCommandFlag certutil_commands[NUM_COMMANDS]; +static secuCommandFlag certutil_options [NUM_OPTIONS ]; + +static const secuCommand certutil = { + NUM_COMMANDS, + NUM_OPTIONS, + certutil_commands, + certutil_options +}; + +static certutilExtnList certutil_extns; + +static int +certutil_main(int argc, char **argv, PRBool initialize) +{ + CERTCertDBHandle *certHandle; + PK11SlotInfo *slot = NULL; + CERTName * subject = 0; + PRFileDesc *inFile = PR_STDIN; + PRFileDesc *outFile = NULL; + char * certfile = "tempcert"; + char * certreqfile = "tempcertreq"; + char * slotname = "internal"; + char * certPrefix = ""; + char * sourceDir = ""; + char * srcCertPrefix = ""; + char * upgradeID = ""; + char * upgradeTokenName = ""; + KeyType keytype = rsaKey; + char * name = NULL; + char * email = NULL; + char * keysource = NULL; + SECOidTag hashAlgTag = SEC_OID_UNKNOWN; + int keysize = DEFAULT_KEY_BITS; + int publicExponent = 0x010001; + unsigned int serialNumber = 0; + int warpmonths = 0; + int validityMonths = 3; + int commandsEntered = 0; + char commandToRun = '\0'; + secuPWData pwdata = { PW_NONE, 0 }; + secuPWData pwdata2 = { PW_NONE, 0 }; + PRBool readOnly = PR_FALSE; + PRBool initialized = PR_FALSE; + + SECKEYPrivateKey *privkey = NULL; + SECKEYPublicKey *pubkey = NULL; + + int i; + SECStatus rv; + + progName = PORT_Strrchr(argv[0], '/'); + progName = progName ? progName+1 : argv[0]; + memcpy(certutil_commands, commands_init, sizeof commands_init); + memcpy(certutil_options, options_init, sizeof options_init); + + rv = SECU_ParseCommandLine(argc, argv, progName, &certutil); + + if (rv != SECSuccess) + Usage(progName); + + if (certutil.commands[cmd_PrintHelp].activated) + LongUsage(progName); + + if (certutil.options[opt_PasswordFile].arg) { + pwdata.source = PW_FROMFILE; + pwdata.data = certutil.options[opt_PasswordFile].arg; + } + if (certutil.options[opt_NewPasswordFile].arg) { + pwdata2.source = PW_FROMFILE; + pwdata2.data = certutil.options[opt_NewPasswordFile].arg; + } + + if (certutil.options[opt_CertDir].activated) + SECU_ConfigDirectory(certutil.options[opt_CertDir].arg); + + if (certutil.options[opt_SourceDir].activated) + sourceDir = certutil.options[opt_SourceDir].arg; + + if (certutil.options[opt_UpgradeID].activated) + upgradeID = certutil.options[opt_UpgradeID].arg; + + if (certutil.options[opt_UpgradeTokenName].activated) + upgradeTokenName = certutil.options[opt_UpgradeTokenName].arg; + + if (certutil.options[opt_KeySize].activated) { + keysize = PORT_Atoi(certutil.options[opt_KeySize].arg); + if ((keysize < MIN_KEY_BITS) || (keysize > MAX_KEY_BITS)) { + PR_fprintf(PR_STDERR, + "%s -g: Keysize must be between %d and %d.\n", + progName, MIN_KEY_BITS, MAX_KEY_BITS); + return 255; + } +#ifdef NSS_ENABLE_ECC + if (keytype == ecKey) { + PR_fprintf(PR_STDERR, "%s -g: Not for ec keys.\n", progName); + return 255; + } +#endif /* NSS_ENABLE_ECC */ + + } + + /* -h specify token name */ + if (certutil.options[opt_TokenName].activated) { + if (PL_strcmp(certutil.options[opt_TokenName].arg, "all") == 0) + slotname = NULL; + else + slotname = PL_strdup(certutil.options[opt_TokenName].arg); + } + + /* -Z hash type */ + if (certutil.options[opt_Hash].activated) { + char * arg = certutil.options[opt_Hash].arg; + hashAlgTag = SECU_StringToSignatureAlgTag(arg); + if (hashAlgTag == SEC_OID_UNKNOWN) { + PR_fprintf(PR_STDERR, "%s -Z: %s is not a recognized type.\n", + progName, arg); + return 255; + } + } + + /* -k key type */ + if (certutil.options[opt_KeyType].activated) { + char * arg = certutil.options[opt_KeyType].arg; + if (PL_strcmp(arg, "rsa") == 0) { + keytype = rsaKey; + } else if (PL_strcmp(arg, "dsa") == 0) { + keytype = dsaKey; +#ifdef NSS_ENABLE_ECC + } else if (PL_strcmp(arg, "ec") == 0) { + keytype = ecKey; +#endif /* NSS_ENABLE_ECC */ + } else if (PL_strcmp(arg, "all") == 0) { + keytype = nullKey; + } else { + /* use an existing private/public key pair */ + keysource = arg; + } + } else if (certutil.commands[cmd_ListKeys].activated) { + keytype = nullKey; + } + + /* -m serial number */ + if (certutil.options[opt_SerialNumber].activated) { + int sn = PORT_Atoi(certutil.options[opt_SerialNumber].arg); + if (sn < 0) { + PR_fprintf(PR_STDERR, "%s -m: %s is not a valid serial number.\n", + progName, certutil.options[opt_SerialNumber].arg); + return 255; + } + serialNumber = sn; + } + + /* -P certdb name prefix */ + if (certutil.options[opt_DBPrefix].activated) { + if (certutil.options[opt_DBPrefix].arg) { + certPrefix = strdup(certutil.options[opt_DBPrefix].arg); + } else { + Usage(progName); + } + } + + /* --source-prefix certdb name prefix */ + if (certutil.options[opt_SourcePrefix].activated) { + if (certutil.options[opt_SourcePrefix].arg) { + srcCertPrefix = strdup(certutil.options[opt_SourcePrefix].arg); + } else { + Usage(progName); + } + } + + /* -q PQG file or curve name */ + if (certutil.options[opt_PQGFile].activated) { +#ifdef NSS_ENABLE_ECC + if ((keytype != dsaKey) && (keytype != ecKey)) { + PR_fprintf(PR_STDERR, "%s -q: specifies a PQG file for DSA keys" \ + " (-k dsa) or a named curve for EC keys (-k ec)\n)", + progName); +#else /* } */ + if (keytype != dsaKey) { + PR_fprintf(PR_STDERR, "%s -q: PQG file is for DSA key (-k dsa).\n)", + progName); +#endif /* NSS_ENABLE_ECC */ + return 255; + } + } + + /* -s subject name */ + if (certutil.options[opt_Subject].activated) { + subject = CERT_AsciiToName(certutil.options[opt_Subject].arg); + if (!subject) { + PR_fprintf(PR_STDERR, "%s -s: improperly formatted name: \"%s\"\n", + progName, certutil.options[opt_Subject].arg); + return 255; + } + } + + /* -v validity period */ + if (certutil.options[opt_Validity].activated) { + validityMonths = PORT_Atoi(certutil.options[opt_Validity].arg); + if (validityMonths < 0) { + PR_fprintf(PR_STDERR, "%s -v: incorrect validity period: \"%s\"\n", + progName, certutil.options[opt_Validity].arg); + return 255; + } + } + + /* -w warp months */ + if (certutil.options[opt_OffsetMonths].activated) + warpmonths = PORT_Atoi(certutil.options[opt_OffsetMonths].arg); + + /* -y public exponent (for RSA) */ + if (certutil.options[opt_Exponent].activated) { + publicExponent = PORT_Atoi(certutil.options[opt_Exponent].arg); + if ((publicExponent != 3) && + (publicExponent != 17) && + (publicExponent != 65537)) { + PR_fprintf(PR_STDERR, "%s -y: incorrect public exponent %d.", + progName, publicExponent); + PR_fprintf(PR_STDERR, "Must be 3, 17, or 65537.\n"); + return 255; + } + } + + /* Check number of commands entered. */ + commandsEntered = 0; + for (i=0; i< certutil.numCommands; i++) { + if (certutil.commands[i].activated) { + commandToRun = certutil.commands[i].flag; + commandsEntered++; + } + if (commandsEntered > 1) + break; + } + if (commandsEntered > 1) { + PR_fprintf(PR_STDERR, "%s: only one command at a time!\n", progName); + PR_fprintf(PR_STDERR, "You entered: "); + for (i=0; i< certutil.numCommands; i++) { + if (certutil.commands[i].activated) + PR_fprintf(PR_STDERR, " -%c", certutil.commands[i].flag); + } + PR_fprintf(PR_STDERR, "\n"); + return 255; + } + if (commandsEntered == 0) { + PR_fprintf(PR_STDERR, "%s: you must enter a command!\n", progName); + Usage(progName); + } + + if (certutil.commands[cmd_ListCerts].activated || + certutil.commands[cmd_PrintHelp].activated || + certutil.commands[cmd_ListKeys].activated || + certutil.commands[cmd_ListModules].activated || + certutil.commands[cmd_CheckCertValidity].activated || + certutil.commands[cmd_Version].activated ) { + readOnly = !certutil.options[opt_RW].activated; + } + + /* -A, -D, -F, -M, -S, -V, and all require -n */ + if ((certutil.commands[cmd_AddCert].activated || + certutil.commands[cmd_DeleteCert].activated || + certutil.commands[cmd_DeleteKey].activated || + certutil.commands[cmd_DumpChain].activated || + certutil.commands[cmd_ModifyCertTrust].activated || + certutil.commands[cmd_CreateAndAddCert].activated || + certutil.commands[cmd_CheckCertValidity].activated) && + !certutil.options[opt_Nickname].activated) { + PR_fprintf(PR_STDERR, + "%s -%c: nickname is required for this command (-n).\n", + progName, commandToRun); + return 255; + } + + /* -A, -E, -M, -S require trust */ + if ((certutil.commands[cmd_AddCert].activated || + certutil.commands[cmd_AddEmailCert].activated || + certutil.commands[cmd_ModifyCertTrust].activated || + certutil.commands[cmd_CreateAndAddCert].activated) && + !certutil.options[opt_Trust].activated) { + PR_fprintf(PR_STDERR, + "%s -%c: trust is required for this command (-t).\n", + progName, commandToRun); + return 255; + } + + /* if -L is given raw or ascii mode, it must be for only one cert. */ + if (certutil.commands[cmd_ListCerts].activated && + (certutil.options[opt_ASCIIForIO].activated || + certutil.options[opt_BinaryDER].activated) && + !certutil.options[opt_Nickname].activated) { + PR_fprintf(PR_STDERR, + "%s: nickname is required to dump cert in raw or ascii mode.\n", + progName); + return 255; + } + + /* -L can only be in (raw || ascii). */ + if (certutil.commands[cmd_ListCerts].activated && + certutil.options[opt_ASCIIForIO].activated && + certutil.options[opt_BinaryDER].activated) { + PR_fprintf(PR_STDERR, + "%s: cannot specify both -r and -a when dumping cert.\n", + progName); + return 255; + } + + /* If making a cert request, need a subject. */ + if ((certutil.commands[cmd_CertReq].activated || + certutil.commands[cmd_CreateAndAddCert].activated) && + !(certutil.options[opt_Subject].activated || keysource)) { + PR_fprintf(PR_STDERR, + "%s -%c: subject is required to create a cert request.\n", + progName, commandToRun); + return 255; + } + + /* If making a cert, need a serial number. */ + if ((certutil.commands[cmd_CreateNewCert].activated || + certutil.commands[cmd_CreateAndAddCert].activated) && + !certutil.options[opt_SerialNumber].activated) { + /* Make a default serial number from the current time. */ + PRTime now = PR_Now(); + LL_USHR(now, now, 19); + LL_L2UI(serialNumber, now); + } + + /* Validation needs the usage to validate for. */ + if (certutil.commands[cmd_CheckCertValidity].activated && + !certutil.options[opt_Usage].activated) { + PR_fprintf(PR_STDERR, + "%s -V: specify a usage to validate the cert for (-u).\n", + progName); + return 255; + } + + /* Upgrade/Merge needs a source database and a upgrade id. */ + if (certutil.commands[cmd_UpgradeMerge].activated && + !(certutil.options[opt_SourceDir].activated && + certutil.options[opt_UpgradeID].activated)) { + + PR_fprintf(PR_STDERR, + "%s --upgrade-merge: specify an upgrade database directory " + "(--source-dir) and\n" + " an upgrade ID (--upgrade-id).\n", + progName); + return 255; + } + + /* Merge needs a source database */ + if (certutil.commands[cmd_Merge].activated && + !certutil.options[opt_SourceDir].activated) { + + + PR_fprintf(PR_STDERR, + "%s --merge: specify an source database directory " + "(--source-dir)\n", + progName); + return 255; + } + + + /* To make a cert, need either a issuer or to self-sign it. */ + if (certutil.commands[cmd_CreateAndAddCert].activated && + !(certutil.options[opt_IssuerName].activated || + certutil.options[opt_SelfSign].activated)) { + PR_fprintf(PR_STDERR, + "%s -S: must specify issuer (-c) or self-sign (-x).\n", + progName); + return 255; + } + + /* Using slotname == NULL for listing keys and certs on all slots, + * but only that. */ + if (!(certutil.commands[cmd_ListKeys].activated || + certutil.commands[cmd_DumpChain].activated || + certutil.commands[cmd_ListCerts].activated) && slotname == NULL) { + PR_fprintf(PR_STDERR, + "%s -%c: cannot use \"-h all\" for this command.\n", + progName, commandToRun); + return 255; + } + + /* Using keytype == nullKey for list all key types, but only that. */ + if (!certutil.commands[cmd_ListKeys].activated && keytype == nullKey) { + PR_fprintf(PR_STDERR, + "%s -%c: cannot use \"-k all\" for this command.\n", + progName, commandToRun); + return 255; + } + + /* -S open outFile, temporary file for cert request. */ + if (certutil.commands[cmd_CreateAndAddCert].activated) { + outFile = PR_Open(certreqfile, + PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE, 00660); + if (!outFile) { + PR_fprintf(PR_STDERR, + "%s -o: unable to open \"%s\" for writing (%ld, %ld)\n", + progName, certreqfile, + PR_GetError(), PR_GetOSError()); + return 255; + } + } + + /* Open the input file. */ + if (certutil.options[opt_InputFile].activated) { + inFile = PR_Open(certutil.options[opt_InputFile].arg, PR_RDONLY, 0); + if (!inFile) { + PR_fprintf(PR_STDERR, + "%s: unable to open \"%s\" for reading (%ld, %ld).\n", + progName, certutil.options[opt_InputFile].arg, + PR_GetError(), PR_GetOSError()); + return 255; + } + } + + /* Open the output file. */ + if (certutil.options[opt_OutputFile].activated && !outFile) { + outFile = PR_Open(certutil.options[opt_OutputFile].arg, + PR_CREATE_FILE | PR_RDWR | PR_TRUNCATE, 00660); + if (!outFile) { + PR_fprintf(PR_STDERR, + "%s: unable to open \"%s\" for writing (%ld, %ld).\n", + progName, certutil.options[opt_OutputFile].arg, + PR_GetError(), PR_GetOSError()); + return 255; + } + } + + name = SECU_GetOptionArg(&certutil, opt_Nickname); + email = SECU_GetOptionArg(&certutil, opt_Emailaddress); + + PK11_SetPasswordFunc(SECU_GetModulePassword); + + if (PR_TRUE == initialize) { + /* Initialize NSPR and NSS. */ + PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1); + if (!certutil.commands[cmd_UpgradeMerge].activated) { + rv = NSS_Initialize(SECU_ConfigDirectory(NULL), + certPrefix, certPrefix, + "secmod.db", readOnly ? NSS_INIT_READONLY: 0); + } else { + rv = NSS_InitWithMerge(SECU_ConfigDirectory(NULL), + certPrefix, certPrefix, "secmod.db", + sourceDir, srcCertPrefix, srcCertPrefix, + upgradeID, upgradeTokenName, + readOnly ? NSS_INIT_READONLY: 0); + } + if (rv != SECSuccess) { + SECU_PrintPRandOSError(progName); + rv = SECFailure; + goto shutdown; + } + initialized = PR_TRUE; + SECU_RegisterDynamicOids(); + } + certHandle = CERT_GetDefaultCertDB(); + + if (certutil.commands[cmd_Version].activated) { + printf("Certificate database content version: command not implemented.\n"); + } + + if (PL_strcmp(slotname, "internal") == 0) + slot = PK11_GetInternalKeySlot(); + else if (slotname != NULL) + slot = PK11_FindSlotByName(slotname); + + + + + if ( !slot && (certutil.commands[cmd_NewDBs].activated || + certutil.commands[cmd_ModifyCertTrust].activated || + certutil.commands[cmd_ChangePassword].activated || + certutil.commands[cmd_TokenReset].activated || + certutil.commands[cmd_CreateAndAddCert].activated || + certutil.commands[cmd_AddCert].activated || + certutil.commands[cmd_Merge].activated || + certutil.commands[cmd_UpgradeMerge].activated || + certutil.commands[cmd_AddEmailCert].activated)) { + + SECU_PrintError(progName, "could not find the slot %s",slotname); + rv = SECFailure; + goto shutdown; + } + + /* If creating new database, initialize the password. */ + if (certutil.commands[cmd_NewDBs].activated) { + SECU_ChangePW2(slot, 0, 0, certutil.options[opt_PasswordFile].arg, + certutil.options[opt_NewPasswordFile].arg); + } + + /* walk through the upgrade merge if necessary. + * This option is more to test what some applications will want to do + * to do an automatic upgrade. The --merge command is more useful for + * the general case where 2 database need to be merged together. + */ + if (certutil.commands[cmd_UpgradeMerge].activated) { + if (*upgradeTokenName == 0) { + upgradeTokenName = upgradeID; + } + if (!PK11_IsInternal(slot)) { + fprintf(stderr, "Only internal DB's can be upgraded\n"); + rv = SECSuccess; + goto shutdown; + } + if (!PK11_IsRemovable(slot)) { + printf("database already upgraded.\n"); + rv = SECSuccess; + goto shutdown; + } + if (!PK11_NeedLogin(slot)) { + printf("upgrade complete!\n"); + rv = SECSuccess; + goto shutdown; + } + /* authenticate to the old DB if necessary */ + if (PORT_Strcmp(PK11_GetTokenName(slot), upgradeTokenName) == 0) { + /* if we need a password, supply it. This will be the password + * for the old database */ + rv = PK11_Authenticate(slot, PR_FALSE, &pwdata2); + if (rv != SECSuccess) { + SECU_PrintError(progName, "Could not get password for %s", + upgradeTokenName); + goto shutdown; + } + /* + * if we succeeded above, but still aren't logged in, that means + * we just supplied the password for the old database. We may + * need the password for the new database. NSS will automatically + * change the token names at this point + */ + if (PK11_IsLoggedIn(slot, &pwdata)) { + printf("upgrade complete!\n"); + rv = SECSuccess; + goto shutdown; + } + } + + /* call PK11_IsPresent to update our cached token information */ + if (!PK11_IsPresent(slot)) { + /* this shouldn't happen. We call isPresent to force a token + * info update */ + fprintf(stderr, "upgrade/merge internal error\n"); + rv = SECFailure; + goto shutdown; + } + + /* the token is now set to the state of the source database, + * if we need a password for it, PK11_Authenticate will + * automatically prompt us */ + rv = PK11_Authenticate(slot, PR_FALSE, &pwdata); + if (rv == SECSuccess) { + printf("upgrade complete!\n"); + } else { + SECU_PrintError(progName, "Could not get password for %s", + PK11_GetTokenName(slot)); + } + goto shutdown; + } + + /* + * merge 2 databases. + */ + if (certutil.commands[cmd_Merge].activated) { + PK11SlotInfo *sourceSlot = NULL; + PK11MergeLog *log; + char *modspec = PR_smprintf( + "configDir='%s' certPrefix='%s' tokenDescription='%s'", + sourceDir, srcCertPrefix, + *upgradeTokenName ? upgradeTokenName : "Source Database"); + + if (!modspec) { + rv = SECFailure; + goto shutdown; + } + + sourceSlot = SECMOD_OpenUserDB(modspec); + PR_smprintf_free(modspec); + if (!sourceSlot) { + SECU_PrintError(progName, "couldn't open source database"); + rv = SECFailure; + goto shutdown; + } + + rv = PK11_Authenticate(slot, PR_FALSE, &pwdata); + if (rv != SECSuccess) { + SECU_PrintError(progName, "Couldn't get password for %s", + PK11_GetTokenName(slot)); + goto merge_fail; + } + + rv = PK11_Authenticate(sourceSlot, PR_FALSE, &pwdata2); + if (rv != SECSuccess) { + SECU_PrintError(progName, "Couldn't get password for %s", + PK11_GetTokenName(sourceSlot)); + goto merge_fail; + } + + log = PK11_CreateMergeLog(); + if (!log) { + rv = SECFailure; + SECU_PrintError(progName, "couldn't create error log"); + goto merge_fail; + } + + rv = PK11_MergeTokens(slot, sourceSlot, log, &pwdata, &pwdata2); + if (rv != SECSuccess) { + DumpMergeLog(progName, log); + } + PK11_DestroyMergeLog(log); + +merge_fail: + SECMOD_CloseUserDB(sourceSlot); + PK11_FreeSlot(sourceSlot); + goto shutdown; + } + + /* The following 8 options are mutually exclusive with all others. */ + + /* List certs (-L) */ + if (certutil.commands[cmd_ListCerts].activated) { + rv = ListCerts(certHandle, name, email, slot, + certutil.options[opt_BinaryDER].activated, + certutil.options[opt_ASCIIForIO].activated, + (outFile) ? outFile : PR_STDOUT, &pwdata); + goto shutdown; + } + if (certutil.commands[cmd_DumpChain].activated) { + rv = DumpChain(certHandle, name, + certutil.options[opt_ASCIIForIO].activated); + goto shutdown; + } + /* XXX needs work */ + /* List keys (-K) */ + if (certutil.commands[cmd_ListKeys].activated) { + rv = ListKeys(slot, name, 0 /*keyindex*/, keytype, PR_FALSE /*dopriv*/, + &pwdata); + goto shutdown; + } + /* List modules (-U) */ + if (certutil.commands[cmd_ListModules].activated) { + rv = ListModules(); + goto shutdown; + } + /* Delete cert (-D) */ + if (certutil.commands[cmd_DeleteCert].activated) { + rv = DeleteCert(certHandle, name); + goto shutdown; + } + /* Delete key (-F) */ + if (certutil.commands[cmd_DeleteKey].activated) { + rv = DeleteKey(name, &pwdata); + goto shutdown; + } + /* Modify trust attribute for cert (-M) */ + if (certutil.commands[cmd_ModifyCertTrust].activated) { + rv = ChangeTrustAttributes(certHandle, slot, name, + certutil.options[opt_Trust].arg, &pwdata); + goto shutdown; + } + /* Change key db password (-W) (future - change pw to slot?) */ + if (certutil.commands[cmd_ChangePassword].activated) { + rv = SECU_ChangePW2(slot, 0, 0, certutil.options[opt_PasswordFile].arg, + certutil.options[opt_NewPasswordFile].arg); + goto shutdown; + } + /* Reset the a token */ + if (certutil.commands[cmd_TokenReset].activated) { + char *sso_pass = ""; + + if (certutil.options[opt_SSOPass].activated) { + sso_pass = certutil.options[opt_SSOPass].arg; + } + rv = PK11_ResetToken(slot,sso_pass); + + goto shutdown; + } + /* Check cert validity against current time (-V) */ + if (certutil.commands[cmd_CheckCertValidity].activated) { + /* XXX temporary hack for fips - must log in to get priv key */ + if (certutil.options[opt_VerifySig].activated) { + if (slot && PK11_NeedLogin(slot)) { + SECStatus newrv = PK11_Authenticate(slot, PR_TRUE, &pwdata); + if (newrv != SECSuccess) { + SECU_PrintError(progName, "could not authenticate to token %s.", + PK11_GetTokenName(slot)); + goto shutdown; + } + } + } + rv = ValidateCert(certHandle, name, + certutil.options[opt_ValidityTime].arg, + certutil.options[opt_Usage].arg, + certutil.options[opt_VerifySig].activated, + certutil.options[opt_DetailedInfo].activated, + certutil.options[opt_ASCIIForIO].activated, + &pwdata); + if (rv != SECSuccess && PR_GetError() == SEC_ERROR_INVALID_ARGS) + SECU_PrintError(progName, "validation failed"); + goto shutdown; + } + + /* + * Key generation + */ + + /* These commands may require keygen. */ + if (certutil.commands[cmd_CertReq].activated || + certutil.commands[cmd_CreateAndAddCert].activated || + certutil.commands[cmd_GenKeyPair].activated) { + if (keysource) { + CERTCertificate *keycert; + keycert = CERT_FindCertByNicknameOrEmailAddr(certHandle, keysource); + if (!keycert) { + keycert = PK11_FindCertFromNickname(keysource, NULL); + if (!keycert) { + SECU_PrintError(progName, + "%s is neither a key-type nor a nickname", keysource); + return SECFailure; + } + } + privkey = PK11_FindKeyByDERCert(slot, keycert, &pwdata); + if (privkey) + pubkey = CERT_ExtractPublicKey(keycert); + if (!pubkey) { + SECU_PrintError(progName, + "Could not get keys from cert %s", keysource); + rv = SECFailure; + CERT_DestroyCertificate(keycert); + goto shutdown; + } + keytype = privkey->keyType; + /* On CertReq for renewal if no subject has been + * specified obtain it from the certificate. + */ + if (certutil.commands[cmd_CertReq].activated && !subject) { + subject = CERT_AsciiToName(keycert->subjectName); + if (!subject) { + SECU_PrintError(progName, + "Could not get subject from certificate %s", keysource); + CERT_DestroyCertificate(keycert); + rv = SECFailure; + goto shutdown; + } + } + CERT_DestroyCertificate(keycert); + } else { + privkey = + CERTUTIL_GeneratePrivateKey(keytype, slot, keysize, + publicExponent, + certutil.options[opt_NoiseFile].arg, + &pubkey, + certutil.options[opt_PQGFile].arg, + &pwdata); + if (privkey == NULL) { + SECU_PrintError(progName, "unable to generate key(s)\n"); + rv = SECFailure; + goto shutdown; + } + } + privkey->wincx = &pwdata; + PORT_Assert(pubkey != NULL); + + /* If all that was needed was keygen, exit. */ + if (certutil.commands[cmd_GenKeyPair].activated) { + rv = SECSuccess; + goto shutdown; + } + } + + /* If we need a list of extensions convert the flags into list format */ + if (certutil.commands[cmd_CertReq].activated || + certutil.commands[cmd_CreateAndAddCert].activated || + certutil.commands[cmd_CreateNewCert].activated) { + certutil_extns[ext_keyUsage].activated = + certutil.options[opt_AddCmdKeyUsageExt].activated; + if (!certutil_extns[ext_keyUsage].activated) { + certutil_extns[ext_keyUsage].activated = + certutil.options[opt_AddKeyUsageExt].activated; + } else { + certutil_extns[ext_keyUsage].arg = + certutil.options[opt_AddCmdKeyUsageExt].arg; + } + certutil_extns[ext_basicConstraint].activated = + certutil.options[opt_AddBasicConstraintExt].activated; + certutil_extns[ext_authorityKeyID].activated = + certutil.options[opt_AddAuthorityKeyIDExt].activated; + certutil_extns[ext_subjectKeyID].activated = + certutil.options[opt_AddSubjectKeyIDExt].activated; + certutil_extns[ext_CRLDistPts].activated = + certutil.options[opt_AddCRLDistPtsExt].activated; + certutil_extns[ext_NSCertType].activated = + certutil.options[opt_AddCmdNSCertTypeExt].activated; + if (!certutil_extns[ext_NSCertType].activated) { + certutil_extns[ext_NSCertType].activated = + certutil.options[opt_AddNSCertTypeExt].activated; + } else { + certutil_extns[ext_NSCertType].arg = + certutil.options[opt_AddCmdNSCertTypeExt].arg; + } + + certutil_extns[ext_extKeyUsage].activated = + certutil.options[opt_AddCmdExtKeyUsageExt].activated; + if (!certutil_extns[ext_extKeyUsage].activated) { + certutil_extns[ext_extKeyUsage].activated = + certutil.options[opt_AddExtKeyUsageExt].activated; + } else { + certutil_extns[ext_extKeyUsage].arg = + certutil.options[opt_AddCmdExtKeyUsageExt].arg; + } + + certutil_extns[ext_authInfoAcc].activated = + certutil.options[opt_AddAuthInfoAccExt].activated; + certutil_extns[ext_subjInfoAcc].activated = + certutil.options[opt_AddSubjInfoAccExt].activated; + certutil_extns[ext_certPolicies].activated = + certutil.options[opt_AddCertPoliciesExt].activated; + certutil_extns[ext_policyMappings].activated = + certutil.options[opt_AddPolicyMapExt].activated; + certutil_extns[ext_policyConstr].activated = + certutil.options[opt_AddPolicyConstrExt].activated; + certutil_extns[ext_inhibitAnyPolicy].activated = + certutil.options[opt_AddInhibAnyExt].activated; + } + /* + * Certificate request + */ + + /* Make a cert request (-R). */ + if (certutil.commands[cmd_CertReq].activated) { + rv = CertReq(privkey, pubkey, keytype, hashAlgTag, subject, + certutil.options[opt_PhoneNumber].arg, + certutil.options[opt_ASCIIForIO].activated, + certutil.options[opt_ExtendedEmailAddrs].arg, + certutil.options[opt_ExtendedDNSNames].arg, + certutil_extns, + outFile ? outFile : PR_STDOUT); + if (rv) + goto shutdown; + privkey->wincx = &pwdata; + } + + /* + * Certificate creation + */ + + /* If making and adding a cert, create a cert request file first without + * any extensions, then load it with the command line extensions + * and output the cert to another file. + */ + if (certutil.commands[cmd_CreateAndAddCert].activated) { + static certutilExtnList nullextnlist = {{PR_FALSE, NULL}}; + rv = CertReq(privkey, pubkey, keytype, hashAlgTag, subject, + certutil.options[opt_PhoneNumber].arg, + certutil.options[opt_ASCIIForIO].activated, + NULL, + NULL, + nullextnlist, + outFile ? outFile : PR_STDOUT); + if (rv) + goto shutdown; + privkey->wincx = &pwdata; + PR_Close(outFile); + outFile = NULL; + inFile = PR_Open(certreqfile, PR_RDONLY, 0); + if (!inFile) { + PR_fprintf(PR_STDERR, "Failed to open file \"%s\" (%ld, %ld).\n", + certreqfile, PR_GetError(), PR_GetOSError()); + rv = SECFailure; + goto shutdown; + } + outFile = PR_Open(certfile, + PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE, 00660); + if (!outFile) { + PR_fprintf(PR_STDERR, "Failed to open file \"%s\" (%ld, %ld).\n", + certfile, PR_GetError(), PR_GetOSError()); + rv = SECFailure; + goto shutdown; + } + } + + /* Create a certificate (-C or -S). */ + if (certutil.commands[cmd_CreateAndAddCert].activated || + certutil.commands[cmd_CreateNewCert].activated) { + rv = CreateCert(certHandle, slot, + certutil.options[opt_IssuerName].arg, + inFile, outFile, &privkey, &pwdata, hashAlgTag, + serialNumber, warpmonths, validityMonths, + certutil.options[opt_ExtendedEmailAddrs].arg, + certutil.options[opt_ExtendedDNSNames].arg, + certutil.options[opt_ASCIIForIO].activated, + certutil.options[opt_SelfSign].activated, + certutil_extns); + if (rv) + goto shutdown; + } + + /* + * Adding a cert to the database (or slot) + */ + + if (certutil.commands[cmd_CreateAndAddCert].activated) { + PORT_Assert(inFile != PR_STDIN); + PR_Close(inFile); + PR_Close(outFile); + outFile = NULL; + inFile = PR_Open(certfile, PR_RDONLY, 0); + if (!inFile) { + PR_fprintf(PR_STDERR, "Failed to open file \"%s\" (%ld, %ld).\n", + certfile, PR_GetError(), PR_GetOSError()); + rv = SECFailure; + goto shutdown; + } + } + + /* -A -E or -S Add the cert to the DB */ + if (certutil.commands[cmd_CreateAndAddCert].activated || + certutil.commands[cmd_AddCert].activated || + certutil.commands[cmd_AddEmailCert].activated) { + rv = AddCert(slot, certHandle, name, + certutil.options[opt_Trust].arg, + inFile, + certutil.options[opt_ASCIIForIO].activated, + certutil.commands[cmd_AddEmailCert].activated,&pwdata); + if (rv) + goto shutdown; + } + + if (certutil.commands[cmd_CreateAndAddCert].activated) { + PORT_Assert(inFile != PR_STDIN); + PR_Close(inFile); + PR_Delete(certfile); + PR_Delete(certreqfile); + } + +shutdown: + if (slot) { + PK11_FreeSlot(slot); + } + if (privkey) { + SECKEY_DestroyPrivateKey(privkey); + } + if (pubkey) { + SECKEY_DestroyPublicKey(pubkey); + } + if (subject) { + CERT_DestroyName(subject); + } + if (name) { + PL_strfree(name); + } + if (outFile) { + PR_Close(outFile); + } + if (pwdata.data && pwdata.source == PW_PLAINTEXT) { + /* Allocated by a PL_strdup call in SECU_GetModulePassword. */ + PL_strfree(pwdata.data); + } + + /* Open the batch command file. + * + * - If -B option is specified, the contents in the + * command file will be interpreted as subsequent certutil + * commands to be executed in the current certutil process + * context after the current certutil command has been executed. + * - Each line in the command file consists of the command + * line arguments for certutil. + * - The -d option will be ignored if specified in the + * command file. + * - Quoting with double quote characters ("...") is supported + * to allow white space in a command line argument. The + * double quote character cannot be escaped and quoting cannot + * be nested in this version. + * - each line in the batch file is limited to 512 characters + */ + + if ((SECSuccess == rv) && certutil.commands[cmd_Batch].activated) { + FILE* batchFile = NULL; + char *nextcommand = NULL; + PRInt32 cmd_len = 0, buf_size = 0; + static const int increment = 512; + + if (!certutil.options[opt_InputFile].activated || + !certutil.options[opt_InputFile].arg) { + PR_fprintf(PR_STDERR, + "%s: no batch input file specified.\n", + progName); + return 255; + } + batchFile = fopen(certutil.options[opt_InputFile].arg, "r"); + if (!batchFile) { + PR_fprintf(PR_STDERR, + "%s: unable to open \"%s\" for reading (%ld, %ld).\n", + progName, certutil.options[opt_InputFile].arg, + PR_GetError(), PR_GetOSError()); + return 255; + } + /* read and execute command-lines in a loop */ + while ( SECSuccess == rv ) { + PRBool invalid = PR_FALSE; + int newargc = 2; + char* space = NULL; + char* nextarg = NULL; + char** newargv = NULL; + char* crlf; + + if (cmd_len + increment > buf_size) { + char * new_buf; + buf_size += increment; + new_buf = PORT_Realloc(nextcommand, buf_size); + if (!new_buf) { + PR_fprintf(PR_STDERR, "%s: PORT_Realloc(%ld) failed\n", + progName, buf_size); + break; + } + nextcommand = new_buf; + nextcommand[cmd_len] = '\0'; + } + if (!fgets(nextcommand + cmd_len, buf_size - cmd_len, batchFile)) { + break; + } + crlf = PORT_Strrchr(nextcommand, '\n'); + if (crlf) { + *crlf = '\0'; + } + cmd_len = strlen(nextcommand); + if (cmd_len && nextcommand[cmd_len - 1] == '\\') { + nextcommand[--cmd_len] = '\0'; + continue; + } + + /* we now need to split the command into argc / argv format */ + + newargv = PORT_Alloc(sizeof(char*)*(newargc+1)); + newargv[0] = progName; + newargv[1] = nextcommand; + nextarg = nextcommand; + while ((space = PORT_Strpbrk(nextarg, " \f\n\r\t\v")) ) { + while (isspace(*space) ) { + *space = '\0'; + space ++; + } + if (*space == '\0') { + break; + } else if (*space != '\"') { + nextarg = space; + } else { + char* closingquote = strchr(space+1, '\"'); + if (closingquote) { + *closingquote = '\0'; + space++; + nextarg = closingquote+1; + } else { + invalid = PR_TRUE; + nextarg = space; + } + } + newargc++; + newargv = PORT_Realloc(newargv, sizeof(char*)*(newargc+1)); + newargv[newargc-1] = space; + } + newargv[newargc] = NULL; + + /* invoke next command */ + if (PR_TRUE == invalid) { + PR_fprintf(PR_STDERR, "Missing closing quote in batch command :\n%s\nNot executed.\n", + nextcommand); + rv = SECFailure; + } else { + if (0 != certutil_main(newargc, newargv, PR_FALSE) ) + rv = SECFailure; + } + PORT_Free(newargv); + cmd_len = 0; + nextcommand[0] = '\0'; + } + PORT_Free(nextcommand); + fclose(batchFile); + } + + if ((initialized == PR_TRUE) && NSS_Shutdown() != SECSuccess) { + exit(1); + } + if (rv == SECSuccess) { + return 0; + } else { + return 255; + } +} + +int +main(int argc, char **argv) +{ + int rv = certutil_main(argc, argv, PR_TRUE); + PL_ArenaFinish(); + PR_Cleanup(); + return rv; +} + diff --git a/mozilla/security/nss/cmd/certutil/certutil.h b/mozilla/security/nss/cmd/certutil/certutil.h new file mode 100644 index 0000000..0f9470d --- /dev/null +++ b/mozilla/security/nss/cmd/certutil/certutil.h @@ -0,0 +1,82 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Dr Vipul Gupta , Sun Microsystems Laboratories + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef _CERTUTIL_H +#define _CERTUTIL_H + +extern SECKEYPrivateKey * +CERTUTIL_GeneratePrivateKey(KeyType keytype, + PK11SlotInfo *slot, + int rsasize, + int publicExponent, + char *noise, + SECKEYPublicKey **pubkeyp, + char *pqgFile, + secuPWData *pwdata); + +extern char *progName; + +enum certutilExtns { + ext_keyUsage = 0, + ext_basicConstraint, + ext_authorityKeyID, + ext_CRLDistPts, + ext_NSCertType, + ext_extKeyUsage, + ext_authInfoAcc, + ext_subjInfoAcc, + ext_certPolicies, + ext_policyMappings, + ext_policyConstr, + ext_inhibitAnyPolicy, + ext_subjectKeyID, + ext_End +}; + +typedef struct ExtensionEntryStr { + PRBool activated; + const char *arg; +} ExtensionEntry; + +typedef ExtensionEntry certutilExtnList[ext_End]; + +extern SECStatus +AddExtensions(void *extHandle, const char *emailAddrs, const char *dnsNames, + certutilExtnList extList); + +#endif /* _CERTUTIL_H */ + diff --git a/mozilla/security/nss/cmd/certutil/keystuff.c b/mozilla/security/nss/cmd/certutil/keystuff.c new file mode 100644 index 0000000..cbfd25c --- /dev/null +++ b/mozilla/security/nss/cmd/certutil/keystuff.c @@ -0,0 +1,610 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Dr Vipul Gupta , Sun Microsystems Laboratories + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include +#include +#include "secutil.h" + +#if defined(XP_UNIX) +#include +#include +#include +#endif + +#if defined(XP_WIN) || defined (XP_PC) +#include +#ifndef WINCE +#include +#endif +#endif + +#if defined(__sun) && !defined(SVR4) +extern int fclose(FILE*); +extern int fprintf(FILE *, char *, ...); +extern int isatty(int); +extern char *sys_errlist[]; +#define strerror(errno) sys_errlist[errno] +#endif + +#include "nspr.h" +#include "prtypes.h" +#include "prtime.h" +#include "prlong.h" + +#include "pk11func.h" + +#define NUM_KEYSTROKES 120 +#define RAND_BUF_SIZE 60 + +#define ERROR_BREAK rv = SECFailure;break; + +const SEC_ASN1Template SECKEY_PQGParamsTemplate[] = { + { SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SECKEYPQGParams) }, + { SEC_ASN1_INTEGER, offsetof(SECKEYPQGParams,prime) }, + { SEC_ASN1_INTEGER, offsetof(SECKEYPQGParams,subPrime) }, + { SEC_ASN1_INTEGER, offsetof(SECKEYPQGParams,base) }, + { 0, } +}; + +/* returns 0 for success, -1 for failure (EOF encountered) */ +static int +UpdateRNG(void) +{ + char randbuf[RAND_BUF_SIZE]; + int fd, count; + int c; + int rv = 0; +#ifdef XP_UNIX + cc_t orig_cc_min; + cc_t orig_cc_time; + tcflag_t orig_lflag; + struct termios tio; +#endif + char meter[] = { + "\r| |" }; + +#define FPS fprintf(stderr, + FPS "\n"); + FPS "A random seed must be generated that will be used in the\n"); + FPS "creation of your key. One of the easiest ways to create a\n"); + FPS "random seed is to use the timing of keystrokes on a keyboard.\n"); + FPS "\n"); + FPS "To begin, type keys on the keyboard until this progress meter\n"); + FPS "is full. DO NOT USE THE AUTOREPEAT FUNCTION ON YOUR KEYBOARD!\n"); + FPS "\n"); + FPS "\n"); + FPS "Continue typing until the progress meter is full:\n\n"); + FPS "%s", meter); + FPS "\r|"); + + /* turn off echo on stdin & return on 1 char instead of NL */ + fd = fileno(stdin); + +#if defined(XP_UNIX) + tcgetattr(fd, &tio); + orig_lflag = tio.c_lflag; + orig_cc_min = tio.c_cc[VMIN]; + orig_cc_time = tio.c_cc[VTIME]; + tio.c_lflag &= ~ECHO; + tio.c_lflag &= ~ICANON; + tio.c_cc[VMIN] = 1; + tio.c_cc[VTIME] = 0; + tcsetattr(fd, TCSAFLUSH, &tio); +#endif + + /* Get random noise from keyboard strokes */ + count = 0; + while (count < sizeof randbuf) { +#if defined(XP_UNIX) || defined(WINCE) + c = getc(stdin); +#else + c = getch(); +#endif + if (c == EOF) { + rv = -1; + break; + } + randbuf[count] = c; + if (count == 0 || c != randbuf[count-1]) { + count++; + FPS "*"); + } + } + PK11_RandomUpdate(randbuf, sizeof randbuf); + memset(randbuf, 0, sizeof randbuf); + + FPS "\n\n"); + FPS "Finished. Press enter to continue: "); + while ((c = getc(stdin)) != '\n' && c != EOF) + ; + if (c == EOF) + rv = -1; + FPS "\n"); + +#undef FPS + +#if defined(XP_UNIX) + /* set back termio the way it was */ + tio.c_lflag = orig_lflag; + tio.c_cc[VMIN] = orig_cc_min; + tio.c_cc[VTIME] = orig_cc_time; + tcsetattr(fd, TCSAFLUSH, &tio); +#endif + return rv; +} + +static const unsigned char P[] = { 0, + 0x98, 0xef, 0x3a, 0xae, 0x70, 0x98, 0x9b, 0x44, + 0xdb, 0x35, 0x86, 0xc1, 0xb6, 0xc2, 0x47, 0x7c, + 0xb4, 0xff, 0x99, 0xe8, 0xae, 0x44, 0xf2, 0xeb, + 0xc3, 0xbe, 0x23, 0x0f, 0x65, 0xd0, 0x4c, 0x04, + 0x82, 0x90, 0xa7, 0x9d, 0x4a, 0xc8, 0x93, 0x7f, + 0x41, 0xdf, 0xf8, 0x80, 0x6b, 0x0b, 0x68, 0x7f, + 0xaf, 0xe4, 0xa8, 0xb5, 0xb2, 0x99, 0xc3, 0x69, + 0xfb, 0x3f, 0xe7, 0x1b, 0xd0, 0x0f, 0xa9, 0x7a, + 0x4a, 0x04, 0xbf, 0x50, 0x9e, 0x22, 0x33, 0xb8, + 0x89, 0x53, 0x24, 0x10, 0xf9, 0x68, 0x77, 0xad, + 0xaf, 0x10, 0x68, 0xb8, 0xd3, 0x68, 0x5d, 0xa3, + 0xc3, 0xeb, 0x72, 0x3b, 0xa0, 0x0b, 0x73, 0x65, + 0xc5, 0xd1, 0xfa, 0x8c, 0xc0, 0x7d, 0xaa, 0x52, + 0x29, 0x34, 0x44, 0x01, 0xbf, 0x12, 0x25, 0xfe, + 0x18, 0x0a, 0xc8, 0x3f, 0xc1, 0x60, 0x48, 0xdb, + 0xad, 0x93, 0xb6, 0x61, 0x67, 0xd7, 0xa8, 0x2d }; +static const unsigned char Q[] = { 0, + 0xb5, 0xb0, 0x84, 0x8b, 0x44, 0x29, 0xf6, 0x33, + 0x59, 0xa1, 0x3c, 0xbe, 0xd2, 0x7f, 0x35, 0xa1, + 0x76, 0x27, 0x03, 0x81 }; +static const unsigned char G[] = { + 0x04, 0x0e, 0x83, 0x69, 0xf1, 0xcd, 0x7d, 0xe5, + 0x0c, 0x78, 0x93, 0xd6, 0x49, 0x6f, 0x00, 0x04, + 0x4e, 0x0e, 0x6c, 0x37, 0xaa, 0x38, 0x22, 0x47, + 0xd2, 0x58, 0xec, 0x83, 0x12, 0x95, 0xf9, 0x9c, + 0xf1, 0xf4, 0x27, 0xff, 0xd7, 0x99, 0x57, 0x35, + 0xc6, 0x64, 0x4c, 0xc0, 0x47, 0x12, 0x31, 0x50, + 0x82, 0x3c, 0x2a, 0x07, 0x03, 0x01, 0xef, 0x30, + 0x09, 0x89, 0x82, 0x41, 0x76, 0x71, 0xda, 0x9e, + 0x57, 0x8b, 0x76, 0x38, 0x37, 0x5f, 0xa5, 0xcd, + 0x32, 0x84, 0x45, 0x8d, 0x4c, 0x17, 0x54, 0x2b, + 0x5d, 0xc2, 0x6b, 0xba, 0x3e, 0xa0, 0x7b, 0x95, + 0xd7, 0x00, 0x42, 0xf7, 0x08, 0xb8, 0x83, 0x87, + 0x60, 0xe1, 0xe5, 0xf4, 0x1a, 0x54, 0xc2, 0x20, + 0xda, 0x38, 0x3a, 0xd1, 0xb6, 0x10, 0xf4, 0xcb, + 0x35, 0xda, 0x97, 0x92, 0x87, 0xd6, 0xa5, 0x37, + 0x62, 0xb4, 0x93, 0x4a, 0x15, 0x21, 0xa5, 0x10 }; + +/* h: + * 4a:76:30:89:eb:e1:81:7c:99:0b:39:7f:95:4a:65:72: + * c6:b4:05:92:48:6c:3c:b2:7e:e7:39:f3:92:7d:c1:3f: + * bf:e1:fd:b3:4a:46:3e:ce:29:80:e3:d6:f4:59:c6:92: + * 16:2b:0e:d7:d6:bb:ef:94:36:31:c2:66:46:c5:4a:77: + * aa:95:84:ef:99:7e:e3:9c:d9:a0:32:42:09:b6:4e:d0: + * b3:c8:5e:06:df:a1:ac:4d:2d:f9:08:c2:cb:4b:a4:42: + * db:8a:5b:de:25:6e:2b:5b:ca:00:75:2c:57:00:18:aa: + * 68:59:a1:94:03:07:94:78:38:bc:f8:7c:1e:1c:a3:2e + * SEED: + * b5:44:66:c9:0f:f1:ca:1c:95:45:ce:90:74:89:14:f2: + * 13:3e:23:5a:b0:6a:bf:86:ad:cb:a0:7d:ce:3b:c8:16: + * 7f:2d:a2:1a:cb:33:7d:c1:e7:d7:07:aa:1b:a2:d7:89: + * f5:a4:db:f7:8b:50:00:cd:b4:7d:25:81:3f:f8:a8:dd: + * 6c:46:e5:77:b5:60:7e:75:79:b8:99:57:c1:c4:f3:f7: + * 17:ca:43:00:b8:33:b6:06:8f:4d:91:ed:23:a5:66:1b: + * ef:14:d7:bc:21:2b:82:d8:ab:fa:fd:a7:c3:4d:bf:52: + * af:8e:57:59:61:1a:4e:65:c6:90:d6:a6:ff:0b:15:b1 + * g: 1024 + * counter: 1003 + */ + +static const SECKEYPQGParams default_pqg_params = { + NULL, + { 0, (unsigned char *)P, sizeof(P) }, + { 0, (unsigned char *)Q, sizeof(Q) }, + { 0, (unsigned char *)G, sizeof(G) } +}; + +static SECKEYPQGParams * +decode_pqg_params(const char *str) +{ + char *buf; + unsigned int len; + PRArenaPool *arena; + SECKEYPQGParams *params; + SECStatus status; + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if (arena == NULL) + return NULL; + + params = PORT_ArenaZAlloc(arena, sizeof(SECKEYPQGParams)); + if (params == NULL) + goto loser; + params->arena = arena; + + buf = (char *)ATOB_AsciiToData(str, &len); + if ((buf == NULL) || (len == 0)) + goto loser; + + status = SEC_ASN1Decode(arena, params, SECKEY_PQGParamsTemplate, buf, len); + if (status != SECSuccess) + goto loser; + + return params; + +loser: + if (arena != NULL) + PORT_FreeArena(arena, PR_FALSE); + return NULL; +} + +void +CERTUTIL_DestroyParamsPQG(SECKEYPQGParams *params) +{ + if (params->arena) { + PORT_FreeArena(params->arena, PR_FALSE); + } +} + +static int +pqg_prime_bits(const SECKEYPQGParams *params) +{ + int primeBits = 0; + + if (params != NULL) { + int i; + for (i = 0; params->prime.data[i] == 0; i++) { + /* empty */; + } + primeBits = (params->prime.len - i) * 8; + } + + return primeBits; +} + +static char * +getPQGString(const char *filename) +{ + unsigned char *buf = NULL; + PRFileDesc *src; + PRInt32 numBytes; + PRStatus prStatus; + PRFileInfo info; + + src = PR_Open(filename, PR_RDONLY, 0); + if (!src) { + fprintf(stderr, "Failed to open PQG file %s\n", filename); + return NULL; + } + + prStatus = PR_GetOpenFileInfo(src, &info); + + if (prStatus == PR_SUCCESS) { + buf = (unsigned char*)PORT_Alloc(info.size + 1); + } + if (!buf) { + PR_Close(src); + fprintf(stderr, "Failed to read PQG file %s\n", filename); + return NULL; + } + + numBytes = PR_Read(src, buf, info.size); + PR_Close(src); + if (numBytes != info.size) { + PORT_Free(buf); + fprintf(stderr, "Failed to read PQG file %s\n", filename); + PORT_SetError(SEC_ERROR_IO); + return NULL; + } + + if (buf[numBytes-1] == '\n') + numBytes--; + if (buf[numBytes-1] == '\r') + numBytes--; + buf[numBytes] = 0; + + return (char *)buf; +} + +static SECKEYPQGParams* +getpqgfromfile(int keyBits, const char *pqgFile) +{ + char *end, *str, *pqgString; + SECKEYPQGParams* params = NULL; + + str = pqgString = getPQGString(pqgFile); + if (!str) + return NULL; + + do { + end = PORT_Strchr(str, ','); + if (end) + *end = '\0'; + params = decode_pqg_params(str); + if (params) { + int primeBits = pqg_prime_bits(params); + if (keyBits == primeBits) + break; + CERTUTIL_DestroyParamsPQG(params); + params = NULL; + } + if (end) + str = end + 1; + } while (end); + + PORT_Free(pqgString); + return params; +} + +static SECStatus +CERTUTIL_FileForRNG(const char *noise) +{ + char buf[2048]; + PRFileDesc *fd; + PRInt32 count; + + fd = PR_Open(noise,PR_RDONLY,0); + if (!fd) { + fprintf(stderr, "failed to open noise file."); + return SECFailure; + } + + do { + count = PR_Read(fd,buf,sizeof(buf)); + if (count > 0) { + PK11_RandomUpdate(buf,count); + } + } while (count > 0); + + PR_Close(fd); + return SECSuccess; +} + +#ifdef NSS_ENABLE_ECC +typedef struct curveNameTagPairStr { + char *curveName; + SECOidTag curveOidTag; +} CurveNameTagPair; + +#define DEFAULT_CURVE_OID_TAG SEC_OID_SECG_EC_SECP192R1 +/* #define DEFAULT_CURVE_OID_TAG SEC_OID_SECG_EC_SECP160R1 */ + +static CurveNameTagPair nameTagPair[] = +{ + { "sect163k1", SEC_OID_SECG_EC_SECT163K1}, + { "nistk163", SEC_OID_SECG_EC_SECT163K1}, + { "sect163r1", SEC_OID_SECG_EC_SECT163R1}, + { "sect163r2", SEC_OID_SECG_EC_SECT163R2}, + { "nistb163", SEC_OID_SECG_EC_SECT163R2}, + { "sect193r1", SEC_OID_SECG_EC_SECT193R1}, + { "sect193r2", SEC_OID_SECG_EC_SECT193R2}, + { "sect233k1", SEC_OID_SECG_EC_SECT233K1}, + { "nistk233", SEC_OID_SECG_EC_SECT233K1}, + { "sect233r1", SEC_OID_SECG_EC_SECT233R1}, + { "nistb233", SEC_OID_SECG_EC_SECT233R1}, + { "sect239k1", SEC_OID_SECG_EC_SECT239K1}, + { "sect283k1", SEC_OID_SECG_EC_SECT283K1}, + { "nistk283", SEC_OID_SECG_EC_SECT283K1}, + { "sect283r1", SEC_OID_SECG_EC_SECT283R1}, + { "nistb283", SEC_OID_SECG_EC_SECT283R1}, + { "sect409k1", SEC_OID_SECG_EC_SECT409K1}, + { "nistk409", SEC_OID_SECG_EC_SECT409K1}, + { "sect409r1", SEC_OID_SECG_EC_SECT409R1}, + { "nistb409", SEC_OID_SECG_EC_SECT409R1}, + { "sect571k1", SEC_OID_SECG_EC_SECT571K1}, + { "nistk571", SEC_OID_SECG_EC_SECT571K1}, + { "sect571r1", SEC_OID_SECG_EC_SECT571R1}, + { "nistb571", SEC_OID_SECG_EC_SECT571R1}, + { "secp160k1", SEC_OID_SECG_EC_SECP160K1}, + { "secp160r1", SEC_OID_SECG_EC_SECP160R1}, + { "secp160r2", SEC_OID_SECG_EC_SECP160R2}, + { "secp192k1", SEC_OID_SECG_EC_SECP192K1}, + { "secp192r1", SEC_OID_SECG_EC_SECP192R1}, + { "nistp192", SEC_OID_SECG_EC_SECP192R1}, + { "secp224k1", SEC_OID_SECG_EC_SECP224K1}, + { "secp224r1", SEC_OID_SECG_EC_SECP224R1}, + { "nistp224", SEC_OID_SECG_EC_SECP224R1}, + { "secp256k1", SEC_OID_SECG_EC_SECP256K1}, + { "secp256r1", SEC_OID_SECG_EC_SECP256R1}, + { "nistp256", SEC_OID_SECG_EC_SECP256R1}, + { "secp384r1", SEC_OID_SECG_EC_SECP384R1}, + { "nistp384", SEC_OID_SECG_EC_SECP384R1}, + { "secp521r1", SEC_OID_SECG_EC_SECP521R1}, + { "nistp521", SEC_OID_SECG_EC_SECP521R1}, + + { "prime192v1", SEC_OID_ANSIX962_EC_PRIME192V1 }, + { "prime192v2", SEC_OID_ANSIX962_EC_PRIME192V2 }, + { "prime192v3", SEC_OID_ANSIX962_EC_PRIME192V3 }, + { "prime239v1", SEC_OID_ANSIX962_EC_PRIME239V1 }, + { "prime239v2", SEC_OID_ANSIX962_EC_PRIME239V2 }, + { "prime239v3", SEC_OID_ANSIX962_EC_PRIME239V3 }, + + { "c2pnb163v1", SEC_OID_ANSIX962_EC_C2PNB163V1 }, + { "c2pnb163v2", SEC_OID_ANSIX962_EC_C2PNB163V2 }, + { "c2pnb163v3", SEC_OID_ANSIX962_EC_C2PNB163V3 }, + { "c2pnb176v1", SEC_OID_ANSIX962_EC_C2PNB176V1 }, + { "c2tnb191v1", SEC_OID_ANSIX962_EC_C2TNB191V1 }, + { "c2tnb191v2", SEC_OID_ANSIX962_EC_C2TNB191V2 }, + { "c2tnb191v3", SEC_OID_ANSIX962_EC_C2TNB191V3 }, + { "c2onb191v4", SEC_OID_ANSIX962_EC_C2ONB191V4 }, + { "c2onb191v5", SEC_OID_ANSIX962_EC_C2ONB191V5 }, + { "c2pnb208w1", SEC_OID_ANSIX962_EC_C2PNB208W1 }, + { "c2tnb239v1", SEC_OID_ANSIX962_EC_C2TNB239V1 }, + { "c2tnb239v2", SEC_OID_ANSIX962_EC_C2TNB239V2 }, + { "c2tnb239v3", SEC_OID_ANSIX962_EC_C2TNB239V3 }, + { "c2onb239v4", SEC_OID_ANSIX962_EC_C2ONB239V4 }, + { "c2onb239v5", SEC_OID_ANSIX962_EC_C2ONB239V5 }, + { "c2pnb272w1", SEC_OID_ANSIX962_EC_C2PNB272W1 }, + { "c2pnb304w1", SEC_OID_ANSIX962_EC_C2PNB304W1 }, + { "c2tnb359v1", SEC_OID_ANSIX962_EC_C2TNB359V1 }, + { "c2pnb368w1", SEC_OID_ANSIX962_EC_C2PNB368W1 }, + { "c2tnb431r1", SEC_OID_ANSIX962_EC_C2TNB431R1 }, + + { "secp112r1", SEC_OID_SECG_EC_SECP112R1}, + { "secp112r2", SEC_OID_SECG_EC_SECP112R2}, + { "secp128r1", SEC_OID_SECG_EC_SECP128R1}, + { "secp128r2", SEC_OID_SECG_EC_SECP128R2}, + + { "sect113r1", SEC_OID_SECG_EC_SECT113R1}, + { "sect113r2", SEC_OID_SECG_EC_SECT113R2}, + { "sect131r1", SEC_OID_SECG_EC_SECT131R1}, + { "sect131r2", SEC_OID_SECG_EC_SECT131R2}, +}; + +static SECKEYECParams * +getECParams(const char *curve) +{ + SECKEYECParams *ecparams; + SECOidData *oidData = NULL; + SECOidTag curveOidTag = SEC_OID_UNKNOWN; /* default */ + int i, numCurves; + + if (curve != NULL) { + numCurves = sizeof(nameTagPair)/sizeof(CurveNameTagPair); + for (i = 0; ((i < numCurves) && (curveOidTag == SEC_OID_UNKNOWN)); + i++) { + if (PL_strcmp(curve, nameTagPair[i].curveName) == 0) + curveOidTag = nameTagPair[i].curveOidTag; + } + } + + /* Return NULL if curve name is not recognized */ + if ((curveOidTag == SEC_OID_UNKNOWN) || + (oidData = SECOID_FindOIDByTag(curveOidTag)) == NULL) { + fprintf(stderr, "Unrecognized elliptic curve %s\n", curve); + return NULL; + } + + ecparams = SECITEM_AllocItem(NULL, NULL, (2 + oidData->oid.len)); + + /* + * ecparams->data needs to contain the ASN encoding of an object ID (OID) + * representing the named curve. The actual OID is in + * oidData->oid.data so we simply prepend 0x06 and OID length + */ + ecparams->data[0] = SEC_ASN1_OBJECT_ID; + ecparams->data[1] = oidData->oid.len; + memcpy(ecparams->data + 2, oidData->oid.data, oidData->oid.len); + + return ecparams; +} +#endif /* NSS_ENABLE_ECC */ + +SECKEYPrivateKey * +CERTUTIL_GeneratePrivateKey(KeyType keytype, PK11SlotInfo *slot, int size, + int publicExponent, const char *noise, + SECKEYPublicKey **pubkeyp, const char *pqgFile, + secuPWData *pwdata) +{ + CK_MECHANISM_TYPE mechanism; + SECOidTag algtag; + PK11RSAGenParams rsaparams; + SECKEYPQGParams * dsaparams = NULL; + void * params; + SECKEYPrivateKey * privKey = NULL; + + if (slot == NULL) + return NULL; + + if (PK11_Authenticate(slot, PR_TRUE, pwdata) != SECSuccess) + return NULL; + + /* + * Do some random-number initialization. + */ + + if (noise) { + SECStatus rv = CERTUTIL_FileForRNG(noise); + if (rv != SECSuccess) { + PORT_SetError(PR_END_OF_FILE_ERROR); /* XXX */ + return NULL; + } + } else { + int rv = UpdateRNG(); + if (rv) { + PORT_SetError(PR_END_OF_FILE_ERROR); + return NULL; + } + } + + switch (keytype) { + case rsaKey: + rsaparams.keySizeInBits = size; + rsaparams.pe = publicExponent; + mechanism = CKM_RSA_PKCS_KEY_PAIR_GEN; + algtag = SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION; + params = &rsaparams; + break; + case dsaKey: + mechanism = CKM_DSA_KEY_PAIR_GEN; + algtag = SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST; + if (pqgFile) { + dsaparams = getpqgfromfile(size, pqgFile); + if (dsaparams == NULL) + return NULL; + params = dsaparams; + } else { + /* cast away const, and don't set dsaparams */ + params = (void *)&default_pqg_params; + } + break; +#ifdef NSS_ENABLE_ECC + case ecKey: + mechanism = CKM_EC_KEY_PAIR_GEN; + /* For EC keys, PQGFile determines EC parameters */ + if ((params = (void *) getECParams(pqgFile)) == NULL) + return NULL; + break; +#endif /* NSS_ENABLE_ECC */ + default: + return NULL; + } + + fprintf(stderr, "\n\n"); + fprintf(stderr, "Generating key. This may take a few moments...\n\n"); + + privKey = PK11_GenerateKeyPair(slot, mechanism, params, pubkeyp, + PR_TRUE /*isPerm*/, PR_TRUE /*isSensitive*/, + pwdata /*wincx*/); + /* free up the params */ + switch (keytype) { + case dsaKey: if (dsaparams) CERTUTIL_DestroyParamsPQG(dsaparams); + break; +#ifdef NSS_ENABLE_ECC + case ecKey: SECITEM_FreeItem((SECItem *)params, PR_TRUE); break; +#endif + default: /* nothing to free */ break; + } + return privKey; +} diff --git a/mozilla/security/nss/cmd/certutil/manifest.mn b/mozilla/security/nss/cmd/certutil/manifest.mn new file mode 100644 index 0000000..d8c755d --- /dev/null +++ b/mozilla/security/nss/cmd/certutil/manifest.mn @@ -0,0 +1,57 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +CORE_DEPTH = ../../.. + +DEFINES += -DNSPR20 + +# MODULE public and private header directories are implicitly REQUIRED. +MODULE = nss + +CSRCS = \ + certext.c \ + certutil.c \ + keystuff.c \ + $(NULL) + +# The MODULE is always implicitly required. +# Listing it here in REQUIRES makes it appear twice in the cc command line. +REQUIRES = dbm seccmd + +PROGRAM = certutil + +#USE_STATIC_LIBS = 1 diff --git a/mozilla/security/nss/cmd/checkcert/Makefile b/mozilla/security/nss/cmd/checkcert/Makefile new file mode 100644 index 0000000..140b419 --- /dev/null +++ b/mozilla/security/nss/cmd/checkcert/Makefile @@ -0,0 +1,80 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + +include ../platlibs.mk + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + + + +include ../platrules.mk + diff --git a/mozilla/security/nss/cmd/checkcert/checkcert.c b/mozilla/security/nss/cmd/checkcert/checkcert.c new file mode 100644 index 0000000..27c201e --- /dev/null +++ b/mozilla/security/nss/cmd/checkcert/checkcert.c @@ -0,0 +1,591 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "secutil.h" +#include "plgetopt.h" +#include "cert.h" +#include "secoid.h" +#include "cryptohi.h" + +/* maximum supported modulus length in bits (indicate problem if over this) */ +#define MAX_MODULUS (1024) + + +static void Usage(char *progName) +{ + fprintf(stderr, "Usage: %s [aAvf] [certtocheck] [issuingcert]\n", + progName); + fprintf(stderr, "%-20s Cert to check is base64 encoded\n", + "-a"); + fprintf(stderr, "%-20s Issuer's cert is base64 encoded\n", + "-A"); + fprintf(stderr, "%-20s Verbose (indicate decoding progress etc.)\n", + "-v"); + fprintf(stderr, "%-20s Force sanity checks even if pretty print fails.\n", + "-f"); + fprintf(stderr, "%-20s Define an output file to use (default is stdout)\n", + "-o output"); + fprintf(stderr, "%-20s Specify the input type (no default)\n", + "-t type"); + exit(-1); +} + + +/* + * Check integer field named fieldName, printing out results and + * returning the length of the integer in bits + */ + +static +int checkInteger(SECItem *intItem, char *fieldName, int verbose) +{ + int len, bitlen; + if (verbose) { + printf("Checking %s\n", fieldName); + } + + len = intItem->len; + + if (len && (intItem->data[0] & 0x80)) { + printf("PROBLEM: %s is NEGATIVE 2's-complement integer.\n", + fieldName); + } + + + /* calculate bit length and check for unnecessary leading zeros */ + bitlen = len << 3; + if (len > 1 && intItem->data[0] == 0) { + /* leading zero byte(s) */ + if (!(intItem->data[1] & 0x80)) { + printf("PROBLEM: %s has unneeded leading zeros. Violates DER.\n", + fieldName); + } + /* strip leading zeros in length calculation */ + { + int i=0; + while (bitlen > 8 && intItem->data[i] == 0) { + bitlen -= 8; + i++; + } + } + } + return bitlen; +} + + + + +static +void checkName(CERTName *n, char *fieldName, int verbose) +{ + char *v=0; + if (verbose) { + printf("Checking %s\n", fieldName); + } + + v = CERT_GetCountryName(n); + if (!v) { + printf("PROBLEM: %s lacks Country Name (C)\n", + fieldName); + } + PORT_Free(v); + + v = CERT_GetOrgName(n); + if (!v) { + printf("PROBLEM: %s lacks Organization Name (O)\n", + fieldName); + } + PORT_Free(v); + + v = CERT_GetOrgUnitName(n); + if (!v) { + printf("WARNING: %s lacks Organization Unit Name (OU)\n", + fieldName); + } + PORT_Free(v); + + v = CERT_GetCommonName(n); + if (!v) { + printf("PROBLEM: %s lacks Common Name (CN)\n", + fieldName); + } + PORT_Free(v); +} + + +static +SECStatus +OurVerifyData(unsigned char *buf, int len, SECKEYPublicKey *key, + SECItem *sig, SECAlgorithmID *sigAlgorithm) +{ + SECStatus rv; + VFYContext *cx; + SECOidData *sigAlgOid, *oiddata; + SECOidTag sigAlgTag; + SECOidTag hashAlgTag; + int showDigestOid=0; + + cx = VFY_CreateContextWithAlgorithmID(key, sig, sigAlgorithm, &hashAlgTag, + NULL); + if (cx == NULL) + return SECFailure; + + sigAlgOid = SECOID_FindOID(&sigAlgorithm->algorithm); + if (sigAlgOid == 0) + return SECFailure; + sigAlgTag = sigAlgOid->offset; + + + if (showDigestOid) { + oiddata = SECOID_FindOIDByTag(hashAlgTag); + if ( oiddata ) { + printf("PROBLEM: (cont) Digest OID is %s\n", oiddata->desc); + } else { + SECU_PrintAsHex(stdout, + &oiddata->oid, "PROBLEM: UNKNOWN OID", 0); + } + } + + rv = VFY_Begin(cx); + if (rv == SECSuccess) { + rv = VFY_Update(cx, buf, len); + if (rv == SECSuccess) + rv = VFY_End(cx); + } + + VFY_DestroyContext(cx, PR_TRUE); + return rv; +} + + + +static +SECStatus +OurVerifySignedData(CERTSignedData *sd, CERTCertificate *cert) +{ + SECItem sig; + SECKEYPublicKey *pubKey = 0; + SECStatus rv; + + /* check the certificate's validity */ + rv = CERT_CertTimesValid(cert); + if ( rv ) { + return(SECFailure); + } + + /* get cert's public key */ + pubKey = CERT_ExtractPublicKey(cert); + if ( !pubKey ) { + return(SECFailure); + } + + /* check the signature */ + sig = sd->signature; + DER_ConvertBitString(&sig); + rv = OurVerifyData(sd->data.data, sd->data.len, pubKey, &sig, + &sd->signatureAlgorithm); + + SECKEY_DestroyPublicKey(pubKey); + + if ( rv ) { + return(SECFailure); + } + + return(SECSuccess); +} + + + + +static +CERTCertificate *createEmptyCertificate(void) +{ + PRArenaPool *arena = 0; + CERTCertificate *c = 0; + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if ( !arena ) { + return 0; + } + + + c = (CERTCertificate *) PORT_ArenaZAlloc(arena, sizeof(CERTCertificate)); + + if (c) { + c->referenceCount = 1; + c->arena = arena; + } else { + PORT_FreeArena(arena,PR_TRUE); + } + + return c; +} + + + + +int main(int argc, char **argv) +{ + int rv, verbose=0, force=0; + int ascii=0, issuerAscii=0; + char *progName=0; + PRFileDesc *inFile=0, *issuerCertFile=0; + SECItem derCert, derIssuerCert; + PRArenaPool *arena=0; + CERTSignedData *signedData=0; + CERTCertificate *cert=0, *issuerCert=0; + SECKEYPublicKey *rsapubkey=0; + SECAlgorithmID md5WithRSAEncryption, md2WithRSAEncryption; + SECAlgorithmID sha1WithRSAEncryption, rsaEncryption; + SECItem spk; + int selfSigned=0; + int invalid=0; + char *inFileName = NULL, *issuerCertFileName = NULL; + PLOptState *optstate; + PLOptStatus status; + + PORT_Memset(&md5WithRSAEncryption, 0, sizeof(md5WithRSAEncryption)); + PORT_Memset(&md2WithRSAEncryption, 0, sizeof(md2WithRSAEncryption)); + PORT_Memset(&sha1WithRSAEncryption, 0, sizeof(sha1WithRSAEncryption)); + PORT_Memset(&rsaEncryption, 0, sizeof(rsaEncryption)); + + progName = strrchr(argv[0], '/'); + progName = progName ? progName+1 : argv[0]; + + optstate = PL_CreateOptState(argc, argv, "aAvf"); + while ((status = PL_GetNextOpt(optstate)) == PL_OPT_OK) { + switch (optstate->option) { + case 'v': + verbose = 1; + break; + + case 'f': + force = 1; + break; + + case 'a': + ascii = 1; + break; + + case 'A': + issuerAscii = 1; + break; + + case '\0': + if (!inFileName) + inFileName = PL_strdup(optstate->value); + else if (!issuerCertFileName) + issuerCertFileName = PL_strdup(optstate->value); + else + Usage(progName); + break; + } + } + + if (!inFileName || !issuerCertFileName || status == PL_OPT_BAD) { + /* insufficient or excess args */ + Usage(progName); + } + + inFile = PR_Open(inFileName, PR_RDONLY, 0); + if (!inFile) { + fprintf(stderr, "%s: unable to open \"%s\" for reading\n", + progName, inFileName); + exit(1); + } + + issuerCertFile = PR_Open(issuerCertFileName, PR_RDONLY, 0); + if (!issuerCertFile) { + fprintf(stderr, "%s: unable to open \"%s\" for reading\n", + progName, issuerCertFileName); + exit(1); + } + + if (SECU_ReadDERFromFile(&derCert, inFile, ascii) != SECSuccess) { + printf("Couldn't read input certificate as DER binary or base64\n"); + exit(1); + } + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if (arena == 0) { + fprintf(stderr,"%s: can't allocate scratch arena!", progName); + exit(1); + } + + if (issuerCertFile) { + CERTSignedData *issuerCertSD=0; + if (SECU_ReadDERFromFile(&derIssuerCert, issuerCertFile, issuerAscii) + != SECSuccess) { + printf("Couldn't read issuer certificate as DER binary or base64.\n"); + exit(1); + } + issuerCertSD = PORT_ArenaZNew(arena, CERTSignedData); + if (!issuerCertSD) { + fprintf(stderr,"%s: can't allocate issuer signed data!", progName); + exit(1); + } + rv = SEC_ASN1DecodeItem(arena, issuerCertSD, + SEC_ASN1_GET(CERT_SignedDataTemplate), + &derIssuerCert); + if (rv) { + fprintf(stderr, "%s: Issuer cert isn't X509 SIGNED Data?\n", + progName); + exit(1); + } + issuerCert = createEmptyCertificate(); + if (!issuerCert) { + printf("%s: can't allocate space for issuer cert.", progName); + exit(1); + } + rv = SEC_ASN1DecodeItem(arena, issuerCert, + SEC_ASN1_GET(CERT_CertificateTemplate), + &issuerCertSD->data); + if (rv) { + printf("%s: Does not appear to be an X509 Certificate.\n", + progName); + exit(1); + } + } + + signedData = PORT_ArenaZNew(arena,CERTSignedData); + if (!signedData) { + fprintf(stderr,"%s: can't allocate signedData!", progName); + exit(1); + } + + rv = SEC_ASN1DecodeItem(arena, signedData, + SEC_ASN1_GET(CERT_SignedDataTemplate), + &derCert); + if (rv) { + fprintf(stderr, "%s: Does not appear to be X509 SIGNED Data.\n", + progName); + exit(1); + } + + if (verbose) { + printf("Decoded ok as X509 SIGNED data.\n"); + } + + cert = createEmptyCertificate(); + if (!cert) { + fprintf(stderr, "%s: can't allocate cert", progName); + exit(1); + } + + rv = SEC_ASN1DecodeItem(arena, cert, + SEC_ASN1_GET(CERT_CertificateTemplate), + &signedData->data); + if (rv) { + fprintf(stderr, "%s: Does not appear to be an X509 Certificate.\n", + progName); + exit(1); + } + + + if (verbose) { + printf("Decoded ok as an X509 certificate.\n"); + } + + SECU_RegisterDynamicOids(); + rv = SECU_PrintSignedData(stdout, &derCert, "Certificate", 0, + SECU_PrintCertificate); + + if (rv) { + fprintf(stderr, "%s: Unable to pretty print cert. Error: %d\n", + progName, PORT_GetError()); + if (!force) { + exit(1); + } + } + + + /* Do various checks on the cert */ + + printf("\n"); + + /* Check algorithms */ + SECOID_SetAlgorithmID(arena, &md5WithRSAEncryption, + SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION, NULL); + + SECOID_SetAlgorithmID(arena, &md2WithRSAEncryption, + SEC_OID_PKCS1_MD2_WITH_RSA_ENCRYPTION, NULL); + + SECOID_SetAlgorithmID(arena, &sha1WithRSAEncryption, + SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION, NULL); + + SECOID_SetAlgorithmID(arena, &rsaEncryption, + SEC_OID_PKCS1_RSA_ENCRYPTION, NULL); + + { + int isMD5RSA = (SECOID_CompareAlgorithmID(&cert->signature, + &md5WithRSAEncryption) == 0); + int isMD2RSA = (SECOID_CompareAlgorithmID(&cert->signature, + &md2WithRSAEncryption) == 0); + int isSHA1RSA = (SECOID_CompareAlgorithmID(&cert->signature, + &sha1WithRSAEncryption) == 0); + + if (verbose) { + printf("\nDoing algorithm checks.\n"); + } + + if (!(isMD5RSA || isMD2RSA || isSHA1RSA)) { + printf("PROBLEM: Signature not PKCS1 MD5, MD2, or SHA1 + RSA.\n"); + } else if (!isMD5RSA) { + printf("WARNING: Signature not PKCS1 MD5 with RSA Encryption\n"); + } + + if (SECOID_CompareAlgorithmID(&cert->signature, + &signedData->signatureAlgorithm)) { + printf("PROBLEM: Algorithm in sig and certInfo don't match.\n"); + } + } + + if (SECOID_CompareAlgorithmID(&cert->subjectPublicKeyInfo.algorithm, + &rsaEncryption)) { + printf("PROBLEM: Public key algorithm is not PKCS1 RSA Encryption.\n"); + } + + /* Check further public key properties */ + spk = cert->subjectPublicKeyInfo.subjectPublicKey; + DER_ConvertBitString(&spk); + + if (verbose) { + printf("\nsubjectPublicKey DER\n"); + rv = DER_PrettyPrint(stdout, &spk, PR_FALSE); + printf("\n"); + } + + rsapubkey = (SECKEYPublicKey *) + PORT_ArenaZAlloc(arena,sizeof(SECKEYPublicKey)); + if (!rsapubkey) { + fprintf(stderr, "%s: rsapubkey allocation failed.\n", progName); + exit(1); + } + + rv = SEC_ASN1DecodeItem(arena, rsapubkey, + SEC_ASN1_GET(SECKEY_RSAPublicKeyTemplate), &spk); + if (rv) { + printf("PROBLEM: subjectPublicKey is not a DER PKCS1 RSAPublicKey.\n"); + } else { + int mlen; + int pubexp; + if (verbose) { + printf("Decoded RSA Public Key ok. Doing key checks.\n"); + } + PORT_Assert(rsapubkey->keyType == rsaKey); /* XXX RSA */ + mlen = checkInteger(&rsapubkey->u.rsa.modulus, "Modulus", verbose); + printf("INFO: Public Key modulus length in bits: %d\n", mlen); + if (mlen > MAX_MODULUS) { + printf("PROBLEM: Modulus length exceeds %d bits.\n", + MAX_MODULUS); + } + if (mlen < 512) { + printf("WARNING: Short modulus.\n"); + } + if (mlen != (1 << (ffs(mlen)-1))) { + printf("WARNING: Unusual modulus length (not a power of two).\n"); + } + checkInteger(&rsapubkey->u.rsa.publicExponent, "Public Exponent", + verbose); + pubexp = DER_GetInteger(&rsapubkey->u.rsa.publicExponent); + if (pubexp != 17 && pubexp != 3 && pubexp != 65537) { + printf("WARNING: Public exponent not any of: 3, 17, 65537\n"); + } + } + + + /* Name checks */ + checkName(&cert->issuer, "Issuer Name", verbose); + checkName(&cert->subject, "Subject Name", verbose); + + if (issuerCert) { + SECComparison c = + CERT_CompareName(&cert->issuer, &issuerCert->subject); + if (c) { + printf("PROBLEM: Issuer Name and Subject in Issuing Cert differ\n"); + } + } + + /* Check if self-signed */ + selfSigned = (CERT_CompareName(&cert->issuer, &cert->subject) == 0); + if (selfSigned) { + printf("INFO: Certificate is self signed.\n"); + } else { + printf("INFO: Certificate is NOT self-signed.\n"); + } + + + /* Validity time check */ + if (CERT_CertTimesValid(cert) == SECSuccess) { + printf("INFO: Inside validity period of certificate.\n"); + } else { + printf("PROBLEM: Not in validity period of certificate.\n"); + invalid = 1; + } + + /* Signature check if self-signed */ + if (selfSigned && !invalid) { + if (rsapubkey->u.rsa.modulus.len) { + SECStatus ver; + if (verbose) { + printf("Checking self signature.\n"); + } + ver = OurVerifySignedData(signedData, cert); + if (ver != SECSuccess) { + printf("PROBLEM: Verification of self-signature failed!\n"); + } else { + printf("INFO: Self-signature verifies ok.\n"); + } + } else { + printf("INFO: Not checking signature due to key problems.\n"); + } + } else if (!selfSigned && !invalid && issuerCert) { + SECStatus ver; + ver = OurVerifySignedData(signedData, issuerCert); + if (ver != SECSuccess) { + printf("PROBLEM: Verification of issuer's signature failed!\n"); + } else { + printf("INFO: Issuer's signature verifies ok.\n"); + } + } else { + printf("INFO: Not checking signature.\n"); + } + + return 0; +} + + + diff --git a/mozilla/security/nss/cmd/checkcert/manifest.mn b/mozilla/security/nss/cmd/checkcert/manifest.mn new file mode 100644 index 0000000..91cbf1f --- /dev/null +++ b/mozilla/security/nss/cmd/checkcert/manifest.mn @@ -0,0 +1,51 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +CORE_DEPTH = ../../.. + +# MODULE public and private header directories are implicitly REQUIRED. +MODULE = nss + +# This next line is used by .mk files +# and gets translated into $LINCS in manifest.mnw +REQUIRES = seccmd dbm + +DEFINES = -DNSPR20 + +CSRCS = checkcert.c + +PROGRAM = checkcert diff --git a/mozilla/security/nss/cmd/crlutil/Makefile b/mozilla/security/nss/cmd/crlutil/Makefile new file mode 100644 index 0000000..0f01f4c --- /dev/null +++ b/mozilla/security/nss/cmd/crlutil/Makefile @@ -0,0 +1,85 @@ +#! gmake +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + +include ../platlibs.mk + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + +# +# crlgen_lex can be generated on linux by flex or solaris by lex +# +crlgen_lex: + ${LEX} -t crlgen_lex_orig.l > crlgen_lex_fix.c + sed -f crlgen_lex_fix.sed < crlgen_lex_fix.c > crlgen_lex.c + rm -f crlgen_lex_fix.c + +include ../platrules.mk diff --git a/mozilla/security/nss/cmd/crlutil/crlgen.c b/mozilla/security/nss/cmd/crlutil/crlgen.c new file mode 100644 index 0000000..5f86766 --- /dev/null +++ b/mozilla/security/nss/cmd/crlutil/crlgen.c @@ -0,0 +1,1589 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* +** crlgen.c +** +** utility for managing certificates revocation lists generation +** +*/ + + +#include +#include + +#include "nspr.h" +#include "plgetopt.h" +#include "nss.h" +#include "secutil.h" +#include "cert.h" +#include "certi.h" +#include "certdb.h" +#include "pk11func.h" +#include "crlgen.h" + + +/* Destroys extHandle and data. data was create on heap. + * extHandle creaded by CERT_StartCRLEntryExtensions. entry + * was allocated on arena.*/ +static void +destroyEntryData(CRLGENEntryData *data) +{ + if (!data) + return; + PORT_Assert(data->entry); + if (data->extHandle) + CERT_FinishExtensions(data->extHandle); + PORT_Free(data); +} + + +/* Prints error messages along with line number */ +void +crlgen_PrintError(int line, char *msg, ...) +{ + va_list args; + + va_start(args, msg); + + fprintf(stderr, "crlgen: (line: %d) ", line); + vfprintf(stderr, msg, args); + + va_end(args); +} +/* Finds CRLGENEntryData in hashtable according PRUint64 value + * - certId : cert serial number*/ +static CRLGENEntryData* +crlgen_FindEntry(CRLGENGeneratorData *crlGenData, SECItem *certId) +{ + if (!crlGenData->entryDataHashTable || !certId) + return NULL; + return (CRLGENEntryData*) + PL_HashTableLookup(crlGenData->entryDataHashTable, + certId); +} + + +/* Removes CRLGENEntryData from hashtable according to certId + * - certId : cert serial number*/ +static SECStatus +crlgen_RmEntry(CRLGENGeneratorData *crlGenData, SECItem *certId) +{ + CRLGENEntryData *data = NULL; + + if (!crlGenData->entryDataHashTable) + return SECSuccess; + data = crlgen_FindEntry(crlGenData, certId); + if (!data) + return SECSuccess; + if (PL_HashTableRemove(crlGenData->entryDataHashTable, certId)) + return SECSuccess; + destroyEntryData(data); + return SECFailure; +} + + +/* Stores CRLGENEntryData in hashtable according to certId + * - certId : cert serial number*/ +static CRLGENEntryData* +crlgen_PlaceAnEntry(CRLGENGeneratorData *crlGenData, + CERTCrlEntry *entry, SECItem *certId) +{ + CRLGENEntryData *newData = NULL; + + PORT_Assert(crlGenData && crlGenData->entryDataHashTable && + entry); + if (!crlGenData || !crlGenData->entryDataHashTable || !entry) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return NULL; + } + + newData = PORT_ZNew(CRLGENEntryData); + if (!newData) { + return NULL; + } + newData->entry = entry; + newData->certId = certId; + if (!PL_HashTableAdd(crlGenData->entryDataHashTable, + newData->certId, newData)) { + crlgen_PrintError(crlGenData->parsedLineNum, + "Can not add entryData structure\n"); + return NULL; + } + return newData; +} + +/* Use this structure to keep pointer when commiting entries extensions */ +struct commitData { + int pos; + CERTCrlEntry **entries; +}; + +/* HT PL_HashTableEnumerateEntries callback. Sorts hashtable entries of the + * table he. Returns value through arg parameter*/ +static PRIntn PR_CALLBACK +crlgen_CommitEntryData(PLHashEntry *he, PRIntn i, void *arg) +{ + CRLGENEntryData *data = NULL; + + PORT_Assert(he); + if (!he) { + return HT_ENUMERATE_NEXT; + } + data = (CRLGENEntryData*)he->value; + + PORT_Assert(data); + PORT_Assert(arg); + + if (data) { + struct commitData *dt = (struct commitData*)arg; + dt->entries[dt->pos++] = data->entry; + destroyEntryData(data); + } + return HT_ENUMERATE_NEXT; +} + + + +/* Copy char * datainto allocated in arena SECItem */ +static SECStatus +crlgen_SetString(PRArenaPool *arena, const char *dataIn, SECItem *value) +{ + SECItem item; + + PORT_Assert(arena && dataIn); + if (!arena || !dataIn) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + + item.data = (void*)dataIn; + item.len = PORT_Strlen(dataIn); + + return SECITEM_CopyItem(arena, value, &item); +} + +/* Creates CERTGeneralName from parsed data for the Authority Key Extension */ +static CERTGeneralName * +crlgen_GetGeneralName (PRArenaPool *arena, CRLGENGeneratorData *crlGenData, + const char *data) +{ + CERTGeneralName *namesList = NULL; + CERTGeneralName *current; + CERTGeneralName *tail = NULL; + SECStatus rv = SECSuccess; + const char *nextChunk = NULL; + const char *currData = NULL; + int intValue; + char buffer[512]; + void *mark; + + if (!data) + return NULL; + PORT_Assert (arena); + if (!arena) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return NULL; + } + + mark = PORT_ArenaMark (arena); + + nextChunk = data; + currData = data; + do { + int nameLen = 0; + char name[128]; + const char *sepPrt = NULL; + nextChunk = PORT_Strchr(currData, '|'); + if (!nextChunk) + nextChunk = data + strlen(data); + sepPrt = PORT_Strchr(currData, ':'); + if (sepPrt == NULL || sepPrt >= nextChunk) { + *buffer = '\0'; + sepPrt = nextChunk; + } else { + PORT_Memcpy(buffer, sepPrt + 1, + (nextChunk - sepPrt - 1)); + buffer[nextChunk - sepPrt - 1] = '\0'; + } + nameLen = PR_MIN(sepPrt - currData, sizeof(name) - 1 ); + PORT_Memcpy(name, currData, nameLen); + name[nameLen] = '\0'; + currData = nextChunk + 1; + + if (!PORT_Strcmp(name, "otherName")) + intValue = certOtherName; + else if (!PORT_Strcmp(name, "rfc822Name")) + intValue = certRFC822Name; + else if (!PORT_Strcmp(name, "dnsName")) + intValue = certDNSName; + else if (!PORT_Strcmp(name, "x400Address")) + intValue = certX400Address; + else if (!PORT_Strcmp(name, "directoryName")) + intValue = certDirectoryName; + else if (!PORT_Strcmp(name, "ediPartyName")) + intValue = certEDIPartyName; + else if (!PORT_Strcmp(name, "URI")) + intValue = certURI; + else if (!PORT_Strcmp(name, "ipAddress")) + intValue = certIPAddress; + else if (!PORT_Strcmp(name, "registerID")) + intValue = certRegisterID; + else intValue = -1; + + if (intValue >= certOtherName && intValue <= certRegisterID) { + if (namesList == NULL) { + namesList = current = tail = PORT_ArenaZNew(arena, + CERTGeneralName); + } else { + current = PORT_ArenaZNew(arena, CERTGeneralName); + } + if (current == NULL) { + rv = SECFailure; + break; + } + } else { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + break; + } + current->type = intValue; + switch (current->type) { + case certURI: + case certDNSName: + case certRFC822Name: + current->name.other.data = PORT_ArenaAlloc (arena, strlen (buffer)); + if (current->name.other.data == NULL) { + rv = SECFailure; + break; + } + PORT_Memcpy(current->name.other.data, buffer, + current->name.other.len = strlen(buffer)); + break; + + case certEDIPartyName: + case certIPAddress: + case certOtherName: + case certRegisterID: + case certX400Address: { + + current->name.other.data = PORT_ArenaAlloc (arena, strlen (buffer) + 2); + if (current->name.other.data == NULL) { + rv = SECFailure; + break; + } + + PORT_Memcpy (current->name.other.data + 2, buffer, strlen (buffer)); +/* This may not be accurate for all cases.For now, use this tag type */ + current->name.other.data[0] = (char)(((current->type - 1) & 0x1f)| 0x80); + current->name.other.data[1] = (char)strlen (buffer); + current->name.other.len = strlen (buffer) + 2; + break; + } + + case certDirectoryName: { + CERTName *directoryName = NULL; + + directoryName = CERT_AsciiToName (buffer); + if (!directoryName) { + rv = SECFailure; + break; + } + + rv = CERT_CopyName (arena, ¤t->name.directoryName, directoryName); + CERT_DestroyName (directoryName); + + break; + } + } + if (rv != SECSuccess) + break; + current->l.next = &(namesList->l); + current->l.prev = &(tail->l); + tail->l.next = &(current->l); + tail = current; + + } while(nextChunk != data + strlen(data)); + + if (rv != SECSuccess) { + PORT_ArenaRelease (arena, mark); + namesList = NULL; + } + return (namesList); +} + +/* Creates CERTGeneralName from parsed data for the Authority Key Extension */ +static CERTGeneralName * +crlgen_DistinguishedName (PRArenaPool *arena, CRLGENGeneratorData *crlGenData, + const char *data) +{ + CERTName *directoryName = NULL; + CERTGeneralName *current; + SECStatus rv = SECFailure; + void *mark; + + if (!data) + return NULL; + PORT_Assert (arena); + if (!arena) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return NULL; + } + + mark = PORT_ArenaMark (arena); + + current = PORT_ArenaZNew(arena, CERTGeneralName); + if (current == NULL) { + goto loser; + } + current->type = certDirectoryName; + current->l.next = ¤t->l; + current->l.prev = ¤t->l; + + directoryName = CERT_AsciiToName ((char*)data); + if (!directoryName) { + goto loser; + } + + rv = CERT_CopyName (arena, ¤t->name.directoryName, directoryName); + CERT_DestroyName (directoryName); + + loser: + if (rv != SECSuccess) { + PORT_SetError (rv); + PORT_ArenaRelease (arena, mark); + current = NULL; + } + return (current); +} + + +/* Adding Authority Key ID extension to extension handle. */ +static SECStatus +crlgen_AddAuthKeyID (CRLGENGeneratorData *crlGenData, + const char **dataArr) +{ + void *extHandle = NULL; + CERTAuthKeyID *authKeyID = NULL; + PRArenaPool *arena = NULL; + SECStatus rv = SECSuccess; + + PORT_Assert(dataArr && crlGenData); + if (!crlGenData || !dataArr) { + return SECFailure; + } + + extHandle = crlGenData->crlExtHandle; + + if (!dataArr[0] || !dataArr[1] || !dataArr[2]) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + crlgen_PrintError(crlGenData->parsedLineNum, + "insufficient number of parameters.\n"); + return SECFailure; + } + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if (!arena) { + return SECFailure; + } + + authKeyID = PORT_ArenaZNew(arena, CERTAuthKeyID); + if (authKeyID == NULL) { + rv = SECFailure; + goto loser; + } + + if (dataArr[3] == NULL) { + rv = crlgen_SetString (arena, dataArr[2], &authKeyID->keyID); + if (rv != SECSuccess) + goto loser; + } else { + rv = crlgen_SetString (arena, dataArr[3], + &authKeyID->authCertSerialNumber); + if (rv != SECSuccess) + goto loser; + + authKeyID->authCertIssuer = + crlgen_DistinguishedName (arena, crlGenData, dataArr[2]); + if (authKeyID->authCertIssuer == NULL && SECFailure == PORT_GetError ()){ + crlgen_PrintError(crlGenData->parsedLineNum, "syntax error.\n"); + rv = SECFailure; + goto loser; + } + } + + rv = + SECU_EncodeAndAddExtensionValue(arena, extHandle, authKeyID, + (*dataArr[1] == '1') ? PR_TRUE : PR_FALSE, + SEC_OID_X509_AUTH_KEY_ID, + (EXTEN_EXT_VALUE_ENCODER) CERT_EncodeAuthKeyID); + loser: + if (arena) + PORT_FreeArena (arena, PR_FALSE); + return rv; +} + +/* Creates and add Subject Alternative Names extension */ +static SECStatus +crlgen_AddIssuerAltNames(CRLGENGeneratorData *crlGenData, + const char **dataArr) +{ + CERTGeneralName *nameList = NULL; + PRArenaPool *arena = NULL; + void *extHandle = NULL; + SECStatus rv = SECSuccess; + + + PORT_Assert(dataArr && crlGenData); + if (!crlGenData || !dataArr) { + return SECFailure; + } + + if (!dataArr || !dataArr[0] || !dataArr[1] || !dataArr[2]) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + crlgen_PrintError(crlGenData->parsedLineNum, + "insufficient number of arguments.\n"); + return SECFailure; + } + + PORT_Assert(dataArr && crlGenData); + if (!crlGenData || !dataArr) { + return SECFailure; + } + + extHandle = crlGenData->crlExtHandle; + + if (!dataArr[0] || !dataArr[1] || !dataArr[2]) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + crlgen_PrintError(crlGenData->parsedLineNum, + "insufficient number of parameters.\n"); + return SECFailure; + } + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if (!arena) { + return SECFailure; + } + + nameList = crlgen_GetGeneralName(arena, crlGenData, dataArr[2]); + if (nameList == NULL) { + crlgen_PrintError(crlGenData->parsedLineNum, "syntax error.\n"); + rv = SECFailure; + goto loser; + } + + rv = + SECU_EncodeAndAddExtensionValue(arena, extHandle, nameList, + (*dataArr[1] == '1') ? PR_TRUE : PR_FALSE, + SEC_OID_X509_ISSUER_ALT_NAME, + (EXTEN_EXT_VALUE_ENCODER)CERT_EncodeAltNameExtension); + loser: + if (arena) + PORT_FreeArena (arena, PR_FALSE); + return rv; +} + +/* Creates and adds CRLNumber extension to extension handle. + * Since, this is CRL extension, extension handle is the one + * related to CRL extensions */ +static SECStatus +crlgen_AddCrlNumber(CRLGENGeneratorData *crlGenData, const char **dataArr) +{ + PRArenaPool *arena = NULL; + SECItem encodedItem; + void *extHandle = crlGenData->crlExtHandle; + void *dummy; + SECStatus rv = SECFailure; + int code = 0; + + PORT_Assert(dataArr && crlGenData); + if (!crlGenData || !dataArr) { + goto loser; + } + + if (!dataArr[0] || !dataArr[1] || !dataArr[2]) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + crlgen_PrintError(crlGenData->parsedLineNum, + "insufficient number of arguments.\n"); + goto loser; + } + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if (arena == NULL) { + goto loser; + } + + code = atoi(dataArr[2]); + if (code == 0 && *dataArr[2] != '0') { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + goto loser; + } + + dummy = SEC_ASN1EncodeInteger(arena, &encodedItem, code); + if (!dummy) { + rv = SECFailure; + goto loser; + } + + rv = CERT_AddExtension (extHandle, SEC_OID_X509_CRL_NUMBER, &encodedItem, + (*dataArr[1] == '1') ? PR_TRUE : PR_FALSE, + PR_TRUE); + + loser: + if (arena) + PORT_FreeArena(arena, PR_FALSE); + return rv; + +} + + +/* Creates Cert Revocation Reason code extension. Encodes it and + * returns as SECItem structure */ +static SECItem* +crlgen_CreateReasonCode(PRArenaPool *arena, const char **dataArr, + int *extCode) +{ + SECItem *encodedItem; + void *dummy; + void *mark; + int code = 0; + + PORT_Assert(arena && dataArr); + if (!arena || !dataArr) { + goto loser; + } + + mark = PORT_ArenaMark(arena); + + encodedItem = PORT_ArenaZNew (arena, SECItem); + if (encodedItem == NULL) { + goto loser; + } + + if (dataArr[2] == NULL) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + goto loser; + } + + code = atoi(dataArr[2]); + /* aACompromise(10) is the last possible of the values + * for the Reason Core Extension */ + if ((code == 0 && *dataArr[2] != '0') || code > 10) { + + PORT_SetError(SEC_ERROR_INVALID_ARGS); + goto loser; + } + + dummy = SEC_ASN1EncodeInteger(arena, encodedItem, code); + if (!dummy) { + goto loser; + } + + *extCode = SEC_OID_X509_REASON_CODE; + return encodedItem; + + loser: + PORT_ArenaRelease (arena, mark); + return NULL; +} + +/* Creates Cert Invalidity Date extension. Encodes it and + * returns as SECItem structure */ +static SECItem* +crlgen_CreateInvalidityDate(PRArenaPool *arena, const char **dataArr, + int *extCode) +{ + SECItem *encodedItem; + int length = 0; + void *mark; + + PORT_Assert(arena && dataArr); + if (!arena || !dataArr) { + goto loser; + } + + mark = PORT_ArenaMark(arena); + + encodedItem = PORT_ArenaZNew(arena, SECItem); + if (encodedItem == NULL) { + goto loser; + } + + length = PORT_Strlen(dataArr[2]); + + encodedItem->type = siGeneralizedTime; + encodedItem->data = PORT_ArenaAlloc(arena, length); + if (!encodedItem->data) { + goto loser; + } + + PORT_Memcpy(encodedItem->data, dataArr[2], (encodedItem->len = length) * + sizeof(char)); + + *extCode = SEC_OID_X509_INVALID_DATE; + return encodedItem; + + loser: + PORT_ArenaRelease(arena, mark); + return NULL; +} + +/* Creates(by calling extCreator function) and adds extension to a set + * of already added certs. Uses values of rangeFrom and rangeTo from + * CRLGENCrlGenCtl structure for identifying the inclusive set of certs */ +static SECStatus +crlgen_AddEntryExtension(CRLGENGeneratorData *crlGenData, + const char **dataArr, char *extName, + SECItem* (*extCreator)(PRArenaPool *arena, + const char **dataArr, + int *extCode)) +{ + PRUint64 i = 0; + SECStatus rv = SECFailure; + int extCode = 0; + PRUint64 lastRange ; + SECItem *ext = NULL; + PRArenaPool *arena = NULL; + + + PORT_Assert(crlGenData && dataArr); + if (!crlGenData || !dataArr) { + goto loser; + } + + if (!dataArr[0] || !dataArr[1]) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + crlgen_PrintError(crlGenData->parsedLineNum, + "insufficient number of arguments.\n"); + } + + lastRange = crlGenData->rangeTo - crlGenData->rangeFrom + 1; + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if (arena == NULL) { + goto loser; + } + + ext = extCreator(arena, dataArr, &extCode); + if (ext == NULL) { + crlgen_PrintError(crlGenData->parsedLineNum, + "got error while creating extension: %s\n", + extName); + goto loser; + } + + for (i = 0;i < lastRange;i++) { + CRLGENEntryData * extData = NULL; + void *extHandle = NULL; + SECItem * certIdItem = + SEC_ASN1EncodeInteger(arena, NULL, + crlGenData->rangeFrom + i); + if (!certIdItem) { + rv = SECFailure; + goto loser; + } + + extData = crlgen_FindEntry(crlGenData, certIdItem); + if (!extData) { + crlgen_PrintError(crlGenData->parsedLineNum, + "can not add extension: crl entry " + "(serial number: %d) is not in the list yet.\n", + crlGenData->rangeFrom + i); + continue; + } + + extHandle = extData->extHandle; + if (extHandle == NULL) { + extHandle = extData->extHandle = + CERT_StartCRLEntryExtensions(&crlGenData->signCrl->crl, + (CERTCrlEntry*)extData->entry); + } + rv = CERT_AddExtension (extHandle, extCode, ext, + (*dataArr[1] == '1') ? PR_TRUE : PR_FALSE, + PR_TRUE); + if (rv == SECFailure) { + goto loser; + } + } + + loser: + if (arena) + PORT_FreeArena(arena, PR_FALSE); + return rv; +} + + +/* Commits all added entries and their's extensions into CRL. */ +SECStatus +CRLGEN_CommitExtensionsAndEntries(CRLGENGeneratorData *crlGenData) +{ + int size = 0; + CERTCrl *crl; + PRArenaPool *arena; + SECStatus rv = SECSuccess; + void *mark; + + PORT_Assert(crlGenData && crlGenData->signCrl && crlGenData->signCrl->arena); + if (!crlGenData || !crlGenData->signCrl || !crlGenData->signCrl->arena) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + + arena = crlGenData->signCrl->arena; + crl = &crlGenData->signCrl->crl; + + mark = PORT_ArenaMark(arena); + + if (crlGenData->crlExtHandle) + CERT_FinishExtensions(crlGenData->crlExtHandle); + + size = crlGenData->entryDataHashTable->nentries; + crl->entries = NULL; + if (size) { + crl->entries = PORT_ArenaZNewArray(arena, CERTCrlEntry*, size + 1); + if (!crl->entries) { + rv = SECFailure; + } else { + struct commitData dt; + dt.entries = crl->entries; + dt.pos = 0; + PL_HashTableEnumerateEntries(crlGenData->entryDataHashTable, + &crlgen_CommitEntryData, &dt); + /* Last should be NULL */ + crl->entries[size] = NULL; + } + } + + if (rv != SECSuccess) + PORT_ArenaRelease(arena, mark); + return rv; +} + +/* Initializes extHandle with data from extensions array */ +static SECStatus +crlgen_InitExtensionHandle(void *extHandle, + CERTCertExtension **extensions) +{ + CERTCertExtension *extension = NULL; + + if (!extensions) + return SECSuccess; + + PORT_Assert(extHandle != NULL); + if (!extHandle) { + return SECFailure; + } + + extension = *extensions; + while (extension) { + SECOidTag oidTag = SECOID_FindOIDTag (&extension->id); +/* shell we skip unknown extensions? */ + CERT_AddExtension (extHandle, oidTag, &extension->value, + (extension->critical.len != 0) ? PR_TRUE : PR_FALSE, + PR_FALSE); + extension = *(++extensions); + } + return SECSuccess; +} + +/* Used for initialization of extension handles for crl and certs + * extensions from existing CRL data then modifying existing CRL.*/ +SECStatus +CRLGEN_ExtHandleInit(CRLGENGeneratorData *crlGenData) +{ + CERTCrl *crl = NULL; + PRUint64 maxSN = 0; + + PORT_Assert(crlGenData && crlGenData->signCrl && + crlGenData->entryDataHashTable); + if (!crlGenData || !crlGenData->signCrl || + !crlGenData->entryDataHashTable) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + + crl = &crlGenData->signCrl->crl; + crlGenData->crlExtHandle = CERT_StartCRLExtensions(crl); + crlgen_InitExtensionHandle(crlGenData->crlExtHandle, + crl->extensions); + crl->extensions = NULL; + + if (crl->entries) { + CERTCrlEntry **entry = crl->entries; + while (*entry) { + PRUint64 sn = DER_GetInteger(&(*entry)->serialNumber); + CRLGENEntryData *extData = + crlgen_PlaceAnEntry(crlGenData, *entry, &(*entry)->serialNumber); + if ((*entry)->extensions) { + extData->extHandle = + CERT_StartCRLEntryExtensions(&crlGenData->signCrl->crl, + (CERTCrlEntry*)extData->entry); + if (crlgen_InitExtensionHandle(extData->extHandle, + (*entry)->extensions) == SECFailure) + return SECFailure; + } + (*entry)->extensions = NULL; + entry++; + maxSN = PR_MAX(maxSN, sn); + } + } + + crlGenData->rangeFrom = crlGenData->rangeTo = maxSN + 1; + return SECSuccess; +} + +/***************************************************************************** + * Parser trigger functions start here + */ + +/* Sets new internal range value for add/rm certs.*/ +static SECStatus +crlgen_SetNewRangeField(CRLGENGeneratorData *crlGenData, char *value) +{ + long rangeFrom = 0, rangeTo = 0; + char *dashPos = NULL; + + PORT_Assert(crlGenData); + if (!crlGenData) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + + if (value == NULL) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + crlgen_PrintError(crlGenData->parsedLineNum, + "insufficient number of arguments.\n"); + return SECFailure; + } + + if ((dashPos = strchr(value, '-')) != NULL) { + char *rangeToS, *rangeFromS = value; + *dashPos = '\0'; + rangeFrom = atoi(rangeFromS); + *dashPos = '-'; + + rangeToS = (char*)(dashPos + 1); + rangeTo = atol(rangeToS); + } else { + rangeFrom = atol(value); + rangeTo = rangeFrom; + } + + if (rangeFrom < 1 || rangeToparsedLineNum, + "bad cert id range: %s.\n", value); + return SECFailure; + } + + crlGenData->rangeFrom = rangeFrom; + crlGenData->rangeTo = rangeTo; + + return SECSuccess; +} + +/* Changes issuer subject field in CRL. By default this data is taken from + * issuer cert subject field.Not yet implemented */ +static SECStatus +crlgen_SetIssuerField(CRLGENGeneratorData *crlGenData, char *value) +{ + crlgen_PrintError(crlGenData->parsedLineNum, + "Can not change CRL issuer field.\n"); + return SECFailure; +} + +/* Encode and sets CRL thisUpdate and nextUpdate time fields*/ +static SECStatus +crlgen_SetTimeField(CRLGENGeneratorData *crlGenData, char *value, + PRBool setThisUpdate) +{ + CERTSignedCrl *signCrl; + PRArenaPool *arena; + CERTCrl *crl; + int length = 0; + SECItem *timeDest = NULL; + + PORT_Assert(crlGenData && crlGenData->signCrl && + crlGenData->signCrl->arena); + if (!crlGenData || !crlGenData->signCrl || !crlGenData->signCrl->arena) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + + signCrl = crlGenData->signCrl; + arena = signCrl->arena; + crl = &signCrl->crl; + + if (value == NULL) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + crlgen_PrintError(crlGenData->parsedLineNum, + "insufficient number of arguments.\n"); + return SECFailure; + } + length = PORT_Strlen(value); + + if (setThisUpdate == PR_TRUE) { + timeDest = &crl->lastUpdate; + } else { + timeDest = &crl->nextUpdate; + } + + timeDest->type = siGeneralizedTime; + timeDest->data = PORT_ArenaAlloc(arena, length); + if (!timeDest->data) { + return SECFailure; + } + PORT_Memcpy(timeDest->data, value, length); + timeDest->len = length; + + return SECSuccess; +} + + +/* Adds new extension into CRL or added cert handles */ +static SECStatus +crlgen_AddExtension(CRLGENGeneratorData *crlGenData, const char **extData) +{ + PORT_Assert(crlGenData && crlGenData->crlExtHandle); + if (!crlGenData || !crlGenData->crlExtHandle) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + + if (extData == NULL || *extData == NULL) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + crlgen_PrintError(crlGenData->parsedLineNum, + "insufficient number of arguments.\n"); + return SECFailure; + } + if (!PORT_Strcmp(*extData, "authKeyId")) + return crlgen_AddAuthKeyID(crlGenData, extData); + else if (!PORT_Strcmp(*extData, "issuerAltNames")) + return crlgen_AddIssuerAltNames(crlGenData, extData); + else if (!PORT_Strcmp(*extData, "crlNumber")) + return crlgen_AddCrlNumber(crlGenData, extData); + else if (!PORT_Strcmp(*extData, "reasonCode")) + return crlgen_AddEntryExtension(crlGenData, extData, "reasonCode", + crlgen_CreateReasonCode); + else if (!PORT_Strcmp(*extData, "invalidityDate")) + return crlgen_AddEntryExtension(crlGenData, extData, "invalidityDate", + crlgen_CreateInvalidityDate); + else { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + crlgen_PrintError(crlGenData->parsedLineNum, + "insufficient number of arguments.\n"); + return SECFailure; + } +} + + + +/* Created CRLGENEntryData for cert with serial number certId and + * adds it to entryDataHashTable. certId can be a single cert serial + * number or an inclusive rage of certs */ +static SECStatus +crlgen_AddCert(CRLGENGeneratorData *crlGenData, + char *certId, char *revocationDate) +{ + CERTSignedCrl *signCrl; + SECItem *certIdItem; + PRArenaPool *arena; + PRUint64 rangeFrom = 0, rangeTo = 0, i = 0; + int timeValLength = -1; + SECStatus rv = SECFailure; + void *mark; + + + PORT_Assert(crlGenData && crlGenData->signCrl && + crlGenData->signCrl->arena); + if (!crlGenData || !crlGenData->signCrl || !crlGenData->signCrl->arena) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + + signCrl = crlGenData->signCrl; + arena = signCrl->arena; + + if (!certId || !revocationDate) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + crlgen_PrintError(crlGenData->parsedLineNum, + "insufficient number of arguments.\n"); + return SECFailure; + } + + timeValLength = strlen(revocationDate); + + if (crlgen_SetNewRangeField(crlGenData, certId) == SECFailure && + certId) { + return SECFailure; + } + rangeFrom = crlGenData->rangeFrom; + rangeTo = crlGenData->rangeTo; + + for (i = 0;i < rangeTo - rangeFrom + 1;i++) { + CERTCrlEntry *entry; + mark = PORT_ArenaMark(arena); + entry = PORT_ArenaZNew(arena, CERTCrlEntry); + if (entry == NULL) { + goto loser; + } + + certIdItem = SEC_ASN1EncodeInteger(arena, &entry->serialNumber, + rangeFrom + i); + if (!certIdItem) { + goto loser; + } + + if (crlgen_FindEntry(crlGenData, certIdItem)) { + crlgen_PrintError(crlGenData->parsedLineNum, + "entry already exists. Use \"range\" " + "and \"rmcert\" before adding a new one with the " + "same serial number %ld\n", rangeFrom + i); + goto loser; + } + + entry->serialNumber.type = siBuffer; + + entry->revocationDate.type = siGeneralizedTime; + + entry->revocationDate.data = + PORT_ArenaAlloc(arena, timeValLength); + if (entry->revocationDate.data == NULL) { + goto loser; + } + + PORT_Memcpy(entry->revocationDate.data, revocationDate, + timeValLength * sizeof(char)); + entry->revocationDate.len = timeValLength; + + + entry->extensions = NULL; + if (!crlgen_PlaceAnEntry(crlGenData, entry, certIdItem)) { + goto loser; + } + mark = NULL; + } + + rv = SECSuccess; + loser: + if (mark) { + PORT_ArenaRelease(arena, mark); + } + return rv; +} + + +/* Removes certs from entryDataHashTable which have certId serial number. + * certId can have value of a range of certs */ +static SECStatus +crlgen_RmCert(CRLGENGeneratorData *crlGenData, char *certId) +{ + PRUint64 i = 0; + PRArenaPool *arena; + + PORT_Assert(crlGenData && certId); + if (!crlGenData || !certId) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + + arena = crlGenData->signCrl->arena; + + if (crlgen_SetNewRangeField(crlGenData, certId) == SECFailure && + certId) { + return SECFailure; + } + + for (i = 0;i < crlGenData->rangeTo - crlGenData->rangeFrom + 1;i++) { + SECItem* certIdItem = SEC_ASN1EncodeInteger(NULL, NULL, + crlGenData->rangeFrom + i); + if (certIdItem) { + CRLGENEntryData *extData = + crlgen_FindEntry(crlGenData, certIdItem); + if (!extData) { + printf("Cert with id %s is not in the list\n", certId); + } else { + crlgen_RmEntry(crlGenData, certIdItem); + } + SECITEM_FreeItem(certIdItem, PR_TRUE); + } + } + + return SECSuccess; +} + +/************************************************************************* + * Lex Parser Helper functions are used to store parsed information + * in context related structures. Context(or state) is identified base on + * a type of a instruction parser currently is going through. New context + * is identified by first token in a line. It can be addcert context, + * addext context, etc. */ + +/* Updates CRL field depending on current context */ +static SECStatus +crlgen_updateCrlFn_field(CRLGENGeneratorData *crlGenData, void *str) +{ + CRLGENCrlField *fieldStr = (CRLGENCrlField*)str; + + PORT_Assert(crlGenData); + if (!crlGenData) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + + switch(crlGenData->contextId) { + case CRLGEN_ISSUER_CONTEXT: + crlgen_SetIssuerField(crlGenData, fieldStr->value); + break; + case CRLGEN_UPDATE_CONTEXT: + return crlgen_SetTimeField(crlGenData, fieldStr->value, PR_TRUE); + break; + case CRLGEN_NEXT_UPDATE_CONTEXT: + return crlgen_SetTimeField(crlGenData, fieldStr->value, PR_FALSE); + break; + case CRLGEN_CHANGE_RANGE_CONTEXT: + return crlgen_SetNewRangeField(crlGenData, fieldStr->value); + break; + default: + crlgen_PrintError(crlGenData->parsedLineNum, + "syntax error (unknow token type: %d)\n", + crlGenData->contextId); + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + return SECSuccess; +} + +/* Sets parsed data for CRL field update into temporary structure */ +static SECStatus +crlgen_setNextDataFn_field(CRLGENGeneratorData *crlGenData, void *str, + void *data, unsigned short dtype) +{ + CRLGENCrlField *fieldStr = (CRLGENCrlField*)str; + + PORT_Assert(crlGenData); + if (!crlGenData) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + + switch (crlGenData->contextId) { + case CRLGEN_CHANGE_RANGE_CONTEXT: + if (dtype != CRLGEN_TYPE_DIGIT || dtype != CRLGEN_TYPE_DIGIT_RANGE) { + crlgen_PrintError(crlGenData->parsedLineNum, + "range value should have " + "numeric or numeric range values.\n"); + return SECFailure; + } + break; + case CRLGEN_NEXT_UPDATE_CONTEXT: + case CRLGEN_UPDATE_CONTEXT: + if (dtype != CRLGEN_TYPE_ZDATE){ + crlgen_PrintError(crlGenData->parsedLineNum, + "bad formated date. Should be " + "YYYYMMDDHHMMSSZ.\n"); + return SECFailure; + } + break; + default: + PORT_SetError(SEC_ERROR_INVALID_ARGS); + crlgen_PrintError(crlGenData->parsedLineNum, + "syntax error (unknow token type: %d).\n", + crlGenData->contextId, data); + return SECFailure; + } + fieldStr->value = PORT_Strdup(data); + if (!fieldStr->value) { + return SECFailure; + } + return SECSuccess; +} + +/* Triggers cert entries update depending on current context */ +static SECStatus +crlgen_updateCrlFn_cert(CRLGENGeneratorData *crlGenData, void *str) +{ + CRLGENCertEntry *certStr = (CRLGENCertEntry*)str; + + PORT_Assert(crlGenData); + if (!crlGenData) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + + switch(crlGenData->contextId) { + case CRLGEN_ADD_CERT_CONTEXT: + return crlgen_AddCert(crlGenData, certStr->certId, + certStr->revocationTime); + case CRLGEN_RM_CERT_CONTEXT: + return crlgen_RmCert(crlGenData, certStr->certId); + default: + PORT_SetError(SEC_ERROR_INVALID_ARGS); + crlgen_PrintError(crlGenData->parsedLineNum, + "syntax error (unknow token type: %d).\n", + crlGenData->contextId); + return SECFailure; + } +} + + +/* Sets parsed data for CRL entries update into temporary structure */ +static SECStatus +crlgen_setNextDataFn_cert(CRLGENGeneratorData *crlGenData, void *str, + void *data, unsigned short dtype) +{ + CRLGENCertEntry *certStr = (CRLGENCertEntry*)str; + + PORT_Assert(crlGenData); + if (!crlGenData) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + + switch(dtype) { + case CRLGEN_TYPE_DIGIT: + case CRLGEN_TYPE_DIGIT_RANGE: + certStr->certId = PORT_Strdup(data); + if (!certStr->certId) { + return SECFailure; + } + break; + case CRLGEN_TYPE_DATE: + case CRLGEN_TYPE_ZDATE: + certStr->revocationTime = PORT_Strdup(data); + if (!certStr->revocationTime) { + return SECFailure; + } + break; + default: + PORT_SetError(SEC_ERROR_INVALID_ARGS); + crlgen_PrintError(crlGenData->parsedLineNum, + "syntax error (unknow token type: %d).\n", + crlGenData->contextId); + return SECFailure; + } + return SECSuccess; +} + +/* Triggers cert entries/crl extension update */ +static SECStatus +crlgen_updateCrlFn_extension(CRLGENGeneratorData *crlGenData, void *str) +{ + CRLGENExtensionEntry *extStr = (CRLGENExtensionEntry*)str; + + return crlgen_AddExtension(crlGenData, (const char**)extStr->extData); +} + +/* Defines maximum number of fields extension may have */ +#define MAX_EXT_DATA_LENGTH 10 + +/* Sets parsed extension data for CRL entries/CRL extensions update + * into temporary structure */ +static SECStatus +crlgen_setNextDataFn_extension(CRLGENGeneratorData *crlGenData, void *str, + void *data, unsigned short dtype) +{ + CRLGENExtensionEntry *extStr = (CRLGENExtensionEntry*)str; + + PORT_Assert(crlGenData); + if (!crlGenData) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + + if (extStr->extData == NULL) { + extStr->extData = PORT_ZNewArray(char *, MAX_EXT_DATA_LENGTH); + if (!extStr->extData) { + return SECFailure; + } + } + if (extStr->nextUpdatedData >= MAX_EXT_DATA_LENGTH) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + crlgen_PrintError(crlGenData->parsedLineNum, + "number of fields in extension " + "exceeded maximum allowed data length: %d.\n", + MAX_EXT_DATA_LENGTH); + return SECFailure; + } + extStr->extData[extStr->nextUpdatedData] = PORT_Strdup(data); + if (!extStr->extData[extStr->nextUpdatedData]) { + return SECFailure; + } + extStr->nextUpdatedData += 1; + + return SECSuccess; +} + + +/**************************************************************************************** + * Top level functions are triggered directly by parser. + */ + +/* + * crl generation script parser recreates a temporary data staructure + * for each line it is going through. This function cleans temp structure. + */ +void +crlgen_destroyTempData(CRLGENGeneratorData *crlGenData) +{ + if (crlGenData->contextId != CRLGEN_UNKNOWN_CONTEXT) { + switch(crlGenData->contextId) { + case CRLGEN_ISSUER_CONTEXT: + case CRLGEN_UPDATE_CONTEXT: + case CRLGEN_NEXT_UPDATE_CONTEXT: + case CRLGEN_CHANGE_RANGE_CONTEXT: + if (crlGenData->crlField->value) + PORT_Free(crlGenData->crlField->value); + PORT_Free(crlGenData->crlField); + break; + case CRLGEN_ADD_CERT_CONTEXT: + case CRLGEN_RM_CERT_CONTEXT: + if (crlGenData->certEntry->certId) + PORT_Free(crlGenData->certEntry->certId); + if (crlGenData->certEntry->revocationTime) + PORT_Free(crlGenData->certEntry->revocationTime); + PORT_Free(crlGenData->certEntry); + break; + case CRLGEN_ADD_EXTENSION_CONTEXT: + if (crlGenData->extensionEntry->extData) { + int i = 0; + for (;i < crlGenData->extensionEntry->nextUpdatedData;i++) + PORT_Free(*(crlGenData->extensionEntry->extData + i)); + PORT_Free(crlGenData->extensionEntry->extData); + } + PORT_Free(crlGenData->extensionEntry); + break; + } + crlGenData->contextId = CRLGEN_UNKNOWN_CONTEXT; + } +} + +SECStatus +crlgen_updateCrl(CRLGENGeneratorData *crlGenData) +{ + SECStatus rv = SECSuccess; + + PORT_Assert(crlGenData); + if (!crlGenData) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + + switch(crlGenData->contextId) { + case CRLGEN_ISSUER_CONTEXT: + case CRLGEN_UPDATE_CONTEXT: + case CRLGEN_NEXT_UPDATE_CONTEXT: + case CRLGEN_CHANGE_RANGE_CONTEXT: + rv = crlGenData->crlField->updateCrlFn(crlGenData, crlGenData->crlField); + break; + case CRLGEN_RM_CERT_CONTEXT: + case CRLGEN_ADD_CERT_CONTEXT: + rv = crlGenData->certEntry->updateCrlFn(crlGenData, crlGenData->certEntry); + break; + case CRLGEN_ADD_EXTENSION_CONTEXT: + rv = crlGenData->extensionEntry-> + updateCrlFn(crlGenData, crlGenData->extensionEntry); + break; + case CRLGEN_UNKNOWN_CONTEXT: + break; + default: + crlgen_PrintError(crlGenData->parsedLineNum, + "unknown lang context type code: %d.\n", + crlGenData->contextId); + PORT_Assert(0); + return SECFailure; + } + /* Clrean structures after crl update */ + crlgen_destroyTempData(crlGenData); + + crlGenData->parsedLineNum += 1; + + return rv; +} + +SECStatus +crlgen_setNextData(CRLGENGeneratorData *crlGenData, void *data, + unsigned short dtype) +{ + SECStatus rv = SECSuccess; + + PORT_Assert(crlGenData); + if (!crlGenData) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + + switch(crlGenData->contextId) { + case CRLGEN_ISSUER_CONTEXT: + case CRLGEN_UPDATE_CONTEXT: + case CRLGEN_NEXT_UPDATE_CONTEXT: + case CRLGEN_CHANGE_RANGE_CONTEXT: + rv = crlGenData->crlField->setNextDataFn(crlGenData, crlGenData->crlField, + data, dtype); + break; + case CRLGEN_ADD_CERT_CONTEXT: + case CRLGEN_RM_CERT_CONTEXT: + rv = crlGenData->certEntry->setNextDataFn(crlGenData, crlGenData->certEntry, + data, dtype); + break; + case CRLGEN_ADD_EXTENSION_CONTEXT: + rv = + crlGenData->extensionEntry-> + setNextDataFn(crlGenData, crlGenData->extensionEntry, data, dtype); + break; + case CRLGEN_UNKNOWN_CONTEXT: + break; + default: + crlgen_PrintError(crlGenData->parsedLineNum, + "unknown context type: %d.\n", + crlGenData->contextId); + PORT_Assert(0); + return SECFailure; + } + return rv; +} + +SECStatus +crlgen_createNewLangStruct(CRLGENGeneratorData *crlGenData, + unsigned structType) +{ + PORT_Assert(crlGenData && + crlGenData->contextId == CRLGEN_UNKNOWN_CONTEXT); + if (!crlGenData || + crlGenData->contextId != CRLGEN_UNKNOWN_CONTEXT) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return SECFailure; + } + + switch(structType) { + case CRLGEN_ISSUER_CONTEXT: + case CRLGEN_UPDATE_CONTEXT: + case CRLGEN_NEXT_UPDATE_CONTEXT: + case CRLGEN_CHANGE_RANGE_CONTEXT: + crlGenData->crlField = PORT_New(CRLGENCrlField); + if (!crlGenData->crlField) { + return SECFailure; + } + crlGenData->contextId = structType; + crlGenData->crlField->value = NULL; + crlGenData->crlField->updateCrlFn = &crlgen_updateCrlFn_field; + crlGenData->crlField->setNextDataFn = &crlgen_setNextDataFn_field; + break; + case CRLGEN_RM_CERT_CONTEXT: + case CRLGEN_ADD_CERT_CONTEXT: + crlGenData->certEntry = PORT_New(CRLGENCertEntry); + if (!crlGenData->certEntry) { + return SECFailure; + } + crlGenData->contextId = structType; + crlGenData->certEntry->certId = 0; + crlGenData->certEntry->revocationTime = NULL; + crlGenData->certEntry->updateCrlFn = &crlgen_updateCrlFn_cert; + crlGenData->certEntry->setNextDataFn = &crlgen_setNextDataFn_cert; + break; + case CRLGEN_ADD_EXTENSION_CONTEXT: + crlGenData->extensionEntry = PORT_New(CRLGENExtensionEntry); + if (!crlGenData->extensionEntry) { + return SECFailure; + } + crlGenData->contextId = structType; + crlGenData->extensionEntry->extData = NULL; + crlGenData->extensionEntry->nextUpdatedData = 0; + crlGenData->extensionEntry->updateCrlFn = + &crlgen_updateCrlFn_extension; + crlGenData->extensionEntry->setNextDataFn = + &crlgen_setNextDataFn_extension; + break; + case CRLGEN_UNKNOWN_CONTEXT: + break; + default: + crlgen_PrintError(crlGenData->parsedLineNum, + "unknown context type: %d.\n", structType); + PORT_Assert(0); + return SECFailure; + } + return SECSuccess; +} + + +/* Parser initialization function */ +CRLGENGeneratorData* +CRLGEN_InitCrlGeneration(CERTSignedCrl *signCrl, PRFileDesc *src) +{ + CRLGENGeneratorData *crlGenData = NULL; + + PORT_Assert(signCrl && src); + if (!signCrl || !src) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + return NULL; + } + + crlGenData = PORT_ZNew(CRLGENGeneratorData); + if (!crlGenData) { + return NULL; + } + + crlGenData->entryDataHashTable = + PL_NewHashTable(0, SECITEM_Hash, SECITEM_HashCompare, + PL_CompareValues, NULL, NULL); + if (!crlGenData->entryDataHashTable) { + PORT_Free(crlGenData); + return NULL; + } + + crlGenData->src = src; + crlGenData->parsedLineNum = 1; + crlGenData->contextId = CRLGEN_UNKNOWN_CONTEXT; + crlGenData->signCrl = signCrl; + crlGenData->rangeFrom = 0; + crlGenData->rangeTo = 0; + crlGenData->crlExtHandle = NULL; + + PORT_SetError(0); + + return crlGenData; +} + +void +CRLGEN_FinalizeCrlGeneration(CRLGENGeneratorData *crlGenData) +{ + if (!crlGenData) + return; + if (crlGenData->src) + PR_Close(crlGenData->src); + PL_HashTableDestroy(crlGenData->entryDataHashTable); + PORT_Free(crlGenData); +} + diff --git a/mozilla/security/nss/cmd/crlutil/crlgen.h b/mozilla/security/nss/cmd/crlutil/crlgen.h new file mode 100644 index 0000000..4eb5304 --- /dev/null +++ b/mozilla/security/nss/cmd/crlutil/crlgen.h @@ -0,0 +1,182 @@ + +#ifndef _CRLGEN_H_ +#define _CRLGEN_H_ + +#include "prio.h" +#include "prprf.h" +#include "plhash.h" +#include "seccomon.h" +#include "certt.h" +#include "secoidt.h" + + +#define CRLGEN_UNKNOWN_CONTEXT 0 +#define CRLGEN_ISSUER_CONTEXT 1 +#define CRLGEN_UPDATE_CONTEXT 2 +#define CRLGEN_NEXT_UPDATE_CONTEXT 3 +#define CRLGEN_ADD_EXTENSION_CONTEXT 4 +#define CRLGEN_ADD_CERT_CONTEXT 6 +#define CRLGEN_CHANGE_RANGE_CONTEXT 7 +#define CRLGEN_RM_CERT_CONTEXT 8 + +#define CRLGEN_TYPE_DATE 0 +#define CRLGEN_TYPE_ZDATE 1 +#define CRLGEN_TYPE_DIGIT 2 +#define CRLGEN_TYPE_DIGIT_RANGE 3 +#define CRLGEN_TYPE_OID 4 +#define CRLGEN_TYPE_STRING 5 +#define CRLGEN_TYPE_ID 6 + + +typedef struct CRLGENGeneratorDataStr CRLGENGeneratorData; +typedef struct CRLGENEntryDataStr CRLGENEntryData; +typedef struct CRLGENExtensionEntryStr CRLGENExtensionEntry; +typedef struct CRLGENCertEntrySrt CRLGENCertEntry; +typedef struct CRLGENCrlFieldStr CRLGENCrlField; +typedef struct CRLGENEntriesSortedDataStr CRLGENEntriesSortedData; + +/* Exported functions */ + +/* Used for initialization of extension handles for crl and certs + * extensions from existing CRL data then modifying existing CRL.*/ +extern SECStatus CRLGEN_ExtHandleInit(CRLGENGeneratorData *crlGenData); + +/* Commits all added entries and their's extensions into CRL. */ +extern SECStatus CRLGEN_CommitExtensionsAndEntries(CRLGENGeneratorData *crlGenData); + +/* Lunches the crl generation script parse */ +extern SECStatus CRLGEN_StartCrlGen(CRLGENGeneratorData *crlGenData); + +/* Closes crl generation script file and frees crlGenData */ +extern void CRLGEN_FinalizeCrlGeneration(CRLGENGeneratorData *crlGenData); + +/* Parser initialization function. Creates CRLGENGeneratorData structure + * for the current thread */ +extern CRLGENGeneratorData* CRLGEN_InitCrlGeneration(CERTSignedCrl *newCrl, + PRFileDesc *src); + + +/* This lock is defined in crlgen_lex.c(derived from crlgen_lex.l). + * It controls access to invocation of yylex, allows to parse one + * script at a time */ +extern void CRLGEN_InitCrlGenParserLock(); +extern void CRLGEN_DestroyCrlGenParserLock(); + + +/* The following function types are used to define functions for each of + * CRLGENExtensionEntryStr, CRLGENCertEntrySrt, CRLGENCrlFieldStr to + * provide functionality needed for these structures*/ +typedef SECStatus updateCrlFn_t(CRLGENGeneratorData *crlGenData, void *str); +typedef SECStatus setNextDataFn_t(CRLGENGeneratorData *crlGenData, void *str, + void *data, unsigned short dtype); +typedef SECStatus createNewLangStructFn_t(CRLGENGeneratorData *crlGenData, + void *str, unsigned i); + +/* Sets reports failure to parser if anything goes wrong */ +extern void crlgen_setFailure(CRLGENGeneratorData *str, char *); + +/* Collects data in to one of the current data structure that corresponds + * to the correct context type. This function gets called after each token + * is found for a particular line */ +extern SECStatus crlgen_setNextData(CRLGENGeneratorData *str, void *data, + unsigned short dtype); + +/* initiates crl update with collected data. This function is called at the + * end of each line */ +extern SECStatus crlgen_updateCrl(CRLGENGeneratorData *str); + +/* Creates new context structure depending on token that was parsed + * at the beginning of a line */ +extern SECStatus crlgen_createNewLangStruct(CRLGENGeneratorData *str, + unsigned structType); + + +/* CRLGENExtensionEntry is used to store addext request data for either + * CRL extensions or CRL entry extensions. The differentiation between + * is based on order and type of extension been added. + * - extData : all data in request staring from name of the extension are + * in saved here. + * - nextUpdatedData: counter of elements added to extData + */ +struct CRLGENExtensionEntryStr { + char **extData; + int nextUpdatedData; + updateCrlFn_t *updateCrlFn; + setNextDataFn_t *setNextDataFn; +}; + +/* CRLGENCeryestEntry is used to store addcert request data + * - certId : certificate id or range of certificate with dash as a delimiter + * All certs from range will be inclusively added to crl + * - revocationTime: revocation time of cert(s) + */ +struct CRLGENCertEntrySrt { + char *certId; + char *revocationTime; + updateCrlFn_t *updateCrlFn; + setNextDataFn_t *setNextDataFn; +}; + + +/* CRLGENCrlField is used to store crl fields record like update time, next + * update time, etc. + * - value: value of the parsed field data*/ +struct CRLGENCrlFieldStr { + char *value; + updateCrlFn_t *updateCrlFn; + setNextDataFn_t *setNextDataFn; +}; + +/* Can not create entries extension until completely done with parsing. + * Therefore need to keep joined data + * - certId : serial number of certificate + * - extHandle: head pointer to a list of extensions that belong to + * entry + * - entry : CERTCrlEntry structure pointer*/ +struct CRLGENEntryDataStr { + SECItem *certId; + void *extHandle; + CERTCrlEntry *entry; +}; + +/* Crl generator/parser main structure. Keeps info regarding current state of + * parser(context, status), parser helper functions pointers, parsed data and + * generated data. + * - contextId : current parsing context. Context in this parser environment + * defines what type of crl operations parser is going through + * in the current line of crl generation script. + * setting or new cert or an extension addition, etc. + * - createNewLangStructFn: pointer to top level function which creates + * data structures according contextId + * - setNextDataFn : pointer to top level function which sets new parsed data + * in temporary structure + * - updateCrlFn : pointer to top level function which triggers actual + * crl update functions with gathered data + * - union : data union create according to contextId + * - rangeFrom, rangeTo : holds last range in which certs was added + * - newCrl : pointer to CERTSignedCrl newly created crl + * - crlExtHandle : pointer to crl extension handle + * - entryDataHashTable: hash of CRLGENEntryData. + * key: cert serial number + * data: CRLGENEntryData pointer + * - parserStatus : current status of parser. Triggers parser to abort when + * set to SECFailure + * - src : PRFileDesc structure pointer of crl generator config file + * - parsedLineNum : currently parsing line. Keeping it to report errors */ +struct CRLGENGeneratorDataStr { + unsigned short contextId; + CRLGENCrlField *crlField; + CRLGENCertEntry *certEntry; + CRLGENExtensionEntry *extensionEntry; + PRUint64 rangeFrom; + PRUint64 rangeTo; + CERTSignedCrl *signCrl; + void *crlExtHandle; + PLHashTable *entryDataHashTable; + + PRFileDesc *src; + int parsedLineNum; +}; + + +#endif /* _CRLGEN_H_ */ diff --git a/mozilla/security/nss/cmd/crlutil/crlgen_lex.c b/mozilla/security/nss/cmd/crlutil/crlgen_lex.c new file mode 100644 index 0000000..ee07a68 --- /dev/null +++ b/mozilla/security/nss/cmd/crlutil/crlgen_lex.c @@ -0,0 +1,1783 @@ +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header: /cvsroot/mozilla/security/nss/cmd/crlutil/crlgen_lex.c,v 1.2 2009/02/04 23:23:40 alexei.volkov.bugs%sun.com Exp $ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +#include +#ifdef _WIN32 +#include +#else +#include +#endif + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + +#ifdef __cplusplus + +#include + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_PROTOS +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include +#include +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yytext_ptr ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +typedef unsigned int yy_size_t; + + +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +static YY_BUFFER_STATE yy_current_buffer = 0; + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_file )); + +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + +typedef unsigned char YY_CHAR; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +typedef int yy_state_type; +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yytext_ptr -= yy_more_len; \ + yyleng = (int) (yy_cp - yytext_ptr); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 17 +#define YY_END_OF_BUFFER 18 +static yyconst short int yy_accept[67] = + { 0, + 0, 0, 18, 16, 14, 15, 16, 11, 12, 2, + 10, 9, 9, 9, 9, 9, 13, 14, 15, 11, + 12, 0, 12, 2, 9, 9, 9, 9, 9, 13, + 3, 4, 2, 9, 9, 9, 9, 2, 9, 9, + 9, 9, 2, 2, 9, 9, 8, 9, 2, 5, + 9, 6, 2, 9, 2, 9, 2, 9, 2, 7, + 2, 2, 2, 2, 1, 0 + } ; + +static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 5, 6, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 7, 8, 1, 9, 9, 10, + 11, 12, 12, 12, 13, 13, 13, 14, 1, 1, + 15, 1, 1, 1, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, + 1, 1, 1, 1, 1, 1, 18, 16, 16, 19, + + 20, 16, 21, 16, 22, 16, 16, 16, 16, 23, + 16, 24, 16, 25, 26, 27, 28, 16, 16, 29, + 16, 16, 1, 14, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst int yy_meta[30] = + { 0, + 1, 1, 2, 1, 3, 1, 1, 4, 5, 5, + 5, 5, 5, 4, 1, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4 + } ; + +static yyconst short int yy_base[72] = + { 0, + 0, 149, 154, 205, 138, 205, 103, 0, 0, 23, + 205, 29, 30, 31, 32, 33, 0, 99, 205, 0, + 0, 0, 50, 55, 34, 61, 41, 63, 64, 0, + 0, 0, 79, 65, 68, 86, 66, 99, 105, 88, + 106, 90, 118, 76, 107, 110, 89, 125, 43, 91, + 127, 128, 138, 144, 113, 129, 154, 160, 160, 130, + 172, 166, 177, 144, 0, 205, 190, 192, 194, 199, + 76 + } ; + +static yyconst short int yy_def[72] = + { 0, + 66, 1, 66, 66, 66, 66, 66, 67, 68, 68, + 66, 69, 69, 69, 69, 69, 70, 66, 66, 67, + 68, 71, 68, 10, 69, 69, 69, 69, 69, 70, + 71, 23, 10, 69, 69, 69, 69, 10, 69, 69, + 69, 69, 10, 38, 69, 69, 69, 69, 38, 69, + 69, 69, 38, 69, 38, 69, 38, 69, 38, 69, + 38, 38, 38, 38, 68, 0, 66, 66, 66, 66, + 66 + } ; + +static yyconst short int yy_nxt[235] = + { 0, + 4, 5, 6, 7, 8, 4, 4, 9, 10, 10, + 10, 10, 10, 9, 11, 12, 12, 12, 12, 12, + 12, 13, 14, 12, 15, 12, 12, 16, 12, 22, + 23, 24, 24, 24, 24, 24, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 28, + 27, 53, 53, 53, 21, 26, 29, 32, 32, 32, + 32, 32, 32, 33, 33, 33, 33, 33, 21, 35, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 31, 21, 37, 42, 44, 36, 34, 38, 38, 38, + 38, 38, 39, 21, 40, 21, 21, 21, 21, 21, + + 18, 21, 21, 21, 21, 19, 41, 43, 44, 44, + 44, 44, 21, 21, 21, 46, 48, 21, 21, 21, + 21, 57, 57, 21, 45, 47, 49, 49, 49, 49, + 49, 50, 21, 51, 21, 21, 21, 21, 21, 18, + 21, 21, 21, 21, 52, 54, 55, 55, 55, 55, + 55, 21, 44, 66, 17, 58, 66, 21, 66, 66, + 65, 56, 59, 59, 59, 59, 59, 21, 61, 61, + 61, 61, 66, 21, 63, 63, 63, 63, 66, 60, + 62, 62, 62, 62, 62, 64, 64, 64, 64, 64, + 20, 20, 66, 20, 20, 21, 21, 25, 25, 30, + + 66, 30, 30, 30, 3, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66 + } ; + +static yyconst short int yy_chk[235] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, + 10, 10, 10, 10, 10, 10, 12, 13, 14, 15, + 16, 25, 12, 13, 14, 15, 16, 25, 27, 15, + 14, 49, 49, 49, 27, 13, 16, 23, 23, 23, + 23, 23, 23, 24, 24, 24, 24, 24, 26, 27, + 28, 29, 34, 37, 26, 35, 28, 29, 34, 37, + 71, 35, 29, 37, 44, 28, 26, 33, 33, 33, + 33, 33, 34, 36, 35, 40, 47, 42, 50, 36, + + 18, 40, 47, 42, 50, 7, 36, 38, 38, 38, + 38, 38, 39, 41, 45, 40, 42, 46, 39, 41, + 45, 55, 55, 46, 39, 41, 43, 43, 43, 43, + 43, 45, 48, 46, 51, 52, 56, 60, 48, 5, + 51, 52, 56, 60, 48, 51, 53, 53, 53, 53, + 53, 54, 64, 3, 2, 56, 0, 54, 0, 0, + 64, 54, 57, 57, 57, 57, 57, 58, 59, 59, + 59, 59, 0, 58, 62, 62, 62, 62, 0, 58, + 61, 61, 61, 61, 61, 63, 63, 63, 63, 63, + 67, 67, 0, 67, 67, 68, 68, 69, 69, 70, + + 0, 70, 70, 70, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +static int yy_more_flag = 0; +static int yy_more_len = 0; +#define yymore() (yy_more_flag = 1) +#define YY_MORE_ADJ yy_more_len +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "crlgen_lex_orig.l" +#define INITIAL 0 +#line 2 "crlgen_lex_orig.l" + +#include "crlgen.h" + +static SECStatus parserStatus = SECSuccess; +static CRLGENGeneratorData *parserData; +static PRFileDesc *src; + +#define YY_INPUT(buf,result,max_size) \ + if ( parserStatus != SECFailure) { \ + if (((result = PR_Read(src, buf, max_size)) == 0) && \ + ferror( yyin )) \ + return SECFailure; \ + } else { return SECFailure; } + + + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +static void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen YY_PROTO(( yyconst char * )); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +#endif + +#if YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#endif +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ + +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL int yylex YY_PROTO(( void )) +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + if ( yyleng > 0 ) \ + yy_current_buffer->yy_at_bol = \ + (yytext[yyleng - 1] == '\n'); \ + YY_USER_ACTION + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp = NULL, *yy_bp = NULL; + register int yy_act; + +#line 28 "crlgen_lex_orig.l" + + + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_more_len = 0; + if ( yy_more_flag ) + { + yy_more_len = yy_c_buf_p - yytext_ptr; + yy_more_flag = 0; + } + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yy_start; + yy_current_state += YY_AT_BOL(); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 67 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 205 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + +do_action: /* This label is used only to access EOF actions. */ + + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 30 "crlgen_lex_orig.l" +{ +parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_ZDATE); +if (parserStatus != SECSuccess) + return parserStatus; +} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 36 "crlgen_lex_orig.l" +{ +parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_DIGIT); +if (parserStatus != SECSuccess) + return parserStatus; +} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 42 "crlgen_lex_orig.l" +{ +parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_DIGIT_RANGE); +if (parserStatus != SECSuccess) + return parserStatus; +} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 48 "crlgen_lex_orig.l" +{ +parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_OID); +if (parserStatus != SECSuccess) + return parserStatus; +} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 54 "crlgen_lex_orig.l" +{ +parserStatus = crlgen_createNewLangStruct(parserData, CRLGEN_ISSUER_CONTEXT); +if (parserStatus != SECSuccess) + return parserStatus; +} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 60 "crlgen_lex_orig.l" +{ +parserStatus = crlgen_createNewLangStruct(parserData, CRLGEN_UPDATE_CONTEXT); +if (parserStatus != SECSuccess) + return parserStatus; +} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 65 "crlgen_lex_orig.l" +{ +parserStatus = crlgen_createNewLangStruct(parserData, CRLGEN_NEXT_UPDATE_CONTEXT); +if (parserStatus != SECSuccess) + return parserStatus; +} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 71 "crlgen_lex_orig.l" +{ +parserStatus = crlgen_createNewLangStruct(parserData, CRLGEN_CHANGE_RANGE_CONTEXT); +if (parserStatus != SECSuccess) + return parserStatus; +} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 77 "crlgen_lex_orig.l" +{ +if (strcmp(yytext, "addcert") == 0) { + parserStatus = crlgen_createNewLangStruct(parserData, + CRLGEN_ADD_CERT_CONTEXT); + if (parserStatus != SECSuccess) + return parserStatus; +} else if (strcmp(yytext, "rmcert") == 0) { + parserStatus = crlgen_createNewLangStruct(parserData, + CRLGEN_RM_CERT_CONTEXT); + if (parserStatus != SECSuccess) + return parserStatus; +} else if (strcmp(yytext, "addext") == 0) { + parserStatus = crlgen_createNewLangStruct(parserData, + CRLGEN_ADD_EXTENSION_CONTEXT); + if (parserStatus != SECSuccess) + return parserStatus; +} else { + parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_ID); + if (parserStatus != SECSuccess) + return parserStatus; +} +} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 100 "crlgen_lex_orig.l" + + YY_BREAK +case 11: +YY_RULE_SETUP +#line 102 "crlgen_lex_orig.l" +{ +if (yytext[yyleng-1] == '\\') { + yymore(); +} else { + register int c; + c = input(); + if (c != '\"') { + printf( "Error: Line ending \" is missing: %c\n", c); + unput(c); + } else { + parserStatus = crlgen_setNextData(parserData, yytext + 1, + CRLGEN_TYPE_STRING); + if (parserStatus != SECSuccess) + return parserStatus; + } +} +} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 120 "crlgen_lex_orig.l" +{ +parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_STRING); +if (parserStatus != SECSuccess) + return parserStatus; +} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 128 "crlgen_lex_orig.l" +/* eat up one-line comments */ {} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 130 "crlgen_lex_orig.l" +{} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 132 "crlgen_lex_orig.l" +{ +parserStatus = crlgen_updateCrl(parserData); +if (parserStatus != SECSuccess) + return parserStatus; +} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 138 "crlgen_lex_orig.l" +{ + fprintf(stderr, "Syntax error at line %d: unknown token %s\n", + parserData->parsedLineNum, yytext); + return SECFailure; +} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 144 "crlgen_lex_orig.l" +ECHO; + YY_BREAK +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + +static int yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_current_buffer->yy_n_chars = yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +static yy_state_type yy_get_previous_state() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + yy_current_state += YY_AT_BOL(); + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 67 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; + } + + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif + { + register int yy_is_jam; + register char *yy_cp = yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 67 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 66); + + return yy_is_jam ? 0 : yy_current_state; + } + + +#ifndef YY_NO_UNPUT +#ifdef YY_USE_PROTOS +static void yyunput( int c, register char *yy_bp ) +#else +static void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ + + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#endif + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yy_c_buf_p - yytext_ptr; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + return EOF; + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + + yy_current_buffer->yy_at_bol = (c == '\n'); + + return c; + } +#endif /* YY_NO_INPUT */ + +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +#if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif + } + + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } + + +#ifndef YY_NO_SCAN_BUFFER +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } +#endif + + +#ifndef YY_NO_SCAN_STRING +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) +#else +YY_BUFFER_STATE yy_scan_string( yy_str ) +yyconst char *yy_str; +#endif + { + int len; + for ( len = 0; yy_str[len]; ++len ) + ; + + return yy_scan_bytes( yy_str, len ); + } +#endif + + +#ifndef YY_NO_SCAN_BYTES +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +yyconst char *bytes; +int len; +#endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } +#endif + + +#ifndef YY_NO_PUSH_STATE +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + + + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +yyconst char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + +#ifdef YY_NEED_STRLEN +#ifdef YY_USE_PROTOS +static int yy_flex_strlen( yyconst char *s ) +#else +static int yy_flex_strlen( s ) +yyconst char *s; +#endif + { + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { + return (void *) malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +#line 144 "crlgen_lex_orig.l" + +#include "prlock.h" + +static PRLock *parserInvocationLock; + +void CRLGEN_InitCrlGenParserLock() +{ + parserInvocationLock = PR_NewLock(); +} + +void CRLGEN_DestroyCrlGenParserLock() +{ + PR_DestroyLock(parserInvocationLock); +} + + +SECStatus CRLGEN_StartCrlGen(CRLGENGeneratorData *parserCtlData) +{ + SECStatus rv; + + PR_Lock(parserInvocationLock); + + parserStatus = SECSuccess; + parserData = parserCtlData; + src = parserCtlData->src; + + rv = yylex(); + + PR_Unlock(parserInvocationLock); + + return rv; +} + +int yywrap() {return 1;} diff --git a/mozilla/security/nss/cmd/crlutil/crlgen_lex_fix.sed b/mozilla/security/nss/cmd/crlutil/crlgen_lex_fix.sed new file mode 100644 index 0000000..603dd2d --- /dev/null +++ b/mozilla/security/nss/cmd/crlutil/crlgen_lex_fix.sed @@ -0,0 +1,6 @@ +// { + i #ifdef _WIN32 + i #include + i #else + a #endif +} diff --git a/mozilla/security/nss/cmd/crlutil/crlgen_lex_orig.l b/mozilla/security/nss/cmd/crlutil/crlgen_lex_orig.l new file mode 100644 index 0000000..7cb1e5c --- /dev/null +++ b/mozilla/security/nss/cmd/crlutil/crlgen_lex_orig.l @@ -0,0 +1,177 @@ +%{ + +#include "crlgen.h" + +static SECStatus parserStatus = SECSuccess; +static CRLGENGeneratorData *parserData; +static PRFileDesc *src; + +#define YY_INPUT(buf,result,max_size) \ + if ( parserStatus != SECFailure) { \ + if (((result = PR_Read(src, buf, max_size)) == 0) && \ + ferror( yyin )) \ + return SECFailure; \ + } else { return SECFailure; } + + +%} + +%a 5000 +DIGIT [0-9]+ +DIGIT_RANGE [0-9]+-[0-9]+ +ID [a-zA-Z][a-zA-Z0-9]* +OID [0-9]+\.[\.0-9]+ +DATE [0-9]{4}[01][0-9][0-3][0-9][0-2][0-9][0-6][0-9][0-6][0-9] +ZDATE [0-9]{4}[01][0-9][0-3][0-9][0-2][0-9][0-6][0-9][0-6][0-9]Z +N_SP_STRING [a-zA-Z0-9\:\|\.]+ + +%% + +{ZDATE} { +parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_ZDATE); +if (parserStatus != SECSuccess) + return parserStatus; +} + +{DIGIT} { +parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_DIGIT); +if (parserStatus != SECSuccess) + return parserStatus; +} + +{DIGIT_RANGE} { +parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_DIGIT_RANGE); +if (parserStatus != SECSuccess) + return parserStatus; +} + +{OID} { +parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_OID); +if (parserStatus != SECSuccess) + return parserStatus; +} + +issuer { +parserStatus = crlgen_createNewLangStruct(parserData, CRLGEN_ISSUER_CONTEXT); +if (parserStatus != SECSuccess) + return parserStatus; +} + +update { +parserStatus = crlgen_createNewLangStruct(parserData, CRLGEN_UPDATE_CONTEXT); +if (parserStatus != SECSuccess) + return parserStatus; +} +nextupdate { +parserStatus = crlgen_createNewLangStruct(parserData, CRLGEN_NEXT_UPDATE_CONTEXT); +if (parserStatus != SECSuccess) + return parserStatus; +} + +range { +parserStatus = crlgen_createNewLangStruct(parserData, CRLGEN_CHANGE_RANGE_CONTEXT); +if (parserStatus != SECSuccess) + return parserStatus; +} + +{ID} { +if (strcmp(yytext, "addcert") == 0) { + parserStatus = crlgen_createNewLangStruct(parserData, + CRLGEN_ADD_CERT_CONTEXT); + if (parserStatus != SECSuccess) + return parserStatus; +} else if (strcmp(yytext, "rmcert") == 0) { + parserStatus = crlgen_createNewLangStruct(parserData, + CRLGEN_RM_CERT_CONTEXT); + if (parserStatus != SECSuccess) + return parserStatus; +} else if (strcmp(yytext, "addext") == 0) { + parserStatus = crlgen_createNewLangStruct(parserData, + CRLGEN_ADD_EXTENSION_CONTEXT); + if (parserStatus != SECSuccess) + return parserStatus; +} else { + parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_ID); + if (parserStatus != SECSuccess) + return parserStatus; +} +} + +"=" + +\"[^\"]* { +if (yytext[yyleng-1] == '\\') { + yymore(); +} else { + register int c; + c = input(); + if (c != '\"') { + printf( "Error: Line ending \" is missing: %c\n", c); + unput(c); + } else { + parserStatus = crlgen_setNextData(parserData, yytext + 1, + CRLGEN_TYPE_STRING); + if (parserStatus != SECSuccess) + return parserStatus; + } +} +} + +{N_SP_STRING} { +parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_STRING); +if (parserStatus != SECSuccess) + return parserStatus; +} + + + +^#[^\n]* /* eat up one-line comments */ {} + +[ \t]+ {} + +(\n|\r\n) { +parserStatus = crlgen_updateCrl(parserData); +if (parserStatus != SECSuccess) + return parserStatus; +} + +. { + fprintf(stderr, "Syntax error at line %d: unknown token %s\n", + parserData->parsedLineNum, yytext); + return SECFailure; +} + +%% +#include "prlock.h" + +static PRLock *parserInvocationLock; + +void CRLGEN_InitCrlGenParserLock() +{ + parserInvocationLock = PR_NewLock(); +} + +void CRLGEN_DestroyCrlGenParserLock() +{ + PR_DestroyLock(parserInvocationLock); +} + + +SECStatus CRLGEN_StartCrlGen(CRLGENGeneratorData *parserCtlData) +{ + SECStatus rv; + + PR_Lock(parserInvocationLock); + + parserStatus = SECSuccess; + parserData = parserCtlData; + src = parserCtlData->src; + + rv = yylex(); + + PR_Unlock(parserInvocationLock); + + return rv; +} + +int yywrap() {return 1;} diff --git a/mozilla/security/nss/cmd/crlutil/crlutil.c b/mozilla/security/nss/cmd/crlutil/crlutil.c new file mode 100644 index 0000000..ea88fc1 --- /dev/null +++ b/mozilla/security/nss/cmd/crlutil/crlutil.c @@ -0,0 +1,1089 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* +** certutil.c +** +** utility for managing certificates and the cert database +** +*/ +/* test only */ + +#include "nspr.h" +#include "plgetopt.h" +#include "secutil.h" +#include "cert.h" +#include "certi.h" +#include "certdb.h" +#include "nss.h" +#include "pk11func.h" +#include "crlgen.h" + +#define SEC_CERT_DB_EXISTS 0 +#define SEC_CREATE_CERT_DB 1 + +static char *progName; + +static CERTSignedCrl *FindCRL + (CERTCertDBHandle *certHandle, char *name, int type) +{ + CERTSignedCrl *crl = NULL; + CERTCertificate *cert = NULL; + SECItem derName; + + derName.data = NULL; + derName.len = 0; + + cert = CERT_FindCertByNicknameOrEmailAddr(certHandle, name); + if (!cert) { + CERTName *certName = NULL; + PRArenaPool *arena = NULL; + + certName = CERT_AsciiToName(name); + if (certName) { + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if (arena) { + SECItem *nameItem = + SEC_ASN1EncodeItem (arena, NULL, (void *)certName, + SEC_ASN1_GET(CERT_NameTemplate)); + if (nameItem) { + SECITEM_CopyItem(NULL, &derName, nameItem); + } + PORT_FreeArena(arena, PR_FALSE); + } + CERT_DestroyName(certName); + } + + if (!derName.len || !derName.data) { + SECU_PrintError(progName, "could not find certificate named '%s'", name); + return ((CERTSignedCrl *)NULL); + } + } else { + SECITEM_CopyItem(NULL, &derName, &cert->derSubject); + CERT_DestroyCertificate (cert); + } + + crl = SEC_FindCrlByName(certHandle, &derName, type); + if (crl ==NULL) + SECU_PrintError + (progName, "could not find %s's CRL", name); + if (derName.data) { + SECITEM_FreeItem(&derName, PR_FALSE); + } + return (crl); +} + +static SECStatus DisplayCRL (CERTCertDBHandle *certHandle, char *nickName, int crlType) +{ + CERTSignedCrl *crl = NULL; + + crl = FindCRL (certHandle, nickName, crlType); + + if (crl) { + SECU_PrintCRLInfo (stdout, &crl->crl, "CRL Info:\n", 0); + SEC_DestroyCrl (crl); + return SECSuccess; + } + return SECFailure; +} + +static void ListCRLNames (CERTCertDBHandle *certHandle, int crlType, PRBool deletecrls) +{ + CERTCrlHeadNode *crlList = NULL; + CERTCrlNode *crlNode = NULL; + CERTName *name = NULL; + PRArenaPool *arena = NULL; + SECStatus rv; + + do { + arena = PORT_NewArena (SEC_ASN1_DEFAULT_ARENA_SIZE); + if (arena == NULL) { + fprintf(stderr, "%s: fail to allocate memory\n", progName); + break; + } + + name = PORT_ArenaZAlloc (arena, sizeof(*name)); + if (name == NULL) { + fprintf(stderr, "%s: fail to allocate memory\n", progName); + break; + } + name->arena = arena; + + rv = SEC_LookupCrls (certHandle, &crlList, crlType); + if (rv != SECSuccess) { + fprintf(stderr, "%s: fail to look up CRLs (%s)\n", progName, + SECU_Strerror(PORT_GetError())); + break; + } + + /* just in case */ + if (!crlList) + break; + + crlNode = crlList->first; + + fprintf (stdout, "\n"); + fprintf (stdout, "\n%-40s %-5s\n\n", "CRL names", "CRL Type"); + while (crlNode) { + char* asciiname = NULL; + CERTCertificate *cert = NULL; + if (crlNode->crl && &crlNode->crl->crl.derName) { + cert = CERT_FindCertByName(certHandle, + &crlNode->crl->crl.derName); + if (!cert) { + SECU_PrintError(progName, "could not find signing " + "certificate in database"); + } + } + if (cert) { + char* certName = NULL; + if (cert->nickname && PORT_Strlen(cert->nickname) > 0) { + certName = cert->nickname; + } else if (cert->emailAddr && PORT_Strlen(cert->emailAddr) > 0) { + certName = cert->emailAddr; + } + if (certName) { + asciiname = PORT_Strdup(certName); + } + CERT_DestroyCertificate(cert); + } + + if (!asciiname) { + name = &crlNode->crl->crl.name; + if (!name){ + SECU_PrintError(progName, "fail to get the CRL " + "issuer name"); + continue; + } + asciiname = CERT_NameToAscii(name); + } + fprintf (stdout, "%-40s %-5s\n", asciiname, "CRL"); + if (asciiname) { + PORT_Free(asciiname); + } + if ( PR_TRUE == deletecrls) { + CERTSignedCrl* acrl = NULL; + SECItem* issuer = &crlNode->crl->crl.derName; + acrl = SEC_FindCrlByName(certHandle, issuer, crlType); + if (acrl) + { + SEC_DeletePermCRL(acrl); + SEC_DestroyCrl(acrl); + } + } + crlNode = crlNode->next; + } + + } while (0); + if (crlList) + PORT_FreeArena (crlList->arena, PR_FALSE); + PORT_FreeArena (arena, PR_FALSE); +} + +static SECStatus ListCRL (CERTCertDBHandle *certHandle, char *nickName, int crlType) +{ + if (nickName == NULL) { + ListCRLNames (certHandle, crlType, PR_FALSE); + return SECSuccess; + } + + return DisplayCRL (certHandle, nickName, crlType); +} + + + +static SECStatus DeleteCRL (CERTCertDBHandle *certHandle, char *name, int type) +{ + CERTSignedCrl *crl = NULL; + SECStatus rv = SECFailure; + + crl = FindCRL (certHandle, name, type); + if (!crl) { + SECU_PrintError + (progName, "could not find the issuer %s's CRL", name); + return SECFailure; + } + rv = SEC_DeletePermCRL (crl); + SEC_DestroyCrl(crl); + if (rv != SECSuccess) { + SECU_PrintError(progName, "fail to delete the issuer %s's CRL " + "from the perm database (reason: %s)", + name, SECU_Strerror(PORT_GetError())); + return SECFailure; + } + return (rv); +} + +SECStatus ImportCRL (CERTCertDBHandle *certHandle, char *url, int type, + PRFileDesc *inFile, PRInt32 importOptions, PRInt32 decodeOptions) +{ + CERTSignedCrl *crl = NULL; + SECItem crlDER; + PK11SlotInfo* slot = NULL; + int rv; +#if defined(DEBUG_jp96085) + PRIntervalTime starttime, endtime, elapsed; + PRUint32 mins, secs, msecs; +#endif + + crlDER.data = NULL; + + + /* Read in the entire file specified with the -f argument */ + rv = SECU_ReadDERFromFile(&crlDER, inFile, PR_FALSE); + if (rv != SECSuccess) { + SECU_PrintError(progName, "unable to read input file"); + return (SECFailure); + } + + decodeOptions |= CRL_DECODE_DONT_COPY_DER; + + slot = PK11_GetInternalKeySlot(); + +#if defined(DEBUG_jp96085) + starttime = PR_IntervalNow(); +#endif + crl = PK11_ImportCRL(slot, &crlDER, url, type, + NULL, importOptions, NULL, decodeOptions); +#if defined(DEBUG_jp96085) + endtime = PR_IntervalNow(); + elapsed = endtime - starttime; + mins = PR_IntervalToSeconds(elapsed) / 60; + secs = PR_IntervalToSeconds(elapsed) % 60; + msecs = PR_IntervalToMilliseconds(elapsed) % 1000; + printf("Elapsed : %2d:%2d.%3d\n", mins, secs, msecs); +#endif + if (!crl) { + const char *errString; + + rv = SECFailure; + errString = SECU_Strerror(PORT_GetError()); + if ( errString && PORT_Strlen (errString) == 0) + SECU_PrintError (progName, + "CRL is not imported (error: input CRL is not up to date.)"); + else + SECU_PrintError (progName, "unable to import CRL"); + } else { + SEC_DestroyCrl (crl); + } + if (slot) { + PK11_FreeSlot(slot); + } + return (rv); +} + + +static CERTCertificate* +FindSigningCert(CERTCertDBHandle *certHandle, CERTSignedCrl *signCrl, + char *certNickName) +{ + CERTCertificate *cert = NULL, *certTemp = NULL; + SECStatus rv = SECFailure; + CERTAuthKeyID* authorityKeyID = NULL; + SECItem* subject = NULL; + + PORT_Assert(certHandle != NULL); + if (!certHandle || (!signCrl && !certNickName)) { + SECU_PrintError(progName, "invalid args for function " + "FindSigningCert \n"); + return NULL; + } + + if (signCrl) { +#if 0 + authorityKeyID = SECU_FindCRLAuthKeyIDExten(tmpArena, scrl); +#endif + subject = &signCrl->crl.derName; + } else { + certTemp = CERT_FindCertByNickname(certHandle, certNickName); + if (!certTemp) { + SECU_PrintError(progName, "could not find certificate \"%s\" " + "in database", certNickName); + goto loser; + } + subject = &certTemp->derSubject; + } + + cert = SECU_FindCrlIssuer(certHandle, subject, authorityKeyID, PR_Now()); + if (!cert) { + SECU_PrintError(progName, "could not find signing certificate " + "in database"); + goto loser; + } else { + rv = SECSuccess; + } + + loser: + if (certTemp) + CERT_DestroyCertificate(certTemp); + if (cert && rv != SECSuccess) + CERT_DestroyCertificate(cert); + return cert; +} + +static CERTSignedCrl* +CreateModifiedCRLCopy(PRArenaPool *arena, CERTCertDBHandle *certHandle, + CERTCertificate **cert, char *certNickName, + PRFileDesc *inFile, PRInt32 decodeOptions, + PRInt32 importOptions) +{ + SECItem crlDER = {0, NULL, 0}; + CERTSignedCrl *signCrl = NULL; + CERTSignedCrl *modCrl = NULL; + PRArenaPool *modArena = NULL; + SECStatus rv = SECSuccess; + + if (!arena || !certHandle || !certNickName) { + PORT_SetError(SEC_ERROR_INVALID_ARGS); + SECU_PrintError(progName, "CreateModifiedCRLCopy: invalid args\n"); + return NULL; + } + + modArena = PORT_NewArena(SEC_ASN1_DEFAULT_ARENA_SIZE); + if (!modArena) { + SECU_PrintError(progName, "fail to allocate memory\n"); + return NULL; + } + + if (inFile != NULL) { + rv = SECU_ReadDERFromFile(&crlDER, inFile, PR_FALSE); + if (rv != SECSuccess) { + SECU_PrintError(progName, "unable to read input file"); + PORT_FreeArena(modArena, PR_FALSE); + goto loser; + } + + decodeOptions |= CRL_DECODE_DONT_COPY_DER; + + modCrl = CERT_DecodeDERCrlWithFlags(modArena, &crlDER, SEC_CRL_TYPE, + decodeOptions); + if (!modCrl) { + SECU_PrintError(progName, "fail to decode CRL"); + goto loser; + } + + if (0 == (importOptions & CRL_IMPORT_BYPASS_CHECKS)){ + /* If caCert is a v2 certificate, make sure that it + * can be used for crl signing purpose */ + *cert = FindSigningCert(certHandle, modCrl, NULL); + if (!*cert) { + goto loser; + } + + rv = CERT_VerifySignedData(&modCrl->signatureWrap, *cert, + PR_Now(), NULL); + if (rv != SECSuccess) { + SECU_PrintError(progName, "fail to verify signed data\n"); + goto loser; + } + } + } else { + modCrl = FindCRL(certHandle, certNickName, SEC_CRL_TYPE); + if (!modCrl) { + SECU_PrintError(progName, "fail to find crl %s in database\n", + certNickName); + goto loser; + } + } + + signCrl = PORT_ArenaZNew(arena, CERTSignedCrl); + if (signCrl == NULL) { + SECU_PrintError(progName, "fail to allocate memory\n"); + goto loser; + } + + rv = SECU_CopyCRL(arena, &signCrl->crl, &modCrl->crl); + if (rv != SECSuccess) { + SECU_PrintError(progName, "unable to dublicate crl for " + "modification."); + goto loser; + } + + /* Make sure the update time is current. It can be modified later + * by "update