~ubuntu-branches/ubuntu/utopic/dropbear/utopic-proposed

« back to all changes in this revision

Viewing changes to libtommath/bn_mp_toradix_n.c

  • Committer: Bazaar Package Importer
  • Author(s): Gerrit Pape, Matt Johnston, Gerrit Pape
  • Date: 2008-03-27 20:08:06 UTC
  • mfrom: (1.4.1 upstream) (9 hardy)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: james.westby@ubuntu.com-20080327200806-c1hhdgt3ht2gk496
Tags: 0.51-1
[ Matt Johnston ]
* New upstream release.
  - Wait until a process exits before the server closes a connection,
    so that an exit code can be sent. This fixes problems with exit
    codes not being returned, which could cause scp to fail (closes:
    #448397, #472483).

[ Gerrit Pape ]
* debian/dropbear.postinst: don't print an error message if the
  update-service program is not installed (thx Matt).

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 * The library is free for all purposes without any express
13
13
 * guarantee it works.
14
14
 *
15
 
 * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
 
15
 * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
16
16
 */
17
17
 
18
18
/* stores a bignum as a ASCII string in a given radix (2..64) 
27
27
  char   *_s = str;
28
28
 
29
29
  /* check range of the maxlen, radix */
30
 
  if (maxlen < 3 || radix < 2 || radix > 64) {
 
30
  if (maxlen < 2 || radix < 2 || radix > 64) {
31
31
    return MP_VAL;
32
32
  }
33
33
 
34
34
  /* quick out if its zero */
35
 
  if (mp_iszero(a) == 1) {
 
35
  if (mp_iszero(a) == MP_YES) {
36
36
     *str++ = '0';
37
37
     *str = '\0';
38
38
     return MP_OKAY;
57
57
 
58
58
  digs = 0;
59
59
  while (mp_iszero (&t) == 0) {
 
60
    if (--maxlen < 1) {
 
61
       /* no more room */
 
62
       break;
 
63
    }
60
64
    if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) {
61
65
      mp_clear (&t);
62
66
      return res;
63
67
    }
64
68
    *str++ = mp_s_rmap[d];
65
69
    ++digs;
66
 
 
67
 
    if (--maxlen == 1) {
68
 
       /* no more room */
69
 
       break;
70
 
    }
71
70
  }
72
71
 
73
72
  /* reverse the digits of the string.  In this case _s points
74
 
   * to the first digit [exluding the sign] of the number]
 
73
   * to the first digit [exluding the sign] of the number
75
74
   */
76
75
  bn_reverse ((unsigned char *)_s, digs);
77
76
 
83
82
}
84
83
 
85
84
#endif
 
85
 
 
86
/* $Source: /cvs/libtom/libtommath/bn_mp_toradix_n.c,v $ */
 
87
/* $Revision: 1.4 $ */
 
88
/* $Date: 2006/03/31 14:18:44 $ */