本文整理汇总了C++中BIO_set_init函数的典型用法代码示例。如果您正苦于以下问题:C++ BIO_set_init函数的具体用法?C++ BIO_set_init怎么用?C++ BIO_set_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BIO_set_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bio_zlib_new
static int bio_zlib_new(BIO *bi)
{
BIO_ZLIB_CTX *ctx;
# ifdef ZLIB_SHARED
(void)COMP_zlib();
if (!zlib_loaded) {
COMPerr(COMP_F_BIO_ZLIB_NEW, COMP_R_ZLIB_NOT_SUPPORTED);
return 0;
}
# endif
ctx = OPENSSL_zalloc(sizeof(*ctx));
if (ctx == NULL) {
COMPerr(COMP_F_BIO_ZLIB_NEW, ERR_R_MALLOC_FAILURE);
return 0;
}
ctx->ibufsize = ZLIB_DEFAULT_BUFSIZE;
ctx->obufsize = ZLIB_DEFAULT_BUFSIZE;
ctx->zin.zalloc = Z_NULL;
ctx->zin.zfree = Z_NULL;
ctx->zout.zalloc = Z_NULL;
ctx->zout.zfree = Z_NULL;
ctx->comp_level = Z_DEFAULT_COMPRESSION;
BIO_set_init(bi, 1);
BIO_set_data(bi, ctx);
return 1;
}
示例2: bio_create
static int bio_create(BIO *b)
{
BIO_set_init(b, 1);
BIO_set_data(b, NULL);
return 1;
}
示例3: tls_bio_mbuf_new
/** create a new BIO.
* (internal openssl use via the tls_mbuf method)
* @return 1 on success, 0 on error.
*/
static int tls_bio_mbuf_new(BIO* b)
{
struct tls_bio_mbuf_data* d;
TLS_BIO_DBG("tls_bio_mbuf_new called (%p)\n", b);
#if OPENSSL_VERSION_NUMBER < 0x010100000L
b->init = 0; /* not initialized yet */
b->num = 0;
b->ptr = 0;
b->flags = 0;
d = OPENSSL_malloc(sizeof(*d));
if (unlikely(d == 0))
return 0;
d->rd = 0;
d->wr = 0;
b->ptr = d;
#else
BIO_set_init(b, 0);
BIO_set_data(b, NULL);
d = OPENSSL_zalloc(sizeof(*d));
if (unlikely(d == 0))
return 0;
BIO_set_data(b, d);
#endif
return 1;
}
示例4: BIO_set_cipher
int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k,
const unsigned char *i, int e)
{
BIO_ENC_CTX *ctx;
long (*callback) (struct bio_st *, int, const char *, int, long, long);
ctx = BIO_get_data(b);
if (ctx == NULL)
return 0;
callback = BIO_get_callback(b);
if ((callback != NULL) &&
(callback(b, BIO_CB_CTRL, (const char *)c, BIO_CTRL_SET, e,
0L) <= 0))
return 0;
BIO_set_init(b, 1);
if (!EVP_CipherInit_ex(ctx->cipher, c, NULL, k, i, e))
return 0;
if (callback != NULL)
return callback(b, BIO_CB_CTRL, (const char *)c, BIO_CTRL_SET, e, 1L);
return 1;
}
示例5: tlso_bio_create
static int
tlso_bio_create( BIO *b ) {
BIO_set_init( b, 1 );
BIO_set_data( b, NULL );
BIO_clear_flags( b, ~0 );
return 1;
}
示例6: BIO_new
static BIO *dill_tls_new_cbio(void *mem) {
BIO *bio = BIO_new(dill_tls_cbio);
if(dill_slow(!bio)) {errno = EFAULT; return NULL;}
BIO_set_data(bio, mem);
BIO_set_init(bio, 1);
return bio;
}
示例7: bio_bufferevent_new
/* Called to initialize a new BIO */
static int
bio_bufferevent_new(BIO *b)
{
BIO_set_init(b, 0);
BIO_set_data(b, NULL); /* We'll be putting the bufferevent in this field.*/
return 1;
}
示例8: transport_bio_simple_uninit
static int transport_bio_simple_uninit(BIO* bio)
{
WINPR_BIO_SIMPLE_SOCKET* ptr = (WINPR_BIO_SIMPLE_SOCKET*) BIO_get_data(bio);
if (BIO_get_shutdown(bio))
{
if (BIO_get_init(bio))
{
_shutdown(ptr->socket, SD_BOTH);
closesocket(ptr->socket);
ptr->socket = 0;
}
}
if (ptr->hEvent)
{
CloseHandle(ptr->hEvent);
ptr->hEvent = NULL;
}
BIO_set_init(bio, 0);
BIO_set_flags(bio, 0);
return 1;
}
示例9: bio_rdp_tls_free
static int bio_rdp_tls_free(BIO* bio)
{
BIO_RDP_TLS* tls;
if (!bio)
return 0;
tls = (BIO_RDP_TLS*) BIO_get_data(bio);
if (!tls)
return 0;
if (BIO_get_shutdown(bio))
{
if (BIO_get_init(bio) && tls->ssl)
{
SSL_shutdown(tls->ssl);
SSL_free(tls->ssl);
}
BIO_set_init(bio, 0);
BIO_set_flags(bio, 0);
}
DeleteCriticalSection(&tls->lock);
free(tls);
return 1;
}
示例10: tap_free
static int tap_free(BIO *b)
{
if (b == NULL)
return 0;
BIO_set_data(b, NULL);
BIO_set_init(b, 0);
return 1;
}
示例11: mempacket_test_free
static int mempacket_test_free(BIO *bio)
{
MEMPACKET_TEST_CTX *ctx = BIO_get_data(bio);
sk_MEMPACKET_pop_free(ctx->pkts, mempacket_free);
OPENSSL_free(ctx);
BIO_set_data(bio, NULL);
BIO_set_init(bio, 0);
return 1;
}
示例12: md_free
static int md_free(BIO *a)
{
if (a == NULL)
return 0;
EVP_MD_CTX_free(BIO_get_data(a));
BIO_set_data(a, NULL);
BIO_set_init(a, 0);
return 1;
}
示例13: bio_method_new
static int
bio_method_new (BIO * bio)
{
GST_LOG_OBJECT (NULL, "BIO: new");
BIO_set_shutdown (bio, 0);
BIO_set_init (bio, 1);
return 1;
}
示例14: tlso_bio_destroy
static int
tlso_bio_destroy( BIO *b )
{
if ( b == NULL ) return 0;
BIO_set_data( b, NULL ); /* sb_tls_remove() will free it */
BIO_set_init( b, 0 );
BIO_clear_flags( b, ~0 );
return 1;
}
示例15: mongoc_stream_tls_openssl_bio_create
int
mongoc_stream_tls_openssl_bio_create (BIO *b)
{
BSON_ASSERT (b);
BIO_set_init (b, 1);
BIO_set_data (b, NULL);
BIO_set_flags (b, 0);
return 1;
}