SlideShare a Scribd company logo
LibreSSL
Giovanni Bechis
<giovanni@openbsd.org>
CeBIT 2015
About Me
sys admin and developer @SNB
About Me
sys admin and developer @SNB
OpenBSD developer
Open Source developer in several other projects
CVE-2014-0160
17% of https web servers use OpenSSL as SSL/TLS
library and have heartbeat extension enabled
CVE-2014-0160
17% of https web servers use OpenSSL as SSL/TLS
library and have heartbeat extension enabled
at least Cisco, Fortinet, Oracle and Siemens products
has been affected
CVE-2014-0160
17% of https web servers use OpenSSL as SSL/TLS
library and have heartbeat extension enabled
at least Cisco, Fortinet, Oracle and Siemens products
has been affected
bug was introduced on December 2011 and fixed on
April 2014
CVE-2014-0160
17% of https web servers use OpenSSL as SSL/TLS
library and have heartbeat extension enabled
at least Cisco, Fortinet, Oracle and Siemens products
has been affected
bug was introduced on December 2011 and fixed on
April 2014
exploitation of this bug does not leave any trace
CVE-2014-0160
17% of https web servers use OpenSSL as SSL/TLS
library and have heartbeat extension enabled
at least Cisco, Fortinet, Oracle and Siemens products
has been affected
bug was introduced on December 2011 and fixed on
April 2014
exploitation of this bug does not leave any trace
eWEEK estimated a total cost of $500 million
How the Heartbleed bug works:
attacker can dump up to 64k of memory near the
SSL heartbeat of the attacked machine
How the Heartbleed bug works:
attacker can dump up to 64k of memory near the
SSL heartbeat of the attacked machine
attack can be repeated many times to obtain
different memory allocations of 64k size
How the Heartbleed bug works:
attacker can dump up to 64k of memory near the
SSL heartbeat of the attacked machine
attack can be repeated many times to obtain
different memory allocations of 64k size
memory stolen could reveal any kind of data:
passwords, credit card numbers, personal data, ...
Why Heartbleed happened ?
code too complex and intricated
Why Heartbleed happened ?
code too complex and intricated
developers mostly interested in adding features, not
fixing code
Why Heartbleed happened ?
code too complex and intricated
developers mostly interested in adding features, not
fixing code
fixes not merged upstream
Why Heartbleed happened ?
code too complex and intricated
developers mostly interested in adding features, not
fixing code
fixes not merged upstream
bugs (and fixes) sleep for years in the bug tracker
OpenSSL malloc replacement
it never frees memory (tools cannot spot bugs)
OpenSSL malloc replacement
it never frees memory (tools cannot spot bugs)
it uses LIFO recycling (no ’use after free’ problems)
OpenSSL malloc replacement
it never frees memory (tools cannot spot bugs)
it uses LIFO recycling (no ’use after free’ problems)
includes a debugging malloc that send private info to
logs
OpenSSL malloc replacement
it never frees memory (tools cannot spot bugs)
it uses LIFO recycling (no ’use after free’ problems)
includes a debugging malloc that send private info to
logs
includes the ability to replace the malloc/free at
runtime
What’s wrong with OpenSSL code ?
quite all OpenSSL API headers are public
What’s wrong with OpenSSL code ?
quite all OpenSSL API headers are public
it is developed using ”OpenSSL C”
What’s wrong with OpenSSL code ?
quite all OpenSSL API headers are public
it is developed using ”OpenSSL C”
it uses its own functions instead of those provided by
libc like BIO free(3) or BIO strdup
What’s wrong with OpenSSL code ?
quite all OpenSSL API headers are public
it is developed using ”OpenSSL C”
it uses its own functions instead of those provided by
libc like BIO free(3) or BIO strdup
it has strange compile options (in OpenSSL both
NO OLD ASN1 and NO ASN1 OLD compile options
are present but their meaning is slightly different)
LibreSSL
very young project, development started on April
2014
LibreSSL
very young project, development started on April
2014
mostly developed by OpenBSD team
LibreSSL
very young project, development started on April
2014
mostly developed by OpenBSD team
forked from OpenSSL 1.0.1g
LibreSSL goals
preserve API/ABI compatibility with OpenSSL
LibreSSL goals
preserve API/ABI compatibility with OpenSSL
bring more people into working with the codebase
(+KNF, -#ifdef)
LibreSSL goals
preserve API/ABI compatibility with OpenSSL
bring more people into working with the codebase
(+KNF, -#ifdef)
fix bugs asap, use modern coding practices
LibreSSL goals
preserve API/ABI compatibility with OpenSSL
bring more people into working with the codebase
(+KNF, -#ifdef)
fix bugs asap, use modern coding practices
do portability the right wayTM
Some differences between LibreSSL and OpenSSL
∼90000 lines of code less but same functionalities
Some differences between LibreSSL and OpenSSL
∼90000 lines of code less but same functionalities
does not support VMS, MsDos nor MacOS 9
Some differences between LibreSSL and OpenSSL
∼90000 lines of code less but same functionalities
does not support VMS, MsDos nor MacOS 9
does not have FIPS support
Some differences between LibreSSL and OpenSSL
∼90000 lines of code less but same functionalities
does not support VMS, MsDos nor MacOS 9
does not have FIPS support
different set of ciphers (-MD2, -SRP, +ChaCha,
+poly1305)
Some differences between LibreSSL and OpenSSL
∼90000 lines of code less but same functionalities
does not support VMS, MsDos nor MacOS 9
does not have FIPS support
different set of ciphers (-MD2, -SRP, +ChaCha,
+poly1305)
BIO * functions do the right thingTM
Some differences between LibreSSL and OpenSSL
∼90000 lines of code less but same functionalities
does not support VMS, MsDos nor MacOS 9
does not have FIPS support
different set of ciphers (-MD2, -SRP, +ChaCha,
+poly1305)
BIO * functions do the right thingTM
malloc(x*y) has been converted to reallocarray(x,y)
How OpenSSL does portable
use and abuse of internal functions that behaves
”more or less” the same as libc counterpart
How OpenSSL does portable
use and abuse of internal functions that behaves
”more or less” the same as libc counterpart
#ifdef and #ifndef everywhere
How OpenSSL does portable
use and abuse of internal functions that behaves
”more or less” the same as libc counterpart
#ifdef and #ifndef everywhere
support for as many combinations of operating
systems and compilers out there
How OpenSSH (and LibreSSL) does portable
assume a sane target OS (OpenBSD) and code with
his standards
How OpenSSH (and LibreSSL) does portable
assume a sane target OS (OpenBSD) and code with
his standards
build and maintain code on the main target OS,
using modern C
How OpenSSH (and LibreSSL) does portable
assume a sane target OS (OpenBSD) and code with
his standards
build and maintain code on the main target OS,
using modern C
provide portability code only to provide functions
that other OS’s don’t provide
How OpenSSH (and LibreSSL) does portable
assume a sane target OS (OpenBSD) and code with
his standards
build and maintain code on the main target OS,
using modern C
provide portability code only to provide functions
that other OS’s don’t provide
do not reimplement libc
How OpenSSH (and LibreSSL) does portable
assume a sane target OS (OpenBSD) and code with
his standards
build and maintain code on the main target OS,
using modern C
provide portability code only to provide functions
that other OS’s don’t provide
do not reimplement libc
put as few #ifdefs as possible in the code
LibreSSL API, ftp client
- if (inet_pton(AF_INET, host, &addrbuf) != 1 &&
- inet_pton(AF_INET6, host, &addrbuf) != 1) {
- if (SSL_set_tlsext_host_name(ssl, host) == 0) {
- ERR_print_errors_fp(ttyout);
- goto cleanup_url_get;
- }
- }
- if (SSL_connect(ssl) <= 0) {
- ERR_print_errors_fp(ttyout);
+ if (ressl_connect_socket(ssl, s, host) != 0) {
+ fprintf(ttyout, "SSL failure: %sn", ressl_error(ssl));
goto cleanup_url_get;
}
- if (ssl_verify) {
- X509 *cert;
-
- cert = SSL_get_peer_certificate(ssl);
- if (cert == NULL) {
- fprintf(ttyout, "%s: no server certificaten",
- getprogname());
- goto cleanup_url_get;
- }
-
- if (ssl_check_hostname(cert, host) != 0) {
- X509_free(cert);
- fprintf(ttyout, "%s: host ‘%s’ not present in"
- " server certificaten",
- getprogname(), host);
- goto cleanup_url_get;
- }
-
- X509_free(cert);
What should we have learned ?
fix bugs ASAP, do not let them sleep fo years
What should we have learned ?
fix bugs ASAP, do not let them sleep fo years
use as few workarounds as possible in your code
What should we have learned ?
fix bugs ASAP, do not let them sleep fo years
use as few workarounds as possible in your code
review your code
What should we have learned ?
fix bugs ASAP, do not let them sleep fo years
use as few workarounds as possible in your code
review your code
look at your old code and fix horrors sleeping there
What should we have learned ?
fix bugs ASAP, do not let them sleep fo years
use as few workarounds as possible in your code
review your code
look at your old code and fix horrors sleeping there
do not reinvent the wheel
What should we have learned ?
fix bugs ASAP, do not let them sleep fo years
use as few workarounds as possible in your code
review your code
look at your old code and fix horrors sleeping there
do not reinvent the wheel
every bug could be a security bug
Questions ?
Giovanni Bechis
<giovanni@openbsd.org>

More Related Content

PDF
OpenSSH: keep your secrets safe
PDF
Relayd: a load balancer for OpenBSD
PDF
OpenSMTPD: we deliver !!
PDF
OWASP Proxy
KEY
PDF
Centralized Logging with syslog
PDF
Tomáš Čorej - OpenSSH
PDF
Pycon - Python for ethical hackers
OpenSSH: keep your secrets safe
Relayd: a load balancer for OpenBSD
OpenSMTPD: we deliver !!
OWASP Proxy
Centralized Logging with syslog
Tomáš Čorej - OpenSSH
Pycon - Python for ethical hackers

What's hot (20)

ODP
Getting started with RDO Havana
PPT
Sockets intro
PDF
Monitoring with Syslog and EventMachine
ODP
Pycon Sec
PDF
Lecture10
PDF
Python for Penetration testers
PDF
Python build your security tools.pdf
PPTX
Penetration testing using python
PPT
Socket System Calls
PDF
Fluentd - CNCF Paris
PDF
Linux seccomp(2) vs OpenBSD pledge(2)
PPTX
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
PDF
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
PPT
Iss letcure 7_8
PPTX
Linux networking
PDF
Arduino práctico ethernet
PDF
For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...
PDF
Linux Shellcode disassembling
PDF
Possibility of arbitrary code execution by Step-Oriented Programming
PDF
Reverse engineering Swisscom's Centro Grande Modem
Getting started with RDO Havana
Sockets intro
Monitoring with Syslog and EventMachine
Pycon Sec
Lecture10
Python for Penetration testers
Python build your security tools.pdf
Penetration testing using python
Socket System Calls
Fluentd - CNCF Paris
Linux seccomp(2) vs OpenBSD pledge(2)
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
Iss letcure 7_8
Linux networking
Arduino práctico ethernet
For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...
Linux Shellcode disassembling
Possibility of arbitrary code execution by Step-Oriented Programming
Reverse engineering Swisscom's Centro Grande Modem
Ad

Similar to LibreSSL, one year later (20)

PDF
LibreSSL
PDF
CONFidence 2015: Trust boundaries - Mateusz Kocielski
PDF
OpenSSL programming (still somewhat initial version)
PDF
Trust boundaries - Confidence 2015
PPTX
Rust Hack
PPTX
Security Vulnerabilities in Third Party Code - Fix All the Things!
PDF
A Boring Article About a Check of the OpenSSL Project
PDF
OpenSSL Basic Function Call Flow
PDF
Heartbleed Overview
PDF
[CLASS 2014] Palestra Técnica - Jonathan Knudsen
PDF
libcurl, seven SSL libraries and one SSH library
PDF
How to exploit heartbleed vulnerability demonstration
PPSX
Bleeding secrets
PDF
OSDC 2014: Christopher Kunz - Software defined networking in an open-source c...
PPTX
Synchronization
PPT
Open ssl heart bleed weakness.
PPTX
Heartbleed Bug: A case study
PDF
CNIT 127: Ch 18: Source Code Auditing
PPTX
Shooting clay pidgins
PDF
"The Sorry State of SSL" Hynek Schlawack, PyConRu 2014
LibreSSL
CONFidence 2015: Trust boundaries - Mateusz Kocielski
OpenSSL programming (still somewhat initial version)
Trust boundaries - Confidence 2015
Rust Hack
Security Vulnerabilities in Third Party Code - Fix All the Things!
A Boring Article About a Check of the OpenSSL Project
OpenSSL Basic Function Call Flow
Heartbleed Overview
[CLASS 2014] Palestra Técnica - Jonathan Knudsen
libcurl, seven SSL libraries and one SSH library
How to exploit heartbleed vulnerability demonstration
Bleeding secrets
OSDC 2014: Christopher Kunz - Software defined networking in an open-source c...
Synchronization
Open ssl heart bleed weakness.
Heartbleed Bug: A case study
CNIT 127: Ch 18: Source Code Auditing
Shooting clay pidgins
"The Sorry State of SSL" Hynek Schlawack, PyConRu 2014
Ad

More from Giovanni Bechis (17)

PDF
the Apache way
PDF
SpamAssassin 4.0 new features
PDF
ACME and mod_md: tls certificates made easy
PDF
Scaling antispam solutions with Puppet
PDF
What's new in SpamAssassin 3.4.3
PDF
Fighting Spam for fun and profit
PDF
Pledge in OpenBSD
PDF
Pf: the OpenBSD packet filter
PDF
ELK: a log management framework
PDF
SOGo: sostituire Microsoft Exchange con software Open Source
PDF
Cloud storage, i tuoi files, ovunque con te
PDF
Npppd: easy vpn with OpenBSD
PDF
Openssh: comunicare in sicurezza
PDF
Ipv6: il futuro di internet
PDF
L'ABC della crittografia
PDF
Pf e netfilter, analisi dei firewall open source
PDF
Mysql diventa grande
the Apache way
SpamAssassin 4.0 new features
ACME and mod_md: tls certificates made easy
Scaling antispam solutions with Puppet
What's new in SpamAssassin 3.4.3
Fighting Spam for fun and profit
Pledge in OpenBSD
Pf: the OpenBSD packet filter
ELK: a log management framework
SOGo: sostituire Microsoft Exchange con software Open Source
Cloud storage, i tuoi files, ovunque con te
Npppd: easy vpn with OpenBSD
Openssh: comunicare in sicurezza
Ipv6: il futuro di internet
L'ABC della crittografia
Pf e netfilter, analisi dei firewall open source
Mysql diventa grande

Recently uploaded (20)

PDF
Softaken Excel to vCard Converter Software.pdf
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
L1 - Introduction to python Backend.pptx
PDF
Digital Strategies for Manufacturing Companies
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Transform Your Business with a Software ERP System
Softaken Excel to vCard Converter Software.pdf
How Creative Agencies Leverage Project Management Software.pdf
Odoo POS Development Services by CandidRoot Solutions
Wondershare Filmora 15 Crack With Activation Key [2025
L1 - Introduction to python Backend.pptx
Digital Strategies for Manufacturing Companies
Odoo Companies in India – Driving Business Transformation.pdf
Understanding Forklifts - TECH EHS Solution
Design an Analysis of Algorithms II-SECS-1021-03
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
2025 Textile ERP Trends: SAP, Odoo & Oracle
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
ManageIQ - Sprint 268 Review - Slide Deck
Upgrade and Innovation Strategies for SAP ERP Customers
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Navsoft: AI-Powered Business Solutions & Custom Software Development
Transform Your Business with a Software ERP System

LibreSSL, one year later

  • 2. About Me sys admin and developer @SNB
  • 3. About Me sys admin and developer @SNB OpenBSD developer Open Source developer in several other projects
  • 4. CVE-2014-0160 17% of https web servers use OpenSSL as SSL/TLS library and have heartbeat extension enabled
  • 5. CVE-2014-0160 17% of https web servers use OpenSSL as SSL/TLS library and have heartbeat extension enabled at least Cisco, Fortinet, Oracle and Siemens products has been affected
  • 6. CVE-2014-0160 17% of https web servers use OpenSSL as SSL/TLS library and have heartbeat extension enabled at least Cisco, Fortinet, Oracle and Siemens products has been affected bug was introduced on December 2011 and fixed on April 2014
  • 7. CVE-2014-0160 17% of https web servers use OpenSSL as SSL/TLS library and have heartbeat extension enabled at least Cisco, Fortinet, Oracle and Siemens products has been affected bug was introduced on December 2011 and fixed on April 2014 exploitation of this bug does not leave any trace
  • 8. CVE-2014-0160 17% of https web servers use OpenSSL as SSL/TLS library and have heartbeat extension enabled at least Cisco, Fortinet, Oracle and Siemens products has been affected bug was introduced on December 2011 and fixed on April 2014 exploitation of this bug does not leave any trace eWEEK estimated a total cost of $500 million
  • 9. How the Heartbleed bug works: attacker can dump up to 64k of memory near the SSL heartbeat of the attacked machine
  • 10. How the Heartbleed bug works: attacker can dump up to 64k of memory near the SSL heartbeat of the attacked machine attack can be repeated many times to obtain different memory allocations of 64k size
  • 11. How the Heartbleed bug works: attacker can dump up to 64k of memory near the SSL heartbeat of the attacked machine attack can be repeated many times to obtain different memory allocations of 64k size memory stolen could reveal any kind of data: passwords, credit card numbers, personal data, ...
  • 12. Why Heartbleed happened ? code too complex and intricated
  • 13. Why Heartbleed happened ? code too complex and intricated developers mostly interested in adding features, not fixing code
  • 14. Why Heartbleed happened ? code too complex and intricated developers mostly interested in adding features, not fixing code fixes not merged upstream
  • 15. Why Heartbleed happened ? code too complex and intricated developers mostly interested in adding features, not fixing code fixes not merged upstream bugs (and fixes) sleep for years in the bug tracker
  • 16. OpenSSL malloc replacement it never frees memory (tools cannot spot bugs)
  • 17. OpenSSL malloc replacement it never frees memory (tools cannot spot bugs) it uses LIFO recycling (no ’use after free’ problems)
  • 18. OpenSSL malloc replacement it never frees memory (tools cannot spot bugs) it uses LIFO recycling (no ’use after free’ problems) includes a debugging malloc that send private info to logs
  • 19. OpenSSL malloc replacement it never frees memory (tools cannot spot bugs) it uses LIFO recycling (no ’use after free’ problems) includes a debugging malloc that send private info to logs includes the ability to replace the malloc/free at runtime
  • 20. What’s wrong with OpenSSL code ? quite all OpenSSL API headers are public
  • 21. What’s wrong with OpenSSL code ? quite all OpenSSL API headers are public it is developed using ”OpenSSL C”
  • 22. What’s wrong with OpenSSL code ? quite all OpenSSL API headers are public it is developed using ”OpenSSL C” it uses its own functions instead of those provided by libc like BIO free(3) or BIO strdup
  • 23. What’s wrong with OpenSSL code ? quite all OpenSSL API headers are public it is developed using ”OpenSSL C” it uses its own functions instead of those provided by libc like BIO free(3) or BIO strdup it has strange compile options (in OpenSSL both NO OLD ASN1 and NO ASN1 OLD compile options are present but their meaning is slightly different)
  • 24. LibreSSL very young project, development started on April 2014
  • 25. LibreSSL very young project, development started on April 2014 mostly developed by OpenBSD team
  • 26. LibreSSL very young project, development started on April 2014 mostly developed by OpenBSD team forked from OpenSSL 1.0.1g
  • 27. LibreSSL goals preserve API/ABI compatibility with OpenSSL
  • 28. LibreSSL goals preserve API/ABI compatibility with OpenSSL bring more people into working with the codebase (+KNF, -#ifdef)
  • 29. LibreSSL goals preserve API/ABI compatibility with OpenSSL bring more people into working with the codebase (+KNF, -#ifdef) fix bugs asap, use modern coding practices
  • 30. LibreSSL goals preserve API/ABI compatibility with OpenSSL bring more people into working with the codebase (+KNF, -#ifdef) fix bugs asap, use modern coding practices do portability the right wayTM
  • 31. Some differences between LibreSSL and OpenSSL ∼90000 lines of code less but same functionalities
  • 32. Some differences between LibreSSL and OpenSSL ∼90000 lines of code less but same functionalities does not support VMS, MsDos nor MacOS 9
  • 33. Some differences between LibreSSL and OpenSSL ∼90000 lines of code less but same functionalities does not support VMS, MsDos nor MacOS 9 does not have FIPS support
  • 34. Some differences between LibreSSL and OpenSSL ∼90000 lines of code less but same functionalities does not support VMS, MsDos nor MacOS 9 does not have FIPS support different set of ciphers (-MD2, -SRP, +ChaCha, +poly1305)
  • 35. Some differences between LibreSSL and OpenSSL ∼90000 lines of code less but same functionalities does not support VMS, MsDos nor MacOS 9 does not have FIPS support different set of ciphers (-MD2, -SRP, +ChaCha, +poly1305) BIO * functions do the right thingTM
  • 36. Some differences between LibreSSL and OpenSSL ∼90000 lines of code less but same functionalities does not support VMS, MsDos nor MacOS 9 does not have FIPS support different set of ciphers (-MD2, -SRP, +ChaCha, +poly1305) BIO * functions do the right thingTM malloc(x*y) has been converted to reallocarray(x,y)
  • 37. How OpenSSL does portable use and abuse of internal functions that behaves ”more or less” the same as libc counterpart
  • 38. How OpenSSL does portable use and abuse of internal functions that behaves ”more or less” the same as libc counterpart #ifdef and #ifndef everywhere
  • 39. How OpenSSL does portable use and abuse of internal functions that behaves ”more or less” the same as libc counterpart #ifdef and #ifndef everywhere support for as many combinations of operating systems and compilers out there
  • 40. How OpenSSH (and LibreSSL) does portable assume a sane target OS (OpenBSD) and code with his standards
  • 41. How OpenSSH (and LibreSSL) does portable assume a sane target OS (OpenBSD) and code with his standards build and maintain code on the main target OS, using modern C
  • 42. How OpenSSH (and LibreSSL) does portable assume a sane target OS (OpenBSD) and code with his standards build and maintain code on the main target OS, using modern C provide portability code only to provide functions that other OS’s don’t provide
  • 43. How OpenSSH (and LibreSSL) does portable assume a sane target OS (OpenBSD) and code with his standards build and maintain code on the main target OS, using modern C provide portability code only to provide functions that other OS’s don’t provide do not reimplement libc
  • 44. How OpenSSH (and LibreSSL) does portable assume a sane target OS (OpenBSD) and code with his standards build and maintain code on the main target OS, using modern C provide portability code only to provide functions that other OS’s don’t provide do not reimplement libc put as few #ifdefs as possible in the code
  • 45. LibreSSL API, ftp client - if (inet_pton(AF_INET, host, &addrbuf) != 1 && - inet_pton(AF_INET6, host, &addrbuf) != 1) { - if (SSL_set_tlsext_host_name(ssl, host) == 0) { - ERR_print_errors_fp(ttyout); - goto cleanup_url_get; - } - } - if (SSL_connect(ssl) <= 0) { - ERR_print_errors_fp(ttyout); + if (ressl_connect_socket(ssl, s, host) != 0) { + fprintf(ttyout, "SSL failure: %sn", ressl_error(ssl)); goto cleanup_url_get; } - if (ssl_verify) { - X509 *cert; - - cert = SSL_get_peer_certificate(ssl); - if (cert == NULL) { - fprintf(ttyout, "%s: no server certificaten", - getprogname()); - goto cleanup_url_get; - } - - if (ssl_check_hostname(cert, host) != 0) { - X509_free(cert); - fprintf(ttyout, "%s: host ‘%s’ not present in" - " server certificaten", - getprogname(), host); - goto cleanup_url_get; - } - - X509_free(cert);
  • 46. What should we have learned ? fix bugs ASAP, do not let them sleep fo years
  • 47. What should we have learned ? fix bugs ASAP, do not let them sleep fo years use as few workarounds as possible in your code
  • 48. What should we have learned ? fix bugs ASAP, do not let them sleep fo years use as few workarounds as possible in your code review your code
  • 49. What should we have learned ? fix bugs ASAP, do not let them sleep fo years use as few workarounds as possible in your code review your code look at your old code and fix horrors sleeping there
  • 50. What should we have learned ? fix bugs ASAP, do not let them sleep fo years use as few workarounds as possible in your code review your code look at your old code and fix horrors sleeping there do not reinvent the wheel
  • 51. What should we have learned ? fix bugs ASAP, do not let them sleep fo years use as few workarounds as possible in your code review your code look at your old code and fix horrors sleeping there do not reinvent the wheel every bug could be a security bug