diff options
author | Ralf S. Engelschall <rse@openssl.org> | 1998-12-21 10:56:39 +0000 |
---|---|---|
committer | Ralf S. Engelschall <rse@openssl.org> | 1998-12-21 10:56:39 +0000 |
commit | 58964a492275ca9a59a0cd9c8155cb2491b4b909 (patch) | |
tree | c7b16876a5789463bbbb468ef4829c8129b3d718 /crypto/evp/encode.c | |
parent | d02b48c63a58ea4367a0e905979f140b7d090f86 (diff) |
Import of old SSLeay release: SSLeay 0.9.0b
Diffstat (limited to 'crypto/evp/encode.c')
-rw-r--r-- | crypto/evp/encode.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/crypto/evp/encode.c b/crypto/evp/encode.c index 7cd65244e6..14d47c1eed 100644 --- a/crypto/evp/encode.c +++ b/crypto/evp/encode.c @@ -1,5 +1,5 @@ /* crypto/evp/encode.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written @@ -224,6 +224,7 @@ EVP_ENCODE_CTX *ctx; ctx->length=30; ctx->num=0; ctx->line_num=0; + ctx->expect_nl=0; } /* -1 for error @@ -237,12 +238,13 @@ int *outl; unsigned char *in; int inl; { - int seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,n,ln,tmp2; + int seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,n,ln,tmp2,exp_nl; unsigned char *d; n=ctx->num; d=ctx->enc_data; ln=ctx->line_num; + exp_nl=ctx->expect_nl; /* last line of input. */ if ((inl == 0) || ((n == 0) && (conv_ascii2bin(in[0]) == B64_EOF))) @@ -280,7 +282,16 @@ int inl; } /* eoln */ - if (v == B64_EOLN) ln=0; + if (v == B64_EOLN) + { + ln=0; + if (exp_nl) + { + exp_nl=0; + continue; + } + } + exp_nl=0; /* If we are at the end of input and it looks like a * line, process it. */ @@ -289,6 +300,10 @@ int inl; if ((v == B64_EOF) || (n >= 64)) { + /* This is needed to work correctly on 64 byte input + * lines. We process the line and then need to + * accept the '\n' */ + if ((v != B64_EOF) && (n >= 64)) exp_nl=1; tmp2=v; if (n > 0) { @@ -322,6 +337,7 @@ end: *outl=ret; ctx->num=n; ctx->line_num=ln; + ctx->expect_nl=exp_nl; return(rv); } |