comparison src/pk/rsa/rsa_exptmod.c @ 210:4768b55c5240 libtomcrypt

propagate from branch 'au.asn.ucc.matt.ltc-orig' (head 33c416b902f1a44913d825bae7ad9a160f703ed3) to branch 'au.asn.ucc.matt.dropbear.ltc' (head 4d6aec6e6121e13f68c11c149b6579c41cb63e74)
author Matt Johnston <matt@ucc.asn.au>
date Wed, 06 Jul 2005 12:10:23 +0000
parents 39d5d58461d6
children
comparison
equal deleted inserted replaced
199:8be64e2c86f4 210:4768b55c5240
84 x = (unsigned long)mp_unsigned_bin_size(&key->N); 84 x = (unsigned long)mp_unsigned_bin_size(&key->N);
85 if (x > *outlen) { 85 if (x > *outlen) {
86 err = CRYPT_BUFFER_OVERFLOW; 86 err = CRYPT_BUFFER_OVERFLOW;
87 goto done; 87 goto done;
88 } 88 }
89
90 /* this should never happen ... */
91 if (mp_unsigned_bin_size(&tmp) > mp_unsigned_bin_size(&key->N)) {
92 err = CRYPT_ERROR;
93 goto done;
94 }
89 *outlen = x; 95 *outlen = x;
90 96
91 /* convert it */ 97 /* convert it */
92 zeromem(out, x); 98 zeromem(out, x);
93 if ((err = mp_to_unsigned_bin(&tmp, out+(x-mp_unsigned_bin_size(&tmp)))) != MP_OKAY) { goto error; } 99 if ((err = mp_to_unsigned_bin(&tmp, out+(x-mp_unsigned_bin_size(&tmp)))) != MP_OKAY) { goto error; }
101 mp_clear_multi(&tmp, &tmpa, &tmpb, NULL); 107 mp_clear_multi(&tmp, &tmpa, &tmpb, NULL);
102 return err; 108 return err;
103 } 109 }
104 110
105 #endif 111 #endif
112
113 /* $Source: /cvs/libtom/libtomcrypt/src/pk/rsa/rsa_exptmod.c,v $ */
114 /* $Revision: 1.4 $ */
115 /* $Date: 2005/06/23 02:10:22 $ */