Merge pull request #133 from libtom/pr/msvc-fixes Fixes for #131 + #132 (MSVC related)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
diff --git a/.gitignore b/.gitignore
index 20e85c3..d5a7b5b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,25 @@ mtest.exe
# ignore user specific settings
*.user
*.suo
+*.userosscache
+*.sln.docstates
+*.userprefs
+# cache/options directory
+.vs/
+# Backup & report files from converting an old project file to a newer Visual Studio version
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+# Visual Studio 6 build log + workspace options file
+*.plg
+*.opt
+# visual studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
# ignore stuff generated by "make manual" and "make poster"
*.aux
diff --git a/bn_mp_exptmod_fast.c b/bn_mp_exptmod_fast.c
old mode 100644
new mode 100755
index 0d01e38..a63ebd5
--- a/bn_mp_exptmod_fast.c
+++ b/bn_mp_exptmod_fast.c
@@ -165,15 +165,15 @@ int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y
}
/* compute the value at M[1<<(winsize-1)] by squaring M[1] (winsize-1) times */
- if ((err = mp_copy(&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) {
+ if ((err = mp_copy(&M[1], &M[(size_t)1 << (winsize - 1)])) != MP_OKAY) {
goto LBL_RES;
}
for (x = 0; x < (winsize - 1); x++) {
- if ((err = mp_sqr(&M[1 << (winsize - 1)], &M[1 << (winsize - 1)])) != MP_OKAY) {
+ if ((err = mp_sqr(&M[(size_t)1 << (winsize - 1)], &M[(size_t)1 << (winsize - 1)])) != MP_OKAY) {
goto LBL_RES;
}
- if ((err = redux(&M[1 << (winsize - 1)], P, mp)) != MP_OKAY) {
+ if ((err = redux(&M[(size_t)1 << (winsize - 1)], P, mp)) != MP_OKAY) {
goto LBL_RES;
}
}
diff --git a/bn_s_mp_exptmod.c b/bn_s_mp_exptmod.c
index f84da21..52a6422 100644
--- a/bn_s_mp_exptmod.c
+++ b/bn_s_mp_exptmod.c
@@ -99,19 +99,19 @@ int s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, i
/* compute the value at M[1<<(winsize-1)] by squaring
* M[1] (winsize-1) times
*/
- if ((err = mp_copy(&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) {
+ if ((err = mp_copy(&M[1], &M[(size_t)1 << (winsize - 1)])) != MP_OKAY) {
goto LBL_MU;
}
for (x = 0; x < (winsize - 1); x++) {
/* square it */
- if ((err = mp_sqr(&M[1 << (winsize - 1)],
- &M[1 << (winsize - 1)])) != MP_OKAY) {
+ if ((err = mp_sqr(&M[(size_t)1 << (winsize - 1)],
+ &M[(size_t)1 << (winsize - 1)])) != MP_OKAY) {
goto LBL_MU;
}
/* reduce modulo P */
- if ((err = redux(&M[1 << (winsize - 1)], P, &mu)) != MP_OKAY) {
+ if ((err = redux(&M[(size_t)1 << (winsize - 1)], P, &mu)) != MP_OKAY) {
goto LBL_MU;
}
}
diff --git a/libtommath_VS2008.sln b/libtommath_VS2008.sln
index c592fe0..6bfc159 100644
--- a/libtommath_VS2008.sln
+++ b/libtommath_VS2008.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtommath", "libtommath_VS2008.vcproj", "{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tommath", "libtommath_VS2008.vcproj", "{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -23,4 +23,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {83B84178-7B4F-4B78-9C5D-17B8201D5B61}
+ EndGlobalSection
EndGlobal
diff --git a/libtommath_VS2008.vcproj b/libtommath_VS2008.vcproj
index 98e2be4..26429c9 100644
--- a/libtommath_VS2008.vcproj
+++ b/libtommath_VS2008.vcproj
@@ -2,9 +2,9 @@
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
- Name="libtommath"
+ Name="tommath"
ProjectGUID="{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}"
- RootNamespace="libtommath"
+ RootNamespace="tommath"
TargetFrameworkVersion="0"
>
<Platforms>
@@ -37,9 +37,6 @@
Name="VCXMLDataGeneratorTool"
/>
<Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
Name="VCMIDLTool"
/>
<Tool
@@ -73,7 +70,7 @@
/>
<Tool
Name="VCLibrarianTool"
- OutputFile="$(OutDir)\tommathd.lib"
+ OutputFile="$(OutDir)\tommath.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -85,7 +82,7 @@
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
- OutputFile="$(OutDir)\libtommath.bsc"
+ OutputFile="$(OutDir)\tommath.bsc"
/>
<Tool
Name="VCFxCopTool"
@@ -113,9 +110,6 @@
Name="VCXMLDataGeneratorTool"
/>
<Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
@@ -150,7 +144,7 @@
/>
<Tool
Name="VCLibrarianTool"
- OutputFile="$(OutDir)\tommathd.lib"
+ OutputFile="$(OutDir)\tommath.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -162,7 +156,7 @@
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
- OutputFile="$(OutDir)\libtommath.bsc"
+ OutputFile="$(OutDir)\tommath.bsc"
/>
<Tool
Name="VCFxCopTool"
@@ -190,9 +184,6 @@
Name="VCXMLDataGeneratorTool"
/>
<Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
Name="VCMIDLTool"
/>
<Tool
@@ -236,7 +227,7 @@
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
- OutputFile="$(OutDir)\libtommath.bsc"
+ OutputFile="$(OutDir)\tommath.bsc"
/>
<Tool
Name="VCFxCopTool"
@@ -264,9 +255,6 @@
Name="VCXMLDataGeneratorTool"
/>
<Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
@@ -311,7 +299,7 @@
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
- OutputFile="$(OutDir)\libtommath.bsc"
+ OutputFile="$(OutDir)\tommath.bsc"
/>
<Tool
Name="VCFxCopTool"