miasm
Reverse engineering framework
bn.h File Reference
#include <stdint.h>
#include <assert.h>
Include dependency graph for bn.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  bn
 

Macros

#define _MIASM_EXPORT
 
#define WORD_SIZE   4
 
#define BN_BYTE_SIZE   32
 
#define BN_BIT_SIZE   ((BN_BYTE_SIZE) * 8)
 
#define BN_ARRAY_SIZE   (BN_BYTE_SIZE / WORD_SIZE)
 
#define DTYPE   uint32_t
 
#define DTYPE_SIGNED   int32_t
 
#define DTYPE_TMP   uint64_t
 
#define DTYPE_MSB   ((DTYPE_TMP)(0x80000000))
 
#define SPRINTF_FORMAT_STR   "%.08x"
 
#define SSCANF_FORMAT_STR   "%8x"
 
#define MAX_VAL   ((DTYPE_TMP)0xFFFFFFFF)
 
#define require(p, msg)   assert(p && #msg)
 

Typedefs

typedef struct bn bn_t
 

Enumerations

enum  { SMALLER = -1, EQUAL = 0, LARGER = 1 }
 

Functions

_MIASM_EXPORT bn_t bignum_init (void)
 
_MIASM_EXPORT bn_t bignum_from_int (DTYPE_TMP i)
 
_MIASM_EXPORT bn_t bignum_from_uint64 (uint64_t i)
 
_MIASM_EXPORT int bignum_to_int (bn_t n)
 
_MIASM_EXPORT uint64_t bignum_to_uint64 (bn_t n)
 
_MIASM_EXPORT bn_t bignum_from_string (char *str, int nbytes)
 
_MIASM_EXPORT void bignum_to_string (bn_t n, char *str, int maxsize)
 
_MIASM_EXPORT bn_t bignum_add (bn_t a, bn_t b)
 
_MIASM_EXPORT bn_t bignum_sub (bn_t a, bn_t b)
 
_MIASM_EXPORT bn_t bignum_mul (bn_t a, bn_t b)
 
_MIASM_EXPORT bn_t bignum_udiv (bn_t a, bn_t b)
 
_MIASM_EXPORT bn_t bignum_umod (bn_t a, bn_t b)
 
_MIASM_EXPORT bn_t bignum_sdiv (bn_t a, bn_t b, int size)
 
_MIASM_EXPORT bn_t bignum_smod (bn_t a, bn_t b, int size)
 
_MIASM_EXPORT bn_t bignum_and (bn_t a, bn_t b)
 
_MIASM_EXPORT bn_t bignum_or (bn_t a, bn_t b)
 
_MIASM_EXPORT bn_t bignum_xor (bn_t a, bn_t b)
 
_MIASM_EXPORT bn_t bignum_lshift (bn_t a, int nbits)
 
_MIASM_EXPORT bn_t bignum_rshift (bn_t a, int nbits)
 
_MIASM_EXPORT bn_t bignum_a_rshift (bn_t a, int size, int nbits)
 
_MIASM_EXPORT bn_t bignum_not (bn_t a)
 
_MIASM_EXPORT int bignum_cmp (bn_t a, bn_t b)
 
_MIASM_EXPORT int bignum_is_equal (bn_t a, bn_t b)
 
_MIASM_EXPORT int bignum_is_inf_unsigned (bn_t a, bn_t b)
 
_MIASM_EXPORT int bignum_is_inf_equal_unsigned (bn_t a, bn_t b)
 
_MIASM_EXPORT int bignum_is_inf_signed (bn_t a, bn_t b)
 
_MIASM_EXPORT int bignum_is_inf_equal_signed (bn_t a, bn_t b)
 
_MIASM_EXPORT int bignum_is_zero (bn_t n)
 
_MIASM_EXPORT bn_t bignum_inc (bn_t n)
 
_MIASM_EXPORT bn_t bignum_dec (bn_t n)
 
_MIASM_EXPORT int bignum_cntleadzeros (bn_t n, int size)
 
_MIASM_EXPORT int bignum_cnttrailzeros (bn_t n, int size)
 
_MIASM_EXPORT bn_t bignum_assign (bn_t src)
 
_MIASM_EXPORT bn_t bignum_mask (bn_t src, int bits)
 
_MIASM_EXPORT bn_t bignum_rol (bn_t a, int size, int nbits)
 
_MIASM_EXPORT bn_t bignum_ror (bn_t a, int size, int nbits)
 
_MIASM_EXPORT int bignum_getbit (bn_t a, int pos)
 

Macro Definition Documentation

◆ _MIASM_EXPORT

#define _MIASM_EXPORT

◆ BN_ARRAY_SIZE

#define BN_ARRAY_SIZE   (BN_BYTE_SIZE / WORD_SIZE)

◆ BN_BIT_SIZE

#define BN_BIT_SIZE   ((BN_BYTE_SIZE) * 8)

◆ BN_BYTE_SIZE

#define BN_BYTE_SIZE   32

◆ DTYPE

#define DTYPE   uint32_t

◆ DTYPE_MSB

#define DTYPE_MSB   ((DTYPE_TMP)(0x80000000))

◆ DTYPE_SIGNED

#define DTYPE_SIGNED   int32_t

◆ DTYPE_TMP

#define DTYPE_TMP   uint64_t

◆ MAX_VAL

#define MAX_VAL   ((DTYPE_TMP)0xFFFFFFFF)

◆ require

#define require (   p,
  msg 
)    assert(p && #msg)

◆ SPRINTF_FORMAT_STR

#define SPRINTF_FORMAT_STR   "%.08x"

◆ SSCANF_FORMAT_STR

#define SSCANF_FORMAT_STR   "%8x"

◆ WORD_SIZE

#define WORD_SIZE   4

Typedef Documentation

◆ bn_t

typedef struct bn bn_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SMALLER 
EQUAL 
LARGER 

Function Documentation

◆ bignum_a_rshift()

_MIASM_EXPORT bn_t bignum_a_rshift ( bn_t  a,
int  size,
int  nbits 
)
Here is the call graph for this function:

◆ bignum_add()

_MIASM_EXPORT bn_t bignum_add ( bn_t  a,
bn_t  b 
)

◆ bignum_and()

_MIASM_EXPORT bn_t bignum_and ( bn_t  a,
bn_t  b 
)
Here is the caller graph for this function:

◆ bignum_assign()

_MIASM_EXPORT bn_t bignum_assign ( bn_t  src)
Here is the caller graph for this function:

◆ bignum_cmp()

_MIASM_EXPORT int bignum_cmp ( bn_t  a,
bn_t  b 
)
Here is the caller graph for this function:

◆ bignum_cntleadzeros()

_MIASM_EXPORT int bignum_cntleadzeros ( bn_t  n,
int  size 
)
Here is the call graph for this function:

◆ bignum_cnttrailzeros()

_MIASM_EXPORT int bignum_cnttrailzeros ( bn_t  n,
int  size 
)
Here is the call graph for this function:

◆ bignum_dec()

_MIASM_EXPORT bn_t bignum_dec ( bn_t  n)
Here is the caller graph for this function:

◆ bignum_from_int()

_MIASM_EXPORT bn_t bignum_from_int ( DTYPE_TMP  i)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bignum_from_string()

_MIASM_EXPORT bn_t bignum_from_string ( char *  str,
int  nbytes 
)
Here is the call graph for this function:

◆ bignum_from_uint64()

_MIASM_EXPORT bn_t bignum_from_uint64 ( uint64_t  i)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bignum_getbit()

_MIASM_EXPORT int bignum_getbit ( bn_t  a,
int  pos 
)
Here is the caller graph for this function:

◆ bignum_inc()

_MIASM_EXPORT bn_t bignum_inc ( bn_t  n)

◆ bignum_init()

_MIASM_EXPORT bn_t bignum_init ( void  )
Here is the caller graph for this function:

◆ bignum_is_equal()

_MIASM_EXPORT int bignum_is_equal ( bn_t  a,
bn_t  b 
)
Here is the call graph for this function:

◆ bignum_is_inf_equal_signed()

_MIASM_EXPORT int bignum_is_inf_equal_signed ( bn_t  a,
bn_t  b 
)
Here is the call graph for this function:

◆ bignum_is_inf_equal_unsigned()

_MIASM_EXPORT int bignum_is_inf_equal_unsigned ( bn_t  a,
bn_t  b 
)
Here is the call graph for this function:

◆ bignum_is_inf_signed()

_MIASM_EXPORT int bignum_is_inf_signed ( bn_t  a,
bn_t  b 
)
Here is the call graph for this function:

◆ bignum_is_inf_unsigned()

_MIASM_EXPORT int bignum_is_inf_unsigned ( bn_t  a,
bn_t  b 
)
Here is the call graph for this function:

◆ bignum_is_zero()

_MIASM_EXPORT int bignum_is_zero ( bn_t  n)
Here is the caller graph for this function:

◆ bignum_lshift()

_MIASM_EXPORT bn_t bignum_lshift ( bn_t  a,
int  nbits 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bignum_mask()

_MIASM_EXPORT bn_t bignum_mask ( bn_t  src,
int  bits 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bignum_mul()

_MIASM_EXPORT bn_t bignum_mul ( bn_t  a,
bn_t  b 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bignum_not()

_MIASM_EXPORT bn_t bignum_not ( bn_t  a)

◆ bignum_or()

_MIASM_EXPORT bn_t bignum_or ( bn_t  a,
bn_t  b 
)
Here is the caller graph for this function:

◆ bignum_rol()

_MIASM_EXPORT bn_t bignum_rol ( bn_t  a,
int  size,
int  nbits 
)
Here is the call graph for this function:

◆ bignum_ror()

_MIASM_EXPORT bn_t bignum_ror ( bn_t  a,
int  size,
int  nbits 
)
Here is the call graph for this function:

◆ bignum_rshift()

_MIASM_EXPORT bn_t bignum_rshift ( bn_t  a,
int  nbits 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bignum_sdiv()

_MIASM_EXPORT bn_t bignum_sdiv ( bn_t  a,
bn_t  b,
int  size 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bignum_smod()

_MIASM_EXPORT bn_t bignum_smod ( bn_t  a,
bn_t  b,
int  size 
)
Here is the call graph for this function:

◆ bignum_sub()

_MIASM_EXPORT bn_t bignum_sub ( bn_t  a,
bn_t  b 
)
Here is the caller graph for this function:

◆ bignum_to_int()

_MIASM_EXPORT int bignum_to_int ( bn_t  n)
Here is the call graph for this function:

◆ bignum_to_string()

_MIASM_EXPORT void bignum_to_string ( bn_t  n,
char *  str,
int  maxsize 
)
Here is the call graph for this function:

◆ bignum_to_uint64()

_MIASM_EXPORT uint64_t bignum_to_uint64 ( bn_t  n)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bignum_udiv()

_MIASM_EXPORT bn_t bignum_udiv ( bn_t  a,
bn_t  b 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bignum_umod()

_MIASM_EXPORT bn_t bignum_umod ( bn_t  a,
bn_t  b 
)
Here is the call graph for this function:

◆ bignum_xor()

_MIASM_EXPORT bn_t bignum_xor ( bn_t  a,
bn_t  b 
)
Here is the caller graph for this function: