Multiple-precision Integer Arithmetic
Library for Palm OS
(MPLib)

Current Version: 0.2 (Feb 11, 2001)


What's MPLib?

MPLib is a free system library for Palm OS. It contains functions to perform multiple-precision integer arithmetic operations. It also includes some other useful and related algorithms. There is no limit to the precision except the available dynamic memory implied by the memory manager of your Palm OS. MPLib has a rich set of functions, and the functions have a regular interface. A complete list of the functions currently provided by the latest version of MPLib can be found in the User's Manual. This library can be used in collaboration with my other cryptographic libraries to implement most of the well-known public-key cryptosystems on a Palm Pilot.

This library was written as a system library (not in GLib format) for benefiting the full support from the latest version of Palm OS and the developing tools. The system library is supported by the Palm OS SysLib* API calls and is officially described in Palm OS FAQ Shared Libraries and Other Advanced Project Types. It is a runtime shared library which allows Palm applications or other shared libraries using the MPLib functions dynamically. This in terms saves the applications from keeping copies of the same code in their own code resources. Another advantage of implementing those functions in the form of a shared library is to overcome two memory constraints of Palm OS namely the 32KB jump limit (CodeWarrior default model) and the code resource size limit.

Another type of shared libraries is called GLib, which is more user-friendly (or programmer-friendly) than the system library mentioned above and is also faster because no systraps are done when calling the GLib functions. However, as of this writing, neither CodeWarrior nor the latest version of PRC-Tools supports GLibs. Only PRC-Tools 0.5.0 and Michael Sokolov's 0.6.0 beta do so. This is also one of the reasons of implementing the library as a system library instead of a GLib.

MPLib is a side-product of my researches. I have written and collected some useful functions for experimenting cryptographic algorithms and protocols on Palm devices. The library is just a nicer collection of some of these functions. My intention is to continue enriching this library so to make it more useful to researches or any other applications you can think of.


How to Use?

If you just want to use the MPLib with your Palm programs, simply follow the steps below to download the files and learn how to use them.

  1. Download the PRC file, MPLib.prc and install it to your Palm Pilot.

  2. Download header files, MPLib.h and mp.h.
    Your Palm program only needs to include the MPLib.h header file. The header file, mp.h, which contains the data structure of multiple-precision integers and other related structures and macros, has already been included in MPLib.h.

  3. Download Testbed_1_0.zip as a demo.
    This ZIP file contains a CodeWarrior Release 6 project, the source code and the binary Testbed.prc. It demonstrates how to use the library. To compile it, you need Palm OS SDK version 3.5.

  4. Finally, download MPLib User's Manual and learn the library functions. I'll polish a better one when I have time.
For people who are interested in getting the source, you can download it by clicking the link below. It contains all the source code, CodeWarrior project files, binaries and the user's manual.

MPLib_0_2.zip

I have only tested the library on my Palm V with Palm OS v3.3 so far. So your feedbacks of running the library on other Palm devices are welcome. This library is in the public domain. You can distribute, copy or modify the code as you will. I would also appreciate any comments, bug reports and enhancements.

Changes Log

Changes with MPLib v0.2 (Feb 11, 2001)
- Add Garner's algorithm for CRT on special case of two moduli: MPLibMP_crt2
- Add primality test algorithm: MPLibMP_probab_prime


THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.


Duncan S. Wong
swong@ccs.neu.edu
Mar 5, 2001