sync with OpenBSD -current
This commit is contained in:
parent
efa57bf0d2
commit
d178ff6848
153 changed files with 982 additions and 11182 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: b_dump.c,v 1.29 2024/02/15 10:34:30 tb Exp $ */
|
||||
/* $OpenBSD: b_dump.c,v 1.30 2024/03/02 09:21:24 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -209,39 +209,3 @@ BIO_dump(BIO *bio, const char *s, int len)
|
|||
return BIO_dump_indent(bio, s, len, 0);
|
||||
}
|
||||
LCRYPTO_ALIAS(BIO_dump);
|
||||
|
||||
/*
|
||||
* XXX - remove the functions below in the next major bump.
|
||||
*/
|
||||
|
||||
int
|
||||
BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u),
|
||||
void *u, const char *s, int len)
|
||||
{
|
||||
BIOerror(ERR_R_DISABLED);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u),
|
||||
void *u, const char *s, int len, int indent)
|
||||
{
|
||||
BIOerror(ERR_R_DISABLED);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
BIO_dump_fp(FILE *fp, const char *s, int len)
|
||||
{
|
||||
BIOerror(ERR_R_DISABLED);
|
||||
return -1;
|
||||
}
|
||||
LCRYPTO_ALIAS(BIO_dump_fp);
|
||||
|
||||
int
|
||||
BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent)
|
||||
{
|
||||
BIOerror(ERR_R_DISABLED);
|
||||
return -1;
|
||||
}
|
||||
LCRYPTO_ALIAS(BIO_dump_indent_fp);
|
||||
|
|
|
@ -1,21 +1,10 @@
|
|||
/* $OpenBSD: b_print.c,v 1.27 2023/07/05 21:23:37 beck Exp $ */
|
||||
/* $OpenBSD: b_print.c,v 1.28 2024/03/02 09:18:28 tb Exp $ */
|
||||
|
||||
/* Theo de Raadt places this file in the public domain. */
|
||||
|
||||
#include <openssl/bio.h>
|
||||
|
||||
int
|
||||
BIO_printf(BIO *bio, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
int ret;
|
||||
|
||||
va_start(args, format);
|
||||
ret = BIO_vprintf(bio, format, args);
|
||||
va_end(args);
|
||||
return (ret);
|
||||
}
|
||||
LCRYPTO_ALIAS(BIO_printf);
|
||||
#include "bio_local.h"
|
||||
|
||||
#ifdef HAVE_FUNOPEN
|
||||
static int
|
||||
|
@ -40,7 +29,6 @@ BIO_vprintf(BIO *bio, const char *format, va_list args)
|
|||
fail:
|
||||
return (ret);
|
||||
}
|
||||
LCRYPTO_ALIAS(BIO_vprintf);
|
||||
|
||||
#else /* !HAVE_FUNOPEN */
|
||||
|
||||
|
@ -57,55 +45,18 @@ BIO_vprintf(BIO *bio, const char *format, va_list args)
|
|||
free(buf);
|
||||
return (ret);
|
||||
}
|
||||
LCRYPTO_ALIAS(BIO_vprintf);
|
||||
|
||||
#endif /* HAVE_FUNOPEN */
|
||||
|
||||
/*
|
||||
* BIO_snprintf and BIO_vsnprintf return -1 for overflow,
|
||||
* due to the history of this API. Justification:
|
||||
*
|
||||
* Traditional snprintf surfaced in 4.4BSD, and returned
|
||||
* "number of bytes wanted". Solaris and Windows opted to
|
||||
* return -1. A draft standard was written which returned -1.
|
||||
* Due to the large volume of code already using the first
|
||||
* semantics, the draft was repaired before standardization to
|
||||
* specify "number of bytes wanted" plus "-1 for character conversion
|
||||
* style errors". Solaris adapted to this rule, but Windows stuck
|
||||
* with -1.
|
||||
*
|
||||
* Original OpenSSL comment which is full of lies:
|
||||
*
|
||||
* "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.)"
|
||||
*/
|
||||
int
|
||||
BIO_snprintf(char *buf, size_t n, const char *format, ...)
|
||||
BIO_printf(BIO *bio, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
int ret;
|
||||
|
||||
va_start(args, format);
|
||||
ret = vsnprintf(buf, n, format, args);
|
||||
ret = BIO_vprintf(bio, format, args);
|
||||
va_end(args);
|
||||
|
||||
if (ret >= n || ret == -1)
|
||||
return (-1);
|
||||
return (ret);
|
||||
}
|
||||
LCRYPTO_ALIAS(BIO_snprintf);
|
||||
|
||||
int
|
||||
BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = vsnprintf(buf, n, format, args);
|
||||
|
||||
if (ret >= n || ret == -1)
|
||||
return (-1);
|
||||
return (ret);
|
||||
}
|
||||
LCRYPTO_ALIAS(BIO_vsnprintf);
|
||||
LCRYPTO_ALIAS(BIO_printf);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: bio.h,v 1.60 2023/08/25 12:37:33 schwarze Exp $ */
|
||||
/* $OpenBSD: bio.h,v 1.63 2024/03/02 09:22:41 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -534,7 +534,6 @@ const BIO_METHOD *BIO_s_file(void);
|
|||
BIO *BIO_new_file(const char *filename, const char *mode);
|
||||
BIO *BIO_new_fp(FILE *stream, int close_flag);
|
||||
BIO *BIO_new(const BIO_METHOD *type);
|
||||
int BIO_set(BIO *a, const BIO_METHOD *type);
|
||||
int BIO_free(BIO *a);
|
||||
int BIO_up_ref(BIO *bio);
|
||||
void *BIO_get_data(BIO *a);
|
||||
|
@ -599,14 +598,10 @@ int BIO_dgram_non_fatal_error(int _error);
|
|||
|
||||
int BIO_fd_should_retry(int i);
|
||||
int BIO_fd_non_fatal_error(int _error);
|
||||
int BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u),
|
||||
void *u, const char *s, int len);
|
||||
int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u),
|
||||
void *u, const char *s, int len, int indent);
|
||||
|
||||
int BIO_dump(BIO *b, const char *bytes, int len);
|
||||
int BIO_dump_indent(BIO *b, const char *bytes, int len, int indent);
|
||||
int BIO_dump_fp(FILE *fp, const char *s, int len);
|
||||
int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent);
|
||||
|
||||
struct hostent *BIO_gethostbyname(const char *name);
|
||||
/* We might want a thread-safe interface too:
|
||||
* struct hostent *BIO_gethostbyname_r(const char *name,
|
||||
|
@ -648,25 +643,9 @@ void BIO_copy_next_retry(BIO *b);
|
|||
#ifndef __MINGW_PRINTF_FORMAT
|
||||
int BIO_printf(BIO *bio, const char *format, ...)
|
||||
__attribute__((__format__(__printf__, 2, 3), __nonnull__(2)));
|
||||
int BIO_vprintf(BIO *bio, const char *format, va_list args)
|
||||
__attribute__((__format__(__printf__, 2, 0), __nonnull__(2)));
|
||||
int BIO_snprintf(char *buf, size_t n, const char *format, ...)
|
||||
__attribute__((__deprecated__, __format__(__printf__, 3, 4),
|
||||
__nonnull__(3)));
|
||||
int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
|
||||
__attribute__((__deprecated__, __format__(__printf__, 3, 0),
|
||||
__nonnull__(3)));
|
||||
#else
|
||||
int BIO_printf(BIO *bio, const char *format, ...)
|
||||
__attribute__((__format__(__MINGW_PRINTF_FORMAT, 2, 3), __nonnull__(2)));
|
||||
int BIO_vprintf(BIO *bio, const char *format, va_list args)
|
||||
__attribute__((__format__(__MINGW_PRINTF_FORMAT, 2, 0), __nonnull__(2)));
|
||||
int BIO_snprintf(char *buf, size_t n, const char *format, ...)
|
||||
__attribute__((__deprecated__, __format__(__MINGW_PRINTF_FORMAT, 3, 4),
|
||||
__nonnull__(3)));
|
||||
int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
|
||||
__attribute__((__deprecated__, __format__(__MINGW_PRINTF_FORMAT, 3, 0),
|
||||
__nonnull__(3)));
|
||||
#endif
|
||||
|
||||
void ERR_load_BIO_strings(void);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: bio_lib.c,v 1.51 2024/02/17 14:29:07 jsing Exp $ */
|
||||
/* $OpenBSD: bio_lib.c,v 1.52 2024/03/02 09:22:41 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -160,14 +160,6 @@ BIO_new(const BIO_METHOD *method)
|
|||
}
|
||||
LCRYPTO_ALIAS(BIO_new);
|
||||
|
||||
int
|
||||
BIO_set(BIO *bio, const BIO_METHOD *method)
|
||||
{
|
||||
BIOerror(ERR_R_DISABLED);
|
||||
return 0;
|
||||
}
|
||||
LCRYPTO_ALIAS(BIO_set);
|
||||
|
||||
int
|
||||
BIO_free(BIO *bio)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: bio_local.h,v 1.5 2022/12/02 19:44:04 tb Exp $ */
|
||||
/* $OpenBSD: bio_local.h,v 1.6 2024/03/02 09:18:28 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -59,6 +59,8 @@
|
|||
#ifndef HEADER_BIO_LOCAL_H
|
||||
#define HEADER_BIO_LOCAL_H
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
__BEGIN_HIDDEN_DECLS
|
||||
|
||||
struct bio_method_st {
|
||||
|
@ -118,6 +120,8 @@ typedef struct bio_f_buffer_ctx_struct {
|
|||
int obuf_off; /* write/read offset */
|
||||
} BIO_F_BUFFER_CTX;
|
||||
|
||||
int BIO_vprintf(BIO *bio, const char *format, va_list args);
|
||||
|
||||
__END_HIDDEN_DECLS
|
||||
|
||||
#endif /* !HEADER_BIO_LOCAL_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue