Skip to content

Commit 86790fc

Browse files
committed
Add the OpenSSL Strategic Architecture document
Includes notes on how to convert documents from Google Docs to Markdown. Reviewed-by: Matt Caswell <[email protected]> (Merged from openssl#110)
1 parent b36b544 commit 86790fc

File tree

7 files changed

+372
-0
lines changed

7 files changed

+372
-0
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ SIMPLE = newsflash.inc sitemap.txt \
1414
community/committers.inc \
1515
community/omc.inc community/omc-alumni.inc \
1616
docs/faq.inc docs/fips.inc \
17+
docs/OpenSSLStrategicArchitecture.html \
1718
news/changelog.inc news/changelog.txt \
1819
news/cl102.txt news/cl110.txt news/cl111.txt \
1920
news/openssl-1.0.2-notes.inc \
@@ -106,6 +107,10 @@ docs/fips.inc: $(wildcard docs/fips/*) bin/mk-filelist
106107
@rm -f $@
107108
./bin/mk-filelist docs/fips fips/ '*' >$@
108109

110+
docs/OpenSSLStrategicArchitecture.html: docs/OpenSSLStrategicArchitecture.md
111+
@rm -f $@
112+
./bin/md-to-html5 $<
113+
109114
news/changelog.inc: news/changelog.txt bin/mk-changelog
110115
@rm -f $@
111116
./bin/mk-changelog <news/changelog.txt >$@
Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
---
2+
title: OpenSSL Strategic Architecture
3+
author: OpenSSL Management Committee (OMC)
4+
date: January, 2019
5+
---
6+
## Introduction
7+
8+
This document outlines the OpenSSL strategic architecture. It will take
9+
multiple releases, starting from 3.0.0, to move the architecture from
10+
the current "as-is" (1.1.1), to the future "to-be" architecture.
11+
12+
Numerous changes are anticipated in the to-be architecture. A migration
13+
path for handling the eventual transition will be provided. The OpenSSL
14+
3.0.0 release will have minimal impact to the vast majority of existing
15+
applications, almost all well-behaved applications will just need to be
16+
recompiled.
17+
18+
The current functionality provided by the engine interface will be
19+
replaced over time via a provider interface. OpenSSL 3.0.0 will continue
20+
to support engines. The to-be architecture will not be fully realised
21+
until OpenSSL 4.0.0 at the earliest.
22+
23+
## As-is architecture
24+
25+
Currently, OpenSSL is split into four principal components:
26+
27+
1. libcrypto. This is the core library for providing implementations of
28+
numerous cryptographic primitives. In addition it provides a set of
29+
supporting services which are used by libssl and libcrypto, as well
30+
as implementations of protocols such as CMS and OCSP.
31+
32+
2. Engine. The functionality of libcrypto can be extended through the
33+
Engine API.
34+
35+
Typically engines are dynamically loadable modules that are registered
36+
with libcrypto and use the available hooks to provide cryptographic
37+
algorithm implementations. Usually these are alternative implementations
38+
of algorithms already provided by libcrypto (e.g. to enable hardware
39+
acceleration of the algorithm), but they may also include algorithms not
40+
implemented in default OpenSSL (e.g. the GOST engine implements the GOST
41+
algorithm family). Some engines are provided as part of the OpenSSL
42+
distribution, and some are provided by external third parties (again,
43+
GOST).
44+
45+
3. libssl. This library depends on libcrypto and implements the TLS and
46+
DTLS protocols.
47+
48+
4. Applications. The applications are a set of command line tools that
49+
use the underlying libssl and libcrypto components to provide a set
50+
of cryptographic and other features such as:
51+
a. Key and parameter generation and inspection
52+
b. Certificate generation and inspection
53+
c. SSL/TLS test tools
54+
d. ASN.1 inspection
55+
e. Etc
56+
57+
Currently, OpenSSL has the following characteristics:
58+
59+
1. EVP. The EVP (envelope) API level provides the high-level abstract
60+
interface to cryptographic functionality separate from the concrete
61+
implementation binding. Direct use of concrete cryptographic
62+
algorithm implementations via interfaces other than the EVP layer is
63+
discouraged. The EVP layer also provides composite operations, such
64+
as signing and verifying. Certain composite operations are also
65+
provided as an EVP-level operation (such as HMAC-SHA256). EVP also
66+
allow use of cryptographic algorithms in an algorithm-agnostic
67+
manner (e.g. EVP\_DigestSign works for both RSA and ECDSA
68+
algorithms).
69+
70+
2. FIPS140 is not supported. FIPS140 it is only available in
71+
OpenSSL-1.0.2 which predates the as-is architecture and is not API
72+
or ABI compatible.
73+
74+
### Conceptual Component View
75+
76+
The existing architecture is a simple 4 level layering with the crypto
77+
layer at the bottom. The TLS layer depends on the crypto layer, and the
78+
applications depend on both the TLS and crypto layers.
79+
80+
Note: the existence of a component in the diagram does not indicate that
81+
the component is a public API or intended for end-user direct access or
82+
usage.
83+
84+
![](images/AsIsComponent.png)
85+
86+
### Packaging View
87+
88+
The components described above are packaged into libraries (libcrypto
89+
and libssl) and associated engine interfaces as well as an "openssl"
90+
command line executable for running the various applications. This is
91+
illustrated in the diagram below.
92+
93+
![](images/AsIsPackaging.png)
94+
95+
## To-be Architecture
96+
97+
The to-be architecture has the following features:
98+
99+
- Core Services form the building blocks usable by applications and
100+
providers. (e.g. BIO, X509, SECMEM, ASN1, etc).
101+
102+
- Providers implement cryptographic algorithms and supporting
103+
services. A provider has implementations of one or more of the
104+
following:
105+
106+
- The cryptographic primitives for an algorithm, e.g. how to
107+
encrypt/decrypt/sign/hash etc.
108+
- Serialisation for an algorithm, e.g. how to convert a private
109+
key into a PEM file. Serialisation could be to or from formats
110+
that are not currently supported.
111+
- Store loader back ends. OpenSSL currently has a store loader
112+
that reads keys, parameters and other items from files.
113+
Providers could have a loader to load from another location
114+
(e.g. LDAP directory).
115+
116+
A Provider may be entirely self-contained or it may use services that
117+
are provided by different providers or the Core Services. For example,
118+
an application may use the cryptographic primitives for an algorithm
119+
implemented by a hardware accelerated provider, but use the
120+
serialisation services of a different provider in order to export keys
121+
into PKCS\#12 format.
122+
123+
A default provider (which contains the core of the current OpenSSL
124+
cryptographic algorithm implementations) will be "built-in" but other
125+
providers will be able to be dynamically loadable at runtime.
126+
127+
Legacy provider module(s) will provide cryptographic implementations for
128+
older algorithms (e.g., DES, MDC2, MD2, Blowfish, CAST). The OMC will
129+
publish a policy for how and when algorithms are transitioned from the
130+
default provider to the legacy provider.
131+
132+
A FIPS provider that embodies the OpenSSL FIPS Cryptographic Module will
133+
be able to be dynamically loaded at runtime.
134+
135+
- The Core enables access to the services offered by providers to
136+
applications (and other providers). Providers make methods available
137+
to the Core. The Core is the mechanism via which concrete
138+
implementations of where things such as algorithms are located.
139+
140+
The Core will implement a property based look-up feature for finding
141+
algorithms, e.g. it might allow you find an algorithm where "fips=true",
142+
or "keysize=128, constant\_time=true". The details of this will be
143+
determined in later design documents.
144+
145+
- Protocol implementations. E.g. TLS, DTLS.
146+
147+
The to-be architecture has the following characteristics:
148+
149+
- The EVP layer becomes a thin wrapper for services implemented in the
150+
providers. Most calls are passed straight through with little/no
151+
pre- or post-processing.
152+
153+
- New EVP APIs will be provided to find the implementation of an
154+
algorithm in the Core to be used for any given EVP call.
155+
156+
- Information will be passed between the core library and the
157+
providers in an implementation agnostic way.
158+
159+
- Legacy APIs (e.g. low level cryptographic APIs that do not go via
160+
the EVP layer) will be deprecated. Note that there are legacy APIs
161+
to non legacy algorithms (e.g. AES is a non-legacy algorithm but
162+
AES\_encrypt is a legacy API).
163+
164+
- The OpenSSL FIPS Cryptographic Module will be implemented as a
165+
dynamically loaded provider. It will be self-contained (i.e. can
166+
only depend on system runtime libraries and services provided by the
167+
Core).
168+
169+
- Other interfaces may also be transitioned to use the Core over time
170+
(for example OSSL\_STORE might be considered for this).
171+
172+
- Engine usage will evolve to providers. "*Bye-bye-Engines,
173+
Hello-Providers".*
174+
175+
### Conceptual Component View
176+
177+
An overview of the conceptual components in the OpenSSL to-be
178+
architecture is as shown in the (pink nirvana) diagram below.
179+
180+
Note: the existence of a component in the diagram does not indicate that
181+
the component is a public API or intended for end-user direct access or
182+
usage.
183+
184+
![](images/ToBeComponent.png)
185+
186+
The components shown here are as follows:
187+
188+
- Applications: Command line applications, e.g. ca, ciphers, cms, dgst
189+
etc
190+
191+
- Protocols: Provides capabilities for communicating between endpoints
192+
according to standard protocols
193+
194+
- TLS Protocols: An implementation of all supported TLS/DTLS
195+
protocols and supporting infrastructure such as:
196+
- SSL BIO: A BIO for communication using TLS
197+
- Statem: The TLS state machine
198+
- Record: The TLS record layer
199+
- Other Protocols
200+
- CMS: An implementation of the Cryptographic Message Syntax
201+
standard
202+
- OCSP: An implementation of Online Certificate Status
203+
Protocol
204+
- TS: An implementation of the Timestamp Protocol
205+
- Supporting Services: Components specifically designed to support
206+
the implementation of protocol code
207+
- Packet: Internal component for reading protocol messages
208+
- Wpacket: Internal component for writing protocol messages
209+
210+
- Core: This is a fundamental component that connects requests for a
211+
service (such as encryption) to a provider of that service. It
212+
implements the ability for providers to register their services
213+
along with the properties of those services. It also provides the
214+
ability to locate a service given a set of properties that the
215+
service must fulfil. For example, properties of an encryption
216+
service might include "aead", "aes-gcm", "fips",
217+
"security-bits=128", etc.
218+
219+
- Default Provider: Implements a set of default services that are
220+
registered with the Core.
221+
222+
- Supporting Services
223+
- Low Level Implementations: This is the set of components
224+
that actually implement the cryptographic primitives.
225+
226+
- FIPS Provider: Implements a set of services that are FIPS validated
227+
and made available to the Core. This includes the following
228+
supporting services:
229+
230+
- POST: Power On Self Test
231+
- KAT: Known Answer Tests
232+
- Integrity Check
233+
- Low Level Implementations: This is the set of components that
234+
actually implement the cryptographic primitives (to meet the
235+
FIPS-mandated self-contained requirement).
236+
237+
- Legacy Provider: Provides implementations of older algorithms that
238+
will be exposed via EVP-level APIs.
239+
240+
- Third-Party Provider: Not part of the OpenSSL distribution. Third
241+
Parties may implement their own providers.
242+
243+
- Common Services: these form the building blocks usable by
244+
applications and providers. (e.g. BIO, X509, SECMEM, ASN1, etc).
245+
246+
- Legacy APIs. The "low-level" APIs. The "legacy" here refers to the
247+
API, not the algorithm itself. For example, AES is not a legacy
248+
algorithm but it has a legacy API (e.g. AES\_encrypt).
249+
250+
### Packaging View
251+
252+
The various components described in the conceptual component view above
253+
are physically packaged into:
254+
255+
- Executable application(s) for use by users
256+
257+
- Libraries for use by application(s)
258+
259+
- Dynamically loadable module(s) for use by the Core.
260+
261+
![](images/ToBePackaging.png)
262+
263+
The physical packages shown here are:
264+
265+
- Openssl executable. The command line application.
266+
267+
- Libssl. This contains everything directly related to TLS and DTLS.
268+
Its contents will be largely the same as libssl in the as-is
269+
architecture. Note that some supporting services will be moved to
270+
libcrypto.
271+
272+
- Libcrypto. This library contains the following components:
273+
274+
- Implementations of the core services such as: X509, ASN1, EVP,
275+
OSSL\_STORE etc
276+
- The Core
277+
- Protocols not related to TLS or DTLS
278+
- Protocol supporting services (e.g. Packet and Wpacket)
279+
- The default provider containing implementations of all the
280+
default algorithms
281+
282+
- Libcrypto-legacy. Provides the legacy "low-level" APIs.
283+
Implementations of the algorithms for these APIS may come from any
284+
provider.
285+
286+
- FIPS module. This contains the FIPS Provider that implements a set
287+
of services that are FIPS validated and are registered with the
288+
Core.
289+
290+
- Legacy module. This contains the legacy provider.

docs/README.googledocs.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
Converting word processing files from Google Docs to Markdown
2+
=============================================================
3+
4+
Converting documents from Google Docs to anything other than what you
5+
get with 'Files'->'Download as' or using an add-on is a bit of an
6+
adventure. All of them come with quirks.
7+
8+
Downloading and converting with pandoc
9+
--------------------------------------
10+
11+
For simple documents, [pandoc](https://pandoc.org/) turns out to be
12+
versatile enough to do a decent job that only requires small amounts
13+
of post processing.
14+
15+
Experiments have shown that to convert a Google Docs wordprocessing
16+
document to Markdown with pandoc, a download in ODT format gives the
17+
cleanest results. It still requires a little bit of editing, of which
18+
some can be automated, using this script:
19+
20+
``` shell
21+
#! /bin/sh
22+
23+
for f in "$@"; do
24+
b=`basename "$f" .odt`
25+
if [ "$f" != "$b" ]; then
26+
bns=`echo "$b" | sed -e 's| *||g'`
27+
pandoc -t markdown --atx-headers --extract-media=media "$f" | perl -p -e '
28+
BEGIN { $/ = ""; }
29+
s|^\[\]\{#anchor-\d+\}|#!# |;
30+
s|(\n\s*)> |$1|g;
31+
' > "$bns.md"
32+
echo "'$bns.md' produced, make sure to edit the title page and the headings"
33+
fi
34+
done
35+
```
36+
37+
When a Markdown file has been produced, a litte bit of editing is
38+
required. A required thing is to look for all lines starting with
39+
`#!#` and replace them with an appropriate number of `#` characters,
40+
depending on the original heading's level. ATX format headings are
41+
used, since they allow more than 2 heading levels.
42+
43+
Try rendering the Markdown file using bin/md-to-html5, have a look at
44+
the result. If you're satisfied, commit the Markdown file and images,
45+
and make appropiate changes in the top Makefile. If not, make changes
46+
in the Markdown file and try again.
47+
48+
Using an add-on in Google Docs and using the result
49+
---------------------------------------------------
50+
51+
Unfortunately, it seems that there are things where Pandoc loses track
52+
of what it's doing. I have not analyzed if it's a pandoc bug or if
53+
the ODT input was bad. Also, pandoc isn't very good at recognising
54+
code sections.
55+
56+
The other option is to use an add-on in Google Docs. I've played with
57+
[gd2md](https://github.com/evbacher/gd2md-html/wiki) with fairly
58+
satisfactory results.
59+
60+
Things to be wary of with gd2md are:
61+
62+
- It doesn't make a difference between ordered lists with numbers
63+
and ordered lists with letters, it makes them all numbered items.
64+
- It sometimes doesn't convert simple things, like headings, and
65+
leaves them as HTML
66+
- It sometimes leaves code as explicit HTML wrapped with \<code\>
67+
- It leaves tables in HTML form
68+
- You have to provide the images yourself
69+
- Internal links to bookmarks and headings are sometimes left with
70+
no corresponding anchor
71+
72+
All these things need to be looked after and edited into markdown.
73+
74+
Try rendering the Markdown file using bin/md-to-html5, have a look at
75+
the result. If you're satisfied, commit the Markdown file and images,
76+
and make appropiate changes in the top Makefile. If not, make changes
77+
in the Markdown file and try again.

docs/images/AsIsComponent.png

51.3 KB
Loading

docs/images/AsIsPackaging.png

35.5 KB
Loading

docs/images/ToBeComponent.png

71.7 KB
Loading

docs/images/ToBePackaging.png

63.5 KB
Loading

0 commit comments

Comments
 (0)