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

# beecrypt/mp32barrett.h

Go to the documentation of this file.

    00001
    00007 /*
    00008  * Copyright (c) 1997, 1998, 1999, 2000, 2001 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 _MP32BARRETT_H
    00029 #define _MP32BARRETT_H
    00030
    00031 #include "beecrypt.h"
    00032 #include "mp32number.h"
    00033
    00034 typedef struct
    00035 {
    00036         uint32  size;
    00037 /*@owned@*/
    00038         uint32* modl;   /* (size) words */
    00039 /*@dependent@*/ /*@null@*/
    00040         uint32* mu;     /* (size+1) words */
    00041 } mp32barrett;
    00042
    00043 #ifdef __cplusplus
    00044 extern "C" {
    00045 #endif
    00046
    00049 BEECRYPTAPI
    00050 void mp32bzero(/*@out@*/ mp32barrett* b)
    00051         /*@modifies b->size, b->modl, b->mu @*/;
    00052
    00055 BEECRYPTAPI
    00056 void mp32binit(mp32barrett* b, uint32 size)
    00057         /*@modifies b->size, b->modl, b->mu @*/;
    00058
    00061 BEECRYPTAPI
    00062 void mp32bfree(/*@special@*/ mp32barrett* b)
    00063         /*@uses b->size, b->modl @*/
    00064         /*@releases b->modl @*/
    00065         /*@modifies b->size, b->modl, b->mu @*/;
    00066
    00069 BEECRYPTAPI
    00070 void mp32bcopy(mp32barrett* b, const mp32barrett* copy)
    00071         /*@modifies b->size, b->modl, b->mu @*/;
    00072
    00075 BEECRYPTAPI
    00076 void mp32bset(mp32barrett* b, uint32 size, const uint32* data)
    00077         /*@modifies b->size, b->modl, b->mu @*/;
    00078
    00081 BEECRYPTAPI /*@unused@*/
    00082 void mp32bsethex(mp32barrett* b, const char* hex)
    00083         /*@modifies b->size, b->modl, b->mu @*/;
    00084
    00087 BEECRYPTAPI
    00088 void mp32bsubone(const mp32barrett* b, uint32* result)
    00089         /*@modifies result @*/;
    00090
    00093 BEECRYPTAPI /*@unused@*/
    00094 void mp32bneg(const mp32barrett* b, const uint32* xdata, uint32* result)
    00095         /*@modifies result @*/;
    00096
    00099 BEECRYPTAPI
    00100 void mp32bmu_w(mp32barrett* b, /*@out@*/ uint32* wksp)
    00101         /*@modifies b->size, b->modl, b->mu, wksp @*/;
    00102
    00105 BEECRYPTAPI
    00106 void mp32brnd_w   (const mp32barrett* b, randomGeneratorContext* rc, /*@out@*/ uint32* result, /*@out@*/ uint32* wksp)
    00107         /*@modifies result, wksp @*/;
    00108
    00111 /*@-exportlocal@*/
    00112 BEECRYPTAPI
    00113 void mp32brndodd_w(const mp32barrett* b, randomGeneratorContext* rc, /*@out@*/ uint32* result, /*@out@*/ uint32* wksp)
    00114         /*@modifies result, wksp @*/;
    00115 /*@=exportlocal@*/
    00116
    00119 BEECRYPTAPI
    00120 void mp32brndinv_w(const mp32barrett* b, randomGeneratorContext* rc, /*@out@*/ uint32* result, /*@out@*/ uint32* inverse, /*@out@*/ uint32* wksp)
    00121         /*@modifies result, inverse, wksp @*/;
    00122
    00125 BEECRYPTAPI
    00126 void mp32bmod_w(const mp32barrett* b, const uint32* xdata, /*@out@*/ uint32* result, /*@out@*/ uint32* wksp)
    00127         /*@modifies result, wksp @*/;
    00128
    00131 BEECRYPTAPI
    00132 void mp32baddmod_w(const mp32barrett* b, uint32 xsize, const uint32* xdata, uint32 ysize, const uint32* ydata, /*@out@*/ uint32* result, /*@out@*/ uint32* wksp)
    00133         /*@modifies result, wksp @*/;
    00134
    00137 BEECRYPTAPI /*@unused@*/
    00138 void mp32bsubmod_w(const mp32barrett* b, uint32 xsize, const uint32* xdata, uint32 ysize, const uint32* ydata, /*@out@*/ uint32* result, /*@out@*/ uint32* wksp)
    00139         /*@modifies result, wksp @*/;
    00140
    00143 BEECRYPTAPI
    00144 void mp32bmulmod_w(const mp32barrett* b, uint32 xsize, const uint32* xdata, uint32 ysize, const uint32* ydata, /*@out@*/ uint32* result, /*@out@*/ uint32* wksp)
    00145         /*@modifies result, wksp @*/;
    00146
    00149 BEECRYPTAPI
    00150 void mp32bsqrmod_w(const mp32barrett* b, uint32 xsize, const uint32* xdata, /*@out@*/ uint32* result, /*@out@*/ uint32* wksp)
    00151         /*@modifies result, wksp @*/;
    00152
    00155 BEECRYPTAPI
    00156 void mp32bpowmod_w(const mp32barrett* b, uint32 xsize, const uint32* xdata, uint32 psize, const uint32* pdata, /*@out@*/ uint32* result, /*@out@*/ uint32* wksp)
    00157         /*@modifies result, wksp @*/;
    00158
    00161 /*@-exportlocal@*/
    00162 BEECRYPTAPI
    00163 void mp32bpowmodsld_w(const mp32barrett* b, const uint32* slide, uint32 psize, const uint32* pdata, /*@out@*/ uint32* result, /*@out@*/ uint32* wksp)
    00164         /*@globals internalState @*/
    00165         /*@modifies result, wksp, internalState @*/;
    00166 /*@=exportlocal@*/
    00167
    00170 BEECRYPTAPI
    00171 void mp32btwopowmod_w(const mp32barrett* b, uint32 psize, const uint32* pdata, /*@out@*/ uint32* result, /*@out@*/ uint32* wksp)
    00172         /*@modifies result, wksp @*/;
    00173
    00176 BEECRYPTAPI
    00177 int  mp32binv_w(const mp32barrett* b, uint32 xsize, const uint32* xdata, /*@out@*/ uint32* result, /*@out@*/ uint32* wksp)
    00178         /*@modifies result, wksp @*/;
    00179
    00180 #ifdef  NOTYET
    00181
    00185 BEECRYPTAPI /*@unused@*/
    00186 void mp32bsm2powmod(const mp32barrett* b, const uint32*, const uint32*, const uint32*, const uint32*);
    00187
    00190 BEECRYPTAPI /*@unused@*/
    00191 void mp32bsm3powmod(const mp32barrett* b, const uint32*, const uint32*, const uint32*, const uint32*, const uint32*, const uint32*);
    00192 #endif  /* NOTYET */
    00193
    00196 BEECRYPTAPI /*@unused@*/
    00197 int  mp32bpprime_w(const mp32barrett* b, randomGeneratorContext* rc, int t, /*@out@*/ uint32* wksp)
    00198         /*@modifies wksp @*/;
    00199
    00203 BEECRYPTAPI
    00204 void mp32bnrnd(const mp32barrett* b, randomGeneratorContext* rc, mp32number* result)
    00205         /*@modifies result @*/;
    00206
    00210 BEECRYPTAPI /*@unused@*/
    00211 void mp32bnmulmod(const mp32barrett* b, const mp32number* x, const mp32number* y, mp32number* result)
    00212         /*@modifies result @*/;
    00213
    00217 BEECRYPTAPI /*@unused@*/
    00218 void mp32bnsqrmod(const mp32barrett* b, const mp32number* x, mp32number* result)
    00219         /*@modifies result @*/;
    00220
    00224 BEECRYPTAPI
    00225 void mp32bnpowmod   (const mp32barrett* b, const mp32number* x, const mp32number* pow, mp32number* y)
    00226         /*@modifies y @*/;
    00227
    00231 BEECRYPTAPI /*@unused@*/
    00232 void mp32bnpowmodsld(const mp32barrett* b, const uint32* slide, const mp32number* pow, mp32number* y)
    00233         /*@modifies y @*/;
    00234
    00235 #ifdef __cplusplus
    00236 }
    00237 #endif
    00238
    00239 #endif