security/nss/cmd/chktest/chktest.c

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial