diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-09-25 16:32:27 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-09-25 16:36:58 +0300 |
commit | 1dcfb8da09c47d2a7502d1dfab06c8be4b6cf323 (patch) | |
tree | f99b357968ff2c075d11e00d9912b8101e59f0cc /contrib/pgcrypto/pgp.h | |
parent | 56a312aac8802c2aa01530101d2d19e63568eeda (diff) | |
download | postgresql-1dcfb8da09c47d2a7502d1dfab06c8be4b6cf323.tar.gz postgresql-1dcfb8da09c47d2a7502d1dfab06c8be4b6cf323.zip |
Refactor space allocation for base64 encoding/decoding in pgcrypto.
Instead of trying to accurately calculate the space needed, use a StringInfo
that's enlarged as needed. This is just moving things around currently - the
old code was not wrong - but this is in preparation for a patch that adds
support for extra armor headers, and would make the space calculation more
complicated.
Marko Tiikkaja
Diffstat (limited to 'contrib/pgcrypto/pgp.h')
-rw-r--r-- | contrib/pgcrypto/pgp.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/pgcrypto/pgp.h b/contrib/pgcrypto/pgp.h index 8d4ab9862df..cecd1814956 100644 --- a/contrib/pgcrypto/pgp.h +++ b/contrib/pgcrypto/pgp.h @@ -29,6 +29,8 @@ * contrib/pgcrypto/pgp.h */ +#include "lib/stringinfo.h" + #include "mbuf.h" #include "px.h" @@ -274,10 +276,8 @@ void pgp_cfb_free(PGP_CFB *ctx); int pgp_cfb_encrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst); int pgp_cfb_decrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst); -int pgp_armor_encode(const uint8 *src, unsigned len, uint8 *dst); -int pgp_armor_decode(const uint8 *src, unsigned len, uint8 *dst); -unsigned pgp_armor_enc_len(unsigned len); -unsigned pgp_armor_dec_len(unsigned len); +void pgp_armor_encode(const uint8 *src, int len, StringInfo dst); +int pgp_armor_decode(const uint8 *src, int len, StringInfo dst); int pgp_compress_filter(PushFilter **res, PGP_Context *ctx, PushFilter *dst); int pgp_decompress_filter(PullFilter **res, PGP_Context *ctx, PullFilter *src); |