#include "postgres.h"#include "px.h"#include "mbuf.h"#include "pgp.h"
Go to the source code of this file.
Functions | |
| int | pgp_mpi_alloc (int bits, PGP_MPI **mpi) |
| int | pgp_mpi_create (uint8 *data, int bits, PGP_MPI **mpi) |
| int | pgp_mpi_free (PGP_MPI *mpi) |
| int | pgp_mpi_read (PullFilter *src, PGP_MPI **mpi) |
| int | pgp_mpi_write (PushFilter *dst, PGP_MPI *n) |
| int | pgp_mpi_hash (PX_MD *md, PGP_MPI *n) |
| unsigned | pgp_mpi_cksum (unsigned cksum, PGP_MPI *n) |
| int pgp_mpi_alloc | ( | int | bits, | |
| PGP_MPI ** | mpi | |||
| ) |
Definition at line 38 of file pgp-mpi.c.
References PGP_MPI::bits, PGP_MPI::bytes, PGP_MPI::data, px_alloc, and px_debug().
Referenced by bn_to_mpi(), pgp_mpi_create(), and pgp_mpi_read().
| unsigned pgp_mpi_cksum | ( | unsigned | cksum, | |
| PGP_MPI * | n | |||
| ) |
Definition at line 133 of file pgp-mpi.c.
References PGP_MPI::bits, PGP_MPI::bytes, PGP_MPI::data, and i.
Referenced by check_key_cksum().
Definition at line 57 of file pgp-mpi.c.
References PGP_MPI::bytes, PGP_MPI::data, and pgp_mpi_alloc().
Referenced by create_secmsg().
{
int res;
PGP_MPI *n;
res = pgp_mpi_alloc(bits, &n);
if (res < 0)
return res;
memcpy(n->data, data, n->bytes);
*mpi = n;
return 0;
}
| int pgp_mpi_free | ( | PGP_MPI * | mpi | ) |
Definition at line 71 of file pgp-mpi.c.
References PGP_MPI::bytes, NULL, and px_free.
Referenced by bn_to_mpi(), decrypt_elgamal(), decrypt_rsa(), encrypt_and_write_elgamal(), encrypt_and_write_rsa(), pgp_key_free(), pgp_mpi_read(), and pgp_parse_pubenc_sesskey().
Definition at line 120 of file pgp-mpi.c.
References PGP_MPI::bits, buf, PGP_MPI::bytes, PGP_MPI::data, and px_md_update.
Referenced by calc_key_id(), and check_key_sha1().
{
uint8 buf[2];
buf[0] = n->bits >> 8;
buf[1] = n->bits & 0xFF;
px_md_update(md, buf, 2);
px_md_update(md, n->data, n->bytes);
return 0;
}
| int pgp_mpi_read | ( | PullFilter * | src, | |
| PGP_MPI ** | mpi | |||
| ) |
Definition at line 81 of file pgp-mpi.c.
References PGP_MPI::bytes, PGP_MPI::data, pgp_mpi_alloc(), pgp_mpi_free(), and pullf_read_fixed().
Referenced by _pgp_read_public_key(), decrypt_elgamal(), decrypt_rsa(), and process_secret_key().
{
int res;
uint8 hdr[2];
int bits;
PGP_MPI *n;
res = pullf_read_fixed(src, 2, hdr);
if (res < 0)
return res;
bits = ((unsigned) hdr[0] << 8) + hdr[1];
res = pgp_mpi_alloc(bits, &n);
if (res < 0)
return res;
res = pullf_read_fixed(src, n->bytes, n->data);
if (res < 0)
pgp_mpi_free(n);
else
*mpi = n;
return res;
}
| int pgp_mpi_write | ( | PushFilter * | dst, | |
| PGP_MPI * | n | |||
| ) |
Definition at line 106 of file pgp-mpi.c.
References PGP_MPI::bits, buf, PGP_MPI::bytes, PGP_MPI::data, and pushf_write().
Referenced by encrypt_and_write_elgamal(), and encrypt_and_write_rsa().
{
int res;
uint8 buf[2];
buf[0] = n->bits >> 8;
buf[1] = n->bits & 0xFF;
res = pushf_write(dst, buf, 2);
if (res >= 0)
res = pushf_write(dst, n->data, n->bytes);
return res;
}
1.7.1