| /developtools/hapsigner/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/zip/ |
| H A D | RandomAccessFileZipDataInput.java | 56 * @param offset offset 59 public RandomAccessFileZipDataInput(RandomAccessFile file, long offset, long size) { in RandomAccessFileZipDataInput() argument 60 if (offset < 0) { in RandomAccessFileZipDataInput() 61 throw new IndexOutOfBoundsException("offset: " + offset); in RandomAccessFileZipDataInput() 68 this.startIndex = offset; in RandomAccessFileZipDataInput() 85 public void copyTo(long offset, long size, ZipDataOutput output) throws IOException { in copyTo() argument 87 checkBoundValid(offset, size, srcSize); in copyTo() 91 long offsetInFile = startIndex + offset; in copyTo() 108 copyTo(long offset, int size, ByteBuffer buffer) copyTo() argument 137 createByteBuffer(long offset, int size) createByteBuffer() argument 148 slice(long offset, long size) slice() argument 157 checkBoundValid(long offset, long size, long sourceSize) checkBoundValid() argument [all...] |
| H A D | ByteBufferZipDataInput.java | 45 public void copyTo(long offset, long size, ZipDataOutput output) throws IOException { in copyTo() argument 49 output.write(createByteBuffer(offset, (int) size)); in copyTo() 53 public void copyTo(long offset, int size, ByteBuffer buffer) throws IOException { in copyTo() argument 54 buffer.put(createByteBuffer(offset, size)); in copyTo() 58 public ByteBuffer createByteBuffer(long offset, int size) { in createByteBuffer() argument 59 checkChunkValid(offset, size); in createByteBuffer() 60 int position = (int) offset; in createByteBuffer() 71 public ZipDataInput slice(long offset, long size) { in slice() argument 72 if (offset == 0 && size == sourceSize) { in slice() 78 ByteBuffer byteBuffer = createByteBuffer(offset, (in in slice() 82 checkChunkValid(long offset, long size) checkChunkValid() argument [all...] |
| H A D | RandomAccessFileZipDataOutput.java | 46 * @param startPosition start position offset 61 public void write(byte[] buffer, int offset, int length) throws IOException { in write() argument 62 if (offset < 0) { in write() 63 throw new IndexOutOfBoundsException("offset: " + offset); in write() 65 if (offset > buffer.length) { in write() 66 throw new IndexOutOfBoundsException("offset (" + offset + ") > buffer length(" + buffer.length + ")"); in write() 73 file.write(buffer, offset, length); in write()
|
| H A D | EndOfCentralDirectory.java | 34 * offset of start of central 81 private long offset; field in EndOfCentralDirectory 96 * init End Of Central Directory, default offset is 0 109 * @param offset offset 112 public static Optional<EndOfCentralDirectory> getEOCDByBytes(byte[] bytes, int offset) { in getEOCDByBytes() argument 114 int remainingDataLen = bytes.length - offset; in getEOCDByBytes() 118 ByteBuffer bf = ByteBuffer.wrap(bytes, offset, remainingDataLen); in getEOCDByBytes() 158 UnsignedDecimalUtil.setUnsignedInt(bf, offset); in toBytes() 215 return offset; in getOffset() 218 setOffset(long offset) setOffset() argument [all...] |
| H A D | ZipDataInput.java | 37 * @param offset offset index at the ZipDataInput 42 void copyTo(long offset, long size, ZipDataOutput output) throws IOException; in copyTo() argument 47 * @param offset offset index at the ZipDataInput 52 void copyTo(long offset, int size, ByteBuffer buffer) throws IOException; in copyTo() argument 57 * @param offset offset index at the ZipDataInput 62 ByteBuffer createByteBuffer(long offset, int size) throws IOException; in createByteBuffer() argument 67 * @param offset offse 71 slice(long offset, long size) slice() argument [all...] |
| H A D | ZipUtils.java | 64 * @return offset from buffer start point. 76 * 4-bytes: offset of central directory in zip file in findEocdInSearchBuffer() 104 * @param zipEocdOffset offset of the ZIP EOCD in the file. 119 * Get offset value of Central Directory from End of Central Directory Record. 122 * @return offset value of Central Directory. 130 * set offset value of Central Directory to End of Central Directory Record. 133 * @param offset offset value of Central Directory. 135 public static void setCentralDirectoryOffset(ByteBuffer eocd, long offset) { in setCentralDirectoryOffset() argument 137 setUInt32ToBuffer(eocd, eocd.position() + ZIP_CENTRAL_DIR_OFFSET_IN_EOCD, offset); in setCentralDirectoryOffset() 169 getUInt16FromBuffer(ByteBuffer buffer, int offset) getUInt16FromBuffer() argument 173 getUInt32FromBuffer(ByteBuffer buffer, int offset) getUInt32FromBuffer() argument 177 setUInt32ToBuffer(ByteBuffer buffer, int offset, long value) setUInt32ToBuffer() argument [all...] |
| /developtools/hapsigner/hapsigntool_cpp/zip/src/ |
| H A D | random_access_file_input.cpp | 31 RandomAccessFileInput::RandomAccessFileInput(RandomAccessFile& file, int64_t offset, int64_t size) in RandomAccessFileInput() argument 32 : file(file), startIndex(offset), size(size) in RandomAccessFileInput() 34 if (offset < 0) { in RandomAccessFileInput() 35 SIGNATURE_TOOLS_LOGE("out of range: offset %" PRId64, offset); in RandomAccessFileInput() 52 bool RandomAccessFileInput::CopyTo(int64_t offset, int size, ByteBuffer& buffer) in CopyTo() argument 55 if (!CheckBoundValid(offset, size, srcSize)) { in CopyTo() 66 int64_t offsetInFile = startIndex + offset; in CopyTo() 87 ByteBuffer RandomAccessFileInput::CreateByteBuffer(int64_t offset, int size) in CreateByteBuffer() argument 96 if (!CopyTo(offset, siz in CreateByteBuffer() 104 Slice(int64_t offset, int64_t size) Slice() argument 117 CheckBoundValid(int64_t offset, int64_t size, int64_t sourceSize) CheckBoundValid() argument [all...] |
| H A D | zip_utils.cpp | 25 bool ZipUtils::SetCentralDirectoryOffset(ByteBuffer& eocd, int64_t offset) in SetCentralDirectoryOffset() argument 27 if (!SetUInt32ToBuffer(eocd, eocd.GetPosition() + ZIP_CENTRAL_DIR_OFFSET_IN_EOCD, offset)) { in SetCentralDirectoryOffset() 34 bool ZipUtils::SetUInt32ToBuffer(ByteBuffer& buffer, int offset, int64_t value) in SetUInt32ToBuffer() argument 36 SIGNATURE_TOOLS_LOGI("offset: %d, value: %" PRId64 ", UINT32_MAX_VALUE: %" PRId64, in SetUInt32ToBuffer() 37 offset, value, UINT32_MAX_VALUE); in SetUInt32ToBuffer() 42 buffer.PutInt32(offset, static_cast<int>(value)); in SetUInt32ToBuffer()
|
| H A D | zip_signer.cpp | 40 /* 2. use eocd's cd offset, get cd data */ in Init() 46 /* 3. use cd's entry offset and file size, get entry data */ in Init() 138 std::string::size_type offset = 0; in GetZipCentralDirectory() local 140 while (offset < retStr.size()) { in GetZipCentralDirectory() 148 offset += cd->GetLength(); in GetZipCentralDirectory() 151 if (offset + m_cDOffset != m_eOCDOffset) { in GetZipCentralDirectory() 152 SIGNATURE_TOOLS_LOGE("cd end offset not equals to eocd offset, maybe this is a zip64 file"); in GetZipCentralDirectory() 162 SIGNATURE_TOOLS_LOGE("signing offset in front of entry end"); in GetSigningBlock() 183 uint32_t offset in GetZipEntries() local 324 uint32_t offset = 0U; ResetOffset() local [all...] |
| H A D | zip_entry_data.cpp | 32 uint32_t offset = entryOffset; in GetZipEntry() local 33 /* read entry header by file and offset. */ in GetZipEntry() 43 offset += ZipEntryHeader::HEADER_LENGTH; in GetZipEntry() 45 /* read entry file name and extra by offset. */ in GetZipEntry() 46 if (!ReadEntryFileNameAndExtraByOffset(input, entryHeader, offset)) { in GetZipEntry() 49 /* skip file data , save file offset and size. */ in GetZipEntry() 51 entry->SetFileOffset(offset); in GetZipEntry() 77 uint32_t& offset) in ReadEntryFileNameAndExtraByOffset() 86 offset += entryHeader->GetFileNameLength(); in ReadEntryFileNameAndExtraByOffset() 95 offset in ReadEntryFileNameAndExtraByOffset() 76 ReadEntryFileNameAndExtraByOffset(std::ifstream& input, ZipEntryHeader* entryHeader, uint32_t& offset) ReadEntryFileNameAndExtraByOffset() argument [all...] |
| /developtools/hapsigner/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/hap/entity/ |
| H A D | HwBlockHead.java | 67 * @param offset Byte offset of the data block relative to the start position of the signature block 70 public static byte[] getBlockHead(char type, char tag, short length, int offset) { in getBlockHead() argument 76 (byte) ((offset >> TRIPLE_BIT_SIZE) & 0xff), in getBlockHead() 77 (byte) ((offset >> DOUBLE_BIT_SIZE) & 0xff), in getBlockHead() 78 (byte) ((offset >> BIT_SIZE) & 0xff), in getBlockHead() 79 (byte) (offset & 0xff) in getBlockHead() 89 * @param offset Byte offset of the data block relative to the start position of the signature block 92 public static byte[] getBlockHeadLittleEndian(char type, char tag, int length, int offset) { in getBlockHeadLittleEndian() argument [all...] |
| H A D | SigningBlock.java | 28 private int offset; field in SigningBlock 48 * @param offset signing block offset 50 public SigningBlock(int type, byte[] value, int offset) { in SigningBlock() argument 55 this.offset = offset; in SigningBlock() 71 return offset; in getOffset()
|
| /developtools/hapsigner/hapsigntool_cpp_test/unittest/codeSigning/sign/ |
| H A D | verify_code_signature_test.cpp | 110 int64_t offset = 1397151; in HWTEST_F() local 114 VerifyCodeSignature::VerifyHap(file, offset, length, fileFormat, profileContent); in HWTEST_F() 132 int64_t offset = 1397151; in HWTEST_F() local 136 bool flag = VerifyCodeSignature::VerifyHap(file, offset, length, fileFormat, profileContent); in HWTEST_F() 152 int64_t offset = 1397151; in HWTEST_F() local 156 bool flag = VerifyCodeSignature::VerifyHap(file, offset, length, fileFormat, profileContent); in HWTEST_F() 163 * @tc.desc: verify hap with invalid offset 172 int64_t offset = 1397151; in HWTEST_F() local 176 bool flag = VerifyCodeSignature::VerifyHap(file, offset, length, fileFormat, profileContent); in HWTEST_F() 192 int64_t offset in HWTEST_F() local 212 int64_t offset = 1397151; HWTEST_F() local 232 int64_t offset = 1397151; HWTEST_F() local 252 int64_t offset = 1397151; HWTEST_F() local 272 int64_t offset = 1397151; HWTEST_F() local 313 int64_t offset = 8216; HWTEST_F() local 333 int64_t offset = 8216; HWTEST_F() local 353 int64_t offset = 8216; HWTEST_F() local 373 int64_t offset = 8216; HWTEST_F() local 393 int64_t offset = 8216; HWTEST_F() local 413 int64_t offset = 8216; HWTEST_F() local 433 int64_t offset = 8216; HWTEST_F() local 475 int64_t offset = 1397151; HWTEST_F() local [all...] |
| /developtools/hapsigner/hapsigntool_cpp/hap/entity/src/ |
| H A D | block_head.cpp | 33 std::string BlockHead::GetBlockHead(const char type, const char tag, const short length, const int offset) in GetBlockHead() argument 40 tmpVec.push_back((offset >> TRIPLE_BIT_SIZE) & 0xff); in GetBlockHead() 41 tmpVec.push_back((offset >> DOUBLE_BIT_SIZE) & 0xff); in GetBlockHead() 42 tmpVec.push_back((offset >> BIT_SIZE) & 0xff); in GetBlockHead() 43 tmpVec.push_back(offset & 0xff); in GetBlockHead() 49 const int length, const int offset) in GetBlockHeadLittleEndian() 57 bf.PutInt32(offset); in GetBlockHeadLittleEndian() 48 GetBlockHeadLittleEndian(const char type, const char tag, const int length, const int offset) GetBlockHeadLittleEndian() argument
|
| /developtools/hapsigner/hapsigntool_cpp/common/src/ |
| H A D | random_access_file.cpp | 81 int32_t RandomAccessFile::DoMMap(int32_t bufCapacity, int64_t offset, MmapInfo& mmapInfo) in DoMMap() argument 94 if (offset < 0 || offset > fileLength - bufCapacity) { in DoMMap() 95 SIGNATURE_TOOLS_LOGE("offset is less than 0 OR read offset is out of range. offset: %" PRId64 in DoMMap() 96 ", range: %" PRId64, offset, fileLength - bufCapacity); in DoMMap() 99 // Memory mapped file offset, 0 OR an integer multiple of 4K in DoMMap() 100 mmapInfo.mmapPosition = (offset / memoryPageSize) * memoryPageSize; in DoMMap() 102 mmapInfo.readMoreLen = static_cast<int>(offset in DoMMap() 113 ReadFileFullyFromOffset(char buf[], int64_t offset, int64_t bufCapacity) ReadFileFullyFromOffset() argument 136 ReadFileFullyFromOffset(ByteBuffer& buffer, int64_t offset) ReadFileFullyFromOffset() argument 190 ReadFileFromOffsetAndDigestUpdate(const DigestParameter& digestParam, int32_t chunkSize, int64_t offset) ReadFileFromOffsetAndDigestUpdate() argument [all...] |
| H A D | byte_buffer.cpp | 309 void ByteBuffer::PutInt32(int32_t offset, int32_t value) in PutInt32() argument 311 if (buffer != nullptr && offset >= 0 && limit - offset >= static_cast<int32_t>(sizeof(value))) { in PutInt32() 312 if (memcpy_s((buffer.get() + offset), (limit - offset), &value, sizeof(value)) != EOK) { in PutInt32() 318 void ByteBuffer::PutInt16(int32_t offset, int16_t value) in PutInt16() argument 320 if (buffer != nullptr && offset >= 0 && limit - offset >= static_cast<int16_t>(sizeof(value))) { in PutInt16() 321 if (memcpy_s((buffer.get() + offset), (limit - offset), in PutInt16() 327 PutByte(int32_t offset, char value) PutByte() argument 336 PutData(int32_t offset, const char data[], int32_t len) PutData() argument 345 PutData(int32_t offset, const int8_t data[], int32_t len) PutData() argument 354 PutData(int32_t offset, const char data[], int32_t len, int32_t type) PutData() argument 481 GetData(int32_t offset, int8_t data[], uint32_t len) GetData() argument [all...] |
| /developtools/profiler/device/plugins/ftrace_plugin/test/unittest/ |
| H A D | ftrace_field_parser_test.cpp | 36 size_t offset = buffer_.size(); in AppendInt() local 38 if (memcpy_s(&buffer_[offset], buffer_.capacity() - offset, &value, sizeof(value))) { in AppendInt() 43 format.offset = offset; in AppendInt() 52 size_t offset = buffer_.size(); in AppendString() local 54 if (memcpy_s(&buffer_[offset], buffer_.capacity() - offset, &str[0], str.size())) { in AppendString() 59 format.offset = offset; in AppendString() [all...] |
| /developtools/smartperf_host/trace_streamer/test/unittest/rawtrace/ |
| H A D | ftrace_field_processor_test.cpp | 36 size_t offset = fieldBuffer_.size(); in AppendIntFiled() local 38 if (memcpy_s(&fieldBuffer_[offset], fieldBuffer_.capacity() - offset, &value, sizeof(value))) { in AppendIntFiled() 43 fieldFormat.offset = offset; in AppendIntFiled() 52 size_t offset = fieldBuffer_.size(); in AppendString() local 54 if (memcpy_s(&fieldBuffer_[offset], fieldBuffer_.capacity() - offset, &str[0], str.size())) { in AppendString() 59 fieldFormat.offset = offset; in AppendString() [all...] |
| /developtools/hapsigner/hapsigntool_cpp/zip/include/ |
| H A D | random_access_file_input.h | 35 * @param offset offset 38 RandomAccessFileInput(RandomAccessFile& file, int64_t offset, int64_t size); 46 bool CopyTo(int64_t offset, int size, ByteBuffer& buffer) override; 48 ByteBuffer CreateByteBuffer(int64_t offset, int size) override; 50 DataSource* Slice(int64_t offset, int64_t size) override; 55 bool CheckBoundValid(int64_t offset, int64_t size, int64_t sourceSize);
|
| H A D | zip_data_input.h | 44 * @param offset offset index at the ZipDataInput 49 virtual bool CopyTo(int64_t offset, int size, ByteBuffer& buffer) = 0; 54 * @param offset offset index at the ZipDataInput 59 virtual ByteBuffer CreateByteBuffer(int64_t offset, int size) = 0; 64 * @param offset offset index at the DataSource 68 virtual DataSource* Slice(int64_t offset, int64_t size) = 0;
|
| /developtools/hapsigner/hapsigntool_cpp/hap/verify/src/ |
| H A D | verify_elf.cpp | 237 int64_t offset = 0; in GetSignBlockData() local 238 bool checkMagicAndVersionFlag = CheckMagicAndVersion(bytes, offset, fileType); in GetSignBlockData() 244 std::vector<int8_t> blockSizeByte(bytes.begin() + offset, bytes.begin() + offset + intByteLength); in GetSignBlockData() 245 offset += intByteLength; in GetSignBlockData() 246 std::vector<int8_t> blockNumByte(bytes.begin() + offset, bytes.begin() + offset + intByteLength); in GetSignBlockData() 272 bool VerifyElf::CheckMagicAndVersion(std::vector<int8_t>& bytes, int64_t& offset, const std::string fileType) in CheckMagicAndVersion() argument 275 offset = bytes.size() - SignHead::SIGN_HEAD_LEN; in CheckMagicAndVersion() 276 std::vector<int8_t> magicByte(bytes.begin() + offset, byte in CheckMagicAndVersion() 301 int64_t offset = blockData.GetBlockStart(); GetElfSignBlock() local 329 int32_t offset = blockData.GetBlockStart(); GetBinSignBlock() local [all...] |
| /developtools/hapsigner/hapsigntool_cpp_test/unittest/codeSigning/datastructure/ |
| H A D | signed_file_pos_test.cpp | 67 int32_t offset = api->GetFileNameOffset(); in HWTEST_F() local 69 EXPECT_EQ(offset, 108); in HWTEST_F() 136 int32_t offset = api->GetFileNameOffset(); in HWTEST_F() local 138 EXPECT_EQ(offset, 109); in HWTEST_F() 154 int32_t offset = api->GetSignInfoOffset(); in HWTEST_F() local 156 EXPECT_EQ(offset, 282); in HWTEST_F()
|
| /developtools/hapsigner/hapsigntool_cpp_test/fuzztest/common/bytebuffer/bytebufferinit_fuzzer/ |
| H A D | bytebufferinit_fuzzer.cpp | 26 int32_t offset = 32; in ByteBufferTest001() local 35 bytebuffer.GetUInt8(offset, vValue); in ByteBufferTest001() 36 bytebuffer.PutInt16(offset, value); in ByteBufferTest001() 37 bytebuffer.PutData(offset, dataTest, len, type); in ByteBufferTest001()
|
| /developtools/hapsigner/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/hap/sign/ |
| H A D | SignHap.java | 84 long offset = INIT_OFFSET_LEN; in copyFiles() 98 offset += JarFile.LOCHDR; in copyFiles() 101 offset += outEntry.getName().length(); in copyFiles() 104 if (alignment > 0 && (offset % alignment != 0)) { in copyFiles() 105 int needed = alignment - (int) (offset % alignment); in copyFiles() 107 offset += needed; in copyFiles() 111 offset = writeOutputStreamAndGetOffset(in, out, inEntry, offset); in copyFiles() 122 offset += JarFile.LOCHDR; in copyFiles() 123 JarEntry outEntry = getFirstJarEntry(firstEntry, offset, timestam in copyFiles() 156 getFirstJarEntry(JarEntry firstEntry, long offset, long timestamp) getFirstJarEntry() argument 187 writeOutputStreamAndGetOffset(JarFile in, JarOutputStream out, JarEntry inEntry, long offset) writeOutputStreamAndGetOffset() argument [all...] |
| /developtools/hapsigner/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/utils/ |
| H A D | FileUtils.java | 151 * @param offset offset 155 public static byte[] readFileByOffsetAndLength(File file, long offset, long length) throws IOException { in readFileByOffsetAndLength() argument 157 return readInputByOffsetAndLength(input, offset, length); in readFileByOffsetAndLength() 165 * @param offset offset 170 public static byte[] readInputByOffsetAndLength(InputStream input, long offset, long length) throws IOException { in readInputByOffsetAndLength() argument 171 input.skip(offset); in readInputByOffsetAndLength() 229 * @param offset file read offset 233 appendWriteFileByOffsetToFile(String inFile, FileOutputStream out, long offset, long size) appendWriteFileByOffsetToFile() argument [all...] |