2 * Copyright (c) 1997-1999 The Stanford SRP Authentication Project
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
18 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
20 * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
21 * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
22 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
23 * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
24 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26 * In addition, the following conditions apply:
28 * 1. Any software that incorporates the SRP authentication technology
29 * must display the following acknowlegment:
30 * "This product uses the 'Secure Remote Password' cryptographic
31 * authentication system developed by Tom Wu (tjw@CS.Stanford.EDU)."
33 * 2. Any software that incorporates all or part of the SRP distribution
34 * itself must also display the following acknowledgment:
35 * "This product includes software developed by Tom Wu and Eugene
36 * Jhong for the SRP Distribution (http://srp.stanford.edu/srp/)."
38 * 3. Redistributions in source or binary form must retain an intact copy
39 * of this copyright notice and list of conditions.
46 #if defined(__STDC__) || defined(__cplusplus)
55 #endif /* HAVE_CONFIG_H */
60 #ifdef MSVC15 /* MSVC1.5 support for 16 bit apps */
61 #define _MSVC15EXPORT _export
63 #define _DLLAPI _export _pascal
64 #define _TYPE(a) a _MSVC15EXPORT
69 #define _MSVC20EXPORT _declspec(dllexport)
71 #define _TYPE(a) _MSVC20EXPORT a
74 #else /* Default, non-dll. Use this for Unix or DOS */
75 #define _MSVC15DEXPORT
85 #else /* not STDC_HEADERS */
88 #define strrchr rindex
90 char *strchr(), *strrchr(), *strtok();
92 #define memcpy(d, s, n) bcopy((s), (d), (n))
94 #endif /* not STDC_HEADERS */
96 #include <sys/types.h>
98 #if TIME_WITH_SYS_TIME
101 #else /* not TIME_WITH_SYS_TIME */
103 #include <sys/time.h>
107 #endif /* not TIME_WITH_SYS_TIME */
111 #define STTY(fd, termio) tcsetattr(fd, TCSANOW, termio)
112 #define GTTY(fd, termio) tcgetattr(fd, termio)
113 #define TERMIO struct termios
116 #include <sys/ioctl.h>
118 #define STTY(fd, termio) ioctl(fd, TCSETA, termio)
119 #define GTTY(fd, termio) ioctl(fd, TCGETA, termio)
120 #define TEMRIO struct termio
124 #define STTY(fd, termio) stty(fd, termio)
125 #define GTTY(fd, termio) gtty(fd, termio)
126 #define TERMIO struct sgttyb
131 #include <sys/timeb.h>
135 typedef void * BigInteger
;
138 _TYPE( BigInteger
) BigIntegerFromInt
P((unsigned int number
));
139 _TYPE( BigInteger
) BigIntegerFromBytes
P((unsigned char * bytes
, int length
));
140 _TYPE( int ) BigIntegerToBytes
P((BigInteger src
, unsigned char * dest
));
141 _TYPE( int ) BigIntegerBitLen
P((BigInteger b
));
142 _TYPE( int ) BigIntegerCmp
P((BigInteger c1
, BigInteger c2
));
143 _TYPE( int ) BigIntegerCmpInt
P((BigInteger c1
, unsigned int c2
));
144 _TYPE( void ) BigIntegerLShift
P((BigInteger result
, BigInteger x
,
146 _TYPE( void ) BigIntegerAdd
P((BigInteger result
, BigInteger a1
, BigInteger a2
));
147 _TYPE( void ) BigIntegerAddInt
P((BigInteger result
,
148 BigInteger a1
, unsigned int a2
));
149 _TYPE( void ) BigIntegerSub
P((BigInteger result
, BigInteger s1
, BigInteger s2
));
150 _TYPE( void ) BigIntegerSubInt
P((BigInteger result
,
151 BigInteger s1
, unsigned int s2
));
152 /* For BigIntegerMul{,Int}: result != m1, m2 */
153 _TYPE( void ) BigIntegerMul
P((BigInteger result
, BigInteger m1
, BigInteger m2
));
154 _TYPE( void ) BigIntegerMulInt
P((BigInteger result
,
155 BigInteger m1
, unsigned int m2
));
156 _TYPE( void ) BigIntegerDivInt
P((BigInteger result
,
157 BigInteger d
, unsigned int m
));
158 _TYPE( void ) BigIntegerMod
P((BigInteger result
, BigInteger d
, BigInteger m
));
159 _TYPE( unsigned int ) BigIntegerModInt
P((BigInteger d
, unsigned int m
));
160 _TYPE( void ) BigIntegerModMul
P((BigInteger result
,
161 BigInteger m1
, BigInteger m2
, BigInteger m
));
162 _TYPE( void ) BigIntegerModExp
P((BigInteger result
, BigInteger base
,
163 BigInteger expt
, BigInteger modulus
));
164 _TYPE( void ) BigIntegerModExpInt
P((BigInteger result
, BigInteger base
,
165 unsigned int expt
, BigInteger modulus
));
166 _TYPE( int ) BigIntegerCheckPrime
P((BigInteger n
));
167 _TYPE( void ) BigIntegerFree
P((BigInteger b
));
This page took 0.048747 seconds and 5 git commands to generate.