Loading CHANGES +6 −0 Original line number Original line Diff line number Diff line Loading @@ -4,6 +4,12 @@ Changes between 0.9.5a and 0.9.6 [xx XXX 2000] Changes between 0.9.5a and 0.9.6 [xx XXX 2000] *) New function ERR_error_string_n(e, buf, len) which is like ERR_error_string(e, buf), but writes at most 'len' bytes including the 0 terminator. For ERR_error_string_n, 'buf' may not be NULL. [Damien Miller <djm@mindrot.org>, Bodo Moeller] *) CONF library reworked to become more general. A new CONF *) CONF library reworked to become more general. A new CONF configuration file reader "class" is implemented as well as a configuration file reader "class" is implemented as well as a new functions (NCONF_*, for "New CONF") to handle it. The now new functions (NCONF_*, for "New CONF") to handle it. The now Loading STATUS +1 −5 Original line number Original line Diff line number Diff line OpenSSL STATUS Last modified at OpenSSL STATUS Last modified at ______________ $Date: 2000/04/01 12:32:10 $ ______________ $Date: 2000/04/14 23:35:50 $ DEVELOPMENT STATE DEVELOPMENT STATE Loading Loading @@ -89,10 +89,6 @@ use a key length decided by the size of the RSA encrypted key and expect use a key length decided by the size of the RSA encrypted key and expect RC2 to adapt). RC2 to adapt). o ERR_error_string(..., buf) does not know how large buf is, there should be ERR_error_string_n(..., buf, bufsize) or similar. WISHES WISHES o o apps/errstr.c +4 −1 Original line number Original line Diff line number Diff line Loading @@ -104,7 +104,10 @@ int MAIN(int argc, char **argv) for (i=1; i<argc; i++) for (i=1; i<argc; i++) { { if (sscanf(argv[i],"%lx",&l)) if (sscanf(argv[i],"%lx",&l)) printf("%s\n",ERR_error_string(l,buf)); { ERR_error_string_n(l, buf, sizeof buf); printf("%s\n",buf); } else else { { printf("%s: bad error code\n",argv[i]); printf("%s: bad error code\n",argv[i]); Loading crypto/bio/b_print.c +73 −51 Original line number Original line Diff line number Diff line Loading @@ -78,48 +78,7 @@ # endif # endif #endif #endif static void dopr (char *buffer, size_t maxlen, size_t *retlen, /***************************************************************************/ const char *format, va_list args); #ifdef USE_ALLOCATING_PRINT static void doapr (char **buffer, size_t *retlen, const char *format, va_list args); #endif int BIO_printf (BIO *bio, ...) { va_list args; char *format; int ret; size_t retlen; #ifdef USE_ALLOCATING_PRINT char *hugebuf; #else MS_STATIC char hugebuf[1024*2]; /* 10k in one chunk is the limit */ #endif va_start(args, bio); format=va_arg(args, char *); #ifndef USE_ALLOCATING_PRINT hugebuf[0]='\0'; dopr(hugebuf, sizeof(hugebuf), &retlen, format, args); #else hugebuf = NULL; CRYPTO_push_info("doapr()"); doapr(&hugebuf, &retlen, format, args); if (hugebuf) { #endif ret=BIO_write(bio, hugebuf, (int)retlen); #ifdef USE_ALLOCATING_PRINT Free(hugebuf); } CRYPTO_pop_info(); #endif va_end(args); return(ret); } /* /* * Copyright Patrick Powell 1995 * Copyright Patrick Powell 1995 Loading @@ -140,6 +99,7 @@ int BIO_printf (BIO *bio, ...) * o Andrew Tridgell <tridge@samba.org> (1998, for Samba) * o Andrew Tridgell <tridge@samba.org> (1998, for Samba) * o Luke Mewburn <lukem@netbsd.org> (1999, for LukemFTP) * o Luke Mewburn <lukem@netbsd.org> (1999, for LukemFTP) * o Ralf S. Engelschall <rse@engelschall.com> (1999, for Pth) * o Ralf S. Engelschall <rse@engelschall.com> (1999, for Pth) * o ... (for OpenSSL) */ */ #if HAVE_LONG_DOUBLE #if HAVE_LONG_DOUBLE Loading @@ -161,18 +121,17 @@ static void fmtint (void (*)(char **, size_t *, size_t *, int), char **, size_t *, size_t *, LLONG, int, int, int, int); char **, size_t *, size_t *, LLONG, int, int, int, int); static void fmtfp (void (*)(char **, size_t *, size_t *, int), static void fmtfp (void (*)(char **, size_t *, size_t *, int), char **, size_t *, size_t *, LDOUBLE, int, int, int); char **, size_t *, size_t *, LDOUBLE, int, int, int); #ifndef USE_ALLOCATING_PRINT static int dopr_isbig (size_t, size_t); static int dopr_isbig (size_t, size_t); static int dopr_copy (size_t); static int dopr_copy (size_t); static void dopr_outch (char **, size_t *, size_t *, int); static void dopr_outch (char **, size_t *, size_t *, int); #else #ifdef USE_ALLOCATING_PRINT static int doapr_isbig (size_t, size_t); static int doapr_isbig (size_t, size_t); static int doapr_copy (size_t); static int doapr_copy (size_t); static void doapr_outch (char **, size_t *, size_t *, int); static void doapr_outch (char **, size_t *, size_t *, int); #endif #endif static void _dopr(void (*)(char **, size_t *, size_t *, int), static void _dopr(void (*)(char **, size_t *, size_t *, int), int (*)(size_t, size_t), int (*)(size_t), int (*)(size_t, size_t), int (*)(size_t), char **buffer, size_t *maxlen, size_t *retlen, char **buffer, size_t *maxlen, size_t *retlen, int *truncated, const char *format, va_list args); const char *format, va_list args); /* format read states */ /* format read states */ Loading Loading @@ -213,8 +172,9 @@ dopr( const char *format, const char *format, va_list args) va_list args) { { int ignored; _dopr(dopr_outch, dopr_isbig, dopr_copy, _dopr(dopr_outch, dopr_isbig, dopr_copy, &buffer, &maxlen, retlen, format, args); &buffer, &maxlen, retlen, &ignored, format, args); } } #else #else Loading @@ -226,8 +186,9 @@ doapr( va_list args) va_list args) { { size_t dummy_maxlen = 0; size_t dummy_maxlen = 0; int ignored; _dopr(doapr_outch, doapr_isbig, doapr_copy, _dopr(doapr_outch, doapr_isbig, doapr_copy, buffer, &dummy_maxlen, retlen, format, args); buffer, &dummy_maxlen, retlen, &ignored, format, args); } } #endif #endif Loading @@ -239,6 +200,7 @@ _dopr( char **buffer, char **buffer, size_t *maxlen, size_t *maxlen, size_t *retlen, size_t *retlen, int *truncated, const char *format, const char *format, va_list args) va_list args) { { Loading Loading @@ -484,7 +446,8 @@ _dopr( break; break; } } } } if (currlen >= *maxlen - 1) *truncated = (currlen > *maxlen - 1); if (*truncated) currlen = *maxlen - 1; currlen = *maxlen - 1; (*buffer)[currlen] = '\0'; (*buffer)[currlen] = '\0'; *retlen = currlen; *retlen = currlen; Loading Loading @@ -842,3 +805,62 @@ doapr_outch( return; return; } } #endif #endif /***************************************************************************/ int BIO_printf (BIO *bio, const char *format, ...) { va_list args; int ret; size_t retlen; #ifdef USE_ALLOCATING_PRINT char *hugebuf; #else MS_STATIC char hugebuf[1024*2]; /* 10k in one chunk is the limit */ #endif va_start(args, format); #ifndef USE_ALLOCATING_PRINT hugebuf[0]='\0'; dopr(hugebuf, sizeof(hugebuf), &retlen, format, args); #else hugebuf = NULL; CRYPTO_push_info("doapr()"); doapr(&hugebuf, &retlen, format, args); if (hugebuf) { #endif ret=BIO_write(bio, hugebuf, (int)retlen); #ifdef USE_ALLOCATING_PRINT Free(hugebuf); } CRYPTO_pop_info(); #endif va_end(args); return(ret); } /* As snprintf is not available everywhere, we provide our own implementation. * This function has nothing to do with BIOs, but it's closely related * to BIO_printf, and we need *some* name prefix ... * (XXX the function should be renamed, but to what?) */ int BIO_snprintf(char *buf, size_t n, const char *format, ...) { va_list args; size_t retlen; int truncated; va_start(args, format); _dopr(dopr_outch, dopr_isbig, dopr_copy, &buf, &n, &retlen, &truncated, format, args); if (truncated) /* In case of truncation, return -1 like traditional snprintf. * (Current drafts for ISO/IEC 9899 say snprintf should return * the number of characters that would have been written, * had the buffer been large enough.) */ return -1; else return (retlen <= INT_MAX) ? retlen : -1; } crypto/bio/bio.h +2 −1 Original line number Original line Diff line number Diff line Loading @@ -592,7 +592,8 @@ void BIO_copy_next_retry(BIO *b); long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); int BIO_printf(BIO *bio, ...); int BIO_printf(BIO *bio, const char *format, ...); int BIO_snprintf(char *buf, size_t n, const char *format, ...); /* BEGIN ERROR CODES */ /* BEGIN ERROR CODES */ /* The following lines are auto generated by the script mkerr.pl. Any changes /* The following lines are auto generated by the script mkerr.pl. Any changes Loading Loading
CHANGES +6 −0 Original line number Original line Diff line number Diff line Loading @@ -4,6 +4,12 @@ Changes between 0.9.5a and 0.9.6 [xx XXX 2000] Changes between 0.9.5a and 0.9.6 [xx XXX 2000] *) New function ERR_error_string_n(e, buf, len) which is like ERR_error_string(e, buf), but writes at most 'len' bytes including the 0 terminator. For ERR_error_string_n, 'buf' may not be NULL. [Damien Miller <djm@mindrot.org>, Bodo Moeller] *) CONF library reworked to become more general. A new CONF *) CONF library reworked to become more general. A new CONF configuration file reader "class" is implemented as well as a configuration file reader "class" is implemented as well as a new functions (NCONF_*, for "New CONF") to handle it. The now new functions (NCONF_*, for "New CONF") to handle it. The now Loading
STATUS +1 −5 Original line number Original line Diff line number Diff line OpenSSL STATUS Last modified at OpenSSL STATUS Last modified at ______________ $Date: 2000/04/01 12:32:10 $ ______________ $Date: 2000/04/14 23:35:50 $ DEVELOPMENT STATE DEVELOPMENT STATE Loading Loading @@ -89,10 +89,6 @@ use a key length decided by the size of the RSA encrypted key and expect use a key length decided by the size of the RSA encrypted key and expect RC2 to adapt). RC2 to adapt). o ERR_error_string(..., buf) does not know how large buf is, there should be ERR_error_string_n(..., buf, bufsize) or similar. WISHES WISHES o o
apps/errstr.c +4 −1 Original line number Original line Diff line number Diff line Loading @@ -104,7 +104,10 @@ int MAIN(int argc, char **argv) for (i=1; i<argc; i++) for (i=1; i<argc; i++) { { if (sscanf(argv[i],"%lx",&l)) if (sscanf(argv[i],"%lx",&l)) printf("%s\n",ERR_error_string(l,buf)); { ERR_error_string_n(l, buf, sizeof buf); printf("%s\n",buf); } else else { { printf("%s: bad error code\n",argv[i]); printf("%s: bad error code\n",argv[i]); Loading
crypto/bio/b_print.c +73 −51 Original line number Original line Diff line number Diff line Loading @@ -78,48 +78,7 @@ # endif # endif #endif #endif static void dopr (char *buffer, size_t maxlen, size_t *retlen, /***************************************************************************/ const char *format, va_list args); #ifdef USE_ALLOCATING_PRINT static void doapr (char **buffer, size_t *retlen, const char *format, va_list args); #endif int BIO_printf (BIO *bio, ...) { va_list args; char *format; int ret; size_t retlen; #ifdef USE_ALLOCATING_PRINT char *hugebuf; #else MS_STATIC char hugebuf[1024*2]; /* 10k in one chunk is the limit */ #endif va_start(args, bio); format=va_arg(args, char *); #ifndef USE_ALLOCATING_PRINT hugebuf[0]='\0'; dopr(hugebuf, sizeof(hugebuf), &retlen, format, args); #else hugebuf = NULL; CRYPTO_push_info("doapr()"); doapr(&hugebuf, &retlen, format, args); if (hugebuf) { #endif ret=BIO_write(bio, hugebuf, (int)retlen); #ifdef USE_ALLOCATING_PRINT Free(hugebuf); } CRYPTO_pop_info(); #endif va_end(args); return(ret); } /* /* * Copyright Patrick Powell 1995 * Copyright Patrick Powell 1995 Loading @@ -140,6 +99,7 @@ int BIO_printf (BIO *bio, ...) * o Andrew Tridgell <tridge@samba.org> (1998, for Samba) * o Andrew Tridgell <tridge@samba.org> (1998, for Samba) * o Luke Mewburn <lukem@netbsd.org> (1999, for LukemFTP) * o Luke Mewburn <lukem@netbsd.org> (1999, for LukemFTP) * o Ralf S. Engelschall <rse@engelschall.com> (1999, for Pth) * o Ralf S. Engelschall <rse@engelschall.com> (1999, for Pth) * o ... (for OpenSSL) */ */ #if HAVE_LONG_DOUBLE #if HAVE_LONG_DOUBLE Loading @@ -161,18 +121,17 @@ static void fmtint (void (*)(char **, size_t *, size_t *, int), char **, size_t *, size_t *, LLONG, int, int, int, int); char **, size_t *, size_t *, LLONG, int, int, int, int); static void fmtfp (void (*)(char **, size_t *, size_t *, int), static void fmtfp (void (*)(char **, size_t *, size_t *, int), char **, size_t *, size_t *, LDOUBLE, int, int, int); char **, size_t *, size_t *, LDOUBLE, int, int, int); #ifndef USE_ALLOCATING_PRINT static int dopr_isbig (size_t, size_t); static int dopr_isbig (size_t, size_t); static int dopr_copy (size_t); static int dopr_copy (size_t); static void dopr_outch (char **, size_t *, size_t *, int); static void dopr_outch (char **, size_t *, size_t *, int); #else #ifdef USE_ALLOCATING_PRINT static int doapr_isbig (size_t, size_t); static int doapr_isbig (size_t, size_t); static int doapr_copy (size_t); static int doapr_copy (size_t); static void doapr_outch (char **, size_t *, size_t *, int); static void doapr_outch (char **, size_t *, size_t *, int); #endif #endif static void _dopr(void (*)(char **, size_t *, size_t *, int), static void _dopr(void (*)(char **, size_t *, size_t *, int), int (*)(size_t, size_t), int (*)(size_t), int (*)(size_t, size_t), int (*)(size_t), char **buffer, size_t *maxlen, size_t *retlen, char **buffer, size_t *maxlen, size_t *retlen, int *truncated, const char *format, va_list args); const char *format, va_list args); /* format read states */ /* format read states */ Loading Loading @@ -213,8 +172,9 @@ dopr( const char *format, const char *format, va_list args) va_list args) { { int ignored; _dopr(dopr_outch, dopr_isbig, dopr_copy, _dopr(dopr_outch, dopr_isbig, dopr_copy, &buffer, &maxlen, retlen, format, args); &buffer, &maxlen, retlen, &ignored, format, args); } } #else #else Loading @@ -226,8 +186,9 @@ doapr( va_list args) va_list args) { { size_t dummy_maxlen = 0; size_t dummy_maxlen = 0; int ignored; _dopr(doapr_outch, doapr_isbig, doapr_copy, _dopr(doapr_outch, doapr_isbig, doapr_copy, buffer, &dummy_maxlen, retlen, format, args); buffer, &dummy_maxlen, retlen, &ignored, format, args); } } #endif #endif Loading @@ -239,6 +200,7 @@ _dopr( char **buffer, char **buffer, size_t *maxlen, size_t *maxlen, size_t *retlen, size_t *retlen, int *truncated, const char *format, const char *format, va_list args) va_list args) { { Loading Loading @@ -484,7 +446,8 @@ _dopr( break; break; } } } } if (currlen >= *maxlen - 1) *truncated = (currlen > *maxlen - 1); if (*truncated) currlen = *maxlen - 1; currlen = *maxlen - 1; (*buffer)[currlen] = '\0'; (*buffer)[currlen] = '\0'; *retlen = currlen; *retlen = currlen; Loading Loading @@ -842,3 +805,62 @@ doapr_outch( return; return; } } #endif #endif /***************************************************************************/ int BIO_printf (BIO *bio, const char *format, ...) { va_list args; int ret; size_t retlen; #ifdef USE_ALLOCATING_PRINT char *hugebuf; #else MS_STATIC char hugebuf[1024*2]; /* 10k in one chunk is the limit */ #endif va_start(args, format); #ifndef USE_ALLOCATING_PRINT hugebuf[0]='\0'; dopr(hugebuf, sizeof(hugebuf), &retlen, format, args); #else hugebuf = NULL; CRYPTO_push_info("doapr()"); doapr(&hugebuf, &retlen, format, args); if (hugebuf) { #endif ret=BIO_write(bio, hugebuf, (int)retlen); #ifdef USE_ALLOCATING_PRINT Free(hugebuf); } CRYPTO_pop_info(); #endif va_end(args); return(ret); } /* As snprintf is not available everywhere, we provide our own implementation. * This function has nothing to do with BIOs, but it's closely related * to BIO_printf, and we need *some* name prefix ... * (XXX the function should be renamed, but to what?) */ int BIO_snprintf(char *buf, size_t n, const char *format, ...) { va_list args; size_t retlen; int truncated; va_start(args, format); _dopr(dopr_outch, dopr_isbig, dopr_copy, &buf, &n, &retlen, &truncated, format, args); if (truncated) /* In case of truncation, return -1 like traditional snprintf. * (Current drafts for ISO/IEC 9899 say snprintf should return * the number of characters that would have been written, * had the buffer been large enough.) */ return -1; else return (retlen <= INT_MAX) ? retlen : -1; }
crypto/bio/bio.h +2 −1 Original line number Original line Diff line number Diff line Loading @@ -592,7 +592,8 @@ void BIO_copy_next_retry(BIO *b); long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); int BIO_printf(BIO *bio, ...); int BIO_printf(BIO *bio, const char *format, ...); int BIO_snprintf(char *buf, size_t n, const char *format, ...); /* BEGIN ERROR CODES */ /* BEGIN ERROR CODES */ /* The following lines are auto generated by the script mkerr.pl. Any changes /* The following lines are auto generated by the script mkerr.pl. Any changes Loading