~ubuntu-branches/ubuntu/precise/dropbear/precise

« back to all changes in this revision

Viewing changes to libtomcrypt/src/pk/asn1/der/short_integer/der_encode_short_integer.c

  • Committer: Bazaar Package Importer
  • Author(s): Gerrit Pape
  • Date: 2007-03-02 20:48:18 UTC
  • mfrom: (1.3.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070302204818-ozmbou2sbyj7dus5
Tags: 0.49-1
* new upstream release, fixes
  * CVE-2007-1099: dropbear dbclient insufficient warning on hostkey
    mismatch (closes: #412899).
  * dbclient uses static "Password:" prompt instead of using the server's
    prompt (closes: #394996).
* debian/control: Suggests: openssh-client, not ssh (closes: #405686);
  Standards-Version: 3.7.2.2.
* debian/README.Debian: ssh -> openssh-server, openssh-client; remove
  'Replacing OpenSSH "sshd" with Dropbear' part, this is simply done by not
  installing the openssh-server package.
* debian/README.runit: runsvstat -> sv status.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * The library is free for all purposes without any express
7
7
 * guarantee it works.
8
8
 *
9
 
 * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
 
9
 * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
10
10
 */
11
11
#include "tomcrypt.h"
12
12
 
18
18
 
19
19
#ifdef LTC_DER
20
20
 
21
 
/* Exports a positive integer as DER format (upto 32-bits in size) */
22
21
/**
23
 
  Store a mp_int integer
 
22
  Store a short integer in the range (0,2^32-1)
24
23
  @param num      The integer to encode
25
24
  @param out      [out] The destination for the DER encoded integers
26
25
  @param outlen   [in/out] The max size and resulting size of the DER encoded integers
43
42
   }
44
43
 
45
44
   if (*outlen < len) {
 
45
      *outlen = len;
46
46
      return CRYPT_BUFFER_OVERFLOW;
47
47
   }
48
48
 
70
70
   /* store header */
71
71
   x = 0;
72
72
   out[x++] = 0x02;
73
 
   out[x++] = z;
 
73
   out[x++] = (unsigned char)z;
74
74
 
75
75
   /* if 31st bit is set output a leading zero and decrement count */
76
76
   if (z == 5) {
80
80
 
81
81
   /* store values */
82
82
   for (y = 0; y < z; y++) {
83
 
      out[x++] = (num >> 24) & 0xFF;
 
83
      out[x++] = (unsigned char)((num >> 24) & 0xFF);
84
84
      num    <<= 8;
85
85
   }
86
86
 
93
93
#endif
94
94
 
95
95
/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/short_integer/der_encode_short_integer.c,v $ */
96
 
/* $Revision: 1.3 $ */
97
 
/* $Date: 2005/05/23 01:27:03 $ */
 
96
/* $Revision: 1.7 $ */
 
97
/* $Date: 2006/12/04 21:34:03 $ */