~ubuntu-branches/ubuntu/natty/libgcrypt11/natty-proposed

« back to all changes in this revision

Viewing changes to mpi/mpi-mpow.c

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Metzler
  • Date: 2009-02-21 13:46:58 UTC
  • mto: (1.1.6 upstream) (2.1.3 squeeze)
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20090221134658-855twvcr4ezk2ron
ImportĀ upstreamĀ versionĀ 1.4.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include <config.h>
22
22
#include <stdio.h>
23
23
#include <stdlib.h>
 
24
 
24
25
#include "mpi-internal.h"
25
26
#include "longlong.h"
26
27
#include "g10lib.h"
27
 
#include <assert.h>
28
28
 
29
29
 
30
30
/* Barrett is slower than the classical way.  It can be tweaked by
77
77
 
78
78
    for(k=0; basearray[k]; k++ )
79
79
        ;
80
 
    assert(k);
 
80
    gcry_assert(k);
81
81
    for(t=0, i=0; (tmp=exparray[i]); i++ ) {
82
82
        /*log_mpidump("exp: ", tmp );*/
83
83
        j = mpi_get_nbits(tmp);
85
85
            t = j;
86
86
    }
87
87
    /*log_mpidump("mod: ", m );*/
88
 
    assert(i==k);
89
 
    assert(t);
90
 
    assert( k < 10 );
 
88
    gcry_assert (i==k);
 
89
    gcry_assert (t);
 
90
    gcry_assert (k < 10);
91
91
 
92
92
    G = gcry_xcalloc( (1<<k) , sizeof *G );
93
93
#ifdef USE_BARRETT
100
100
        barrett_mulm(tmp, res, res, m, barrett_y, barrett_k,
101
101
                                       barrett_r1, barrett_r2 );
102
102
        idx = build_index( exparray, k, i, t );
103
 
        assert( idx >= 0 && idx < (1<<k) );
 
103
        gcry_assert (idx >= 0 && idx < (1<<k));
104
104
        if( !G[idx] ) {
105
105
            if( !idx )
106
106
                 G[0] = mpi_alloc_set_ui( 1 );