mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 02:05:01 +00:00
Massive refactoring of external header files.
This reduces the number of exported header files to the minimum needed by
the existing userspace utilities and firmware implementations.
BUG=chromium:221544
BRANCH=none
TEST=manual, trybots
CQ-DEPEND=CL:47019,CL:47022,CL:47023
sudo FEATURES=test emerge vboot_reference
FEATURES=test emerge-$BOARD \
vboot_reference \
chromeos-cryptohome \
chromeos-installer \
chromeos-u-boot \
peach-u-boot \
depthcharge
Change-Id: I2946cc2dbaf5459a6c5eca92ca57d546498e6d85
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47021
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
committed by
ChromeBot
parent
28b65ca99f
commit
0c3ba249ab
49
host/lib/include/host_misc.h
Normal file
49
host/lib/include/host_misc.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*
|
||||
* Host-side misc functions for verified boot.
|
||||
*/
|
||||
|
||||
#ifndef VBOOT_REFERENCE_HOST_MISC_H_
|
||||
#define VBOOT_REFERENCE_HOST_MISC_H_
|
||||
|
||||
#include "utility.h"
|
||||
#include "vboot_struct.h"
|
||||
|
||||
/* Copy up to dest_size-1 characters from src to dest, ensuring null
|
||||
termination (which strncpy() doesn't do). Returns the destination
|
||||
string. */
|
||||
char* StrCopy(char* dest, const char* src, int dest_size);
|
||||
|
||||
/* Read data from [filename]. Store the size of returned data in [size].
|
||||
*
|
||||
* Returns the data buffer, which the caller must Free(), or NULL if
|
||||
* error. */
|
||||
uint8_t* ReadFile(const char* filename, uint64_t* size);
|
||||
|
||||
/* Read a string from a file. Passed the destination, dest size, and
|
||||
* filename to read.
|
||||
*
|
||||
* Returns the destination, or NULL if error. */
|
||||
char* ReadFileString(char* dest, int size, const char* filename);
|
||||
|
||||
/* Read an integer from a file.
|
||||
*
|
||||
* Returns the parsed integer, or -1 if error. */
|
||||
int ReadFileInt(const char* filename);
|
||||
|
||||
/* Check if a bit is set in a file which contains an integer.
|
||||
*
|
||||
* Returns 1 if the bit is set, 0 if clear, or -1 if error. */
|
||||
int ReadFileBit(const char* filename, int bitmask);
|
||||
|
||||
/* Writes [size] bytes of [data] to [filename].
|
||||
*
|
||||
* Returns 0 if success, 1 if error. */
|
||||
int WriteFile(const char* filename, const void *data, uint64_t size);
|
||||
|
||||
/* Prints the sha1sum of the given VbPublicKey to stdout. */
|
||||
void PrintPubKeySha1Sum(VbPublicKey* key);
|
||||
|
||||
#endif /* VBOOT_REFERENCE_HOST_MISC_H_ */
|
||||
Reference in New Issue
Block a user