| 104 | } |
| 105 | |
| 106 | static int |
| 107 | fips_test_parse_header(void) |
| 108 | { |
| 109 | uint32_t i; |
| 110 | char *tmp; |
| 111 | int ret; |
| 112 | int algo_parsed = 0; |
| 113 | time_t t = time(NULL); |
| 114 | struct tm *tm_now = localtime(&t); |
| 115 | |
| 116 | ret = fips_test_fetch_one_block(); |
| 117 | if (ret < 0) |
| 118 | return ret; |
| 119 | |
| 120 | if (info.nb_vec_lines) |
| 121 | fips_test_parse_version(); |
| 122 | |
| 123 | for (i = 0; i < info.nb_vec_lines; i++) { |
| 124 | if (!algo_parsed) { |
| 125 | if (strstr(info.vec[i], "AES")) { |
| 126 | algo_parsed = 1; |
| 127 | info.algo = FIPS_TEST_ALGO_AES; |
| 128 | ret = parse_test_aes_init(); |
| 129 | if (ret < 0) |
| 130 | return ret; |
| 131 | } else if (strstr(info.vec[i], "GCM")) { |
| 132 | algo_parsed = 1; |
| 133 | info.algo = FIPS_TEST_ALGO_AES_GCM; |
| 134 | ret = parse_test_gcm_init(); |
| 135 | if (ret < 0) |
| 136 | return ret; |
| 137 | } else if (strstr(info.vec[i], "CMAC")) { |
| 138 | algo_parsed = 1; |
| 139 | info.algo = FIPS_TEST_ALGO_AES_CMAC; |
| 140 | ret = parse_test_cmac_init(); |
| 141 | if (ret < 0) |
| 142 | return 0; |
| 143 | } else if (strstr(info.vec[i], "CCM")) { |
| 144 | algo_parsed = 1; |
| 145 | info.algo = FIPS_TEST_ALGO_AES_CCM; |
| 146 | ret = parse_test_ccm_init(); |
| 147 | if (ret < 0) |
| 148 | return 0; |
| 149 | } else if (strstr(info.vec[i], "HMAC")) { |
| 150 | algo_parsed = 1; |
| 151 | info.algo = FIPS_TEST_ALGO_HMAC; |
| 152 | ret = parse_test_hmac_init(); |
| 153 | if (ret < 0) |
| 154 | return ret; |
| 155 | } else if (strstr(info.vec[i], "TDES")) { |
| 156 | algo_parsed = 1; |
| 157 | info.algo = FIPS_TEST_ALGO_TDES; |
| 158 | ret = parse_test_tdes_init(); |
| 159 | if (ret < 0) |
| 160 | return 0; |
| 161 | } else if (strstr(info.vec[i], "PERMUTATION")) { |
| 162 | algo_parsed = 1; |
| 163 | info.algo = FIPS_TEST_ALGO_TDES; |
no test coverage detected