security/nss/cmd/chktest/chktest.c

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #include <stdio.h>
michael@0 6 #include <stdlib.h>
michael@0 7
michael@0 8 #include "blapi.h"
michael@0 9 #include "secutil.h"
michael@0 10
michael@0 11 static int Usage()
michael@0 12 {
michael@0 13 fprintf(stderr, "Usage: chktest <full-path-to-shared-library>\n");
michael@0 14 fprintf(stderr, " Will test for valid chk file.\n");
michael@0 15 fprintf(stderr, " Will print SUCCESS or FAILURE.\n");
michael@0 16 exit(1);
michael@0 17 }
michael@0 18
michael@0 19 int main(int argc, char **argv)
michael@0 20 {
michael@0 21 SECStatus rv = SECFailure;
michael@0 22 PRBool good_result = PR_FALSE;
michael@0 23
michael@0 24 if (argc != 2)
michael@0 25 return Usage();
michael@0 26
michael@0 27 rv = RNG_RNGInit();
michael@0 28 if (rv != SECSuccess) {
michael@0 29 SECU_PrintPRandOSError("");
michael@0 30 return -1;
michael@0 31 }
michael@0 32 rv = BL_Init();
michael@0 33 if (rv != SECSuccess) {
michael@0 34 SECU_PrintPRandOSError("");
michael@0 35 return -1;
michael@0 36 }
michael@0 37 RNG_SystemInfoForRNG();
michael@0 38
michael@0 39 good_result = BLAPI_SHVerifyFile(argv[1]);
michael@0 40 printf("%s\n",
michael@0 41 (good_result ? "SUCCESS" : "FAILURE"));
michael@0 42 return (good_result) ? SECSuccess : SECFailure;
michael@0 43 }

mercurial