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

« back to all changes in this revision

Viewing changes to libtomcrypt/src/pk/rsa/rsa_export.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:
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
 
27
27
*/    
28
28
int rsa_export(unsigned char *out, unsigned long *outlen, int type, rsa_key *key)
29
29
{
30
 
   int           err;
31
30
   unsigned long zero=0;
32
 
 
33
31
   LTC_ARGCHK(out    != NULL);
34
32
   LTC_ARGCHK(outlen != NULL);
35
33
   LTC_ARGCHK(key    != NULL);
44
42
      /* output is 
45
43
            Version, n, e, d, p, q, d mod (p-1), d mod (q - 1), 1/q mod p
46
44
       */
47
 
      if ((err = der_encode_sequence_multi(out, outlen, 
 
45
      return der_encode_sequence_multi(out, outlen, 
48
46
                          LTC_ASN1_SHORT_INTEGER, 1UL, &zero, 
49
 
                          LTC_ASN1_INTEGER, 1UL, &key->N, 
50
 
                          LTC_ASN1_INTEGER, 1UL, &key->e,
51
 
                          LTC_ASN1_INTEGER, 1UL, &key->d, 
52
 
                          LTC_ASN1_INTEGER, 1UL, &key->p, 
53
 
                          LTC_ASN1_INTEGER, 1UL, &key->q, 
54
 
                          LTC_ASN1_INTEGER, 1UL, &key->dP,
55
 
                          LTC_ASN1_INTEGER, 1UL, &key->dQ, 
56
 
                          LTC_ASN1_INTEGER, 1UL, &key->qP, 
57
 
                          LTC_ASN1_EOL,     0UL, NULL)) != CRYPT_OK) {
58
 
         return err;
59
 
      }
60
 
 
61
 
      /* clear zero and return */
62
 
      return CRYPT_OK;
 
47
                          LTC_ASN1_INTEGER, 1UL,  key->N, 
 
48
                          LTC_ASN1_INTEGER, 1UL,  key->e,
 
49
                          LTC_ASN1_INTEGER, 1UL,  key->d, 
 
50
                          LTC_ASN1_INTEGER, 1UL,  key->p, 
 
51
                          LTC_ASN1_INTEGER, 1UL,  key->q, 
 
52
                          LTC_ASN1_INTEGER, 1UL,  key->dP,
 
53
                          LTC_ASN1_INTEGER, 1UL,  key->dQ, 
 
54
                          LTC_ASN1_INTEGER, 1UL,  key->qP, 
 
55
                          LTC_ASN1_EOL,     0UL, NULL);
63
56
   } else {
64
57
      /* public key */
65
58
      return der_encode_sequence_multi(out, outlen, 
66
 
                                 LTC_ASN1_INTEGER, 1UL, &key->N, 
67
 
                                 LTC_ASN1_INTEGER, 1UL, &key->e, 
 
59
                                 LTC_ASN1_INTEGER, 1UL,  key->N, 
 
60
                                 LTC_ASN1_INTEGER, 1UL,  key->e, 
68
61
                                 LTC_ASN1_EOL,     0UL, NULL);
69
62
   }
70
63
}
72
65
#endif /* MRSA */
73
66
 
74
67
/* $Source: /cvs/libtom/libtomcrypt/src/pk/rsa/rsa_export.c,v $ */
75
 
/* $Revision: 1.11 $ */
76
 
/* $Date: 2005/06/04 01:42:48 $ */
 
68
/* $Revision: 1.15 $ */
 
69
/* $Date: 2006/03/31 14:15:35 $ */