* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/openssl.c,v 1.32 2007/11/15 21:14:31 momjian Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/openssl.c,v 1.33 2009/06/11 14:48:52 momjian Exp $
*/
#include "postgres.h"
#include "sha2.c"
#include "internal-sha2.c"
-typedef void (*init_f) (PX_MD * md);
+typedef void (*init_f) (PX_MD *md);
static int
-compat_find_digest(const char *name, PX_MD ** res)
+compat_find_digest(const char *name, PX_MD **res)
{
init_f init = NULL;
{
const EVP_MD *algo;
EVP_MD_CTX ctx;
-} OSSLDigest;
+} OSSLDigest;
static unsigned
-digest_result_size(PX_MD * h)
+digest_result_size(PX_MD *h)
{
OSSLDigest *digest = (OSSLDigest *) h->p.ptr;
}
static unsigned
-digest_block_size(PX_MD * h)
+digest_block_size(PX_MD *h)
{
OSSLDigest *digest = (OSSLDigest *) h->p.ptr;
}
static void
-digest_reset(PX_MD * h)
+digest_reset(PX_MD *h)
{
OSSLDigest *digest = (OSSLDigest *) h->p.ptr;
}
static void
-digest_update(PX_MD * h, const uint8 *data, unsigned dlen)
+digest_update(PX_MD *h, const uint8 *data, unsigned dlen)
{
OSSLDigest *digest = (OSSLDigest *) h->p.ptr;
}
static void
-digest_finish(PX_MD * h, uint8 *dst)
+digest_finish(PX_MD *h, uint8 *dst)
{
OSSLDigest *digest = (OSSLDigest *) h->p.ptr;
}
static void
-digest_free(PX_MD * h)
+digest_free(PX_MD *h)
{
OSSLDigest *digest = (OSSLDigest *) h->p.ptr;
/* PUBLIC functions */
int
-px_find_digest(const char *name, PX_MD ** res)
+px_find_digest(const char *name, PX_MD **res)
{
const EVP_MD *md;
PX_MD *h;
struct ossl_cipher
{
- int (*init) (PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv);
- int (*encrypt) (PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res);
- int (*decrypt) (PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res);
+ int (*init) (PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv);
+ int (*encrypt) (PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res);
+ int (*decrypt) (PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res);
int block_size;
int max_key_size;
unsigned klen;
unsigned init;
const struct ossl_cipher *ciph;
-} ossldata;
+} ossldata;
/* generic */
static unsigned
-gen_ossl_block_size(PX_Cipher * c)
+gen_ossl_block_size(PX_Cipher *c)
{
ossldata *od = (ossldata *) c->ptr;
}
static unsigned
-gen_ossl_key_size(PX_Cipher * c)
+gen_ossl_key_size(PX_Cipher *c)
{
ossldata *od = (ossldata *) c->ptr;
}
static unsigned
-gen_ossl_iv_size(PX_Cipher * c)
+gen_ossl_iv_size(PX_Cipher *c)
{
unsigned ivlen;
ossldata *od = (ossldata *) c->ptr;
}
static void
-gen_ossl_free(PX_Cipher * c)
+gen_ossl_free(PX_Cipher *c)
{
ossldata *od = (ossldata *) c->ptr;
}
static int
-bf_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
+bf_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv)
{
ossldata *od = c->ptr;
static int bf_is_strong = -1;
}
static int
-bf_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
+bf_ecb_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res)
{
unsigned bs = gen_ossl_block_size(c);
unsigned i;
}
static int
-bf_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
+bf_ecb_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res)
{
unsigned bs = gen_ossl_block_size(c),
i;
}
static int
-bf_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
+bf_cbc_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res)
{
ossldata *od = c->ptr;
}
static int
-bf_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
+bf_cbc_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res)
{
ossldata *od = c->ptr;
}
static int
-bf_cfb64_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
+bf_cfb64_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res)
{
ossldata *od = c->ptr;
}
static int
-bf_cfb64_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
+bf_cfb64_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res)
{
ossldata *od = c->ptr;
/* DES */
static int
-ossl_des_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
+ossl_des_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv)
{
ossldata *od = c->ptr;
DES_cblock xkey;
}
static int
-ossl_des_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
+ossl_des_ecb_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen,
uint8 *res)
{
unsigned bs = gen_ossl_block_size(c);
}
static int
-ossl_des_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
+ossl_des_ecb_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen,
uint8 *res)
{
unsigned bs = gen_ossl_block_size(c);
}
static int
-ossl_des_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
+ossl_des_cbc_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen,
uint8 *res)
{
ossldata *od = c->ptr;
}
static int
-ossl_des_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
+ossl_des_cbc_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen,
uint8 *res)
{
ossldata *od = c->ptr;
/* DES3 */
static int
-ossl_des3_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
+ossl_des3_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv)
{
ossldata *od = c->ptr;
DES_cblock xkey1,
}
static int
-ossl_des3_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
+ossl_des3_ecb_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen,
uint8 *res)
{
unsigned bs = gen_ossl_block_size(c);
}
static int
-ossl_des3_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
+ossl_des3_ecb_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen,
uint8 *res)
{
unsigned bs = gen_ossl_block_size(c);
}
static int
-ossl_des3_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
+ossl_des3_cbc_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen,
uint8 *res)
{
ossldata *od = c->ptr;
}
static int
-ossl_des3_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
+ossl_des3_cbc_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen,
uint8 *res)
{
ossldata *od = c->ptr;
/* CAST5 */
static int
-ossl_cast_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
+ossl_cast_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv)
{
ossldata *od = c->ptr;
unsigned bs = gen_ossl_block_size(c);
}
static int
-ossl_cast_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
+ossl_cast_ecb_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res)
{
unsigned bs = gen_ossl_block_size(c);
ossldata *od = c->ptr;
}
static int
-ossl_cast_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
+ossl_cast_ecb_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res)
{
unsigned bs = gen_ossl_block_size(c);
ossldata *od = c->ptr;
}
static int
-ossl_cast_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
+ossl_cast_cbc_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res)
{
ossldata *od = c->ptr;
}
static int
-ossl_cast_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
+ossl_cast_cbc_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res)
{
ossldata *od = c->ptr;
/* AES */
static int
-ossl_aes_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
+ossl_aes_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv)
{
ossldata *od = c->ptr;
unsigned bs = gen_ossl_block_size(c);
}
static int
-ossl_aes_key_init(ossldata * od, int type)
+ossl_aes_key_init(ossldata *od, int type)
{
int err;
}
static int
-ossl_aes_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
+ossl_aes_ecb_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen,
uint8 *res)
{
unsigned bs = gen_ossl_block_size(c);
}
static int
-ossl_aes_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
+ossl_aes_ecb_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen,
uint8 *res)
{
unsigned bs = gen_ossl_block_size(c);
}
static int
-ossl_aes_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
+ossl_aes_cbc_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen,
uint8 *res)
{
ossldata *od = c->ptr;
}
static int
-ossl_aes_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
+ossl_aes_cbc_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen,
uint8 *res)
{
ossldata *od = c->ptr;
/* PUBLIC functions */
int
-px_find_cipher(const char *name, PX_Cipher ** res)
+px_find_cipher(const char *name, PX_Cipher **res)
{
const struct ossl_cipher_lookup *i;
PX_Cipher *c = NULL;