Main Page Modules Data Structures File List Data Fields Globals Related Pages

# beecrypt/mp32.h

Go to the documentation of this file.

    00001
    00007 /*
    00008  * Copyright (c) 1997, 1998, 1999, 2000  Virtual Unlimited B.V.
    00009  *
    00010  * Author: Bob Deblier <bob@virtualunlimited.com>
    00011  *
    00012  * This library is free software; you can redistribute it and/or
    00013  * modify it under the terms of the GNU Lesser General Public
    00014  * License as published by the Free Software Foundation; either
    00015  * version 2.1 of the License, or (at your option) any later version.
    00016  *
    00017  * This library is distributed in the hope that it will be useful,
    00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00020  * Lesser General Public License for more details.
    00021  *
    00022  * You should have received a copy of the GNU Lesser General Public
    00023  * License along with this library; if not, write to the Free Software
    00024  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00025  *
    00026  */
    00027
    00028 #ifndef _MP32_H
    00029 #define _MP32_H
    00030
    00031 #include "beecrypt.h"
    00032
    00033 #if HAVE_STRING_H
    00034 # include <string.h>
    00035 #endif
    00036 #include <stdio.h>
    00037
    00038 #include "mp32opt.h"
    00039
    00040 #ifdef __cplusplus
    00041 extern "C" {
    00042 #endif
    00043
    00046 BEECRYPTAPI /*@unused@*/
    00047 void mp32copy(uint32 size, /*@out@*/ uint32* dst, const uint32* src)
    00048         /*@modifies dst @*/;
    00049 #ifndef ASM_MP32COPY
    00050 #ifdef  __LCLINT__
    00051 # define mp32copy(size, dst, src) memmove(dst, src, ((unsigned)(size)) << 2)
    00052 #else
    00053 # define mp32copy(size, dst, src) memcpy(dst, src, (size) << 2)
    00054 #endif
    00055 #endif
    00056
    00059 BEECRYPTAPI /*@unused@*/
    00060 void mp32move(uint32 size, /*@out@*/ uint32* dst, const uint32* src)
    00061         /*@modifies dst @*/;
    00062 #ifndef ASM_MP32MOVE
    00063 #ifdef  __LCLINT__
    00064 # define mp32move(size, dst, src) memmove(dst, src, ((unsigned)(size)) << 2)
    00065 #else
    00066 # define mp32move(size, dst, src) memmove(dst, src, (size) << 2)
    00067 #endif
    00068 #endif
    00069
    00072 BEECRYPTAPI
    00073 void mp32zero(uint32 xsize, /*@out@*/ uint32* xdata)
    00074         /*@modifies xdata @*/;
    00075
    00078 BEECRYPTAPI /*@unused@*/
    00079 void mp32fill(uint32 xsize, /*@out@*/ uint32* xdata, uint32 val)
    00080         /*@modifies xdata @*/;
    00081
    00084 BEECRYPTAPI
    00085 int mp32odd (uint32 xsize, const uint32* xdata)
    00086         /*@*/;
    00087
    00090 BEECRYPTAPI
    00091 int mp32even(uint32 xsize, const uint32* xdata)
    00092         /*@*/;
    00093
    00096 BEECRYPTAPI
    00097 int mp32z  (uint32 xsize, const uint32* xdata)
    00098         /*@*/;
    00099
    00102 /*@-exportlocal@*/
    00103 BEECRYPTAPI
    00104 int mp32nz (uint32 xsize, const uint32* xdata)
    00105         /*@*/;
    00106 /*@=exportlocal@*/
    00107
    00110 BEECRYPTAPI
    00111 int mp32eq (uint32 size, const uint32* xdata, const uint32* ydata)
    00112         /*@*/;
    00113
    00116 /*@-exportlocal@*/
    00117 BEECRYPTAPI
    00118 int mp32ne (uint32 size, const uint32* xdata, const uint32* ydata)
    00119         /*@*/;
    00120 /*@=exportlocal@*/
    00121
    00124 /*@-exportlocal@*/
    00125 BEECRYPTAPI
    00126 int mp32gt (uint32 size, const uint32* xdata, const uint32* ydata)
    00127         /*@*/;
    00128 /*@=exportlocal@*/
    00129
    00132 /*@-exportlocal@*/
    00133 BEECRYPTAPI
    00134 int mp32lt (uint32 size, const uint32* xdata, const uint32* ydata)
    00135         /*@*/;
    00136 /*@=exportlocal@*/
    00137
    00140 BEECRYPTAPI
    00141 int mp32ge (uint32 size, const uint32* xdata, const uint32* ydata)
    00142         /*@*/;
    00143
    00146 BEECRYPTAPI
    00147 int mp32le (uint32 size, const uint32* xdata, const uint32* ydata)
    00148         /*@*/;
    00149
    00152 BEECRYPTAPI
    00153 int mp32eqx(uint32 xsize, const uint32* xdata, uint32 ysize, const uint32* ydata)
    00154         /*@*/;
    00155
    00158 BEECRYPTAPI /*@unused@*/
    00159 int mp32nex(uint32 xsize, const uint32* xdata, uint32 ysize, const uint32* ydata)
    00160         /*@*/;
    00161
    00164 BEECRYPTAPI /*@unused@*/
    00165 int mp32gtx(uint32 xsize, const uint32* xdata, uint32 ysize, const uint32* ydata)
    00166         /*@*/;
    00167
    00170 BEECRYPTAPI /*@unused@*/
    00171 int mp32ltx(uint32 xsize, const uint32* xdata, uint32 ysize, const uint32* ydata)
    00172         /*@*/;
    00173
    00176 BEECRYPTAPI
    00177 int mp32gex(uint32 xsize, const uint32* xdata, uint32 ysize, const uint32* ydata)
    00178         /*@*/;
    00179
    00182 BEECRYPTAPI
    00183 int mp32lex(uint32 xsize, const uint32* xdata, uint32 ysize, const uint32* ydata)
    00184         /*@*/;
    00185
    00188 BEECRYPTAPI
    00189 int mp32isone(uint32 xsize, const uint32* xdata)
    00190         /*@*/;
    00191
    00194 BEECRYPTAPI
    00195 int mp32istwo(uint32 xsize, const uint32* xdata)
    00196         /*@*/;
    00197
    00200 BEECRYPTAPI
    00201 int mp32leone(uint32 xsize, const uint32* xdata)
    00202         /*@*/;
    00203
    00206 BEECRYPTAPI /*@unused@*/
    00207 int mp32eqmone(uint32 size, const uint32* xdata, const uint32* ydata)
    00208         /*@*/;
    00209
    00212 BEECRYPTAPI
    00213 int mp32msbset(uint32 xsize, const uint32* xdata)
    00214         /*@*/;
    00215
    00218 BEECRYPTAPI /*@unused@*/
    00219 int mp32lsbset(uint32 xsize, const uint32* xdata)
    00220         /*@*/;
    00221
    00224 BEECRYPTAPI /*@unused@*/
    00225 void mp32setmsb(uint32 xsize, uint32* xdata)
    00226         /*@modifies xdata @*/;
    00227
    00230 BEECRYPTAPI
    00231 void mp32setlsb(uint32 xsize, uint32* xdata)
    00232         /*@modifies xdata @*/;
    00233
    00236 BEECRYPTAPI /*@unused@*/
    00237 void mp32clrmsb(uint32 xsize, uint32* xdata)
    00238         /*@modifies xdata @*/;
    00239
    00242 BEECRYPTAPI /*@unused@*/
    00243 void mp32clrlsb(uint32 xsize, uint32* xdata)
    00244         /*@modifies xdata @*/;
    00245
    00248 BEECRYPTAPI /*@unused@*/
    00249 void mp32xor(uint32 size, uint32* xdata, const uint32* ydata)
    00250         /*@modifies xdata @*/;
    00251
    00254 /*@-exportlocal@*/
    00255 BEECRYPTAPI
    00256 void mp32not(uint32 xsize, uint32* xdata)
    00257         /*@modifies xdata @*/;
    00258 /*@=exportlocal@*/
    00259
    00262 BEECRYPTAPI
    00263 void mp32setw(uint32 xsize, /*@out@*/ uint32* xdata, uint32 y)
    00264         /*@modifies xdata @*/;
    00265
    00268 BEECRYPTAPI
    00269 void mp32setx(uint32 xsize, /*@out@*/ uint32* xdata, uint32 ysize, const uint32* ydata)
    00270         /*@modifies xdata @*/;
    00271
    00274 BEECRYPTAPI
    00275 uint32 mp32addw(uint32 xsize, uint32* xdata, uint32 y)
    00276         /*@modifies xdata @*/;
    00277
    00280 BEECRYPTAPI
    00281 uint32 mp32add (uint32 size, uint32* xdata, const uint32* ydata)
    00282         /*@modifies xdata @*/;
    00283
    00286 BEECRYPTAPI
    00287 uint32 mp32addx(uint32 xsize, uint32* xdata, uint32 ysize, const uint32* ydata)
    00288         /*@modifies xdata @*/;
    00289
    00292 BEECRYPTAPI
    00293 uint32 mp32subw(uint32 xsize, uint32* xdata, uint32 y)
    00294         /*@modifies xdata @*/;
    00295
    00298 BEECRYPTAPI
    00299 uint32 mp32sub (uint32 size, uint32* xdata, const uint32* ydata)
    00300         /*@modifies xdata @*/;
    00301
    00304 BEECRYPTAPI
    00305 uint32 mp32subx(uint32 xsize, uint32* xdata, uint32 ysize, const uint32* ydata)
    00306         /*@modifies xdata @*/;
    00307
    00310 BEECRYPTAPI
    00311 uint32 mp32multwo(uint32 xsize, uint32* xdata)
    00312         /*@modifies xdata @*/;
    00313
    00316 BEECRYPTAPI
    00317 void mp32neg(uint32 xsize, uint32* xdata)
    00318         /*@modifies xdata @*/;
    00319
    00322 BEECRYPTAPI /*@unused@*/
    00323 uint32 mp32size(uint32 xsize, const uint32* xdata)
    00324         /*@*/;
    00325
    00328 BEECRYPTAPI
    00329 uint32 mp32mszcnt(uint32 xsize, const uint32* xdata)
    00330         /*@*/;
    00331
    00334 /*@-exportlocal@*/
    00335 BEECRYPTAPI /*@unused@*/
    00336 uint32 mp32lszcnt(uint32 xsize, const uint32* xdata)
    00337         /*@*/;
    00338 /*@=exportlocal@*/
    00339
    00342 /*@-exportlocal@*/
    00343 BEECRYPTAPI
    00344 void mp32lshift(uint32 xsize, uint32* xdata, uint32 count)
    00345         /*@modifies xdata @*/;
    00346 /*@=exportlocal@*/
    00347
    00350 BEECRYPTAPI
    00351 void mp32rshift(uint32 xsize, uint32* xdata, uint32 count)
    00352         /*@modifies xdata @*/;
    00353
    00356 BEECRYPTAPI
    00357 uint32 mp32rshiftlsz(uint32 xsize, uint32* xdata)
    00358         /*@modifies xdata @*/;
    00359
    00362 BEECRYPTAPI
    00363 uint32 mp32norm(uint32 xsize, uint32* xdata)
    00364         /*@modifies xdata @*/;
    00365
    00368 BEECRYPTAPI /*@unused@*/
    00369 uint32 mp32divpowtwo(uint32 xsize, uint32* xdata)
    00370         /*@modifies xdata @*/;
    00371
    00374 BEECRYPTAPI
    00375 void mp32divtwo (uint32 xsize, uint32* xdata)
    00376         /*@modifies xdata @*/;
    00377
    00380 BEECRYPTAPI
    00381 void mp32sdivtwo(uint32 xsize, uint32* xdata)
    00382         /*@modifies xdata @*/;
    00383
    00386 BEECRYPTAPI
    00387 uint32 mp32setmul   (uint32 size, /*@out@*/ uint32* result, const uint32* xdata, uint32 y)
    00388         /*@modifies result @*/;
    00389
    00392 BEECRYPTAPI
    00393 uint32 mp32addmul   (uint32 size, /*@out@*/ uint32* result, const uint32* xdata, uint32 y)
    00394         /*@modifies result @*/;
    00395
    00398 /*@-exportlocal@*/
    00399 BEECRYPTAPI
    00400 uint32 mp32addsqrtrc(uint32 size, /*@out@*/ uint32* result, const uint32* xdata)
    00401         /*@modifies result @*/;
    00402 /*@=exportlocal@*/
    00403
    00406 BEECRYPTAPI
    00407 void mp32mul(/*@out@*/ uint32* result, uint32 xsize, const uint32* xdata, uint32 ysize, const uint32* ydata)
    00408         /*@modifies result @*/;
    00409
    00412 BEECRYPTAPI
    00413 void mp32sqr(/*@out@*/ uint32* result, uint32 xsize, const uint32* xdata)
    00414         /*@modifies result @*/;
    00415
    00418 BEECRYPTAPI
    00419 void mp32gcd_w(uint32 size, const uint32* xdata, const uint32* ydata, /*@out@*/ uint32* result, /*@out@*/ uint32* wksp)
    00420         /*@modifies result, wksp @*/;
    00421
    00424 BEECRYPTAPI /*@unused@*/
    00425 uint32 mp32nmodw(/*@out@*/ uint32* result, uint32 xsize, const uint32* xdata, uint32 y, /*@out@*/ uint32* wksp)
    00426         /*@modifies result, wksp @*/;
    00427
    00430 BEECRYPTAPI /*@unused@*/
    00431 void mp32nmod(/*@out@*/ uint32* result, uint32 xsize, const uint32* xdata, uint32 ysize, const uint32* ydata, /*@out@*/ uint32* wksp)
    00432         /*@modifies result, wksp @*/;
    00433
    00436 BEECRYPTAPI
    00437 void mp32ndivmod(/*@out@*/ uint32* result, uint32 xsize, const uint32* xdata, uint32 ysize, const uint32* ydata, /*@out@*/ uint32* wksp)
    00438         /*@modifies result, wksp @*/;
    00439
    00442 BEECRYPTAPI /*@unused@*/
    00443 void mp32print(/*@null@*/ FILE * fp, uint32 xsize, /*@null@*/ const uint32* xdata)
    00444         /*@globals fileSystem @*/
    00445         /*@modifies *fp, fileSystem @*/;
    00446
    00449 BEECRYPTAPI /*@unused@*/
    00450 void mp32println(/*@null@*/ FILE * fp, uint32 xsize, /*@null@*/ const uint32* xdata)
    00451         /*@globals fileSystem @*/
    00452         /*@modifies *fp, fileSystem @*/;
    00453
    00454 #ifdef __cplusplus
    00455 }
    00456 #endif
    00457
    00458 #endif