当前位置:网站首页>Ssl/bio of OpenSSL_ get_ fd
Ssl/bio of OpenSSL_ get_ fd
2022-07-03 17:48:00 【Brother Xing plays with the clouds】
As long as it is used OpenSSL, There are always things that make people feel overwhelmed . This time it is SSL_get_fd. I created one in a very simple way SSL object , Directly on this object SSL Of accept:
bio = BIO_new(BIO_s_accept()); BIO_set_accept_port(bio, "1234"); BIO_do_accept(bio); SSL_set_bio(ssl, bio, bio); SSL_accept(ssl);
So you don't have to deal with annoying sockaddr 了 . Later, I thought about this SSL The bottom layer of object Association socket On the implementation setsockopt, Take it for granted SSL_get_fd/BIO_get_fd This is very self-evident API. So far, it's great . Then it's not cool , I find setsockiot The descriptor of the final operation is listnen Socket , instead of accept The socket returned . This seems to be API On the level, it is very reasonable , After all bio The parameter of is a BIO_s_accept, And what is associated with it is a listen Socket . Want to get the right accept Returned read / write socket The descriptor , You have to write this :
[plain] view plaincopyprint? stay CODE View the code slice on the screen and derive it to my code slice
BIO_get_fd(BIO_next(bio), &sd);
BIO_get_fd(BIO_next(bio), &sd); The problem is , You must know this BIO stack How is it arranged to write the above code , The best way to do this is to see OpenSSL Source code .
BIO Of API Design must be designed as get/set_fd Do you ?BIO You have to be with one fd Is it relevant ?memory Type of BIO If get fd Words , What kind of error will it return ? since BIO Constitute a superimposed IO stack, Then maybe the one at the bottom will be with one UNIX fd Related to , Then why not just go back to the bottom one ?
边栏推荐
- Golang单元测试、Mock测试以及基准测试
- How to purchase Google colab members in China
- Enterprise custom form engine solution (XI) -- form rule engine 1
- How to read the source code [debug and observe the source code]
- [combinatorics] recursive equation (summary of the solution process of recursive equation | homogeneous | double root | non-homogeneous | characteristic root is 1 | exponential form | the bottom is th
- Electronic Science and technology 20th autumn "Microcomputer Principle and application" online assignment 2 [standard answer]
- Leetcode 538 converts binary search tree into cumulative tree -- recursive method and iterative method
- Type conversion, variable
- [combinatorics] recursive equation (special solution example 1 Hannover tower complete solution process | special solution example 2 special solution processing when the characteristic root is 1)
- Ml (machine learning) softmax function to realize the classification of simple movie categories
猜你喜欢
Luogu: p2685 [tjoi2012] Bridge
Records of long objects and long judgments in the stream of list
Golang单元测试、Mock测试以及基准测试
Leetcode Valentine's Day Special - looking for a single dog
Classroom attendance system based on face recognition tkinter+openpyxl+face_ recognition
[RT thread] NXP rt10xx device driver framework -- pin construction and use
[combinatorics] generating function (summation property)
MySQL grouping query
QT learning diary 9 - dialog box
Qt调节Win屏幕亮度和声音大小
随机推荐
Leetcode540: a single element in an ordered array
Leetcode 108 converts an ordered array into a binary search tree -- recursive method
2021 ICPC regional competition (Shanghai) g.edge groups (tree DP)
[combinatorics] generating function (shift property)
List的stream中Long对象与long判等问题记录
How to train mask r-cnn model with your own data
Graduation summary
Brief introduction to the core functions of automatic penetration testing tool
[Yu Yue education] family education SPOC class 2 reference materials of Shanghai Normal University
Introduction to SolidWorks gear design software tool geartrax
Analysis report on production and marketing demand and investment forecast of China's PVC industry from 2021 to 2026
PHP processing - watermark images (text, etc.)
How to deploy applications on kubernetes cluster
c# .net 工具生态
Y is always discrete and can't understand, how to solve it? Answer: read it several times
Hongmeng third training
Applet with multiple tabs and Swipers + paging of each tab
Leetcode Valentine's Day Special - looking for a single dog
Research Report on investment trends and development planning of China's thermal insulation material industry, 2022-2028
Records of long objects and long judgments in the stream of list