1 /* 2 * Copyright 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include "avb_manager.h" 18 #include "secure_storage_interface.h" 19 20 namespace avb { 21 22 // Fake implementation of SecureStorageInterface 23 class SecureStorageFake : public SecureStorageInterface { 24 public: open(const char * name)25 int open(const char* name) override { return 0; } delete_file(const char * name)26 int delete_file(const char* name) override { return 0; } read(uint64_t off,void * buf,size_t size)27 int read(uint64_t off, void* buf, size_t size) const override { 28 *(uint64_t*)buf = 1; 29 return size; 30 } get_file_size(uint64_t * size)31 int get_file_size(uint64_t* size) const override { 32 *size = sizeof(uint64_t) * kRollbackSlotMax; 33 return 0; 34 } write(uint64_t off,const void * buf,size_t size)35 int write(uint64_t off, const void* buf, size_t size) const override { 36 return size; 37 } 38 }; 39 40 } // namespace avb 41