libclamav/elf.h
6ed894e0
 /*
a140a928
  *  Copyright (C) 2007-2009 Sourcefire, Inc.
6ed894e0
  *
2023340a
  *  Authors: Tomasz Kojm
6ed894e0
  *
  *  This program is free software; you can redistribute it and/or modify
bb34cb31
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
6ed894e0
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
48b7b4a7
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  *  MA 02110-1301, USA.
6ed894e0
  */
 
 #ifndef __ELF_H
 #define __ELF_H
 
 #include "cltypes.h"
 #include "clamav.h"
01302683
 #include "execs.h"
3c91998b
 #include "others.h"
90b75c27
 #include "fmap.h"
6ed894e0
 
 struct elf_file_hdr32 {
     unsigned char e_ident[16];
     uint16_t e_type;
     uint16_t e_machine;
     uint32_t e_version;
     uint32_t e_entry;
     uint32_t e_phoff;
     uint32_t e_shoff;
     uint32_t e_flags;
     uint16_t e_ehsize;
     uint16_t e_phentsize;
     uint16_t e_phnum;
     uint16_t e_shentsize;
     uint16_t e_shnum;
     uint16_t e_shstrndx;
 };
 
a140a928
 struct elf_file_hdr64 {
     unsigned char e_ident[16];
     uint16_t e_type;
     uint16_t e_machine;
     uint32_t e_version;
     uint64_t e_entry;
     uint64_t e_phoff;
     uint64_t e_shoff;
     uint32_t e_flags;
     uint16_t e_ehsize;
     uint16_t e_phentsize;
     uint16_t e_phnum;
     uint16_t e_shentsize;
     uint16_t e_shnum;
     uint16_t e_shstrndx;
 };
 
939b015c
 struct elf_program_hdr32 {
     uint32_t p_type;
     uint32_t p_offset;
     uint32_t p_vaddr;
     uint32_t p_paddr;
     uint32_t p_filesz;
     uint32_t p_memsz;
     uint32_t p_flags;
     uint32_t p_align;
 };
 
a140a928
 struct elf_program_hdr64 {
     uint32_t p_type;
     uint32_t p_flags;
     uint64_t p_offset;
     uint64_t p_vaddr;
     uint64_t p_paddr;
     uint64_t p_filesz;
     uint64_t p_memsz;
     uint64_t p_align;
 };
 
6ed894e0
 struct elf_section_hdr32 {
     uint32_t sh_name;
     uint32_t sh_type;
     uint32_t sh_flags;
     uint32_t sh_addr;
     uint32_t sh_offset;
     uint32_t sh_size;
     uint32_t sh_link;
     uint32_t sh_info;
     uint32_t sh_addralign;
     uint32_t sh_entsize;
 };
 
a140a928
 struct elf_section_hdr64 {
     uint32_t sh_name;
     uint32_t sh_type;
     uint64_t sh_flags;
     uint64_t sh_addr;
     uint64_t sh_offset;
     uint64_t sh_size;
     uint32_t sh_link;
     uint32_t sh_info;
     uint64_t sh_addralign;
     uint64_t sh_entsize;
 };
 
90b75c27
 int cli_scanelf(cli_ctx *ctx);
6ed894e0
 
49cc1e3c
 int cli_elfheader(fmap_t *map, struct cli_exe_info *elfinfo);
01302683
 
6ed894e0
 #endif