From dcce727d32aec1f557bcb717e8219ee45cfc4582 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 10 Aug 2017 14:29:11 +0000 Subject: Release candidate branch for Tcl 8.7a1. --- README | 2 +- generic/tcl.h | 4 ++-- library/init.tcl | 2 +- unix/configure | 2 +- unix/configure.ac | 2 +- win/configure | 2 +- win/configure.ac | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README b/README index aab0db5..59de34d 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ README: Tcl - This is the Tcl 8.7a0 source distribution. + This is the Tcl 8.7a1 source distribution. http://sourceforge.net/projects/tcl/files/Tcl/ You can get any source release of Tcl from the URL above. diff --git a/generic/tcl.h b/generic/tcl.h index 6fa26f9..2e9d60a 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -55,10 +55,10 @@ extern "C" { #define TCL_MAJOR_VERSION 8 #define TCL_MINOR_VERSION 7 #define TCL_RELEASE_LEVEL TCL_ALPHA_RELEASE -#define TCL_RELEASE_SERIAL 0 +#define TCL_RELEASE_SERIAL 1 #define TCL_VERSION "8.7" -#define TCL_PATCH_LEVEL "8.7a0" +#define TCL_PATCH_LEVEL "8.7a1" #if !defined(TCL_NO_DEPRECATED) || defined(RC_INVOKED) /* diff --git a/library/init.tcl b/library/init.tcl index ece1e44..b6e6e8b 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -16,7 +16,7 @@ if {[info commands package] == ""} { error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]" } -package require -exact Tcl 8.7a0 +package require -exact Tcl 8.7a1 # Compute the auto path to use in this interpreter. # The values on the path come from several locations: diff --git a/unix/configure b/unix/configure index a9132b57..0b22a43 100755 --- a/unix/configure +++ b/unix/configure @@ -2325,7 +2325,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a0" +TCL_PATCH_LEVEL="a1" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/unix/configure.ac b/unix/configure.ac index b43da6d..d7aa50f 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -25,7 +25,7 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [ TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a0" +TCL_PATCH_LEVEL="a1" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/win/configure b/win/configure index d0431cb..a47ff23 100755 --- a/win/configure +++ b/win/configure @@ -2102,7 +2102,7 @@ SHELL=/bin/sh TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a0" +TCL_PATCH_LEVEL="a1" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 diff --git a/win/configure.ac b/win/configure.ac index 2821bc3..e32dadc 100644 --- a/win/configure.ac +++ b/win/configure.ac @@ -14,7 +14,7 @@ SHELL=/bin/sh TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a0" +TCL_PATCH_LEVEL="a1" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 -- cgit v0.12 From e339740a29aa9b5c81844f173a01b4a4dcfdfd9b Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 10 Aug 2017 14:56:23 +0000 Subject: Bring changes up to the 8.6.7 release. --- changes | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/changes b/changes index 1e24269..f98eafc 100644 --- a/changes +++ b/changes @@ -8624,3 +8624,174 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2016-02-22 (bug)[9b4702] [info exists env(missing)] kills trace (nijtmans) --- Released 8.6.5, February 29, 2016 --- http://core.tcl.tk/tcl/ for details + +2016-03-01 (bug)[803042] mem leak due to reference cycle (porter) + +2016-03-08 (bug)[bbc304] reflected watch race condition (porter) + +2016-03-17 (bug)[fadc99] compile-5.3 (rodriguez,porter) + +2016-03-17 (enhancement)[1a25fd] compile [variable ${ns}::v] (porter) + +2016-03-20 (bug)[1af8de] crash in compiled [string replace] (harder,fellows) + +2016-03-21 (bug)[d30718] segv in notifier finalize (hirofumi,nijtmans) + +2016-03-23 (enhancement)[7d0db7] parallel make (yarda,nijtmans) + +2016-03-23 [f12535] enable test bindings customization (vogel,nijtmans) + +2016-04-04 (bug)[47ac84] compiled [lreplace] fixes (aspect,ferrieux,fellows) + *** POTENTIAL INCOMPATIBILITY *** + +2016-04-08 (bug)[866368] RE \w includes 'Punctuation Connector' (nijtmans) + +2016-04-08 (bug)[2538f3] Win crash Tcl_OpenTcpServer() (griffin) + +2016-04-10 [07d13d] Restore TclBlend support lost in 8.6.1 (buratti) + +2016-05-13 (bug)[3154ea] Mem corruption in assembler exceptions (tkob,kenny) + +2016-05-13 (bug) registry package support any Unicode env (nijtmans) +=> registry 1.3.2 + +2016-05-21 (bug)[f7d4e] [namespace delete] performance (fellows) + +2016-06-02 (TIP 447) execution time verbosity option (cerutti) +=> tcltest 2.4.0 + +2016-06-16 (bug)[16828b] crash due to [vwait] trace undo fail (dah,porter) + +2016-06-16 (enhancement)[4b61af] good [info frame] from more cases (beric) + +2016-06-21 (bug)[c383eb] crash in [glob -path a] (oehlmann,porter) + +2016-06-21 (update) Update Unicode data to 9.0 (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2016-06-22 (bug)[16896d] Tcl_DString tolerate append to self. (dah,porter) + +2016-06-23 (bug)[d55322] crash in [dict update] (yorick,fellows) + +2016-06-27 (bug)[dd260a] crash in [chan configure -dictionary] (madden,aspect) + +2016-07-02 (bug)[f961d7] usage message with parameters with spaces (porter) + *** POTENTIAL INCOMPATIBILITY *** + +2016-07-02 (enhancement)[09fabc] Sort order of -relateddir (lanam) + +2016-07-07 (bug)[5d7ca0] Win: [file executable] for .cmd and .ps1 (nadkarni) + *** POTENTIAL INCOMPATIBILITY *** + +2016-07-08 (bug)[a47641] [file normalize] & Windows junctions (nadkarni) + +2016-07-09 [ae61a6] [file] handling of Win hardcoded names (CON) (nadkarni) + *** POTENTIAL INCOMPATIBILITY *** + +2016-07-09 [3613671] [file owned] (more) useful on Win (nadkarni) + +2016-07-09 (bug)[1493a4] [namespace upvar] use of resolvers (beric,fellows) + *** POTENTIAL INCOMPATIBILITY *** + +2016-07-10 (bug)[da340d] integer division in clock math (nadkarni) + +2016-07-20 tzdata updated to Olson's tzdata2016f (venkat) + +--- Released 8.6.6, July 27, 2016 --- http://core.tcl.tk/tcl/ for details + +2016-09-07 (bug)[c09edf] Bad caching with custom resolver (neumann,nijtmans) + +2016-09-07 (bug)[4dbdd9] Memleak in test var-8.3 (mr_calvin,porter) + +2016-10-03 (bug)[2bf561] Allow empty command as alias target (yorick,nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2016-10-04 (bug)[4d5ae7] Crash in async connects host no address (gahr,fellows) + +2016-10-08 (bug)[838e99] treat application/xml as text (gahr,fellows) +=> http 2.8.10 + +2016-10-11 (bug)[3cc1d9] Thread finalization crash in zippy (neumann) + +2016-10-12 (bug)[be003d] Fix [scan 0x1 %b], [scan 0x1 %o] (porter) + +2016-10-14 (bug)[eb6b68] Fix stringComp-14.5 (porter) + +2016-10-30 (bug)[b26e38] Fix zlib-7.8 (fellows) + +2016-10-30 (bug)[1ae129] Fix memleak in [history] destruction (fellows) + +2016-11-04 (feature) Provisional Tcl 9 support in msgcat and tcltest (nijtmans) +=> msgcat 1.6.1 +=> tcltest 2.4.1 + +2016-11-04 (bug)[824752] Crash in Tcl_ListObjReplace() (gahr,porter) + +2016-11-11 (bug)[79614f] invalidate VFS mounts on sytem encoding change (yorick) + +2016-11-14 OSX: End panic() as legacy support macro; system conflicts (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2016-11-15 (bug) TclOO fix stops crash mixing Itcl and snit (fellows) + +2016-11-17 (update) Reconcile libtommath updates; purge unused files (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-01-09 (bug)[b87ad7] Repair drifts in timer clock (sebres) + +2017-01-17 (update) => zlib 1.2.11 (nijtmans) + +2017-01-31 (bug)[39f630] Revise Tcl_LinkVar to tolerate some prefixes (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-02-01 (bug)[d0f7ba] Improper NAN optimization. expr-22.1[01] (aspect) + +2017-02-26 (bug)[25842c] zlib stream finalization (aspect) + +2017-03-07 (deprecate) Remove unmaintained makefile.bc file (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-03-14 (enhancement) [clock] and [encoding] are now ensembles (kenny) + +2017-03-15 (enhancement) several [clock] subcommands bytecoded (kenny) + +2017-03-23 tzdata updated to Olson's tzdata2017b (jima) + +2017-03-29 (bug)[900cb0] Fix OO unexport introspection (napier) + +2017-04-12 (bug)[42202b] Nesting imbalance in coro injection (nadkarni,sebres) + +2017-04-18 (bug)[bc4322] http package support for safe interps (nash,nijtmans) + +2017-04-28 (bug)[f34cf8] [file join a //b] => /b (neumann,porter) + +2017-05-01 (bug)[8bd13f] Windows threads and pipes (sebres,nijtmans) + +2017-05-01 (bug)[f9fe90] [file join //a b] EIAS violation (aspect,porter) + +2017-05-04 (bug) Make test filesystem-1.52 pass on Windows (nijtmans) + +2017-05-05 (bug)[601522] [binary] field spec overflow -> segfault (porter) + +2017-05-08 (bug)[6ca52a] http memleak handling keep-alive (aspect,nijtmans) +=> http 2.8.11 + +2017-05-29 (bug)[a3fb33] crash in [lsort] on long lists (sebres) + +2017-06-05 (bug)[67aa9a] Tcl_UtfToUniChar() revised handling invalid UTF-8 (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-06-08 (bug)[2738427] Tcl_NumUtfChars() corner case utf-4.9 (nijtmans) + +2017-06-22 (update) Update Unicode data to 10.0 (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-06-22 (TIP 473) Let [oo::copy] specify target namespace (fellows) + +2017-06-26 (bug)[46f801] Repair autoloader fragility (porter) + +2017-07-06 (bug)[adb198] Plug memleak in TclJoinPath (sebres,porter) + +2017-07-17 (bug)[fb2208] Repeatable tclIndex generation (wiedemann,nijtmans) + +--- Released 8.6.7, August 9, 2017 --- http://core.tcl.tk/tcl/ for details -- cgit v0.12 From 0ec3676ad3de0d927622af230e5febc9ca673e20 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 10 Aug 2017 17:34:31 +0000 Subject: Update outdated comment. --- generic/tclPkg.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 3b0554a..eb4dc9b 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -331,8 +331,8 @@ Tcl_PkgRequireEx( * * Second, how does this work? If we reach this point, then the global * variable tclEmptyStringRep has the value NULL. Compare that with - * the definition of tclEmptyStringRep near the top of the file - * generic/tclObj.c. It clearly should not have the value NULL; it + * the definition of tclEmptyStringRep near the top of this file. + * It clearly should not have the value NULL; it * should point to the char tclEmptyString. If we see it having the * value NULL, then somehow we are seeing a Tcl library that isn't * completely initialized, and that's an indicator for the error @@ -348,18 +348,11 @@ Tcl_PkgRequireEx( * After all, two Tcl libraries can't be a good thing!) * * Trouble is that's going to be tricky. We're now using a Tcl library - * that's not fully initialized. In particular, it doesn't have a - * proper value for tclEmptyStringRep. The Tcl_Obj system heavily - * depends on the value of tclEmptyStringRep and all of Tcl depends - * (increasingly) on the Tcl_Obj system, we need to correct that flaw - * before making the calls to set the interpreter result to the error - * message. That's the only flaw corrected; other problems with - * initialization of the Tcl library are not remedied, so be very - * careful about adding any other calls here without checking how they - * behave when initialization is incomplete. + * that's not fully initialized. Functions in it may not work + * reliably, so be very careful about adding any other calls here + * without checking how they behave when initialization is incomplete. */ - tclEmptyStringRep = &tclEmptyString; Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Cannot load package \"%s\" in standalone executable:" " This package is not compiled with stub support", name)); -- cgit v0.12 From 38b319739dd65940f0c634509f00ad6dc5cb98de Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 10 Aug 2017 19:14:15 +0000 Subject: Add 8.7 -only changes to the changes file. --- changes | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/changes b/changes index f98eafc..7b035fb 100644 --- a/changes +++ b/changes @@ -8795,3 +8795,44 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2017-07-17 (bug)[fb2208] Repeatable tclIndex generation (wiedemann,nijtmans) --- Released 8.6.7, August 9, 2017 --- http://core.tcl.tk/tcl/ for details + +2016-03-17 (bug)[0b8c38] socket accept callbacks always in global ns (porter) + *** POTENTIAL INCOMPATIBILITY *** + +2016-07-01 Hack accommodations for legacy Itcl 3 disabled (porter) + +2016-07-12 Make TCL_HASH_TYPE build-time configurable (nijtmans) + +2016-07-19 (bug)[0363f0] Partial array search ID reform (porter) + +2016-07-19 (feature removed) Tcl_ObjType "array search" unregistered (porter) + *** POTENTIAL INCOMPATIBILITY for Tcl_GetObjType("array search") *** + +2016-10-04 Server socket on port 0 chooses port supporting IPv4 * IPv6 (max) + +2016-11-25 [array named -regexp] supports backrefs (goth) + +2017-01-04 (TIP 456) New routine Tcl_OpenTcpServerEx() (limeboy) + +2017-01-04 (TIP 459) New subcommand [package files] (nijtmans) + +2017-01-16 threaded allocator initialization repair (vasiljevic,nijtmans) + +2017-01-30 Add to Win shell builtins: assoc ftype move (ashok) + +2017-03-31 TCL_MEM_DEBUG facilities better support 64-bit memory (nijtmans) + +2017-04-13 \u escaped content in msg files converted to true utf-8 (nijtmans) + +2017-05-18 (TIP 458) New epoll or kqueue notifiers are default (alborboz) + +2017-05-31 Purge build support for SunOS-4.* (stu) + +2017-06-22 (TIP 463) New option [regsub ... -command ...] (fellows) + +2017-06-22 (TIP 470) Tcl_GetDefineContextObject();[oo::define [self]] (fellows) +=> TclOO 1.2.0 + +2017-06-23 (TIP 472) Support 0d as prefix of decimal numbers (iyer,griffin) + +--- Released 8.7a1, August ??, 2017 --- http://core.tcl.tk/tcl/ for details -- cgit v0.12 From 176661769ec1b78bbe6debfc8f986b7cd7f21734 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 5 Sep 2017 15:38:02 +0000 Subject: update changes --- changes | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/changes b/changes index d1e6417..5cc49ea 100644 --- a/changes +++ b/changes @@ -8838,4 +8838,6 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2017-08-31 (bug)[2a9465] http state 100 continue handling broken (oehlmann) => http 2.8.12 ---- Released 8.7a1, August ??, 2017 --- http://core.tcl.tk/tcl/ for details +2017-09-02 (bug)[0e4d88] replace command, delete trace kills namespace (porter) + +--- Released 8.7a1, September 8, 2017 --- http://core.tcl.tk/tcl/ for details -- cgit v0.12 From 48ce21e3a9c2c9da4e4674bf08275e378629a0e3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 6 Sep 2017 15:02:24 +0000 Subject: Fix use of "long long" (manually) in MSVC --- generic/tclTomMath.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 39132ed..508fadd 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -277,13 +277,19 @@ int mp_set_long_long(mp_int *a, unsigned long long b); */ /* get a 32-bit value */ -unsigned long mp_get_int(mp_int * a); +/* +unsigned long mp_get_int(const mp_int * a); +*/ /* get a platform dependent unsigned long value */ -unsigned long mp_get_long(mp_int * a); +/* +unsigned long mp_get_long(const mp_int * a); +*/ /* get a platform dependent unsigned long long value */ -unsigned long long mp_get_long_long(mp_int * a); +/* +unsigned long long mp_get_long_long(const mp_int * a); +*/ /* initialize and set a digit */ /* @@ -339,7 +345,7 @@ int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d); /* b = a/2 */ /* -int mp_div_2(mp_int *a, mp_int *b); +int mp_div_2(const mp_int *a, mp_int *b); */ /* c = a * 2**b, implemented as c = a << b */ @@ -349,7 +355,7 @@ int mp_mul_2d(const mp_int *a, int b, mp_int *c); /* b = a*2 */ /* -int mp_mul_2(mp_int *a, mp_int *b); +int mp_mul_2(const mp_int *a, mp_int *b); */ /* c = a mod 2**b */ @@ -801,7 +807,7 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream); #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ -- cgit v0.12 From b9ae4bcae4f10a98c180b3a951f58c8a5ac03f8e Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 8 Sep 2017 13:13:15 +0000 Subject: Bump to 8.7a2 to distinguish trunk from 8.7a1 release. --- README | 2 +- generic/tcl.h | 4 ++-- library/init.tcl | 2 +- unix/configure | 2 +- unix/configure.ac | 2 +- win/configure | 2 +- win/configure.ac | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README b/README index 59de34d..322666a 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ README: Tcl - This is the Tcl 8.7a1 source distribution. + This is the Tcl 8.7a2 source distribution. http://sourceforge.net/projects/tcl/files/Tcl/ You can get any source release of Tcl from the URL above. diff --git a/generic/tcl.h b/generic/tcl.h index 589a63f..07d841d 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -55,10 +55,10 @@ extern "C" { #define TCL_MAJOR_VERSION 8 #define TCL_MINOR_VERSION 7 #define TCL_RELEASE_LEVEL TCL_ALPHA_RELEASE -#define TCL_RELEASE_SERIAL 1 +#define TCL_RELEASE_SERIAL 2 #define TCL_VERSION "8.7" -#define TCL_PATCH_LEVEL "8.7a1" +#define TCL_PATCH_LEVEL "8.7a2" #if !defined(TCL_NO_DEPRECATED) || defined(RC_INVOKED) /* diff --git a/library/init.tcl b/library/init.tcl index b6e6e8b..e361645 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -16,7 +16,7 @@ if {[info commands package] == ""} { error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]" } -package require -exact Tcl 8.7a1 +package require -exact Tcl 8.7a2 # Compute the auto path to use in this interpreter. # The values on the path come from several locations: diff --git a/unix/configure b/unix/configure index 0b22a43..129c283 100755 --- a/unix/configure +++ b/unix/configure @@ -2325,7 +2325,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a1" +TCL_PATCH_LEVEL="a2" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/unix/configure.ac b/unix/configure.ac index d7aa50f..e14d85e 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -25,7 +25,7 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [ TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a1" +TCL_PATCH_LEVEL="a2" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/win/configure b/win/configure index a47ff23..fdd3adb 100755 --- a/win/configure +++ b/win/configure @@ -2102,7 +2102,7 @@ SHELL=/bin/sh TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a1" +TCL_PATCH_LEVEL="a2" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 diff --git a/win/configure.ac b/win/configure.ac index e32dadc..d03695c 100644 --- a/win/configure.ac +++ b/win/configure.ac @@ -14,7 +14,7 @@ SHELL=/bin/sh TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a1" +TCL_PATCH_LEVEL="a2" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 -- cgit v0.12 From 86eedd9ac8aa6c202c941fe08d1ec6fd255f422f Mon Sep 17 00:00:00 2001 From: gahr Date: Fri, 8 Sep 2017 13:30:29 +0000 Subject: Be consistent about how I am referred to. --- changes | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changes b/changes index 5cc49ea..ec8beb1 100644 --- a/changes +++ b/changes @@ -8234,7 +8234,7 @@ Dropped support for OS X versions less than 10.4 (Tiger) (fellows) 2013-05-16 (platform support) mingw-4.0 (nijtmans) -2013-05-19 (platform support) FreeBSD updates (cerutti) +2013-05-19 (platform support) FreeBSD updates (gahr) 2013-05-20 (bug fix)[3613567] access error temp file creation (keene) @@ -8657,7 +8657,7 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2016-05-21 (bug)[f7d4e] [namespace delete] performance (fellows) -2016-06-02 (TIP 447) execution time verbosity option (cerutti) +2016-06-02 (TIP 447) execution time verbosity option (gahr) => tcltest 2.4.0 2016-06-16 (bug)[16828b] crash due to [vwait] trace undo fail (dah,porter) -- cgit v0.12 From 72cd4c6a0763c30b3f3a4fceb1ed78ad63711cb5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 8 Sep 2017 14:15:13 +0000 Subject: Add some more functions from libtommath for availability within Tcl (mainly the 'long long' variants). Add more 'const' keywords there too. --- generic/tclStubInit.c | 2 ++ generic/tclTomMath.decls | 11 +++++++++-- generic/tclTomMath.h | 4 ++-- generic/tclTomMathDecls.h | 21 +++++++++++++++++---- libtommath/bn_mp_div_2.c | 2 +- libtommath/bn_mp_get_int.c | 2 +- libtommath/bn_mp_get_long.c | 2 +- libtommath/bn_mp_get_long_long.c | 6 +++--- libtommath/bn_mp_mul_2.c | 2 +- libtommath/bn_mp_set_long_long.c | 2 +- libtommath/tommath.h | 12 ++++++------ unix/Makefile.in | 16 ++++++++++++++-- unix/tcl.spec | 2 +- win/Makefile.in | 3 +++ win/makefile.vc | 3 +++ 15 files changed, 65 insertions(+), 25 deletions(-) diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 8cc21aa..a2f1ed3 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -859,6 +859,8 @@ const TclTomMathStubs tclTomMathStubs = { TclBNInitBignumFromWideInt, /* 65 */ TclBNInitBignumFromWideUInt, /* 66 */ TclBN_mp_expt_d_ex, /* 67 */ + TclBN_mp_set_long_long, /* 68 */ + TclBN_mp_get_long_long, /* 69 */ }; static const TclStubHooks tclStubHooks = { diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls index 74ccefc..c4299d0 100644 --- a/generic/tclTomMath.decls +++ b/generic/tclTomMath.decls @@ -69,7 +69,7 @@ declare 14 { int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *q, mp_digit *r) } declare 15 { - int TclBN_mp_div_2(mp_int *a, mp_int *q) + int TclBN_mp_div_2(const mp_int *a, mp_int *q) } declare 16 { int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r) @@ -117,7 +117,7 @@ declare 30 { int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *p) } declare 31 { - int TclBN_mp_mul_2(mp_int *a, mp_int *p) + int TclBN_mp_mul_2(const mp_int *a, mp_int *p) } declare 32 { int TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p) @@ -237,6 +237,13 @@ declare 66 { declare 67 { int TclBN_mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast) } +# Added in libtommath 1.0.1 +declare 68 { + int TclBN_mp_set_long_long(mp_int *a, Tcl_WideUInt i) +} +declare 69 { + Tcl_WideUInt TclBN_mp_get_long_long(const mp_int *a) +} # Local Variables: # mode: tcl diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 508fadd..7e3c29e 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -273,7 +273,7 @@ int mp_set_long(mp_int *a, unsigned long b); /* set a platform dependent unsigned long long value */ /* -int mp_set_long_long(mp_int *a, unsigned long long b); +int mp_set_long_long(mp_int *a, Tcl_WideUInt b); */ /* get a 32-bit value */ @@ -288,7 +288,7 @@ unsigned long mp_get_long(const mp_int * a); /* get a platform dependent unsigned long long value */ /* -unsigned long long mp_get_long_long(const mp_int * a); +Tcl_WideUInt mp_get_long_long(const mp_int * a); */ /* initialize and set a digit */ diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index 209c486..70de3b1 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -74,6 +74,8 @@ #define mp_exch TclBN_mp_exch #define mp_expt_d TclBN_mp_expt_d #define mp_expt_d_ex TclBN_mp_expt_d_ex +#define mp_get_int TclBN_mp_get_int +#define mp_get_long_long TclBN_mp_get_long_long #define mp_grow TclBN_mp_grow #define mp_init TclBN_mp_init #define mp_init_copy TclBN_mp_init_copy @@ -98,6 +100,7 @@ #define mp_s_rmap TclBNMpSRmap #define mp_set TclBN_mp_set #define mp_set_int TclBN_mp_set_int +#define mp_set_long_long TclBN_mp_set_long_long #define mp_shrink TclBN_mp_shrink #define mp_sqr TclBN_mp_sqr #define mp_sqrt TclBN_mp_sqrt @@ -176,7 +179,7 @@ EXTERN int TclBN_mp_div(mp_int *a, mp_int *b, mp_int *q, EXTERN int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 15 */ -EXTERN int TclBN_mp_div_2(mp_int *a, mp_int *q); +EXTERN int TclBN_mp_div_2(const mp_int *a, mp_int *q); /* 16 */ EXTERN int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r); @@ -209,7 +212,7 @@ EXTERN int TclBN_mp_mul(mp_int *a, mp_int *b, mp_int *p); /* 30 */ EXTERN int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *p); /* 31 */ -EXTERN int TclBN_mp_mul_2(mp_int *a, mp_int *p); +EXTERN int TclBN_mp_mul_2(const mp_int *a, mp_int *p); /* 32 */ EXTERN int TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p); /* 33 */ @@ -292,6 +295,10 @@ EXTERN void TclBNInitBignumFromWideUInt(mp_int *bignum, /* 67 */ EXTERN int TclBN_mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast); +/* 68 */ +EXTERN int TclBN_mp_set_long_long(mp_int *a, Tcl_WideUInt i); +/* 69 */ +EXTERN Tcl_WideUInt TclBN_mp_get_long_long(const mp_int *a); typedef struct TclTomMathStubs { int magic; @@ -312,7 +319,7 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_count_bits) (const mp_int *a); /* 12 */ int (*tclBN_mp_div) (mp_int *a, mp_int *b, mp_int *q, mp_int *r); /* 13 */ int (*tclBN_mp_div_d) (mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */ - int (*tclBN_mp_div_2) (mp_int *a, mp_int *q); /* 15 */ + int (*tclBN_mp_div_2) (const mp_int *a, mp_int *q); /* 15 */ int (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */ int (*tclBN_mp_div_3) (mp_int *a, mp_int *q, mp_digit *r); /* 17 */ void (*tclBN_mp_exch) (mp_int *a, mp_int *b); /* 18 */ @@ -328,7 +335,7 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r); /* 28 */ int (*tclBN_mp_mul) (mp_int *a, mp_int *b, mp_int *p); /* 29 */ int (*tclBN_mp_mul_d) (mp_int *a, mp_digit b, mp_int *p); /* 30 */ - int (*tclBN_mp_mul_2) (mp_int *a, mp_int *p); /* 31 */ + int (*tclBN_mp_mul_2) (const mp_int *a, mp_int *p); /* 31 */ int (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p); /* 32 */ int (*tclBN_mp_neg) (const mp_int *a, mp_int *b); /* 33 */ int (*tclBN_mp_or) (mp_int *a, mp_int *b, mp_int *c); /* 34 */ @@ -365,6 +372,8 @@ typedef struct TclTomMathStubs { void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */ void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */ int (*tclBN_mp_expt_d_ex) (mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */ + int (*tclBN_mp_set_long_long) (mp_int *a, Tcl_WideUInt i); /* 68 */ + Tcl_WideUInt (*tclBN_mp_get_long_long) (const mp_int *a); /* 69 */ } TclTomMathStubs; extern const TclTomMathStubs *tclTomMathStubsPtr; @@ -515,6 +524,10 @@ extern const TclTomMathStubs *tclTomMathStubsPtr; (tclTomMathStubsPtr->tclBNInitBignumFromWideUInt) /* 66 */ #define TclBN_mp_expt_d_ex \ (tclTomMathStubsPtr->tclBN_mp_expt_d_ex) /* 67 */ +#define TclBN_mp_set_long_long \ + (tclTomMathStubsPtr->tclBN_mp_set_long_long) /* 68 */ +#define TclBN_mp_get_long_long \ + (tclTomMathStubsPtr->tclBN_mp_get_long_long) /* 69 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/libtommath/bn_mp_div_2.c b/libtommath/bn_mp_div_2.c index 2b5bb49..0e981a0 100644 --- a/libtommath/bn_mp_div_2.c +++ b/libtommath/bn_mp_div_2.c @@ -16,7 +16,7 @@ */ /* b = a/2 */ -int mp_div_2(mp_int * a, mp_int * b) +int mp_div_2(const mp_int * a, mp_int * b) { int x, res, oldused; diff --git a/libtommath/bn_mp_get_int.c b/libtommath/bn_mp_get_int.c index 5c820f8..abb7011 100644 --- a/libtommath/bn_mp_get_int.c +++ b/libtommath/bn_mp_get_int.c @@ -16,7 +16,7 @@ */ /* get the lower 32-bits of an mp_int */ -unsigned long mp_get_int(mp_int * a) +unsigned long mp_get_int(const mp_int * a) { int i; mp_min_u32 res; diff --git a/libtommath/bn_mp_get_long.c b/libtommath/bn_mp_get_long.c index 7c3d0fe..da69080 100644 --- a/libtommath/bn_mp_get_long.c +++ b/libtommath/bn_mp_get_long.c @@ -16,7 +16,7 @@ */ /* get the lower unsigned long of an mp_int, platform dependent */ -unsigned long mp_get_long(mp_int * a) +unsigned long mp_get_long(const mp_int * a) { int i; unsigned long res; diff --git a/libtommath/bn_mp_get_long_long.c b/libtommath/bn_mp_get_long_long.c index 4b959e6..534c48c 100644 --- a/libtommath/bn_mp_get_long_long.c +++ b/libtommath/bn_mp_get_long_long.c @@ -16,17 +16,17 @@ */ /* get the lower unsigned long long of an mp_int, platform dependent */ -unsigned long long mp_get_long_long (mp_int * a) +Tcl_WideUInt mp_get_long_long (const mp_int * a) { int i; - unsigned long long res; + Tcl_WideUInt res; if (a->used == 0) { return 0; } /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(unsigned long long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + i = MIN(a->used,(int)(((sizeof(Tcl_WideUInt) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; /* get most significant digit of result */ res = DIGIT(a,i); diff --git a/libtommath/bn_mp_mul_2.c b/libtommath/bn_mp_mul_2.c index d22fd89..0c8c2e3 100644 --- a/libtommath/bn_mp_mul_2.c +++ b/libtommath/bn_mp_mul_2.c @@ -16,7 +16,7 @@ */ /* b = a*2 */ -int mp_mul_2(mp_int * a, mp_int * b) +int mp_mul_2(const mp_int * a, mp_int * b) { int x, res, oldused; diff --git a/libtommath/bn_mp_set_long_long.c b/libtommath/bn_mp_set_long_long.c index 3566b45..0b8be33 100644 --- a/libtommath/bn_mp_set_long_long.c +++ b/libtommath/bn_mp_set_long_long.c @@ -16,7 +16,7 @@ */ /* set a platform dependent unsigned long long int */ -MP_SET_XLONG(mp_set_long_long, unsigned long long) +MP_SET_XLONG(mp_set_long_long, Tcl_WideUInt) #endif /* ref: $Format:%D$ */ diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 7d92d97..a8c9e21 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -220,16 +220,16 @@ int mp_set_int(mp_int *a, unsigned long b); int mp_set_long(mp_int *a, unsigned long b); /* set a platform dependent unsigned long long value */ -int mp_set_long_long(mp_int *a, unsigned long long b); +int mp_set_long_long(mp_int *a, Tcl_WideUInt b); /* get a 32-bit value */ -unsigned long mp_get_int(mp_int * a); +unsigned long mp_get_int(const mp_int * a); /* get a platform dependent unsigned long value */ -unsigned long mp_get_long(mp_int * a); +unsigned long mp_get_long(const mp_int * a); /* get a platform dependent unsigned long long value */ -unsigned long long mp_get_long_long(mp_int * a); +Tcl_WideUInt mp_get_long_long(const mp_int * a); /* initialize and set a digit */ int mp_init_set (mp_int * a, mp_digit b); @@ -264,13 +264,13 @@ int mp_lshd(mp_int *a, int b); int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d); /* b = a/2 */ -int mp_div_2(mp_int *a, mp_int *b); +int mp_div_2(const mp_int *a, mp_int *b); /* c = a * 2**b, implemented as c = a << b */ int mp_mul_2d(const mp_int *a, int b, mp_int *c); /* b = a*2 */ -int mp_mul_2(mp_int *a, mp_int *b); +int mp_mul_2(const mp_int *a, mp_int *b); /* c = a mod 2**b */ int mp_mod_2d(const mp_int *a, int b, mp_int *c); diff --git a/unix/Makefile.in b/unix/Makefile.in index fadc147..2f97bf5 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -320,7 +320,7 @@ TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \ bn_mp_cnt_lsb.o bn_mp_copy.o \ bn_mp_count_bits.o bn_mp_div.o bn_mp_div_d.o bn_mp_div_2.o \ bn_mp_div_2d.o bn_mp_div_3.o \ - bn_mp_exch.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_grow.o bn_mp_init.o \ + bn_mp_exch.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_get_int.o bn_mp_get_long_long.o bn_mp_grow.o bn_mp_init.o \ bn_mp_init_copy.o bn_mp_init_multi.o bn_mp_init_set.o \ bn_mp_init_set_int.o bn_mp_init_size.o bn_mp_karatsuba_mul.o \ bn_mp_karatsuba_sqr.o \ @@ -328,7 +328,7 @@ TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \ bn_mp_mul_2d.o bn_mp_mul_d.o bn_mp_neg.o bn_mp_or.o \ bn_mp_radix_size.o bn_mp_radix_smap.o \ bn_mp_read_radix.o bn_mp_rshd.o bn_mp_set.o bn_mp_set_int.o \ - bn_mp_shrink.o \ + bn_mp_set_long_long.o bn_mp_shrink.o \ bn_mp_sqr.o bn_mp_sqrt.o bn_mp_sub.o bn_mp_sub_d.o \ bn_mp_to_unsigned_bin.o bn_mp_to_unsigned_bin_n.o \ bn_mp_toom_mul.o bn_mp_toom_sqr.o bn_mp_toradix_n.o \ @@ -504,6 +504,8 @@ TOMMATH_SRCS = \ $(TOMMATH_DIR)/bn_mp_exch.c \ $(TOMMATH_DIR)/bn_mp_expt_d.c \ $(TOMMATH_DIR)/bn_mp_expt_d_ex.c \ + $(TOMMATH_DIR)/bn_mp_get_int.c \ + $(TOMMATH_DIR)/bn_mp_get_long_long.c \ $(TOMMATH_DIR)/bn_mp_grow.c \ $(TOMMATH_DIR)/bn_mp_init.c \ $(TOMMATH_DIR)/bn_mp_init_copy.c \ @@ -528,6 +530,7 @@ TOMMATH_SRCS = \ $(TOMMATH_DIR)/bn_mp_rshd.c \ $(TOMMATH_DIR)/bn_mp_set.c \ $(TOMMATH_DIR)/bn_mp_set_int.c \ + $(TOMMATH_DIR)/bn_mp_set_long_long.c \ $(TOMMATH_DIR)/bn_mp_shrink.c \ $(TOMMATH_DIR)/bn_mp_sqr.c \ $(TOMMATH_DIR)/bn_mp_sqrt.c \ @@ -1426,6 +1429,12 @@ bn_mp_expt_d.o: $(TOMMATH_DIR)/bn_mp_expt_d.c $(MATHHDRS) bn_mp_expt_d_ex.o: $(TOMMATH_DIR)/bn_mp_expt_d_ex.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_expt_d_ex.c +bn_mp_get_int.o: $(TOMMATH_DIR)/bn_mp_get_int.c $(MATHHDRS) + $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_get_int.c + +bn_mp_get_long_long.o: $(TOMMATH_DIR)/bn_mp_get_long_long.c $(MATHHDRS) + $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_get_long_long.c + bn_mp_grow.o: $(TOMMATH_DIR)/bn_mp_grow.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_grow.c @@ -1498,6 +1507,9 @@ bn_mp_set.o: $(TOMMATH_DIR)/bn_mp_set.c $(MATHHDRS) bn_mp_set_int.o: $(TOMMATH_DIR)/bn_mp_set_int.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_set_int.c +bn_mp_set_long_long.o: $(TOMMATH_DIR)/bn_mp_set_long_long.c $(MATHHDRS) + $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_set_long_long.c + bn_mp_shrink.o: $(TOMMATH_DIR)/bn_mp_shrink.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_shrink.c diff --git a/unix/tcl.spec b/unix/tcl.spec index 868a226..265e4df 100644 --- a/unix/tcl.spec +++ b/unix/tcl.spec @@ -4,7 +4,7 @@ Name: tcl Summary: Tcl scripting language development environment -Version: 8.7a0 +Version: 8.7a2 Release: 2 License: BSD Group: Development/Languages diff --git a/win/Makefile.in b/win/Makefile.in index 24cb5b2..4a0f839 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -329,6 +329,8 @@ TOMMATH_OBJS = \ bn_mp_exch.${OBJEXT} \ bn_mp_expt_d.${OBJEXT} \ bn_mp_expt_d_ex.${OBJEXT} \ + bn_mp_get_int.${OBJEXT} \ + bn_mp_get_long_long.${OBJEXT} \ bn_mp_grow.${OBJEXT} \ bn_mp_init.${OBJEXT} \ bn_mp_init_copy.${OBJEXT} \ @@ -353,6 +355,7 @@ TOMMATH_OBJS = \ bn_mp_rshd.${OBJEXT} \ bn_mp_set.${OBJEXT} \ bn_mp_set_int.${OBJEXT} \ + bn_mp_set_long_long.${OBJEXT} \ bn_mp_shrink.${OBJEXT} \ bn_mp_sqr.${OBJEXT} \ bn_mp_sqrt.${OBJEXT} \ diff --git a/win/makefile.vc b/win/makefile.vc index 5566df2..ca8cc08 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -384,6 +384,8 @@ TOMMATHOBJS = \ $(TMP_DIR)\bn_mp_exch.obj \ $(TMP_DIR)\bn_mp_expt_d.obj \ $(TMP_DIR)\bn_mp_expt_d_ex.obj \ + $(TMP_DIR)\bn_mp_get_int.obj \ + $(TMP_DIR)\bn_mp_get_long_long.obj \ $(TMP_DIR)\bn_mp_grow.obj \ $(TMP_DIR)\bn_mp_init.obj \ $(TMP_DIR)\bn_mp_init_copy.obj \ @@ -408,6 +410,7 @@ TOMMATHOBJS = \ $(TMP_DIR)\bn_mp_rshd.obj \ $(TMP_DIR)\bn_mp_set.obj \ $(TMP_DIR)\bn_mp_set_int.obj \ + $(TMP_DIR)\bn_mp_set_long_long.obj \ $(TMP_DIR)\bn_mp_shrink.obj \ $(TMP_DIR)\bn_mp_sqr.obj \ $(TMP_DIR)\bn_mp_sqrt.obj \ -- cgit v0.12 From b9e8eecd80020e9dc1539f6f99f121472aff3126 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 11 Sep 2017 10:38:07 +0000 Subject: Many 'const' addtions in libtommath where it makes sense. To be submitted back to the libtommath guys. --- generic/tclTomMath.decls | 50 +++++++-------- generic/tclTomMath.h | 38 +++++------ generic/tclTomMathDecls.h | 125 ++++++++++++++++++++----------------- libtommath/bn_fast_s_mp_mul_digs.c | 2 +- libtommath/bn_fast_s_mp_sqr.c | 2 +- libtommath/bn_mp_add.c | 2 +- libtommath/bn_mp_and.c | 5 +- libtommath/bn_mp_div.c | 4 +- libtommath/bn_mp_div_3.c | 2 +- libtommath/bn_mp_div_d.c | 2 +- libtommath/bn_mp_expt_d.c | 2 +- libtommath/bn_mp_expt_d_ex.c | 2 +- libtommath/bn_mp_karatsuba_mul.c | 2 +- libtommath/bn_mp_karatsuba_sqr.c | 2 +- libtommath/bn_mp_mod.c | 2 +- libtommath/bn_mp_mul.c | 2 +- libtommath/bn_mp_mul_d.c | 2 +- libtommath/bn_mp_or.c | 5 +- libtommath/bn_mp_sqr.c | 2 +- libtommath/bn_mp_sqrt.c | 2 +- libtommath/bn_mp_sub.c | 2 +- libtommath/bn_mp_toom_mul.c | 2 +- libtommath/bn_mp_toom_sqr.c | 2 +- libtommath/bn_mp_xor.c | 5 +- libtommath/bn_s_mp_add.c | 4 +- libtommath/bn_s_mp_mul_digs.c | 2 +- libtommath/bn_s_mp_sqr.c | 2 +- libtommath/bn_s_mp_sub.c | 2 +- libtommath/tommath.h | 36 +++++------ libtommath/tommath_private.h | 20 +++--- 30 files changed, 174 insertions(+), 158 deletions(-) diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls index c4299d0..5d1c8e8 100644 --- a/generic/tclTomMath.decls +++ b/generic/tclTomMath.decls @@ -30,13 +30,13 @@ declare 1 { } declare 2 { - int TclBN_mp_add(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_add(const mp_int *a, const mp_int *b, mp_int *c) } declare 3 { int TclBN_mp_add_d(mp_int *a, mp_digit b, mp_int *c) } declare 4 { - int TclBN_mp_and(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_and(const mp_int *a, const mp_int *b, mp_int *c) } declare 5 { void TclBN_mp_clamp(mp_int *a) @@ -63,10 +63,10 @@ declare 12 { int TclBN_mp_count_bits(const mp_int *a) } declare 13 { - int TclBN_mp_div(mp_int *a, mp_int *b, mp_int *q, mp_int *r) + int TclBN_mp_div(const mp_int *a, const mp_int *b, mp_int *q, mp_int *r) } declare 14 { - int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *q, mp_digit *r) + int TclBN_mp_div_d(const mp_int *a, mp_digit b, mp_int *q, mp_digit *r) } declare 15 { int TclBN_mp_div_2(const mp_int *a, mp_int *q) @@ -75,13 +75,13 @@ declare 16 { int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r) } declare 17 { - int TclBN_mp_div_3(mp_int *a, mp_int *q, mp_digit *r) + int TclBN_mp_div_3(const mp_int *a, mp_int *q, mp_digit *r) } declare 18 { void TclBN_mp_exch(mp_int *a, mp_int *b) } declare 19 { - int TclBN_mp_expt_d(mp_int *a, mp_digit b, mp_int *c) + int TclBN_mp_expt_d(const mp_int *a, mp_digit b, mp_int *c) } declare 20 { int TclBN_mp_grow(mp_int *a, int size) @@ -105,16 +105,16 @@ declare 26 { int TclBN_mp_lshd(mp_int *a, int shift) } declare 27 { - int TclBN_mp_mod(mp_int *a, mp_int *b, mp_int *r) + int TclBN_mp_mod(const mp_int *a, const mp_int *b, mp_int *r) } declare 28 { int TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r) } declare 29 { - int TclBN_mp_mul(mp_int *a, mp_int *b, mp_int *p) + int TclBN_mp_mul(const mp_int *a, const mp_int *b, mp_int *p) } declare 30 { - int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *p) + int TclBN_mp_mul_d(const mp_int *a, mp_digit b, mp_int *p) } declare 31 { int TclBN_mp_mul_2(const mp_int *a, mp_int *p) @@ -126,7 +126,7 @@ declare 33 { int TclBN_mp_neg(const mp_int *a, mp_int *b) } declare 34 { - int TclBN_mp_or(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_or(const mp_int *a, const mp_int *b, mp_int *c) } declare 35 { int TclBN_mp_radix_size(const mp_int *a, int radix, int *size) @@ -144,13 +144,13 @@ declare 39 { void TclBN_mp_set(mp_int *a, mp_digit b) } declare 40 { - int TclBN_mp_sqr(mp_int *a, mp_int *b) + int TclBN_mp_sqr(const mp_int *a, mp_int *b) } declare 41 { - int TclBN_mp_sqrt(mp_int *a, mp_int *b) + int TclBN_mp_sqrt(const mp_int *a, mp_int *b) } declare 42 { - int TclBN_mp_sub(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) } declare 43 { int TclBN_mp_sub_d(mp_int *a, mp_digit b, mp_int *c) @@ -169,7 +169,7 @@ declare 47 { int TclBN_mp_unsigned_bin_size(mp_int *a) } declare 48 { - int TclBN_mp_xor(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_xor(const mp_int *a, const mp_int *b, mp_int *c) } declare 49 { void TclBN_mp_zero(mp_int *a) @@ -182,34 +182,34 @@ declare 50 { void TclBN_reverse(unsigned char *s, int len) } declare 51 { - int TclBN_fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs) + int TclBN_fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) } declare 52 { - int TclBN_fast_s_mp_sqr(mp_int *a, mp_int *b) + int TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b) } declare 53 { - int TclBN_mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c) } declare 54 { - int TclBN_mp_karatsuba_sqr(mp_int *a, mp_int *b) + int TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b) } declare 55 { - int TclBN_mp_toom_mul(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c) } declare 56 { - int TclBN_mp_toom_sqr(mp_int *a, mp_int *b) + int TclBN_mp_toom_sqr(const mp_int *a, mp_int *b) } declare 57 { - int TclBN_s_mp_add(mp_int *a, mp_int *b, mp_int *c) + int TclBN_s_mp_add(const mp_int *a, const mp_int *b, mp_int *c) } declare 58 { - int TclBN_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs) + int TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) } declare 59 { - int TclBN_s_mp_sqr(mp_int *a, mp_int *b) + int TclBN_s_mp_sqr(const mp_int *a, mp_int *b) } declare 60 { - int TclBN_s_mp_sub(mp_int *a, mp_int *b, mp_int *c) + int TclBN_s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) } declare 61 { int TclBN_mp_init_set_int(mp_int *a, unsigned long i) @@ -235,7 +235,7 @@ declare 66 { # Added in libtommath 1.0 declare 67 { - int TclBN_mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast) + int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) } # Added in libtommath 1.0.1 declare 68 { diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 7e3c29e..2ce8194 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -27,7 +27,7 @@ extern "C" { #endif /* detect 64-bit mode if possible */ -#if defined(NEVER) /* 128-bit ints fail in too many places */ +#if defined(NEVER) #if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT)) #define MP_64BIT #endif @@ -383,17 +383,17 @@ int mp_rand(mp_int *a, int digits); /* ---> binary operations <--- */ /* c = a XOR b */ /* -int mp_xor(mp_int *a, mp_int *b, mp_int *c); +int mp_xor(const mp_int *a, const mp_int *b, mp_int *c); */ /* c = a OR b */ /* -int mp_or(mp_int *a, mp_int *b, mp_int *c); +int mp_or(const mp_int *a, const mp_int *b, mp_int *c); */ /* c = a AND b */ /* -int mp_and(mp_int *a, mp_int *b, mp_int *c); +int mp_and(const mp_int *a, const mp_int *b, mp_int *c); */ /* ---> Basic arithmetic <--- */ @@ -405,7 +405,7 @@ int mp_neg(const mp_int *a, mp_int *b); /* b = |a| */ /* -int mp_abs(mp_int *a, mp_int *b); +int mp_abs(const mp_int *a, mp_int *b); */ /* compare a to b */ @@ -420,32 +420,32 @@ int mp_cmp_mag(const mp_int *a, const mp_int *b); /* c = a + b */ /* -int mp_add(mp_int *a, mp_int *b, mp_int *c); +int mp_add(const mp_int *a, const mp_int *b, mp_int *c); */ /* c = a - b */ /* -int mp_sub(mp_int *a, mp_int *b, mp_int *c); +int mp_sub(const mp_int *a, const mp_int *b, mp_int *c); */ /* c = a * b */ /* -int mp_mul(mp_int *a, mp_int *b, mp_int *c); +int mp_mul(const mp_int *a, const mp_int *b, mp_int *c); */ /* b = a*a */ /* -int mp_sqr(mp_int *a, mp_int *b); +int mp_sqr(const mp_int *a, mp_int *b); */ /* a/b => cb + d == a */ /* -int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d); */ /* c = a mod b, 0 <= c < b */ /* -int mp_mod(mp_int *a, mp_int *b, mp_int *c); +int mp_mod(const mp_int *a, const mp_int *b, mp_int *c); */ /* ---> single digit functions <--- */ @@ -457,40 +457,40 @@ int mp_cmp_d(const mp_int *a, mp_digit b); /* c = a + b */ /* -int mp_add_d(mp_int *a, mp_digit b, mp_int *c); +int mp_add_d(const mp_int *a, const mp_digit b, mp_int *c); */ /* c = a - b */ /* -int mp_sub_d(mp_int *a, mp_digit b, mp_int *c); +int mp_sub_d(const mp_int *a, mp_digit b, mp_int *c); */ /* c = a * b */ /* -int mp_mul_d(mp_int *a, mp_digit b, mp_int *c); +int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c); */ /* a/b => cb + d == a */ /* -int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d); +int mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d); */ /* a/3 => 3c + d == a */ /* -int mp_div_3(mp_int *a, mp_int *c, mp_digit *d); +int mp_div_3(const mp_int *a, mp_int *c, mp_digit *d); */ /* c = a**b */ /* -int mp_expt_d(mp_int *a, mp_digit b, mp_int *c); +int mp_expt_d(const mp_int *a, const mp_digit b, mp_int *c); */ /* -int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast); +int mp_expt_d_ex (const mp_int * a, const mp_digit b, mp_int * c, int fast); */ /* c = a mod b, 0 <= c < b */ /* -int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c); +int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c); */ /* ---> number theory <--- */ diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index 70de3b1..9d683dc 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -151,11 +151,13 @@ EXTERN int TclBN_epoch(void); /* 1 */ EXTERN int TclBN_revision(void); /* 2 */ -EXTERN int TclBN_mp_add(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_add(const mp_int *a, const mp_int *b, + mp_int *c); /* 3 */ EXTERN int TclBN_mp_add_d(mp_int *a, mp_digit b, mp_int *c); /* 4 */ -EXTERN int TclBN_mp_and(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_and(const mp_int *a, const mp_int *b, + mp_int *c); /* 5 */ EXTERN void TclBN_mp_clamp(mp_int *a); /* 6 */ @@ -173,22 +175,24 @@ EXTERN int TclBN_mp_copy(const mp_int *a, mp_int *b); /* 12 */ EXTERN int TclBN_mp_count_bits(const mp_int *a); /* 13 */ -EXTERN int TclBN_mp_div(mp_int *a, mp_int *b, mp_int *q, - mp_int *r); +EXTERN int TclBN_mp_div(const mp_int *a, const mp_int *b, + mp_int *q, mp_int *r); /* 14 */ -EXTERN int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *q, - mp_digit *r); +EXTERN int TclBN_mp_div_d(const mp_int *a, mp_digit b, + mp_int *q, mp_digit *r); /* 15 */ EXTERN int TclBN_mp_div_2(const mp_int *a, mp_int *q); /* 16 */ EXTERN int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r); /* 17 */ -EXTERN int TclBN_mp_div_3(mp_int *a, mp_int *q, mp_digit *r); +EXTERN int TclBN_mp_div_3(const mp_int *a, mp_int *q, + mp_digit *r); /* 18 */ EXTERN void TclBN_mp_exch(mp_int *a, mp_int *b); /* 19 */ -EXTERN int TclBN_mp_expt_d(mp_int *a, mp_digit b, mp_int *c); +EXTERN int TclBN_mp_expt_d(const mp_int *a, mp_digit b, + mp_int *c); /* 20 */ EXTERN int TclBN_mp_grow(mp_int *a, int size); /* 21 */ @@ -204,13 +208,16 @@ EXTERN int TclBN_mp_init_size(mp_int *a, int size); /* 26 */ EXTERN int TclBN_mp_lshd(mp_int *a, int shift); /* 27 */ -EXTERN int TclBN_mp_mod(mp_int *a, mp_int *b, mp_int *r); +EXTERN int TclBN_mp_mod(const mp_int *a, const mp_int *b, + mp_int *r); /* 28 */ EXTERN int TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r); /* 29 */ -EXTERN int TclBN_mp_mul(mp_int *a, mp_int *b, mp_int *p); +EXTERN int TclBN_mp_mul(const mp_int *a, const mp_int *b, + mp_int *p); /* 30 */ -EXTERN int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *p); +EXTERN int TclBN_mp_mul_d(const mp_int *a, mp_digit b, + mp_int *p); /* 31 */ EXTERN int TclBN_mp_mul_2(const mp_int *a, mp_int *p); /* 32 */ @@ -218,7 +225,8 @@ EXTERN int TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p); /* 33 */ EXTERN int TclBN_mp_neg(const mp_int *a, mp_int *b); /* 34 */ -EXTERN int TclBN_mp_or(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_or(const mp_int *a, const mp_int *b, + mp_int *c); /* 35 */ EXTERN int TclBN_mp_radix_size(const mp_int *a, int radix, int *size); @@ -232,11 +240,12 @@ EXTERN int TclBN_mp_shrink(mp_int *a); /* 39 */ EXTERN void TclBN_mp_set(mp_int *a, mp_digit b); /* 40 */ -EXTERN int TclBN_mp_sqr(mp_int *a, mp_int *b); +EXTERN int TclBN_mp_sqr(const mp_int *a, mp_int *b); /* 41 */ -EXTERN int TclBN_mp_sqrt(mp_int *a, mp_int *b); +EXTERN int TclBN_mp_sqrt(const mp_int *a, mp_int *b); /* 42 */ -EXTERN int TclBN_mp_sub(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_sub(const mp_int *a, const mp_int *b, + mp_int *c); /* 43 */ EXTERN int TclBN_mp_sub_d(mp_int *a, mp_digit b, mp_int *c); /* 44 */ @@ -250,34 +259,38 @@ EXTERN int TclBN_mp_toradix_n(mp_int *a, char *str, int radix, /* 47 */ EXTERN int TclBN_mp_unsigned_bin_size(mp_int *a); /* 48 */ -EXTERN int TclBN_mp_xor(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_xor(const mp_int *a, const mp_int *b, + mp_int *c); /* 49 */ EXTERN void TclBN_mp_zero(mp_int *a); /* 50 */ EXTERN void TclBN_reverse(unsigned char *s, int len); /* 51 */ -EXTERN int TclBN_fast_s_mp_mul_digs(mp_int *a, mp_int *b, - mp_int *c, int digs); +EXTERN int TclBN_fast_s_mp_mul_digs(const mp_int *a, + const mp_int *b, mp_int *c, int digs); /* 52 */ -EXTERN int TclBN_fast_s_mp_sqr(mp_int *a, mp_int *b); +EXTERN int TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b); /* 53 */ -EXTERN int TclBN_mp_karatsuba_mul(mp_int *a, mp_int *b, - mp_int *c); +EXTERN int TclBN_mp_karatsuba_mul(const mp_int *a, + const mp_int *b, mp_int *c); /* 54 */ -EXTERN int TclBN_mp_karatsuba_sqr(mp_int *a, mp_int *b); +EXTERN int TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b); /* 55 */ -EXTERN int TclBN_mp_toom_mul(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_toom_mul(const mp_int *a, const mp_int *b, + mp_int *c); /* 56 */ -EXTERN int TclBN_mp_toom_sqr(mp_int *a, mp_int *b); +EXTERN int TclBN_mp_toom_sqr(const mp_int *a, mp_int *b); /* 57 */ -EXTERN int TclBN_s_mp_add(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_s_mp_add(const mp_int *a, const mp_int *b, + mp_int *c); /* 58 */ -EXTERN int TclBN_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, - int digs); +EXTERN int TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b, + mp_int *c, int digs); /* 59 */ -EXTERN int TclBN_s_mp_sqr(mp_int *a, mp_int *b); +EXTERN int TclBN_s_mp_sqr(const mp_int *a, mp_int *b); /* 60 */ -EXTERN int TclBN_s_mp_sub(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_s_mp_sub(const mp_int *a, const mp_int *b, + mp_int *c); /* 61 */ EXTERN int TclBN_mp_init_set_int(mp_int *a, unsigned long i); /* 62 */ @@ -293,8 +306,8 @@ EXTERN void TclBNInitBignumFromWideInt(mp_int *bignum, EXTERN void TclBNInitBignumFromWideUInt(mp_int *bignum, Tcl_WideUInt initVal); /* 67 */ -EXTERN int TclBN_mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, - int fast); +EXTERN int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, + mp_int *c, int fast); /* 68 */ EXTERN int TclBN_mp_set_long_long(mp_int *a, Tcl_WideUInt i); /* 69 */ @@ -306,9 +319,9 @@ typedef struct TclTomMathStubs { int (*tclBN_epoch) (void); /* 0 */ int (*tclBN_revision) (void); /* 1 */ - int (*tclBN_mp_add) (mp_int *a, mp_int *b, mp_int *c); /* 2 */ + int (*tclBN_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 2 */ int (*tclBN_mp_add_d) (mp_int *a, mp_digit b, mp_int *c); /* 3 */ - int (*tclBN_mp_and) (mp_int *a, mp_int *b, mp_int *c); /* 4 */ + int (*tclBN_mp_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 4 */ void (*tclBN_mp_clamp) (mp_int *a); /* 5 */ void (*tclBN_mp_clear) (mp_int *a); /* 6 */ void (*tclBN_mp_clear_multi) (mp_int *a, ...); /* 7 */ @@ -317,13 +330,13 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_cmp_mag) (const mp_int *a, const mp_int *b); /* 10 */ int (*tclBN_mp_copy) (const mp_int *a, mp_int *b); /* 11 */ int (*tclBN_mp_count_bits) (const mp_int *a); /* 12 */ - int (*tclBN_mp_div) (mp_int *a, mp_int *b, mp_int *q, mp_int *r); /* 13 */ - int (*tclBN_mp_div_d) (mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */ + int (*tclBN_mp_div) (const mp_int *a, const mp_int *b, mp_int *q, mp_int *r); /* 13 */ + int (*tclBN_mp_div_d) (const mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */ int (*tclBN_mp_div_2) (const mp_int *a, mp_int *q); /* 15 */ int (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */ - int (*tclBN_mp_div_3) (mp_int *a, mp_int *q, mp_digit *r); /* 17 */ + int (*tclBN_mp_div_3) (const mp_int *a, mp_int *q, mp_digit *r); /* 17 */ void (*tclBN_mp_exch) (mp_int *a, mp_int *b); /* 18 */ - int (*tclBN_mp_expt_d) (mp_int *a, mp_digit b, mp_int *c); /* 19 */ + int (*tclBN_mp_expt_d) (const mp_int *a, mp_digit b, mp_int *c); /* 19 */ int (*tclBN_mp_grow) (mp_int *a, int size); /* 20 */ int (*tclBN_mp_init) (mp_int *a); /* 21 */ int (*tclBN_mp_init_copy) (mp_int *a, const mp_int *b); /* 22 */ @@ -331,47 +344,47 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_init_set) (mp_int *a, mp_digit b); /* 24 */ int (*tclBN_mp_init_size) (mp_int *a, int size); /* 25 */ int (*tclBN_mp_lshd) (mp_int *a, int shift); /* 26 */ - int (*tclBN_mp_mod) (mp_int *a, mp_int *b, mp_int *r); /* 27 */ + int (*tclBN_mp_mod) (const mp_int *a, const mp_int *b, mp_int *r); /* 27 */ int (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r); /* 28 */ - int (*tclBN_mp_mul) (mp_int *a, mp_int *b, mp_int *p); /* 29 */ - int (*tclBN_mp_mul_d) (mp_int *a, mp_digit b, mp_int *p); /* 30 */ + int (*tclBN_mp_mul) (const mp_int *a, const mp_int *b, mp_int *p); /* 29 */ + int (*tclBN_mp_mul_d) (const mp_int *a, mp_digit b, mp_int *p); /* 30 */ int (*tclBN_mp_mul_2) (const mp_int *a, mp_int *p); /* 31 */ int (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p); /* 32 */ int (*tclBN_mp_neg) (const mp_int *a, mp_int *b); /* 33 */ - int (*tclBN_mp_or) (mp_int *a, mp_int *b, mp_int *c); /* 34 */ + int (*tclBN_mp_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 34 */ int (*tclBN_mp_radix_size) (const mp_int *a, int radix, int *size); /* 35 */ int (*tclBN_mp_read_radix) (mp_int *a, const char *str, int radix); /* 36 */ void (*tclBN_mp_rshd) (mp_int *a, int shift); /* 37 */ int (*tclBN_mp_shrink) (mp_int *a); /* 38 */ void (*tclBN_mp_set) (mp_int *a, mp_digit b); /* 39 */ - int (*tclBN_mp_sqr) (mp_int *a, mp_int *b); /* 40 */ - int (*tclBN_mp_sqrt) (mp_int *a, mp_int *b); /* 41 */ - int (*tclBN_mp_sub) (mp_int *a, mp_int *b, mp_int *c); /* 42 */ + int (*tclBN_mp_sqr) (const mp_int *a, mp_int *b); /* 40 */ + int (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b); /* 41 */ + int (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 42 */ int (*tclBN_mp_sub_d) (mp_int *a, mp_digit b, mp_int *c); /* 43 */ int (*tclBN_mp_to_unsigned_bin) (mp_int *a, unsigned char *b); /* 44 */ int (*tclBN_mp_to_unsigned_bin_n) (mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */ int (*tclBN_mp_toradix_n) (mp_int *a, char *str, int radix, int maxlen); /* 46 */ int (*tclBN_mp_unsigned_bin_size) (mp_int *a); /* 47 */ - int (*tclBN_mp_xor) (mp_int *a, mp_int *b, mp_int *c); /* 48 */ + int (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 48 */ void (*tclBN_mp_zero) (mp_int *a); /* 49 */ void (*tclBN_reverse) (unsigned char *s, int len); /* 50 */ - int (*tclBN_fast_s_mp_mul_digs) (mp_int *a, mp_int *b, mp_int *c, int digs); /* 51 */ - int (*tclBN_fast_s_mp_sqr) (mp_int *a, mp_int *b); /* 52 */ - int (*tclBN_mp_karatsuba_mul) (mp_int *a, mp_int *b, mp_int *c); /* 53 */ - int (*tclBN_mp_karatsuba_sqr) (mp_int *a, mp_int *b); /* 54 */ - int (*tclBN_mp_toom_mul) (mp_int *a, mp_int *b, mp_int *c); /* 55 */ - int (*tclBN_mp_toom_sqr) (mp_int *a, mp_int *b); /* 56 */ - int (*tclBN_s_mp_add) (mp_int *a, mp_int *b, mp_int *c); /* 57 */ - int (*tclBN_s_mp_mul_digs) (mp_int *a, mp_int *b, mp_int *c, int digs); /* 58 */ - int (*tclBN_s_mp_sqr) (mp_int *a, mp_int *b); /* 59 */ - int (*tclBN_s_mp_sub) (mp_int *a, mp_int *b, mp_int *c); /* 60 */ + int (*tclBN_fast_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 51 */ + int (*tclBN_fast_s_mp_sqr) (const mp_int *a, mp_int *b); /* 52 */ + int (*tclBN_mp_karatsuba_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 53 */ + int (*tclBN_mp_karatsuba_sqr) (const mp_int *a, mp_int *b); /* 54 */ + int (*tclBN_mp_toom_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 55 */ + int (*tclBN_mp_toom_sqr) (const mp_int *a, mp_int *b); /* 56 */ + int (*tclBN_s_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 57 */ + int (*tclBN_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 58 */ + int (*tclBN_s_mp_sqr) (const mp_int *a, mp_int *b); /* 59 */ + int (*tclBN_s_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 60 */ int (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); /* 61 */ int (*tclBN_mp_set_int) (mp_int *a, unsigned long i); /* 62 */ int (*tclBN_mp_cnt_lsb) (const mp_int *a); /* 63 */ void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */ void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */ void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */ - int (*tclBN_mp_expt_d_ex) (mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */ + int (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */ int (*tclBN_mp_set_long_long) (mp_int *a, Tcl_WideUInt i); /* 68 */ Tcl_WideUInt (*tclBN_mp_get_long_long) (const mp_int *a); /* 69 */ } TclTomMathStubs; diff --git a/libtommath/bn_fast_s_mp_mul_digs.c b/libtommath/bn_fast_s_mp_mul_digs.c index a1015af..641b574 100644 --- a/libtommath/bn_fast_s_mp_mul_digs.c +++ b/libtommath/bn_fast_s_mp_mul_digs.c @@ -31,7 +31,7 @@ * Based on Algorithm 14.12 on pp.595 of HAC. * */ -int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) +int fast_s_mp_mul_digs (const mp_int * a, const mp_int * b, mp_int * c, int digs) { int olduse, res, pa, ix, iz; mp_digit W[MP_WARRAY]; diff --git a/libtommath/bn_fast_s_mp_sqr.c b/libtommath/bn_fast_s_mp_sqr.c index f435af9..282d303 100644 --- a/libtommath/bn_fast_s_mp_sqr.c +++ b/libtommath/bn_fast_s_mp_sqr.c @@ -25,7 +25,7 @@ After that loop you do the squares and add them in. */ -int fast_s_mp_sqr (mp_int * a, mp_int * b) +int fast_s_mp_sqr (const mp_int * a, mp_int * b) { int olduse, res, pa, ix, iz; mp_digit W[MP_WARRAY], *tmpx; diff --git a/libtommath/bn_mp_add.c b/libtommath/bn_mp_add.c index bdb166f..a68c02e 100644 --- a/libtommath/bn_mp_add.c +++ b/libtommath/bn_mp_add.c @@ -16,7 +16,7 @@ */ /* high level addition (handles signs) */ -int mp_add (mp_int * a, mp_int * b, mp_int * c) +int mp_add (const mp_int * a, const mp_int * b, mp_int * c) { int sa, sb, res; diff --git a/libtommath/bn_mp_and.c b/libtommath/bn_mp_and.c index 53008a5..e90ab37 100644 --- a/libtommath/bn_mp_and.c +++ b/libtommath/bn_mp_and.c @@ -17,10 +17,11 @@ /* AND two ints together */ int -mp_and (mp_int * a, mp_int * b, mp_int * c) +mp_and (const mp_int * a, const mp_int * b, mp_int * c) { int res, ix, px; - mp_int t, *x; + mp_int t; + const mp_int *x; if (a->used > b->used) { if ((res = mp_init_copy (&t, a)) != MP_OKAY) { diff --git a/libtommath/bn_mp_div.c b/libtommath/bn_mp_div.c index 0890e65..30b36b6 100644 --- a/libtommath/bn_mp_div.c +++ b/libtommath/bn_mp_div.c @@ -18,7 +18,7 @@ #ifdef BN_MP_DIV_SMALL /* slower bit-bang division... also smaller */ -int mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d) +int mp_div(const mp_int * a, const mp_int * b, mp_int * c, mp_int * d) { mp_int ta, tb, tq, q; int res, n, n2; @@ -100,7 +100,7 @@ LBL_ERR: * The overall algorithm is as described as * 14.20 from HAC but fixed to treat these cases. */ -int mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d) +int mp_div (const mp_int * a, const mp_int * b, mp_int * c, mp_int * d) { mp_int q, x, y, t1, t2; int res, n, t, i, norm, neg; diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_mp_div_3.c index e8504ea..5e75438 100644 --- a/libtommath/bn_mp_div_3.c +++ b/libtommath/bn_mp_div_3.c @@ -17,7 +17,7 @@ /* divide by three (based on routine from MPI and the GMP manual) */ int -mp_div_3 (mp_int * a, mp_int *c, mp_digit * d) +mp_div_3 (const mp_int * a, mp_int *c, mp_digit * d) { mp_int q; mp_word w, t; diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index d1f2774..4767565 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -33,7 +33,7 @@ static int s_is_power_of_two(mp_digit b, int *p) } /* single digit division (based on routine from MPI) */ -int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d) +int mp_div_d (const mp_int * a, mp_digit b, mp_int * c, mp_digit * d) { mp_int q; mp_word w; diff --git a/libtommath/bn_mp_expt_d.c b/libtommath/bn_mp_expt_d.c index a311926..ffa3b93 100644 --- a/libtommath/bn_mp_expt_d.c +++ b/libtommath/bn_mp_expt_d.c @@ -16,7 +16,7 @@ */ /* wrapper function for mp_expt_d_ex() */ -int mp_expt_d (mp_int * a, mp_digit b, mp_int * c) +int mp_expt_d (const mp_int * a, mp_digit b, mp_int * c) { return mp_expt_d_ex(a, b, c, 0); } diff --git a/libtommath/bn_mp_expt_d_ex.c b/libtommath/bn_mp_expt_d_ex.c index c361b27..545d156 100644 --- a/libtommath/bn_mp_expt_d_ex.c +++ b/libtommath/bn_mp_expt_d_ex.c @@ -16,7 +16,7 @@ */ /* calculate c = a**b using a square-multiply algorithm */ -int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast) +int mp_expt_d_ex (const mp_int * a, mp_digit b, mp_int * c, int fast) { int res; unsigned int x; diff --git a/libtommath/bn_mp_karatsuba_mul.c b/libtommath/bn_mp_karatsuba_mul.c index 4d982c7..1e6a42b 100644 --- a/libtommath/bn_mp_karatsuba_mul.c +++ b/libtommath/bn_mp_karatsuba_mul.c @@ -44,7 +44,7 @@ * Generally though the overhead of this method doesn't pay off * until a certain size (N ~ 80) is reached. */ -int mp_karatsuba_mul (mp_int * a, mp_int * b, mp_int * c) +int mp_karatsuba_mul (const mp_int * a, const mp_int * b, mp_int * c) { mp_int x0, x1, y0, y1, t1, x0y0, x1y1; int B, err; diff --git a/libtommath/bn_mp_karatsuba_sqr.c b/libtommath/bn_mp_karatsuba_sqr.c index 764e85a..90624d0 100644 --- a/libtommath/bn_mp_karatsuba_sqr.c +++ b/libtommath/bn_mp_karatsuba_sqr.c @@ -22,7 +22,7 @@ * is essentially the same algorithm but merely * tuned to perform recursive squarings. */ -int mp_karatsuba_sqr (mp_int * a, mp_int * b) +int mp_karatsuba_sqr (const mp_int * a, mp_int * b) { mp_int x0, x1, t1, t2, x0x0, x1x1; int B, err; diff --git a/libtommath/bn_mp_mod.c b/libtommath/bn_mp_mod.c index 06240a0..fff0f92 100644 --- a/libtommath/bn_mp_mod.c +++ b/libtommath/bn_mp_mod.c @@ -17,7 +17,7 @@ /* c = a mod b, 0 <= c < b if b > 0, b < c <= 0 if b < 0 */ int -mp_mod (mp_int * a, mp_int * b, mp_int * c) +mp_mod (const mp_int * a, const mp_int * b, mp_int * c) { mp_int t; int res; diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c index cc3b9c8..b8b85c8 100644 --- a/libtommath/bn_mp_mul.c +++ b/libtommath/bn_mp_mul.c @@ -16,7 +16,7 @@ */ /* high level multiplication (handles sign) */ -int mp_mul (mp_int * a, mp_int * b, mp_int * c) +int mp_mul (const mp_int * a, const mp_int * b, mp_int * c) { int res, neg; neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; diff --git a/libtommath/bn_mp_mul_d.c b/libtommath/bn_mp_mul_d.c index 6954ed3..266b082 100644 --- a/libtommath/bn_mp_mul_d.c +++ b/libtommath/bn_mp_mul_d.c @@ -17,7 +17,7 @@ /* multiply by a digit */ int -mp_mul_d (mp_int * a, mp_digit b, mp_int * c) +mp_mul_d (const mp_int * a, mp_digit b, mp_int * c) { mp_digit u, *tmpa, *tmpc; mp_word r; diff --git a/libtommath/bn_mp_or.c b/libtommath/bn_mp_or.c index b9775ce..afe8467 100644 --- a/libtommath/bn_mp_or.c +++ b/libtommath/bn_mp_or.c @@ -16,10 +16,11 @@ */ /* OR two ints together */ -int mp_or (mp_int * a, mp_int * b, mp_int * c) +int mp_or (const mp_int * a, const mp_int * b, mp_int * c) { int res, ix, px; - mp_int t, *x; + mp_int t; + const mp_int *x; if (a->used > b->used) { if ((res = mp_init_copy (&t, a)) != MP_OKAY) { diff --git a/libtommath/bn_mp_sqr.c b/libtommath/bn_mp_sqr.c index ffe94e2..a61f506 100644 --- a/libtommath/bn_mp_sqr.c +++ b/libtommath/bn_mp_sqr.c @@ -17,7 +17,7 @@ /* computes b = a*a */ int -mp_sqr (mp_int * a, mp_int * b) +mp_sqr (const mp_int * a, mp_int * b) { int res; diff --git a/libtommath/bn_mp_sqrt.c b/libtommath/bn_mp_sqrt.c index 775e85f..ce8bd0e 100644 --- a/libtommath/bn_mp_sqrt.c +++ b/libtommath/bn_mp_sqrt.c @@ -20,7 +20,7 @@ #endif /* this function is less generic than mp_n_root, simpler and faster */ -int mp_sqrt(mp_int *arg, mp_int *ret) +int mp_sqrt(const mp_int *arg, mp_int *ret) { int res; mp_int t1,t2; diff --git a/libtommath/bn_mp_sub.c b/libtommath/bn_mp_sub.c index 2f73faa..9ff03d5 100644 --- a/libtommath/bn_mp_sub.c +++ b/libtommath/bn_mp_sub.c @@ -17,7 +17,7 @@ /* high level subtraction (handles signs) */ int -mp_sub (mp_int * a, mp_int * b, mp_int * c) +mp_sub (const mp_int * a, const mp_int * b, mp_int * c) { int sa, sb, res; diff --git a/libtommath/bn_mp_toom_mul.c b/libtommath/bn_mp_toom_mul.c index 4a574fc..0bf940d 100644 --- a/libtommath/bn_mp_toom_mul.c +++ b/libtommath/bn_mp_toom_mul.c @@ -22,7 +22,7 @@ * only particularly useful on VERY large inputs * (we're talking 1000s of digits here...). */ -int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c) +int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c) { mp_int w0, w1, w2, w3, w4, tmp1, tmp2, a0, a1, a2, b0, b1, b2; int res, B; diff --git a/libtommath/bn_mp_toom_sqr.c b/libtommath/bn_mp_toom_sqr.c index 0a38192..842ae47 100644 --- a/libtommath/bn_mp_toom_sqr.c +++ b/libtommath/bn_mp_toom_sqr.c @@ -17,7 +17,7 @@ /* squaring using Toom-Cook 3-way algorithm */ int -mp_toom_sqr(mp_int *a, mp_int *b) +mp_toom_sqr(const mp_int *a, mp_int *b) { mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2; int res, B; diff --git a/libtommath/bn_mp_xor.c b/libtommath/bn_mp_xor.c index f51fc8e..9f7b086 100644 --- a/libtommath/bn_mp_xor.c +++ b/libtommath/bn_mp_xor.c @@ -17,10 +17,11 @@ /* XOR two ints together */ int -mp_xor (mp_int * a, mp_int * b, mp_int * c) +mp_xor (const mp_int * a, const mp_int * b, mp_int * c) { int res, ix, px; - mp_int t, *x; + mp_int t; + const mp_int *x; if (a->used > b->used) { if ((res = mp_init_copy (&t, a)) != MP_OKAY) { diff --git a/libtommath/bn_s_mp_add.c b/libtommath/bn_s_mp_add.c index 7a100e8..432e3b4 100644 --- a/libtommath/bn_s_mp_add.c +++ b/libtommath/bn_s_mp_add.c @@ -17,9 +17,9 @@ /* low level addition, based on HAC pp.594, Algorithm 14.7 */ int -s_mp_add (mp_int * a, mp_int * b, mp_int * c) +s_mp_add (const mp_int * a, const mp_int * b, mp_int * c) { - mp_int *x; + const mp_int *x; int olduse, res, min, max; /* find sizes, we let |a| <= |b| which means we have to sort diff --git a/libtommath/bn_s_mp_mul_digs.c b/libtommath/bn_s_mp_mul_digs.c index 8f1bf97..d32bf15 100644 --- a/libtommath/bn_s_mp_mul_digs.c +++ b/libtommath/bn_s_mp_mul_digs.c @@ -19,7 +19,7 @@ * HAC pp. 595, Algorithm 14.12 Modified so you can control how * many digits of output are created. */ -int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) +int s_mp_mul_digs (const mp_int * a, const mp_int * b, mp_int * c, int digs) { mp_int t; int res, pa, pb, ix, iy; diff --git a/libtommath/bn_s_mp_sqr.c b/libtommath/bn_s_mp_sqr.c index ac0e157..de6a3ea 100644 --- a/libtommath/bn_s_mp_sqr.c +++ b/libtommath/bn_s_mp_sqr.c @@ -16,7 +16,7 @@ */ /* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */ -int s_mp_sqr (mp_int * a, mp_int * b) +int s_mp_sqr (const mp_int * a, mp_int * b) { mp_int t; int res, ix, iy, pa; diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c index 8091f4a..7f49d66 100644 --- a/libtommath/bn_s_mp_sub.c +++ b/libtommath/bn_s_mp_sub.c @@ -17,7 +17,7 @@ /* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */ int -s_mp_sub (mp_int * a, mp_int * b, mp_int * c) +s_mp_sub (const mp_int * a, const mp_int * b, mp_int * c) { int olduse, res, min, max; diff --git a/libtommath/tommath.h b/libtommath/tommath.h index a8c9e21..b183b8a 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -288,13 +288,13 @@ int mp_rand(mp_int *a, int digits); /* ---> binary operations <--- */ /* c = a XOR b */ -int mp_xor(mp_int *a, mp_int *b, mp_int *c); +int mp_xor(const mp_int *a, const mp_int *b, mp_int *c); /* c = a OR b */ -int mp_or(mp_int *a, mp_int *b, mp_int *c); +int mp_or(const mp_int *a, const mp_int *b, mp_int *c); /* c = a AND b */ -int mp_and(mp_int *a, mp_int *b, mp_int *c); +int mp_and(const mp_int *a, const mp_int *b, mp_int *c); /* ---> Basic arithmetic <--- */ @@ -302,7 +302,7 @@ int mp_and(mp_int *a, mp_int *b, mp_int *c); int mp_neg(const mp_int *a, mp_int *b); /* b = |a| */ -int mp_abs(mp_int *a, mp_int *b); +int mp_abs(const mp_int *a, mp_int *b); /* compare a to b */ int mp_cmp(const mp_int *a, const mp_int *b); @@ -311,22 +311,22 @@ int mp_cmp(const mp_int *a, const mp_int *b); int mp_cmp_mag(const mp_int *a, const mp_int *b); /* c = a + b */ -int mp_add(mp_int *a, mp_int *b, mp_int *c); +int mp_add(const mp_int *a, const mp_int *b, mp_int *c); /* c = a - b */ -int mp_sub(mp_int *a, mp_int *b, mp_int *c); +int mp_sub(const mp_int *a, const mp_int *b, mp_int *c); /* c = a * b */ -int mp_mul(mp_int *a, mp_int *b, mp_int *c); +int mp_mul(const mp_int *a, const mp_int *b, mp_int *c); /* b = a*a */ -int mp_sqr(mp_int *a, mp_int *b); +int mp_sqr(const mp_int *a, mp_int *b); /* a/b => cb + d == a */ -int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d); /* c = a mod b, 0 <= c < b */ -int mp_mod(mp_int *a, mp_int *b, mp_int *c); +int mp_mod(const mp_int *a, const mp_int *b, mp_int *c); /* ---> single digit functions <--- */ @@ -334,26 +334,26 @@ int mp_mod(mp_int *a, mp_int *b, mp_int *c); int mp_cmp_d(const mp_int *a, mp_digit b); /* c = a + b */ -int mp_add_d(mp_int *a, mp_digit b, mp_int *c); +int mp_add_d(const mp_int *a, const mp_digit b, mp_int *c); /* c = a - b */ int mp_sub_d(mp_int *a, mp_digit b, mp_int *c); /* c = a * b */ -int mp_mul_d(mp_int *a, mp_digit b, mp_int *c); +int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c); /* a/b => cb + d == a */ -int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d); +int mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d); /* a/3 => 3c + d == a */ -int mp_div_3(mp_int *a, mp_int *c, mp_digit *d); +int mp_div_3(const mp_int *a, mp_int *c, mp_digit *d); /* c = a**b */ -int mp_expt_d(mp_int *a, mp_digit b, mp_int *c); -int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast); +int mp_expt_d(const mp_int *a, const mp_digit b, mp_int *c); +int mp_expt_d_ex (const mp_int * a, const mp_digit b, mp_int * c, int fast); /* c = a mod b, 0 <= c < b */ -int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c); +int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c); /* ---> number theory <--- */ @@ -389,7 +389,7 @@ int mp_n_root(mp_int *a, mp_digit b, mp_int *c); int mp_n_root_ex (mp_int * a, mp_digit b, mp_int * c, int fast); /* special sqrt algo */ -int mp_sqrt(mp_int *arg, mp_int *ret); +int mp_sqrt(const mp_int *arg, mp_int *ret); /* special sqrt (mod prime) */ int mp_sqrtmod_prime(mp_int *arg, mp_int *prime, mp_int *ret); diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index 3217ee7..07607a8 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -57,19 +57,19 @@ extern "C" { #endif /* lowlevel functions, do not call! */ -int s_mp_add(mp_int *a, mp_int *b, mp_int *c); -int s_mp_sub(mp_int *a, mp_int *b, mp_int *c); +int s_mp_add(const mp_int *a, const mp_int *b, mp_int *c); +int s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c); #define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1) -int fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -int s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs); +int fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); +int s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); int s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -int fast_s_mp_sqr(mp_int *a, mp_int *b); -int s_mp_sqr(mp_int *a, mp_int *b); -int mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c); -int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c); -int mp_karatsuba_sqr(mp_int *a, mp_int *b); -int mp_toom_sqr(mp_int *a, mp_int *b); +int fast_s_mp_sqr(const mp_int *a, mp_int *b); +int s_mp_sqr(const mp_int *a, mp_int *b); +int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c); +int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c); +int mp_karatsuba_sqr(const mp_int *a, mp_int *b); +int mp_toom_sqr(const mp_int *a, mp_int *b); int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c); int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c); int fast_mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho); -- cgit v0.12