summaryrefslogtreecommitdiffstats
path: root/util_lib/include
diff options
context:
space:
mode:
Diffstat (limited to 'util_lib/include')
-rw-r--r--util_lib/include/elf_info.h36
-rw-r--r--util_lib/include/ip_checksum.h8
-rw-r--r--util_lib/include/sha256.h22
3 files changed, 66 insertions, 0 deletions
diff --git a/util_lib/include/elf_info.h b/util_lib/include/elf_info.h
new file mode 100644
index 0000000..fdf4c3d
--- /dev/null
+++ b/util_lib/include/elf_info.h
@@ -0,0 +1,36 @@
+#ifndef ELF_INFO_H
+#define ELF_INFO_H
+
+#define _XOPEN_SOURCE 700
+#define _GNU_SOURCE
+#define _LARGEFILE_SOURCE 1
+#define _FILE_OFFSET_BITS 64
+
+#include <endian.h>
+#include <byteswap.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <limits.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <elf.h>
+#include <stdbool.h>
+#include <inttypes.h>
+#include <ctype.h>
+
+int get_pt_load(int idx,
+ unsigned long long *phys_start,
+ unsigned long long *phys_end,
+ unsigned long long *virt_start,
+ unsigned long long *virt_end);
+int read_phys_offset_elf_kcore(int fd, long *phys_off);
+int read_elf(int fd);
+void dump_dmesg(int fd, void (*handler)(char*, unsigned int));
+extern void (*arch_scan_vmcoreinfo)(char *pos);
+
+#endif /* ELF_INFO_H */
diff --git a/util_lib/include/ip_checksum.h b/util_lib/include/ip_checksum.h
new file mode 100644
index 0000000..5559fa4
--- /dev/null
+++ b/util_lib/include/ip_checksum.h
@@ -0,0 +1,8 @@
+#ifndef IP_CHECKSUM_H
+#define IP_CHECKSUM_H
+
+unsigned long compute_ip_checksum(void *addr, unsigned long length);
+unsigned long add_ip_checksums(unsigned long offset, unsigned long sum, unsigned long new);
+unsigned long negate_ip_checksum(unsigned long sum);
+
+#endif /* IP_CHECKSUM_H */
diff --git a/util_lib/include/sha256.h b/util_lib/include/sha256.h
new file mode 100644
index 0000000..467fb22
--- /dev/null
+++ b/util_lib/include/sha256.h
@@ -0,0 +1,22 @@
+#ifndef SHA256_H
+#define SHA256_H
+
+#include <sys/types.h>
+#include <stdint.h>
+
+typedef struct
+{
+ size_t total[2];
+ uint32_t state[8];
+ uint8_t buffer[64];
+}
+sha256_context;
+
+typedef uint8_t sha256_digest_t[32];
+
+void sha256_starts( sha256_context *ctx );
+void sha256_update( sha256_context *ctx, const uint8_t *input, size_t length );
+void sha256_finish( sha256_context *ctx, sha256_digest_t digest );
+
+
+#endif /* SHA256_H */