summaryrefslogtreecommitdiff
path: root/crypto/bio
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/bio')
-rw-r--r--crypto/bio/b_print.c19
-rw-r--r--crypto/bio/b_sock.c8
-rw-r--r--crypto/bio/bf_nbio.c4
-rw-r--r--crypto/bio/bio.h22
-rw-r--r--crypto/bio/bio_err.c1
-rw-r--r--crypto/bio/bio_lib.c3
-rw-r--r--crypto/bio/bss_acpt.c4
-rw-r--r--crypto/bio/bss_conn.c4
-rw-r--r--crypto/bio/bss_sock.c5
9 files changed, 44 insertions, 26 deletions
diff --git a/crypto/bio/b_print.c b/crypto/bio/b_print.c
index 3f5d6a74bf..a9e552f245 100644
--- a/crypto/bio/b_print.c
+++ b/crypto/bio/b_print.c
@@ -378,7 +378,7 @@ _dopr(
case 'p':
value = (long)va_arg(args, void *);
fmtint(sbuffer, buffer, &currlen, maxlen,
- value, 16, min, max, flags);
+ value, 16, min, max, flags|DP_F_NUM);
break;
case 'n': /* XXX */
if (cflags == DP_C_SHORT) {
@@ -482,8 +482,9 @@ fmtint(
int flags)
{
int signvalue = 0;
+ char *prefix = "";
unsigned LLONG uvalue;
- char convert[DECIMAL_SIZE(value)+1];
+ char convert[DECIMAL_SIZE(value)+3];
int place = 0;
int spadlen = 0;
int zpadlen = 0;
@@ -501,6 +502,10 @@ fmtint(
else if (flags & DP_F_SPACE)
signvalue = ' ';
}
+ if (flags & DP_F_NUM) {
+ if (base == 8) prefix = "0";
+ if (base == 16) prefix = "0x";
+ }
if (flags & DP_F_UP)
caps = 1;
do {
@@ -514,7 +519,7 @@ fmtint(
convert[place] = 0;
zpadlen = max - place;
- spadlen = min - OSSL_MAX(max, place) - (signvalue ? 1 : 0);
+ spadlen = min - OSSL_MAX(max, place) - (signvalue ? 1 : 0) - strlen(prefix);
if (zpadlen < 0)
zpadlen = 0;
if (spadlen < 0)
@@ -536,6 +541,12 @@ fmtint(
if (signvalue)
doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue);
+ /* prefix */
+ while (*prefix) {
+ doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix);
+ prefix++;
+ }
+
/* zeros */
if (zpadlen > 0) {
while (zpadlen > 0) {
@@ -692,7 +703,7 @@ fmtfp(
* Decimal point. This should probably use locale to find the correct
* char to print out.
*/
- if (max > 0) {
+ if (max > 0 || (flags & DP_F_NUM)) {
doapr_outch(sbuffer, buffer, currlen, maxlen, '.');
while (fplace > 0)
diff --git a/crypto/bio/b_sock.c b/crypto/bio/b_sock.c
index cc6fb82ce2..73508d1691 100644
--- a/crypto/bio/b_sock.c
+++ b/crypto/bio/b_sock.c
@@ -56,8 +56,6 @@
* [including the GNU Public Licence.]
*/
-#ifndef OPENSSL_NO_SOCK
-
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -65,6 +63,8 @@
#include "cryptlib.h"
#include <openssl/bio.h>
+#ifndef OPENSSL_NO_SOCK
+
#ifdef OPENSSL_SYS_WIN16
#define SOCKET_PROTOCOL 0 /* more microsoft stupidity */
#else
@@ -523,7 +523,7 @@ void BIO_sock_cleanup(void)
#ifdef OPENSSL_SYS_VMS
int BIO_socket_ioctl(int fd, long type, UINT_L32p arg) /* changed for 64-bit API */
#else
-int BIO_socket_ioctl(int fd, long type, unsigned long *arg)
+int BIO_socket_ioctl(int fd, long type, void *arg)
#endif
{
int i;
@@ -774,7 +774,7 @@ int BIO_set_tcp_ndelay(int s, int on)
int BIO_socket_nbio(int s, int mode)
{
int ret= -1;
- unsigned long l;
+ int l;
l=mode;
#ifdef FIONBIO
diff --git a/crypto/bio/bf_nbio.c b/crypto/bio/bf_nbio.c
index 1ce2bfacc0..c72a23c2e1 100644
--- a/crypto/bio/bf_nbio.c
+++ b/crypto/bio/bf_nbio.c
@@ -127,7 +127,7 @@ static int nbiof_read(BIO *b, char *out, int outl)
{
NBIO_TEST *nt;
int ret=0;
-#if 0
+#if 1
int num;
unsigned char n;
#endif
@@ -137,7 +137,7 @@ static int nbiof_read(BIO *b, char *out, int outl)
nt=(NBIO_TEST *)b->ptr;
BIO_clear_retry_flags(b);
-#if 0
+#if 1
RAND_pseudo_bytes(&n,1);
num=(n&0x07);
diff --git a/crypto/bio/bio.h b/crypto/bio/bio.h
index c6d4e1c790..d350e12ac2 100644
--- a/crypto/bio/bio.h
+++ b/crypto/bio/bio.h
@@ -59,13 +59,14 @@
#ifndef HEADER_BIO_H
#define HEADER_BIO_H
+#include <openssl/e_os2.h>
+
#ifndef OPENSSL_NO_FP_API
# include <stdio.h>
#endif
#include <stdarg.h>
#include <openssl/crypto.h>
-#include <openssl/e_os2.h>
#ifdef __cplusplus
extern "C" {
@@ -244,7 +245,7 @@ typedef struct bio_method_st
long (_far *ctrl)();
int (_far *create)();
int (_far *destroy)();
- long (_fat *callback_ctrl)();
+ long (_far *callback_ctrl)();
} BIO_METHOD;
#endif
@@ -603,7 +604,7 @@ int BIO_sock_error(int sock);
#ifdef OPENSSL_SYS_VMS
int BIO_socket_ioctl(int fd, long type, UINT_L32p arg);
#else
-int BIO_socket_ioctl(int fd, long type, unsigned long *arg);
+int BIO_socket_ioctl(int fd, long type, void *arg);
#endif
int BIO_socket_nbio(int fd,int mode);
int BIO_get_port(const char *str, unsigned short *port_ptr);
@@ -630,10 +631,17 @@ void BIO_copy_next_retry(BIO *b);
/*long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);*/
-int BIO_printf(BIO *bio, const char *format, ...);
-int BIO_vprintf(BIO *bio, const char *format, va_list args);
-int BIO_snprintf(char *buf, size_t n, const char *format, ...);
-int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args);
+#ifndef __GNUC__
+#define __attribute__(x)
+#endif
+int BIO_printf(BIO *bio, const char *format, ...)
+ __attribute__((__format__(__printf__,2,3)));
+int BIO_vprintf(BIO *bio, const char *format, va_list args)
+ __attribute__((__format__(__printf__,2,0)));
+int BIO_snprintf(char *buf, size_t n, const char *format, ...)
+ __attribute__((__format__(__printf__,3,4)));
+int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
+ __attribute__((__format__(__printf__,3,0)));
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
diff --git a/crypto/bio/bio_err.c b/crypto/bio/bio_err.c
index 68a119d895..5df17ff892 100644
--- a/crypto/bio/bio_err.c
+++ b/crypto/bio/bio_err.c
@@ -61,6 +61,7 @@
#include <stdio.h>
#include <openssl/err.h>
#include <openssl/bio.h>
+#include <openssl/opensslconf.h> /* To see if OPENSSL_NO_ERR is defined */
/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR
diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c
index 98ce395519..692c8fb5c6 100644
--- a/crypto/bio/bio_lib.c
+++ b/crypto/bio/bio_lib.c
@@ -395,6 +395,8 @@ BIO *BIO_pop(BIO *b)
if (b == NULL) return(NULL);
ret=b->next_bio;
+ BIO_ctrl(b,BIO_CTRL_POP,0,NULL);
+
if (b->prev_bio != NULL)
b->prev_bio->next_bio=b->next_bio;
if (b->next_bio != NULL)
@@ -402,7 +404,6 @@ BIO *BIO_pop(BIO *b)
b->next_bio=NULL;
b->prev_bio=NULL;
- BIO_ctrl(b,BIO_CTRL_POP,0,NULL);
return(ret);
}
diff --git a/crypto/bio/bss_acpt.c b/crypto/bio/bss_acpt.c
index 8ea1db158b..d090b7272f 100644
--- a/crypto/bio/bss_acpt.c
+++ b/crypto/bio/bss_acpt.c
@@ -56,14 +56,14 @@
* [including the GNU Public Licence.]
*/
-#ifndef OPENSSL_NO_SOCK
-
#include <stdio.h>
#include <errno.h>
#define USE_SOCKETS
#include "cryptlib.h"
#include <openssl/bio.h>
+#ifndef OPENSSL_NO_SOCK
+
#ifdef OPENSSL_SYS_WIN16
#define SOCKET_PROTOCOL 0 /* more microsoft stupidity */
#else
diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c
index 72a4ea1f8d..d5c3f40da0 100644
--- a/crypto/bio/bss_conn.c
+++ b/crypto/bio/bss_conn.c
@@ -56,14 +56,14 @@
* [including the GNU Public Licence.]
*/
-#ifndef OPENSSL_NO_SOCK
-
#include <stdio.h>
#include <errno.h>
#define USE_SOCKETS
#include "cryptlib.h"
#include <openssl/bio.h>
+#ifndef OPENSSL_NO_SOCK
+
#ifdef OPENSSL_SYS_WIN16
#define SOCKET_PROTOCOL 0 /* more microsoft stupidity */
#else
diff --git a/crypto/bio/bss_sock.c b/crypto/bio/bss_sock.c
index d2a8857adc..946a7be8e0 100644
--- a/crypto/bio/bss_sock.c
+++ b/crypto/bio/bss_sock.c
@@ -56,8 +56,6 @@
* [including the GNU Public Licence.]
*/
-#ifndef OPENSSL_NO_SOCK
-
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -354,7 +352,7 @@ int BIO_sock_non_fatal_error(int err)
#endif
#ifdef EAGAIN
-#if EWOULDBLOCK != EAGAIN
+# if EWOULDBLOCK != EAGAIN
case EAGAIN:
# endif
#endif
@@ -377,4 +375,3 @@ int BIO_sock_non_fatal_error(int err)
}
return(0);
}
-#endif