mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 11:17:29 +02:00
Remove the BIO method custom... its not compat. Fix bio->ptr to be void*
.
This commit is contained in:
66
src/bio.c
66
src/bio.c
@ -185,8 +185,8 @@ int wolfSSL_BIO_read(WOLFSSL_BIO* bio, void* buf, int len)
|
|||||||
|
|
||||||
while (bio != NULL && ret >= 0) {
|
while (bio != NULL && ret >= 0) {
|
||||||
/* check for custom read */
|
/* check for custom read */
|
||||||
if (bio && bio->method->custom && bio->method->custom->readCb) {
|
if (bio->method && bio->method->readCb) {
|
||||||
ret = bio->method->custom->readCb(bio, (char*)buf, len);
|
ret = bio->method->readCb(bio, (char*)buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* formating data */
|
/* formating data */
|
||||||
@ -442,8 +442,8 @@ int wolfSSL_BIO_write(WOLFSSL_BIO* bio, const void* data, int len)
|
|||||||
|
|
||||||
while (bio != NULL && ret >= 0) {
|
while (bio != NULL && ret >= 0) {
|
||||||
/* check for custom write */
|
/* check for custom write */
|
||||||
if (bio && bio->method->custom && bio->method->custom->writeCb) {
|
if (bio->method && bio->method->writeCb) {
|
||||||
ret = bio->method->custom->writeCb(bio, (const char*)data, len);
|
ret = bio->method->writeCb(bio, (const char*)data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for formating */
|
/* check for formating */
|
||||||
@ -557,9 +557,8 @@ long wolfSSL_BIO_ctrl(WOLFSSL_BIO *bio, int cmd, long larg, void *parg)
|
|||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_BIO_ctrl");
|
WOLFSSL_ENTER("wolfSSL_BIO_ctrl");
|
||||||
|
|
||||||
if (bio && bio->method && bio->method->custom &&
|
if (bio && bio->method && bio->method->ctrlCb) {
|
||||||
bio->method->custom->ctrlCb) {
|
return bio->method->ctrlCb(bio, cmd, larg, parg);
|
||||||
return bio->method->custom->ctrlCb(bio, cmd, larg, parg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(cmd) {
|
switch(cmd) {
|
||||||
@ -637,8 +636,8 @@ int wolfSSL_BIO_gets(WOLFSSL_BIO* bio, char* buf, int sz)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check if is custom method */
|
/* check if is custom method */
|
||||||
if (bio->method->custom && bio->method->custom->getsCb) {
|
if (bio->method && bio->method->getsCb) {
|
||||||
return bio->method->custom->getsCb(bio, buf, sz);
|
return bio->method->getsCb(bio, buf, sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (bio->type) {
|
switch (bio->type) {
|
||||||
@ -757,8 +756,8 @@ int wolfSSL_BIO_puts(WOLFSSL_BIO* bio, const char* buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check if is custom method */
|
/* check if is custom method */
|
||||||
if (bio->method->custom && bio->method->custom->putsCb) {
|
if (bio->method && bio->method->putsCb) {
|
||||||
return bio->method->custom->putsCb(bio, buf);
|
return bio->method->putsCb(bio, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
sz = (int)XSTRLEN(buf);
|
sz = (int)XSTRLEN(buf);
|
||||||
@ -1391,7 +1390,6 @@ long wolfSSL_BIO_set_nbio(WOLFSSL_BIO* bio, long on)
|
|||||||
WOLFSSL_BIO_METHOD *wolfSSL_BIO_meth_new(int type, const char *name)
|
WOLFSSL_BIO_METHOD *wolfSSL_BIO_meth_new(int type, const char *name)
|
||||||
{
|
{
|
||||||
WOLFSSL_BIO_METHOD* meth;
|
WOLFSSL_BIO_METHOD* meth;
|
||||||
WOLFSSL_BIO_METHOD_CUSTOM* custom;
|
|
||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_BIO_meth_new");
|
WOLFSSL_ENTER("wolfSSL_BIO_meth_new");
|
||||||
|
|
||||||
@ -1403,19 +1401,8 @@ WOLFSSL_BIO_METHOD *wolfSSL_BIO_meth_new(int type, const char *name)
|
|||||||
}
|
}
|
||||||
XMEMSET(meth, 0, sizeof(WOLFSSL_BIO_METHOD));
|
XMEMSET(meth, 0, sizeof(WOLFSSL_BIO_METHOD));
|
||||||
meth->type = (byte)type;
|
meth->type = (byte)type;
|
||||||
|
XSTRNCPY(meth->name, name, MAX_BIO_METHOD_NAME - 1);
|
||||||
|
|
||||||
custom = (WOLFSSL_BIO_METHOD_CUSTOM*)XMALLOC(
|
|
||||||
sizeof(WOLFSSL_BIO_METHOD_CUSTOM), NULL, DYNAMIC_TYPE_OPENSSL);
|
|
||||||
if (custom == NULL) {
|
|
||||||
WOLFSSL_MSG("Error allocating memory for WOLFSSL_BIO_METHOD_CUSTOM");
|
|
||||||
wolfSSL_BIO_meth_free(meth);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
XMEMSET(custom, 0, sizeof(WOLFSSL_BIO_METHOD_CUSTOM));
|
|
||||||
meth->custom = custom;
|
|
||||||
|
|
||||||
XSTRNCPY(custom->name, name, MAX_BIO_METHOD_NAME - 1);
|
|
||||||
return meth;
|
return meth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1424,9 +1411,6 @@ void wolfSSL_BIO_meth_free(WOLFSSL_BIO_METHOD *biom)
|
|||||||
{
|
{
|
||||||
WOLFSSL_ENTER("wolfSSL_BIO_meth_free");
|
WOLFSSL_ENTER("wolfSSL_BIO_meth_free");
|
||||||
if (biom) {
|
if (biom) {
|
||||||
if (biom->custom) {
|
|
||||||
XFREE(biom->custom, NULL, DYNAMIC_TYPE_OPENSSL);
|
|
||||||
}
|
|
||||||
XFREE(biom, NULL, DYNAMIC_TYPE_OPENSSL);
|
XFREE(biom, NULL, DYNAMIC_TYPE_OPENSSL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1436,8 +1420,8 @@ int wolfSSL_BIO_meth_set_write(WOLFSSL_BIO_METHOD *biom,
|
|||||||
wolfSSL_BIO_meth_write_cb biom_write)
|
wolfSSL_BIO_meth_write_cb biom_write)
|
||||||
{
|
{
|
||||||
WOLFSSL_ENTER("wolfSSL_BIO_meth_set_write");
|
WOLFSSL_ENTER("wolfSSL_BIO_meth_set_write");
|
||||||
if (biom && biom->custom) {
|
if (biom) {
|
||||||
biom->custom->writeCb = biom_write;
|
biom->writeCb = biom_write;
|
||||||
return WOLFSSL_SUCCESS;
|
return WOLFSSL_SUCCESS;
|
||||||
}
|
}
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
@ -1448,8 +1432,8 @@ int wolfSSL_BIO_meth_set_read(WOLFSSL_BIO_METHOD *biom,
|
|||||||
wolfSSL_BIO_meth_read_cb biom_read)
|
wolfSSL_BIO_meth_read_cb biom_read)
|
||||||
{
|
{
|
||||||
WOLFSSL_ENTER("wolfSSL_BIO_meth_set_read");
|
WOLFSSL_ENTER("wolfSSL_BIO_meth_set_read");
|
||||||
if (biom && biom->custom) {
|
if (biom) {
|
||||||
biom->custom->readCb = biom_read;
|
biom->readCb = biom_read;
|
||||||
return WOLFSSL_SUCCESS;
|
return WOLFSSL_SUCCESS;
|
||||||
}
|
}
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
@ -1460,8 +1444,8 @@ int wolfSSL_BIO_meth_set_puts(WOLFSSL_BIO_METHOD *biom,
|
|||||||
wolfSSL_BIO_meth_puts_cb biom_puts)
|
wolfSSL_BIO_meth_puts_cb biom_puts)
|
||||||
{
|
{
|
||||||
WOLFSSL_ENTER("wolfSSL_BIO_meth_set_puts");
|
WOLFSSL_ENTER("wolfSSL_BIO_meth_set_puts");
|
||||||
if (biom && biom->custom) {
|
if (biom) {
|
||||||
biom->custom->putsCb = biom_puts;
|
biom->putsCb = biom_puts;
|
||||||
return WOLFSSL_SUCCESS;
|
return WOLFSSL_SUCCESS;
|
||||||
}
|
}
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
@ -1472,8 +1456,8 @@ int wolfSSL_BIO_meth_set_gets(WOLFSSL_BIO_METHOD *biom,
|
|||||||
wolfSSL_BIO_meth_gets_cb biom_gets)
|
wolfSSL_BIO_meth_gets_cb biom_gets)
|
||||||
{
|
{
|
||||||
WOLFSSL_ENTER("wolfSSL_BIO_meth_set_gets");
|
WOLFSSL_ENTER("wolfSSL_BIO_meth_set_gets");
|
||||||
if (biom && biom->custom) {
|
if (biom) {
|
||||||
biom->custom->getsCb = biom_gets;
|
biom->getsCb = biom_gets;
|
||||||
return WOLFSSL_SUCCESS;
|
return WOLFSSL_SUCCESS;
|
||||||
}
|
}
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
@ -1484,8 +1468,8 @@ int wolfSSL_BIO_meth_set_ctrl(WOLFSSL_BIO_METHOD *biom,
|
|||||||
wolfSSL_BIO_meth_get_ctrl_cb biom_ctrl)
|
wolfSSL_BIO_meth_get_ctrl_cb biom_ctrl)
|
||||||
{
|
{
|
||||||
WOLFSSL_ENTER("wolfSSL_BIO_meth_set_ctrl");
|
WOLFSSL_ENTER("wolfSSL_BIO_meth_set_ctrl");
|
||||||
if (biom && biom->custom) {
|
if (biom) {
|
||||||
biom->custom->ctrlCb = biom_ctrl;
|
biom->ctrlCb = biom_ctrl;
|
||||||
return WOLFSSL_SUCCESS;
|
return WOLFSSL_SUCCESS;
|
||||||
}
|
}
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
@ -1496,8 +1480,8 @@ int wolfSSL_BIO_meth_set_create(WOLFSSL_BIO_METHOD *biom,
|
|||||||
wolfSSL_BIO_meth_create_cb biom_create)
|
wolfSSL_BIO_meth_create_cb biom_create)
|
||||||
{
|
{
|
||||||
WOLFSSL_ENTER("wolfSSL_BIO_meth_set_create");
|
WOLFSSL_ENTER("wolfSSL_BIO_meth_set_create");
|
||||||
if (biom && biom->custom) {
|
if (biom) {
|
||||||
biom->custom->createCb = biom_create;
|
biom->createCb = biom_create;
|
||||||
return WOLFSSL_SUCCESS;
|
return WOLFSSL_SUCCESS;
|
||||||
}
|
}
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
@ -1508,8 +1492,8 @@ int wolfSSL_BIO_meth_set_destroy(WOLFSSL_BIO_METHOD *biom,
|
|||||||
wolfSSL_BIO_meth_destroy_cb biom_destroy)
|
wolfSSL_BIO_meth_destroy_cb biom_destroy)
|
||||||
{
|
{
|
||||||
WOLFSSL_STUB("wolfSSL_BIO_meth_set_destroy");
|
WOLFSSL_STUB("wolfSSL_BIO_meth_set_destroy");
|
||||||
if (biom && biom->custom) {
|
if (biom) {
|
||||||
biom->custom->freeCb = biom_destroy;
|
biom->freeCb = biom_destroy;
|
||||||
return WOLFSSL_SUCCESS;
|
return WOLFSSL_SUCCESS;
|
||||||
}
|
}
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
|
64
src/ssl.c
64
src/ssl.c
@ -13951,7 +13951,6 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||||||
|
|
||||||
WOLFSSL_ENTER("BIO_f_buffer");
|
WOLFSSL_ENTER("BIO_f_buffer");
|
||||||
meth.type = WOLFSSL_BIO_BUFFER;
|
meth.type = WOLFSSL_BIO_BUFFER;
|
||||||
meth.custom = NULL;
|
|
||||||
|
|
||||||
return &meth;
|
return &meth;
|
||||||
}
|
}
|
||||||
@ -13973,7 +13972,6 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_BIO_s_bio");
|
WOLFSSL_ENTER("wolfSSL_BIO_s_bio");
|
||||||
bio_meth.type = WOLFSSL_BIO_BIO;
|
bio_meth.type = WOLFSSL_BIO_BIO;
|
||||||
bio_meth.custom = NULL;
|
|
||||||
|
|
||||||
return &bio_meth;
|
return &bio_meth;
|
||||||
}
|
}
|
||||||
@ -13986,7 +13984,6 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_BIO_s_file");
|
WOLFSSL_ENTER("wolfSSL_BIO_s_file");
|
||||||
file_meth.type = WOLFSSL_BIO_FILE;
|
file_meth.type = WOLFSSL_BIO_FILE;
|
||||||
file_meth.custom = NULL;
|
|
||||||
|
|
||||||
return &file_meth;
|
return &file_meth;
|
||||||
}
|
}
|
||||||
@ -13999,7 +13996,6 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_BIO_f_ssl");
|
WOLFSSL_ENTER("wolfSSL_BIO_f_ssl");
|
||||||
meth.type = WOLFSSL_BIO_SSL;
|
meth.type = WOLFSSL_BIO_SSL;
|
||||||
meth.custom = NULL;
|
|
||||||
|
|
||||||
return &meth;
|
return &meth;
|
||||||
}
|
}
|
||||||
@ -14011,7 +14007,6 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_BIO_s_socket");
|
WOLFSSL_ENTER("wolfSSL_BIO_s_socket");
|
||||||
meth.type = WOLFSSL_BIO_SOCKET;
|
meth.type = WOLFSSL_BIO_SOCKET;
|
||||||
meth.custom = NULL;
|
|
||||||
|
|
||||||
return &meth;
|
return &meth;
|
||||||
}
|
}
|
||||||
@ -14099,8 +14094,8 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check if is custom method */
|
/* check if is custom method */
|
||||||
if (method->custom) {
|
if (method->createCb) {
|
||||||
method->custom->createCb(bio);
|
method->createCb(bio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bio;
|
return bio;
|
||||||
@ -14173,8 +14168,8 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* call custom set free callback */
|
/* call custom set free callback */
|
||||||
if (bio->method->custom && bio->method->custom->freeCb) {
|
if (bio->method && bio->method->freeCb) {
|
||||||
bio->method->custom->freeCb(bio);
|
bio->method->freeCb(bio);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remove from pair by setting the paired bios pair to NULL */
|
/* remove from pair by setting the paired bios pair to NULL */
|
||||||
@ -17698,7 +17693,7 @@ WOLFSSL_X509* wolfSSL_X509_d2i(WOLFSSL_X509** x509, const byte* in, int len)
|
|||||||
return WOLFSSL_SUCCESS;
|
return WOLFSSL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* not an openssl compatibility function - getting for derCert */
|
||||||
const byte* wolfSSL_X509_get_der(WOLFSSL_X509* x509, int* outSz)
|
const byte* wolfSSL_X509_get_der(WOLFSSL_X509* x509, int* outSz)
|
||||||
{
|
{
|
||||||
WOLFSSL_ENTER("wolfSSL_X509_get_der");
|
WOLFSSL_ENTER("wolfSSL_X509_get_der");
|
||||||
@ -21118,7 +21113,6 @@ WOLFSSL_BIO_METHOD* wolfSSL_BIO_s_mem(void)
|
|||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_BIO_s_mem");
|
WOLFSSL_ENTER("wolfSSL_BIO_s_mem");
|
||||||
meth.type = WOLFSSL_BIO_MEMORY;
|
meth.type = WOLFSSL_BIO_MEMORY;
|
||||||
meth.custom = NULL;
|
|
||||||
|
|
||||||
return &meth;
|
return &meth;
|
||||||
}
|
}
|
||||||
@ -21130,7 +21124,6 @@ WOLFSSL_BIO_METHOD* wolfSSL_BIO_f_base64(void)
|
|||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_BIO_f_base64");
|
WOLFSSL_ENTER("wolfSSL_BIO_f_base64");
|
||||||
meth.type = WOLFSSL_BIO_BASE64;
|
meth.type = WOLFSSL_BIO_BASE64;
|
||||||
meth.custom = NULL;
|
|
||||||
|
|
||||||
return &meth;
|
return &meth;
|
||||||
}
|
}
|
||||||
@ -35437,29 +35430,38 @@ void* wolfSSL_GetDhAgreeCtx(WOLFSSL* ssl)
|
|||||||
|
|
||||||
cert->version = (int)wolfSSL_X509_get_version(x509);
|
cert->version = (int)wolfSSL_X509_get_version(x509);
|
||||||
|
|
||||||
#ifdef WOLFSSL_ALT_NAMES
|
#ifdef WOLFSSL_ALT_NAMES
|
||||||
if ((x509->notBefore.length + 2) < CTC_DATE_SIZE) {
|
if (x509->notBefore.length > 0) {
|
||||||
cert->beforeDate[0] = x509->notBefore.type;
|
if ((x509->notBefore.length + 2) < CTC_DATE_SIZE) {
|
||||||
cert->beforeDate[1] = x509->notBefore.length;
|
cert->beforeDate[0] = x509->notBefore.type;
|
||||||
XMEMCPY(&cert->beforeDate[2], x509->notBefore.data,
|
cert->beforeDate[1] = x509->notBefore.length;
|
||||||
x509->notBefore.length);
|
XMEMCPY(&cert->beforeDate[2], x509->notBefore.data,
|
||||||
cert->beforeDateSz = x509->notBefore.length + 2;
|
x509->notBefore.length);
|
||||||
|
cert->beforeDateSz = x509->notBefore.length + 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
WOLFSSL_MSG("Not before date too large");
|
||||||
|
return WOLFSSL_FAILURE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
WOLFSSL_MSG("Not before date too large");
|
cert->beforeDateSz = 0;
|
||||||
return WOLFSSL_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
if (x509->notAfter.length > 0) {
|
||||||
if ((x509->notAfter.length + 2) < CTC_DATE_SIZE) {
|
if ((x509->notAfter.length + 2) < CTC_DATE_SIZE) {
|
||||||
cert->afterDate[0] = x509->notAfter.type;
|
cert->afterDate[0] = x509->notAfter.type;
|
||||||
cert->afterDate[1] = x509->notAfter.length;
|
cert->afterDate[1] = x509->notAfter.length;
|
||||||
XMEMCPY(&cert->afterDate[2], x509->notAfter.data,
|
XMEMCPY(&cert->afterDate[2], x509->notAfter.data,
|
||||||
x509->notAfter.length);
|
x509->notAfter.length);
|
||||||
cert->afterDateSz = x509->notAfter.length + 2;
|
cert->afterDateSz = x509->notAfter.length + 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
WOLFSSL_MSG("Not after date too large");
|
||||||
|
return WOLFSSL_FAILURE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
WOLFSSL_MSG("Not after date too large");
|
cert->afterDateSz = 0;
|
||||||
return WOLFSSL_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy over alt names */
|
/* copy over alt names */
|
||||||
@ -35480,7 +35482,7 @@ void* wolfSSL_GetDhAgreeCtx(WOLFSSL* ssl)
|
|||||||
}
|
}
|
||||||
cert->altNamesSz = idx;
|
cert->altNamesSz = idx;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* WOLFSSL_ALT_NAMES */
|
||||||
|
|
||||||
cert->sigType = wolfSSL_X509_get_signature_type(x509);
|
cert->sigType = wolfSSL_X509_get_signature_type(x509);
|
||||||
cert->keyType = x509->pubKeyOID;
|
cert->keyType = x509->pubKeyOID;
|
||||||
|
10
src/wolfio.c
10
src/wolfio.c
@ -125,10 +125,9 @@ int BioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx)
|
|||||||
return WOLFSSL_CBIO_ERR_GENERAL;
|
return WOLFSSL_CBIO_ERR_GENERAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ssl->biord->method && ssl->biord->method->custom &&
|
if (ssl->biord->method && ssl->biord->method->readCb) {
|
||||||
ssl->biord->method->custom->readCb) {
|
|
||||||
WOLFSSL_MSG("Calling custom biord");
|
WOLFSSL_MSG("Calling custom biord");
|
||||||
recvd = ssl->biord->method->custom->readCb(ssl->biord, buf, sz);
|
recvd = ssl->biord->method->readCb(ssl->biord, buf, sz);
|
||||||
if (recvd < 0 && recvd != WOLFSSL_CBIO_ERR_WANT_READ)
|
if (recvd < 0 && recvd != WOLFSSL_CBIO_ERR_WANT_READ)
|
||||||
return WOLFSSL_CBIO_ERR_GENERAL;
|
return WOLFSSL_CBIO_ERR_GENERAL;
|
||||||
return recvd;
|
return recvd;
|
||||||
@ -179,10 +178,9 @@ int BioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx)
|
|||||||
return WOLFSSL_CBIO_ERR_GENERAL;
|
return WOLFSSL_CBIO_ERR_GENERAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ssl->biowr->method && ssl->biowr->method->custom &&
|
if (ssl->biowr->method && ssl->biowr->method->writeCb) {
|
||||||
ssl->biowr->method->custom->writeCb) {
|
|
||||||
WOLFSSL_MSG("Calling custom biowr");
|
WOLFSSL_MSG("Calling custom biowr");
|
||||||
sent = ssl->biowr->method->custom->writeCb(ssl->biowr, buf, sz);
|
sent = ssl->biowr->method->writeCb(ssl->biowr, buf, sz);
|
||||||
if (sent < 0) {
|
if (sent < 0) {
|
||||||
return WOLFSSL_CBIO_ERR_GENERAL;
|
return WOLFSSL_CBIO_ERR_GENERAL;
|
||||||
}
|
}
|
||||||
|
17
tests/api.c
17
tests/api.c
@ -21806,13 +21806,20 @@ static void test_wolfSSL_X509_sign(void)
|
|||||||
|
|
||||||
ret = X509_sign(x509, priv, EVP_sha256());
|
ret = X509_sign(x509, priv, EVP_sha256());
|
||||||
|
|
||||||
/* Valid case - size should be 768 */
|
#if 0
|
||||||
#ifdef USE_CERT_BUFFERS_1024
|
/* example for writting to file */
|
||||||
AssertIntEQ(ret, 768);
|
XFILE tmpFile = XFOPEN("./signed.der", "wb");
|
||||||
#else
|
if (tmpFile) {
|
||||||
AssertIntEQ(ret, 798);
|
int derSz = 0;
|
||||||
|
const byte* der = wolfSSL_X509_get_der(x509, &derSz);
|
||||||
|
XFWRITE(der, 1, derSz, tmpFile);
|
||||||
|
}
|
||||||
|
XFCLOSE(tmpFile);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Valid case - size should be 798 */
|
||||||
|
AssertIntEQ(ret, 798);
|
||||||
|
|
||||||
X509_NAME_free(name);
|
X509_NAME_free(name);
|
||||||
EVP_PKEY_free(priv);
|
EVP_PKEY_free(priv);
|
||||||
EVP_PKEY_free(pub);
|
EVP_PKEY_free(pub);
|
||||||
|
@ -430,8 +430,12 @@ typedef long (*wolfSSL_BIO_meth_get_ctrl_cb)(WOLFSSL_BIO*, int, long, void*);
|
|||||||
typedef int (*wolfSSL_BIO_meth_create_cb)(WOLFSSL_BIO*);
|
typedef int (*wolfSSL_BIO_meth_create_cb)(WOLFSSL_BIO*);
|
||||||
typedef int (*wolfSSL_BIO_meth_destroy_cb)(WOLFSSL_BIO*);
|
typedef int (*wolfSSL_BIO_meth_destroy_cb)(WOLFSSL_BIO*);
|
||||||
|
|
||||||
|
/* wolfSSL BIO_METHOD type */
|
||||||
|
#ifndef MAX_BIO_METHOD_NAME
|
||||||
#define MAX_BIO_METHOD_NAME 256
|
#define MAX_BIO_METHOD_NAME 256
|
||||||
typedef struct WOLFSSL_BIO_METHOD_CUSTOM {
|
#endif
|
||||||
|
struct WOLFSSL_BIO_METHOD {
|
||||||
|
byte type; /* method type */
|
||||||
char name[MAX_BIO_METHOD_NAME];
|
char name[MAX_BIO_METHOD_NAME];
|
||||||
|
|
||||||
wolfSSL_BIO_meth_puts_cb putsCb;
|
wolfSSL_BIO_meth_puts_cb putsCb;
|
||||||
@ -444,12 +448,6 @@ typedef struct WOLFSSL_BIO_METHOD_CUSTOM {
|
|||||||
wolfSSL_BIO_meth_create_cb createCb;
|
wolfSSL_BIO_meth_create_cb createCb;
|
||||||
|
|
||||||
wolfSSL_BIO_meth_get_ctrl_cb ctrlCb;
|
wolfSSL_BIO_meth_get_ctrl_cb ctrlCb;
|
||||||
} WOLFSSL_BIO_METHOD_CUSTOM;
|
|
||||||
|
|
||||||
/* wolfSSL BIO_METHOD type */
|
|
||||||
struct WOLFSSL_BIO_METHOD {
|
|
||||||
byte type; /* method type */
|
|
||||||
WOLFSSL_BIO_METHOD_CUSTOM* custom;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* wolfSSL BIO type */
|
/* wolfSSL BIO type */
|
||||||
@ -467,7 +465,7 @@ struct WOLFSSL_BIO {
|
|||||||
WOLFSSL_BIO* next; /* next in chain */
|
WOLFSSL_BIO* next; /* next in chain */
|
||||||
WOLFSSL_BIO* pair; /* BIO paired with */
|
WOLFSSL_BIO* pair; /* BIO paired with */
|
||||||
void* heap; /* user heap hint */
|
void* heap; /* user heap hint */
|
||||||
byte* ptr; /* memory buffer */
|
void* ptr; /* memory buffer */
|
||||||
void* usrCtx; /* user set pointer */
|
void* usrCtx; /* user set pointer */
|
||||||
char* infoArg; /* BIO callback argument */
|
char* infoArg; /* BIO callback argument */
|
||||||
wolf_bio_info_cb infoCb; /* BIO callback */
|
wolf_bio_info_cb infoCb; /* BIO callback */
|
||||||
|
Reference in New Issue
Block a user