Markus Stockhausen 4592172376 MIPS32R3 provides the EXT instruction to extract bits from il y a 5 ans
..
aes 4592172376 MIPS32R3 provides the EXT instruction to extract bits from il y a 5 ans
aria 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
asn1 2aa2beb06c Fix d2i_PublicKey() for EC keys il y a 5 ans
async 9f5a87fd66 add an additional async notification communication method based on callback il y a 5 ans
bf 8b00b7b8b3 Following the license change, modify the boilerplates in crypto/bf/ il y a 5 ans
bio 9b57e4a1ef cygwin: drop explicit O_TEXT il y a 5 ans
blake2 8269e44f9e blake2: avoid writing to output buffer when using default digest length il y a 5 ans
bn c8147d37cc Clear BN_FLG_CONSTTIME on BN_CTX_get() il y a 5 ans
buffer 0c4fa1f10d Following the license change, modify the boilerplates in crypto/buffer/ il y a 5 ans
camellia 5593d9c952 Following the license change, modify the boilerplates in crypto/camellia/ il y a 5 ans
cast a5024e0609 Following the license change, modify the boilerplates in crypto/cast/ il y a 5 ans
chacha db42bb440e ARM64 assembly pack: make it Windows-friendly. il y a 5 ans
cmac 8de396f875 Following the license change, modify the boilerplates in crypto/cmac/ il y a 5 ans
cms b754a8a159 Fix null pointer dereference in cms_RecipientInfo_kari_init il y a 5 ans
comp 48f66f8115 Following the license change, modify the boilerplates in crypto/comp/ il y a 5 ans
conf 9d5560331d Allow the syntax of the .include directive to optionally have '=' il y a 5 ans
ct 5477e84273 Following the license change, modify the boilerplates in crypto/ct/ il y a 5 ans
des df4439186f Remove unnecessary trailing whitespace il y a 5 ans
dh e38873f5ce Following the license change, modify the boilerplates in crypto/dh/ il y a 5 ans
dsa a97faad76a Document and add macros for additional DSA options il y a 5 ans
dso e26f653def Fix compilation with `-DREF_PRINT` il y a 5 ans
ec c0e8e5007b Fix some CFI issues in x86_64 assembly il y a 5 ans
engine 2afebe0bab e_devcrypto: make the /dev/crypto engine dynamic il y a 5 ans
err 3d35e3a253 Don't interleave handshake and other record types in TLSv1.3 il y a 5 ans
ess e85d19c68e crypto/cms: Add support for CAdES Basic Electronic Signatures (CAdES-BES) il y a 5 ans
evp 4c3941c2eb Don't leak EVP_KDF_CTX on error il y a 5 ans
gmac 58efb32c8b Following the license change, modify the boilerplates in crypto/gmac/ il y a 5 ans
hmac 6f888e05e5 Following the license change, modify the boilerplates in crypto/hmac/ il y a 5 ans
idea aa2d9a76b4 Following the license change, modify the boilerplates in crypto/idea/ il y a 5 ans
include 48fe4ce104 Mark generated functions unused (applies to safestack, lhash, sparse_array) il y a 5 ans
kdf 5a285addbf Added new EVP/KDF API. il y a 5 ans
kmac 97c213814b Update kmac.c il y a 5 ans
lhash 1bdbdaffdc Properties for implementation selection. il y a 5 ans
md2 4911f55362 Following the license change, modify the boilerplates in crypto/mdN/ il y a 5 ans
md4 4911f55362 Following the license change, modify the boilerplates in crypto/mdN/ il y a 5 ans
md5 4911f55362 Following the license change, modify the boilerplates in crypto/mdN/ il y a 5 ans
mdc2 2bcb0fc862 Following the license change, modify the boilerplates in crypto/mdc2/ il y a 5 ans
modes 54d00677f3 cfi build fixes in x86-64 ghash assembly il y a 5 ans
objects d1ad7c834e blake2: register MAC objects il y a 5 ans
ocsp 0c49670063 Following the license change, modify the boilerplates in crypto/ocsp/ il y a 5 ans
pem df4439186f Remove unnecessary trailing whitespace il y a 5 ans
perlasm e09633107b Check for unpaired .cfi_remember_state il y a 5 ans
pkcs12 54fffdf47c Following the license change, modify the boilerplates in crypto/pkcs12/ il y a 5 ans
pkcs7 b7617a3a99 Following the license change, modify the boilerplates in crypto/pkcs7/ il y a 5 ans
poly1305 db42bb440e ARM64 assembly pack: make it Windows-friendly. il y a 5 ans
property 0a79572a29 Property: naming and manual clarifiations il y a 5 ans
rand 5c8b7b4caa Cleanup vxworks support to be able to compile for VxWorks 7 il y a 5 ans
rc2 5e4435a760 Following the license change, modify the boilerplates in crypto/rcN/ il y a 5 ans
rc4 1039c78255 Build: correct assembler generation in crypto/rc4/build.info il y a 5 ans
rc5 5e4435a760 Following the license change, modify the boilerplates in crypto/rcN/ il y a 5 ans
ripemd 57946a26b6 Following the license change, modify the boilerplates in crypto/ripemd/ il y a 5 ans
rsa 2beb004b24 Fix comment typo il y a 5 ans
seed 39c44eee7f Following the license change, modify the boilerplates in crypto/seed/ il y a 5 ans
sha 7dec815ecd sha/keccak1600.c: subscribe more platforms for "complementing" optimization. il y a 5 ans
siphash 134148276b Following the license change, modify the boilerplates in crypto/siphash/ il y a 5 ans
sm2 f9f859adc6 Following the license change, modify the boilerplates in crypto/smN/ il y a 5 ans
sm3 f9f859adc6 Following the license change, modify the boilerplates in crypto/smN/ il y a 5 ans
sm4 f9f859adc6 Following the license change, modify the boilerplates in crypto/smN/ il y a 5 ans
srp df4439186f Remove unnecessary trailing whitespace il y a 5 ans
stack 4fc56f9022 Following the license change, modify the boilerplates in crypto/stack/ il y a 5 ans
store 5c0d0c86af Following the license change, modify the boilerplates in crypto/store/ il y a 5 ans
ts e85d19c68e crypto/cms: Add support for CAdES Basic Electronic Signatures (CAdES-BES) il y a 5 ans
txt_db 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
ui 5c8b7b4caa Cleanup vxworks support to be able to compile for VxWorks 7 il y a 5 ans
whrlpool 677c7ab9ea Following the license change, modify the boilerplates in crypto/whrlpool/ il y a 5 ans
x509 5dc40a83c7 Fix a crash in reuse of i2d_X509_PUBKEY il y a 5 ans
x509v3 ffd2df135a X509_check_issued: check that signature algo matches signing key algo il y a 5 ans
LPdir_nyi.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
LPdir_unix.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
LPdir_vms.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
LPdir_win.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
LPdir_win32.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
LPdir_wince.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
README.sparse_array a40f0f6475 Add sparse array data type. il y a 5 ans
alphacpuid.pl 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
arm64cpuid.pl 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
arm_arch.h 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
armcap.c 5f40dd158c crypto/armcap.c, crypto/ppccap.c: stricter use of getauxval() il y a 5 ans
armv4cpuid.pl 3405db97e5 ARM assembly pack: make it Windows-friendly. il y a 5 ans
build.info 1bdbdaffdc Properties for implementation selection. il y a 5 ans
c64xpluscpuid.pl 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
context.c d64b62998b Add an OpenSSL library context il y a 5 ans
cpt_err.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
cryptlib.c df4439186f Remove unnecessary trailing whitespace il y a 5 ans
ctype.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
cversion.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
dllmain.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
ebcdic.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
ex_data.c e17f5b6a6b Add CRYPTO_alloc_ex_data() il y a 5 ans
getenv.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
ia64cpuid.S 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
init.c 2afebe0bab e_devcrypto: make the /dev/crypto engine dynamic il y a 5 ans
mem.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
mem_clr.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
mem_dbg.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
mem_sec.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
mips_arch.h 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
o_dir.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
o_fips.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
o_fopen.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
o_init.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
o_str.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
o_time.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
pariscid.pl 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
ppc_arch.h c8f370485c PPC: Try out if mftb works before using it il y a 5 ans
ppccap.c a28e4890ee poly1305/asm/poly1305-ppc.pl: add vector base 2^26 implementation. il y a 5 ans
ppccpuid.pl c8f370485c PPC: Try out if mftb works before using it il y a 5 ans
s390x_arch.h 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
s390xcap.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
s390xcpuid.pl 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
sparc_arch.h 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
sparccpuid.S 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
sparcv9cap.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
sparse_array.c 1bdbdaffdc Properties for implementation selection. il y a 5 ans
threads_none.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
threads_pthread.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
threads_win.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
uid.c aefb980c45 crypto/uid.c: use own macro as guard rather than AT_SECURE il y a 5 ans
vms_rms.h 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
x86_64cpuid.pl 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans
x86cpuid.pl 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ il y a 5 ans

README.sparse_array

The sparse_array.c file contains an implementation of a sparse array that
attempts to be both space and time efficient.

The sparse array is represented using a tree structure. Each node in the
tree contains a block of pointers to either the user supplied leaf values or
to another node.

There are a number of parameters used to define the block size:

OPENSSL_SA_BLOCK_BITS Specifies the number of bits covered by each block
SA_BLOCK_MAX Specifies the number of pointers in each block
SA_BLOCK_MASK Specifies a bit mask to perform modulo block size
SA_BLOCK_MAX_LEVELS Indicates the maximum possible height of the tree

These constants are inter-related:
SA_BLOCK_MAX = 2 ^ OPENSSL_SA_BLOCK_BITS
SA_BLOCK_MASK = SA_BLOCK_MAX - 1
SA_BLOCK_MAX_LEVELS = number of bits in size_t divided by
OPENSSL_SA_BLOCK_BITS rounded up to the next multiple
of OPENSSL_SA_BLOCK_BITS

OPENSSL_SA_BLOCK_BITS can be defined at compile time and this overrides the
built in setting.

As a space and performance optimisation, the height of the tree is usually
less than the maximum possible height. Only sufficient height is allocated to
accommodate the largest index added to the data structure.

The largest index used to add a value to the array determines the tree height:

+----------------------+---------------------+
| Largest Added Index | Height of Tree |
+----------------------+---------------------+
| SA_BLOCK_MAX - 1 | 1 |
| SA_BLOCK_MAX ^ 2 - 1 | 2 |
| SA_BLOCK_MAX ^ 3 - 1 | 3 |
| ... | ... |
| size_t max | SA_BLOCK_MAX_LEVELS |
+----------------------+---------------------+

The tree height is dynamically increased as needed based on additions.

An empty tree is represented by a NULL root pointer. Inserting a value at
index 0 results in the allocation of a top level node full of null pointers
except for the single pointer to the user's data (N = SA_BLOCK_MAX for
breviety):

+----+
|Root|
|Node|
+-+--+
|
|
|
v
+-+-+---+---+---+---+
| 0 | 1 | 2 |...|N-1|
| |nil|nil|...|nil|
+-+-+---+---+---+---+
|
|
|
v
+-+--+
|User|
|Data|
+----+
Index 0


Inserting at element 2N+1 creates a new root node and pushes down the old root
node. It then creates a second second level node to hold the pointer to the
user's new data:

+----+
|Root|
|Node|
+-+--+
|
|
|
v
+-+-+---+---+---+---+
| 0 | 1 | 2 |...|N-1|
| |nil| |...|nil|
+-+-+---+-+-+---+---+
| |
| +------------------+
| |
v v
+-+-+---+---+---+---+ +-+-+---+---+---+---+
| 0 | 1 | 2 |...|N-1| | 0 | 1 | 2 |...|N-1|
|nil| |nil|...|nil| |nil| |nil|...|nil|
+-+-+---+---+---+---+ +---+-+-+---+---+---+
| |
| |
| |
v v
+-+--+ +-+--+
|User| |User|
|Data| |Data|
+----+ +----+
Index 0 Index 2N+1


The nodes themselves are allocated in a sparse manner. Only nodes which exist
along a path from the root of the tree to an added leaf will be allocated.
The complexity is hidden and nodes are allocated on an as needed basis.
Because the data is expected to be sparse this doesn't result in a large waste
of space.

Values can be removed from the sparse array by setting their index position to
NULL. The data structure does not attempt to reclaim nodes or reduce the
height of the tree on removal. For example, now setting index 0 to NULL would
result in:

+----+
|Root|
|Node|
+-+--+
|
|
|
v
+-+-+---+---+---+---+
| 0 | 1 | 2 |...|N-1|
| |nil| |...|nil|
+-+-+---+-+-+---+---+
| |
| +------------------+
| |
v v
+-+-+---+---+---+---+ +-+-+---+---+---+---+
| 0 | 1 | 2 |...|N-1| | 0 | 1 | 2 |...|N-1|
|nil|nil|nil|...|nil| |nil| |nil|...|nil|
+---+---+---+---+---+ +---+-+-+---+---+---+
|
|
|
v
+-+--+
|User|
|Data|
+----+
Index 2N+1


Accesses to elements in the sparse array take O(log n) time where n is the
largest element. The base of the logarithm is SA_BLOCK_MAX, so for moderately
small indices (e.g. NIDs), single level (constant time) access is achievable.
Space usage is O(minimum(m, n log(n)) where m is the number of elements in the
array.

Note: sparse arrays only include pointers to types. Thus, SPARSE_ARRAY_OF(char)
can be used to store a string.