diff options
author | alexei.volkov.bugs%sun.com <devnull@localhost> | 2007-08-24 20:43:01 +0000 |
---|---|---|
committer | alexei.volkov.bugs%sun.com <devnull@localhost> | 2007-08-24 20:43:01 +0000 |
commit | 29d936dd96590a21c3764bd7351f8dbbee73e2c1 (patch) | |
tree | 0fabce6bcdbc393698821352d23c149dd213627d /security/nss/cmd/libpkix | |
parent | f066798a77223ed9935c41e332e8d558dfad1d40 (diff) | |
download | nss-hg-29d936dd96590a21c3764bd7351f8dbbee73e2c1.tar.gz |
301213: Combine internal libpkix function tests into a single statically linked program. r=nelson,julien
Diffstat (limited to 'security/nss/cmd/libpkix')
104 files changed, 901 insertions, 340 deletions
diff --git a/security/nss/cmd/libpkix/Makefile b/security/nss/cmd/libpkix/Makefile index dfafebf4b..f3040ed6e 100755 --- a/security/nss/cmd/libpkix/Makefile +++ b/security/nss/cmd/libpkix/Makefile @@ -46,7 +46,6 @@ include manifest.mn # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### -include $(PKIX_DEPTH)/pkixrules.mk include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### diff --git a/security/nss/cmd/libpkix/manifest.mn b/security/nss/cmd/libpkix/manifest.mn index 71549d7aa..2d6e27385 100755 --- a/security/nss/cmd/libpkix/manifest.mn +++ b/security/nss/cmd/libpkix/manifest.mn @@ -36,6 +36,8 @@ # ***** END LICENSE BLOCK ***** PKIX_DEPTH = . +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. -DIRS = testutil pkix_pl pkix sample_apps perf \ +DIRS = testutil pkix_pl pkix sample_apps perf pkixutil \ $(NULL) diff --git a/security/nss/cmd/libpkix/perf/Makefile b/security/nss/cmd/libpkix/perf/Makefile index 15a060b07..c89f1a317 100755 --- a/security/nss/cmd/libpkix/perf/Makefile +++ b/security/nss/cmd/libpkix/perf/Makefile @@ -46,7 +46,6 @@ include manifest.mn # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### -include $(PKIX_DEPTH)/pkixrules.mk include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### @@ -58,7 +57,6 @@ include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### include $(PLAT_DEPTH)/platlibs.mk -include $(PKIX_DEPTH)/pkixlibs.mk ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # @@ -70,8 +68,6 @@ include $(CORE_DEPTH)/coreconf/rules.mk # (6) Execute "component" rules. (OPTIONAL) # ####################################################################### - - ####################################################################### # (7) Execute "local" rules. (OPTIONAL). # ####################################################################### diff --git a/security/nss/cmd/libpkix/perf/libpkix_buildthreads.c b/security/nss/cmd/libpkix/perf/libpkix_buildthreads.c index ca7c466da..ecf4baa12 100644 --- a/security/nss/cmd/libpkix/perf/libpkix_buildthreads.c +++ b/security/nss/cmd/libpkix/perf/libpkix_buildthreads.c @@ -66,7 +66,7 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; #undef pkixTempResult #define PERF_DECREF(obj) \ @@ -79,7 +79,7 @@ void *plContext = NULL; } \ } -void finish(char* message, int code); +static void finish(char* message, int code); typedef struct ThreadDataStr tData; @@ -104,7 +104,7 @@ char *logLevels[] = { "Trace" }; -PKIX_Error *loggerCallback( +static PKIX_Error *loggerCallback( PKIX_Logger *logger, PKIX_PL_String *message, PKIX_UInt32 logLevel, @@ -126,7 +126,7 @@ PKIX_Error *loggerCallback( #endif /* PKIX_LOGGER_ON */ -void ThreadEntry(void* data) +static void ThreadEntry(void* data) { tData* tdata = (tData*) data; PRIntervalTime duration = tdata->duration; @@ -245,7 +245,7 @@ void ThreadEntry(void* data) } -void +static void Test( CERTCertificate* anchor, char* eecertName, @@ -304,20 +304,21 @@ Test( } -void finish(char* message, int code) +static void finish(char* message, int code) { (void) printf(message); exit(code); } -void usage(char* progname) +static void usage(char* progname) { (void) printf("Usage : %s <duration> <threads> <anchorNickname> " "<eecertNickname>\n\n", progname); finish("", 0); } -int main(int argc, char** argv) +int +libpkix_buildthreads(int argc, char** argv) { CERTCertDBHandle *handle = NULL; CERTCertificate* eecert = NULL; diff --git a/security/nss/cmd/libpkix/perf/manifest.mn b/security/nss/cmd/libpkix/perf/manifest.mn index 6c46e083f..88c436674 100755 --- a/security/nss/cmd/libpkix/perf/manifest.mn +++ b/security/nss/cmd/libpkix/perf/manifest.mn @@ -36,6 +36,8 @@ # ***** END LICENSE BLOCK ***** PKIX_DEPTH = .. +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. # MODULE public and private header directories are implicitly REQUIRED. MODULE = nss @@ -44,8 +46,10 @@ CSRCS = libpkix_buildthreads.c \ nss_threads.c \ $(NULL) -PROGRAMS = $(CSRCS:.c=) +LIBRARY_NAME = pkixtoolperf -TARGETS = $(PROGRAMS) +TARGETS = $(LIBRARY) + +SOURCE_LIB_DIR = $(PKIX_DEPTH)/$(OBJDIR) NO_MD_RELEASE = 1 diff --git a/security/nss/cmd/libpkix/perf/nss_threads.c b/security/nss/cmd/libpkix/perf/nss_threads.c index 206019cf6..a2096749b 100644 --- a/security/nss/cmd/libpkix/perf/nss_threads.c +++ b/security/nss/cmd/libpkix/perf/nss_threads.c @@ -67,7 +67,7 @@ struct ThreadDataStr { PRUint32 iterations; }; -void ThreadEntry(void* data) +static void ThreadEntry(void* data) { tData* tdata = (tData*) data; PRIntervalTime duration = tdata->duration; @@ -99,7 +99,7 @@ void ThreadEntry(void* data) } while ((PR_IntervalNow() - start) < duration); } -void Test(CERTCertificate* cert, PRIntervalTime duration, PRUint32 threads) +static void Test(CERTCertificate* cert, PRIntervalTime duration, PRUint32 threads) { tData data; tData** alldata; @@ -150,20 +150,20 @@ void Test(CERTCertificate* cert, PRIntervalTime duration, PRUint32 threads) } -void finish(char* message, int code) +static void finish(char* message, int code) { (void) printf(message); exit(code); } -void usage(char* progname) +static void usage(char* progname) { (void) printf("Usage : %s <duration> <threads> <certnickname>\n\n", progname); finish("", 0); } -int main(int argc, char** argv) +int nss_threads(int argc, char** argv) { SECStatus rv = SECSuccess; CERTCertDBHandle *handle = NULL; diff --git a/security/nss/cmd/libpkix/pkix/Makefile b/security/nss/cmd/libpkix/pkix/Makefile index 15a060b07..f3040ed6e 100755 --- a/security/nss/cmd/libpkix/pkix/Makefile +++ b/security/nss/cmd/libpkix/pkix/Makefile @@ -46,7 +46,6 @@ include manifest.mn # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### -include $(PKIX_DEPTH)/pkixrules.mk include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### @@ -58,7 +57,6 @@ include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### include $(PLAT_DEPTH)/platlibs.mk -include $(PKIX_DEPTH)/pkixlibs.mk ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # diff --git a/security/nss/cmd/libpkix/pkix/certsel/Makefile b/security/nss/cmd/libpkix/pkix/certsel/Makefile index 15a060b07..2a760dcd6 100755 --- a/security/nss/cmd/libpkix/pkix/certsel/Makefile +++ b/security/nss/cmd/libpkix/pkix/certsel/Makefile @@ -46,7 +46,6 @@ include manifest.mn # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### -include $(PKIX_DEPTH)/pkixrules.mk include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### @@ -58,7 +57,6 @@ include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### include $(PLAT_DEPTH)/platlibs.mk -include $(PKIX_DEPTH)/pkixlibs.mk ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # @@ -77,4 +75,3 @@ include $(CORE_DEPTH)/coreconf/rules.mk ####################################################################### include $(PLAT_DEPTH)/platrules.mk - diff --git a/security/nss/cmd/libpkix/pkix/certsel/manifest.mn b/security/nss/cmd/libpkix/pkix/certsel/manifest.mn index 757b8cf4f..94e6c905f 100755 --- a/security/nss/cmd/libpkix/pkix/certsel/manifest.mn +++ b/security/nss/cmd/libpkix/pkix/certsel/manifest.mn @@ -36,6 +36,8 @@ # ***** END LICENSE BLOCK ***** PKIX_DEPTH = ../.. +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. # MODULE public and private header directories are implicitly REQUIRED. MODULE = nss @@ -44,8 +46,10 @@ CSRCS = test_certselector.c \ test_comcertselparams.c \ $(NULL) -PROGRAMS = $(CSRCS:.c=) +LIBRARY_NAME=pkixtoolcertsel -TARGETS = $(PROGRAMS) +TARGETS = $(LIBRARY) + +SOURCE_LIB_DIR=$(PKIX_DEPTH)/$(OBJDIR) NO_MD_RELEASE = 1 diff --git a/security/nss/cmd/libpkix/pkix/certsel/test_certselector.c b/security/nss/cmd/libpkix/pkix/certsel/test_certselector.c index 5b9c0eb20..268e39fe5 100644 --- a/security/nss/cmd/libpkix/pkix/certsel/test_certselector.c +++ b/security/nss/cmd/libpkix/pkix/certsel/test_certselector.c @@ -50,7 +50,7 @@ #define PKIX_TEST_CERTSELECTOR_ISSUER_NUM_CERTS 4 #define PKIX_TEST_CERTSELECTOR_SERIALNUMBER_NUM_CERTS 1 -void *plContext = NULL; +static void *plContext = NULL; /* * The first three certs are used to obtain policies to test @@ -141,6 +141,7 @@ static char *sanCertList[] = { * (For example, if you expect every cert to pass, "expectedResult" can be * set to 0xFFFFFFFF, even if the chain has fewer than 32 certs.) */ +static void testSelector( PKIX_CertSelector *selector, PKIX_List *certs, @@ -199,7 +200,7 @@ cleanup: * to the index provided by "index", creates an immutable List containing the * OID of that policy, and stores the result at "pPolicyList". */ -void testGetPolicyFromCert( +static void testGetPolicyFromCert( PKIX_PL_Cert *cert, PKIX_UInt32 index, PKIX_List **pPolicyList) @@ -412,6 +413,7 @@ cleanup: return(error); } +static void testSubjectMatch( PKIX_List *certs, PKIX_PL_Cert *certNameToMatch) @@ -445,6 +447,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testBasicConstraintsMatch( PKIX_List *certs) { @@ -502,6 +505,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testPolicyMatch( PKIX_List *certs, PKIX_PL_Cert *NIST1Cert, /* a source for policy NIST1 */ @@ -584,6 +588,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testCertificateMatch( PKIX_List *certs, PKIX_PL_Cert *certToMatch) @@ -613,6 +618,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testNameConstraintsMatch(PKIX_List *certs) { PKIX_CertSelector *selector = NULL; @@ -743,6 +749,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testPathToNamesMatch(PKIX_List *certs) { PKIX_CertSelector *selector = NULL; @@ -917,6 +924,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testSubjAltNamesMatch(PKIX_List *certs) { PKIX_CertSelector *selector = NULL; @@ -996,6 +1004,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testCertificateValidMatch( PKIX_List *certs) { @@ -1034,6 +1043,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void test_customCallback1(PKIX_List *certs) { PKIX_CertSelector *selector = NULL; @@ -1057,6 +1067,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void test_customCallback2 (PKIX_List *certs, PKIX_PL_Cert *anyPolicyCert) /* a source for policy anyPolicy */ @@ -1091,6 +1102,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testExtendedKeyUsageMatch(char *certDir) { PKIX_ComCertSelParams *goodParams = NULL; @@ -1178,6 +1190,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testKeyUsageMatch(char *certDir) { PKIX_ComCertSelParams *goodParams = NULL; @@ -1242,6 +1255,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testCertValidMatch(char *certDir) { PKIX_ComCertSelParams *goodParams = NULL; @@ -1310,6 +1324,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testIssuerMatch(char *certDir) { PKIX_ComCertSelParams *goodParams = NULL; @@ -1385,6 +1400,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testSerialNumberVersionMatch(char *certDir) { PKIX_ComCertSelParams *goodParams = NULL; @@ -1480,6 +1496,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testSubjKeyIdMatch(PKIX_List *certs) { PKIX_CertSelector *selector = NULL; @@ -1527,6 +1544,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testAuthKeyIdMatch(PKIX_List *certs) { PKIX_CertSelector *selector = NULL; @@ -1575,6 +1593,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testSubjPKAlgIdMatch(PKIX_List *certs) { PKIX_CertSelector *selector = NULL; @@ -1621,6 +1640,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testSubjPublicKeyMatch(PKIX_List *certs) { PKIX_CertSelector *selector = NULL; @@ -1667,6 +1687,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void test_CertSelector_Duplicate(PKIX_CertSelector *selector) { PKIX_Int32 goodBasicConstraints = 0; @@ -1799,11 +1820,12 @@ cleanup: PKIX_TEST_RETURN(); } +static void printUsage(void) { (void) printf("\nUSAGE:\ttest_certselector <NIST_FILES_DIR> <cert-dir>\n\n"); } -int main(int argc, char *argv[]) { +int test_certselector(int argc, char *argv[]) { PKIX_UInt32 i = 0; PKIX_UInt32 j = 0; diff --git a/security/nss/cmd/libpkix/pkix/certsel/test_comcertselparams.c b/security/nss/cmd/libpkix/pkix/certsel/test_comcertselparams.c index fa62525dd..1f449478c 100644 --- a/security/nss/cmd/libpkix/pkix/certsel/test_comcertselparams.c +++ b/security/nss/cmd/libpkix/pkix/certsel/test_comcertselparams.c @@ -44,8 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static void test_CreateOIDList(PKIX_List *certPolicyInfos, PKIX_List **pPolicyOIDs) { PKIX_UInt32 i = 0; @@ -90,6 +91,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void test_NameConstraints(char *dirName) { PKIX_PL_Cert *goodCert = NULL; @@ -149,6 +151,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void test_PathToNames(void) { PKIX_ComCertSelParams *goodParams = NULL; @@ -257,6 +260,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void test_SubjAltNames(void) { PKIX_ComCertSelParams *goodParams = NULL; @@ -383,6 +387,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void test_KeyUsages(void) { PKIX_ComCertSelParams *goodParams = NULL; @@ -453,6 +458,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void test_Version_Issuer_SerialNumber(void) { PKIX_ComCertSelParams *goodParams = NULL; @@ -548,6 +554,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void test_SubjKeyId_AuthKeyId(void) { PKIX_ComCertSelParams *goodParams = NULL; @@ -621,6 +628,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void test_SubjAlgId_SubjPublicKey(char *dirName) { PKIX_ComCertSelParams *goodParams = NULL; @@ -702,11 +710,12 @@ cleanup: PKIX_TEST_RETURN(); } +static void printUsage(void) { (void) printf("\nUSAGE:\ttest_comcertselparams <NIST_FILES_DIR> \n\n"); } -int main(int argc, char *argv[]) { +int test_comcertselparams(int argc, char *argv[]) { PKIX_UInt32 actualMinorVersion; PKIX_UInt32 j = 0; diff --git a/security/nss/cmd/libpkix/pkix/checker/Makefile b/security/nss/cmd/libpkix/pkix/checker/Makefile index 15a060b07..2a760dcd6 100755 --- a/security/nss/cmd/libpkix/pkix/checker/Makefile +++ b/security/nss/cmd/libpkix/pkix/checker/Makefile @@ -46,7 +46,6 @@ include manifest.mn # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### -include $(PKIX_DEPTH)/pkixrules.mk include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### @@ -58,7 +57,6 @@ include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### include $(PLAT_DEPTH)/platlibs.mk -include $(PKIX_DEPTH)/pkixlibs.mk ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # @@ -77,4 +75,3 @@ include $(CORE_DEPTH)/coreconf/rules.mk ####################################################################### include $(PLAT_DEPTH)/platrules.mk - diff --git a/security/nss/cmd/libpkix/pkix/checker/manifest.mn b/security/nss/cmd/libpkix/pkix/checker/manifest.mn index edbddd2f6..cb4ecde40 100755 --- a/security/nss/cmd/libpkix/pkix/checker/manifest.mn +++ b/security/nss/cmd/libpkix/pkix/checker/manifest.mn @@ -36,14 +36,18 @@ # ***** END LICENSE BLOCK ***** PKIX_DEPTH = ../.. +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. # MODULE public and private header directories are implicitly REQUIRED. MODULE = nss CSRCS = test_certchainchecker.c -PROGRAMS = $(CSRCS:.c=) +LIBRARY_NAME=pkixtoolchecker -TARGETS = $(PROGRAMS) +TARGETS = $(LIBRARY) + +SOURCE_LIB_DIR=$(PKIX_DEPTH)/$(OBJDIR) NO_MD_RELEASE = 1 diff --git a/security/nss/cmd/libpkix/pkix/checker/test_certchainchecker.c b/security/nss/cmd/libpkix/pkix/checker/test_certchainchecker.c index b69a120f5..794b89ca4 100755 --- a/security/nss/cmd/libpkix/pkix/checker/test_certchainchecker.c +++ b/security/nss/cmd/libpkix/pkix/checker/test_certchainchecker.c @@ -44,8 +44,10 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; + +static PKIX_Error *dummyChecker_Check( PKIX_CertChainChecker *checker, PKIX_PL_Cert *cert, @@ -61,6 +63,7 @@ cleanup: } +static void test_CertChainChecker_Duplicate(PKIX_CertChainChecker *original) { PKIX_Boolean originalForward = PKIX_FALSE; @@ -151,7 +154,7 @@ cleanup: PKIX_TEST_RETURN(); } -int main(int argc, char *argv[]) { +int test_certchainchecker(int argc, char *argv[]) { PKIX_UInt32 actualMinorVersion; PKIX_PL_OID *bcOID = NULL; diff --git a/security/nss/cmd/libpkix/pkix/crlsel/Makefile b/security/nss/cmd/libpkix/pkix/crlsel/Makefile index 15a060b07..2a760dcd6 100755 --- a/security/nss/cmd/libpkix/pkix/crlsel/Makefile +++ b/security/nss/cmd/libpkix/pkix/crlsel/Makefile @@ -46,7 +46,6 @@ include manifest.mn # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### -include $(PKIX_DEPTH)/pkixrules.mk include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### @@ -58,7 +57,6 @@ include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### include $(PLAT_DEPTH)/platlibs.mk -include $(PKIX_DEPTH)/pkixlibs.mk ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # @@ -77,4 +75,3 @@ include $(CORE_DEPTH)/coreconf/rules.mk ####################################################################### include $(PLAT_DEPTH)/platrules.mk - diff --git a/security/nss/cmd/libpkix/pkix/crlsel/manifest.mn b/security/nss/cmd/libpkix/pkix/crlsel/manifest.mn index 6eb26f3a3..f948f3d2a 100755 --- a/security/nss/cmd/libpkix/pkix/crlsel/manifest.mn +++ b/security/nss/cmd/libpkix/pkix/crlsel/manifest.mn @@ -36,6 +36,8 @@ # ***** END LICENSE BLOCK ***** PKIX_DEPTH = ../.. +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. # MODULE public and private header directories are implicitly REQUIRED. MODULE = nss @@ -44,8 +46,10 @@ CSRCS = test_crlselector.c \ test_comcrlselparams.c \ $(NULL) -PROGRAMS = $(CSRCS:.c=) +LIBRARY_NAME=pkixtoolcrlsel -TARGETS = $(PROGRAMS) +TARGETS = $(LIBRARY) + +SOURCE_LIB_DIR=$(PKIX_DEPTH)/$(OBJDIR) NO_MD_RELEASE = 1 diff --git a/security/nss/cmd/libpkix/pkix/crlsel/test_comcrlselparams.c b/security/nss/cmd/libpkix/pkix/crlsel/test_comcrlselparams.c index 1c5133df3..e7f8df426 100644 --- a/security/nss/cmd/libpkix/pkix/crlsel/test_comcrlselparams.c +++ b/security/nss/cmd/libpkix/pkix/crlsel/test_comcrlselparams.c @@ -44,7 +44,7 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; static void testIssuer(PKIX_ComCRLSelParams *goodObject) @@ -198,6 +198,7 @@ cleanup: } +static void testCertificateChecking( char *dataCentralDir, char *goodInput, @@ -243,6 +244,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testDateAndTime(PKIX_ComCRLSelParams *goodObject){ PKIX_PL_Date *setDate = NULL; @@ -282,6 +284,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testMaxMinCRLNumbers(PKIX_ComCRLSelParams *goodObject){ PKIX_PL_BigInt *setMaxCrlNumber = NULL; PKIX_PL_BigInt *getMaxCrlNumber = NULL; @@ -368,6 +371,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testDuplicate(PKIX_ComCRLSelParams *goodObject){ PKIX_ComCRLSelParams *dupObject = NULL; @@ -397,13 +401,14 @@ cleanup: PKIX_TEST_RETURN(); } +static void printUsage(char *pName){ printf("\nUSAGE: %s <central-data-dir>\n\n", pName); } /* Functional tests for ComCRLSelParams public functions */ -int main(int argc, char *argv[]){ +int test_comcrlselparams(int argc, char *argv[]){ char *dataCentralDir = NULL; char *goodInput = "yassir2yassir"; diff --git a/security/nss/cmd/libpkix/pkix/crlsel/test_crlselector.c b/security/nss/cmd/libpkix/pkix/crlsel/test_crlselector.c index a1ab4e1c6..4cf1a0715 100644 --- a/security/nss/cmd/libpkix/pkix/crlsel/test_crlselector.c +++ b/security/nss/cmd/libpkix/pkix/crlsel/test_crlselector.c @@ -44,7 +44,7 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; static void testGetMatchCallback(PKIX_CRLSelector *goodObject) @@ -68,6 +68,7 @@ cleanup: } +static void testGetCRLSelectorContext(PKIX_CRLSelector *goodObject) { PKIX_PL_Object *context = NULL; @@ -89,6 +90,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testCommonCRLSelectorParams(PKIX_CRLSelector *goodObject){ PKIX_ComCRLSelParams *setParams = NULL; PKIX_ComCRLSelParams *getParams = NULL; @@ -142,7 +144,7 @@ cleanup: /* Functional tests for CRLSelector public functions */ -int main(int argc, char *argv[]){ +int test_crlselector(int argc, char *argv[]){ PKIX_PL_Date *context = NULL; PKIX_CRLSelector *goodObject = NULL; diff --git a/security/nss/cmd/libpkix/pkix/manifest.mn b/security/nss/cmd/libpkix/pkix/manifest.mn index 0fec1cb84..8bd8b8b8e 100755 --- a/security/nss/cmd/libpkix/pkix/manifest.mn +++ b/security/nss/cmd/libpkix/pkix/manifest.mn @@ -36,6 +36,8 @@ # ***** END LICENSE BLOCK ***** PKIX_DEPTH = .. +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. DIRS = certsel checker crlsel params results store top util \ $(NULL) diff --git a/security/nss/cmd/libpkix/pkix/params/Makefile b/security/nss/cmd/libpkix/pkix/params/Makefile index 15a060b07..2a760dcd6 100755 --- a/security/nss/cmd/libpkix/pkix/params/Makefile +++ b/security/nss/cmd/libpkix/pkix/params/Makefile @@ -46,7 +46,6 @@ include manifest.mn # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### -include $(PKIX_DEPTH)/pkixrules.mk include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### @@ -58,7 +57,6 @@ include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### include $(PLAT_DEPTH)/platlibs.mk -include $(PKIX_DEPTH)/pkixlibs.mk ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # @@ -77,4 +75,3 @@ include $(CORE_DEPTH)/coreconf/rules.mk ####################################################################### include $(PLAT_DEPTH)/platrules.mk - diff --git a/security/nss/cmd/libpkix/pkix/params/manifest.mn b/security/nss/cmd/libpkix/pkix/params/manifest.mn index 954c05922..ce73f01eb 100755 --- a/security/nss/cmd/libpkix/pkix/params/manifest.mn +++ b/security/nss/cmd/libpkix/pkix/params/manifest.mn @@ -36,6 +36,8 @@ # ***** END LICENSE BLOCK ***** PKIX_DEPTH = ../.. +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. # MODULE public and private header directories are implicitly REQUIRED. MODULE = nss @@ -46,8 +48,10 @@ CSRCS = test_procparams.c \ test_resourcelimits.c \ $(NULL) -PROGRAMS = $(CSRCS:.c=) +LIBRARY_NAME=pkixtoolparams -TARGETS = $(PROGRAMS) +TARGETS = $(LIBRARY) + +SOURCE_LIB_DIR=$(PKIX_DEPTH)/$(OBJDIR) NO_MD_RELEASE = 1 diff --git a/security/nss/cmd/libpkix/pkix/params/test_buildparams.c b/security/nss/cmd/libpkix/pkix/params/test_buildparams.c index f0711127a..07de7ac4b 100644 --- a/security/nss/cmd/libpkix/pkix/params/test_buildparams.c +++ b/security/nss/cmd/libpkix/pkix/params/test_buildparams.c @@ -44,7 +44,7 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; static void testDestroy(void *goodObject, void *equalObject, void *diffObject) @@ -63,6 +63,7 @@ cleanup: } +static void testGetProcParams( PKIX_BuildParams *goodObject, PKIX_BuildParams *equalObject){ @@ -93,11 +94,12 @@ cleanup: PKIX_TEST_RETURN(); } +static void printUsage(char *pName){ printf("\nUSAGE: %s <central-data-dir>\n\n", pName); } -int main(int argc, char *argv[]) { +int test_buildparams(int argc, char *argv[]) { PKIX_BuildParams *goodObject = NULL; PKIX_BuildParams *equalObject = NULL; diff --git a/security/nss/cmd/libpkix/pkix/params/test_procparams.c b/security/nss/cmd/libpkix/pkix/params/test_procparams.c index d3407c314..23481cadb 100644 --- a/security/nss/cmd/libpkix/pkix/params/test_procparams.c +++ b/security/nss/cmd/libpkix/pkix/params/test_procparams.c @@ -44,7 +44,7 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; static void testDestroy(void *goodObject, void *equalObject, void *diffObject) @@ -63,6 +63,7 @@ cleanup: } +static void testGetAnchors( PKIX_ProcessingParams *goodObject, PKIX_ProcessingParams *equalObject){ @@ -92,6 +93,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testGetSetDate( PKIX_ProcessingParams *goodObject, PKIX_ProcessingParams *equalObject){ @@ -130,6 +132,7 @@ cleanup: PKIX_TEST_RETURN(); } +static PKIX_Error *userChecker1cb( PKIX_CertChainChecker *checker, PKIX_PL_Cert *cert, @@ -140,6 +143,7 @@ PKIX_Error *userChecker1cb( return(NULL); } +static void testGetSetCertChainCheckers( PKIX_ProcessingParams *goodObject, PKIX_ProcessingParams *equalObject){ @@ -199,6 +203,7 @@ cleanup: PKIX_TEST_RETURN(); } +static PKIX_Error *userChecker2cb( PKIX_RevocationChecker *checker, PKIX_PL_Cert *cert, @@ -208,6 +213,7 @@ PKIX_Error *userChecker2cb( return(NULL); } +static void testGetSetRevocationCheckers( PKIX_ProcessingParams *goodObject, PKIX_ProcessingParams *equalObject){ @@ -263,6 +269,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testGetSetResourceLimits( PKIX_ProcessingParams *goodObject, PKIX_ProcessingParams *equalObject) @@ -307,6 +314,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testGetSetConstraints(PKIX_ProcessingParams *goodObject){ PKIX_CertSelector *setConstraints = NULL; @@ -341,6 +349,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testGetSetInitialPolicies( PKIX_ProcessingParams *goodObject, char *asciiPolicyOID) @@ -383,6 +392,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testGetSetPolicyQualifiersRejected( PKIX_ProcessingParams *goodObject, PKIX_Boolean rejected) @@ -410,11 +420,12 @@ cleanup: PKIX_TEST_RETURN(); } +static void printUsage(char *pName){ printf("\nUSAGE: %s <central-data-dir>\n\n", pName); } -int main(int argc, char *argv[]) { +int test_procparams(int argc, char *argv[]) { PKIX_ProcessingParams *goodObject = NULL; PKIX_ProcessingParams *equalObject = NULL; diff --git a/security/nss/cmd/libpkix/pkix/params/test_resourcelimits.c b/security/nss/cmd/libpkix/pkix/params/test_resourcelimits.c index d5f7c3b78..6c2a15333 100644 --- a/security/nss/cmd/libpkix/pkix/params/test_resourcelimits.c +++ b/security/nss/cmd/libpkix/pkix/params/test_resourcelimits.c @@ -44,7 +44,7 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; static void testDestroy(void *goodObject, void *equalObject, void *diffObject) @@ -63,7 +63,7 @@ cleanup: } -int main(int argc, char *argv[]) { +int test_resourcelimits(int argc, char *argv[]) { PKIX_ResourceLimits *goodObject = NULL; PKIX_ResourceLimits *equalObject = NULL; diff --git a/security/nss/cmd/libpkix/pkix/params/test_trustanchor.c b/security/nss/cmd/libpkix/pkix/params/test_trustanchor.c index f0b22188f..7ba24de59 100644 --- a/security/nss/cmd/libpkix/pkix/params/test_trustanchor.c +++ b/security/nss/cmd/libpkix/pkix/params/test_trustanchor.c @@ -44,8 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static void createTrustAnchors( char *dirName, char *goodInput, @@ -66,6 +67,7 @@ void createTrustAnchors( (dirName, goodInput, PKIX_TRUE, plContext); } +static void testGetCAName( PKIX_PL_Cert *diffCert, PKIX_TrustAnchor *equalObject){ @@ -95,6 +97,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testGetCAPublicKey( PKIX_PL_Cert *diffCert, PKIX_TrustAnchor *equalObject){ @@ -124,6 +127,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testGetNameConstraints(char *dirName) { PKIX_TrustAnchor *goodObject = NULL; @@ -211,11 +215,12 @@ cleanup: } +static void printUsage(void) { (void) printf("\nUSAGE:\ttest_trustanchor <NIST_FILES_DIR> <central-data-dir>\n\n"); } -int main(int argc, char *argv[]) { +int test_trustanchor(int argc, char *argv[]) { PKIX_TrustAnchor *goodObject = NULL; PKIX_TrustAnchor *equalObject = NULL; diff --git a/security/nss/cmd/libpkix/pkix/params/test_valparams.c b/security/nss/cmd/libpkix/pkix/params/test_valparams.c index 5a4c80cfb..2883ec7c6 100644 --- a/security/nss/cmd/libpkix/pkix/params/test_valparams.c +++ b/security/nss/cmd/libpkix/pkix/params/test_valparams.c @@ -44,7 +44,7 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; static void testDestroy(void *goodObject, void *equalObject, void *diffObject) @@ -63,6 +63,7 @@ cleanup: } +static void testGetProcParams( PKIX_ValidateParams *goodObject, PKIX_ValidateParams *equalObject){ @@ -94,6 +95,7 @@ cleanup: } +static void testGetCertChain( PKIX_ValidateParams *goodObject, PKIX_ValidateParams *equalObject){ @@ -124,11 +126,12 @@ cleanup: PKIX_TEST_RETURN(); } +static void printUsage(char *pName){ printf("\nUSAGE: %s <central-data-dir>\n\n", pName); } -int main(int argc, char *argv[]) { +int test_valparams(int argc, char *argv[]) { PKIX_ValidateParams *goodObject = NULL; PKIX_ValidateParams *equalObject = NULL; diff --git a/security/nss/cmd/libpkix/pkix/results/Makefile b/security/nss/cmd/libpkix/pkix/results/Makefile index 15a060b07..2a760dcd6 100755 --- a/security/nss/cmd/libpkix/pkix/results/Makefile +++ b/security/nss/cmd/libpkix/pkix/results/Makefile @@ -46,7 +46,6 @@ include manifest.mn # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### -include $(PKIX_DEPTH)/pkixrules.mk include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### @@ -58,7 +57,6 @@ include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### include $(PLAT_DEPTH)/platlibs.mk -include $(PKIX_DEPTH)/pkixlibs.mk ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # @@ -77,4 +75,3 @@ include $(CORE_DEPTH)/coreconf/rules.mk ####################################################################### include $(PLAT_DEPTH)/platrules.mk - diff --git a/security/nss/cmd/libpkix/pkix/results/manifest.mn b/security/nss/cmd/libpkix/pkix/results/manifest.mn index b5793bccb..dcf382dec 100755 --- a/security/nss/cmd/libpkix/pkix/results/manifest.mn +++ b/security/nss/cmd/libpkix/pkix/results/manifest.mn @@ -36,6 +36,8 @@ # ***** END LICENSE BLOCK ***** PKIX_DEPTH = ../.. +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. # MODULE public and private header directories are implicitly REQUIRED. MODULE = nss @@ -46,8 +48,10 @@ CSRCS = test_buildresult.c \ test_valresult.c \ $(NULL) -PROGRAMS = $(CSRCS:.c=) +LIBRARY_NAME=pkixtoolresults -TARGETS = $(PROGRAMS) +TARGETS = $(LIBRARY) + +SOURCE_LIB_DIR=$(PKIX_DEPTH)/$(OBJDIR) NO_MD_RELEASE = 1 diff --git a/security/nss/cmd/libpkix/pkix/results/test_buildresult.c b/security/nss/cmd/libpkix/pkix/results/test_buildresult.c index 02866cd15..0283d615c 100644 --- a/security/nss/cmd/libpkix/pkix/results/test_buildresult.c +++ b/security/nss/cmd/libpkix/pkix/results/test_buildresult.c @@ -44,7 +44,7 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; static void testDestroy(void *goodObject, void *equalObject, void *diffObject) @@ -63,6 +63,7 @@ cleanup: } +static void testGetValidateResult( PKIX_BuildResult *goodObject, PKIX_BuildResult *equalObject){ @@ -93,6 +94,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testGetCertChain( PKIX_BuildResult *goodObject, PKIX_BuildResult *equalObject){ @@ -123,11 +125,12 @@ cleanup: PKIX_TEST_RETURN(); } +static void printUsage(char *pName){ printf("\nUSAGE: %s <central-data-dir>\n\n", pName); } -int main(int argc, char *argv[]) { +int test_buildresult(int argc, char *argv[]) { PKIX_BuildResult *goodObject = NULL; PKIX_BuildResult *equalObject = NULL; diff --git a/security/nss/cmd/libpkix/pkix/results/test_policynode.c b/security/nss/cmd/libpkix/pkix/results/test_policynode.c index f1fa098bb..92c0ff7e2 100644 --- a/security/nss/cmd/libpkix/pkix/results/test_policynode.c +++ b/security/nss/cmd/libpkix/pkix/results/test_policynode.c @@ -44,7 +44,7 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; static void test_GetChildren( @@ -357,11 +357,12 @@ cleanup: PKIX_TEST_RETURN(); } +static void printUsage(void) { (void) printf("\nUSAGE:\ttest_policynode <NIST_FILES_DIR> \n\n"); } -int main(int argc, char *argv[]) { +int test_policynode(int argc, char *argv[]) { /* * Create a tree with parent = anyPolicy, diff --git a/security/nss/cmd/libpkix/pkix/results/test_valresult.c b/security/nss/cmd/libpkix/pkix/results/test_valresult.c index dd7fea5b6..1377d61ce 100644 --- a/security/nss/cmd/libpkix/pkix/results/test_valresult.c +++ b/security/nss/cmd/libpkix/pkix/results/test_valresult.c @@ -44,7 +44,7 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; static void testDestroy(void *goodObject, void *equalObject, void *diffObject) @@ -63,6 +63,7 @@ cleanup: } +static void testGetPublicKey( PKIX_ValidateResult *goodObject, PKIX_ValidateResult *equalObject){ @@ -93,6 +94,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testGetTrustAnchor( PKIX_ValidateResult *goodObject, PKIX_ValidateResult *equalObject){ @@ -123,6 +125,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testGetPolicyTree( PKIX_ValidateResult *goodObject, PKIX_ValidateResult *equalObject){ @@ -157,11 +160,12 @@ cleanup: PKIX_TEST_RETURN(); } +static void printUsage(char *pName){ printf("\nUSAGE: %s <central-data-dir>\n\n", pName); } -int main(int argc, char *argv[]) { +int test_valresult(int argc, char *argv[]) { PKIX_ValidateResult *goodObject = NULL; PKIX_ValidateResult *equalObject = NULL; diff --git a/security/nss/cmd/libpkix/pkix/results/test_verifynode.c b/security/nss/cmd/libpkix/pkix/results/test_verifynode.c index 8d29de295..06429cf53 100644 --- a/security/nss/cmd/libpkix/pkix/results/test_verifynode.c +++ b/security/nss/cmd/libpkix/pkix/results/test_verifynode.c @@ -44,13 +44,14 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static void printUsage(void) { (void) printf("\nUSAGE:\ttest_verifynode path cert1 cert2 cert3\n\n"); } -int main(int argc, char *argv[]) { +int test_verifynode(int argc, char *argv[]) { /* * Create a tree with parent = cert1, child=cert2, grandchild=cert3 diff --git a/security/nss/cmd/libpkix/pkix/store/Makefile b/security/nss/cmd/libpkix/pkix/store/Makefile index 15a060b07..2a760dcd6 100755 --- a/security/nss/cmd/libpkix/pkix/store/Makefile +++ b/security/nss/cmd/libpkix/pkix/store/Makefile @@ -46,7 +46,6 @@ include manifest.mn # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### -include $(PKIX_DEPTH)/pkixrules.mk include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### @@ -58,7 +57,6 @@ include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### include $(PLAT_DEPTH)/platlibs.mk -include $(PKIX_DEPTH)/pkixlibs.mk ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # @@ -77,4 +75,3 @@ include $(CORE_DEPTH)/coreconf/rules.mk ####################################################################### include $(PLAT_DEPTH)/platrules.mk - diff --git a/security/nss/cmd/libpkix/pkix/store/manifest.mn b/security/nss/cmd/libpkix/pkix/store/manifest.mn index d906256c5..3fe49684c 100755 --- a/security/nss/cmd/libpkix/pkix/store/manifest.mn +++ b/security/nss/cmd/libpkix/pkix/store/manifest.mn @@ -36,14 +36,18 @@ # ***** END LICENSE BLOCK ***** PKIX_DEPTH = ../.. +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. # MODULE public and private header directories are implicitly REQUIRED. MODULE = nss CSRCS = test_store.c -PROGRAMS = $(CSRCS:.c=) +LIBRARY_NAME=pkixtoolstore -TARGETS = $(PROGRAMS) +TARGETS = $(LIBRARY) + +SOURCE_LIB_DIR=$(PKIX_DEPTH)/$(OBJDIR) NO_MD_RELEASE = 1 diff --git a/security/nss/cmd/libpkix/pkix/store/test_store.c b/security/nss/cmd/libpkix/pkix/store/test_store.c index 69a44238c..87d22b2bd 100755 --- a/security/nss/cmd/libpkix/pkix/store/test_store.c +++ b/security/nss/cmd/libpkix/pkix/store/test_store.c @@ -44,8 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static PKIX_Error *testCRLCallback( PKIX_CertStore *store, PKIX_CRLSelector *selector, @@ -56,6 +57,7 @@ PKIX_Error *testCRLCallback( return (0); } +static PKIX_Error *testCRLContinue( PKIX_CertStore *store, PKIX_CRLSelector *selector, @@ -66,6 +68,7 @@ PKIX_Error *testCRLContinue( return (0); } +static PKIX_Error *testCertCallback( PKIX_CertStore *store, PKIX_CertSelector *selector, @@ -76,6 +79,7 @@ PKIX_Error *testCertCallback( return (0); } +static PKIX_Error *testCertContinue( PKIX_CertStore *store, PKIX_CertSelector *selector, @@ -111,6 +115,7 @@ cleanup: return (pathName); } +static void testCertStore(char *crlDir) { PKIX_PL_String *dirString = NULL; @@ -176,13 +181,14 @@ cleanup: } +static void printUsage(char *pName){ printf("\nUSAGE: %s testName <data-dir> <platform-dir>\n\n", pName); } /* Functional tests for CertStore public functions */ -int main(int argc, char *argv[]) { +int test_store(int argc, char *argv[]) { char *platformDir = NULL; char *dataDir = NULL; diff --git a/security/nss/cmd/libpkix/pkix/top/Makefile b/security/nss/cmd/libpkix/pkix/top/Makefile index 15a060b07..2a760dcd6 100755 --- a/security/nss/cmd/libpkix/pkix/top/Makefile +++ b/security/nss/cmd/libpkix/pkix/top/Makefile @@ -46,7 +46,6 @@ include manifest.mn # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### -include $(PKIX_DEPTH)/pkixrules.mk include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### @@ -58,7 +57,6 @@ include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### include $(PLAT_DEPTH)/platlibs.mk -include $(PKIX_DEPTH)/pkixlibs.mk ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # @@ -77,4 +75,3 @@ include $(CORE_DEPTH)/coreconf/rules.mk ####################################################################### include $(PLAT_DEPTH)/platrules.mk - diff --git a/security/nss/cmd/libpkix/pkix/top/manifest.mn b/security/nss/cmd/libpkix/pkix/top/manifest.mn index 7b05e02f1..38c696df1 100755 --- a/security/nss/cmd/libpkix/pkix/top/manifest.mn +++ b/security/nss/cmd/libpkix/pkix/top/manifest.mn @@ -36,6 +36,8 @@ # ***** END LICENSE BLOCK ***** PKIX_DEPTH = ../.. +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. # MODULE public and private header directories are implicitly REQUIRED. MODULE = nss @@ -56,8 +58,10 @@ CSRCS = test_basicchecker.c \ test_validatechain_NB.c \ $(NULL) -PROGRAMS = $(CSRCS:.c=) +LIBRARY_NAME=pkixtooltop -TARGETS = $(PROGRAMS) +TARGETS = $(LIBRARY) + +SOURCE_LIB_DIR=$(PKIX_DEPTH)/$(OBJDIR) NO_MD_RELEASE = 1 diff --git a/security/nss/cmd/libpkix/pkix/top/test_basicchecker.c b/security/nss/cmd/libpkix/pkix/top/test_basicchecker.c index 936f7210b..f2d3f1799 100644 --- a/security/nss/cmd/libpkix/pkix/top/test_basicchecker.c +++ b/security/nss/cmd/libpkix/pkix/top/test_basicchecker.c @@ -44,8 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static void testPass(char *dirName, char *goodInput, char *diffInput, char *dateAscii){ PKIX_List *chain = NULL; @@ -94,6 +95,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testNameChainingFail( char *dirName, char *goodInput, @@ -139,6 +141,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testDateFail(char *dirName, char *goodInput, char *diffInput){ PKIX_List *chain = NULL; @@ -175,6 +178,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testSignatureFail( char *dirName, char *goodInput, @@ -216,11 +220,12 @@ cleanup: PKIX_TEST_RETURN(); } +static void printUsage(char *pName){ printf("\nUSAGE: %s <central-data-dir>\n\n", pName); } -int main(int argc, char *argv[]) { +int test_basicchecker(int argc, char *argv[]) { char *goodInput = "yassir2yassir"; char *diffInput = "yassir2bcn"; diff --git a/security/nss/cmd/libpkix/pkix/top/test_basicconstraintschecker.c b/security/nss/cmd/libpkix/pkix/top/test_basicconstraintschecker.c index c274c688a..42c27e4c7 100644 --- a/security/nss/cmd/libpkix/pkix/top/test_basicconstraintschecker.c +++ b/security/nss/cmd/libpkix/pkix/top/test_basicconstraintschecker.c @@ -46,19 +46,21 @@ #define PKIX_TEST_MAX_CERTS 10 -void *plContext = NULL; +static void *plContext = NULL; +static void printUsage1(char *pName){ printf("\nUSAGE: %s test-name [ENE|EE] ", pName); printf("cert [certs].\n"); } +static void printUsageMax(PKIX_UInt32 numCerts){ printf("\nUSAGE ERROR: number of certs %d exceed maximum %d\n", numCerts, PKIX_TEST_MAX_CERTS); } -int main(int argc, char *argv[]){ +int test_basicconstraintschecker(int argc, char *argv[]){ PKIX_List *chain = NULL; PKIX_ValidateParams *valParams = NULL; diff --git a/security/nss/cmd/libpkix/pkix/top/test_buildchain.c b/security/nss/cmd/libpkix/pkix/top/test_buildchain.c index 6bc433cbc..46d796bc5 100644 --- a/security/nss/cmd/libpkix/pkix/top/test_buildchain.c +++ b/security/nss/cmd/libpkix/pkix/top/test_buildchain.c @@ -47,20 +47,20 @@ #include "testutil_nss.h" #define LDAP_PORT 389 -PKIX_Boolean usebind = PKIX_FALSE; -PKIX_Boolean useLDAP = PKIX_FALSE; -char buf[PR_NETDB_BUF_SIZE]; -char *serverName = NULL; -char *sepPtr = NULL; -PRNetAddr netAddr; -PRHostEnt hostent; -PKIX_UInt32 portNum = 0; -PRIntn hostenum = 0; -PRStatus prstatus = PR_FAILURE; -void *ipaddr = NULL; +static PKIX_Boolean usebind = PKIX_FALSE; +static PKIX_Boolean useLDAP = PKIX_FALSE; +static char buf[PR_NETDB_BUF_SIZE]; +static char *serverName = NULL; +static char *sepPtr = NULL; +static PRNetAddr netAddr; +static PRHostEnt hostent; +static PKIX_UInt32 portNum = 0; +static PRIntn hostenum = 0; +static PRStatus prstatus = PR_FAILURE; +static void *ipaddr = NULL; -void *plContext = NULL; +static void *plContext = NULL; static void printUsage(void) { (void) printf("\nUSAGE:\ttest_buildchain [-arenas] [usebind] " @@ -122,7 +122,7 @@ cleanup: } -int main(int argc, char *argv[]) +int test_buildchain(int argc, char *argv[]) { PKIX_BuildResult *buildResult = NULL; PKIX_ComCertSelParams *certSelParams = NULL; diff --git a/security/nss/cmd/libpkix/pkix/top/test_buildchain_partialchain.c b/security/nss/cmd/libpkix/pkix/top/test_buildchain_partialchain.c index 698671aab..0a10035b6 100644 --- a/security/nss/cmd/libpkix/pkix/top/test_buildchain_partialchain.c +++ b/security/nss/cmd/libpkix/pkix/top/test_buildchain_partialchain.c @@ -47,20 +47,20 @@ #include "testutil_nss.h" #define LDAP_PORT 389 -PKIX_Boolean usebind = PKIX_FALSE; -PKIX_Boolean useLDAP = PKIX_FALSE; -char buf[PR_NETDB_BUF_SIZE]; -char *serverName = NULL; -char *sepPtr = NULL; -PRNetAddr netAddr; -PRHostEnt hostent; -PKIX_UInt32 portNum = 0; -PRIntn hostenum = 0; -PRStatus prstatus = PR_FAILURE; -void *ipaddr = NULL; +static PKIX_Boolean usebind = PKIX_FALSE; +static PKIX_Boolean useLDAP = PKIX_FALSE; +static char buf[PR_NETDB_BUF_SIZE]; +static char *serverName = NULL; +static char *sepPtr = NULL; +static PRNetAddr netAddr; +static PRHostEnt hostent; +static PKIX_UInt32 portNum = 0; +static PRIntn hostenum = 0; +static PRStatus prstatus = PR_FAILURE; +static void *ipaddr = NULL; -void *plContext = NULL; +static void *plContext = NULL; static void printUsage(void) { (void) printf("\nUSAGE:\ttest_buildchain [-arenas] [usebind] " @@ -695,7 +695,7 @@ cleanup: } -int main(int argc, char *argv[]) +int test_buildchain_partialchain(int argc, char *argv[]) { PKIX_UInt32 actualMinorVersion = 0; PKIX_UInt32 j = 0; diff --git a/security/nss/cmd/libpkix/pkix/top/test_buildchain_resourcelimits.c b/security/nss/cmd/libpkix/pkix/top/test_buildchain_resourcelimits.c index e79a2c899..b81d243f3 100644 --- a/security/nss/cmd/libpkix/pkix/top/test_buildchain_resourcelimits.c +++ b/security/nss/cmd/libpkix/pkix/top/test_buildchain_resourcelimits.c @@ -46,11 +46,11 @@ #define PKIX_TESTUSERCHECKER_TYPE (PKIX_NUMTYPES+30) -void *plContext = NULL; -PKIX_Boolean usebind = PKIX_FALSE; -PKIX_Boolean useLDAP = PKIX_FALSE; -char buf[PR_NETDB_BUF_SIZE]; -char *serverName = NULL; +static void *plContext = NULL; +static PKIX_Boolean usebind = PKIX_FALSE; +static PKIX_Boolean useLDAP = PKIX_FALSE; +static char buf[PR_NETDB_BUF_SIZE]; +static char *serverName = NULL; static void printUsage(void) { (void) printf("\nUSAGE:\ttest_buildchain_resourcelimits [-arenas] " @@ -262,7 +262,7 @@ cleanup: } -int main(int argc, char *argv[]) +int test_buildchain_resourcelimits(int argc, char *argv[]) { PKIX_ComCertSelParams *certSelParams = NULL; PKIX_CertSelector *certSelector = NULL; diff --git a/security/nss/cmd/libpkix/pkix/top/test_buildchain_uchecker.c b/security/nss/cmd/libpkix/pkix/top/test_buildchain_uchecker.c index a489abca8..c8793101d 100644 --- a/security/nss/cmd/libpkix/pkix/top/test_buildchain_uchecker.c +++ b/security/nss/cmd/libpkix/pkix/top/test_buildchain_uchecker.c @@ -46,9 +46,10 @@ #define PKIX_TESTUSERCHECKER_TYPE (PKIX_NUMTYPES+30) -void *plContext = NULL; +static void *plContext = NULL; static PKIX_UInt32 numUserCheckerCalled = 0; +static void printUsage(void){ (void) printf("\nUSAGE:\ttest_buildchain_uchecker [ENE|EE] " "[-|[F]<userOID>] " @@ -76,7 +77,7 @@ testUserChecker( return(0); } -int main(int argc, char *argv[]) +int test_buildchain_uchecker(int argc, char *argv[]) { PKIX_BuildResult *buildResult = NULL; PKIX_ComCertSelParams *certSelParams = NULL; diff --git a/security/nss/cmd/libpkix/pkix/top/test_customcrlchecker.c b/security/nss/cmd/libpkix/pkix/top/test_customcrlchecker.c index 97079d155..2e1e3b99a 100644 --- a/security/nss/cmd/libpkix/pkix/top/test_customcrlchecker.c +++ b/security/nss/cmd/libpkix/pkix/top/test_customcrlchecker.c @@ -47,20 +47,22 @@ #define PKIX_TEST_MAX_CERTS 10 #define PKIX_TEST_COLLECTIONCERTSTORE_NUM_CRLS 5 -void *plContext = NULL; +static void *plContext = NULL; char *dirName = NULL; /* also used in callback */ +static void printUsage1(char *pName){ printf("\nUSAGE: %s test-purpose [ENE|EE] ", pName); printf("cert [certs].\n"); } +static void printUsageMax(PKIX_UInt32 numCerts){ printf("\nUSAGE ERROR: number of certs %d exceed maximum %d\n", numCerts, PKIX_TEST_MAX_CERTS); } -PKIX_Error * +static PKIX_Error * getCRLCallback( PKIX_CertStore *store, PKIX_CRLSelector *crlSelector, @@ -105,7 +107,7 @@ cleanup: } -PKIX_Error * +static PKIX_Error * getCRLContinue( PKIX_CertStore *store, PKIX_CRLSelector *crlSelector, @@ -116,7 +118,7 @@ getCRLContinue( return (NULL); } -PKIX_Error * +static PKIX_Error * getCertCallback( PKIX_CertStore *store, PKIX_CertSelector *certSelector, @@ -127,7 +129,7 @@ getCertCallback( return (NULL); } -PKIX_Error * +static PKIX_Error * getCertContinue( PKIX_CertStore *store, PKIX_CertSelector *certSelector, @@ -138,7 +140,7 @@ getCertContinue( return (NULL); } -PKIX_Error * +static PKIX_Error * testCRLSelectorMatchCallback( PKIX_CRLSelector *selector, PKIX_PL_CRL *crl, @@ -241,7 +243,7 @@ cleanup: } -PKIX_Error * +static PKIX_Error * testAddIssuerName(PKIX_ComCRLSelParams *comCrlSelParams, char *issuerName) { PKIX_PL_String *issuerString = NULL; @@ -278,7 +280,7 @@ cleanup: return (0); } -PKIX_Error * +static PKIX_Error * testCustomCertStore(PKIX_ValidateParams *valParams) { PKIX_CertStore_CRLCallback crlCallback; @@ -398,7 +400,7 @@ cleanup: * revocation check, CRL's are filtered based on the criteria set. */ -int main(int argc, char *argv[]){ +int test_customcrlchecker(int argc, char *argv[]){ PKIX_List *chain = NULL; PKIX_ValidateParams *valParams = NULL; diff --git a/security/nss/cmd/libpkix/pkix/top/test_defaultcrlchecker2stores.c b/security/nss/cmd/libpkix/pkix/top/test_defaultcrlchecker2stores.c index 4b6acf73f..eb209d4db 100644 --- a/security/nss/cmd/libpkix/pkix/top/test_defaultcrlchecker2stores.c +++ b/security/nss/cmd/libpkix/pkix/top/test_defaultcrlchecker2stores.c @@ -46,19 +46,21 @@ #define PKIX_TEST_MAX_CERTS 10 -void *plContext = NULL; +static void *plContext = NULL; +static void printUsage1(char *pName){ printf("\nUSAGE: %s test-purpose [ENE|EE] ", pName); printf("crl-directory cert [certs].\n"); } +static void printUsageMax(PKIX_UInt32 numCerts){ printf("\nUSAGE ERROR: number of certs %d exceed maximum %d\n", numCerts, PKIX_TEST_MAX_CERTS); } -PKIX_Error * +static PKIX_Error * getCertCallback( PKIX_CertStore *store, PKIX_CertSelector *certSelector, @@ -68,7 +70,7 @@ getCertCallback( return (NULL); } -PKIX_Error * +static PKIX_Error * testDefaultMultipleCertStores(PKIX_ValidateParams *valParams, char *crlDir1, char *crlDir2) @@ -156,7 +158,7 @@ cleanup: * required for revocation check to pass. */ -int main(int argc, char *argv[]){ +int test_defaultcrlchecker2stores(int argc, char *argv[]){ PKIX_List *chain = NULL; PKIX_ValidateParams *valParams = NULL; diff --git a/security/nss/cmd/libpkix/pkix/top/test_ocsp.c b/security/nss/cmd/libpkix/pkix/top/test_ocsp.c index fe1239b31..d18414e87 100644 --- a/security/nss/cmd/libpkix/pkix/top/test_ocsp.c +++ b/security/nss/cmd/libpkix/pkix/top/test_ocsp.c @@ -44,8 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static void printUsage(void){ (void) printf("\nUSAGE:\nOcspChecker TestName [ENE|EE] " "<certStoreDirectory> <trustedCert> <targetCert>\n\n"); @@ -58,6 +59,7 @@ void printUsage(void){ "If EE is specified, an Error is Expected.\n"); } +static char *createFullPathName( char *dirName, char *certFile, @@ -89,7 +91,7 @@ cleanup: return (certPathName); } -PKIX_Error * +static PKIX_Error * testDefaultCertStore(PKIX_ValidateParams *valParams, char *crlDir) { PKIX_PL_String *dirString = NULL; @@ -176,7 +178,7 @@ cleanup: return (0); } -int main(int argc, char *argv[]){ +int test_ocsp(int argc, char *argv[]){ PKIX_ValidateParams *valParams = NULL; PKIX_ProcessingParams *procParams = NULL; diff --git a/security/nss/cmd/libpkix/pkix/top/test_policychecker.c b/security/nss/cmd/libpkix/pkix/top/test_policychecker.c index 63b574d1f..addaa3a87 100644 --- a/security/nss/cmd/libpkix/pkix/top/test_policychecker.c +++ b/security/nss/cmd/libpkix/pkix/top/test_policychecker.c @@ -46,8 +46,9 @@ #define PKIX_TEST_MAX_CERTS 10 -void *plContext = NULL; +static void *plContext = NULL; +static void printUsage(char *testname) { char *fmt = "USAGE: %s testname" @@ -59,12 +60,14 @@ void printUsage(char *testname) { printf(fmt, testname); } +static void printUsageMax(PKIX_UInt32 numCerts) { printf("\nUSAGE ERROR: number of certs %d exceed maximum %d\n", numCerts, PKIX_TEST_MAX_CERTS); } +static PKIX_List *policySetParse(char *policyString) { char *p = NULL; @@ -157,7 +160,7 @@ cleanup: * RETURNS: * Nothing. */ -void +static void treeToStringHelper(PKIX_PolicyNode *parent, char *expected) { PKIX_PL_String *stringRep = NULL; @@ -188,6 +191,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testPass(char *dirName, char *goodInput, char *diffInput, char *dateAscii){ PKIX_List *chain = NULL; @@ -228,6 +232,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testNistTest1(char *dirName) { #define PKIX_TEST_NUM_CERTS 2 @@ -302,6 +307,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testNistTest2(char *dirName) { #define PKIX_TEST_NUM_CERTS 2 @@ -403,7 +409,7 @@ cleanup: PKIX_TEST_RETURN(); } -int main(int argc, char *argv[]) +int test_policychecker(int argc, char *argv[]) { PKIX_Boolean initialPolicyMappingInhibit = PKIX_FALSE; diff --git a/security/nss/cmd/libpkix/pkix/top/test_subjaltnamechecker.c b/security/nss/cmd/libpkix/pkix/top/test_subjaltnamechecker.c index 33d91623b..b0e9b3e88 100644 --- a/security/nss/cmd/libpkix/pkix/top/test_subjaltnamechecker.c +++ b/security/nss/cmd/libpkix/pkix/top/test_subjaltnamechecker.c @@ -53,13 +53,15 @@ #define PKIX_TEST_MAX_CERTS 10 -void *plContext = NULL; +static void *plContext = NULL; +static void printUsage1(char *pName){ printf("\nUSAGE: %s test-name [ENE|EE] ", pName); printf("cert [certs].\n"); } +static void printUsage2(char *name) { printf("\ninvalid test-name syntax - %s", name); printf("\ntest-name syntax: [01][DNORU]:<name>+..."); @@ -73,11 +75,13 @@ void printUsage2(char *name) { printf("\n + separator for more names\n\n"); } +static void printUsageMax(PKIX_UInt32 numCerts){ printf("\nUSAGE ERROR: number of certs %d exceed maximum %d\n", numCerts, PKIX_TEST_MAX_CERTS); } +static PKIX_UInt32 getNameType(char *name){ PKIX_UInt32 nameType; @@ -111,7 +115,7 @@ cleanup: return (nameType); } -int main(int argc, char *argv[]){ +int test_subjaltnamechecker(int argc, char *argv[]){ PKIX_List *chain = NULL; PKIX_ValidateParams *valParams = NULL; diff --git a/security/nss/cmd/libpkix/pkix/top/test_validatechain.c b/security/nss/cmd/libpkix/pkix/top/test_validatechain.c index c72885a37..ec886d07c 100644 --- a/security/nss/cmd/libpkix/pkix/top/test_validatechain.c +++ b/security/nss/cmd/libpkix/pkix/top/test_validatechain.c @@ -44,8 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static void printUsage(void){ (void) printf("\nUSAGE:\nvalidateChain TestName [ENE|EE] " "<certStoreDirectory> <trustedCert> <targetCert>\n\n"); @@ -58,6 +59,7 @@ void printUsage(void){ "If EE is specified, an Error is Expected.\n"); } +static char *createFullPathName( char *dirName, char *certFile, @@ -89,7 +91,7 @@ cleanup: return (certPathName); } -PKIX_Error * +static PKIX_Error * testDefaultCertStore(PKIX_ValidateParams *valParams, char *crlDir) { PKIX_PL_String *dirString = NULL; @@ -158,7 +160,7 @@ cleanup: return (0); } -int main(int argc, char *argv[]){ +int test_validatechain(int argc, char *argv[]){ PKIX_ValidateParams *valParams = NULL; PKIX_ValidateResult *valResult = NULL; diff --git a/security/nss/cmd/libpkix/pkix/top/test_validatechain_NB.c b/security/nss/cmd/libpkix/pkix/top/test_validatechain_NB.c index d55d1556c..a1a9bd026 100644 --- a/security/nss/cmd/libpkix/pkix/top/test_validatechain_NB.c +++ b/security/nss/cmd/libpkix/pkix/top/test_validatechain_NB.c @@ -44,8 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static void printUsage(void){ (void) printf("\nUSAGE:\ntest_validateChain_NB TestName [ENE|EE] " "<certStoreDirectory> <trustedCert> <targetCert>\n\n"); @@ -58,6 +59,7 @@ void printUsage(void){ "If EE is specified, an Error is Expected.\n"); } +static char *createFullPathName( char *dirName, char *certFile, @@ -89,7 +91,7 @@ cleanup: return (certPathName); } -PKIX_Error * +static PKIX_Error * testSetupCertStore(PKIX_ValidateParams *valParams, char *ldapName) { PKIX_PL_String *dirString = NULL; @@ -137,11 +139,11 @@ cleanup: return (0); } -char *levels[] = { +static char *levels[] = { "None", "Fatal Error", "Error", "Warning", "Debug", "Trace" }; -PKIX_Error *loggerCallback( +static PKIX_Error *loggerCallback( PKIX_Logger *logger, PKIX_PL_String *message, PKIX_UInt32 logLevel, @@ -167,6 +169,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testLogErrors( PKIX_ERRORNUM module, PKIX_UInt32 loggingLevel, @@ -194,7 +197,7 @@ cleanup: PKIX_TEST_RETURN(); } -int main(int argc, char *argv[]){ +int test_validatechain_NB(int argc, char *argv[]){ PKIX_ValidateParams *valParams = NULL; PKIX_ValidateResult *valResult = NULL; diff --git a/security/nss/cmd/libpkix/pkix/top/test_validatechain_bc.c b/security/nss/cmd/libpkix/pkix/top/test_validatechain_bc.c index 4f6cf49e7..c45ed812e 100644 --- a/security/nss/cmd/libpkix/pkix/top/test_validatechain_bc.c +++ b/security/nss/cmd/libpkix/pkix/top/test_validatechain_bc.c @@ -65,13 +65,14 @@ #include "keythi.h" #include "nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static void printUsage(void){ printf("\nUSAGE: incorrect.\n"); } -PKIX_PL_Cert * +static PKIX_PL_Cert * createCert(char *inFileName) { PKIX_PL_ByteArray *byteArray = NULL; @@ -129,7 +130,7 @@ cleanup: return (cert); } -int main(int argc, char *argv[]) +int test_validatechain_bc(int argc, char *argv[]) { PKIX_TrustAnchor *anchor = NULL; diff --git a/security/nss/cmd/libpkix/pkix/util/Makefile b/security/nss/cmd/libpkix/pkix/util/Makefile index 15a060b07..2a760dcd6 100755 --- a/security/nss/cmd/libpkix/pkix/util/Makefile +++ b/security/nss/cmd/libpkix/pkix/util/Makefile @@ -46,7 +46,6 @@ include manifest.mn # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### -include $(PKIX_DEPTH)/pkixrules.mk include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### @@ -58,7 +57,6 @@ include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### include $(PLAT_DEPTH)/platlibs.mk -include $(PKIX_DEPTH)/pkixlibs.mk ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # @@ -77,4 +75,3 @@ include $(CORE_DEPTH)/coreconf/rules.mk ####################################################################### include $(PLAT_DEPTH)/platrules.mk - diff --git a/security/nss/cmd/libpkix/pkix/util/manifest.mn b/security/nss/cmd/libpkix/pkix/util/manifest.mn index e8153999e..1725cd0d7 100755 --- a/security/nss/cmd/libpkix/pkix/util/manifest.mn +++ b/security/nss/cmd/libpkix/pkix/util/manifest.mn @@ -36,6 +36,8 @@ # ***** END LICENSE BLOCK ***** PKIX_DEPTH = ../.. +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. # MODULE public and private header directories are implicitly REQUIRED. MODULE = nss @@ -46,8 +48,10 @@ CSRCS = test_error.c \ test_logger.c \ $(NULL) -PROGRAMS = $(CSRCS:.c=) +LIBRARY_NAME=pkixtoolutil -TARGETS = $(PROGRAMS) +TARGETS = $(LIBRARY) + +SOURCE_LIB_DIR=$(PKIX_DEPTH)/$(OBJDIR) NO_MD_RELEASE = 1 diff --git a/security/nss/cmd/libpkix/pkix/util/test_error.c b/security/nss/cmd/libpkix/pkix/util/test_error.c index 0d88bd240..d01068743 100644 --- a/security/nss/cmd/libpkix/pkix/util/test_error.c +++ b/security/nss/cmd/libpkix/pkix/util/test_error.c @@ -44,8 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static void createErrors( PKIX_Error **error, PKIX_Error **error2, @@ -138,6 +139,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testGetErrorCode(PKIX_Error *error, PKIX_Error *error2){ PKIX_UInt32 code; @@ -171,6 +173,7 @@ cleanup: } +static void testGetDescription( PKIX_Error *error, PKIX_Error *error2, @@ -226,6 +229,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testGetCause(PKIX_Error *error, PKIX_Error *error2, PKIX_Error *error3){ PKIX_Error *error4 = NULL; @@ -275,6 +279,7 @@ cleanup: } +static void testGetSupplementaryInfo(PKIX_Error *error, char *infoChar){ PKIX_PL_Object *targetString = NULL; @@ -301,7 +306,7 @@ cleanup: } -void +static void testPrimitiveError(void) { PKIX_PL_String *targetString = NULL; @@ -334,7 +339,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testChaining(PKIX_Error *error7) { PKIX_PL_String *targetString = NULL; @@ -375,7 +380,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testDestroy(PKIX_Error *error) { PKIX_TEST_STD_VARS(); @@ -387,7 +392,7 @@ cleanup: PKIX_TEST_RETURN(); } -int main(int argc, char *argv[]) { +int test_error(int argc, char *argv[]) { PKIX_Error *error, *error2, *error3, *error5, *error6, *error7; char *descChar = "Error Message"; diff --git a/security/nss/cmd/libpkix/pkix/util/test_list.c b/security/nss/cmd/libpkix/pkix/util/test_list.c index 7b5cf08c0..6f97038a8 100644 --- a/security/nss/cmd/libpkix/pkix/util/test_list.c +++ b/security/nss/cmd/libpkix/pkix/util/test_list.c @@ -44,9 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; -void +static void createLists(PKIX_List **list, PKIX_List **list2) { PKIX_TEST_STD_VARS(); @@ -59,7 +59,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testReverseList(void) { PKIX_List *firstList = NULL; @@ -176,7 +176,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testZeroLengthList(PKIX_List *list) { PKIX_UInt32 length; @@ -257,7 +257,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testGetLength(PKIX_List *list) { PKIX_UInt32 length; @@ -275,7 +275,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testGetSetItem( PKIX_List *list, char *testItemString, @@ -396,7 +396,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testInsertItem( PKIX_List *list, PKIX_PL_String *testItem, @@ -441,7 +441,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testAppendItem(PKIX_List *list, PKIX_PL_String *testItem) { PKIX_UInt32 length2; @@ -474,7 +474,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testNestedLists( PKIX_List *list, PKIX_List *list2, @@ -533,7 +533,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testDeleteItem( PKIX_List *list, PKIX_List *list2, @@ -659,7 +659,7 @@ cleanup: #if testContainsFunction /* This test requires pkix_List_Contains to be in nss.def */ -void +static void testContains(void) { @@ -743,7 +743,7 @@ cleanup: } #endif -void +static void testErrorHandling(void) { PKIX_List *emptylist = NULL; @@ -779,7 +779,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testDestroy(PKIX_List *list) { PKIX_TEST_STD_VARS(); @@ -791,7 +791,7 @@ cleanup: PKIX_TEST_RETURN(); } -int main(int argc, char *argv[]) { +int test_list(int argc, char *argv[]) { PKIX_List *list, *list2; PKIX_PL_String *testItem, *testItem2, *testItem3; diff --git a/security/nss/cmd/libpkix/pkix/util/test_list2.c b/security/nss/cmd/libpkix/pkix/util/test_list2.c index 1030413a5..e1df956f5 100644 --- a/security/nss/cmd/libpkix/pkix/util/test_list2.c +++ b/security/nss/cmd/libpkix/pkix/util/test_list2.c @@ -44,9 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; -int main(int argc, char *argv[]) { +int test_list2(int argc, char *argv[]) { PKIX_List *list; char *temp; diff --git a/security/nss/cmd/libpkix/pkix/util/test_logger.c b/security/nss/cmd/libpkix/pkix/util/test_logger.c index 7db7df85d..22815cf88 100644 --- a/security/nss/cmd/libpkix/pkix/util/test_logger.c +++ b/security/nss/cmd/libpkix/pkix/util/test_logger.c @@ -44,9 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; -char *levels[] = { +static char *levels[] = { "None", "Fatal Error", "Error", @@ -55,6 +55,7 @@ char *levels[] = { "Trace" }; +static PKIX_Error *testLoggerCallback( PKIX_Logger *logger, PKIX_PL_String *message, @@ -85,6 +86,7 @@ cleanup: PKIX_TEST_RETURN(); } +static PKIX_Error *testLoggerCallback2( PKIX_Logger *logger, PKIX_PL_String *message, @@ -108,7 +110,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void createLogger(PKIX_Logger **logger, PKIX_PL_Object *context, PKIX_Logger_LogCallback cb) @@ -123,7 +125,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testContextCallback(PKIX_Logger *logger, PKIX_Logger *logger2) { PKIX_Logger_LogCallback cb = NULL; @@ -154,7 +156,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testComponent(PKIX_Logger *logger) { PKIX_ERRORNUM compName = (PKIX_ERRORNUM)NULL; @@ -187,7 +189,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testMaxLoggingLevel(PKIX_Logger *logger) { PKIX_UInt32 level = 0; @@ -218,7 +220,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testLogger(PKIX_Logger *logger, PKIX_Logger *logger2) { PKIX_List *loggerList = NULL; @@ -305,7 +307,8 @@ cleanup: PKIX_TEST_DECREF_AC(checkList); PKIX_TEST_RETURN(); } -void + +static void testDestroy(PKIX_Logger *logger) { PKIX_TEST_STD_VARS(); @@ -317,7 +320,7 @@ cleanup: PKIX_TEST_RETURN(); } -int main(int argc, char *argv[]) { +int test_logger(int argc, char *argv[]) { PKIX_Logger *logger, *logger2; PKIX_UInt32 actualMinorVersion; diff --git a/security/nss/cmd/libpkix/pkix_pl/Makefile b/security/nss/cmd/libpkix/pkix_pl/Makefile index dfafebf4b..f3040ed6e 100755 --- a/security/nss/cmd/libpkix/pkix_pl/Makefile +++ b/security/nss/cmd/libpkix/pkix_pl/Makefile @@ -46,7 +46,6 @@ include manifest.mn # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### -include $(PKIX_DEPTH)/pkixrules.mk include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### diff --git a/security/nss/cmd/libpkix/pkix_pl/manifest.mn b/security/nss/cmd/libpkix/pkix_pl/manifest.mn index 6f90c5b0d..cc1f1d6c8 100755 --- a/security/nss/cmd/libpkix/pkix_pl/manifest.mn +++ b/security/nss/cmd/libpkix/pkix_pl/manifest.mn @@ -36,6 +36,8 @@ # ***** END LICENSE BLOCK ***** PKIX_DEPTH = ./.. +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. DIRS = module pki system \ $(NULL) diff --git a/security/nss/cmd/libpkix/pkix_pl/module/Makefile b/security/nss/cmd/libpkix/pkix_pl/module/Makefile index 15a060b07..2a760dcd6 100755 --- a/security/nss/cmd/libpkix/pkix_pl/module/Makefile +++ b/security/nss/cmd/libpkix/pkix_pl/module/Makefile @@ -46,7 +46,6 @@ include manifest.mn # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### -include $(PKIX_DEPTH)/pkixrules.mk include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### @@ -58,7 +57,6 @@ include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### include $(PLAT_DEPTH)/platlibs.mk -include $(PKIX_DEPTH)/pkixlibs.mk ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # @@ -77,4 +75,3 @@ include $(CORE_DEPTH)/coreconf/rules.mk ####################################################################### include $(PLAT_DEPTH)/platrules.mk - diff --git a/security/nss/cmd/libpkix/pkix_pl/module/manifest.mn b/security/nss/cmd/libpkix/pkix_pl/module/manifest.mn index 943fbda17..ea98a7951 100755 --- a/security/nss/cmd/libpkix/pkix_pl/module/manifest.mn +++ b/security/nss/cmd/libpkix/pkix_pl/module/manifest.mn @@ -36,6 +36,8 @@ # ***** END LICENSE BLOCK ***** PKIX_DEPTH = ../.. +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. # MODULE public and private header directories are implicitly REQUIRED. MODULE = nss @@ -47,8 +49,10 @@ CSRCS = test_colcertstore.c \ test_httpcertstore.c \ $(NULL) -PROGRAMS = $(CSRCS:.c=) +LIBRARY_NAME=pkixtoolmodule -TARGETS = $(PROGRAMS) +TARGETS = $(LIBRARY) + +SOURCE_LIB_DIR=$(PKIX_DEPTH)/$(OBJDIR) NO_MD_RELEASE = 1 diff --git a/security/nss/cmd/libpkix/pkix_pl/module/test_colcertstore.c b/security/nss/cmd/libpkix/pkix_pl/module/test_colcertstore.c index cf43df9b0..0da7f1666 100644 --- a/security/nss/cmd/libpkix/pkix_pl/module/test_colcertstore.c +++ b/security/nss/cmd/libpkix/pkix_pl/module/test_colcertstore.c @@ -49,9 +49,9 @@ #define PKIX_TEST_COLLECTIONCERTSTORE_NUM_CRLS 4 #define PKIX_TEST_COLLECTIONCERTSTORE_NUM_CERTS 15 -void *plContext = NULL; +static void *plContext = NULL; -PKIX_Error * +static PKIX_Error * testCRLSelectorMatchCallback( PKIX_CRLSelector *selector, PKIX_PL_CRL *crl, @@ -63,7 +63,7 @@ testCRLSelectorMatchCallback( return (0); } -PKIX_Error * +static PKIX_Error * testCertSelectorMatchCallback( PKIX_CertSelector *selector, PKIX_PL_Cert *cert, @@ -75,7 +75,7 @@ testCertSelectorMatchCallback( return (0); } -PKIX_Error * +static PKIX_Error * getCertCallback( PKIX_CertStore *store, PKIX_CertSelector *certSelector, @@ -110,6 +110,7 @@ cleanup: return (pathName); } +static void testGetCRL(char *crlDir) { PKIX_PL_String *dirString = NULL; @@ -173,6 +174,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testGetCert(char *certDir) { PKIX_PL_String *dirString = NULL; @@ -236,13 +238,13 @@ cleanup: PKIX_TEST_RETURN(); } -void printUsage(char *pName){ +static void printUsage(char *pName){ printf("\nUSAGE: %s test-purpose <data-dir> <platform-dir>\n\n", pName); } /* Functional tests for CollectionCertStore public functions */ -int main(int argc, char *argv[]) { +int test_colcertstore(int argc, char *argv[]) { PKIX_UInt32 actualMinorVersion; PKIX_Boolean useArenas = PKIX_FALSE; diff --git a/security/nss/cmd/libpkix/pkix_pl/module/test_ekuchecker.c b/security/nss/cmd/libpkix/pkix_pl/module/test_ekuchecker.c index 80713615b..3a094a938 100644 --- a/security/nss/cmd/libpkix/pkix_pl/module/test_ekuchecker.c +++ b/security/nss/cmd/libpkix/pkix_pl/module/test_ekuchecker.c @@ -46,19 +46,20 @@ #define PKIX_TEST_MAX_CERTS 10 -void *plContext = NULL; +static void *plContext = NULL; +static void printUsage1(char *pName){ printf("\nUSAGE: %s test-purpose [ENE|EE] ", pName); printf("[E]oid[,oid]* <data-dir> cert [certs].\n"); } -void printUsageMax(PKIX_UInt32 numCerts){ +static void printUsageMax(PKIX_UInt32 numCerts){ printf("\nUSAGE ERROR: number of certs %d exceed maximum %d\n", numCerts, PKIX_TEST_MAX_CERTS); } -PKIX_Error * +static PKIX_Error * testCertSelectorMatchCallback( PKIX_CertSelector *selector, PKIX_PL_Cert *cert, @@ -70,7 +71,7 @@ testCertSelectorMatchCallback( return (0); } -PKIX_Error * +static PKIX_Error * testEkuSetup( PKIX_ValidateParams *valParams, char *ekuOidString, @@ -183,7 +184,7 @@ cleanup: return (0); } -PKIX_Error * +static PKIX_Error * testEkuChecker( PKIX_ValidateParams *valParams, PKIX_Boolean only4EE) @@ -214,7 +215,7 @@ cleanup: return (0); } -int main(int argc, char *argv[]){ +int test_ekuchecker(int argc, char *argv[]){ PKIX_List *chain = NULL; PKIX_ValidateParams *valParams = NULL; PKIX_ValidateResult *valResult = NULL; diff --git a/security/nss/cmd/libpkix/pkix_pl/module/test_httpcertstore.c b/security/nss/cmd/libpkix/pkix_pl/module/test_httpcertstore.c index 4d9948a8a..901566992 100644 --- a/security/nss/cmd/libpkix/pkix_pl/module/test_httpcertstore.c +++ b/security/nss/cmd/libpkix/pkix_pl/module/test_httpcertstore.c @@ -39,8 +39,9 @@ #include "testutil_nss.h" #include "pkix_pl_common.h" -void *plContext = NULL; +static void *plContext = NULL; +static void printUsage(char *testname) { char *fmt = "USAGE: %s [-arenas] certDir certName\n"; @@ -48,6 +49,7 @@ void printUsage(char *testname) { } /* Functional tests for Socket public functions */ +static void do_other_work(void) { /* while waiting for nonblocking I/O to complete */ (void) PR_Sleep(2*60); } @@ -66,7 +68,7 @@ pkix_pl_HttpCertStore_CreateWithAsciiName( PKIX_CertStore **pCertStore, void *plContext); -PKIX_Error * +static PKIX_Error * getLocation( PKIX_PL_Cert *certWithAia, PKIX_PL_GeneralName **pLocation, @@ -119,7 +121,7 @@ cleanup: return (NULL); } -int main(int argc, char *argv[]) { +int test_httpcertstore(int argc, char *argv[]) { PKIX_UInt32 i = 0; PKIX_UInt32 numCerts = 0; diff --git a/security/nss/cmd/libpkix/pkix_pl/module/test_pk11certstore.c b/security/nss/cmd/libpkix/pkix_pl/module/test_pk11certstore.c index 9a61a9c63..d5d4e194b 100644 --- a/security/nss/cmd/libpkix/pkix_pl/module/test_pk11certstore.c +++ b/security/nss/cmd/libpkix/pkix_pl/module/test_pk11certstore.c @@ -45,13 +45,14 @@ #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; /* * This function creates a certSelector with ComCertSelParams set up to * select entries whose Subject Name matches that in the given Cert and * whose validity window includes the Date specified by "validityDate". */ +static void test_makeSubjectCertSelector( PKIX_PL_Cert *certNameToMatch, PKIX_PL_Date *validityDate, @@ -92,6 +93,7 @@ cleanup: * select entries containing a Basic Constraints extension with a path * length of at least the specified "minPathLength". */ +static void test_makePathCertSelector( PKIX_Int32 minPathLength, PKIX_CertSelector **pSelector, @@ -127,6 +129,7 @@ cleanup: * for a Subject Name match, and then queries the database for matching entries. * It is intended to test a "smart" database query. */ +static void testMatchCertSubject( char *crlDir, char *desiredSubjectCert, @@ -198,6 +201,7 @@ cleanup: * available certs and the filtering will be done by the interaction of the * certstore and the selector. */ +static void testMatchCertMinPath( PKIX_Int32 minPath, char *expectedAscii, @@ -247,6 +251,7 @@ cleanup: * This function creates a crlSelector with ComCrlSelParams set up to * select entries whose Issuer Name matches that in the given Crl. */ +static void test_makeIssuerCRLSelector( PKIX_PL_CRL *crlNameToMatch, PKIX_CRLSelector **pSelector, @@ -290,6 +295,7 @@ cleanup: * select entries that would be valid at the Date specified by the Date * criterion. */ +static void test_makeDateCRLSelector( PKIX_PL_Date *dateToMatch, PKIX_CRLSelector **pSelector, @@ -323,6 +329,7 @@ cleanup: * for a Issuer Name match, and then queries the database for matching entries. * It is intended to test the case of a "smart" database query. */ +static void testMatchCrlIssuer( char *crlDir, char *desiredIssuerCrl, @@ -390,6 +397,7 @@ cleanup: * rather than ask the database for all available CRLs and then filter the * results using the selector. */ +static void testMatchCrlDate( char *dateMatch, char *expectedAscii, @@ -427,13 +435,14 @@ cleanup: PKIX_TEST_RETURN(); } +static void printUsage(char *pName){ printf("\nUSAGE: %s <data-dir> <database-dir>\n\n", pName); } /* Functional tests for Pk11CertStore public functions */ -int main(int argc, char *argv[]) { +int test_pk11certstore(int argc, char *argv[]) { PKIX_Boolean useArenas = PKIX_FALSE; PKIX_UInt32 j = 0; diff --git a/security/nss/cmd/libpkix/pkix_pl/module/test_socket.c b/security/nss/cmd/libpkix/pkix_pl/module/test_socket.c index f14ecb41a..9f1cfd9fa 100644 --- a/security/nss/cmd/libpkix/pkix_pl/module/test_socket.c +++ b/security/nss/cmd/libpkix/pkix_pl/module/test_socket.c @@ -41,7 +41,7 @@ #define LDAP_PORT 389 -void *plContext = NULL; +static void *plContext = NULL; typedef enum { SERVER_LISTENING, @@ -90,16 +90,19 @@ char *sendBuf4 = "What do you mean, \"What do you mean, \'Ack\'?\"?"; char rcvBuf1[100]; char rcvBuf2[100]; +static void printUsage(char *testname) { char *fmt = "USAGE: %s [-arenas] server:port\n"; printf(fmt, testname); } /* Functional tests for Socket public functions */ +static void do_other_work(void) { /* while waiting for nonblocking I/O to complete */ (void) PR_Sleep(2*60); } +static PKIX_Boolean server() { PKIX_Int32 bytesRead = 0; @@ -249,6 +252,7 @@ cleanup: return (keepGoing); } +static PKIX_Boolean client() { PKIX_Boolean keepGoing = PKIX_FALSE; PKIX_Int32 bytesRead = 0; @@ -413,6 +417,7 @@ cleanup: return (keepGoing); } +static void dispatcher() { PKIX_Boolean keepGoing = PKIX_FALSE; @@ -437,7 +442,7 @@ void dispatcher() PKIX_TEST_RETURN(); } -int main(int argc, char *argv[]) { +int test_socket(int argc, char *argv[]) { PKIX_Boolean useArenas = PKIX_FALSE; int j = 0; diff --git a/security/nss/cmd/libpkix/pkix_pl/pki/Makefile b/security/nss/cmd/libpkix/pkix_pl/pki/Makefile index 15a060b07..2a760dcd6 100755 --- a/security/nss/cmd/libpkix/pkix_pl/pki/Makefile +++ b/security/nss/cmd/libpkix/pkix_pl/pki/Makefile @@ -46,7 +46,6 @@ include manifest.mn # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### -include $(PKIX_DEPTH)/pkixrules.mk include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### @@ -58,7 +57,6 @@ include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### include $(PLAT_DEPTH)/platlibs.mk -include $(PKIX_DEPTH)/pkixlibs.mk ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # @@ -77,4 +75,3 @@ include $(CORE_DEPTH)/coreconf/rules.mk ####################################################################### include $(PLAT_DEPTH)/platrules.mk - diff --git a/security/nss/cmd/libpkix/pkix_pl/pki/manifest.mn b/security/nss/cmd/libpkix/pkix_pl/pki/manifest.mn index bb78acd55..6344be364 100755 --- a/security/nss/cmd/libpkix/pkix_pl/pki/manifest.mn +++ b/security/nss/cmd/libpkix/pkix_pl/pki/manifest.mn @@ -36,6 +36,8 @@ # ***** END LICENSE BLOCK ***** PKIX_DEPTH = ../.. +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. # MODULE public and private header directories are implicitly REQUIRED. MODULE = nss @@ -51,8 +53,10 @@ CSRCS = test_cert.c \ test_subjectinfoaccess.c \ $(NULL) -PROGRAMS = $(CSRCS:.c=) +LIBRARY_NAME=pkixtoolpki -TARGETS = $(PROGRAMS) +TARGETS = $(LIBRARY) + +SOURCE_LIB_DIR=$(PKIX_DEPTH)/$(OBJDIR) NO_MD_RELEASE = 1 diff --git a/security/nss/cmd/libpkix/pkix_pl/pki/test_authorityinfoaccess.c b/security/nss/cmd/libpkix/pkix_pl/pki/test_authorityinfoaccess.c index 37a8920b4..ebfedd1ae 100644 --- a/security/nss/cmd/libpkix/pkix_pl/pki/test_authorityinfoaccess.c +++ b/security/nss/cmd/libpkix/pkix_pl/pki/test_authorityinfoaccess.c @@ -46,9 +46,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; -int main(int argc, char *argv[]) { +int test_authorityinfoaccess(int argc, char *argv[]) { PKIX_PL_Cert *cert = NULL; PKIX_PL_Cert *certDiff = NULL; diff --git a/security/nss/cmd/libpkix/pkix_pl/pki/test_cert.c b/security/nss/cmd/libpkix/pkix_pl/pki/test_cert.c index 959364c8c..67afcf509 100644 --- a/security/nss/cmd/libpkix/pkix_pl/pki/test_cert.c +++ b/security/nss/cmd/libpkix/pkix_pl/pki/test_cert.c @@ -65,9 +65,9 @@ static PKIX_PL_Cert *altNameOidCert = NULL; static PKIX_PL_Cert *altNameOidCert_diff = NULL; static PKIX_PL_Cert *altNameMultipleCert = NULL; -void *plContext = NULL; +static void *plContext = NULL; -void createCerts( +static void createCerts( char *dataCentralDir, char *goodInput, char *diffInput, @@ -2225,11 +2225,12 @@ cleanup: } +static void printUsage(void) { (void) printf("\nUSAGE:\ttest_cert <test-purpose> <data-central-dir> <data-dir>\n\n"); } -int main(int argc, char *argv[]) { +int test_cert(int argc, char *argv[]) { PKIX_PL_Cert *goodObject = NULL; PKIX_PL_Cert *equalObject = NULL; diff --git a/security/nss/cmd/libpkix/pkix_pl/pki/test_crl.c b/security/nss/cmd/libpkix/pkix_pl/pki/test_crl.c index 81c2c66ff..b25ee8289 100644 --- a/security/nss/cmd/libpkix/pkix_pl/pki/test_crl.c +++ b/security/nss/cmd/libpkix/pkix_pl/pki/test_crl.c @@ -44,8 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static void createCRLs( char *dataDir, char *goodInput, @@ -237,13 +238,14 @@ cleanup: PKIX_TEST_RETURN(); } +static void printUsage(void) { (void) printf("\nUSAGE:\ttest_crl <test-purpose> <data-central-dir>\n\n"); } /* Functional tests for CRL public functions */ -int main(int argc, char *argv[]) { +int test_crl(int argc, char *argv[]) { PKIX_PL_CRL *goodObject = NULL; PKIX_PL_CRL *equalObject = NULL; PKIX_PL_CRL *diffObject = NULL; diff --git a/security/nss/cmd/libpkix/pkix_pl/pki/test_crlentry.c b/security/nss/cmd/libpkix/pkix_pl/pki/test_crlentry.c index 2a70d0069..4062d92e2 100644 --- a/security/nss/cmd/libpkix/pkix_pl/pki/test_crlentry.c +++ b/security/nss/cmd/libpkix/pkix_pl/pki/test_crlentry.c @@ -44,8 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static void createCRLEntries( char *dataDir, char *crlInput, @@ -170,13 +171,14 @@ testGetCriticalExtensionOIDs(PKIX_PL_CRLEntry *goodObject) } +static void printUsage(void) { (void) printf("\nUSAGE:\ttest_crlentry <data-dir>\n\n"); } /* Functional tests for CRLENTRY public functions */ -int main(int argc, char *argv[]) { +int test_crlentry(int argc, char *argv[]) { PKIX_PL_CRL *crl = NULL; PKIX_PL_CRLEntry *goodObject = NULL; PKIX_PL_CRLEntry *equalObject = NULL; diff --git a/security/nss/cmd/libpkix/pkix_pl/pki/test_date.c b/security/nss/cmd/libpkix/pkix_pl/pki/test_date.c index 997b7cdf2..ed944aaf3 100644 --- a/security/nss/cmd/libpkix/pkix_pl/pki/test_date.c +++ b/security/nss/cmd/libpkix/pkix_pl/pki/test_date.c @@ -46,7 +46,7 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; static void createDates(char *goodInput, char *diffInput, @@ -82,6 +82,7 @@ cleanup: } +static void testDate(char *goodInput, char *diffInput){ PKIX_PL_Date *goodDate = NULL; @@ -110,7 +111,7 @@ void testDate(char *goodInput, char *diffInput){ } -int main(int argc, char *argv[]) { +int test_date(int argc, char *argv[]) { char *goodInput = NULL; char *diffInput = NULL; diff --git a/security/nss/cmd/libpkix/pkix_pl/pki/test_generalname.c b/security/nss/cmd/libpkix/pkix_pl/pki/test_generalname.c index 7ab4bdb75..16b826041 100644 --- a/security/nss/cmd/libpkix/pkix_pl/pki/test_generalname.c +++ b/security/nss/cmd/libpkix/pkix_pl/pki/test_generalname.c @@ -44,7 +44,7 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; static void createGeneralNames(PKIX_UInt32 nameType, char *goodInput, char *diffInput, @@ -80,7 +80,7 @@ cleanup: } -void testNameType +static void testNameType (PKIX_UInt32 nameType, char *goodInput, char *diffInput, char *expectedAscii){ PKIX_PL_GeneralName *goodName = NULL; @@ -101,7 +101,7 @@ void testNameType testDestroy(goodName, equalName, diffName); } -int main(int argc, char *argv[]) { +int test_generalname(int argc, char *argv[]) { char *goodInput = NULL; char *diffInput = NULL; diff --git a/security/nss/cmd/libpkix/pkix_pl/pki/test_nameconstraints.c b/security/nss/cmd/libpkix/pkix_pl/pki/test_nameconstraints.c index c283e9558..c7ab3230e 100644 --- a/security/nss/cmd/libpkix/pkix_pl/pki/test_nameconstraints.c +++ b/security/nss/cmd/libpkix/pkix_pl/pki/test_nameconstraints.c @@ -44,7 +44,7 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; static char *catDirName(char *platform, char *dir, void *plContext) { @@ -107,6 +107,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void printUsage(void) { (void) printf ("\nUSAGE:\ttest_nameconstraints <test-purpose>" @@ -115,7 +116,7 @@ void printUsage(void) { /* Functional tests for CRL public functions */ -int main(int argc, char *argv[]) { +int test_nameconstraints(int argc, char *argv[]) { PKIX_UInt32 actualMinorVersion; PKIX_UInt32 j = 0; char *platformDir = NULL; diff --git a/security/nss/cmd/libpkix/pkix_pl/pki/test_subjectinfoaccess.c b/security/nss/cmd/libpkix/pkix_pl/pki/test_subjectinfoaccess.c index 5b4d94d34..79e32603e 100644 --- a/security/nss/cmd/libpkix/pkix_pl/pki/test_subjectinfoaccess.c +++ b/security/nss/cmd/libpkix/pkix_pl/pki/test_subjectinfoaccess.c @@ -46,9 +46,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; -int main(int argc, char *argv[]) { +int test_subjectinfoaccess(int argc, char *argv[]) { PKIX_PL_Cert *cert = NULL; PKIX_PL_Cert *certDiff = NULL; diff --git a/security/nss/cmd/libpkix/pkix_pl/pki/test_x500name.c b/security/nss/cmd/libpkix/pkix_pl/pki/test_x500name.c index eb7bc6404..502c7b2f0 100644 --- a/security/nss/cmd/libpkix/pkix_pl/pki/test_x500name.c +++ b/security/nss/cmd/libpkix/pkix_pl/pki/test_x500name.c @@ -44,7 +44,7 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; static PKIX_PL_X500Name * createX500Name(char *asciiName, PKIX_Boolean expectedToPass){ @@ -160,7 +160,7 @@ cleanup: } -int main(int argc, char *argv[]) { +int test_x500name(int argc, char *argv[]) { PKIX_PL_X500Name *goodObject = NULL; PKIX_PL_X500Name *equalObject = NULL; diff --git a/security/nss/cmd/libpkix/pkix_pl/system/Makefile b/security/nss/cmd/libpkix/pkix_pl/system/Makefile index 15a060b07..2a760dcd6 100755 --- a/security/nss/cmd/libpkix/pkix_pl/system/Makefile +++ b/security/nss/cmd/libpkix/pkix_pl/system/Makefile @@ -46,7 +46,6 @@ include manifest.mn # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### -include $(PKIX_DEPTH)/pkixrules.mk include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### @@ -58,7 +57,6 @@ include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### include $(PLAT_DEPTH)/platlibs.mk -include $(PKIX_DEPTH)/pkixlibs.mk ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # @@ -77,4 +75,3 @@ include $(CORE_DEPTH)/coreconf/rules.mk ####################################################################### include $(PLAT_DEPTH)/platrules.mk - diff --git a/security/nss/cmd/libpkix/pkix_pl/system/manifest.mn b/security/nss/cmd/libpkix/pkix_pl/system/manifest.mn index ac24453d8..18bb060da 100755 --- a/security/nss/cmd/libpkix/pkix_pl/system/manifest.mn +++ b/security/nss/cmd/libpkix/pkix_pl/system/manifest.mn @@ -36,6 +36,8 @@ # ***** END LICENSE BLOCK ***** PKIX_DEPTH = ../.. +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. # MODULE public and private header directories are implicitly REQUIRED. MODULE = nss @@ -60,8 +62,11 @@ CSRCS = test_bigint.c \ test_string2.c \ $(NULL) -PROGRAMS = $(CSRCS:.c=) -TARGETS = $(PROGRAMS) +LIBRARY_NAME=pkixtoolsys +TARGETS = $(LIBRARY) + +SOURCE_LIB_DIR=$(PKIX_DEPTH)/$(OBJDIR) + NO_MD_RELEASE = 1 diff --git a/security/nss/cmd/libpkix/pkix_pl/system/stress_test.c b/security/nss/cmd/libpkix/pkix_pl/system/stress_test.c index 44661dd83..bde2e4d2c 100644 --- a/security/nss/cmd/libpkix/pkix_pl/system/stress_test.c +++ b/security/nss/cmd/libpkix/pkix_pl/system/stress_test.c @@ -44,9 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; -int main(int argc, char *argv[]) { +int stress_test(int argc, char *argv[]) { PKIX_UInt32 i, k, length, hashcode; PKIX_UInt32 size = 17576; diff --git a/security/nss/cmd/libpkix/pkix_pl/system/test_bigint.c b/security/nss/cmd/libpkix/pkix_pl/system/test_bigint.c index 33aa14c1d..4bc720255 100644 --- a/security/nss/cmd/libpkix/pkix_pl/system/test_bigint.c +++ b/security/nss/cmd/libpkix/pkix_pl/system/test_bigint.c @@ -44,9 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; -void +static void createBigInt( PKIX_PL_BigInt **bigInts, char *bigIntAscii, @@ -82,7 +82,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testToString( PKIX_PL_BigInt *bigInt, char *expAscii) @@ -116,7 +116,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testCompare( PKIX_PL_BigInt *firstBigInt, PKIX_PL_BigInt *secondBigInt, @@ -133,7 +133,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testDestroy( PKIX_PL_BigInt *bigInt) { @@ -146,7 +146,7 @@ cleanup: PKIX_TEST_RETURN(); } -int main(int argc, char *argv[]) { +int test_bigint(int argc, char *argv[]) { PKIX_UInt32 size = 4, badSize = 3, i = 0; PKIX_PL_BigInt *testBigInt[4] = {NULL}; diff --git a/security/nss/cmd/libpkix/pkix_pl/system/test_bytearray.c b/security/nss/cmd/libpkix/pkix_pl/system/test_bytearray.c index 2b76f6ce0..0d2f3ed64 100644 --- a/security/nss/cmd/libpkix/pkix_pl/system/test_bytearray.c +++ b/security/nss/cmd/libpkix/pkix_pl/system/test_bytearray.c @@ -44,9 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; -void +static void createByteArray( PKIX_PL_ByteArray **byteArray, char *bytes, @@ -63,7 +63,7 @@ cleanup: } -void +static void testZeroLength(void) { PKIX_PL_ByteArray *byteArray = NULL; @@ -96,7 +96,7 @@ cleanup: } -void +static void testToString( PKIX_PL_ByteArray *byteArray, char *expAscii) @@ -130,7 +130,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testGetLength( PKIX_PL_ByteArray *byteArray, PKIX_UInt32 expLength) @@ -153,7 +153,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testGetPointer( PKIX_PL_ByteArray *byteArray, char *expBytes, @@ -192,7 +192,7 @@ cleanup: PKIX_TEST_RETURN(); } -int main(int argc, char *argv[]) { +int test_bytearray(int argc, char *argv[]) { PKIX_PL_ByteArray *testByteArray[4]; diff --git a/security/nss/cmd/libpkix/pkix_pl/system/test_hashtable.c b/security/nss/cmd/libpkix/pkix_pl/system/test_hashtable.c index b61c6dafd..8e3da6851 100644 --- a/security/nss/cmd/libpkix/pkix_pl/system/test_hashtable.c +++ b/security/nss/cmd/libpkix/pkix_pl/system/test_hashtable.c @@ -44,9 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; -void +static void createHashTables( PKIX_PL_HashTable **ht, PKIX_PL_HashTable **ht2, @@ -72,7 +72,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testAdd( PKIX_PL_HashTable *ht, PKIX_PL_HashTable *ht2, @@ -157,7 +157,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testAddFIFO( PKIX_PL_HashTable *ht, PKIX_PL_String **testString, @@ -222,7 +222,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testLookup( PKIX_PL_HashTable *ht, PKIX_PL_HashTable *ht2, @@ -345,7 +345,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testRemove( PKIX_PL_HashTable *ht, PKIX_PL_HashTable *ht2, @@ -380,7 +380,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testDestroy( PKIX_PL_HashTable *ht, PKIX_PL_HashTable *ht2, @@ -401,7 +401,7 @@ cleanup: -int main(int argc, char *argv[]) { +int test_hashtable(int argc, char *argv[]) { PKIX_PL_HashTable *ht, *ht2, *ht3, *ht4; PKIX_PL_String *testString, *testString2, *testString3; diff --git a/security/nss/cmd/libpkix/pkix_pl/system/test_mem.c b/security/nss/cmd/libpkix/pkix_pl/system/test_mem.c index 090b87085..47356b66c 100644 --- a/security/nss/cmd/libpkix/pkix_pl/system/test_mem.c +++ b/security/nss/cmd/libpkix/pkix_pl/system/test_mem.c @@ -44,8 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static void testMalloc(PKIX_UInt32 **array) { PKIX_UInt32 i, arraySize = 10; @@ -72,6 +73,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testRealloc(PKIX_UInt32 **array) { PKIX_UInt32 i, arraySize = 20; @@ -97,6 +99,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testFree(PKIX_UInt32 *array) { @@ -107,7 +110,7 @@ cleanup: PKIX_TEST_RETURN(); } -int main(int argc, char *argv[]) { +int test_mem(int argc, char *argv[]) { unsigned int *array = NULL; int arraySize = 10; diff --git a/security/nss/cmd/libpkix/pkix_pl/system/test_monitorlock.c b/security/nss/cmd/libpkix/pkix_pl/system/test_monitorlock.c index 931dd5ba2..5246ddb40 100644 --- a/security/nss/cmd/libpkix/pkix_pl/system/test_monitorlock.c +++ b/security/nss/cmd/libpkix/pkix_pl/system/test_monitorlock.c @@ -44,8 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static void createMonitorLockes( PKIX_PL_MonitorLock **monitorLock, PKIX_PL_MonitorLock **monitorLock2, @@ -66,6 +67,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testLock(PKIX_PL_MonitorLock *monitorLock) { PKIX_TEST_STD_VARS(); @@ -83,6 +85,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testDestroy( PKIX_PL_MonitorLock *monitorLock, PKIX_PL_MonitorLock *monitorLock2, @@ -98,7 +101,7 @@ cleanup: PKIX_TEST_RETURN(); } -int main(int argc, char *argv[]) { +int test_monitorlock(int argc, char *argv[]) { PKIX_PL_MonitorLock *monitorLock, *monitorLock2, *monitorLock3; PKIX_UInt32 actualMinorVersion; diff --git a/security/nss/cmd/libpkix/pkix_pl/system/test_mutex.c b/security/nss/cmd/libpkix/pkix_pl/system/test_mutex.c index 0bb27eae8..f4e450207 100644 --- a/security/nss/cmd/libpkix/pkix_pl/system/test_mutex.c +++ b/security/nss/cmd/libpkix/pkix_pl/system/test_mutex.c @@ -44,8 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static void createMutexes( PKIX_PL_Mutex **mutex, PKIX_PL_Mutex **mutex2, @@ -64,6 +65,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testLock(PKIX_PL_Mutex *mutex) { PKIX_TEST_STD_VARS(); @@ -75,6 +77,7 @@ cleanup: PKIX_TEST_RETURN(); } +static void testDestroy( PKIX_PL_Mutex *mutex, PKIX_PL_Mutex *mutex2, @@ -90,7 +93,7 @@ cleanup: PKIX_TEST_RETURN(); } -int main(int argc, char *argv[]) { +int test_mutex(int argc, char *argv[]) { PKIX_PL_Mutex *mutex, *mutex2, *mutex3; PKIX_UInt32 actualMinorVersion; diff --git a/security/nss/cmd/libpkix/pkix_pl/system/test_mutex2.c b/security/nss/cmd/libpkix/pkix_pl/system/test_mutex2.c index 70a806059..55f74e057 100644 --- a/security/nss/cmd/libpkix/pkix_pl/system/test_mutex2.c +++ b/security/nss/cmd/libpkix/pkix_pl/system/test_mutex2.c @@ -48,7 +48,7 @@ static int box1 = 0, box2 = 0, box3 = 0; static PKIX_PL_Mutex *mutex; static PRCondVar *cv; -void *plContext = NULL; +static void *plContext = NULL; static void consumer(/* ARGSUSED */ void* arg) { PRStatus status = PR_SUCCESS; @@ -108,7 +108,7 @@ static void producer(void* arg) { } } -int main(int argc, char *argv[]) { +int test_mutex2(int argc, char *argv[]) { PRThread *consThread, *prodThread, *prodThread2, *prodThread3; int x = 10, y = 20, z = 30; diff --git a/security/nss/cmd/libpkix/pkix_pl/system/test_mutex3.c b/security/nss/cmd/libpkix/pkix_pl/system/test_mutex3.c index caf78ea6d..7a45f4aa0 100644 --- a/security/nss/cmd/libpkix/pkix_pl/system/test_mutex3.c +++ b/security/nss/cmd/libpkix/pkix_pl/system/test_mutex3.c @@ -45,7 +45,7 @@ #include "testutil_nss.h" static PKIX_PL_Mutex *mutex; -void *plContext = NULL; +static void *plContext = NULL; static void t1(/* ARGSUSED */ void* arg) { PKIX_Error *errorResult; @@ -78,7 +78,7 @@ static void t2(/* ARGSUSED */ void* arg) { (void) printf("t2 exiting...\n"); } -int main(int argc, char *argv[]) { +int test_mutex3(int argc, char *argv[]) { PRThread *thread, *thread2; PKIX_UInt32 actualMinorVersion; PKIX_UInt32 j = 0; diff --git a/security/nss/cmd/libpkix/pkix_pl/system/test_object.c b/security/nss/cmd/libpkix/pkix_pl/system/test_object.c index b34376cf0..6fa9e8637 100644 --- a/security/nss/cmd/libpkix/pkix_pl/system/test_object.c +++ b/security/nss/cmd/libpkix/pkix_pl/system/test_object.c @@ -44,7 +44,7 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; static PKIX_Error * destructor( @@ -111,7 +111,7 @@ comparator( } -PKIX_Error * +static PKIX_Error * hashcodeCallback( PKIX_PL_Object *object, PKIX_UInt32 *pValue, @@ -142,7 +142,7 @@ equalsCallback( return (NULL); } -void +static void createObjects( PKIX_PL_Object **obj, PKIX_PL_Object **obj2, @@ -199,7 +199,7 @@ cleanup: } -void +static void testGetType( PKIX_PL_Object *obj, PKIX_PL_Object *obj2, @@ -230,7 +230,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testCompare( PKIX_PL_Object *obj2, PKIX_PL_Object *obj4) @@ -261,7 +261,7 @@ cleanup: } -void +static void testDestroy( PKIX_PL_Object *obj, PKIX_PL_Object *obj2, @@ -280,7 +280,7 @@ cleanup: PKIX_TEST_RETURN(); } -int main(int argc, char *argv[]) { +int test_object(int argc, char *argv[]) { PKIX_PL_Object *obj, *obj2, *obj3, *obj4; PKIX_UInt32 actualMinorVersion; diff --git a/security/nss/cmd/libpkix/pkix_pl/system/test_oid.c b/security/nss/cmd/libpkix/pkix_pl/system/test_oid.c index 248be1a3b..48f38bf67 100644 --- a/security/nss/cmd/libpkix/pkix_pl/system/test_oid.c +++ b/security/nss/cmd/libpkix/pkix_pl/system/test_oid.c @@ -44,9 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; -void +static void createOID( PKIX_PL_OID **testOID, char *oidAscii, @@ -68,7 +68,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testToString( PKIX_PL_OID *oid, char *expAscii) @@ -102,7 +102,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testCompare( PKIX_PL_OID *oid0, PKIX_PL_OID *oid1, @@ -143,7 +143,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testDestroy( PKIX_PL_OID *oid) { @@ -157,7 +157,7 @@ cleanup: } -int main(int argc, char *argv[]) { +int test_oid(int argc, char *argv[]) { PKIX_PL_OID *testOID[6] = {NULL}; PKIX_PL_OID *badTestOID = NULL; diff --git a/security/nss/cmd/libpkix/pkix_pl/system/test_rwlock.c b/security/nss/cmd/libpkix/pkix_pl/system/test_rwlock.c index 2172a79de..f8805972f 100644 --- a/security/nss/cmd/libpkix/pkix_pl/system/test_rwlock.c +++ b/security/nss/cmd/libpkix/pkix_pl/system/test_rwlock.c @@ -44,7 +44,7 @@ static PKIX_PL_RWLock *rwlock = NULL, *rwlock2 = NULL, *rwlock3 = NULL; static PRThread *thread = NULL, *thread2 = NULL, *thread3 = NULL; -void *plContext = NULL; +static void *plContext = NULL; static void reader(void) { PKIX_Error *errorResult; @@ -120,7 +120,7 @@ static void reader2(void) { -int main() { +int test_rwlock() { PKIX_PL_String* outputString = NULL; PKIX_UInt32 j = 0; PKIX_Boolean useArenas = PKIX_FALSE; diff --git a/security/nss/cmd/libpkix/pkix_pl/system/test_string.c b/security/nss/cmd/libpkix/pkix_pl/system/test_string.c index d5efcf750..a5747825e 100644 --- a/security/nss/cmd/libpkix/pkix_pl/system/test_string.c +++ b/security/nss/cmd/libpkix/pkix_pl/system/test_string.c @@ -44,9 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; -void +static void createString( PKIX_PL_String **testString, PKIX_UInt32 format, @@ -64,7 +64,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void createStringOther( PKIX_PL_String **testEscAscii, PKIX_PL_String **testUtf16, @@ -111,7 +111,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testGetEncoded( PKIX_PL_String *testEscAscii, PKIX_PL_String *testString0, @@ -188,7 +188,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testSprintf(void) { PKIX_Int32 x = 0xCAFE; @@ -245,7 +245,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testErrorHandling(void) { char *debugAsciiString = @@ -369,7 +369,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testDestroy( PKIX_PL_String *string) { @@ -383,7 +383,7 @@ cleanup: } -int main(int argc, char *argv[]) { +int test_string(int argc, char *argv[]) { PKIX_PL_String *testString[6] = {NULL}; PKIX_PL_String *testNullString = NULL; diff --git a/security/nss/cmd/libpkix/pkix_pl/system/test_string2.c b/security/nss/cmd/libpkix/pkix_pl/system/test_string2.c index 343afbe4f..2ef788c5c 100644 --- a/security/nss/cmd/libpkix/pkix_pl/system/test_string2.c +++ b/security/nss/cmd/libpkix/pkix_pl/system/test_string2.c @@ -44,9 +44,9 @@ #include "testutil.h" #include "testutil_nss.h" -void *plContext = NULL; +static void *plContext = NULL; -void +static void createString( PKIX_PL_String **vivaEspanaString, PKIX_PL_String **straussString, @@ -130,7 +130,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testGetEncoded(PKIX_PL_String *string, PKIX_UInt32 format) { void *dest = NULL; @@ -155,7 +155,7 @@ cleanup: } -void +static void testHTMLOutput( PKIX_PL_String *vivaEspanaString, PKIX_PL_String *straussString, @@ -296,7 +296,7 @@ cleanup: PKIX_TEST_RETURN(); } -void +static void testDestroy( PKIX_PL_String *string) { @@ -309,7 +309,7 @@ cleanup: PKIX_TEST_RETURN(); } -int main(int argc, char *argv[]) { +int test_string2(int argc, char *argv[]) { PKIX_PL_String *vivaEspanaString, *straussString, *testUTF16String; PKIX_PL_String *chineseString, *jeanRenoString, *gorbachevString; diff --git a/security/nss/cmd/libpkix/pkixutil/Makefile b/security/nss/cmd/libpkix/pkixutil/Makefile new file mode 100644 index 000000000..869b85713 --- /dev/null +++ b/security/nss/cmd/libpkix/pkixutil/Makefile @@ -0,0 +1,76 @@ +#! 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 $(PLAT_DEPTH)/platlibs.mk + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + +include $(PLAT_DEPTH)/platrules.mk diff --git a/security/nss/cmd/libpkix/pkixutil/manifest.mn b/security/nss/cmd/libpkix/pkixutil/manifest.mn new file mode 100644 index 000000000..00e174227 --- /dev/null +++ b/security/nss/cmd/libpkix/pkixutil/manifest.mn @@ -0,0 +1,73 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1GPL 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 +# htt/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 ***** + +PKIX_DEPTH = .. +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. + +# MODULE public and private header directories are implicitly REQUIRED. +MODULE = nss + +CSRCS = \ + pkixutil.c \ + $(NULL) + +PROGRAM = pkixutil + +TOOLS_LIB_DIR=$(PKIX_DEPTH)/$(OBJDIR) + +EXTRA_LIBS += \ + $(TOOLS_LIB_DIR)/$(LIB_PREFIX)pkixtoolperf.$(LIB_SUFFIX) \ + $(TOOLS_LIB_DIR)/$(LIB_PREFIX)pkixtoolcertsel.$(LIB_SUFFIX) \ + $(TOOLS_LIB_DIR)/$(LIB_PREFIX)pkixtoolparams.$(LIB_SUFFIX) \ + $(TOOLS_LIB_DIR)/$(LIB_PREFIX)pkixtoolmodule.$(LIB_SUFFIX) \ + $(TOOLS_LIB_DIR)/$(LIB_PREFIX)pkixtoolpki.$(LIB_SUFFIX) \ + $(TOOLS_LIB_DIR)/$(LIB_PREFIX)pkixtoolsys.$(LIB_SUFFIX) \ + $(TOOLS_LIB_DIR)/$(LIB_PREFIX)pkixtoolresults.$(LIB_SUFFIX) \ + $(TOOLS_LIB_DIR)/$(LIB_PREFIX)pkixtoolstore.$(LIB_SUFFIX) \ + $(TOOLS_LIB_DIR)/$(LIB_PREFIX)pkixtooltop.$(LIB_SUFFIX) \ + $(TOOLS_LIB_DIR)/$(LIB_PREFIX)pkixtoolutil.$(LIB_SUFFIX) \ + $(TOOLS_LIB_DIR)/$(LIB_PREFIX)pkixtoolsmplapps.$(LIB_SUFFIX) \ + $(TOOLS_LIB_DIR)/$(LIB_PREFIX)pkixtoolchecker.$(LIB_SUFFIX) \ + $(TOOLS_LIB_DIR)/$(LIB_PREFIX)pkixtoolcrlsel.$(LIB_SUFFIX) \ + $(TOOLS_LIB_DIR)/$(LIB_PREFIX)pkixtooltestutil.$(LIB_SUFFIX) \ + $(NULL) + +NO_MD_RELEASE = 1 + +USE_STATIC_LIBS = 1 + diff --git a/security/nss/cmd/libpkix/pkixutil/pkixutil.c b/security/nss/cmd/libpkix/pkixutil/pkixutil.c new file mode 100644 index 000000000..114037308 --- /dev/null +++ b/security/nss/cmd/libpkix/pkixutil/pkixutil.c @@ -0,0 +1,238 @@ +/* ***** 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): + * Sun Microsystems + * + * 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 ***** */ +/* + * testwrapper.c + * + * Wrpper programm for libpkix tests. + * + */ + +#include <stdio.h> + +#include "secport.h" + +typedef int (*mainTestFn)(int argc, char* argv[]); + +extern int libpkix_buildthreads(int argc, char *argv[]); +extern int nss_threads(int argc, char *argv[]); +extern int test_certselector(int argc, char *argv[]); +extern int test_comcertselparams(int argc, char *argv[]); +extern int test_certchainchecker(int argc, char *argv[]); +extern int test_comcrlselparams(int argc, char *argv[]); +extern int test_crlselector(int argc, char *argv[]); + +/* This test fails to build. Need to fix */ +/* extern int test_buildparams(int argc, char *argv[]); */ +extern int test_procparams(int argc, char *argv[]); +extern int test_resourcelimits(int argc, char *argv[]); +extern int test_trustanchor(int argc, char *argv[]); +extern int test_valparams(int argc, char *argv[]); +extern int test_buildresult(int argc, char *argv[]); +extern int test_policynode(int argc, char *argv[]); +extern int test_valresult(int argc, char *argv[]); +extern int test_verifynode(int argc, char *argv[]); +extern int test_store(int argc, char *argv[]); +extern int test_basicchecker(int argc, char *argv[]); +extern int test_basicconstraintschecker(int argc, char *argv[]); +extern int test_buildchain(int argc, char *argv[]); +extern int test_buildchain_partialchain(int argc, char *argv[]); +extern int test_buildchain_resourcelimits(int argc, char *argv[]); +extern int test_buildchain_uchecker(int argc, char *argv[]); +extern int test_customcrlchecker(int argc, char *argv[]); +extern int test_defaultcrlchecker2stores(int argc, char *argv[]); +extern int test_ocsp(int argc, char *argv[]); +extern int test_policychecker(int argc, char *argv[]); +extern int test_subjaltnamechecker(int argc, char *argv[]); +extern int test_validatechain(int argc, char *argv[]); +extern int test_validatechain_NB(int argc, char *argv[]); +extern int test_validatechain_bc(int argc, char *argv[]); +extern int test_error(int argc, char *argv[]); +extern int test_list(int argc, char *argv[]); +extern int test_list2(int argc, char *argv[]); +extern int test_logger(int argc, char *argv[]); +extern int test_colcertstore(int argc, char *argv[]); +extern int test_ekuchecker(int argc, char *argv[]); +extern int test_httpcertstore(int argc, char *argv[]); +extern int test_pk11certstore(int argc, char *argv[]); +extern int test_socket(int argc, char *argv[]); +extern int test_authorityinfoaccess(int argc, char *argv[]); +extern int test_cert(int argc, char *argv[]); +extern int test_crl(int argc, char *argv[]); +extern int test_crlentry(int argc, char *argv[]); +extern int test_date(int argc, char *argv[]); +extern int test_generalname(int argc, char *argv[]); +extern int test_nameconstraints(int argc, char *argv[]); +extern int test_subjectinfoaccess(int argc, char *argv[]); +extern int test_x500name(int argc, char *argv[]); +extern int stress_test(int argc, char *argv[]); +extern int test_bigint(int argc, char *argv[]); +extern int test_bytearray(int argc, char *argv[]); +extern int test_hashtable(int argc, char *argv[]); +extern int test_mem(int argc, char *argv[]); +extern int test_monitorlock(int argc, char *argv[]); +extern int test_mutex(int argc, char *argv[]); +extern int test_mutex2(int argc, char *argv[]); +extern int test_mutex3(int argc, char *argv[]); +extern int test_object(int argc, char *argv[]); +extern int test_oid(int argc, char *argv[]); + +/* Taken out. Problem with build */ +/* extern int test_rwlock(int argc, char *argv[]); */ +extern int test_string(int argc, char *argv[]); +extern int test_string2(int argc, char *argv[]); +extern int build_chain(int argc, char *argv[]); +extern int dumpcert(int argc, char *argv[]); +extern int dumpcrl(int argc, char *argv[]); +extern int validate_chain(int argc, char *argv[]); + + +typedef struct { + char *fnName; + mainTestFn fnPointer; +} testFunctionRef; + +testFunctionRef testFnRefTable[] = { + {"libpkix_buildthreads", libpkix_buildthreads}, + {"nss_threads", nss_threads}, + {"test_certselector", test_certselector}, + {"test_comcertselparams", test_comcertselparams}, + {"test_certchainchecker", test_certchainchecker}, + {"test_comcrlselparams", test_comcrlselparams}, + {"test_crlselector", test_crlselector}, +/* {"test_buildparams", test_buildparams}*/ + {"test_procparams", test_procparams}, + {"test_resourcelimits", test_resourcelimits}, + {"test_trustanchor", test_trustanchor}, + {"test_valparams", test_valparams}, + {"test_buildresult", test_buildresult}, + {"test_policynode", test_policynode}, + {"test_valresult", test_valresult}, + {"test_verifynode", test_verifynode}, + {"test_store", test_store}, + {"test_basicchecker", test_basicchecker}, + {"test_basicconstraintschecker", test_basicconstraintschecker}, + {"test_buildchain", test_buildchain}, + {"test_buildchain_partialchain", test_buildchain_partialchain}, + {"test_buildchain_resourcelimits", test_buildchain_resourcelimits}, + {"test_buildchain_uchecker", test_buildchain_uchecker}, + {"test_customcrlchecker", test_customcrlchecker}, + {"test_defaultcrlchecker2stores", test_defaultcrlchecker2stores}, + {"test_ocsp", test_ocsp}, + {"test_policychecker", test_policychecker}, + {"test_subjaltnamechecker", test_subjaltnamechecker}, + {"test_validatechain", test_validatechain}, + {"test_validatechain_NB", test_validatechain_NB}, + {"test_validatechain_bc", test_validatechain_bc}, + {"test_error", test_error}, + {"test_list", test_list}, + {"test_list2", test_list2}, + {"test_logger", test_logger}, + {"test_colcertstore", test_colcertstore}, + {"test_ekuchecker", test_ekuchecker}, + {"test_httpcertstore", test_httpcertstore}, + {"test_pk11certstore", test_pk11certstore}, + {"test_socket", test_socket}, + {"test_authorityinfoaccess", test_authorityinfoaccess}, + {"test_cert", test_cert}, + {"test_crl", test_crl}, + {"test_crlentry", test_crlentry}, + {"test_date", test_date}, + {"test_generalname", test_generalname}, + {"test_nameconstraints", test_nameconstraints}, + {"test_subjectinfoaccess", test_subjectinfoaccess}, + {"test_x500name", test_x500name}, + {"stress_test", stress_test}, + {"test_bigint", test_bigint}, + {"test_bytearray", test_bytearray}, + {"test_hashtable", test_hashtable}, + {"test_mem", test_mem}, + {"test_monitorlock", test_monitorlock}, + {"test_mutex", test_mutex}, + {"test_mutex2", test_mutex2}, + {"test_mutex3", test_mutex3}, + {"test_object", test_object}, + {"test_oid", test_oid}, +/* {"test_rwlock", test_rwlock, }*/ + {"test_string", test_string}, + {"test_string2", test_string2}, + {"build_chain", build_chain}, + {"dumpcert", dumpcert}, + {"dumpcrl", dumpcrl}, + {"validate_chain", validate_chain}, + {NULL, NULL }, +}; + +static +void printUsage(char *cmdName) { + int fnCounter = 0, totalCharLen = 0; + + fprintf(stderr, "Usage: %s [test name] [arg1]...[argN]\n\n", cmdName); + fprintf(stderr, "List of possible names for the tests:"); + while (testFnRefTable[fnCounter].fnName != NULL) { + if (fnCounter % 2 == 0) { + fprintf(stderr, "\n"); + } + fprintf(stderr, " %-35s ", testFnRefTable[fnCounter].fnName); + fnCounter += 1; + } + fprintf(stderr, "\n"); +} + + +int main(int argc, char **argv) { + char *fnName = NULL; + int fnCounter = 0; + + if (argc < 2) { + printUsage(argv[0]); + return 1; + } + + fnName = argv[1]; + while (testFnRefTable[fnCounter].fnName != NULL) { + int fnNameLen = PORT_Strlen(testFnRefTable[fnCounter].fnName); + if (!PORT_Strncmp(fnName, testFnRefTable[fnCounter].fnName, + fnNameLen)) { + return testFnRefTable[fnCounter].fnPointer(argc - 1, argv + 1); + } + fnCounter += 1; + } + printf("ERROR: unknown name of the test: %s.\n", fnName); + printUsage(argv[0]); + return -1; +} + diff --git a/security/nss/cmd/libpkix/sample_apps/Makefile b/security/nss/cmd/libpkix/sample_apps/Makefile index 15a060b07..869b85713 100755 --- a/security/nss/cmd/libpkix/sample_apps/Makefile +++ b/security/nss/cmd/libpkix/sample_apps/Makefile @@ -40,13 +40,13 @@ # (1) Include initial platform-independent assignments (MANDATORY). # ####################################################################### + include manifest.mn ####################################################################### # (2) Include "global" configuration information. (OPTIONAL) # ####################################################################### -include $(PKIX_DEPTH)/pkixrules.mk include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### @@ -58,7 +58,6 @@ include $(CORE_DEPTH)/coreconf/config.mk ####################################################################### include $(PLAT_DEPTH)/platlibs.mk -include $(PKIX_DEPTH)/pkixlibs.mk ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # @@ -70,11 +69,8 @@ include $(CORE_DEPTH)/coreconf/rules.mk # (6) Execute "component" rules. (OPTIONAL) # ####################################################################### - - ####################################################################### # (7) Execute "local" rules. (OPTIONAL). # ####################################################################### include $(PLAT_DEPTH)/platrules.mk - diff --git a/security/nss/cmd/libpkix/sample_apps/build_chain.c b/security/nss/cmd/libpkix/sample_apps/build_chain.c index 285c6e7f3..df9d21662 100644 --- a/security/nss/cmd/libpkix/sample_apps/build_chain.c +++ b/security/nss/cmd/libpkix/sample_apps/build_chain.c @@ -65,8 +65,9 @@ #include "keythi.h" #include "nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static void printUsage(void){ (void) printf("\nUSAGE:\tbuildChain " "<trustedCert> <targetCert> <certStoreDirectory>\n\n"); @@ -76,7 +77,7 @@ void printUsage(void){ "using the certs and CRLs in <certStoreDirectory>.\n"); } -PKIX_PL_Cert * +static PKIX_PL_Cert * createCert(char *inFileName) { PKIX_PL_ByteArray *byteArray = NULL; @@ -133,7 +134,7 @@ cleanup: return (cert); } -int main(int argc, char *argv[]) +int build_chain(int argc, char *argv[]) { PKIX_BuildResult *buildResult = NULL; PKIX_ComCertSelParams *certSelParams = NULL; diff --git a/security/nss/cmd/libpkix/sample_apps/dumpcert.c b/security/nss/cmd/libpkix/sample_apps/dumpcert.c index 5338c5193..ead2e9317 100644 --- a/security/nss/cmd/libpkix/sample_apps/dumpcert.c +++ b/security/nss/cmd/libpkix/sample_apps/dumpcert.c @@ -54,19 +54,21 @@ #include "secasn1t.h" #include "certt.h" -void *plContext = NULL; +static void *plContext = NULL; +static void printUsage(void){ (void) printf("\nUSAGE:\tdumpcert <certFile>\n"); (void) printf("\tParses a certificate located at <certFile> " "and displays it.\n"); } +static void printFailure(char *msg){ (void) printf("FAILURE: %s\n", msg); } -PKIX_PL_Cert * +static PKIX_PL_Cert * createCert(char *inFileName) { PKIX_PL_ByteArray *byteArray = NULL; @@ -129,7 +131,7 @@ cleanup: return (cert); } -int main(int argc, char *argv[]) +int dumpcert(int argc, char *argv[]) { PKIX_PL_String *string = NULL; diff --git a/security/nss/cmd/libpkix/sample_apps/dumpcrl.c b/security/nss/cmd/libpkix/sample_apps/dumpcrl.c index bde913f66..ccb60cddd 100644 --- a/security/nss/cmd/libpkix/sample_apps/dumpcrl.c +++ b/security/nss/cmd/libpkix/sample_apps/dumpcrl.c @@ -54,19 +54,21 @@ #include "secasn1t.h" #include "certt.h" -void *plContext = NULL; +static void *plContext = NULL; +static void printUsage(void){ (void) printf("\nUSAGE:\tdumpcrl <crlFile>\n"); (void) printf("\tParses a CRL located at <crlFile> " "and displays it.\n"); } +static void printFailure(char *msg){ (void) printf("FAILURE: %s\n", msg); } -PKIX_PL_CRL * +static PKIX_PL_CRL * createCRL(char *inFileName) { PKIX_PL_ByteArray *byteArray = NULL; @@ -133,7 +135,7 @@ cleanup: return (crl); } -int main(int argc, char *argv[]) +int dumpcrl(int argc, char *argv[]) { PKIX_PL_String *string = NULL; diff --git a/security/nss/cmd/libpkix/sample_apps/manifest.mn b/security/nss/cmd/libpkix/sample_apps/manifest.mn index 95af7f986..7d3544ae8 100755 --- a/security/nss/cmd/libpkix/sample_apps/manifest.mn +++ b/security/nss/cmd/libpkix/sample_apps/manifest.mn @@ -36,6 +36,8 @@ # ***** END LICENSE BLOCK ***** PKIX_DEPTH = .. +PLAT_DEPTH = $(PKIX_DEPTH)/.. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. # MODULE public and private header directories are implicitly REQUIRED. MODULE = nss @@ -46,8 +48,10 @@ CSRCS = dumpcert.c \ build_chain.c \ $(NULL) -PROGRAMS = $(CSRCS:.c=) +LIBRARY_NAME=pkixtoolsmplapps -TARGETS = $(PROGRAMS) +TARGETS = $(LIBRARY) + +SOURCE_LIB_DIR=$(PKIX_DEPTH)/$(OBJDIR) NO_MD_RELEASE = 1 diff --git a/security/nss/cmd/libpkix/sample_apps/validate_chain.c b/security/nss/cmd/libpkix/sample_apps/validate_chain.c index 259c850e7..f50a4f429 100644 --- a/security/nss/cmd/libpkix/sample_apps/validate_chain.c +++ b/security/nss/cmd/libpkix/sample_apps/validate_chain.c @@ -65,8 +65,9 @@ #include "keythi.h" #include "nss.h" -void *plContext = NULL; +static void *plContext = NULL; +static void printUsage(void){ (void) printf("\nUSAGE:\tvalidateChain <trustedCert> " "<cert_1> <cert_2> ... <cert_n>\n"); @@ -75,7 +76,7 @@ void printUsage(void){ } -PKIX_PL_Cert * +static PKIX_PL_Cert * createCert(char *inFileName) { PKIX_PL_ByteArray *byteArray = NULL; @@ -133,7 +134,7 @@ cleanup: return (cert); } -int main(int argc, char *argv[]) +int validate_chain(int argc, char *argv[]) { PKIX_TrustAnchor *anchor = NULL; PKIX_List *anchors = NULL; diff --git a/security/nss/cmd/libpkix/testutil/Makefile b/security/nss/cmd/libpkix/testutil/Makefile index b79994fbe..8ecb61bed 100755 --- a/security/nss/cmd/libpkix/testutil/Makefile +++ b/security/nss/cmd/libpkix/testutil/Makefile @@ -47,9 +47,6 @@ include manifest.mn ####################################################################### include $(CORE_DEPTH)/coreconf/config.mk -include config.mk -EXTRA_LIBS = \ - $(NULL) ####################################################################### # (3) Include "component" configuration information. (OPTIONAL) # @@ -77,6 +74,8 @@ include $(CORE_DEPTH)/coreconf/rules.mk # (7) Execute "local" rules. (OPTIONAL). # ####################################################################### + include $(PLAT_DEPTH)/platrules.mk export:: private_export + diff --git a/security/nss/cmd/libpkix/testutil/manifest.mn b/security/nss/cmd/libpkix/testutil/manifest.mn index 742a588a3..66b6f27d5 100755 --- a/security/nss/cmd/libpkix/testutil/manifest.mn +++ b/security/nss/cmd/libpkix/testutil/manifest.mn @@ -35,22 +35,26 @@ # # ***** END LICENSE BLOCK ***** -CORE_DEPTH = ../../../.. -PLAT_DEPTH = ../.. +PKIX_DEPTH = .. +CORE_DEPTH = $(PKIX_DEPTH)/../../.. +PLAT_DEPTH = $(PKIX_DEPTH)/.. - -LIBRARY_NAME = pkixutil +MODULE = nss PRIVATE_EXPORTS = \ testutil_nss.h \ testutil.h \ $(NULL) -MODULE = nss -MAPFILE = $(OBJDIR)/pkixutil.def - CSRCS = \ testutil_nss.c \ testutil.c \ $(NULL) +LIBRARY_NAME = pkixtooltestutil + +TARGETS = $(LIBRARY) + +SOURCE_LIB_DIR = $(PKIX_DEPTH)/$(OBJDIR) + +NO_MD_RELEASE = 1 |