~ubuntu-branches/ubuntu/lucid/openssl/lucid-security

« back to all changes in this revision

Viewing changes to crypto/bn/bn_exp.c

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2008-08-03 19:47:10 UTC
  • mfrom: (1.1.6 upstream) (14 gutsy)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: james.westby@ubuntu.com-20080803194710-dwlvv1y2pyzi3in2
Tags: 0.9.8g-13
Fix a problem with tlsext preventing firefox 3 from connection.
Patch from upstream CVS and part of 0.9.8h.
(Closes: #492758)

Show diffs side-by-side

added added

removed removed

Lines of Context:
122
122
        int i,bits,ret=0;
123
123
        BIGNUM *v,*rr;
124
124
 
125
 
        if (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) != 0)
 
125
        if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0)
126
126
                {
127
 
                /* BN_FLG_EXP_CONSTTIME only supported by BN_mod_exp_mont() */
 
127
                /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
128
128
                BNerr(BN_F_BN_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
129
129
                return -1;
130
130
                }
213
213
        if (BN_is_odd(m))
214
214
                {
215
215
#  ifdef MONT_EXP_WORD
216
 
                if (a->top == 1 && !a->neg && (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) == 0))
 
216
                if (a->top == 1 && !a->neg && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0))
217
217
                        {
218
218
                        BN_ULONG A = a->d[0];
219
219
                        ret=BN_mod_exp_mont_word(r,A,p,m,ctx,NULL);
245
245
        BIGNUM *val[TABLE_SIZE];
246
246
        BN_RECP_CTX recp;
247
247
 
248
 
        if (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) != 0)
 
248
        if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0)
249
249
                {
250
 
                /* BN_FLG_EXP_CONSTTIME only supported by BN_mod_exp_mont() */
 
250
                /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
251
251
                BNerr(BN_F_BN_MOD_EXP_RECP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
252
252
                return -1;
253
253
                }
379
379
        BIGNUM *val[TABLE_SIZE];
380
380
        BN_MONT_CTX *mont=NULL;
381
381
 
382
 
        if (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) != 0)
 
382
        if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0)
383
383
                {
384
384
                return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
385
385
                }
745
745
#define BN_TO_MONTGOMERY_WORD(r, w, mont) \
746
746
                (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
747
747
 
748
 
        if (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) != 0)
 
748
        if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0)
749
749
                {
750
 
                /* BN_FLG_EXP_CONSTTIME only supported by BN_mod_exp_mont() */
 
750
                /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
751
751
                BNerr(BN_F_BN_MOD_EXP_MONT_WORD,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
752
752
                return -1;
753
753
                }
881
881
        /* Table of variables obtained from 'ctx' */
882
882
        BIGNUM *val[TABLE_SIZE];
883
883
 
884
 
        if (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) != 0)
 
884
        if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0)
885
885
                {
886
 
                /* BN_FLG_EXP_CONSTTIME only supported by BN_mod_exp_mont() */
 
886
                /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
887
887
                BNerr(BN_F_BN_MOD_EXP_SIMPLE,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
888
888
                return -1;
889
889
                }