| 94 | } |
| 95 | |
| 96 | Result CreateManifestHash(dmLiveUpdateDDF::HashAlgorithm algorithm, const uint8_t* buf, size_t buflen, uint8_t* digest) |
| 97 | { |
| 98 | if (algorithm == dmLiveUpdateDDF::HASH_SHA1) |
| 99 | { |
| 100 | dmCrypt::HashSha1(buf, buflen, digest); |
| 101 | } |
| 102 | else if (algorithm == dmLiveUpdateDDF::HASH_SHA256) |
| 103 | { |
| 104 | dmCrypt::HashSha256(buf, buflen, digest); |
| 105 | } |
| 106 | else if (algorithm == dmLiveUpdateDDF::HASH_SHA512) |
| 107 | { |
| 108 | dmCrypt::HashSha512(buf, buflen, digest); |
| 109 | } |
| 110 | else |
| 111 | { |
| 112 | dmLogError("The algorithm specified for manifest verification hashing is not supported (%i)", algorithm); |
| 113 | return RESULT_INVALID_DATA; |
| 114 | } |
| 115 | return RESULT_OK; |
| 116 | } |
| 117 | |
| 118 | Result MemCompare(const uint8_t* digest, uint32_t len, const uint8_t* expected_digest, uint32_t expected_len) |
| 119 | { |
nothing calls this directly
no test coverage detected