Source / Sink type BIO
--- Translation according to OpenSSL DOC / CRYPTO / BIO_S_NULL.POD and your understanding
(Author: DragonKing, Mail: wzhah@263.net, Posted: httpgdwzh.126.com the openssl professional forum)
This is an empty Source / Sink Bio, and the data written to this BIO is lost, and the read operation from here always returns EOF. The BIO is very simple, the definition of related functions is as follows (OpenSSL / BIO.H):
BIO_METHOD * BIO_S_NULL (VOID);
Its related source file implementation functions are in BSS_NULL.C.
[BIO_S_NULL]
This function returns a NULL-type Bio_Method structure that is defined as follows:
Static Bio_method null_method =
{
BIO_TYPE_NULL,
"NULL",
NULL_WRITE,
null_read,
NULL_PUTS,
null_gets,
Null_ctrl,
null_new,
Null_free,
NULL,
}
From the structure, this type of BIO has achieved a lot of functions, however, take a closer look at the source file, and all of these functions are just simply returned to 0, 1 or the length of the input data, not anything. Those skilled in the Linux system may know that this is the same as the Linux system / dev / null device.
In general, in OpenSSL, this type of Bio is placed at the end of the BIO chain, such as in the application, if you want to make some data through the Filter type Bio Digest summary algorithm, but do not need to put it Send it to any place, but because a BIO chain begins or ends or ends with a Source / Sink type BIO, you can add a Source / Sink type Null type Bio at the end of the BIO chain to implement this feature.