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

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

Issue 2934373002: Record Code Signature of Downloaded DMG files (Closed)
Patch Set: correcting rebase mixup 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 // Returns the blob of DMG signature data.
55 const std::vector<uint8_t>& GetCodeSignature();
56
54 // Returns the number of partitions in this UDIF image. 57 // Returns the number of partitions in this UDIF image.
55 size_t GetNumberOfPartitions(); 58 size_t GetNumberOfPartitions();
56 59
57 // Returns the partition name for a given partition number, in the range of 60 // Returns the partition name for a given partition number, in the range of
58 // [0,GetNumberOfPartitions()). This will include the number, name, and type 61 // [0,GetNumberOfPartitions()). This will include the number, name, and type
59 // of partition. E.g., "disk image (Apple_HFS : 2)". 62 // of partition. E.g., "disk image (Apple_HFS : 2)".
60 std::string GetPartitionName(size_t part_number); 63 std::string GetPartitionName(size_t part_number);
61 64
62 // Returns the partition type as a string for the given partition number. 65 // Returns the partition type as a string for the given partition number.
63 // E.g., "Apple_HFS" and "Apple_Free". 66 // E.g., "Apple_HFS" and "Apple_Free".
64 std::string GetPartitionType(size_t part_number); 67 std::string GetPartitionType(size_t part_number);
65 68
66 // Returns the size of the partition in bytes. 69 // Returns the size of the partition in bytes.
67 size_t GetPartitionSize(size_t part_number); 70 size_t GetPartitionSize(size_t part_number);
68 71
69 // Returns a stream of the raw partition data for the given partition 72 // Returns a stream of the raw partition data for the given partition
70 // number. 73 // number.
71 std::unique_ptr<ReadStream> GetPartitionReadStream(size_t part_number); 74 std::unique_ptr<ReadStream> GetPartitionReadStream(size_t part_number);
72 75
73 private: 76 private:
74 // Parses the blkx plist trailer structure. 77 // Parses the blkx plist trailer structure.
75 bool ParseBlkx(); 78 bool ParseBlkx();
76 79
77 ReadStream* const stream_; // The stream backing the UDIF image. Weak. 80 ReadStream* const stream_; // The stream backing the UDIF image. Weak.
78 std::vector<std::string> partition_names_; // The names of all partitions. 81 std::vector<std::string> partition_names_; // The names of all partitions.
79 // All blocks in the UDIF image. 82 // All blocks in the UDIF image.
80 std::vector<std::unique_ptr<const UDIFBlock>> blocks_; 83 std::vector<std::unique_ptr<const UDIFBlock>> blocks_;
81 uint16_t block_size_; // The image's block size, in bytes. 84 uint16_t block_size_; // The image's block size, in bytes.
85 std::vector<uint8_t> signature_blob_; // DMG signature.
82 86
83 DISALLOW_COPY_AND_ASSIGN(UDIFParser); 87 DISALLOW_COPY_AND_ASSIGN(UDIFParser);
84 }; 88 };
85 89
86 } // namespace dmg 90 } // namespace dmg
87 } // namespace safe_browsing 91 } // namespace safe_browsing
88 92
89 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_ 93 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_
OLDNEW
« no previous file with comments | « chrome/utility/safe_browsing/mac/dmg_iterator.cc ('k') | chrome/utility/safe_browsing/mac/udif.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698