|
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/. */ |
|
4 |
|
5 #include <stdio.h> |
|
6 #include <stdlib.h> |
|
7 |
|
8 #include "blapi.h" |
|
9 #include "secutil.h" |
|
10 |
|
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 } |
|
18 |
|
19 int main(int argc, char **argv) |
|
20 { |
|
21 SECStatus rv = SECFailure; |
|
22 PRBool good_result = PR_FALSE; |
|
23 |
|
24 if (argc != 2) |
|
25 return Usage(); |
|
26 |
|
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(); |
|
38 |
|
39 good_result = BLAPI_SHVerifyFile(argv[1]); |
|
40 printf("%s\n", |
|
41 (good_result ? "SUCCESS" : "FAILURE")); |
|
42 return (good_result) ? SECSuccess : SECFailure; |
|
43 } |