MCPcopy Create free account
hub / github.com/F-Stack/f-stack / verify_digest

Function verify_digest

freebsd/security/mac_veriexec_parser/mac_veriexec_parser.c:223–234  ·  view source on GitHub ↗

* Currently we verify manifest using sha256. * In future another env with hash type could be introduced. */

Source from the content-addressed store, hash-verified

221 * In future another env with hash type could be introduced.
222 */
223static int
224verify_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
236static int
237open_file(const char *path, struct nameidata *nid)

Callers 1

read_manifestFunction · 0.70

Calls 3

SHA256_InitFunction · 0.50
SHA256_UpdateFunction · 0.50
SHA256_FinalFunction · 0.50

Tested by

no test coverage detected