* Currently we verify manifest using sha256. * In future another env with hash type could be introduced. */
| 221 | * In future another env with hash type could be introduced. |
| 222 | */ |
| 223 | static int |
| 224 | verify_digest(const char *data, size_t len, const unsigned char *expected_hash) |
| 225 | { |
| 226 | SHA256_CTX ctx; |
| 227 | unsigned char hash[SHA256_DIGEST_LENGTH]; |
| 228 | |
| 229 | SHA256_Init(&ctx); |
| 230 | SHA256_Update(&ctx, data, len); |
| 231 | SHA256_Final(hash, &ctx); |
| 232 | |
| 233 | return (memcmp(expected_hash, hash, SHA256_DIGEST_LENGTH)); |
| 234 | } |
| 235 | |
| 236 | static int |
| 237 | open_file(const char *path, struct nameidata *nid) |
no test coverage detected