~louis/ubuntu/trusty/clamav/lp799623_fix_logrotate

« back to all changes in this revision

Viewing changes to libclamav/clambc.h

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-03-12 11:30:04 UTC
  • mfrom: (0.41.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100312113004-b0fop4bkycszdd0z
Tags: 0.96~rc1+dfsg-0ubuntu1
* New upstream RC - FFE (LP: #537636):
  - Add OfficialDatabaseOnly option to clamav-base.postinst.in
  - Add LocalSocketGroup option to clamav-base.postinst.in
  - Add LocalSocketMode option to clamav-base.postinst.in
  - Add CrossFilesystems option to clamav-base.postinst.in
  - Add ClamukoScannerCount option to clamav-base.postinst.in
  - Add BytecodeSecurity opiton to clamav-base.postinst.in
  - Add DetectionStatsHostID option to clamav-freshclam.postinst.in
  - Add Bytecode option to clamav-freshclam.postinst.in
  - Add MilterSocketGroup option to clamav-milter.postinst.in
  - Add MilterSocketMode option to clamav-milter.postinst.in
  - Add ReportHostname option to clamav-milter.postinst.in
  - Bump libclamav SO version to 6.1.0 in libclamav6.install
  - Drop clamdmon from clamav.examples (no longer shipped by upstream)
  - Drop libclamav.a from libclamav-dev.install (not built by upstream)
  - Update SO version for lintian override for libclamav6
  - Add new Bytecode Testing Tool, usr/bin/clambc, to clamav.install
  - Add build-depends on python and python-setuptools for new test suite
  - Update debian/copyright for the embedded copy of llvm (using the system
    llvm is not currently feasible)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  ClamAV bytecode definitions.
 
3
 *
 
4
 *  Copyright (C) 2009-2010 Sourcefire, Inc.
 
5
 *
 
6
 *  Authors: Török Edvin
 
7
 *
 
8
 *  This program is free software; you can redistribute it and/or modify
 
9
 *  it under the terms of the GNU General Public License version 2 as
 
10
 *  published by the Free Software Foundation.
 
11
 *
 
12
 *  This program is distributed in the hope that it will be useful,
 
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 *  GNU General Public License for more details.
 
16
 *
 
17
 *  You should have received a copy of the GNU General Public License
 
18
 *  along with this program; if not, write to the Free Software
 
19
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
20
 *  MA 02110-1301, USA.
 
21
 */
 
22
#ifndef CLAMBC_H
 
23
#define CLAMBC_H
 
24
 
 
25
struct bytecode_metadata {
 
26
    char *compiler;
 
27
    char *sigmaker;
 
28
    uint64_t timestamp;
 
29
    unsigned long maxStack, maxMem;
 
30
    unsigned long maxTime;
 
31
    unsigned targetExclude;
 
32
};
 
33
 
 
34
#define BC_FUNC_LEVEL 6
 
35
#define BC_HEADER "ClamBC"
 
36
 
 
37
enum bc_opcode {
 
38
  OP_BC_ADD=1,
 
39
  OP_BC_SUB,
 
40
  OP_BC_MUL,
 
41
  OP_BC_UDIV,
 
42
  OP_BC_SDIV,
 
43
  OP_BC_UREM,
 
44
  OP_BC_SREM,
 
45
  OP_BC_SHL,
 
46
  OP_BC_LSHR,
 
47
  OP_BC_ASHR,
 
48
  OP_BC_AND,
 
49
  OP_BC_OR,
 
50
  OP_BC_XOR,
 
51
 
 
52
  OP_BC_TRUNC,
 
53
  OP_BC_SEXT,
 
54
  OP_BC_ZEXT,
 
55
 
 
56
  OP_BC_BRANCH,
 
57
  OP_BC_JMP,
 
58
  OP_BC_RET,
 
59
  OP_BC_RET_VOID,
 
60
 
 
61
  OP_BC_ICMP_EQ,
 
62
  OP_BC_ICMP_NE,
 
63
  OP_BC_ICMP_UGT,
 
64
  OP_BC_ICMP_UGE,
 
65
  OP_BC_ICMP_ULT,
 
66
  OP_BC_ICMP_ULE,
 
67
  OP_BC_ICMP_SGT,
 
68
  OP_BC_ICMP_SGE,
 
69
  OP_BC_ICMP_SLE,
 
70
  OP_BC_ICMP_SLT,
 
71
  OP_BC_SELECT,
 
72
  OP_BC_CALL_DIRECT,
 
73
  OP_BC_CALL_API,
 
74
  OP_BC_COPY,
 
75
  OP_BC_GEP1,
 
76
  OP_BC_GEPZ,
 
77
  OP_BC_GEPN,
 
78
  OP_BC_STORE,
 
79
  OP_BC_LOAD,
 
80
  OP_BC_MEMSET,
 
81
  OP_BC_MEMCPY,
 
82
  OP_BC_MEMMOVE,
 
83
  OP_BC_MEMCMP,
 
84
  OP_BC_ISBIGENDIAN,
 
85
  OP_BC_ABORT,
 
86
  OP_BC_BSWAP16,
 
87
  OP_BC_BSWAP32,
 
88
  OP_BC_BSWAP64,
 
89
  OP_BC_PTRDIFF32,
 
90
  OP_BC_INVALID /* last */
 
91
};
 
92
 
 
93
static const unsigned char operand_counts[] = {
 
94
  0,
 
95
  /* ADD -> XOR */
 
96
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 
97
  /* TRUNC -> ZEXT */
 
98
  1, 1, 1,
 
99
  /* BRANCH, JMP, RET */
 
100
  3, 1, 1, 0,
 
101
  /* ICMP */
 
102
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 
103
  /* SELECT */
 
104
  3,
 
105
  /* CALLs have variable number of operands */
 
106
  0, 0,
 
107
  /* OP_BC_COPY */
 
108
  2,
 
109
  /* OP_BC_GEP1, OP_BC_GEPZ, OP_BC_GEPN, OP_BC_STORE, OP_BC_LOAD*/
 
110
  3, 3, 0, 2, 1,
 
111
  /* OP_MEM* */
 
112
  3, 3, 3, 3,
 
113
  /* OP_BC_ISBIGENDIAN */
 
114
  0,
 
115
  /* OP_BC_ABORT, OP_BSWAP*, OP_PTRDIFF32 */
 
116
  0, 1, 1, 1, 2
 
117
};
 
118
 
 
119
enum bc_global {
 
120
  _FIRST_GLOBAL = 0x8000,
 
121
  GLOBAL_MATCH_COUNTS = 0x8000,
 
122
  GLOBAL_KIND,
 
123
  GLOBAL_VIRUSNAMES,
 
124
  GLOBAL_PEDATA,
 
125
  GLOBAL_FILESIZE,
 
126
  _LAST_GLOBAL
 
127
};
 
128
 
 
129
#define BC_START_TID 69
 
130
#endif