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

Side by Side Diff: file_hasher.cc

Issue 6810004: verity: don't error on depth=0 (Closed) Base URL: http://git.chromium.org/git/dm-verity.git@master
Patch Set: Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by the GPL v2 license that can 2 // Use of this source code is governed by the GPL v2 license that can
3 // be found in the LICENSE file. 3 // be found in the LICENSE file.
4 // 4 //
5 // Implementation of FileHasher 5 // Implementation of FileHasher
6 6
7 #define __STDC_LIMIT_MACROS 1 7 #define __STDC_LIMIT_MACROS 1
8 #define __STDC_FORMAT_MACROS 1 8 #define __STDC_FORMAT_MACROS 1
9 #include <errno.h> 9 #include <errno.h>
10 #include <inttypes.h> 10 #include <inttypes.h>
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 dm_bht_write_completed(entry, 0); 42 dm_bht_write_completed(entry, 0);
43 return 0; 43 return 0;
44 } 44 }
45 45
46 bool FileHasher::Initialize(simple_file::File *source, 46 bool FileHasher::Initialize(simple_file::File *source,
47 simple_file::File *destination, 47 simple_file::File *destination,
48 unsigned int depth, 48 unsigned int depth,
49 unsigned int blocks, 49 unsigned int blocks,
50 const char *alg) { 50 const char *alg) {
51 if (depth == 0 || !alg || !source || !destination) { 51 if (!alg || !source || !destination) {
52 LOG(ERROR) << "Invalid arguments supplied to Initialize"; 52 LOG(ERROR) << "Invalid arguments supplied to Initialize";
53 LOG(INFO) << "depth: " << depth; 53 LOG(INFO) << "depth: " << depth;
54 LOG(INFO) << "s: " << source << " d: " << destination; 54 LOG(INFO) << "s: " << source << " d: " << destination;
55 return false; 55 return false;
56 } 56 }
57 if (source_ || destination_) { 57 if (source_ || destination_) {
58 LOG(ERROR) << "Initialize called more than once"; 58 LOG(ERROR) << "Initialize called more than once";
59 return false; 59 return false;
60 } 60 }
61 if (blocks > source->Size() / PAGE_SIZE) { 61 if (blocks > source->Size() / PAGE_SIZE) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 unsigned int hash_start = 0; 120 unsigned int hash_start = 0;
121 unsigned int root_end = to_sector(block_limit_ << PAGE_SHIFT); 121 unsigned int root_end = to_sector(block_limit_ << PAGE_SHIFT);
122 if (colocated) hash_start = root_end; 122 if (colocated) hash_start = root_end;
123 printf("0 %u verity ROOT_DEV HASH_DEV %u %u %s %s\n", 123 printf("0 %u verity ROOT_DEV HASH_DEV %u %u %s %s\n",
124 root_end, hash_start, depth_, alg_, digest); 124 root_end, hash_start, depth_, alg_, digest);
125 } 125 }
126 126
127 } // namespace verity 127 } // namespace verity
128 128
129 129
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698