chktest.c (1092B)
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 12 Usage() 13 { 14 fprintf(stderr, "Usage: chktest <full-path-to-shared-library>\n"); 15 fprintf(stderr, " Will test for valid chk file.\n"); 16 fprintf(stderr, " Will print SUCCESS or FAILURE.\n"); 17 exit(1); 18 } 19 20 int 21 main(int argc, char **argv) 22 { 23 SECStatus rv = SECFailure; 24 PRBool good_result = PR_FALSE; 25 26 if (argc != 2) 27 return Usage(); 28 29 rv = RNG_RNGInit(); 30 if (rv != SECSuccess) { 31 SECU_PrintPRandOSError(""); 32 return -1; 33 } 34 rv = BL_Init(); 35 if (rv != SECSuccess) { 36 SECU_PrintPRandOSError(""); 37 return -1; 38 } 39 RNG_SystemInfoForRNG(); 40 41 good_result = BLAPI_SHVerifyFile(argv[1]); 42 printf("%s\n", 43 (good_result ? "SUCCESS" : "FAILURE")); 44 return (good_result) ? SECSuccess : SECFailure; 45 }