Cryptography Reference
In-Depth Information
A typical mechanism that enables this redirects calls to malloc() to a
special test function that receives the memory requests, in turn calls malloc() ,
and thereby allocates a somewhat greater amount of memory than is actually
requested. The block of memory is registered in an internal data structure, and
a frame of a few bytes is constructed “right” and “left” of the memory originally
requested, which is filled with a redundant pattern such as alternating binary
zeros and ones. Then a pointer is returned to the free memory within the frame. A
call to free() now in turn goes first to the debug shell of this function. Before the
allocated block is released a check is made as to whether the frame has been left
unharmed or whether the pattern has been destroyed by overwriting, in which
case an appropriate message is generated and the memory is stricken from the
registration list. Only then is the function free() actually called. At the end of the
application one can check using the internal registration list whether, or which,
areas of memory were not released. The orchestrating of the code for rerouting
the calls to malloc() and free() to their debug shells is accomplished with macros
that are usually defined in #include files.
For the test of the FLINT/C functions the ResTrack package from [Murp] is
employed. This enables the detection, in certain cases, of subtle instances of
exceeding the vector bounds of CLINT variables, which otherwise might have
remained undetected during testing.
We have now completed the basic preparations and consider next the
functions for basic calculation (cf. Chapter 4)
add_l() , sub_l() , mul_l() , sqr_l() , div_l() , mod_l() , inc_l() ,
dec_l() , shl_l() , shr_l() , shift_l() ,
including the kernel functions
add() , sub() , mult() , umul() , sqr() ,
the mixed arithmetic functions with a USHORT argument
uadd_l() , usub_l() , umul_l() , udiv_l() , umod_l() , mod2_l() ,
and finally the functions for modular arithmetic (cf. Chapters 5 and 6)
madd_l() , msub_l() , mmul_l() , msqr_l() ,
and the exponentiation function
*mexp*_l() .
The calculational rules that we shall employ in testing these functions arise
from the group laws of the integers, which have been introduced already in
Chapter 5 for the residue class rings
Z
n . The applicable rules for the natural
numbers are again collected here, where we find an opportunity for testing
wherever an equal sign stands between two expressions (see Table 13-1).
 
Search WWH ::




Custom Search