diff options
Diffstat (limited to 'crypto/bio/bio_lib.c')
| -rw-r--r-- | crypto/bio/bio_lib.c | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c index 245a75afa1b8..26274886c9cd 100644 --- a/crypto/bio/bio_lib.c +++ b/crypto/bio/bio_lib.c @@ -20,12 +20,12 @@ * len parameter or not */ #define HAS_LEN_OPER(o) ((o) == BIO_CB_READ || (o) == BIO_CB_WRITE \ - || (o) == BIO_CB_GETS) + || (o) == BIO_CB_GETS) #ifndef OPENSSL_NO_DEPRECATED_3_0 -# define HAS_CALLBACK(b) ((b)->callback != NULL || (b)->callback_ex != NULL) +#define HAS_CALLBACK(b) ((b)->callback != NULL || (b)->callback_ex != NULL) #else -# define HAS_CALLBACK(b) ((b)->callback_ex != NULL) +#define HAS_CALLBACK(b) ((b)->callback_ex != NULL) #endif /* * Helper function to work out whether to call the new style callback or the old @@ -35,8 +35,8 @@ * for the "long" used for "inret" */ static long bio_call_callback(BIO *b, int oper, const char *argp, size_t len, - int argi, long argl, long inret, - size_t *processed) + int argi, long argl, long inret, + size_t *processed) { long ret = inret; #ifndef OPENSSL_NO_DEPRECATED_3_0 @@ -279,9 +279,7 @@ static int bio_read_intern(BIO *b, void *data, size_t dlen, size_t *readbytes) return -2; } - if (HAS_CALLBACK(b) && - ((ret = (int)bio_call_callback(b, BIO_CB_READ, data, dlen, 0, 0L, 1L, - NULL)) <= 0)) + if (HAS_CALLBACK(b) && ((ret = (int)bio_call_callback(b, BIO_CB_READ, data, dlen, 0, 0L, 1L, NULL)) <= 0)) return ret; if (!b->init) { @@ -296,7 +294,7 @@ static int bio_read_intern(BIO *b, void *data, size_t dlen, size_t *readbytes) if (HAS_CALLBACK(b)) ret = (int)bio_call_callback(b, BIO_CB_READ | BIO_CB_RETURN, data, - dlen, 0, 0L, ret, readbytes); + dlen, 0, 0L, ret, readbytes); /* Shouldn't happen */ if (ret > 0 && *readbytes > dlen) { @@ -331,7 +329,7 @@ int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes) } static int bio_write_intern(BIO *b, const void *data, size_t dlen, - size_t *written) + size_t *written) { size_t local_written; int ret; @@ -350,9 +348,7 @@ static int bio_write_intern(BIO *b, const void *data, size_t dlen, return -2; } - if (HAS_CALLBACK(b) && - ((ret = (int)bio_call_callback(b, BIO_CB_WRITE, data, dlen, 0, 0L, 1L, - NULL)) <= 0)) + if (HAS_CALLBACK(b) && ((ret = (int)bio_call_callback(b, BIO_CB_WRITE, data, dlen, 0, 0L, 1L, NULL)) <= 0)) return ret; if (!b->init) { @@ -367,7 +363,7 @@ static int bio_write_intern(BIO *b, const void *data, size_t dlen, if (HAS_CALLBACK(b)) ret = (int)bio_call_callback(b, BIO_CB_WRITE | BIO_CB_RETURN, data, - dlen, 0, 0L, ret, &local_written); + dlen, 0, 0L, ret, &local_written); if (written != NULL) *written = local_written; @@ -433,7 +429,7 @@ int BIO_puts(BIO *b, const char *buf) if (HAS_CALLBACK(b)) ret = (int)bio_call_callback(b, BIO_CB_PUTS | BIO_CB_RETURN, buf, 0, 0, - 0L, ret, &written); + 0L, ret, &written); if (ret > 0) { if (written > INT_MAX) { @@ -486,7 +482,7 @@ int BIO_gets(BIO *b, char *buf, int size) if (HAS_CALLBACK(b)) ret = (int)bio_call_callback(b, BIO_CB_GETS | BIO_CB_RETURN, buf, size, - 0, 0L, ret, &readbytes); + 0, 0L, ret, &readbytes); if (ret > 0) { /* Shouldn't happen */ @@ -581,7 +577,7 @@ long BIO_ctrl(BIO *b, int cmd, long larg, void *parg) if (HAS_CALLBACK(b)) ret = bio_call_callback(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, 0, cmd, - larg, ret, NULL); + larg, ret, NULL); return ret; } @@ -593,14 +589,14 @@ long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) if (b == NULL) return -2; if (b->method == NULL || b->method->callback_ctrl == NULL - || cmd != BIO_CTRL_SET_CALLBACK) { + || cmd != BIO_CTRL_SET_CALLBACK) { ERR_raise(ERR_LIB_BIO, BIO_R_UNSUPPORTED_METHOD); return -2; } if (HAS_CALLBACK(b)) { ret = bio_call_callback(b, BIO_CB_CTRL, (void *)&fp, 0, cmd, 0, 1L, - NULL); + NULL); if (ret <= 0) return ret; } @@ -609,7 +605,7 @@ long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) if (HAS_CALLBACK(b)) ret = bio_call_callback(b, BIO_CB_CTRL | BIO_CB_RETURN, (void *)&fp, 0, - cmd, 0, ret, NULL); + cmd, 0, ret, NULL); return ret; } @@ -791,7 +787,7 @@ BIO *BIO_dup_chain(BIO *in) /* copy app data */ if (!CRYPTO_dup_ex_data(CRYPTO_EX_INDEX_BIO, &new_bio->ex_data, - &bio->ex_data)) { + &bio->ex_data)) { BIO_free(new_bio); goto err; } @@ -805,7 +801,7 @@ BIO *BIO_dup_chain(BIO *in) } } return ret; - err: +err: BIO_free_all(ret); return NULL; @@ -908,7 +904,7 @@ int BIO_wait(BIO *bio, time_t max_time, unsigned int nap_milliseconds) if (rv <= 0) ERR_raise(ERR_LIB_BIO, - rv == 0 ? BIO_R_TRANSFER_TIMEOUT : BIO_R_TRANSFER_ERROR); + rv == 0 ? BIO_R_TRANSFER_TIMEOUT : BIO_R_TRANSFER_ERROR); return rv; } @@ -935,7 +931,7 @@ int BIO_do_connect_retry(BIO *bio, int timeout, int nap_milliseconds) nap_milliseconds = 100; BIO_set_nbio(bio, !blocking); - retry: +retry: ERR_set_mark(); rv = BIO_do_connect(bio); @@ -970,7 +966,7 @@ int BIO_do_connect_retry(BIO *bio, int timeout, int nap_milliseconds) if (rv > 0) goto retry; ERR_raise(ERR_LIB_BIO, - rv == 0 ? BIO_R_CONNECT_TIMEOUT : BIO_R_CONNECT_ERROR); + rv == 0 ? BIO_R_CONNECT_TIMEOUT : BIO_R_CONNECT_ERROR); } else { ERR_clear_last_mark(); rv = -1; |
