| 116 | } |
| 117 | |
| 118 | Result MemCompare(const uint8_t* digest, uint32_t len, const uint8_t* expected_digest, uint32_t expected_len) |
| 119 | { |
| 120 | if (expected_len != len) |
| 121 | { |
| 122 | dmLogError("Length mismatch in hash comparison. Expected %u, got %u", expected_len, len); |
| 123 | return RESULT_FORMAT_ERROR; |
| 124 | } |
| 125 | if (memcmp(digest, expected_digest, len) != 0) |
| 126 | { |
| 127 | return RESULT_SIGNATURE_MISMATCH;; |
| 128 | } |
| 129 | return RESULT_OK; |
| 130 | } |
| 131 | |
| 132 | // TODO: Test this... |
| 133 | uint32_t GetCanonicalPathFromBase(const char* base_dir, const char* relative_dir, char* buf, uint32_t buf_len) |