Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: chrome/utility/safe_browsing/mac/udif.h

Issue 2934373002: Record Code Signature of Downloaded DMG files (Closed)
Patch Set: adjusted test file path names Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_ 5 #ifndef CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_
6 #define CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_ 6 #define CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_
7 7
8 #include <CoreFoundation/CoreFoundation.h> 8 #include <CoreFoundation/CoreFoundation.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 class UDIFParser { 44 class UDIFParser {
45 public: 45 public:
46 // Constructs an instance from a stream. 46 // Constructs an instance from a stream.
47 explicit UDIFParser(ReadStream* stream); 47 explicit UDIFParser(ReadStream* stream);
48 ~UDIFParser(); 48 ~UDIFParser();
49 49
50 // Parses the UDIF file. This method must be called before any other method. 50 // Parses the UDIF file. This method must be called before any other method.
51 // If this returns false, it is not legal to call any other methods. 51 // If this returns false, it is not legal to call any other methods.
52 bool Parse(); 52 bool Parse();
53 53
54 uint64_t GetDmgSignatureLength();
55
56 // Returns a pointer to the buffer storing the blob of DMG signature data.
57 uint8_t* GetDmgSignatureData();
Robert Sesek 2017/06/26 18:56:33 This should return |const std::vector<uint8_t>&|.
mortonm 2017/06/27 16:36:23 Done.
58
54 // Returns the number of partitions in this UDIF image. 59 // Returns the number of partitions in this UDIF image.
55 size_t GetNumberOfPartitions(); 60 size_t GetNumberOfPartitions();
56 61
57 // Returns the partition name for a given partition number, in the range of 62 // Returns the partition name for a given partition number, in the range of
58 // [0,GetNumberOfPartitions()). This will include the number, name, and type 63 // [0,GetNumberOfPartitions()). This will include the number, name, and type
59 // of partition. E.g., "disk image (Apple_HFS : 2)". 64 // of partition. E.g., "disk image (Apple_HFS : 2)".
60 std::string GetPartitionName(size_t part_number); 65 std::string GetPartitionName(size_t part_number);
61 66
62 // Returns the partition type as a string for the given partition number. 67 // Returns the partition type as a string for the given partition number.
63 // E.g., "Apple_HFS" and "Apple_Free". 68 // E.g., "Apple_HFS" and "Apple_Free".
64 std::string GetPartitionType(size_t part_number); 69 std::string GetPartitionType(size_t part_number);
65 70
66 // Returns the size of the partition in bytes. 71 // Returns the size of the partition in bytes.
67 size_t GetPartitionSize(size_t part_number); 72 size_t GetPartitionSize(size_t part_number);
68 73
69 // Returns a stream of the raw partition data for the given partition 74 // Returns a stream of the raw partition data for the given partition
70 // number. 75 // number.
71 std::unique_ptr<ReadStream> GetPartitionReadStream(size_t part_number); 76 std::unique_ptr<ReadStream> GetPartitionReadStream(size_t part_number);
72 77
73 private: 78 private:
74 // Parses the blkx plist trailer structure. 79 // Parses the blkx plist trailer structure.
75 bool ParseBlkx(); 80 bool ParseBlkx();
76 81
77 ReadStream* const stream_; // The stream backing the UDIF image. Weak. 82 ReadStream* const stream_; // The stream backing the UDIF image. Weak.
78 std::vector<std::string> partition_names_; // The names of all partitions. 83 std::vector<std::string> partition_names_; // The names of all partitions.
79 // All blocks in the UDIF image. 84 // All blocks in the UDIF image.
80 std::vector<std::unique_ptr<const UDIFBlock>> blocks_; 85 std::vector<std::unique_ptr<const UDIFBlock>> blocks_;
81 uint16_t block_size_; // The image's block size, in bytes. 86 uint16_t block_size_; // The image's block size, in bytes.
87 uint8_t* signature_blob_data_; // Data that comprises the DMG signature
88 uint64_t signature_blob_length_; // Length of the signature in bytes
82 89
83 DISALLOW_COPY_AND_ASSIGN(UDIFParser); 90 DISALLOW_COPY_AND_ASSIGN(UDIFParser);
84 }; 91 };
85 92
86 } // namespace dmg 93 } // namespace dmg
87 } // namespace safe_browsing 94 } // namespace safe_browsing
88 95
89 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_ 96 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698