Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d309caa authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "[adb] Add a version field to v4 signature format" am: aab85d3b am: 7521152c

Change-Id: I370ccb892a3df564e6067007eae59eb789e21608
parents 290bb336 7521152c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -54,6 +54,13 @@ static inline int32_t read_be_int32(borrowed_fd fd) {
    return int32_t(be32toh(read_int32(fd)));
}

static inline void append_int(borrowed_fd fd, std::vector<char>* bytes) {
    int32_t be_val = read_int32(fd);
    auto old_size = bytes->size();
    bytes->resize(old_size + sizeof(be_val));
    memcpy(bytes->data() + old_size, &be_val, sizeof(be_val));
}

static inline void append_bytes_with_size(borrowed_fd fd, std::vector<char>* bytes) {
    int32_t be_size = read_int32(fd);
    int32_t size = int32_t(be32toh(be_size));
@@ -65,6 +72,7 @@ static inline void append_bytes_with_size(borrowed_fd fd, std::vector<char>* byt

static inline std::pair<std::vector<char>, int32_t> read_id_sig_headers(borrowed_fd fd) {
    std::vector<char> result;
    append_int(fd, &result);              // version
    append_bytes_with_size(fd, &result);  // verityRootHash
    append_bytes_with_size(fd, &result);  // v3Digest
    append_bytes_with_size(fd, &result);  // pkcs7SignatureBlock