package binsec

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type a
and b
type nonrec size = size
type nonrec 'a interval = 'a interval = {
  1. lo : 'a;
  2. hi : 'a;
}
type nonrec endianness = endianness =
  1. | LittleEndian
  2. | BigEndian
type 'a op = 'a operator =
  1. | Not : unary op
  2. | Sext : size -> unary op
  3. | Uext : size -> unary op
  4. | Restrict : int interval -> unary op
  5. | Plus : binary op
  6. | Minus : _ op
  7. | Mul : binary op
  8. | Udiv : binary op
  9. | Umod : binary op
  10. | Sdiv : binary op
  11. | Smod : binary op
  12. | Or : binary op
  13. | And : binary op
  14. | Xor : binary op
  15. | Concat : binary op
  16. | Lsl : binary op
  17. | Lsr : binary op
  18. | Asr : binary op
  19. | Rol : binary op
  20. | Ror : binary op
  21. | Eq : binary op
  22. | Diff : binary op
  23. | Ule : binary op
  24. | Ult : binary op
  25. | Uge : binary op
  26. | Ugt : binary op
  27. | Sle : binary op
  28. | Slt : binary op
  29. | Sge : binary op
  30. | Sgt : binary op
type ('k, 'a, 'b) term = private ('k, 'a, 'b) t =
  1. | Var : {
    1. hash : int;
    2. size : size;
    3. name : string;
    4. label : 'a;
    } -> ([< `Var | `Loc | `Exp ], 'a, _) term
  2. | Load : {
    1. hash : int;
    2. len : size;
    3. dir : endianness;
    4. addr : ([ `Exp ], 'a, 'b) term;
    5. label : 'b;
    } -> ([< `Mem | `Loc | `Exp ], 'a, 'b) term
  3. | Cst : Bitvector.t -> ([< `Cst | `Exp ], _, _) term
  4. | Unary : {
    1. hash : int;
    2. size : size;
    3. f : unary operator;
    4. x : ([ `Exp ], 'a, 'b) term;
    } -> ([ `Exp ], 'a, 'b) term
  5. | Binary : {
    1. hash : int;
    2. size : size;
    3. f : binary operator;
    4. x : ([ `Exp ], 'a, 'b) term;
    5. y : ([ `Exp ], 'a, 'b) term;
    } -> ([ `Exp ], 'a, 'b) term
  6. | Ite : {
    1. hash : int;
    2. size : size;
    3. c : ([ `Exp ], 'a, 'b) term;
    4. t : ([ `Exp ], 'a, 'b) term;
    5. e : ([ `Exp ], 'a, 'b) term;
    } -> ([ `Exp ], 'a, 'b) term
type t = ([ `Exp ], a, b) term

Constructors

val var : string -> size -> a -> t

var name bitsize label

val load : size -> endianness -> t -> b -> t

load nbytes endianness addr label

val constant : Bitvector.t -> t

constant bv creates a constant expression from the bitvector bv.

val unary : unary op -> t -> t

unary f x creates a unary application of f on x.

val binary : binary op -> t -> t -> t

binary f x y creates a binary application of f on x and y.

val ite : t -> t -> t -> t

ite c t e creates an if-then-else expression c ? t : e.

val uminus : t -> t
val add : t -> t -> t
val sub : t -> t -> t
val mul : t -> t -> t
val smod : t -> t -> t
val umod : t -> t -> t
val udiv : t -> t -> t
val sdiv : t -> t -> t
val append : t -> t -> t
val equal : t -> t -> t
val diff : t -> t -> t
val ule : t -> t -> t
val uge : t -> t -> t
val ult : t -> t -> t
val ugt : t -> t -> t
val sle : t -> t -> t
val sge : t -> t -> t
val slt : t -> t -> t
val sgt : t -> t -> t
val logand : t -> t -> t
val logor : t -> t -> t
val lognot : t -> t
val logxor : t -> t -> t
val shift_left : t -> t -> t
val shift_right : t -> t -> t
val shift_right_signed : t -> t -> t

shift_(left|right) e q shifts expression e by quantity q, padding with zeroes

val rotate_left : t -> t -> t
val rotate_right : t -> t -> t

rotate_(left|right) e q rotates expression e by quantity q

val sext : size -> t -> t

sext sz e performs a signed extension of expression e to size sz

val uext : size -> t -> t

uext sz e performs an unsigned extension expression e to size sz

val restrict : lo:int -> hi:int -> t -> t

restrict lo hi e creates Dba.ExprUnary(Restrict(lo, hi), e) if hi >= lo && lo >=0 .

val bit_restrict : int -> t -> t

bit_restrict o e is restrict o o e

Specific constants

val zeros : int -> t

zeros n creates a constant expression of value 0 with length n

val ones : int -> t

ones n creates a constant expression of value 1 with length n. I.e.; it has (n - 1) zeros in binary.

val one : t
val zero : t
val addi : t -> int -> t
val addz : t -> Z.t -> t
Utils

*

val hash : t -> int

hash t returns the hash of t in constant time.

val is_equal : t -> t -> bool
val compare : t -> t -> int
val sizeof : t -> size

sizeof t returns the bit size of t in constant time.

val map : (string -> int -> 'a -> t) -> (int -> Machine.endianness -> t -> 'b -> t) -> (_, 'a, 'b) term -> t
OCaml

Innovation. Community. Security.