Mercurial > dropbear
annotate libtommath/bn_mp_init_set_int.c @ 1147:809feaa9408f DROPBEAR_2015.68
changelog and version 2015.68
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 08 Aug 2015 20:35:28 +0800 |
parents | 5ff8218bcee9 |
children | 60fc6476e044 |
rev | line source |
---|---|
284
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
1 #include <tommath.h> |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
2 #ifdef BN_MP_INIT_SET_INT_C |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
4 * |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
5 * LibTomMath is a library that provides multiple-precision |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
6 * integer arithmetic as well as number theoretic functionality. |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
7 * |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
8 * The library was designed directly after the MPI library by |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
9 * Michael Fromberger but has been written from scratch with |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
10 * additional optimizations in place. |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
11 * |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
12 * The library is free for all purposes without any express |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
13 * guarantee it works. |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
14 * |
389
5ff8218bcee9
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 2af95f00ebd5bb7a28b3817db1218442c935388e)
Matt Johnston <matt@ucc.asn.au>
parents:
284
diff
changeset
|
15 * Tom St Denis, [email protected], http://math.libtomcrypt.com |
284
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
16 */ |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
17 |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
18 /* initialize and set a digit */ |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
19 int mp_init_set_int (mp_int * a, unsigned long b) |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
20 { |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
21 int err; |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
22 if ((err = mp_init(a)) != MP_OKAY) { |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
23 return err; |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
24 } |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
25 return mp_set_int(a, b); |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
26 } |
eed26cff980b
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 6c790cad5a7fa866ad062cb3a0c279f7ba788583)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
27 #endif |
389
5ff8218bcee9
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 2af95f00ebd5bb7a28b3817db1218442c935388e)
Matt Johnston <matt@ucc.asn.au>
parents:
284
diff
changeset
|
28 |
5ff8218bcee9
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 2af95f00ebd5bb7a28b3817db1218442c935388e)
Matt Johnston <matt@ucc.asn.au>
parents:
284
diff
changeset
|
29 /* $Source: /cvs/libtom/libtommath/bn_mp_init_set_int.c,v $ */ |
5ff8218bcee9
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 2af95f00ebd5bb7a28b3817db1218442c935388e)
Matt Johnston <matt@ucc.asn.au>
parents:
284
diff
changeset
|
30 /* $Revision: 1.3 $ */ |
5ff8218bcee9
propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 2af95f00ebd5bb7a28b3817db1218442c935388e)
Matt Johnston <matt@ucc.asn.au>
parents:
284
diff
changeset
|
31 /* $Date: 2006/03/31 14:18:44 $ */ |