mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
Address code review
This commit is contained in:
@ -1587,7 +1587,7 @@ int wolfSSL_OCSP_REQ_CTX_set1_req(WOLFSSL_OCSP_REQ_CTX *ctx, OcspRequest *req)
|
||||
|
||||
static int OCSP_REQ_CTX_bio_cb(char *buf, int sz, void *ctx)
|
||||
{
|
||||
return BioReceive((WOLFSSL_BIO*)ctx, NULL, buf, sz);
|
||||
return BioReceiveInternal((WOLFSSL_BIO*)ctx, NULL, buf, sz);
|
||||
}
|
||||
|
||||
int wolfSSL_OCSP_REQ_CTX_nbio(WOLFSSL_OCSP_REQ_CTX *ctx)
|
||||
|
15
src/wolfio.c
15
src/wolfio.c
@ -260,7 +260,18 @@ static int TranslateIoReturnCode(int err, SOCKET_T sd, int direction)
|
||||
#ifdef OPENSSL_EXTRA
|
||||
#ifndef NO_BIO
|
||||
|
||||
int BioReceive(WOLFSSL_BIO* biord, WOLFSSL_BIO* biowr, char* buf, int sz)
|
||||
int BioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx)
|
||||
{
|
||||
return SslBioSend(ssl, buf, sz, ctx);
|
||||
}
|
||||
|
||||
int BioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx)
|
||||
{
|
||||
return SslBioReceive(ssl, buf, sz, ctx);
|
||||
}
|
||||
|
||||
int BioReceiveInternal(WOLFSSL_BIO* biord, WOLFSSL_BIO* biowr, char* buf,
|
||||
int sz)
|
||||
{
|
||||
int recvd = WOLFSSL_CBIO_ERR_GENERAL;
|
||||
|
||||
@ -325,7 +336,7 @@ int SslBioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx)
|
||||
{
|
||||
WOLFSSL_ENTER("SslBioReceive");
|
||||
(void)ctx;
|
||||
return BioReceive(ssl->biord, ssl->biowr, buf, sz);
|
||||
return BioReceiveInternal(ssl->biord, ssl->biowr, buf, sz);
|
||||
}
|
||||
|
||||
|
||||
|
@ -13543,7 +13543,7 @@ static int AddDNSEntryToList(DNS_entry** lst, DNS_entry* entry)
|
||||
|
||||
/* Allocate a DNS entry and set the fields.
|
||||
*
|
||||
* @param [in] cert Certificate object.
|
||||
* @param [in] heap Heap hint.
|
||||
* @param [in] str DNS name string.
|
||||
* @param [in] strLen Length of DNS name string.
|
||||
* @param [in] type Type of DNS name string.
|
||||
|
@ -125,17 +125,17 @@ WOLFSSL_API WOLFSSL_ASN1_OBJECT *wolfSSL_c2i_ASN1_OBJECT(WOLFSSL_ASN1_OBJECT **a
|
||||
* we don't use this. Some projects use OpenSSL to implement ASN1 types and
|
||||
* this section is only to provide those projects with ASN1 functionality. */
|
||||
|
||||
typedef void* (*wolfssl_asn1_new)(void);
|
||||
typedef void (*wolfssl_asn1_free)(void*);
|
||||
typedef int (*wolfssl_asn1_i2d)(const void*, unsigned char**);
|
||||
typedef void* (*wolfssl_asn1_d2i)(void**, const byte **, long);
|
||||
typedef void* (*WolfsslAsn1NewCb)(void);
|
||||
typedef void (*WolfsslAsn1FreeCb)(void*);
|
||||
typedef int (*WolfsslAsn1i2dCb)(const void*, unsigned char**);
|
||||
typedef void* (*WolfsslAsn1d2iCb)(void**, const byte **, long);
|
||||
|
||||
struct WOLFSSL_ASN1_TEMPLATE {
|
||||
/* Type functions */
|
||||
wolfssl_asn1_new new_func;
|
||||
wolfssl_asn1_free free_func;
|
||||
wolfssl_asn1_i2d i2d_func;
|
||||
wolfssl_asn1_d2i d2i_func;
|
||||
WolfsslAsn1NewCb new_func;
|
||||
WolfsslAsn1FreeCb free_func;
|
||||
WolfsslAsn1i2dCb i2d_func;
|
||||
WolfsslAsn1d2iCb d2i_func;
|
||||
/* Member info */
|
||||
size_t offset; /* Offset of this field in structure */
|
||||
/* DER info */
|
||||
@ -232,45 +232,45 @@ static WC_MAYBE_UNUSED const byte ASN1_BIT_STRING_FIRST_BYTE = ASN_BIT_STRING;
|
||||
* incorrectly expand the type. Ex: ASN1_INTEGER -> WOLFSSL_ASN1_INTEGER */
|
||||
|
||||
#define ASN1_SIMPLE(type, member, member_type) \
|
||||
{ (wolfssl_asn1_new)member_type##_new, \
|
||||
(wolfssl_asn1_free)member_type##_free, \
|
||||
(wolfssl_asn1_i2d)i2d_##member_type, \
|
||||
(wolfssl_asn1_d2i)d2i_##member_type, \
|
||||
{ (WolfsslAsn1NewCb)member_type##_new, \
|
||||
(WolfsslAsn1FreeCb)member_type##_free, \
|
||||
(WolfsslAsn1i2dCb)i2d_##member_type, \
|
||||
(WolfsslAsn1d2iCb)d2i_##member_type, \
|
||||
ASN1_TYPE(type, member, -1, 0, 0, 0) }
|
||||
|
||||
#define ASN1_IMP(type, member, member_type, tag) \
|
||||
{ (wolfssl_asn1_new)member_type##_new, \
|
||||
(wolfssl_asn1_free)member_type##_free, \
|
||||
(wolfssl_asn1_i2d)i2d_##member_type, \
|
||||
(wolfssl_asn1_d2i)d2i_##member_type, \
|
||||
{ (WolfsslAsn1NewCb)member_type##_new, \
|
||||
(WolfsslAsn1FreeCb)member_type##_free, \
|
||||
(WolfsslAsn1i2dCb)i2d_##member_type, \
|
||||
(WolfsslAsn1d2iCb)d2i_##member_type, \
|
||||
ASN1_TYPE(type, member, tag, member_type##_FIRST_BYTE, 0, 0) }
|
||||
|
||||
#define ASN1_EXP(type, member, member_type, tag) \
|
||||
{ (wolfssl_asn1_new)member_type##_new, \
|
||||
(wolfssl_asn1_free)member_type##_free, \
|
||||
(wolfssl_asn1_i2d)i2d_##member_type, \
|
||||
(wolfssl_asn1_d2i)d2i_##member_type, \
|
||||
{ (WolfsslAsn1NewCb)member_type##_new, \
|
||||
(WolfsslAsn1FreeCb)member_type##_free, \
|
||||
(WolfsslAsn1i2dCb)i2d_##member_type, \
|
||||
(WolfsslAsn1d2iCb)d2i_##member_type, \
|
||||
ASN1_TYPE(type, member, tag, 0, 1, 0) }
|
||||
|
||||
#define ASN1_SEQUENCE_OF(type, member, member_type) \
|
||||
{ (wolfssl_asn1_new)member_type##_new, \
|
||||
(wolfssl_asn1_free)member_type##_free, \
|
||||
(wolfssl_asn1_i2d)i2d_##member_type, \
|
||||
(wolfssl_asn1_d2i)d2i_##member_type, \
|
||||
{ (WolfsslAsn1NewCb)member_type##_new, \
|
||||
(WolfsslAsn1FreeCb)member_type##_free, \
|
||||
(WolfsslAsn1i2dCb)i2d_##member_type, \
|
||||
(WolfsslAsn1d2iCb)d2i_##member_type, \
|
||||
ASN1_TYPE(type, member, -1, 0, 0, 1) }
|
||||
|
||||
#define ASN1_EXP_SEQUENCE_OF(type, member, member_type, tag) \
|
||||
{ (wolfssl_asn1_new)member_type##_new, \
|
||||
(wolfssl_asn1_free)member_type##_free, \
|
||||
(wolfssl_asn1_i2d)i2d_##member_type, \
|
||||
(wolfssl_asn1_d2i)d2i_##member_type, \
|
||||
{ (WolfsslAsn1NewCb)member_type##_new, \
|
||||
(WolfsslAsn1FreeCb)member_type##_free, \
|
||||
(WolfsslAsn1i2dCb)i2d_##member_type, \
|
||||
(WolfsslAsn1d2iCb)d2i_##member_type, \
|
||||
ASN1_TYPE(type, member, tag, 0, 1, 1) }
|
||||
|
||||
#define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, member_type) \
|
||||
{ (wolfssl_asn1_new)member_type##_new, \
|
||||
(wolfssl_asn1_free)member_type##_free, \
|
||||
(wolfssl_asn1_i2d)i2d_##member_type, \
|
||||
(wolfssl_asn1_d2i)d2i_##member_type, \
|
||||
{ (WolfsslAsn1NewCb)member_type##_new, \
|
||||
(WolfsslAsn1FreeCb)member_type##_free, \
|
||||
(WolfsslAsn1i2dCb)i2d_##member_type, \
|
||||
(WolfsslAsn1d2iCb)d2i_##member_type, \
|
||||
0, flags & ASN1_TFLG_TAG_MASK ? tag : -1, 0, \
|
||||
!!(flags & ASN1_TFLG_EXPLICIT), TRUE }
|
||||
|
||||
|
@ -723,7 +723,6 @@ typedef struct w64wrapper {
|
||||
#define XMEMMOVE(d,s,l) memmove((d),(s),(l))
|
||||
|
||||
#define XSTRLEN(s1) strlen((s1))
|
||||
#define XSTRCPY(s1,s2) strcpy((s1),(s2))
|
||||
#define XSTRNCPY(s1,s2,n) strncpy((s1),(s2),(n))
|
||||
/* strstr, strncmp, strcmp, and strncat only used by wolfSSL proper,
|
||||
* not required for wolfCrypt only */
|
||||
|
@ -520,11 +520,14 @@ WOLFSSL_API int wolfIO_RecvFrom(SOCKET_T sd, WOLFSSL_BIO_ADDR *addr, char *buf,
|
||||
#endif
|
||||
#endif /* WOLFSSL_NO_SOCK */
|
||||
|
||||
/* Preseve API previously exposed */
|
||||
WOLFSSL_API int BioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx);
|
||||
WOLFSSL_API int BioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx);
|
||||
|
||||
WOLFSSL_API int SslBioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx);
|
||||
WOLFSSL_API int BioReceive(WOLFSSL_BIO* biord, WOLFSSL_BIO* biowr, char* buf,
|
||||
int sz);
|
||||
WOLFSSL_API int SslBioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx);
|
||||
WOLFSSL_LOCAL int SslBioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx);
|
||||
WOLFSSL_LOCAL int BioReceiveInternal(WOLFSSL_BIO* biord, WOLFSSL_BIO* biowr,
|
||||
char* buf, int sz);
|
||||
WOLFSSL_LOCAL int SslBioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx);
|
||||
#if defined(USE_WOLFSSL_IO)
|
||||
/* default IO callbacks */
|
||||
WOLFSSL_API int EmbedReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx);
|
||||
|
Reference in New Issue
Block a user