~ubuntu-branches/ubuntu/natty/postgresql-8.4/natty-security

« back to all changes in this revision

Viewing changes to contrib/pgcrypto/pgp-mpi-internal.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-11 16:59:35 UTC
  • mfrom: (5.1.1 karmic)
  • Revision ID: james.westby@ubuntu.com-20090711165935-jfwin6gfrxf0gfsi
Tags: 8.4.0-2
* debian/libpq-dev.install: Ship catalog/genbki.h. (Closes: #536139)
* debian/rules: Drop --enable-cassert for final release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
27
 * SUCH DAMAGE.
28
28
 *
29
 
 * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-mpi-internal.c,v 1.7 2006/10/04 00:29:46 momjian Exp $
 
29
 * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-mpi-internal.c,v 1.8 2009/06/11 14:48:52 momjian Exp $
30
30
 */
31
31
#include "postgres.h"
32
32
 
46
46
}
47
47
 
48
48
static void
49
 
mp_clear_free(mpz_t * a)
 
49
mp_clear_free(mpz_t *a)
50
50
{
51
51
        if (!a)
52
52
                return;
56
56
 
57
57
 
58
58
static int
59
 
mp_px_rand(uint32 bits, mpz_t * res)
 
59
mp_px_rand(uint32 bits, mpz_t *res)
60
60
{
61
61
        int                     err;
62
62
        unsigned        bytes = (bits + 7) / 8;
88
88
}
89
89
 
90
90
static void
91
 
mp_modmul(mpz_t * a, mpz_t * b, mpz_t * p, mpz_t * res)
 
91
mp_modmul(mpz_t *a, mpz_t *b, mpz_t *p, mpz_t *res)
92
92
{
93
93
        mpz_t      *tmp = mp_new();
94
94
 
98
98
}
99
99
 
100
100
static mpz_t *
101
 
mpi_to_bn(PGP_MPI * n)
 
101
mpi_to_bn(PGP_MPI *n)
102
102
{
103
103
        mpz_t      *bn = mp_new();
104
104
 
117
117
}
118
118
 
119
119
static PGP_MPI *
120
 
bn_to_mpi(mpz_t * bn)
 
120
bn_to_mpi(mpz_t *bn)
121
121
{
122
122
        int                     res;
123
123
        PGP_MPI    *n;
164
164
}
165
165
 
166
166
int
167
 
pgp_elgamal_encrypt(PGP_PubKey * pk, PGP_MPI * _m,
168
 
                                        PGP_MPI ** c1_p, PGP_MPI ** c2_p)
 
167
pgp_elgamal_encrypt(PGP_PubKey *pk, PGP_MPI *_m,
 
168
                                        PGP_MPI **c1_p, PGP_MPI **c2_p)
169
169
{
170
170
        int                     res = PXE_PGP_MATH_FAILED;
171
171
        int                     k_bits;
214
214
}
215
215
 
216
216
int
217
 
pgp_elgamal_decrypt(PGP_PubKey * pk, PGP_MPI * _c1, PGP_MPI * _c2,
218
 
                                        PGP_MPI ** msg_p)
 
217
pgp_elgamal_decrypt(PGP_PubKey *pk, PGP_MPI *_c1, PGP_MPI *_c2,
 
218
                                        PGP_MPI **msg_p)
219
219
{
220
220
        int                     res = PXE_PGP_MATH_FAILED;
221
221
        mpz_t      *c1 = mpi_to_bn(_c1);
252
252
}
253
253
 
254
254
int
255
 
pgp_rsa_encrypt(PGP_PubKey * pk, PGP_MPI * _m, PGP_MPI ** c_p)
 
255
pgp_rsa_encrypt(PGP_PubKey *pk, PGP_MPI *_m, PGP_MPI **c_p)
256
256
{
257
257
        int                     res = PXE_PGP_MATH_FAILED;
258
258
        mpz_t      *m = mpi_to_bn(_m);
280
280
}
281
281
 
282
282
int
283
 
pgp_rsa_decrypt(PGP_PubKey * pk, PGP_MPI * _c, PGP_MPI ** m_p)
 
283
pgp_rsa_decrypt(PGP_PubKey *pk, PGP_MPI *_c, PGP_MPI **m_p)
284
284
{
285
285
        int                     res = PXE_PGP_MATH_FAILED;
286
286
        mpz_t      *c = mpi_to_bn(_c);