Matt Caswell a2f27fd750 Move the rand_nonce_lock code into drbg_lib.c пре 5 година
..
aes 66ad63e801 Make basic AES ciphers available from within the FIPS providers пре 5 година
aria 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
asn1 6aa2e59e1c Add d2i_KeyParams/i2d_KeyParams API's. пре 5 година
async 9f5a87fd66 add an additional async notification communication method based on callback пре 5 година
bf 8b00b7b8b3 Following the license change, modify the boilerplates in crypto/bf/ пре 6 година
bio d34bce03ac Add testing of RDONLY memory BIOs пре 5 година
blake2 7ed66e2634 Change EVP_MAC method from copy to dup пре 5 година
bn 3e3dcf9ab8 Call RSA generation callback at the correct time. пре 5 година
buffer 0c4fa1f10d Following the license change, modify the boilerplates in crypto/buffer/ пре 6 година
camellia 5593d9c952 Following the license change, modify the boilerplates in crypto/camellia/ пре 6 година
cast a5024e0609 Following the license change, modify the boilerplates in crypto/cast/ пре 6 година
chacha 302aa3c26d s390x assembly pack: remove chacha20 dependency on non-base memnonics пре 5 година
cmac 7ed66e2634 Change EVP_MAC method from copy to dup пре 5 година
cmp 8869ad4a39 Certificate Management Protocol (CMP, RFC 4210) extension to OpenSSL пре 5 година
cms 19e512a824 Add the content type attribute to additional CMS signerinfo. пре 5 година
comp 48f66f8115 Following the license change, modify the boilerplates in crypto/comp/ пре 6 година
conf f4a96507fb crypto/conf: openssl_config_int() returns unitialized value пре 5 година
crmf 8869ad4a39 Certificate Management Protocol (CMP, RFC 4210) extension to OpenSSL пре 5 година
ct 5477e84273 Following the license change, modify the boilerplates in crypto/ct/ пре 6 година
des df4439186f Remove unnecessary trailing whitespace пре 5 година
dh 70b0b977f7 Change default RSA, DSA and DH size to 2048 bit пре 5 година
dsa cd4c83b524 The SHA256 is not a mandatory digest for DSA. пре 5 година
dso 31b6ed76df Rework DSO API conditions and configuration option пре 5 година
ec 8be6a4ed02 Fix various mistakes in ec_GFp_nistp_recode_scalar_bits comment. пре 5 година
engine 21d9856986 Coverity CID 1444957: Error handling issues пре 5 година
err be5fc053ed Replace EVP_MAC_CTX_copy() by EVP_MAC_CTX_dup() пре 5 година
ess 9fdcc21fdc constify *_dup() and *i2d_*() and related functions as far as possible, introducing DECLARE_ASN1_DUP_FUNCTION пре 5 година
evp 7ed66e2634 Change EVP_MAC method from copy to dup пре 5 година
gmac 7ed66e2634 Change EVP_MAC method from copy to dup пре 5 година
hmac 7ed66e2634 Change EVP_MAC method from copy to dup пре 5 година
idea aa2d9a76b4 Following the license change, modify the boilerplates in crypto/idea/ пре 6 година
include da0d114cd9 Convert drbg_lib to use OPENSSL_CTX for its global data пре 5 година
kdf be5fc053ed Replace EVP_MAC_CTX_copy() by EVP_MAC_CTX_dup() пре 5 година
kmac 7ed66e2634 Change EVP_MAC method from copy to dup пре 5 година
lhash 319e518a5a Make some EVP code available from within the FIPS module пре 5 година
md2 4911f55362 Following the license change, modify the boilerplates in crypto/mdN/ пре 6 година
md4 4911f55362 Following the license change, modify the boilerplates in crypto/mdN/ пре 6 година
md5 d5e5e2ffaf Move digests to providers пре 5 година
mdc2 2bcb0fc862 Following the license change, modify the boilerplates in crypto/mdc2/ пре 6 година
modes be5fc053ed Replace EVP_MAC_CTX_copy() by EVP_MAC_CTX_dup() пре 5 година
objects 53bfacf220 Fix GOST OID пре 5 година
ocsp 878dc8dd95 Join the x509 and x509v3 directories пре 5 година
pem 8cf85d4899 Fix the allocation size in EVP_OpenInit and PEM_SignFinal пре 5 година
perlasm 3062468b0a s390x assembly pack: update perlasm module пре 5 година
pkcs12 9fdcc21fdc constify *_dup() and *i2d_*() and related functions as far as possible, introducing DECLARE_ASN1_DUP_FUNCTION пре 5 година
pkcs7 9fdcc21fdc constify *_dup() and *i2d_*() and related functions as far as possible, introducing DECLARE_ASN1_DUP_FUNCTION пре 5 година
poly1305 7ed66e2634 Change EVP_MAC method from copy to dup пре 5 година
property b6db5b3d50 Remove file reference from property documentation. пре 5 година
rand a2f27fd750 Move the rand_nonce_lock code into drbg_lib.c пре 5 година
rc2 5e4435a760 Following the license change, modify the boilerplates in crypto/rcN/ пре 6 година
rc4 1039c78255 Build: correct assembler generation in crypto/rc4/build.info пре 5 година
rc5 5e4435a760 Following the license change, modify the boilerplates in crypto/rcN/ пре 6 година
ripemd 57946a26b6 Following the license change, modify the boilerplates in crypto/ripemd/ пре 6 година
rsa 70b0b977f7 Change default RSA, DSA and DH size to 2048 bit пре 5 година
seed 39c44eee7f Following the license change, modify the boilerplates in crypto/seed/ пре 6 година
sha d5e5e2ffaf Move digests to providers пре 5 година
siphash 7ed66e2634 Change EVP_MAC method from copy to dup пре 5 година
sm2 8267becb8b Support SM2 certificate verification пре 5 година
sm3 d5e5e2ffaf Move digests to providers пре 5 година
sm4 f9f859adc6 Following the license change, modify the boilerplates in crypto/smN/ пре 6 година
srp df4439186f Remove unnecessary trailing whitespace пре 5 година
stack 3593266d1c Make core code available within the FIPS module пре 5 година
store 5c0d0c86af Following the license change, modify the boilerplates in crypto/store/ пре 6 година
ts 9fdcc21fdc constify *_dup() and *i2d_*() and related functions as far as possible, introducing DECLARE_ASN1_DUP_FUNCTION пре 5 година
txt_db 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
ui 5c8b7b4caa Cleanup vxworks support to be able to compile for VxWorks 7 пре 5 година
whrlpool 677c7ab9ea Following the license change, modify the boilerplates in crypto/whrlpool/ пре 6 година
x509 bab6046146 Replace BIO_printf with ASN1_STRING_print in GENERAL_NAME_print пре 5 година
LPdir_nyi.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
LPdir_unix.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
LPdir_vms.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
LPdir_win.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
LPdir_win32.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
LPdir_wince.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
README.sparse_array a40f0f6475 Add sparse array data type. пре 5 година
alphacpuid.pl 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
arm64cpuid.pl 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
arm_arch.h 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
armcap.c 5f40dd158c crypto/armcap.c, crypto/ppccap.c: stricter use of getauxval() пре 5 година
armv4cpuid.pl 3405db97e5 ARM assembly pack: make it Windows-friendly. пре 5 година
bsearch.c 5c3f1e34b5 ossl_bsearch(): New generic internal binary search utility function пре 5 година
build.info 41525ed628 Ensure we get all the right defines for AES assembler in FIPS module пре 5 година
c64xpluscpuid.pl 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
context.c 3593266d1c Make core code available within the FIPS module пре 5 година
core_fetch.c d5e5e2ffaf Move digests to providers пре 5 година
core_namemap.c f2182a4e6f Create internal number<->name mapping API пре 5 година
cpt_err.c 1aedc35fd6 Instead of global data store it in an OPENSSL_CTX пре 5 година
cryptlib.c df4439186f Remove unnecessary trailing whitespace пре 5 година
ctype.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
cversion.c 47ca833835 Add the possibility to display and use MODULESDIR пре 5 година
dllmain.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
ebcdic.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
ex_data.c 1f76076095 Coverity CID 1444951: Null pointer dereferences пре 5 година
getenv.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
ia64cpuid.S 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
info.c 0109e030db Add a way for the application to get OpenSSL configuration data пре 5 година
init.c a2f27fd750 Move the rand_nonce_lock code into drbg_lib.c пре 5 година
mem.c 9efa0ae0b6 Create a FIPS provider and put SHA256 in it пре 5 година
mem_clr.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
mem_dbg.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
mem_sec.c 61783db5b5 Use vxRandLib for VxWorks7 пре 5 година
mips_arch.h 1b9c5f2e2f Fix compiling error for mips32r6 and mips64r6 пре 5 година
o_dir.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
o_fips.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
o_fopen.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
o_init.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
o_str.c e3b35d2b29 openssl_strerror_r: Fix handling of GNU strerror_r пре 5 година
o_time.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
params.c 9830e7ea42 Params conversion tests. пре 5 година
pariscid.pl 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
ppc_arch.h c8f370485c PPC: Try out if mftb works before using it пре 5 година
ppccap.c 41525ed628 Ensure we get all the right defines for AES assembler in FIPS module пре 5 година
ppccpuid.pl c8f370485c PPC: Try out if mftb works before using it пре 5 година
provider.c 24626a47fb Constify OSSL_PROVIDER getter input parameters пре 5 година
provider_conf.c 71849dff56 Rename the PROVIDER_CONF trace to CONF пре 5 година
provider_core.c ad14e8e508 Coverity fixes пре 5 година
provider_local.h c41f3ae0d9 Replumbing: Add a mechanism to pre-populate the provider store пре 5 година
provider_predefined.c 3593266d1c Make core code available within the FIPS module пре 5 година
s390x_arch.h 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
s390xcap.c 61d7045bd2 fix --strict-warnings build пре 5 година
s390xcpuid.pl 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
sparc_arch.h 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
sparccpuid.S 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
sparcv9cap.c 41525ed628 Ensure we get all the right defines for AES assembler in FIPS module пре 5 година
sparse_array.c 8ab53b193a Make the sparse array code use ossl_uintmax_t as its index rather than size_t. пре 5 година
threads_none.c 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
threads_pthread.c 3593266d1c Make core code available within the FIPS module пре 5 година
threads_win.c 09305a7d0a Avoid linking error for InitializeCriticalSectionAndSpinCount(). пре 5 година
trace.c bc362b9b72 Convert the ENGINE_CONF trace calls to use CONF instead пре 5 година
uid.c aefb980c45 crypto/uid.c: use own macro as guard rather than AT_SECURE пре 5 година
vms_rms.h 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
x86_64cpuid.pl 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година
x86cpuid.pl 0e9725bcb9 Following the license change, modify the boilerplates in crypto/ пре 6 година

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.