summaryrefslogtreecommitdiffstats
path: root/crypto/evp/bio_enc.c
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>2000-11-12 02:13:38 +0000
committerBen Laurie <ben@openssl.org>2000-11-12 02:13:38 +0000
commit757e392d4e5195d59e138a216495f669a9d7dbcf (patch)
treeb48f0120f31f7fc6493a2fe9252dc8a18b3228d2 /crypto/evp/bio_enc.c
parent2f9f0c72de36b2d770f380c04e389c910c315304 (diff)
Make Rijndael work! Those long flights have some good points.
Diffstat (limited to 'crypto/evp/bio_enc.c')
-rw-r--r--crypto/evp/bio_enc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/evp/bio_enc.c b/crypto/evp/bio_enc.c
index 831c71a2b5..f8336f2610 100644
--- a/crypto/evp/bio_enc.c
+++ b/crypto/evp/bio_enc.c
@@ -71,6 +71,7 @@ static int enc_new(BIO *h);
static int enc_free(BIO *data);
static long enc_callback_ctrl(BIO *h, int cmd, bio_info_cb *fps);
#define ENC_BLOCK_SIZE (1024*4)
+#define BUF_OFFSET 8 /* XXX: why? */
typedef struct enc_struct
{
@@ -80,7 +81,7 @@ typedef struct enc_struct
int finished;
int ok; /* bad decrypt */
EVP_CIPHER_CTX cipher;
- char buf[ENC_BLOCK_SIZE+10];
+ char buf[ENC_BLOCK_SIZE+BUF_OFFSET+2/*why?*/];
} BIO_ENC_CTX;
static BIO_METHOD methods_enc=
@@ -172,7 +173,7 @@ static int enc_read(BIO *b, char *out, int outl)
/* read in at offset 8, read the EVP_Cipher
* documentation about why */
- i=BIO_read(b->next_bio,&(ctx->buf[8]),ENC_BLOCK_SIZE);
+ i=BIO_read(b->next_bio,&(ctx->buf[BUF_OFFSET]),ENC_BLOCK_SIZE);
if (i <= 0)
{
@@ -196,7 +197,7 @@ static int enc_read(BIO *b, char *out, int outl)
{
EVP_CipherUpdate(&(ctx->cipher),
(unsigned char *)ctx->buf,&ctx->buf_len,
- (unsigned char *)&(ctx->buf[8]),i);
+ (unsigned char *)&(ctx->buf[BUF_OFFSET]),i);
ctx->cont=1;
/* Note: it is possible for EVP_CipherUpdate to
* decrypt zero bytes because this is or looks like