Cryptography Reference
In-Depth Information
The C function mul_l() is called, to which are passed as arguments the vectors
lm.n_l , ln.n_l asfactors,aswellas prd.n_l for storing the product.
error = mul_l (lm.n_l, ln.n_l, prd.n_l);
The evaluation of the error code stored in error distinguishes three cases: If error
== 0 , then all is right with the world, and the object prd can be marked as ini-
tialized. This takes place by setting the variable prd.status to a value unequal to
E_LINT_INV , which in normal cases ( error == 0 )is E_LINT_OK .Ifanoverflowoc-
curred with mul_l() ,then error contains the value E_CLINT_OFL . Since the vector
prd.n_l contains in this case a valid CLINT integer, the status variable prd.status is
simply set to E_LINT_OFL , though without a call to error handling. If error has nei-
ther of these two values after the call to mul_l() , then something has gone awry in
these functions without our being able to identify more precisely what error has
occurred. Therefore, the function panic() is called for further error handling.
switch (error)
{
case 0:
prd.status = E_LINT_OK;
break;
case E_CLINT_OFL:
prd.status = E_LINT_OFL;
break;
default:
lint::panic (E_LINT_ERR, "*", error, __LINE__);
}
If the error cannot be repaired by panic() , there would be no point in returning to
this location. The mechanism for error recognition leads here to a defined termi-
nation, which in principle is better than continuing the program in an undefined
state. As a final step we have the elementwise return of the product prd .
return prd;
}
Since the object prd exists only within the context of the function, the
compiler makes sure that a temporary object is created automatically, which
represents the value of prd outside the function. This temporary object is
generated with the aid of the copy constructor LINT(const LINT&) (cf. page 328)
and exists until the expression within which the operator was used has been
 
Search WWH ::




Custom Search